@fluid-topics/ft-app-context 2.0.21 → 2.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";(()=>{var vt=Object.create;var pe=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,
|
|
2
|
-
`)===0?d.substr(1,d.length):d}).forEach(function(d){var p=d.split(":"),u=p.shift().trim();if(u){var K=p.join(":").trim();try{i.append(u,K)}catch(Z){console.warn("Response "+Z.message)}}}),i}ce.call(I.prototype);function C(s,i){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=i.statusText===void 0?"":""+i.statusText,this.headers=new A(i.headers),this.url=i.url||"",this._initBody(s)}ce.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new A(this.headers),url:this.url})},C.error=function(){var s=new C(null,{status:200,statusText:""});return s.ok=!1,s.status=0,s.type="error",s};var _t=[301,302,303,307,308];C.redirect=function(s,i){if(_t.indexOf(i)===-1)throw new RangeError("Invalid status code");return new C(null,{status:i,headers:{location:s}})},r.DOMException=n.DOMException;try{new r.DOMException}catch{r.DOMException=function(i,o){this.message=i,this.name=o;var d=Error(i);this.stack=d.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function J(s,i){return new Promise(function(o,d){var p=new I(s,i);if(p.signal&&p.signal.aborted)return d(new r.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function K(){u.abort()}u.onload=function(){var E={statusText:u.statusText,headers:St(u.getAllResponseHeaders()||"")};p.url.indexOf("file://")===0&&(u.status<200||u.status>599)?E.status=200:E.status=u.status,E.url="responseURL"in u?u.responseURL:E.headers.get("X-Request-URL");var x="response"in u?u.response:u.responseText;setTimeout(function(){o(new C(x,E))},0)},u.onerror=function(){setTimeout(function(){d(new TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){d(new TypeError("Network request timed out"))},0)},u.onabort=function(){setTimeout(function(){d(new r.DOMException("Aborted","AbortError"))},0)};function Z(E){try{return E===""&&n.location.href?n.location.href:E}catch{return E}}if(u.open(p.method,Z(p.url),!0),p.credentials==="include"?u.withCredentials=!0:p.credentials==="omit"&&(u.withCredentials=!1),"responseType"in u&&(a.blob?u.responseType="blob":a.arrayBuffer&&(u.responseType="arraybuffer")),i&&typeof i.headers=="object"&&!(i.headers instanceof A||n.Headers&&i.headers instanceof n.Headers)){var de=[];Object.getOwnPropertyNames(i.headers).forEach(function(E){de.push(v(E)),u.setRequestHeader(E,N(i.headers[E]))}),p.headers.forEach(function(E,x){de.indexOf(x)===-1&&u.setRequestHeader(x,E)})}else p.headers.forEach(function(E,x){u.setRequestHeader(x,E)});p.signal&&(p.signal.addEventListener("abort",K),u.onreadystatechange=function(){u.readyState===4&&p.signal.removeEventListener("abort",K)}),u.send(typeof p._bodyInit>"u"?null:p._bodyInit)})}return J.polyfill=!0,n.fetch||(n.fetch=J,n.Headers=A,n.Request=I,n.Response=C),r.Headers=A,r.Request=I,r.Response=C,r.fetch=J,r}({})})(z);z.fetch.ponyfill=!0;delete z.fetch.polyfill;var H=$.fetch?$:z;
|
|
3
|
-
`;var V=T(R()),xt="ft-app-info",P=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:t})}};P.eventName="authentication-change";var B=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:t})}};B.eventName="ui-locale-changed";var Lt={session:(e,t)=>{(0,V.deepEqual)(e.session,t.payload)||(e.session=t.payload,setTimeout(()=>h.dispatchEvent(new P(t.payload)),0))}},h=V.FtReduxStore.get({name:xt,reducers:Lt,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,searchLanguageSetsUiLanguage:!1,uiLanguageSetsSearchLanguage:!1,uiLanguageSetsReaderLanguage:!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 te=T(R());var L=class e{static get(t){let{baseUrl:r,apiIntegrationIdentifier:n}=h.getState(),a=t??n;if(r&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,a,!0)}static await(t){return new Promise(r=>{let n=e.get(t);if(n)r(n);else{let a=h.subscribe(()=>{n=e.get(t),n&&(a(),r(n))})}})}};var F=class{constructor(t){this.overrideApi=t}get api(){var t;return(t=this.overrideApi)!==null&&t!==void 0?t:L.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):L.await()}};var U=class extends F{constructor(t=!0,r){var n;super(r),this.sortObjectFields=(l,c)=>typeof c!="object"||c==null||Array.isArray(c)?c:Object.fromEntries(Object.entries(c).sort(([y],[v])=>y.localeCompare(v)));let a=this.constructor;a.commonCache=(n=a.commonCache)!==null&&n!==void 0?n:new te.CacheRegistry,this.cache=t?a.commonCache:new te.CacheRegistry}clearCache(){this.cache.clearAll()}hash(t){return String(Array.from(JSON.stringify(t,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var re=class{addCommand(t,r=!1){h.commands.add(t,r)}consumeCommand(t){return h.commands.consume(t)}};window.FluidTopicsAppInfoStoreService=new re;var _=T(R());var ge,k=class extends CustomEvent{constructor(t){super("ft-i18n-context-loaded",{detail:t})}},Ut=Symbol("clearAfterUnitTest"),q=class extends(0,_.withEventBus)(U){constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[ge]=()=>{this.defaultMessages={},this.cache=new _.CacheRegistry,this.listeners={}},this.currentUiLocale=h.getState().uiLocale,h.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:t}=h.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){let r=t.name.toLowerCase();this.cache.setFinal(r,t),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,r){var n;if(t=t.toLowerCase(),r&&Object.keys(r).length>0){let a={...(n=this.defaultMessages[t])!==null&&n!==void 0?n:{},...r};(0,_.deepEqual)(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}return this.fetchContext(t)}resolveContext(t){var r,n;return this.fetchContext(t),(n=(r=this.cache.getNow(t))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(t,r){let n=t.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(t,r,...n){var a;let l=t.toLowerCase(),c=this.resolveContext(l);return new _.ParametrizedLabelResolver((a=this.defaultMessages[l])!==null&&a!==void 0?a:{},c).resolve(r,...n)}async fetchContext(t){let r=!this.cache.has(t),n;try{n=await this.cache.get(t,()=>this.messageContextProvider(this.currentUiLocale,t)),r&&await this.notify(t)}catch(a){!(a instanceof _.CanceledPromiseError)&&r&&console.error(a)}return n}subscribe(t,r){var n;return t=t.toLowerCase(),this.listeners[t]=(n=this.listeners[t])!==null&&n!==void 0?n:new Set,this.listeners[t].add(r),()=>{var a;return(a=this.listeners[t])===null||a===void 0?void 0:a.delete(r)}}async notifyAll(){let t=Object.keys(this.listeners);document.body.dispatchEvent(new k({loadedContexts:t})),this.dispatchEvent(new k({loadedContexts:t})),await Promise.all(t.map(r=>this.notify(r,!1)))}async notify(t,r=!0){r&&(document.body.dispatchEvent(new k({loadedContexts:[t]})),this.dispatchEvent(new k({loadedContexts:[t]}))),this.listeners[t]!=null&&await Promise.all([...this.listeners[t].values()].map(n=>(0,_.delay)(0).then(()=>n()).catch(()=>null)))}};ge=Ut;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends q{constructor(){super(async(e,t)=>(await this.awaitApi).getFluidTopicsMessageContext(e,t))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends q{constructor(){super(async(e,t)=>(await this.awaitApi).getCustomMessageContext(e,t))}});var Te=window.FluidTopicsI18nService,Jt=window.FluidTopicsCustomI18nService;var Se=T(R()),se=class{highlightHtml(t,r,n){(0,Se.highlightHtml)(t,r,n)}};window.FluidTopicsHighlightHtmlService=new se;var Dt=T(ve(),1);var Ce;(function(e){e.black="black",e.green="green",e.blue="blue",e.purple="purple",e.red="red",e.orange="orange",e.yellow="yellow"})(Ce||(Ce={}));var Re;(function(e){e.OFFICIAL="OFFICIAL",e.PERSONAL="PERSONAL",e.SHARED="SHARED"})(Re||(Re={}));var Ie;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(Ie||(Ie={}));var Oe;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(Oe||(Oe={}));var be;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(be||(be={}));var xe;(function(e){e.VALUE="VALUE",e.DATE="DATE",e.RANGE="RANGE"})(xe||(xe={}));var Le;(function(e){e.OFFICIAL="OFFICIAL",e.AI="AI"})(Le||(Le={}));var Ue;(function(e){e.BOOKMARK__CREATE="BOOKMARK__CREATE",e.BOOKMARK__DELETE="BOOKMARK__DELETE",e.CASE_DEFLECTION__START="CASE_DEFLECTION__START",e.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",e.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",e.CHATBOT__RATE="CHATBOT__RATE",e.COLLECTION__CREATE="COLLECTION__CREATE",e.COLLECTION__UPDATE="COLLECTION__UPDATE",e.COLLECTION__DELETE="COLLECTION__DELETE",e.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",e.DOCUMENT__ON_DEMAND_TRANSLATE="DOCUMENT__ON_DEMAND_TRANSLATE",e.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",e.DOCUMENT__PRINT="DOCUMENT__PRINT",e.DOCUMENT__PROCESS="DOCUMENT__PROCESS",e.DOCUMENT__RATE="DOCUMENT__RATE",e.DOCUMENT__SEARCH="DOCUMENT__SEARCH",e.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",e.DOCUMENT__UNRATE="DOCUMENT__UNRATE",e.FEEDBACK__SEND="FEEDBACK__SEND",e.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",e.AI__RATE="AI__RATE",e.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",e.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",e.KHUB__PROCESS="KHUB__PROCESS",e.KHUB__SEARCH="KHUB__SEARCH",e.LABELS__DOWNLOAD="LABELS__DOWNLOAD",e.LINK__SHARE="LINK__SHARE",e.PAGE__DISPLAY="PAGE__DISPLAY",e.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",e.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",e.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",e.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",e.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",e.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",e.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",e.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",e.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",e.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",e.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",e.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",e.TOPIC__RATE="TOPIC__RATE",e.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",e.TOPIC__UNRATE="TOPIC__UNRATE",e.USER__LOGIN="USER__LOGIN",e.USER__LOGOUT="USER__LOGOUT",e.HEARTBEAT="HEARTBEAT"})(Ue||(Ue={}));var De;(function(e){e.STANDARD="STANDARD",e.STRUCTURAL="STRUCTURAL"})(De||(De={}));var we;(function(e){e.THIRD_PARTY="THIRD_PARTY",e.OFF_THE_GRID="OFF_THE_GRID",e.CONTENT_PACKAGER="CONTENT_PACKAGER",e.PAGES="PAGES",e.DESIGNED_READER="DESIGNED_READER"})(we||(we={}));var Me;(function(e){e.HOMEPAGE="HOMEPAGE",e.CUSTOM="CUSTOM",e.HEADER="HEADER",e.READER="READER",e.TOPIC_TEMPLATE="TOPIC_TEMPLATE",e.SEARCH="SEARCH",e.SEARCH_RESULT="SEARCH_RESULT",e.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",e.LINK_PREVIEW="LINK_PREVIEW",e.UD_VIEWER="UD_VIEWER",e.ASSET_VIEWER="ASSET_VIEWER"})(Me||(Me={}));var Ne;(function(e){e.CLASSIC="CLASSIC",e.CUSTOM="CUSTOM",e.DESIGNER="DESIGNER"})(Ne||(Ne={}));var Pe;(function(e){e.AND="AND",e.OR="OR",e.MONOVALUED="MONOVALUED"})(Pe||(Pe={}));var Fe;(function(e){e.NONE="NONE",e.ALPHABET="ALPHABET",e.VERSION="VERSION"})(Fe||(Fe={}));var ke;(function(e){e.STARS="STARS",e.LIKE="LIKE",e.DICHOTOMOUS="DICHOTOMOUS",e.NO_RATING="NO_RATING"})(ke||(ke={}));var He;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR",e.CUSTOM="CUSTOM"})(He||(He={}));var Be;(function(e){e.OPTIONAL="OPTIONAL",e.MANDATORY="MANDATORY"})(Be||(Be={}));var je;(function(e){e.ASC="ASC",e.DESC="DESC"})(je||(je={}));var Ke;(function(e){e.ALPHA="ALPHA",e.NATURAL="NATURAL"})(Ke||(Ke={}));var Ge;(function(e){e.EVERYWHERE="EVERYWHERE",e.TITLE_ONLY="TITLE_ONLY",e.NONE="NONE"})(Ge||(Ge={}));var Ve;(function(e){e.ARTICLE="ARTICLE",e.BOOK="BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})(Ve||(Ve={}));var qe;(function(e){e.FLUIDTOPICS="FLUIDTOPICS",e.EXTERNAL="EXTERNAL"})(qe||(qe={}));var $e;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.PERSONAL_BOOK="PERSONAL_BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})($e||($e={}));var ze;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(ze||(ze={}));var We;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.HTML_PACKAGE="HTML_PACKAGE",e.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(We||(We={}));var Xe;(function(e){e.DEFAULT="DEFAULT",e.DOCUMENTS="DOCUMENTS",e.ALL_TOPICS="ALL_TOPICS",e.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Xe||(Xe={}));var Ye;(function(e){e.PLAIN_TEXT="PLAIN_TEXT",e.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",e.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(Ye||(Ye={}));var m;(function(e){e.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",e.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",e.HTML_EXPORT_USER="HTML_EXPORT_USER",e.PDF_EXPORT_USER="PDF_EXPORT_USER",e.SAVED_SEARCH_USER="SAVED_SEARCH_USER",e.COLLECTION_USER="COLLECTION_USER",e.OFFLINE_USER="OFFLINE_USER",e.ANALYTICS_USER="ANALYTICS_USER",e.BETA_USER="BETA_USER",e.DEBUG_USER="DEBUG_USER",e.PRINT_USER="PRINT_USER",e.RATING_USER="RATING_USER",e.FEEDBACK_USER="FEEDBACK_USER",e.GENERATIVE_AI_USER="GENERATIVE_AI_USER",e.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",e.CONTENT_PUBLISHER="CONTENT_PUBLISHER",e.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",e.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",e.KHUB_ADMIN="KHUB_ADMIN",e.USERS_ADMIN="USERS_ADMIN",e.PORTAL_ADMIN="PORTAL_ADMIN",e.ADMIN="ADMIN"})(m||(m={}));var Qe;(function(e){e.SEARCHES="SEARCHES",e.BOOKMARKS="BOOKMARKS",e.BOOKS="BOOKS",e.COLLECTIONS="COLLECTIONS"})(Qe||(Qe={}));var Je;(function(e){e.UNAUTHENTICATED="UNAUTHENTICATED",e.USER_INCOMPLETE="USER_INCOMPLETE",e.MFA_REQUIRED="MFA_REQUIRED",e.AUTHENTICATED="AUTHENTICATED"})(Je||(Je={}));var Ze;(function(e){e.VALID="VALID",e.INVALID="INVALID"})(Ze||(Ze={}));var et;(function(e){e.INACCURATE="INACCURATE",e.INCOMPLETE="INCOMPLETE",e.OFF_TOPIC="OFF_TOPIC",e.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",e.SUMMARY="SUMMARY",e.SEMANTIC_SEARCH="SEMANTIC_SEARCH",e.CHATBOT_INSTRUCTIONS="CHATBOT_INSTRUCTIONS",e.OTHER="OTHER"})(et||(et={}));var tt;(function(e){e.INACCURATE="INACCURATE",e.INCOMPLETE="INCOMPLETE",e.OFF_TOPIC="OFF_TOPIC",e.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",e.SLOW="SLOW",e.OTHER="OTHER"})(tt||(tt={}));var rt;(function(e){e.JSON="JSON",e.TEXT="TEXT"})(rt||(rt={}));var st;(function(e){e.JSON="JSON",e.TEXT="TEXT"})(st||(st={}));var nt;(function(e){e.USER="USER",e.ASSISTANT="ASSISTANT"})(nt||(nt={}));var it;(function(e){e.TEXT="TEXT",e.HTML="HTML"})(it||(it={}));var at;(function(e){e.HTML="HTML",e.MARKDOWN="MARKDOWN"})(at||(at={}));var lt;(function(e){e.MAP="MAP",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(lt||(lt={}));var cr={[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.BEHAVIOR_DATA_USER],[m.GENERATIVE_AI_EXPORT_USER]:[m.GENERATIVE_AI_USER]};var ot=T(R());var ne=class{isDate(t){var r,n,a,l;return(l=(a=((n=(r=h.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&n!==void 0?n:[]).find(y=>y.key===t))===null||a===void 0?void 0:a.date)!==null&&l!==void 0?l:!1}format(t,r){var n,a,l,c;if(t==null)return"";try{return ot.DateFormatter.format(t,(n=r?.locale)!==null&&n!==void 0?n:h.getState().uiLocale,(a=r?.longFormat)!==null&&a!==void 0?a:!1,(l=r?.withTime)!==null&&l!==void 0?l:!1,(c=r?.onlyTime)!==null&&c!==void 0?c:!1)}catch(y){throw console.error(`Date ${JSON.stringify(t)} is not valid`,y),y}}};window.FluidTopicsDateService=new ne;var ut=T(R());var j=class{static get(t,r){var n,a;let l=h.getState(),{lang:c,region:y}=(a=(n=l.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&a!==void 0?a:{lang:"en",region:"US"};return new ut.SearchPlaceConverter(l.baseUrl,t??20,l.searchInAllLanguagesAllowed,r??`${c}-${y}`)}};var ie=class{urlToSearchRequest(t){return j.get().parse(t)}searchRequestToUrl(t){return j.get().serialize(t)}};window.FluidTopicsUrlService=new ie;var b=T(R());var D=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:{currentItem:t}})}};D.eventName="change";var ae=class{itemName(t){return`fluid-topics-history-item-${t}`}get(t){let r=sessionStorage.getItem(this.itemName(t));return r?JSON.parse(r):void 0}set(t,r){sessionStorage.setItem(this.itemName(t),JSON.stringify(r))}},ct=new ae;var W=class e extends b.WithEventBus{static build(){return new e(window.history,ct,()=>window.location,!1)}constructor(t,r,n,a){var l,c;super(),this.history=t,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=t.pushState,this.realReplaceState=t.replaceState,this.initialIndex=(c=(l=t.state)===null||l===void 0?void 0:l.index)!==null&&c!==void 0?c:t.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(a)}setCurrentState(t,r=!1){let n=r&&this.currentIndex===t.index-1;this.currentState={...this.buildCurrentState(),...t},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,b.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new D(this.currentItem())),0)}installProxies(){let t=r=>(n,a,[l,c,y])=>{let v=r(),N={...v===this.currentIndex?this.currentState:void 0,...l,index:v,href:typeof y=="string"?y:(y??this.windowLocation()).href};n.apply(a,[N,c,y]),this.setCurrentState(N,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:t(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:t(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",t=>this.setCurrentState(t.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(t){for(let r=this.history.length-1;r>=0;r--)t?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(t){var r;let n={...this.buildCurrentState(),...t,index:this.currentIndex,title:(r=t?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(t){this.addEventListener(D.eventName,t)}removeHistoryChangeListener(t){this.removeEventListener(D.eventName,t)}currentItem(){return(0,b.deepCopy)(this.currentState)}back(){let t=this.previousDifferentMajorPosition();t>=0?this.history.go(t-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,b.deepCopy)(this.states[this.previousDifferentMajorPosition()])}previousDifferentMajorPosition(){let t=this.currentIndex>0?this.currentIndex-1:0;for(;t>0&&!this.isDifferentMajorState(t);)t--;return t}forward(){let t=this.nextMajorPosition();t&&t<this.states.length?this.history.go(t-this.currentIndex):this.history.forward()}forwardItem(){let t=this.nextMajorPosition();if(t)return(0,b.deepCopy)(this.states[t])}nextMajorPosition(){let t=this.currentIndex;if(!(t>=this.states.length)){do t++;while(t<this.states.length&&!this.isDifferentMajorState(t));return this.getHigherPositionInTheSameState(t)}}getHigherPositionInTheSameState(t){var r;let n=(r=this.states[t])===null||r===void 0?void 0:r.majorStateId;if(!n)return t;let a=t,l=t+1;for(;this.states.length>l&&!this.isDifferentMajorState(l,n);)this.hasState(l)&&(a=l),l++;return a}buildCurrentState(){var t,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(t=this.history.state)===null||t===void 0?void 0:t.title)!==null&&r!==void 0?r:document.title}}hasState(t){return this.states[t]!=null}isDifferentMajorState(t,r){var n;if(!this.hasState(t))return!1;let a=r??this.currentState.majorStateId,l=(n=this.states[t])===null||n===void 0?void 0:n.majorStateId;return l==null||l!=a}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=W.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),addHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(e),removeHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(e)});var w=T(R());function dt(e,t){let{authenticationRequired:r,session:n}=h.getState();return r&&!n?.sessionAuthenticated?Promise.resolve(t):e()}var X=class extends F{async updateUiLocale(t){return(await this.awaitApi).updateUiLocale(t)}};var le=class e extends w.FtStateManager{static build(t){return new e(h,t)}constructor(t,r){super(),this.store=t,this.cache=new w.CacheRegistry,this.withManualResources=!0,this.localesConfiguration=null,this.userLocaleService=new X,this.cleanSessionDebouncer=new w.Debouncer,this.reloadDebouncer=new w.Debouncer(500),this.apiProvider=r??(()=>L.get())}setWithManualResources(t){this.withManualResources=t,this.updateIfNeeded()}async initService(){this.store.addEventListener(P.eventName,this.reloadConfiguration)}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.store.getState().session==null&&this.updateSession(),this.store.getState().metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),(this.store.getState().availableContentLocales==null||this.store.getState().availableContentLocales.length==0)&&this.updateAvailableContentLocales())}async updateSession(){let t=await this.cache.get("session",async()=>{let r=await this.apiProvider().getCurrentSession();return r.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.setSession(void 0)},r.idleTimeoutInMillis),r});this.setSession(t)}async updateMetadataConfiguration(){this.setMetadataConfiguration(await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration()))}async updateLocalesConfiguration(){this.setLocalesConfiguration(await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration()))}async updateAvailableContentLocales(){var t;let r=await this.cache.get("availableContentLocales",()=>dt(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}));this.setAvailableContentLocales((t=r.contentLocales)!==null&&t!==void 0?t:[])}reloadConfiguration(){var t;(t=this.cache)===null||t===void 0||t.clear("availableContentLocales"),typeof this.updateAvailableContentLocales=="function"&&this.updateAvailableContentLocales()}setBaseUrl(t){this.store.actions.baseUrl(t),window.fluidTopicsBaseUrl=t}setApiIntegrationIdentifier(t){this.store.actions.apiIntegrationIdentifier(t)}setApiIntegrationAppVersion(t){this.store.actions.apiIntegrationAppVersion(t)}setUiLocale(t){this.store.actions.uiLocale(t)}setLocalesConfiguration(t){var r,n,a,l,c;this.localesConfiguration=t,this.store.actions.defaultLocales(this.localesConfiguration.defaultLocales),this.store.actions.availableUiLocales((r=this.localesConfiguration.availableUiLocales)!==null&&r!==void 0?r:[]),this.store.actions.searchInAllLanguagesAllowed((n=this.localesConfiguration.allLanguagesAllowed)!==null&&n!==void 0?n:!1),this.store.actions.searchLanguageSetsUiLanguage((a=this.localesConfiguration.searchLanguageSetsUiLanguage)!==null&&a!==void 0?a:!1),this.store.actions.uiLanguageSetsSearchLanguage((l=this.localesConfiguration.uiLanguageSetsSearchLanguage)!==null&&l!==void 0?l:!1),this.store.actions.uiLanguageSetsReaderLanguage((c=this.localesConfiguration.uiLanguageSetsReaderLanguage)!==null&&c!==void 0?c:!1),setTimeout(()=>this.updateIfNeeded())}setAvailableContentLocales(t){this.store.actions.availableContentLocales(t),setTimeout(()=>this.updateIfNeeded())}stopReloadDebouncer(){this.reloadDebouncer.cancel()}requestUiLocaleUpdate(t){this.userLocaleService.updateUiLocale({uiLocale:t}).then(r=>{r.uiLocaleChanged&&(this.reloadDebouncer.run(()=>window.location.reload()),this.store.dispatchEvent(new B(r)))}).catch(()=>{})}setMetadataConfiguration(t){this.store.actions.metadataConfiguration(t),setTimeout(()=>this.updateIfNeeded())}setNoCustom(t){this.store.actions.noCustom(t)}setEditorMode(t){this.store.actions.editorMode(t)}setNoCustomComponent(t){this.store.actions.noCustomComponent(t)}setSession(t){this.store.actions.session(t),setTimeout(()=>this.updateIfNeeded())}setOpenExternalDocumentInNewTab(t){this.store.actions.openExternalDocumentInNewTab(t)}setNavigatorOnline(t){this.store.actions.navigatorOnline(t)}setForcedOffline(t){this.store.actions.forcedOffline(t)}setAuthenticationRequired(t){this.store.actions.authenticationRequired(t)}},pt=le.build();var g=function(e,t,r,n){var a=arguments.length,l=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,r,n);else for(var y=e.length-1;y>=0;y--)(c=e[y])&&(l=(a<3?c(l):a>3?c(t,r,l):c(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l},f=class extends M.FtLitElementRedux{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.authenticationRequired=!1,this.messageContexts=[],this.stateManager=pt}render(){return ht.html`
|
|
1
|
+
"use strict";(()=>{var vt=Object.create;var pe=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var It=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ot=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Rt(t))!bt.call(e,a)&&a!==r&&pe(e,a,{get:()=>t[a],enumerable:!(n=Ct(t,a))||n.enumerable});return e};var T=(e,t,r)=>(r=e!=null?vt(It(e)):{},Ot(t||!e||!e.__esModule?pe(r,"default",{value:e,enumerable:!0}):r,e));var R=G((Mt,he)=>{he.exports=ftGlobals.wcUtils});var ee=G((Nt,fe)=>{fe.exports=ftGlobals.lit});var Ae=G((Pt,ye)=>{ye.exports=ftGlobals.litDecorators});var ve=G((b,_e)=>{var $=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,z=function(){function e(){this.fetch=!1,this.DOMException=$.DOMException}return e.prototype=$,new e}();(function(e){var t=function(r){var n=typeof e<"u"&&e||typeof self<"u"&&self||typeof global<"u"&&global||{},a={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function l(s){return s&&DataView.prototype.isPrototypeOf(s)}if(a.arrayBuffer)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=ArrayBuffer.isView||function(s){return s&&c.indexOf(Object.prototype.toString.call(s))>-1};function v(s){if(typeof s!="string"&&(s=String(s)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(s)||s==="")throw new TypeError('Invalid character in header field name: "'+s+'"');return s.toLowerCase()}function N(s){return typeof s!="string"&&(s=String(s)),s}function Y(s){var i={next:function(){var o=s.shift();return{done:o===void 0,value:o}}};return a.iterable&&(i[Symbol.iterator]=function(){return i}),i}function A(s){this.map={},s instanceof A?s.forEach(function(i,o){this.append(o,i)},this):Array.isArray(s)?s.forEach(function(i){if(i.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+i.length);this.append(i[0],i[1])},this):s&&Object.getOwnPropertyNames(s).forEach(function(i){this.append(i,s[i])},this)}A.prototype.append=function(s,i){s=v(s),i=N(i);var o=this.map[s];this.map[s]=o?o+", "+i:i},A.prototype.delete=function(s){delete this.map[v(s)]},A.prototype.get=function(s){return s=v(s),this.has(s)?this.map[s]:null},A.prototype.has=function(s){return this.map.hasOwnProperty(v(s))},A.prototype.set=function(s,i){this.map[v(s)]=N(i)},A.prototype.forEach=function(s,i){for(var o in this.map)this.map.hasOwnProperty(o)&&s.call(i,this.map[o],o,this)},A.prototype.keys=function(){var s=[];return this.forEach(function(i,o){s.push(o)}),Y(s)},A.prototype.values=function(){var s=[];return this.forEach(function(i){s.push(i)}),Y(s)},A.prototype.entries=function(){var s=[];return this.forEach(function(i,o){s.push([o,i])}),Y(s)},a.iterable&&(A.prototype[Symbol.iterator]=A.prototype.entries);function Q(s){if(!s._noBody){if(s.bodyUsed)return Promise.reject(new TypeError("Already read"));s.bodyUsed=!0}}function oe(s){return new Promise(function(i,o){s.onload=function(){i(s.result)},s.onerror=function(){o(s.error)}})}function yt(s){var i=new FileReader,o=oe(i);return i.readAsArrayBuffer(s),o}function At(s){var i=new FileReader,o=oe(i),d=/charset=([A-Za-z0-9_-]+)/.exec(s.type),p=d?d[1]:"utf-8";return i.readAsText(s,p),o}function mt(s){for(var i=new Uint8Array(s),o=new Array(i.length),d=0;d<i.length;d++)o[d]=String.fromCharCode(i[d]);return o.join("")}function ue(s){if(s.slice)return s.slice(0);var i=new Uint8Array(s.byteLength);return i.set(new Uint8Array(s)),i.buffer}function ce(){return this.bodyUsed=!1,this._initBody=function(s){this.bodyUsed=this.bodyUsed,this._bodyInit=s,s?typeof s=="string"?this._bodyText=s:a.blob&&Blob.prototype.isPrototypeOf(s)?this._bodyBlob=s:a.formData&&FormData.prototype.isPrototypeOf(s)?this._bodyFormData=s:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(s)?this._bodyText=s.toString():a.arrayBuffer&&a.blob&&l(s)?(this._bodyArrayBuffer=ue(s.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(s)||y(s))?this._bodyArrayBuffer=ue(s):this._bodyText=s=Object.prototype.toString.call(s):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof s=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):a.searchParams&&URLSearchParams.prototype.isPrototypeOf(s)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var s=Q(this);if(s)return s;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var s=Q(this);return s||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(a.blob)return this.blob().then(yt);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var s=Q(this);if(s)return s;if(this._bodyBlob)return At(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(mt(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a.formData&&(this.formData=function(){return this.text().then(Tt)}),this.json=function(){return this.text().then(JSON.parse)},this}var Et=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function gt(s){var i=s.toUpperCase();return Et.indexOf(i)>-1?i:s}function I(s,i){if(!(this instanceof I))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');i=i||{};var o=i.body;if(s instanceof I){if(s.bodyUsed)throw new TypeError("Already read");this.url=s.url,this.credentials=s.credentials,i.headers||(this.headers=new A(s.headers)),this.method=s.method,this.mode=s.mode,this.signal=s.signal,!o&&s._bodyInit!=null&&(o=s._bodyInit,s.bodyUsed=!0)}else this.url=String(s);if(this.credentials=i.credentials||this.credentials||"same-origin",(i.headers||!this.headers)&&(this.headers=new A(i.headers)),this.method=gt(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal||function(){if("AbortController"in n){var u=new AbortController;return u.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&o)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(o),(this.method==="GET"||this.method==="HEAD")&&(i.cache==="no-store"||i.cache==="no-cache")){var d=/([?&])_=[^&]*/;if(d.test(this.url))this.url=this.url.replace(d,"$1_="+new Date().getTime());else{var p=/\?/;this.url+=(p.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}I.prototype.clone=function(){return new I(this,{body:this._bodyInit})};function Tt(s){var i=new FormData;return s.trim().split("&").forEach(function(o){if(o){var d=o.split("="),p=d.shift().replace(/\+/g," "),u=d.join("=").replace(/\+/g," ");i.append(decodeURIComponent(p),decodeURIComponent(u))}}),i}function St(s){var i=new A,o=s.replace(/\r?\n[\t ]+/g," ");return o.split("\r").map(function(d){return d.indexOf(`
|
|
2
|
+
`)===0?d.substr(1,d.length):d}).forEach(function(d){var p=d.split(":"),u=p.shift().trim();if(u){var K=p.join(":").trim();try{i.append(u,K)}catch(Z){console.warn("Response "+Z.message)}}}),i}ce.call(I.prototype);function C(s,i){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(i||(i={}),this.type="default",this.status=i.status===void 0?200:i.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=i.statusText===void 0?"":""+i.statusText,this.headers=new A(i.headers),this.url=i.url||"",this._initBody(s)}ce.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new A(this.headers),url:this.url})},C.error=function(){var s=new C(null,{status:200,statusText:""});return s.ok=!1,s.status=0,s.type="error",s};var _t=[301,302,303,307,308];C.redirect=function(s,i){if(_t.indexOf(i)===-1)throw new RangeError("Invalid status code");return new C(null,{status:i,headers:{location:s}})},r.DOMException=n.DOMException;try{new r.DOMException}catch{r.DOMException=function(i,o){this.message=i,this.name=o;var d=Error(i);this.stack=d.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function J(s,i){return new Promise(function(o,d){var p=new I(s,i);if(p.signal&&p.signal.aborted)return d(new r.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function K(){u.abort()}u.onload=function(){var E={statusText:u.statusText,headers:St(u.getAllResponseHeaders()||"")};p.url.indexOf("file://")===0&&(u.status<200||u.status>599)?E.status=200:E.status=u.status,E.url="responseURL"in u?u.responseURL:E.headers.get("X-Request-URL");var x="response"in u?u.response:u.responseText;setTimeout(function(){o(new C(x,E))},0)},u.onerror=function(){setTimeout(function(){d(new TypeError("Network request failed"))},0)},u.ontimeout=function(){setTimeout(function(){d(new TypeError("Network request timed out"))},0)},u.onabort=function(){setTimeout(function(){d(new r.DOMException("Aborted","AbortError"))},0)};function Z(E){try{return E===""&&n.location.href?n.location.href:E}catch{return E}}if(u.open(p.method,Z(p.url),!0),p.credentials==="include"?u.withCredentials=!0:p.credentials==="omit"&&(u.withCredentials=!1),"responseType"in u&&(a.blob?u.responseType="blob":a.arrayBuffer&&(u.responseType="arraybuffer")),i&&typeof i.headers=="object"&&!(i.headers instanceof A||n.Headers&&i.headers instanceof n.Headers)){var de=[];Object.getOwnPropertyNames(i.headers).forEach(function(E){de.push(v(E)),u.setRequestHeader(E,N(i.headers[E]))}),p.headers.forEach(function(E,x){de.indexOf(x)===-1&&u.setRequestHeader(x,E)})}else p.headers.forEach(function(E,x){u.setRequestHeader(x,E)});p.signal&&(p.signal.addEventListener("abort",K),u.onreadystatechange=function(){u.readyState===4&&p.signal.removeEventListener("abort",K)}),u.send(typeof p._bodyInit>"u"?null:p._bodyInit)})}return J.polyfill=!0,n.fetch||(n.fetch=J,n.Headers=A,n.Request=I,n.Response=C),r.Headers=A,r.Request=I,r.Response=C,r.fetch=J,r}({})})(z);z.fetch.ponyfill=!0;delete z.fetch.polyfill;var H=$.fetch?$:z;b=H.fetch;b.default=H.fetch;b.fetch=H.fetch;b.Headers=H.Headers;b.Request=H.Request;b.Response=H.Response;_e.exports=b});var ft=T(R());var ht=T(ee()),S=T(Ae()),M=T(R());var me=T(ee());var Ee=me.css`
|
|
3
|
+
`;var V=T(R()),xt="ft-app-info",P=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:t})}};P.eventName="authentication-change";var B=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:t})}};B.eventName="ui-locale-changed";var Lt={session:(e,t)=>{(0,V.deepEqual)(e.session,t.payload)||(e.session=t.payload,setTimeout(()=>h.dispatchEvent(new P(t.payload)),0))}},h=V.FtReduxStore.get({name:xt,reducers:Lt,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,searchLanguageSetsUiLanguage:!1,uiLanguageSetsSearchLanguage:!1,uiLanguageSetsReaderLanguage:!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 te=T(R());var L=class e{static get(t){let{baseUrl:r,apiIntegrationIdentifier:n}=h.getState(),a=t??n;if(r&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,a,!0)}static await(t){return new Promise(r=>{let n=e.get(t);if(n)r(n);else{let a=h.subscribe(()=>{n=e.get(t),n&&(a(),r(n))})}})}};var F=class{constructor(t){this.overrideApi=t}get api(){var t;return(t=this.overrideApi)!==null&&t!==void 0?t:L.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):L.await()}};var U=class extends F{constructor(t=!0,r){var n;super(r),this.sortObjectFields=(l,c)=>typeof c!="object"||c==null||Array.isArray(c)?c:Object.fromEntries(Object.entries(c).sort(([y],[v])=>y.localeCompare(v)));let a=this.constructor;a.commonCache=(n=a.commonCache)!==null&&n!==void 0?n:new te.CacheRegistry,this.cache=t?a.commonCache:new te.CacheRegistry}clearCache(){this.cache.clearAll()}hash(t){return String(Array.from(JSON.stringify(t,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var re=class{addCommand(t,r=!1){h.commands.add(t,r)}consumeCommand(t){return h.commands.consume(t)}};window.FluidTopicsAppInfoStoreService=new re;var _=T(R());var ge,k=class extends CustomEvent{constructor(t){super("ft-i18n-context-loaded",{detail:t})}},Ut=Symbol("clearAfterUnitTest"),q=class extends(0,_.withEventBus)(U){constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[ge]=()=>{this.defaultMessages={},this.cache=new _.CacheRegistry,this.listeners={}},this.currentUiLocale=h.getState().uiLocale,h.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:t}=h.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){let r=t.name.toLowerCase();this.cache.setFinal(r,t),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,r){var n;if(t=t.toLowerCase(),r&&Object.keys(r).length>0){let a={...(n=this.defaultMessages[t])!==null&&n!==void 0?n:{},...r};(0,_.deepEqual)(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}return this.fetchContext(t)}resolveContext(t){var r,n;return this.fetchContext(t),(n=(r=this.cache.getNow(t))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(t,r){let n=t.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(t,r,...n){var a;let l=t.toLowerCase(),c=this.resolveContext(l);return new _.ParametrizedLabelResolver((a=this.defaultMessages[l])!==null&&a!==void 0?a:{},c).resolve(r,...n)}async fetchContext(t){let r=!this.cache.has(t),n;try{n=await this.cache.get(t,()=>this.messageContextProvider(this.currentUiLocale,t)),r&&await this.notify(t)}catch(a){!(a instanceof _.CanceledPromiseError)&&r&&console.error(a)}return n}subscribe(t,r){var n;return t=t.toLowerCase(),this.listeners[t]=(n=this.listeners[t])!==null&&n!==void 0?n:new Set,this.listeners[t].add(r),()=>{var a;return(a=this.listeners[t])===null||a===void 0?void 0:a.delete(r)}}async notifyAll(){let t=Object.keys(this.listeners);document.body.dispatchEvent(new k({loadedContexts:t})),this.dispatchEvent(new k({loadedContexts:t})),await Promise.all(t.map(r=>this.notify(r,!1)))}async notify(t,r=!0){r&&(document.body.dispatchEvent(new k({loadedContexts:[t]})),this.dispatchEvent(new k({loadedContexts:[t]}))),this.listeners[t]!=null&&await Promise.all([...this.listeners[t].values()].map(n=>(0,_.delay)(0).then(()=>n()).catch(()=>null)))}};ge=Ut;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends q{constructor(){super(async(e,t)=>(await this.awaitApi).getFluidTopicsMessageContext(e,t))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends q{constructor(){super(async(e,t)=>(await this.awaitApi).getCustomMessageContext(e,t))}});var Te=window.FluidTopicsI18nService,Jt=window.FluidTopicsCustomI18nService;var Se=T(R()),se=class{highlightHtml(t,r,n){(0,Se.highlightHtml)(t,r,n)}};window.FluidTopicsHighlightHtmlService=new se;var Dt=T(ve(),1);var Ce;(function(e){e.black="black",e.green="green",e.blue="blue",e.purple="purple",e.red="red",e.orange="orange",e.yellow="yellow"})(Ce||(Ce={}));var Re;(function(e){e.OFFICIAL="OFFICIAL",e.PERSONAL="PERSONAL",e.SHARED="SHARED"})(Re||(Re={}));var Ie;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(Ie||(Ie={}));var be;(function(e){e.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",e.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",e.PERSONAL_BOOK="PERSONAL_BOOK",e.ATTACHMENT="ATTACHMENT",e.RESOURCE="RESOURCE",e.HTML_PACKAGE="HTML_PACKAGE"})(be||(be={}));var Oe;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(Oe||(Oe={}));var xe;(function(e){e.VALUE="VALUE",e.DATE="DATE",e.RANGE="RANGE"})(xe||(xe={}));var Le;(function(e){e.OFFICIAL="OFFICIAL",e.AI="AI"})(Le||(Le={}));var Ue;(function(e){e.BOOKMARK__CREATE="BOOKMARK__CREATE",e.BOOKMARK__DELETE="BOOKMARK__DELETE",e.CASE_DEFLECTION__START="CASE_DEFLECTION__START",e.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",e.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",e.CHATBOT__RATE="CHATBOT__RATE",e.COLLECTION__CREATE="COLLECTION__CREATE",e.COLLECTION__UPDATE="COLLECTION__UPDATE",e.COLLECTION__DELETE="COLLECTION__DELETE",e.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",e.DOCUMENT__ON_DEMAND_TRANSLATE="DOCUMENT__ON_DEMAND_TRANSLATE",e.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",e.DOCUMENT__PRINT="DOCUMENT__PRINT",e.DOCUMENT__PROCESS="DOCUMENT__PROCESS",e.DOCUMENT__RATE="DOCUMENT__RATE",e.DOCUMENT__SEARCH="DOCUMENT__SEARCH",e.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",e.DOCUMENT__UNRATE="DOCUMENT__UNRATE",e.FEEDBACK__SEND="FEEDBACK__SEND",e.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",e.AI__RATE="AI__RATE",e.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",e.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",e.KHUB__PROCESS="KHUB__PROCESS",e.KHUB__SEARCH="KHUB__SEARCH",e.LABELS__DOWNLOAD="LABELS__DOWNLOAD",e.LINK__SHARE="LINK__SHARE",e.PAGE__DISPLAY="PAGE__DISPLAY",e.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",e.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",e.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",e.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",e.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",e.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",e.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",e.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",e.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",e.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",e.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",e.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",e.TOPIC__RATE="TOPIC__RATE",e.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",e.TOPIC__UNRATE="TOPIC__UNRATE",e.USER__LOGIN="USER__LOGIN",e.USER__LOGOUT="USER__LOGOUT",e.HEARTBEAT="HEARTBEAT"})(Ue||(Ue={}));var De;(function(e){e.STANDARD="STANDARD",e.STRUCTURAL="STRUCTURAL"})(De||(De={}));var we;(function(e){e.THIRD_PARTY="THIRD_PARTY",e.OFF_THE_GRID="OFF_THE_GRID",e.CONTENT_PACKAGER="CONTENT_PACKAGER",e.PAGES="PAGES",e.DESIGNED_READER="DESIGNED_READER"})(we||(we={}));var Me;(function(e){e.HOMEPAGE="HOMEPAGE",e.CUSTOM="CUSTOM",e.HEADER="HEADER",e.READER="READER",e.TOPIC_TEMPLATE="TOPIC_TEMPLATE",e.SEARCH="SEARCH",e.SEARCH_RESULT="SEARCH_RESULT",e.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",e.LINK_PREVIEW="LINK_PREVIEW",e.UD_VIEWER="UD_VIEWER",e.ASSET_VIEWER="ASSET_VIEWER"})(Me||(Me={}));var Ne;(function(e){e.CLASSIC="CLASSIC",e.CUSTOM="CUSTOM",e.DESIGNER="DESIGNER"})(Ne||(Ne={}));var Pe;(function(e){e.AND="AND",e.OR="OR",e.MONOVALUED="MONOVALUED"})(Pe||(Pe={}));var Fe;(function(e){e.NONE="NONE",e.ALPHABET="ALPHABET",e.VERSION="VERSION"})(Fe||(Fe={}));var ke;(function(e){e.STARS="STARS",e.LIKE="LIKE",e.DICHOTOMOUS="DICHOTOMOUS",e.NO_RATING="NO_RATING"})(ke||(ke={}));var He;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR",e.CUSTOM="CUSTOM"})(He||(He={}));var Be;(function(e){e.OPTIONAL="OPTIONAL",e.MANDATORY="MANDATORY"})(Be||(Be={}));var je;(function(e){e.ASC="ASC",e.DESC="DESC"})(je||(je={}));var Ke;(function(e){e.ALPHA="ALPHA",e.NATURAL="NATURAL"})(Ke||(Ke={}));var Ge;(function(e){e.EVERYWHERE="EVERYWHERE",e.TITLE_ONLY="TITLE_ONLY",e.NONE="NONE"})(Ge||(Ge={}));var Ve;(function(e){e.ARTICLE="ARTICLE",e.BOOK="BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})(Ve||(Ve={}));var qe;(function(e){e.FLUIDTOPICS="FLUIDTOPICS",e.EXTERNAL="EXTERNAL"})(qe||(qe={}));var $e;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.PERSONAL_BOOK="PERSONAL_BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})($e||($e={}));var ze;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(ze||(ze={}));var We;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.HTML_PACKAGE="HTML_PACKAGE",e.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(We||(We={}));var Xe;(function(e){e.DEFAULT="DEFAULT",e.DOCUMENTS="DOCUMENTS",e.ALL_TOPICS="ALL_TOPICS",e.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Xe||(Xe={}));var Ye;(function(e){e.PLAIN_TEXT="PLAIN_TEXT",e.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",e.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(Ye||(Ye={}));var m;(function(e){e.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",e.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",e.HTML_EXPORT_USER="HTML_EXPORT_USER",e.PDF_EXPORT_USER="PDF_EXPORT_USER",e.SAVED_SEARCH_USER="SAVED_SEARCH_USER",e.COLLECTION_USER="COLLECTION_USER",e.OFFLINE_USER="OFFLINE_USER",e.ANALYTICS_USER="ANALYTICS_USER",e.BETA_USER="BETA_USER",e.DEBUG_USER="DEBUG_USER",e.PRINT_USER="PRINT_USER",e.RATING_USER="RATING_USER",e.FEEDBACK_USER="FEEDBACK_USER",e.GENERATIVE_AI_USER="GENERATIVE_AI_USER",e.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",e.CONTENT_PUBLISHER="CONTENT_PUBLISHER",e.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",e.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",e.KHUB_ADMIN="KHUB_ADMIN",e.USERS_ADMIN="USERS_ADMIN",e.PORTAL_ADMIN="PORTAL_ADMIN",e.ADMIN="ADMIN"})(m||(m={}));var Qe;(function(e){e.SEARCHES="SEARCHES",e.BOOKMARKS="BOOKMARKS",e.BOOKS="BOOKS",e.COLLECTIONS="COLLECTIONS"})(Qe||(Qe={}));var Je;(function(e){e.UNAUTHENTICATED="UNAUTHENTICATED",e.USER_INCOMPLETE="USER_INCOMPLETE",e.MFA_REQUIRED="MFA_REQUIRED",e.AUTHENTICATED="AUTHENTICATED"})(Je||(Je={}));var Ze;(function(e){e.VALID="VALID",e.INVALID="INVALID"})(Ze||(Ze={}));var et;(function(e){e.INACCURATE="INACCURATE",e.INCOMPLETE="INCOMPLETE",e.OFF_TOPIC="OFF_TOPIC",e.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",e.SUMMARY="SUMMARY",e.SEMANTIC_SEARCH="SEMANTIC_SEARCH",e.CHATBOT_INSTRUCTIONS="CHATBOT_INSTRUCTIONS",e.OTHER="OTHER"})(et||(et={}));var tt;(function(e){e.INACCURATE="INACCURATE",e.INCOMPLETE="INCOMPLETE",e.OFF_TOPIC="OFF_TOPIC",e.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",e.SLOW="SLOW",e.OTHER="OTHER"})(tt||(tt={}));var rt;(function(e){e.JSON="JSON",e.TEXT="TEXT"})(rt||(rt={}));var st;(function(e){e.JSON="JSON",e.TEXT="TEXT"})(st||(st={}));var nt;(function(e){e.USER="USER",e.ASSISTANT="ASSISTANT"})(nt||(nt={}));var it;(function(e){e.TEXT="TEXT",e.HTML="HTML"})(it||(it={}));var at;(function(e){e.HTML="HTML",e.MARKDOWN="MARKDOWN"})(at||(at={}));var lt;(function(e){e.MAP="MAP",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(lt||(lt={}));var cr={[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.BEHAVIOR_DATA_USER],[m.GENERATIVE_AI_EXPORT_USER]:[m.GENERATIVE_AI_USER]};var ot=T(R());var ne=class{isDate(t){var r,n,a,l;return(l=(a=((n=(r=h.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&n!==void 0?n:[]).find(y=>y.key===t))===null||a===void 0?void 0:a.date)!==null&&l!==void 0?l:!1}format(t,r){var n,a,l,c;if(t==null)return"";try{return ot.DateFormatter.format(t,(n=r?.locale)!==null&&n!==void 0?n:h.getState().uiLocale,(a=r?.longFormat)!==null&&a!==void 0?a:!1,(l=r?.withTime)!==null&&l!==void 0?l:!1,(c=r?.onlyTime)!==null&&c!==void 0?c:!1)}catch(y){throw console.error(`Date ${JSON.stringify(t)} is not valid`,y),y}}};window.FluidTopicsDateService=new ne;var ut=T(R());var j=class{static get(t,r){var n,a;let l=h.getState(),{lang:c,region:y}=(a=(n=l.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&a!==void 0?a:{lang:"en",region:"US"};return new ut.SearchPlaceConverter(l.baseUrl,t??20,l.searchInAllLanguagesAllowed,r??`${c}-${y}`)}};var ie=class{urlToSearchRequest(t){return j.get().parse(t)}searchRequestToUrl(t){return j.get().serialize(t)}};window.FluidTopicsUrlService=new ie;var O=T(R());var D=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:{currentItem:t}})}};D.eventName="change";var ae=class{itemName(t){return`fluid-topics-history-item-${t}`}get(t){let r=sessionStorage.getItem(this.itemName(t));return r?JSON.parse(r):void 0}set(t,r){sessionStorage.setItem(this.itemName(t),JSON.stringify(r))}},ct=new ae;var W=class e extends O.WithEventBus{static build(){return new e(window.history,ct,()=>window.location,!1)}constructor(t,r,n,a){var l,c;super(),this.history=t,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=t.pushState,this.realReplaceState=t.replaceState,this.initialIndex=(c=(l=t.state)===null||l===void 0?void 0:l.index)!==null&&c!==void 0?c:t.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(a)}setCurrentState(t,r=!1){let n=r&&this.currentIndex===t.index-1;this.currentState={...this.buildCurrentState(),...t},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,O.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new D(this.currentItem())),0)}installProxies(){let t=r=>(n,a,[l,c,y])=>{let v=r(),N={...v===this.currentIndex?this.currentState:void 0,...l,index:v,href:typeof y=="string"?y:(y??this.windowLocation()).href};n.apply(a,[N,c,y]),this.setCurrentState(N,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:t(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:t(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",t=>this.setCurrentState(t.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(t){for(let r=this.history.length-1;r>=0;r--)t?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(t){var r;let n={...this.buildCurrentState(),...t,index:this.currentIndex,title:(r=t?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(t){this.addEventListener(D.eventName,t)}removeHistoryChangeListener(t){this.removeEventListener(D.eventName,t)}currentItem(){return(0,O.deepCopy)(this.currentState)}back(){let t=this.previousDifferentMajorPosition();t>=0?this.history.go(t-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,O.deepCopy)(this.states[this.previousDifferentMajorPosition()])}previousDifferentMajorPosition(){let t=this.currentIndex>0?this.currentIndex-1:0;for(;t>0&&!this.isDifferentMajorState(t);)t--;return t}forward(){let t=this.nextMajorPosition();t&&t<this.states.length?this.history.go(t-this.currentIndex):this.history.forward()}forwardItem(){let t=this.nextMajorPosition();if(t)return(0,O.deepCopy)(this.states[t])}nextMajorPosition(){let t=this.currentIndex;if(!(t>=this.states.length)){do t++;while(t<this.states.length&&!this.isDifferentMajorState(t));return this.getHigherPositionInTheSameState(t)}}getHigherPositionInTheSameState(t){var r;let n=(r=this.states[t])===null||r===void 0?void 0:r.majorStateId;if(!n)return t;let a=t,l=t+1;for(;this.states.length>l&&!this.isDifferentMajorState(l,n);)this.hasState(l)&&(a=l),l++;return a}buildCurrentState(){var t,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(t=this.history.state)===null||t===void 0?void 0:t.title)!==null&&r!==void 0?r:document.title}}hasState(t){return this.states[t]!=null}isDifferentMajorState(t,r){var n;if(!this.hasState(t))return!1;let a=r??this.currentState.majorStateId,l=(n=this.states[t])===null||n===void 0?void 0:n.majorStateId;return l==null||l!=a}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=W.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),addHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(e),removeHistoryChangeListener:e=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(e)});var w=T(R());function dt(e,t){let{authenticationRequired:r,session:n}=h.getState();return r&&!n?.sessionAuthenticated?Promise.resolve(t):e()}var X=class extends F{async updateUiLocale(t){return(await this.awaitApi).updateUiLocale(t)}};var le=class e extends w.FtStateManager{static build(t){return new e(h,t)}constructor(t,r){super(),this.store=t,this.cache=new w.CacheRegistry,this.withManualResources=!0,this.localesConfiguration=null,this.userLocaleService=new X,this.cleanSessionDebouncer=new w.Debouncer,this.reloadDebouncer=new w.Debouncer(500),this.apiProvider=r??(()=>L.get())}setWithManualResources(t){this.withManualResources=t,this.updateIfNeeded()}async initService(){this.store.addEventListener(P.eventName,this.reloadConfiguration)}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.store.getState().session==null&&this.updateSession(),this.store.getState().metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),(this.store.getState().availableContentLocales==null||this.store.getState().availableContentLocales.length==0)&&this.updateAvailableContentLocales())}async updateSession(){let t=await this.cache.get("session",async()=>{let r=await this.apiProvider().getCurrentSession();return r.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.setSession(void 0)},r.idleTimeoutInMillis),r});this.setSession(t)}async updateMetadataConfiguration(){this.setMetadataConfiguration(await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration()))}async updateLocalesConfiguration(){this.setLocalesConfiguration(await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration()))}async updateAvailableContentLocales(){var t;let r=await this.cache.get("availableContentLocales",()=>dt(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}));this.setAvailableContentLocales((t=r.contentLocales)!==null&&t!==void 0?t:[])}reloadConfiguration(){var t;(t=this.cache)===null||t===void 0||t.clear("availableContentLocales"),typeof this.updateAvailableContentLocales=="function"&&this.updateAvailableContentLocales()}setBaseUrl(t){this.store.actions.baseUrl(t),window.fluidTopicsBaseUrl=t}setApiIntegrationIdentifier(t){this.store.actions.apiIntegrationIdentifier(t)}setApiIntegrationAppVersion(t){this.store.actions.apiIntegrationAppVersion(t)}setUiLocale(t){this.store.actions.uiLocale(t)}setLocalesConfiguration(t){var r,n,a,l,c;this.localesConfiguration=t,this.store.actions.defaultLocales(this.localesConfiguration.defaultLocales),this.store.actions.availableUiLocales((r=this.localesConfiguration.availableUiLocales)!==null&&r!==void 0?r:[]),this.store.actions.searchInAllLanguagesAllowed((n=this.localesConfiguration.allLanguagesAllowed)!==null&&n!==void 0?n:!1),this.store.actions.searchLanguageSetsUiLanguage((a=this.localesConfiguration.searchLanguageSetsUiLanguage)!==null&&a!==void 0?a:!1),this.store.actions.uiLanguageSetsSearchLanguage((l=this.localesConfiguration.uiLanguageSetsSearchLanguage)!==null&&l!==void 0?l:!1),this.store.actions.uiLanguageSetsReaderLanguage((c=this.localesConfiguration.uiLanguageSetsReaderLanguage)!==null&&c!==void 0?c:!1),setTimeout(()=>this.updateIfNeeded())}setAvailableContentLocales(t){this.store.actions.availableContentLocales(t),setTimeout(()=>this.updateIfNeeded())}stopReloadDebouncer(){this.reloadDebouncer.cancel()}requestUiLocaleUpdate(t){this.userLocaleService.updateUiLocale({uiLocale:t}).then(r=>{r.uiLocaleChanged&&(this.reloadDebouncer.run(()=>window.location.reload()),this.store.dispatchEvent(new B(r)))}).catch(()=>{})}setMetadataConfiguration(t){this.store.actions.metadataConfiguration(t),setTimeout(()=>this.updateIfNeeded())}setNoCustom(t){this.store.actions.noCustom(t)}setEditorMode(t){this.store.actions.editorMode(t)}setNoCustomComponent(t){this.store.actions.noCustomComponent(t)}setSession(t){this.store.actions.session(t),setTimeout(()=>this.updateIfNeeded())}setOpenExternalDocumentInNewTab(t){this.store.actions.openExternalDocumentInNewTab(t)}setNavigatorOnline(t){this.store.actions.navigatorOnline(t)}setForcedOffline(t){this.store.actions.forcedOffline(t)}setAuthenticationRequired(t){this.store.actions.authenticationRequired(t)}},pt=le.build();var g=function(e,t,r,n){var a=arguments.length,l=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,r,n);else for(var y=e.length-1;y>=0;y--)(c=e[y])&&(l=(a<3?c(l):a>3?c(t,r,l):c(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l},f=class extends M.FtLitElementRedux{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.authenticationRequired=!1,this.messageContexts=[],this.stateManager=pt}render(){return ht.html`
|
|
4
4
|
<slot></slot>
|
|
5
5
|
`}connectedCallback(){super.connectedCallback(),this.stateManager.initService()}disconnectedCallback(){super.disconnectedCallback()}update(t){var r;super.update(t),t.has("baseUrl")&&this.stateManager.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&this.stateManager.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("apiIntegrationAppVersion")&&this.stateManager.setApiIntegrationAppVersion(this.apiIntegrationAppVersion),t.has("uiLocale")&&this.stateManager.setUiLocale(this.uiLocale),t.has("metadataConfiguration")&&this.stateManager.setMetadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&this.stateManager.setNoCustom(this.noCustom),t.has("editorMode")&&this.stateManager.setEditorMode(this.editorMode),t.has("noCustomComponent")&&this.stateManager.setNoCustomComponent(this.noCustomComponent),t.has("session")&&this.stateManager.setSession(this.session),t.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(n=>Te.addContext(n)),t.has("openExternalDocumentInNewTab")&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&this.stateManager.setNavigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&this.stateManager.setForcedOffline(this.forcedOffline),t.has("authenticationRequired")&&this.stateManager.setAuthenticationRequired(this.authenticationRequired),t.has("withManualResources")&&((r=this.stateManager)===null||r===void 0||r.setWithManualResources(this.withManualResources)),setTimeout(()=>this.stateManager.updateIfNeeded())}};f.elementDefinitions={};f.styles=Ee;g([(0,S.property)()],f.prototype,"baseUrl",void 0);g([(0,S.property)()],f.prototype,"apiIntegrationIdentifier",void 0);g([(0,S.property)()],f.prototype,"apiIntegrationAppVersion",void 0);g([(0,S.property)()],f.prototype,"uiLocale",void 0);g([(0,M.jsonProperty)(null)],f.prototype,"availableUiLocales",void 0);g([(0,M.jsonProperty)(null)],f.prototype,"metadataConfiguration",void 0);g([(0,S.property)({type:Boolean})],f.prototype,"editorMode",void 0);g([(0,S.property)({type:Boolean})],f.prototype,"noCustom",void 0);g([(0,S.property)({type:Boolean})],f.prototype,"openExternalDocumentInNewTab",void 0);g([(0,S.property)({converter:{fromAttribute(e){return e==="false"?!1:e==="true"||(e??!1)}}})],f.prototype,"noCustomComponent",void 0);g([(0,S.property)({type:Boolean})],f.prototype,"withManualResources",void 0);g([(0,S.property)({type:Boolean})],f.prototype,"navigatorOnline",void 0);g([(0,S.property)({type:Boolean})],f.prototype,"forcedOffline",void 0);g([(0,S.property)({type:Boolean})],f.prototype,"authenticationRequired",void 0);g([(0,M.jsonProperty)([])],f.prototype,"messageContexts",void 0);g([(0,M.jsonProperty)(void 0)],f.prototype,"session",void 0);(0,ft.customElement)("ft-app-context")(f);})();
|