@sitecore-feaas/clientside 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/README.md +7 -7
  2. package/build/components/FEAASComponent.js +72 -10
  3. package/build/components/FEAASComponent.js.map +1 -1
  4. package/build/components/FEAASElement.js +19 -5
  5. package/build/components/FEAASElement.js.map +1 -1
  6. package/build/dom/rendering.js.map +1 -1
  7. package/build/dom/thumbnail.js +29 -24
  8. package/build/dom/thumbnail.js.map +1 -1
  9. package/build/headless.js +5 -0
  10. package/build/headless.js.map +1 -1
  11. package/build/ui/FEAAS.js +5 -0
  12. package/build/ui/FEAAS.js.map +1 -0
  13. package/build/ui/FEAASContext.js +9 -6
  14. package/build/ui/FEAASContext.js.map +1 -1
  15. package/build/ui/FEAASExternal.js +68 -4
  16. package/build/ui/FEAASExternal.js.map +1 -1
  17. package/build/ui/FEAASPicker.js +15 -5
  18. package/build/ui/FEAASPicker.js.map +1 -1
  19. package/build/ui/index.js +3 -4
  20. package/build/ui/index.js.map +1 -1
  21. package/build/ui/react.js +23 -8
  22. package/build/ui/react.js.map +1 -1
  23. package/build/utils/datapath.js +15 -0
  24. package/build/utils/datapath.js.map +1 -1
  25. package/build/utils/fetch.js +40 -0
  26. package/build/utils/fetch.js.map +1 -0
  27. package/build/utils/settings.js +60 -0
  28. package/build/utils/settings.js.map +1 -0
  29. package/dist/browser/headless.cjs +8 -6
  30. package/dist/browser/headless.cjs.map +4 -4
  31. package/dist/browser/headless.esm.js +8 -6
  32. package/dist/browser/headless.esm.js.map +1 -1
  33. package/dist/browser/index.cjs +8 -6
  34. package/dist/browser/index.cjs.map +4 -4
  35. package/dist/browser/index.esm.js +8 -6
  36. package/dist/browser/index.esm.js.map +1 -1
  37. package/dist/browser/react.cjs +8 -6
  38. package/dist/browser/react.cjs.map +4 -4
  39. package/dist/browser/react.esm.js +8 -6
  40. package/dist/browser/react.esm.js.map +1 -1
  41. package/dist/node/headless.cjs +6 -4
  42. package/dist/node/headless.cjs.map +4 -4
  43. package/dist/node/headless.esm.js +6 -4
  44. package/dist/node/headless.esm.js.map +4 -4
  45. package/dist/node/index.cjs +7 -5
  46. package/dist/node/index.cjs.map +4 -4
  47. package/dist/node/index.esm.js +7 -5
  48. package/dist/node/index.esm.js.map +4 -4
  49. package/dist/node/react.cjs +6 -4
  50. package/dist/node/react.cjs.map +4 -4
  51. package/dist/node/react.esm.js +6 -4
  52. package/dist/node/react.esm.js.map +4 -4
  53. package/headless.cjs +6 -4
  54. package/headless.cjs.map +4 -4
  55. package/headless.js +6 -4
  56. package/headless.js.map +4 -4
  57. package/package.json +2 -2
  58. package/react.cjs +8 -6
  59. package/react.cjs.map +4 -4
  60. package/react.js +8 -6
  61. package/react.js.map +4 -4
  62. package/scripts/build.js +1 -1
  63. package/src/components/FEAASComponent.tsx +101 -10
  64. package/src/components/FEAASElement.tsx +30 -5
  65. package/src/dom/rendering.ts +1 -0
  66. package/src/dom/thumbnail.ts +29 -24
  67. package/src/headless.ts +5 -0
  68. package/src/ui/FEAAS.tsx +4 -0
  69. package/src/ui/FEAASContext.tsx +10 -1
  70. package/src/ui/FEAASExternal.tsx +75 -16
  71. package/src/ui/FEAASPicker.tsx +19 -7
  72. package/src/ui/index.ts +4 -4
  73. package/src/ui/react.tsx +48 -14
  74. package/src/utils/datapath.ts +17 -0
  75. package/src/utils/fetch.ts +60 -0
  76. package/src/utils/settings.ts +69 -0
  77. package/test/FEAASComponent.react.test.tsx +1 -1
  78. package/test/FEAASComponent.test.tsx +1 -0
  79. package/test/FEAASComponentData.test.tsx +215 -0
  80. package/test/FEAASContext.test.tsx +3 -3
  81. package/test/FEAASExternal.test.tsx +1 -8
  82. package/test/ServerComponent.test.tsx +33 -0
  83. package/test/fetch-data.ts +55 -0
  84. package/test/settings.test.ts +78 -0
  85. package/types/components/FEAASComponent.d.ts +33 -1
  86. package/types/components/FEAASComponent.d.ts.map +1 -1
  87. package/types/components/FEAASElement.d.ts +10 -1
  88. package/types/components/FEAASElement.d.ts.map +1 -1
  89. package/types/dom/rendering.d.ts.map +1 -1
  90. package/types/dom/thumbnail.d.ts +16 -16
  91. package/types/dom/thumbnail.d.ts.map +1 -1
  92. package/types/headless.d.ts +5 -0
  93. package/types/headless.d.ts.map +1 -1
  94. package/types/tsbuildinfo +1 -1
  95. package/types/ui/FEAAS.d.ts +5 -0
  96. package/types/ui/FEAAS.d.ts.map +1 -0
  97. package/types/ui/FEAASContext.d.ts +8 -0
  98. package/types/ui/FEAASContext.d.ts.map +1 -1
  99. package/types/ui/FEAASExternal.d.ts +56 -3
  100. package/types/ui/FEAASExternal.d.ts.map +1 -1
  101. package/types/ui/FEAASPicker.d.ts +10 -6
  102. package/types/ui/FEAASPicker.d.ts.map +1 -1
  103. package/types/ui/index.d.ts +1 -4
  104. package/types/ui/index.d.ts.map +1 -1
  105. package/types/ui/react.d.ts +7 -2
  106. package/types/ui/react.d.ts.map +1 -1
  107. package/types/ui/tsbuildinfo +1 -1
  108. package/types/utils/datapath.d.ts +2 -0
  109. package/types/utils/datapath.d.ts.map +1 -1
  110. package/types/utils/fetch.d.ts +9 -0
  111. package/types/utils/fetch.d.ts.map +1 -0
  112. package/types/utils/settings.d.ts +13 -0
  113. package/types/utils/settings.d.ts.map +1 -0
@@ -1,7 +1,7 @@
1
- var oe=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ze=Object.prototype.hasOwnProperty;var ge=(t,e)=>{for(var r in e)oe(t,r,{get:e[r],enumerable:!0})},Xe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qe(e))!Ze.call(t,i)&&i!==r&&oe(t,i,{get:()=>e[i],enumerable:!(n=Ye(e,i))||n.enumerable});return t};var et=t=>Xe(oe({},"__esModule",{value:!0}),t);var Dt={};ge(Dt,{Component:()=>J,ComponentProps:()=>Ue,ControlledPromise:()=>S,DEFAULT_CDN_URL:()=>x,Element:()=>g,FEAASComponent:()=>J,FEAASComponentsProps:()=>Ue,FEAASElement:()=>g,FEAASLoader:()=>V,FEAASLoaderProps:()=>Be,FEAASStylesheet:()=>re,FEAASStylesheetProps:()=>je,InvalidResponse:()=>Q,JSONPath:()=>p,Loader:()=>V,MyComponent:()=>G,Stylesheet:()=>re,Thumbnail:()=>ne,autoloadScripts:()=>Ce,cleanCollectionBit:()=>Re,clearFetchCache:()=>xt,createStylesheet:()=>ke,fetchAndRevalidate:()=>I,fetchAndRevalidateComponent:()=>P,fetchAndRevalidateStylesheet:()=>ee,fetchBypassingCache:()=>Z,fetchCache:()=>j,fetchComponent:()=>_t,fetchToValidateCache:()=>W,fetchWithCacheAwareness:()=>N,findStylesheet:()=>Me,getComponentSource:()=>Et,getComponentURL:()=>fe,getFetchCache:()=>$e,getQualifier:()=>gt,getStylesheetSource:()=>St,getStylesheetURL:()=>z,loadScript:()=>B,loadStylesheet:()=>te,loadStylesheetAllowStale:()=>pe,normalizeCollectionScope:()=>he,observeDOMElement:()=>Fe,parseComponentSource:()=>H,parseLimit:()=>vt,parseRange:()=>bt,parseStylesheetSource:()=>X,queryScopes:()=>Y,renderComponent:()=>me,renderComponentElement:()=>Ct,renderComponentPromise:()=>Le,renderDOMContent:()=>$,renderDOMElement:()=>w,renderHTMLContent:()=>At,renderStylesheet:()=>Ft,renderStylesheetPromise:()=>Pe,serializeCH1RichText:()=>O,setDOMAttribute:()=>T});module.exports=et(Dt);function S(t,e=r=>{}){var r;let n=()=>{var i,o;let s=new Promise((u,c)=>{i=l=>{t==null||t(l),u(l)},o=c});var a=Object.assign(s,{resolve:i,reject:o,restart:n,first:r});return r=a,a.catch(e),a};return n()}var tt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,g=class extends tt{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(e=>{this.payload=e}),this.whenRendered=S(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(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(e){this.onError(e)}}log(...e){typeof process!="undefined"&&process.env.TESTING||console.log(...e)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}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)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,n;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var 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}onError(e,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(i),this.whenLoaded.reject(e),!i.defaultPrevented&&!n){this.whenRendered.reject(e);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;let n=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:s}=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.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(n=(r=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:n,ReactDOM:i}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return n.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},n.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:n,ReactDOM:i}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=n.useReducer(u=>u+1,0);return e.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r],i=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==null||n===this.defaultProps[r]?this.removeAttribute(i):(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&this.getAttribute(i)!=String(n)&&this.setAttribute(i,String(n))}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var 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,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(e)&&r.customElements.define(e,this)}};var D=class extends g{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)}},G=class extends D{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",n))}};G.observedAttributes=["counter"];function A(t){return A=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},A(t)}function Ae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function we(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 xe(t,e,r){return e&&we(t.prototype,e),r&&we(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function rt(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&&U(t,e)}function L(t){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},L(t)}function U(t,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},U(t,e)}function Ee(){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 k(t,e,r){return Ee()?k=Reflect.construct.bind():k=function(i,o,s){var a=[null];a.push.apply(a,o);var u=Function.bind.apply(i,a),c=new u;return s&&U(c,s.prototype),c},k.apply(null,arguments)}function nt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function se(t){var e=typeof Map=="function"?new Map:void 0;return se=function(n){if(n===null||!nt(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 k(n,arguments,L(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),U(i,n)},se(t)}function it(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ot(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 it(t)}function st(t){var e=Ee();return function(){var n=L(t),i;if(e){var o=L(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ot(this,i)}}function at(t){return ut(t)||lt(t)||Se(t)||ct()}function ut(t){if(Array.isArray(t))return ae(t)}function lt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Se(t,e){if(t){if(typeof t=="string")return ae(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 ae(t,e)}}function ae(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 ct(){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 dt(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Se(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,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var v=Object.prototype.hasOwnProperty;function C(t,e){return t=t.slice(),t.push(e),t}function ue(t,e){return e=e.slice(),e.unshift(t),e}var ht=function(t){rt(r,t);var e=st(r);function r(n){var i;return Ae(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 xe(r)}(se(Error));function p(t,e,r,n,i){if(!(this instanceof p))try{return new p(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&&A(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 s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||A(a)!=="object")throw new ht(a);return a}}p.prototype.evaluate=function(t,e,r,n){var i=this,o=this.parent,s=this.parentProperty,a=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&&A(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 c=t;e=c.json,a=v.call(t,"flatten")?t.flatten:a,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,s=v.call(t,"parentProperty")?t.parentProperty:s,t=t.path}if(o=o||null,s=s||null,Array.isArray(t)&&(t=p.toPathString(t)),!(!t&&t!==""||!e)){var l=p.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;var h=this._trace(l,e,["$"],o,s,r).filter(function(d){return d&&!d.isParentSelector});return h.length?!u&&h.length===1&&!h[0].hasArrExpr?this._getPreferredOutput(h[0]):h.reduce(function(d,f){var b=i._getPreferredOutput(f);return a&&Array.isArray(b)?d=d.concat(b):d.push(b),d},[]):u?[]:void 0}};p.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(n,r,t)}};p.prototype._trace=function(t,e,r,n,i,o,s,a){var u=this,c;if(!t.length)return c={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(c,o,"value"),c;var l=t[0],h=t.slice(1),d=[];function f(m){Array.isArray(m)?m.forEach(function(Ge){d.push(Ge)}):d.push(m)}if((typeof l!="string"||a)&&e&&v.call(e,l))f(this._trace(h,e[l],C(r,l),e,l,o,s));else if(l==="*")this._walk(e,function(m){f(u._trace(h,e[m],C(r,m),e,m,o,!0,!0))});else if(l==="..")f(this._trace(h,e,r,n,i,o,s)),this._walk(e,function(m){A(e[m])==="object"&&f(u._trace(t.slice(),e[m],C(r,m),e,m,o,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(l==="~")return c={path:C(r,l),value:i,parent:n,parentProperty:null},this._handleCallback(c,o,"property"),c;if(l==="$")f(this._trace(h,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))f(this._slice(l,h,e,r,n,i,o));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var b=l.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(m){u._eval(b,e[m],m,r,n,i)&&f(u._trace(h,e[m],C(r,m),e,m,o,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(ue(this._eval(l,e,r[r.length-1],r.slice(0,-1),n,i),h),e,r,n,i,o,s))}else if(l[0]==="@"){var y=!1,E=l.slice(1,-2);switch(E){case"scalar":(!e||!["object","function"].includes(A(e)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":A(e)===E&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&A(e)===E&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+E)}if(y)return c={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(c,o,"value"),c}else if(l[0]==="`"&&e&&v.call(e,l.slice(1))){var _=l.slice(1);f(this._trace(h,e[_],C(r,_),e,_,o,s,!0))}else if(l.includes(",")){var Ve=l.split(","),q=dt(Ve),be;try{for(q.s();!(be=q.n()).done;){var qe=be.value;f(this._trace(ue(qe,h),e,r,n,i,o,!0))}}catch(m){q.e(m)}finally{q.f()}}else!a&&e&&v.call(e,l)&&f(this._trace(h,e[l],C(r,l),e,l,o,s,!0))}if(this._hasParentSelector)for(var F=0;F<d.length;F++){var K=d[F];if(K&&K.isParentSelector){var M=this._trace(K.expr,e,K.path,n,i,o,s);if(Array.isArray(M)){d[F]=M[0];for(var Ke=M.length,ie=1;ie<Ke;ie++)F++,d.splice(F,0,M[ie])}else d[F]=M}}return d};p.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,n=0;n<r;n++)e(n);else t&&A(t)==="object"&&Object.keys(t).forEach(function(i){e(i)})};p.prototype._slice=function(t,e,r,n,i,o,s){if(Array.isArray(r)){var a=r.length,u=t.split(":"),c=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,h=u[1]&&Number.parseInt(u[1])||a;l=l<0?Math.max(0,l+a):Math.min(a,l),h=h<0?Math.max(0,h+a):Math.min(a,h);for(var d=[],f=l;f<h;f+=c){var b=this._trace(ue(f,e),r,n,i,o,s,!0);b.forEach(function(y){d.push(y)})}return d}};p.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 s=t.includes("@path");s&&(this.currSandbox._$_path=p.toPathString(n.concat([r])));var a="script:"+t;if(!p.cache[a]){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");s&&(u=u.replace(/@path/g,"_$_path")),p.cache[a]=new this.vm.Script(u)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(c){throw new Error("jsonPath: "+c.message+": "+t)}};p.cache={};p.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};p.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};p.toPathArray=function(t){var e=p.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,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,s){return"['"+s.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return e[t]=i,e[t].concat()};var ft=function(e,r,n){for(var i=e.length,o=0;o<i;o++){var s=e[o];n(s)&&r.push(e.splice(o--,1)[0])}},pt=function(){function t(e){Ae(this,t),this.code=e}return xe(t,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];ft(i,o,function(l){return typeof r[l]=="function"});var s=i.map(function(l,h){return r[l]}),a=o.reduce(function(l,h){var d=r[h].toString();return/function/.test(d)||(d="function "+d),"var "+h+"="+d+";"+l},"");n=a+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(";"),c=u>-1?n.slice(0,u+1)+" return "+n.slice(u+1):" return "+n;return k(Function,i.concat([c])).apply(void 0,at(s))}}]),t}();p.prototype.vm={Script:pt};function Y(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((a,u)=>u.length-a.length);for(let a of o)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}i=e.substring(a.length+1),n=t[a];break}var s=p({path:i,json:n});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((a,u,c)=>c.indexOf(a)===u).reduce((a,u)=>a.length>0?a:p({path:u,json:n}),[])),r&&Array.isArray(s)?s[0]:s}function le(t,e={},r){return r?`<${r}${Object.entries(e).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${O(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):O(t)}function O(t){var e;if(Array.isArray(t))return t.map(O).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 le(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>le(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 le(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}var R=class{constructor(e,r=1,n){this.ownerDocument={createElement(i){return new R(i)}},this.nodeName=e,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(e,r){let n=this.attributes.find(i=>i.name===e);n?n.value=r:this.attributes.push({name:e,value:r})}getAttribute(e){let r=this.attributes.find(n=>n.name===e);return r?r.value:void 0}insertBefore(e,r){if(e.parentNode=this,r===null)this.childNodes.push(e);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,e)}}removeAttribute(e){let r=this.attributes.findIndex(n=>n.name===e);r!==-1&&this.attributes.splice(r,1)}appendChild(e){e.parentNode=this,this.childNodes.push(e)}get tagName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toUpperCase()}get localName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toLowerCase()}get innerHTML(){return ce(this.childNodes)}set innerHTML(e){this.childNodes=de(String(e!=null?e:""))}get outerHTML(){return ce([this])}get children(){return this.childNodes.filter(e=>e.nodeType==1)}closest(e){let r=this;for(;r;){if(_e(e,r))return r;r=r.parentNode}return null}querySelectorAll(e){let r=e.split(/\s*,\s*/),n=[],i=o=>{for(let s of r)if(_e(s,o)){n.push(o);break}for(let s of o.childNodes)i(s)};for(let o of this.childNodes)i(o);return n}querySelector(e){return this.querySelectorAll(e)[0]}findSibling(e,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let o=i+e;o>=0&&o<n.length;o+=e){let s=n[o];if(!r||s.nodeType===1)return s}return null}removeChild(e){let r=this.childNodes.indexOf(e);if(r!==-1)return this.childNodes.splice(r,1),e.parentNode=void 0,e}get previousSibling(){return this.findSibling(-1)}get nextSibling(){return this.findSibling(1)}get previousElementSibling(){return this.findSibling(-1,!0)}get nextElementSibling(){return this.findSibling(1,!0)}cloneNode(e=!1){let r=new R(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),e)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var e;return((e=this.parentNode)===null||e===void 0?void 0:e.nodeType)==1?this.parentNode:null}};function _e(t,e){let r=t.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(e.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(e.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let o=i[1],s=i[3],a=e.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(e.nodeName!==n)return!1;return!0}function de(t){var e;let r=[],n=[];for(;t;){let i=t.match(/^<([\w-]+)(\s[^>]*)?>/),o=t.match(/^<\/([\w-]+)>/);if(i){let s=i[1],u=((e=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||e===void 0?void 0:e.map(l=>{let[h,d,,f]=l.match(/([\w-]+)(="([^"]*)")?/);return{name:d,value:yt(f||"")}}))||[],c=new R(s,1);if(c.attributes=u,n.length>0){let l=n[n.length-1];l.childNodes.push(c),c.parentNode=l}else r.push(c);n.push(c),t=t.slice(i[0].length)}else if(o)n.pop(),t=t.slice(o[0].length);else{let s=t.indexOf("<"),a=t.slice(0,s!==-1?s:void 0),u=new R("#text",3);if(u.textContent=a,n.length>0){let c=n[n.length-1];c.childNodes.push(u),u.parentNode=c}else r.push(u);t=t.slice(a.length)}}return r}function mt(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function yt(t){return t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function ce(t){return t.map(e=>{if(e.nodeType===3)return e.textContent||"";let{nodeName:r,attributes:n}=e,i=n.map(({name:s,value:a})=>` ${s}="${mt(String(a))}"`).join(""),o=ce(e.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function Fe(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&B(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&Ce(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function Ce(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];B(i,i.getAttribute("data-embed-src"))}if(e)return Fe(t)}function B(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.setAttribute("type","module"),o.setAttribute("src",e),r.appendChild(o);break}}var vt=t=>{var e;let r=parseInt((e=t==null?void 0:t.match(/\[0:(\d+)\]/))===null||e===void 0?void 0:e[1],10);return!isNaN(r)&&r>0?String(r):null},bt=t=>{var e;let r=(e=t==null?void 0:t.match(/\[([^\]]+)\]/))===null||e===void 0?void 0:e[1].split(/\s*,\s*/g).filter(Boolean).map(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=t=>{var e;return(e=t==null?void 0:t.match(/(\.\*|\[[^\]]+\])$/))===null||e===void 0?void 0:e[0]};function Re(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function he(t){return Re(t)+".*"}function De(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 wt(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=De(t);if(i!=0)return;let o=t.parentNode;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=i+1,a=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(s++,a=u);for(var c=s;c<e;c++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var c=Math.max(1,e);c<s;c++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function T(t,e,r,n){var i,o;if(t){var s=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=O(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"){let d=Array.from(t.children).find(f=>f.localName=="picture")||t;s=t.localName=="img"?t:d.querySelector("img, video")}else if(e=="data-path-href")s=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")s=(Array.from(t.children).find(f=>f.localName=="picture")||t).querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")a="innerHTML";else if(e=="data-embed-src")B(t,r);else if(e=="data-path-attributes"){let d=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var u in r){var c=r[u];T(t,u,typeof c=="object"&&c?JSON.stringify(c):c,n)}for(var l=0;l<d.length;l++)(r==null||!(d[l]in r))&&T(t,d[l],null,n);T(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!s){var h=String((o=t.getAttribute("data-path-placeholder")||s[a])!==null&&o!==void 0?o:s.getAttribute(a));r!=null?a=="innerHTML"?s.innerHTML!=r&&(s.innerHTML=r):s.getAttribute(a)!=r&&s.setAttribute(a,r):a=="innerHTML"?s.innerHTML=h:s.removeAttribute(a)}}}var Ne=["data-attributes-keys","data-path-attributes","data-path-scope"];function w(t,e,r,n){var i,o,s;let a=t;if(n||(e=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,a,e))||e),a.nodeType==1){let l=a.getAttribute("data-path-scope");if(l){let d=De(a),f=Y(e,l,!1)||[];d==0&&wt(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,f))===!1?1:f.length,r),e={...e,[he(l)]:f[d]}}let h=Array.prototype.slice.call(a.attributes).sort((d,f)=>Ne.indexOf(d.name)-Ne.indexOf(f.name));for(var u=0;u<h.length;u++){let{name:d,value:f}=h[u];d.startsWith("data-path")&&d!="data-path-scope"&&T(a,d,Y(e,f,!0),r),d=="data-embed-src"&&T(a,d,a.getAttribute(d),r)}}for(var u=0,c;c=a.childNodes[u++];)Oe(c)&&w(c,e,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function Oe(t){return t.nodeType==1}function $(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(var a=0,u;u=t.childNodes[a++];)Oe(u)&&(u.className=u.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return w(t,r,n)}function At(t,e,r,n=!1){var i;let o=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,t,e))||t;if(typeof document=="undefined"||n){let s=de(o);return w(s[0],e,r).outerHTML}else{let s=document.createElement("div");return s.innerHTML=o,w(s,e,r),s.innerHTML}}var Te=["initial","check","updated"],j={};function xt(){j={}}async function I(t,e,r,n,i=j){return N({url:t,options:e,validator:r,callback:n,cache:i}).then(W).then(o=>o.response)}function $e(t,e=!1){let r=String(t).replace("?head","");var n=j[r];return!n&&!e&&(n=j[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),n}var Q=class extends Error{};async function N({url:t,options:e,validator:r,callback:n,cache:i},o="initial"){let s=new Date;if(i!=null){var a=$e(t);if(Te.indexOf(a.phase)>=Te.indexOf(o))var u=a[o];else a.phase=o}let c=await(u||fetch(t,e));if(!u&&a&&(c.ok?a[o].resolve(c):a[o].reject(new Error("Fetch failed"))),!c.ok)throw new Error("Fetch failed");let l=new Date(c.headers.get("date"))<s||u&&o=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(c,l))===!1)throw new Q("Response is not valid");return await(n==null?void 0:n(c,o,l)),{url:t,options:e,isCached:l,response:c,validator:r,callback:n,cache:i}}async function W(t){let{url:e,isCached:r,options:n,validator:i,response:o,cache:s}=t;if(r){let{response:a}=await N({url:e+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return Z(t)}return t}async function Z(t){return N({...t,options:{...t.options,cache:"reload"}},"updated")}var x="https://feaas.blob.core.windows.net";function H(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,n,i,o,s]=e;return{cdn:r,library:n,component:i,version:o,revision:s}}}function Et(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=x?`${t.cdn}/components`:""}/${t.library}/${t.component}/${!t.version||t.version=="responsive"&&(!t.revision||t.revision=="published")?"":t.version}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function St(t){return`${t.cdn&&t.cdn!=x?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function X(t){let e=t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,n,i]=e;return{cdn:r,library:n,revision:i}}else{let o=H(t);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 fe(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...H(t.src)}),`${t.cdn||t.hostname||x}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function z(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...X(t.src)}),`${t.cdn||t.hostname||x}/styles/${t.library}/${t.revision||"published"}.css`}async function P(t,e,r=!1){let n=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,i=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&N({options:{headers:{Accept:"text/html"},credentials:"omit"},url:fe({...t,version:t.instance}),validator:n}).catch(a=>a),N({url:fe(t),validator:n}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(u=>u&&u instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await i(s.response),r?s:W({...s,callback:i}).catch(a=>{if(o[0]==s&&(Z({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),W({...o[1],callback:i});throw a})}async function _t(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await P(t,n=>{e=n},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function ee(t,e){return typeof t=="string"&&(t={src:t}),I(z(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>e(i,n)))}function Ft(t,e){return Pe(t,e||(e=document.createElement("style"))),e}function Pe(t,e){return e||(e=document.createElement("style")),ee(t,(r,n)=>{e.textContent=r}).then(()=>e)}function te(t,e){var r=Me(t);if(!r)var n=ke(t);return ee(t,(i,o)=>{n&&(n.textContent=i),e==null||e(i,o)}).then(()=>r||n)}function pe(t){return new Promise((e,r)=>{te(t,e).catch(r)})}function Me(t){return document.head.querySelector(`style[data-href="${z(t)}"]`)}function ke(t){let e=z(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function Ct(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return w(n,e),r}function me(t,e){return Le(t,e||(e=document.createElement("div"))),e}async function Le(t,e){return e||(e=document.createElement("div")),e.childNodes.length?w(e,t.data,t):"template"in t?$(e,t.template,t.data,t):P(t,r=>$(e,r,t.data,t)).then(()=>e)}function Ue(t){var e,r,n,i,o,s,a,u;let c,l=t.getAttribute("src");if(l){let _=H(l);if(!_)throw new Error(`Could not parse FEAAS Component source: ${l}`);var{cdn:h,library:d,component:f,version:b,revision:y}=_}let E=t.getAttribute("data");if(E!=null&&E!="")try{c=typeof E=="string"?JSON.parse(E):{}}catch(_){}return{data:c||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:h)!==null&&r!==void 0?r:x,library:(n=t.getAttribute("library"))!==null&&n!==void 0?n:d,component:(i=t.getAttribute("component"))!==null&&i!==void 0?i:f,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:b)!==null&&s!==void 0?s:"responsive",revision:(u=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:y)!==null&&u!==void 0?u:"published",hostname:t.getAttribute("hostname"),template:t.getAttribute("template"),instance:t.getAttribute("instance"),editable:t.getAttribute("editable")!=null,suspended:t.getAttribute("suspended")!=null,lastModified:t.getAttribute("last-modified"),withStylesheet:t.getAttribute("with-stylesheet")!="false"}}var J=class extends g{setData(e){this.set({data:e})}getProps(){return Ue(this)}attributeChangedCallback(e,r,n){r!==n&&((e=="library"||e=="component"||e=="revision"||e=="version")&&(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}constructor(){super(),this.defaultProps={cdn:x,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=e=>{this.payload=e,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var 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()){if(this.props.withStylesheet)var e=pe({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,P(this.props,r=>{this.payload=r,e||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)w(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;$(this,this.payload,this.props.data)}}};J.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];J.register("feaas-component");function Be(t){return{opacity:t!=null&&t.getAttribute("opacity")?parseFloat(t==null?void 0:t.getAttribute("opacity")):1,hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var V=class extends g{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Be(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 fe=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ht=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var r in t)fe(e,r,{get:t[r],enumerable:!0})},ft=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dt(t))!ht.call(e,i)&&i!==r&&fe(e,i,{get:()=>t[i],enumerable:!(n=ct(t,i))||n.enumerable});return e};var pt=e=>ft(fe({},"__esModule",{value:!0}),e);var Wt={};P(Wt,{Component:()=>V,ComponentProps:()=>Qe,ControlledPromise:()=>A,DEFAULT_CDN_URL:()=>S,DOM:()=>re,DataSettings:()=>ce,Datapath:()=>te,Datascope:()=>Z,Element:()=>x,FEAASComponent:()=>V,FEAASComponentsProps:()=>Qe,FEAASElement:()=>x,FEAASLoader:()=>K,FEAASLoaderProps:()=>Xe,FEAASStylesheet:()=>ue,FEAASStylesheetProps:()=>Ze,InvalidResponse:()=>ne,JSONPath:()=>p,Loader:()=>K,MyComponent:()=>X,Stylesheet:()=>ue,Thumbnail:()=>de,autoloadScripts:()=>$e,cleanCollectionBit:()=>W,clearFetchCache:()=>Tt,createStylesheet:()=>Ve,fetchAndRevalidate:()=>z,fetchAndRevalidateComponent:()=>k,fetchAndRevalidateStylesheet:()=>ae,fetchBypassingCache:()=>ie,fetchCache:()=>H,fetchComponent:()=>kt,fetchData:()=>Ee,fetchToValidateCache:()=>J,fetchWithCacheAwareness:()=>T,findStylesheet:()=>Ge,getComponentSource:()=>Pt,getComponentURL:()=>we,getFetchCache:()=>Je,getHumanizedLabel:()=>je,getLastPathBit:()=>Ue,getQualifier:()=>Le,getStylesheetSource:()=>$t,getStylesheetURL:()=>G,isDataSettings:()=>le,loadScript:()=>I,loadStylesheet:()=>se,loadStylesheetAllowStale:()=>Ae,normalizeCollectionScope:()=>ee,observeDOMElement:()=>Pe,parseComponentSource:()=>q,parseLimit:()=>ke,parseRange:()=>Me,parseStylesheetSource:()=>oe,queryScopes:()=>B,renderComponent:()=>xe,renderComponentElement:()=>Lt,renderComponentPromise:()=>Ke,renderDOMContent:()=>O,renderDOMElement:()=>g,renderHTMLContent:()=>He,renderStylesheet:()=>Mt,renderStylesheetPromise:()=>qe,serializeCH1RichText:()=>R,setDOMAttribute:()=>N});module.exports=pt(Wt);function A(e,t=r=>{}){var r;let n=()=>{var i,o;let a=new Promise((l,c)=>{i=u=>{e==null||e(u),l(u)},o=c});var s=Object.assign(a,{resolve:i,reject:o,restart:n,first:r});return r=s,s.catch(t),s};return n()}var mt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,x=class extends mt{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=A(t=>{this.payload=t}),this.whenRendered=A(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),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{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))}log(...t){typeof process!="undefined"&&process.env.TESTING||console.log(...t)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(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.refs.topReact&&!this.forceUpdateReact?a?(this.reactRoot||(this.reactRoot=a.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(n=(r=this.refs.topReact).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).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 n=this.props[r],i=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==null||n===this.defaultProps[r]?this.removeAttribute(i):(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&this.getAttribute(i)!=String(n)&&this.setAttribute(i,String(n))}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(t){return import( /*@vite-ignore*/ /* webpackIgnore: true */ t)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(t=>{})})}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var 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 $=class extends x{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)}},X=class extends ${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))}};X.observedAttributes=["counter"];var re={};P(re,{renderDOMContent:()=>O,renderDOMElement:()=>g,renderHTMLContent:()=>He,setDOMAttribute:()=>N});var Z={};P(Z,{JSONPath:()=>p,queryScopes:()=>B,serializeCH1RichText:()=>R});function E(e){return E=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},E(e)}function Re(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fe(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&&Fe(e.prototype,t),r&&Fe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function yt(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 j(e){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},j(e)}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},U(e,t)}function Ne(){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 L(e,t,r){return Ne()?L=Reflect.construct.bind():L=function(i,o,a){var s=[null];s.push.apply(s,o);var l=Function.bind.apply(i,s),c=new l;return a&&U(c,a.prototype),c},L.apply(null,arguments)}function vt(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function pe(e){var t=typeof Map=="function"?new Map:void 0;return pe=function(n){if(n===null||!vt(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 L(n,arguments,j(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),U(i,n)},pe(e)}function bt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gt(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 bt(e)}function wt(e){var t=Ne();return function(){var n=j(e),i;if(t){var o=j(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return gt(this,i)}}function At(e){return xt(e)||Et(e)||Oe(e)||St()}function xt(e){if(Array.isArray(e))return me(e)}function Et(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Oe(e,t){if(e){if(typeof e=="string")return me(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 me(e,t)}}function me(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
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _t(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Oe(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
+ 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 b=Object.prototype.hasOwnProperty;function F(e,t){return e=e.slice(),e.push(t),e}function ye(e,t){return t=t.slice(),t.unshift(e),t}var Ct=function(e){yt(r,e);var t=wt(r);function r(n){var i;return Re(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)}(pe(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&&E(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=b.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||E(s)!=="object")throw new Ct(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&&E(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(!b.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var c=e;t=c.json,s=b.call(e,"flatten")?e.flatten:s,this.currResultType=b.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=b.call(e,"sandbox")?e.sandbox:this.currSandbox,l=b.call(e,"wrap")?e.wrap:l,this.currPreventEval=b.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=b.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=b.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=b.call(e,"parent")?e.parent:o,a=b.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 u=p.toPathArray(e);u[0]==="$"&&u.length>1&&u.shift(),this._hasParentSelector=null;var h=this._trace(u,t,["$"],o,a,r).filter(function(d){return d&&!d.isParentSelector});return h.length?!l&&h.length===1&&!h[0].hasArrExpr?this._getPreferredOutput(h[0]):h.reduce(function(d,f){var w=i._getPreferredOutput(f);return s&&Array.isArray(w)?d=d.concat(w):d.push(w),d},[]):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,c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:a},this._handleCallback(c,o,"value"),c;var u=e[0],h=e.slice(1),d=[];function f(m){Array.isArray(m)?m.forEach(function(ut){d.push(ut)}):d.push(m)}if((typeof u!="string"||s)&&t&&b.call(t,u))f(this._trace(h,t[u],F(r,u),t,u,o,a));else if(u==="*")this._walk(t,function(m){f(l._trace(h,t[m],F(r,m),t,m,o,!0,!0))});else if(u==="..")f(this._trace(h,t,r,n,i,o,a)),this._walk(t,function(m){E(t[m])==="object"&&f(l._trace(e.slice(),t[m],F(r,m),t,m,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(u==="~")return c={path:F(r,u),value:i,parent:n,parentProperty:null},this._handleCallback(c,o,"property"),c;if(u==="$")f(this._trace(h,t,r,null,null,o,a));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(u))f(this._slice(u,h,t,r,n,i,o));else if(u.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var w=u.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(m){l._eval(w,t[m],m,r,n,i)&&f(l._trace(h,t[m],F(r,m),t,m,o,!0))})}else if(u[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(ye(this._eval(u,t,r[r.length-1],r.slice(0,-1),n,i),h),t,r,n,i,o,a))}else if(u[0]==="@"){var y=!1,v=u.slice(1,-2);switch(v){case"scalar":(!t||!["object","function"].includes(E(t)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":E(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&&E(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 c={path:r,value:t,parent:n,parentProperty:i},this._handleCallback(c,o,"value"),c}else if(u[0]==="`"&&t&&b.call(t,u.slice(1))){var _=u.slice(1);f(this._trace(h,t[_],F(r,_),t,_,o,a,!0))}else if(u.includes(",")){var at=u.split(","),Y=_t(at),Ce;try{for(Y.s();!(Ce=Y.n()).done;){var st=Ce.value;f(this._trace(ye(st,h),t,r,n,i,o,!0))}}catch(m){Y.e(m)}finally{Y.f()}}else!s&&t&&b.call(t,u)&&f(this._trace(h,t[u],F(r,u),t,u,o,a,!0))}if(this._hasParentSelector)for(var C=0;C<d.length;C++){var Q=d[C];if(Q&&Q.isParentSelector){var M=this._trace(Q.expr,t,Q.path,n,i,o,a);if(Array.isArray(M)){d[C]=M[0];for(var lt=M.length,he=1;he<lt;he++)C++,d.splice(C,0,M[he])}else d[C]=M}}return d};p.prototype._walk=function(e,t){if(Array.isArray(e))for(var r=e.length,n=0;n<r;n++)t(n);else e&&E(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(":"),c=l[2]&&Number.parseInt(l[2])||1,u=l[0]&&Number.parseInt(l[0])||0,h=l[1]&&Number.parseInt(l[1])||s;u=u<0?Math.max(0,u+s):Math.min(s,u),h=h<0?Math.max(0,h+s):Math.min(s,h);for(var d=[],f=u;f<h;f+=c){var w=this._trace(ye(f,t),r,n,i,o,a,!0);w.forEach(function(y){d.push(y)})}return d}};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(c){throw new Error("jsonPath: "+c.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 Ft=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])}},Rt=function(){function e(t){Re(this,e),this.code=t}return De(e,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];Ft(i,o,function(u){return typeof r[u]=="function"});var a=i.map(function(u,h){return r[u]}),s=o.reduce(function(u,h){var d=r[h].toString();return/function/.test(d)||(d="function "+d),"var "+h+"="+d+";"+u},"");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(";"),c=l>-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return L(Function,i.concat([c])).apply(void 0,At(a))}}]),e}();p.prototype.vm={Script:Rt};function B(e,t,r=!1,n=e){var i=t;let o=Object.keys(e).sort((s,l)=>l.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=p({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,l,c)=>c.indexOf(s)===l).reduce((s,l)=>s.length>0?s:p({path:l,json:n}),[])),r&&Array.isArray(a)?a[0]:a}function ve(e,t={},r){return r?`<${r}${Object.entries(t).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${R(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):R(e)}function R(e){var t;if(Array.isArray(e))return e.map(R).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 ve(e.content,n,"h"+r);case"text":return(e.marks||[]).reduce((i,o)=>ve(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 ve(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var D=class{constructor(t,r=1,n){this.ownerDocument={createElement(i){return new D(i)}},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 be(this.childNodes)}set innerHTML(t){this.childNodes=ge(String(t!=null?t:""))}get outerHTML(){return be([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(Te(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(Te(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 D(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 Te(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 ge(e){var t;let r=[],n=[];for(;e;){let i=e.match(/^<([\w-]+)(\s[^>]*)?>/),o=e.match(/^<\/([\w-]+)>/);if(i){let a=i[1],l=((t=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(u=>{let[h,d,,f]=u.match(/([\w-]+)(="([^"]*)")?/);return{name:d,value:Nt(f||"")}}))||[],c=new D(a,1);if(c.attributes=l,n.length>0){let u=n[n.length-1];u.childNodes.push(c),c.parentNode=u}else r.push(c);n.push(c),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 D("#text",3);if(l.textContent=s,n.length>0){let c=n[n.length-1];c.childNodes.push(l),l.parentNode=c}else r.push(l);e=e.slice(s.length)}}return r}function Dt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Nt(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function be(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}="${Dt(String(s))}"`).join(""),o=be(t.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function Pe(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&I(i,o),n.addedNodes&&n.addedNodes.forEach(a=>{a.nodeType==1&&$e(a,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function $e(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];I(i,i.getAttribute("data-embed-src"))}if(t)return Pe(e)}function I(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 te={};P(te,{cleanCollectionBit:()=>W,getHumanizedLabel:()=>je,getLastPathBit:()=>Ue,getQualifier:()=>Le,normalizeCollectionScope:()=>ee,parseLimit:()=>ke,parseRange:()=>Me});var ke=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},Me=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},Le=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]+\])$/))===null||t===void 0?void 0:t[0]};function W(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ee(e){return W(e)+".*"}function je(e,t=2){var r=W(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 Ue(e){return W(e).split(".").pop()}function Ie(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 Ot(e,t,r){let n=e.getAttribute("data-path-scope");if(n==null)return;var i=Ie(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 c=a;c<t;c++)o.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var c=Math.max(1,t);c<a;c++)s=s.previousElementSibling,o.removeChild(s.nextElementSibling)}}function N(e,t,r,n){var i,o;if(e){var a=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=R(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(e,t,r));var s=t.replace("data-path-","");if(t=="data-path-src"){let d=Array.from(e.children).find(f=>f.localName=="picture")||e;a=e.localName=="img"?e:d.querySelector("img, video")}else if(t=="data-path-href")a=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")a=(Array.from(e.children).find(f=>f.localName=="picture")||e).querySelector("img, picture");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")s="innerHTML";else if(t=="data-embed-src")I(e,r);else if(t=="data-path-attributes"){let d=((i=e.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var l in r){var c=r[l];N(e,l,typeof c=="object"&&c?JSON.stringify(c):c,n)}for(var u=0;u<d.length;u++)(r==null||!(d[u]in r))&&N(e,d[u],null,n);N(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!a){var h=String((o=e.getAttribute("data-path-placeholder")||a[s])!==null&&o!==void 0?o:a.getAttribute(s));r!=null?s=="innerHTML"?a.innerHTML!=r&&(a.innerHTML=r):a.getAttribute(s)!=r&&a.setAttribute(s,r):s=="innerHTML"?a.innerHTML=h:a.removeAttribute(s)}}}var Be=["data-attributes-keys","data-path-attributes","data-path-scope"];function g(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 u=s.getAttribute("data-path-scope");if(u){let d=Ie(s),f=B(t,u,!1)||[];d==0&&Ot(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,[ee(u)]:f[d]}}let h=Array.prototype.slice.call(s.attributes).sort((d,f)=>Be.indexOf(d.name)-Be.indexOf(f.name));for(var l=0;l<h.length;l++){let{name:d,value:f}=h[l];d.startsWith("data-path")&&d!="data-path-scope"&&N(s,d,B(t,f,!0),r),d=="data-embed-src"&&N(s,d,s.getAttribute(d),r)}}for(var l=0,c;c=s.childNodes[l++];)We(c)&&g(c,t,r,!0);return n||(a=r==null?void 0:r.onRender)===null||a===void 0||a.call(r,s,t),s}function We(e){return e.nodeType==1}function O(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(var s=0,l;l=e.childNodes[s++];)We(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return g(e,r,n)}function He(e,t,r,n=!1){var i;let o=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,e,t))||e;if(typeof document=="undefined"||n){let a=ge(o);return g(a[0],t,r).outerHTML}else{let a=document.createElement("div");return a.innerHTML=o,g(a,t,r),a.innerHTML}}var ze=["initial","check","updated"],H={};function Tt(){H={}}async function z(e,t,r,n,i=H){return T({url:e,options:t,validator:r,callback:n,cache:i}).then(J).then(o=>o.response)}function Je(e,t=!1){let r=String(e).replace("?head","");var n=H[r];return!n&&!t&&(n=H[r]={phase:null,initial:A(),check:A(),updated:A(),final:A()}),n}var ne=class extends Error{};async function T({url:e,options:t,validator:r,callback:n,cache:i},o="initial"){let a=new Date;if(i!=null){var s=Je(e);if(ze.indexOf(s.phase)>=ze.indexOf(o))var l=s[o];else s.phase=o}let c=await(l||fetch(e,t));if(!l&&s&&(c.ok?s[o].resolve(c):s[o].reject(new Error("Fetch failed"))),!c.ok)throw new Error("Fetch failed");let u=new Date(c.headers.get("date"))<a||l&&o=="initial"&&(s.phase=="updated"||s.phase=="check");if((r==null?void 0:r(c,u))===!1)throw new ne("Response is not valid");return await(n==null?void 0:n(c,o,u)),{url:e,options:t,isCached:u,response:c,validator:r,callback:n,cache:i}}async function J(e){let{url:t,isCached:r,options:n,validator:i,response:o,cache:a}=e;if(r){let{response:s}=await T({url:t+"?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 ie(e)}return e}async function ie(e){return T({...e,options:{...e.options,cache:"reload"}},"updated")}var S="https://feaas.blob.core.windows.net";function q(e){let t=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 Pt(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=S?`${e.cdn}/components`:""}/${e.library}/${e.component}/${!e.version||e.version=="responsive"&&(!e.revision||e.revision=="published")?"":e.version}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function $t(e){return`${e.cdn&&e.cdn!=S?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function oe(e){let t=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=q(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 we(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...q(e.src)}),`${e.cdn||e.hostname||S}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function G(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...oe(e.src)}),`${e.cdn||e.hostname||S}/styles/${e.library}/${e.revision||"published"}.css`}async function k(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&&T({options:{headers:{Accept:"text/html"},credentials:"omit"},url:we({...e,version:e.instance}),validator:n}).catch(s=>s),T({url:we(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:J({...a,callback:i}).catch(s=>{if(o[0]==a&&(ie({...a,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),J({...o[1],callback:i});throw s})}async function kt(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await k(e,n=>{t=n},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function ae(e,t){return typeof e=="string"&&(e={src:e}),z(G(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 Mt(e,t){return qe(e,t||(t=document.createElement("style"))),t}function qe(e,t){return t||(t=document.createElement("style")),ae(e,(r,n)=>{t.textContent=r}).then(()=>t)}function se(e,t){var r=Ge(e);if(!r)var n=Ve(e);return ae(e,(i,o)=>{n&&(n.textContent=i),t==null||t(i,o)}).then(()=>r||n)}function Ae(e){return new Promise((t,r)=>{se(e,t).catch(r)})}function Ge(e){return document.head.querySelector(`style[data-href="${G(e)}"]`)}function Ve(e){let t=G(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function Lt(e,t){let r=document.createElement("div");r.innerHTML=e;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return g(n,t),r}function xe(e,t){return Ke(e,t||(t=document.createElement("div"))),t}async function Ke(e,t){return t||(t=document.createElement("div")),t.childNodes.length?g(t,e.data,e):"template"in e?O(t,e.template,e.data,e):k(e,r=>O(t,r,e.data,e)).then(()=>t)}var le=e=>{if(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},Ye=async e=>{try{let t=await fetch(e.url,e);return t?await t.json():{}}catch(t){return{}}};async function Ee(e){if(!e)return e;if(le(e))return Ye(e);let t=Object.keys(e),r=await Promise.all(t.map(n=>le(e[n])?Ye(e[n]):null).filter(Boolean));return t.reduce((n,i)=>({...n,[i]:le(e[i])?r.shift():e[i]}),{})}function Qe(e){var t,r,n,i,o,a,s,l;let c,u=e.getAttribute("src");if(u){let _=q(u);if(!_)throw new Error(`Could not parse FEAAS Component source: ${u}`);var{cdn:h,library:d,component:f,version:w,revision:y}=_}let v=e.getAttribute("data");if(v!=null&&v!="")try{c=typeof v=="string"?JSON.parse(v):{}}catch(_){console.error(_)}return{data:c||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:h)!==null&&r!==void 0?r:S,library:(n=e.getAttribute("library"))!==null&&n!==void 0?n:d,component:(i=e.getAttribute("component"))!==null&&i!==void 0?i:f,version:(a=(o=e.getAttribute("version"))!==null&&o!==void 0?o:w)!==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"),withStylesheet:e.getAttribute("with-stylesheet")!="false"}}var V=class extends x{setData(t){this.set({data:t})}getProps(){return Qe(this)}attributeChangedCallback(t,r,n){r!==n&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,n),t==="data"&&this.fetchData())}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let t=await Ee(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=A(t=>this.readyData=t,t=>this.onError(t)),this.defaultProps={cdn:S,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=t=>{this.payload=t,this.advance()},this.getAttribute("data")||this.whenDataReady.resolve({}),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var 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())return;let t=()=>{this.payload&&(r||this.readyData&&this.onLoad(this.payload))};if(this.props.withStylesheet)var r=Ae({...this.props,revision:"published"}).then(()=>{r=null,t()});return Promise.all([r,this.whenDataReady.then(()=>t()),k(this.props,n=>{this.payload=n,t()})]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)g(this,this.readyData);else{if(this.needsRefresh=!0,this.getOriginal())return;O(this,this.payload,this.readyData)}}};V.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];V.register("feaas-component");function Xe(e){return{opacity:e!=null&&e.getAttribute("opacity")?parseFloat(e==null?void 0:e.getAttribute("opacity")):1,hidden:(e==null?void 0:e.getAttribute("hidden"))!=null}}var K=class extends x{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Xe(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,8 +65,10 @@ 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)}};V.observedAttributes=["hidden","opacity"];V.register("feaas-loader");function je(t){var e,r,n,i;let o=t.getAttribute("src");if(o)var{cdn:s,library:a,revision:u}=X(o);return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:u)!==null&&r!==void 0?r:"published",cdn:(i=(n=t==null?void 0:t.getContextAttribute("cdn"))!==null&&n!==void 0?n:t==null?void 0:t.getContextAttribute("hostname"))!==null&&i!==void 0?i:x}}var re=class extends g{constructor(){super(...arguments),this.onLoad=e=>{this.payload=e,this.advance()}}getProps(){return je(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return te(this.props,this.onLoad)}};re.register("feaas-stylesheet");var ne={};ge(ne,{convertBase64toBlob:()=>Ie,generate:()=>ze,get:()=>Rt,getVersionForThumbnail:()=>We,load:()=>He,responseToImage:()=>ye,upload:()=>Je});var Ie=t=>fetch(t).then(e=>e.blob()),ye=t=>t.blob().then(e=>new Promise((r,n)=>{let i=new Image;i.onerror=n,i.onload=()=>{r(i)},i.src=URL.createObjectURL(e)}));async function We(t){return t.versions.length||await t.versions.fetch(),t.getVersionForWidth(800)}async function Rt(t,e,r){try{if(!t.isNew)return await He(t,e,r)}catch(i){t.sdk.log(`FEAAS: Thumbnail ${t.id}, version: ${(e==null?void 0:e.id)||"responsive"}, status: generating ${status}, reason: ${i}`)}let n=await ze(t,e);return r==null||r(n,!1),n&&!t.isNew&&Ie(n.src).then(i=>Je(t,e,i)),n}async function He(t,e,r){let n=e?e.getThumbnailURL():t.getThumbnailURL(),i=t.library.stylesheet,o=new Date(Math.max(Number(t.modifiedAt),Number(i.modifiedAt)));t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, loading`);var s;return await I(n,{},(a,u)=>{let c=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(o))<2e3;return u&&!c&&ye(a).then(l=>{s=l,r(l,u)}),c},(a,u,c)=>{t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, status: ${u}`),ye(a).then(l=>{s=l,r(l,c)})},null),s}async function ze(t,e){let r=e||(t.isNew?null:await We(t));if(!r||r.isViewEmpty())return null;let{stylesheet:n,datasources:i}=t.library;return await Nt(r.classList,n.getBreakpointForWidth(800,r.getBreakpoints()),r.view,i.reduce((s,a)=>Object.assign(s,{[a.id]:a.sample}),{}),n.css,t.sdk)}function Nt(t,e,r,n,i,o){let s=document.createElement("iframe");return s.style.position="absolute",s.style.top="-2000px",s.style.left="-2000px",s.style.width=e.props.minWidth+"px",s.style.height="720px",s.style.zIndex="100011",document.body.appendChild(s),new Promise((a,u)=>{let c=document.createElement("script");c.onerror=u,c.src=o.frontend+"/assets/html2canvas.js",c.onload=()=>{var d;(((d=s.contentWindow.document.fonts)===null||d===void 0?void 0:d.ready)||Promise.resolve()).then(function(){return s.contentWindow.html2canvas(h,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,e.props.minWidth))),width:Math.min(1401,Math.max(320,e.props.minWidth)),height:Math.max(1,Math.min(2e3,h.offsetHeight)),windowWidth:e.props.minWidth+"px",windowHeight:1e3,proxy:o.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(f=>{let b=f.toDataURL("image/jpeg",.6);s.parentElement.removeChild(s);let y=new Image;y.onload=()=>{a(y)},y.onerror=u,y.src=b})})},s.contentWindow.document.head.appendChild(c);let l=s.contentWindow.document.createElement("style");l.textContent=`
68
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};K.observedAttributes=["hidden","opacity"];K.register("feaas-loader");function Ze(e){var t,r,n,i;let o=e.getAttribute("src");if(o)var{cdn:a,library:s,revision:l}=oe(o);return{library:e==null?void 0:e.getContextAttribute("library"),revision:(r=(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:l)!==null&&r!==void 0?r:"published",cdn:(i=(n=e==null?void 0:e.getContextAttribute("cdn"))!==null&&n!==void 0?n:e==null?void 0:e.getContextAttribute("hostname"))!==null&&i!==void 0?i:S}}var ue=class extends x{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return Ze(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return se(this.props,this.onLoad)}};ue.register("feaas-stylesheet");var ce={};P(ce,{clean:()=>jt,normalize:()=>et,toFetchArguments:()=>Ut});function jt(e){let t={},r=(e==null?void 0:e.method)==="GET"||(e==null?void 0:e.method)==="HEAD"||Object.keys((e==null?void 0:e.body)||{}).length===0,n=e.headers&&(Object.keys(e.headers).length===0||Object.keys(e.headers).length===1&&(e.headers["Content-type"]||e.headers["Content-Type"])&&(e.headers["Content-type"]==="application/json"||e.headers["Content-Type"]==="application/json")),i=e.params||Object.keys(e.params||{}).length===0;return e.method&&e.method!=="GET"&&(t={...t,method:e.method}),e.body&&!r&&(t={...t,body:e.body}),t={...t,headers:n?{"Content-type":"application/json"}:e.headers},e.params&&!i&&(t={...t,params:e.params}),{...t,url:e.url||""}}function Ut(e){let t=et(e),r=null,n=t.headers["Content-Type"]||t.headers["Content-type"],i=n==="application/json",o=n==="multipart/form-data",a=n==="application/x-www-form-urlencoded";i&&(r=JSON.stringify(t.body)),o&&(r=Object.keys(t.body).reduce((u,h)=>(u.append(h,t.body[h]),u),new FormData)),a&&(r=new URLSearchParams(t.body));let s=Object.keys(t.params).length?`?${new URLSearchParams(t.params)}`:"",l=`${t.url}${s}`,c={};return r&&(c.body=r),Object.keys(t.headers).length&&(c.headers=t.headers),t.method!=="GET"&&(c.method=t.method),[l,c]}function et(e){return{params:(e==null?void 0:e.params)||{},headers:(e==null?void 0:e.headers)||{},jsonpath:(e==null?void 0:e.jsonpath)||"$",method:(e==null?void 0:e.method)||"GET",body:(e==null?void 0:e.body)||{},url:(e==null?void 0:e.url)||""}}var de={};P(de,{convertBase64toBlob:()=>tt,generate:()=>it,get:()=>Bt,getVersionForThumbnail:()=>rt,load:()=>nt,responseToImage:()=>Se,upload:()=>ot});var tt=e=>fetch(e).then(t=>t.blob()),Se=e=>e.blob().then(t=>new Promise((r,n)=>{let i=new Image;i.onerror=n,i.onload=()=>{r(i)},i.src=URL.createObjectURL(t)}));async function rt(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function Bt(e,t,r){try{if(!e.isNew)return await nt(e,t,r)}catch(i){e.sdk.log(`FEAAS: Thumbnail ${e.id}, version: ${(t==null?void 0:t.id)||"responsive"}, status: generating ${status}, reason: ${i}`)}let n=await it(e,t);return r==null||r(n,!1),n&&!e.isNew&&tt(n.src).then(i=>ot(e,t,i)),n}async function nt(e,t,r){let n=t?t.getThumbnailURL():e.getThumbnailURL(),i=e.library.stylesheet,o=new Date(Math.max(Number(e.modifiedAt),Number(i.modifiedAt)));e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, loading`);var a;return await z(n,{},(s,l)=>{let c=Math.abs(Number(new Date(s.headers.get("x-ms-meta-componentRenderedAt")))-Number(o))<2e3;return l&&!c&&Se(s).then(u=>{a=u,r(u,l)}),c},(s,l,c)=>{e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, status: ${l}`),Se(s).then(u=>{a=u,r(u,c)})},null),a}async function it(e,t){let r=t||(e.isNew?null:await rt(e));if(!r||r.isViewEmpty())return null;let{stylesheet:n,datasources:i}=e.library;return await It(r.classList,n.getBreakpointForWidth(800,r.getBreakpoints()),r.view,i.reduce((a,s)=>Object.assign(a,{[s.id]:s.sample}),{}),n.css,e.sdk)}function It(e,t,r,n,i,o){let a=document.createElement("iframe");return a.style.position="absolute",a.style.top="-2000px",a.style.left="-2000px",a.style.width=t.props.minWidth+"px",a.style.height="720px",a.style.zIndex="100011",document.body.appendChild(a),new Promise((s,l)=>{let c=document.createElement("script");c.onerror=l,c.src=o.frontend+"/assets/html2canvas.js",c.onload=()=>{var f;(((f=a.contentWindow.document.fonts)===null||f===void 0?void 0:f.ready)||Promise.resolve()).then(function(){return a.contentWindow.html2canvas(d,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,t.props.minWidth))),width:Math.min(1401,Math.max(320,t.props.minWidth)),height:Math.max(1,Math.min(2e3,d.offsetHeight)),windowWidth:t.props.minWidth+"px",windowHeight:1e3,proxy:o.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(w=>{let y=w.toDataURL("image/jpeg",.6);a.parentElement.removeChild(a);let v=new Image;v.onload=()=>{s(v)},v.onerror=l,v.src=y})})},a.contentWindow.document.head.appendChild(c);let u=a.contentWindow.document.createElement("style");u.textContent=`
69
69
  ${i}
70
70
  body, html { padding: 0; margin: 0; overflow: hidden }
71
- `,s.contentWindow.document.head.appendChild(l);let h=me({template:r,data:n});h.classList.add(...t,"-feaas--preview","-emulate--"+e.details.slug),s.contentWindow.document.body.appendChild(h)})}async function Je(t,e,r){let n=e?e.getThumbnailURL():t.getThumbnailURL(),i=new Date(Math.max(Number(t.modifiedAt),Number(t.library.stylesheet.modifiedAt)));try{await t.sdk.uploadBlob("thumbnails",n.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":e?e.id:null,"x-ms-meta-versionRevision":e?e.revision.toString():null,"x-ms-meta-componentId":t.id,"x-ms-meta-componentRenderedAt":i.toUTCString(),"x-ms-meta-componentModifiedAt":t.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":t.createdAt.toUTCString(),"x-ms-meta-modifiedAt":t.modifiedAt.toUTCString()}}),fetch(n,{cache:"no-cache"}).then(()=>{t.sdk.log("FEAAS: Thumbnail uploaded",n)})}catch(o){t.sdk.log("FEAAS: Thumbnail failed to upload",n,o)}return n}var ve;typeof window!="undefined"&&(window.FEAASReactElement=D,(ve=window.FEAASLoading)!==null&&ve!==void 0||(window.FEAASLoading=Promise.resolve()));
71
+ `;let h=a.contentWindow.document.createElement("style");h.textContent=`
72
+ body, html { padding: 0; margin: 0; overflow: hidden }
73
+ `,a.contentWindow.document.head.appendChild(u),a.contentWindow.document.head.appendChild(h);let d=xe({template:r,data:n});d.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),a.contentWindow.document.body.appendChild(d)})}async function ot(e,t,r){let n=t?t.getThumbnailURL():e.getThumbnailURL(),i=new Date(Math.max(Number(e.modifiedAt),Number(e.library.stylesheet.modifiedAt)));try{await e.sdk.uploadBlob("thumbnails",n.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":t?t.id:null,"x-ms-meta-versionRevision":t?t.revision.toString():null,"x-ms-meta-componentId":e.id,"x-ms-meta-componentRenderedAt":i.toUTCString(),"x-ms-meta-componentModifiedAt":e.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":e.createdAt.toUTCString(),"x-ms-meta-modifiedAt":e.modifiedAt.toUTCString()}}),fetch(n,{cache:"no-cache"}).then(()=>{e.sdk.log("FEAAS: Thumbnail uploaded",n)})}catch(o){e.sdk.log("FEAAS: Thumbnail failed to upload",n,o)}return n}var _e;typeof window!="undefined"&&(window.FEAASReactElement=$,(_e=window.FEAASLoading)!==null&&_e!==void 0||(window.FEAASLoading=Promise.resolve()));
72
74
  //# sourceMappingURL=headless.cjs.map