@fluid-topics/public-api
Advanced tools
Comparing version 1.0.56 to 1.0.57
@@ -303,2 +303,3 @@ "use strict"; | ||
&& ((0, exports.isFtMetadataSortRule)(o.sortRule)) | ||
&& (isString(o.label)) | ||
&& (isBoolean(o.reverseSort)) | ||
@@ -305,0 +306,0 @@ && (isString(o.key)); |
@@ -22,3 +22,5 @@ "use strict"; | ||
&& (isNumber(o.loadAfterLastVisibleTopic)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)); | ||
&& (isString(o.relativeTopicPivotMetadata)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)) | ||
&& (isString(o.relativePivotMetadata)); | ||
}; | ||
@@ -25,0 +27,0 @@ exports.isFtReaderConfiguration = isFtReaderConfiguration; |
@@ -231,2 +231,3 @@ export interface FtHttpErrorDetails { | ||
sortRule: FtMetadataSortRuleKeys; | ||
label: string; | ||
reverseSort: boolean; | ||
@@ -233,0 +234,0 @@ key: string; |
@@ -272,2 +272,3 @@ const isObject = (o) => typeof o === "object" && o != null; | ||
&& (isFtMetadataSortRule(o.sortRule)) | ||
&& (isString(o.label)) | ||
&& (isBoolean(o.reverseSort)) | ||
@@ -274,0 +275,0 @@ && (isString(o.key)); |
@@ -10,3 +10,5 @@ export declare enum FtConfigurationHistoryEntryStatus { | ||
loadAfterLastVisibleTopic: number; | ||
relativeTopicPivotMetadata: string; | ||
loadBeforeFirstVisibleTopic: number; | ||
relativePivotMetadata: string; | ||
} | ||
@@ -13,0 +15,0 @@ export declare const isFtReaderConfiguration: (o: any) => o is FtReaderConfiguration; |
@@ -18,3 +18,5 @@ const isObject = (o) => typeof o === "object" && o != null; | ||
&& (isNumber(o.loadAfterLastVisibleTopic)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)); | ||
&& (isString(o.relativeTopicPivotMetadata)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)) | ||
&& (isString(o.relativePivotMetadata)); | ||
}; | ||
@@ -21,0 +23,0 @@ export const isFtReaderFeedbackConfiguration = (o) => { |
@@ -1,1 +0,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(A)}),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 f(e,t){var r,i,a=(t=t||{}).body;if(e instanceof f){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 A(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 m(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)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];m.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new m(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 f(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 m(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=f,e.Response=m),t.Headers=l,t.Request=f,t.Response=m,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,a=e=>"number"==typeof e,s=e=>"string"==typeof e;var n;e.FtMyLibraryColors=void 0,(n=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",n.green="green",n.blue="blue",n.purple="purple",n.red="red",n.orange="orange",n.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var A;e.FtTopicContentTarget=void 0,(A=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",A.OFF_THE_GRID="OFF_THE_GRID",A.CONTENT_PACKAGER="CONTENT_PACKAGER",A.PAGES="PAGES",A.DESIGNED_READER="DESIGNED_READER";var m;e.FtMetadataHomeLayout=void 0,(m=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",m.CUSTOM="CUSTOM",m.DESIGNER="DESIGNER";const E=e=>r(e)&&a(e.count)&&s(e.label)&&(null==e.lang||s(e.lang));var g;e.FtFacetType=void 0,(g=e.FtFacetType||(e.FtFacetType={})).AND="AND",g.OR="OR",g.MONOVALUED="MONOVALUED";const b=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key);var T;e.FtMetadataSortRule=void 0,(T=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",T.ALPHABET="ALPHABET",T.VERSION="VERSION";const S=e=>["NONE","ALPHABET","VERSION"].includes(e),R=e=>r(e)&&S(e.sortRule)&&i(e.reverseSort)&&s(e.key),F=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>J(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale));var O;e.FtRatingType=void 0,(O=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",O.LIKE="LIKE",O.DICHOTOMOUS="DICHOTOMOUS",O.NO_RATING="NO_RATING";const U=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),I=e=>r(e)&&s(e.date)&&U(e.type)&&a(e.value),v=e=>r(e)&&(null==e.rating||I(e.rating))&&U(e.type),_=e=>r(e)&&s(e.date)&&s(e.tocId)&&U(e.type)&&a(e.value),C=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>_(e)))&&U(e.type),L=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),D=e=>r(e)&&s(e.from)&&s(e.to),P=e=>r(e)&&(null==e.period||D(e.period))&&M(e.periodType);var N;e.FtPeriodFilterType=void 0,(N=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",N.LAST_MONTH="LAST_MONTH",N.LAST_YEAR="LAST_YEAR",N.CUSTOM="CUSTOM";const M=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),k=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(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),K=e=>r(e)&&a(e.totalResultsCount)&&i(e.isLastPage)&&a(e.currentPage)&&a(e.totalClustersCount);var j;e.FtEditorialType=void 0,(j=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",j.BOOK="BOOK",j.SHARED_BOOK="SHARED_BOOK";const G=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=>r(e)&&(null==e.perPage||a(e.perPage))&&a(e.page);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 W=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),J=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),Q=e=>r(e)&&a(e.weight)&&s(e.value)&&s(e.key),Z=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ee(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),ee=e=>r(e)&&(null==e.document||te(e.document))&&(null==e.topic||ie(e.topic))&&se(e.type)&&(null==e.map||re(e.map)),te=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),re=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.openMode||X(e.openMode))&&G(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),ie=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>he(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var ae;e.FtSearchResultType=void 0,(ae=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",ae.DOCUMENT="DOCUMENT",ae.TOPIC="TOPIC";const se=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var ne;e.FtSearchScope=void 0,(ne=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",ne.DOCUMENTS="DOCUMENTS",ne.ALL_TOPICS="ALL_TOPICS";const oe=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),le=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>ce(e))),ue=e=>r(e)&&(null==e.maxDepth||a(e.maxDepth))&&s(e.id),ce=e=>r(e)&&a(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>ce(e)))&&s(e.label)&&s(e.value)&&i(e.selected),de=e=>r(e)&&x(e.type)&&s(e.key)&&B(e.order),pe=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),he=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),ye=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||G(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&se(e.type)&&s(e.value);var fe;e.FtUserRole=void 0,(fe=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",fe.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",fe.HTML_EXPORT_USER="HTML_EXPORT_USER",fe.PDF_EXPORT_USER="PDF_EXPORT_USER",fe.SAVED_SEARCH_USER="SAVED_SEARCH_USER",fe.COLLECTION_USER="COLLECTION_USER",fe.OFFLINE_USER="OFFLINE_USER",fe.ANALYTICS_USER="ANALYTICS_USER",fe.BETA_USER="BETA_USER",fe.DEBUG_USER="DEBUG_USER",fe.PRINT_USER="PRINT_USER",fe.RATING_USER="RATING_USER",fe.FEEDBACK_USER="FEEDBACK_USER",fe.CONTENT_PUBLISHER="CONTENT_PUBLISHER",fe.KHUB_ADMIN="KHUB_ADMIN",fe.USERS_ADMIN="USERS_ADMIN",fe.PORTAL_ADMIN="PORTAL_ADMIN",fe.ADMIN="ADMIN",fe.DEVELOPER="DEVELOPER";const Ae=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","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),me=e=>r(e)&&s(e.identifier)&&s(e.realm),Ee=e=>r(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>k(e))),ge=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>Ae(e)))&&(null==e.userId||s(e.userId)),be=e=>"object"==typeof e&&null!=e,Te=e=>"boolean"==typeof e,Se=e=>"number"==typeof e,Re=e=>"string"==typeof e;var Fe;e.FtConfigurationHistoryEntryStatus=void 0,(Fe=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Fe.INVALID="INVALID";const Oe=e=>be(e)&&Te(e.mailsSentByFluidTopics)&&Te(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Re(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Re(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Re(e))),Ue=e=>be(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Te(e))))&&Te(e.isVisible),Ie=e=>be(e)&&(null==e.prettyUrl||Re(e.prettyUrl))&&(null==e.hasRating||Te(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Re(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Ie(e)))&&(null==e.pageConfiguration||Ue(e.pageConfiguration))&&(null==e.contentId||Re(e.contentId))&&(null==e.title||Re(e.title)),ve=e=>be(e)&&Te(e.splitCurrentPageToc),_e={[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 Ce(e,t){return e===t||(_e[e]??[]).some((e=>Ce(e,t)))}const Le="undefined"==typeof window?globalThis:window;function De(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 Pe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ne="undefined"==typeof window?globalThis:window;class Me 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 ke extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function we(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 Ne.dispatchEvent&&Ne.dispatchEvent(new ke(i)),new Me(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function Be(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class He{tenantBaseUrl;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`})},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:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/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}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ne.fluidTopicsBaseUrl??Ne.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ne.location&&Ne.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.khub.locales)}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})}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)}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.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 Me("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=>we(e,t,r))).then(Be)}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=>we(e,t,r))).then(Be)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>we("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=He,e.HttpError=Me,e.HttpErrorEvent=ke,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Le.localStorage){const r=Pe(e),i=e=>{e.storageArea===Le.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Le.addEventListener("storage",i),{removeHandler:()=>Le.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=He,e.getUnauthenticatedUserSearchPreferences=function(e){if(Le.localStorage)return JSON.parse(Le.localStorage.getItem(Pe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&me(e.authenticationIdentifier)&&ge(e.profile),e.isFtAuthenticationIdentifier=me,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&W(e.type),e.isFtCollectionDocumentType=W,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=G,e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtHttpErrorDetails=e=>r(e)&&s(e.endpoint)&&s(e.method)&&s(e.statusText)&&s(e.body)&&a(e.status),e.isFtLabeledSearchFilter=J,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&G(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&(null==e.rightsApiEndpoint||s(e.rightsApiEndpoint))&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.fingerprint)&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>be(e)&&Re(e.file)&&(null==e.size||Se(e.size))&&Te(e.externalLink)&&Re(e.name)&&Re(e.id)&&(null==e.mimeType||Re(e.mimeType))&&(null==e.viewerUrl||Re(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=b,e.isFtMetadataConfiguration=e=>r(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>R(e))),e.isFtMetadataDescriptor=R,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=L,e.isFtMetadataSortRule=S,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&F(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=F,e.isFtOpenMode=X,e.isFtPageConfiguration=Ue,e.isFtPageRequest=Y,e.isFtPaginatedToc=e=>be(e)&&ve(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Ie(e))),e.isFtPaginatedTocNode=Ie,e.isFtPaginationConfiguration=ve,e.isFtPeriod=D,e.isFtPeriodFilter=P,e.isFtPeriodFilterType=M,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=I,e.isFtPublicationRatingSummary=v,e.isFtRatingCreation=e=>r(e)&&U(e.type)&&a(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||C(e.topics))&&v(e.publication),e.isFtRatingType=U,e.isFtReaderConfiguration=e=>be(e)&&Oe(e.feedback)&&Se(e.loadAfterLastVisibleTopic)&&Se(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Oe,e.isFtSearchFacet=le,e.isFtSearchFacetConf=ue,e.isFtSearchFacetEntry=ce,e.isFtSearchFilter=k,e.isFtSearchLocale=E,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>E(e))),e.isFtSearchPreferences=Ee,e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>L(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&a(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=Q,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Y(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>Q(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ue(e))),e.isFtSearchResultCluster=Z,e.isFtSearchResultClusterEntry=ee,e.isFtSearchResultMap=re,e.isFtSearchResultTopic=ie,e.isFtSearchResultType=se,e.isFtSearchResultUnstructuredDocument=te,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||pe(e.spellcheck))&&K(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Z(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>le(e))),e.isFtSearchResultsPageInfo=K,e.isFtSearchScope=oe,e.isFtSearchSortCriterion=de,e.isFtSearchSortCriterionOrder=B,e.isFtSearchSortCriterionType=x,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||me(e.authenticationIdentifier))&&a(e.idleTimeoutInMillis)&&ge(e.profile)&&i(e.sessionAuthenticated)&&Ee(e.searchPreferences),e.isFtSpellcheck=pe,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.maxCount||a(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=ye,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ye(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=_,e.isFtTopicResource=he,e.isFtTopicsRatingSummary=C,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ge,e.isFtUserRole=Ae,e.isFtVirtualField=$,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Le.localStorage){let r={...t,metadata:De(t.metadata??{})};const i=Pe(e),a=JSON.stringify(r);return Le.localStorage.setItem(i,a),Le.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Le.localStorage,url:Le.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=>Ce(e,t)))}})); | ||
!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(A)}),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 f(e,t){var r,i,a=(t=t||{}).body;if(e instanceof f){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 A(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 m(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)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];m.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new m(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 f(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 m(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=f,e.Response=m),t.Headers=l,t.Request=f,t.Response=m,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,a=e=>"number"==typeof e,s=e=>"string"==typeof e;var n;e.FtMyLibraryColors=void 0,(n=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",n.green="green",n.blue="blue",n.purple="purple",n.red="red",n.orange="orange",n.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var A;e.FtTopicContentTarget=void 0,(A=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",A.OFF_THE_GRID="OFF_THE_GRID",A.CONTENT_PACKAGER="CONTENT_PACKAGER",A.PAGES="PAGES",A.DESIGNED_READER="DESIGNED_READER";var m;e.FtMetadataHomeLayout=void 0,(m=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",m.CUSTOM="CUSTOM",m.DESIGNER="DESIGNER";const E=e=>r(e)&&a(e.count)&&s(e.label)&&(null==e.lang||s(e.lang));var g;e.FtFacetType=void 0,(g=e.FtFacetType||(e.FtFacetType={})).AND="AND",g.OR="OR",g.MONOVALUED="MONOVALUED";const b=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key);var T;e.FtMetadataSortRule=void 0,(T=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",T.ALPHABET="ALPHABET",T.VERSION="VERSION";const S=e=>["NONE","ALPHABET","VERSION"].includes(e),R=e=>r(e)&&S(e.sortRule)&&s(e.label)&&i(e.reverseSort)&&s(e.key),F=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>J(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale));var O;e.FtRatingType=void 0,(O=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",O.LIKE="LIKE",O.DICHOTOMOUS="DICHOTOMOUS",O.NO_RATING="NO_RATING";const U=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),I=e=>r(e)&&s(e.date)&&U(e.type)&&a(e.value),v=e=>r(e)&&(null==e.rating||I(e.rating))&&U(e.type),_=e=>r(e)&&s(e.date)&&s(e.tocId)&&U(e.type)&&a(e.value),C=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>_(e)))&&U(e.type),L=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),D=e=>r(e)&&s(e.from)&&s(e.to),P=e=>r(e)&&(null==e.period||D(e.period))&&M(e.periodType);var N;e.FtPeriodFilterType=void 0,(N=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",N.LAST_MONTH="LAST_MONTH",N.LAST_YEAR="LAST_YEAR",N.CUSTOM="CUSTOM";const M=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),k=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(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),K=e=>r(e)&&a(e.totalResultsCount)&&i(e.isLastPage)&&a(e.currentPage)&&a(e.totalClustersCount);var j;e.FtEditorialType=void 0,(j=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",j.BOOK="BOOK",j.SHARED_BOOK="SHARED_BOOK";const G=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=>r(e)&&(null==e.perPage||a(e.perPage))&&a(e.page);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 W=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),J=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),Q=e=>r(e)&&a(e.weight)&&s(e.value)&&s(e.key),Z=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ee(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),ee=e=>r(e)&&(null==e.document||te(e.document))&&(null==e.topic||ie(e.topic))&&se(e.type)&&(null==e.map||re(e.map)),te=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),re=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.openMode||X(e.openMode))&&G(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),ie=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>he(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var ae;e.FtSearchResultType=void 0,(ae=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",ae.DOCUMENT="DOCUMENT",ae.TOPIC="TOPIC";const se=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var ne;e.FtSearchScope=void 0,(ne=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",ne.DOCUMENTS="DOCUMENTS",ne.ALL_TOPICS="ALL_TOPICS";const oe=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),le=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>ce(e))),ue=e=>r(e)&&(null==e.maxDepth||a(e.maxDepth))&&s(e.id),ce=e=>r(e)&&a(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>ce(e)))&&s(e.label)&&s(e.value)&&i(e.selected),de=e=>r(e)&&x(e.type)&&s(e.key)&&B(e.order),pe=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),he=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),ye=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||G(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&se(e.type)&&s(e.value);var fe;e.FtUserRole=void 0,(fe=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",fe.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",fe.HTML_EXPORT_USER="HTML_EXPORT_USER",fe.PDF_EXPORT_USER="PDF_EXPORT_USER",fe.SAVED_SEARCH_USER="SAVED_SEARCH_USER",fe.COLLECTION_USER="COLLECTION_USER",fe.OFFLINE_USER="OFFLINE_USER",fe.ANALYTICS_USER="ANALYTICS_USER",fe.BETA_USER="BETA_USER",fe.DEBUG_USER="DEBUG_USER",fe.PRINT_USER="PRINT_USER",fe.RATING_USER="RATING_USER",fe.FEEDBACK_USER="FEEDBACK_USER",fe.CONTENT_PUBLISHER="CONTENT_PUBLISHER",fe.KHUB_ADMIN="KHUB_ADMIN",fe.USERS_ADMIN="USERS_ADMIN",fe.PORTAL_ADMIN="PORTAL_ADMIN",fe.ADMIN="ADMIN",fe.DEVELOPER="DEVELOPER";const Ae=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","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),me=e=>r(e)&&s(e.identifier)&&s(e.realm),Ee=e=>r(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>k(e))),ge=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>Ae(e)))&&(null==e.userId||s(e.userId)),be=e=>"object"==typeof e&&null!=e,Te=e=>"boolean"==typeof e,Se=e=>"number"==typeof e,Re=e=>"string"==typeof e;var Fe;e.FtConfigurationHistoryEntryStatus=void 0,(Fe=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Fe.INVALID="INVALID";const Oe=e=>be(e)&&Te(e.mailsSentByFluidTopics)&&Te(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Re(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Re(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Re(e))),Ue=e=>be(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Te(e))))&&Te(e.isVisible),Ie=e=>be(e)&&(null==e.prettyUrl||Re(e.prettyUrl))&&(null==e.hasRating||Te(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Re(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Ie(e)))&&(null==e.pageConfiguration||Ue(e.pageConfiguration))&&(null==e.contentId||Re(e.contentId))&&(null==e.title||Re(e.title)),ve=e=>be(e)&&Te(e.splitCurrentPageToc),_e={[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 Ce(e,t){return e===t||(_e[e]??[]).some((e=>Ce(e,t)))}const Le="undefined"==typeof window?globalThis:window;function De(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 Pe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ne="undefined"==typeof window?globalThis:window;class Me 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 ke extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function we(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 Ne.dispatchEvent&&Ne.dispatchEvent(new ke(i)),new Me(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function Be(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class He{tenantBaseUrl;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`})},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:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/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}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ne.fluidTopicsBaseUrl??Ne.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ne.location&&Ne.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.khub.locales)}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})}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)}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.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 Me("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=>we(e,t,r))).then(Be)}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=>we(e,t,r))).then(Be)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>we("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=He,e.HttpError=Me,e.HttpErrorEvent=ke,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Le.localStorage){const r=Pe(e),i=e=>{e.storageArea===Le.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Le.addEventListener("storage",i),{removeHandler:()=>Le.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=He,e.getUnauthenticatedUserSearchPreferences=function(e){if(Le.localStorage)return JSON.parse(Le.localStorage.getItem(Pe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&me(e.authenticationIdentifier)&&ge(e.profile),e.isFtAuthenticationIdentifier=me,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&W(e.type),e.isFtCollectionDocumentType=W,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=G,e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtHttpErrorDetails=e=>r(e)&&s(e.endpoint)&&s(e.method)&&s(e.statusText)&&s(e.body)&&a(e.status),e.isFtLabeledSearchFilter=J,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&G(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&(null==e.rightsApiEndpoint||s(e.rightsApiEndpoint))&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.fingerprint)&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>be(e)&&Re(e.file)&&(null==e.size||Se(e.size))&&Te(e.externalLink)&&Re(e.name)&&Re(e.id)&&(null==e.mimeType||Re(e.mimeType))&&(null==e.viewerUrl||Re(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=b,e.isFtMetadataConfiguration=e=>r(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>R(e))),e.isFtMetadataDescriptor=R,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=L,e.isFtMetadataSortRule=S,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&F(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=F,e.isFtOpenMode=X,e.isFtPageConfiguration=Ue,e.isFtPageRequest=Y,e.isFtPaginatedToc=e=>be(e)&&ve(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Ie(e))),e.isFtPaginatedTocNode=Ie,e.isFtPaginationConfiguration=ve,e.isFtPeriod=D,e.isFtPeriodFilter=P,e.isFtPeriodFilterType=M,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=I,e.isFtPublicationRatingSummary=v,e.isFtRatingCreation=e=>r(e)&&U(e.type)&&a(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||C(e.topics))&&v(e.publication),e.isFtRatingType=U,e.isFtReaderConfiguration=e=>be(e)&&Oe(e.feedback)&&Se(e.loadAfterLastVisibleTopic)&&Re(e.relativeTopicPivotMetadata)&&Se(e.loadBeforeFirstVisibleTopic)&&Re(e.relativePivotMetadata),e.isFtReaderFeedbackConfiguration=Oe,e.isFtSearchFacet=le,e.isFtSearchFacetConf=ue,e.isFtSearchFacetEntry=ce,e.isFtSearchFilter=k,e.isFtSearchLocale=E,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>E(e))),e.isFtSearchPreferences=Ee,e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>L(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&a(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=Q,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Y(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>Q(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ue(e))),e.isFtSearchResultCluster=Z,e.isFtSearchResultClusterEntry=ee,e.isFtSearchResultMap=re,e.isFtSearchResultTopic=ie,e.isFtSearchResultType=se,e.isFtSearchResultUnstructuredDocument=te,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||pe(e.spellcheck))&&K(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Z(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>le(e))),e.isFtSearchResultsPageInfo=K,e.isFtSearchScope=oe,e.isFtSearchSortCriterion=de,e.isFtSearchSortCriterionOrder=B,e.isFtSearchSortCriterionType=x,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||me(e.authenticationIdentifier))&&a(e.idleTimeoutInMillis)&&ge(e.profile)&&i(e.sessionAuthenticated)&&Ee(e.searchPreferences),e.isFtSpellcheck=pe,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.maxCount||a(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=ye,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ye(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=_,e.isFtTopicResource=he,e.isFtTopicsRatingSummary=C,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ge,e.isFtUserRole=Ae,e.isFtVirtualField=$,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Le.localStorage){let r={...t,metadata:De(t.metadata??{})};const i=Pe(e),a=JSON.stringify(r);return Le.localStorage.setItem(i,a),Le.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Le.localStorage,url:Le.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=>Ce(e,t)))}})); |
@@ -303,2 +303,3 @@ "use strict"; | ||
&& ((0, exports.isFtMetadataSortRule)(o.sortRule)) | ||
&& (isString(o.label)) | ||
&& (isBoolean(o.reverseSort)) | ||
@@ -305,0 +306,0 @@ && (isString(o.key)); |
@@ -22,3 +22,5 @@ "use strict"; | ||
&& (isNumber(o.loadAfterLastVisibleTopic)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)); | ||
&& (isString(o.relativeTopicPivotMetadata)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)) | ||
&& (isString(o.relativePivotMetadata)); | ||
}; | ||
@@ -25,0 +27,0 @@ exports.isFtReaderConfiguration = isFtReaderConfiguration; |
@@ -1,1 +0,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(A)}),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 f(e,t){var r,i,a=(t=t||{}).body;if(e instanceof f){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 A(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 m(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)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];m.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new m(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 f(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 m(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=f,e.Response=m),t.Headers=l,t.Request=f,t.Response=m,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,a=e=>"number"==typeof e,s=e=>"string"==typeof e;var n;e.FtMyLibraryColors=void 0,(n=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",n.green="green",n.blue="blue",n.purple="purple",n.red="red",n.orange="orange",n.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var A;e.FtTopicContentTarget=void 0,(A=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",A.OFF_THE_GRID="OFF_THE_GRID",A.CONTENT_PACKAGER="CONTENT_PACKAGER",A.PAGES="PAGES",A.DESIGNED_READER="DESIGNED_READER";var m;e.FtMetadataHomeLayout=void 0,(m=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",m.CUSTOM="CUSTOM",m.DESIGNER="DESIGNER";const E=e=>r(e)&&a(e.count)&&s(e.label)&&(null==e.lang||s(e.lang));var g;e.FtFacetType=void 0,(g=e.FtFacetType||(e.FtFacetType={})).AND="AND",g.OR="OR",g.MONOVALUED="MONOVALUED";const b=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key);var T;e.FtMetadataSortRule=void 0,(T=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",T.ALPHABET="ALPHABET",T.VERSION="VERSION";const S=e=>["NONE","ALPHABET","VERSION"].includes(e),R=e=>r(e)&&S(e.sortRule)&&i(e.reverseSort)&&s(e.key),F=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>J(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale));var O;e.FtRatingType=void 0,(O=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",O.LIKE="LIKE",O.DICHOTOMOUS="DICHOTOMOUS",O.NO_RATING="NO_RATING";const U=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),I=e=>r(e)&&s(e.date)&&U(e.type)&&a(e.value),v=e=>r(e)&&(null==e.rating||I(e.rating))&&U(e.type),_=e=>r(e)&&s(e.date)&&s(e.tocId)&&U(e.type)&&a(e.value),C=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>_(e)))&&U(e.type),L=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),D=e=>r(e)&&s(e.from)&&s(e.to),P=e=>r(e)&&(null==e.period||D(e.period))&&M(e.periodType);var N;e.FtPeriodFilterType=void 0,(N=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",N.LAST_MONTH="LAST_MONTH",N.LAST_YEAR="LAST_YEAR",N.CUSTOM="CUSTOM";const M=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),k=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(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),K=e=>r(e)&&a(e.totalResultsCount)&&i(e.isLastPage)&&a(e.currentPage)&&a(e.totalClustersCount);var j;e.FtEditorialType=void 0,(j=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",j.BOOK="BOOK",j.SHARED_BOOK="SHARED_BOOK";const G=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=>r(e)&&(null==e.perPage||a(e.perPage))&&a(e.page);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 W=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),J=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),Q=e=>r(e)&&a(e.weight)&&s(e.value)&&s(e.key),Z=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ee(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),ee=e=>r(e)&&(null==e.document||te(e.document))&&(null==e.topic||ie(e.topic))&&se(e.type)&&(null==e.map||re(e.map)),te=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),re=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.openMode||X(e.openMode))&&G(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),ie=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>he(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var ae;e.FtSearchResultType=void 0,(ae=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",ae.DOCUMENT="DOCUMENT",ae.TOPIC="TOPIC";const se=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var ne;e.FtSearchScope=void 0,(ne=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",ne.DOCUMENTS="DOCUMENTS",ne.ALL_TOPICS="ALL_TOPICS";const oe=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),le=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>ce(e))),ue=e=>r(e)&&(null==e.maxDepth||a(e.maxDepth))&&s(e.id),ce=e=>r(e)&&a(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>ce(e)))&&s(e.label)&&s(e.value)&&i(e.selected),de=e=>r(e)&&x(e.type)&&s(e.key)&&B(e.order),pe=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),he=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),ye=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||G(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&se(e.type)&&s(e.value);var fe;e.FtUserRole=void 0,(fe=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",fe.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",fe.HTML_EXPORT_USER="HTML_EXPORT_USER",fe.PDF_EXPORT_USER="PDF_EXPORT_USER",fe.SAVED_SEARCH_USER="SAVED_SEARCH_USER",fe.COLLECTION_USER="COLLECTION_USER",fe.OFFLINE_USER="OFFLINE_USER",fe.ANALYTICS_USER="ANALYTICS_USER",fe.BETA_USER="BETA_USER",fe.DEBUG_USER="DEBUG_USER",fe.PRINT_USER="PRINT_USER",fe.RATING_USER="RATING_USER",fe.FEEDBACK_USER="FEEDBACK_USER",fe.CONTENT_PUBLISHER="CONTENT_PUBLISHER",fe.KHUB_ADMIN="KHUB_ADMIN",fe.USERS_ADMIN="USERS_ADMIN",fe.PORTAL_ADMIN="PORTAL_ADMIN",fe.ADMIN="ADMIN",fe.DEVELOPER="DEVELOPER";const Ae=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","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),me=e=>r(e)&&s(e.identifier)&&s(e.realm),Ee=e=>r(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>k(e))),ge=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>Ae(e)))&&(null==e.userId||s(e.userId)),be=e=>"object"==typeof e&&null!=e,Te=e=>"boolean"==typeof e,Se=e=>"number"==typeof e,Re=e=>"string"==typeof e;var Fe;e.FtConfigurationHistoryEntryStatus=void 0,(Fe=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Fe.INVALID="INVALID";const Oe=e=>be(e)&&Te(e.mailsSentByFluidTopics)&&Te(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Re(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Re(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Re(e))),Ue=e=>be(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Te(e))))&&Te(e.isVisible),Ie=e=>be(e)&&(null==e.prettyUrl||Re(e.prettyUrl))&&(null==e.hasRating||Te(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Re(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Ie(e)))&&(null==e.pageConfiguration||Ue(e.pageConfiguration))&&(null==e.contentId||Re(e.contentId))&&(null==e.title||Re(e.title)),ve=e=>be(e)&&Te(e.splitCurrentPageToc),_e={[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 Ce(e,t){return e===t||(_e[e]??[]).some((e=>Ce(e,t)))}const Le="undefined"==typeof window?globalThis:window;function De(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 Pe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ne="undefined"==typeof window?globalThis:window;class Me 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 ke extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function we(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 Ne.dispatchEvent&&Ne.dispatchEvent(new ke(i)),new Me(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function Be(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class He{tenantBaseUrl;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`})},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:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/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}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ne.fluidTopicsBaseUrl??Ne.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ne.location&&Ne.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.khub.locales)}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})}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)}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.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 Me("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=>we(e,t,r))).then(Be)}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=>we(e,t,r))).then(Be)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>we("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=He,e.HttpError=Me,e.HttpErrorEvent=ke,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Le.localStorage){const r=Pe(e),i=e=>{e.storageArea===Le.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Le.addEventListener("storage",i),{removeHandler:()=>Le.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=He,e.getUnauthenticatedUserSearchPreferences=function(e){if(Le.localStorage)return JSON.parse(Le.localStorage.getItem(Pe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&me(e.authenticationIdentifier)&&ge(e.profile),e.isFtAuthenticationIdentifier=me,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&W(e.type),e.isFtCollectionDocumentType=W,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=G,e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtHttpErrorDetails=e=>r(e)&&s(e.endpoint)&&s(e.method)&&s(e.statusText)&&s(e.body)&&a(e.status),e.isFtLabeledSearchFilter=J,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&G(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&(null==e.rightsApiEndpoint||s(e.rightsApiEndpoint))&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.fingerprint)&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>be(e)&&Re(e.file)&&(null==e.size||Se(e.size))&&Te(e.externalLink)&&Re(e.name)&&Re(e.id)&&(null==e.mimeType||Re(e.mimeType))&&(null==e.viewerUrl||Re(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=b,e.isFtMetadataConfiguration=e=>r(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>R(e))),e.isFtMetadataDescriptor=R,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=L,e.isFtMetadataSortRule=S,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&F(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=F,e.isFtOpenMode=X,e.isFtPageConfiguration=Ue,e.isFtPageRequest=Y,e.isFtPaginatedToc=e=>be(e)&&ve(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Ie(e))),e.isFtPaginatedTocNode=Ie,e.isFtPaginationConfiguration=ve,e.isFtPeriod=D,e.isFtPeriodFilter=P,e.isFtPeriodFilterType=M,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=I,e.isFtPublicationRatingSummary=v,e.isFtRatingCreation=e=>r(e)&&U(e.type)&&a(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||C(e.topics))&&v(e.publication),e.isFtRatingType=U,e.isFtReaderConfiguration=e=>be(e)&&Oe(e.feedback)&&Se(e.loadAfterLastVisibleTopic)&&Se(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Oe,e.isFtSearchFacet=le,e.isFtSearchFacetConf=ue,e.isFtSearchFacetEntry=ce,e.isFtSearchFilter=k,e.isFtSearchLocale=E,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>E(e))),e.isFtSearchPreferences=Ee,e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>L(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&a(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=Q,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Y(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>Q(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ue(e))),e.isFtSearchResultCluster=Z,e.isFtSearchResultClusterEntry=ee,e.isFtSearchResultMap=re,e.isFtSearchResultTopic=ie,e.isFtSearchResultType=se,e.isFtSearchResultUnstructuredDocument=te,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||pe(e.spellcheck))&&K(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Z(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>le(e))),e.isFtSearchResultsPageInfo=K,e.isFtSearchScope=oe,e.isFtSearchSortCriterion=de,e.isFtSearchSortCriterionOrder=B,e.isFtSearchSortCriterionType=x,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||me(e.authenticationIdentifier))&&a(e.idleTimeoutInMillis)&&ge(e.profile)&&i(e.sessionAuthenticated)&&Ee(e.searchPreferences),e.isFtSpellcheck=pe,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.maxCount||a(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=ye,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ye(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=_,e.isFtTopicResource=he,e.isFtTopicsRatingSummary=C,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ge,e.isFtUserRole=Ae,e.isFtVirtualField=$,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Le.localStorage){let r={...t,metadata:De(t.metadata??{})};const i=Pe(e),a=JSON.stringify(r);return Le.localStorage.setItem(i,a),Le.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Le.localStorage,url:Le.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=>Ce(e,t)))}})); | ||
!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(A)}),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 f(e,t){var r,i,a=(t=t||{}).body;if(e instanceof f){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 A(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 m(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)}f.prototype.clone=function(){return new f(this,{body:this._bodyInit})},h.call(f.prototype),h.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},m.error=function(){var e=new m(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];m.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new m(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 f(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 m(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=f,e.Response=m),t.Headers=l,t.Request=f,t.Response=m,t.fetch=g,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:t);const r=e=>"object"==typeof e&&null!=e,i=e=>"boolean"==typeof e,a=e=>"number"==typeof e,s=e=>"string"==typeof e;var n;e.FtMyLibraryColors=void 0,(n=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",n.green="green",n.blue="blue",n.purple="purple",n.red="red",n.orange="orange",n.yellow="yellow";const o=e=>["black","green","blue","purple","red","orange","yellow"].includes(e);var l;e.FtTopicOriginType=void 0,(l=e.FtTopicOriginType||(e.FtTopicOriginType={})).OFFICIAL="OFFICIAL",l.PERSONAL="PERSONAL",l.SHARED="SHARED";const u=e=>["OFFICIAL","PERSONAL","SHARED"].includes(e),c=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>Array.isArray(e)&&e.every((e=>s(e)))))&&s(e.key),d=e=>r(e)&&s(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&s(e.title)&&(null==e.htmlContent||s(e.htmlContent)),p=e=>r(e)&&s(e.tocId)&&s(e.contentId)&&s(e.mapId),h=e=>r(e)&&s(e.topicStylesheetUrl)&&s(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>s(e))),y=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&s(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&s(e.contentId)&&s(e.title),f=e=>r(e)&&s(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.contentId)&&s(e.mapId)&&u(e.type);var A;e.FtTopicContentTarget=void 0,(A=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",A.OFF_THE_GRID="OFF_THE_GRID",A.CONTENT_PACKAGER="CONTENT_PACKAGER",A.PAGES="PAGES",A.DESIGNED_READER="DESIGNED_READER";var m;e.FtMetadataHomeLayout=void 0,(m=e.FtMetadataHomeLayout||(e.FtMetadataHomeLayout={})).CLASSIC="CLASSIC",m.CUSTOM="CUSTOM",m.DESIGNER="DESIGNER";const E=e=>r(e)&&a(e.count)&&s(e.label)&&(null==e.lang||s(e.lang));var g;e.FtFacetType=void 0,(g=e.FtFacetType||(e.FtFacetType={})).AND="AND",g.OR="OR",g.MONOVALUED="MONOVALUED";const b=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>s(e))))))&&s(e.label)&&s(e.key);var T;e.FtMetadataSortRule=void 0,(T=e.FtMetadataSortRule||(e.FtMetadataSortRule={})).NONE="NONE",T.ALPHABET="ALPHABET",T.VERSION="VERSION";const S=e=>["NONE","ALPHABET","VERSION"].includes(e),R=e=>r(e)&&S(e.sortRule)&&s(e.label)&&i(e.reverseSort)&&s(e.key),F=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>J(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale));var O;e.FtRatingType=void 0,(O=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",O.LIKE="LIKE",O.DICHOTOMOUS="DICHOTOMOUS",O.NO_RATING="NO_RATING";const U=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),I=e=>r(e)&&s(e.date)&&U(e.type)&&a(e.value),v=e=>r(e)&&(null==e.rating||I(e.rating))&&U(e.type),_=e=>r(e)&&s(e.date)&&s(e.tocId)&&U(e.type)&&a(e.value),C=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>_(e)))&&U(e.type),L=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),D=e=>r(e)&&s(e.from)&&s(e.to),P=e=>r(e)&&(null==e.period||D(e.period))&&M(e.periodType);var N;e.FtPeriodFilterType=void 0,(N=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",N.LAST_MONTH="LAST_MONTH",N.LAST_YEAR="LAST_YEAR",N.CUSTOM="CUSTOM";const M=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),k=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(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),K=e=>r(e)&&a(e.totalResultsCount)&&i(e.isLastPage)&&a(e.currentPage)&&a(e.totalClustersCount);var j;e.FtEditorialType=void 0,(j=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",j.BOOK="BOOK",j.SHARED_BOOK="SHARED_BOOK";const G=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=>r(e)&&(null==e.perPage||a(e.perPage))&&a(e.page);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 W=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),J=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),Q=e=>r(e)&&a(e.weight)&&s(e.value)&&s(e.key),Z=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>ee(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),ee=e=>r(e)&&(null==e.document||te(e.document))&&(null==e.topic||ie(e.topic))&&se(e.type)&&(null==e.map||re(e.map)),te=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.documentUrl)&&s(e.mimeType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.viewerUrl)&&s(e.contentUrl)&&s(e.filename)&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.documentId)&&s(e.lastEditionDate)&&s(e.htmlExcerpt),re=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&(null==e.openMode||X(e.openMode))&&G(e.editorialType)&&s(e.title)&&(null==e.lastPublicationDate||s(e.lastPublicationDate))&&s(e.htmlTitle)&&(null==e.originUrl||s(e.originUrl))&&s(e.mapUrl)&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt),ie=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>he(e)))&&s(e.title)&&s(e.mapTitle)&&s(e.topicUrl)&&s(e.contentUrl)&&s(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&(null==e.originUrl||s(e.originUrl))&&s(e.readerUrl)&&s(e.mapId)&&(null==e.lastEditionDate||s(e.lastEditionDate))&&s(e.htmlExcerpt);var ae;e.FtSearchResultType=void 0,(ae=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",ae.DOCUMENT="DOCUMENT",ae.TOPIC="TOPIC";const se=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var ne;e.FtSearchScope=void 0,(ne=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",ne.DOCUMENTS="DOCUMENTS",ne.ALL_TOPICS="ALL_TOPICS";const oe=e=>["DEFAULT","DOCUMENTS","ALL_TOPICS"].includes(e),le=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>ce(e))),ue=e=>r(e)&&(null==e.maxDepth||a(e.maxDepth))&&s(e.id),ce=e=>r(e)&&a(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>ce(e)))&&s(e.label)&&s(e.value)&&i(e.selected),de=e=>r(e)&&x(e.type)&&s(e.key)&&B(e.order),pe=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),he=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),ye=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||G(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&se(e.type)&&s(e.value);var fe;e.FtUserRole=void 0,(fe=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",fe.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",fe.HTML_EXPORT_USER="HTML_EXPORT_USER",fe.PDF_EXPORT_USER="PDF_EXPORT_USER",fe.SAVED_SEARCH_USER="SAVED_SEARCH_USER",fe.COLLECTION_USER="COLLECTION_USER",fe.OFFLINE_USER="OFFLINE_USER",fe.ANALYTICS_USER="ANALYTICS_USER",fe.BETA_USER="BETA_USER",fe.DEBUG_USER="DEBUG_USER",fe.PRINT_USER="PRINT_USER",fe.RATING_USER="RATING_USER",fe.FEEDBACK_USER="FEEDBACK_USER",fe.CONTENT_PUBLISHER="CONTENT_PUBLISHER",fe.KHUB_ADMIN="KHUB_ADMIN",fe.USERS_ADMIN="USERS_ADMIN",fe.PORTAL_ADMIN="PORTAL_ADMIN",fe.ADMIN="ADMIN",fe.DEVELOPER="DEVELOPER";const Ae=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","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(e),me=e=>r(e)&&s(e.identifier)&&s(e.realm),Ee=e=>r(e)&&Array.isArray(e.defaultFilters)&&e.defaultFilters.every((e=>k(e))),ge=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>Ae(e)))&&(null==e.userId||s(e.userId)),be=e=>"object"==typeof e&&null!=e,Te=e=>"boolean"==typeof e,Se=e=>"number"==typeof e,Re=e=>"string"==typeof e;var Fe;e.FtConfigurationHistoryEntryStatus=void 0,(Fe=e.FtConfigurationHistoryEntryStatus||(e.FtConfigurationHistoryEntryStatus={})).VALID="VALID",Fe.INVALID="INVALID";const Oe=e=>be(e)&&Te(e.mailsSentByFluidTopics)&&Te(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Re(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Re(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Re(e))),Ue=e=>be(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>Te(e))))&&Te(e.isVisible),Ie=e=>be(e)&&(null==e.prettyUrl||Re(e.prettyUrl))&&(null==e.hasRating||Te(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Re(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>Ie(e)))&&(null==e.pageConfiguration||Ue(e.pageConfiguration))&&(null==e.contentId||Re(e.contentId))&&(null==e.title||Re(e.title)),ve=e=>be(e)&&Te(e.splitCurrentPageToc),_e={[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 Ce(e,t){return e===t||(_e[e]??[]).some((e=>Ce(e,t)))}const Le="undefined"==typeof window?globalThis:window;function De(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 Pe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ne="undefined"==typeof window?globalThis:window;class Me 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 ke extends CustomEvent{constructor(e){super("ft-api-http-error",{detail:e})}}async function we(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 Ne.dispatchEvent&&Ne.dispatchEvent(new ke(i)),new Me(i.method,i.endpoint,i.status,i.statusText,i.body)}return r}function Be(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class He{tenantBaseUrl;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`})},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:"api/stylesheets/fonts.css",theme:"api/stylesheets/theme.css",content:{title:"api/stylesheets/content/title.css",topic:"api/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}`})}})}};get defaultHeaders(){return{...this.authorization,...this.searchLabel,"Ft-Calling-App":this.ftCallingApp}}constructor(e,t,r){e=(e??Ne.fluidTopicsBaseUrl??Ne.__gwt_ft_moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ne.location&&Ne.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.khub.locales)}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})}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)}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.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 Me("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=>we(e,t,r))).then(Be)}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=>we(e,t,r))).then(Be)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then((t=>we("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=He,e.HttpError=Me,e.HttpErrorEvent=ke,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Le.localStorage){const r=Pe(e),i=e=>{e.storageArea===Le.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Le.addEventListener("storage",i),{removeHandler:()=>Le.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=He,e.getUnauthenticatedUserSearchPreferences=function(e){if(Le.localStorage)return JSON.parse(Le.localStorage.getItem(Pe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&me(e.authenticationIdentifier)&&ge(e.profile),e.isFtAuthenticationIdentifier=me,e.isFtBookmark=e=>r(e)&&s(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>s(e)))&&s(e.tocId)&&s(e.lastUpdate)&&s(e.readerUrl)&&s(e.mapId)&&s(e.id)&&s(e.title)&&s(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||s(e.apiUrl))&&(null==e.portalUrl||s(e.portalUrl))&&s(e.id)&&s(e.title)&&W(e.type),e.isFtCollectionDocumentType=W,e.isFtConfigurationHistoryEntryStatus=e=>["VALID","INVALID"].includes(e),e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=G,e.isFtFacetType=e=>["AND","OR","MONOVALUED"].includes(e),e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtHttpErrorDetails=e=>r(e)&&s(e.endpoint)&&s(e.method)&&s(e.statusText)&&s(e.body)&&a(e.status),e.isFtLabeledSearchFilter=J,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&X(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&G(e.editorialType)&&s(e.baseId)&&s(e.clusterId)&&s(e.title)&&s(e.lastPublication)&&s(e.lastEdition)&&s(e.originId)&&(null==e.rightsApiEndpoint||s(e.rightsApiEndpoint))&&h(e.contentStyles)&&(null==e.originUrl||s(e.originUrl))&&s(e.fingerprint)&&s(e.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>be(e)&&Re(e.file)&&(null==e.size||Se(e.size))&&Te(e.externalLink)&&Re(e.name)&&Re(e.id)&&(null==e.mimeType||Re(e.mimeType))&&(null==e.viewerUrl||Re(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&s(e.contentUrl)&&s(e.filename)&&s(e.id)&&s(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&s(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>s(e)))&&Object.values(e.messages).every((e=>s(e)))&&s(e.locale),e.isFtMetadata=b,e.isFtMetadataConfiguration=e=>r(e)&&Array.isArray(e.descriptors)&&e.descriptors.every((e=>R(e))),e.isFtMetadataDescriptor=R,e.isFtMetadataHomeLayout=e=>["CLASSIC","CUSTOM","DESIGNER"].includes(e),e.isFtMetadataPreferenceConfiguration=L,e.isFtMetadataSortRule=S,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&F(e.searchRequest)&&o(e.color)&&i(e.alert)&&s(e.description)&&s(e.id)&&s(e.ownerId)&&s(e.title)&&s(e.creationDate),e.isFtMySearchRequest=F,e.isFtOpenMode=X,e.isFtPageConfiguration=Ue,e.isFtPageRequest=Y,e.isFtPaginatedToc=e=>be(e)&&ve(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>Ie(e))),e.isFtPaginatedTocNode=Ie,e.isFtPaginationConfiguration=ve,e.isFtPeriod=D,e.isFtPeriodFilter=P,e.isFtPeriodFilterType=M,e.isFtPersonalBookCreation=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>c(e)))&&Array.isArray(e.nodes)&&e.nodes.every((e=>d(e)))&&s(e.description)&&s(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=I,e.isFtPublicationRatingSummary=v,e.isFtRatingCreation=e=>r(e)&&U(e.type)&&a(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||C(e.topics))&&v(e.publication),e.isFtRatingType=U,e.isFtReaderConfiguration=e=>be(e)&&Oe(e.feedback)&&Se(e.loadAfterLastVisibleTopic)&&Re(e.relativeTopicPivotMetadata)&&Se(e.loadBeforeFirstVisibleTopic)&&Re(e.relativePivotMetadata),e.isFtReaderFeedbackConfiguration=Oe,e.isFtSearchFacet=le,e.isFtSearchFacetConf=ue,e.isFtSearchFacetEntry=ce,e.isFtSearchFilter=k,e.isFtSearchLocale=E,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>E(e))),e.isFtSearchPreferences=Ee,e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>L(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&a(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=Q,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||P(e.periodFilter))&&s(e.query)&&(null==e.scope||oe(e.scope))&&Y(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.virtualField||$(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>Q(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ue(e))),e.isFtSearchResultCluster=Z,e.isFtSearchResultClusterEntry=ee,e.isFtSearchResultMap=re,e.isFtSearchResultTopic=ie,e.isFtSearchResultType=se,e.isFtSearchResultUnstructuredDocument=te,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||pe(e.spellcheck))&&K(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Z(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>le(e))),e.isFtSearchResultsPageInfo=K,e.isFtSearchScope=oe,e.isFtSearchSortCriterion=de,e.isFtSearchSortCriterionOrder=B,e.isFtSearchSortCriterionType=x,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||me(e.authenticationIdentifier))&&a(e.idleTimeoutInMillis)&&ge(e.profile)&&i(e.sessionAuthenticated)&&Ee(e.searchPreferences),e.isFtSpellcheck=pe,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&(null==e.scope||oe(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>k(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>de(e)))&&(null==e.maxCount||a(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=ye,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ye(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.id)&&s(e.contentApiEndpoint)&&s(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=_,e.isFtTopicResource=he,e.isFtTopicsRatingSummary=C,e.isFtUiLocale=e=>r(e)&&s(e.displayName)&&s(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>b(e)))&&s(e.openMode)&&(null==e.description||s(e.description))&&s(e.mimeType)&&(null==e.baseId||s(e.baseId))&&(null==e.clusterId||s(e.clusterId))&&s(e.contentApiEndpoint)&&s(e.title)&&(null==e.lastPublication||s(e.lastPublication))&&s(e.viewerUrl)&&s(e.lastEdition)&&s(e.filename)&&(null==e.originId||s(e.originId))&&s(e.rightsApiEndpoint)&&(null==e.originUrl||s(e.originUrl))&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtUserProfile=ge,e.isFtUserRole=Ae,e.isFtVirtualField=$,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Le.localStorage){let r={...t,metadata:De(t.metadata??{})};const i=Pe(e),a=JSON.stringify(r);return Le.localStorage.setItem(i,a),Le.dispatchEvent(new StorageEvent("storage",{key:i,newValue:a,storageArea:Le.localStorage,url:Le.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=>Ce(e,t)))}})); |
@@ -231,2 +231,3 @@ export interface FtHttpErrorDetails { | ||
sortRule: FtMetadataSortRuleKeys; | ||
label: string; | ||
reverseSort: boolean; | ||
@@ -233,0 +234,0 @@ key: string; |
@@ -272,2 +272,3 @@ const isObject = (o) => typeof o === "object" && o != null; | ||
&& (isFtMetadataSortRule(o.sortRule)) | ||
&& (isString(o.label)) | ||
&& (isBoolean(o.reverseSort)) | ||
@@ -274,0 +275,0 @@ && (isString(o.key)); |
@@ -10,3 +10,5 @@ export declare enum FtConfigurationHistoryEntryStatus { | ||
loadAfterLastVisibleTopic: number; | ||
relativeTopicPivotMetadata: string; | ||
loadBeforeFirstVisibleTopic: number; | ||
relativePivotMetadata: string; | ||
} | ||
@@ -13,0 +15,0 @@ export declare const isFtReaderConfiguration: (o: any) => o is FtReaderConfiguration; |
@@ -18,3 +18,5 @@ const isObject = (o) => typeof o === "object" && o != null; | ||
&& (isNumber(o.loadAfterLastVisibleTopic)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)); | ||
&& (isString(o.relativeTopicPivotMetadata)) | ||
&& (isNumber(o.loadBeforeFirstVisibleTopic)) | ||
&& (isString(o.relativePivotMetadata)); | ||
}; | ||
@@ -21,0 +23,0 @@ export const isFtReaderFeedbackConfiguration = (o) => { |
{ | ||
"name": "@fluid-topics/public-api", | ||
"version": "1.0.56", | ||
"version": "1.0.57", | ||
"description": "Fluid Topics Public API", | ||
@@ -5,0 +5,0 @@ "author": "Fluid Topics dev team <opensource@antidot.net>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
370254
7342