@fluid-topics/public-api
Advanced tools
Comparing version 1.0.48 to 1.0.49
@@ -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]"],n=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 a(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)||n(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=s(e),t=a(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)]=a(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,n=(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,n||null==e._bodyInit||(n=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)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}})),t}function A(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(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];A.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new A(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(n,s){var a=new f(e,i);if(a.signal&&a.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 n=r.join(":").trim();t.append(i,n)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;n(new A(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(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,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,n=e=>"number"==typeof e,s=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.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 m;e.FtTopicContentTarget=void 0,(m=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",m.OFF_THE_GRID="OFF_THE_GRID",m.CONTENT_PACKAGER="CONTENT_PACKAGER",m.PAGES="PAGES",m.DESIGNED_READER="DESIGNED_READER";const A=e=>r(e)&&n(e.count)&&s(e.label)&&(null==e.lang||s(e.lang)),E=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),g=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&(null==e.scope||re(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>q(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.virtualField||M(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale));var b;e.FtRatingType=void 0,(b=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",b.LIKE="LIKE",b.DICHOTOMOUS="DICHOTOMOUS",b.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),S=e=>r(e)&&s(e.date)&&T(e.type)&&n(e.value),R=e=>r(e)&&(null==e.rating||S(e.rating))&&T(e.type),F=e=>r(e)&&s(e.date)&&s(e.tocId)&&T(e.type)&&n(e.value),U=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>F(e)))&&T(e.type),O=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>s(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>s(e))),I=e=>r(e)&&s(e.from)&&s(e.to),_=e=>r(e)&&(null==e.period||I(e.period))&&C(e.periodType);var v;e.FtPeriodFilterType=void 0,(v=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",v.LAST_MONTH="LAST_MONTH",v.LAST_YEAR="LAST_YEAR",v.CUSTOM="CUSTOM";const C=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),P=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.key);var D;e.FtSearchSortCriterionOrder=void 0,(D=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",D.DESC="DESC";const L=e=>["ASC","DESC"].includes(e);var N;e.FtSearchSortCriterionType=void 0,(N=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",N.NATURAL="NATURAL";const k=e=>["ALPHA","NATURAL"].includes(e);var w;e.FtVirtualField=void 0,(w=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",w.TITLE_ONLY="TITLE_ONLY",w.NONE="NONE";const M=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),B=e=>r(e)&&n(e.totalResultsCount)&&i(e.isLastPage)&&n(e.currentPage)&&n(e.totalClustersCount);var x;e.FtEditorialType=void 0,(x=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",x.BOOK="BOOK",x.SHARED_BOOK="SHARED_BOOK";const H=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var K;e.FtOpenMode=void 0,(K=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",K.EXTERNAL="EXTERNAL";const $=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),V=e=>r(e)&&(null==e.perPage||n(e.perPage))&&n(e.page);var j;e.FtCollectionDocumentType=void 0,(j=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",j.DOCUMENT="DOCUMENT",j.TOPIC="TOPIC",j.PERSONAL_BOOK="PERSONAL_BOOK",j.SHARED_BOOK="SHARED_BOOK";const G=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),q=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>s(e)))&&s(e.label)&&s(e.key),X=e=>r(e)&&n(e.weight)&&s(e.value)&&s(e.key),Y=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>z(e)))&&(null==e.metadataVariableAxis||s(e.metadataVariableAxis)),z=e=>r(e)&&(null==e.document||W(e.document))&&(null==e.topic||Q(e.topic))&&ee(e.type)&&(null==e.map||J(e.map)),W=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(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),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&(null==e.openMode||$(e.openMode))&&H(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),Q=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&s(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>le(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 Z;e.FtSearchResultType=void 0,(Z=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",Z.DOCUMENT="DOCUMENT",Z.TOPIC="TOPIC";const ee=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var te;e.FtSearchScope=void 0,(te=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",te.DOCUMENTS="DOCUMENTS";const re=e=>["DEFAULT","DOCUMENTS"].includes(e),ie=e=>r(e)&&i(e.hierarchical)&&s(e.label)&&i(e.multiSelectionable)&&s(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>se(e))),ne=e=>r(e)&&(null==e.maxDepth||n(e.maxDepth))&&s(e.id),se=e=>r(e)&&n(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>se(e)))&&s(e.label)&&s(e.value)&&i(e.selected),ae=e=>r(e)&&k(e.type)&&s(e.key)&&L(e.order),oe=e=>r(e)&&s(e.suggestedQuery)&&s(e.htmlSuggestedQuery),le=e=>r(e)&&s(e.filename)&&s(e.resourceUrl)&&s(e.id)&&s(e.mimeType)&&s(e.resourceContentUrl)&&s(e.viewerUrl),ue=e=>r(e)&&(null==e.filenameExtension||s(e.filenameExtension))&&(null==e.editorialType||H(e.editorialType))&&(null==e.mimeType||s(e.mimeType))&&ee(e.type)&&s(e.value);var ce;e.FtUserRole=void 0,(ce=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ce.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ce.HTML_EXPORT_USER="HTML_EXPORT_USER",ce.PDF_EXPORT_USER="PDF_EXPORT_USER",ce.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ce.COLLECTION_USER="COLLECTION_USER",ce.OFFLINE_USER="OFFLINE_USER",ce.ANALYTICS_USER="ANALYTICS_USER",ce.BETA_USER="BETA_USER",ce.DEBUG_USER="DEBUG_USER",ce.PRINT_USER="PRINT_USER",ce.RATING_USER="RATING_USER",ce.FEEDBACK_USER="FEEDBACK_USER",ce.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ce.KHUB_ADMIN="KHUB_ADMIN",ce.USERS_ADMIN="USERS_ADMIN",ce.PORTAL_ADMIN="PORTAL_ADMIN",ce.ADMIN="ADMIN",ce.DEVELOPER="DEVELOPER";const de=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),pe=e=>r(e)&&s(e.identifier)&&s(e.realm),he=e=>r(e)&&(null==e.emailAddress||s(e.emailAddress))&&(null==e.displayName||s(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>de(e)))&&(null==e.userId||s(e.userId)),ye=e=>"object"==typeof e&&null!=e,fe=e=>"boolean"==typeof e,me=e=>"number"==typeof e,Ae=e=>"string"==typeof e,Ee=e=>ye(e)&&fe(e.mailsSentByFluidTopics)&&fe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Ae(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Ae(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Ae(e))),ge=e=>ye(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>fe(e))))&&fe(e.isVisible),be=e=>ye(e)&&(null==e.prettyUrl||Ae(e.prettyUrl))&&(null==e.hasRating||fe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Ae(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>be(e)))&&(null==e.pageConfiguration||ge(e.pageConfiguration))&&(null==e.contentId||Ae(e.contentId))&&(null==e.title||Ae(e.title)),Te=e=>ye(e)&&fe(e.splitCurrentPageToc),Se={[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 Re(e,t){return e===t||(Se[e]??[]).some((e=>Re(e,t)))}const Fe="undefined"==typeof window?globalThis:window;function Ue(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 Oe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ie="undefined"==typeof window?globalThis:window;class _e extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function ve(e){if(!e.ok)throw new _e(e.status,e.statusText,await e.text());return e}function Ce(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Pe{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"},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??Ie.__gwt_ft_moduleBase??Ie.fluidtopicsclient?.__moduleBase??Ie.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ie.location&&Ie.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)}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(((n,s)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;n(e)}else s(new _e(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(ve).then(Ce)}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(ve).then(Ce)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ve).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=Pe,e.HttpError=_e,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Fe.localStorage){const r=Oe(e),i=e=>{e.storageArea===Fe.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Fe.addEventListener("storage",i),{removeHandler:()=>Fe.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Pe,e.getUnauthenticatedUserSearchPreferences=function(e){if(Fe.localStorage)return JSON.parse(Fe.localStorage.getItem(Oe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&pe(e.authenticationIdentifier)&&he(e.profile),e.isFtAuthenticationIdentifier=pe,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)&&G(e.type),e.isFtCollectionDocumentType=G,e.isFtCredentials=e=>r(e)&&s(e.password)&&(null==e.newPassword||s(e.newPassword))&&i(e.rememberMe)&&s(e.login),e.isFtEditorialType=H,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||s(e.from))&&s(e.message),e.isFtLabeledSearchFilter=q,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||s(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&(null==e.topicsApiEndpoint||s(e.topicsApiEndpoint))&&(null==e.description||s(e.description))&&(null==e.attachmentsApiEndpoint||s(e.attachmentsApiEndpoint))&&H(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.readerUrl)&&(null==e.khubVersion||s(e.khubVersion))&&s(e.id)&&(null==e.lang||s(e.lang)),e.isFtMapAttachment=e=>ye(e)&&Ae(e.file)&&(null==e.size||me(e.size))&&fe(e.externalLink)&&Ae(e.name)&&Ae(e.id)&&(null==e.mimeType||Ae(e.mimeType))&&(null==e.viewerUrl||Ae(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=E,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&g(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=g,e.isFtOpenMode=$,e.isFtPageConfiguration=ge,e.isFtPageRequest=V,e.isFtPaginatedToc=e=>ye(e)&&Te(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>be(e))),e.isFtPaginatedTocNode=be,e.isFtPaginationConfiguration=Te,e.isFtPeriod=I,e.isFtPeriodFilter=_,e.isFtPeriodFilterType=C,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=S,e.isFtPublicationRatingSummary=R,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&n(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&R(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>ye(e)&&Ee(e.feedback)&&me(e.loadAfterLastVisibleTopic)&&me(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Ee,e.isFtSearchFacet=ie,e.isFtSearchFacetConf=ne,e.isFtSearchFacetEntry=se,e.isFtSearchFilter=P,e.isFtSearchLocale=A,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>A(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>s(e)))&&Object.values(e.metadata).every((e=>O(e))),e.isFtSearchPreset=e=>r(e)&&s(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&n(e.priority)&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSearchPrior=X,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&s(e.query)&&(null==e.scope||re(e.scope))&&V(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.uiLocale||s(e.uiLocale))&&(null==e.virtualField||M(e.virtualField))&&(null==e.contentLocale||s(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>X(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>ne(e))),e.isFtSearchResultCluster=Y,e.isFtSearchResultClusterEntry=z,e.isFtSearchResultMap=J,e.isFtSearchResultTopic=Q,e.isFtSearchResultType=ee,e.isFtSearchResultUnstructuredDocument=W,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||oe(e.spellcheck))&&B(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Y(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>ie(e))),e.isFtSearchResultsPageInfo=B,e.isFtSearchScope=re,e.isFtSearchSortCriterion=ae,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=k,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||pe(e.authenticationIdentifier))&&n(e.idleTimeoutInMillis)&&he(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=oe,e.isFtSuggestRequest=e=>r(e)&&s(e.input)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.maxCount||n(e.maxCount))&&(null==e.contentLocale||s(e.contentLocale)),e.isFtSuggestResult=ue,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ue(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(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=F,e.isFtTopicResource=le,e.isFtTopicsRatingSummary=U,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=>E(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=he,e.isFtUserRole=de,e.isFtVirtualField=M,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Fe.localStorage){let r={...t,metadata:Ue(t.metadata??{})};const i=Oe(e),n=JSON.stringify(r);return Fe.localStorage.setItem(i,n),Fe.dispatchEvent(new StorageEvent("storage",{key:i,newValue:n,storageArea:Fe.localStorage,url:Fe.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=>Re(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]"],s=ArrayBuffer.isView||function(e){return e&&i.indexOf(Object.prototype.toString.call(e))>-1};function n(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 a(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)||s(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var e=u(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,i=u(this);if(i)return i;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,r=c(t),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(m)}),this.json=function(){return this.text().then(JSON.parse)},this}l.prototype.append=function(e,t){e=n(e),t=a(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},l.prototype.delete=function(e){delete this.map[n(e)]},l.prototype.get=function(e){return e=n(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(n(e))},l.prototype.set=function(e,t){this.map[n(e)]=a(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,s=(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,s||null==e._bodyInit||(s=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new 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)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(s)}function m(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),s=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(s))}})),t}function A(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(A.prototype),A.prototype.clone=function(){return new A(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},A.error=function(){var e=new A(null,{status:0,statusText:""});return e.type="error",e};var E=[301,302,303,307,308];A.redirect=function(e,t){if(-1===E.indexOf(t))throw new RangeError("Invalid status code");return new A(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(s,n){var a=new f(e,i);if(a.signal&&a.signal.aborted)return n(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 s=r.join(":").trim();t.append(i,s)}})),t)};r.url="responseURL"in o?o.responseURL:r.headers.get("X-Request-URL");var i="response"in o?o.response:o.responseText;s(new A(i,r))},o.onerror=function(){n(new TypeError("Network request failed"))},o.ontimeout=function(){n(new TypeError("Network request failed"))},o.onabort=function(){n(new t.DOMException("Aborted","AbortError"))},o.open(a.method,a.url,!0),"include"===a.credentials?o.withCredentials=!0:"omit"===a.credentials&&(o.withCredentials=!1),"responseType"in o&&r.blob&&(o.responseType="blob"),a.headers.forEach((function(e,t){o.setRequestHeader(t,e)})),a.signal&&(a.signal.addEventListener("abort",u),o.onreadystatechange=function(){4===o.readyState&&a.signal.removeEventListener("abort",u)}),o.send(void 0===a._bodyInit?null:a._bodyInit)}))}g.polyfill=!0,e.fetch||(e.fetch=g,e.Headers=l,e.Request=f,e.Response=A),t.Headers=l,t.Request=f,t.Response=A,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,s=e=>"number"==typeof e,n=e=>"string"==typeof e;var a;e.FtMyLibraryColors=void 0,(a=e.FtMyLibraryColors||(e.FtMyLibraryColors={})).black="black",a.green="green",a.blue="blue",a.purple="purple",a.red="red",a.orange="orange",a.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=>n(e)))))&&n(e.key),d=e=>r(e)&&n(e.notes)&&Array.isArray(e.children)&&e.children.every((e=>d(e)))&&(null==e.topicLink||p(e.topicLink))&&n(e.title)&&(null==e.htmlContent||n(e.htmlContent)),p=e=>r(e)&&n(e.tocId)&&n(e.contentId)&&n(e.mapId),h=e=>r(e)&&n(e.topicStylesheetUrl)&&n(e.titleStylesheetUrl)&&Array.isArray(e.customCssClasses)&&e.customCssClasses.every((e=>n(e))),y=e=>r(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&(null==e.hasRating||i(e.hasRating))&&n(e.tocId)&&Array.isArray(e.children)&&e.children.every((e=>y(e)))&&(null==e.origin||f(e.origin))&&n(e.contentId)&&n(e.title),f=e=>r(e)&&n(e.mapTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&n(e.contentId)&&n(e.mapId)&&u(e.type);var m;e.FtTopicContentTarget=void 0,(m=e.FtTopicContentTarget||(e.FtTopicContentTarget={})).THIRD_PARTY="THIRD_PARTY",m.OFF_THE_GRID="OFF_THE_GRID",m.CONTENT_PACKAGER="CONTENT_PACKAGER",m.PAGES="PAGES",m.DESIGNED_READER="DESIGNED_READER";const A=e=>r(e)&&s(e.count)&&n(e.label)&&(null==e.lang||n(e.lang)),E=e=>r(e)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&(null==e.hierarchicalValues||Array.isArray(e.hierarchicalValues)&&e.hierarchicalValues.every((e=>Array.isArray(e)&&e.every((e=>n(e))))))&&n(e.label)&&n(e.key),g=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&n(e.query)&&(null==e.scope||re(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>q(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.virtualField||M(e.virtualField))&&(null==e.contentLocale||n(e.contentLocale));var b;e.FtRatingType=void 0,(b=e.FtRatingType||(e.FtRatingType={})).STARS="STARS",b.LIKE="LIKE",b.DICHOTOMOUS="DICHOTOMOUS",b.NO_RATING="NO_RATING";const T=e=>["STARS","LIKE","DICHOTOMOUS","NO_RATING"].includes(e),S=e=>r(e)&&n(e.date)&&T(e.type)&&s(e.value),R=e=>r(e)&&(null==e.rating||S(e.rating))&&T(e.type),F=e=>r(e)&&n(e.date)&&n(e.tocId)&&T(e.type)&&s(e.value),U=e=>r(e)&&Array.isArray(e.ratings)&&e.ratings.every((e=>F(e)))&&T(e.type),O=e=>r(e)&&Array.isArray(e.filter)&&e.filter.every((e=>n(e)))&&Array.isArray(e.prior)&&e.prior.every((e=>n(e))),I=e=>r(e)&&n(e.from)&&n(e.to),_=e=>r(e)&&(null==e.period||I(e.period))&&C(e.periodType);var v;e.FtPeriodFilterType=void 0,(v=e.FtPeriodFilterType||(e.FtPeriodFilterType={})).LAST_WEEK="LAST_WEEK",v.LAST_MONTH="LAST_MONTH",v.LAST_YEAR="LAST_YEAR",v.CUSTOM="CUSTOM";const C=e=>["LAST_WEEK","LAST_MONTH","LAST_YEAR","CUSTOM"].includes(e),P=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&n(e.key);var D;e.FtSearchSortCriterionOrder=void 0,(D=e.FtSearchSortCriterionOrder||(e.FtSearchSortCriterionOrder={})).ASC="ASC",D.DESC="DESC";const L=e=>["ASC","DESC"].includes(e);var N;e.FtSearchSortCriterionType=void 0,(N=e.FtSearchSortCriterionType||(e.FtSearchSortCriterionType={})).ALPHA="ALPHA",N.NATURAL="NATURAL";const k=e=>["ALPHA","NATURAL"].includes(e);var w;e.FtVirtualField=void 0,(w=e.FtVirtualField||(e.FtVirtualField={})).EVERYWHERE="EVERYWHERE",w.TITLE_ONLY="TITLE_ONLY",w.NONE="NONE";const M=e=>["EVERYWHERE","TITLE_ONLY","NONE"].includes(e),B=e=>r(e)&&s(e.totalResultsCount)&&i(e.isLastPage)&&s(e.currentPage)&&s(e.totalClustersCount);var x;e.FtEditorialType=void 0,(x=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",x.BOOK="BOOK",x.SHARED_BOOK="SHARED_BOOK";const H=e=>["ARTICLE","BOOK","SHARED_BOOK"].includes(e);var K;e.FtOpenMode=void 0,(K=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",K.EXTERNAL="EXTERNAL";const $=e=>["FLUIDTOPICS","EXTERNAL"].includes(e),V=e=>r(e)&&(null==e.perPage||s(e.perPage))&&s(e.page);var j;e.FtCollectionDocumentType=void 0,(j=e.FtCollectionDocumentType||(e.FtCollectionDocumentType={})).MAP="MAP",j.DOCUMENT="DOCUMENT",j.TOPIC="TOPIC",j.PERSONAL_BOOK="PERSONAL_BOOK",j.SHARED_BOOK="SHARED_BOOK";const G=e=>["MAP","DOCUMENT","TOPIC","PERSONAL_BOOK","SHARED_BOOK"].includes(e),q=e=>r(e)&&i(e.negative)&&Array.isArray(e.values)&&e.values.every((e=>n(e)))&&n(e.label)&&n(e.key),X=e=>r(e)&&s(e.weight)&&n(e.value)&&n(e.key),Y=e=>r(e)&&Array.isArray(e.entries)&&e.entries.every((e=>z(e)))&&(null==e.metadataVariableAxis||n(e.metadataVariableAxis)),z=e=>r(e)&&(null==e.document||W(e.document))&&(null==e.topic||Q(e.topic))&&ee(e.type)&&(null==e.map||J(e.map)),W=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&n(e.documentUrl)&&n(e.mimeType)&&n(e.title)&&(null==e.lastPublicationDate||n(e.lastPublicationDate))&&n(e.viewerUrl)&&n(e.contentUrl)&&n(e.filename)&&n(e.htmlTitle)&&(null==e.originUrl||n(e.originUrl))&&n(e.documentId)&&n(e.lastEditionDate)&&n(e.htmlExcerpt),J=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&(null==e.openMode||$(e.openMode))&&H(e.editorialType)&&n(e.title)&&(null==e.lastPublicationDate||n(e.lastPublicationDate))&&n(e.htmlTitle)&&(null==e.originUrl||n(e.originUrl))&&n(e.mapUrl)&&n(e.readerUrl)&&n(e.mapId)&&(null==e.lastEditionDate||n(e.lastEditionDate))&&n(e.htmlExcerpt),Q=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&n(e.contentId)&&Array.isArray(e.resources)&&e.resources.every((e=>le(e)))&&n(e.title)&&n(e.mapTitle)&&n(e.topicUrl)&&n(e.contentUrl)&&n(e.htmlTitle)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&(null==e.originUrl||n(e.originUrl))&&n(e.readerUrl)&&n(e.mapId)&&(null==e.lastEditionDate||n(e.lastEditionDate))&&n(e.htmlExcerpt);var Z;e.FtSearchResultType=void 0,(Z=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",Z.DOCUMENT="DOCUMENT",Z.TOPIC="TOPIC";const ee=e=>["MAP","DOCUMENT","TOPIC"].includes(e);var te;e.FtSearchScope=void 0,(te=e.FtSearchScope||(e.FtSearchScope={})).DEFAULT="DEFAULT",te.DOCUMENTS="DOCUMENTS";const re=e=>["DEFAULT","DOCUMENTS"].includes(e),ie=e=>r(e)&&i(e.hierarchical)&&n(e.label)&&i(e.multiSelectionable)&&n(e.key)&&Array.isArray(e.rootNodes)&&e.rootNodes.every((e=>ne(e))),se=e=>r(e)&&(null==e.maxDepth||s(e.maxDepth))&&n(e.id),ne=e=>r(e)&&s(e.totalResultsCount)&&i(e.descendantSelected)&&Array.isArray(e.childNodes)&&e.childNodes.every((e=>ne(e)))&&n(e.label)&&n(e.value)&&i(e.selected),ae=e=>r(e)&&k(e.type)&&n(e.key)&&L(e.order),oe=e=>r(e)&&n(e.suggestedQuery)&&n(e.htmlSuggestedQuery),le=e=>r(e)&&n(e.filename)&&n(e.resourceUrl)&&n(e.id)&&n(e.mimeType)&&n(e.resourceContentUrl)&&n(e.viewerUrl),ue=e=>r(e)&&(null==e.filenameExtension||n(e.filenameExtension))&&(null==e.editorialType||H(e.editorialType))&&(null==e.mimeType||n(e.mimeType))&&ee(e.type)&&n(e.value);var ce;e.FtUserRole=void 0,(ce=e.FtUserRole||(e.FtUserRole={})).PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",ce.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",ce.HTML_EXPORT_USER="HTML_EXPORT_USER",ce.PDF_EXPORT_USER="PDF_EXPORT_USER",ce.SAVED_SEARCH_USER="SAVED_SEARCH_USER",ce.COLLECTION_USER="COLLECTION_USER",ce.OFFLINE_USER="OFFLINE_USER",ce.ANALYTICS_USER="ANALYTICS_USER",ce.BETA_USER="BETA_USER",ce.DEBUG_USER="DEBUG_USER",ce.PRINT_USER="PRINT_USER",ce.RATING_USER="RATING_USER",ce.FEEDBACK_USER="FEEDBACK_USER",ce.CONTENT_PUBLISHER="CONTENT_PUBLISHER",ce.KHUB_ADMIN="KHUB_ADMIN",ce.USERS_ADMIN="USERS_ADMIN",ce.PORTAL_ADMIN="PORTAL_ADMIN",ce.ADMIN="ADMIN",ce.DEVELOPER="DEVELOPER";const de=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),pe=e=>r(e)&&n(e.identifier)&&n(e.realm),he=e=>r(e)&&(null==e.emailAddress||n(e.emailAddress))&&(null==e.displayName||n(e.displayName))&&Array.isArray(e.roles)&&e.roles.every((e=>de(e)))&&(null==e.userId||n(e.userId)),ye=e=>"object"==typeof e&&null!=e,fe=e=>"boolean"==typeof e,me=e=>"number"==typeof e,Ae=e=>"string"==typeof e,Ee=e=>ye(e)&&fe(e.mailsSentByFluidTopics)&&fe(e.mailsSentByFluidTopicsForUnauthenticatedUsers)&&Array.isArray(e.recipients)&&e.recipients.every((e=>Ae(e)))&&Array.isArray(e.bodyMetadataIds)&&e.bodyMetadataIds.every((e=>Ae(e)))&&Array.isArray(e.subjectMetadataIds)&&e.subjectMetadataIds.every((e=>Ae(e))),ge=e=>ye(e)&&(null==e.parentsVisibility||Array.isArray(e.parentsVisibility)&&e.parentsVisibility.every((e=>fe(e))))&&fe(e.isVisible),be=e=>ye(e)&&(null==e.prettyUrl||Ae(e.prettyUrl))&&(null==e.hasRating||fe(e.hasRating))&&(null==e.pageToc||Array.isArray(e.pageToc))&&(null==e.tocId||Ae(e.tocId))&&Array.isArray(e.children)&&e.children.every((e=>be(e)))&&(null==e.pageConfiguration||ge(e.pageConfiguration))&&(null==e.contentId||Ae(e.contentId))&&(null==e.title||Ae(e.title)),Te=e=>ye(e)&&fe(e.splitCurrentPageToc),Se={[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 Re(e,t){return e===t||(Se[e]??[]).some((e=>Re(e,t)))}const Fe="undefined"==typeof window?globalThis:window;function Ue(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 Oe(e){return`${e}-FluidTopicsUnauthenticatedUserSearchPreferences`}const Ie="undefined"==typeof window?globalThis:window;class _e extends Error{status;statusText;body;constructor(e,t,r){super(`${e} - ${t}: ${r}`),this.status=e,this.statusText=t,this.body=r}}async function ve(e){if(!e.ok)throw new _e(e.status,e.statusText,await e.text());return e}function Ce(e){return"application/json"===e.headers.get("Content-Type")?e.json():e.text()}class Pe{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"},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??Ie.__gwt_ft_moduleBase??Ie.fluidtopicsclient?.__moduleBase??Ie.__gwt_activeModules?.fluidtopicsclient?.moduleBase??"").trim(),this.tenantBaseUrl=e.endsWith("/")?e:e+"/",r&&void 0!==Ie.location&&Ie.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)}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(((s,n)=>{let a=new XMLHttpRequest;a.onload=()=>{if(a.status>=200&&a.status<300){let e="application/json"===a.getResponseHeader("Content-Type")?JSON.parse(a.responseText):a.responseText;s(e)}else n(new _e(a.status,a.statusText,a.responseText))},a.upload.onprogress=e=>i(e),a.open(e,this.makeAbsolute(t),!0),a.send(r)})):this.fetch(t,{method:e,body:r}).then(ve).then(Ce)}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(ve).then(Ce)}fetchRawData(e,t){return fetch(this.withVersion(e,t),{headers:this.defaultHeaders,credentials:null==this.authorization?"include":void 0}).then(ve).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=Pe,e.HttpError=_e,e.addUnauthenticatedUserSearchPreferencesChangeHandler=function(e,t){if(Fe.localStorage){const r=Oe(e),i=e=>{e.storageArea===Fe.localStorage&&e.key===r&&t(JSON.parse(e.newValue??"{}"))};return Fe.addEventListener("storage",i),{removeHandler:()=>Fe.removeEventListener("storage",i)}}console.error("Cannot handle unauthenticated preferences: local storage is unavailable.")},e.default=Pe,e.getUnauthenticatedUserSearchPreferences=function(e){if(Fe.localStorage)return JSON.parse(Fe.localStorage.getItem(Oe(e))??"{}");console.error("Cannot get unauthenticated preferences: local storage is unavailable.")},e.isFtAuthenticatedSession=e=>r(e)&&pe(e.authenticationIdentifier)&&he(e.profile),e.isFtAuthenticationIdentifier=pe,e.isFtBookmark=e=>r(e)&&n(e.mapTitle)&&o(e.color)&&Array.isArray(e.breadcrumb)&&e.breadcrumb.every((e=>n(e)))&&n(e.tocId)&&n(e.lastUpdate)&&n(e.readerUrl)&&n(e.mapId)&&n(e.id)&&n(e.title)&&n(e.creationDate),e.isFtCollectionDocument=e=>r(e)&&i(e.deleted)&&(null==e.apiUrl||n(e.apiUrl))&&(null==e.portalUrl||n(e.portalUrl))&&n(e.id)&&n(e.title)&&G(e.type),e.isFtCollectionDocumentType=G,e.isFtCredentials=e=>r(e)&&n(e.password)&&(null==e.newPassword||n(e.newPassword))&&i(e.rememberMe)&&n(e.login),e.isFtEditorialType=H,e.isFtFeedbackCreation=e=>r(e)&&(null==e.from||n(e.from))&&n(e.message),e.isFtLabeledSearchFilter=q,e.isFtMap=e=>r(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&$(e.openMode)&&(null==e.topicsApiEndpoint||n(e.topicsApiEndpoint))&&(null==e.description||n(e.description))&&(null==e.attachmentsApiEndpoint||n(e.attachmentsApiEndpoint))&&H(e.editorialType)&&n(e.baseId)&&n(e.clusterId)&&n(e.title)&&n(e.lastPublication)&&n(e.lastEdition)&&n(e.originId)&&(null==e.rightsApiEndpoint||n(e.rightsApiEndpoint))&&h(e.contentStyles)&&(null==e.originUrl||n(e.originUrl))&&n(e.readerUrl)&&(null==e.khubVersion||n(e.khubVersion))&&n(e.id)&&(null==e.lang||n(e.lang)),e.isFtMapAttachment=e=>ye(e)&&Ae(e.file)&&(null==e.size||me(e.size))&&fe(e.externalLink)&&Ae(e.name)&&Ae(e.id)&&(null==e.mimeType||Ae(e.mimeType))&&(null==e.viewerUrl||Ae(e.viewerUrl)),e.isFtMapResource=e=>r(e)&&n(e.contentUrl)&&n(e.filename)&&n(e.id)&&n(e.mimeType),e.isFtMapStyles=h,e.isFtMessageContext=e=>r(e)&&n(e.name)&&r(e.messages)&&Object.keys(e.messages).every((e=>n(e)))&&Object.values(e.messages).every((e=>n(e)))&&n(e.locale),e.isFtMetadata=E,e.isFtMetadataPreferenceConfiguration=O,e.isFtMyLibraryColors=o,e.isFtMySearch=e=>r(e)&&g(e.searchRequest)&&o(e.color)&&i(e.alert)&&n(e.description)&&n(e.id)&&n(e.ownerId)&&n(e.title)&&n(e.creationDate),e.isFtMySearchRequest=g,e.isFtOpenMode=$,e.isFtPageConfiguration=ge,e.isFtPageRequest=V,e.isFtPaginatedToc=e=>ye(e)&&Te(e.configuration)&&Array.isArray(e.paginatedToc)&&e.paginatedToc.every((e=>be(e))),e.isFtPaginatedTocNode=be,e.isFtPaginationConfiguration=Te,e.isFtPeriod=I,e.isFtPeriodFilter=_,e.isFtPeriodFilterType=C,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)))&&n(e.description)&&n(e.title),e.isFtPersonalBookMetadataUpdate=c,e.isFtPersonalBookNodeCreation=d,e.isFtPersonalBookTopicLinkCreation=p,e.isFtPublicationRating=S,e.isFtPublicationRatingSummary=R,e.isFtRatingCreation=e=>r(e)&&T(e.type)&&s(e.value),e.isFtRatingSummary=e=>r(e)&&(null==e.topics||U(e.topics))&&R(e.publication),e.isFtRatingType=T,e.isFtReaderConfiguration=e=>ye(e)&&Ee(e.feedback)&&me(e.loadAfterLastVisibleTopic)&&me(e.loadBeforeFirstVisibleTopic),e.isFtReaderFeedbackConfiguration=Ee,e.isFtSearchFacet=ie,e.isFtSearchFacetConf=se,e.isFtSearchFacetEntry=ne,e.isFtSearchFilter=P,e.isFtSearchLocale=A,e.isFtSearchLocales=e=>r(e)&&Array.isArray(e.contentLocales)&&e.contentLocales.every((e=>A(e))),e.isFtSearchPreferencesConfiguration=e=>r(e)&&r(e.metadata)&&Object.keys(e.metadata).every((e=>n(e)))&&Object.values(e.metadata).every((e=>O(e))),e.isFtSearchPreset=e=>r(e)&&n(e.name)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&s(e.priority)&&(null==e.contentLocale||n(e.contentLocale)),e.isFtSearchPrior=X,e.isFtSearchRequest=e=>r(e)&&(null==e.periodFilter||_(e.periodFilter))&&n(e.query)&&(null==e.scope||re(e.scope))&&V(e.paging)&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.uiLocale||n(e.uiLocale))&&(null==e.virtualField||M(e.virtualField))&&(null==e.contentLocale||n(e.contentLocale))&&(null==e.priors||Array.isArray(e.priors)&&e.priors.every((e=>X(e))))&&Array.isArray(e.facets)&&e.facets.every((e=>se(e))),e.isFtSearchResultCluster=Y,e.isFtSearchResultClusterEntry=z,e.isFtSearchResultMap=J,e.isFtSearchResultTopic=Q,e.isFtSearchResultType=ee,e.isFtSearchResultUnstructuredDocument=W,e.isFtSearchResults=e=>r(e)&&(null==e.spellcheck||oe(e.spellcheck))&&B(e.paging)&&Array.isArray(e.results)&&e.results.every((e=>Y(e)))&&Array.isArray(e.facets)&&e.facets.every((e=>ie(e))),e.isFtSearchResultsPageInfo=B,e.isFtSearchScope=re,e.isFtSearchSortCriterion=ae,e.isFtSearchSortCriterionOrder=L,e.isFtSearchSortCriterionType=k,e.isFtSession=e=>r(e)&&(null==e.authenticationIdentifier||pe(e.authenticationIdentifier))&&s(e.idleTimeoutInMillis)&&he(e.profile)&&i(e.sessionAuthenticated),e.isFtSpellcheck=oe,e.isFtSuggestRequest=e=>r(e)&&n(e.input)&&(null==e.scope||re(e.scope))&&Array.isArray(e.filters)&&e.filters.every((e=>P(e)))&&Array.isArray(e.sort)&&e.sort.every((e=>ae(e)))&&(null==e.maxCount||s(e.maxCount))&&(null==e.contentLocale||n(e.contentLocale)),e.isFtSuggestResult=ue,e.isFtSuggestResults=e=>r(e)&&Array.isArray(e.suggestions)&&e.suggestions.every((e=>ue(e))),e.isFtTocNode=y,e.isFtTopic=e=>r(e)&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&n(e.id)&&n(e.contentApiEndpoint)&&n(e.title),e.isFtTopicContentTarget=e=>["THIRD_PARTY","OFF_THE_GRID","CONTENT_PACKAGER","PAGES","DESIGNED_READER"].includes(e),e.isFtTopicOrigin=f,e.isFtTopicOriginType=u,e.isFtTopicRating=F,e.isFtTopicResource=le,e.isFtTopicsRatingSummary=U,e.isFtUiLocale=e=>r(e)&&n(e.displayName)&&n(e.languageTag)&&i(e.translated),e.isFtUnstructuredDocument=e=>r(e)&&(null==e.prettyUrl||n(e.prettyUrl))&&Array.isArray(e.metadata)&&e.metadata.every((e=>E(e)))&&n(e.openMode)&&(null==e.description||n(e.description))&&n(e.mimeType)&&(null==e.baseId||n(e.baseId))&&(null==e.clusterId||n(e.clusterId))&&n(e.contentApiEndpoint)&&n(e.title)&&(null==e.lastPublication||n(e.lastPublication))&&n(e.viewerUrl)&&n(e.lastEdition)&&n(e.filename)&&(null==e.originId||n(e.originId))&&n(e.rightsApiEndpoint)&&(null==e.originUrl||n(e.originUrl))&&(null==e.khubVersion||n(e.khubVersion))&&n(e.id)&&(null==e.lang||n(e.lang)),e.isFtUserProfile=he,e.isFtUserRole=de,e.isFtVirtualField=M,e.setUnauthenticatedUserSearchPreferences=function(e,t){if(Fe.localStorage){let r={...t,metadata:Ue(t.metadata??{})};const i=Oe(e),s=JSON.stringify(r);return Fe.localStorage.setItem(i,s),Fe.dispatchEvent(new StorageEvent("storage",{key:i,newValue:s,storageArea:Fe.localStorage,url:Fe.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=>Re(e,t)))}})); |
{ | ||
"name": "@fluid-topics/public-api", | ||
"version": "1.0.48", | ||
"version": "1.0.49", | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
3
44696
6
130