@fluid-topics/ft-search-context 1.1.69 → 1.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- !function(t,i,s,e){const n=s.css`
2
- `,r={setRequest:(t,i)=>{t.request=i.payload},setRequestQuery:(t,i)=>{t.request.query=i.payload},setRequestContentLocale:(t,i)=>{t.request.contentLocale=i.payload},setPageSize:(t,i)=>{t.request.paging.perPage=i.payload},setPageNumber:(t,i)=>{t.request.paging.page=i.payload},setRequestSort:(t,i)=>{t.request.sort=i.payload},setRequestFilters:(t,i)=>{t.request.filters=i.payload},setRequestFacets:(t,i)=>{t.request.facets=i.payload},setRequestVirtualField:(t,i)=>{t.request.virtualField=i.payload},setRequestScope:(t,i)=>{t.request.scope=i.payload},setRequestClusterSortCriterion:(t,i)=>{t.request.clusterSortCriterions=i.payload},setResults:(t,i)=>{t.results=i.payload},setFacets:(t,i)=>{t.facets=i.payload},setSpellcheck:(t,i)=>{t.spellcheck=i.payload},setLocales:(t,i)=>{t.locales=i.payload},setPaging:(t,i)=>{t.paging=i.payload},setLiveQuery:(t,i)=>{t.liveQuery=i.payload},setSuggestResults:(t,i)=>{t.suggestResults=i.payload},setRequestPeriodFilter:(t,i)=>{t.request.periodFilter=i.payload}};var o,a,h,c,u,l,d,f,v,w,y,p,E,S,m,b,A,g;!function(t){!function(i){var s={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(s.arrayBuffer)var e=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&e.indexOf(Object.prototype.toString.call(t))>-1};function r(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function o(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var i={next:function(){var i=t.shift();return{done:void 0===i,value:i}}};return s.iterable&&(i[Symbol.iterator]=function(){return i}),i}function h(t){this.map={},t instanceof h?t.forEach((function(t,i){this.append(i,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(i){this.append(i,t[i])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function u(t){return new Promise((function(i,s){t.onload=function(){i(t.result)},t.onerror=function(){s(t.error)}}))}function l(t){var i=new FileReader,s=u(i);return i.readAsArrayBuffer(t),s}function d(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(t){var i;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:s.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s.arrayBuffer&&s.blob&&((i=t)&&DataView.prototype.isPrototypeOf(i))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):s.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var t=c(this);if(t)return t;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?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,i,s,e=c(this);if(e)return e;if(this._bodyBlob)return t=this._bodyBlob,i=new FileReader,s=u(i),i.readAsText(t),s;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var i=new Uint8Array(t),s=new Array(i.length),e=0;e<i.length;e++)s[e]=String.fromCharCode(i[e]);return s.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,i){t=r(t),i=o(i);var s=this.map[t];this.map[t]=s?s+", "+i:i},h.prototype.delete=function(t){delete this.map[r(t)]},h.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},h.prototype.set=function(t,i){this.map[r(t)]=o(i)},h.prototype.forEach=function(t,i){for(var s in this.map)this.map.hasOwnProperty(s)&&t.call(i,this.map[s],s,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(i,s){t.push(s)})),a(t)},h.prototype.values=function(){var t=[];return this.forEach((function(i){t.push(i)})),a(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(i,s){t.push([s,i])})),a(t)},s.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,i){var s,e,n=(i=i||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new h(i.headers)),this.method=(s=i.method||this.method||"GET",e=s.toUpperCase(),v.indexOf(e)>-1?e:s),this.mode=i.mode||this.mode||null,this.signal=i.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 y(t){var i=new FormData;return t.trim().split("&").forEach((function(t){if(t){var s=t.split("="),e=s.shift().replace(/\+/g," "),n=s.join("=").replace(/\+/g," ");i.append(decodeURIComponent(e),decodeURIComponent(n))}})),i}function p(t,i){i||(i={}),this.type="default",this.status=void 0===i.status?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new h(i.headers),this.url=i.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},f.call(w.prototype),f.call(p.prototype),p.prototype.clone=function(){return new p(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},p.error=function(){var t=new p(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];p.redirect=function(t,i){if(-1===E.indexOf(i))throw new RangeError("Invalid status code");return new p(null,{status:i,headers:{location:t}})},i.DOMException=t.DOMException;try{new i.DOMException}catch(t){i.DOMException=function(t,i){this.message=t,this.name=i;var s=Error(t);this.stack=s.stack},i.DOMException.prototype=Object.create(Error.prototype),i.DOMException.prototype.constructor=i.DOMException}function S(t,e){return new Promise((function(n,r){var o=new w(t,e);if(o.signal&&o.signal.aborted)return r(new i.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,i,s={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",i=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var s=t.split(":"),e=s.shift().trim();if(e){var n=s.join(":").trim();i.append(e,n)}})),i)};s.url="responseURL"in a?a.responseURL:s.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;n(new p(e,s))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.onabort=function(){r(new i.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&s.blob&&(a.responseType="blob"),o.headers.forEach((function(t,i){a.setRequestHeader(i,t)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}S.polyfill=!0,t.fetch||(t.fetch=S,t.Headers=h,t.Request=w,t.Response=p),i.Headers=h,i.Request=w,i.Response=p,i.fetch=S,Object.defineProperty(i,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(o||(o={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(a||(a={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(h||(h={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(c||(c={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(u||(u={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(l||(l={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(d||(d={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(f||(f={})),function(t){t.ASC="ASC",t.DESC="DESC"}(v||(v={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(w||(w={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(y||(y={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(p||(p={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(E||(E={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(S||(S={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(m||(m={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(b||(b={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(A||(A={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(g||(g={})),A.PERSONAL_BOOK_SHARE_USER,A.PERSONAL_BOOK_USER,A.HTML_EXPORT_USER,A.PERSONAL_BOOK_USER,A.PDF_EXPORT_USER,A.PERSONAL_BOOK_USER,A.KHUB_ADMIN,A.CONTENT_PUBLISHER,A.ADMIN,A.KHUB_ADMIN,A.USERS_ADMIN,A.PORTAL_ADMIN,A.DEVELOPER,A.BETA_USER,A.DEBUG_USER;const R=s.css`
3
- `,O=i.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});class T{static get(t){const{baseUrl:i,apiIntegrationIdentifier:s}=O.getState(),e=null!=t?t:s;if(i&&e&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,e,!0)}static await(t){return new Promise((i=>{let s=T.get(t);if(s)i(s);else{const e=O.subscribe((()=>{s=T.get(t),s&&(e(),i(s))}))}}))}}class C{constructor(t=!0,s){var e;this.overrideApi=s;let n=this.constructor;n.commonCache=null!==(e=n.commonCache)&&void 0!==e?e:new i.CacheRegistry,this.cache=t?n.commonCache:new i.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:T.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:T.await()}clearCache(){this.cache.clearAll()}}var I;const U=Symbol("clearAfterUnitTest");class L extends C{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[I]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=O.getState().uiLocale,O.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=O.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,s){var e;if(t=t.toLowerCase(),Object.keys(s).length>0){const n={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...s};i.deepEqual(this.defaultMessages[t],n)||(this.defaultMessages[t]=n,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,s,...e){var n,r,o;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(r=null===(n=this.cache.getNow(t))||void 0===n?void 0:n.messages)&&void 0!==r?r:{};return new i.ParametrizedLabelResolver(null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},a).resolve(s,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,i){var s;return t=t.toLowerCase(),this.listeners[t]=null!==(s=this.listeners[t])&&void 0!==s?s:new Set,this.listeners[t].add(i),()=>{var s;return null===(s=this.listeners[t])||void 0===s?void 0:s.delete(i)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>i.delay(0).then((()=>t())).catch((()=>null)))))}}I=U,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends L{constructor(){super((async(t,i)=>(await this.awaitApi).getFluidTopicsMessageContext(t,i)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends L{constructor(){super((async(t,i)=>(await this.awaitApi).getCustomMessageContext(t,i)))}});const D=window.FluidTopicsI18nService;var N=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class P extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>T.get(),this.messageContexts=[],this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return s.html`
1
+ "use strict";(()=>{var at=Object.create;var he=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,lt=Object.prototype.hasOwnProperty;var B=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ut=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ot(e))!lt.call(t,n)&&n!==s&&he(t,n,{get:()=>e[n],enumerable:!(i=nt(e,n))||i.enumerable});return t};var f=(t,e,s)=>(s=t!=null?at(ct(t)):{},ut(e||!t||!t.__esModule?he(s,"default",{value:t,enumerable:!0}):s,t));var v=B((Et,de)=>{de.exports=ftGlobals.wcUtils});var F=B((bt,pe)=>{pe.exports=ftGlobals.lit});var q=B((vt,fe)=>{fe.exports=ftGlobals.litDecorators});var Ee=B(Ae=>{(function(t){var e=function(s){var i={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};function n(r){return r&&DataView.prototype.isPrototypeOf(r)}if(i.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(r){return r&&o.indexOf(Object.prototype.toString.call(r))>-1};function y(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(r))throw new TypeError("Invalid character in header field name");return r.toLowerCase()}function oe(r){return typeof r!="string"&&(r=String(r)),r}function Q(r){var a={next:function(){var c=r.shift();return{done:c===void 0,value:c}}};return i.iterable&&(a[Symbol.iterator]=function(){return a}),a}function m(r){this.map={},r instanceof m?r.forEach(function(a,c){this.append(c,a)},this):Array.isArray(r)?r.forEach(function(a){this.append(a[0],a[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(a){this.append(a,r[a])},this)}m.prototype.append=function(r,a){r=y(r),a=oe(a);var c=this.map[r];this.map[r]=c?c+", "+a:a},m.prototype.delete=function(r){delete this.map[y(r)]},m.prototype.get=function(r){return r=y(r),this.has(r)?this.map[r]:null},m.prototype.has=function(r){return this.map.hasOwnProperty(y(r))},m.prototype.set=function(r,a){this.map[y(r)]=oe(a)},m.prototype.forEach=function(r,a){for(var c in this.map)this.map.hasOwnProperty(c)&&r.call(a,this.map[c],c,this)},m.prototype.keys=function(){var r=[];return this.forEach(function(a,c){r.push(c)}),Q(r)},m.prototype.values=function(){var r=[];return this.forEach(function(a){r.push(a)}),Q(r)},m.prototype.entries=function(){var r=[];return this.forEach(function(a,c){r.push([c,a])}),Q(r)},i.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function Y(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function ce(r){return new Promise(function(a,c){r.onload=function(){a(r.result)},r.onerror=function(){c(r.error)}})}function We(r){var a=new FileReader,c=ce(a);return a.readAsArrayBuffer(r),c}function Je(r){var a=new FileReader,c=ce(a);return a.readAsText(r),c}function Ze(r){for(var a=new Uint8Array(r),c=new Array(a.length),A=0;A<a.length;A++)c[A]=String.fromCharCode(a[A]);return c.join("")}function le(r){if(r.slice)return r.slice(0);var a=new Uint8Array(r.byteLength);return a.set(new Uint8Array(r)),a.buffer}function ue(){return this.bodyUsed=!1,this._initBody=function(r){this._bodyInit=r,r?typeof r=="string"?this._bodyText=r:i.blob&&Blob.prototype.isPrototypeOf(r)?this._bodyBlob=r:i.formData&&FormData.prototype.isPrototypeOf(r)?this._bodyFormData=r:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)?this._bodyText=r.toString():i.arrayBuffer&&i.blob&&n(r)?(this._bodyArrayBuffer=le(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||h(r))?this._bodyArrayBuffer=le(r):this._bodyText=r=Object.prototype.toString.call(r):this._bodyText="",this.headers.get("content-type")||(typeof r=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var r=Y(this);if(r)return r;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?Y(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(We)}),this.text=function(){var r=Y(this);if(r)return r;if(this._bodyBlob)return Je(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Ze(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(rt)}),this.json=function(){return this.text().then(JSON.parse)},this}var et=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function tt(r){var a=r.toUpperCase();return et.indexOf(a)>-1?a:r}function U(r,a){a=a||{};var c=a.body;if(r instanceof U){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,a.headers||(this.headers=new m(r.headers)),this.method=r.method,this.mode=r.mode,this.signal=r.signal,!c&&r._bodyInit!=null&&(c=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=a.credentials||this.credentials||"same-origin",(a.headers||!this.headers)&&(this.headers=new m(a.headers)),this.method=tt(a.method||this.method||"GET"),this.mode=a.mode||this.mode||null,this.signal=a.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&c)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(c)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function rt(r){var a=new FormData;return r.trim().split("&").forEach(function(c){if(c){var A=c.split("="),S=A.shift().replace(/\+/g," "),u=A.join("=").replace(/\+/g," ");a.append(decodeURIComponent(S),decodeURIComponent(u))}}),a}function st(r){var a=new m,c=r.replace(/\r?\n[\t ]+/g," ");return c.split(/\r?\n/).forEach(function(A){var S=A.split(":"),u=S.shift().trim();if(u){var N=S.join(":").trim();a.append(u,N)}}),a}ue.call(U.prototype);function I(r,a){a||(a={}),this.type="default",this.status=a.status===void 0?200:a.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in a?a.statusText:"OK",this.headers=new m(a.headers),this.url=a.url||"",this._initBody(r)}ue.call(I.prototype),I.prototype.clone=function(){return new I(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},I.error=function(){var r=new I(null,{status:0,statusText:""});return r.type="error",r};var it=[301,302,303,307,308];I.redirect=function(r,a){if(it.indexOf(a)===-1)throw new RangeError("Invalid status code");return new I(null,{status:a,headers:{location:r}})},s.DOMException=t.DOMException;try{new s.DOMException}catch{s.DOMException=function(a,c){this.message=a,this.name=c;var A=Error(a);this.stack=A.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function X(r,a){return new Promise(function(c,A){var S=new U(r,a);if(S.signal&&S.signal.aborted)return A(new s.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function N(){u.abort()}u.onload=function(){var k={status:u.status,statusText:u.statusText,headers:st(u.getAllResponseHeaders()||"")};k.url="responseURL"in u?u.responseURL:k.headers.get("X-Request-URL");var W="response"in u?u.response:u.responseText;c(new I(W,k))},u.onerror=function(){A(new TypeError("Network request failed"))},u.ontimeout=function(){A(new TypeError("Network request failed"))},u.onabort=function(){A(new s.DOMException("Aborted","AbortError"))},u.open(S.method,S.url,!0),S.credentials==="include"?u.withCredentials=!0:S.credentials==="omit"&&(u.withCredentials=!1),"responseType"in u&&i.blob&&(u.responseType="blob"),S.headers.forEach(function(k,W){u.setRequestHeader(W,k)}),S.signal&&(S.signal.addEventListener("abort",N),u.onreadystatechange=function(){u.readyState===4&&S.signal.removeEventListener("abort",N)}),u.send(typeof S._bodyInit>"u"?null:S._bodyInit)})}return X.polyfill=!0,t.fetch||(t.fetch=X,t.Headers=m,t.Request=U,t.Response=I),s.Headers=m,s.Request=U,s.Response=I,s.fetch=X,Object.defineProperty(s,"__esModule",{value:!0}),s}({})})(typeof self<"u"?self:Ae)});var Xe=f(v());var Ye=f(F()),L=f(q()),x=f(v());var ye=f(F()),Tt={},me=ye.css`
2
+ `;var ze=f(v()),Qe=f(q());var O=f(v());var ge=f(v()),ht={setRequest:(t,e)=>{t.request=e.payload},setRequestQuery:(t,e)=>{t.request.query=e.payload},setRequestContentLocale:(t,e)=>{t.request.contentLocale=e.payload},setPageSize:(t,e)=>{t.request.paging.perPage=e.payload},setPageNumber:(t,e)=>{t.request.paging.page=e.payload},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestFilters:(t,e)=>{t.request.filters=e.payload},setRequestFacets:(t,e)=>{t.request.facets=e.payload},setRequestVirtualField:(t,e)=>{t.request.virtualField=e.payload},setRequestScope:(t,e)=>{t.request.scope=e.payload},setRequestClusterSortCriterion:(t,e)=>{t.request.clusterSortCriterions=e.payload},setResults:(t,e)=>{t.results=e.payload},setFacets:(t,e)=>{t.facets=e.payload},setSpellcheck:(t,e)=>{t.spellcheck=e.payload},setLocales:(t,e)=>{t.locales=e.payload},setPaging:(t,e)=>{t.paging=e.payload},setLiveQuery:(t,e)=>{t.liveQuery=e.payload},setSuggestResults:(t,e)=>{t.suggestResults=e.payload},setRequestPeriodFilter:(t,e)=>{t.request.periodFilter=e.payload}},Se=t=>ge.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:ht});var kt=f(Ee(),1);var be;(function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"})(be||(be={}));var ve;(function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"})(ve||(ve={}));var Te;(function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"})(Te||(Te={}));var Re;(function(t){t.HOMEPAGE="HOMEPAGE",t.CUSTOM="CUSTOM",t.READER="READER",t.TOPIC_TEMPLATE="TOPIC_TEMPLATE",t.SEARCH="SEARCH",t.SEARCH_RESULT="SEARCH_RESULT"})(Re||(Re={}));var xe;(function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"})(xe||(xe={}));var Ie;(function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"})(Ie||(Ie={}));var Ce;(function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"})(Ce||(Ce={}));var Oe;(function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"})(Oe||(Oe={}));var Le;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"})(Le||(Le={}));var we;(function(t){t.ASC="ASC",t.DESC="DESC"})(we||(we={}));var Ue;(function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"})(Ue||(Ue={}));var P;(function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"})(P||(P={}));var _e;(function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"})(_e||(_e={}));var Pe;(function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"})(Pe||(Pe={}));var De;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"})(De||(De={}));var ke;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"})(ke||(ke={}));var D;(function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"})(D||(D={}));var g;(function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"})(g||(g={}));var Fe;(function(t){t.VALID="VALID",t.INVALID="INVALID"})(Fe||(Fe={}));var Ut={[g.PERSONAL_BOOK_SHARE_USER]:[g.PERSONAL_BOOK_USER],[g.HTML_EXPORT_USER]:[g.PERSONAL_BOOK_USER],[g.PDF_EXPORT_USER]:[g.PERSONAL_BOOK_USER],[g.KHUB_ADMIN]:[g.CONTENT_PUBLISHER],[g.ADMIN]:[g.KHUB_ADMIN,g.USERS_ADMIN,g.PORTAL_ADMIN],[g.DEVELOPER]:[g.BETA_USER,g.DEBUG_USER]};var Ke=f(v());var Ve=f(F()),T=f(q()),R=f(v());var Me=f(F());var Ne=Me.css`
3
+ `;var Be=f(v()),dt="ft-app-info",pt={},l=Be.FtReduxStore.get({name:dt,reducers:pt,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1}});var w=f(v());var J=f(v());var _=class t{static get(e){let{baseUrl:s,apiIntegrationIdentifier:i}=l.getState(),n=e??i;if(s&&n&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(s,n,!0)}static await(e){return new Promise(s=>{let i=t.get(e);if(i)s(i);else{let n=l.subscribe(()=>{i=t.get(e),i&&(n(),s(i))})}})}};var C=class{constructor(e=!0,s){var i;this.overrideApi=s;let n=this.constructor;n.commonCache=(i=n.commonCache)!==null&&i!==void 0?i:new J.CacheRegistry,this.cache=e?n.commonCache:new J.CacheRegistry}get api(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:_.get()}get awaitApi(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:_.await()}clearCache(){this.cache.clearAll()}};var qe,ft=Symbol("clearAfterUnitTest"),H=class extends C{constructor(e){super(),this.messageContextProvider=e,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[qe]=()=>{this.defaultMessages={},this.cache=new w.CacheRegistry,this.listeners={}},this.currentUiLocale=l.getState().uiLocale,l.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:e}=l.getState();this.currentUiLocale!==e&&(this.currentUiLocale=e,this.cache.clearAll(),this.notifyAll())}addContext(e){let s=e.name.toLowerCase();this.cache.setFinal(s,e),this.notify(s)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(e,s){var i;if(e=e.toLowerCase(),Object.keys(s).length>0){let n={...(i=this.defaultMessages[e])!==null&&i!==void 0?i:{},...s};(0,w.deepEqual)(this.defaultMessages[e],n)||(this.defaultMessages[e]=n,await this.notify(e))}await this.fetchContext(e)}resolveMessage(e,s,...i){var n,o,h;e=e.toLowerCase(),this.fetchContext(e);let y=(o=(n=this.cache.getNow(e))===null||n===void 0?void 0:n.messages)!==null&&o!==void 0?o:{};return new w.ParametrizedLabelResolver((h=this.defaultMessages[e])!==null&&h!==void 0?h:{},y).resolve(s,...i)}async fetchContext(e){if(!this.cache.has(e))try{await this.cache.get(e,()=>this.messageContextProvider(this.currentUiLocale,e)),await this.notify(e)}catch(s){console.error(s)}}subscribe(e,s){var i;return e=e.toLowerCase(),this.listeners[e]=(i=this.listeners[e])!==null&&i!==void 0?i:new Set,this.listeners[e].add(s),()=>{var n;return(n=this.listeners[e])===null||n===void 0?void 0:n.delete(s)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map(e=>this.notify(e)))}async notify(e){this.listeners[e]!=null&&await Promise.all([...this.listeners[e].values()].map(s=>(0,w.delay)(0).then(()=>s()).catch(()=>null)))}};qe=ft;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends H{constructor(){super(async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends H{constructor(){super(async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e))}});var He=window.FluidTopicsI18nService,Xt=window.FluidTopicsCustomI18nService;var E=function(t,e,s,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,s,i);else for(var y=t.length-1;y>=0;y--)(h=t[y])&&(o=(n<3?h(o):n>3?h(e,s,o):h(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o},d=class extends R.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.navigatorOnline=!1,this.forcedOffline=!1,this.apiProvider=()=>_.get(),this.messageContexts=[],this.cache=new R.CacheRegistry,this.cleanSessionDebouncer=new R.Debouncer}render(){return Ve.html`
4
4
  <slot></slot>
5
- `}update(t){super.update(t),t.has("baseUrl")&&(O.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&O.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&O.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&O.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&O.actions.noCustom(this.noCustom),t.has("editorMode")&&O.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&O.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&O.actions.session(this.session),t.has("availableUiLocales")&&O.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>D.addContext(t))),t.has("openExternalDocumentInNewTab")&&O.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("navigatorOnline")&&O.actions.navigatorOnline(this.navigatorOnline),t.has("forcedOffline")&&O.actions.forcedOffline(this.forcedOffline),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}P.elementDefinitions={},P.styles=R,N([e.property()],P.prototype,"baseUrl",void 0),N([e.property()],P.prototype,"apiIntegrationIdentifier",void 0),N([e.property()],P.prototype,"uiLocale",void 0),N([i.jsonProperty(null)],P.prototype,"availableUiLocales",void 0),N([i.jsonProperty(null)],P.prototype,"metadataConfiguration",void 0),N([e.property({type:Boolean})],P.prototype,"editorMode",void 0),N([e.property({type:Boolean})],P.prototype,"noCustom",void 0),N([e.property({type:Boolean})],P.prototype,"openExternalDocumentInNewTab",void 0),N([e.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],P.prototype,"noCustomComponent",void 0),N([e.property({type:Boolean})],P.prototype,"withManualResources",void 0),N([e.property({type:Boolean})],P.prototype,"navigatorOnline",void 0),N([e.property({type:Boolean})],P.prototype,"forcedOffline",void 0),N([e.property({type:Object})],P.prototype,"apiProvider",void 0),N([i.jsonProperty([])],P.prototype,"messageContexts",void 0),N([i.jsonProperty(void 0)],P.prototype,"session",void 0);class _ extends C{async listMySearches(){let t=O.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class x extends C{async listMyBookmarks(){let t=O.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const B=i.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const F=new class{constructor(){this.currentSession=O.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new x,this.savedSearchesService=new _,O.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:s}=O.getState();i.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==s?void 0:s.profile)||(this.currentSession=s,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),B.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),B.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();B.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const i=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;B.actions.bookmarks(i)}}};window.FluidTopicsAppInfoStoreService=new class{addCommand(t,i=!1){O.commands.add(t,i)}consumeCommand(t){return O.commands.consume(t)}};window.FluidTopicsHighlightHtmlService=new class{highlightHtml(t,s){i.highlightHtml(t,s)}},i.customElement("ft-app-context")(P);class M extends C{constructor(){super(),this.cache.registerFinal("available-locales",(()=>this.api.getAvailableSearchLocales()))}async launchSearch(t){return this.api.search(t)}async launchSuggest(t){return this.api.getSuggestions(t)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}}const k=t=>t.request.virtualField===y.TITLE_ONLY&&t.request.scope===b.DOCUMENTS;class q extends Event{constructor(){super(q.eventName)}}q.eventName="search-context-clear-all-filters";class j{static build(t,s){return new j((t=>i.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:r}))(t.trim()||"context"),s)}constructor(t,s){this.store=t,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new i.Debouncer(100),this.suggestDebouncer=new i.Debouncer(300),this.service=null!=s?s:new M}async initService(){return this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}setQuery(t){this.store.actions.setRequestQuery(t),this.store.actions.setLiveQuery(t),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(t){let i=this.store.getState().locales,s=this.store.getState().request.contentLocale;if(t!=s){if(i){const e=t=>i.some((i=>i.lang==t));e(t)||(t=e(s)?s:i[0].lang)}this.store.actions.setRequestContentLocale(t),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return t}setPageSize(t){this.store.actions.setPageSize(t),this.launchSearch()}setPageNumber(t){this.store.actions.setPageNumber(t),this.launchSearch()}setSort(t){this.store.actions.setRequestSort(t),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(t){const i=t.filter((t=>t.values.length>0));this.store.actions.setRequestFilters(i),this.store.actions.setPageNumber(1),i.forEach((t=>{this.facetIds.includes(t.key)||(this.facetIds=[...this.facetIds,t.key])})),this.launchSearch()}setClusterSortCriterion(t){this.store.actions.setRequestClusterSortCriterion(t),this.launchSearch()}setSearchInDocumentTitlesOnly(t){t?(this.store.actions.setRequestVirtualField(y.TITLE_ONLY),this.store.actions.setRequestScope(b.DOCUMENTS)):(this.store.actions.setRequestVirtualField(y.EVERYWHERE),this.store.actions.setRequestScope(b.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return k(this.store.getState())}get periodFilter(){return this.store.getState().request.periodFilter}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new q)}addFacet(t){this.facetIds=[...this.facetIds,t],this.launchSearch()}replaceFacet(t,i){let s=this.facetIds.filter((i=>i!=t));i&&s.push(i),this.facetIds=s,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map((t=>t.id))}set facetIds(t){let i=[...new Set(t)].map((t=>({id:t})));this.store.actions.setRequestFacets(i)}setFilter(t,i){let s=this.store.getState().request.filters,e={key:t,values:i,negative:!1},n=[...s.filter((i=>i.key!==t)),e];this.setFilters(n)}setLiveQuery(t){this.store.actions.setLiveQuery(t),this.launchSuggest()}setRequest(t){this.store.actions.setRequest(t),this.store.actions.setLiveQuery(t.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(t){this.store.actions.setRequestScope(t),this.launchSearch()}setIgnoreEmptyQuery(t){this.ignoreEmptyQuery=t,this.launchSearch()}setOpenExternalDocumentInNewTab(t){this.openExternalDocumentInNewTab=t}setPeriodFilter(t){this.store.actions.setRequestPeriodFilter(t),this.store.actions.setPageNumber(1),this.launchSearch()}launchSearch(){return this.searchDebouncer.run((()=>this.fetchSearchData()))}launchSuggest(){return this.suggestDebouncer.run((()=>this.fetchSuggestData()))}async fetchSearchData(){var t,s;try{null===(t=this.cancelableSearch)||void 0===t||t.cancel();let e=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&0==e.query.length)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=i.cancelable(this.service.launchSearch(e));const t=await this.cancelableSearch;if(t.paging.currentPage<=1)this.store.actions.setResults(t.results),this.store.actions.setFacets(t.facets),this.store.actions.setSpellcheck(t.spellcheck);else{let i=(null!==(s=this.store.getState().results)&&void 0!==s?s:[]).concat(t.results);this.store.actions.setResults(i)}this.store.actions.setPaging(t.paging)}}catch(t){t instanceof i.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}async fetchSuggestData(){var t;try{const s=this.store.getState(),e=s.request,n={input:s.liveQuery,filters:e.filters,sort:e.sort,contentLocale:e.contentLocale,scope:e.scope};null===(t=this.cancelableSuggest)||void 0===t||t.cancel(),this.cancelableSuggest=i.cancelable(this.service.launchSuggest(n));let r=await this.cancelableSuggest;this.store.actions.setSuggestResults(r.suggestions)}catch(t){t instanceof i.CanceledPromiseError||!this.errorHandler||this.errorHandler(t)}}clear(){this.store.clear()}}var H=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class G extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const K=Symbol("registerInterval");class V extends(function(t){var i;class s extends t{constructor(){super(...arguments),this[i]=0}setSearchStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[K]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[K]):this.dispatchEvent(new G)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return i=K,H([e.state()],s.prototype,"stateManager",void 0),s}(i.FtLitElementRedux)){}var Q=function(t,i,s,e){for(var n,r=arguments.length,o=r<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,s,o):n(i,s))||o);return r>3&&o&&Object.defineProperty(i,s,o),o};class z extends CustomEvent{constructor(t){super("ft-search-load-error",{detail:t})}}class X extends CustomEvent{constructor(t){super("ft-search-request-change",{detail:t})}}class Y extends CustomEvent{constructor(t,i,s){super("ft-search-results-change",{detail:{request:t,paging:i,spellcheck:s}})}}class W extends i.FtLitElementRedux{get stateManager(){if(null==this._stateManager){const t=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=j.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),t),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"search")}return this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(O)}render(){return s.html`
5
+ `}update(e){super.update(e),e.has("baseUrl")&&(l.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),e.has("apiIntegrationIdentifier")&&l.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("uiLocale")&&l.actions.uiLocale(this.uiLocale),e.has("metadataConfiguration")&&l.actions.metadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&l.actions.noCustom(this.noCustom),e.has("editorMode")&&l.actions.editorMode(this.editorMode),e.has("noCustomComponent")&&l.actions.noCustomComponent(this.noCustomComponent),e.has("session")&&l.actions.session(this.session),e.has("availableUiLocales")&&l.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(s=>He.addContext(s)),e.has("openExternalDocumentInNewTab")&&l.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&l.actions.navigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&l.actions.forcedOffline(this.forcedOffline),setTimeout(()=>this.updateIfNeeded())}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(this.session==null&&this.updateSession(),this.availableUiLocales==null&&this.updateUiLocales(),this.metadataConfiguration==null&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",async()=>{let e=await this.apiProvider().getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.session=void 0},e.idleTimeoutInMillis),e})}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",()=>this.apiProvider().getAvailableUiLocales())}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration())}};d.elementDefinitions={};d.styles=Ne;E([(0,T.property)()],d.prototype,"baseUrl",void 0);E([(0,T.property)()],d.prototype,"apiIntegrationIdentifier",void 0);E([(0,T.property)()],d.prototype,"uiLocale",void 0);E([(0,R.jsonProperty)(null)],d.prototype,"availableUiLocales",void 0);E([(0,R.jsonProperty)(null)],d.prototype,"metadataConfiguration",void 0);E([(0,T.property)({type:Boolean})],d.prototype,"editorMode",void 0);E([(0,T.property)({type:Boolean})],d.prototype,"noCustom",void 0);E([(0,T.property)({type:Boolean})],d.prototype,"openExternalDocumentInNewTab",void 0);E([(0,T.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],d.prototype,"noCustomComponent",void 0);E([(0,T.property)({type:Boolean})],d.prototype,"withManualResources",void 0);E([(0,T.property)({type:Boolean})],d.prototype,"navigatorOnline",void 0);E([(0,T.property)({type:Boolean})],d.prototype,"forcedOffline",void 0);E([(0,T.property)({type:Object})],d.prototype,"apiProvider",void 0);E([(0,R.jsonProperty)([])],d.prototype,"messageContexts",void 0);E([(0,R.jsonProperty)(void 0)],d.prototype,"session",void 0);var K=f(v());var V=class extends C{async listMySearches(){let e=l.getState().session;return e?.sessionAuthenticated?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(e.profile.userId),5*60*1e3):[]}};var j=class extends C{async listMyBookmarks(){let e=l.getState().session;return e?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(e.profile.userId),5*60*1e3):[]}};var yt="ft-user-assets",G=K.FtReduxStore.get({name:yt,initialState:{savedSearches:void 0,bookmarks:void 0}}),Z=class{constructor(){this.currentSession=l.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new j,this.savedSearchesService=new V,l.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:s}=l.getState();(0,K.deepEqual)((e=this.currentSession)===null||e===void 0?void 0:e.profile,s?.profile)||(this.currentSession=s,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),G.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),G.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();G.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let s=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;G.actions.bookmarks(s)}}},je=new Z;var ee=class{addCommand(e,s=!1){l.commands.add(e,s)}consumeCommand(e){return l.commands.consume(e)}};window.FluidTopicsAppInfoStoreService=new ee;var Ge=f(v()),te=class{highlightHtml(e,s){(0,Ge.highlightHtml)(e,s)}};window.FluidTopicsHighlightHtmlService=new te;(0,Ke.customElement)("ft-app-context")(d);var $=class extends C{constructor(){super(),this.cache.registerFinal("available-locales",()=>this.api.getAvailableSearchLocales())}async launchSearch(e){return this.api.search(e)}async launchSuggest(e){return this.api.getSuggestions(e)}async getAvailableSearchLocales(){return this.cache.get("available-locales")}};var mt=t=>t.request.virtualField===P.TITLE_ONLY&&t.request.scope===D.DOCUMENTS,z=class t extends Event{constructor(){super(t.eventName)}};z.eventName="search-context-clear-all-filters";var M=class t{static build(e,s){return new t(Se(e.trim()||"context"),s)}constructor(e,s){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.searchDebouncer=new O.Debouncer(100),this.suggestDebouncer=new O.Debouncer(300),this.service=s??new $}async initService(){return this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales),this.launchSearch()}setQuery(e){this.store.actions.setRequestQuery(e),this.store.actions.setLiveQuery(e),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(e){let s=this.store.getState().locales,i=this.store.getState().request.contentLocale;if(e!=i){if(s){let n=o=>s.some(h=>h.lang==o);n(e)||(e=n(i)?i:s[0].lang)}this.store.actions.setRequestContentLocale(e),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return e}setPageSize(e){this.store.actions.setPageSize(e),this.launchSearch()}setPageNumber(e){this.store.actions.setPageNumber(e),this.launchSearch()}setSort(e){this.store.actions.setRequestSort(e),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(e){let s=e.filter(i=>i.values.length>0);this.store.actions.setRequestFilters(s),this.store.actions.setPageNumber(1),s.forEach(i=>{this.facetIds.includes(i.key)||(this.facetIds=[...this.facetIds,i.key])}),this.launchSearch()}setClusterSortCriterion(e){this.store.actions.setRequestClusterSortCriterion(e),this.launchSearch()}setSearchInDocumentTitlesOnly(e){e?(this.store.actions.setRequestVirtualField(P.TITLE_ONLY),this.store.actions.setRequestScope(D.DOCUMENTS)):(this.store.actions.setRequestVirtualField(P.EVERYWHERE),this.store.actions.setRequestScope(D.DEFAULT)),this.launchSearch()}get searchInDocumentTitlesOnly(){return mt(this.store.getState())}get periodFilter(){return this.store.getState().request.periodFilter}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new z)}addFacet(e){this.facetIds=[...this.facetIds,e],this.launchSearch()}replaceFacet(e,s){let i=this.facetIds.filter(n=>n!=e);s&&i.push(s),this.facetIds=i,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map(e=>e.id)}set facetIds(e){let i=[...new Set(e)].map(n=>({id:n}));this.store.actions.setRequestFacets(i)}setFilter(e,s){let i=this.store.getState().request.filters,n={key:e,values:s,negative:!1},o=[...i.filter(h=>h.key!==e),n];this.setFilters(o)}setLiveQuery(e){this.store.actions.setLiveQuery(e),this.launchSuggest()}setRequest(e){this.store.actions.setRequest(e),this.store.actions.setLiveQuery(e.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(e){this.store.actions.setRequestScope(e),this.launchSearch()}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e,this.launchSearch()}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}setPeriodFilter(e){this.store.actions.setRequestPeriodFilter(e),this.store.actions.setPageNumber(1),this.launchSearch()}launchSearch(){return this.searchDebouncer.run(()=>this.fetchSearchData())}launchSuggest(){return this.suggestDebouncer.run(()=>this.fetchSuggestData())}async fetchSearchData(){var e,s;try{(e=this.cancelableSearch)===null||e===void 0||e.cancel();let i=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&i.query.length==0)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=(0,O.cancelable)(this.service.launchSearch(i));let n=await this.cancelableSearch;if(n.paging.currentPage<=1)this.store.actions.setResults(n.results),this.store.actions.setFacets(n.facets),this.store.actions.setSpellcheck(n.spellcheck);else{let o=((s=this.store.getState().results)!==null&&s!==void 0?s:[]).concat(n.results);this.store.actions.setResults(o)}this.store.actions.setPaging(n.paging)}}catch(i){!(i instanceof O.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(i)}}async fetchSuggestData(){var e;try{let s=this.store.getState(),i=s.request,n={input:s.liveQuery,filters:i.filters,sort:i.sort,contentLocale:i.contentLocale,scope:i.scope};(e=this.cancelableSuggest)===null||e===void 0||e.cancel(),this.cancelableSuggest=(0,O.cancelable)(this.service.launchSuggest(n));let o=await this.cancelableSuggest;this.store.actions.setSuggestResults(o.suggestions)}catch(s){!(s instanceof O.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(s)}}clear(){this.store.clear()}};var gt=function(t,e,s,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,s,i);else for(var y=t.length-1;y>=0;y--)(h=t[y])&&(o=(n<3?h(o):n>3?h(e,s,o):h(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o},se=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},re=Symbol("registerInterval");function St(t){var e;class s extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[re]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[re]):this.dispatchEvent(new se)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=re,gt([(0,Qe.state)()],s.prototype,"stateManager",void 0),s}var $e=class extends St(ze.FtLitElementRedux){};var b=function(t,e,s,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,s):i,h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,s,i);else for(var y=t.length-1;y>=0;y--)(h=t[y])&&(o=(n<3?h(o):n>3?h(e,s,o):h(e,s))||o);return n>3&&o&&Object.defineProperty(e,s,o),o},ie=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},ae=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},ne=class extends CustomEvent{constructor(e,s,i){super("ft-search-results-change",{detail:{request:e,paging:s,spellcheck:i}})}},p=class extends x.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=M.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=s=>this.handleLoadError(s),this.addStore(this.stateManager.store,"search")}return this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(l)}render(){return Ye.html`
6
6
  <slot @register-ft-search-component=${this.registerComponent}></slot>
7
- `}update(t){super.update(t),t.has("query")&&void 0!==this.query&&this.stateManager.setQuery(this.query),t.has("contentLocale")&&void 0!==this.contentLocale&&this.stateManager.setContentLocale(this.contentLocale),t.has("session")&&this.session&&this.stateManager.initService(),t.has("filters")&&void 0!==this.filters&&this.stateManager.setFilters(this.filters),t.has("sort")&&void 0!==this.sort&&this.stateManager.setSort(this.sort),t.has("pageSize")&&void 0!==this.pageSize&&this.stateManager.setPageSize(this.pageSize),t.has("searchInDocumentTitlesOnly")&&void 0!==this.searchInDocumentTitlesOnly&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),t.has("scope")&&void 0!==this.scope&&this.stateManager.setScope(this.scope),t.has("ignoreEmptyQuery")&&void 0!==this.ignoreEmptyQuery&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),t.has("openExternalDocumentInNewTab")&&void 0!==this.openExternalDocumentInNewTab&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),t.has("periodFilter")&&void 0!==this.periodFilter&&this.stateManager.setPeriodFilter(this.periodFilter)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(t){super.contentAvailableCallback(t),t.has("request")&&this.request&&this.dispatchEvent(new X(this.request)),t.has("paging")&&void 0!==this.paging&&this.dispatchEvent(new Y(this.request,this.paging,this.autocorrect))}registerComponent(t){t.stopPropagation();const i=t.composedPath()[0];this.register(i)}register(t){t.setSearchStateManager(this.stateManager)}handleLoadError(t){this.dispatchEvent(new z(t))}reloadSavedSearches(){F.clearMySearches()}clear(){this.stateManager.clear()}}W.elementDefinitions={},W.styles=n,Q([e.property()],W.prototype,"query",void 0),Q([e.property()],W.prototype,"contentLocale",void 0),Q([e.property({type:Number})],W.prototype,"pageSize",void 0),Q([e.property({type:Boolean})],W.prototype,"searchInDocumentTitlesOnly",void 0),Q([e.property()],W.prototype,"periodFilter",void 0),Q([e.property()],W.prototype,"scope",void 0),Q([e.property({type:Boolean})],W.prototype,"ignoreEmptyQuery",void 0),Q([i.redux({store:O.name})],W.prototype,"openExternalDocumentInNewTab",void 0),Q([i.jsonProperty([])],W.prototype,"filters",void 0),Q([i.jsonProperty([])],W.prototype,"sort",void 0),Q([i.redux({store:"search"})],W.prototype,"request",void 0),Q([i.redux({store:"search"})],W.prototype,"paging",void 0),Q([i.redux({store:"search",selector:t=>t.spellcheck})],W.prototype,"autocorrect",void 0),Q([i.redux({store:O.name})],W.prototype,"session",void 0),Q([e.property({attribute:!1})],W.prototype,"searchServiceProvider",void 0),i.customElement("ft-search-context")(W),t.ClearAllFiltersEvent=q,t.FtSearchContext=W,t.FtSearchContextCssVariables={},t.FtSearchStateManager=j,t.LoadErrorEvent=z,t.SearchRequestChangeEvent=X,t.SearchResultsChangeEvent=Y,t.searchInDocumentTitlesOnlySelector=k,t.styles=n}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
7
+ `}update(e){super.update(e),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.setContentLocale(this.contentLocale),e.has("session")&&this.session&&this.stateManager.initService(),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sort")&&this.sort!==void 0&&this.stateManager.setSort(this.sort),e.has("pageSize")&&this.pageSize!==void 0&&this.stateManager.setPageSize(this.pageSize),e.has("searchInDocumentTitlesOnly")&&this.searchInDocumentTitlesOnly!==void 0&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("ignoreEmptyQuery")&&this.ignoreEmptyQuery!==void 0&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),e.has("openExternalDocumentInNewTab")&&this.openExternalDocumentInNewTab!==void 0&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("periodFilter")&&this.periodFilter!==void 0&&this.stateManager.setPeriodFilter(this.periodFilter)}connectedCallback(){super.connectedCallback(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new ae(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new ne(this.request,this.paging,this.autocorrect))}registerComponent(e){e.stopPropagation();let s=e.composedPath()[0];this.register(s)}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new ie(e))}reloadSavedSearches(){je.clearMySearches()}clear(){this.stateManager.clear()}};p.elementDefinitions={};p.styles=me;b([(0,L.property)()],p.prototype,"query",void 0);b([(0,L.property)()],p.prototype,"contentLocale",void 0);b([(0,L.property)({type:Number})],p.prototype,"pageSize",void 0);b([(0,L.property)({type:Boolean})],p.prototype,"searchInDocumentTitlesOnly",void 0);b([(0,L.property)()],p.prototype,"periodFilter",void 0);b([(0,L.property)()],p.prototype,"scope",void 0);b([(0,L.property)({type:Boolean})],p.prototype,"ignoreEmptyQuery",void 0);b([(0,x.redux)({store:l.name})],p.prototype,"openExternalDocumentInNewTab",void 0);b([(0,x.jsonProperty)([])],p.prototype,"filters",void 0);b([(0,x.jsonProperty)([])],p.prototype,"sort",void 0);b([(0,x.redux)({store:"search"})],p.prototype,"request",void 0);b([(0,x.redux)({store:"search"})],p.prototype,"paging",void 0);b([(0,x.redux)({store:"search",selector:t=>t.spellcheck})],p.prototype,"autocorrect",void 0);b([(0,x.redux)({store:l.name})],p.prototype,"session",void 0);b([(0,L.property)({attribute:!1})],p.prototype,"searchServiceProvider",void 0);(0,Xe.customElement)("ft-search-context")(p);})();