@fluid-topics/public-api 1.0.73 → 1.0.75

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.
@@ -46,9 +46,12 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
46
46
  function reject(value) { resume("throw", value); }
47
47
  function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
48
48
  };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
49
52
  Object.defineProperty(exports, "__esModule", { value: true });
50
53
  exports.FluidTopicsApi = exports.HttpErrorEvent = exports.HttpError = void 0;
51
- require("cross-fetch/polyfill");
54
+ const cross_fetch_1 = __importDefault(require("cross-fetch"));
52
55
  const GenAIChunkReader_1 = require("./helpers/GenAIChunkReader");
53
56
  const wnd = (typeof window === "undefined" ? globalThis : window);
54
57
  __exportStar(require("./types/ft-common/public"), exports);
@@ -416,7 +419,7 @@ class FluidTopicsApi {
416
419
  var _a;
417
420
  return __awaiter(this, void 0, void 0, function* () {
418
421
  const requestInit = init;
419
- return yield fetch(this.makeAbsolute(endpoint), Object.assign(Object.assign({}, (requestInit !== null && requestInit !== void 0 ? requestInit : {})), { headers: Object.assign(Object.assign({}, this.defaultHeaders), ((_a = requestInit === null || requestInit === void 0 ? void 0 : requestInit.headers) !== null && _a !== void 0 ? _a : {})) }));
422
+ return yield (0, cross_fetch_1.default)(this.makeAbsolute(endpoint), Object.assign(Object.assign({}, (requestInit !== null && requestInit !== void 0 ? requestInit : {})), { headers: Object.assign(Object.assign({}, this.defaultHeaders), ((_a = requestInit === null || requestInit === void 0 ? void 0 : requestInit.headers) !== null && _a !== void 0 ? _a : {})) }));
420
423
  });
421
424
  }
422
425
  upload(method, endpoint, body, onProgress = () => undefined) {
@@ -454,7 +457,7 @@ class FluidTopicsApi {
454
457
  .then(getBody);
455
458
  }
456
459
  fetchRawData(endpoint, v) {
457
- return fetch(this.withVersion(endpoint, v), {
460
+ return (0, cross_fetch_1.default)(this.withVersion(endpoint, v), {
458
461
  headers: this.defaultHeaders,
459
462
  credentials: this.authorization == null ? "include" : undefined
460
463
  })
@@ -1,4 +1,3 @@
1
- import "cross-fetch/polyfill";
2
1
  import { FtAuthenticatedSession, FtBookmark, FtCollectionDocument, FtHttpErrorDetails, FtMap, FtMapResource, FtMessageContext, FtMetadataConfiguration, FtMySearch, FtRatingSummary, FtRatingType, FtRatingTypeKeys, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSession, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUiLocale, FtUnstructuredDocument } from "./types/ft-common/public";
3
2
  import { FtClusteredSemanticSearchReply, FtGenAIRating, FtMapAttachment, FtPaginatedToc, FtRagInput, FtReaderConfiguration, FtSemanticSearchRequest, FtSemanticSearchResponseItem } from "./types/ft-server/public";
4
3
  import { GenAIChunk } from "./helpers/GenAIChunkReader";
@@ -1,4 +1,4 @@
1
- import "cross-fetch/polyfill";
1
+ import fetch from "cross-fetch";
2
2
  import { GenAIChunkReader } from "./helpers/GenAIChunkReader";
3
3
  const wnd = (typeof window === "undefined" ? globalThis : window);
4
4
  export * from "./types/ft-common/public";
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function n(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||a(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=n(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=n(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function A(e,t){var r,i,a=(t=t||{}).body;if(e instanceof A){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,a||null==e._bodyInit||(a=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&a)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(a)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),a=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(a))}})),t}function f(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},h.call(A.prototype),h.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},f.error=function(){var e=new f(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];f.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new f(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function g(e,i){return new Promise((function(a,s){var n=new A(e,i);if(n.signal&&n.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var a=r.join(":").trim();t.append(i,a)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;a(new f(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(n.method,n.url,!0),"include"===n.credentials?o.withCredentials=!0:"omit"===n.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),n.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),n.signal&&(n.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&n.signal.removeEventListener("abort",u)}),o.send(void 0===n._bodyInit?null:n._bodyInit)}))}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=l,e.Request=A,e.Response=f),t.Headers=l,t.Request=A,t.Response=f,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);class r{reader;decoder=new TextDecoder;partialChunk="";constructor(e){this.reader=e}async*read(){for(;;){const{done:e,value:t}=await this.reader.read();if(e)return void(yield*this.readRemainingChunks());yield*this.readChunksFromValue(t)}}*readRemainingChunks(){yield*this.parseLine(this.partialChunk)}*readChunksFromValue(e){const t=(this.partialChunk+this.decoder.decode(e)).split("\n");this.partialChunk=t.pop();for(let e of t)yield*this.parseLine(e)}*parseLine(e){const[t,r]=e.split(/:(.*)/);"data"==t&&r.length>0&&(yield JSON.parse(r))}}const i=e=>"object"==typeof e&&null!=e,a=e=>"boolean"==typeof e,s=e=>"number"==typeof e,n=e=>"string"==typeof e;var o;e.FtMyLibraryColors=void 0,(o=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",o.green="green",o.blue="blue",o.purple="purple",o.red="red",o.orange="orange",o.yellow="yellow";const l=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var u;e.FtTopicOriginType=void 0,(u=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",u.PERSONAL="PERSONAL",u.SHARED="SHARED";const c=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),d=e=>i(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>n(e)))))&&n(e.key),p=e=>i(e)&&n(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>p(e)))&&(null==e.topicLink||h(e.topicLink))&&n(e.title)&&(null==e.htmlContent||n(e.htmlContent)),h=e=>i(e)&&n(e.tocId)&&n(e.contentId)&&n(e.mapId),y=e=>i(e)&&n(e.topicStylesheetUrl)&&n(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>n(e))),A=e=>i(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&(null==e.hasRating||a(e.hasRating))&&n(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>A(e)))&&(null==e.origin||m(e.origin))&&n(e.contentId)&&n(e.title),m=e=>i(e)&&n(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&n(e.contentId)&&n(e.mapId)&&c(e.type);var f;e.FtTopicContentTarget=void 0,(f=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",f.OFF_THE_GRID="OFF_THE_GRID",f.CONTENT_PACKAGER="CONTENT_PACKAGER",f.PAGES="PAGES",f.DESIGNED_READER="DESIGNED_READER";var E;e.FtExternalWebComponentContext=void 0,(E=e.FtExternalWebComponentContext||(e.FtExternalWebComponentContext={})).HOMEPAGE="HOMEPAGE",E.CUSTOM="CUSTOM",E.HEADER="HEADER",E.READER="READER",E.TOPIC_TEMPLATE="TOPIC_TEMPLATE",E.SEARCH="SEARCH",E.SEARCH_RESULT="SEARCH_RESULT";var g;e.FtMetadataHomeLayout=void 0,(g=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",g.CUSTOM="CUSTOM",g.DESIGNER="DESIGNER";const S=e=>i(e)&&s(e.count)&&n(e.label)&&(null==e.lang||n(e.lang));var T;e.FtFacetType=void 0,(T=e.FtFacetType||(e.FtFacetType={})).AND="AND",T.OR="OR",T.MONOVALUED="MONOVALUED";const b=e=>i(e)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>n(e))))))&&n(e.label)&&n(e.key);var R;e.FtMetadataSortRule=void 0,(R=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",R.ALPHABET="ALPHABET",R.VERSION="VERSION";const F=e=>["NONE","ALPHABET","VERSION"].includes(e),O=e=>i(e)&&a(e.date)&&F(e.sortRule)&&n(e.label)&&a(e.reverseSort)&&n(e.key),I=e=>i(e)&&(null==e.periodFilter||ee(e.periodFilter))&&n(e.query)&&(null==e.scope||ce(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>Q(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ye(e)))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||n(e.contentLocale));var v;e.FtRatingType=void 0,(v=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",v.LIKE="LIKE",v.DICHOTOMOUS="DICHOTOMOUS",v.NO_RATING="NO_RATING";const U=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),C=e=>i(e)&&n(e.date)&&U(e.type)&&s(e.value),_=e=>i(e)&&(null==e.rating||C(e.rating))&&U(e.type),L=e=>i(e)&&n(e.date)&&n(e.tocId)&&U(e.type)&&s(e.value),P=e=>i(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>L(e)))&&U(e.type),D=e=>i(e)&&Array.isArray(e.filter)&&e.filter.every((e=>n(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>n(e)));var N;e.FtPeriodFilterType=void 0,(N=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",N.LAST_MONTH="LAST_MONTH",N.LAST_QUARTER="LAST_QUARTER",N.LAST_YEAR="LAST_YEAR",N.CUSTOM="CUSTOM";const k=e=>["LAST_WEEK","LAST_MONTH","LAST_QUARTER","LAST_YEAR","CUSTOM"].includes(e),M=e=>i(e)&&a(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&n(e.key);var w;e.FtSearchSortCriterionOrder=void 0,(w=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",w.DESC="DESC";const B=e=>["ASC","DESC"].includes(e);var H;e.FtSearchSortCriterionType=void 0,(H=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",H.NATURAL="NATURAL";const x=e=>["ALPHA","NATURAL"].includes(e);var V;e.FtVirtualField=void 0,(V=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",V.TITLE_ONLY="TITLE_ONLY",V.NONE="NONE";const $=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),G=e=>i(e)&&s(e.totalResultsCount)&&a(e.isLastPage)&&s(e.currentPage)&&s(e.totalClustersCount);var K;e.FtEditorialType=void 0,(K=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",K.BOOK="BOOK",K.SHARED_BOOK="SHARED_BOOK";const j=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var q;e.FtOpenMode=void 0,(q=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",q.EXTERNAL="EXTERNAL";const X=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),Y=e=>i(e)&&(null==e.perPage||s(e.perPage))&&s(e.page),z=e=>i(e)&&n(e.key);var W;e.FtCollectionDocumentType=void 0,(W=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",W.DOCUMENT="DOCUMENT",W.TOPIC="TOPIC",W.PERSONAL_BOOK="PERSONAL_BOOK",W.SHARED_BOOK="SHARED_BOOK";const J=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),Q=e=>i(e)&&a(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&n(e.label)&&n(e.key),Z=e=>i(e)&&n(e.from)&&n(e.to),ee=e=>i(e)&&(null==e.period||Z(e.period))&&k(e.periodType)&&(null==e.key||n(e.key)),te=e=>i(e)&&s(e.weight)&&n(e.value)&&n(e.key),re=e=>i(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ie(e)))&&(null==e.metadataVariableAxis||n(e.metadataVariableAxis)),ie=e=>i(e)&&Array.isArray(e.missingTerms)&&e.missingTerms.every((e=>n(e)))&&(null==e.document||ae(e.document))&&(null==e.topic||ne(e.topic))&&le(e.type)&&(null==e.map||se(e.map)),ae=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&n(e.documentUrl)&&n(e.mimeType)&&n(e.title)&&(null==e.lastPublicationDate||n(e.lastPublicationDate))&&n(e.viewerUrl)&&n(e.contentUrl)&&n(e.filename)&&n(e.htmlTitle)&&(null==e.originUrl||n(e.originUrl))&&n(e.documentId)&&n(e.lastEditionDate)&&n(e.htmlExcerpt),se=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.openMode||X(e.openMode))&&j(e.editorialType)&&n(e.title)&&(null==e.lastPublicationDate||n(e.lastPublicationDate))&&n(e.htmlTitle)&&(null==e.originUrl||n(e.originUrl))&&n(e.mapUrl)&&n(e.readerUrl)&&n(e.mapId)&&(null==e.lastEditionDate||n(e.lastEditionDate))&&n(e.htmlExcerpt),ne=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&n(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>me(e)))&&n(e.title)&&n(e.mapTitle)&&n(e.topicUrl)&&n(e.contentUrl)&&n(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&(null==e.originUrl||n(e.originUrl))&&n(e.readerUrl)&&n(e.mapId)&&(null==e.lastEditionDate||n(e.lastEditionDate))&&n(e.htmlExcerpt);var oe;e.FtSearchResultType=void 0,(oe=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",oe.DOCUMENT="DOCUMENT",oe.TOPIC="TOPIC";const le=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var ue;e.FtSearchScope=void 0,(ue=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",ue.DOCUMENTS="DOCUMENTS",ue.ALL_TOPICS="ALL_TOPICS";const ce=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),de=e=>i(e)&&a(e.hierarchical)&&n(e.label)&&a(e.multiSelectionable)&&n(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>he(e))),pe=e=>i(e)&&(null==e.maxDepth||s(e.maxDepth))&&n(e.id),he=e=>i(e)&&s(e.totalResultsCount)&&a(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>he(e)))&&n(e.label)&&n(e.value)&&a(e.selected),ye=e=>i(e)&&x(e.type)&&n(e.key)&&B(e.order),Ae=e=>i(e)&&n(e.suggestedQuery)&&n(e.htmlSuggestedQuery),me=e=>i(e)&&n(e.filename)&&n(e.resourceUrl)&&n(e.id)&&n(e.mimeType)&&n(e.resourceContentUrl)&&n(e.viewerUrl),fe=e=>i(e)&&(null==e.filenameExtension||n(e.filenameExtension))&&(null==e.editorialType||j(e.editorialType))&&(null==e.mimeType||n(e.mimeType))&&le(e.type)&&n(e.value);var Ee;e.FtUserRole=void 0,(Ee=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",Ee.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",Ee.HTML_EXPORT_USER="HTML_EXPORT_USER",Ee.PDF_EXPORT_USER="PDF_EXPORT_USER",Ee.SAVED_SEARCH_USER="SAVED_SEARCH_USER",Ee.COLLECTION_USER="COLLECTION_USER",Ee.OFFLINE_USER="OFFLINE_USER",Ee.ANALYTICS_USER="ANALYTICS_USER",Ee.BETA_USER="BETA_USER",Ee.DEBUG_USER="DEBUG_USER",Ee.PRINT_USER="PRINT_USER",Ee.RATING_USER="RATING_USER",Ee.FEEDBACK_USER="FEEDBACK_USER",Ee.GENERATIVE_AI_USER="GENERATIVE_AI_USER",Ee.CONTENT_PUBLISHER="CONTENT_PUBLISHER",Ee.KHUB_ADMIN="KHUB_ADMIN",Ee.USERS_ADMIN="USERS_ADMIN",Ee.PORTAL_ADMIN="PORTAL_ADMIN",Ee.ADMIN="ADMIN",Ee.DEVELOPER="DEVELOPER";const ge=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","GENERATIVE_AI_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),Se=e=>i(e)&&n(e.identifier)&&n(e.realm),Te=e=>i(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>M(e))),be=e=>i(e)&&(null==e.emailAddress||n(e.emailAddress))&&(null==e.displayName||n(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>ge(e)))&&(null==e.userId||n(e.userId))&&Array.isArray(e.tags)&&e.tags.every((e=>n(e))),Re=e=>i(e)&&n(e.color)&&Array.isArray(e.text)&&e.text.every((e=>n(e)))&&s(e.opacity),Fe=e=>"object"==typeof e&&null!=e,Oe=e=>"boolean"==typeof e,Ie=e=>"number"==typeof e,ve=e=>"string"==typeof e;var Ue;e.FtConfigurationHistoryEntryStatus=void 0,(Ue=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Ue.INVALID="INVALID";const Ce=e=>Fe(e)&&Oe(e.mailsSentByFluidTopics)&&Oe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>ve(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>ve(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>ve(e))),_e=e=>Fe(e)&&ve(e.role)&&ve(e.content),Le=e=>Fe(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Oe(e))))&&Oe(e.isVisible),Pe=e=>Fe(e)&&(null==e.prettyUrl||ve(e.prettyUrl))&&(null==e.hasRating||Oe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||ve(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Pe(e)))&&(null==e.pageConfiguration||Le(e.pageConfiguration))&&(null==e.contentId||ve(e.contentId))&&(null==e.title||ve(e.title)),De=e=>Fe(e)&&Oe(e.splitCurrentPageToc),Ne=e=>Fe(e)&&Fe(e.metadata)&&Object.keys(e.metadata).every((e=>ve(e)))&&Object.values(e.metadata).every((e=>Array.isArray(e)&&e.every((e=>ve(e)))))&&ve(e.excerpt)&&Ie(e.relevance),ke=e=>Fe(e)&&Array.isArray(e.values)&&e.values.every((e=>ve(e)))&&ve(e.key),Me={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function we(e,t){return e===t||(Me[e]??[]).some((e=>we(e,t)))}const Be="undefined"==typeof window?globalThis:window;function He(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function xe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ve="undefined"==typeof window?globalThis:window;class $e extends Error{method;endpoint;status;statusText;body;constructor(e,t,r,i,a){super(`${e} ${t} -> ${r} - ${i}: ${a}`),this.method=e,this.endpoint=t,this.status=r,this.statusText=i,this.body=a}}class Ge extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function Ke(e,t,r){if(!r.ok){let i={method:e,endpoint:t,status:r.status,statusText:r.statusText,body:await r.text()};throw"function"==typeof Ve.dispatchEvent&&Ve.dispatchEvent(new Ge(i)),new $e(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function je(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class qe{tenantBaseUrl;tenantBaseUrlNoTrailingSlash;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},semantic:{search:"api/khub/semantic/search",clusteredSearch:"api/khub/semantic/clustered-search"},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"stylesheets/fonts.css",theme:"stylesheets/theme.css",content:{title:"stylesheets/content/title.css",topic:"stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader",metadata:"api/configuration/metadata"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})},ai:{generate:"api/ai/generate",sendFeedback:"api/ai/rate",chat:"/api/ai/rag/chat"}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ve.fluidTopicsBaseUrl??Ve.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",this.tenantBaseUrlNoTrailingSlash=this.tenantBaseUrl.replace(/\/$/,""),r&&void 0!==Ve.location&&Ve.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e,t){return this.get(this.endpoints.khub.maps.mapId(e).info,t)}getTableOfContent(e,t){return this.get(this.endpoints.khub.maps.mapId(e).toc,t)}getPages(e,t){return this.get(this.endpoints.khub.maps.mapId(e).pages,t)}getTopic(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info,r)}getTopicHTMLContent(e,t,r,i){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""),i)}getMapAttachments(e,t){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list,t)}getMapAttachmentContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content,r)}getMapResources(e,t){return this.get(this.endpoints.khub.maps.mapId(e).resources.list,t)}getMapResourceContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content,r)}getUnstructuredDocument(e,t){return this.get(this.endpoints.khub.documents.documentId(e).info,t)}getUnstructuredDocumentContent(e,t){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content,t)}getUnstructuredDocumentTextContent(e,t){return this.get(this.endpoints.khub.documents.documentId(e).text,t)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.locales.ui)}getMetadataConfiguration(){return this.get(this.endpoints.configuration.metadata)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}semanticSearch(e){return this.post(this.endpoints.khub.semantic.search,{request:e})}clusteredSemanticSearch(e){return this.post(this.endpoints.khub.semantic.clusteredSearch,{request:e})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}async*generate(e,t){const i=await this.fetch(this.endpoints.ai.generate,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:e,parameters:t}),credentials:null==this.authorization?"include":void 0});await Ke("POST",this.endpoints.ai.generate,i);const a=new r(i.body.getReader());yield*a.read()}async*chat(e){const t=await this.fetch(this.endpoints.ai.chat,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:null==this.authorization?"include":void 0});await Ke("POST",this.endpoints.ai.chat,t);const i=new r(t.body.getReader());yield*i.read()}sendFeedback(e){return this.post(this.endpoints.ai.sendFeedback,e)}get(e,t){return this.makeRequest("GET",this.withVersion(e,t))}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return e.startsWith(this.tenantBaseUrl)||e===this.tenantBaseUrlNoTrailingSlash?e:this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((a,s)=>{let n=new XMLHttpRequest;n.onload=()=>{if(n.status>=200&&n.status<300){let e="application/json"===n.getResponseHeader("Content-Type")?JSON.parse(n.responseText):n.responseText;a(e)}else s(new $e("GET",t,n.status,n.statusText,n.responseText))},n.upload.onprogress=e=>i(e),n.open(e,this.makeAbsolute(t),!0),n.send(r)})):this.fetch(t,{method:e,body:r}).then((r=>Ke(e,t,r))).then(je)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then((r=>Ke(e,t,r))).then(je)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>Ke("GET",e,t))).then((e=>e.arrayBuffer()))}withVersion(e,t){let r=new URL(this.makeAbsolute(e));return t&&r.searchParams.append("v",t),r.toString()}}e.FluidTopicsApi=qe,e.HttpError=$e,e.HttpErrorEvent=Ge,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Be.localStorage){const r=xe(e),i=e=>{e.storageArea===Be.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Be.addEventListener("storage",i),{removeHandler:()=>Be.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=qe,e.getUnauthenticatedUserSearchPreferences=function(e){if(Be.localStorage)return JSON.parse(Be.localStorage.getItem(xe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>i(e)&&Se(e.authenticationIdentifier)&&be(e.profile),e.isFtAuthenticationIdentifier=Se,e.isFtBookmark=e=>i(e)&&n(e.mapTitle)&&l(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&n(e.lastUpdate)&&n(e.readerUrl)&&n(e.mapId)&&n(e.id)&&n(e.title)&&n(e.creationDate),e.isFtClusteredSemanticSearchReply=e=>Fe(e)&&Array.isArray(e.documents)&&e.documents.every((e=>Ne(e)))&&Array.isArray(e.clusterId)&&e.clusterId.every((e=>ve(e))),e.isFtCollectionDocument=e=>i(e)&&a(e.deleted)&&(null==e.apiUrl||n(e.apiUrl))&&(null==e.portalUrl||n(e.portalUrl))&&n(e.id)&&n(e.title)&&J(e.type),e.isFtCollectionDocumentType=J,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>i(e)&&n(e.password)&&(null==e.newPassword||n(e.newPassword))&&a(e.rememberMe)&&n(e.login),e.isFtEditorialType=j,e.isFtExternalWebComponentContext=e=>["HOMEPAGE","CUSTOM","HEADER","READER","TOPIC_TEMPLATE","SEARCH","SEARCH_RESULT"].includes(e),e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>i(e)&&(null==e.from||n(e.from))&&n(e.message),e.isFtGenAIGenerateInput=e=>Fe(e)&&ve(e.profileId)&&(null==e.parameters||Fe(e.parameters)&&Object.keys(e.parameters).every((e=>ve(e)))&&Object.values(e.parameters).every((e=>ve(e)))),e.isFtGenAIRating=e=>Fe(e)&&Ie(e.rating)&&ve(e.comment)&&ve(e.queryId),e.isFtHttpErrorDetails=e=>i(e)&&n(e.endpoint)&&n(e.method)&&n(e.statusText)&&n(e.body)&&s(e.status),e.isFtLabeledSearchFilter=Q,e.isFtMap=e=>i(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.watermark||Re(e.watermark))&&X(e.openMode)&&(null==e.topicsApiEndpoint||n(e.topicsApiEndpoint))&&(null==e.description||n(e.description))&&(null==e.attachmentsApiEndpoint||n(e.attachmentsApiEndpoint))&&j(e.editorialType)&&n(e.baseId)&&n(e.clusterId)&&n(e.title)&&n(e.lastPublication)&&a(e.pbkConfidential)&&n(e.lastEdition)&&n(e.originId)&&(null==e.rightsApiEndpoint||n(e.rightsApiEndpoint))&&y(e.contentStyles)&&(null==e.originUrl||n(e.originUrl))&&n(e.fingerprint)&&n(e.readerUrl)&&(null==e.khubVersion||n(e.khubVersion))&&n(e.id)&&(null==e.lang||n(e.lang)),e.isFtMapAttachment=e=>Fe(e)&&ve(e.file)&&(null==e.size||Ie(e.size))&&Oe(e.externalLink)&&ve(e.name)&&ve(e.id)&&(null==e.mimeType||ve(e.mimeType))&&(null==e.viewerUrl||ve(e.viewerUrl)),e.isFtMapResource=e=>i(e)&&n(e.contentUrl)&&n(e.filename)&&n(e.id)&&n(e.mimeType),e.isFtMapStyles=y,e.isFtMessageContext=e=>i(e)&&n(e.name)&&i(e.messages)&&Object.keys(e.messages).every((e=>n(e)))&&Object.values(e.messages).every((e=>n(e)))&&n(e.locale),e.isFtMetadata=b,e.isFtMetadataConfiguration=e=>i(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>O(e))),e.isFtMetadataDescriptor=O,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=D,e.isFtMetadataSortRule=F,e.isFtMyLibraryColors=l,e.isFtMySearch=e=>i(e)&&I(e.searchRequest)&&l(e.color)&&a(e.alert)&&n(e.description)&&n(e.id)&&n(e.ownerId)&&n(e.title)&&n(e.creationDate),e.isFtMySearchRequest=I,e.isFtOpenMode=X,e.isFtPageConfiguration=Le,e.isFtPageRequest=Y,e.isFtPaginatedToc=e=>Fe(e)&&De(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Pe(e))),e.isFtPaginatedTocNode=Pe,e.isFtPaginationConfiguration=De,e.isFtPeriod=Z,e.isFtPeriodFilter=ee,e.isFtPeriodFilterType=k,e.isFtPersonalBookCreation=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>d(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>p(e)))&&n(e.description)&&n(e.title),e.isFtPersonalBookMetadataUpdate=d,e.isFtPersonalBookNodeCreation=p,e.isFtPersonalBookTopicLinkCreation=h,e.isFtPublicClusterSortCriterion=z,e.isFtPublicationRating=C,e.isFtPublicationRatingSummary=_,e.isFtRagHistory=_e,e.isFtRagInput=e=>Fe(e)&&ve(e.profileId)&&(null==e.conversationId||ve(e.conversationId))&&ve(e.query)&&(null==e.messages||Array.isArray(e.messages)&&e.messages.every((e=>_e(e))))&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>ke(e)))),e.isFtRatingCreation=e=>i(e)&&U(e.type)&&s(e.value),e.isFtRatingSummary=e=>i(e)&&(null==e.topics||P(e.topics))&&_(e.publication),e.isFtRatingType=U,e.isFtReaderConfiguration=e=>Fe(e)&&Ce(e.feedback)&&Ie(e.loadAfterLastVisibleTopic)&&ve(e.relativeTopicPivotMetadata)&&Ie(e.loadBeforeFirstVisibleTopic)&&ve(e.relativePivotMetadata),e.isFtReaderFeedbackConfiguration=Ce,e.isFtSearchFacet=de,e.isFtSearchFacetConf=pe,e.isFtSearchFacetEntry=he,e.isFtSearchFilter=M,e.isFtSearchLocale=S,e.isFtSearchLocales=e=>i(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>S(e))),e.isFtSearchPreferences=Te,e.isFtSearchPreferencesConfiguration=e=>i(e)&&i(e.metadata)&&Object.keys(e.metadata).every((e=>n(e)))&&Object.values(e.metadata).every((e=>D(e))),e.isFtSearchPreset=e=>i(e)&&n(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>M(e)))&&s(e.priority)&&(null==e.contentLocale||n(e.contentLocale)),e.isFtSearchPrior=te,e.isFtSearchRequest=e=>i(e)&&(null==e.periodFilter||ee(e.periodFilter))&&n(e.query)&&Y(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>M(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ye(e)))&&(null==e.virtualField||$(e.virtualField))&&Array.isArray(e.facets)&&e.facets.every((e=>pe(e)))&&(null==e.scope||ce(e.scope))&&(null==e.uiLocale||n(e.uiLocale))&&(null==e.contentLocale||n(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>te(e))))&&(null==e.clusterSortCriterions||Array.isArray(e.clusterSortCriterions)&&e.clusterSortCriterions.every((e=>z(e)))),e.isFtSearchResultCluster=re,e.isFtSearchResultClusterEntry=ie,e.isFtSearchResultMap=se,e.isFtSearchResultTopic=ne,e.isFtSearchResultType=le,e.isFtSearchResultUnstructuredDocument=ae,e.isFtSearchResults=e=>i(e)&&(null==e.spellcheck||Ae(e.spellcheck))&&G(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>re(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>de(e))),e.isFtSearchResultsPageInfo=G,e.isFtSearchScope=ce,e.isFtSearchSortCriterion=ye,e.isFtSearchSortCriterionOrder=B,e.isFtSearchSortCriterionType=x,e.isFtSemanticSearchFilter=ke,e.isFtSemanticSearchRequest=e=>Fe(e)&&ve(e.query)&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>ke(e))))&&(null==e.nbResults||Ie(e.nbResults)),e.isFtSemanticSearchResponseItem=Ne,e.isFtSession=e=>i(e)&&(null==e.authenticationIdentifier||Se(e.authenticationIdentifier))&&s(e.idleTimeoutInMillis)&&be(e.profile)&&a(e.sessionAuthenticated)&&Te(e.searchPreferences),e.isFtSpellcheck=Ae,e.isFtSuggestRequest=e=>i(e)&&n(e.input)&&(null==e.scope||ce(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>M(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ye(e)))&&(null==e.maxCount||s(e.maxCount))&&(null==e.contentLocale||n(e.contentLocale)),e.isFtSuggestResult=fe,e.isFtSuggestResults=e=>i(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>fe(e))),e.isFtTocNode=A,e.isFtTopic=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&n(e.id)&&n(e.contentApiEndpoint)&&n(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=m,e.isFtTopicOriginType=c,e.isFtTopicRating=L,e.isFtTopicResource=me,e.isFtTopicsRatingSummary=P,e.isFtUiLocale=e=>i(e)&&n(e.displayName)&&n(e.languageTag)&&a(e.translated),e.isFtUnstructuredDocument=e=>i(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&n(e.openMode)&&(null==e.description||n(e.description))&&n(e.mimeType)&&(null==e.baseId||n(e.baseId))&&(null==e.clusterId||n(e.clusterId))&&n(e.contentApiEndpoint)&&n(e.title)&&(null==e.lastPublication||n(e.lastPublication))&&n(e.viewerUrl)&&n(e.lastEdition)&&n(e.filename)&&(null==e.originId||n(e.originId))&&n(e.rightsApiEndpoint)&&(null==e.originUrl||n(e.originUrl))&&(null==e.khubVersion||n(e.khubVersion))&&n(e.id)&&(null==e.lang||n(e.lang)),e.isFtUserProfile=be,e.isFtUserRole=ge,e.isFtVirtualField=$,e.isFtWatermark=Re,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Be.localStorage){let r={...t,metadata:He(t.metadata??{})};const i=xe(e),a=JSON.stringify(r);return Be.localStorage.setItem(i,a),Be.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Be.localStorage,url:Be.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return null!=e&&(Array.isArray(e)?e:Array.isArray(e.roles)?e.roles:Array.isArray(e.profile?.roles)?e.profile.roles:[]).some((e=>we(e,t)))}}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i={exports:{}};!function(e,r){var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t&&t,a=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();!function(e){!function(r){var i=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==t&&t||{},a={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};if(a.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return a.iterable&&(t[Symbol.iterator]=function(){return t}),t}function c(e){this.map={},e instanceof c?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function d(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function h(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a.arrayBuffer&&a.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?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(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var e=d(this);if(e)return e;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 e=d(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(a.blob)return this.blob().then(h);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,i,a,s=d(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=p(t),i=/charset=([A-Za-z0-9_-]+)/.exec(e.type),a=i?i[1]:"utf-8",t.readAsText(e,a),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(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(E)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=o(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},c.prototype.delete=function(e){delete this.map[o(e)]},c.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},c.prototype.set=function(e,t){this.map[o(e)]=l(t)},c.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},c.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),u(e)},c.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),u(e)},c.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),u(e)},a.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var A=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function m(e,t){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,a,s=(t=t||{}).body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,s||null==e._bodyInit||(s=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=(r=t.method||this.method||"GET",a=r.toUpperCase(),A.indexOf(a)>-1?a:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in i)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function E(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),a=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(a))}})),t}function g(e,t){if(!(this instanceof g))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.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=void 0===t.statusText?"":""+t.statusText,this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},f.call(m.prototype),f.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var T=[301,302,303,307,308];g.redirect=function(e,t){if(-1===T.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},r.DOMException=i.DOMException;try{new r.DOMException}catch(e){r.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function b(e,t){return new Promise((function(s,n){var u=new m(e,t);if(u.signal&&u.signal.aborted)return n(new r.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function p(){d.abort()}if(d.onload=function(){var e,t,r={statusText:d.statusText,headers:(e=d.getAllResponseHeaders()||"",t=new c,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var a=r.join(":").trim();try{t.append(i,a)}catch(e){console.warn("Response "+e.message)}}})),t)};0===u.url.indexOf("file://")&&(d.status<200||d.status>599)?r.status=200:r.status=d.status,r.url="responseURL"in d?d.responseURL:r.headers.get("X-Request-URL");var i="response"in d?d.response:d.responseText;setTimeout((function(){s(new g(i,r))}),0)},d.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},d.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request timed out"))}),0)},d.onabort=function(){setTimeout((function(){n(new r.DOMException("Aborted","AbortError"))}),0)},d.open(u.method,function(e){try{return""===e&&i.location.href?i.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?d.withCredentials=!0:"omit"===u.credentials&&(d.withCredentials=!1),"responseType"in d&&(a.blob?d.responseType="blob":a.arrayBuffer&&(d.responseType="arraybuffer")),t&&"object"==typeof t.headers&&!(t.headers instanceof c||i.Headers&&t.headers instanceof i.Headers)){var h=[];Object.getOwnPropertyNames(t.headers).forEach((function(e){h.push(o(e)),d.setRequestHeader(e,l(t.headers[e]))})),u.headers.forEach((function(e,t){-1===h.indexOf(t)&&d.setRequestHeader(t,e)}))}else u.headers.forEach((function(e,t){d.setRequestHeader(t,e)}));u.signal&&(u.signal.addEventListener("abort",p),d.onreadystatechange=function(){4===d.readyState&&u.signal.removeEventListener("abort",p)}),d.send(void 0===u._bodyInit?null:u._bodyInit)}))}b.polyfill=!0,i.fetch||(i.fetch=b,i.Headers=c,i.Request=m,i.Response=g),r.Headers=c,r.Request=m,r.Response=g,r.fetch=b}({})}(a),a.fetch.ponyfill=!0,delete a.fetch.polyfill;var s=i.fetch?i:a;(r=s.fetch).default=s.fetch,r.fetch=s.fetch,r.Headers=s.Headers,r.Request=s.Request,r.Response=s.Response,e.exports=r}(i,i.exports);var a=r(i.exports);class s{reader;decoder=new TextDecoder;partialChunk="";constructor(e){this.reader=e}async*read(){for(;;){const{done:e,value:t}=await this.reader.read();if(e)return void(yield*this.readRemainingChunks());yield*this.readChunksFromValue(t)}}*readRemainingChunks(){yield*this.parseLine(this.partialChunk)}*readChunksFromValue(e){const t=(this.partialChunk+this.decoder.decode(e)).split("\n");this.partialChunk=t.pop();for(let e of t)yield*this.parseLine(e)}*parseLine(e){const[t,r]=e.split(/:(.*)/);"data"==t&&r.length>0&&(yield JSON.parse(r))}}const n=e=>"object"==typeof e&&null!=e,o=e=>"boolean"==typeof e,l=e=>"number"==typeof e,u=e=>"string"==typeof e;var c;e.FtMyLibraryColors=void 0,(c=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",c.green="green",c.blue="blue",c.purple="purple",c.red="red",c.orange="orange",c.yellow="yellow";const d=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var p;e.FtTopicOriginType=void 0,(p=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",p.PERSONAL="PERSONAL",p.SHARED="SHARED";const h=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),y=e=>n(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>u(e)))))&&u(e.key),f=e=>n(e)&&u(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>f(e)))&&(null==e.topicLink||A(e.topicLink))&&u(e.title)&&(null==e.htmlContent||u(e.htmlContent)),A=e=>n(e)&&u(e.tocId)&&u(e.contentId)&&u(e.mapId),m=e=>n(e)&&u(e.topicStylesheetUrl)&&u(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>u(e))),E=e=>n(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&(null==e.hasRating||o(e.hasRating))&&u(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>E(e)))&&(null==e.origin||g(e.origin))&&u(e.contentId)&&u(e.title),g=e=>n(e)&&u(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&u(e.contentId)&&u(e.mapId)&&h(e.type);var T;e.FtTopicContentTarget=void 0,(T=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",T.OFF_THE_GRID="OFF_THE_GRID",T.CONTENT_PACKAGER="CONTENT_PACKAGER",T.PAGES="PAGES",T.DESIGNED_READER="DESIGNED_READER";var b;e.FtExternalWebComponentContext=void 0,(b=e.FtExternalWebComponentContext||(e.FtExternalWebComponentContext={})).HOMEPAGE="HOMEPAGE",b.CUSTOM="CUSTOM",b.HEADER="HEADER",b.READER="READER",b.TOPIC_TEMPLATE="TOPIC_TEMPLATE",b.SEARCH="SEARCH",b.SEARCH_RESULT="SEARCH_RESULT";var S;e.FtMetadataHomeLayout=void 0,(S=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",S.CUSTOM="CUSTOM",S.DESIGNER="DESIGNER";const R=e=>n(e)&&l(e.count)&&u(e.label)&&(null==e.lang||u(e.lang));var F;e.FtFacetType=void 0,(F=e.FtFacetType||(e.FtFacetType={})).AND="AND",F.OR="OR",F.MONOVALUED="MONOVALUED";const O=e=>n(e)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>u(e))))))&&u(e.label)&&u(e.key);var v;e.FtMetadataSortRule=void 0,(v=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",v.ALPHABET="ALPHABET",v.VERSION="VERSION";const U=e=>["NONE","ALPHABET","VERSION"].includes(e),I=e=>n(e)&&o(e.date)&&U(e.sortRule)&&u(e.label)&&o(e.reverseSort)&&u(e.key),C=e=>n(e)&&(null==e.periodFilter||ie(e.periodFilter))&&u(e.query)&&(null==e.scope||he(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>te(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>me(e)))&&(null==e.virtualField||K(e.virtualField))&&(null==e.contentLocale||u(e.contentLocale));var _;e.FtRatingType=void 0,(_=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",_.LIKE="LIKE",_.DICHOTOMOUS="DICHOTOMOUS",_.NO_RATING="NO_RATING";const L=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),P=e=>n(e)&&u(e.date)&&L(e.type)&&l(e.value),D=e=>n(e)&&(null==e.rating||P(e.rating))&&L(e.type),N=e=>n(e)&&u(e.date)&&u(e.tocId)&&L(e.type)&&l(e.value),k=e=>n(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>N(e)))&&L(e.type),M=e=>n(e)&&Array.isArray(e.filter)&&e.filter.every((e=>u(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>u(e)));var w;e.FtPeriodFilterType=void 0,(w=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",w.LAST_MONTH="LAST_MONTH",w.LAST_QUARTER="LAST_QUARTER",w.LAST_YEAR="LAST_YEAR",w.CUSTOM="CUSTOM";const B=e=>["LAST_WEEK","LAST_MONTH","LAST_QUARTER","LAST_YEAR","CUSTOM"].includes(e),H=e=>n(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.key);var x;e.FtSearchSortCriterionOrder=void 0,(x=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",x.DESC="DESC";const V=e=>["ASC","DESC"].includes(e);var $;e.FtSearchSortCriterionType=void 0,($=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",$.NATURAL="NATURAL";const j=e=>["ALPHA","NATURAL"].includes(e);var G;e.FtVirtualField=void 0,(G=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",G.TITLE_ONLY="TITLE_ONLY",G.NONE="NONE";const K=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),q=e=>n(e)&&l(e.totalResultsCount)&&o(e.isLastPage)&&l(e.currentPage)&&l(e.totalClustersCount);var z;e.FtEditorialType=void 0,(z=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",z.BOOK="BOOK",z.SHARED_BOOK="SHARED_BOOK";const X=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var Y;e.FtOpenMode=void 0,(Y=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",Y.EXTERNAL="EXTERNAL";const W=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),J=e=>n(e)&&(null==e.perPage||l(e.perPage))&&l(e.page),Q=e=>n(e)&&u(e.key);var Z;e.FtCollectionDocumentType=void 0,(Z=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",Z.DOCUMENT="DOCUMENT",Z.TOPIC="TOPIC",Z.PERSONAL_BOOK="PERSONAL_BOOK",Z.SHARED_BOOK="SHARED_BOOK";const ee=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),te=e=>n(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.label)&&u(e.key),re=e=>n(e)&&u(e.from)&&u(e.to),ie=e=>n(e)&&(null==e.period||re(e.period))&&B(e.periodType)&&(null==e.key||u(e.key)),ae=e=>n(e)&&l(e.weight)&&u(e.value)&&u(e.key),se=e=>n(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ne(e)))&&(null==e.metadataVariableAxis||u(e.metadataVariableAxis)),ne=e=>n(e)&&Array.isArray(e.missingTerms)&&e.missingTerms.every((e=>u(e)))&&(null==e.document||oe(e.document))&&(null==e.topic||ue(e.topic))&&de(e.type)&&(null==e.map||le(e.map)),oe=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&W(e.openMode)&&u(e.documentUrl)&&u(e.mimeType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.viewerUrl)&&u(e.contentUrl)&&u(e.filename)&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.documentId)&&u(e.lastEditionDate)&&u(e.htmlExcerpt),le=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&(null==e.openMode||W(e.openMode))&&X(e.editorialType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.mapUrl)&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt),ue=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&W(e.openMode)&&u(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>ge(e)))&&u(e.title)&&u(e.mapTitle)&&u(e.topicUrl)&&u(e.contentUrl)&&u(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt);var ce;e.FtSearchResultType=void 0,(ce=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",ce.DOCUMENT="DOCUMENT",ce.TOPIC="TOPIC";const de=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var pe;e.FtSearchScope=void 0,(pe=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",pe.DOCUMENTS="DOCUMENTS",pe.ALL_TOPICS="ALL_TOPICS";const he=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),ye=e=>n(e)&&o(e.hierarchical)&&u(e.label)&&o(e.multiSelectionable)&&u(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>Ae(e))),fe=e=>n(e)&&(null==e.maxDepth||l(e.maxDepth))&&u(e.id),Ae=e=>n(e)&&l(e.totalResultsCount)&&o(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>Ae(e)))&&u(e.label)&&u(e.value)&&o(e.selected),me=e=>n(e)&&j(e.type)&&u(e.key)&&V(e.order),Ee=e=>n(e)&&u(e.suggestedQuery)&&u(e.htmlSuggestedQuery),ge=e=>n(e)&&u(e.filename)&&u(e.resourceUrl)&&u(e.id)&&u(e.mimeType)&&u(e.resourceContentUrl)&&u(e.viewerUrl),Te=e=>n(e)&&(null==e.filenameExtension||u(e.filenameExtension))&&(null==e.editorialType||X(e.editorialType))&&(null==e.mimeType||u(e.mimeType))&&de(e.type)&&u(e.value);var be;e.FtUserRole=void 0,(be=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",be.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",be.HTML_EXPORT_USER="HTML_EXPORT_USER",be.PDF_EXPORT_USER="PDF_EXPORT_USER",be.SAVED_SEARCH_USER="SAVED_SEARCH_USER",be.COLLECTION_USER="COLLECTION_USER",be.OFFLINE_USER="OFFLINE_USER",be.ANALYTICS_USER="ANALYTICS_USER",be.BETA_USER="BETA_USER",be.DEBUG_USER="DEBUG_USER",be.PRINT_USER="PRINT_USER",be.RATING_USER="RATING_USER",be.FEEDBACK_USER="FEEDBACK_USER",be.GENERATIVE_AI_USER="GENERATIVE_AI_USER",be.CONTENT_PUBLISHER="CONTENT_PUBLISHER",be.KHUB_ADMIN="KHUB_ADMIN",be.USERS_ADMIN="USERS_ADMIN",be.PORTAL_ADMIN="PORTAL_ADMIN",be.ADMIN="ADMIN",be.DEVELOPER="DEVELOPER";const Se=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","GENERATIVE_AI_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),Re=e=>n(e)&&u(e.identifier)&&u(e.realm),Fe=e=>n(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>H(e))),Oe=e=>n(e)&&(null==e.emailAddress||u(e.emailAddress))&&(null==e.displayName||u(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>Se(e)))&&(null==e.userId||u(e.userId))&&Array.isArray(e.tags)&&e.tags.every((e=>u(e))),ve=e=>n(e)&&u(e.color)&&Array.isArray(e.text)&&e.text.every((e=>u(e)))&&l(e.opacity),Ue=e=>"object"==typeof e&&null!=e,Ie=e=>"boolean"==typeof e,Ce=e=>"number"==typeof e,_e=e=>"string"==typeof e;var Le;e.FtConfigurationHistoryEntryStatus=void 0,(Le=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Le.INVALID="INVALID";const Pe=e=>Ue(e)&&Ie(e.mailsSentByFluidTopics)&&Ie(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>_e(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>_e(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>_e(e))),De=e=>Ue(e)&&_e(e.role)&&_e(e.content),Ne=e=>Ue(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Ie(e))))&&Ie(e.isVisible),ke=e=>Ue(e)&&(null==e.prettyUrl||_e(e.prettyUrl))&&(null==e.hasRating||Ie(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||_e(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>ke(e)))&&(null==e.pageConfiguration||Ne(e.pageConfiguration))&&(null==e.contentId||_e(e.contentId))&&(null==e.title||_e(e.title)),Me=e=>Ue(e)&&Ie(e.splitCurrentPageToc),we=e=>Ue(e)&&Ue(e.metadata)&&Object.keys(e.metadata).every((e=>_e(e)))&&Object.values(e.metadata).every((e=>Array.isArray(e)&&e.every((e=>_e(e)))))&&_e(e.excerpt)&&Ce(e.relevance),Be=e=>Ue(e)&&Array.isArray(e.values)&&e.values.every((e=>_e(e)))&&_e(e.key),He={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function xe(e,t){return e===t||(He[e]??[]).some((e=>xe(e,t)))}const Ve="undefined"==typeof window?globalThis:window;function $e(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function je(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ge="undefined"==typeof window?globalThis:window;class Ke extends Error{method;endpoint;status;statusText;body;constructor(e,t,r,i,a){super(`${e} ${t} -> ${r} - ${i}: ${a}`),this.method=e,this.endpoint=t,this.status=r,this.statusText=i,this.body=a}}class qe extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function ze(e,t,r){if(!r.ok){let i={method:e,endpoint:t,status:r.status,statusText:r.statusText,body:await r.text()};throw"function"==typeof Ge.dispatchEvent&&Ge.dispatchEvent(new qe(i)),new Ke(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function Xe(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Ye{tenantBaseUrl;tenantBaseUrlNoTrailingSlash;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},semantic:{search:"api/khub/semantic/search",clusteredSearch:"api/khub/semantic/clustered-search"},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"stylesheets/fonts.css",theme:"stylesheets/theme.css",content:{title:"stylesheets/content/title.css",topic:"stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader",metadata:"api/configuration/metadata"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})},ai:{generate:"api/ai/generate",sendFeedback:"api/ai/rate",chat:"/api/ai/rag/chat"}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ge.fluidTopicsBaseUrl??Ge.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",this.tenantBaseUrlNoTrailingSlash=this.tenantBaseUrl.replace(/\/$/,""),r&&void 0!==Ge.location&&Ge.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e,t){return this.get(this.endpoints.khub.maps.mapId(e).info,t)}getTableOfContent(e,t){return this.get(this.endpoints.khub.maps.mapId(e).toc,t)}getPages(e,t){return this.get(this.endpoints.khub.maps.mapId(e).pages,t)}getTopic(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info,r)}getTopicHTMLContent(e,t,r,i){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""),i)}getMapAttachments(e,t){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list,t)}getMapAttachmentContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content,r)}getMapResources(e,t){return this.get(this.endpoints.khub.maps.mapId(e).resources.list,t)}getMapResourceContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content,r)}getUnstructuredDocument(e,t){return this.get(this.endpoints.khub.documents.documentId(e).info,t)}getUnstructuredDocumentContent(e,t){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content,t)}getUnstructuredDocumentTextContent(e,t){return this.get(this.endpoints.khub.documents.documentId(e).text,t)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.locales.ui)}getMetadataConfiguration(){return this.get(this.endpoints.configuration.metadata)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}semanticSearch(e){return this.post(this.endpoints.khub.semantic.search,{request:e})}clusteredSemanticSearch(e){return this.post(this.endpoints.khub.semantic.clusteredSearch,{request:e})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}async*generate(e,t){const r=await this.fetch(this.endpoints.ai.generate,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:e,parameters:t}),credentials:null==this.authorization?"include":void 0});await ze("POST",this.endpoints.ai.generate,r);const i=new s(r.body.getReader());yield*i.read()}async*chat(e){const t=await this.fetch(this.endpoints.ai.chat,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:null==this.authorization?"include":void 0});await ze("POST",this.endpoints.ai.chat,t);const r=new s(t.body.getReader());yield*r.read()}sendFeedback(e){return this.post(this.endpoints.ai.sendFeedback,e)}get(e,t){return this.makeRequest("GET",this.withVersion(e,t))}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return e.startsWith(this.tenantBaseUrl)||e===this.tenantBaseUrlNoTrailingSlash?e:this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await a(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((a,s)=>{let n=new XMLHttpRequest;n.onload=()=>{if(n.status>=200&&n.status<300){let e="application/json"===n.getResponseHeader("Content-Type")?JSON.parse(n.responseText):n.responseText;a(e)}else s(new Ke("GET",t,n.status,n.statusText,n.responseText))},n.upload.onprogress=e=>i(e),n.open(e,this.makeAbsolute(t),!0),n.send(r)})):this.fetch(t,{method:e,body:r}).then((r=>ze(e,t,r))).then(Xe)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then((r=>ze(e,t,r))).then(Xe)}fetchRawData(e,t){return a(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>ze("GET",e,t))).then((e=>e.arrayBuffer()))}withVersion(e,t){let r=new URL(this.makeAbsolute(e));return t&&r.searchParams.append("v",t),r.toString()}}e.FluidTopicsApi=Ye,e.HttpError=Ke,e.HttpErrorEvent=qe,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Ve.localStorage){const r=je(e),i=e=>{e.storageArea===Ve.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Ve.addEventListener("storage",i),{removeHandler:()=>Ve.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Ye,e.getUnauthenticatedUserSearchPreferences=function(e){if(Ve.localStorage)return JSON.parse(Ve.localStorage.getItem(je(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>n(e)&&Re(e.authenticationIdentifier)&&Oe(e.profile),e.isFtAuthenticationIdentifier=Re,e.isFtBookmark=e=>n(e)&&u(e.mapTitle)&&d(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&u(e.lastUpdate)&&u(e.readerUrl)&&u(e.mapId)&&u(e.id)&&u(e.title)&&u(e.creationDate),e.isFtClusteredSemanticSearchReply=e=>Ue(e)&&Array.isArray(e.documents)&&e.documents.every((e=>we(e)))&&Array.isArray(e.clusterId)&&e.clusterId.every((e=>_e(e))),e.isFtCollectionDocument=e=>n(e)&&o(e.deleted)&&(null==e.apiUrl||u(e.apiUrl))&&(null==e.portalUrl||u(e.portalUrl))&&u(e.id)&&u(e.title)&&ee(e.type),e.isFtCollectionDocumentType=ee,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>n(e)&&u(e.password)&&(null==e.newPassword||u(e.newPassword))&&o(e.rememberMe)&&u(e.login),e.isFtEditorialType=X,e.isFtExternalWebComponentContext=e=>["HOMEPAGE","CUSTOM","HEADER","READER","TOPIC_TEMPLATE","SEARCH","SEARCH_RESULT"].includes(e),e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>n(e)&&(null==e.from||u(e.from))&&u(e.message),e.isFtGenAIGenerateInput=e=>Ue(e)&&_e(e.profileId)&&(null==e.parameters||Ue(e.parameters)&&Object.keys(e.parameters).every((e=>_e(e)))&&Object.values(e.parameters).every((e=>_e(e)))),e.isFtGenAIRating=e=>Ue(e)&&Ce(e.rating)&&_e(e.comment)&&_e(e.queryId),e.isFtHttpErrorDetails=e=>n(e)&&u(e.endpoint)&&u(e.method)&&u(e.statusText)&&u(e.body)&&l(e.status),e.isFtLabeledSearchFilter=te,e.isFtMap=e=>n(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&(null==e.watermark||ve(e.watermark))&&W(e.openMode)&&(null==e.topicsApiEndpoint||u(e.topicsApiEndpoint))&&(null==e.description||u(e.description))&&(null==e.attachmentsApiEndpoint||u(e.attachmentsApiEndpoint))&&X(e.editorialType)&&u(e.baseId)&&u(e.clusterId)&&u(e.title)&&u(e.lastPublication)&&o(e.pbkConfidential)&&u(e.lastEdition)&&u(e.originId)&&(null==e.rightsApiEndpoint||u(e.rightsApiEndpoint))&&m(e.contentStyles)&&(null==e.originUrl||u(e.originUrl))&&u(e.fingerprint)&&u(e.readerUrl)&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtMapAttachment=e=>Ue(e)&&_e(e.file)&&(null==e.size||Ce(e.size))&&Ie(e.externalLink)&&_e(e.name)&&_e(e.id)&&(null==e.mimeType||_e(e.mimeType))&&(null==e.viewerUrl||_e(e.viewerUrl)),e.isFtMapResource=e=>n(e)&&u(e.contentUrl)&&u(e.filename)&&u(e.id)&&u(e.mimeType),e.isFtMapStyles=m,e.isFtMessageContext=e=>n(e)&&u(e.name)&&n(e.messages)&&Object.keys(e.messages).every((e=>u(e)))&&Object.values(e.messages).every((e=>u(e)))&&u(e.locale),e.isFtMetadata=O,e.isFtMetadataConfiguration=e=>n(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>I(e))),e.isFtMetadataDescriptor=I,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=M,e.isFtMetadataSortRule=U,e.isFtMyLibraryColors=d,e.isFtMySearch=e=>n(e)&&C(e.searchRequest)&&d(e.color)&&o(e.alert)&&u(e.description)&&u(e.id)&&u(e.ownerId)&&u(e.title)&&u(e.creationDate),e.isFtMySearchRequest=C,e.isFtOpenMode=W,e.isFtPageConfiguration=Ne,e.isFtPageRequest=J,e.isFtPaginatedToc=e=>Ue(e)&&Me(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>ke(e))),e.isFtPaginatedTocNode=ke,e.isFtPaginationConfiguration=Me,e.isFtPeriod=re,e.isFtPeriodFilter=ie,e.isFtPeriodFilterType=B,e.isFtPersonalBookCreation=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>f(e)))&&u(e.description)&&u(e.title),e.isFtPersonalBookMetadataUpdate=y,e.isFtPersonalBookNodeCreation=f,e.isFtPersonalBookTopicLinkCreation=A,e.isFtPublicClusterSortCriterion=Q,e.isFtPublicationRating=P,e.isFtPublicationRatingSummary=D,e.isFtRagHistory=De,e.isFtRagInput=e=>Ue(e)&&_e(e.profileId)&&(null==e.conversationId||_e(e.conversationId))&&_e(e.query)&&(null==e.messages||Array.isArray(e.messages)&&e.messages.every((e=>De(e))))&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>Be(e)))),e.isFtRatingCreation=e=>n(e)&&L(e.type)&&l(e.value),e.isFtRatingSummary=e=>n(e)&&(null==e.topics||k(e.topics))&&D(e.publication),e.isFtRatingType=L,e.isFtReaderConfiguration=e=>Ue(e)&&Pe(e.feedback)&&Ce(e.loadAfterLastVisibleTopic)&&_e(e.relativeTopicPivotMetadata)&&Ce(e.loadBeforeFirstVisibleTopic)&&_e(e.relativePivotMetadata),e.isFtReaderFeedbackConfiguration=Pe,e.isFtSearchFacet=ye,e.isFtSearchFacetConf=fe,e.isFtSearchFacetEntry=Ae,e.isFtSearchFilter=H,e.isFtSearchLocale=R,e.isFtSearchLocales=e=>n(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>R(e))),e.isFtSearchPreferences=Fe,e.isFtSearchPreferencesConfiguration=e=>n(e)&&n(e.metadata)&&Object.keys(e.metadata).every((e=>u(e)))&&Object.values(e.metadata).every((e=>M(e))),e.isFtSearchPreset=e=>n(e)&&u(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>H(e)))&&l(e.priority)&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSearchPrior=ae,e.isFtSearchRequest=e=>n(e)&&(null==e.periodFilter||ie(e.periodFilter))&&u(e.query)&&J(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>H(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>me(e)))&&(null==e.virtualField||K(e.virtualField))&&Array.isArray(e.facets)&&e.facets.every((e=>fe(e)))&&(null==e.scope||he(e.scope))&&(null==e.uiLocale||u(e.uiLocale))&&(null==e.contentLocale||u(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>ae(e))))&&(null==e.clusterSortCriterions||Array.isArray(e.clusterSortCriterions)&&e.clusterSortCriterions.every((e=>Q(e)))),e.isFtSearchResultCluster=se,e.isFtSearchResultClusterEntry=ne,e.isFtSearchResultMap=le,e.isFtSearchResultTopic=ue,e.isFtSearchResultType=de,e.isFtSearchResultUnstructuredDocument=oe,e.isFtSearchResults=e=>n(e)&&(null==e.spellcheck||Ee(e.spellcheck))&&q(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>se(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>ye(e))),e.isFtSearchResultsPageInfo=q,e.isFtSearchScope=he,e.isFtSearchSortCriterion=me,e.isFtSearchSortCriterionOrder=V,e.isFtSearchSortCriterionType=j,e.isFtSemanticSearchFilter=Be,e.isFtSemanticSearchRequest=e=>Ue(e)&&_e(e.query)&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>Be(e))))&&(null==e.nbResults||Ce(e.nbResults)),e.isFtSemanticSearchResponseItem=we,e.isFtSession=e=>n(e)&&(null==e.authenticationIdentifier||Re(e.authenticationIdentifier))&&l(e.idleTimeoutInMillis)&&Oe(e.profile)&&o(e.sessionAuthenticated)&&Fe(e.searchPreferences),e.isFtSpellcheck=Ee,e.isFtSuggestRequest=e=>n(e)&&u(e.input)&&(null==e.scope||he(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>H(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>me(e)))&&(null==e.maxCount||l(e.maxCount))&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSuggestResult=Te,e.isFtSuggestResults=e=>n(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>Te(e))),e.isFtTocNode=E,e.isFtTopic=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&u(e.id)&&u(e.contentApiEndpoint)&&u(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=g,e.isFtTopicOriginType=h,e.isFtTopicRating=N,e.isFtTopicResource=ge,e.isFtTopicsRatingSummary=k,e.isFtUiLocale=e=>n(e)&&u(e.displayName)&&u(e.languageTag)&&o(e.translated),e.isFtUnstructuredDocument=e=>n(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&u(e.openMode)&&(null==e.description||u(e.description))&&u(e.mimeType)&&(null==e.baseId||u(e.baseId))&&(null==e.clusterId||u(e.clusterId))&&u(e.contentApiEndpoint)&&u(e.title)&&(null==e.lastPublication||u(e.lastPublication))&&u(e.viewerUrl)&&u(e.lastEdition)&&u(e.filename)&&(null==e.originId||u(e.originId))&&u(e.rightsApiEndpoint)&&(null==e.originUrl||u(e.originUrl))&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtUserProfile=Oe,e.isFtUserRole=Se,e.isFtVirtualField=K,e.isFtWatermark=ve,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Ve.localStorage){let r={...t,metadata:$e(t.metadata??{})};const i=je(e),a=JSON.stringify(r);return Ve.localStorage.setItem(i,a),Ve.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Ve.localStorage,url:Ve.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return null!=e&&(Array.isArray(e)?e:Array.isArray(e.roles)?e.roles:Array.isArray(e.profile?.roles)?e.profile.roles:[]).some((e=>xe(e,t)))}}));
@@ -0,0 +1,18 @@
1
+ <testsuite name="Mocha Tests" tests="16" failures="0" errors="0" skipped="0" timestamp="Thu, 09 Jan 2025 15:01:19 GMT" time="4.269">
2
+ <testcase classname="Login" name="should access restricted content once logged in" time="1.224"/>
3
+ <testcase classname="Map" name="should get a map and its ToC" time="0.154"/>
4
+ <testcase classname="Map" name="should get a map resources" time="0.13"/>
5
+ <testcase classname="Map" name="should get a map attachments" time="0.228"/>
6
+ <testcase classname="Map" name="should get map topics" time="0.143"/>
7
+ <testcase classname="Messages" name="should get a message context" time="1.885"/>
8
+ <testcase classname="Roles" name="Should return false when user does not have role" time="0"/>
9
+ <testcase classname="Roles" name="Should return true when user has role" time="0"/>
10
+ <testcase classname="Roles" name="Should return true when user has role by inheritance" time="0"/>
11
+ <testcase classname="Roles" name="Should return true when user has role by double inheritance" time="0"/>
12
+ <testcase classname="Roles" name="Should not inherit roles backwards" time="0"/>
13
+ <testcase classname="Roles" name="Should accept profile model" time="0"/>
14
+ <testcase classname="Roles" name="Should accept session model" time="0"/>
15
+ <testcase classname="Search" name="should get suggestions" time="0.095"/>
16
+ <testcase classname="Search" name="should search" time="0.153"/>
17
+ <testcase classname="Unstructured Document" name="should get an unstructured document and its content" time="0.253"/>
18
+ </testsuite>
package/dist/cjs/index.js CHANGED
@@ -46,9 +46,12 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar
46
46
  function reject(value) { resume("throw", value); }
47
47
  function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
48
48
  };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
49
52
  Object.defineProperty(exports, "__esModule", { value: true });
50
53
  exports.FluidTopicsApi = exports.HttpErrorEvent = exports.HttpError = void 0;
51
- require("cross-fetch/polyfill");
54
+ const cross_fetch_1 = __importDefault(require("cross-fetch"));
52
55
  const GenAIChunkReader_1 = require("./helpers/GenAIChunkReader");
53
56
  const wnd = (typeof window === "undefined" ? globalThis : window);
54
57
  __exportStar(require("./types/ft-common/public"), exports);
@@ -416,7 +419,7 @@ class FluidTopicsApi {
416
419
  var _a;
417
420
  return __awaiter(this, void 0, void 0, function* () {
418
421
  const requestInit = init;
419
- return yield fetch(this.makeAbsolute(endpoint), Object.assign(Object.assign({}, (requestInit !== null && requestInit !== void 0 ? requestInit : {})), { headers: Object.assign(Object.assign({}, this.defaultHeaders), ((_a = requestInit === null || requestInit === void 0 ? void 0 : requestInit.headers) !== null && _a !== void 0 ? _a : {})) }));
422
+ return yield (0, cross_fetch_1.default)(this.makeAbsolute(endpoint), Object.assign(Object.assign({}, (requestInit !== null && requestInit !== void 0 ? requestInit : {})), { headers: Object.assign(Object.assign({}, this.defaultHeaders), ((_a = requestInit === null || requestInit === void 0 ? void 0 : requestInit.headers) !== null && _a !== void 0 ? _a : {})) }));
420
423
  });
421
424
  }
422
425
  upload(method, endpoint, body, onProgress = () => undefined) {
@@ -454,7 +457,7 @@ class FluidTopicsApi {
454
457
  .then(getBody);
455
458
  }
456
459
  fetchRawData(endpoint, v) {
457
- return fetch(this.withVersion(endpoint, v), {
460
+ return (0, cross_fetch_1.default)(this.withVersion(endpoint, v), {
458
461
  headers: this.defaultHeaders,
459
462
  credentials: this.authorization == null ? "include" : undefined
460
463
  })
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(e){!function(t){var r={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function n(e){return"string"!=typeof e&&(e=String(e)),e}function o(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function u(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function c(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=c(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||a(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=n(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[s(e)]},l.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},l.prototype.set=function(e,t){this.map[s(e)]=n(t)},l.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},l.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),o(e)},l.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),o(e)},l.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),o(e)},r.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function A(e,t){var r,i,a=(t=t||{}).body;if(e instanceof A){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new l(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,a||null==e._bodyInit||(a=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new l(t.headers)),this.method=(r=t.method||this.method||"GET",i=r.toUpperCase(),y.indexOf(i)>-1?i:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&a)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(a)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),a=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(a))}})),t}function f(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},h.call(A.prototype),h.call(f.prototype),f.prototype.clone=function(){return new f(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},f.error=function(){var e=new f(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];f.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new f(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function g(e,i){return new Promise((function(a,s){var n=new A(e,i);if(n.signal&&n.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var o=new XMLHttpRequest;function u(){o.abort()}o.onload=function(){var e,t,r={status:o.status,statusText:o.statusText,headers:(e=o.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var a=r.join(":").trim();t.append(i,a)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;a(new f(i,r))},o.onerror=function(){s(new TypeError("Network request failed"))},o.ontimeout=function(){s(new TypeError("Network request failed"))},o.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},o.open(n.method,n.url,!0),"include"===n.credentials?o.withCredentials=!0:"omit"===n.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),n.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),n.signal&&(n.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&n.signal.removeEventListener("abort",u)}),o.send(void 0===n._bodyInit?null:n._bodyInit)}))}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=l,e.Request=A,e.Response=f),t.Headers=l,t.Request=A,t.Response=f,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);class r{reader;decoder=new TextDecoder;partialChunk="";constructor(e){this.reader=e}async*read(){for(;;){const{done:e,value:t}=await this.reader.read();if(e)return void(yield*this.readRemainingChunks());yield*this.readChunksFromValue(t)}}*readRemainingChunks(){yield*this.parseLine(this.partialChunk)}*readChunksFromValue(e){const t=(this.partialChunk+this.decoder.decode(e)).split("\n");this.partialChunk=t.pop();for(let e of t)yield*this.parseLine(e)}*parseLine(e){const[t,r]=e.split(/:(.*)/);"data"==t&&r.length>0&&(yield JSON.parse(r))}}const i=e=>"object"==typeof e&&null!=e,a=e=>"boolean"==typeof e,s=e=>"number"==typeof e,n=e=>"string"==typeof e;var o;e.FtMyLibraryColors=void 0,(o=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",o.green="green",o.blue="blue",o.purple="purple",o.red="red",o.orange="orange",o.yellow="yellow";const l=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var u;e.FtTopicOriginType=void 0,(u=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",u.PERSONAL="PERSONAL",u.SHARED="SHARED";const c=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),d=e=>i(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>n(e)))))&&n(e.key),p=e=>i(e)&&n(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>p(e)))&&(null==e.topicLink||h(e.topicLink))&&n(e.title)&&(null==e.htmlContent||n(e.htmlContent)),h=e=>i(e)&&n(e.tocId)&&n(e.contentId)&&n(e.mapId),y=e=>i(e)&&n(e.topicStylesheetUrl)&&n(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>n(e))),A=e=>i(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&(null==e.hasRating||a(e.hasRating))&&n(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>A(e)))&&(null==e.origin||m(e.origin))&&n(e.contentId)&&n(e.title),m=e=>i(e)&&n(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&n(e.contentId)&&n(e.mapId)&&c(e.type);var f;e.FtTopicContentTarget=void 0,(f=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",f.OFF_THE_GRID="OFF_THE_GRID",f.CONTENT_PACKAGER="CONTENT_PACKAGER",f.PAGES="PAGES",f.DESIGNED_READER="DESIGNED_READER";var E;e.FtExternalWebComponentContext=void 0,(E=e.FtExternalWebComponentContext||(e.FtExternalWebComponentContext={})).HOMEPAGE="HOMEPAGE",E.CUSTOM="CUSTOM",E.HEADER="HEADER",E.READER="READER",E.TOPIC_TEMPLATE="TOPIC_TEMPLATE",E.SEARCH="SEARCH",E.SEARCH_RESULT="SEARCH_RESULT";var g;e.FtMetadataHomeLayout=void 0,(g=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",g.CUSTOM="CUSTOM",g.DESIGNER="DESIGNER";const S=e=>i(e)&&s(e.count)&&n(e.label)&&(null==e.lang||n(e.lang));var T;e.FtFacetType=void 0,(T=e.FtFacetType||(e.FtFacetType={})).AND="AND",T.OR="OR",T.MONOVALUED="MONOVALUED";const b=e=>i(e)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>n(e))))))&&n(e.label)&&n(e.key);var R;e.FtMetadataSortRule=void 0,(R=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",R.ALPHABET="ALPHABET",R.VERSION="VERSION";const F=e=>["NONE","ALPHABET","VERSION"].includes(e),O=e=>i(e)&&a(e.date)&&F(e.sortRule)&&n(e.label)&&a(e.reverseSort)&&n(e.key),I=e=>i(e)&&(null==e.periodFilter||ee(e.periodFilter))&&n(e.query)&&(null==e.scope||ce(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>Q(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ye(e)))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||n(e.contentLocale));var v;e.FtRatingType=void 0,(v=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",v.LIKE="LIKE",v.DICHOTOMOUS="DICHOTOMOUS",v.NO_RATING="NO_RATING";const U=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),C=e=>i(e)&&n(e.date)&&U(e.type)&&s(e.value),_=e=>i(e)&&(null==e.rating||C(e.rating))&&U(e.type),L=e=>i(e)&&n(e.date)&&n(e.tocId)&&U(e.type)&&s(e.value),P=e=>i(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>L(e)))&&U(e.type),D=e=>i(e)&&Array.isArray(e.filter)&&e.filter.every((e=>n(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>n(e)));var N;e.FtPeriodFilterType=void 0,(N=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",N.LAST_MONTH="LAST_MONTH",N.LAST_QUARTER="LAST_QUARTER",N.LAST_YEAR="LAST_YEAR",N.CUSTOM="CUSTOM";const k=e=>["LAST_WEEK","LAST_MONTH","LAST_QUARTER","LAST_YEAR","CUSTOM"].includes(e),M=e=>i(e)&&a(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&n(e.key);var w;e.FtSearchSortCriterionOrder=void 0,(w=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",w.DESC="DESC";const B=e=>["ASC","DESC"].includes(e);var H;e.FtSearchSortCriterionType=void 0,(H=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",H.NATURAL="NATURAL";const x=e=>["ALPHA","NATURAL"].includes(e);var V;e.FtVirtualField=void 0,(V=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",V.TITLE_ONLY="TITLE_ONLY",V.NONE="NONE";const $=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),G=e=>i(e)&&s(e.totalResultsCount)&&a(e.isLastPage)&&s(e.currentPage)&&s(e.totalClustersCount);var K;e.FtEditorialType=void 0,(K=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",K.BOOK="BOOK",K.SHARED_BOOK="SHARED_BOOK";const j=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var q;e.FtOpenMode=void 0,(q=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",q.EXTERNAL="EXTERNAL";const X=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),Y=e=>i(e)&&(null==e.perPage||s(e.perPage))&&s(e.page),z=e=>i(e)&&n(e.key);var W;e.FtCollectionDocumentType=void 0,(W=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",W.DOCUMENT="DOCUMENT",W.TOPIC="TOPIC",W.PERSONAL_BOOK="PERSONAL_BOOK",W.SHARED_BOOK="SHARED_BOOK";const J=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),Q=e=>i(e)&&a(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&n(e.label)&&n(e.key),Z=e=>i(e)&&n(e.from)&&n(e.to),ee=e=>i(e)&&(null==e.period||Z(e.period))&&k(e.periodType)&&(null==e.key||n(e.key)),te=e=>i(e)&&s(e.weight)&&n(e.value)&&n(e.key),re=e=>i(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ie(e)))&&(null==e.metadataVariableAxis||n(e.metadataVariableAxis)),ie=e=>i(e)&&Array.isArray(e.missingTerms)&&e.missingTerms.every((e=>n(e)))&&(null==e.document||ae(e.document))&&(null==e.topic||ne(e.topic))&&le(e.type)&&(null==e.map||se(e.map)),ae=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&n(e.documentUrl)&&n(e.mimeType)&&n(e.title)&&(null==e.lastPublicationDate||n(e.lastPublicationDate))&&n(e.viewerUrl)&&n(e.contentUrl)&&n(e.filename)&&n(e.htmlTitle)&&(null==e.originUrl||n(e.originUrl))&&n(e.documentId)&&n(e.lastEditionDate)&&n(e.htmlExcerpt),se=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.openMode||X(e.openMode))&&j(e.editorialType)&&n(e.title)&&(null==e.lastPublicationDate||n(e.lastPublicationDate))&&n(e.htmlTitle)&&(null==e.originUrl||n(e.originUrl))&&n(e.mapUrl)&&n(e.readerUrl)&&n(e.mapId)&&(null==e.lastEditionDate||n(e.lastEditionDate))&&n(e.htmlExcerpt),ne=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&n(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>me(e)))&&n(e.title)&&n(e.mapTitle)&&n(e.topicUrl)&&n(e.contentUrl)&&n(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&(null==e.originUrl||n(e.originUrl))&&n(e.readerUrl)&&n(e.mapId)&&(null==e.lastEditionDate||n(e.lastEditionDate))&&n(e.htmlExcerpt);var oe;e.FtSearchResultType=void 0,(oe=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",oe.DOCUMENT="DOCUMENT",oe.TOPIC="TOPIC";const le=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var ue;e.FtSearchScope=void 0,(ue=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",ue.DOCUMENTS="DOCUMENTS",ue.ALL_TOPICS="ALL_TOPICS";const ce=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),de=e=>i(e)&&a(e.hierarchical)&&n(e.label)&&a(e.multiSelectionable)&&n(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>he(e))),pe=e=>i(e)&&(null==e.maxDepth||s(e.maxDepth))&&n(e.id),he=e=>i(e)&&s(e.totalResultsCount)&&a(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>he(e)))&&n(e.label)&&n(e.value)&&a(e.selected),ye=e=>i(e)&&x(e.type)&&n(e.key)&&B(e.order),Ae=e=>i(e)&&n(e.suggestedQuery)&&n(e.htmlSuggestedQuery),me=e=>i(e)&&n(e.filename)&&n(e.resourceUrl)&&n(e.id)&&n(e.mimeType)&&n(e.resourceContentUrl)&&n(e.viewerUrl),fe=e=>i(e)&&(null==e.filenameExtension||n(e.filenameExtension))&&(null==e.editorialType||j(e.editorialType))&&(null==e.mimeType||n(e.mimeType))&&le(e.type)&&n(e.value);var Ee;e.FtUserRole=void 0,(Ee=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",Ee.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",Ee.HTML_EXPORT_USER="HTML_EXPORT_USER",Ee.PDF_EXPORT_USER="PDF_EXPORT_USER",Ee.SAVED_SEARCH_USER="SAVED_SEARCH_USER",Ee.COLLECTION_USER="COLLECTION_USER",Ee.OFFLINE_USER="OFFLINE_USER",Ee.ANALYTICS_USER="ANALYTICS_USER",Ee.BETA_USER="BETA_USER",Ee.DEBUG_USER="DEBUG_USER",Ee.PRINT_USER="PRINT_USER",Ee.RATING_USER="RATING_USER",Ee.FEEDBACK_USER="FEEDBACK_USER",Ee.GENERATIVE_AI_USER="GENERATIVE_AI_USER",Ee.CONTENT_PUBLISHER="CONTENT_PUBLISHER",Ee.KHUB_ADMIN="KHUB_ADMIN",Ee.USERS_ADMIN="USERS_ADMIN",Ee.PORTAL_ADMIN="PORTAL_ADMIN",Ee.ADMIN="ADMIN",Ee.DEVELOPER="DEVELOPER";const ge=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","GENERATIVE_AI_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),Se=e=>i(e)&&n(e.identifier)&&n(e.realm),Te=e=>i(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>M(e))),be=e=>i(e)&&(null==e.emailAddress||n(e.emailAddress))&&(null==e.displayName||n(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>ge(e)))&&(null==e.userId||n(e.userId))&&Array.isArray(e.tags)&&e.tags.every((e=>n(e))),Re=e=>i(e)&&n(e.color)&&Array.isArray(e.text)&&e.text.every((e=>n(e)))&&s(e.opacity),Fe=e=>"object"==typeof e&&null!=e,Oe=e=>"boolean"==typeof e,Ie=e=>"number"==typeof e,ve=e=>"string"==typeof e;var Ue;e.FtConfigurationHistoryEntryStatus=void 0,(Ue=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Ue.INVALID="INVALID";const Ce=e=>Fe(e)&&Oe(e.mailsSentByFluidTopics)&&Oe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>ve(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>ve(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>ve(e))),_e=e=>Fe(e)&&ve(e.role)&&ve(e.content),Le=e=>Fe(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Oe(e))))&&Oe(e.isVisible),Pe=e=>Fe(e)&&(null==e.prettyUrl||ve(e.prettyUrl))&&(null==e.hasRating||Oe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||ve(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Pe(e)))&&(null==e.pageConfiguration||Le(e.pageConfiguration))&&(null==e.contentId||ve(e.contentId))&&(null==e.title||ve(e.title)),De=e=>Fe(e)&&Oe(e.splitCurrentPageToc),Ne=e=>Fe(e)&&Fe(e.metadata)&&Object.keys(e.metadata).every((e=>ve(e)))&&Object.values(e.metadata).every((e=>Array.isArray(e)&&e.every((e=>ve(e)))))&&ve(e.excerpt)&&Ie(e.relevance),ke=e=>Fe(e)&&Array.isArray(e.values)&&e.values.every((e=>ve(e)))&&ve(e.key),Me={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function we(e,t){return e===t||(Me[e]??[]).some((e=>we(e,t)))}const Be="undefined"==typeof window?globalThis:window;function He(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function xe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ve="undefined"==typeof window?globalThis:window;class $e extends Error{method;endpoint;status;statusText;body;constructor(e,t,r,i,a){super(`${e} ${t} -> ${r} - ${i}: ${a}`),this.method=e,this.endpoint=t,this.status=r,this.statusText=i,this.body=a}}class Ge extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function Ke(e,t,r){if(!r.ok){let i={method:e,endpoint:t,status:r.status,statusText:r.statusText,body:await r.text()};throw"function"==typeof Ve.dispatchEvent&&Ve.dispatchEvent(new Ge(i)),new $e(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function je(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class qe{tenantBaseUrl;tenantBaseUrlNoTrailingSlash;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},semantic:{search:"api/khub/semantic/search",clusteredSearch:"api/khub/semantic/clustered-search"},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"stylesheets/fonts.css",theme:"stylesheets/theme.css",content:{title:"stylesheets/content/title.css",topic:"stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader",metadata:"api/configuration/metadata"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})},ai:{generate:"api/ai/generate",sendFeedback:"api/ai/rate",chat:"/api/ai/rag/chat"}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ve.fluidTopicsBaseUrl??Ve.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",this.tenantBaseUrlNoTrailingSlash=this.tenantBaseUrl.replace(/\/$/,""),r&&void 0!==Ve.location&&Ve.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e,t){return this.get(this.endpoints.khub.maps.mapId(e).info,t)}getTableOfContent(e,t){return this.get(this.endpoints.khub.maps.mapId(e).toc,t)}getPages(e,t){return this.get(this.endpoints.khub.maps.mapId(e).pages,t)}getTopic(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info,r)}getTopicHTMLContent(e,t,r,i){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""),i)}getMapAttachments(e,t){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list,t)}getMapAttachmentContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content,r)}getMapResources(e,t){return this.get(this.endpoints.khub.maps.mapId(e).resources.list,t)}getMapResourceContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content,r)}getUnstructuredDocument(e,t){return this.get(this.endpoints.khub.documents.documentId(e).info,t)}getUnstructuredDocumentContent(e,t){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content,t)}getUnstructuredDocumentTextContent(e,t){return this.get(this.endpoints.khub.documents.documentId(e).text,t)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.locales.ui)}getMetadataConfiguration(){return this.get(this.endpoints.configuration.metadata)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}semanticSearch(e){return this.post(this.endpoints.khub.semantic.search,{request:e})}clusteredSemanticSearch(e){return this.post(this.endpoints.khub.semantic.clusteredSearch,{request:e})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}async*generate(e,t){const i=await this.fetch(this.endpoints.ai.generate,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:e,parameters:t}),credentials:null==this.authorization?"include":void 0});await Ke("POST",this.endpoints.ai.generate,i);const a=new r(i.body.getReader());yield*a.read()}async*chat(e){const t=await this.fetch(this.endpoints.ai.chat,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:null==this.authorization?"include":void 0});await Ke("POST",this.endpoints.ai.chat,t);const i=new r(t.body.getReader());yield*i.read()}sendFeedback(e){return this.post(this.endpoints.ai.sendFeedback,e)}get(e,t){return this.makeRequest("GET",this.withVersion(e,t))}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return e.startsWith(this.tenantBaseUrl)||e===this.tenantBaseUrlNoTrailingSlash?e:this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await fetch(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((a,s)=>{let n=new XMLHttpRequest;n.onload=()=>{if(n.status>=200&&n.status<300){let e="application/json"===n.getResponseHeader("Content-Type")?JSON.parse(n.responseText):n.responseText;a(e)}else s(new $e("GET",t,n.status,n.statusText,n.responseText))},n.upload.onprogress=e=>i(e),n.open(e,this.makeAbsolute(t),!0),n.send(r)})):this.fetch(t,{method:e,body:r}).then((r=>Ke(e,t,r))).then(je)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then((r=>Ke(e,t,r))).then(je)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>Ke("GET",e,t))).then((e=>e.arrayBuffer()))}withVersion(e,t){let r=new URL(this.makeAbsolute(e));return t&&r.searchParams.append("v",t),r.toString()}}e.FluidTopicsApi=qe,e.HttpError=$e,e.HttpErrorEvent=Ge,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Be.localStorage){const r=xe(e),i=e=>{e.storageArea===Be.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Be.addEventListener("storage",i),{removeHandler:()=>Be.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=qe,e.getUnauthenticatedUserSearchPreferences=function(e){if(Be.localStorage)return JSON.parse(Be.localStorage.getItem(xe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>i(e)&&Se(e.authenticationIdentifier)&&be(e.profile),e.isFtAuthenticationIdentifier=Se,e.isFtBookmark=e=>i(e)&&n(e.mapTitle)&&l(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&n(e.lastUpdate)&&n(e.readerUrl)&&n(e.mapId)&&n(e.id)&&n(e.title)&&n(e.creationDate),e.isFtClusteredSemanticSearchReply=e=>Fe(e)&&Array.isArray(e.documents)&&e.documents.every((e=>Ne(e)))&&Array.isArray(e.clusterId)&&e.clusterId.every((e=>ve(e))),e.isFtCollectionDocument=e=>i(e)&&a(e.deleted)&&(null==e.apiUrl||n(e.apiUrl))&&(null==e.portalUrl||n(e.portalUrl))&&n(e.id)&&n(e.title)&&J(e.type),e.isFtCollectionDocumentType=J,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>i(e)&&n(e.password)&&(null==e.newPassword||n(e.newPassword))&&a(e.rememberMe)&&n(e.login),e.isFtEditorialType=j,e.isFtExternalWebComponentContext=e=>["HOMEPAGE","CUSTOM","HEADER","READER","TOPIC_TEMPLATE","SEARCH","SEARCH_RESULT"].includes(e),e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>i(e)&&(null==e.from||n(e.from))&&n(e.message),e.isFtGenAIGenerateInput=e=>Fe(e)&&ve(e.profileId)&&(null==e.parameters||Fe(e.parameters)&&Object.keys(e.parameters).every((e=>ve(e)))&&Object.values(e.parameters).every((e=>ve(e)))),e.isFtGenAIRating=e=>Fe(e)&&Ie(e.rating)&&ve(e.comment)&&ve(e.queryId),e.isFtHttpErrorDetails=e=>i(e)&&n(e.endpoint)&&n(e.method)&&n(e.statusText)&&n(e.body)&&s(e.status),e.isFtLabeledSearchFilter=Q,e.isFtMap=e=>i(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.watermark||Re(e.watermark))&&X(e.openMode)&&(null==e.topicsApiEndpoint||n(e.topicsApiEndpoint))&&(null==e.description||n(e.description))&&(null==e.attachmentsApiEndpoint||n(e.attachmentsApiEndpoint))&&j(e.editorialType)&&n(e.baseId)&&n(e.clusterId)&&n(e.title)&&n(e.lastPublication)&&a(e.pbkConfidential)&&n(e.lastEdition)&&n(e.originId)&&(null==e.rightsApiEndpoint||n(e.rightsApiEndpoint))&&y(e.contentStyles)&&(null==e.originUrl||n(e.originUrl))&&n(e.fingerprint)&&n(e.readerUrl)&&(null==e.khubVersion||n(e.khubVersion))&&n(e.id)&&(null==e.lang||n(e.lang)),e.isFtMapAttachment=e=>Fe(e)&&ve(e.file)&&(null==e.size||Ie(e.size))&&Oe(e.externalLink)&&ve(e.name)&&ve(e.id)&&(null==e.mimeType||ve(e.mimeType))&&(null==e.viewerUrl||ve(e.viewerUrl)),e.isFtMapResource=e=>i(e)&&n(e.contentUrl)&&n(e.filename)&&n(e.id)&&n(e.mimeType),e.isFtMapStyles=y,e.isFtMessageContext=e=>i(e)&&n(e.name)&&i(e.messages)&&Object.keys(e.messages).every((e=>n(e)))&&Object.values(e.messages).every((e=>n(e)))&&n(e.locale),e.isFtMetadata=b,e.isFtMetadataConfiguration=e=>i(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>O(e))),e.isFtMetadataDescriptor=O,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=D,e.isFtMetadataSortRule=F,e.isFtMyLibraryColors=l,e.isFtMySearch=e=>i(e)&&I(e.searchRequest)&&l(e.color)&&a(e.alert)&&n(e.description)&&n(e.id)&&n(e.ownerId)&&n(e.title)&&n(e.creationDate),e.isFtMySearchRequest=I,e.isFtOpenMode=X,e.isFtPageConfiguration=Le,e.isFtPageRequest=Y,e.isFtPaginatedToc=e=>Fe(e)&&De(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Pe(e))),e.isFtPaginatedTocNode=Pe,e.isFtPaginationConfiguration=De,e.isFtPeriod=Z,e.isFtPeriodFilter=ee,e.isFtPeriodFilterType=k,e.isFtPersonalBookCreation=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>d(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>p(e)))&&n(e.description)&&n(e.title),e.isFtPersonalBookMetadataUpdate=d,e.isFtPersonalBookNodeCreation=p,e.isFtPersonalBookTopicLinkCreation=h,e.isFtPublicClusterSortCriterion=z,e.isFtPublicationRating=C,e.isFtPublicationRatingSummary=_,e.isFtRagHistory=_e,e.isFtRagInput=e=>Fe(e)&&ve(e.profileId)&&(null==e.conversationId||ve(e.conversationId))&&ve(e.query)&&(null==e.messages||Array.isArray(e.messages)&&e.messages.every((e=>_e(e))))&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>ke(e)))),e.isFtRatingCreation=e=>i(e)&&U(e.type)&&s(e.value),e.isFtRatingSummary=e=>i(e)&&(null==e.topics||P(e.topics))&&_(e.publication),e.isFtRatingType=U,e.isFtReaderConfiguration=e=>Fe(e)&&Ce(e.feedback)&&Ie(e.loadAfterLastVisibleTopic)&&ve(e.relativeTopicPivotMetadata)&&Ie(e.loadBeforeFirstVisibleTopic)&&ve(e.relativePivotMetadata),e.isFtReaderFeedbackConfiguration=Ce,e.isFtSearchFacet=de,e.isFtSearchFacetConf=pe,e.isFtSearchFacetEntry=he,e.isFtSearchFilter=M,e.isFtSearchLocale=S,e.isFtSearchLocales=e=>i(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>S(e))),e.isFtSearchPreferences=Te,e.isFtSearchPreferencesConfiguration=e=>i(e)&&i(e.metadata)&&Object.keys(e.metadata).every((e=>n(e)))&&Object.values(e.metadata).every((e=>D(e))),e.isFtSearchPreset=e=>i(e)&&n(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>M(e)))&&s(e.priority)&&(null==e.contentLocale||n(e.contentLocale)),e.isFtSearchPrior=te,e.isFtSearchRequest=e=>i(e)&&(null==e.periodFilter||ee(e.periodFilter))&&n(e.query)&&Y(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>M(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ye(e)))&&(null==e.virtualField||$(e.virtualField))&&Array.isArray(e.facets)&&e.facets.every((e=>pe(e)))&&(null==e.scope||ce(e.scope))&&(null==e.uiLocale||n(e.uiLocale))&&(null==e.contentLocale||n(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>te(e))))&&(null==e.clusterSortCriterions||Array.isArray(e.clusterSortCriterions)&&e.clusterSortCriterions.every((e=>z(e)))),e.isFtSearchResultCluster=re,e.isFtSearchResultClusterEntry=ie,e.isFtSearchResultMap=se,e.isFtSearchResultTopic=ne,e.isFtSearchResultType=le,e.isFtSearchResultUnstructuredDocument=ae,e.isFtSearchResults=e=>i(e)&&(null==e.spellcheck||Ae(e.spellcheck))&&G(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>re(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>de(e))),e.isFtSearchResultsPageInfo=G,e.isFtSearchScope=ce,e.isFtSearchSortCriterion=ye,e.isFtSearchSortCriterionOrder=B,e.isFtSearchSortCriterionType=x,e.isFtSemanticSearchFilter=ke,e.isFtSemanticSearchRequest=e=>Fe(e)&&ve(e.query)&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>ke(e))))&&(null==e.nbResults||Ie(e.nbResults)),e.isFtSemanticSearchResponseItem=Ne,e.isFtSession=e=>i(e)&&(null==e.authenticationIdentifier||Se(e.authenticationIdentifier))&&s(e.idleTimeoutInMillis)&&be(e.profile)&&a(e.sessionAuthenticated)&&Te(e.searchPreferences),e.isFtSpellcheck=Ae,e.isFtSuggestRequest=e=>i(e)&&n(e.input)&&(null==e.scope||ce(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>M(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ye(e)))&&(null==e.maxCount||s(e.maxCount))&&(null==e.contentLocale||n(e.contentLocale)),e.isFtSuggestResult=fe,e.isFtSuggestResults=e=>i(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>fe(e))),e.isFtTocNode=A,e.isFtTopic=e=>i(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&n(e.id)&&n(e.contentApiEndpoint)&&n(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=m,e.isFtTopicOriginType=c,e.isFtTopicRating=L,e.isFtTopicResource=me,e.isFtTopicsRatingSummary=P,e.isFtUiLocale=e=>i(e)&&n(e.displayName)&&n(e.languageTag)&&a(e.translated),e.isFtUnstructuredDocument=e=>i(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&n(e.openMode)&&(null==e.description||n(e.description))&&n(e.mimeType)&&(null==e.baseId||n(e.baseId))&&(null==e.clusterId||n(e.clusterId))&&n(e.contentApiEndpoint)&&n(e.title)&&(null==e.lastPublication||n(e.lastPublication))&&n(e.viewerUrl)&&n(e.lastEdition)&&n(e.filename)&&(null==e.originId||n(e.originId))&&n(e.rightsApiEndpoint)&&(null==e.originUrl||n(e.originUrl))&&(null==e.khubVersion||n(e.khubVersion))&&n(e.id)&&(null==e.lang||n(e.lang)),e.isFtUserProfile=be,e.isFtUserRole=ge,e.isFtVirtualField=$,e.isFtWatermark=Re,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Be.localStorage){let r={...t,metadata:He(t.metadata??{})};const i=xe(e),a=JSON.stringify(r);return Be.localStorage.setItem(i,a),Be.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Be.localStorage,url:Be.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return null!=e&&(Array.isArray(e)?e:Array.isArray(e.roles)?e.roles:Array.isArray(e.profile?.roles)?e.profile.roles:[]).some((e=>we(e,t)))}}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i={exports:{}};!function(e,r){var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==t&&t,a=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();!function(e){!function(r){var i=void 0!==e&&e||"undefined"!=typeof self&&self||void 0!==t&&t||{},a={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};if(a.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function o(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return a.iterable&&(t[Symbol.iterator]=function(){return t}),t}function c(e){this.map={},e instanceof c?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function d(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function h(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:a.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:a.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():a.arrayBuffer&&a.blob&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):a.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||n(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof e?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(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a.blob&&(this.blob=function(){var e=d(this);if(e)return e;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 e=d(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(a.blob)return this.blob().then(h);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,i,a,s=d(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=p(t),i=/charset=([A-Za-z0-9_-]+)/.exec(e.type),a=i?i[1]:"utf-8",t.readAsText(e,a),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(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(E)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(e,t){e=o(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},c.prototype.delete=function(e){delete this.map[o(e)]},c.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},c.prototype.set=function(e,t){this.map[o(e)]=l(t)},c.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},c.prototype.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),u(e)},c.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),u(e)},c.prototype.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),u(e)},a.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var A=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function m(e,t){if(!(this instanceof m))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var r,a,s=(t=t||{}).body;if(e instanceof m){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,s||null==e._bodyInit||(s=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=(r=t.method||this.method||"GET",a=r.toUpperCase(),A.indexOf(a)>-1?a:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in i)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var n=/([?&])_=[^&]*/;if(n.test(this.url))this.url=this.url.replace(n,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function E(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),a=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(a))}})),t}function g(e,t){if(!(this instanceof g))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.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=void 0===t.statusText?"":""+t.statusText,this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},f.call(m.prototype),f.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var T=[301,302,303,307,308];g.redirect=function(e,t){if(-1===T.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},r.DOMException=i.DOMException;try{new r.DOMException}catch(e){r.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function b(e,t){return new Promise((function(s,n){var u=new m(e,t);if(u.signal&&u.signal.aborted)return n(new r.DOMException("Aborted","AbortError"));var d=new XMLHttpRequest;function p(){d.abort()}if(d.onload=function(){var e,t,r={statusText:d.statusText,headers:(e=d.getAllResponseHeaders()||"",t=new c,e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var r=e.split(":"),i=r.shift().trim();if(i){var a=r.join(":").trim();try{t.append(i,a)}catch(e){console.warn("Response "+e.message)}}})),t)};0===u.url.indexOf("file://")&&(d.status<200||d.status>599)?r.status=200:r.status=d.status,r.url="responseURL"in d?d.responseURL:r.headers.get("X-Request-URL");var i="response"in d?d.response:d.responseText;setTimeout((function(){s(new g(i,r))}),0)},d.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},d.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request timed out"))}),0)},d.onabort=function(){setTimeout((function(){n(new r.DOMException("Aborted","AbortError"))}),0)},d.open(u.method,function(e){try{return""===e&&i.location.href?i.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?d.withCredentials=!0:"omit"===u.credentials&&(d.withCredentials=!1),"responseType"in d&&(a.blob?d.responseType="blob":a.arrayBuffer&&(d.responseType="arraybuffer")),t&&"object"==typeof t.headers&&!(t.headers instanceof c||i.Headers&&t.headers instanceof i.Headers)){var h=[];Object.getOwnPropertyNames(t.headers).forEach((function(e){h.push(o(e)),d.setRequestHeader(e,l(t.headers[e]))})),u.headers.forEach((function(e,t){-1===h.indexOf(t)&&d.setRequestHeader(t,e)}))}else u.headers.forEach((function(e,t){d.setRequestHeader(t,e)}));u.signal&&(u.signal.addEventListener("abort",p),d.onreadystatechange=function(){4===d.readyState&&u.signal.removeEventListener("abort",p)}),d.send(void 0===u._bodyInit?null:u._bodyInit)}))}b.polyfill=!0,i.fetch||(i.fetch=b,i.Headers=c,i.Request=m,i.Response=g),r.Headers=c,r.Request=m,r.Response=g,r.fetch=b}({})}(a),a.fetch.ponyfill=!0,delete a.fetch.polyfill;var s=i.fetch?i:a;(r=s.fetch).default=s.fetch,r.fetch=s.fetch,r.Headers=s.Headers,r.Request=s.Request,r.Response=s.Response,e.exports=r}(i,i.exports);var a=r(i.exports);class s{reader;decoder=new TextDecoder;partialChunk="";constructor(e){this.reader=e}async*read(){for(;;){const{done:e,value:t}=await this.reader.read();if(e)return void(yield*this.readRemainingChunks());yield*this.readChunksFromValue(t)}}*readRemainingChunks(){yield*this.parseLine(this.partialChunk)}*readChunksFromValue(e){const t=(this.partialChunk+this.decoder.decode(e)).split("\n");this.partialChunk=t.pop();for(let e of t)yield*this.parseLine(e)}*parseLine(e){const[t,r]=e.split(/:(.*)/);"data"==t&&r.length>0&&(yield JSON.parse(r))}}const n=e=>"object"==typeof e&&null!=e,o=e=>"boolean"==typeof e,l=e=>"number"==typeof e,u=e=>"string"==typeof e;var c;e.FtMyLibraryColors=void 0,(c=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",c.green="green",c.blue="blue",c.purple="purple",c.red="red",c.orange="orange",c.yellow="yellow";const d=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var p;e.FtTopicOriginType=void 0,(p=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",p.PERSONAL="PERSONAL",p.SHARED="SHARED";const h=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),y=e=>n(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>u(e)))))&&u(e.key),f=e=>n(e)&&u(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>f(e)))&&(null==e.topicLink||A(e.topicLink))&&u(e.title)&&(null==e.htmlContent||u(e.htmlContent)),A=e=>n(e)&&u(e.tocId)&&u(e.contentId)&&u(e.mapId),m=e=>n(e)&&u(e.topicStylesheetUrl)&&u(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>u(e))),E=e=>n(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&(null==e.hasRating||o(e.hasRating))&&u(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>E(e)))&&(null==e.origin||g(e.origin))&&u(e.contentId)&&u(e.title),g=e=>n(e)&&u(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&u(e.contentId)&&u(e.mapId)&&h(e.type);var T;e.FtTopicContentTarget=void 0,(T=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",T.OFF_THE_GRID="OFF_THE_GRID",T.CONTENT_PACKAGER="CONTENT_PACKAGER",T.PAGES="PAGES",T.DESIGNED_READER="DESIGNED_READER";var b;e.FtExternalWebComponentContext=void 0,(b=e.FtExternalWebComponentContext||(e.FtExternalWebComponentContext={})).HOMEPAGE="HOMEPAGE",b.CUSTOM="CUSTOM",b.HEADER="HEADER",b.READER="READER",b.TOPIC_TEMPLATE="TOPIC_TEMPLATE",b.SEARCH="SEARCH",b.SEARCH_RESULT="SEARCH_RESULT";var S;e.FtMetadataHomeLayout=void 0,(S=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",S.CUSTOM="CUSTOM",S.DESIGNER="DESIGNER";const R=e=>n(e)&&l(e.count)&&u(e.label)&&(null==e.lang||u(e.lang));var F;e.FtFacetType=void 0,(F=e.FtFacetType||(e.FtFacetType={})).AND="AND",F.OR="OR",F.MONOVALUED="MONOVALUED";const O=e=>n(e)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>u(e))))))&&u(e.label)&&u(e.key);var v;e.FtMetadataSortRule=void 0,(v=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",v.ALPHABET="ALPHABET",v.VERSION="VERSION";const U=e=>["NONE","ALPHABET","VERSION"].includes(e),I=e=>n(e)&&o(e.date)&&U(e.sortRule)&&u(e.label)&&o(e.reverseSort)&&u(e.key),C=e=>n(e)&&(null==e.periodFilter||ie(e.periodFilter))&&u(e.query)&&(null==e.scope||he(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>te(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>me(e)))&&(null==e.virtualField||K(e.virtualField))&&(null==e.contentLocale||u(e.contentLocale));var _;e.FtRatingType=void 0,(_=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",_.LIKE="LIKE",_.DICHOTOMOUS="DICHOTOMOUS",_.NO_RATING="NO_RATING";const L=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),P=e=>n(e)&&u(e.date)&&L(e.type)&&l(e.value),D=e=>n(e)&&(null==e.rating||P(e.rating))&&L(e.type),N=e=>n(e)&&u(e.date)&&u(e.tocId)&&L(e.type)&&l(e.value),k=e=>n(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>N(e)))&&L(e.type),M=e=>n(e)&&Array.isArray(e.filter)&&e.filter.every((e=>u(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>u(e)));var w;e.FtPeriodFilterType=void 0,(w=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",w.LAST_MONTH="LAST_MONTH",w.LAST_QUARTER="LAST_QUARTER",w.LAST_YEAR="LAST_YEAR",w.CUSTOM="CUSTOM";const B=e=>["LAST_WEEK","LAST_MONTH","LAST_QUARTER","LAST_YEAR","CUSTOM"].includes(e),H=e=>n(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.key);var x;e.FtSearchSortCriterionOrder=void 0,(x=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",x.DESC="DESC";const V=e=>["ASC","DESC"].includes(e);var $;e.FtSearchSortCriterionType=void 0,($=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",$.NATURAL="NATURAL";const j=e=>["ALPHA","NATURAL"].includes(e);var G;e.FtVirtualField=void 0,(G=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",G.TITLE_ONLY="TITLE_ONLY",G.NONE="NONE";const K=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),q=e=>n(e)&&l(e.totalResultsCount)&&o(e.isLastPage)&&l(e.currentPage)&&l(e.totalClustersCount);var z;e.FtEditorialType=void 0,(z=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",z.BOOK="BOOK",z.SHARED_BOOK="SHARED_BOOK";const X=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var Y;e.FtOpenMode=void 0,(Y=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",Y.EXTERNAL="EXTERNAL";const W=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),J=e=>n(e)&&(null==e.perPage||l(e.perPage))&&l(e.page),Q=e=>n(e)&&u(e.key);var Z;e.FtCollectionDocumentType=void 0,(Z=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",Z.DOCUMENT="DOCUMENT",Z.TOPIC="TOPIC",Z.PERSONAL_BOOK="PERSONAL_BOOK",Z.SHARED_BOOK="SHARED_BOOK";const ee=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),te=e=>n(e)&&o(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>u(e)))&&u(e.label)&&u(e.key),re=e=>n(e)&&u(e.from)&&u(e.to),ie=e=>n(e)&&(null==e.period||re(e.period))&&B(e.periodType)&&(null==e.key||u(e.key)),ae=e=>n(e)&&l(e.weight)&&u(e.value)&&u(e.key),se=e=>n(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ne(e)))&&(null==e.metadataVariableAxis||u(e.metadataVariableAxis)),ne=e=>n(e)&&Array.isArray(e.missingTerms)&&e.missingTerms.every((e=>u(e)))&&(null==e.document||oe(e.document))&&(null==e.topic||ue(e.topic))&&de(e.type)&&(null==e.map||le(e.map)),oe=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&W(e.openMode)&&u(e.documentUrl)&&u(e.mimeType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.viewerUrl)&&u(e.contentUrl)&&u(e.filename)&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.documentId)&&u(e.lastEditionDate)&&u(e.htmlExcerpt),le=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&(null==e.openMode||W(e.openMode))&&X(e.editorialType)&&u(e.title)&&(null==e.lastPublicationDate||u(e.lastPublicationDate))&&u(e.htmlTitle)&&(null==e.originUrl||u(e.originUrl))&&u(e.mapUrl)&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt),ue=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&W(e.openMode)&&u(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>ge(e)))&&u(e.title)&&u(e.mapTitle)&&u(e.topicUrl)&&u(e.contentUrl)&&u(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&(null==e.originUrl||u(e.originUrl))&&u(e.readerUrl)&&u(e.mapId)&&(null==e.lastEditionDate||u(e.lastEditionDate))&&u(e.htmlExcerpt);var ce;e.FtSearchResultType=void 0,(ce=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",ce.DOCUMENT="DOCUMENT",ce.TOPIC="TOPIC";const de=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var pe;e.FtSearchScope=void 0,(pe=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",pe.DOCUMENTS="DOCUMENTS",pe.ALL_TOPICS="ALL_TOPICS";const he=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),ye=e=>n(e)&&o(e.hierarchical)&&u(e.label)&&o(e.multiSelectionable)&&u(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>Ae(e))),fe=e=>n(e)&&(null==e.maxDepth||l(e.maxDepth))&&u(e.id),Ae=e=>n(e)&&l(e.totalResultsCount)&&o(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>Ae(e)))&&u(e.label)&&u(e.value)&&o(e.selected),me=e=>n(e)&&j(e.type)&&u(e.key)&&V(e.order),Ee=e=>n(e)&&u(e.suggestedQuery)&&u(e.htmlSuggestedQuery),ge=e=>n(e)&&u(e.filename)&&u(e.resourceUrl)&&u(e.id)&&u(e.mimeType)&&u(e.resourceContentUrl)&&u(e.viewerUrl),Te=e=>n(e)&&(null==e.filenameExtension||u(e.filenameExtension))&&(null==e.editorialType||X(e.editorialType))&&(null==e.mimeType||u(e.mimeType))&&de(e.type)&&u(e.value);var be;e.FtUserRole=void 0,(be=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",be.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",be.HTML_EXPORT_USER="HTML_EXPORT_USER",be.PDF_EXPORT_USER="PDF_EXPORT_USER",be.SAVED_SEARCH_USER="SAVED_SEARCH_USER",be.COLLECTION_USER="COLLECTION_USER",be.OFFLINE_USER="OFFLINE_USER",be.ANALYTICS_USER="ANALYTICS_USER",be.BETA_USER="BETA_USER",be.DEBUG_USER="DEBUG_USER",be.PRINT_USER="PRINT_USER",be.RATING_USER="RATING_USER",be.FEEDBACK_USER="FEEDBACK_USER",be.GENERATIVE_AI_USER="GENERATIVE_AI_USER",be.CONTENT_PUBLISHER="CONTENT_PUBLISHER",be.KHUB_ADMIN="KHUB_ADMIN",be.USERS_ADMIN="USERS_ADMIN",be.PORTAL_ADMIN="PORTAL_ADMIN",be.ADMIN="ADMIN",be.DEVELOPER="DEVELOPER";const Se=e=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","GENERATIVE_AI_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),Re=e=>n(e)&&u(e.identifier)&&u(e.realm),Fe=e=>n(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>H(e))),Oe=e=>n(e)&&(null==e.emailAddress||u(e.emailAddress))&&(null==e.displayName||u(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>Se(e)))&&(null==e.userId||u(e.userId))&&Array.isArray(e.tags)&&e.tags.every((e=>u(e))),ve=e=>n(e)&&u(e.color)&&Array.isArray(e.text)&&e.text.every((e=>u(e)))&&l(e.opacity),Ue=e=>"object"==typeof e&&null!=e,Ie=e=>"boolean"==typeof e,Ce=e=>"number"==typeof e,_e=e=>"string"==typeof e;var Le;e.FtConfigurationHistoryEntryStatus=void 0,(Le=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Le.INVALID="INVALID";const Pe=e=>Ue(e)&&Ie(e.mailsSentByFluidTopics)&&Ie(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>_e(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>_e(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>_e(e))),De=e=>Ue(e)&&_e(e.role)&&_e(e.content),Ne=e=>Ue(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Ie(e))))&&Ie(e.isVisible),ke=e=>Ue(e)&&(null==e.prettyUrl||_e(e.prettyUrl))&&(null==e.hasRating||Ie(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||_e(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>ke(e)))&&(null==e.pageConfiguration||Ne(e.pageConfiguration))&&(null==e.contentId||_e(e.contentId))&&(null==e.title||_e(e.title)),Me=e=>Ue(e)&&Ie(e.splitCurrentPageToc),we=e=>Ue(e)&&Ue(e.metadata)&&Object.keys(e.metadata).every((e=>_e(e)))&&Object.values(e.metadata).every((e=>Array.isArray(e)&&e.every((e=>_e(e)))))&&_e(e.excerpt)&&Ce(e.relevance),Be=e=>Ue(e)&&Array.isArray(e.values)&&e.values.every((e=>_e(e)))&&_e(e.key),He={[e.FtUserRole.PERSONAL_BOOK_SHARE_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.HTML_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.PDF_EXPORT_USER]:[e.FtUserRole.PERSONAL_BOOK_USER],[e.FtUserRole.KHUB_ADMIN]:[e.FtUserRole.CONTENT_PUBLISHER],[e.FtUserRole.ADMIN]:[e.FtUserRole.KHUB_ADMIN,e.FtUserRole.USERS_ADMIN,e.FtUserRole.PORTAL_ADMIN],[e.FtUserRole.DEVELOPER]:[e.FtUserRole.BETA_USER,e.FtUserRole.DEBUG_USER]};function xe(e,t){return e===t||(He[e]??[]).some((e=>xe(e,t)))}const Ve="undefined"==typeof window?globalThis:window;function $e(e){let t={};for(let r in e){let i=e[r];("object"!=typeof i||Array.isArray(i))&&(i={prior:i});for(let e of["prior","filter"])i[e]=Array.isArray(i[e])?i[e]:[i[e]],i[e]=i[e].map((e=>null!=e?""+e:"")).filter((e=>""!==e));t[r]=i}return t}function je(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ge="undefined"==typeof window?globalThis:window;class Ke extends Error{method;endpoint;status;statusText;body;constructor(e,t,r,i,a){super(`${e} ${t} -> ${r} - ${i}: ${a}`),this.method=e,this.endpoint=t,this.status=r,this.statusText=i,this.body=a}}class qe extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function ze(e,t,r){if(!r.ok){let i={method:e,endpoint:t,status:r.status,statusText:r.statusText,body:await r.text()};throw"function"==typeof Ge.dispatchEvent&&Ge.dispatchEvent(new qe(i)),new Ke(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function Xe(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Ye{tenantBaseUrl;tenantBaseUrlNoTrailingSlash;ftCallingApp;authorization;searchLabel;endpoints={authentication:{login:"api/authentication/login",logout:"api/authentication/logout",currentSession:"api/authentication/current-session"},khub:{maps:{mapId:e=>({info:`api/khub/maps/${e}`,toc:`api/khub/maps/${e}/toc`,pages:`api/khub/maps/${e}/pages`,feedback:`api/khub/maps/${e}/feedback`,rating:`api/khub/maps/${e}/rating`,attachments:{list:`api/khub/maps/${e}/attachments`,attachmentId:t=>({content:`api/khub/maps/${e}/attachments/${t}/content`})},resources:{list:`api/khub/maps/${e}/resources`,resourceId:t=>({content:`api/khub/maps/${e}/resources/${t}/content`})},topics:{contentId:t=>({info:`api/khub/maps/${e}/topics/${t}`,content:`api/khub/maps/${e}/topics/${t}/content`}),tocId:t=>({feedback:`api/khub/maps/${e}/topics/${t}/feedback`,rating:`api/khub/maps/${e}/topics/${t}/rating`})}})},documents:{documentId:e=>({info:`api/khub/documents/${e}`,content:`api/khub/documents/${e}/content`,text:`api/khub/documents/${e}/content/text`,feedback:`api/khub/documents/${e}/feedback`,rating:`api/khub/documents/${e}/rating`})},semantic:{search:"api/khub/semantic/search",clusteredSearch:"api/khub/semantic/clustered-search"},suggest:"api/khub/suggest",clusteredSearch:"api/khub/clustered-search",locales:"api/khub/locales"},users:{userId:e=>({collections:{collectionId:t=>({documents:`api/users/${e}/collections/${t}/documents`})},searches:{list:`api/users/${e}/searches`},bookmarks:{list:`api/users/${e}/bookmarks`}})},stylesheets:{fonts:"stylesheets/fonts.css",theme:"stylesheets/theme.css",content:{title:"stylesheets/content/title.css",topic:"stylesheets/content/topic.css"}},configuration:{reader:"api/configuration/reader",metadata:"api/configuration/metadata"},locales:{ui:"api/locales/ui"},messages:{locale:e=>({fluidTopics:{contextName:t=>({endpoint:`api/messages/${e}/fluid-topics/${t}`})},custom:{contextName:t=>({endpoint:`api/messages/${e}/custom/${t}`})}})},ai:{generate:"api/ai/generate",sendFeedback:"api/ai/rate",chat:"/api/ai/rag/chat"}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ge.fluidTopicsBaseUrl??Ge.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",this.tenantBaseUrlNoTrailingSlash=this.tenantBaseUrl.replace(/\/$/,""),r&&void 0!==Ge.location&&Ge.location.href.startsWith(this.tenantBaseUrl)?this.ftCallingApp=t:this.ftCallingApp=`ft-public-api/${t}`}setApiKey(e){this.authorization={Authorization:"Bearer "+e}}setCredentials(e,t){var r;this.authorization={Authorization:"Basic "+(r=`${e}:${t}`,"undefined"!=typeof Buffer?Buffer.from(r).toString("base64"):btoa(r))}}clearAuthentication(){this.authorization=void 0}setSearchLabel(e){this.searchLabel={"FT-search-label":e}}clearSearchLabel(){this.searchLabel=void 0}login(e,t){let r={login:e,password:t,rememberMe:!0};return this.post(this.endpoints.authentication.login,r).then((r=>(this.setCredentials(e,t),r)))}logout(){return this.post(this.endpoints.authentication.logout).then((()=>this.clearAuthentication()))}getCurrentSession(){return this.get(this.endpoints.authentication.currentSession)}getReaderConfiguration(){return this.get(this.endpoints.configuration.reader)}getMap(e,t){return this.get(this.endpoints.khub.maps.mapId(e).info,t)}getTableOfContent(e,t){return this.get(this.endpoints.khub.maps.mapId(e).toc,t)}getPages(e,t){return this.get(this.endpoints.khub.maps.mapId(e).pages,t)}getTopic(e,t,r){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).info,r)}getTopicHTMLContent(e,t,r,i){return this.get(this.endpoints.khub.maps.mapId(e).topics.contentId(t).content+(r?"?target="+r:""),i)}getMapAttachments(e,t){return this.get(this.endpoints.khub.maps.mapId(e).attachments.list,t)}getMapAttachmentContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).attachments.attachmentId(t).content,r)}getMapResources(e,t){return this.get(this.endpoints.khub.maps.mapId(e).resources.list,t)}getMapResourceContent(e,t,r){return this.fetchRawData(this.endpoints.khub.maps.mapId(e).resources.resourceId(t).content,r)}getUnstructuredDocument(e,t){return this.get(this.endpoints.khub.documents.documentId(e).info,t)}getUnstructuredDocumentContent(e,t){return this.fetchRawData(this.endpoints.khub.documents.documentId(e).content,t)}getUnstructuredDocumentTextContent(e,t){return this.get(this.endpoints.khub.documents.documentId(e).text,t)}getCollectionDocuments(e,t){return this.get(this.endpoints.users.userId(e).collections.collectionId(t).documents)}getSuggestions(e){return this.post(this.endpoints.khub.suggest,e)}search(e){return this.post(this.endpoints.khub.clusteredSearch,e)}getAvailableSearchLocales(){return this.get(this.endpoints.khub.locales)}getAvailableUiLocales(){return this.get(this.endpoints.locales.ui)}getMetadataConfiguration(){return this.get(this.endpoints.configuration.metadata)}getMapRating(e){return this.get(this.endpoints.khub.maps.mapId(e).rating)}rateMap(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).rating,{type:t,value:r})}unrateMap(e){return this.delete(this.endpoints.khub.maps.mapId(e).rating)}sendMapFeedback(e,t,r){return this.post(this.endpoints.khub.maps.mapId(e).feedback,{message:t,from:r})}rateTopic(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating,{type:r,value:i})}unrateTopic(e,t){return this.delete(this.endpoints.khub.maps.mapId(e).topics.tocId(t).rating)}sendTopicFeedback(e,t,r,i){return this.post(this.endpoints.khub.maps.mapId(e).topics.tocId(t).feedback,{message:r,from:i})}getDocumentRating(e){return this.get(this.endpoints.khub.documents.documentId(e).rating)}rateDocument(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).rating,{type:t,value:r})}unrateDocument(e){return this.delete(this.endpoints.khub.documents.documentId(e).rating)}sendDocumentFeedback(e,t,r){return this.post(this.endpoints.khub.documents.documentId(e).feedback,{message:t,from:r})}semanticSearch(e){return this.post(this.endpoints.khub.semantic.search,{request:e})}clusteredSemanticSearch(e){return this.post(this.endpoints.khub.semantic.clusteredSearch,{request:e})}getFluidTopicsMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).fluidTopics.contextName(t).endpoint)}getCustomMessageContext(e,t){return this.get(this.endpoints.messages.locale(e).custom.contextName(t).endpoint)}listMySearches(e){return this.get(this.endpoints.users.userId(e).searches.list)}listMyBookmarks(e){return this.get(this.endpoints.users.userId(e).bookmarks.list)}async*generate(e,t){const r=await this.fetch(this.endpoints.ai.generate,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profileId:e,parameters:t}),credentials:null==this.authorization?"include":void 0});await ze("POST",this.endpoints.ai.generate,r);const i=new s(r.body.getReader());yield*i.read()}async*chat(e){const t=await this.fetch(this.endpoints.ai.chat,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:null==this.authorization?"include":void 0});await ze("POST",this.endpoints.ai.chat,t);const r=new s(t.body.getReader());yield*r.read()}sendFeedback(e){return this.post(this.endpoints.ai.sendFeedback,e)}get(e,t){return this.makeRequest("GET",this.withVersion(e,t))}post(e,t){return this.makeRequest("POST",e,t)}put(e,t){return this.makeRequest("PUT",e,t)}delete(e){return this.makeRequest("DELETE",e)}makeAbsolute(e){return e.startsWith(this.tenantBaseUrl)||e===this.tenantBaseUrlNoTrailingSlash?e:this.tenantBaseUrl+e.replace(/^\//,"")}async fetch(e,t){const r=t;return await a(this.makeAbsolute(e),{...r??{},headers:{...this.defaultHeaders,...r?.headers??{}}})}upload(e,t,r,i=(()=>{})){return"undefined"!=typeof XMLHttpRequest?new Promise(((a,s)=>{let n=new XMLHttpRequest;n.onload=()=>{if(n.status>=200&&n.status<300){let e="application/json"===n.getResponseHeader("Content-Type")?JSON.parse(n.responseText):n.responseText;a(e)}else s(new Ke("GET",t,n.status,n.statusText,n.responseText))},n.upload.onprogress=e=>i(e),n.open(e,this.makeAbsolute(t),!0),n.send(r)})):this.fetch(t,{method:e,body:r}).then((r=>ze(e,t,r))).then(Xe)}makeRequest(e,t,r){return this.fetch(t,{method:e,headers:{...null!=r?{"Content-Type":"application/json"}:{}},body:null!=r?JSON.stringify(r):void 0,credentials:null==this.authorization?"include":void 0}).then((r=>ze(e,t,r))).then(Xe)}fetchRawData(e,t){return a(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>ze("GET",e,t))).then((e=>e.arrayBuffer()))}withVersion(e,t){let r=new URL(this.makeAbsolute(e));return t&&r.searchParams.append("v",t),r.toString()}}e.FluidTopicsApi=Ye,e.HttpError=Ke,e.HttpErrorEvent=qe,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Ve.localStorage){const r=je(e),i=e=>{e.storageArea===Ve.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Ve.addEventListener("storage",i),{removeHandler:()=>Ve.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Ye,e.getUnauthenticatedUserSearchPreferences=function(e){if(Ve.localStorage)return JSON.parse(Ve.localStorage.getItem(je(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>n(e)&&Re(e.authenticationIdentifier)&&Oe(e.profile),e.isFtAuthenticationIdentifier=Re,e.isFtBookmark=e=>n(e)&&u(e.mapTitle)&&d(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>u(e)))&&u(e.tocId)&&u(e.lastUpdate)&&u(e.readerUrl)&&u(e.mapId)&&u(e.id)&&u(e.title)&&u(e.creationDate),e.isFtClusteredSemanticSearchReply=e=>Ue(e)&&Array.isArray(e.documents)&&e.documents.every((e=>we(e)))&&Array.isArray(e.clusterId)&&e.clusterId.every((e=>_e(e))),e.isFtCollectionDocument=e=>n(e)&&o(e.deleted)&&(null==e.apiUrl||u(e.apiUrl))&&(null==e.portalUrl||u(e.portalUrl))&&u(e.id)&&u(e.title)&&ee(e.type),e.isFtCollectionDocumentType=ee,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>n(e)&&u(e.password)&&(null==e.newPassword||u(e.newPassword))&&o(e.rememberMe)&&u(e.login),e.isFtEditorialType=X,e.isFtExternalWebComponentContext=e=>["HOMEPAGE","CUSTOM","HEADER","READER","TOPIC_TEMPLATE","SEARCH","SEARCH_RESULT"].includes(e),e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>n(e)&&(null==e.from||u(e.from))&&u(e.message),e.isFtGenAIGenerateInput=e=>Ue(e)&&_e(e.profileId)&&(null==e.parameters||Ue(e.parameters)&&Object.keys(e.parameters).every((e=>_e(e)))&&Object.values(e.parameters).every((e=>_e(e)))),e.isFtGenAIRating=e=>Ue(e)&&Ce(e.rating)&&_e(e.comment)&&_e(e.queryId),e.isFtHttpErrorDetails=e=>n(e)&&u(e.endpoint)&&u(e.method)&&u(e.statusText)&&u(e.body)&&l(e.status),e.isFtLabeledSearchFilter=te,e.isFtMap=e=>n(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&(null==e.watermark||ve(e.watermark))&&W(e.openMode)&&(null==e.topicsApiEndpoint||u(e.topicsApiEndpoint))&&(null==e.description||u(e.description))&&(null==e.attachmentsApiEndpoint||u(e.attachmentsApiEndpoint))&&X(e.editorialType)&&u(e.baseId)&&u(e.clusterId)&&u(e.title)&&u(e.lastPublication)&&o(e.pbkConfidential)&&u(e.lastEdition)&&u(e.originId)&&(null==e.rightsApiEndpoint||u(e.rightsApiEndpoint))&&m(e.contentStyles)&&(null==e.originUrl||u(e.originUrl))&&u(e.fingerprint)&&u(e.readerUrl)&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtMapAttachment=e=>Ue(e)&&_e(e.file)&&(null==e.size||Ce(e.size))&&Ie(e.externalLink)&&_e(e.name)&&_e(e.id)&&(null==e.mimeType||_e(e.mimeType))&&(null==e.viewerUrl||_e(e.viewerUrl)),e.isFtMapResource=e=>n(e)&&u(e.contentUrl)&&u(e.filename)&&u(e.id)&&u(e.mimeType),e.isFtMapStyles=m,e.isFtMessageContext=e=>n(e)&&u(e.name)&&n(e.messages)&&Object.keys(e.messages).every((e=>u(e)))&&Object.values(e.messages).every((e=>u(e)))&&u(e.locale),e.isFtMetadata=O,e.isFtMetadataConfiguration=e=>n(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>I(e))),e.isFtMetadataDescriptor=I,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=M,e.isFtMetadataSortRule=U,e.isFtMyLibraryColors=d,e.isFtMySearch=e=>n(e)&&C(e.searchRequest)&&d(e.color)&&o(e.alert)&&u(e.description)&&u(e.id)&&u(e.ownerId)&&u(e.title)&&u(e.creationDate),e.isFtMySearchRequest=C,e.isFtOpenMode=W,e.isFtPageConfiguration=Ne,e.isFtPageRequest=J,e.isFtPaginatedToc=e=>Ue(e)&&Me(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>ke(e))),e.isFtPaginatedTocNode=ke,e.isFtPaginationConfiguration=Me,e.isFtPeriod=re,e.isFtPeriodFilter=ie,e.isFtPeriodFilterType=B,e.isFtPersonalBookCreation=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>y(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>f(e)))&&u(e.description)&&u(e.title),e.isFtPersonalBookMetadataUpdate=y,e.isFtPersonalBookNodeCreation=f,e.isFtPersonalBookTopicLinkCreation=A,e.isFtPublicClusterSortCriterion=Q,e.isFtPublicationRating=P,e.isFtPublicationRatingSummary=D,e.isFtRagHistory=De,e.isFtRagInput=e=>Ue(e)&&_e(e.profileId)&&(null==e.conversationId||_e(e.conversationId))&&_e(e.query)&&(null==e.messages||Array.isArray(e.messages)&&e.messages.every((e=>De(e))))&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>Be(e)))),e.isFtRatingCreation=e=>n(e)&&L(e.type)&&l(e.value),e.isFtRatingSummary=e=>n(e)&&(null==e.topics||k(e.topics))&&D(e.publication),e.isFtRatingType=L,e.isFtReaderConfiguration=e=>Ue(e)&&Pe(e.feedback)&&Ce(e.loadAfterLastVisibleTopic)&&_e(e.relativeTopicPivotMetadata)&&Ce(e.loadBeforeFirstVisibleTopic)&&_e(e.relativePivotMetadata),e.isFtReaderFeedbackConfiguration=Pe,e.isFtSearchFacet=ye,e.isFtSearchFacetConf=fe,e.isFtSearchFacetEntry=Ae,e.isFtSearchFilter=H,e.isFtSearchLocale=R,e.isFtSearchLocales=e=>n(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>R(e))),e.isFtSearchPreferences=Fe,e.isFtSearchPreferencesConfiguration=e=>n(e)&&n(e.metadata)&&Object.keys(e.metadata).every((e=>u(e)))&&Object.values(e.metadata).every((e=>M(e))),e.isFtSearchPreset=e=>n(e)&&u(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>H(e)))&&l(e.priority)&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSearchPrior=ae,e.isFtSearchRequest=e=>n(e)&&(null==e.periodFilter||ie(e.periodFilter))&&u(e.query)&&J(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>H(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>me(e)))&&(null==e.virtualField||K(e.virtualField))&&Array.isArray(e.facets)&&e.facets.every((e=>fe(e)))&&(null==e.scope||he(e.scope))&&(null==e.uiLocale||u(e.uiLocale))&&(null==e.contentLocale||u(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>ae(e))))&&(null==e.clusterSortCriterions||Array.isArray(e.clusterSortCriterions)&&e.clusterSortCriterions.every((e=>Q(e)))),e.isFtSearchResultCluster=se,e.isFtSearchResultClusterEntry=ne,e.isFtSearchResultMap=le,e.isFtSearchResultTopic=ue,e.isFtSearchResultType=de,e.isFtSearchResultUnstructuredDocument=oe,e.isFtSearchResults=e=>n(e)&&(null==e.spellcheck||Ee(e.spellcheck))&&q(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>se(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>ye(e))),e.isFtSearchResultsPageInfo=q,e.isFtSearchScope=he,e.isFtSearchSortCriterion=me,e.isFtSearchSortCriterionOrder=V,e.isFtSearchSortCriterionType=j,e.isFtSemanticSearchFilter=Be,e.isFtSemanticSearchRequest=e=>Ue(e)&&_e(e.query)&&(null==e.filters||Array.isArray(e.filters)&&e.filters.every((e=>Be(e))))&&(null==e.nbResults||Ce(e.nbResults)),e.isFtSemanticSearchResponseItem=we,e.isFtSession=e=>n(e)&&(null==e.authenticationIdentifier||Re(e.authenticationIdentifier))&&l(e.idleTimeoutInMillis)&&Oe(e.profile)&&o(e.sessionAuthenticated)&&Fe(e.searchPreferences),e.isFtSpellcheck=Ee,e.isFtSuggestRequest=e=>n(e)&&u(e.input)&&(null==e.scope||he(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>H(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>me(e)))&&(null==e.maxCount||l(e.maxCount))&&(null==e.contentLocale||u(e.contentLocale)),e.isFtSuggestResult=Te,e.isFtSuggestResults=e=>n(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>Te(e))),e.isFtTocNode=E,e.isFtTopic=e=>n(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&u(e.id)&&u(e.contentApiEndpoint)&&u(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=g,e.isFtTopicOriginType=h,e.isFtTopicRating=N,e.isFtTopicResource=ge,e.isFtTopicsRatingSummary=k,e.isFtUiLocale=e=>n(e)&&u(e.displayName)&&u(e.languageTag)&&o(e.translated),e.isFtUnstructuredDocument=e=>n(e)&&(null==e.prettyUrl||u(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>O(e)))&&u(e.openMode)&&(null==e.description||u(e.description))&&u(e.mimeType)&&(null==e.baseId||u(e.baseId))&&(null==e.clusterId||u(e.clusterId))&&u(e.contentApiEndpoint)&&u(e.title)&&(null==e.lastPublication||u(e.lastPublication))&&u(e.viewerUrl)&&u(e.lastEdition)&&u(e.filename)&&(null==e.originId||u(e.originId))&&u(e.rightsApiEndpoint)&&(null==e.originUrl||u(e.originUrl))&&(null==e.khubVersion||u(e.khubVersion))&&u(e.id)&&(null==e.lang||u(e.lang)),e.isFtUserProfile=Oe,e.isFtUserRole=Se,e.isFtVirtualField=K,e.isFtWatermark=ve,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Ve.localStorage){let r={...t,metadata:$e(t.metadata??{})};const i=je(e),a=JSON.stringify(r);return Ve.localStorage.setItem(i,a),Ve.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Ve.localStorage,url:Ve.location.href})),r}console.error("Cannot set unauthenticated preferences: local storage is unavailable.")},e.userHasRole=function(e,t){return null!=e&&(Array.isArray(e)?e:Array.isArray(e.roles)?e.roles:Array.isArray(e.profile?.roles)?e.profile.roles:[]).some((e=>xe(e,t)))}}));
@@ -1,4 +1,3 @@
1
- import "cross-fetch/polyfill";
2
1
  import { FtAuthenticatedSession, FtBookmark, FtCollectionDocument, FtHttpErrorDetails, FtMap, FtMapResource, FtMessageContext, FtMetadataConfiguration, FtMySearch, FtRatingSummary, FtRatingType, FtRatingTypeKeys, FtSearchLocales, FtSearchRequest, FtSearchResults, FtSession, FtSuggestRequest, FtSuggestResults, FtTocNode, FtTopic, FtTopicContentTarget, FtTopicContentTargetKeys, FtUiLocale, FtUnstructuredDocument } from "./types/ft-common/public";
3
2
  import { FtClusteredSemanticSearchReply, FtGenAIRating, FtMapAttachment, FtPaginatedToc, FtRagInput, FtReaderConfiguration, FtSemanticSearchRequest, FtSemanticSearchResponseItem } from "./types/ft-server/public";
4
3
  import { GenAIChunk } from "./helpers/GenAIChunkReader";
package/dist/mjs/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "cross-fetch/polyfill";
1
+ import fetch from "cross-fetch";
2
2
  import { GenAIChunkReader } from "./helpers/GenAIChunkReader";
3
3
  const wnd = (typeof window === "undefined" ? globalThis : window);
4
4
  export * from "./types/ft-common/public";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/public-api",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "description": "Fluid Topics Public API",
5
5
  "author": "Fluid Topics dev team <opensource@antidot.net>",
6
6
  "license": "LGPL-3.0-only",
@@ -20,7 +20,7 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "cross-fetch": "3.1.5"
23
+ "cross-fetch": "4.1.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@cyclonedx/bom": "^3.10.6",