@fluid-topics/ft-app-context 1.1.37 → 1.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- !function(t,i,s,a){const e=s.css`
2
- `,o="ft-app-info",n=i.FtReduxStore.get({name:o,reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class l{static build(t){const{baseUrl:i,apiIntegrationIdentifier:s}=n.getState(),a=null!=t?t:s;if(i&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,a,!0)}static get(t){var i;return null!=t?l.build(t):null!==(i=l.API)&&void 0!==i?i:l.API=l.build()}static await(t){return new Promise((i=>{let s=l.get(t);if(s)i(s);else{const a=n.subscribe((()=>{s=l.get(t),s&&(a(),i(s))}))}}))}}var r;const h=Symbol("clearAfterUnitTest");class c{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[r]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=n.getState().uiLocale,n.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=n.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,s){var a;if(t=t.toLowerCase(),Object.keys(s).length>0){const e={...null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},...s};i.deepEqual(this.defaultMessages[t],e)||(this.defaultMessages[t]=e,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,s,...a){var e,o,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(o=null===(e=this.cache.getNow(t))||void 0===e?void 0:e.messages)&&void 0!==o?o:{};return new i.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(s,...a)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,i){var s;return t=t.toLowerCase(),this.listeners[t]=null!==(s=this.listeners[t])&&void 0!==s?s:new Set,this.listeners[t].add(i),()=>{var s;return null===(s=this.listeners[t])||void 0===s?void 0:s.delete(i)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>i.delay(0).then((()=>t())).catch((()=>null)))))}}r=h,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new c((async(t,i)=>(await l.await()).getFluidTopicsMessageContext(t,i)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new c((async(t,i)=>(await l.await()).getCustomMessageContext(t,i))));const d=window.FluidTopicsI18nService,u=window.FluidTopicsCustomI18nService;var v=function(t,i,s,a){for(var e,o=arguments.length,n=o<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,s):a,l=t.length-1;l>=0;l--)(e=t[l])&&(n=(o<3?e(n):o>3?e(i,s,n):e(i,s))||n);return o>3&&n&&Object.defineProperty(i,s,n),n};class w extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>l.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return s.html`
1
+ !function(t,s,i,e){const a=i.css`
2
+ `,n="ft-app-info",o=s.FtReduxStore.get({name:n,reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class h{static build(t){const{baseUrl:s,apiIntegrationIdentifier:i}=o.getState(),e=null!=t?t:i;if(s&&e&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(s,e,!0)}static get(t){var s;return null!=t?h.build(t):null!==(s=h.API)&&void 0!==s?s:h.API=h.build()}static await(t){return new Promise((s=>{let i=h.get(t);if(i)s(i);else{const e=o.subscribe((()=>{i=h.get(t),i&&(e(),s(i))}))}}))}}class l{constructor(t=!0,i){var e;this.overrideApi=i;let a=this.constructor;a.commonCache=null!==(e=a.commonCache)&&void 0!==e?e:new s.CacheRegistry,this.cache=t?a.commonCache:new s.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:h.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:h.await()}clearCache(){this.cache.clearAll()}}var r;const c=Symbol("clearAfterUnitTest");class d extends l{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[r]=()=>{this.defaultMessages={},this.cache=new s.CacheRegistry,this.listeners={}},this.currentUiLocale=o.getState().uiLocale,o.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=o.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const s=t.name.toLowerCase();this.cache.setFinal(s,t),this.notify(s)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,i){var e;if(t=t.toLowerCase(),Object.keys(i).length>0){const a={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...i};s.deepEqual(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,i,...e){var a,n,o;t=t.toLowerCase(),this.fetchContext(t);const h=null!==(n=null===(a=this.cache.getNow(t))||void 0===a?void 0:a.messages)&&void 0!==n?n:{};return new s.ParametrizedLabelResolver(null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},h).resolve(i,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,s){var i;return t=t.toLowerCase(),this.listeners[t]=null!==(i=this.listeners[t])&&void 0!==i?i:new Set,this.listeners[t].add(s),()=>{var i;return null===(i=this.listeners[t])||void 0===i?void 0:i.delete(s)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>s.delay(0).then((()=>t())).catch((()=>null)))))}}r=c,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends d{constructor(){super((async(t,s)=>(await this.awaitApi).getFluidTopicsMessageContext(t,s)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends d{constructor(){super((async(t,s)=>(await this.awaitApi).getCustomMessageContext(t,s)))}});const u=window.FluidTopicsI18nService,v=window.FluidTopicsCustomI18nService;var w=function(t,s,i,e){for(var a,n=arguments.length,o=n<3?s:null===e?e=Object.getOwnPropertyDescriptor(s,i):e,h=t.length-1;h>=0;h--)(a=t[h])&&(o=(n<3?a(o):n>3?a(s,i,o):a(s,i))||o);return n>3&&o&&Object.defineProperty(s,i,o),o};class y extends s.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>h.get(),this.cache=new s.CacheRegistry,this.cleanSessionDebouncer=new s.Debouncer}render(){return i.html`
3
3
  <slot></slot>
4
- `}update(t){super.update(t),t.has("baseUrl")&&(n.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&n.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&n.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&n.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&n.actions.noCustom(this.noCustom),t.has("editorMode")&&n.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&n.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&n.actions.session(this.session),t.has("availableUiLocales")&&n.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>d.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}w.elementDefinitions={},w.styles=e,v([a.property()],w.prototype,"baseUrl",void 0),v([a.property()],w.prototype,"apiIntegrationIdentifier",void 0),v([a.property()],w.prototype,"uiLocale",void 0),v([i.jsonProperty(null)],w.prototype,"availableUiLocales",void 0),v([i.jsonProperty(null)],w.prototype,"metadataConfiguration",void 0),v([a.property({type:Boolean})],w.prototype,"editorMode",void 0),v([a.property({type:Boolean})],w.prototype,"noCustom",void 0),v([a.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],w.prototype,"noCustomComponent",void 0),v([a.property({type:Boolean})],w.prototype,"withManualResources",void 0),v([i.jsonProperty([])],w.prototype,"messageContexts",void 0),v([i.jsonProperty(void 0)],w.prototype,"session",void 0),v([a.property({type:Object})],w.prototype,"apiProvider",void 0);class f{async listMySearches(){var t;return(null===(t=n.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await l.await()).listMySearches(n.getState().session.profile.userId):[]}}const m=new i.CacheRegistry;class y{async listMyBookmarks(){return m.get("bookmarks",(async()=>(await l.await()).listMyBookmarks(n.getState().session.profile.userId)))}clearCache(){m.clear("bookmarks")}}const p="ft-user-assets",b=i.FtReduxStore.get({name:p,initialState:{savedSearches:void 0,bookmarks:void 0}});const C=new class{constructor(){this.currentSession=n.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new y,n.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:s}=n.getState();i.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==s?void 0:s.profile)||(this.currentSession=s,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){b.actions.savedSearches(void 0)}clearMyBookmarks(){b.actions.bookmarks(void 0)}async reloadMySearches(){const t=new f,i=await t.listMySearches();b.actions.savedSearches(i)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const i=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;b.actions.bookmarks(i)}}};i.customElement("ft-app-context")(w),t.FluidTopicsApiProvider=l,t.FtAppContext=w,t.FtAppContextCssVariables={},t.FtAppInfoStoreName=o,t.FtI18nServiceInternalClass=c,t.FtUserAssetsStoreName=p,t.clearAfterUnitTest=h,t.ftAppInfoStore=n,t.ftCustomI18nService=u,t.ftI18nService=d,t.ftUserAssetsStore=b,t.styles=e,t.userAssetsActions=C}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
4
+ `}update(t){super.update(t),t.has("baseUrl")&&(o.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&o.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&o.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&o.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&o.actions.noCustom(this.noCustom),t.has("editorMode")&&o.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&o.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&o.actions.session(this.session),t.has("availableUiLocales")&&o.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>u.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}y.elementDefinitions={},y.styles=a,w([e.property()],y.prototype,"baseUrl",void 0),w([e.property()],y.prototype,"apiIntegrationIdentifier",void 0),w([e.property()],y.prototype,"uiLocale",void 0),w([s.jsonProperty(null)],y.prototype,"availableUiLocales",void 0),w([s.jsonProperty(null)],y.prototype,"metadataConfiguration",void 0),w([e.property({type:Boolean})],y.prototype,"editorMode",void 0),w([e.property({type:Boolean})],y.prototype,"noCustom",void 0),w([e.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],y.prototype,"noCustomComponent",void 0),w([e.property({type:Boolean})],y.prototype,"withManualResources",void 0),w([s.jsonProperty([])],y.prototype,"messageContexts",void 0),w([s.jsonProperty(void 0)],y.prototype,"session",void 0),w([e.property({type:Object})],y.prototype,"apiProvider",void 0);class m extends l{async listMySearches(){let t=o.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class f extends l{async listMyBookmarks(){let t=o.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const p="ft-user-assets",C=s.FtReduxStore.get({name:p,initialState:{savedSearches:void 0,bookmarks:void 0}});const b=new class{constructor(){this.currentSession=o.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new f,this.savedSearchesService=new m,o.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:i}=o.getState();s.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==i?void 0:i.profile)||(this.currentSession=i,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),C.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),C.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();C.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const s=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;C.actions.bookmarks(s)}}};s.customElement("ft-app-context")(y),t.FluidTopicsApiProvider=h,t.FtAppContext=y,t.FtAppContextCssVariables={},t.FtAppInfoStoreName=n,t.FtI18nServiceInternalClass=d,t.FtServiceWithCache=l,t.FtUserAssetsStoreName=p,t.clearAfterUnitTest=c,t.ftAppInfoStore=o,t.ftCustomI18nService=v,t.ftI18nService=u,t.ftUserAssetsStore=C,t.styles=a,t.userAssetsActions=b}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
@@ -62,7 +62,7 @@ let uo=class extends kt{constructor(){super(...arguments),this.renderOptions={ho
62
62
  * Copyright 2019 Google LLC
63
63
  * SPDX-License-Identifier: BSD-3-Clause
64
64
  */
65
- const vo=window,No=vo.ShadowRoot&&(void 0===vo.ShadyCSS||vo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class wo extends uo{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([o,e])=>t.registry.define(o,e))));const o={...t.shadowRootOptions,customElements:t.registry},e=this.renderOptions.creationScope=this.attachShadow(o);return((t,o)=>{No?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=vo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var So,xo=function(t,o,e,r){for(var n,i=arguments.length,a=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(o,e,a):n(o,e))||a);return i>3&&a&&Object.defineProperty(o,e,a),a};const Co=Symbol("constructorPrototype"),Eo=Symbol("constructorName"),Uo=Symbol("exportpartsDebouncer");class Ro extends wo{constructor(){super(),this[So]=new n(5),this[Eo]=this.constructor.name,this[Co]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Eo]&&Object.setPrototypeOf(this,this[Co])}updated(t){super.updated(t),this.updateComplete.then((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}))}contentAvailableCallback(t){var o,e;if((null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==e?e:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){var t,o,e;((null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())||null!==(e=null===(o=this.exportpartsPrefixes)||void 0===o?void 0:o.length)&&void 0!==e&&e)&&this[Uo].run((()=>{var t,o;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&(null===(o=this.exportpartsPrefixes)||void 0===o?void 0:o.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var o,e,r,n,i,a;const s=t=>null!=t&&t.trim().length>0,c=t.filter(s).map((t=>t.trim()));if(0===c.length)return void this.removeAttribute("exportparts");const l=new Set;for(let t of null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll("[part],[exportparts]"))&&void 0!==e?e:[]){const o=null!==(n=null===(r=t.getAttribute("part"))||void 0===r?void 0:r.split(" "))&&void 0!==n?n:[],e=null!==(a=null===(i=t.getAttribute("exportparts"))||void 0===i?void 0:i.split(",").map((t=>t.split(":")[1])))&&void 0!==a?a:[];new Array(...o,...e).filter(s).map((t=>t.trim())).forEach((t=>l.add(t)))}if(0===l.size)return void this.removeAttribute("exportparts");const f=[...l.values()].flatMap((t=>c.map((o=>`${t}:${o}--${t}`))));this.setAttribute("exportparts",[...this.part,...f].join(", "))}}So=Uo,xo([R()],Ro.prototype,"exportpartsPrefix",void 0),xo([W([])],Ro.prototype,"exportpartsPrefixes",void 0),xo([R()],Ro.prototype,"customStylesheet",void 0);const Io=go.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");bt`
65
+ const vo=window,No=vo.ShadowRoot&&(void 0===vo.ShadyCSS||vo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;class wo extends uo{createRenderRoot(){const t=this.constructor;t.elementDefinitions&&!t.registry&&(t.registry=new CustomElementRegistry,Object.entries(t.elementDefinitions).forEach((([o,e])=>t.registry.define(o,e))));const o={...t.shadowRootOptions,customElements:t.registry},e=this.renderOptions.creationScope=this.attachShadow(o);return((t,o)=>{No?t.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):o.forEach((o=>{const e=document.createElement("style"),r=vo.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=o.cssText,t.appendChild(e)}))})(e,t.elementStyles),e}}var So,xo=function(t,o,e,r){for(var n,i=arguments.length,a=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(o,e,a):n(o,e))||a);return i>3&&a&&Object.defineProperty(o,e,a),a};const Co=Symbol("constructorPrototype"),Eo=Symbol("constructorName"),Uo=Symbol("exportpartsDebouncer");class Ro extends wo{constructor(){super(),this[So]=new n(5),this[Eo]=this.constructor.name,this[Co]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[Eo]&&Object.setPrototypeOf(this,this[Co])}updated(t){super.updated(t),this.updateComplete.then((()=>{this.contentAvailableCallback(t),this.insertCustomStylesheet(),this.scheduleExportpartsUpdate()}))}contentAvailableCallback(t){}insertCustomStylesheet(){var t,o;if((null!==(o=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==o?o:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){var t,o,e;((null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())||null!==(e=null===(o=this.exportpartsPrefixes)||void 0===o?void 0:o.length)&&void 0!==e&&e)&&this[Uo].run((()=>{var t,o;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&(null===(o=this.exportpartsPrefixes)||void 0===o?void 0:o.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var o,e,r,n,i,a;const s=t=>null!=t&&t.trim().length>0,c=t.filter(s).map((t=>t.trim()));if(0===c.length)return void this.removeAttribute("exportparts");const l=new Set;for(let t of null!==(e=null===(o=this.shadowRoot)||void 0===o?void 0:o.querySelectorAll("[part],[exportparts]"))&&void 0!==e?e:[]){const o=null!==(n=null===(r=t.getAttribute("part"))||void 0===r?void 0:r.split(" "))&&void 0!==n?n:[],e=null!==(a=null===(i=t.getAttribute("exportparts"))||void 0===i?void 0:i.split(",").map((t=>t.split(":")[1])))&&void 0!==a?a:[];new Array(...o,...e).filter(s).map((t=>t.trim())).forEach((t=>l.add(t)))}if(0===l.size)return void this.removeAttribute("exportparts");const f=[...l.values()].flatMap((t=>c.map((o=>`${t}:${o}--${t}`))));this.setAttribute("exportparts",[...this.part,...f].join(", "))}}So=Uo,xo([R()],Ro.prototype,"exportpartsPrefix",void 0),xo([W([])],Ro.prototype,"exportpartsPrefixes",void 0),xo([R()],Ro.prototype,"customStylesheet",void 0);const Io=go.create("--ft-utils-highlight-html-background-color","","COLOR","#FFF26E");bt`
66
66
  .highlight-html-match {
67
67
  background: ${Io};
68
68
  }
@@ -99,6 +99,6 @@ const vo=window,No=vo.ShadowRoot&&(void 0===vo.ShadyCSS||vo.ShadyCSS.nativeShado
99
99
  width: 0;
100
100
  }
101
101
  `;class Wo{constructor(t,o){this.defaultLabels=t,this.labels=o}resolve(t,...o){var e,r;t=this.resolvePluralKey(t,o);let n=null!==(r=null!==(e=this.labels[t])&&void 0!==e?e:this.defaultLabels[t])&&void 0!==r?r:"";return o.forEach(((t,o)=>n=n.replace(new RegExp(`\\{${o}([^}]*)\\}`,"g"),((o,e)=>this.formatValue(t,e))))),n}resolvePluralKey(t,o){for(let e of o)if("number"==typeof e){const o=`${String(t)}[\\=${e}]`;if(o in this.labels||o in this.defaultLabels)return o}return t}formatValue(t,o){return t instanceof Date?this.formatDate(t,o):null!=t?t:""}formatDate(t,o){const e=e=>(null==o?void 0:o.includes("date"))?t.toLocaleDateString(e):(null==o?void 0:o.includes("time"))?t.toLocaleTimeString(e):t.toLocaleString(e);try{return e(document.documentElement.lang)}catch(t){return e()}}}class Lo{constructor(){this.queue=[]}add(t,o=!1){o&&(this.queue=this.queue.filter((o=>o.type!==t.type))),this.queue.push(t)}consume(t){const o=this.queue.find((o=>o.type===t));return o&&(this.queue=this.queue.filter((t=>t!==o))),o}}function ko(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var Ko,Ao,Zo;const jo=Symbol("internalReduxEventsUnsubscribers"),Mo=Symbol("internalStoresUnsubscribers"),Fo=Symbol("internalStores");class $o extends Ro{constructor(){super(...arguments),this[Ko]=new Map,this[Ao]=new Map,this[Zo]=[]}get reduxConstructor(){return this.constructor}update(t){super.update(t),[...this.reduxConstructor.reduxReactiveProperties].some((o=>t.has(o)))&&this.updateFromStores()}getUnnamedStore(){if(this[Fo].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[Fo].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[Fo].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:ko(t)?t.name:void 0)&&void 0!==e?e:"default-store",this.unsubscribeFromStore(o),this.setupStore(o,t)}removeStore(t){const o="string"==typeof t?t:t.name;this.unsubscribeFromStore(o),this[Fo].delete(o)}setupStore(t,o){this[Fo].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[Fo].forEach(((t,o)=>this.subscribeToStore(o,t))),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach(((t,o)=>{const e=this.constructor.getPropertyOptions(o);if(!(null==e?void 0:e.attribute)||!this.hasAttribute("string"==typeof(null==e?void 0:e.attribute)?e.attribute:o)){const e=this.getStore(t.store);e&&(t.store?this[Mo].has(t.store):this[Mo].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[Mo].set(t,o.subscribe((()=>this.updateFromStores()))),ko(o)&&o.eventBus&&(null===(e=this.reduxConstructor.reduxEventListeners)||void 0===e||e.forEach(((t,e)=>{if("function"==typeof this[e]&&(!t.store||o.name===t.store)){const r=t=>this[e](t);o.eventBus.addEventListener(t.eventName,r),this[jo].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Mo].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[jo].forEach((t=>t())),this[jo]=[]}unsubscribeFromStore(t){this[Mo].has(t)&&this[Mo].get(t)(),this[Mo].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}function Po(t){for(var o=arguments.length,e=Array(o>1?o-1:0),r=1;r<o;r++)e[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+t+(e.length?" "+e.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Bo(t){return!!t&&!!t[Ue]}function Do(t){var o;return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;var e=Object.hasOwnProperty.call(o,"constructor")&&o.constructor;return e===Object||"function"==typeof e&&Function.toString.call(e)===Re}(t)||Array.isArray(t)||!!t[Ee]||!!(null===(o=t.constructor)||void 0===o?void 0:o[Ee])||qo(t)||Yo(t))}function zo(t,o,e){void 0===e&&(e=!1),0===_o(t)?(e?Object.keys:Ie)(t).forEach((function(r){e&&"symbol"==typeof r||o(r,t[r],t)})):t.forEach((function(e,r){return o(r,e,t)}))}function _o(t){var o=t[Ue];return o?o.i>3?o.i-4:o.i:Array.isArray(t)?1:qo(t)?2:Yo(t)?3:0}function To(t,o){return 2===_o(t)?t.has(o):Object.prototype.hasOwnProperty.call(t,o)}function Ho(t,o,e){var r=_o(t);2===r?t.set(o,e):3===r?t.add(e):t[o]=e}function Go(t,o){return t===o?0!==t||1/t==1/o:t!=t&&o!=o}function qo(t){return we&&t instanceof Map}function Yo(t){return Se&&t instanceof Set}function Vo(t){return t.o||t.t}function Jo(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var o=We(t);delete o[Ue];for(var e=Ie(o),r=0;r<e.length;r++){var n=e[r],i=o[n];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(o[n]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[n]})}return Object.create(Object.getPrototypeOf(t),o)}function Xo(t,o){return void 0===o&&(o=!1),te(t)||Bo(t)||!Do(t)||(_o(t)>1&&(t.set=t.add=t.clear=t.delete=Qo),Object.freeze(t),o&&zo(t,(function(t,o){return Xo(o,!0)}),!0)),t}function Qo(){Po(2)}function te(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function oe(t){var o=Le[t];return o||Po(18,t),o}function ee(){return ve}function re(t,o){o&&(oe("Patches"),t.u=[],t.s=[],t.v=o)}function ne(t){ie(t),t.p.forEach(se),t.p=null}function ie(t){t===ve&&(ve=t.l)}function ae(t){return ve={p:[],l:ve,h:t,m:!0,_:0}}function se(t){var o=t[Ue];0===o.i||1===o.i?o.j():o.g=!0}function ce(t,o){o._=o.p.length;var e=o.p[0],r=void 0!==t&&t!==e;return o.h.O||oe("ES5").S(o,t,r),r?(e[Ue].P&&(ne(o),Po(4)),Do(t)&&(t=le(o,t),o.l||he(o,t)),o.u&&oe("Patches").M(e[Ue].t,t,o.u,o.s)):t=le(o,e,[]),ne(o),o.u&&o.v(o.u,o.s),t!==Ce?t:void 0}function le(t,o,e){if(te(o))return o;var r=o[Ue];if(!r)return zo(o,(function(n,i){return fe(t,r,o,n,i,e)}),!0),o;if(r.A!==t)return o;if(!r.P)return he(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var n=4===r.i||5===r.i?r.o=Jo(r.k):r.o,i=n,a=!1;3===r.i&&(i=new Set(n),n.clear(),a=!0),zo(i,(function(o,i){return fe(t,r,n,o,i,e,a)})),he(t,n,!1),e&&t.u&&oe("Patches").N(r,e,t.u,t.s)}return r.o}function fe(t,o,e,r,n,i,a){if(Bo(n)){var s=le(t,n,i&&o&&3!==o.i&&!To(o.R,r)?i.concat(r):void 0);if(Ho(e,r,s),!Bo(s))return;t.m=!1}else a&&e.add(n);if(Do(n)&&!te(n)){if(!t.h.D&&t._<1)return;le(t,n),o&&o.A.l||he(t,n)}}function he(t,o,e){void 0===e&&(e=!1),!t.l&&t.h.D&&t.m&&Xo(o,e)}function pe(t,o){var e=t[Ue];return(e?Vo(e):t)[o]}function ue(t,o){if(o in t)for(var e=Object.getPrototypeOf(t);e;){var r=Object.getOwnPropertyDescriptor(e,o);if(r)return r;e=Object.getPrototypeOf(e)}}function de(t){t.P||(t.P=!0,t.l&&de(t.l))}function ye(t){t.o||(t.o=Jo(t.t))}function be(t,o,e){var r=qo(o)?oe("MapSet").F(o,e):Yo(o)?oe("MapSet").T(o,e):t.O?function(t,o){var e=Array.isArray(t),r={i:e?1:0,A:o?o.A:ee(),P:!1,I:!1,R:{},l:o,t,k:null,o:null,j:null,C:!1},n=r,i=ke;e&&(n=[r],i=Ke);var a=Proxy.revocable(n,i),s=a.revoke,c=a.proxy;return r.k=c,r.j=s,c}(o,e):oe("ES5").J(o,e);return(e?e.A:ee()).p.push(r),r}function ge(t){return Bo(t)||Po(22,t),function t(o){if(!Do(o))return o;var e,r=o[Ue],n=_o(o);if(r){if(!r.P&&(r.i<4||!oe("ES5").K(r)))return r.t;r.I=!0,e=me(o,n),r.I=!1}else e=me(o,n);return zo(e,(function(o,n){r&&function(t,o){return 2===_o(t)?t.get(o):t[o]}(r.t,o)===n||Ho(e,o,t(n))})),3===n?new Set(e):e}(t)}function me(t,o){switch(o){case 2:return new Map(t);case 3:return Array.from(t)}return Jo(t)}Ko=Mo,Ao=Fo,Zo=jo,$o.reduxProperties=new Map,$o.reduxReactiveProperties=new Set,$o.reduxEventListeners=new Map;var Oe,ve,Ne="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),we="undefined"!=typeof Map,Se="undefined"!=typeof Set,xe="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Ce=Ne?Symbol.for("immer-nothing"):((Oe={})["immer-nothing"]=!0,Oe),Ee=Ne?Symbol.for("immer-draftable"):"__$immer_draftable",Ue=Ne?Symbol.for("immer-state"):"__$immer_state",Re=""+Object.prototype.constructor,Ie="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,We=Object.getOwnPropertyDescriptors||function(t){var o={};return Ie(t).forEach((function(e){o[e]=Object.getOwnPropertyDescriptor(t,e)})),o},Le={},ke={get:function(t,o){if(o===Ue)return t;var e=Vo(t);if(!To(e,o))return function(t,o,e){var r,n=ue(o,e);return n?"value"in n?n.value:null===(r=n.get)||void 0===r?void 0:r.call(t.k):void 0}(t,e,o);var r=e[o];return t.I||!Do(r)?r:r===pe(t.t,o)?(ye(t),t.o[o]=be(t.A.h,r,t)):r},has:function(t,o){return o in Vo(t)},ownKeys:function(t){return Reflect.ownKeys(Vo(t))},set:function(t,o,e){var r=ue(Vo(t),o);if(null==r?void 0:r.set)return r.set.call(t.k,e),!0;if(!t.P){var n=pe(Vo(t),o),i=null==n?void 0:n[Ue];if(i&&i.t===e)return t.o[o]=e,t.R[o]=!1,!0;if(Go(e,n)&&(void 0!==e||To(t.t,o)))return!0;ye(t),de(t)}return t.o[o]===e&&(void 0!==e||o in t.o)||Number.isNaN(e)&&Number.isNaN(t.o[o])||(t.o[o]=e,t.R[o]=!0),!0},deleteProperty:function(t,o){return void 0!==pe(t.t,o)||o in t.t?(t.R[o]=!1,ye(t),de(t)):delete t.R[o],t.o&&delete t.o[o],!0},getOwnPropertyDescriptor:function(t,o){var e=Vo(t),r=Reflect.getOwnPropertyDescriptor(e,o);return r?{writable:!0,configurable:1!==t.i||"length"!==o,enumerable:r.enumerable,value:e[o]}:r},defineProperty:function(){Po(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){Po(12)}},Ke={};zo(ke,(function(t,o){Ke[t]=function(){return arguments[0]=arguments[0][0],o.apply(this,arguments)}})),Ke.deleteProperty=function(t,o){return Ke.set.call(this,t,o,void 0)},Ke.set=function(t,o,e){return ke.set.call(this,t[0],o,e,t[0])};var Ae=function(){function t(t){var o=this;this.O=xe,this.D=!0,this.produce=function(t,e,r){if("function"==typeof t&&"function"!=typeof e){var n=e;e=t;var i=o;return function(t){var o=this;void 0===t&&(t=n);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return i.produce(t,(function(t){var r;return(r=e).call.apply(r,[o,t].concat(a))}))}}var a;if("function"!=typeof e&&Po(6),void 0!==r&&"function"!=typeof r&&Po(7),Do(t)){var s=ae(o),c=be(o,t,void 0),l=!0;try{a=e(c),l=!1}finally{l?ne(s):ie(s)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(t){return re(s,r),ce(t,s)}),(function(t){throw ne(s),t})):(re(s,r),ce(a,s))}if(!t||"object"!=typeof t){if(void 0===(a=e(t))&&(a=t),a===Ce&&(a=void 0),o.D&&Xo(a,!0),r){var f=[],h=[];oe("Patches").M(t,a,f,h),r(f,h)}return a}Po(21,t)},this.produceWithPatches=function(t,e){if("function"==typeof t)return function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return o.produceWithPatches(e,(function(o){return t.apply(void 0,[o].concat(n))}))};var r,n,i=o.produce(t,e,(function(t,o){r=t,n=o}));return"undefined"!=typeof Promise&&i instanceof Promise?i.then((function(t){return[t,r,n]})):[i,r,n]},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var o=t.prototype;return o.createDraft=function(t){Do(t)||Po(8),Bo(t)&&(t=ge(t));var o=ae(this),e=be(this,t,void 0);return e[Ue].C=!0,ie(o),e},o.finishDraft=function(t,o){var e=(t&&t[Ue]).A;return re(e,o),ce(void 0,e)},o.setAutoFreeze=function(t){this.D=t},o.setUseProxies=function(t){t&&!xe&&Po(20),this.O=t},o.applyPatches=function(t,o){var e;for(e=o.length-1;e>=0;e--){var r=o[e];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}e>-1&&(o=o.slice(e+1));var n=oe("Patches").$;return Bo(t)?n(t,o):this.produce(t,(function(t){return n(t,o)}))},t}(),Ze=new Ae,je=Ze.produce;function Me(t){return Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(t)}function Fe(t){var o=function(t,o){if("object"!==Me(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,o||"default");if("object"!==Me(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===o?String:Number)(t)}(t,"string");return"symbol"===Me(o)?o:String(o)}function $e(t,o,e){return(o=Fe(o))in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function Pe(t,o){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),e.push.apply(e,r)}return e}function Be(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{};o%2?Pe(Object(e),!0).forEach((function(o){$e(t,o,e[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):Pe(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}))}return t}function De(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}Ze.produceWithPatches.bind(Ze),Ze.setAutoFreeze.bind(Ze),Ze.setUseProxies.bind(Ze),Ze.applyPatches.bind(Ze),Ze.createDraft.bind(Ze),Ze.finishDraft.bind(Ze);var ze="function"==typeof Symbol&&Symbol.observable||"@@observable",_e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Te={INIT:"@@redux/INIT"+_e(),REPLACE:"@@redux/REPLACE"+_e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+_e()}};function He(t,o,e){var r;if("function"==typeof o&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(De(0));if("function"==typeof o&&void 0===e&&(e=o,o=void 0),void 0!==e){if("function"!=typeof e)throw new Error(De(1));return e(He)(t,o)}if("function"!=typeof t)throw new Error(De(2));var n=t,i=o,a=[],s=a,c=!1;function l(){s===a&&(s=a.slice())}function f(){if(c)throw new Error(De(3));return i}function h(t){if("function"!=typeof t)throw new Error(De(4));if(c)throw new Error(De(5));var o=!0;return l(),s.push(t),function(){if(o){if(c)throw new Error(De(6));o=!1,l();var e=s.indexOf(t);s.splice(e,1),a=null}}}function p(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var o=t;null!==Object.getPrototypeOf(o);)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(t)===o}(t))throw new Error(De(7));if(void 0===t.type)throw new Error(De(8));if(c)throw new Error(De(9));try{c=!0,i=n(i,t)}finally{c=!1}for(var o=a=s,e=0;e<o.length;e++){(0,o[e])()}return t}return p({type:Te.INIT}),(r={dispatch:p,subscribe:h,getState:f,replaceReducer:function(t){if("function"!=typeof t)throw new Error(De(10));n=t,p({type:Te.REPLACE})}})[ze]=function(){var t,o=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(De(11));function e(){t.next&&t.next(f())}return e(),{unsubscribe:o(e)}}})[ze]=function(){return this},t},r}function Ge(t){for(var o=Object.keys(t),e={},r=0;r<o.length;r++){var n=o[r];"function"==typeof t[n]&&(e[n]=t[n])}var i,a=Object.keys(e);try{!function(t){Object.keys(t).forEach((function(o){var e=t[o];if(void 0===e(void 0,{type:Te.INIT}))throw new Error(De(12));if(void 0===e(void 0,{type:Te.PROBE_UNKNOWN_ACTION()}))throw new Error(De(13))}))}(e)}catch(t){i=t}return function(t,o){if(void 0===t&&(t={}),i)throw i;for(var r=!1,n={},s=0;s<a.length;s++){var c=a[s],l=e[c],f=t[c],h=l(f,o);if(void 0===h)throw o&&o.type,new Error(De(14));n[c]=h,r=r||h!==f}return(r=r||a.length!==Object.keys(t).length)?n:t}}function qe(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return 0===o.length?function(t){return t}:1===o.length?o[0]:o.reduce((function(t,o){return function(){return t(o.apply(void 0,arguments))}}))}function Ye(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return function(t){return function(){var e=t.apply(void 0,arguments),r=function(){throw new Error(De(15))},n={getState:e.getState,dispatch:function(){return r.apply(void 0,arguments)}},i=o.map((function(t){return t(n)}));return r=qe.apply(void 0,i)(e.dispatch),Be(Be({},e),{},{dispatch:r})}}}function Ve(t){return function(o){var e=o.dispatch,r=o.getState;return function(o){return function(n){return"function"==typeof n?n(e,r,t):o(n)}}}}var Je=Ve();Je.withExtraArgument=Ve;var Xe,Qe=Je,tr=(Xe=function(t,o){return Xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])},Xe(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}Xe(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}),or=function(t,o){var e,r,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,r&&(n=2&i[0]?r.return:i[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;switch(r=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=o.call(t,a)}catch(t){i=[6,t],r=0}finally{e=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},er=function(t,o){for(var e=0,r=o.length,n=t.length;e<r;e++,n++)t[n]=o[e];return t},rr=Object.defineProperty,nr=Object.defineProperties,ir=Object.getOwnPropertyDescriptors,ar=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,cr=Object.prototype.propertyIsEnumerable,lr=function(t,o,e){return o in t?rr(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e},fr=function(t,o){for(var e in o||(o={}))sr.call(o,e)&&lr(t,e,o[e]);if(ar)for(var r=0,n=ar(o);r<n.length;r++){e=n[r];cr.call(o,e)&&lr(t,e,o[e])}return t},hr=function(t,o){return nr(t,ir(o))},pr="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?qe:qe.apply(null,arguments)};var ur=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,e)||this;return Object.setPrototypeOf(n,o.prototype),n}return tr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,er([void 0],t[0].concat(this)))):new(o.bind.apply(o,er([void 0],t.concat(this))))},o}(Array),dr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,e)||this;return Object.setPrototypeOf(n,o.prototype),n}return tr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,er([void 0],t[0].concat(this)))):new(o.bind.apply(o,er([void 0],t.concat(this))))},o}(Array);function yr(t){return Do(t)?je(t,(function(){})):t}function br(){return function(t){return function(t){void 0===t&&(t={});var o=t.thunk,e=void 0===o||o;t.immutableCheck,t.serializableCheck;var r=new ur;e&&(!function(t){return"boolean"==typeof t}(e)?r.push(Qe.withExtraArgument(e.extraArgument)):r.push(Qe));return r}(t)}}function gr(t){var o,e=br(),r=t||{},n=r.reducer,i=void 0===n?void 0:n,a=r.middleware,s=void 0===a?e():a,c=r.devTools,l=void 0===c||c,f=r.preloadedState,h=void 0===f?void 0:f,p=r.enhancers,u=void 0===p?void 0:p;if("function"==typeof i)o=i;else{if(!function(t){if("object"!=typeof t||null===t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;for(var e=o;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return o===e}(i))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');o=Ge(i)}var d=s;"function"==typeof d&&(d=d(e));var y=Ye.apply(void 0,d),b=qe;l&&(b=pr(fr({trace:!1},"object"==typeof l&&l)));var g=new dr(y),m=g;return Array.isArray(u)?m=er([y],u):"function"==typeof u&&(m=u(g)),He(o,h,b.apply(void 0,m))}function mr(t,o){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(o){var n=o.apply(void 0,e);if(!n)throw new Error("prepareAction did not return an object");return fr(fr({type:t,payload:n.payload},"meta"in n&&{meta:n.meta}),"error"in n&&{error:n.error})}return{type:t,payload:e[0]}}return e.toString=function(){return""+t},e.type=t,e.match=function(o){return o.type===t},e}function Or(t){var o,e={},r=[],n={addCase:function(t,o){var r="string"==typeof t?t:t.type;if(r in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[r]=o,n},addMatcher:function(t,o){return r.push({matcher:t,reducer:o}),n},addDefaultCase:function(t){return o=t,n}};return t(n),[e,r,o]}function vr(t){var o=t.name;if(!o)throw new Error("`name` is a required option for createSlice");var e,r="function"==typeof t.initialState?t.initialState:yr(t.initialState),n=t.reducers||{},i=Object.keys(n),a={},s={},c={};function l(){var o="function"==typeof t.extraReducers?Or(t.extraReducers):[t.extraReducers],e=o[0],n=void 0===e?{}:e,i=o[1],a=void 0===i?[]:i,c=o[2],l=void 0===c?void 0:c,f=fr(fr({},n),s);return function(t,o,e,r){void 0===e&&(e=[]);var n,i="function"==typeof o?Or(o):[o,e,r],a=i[0],s=i[1],c=i[2];if(function(t){return"function"==typeof t}(t))n=function(){return yr(t())};else{var l=yr(t);n=function(){return l}}function f(t,o){void 0===t&&(t=n());var e=er([a[o.type]],s.filter((function(t){return(0,t.matcher)(o)})).map((function(t){return t.reducer})));return 0===e.filter((function(t){return!!t})).length&&(e=[c]),e.reduce((function(t,e){if(e){var r;if(Bo(t))return void 0===(r=e(t,o))?t:r;if(Do(t))return je(t,(function(t){return e(t,o)}));if(void 0===(r=e(t,o))){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return t}),t)}return f.getInitialState=n,f}(r,(function(t){for(var o in f)t.addCase(o,f[o]);for(var e=0,r=a;e<r.length;e++){var n=r[e];t.addMatcher(n.matcher,n.reducer)}l&&t.addDefaultCase(l)}))}return i.forEach((function(t){var e,r,i=n[t],l=o+"/"+t;"reducer"in i?(e=i.reducer,r=i.prepare):e=i,a[t]=e,s[l]=e,c[t]=r?mr(l,r):mr(l)})),{name:o,reducer:function(t,o){return e||(e=l()),e(t,o)},actions:c,caseReducers:a,getInitialState:function(){return e||(e=l()),e.getInitialState()}}}var Nr=["name","message","stack","code"],wr=function(t,o){this.payload=t,this.meta=o},Sr=function(t,o){this.payload=t,this.meta=o},xr=function(t){if("object"==typeof t&&null!==t){for(var o={},e=0,r=Nr;e<r.length;e++){var n=r[e];"string"==typeof t[n]&&(o[n]=t[n])}return o}return{message:String(t)}};function Cr(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}!function(){function t(t,o,e){var r=mr(t+"/fulfilled",(function(t,o,e,r){return{payload:t,meta:hr(fr({},r||{}),{arg:e,requestId:o,requestStatus:"fulfilled"})}})),n=mr(t+"/pending",(function(t,o,e){return{payload:void 0,meta:hr(fr({},e||{}),{arg:o,requestId:t,requestStatus:"pending"})}})),i=mr(t+"/rejected",(function(t,o,r,n,i){return{payload:n,error:(e&&e.serializeError||xr)(t||"Rejected"),meta:hr(fr({},i||{}),{arg:r,requestId:o,rejectedWithValue:!!n,requestStatus:"rejected",aborted:"AbortError"===(null==t?void 0:t.name),condition:"ConditionError"===(null==t?void 0:t.name)})}})),a="undefined"!=typeof AbortController?AbortController:function(){function t(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return t.prototype.abort=function(){},t}();return Object.assign((function(t){return function(s,c,l){var f,h=(null==e?void 0:e.idGenerator)?e.idGenerator(t):function(t){void 0===t&&(t=21);for(var o="",e=t;e--;)o+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return o}(),p=new a;function u(t){f=t,p.abort()}var d=function(){return a=this,d=null,y=function(){var a,d,y,b,g,m;return or(this,(function(O){switch(O.label){case 0:return O.trys.push([0,4,,5]),b=null==(a=null==e?void 0:e.condition)?void 0:a.call(e,t,{getState:c,extra:l}),null===(v=b)||"object"!=typeof v||"function"!=typeof v.then?[3,2]:[4,b];case 1:b=O.sent(),O.label=2;case 2:if(!1===b||p.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return g=new Promise((function(t,o){return p.signal.addEventListener("abort",(function(){return o({name:"AbortError",message:f||"Aborted"})}))})),s(n(h,t,null==(d=null==e?void 0:e.getPendingMeta)?void 0:d.call(e,{requestId:h,arg:t},{getState:c,extra:l}))),[4,Promise.race([g,Promise.resolve(o(t,{dispatch:s,getState:c,extra:l,requestId:h,signal:p.signal,abort:u,rejectWithValue:function(t,o){return new wr(t,o)},fulfillWithValue:function(t,o){return new Sr(t,o)}})).then((function(o){if(o instanceof wr)throw o;return o instanceof Sr?r(o.payload,h,t,o.meta):r(o,h,t)}))])];case 3:return y=O.sent(),[3,5];case 4:return m=O.sent(),y=m instanceof wr?i(null,h,t,m.payload,m.meta):i(m,h,t),[3,5];case 5:return e&&!e.dispatchConditionRejection&&i.match(y)&&y.meta.condition||s(y),[2,y]}var v}))},new Promise((function(t,o){var e=function(t){try{n(y.next(t))}catch(t){o(t)}},r=function(t){try{n(y.throw(t))}catch(t){o(t)}},n=function(o){return o.done?t(o.value):Promise.resolve(o.value).then(e,r)};n((y=y.apply(a,d)).next())}));var a,d,y}();return Object.assign(d,{abort:u,requestId:h,arg:t,unwrap:function(){return d.then(Cr)}})}}),{pending:n,rejected:i,fulfilled:r,typePrefix:t})}t.withTypes=function(){return t}}();var Er,Ur,Rr="listenerMiddleware";mr(Rr+"/add"),mr(Rr+"/removeAll"),mr(Rr+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function t(t,o){var e=n[t];return e?e.enumerable=o:n[t]=e={configurable:!0,enumerable:o,get:function(){var o=this[Ue];return ke.get(o,t)},set:function(o){var e=this[Ue];ke.set(e,t,o)}},e}function o(t){for(var o=t.length-1;o>=0;o--){var n=t[o][Ue];if(!n.P)switch(n.i){case 5:r(n)&&de(n);break;case 4:e(n)&&de(n)}}}function e(t){for(var o=t.t,e=t.k,r=Ie(e),n=r.length-1;n>=0;n--){var i=r[n];if(i!==Ue){var a=o[i];if(void 0===a&&!To(o,i))return!0;var s=e[i],c=s&&s[Ue];if(c?c.t!==a:!Go(s,a))return!0}}var l=!!o[Ue];return r.length!==Ie(o).length+(l?0:1)}function r(t){var o=t.k;if(o.length!==t.t.length)return!0;var e=Object.getOwnPropertyDescriptor(o,o.length-1);if(e&&!e.get)return!0;for(var r=0;r<o.length;r++)if(!o.hasOwnProperty(r))return!0;return!1}var n={};!function(t,o){Le[t]||(Le[t]=o)}("ES5",{J:function(o,e){var r=Array.isArray(o),n=function(o,e){if(o){for(var r=Array(e.length),n=0;n<e.length;n++)Object.defineProperty(r,""+n,t(n,!0));return r}var i=We(e);delete i[Ue];for(var a=Ie(i),s=0;s<a.length;s++){var c=a[s];i[c]=t(c,o||!!i[c].enumerable)}return Object.create(Object.getPrototypeOf(e),i)}(r,o),i={i:r?5:4,A:e?e.A:ee(),P:!1,I:!1,R:{},l:e,t:o,k:n,o:null,g:!1,C:!1};return Object.defineProperty(n,Ue,{value:i,writable:!0}),n},S:function(t,e,n){n?Bo(e)&&e[Ue].A===t&&o(t.p):(t.u&&function t(o){if(o&&"object"==typeof o){var e=o[Ue];if(e){var n=e.t,i=e.k,a=e.R,s=e.i;if(4===s)zo(i,(function(o){o!==Ue&&(void 0!==n[o]||To(n,o)?a[o]||t(i[o]):(a[o]=!0,de(e)))})),zo(n,(function(t){void 0!==i[t]||To(i,t)||(a[t]=!1,de(e))}));else if(5===s){if(r(e)&&(de(e),a.length=!0),i.length<n.length)for(var c=i.length;c<n.length;c++)a[c]=!1;else for(var l=n.length;l<i.length;l++)a[l]=!0;for(var f=Math.min(i.length,n.length),h=0;h<f;h++)i.hasOwnProperty(h)||(a[h]=!0),void 0===a[h]&&t(i[h])}}}}(t.p[0]),o(t.p))},K:function(t){return 4===t.i?e(t):r(t)}})}(),window.ftReduxStores||(window.ftReduxStores={});class Ir{static get(t){var o;const e="string"==typeof t?t:t.name,r="string"==typeof t?void 0:t,n=window.ftReduxStores[e];if(ko(n))return n;if(null==r)return;const i=vr({...r,reducers:null!==(o=r.reducers)&&void 0!==o?o:{}}),a=gr({reducer:(t,o)=>{var e;switch(o.type){case"CLEAR_FT_REDUX_STORE":return i.getInitialState();case"DEFAULT_STATE_FIELDS_VALUES_SETTER":return{...t,...null!==(e=o.overwrites)&&void 0!==e?e:{}};default:return i.reducer(t,o)}}});return window.ftReduxStores[r.name]=new Ir(i,a)}constructor(t,o){this.reduxSlice=t,this.reduxStore=o,this.isFtReduxStore=!0,this.eventBus=document.createElement("event-bus"),this.commands=new Lo,this.actions=new Proxy(this.reduxSlice.actions,{get:(t,o,e)=>{const r=o,n=t[r];return n?(...t)=>{const o=n(...t);return this.reduxStore.dispatch(o),o}:t=>{this.setState({[r]:t})}}})}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE"})}setState(t){this.reduxStore.dispatch({type:"DEFAULT_STATE_FIELDS_VALUES_SETTER",overwrites:t})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(t){throw new Error("Not implemented yet.")}subscribe(t){return this.reduxStore.subscribe(t)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}}navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Ur=null===(Er=window.safari)||void 0===Er?void 0:Er.pushNotification)||void 0===Ur||Ur.toString());const Wr=bt`
102
- `,Lr="ft-app-info",kr=Ir.get({name:Lr,reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class Kr{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=kr.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static get(t){var o;return null!=t?Kr.build(t):null!==(o=Kr.API)&&void 0!==o?o:Kr.API=Kr.build()}static await(t){return new Promise((o=>{let e=Kr.get(t);if(e)o(e);else{const r=kr.subscribe((()=>{e=Kr.get(t),e&&(r(),o(e))}))}}))}}var Ar;const Zr=Symbol("clearAfterUnitTest");class jr{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new r,this.listeners={},this.currentUiLocale="",this[Ar]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=kr.getState().uiLocale,kr.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=kr.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};I(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){var r,n,i;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new Wo(null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},a).resolve(o,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>{return(o=0,new Promise((t=>setTimeout(t,o)))).then((()=>t())).catch((()=>null));var o})))}}Ar=Zr,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new jr((async(t,o)=>(await Kr.await()).getFluidTopicsMessageContext(t,o)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new jr((async(t,o)=>(await Kr.await()).getCustomMessageContext(t,o))));const Mr=window.FluidTopicsI18nService,Fr=window.FluidTopicsCustomI18nService;var $r=function(t,o,e,r){for(var n,i=arguments.length,a=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(o,e,a):n(o,e))||a);return i>3&&a&&Object.defineProperty(o,e,a),a};class Pr extends Ro{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Kr.get(),this.cache=new r,this.cleanSessionDebouncer=new n}render(){return Xt`
102
+ `,Lr="ft-app-info",kr=Ir.get({name:Lr,reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class Kr{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=kr.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static get(t){var o;return null!=t?Kr.build(t):null!==(o=Kr.API)&&void 0!==o?o:Kr.API=Kr.build()}static await(t){return new Promise((o=>{let e=Kr.get(t);if(e)o(e);else{const r=kr.subscribe((()=>{e=Kr.get(t),e&&(r(),o(e))}))}}))}}class Ar{constructor(t=!0,o){var e;this.overrideApi=o;let n=this.constructor;n.commonCache=null!==(e=n.commonCache)&&void 0!==e?e:new r,this.cache=t?n.commonCache:new r}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Kr.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Kr.await()}clearCache(){this.cache.clearAll()}}var Zr;const jr=Symbol("clearAfterUnitTest");class Mr extends Ar{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Zr]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=kr.getState().uiLocale,kr.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=kr.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};I(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){var r,n,i;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new Wo(null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},a).resolve(o,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>{return(o=0,new Promise((t=>setTimeout(t,o)))).then((()=>t())).catch((()=>null));var o})))}}Zr=jr,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Mr{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Mr{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const Fr=window.FluidTopicsI18nService,$r=window.FluidTopicsCustomI18nService;var Pr=function(t,o,e,r){for(var n,i=arguments.length,a=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(o,e,a):n(o,e))||a);return i>3&&a&&Object.defineProperty(o,e,a),a};class Br extends Ro{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Kr.get(),this.cache=new r,this.cleanSessionDebouncer=new n}render(){return Xt`
103
103
  <slot></slot>
104
- `}update(t){super.update(t),t.has("baseUrl")&&(kr.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&kr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&kr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&kr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&kr.actions.noCustom(this.noCustom),t.has("editorMode")&&kr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&kr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&kr.actions.session(this.session),t.has("availableUiLocales")&&kr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Mr.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Pr.elementDefinitions={},Pr.styles=Wr,$r([R()],Pr.prototype,"baseUrl",void 0),$r([R()],Pr.prototype,"apiIntegrationIdentifier",void 0),$r([R()],Pr.prototype,"uiLocale",void 0),$r([W(null)],Pr.prototype,"availableUiLocales",void 0),$r([W(null)],Pr.prototype,"metadataConfiguration",void 0),$r([R({type:Boolean})],Pr.prototype,"editorMode",void 0),$r([R({type:Boolean})],Pr.prototype,"noCustom",void 0),$r([R({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Pr.prototype,"noCustomComponent",void 0),$r([R({type:Boolean})],Pr.prototype,"withManualResources",void 0),$r([W([])],Pr.prototype,"messageContexts",void 0),$r([W(void 0)],Pr.prototype,"session",void 0),$r([R({type:Object})],Pr.prototype,"apiProvider",void 0);class Br{async listMySearches(){var t;return(null===(t=kr.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await Kr.await()).listMySearches(kr.getState().session.profile.userId):[]}}const Dr=new r;class zr{async listMyBookmarks(){return Dr.get("bookmarks",(async()=>(await Kr.await()).listMyBookmarks(kr.getState().session.profile.userId)))}clearCache(){Dr.clear("bookmarks")}}const _r="ft-user-assets",Tr=Ir.get({name:_r,initialState:{savedSearches:void 0,bookmarks:void 0}});const Hr=new class{constructor(){this.currentSession=kr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new zr,kr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=kr.getState();I(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){Tr.actions.savedSearches(void 0)}clearMyBookmarks(){Tr.actions.bookmarks(void 0)}async reloadMySearches(){const t=new Br,o=await t.listMySearches();Tr.actions.savedSearches(o)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Tr.actions.bookmarks(o)}}};var Gr;(Gr="ft-app-context",t=>{window.customElements.get(Gr)||window.customElements.define(Gr,t)})(Pr),t.FluidTopicsApiProvider=Kr,t.FtAppContext=Pr,t.FtAppContextCssVariables={},t.FtAppInfoStoreName=Lr,t.FtI18nServiceInternalClass=jr,t.FtUserAssetsStoreName=_r,t.clearAfterUnitTest=Zr,t.ftAppInfoStore=kr,t.ftCustomI18nService=Fr,t.ftI18nService=Mr,t.ftUserAssetsStore=Tr,t.styles=Wr,t.userAssetsActions=Hr}({});
104
+ `}update(t){super.update(t),t.has("baseUrl")&&(kr.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&kr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&kr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&kr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&kr.actions.noCustom(this.noCustom),t.has("editorMode")&&kr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&kr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&kr.actions.session(this.session),t.has("availableUiLocales")&&kr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Fr.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}Br.elementDefinitions={},Br.styles=Wr,Pr([R()],Br.prototype,"baseUrl",void 0),Pr([R()],Br.prototype,"apiIntegrationIdentifier",void 0),Pr([R()],Br.prototype,"uiLocale",void 0),Pr([W(null)],Br.prototype,"availableUiLocales",void 0),Pr([W(null)],Br.prototype,"metadataConfiguration",void 0),Pr([R({type:Boolean})],Br.prototype,"editorMode",void 0),Pr([R({type:Boolean})],Br.prototype,"noCustom",void 0),Pr([R({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Br.prototype,"noCustomComponent",void 0),Pr([R({type:Boolean})],Br.prototype,"withManualResources",void 0),Pr([W([])],Br.prototype,"messageContexts",void 0),Pr([W(void 0)],Br.prototype,"session",void 0),Pr([R({type:Object})],Br.prototype,"apiProvider",void 0);class Dr extends Ar{async listMySearches(){let t=kr.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class zr extends Ar{async listMyBookmarks(){let t=kr.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const _r="ft-user-assets",Tr=Ir.get({name:_r,initialState:{savedSearches:void 0,bookmarks:void 0}});const Hr=new class{constructor(){this.currentSession=kr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new zr,this.savedSearchesService=new Dr,kr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=kr.getState();I(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Tr.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Tr.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Tr.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Tr.actions.bookmarks(o)}}};var Gr;(Gr="ft-app-context",t=>{window.customElements.get(Gr)||window.customElements.define(Gr,t)})(Br),t.FluidTopicsApiProvider=Kr,t.FtAppContext=Br,t.FtAppContextCssVariables={},t.FtAppInfoStoreName=Lr,t.FtI18nServiceInternalClass=Mr,t.FtServiceWithCache=Ar,t.FtUserAssetsStoreName=_r,t.clearAfterUnitTest=jr,t.ftAppInfoStore=kr,t.ftCustomI18nService=$r,t.ftI18nService=Fr,t.ftUserAssetsStore=Tr,t.styles=Wr,t.userAssetsActions=Hr}({});
package/build/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./redux-stores/FtAppInfoStore";
2
2
  export * from "./redux-stores/FtUserAssetsStore";
3
+ export * from "./services/FtServiceWithCache";
3
4
  export * from "./services/FluidTopicsApiProvider";
4
5
  export * from "./services/FtI18nService";
5
6
  export * from "./ft-app-context.css";
package/build/index.js CHANGED
@@ -2,6 +2,7 @@ import { customElement } from "@fluid-topics/ft-wc-utils";
2
2
  import { FtAppContext } from "./ft-app-context";
3
3
  export * from "./redux-stores/FtAppInfoStore";
4
4
  export * from "./redux-stores/FtUserAssetsStore";
5
+ export * from "./services/FtServiceWithCache";
5
6
  export * from "./services/FluidTopicsApiProvider";
6
7
  export * from "./services/FtI18nService";
7
8
  export * from "./ft-app-context.css";
@@ -11,6 +11,7 @@ declare class UserAssetsActions {
11
11
  private currentSession;
12
12
  private bookmarksAreUsed;
13
13
  private bookmarksService;
14
+ private savedSearchesService;
14
15
  constructor();
15
16
  private reloadWhenUserSessionChanges;
16
17
  clear(): void;
@@ -15,6 +15,7 @@ class UserAssetsActions {
15
15
  this.currentSession = ftAppInfoStore.getState().session;
16
16
  this.bookmarksAreUsed = false;
17
17
  this.bookmarksService = new BookmarksService();
18
+ this.savedSearchesService = new SavedSearchesService();
18
19
  ftAppInfoStore.subscribe(() => this.reloadWhenUserSessionChanges());
19
20
  }
20
21
  reloadWhenUserSessionChanges() {
@@ -31,14 +32,16 @@ class UserAssetsActions {
31
32
  this.clearMyBookmarks();
32
33
  }
33
34
  clearMySearches() {
35
+ this.savedSearchesService.clearCache();
34
36
  ftUserAssetsStore.actions.savedSearches(undefined);
35
37
  }
36
38
  clearMyBookmarks() {
39
+ this.bookmarksService.clearCache();
37
40
  ftUserAssetsStore.actions.bookmarks(undefined);
38
41
  }
39
42
  async reloadMySearches() {
40
- const savedSearchesService = new SavedSearchesService();
41
- const mySearches = await savedSearchesService.listMySearches();
43
+ this.savedSearchesService.clearCache();
44
+ const mySearches = await this.savedSearchesService.listMySearches();
42
45
  ftUserAssetsStore.actions.savedSearches(mySearches);
43
46
  }
44
47
  async reloadBookmarks() {
@@ -1,5 +1,5 @@
1
1
  import { FtBookmark } from "@fluid-topics/public-api";
2
- export declare class BookmarksService {
2
+ import { FtServiceWithCache } from "./FtServiceWithCache";
3
+ export declare class BookmarksService extends FtServiceWithCache {
3
4
  listMyBookmarks(): Promise<FtBookmark[]>;
4
- clearCache(): void;
5
5
  }
@@ -1,12 +1,11 @@
1
- import { FluidTopicsApiProvider } from "./FluidTopicsApiProvider";
2
1
  import { ftAppInfoStore } from "../redux-stores/FtAppInfoStore";
3
- import { CacheRegistry } from "@fluid-topics/ft-wc-utils";
4
- const cache = new CacheRegistry();
5
- export class BookmarksService {
2
+ import { FtServiceWithCache } from "./FtServiceWithCache";
3
+ export class BookmarksService extends FtServiceWithCache {
6
4
  async listMyBookmarks() {
7
- return cache.get("bookmarks", async () => (await FluidTopicsApiProvider.await()).listMyBookmarks(ftAppInfoStore.getState().session.profile.userId));
8
- }
9
- clearCache() {
10
- cache.clear("bookmarks");
5
+ let session = ftAppInfoStore.getState().session;
6
+ if (!(session === null || session === void 0 ? void 0 : session.sessionAuthenticated)) {
7
+ return [];
8
+ }
9
+ return this.cache.get("my-bookmarks", async () => (await this.awaitApi).listMyBookmarks(session.profile.userId), 5 * 60 * 1000);
11
10
  }
12
11
  }
@@ -1,4 +1,5 @@
1
1
  import type { FtMessageContext } from "@fluid-topics/public-api";
2
+ import { FtServiceWithCache } from "./FtServiceWithCache";
2
3
  declare global {
3
4
  interface Window {
4
5
  FluidTopicsI18nService?: FtI18nService;
@@ -7,10 +8,9 @@ declare global {
7
8
  }
8
9
  export type Unsubscribe = () => void;
9
10
  export declare const clearAfterUnitTest: unique symbol;
10
- export declare class FtI18nServiceInternalClass {
11
+ export declare class FtI18nServiceInternalClass extends FtServiceWithCache {
11
12
  private messageContextProvider;
12
13
  private defaultMessages;
13
- private cache;
14
14
  private listeners;
15
15
  private currentUiLocale;
16
16
  constructor(messageContextProvider: (locale: string, name: string) => Promise<FtMessageContext>);
@@ -1,13 +1,13 @@
1
1
  var _a;
2
2
  import { ftAppInfoStore } from "../redux-stores/FtAppInfoStore";
3
3
  import { CacheRegistry, deepEqual, delay, ParametrizedLabelResolver } from "@fluid-topics/ft-wc-utils";
4
- import { FluidTopicsApiProvider } from "./FluidTopicsApiProvider";
4
+ import { FtServiceWithCache } from "./FtServiceWithCache";
5
5
  export const clearAfterUnitTest = Symbol("clearAfterUnitTest");
6
- export class FtI18nServiceInternalClass {
6
+ export class FtI18nServiceInternalClass extends FtServiceWithCache {
7
7
  constructor(messageContextProvider) {
8
+ super();
8
9
  this.messageContextProvider = messageContextProvider;
9
10
  this.defaultMessages = {};
10
- this.cache = new CacheRegistry();
11
11
  this.listeners = {};
12
12
  this.currentUiLocale = "";
13
13
  this[_a] = () => {
@@ -86,10 +86,18 @@ export class FtI18nServiceInternalClass {
86
86
  }
87
87
  _a = clearAfterUnitTest;
88
88
  if (window.FluidTopicsI18nService == null) {
89
- window.FluidTopicsI18nService = new FtI18nServiceInternalClass(async (locale, name) => (await FluidTopicsApiProvider.await()).getFluidTopicsMessageContext(locale, name));
89
+ window.FluidTopicsI18nService = new class extends FtI18nServiceInternalClass {
90
+ constructor() {
91
+ super(async (locale, name) => (await this.awaitApi).getFluidTopicsMessageContext(locale, name));
92
+ }
93
+ };
90
94
  }
91
95
  if (window.FluidTopicsCustomI18nService == null) {
92
- window.FluidTopicsCustomI18nService = new FtI18nServiceInternalClass(async (locale, name) => (await FluidTopicsApiProvider.await()).getCustomMessageContext(locale, name));
96
+ window.FluidTopicsCustomI18nService = new class extends FtI18nServiceInternalClass {
97
+ constructor() {
98
+ super(async (locale, name) => (await this.awaitApi).getCustomMessageContext(locale, name));
99
+ }
100
+ };
93
101
  }
94
102
  export const ftI18nService = window.FluidTopicsI18nService;
95
103
  export const ftCustomI18nService = window.FluidTopicsCustomI18nService;
@@ -0,0 +1,11 @@
1
+ import { CacheRegistry } from "@fluid-topics/ft-wc-utils";
2
+ import { FluidTopicsApi } from "@fluid-topics/public-api";
3
+ export declare class FtServiceWithCache {
4
+ private overrideApi?;
5
+ static commonCache: CacheRegistry;
6
+ cache: CacheRegistry;
7
+ constructor(withCommonCache?: boolean, overrideApi?: FluidTopicsApi | undefined);
8
+ protected get api(): FluidTopicsApi;
9
+ protected get awaitApi(): FluidTopicsApi | Promise<FluidTopicsApi>;
10
+ clearCache(): void;
11
+ }
@@ -0,0 +1,23 @@
1
+ import { CacheRegistry } from "@fluid-topics/ft-wc-utils";
2
+ import { FluidTopicsApiProvider } from "./FluidTopicsApiProvider";
3
+ export class FtServiceWithCache {
4
+ constructor(withCommonCache = true, overrideApi) {
5
+ var _a;
6
+ this.overrideApi = overrideApi;
7
+ // Have a different cache for each child class
8
+ let constructor = this.constructor;
9
+ constructor.commonCache = (_a = constructor.commonCache) !== null && _a !== void 0 ? _a : new CacheRegistry();
10
+ this.cache = withCommonCache ? constructor.commonCache : new CacheRegistry();
11
+ }
12
+ get api() {
13
+ var _a;
14
+ return (_a = this.overrideApi) !== null && _a !== void 0 ? _a : FluidTopicsApiProvider.get();
15
+ }
16
+ get awaitApi() {
17
+ var _a;
18
+ return (_a = this.overrideApi) !== null && _a !== void 0 ? _a : FluidTopicsApiProvider.await();
19
+ }
20
+ clearCache() {
21
+ this.cache.clearAll();
22
+ }
23
+ }
@@ -1,4 +1,5 @@
1
1
  import { FtMySearch } from "@fluid-topics/public-api";
2
- export declare class SavedSearchesService {
2
+ import { FtServiceWithCache } from "./FtServiceWithCache";
3
+ export declare class SavedSearchesService extends FtServiceWithCache {
3
4
  listMySearches(): Promise<FtMySearch[]>;
4
5
  }
@@ -1,11 +1,11 @@
1
- import { FluidTopicsApiProvider } from "./FluidTopicsApiProvider";
2
1
  import { ftAppInfoStore } from "../redux-stores/FtAppInfoStore";
3
- export class SavedSearchesService {
2
+ import { FtServiceWithCache } from "./FtServiceWithCache";
3
+ export class SavedSearchesService extends FtServiceWithCache {
4
4
  async listMySearches() {
5
- var _a;
6
- if (!((_a = ftAppInfoStore.getState().session) === null || _a === void 0 ? void 0 : _a.sessionAuthenticated)) {
5
+ let session = ftAppInfoStore.getState().session;
6
+ if (!(session === null || session === void 0 ? void 0 : session.sessionAuthenticated)) {
7
7
  return [];
8
8
  }
9
- return (await FluidTopicsApiProvider.await()).listMySearches(ftAppInfoStore.getState().session.profile.userId);
9
+ return this.cache.get("my-searches", async () => (await this.awaitApi).listMySearches(session.profile.userId), 5 * 60 * 1000);
10
10
  }
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-app-context",
3
- "version": "1.1.37",
3
+ "version": "1.1.39",
4
4
  "description": "Global application context for Fluid Topics integrations",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,11 +19,11 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-wc-utils": "1.1.37",
22
+ "@fluid-topics/ft-wc-utils": "1.1.39",
23
23
  "lit": "3.1.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@fluid-topics/public-api": "1.0.59"
26
+ "@fluid-topics/public-api": "1.0.60"
27
27
  },
28
- "gitHead": "a2f1f35da13aa0735c3765b8149fc7564593a7ed"
28
+ "gitHead": "a9b7f979a6e94b58571a61de90a4b2655800690d"
29
29
  }