@fluid-topics/ft-app-context 2.0.14 → 2.0.16
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.
- package/build/ft-app-context.d.ts +4 -14
- package/build/ft-app-context.js +26 -89
- package/build/ft-app-context.light.js +4 -4
- package/build/ft-app-context.min.js +18 -18
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/redux-stores/FtAppInfoStore.d.ts +8 -1
- package/build/redux-stores/FtAppInfoStore.js +11 -3
- package/build/redux-stores/FtAppStateManager.d.ts +42 -0
- package/build/redux-stores/FtAppStateManager.js +153 -0
- package/build/services/history/HistoryService.models.js +1 -2
- package/build/services/user/UserLocaleService.d.ts +5 -0
- package/build/services/user/UserLocaleService.js +6 -0
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropertyValues } from "lit";
|
|
2
|
-
import { ElementDefinitionsMap,
|
|
2
|
+
import { ElementDefinitionsMap, FtLitElementRedux } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { FtAppContextProperties } from "./ft-app-context.properties";
|
|
4
|
-
import {
|
|
5
|
-
export declare class FtAppContext extends
|
|
4
|
+
import { FtMessageContext, FtMetadataConfiguration, FtSession, FtUiLocale } from "@fluid-topics/public-api";
|
|
5
|
+
export declare class FtAppContext extends FtLitElementRedux implements FtAppContextProperties {
|
|
6
6
|
static elementDefinitions: ElementDefinitionsMap;
|
|
7
7
|
static styles: import("lit").CSSResult;
|
|
8
8
|
baseUrl?: string;
|
|
@@ -18,22 +18,12 @@ export declare class FtAppContext extends FtLitElement implements FtAppContextPr
|
|
|
18
18
|
withManualResources: boolean;
|
|
19
19
|
navigatorOnline: boolean;
|
|
20
20
|
forcedOffline: boolean;
|
|
21
|
-
apiProvider: () => import("@fluid-topics/public-api").FluidTopicsApi | undefined;
|
|
22
21
|
authenticationRequired: boolean;
|
|
23
22
|
messageContexts: FtMessageContext[];
|
|
24
23
|
session?: FtSession;
|
|
25
|
-
|
|
26
|
-
availableContentLocales?: FtSearchLocales;
|
|
27
|
-
private cache;
|
|
24
|
+
stateManager: import("./redux-stores/FtAppStateManager").FtAppStateManager;
|
|
28
25
|
render(): import("lit-html").TemplateResult<1>;
|
|
29
26
|
connectedCallback(): void;
|
|
30
27
|
disconnectedCallback(): void;
|
|
31
28
|
update(props: PropertyValues<FtAppContext>): void;
|
|
32
|
-
private cleanSessionDebouncer;
|
|
33
|
-
private updateIfNeeded;
|
|
34
|
-
private updateSession;
|
|
35
|
-
private reloadConfiguration;
|
|
36
|
-
updateMetadataConfiguration(): Promise<void>;
|
|
37
|
-
updateLocalesConfiguration(): Promise<void>;
|
|
38
|
-
updateAvailableContentLocales(): Promise<void>;
|
|
39
29
|
}
|
package/build/ft-app-context.js
CHANGED
|
@@ -4,14 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from "lit";
|
|
8
|
-
import { property
|
|
9
|
-
import {
|
|
7
|
+
import { html, } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
9
|
+
import { FtLitElementRedux, jsonProperty, } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { styles } from "./ft-app-context.styles";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
class FtAppContext extends FtLitElement {
|
|
11
|
+
import { ftI18nService } from "./services";
|
|
12
|
+
import { ftAppStateManager } from "./redux-stores/FtAppStateManager";
|
|
13
|
+
export class FtAppContext extends FtLitElementRedux {
|
|
15
14
|
constructor() {
|
|
16
15
|
super(...arguments);
|
|
17
16
|
this.apiIntegrationIdentifier = "ft-integration";
|
|
@@ -24,15 +23,9 @@ class FtAppContext extends FtLitElement {
|
|
|
24
23
|
this.withManualResources = false;
|
|
25
24
|
this.navigatorOnline = false;
|
|
26
25
|
this.forcedOffline = false;
|
|
27
|
-
this.apiProvider = () => FluidTopicsApiProvider.get();
|
|
28
26
|
this.authenticationRequired = false;
|
|
29
27
|
this.messageContexts = [];
|
|
30
|
-
this.
|
|
31
|
-
this.cleanSessionDebouncer = new Debouncer();
|
|
32
|
-
this.reloadConfiguration = () => {
|
|
33
|
-
this.cache.clear("availableContentLocales");
|
|
34
|
-
this.updateAvailableContentLocales();
|
|
35
|
-
};
|
|
28
|
+
this.stateManager = ftAppStateManager;
|
|
36
29
|
}
|
|
37
30
|
render() {
|
|
38
31
|
return html `
|
|
@@ -41,106 +34,60 @@ class FtAppContext extends FtLitElement {
|
|
|
41
34
|
}
|
|
42
35
|
connectedCallback() {
|
|
43
36
|
super.connectedCallback();
|
|
44
|
-
|
|
37
|
+
this.stateManager.initService();
|
|
45
38
|
}
|
|
46
39
|
disconnectedCallback() {
|
|
47
|
-
ftAppInfoStore.addEventListener(AuthenticationChangeEvent.eventName, this.reloadConfiguration);
|
|
48
40
|
super.disconnectedCallback();
|
|
49
41
|
}
|
|
50
42
|
update(props) {
|
|
51
|
-
var _a
|
|
43
|
+
var _a;
|
|
52
44
|
super.update(props);
|
|
53
45
|
if (props.has("baseUrl")) {
|
|
54
|
-
|
|
55
|
-
window.fluidTopicsBaseUrl = this.baseUrl;
|
|
46
|
+
this.stateManager.setBaseUrl(this.baseUrl);
|
|
56
47
|
}
|
|
57
48
|
if (props.has("apiIntegrationIdentifier")) {
|
|
58
|
-
|
|
49
|
+
this.stateManager.setApiIntegrationIdentifier(this.apiIntegrationIdentifier);
|
|
59
50
|
}
|
|
60
51
|
if (props.has("apiIntegrationAppVersion")) {
|
|
61
|
-
|
|
52
|
+
this.stateManager.setApiIntegrationAppVersion(this.apiIntegrationAppVersion);
|
|
62
53
|
}
|
|
63
54
|
if (props.has("uiLocale")) {
|
|
64
|
-
|
|
55
|
+
this.stateManager.setUiLocale(this.uiLocale);
|
|
65
56
|
}
|
|
66
57
|
if (props.has("metadataConfiguration")) {
|
|
67
|
-
|
|
58
|
+
this.stateManager.setMetadataConfiguration(this.metadataConfiguration);
|
|
68
59
|
}
|
|
69
60
|
if (props.has("noCustom")) {
|
|
70
|
-
|
|
61
|
+
this.stateManager.setNoCustom(this.noCustom);
|
|
71
62
|
}
|
|
72
63
|
if (props.has("editorMode")) {
|
|
73
|
-
|
|
64
|
+
this.stateManager.setEditorMode(this.editorMode);
|
|
74
65
|
}
|
|
75
66
|
if (props.has("noCustomComponent")) {
|
|
76
|
-
|
|
67
|
+
this.stateManager.setNoCustomComponent(this.noCustomComponent);
|
|
77
68
|
}
|
|
78
69
|
if (props.has("session")) {
|
|
79
|
-
|
|
70
|
+
this.stateManager.setSession(this.session);
|
|
80
71
|
}
|
|
81
72
|
if (props.has("messageContexts") && this.messageContexts != null) {
|
|
82
|
-
this.messageContexts.forEach(context => ftI18nService.addContext(context));
|
|
73
|
+
this.messageContexts.forEach((context) => ftI18nService.addContext(context));
|
|
83
74
|
}
|
|
84
75
|
if (props.has("openExternalDocumentInNewTab")) {
|
|
85
|
-
|
|
76
|
+
this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab);
|
|
86
77
|
}
|
|
87
78
|
if (props.has("navigatorOnline")) {
|
|
88
|
-
|
|
79
|
+
this.stateManager.setNavigatorOnline(this.navigatorOnline);
|
|
89
80
|
}
|
|
90
81
|
if (props.has("forcedOffline")) {
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
if (props.has("localesConfiguration")) {
|
|
94
|
-
ftAppInfoStore.actions.defaultLocales((_a = this.localesConfiguration) === null || _a === void 0 ? void 0 : _a.defaultLocales);
|
|
95
|
-
ftAppInfoStore.actions.availableUiLocales((_c = (_b = this.localesConfiguration) === null || _b === void 0 ? void 0 : _b.availableUiLocales) !== null && _c !== void 0 ? _c : []);
|
|
96
|
-
ftAppInfoStore.actions.searchInAllLanguagesAllowed((_e = (_d = this.localesConfiguration) === null || _d === void 0 ? void 0 : _d.allLanguagesAllowed) !== null && _e !== void 0 ? _e : false);
|
|
82
|
+
this.stateManager.setForcedOffline(this.forcedOffline);
|
|
97
83
|
}
|
|
98
84
|
if (props.has("authenticationRequired")) {
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
if (props.has("availableContentLocales")) {
|
|
102
|
-
ftAppInfoStore.actions.availableContentLocales((_g = (_f = this.availableContentLocales) === null || _f === void 0 ? void 0 : _f.contentLocales) !== null && _g !== void 0 ? _g : []);
|
|
85
|
+
this.stateManager.setAuthenticationRequired(this.authenticationRequired);
|
|
103
86
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
async updateIfNeeded() {
|
|
107
|
-
if (this.apiProvider()) {
|
|
108
|
-
if (!this.withManualResources) {
|
|
109
|
-
if (this.session == null) {
|
|
110
|
-
this.updateSession();
|
|
111
|
-
}
|
|
112
|
-
if (this.metadataConfiguration == null) {
|
|
113
|
-
this.updateMetadataConfiguration();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (this.localesConfiguration == null) {
|
|
117
|
-
this.updateLocalesConfiguration();
|
|
118
|
-
}
|
|
119
|
-
if (this.availableContentLocales == null) {
|
|
120
|
-
this.updateAvailableContentLocales();
|
|
121
|
-
}
|
|
87
|
+
if (props.has("withManualResources")) {
|
|
88
|
+
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setWithManualResources(this.withManualResources);
|
|
122
89
|
}
|
|
123
|
-
|
|
124
|
-
async updateSession() {
|
|
125
|
-
this.session = await this.cache.get("session", async () => {
|
|
126
|
-
const currentSession = await this.apiProvider().getCurrentSession();
|
|
127
|
-
if (currentSession.idleTimeoutInMillis > 0) {
|
|
128
|
-
this.cleanSessionDebouncer.run(() => {
|
|
129
|
-
this.cache.clear("session");
|
|
130
|
-
this.session = undefined;
|
|
131
|
-
}, currentSession.idleTimeoutInMillis);
|
|
132
|
-
}
|
|
133
|
-
return currentSession;
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
async updateMetadataConfiguration() {
|
|
137
|
-
this.metadataConfiguration = await this.cache.get("metadataConfiguration", () => this.apiProvider().getMetadataConfiguration());
|
|
138
|
-
}
|
|
139
|
-
async updateLocalesConfiguration() {
|
|
140
|
-
this.localesConfiguration = await this.cache.get("localesConfiguration", () => this.apiProvider().getLocalesConfiguration());
|
|
141
|
-
}
|
|
142
|
-
async updateAvailableContentLocales() {
|
|
143
|
-
this.availableContentLocales = await this.cache.get("availableContentLocales", () => getOrDefaultIfMissingRequiredAuthentication(() => this.apiProvider().getAvailableSearchLocales(), { contentLocales: [] }));
|
|
90
|
+
setTimeout(() => this.stateManager.updateIfNeeded());
|
|
144
91
|
}
|
|
145
92
|
}
|
|
146
93
|
FtAppContext.elementDefinitions = {};
|
|
@@ -190,9 +137,6 @@ __decorate([
|
|
|
190
137
|
__decorate([
|
|
191
138
|
property({ type: Boolean })
|
|
192
139
|
], FtAppContext.prototype, "forcedOffline", void 0);
|
|
193
|
-
__decorate([
|
|
194
|
-
property({ type: Object })
|
|
195
|
-
], FtAppContext.prototype, "apiProvider", void 0);
|
|
196
140
|
__decorate([
|
|
197
141
|
property({ type: Boolean })
|
|
198
142
|
], FtAppContext.prototype, "authenticationRequired", void 0);
|
|
@@ -202,10 +146,3 @@ __decorate([
|
|
|
202
146
|
__decorate([
|
|
203
147
|
jsonProperty(undefined)
|
|
204
148
|
], FtAppContext.prototype, "session", void 0);
|
|
205
|
-
__decorate([
|
|
206
|
-
state()
|
|
207
|
-
], FtAppContext.prototype, "localesConfiguration", void 0);
|
|
208
|
-
__decorate([
|
|
209
|
-
state()
|
|
210
|
-
], FtAppContext.prototype, "availableContentLocales", void 0);
|
|
211
|
-
export { FtAppContext };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`)===0?
|
|
3
|
-
`;var j=_(O()),vt="ft-app-info",U=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:t})}};U.eventName="authentication-change";var Ct={session:(e,t)=>{(0,j.deepEqual)(e.session,t.payload)||(e.session=t.payload,setTimeout(()=>o.dispatchEvent(new U(t.payload)),0))}},o=j.FtReduxStore.get({name:vt,reducers:Ct,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 J=_(O());var w=class e{static get(t){let{baseUrl:n,apiIntegrationIdentifier:s}=o.getState(),a=t??s;if(n&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(n,a,!0)}static await(t){return new Promise(n=>{let s=e.get(t);if(s)n(s);else{let a=o.subscribe(()=>{s=e.get(t),s&&(a(),n(s))})}})}};var K=class{constructor(t){this.overrideApi=t}get api(){var t;return(t=this.overrideApi)!==null&&t!==void 0?t:w.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):w.await()}};var P=class extends K{constructor(t=!0,n){var s;super(n),this.sortObjectFields=(l,d)=>typeof d!="object"||d==null||Array.isArray(d)?d:Object.fromEntries(Object.entries(d).sort(([h],[S])=>h.localeCompare(S)));let a=this.constructor;a.commonCache=(s=a.commonCache)!==null&&s!==void 0?s:new J.CacheRegistry,this.cache=t?a.commonCache:new J.CacheRegistry}clearCache(){this.cache.clearAll()}hash(t){return String(Array.from(JSON.stringify(t,this.sortObjectFields)).reduce((n,s)=>0|31*n+s.charCodeAt(0),0))}};var Z=class{addCommand(t,n=!1){o.commands.add(t,n)}consumeCommand(t){return o.commands.consume(t)}};window.FluidTopicsAppInfoStoreService=new Z;var v=_(O());var ye,M=class extends CustomEvent{constructor(t){super("ft-i18n-context-loaded",{detail:t})}},Rt=Symbol("clearAfterUnitTest"),G=class extends(0,v.withEventBus)(P){constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[ye]=()=>{this.defaultMessages={},this.cache=new v.CacheRegistry,this.listeners={}},this.currentUiLocale=o.getState().uiLocale,o.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:t}=o.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){let n=t.name.toLowerCase();this.cache.setFinal(n,t),this.notify(n)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,n){var s;if(t=t.toLowerCase(),n&&Object.keys(n).length>0){let a={...(s=this.defaultMessages[t])!==null&&s!==void 0?s:{},...n};(0,v.deepEqual)(this.defaultMessages[t],a)||(this.defaultMessages[t]=a,await this.notify(t))}return this.fetchContext(t)}resolveContext(t){var n,s;return this.fetchContext(t),(s=(n=this.cache.getNow(t))===null||n===void 0?void 0:n.messages)!==null&&s!==void 0?s:{}}resolveRawMessage(t,n){let s=t.toLowerCase();return this.resolveContext(s)[n]}resolveMessage(t,n,...s){var a;let l=t.toLowerCase(),d=this.resolveContext(l);return new v.ParametrizedLabelResolver((a=this.defaultMessages[l])!==null&&a!==void 0?a:{},d).resolve(n,...s)}async fetchContext(t){let n=!this.cache.has(t),s;try{s=await this.cache.get(t,()=>this.messageContextProvider(this.currentUiLocale,t)),n&&await this.notify(t)}catch(a){!(a instanceof v.CanceledPromiseError)&&n&&console.error(a)}return s}subscribe(t,n){var s;return t=t.toLowerCase(),this.listeners[t]=(s=this.listeners[t])!==null&&s!==void 0?s:new Set,this.listeners[t].add(n),()=>{var a;return(a=this.listeners[t])===null||a===void 0?void 0:a.delete(n)}}async notifyAll(){let t=Object.keys(this.listeners);document.body.dispatchEvent(new M({loadedContexts:t})),this.dispatchEvent(new M({loadedContexts:t})),await Promise.all(t.map(n=>this.notify(n,!1)))}async notify(t,n=!0){n&&(document.body.dispatchEvent(new M({loadedContexts:[t]})),this.dispatchEvent(new M({loadedContexts:[t]}))),this.listeners[t]!=null&&await Promise.all([...this.listeners[t].values()].map(s=>(0,v.delay)(0).then(()=>s()).catch(()=>null)))}};ye=Rt;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends G{constructor(){super(async(e,t)=>(await this.awaitApi).getFluidTopicsMessageContext(e,t))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends G{constructor(){super(async(e,t)=>(await this.awaitApi).getCustomMessageContext(e,t))}});var Ae=window.FluidTopicsI18nService,$t=window.FluidTopicsCustomI18nService;var Ee=_(O()),ee=class{highlightHtml(t,n,s){(0,Ee.highlightHtml)(t,n,s)}};window.FluidTopicsHighlightHtmlService=new ee;var Ot=_(Te(),1);var ge;(function(e){e.black="black",e.green="green",e.blue="blue",e.purple="purple",e.red="red",e.orange="orange",e.yellow="yellow"})(ge||(ge={}));var Se;(function(e){e.OFFICIAL="OFFICIAL",e.PERSONAL="PERSONAL",e.SHARED="SHARED"})(Se||(Se={}));var _e;(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"})(_e||(_e={}));var ve;(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"})(ve||(ve={}));var Ce;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(Ce||(Ce={}));var Re;(function(e){e.VALUE="VALUE",e.DATE="DATE",e.RANGE="RANGE"})(Re||(Re={}));var Oe;(function(e){e.OFFICIAL="OFFICIAL",e.AI="AI"})(Oe||(Oe={}));var be;(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"})(be||(be={}));var Ie;(function(e){e.STANDARD="STANDARD",e.STRUCTURAL="STRUCTURAL"})(Ie||(Ie={}));var xe;(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"})(xe||(xe={}));var Le;(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"})(Le||(Le={}));var De;(function(e){e.CLASSIC="CLASSIC",e.CUSTOM="CUSTOM",e.DESIGNER="DESIGNER"})(De||(De={}));var Ue;(function(e){e.AND="AND",e.OR="OR",e.MONOVALUED="MONOVALUED"})(Ue||(Ue={}));var we;(function(e){e.NONE="NONE",e.ALPHABET="ALPHABET",e.VERSION="VERSION"})(we||(we={}));var Pe;(function(e){e.STARS="STARS",e.LIKE="LIKE",e.DICHOTOMOUS="DICHOTOMOUS",e.NO_RATING="NO_RATING"})(Pe||(Pe={}));var Ne;(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"})(Ne||(Ne={}));var Me;(function(e){e.OPTIONAL="OPTIONAL",e.MANDATORY="MANDATORY"})(Me||(Me={}));var Fe;(function(e){e.ASC="ASC",e.DESC="DESC"})(Fe||(Fe={}));var ke;(function(e){e.ALPHA="ALPHA",e.NATURAL="NATURAL"})(ke||(ke={}));var He;(function(e){e.EVERYWHERE="EVERYWHERE",e.TITLE_ONLY="TITLE_ONLY",e.NONE="NONE"})(He||(He={}));var Be;(function(e){e.ARTICLE="ARTICLE",e.BOOK="BOOK",e.SHARED_BOOK="SHARED_BOOK",e.HTML_PACKAGE="HTML_PACKAGE"})(Be||(Be={}));var je;(function(e){e.FLUIDTOPICS="FLUIDTOPICS",e.EXTERNAL="EXTERNAL"})(je||(je={}));var Ke;(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"})(Ke||(Ke={}));var Ge;(function(e){e.LAST_WEEK="LAST_WEEK",e.LAST_MONTH="LAST_MONTH",e.LAST_QUARTER="LAST_QUARTER",e.LAST_YEAR="LAST_YEAR"})(Ge||(Ge={}));var Ve;(function(e){e.MAP="MAP",e.DOCUMENT="DOCUMENT",e.TOPIC="TOPIC",e.HTML_PACKAGE="HTML_PACKAGE",e.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(Ve||(Ve={}));var qe;(function(e){e.DEFAULT="DEFAULT",e.DOCUMENTS="DOCUMENTS",e.ALL_TOPICS="ALL_TOPICS",e.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(qe||(qe={}));var $e;(function(e){e.PLAIN_TEXT="PLAIN_TEXT",e.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",e.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})($e||($e={}));var E;(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"})(E||(E={}));var ze;(function(e){e.SEARCHES="SEARCHES",e.BOOKMARKS="BOOKMARKS",e.BOOKS="BOOKS",e.COLLECTIONS="COLLECTIONS"})(ze||(ze={}));var We;(function(e){e.UNAUTHENTICATED="UNAUTHENTICATED",e.USER_INCOMPLETE="USER_INCOMPLETE",e.MFA_REQUIRED="MFA_REQUIRED",e.AUTHENTICATED="AUTHENTICATED"})(We||(We={}));var Ye;(function(e){e.VALID="VALID",e.INVALID="INVALID"})(Ye||(Ye={}));var Qe;(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"})(Qe||(Qe={}));var Xe;(function(e){e.INACCURATE="INACCURATE",e.INCOMPLETE="INCOMPLETE",e.OFF_TOPIC="OFF_TOPIC",e.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",e.SLOW="SLOW",e.OTHER="OTHER"})(Xe||(Xe={}));var Je;(function(e){e.JSON="JSON",e.TEXT="TEXT"})(Je||(Je={}));var Ze;(function(e){e.USER="USER",e.ASSISTANT="ASSISTANT"})(Ze||(Ze={}));var et;(function(e){e.TEXT="TEXT",e.HTML="HTML"})(et||(et={}));var tt;(function(e){e.HTML="HTML",e.MARKDOWN="MARKDOWN"})(tt||(tt={}));var rt;(function(e){e.MAP="MAP",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(rt||(rt={}));var sr={[E.PERSONAL_BOOK_SHARE_USER]:[E.PERSONAL_BOOK_USER],[E.HTML_EXPORT_USER]:[E.PERSONAL_BOOK_USER],[E.PDF_EXPORT_USER]:[E.PERSONAL_BOOK_USER],[E.KHUB_ADMIN]:[E.CONTENT_PUBLISHER],[E.ADMIN]:[E.KHUB_ADMIN,E.USERS_ADMIN,E.PORTAL_ADMIN,E.BEHAVIOR_DATA_USER],[E.GENERATIVE_AI_EXPORT_USER]:[E.GENERATIVE_AI_USER]};var nt=_(O());var te=class{isDate(t){var n,s,a,l;return(l=(a=((s=(n=o.getState().metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&s!==void 0?s:[]).find(h=>h.key===t))===null||a===void 0?void 0:a.date)!==null&&l!==void 0?l:!1}format(t,n){var s,a,l,d;if(t==null)return"";try{return nt.DateFormatter.format(t,(s=n?.locale)!==null&&s!==void 0?s:o.getState().uiLocale,(a=n?.longFormat)!==null&&a!==void 0?a:!1,(l=n?.withTime)!==null&&l!==void 0?l:!1,(d=n?.onlyTime)!==null&&d!==void 0?d:!1)}catch(h){throw console.error(`Date ${JSON.stringify(t)} is not valid`,h),h}}};window.FluidTopicsDateService=new te;var st=_(O());var k=class{static get(t,n){var s,a;let l=o.getState(),{lang:d,region:h}=(a=(s=l.defaultLocales)===null||s===void 0?void 0:s.defaultContentLocale)!==null&&a!==void 0?a:{lang:"en",region:"US"};return new st.SearchPlaceConverter(l.baseUrl,t??20,l.searchInAllLanguagesAllowed,n??`${d}-${h}`)}};var re=class{urlToSearchRequest(t){return k.get().parse(t)}searchRequestToUrl(t){return k.get().serialize(t)}};window.FluidTopicsUrlService=new re;var L=_(O());var N=class e extends CustomEvent{constructor(t){super(e.eventName,{detail:{currentItem:t}})}};N.eventName="change";var ne=class{itemName(t){return`fluid-topics-history-item-${t}`}get(t){let n=sessionStorage.getItem(this.itemName(t));return n?JSON.parse(n):void 0}set(t,n){sessionStorage.setItem(this.itemName(t),JSON.stringify(n))}},it=new ne;var $=class e extends L.WithEventBus{static build(){return new e(window.history,it,()=>window.location,!1)}constructor(t,n,s,a){var l,d;super(),this.history=t,this.historyStorage=n,this.windowLocation=s,this.states=[],this.realPushState=t.pushState,this.realReplaceState=t.replaceState,this.initialIndex=(d=(l=t.state)===null||l===void 0?void 0:l.index)!==null&&d!==void 0?d:t.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(a)}setCurrentState(t,n=!1){let s=n&&this.currentIndex===t.index-1;this.currentState={...this.buildCurrentState(),...t},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,s&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,L.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new N(this.currentItem())),0)}installProxies(){let t=n=>(s,a,[l,d,h])=>{let S=n(),b={...S===this.currentIndex?this.currentState:void 0,...l,index:S,href:typeof h=="string"?h:(h??this.windowLocation()).href};s.apply(a,[b,d,h]),this.setCurrentState(b,!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 n=this.history.length-1;n>=0;n--)t?this.states[n]=this.historyStorage.get(n):setTimeout(()=>this.states[n]=this.historyStorage.get(n),this.history.length-n)}updateCurrentState(t){var n;let s={...this.buildCurrentState(),...t,index:this.currentIndex,title:(n=t?.title)!==null&&n!==void 0?n:this.currentState.title};this.setCurrentState(s)}addHistoryChangeListener(t){this.addEventListener(N.eventName,t)}removeHistoryChangeListener(t){this.removeEventListener(N.eventName,t)}currentItem(){return(0,L.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,L.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,L.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 n;let s=(n=this.states[t])===null||n===void 0?void 0:n.majorStateId;if(!s)return t;let a=t,l=t+1;for(;this.states.length>l&&!this.isDifferentMajorState(l,s);)this.hasState(l)&&(a=l),l++;return a}buildCurrentState(){var t,n;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(n=(t=this.history.state)===null||t===void 0?void 0:t.title)!==null&&n!==void 0?n:document.title}}hasState(t){return this.states[t]!=null}isDifferentMajorState(t,n){var s;if(!this.hasState(t))return!1;let a=n??this.currentState.majorStateId,l=(s=this.states[t])===null||s===void 0?void 0:s.majorStateId;return l==null||l!=a}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=$.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)});function at(e,t){let{authenticationRequired:n,session:s}=o.getState();return n&&!s?.sessionAuthenticated?Promise.resolve(t):e()}var m=function(e,t,n,s){var a=arguments.length,l=a<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,t,n,s);else for(var h=e.length-1;h>=0;h--)(d=e[h])&&(l=(a<3?d(l):a>3?d(t,n,l):d(t,n))||l);return a>3&&l&&Object.defineProperty(t,n,l),l},f=class extends R.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=()=>w.get(),this.authenticationRequired=!1,this.messageContexts=[],this.cache=new R.CacheRegistry,this.cleanSessionDebouncer=new R.Debouncer,this.reloadConfiguration=()=>{this.cache.clear("availableContentLocales"),this.updateAvailableContentLocales()}}render(){return lt.html`
|
|
1
|
+
"use strict";(()=>{var _t=Object.create;var pe=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,It=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 Ct(t))!It.call(e,a)&&a!==r&&pe(e,a,{get:()=>t[a],enumerable:!(n=vt(t,a))||n.enumerable});return e};var T=(e,t,r)=>(r=e!=null?_t(Rt(e)):{},Ot(t||!e||!e.__esModule?pe(r,"default",{value:e,enumerable:!0}):r,e));var R=G((wt,he)=>{he.exports=ftGlobals.wcUtils});var ee=G((Mt,fe)=>{fe.exports=ftGlobals.lit});var Ae=G((Nt,ye)=>{ye.exports=ftGlobals.litDecorators});var ve=G((O,_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 Q(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)}),Q(s)},A.prototype.values=function(){var s=[];return this.forEach(function(i){s.push(i)}),Q(s)},A.prototype.entries=function(){var s=[];return this.forEach(function(i,o){s.push([o,i])}),Q(s)},a.iterable&&(A.prototype[Symbol.iterator]=A.prototype.entries);function X(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 ft(s){var i=new FileReader,o=oe(i);return i.readAsArrayBuffer(s),o}function yt(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 At(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=X(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=X(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(ft);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var s=X(this);if(s)return s;if(this._bodyBlob)return yt(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(At(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(gt)}),this.json=function(){return this.text().then(JSON.parse)},this}var mt=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function Et(s){var i=s.toUpperCase();return mt.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=Et(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 gt(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 Tt(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 St=[301,302,303,307,308];C.redirect=function(s,i){if(St.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:Tt(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;O=H.fetch;O.default=H.fetch;O.fetch=H.fetch;O.Headers=H.Headers;O.Request=H.Request;O.Response=H.Response;_e.exports=O});var ht=T(R());var pt=T(ee()),S=T(Ae()),M=T(R());var me=T(ee());var Ee=me.css`
|
|
3
|
+
`;var V=T(R()),bt="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 xt={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:bt,reducers:xt,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})}},Lt=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=Lt;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,Xt=window.FluidTopicsCustomI18nService;var Se=T(R()),se=class{highlightHtml(t,r,n){(0,Se.highlightHtml)(t,r,n)}};window.FluidTopicsHighlightHtmlService=new se;var Ut=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 Ye;(function(e){e.DEFAULT="DEFAULT",e.DOCUMENTS="DOCUMENTS",e.ALL_TOPICS="ALL_TOPICS",e.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(Ye||(Ye={}));var Qe;(function(e){e.PLAIN_TEXT="PLAIN_TEXT",e.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",e.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(Qe||(Qe={}));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 Xe;(function(e){e.SEARCHES="SEARCHES",e.BOOKMARKS="BOOKMARKS",e.BOOKS="BOOKS",e.COLLECTIONS="COLLECTIONS"})(Xe||(Xe={}));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.USER="USER",e.ASSISTANT="ASSISTANT"})(st||(st={}));var nt;(function(e){e.TEXT="TEXT",e.HTML="HTML"})(nt||(nt={}));var it;(function(e){e.HTML="HTML",e.MARKDOWN="MARKDOWN"})(it||(it={}));var at;(function(e){e.MAP="MAP",e.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(at||(at={}));var ur={[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 lt=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 lt.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 ot=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 ot.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))}},ut=new ae;var W=class e extends b.WithEventBus{static build(){return new e(window.history,ut,()=>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 ct(e,t){let{authenticationRequired:r,session:n}=h.getState();return r&&!n?.sessionAuthenticated?Promise.resolve(t):e()}var Y=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 Y,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",()=>ct(()=>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)}},dt=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=dt}render(){return pt.html`
|
|
4
4
|
<slot></slot>
|
|
5
|
-
`}connectedCallback(){super.connectedCallback(),
|
|
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,ht.customElement)("ft-app-context")(f);})();
|