@fluid-topics/ft-search-context 1.3.47 → 1.3.49

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.
@@ -3,7 +3,7 @@
3
3
  `;var Et=O(k()),is=O(re());var z=O(k());var ze=O(k()),ys={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)=>{var r;let n=+((r=e.payload)!==null&&r!==void 0?r:20);t.request.paging.perPage=isNaN(n)?20:(0,ze.minmax)(1,n,1e3)},setPageNumber:(t,e)=>{t.request.paging.page=isNaN(e.payload)?1:Math.max(1,e.payload)},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestSortId:(t,e)=>{t.request.sortId=e.payload},setRequestFilters:(t,e)=>{t.request.metadataFilters=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},setOtherQueryParams:(t,e)=>{t.request.otherQueryParams=e.payload},setRequestClusterSortCriterion:(t,e)=>{var r;t.request.clusterSortCriterions=(r=e.payload)!==null&&r!==void 0?r:[]},setKeywordMatch:(t,e)=>{t.request.keywordMatch=e.payload}},Sr=t=>ze.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",clusterSortCriterions:[],metadataFilters:[],facets:[],sort:[],sortId:void 0,paging:{page:1,perPage:20},keywordMatch:void 0},liveQuery:"",paging:void 0,facets:void 0,spellcheck:void 0,locales:[],results:void 0,announcements:void 0,suggestResults:void 0,configuration:void 0},reducers:ys});var vs=O(Er(),1);var wr;(function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"})(wr||(wr={}));var Or;(function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"})(Or||(Or={}));var xr;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(xr||(xr={}));var xe;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(xe||(xe={}));var Tr;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(Tr||(Tr={}));var Cr;(function(t){t.VALUE="VALUE",t.DATE="DATE",t.RANGE="RANGE"})(Cr||(Cr={}));var pe;(function(t){t.BOOKMARK__CREATE="BOOKMARK__CREATE",t.BOOKMARK__DELETE="BOOKMARK__DELETE",t.CASE_DEFLECTION__START="CASE_DEFLECTION__START",t.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",t.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",t.CHATBOT__RATE="CHATBOT__RATE",t.COLLECTION__CREATE="COLLECTION__CREATE",t.COLLECTION__UPDATE="COLLECTION__UPDATE",t.COLLECTION__DELETE="COLLECTION__DELETE",t.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",t.DOCUMENT__AI_TRANSLATE="DOCUMENT__AI_TRANSLATE",t.DOCUMENT__DISPLAY="DOCUMENT__DISPLAY",t.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",t.DOCUMENT__PRINT="DOCUMENT__PRINT",t.DOCUMENT__PROCESS="DOCUMENT__PROCESS",t.DOCUMENT__RATE="DOCUMENT__RATE",t.DOCUMENT__SEARCH="DOCUMENT__SEARCH",t.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",t.DOCUMENT__UNRATE="DOCUMENT__UNRATE",t.FEEDBACK__SEND="FEEDBACK__SEND",t.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",t.AI__RATE="AI__RATE",t.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",t.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",t.KHUB__PROCESS="KHUB__PROCESS",t.KHUB__SEARCH="KHUB__SEARCH",t.LABELS__DOWNLOAD="LABELS__DOWNLOAD",t.LINK__SHARE="LINK__SHARE",t.PAGE__DISPLAY="PAGE__DISPLAY",t.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",t.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",t.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",t.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",t.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",t.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",t.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",t.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",t.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",t.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",t.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",t.TOPIC__DISPLAY="TOPIC__DISPLAY",t.TOPIC__RATE="TOPIC__RATE",t.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",t.TOPIC__UNRATE="TOPIC__UNRATE",t.USER__LOGIN="USER__LOGIN",t.USER__LOGOUT="USER__LOGOUT",t.HEARTBEAT="HEARTBEAT"})(pe||(pe={}));var _r;(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"})(_r||(_r={}));var Rr;(function(t){t.HOMEPAGE="HOMEPAGE",t.CUSTOM="CUSTOM",t.HEADER="HEADER",t.READER="READER",t.TOPIC_TEMPLATE="TOPIC_TEMPLATE",t.SEARCH="SEARCH",t.SEARCH_RESULT="SEARCH_RESULT",t.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT"})(Rr||(Rr={}));var Ir;(function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"})(Ir||(Ir={}));var Dr;(function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"})(Dr||(Dr={}));var Mr;(function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"})(Mr||(Mr={}));var Pr;(function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"})(Pr||(Pr={}));var kr;(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"})(kr||(kr={}));var We;(function(t){t.OPTIONAL="OPTIONAL",t.MANDATORY="MANDATORY"})(We||(We={}));var Lr;(function(t){t.ASC="ASC",t.DESC="DESC"})(Lr||(Lr={}));var Nr;(function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"})(Nr||(Nr={}));var Te;(function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"})(Te||(Te={}));var Fr;(function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(Fr||(Fr={}));var Ur;(function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"})(Ur||(Ur={}));var jr;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"})(jr||(jr={}));var Br;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(Br||(Br={}));var se;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"})(se||(se={}));var Ce;(function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS",t.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Ce||(Ce={}));var qr;(function(t){t.PLAIN_TEXT="PLAIN_TEXT",t.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",t.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(qr||(qr={}));var M;(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.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_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.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN"})(M||(M={}));var G;(function(t){t.SEARCHES="SEARCHES",t.BOOKMARKS="BOOKMARKS",t.BOOKS="BOOKS",t.COLLECTIONS="COLLECTIONS"})(G||(G={}));var Hr;(function(t){t.VALID="VALID",t.INVALID="INVALID"})(Hr||(Hr={}));var Vr;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(Vr||(Vr={}));var Kr;(function(t){t.USER="USER",t.ASSISTANT="ASSISTANT"})(Kr||(Kr={}));var zr;(function(t){t.TEXT="TEXT",t.HTML="HTML"})(zr||(zr={}));var Gr;(function(t){t.HTML="HTML",t.MARKDOWN="MARKDOWN"})(Gr||(Gr={}));var ms={[M.PERSONAL_BOOK_SHARE_USER]:[M.PERSONAL_BOOK_USER],[M.HTML_EXPORT_USER]:[M.PERSONAL_BOOK_USER],[M.PDF_EXPORT_USER]:[M.PERSONAL_BOOK_USER],[M.KHUB_ADMIN]:[M.CONTENT_PUBLISHER],[M.ADMIN]:[M.KHUB_ADMIN,M.USERS_ADMIN,M.PORTAL_ADMIN],[M.GENERATIVE_AI_EXPORT_USER]:[M.GENERATIVE_AI_USER]};function $r(t,e){return t===e||(ms[t]??[]).some(r=>$r(r,e))}function Wr(t,e){return t==null?!1:(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some(n=>$r(n,e))}var rs=O(k());var an=O(we()),U=O(re()),Y=O(k());var Qr=O(we());var Yr=Qr.css`
4
4
  `;var Qe=O(k()),gs="ft-app-info",ye=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};ye.eventName="authentication-change";var bs={session:(t,e)=>{(0,Qe.deepEqual)(t.session,e.payload)||(t.session=e.payload,setTimeout(()=>v.dispatchEvent(new ye(e.payload)),0))}},v=Qe.FtReduxStore.get({name:gs,reducers:bs,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1}});var Ct=O(k());var me=class t{static get(e){let{baseUrl:r,apiIntegrationIdentifier:n}=v.getState(),s=e??n;if(r&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,s,!0)}static await(e){return new Promise(r=>{let n=t.get(e);if(n)r(n);else{let s=v.subscribe(()=>{n=t.get(e),n&&(s(),r(n))})}})}};var Ye=class{constructor(e){this.overrideApi=e}get api(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:me.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):me.await()}};var j=class extends Ye{constructor(e=!0,r){var n;super(r),this.sortObjectFields=(i,a)=>typeof a!="object"||a==null||Array.isArray(a)?a:Object.fromEntries(Object.entries(a).sort(([o],[l])=>o.localeCompare(l)));let s=this.constructor;s.commonCache=(n=s.commonCache)!==null&&n!==void 0?n:new Ct.CacheRegistry,this.cache=e?s.commonCache:new Ct.CacheRegistry}clearCache(){this.cache.clearAll()}hash(e){return String(Array.from(JSON.stringify(e,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var Xe=class extends j{async listMyBookmarks(){let e=v.getState().session;return e?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(e.profile.userId),5*60*1e3):[]}};var _t=class{addCommand(e,r=!1){v.commands.add(e,r)}consumeCommand(e){return v.commands.consume(e)}};window.FluidTopicsAppInfoStoreService=new _t;var $=O(k());var Xr,_e=class extends CustomEvent{constructor(e){super("ft-i18n-context-loaded",{detail:e})}},Ss=Symbol("clearAfterUnitTest"),Je=class extends(0,$.withEventBus)(j){constructor(e){super(),this.messageContextProvider=e,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Xr]=()=>{this.defaultMessages={},this.cache=new $.CacheRegistry,this.listeners={}},this.currentUiLocale=v.getState().uiLocale,v.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:e}=v.getState();this.currentUiLocale!==e&&(this.currentUiLocale=e,this.cache.clearAll(),this.notifyAll())}addContext(e){let r=e.name.toLowerCase();this.cache.setFinal(r,e),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(e,r){var n;if(e=e.toLowerCase(),r&&Object.keys(r).length>0){let s={...(n=this.defaultMessages[e])!==null&&n!==void 0?n:{},...r};(0,$.deepEqual)(this.defaultMessages[e],s)||(this.defaultMessages[e]=s,await this.notify(e))}return this.fetchContext(e)}resolveContext(e){var r,n;return this.fetchContext(e),(n=(r=this.cache.getNow(e))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(e,r){let n=e.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(e,r,...n){var s;let i=e.toLowerCase(),a=this.resolveContext(i);return new $.ParametrizedLabelResolver((s=this.defaultMessages[i])!==null&&s!==void 0?s:{},a).resolve(r,...n)}async fetchContext(e){let r=!this.cache.has(e),n;try{n=await this.cache.get(e,()=>this.messageContextProvider(this.currentUiLocale,e)),r&&await this.notify(e)}catch(s){!(s instanceof $.CanceledPromiseError)&&r&&console.error(s)}return n}subscribe(e,r){var n;return e=e.toLowerCase(),this.listeners[e]=(n=this.listeners[e])!==null&&n!==void 0?n:new Set,this.listeners[e].add(r),()=>{var s;return(s=this.listeners[e])===null||s===void 0?void 0:s.delete(r)}}async notifyAll(){let e=Object.keys(this.listeners);document.body.dispatchEvent(new _e({loadedContexts:e})),this.dispatchEvent(new _e({loadedContexts:e})),await Promise.all(e.map(r=>this.notify(r,!1)))}async notify(e,r=!0){r&&(document.body.dispatchEvent(new _e({loadedContexts:[e]})),this.dispatchEvent(new _e({loadedContexts:[e]}))),this.listeners[e]!=null&&await Promise.all([...this.listeners[e].values()].map(n=>(0,$.delay)(0).then(()=>n()).catch(()=>null)))}};Xr=Ss;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends Je{constructor(){super(async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends Je{constructor(){super(async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e))}});var Jr=window.FluidTopicsI18nService,Yi=window.FluidTopicsCustomI18nService;var Zr=O(k()),Rt=class{highlightHtml(e,r,n){(0,Zr.highlightHtml)(e,r,n)}};window.FluidTopicsHighlightHtmlService=new Rt;var Ze=class extends j{async listMySearches(){let{session:e}=v.getState();return Wr(e,M.SAVED_SEARCH_USER)?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(e.profile.userId),5*60*1e3):[]}};var en=O(k());var It=class{isDate(e){var r,n,s,i;return(i=(s=((n=(r=v.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&n!==void 0?n:[]).find(o=>o.key===e))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1}format(e,r){var n,s,i;return en.DateFormatter.format(e,(n=r?.locale)!==null&&n!==void 0?n:v.getState().uiLocale,(s=r?.longFormat)!==null&&s!==void 0?s:!1,(i=r?.withTime)!==null&&i!==void 0?i:!1)}};window.FluidTopicsDateService=new It;var tn=O(k());var Ne=class{static get(e,r){var n,s;let i=v.getState(),{lang:a,region:o}=(s=(n=i.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&s!==void 0?s:{lang:"en",region:"US"};return new tn.SearchPlaceConverter(i.baseUrl,e??20,i.searchInAllLanguagesAllowed,r??`${a}-${o}`)}};var et=class extends j{async sendDocumentStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.start_display event")}async sendTopicStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.start_display event")}async sendKhubSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send khub.search event")}async sendDocumentSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.search event")}async sendSearchPageSelectEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_page.select event")}async sendSearchResultOpenContextMenuEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_result.open_context_menu event")}sortEventArrays(e){let r=Object.entries(e).map(([n,s])=>Array.isArray(s)?[n,s.map(i=>typeof i=="object"&&i!=null&&!Array.isArray(i)?this.sortEventArrays(i):i).sort((i,a)=>typeof i=="object"&&i!==null&&"key"in i?i.key.localeCompare(a.key):typeof i=="string"&&typeof a=="string"?i.localeCompare(a):String(i).localeCompare(String(a)))]:typeof s=="object"&&s!==null?[n,this.sortEventArrays(s)]:[n,s]);return Object.fromEntries(r)}sendEvents(e,r){let n="anything not undefined";return this.cache.get("analytics-event-"+this.hash(e),async()=>(await this.awaitApi).sendEvents(e).then(()=>n).catch(s=>(console.info(r),console.debug(s),n)),1e3)}};var Dt=class{urlToSearchRequest(e){return Ne.get().parse(e)}searchRequestToUrl(e){return Ne.get().serialize(e)}};window.FluidTopicsUrlService=new Dt;var ie=O(k());var ve=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{currentItem:e}})}};ve.eventName="change";var Mt=class{itemName(e){return`fluid-topics-history-item-${e}`}get(e){let r=sessionStorage.getItem(this.itemName(e));return r?JSON.parse(r):void 0}set(e,r){sessionStorage.setItem(this.itemName(e),JSON.stringify(r))}},rn=new Mt;var tt=class t extends ie.WithEventBus{static build(){return new t(window.history,rn,()=>window.location,!1)}constructor(e,r,n,s){var i,a;super(),this.history=e,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=e.pushState,this.realReplaceState=e.replaceState,this.initialIndex=(a=(i=e.state)===null||i===void 0?void 0:i.index)!==null&&a!==void 0?a:e.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(s)}setCurrentState(e,r=!1){let n=r&&this.currentIndex===e.index-1;this.currentState={...this.buildCurrentState(),...e},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,ie.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new ve(this.currentItem())),0)}installProxies(){let e=r=>(n,s,[i,a,o])=>{let l=r(),c={...l===this.currentIndex?this.currentState:void 0,...i,index:l,href:typeof o=="string"?o:(o??this.windowLocation()).href};n.apply(s,[c,a,o]),this.setCurrentState(c,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:e(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:e(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",e=>this.setCurrentState(e.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(e){for(let r=this.history.length-1;r>=0;r--)e?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(e){var r;let n={...this.buildCurrentState(),...e,index:this.currentIndex,title:(r=e?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(e){this.addEventListener(ve.eventName,e)}removeHistoryChangeListener(e){this.removeEventListener(ve.eventName,e)}currentItem(){return(0,ie.deepCopy)(this.currentState)}back(){let e=this.previousDifferentMajorPosition();e>=0?this.history.go(e-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,ie.deepCopy)(this.states[this.previousDifferentMajorPosition()])}previousDifferentMajorPosition(){let e=this.currentIndex>0?this.currentIndex-1:0;for(;e>0&&!this.isDifferentMajorState(e);)e--;return e}forward(){let e=this.nextMajorPosition();e&&e<this.states.length?this.history.go(e-this.currentIndex):this.history.forward()}forwardItem(){let e=this.nextMajorPosition();if(e)return(0,ie.deepCopy)(this.states[e])}nextMajorPosition(){let e=this.currentIndex;if(!(e>=this.states.length)){do e++;while(e<this.states.length&&!this.isDifferentMajorState(e));return this.getHigherPositionInTheSameState(e)}}getHigherPositionInTheSameState(e){var r;let n=(r=this.states[e])===null||r===void 0?void 0:r.majorStateId;if(!n)return e;let s=e,i=e+1;for(;this.states.length>i&&!this.isDifferentMajorState(i,n);)this.hasState(i)&&(s=i),i++;return s}buildCurrentState(){var e,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(e=this.history.state)===null||e===void 0?void 0:e.title)!==null&&r!==void 0?r:document.title}}hasState(e){return this.states[e]!=null}isDifferentMajorState(e,r){var n;if(!this.hasState(e))return!1;let s=r??this.currentState.majorStateId,i=(n=this.states[e])===null||n===void 0?void 0:n.majorStateId;return i==null||i!=s}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=tt.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),addHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(t),removeHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(t)});var nn=v;function sn(t,e){var r;return nn.getState().authenticationRequired&&!(!((r=nn.getState().session)===null||r===void 0)&&r.sessionAuthenticated)?Promise.resolve(e):t()}var P=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},_=class extends Y.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.apiIntegrationAppVersion="ft-integration-app-version",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=()=>me.get(),this.authenticationRequired=!1,this.messageContexts=[],this.cache=new Y.CacheRegistry,this.cleanSessionDebouncer=new Y.Debouncer,this.reloadConfiguration=()=>{this.cache.clear("availableContentLocales"),this.updateAvailableContentLocales()}}render(){return an.html`
5
5
  <slot></slot>
6
- `}connectedCallback(){super.connectedCallback(),v.addEventListener(ye.eventName,this.reloadConfiguration)}disconnectedCallback(){v.addEventListener(ye.eventName,this.reloadConfiguration),super.disconnectedCallback()}update(e){var r,n,s,i,a,o,l;super.update(e),e.has("baseUrl")&&(v.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),e.has("apiIntegrationIdentifier")&&v.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&v.actions.apiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&v.actions.uiLocale(this.uiLocale),e.has("metadataConfiguration")&&v.actions.metadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&v.actions.noCustom(this.noCustom),e.has("editorMode")&&v.actions.editorMode(this.editorMode),e.has("noCustomComponent")&&v.actions.noCustomComponent(this.noCustomComponent),e.has("session")&&v.actions.session(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(c=>Jr.addContext(c)),e.has("openExternalDocumentInNewTab")&&v.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&v.actions.navigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&v.actions.forcedOffline(this.forcedOffline),e.has("localesConfiguration")&&(v.actions.defaultLocales((r=this.localesConfiguration)===null||r===void 0?void 0:r.defaultLocales),v.actions.availableUiLocales((s=(n=this.localesConfiguration)===null||n===void 0?void 0:n.availableUiLocales)!==null&&s!==void 0?s:[]),v.actions.searchInAllLanguagesAllowed((a=(i=this.localesConfiguration)===null||i===void 0?void 0:i.allLanguagesAllowed)!==null&&a!==void 0?a:!1)),e.has("authenticationRequired")&&v.actions.authenticationRequired(this.authenticationRequired),e.has("availableContentLocales")&&v.actions.availableContentLocales((l=(o=this.availableContentLocales)===null||o===void 0?void 0:o.contentLocales)!==null&&l!==void 0?l:[]),setTimeout(()=>this.updateIfNeeded())}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.session==null&&this.updateSession(),this.metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),this.availableContentLocales==null&&this.updateAvailableContentLocales())}async updateSession(){this.session=await this.cache.get("session",async()=>{let e=await this.apiProvider().getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.session=void 0},e.idleTimeoutInMillis),e})}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration())}async updateLocalesConfiguration(){this.localesConfiguration=await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration())}async updateAvailableContentLocales(){this.availableContentLocales=await this.cache.get("availableContentLocales",()=>sn(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}))}};_.elementDefinitions={};_.styles=Yr;P([(0,U.property)()],_.prototype,"baseUrl",void 0);P([(0,U.property)()],_.prototype,"apiIntegrationIdentifier",void 0);P([(0,U.property)()],_.prototype,"apiIntegrationAppVersion",void 0);P([(0,U.property)()],_.prototype,"uiLocale",void 0);P([(0,Y.jsonProperty)(null)],_.prototype,"availableUiLocales",void 0);P([(0,Y.jsonProperty)(null)],_.prototype,"metadataConfiguration",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"editorMode",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"noCustom",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"openExternalDocumentInNewTab",void 0);P([(0,U.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],_.prototype,"noCustomComponent",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"withManualResources",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"navigatorOnline",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"forcedOffline",void 0);P([(0,U.property)({type:Object})],_.prototype,"apiProvider",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"authenticationRequired",void 0);P([(0,Y.jsonProperty)([])],_.prototype,"messageContexts",void 0);P([(0,Y.jsonProperty)(void 0)],_.prototype,"session",void 0);P([(0,U.state)()],_.prototype,"localesConfiguration",void 0);P([(0,U.state)()],_.prototype,"availableContentLocales",void 0);var nr=O(re());function As(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let r,n,s;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!rt(t[n],e[n]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;for(n of t.entries())if(!rt(n[1],e.get(n[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();let i=a=>Object.keys(a).filter(o=>a[o]!=null);if(s=i(t),r=s.length,r!==i(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){let a=s[n];if(!rt(t[a],e[a]))return!1}return!0}return t!==t&&e!==e||t==null&&e==null}function rt(t,e){try{return As(t,e)}catch{return!1}}function Fe(t,e){return!rt(t,e)}function nt(t,e){let r=n=>n[t]===!0;return n=>{if(r(n))return n;let s=e(n);return s[t]=!0,s}}var on=O(re(),1);var Pt=t=>{let e=t??{};return(r,n)=>{var s;let i={hasChanged:Fe,attribute:!1,...e};(0,on.property)(i)(r,n);let a=r.constructor;a.reduxProperties=new Map(a.reduxProperties),a.reduxProperties.set(n,{selector:(s=e.selector)!==null&&s!==void 0?s:o=>o[n],store:e.store})}};var st=class{constructor(){this.queue=[]}add(e,r=!1){r&&this.clear(e.type),this.queue.push(e)}consume(e){let r=this.queue.find(n=>n.type===e);return r&&(this.queue=this.queue.filter(n=>n!==r)),r}clear(e){typeof e=="string"?this.queue=this.queue.filter(r=>r.type!==e):this.queue=this.queue.filter(r=>!e.test(r.type))}};var ge=O(re(),1);var un=O(re(),1);function cn(t,e){let r=()=>JSON.parse(JSON.stringify(t));return(0,un.property)({type:Object,converter:{fromAttribute:n=>{if(n==null)return r();try{return JSON.parse(n)}catch{return r()}},toAttribute:n=>JSON.stringify(n)},hasChanged:Fe,...e??{}})}var it=class{constructor(e=0){this.timeout=e,this.callbacks=[]}run(e,r){return this.callbacks=[e],this.debounce(r)}queue(e,r){return this.callbacks.push(e),this.debounce(r)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(e){return this.promise==null&&(this.promise=new Promise((r,n)=>{this.resolvePromise=r,this.rejectPromise=n})),this.clearTimeout(),this._debounce=window.setTimeout(()=>this.runCallbacks(),e??this.timeout),this.promise}async runCallbacks(){var e,r;let n=[...this.callbacks];this.callbacks=[];let s=(e=this.rejectPromise)!==null&&e!==void 0?e:()=>null,i=(r=this.resolvePromise)!==null&&r!==void 0?r:()=>null;this.clearPromise();for(let a of n)try{await a()}catch(o){s(o);return}i(!0)}clearTimeout(){this._debounce!=null&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}};var dn=O(we(),1);var at=globalThis,Es=at.ShadowRoot&&(at.ShadyCSS===void 0||at.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Qa=Symbol();var ln=(t,e)=>{if(Es)t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of e){let n=document.createElement("style"),s=at.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=r.cssText,t.appendChild(n)}};var ot=class extends dn.LitElement{createRenderRoot(){let e=this.constructor;e.elementDefinitions&&!e.registry&&(e.registry=new CustomElementRegistry,Object.entries(e.elementDefinitions).forEach(([s,i])=>e.registry.define(s,i)));let r={...e.shadowRootOptions,customElements:e.registry},n=this.renderOptions.creationScope=this.attachShadow(r);return ln(n,e.elementStyles),n}};function fn(t,e,...r){var n;let s=t.querySelector(e);for(let i of r)s=(n=s?.shadowRoot)===null||n===void 0?void 0:n.querySelector(i);return s}var Ie=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},mn,hn=Symbol("constructorPrototype"),pn=Symbol("constructorName"),vn=Symbol("exportpartsDebouncer"),yn=Symbol("dynamicDependenciesLoaded"),Re=class t extends CustomEvent{constructor(){super(t.eventName,{bubbles:!0})}};Re.eventName="exportparts-updated";var J=class extends ot{constructor(){super(),this.useAdoptedStyleSheets=!0,this.adoptedCustomStyleSheet=new CSSStyleSheet,this[mn]=new it(5),this.scheduleExportpartsUpdate=()=>{var e,r,n;(!((e=this.exportpartsPrefix)===null||e===void 0)&&e.trim()||(n=(r=this.exportpartsPrefixes)===null||r===void 0?void 0:r.length)!==null&&n!==void 0&&n)&&this[vn].run(()=>{var s,i;!((s=this.exportpartsPrefix)===null||s===void 0)&&s.trim()?this.setExportpartsAttribute([this.exportpartsPrefix]):this.exportpartsPrefixes!=null&&((i=this.exportpartsPrefixes)===null||i===void 0?void 0:i.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)})},this[pn]=this.constructor.name,this[hn]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[pn]&&Object.setPrototypeOf(this,this[hn])}connectedCallback(){var e;super.connectedCallback();try{this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(this.adoptedCustomStyleSheet)&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.adoptedCustomStyleSheet]),this.useAdoptedStyleSheets=!0}catch(n){this.useAdoptedStyleSheets=!1,console.error("Cannot use adopted stylesheets",n)}let r=this.constructor;r[yn]||(r[yn]=!0,this.importDynamicDependencies()),(e=this.shadowRoot)===null||e===void 0||e.addEventListener(Re.eventName,this.scheduleExportpartsUpdate)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.shadowRoot)===null||e===void 0||e.removeEventListener(Re.eventName,this.scheduleExportpartsUpdate)}importDynamicDependencies(){}updated(e){super.updated(e),this.updateComplete.then(()=>{this.contentAvailableCallback(e),this.focusElementToFocus(e),this.applyCustomStylesheet(e),this.scheduleExportpartsUpdate(),e.has("exportparts")&&this.dispatchEvent(new Re)})}contentAvailableCallback(e){}focusElementToFocus(e){if(e.has("elementToFocus")&&this.elementToFocus!=null){let{element:r,selector:n,shadowPath:s}=this.elementToFocus;if(n!=null){let i=[...s??[],n];r=fn(this.shadowRoot,...i)}r?.focus(),window.FluidTopicsA11yHints.isKeyboardNavigation||r?.blur(),this.elementToFocus=void 0}}applyCustomStylesheet(e){var r,n,s;if(((n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll(".ft-lit-element--custom-stylesheet"))!==null&&n!==void 0?n:[]).forEach(i=>i.remove()),this.useAdoptedStyleSheets){if(e.has("customStylesheet"))try{this.adoptedCustomStyleSheet.replaceSync((s=this.customStylesheet)!==null&&s!==void 0?s:"")}catch(i){console.error(i,this.customStylesheet),this.useAdoptedStyleSheets=!1}}else if(this.customStylesheet){let i=document.createElement("style");i.classList.add("ft-lit-element--custom-stylesheet"),i.innerHTML=this.customStylesheet,this.shadowRoot.append(i)}}setExportpartsAttribute(e){var r,n,s,i,a,o;let l=p=>p!=null&&p.trim().length>0,c=e.filter(l).map(p=>p.trim());if(c.length===0){this.exportparts=void 0;return}let f=new Set;for(let p of(n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll("[part],[exportparts]"))!==null&&n!==void 0?n:[]){let g=(i=(s=p.getAttribute("part"))===null||s===void 0?void 0:s.split(" "))!==null&&i!==void 0?i:[],y=(o=(a=p.getAttribute("exportparts"))===null||a===void 0?void 0:a.split(",").map(S=>S.split(":")[1]))!==null&&o!==void 0?o:[],m=[...g,...y].filter(l).map(S=>S.trim());for(let S of m)f.add(S)}if(f.size===0){this.exportparts=void 0;return}let h=[...f.values()].flatMap(p=>c.map(g=>`${p}:${g}--${p}`));this.exportparts=[...this.part,...h].join(", ")}};mn=vn;Ie([(0,ge.property)()],J.prototype,"exportpartsPrefix",void 0);Ie([cn([])],J.prototype,"exportpartsPrefixes",void 0);Ie([(0,ge.property)({reflect:!0})],J.prototype,"exportparts",void 0);Ie([(0,ge.property)()],J.prototype,"customStylesheet",void 0);Ie([(0,ge.property)()],J.prototype,"elementToFocus",void 0);Ie([(0,ge.state)()],J.prototype,"useAdoptedStyleSheets",void 0);function ut(t){var e;return(e=t?.isFtReduxStore)!==null&&e!==void 0?e:!1}var Ue=Symbol("internalReduxEventsUnsubscribers"),ae=Symbol("internalStoresUnsubscribers"),be=Symbol("internalStores"),ws=nt(Symbol("withRedux"),function(t){var e,r,n;class s extends t{constructor(){super(...arguments),this[e]=new Map,this[r]=new Map,this[n]=new Map}get reduxConstructor(){return this.constructor}willUpdate(a){super.willUpdate(a),[...this.reduxConstructor.reduxReactiveProperties].some(o=>a.has(o))&&this.updateFromStores()}getUnnamedStore(){if(this[be].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[be].values()][0]}getStore(a){return a==null?this.getUnnamedStore():this[be].get(a)}addStore(a,o){var l;o=(l=o??a.name)!==null&&l!==void 0?l:"default-store",this.unsubscribeFromStore(o),this[be].set(o,a),this.subscribeToStore(o,a),this.updateFromStores()}removeStore(a){let o=typeof a=="string"?a:a.name;this.unsubscribeFromStore(o),this[be].delete(o)}setupStores(){this.unsubscribeFromStores(),this[be].forEach((a,o)=>this.subscribeToStore(o,a)),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach((a,o)=>{let l=this.constructor.getPropertyOptions(o);if(!l?.attribute||!this.hasAttribute(typeof l?.attribute=="string"?l.attribute:o)){let c=this.getStore(a.store);c&&(a.store?this[ae].has(a.store):this[ae].size>0)&&(this[o]=a.selector(c.getState(),this))}})}subscribeToStore(a,o){var l;this[ae].set(a,o.subscribe(()=>this.updateFromStores())),this[Ue].set(a,[]),ut(o)&&o.eventBus&&((l=this.reduxConstructor.reduxEventListeners)===null||l===void 0||l.forEach((c,f)=>{if(typeof this[f]=="function"&&(!c.store||o.name===c.store)){let h=p=>this[f](p);o.addEventListener(c.eventName,h),this[Ue].get(a).push(()=>o.removeEventListener(c.eventName,h))}})),this.onStoreAvailable(a)}unsubscribeFromStores(){this[ae].forEach((a,o)=>this.unsubscribeFromStore(o))}unsubscribeFromStore(a){var o;this[ae].has(a)&&this[ae].get(a)(),this[ae].delete(a),(o=this[Ue].get(a))===null||o===void 0||o.forEach(l=>l()),this[Ue].delete(a)}onStoreAvailable(a){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}return e=ae,r=be,n=Ue,s.reduxProperties=new Map,s.reduxReactiveProperties=new Set,s.reduxEventListeners=new Map,s}),gn=class extends ws(J){};function W(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];if(0)var s,i;throw Error("[Immer] minified error nr: "+t+(r.length?" "+r.map(function(a){return"'"+a+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function te(t){return!!t&&!!t[R]}function X(t){var e;return!!t&&(function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var s=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return s===Object||typeof s=="function"&&Function.toString.call(s)===Ds}(t)||Array.isArray(t)||!!t[xn]||!!(!((e=t.constructor)===null||e===void 0)&&e[xn])||Ht(t)||Vt(t))}function Se(t,e,r){r===void 0&&(r=!1),Pe(t)===0?(r?Object.keys:Me)(t).forEach(function(n){r&&typeof n=="symbol"||e(n,t[n],t)}):t.forEach(function(n,s){return e(s,n,t)})}function Pe(t){var e=t[R];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:Ht(t)?2:Vt(t)?3:0}function De(t,e){return Pe(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Os(t,e){return Pe(t)===2?t.get(e):t[e]}function Tn(t,e,r){var n=Pe(t);n===2?t.set(e,r):n===3?t.add(r):t[e]=r}function Cn(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function Ht(t){return Rs&&t instanceof Map}function Vt(t){return Is&&t instanceof Set}function oe(t){return t.o||t.t}function Kt(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=In(t);delete e[R];for(var r=Me(e),n=0;n<r.length;n++){var s=r[n],i=e[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(e[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[s]})}return Object.create(Object.getPrototypeOf(t),e)}function zt(t,e){return e===void 0&&(e=!1),Gt(t)||te(t)||!X(t)||(Pe(t)>1&&(t.set=t.add=t.clear=t.delete=xs),Object.freeze(t),e&&Se(t,function(r,n){return zt(n,!0)},!0)),t}function xs(){W(2)}function Gt(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function Z(t){var e=qt[t];return e||W(18,t),e}function Ts(t,e){qt[t]||(qt[t]=e)}function Ut(){return Be}function kt(t,e){e&&(Z("Patches"),t.u=[],t.s=[],t.v=e)}function ct(t){jt(t),t.p.forEach(Cs),t.p=null}function jt(t){t===Be&&(Be=t.l)}function bn(t){return Be={p:[],l:Be,h:t,m:!0,_:0}}function Cs(t){var e=t[R];e.i===0||e.i===1?e.j():e.g=!0}function Lt(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.O||Z("ES5").S(e,t,n),n?(r[R].P&&(ct(e),W(4)),X(t)&&(t=lt(e,t),e.l||dt(e,t)),e.u&&Z("Patches").M(r[R].t,t,e.u,e.s)):t=lt(e,r,[]),ct(e),e.u&&e.v(e.u,e.s),t!==Rn?t:void 0}function lt(t,e,r){if(Gt(e))return e;var n=e[R];if(!n)return Se(e,function(o,l){return Sn(t,n,e,o,l,r)},!0),e;if(n.A!==t)return e;if(!n.P)return dt(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var s=n.i===4||n.i===5?n.o=Kt(n.k):n.o,i=s,a=!1;n.i===3&&(i=new Set(s),s.clear(),a=!0),Se(i,function(o,l){return Sn(t,n,s,o,l,r,a)}),dt(t,s,!1),r&&t.u&&Z("Patches").N(n,r,t.u,t.s)}return n.o}function Sn(t,e,r,n,s,i,a){if(te(s)){var o=lt(t,s,i&&e&&e.i!==3&&!De(e.R,n)?i.concat(n):void 0);if(Tn(r,n,o),!te(o))return;t.m=!1}else a&&r.add(s);if(X(s)&&!Gt(s)){if(!t.h.D&&t._<1)return;lt(t,s),e&&e.A.l||dt(t,s)}}function dt(t,e,r){r===void 0&&(r=!1),!t.l&&t.h.D&&t.m&&zt(e,r)}function Nt(t,e){var r=t[R];return(r?oe(r):t)[e]}function An(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function ue(t){t.P||(t.P=!0,t.l&&ue(t.l))}function Ft(t){t.o||(t.o=Kt(t.t))}function Bt(t,e,r){var n=Ht(e)?Z("MapSet").F(e,r):Vt(e)?Z("MapSet").T(e,r):t.O?function(s,i){var a=Array.isArray(s),o={i:a?1:0,A:i?i.A:Ut(),P:!1,I:!1,R:{},l:i,t:s,k:null,o:null,j:null,C:!1},l=o,c=qe;a&&(l=[o],c=je);var f=Proxy.revocable(l,c),h=f.revoke,p=f.proxy;return o.k=p,o.j=h,p}(e,r):Z("ES5").J(e,r);return(r?r.A:Ut()).p.push(n),n}function _s(t){return te(t)||W(22,t),function e(r){if(!X(r))return r;var n,s=r[R],i=Pe(r);if(s){if(!s.P&&(s.i<4||!Z("ES5").K(s)))return s.t;s.I=!0,n=En(r,i),s.I=!1}else n=En(r,i);return Se(n,function(a,o){s&&Os(s.t,a)===o||Tn(n,a,e(o))}),i===3?new Set(n):n}(t)}function En(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Kt(t)}function _n(){function t(a,o){var l=i[a];return l?l.enumerable=o:i[a]=l={configurable:!0,enumerable:o,get:function(){var c=this[R];return qe.get(c,a)},set:function(c){var f=this[R];qe.set(f,a,c)}},l}function e(a){for(var o=a.length-1;o>=0;o--){var l=a[o][R];if(!l.P)switch(l.i){case 5:n(l)&&ue(l);break;case 4:r(l)&&ue(l)}}}function r(a){for(var o=a.t,l=a.k,c=Me(l),f=c.length-1;f>=0;f--){var h=c[f];if(h!==R){var p=o[h];if(p===void 0&&!De(o,h))return!0;var g=l[h],y=g&&g[R];if(y?y.t!==p:!Cn(g,p))return!0}}var m=!!o[R];return c.length!==Me(o).length+(m?0:1)}function n(a){var o=a.k;if(o.length!==a.t.length)return!0;var l=Object.getOwnPropertyDescriptor(o,o.length-1);if(l&&!l.get)return!0;for(var c=0;c<o.length;c++)if(!o.hasOwnProperty(c))return!0;return!1}function s(a){a.g&&W(3,JSON.stringify(oe(a)))}var i={};Ts("ES5",{J:function(a,o){var l=Array.isArray(a),c=function(h,p){if(h){for(var g=Array(p.length),y=0;y<p.length;y++)Object.defineProperty(g,""+y,t(y,!0));return g}var m=In(p);delete m[R];for(var S=Me(m),A=0;A<S.length;A++){var E=S[A];m[E]=t(E,h||!!m[E].enumerable)}return Object.create(Object.getPrototypeOf(p),m)}(l,a),f={i:l?5:4,A:o?o.A:Ut(),P:!1,I:!1,R:{},l:o,t:a,k:c,o:null,g:!1,C:!1};return Object.defineProperty(c,R,{value:f,writable:!0}),c},S:function(a,o,l){l?te(o)&&o[R].A===a&&e(a.p):(a.u&&function c(f){if(f&&typeof f=="object"){var h=f[R];if(h){var p=h.t,g=h.k,y=h.R,m=h.i;if(m===4)Se(g,function(x){x!==R&&(p[x]!==void 0||De(p,x)?y[x]||c(g[x]):(y[x]=!0,ue(h)))}),Se(p,function(x){g[x]!==void 0||De(g,x)||(y[x]=!1,ue(h))});else if(m===5){if(n(h)&&(ue(h),y.length=!0),g.length<p.length)for(var S=g.length;S<p.length;S++)y[S]=!1;else for(var A=p.length;A<g.length;A++)y[A]=!0;for(var E=Math.min(g.length,p.length),C=0;C<E;C++)g.hasOwnProperty(C)||(y[C]=!0),y[C]===void 0&&c(g[C])}}}}(a.p[0]),e(a.p))},K:function(a){return a.i===4?r(a):n(a)}})}var wn,Be,$t=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Rs=typeof Map<"u",Is=typeof Set<"u",On=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Rn=$t?Symbol.for("immer-nothing"):((wn={})["immer-nothing"]=!0,wn),xn=$t?Symbol.for("immer-draftable"):"__$immer_draftable",R=$t?Symbol.for("immer-state"):"__$immer_state";var Ds=""+Object.prototype.constructor,Me=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,In=Object.getOwnPropertyDescriptors||function(t){var e={};return Me(t).forEach(function(r){e[r]=Object.getOwnPropertyDescriptor(t,r)}),e},qt={},qe={get:function(t,e){if(e===R)return t;var r=oe(t);if(!De(r,e))return function(s,i,a){var o,l=An(i,a);return l?"value"in l?l.value:(o=l.get)===null||o===void 0?void 0:o.call(s.k):void 0}(t,r,e);var n=r[e];return t.I||!X(n)?n:n===Nt(t.t,e)?(Ft(t),t.o[e]=Bt(t.A.h,n,t)):n},has:function(t,e){return e in oe(t)},ownKeys:function(t){return Reflect.ownKeys(oe(t))},set:function(t,e,r){var n=An(oe(t),e);if(n?.set)return n.set.call(t.k,r),!0;if(!t.P){var s=Nt(oe(t),e),i=s?.[R];if(i&&i.t===r)return t.o[e]=r,t.R[e]=!1,!0;if(Cn(r,s)&&(r!==void 0||De(t.t,e)))return!0;Ft(t),ue(t)}return t.o[e]===r&&(r!==void 0||e in t.o)||Number.isNaN(r)&&Number.isNaN(t.o[e])||(t.o[e]=r,t.R[e]=!0),!0},deleteProperty:function(t,e){return Nt(t.t,e)!==void 0||e in t.t?(t.R[e]=!1,Ft(t),ue(t)):delete t.R[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var r=oe(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{writable:!0,configurable:t.i!==1||e!=="length",enumerable:n.enumerable,value:r[e]}},defineProperty:function(){W(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){W(12)}},je={};Se(qe,function(t,e){je[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),je.deleteProperty=function(t,e){return je.set.call(this,t,e,void 0)},je.set=function(t,e,r){return qe.set.call(this,t[0],e,r,t[0])};var Ms=function(){function t(r){var n=this;this.O=On,this.D=!0,this.produce=function(s,i,a){if(typeof s=="function"&&typeof i!="function"){var o=i;i=s;var l=n;return function(m){var S=this;m===void 0&&(m=o);for(var A=arguments.length,E=Array(A>1?A-1:0),C=1;C<A;C++)E[C-1]=arguments[C];return l.produce(m,function(x){var N;return(N=i).call.apply(N,[S,x].concat(E))})}}var c;if(typeof i!="function"&&W(6),a!==void 0&&typeof a!="function"&&W(7),X(s)){var f=bn(n),h=Bt(n,s,void 0),p=!0;try{c=i(h),p=!1}finally{p?ct(f):jt(f)}return typeof Promise<"u"&&c instanceof Promise?c.then(function(m){return kt(f,a),Lt(m,f)},function(m){throw ct(f),m}):(kt(f,a),Lt(c,f))}if(!s||typeof s!="object"){if((c=i(s))===void 0&&(c=s),c===Rn&&(c=void 0),n.D&&zt(c,!0),a){var g=[],y=[];Z("Patches").M(s,c,g,y),a(g,y)}return c}W(21,s)},this.produceWithPatches=function(s,i){if(typeof s=="function")return function(c){for(var f=arguments.length,h=Array(f>1?f-1:0),p=1;p<f;p++)h[p-1]=arguments[p];return n.produceWithPatches(c,function(g){return s.apply(void 0,[g].concat(h))})};var a,o,l=n.produce(s,i,function(c,f){a=c,o=f});return typeof Promise<"u"&&l instanceof Promise?l.then(function(c){return[c,a,o]}):[l,a,o]},typeof r?.useProxies=="boolean"&&this.setUseProxies(r.useProxies),typeof r?.autoFreeze=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var e=t.prototype;return e.createDraft=function(r){X(r)||W(8),te(r)&&(r=_s(r));var n=bn(this),s=Bt(this,r,void 0);return s[R].C=!0,jt(n),s},e.finishDraft=function(r,n){var s=r&&r[R],i=s.A;return kt(i,n),Lt(void 0,i)},e.setAutoFreeze=function(r){this.D=r},e.setUseProxies=function(r){r&&!On&&W(20),this.O=r},e.applyPatches=function(r,n){var s;for(s=n.length-1;s>=0;s--){var i=n[s];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}s>-1&&(n=n.slice(s+1));var a=Z("Patches").$;return te(r)?a(r,n):this.produce(r,function(o){return a(o,n)})},t}(),V=new Ms,Ps=V.produce,lo=V.produceWithPatches.bind(V),fo=V.setAutoFreeze.bind(V),ho=V.setUseProxies.bind(V),po=V.applyPatches.bind(V),yo=V.createDraft.bind(V),mo=V.finishDraft.bind(V),ft=Ps;function Ae(t){"@babel/helpers - typeof";return Ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(t)}function Dn(t,e){if(Ae(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ae(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mn(t){var e=Dn(t,"string");return Ae(e)=="symbol"?e:e+""}function Pn(t,e,r){return(e=Mn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Wt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?kn(Object(r),!0).forEach(function(n){Pn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kn(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function B(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var Ln=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Qt=function(){return Math.random().toString(36).substring(7).split("").join(".")},ht={INIT:"@@redux/INIT"+Qt(),REPLACE:"@@redux/REPLACE"+Qt(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Qt()}};function ks(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function Yt(t,e,r){var n;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(B(0));if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(B(1));return r(Yt)(t,e)}if(typeof t!="function")throw new Error(B(2));var s=t,i=e,a=[],o=a,l=!1;function c(){o===a&&(o=a.slice())}function f(){if(l)throw new Error(B(3));return i}function h(m){if(typeof m!="function")throw new Error(B(4));if(l)throw new Error(B(5));var S=!0;return c(),o.push(m),function(){if(S){if(l)throw new Error(B(6));S=!1,c();var E=o.indexOf(m);o.splice(E,1),a=null}}}function p(m){if(!ks(m))throw new Error(B(7));if(typeof m.type>"u")throw new Error(B(8));if(l)throw new Error(B(9));try{l=!0,i=s(i,m)}finally{l=!1}for(var S=a=o,A=0;A<S.length;A++){var E=S[A];E()}return m}function g(m){if(typeof m!="function")throw new Error(B(10));s=m,p({type:ht.REPLACE})}function y(){var m,S=h;return m={subscribe:function(E){if(typeof E!="object"||E===null)throw new Error(B(11));function C(){E.next&&E.next(f())}C();var x=S(C);return{unsubscribe:x}}},m[Ln]=function(){return this},m}return p({type:ht.INIT}),n={dispatch:p,subscribe:h,getState:f,replaceReducer:g},n[Ln]=y,n}function Ls(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:ht.INIT});if(typeof n>"u")throw new Error(B(12));if(typeof r(void 0,{type:ht.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(B(13))})}function Nn(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var s=e[n];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,o;try{Ls(r)}catch(l){o=l}return function(c,f){if(c===void 0&&(c={}),o)throw o;if(0)var h;for(var p=!1,g={},y=0;y<i.length;y++){var m=i[y],S=r[m],A=c[m],E=S(A,f);if(typeof E>"u"){var C=f&&f.type;throw new Error(B(14))}g[m]=E,p=p||E!==A}return p=p||i.length!==Object.keys(c).length,p?g:c}}function ke(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,s){return function(){return n(s.apply(void 0,arguments))}})}function Fn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){return function(){var s=n.apply(void 0,arguments),i=function(){throw new Error(B(15))},a={getState:s.getState,dispatch:function(){return i.apply(void 0,arguments)}},o=e.map(function(l){return l(a)});return i=ke.apply(void 0,o)(s.dispatch),Wt(Wt({},s),{},{dispatch:i})}}}function Un(t){var e=function(n){var s=n.dispatch,i=n.getState;return function(a){return function(o){return typeof o=="function"?o(s,i,t):a(o)}}};return e}var jn=Un();jn.withExtraArgument=Un;var Xt=jn;var Kn=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ns=function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(f){return l([c,f])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(f){c=[6,f],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Le=function(t,e){for(var r=0,n=e.length,s=t.length;r<n;r++,s++)t[s]=e[r];return t},Fs=Object.defineProperty,Us=Object.defineProperties,js=Object.getOwnPropertyDescriptors,Bn=Object.getOwnPropertySymbols,Bs=Object.prototype.hasOwnProperty,qs=Object.prototype.propertyIsEnumerable,qn=function(t,e,r){return e in t?Fs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r},ce=function(t,e){for(var r in e||(e={}))Bs.call(e,r)&&qn(t,r,e[r]);if(Bn)for(var n=0,s=Bn(e);n<s.length;n++){var r=s[n];qs.call(e,r)&&qn(t,r,e[r])}return t},Jt=function(t,e){return Us(t,js(e))},Hs=function(t,e,r){return new Promise(function(n,s){var i=function(l){try{o(r.next(l))}catch(c){s(c)}},a=function(l){try{o(r.throw(l))}catch(c){s(c)}},o=function(l){return l.done?n(l.value):Promise.resolve(l.value).then(i,a)};o((r=r.apply(t,e)).next())})};var Vs=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ke:ke.apply(null,arguments)},ko=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function Ks(t){if(typeof t!="object"||t===null)return!1;var e=Object.getPrototypeOf(t);if(e===null)return!0;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return e===r}var zs=function(t){Kn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,Le([void 0],r[0].concat(this)))):new(e.bind.apply(e,Le([void 0],r.concat(this))))},e}(Array),Gs=function(t){Kn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,Le([void 0],r[0].concat(this)))):new(e.bind.apply(e,Le([void 0],r.concat(this))))},e}(Array);function tr(t){return X(t)?ft(t,function(){}):t}function $s(t){return typeof t=="boolean"}function Ws(){return function(e){return Qs(e)}}function Qs(t){t===void 0&&(t={});var e=t.thunk,r=e===void 0?!0:e,n=t.immutableCheck,s=n===void 0?!0:n,i=t.serializableCheck,a=i===void 0?!0:i,o=new zs;if(r&&($s(r)?o.push(Xt):o.push(Xt.withExtraArgument(r.extraArgument))),0){if(s)var l;if(a)var c}return o}var Zt=!0;function zn(t){var e=Ws(),r=t||{},n=r.reducer,s=n===void 0?void 0:n,i=r.middleware,a=i===void 0?e():i,o=r.devTools,l=o===void 0?!0:o,c=r.preloadedState,f=c===void 0?void 0:c,h=r.enhancers,p=h===void 0?void 0:h,g;if(typeof s=="function")g=s;else if(Ks(s))g=Nn(s);else throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');var y=a;if(typeof y=="function"&&(y=y(e),!Zt&&!Array.isArray(y)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!Zt&&y.some(function(x){return typeof x!="function"}))throw new Error("each middleware provided to configureStore must be a function");var m=Fn.apply(void 0,y),S=ke;l&&(S=Vs(ce({trace:!Zt},typeof l=="object"&&l)));var A=new Gs(m),E=A;Array.isArray(p)?E=Le([m],p):typeof p=="function"&&(E=p(A));var C=S.apply(void 0,E);return Yt(g,f,C)}function le(t,e){function r(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];if(e){var i=e.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return ce(ce({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:n[0]}}return r.toString=function(){return""+t},r.type=t,r.match=function(n){return n.type===t},r}function Gn(t){var e={},r=[],n,s={addCase:function(i,a){var o=typeof i=="string"?i:i.type;if(o in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[o]=a,s},addMatcher:function(i,a){return r.push({matcher:i,reducer:a}),s},addDefaultCase:function(i){return n=i,s}};return t(s),[e,r,n]}function Ys(t){return typeof t=="function"}function Xs(t,e,r,n){r===void 0&&(r=[]);var s=typeof e=="function"?Gn(e):[e,r,n],i=s[0],a=s[1],o=s[2],l;if(Ys(t))l=function(){return tr(t())};else{var c=tr(t);l=function(){return c}}function f(h,p){h===void 0&&(h=l());var g=Le([i[p.type]],a.filter(function(y){var m=y.matcher;return m(p)}).map(function(y){var m=y.reducer;return m}));return g.filter(function(y){return!!y}).length===0&&(g=[o]),g.reduce(function(y,m){if(m)if(te(y)){var S=y,A=m(S,p);return A===void 0?y:A}else{if(X(y))return ft(y,function(E){return m(E,p)});var A=m(y,p);if(A===void 0){if(y===null)return y;throw Error("A case reducer on a non-draftable value must not return undefined")}return A}return y},h)}return f.getInitialState=l,f}function Js(t,e){return t+"/"+e}function $n(t){var e=t.name;if(!e)throw new Error("`name` is a required option for createSlice");typeof process<"u";var r=typeof t.initialState=="function"?t.initialState:tr(t.initialState),n=t.reducers||{},s=Object.keys(n),i={},a={},o={};s.forEach(function(f){var h=n[f],p=Js(e,f),g,y;"reducer"in h?(g=h.reducer,y=h.prepare):g=h,i[f]=g,a[p]=g,o[f]=y?le(p,y):le(p)});function l(){var f=typeof t.extraReducers=="function"?Gn(t.extraReducers):[t.extraReducers],h=f[0],p=h===void 0?{}:h,g=f[1],y=g===void 0?[]:g,m=f[2],S=m===void 0?void 0:m,A=ce(ce({},p),a);return Xs(r,function(E){for(var C in A)E.addCase(C,A[C]);for(var x=0,N=y;x<N.length;x++){var Q=N[x];E.addMatcher(Q.matcher,Q.reducer)}S&&E.addDefaultCase(S)})}var c;return{name:e,reducer:function(f,h){return c||(c=l()),c(f,h)},actions:o,caseReducers:i,getInitialState:function(){return c||(c=l()),c.getInitialState()}}}var Zs="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ei=function(t){t===void 0&&(t=21);for(var e="",r=t;r--;)e+=Zs[Math.random()*64|0];return e},ti=["name","message","stack","code"],er=function(){function t(e,r){this.payload=e,this.meta=r}return t}(),Hn=function(){function t(e,r){this.payload=e,this.meta=r}return t}(),ri=function(t){if(typeof t=="object"&&t!==null){for(var e={},r=0,n=ti;r<n.length;r++){var s=n[r];typeof t[s]=="string"&&(e[s]=t[s])}return e}return{message:String(t)}},Uo=function(){function t(e,r,n){var s=le(e+"/fulfilled",function(f,h,p,g){return{payload:f,meta:Jt(ce({},g||{}),{arg:p,requestId:h,requestStatus:"fulfilled"})}}),i=le(e+"/pending",function(f,h,p){return{payload:void 0,meta:Jt(ce({},p||{}),{arg:h,requestId:f,requestStatus:"pending"})}}),a=le(e+"/rejected",function(f,h,p,g,y){return{payload:g,error:(n&&n.serializeError||ri)(f||"Rejected"),meta:Jt(ce({},y||{}),{arg:p,requestId:h,rejectedWithValue:!!g,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"})}}),o=!1,l=typeof AbortController<"u"?AbortController:function(){function f(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return f.prototype.abort=function(){},f}();function c(f){return function(h,p,g){var y=n?.idGenerator?n.idGenerator(f):ei(),m=new l,S,A=!1;function E(x){S=x,m.abort()}var C=function(){return Hs(this,null,function(){var x,N,Q,de,q,fe,Ee;return Ns(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),de=(x=n?.condition)==null?void 0:x.call(n,f,{getState:p,extra:g}),si(de)?[4,de]:[3,2];case 1:de=u.sent(),u.label=2;case 2:if(de===!1||m.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return A=!0,q=new Promise(function(d,b){return m.signal.addEventListener("abort",function(){return b({name:"AbortError",message:S||"Aborted"})})}),h(i(y,f,(N=n?.getPendingMeta)==null?void 0:N.call(n,{requestId:y,arg:f},{getState:p,extra:g}))),[4,Promise.race([q,Promise.resolve(r(f,{dispatch:h,getState:p,extra:g,requestId:y,signal:m.signal,abort:E,rejectWithValue:function(d,b){return new er(d,b)},fulfillWithValue:function(d,b){return new Hn(d,b)}})).then(function(d){if(d instanceof er)throw d;return d instanceof Hn?s(d.payload,y,f,d.meta):s(d,y,f)})])];case 3:return Q=u.sent(),[3,5];case 4:return fe=u.sent(),Q=fe instanceof er?a(null,y,f,fe.payload,fe.meta):a(fe,y,f),[3,5];case 5:return Ee=n&&!n.dispatchConditionRejection&&a.match(Q)&&Q.meta.condition,Ee||h(Q),[2,Q]}})})}();return Object.assign(C,{abort:E,requestId:y,arg:f,unwrap:function(){return C.then(ni)}})}}return Object.assign(c,{pending:i,rejected:a,fulfilled:s,typePrefix:e})}return t.withTypes=function(){return t},t}();function ni(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function si(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var Wn="listener",Qn="completed",Yn="cancelled",jo="task-"+Yn,Bo="task-"+Qn,qo=Wn+"-"+Yn,Ho=Wn+"-"+Qn;var rr="listenerMiddleware";var Vo=le(rr+"/add"),Ko=le(rr+"/removeAll"),zo=le(rr+"/remove");var Vn,Go=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis):function(t){return(Vn||(Vn=Promise.resolve())).then(t).catch(function(e){return setTimeout(function(){throw e},0)})},ii=function(t){return function(e){setTimeout(e,t)}},$o=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:ii(10);_n();var ai=nt(Symbol("withEventBus"),function(t,e){return class extends t{constructor(){super(...arguments),this.eventBus=e??document.createElement("span")}addEventListener(r,n,s){this.eventBus.addEventListener(r,n,s)}dispatchEvent(r){return this.eventBus.dispatchEvent(r)}removeEventListener(r,n,s){this.eventBus.removeEventListener(r,n,s)}}}),pt=class extends ai(Object){};window.ftReduxStores||(window.ftReduxStores={});var Xn=class t extends pt{static get(e){var r;let n=typeof e=="string"?e:e.name,s=typeof e=="string"?void 0:e,i=window.ftReduxStores[n];if(ut(i))return i;if(s==null)return;let a=$n({...s,reducers:(r=s.reducers)!==null&&r!==void 0?r:{}}),o=zn({reducer:(l,c)=>c.type==="CLEAR_FT_REDUX_STORE"?a.getInitialState():typeof c.type=="string"&&c.type.startsWith("DEFAULT_VALUE_SETTER__")?{...l,...c.overwrites}:a.reducer(l,c)});return window.ftReduxStores[s.name]=new t(a,o,s.eventBus)}constructor(e,r,n){super(),this.reduxSlice=e,this.reduxStore=r,this.isFtReduxStore=!0,this.commands=new st;let s=i=>i!=null?JSON.parse(JSON.stringify(i)):i;this.actions=new Proxy(this.reduxSlice.actions,{get:(i,a,o)=>{let l=a,c=i[l];return c?(...f)=>{let h=c(...f.map(s));return this.reduxStore.dispatch(h),h}:f=>{this.setState({[l]:s(f)})}}}),this.eventBus=n??this.eventBus}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE"})}setState(e){this.reduxStore.dispatch({type:"DEFAULT_VALUE_SETTER__"+Object.keys(e).join("_"),overwrites:e})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(e){throw new Error("Not implemented yet.")}subscribe(e){return this.reduxStore.subscribe(e)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}};var yt=class{static format(e,r,n,s){return window.moment?window.moment(e).locale(r).format(this.getMomentDateFormat(n,s)):this.getIntlDateTime(e,r,n,s)}static getMomentDateFormat(e,r){return e?r?"lll":"ll":r?"L LT":"L"}static getIntlDateTime(e,r,n,s){let i=typeof e=="string"?new Date(e):e,a=new Intl.DateTimeFormat(r,{dateStyle:n?"medium":"short"}).format(i);if(!s)return a;let o=new Intl.DateTimeFormat(r,{timeStyle:"short"}).format(i);return`${a} ${o}`}static getTimezoneAsString(){let e=n=>String(Math.floor(n)).padStart(2,"0"),r=new Date().getTimezoneOffset();return`${r<0?"+":"-"}${e(Math.abs(r)/60)}:${e(Math.abs(r)%60)}`}};var Jn=O(k()),mt=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},vu=(0,Jn.applyMixinOnce)(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(v)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var s,i;return((i=(s=this.metadataDescriptors.find(o=>o.key===n))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1)?o=>yt.format(o,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return mt([(0,nr.property)({type:Boolean})],e.prototype,"useLongDateFormat",void 0),mt([(0,nr.property)({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),mt([Pt({store:v.name,selector:r=>{var n,s;return(s=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&s!==void 0?s:[]}})],e.prototype,"metadataDescriptors",void 0),mt([Pt({store:v.name})],e.prototype,"uiLocale",void 0),e});var bt=O(k());var vt=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=v.getState().session;return!!e?.sessionAuthenticated}};var gt=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=v.getState().session;return!!e?.sessionAuthenticated}};var oi="ft-user-assets",ui={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(G).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:s}=e.payload;ir(t,r,[...sr(t,r),s]),Zn(t,r,1,n),es(t,s)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;ir(t,r,sr(t,r).map(s=>s.id===n.id?n:s)),es(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:s}=e.payload;ir(t,r,sr(t,r).filter(i=>i.id!==s)),Zn(t,r,-1,n)}},ts={[G.SEARCHES]:"savedSearches",[G.BOOKMARKS]:"bookmarks",[G.BOOKS]:void 0,[G.COLLECTIONS]:void 0},sr=(t,e)=>{var r;let n=ts[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},ir=(t,e,r)=>{let n=ts[e];n&&(t[n]=r)},Zn=(t,e,r,n)=>{let s=t.assetCounts.allAsset[e];if(s!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,s+r),e===G.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},es=(t,e)=>{let r=t.assetLabels.map(s=>s.title),n=e.labels.filter(s=>!r.includes(s)).map(s=>({title:s}));t.assetLabels.push(...n)},K=bt.FtReduxStore.get({name:oi,reducers:ui,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(G).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),ar=class{constructor(e=new vt,r=new gt){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=v.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Xe,this.savedSearchesService=new Ze,v.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=v.getState();(0,bt.deepEqual)((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),K.actions.clearAssetCount(),K.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),K.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),K.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();K.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();K.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&K.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&K.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(K.getState().assetCounts.bookmarkByMap).length!==0;e===G.BOOKMARKS&&r&&K.actions.clearBookmarkCountByMap(),K.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;K.actions.bookmarks(r)}}},or=new ar;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=or);(0,rs.customElement)("ft-app-context")(_);var St=class extends j{constructor(e){super(!0,e),this.cache.registerFinal("search-configuration",async()=>(await this.awaitApi).getSearchConfiguration())}async launchSearch(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters),facets:[...e.facets].sort((n,s)=>n.id.localeCompare(s.id))};return this.cache.get("search-"+this.hash(r),async()=>(await this.awaitApi).search(e),2*60*1e3)}async launchSuggest(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters)};return this.cache.get("suggest-"+this.hash(r),async()=>(await this.awaitApi).getSuggestions(e),2*60*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}async getConfiguration(){return this.cache.get("search-configuration")}sortFilters(e){return e.map(r=>r.valueFilter==null?r:{...r,valueFilter:{...r.valueFilter,values:[...r.valueFilter.values].sort((n,s)=>n.localeCompare(s))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var ci=t=>t.request.virtualField===Te.TITLE_ONLY&&t.request.scope===Ce.DOCUMENTS,li=t=>t.request.keywordMatch==We.MANDATORY,At=class t extends Event{constructor(){super(t.eventName)}};At.eventName="search-context-clear-all-filters";var He=class t{static build(e,r){return new t(Sr(e.trim()||"context"),r)}constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.localesDebouncer=new z.Debouncer(10),this.searchDebouncer=new z.Debouncer(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest(this.store.getState()))),this.buildSearchRequest=n=>({...n.request,facets:this.facetIds.map(s=>({id:s}))}),this.suggestDebouncer=new z.Debouncer(300),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest(this.store.getState()))),this.buildSuggestRequest=n=>{var s;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(s=n.request.sort)!==null&&s!==void 0?s:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch}},this.service=r??new St,this.service.cache.addEventListener("clear-cache",n=>{n.detail.clearedKeys.includes("available-locales")&&this.updateLocales()}),this.searchWatcher=(0,z.watch)(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=(0,z.watch)(e,this.buildSuggestRequest,this.launchSuggest)}async initService(){return this.updateLocales(),this.service.getConfiguration().then(e=>{this.store.actions.configuration(e),this.setSortId(this.store.getState().request.sortId)}),this.launchSearch()}setQuery(e){this.store.actions.setRequestQuery(e),this.store.actions.liveQuery(e),this.store.actions.setPageNumber(1)}setContentLocale(e){var r;let n=(r=this.store.getState().locales)!==null&&r!==void 0?r:[],s=this.store.getState().request.contentLocale;if(e!=s){if(n.length>0){let i=a=>n.some(o=>o.lang==a);i(e)||(e=i(s)?s:n[0].lang)}this.store.actions.setRequestContentLocale(e),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([])}return e}forceContentLocale(e){this.store.actions.setRequestContentLocale(e)}setPageSize(e){this.store.actions.setPageSize(e)}setPageNumber(e){this.store.actions.setPageNumber(e)}get sortOptions(){var e,r;return(r=(e=this.store.getState().configuration)===null||e===void 0?void 0:e.sortOptions)!==null&&r!==void 0?r:[]}setSort(e){this.store.actions.setRequestSort(e),this.store.actions.setPageNumber(1)}setSortId(e){var r;if(this.store.actions.setPageNumber(1),e==null||this.sortOptions.length==0)return this.store.actions.setRequestSortId(e),e;let n=(r=this.sortOptions.find(s=>s.id==e))!==null&&r!==void 0?r:this.sortOptions[0];return this.store.actions.setRequestSortId(n.id),n.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.store.actions.setRequestFilters(r),this.store.actions.setPageNumber(1)}setClusterSortCriterion(e){this.store.actions.setRequestClusterSortCriterion(e)}setSearchInDocumentTitlesOnly(e){e?(this.store.actions.setRequestVirtualField(Te.TITLE_ONLY),this.store.actions.setRequestScope(Ce.DOCUMENTS)):(this.store.actions.setRequestVirtualField(Te.EVERYWHERE),this.store.actions.setRequestScope(Ce.DEFAULT))}setKeywordMatch(e){this.store.actions.setKeywordMatch(e)}setVirtualField(e){this.store.actions.setRequestVirtualField(e)}get searchInDocumentTitlesOnly(){return ci(this.store.getState())}get keywordMatch(){return li(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new At)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(s=>s!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(s=>({id:s}));this.store.actions.setRequestFacets(n)}setFilter(e,r){this.setValueFilter(e,r)}setValueFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(a=>!a.valueFilter),...n.filter(a=>a.valueFilter&&a.key!==s.key),s];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,dateFilter:{type:r}},i=[...n.filter(a=>!a.dateFilter),...n.filter(a=>a.dateFilter&&a.key!==s.key),s];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.dateFilter),...r.filter(s=>s.dateFilter&&s.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let s=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},a=[...s.filter(o=>!o.rangeFilter),...s.filter(o=>o.rangeFilter&&o.key!==i.key),i];this.setFilters(a)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.rangeFilter),...r.filter(s=>s.rangeFilter&&s.key!==e)];this.setFilters(n)}setLiveQuery(e){this.store.actions.liveQuery(e)}setRequest(e){this.store.actions.setRequest({...e,facets:this.store.getState().request.facets}),this.store.actions.liveQuery(e.query),this.store.actions.setPageNumber(1)}setScope(e){this.store.actions.setRequestScope(e)}setOtherQueryParams(e){this.store.actions.setOtherQueryParams(e)}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales))}async fetchSearchData(e){var r,n,s,i;try{if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),this.store.actions.paging(void 0),this.ignoreEmptyQuery&&e.query.length==0)this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0);else{this.cancelableSearch=(0,z.cancelable)(this.service.launchSearch(e));let a=await this.cancelableSearch;if(this.store.actions.announcements(a.announcements),a.paging.currentPage<=1)this.store.actions.results(a.results),this.store.actions.facets(a.facets),this.store.actions.spellcheck(a.spellcheck);else{let o=((n=this.store.getState().results)!==null&&n!==void 0?n:[]).concat(a.results);this.store.actions.results(o),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(a.paging.currentPage-1)*((s=e.paging.perPage)!==null&&s!==void 0?s:20)+1}`})}this.store.actions.paging(a.paging)}}catch(a){a instanceof z.CanceledPromiseError||(console.error(a),(i=this.errorHandler)===null||i===void 0||i.call(this,a))}}async fetchSuggestData(e){var r;try{(r=this.cancelableSuggest)===null||r===void 0||r.cancel(),this.cancelableSuggest=(0,z.cancelable)(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof z.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(n)}}clear(){this.store.clear()}clearResults(){this.store.actions.paging(void 0),this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0)}};var di=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},cr=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},ns=Symbol("registerInterval"),ur=Symbol("registerAttempts"),fi=40,hi=(0,Et.applyMixinOnce)(Symbol("toFtSearchComponent"),function(t){class e extends t{setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[ur]=0,this[ns]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[ur]>fi?window.clearInterval(this[ns]):(this[ur]++,this.dispatchEvent(new cr))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return di([(0,is.state)()],e.prototype,"stateManager",void 0),e}),ss=class extends hi(Et.FtLitElementRedux){};var as=O(k());function wt(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function Ot(t){var e,r;return t.dateFilter?{key:t.key,type:"DATE",dateValue:t.dateFilter.type}:t.rangeFilter?{key:t.key,type:"RANGE",from:t.rangeFilter.from,to:t.rangeFilter.to}:{key:t.key,values:(e=t.valueFilter)===null||e===void 0?void 0:e.values,negative:(r=t.valueFilter)===null||r===void 0?void 0:r.negative}}var xt=class{constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.enableAnalyticsEvents=!0,this.appName=void 0,this.appVersion=void 0,this.document=void 0,this.sendEvent=n=>{if(!this.canSendEvent()||!n)return;let s=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(s,n):this.sendDocumentSearchEvent(s,n)},this.eventsService=r??new et,this.resultsWatcher=(0,as.watch)(e,n=>n.results,this.sendEvent)}setEnableAnalyticsEvents(e){this.enableAnalyticsEvents=e}setAppName(e){this.appName=e}setAppVersion(e){this.appVersion=e}setDocumentSearch(e){this.document=e}setDocumentSearchFromMap(e){this.setDocumentSearch(this.convertToAnalyticsMap(e))}initAppInfo(){let{apiIntegrationIdentifier:e,apiIntegrationAppVersion:r}=v.getState();this.setAppName(e??"unknown"),this.setAppVersion(r??"unknown")}convertToAnalyticsMap(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}canSendEvent(){if(this.appName==null||this.appVersion==null)return console.debug("ft-search-context.eventManager is not initialized. No events will be sent!"),!1;let{editorMode:e}=v.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r){let n={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:wt(e.metadataFilters),facets:e.metadataFilters.map(s=>Ot(s))}};this.eventsService.sendKhubSearchEvent(n)}sendDocumentSearchEvent(e,r){if(e.metadataFilters.find(s=>{var i;return s.key==="ft:publicationId"&&((i=s.valueFilter)===null||i===void 0?void 0:i.values[0])===this.document.id})!==void 0){let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(s)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==se.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:wt(n.metadataFilters),facets:n.metadataFilters.map(a=>Ot(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==se.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:wt(n.metadataFilters),facets:n.metadataFilters.map(a=>Ot(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case se.MAP:return{id:e.map.mapId,title:e.map.title,type:xe.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case se.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:xe.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case se.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:xe.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r,n,s,i,a;return(i=(n=(r=e.map)===null||r===void 0?void 0:r.originUrl)!==null&&n!==void 0?n:(s=e.topic)===null||s===void 0?void 0:s.originUrl)!==null&&i!==void 0?i:(a=e.document)===null||a===void 0?void 0:a.originUrl}};var L=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},lr=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},dr=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},fr=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n}})}},I=class extends H.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=He.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=r=>this.handleLoadError(r),this.addStore(this.stateManager.store,"search")}return this._stateManager}get eventManager(){return this._eventManager==null&&(this._eventManager=new xt(this.stateManager.store)),this._eventManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.otherQueryParams={},this.addStore(v)}render(){return os.html`
6
+ `}connectedCallback(){super.connectedCallback(),v.addEventListener(ye.eventName,this.reloadConfiguration)}disconnectedCallback(){v.addEventListener(ye.eventName,this.reloadConfiguration),super.disconnectedCallback()}update(e){var r,n,s,i,a,o,l;super.update(e),e.has("baseUrl")&&(v.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),e.has("apiIntegrationIdentifier")&&v.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&v.actions.apiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&v.actions.uiLocale(this.uiLocale),e.has("metadataConfiguration")&&v.actions.metadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&v.actions.noCustom(this.noCustom),e.has("editorMode")&&v.actions.editorMode(this.editorMode),e.has("noCustomComponent")&&v.actions.noCustomComponent(this.noCustomComponent),e.has("session")&&v.actions.session(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(c=>Jr.addContext(c)),e.has("openExternalDocumentInNewTab")&&v.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&v.actions.navigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&v.actions.forcedOffline(this.forcedOffline),e.has("localesConfiguration")&&(v.actions.defaultLocales((r=this.localesConfiguration)===null||r===void 0?void 0:r.defaultLocales),v.actions.availableUiLocales((s=(n=this.localesConfiguration)===null||n===void 0?void 0:n.availableUiLocales)!==null&&s!==void 0?s:[]),v.actions.searchInAllLanguagesAllowed((a=(i=this.localesConfiguration)===null||i===void 0?void 0:i.allLanguagesAllowed)!==null&&a!==void 0?a:!1)),e.has("authenticationRequired")&&v.actions.authenticationRequired(this.authenticationRequired),e.has("availableContentLocales")&&v.actions.availableContentLocales((l=(o=this.availableContentLocales)===null||o===void 0?void 0:o.contentLocales)!==null&&l!==void 0?l:[]),setTimeout(()=>this.updateIfNeeded())}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.session==null&&this.updateSession(),this.metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),this.availableContentLocales==null&&this.updateAvailableContentLocales())}async updateSession(){this.session=await this.cache.get("session",async()=>{let e=await this.apiProvider().getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.session=void 0},e.idleTimeoutInMillis),e})}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration())}async updateLocalesConfiguration(){this.localesConfiguration=await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration())}async updateAvailableContentLocales(){this.availableContentLocales=await this.cache.get("availableContentLocales",()=>sn(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}))}};_.elementDefinitions={};_.styles=Yr;P([(0,U.property)()],_.prototype,"baseUrl",void 0);P([(0,U.property)()],_.prototype,"apiIntegrationIdentifier",void 0);P([(0,U.property)()],_.prototype,"apiIntegrationAppVersion",void 0);P([(0,U.property)()],_.prototype,"uiLocale",void 0);P([(0,Y.jsonProperty)(null)],_.prototype,"availableUiLocales",void 0);P([(0,Y.jsonProperty)(null)],_.prototype,"metadataConfiguration",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"editorMode",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"noCustom",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"openExternalDocumentInNewTab",void 0);P([(0,U.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],_.prototype,"noCustomComponent",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"withManualResources",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"navigatorOnline",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"forcedOffline",void 0);P([(0,U.property)({type:Object})],_.prototype,"apiProvider",void 0);P([(0,U.property)({type:Boolean})],_.prototype,"authenticationRequired",void 0);P([(0,Y.jsonProperty)([])],_.prototype,"messageContexts",void 0);P([(0,Y.jsonProperty)(void 0)],_.prototype,"session",void 0);P([(0,U.state)()],_.prototype,"localesConfiguration",void 0);P([(0,U.state)()],_.prototype,"availableContentLocales",void 0);var nr=O(re());function As(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let r,n,s;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!rt(t[n],e[n]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;for(n of t.entries())if(!rt(n[1],e.get(n[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();let i=a=>Object.keys(a).filter(o=>a[o]!=null);if(s=i(t),r=s.length,r!==i(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[n]))return!1;for(n=r;n--!==0;){let a=s[n];if(!rt(t[a],e[a]))return!1}return!0}return t!==t&&e!==e||t==null&&e==null}function rt(t,e){try{return As(t,e)}catch{return!1}}function Fe(t,e){return!rt(t,e)}function nt(t,e){let r=n=>n[t]===!0;return n=>{if(r(n))return n;let s=e(n);return s[t]=!0,s}}var on=O(re(),1);var Pt=t=>{let e=t??{};return(r,n)=>{var s;let i={hasChanged:Fe,attribute:!1,...e};(0,on.property)(i)(r,n);let a=r.constructor;a.reduxProperties=new Map(a.reduxProperties),a.reduxProperties.set(n,{selector:(s=e.selector)!==null&&s!==void 0?s:o=>o[n],store:e.store})}};var st=class{constructor(){this.queue=[]}add(e,r=!1){r&&this.clear(e.type),this.queue.push(e)}consume(e){let r=this.queue.find(n=>n.type===e);return r&&(this.queue=this.queue.filter(n=>n!==r)),r}clear(e){typeof e=="string"?this.queue=this.queue.filter(r=>r.type!==e):this.queue=this.queue.filter(r=>!e.test(r.type))}};var ge=O(re(),1);var un=O(re(),1);function cn(t,e){let r=()=>JSON.parse(JSON.stringify(t));return(0,un.property)({type:Object,converter:{fromAttribute:n=>{if(n==null)return r();try{return JSON.parse(n)}catch{return r()}},toAttribute:n=>JSON.stringify(n)},hasChanged:Fe,...e??{}})}var it=class{constructor(e=0){this.timeout=e,this.callbacks=[]}run(e,r){return this.callbacks=[e],this.debounce(r)}queue(e,r){return this.callbacks.push(e),this.debounce(r)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(e){return this.promise==null&&(this.promise=new Promise((r,n)=>{this.resolvePromise=r,this.rejectPromise=n})),this.clearTimeout(),this._debounce=window.setTimeout(()=>this.runCallbacks(),e??this.timeout),this.promise}async runCallbacks(){var e,r;let n=[...this.callbacks];this.callbacks=[];let s=(e=this.rejectPromise)!==null&&e!==void 0?e:()=>null,i=(r=this.resolvePromise)!==null&&r!==void 0?r:()=>null;this.clearPromise();for(let a of n)try{await a()}catch(o){s(o);return}i(!0)}clearTimeout(){this._debounce!=null&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}};var dn=O(we(),1);var at=globalThis,Es=at.ShadowRoot&&(at.ShadyCSS===void 0||at.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Qa=Symbol();var ln=(t,e)=>{if(Es)t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of e){let n=document.createElement("style"),s=at.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=r.cssText,t.appendChild(n)}};var ot=class extends dn.LitElement{createRenderRoot(){let e=this.constructor;e.elementDefinitions&&!e.registry&&(e.registry=new CustomElementRegistry,Object.entries(e.elementDefinitions).forEach(([s,i])=>e.registry.define(s,i)));let r={...e.shadowRootOptions,customElements:e.registry},n=this.renderOptions.creationScope=this.attachShadow(r);return ln(n,e.elementStyles),n}};function fn(t,e,...r){var n;let s=t.querySelector(e);for(let i of r)s=(n=s?.shadowRoot)===null||n===void 0?void 0:n.querySelector(i);return s}var Ie=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},mn,hn=Symbol("constructorPrototype"),pn=Symbol("constructorName"),vn=Symbol("exportpartsDebouncer"),yn=Symbol("dynamicDependenciesLoaded"),Re=class t extends CustomEvent{constructor(){super(t.eventName,{bubbles:!0})}};Re.eventName="exportparts-updated";var J=class extends ot{constructor(){super(),this.useAdoptedStyleSheets=!0,this.adoptedCustomStyleSheet=new CSSStyleSheet,this[mn]=new it(5),this.scheduleExportpartsUpdate=()=>{var e,r,n;(!((e=this.exportpartsPrefix)===null||e===void 0)&&e.trim()||(n=(r=this.exportpartsPrefixes)===null||r===void 0?void 0:r.length)!==null&&n!==void 0&&n)&&this[vn].run(()=>{var s,i;!((s=this.exportpartsPrefix)===null||s===void 0)&&s.trim()?this.setExportpartsAttribute([this.exportpartsPrefix]):this.exportpartsPrefixes!=null&&((i=this.exportpartsPrefixes)===null||i===void 0?void 0:i.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)})},this[pn]=this.constructor.name,this[hn]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[pn]&&Object.setPrototypeOf(this,this[hn])}connectedCallback(){var e;super.connectedCallback();try{this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(this.adoptedCustomStyleSheet)&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.adoptedCustomStyleSheet]),this.useAdoptedStyleSheets=!0}catch(n){this.useAdoptedStyleSheets=!1,console.error("Cannot use adopted stylesheets",n)}let r=this.constructor;r[yn]||(r[yn]=!0,this.importDynamicDependencies()),(e=this.shadowRoot)===null||e===void 0||e.addEventListener(Re.eventName,this.scheduleExportpartsUpdate)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.shadowRoot)===null||e===void 0||e.removeEventListener(Re.eventName,this.scheduleExportpartsUpdate)}importDynamicDependencies(){}updated(e){super.updated(e),this.updateComplete.then(()=>{this.contentAvailableCallback(e),this.focusElementToFocus(e),this.applyCustomStylesheet(e),this.scheduleExportpartsUpdate(),e.has("exportparts")&&this.dispatchEvent(new Re)})}contentAvailableCallback(e){}focusElementToFocus(e){if(e.has("elementToFocus")&&this.elementToFocus!=null){let{element:r,selector:n,shadowPath:s}=this.elementToFocus;if(n!=null){let i=[...s??[],n];r=fn(this.shadowRoot,...i)}r?.focus(),window.FluidTopicsA11yHints.isKeyboardNavigation||r?.blur(),this.elementToFocus=void 0}}applyCustomStylesheet(e){var r,n,s;if(((n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll(".ft-lit-element--custom-stylesheet"))!==null&&n!==void 0?n:[]).forEach(i=>i.remove()),this.useAdoptedStyleSheets){if(e.has("customStylesheet"))try{this.adoptedCustomStyleSheet.replaceSync((s=this.customStylesheet)!==null&&s!==void 0?s:"")}catch(i){console.error(i,this.customStylesheet),this.useAdoptedStyleSheets=!1}}else if(this.customStylesheet){let i=document.createElement("style");i.classList.add("ft-lit-element--custom-stylesheet"),i.innerHTML=this.customStylesheet,this.shadowRoot.append(i)}}setExportpartsAttribute(e){var r,n,s,i,a,o;let l=p=>p!=null&&p.trim().length>0,c=e.filter(l).map(p=>p.trim());if(c.length===0){this.exportparts=void 0;return}let f=new Set;for(let p of(n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll("[part],[exportparts]"))!==null&&n!==void 0?n:[]){let g=(i=(s=p.getAttribute("part"))===null||s===void 0?void 0:s.split(" "))!==null&&i!==void 0?i:[],y=(o=(a=p.getAttribute("exportparts"))===null||a===void 0?void 0:a.split(",").map(S=>S.split(":")[1]))!==null&&o!==void 0?o:[],m=[...g,...y].filter(l).map(S=>S.trim());for(let S of m)f.add(S)}if(f.size===0){this.exportparts=void 0;return}let h=[...f.values()].flatMap(p=>c.map(g=>`${p}:${g}--${p}`));this.exportparts=[...this.part,...h].join(", ")}};mn=vn;Ie([(0,ge.property)()],J.prototype,"exportpartsPrefix",void 0);Ie([cn([])],J.prototype,"exportpartsPrefixes",void 0);Ie([(0,ge.property)({reflect:!0})],J.prototype,"exportparts",void 0);Ie([(0,ge.property)()],J.prototype,"customStylesheet",void 0);Ie([(0,ge.property)()],J.prototype,"elementToFocus",void 0);Ie([(0,ge.state)()],J.prototype,"useAdoptedStyleSheets",void 0);function ut(t){var e;return(e=t?.isFtReduxStore)!==null&&e!==void 0?e:!1}var Ue=Symbol("internalReduxEventsUnsubscribers"),ae=Symbol("internalStoresUnsubscribers"),be=Symbol("internalStores"),ws=nt(Symbol("withRedux"),function(t){var e,r,n;class s extends t{constructor(){super(...arguments),this[e]=new Map,this[r]=new Map,this[n]=new Map}get reduxConstructor(){return this.constructor}willUpdate(a){super.willUpdate(a),[...this.reduxConstructor.reduxReactiveProperties].some(o=>a.has(o))&&this.updateFromStores()}getUnnamedStore(){if(this[be].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[be].values()][0]}getStore(a){return a==null?this.getUnnamedStore():this[be].get(a)}addStore(a,o){var l;o=(l=o??a.name)!==null&&l!==void 0?l:"default-store",this.unsubscribeFromStore(o),this[be].set(o,a),this.subscribeToStore(o,a),this.updateFromStores()}removeStore(a){let o=typeof a=="string"?a:a.name;this.unsubscribeFromStore(o),this[be].delete(o)}setupStores(){this.unsubscribeFromStores(),this[be].forEach((a,o)=>this.subscribeToStore(o,a)),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach((a,o)=>{let l=this.constructor.getPropertyOptions(o);if(!l?.attribute||!this.hasAttribute(typeof l?.attribute=="string"?l.attribute:o)){let c=this.getStore(a.store);c&&(a.store?this[ae].has(a.store):this[ae].size>0)&&(this[o]=a.selector(c.getState(),this))}})}subscribeToStore(a,o){var l;this[ae].set(a,o.subscribe(()=>this.updateFromStores())),this[Ue].set(a,[]),ut(o)&&o.eventBus&&((l=this.reduxConstructor.reduxEventListeners)===null||l===void 0||l.forEach((c,f)=>{if(typeof this[f]=="function"&&(!c.store||o.name===c.store)){let h=p=>this[f](p);o.addEventListener(c.eventName,h),this[Ue].get(a).push(()=>o.removeEventListener(c.eventName,h))}})),this.onStoreAvailable(a)}unsubscribeFromStores(){this[ae].forEach((a,o)=>this.unsubscribeFromStore(o))}unsubscribeFromStore(a){var o;this[ae].has(a)&&this[ae].get(a)(),this[ae].delete(a),(o=this[Ue].get(a))===null||o===void 0||o.forEach(l=>l()),this[Ue].delete(a)}onStoreAvailable(a){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}return e=ae,r=be,n=Ue,s.reduxProperties=new Map,s.reduxReactiveProperties=new Set,s.reduxEventListeners=new Map,s}),gn=class extends ws(J){};function W(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];if(0)var s,i;throw Error("[Immer] minified error nr: "+t+(r.length?" "+r.map(function(a){return"'"+a+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function te(t){return!!t&&!!t[R]}function X(t){var e;return!!t&&(function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var s=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return s===Object||typeof s=="function"&&Function.toString.call(s)===Ds}(t)||Array.isArray(t)||!!t[xn]||!!(!((e=t.constructor)===null||e===void 0)&&e[xn])||Ht(t)||Vt(t))}function Se(t,e,r){r===void 0&&(r=!1),Pe(t)===0?(r?Object.keys:Me)(t).forEach(function(n){r&&typeof n=="symbol"||e(n,t[n],t)}):t.forEach(function(n,s){return e(s,n,t)})}function Pe(t){var e=t[R];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:Ht(t)?2:Vt(t)?3:0}function De(t,e){return Pe(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Os(t,e){return Pe(t)===2?t.get(e):t[e]}function Tn(t,e,r){var n=Pe(t);n===2?t.set(e,r):n===3?t.add(r):t[e]=r}function Cn(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function Ht(t){return Rs&&t instanceof Map}function Vt(t){return Is&&t instanceof Set}function oe(t){return t.o||t.t}function Kt(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=In(t);delete e[R];for(var r=Me(e),n=0;n<r.length;n++){var s=r[n],i=e[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(e[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[s]})}return Object.create(Object.getPrototypeOf(t),e)}function zt(t,e){return e===void 0&&(e=!1),Gt(t)||te(t)||!X(t)||(Pe(t)>1&&(t.set=t.add=t.clear=t.delete=xs),Object.freeze(t),e&&Se(t,function(r,n){return zt(n,!0)},!0)),t}function xs(){W(2)}function Gt(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function Z(t){var e=qt[t];return e||W(18,t),e}function Ts(t,e){qt[t]||(qt[t]=e)}function Ut(){return Be}function kt(t,e){e&&(Z("Patches"),t.u=[],t.s=[],t.v=e)}function ct(t){jt(t),t.p.forEach(Cs),t.p=null}function jt(t){t===Be&&(Be=t.l)}function bn(t){return Be={p:[],l:Be,h:t,m:!0,_:0}}function Cs(t){var e=t[R];e.i===0||e.i===1?e.j():e.g=!0}function Lt(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.O||Z("ES5").S(e,t,n),n?(r[R].P&&(ct(e),W(4)),X(t)&&(t=lt(e,t),e.l||dt(e,t)),e.u&&Z("Patches").M(r[R].t,t,e.u,e.s)):t=lt(e,r,[]),ct(e),e.u&&e.v(e.u,e.s),t!==Rn?t:void 0}function lt(t,e,r){if(Gt(e))return e;var n=e[R];if(!n)return Se(e,function(o,l){return Sn(t,n,e,o,l,r)},!0),e;if(n.A!==t)return e;if(!n.P)return dt(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var s=n.i===4||n.i===5?n.o=Kt(n.k):n.o,i=s,a=!1;n.i===3&&(i=new Set(s),s.clear(),a=!0),Se(i,function(o,l){return Sn(t,n,s,o,l,r,a)}),dt(t,s,!1),r&&t.u&&Z("Patches").N(n,r,t.u,t.s)}return n.o}function Sn(t,e,r,n,s,i,a){if(te(s)){var o=lt(t,s,i&&e&&e.i!==3&&!De(e.R,n)?i.concat(n):void 0);if(Tn(r,n,o),!te(o))return;t.m=!1}else a&&r.add(s);if(X(s)&&!Gt(s)){if(!t.h.D&&t._<1)return;lt(t,s),e&&e.A.l||dt(t,s)}}function dt(t,e,r){r===void 0&&(r=!1),!t.l&&t.h.D&&t.m&&zt(e,r)}function Nt(t,e){var r=t[R];return(r?oe(r):t)[e]}function An(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function ue(t){t.P||(t.P=!0,t.l&&ue(t.l))}function Ft(t){t.o||(t.o=Kt(t.t))}function Bt(t,e,r){var n=Ht(e)?Z("MapSet").F(e,r):Vt(e)?Z("MapSet").T(e,r):t.O?function(s,i){var a=Array.isArray(s),o={i:a?1:0,A:i?i.A:Ut(),P:!1,I:!1,R:{},l:i,t:s,k:null,o:null,j:null,C:!1},l=o,c=qe;a&&(l=[o],c=je);var f=Proxy.revocable(l,c),h=f.revoke,p=f.proxy;return o.k=p,o.j=h,p}(e,r):Z("ES5").J(e,r);return(r?r.A:Ut()).p.push(n),n}function _s(t){return te(t)||W(22,t),function e(r){if(!X(r))return r;var n,s=r[R],i=Pe(r);if(s){if(!s.P&&(s.i<4||!Z("ES5").K(s)))return s.t;s.I=!0,n=En(r,i),s.I=!1}else n=En(r,i);return Se(n,function(a,o){s&&Os(s.t,a)===o||Tn(n,a,e(o))}),i===3?new Set(n):n}(t)}function En(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Kt(t)}function _n(){function t(a,o){var l=i[a];return l?l.enumerable=o:i[a]=l={configurable:!0,enumerable:o,get:function(){var c=this[R];return qe.get(c,a)},set:function(c){var f=this[R];qe.set(f,a,c)}},l}function e(a){for(var o=a.length-1;o>=0;o--){var l=a[o][R];if(!l.P)switch(l.i){case 5:n(l)&&ue(l);break;case 4:r(l)&&ue(l)}}}function r(a){for(var o=a.t,l=a.k,c=Me(l),f=c.length-1;f>=0;f--){var h=c[f];if(h!==R){var p=o[h];if(p===void 0&&!De(o,h))return!0;var g=l[h],y=g&&g[R];if(y?y.t!==p:!Cn(g,p))return!0}}var m=!!o[R];return c.length!==Me(o).length+(m?0:1)}function n(a){var o=a.k;if(o.length!==a.t.length)return!0;var l=Object.getOwnPropertyDescriptor(o,o.length-1);if(l&&!l.get)return!0;for(var c=0;c<o.length;c++)if(!o.hasOwnProperty(c))return!0;return!1}function s(a){a.g&&W(3,JSON.stringify(oe(a)))}var i={};Ts("ES5",{J:function(a,o){var l=Array.isArray(a),c=function(h,p){if(h){for(var g=Array(p.length),y=0;y<p.length;y++)Object.defineProperty(g,""+y,t(y,!0));return g}var m=In(p);delete m[R];for(var S=Me(m),A=0;A<S.length;A++){var E=S[A];m[E]=t(E,h||!!m[E].enumerable)}return Object.create(Object.getPrototypeOf(p),m)}(l,a),f={i:l?5:4,A:o?o.A:Ut(),P:!1,I:!1,R:{},l:o,t:a,k:c,o:null,g:!1,C:!1};return Object.defineProperty(c,R,{value:f,writable:!0}),c},S:function(a,o,l){l?te(o)&&o[R].A===a&&e(a.p):(a.u&&function c(f){if(f&&typeof f=="object"){var h=f[R];if(h){var p=h.t,g=h.k,y=h.R,m=h.i;if(m===4)Se(g,function(x){x!==R&&(p[x]!==void 0||De(p,x)?y[x]||c(g[x]):(y[x]=!0,ue(h)))}),Se(p,function(x){g[x]!==void 0||De(g,x)||(y[x]=!1,ue(h))});else if(m===5){if(n(h)&&(ue(h),y.length=!0),g.length<p.length)for(var S=g.length;S<p.length;S++)y[S]=!1;else for(var A=p.length;A<g.length;A++)y[A]=!0;for(var E=Math.min(g.length,p.length),C=0;C<E;C++)g.hasOwnProperty(C)||(y[C]=!0),y[C]===void 0&&c(g[C])}}}}(a.p[0]),e(a.p))},K:function(a){return a.i===4?r(a):n(a)}})}var wn,Be,$t=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Rs=typeof Map<"u",Is=typeof Set<"u",On=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Rn=$t?Symbol.for("immer-nothing"):((wn={})["immer-nothing"]=!0,wn),xn=$t?Symbol.for("immer-draftable"):"__$immer_draftable",R=$t?Symbol.for("immer-state"):"__$immer_state";var Ds=""+Object.prototype.constructor,Me=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,In=Object.getOwnPropertyDescriptors||function(t){var e={};return Me(t).forEach(function(r){e[r]=Object.getOwnPropertyDescriptor(t,r)}),e},qt={},qe={get:function(t,e){if(e===R)return t;var r=oe(t);if(!De(r,e))return function(s,i,a){var o,l=An(i,a);return l?"value"in l?l.value:(o=l.get)===null||o===void 0?void 0:o.call(s.k):void 0}(t,r,e);var n=r[e];return t.I||!X(n)?n:n===Nt(t.t,e)?(Ft(t),t.o[e]=Bt(t.A.h,n,t)):n},has:function(t,e){return e in oe(t)},ownKeys:function(t){return Reflect.ownKeys(oe(t))},set:function(t,e,r){var n=An(oe(t),e);if(n?.set)return n.set.call(t.k,r),!0;if(!t.P){var s=Nt(oe(t),e),i=s?.[R];if(i&&i.t===r)return t.o[e]=r,t.R[e]=!1,!0;if(Cn(r,s)&&(r!==void 0||De(t.t,e)))return!0;Ft(t),ue(t)}return t.o[e]===r&&(r!==void 0||e in t.o)||Number.isNaN(r)&&Number.isNaN(t.o[e])||(t.o[e]=r,t.R[e]=!0),!0},deleteProperty:function(t,e){return Nt(t.t,e)!==void 0||e in t.t?(t.R[e]=!1,Ft(t),ue(t)):delete t.R[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var r=oe(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{writable:!0,configurable:t.i!==1||e!=="length",enumerable:n.enumerable,value:r[e]}},defineProperty:function(){W(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){W(12)}},je={};Se(qe,function(t,e){je[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}}),je.deleteProperty=function(t,e){return je.set.call(this,t,e,void 0)},je.set=function(t,e,r){return qe.set.call(this,t[0],e,r,t[0])};var Ms=function(){function t(r){var n=this;this.O=On,this.D=!0,this.produce=function(s,i,a){if(typeof s=="function"&&typeof i!="function"){var o=i;i=s;var l=n;return function(m){var S=this;m===void 0&&(m=o);for(var A=arguments.length,E=Array(A>1?A-1:0),C=1;C<A;C++)E[C-1]=arguments[C];return l.produce(m,function(x){var N;return(N=i).call.apply(N,[S,x].concat(E))})}}var c;if(typeof i!="function"&&W(6),a!==void 0&&typeof a!="function"&&W(7),X(s)){var f=bn(n),h=Bt(n,s,void 0),p=!0;try{c=i(h),p=!1}finally{p?ct(f):jt(f)}return typeof Promise<"u"&&c instanceof Promise?c.then(function(m){return kt(f,a),Lt(m,f)},function(m){throw ct(f),m}):(kt(f,a),Lt(c,f))}if(!s||typeof s!="object"){if((c=i(s))===void 0&&(c=s),c===Rn&&(c=void 0),n.D&&zt(c,!0),a){var g=[],y=[];Z("Patches").M(s,c,g,y),a(g,y)}return c}W(21,s)},this.produceWithPatches=function(s,i){if(typeof s=="function")return function(c){for(var f=arguments.length,h=Array(f>1?f-1:0),p=1;p<f;p++)h[p-1]=arguments[p];return n.produceWithPatches(c,function(g){return s.apply(void 0,[g].concat(h))})};var a,o,l=n.produce(s,i,function(c,f){a=c,o=f});return typeof Promise<"u"&&l instanceof Promise?l.then(function(c){return[c,a,o]}):[l,a,o]},typeof r?.useProxies=="boolean"&&this.setUseProxies(r.useProxies),typeof r?.autoFreeze=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var e=t.prototype;return e.createDraft=function(r){X(r)||W(8),te(r)&&(r=_s(r));var n=bn(this),s=Bt(this,r,void 0);return s[R].C=!0,jt(n),s},e.finishDraft=function(r,n){var s=r&&r[R],i=s.A;return kt(i,n),Lt(void 0,i)},e.setAutoFreeze=function(r){this.D=r},e.setUseProxies=function(r){r&&!On&&W(20),this.O=r},e.applyPatches=function(r,n){var s;for(s=n.length-1;s>=0;s--){var i=n[s];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}s>-1&&(n=n.slice(s+1));var a=Z("Patches").$;return te(r)?a(r,n):this.produce(r,function(o){return a(o,n)})},t}(),V=new Ms,Ps=V.produce,lo=V.produceWithPatches.bind(V),fo=V.setAutoFreeze.bind(V),ho=V.setUseProxies.bind(V),po=V.applyPatches.bind(V),yo=V.createDraft.bind(V),mo=V.finishDraft.bind(V),ft=Ps;function Ae(t){"@babel/helpers - typeof";return Ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(t)}function Dn(t,e){if(Ae(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(Ae(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mn(t){var e=Dn(t,"string");return Ae(e)=="symbol"?e:e+""}function Pn(t,e,r){return(e=Mn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Wt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?kn(Object(r),!0).forEach(function(n){Pn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kn(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function B(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var Ln=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Qt=function(){return Math.random().toString(36).substring(7).split("").join(".")},ht={INIT:"@@redux/INIT"+Qt(),REPLACE:"@@redux/REPLACE"+Qt(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Qt()}};function ks(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function Yt(t,e,r){var n;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(B(0));if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(B(1));return r(Yt)(t,e)}if(typeof t!="function")throw new Error(B(2));var s=t,i=e,a=[],o=a,l=!1;function c(){o===a&&(o=a.slice())}function f(){if(l)throw new Error(B(3));return i}function h(m){if(typeof m!="function")throw new Error(B(4));if(l)throw new Error(B(5));var S=!0;return c(),o.push(m),function(){if(S){if(l)throw new Error(B(6));S=!1,c();var E=o.indexOf(m);o.splice(E,1),a=null}}}function p(m){if(!ks(m))throw new Error(B(7));if(typeof m.type>"u")throw new Error(B(8));if(l)throw new Error(B(9));try{l=!0,i=s(i,m)}finally{l=!1}for(var S=a=o,A=0;A<S.length;A++){var E=S[A];E()}return m}function g(m){if(typeof m!="function")throw new Error(B(10));s=m,p({type:ht.REPLACE})}function y(){var m,S=h;return m={subscribe:function(E){if(typeof E!="object"||E===null)throw new Error(B(11));function C(){E.next&&E.next(f())}C();var x=S(C);return{unsubscribe:x}}},m[Ln]=function(){return this},m}return p({type:ht.INIT}),n={dispatch:p,subscribe:h,getState:f,replaceReducer:g},n[Ln]=y,n}function Ls(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:ht.INIT});if(typeof n>"u")throw new Error(B(12));if(typeof r(void 0,{type:ht.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(B(13))})}function Nn(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var s=e[n];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,o;try{Ls(r)}catch(l){o=l}return function(c,f){if(c===void 0&&(c={}),o)throw o;if(0)var h;for(var p=!1,g={},y=0;y<i.length;y++){var m=i[y],S=r[m],A=c[m],E=S(A,f);if(typeof E>"u"){var C=f&&f.type;throw new Error(B(14))}g[m]=E,p=p||E!==A}return p=p||i.length!==Object.keys(c).length,p?g:c}}function ke(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,s){return function(){return n(s.apply(void 0,arguments))}})}function Fn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){return function(){var s=n.apply(void 0,arguments),i=function(){throw new Error(B(15))},a={getState:s.getState,dispatch:function(){return i.apply(void 0,arguments)}},o=e.map(function(l){return l(a)});return i=ke.apply(void 0,o)(s.dispatch),Wt(Wt({},s),{},{dispatch:i})}}}function Un(t){var e=function(n){var s=n.dispatch,i=n.getState;return function(a){return function(o){return typeof o=="function"?o(s,i,t):a(o)}}};return e}var jn=Un();jn.withExtraArgument=Un;var Xt=jn;var Kn=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Ns=function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(f){return l([c,f])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(i=c[0]&2?s.return:c[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,c[1])).done)return i;switch(s=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(f){c=[6,f],s=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},Le=function(t,e){for(var r=0,n=e.length,s=t.length;r<n;r++,s++)t[s]=e[r];return t},Fs=Object.defineProperty,Us=Object.defineProperties,js=Object.getOwnPropertyDescriptors,Bn=Object.getOwnPropertySymbols,Bs=Object.prototype.hasOwnProperty,qs=Object.prototype.propertyIsEnumerable,qn=function(t,e,r){return e in t?Fs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r},ce=function(t,e){for(var r in e||(e={}))Bs.call(e,r)&&qn(t,r,e[r]);if(Bn)for(var n=0,s=Bn(e);n<s.length;n++){var r=s[n];qs.call(e,r)&&qn(t,r,e[r])}return t},Jt=function(t,e){return Us(t,js(e))},Hs=function(t,e,r){return new Promise(function(n,s){var i=function(l){try{o(r.next(l))}catch(c){s(c)}},a=function(l){try{o(r.throw(l))}catch(c){s(c)}},o=function(l){return l.done?n(l.value):Promise.resolve(l.value).then(i,a)};o((r=r.apply(t,e)).next())})};var Vs=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?ke:ke.apply(null,arguments)},ko=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function Ks(t){if(typeof t!="object"||t===null)return!1;var e=Object.getPrototypeOf(t);if(e===null)return!0;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return e===r}var zs=function(t){Kn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,Le([void 0],r[0].concat(this)))):new(e.bind.apply(e,Le([void 0],r.concat(this))))},e}(Array),Gs=function(t){Kn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,Le([void 0],r[0].concat(this)))):new(e.bind.apply(e,Le([void 0],r.concat(this))))},e}(Array);function tr(t){return X(t)?ft(t,function(){}):t}function $s(t){return typeof t=="boolean"}function Ws(){return function(e){return Qs(e)}}function Qs(t){t===void 0&&(t={});var e=t.thunk,r=e===void 0?!0:e,n=t.immutableCheck,s=n===void 0?!0:n,i=t.serializableCheck,a=i===void 0?!0:i,o=new zs;if(r&&($s(r)?o.push(Xt):o.push(Xt.withExtraArgument(r.extraArgument))),0){if(s)var l;if(a)var c}return o}var Zt=!0;function zn(t){var e=Ws(),r=t||{},n=r.reducer,s=n===void 0?void 0:n,i=r.middleware,a=i===void 0?e():i,o=r.devTools,l=o===void 0?!0:o,c=r.preloadedState,f=c===void 0?void 0:c,h=r.enhancers,p=h===void 0?void 0:h,g;if(typeof s=="function")g=s;else if(Ks(s))g=Nn(s);else throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');var y=a;if(typeof y=="function"&&(y=y(e),!Zt&&!Array.isArray(y)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!Zt&&y.some(function(x){return typeof x!="function"}))throw new Error("each middleware provided to configureStore must be a function");var m=Fn.apply(void 0,y),S=ke;l&&(S=Vs(ce({trace:!Zt},typeof l=="object"&&l)));var A=new Gs(m),E=A;Array.isArray(p)?E=Le([m],p):typeof p=="function"&&(E=p(A));var C=S.apply(void 0,E);return Yt(g,f,C)}function le(t,e){function r(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];if(e){var i=e.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return ce(ce({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:n[0]}}return r.toString=function(){return""+t},r.type=t,r.match=function(n){return n.type===t},r}function Gn(t){var e={},r=[],n,s={addCase:function(i,a){var o=typeof i=="string"?i:i.type;if(o in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[o]=a,s},addMatcher:function(i,a){return r.push({matcher:i,reducer:a}),s},addDefaultCase:function(i){return n=i,s}};return t(s),[e,r,n]}function Ys(t){return typeof t=="function"}function Xs(t,e,r,n){r===void 0&&(r=[]);var s=typeof e=="function"?Gn(e):[e,r,n],i=s[0],a=s[1],o=s[2],l;if(Ys(t))l=function(){return tr(t())};else{var c=tr(t);l=function(){return c}}function f(h,p){h===void 0&&(h=l());var g=Le([i[p.type]],a.filter(function(y){var m=y.matcher;return m(p)}).map(function(y){var m=y.reducer;return m}));return g.filter(function(y){return!!y}).length===0&&(g=[o]),g.reduce(function(y,m){if(m)if(te(y)){var S=y,A=m(S,p);return A===void 0?y:A}else{if(X(y))return ft(y,function(E){return m(E,p)});var A=m(y,p);if(A===void 0){if(y===null)return y;throw Error("A case reducer on a non-draftable value must not return undefined")}return A}return y},h)}return f.getInitialState=l,f}function Js(t,e){return t+"/"+e}function $n(t){var e=t.name;if(!e)throw new Error("`name` is a required option for createSlice");typeof process<"u";var r=typeof t.initialState=="function"?t.initialState:tr(t.initialState),n=t.reducers||{},s=Object.keys(n),i={},a={},o={};s.forEach(function(f){var h=n[f],p=Js(e,f),g,y;"reducer"in h?(g=h.reducer,y=h.prepare):g=h,i[f]=g,a[p]=g,o[f]=y?le(p,y):le(p)});function l(){var f=typeof t.extraReducers=="function"?Gn(t.extraReducers):[t.extraReducers],h=f[0],p=h===void 0?{}:h,g=f[1],y=g===void 0?[]:g,m=f[2],S=m===void 0?void 0:m,A=ce(ce({},p),a);return Xs(r,function(E){for(var C in A)E.addCase(C,A[C]);for(var x=0,N=y;x<N.length;x++){var Q=N[x];E.addMatcher(Q.matcher,Q.reducer)}S&&E.addDefaultCase(S)})}var c;return{name:e,reducer:function(f,h){return c||(c=l()),c(f,h)},actions:o,caseReducers:i,getInitialState:function(){return c||(c=l()),c.getInitialState()}}}var Zs="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",ei=function(t){t===void 0&&(t=21);for(var e="",r=t;r--;)e+=Zs[Math.random()*64|0];return e},ti=["name","message","stack","code"],er=function(){function t(e,r){this.payload=e,this.meta=r}return t}(),Hn=function(){function t(e,r){this.payload=e,this.meta=r}return t}(),ri=function(t){if(typeof t=="object"&&t!==null){for(var e={},r=0,n=ti;r<n.length;r++){var s=n[r];typeof t[s]=="string"&&(e[s]=t[s])}return e}return{message:String(t)}},Uo=function(){function t(e,r,n){var s=le(e+"/fulfilled",function(f,h,p,g){return{payload:f,meta:Jt(ce({},g||{}),{arg:p,requestId:h,requestStatus:"fulfilled"})}}),i=le(e+"/pending",function(f,h,p){return{payload:void 0,meta:Jt(ce({},p||{}),{arg:h,requestId:f,requestStatus:"pending"})}}),a=le(e+"/rejected",function(f,h,p,g,y){return{payload:g,error:(n&&n.serializeError||ri)(f||"Rejected"),meta:Jt(ce({},y||{}),{arg:p,requestId:h,rejectedWithValue:!!g,requestStatus:"rejected",aborted:f?.name==="AbortError",condition:f?.name==="ConditionError"})}}),o=!1,l=typeof AbortController<"u"?AbortController:function(){function f(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return f.prototype.abort=function(){},f}();function c(f){return function(h,p,g){var y=n?.idGenerator?n.idGenerator(f):ei(),m=new l,S,A=!1;function E(x){S=x,m.abort()}var C=function(){return Hs(this,null,function(){var x,N,Q,de,q,fe,Ee;return Ns(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),de=(x=n?.condition)==null?void 0:x.call(n,f,{getState:p,extra:g}),si(de)?[4,de]:[3,2];case 1:de=u.sent(),u.label=2;case 2:if(de===!1||m.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return A=!0,q=new Promise(function(d,b){return m.signal.addEventListener("abort",function(){return b({name:"AbortError",message:S||"Aborted"})})}),h(i(y,f,(N=n?.getPendingMeta)==null?void 0:N.call(n,{requestId:y,arg:f},{getState:p,extra:g}))),[4,Promise.race([q,Promise.resolve(r(f,{dispatch:h,getState:p,extra:g,requestId:y,signal:m.signal,abort:E,rejectWithValue:function(d,b){return new er(d,b)},fulfillWithValue:function(d,b){return new Hn(d,b)}})).then(function(d){if(d instanceof er)throw d;return d instanceof Hn?s(d.payload,y,f,d.meta):s(d,y,f)})])];case 3:return Q=u.sent(),[3,5];case 4:return fe=u.sent(),Q=fe instanceof er?a(null,y,f,fe.payload,fe.meta):a(fe,y,f),[3,5];case 5:return Ee=n&&!n.dispatchConditionRejection&&a.match(Q)&&Q.meta.condition,Ee||h(Q),[2,Q]}})})}();return Object.assign(C,{abort:E,requestId:y,arg:f,unwrap:function(){return C.then(ni)}})}}return Object.assign(c,{pending:i,rejected:a,fulfilled:s,typePrefix:e})}return t.withTypes=function(){return t},t}();function ni(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function si(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var Wn="listener",Qn="completed",Yn="cancelled",jo="task-"+Yn,Bo="task-"+Qn,qo=Wn+"-"+Yn,Ho=Wn+"-"+Qn;var rr="listenerMiddleware";var Vo=le(rr+"/add"),Ko=le(rr+"/removeAll"),zo=le(rr+"/remove");var Vn,Go=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis):function(t){return(Vn||(Vn=Promise.resolve())).then(t).catch(function(e){return setTimeout(function(){throw e},0)})},ii=function(t){return function(e){setTimeout(e,t)}},$o=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:ii(10);_n();var ai=nt(Symbol("withEventBus"),function(t,e){return class extends t{constructor(){super(...arguments),this.eventBus=e??document.createElement("span")}addEventListener(r,n,s){this.eventBus.addEventListener(r,n,s)}dispatchEvent(r){return this.eventBus.dispatchEvent(r)}removeEventListener(r,n,s){this.eventBus.removeEventListener(r,n,s)}}}),pt=class extends ai(Object){};window.ftReduxStores||(window.ftReduxStores={});var Xn=class t extends pt{static get(e){var r;let n=typeof e=="string"?e:e.name,s=typeof e=="string"?void 0:e,i=window.ftReduxStores[n];if(ut(i))return i;if(s==null)return;let a=$n({...s,reducers:(r=s.reducers)!==null&&r!==void 0?r:{}}),o=zn({reducer:(l,c)=>c.type==="CLEAR_FT_REDUX_STORE"?a.getInitialState():typeof c.type=="string"&&c.type.startsWith("DEFAULT_VALUE_SETTER__")?{...l,...c.overwrites}:a.reducer(l,c)});return window.ftReduxStores[s.name]=new t(a,o,s.eventBus)}constructor(e,r,n){super(),this.reduxSlice=e,this.reduxStore=r,this.isFtReduxStore=!0,this.commands=new st;let s=i=>i!=null?JSON.parse(JSON.stringify(i)):i;this.actions=new Proxy(this.reduxSlice.actions,{get:(i,a,o)=>{let l=a,c=i[l];return c?(...f)=>{let h=c(...f.map(s));return this.reduxStore.dispatch(h),h}:f=>{this.setState({[l]:s(f)})}}}),this.eventBus=n??this.eventBus}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE"})}setState(e){this.reduxStore.dispatch({type:"DEFAULT_VALUE_SETTER__"+Object.keys(e).join("_"),overwrites:e})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(e){throw new Error("Not implemented yet.")}subscribe(e){return this.reduxStore.subscribe(e)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}};var yt=class{static format(e,r,n,s){return window.moment?window.moment(e).locale(r).format(this.getMomentDateFormat(n,s)):this.getIntlDateTime(e,r,n,s)}static getMomentDateFormat(e,r){return e?r?"lll":"ll":r?"L LT":"L"}static getIntlDateTime(e,r,n,s){let i=typeof e=="string"?new Date(e):e,a=new Intl.DateTimeFormat(r,{dateStyle:n?"medium":"short"}).format(i);if(!s)return a;let o=new Intl.DateTimeFormat(r,{timeStyle:"short"}).format(i);return`${a} ${o}`}static getTimezoneAsString(){let e=n=>String(Math.floor(n)).padStart(2,"0"),r=new Date().getTimezoneOffset();return`${r<0?"+":"-"}${e(Math.abs(r)/60)}:${e(Math.abs(r)%60)}`}};var Jn=O(k()),mt=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},vu=(0,Jn.applyMixinOnce)(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(v)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var s,i;return((i=(s=this.metadataDescriptors.find(o=>o.key===n))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1)?o=>yt.format(o,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return mt([(0,nr.property)({type:Boolean})],e.prototype,"useLongDateFormat",void 0),mt([(0,nr.property)({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),mt([Pt({store:v.name,selector:r=>{var n,s;return(s=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&s!==void 0?s:[]}})],e.prototype,"metadataDescriptors",void 0),mt([Pt({store:v.name})],e.prototype,"uiLocale",void 0),e});var bt=O(k());var vt=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=v.getState().session;return!!e?.sessionAuthenticated}};var gt=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=v.getState().session;return!!e?.sessionAuthenticated}};var oi="ft-user-assets",ui={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(G).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:s}=e.payload;ir(t,r,[...sr(t,r),s]),Zn(t,r,1,n),es(t,s)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;ir(t,r,sr(t,r).map(s=>s.id===n.id?n:s)),es(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:s}=e.payload;ir(t,r,sr(t,r).filter(i=>i.id!==s)),Zn(t,r,-1,n)}},ts={[G.SEARCHES]:"savedSearches",[G.BOOKMARKS]:"bookmarks",[G.BOOKS]:void 0,[G.COLLECTIONS]:void 0},sr=(t,e)=>{var r;let n=ts[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},ir=(t,e,r)=>{let n=ts[e];n&&(t[n]=r)},Zn=(t,e,r,n)=>{let s=t.assetCounts.allAsset[e];if(s!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,s+r),e===G.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},es=(t,e)=>{let r=t.assetLabels.map(s=>s.title),n=e.labels.filter(s=>!r.includes(s)).map(s=>({title:s}));t.assetLabels.push(...n)},K=bt.FtReduxStore.get({name:oi,reducers:ui,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(G).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),ar=class{constructor(e=new vt,r=new gt){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=v.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Xe,this.savedSearchesService=new Ze,v.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=v.getState();(0,bt.deepEqual)((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),K.actions.clearAssetCount(),K.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),K.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),K.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();K.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();K.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&K.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&K.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(K.getState().assetCounts.bookmarkByMap).length!==0;e===G.BOOKMARKS&&r&&K.actions.clearBookmarkCountByMap(),K.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;K.actions.bookmarks(r)}}},or=new ar;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=or);(0,rs.customElement)("ft-app-context")(_);var St=class extends j{constructor(e){super(!0,e),this.cache.registerFinal("search-configuration",async()=>(await this.awaitApi).getSearchConfiguration())}async launchSearch(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters),facets:[...e.facets].sort((n,s)=>n.id.localeCompare(s.id))};return this.cache.get("search-"+this.hash(r),async()=>(await this.awaitApi).search(e),2*60*1e3)}async launchSuggest(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters)};return this.cache.get("suggest-"+this.hash(r),async()=>(await this.awaitApi).getSuggestions(e),2*60*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}async getConfiguration(){return this.cache.get("search-configuration")}sortFilters(e){return e.map(r=>r.valueFilter==null?r:{...r,valueFilter:{...r.valueFilter,values:[...r.valueFilter.values].sort((n,s)=>n.localeCompare(s))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var ci=t=>t.request.virtualField===Te.TITLE_ONLY&&t.request.scope===Ce.DOCUMENTS,li=t=>t.request.keywordMatch==We.MANDATORY,At=class t extends Event{constructor(){super(t.eventName)}};At.eventName="search-context-clear-all-filters";var He=class t{static build(e,r){return new t(Sr(e.trim()||"context"),r)}constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.localesDebouncer=new z.Debouncer(10),this.searchDebouncer=new z.Debouncer(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest(this.store.getState()))),this.buildSearchRequest=n=>({...n.request,facets:this.facetIds.map(s=>({id:s}))}),this.suggestDebouncer=new z.Debouncer(1e3),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest(this.store.getState()))),this.buildSuggestRequest=n=>{var s;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(s=n.request.sort)!==null&&s!==void 0?s:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch}},this.service=r??new St,this.service.cache.addEventListener("clear-cache",n=>{n.detail.clearedKeys.includes("available-locales")&&this.updateLocales()}),this.searchWatcher=(0,z.watch)(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=(0,z.watch)(e,this.buildSuggestRequest,this.launchSuggest)}async initService(){return this.updateLocales(),this.service.getConfiguration().then(e=>{this.store.actions.configuration(e),this.setSortId(this.store.getState().request.sortId)}),this.launchSearch()}setQuery(e){this.store.actions.setRequestQuery(e),this.store.actions.liveQuery(e),this.store.actions.setPageNumber(1)}setContentLocale(e){var r;let n=(r=this.store.getState().locales)!==null&&r!==void 0?r:[],s=this.store.getState().request.contentLocale;if(e!=s){if(n.length>0){let i=a=>n.some(o=>o.lang==a);i(e)||(e=i(s)?s:n[0].lang)}this.store.actions.setRequestContentLocale(e),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([])}return e}forceContentLocale(e){this.store.actions.setRequestContentLocale(e)}setPageSize(e){this.store.actions.setPageSize(e)}setPageNumber(e){this.store.actions.setPageNumber(e)}get sortOptions(){var e,r;return(r=(e=this.store.getState().configuration)===null||e===void 0?void 0:e.sortOptions)!==null&&r!==void 0?r:[]}setSort(e){this.store.actions.setRequestSort(e),this.store.actions.setPageNumber(1)}setSortId(e){var r;if(this.store.actions.setPageNumber(1),e==null||this.sortOptions.length==0)return this.store.actions.setRequestSortId(e),e;let n=(r=this.sortOptions.find(s=>s.id==e))!==null&&r!==void 0?r:this.sortOptions[0];return this.store.actions.setRequestSortId(n.id),n.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.store.actions.setRequestFilters(r),this.store.actions.setPageNumber(1)}setClusterSortCriterion(e){this.store.actions.setRequestClusterSortCriterion(e)}setSearchInDocumentTitlesOnly(e){e?(this.store.actions.setRequestVirtualField(Te.TITLE_ONLY),this.store.actions.setRequestScope(Ce.DOCUMENTS)):(this.store.actions.setRequestVirtualField(Te.EVERYWHERE),this.store.actions.setRequestScope(Ce.DEFAULT))}setKeywordMatch(e){this.store.actions.setKeywordMatch(e)}setVirtualField(e){this.store.actions.setRequestVirtualField(e)}get searchInDocumentTitlesOnly(){return ci(this.store.getState())}get keywordMatch(){return li(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new At)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(s=>s!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(s=>({id:s}));this.store.actions.setRequestFacets(n)}setFilter(e,r){this.setValueFilter(e,r)}setValueFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(a=>!a.valueFilter),...n.filter(a=>a.valueFilter&&a.key!==s.key),s];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,dateFilter:{type:r}},i=[...n.filter(a=>!a.dateFilter),...n.filter(a=>a.dateFilter&&a.key!==s.key),s];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.dateFilter),...r.filter(s=>s.dateFilter&&s.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let s=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},a=[...s.filter(o=>!o.rangeFilter),...s.filter(o=>o.rangeFilter&&o.key!==i.key),i];this.setFilters(a)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.rangeFilter),...r.filter(s=>s.rangeFilter&&s.key!==e)];this.setFilters(n)}setLiveQuery(e){this.store.actions.liveQuery(e)}setRequest(e){this.store.actions.setRequest({...e,facets:this.store.getState().request.facets}),this.store.actions.liveQuery(e.query),this.store.actions.setPageNumber(1)}setScope(e){this.store.actions.setRequestScope(e)}setOtherQueryParams(e){this.store.actions.setOtherQueryParams(e)}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales))}async fetchSearchData(e){var r,n,s,i;try{if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),this.store.actions.paging(void 0),this.ignoreEmptyQuery&&e.query.length==0)this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0);else{this.cancelableSearch=(0,z.cancelable)(this.service.launchSearch(e));let a=await this.cancelableSearch;if(this.store.actions.announcements(a.announcements),a.paging.currentPage<=1)this.store.actions.results(a.results),this.store.actions.facets(a.facets),this.store.actions.spellcheck(a.spellcheck);else{let o=((n=this.store.getState().results)!==null&&n!==void 0?n:[]).concat(a.results);this.store.actions.results(o),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(a.paging.currentPage-1)*((s=e.paging.perPage)!==null&&s!==void 0?s:20)+1}`})}this.store.actions.paging(a.paging)}}catch(a){a instanceof z.CanceledPromiseError||(console.error(a),(i=this.errorHandler)===null||i===void 0||i.call(this,a))}}async fetchSuggestData(e){var r;try{if((r=this.cancelableSuggest)===null||r===void 0||r.cancel(),e.input.length!=0&&e.input.length<3)return;this.cancelableSuggest=(0,z.cancelable)(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof z.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(n)}}clear(){this.store.clear()}clearResults(){this.store.actions.paging(void 0),this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0)}};var di=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},cr=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},ns=Symbol("registerInterval"),ur=Symbol("registerAttempts"),fi=40,hi=(0,Et.applyMixinOnce)(Symbol("toFtSearchComponent"),function(t){class e extends t{setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[ur]=0,this[ns]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[ur]>fi?window.clearInterval(this[ns]):(this[ur]++,this.dispatchEvent(new cr))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return di([(0,is.state)()],e.prototype,"stateManager",void 0),e}),ss=class extends hi(Et.FtLitElementRedux){};var as=O(k());function wt(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function Ot(t){var e,r;return t.dateFilter?{key:t.key,type:"DATE",dateValue:t.dateFilter.type}:t.rangeFilter?{key:t.key,type:"RANGE",from:t.rangeFilter.from,to:t.rangeFilter.to}:{key:t.key,values:(e=t.valueFilter)===null||e===void 0?void 0:e.values,negative:(r=t.valueFilter)===null||r===void 0?void 0:r.negative}}var xt=class{constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.enableAnalyticsEvents=!0,this.appName=void 0,this.appVersion=void 0,this.document=void 0,this.sendEvent=n=>{if(!this.canSendEvent()||!n)return;let s=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(s,n):this.sendDocumentSearchEvent(s,n)},this.eventsService=r??new et,this.resultsWatcher=(0,as.watch)(e,n=>n.results,this.sendEvent)}setEnableAnalyticsEvents(e){this.enableAnalyticsEvents=e}setAppName(e){this.appName=e}setAppVersion(e){this.appVersion=e}setDocumentSearch(e){this.document=e}setDocumentSearchFromMap(e){this.setDocumentSearch(this.convertToAnalyticsMap(e))}initAppInfo(){let{apiIntegrationIdentifier:e,apiIntegrationAppVersion:r}=v.getState();this.setAppName(e??"unknown"),this.setAppVersion(r??"unknown")}convertToAnalyticsMap(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}canSendEvent(){if(this.appName==null||this.appVersion==null)return console.debug("ft-search-context.eventManager is not initialized. No events will be sent!"),!1;let{editorMode:e}=v.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r){let n={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:wt(e.metadataFilters),facets:e.metadataFilters.map(s=>Ot(s))}};this.eventsService.sendKhubSearchEvent(n)}sendDocumentSearchEvent(e,r){if(e.metadataFilters.find(s=>{var i;return s.key==="ft:publicationId"&&((i=s.valueFilter)===null||i===void 0?void 0:i.values[0])===this.document.id})!==void 0){let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(s)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==se.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:wt(n.metadataFilters),facets:n.metadataFilters.map(a=>Ot(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==se.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:wt(n.metadataFilters),facets:n.metadataFilters.map(a=>Ot(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case se.MAP:return{id:e.map.mapId,title:e.map.title,type:xe.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case se.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:xe.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case se.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:xe.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r,n,s,i,a;return(i=(n=(r=e.map)===null||r===void 0?void 0:r.originUrl)!==null&&n!==void 0?n:(s=e.topic)===null||s===void 0?void 0:s.originUrl)!==null&&i!==void 0?i:(a=e.document)===null||a===void 0?void 0:a.originUrl}};var L=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},lr=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},dr=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},fr=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n}})}},I=class extends H.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=He.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=r=>this.handleLoadError(r),this.addStore(this.stateManager.store,"search")}return this._stateManager}get eventManager(){return this._eventManager==null&&(this._eventManager=new xt(this.stateManager.store)),this._eventManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.otherQueryParams={},this.addStore(v)}render(){return os.html`
7
7
  <slot @register-ft-search-component=${this.registerComponent} @ft-search-result-click=${this.onResultClicked}
8
8
  @ft-search-result-open-context-menu=${this.onResultContextMenuOpened}></slot>
9
9
  `}willUpdate(e){super.willUpdate(e),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.forceContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sortId")&&this.stateManager.setSortId(this.sortId),e.has("sort")&&this.sort!==void 0&&this.stateManager.setSort(this.sort),e.has("pageSize")&&this.pageSize!==void 0&&this.stateManager.setPageSize(this.pageSize),e.has("searchInDocumentTitlesOnly")&&this.searchInDocumentTitlesOnly!==void 0&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),e.has("keywordMatch")&&this.stateManager.setKeywordMatch(this.keywordMatch),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),e.has("ignoreEmptyQuery")&&this.ignoreEmptyQuery!==void 0&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),e.has("openExternalDocumentInNewTab")&&this.openExternalDocumentInNewTab!==void 0&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("otherQueryParams")&&this.otherQueryParams!==void 0&&this.stateManager.setOtherQueryParams(this.otherQueryParams),e.has("session")&&this.session!==void 0&&e.get("session")!=null&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.clearResults(),this.stateManager.setQuery(this.query),this.stateManager.forceContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSortId(this.sortId),this.stateManager.setSort(this.sort),this.stateManager.setOtherQueryParams(this.otherQueryParams)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new dr(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new fr(this.request,this.paging,this.autocorrect))}registerComponent(e){e.stopPropagation();let r=e.composedPath()[0];this.register(r)}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new lr(e))}reloadSavedSearches(){or.clearMySearches()}clear(){this.stateManager.clear()}onResultClicked(e){this.eventManager.sendResultClickedEvent(e.detail.result,e.detail.rank)}onResultContextMenuOpened(e){this.eventManager.sendResultContextMenuOpenedEvent(e.detail.result,e.detail.rank)}};I.elementDefinitions={};I.styles=br;L([(0,H.redux)({store:v.name})],I.prototype,"session",void 0);L([(0,ee.property)()],I.prototype,"query",void 0);L([(0,ee.property)()],I.prototype,"contentLocale",void 0);L([(0,H.numberProperty)()],I.prototype,"pageSize",void 0);L([(0,ee.property)({type:Boolean})],I.prototype,"searchInDocumentTitlesOnly",void 0);L([(0,ee.property)()],I.prototype,"keywordMatch",void 0);L([(0,ee.property)()],I.prototype,"scope",void 0);L([(0,ee.property)()],I.prototype,"virtualField",void 0);L([(0,ee.property)({type:Boolean})],I.prototype,"ignoreEmptyQuery",void 0);L([(0,H.redux)({store:v.name})],I.prototype,"openExternalDocumentInNewTab",void 0);L([(0,H.jsonProperty)([])],I.prototype,"filters",void 0);L([(0,ee.property)()],I.prototype,"sortId",void 0);L([(0,H.jsonProperty)([])],I.prototype,"sort",void 0);L([(0,H.jsonProperty)({})],I.prototype,"otherQueryParams",void 0);L([(0,H.redux)({store:"search"})],I.prototype,"request",void 0);L([(0,H.redux)({store:"search"})],I.prototype,"paging",void 0);L([(0,H.redux)({store:"search",selector:t=>t.spellcheck})],I.prototype,"autocorrect",void 0);L([(0,ee.property)({attribute:!1})],I.prototype,"searchServiceProvider",void 0);(0,us.customElement)("ft-search-context")(I);})();
@@ -86,7 +86,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:o.extend("--ftds-con
86
86
  `;var Tu={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)=>{var r;let n=+((r=e.payload)!==null&&r!==void 0?r:20);t.request.paging.perPage=isNaN(n)?20:Je(1,n,1e3)},setPageNumber:(t,e)=>{t.request.paging.page=isNaN(e.payload)?1:Math.max(1,e.payload)},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestSortId:(t,e)=>{t.request.sortId=e.payload},setRequestFilters:(t,e)=>{t.request.metadataFilters=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},setOtherQueryParams:(t,e)=>{t.request.otherQueryParams=e.payload},setRequestClusterSortCriterion:(t,e)=>{var r;t.request.clusterSortCriterions=(r=e.payload)!==null&&r!==void 0?r:[]},setKeywordMatch:(t,e)=>{t.request.keywordMatch=e.payload}},hc=t=>Le.get({name:"ft-search-"+t,initialState:{request:{query:"",clusterSortCriterions:[],metadataFilters:[],facets:[],sort:[],sortId:void 0,paging:{page:1,perPage:20},keywordMatch:void 0},liveQuery:"",paging:void 0,facets:void 0,spellcheck:void 0,locales:[],results:void 0,announcements:void 0,suggestResults:void 0,configuration:void 0},reducers:Tu});var mc=j`
87
87
  `;var _u="ft-app-info",pt=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};pt.eventName="authentication-change";var Lu={session:(t,e)=>{oe(t.session,e.payload)||(t.session=e.payload,setTimeout(()=>R.dispatchEvent(new pt(e.payload)),0))}},R=Le.get({name:_u,reducers:Lu,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1}});var ft=class t{static get(e){let{baseUrl:r,apiIntegrationIdentifier:n}=R.getState(),a=e??n;if(r&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,a,!0)}static await(e){return new Promise(r=>{let n=t.get(e);if(n)r(n);else{let a=R.subscribe(()=>{n=t.get(e),n&&(a(),r(n))})}})}};var Xr=class{constructor(e){this.overrideApi=e}get api(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:ft.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):ft.await()}};var X=class extends Xr{constructor(e=!0,r){var n;super(r),this.sortObjectFields=(i,s)=>typeof s!="object"||s==null||Array.isArray(s)?s:Object.fromEntries(Object.entries(s).sort(([l],[d])=>l.localeCompare(d)));let a=this.constructor;a.commonCache=(n=a.commonCache)!==null&&n!==void 0?n:new ve,this.cache=e?a.commonCache:new ve}clearCache(){this.cache.clearAll()}hash(e){return String(Array.from(JSON.stringify(e,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var eo=class extends X{async listMyBookmarks(){let e=R.getState().session;return e?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(e.profile.userId),5*60*1e3):[]}};var ca=class{addCommand(e,r=!1){R.commands.add(e,r)}consumeCommand(e){return R.commands.consume(e)}};window.FluidTopicsAppInfoStoreService=new ca;var gc,zt=class extends CustomEvent{constructor(e){super("ft-i18n-context-loaded",{detail:e})}},Pu=Symbol("clearAfterUnitTest"),to=class extends Pr(X){constructor(e){super(),this.messageContextProvider=e,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[gc]=()=>{this.defaultMessages={},this.cache=new ve,this.listeners={}},this.currentUiLocale=R.getState().uiLocale,R.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:e}=R.getState();this.currentUiLocale!==e&&(this.currentUiLocale=e,this.cache.clearAll(),this.notifyAll())}addContext(e){let r=e.name.toLowerCase();this.cache.setFinal(r,e),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(e,r){var n;if(e=e.toLowerCase(),r&&Object.keys(r).length>0){let a={...(n=this.defaultMessages[e])!==null&&n!==void 0?n:{},...r};oe(this.defaultMessages[e],a)||(this.defaultMessages[e]=a,await this.notify(e))}return this.fetchContext(e)}resolveContext(e){var r,n;return this.fetchContext(e),(n=(r=this.cache.getNow(e))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(e,r){let n=e.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(e,r,...n){var a;let i=e.toLowerCase(),s=this.resolveContext(i);return new dr((a=this.defaultMessages[i])!==null&&a!==void 0?a:{},s).resolve(r,...n)}async fetchContext(e){let r=!this.cache.has(e),n;try{n=await this.cache.get(e,()=>this.messageContextProvider(this.currentUiLocale,e)),r&&await this.notify(e)}catch(a){!(a instanceof xe)&&r&&console.error(a)}return n}subscribe(e,r){var n;return e=e.toLowerCase(),this.listeners[e]=(n=this.listeners[e])!==null&&n!==void 0?n:new Set,this.listeners[e].add(r),()=>{var a;return(a=this.listeners[e])===null||a===void 0?void 0:a.delete(r)}}async notifyAll(){let e=Object.keys(this.listeners);document.body.dispatchEvent(new zt({loadedContexts:e})),this.dispatchEvent(new zt({loadedContexts:e})),await Promise.all(e.map(r=>this.notify(r,!1)))}async notify(e,r=!0){r&&(document.body.dispatchEvent(new zt({loadedContexts:[e]})),this.dispatchEvent(new zt({loadedContexts:[e]}))),this.listeners[e]!=null&&await Promise.all([...this.listeners[e].values()].map(n=>Lr(0).then(()=>n()).catch(()=>null)))}};gc=Pu;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends to{constructor(){super(async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends to{constructor(){super(async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e))}});var yc=window.FluidTopicsI18nService,E0=window.FluidTopicsCustomI18nService;var la=class{highlightHtml(e,r,n){yn(e,r,n)}};window.FluidTopicsHighlightHtmlService=new la;var ro=class extends X{async listMySearches(){let{session:e}=R.getState();return ac(e,G.SAVED_SEARCH_USER)?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(e.profile.userId),5*60*1e3):[]}};var da=class{isDate(e){var r,n,a,i;return(i=(a=((n=(r=R.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&n!==void 0?n:[]).find(l=>l.key===e))===null||a===void 0?void 0:a.date)!==null&&i!==void 0?i:!1}format(e,r){var n,a,i;return lt.format(e,(n=r?.locale)!==null&&n!==void 0?n:R.getState().uiLocale,(a=r?.longFormat)!==null&&a!==void 0?a:!1,(i=r?.withTime)!==null&&i!==void 0?i:!1)}};window.FluidTopicsDateService=new da;var yr=class{static get(e,r){var n,a;let i=R.getState(),{lang:s,region:l}=(a=(n=i.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&a!==void 0?a:{lang:"en",region:"US"};return new Wt(i.baseUrl,e??20,i.searchInAllLanguagesAllowed,r??`${s}-${l}`)}};var oo=class extends X{async sendDocumentStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.start_display event")}async sendTopicStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.start_display event")}async sendKhubSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send khub.search event")}async sendDocumentSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.search event")}async sendSearchPageSelectEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_page.select event")}async sendSearchResultOpenContextMenuEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_result.open_context_menu event")}sortEventArrays(e){let r=Object.entries(e).map(([n,a])=>Array.isArray(a)?[n,a.map(i=>typeof i=="object"&&i!=null&&!Array.isArray(i)?this.sortEventArrays(i):i).sort((i,s)=>typeof i=="object"&&i!==null&&"key"in i?i.key.localeCompare(s.key):typeof i=="string"&&typeof s=="string"?i.localeCompare(s):String(i).localeCompare(String(s)))]:typeof a=="object"&&a!==null?[n,this.sortEventArrays(a)]:[n,a]);return Object.fromEntries(r)}sendEvents(e,r){let n="anything not undefined";return this.cache.get("analytics-event-"+this.hash(e),async()=>(await this.awaitApi).sendEvents(e).then(()=>n).catch(a=>(console.info(r),console.debug(a),n)),1e3)}};var ua=class{urlToSearchRequest(e){return yr.get().parse(e)}searchRequestToUrl(e){return yr.get().serialize(e)}};window.FluidTopicsUrlService=new ua;var ht=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{currentItem:e}})}};ht.eventName="change";var pa=class{itemName(e){return`fluid-topics-history-item-${e}`}get(e){let r=sessionStorage.getItem(this.itemName(e));return r?JSON.parse(r):void 0}set(e,r){sessionStorage.setItem(this.itemName(e),JSON.stringify(r))}},bc=new pa;var no=class t extends Re{static build(){return new t(window.history,bc,()=>window.location,!1)}constructor(e,r,n,a){var i,s;super(),this.history=e,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=e.pushState,this.realReplaceState=e.replaceState,this.initialIndex=(s=(i=e.state)===null||i===void 0?void 0:i.index)!==null&&s!==void 0?s:e.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(a)}setCurrentState(e,r=!1){let n=r&&this.currentIndex===e.index-1;this.currentState={...this.buildCurrentState(),...e},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),oe(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new ht(this.currentItem())),0)}installProxies(){let e=r=>(n,a,[i,s,l])=>{let d=r(),p={...d===this.currentIndex?this.currentState:void 0,...i,index:d,href:typeof l=="string"?l:(l??this.windowLocation()).href};n.apply(a,[p,s,l]),this.setCurrentState(p,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:e(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:e(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",e=>this.setCurrentState(e.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(e){for(let r=this.history.length-1;r>=0;r--)e?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(e){var r;let n={...this.buildCurrentState(),...e,index:this.currentIndex,title:(r=e?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(e){this.addEventListener(ht.eventName,e)}removeHistoryChangeListener(e){this.removeEventListener(ht.eventName,e)}currentItem(){return Jt(this.currentState)}back(){let e=this.previousDifferentMajorPosition();e>=0?this.history.go(e-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return Jt(this.states[this.previousDifferentMajorPosition()])}previousDifferentMajorPosition(){let e=this.currentIndex>0?this.currentIndex-1:0;for(;e>0&&!this.isDifferentMajorState(e);)e--;return e}forward(){let e=this.nextMajorPosition();e&&e<this.states.length?this.history.go(e-this.currentIndex):this.history.forward()}forwardItem(){let e=this.nextMajorPosition();if(e)return Jt(this.states[e])}nextMajorPosition(){let e=this.currentIndex;if(!(e>=this.states.length)){do e++;while(e<this.states.length&&!this.isDifferentMajorState(e));return this.getHigherPositionInTheSameState(e)}}getHigherPositionInTheSameState(e){var r;let n=(r=this.states[e])===null||r===void 0?void 0:r.majorStateId;if(!n)return e;let a=e,i=e+1;for(;this.states.length>i&&!this.isDifferentMajorState(i,n);)this.hasState(i)&&(a=i),i++;return a}buildCurrentState(){var e,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(e=this.history.state)===null||e===void 0?void 0:e.title)!==null&&r!==void 0?r:document.title}}hasState(e){return this.states[e]!=null}isDifferentMajorState(e,r){var n;if(!this.hasState(e))return!1;let a=r??this.currentState.majorStateId,i=(n=this.states[e])===null||n===void 0?void 0:n.majorStateId;return i==null||i!=a}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=no.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),addHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(t),removeHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(t)});var xc=R;function vc(t,e){var r;return xc.getState().authenticationRequired&&!(!((r=xc.getState().session)===null||r===void 0)&&r.sessionAuthenticated)?Promise.resolve(e):t()}var V=function(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},W=class extends te{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.apiIntegrationAppVersion="ft-integration-app-version",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=()=>ft.get(),this.authenticationRequired=!1,this.messageContexts=[],this.cache=new ve,this.cleanSessionDebouncer=new fe,this.reloadConfiguration=()=>{this.cache.clear("availableContentLocales"),this.updateAvailableContentLocales()}}render(){return ye`
88
88
  <slot></slot>
89
- `}connectedCallback(){super.connectedCallback(),R.addEventListener(pt.eventName,this.reloadConfiguration)}disconnectedCallback(){R.addEventListener(pt.eventName,this.reloadConfiguration),super.disconnectedCallback()}update(e){var r,n,a,i,s,l,d;super.update(e),e.has("baseUrl")&&(R.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),e.has("apiIntegrationIdentifier")&&R.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&R.actions.apiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&R.actions.uiLocale(this.uiLocale),e.has("metadataConfiguration")&&R.actions.metadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&R.actions.noCustom(this.noCustom),e.has("editorMode")&&R.actions.editorMode(this.editorMode),e.has("noCustomComponent")&&R.actions.noCustomComponent(this.noCustomComponent),e.has("session")&&R.actions.session(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(p=>yc.addContext(p)),e.has("openExternalDocumentInNewTab")&&R.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&R.actions.navigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&R.actions.forcedOffline(this.forcedOffline),e.has("localesConfiguration")&&(R.actions.defaultLocales((r=this.localesConfiguration)===null||r===void 0?void 0:r.defaultLocales),R.actions.availableUiLocales((a=(n=this.localesConfiguration)===null||n===void 0?void 0:n.availableUiLocales)!==null&&a!==void 0?a:[]),R.actions.searchInAllLanguagesAllowed((s=(i=this.localesConfiguration)===null||i===void 0?void 0:i.allLanguagesAllowed)!==null&&s!==void 0?s:!1)),e.has("authenticationRequired")&&R.actions.authenticationRequired(this.authenticationRequired),e.has("availableContentLocales")&&R.actions.availableContentLocales((d=(l=this.availableContentLocales)===null||l===void 0?void 0:l.contentLocales)!==null&&d!==void 0?d:[]),setTimeout(()=>this.updateIfNeeded())}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.session==null&&this.updateSession(),this.metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),this.availableContentLocales==null&&this.updateAvailableContentLocales())}async updateSession(){this.session=await this.cache.get("session",async()=>{let e=await this.apiProvider().getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.session=void 0},e.idleTimeoutInMillis),e})}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration())}async updateLocalesConfiguration(){this.localesConfiguration=await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration())}async updateAvailableContentLocales(){this.availableContentLocales=await this.cache.get("availableContentLocales",()=>vc(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}))}};W.elementDefinitions={};W.styles=mc;V([T()],W.prototype,"baseUrl",void 0);V([T()],W.prototype,"apiIntegrationIdentifier",void 0);V([T()],W.prototype,"apiIntegrationAppVersion",void 0);V([T()],W.prototype,"uiLocale",void 0);V([ce(null)],W.prototype,"availableUiLocales",void 0);V([ce(null)],W.prototype,"metadataConfiguration",void 0);V([T({type:Boolean})],W.prototype,"editorMode",void 0);V([T({type:Boolean})],W.prototype,"noCustom",void 0);V([T({type:Boolean})],W.prototype,"openExternalDocumentInNewTab",void 0);V([T({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],W.prototype,"noCustomComponent",void 0);V([T({type:Boolean})],W.prototype,"withManualResources",void 0);V([T({type:Boolean})],W.prototype,"navigatorOnline",void 0);V([T({type:Boolean})],W.prototype,"forcedOffline",void 0);V([T({type:Object})],W.prototype,"apiProvider",void 0);V([T({type:Boolean})],W.prototype,"authenticationRequired",void 0);V([ce([])],W.prototype,"messageContexts",void 0);V([ce(void 0)],W.prototype,"session",void 0);V([ee()],W.prototype,"localesConfiguration",void 0);V([ee()],W.prototype,"availableContentLocales",void 0);var ao=function(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},Rv=q(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(R)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var a,i;return((i=(a=this.metadataDescriptors.find(l=>l.key===n))===null||a===void 0?void 0:a.date)!==null&&i!==void 0?i:!1)?l=>lt.format(l,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return ao([T({type:Boolean})],e.prototype,"useLongDateFormat",void 0),ao([T({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),ao([Ee({store:R.name,selector:r=>{var n,a;return(a=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&a!==void 0?a:[]}})],e.prototype,"metadataDescriptors",void 0),ao([Ee({store:R.name})],e.prototype,"uiLocale",void 0),e});var io=class extends X{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=R.getState().session;return!!e?.sessionAuthenticated}};var so=class extends X{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=R.getState().session;return!!e?.sessionAuthenticated}};var ku="ft-user-assets",Fu={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(de).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:a}=e.payload;ha(t,r,[...fa(t,r),a]),Sc(t,r,1,n),Oc(t,a)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;ha(t,r,fa(t,r).map(a=>a.id===n.id?n:a)),Oc(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:a}=e.payload;ha(t,r,fa(t,r).filter(i=>i.id!==a)),Sc(t,r,-1,n)}},Ec={[de.SEARCHES]:"savedSearches",[de.BOOKMARKS]:"bookmarks",[de.BOOKS]:void 0,[de.COLLECTIONS]:void 0},fa=(t,e)=>{var r;let n=Ec[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},ha=(t,e,r)=>{let n=Ec[e];n&&(t[n]=r)},Sc=(t,e,r,n)=>{let a=t.assetCounts.allAsset[e];if(a!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,a+r),e===de.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},Oc=(t,e)=>{let r=t.assetLabels.map(a=>a.title),n=e.labels.filter(a=>!r.includes(a)).map(a=>({title:a}));t.assetLabels.push(...n)},ie=Le.get({name:ku,reducers:Fu,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(de).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),ma=class{constructor(e=new io,r=new so){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=R.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new eo,this.savedSearchesService=new ro,R.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=R.getState();oe((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),ie.actions.clearAssetCount(),ie.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),ie.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),ie.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();ie.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();ie.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&ie.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&ie.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(ie.getState().assetCounts.bookmarkByMap).length!==0;e===de.BOOKMARKS&&r&&ie.actions.clearBookmarkCountByMap(),ie.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;ie.actions.bookmarks(r)}}},ga=new ma;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=ga);tr("ft-app-context")(W);var co=class extends X{constructor(e){super(!0,e),this.cache.registerFinal("search-configuration",async()=>(await this.awaitApi).getSearchConfiguration())}async launchSearch(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters),facets:[...e.facets].sort((n,a)=>n.id.localeCompare(a.id))};return this.cache.get("search-"+this.hash(r),async()=>(await this.awaitApi).search(e),2*60*1e3)}async launchSuggest(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters)};return this.cache.get("suggest-"+this.hash(r),async()=>(await this.awaitApi).getSuggestions(e),2*60*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}async getConfiguration(){return this.cache.get("search-configuration")}sortFilters(e){return e.map(r=>r.valueFilter==null?r:{...r,valueFilter:{...r.valueFilter,values:[...r.valueFilter.values].sort((n,a)=>n.localeCompare(a))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var Mu=t=>t.request.virtualField===ct.TITLE_ONLY&&t.request.scope===Bt.DOCUMENTS,Du=t=>t.request.keywordMatch==$e.MANDATORY,lo=class t extends Event{constructor(){super(t.eventName)}};lo.eventName="search-context-clear-all-filters";var br=class t{static build(e,r){return new t(hc(e.trim()||"context"),r)}constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.localesDebouncer=new fe(10),this.searchDebouncer=new fe(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest(this.store.getState()))),this.buildSearchRequest=n=>({...n.request,facets:this.facetIds.map(a=>({id:a}))}),this.suggestDebouncer=new fe(300),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest(this.store.getState()))),this.buildSuggestRequest=n=>{var a;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(a=n.request.sort)!==null&&a!==void 0?a:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch}},this.service=r??new co,this.service.cache.addEventListener("clear-cache",n=>{n.detail.clearedKeys.includes("available-locales")&&this.updateLocales()}),this.searchWatcher=Ft(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=Ft(e,this.buildSuggestRequest,this.launchSuggest)}async initService(){return this.updateLocales(),this.service.getConfiguration().then(e=>{this.store.actions.configuration(e),this.setSortId(this.store.getState().request.sortId)}),this.launchSearch()}setQuery(e){this.store.actions.setRequestQuery(e),this.store.actions.liveQuery(e),this.store.actions.setPageNumber(1)}setContentLocale(e){var r;let n=(r=this.store.getState().locales)!==null&&r!==void 0?r:[],a=this.store.getState().request.contentLocale;if(e!=a){if(n.length>0){let i=s=>n.some(l=>l.lang==s);i(e)||(e=i(a)?a:n[0].lang)}this.store.actions.setRequestContentLocale(e),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([])}return e}forceContentLocale(e){this.store.actions.setRequestContentLocale(e)}setPageSize(e){this.store.actions.setPageSize(e)}setPageNumber(e){this.store.actions.setPageNumber(e)}get sortOptions(){var e,r;return(r=(e=this.store.getState().configuration)===null||e===void 0?void 0:e.sortOptions)!==null&&r!==void 0?r:[]}setSort(e){this.store.actions.setRequestSort(e),this.store.actions.setPageNumber(1)}setSortId(e){var r;if(this.store.actions.setPageNumber(1),e==null||this.sortOptions.length==0)return this.store.actions.setRequestSortId(e),e;let n=(r=this.sortOptions.find(a=>a.id==e))!==null&&r!==void 0?r:this.sortOptions[0];return this.store.actions.setRequestSortId(n.id),n.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.store.actions.setRequestFilters(r),this.store.actions.setPageNumber(1)}setClusterSortCriterion(e){this.store.actions.setRequestClusterSortCriterion(e)}setSearchInDocumentTitlesOnly(e){e?(this.store.actions.setRequestVirtualField(ct.TITLE_ONLY),this.store.actions.setRequestScope(Bt.DOCUMENTS)):(this.store.actions.setRequestVirtualField(ct.EVERYWHERE),this.store.actions.setRequestScope(Bt.DEFAULT))}setKeywordMatch(e){this.store.actions.setKeywordMatch(e)}setVirtualField(e){this.store.actions.setRequestVirtualField(e)}get searchInDocumentTitlesOnly(){return Mu(this.store.getState())}get keywordMatch(){return Du(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new lo)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(a=>a!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(a=>({id:a}));this.store.actions.setRequestFacets(n)}setFilter(e,r){this.setValueFilter(e,r)}setValueFilter(e,r){let n=this.store.getState().request.metadataFilters,a={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(s=>!s.valueFilter),...n.filter(s=>s.valueFilter&&s.key!==a.key),a];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,a={key:e,dateFilter:{type:r}},i=[...n.filter(s=>!s.dateFilter),...n.filter(s=>s.dateFilter&&s.key!==a.key),a];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(a=>!a.dateFilter),...r.filter(a=>a.dateFilter&&a.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let a=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},s=[...a.filter(l=>!l.rangeFilter),...a.filter(l=>l.rangeFilter&&l.key!==i.key),i];this.setFilters(s)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(a=>!a.rangeFilter),...r.filter(a=>a.rangeFilter&&a.key!==e)];this.setFilters(n)}setLiveQuery(e){this.store.actions.liveQuery(e)}setRequest(e){this.store.actions.setRequest({...e,facets:this.store.getState().request.facets}),this.store.actions.liveQuery(e.query),this.store.actions.setPageNumber(1)}setScope(e){this.store.actions.setRequestScope(e)}setOtherQueryParams(e){this.store.actions.setOtherQueryParams(e)}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales))}async fetchSearchData(e){var r,n,a,i;try{if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),this.store.actions.paging(void 0),this.ignoreEmptyQuery&&e.query.length==0)this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0);else{this.cancelableSearch=vt(this.service.launchSearch(e));let s=await this.cancelableSearch;if(this.store.actions.announcements(s.announcements),s.paging.currentPage<=1)this.store.actions.results(s.results),this.store.actions.facets(s.facets),this.store.actions.spellcheck(s.spellcheck);else{let l=((n=this.store.getState().results)!==null&&n!==void 0?n:[]).concat(s.results);this.store.actions.results(l),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(s.paging.currentPage-1)*((a=e.paging.perPage)!==null&&a!==void 0?a:20)+1}`})}this.store.actions.paging(s.paging)}}catch(s){s instanceof xe||(console.error(s),(i=this.errorHandler)===null||i===void 0||i.call(this,s))}}async fetchSuggestData(e){var r;try{(r=this.cancelableSuggest)===null||r===void 0||r.cancel(),this.cancelableSuggest=vt(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof xe)&&this.errorHandler&&this.errorHandler(n)}}clear(){this.store.clear()}clearResults(){this.store.actions.paging(void 0),this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0)}};var Uu=function(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},ba=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},Cc=Symbol("registerInterval"),ya=Symbol("registerAttempts"),Bu=40,Wu=q(Symbol("toFtSearchComponent"),function(t){class e extends t{setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[ya]=0,this[Cc]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[ya]>Bu?window.clearInterval(this[Cc]):(this[ya]++,this.dispatchEvent(new ba))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return Uu([ee()],e.prototype,"stateManager",void 0),e}),wc=class extends Wu(nt){};function uo(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function po(t){var e,r;return t.dateFilter?{key:t.key,type:"DATE",dateValue:t.dateFilter.type}:t.rangeFilter?{key:t.key,type:"RANGE",from:t.rangeFilter.from,to:t.rangeFilter.to}:{key:t.key,values:(e=t.valueFilter)===null||e===void 0?void 0:e.values,negative:(r=t.valueFilter)===null||r===void 0?void 0:r.negative}}var fo=class{constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.enableAnalyticsEvents=!0,this.appName=void 0,this.appVersion=void 0,this.document=void 0,this.sendEvent=n=>{if(!this.canSendEvent()||!n)return;let a=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(a,n):this.sendDocumentSearchEvent(a,n)},this.eventsService=r??new oo,this.resultsWatcher=Ft(e,n=>n.results,this.sendEvent)}setEnableAnalyticsEvents(e){this.enableAnalyticsEvents=e}setAppName(e){this.appName=e}setAppVersion(e){this.appVersion=e}setDocumentSearch(e){this.document=e}setDocumentSearchFromMap(e){this.setDocumentSearch(this.convertToAnalyticsMap(e))}initAppInfo(){let{apiIntegrationIdentifier:e,apiIntegrationAppVersion:r}=R.getState();this.setAppName(e??"unknown"),this.setAppVersion(r??"unknown")}convertToAnalyticsMap(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}canSendEvent(){if(this.appName==null||this.appVersion==null)return console.debug("ft-search-context.eventManager is not initialized. No events will be sent!"),!1;let{editorMode:e}=R.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r){let n={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:uo(e.metadataFilters),facets:e.metadataFilters.map(a=>po(a))}};this.eventsService.sendKhubSearchEvent(n)}sendDocumentSearchEvent(e,r){if(e.metadataFilters.find(a=>{var i;return a.key==="ft:publicationId"&&((i=a.valueFilter)===null||i===void 0?void 0:i.values[0])===this.document.id})!==void 0){let a={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(a)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,a;e.type==je.TOPIC&&(a={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:uo(n.metadataFilters),facets:n.metadataFilters.map(s=>po(s))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:a},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,a;e.type==je.TOPIC&&(a={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:uo(n.metadataFilters),facets:n.metadataFilters.map(s=>po(s))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:a},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case je.MAP:return{id:e.map.mapId,title:e.map.title,type:Dt.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case je.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:Dt.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case je.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:Dt.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r,n,a,i,s;return(i=(n=(r=e.map)===null||r===void 0?void 0:r.originUrl)!==null&&n!==void 0?n:(a=e.topic)===null||a===void 0?void 0:a.originUrl)!==null&&i!==void 0?i:(s=e.document)===null||s===void 0?void 0:s.originUrl}};var K=function(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},xa=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},va=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},Sa=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n}})}},$=class extends nt{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=br.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=r=>this.handleLoadError(r),this.addStore(this.stateManager.store,"search")}return this._stateManager}get eventManager(){return this._eventManager==null&&(this._eventManager=new fo(this.stateManager.store)),this._eventManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.otherQueryParams={},this.addStore(R)}render(){return ye`
89
+ `}connectedCallback(){super.connectedCallback(),R.addEventListener(pt.eventName,this.reloadConfiguration)}disconnectedCallback(){R.addEventListener(pt.eventName,this.reloadConfiguration),super.disconnectedCallback()}update(e){var r,n,a,i,s,l,d;super.update(e),e.has("baseUrl")&&(R.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),e.has("apiIntegrationIdentifier")&&R.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&R.actions.apiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&R.actions.uiLocale(this.uiLocale),e.has("metadataConfiguration")&&R.actions.metadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&R.actions.noCustom(this.noCustom),e.has("editorMode")&&R.actions.editorMode(this.editorMode),e.has("noCustomComponent")&&R.actions.noCustomComponent(this.noCustomComponent),e.has("session")&&R.actions.session(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(p=>yc.addContext(p)),e.has("openExternalDocumentInNewTab")&&R.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&R.actions.navigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&R.actions.forcedOffline(this.forcedOffline),e.has("localesConfiguration")&&(R.actions.defaultLocales((r=this.localesConfiguration)===null||r===void 0?void 0:r.defaultLocales),R.actions.availableUiLocales((a=(n=this.localesConfiguration)===null||n===void 0?void 0:n.availableUiLocales)!==null&&a!==void 0?a:[]),R.actions.searchInAllLanguagesAllowed((s=(i=this.localesConfiguration)===null||i===void 0?void 0:i.allLanguagesAllowed)!==null&&s!==void 0?s:!1)),e.has("authenticationRequired")&&R.actions.authenticationRequired(this.authenticationRequired),e.has("availableContentLocales")&&R.actions.availableContentLocales((d=(l=this.availableContentLocales)===null||l===void 0?void 0:l.contentLocales)!==null&&d!==void 0?d:[]),setTimeout(()=>this.updateIfNeeded())}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.session==null&&this.updateSession(),this.metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),this.availableContentLocales==null&&this.updateAvailableContentLocales())}async updateSession(){this.session=await this.cache.get("session",async()=>{let e=await this.apiProvider().getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.session=void 0},e.idleTimeoutInMillis),e})}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration())}async updateLocalesConfiguration(){this.localesConfiguration=await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration())}async updateAvailableContentLocales(){this.availableContentLocales=await this.cache.get("availableContentLocales",()=>vc(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}))}};W.elementDefinitions={};W.styles=mc;V([T()],W.prototype,"baseUrl",void 0);V([T()],W.prototype,"apiIntegrationIdentifier",void 0);V([T()],W.prototype,"apiIntegrationAppVersion",void 0);V([T()],W.prototype,"uiLocale",void 0);V([ce(null)],W.prototype,"availableUiLocales",void 0);V([ce(null)],W.prototype,"metadataConfiguration",void 0);V([T({type:Boolean})],W.prototype,"editorMode",void 0);V([T({type:Boolean})],W.prototype,"noCustom",void 0);V([T({type:Boolean})],W.prototype,"openExternalDocumentInNewTab",void 0);V([T({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],W.prototype,"noCustomComponent",void 0);V([T({type:Boolean})],W.prototype,"withManualResources",void 0);V([T({type:Boolean})],W.prototype,"navigatorOnline",void 0);V([T({type:Boolean})],W.prototype,"forcedOffline",void 0);V([T({type:Object})],W.prototype,"apiProvider",void 0);V([T({type:Boolean})],W.prototype,"authenticationRequired",void 0);V([ce([])],W.prototype,"messageContexts",void 0);V([ce(void 0)],W.prototype,"session",void 0);V([ee()],W.prototype,"localesConfiguration",void 0);V([ee()],W.prototype,"availableContentLocales",void 0);var ao=function(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},Rv=q(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(R)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var a,i;return((i=(a=this.metadataDescriptors.find(l=>l.key===n))===null||a===void 0?void 0:a.date)!==null&&i!==void 0?i:!1)?l=>lt.format(l,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return ao([T({type:Boolean})],e.prototype,"useLongDateFormat",void 0),ao([T({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),ao([Ee({store:R.name,selector:r=>{var n,a;return(a=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&a!==void 0?a:[]}})],e.prototype,"metadataDescriptors",void 0),ao([Ee({store:R.name})],e.prototype,"uiLocale",void 0),e});var io=class extends X{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=R.getState().session;return!!e?.sessionAuthenticated}};var so=class extends X{constructor(){super(...arguments),this.CACHE_DURATION=3*60*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=R.getState().session;return!!e?.sessionAuthenticated}};var ku="ft-user-assets",Fu={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(de).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:a}=e.payload;ha(t,r,[...fa(t,r),a]),Sc(t,r,1,n),Oc(t,a)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;ha(t,r,fa(t,r).map(a=>a.id===n.id?n:a)),Oc(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:a}=e.payload;ha(t,r,fa(t,r).filter(i=>i.id!==a)),Sc(t,r,-1,n)}},Ec={[de.SEARCHES]:"savedSearches",[de.BOOKMARKS]:"bookmarks",[de.BOOKS]:void 0,[de.COLLECTIONS]:void 0},fa=(t,e)=>{var r;let n=Ec[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},ha=(t,e,r)=>{let n=Ec[e];n&&(t[n]=r)},Sc=(t,e,r,n)=>{let a=t.assetCounts.allAsset[e];if(a!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,a+r),e===de.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},Oc=(t,e)=>{let r=t.assetLabels.map(a=>a.title),n=e.labels.filter(a=>!r.includes(a)).map(a=>({title:a}));t.assetLabels.push(...n)},ie=Le.get({name:ku,reducers:Fu,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(de).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),ma=class{constructor(e=new io,r=new so){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=R.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new eo,this.savedSearchesService=new ro,R.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=R.getState();oe((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),ie.actions.clearAssetCount(),ie.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),ie.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),ie.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();ie.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();ie.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&ie.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&ie.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(ie.getState().assetCounts.bookmarkByMap).length!==0;e===de.BOOKMARKS&&r&&ie.actions.clearBookmarkCountByMap(),ie.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;ie.actions.bookmarks(r)}}},ga=new ma;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=ga);tr("ft-app-context")(W);var co=class extends X{constructor(e){super(!0,e),this.cache.registerFinal("search-configuration",async()=>(await this.awaitApi).getSearchConfiguration())}async launchSearch(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters),facets:[...e.facets].sort((n,a)=>n.id.localeCompare(a.id))};return this.cache.get("search-"+this.hash(r),async()=>(await this.awaitApi).search(e),2*60*1e3)}async launchSuggest(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters)};return this.cache.get("suggest-"+this.hash(r),async()=>(await this.awaitApi).getSuggestions(e),2*60*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}async getConfiguration(){return this.cache.get("search-configuration")}sortFilters(e){return e.map(r=>r.valueFilter==null?r:{...r,valueFilter:{...r.valueFilter,values:[...r.valueFilter.values].sort((n,a)=>n.localeCompare(a))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var Mu=t=>t.request.virtualField===ct.TITLE_ONLY&&t.request.scope===Bt.DOCUMENTS,Du=t=>t.request.keywordMatch==$e.MANDATORY,lo=class t extends Event{constructor(){super(t.eventName)}};lo.eventName="search-context-clear-all-filters";var br=class t{static build(e,r){return new t(hc(e.trim()||"context"),r)}constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.localesDebouncer=new fe(10),this.searchDebouncer=new fe(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest(this.store.getState()))),this.buildSearchRequest=n=>({...n.request,facets:this.facetIds.map(a=>({id:a}))}),this.suggestDebouncer=new fe(1e3),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest(this.store.getState()))),this.buildSuggestRequest=n=>{var a;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(a=n.request.sort)!==null&&a!==void 0?a:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch}},this.service=r??new co,this.service.cache.addEventListener("clear-cache",n=>{n.detail.clearedKeys.includes("available-locales")&&this.updateLocales()}),this.searchWatcher=Ft(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=Ft(e,this.buildSuggestRequest,this.launchSuggest)}async initService(){return this.updateLocales(),this.service.getConfiguration().then(e=>{this.store.actions.configuration(e),this.setSortId(this.store.getState().request.sortId)}),this.launchSearch()}setQuery(e){this.store.actions.setRequestQuery(e),this.store.actions.liveQuery(e),this.store.actions.setPageNumber(1)}setContentLocale(e){var r;let n=(r=this.store.getState().locales)!==null&&r!==void 0?r:[],a=this.store.getState().request.contentLocale;if(e!=a){if(n.length>0){let i=s=>n.some(l=>l.lang==s);i(e)||(e=i(a)?a:n[0].lang)}this.store.actions.setRequestContentLocale(e),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([])}return e}forceContentLocale(e){this.store.actions.setRequestContentLocale(e)}setPageSize(e){this.store.actions.setPageSize(e)}setPageNumber(e){this.store.actions.setPageNumber(e)}get sortOptions(){var e,r;return(r=(e=this.store.getState().configuration)===null||e===void 0?void 0:e.sortOptions)!==null&&r!==void 0?r:[]}setSort(e){this.store.actions.setRequestSort(e),this.store.actions.setPageNumber(1)}setSortId(e){var r;if(this.store.actions.setPageNumber(1),e==null||this.sortOptions.length==0)return this.store.actions.setRequestSortId(e),e;let n=(r=this.sortOptions.find(a=>a.id==e))!==null&&r!==void 0?r:this.sortOptions[0];return this.store.actions.setRequestSortId(n.id),n.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.store.actions.setRequestFilters(r),this.store.actions.setPageNumber(1)}setClusterSortCriterion(e){this.store.actions.setRequestClusterSortCriterion(e)}setSearchInDocumentTitlesOnly(e){e?(this.store.actions.setRequestVirtualField(ct.TITLE_ONLY),this.store.actions.setRequestScope(Bt.DOCUMENTS)):(this.store.actions.setRequestVirtualField(ct.EVERYWHERE),this.store.actions.setRequestScope(Bt.DEFAULT))}setKeywordMatch(e){this.store.actions.setKeywordMatch(e)}setVirtualField(e){this.store.actions.setRequestVirtualField(e)}get searchInDocumentTitlesOnly(){return Mu(this.store.getState())}get keywordMatch(){return Du(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new lo)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(a=>a!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(a=>({id:a}));this.store.actions.setRequestFacets(n)}setFilter(e,r){this.setValueFilter(e,r)}setValueFilter(e,r){let n=this.store.getState().request.metadataFilters,a={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(s=>!s.valueFilter),...n.filter(s=>s.valueFilter&&s.key!==a.key),a];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,a={key:e,dateFilter:{type:r}},i=[...n.filter(s=>!s.dateFilter),...n.filter(s=>s.dateFilter&&s.key!==a.key),a];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(a=>!a.dateFilter),...r.filter(a=>a.dateFilter&&a.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let a=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},s=[...a.filter(l=>!l.rangeFilter),...a.filter(l=>l.rangeFilter&&l.key!==i.key),i];this.setFilters(s)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(a=>!a.rangeFilter),...r.filter(a=>a.rangeFilter&&a.key!==e)];this.setFilters(n)}setLiveQuery(e){this.store.actions.liveQuery(e)}setRequest(e){this.store.actions.setRequest({...e,facets:this.store.getState().request.facets}),this.store.actions.liveQuery(e.query),this.store.actions.setPageNumber(1)}setScope(e){this.store.actions.setRequestScope(e)}setOtherQueryParams(e){this.store.actions.setOtherQueryParams(e)}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales))}async fetchSearchData(e){var r,n,a,i;try{if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),this.store.actions.paging(void 0),this.ignoreEmptyQuery&&e.query.length==0)this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0);else{this.cancelableSearch=vt(this.service.launchSearch(e));let s=await this.cancelableSearch;if(this.store.actions.announcements(s.announcements),s.paging.currentPage<=1)this.store.actions.results(s.results),this.store.actions.facets(s.facets),this.store.actions.spellcheck(s.spellcheck);else{let l=((n=this.store.getState().results)!==null&&n!==void 0?n:[]).concat(s.results);this.store.actions.results(l),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(s.paging.currentPage-1)*((a=e.paging.perPage)!==null&&a!==void 0?a:20)+1}`})}this.store.actions.paging(s.paging)}}catch(s){s instanceof xe||(console.error(s),(i=this.errorHandler)===null||i===void 0||i.call(this,s))}}async fetchSuggestData(e){var r;try{if((r=this.cancelableSuggest)===null||r===void 0||r.cancel(),e.input.length!=0&&e.input.length<3)return;this.cancelableSuggest=vt(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof xe)&&this.errorHandler&&this.errorHandler(n)}}clear(){this.store.clear()}clearResults(){this.store.actions.paging(void 0),this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0)}};var Uu=function(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},ba=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},Cc=Symbol("registerInterval"),ya=Symbol("registerAttempts"),Bu=40,Wu=q(Symbol("toFtSearchComponent"),function(t){class e extends t{setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[ya]=0,this[Cc]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[ya]>Bu?window.clearInterval(this[Cc]):(this[ya]++,this.dispatchEvent(new ba))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return Uu([ee()],e.prototype,"stateManager",void 0),e}),wc=class extends Wu(nt){};function uo(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function po(t){var e,r;return t.dateFilter?{key:t.key,type:"DATE",dateValue:t.dateFilter.type}:t.rangeFilter?{key:t.key,type:"RANGE",from:t.rangeFilter.from,to:t.rangeFilter.to}:{key:t.key,values:(e=t.valueFilter)===null||e===void 0?void 0:e.values,negative:(r=t.valueFilter)===null||r===void 0?void 0:r.negative}}var fo=class{constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.enableAnalyticsEvents=!0,this.appName=void 0,this.appVersion=void 0,this.document=void 0,this.sendEvent=n=>{if(!this.canSendEvent()||!n)return;let a=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(a,n):this.sendDocumentSearchEvent(a,n)},this.eventsService=r??new oo,this.resultsWatcher=Ft(e,n=>n.results,this.sendEvent)}setEnableAnalyticsEvents(e){this.enableAnalyticsEvents=e}setAppName(e){this.appName=e}setAppVersion(e){this.appVersion=e}setDocumentSearch(e){this.document=e}setDocumentSearchFromMap(e){this.setDocumentSearch(this.convertToAnalyticsMap(e))}initAppInfo(){let{apiIntegrationIdentifier:e,apiIntegrationAppVersion:r}=R.getState();this.setAppName(e??"unknown"),this.setAppVersion(r??"unknown")}convertToAnalyticsMap(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}canSendEvent(){if(this.appName==null||this.appVersion==null)return console.debug("ft-search-context.eventManager is not initialized. No events will be sent!"),!1;let{editorMode:e}=R.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r){let n={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:uo(e.metadataFilters),facets:e.metadataFilters.map(a=>po(a))}};this.eventsService.sendKhubSearchEvent(n)}sendDocumentSearchEvent(e,r){if(e.metadataFilters.find(a=>{var i;return a.key==="ft:publicationId"&&((i=a.valueFilter)===null||i===void 0?void 0:i.values[0])===this.document.id})!==void 0){let a={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:r.length},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(a)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,a;e.type==je.TOPIC&&(a={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:uo(n.metadataFilters),facets:n.metadataFilters.map(s=>po(s))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:a},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,a;e.type==je.TOPIC&&(a={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:st.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:uo(n.metadataFilters),facets:n.metadataFilters.map(s=>po(s))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:a},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case je.MAP:return{id:e.map.mapId,title:e.map.title,type:Dt.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case je.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:Dt.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case je.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:Dt.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r,n,a,i,s;return(i=(n=(r=e.map)===null||r===void 0?void 0:r.originUrl)!==null&&n!==void 0?n:(a=e.topic)===null||a===void 0?void 0:a.originUrl)!==null&&i!==void 0?i:(s=e.document)===null||s===void 0?void 0:s.originUrl}};var K=function(t,e,r,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(i=(a<3?s(i):a>3?s(e,r,i):s(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i},xa=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},va=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},Sa=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n}})}},$=class extends nt{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=br.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=r=>this.handleLoadError(r),this.addStore(this.stateManager.store,"search")}return this._stateManager}get eventManager(){return this._eventManager==null&&(this._eventManager=new fo(this.stateManager.store)),this._eventManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.otherQueryParams={},this.addStore(R)}render(){return ye`
90
90
  <slot @register-ft-search-component=${this.registerComponent} @ft-search-result-click=${this.onResultClicked}
91
91
  @ft-search-result-open-context-menu=${this.onResultContextMenuOpened}></slot>
92
92
  `}willUpdate(e){super.willUpdate(e),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.forceContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sortId")&&this.stateManager.setSortId(this.sortId),e.has("sort")&&this.sort!==void 0&&this.stateManager.setSort(this.sort),e.has("pageSize")&&this.pageSize!==void 0&&this.stateManager.setPageSize(this.pageSize),e.has("searchInDocumentTitlesOnly")&&this.searchInDocumentTitlesOnly!==void 0&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),e.has("keywordMatch")&&this.stateManager.setKeywordMatch(this.keywordMatch),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),e.has("ignoreEmptyQuery")&&this.ignoreEmptyQuery!==void 0&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),e.has("openExternalDocumentInNewTab")&&this.openExternalDocumentInNewTab!==void 0&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("otherQueryParams")&&this.otherQueryParams!==void 0&&this.stateManager.setOtherQueryParams(this.otherQueryParams),e.has("session")&&this.session!==void 0&&e.get("session")!=null&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.clearResults(),this.stateManager.setQuery(this.query),this.stateManager.forceContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSortId(this.sortId),this.stateManager.setSort(this.sort),this.stateManager.setOtherQueryParams(this.otherQueryParams)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new va(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new Sa(this.request,this.paging,this.autocorrect))}registerComponent(e){e.stopPropagation();let r=e.composedPath()[0];this.register(r)}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new xa(e))}reloadSavedSearches(){ga.clearMySearches()}clear(){this.stateManager.clear()}onResultClicked(e){this.eventManager.sendResultClickedEvent(e.detail.result,e.detail.rank)}onResultContextMenuOpened(e){this.eventManager.sendResultContextMenuOpenedEvent(e.detail.result,e.detail.rank)}};$.elementDefinitions={};$.styles=fc;K([Ee({store:R.name})],$.prototype,"session",void 0);K([T()],$.prototype,"query",void 0);K([T()],$.prototype,"contentLocale",void 0);K([kr()],$.prototype,"pageSize",void 0);K([T({type:Boolean})],$.prototype,"searchInDocumentTitlesOnly",void 0);K([T()],$.prototype,"keywordMatch",void 0);K([T()],$.prototype,"scope",void 0);K([T()],$.prototype,"virtualField",void 0);K([T({type:Boolean})],$.prototype,"ignoreEmptyQuery",void 0);K([Ee({store:R.name})],$.prototype,"openExternalDocumentInNewTab",void 0);K([ce([])],$.prototype,"filters",void 0);K([T()],$.prototype,"sortId",void 0);K([ce([])],$.prototype,"sort",void 0);K([ce({})],$.prototype,"otherQueryParams",void 0);K([Ee({store:"search"})],$.prototype,"request",void 0);K([Ee({store:"search"})],$.prototype,"paging",void 0);K([Ee({store:"search",selector:t=>t.spellcheck})],$.prototype,"autocorrect",void 0);K([T({attribute:!1})],$.prototype,"searchServiceProvider",void 0);tr("ft-search-context")($);})();
@@ -31,7 +31,7 @@ export class FtSearchStateManager {
31
31
  facets: this.facetIds.map((id) => ({ id })),
32
32
  };
33
33
  };
34
- this.suggestDebouncer = new Debouncer(300);
34
+ this.suggestDebouncer = new Debouncer(1000);
35
35
  this.launchSuggest = (request) => {
36
36
  return this.suggestDebouncer.run(() => this.fetchSuggestData(request !== null && request !== void 0 ? request : this.buildSuggestRequest(this.store.getState())));
37
37
  };
@@ -308,6 +308,12 @@ export class FtSearchStateManager {
308
308
  var _a;
309
309
  try {
310
310
  (_a = this.cancelableSuggest) === null || _a === void 0 ? void 0 : _a.cancel();
311
+ // We want to keep empty request, and request greater than 3 chars
312
+ // This is done to keep usage of first "empty" request, which prefill
313
+ // suggestions. This will be replace with last inputs.
314
+ if (request.input.length != 0 && request.input.length < 3) {
315
+ return;
316
+ }
311
317
  this.cancelableSuggest = cancelable(this.service.launchSuggest(request));
312
318
  const results = await this.cancelableSuggest;
313
319
  this.store.actions.suggestResults(results.suggestions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-context",
3
- "version": "1.3.47",
3
+ "version": "1.3.49",
4
4
  "description": "Context block for integrated search components",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,12 +19,12 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-app-context": "1.3.47",
23
- "@fluid-topics/ft-wc-utils": "1.3.47",
22
+ "@fluid-topics/ft-app-context": "1.3.49",
23
+ "@fluid-topics/ft-wc-utils": "1.3.49",
24
24
  "lit": "3.1.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@fluid-topics/public-api": "1.0.110"
28
28
  },
29
- "gitHead": "16ac56d62f3a88a3b03cbc92bcd04dd91951a015"
29
+ "gitHead": "88d74757cd8593b6cde7a28c3db66ac7eafb7073"
30
30
  }