@fluid-topics/ft-reader-search-in-document 1.1.66 → 1.1.68

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.
@@ -1048,14 +1048,14 @@ const Ae=Symbol.for(""),De=t=>{if(t?.r===Ae)return t?._$litStatic$},Fe=t=>({_$li
1048
1048
  }
1049
1049
  `,Or=o.css`
1050
1050
  `,wr=o.css`
1051
- `,Sr=e.FtReduxStore.get({name:"ft-app-info",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,openExternalDocumentInNewTab:!1}});class Nr{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Sr.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=Nr.get(t);if(o)e(o);else{const r=Sr.subscribe((()=>{o=Nr.get(t),o&&(r(),e(o))}))}}))}}class Cr{constructor(t=!0,o){var r;this.overrideApi=o;let i=this.constructor;i.commonCache=null!==(r=i.commonCache)&&void 0!==r?r:new e.CacheRegistry,this.cache=t?i.commonCache:new e.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Nr.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Nr.await()}clearCache(){this.cache.clearAll()}}var $r;const Er=Symbol("clearAfterUnitTest");class Ir extends Cr{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[$r]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=Sr.getState().uiLocale,Sr.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Sr.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var r;if(t=t.toLowerCase(),Object.keys(o).length>0){const i={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...o};e.deepEqual(this.defaultMessages[t],i)||(this.defaultMessages[t]=i,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...r){var i,n,a;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(i=this.cache.getNow(t))||void 0===i?void 0:i.messages)&&void 0!==n?n:{};return new e.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},l).resolve(o,...r)}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,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}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=>e.delay(0).then((()=>t())).catch((()=>null)))))}}$r=Er,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ir{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ir{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Rr=window.FluidTopicsI18nService,kr=window.FluidTopicsCustomI18nService;var Ur=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Lr extends e.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Nr.get(),this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return o.html`
1051
+ `,Sr=e.FtReduxStore.get({name:"ft-app-info",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,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class Nr{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Sr.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=Nr.get(t);if(o)e(o);else{const r=Sr.subscribe((()=>{o=Nr.get(t),o&&(r(),e(o))}))}}))}}class Cr{constructor(t=!0,o){var r;this.overrideApi=o;let i=this.constructor;i.commonCache=null!==(r=i.commonCache)&&void 0!==r?r:new e.CacheRegistry,this.cache=t?i.commonCache:new e.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Nr.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Nr.await()}clearCache(){this.cache.clearAll()}}var $r;const Er=Symbol("clearAfterUnitTest");class Ir extends Cr{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[$r]=()=>{this.defaultMessages={},this.cache=new e.CacheRegistry,this.listeners={}},this.currentUiLocale=Sr.getState().uiLocale,Sr.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Sr.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var r;if(t=t.toLowerCase(),Object.keys(o).length>0){const i={...null!==(r=this.defaultMessages[t])&&void 0!==r?r:{},...o};e.deepEqual(this.defaultMessages[t],i)||(this.defaultMessages[t]=i,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...r){var i,n,a;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(i=this.cache.getNow(t))||void 0===i?void 0:i.messages)&&void 0!==n?n:{};return new e.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},l).resolve(o,...r)}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,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}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=>e.delay(0).then((()=>t())).catch((()=>null)))))}}$r=Er,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ir{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ir{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Rr=window.FluidTopicsI18nService,kr=window.FluidTopicsCustomI18nService;var Ur=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Lr extends e.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>Nr.get(),this.messageContexts=[],this.cache=new e.CacheRegistry,this.cleanSessionDebouncer=new e.Debouncer}render(){return o.html`
1052
1052
  <slot></slot>
1053
- `}update(t){super.update(t),t.has("baseUrl")&&(Sr.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Sr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Sr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Sr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Sr.actions.noCustom(this.noCustom),t.has("editorMode")&&Sr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Sr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Sr.actions.session(this.session),t.has("availableUiLocales")&&Sr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Rr.addContext(t))),t.has("openExternalDocumentInNewTab")&&Sr.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),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()))}}Lr.elementDefinitions={},Lr.styles=wr,Ur([r.property()],Lr.prototype,"baseUrl",void 0),Ur([r.property()],Lr.prototype,"apiIntegrationIdentifier",void 0),Ur([r.property()],Lr.prototype,"uiLocale",void 0),Ur([e.jsonProperty(null)],Lr.prototype,"availableUiLocales",void 0),Ur([e.jsonProperty(null)],Lr.prototype,"metadataConfiguration",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"editorMode",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"noCustom",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"openExternalDocumentInNewTab",void 0),Ur([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Lr.prototype,"noCustomComponent",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"withManualResources",void 0),Ur([e.jsonProperty([])],Lr.prototype,"messageContexts",void 0),Ur([e.jsonProperty(void 0)],Lr.prototype,"session",void 0),Ur([r.property({type:Object})],Lr.prototype,"apiProvider",void 0);class Wr extends Cr{async listMySearches(){let t=Sr.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 Cr{async listMyBookmarks(){let t=Sr.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Zr=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Kr=new class{constructor(){this.currentSession=Sr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new zr,this.savedSearchesService=new Wr,Sr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Sr.getState();e.deepEqual(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(),Zr.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Zr.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Zr.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 e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Zr.actions.bookmarks(e)}}};e.customElement("ft-app-context")(Lr);var Ar=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Dr=Symbol("i18nAttributes"),Fr=Symbol("i18nProperties"),Br=Symbol("i18nUnsubs");function Tr(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?kr:Rr}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Dr])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[Fr])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Dr])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[Fr])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[Fr])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Dr])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Br].has(t)||this[Br].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Br].forEach((t=>t())),this[Br].clear()}}return e=Br,Ar([r.property({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Hr extends(Tr(e.FtLitElement)){}class Pr extends(Tr(e.FtLitElementRedux)){}var Mr=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class jr extends Pr{constructor(){super(),this.editorMode=!1,this.addStore(Sr)}render(){return this.key&&this.context?o.html`
1053
+ `}update(t){super.update(t),t.has("baseUrl")&&(Sr.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Sr.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Sr.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Sr.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Sr.actions.noCustom(this.noCustom),t.has("editorMode")&&Sr.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Sr.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Sr.actions.session(this.session),t.has("availableUiLocales")&&Sr.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Rr.addContext(t))),t.has("openExternalDocumentInNewTab")&&Sr.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&Sr.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&Sr.actions.forcedOffline(this.forcedOffline),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()))}}Lr.elementDefinitions={},Lr.styles=wr,Ur([r.property()],Lr.prototype,"baseUrl",void 0),Ur([r.property()],Lr.prototype,"apiIntegrationIdentifier",void 0),Ur([r.property()],Lr.prototype,"uiLocale",void 0),Ur([e.jsonProperty(null)],Lr.prototype,"availableUiLocales",void 0),Ur([e.jsonProperty(null)],Lr.prototype,"metadataConfiguration",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"editorMode",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"noCustom",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"openExternalDocumentInNewTab",void 0),Ur([r.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Lr.prototype,"noCustomComponent",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"withManualResources",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"navigatorOnline",void 0),Ur([r.property({type:Boolean})],Lr.prototype,"forcedOffline",void 0),Ur([r.property({type:Object})],Lr.prototype,"apiProvider",void 0),Ur([e.jsonProperty([])],Lr.prototype,"messageContexts",void 0),Ur([e.jsonProperty(void 0)],Lr.prototype,"session",void 0);class Wr extends Cr{async listMySearches(){let t=Sr.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 Cr{async listMyBookmarks(){let t=Sr.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Zr=e.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Kr=new class{constructor(){this.currentSession=Sr.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new zr,this.savedSearchesService=new Wr,Sr.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=Sr.getState();e.deepEqual(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(),Zr.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Zr.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Zr.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 e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Zr.actions.bookmarks(e)}}};e.customElement("ft-app-context")(Lr);var Ar=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Dr=Symbol("i18nAttributes"),Fr=Symbol("i18nProperties"),Br=Symbol("i18nUnsubs");function Tr(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?kr:Rr}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Dr])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[Fr])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Dr])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[Fr])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[Fr])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Dr])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Br].has(t)||this[Br].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Br].forEach((t=>t())),this[Br].clear()}}return e=Br,Ar([r.property({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Hr extends(Tr(e.FtLitElement)){}class Pr extends(Tr(e.FtLitElementRedux)){}var Mr=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class jr extends Pr{constructor(){super(),this.editorMode=!1,this.addStore(Sr)}render(){return this.key&&this.context?o.html`
1054
1054
  <span class="ft-i18n">
1055
1055
  ${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
1056
1056
  </span>
1057
1057
  `:this.editorMode?"Select a context and a label key.":o.nothing}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}jr.elementDefinitions={},jr.styles=Or,Mr([e.redux()],jr.prototype,"editorMode",void 0),Mr([r.property()],jr.prototype,"context",void 0),Mr([r.property()],jr.prototype,"key",void 0),Mr([e.jsonProperty([])],jr.prototype,"args",void 0),Mr([r.property()],jr.prototype,"defaultMessage",void 0);class Gr{static build(t){return new Gr(t)}static fromGwt(t){return new Gr(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const o=e;return t=>({context:this.name,key:o,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Rr.resolveMessage(this.name,e,...t)})}}e.customElement("ft-i18n")(jr);const _r=o.css`
1058
- `,qr={setRequest:(t,e)=>{t.request=e.payload},setRequestQuery:(t,e)=>{t.request.query=e.payload},setRequestContentLocale:(t,e)=>{t.request.contentLocale=e.payload},setPageSize:(t,e)=>{t.request.paging.perPage=e.payload},setPageNumber:(t,e)=>{t.request.paging.page=e.payload},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestFilters:(t,e)=>{t.request.filters=e.payload},setRequestFacets:(t,e)=>{t.request.facets=e.payload},setRequestVirtualField:(t,e)=>{t.request.virtualField=e.payload},setRequestScope:(t,e)=>{t.request.scope=e.payload},setResults:(t,e)=>{t.results=e.payload},setFacets:(t,e)=>{t.facets=e.payload},setSpellcheck:(t,e)=>{t.spellcheck=e.payload},setLocales:(t,e)=>{t.locales=e.payload},setPaging:(t,e)=>{t.paging=e.payload},setLiveQuery:(t,e)=>{t.liveQuery=e.payload},setSuggestResults:(t,e)=>{t.suggestResults=e.payload},setRequestPeriodFilter:(t,e)=>{t.request.periodFilter=e.payload}};var Yr,Vr,Qr,Xr,Jr,ti,ei,oi,ri,ii,ni,ai,li,si,ci,pi,fi,di;!function(t){!function(e){var o={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(o.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o.iterable&&(e[Symbol.iterator]=function(){return e}),e}function s(t){this.map={},t instanceof s?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,o){t.onload=function(){e(t.result)},t.onerror=function(){o(t.error)}}))}function f(t){var e=new FileReader,o=p(e);return e.readAsArrayBuffer(t),o}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o.arrayBuffer&&o.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,e,o,r=c(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,o=p(e),e.readAsText(t),o;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),o=new Array(e.length),r=0;r<e.length;r++)o[r]=String.fromCharCode(e[r]);return o.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}s.prototype.append=function(t,e){t=n(t),e=a(e);var o=this.map[t];this.map[t]=o?o+", "+e:e},s.prototype.delete=function(t){delete this.map[n(t)]},s.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},s.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},s.prototype.set=function(t,e){this.map[n(t)]=a(e)},s.prototype.forEach=function(t,e){for(var o in this.map)this.map.hasOwnProperty(o)&&t.call(e,this.map[o],o,this)},s.prototype.keys=function(){var t=[];return this.forEach((function(e,o){t.push(o)})),l(t)},s.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),l(t)},s.prototype.entries=function(){var t=[];return this.forEach((function(e,o){t.push([o,e])})),l(t)},o.iterable&&(s.prototype[Symbol.iterator]=s.prototype.entries);var u=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var o,r,i=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new s(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new s(e.headers)),this.method=(o=e.method||this.method||"GET",r=o.toUpperCase(),u.indexOf(r)>-1?r:o),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var o=t.split("="),r=o.shift().replace(/\+/g," "),i=o.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new s(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},h.call(g.prototype),h.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,e){if(-1===m.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var o=Error(t);this.stack=o.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function x(t,r){return new Promise((function(i,n){var a=new g(t,r);if(a.signal&&a.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function c(){l.abort()}l.onload=function(){var t,e,o={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",e=new s,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var o=t.split(":"),r=o.shift().trim();if(r){var i=o.join(":").trim();e.append(r,i)}})),e)};o.url="responseURL"in l?l.responseURL:o.headers.get("X-Request-URL");var r="response"in l?l.response:l.responseText;i(new b(r,o))},l.onerror=function(){n(new TypeError("Network request failed"))},l.ontimeout=function(){n(new TypeError("Network request failed"))},l.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},l.open(a.method,a.url,!0),"include"===a.credentials?l.withCredentials=!0:"omit"===a.credentials&&(l.withCredentials=!1),"responseType"in l&&o.blob&&(l.responseType="blob"),a.headers.forEach((function(t,e){l.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),l.onreadystatechange=function(){4===l.readyState&&a.signal.removeEventListener("abort",c)}),l.send(void 0===a._bodyInit?null:a._bodyInit)}))}x.polyfill=!0,t.fetch||(t.fetch=x,t.Headers=s,t.Request=g,t.Response=b),e.Headers=s,e.Request=g,e.Response=b,e.fetch=x,Object.defineProperty(e,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Yr||(Yr={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Vr||(Vr={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(Qr||(Qr={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Xr||(Xr={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Jr||(Jr={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(ti||(ti={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(ei||(ei={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(oi||(oi={})),function(t){t.ASC="ASC",t.DESC="DESC"}(ri||(ri={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(ii||(ii={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(ni||(ni={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(ai||(ai={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(li||(li={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(si||(si={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(ci||(ci={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(pi||(pi={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(fi||(fi={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(di||(di={})),fi.PERSONAL_BOOK_SHARE_USER,fi.PERSONAL_BOOK_USER,fi.HTML_EXPORT_USER,fi.PERSONAL_BOOK_USER,fi.PDF_EXPORT_USER,fi.PERSONAL_BOOK_USER,fi.KHUB_ADMIN,fi.CONTENT_PUBLISHER,fi.ADMIN,fi.KHUB_ADMIN,fi.USERS_ADMIN,fi.PORTAL_ADMIN,fi.DEVELOPER,fi.BETA_USER,fi.DEBUG_USER;class hi extends Cr{constructor(){super(),this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}class ui extends Event{constructor(){super(ui.eventName)}}ui.eventName="search-context-clear-all-filters";class gi{static build(t,o){return new gi((t=>e.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:qr}))(t.trim()||"context"),o)}constructor(t,o){this.store=t,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new e.Debouncer(100),this.suggestDebouncer=new e.Debouncer(300),this.service=null!=o?o:new hi}async initService(){return this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let e=this.store.getState().locales,o=this.store.getState().request.contentLocale;if(t!=o){if(e){const r=t=>e.some((e=>e.lang==t));r(t)||(t=r(o)?o:e[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const e=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(e),this.store.actions.setPageNumber(1),e.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(ni.TITLE_ONLY),this.store.actions.setRequestScope(pi.DOCUMENTS)):(this.store.actions.setRequestVirtualField(ni.EVERYWHERE),this.store.actions.setRequestScope(pi.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return(t=>t.request.virtualField===ni.TITLE_ONLY&&t.request.scope===pi.DOCUMENTS)(this.store.getState())}get periodFilter(){return this.store.getState().request.periodFilter}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new ui)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,e){let o=this.facetIds.filter((e=>e!=t));e&&o.push(e),this.facetIds=o,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let e=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(e)}setFilter(t,e){let o=this.store.getState().request.filters,r={key:t,values:e,negative:!1},i=[...o.filter((e=>e.key!==t)),r];this.setFilters(i)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}setOpenExternalDocumentInNewTab(t){this.openExternalDocumentInNewTab=t}setPeriodFilter(t){this.store.actions.setRequestPeriodFilter(t),this.store.actions.setPageNumber(1),this.launchSearch()}launchSearch(){return this.searchDebouncer.run((()=>this.fetchSearchData()))}launchSuggest(){return this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,o;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let r=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==r.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=e.cancelable(this.service.launchSearch(r));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let e=(null!==(o=this.store.getState().results)&&void 0!==o?o:[]).concat(t.results);this.store.actions.setResults(e)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof e.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const o=this.store.getState(),r=o.request,i={input:o.liveQuery,filters:r.filters,sort:r.sort,contentLocale:r.contentLocale,scope:r.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=e.cancelable(this.service.launchSuggest(i));let n=await this.cancelableSuggest;this.store.actions.setSuggestResults(n.suggestions)}catch(t){t instanceof e.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var yi=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class bi extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const mi=Symbol("registerInterval");class xi extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[mi]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[mi]):this.dispatchEvent(new bi)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=mi,yi([r.state()],o.prototype,"stateManager",void 0),o}(e.FtLitElementRedux)){}var vi,Oi=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class wi extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class Si extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class Ni extends CustomEvent{constructor(t,e,o){super("ft-search-results-change",{detail:{request:t,paging:e,spellcheck:o}})}}class Ci extends e.FtLitElementRedux{get stateManager(){if(null==this._stateManager){const t=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=gi.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),t),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")}return this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(Sr)}render(){return o.html`
1058
+ `,qr={setRequest:(t,e)=>{t.request=e.payload},setRequestQuery:(t,e)=>{t.request.query=e.payload},setRequestContentLocale:(t,e)=>{t.request.contentLocale=e.payload},setPageSize:(t,e)=>{t.request.paging.perPage=e.payload},setPageNumber:(t,e)=>{t.request.paging.page=e.payload},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestFilters:(t,e)=>{t.request.filters=e.payload},setRequestFacets:(t,e)=>{t.request.facets=e.payload},setRequestVirtualField:(t,e)=>{t.request.virtualField=e.payload},setRequestScope:(t,e)=>{t.request.scope=e.payload},setRequestClusterSortCriterion:(t,e)=>{t.request.clusterSortCriterions=e.payload},setResults:(t,e)=>{t.results=e.payload},setFacets:(t,e)=>{t.facets=e.payload},setSpellcheck:(t,e)=>{t.spellcheck=e.payload},setLocales:(t,e)=>{t.locales=e.payload},setPaging:(t,e)=>{t.paging=e.payload},setLiveQuery:(t,e)=>{t.liveQuery=e.payload},setSuggestResults:(t,e)=>{t.suggestResults=e.payload},setRequestPeriodFilter:(t,e)=>{t.request.periodFilter=e.payload}};var Yr,Vr,Qr,Xr,Jr,ti,ei,oi,ri,ii,ni,ai,li,si,ci,pi,fi,di;!function(t){!function(e){var o={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(o.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o.iterable&&(e[Symbol.iterator]=function(){return e}),e}function s(t){this.map={},t instanceof s?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,o){t.onload=function(){e(t.result)},t.onerror=function(){o(t.error)}}))}function f(t){var e=new FileReader,o=p(e);return e.readAsArrayBuffer(t),o}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o.arrayBuffer&&o.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,e,o,r=c(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,o=p(e),e.readAsText(t),o;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),o=new Array(e.length),r=0;r<e.length;r++)o[r]=String.fromCharCode(e[r]);return o.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}s.prototype.append=function(t,e){t=n(t),e=a(e);var o=this.map[t];this.map[t]=o?o+", "+e:e},s.prototype.delete=function(t){delete this.map[n(t)]},s.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},s.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},s.prototype.set=function(t,e){this.map[n(t)]=a(e)},s.prototype.forEach=function(t,e){for(var o in this.map)this.map.hasOwnProperty(o)&&t.call(e,this.map[o],o,this)},s.prototype.keys=function(){var t=[];return this.forEach((function(e,o){t.push(o)})),l(t)},s.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),l(t)},s.prototype.entries=function(){var t=[];return this.forEach((function(e,o){t.push([o,e])})),l(t)},o.iterable&&(s.prototype[Symbol.iterator]=s.prototype.entries);var u=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var o,r,i=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new s(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new s(e.headers)),this.method=(o=e.method||this.method||"GET",r=o.toUpperCase(),u.indexOf(r)>-1?r:o),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var o=t.split("="),r=o.shift().replace(/\+/g," "),i=o.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new s(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},h.call(g.prototype),h.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,e){if(-1===m.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var o=Error(t);this.stack=o.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function x(t,r){return new Promise((function(i,n){var a=new g(t,r);if(a.signal&&a.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function c(){l.abort()}l.onload=function(){var t,e,o={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",e=new s,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var o=t.split(":"),r=o.shift().trim();if(r){var i=o.join(":").trim();e.append(r,i)}})),e)};o.url="responseURL"in l?l.responseURL:o.headers.get("X-Request-URL");var r="response"in l?l.response:l.responseText;i(new b(r,o))},l.onerror=function(){n(new TypeError("Network request failed"))},l.ontimeout=function(){n(new TypeError("Network request failed"))},l.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},l.open(a.method,a.url,!0),"include"===a.credentials?l.withCredentials=!0:"omit"===a.credentials&&(l.withCredentials=!1),"responseType"in l&&o.blob&&(l.responseType="blob"),a.headers.forEach((function(t,e){l.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),l.onreadystatechange=function(){4===l.readyState&&a.signal.removeEventListener("abort",c)}),l.send(void 0===a._bodyInit?null:a._bodyInit)}))}x.polyfill=!0,t.fetch||(t.fetch=x,t.Headers=s,t.Request=g,t.Response=b),e.Headers=s,e.Request=g,e.Response=b,e.fetch=x,Object.defineProperty(e,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Yr||(Yr={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Vr||(Vr={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(Qr||(Qr={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Xr||(Xr={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Jr||(Jr={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(ti||(ti={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(ei||(ei={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(oi||(oi={})),function(t){t.ASC="ASC",t.DESC="DESC"}(ri||(ri={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(ii||(ii={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(ni||(ni={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(ai||(ai={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(li||(li={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(si||(si={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(ci||(ci={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(pi||(pi={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(fi||(fi={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(di||(di={})),fi.PERSONAL_BOOK_SHARE_USER,fi.PERSONAL_BOOK_USER,fi.HTML_EXPORT_USER,fi.PERSONAL_BOOK_USER,fi.PDF_EXPORT_USER,fi.PERSONAL_BOOK_USER,fi.KHUB_ADMIN,fi.CONTENT_PUBLISHER,fi.ADMIN,fi.KHUB_ADMIN,fi.USERS_ADMIN,fi.PORTAL_ADMIN,fi.DEVELOPER,fi.BETA_USER,fi.DEBUG_USER;class hi extends Cr{constructor(){super(),this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}class ui extends Event{constructor(){super(ui.eventName)}}ui.eventName="search-context-clear-all-filters";class gi{static build(t,o){return new gi((t=>e.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:qr}))(t.trim()||"context"),o)}constructor(t,o){this.store=t,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new e.Debouncer(100),this.suggestDebouncer=new e.Debouncer(300),this.service=null!=o?o:new hi}async initService(){return this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let e=this.store.getState().locales,o=this.store.getState().request.contentLocale;if(t!=o){if(e){const r=t=>e.some((e=>e.lang==t));r(t)||(t=r(o)?o:e[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const e=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(e),this.store.actions.setPageNumber(1),e.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setClusterSortCriterion(t){this.store.actions.setRequestClusterSortCriterion(t),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(ni.TITLE_ONLY),this.store.actions.setRequestScope(pi.DOCUMENTS)):(this.store.actions.setRequestVirtualField(ni.EVERYWHERE),this.store.actions.setRequestScope(pi.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return(t=>t.request.virtualField===ni.TITLE_ONLY&&t.request.scope===pi.DOCUMENTS)(this.store.getState())}get periodFilter(){return this.store.getState().request.periodFilter}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new ui)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,e){let o=this.facetIds.filter((e=>e!=t));e&&o.push(e),this.facetIds=o,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let e=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(e)}setFilter(t,e){let o=this.store.getState().request.filters,r={key:t,values:e,negative:!1},i=[...o.filter((e=>e.key!==t)),r];this.setFilters(i)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}setOpenExternalDocumentInNewTab(t){this.openExternalDocumentInNewTab=t}setPeriodFilter(t){this.store.actions.setRequestPeriodFilter(t),this.store.actions.setPageNumber(1),this.launchSearch()}launchSearch(){return this.searchDebouncer.run((()=>this.fetchSearchData()))}launchSuggest(){return this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,o;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let r=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==r.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=e.cancelable(this.service.launchSearch(r));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let e=(null!==(o=this.store.getState().results)&&void 0!==o?o:[]).concat(t.results);this.store.actions.setResults(e)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof e.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const o=this.store.getState(),r=o.request,i={input:o.liveQuery,filters:r.filters,sort:r.sort,contentLocale:r.contentLocale,scope:r.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=e.cancelable(this.service.launchSuggest(i));let n=await this.cancelableSuggest;this.store.actions.setSuggestResults(n.suggestions)}catch(t){t instanceof e.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var yi=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class bi extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const mi=Symbol("registerInterval");class xi extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[mi]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[mi]):this.dispatchEvent(new bi)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=mi,yi([r.state()],o.prototype,"stateManager",void 0),o}(e.FtLitElementRedux)){}var vi,Oi=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class wi extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class Si extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class Ni extends CustomEvent{constructor(t,e,o){super("ft-search-results-change",{detail:{request:t,paging:e,spellcheck:o}})}}class Ci extends e.FtLitElementRedux{get stateManager(){if(null==this._stateManager){const t=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=gi.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),t),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")}return this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(Sr)}render(){return o.html`
1059
1059
  <slot @register-ft-search-component=${this.registerComponent}></slot>
1060
1060
  `}update(t){super.update(t),t.has("query")&&void 0!==this.query&&this.stateManager.setQuery(this.query),t.has("contentLocale")&&void 0!==this.contentLocale&&this.stateManager.setContentLocale(this.contentLocale),t.has("session")&&this.session&&this.stateManager.initService(),t.has("filters")&&void 0!==this.filters&&this.stateManager.setFilters(this.filters),t.has("sort")&&void 0!==this.sort&&this.stateManager.setSort(this.sort),t.has("pageSize")&&void 0!==this.pageSize&&this.stateManager.setPageSize(this.pageSize),t.has("searchInDocumentTitlesOnly")&&void 0!==this.searchInDocumentTitlesOnly&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),t.has("scope")&&void 0!==this.scope&&this.stateManager.setScope(this.scope),t.has("ignoreEmptyQuery")&&void 0!==this.ignoreEmptyQuery&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),t.has("openExternalDocumentInNewTab")&&void 0!==this.openExternalDocumentInNewTab&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("periodFilter")&&void 0!==this.periodFilter&&this.stateManager.setPeriodFilter(this.periodFilter)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(t){super.contentAvailableCallback(t),t.has("request")&&this.request&&this.dispatchEvent(new Si(this.request)),t.has("paging")&&void 0!==this.paging&&this.dispatchEvent(new Ni(this.request,this.paging,this.autocorrect))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setSearchStateManager(this.stateManager)}handleLoadError(t){this.dispatchEvent(new wi(t))}reloadSavedSearches(){Kr.clearMySearches()}clear(){this.stateManager.clear()}}Ci.elementDefinitions={},Ci.styles=_r,Oi([r.property()],Ci.prototype,"query",void 0),Oi([r.property()],Ci.prototype,"contentLocale",void 0),Oi([r.property({type:Number})],Ci.prototype,"pageSize",void 0),Oi([r.property({type:Boolean})],Ci.prototype,"searchInDocumentTitlesOnly",void 0),Oi([r.property()],Ci.prototype,"periodFilter",void 0),Oi([r.property()],Ci.prototype,"scope",void 0),Oi([r.property({type:Boolean})],Ci.prototype,"ignoreEmptyQuery",void 0),Oi([e.redux({store:Sr.name})],Ci.prototype,"openExternalDocumentInNewTab",void 0),Oi([e.jsonProperty([])],Ci.prototype,"filters",void 0),Oi([e.jsonProperty([])],Ci.prototype,"sort",void 0),Oi([e.redux({store:"search"})],Ci.prototype,"request",void 0),Oi([e.redux({store:"search"})],Ci.prototype,"paging",void 0),Oi([e.redux({store:"search",selector:t=>t.spellcheck})],Ci.prototype,"autocorrect",void 0),Oi([e.redux({store:Sr.name})],Ci.prototype,"session",void 0),Oi([r.property({attribute:!1})],Ci.prototype,"searchServiceProvider",void 0),e.customElement("ft-search-context")(Ci),function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"}(vi||(vi={}));var $i=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Ei extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}const Ii=Symbol("registerInterval");class Ri extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setReaderStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this[Ii]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Ii]):this.dispatchEvent(new Ei)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Ii,$i([r.state()],o.prototype,"stateManager",void 0),o}(e.FtLitElementRedux)){}const ki=o.css`
1061
1061
 
@@ -1193,14 +1193,14 @@ const Ae=Symbol.for(""),De=t=>{if(t?.r===Ae)return t?._$litStatic$},Fe=t=>({_$li
1193
1193
  `}selectAbstract(t){switch(t.type){case"MAP":return t.map.htmlExcerpt;case"DOCUMENT":return t.document.htmlExcerpt;case"TOPIC":return t.topic.htmlExcerpt}return""}}rn.elementDefinitions={"ft-typography":Me},rn.styles=gr,e.customElement("ft-search-result-abstract")(rn);var nn=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class an extends(Tr(xi)){constructor(){super(),this.clusterPolicy="display-first-result",this.displayNoResultsMessage=!1,this.renderResult=()=>o.html`
1194
1194
  <ft-search-result-title></ft-search-result-title>
1195
1195
  <ft-search-result-abstract></ft-search-result-abstract>
1196
- `,this.selectedResultByCluster={},this.addI18nContext(Ui)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return o.html`
1196
+ `,this.clusterSortCriterion=[],this.selectedResultByCluster={},this.addI18nContext(Ui)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return o.html`
1197
1197
  <ft-typography part="no-results-message" variant="body1">${Ui.messages.results(0)}</ft-typography>
1198
1198
  `;const t=this.buildClusters();return a.repeat(t,(t=>t.id),((t,e)=>{var r;return o.html`
1199
1199
  <ft-search-result-context .cluster=${t} index="${e}"
1200
1200
  @ft-search-result-cluster-change="${e=>this.onClusterChange(t.id,e.detail)}">
1201
1201
  ${this.renderResult(null!==(r=this.selectedResultByCluster[t.id])&&void 0!==r?r:t.entries[0],e)}
1202
1202
  </ft-search-result-context>
1203
- `}))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,i,n;return null!==(i=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==i?i:null===(n=t.document)||void 0===n?void 0:n.documentId}}an.styles=Hi,nn([r.property({type:String,attribute:"cluster-policy"})],an.prototype,"clusterPolicy",void 0),nn([r.property({type:Boolean})],an.prototype,"displayNoResultsMessage",void 0),nn([r.property({attribute:!1})],an.prototype,"renderResult",void 0),nn([e.redux()],an.prototype,"request",void 0),nn([e.redux()],an.prototype,"results",void 0),e.customElement("ft-search-results")(an);var ln=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class sn extends e.FtLitElement{constructor(){super(...arguments),this.title="",this.clickable=!1,this.selected=!1,this.noHeader=!1}render(){const t={selected:this.selected,clickable:this.clickable,"no-header":this.noHeader};return o.html`
1203
+ `}))}update(t){var e;super.update(t),(t.has("clusterSortCriterion")||t.has("stateManager")&&this.clusterSortCriterion)&&(null===(e=this.stateManager)||void 0===e||e.setClusterSortCriterion(this.clusterSortCriterion))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,i,n;return null!==(i=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==i?i:null===(n=t.document)||void 0===n?void 0:n.documentId}}an.styles=Hi,nn([r.property({type:String,attribute:"cluster-policy"})],an.prototype,"clusterPolicy",void 0),nn([r.property({type:Boolean})],an.prototype,"displayNoResultsMessage",void 0),nn([r.property({attribute:!1})],an.prototype,"renderResult",void 0),nn([e.jsonProperty([])],an.prototype,"clusterSortCriterion",void 0),nn([e.redux()],an.prototype,"request",void 0),nn([e.redux()],an.prototype,"results",void 0),e.customElement("ft-search-results")(an);var ln=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class sn extends e.FtLitElement{constructor(){super(...arguments),this.title="",this.clickable=!1,this.selected=!1,this.noHeader=!1}render(){const t={selected:this.selected,clickable:this.clickable,"no-header":this.noHeader};return o.html`
1204
1204
  <div id="container" part="container" class=${i.classMap(t)}>
1205
1205
  ${this.clickable?o.html`
1206
1206
  <ft-ripple primary ?selected=${this.selected}></ft-ripple>
@@ -1217,14 +1217,14 @@ const tc=Symbol.for(""),ec=t=>{if(t?.r===tc)return t?._$litStatic$},oc=t=>({_$li
1217
1217
  }
1218
1218
  `,Fc=ut`
1219
1219
  `,zc=ut`
1220
- `,Pc=ts.get({name:"ft-app-info",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,openExternalDocumentInNewTab:!1}});class _c{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Pc.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=_c.get(t);if(o)e(o);else{const r=Pc.subscribe((()=>{o=_c.get(t),o&&(r(),e(o))}))}}))}}class jc{constructor(t=!0,e){var o;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(o=r.commonCache)&&void 0!==o?o:new ro,this.cache=t?r.commonCache:new ro}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:_c.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:_c.await()}clearCache(){this.cache.clearAll()}}var Mc;const Dc=Symbol("clearAfterUnitTest");class Tc extends jc{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Mc]=()=>{this.defaultMessages={},this.cache=new ro,this.listeners={}},this.currentUiLocale=Pc.getState().uiLocale,Pc.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Pc.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};uo(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new tn(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...o)}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,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}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=>co(0).then((()=>t())).catch((()=>null)))))}}Mc=Dc,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Tc{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Tc{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Kc=window.FluidTopicsI18nService,Zc=window.FluidTopicsCustomI18nService;var Hc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Gc extends ji{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>_c.get(),this.cache=new ro,this.cleanSessionDebouncer=new so}render(){return Jt`
1220
+ `,Pc=ts.get({name:"ft-app-info",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,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class _c{static get(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Pc.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static await(t){return new Promise((e=>{let o=_c.get(t);if(o)e(o);else{const r=Pc.subscribe((()=>{o=_c.get(t),o&&(r(),e(o))}))}}))}}class jc{constructor(t=!0,e){var o;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(o=r.commonCache)&&void 0!==o?o:new ro,this.cache=t?r.commonCache:new ro}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:_c.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:_c.await()}clearCache(){this.cache.clearAll()}}var Mc;const Dc=Symbol("clearAfterUnitTest");class Tc extends jc{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Mc]=()=>{this.defaultMessages={},this.cache=new ro,this.listeners={}},this.currentUiLocale=Pc.getState().uiLocale,Pc.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Pc.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};uo(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new tn(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...o)}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,e){var o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.delete(e)}}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=>co(0).then((()=>t())).catch((()=>null)))))}}Mc=Dc,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Tc{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Tc{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Kc=window.FluidTopicsI18nService,Zc=window.FluidTopicsCustomI18nService;var Hc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Gc extends ji{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>_c.get(),this.messageContexts=[],this.cache=new ro,this.cleanSessionDebouncer=new so}render(){return Jt`
1221
1221
  <slot></slot>
1222
- `}update(t){super.update(t),t.has("baseUrl")&&(Pc.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Pc.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Pc.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Pc.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Pc.actions.noCustom(this.noCustom),t.has("editorMode")&&Pc.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Pc.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Pc.actions.session(this.session),t.has("availableUiLocales")&&Pc.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Kc.addContext(t))),t.has("openExternalDocumentInNewTab")&&Pc.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),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()))}}Gc.elementDefinitions={},Gc.styles=zc,Hc([Se()],Gc.prototype,"baseUrl",void 0),Hc([Se()],Gc.prototype,"apiIntegrationIdentifier",void 0),Hc([Se()],Gc.prototype,"uiLocale",void 0),Hc([yo(null)],Gc.prototype,"availableUiLocales",void 0),Hc([yo(null)],Gc.prototype,"metadataConfiguration",void 0),Hc([Se({type:Boolean})],Gc.prototype,"editorMode",void 0),Hc([Se({type:Boolean})],Gc.prototype,"noCustom",void 0),Hc([Se({type:Boolean})],Gc.prototype,"openExternalDocumentInNewTab",void 0),Hc([Se({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Gc.prototype,"noCustomComponent",void 0),Hc([Se({type:Boolean})],Gc.prototype,"withManualResources",void 0),Hc([yo([])],Gc.prototype,"messageContexts",void 0),Hc([yo(void 0)],Gc.prototype,"session",void 0),Hc([Se({type:Object})],Gc.prototype,"apiProvider",void 0);class Vc extends jc{async listMySearches(){let t=Pc.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class qc extends jc{async listMyBookmarks(){let t=Pc.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Yc=ts.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Jc=new class{constructor(){this.currentSession=Pc.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new qc,this.savedSearchesService=new Vc,Pc.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Pc.getState();uo(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Yc.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Yc.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Yc.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 e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Yc.actions.bookmarks(e)}}};go("ft-app-context")(Gc);var Qc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Xc=Symbol("i18nAttributes"),tf=Symbol("i18nProperties"),ef=Symbol("i18nUnsubs");function of(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Zc:Kc}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Xc])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[tf])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Xc])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[tf])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[tf])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Xc])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[ef].has(t)||this[ef].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[ef].forEach((t=>t())),this[ef].clear()}}return e=ef,Qc([Se({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class rf extends(of(ji)){}class nf extends(of(un)){}var af=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class sf extends nf{constructor(){super(),this.editorMode=!1,this.addStore(Pc)}render(){return this.key&&this.context?Jt`
1222
+ `}update(t){super.update(t),t.has("baseUrl")&&(Pc.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Pc.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Pc.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Pc.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Pc.actions.noCustom(this.noCustom),t.has("editorMode")&&Pc.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Pc.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Pc.actions.session(this.session),t.has("availableUiLocales")&&Pc.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Kc.addContext(t))),t.has("openExternalDocumentInNewTab")&&Pc.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&Pc.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&Pc.actions.forcedOffline(this.forcedOffline),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()))}}Gc.elementDefinitions={},Gc.styles=zc,Hc([Se()],Gc.prototype,"baseUrl",void 0),Hc([Se()],Gc.prototype,"apiIntegrationIdentifier",void 0),Hc([Se()],Gc.prototype,"uiLocale",void 0),Hc([yo(null)],Gc.prototype,"availableUiLocales",void 0),Hc([yo(null)],Gc.prototype,"metadataConfiguration",void 0),Hc([Se({type:Boolean})],Gc.prototype,"editorMode",void 0),Hc([Se({type:Boolean})],Gc.prototype,"noCustom",void 0),Hc([Se({type:Boolean})],Gc.prototype,"openExternalDocumentInNewTab",void 0),Hc([Se({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Gc.prototype,"noCustomComponent",void 0),Hc([Se({type:Boolean})],Gc.prototype,"withManualResources",void 0),Hc([Se({type:Boolean})],Gc.prototype,"navigatorOnline",void 0),Hc([Se({type:Boolean})],Gc.prototype,"forcedOffline",void 0),Hc([Se({type:Object})],Gc.prototype,"apiProvider",void 0),Hc([yo([])],Gc.prototype,"messageContexts",void 0),Hc([yo(void 0)],Gc.prototype,"session",void 0);class Vc extends jc{async listMySearches(){let t=Pc.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class qc extends jc{async listMyBookmarks(){let t=Pc.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Yc=ts.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const Jc=new class{constructor(){this.currentSession=Pc.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new qc,this.savedSearchesService=new Vc,Pc.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Pc.getState();uo(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Yc.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Yc.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Yc.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 e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Yc.actions.bookmarks(e)}}};go("ft-app-context")(Gc);var Qc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Xc=Symbol("i18nAttributes"),tf=Symbol("i18nProperties"),ef=Symbol("i18nUnsubs");function of(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Zc:Kc}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Xc])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[tf])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Xc])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[tf])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[tf])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Xc])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[ef].has(t)||this[ef].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[ef].forEach((t=>t())),this[ef].clear()}}return e=ef,Qc([Se({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class rf extends(of(ji)){}class nf extends(of(un)){}var af=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class sf extends nf{constructor(){super(),this.editorMode=!1,this.addStore(Pc)}render(){return this.key&&this.context?Jt`
1223
1223
  <span class="ft-i18n">
1224
1224
  ${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
1225
1225
  </span>
1226
1226
  `:this.editorMode?"Select a context and a label key.":te}update(t){var e;super.update(t),["context","key","defaultMessage"].some((e=>t.has(e)))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:null!==(e=this.defaultMessage)&&void 0!==e?e:""})}}sf.elementDefinitions={},sf.styles=Fc,af([on()],sf.prototype,"editorMode",void 0),af([Se()],sf.prototype,"context",void 0),af([Se()],sf.prototype,"key",void 0),af([yo([])],sf.prototype,"args",void 0),af([Se()],sf.prototype,"defaultMessage",void 0);class lf{static build(t){return new lf(t)}static fromGwt(t){return new lf(t)}constructor(t){this.name=t,this.properties=new Proxy({},{get:(t,e)=>{const o=e;return t=>({context:this.name,key:o,args:"function"==typeof t?void 0:t,argsProvider:"function"==typeof t?t:void 0})}}),this.messages=new Proxy({},{get:(t,e)=>(...t)=>Kc.resolveMessage(this.name,e,...t)})}}go("ft-i18n")(sf);const cf=ut`
1227
- `,ff={setRequest:(t,e)=>{t.request=e.payload},setRequestQuery:(t,e)=>{t.request.query=e.payload},setRequestContentLocale:(t,e)=>{t.request.contentLocale=e.payload},setPageSize:(t,e)=>{t.request.paging.perPage=e.payload},setPageNumber:(t,e)=>{t.request.paging.page=e.payload},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestFilters:(t,e)=>{t.request.filters=e.payload},setRequestFacets:(t,e)=>{t.request.facets=e.payload},setRequestVirtualField:(t,e)=>{t.request.virtualField=e.payload},setRequestScope:(t,e)=>{t.request.scope=e.payload},setResults:(t,e)=>{t.results=e.payload},setFacets:(t,e)=>{t.facets=e.payload},setSpellcheck:(t,e)=>{t.spellcheck=e.payload},setLocales:(t,e)=>{t.locales=e.payload},setPaging:(t,e)=>{t.paging=e.payload},setLiveQuery:(t,e)=>{t.liveQuery=e.payload},setSuggestResults:(t,e)=>{t.suggestResults=e.payload},setRequestPeriodFilter:(t,e)=>{t.request.periodFilter=e.payload}};var hf,uf,df,pf,gf,yf,bf,mf,vf,xf,Of,wf,Sf,Cf,Nf,Ef,Rf,$f;!function(t){!function(e){var o={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(o.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o.iterable&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(e,o){t.onload=function(){e(t.result)},t.onerror=function(){o(t.error)}}))}function h(t){var e=new FileReader,o=f(e);return e.readAsArrayBuffer(t),o}function u(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o.arrayBuffer&&o.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=u(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,o=f(e);return e.readAsText(t),o}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),o=new Array(e.length),r=0;r<e.length;r++)o[r]=String.fromCharCode(e[r]);return o.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=n(t),e=a(e);var o=this.map[t];this.map[t]=o?o+", "+e:e},l.prototype.delete=function(t){delete this.map[n(t)]},l.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},l.prototype.set=function(t,e){this.map[n(t)]=a(e)},l.prototype.forEach=function(t,e){for(var o in this.map)this.map.hasOwnProperty(o)&&t.call(e,this.map[o],o,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,o){t.push(o)})),s(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),s(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,o){t.push([o,e])})),s(t)},o.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var o,r,i=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(o=e.method||this.method||"GET",r=o.toUpperCase(),p.indexOf(r)>-1?r:o),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var o=t.split("="),r=o.shift().replace(/\+/g," "),i=o.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},d.call(g.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,e){if(-1===m.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var o=Error(t);this.stack=o.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function v(t,r){return new Promise((function(i,n){var a=new g(t,r);if(a.signal&&a.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var t,e,o={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var o=t.split(":"),r=o.shift().trim();if(r){var i=o.join(":").trim();e.append(r,i)}})),e)};o.url="responseURL"in s?s.responseURL:o.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new b(r,o))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&o.blob&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",c)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=l,t.Request=g,t.Response=b),e.Headers=l,e.Request=g,e.Response=b,e.fetch=v,Object.defineProperty(e,"W",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(hf||(hf={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(uf||(uf={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(df||(df={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(pf||(pf={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(gf||(gf={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(yf||(yf={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(bf||(bf={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(mf||(mf={})),function(t){t.ASC="ASC",t.DESC="DESC"}(vf||(vf={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(xf||(xf={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Of||(Of={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(wf||(wf={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Sf||(Sf={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Cf||(Cf={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Nf||(Nf={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(Ef||(Ef={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Rf||(Rf={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}($f||($f={})),Rf.PERSONAL_BOOK_SHARE_USER,Rf.PERSONAL_BOOK_USER,Rf.HTML_EXPORT_USER,Rf.PERSONAL_BOOK_USER,Rf.PDF_EXPORT_USER,Rf.PERSONAL_BOOK_USER,Rf.KHUB_ADMIN,Rf.CONTENT_PUBLISHER,Rf.ADMIN,Rf.KHUB_ADMIN,Rf.USERS_ADMIN,Rf.PORTAL_ADMIN,Rf.DEVELOPER,Rf.BETA_USER,Rf.DEBUG_USER;class If extends jc{constructor(){super(),this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}class kf extends Event{constructor(){super(kf.eventName)}}kf.eventName="search-context-clear-all-filters";class Lf{static build(t,e){return new Lf((t=>ts.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:ff}))(t.trim()||"context"),e)}constructor(t,e){this.store=t,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new so(100),this.suggestDebouncer=new so(300),this.service=null!=e?e:new If}async initService(){return this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let e=this.store.getState().locales,o=this.store.getState().request.contentLocale;if(t!=o){if(e){const r=t=>e.some((e=>e.lang==t));r(t)||(t=r(o)?o:e[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const e=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(e),this.store.actions.setPageNumber(1),e.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(Of.TITLE_ONLY),this.store.actions.setRequestScope(Ef.DOCUMENTS)):(this.store.actions.setRequestVirtualField(Of.EVERYWHERE),this.store.actions.setRequestScope(Ef.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return(t=>t.request.virtualField===Of.TITLE_ONLY&&t.request.scope===Ef.DOCUMENTS)(this.store.getState())}get periodFilter(){return this.store.getState().request.periodFilter}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new kf)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,e){let o=this.facetIds.filter((e=>e!=t));e&&o.push(e),this.facetIds=o,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let e=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(e)}setFilter(t,e){let o=this.store.getState().request.filters,r={key:t,values:e,negative:!1},i=[...o.filter((e=>e.key!==t)),r];this.setFilters(i)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}setOpenExternalDocumentInNewTab(t){this.openExternalDocumentInNewTab=t}setPeriodFilter(t){this.store.actions.setRequestPeriodFilter(t),this.store.actions.setPageNumber(1),this.launchSearch()}launchSearch(){return this.searchDebouncer.run((()=>this.fetchSearchData()))}launchSuggest(){return this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,e;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let o=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==o.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=eo(this.service.launchSearch(o));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let o=(null!==(e=this.store.getState().results)&&void 0!==e?e:[]).concat(t.results);this.store.actions.setResults(o)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof Xe||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const e=this.store.getState(),o=e.request,r={input:e.liveQuery,filters:o.filters,sort:o.sort,contentLocale:o.contentLocale,scope:o.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=eo(this.service.launchSuggest(r));let i=await this.cancelableSuggest;this.store.actions.setSuggestResults(i.suggestions)}catch(t){t instanceof Xe||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var Uf=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Wf extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const Af=Symbol("registerInterval");class Bf extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[Af]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Af]):this.dispatchEvent(new Wf)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Af,Uf([Ce()],o.prototype,"stateManager",void 0),o}(un)){}var Ff,zf=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Pf extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class _f extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class jf extends CustomEvent{constructor(t,e,o){super("ft-search-results-change",{detail:{request:t,paging:e,spellcheck:o}})}}class Mf extends un{get stateManager(){if(null==this._stateManager){const t=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=Lf.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),t),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")}return this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(Pc)}render(){return Jt`
1227
+ `,ff={setRequest:(t,e)=>{t.request=e.payload},setRequestQuery:(t,e)=>{t.request.query=e.payload},setRequestContentLocale:(t,e)=>{t.request.contentLocale=e.payload},setPageSize:(t,e)=>{t.request.paging.perPage=e.payload},setPageNumber:(t,e)=>{t.request.paging.page=e.payload},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestFilters:(t,e)=>{t.request.filters=e.payload},setRequestFacets:(t,e)=>{t.request.facets=e.payload},setRequestVirtualField:(t,e)=>{t.request.virtualField=e.payload},setRequestScope:(t,e)=>{t.request.scope=e.payload},setRequestClusterSortCriterion:(t,e)=>{t.request.clusterSortCriterions=e.payload},setResults:(t,e)=>{t.results=e.payload},setFacets:(t,e)=>{t.facets=e.payload},setSpellcheck:(t,e)=>{t.spellcheck=e.payload},setLocales:(t,e)=>{t.locales=e.payload},setPaging:(t,e)=>{t.paging=e.payload},setLiveQuery:(t,e)=>{t.liveQuery=e.payload},setSuggestResults:(t,e)=>{t.suggestResults=e.payload},setRequestPeriodFilter:(t,e)=>{t.request.periodFilter=e.payload}};var hf,uf,df,pf,gf,yf,bf,mf,vf,xf,Of,wf,Sf,Cf,Nf,Ef,Rf,$f;!function(t){!function(e){var o={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(o.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o.iterable&&(e[Symbol.iterator]=function(){return e}),e}function l(t){this.map={},t instanceof l?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(e,o){t.onload=function(){e(t.result)},t.onerror=function(){o(t.error)}}))}function h(t){var e=new FileReader,o=f(e);return e.readAsArrayBuffer(t),o}function u(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o.arrayBuffer&&o.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=u(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,o=f(e);return e.readAsText(t),o}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),o=new Array(e.length),r=0;r<e.length;r++)o[r]=String.fromCharCode(e[r]);return o.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(t,e){t=n(t),e=a(e);var o=this.map[t];this.map[t]=o?o+", "+e:e},l.prototype.delete=function(t){delete this.map[n(t)]},l.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},l.prototype.set=function(t,e){this.map[n(t)]=a(e)},l.prototype.forEach=function(t,e){for(var o in this.map)this.map.hasOwnProperty(o)&&t.call(e,this.map[o],o,this)},l.prototype.keys=function(){var t=[];return this.forEach((function(e,o){t.push(o)})),s(t)},l.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),s(t)},l.prototype.entries=function(){var t=[];return this.forEach((function(e,o){t.push([o,e])})),s(t)},o.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,e){var o,r,i=(e=e||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=(o=e.method||this.method||"GET",r=o.toUpperCase(),p.indexOf(r)>-1?r:o),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var o=t.split("="),r=o.shift().replace(/\+/g," "),i=o.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},d.call(g.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,e){if(-1===m.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var o=Error(t);this.stack=o.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function v(t,r){return new Promise((function(i,n){var a=new g(t,r);if(a.signal&&a.signal.aborted)return n(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var t,e,o={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new l,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var o=t.split(":"),r=o.shift().trim();if(r){var i=o.join(":").trim();e.append(r,i)}})),e)};o.url="responseURL"in s?s.responseURL:o.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new b(r,o))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&o.blob&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",c)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=l,t.Request=g,t.Response=b),e.Headers=l,e.Request=g,e.Response=b,e.fetch=v,Object.defineProperty(e,"W",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(hf||(hf={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(uf||(uf={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(df||(df={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(pf||(pf={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(gf||(gf={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(yf||(yf={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(bf||(bf={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(mf||(mf={})),function(t){t.ASC="ASC",t.DESC="DESC"}(vf||(vf={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(xf||(xf={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Of||(Of={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(wf||(wf={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Sf||(Sf={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Cf||(Cf={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Nf||(Nf={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(Ef||(Ef={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Rf||(Rf={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}($f||($f={})),Rf.PERSONAL_BOOK_SHARE_USER,Rf.PERSONAL_BOOK_USER,Rf.HTML_EXPORT_USER,Rf.PERSONAL_BOOK_USER,Rf.PDF_EXPORT_USER,Rf.PERSONAL_BOOK_USER,Rf.KHUB_ADMIN,Rf.CONTENT_PUBLISHER,Rf.ADMIN,Rf.KHUB_ADMIN,Rf.USERS_ADMIN,Rf.PORTAL_ADMIN,Rf.DEVELOPER,Rf.BETA_USER,Rf.DEBUG_USER;class If extends jc{constructor(){super(),this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}class kf extends Event{constructor(){super(kf.eventName)}}kf.eventName="search-context-clear-all-filters";class Lf{static build(t,e){return new Lf((t=>ts.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:ff}))(t.trim()||"context"),e)}constructor(t,e){this.store=t,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new so(100),this.suggestDebouncer=new so(300),this.service=null!=e?e:new If}async initService(){return this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let e=this.store.getState().locales,o=this.store.getState().request.contentLocale;if(t!=o){if(e){const r=t=>e.some((e=>e.lang==t));r(t)||(t=r(o)?o:e[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const e=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(e),this.store.actions.setPageNumber(1),e.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setClusterSortCriterion(t){this.store.actions.setRequestClusterSortCriterion(t),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(Of.TITLE_ONLY),this.store.actions.setRequestScope(Ef.DOCUMENTS)):(this.store.actions.setRequestVirtualField(Of.EVERYWHERE),this.store.actions.setRequestScope(Ef.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return(t=>t.request.virtualField===Of.TITLE_ONLY&&t.request.scope===Ef.DOCUMENTS)(this.store.getState())}get periodFilter(){return this.store.getState().request.periodFilter}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new kf)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,e){let o=this.facetIds.filter((e=>e!=t));e&&o.push(e),this.facetIds=o,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let e=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(e)}setFilter(t,e){let o=this.store.getState().request.filters,r={key:t,values:e,negative:!1},i=[...o.filter((e=>e.key!==t)),r];this.setFilters(i)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}setOpenExternalDocumentInNewTab(t){this.openExternalDocumentInNewTab=t}setPeriodFilter(t){this.store.actions.setRequestPeriodFilter(t),this.store.actions.setPageNumber(1),this.launchSearch()}launchSearch(){return this.searchDebouncer.run((()=>this.fetchSearchData()))}launchSuggest(){return this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,e;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let o=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==o.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=eo(this.service.launchSearch(o));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let o=(null!==(e=this.store.getState().results)&&void 0!==e?e:[]).concat(t.results);this.store.actions.setResults(o)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof Xe||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const e=this.store.getState(),o=e.request,r={input:e.liveQuery,filters:o.filters,sort:o.sort,contentLocale:o.contentLocale,scope:o.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=eo(this.service.launchSuggest(r));let i=await this.cancelableSuggest;this.store.actions.setSuggestResults(i.suggestions)}catch(t){t instanceof Xe||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var Uf=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Wf extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const Af=Symbol("registerInterval");class Bf extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[Af]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Af]):this.dispatchEvent(new Wf)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Af,Uf([Ce()],o.prototype,"stateManager",void 0),o}(un)){}var Ff,zf=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Pf extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class _f extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class jf extends CustomEvent{constructor(t,e,o){super("ft-search-results-change",{detail:{request:t,paging:e,spellcheck:o}})}}class Mf extends un{get stateManager(){if(null==this._stateManager){const t=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=Lf.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),t),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")}return this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(Pc)}render(){return Jt`
1228
1228
  <slot @register-ft-search-component=${this.registerComponent}></slot>
1229
1229
  `}update(t){super.update(t),t.has("query")&&void 0!==this.query&&this.stateManager.setQuery(this.query),t.has("contentLocale")&&void 0!==this.contentLocale&&this.stateManager.setContentLocale(this.contentLocale),t.has("session")&&this.session&&this.stateManager.initService(),t.has("filters")&&void 0!==this.filters&&this.stateManager.setFilters(this.filters),t.has("sort")&&void 0!==this.sort&&this.stateManager.setSort(this.sort),t.has("pageSize")&&void 0!==this.pageSize&&this.stateManager.setPageSize(this.pageSize),t.has("searchInDocumentTitlesOnly")&&void 0!==this.searchInDocumentTitlesOnly&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),t.has("scope")&&void 0!==this.scope&&this.stateManager.setScope(this.scope),t.has("ignoreEmptyQuery")&&void 0!==this.ignoreEmptyQuery&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),t.has("openExternalDocumentInNewTab")&&void 0!==this.openExternalDocumentInNewTab&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("periodFilter")&&void 0!==this.periodFilter&&this.stateManager.setPeriodFilter(this.periodFilter)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(t){super.contentAvailableCallback(t),t.has("request")&&this.request&&this.dispatchEvent(new _f(this.request)),t.has("paging")&&void 0!==this.paging&&this.dispatchEvent(new jf(this.request,this.paging,this.autocorrect))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setSearchStateManager(this.stateManager)}handleLoadError(t){this.dispatchEvent(new Pf(t))}reloadSavedSearches(){Jc.clearMySearches()}clear(){this.stateManager.clear()}}Mf.elementDefinitions={},Mf.styles=cf,zf([Se()],Mf.prototype,"query",void 0),zf([Se()],Mf.prototype,"contentLocale",void 0),zf([Se({type:Number})],Mf.prototype,"pageSize",void 0),zf([Se({type:Boolean})],Mf.prototype,"searchInDocumentTitlesOnly",void 0),zf([Se()],Mf.prototype,"periodFilter",void 0),zf([Se()],Mf.prototype,"scope",void 0),zf([Se({type:Boolean})],Mf.prototype,"ignoreEmptyQuery",void 0),zf([on({store:Pc.name})],Mf.prototype,"openExternalDocumentInNewTab",void 0),zf([yo([])],Mf.prototype,"filters",void 0),zf([yo([])],Mf.prototype,"sort",void 0),zf([on({store:"search"})],Mf.prototype,"request",void 0),zf([on({store:"search"})],Mf.prototype,"paging",void 0),zf([on({store:"search",selector:t=>t.spellcheck})],Mf.prototype,"autocorrect",void 0),zf([on({store:Pc.name})],Mf.prototype,"session",void 0),zf([Se({attribute:!1})],Mf.prototype,"searchServiceProvider",void 0),go("ft-search-context")(Mf),function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"}(Ff||(Ff={}));var Df=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Tf extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}const Kf=Symbol("registerInterval");class Zf extends(function(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setReaderStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this[Kf]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[Kf]):this.dispatchEvent(new Tf)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Kf,Df([Ce()],o.prototype,"stateManager",void 0),o}(un)){}const Hf=ut`
1230
1230
 
@@ -1362,14 +1362,14 @@ const tc=Symbol.for(""),ec=t=>{if(t?.r===tc)return t?._$litStatic$},oc=t=>({_$li
1362
1362
  `}selectAbstract(t){switch(t.type){case"MAP":return t.map.htmlExcerpt;case"DOCUMENT":return t.document.htmlExcerpt;case"TOPIC":return t.topic.htmlExcerpt}return""}}vh.elementDefinitions={"ft-typography":sc},vh.styles=kc,go("ft-search-result-abstract")(vh);var xh=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Oh extends(of(Bf)){constructor(){super(),this.clusterPolicy="display-first-result",this.displayNoResultsMessage=!1,this.renderResult=()=>Jt`
1363
1363
  <ft-search-result-title></ft-search-result-title>
1364
1364
  <ft-search-result-abstract></ft-search-result-abstract>
1365
- `,this.selectedResultByCluster={},this.addI18nContext(Gf)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return Jt`
1365
+ `,this.clusterSortCriterion=[],this.selectedResultByCluster={},this.addI18nContext(Gf)}render(){if(this.displayNoResultsMessage&&null!=this.results&&0==this.results.length)return Jt`
1366
1366
  <ft-typography part="no-results-message" variant="body1">${Gf.messages.results(0)}</ft-typography>
1367
1367
  `;const t=this.buildClusters();return De(t,(t=>t.id),((t,e)=>{var o;return Jt`
1368
1368
  <ft-search-result-context .cluster=${t} index="${e}"
1369
1369
  @ft-search-result-cluster-change="${e=>this.onClusterChange(t.id,e.detail)}">
1370
1370
  ${this.renderResult(null!==(o=this.selectedResultByCluster[t.id])&&void 0!==o?o:t.entries[0],e)}
1371
1371
  </ft-search-result-context>
1372
- `}))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,i,n;return null!==(i=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==i?i:null===(n=t.document)||void 0===n?void 0:n.documentId}}Oh.styles=ih,xh([Se({type:String,attribute:"cluster-policy"})],Oh.prototype,"clusterPolicy",void 0),xh([Se({type:Boolean})],Oh.prototype,"displayNoResultsMessage",void 0),xh([Se({attribute:!1})],Oh.prototype,"renderResult",void 0),xh([on()],Oh.prototype,"request",void 0),xh([on()],Oh.prototype,"results",void 0),go("ft-search-results")(Oh);var wh=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Sh extends ji{constructor(){super(...arguments),this.title="",this.clickable=!1,this.selected=!1,this.noHeader=!1}render(){const t={selected:this.selected,clickable:this.clickable,"no-header":this.noHeader};return Jt`
1372
+ `}))}update(t){var e;super.update(t),(t.has("clusterSortCriterion")||t.has("stateManager")&&this.clusterSortCriterion)&&(null===(e=this.stateManager)||void 0===e||e.setClusterSortCriterion(this.clusterSortCriterion))}onClusterChange(t,e){this.selectedResultByCluster[t]=e}buildClusters(){return"display-all-results"===this.clusterPolicy?this.buildAllResultsClusters():this.buildFullClusters()}buildFullClusters(){var t,e;return null!==(e=null===(t=this.results)||void 0===t?void 0:t.map((t=>({id:this.clusterId(t.entries[0]),entries:t.entries}))))&&void 0!==e?e:[]}buildAllResultsClusters(){var t,e;let o=null!==(e=null===(t=this.results)||void 0===t?void 0:t.flatMap((t=>t.entries.map((t=>({id:this.clusterId(t),entries:[t]}))))))&&void 0!==e?e:[];return this.request&&1===this.request.paging.page?o.slice(0,this.request.paging.perPage):o}clusterId(t){var e,o,r,i,n;return null!==(i=null!==(o=null===(e=t.map)||void 0===e?void 0:e.mapId)&&void 0!==o?o:null===(r=t.topic)||void 0===r?void 0:r.tocId)&&void 0!==i?i:null===(n=t.document)||void 0===n?void 0:n.documentId}}Oh.styles=ih,xh([Se({type:String,attribute:"cluster-policy"})],Oh.prototype,"clusterPolicy",void 0),xh([Se({type:Boolean})],Oh.prototype,"displayNoResultsMessage",void 0),xh([Se({attribute:!1})],Oh.prototype,"renderResult",void 0),xh([yo([])],Oh.prototype,"clusterSortCriterion",void 0),xh([on()],Oh.prototype,"request",void 0),xh([on()],Oh.prototype,"results",void 0),go("ft-search-results")(Oh);var wh=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Sh extends ji{constructor(){super(...arguments),this.title="",this.clickable=!1,this.selected=!1,this.noHeader=!1}render(){const t={selected:this.selected,clickable:this.clickable,"no-header":this.noHeader};return Jt`
1373
1373
  <div id="container" part="container" class=${Ke(t)}>
1374
1374
  ${this.clickable?Jt`
1375
1375
  <ft-ripple primary ?selected=${this.selected}></ft-ripple>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-search-in-document",
3
- "version": "1.1.66",
3
+ "version": "1.1.68",
4
4
  "description": "A search component to retrieve occurrences in documents",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,20 +19,20 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-button": "1.1.66",
23
- "@fluid-topics/ft-card": "1.1.66",
24
- "@fluid-topics/ft-i18n": "1.1.66",
25
- "@fluid-topics/ft-search-context": "1.1.66",
26
- "@fluid-topics/ft-search-input": "1.1.66",
27
- "@fluid-topics/ft-search-load-more-button": "1.1.66",
28
- "@fluid-topics/ft-search-result-abstract": "1.1.66",
29
- "@fluid-topics/ft-search-result-title": "1.1.66",
30
- "@fluid-topics/ft-search-results": "1.1.66",
31
- "@fluid-topics/ft-search-results-number": "1.1.66",
32
- "@fluid-topics/ft-typography": "1.1.66",
33
- "@fluid-topics/ft-wc-utils": "1.1.66",
34
- "@fluid-topics/public-api": "1.0.65",
22
+ "@fluid-topics/ft-button": "1.1.68",
23
+ "@fluid-topics/ft-card": "1.1.68",
24
+ "@fluid-topics/ft-i18n": "1.1.68",
25
+ "@fluid-topics/ft-search-context": "1.1.68",
26
+ "@fluid-topics/ft-search-input": "1.1.68",
27
+ "@fluid-topics/ft-search-load-more-button": "1.1.68",
28
+ "@fluid-topics/ft-search-result-abstract": "1.1.68",
29
+ "@fluid-topics/ft-search-result-title": "1.1.68",
30
+ "@fluid-topics/ft-search-results": "1.1.68",
31
+ "@fluid-topics/ft-search-results-number": "1.1.68",
32
+ "@fluid-topics/ft-typography": "1.1.68",
33
+ "@fluid-topics/ft-wc-utils": "1.1.68",
34
+ "@fluid-topics/public-api": "1.0.67",
35
35
  "lit": "3.1.0"
36
36
  },
37
- "gitHead": "c7c2a2e66a28387fcdfdc4ba1fc9fdfc65d7b1ac"
37
+ "gitHead": "d10171ba718cee726044d0cc44820ebbb1ab7cbc"
38
38
  }