@fluid-topics/ft-search-input 1.1.39 → 1.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/ft-search-input.js
CHANGED
|
@@ -62,7 +62,7 @@ class FtSearchInput extends withI18n(FtSearchComponent) {
|
|
|
62
62
|
icon="search"
|
|
63
63
|
round dense
|
|
64
64
|
label="${searchInputContext.messages.searchButton()}"
|
|
65
|
-
@click=${() => this.launchSearch()}
|
|
65
|
+
@click=${() => this.launchSearch(this.liveQuery)}
|
|
66
66
|
></ft-button>
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
@@ -81,30 +81,28 @@ class FtSearchInput extends withI18n(FtSearchComponent) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
onSearchBarKeyUp(e) {
|
|
84
|
-
var _a
|
|
84
|
+
var _a;
|
|
85
85
|
if (e.key === "Backspace") {
|
|
86
86
|
e.stopPropagation();
|
|
87
87
|
}
|
|
88
88
|
switch (e.key) {
|
|
89
89
|
case "Enter":
|
|
90
|
-
|
|
91
|
-
this.forceCloseSuggestion = true;
|
|
90
|
+
this.launchSearch(this.input.value);
|
|
92
91
|
break;
|
|
93
92
|
default:
|
|
94
|
-
(
|
|
93
|
+
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setLiveQuery(this.input.value);
|
|
95
94
|
this.forceCloseSuggestion = false;
|
|
96
95
|
break;
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
|
-
launchSearch() {
|
|
98
|
+
launchSearch(query) {
|
|
100
99
|
var _a;
|
|
101
|
-
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setQuery(
|
|
100
|
+
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setQuery(query);
|
|
102
101
|
this.forceCloseSuggestion = true;
|
|
102
|
+
this.dispatchEvent(new CustomEvent("change"));
|
|
103
103
|
}
|
|
104
104
|
onSuggestionSelected(e) {
|
|
105
|
-
|
|
106
|
-
(_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setQuery(e.detail);
|
|
107
|
-
this.forceCloseSuggestion = true;
|
|
105
|
+
this.launchSearch(e.detail);
|
|
108
106
|
}
|
|
109
107
|
}
|
|
110
108
|
FtSearchInput.elementDefinitions = {
|
|
@@ -883,9 +883,9 @@ const Zo=Symbol.for(""),zo=t=>{if(t?.r===Zo)return t?._$litStatic$},Do=t=>({_$li
|
|
|
883
883
|
border-right: 1px solid ${pi.colorOutline};
|
|
884
884
|
}
|
|
885
885
|
`;var di,hi,ui,gi,yi,bi,mi,xi,vi,Oi,Ni,Si,wi,Ci,Ei,$i,Ii,Ui;!function(t){!function(o){var e={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(e.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(t){return t&&i.indexOf(Object.prototype.toString.call(t))>-1};function n(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 a(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function s(t){this.map={},t instanceof s?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function f(t){var o=new FileReader,e=p(o);return o.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(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):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.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(f)}),this.text=function(){var t,o,e,i=c(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,o=new FileReader,e=p(o),o.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),i=0;i<o.length;i++)e[i]=String.fromCharCode(o[i]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}s.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},s.prototype.delete=function(t){delete this.map[n(t)]},s.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},s.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},s.prototype.set=function(t,o){this.map[n(t)]=a(o)},s.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},s.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),l(t)},s.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),l(t)},s.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),l(t)},e.iterable&&(s.prototype[Symbol.iterator]=s.prototype.entries);var u=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function g(t,o){var e,i,r=(o=o||{}).body;if(t instanceof g){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new s(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new s(o.headers)),this.method=(e=o.method||this.method||"GET",i=e.toUpperCase(),u.indexOf(i)>-1?i:e),this.mode=o.mode||this.mode||null,this.signal=o.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function y(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),i=e.shift().replace(/\+/g," "),r=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(i),decodeURIComponent(r))}})),o}function b(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new s(o.headers),this.url=o.url||"",this._initBody(t)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},h.call(g.prototype),h.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new s(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function x(t,i){return new Promise((function(r,n){var a=new g(t,i);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function c(){l.abort()}l.onload=function(){var t,o,e={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",o=new s,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),i=e.shift().trim();if(i){var r=e.join(":").trim();o.append(i,r)}})),o)};e.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL");var i="response"in l?l.response:l.responseText;r(new b(i,e))},l.onerror=function(){n(new TypeError("Network request failed"))},l.ontimeout=function(){n(new TypeError("Network request failed"))},l.onabort=function(){n(new o.DOMException("Aborted","AbortError"))},l.open(a.method,a.url,!0),"include"===a.credentials?l.withCredentials=!0:"omit"===a.credentials&&(l.withCredentials=!1),"responseType"in l&&e.blob&&(l.responseType="blob"),a.headers.forEach((function(t,o){l.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",c),l.onreadystatechange=function(){4===l.readyState&&a.signal.removeEventListener("abort",c)}),l.send(void 0===a._bodyInit?null:a._bodyInit)}))}x.polyfill=!0,t.fetch||(t.fetch=x,t.Headers=s,t.Request=g,t.Response=b),o.Headers=s,o.Request=g,o.Response=b,o.fetch=x,Object.defineProperty(o,"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"}(di||(di={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(hi||(hi={})),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"}(ui||(ui={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(gi||(gi={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(yi||(yi={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(bi||(bi={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(mi||(mi={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(xi||(xi={})),function(t){t.ASC="ASC",t.DESC="DESC"}(vi||(vi={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(Oi||(Oi={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Ni||(Ni={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Si||(Si={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(wi||(wi={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Ci||(Ci={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Ei||(Ei={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}($i||($i={})),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"}(Ii||(Ii={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(Ui||(Ui={})),Ii.PERSONAL_BOOK_SHARE_USER,Ii.PERSONAL_BOOK_USER,Ii.HTML_EXPORT_USER,Ii.PERSONAL_BOOK_USER,Ii.PDF_EXPORT_USER,Ii.PERSONAL_BOOK_USER,Ii.KHUB_ADMIN,Ii.CONTENT_PUBLISHER,Ii.ADMIN,Ii.KHUB_ADMIN,Ii.USERS_ADMIN,Ii.PORTAL_ADMIN,Ii.DEVELOPER,Ii.BETA_USER,Ii.DEBUG_USER;const Ri=e.css`
|
|
886
|
-
`,ki=o.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}});class Wi{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ki.getState(),i=null!=t?t:e;if(o&&i&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,i,!0)}static get(t){var o;return null!=t?Wi.build(t):null!==(o=Wi.API)&&void 0!==o?o:Wi.API=Wi.build()}static await(t){return new Promise((o=>{let e=Wi.get(t);if(e)o(e);else{const i=ki.subscribe((()=>{e=Wi.get(t),e&&(i(),o(e))}))}}))}}class Li{constructor(t=!0,e){var i;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(i=r.commonCache)&&void 0!==i?i:new o.CacheRegistry,this.cache=t?r.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wi.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wi.await()}clearCache(){this.cache.clearAll()}}var Ki;const Ai=Symbol("clearAfterUnitTest");class Zi extends Li{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Ki]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=ki.getState().uiLocale,ki.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ki.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var i;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...e};o.deepEqual(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...i){var r,n,a;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new o.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},l).resolve(e,...i)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>o.delay(0).then((()=>t())).catch((()=>null)))))}}Ki=Ai,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Zi{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Zi{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const zi=window.FluidTopicsI18nService,Di=window.FluidTopicsCustomI18nService;var Fi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Bi extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>Wi.get(),this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
|
|
886
|
+
`,ki=o.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}});class Wi{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ki.getState(),i=null!=t?t:e;if(o&&i&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,i,!0)}static get(t){var o;return null!=t?Wi.build(t):null!==(o=Wi.API)&&void 0!==o?o:Wi.API=Wi.build()}static await(t){return new Promise((o=>{let e=Wi.get(t);if(e)o(e);else{const i=ki.subscribe((()=>{e=Wi.get(t),e&&(i(),o(e))}))}}))}}class Li{constructor(t=!0,e){var i;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(i=r.commonCache)&&void 0!==i?i:new o.CacheRegistry,this.cache=t?r.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wi.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:Wi.await()}clearCache(){this.cache.clearAll()}}var Ki;const Ai=Symbol("clearAfterUnitTest");class Zi extends Li{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Ki]=()=>{this.defaultMessages={},this.cache=new o.CacheRegistry,this.listeners={}},this.currentUiLocale=ki.getState().uiLocale,ki.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ki.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var i;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...e};o.deepEqual(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...i){var r,n,a;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(n=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==n?n:{};return new o.ParametrizedLabelResolver(null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},l).resolve(e,...i)}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,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}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=>o.delay(0).then((()=>t())).catch((()=>null)))))}}Ki=Ai,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Zi{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Zi{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const zi=window.FluidTopicsI18nService,Di=window.FluidTopicsCustomI18nService;var Fi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Bi extends o.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.messageContexts=[],this.apiProvider=()=>Wi.get(),this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
|
|
887
887
|
<slot></slot>
|
|
888
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(ki.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ki.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ki.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ki.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ki.actions.noCustom(this.noCustom),t.has("editorMode")&&ki.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ki.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ki.actions.session(this.session),t.has("availableUiLocales")&&ki.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>zi.addContext(t))),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()))}}Bi.elementDefinitions={},Bi.styles=Ri,Fi([i.property()],Bi.prototype,"baseUrl",void 0),Fi([i.property()],Bi.prototype,"apiIntegrationIdentifier",void 0),Fi([i.property()],Bi.prototype,"uiLocale",void 0),Fi([o.jsonProperty(null)],Bi.prototype,"availableUiLocales",void 0),Fi([o.jsonProperty(null)],Bi.prototype,"metadataConfiguration",void 0),Fi([i.property({type:Boolean})],Bi.prototype,"editorMode",void 0),Fi([i.property({type:Boolean})],Bi.prototype,"noCustom",void 0),Fi([i.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Bi.prototype,"noCustomComponent",void 0),Fi([i.property({type:Boolean})],Bi.prototype,"withManualResources",void 0),Fi([o.jsonProperty([])],Bi.prototype,"messageContexts",void 0),Fi([o.jsonProperty(void 0)],Bi.prototype,"session",void 0),Fi([i.property({type:Object})],Bi.prototype,"apiProvider",void 0);class Ti extends Li{async listMySearches(){let t=ki.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class Hi extends Li{async listMyBookmarks(){let t=ki.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Pi=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=ki.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Hi,this.savedSearchesService=new Ti,ki.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=ki.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Pi.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Pi.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Pi.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 o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Pi.actions.bookmarks(o)}}},o.customElement("ft-app-context")(Bi);class Mi extends Event{constructor(){super(Mi.eventName)}}Mi.eventName="search-context-clear-all-filters";var Gi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class ji extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const _i=Symbol("registerInterval");class Yi extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=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[_i]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[_i]):this.dispatchEvent(new ji)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=_i,Gi([i.state()],e.prototype,"stateManager",void 0),e}(o.FtLitElementRedux)){}const Vi=e.css`
|
|
888
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(ki.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ki.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ki.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ki.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ki.actions.noCustom(this.noCustom),t.has("editorMode")&&ki.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ki.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ki.actions.session(this.session),t.has("availableUiLocales")&&ki.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>zi.addContext(t))),t.has("openExternalDocumentInNewTab")&&ki.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),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()))}}Bi.elementDefinitions={},Bi.styles=Ri,Fi([i.property()],Bi.prototype,"baseUrl",void 0),Fi([i.property()],Bi.prototype,"apiIntegrationIdentifier",void 0),Fi([i.property()],Bi.prototype,"uiLocale",void 0),Fi([o.jsonProperty(null)],Bi.prototype,"availableUiLocales",void 0),Fi([o.jsonProperty(null)],Bi.prototype,"metadataConfiguration",void 0),Fi([i.property({type:Boolean})],Bi.prototype,"editorMode",void 0),Fi([i.property({type:Boolean})],Bi.prototype,"noCustom",void 0),Fi([i.property({type:Boolean})],Bi.prototype,"openExternalDocumentInNewTab",void 0),Fi([i.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],Bi.prototype,"noCustomComponent",void 0),Fi([i.property({type:Boolean})],Bi.prototype,"withManualResources",void 0),Fi([o.jsonProperty([])],Bi.prototype,"messageContexts",void 0),Fi([o.jsonProperty(void 0)],Bi.prototype,"session",void 0),Fi([i.property({type:Object})],Bi.prototype,"apiProvider",void 0);class Ti extends Li{async listMySearches(){let t=ki.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class Hi extends Li{async listMyBookmarks(){let t=ki.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Pi=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=ki.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new Hi,this.savedSearchesService=new Ti,ki.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=ki.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),Pi.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Pi.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Pi.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 o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Pi.actions.bookmarks(o)}}},o.customElement("ft-app-context")(Bi);class Mi extends Event{constructor(){super(Mi.eventName)}}Mi.eventName="search-context-clear-all-filters";var Gi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class ji extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}}const _i=Symbol("registerInterval");class Yi extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=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[_i]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[_i]):this.dispatchEvent(new ji)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=_i,Gi([i.state()],e.prototype,"stateManager",void 0),e}(o.FtLitElementRedux)){}const Vi=e.css`
|
|
889
889
|
`;var qi=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};const Xi=Symbol("i18nAttributes"),Ji=Symbol("i18nProperties"),Qi=Symbol("i18nUnsubs");function tr(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?Di:zi}i18n(t,o,...e){var i;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);const r=null!==(i=t.args)&&void 0!==i?i:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var o,e;null===(o=this[Xi])||void 0===o||o.forEach(((o,e)=>{var i;const r=this.getI18nAttributeValue(e);(null===(i=null==r?void 0:r.context)||void 0===i?void 0:i.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,r,o)})),null===(e=this[Ji])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[Xi])||void 0===o||o.forEach(((o,e)=>{const i=this.getI18nAttributeValue(e);(null==i?void 0:i.context)&&i.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(i.context),this.updateI18nAttributeMessage(e,i,o))})),null===(e=this[Ji])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,i;super.connectedCallback(),new Set([...null!==(o=null===(t=this[Ji])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(i=null===(e=this[Xi])||void 0===e?void 0:e.keys())&&void 0!==i?i:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[Qi].has(t)||this[Qi].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[Qi].forEach((t=>t())),this[Qi].clear()}}return o=Qi,qi([i.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class or extends(tr(o.FtLitElement)){}class er extends(tr(o.FtLitElementRedux)){}var ir=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class rr extends er{constructor(){super(),this.editorMode=!1,this.addStore(ki)}render(){return this.key&&this.context?e.html`
|
|
890
890
|
<span class="ft-i18n">
|
|
891
891
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
@@ -983,8 +983,8 @@ const Zo=Symbol.for(""),zo=t=>{if(t?.r===Zo)return t?._$litStatic$},Do=t=>({_$li
|
|
|
983
983
|
icon="search"
|
|
984
984
|
round dense
|
|
985
985
|
label="${ar.messages.searchButton()}"
|
|
986
|
-
@click=${()=>this.launchSearch()}
|
|
986
|
+
@click=${()=>this.launchSearch(this.liveQuery)}
|
|
987
987
|
></ft-button>
|
|
988
988
|
</div>
|
|
989
989
|
</div>
|
|
990
|
-
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){var o
|
|
990
|
+
`}onSearchBarKeyDown(t){switch(t.key){case"ArrowDown":t.stopPropagation(),t.preventDefault(),this.suggestion.focusFirstSuggestion();break;case"Backspace":t.stopPropagation()}}onSearchBarKeyUp(t){var o;if("Backspace"===t.key&&t.stopPropagation(),"Enter"===t.key)this.launchSearch(this.input.value);else null===(o=this.stateManager)||void 0===o||o.setLiveQuery(this.input.value),this.forceCloseSuggestion=!1}launchSearch(t){var o;null===(o=this.stateManager)||void 0===o||o.setQuery(t),this.forceCloseSuggestion=!0,this.dispatchEvent(new CustomEvent("change"))}onSuggestionSelected(t){this.launchSearch(t.detail)}}dr.elementDefinitions={"ft-search-input-suggestion":pr,"ft-button":ai},dr.styles=[kt,fi],fr([o.redux()],dr.prototype,"request",void 0),fr([o.redux()],dr.prototype,"liveQuery",void 0),fr([o.redux()],dr.prototype,"suggestResults",void 0),fr([i.state()],dr.prototype,"forceCloseSuggestion",void 0),fr([i.query(".ft-search-input--input")],dr.prototype,"input",void 0),fr([i.query("ft-search-input-suggestion")],dr.prototype,"suggestion",void 0),o.customElement("ft-search-input")(dr),t.FtSearchInput=dr,t.FtSearchInputCssVariables=pi,t.styles=fi}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML,ftGlobals.litRepeat);
|