@fluid-topics/ft-search-context 2.0.34 → 2.0.36

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,12 +1,11 @@
1
- "use strict";(()=>{var Os=Object.create;var Tr=Object.defineProperty;var xs=Object.getOwnPropertyDescriptor;var Rs=Object.getOwnPropertyNames;var _s=Object.getPrototypeOf,Is=Object.prototype.hasOwnProperty;var Je=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var Ms=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Rs(e))!Is.call(t,s)&&s!==r&&Tr(t,s,{get:()=>e[s],enumerable:!(n=xs(e,s))||n.enumerable});return t};var w=(t,e,r)=>(r=t!=null?Os(_s(t)):{},Ms(e||!t||!t.__esModule?Tr(r,"default",{value:t,enumerable:!0}):r,t));var L=Je((Mi,wr)=>{wr.exports=ftGlobals.wcUtils});var we=Je((Di,Cr)=>{Cr.exports=ftGlobals.lit});var ne=Je((Li,Or)=>{Or.exports=ftGlobals.litDecorators});var Dr=Je((se,Mr)=>{var Ze=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,et=(function(){function t(){this.fetch=!1,this.DOMException=Ze.DOMException}return t.prototype=Ze,new t})();(function(t){var e=(function(r){var n=typeof t<"u"&&t||typeof self<"u"&&self||typeof global<"u"&&global||{},s={searchParams:"URLSearchParams"in n,iterable:"Symbol"in n&&"iterator"in Symbol,blob:"FileReader"in n&&"Blob"in n&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in n,arrayBuffer:"ArrayBuffer"in n};function i(u){return u&&DataView.prototype.isPrototypeOf(u)}if(s.arrayBuffer)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(u){return u&&a.indexOf(Object.prototype.toString.call(u))>-1};function c(u){if(typeof u!="string"&&(u=String(u)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(u)||u==="")throw new TypeError('Invalid character in header field name: "'+u+'"');return u.toLowerCase()}function l(u){return typeof u!="string"&&(u=String(u)),u}function d(u){var f={next:function(){var S=u.shift();return{done:S===void 0,value:S}}};return s.iterable&&(f[Symbol.iterator]=function(){return f}),f}function h(u){this.map={},u instanceof h?u.forEach(function(f,S){this.append(S,f)},this):Array.isArray(u)?u.forEach(function(f){if(f.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+f.length);this.append(f[0],f[1])},this):u&&Object.getOwnPropertyNames(u).forEach(function(f){this.append(f,u[f])},this)}h.prototype.append=function(u,f){u=c(u),f=l(f);var S=this.map[u];this.map[u]=S?S+", "+f:f},h.prototype.delete=function(u){delete this.map[c(u)]},h.prototype.get=function(u){return u=c(u),this.has(u)?this.map[u]:null},h.prototype.has=function(u){return this.map.hasOwnProperty(c(u))},h.prototype.set=function(u,f){this.map[c(u)]=l(f)},h.prototype.forEach=function(u,f){for(var S in this.map)this.map.hasOwnProperty(S)&&u.call(f,this.map[S],S,this)},h.prototype.keys=function(){var u=[];return this.forEach(function(f,S){u.push(S)}),d(u)},h.prototype.values=function(){var u=[];return this.forEach(function(f){u.push(f)}),d(u)},h.prototype.entries=function(){var u=[];return this.forEach(function(f,S){u.push([S,f])}),d(u)},s.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function p(u){if(!u._noBody){if(u.bodyUsed)return Promise.reject(new TypeError("Already read"));u.bodyUsed=!0}}function v(u){return new Promise(function(f,S){u.onload=function(){f(u.result)},u.onerror=function(){S(u.error)}})}function m(u){var f=new FileReader,S=v(f);return f.readAsArrayBuffer(u),S}function y(u){var f=new FileReader,S=v(f),O=/charset=([A-Za-z0-9_-]+)/.exec(u.type),I=O?O[1]:"utf-8";return f.readAsText(u,I),S}function b(u){for(var f=new Uint8Array(u),S=new Array(f.length),O=0;O<f.length;O++)S[O]=String.fromCharCode(f[O]);return S.join("")}function A(u){if(u.slice)return u.slice(0);var f=new Uint8Array(u.byteLength);return f.set(new Uint8Array(u)),f.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(u){this.bodyUsed=this.bodyUsed,this._bodyInit=u,u?typeof u=="string"?this._bodyText=u:s.blob&&Blob.prototype.isPrototypeOf(u)?this._bodyBlob=u:s.formData&&FormData.prototype.isPrototypeOf(u)?this._bodyFormData=u:s.searchParams&&URLSearchParams.prototype.isPrototypeOf(u)?this._bodyText=u.toString():s.arrayBuffer&&s.blob&&i(u)?(this._bodyArrayBuffer=A(u.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(u)||o(u))?this._bodyArrayBuffer=A(u):this._bodyText=u=Object.prototype.toString.call(u):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof u=="string"?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(u)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s.blob&&(this.blob=function(){var u=p(this);if(u)return u;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var u=p(this);return u||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(s.blob)return this.blob().then(m);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var u=p(this);if(u)return u;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(b(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(Q)}),this.json=function(){return this.text().then(JSON.parse)},this}var x=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function C(u){var f=u.toUpperCase();return x.indexOf(f)>-1?f:u}function N(u,f){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');f=f||{};var S=f.body;if(u instanceof N){if(u.bodyUsed)throw new TypeError("Already read");this.url=u.url,this.credentials=u.credentials,f.headers||(this.headers=new h(u.headers)),this.method=u.method,this.mode=u.mode,this.signal=u.signal,!S&&u._bodyInit!=null&&(S=u._bodyInit,u.bodyUsed=!0)}else this.url=String(u);if(this.credentials=f.credentials||this.credentials||"same-origin",(f.headers||!this.headers)&&(this.headers=new h(f.headers)),this.method=C(f.method||this.method||"GET"),this.mode=f.mode||this.mode||null,this.signal=f.signal||this.signal||(function(){if("AbortController"in n){var T=new AbortController;return T.signal}})(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&S)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(S),(this.method==="GET"||this.method==="HEAD")&&(f.cache==="no-store"||f.cache==="no-cache")){var O=/([?&])_=[^&]*/;if(O.test(this.url))this.url=this.url.replace(O,"$1_="+new Date().getTime());else{var I=/\?/;this.url+=(I.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function Q(u){var f=new FormData;return u.trim().split("&").forEach(function(S){if(S){var O=S.split("="),I=O.shift().replace(/\+/g," "),T=O.join("=").replace(/\+/g," ");f.append(decodeURIComponent(I),decodeURIComponent(T))}}),f}function de(u){var f=new h,S=u.replace(/\r?\n[\t ]+/g," ");return S.split("\r").map(function(O){return O.indexOf(`
2
- `)===0?O.substr(1,O.length):O}).forEach(function(O){var I=O.split(":"),T=I.shift().trim();if(T){var Ye=I.join(":").trim();try{f.append(T,Ye)}catch(kt){console.warn("Response "+kt.message)}}}),f}E.call(N.prototype);function H(u,f){if(!(this instanceof H))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(f||(f={}),this.type="default",this.status=f.status===void 0?200:f.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=f.statusText===void 0?"":""+f.statusText,this.headers=new h(f.headers),this.url=f.url||"",this._initBody(u)}E.call(H.prototype),H.prototype.clone=function(){return new H(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},H.error=function(){var u=new H(null,{status:200,statusText:""});return u.ok=!1,u.status=0,u.type="error",u};var fe=[301,302,303,307,308];H.redirect=function(u,f){if(fe.indexOf(f)===-1)throw new RangeError("Invalid status code");return new H(null,{status:f,headers:{location:u}})},r.DOMException=n.DOMException;try{new r.DOMException}catch{r.DOMException=function(f,S){this.message=f,this.name=S;var O=Error(f);this.stack=O.stack},r.DOMException.prototype=Object.create(Error.prototype),r.DOMException.prototype.constructor=r.DOMException}function Te(u,f){return new Promise(function(S,O){var I=new N(u,f);if(I.signal&&I.signal.aborted)return O(new r.DOMException("Aborted","AbortError"));var T=new XMLHttpRequest;function Ye(){T.abort()}T.onload=function(){var U={statusText:T.statusText,headers:de(T.getAllResponseHeaders()||"")};I.url.indexOf("file://")===0&&(T.status<200||T.status>599)?U.status=200:U.status=T.status,U.url="responseURL"in T?T.responseURL:U.headers.get("X-Request-URL");var he="response"in T?T.response:T.responseText;setTimeout(function(){S(new H(he,U))},0)},T.onerror=function(){setTimeout(function(){O(new TypeError("Network request failed"))},0)},T.ontimeout=function(){setTimeout(function(){O(new TypeError("Network request timed out"))},0)},T.onabort=function(){setTimeout(function(){O(new r.DOMException("Aborted","AbortError"))},0)};function kt(U){try{return U===""&&n.location.href?n.location.href:U}catch{return U}}if(T.open(I.method,kt(I.url),!0),I.credentials==="include"?T.withCredentials=!0:I.credentials==="omit"&&(T.withCredentials=!1),"responseType"in T&&(s.blob?T.responseType="blob":s.arrayBuffer&&(T.responseType="arraybuffer")),f&&typeof f.headers=="object"&&!(f.headers instanceof h||n.Headers&&f.headers instanceof n.Headers)){var Er=[];Object.getOwnPropertyNames(f.headers).forEach(function(U){Er.push(c(U)),T.setRequestHeader(U,l(f.headers[U]))}),I.headers.forEach(function(U,he){Er.indexOf(he)===-1&&T.setRequestHeader(he,U)})}else I.headers.forEach(function(U,he){T.setRequestHeader(he,U)});I.signal&&(I.signal.addEventListener("abort",Ye),T.onreadystatechange=function(){T.readyState===4&&I.signal.removeEventListener("abort",Ye)}),T.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return Te.polyfill=!0,n.fetch||(n.fetch=Te,n.Headers=h,n.Request=N,n.Response=H),r.Headers=h,r.Request=N,r.Response=H,r.fetch=Te,r})({})})(et);et.fetch.ponyfill=!0;delete et.fetch.polyfill;var Ce=Ze.fetch?Ze:et;se=Ce.fetch;se.default=Ce.fetch;se.fetch=Ce.fetch;se.Headers=Ce.Headers;se.Request=Ce.Request;se.Response=Ce.Response;Mr.exports=se});var Cs=w(L());var Ts=w(we()),ee=w(ne()),q=w(L());var xr=w(we());var Rr=xr.css`
3
- `;var Fe=w(L()),br=w(ne());var je;(function(t){t.CLUSTERED_SEARCH="CLUSTERED_SEARCH"})(je||(je={}));var P=w(L());var _r=w(L()),Ds={setRequest:(t,e)=>{t.request=e.payload}},Ir=t=>_r.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",clusterSortCriterions:[],metadataFilters:[],facets:[],sort:[],sortId:void 0,paging:{page:1,perPage:20},keywordMatch:void 0},liveQuery:"",paging:void 0,facets:void 0,spellcheck:void 0,locales:[],results:void 0,announcements:void 0,suggestResults:void 0,configuration:void 0},reducers:Ds});var Ps=w(Dr(),1);var Lr;(function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"})(Lr||(Lr={}));var Pr;(function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"})(Pr||(Pr={}));var kr;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(kr||(kr={}));var ie;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(ie||(ie={}));var Nr;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(Nr||(Nr={}));var Ur;(function(t){t.VALUE="VALUE",t.DATE="DATE",t.RANGE="RANGE"})(Ur||(Ur={}));var Fr;(function(t){t.OFFICIAL="OFFICIAL",t.AI="AI"})(Fr||(Fr={}));var pe;(function(t){t.BOOKMARK__CREATE="BOOKMARK__CREATE",t.BOOKMARK__DELETE="BOOKMARK__DELETE",t.CASE_DEFLECTION__START="CASE_DEFLECTION__START",t.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",t.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",t.CHATBOT__RATE="CHATBOT__RATE",t.COLLECTION__CREATE="COLLECTION__CREATE",t.COLLECTION__UPDATE="COLLECTION__UPDATE",t.COLLECTION__DELETE="COLLECTION__DELETE",t.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",t.DOCUMENT__ON_DEMAND_TRANSLATE="DOCUMENT__ON_DEMAND_TRANSLATE",t.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",t.DOCUMENT__PRINT="DOCUMENT__PRINT",t.DOCUMENT__PROCESS="DOCUMENT__PROCESS",t.DOCUMENT__RATE="DOCUMENT__RATE",t.DOCUMENT__SEARCH="DOCUMENT__SEARCH",t.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",t.DOCUMENT__UNRATE="DOCUMENT__UNRATE",t.FEEDBACK__SEND="FEEDBACK__SEND",t.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",t.AI__RATE="AI__RATE",t.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",t.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",t.KHUB__PROCESS="KHUB__PROCESS",t.KHUB__SEARCH="KHUB__SEARCH",t.LABELS__DOWNLOAD="LABELS__DOWNLOAD",t.LINK__SHARE="LINK__SHARE",t.PAGE__DISPLAY="PAGE__DISPLAY",t.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",t.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",t.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",t.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",t.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",t.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",t.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",t.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",t.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",t.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",t.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",t.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",t.TOPIC__RATE="TOPIC__RATE",t.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",t.TOPIC__UNRATE="TOPIC__UNRATE",t.USER__LOGIN="USER__LOGIN",t.USER__LOGOUT="USER__LOGOUT",t.HEARTBEAT="HEARTBEAT"})(pe||(pe={}));var jr;(function(t){t.STANDARD="STANDARD",t.STRUCTURAL="STRUCTURAL"})(jr||(jr={}));var Br;(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"})(Br||(Br={}));var qr;(function(t){t.HOMEPAGE="HOMEPAGE",t.CUSTOM="CUSTOM",t.HEADER="HEADER",t.READER="READER",t.TOPIC_TEMPLATE="TOPIC_TEMPLATE",t.SEARCH="SEARCH",t.SEARCH_RESULT="SEARCH_RESULT",t.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",t.LINK_PREVIEW="LINK_PREVIEW",t.UD_VIEWER="UD_VIEWER",t.ASSET_VIEWER="ASSET_VIEWER"})(qr||(qr={}));var Hr;(function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"})(Hr||(Hr={}));var Vr;(function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"})(Vr||(Vr={}));var Kr;(function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"})(Kr||(Kr={}));var Gr;(function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"})(Gr||(Gr={}));var zr;(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"})(zr||(zr={}));var tt;(function(t){t.OPTIONAL="OPTIONAL",t.MANDATORY="MANDATORY"})(tt||(tt={}));var $r;(function(t){t.ASC="ASC",t.DESC="DESC"})($r||($r={}));var Wr;(function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"})(Wr||(Wr={}));var Oe;(function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"})(Oe||(Oe={}));var Qr;(function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(Qr||(Qr={}));var Xr;(function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"})(Xr||(Xr={}));var Yr;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(Yr||(Yr={}));var Jr;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(Jr||(Jr={}));var Y;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.HTML_PACKAGE="HTML_PACKAGE",t.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(Y||(Y={}));var xe;(function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS",t.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(xe||(xe={}));var Zr;(function(t){t.PLAIN_TEXT="PLAIN_TEXT",t.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",t.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(Zr||(Zr={}));var D;(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.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",t.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN"})(D||(D={}));var z;(function(t){t.SEARCHES="SEARCHES",t.BOOKMARKS="BOOKMARKS",t.BOOKS="BOOKS",t.COLLECTIONS="COLLECTIONS"})(z||(z={}));var en;(function(t){t.UNAUTHENTICATED="UNAUTHENTICATED",t.USER_INCOMPLETE="USER_INCOMPLETE",t.MFA_REQUIRED="MFA_REQUIRED",t.AUTHENTICATED="AUTHENTICATED"})(en||(en={}));var tn;(function(t){t.VALID="VALID",t.INVALID="INVALID"})(tn||(tn={}));var rn;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",t.SUMMARY="SUMMARY",t.SEMANTIC_SEARCH="SEMANTIC_SEARCH",t.CHATBOT_INSTRUCTIONS="CHATBOT_INSTRUCTIONS",t.OTHER="OTHER"})(rn||(rn={}));var nn;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",t.SLOW="SLOW",t.OTHER="OTHER"})(nn||(nn={}));var sn;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(sn||(sn={}));var an;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(an||(an={}));var on;(function(t){t.USER="USER",t.ASSISTANT="ASSISTANT"})(on||(on={}));var un;(function(t){t.TEXT="TEXT",t.HTML="HTML"})(un||(un={}));var cn;(function(t){t.HTML="HTML",t.MARKDOWN="MARKDOWN"})(cn||(cn={}));var ln;(function(t){t.MAP="MAP",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(ln||(ln={}));var Ls={[D.PERSONAL_BOOK_SHARE_USER]:[D.PERSONAL_BOOK_USER],[D.HTML_EXPORT_USER]:[D.PERSONAL_BOOK_USER],[D.PDF_EXPORT_USER]:[D.PERSONAL_BOOK_USER],[D.KHUB_ADMIN]:[D.CONTENT_PUBLISHER],[D.ADMIN]:[D.KHUB_ADMIN,D.USERS_ADMIN,D.PORTAL_ADMIN,D.BEHAVIOR_DATA_USER],[D.GENERATIVE_AI_EXPORT_USER]:[D.GENERATIVE_AI_USER]};function dn(t,e){return t===e||(Ls[t]??[]).some(r=>dn(r,e))}function fn(t,e){return t==null?!1:(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some(n=>dn(n,e))}var or=w(ne());var hn=w(ne(),1);var Nt=t=>e=>{window.customElements.get(t)||window.customElements.define(t,e)};function pn(t,e){return(0,hn.property)({type:Object,converter:{fromAttribute:r=>{if(r==null)return Be(t);try{return JSON.parse(r)}catch{return Be(t)}},toAttribute:r=>JSON.stringify(r)},hasChanged:qe,...e??{}})}function ks(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let r,n;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!rt(t[n],e[n]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;for(n of t.entries())if(!rt(n[1],e.get(n[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();let s=a=>Object.keys(a).filter(o=>a[o]!=null),i=s(t);if(r=i.length,r!==s(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){let a=i[n];if(!rt(t[a],e[a]))return!1}return!0}return t!==t&&e!==e||t==null&&e==null}function rt(t,e){try{return ks(t,e)}catch{return!1}}function qe(t,e){return!rt(t,e)}function Be(t){return typeof window.structuredClone=="function"?structuredClone(t):t!=null?JSON.parse(JSON.stringify(t)):t}function nt(t,e){let r=n=>n[t]===!0;return n=>{if(r(n))return n;let s=e(n);return s[t]=!0,s}}var mn=w(ne(),1);var Ut=t=>{let e=t??{};return(r,n)=>{var s;let i={hasChanged:qe,attribute:!1,...e};(0,mn.property)(i)(r,n);let a=r.constructor;a.reduxProperties=new Map(a.reduxProperties),a.reduxProperties.set(n,{selector:(s=e.selector)!==null&&s!==void 0?s:(o=>o[n]),store:e.store})}};var st=class{constructor(){this.queue=[]}add(e,r=!1){r&&this.clear(e.type),this.queue.push(e)}consume(e){let r=this.queue.find(n=>n.type===e);return r&&(this.queue=this.queue.filter(n=>n!==r)),r}clear(e){typeof e=="string"?this.queue=this.queue.filter(r=>r.type!==e):this.queue=this.queue.filter(r=>!e.test(r.type))}};var me=w(ne(),1);var it=class{constructor(e=0){this.timeout=e,this.callbacks=[]}run(e,r){return this.callbacks=[e],this.debounce(r)}queue(e,r){return this.callbacks.push(e),this.debounce(r)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(e){return this.promise==null&&(this.promise=new Promise((r,n)=>{this.resolvePromise=r,this.rejectPromise=n})),this.clearTimeout(),this._debounce=window.setTimeout(()=>this.runCallbacks(),e??this.timeout),this.promise}async runCallbacks(){var e,r;let n=[...this.callbacks];this.callbacks=[];let s=(e=this.rejectPromise)!==null&&e!==void 0?e:(()=>null),i=(r=this.resolvePromise)!==null&&r!==void 0?r:(()=>null);this.clearPromise();for(let a of n)try{await a()}catch(o){s(o);return}i(!0)}clearTimeout(){this._debounce!=null&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}};var vn=w(we(),1);var at=globalThis,Ns=at.ShadowRoot&&(at.ShadyCSS===void 0||at.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;var yn=(t,e)=>{if(Ns)t.adoptedStyleSheets=e.map((r=>r instanceof CSSStyleSheet?r:r.styleSheet));else for(let r of e){let n=document.createElement("style"),s=at.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=r.cssText,t.appendChild(n)}};var ot=class extends vn.LitElement{get scopedRegistryConstructor(){return this.constructor}createRenderRoot(){let e=this.scopedRegistryConstructor;e.elementDefinitions&&!e.registry&&(e.registry=new CustomElementRegistry,e.defineScopedElements(e.elementDefinitions));let r={...e.shadowRootOptions,customElements:e.registry},n=this.renderOptions.creationScope=this.attachShadow(r);return yn(n,e.elementStyles),n}static canDefineScopedElement(e){return!!this.registry&&!this.registry.get(e)}static defineScopedElements(e){Object.entries(e).forEach(([r,n])=>this.defineScopedElement(r,n))}static defineScopedElement(e,r){Nt(e)(r),this.canDefineScopedElement(e)&&this.registry.define(e,r)}canDefineScopedElement(e){return this.scopedRegistryConstructor.canDefineScopedElement(e)}defineScopedElements(e){this.scopedRegistryConstructor.defineScopedElements(e)}defineScopedElement(e,r){this.scopedRegistryConstructor.defineScopedElement(e,r)}};function gn(t,e,...r){var n;let s=t.querySelector(e);for(let i of r)s=(n=s?.shadowRoot)===null||n===void 0?void 0:n.querySelector(i);return s}var _e=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},En,Sn=Symbol("constructorPrototype"),bn=Symbol("constructorName"),Tn=Symbol("exportpartsDebouncer"),An=Symbol("dynamicDependenciesLoaded"),Re=class t extends CustomEvent{constructor(){super(t.eventName,{bubbles:!0})}};Re.eventName="exportparts-updated";var J=class extends ot{constructor(){super(),this.useAdoptedStyleSheets=!0,this.adoptedCustomStyleSheet=new CSSStyleSheet,this[En]=new it(5),this.scheduleExportpartsUpdate=()=>{var e,r,n;(!((e=this.exportpartsPrefix)===null||e===void 0)&&e.trim()||(n=(r=this.exportpartsPrefixes)===null||r===void 0?void 0:r.length)!==null&&n!==void 0&&n)&&this[Tn].run(()=>{var s,i;!((s=this.exportpartsPrefix)===null||s===void 0)&&s.trim()?this.setExportpartsAttribute([this.exportpartsPrefix]):this.exportpartsPrefixes!=null&&((i=this.exportpartsPrefixes)===null||i===void 0?void 0:i.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)})},this[bn]=this.constructor.name,this[Sn]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[bn]&&Object.setPrototypeOf(this,this[Sn])}connectedCallback(){var e;super.connectedCallback();try{this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(this.adoptedCustomStyleSheet)&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.adoptedCustomStyleSheet]),this.useAdoptedStyleSheets=!0}catch(n){this.useAdoptedStyleSheets=!1,console.error("Cannot use adopted stylesheets",n)}let r=this.constructor;r[An]||(r[An]=!0,this.importDynamicDependencies()),(e=this.shadowRoot)===null||e===void 0||e.addEventListener(Re.eventName,this.scheduleExportpartsUpdate)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.shadowRoot)===null||e===void 0||e.removeEventListener(Re.eventName,this.scheduleExportpartsUpdate)}importDynamicDependencies(){}updated(e){super.updated(e),this.updateComplete.then(()=>{this.contentAvailableCallback(e),this.focusElementToFocus(e),this.applyCustomStylesheet(e),this.scheduleExportpartsUpdate(),e.has("exportparts")&&this.dispatchEvent(new Re)})}contentAvailableCallback(e){}focusElementToFocus(e){if(e.has("elementToFocus")&&this.elementToFocus!=null){let{element:r,selector:n,shadowPath:s}=this.elementToFocus;if(n!=null){let i=[...s??[],n];r=gn(this.shadowRoot,...i)}r?.focus(),window.FluidTopicsA11yHints.isKeyboardNavigation||r?.blur(),this.elementToFocus=void 0}}applyCustomStylesheet(e){var r,n,s;if(((n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll(".ft-lit-element--custom-stylesheet"))!==null&&n!==void 0?n:[]).forEach(i=>i.remove()),this.useAdoptedStyleSheets){if(e.has("customStylesheet"))try{this.adoptedCustomStyleSheet.replaceSync((s=this.customStylesheet)!==null&&s!==void 0?s:"")}catch(i){console.error(i,this.customStylesheet),this.useAdoptedStyleSheets=!1}}else if(this.customStylesheet){let i=document.createElement("style");i.classList.add("ft-lit-element--custom-stylesheet"),i.innerHTML=this.customStylesheet,this.shadowRoot.append(i)}}setExportpartsAttribute(e){var r,n,s,i,a,o;let c=p=>p!=null&&p.trim().length>0,l=e.filter(c).map(p=>p.trim());if(l.length===0){this.exportparts=void 0;return}let d=new Set;for(let p of(n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll("[part],[exportparts]"))!==null&&n!==void 0?n:[]){let v=(i=(s=p.getAttribute("part"))===null||s===void 0?void 0:s.split(" "))!==null&&i!==void 0?i:[],m=(o=(a=p.getAttribute("exportparts"))===null||a===void 0?void 0:a.split(",").map(b=>b.split(":")[1]))!==null&&o!==void 0?o:[],y=[...v,...m].filter(c).map(b=>b.trim());for(let b of y)d.add(b)}if(d.size===0){this.exportparts=void 0;return}let h=[...d.values()].flatMap(p=>l.map(v=>`${p}:${v}--${p}`));this.exportparts=[...this.part,...h].join(", ")}};En=Tn;_e([(0,me.property)()],J.prototype,"exportpartsPrefix",void 0);_e([pn([])],J.prototype,"exportpartsPrefixes",void 0);_e([(0,me.property)({reflect:!0})],J.prototype,"exportparts",void 0);_e([(0,me.property)()],J.prototype,"customStylesheet",void 0);_e([(0,me.property)()],J.prototype,"elementToFocus",void 0);_e([(0,me.state)()],J.prototype,"useAdoptedStyleSheets",void 0);function ut(t){var e;return(e=t?.isFtReduxStore)!==null&&e!==void 0?e:!1}var He=Symbol("internalReduxEventsUnsubscribers"),ae=Symbol("internalStoresUnsubscribers"),ye=Symbol("internalStores"),Us=nt(Symbol("withRedux"),function(t){var e,r,n;class s extends t{constructor(){super(...arguments),this[e]=new Map,this[r]=new Map,this[n]=new Map}get reduxConstructor(){return this.constructor}willUpdate(a){super.willUpdate(a),[...this.reduxConstructor.reduxReactiveProperties].some(o=>a.has(o))&&this.updateFromStores()}getUnnamedStore(){if(this[ye].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[ye].values()][0]}getStore(a){return a==null?this.getUnnamedStore():this[ye].get(a)}addStore(a,o){var c;o=(c=o??a.name)!==null&&c!==void 0?c:"default-store",this.unsubscribeFromStore(o),this[ye].set(o,a),this.subscribeToStore(o,a),this.updateFromStores()}removeStore(a){let o=typeof a=="string"?a:a.name;this.unsubscribeFromStore(o),this[ye].delete(o)}setupStores(){this.unsubscribeFromStores(),this[ye].forEach((a,o)=>this.subscribeToStore(o,a)),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach((a,o)=>{let c=this.constructor.getPropertyOptions(o);if(!c?.attribute||!this.hasAttribute(typeof c?.attribute=="string"?c.attribute:o)){let l=this.getStore(a.store);l&&(a.store?this[ae].has(a.store):this[ae].size>0)&&(this[o]=a.selector(l.getState(),this))}})}subscribeToStore(a,o){var c;this[ae].set(a,o.subscribe(()=>this.updateFromStores())),this[He].set(a,[]),ut(o)&&o.eventBus&&((c=this.reduxConstructor.reduxEventListeners)===null||c===void 0||c.forEach((l,d)=>{if(typeof this[d]=="function"&&(!l.store||o.name===l.store)){let h=p=>this[d](p);o.addEventListener(l.eventName,h),this[He].get(a).push(()=>o.removeEventListener(l.eventName,h))}})),this.onStoreAvailable(a)}unsubscribeFromStores(){this[ae].forEach((a,o)=>this.unsubscribeFromStore(o))}unsubscribeFromStore(a){var o;this[ae].has(a)&&this[ae].get(a)(),this[ae].delete(a),(o=this[He].get(a))===null||o===void 0||o.forEach(c=>c()),this[He].delete(a)}onStoreAvailable(a){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}return e=ae,r=ye,n=He,s.reduxProperties=new Map,s.reduxReactiveProperties=new Set,s.reduxEventListeners=new Map,s}),wn=class extends Us(J){};function $(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];if(0)var s,i;throw Error("[Immer] minified error nr: "+t+(r.length?" "+r.map((function(a){return"'"+a+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function te(t){return!!t&&!!t[_]}function X(t){var e;return!!t&&((function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var s=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return s===Object||typeof s=="function"&&Function.toString.call(s)===Gs})(t)||Array.isArray(t)||!!t[Mn]||!!(!((e=t.constructor)===null||e===void 0)&&e[Mn])||zt(t)||$t(t))}function ve(t,e,r){r===void 0&&(r=!1),De(t)===0?(r?Object.keys:Me)(t).forEach((function(n){r&&typeof n=="symbol"||e(n,t[n],t)})):t.forEach((function(n,s){return e(s,n,t)}))}function De(t){var e=t[_];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:zt(t)?2:$t(t)?3:0}function Ie(t,e){return De(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Fs(t,e){return De(t)===2?t.get(e):t[e]}function Dn(t,e,r){var n=De(t);n===2?t.set(e,r):n===3?t.add(r):t[e]=r}function Ln(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function zt(t){return Vs&&t instanceof Map}function $t(t){return Ks&&t instanceof Set}function oe(t){return t.o||t.t}function Wt(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=Nn(t);delete e[_];for(var r=Me(e),n=0;n<r.length;n++){var s=r[n],i=e[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(e[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[s]})}return Object.create(Object.getPrototypeOf(t),e)}function Qt(t,e){return e===void 0&&(e=!1),Xt(t)||te(t)||!X(t)||(De(t)>1&&(t.set=t.add=t.clear=t.delete=js),Object.freeze(t),e&&ve(t,(function(r,n){return Qt(n,!0)}),!0)),t}function js(){$(2)}function Xt(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function Z(t){var e=Gt[t];return e||$(18,t),e}function Bs(t,e){Gt[t]||(Gt[t]=e)}function Ht(){return Ke}function Ft(t,e){e&&(Z("Patches"),t.u=[],t.s=[],t.v=e)}function ct(t){Vt(t),t.p.forEach(qs),t.p=null}function Vt(t){t===Ke&&(Ke=t.l)}function Cn(t){return Ke={p:[],l:Ke,h:t,m:!0,_:0}}function qs(t){var e=t[_];e.i===0||e.i===1?e.j():e.g=!0}function jt(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.O||Z("ES5").S(e,t,n),n?(r[_].P&&(ct(e),$(4)),X(t)&&(t=lt(e,t),e.l||dt(e,t)),e.u&&Z("Patches").M(r[_].t,t,e.u,e.s)):t=lt(e,r,[]),ct(e),e.u&&e.v(e.u,e.s),t!==kn?t:void 0}function lt(t,e,r){if(Xt(e))return e;var n=e[_];if(!n)return ve(e,(function(o,c){return On(t,n,e,o,c,r)}),!0),e;if(n.A!==t)return e;if(!n.P)return dt(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var s=n.i===4||n.i===5?n.o=Wt(n.k):n.o,i=s,a=!1;n.i===3&&(i=new Set(s),s.clear(),a=!0),ve(i,(function(o,c){return On(t,n,s,o,c,r,a)})),dt(t,s,!1),r&&t.u&&Z("Patches").N(n,r,t.u,t.s)}return n.o}function On(t,e,r,n,s,i,a){if(te(s)){var o=lt(t,s,i&&e&&e.i!==3&&!Ie(e.R,n)?i.concat(n):void 0);if(Dn(r,n,o),!te(o))return;t.m=!1}else a&&r.add(s);if(X(s)&&!Xt(s)){if(!t.h.D&&t._<1)return;lt(t,s),e&&e.A.l||dt(t,s)}}function dt(t,e,r){r===void 0&&(r=!1),!t.l&&t.h.D&&t.m&&Qt(e,r)}function Bt(t,e){var r=t[_];return(r?oe(r):t)[e]}function xn(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function ue(t){t.P||(t.P=!0,t.l&&ue(t.l))}function qt(t){t.o||(t.o=Wt(t.t))}function Kt(t,e,r){var n=zt(e)?Z("MapSet").F(e,r):$t(e)?Z("MapSet").T(e,r):t.O?(function(s,i){var a=Array.isArray(s),o={i:a?1:0,A:i?i.A:Ht(),P:!1,I:!1,R:{},l:i,t:s,k:null,o:null,j:null,C:!1},c=o,l=Ge;a&&(c=[o],l=Ve);var d=Proxy.revocable(c,l),h=d.revoke,p=d.proxy;return o.k=p,o.j=h,p})(e,r):Z("ES5").J(e,r);return(r?r.A:Ht()).p.push(n),n}function Hs(t){return te(t)||$(22,t),(function e(r){if(!X(r))return r;var n,s=r[_],i=De(r);if(s){if(!s.P&&(s.i<4||!Z("ES5").K(s)))return s.t;s.I=!0,n=Rn(r,i),s.I=!1}else n=Rn(r,i);return ve(n,(function(a,o){s&&Fs(s.t,a)===o||Dn(n,a,e(o))})),i===3?new Set(n):n})(t)}function Rn(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Wt(t)}function Pn(){function t(a,o){var c=i[a];return c?c.enumerable=o:i[a]=c={configurable:!0,enumerable:o,get:function(){var l=this[_];return Ge.get(l,a)},set:function(l){var d=this[_];Ge.set(d,a,l)}},c}function e(a){for(var o=a.length-1;o>=0;o--){var c=a[o][_];if(!c.P)switch(c.i){case 5:n(c)&&ue(c);break;case 4:r(c)&&ue(c)}}}function r(a){for(var o=a.t,c=a.k,l=Me(c),d=l.length-1;d>=0;d--){var h=l[d];if(h!==_){var p=o[h];if(p===void 0&&!Ie(o,h))return!0;var v=c[h],m=v&&v[_];if(m?m.t!==p:!Ln(v,p))return!0}}var y=!!o[_];return l.length!==Me(o).length+(y?0:1)}function n(a){var o=a.k;if(o.length!==a.t.length)return!0;var c=Object.getOwnPropertyDescriptor(o,o.length-1);if(c&&!c.get)return!0;for(var l=0;l<o.length;l++)if(!o.hasOwnProperty(l))return!0;return!1}function s(a){a.g&&$(3,JSON.stringify(oe(a)))}var i={};Bs("ES5",{J:function(a,o){var c=Array.isArray(a),l=(function(h,p){if(h){for(var v=Array(p.length),m=0;m<p.length;m++)Object.defineProperty(v,""+m,t(m,!0));return v}var y=Nn(p);delete y[_];for(var b=Me(y),A=0;A<b.length;A++){var E=b[A];y[E]=t(E,h||!!y[E].enumerable)}return Object.create(Object.getPrototypeOf(p),y)})(c,a),d={i:c?5:4,A:o?o.A:Ht(),P:!1,I:!1,R:{},l:o,t:a,k:l,o:null,g:!1,C:!1};return Object.defineProperty(l,_,{value:d,writable:!0}),l},S:function(a,o,c){c?te(o)&&o[_].A===a&&e(a.p):(a.u&&(function l(d){if(d&&typeof d=="object"){var h=d[_];if(h){var p=h.t,v=h.k,m=h.R,y=h.i;if(y===4)ve(v,(function(C){C!==_&&(p[C]!==void 0||Ie(p,C)?m[C]||l(v[C]):(m[C]=!0,ue(h)))})),ve(p,(function(C){v[C]!==void 0||Ie(v,C)||(m[C]=!1,ue(h))}));else if(y===5){if(n(h)&&(ue(h),m.length=!0),v.length<p.length)for(var b=v.length;b<p.length;b++)m[b]=!1;else for(var A=p.length;A<v.length;A++)m[A]=!0;for(var E=Math.min(v.length,p.length),x=0;x<E;x++)v.hasOwnProperty(x)||(m[x]=!0),m[x]===void 0&&l(v[x])}}}})(a.p[0]),e(a.p))},K:function(a){return a.i===4?r(a):n(a)}})}var _n,Ke,Yt=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Vs=typeof Map<"u",Ks=typeof Set<"u",In=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",kn=Yt?Symbol.for("immer-nothing"):((_n={})["immer-nothing"]=!0,_n),Mn=Yt?Symbol.for("immer-draftable"):"__$immer_draftable",_=Yt?Symbol.for("immer-state"):"__$immer_state";var Gs=""+Object.prototype.constructor,Me=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,Nn=Object.getOwnPropertyDescriptors||function(t){var e={};return Me(t).forEach((function(r){e[r]=Object.getOwnPropertyDescriptor(t,r)})),e},Gt={},Ge={get:function(t,e){if(e===_)return t;var r=oe(t);if(!Ie(r,e))return(function(s,i,a){var o,c=xn(i,a);return c?"value"in c?c.value:(o=c.get)===null||o===void 0?void 0:o.call(s.k):void 0})(t,r,e);var n=r[e];return t.I||!X(n)?n:n===Bt(t.t,e)?(qt(t),t.o[e]=Kt(t.A.h,n,t)):n},has:function(t,e){return e in oe(t)},ownKeys:function(t){return Reflect.ownKeys(oe(t))},set:function(t,e,r){var n=xn(oe(t),e);if(n?.set)return n.set.call(t.k,r),!0;if(!t.P){var s=Bt(oe(t),e),i=s?.[_];if(i&&i.t===r)return t.o[e]=r,t.R[e]=!1,!0;if(Ln(r,s)&&(r!==void 0||Ie(t.t,e)))return!0;qt(t),ue(t)}return t.o[e]===r&&(r!==void 0||e in t.o)||Number.isNaN(r)&&Number.isNaN(t.o[e])||(t.o[e]=r,t.R[e]=!0),!0},deleteProperty:function(t,e){return Bt(t.t,e)!==void 0||e in t.t?(t.R[e]=!1,qt(t),ue(t)):delete t.R[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var r=oe(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{writable:!0,configurable:t.i!==1||e!=="length",enumerable:n.enumerable,value:r[e]}},defineProperty:function(){$(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){$(12)}},Ve={};ve(Ge,(function(t,e){Ve[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),Ve.deleteProperty=function(t,e){return Ve.set.call(this,t,e,void 0)},Ve.set=function(t,e,r){return Ge.set.call(this,t[0],e,r,t[0])};var zs=(function(){function t(r){var n=this;this.O=In,this.D=!0,this.produce=function(s,i,a){if(typeof s=="function"&&typeof i!="function"){var o=i;i=s;var c=n;return function(y){var b=this;y===void 0&&(y=o);for(var A=arguments.length,E=Array(A>1?A-1:0),x=1;x<A;x++)E[x-1]=arguments[x];return c.produce(y,(function(C){var N;return(N=i).call.apply(N,[b,C].concat(E))}))}}var l;if(typeof i!="function"&&$(6),a!==void 0&&typeof a!="function"&&$(7),X(s)){var d=Cn(n),h=Kt(n,s,void 0),p=!0;try{l=i(h),p=!1}finally{p?ct(d):Vt(d)}return typeof Promise<"u"&&l instanceof Promise?l.then((function(y){return Ft(d,a),jt(y,d)}),(function(y){throw ct(d),y})):(Ft(d,a),jt(l,d))}if(!s||typeof s!="object"){if((l=i(s))===void 0&&(l=s),l===kn&&(l=void 0),n.D&&Qt(l,!0),a){var v=[],m=[];Z("Patches").M(s,l,v,m),a(v,m)}return l}$(21,s)},this.produceWithPatches=function(s,i){if(typeof s=="function")return function(l){for(var d=arguments.length,h=Array(d>1?d-1:0),p=1;p<d;p++)h[p-1]=arguments[p];return n.produceWithPatches(l,(function(v){return s.apply(void 0,[v].concat(h))}))};var a,o,c=n.produce(s,i,(function(l,d){a=l,o=d}));return typeof Promise<"u"&&c instanceof Promise?c.then((function(l){return[l,a,o]})):[c,a,o]},typeof r?.useProxies=="boolean"&&this.setUseProxies(r.useProxies),typeof r?.autoFreeze=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var e=t.prototype;return e.createDraft=function(r){X(r)||$(8),te(r)&&(r=Hs(r));var n=Cn(this),s=Kt(this,r,void 0);return s[_].C=!0,Vt(n),s},e.finishDraft=function(r,n){var s=r&&r[_],i=s.A;return Ft(i,n),jt(void 0,i)},e.setAutoFreeze=function(r){this.D=r},e.setUseProxies=function(r){r&&!In&&$(20),this.O=r},e.applyPatches=function(r,n){var s;for(s=n.length-1;s>=0;s--){var i=n[s];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}s>-1&&(n=n.slice(s+1));var a=Z("Patches").$;return te(r)?a(r,n):this.produce(r,(function(o){return a(o,n)}))},t})(),V=new zs,$s=V.produce,Ta=V.produceWithPatches.bind(V),wa=V.setAutoFreeze.bind(V),Ca=V.setUseProxies.bind(V),Oa=V.applyPatches.bind(V),xa=V.createDraft.bind(V),Ra=V.finishDraft.bind(V),ft=$s;function ge(t){"@babel/helpers - typeof";return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ge(t)}function Un(t,e){if(ge(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(ge(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fn(t){var e=Un(t,"string");return ge(e)=="symbol"?e:e+""}function jn(t,e,r){return(e=Fn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Bn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Jt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Bn(Object(r),!0).forEach(function(n){jn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bn(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function F(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var qn=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),Zt=function(){return Math.random().toString(36).substring(7).split("").join(".")},ht={INIT:"@@redux/INIT"+Zt(),REPLACE:"@@redux/REPLACE"+Zt(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Zt()}};function Ws(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function er(t,e,r){var n;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(F(0));if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(F(1));return r(er)(t,e)}if(typeof t!="function")throw new Error(F(2));var s=t,i=e,a=[],o=a,c=!1;function l(){o===a&&(o=a.slice())}function d(){if(c)throw new Error(F(3));return i}function h(y){if(typeof y!="function")throw new Error(F(4));if(c)throw new Error(F(5));var b=!0;return l(),o.push(y),function(){if(b){if(c)throw new Error(F(6));b=!1,l();var E=o.indexOf(y);o.splice(E,1),a=null}}}function p(y){if(!Ws(y))throw new Error(F(7));if(typeof y.type>"u")throw new Error(F(8));if(c)throw new Error(F(9));try{c=!0,i=s(i,y)}finally{c=!1}for(var b=a=o,A=0;A<b.length;A++){var E=b[A];E()}return y}function v(y){if(typeof y!="function")throw new Error(F(10));s=y,p({type:ht.REPLACE})}function m(){var y,b=h;return y={subscribe:function(E){if(typeof E!="object"||E===null)throw new Error(F(11));function x(){E.next&&E.next(d())}x();var C=b(x);return{unsubscribe:C}}},y[qn]=function(){return this},y}return p({type:ht.INIT}),n={dispatch:p,subscribe:h,getState:d,replaceReducer:v},n[qn]=m,n}function Qs(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:ht.INIT});if(typeof n>"u")throw new Error(F(12));if(typeof r(void 0,{type:ht.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(F(13))})}function Hn(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var s=e[n];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,o;try{Qs(r)}catch(c){o=c}return function(l,d){if(l===void 0&&(l={}),o)throw o;if(0)var h;for(var p=!1,v={},m=0;m<i.length;m++){var y=i[m],b=r[y],A=l[y],E=b(A,d);if(typeof E>"u"){var x=d&&d.type;throw new Error(F(14))}v[y]=E,p=p||E!==A}return p=p||i.length!==Object.keys(l).length,p?v:l}}function Le(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,s){return function(){return n(s.apply(void 0,arguments))}})}function Vn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){return function(){var s=n.apply(void 0,arguments),i=function(){throw new Error(F(15))},a={getState:s.getState,dispatch:function(){return i.apply(void 0,arguments)}},o=e.map(function(c){return c(a)});return i=Le.apply(void 0,o)(s.dispatch),Jt(Jt({},s),{},{dispatch:i})}}}function Kn(t){var e=function(n){var s=n.dispatch,i=n.getState;return function(a){return function(o){return typeof o=="function"?o(s,i,t):a(o)}}};return e}var Gn=Kn();Gn.withExtraArgument=Kn;var tr=Gn;var Xn=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Xs=function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(d){return c([l,d])}}function c(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,s=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){r.label=l[1];break}if(l[0]===6&&r.label<i[1]){r.label=i[1],i=l;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(l);break}i[2]&&r.ops.pop(),r.trys.pop();continue}l=e.call(t,r)}catch(d){l=[6,d],s=0}finally{n=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}},Pe=function(t,e){for(var r=0,n=e.length,s=t.length;r<n;r++,s++)t[s]=e[r];return t},Ys=Object.defineProperty,Js=Object.defineProperties,Zs=Object.getOwnPropertyDescriptors,zn=Object.getOwnPropertySymbols,ei=Object.prototype.hasOwnProperty,ti=Object.prototype.propertyIsEnumerable,$n=function(t,e,r){return e in t?Ys(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r},ce=function(t,e){for(var r in e||(e={}))ei.call(e,r)&&$n(t,r,e[r]);if(zn)for(var n=0,s=zn(e);n<s.length;n++){var r=s[n];ti.call(e,r)&&$n(t,r,e[r])}return t},rr=function(t,e){return Js(t,Zs(e))},ri=function(t,e,r){return new Promise(function(n,s){var i=function(c){try{o(r.next(c))}catch(l){s(l)}},a=function(c){try{o(r.throw(c))}catch(l){s(l)}},o=function(c){return c.done?n(c.value):Promise.resolve(c.value).then(i,a)};o((r=r.apply(t,e)).next())})};var ni=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Le:Le.apply(null,arguments)},za=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function si(t){if(typeof t!="object"||t===null)return!1;var e=Object.getPrototypeOf(t);if(e===null)return!0;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return e===r}function le(t,e){function r(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];if(e){var i=e.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return ce(ce({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:n[0]}}return r.toString=function(){return""+t},r.type=t,r.match=function(n){return n.type===t},r}var ii=(function(t){Xn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,Pe([void 0],r[0].concat(this)))):new(e.bind.apply(e,Pe([void 0],r.concat(this))))},e})(Array),ai=(function(t){Xn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,Pe([void 0],r[0].concat(this)))):new(e.bind.apply(e,Pe([void 0],r.concat(this))))},e})(Array);function ir(t){return X(t)?ft(t,function(){}):t}function oi(t){return typeof t=="boolean"}function ui(){return function(e){return ci(e)}}function ci(t){t===void 0&&(t={});var e=t.thunk,r=e===void 0?!0:e,n=t.immutableCheck,s=n===void 0?!0:n,i=t.serializableCheck,a=i===void 0?!0:i,o=t.actionCreatorCheck,c=o===void 0?!0:o,l=new ii;if(r&&(oi(r)?l.push(tr):l.push(tr.withExtraArgument(r.extraArgument))),0){if(s)var d;if(a)var h;if(c)var p}return l}var nr=!0;function Yn(t){var e=ui(),r=t||{},n=r.reducer,s=n===void 0?void 0:n,i=r.middleware,a=i===void 0?e():i,o=r.devTools,c=o===void 0?!0:o,l=r.preloadedState,d=l===void 0?void 0:l,h=r.enhancers,p=h===void 0?void 0:h,v;if(typeof s=="function")v=s;else if(si(s))v=Hn(s);else throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');var m=a;if(typeof m=="function"&&(m=m(e),!nr&&!Array.isArray(m)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!nr&&m.some(function(C){return typeof C!="function"}))throw new Error("each middleware provided to configureStore must be a function");var y=Vn.apply(void 0,m),b=Le;c&&(b=ni(ce({trace:!nr},typeof c=="object"&&c)));var A=new ai(y),E=A;Array.isArray(p)?E=Pe([y],p):typeof p=="function"&&(E=p(A));var x=b.apply(void 0,E);return er(v,d,x)}function Jn(t){var e={},r=[],n,s={addCase:function(i,a){var o=typeof i=="string"?i:i.type;if(!o)throw new Error("`builder.addCase` cannot be called with an empty action type");if(o in e)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return e[o]=a,s},addMatcher:function(i,a){return r.push({matcher:i,reducer:a}),s},addDefaultCase:function(i){return n=i,s}};return t(s),[e,r,n]}function li(t){return typeof t=="function"}function di(t,e,r,n){r===void 0&&(r=[]);var s=typeof e=="function"?Jn(e):[e,r,n],i=s[0],a=s[1],o=s[2],c;if(li(t))c=function(){return ir(t())};else{var l=ir(t);c=function(){return l}}function d(h,p){h===void 0&&(h=c());var v=Pe([i[p.type]],a.filter(function(m){var y=m.matcher;return y(p)}).map(function(m){var y=m.reducer;return y}));return v.filter(function(m){return!!m}).length===0&&(v=[o]),v.reduce(function(m,y){if(y)if(te(m)){var b=m,A=y(b,p);return A===void 0?m:A}else{if(X(m))return ft(m,function(E){return y(E,p)});var A=y(m,p);if(A===void 0){if(m===null)return m;throw Error("A case reducer on a non-draftable value must not return undefined")}return A}return m},h)}return d.getInitialState=c,d}function fi(t,e){return t+"/"+e}function Zn(t){var e=t.name;if(!e)throw new Error("`name` is a required option for createSlice");typeof process<"u";var r=typeof t.initialState=="function"?t.initialState:ir(t.initialState),n=t.reducers||{},s=Object.keys(n),i={},a={},o={};s.forEach(function(d){var h=n[d],p=fi(e,d),v,m;"reducer"in h?(v=h.reducer,m=h.prepare):v=h,i[d]=v,a[p]=v,o[d]=m?le(p,m):le(p)});function c(){var d=typeof t.extraReducers=="function"?Jn(t.extraReducers):[t.extraReducers],h=d[0],p=h===void 0?{}:h,v=d[1],m=v===void 0?[]:v,y=d[2],b=y===void 0?void 0:y,A=ce(ce({},p),a);return di(r,function(E){for(var x in A)E.addCase(x,A[x]);for(var C=0,N=m;C<N.length;C++){var Q=N[C];E.addMatcher(Q.matcher,Q.reducer)}b&&E.addDefaultCase(b)})}var l;return{name:e,reducer:function(d,h){return l||(l=c()),l(d,h)},actions:o,caseReducers:i,getInitialState:function(){return l||(l=c()),l.getInitialState()}}}var hi="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",pi=function(t){t===void 0&&(t=21);for(var e="",r=t;r--;)e+=hi[Math.random()*64|0];return e},mi=["name","message","stack","code"],sr=(function(){function t(e,r){this.payload=e,this.meta=r}return t})(),Wn=(function(){function t(e,r){this.payload=e,this.meta=r}return t})(),yi=function(t){if(typeof t=="object"&&t!==null){for(var e={},r=0,n=mi;r<n.length;r++){var s=n[r];typeof t[s]=="string"&&(e[s]=t[s])}return e}return{message:String(t)}},Xa=(function(){function t(e,r,n){var s=le(e+"/fulfilled",function(d,h,p,v){return{payload:d,meta:rr(ce({},v||{}),{arg:p,requestId:h,requestStatus:"fulfilled"})}}),i=le(e+"/pending",function(d,h,p){return{payload:void 0,meta:rr(ce({},p||{}),{arg:h,requestId:d,requestStatus:"pending"})}}),a=le(e+"/rejected",function(d,h,p,v,m){return{payload:v,error:(n&&n.serializeError||yi)(d||"Rejected"),meta:rr(ce({},m||{}),{arg:p,requestId:h,rejectedWithValue:!!v,requestStatus:"rejected",aborted:d?.name==="AbortError",condition:d?.name==="ConditionError"})}}),o=!1,c=typeof AbortController<"u"?AbortController:(function(){function d(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return d.prototype.abort=function(){},d})();function l(d){return function(h,p,v){var m=n?.idGenerator?n.idGenerator(d):pi(),y=new c,b,A=!1;function E(C){b=C,y.abort()}var x=(function(){return ri(this,null,function(){var C,N,Q,de,H,fe,Te;return Xs(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),de=(C=n?.condition)==null?void 0:C.call(n,d,{getState:p,extra:v}),gi(de)?[4,de]:[3,2];case 1:de=u.sent(),u.label=2;case 2:if(de===!1||y.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return A=!0,H=new Promise(function(f,S){return y.signal.addEventListener("abort",function(){return S({name:"AbortError",message:b||"Aborted"})})}),h(i(m,d,(N=n?.getPendingMeta)==null?void 0:N.call(n,{requestId:m,arg:d},{getState:p,extra:v}))),[4,Promise.race([H,Promise.resolve(r(d,{dispatch:h,getState:p,extra:v,requestId:m,signal:y.signal,abort:E,rejectWithValue:function(f,S){return new sr(f,S)},fulfillWithValue:function(f,S){return new Wn(f,S)}})).then(function(f){if(f instanceof sr)throw f;return f instanceof Wn?s(f.payload,m,d,f.meta):s(f,m,d)})])];case 3:return Q=u.sent(),[3,5];case 4:return fe=u.sent(),Q=fe instanceof sr?a(null,m,d,fe.payload,fe.meta):a(fe,m,d),[3,5];case 5:return Te=n&&!n.dispatchConditionRejection&&a.match(Q)&&Q.meta.condition,Te||h(Q),[2,Q]}})})})();return Object.assign(x,{abort:E,requestId:m,arg:d,unwrap:function(){return x.then(vi)}})}}return Object.assign(l,{pending:i,rejected:a,fulfilled:s,typePrefix:e})}return t.withTypes=function(){return t},t})();function vi(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function gi(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var es="listener",ts="completed",rs="cancelled",Ya="task-"+rs,Ja="task-"+ts,Za=es+"-"+rs,eo=es+"-"+ts;var ar="listenerMiddleware";var to=le(ar+"/add"),ro=le(ar+"/removeAll"),no=le(ar+"/remove");var Qn,so=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis):function(t){return(Qn||(Qn=Promise.resolve())).then(t).catch(function(e){return setTimeout(function(){throw e},0)})},Si=function(t){return function(e){setTimeout(e,t)}},io=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Si(10);Pn();var bi=nt(Symbol("withEventBus"),function(t,e){return class extends t{constructor(){super(...arguments),this.eventBus=e??document.createElement("span")}addEventListener(r,n,s){this.eventBus.addEventListener(r,n,s)}dispatchEvent(r){return this.eventBus.dispatchEvent(r)}removeEventListener(r,n,s){this.eventBus.removeEventListener(r,n,s)}}}),pt=class extends bi(Object){};window.ftReduxStores||(window.ftReduxStores={});var ns=class t extends pt{static get(e){var r;let n=typeof e=="string"?e:e.name,s=typeof e=="string"?void 0:e,i=window.ftReduxStores[n];if(ut(i))return i;if(s==null)return;let a=Zn({...s,reducers:(r=s.reducers)!==null&&r!==void 0?r:{}}),o=Yn({reducer:(c,l)=>{if(l.type==="CLEAR_FT_REDUX_STORE"){let d=Be(a.getInitialState());for(let h of l.keeping)d[h]=(c??d)[h];return d}else if(typeof l.type=="string"&&l.type.startsWith("DEFAULT_VALUE_SETTER__"))return{...c,...l.overwrites};return a.reducer(c,l)}});return window.ftReduxStores[s.name]=new t(a,o,s.eventBus)}constructor(e,r,n){super(),this.reduxSlice=e,this.reduxStore=r,this.isFtReduxStore=!0,this.commands=new st;let s=i=>i!=null?JSON.parse(JSON.stringify(i)):i;this.actions=new Proxy(this.reduxSlice.actions,{get:(i,a,o)=>{let c=a,l=i[c];return l?(...d)=>{let h=l(...d.map(s));return this.reduxStore.dispatch(h),h}:d=>{this.setState({[c]:s(d)})}}}),this.eventBus=n??this.eventBus}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:[]})}clearKeeping(...e){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:e})}setState(e){this.reduxStore.dispatch({type:"DEFAULT_VALUE_SETTER__"+Object.keys(e).join("_"),overwrites:e})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(e){throw new Error("Not implemented yet.")}subscribe(e){return this.reduxStore.subscribe(e)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}};var mt=class{static format(e,r,n,s,i){return window.moment?window.moment(e).locale(r).format(this.getMomentDateFormat(n,s,!!i)):this.getIntlDateTime(e,r,n,s,!!i)}static getMomentDateFormat(e,r,n){return n?"LT":e?r?"lll":"ll":r?"L LT":"L"}static getIntlDateTime(e,r,n,s,i){let a=typeof e=="string"?new Date(e):e,o=new Intl.DateTimeFormat(r,{dateStyle:n?"medium":"short"}).format(a),c=new Intl.DateTimeFormat(r,{timeStyle:"short"}).format(a);return i?c:s?`${o} ${c}`:o}static getTimezoneAsString(){let e=n=>String(Math.floor(n)).padStart(2,"0"),r=new Date().getTimezoneOffset();return`${r<0?"+":"-"}${e(Math.abs(r)/60)}:${e(Math.abs(r)%60)}`}};var yt=w(L()),Ai="ft-app-info",ke=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};ke.eventName="authentication-change";var ze=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};ze.eventName="ui-locale-changed";var Ei={session:(t,e)=>{(0,yt.deepEqual)(t.session,e.payload)||(t.session=e.payload,setTimeout(()=>g.dispatchEvent(new ke(e.payload)),0))}},g=yt.FtReduxStore.get({name:Ai,reducers:Ei,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,searchLanguageSetsUiLanguage:!1,uiLanguageSetsSearchLanguage:!1,uiLanguageSetsReaderLanguage:!1,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1}});var ss=w(L()),vt=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},Po=(0,ss.applyMixinOnce)(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(g)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var s,i;return((i=(s=this.metadataDescriptors.find(o=>o.key===n))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1)?o=>mt.format(o,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return vt([(0,or.property)({type:Boolean})],e.prototype,"useLongDateFormat",void 0),vt([(0,or.property)({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),vt([Ut({store:g.name,selector:r=>{var n,s;return(s=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&s!==void 0?s:[]}})],e.prototype,"metadataDescriptors",void 0),vt([Ut({store:g.name})],e.prototype,"uiLocale",void 0),e});var Et=w(L());var ur=w(L());var Se=class t{static get(e){let{baseUrl:r,apiIntegrationIdentifier:n}=g.getState(),s=e??n;if(r&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,s,!0)}static await(e){return new Promise(r=>{let n=t.get(e);if(n)r(n);else{let s=g.subscribe(()=>{n=t.get(e),n&&(s(),r(n))})}})}};var Ne=class{constructor(e){this.overrideApi=e}get api(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:Se.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):Se.await()}};var j=class extends Ne{constructor(e=!0,r){var n;super(r),this.sortObjectFields=(i,a)=>typeof a!="object"||a==null||Array.isArray(a)?a:Object.fromEntries(Object.entries(a).sort(([o],[c])=>o.localeCompare(c)));let s=this.constructor;s.commonCache=(n=s.commonCache)!==null&&n!==void 0?n:new ur.CacheRegistry,this.cache=e?s.commonCache:new ur.CacheRegistry}clearCache(){this.cache.clearAll()}hash(e){return String(Array.from(JSON.stringify(e,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var gt=class extends j{async listMySearches(){let{session:e}=g.getState();return fn(e,D.SAVED_SEARCH_USER)?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(e.profile.userId),300*1e3):[]}};var St=class extends j{async listMyBookmarks(){let e=g.getState().session;return e?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(e.profile.userId),300*1e3):[]}};var bt=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=g.getState().session;return!!e?.sessionAuthenticated}};var At=class extends j{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=g.getState().session;return!!e?.sessionAuthenticated}};var Ti="ft-user-assets",wi={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(z).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:s}=e.payload;lr(t,r,[...cr(t,r),s]),is(t,r,1,n),as(t,s)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;lr(t,r,cr(t,r).map(s=>s.id===n.id?n:s)),as(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:s}=e.payload;lr(t,r,cr(t,r).filter(i=>i.id!==s)),is(t,r,-1,n)}},os={[z.SEARCHES]:"savedSearches",[z.BOOKMARKS]:"bookmarks",[z.BOOKS]:void 0,[z.COLLECTIONS]:void 0},cr=(t,e)=>{var r;let n=os[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},lr=(t,e,r)=>{let n=os[e];n&&(t[n]=r)},is=(t,e,r,n)=>{let s=t.assetCounts.allAsset[e];if(s!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,s+r),e===z.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},as=(t,e)=>{let r=t.assetLabels.map(s=>s.title),n=e.labels.filter(s=>!r.includes(s)).map(s=>({title:s}));t.assetLabels.push(...n)},K=Et.FtReduxStore.get({name:Ti,reducers:wi,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(z).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),dr=class{constructor(e=new bt,r=new At){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=g.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new St,this.savedSearchesService=new gt,g.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=g.getState();(0,Et.deepEqual)((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),K.actions.clearAssetCount(),K.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),K.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),K.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();K.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();K.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&K.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&K.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(K.getState().assetCounts.bookmarkByMap).length!==0;e===z.BOOKMARKS&&r&&K.actions.clearBookmarkCountByMap(),K.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;K.actions.bookmarks(r)}}},fr=new dr;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=fr);var hr=class{addCommand(e,r=!1){g.commands.add(e,r)}consumeCommand(e){return g.commands.consume(e)}};window.FluidTopicsAppInfoStoreService=new hr;var W=w(L());var us,Ue=class extends CustomEvent{constructor(e){super("ft-i18n-context-loaded",{detail:e})}},Ci=Symbol("clearAfterUnitTest"),Tt=class extends(0,W.withEventBus)(j){constructor(e){super(),this.messageContextProvider=e,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[us]=()=>{this.defaultMessages={},this.cache=new W.CacheRegistry,this.listeners={}},this.currentUiLocale=g.getState().uiLocale,g.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:e}=g.getState();this.currentUiLocale!==e&&(this.currentUiLocale=e,this.cache.clearAll(),this.notifyAll())}addContext(e){let r=e.name.toLowerCase();this.cache.setFinal(r,e),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(e,r){var n;if(e=e.toLowerCase(),r&&Object.keys(r).length>0){let s={...(n=this.defaultMessages[e])!==null&&n!==void 0?n:{},...r};(0,W.deepEqual)(this.defaultMessages[e],s)||(this.defaultMessages[e]=s,await this.notify(e))}return this.fetchContext(e)}resolveContext(e){var r,n;return this.fetchContext(e),(n=(r=this.cache.getNow(e))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(e,r){let n=e.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(e,r,...n){var s;let i=e.toLowerCase(),a=this.resolveContext(i);return new W.ParametrizedLabelResolver((s=this.defaultMessages[i])!==null&&s!==void 0?s:{},a).resolve(r,...n)}async fetchContext(e){let r=!this.cache.has(e),n;try{n=await this.cache.get(e,()=>this.messageContextProvider(this.currentUiLocale,e)),r&&await this.notify(e)}catch(s){!(s instanceof W.CanceledPromiseError)&&r&&console.error(s)}return n}subscribe(e,r){var n;return e=e.toLowerCase(),this.listeners[e]=(n=this.listeners[e])!==null&&n!==void 0?n:new Set,this.listeners[e].add(r),()=>{var s;return(s=this.listeners[e])===null||s===void 0?void 0:s.delete(r)}}async notifyAll(){let e=Object.keys(this.listeners);document.body.dispatchEvent(new Ue({loadedContexts:e})),this.dispatchEvent(new Ue({loadedContexts:e})),await Promise.all(e.map(r=>this.notify(r,!1)))}async notify(e,r=!0){r&&(document.body.dispatchEvent(new Ue({loadedContexts:[e]})),this.dispatchEvent(new Ue({loadedContexts:[e]}))),this.listeners[e]!=null&&await Promise.all([...this.listeners[e].values()].map(n=>(0,W.delay)(0).then(()=>n()).catch(()=>null)))}};us=Ci;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends Tt{constructor(){super(async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends Tt{constructor(){super(async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e))}});var cs=window.FluidTopicsI18nService,mu=window.FluidTopicsCustomI18nService;var ls=w(L()),pr=class{highlightHtml(e,r,n){(0,ls.highlightHtml)(e,r,n)}};window.FluidTopicsHighlightHtmlService=new pr;var ds=w(L());var mr=class{isDate(e){var r,n,s,i;return(i=(s=((n=(r=g.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&n!==void 0?n:[]).find(o=>o.key===e))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1}format(e,r){var n,s,i,a;if(e==null)return"";try{return ds.DateFormatter.format(e,(n=r?.locale)!==null&&n!==void 0?n:g.getState().uiLocale,(s=r?.longFormat)!==null&&s!==void 0?s:!1,(i=r?.withTime)!==null&&i!==void 0?i:!1,(a=r?.onlyTime)!==null&&a!==void 0?a:!1)}catch(o){throw console.error(`Date ${JSON.stringify(e)} is not valid`,o),o}}};window.FluidTopicsDateService=new mr;var fs=w(L());var $e=class{static get(e,r){var n,s;let i=g.getState(),{lang:a,region:o}=(s=(n=i.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&s!==void 0?s:{lang:"en",region:"US"};return new fs.SearchPlaceConverter(i.baseUrl,e??20,i.searchInAllLanguagesAllowed,r??`${a}-${o}`)}};var wt=class extends j{async sendDocumentStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.start_display event")}async sendTopicStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.start_display event")}async sendKhubSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send khub.search event")}async sendDocumentSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.search event")}async sendSearchPageSelectEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_page.select event")}async sendSearchResultOpenContextMenuEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_result.open_context_menu event")}async sendDocumentOnDemandTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.on_demand_translate event")}async sendTopicAiTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.ai_translate event")}convertMapToAnalyticsDocument(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break;default:throw new TypeError("Unknown editorial type for map : "+e.editorialType)}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}sortEventArrays(e){let r=Object.entries(e).map(([n,s])=>Array.isArray(s)?[n,s.map(i=>typeof i=="object"&&i!=null&&!Array.isArray(i)?this.sortEventArrays(i):i).sort((i,a)=>typeof i=="object"&&i!==null&&"key"in i?i.key.localeCompare(a.key):typeof i=="string"&&typeof a=="string"?i.localeCompare(a):String(i).localeCompare(String(a)))]:typeof s=="object"&&s!==null?[n,this.sortEventArrays(s)]:[n,s]);return Object.fromEntries(r)}sendEvents(e,r){let n="anything not undefined";return this.cache.get("analytics-event-"+this.hash(e),async()=>(await this.awaitApi).sendEvents(e).then(()=>n).catch(s=>(console.info(r),console.debug(s),n)),1e3)}};var yr=class{urlToSearchRequest(e){return $e.get().parse(e)}searchRequestToUrl(e){return $e.get().serialize(e)}};window.FluidTopicsUrlService=new yr;var re=w(L());var be=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{currentItem:e}})}};be.eventName="change";var vr=class{itemName(e){return`fluid-topics-history-item-${e}`}get(e){let r=sessionStorage.getItem(this.itemName(e));return r?JSON.parse(r):void 0}set(e,r){sessionStorage.setItem(this.itemName(e),JSON.stringify(r))}},hs=new vr;var Ct=class t extends re.WithEventBus{static build(){return new t(window.history,hs,()=>window.location,!1)}constructor(e,r,n,s){var i,a;super(),this.history=e,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=e.pushState,this.realReplaceState=e.replaceState,this.initialIndex=(a=(i=e.state)===null||i===void 0?void 0:i.index)!==null&&a!==void 0?a:e.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(s)}setCurrentState(e,r=!1){let n=r&&this.currentIndex===e.index-1;this.currentState={...this.buildCurrentState(),...e},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,re.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new be(this.currentItem())),0)}installProxies(){let e=r=>(n,s,[i,a,o])=>{let c=r(),l={...c===this.currentIndex?this.currentState:void 0,...i,index:c,href:typeof o=="string"?o:(o??this.windowLocation()).href};n.apply(s,[l,a,o]),this.setCurrentState(l,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:e(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:e(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",e=>this.setCurrentState(e.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(e){for(let r=this.history.length-1;r>=0;r--)e?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(e){var r;let n={...this.buildCurrentState(),...e,index:this.currentIndex,title:(r=e?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(e){this.addEventListener(be.eventName,e)}removeHistoryChangeListener(e){this.removeEventListener(be.eventName,e)}currentItem(){return(0,re.deepCopy)(this.currentState)}back(){let e=this.previousDifferentMajorPosition();e>=0?this.history.go(e-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,re.deepCopy)(this.states[this.previousDifferentMajorPosition()])}backwardItemMatching(e){let r=this.states.filter(n=>!!n).filter(n=>n.index<this.currentIndex).reverse();return(0,re.deepCopy)(r.find(n=>e(n)))}previousDifferentMajorPosition(){let e=this.currentIndex>0?this.currentIndex-1:0;for(;e>0&&!this.isDifferentMajorState(e);)e--;return e}forward(){let e=this.nextMajorPosition();e&&e<this.states.length?this.history.go(e-this.currentIndex):this.history.forward()}forwardItem(){let e=this.nextMajorPosition();if(e)return(0,re.deepCopy)(this.states[e])}nextMajorPosition(){let e=this.currentIndex;if(!(e>=this.states.length)){do e++;while(e<this.states.length&&!this.isDifferentMajorState(e));return this.getHigherPositionInTheSameState(e)}}getHigherPositionInTheSameState(e){var r;let n=(r=this.states[e])===null||r===void 0?void 0:r.majorStateId;if(!n)return e;let s=e,i=e+1;for(;this.states.length>i&&!this.isDifferentMajorState(i,n);)this.hasState(i)&&(s=i),i++;return s}buildCurrentState(){var e,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(e=this.history.state)===null||e===void 0?void 0:e.title)!==null&&r!==void 0?r:document.title}}hasState(e){return this.states[e]!=null}isDifferentMajorState(e,r){var n;if(!this.hasState(e))return!1;let s=r??this.currentState.majorStateId,i=(n=this.states[e])===null||n===void 0?void 0:n.majorStateId;return i==null||i!=s}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=Ct.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),backwardItemMatching:t=>window.FluidTopicsInternalHistoryService.backwardItemMatching(t),addHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(t),removeHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(t)});var ps=w(we());var ms=ps.css`
4
- `;var vs=w(we()),G=w(ne()),Ee=w(L());var Ae=w(L());function ys(t,e){let{authenticationRequired:r,session:n}=g.getState();return r&&!n?.sessionAuthenticated?Promise.resolve(e):t()}var Ot=class extends Ne{async updateUiLocale(e){return(await this.awaitApi).updateUiLocale(e)}};var gr=class t extends Ae.FtStateManager{static build(e){return new t(g,e)}constructor(e,r){super(),this.store=e,this.cache=new Ae.CacheRegistry,this.withManualResources=!0,this.localesConfiguration=null,this.userLocaleService=new Ot,this.cleanSessionDebouncer=new Ae.Debouncer,this.reloadDebouncer=new Ae.Debouncer(500),this.apiProvider=r??(()=>Se.get())}setWithManualResources(e){this.withManualResources=e,this.updateIfNeeded()}async initService(){this.store.addEventListener(ke.eventName,this.reloadConfiguration)}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.store.getState().session==null&&this.updateSession(),this.store.getState().metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),(this.store.getState().availableContentLocales==null||this.store.getState().availableContentLocales.length==0)&&this.updateAvailableContentLocales())}async updateSession(){let e=await this.cache.get("session",async()=>{let r=await this.apiProvider().getCurrentSession();return r.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.setSession(void 0)},r.idleTimeoutInMillis),r});this.setSession(e)}async updateMetadataConfiguration(){this.setMetadataConfiguration(await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration()))}async updateLocalesConfiguration(){this.setLocalesConfiguration(await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration()))}async updateAvailableContentLocales(){var e;let r=await this.cache.get("availableContentLocales",()=>ys(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}));this.setAvailableContentLocales((e=r.contentLocales)!==null&&e!==void 0?e:[])}reloadConfiguration(){var e;(e=this.cache)===null||e===void 0||e.clear("availableContentLocales"),typeof this.updateAvailableContentLocales=="function"&&this.updateAvailableContentLocales()}setBaseUrl(e){this.store.actions.baseUrl(e),window.fluidTopicsBaseUrl=e}setApiIntegrationIdentifier(e){this.store.actions.apiIntegrationIdentifier(e)}setApiIntegrationAppVersion(e){this.store.actions.apiIntegrationAppVersion(e)}setUiLocale(e){this.store.actions.uiLocale(e)}setLocalesConfiguration(e){var r,n,s,i,a;this.localesConfiguration=e,this.store.actions.defaultLocales(this.localesConfiguration.defaultLocales),this.store.actions.availableUiLocales((r=this.localesConfiguration.availableUiLocales)!==null&&r!==void 0?r:[]),this.store.actions.searchInAllLanguagesAllowed((n=this.localesConfiguration.allLanguagesAllowed)!==null&&n!==void 0?n:!1),this.store.actions.searchLanguageSetsUiLanguage((s=this.localesConfiguration.searchLanguageSetsUiLanguage)!==null&&s!==void 0?s:!1),this.store.actions.uiLanguageSetsSearchLanguage((i=this.localesConfiguration.uiLanguageSetsSearchLanguage)!==null&&i!==void 0?i:!1),this.store.actions.uiLanguageSetsReaderLanguage((a=this.localesConfiguration.uiLanguageSetsReaderLanguage)!==null&&a!==void 0?a:!1),setTimeout(()=>this.updateIfNeeded())}setAvailableContentLocales(e){this.store.actions.availableContentLocales(e),setTimeout(()=>this.updateIfNeeded())}stopReloadDebouncer(){this.reloadDebouncer.cancel()}requestUiLocaleUpdate(e){this.userLocaleService.updateUiLocale({uiLocale:e}).then(r=>{r.uiLocaleChanged&&(this.reloadDebouncer.run(()=>window.location.reload()),this.store.dispatchEvent(new ze(r)))}).catch(()=>{})}setMetadataConfiguration(e){this.store.actions.metadataConfiguration(e),setTimeout(()=>this.updateIfNeeded())}setNoCustom(e){this.store.actions.noCustom(e)}setEditorMode(e){this.store.actions.editorMode(e)}setNoCustomComponent(e){this.store.actions.noCustomComponent(e)}setSession(e){this.store.actions.session(e),setTimeout(()=>this.updateIfNeeded())}setOpenExternalDocumentInNewTab(e){this.store.actions.openExternalDocumentInNewTab(e)}setNavigatorOnline(e){this.store.actions.navigatorOnline(e)}setForcedOffline(e){this.store.actions.forcedOffline(e)}setAuthenticationRequired(e){this.store.actions.authenticationRequired(e)}},We=gr.build();var B=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},M=class extends Ee.FtLitElementRedux{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.apiIntegrationAppVersion="ft-integration-app-version",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.authenticationRequired=!1,this.messageContexts=[],this.stateManager=We}render(){return vs.html`
1
+ "use strict";(()=>{var fs=Object.create;var dr=Object.defineProperty;var ps=Object.getOwnPropertyDescriptor;var hs=Object.getOwnPropertyNames;var ms=Object.getPrototypeOf,ys=Object.prototype.hasOwnProperty;var bt=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}};var vs=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of hs(e))!ys.call(t,s)&&s!==r&&dr(t,s,{get:()=>e[s],enumerable:!(n=ps(e,s))||n.enumerable});return t};var A=(t,e,r)=>(r=t!=null?fs(ms(t)):{},vs(e||!t||!t.__esModule?dr(r,"default",{value:t,enumerable:!0}):r,t));var w=bt((yi,fr)=>{fr.exports=ftGlobals.wcUtils});var pe=bt((vi,pr)=>{pr.exports=ftGlobals.lit});var Y=bt((gi,hr)=>{hr.exports=ftGlobals.litDecorators});var ds=A(w());var cs=A(pe()),G=A(Y()),k=A(w());var mr=A(pe());var yr=mr.css`
2
+ `;var xe=A(w()),or=A(Y());var Ie;(function(t){t.CLUSTERED_SEARCH="CLUSTERED_SEARCH"})(Ie||(Ie={}));var R=A(w());var vr=A(w()),gs={setRequest:(t,e)=>{t.request=e.payload}},gr=t=>vr.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",clusterSortCriterions:[],metadataFilters:[],facets:[],sort:[],sortId:void 0,paging:{page:1,perPage:20},keywordMatch:void 0},liveQuery:"",paging:void 0,facets:void 0,spellcheck:void 0,locales:[],results:void 0,announcements:void 0,suggestResults:void 0,configuration:void 0},reducers:gs});var Sr;(function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"})(Sr||(Sr={}));var Ar;(function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"})(Ar||(Ar={}));var Er;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(Er||(Er={}));var X;(function(t){t.STRUCTURED_DOCUMENT="STRUCTURED_DOCUMENT",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT",t.SHARED_PERSONAL_BOOK="SHARED_PERSONAL_BOOK",t.PERSONAL_BOOK="PERSONAL_BOOK",t.ATTACHMENT="ATTACHMENT",t.RESOURCE="RESOURCE",t.HTML_PACKAGE="HTML_PACKAGE"})(X||(X={}));var br;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(br||(br={}));var Cr;(function(t){t.VALUE="VALUE",t.DATE="DATE",t.RANGE="RANGE"})(Cr||(Cr={}));var Tr;(function(t){t.OFFICIAL="OFFICIAL",t.AI="AI"})(Tr||(Tr={}));var ne;(function(t){t.BOOKMARK__CREATE="BOOKMARK__CREATE",t.BOOKMARK__DELETE="BOOKMARK__DELETE",t.CASE_DEFLECTION__START="CASE_DEFLECTION__START",t.CASE_DEFLECTION__OPEN_TICKET="CASE_DEFLECTION__OPEN_TICKET",t.CASE_DEFLECTION__RATE="CASE_DEFLECTION__RATE",t.CHATBOT__RATE="CHATBOT__RATE",t.COLLECTION__CREATE="COLLECTION__CREATE",t.COLLECTION__UPDATE="COLLECTION__UPDATE",t.COLLECTION__DELETE="COLLECTION__DELETE",t.CUSTOM_EVENT__TRIGGER="CUSTOM_EVENT__TRIGGER",t.DOCUMENT__ON_DEMAND_TRANSLATE="DOCUMENT__ON_DEMAND_TRANSLATE",t.DOCUMENT__DOWNLOAD="DOCUMENT__DOWNLOAD",t.DOCUMENT__PRINT="DOCUMENT__PRINT",t.DOCUMENT__PROCESS="DOCUMENT__PROCESS",t.DOCUMENT__RATE="DOCUMENT__RATE",t.DOCUMENT__SEARCH="DOCUMENT__SEARCH",t.DOCUMENT__START_DISPLAY="DOCUMENT__START_DISPLAY",t.DOCUMENT__UNRATE="DOCUMENT__UNRATE",t.FEEDBACK__SEND="FEEDBACK__SEND",t.AI__COMPLETED_QUERY="AI__COMPLETED_QUERY",t.AI__RATE="AI__RATE",t.AI_CASE_DEFLECTION__START="AI_CASE_DEFLECTION__START",t.AI_CASE_DEFLECTION__OPEN_TICKET="AI_CASE_DEFLECTION__OPEN_TICKET",t.KHUB__PROCESS="KHUB__PROCESS",t.KHUB__SEARCH="KHUB__SEARCH",t.LABELS__DOWNLOAD="LABELS__DOWNLOAD",t.LINK__SHARE="LINK__SHARE",t.PAGE__DISPLAY="PAGE__DISPLAY",t.PERSONAL_BOOK__CREATE="PERSONAL_BOOK__CREATE",t.PERSONAL_BOOK__DELETE="PERSONAL_BOOK__DELETE",t.PERSONAL_BOOK__UPDATE="PERSONAL_BOOK__UPDATE",t.PERSONAL_TOPIC__CREATE="PERSONAL_TOPIC__CREATE",t.PERSONAL_TOPIC__UPDATE="PERSONAL_TOPIC__UPDATE",t.PERSONAL_TOPIC__DELETE="PERSONAL_TOPIC__DELETE",t.SAVED_SEARCH__CREATE="SAVED_SEARCH__CREATE",t.SAVED_SEARCH__DELETE="SAVED_SEARCH__DELETE",t.SAVED_SEARCH__UPDATE="SAVED_SEARCH__UPDATE",t.SEARCH_PAGE__SELECT="SEARCH_PAGE__SELECT",t.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU="SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU",t.TOPIC__AI_TRANSLATE="TOPIC__AI_TRANSLATE",t.TOPIC__RATE="TOPIC__RATE",t.TOPIC__START_DISPLAY="TOPIC__START_DISPLAY",t.TOPIC__UNRATE="TOPIC__UNRATE",t.USER__LOGIN="USER__LOGIN",t.USER__LOGOUT="USER__LOGOUT",t.HEARTBEAT="HEARTBEAT"})(ne||(ne={}));var Or;(function(t){t.STANDARD="STANDARD",t.STRUCTURAL="STRUCTURAL"})(Or||(Or={}));var xr;(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"})(xr||(xr={}));var wr;(function(t){t.HOMEPAGE="HOMEPAGE",t.CUSTOM="CUSTOM",t.HEADER="HEADER",t.READER="READER",t.TOPIC_TEMPLATE="TOPIC_TEMPLATE",t.SEARCH="SEARCH",t.SEARCH_RESULT="SEARCH_RESULT",t.SEARCH_ANNOUNCEMENT="SEARCH_ANNOUNCEMENT",t.LINK_PREVIEW="LINK_PREVIEW",t.UD_VIEWER="UD_VIEWER",t.ASSET_VIEWER="ASSET_VIEWER"})(wr||(wr={}));var Rr;(function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"})(Rr||(Rr={}));var _r;(function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"})(_r||(_r={}));var Ir;(function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"})(Ir||(Ir={}));var Mr;(function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"})(Mr||(Mr={}));var Dr;(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"})(Dr||(Dr={}));var He;(function(t){t.OPTIONAL="OPTIONAL",t.MANDATORY="MANDATORY"})(He||(He={}));var Lr;(function(t){t.ASC="ASC",t.DESC="DESC"})(Lr||(Lr={}));var kr;(function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"})(kr||(kr={}));var he;(function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"})(he||(he={}));var Pr;(function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(Pr||(Pr={}));var Nr;(function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"})(Nr||(Nr={}));var Fr;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK",t.HTML_PACKAGE="HTML_PACKAGE"})(Fr||(Fr={}));var Ur;(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR"})(Ur||(Ur={}));var H;(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.HTML_PACKAGE="HTML_PACKAGE",t.HTML_PACKAGE_PAGE="HTML_PACKAGE_PAGE"})(H||(H={}));var me;(function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS",t.TOPICS_AND_UNSTRUCTURED_DOCUMENTS="TOPICS_AND_UNSTRUCTURED_DOCUMENTS"})(me||(me={}));var jr;(function(t){t.PLAIN_TEXT="PLAIN_TEXT",t.LOCALIZED_OFFICIAL="LOCALIZED_OFFICIAL",t.LOCALIZED_CUSTOM="LOCALIZED_CUSTOM"})(jr||(jr={}));var x;(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.GENERATIVE_AI_EXPORT_USER="GENERATIVE_AI_EXPORT_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.BEHAVIOR_DATA_USER="BEHAVIOR_DATA_USER",t.ANNOUNCEMENT_ADMIN="ANNOUNCEMENT_ADMIN",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN"})(x||(x={}));var F;(function(t){t.SEARCHES="SEARCHES",t.BOOKMARKS="BOOKMARKS",t.BOOKS="BOOKS",t.COLLECTIONS="COLLECTIONS"})(F||(F={}));var Br;(function(t){t.UNAUTHENTICATED="UNAUTHENTICATED",t.USER_INCOMPLETE="USER_INCOMPLETE",t.MFA_REQUIRED="MFA_REQUIRED",t.AUTHENTICATED="AUTHENTICATED"})(Br||(Br={}));var qr;(function(t){t.VALID="VALID",t.INVALID="INVALID"})(qr||(qr={}));var Hr;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",t.SUMMARY="SUMMARY",t.SEMANTIC_SEARCH="SEMANTIC_SEARCH",t.CHATBOT_INSTRUCTIONS="CHATBOT_INSTRUCTIONS",t.OTHER="OTHER"})(Hr||(Hr={}));var Vr;(function(t){t.INACCURATE="INACCURATE",t.INCOMPLETE="INCOMPLETE",t.OFF_TOPIC="OFF_TOPIC",t.IRRELEVANT_SOURCES="IRRELEVANT_SOURCES",t.SLOW="SLOW",t.OTHER="OTHER"})(Vr||(Vr={}));var Kr;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(Kr||(Kr={}));var Gr;(function(t){t.JSON="JSON",t.TEXT="TEXT"})(Gr||(Gr={}));var zr;(function(t){t.USER="USER",t.ASSISTANT="ASSISTANT"})(zr||(zr={}));var $r;(function(t){t.TEXT="TEXT",t.HTML="HTML"})($r||($r={}));var Wr;(function(t){t.HTML="HTML",t.MARKDOWN="MARKDOWN"})(Wr||(Wr={}));var Qr;(function(t){t.MAP="MAP",t.UNSTRUCTURED_DOCUMENT="UNSTRUCTURED_DOCUMENT"})(Qr||(Qr={}));var Ss={[x.PERSONAL_BOOK_SHARE_USER]:[x.PERSONAL_BOOK_USER],[x.HTML_EXPORT_USER]:[x.PERSONAL_BOOK_USER],[x.PDF_EXPORT_USER]:[x.PERSONAL_BOOK_USER],[x.KHUB_ADMIN]:[x.CONTENT_PUBLISHER],[x.ADMIN]:[x.KHUB_ADMIN,x.USERS_ADMIN,x.PORTAL_ADMIN,x.BEHAVIOR_DATA_USER],[x.GENERATIVE_AI_EXPORT_USER]:[x.GENERATIVE_AI_USER]};function Yr(t,e){return t===e||(Ss[t]??[]).some(r=>Yr(r,e))}function Xr(t,e){return t==null?!1:(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some(n=>Yr(n,e))}var Wt=A(Y());var Jr=A(Y(),1);var Ct=t=>e=>{window.customElements.get(t)||window.customElements.define(t,e)};function Zr(t,e){return(0,Jr.property)({type:Object,converter:{fromAttribute:r=>{if(r==null)return Me(t);try{return JSON.parse(r)}catch{return Me(t)}},toAttribute:r=>JSON.stringify(r)},hasChanged:De,...e??{}})}function As(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let r,n;if(Array.isArray(t)){if(r=t.length,r!=e.length)return!1;for(n=r;n--!==0;)if(!Ve(t[n],e[n]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;for(n of t.entries())if(!Ve(n[1],e.get(n[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(n of t.entries())if(!e.has(n[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();let s=a=>Object.keys(a).filter(o=>a[o]!=null),i=s(t);if(r=i.length,r!==s(e).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[n]))return!1;for(n=r;n--!==0;){let a=i[n];if(!Ve(t[a],e[a]))return!1}return!0}return t!==t&&e!==e||t==null&&e==null}function Ve(t,e){try{return As(t,e)}catch{return!1}}function De(t,e){return!Ve(t,e)}function Me(t){return typeof window.structuredClone=="function"?structuredClone(t):t!=null?JSON.parse(JSON.stringify(t)):t}function Ke(t,e){let r=n=>n[t]===!0;return n=>{if(r(n))return n;let s=e(n);return s[t]=!0,s}}var en=A(Y(),1);var Tt=t=>{let e=t??{};return(r,n)=>{var s;let i={hasChanged:De,attribute:!1,...e};(0,en.property)(i)(r,n);let a=r.constructor;a.reduxProperties=new Map(a.reduxProperties),a.reduxProperties.set(n,{selector:(s=e.selector)!==null&&s!==void 0?s:(o=>o[n]),store:e.store})}};var Ge=class{constructor(){this.queue=[]}add(e,r=!1){r&&this.clear(e.type),this.queue.push(e)}consume(e){let r=this.queue.find(n=>n.type===e);return r&&(this.queue=this.queue.filter(n=>n!==r)),r}clear(e){typeof e=="string"?this.queue=this.queue.filter(r=>r.type!==e):this.queue=this.queue.filter(r=>!e.test(r.type))}};var se=A(Y(),1);var ze=class{constructor(e=0){this.timeout=e,this.callbacks=[]}run(e,r){return this.callbacks=[e],this.debounce(r)}queue(e,r){return this.callbacks.push(e),this.debounce(r)}cancel(){this.clearTimeout(),this.resolvePromise&&this.resolvePromise(!1),this.clearPromise()}debounce(e){return this.promise==null&&(this.promise=new Promise((r,n)=>{this.resolvePromise=r,this.rejectPromise=n})),this.clearTimeout(),this._debounce=window.setTimeout(()=>this.runCallbacks(),e??this.timeout),this.promise}async runCallbacks(){var e,r;let n=[...this.callbacks];this.callbacks=[];let s=(e=this.rejectPromise)!==null&&e!==void 0?e:(()=>null),i=(r=this.resolvePromise)!==null&&r!==void 0?r:(()=>null);this.clearPromise();for(let a of n)try{await a()}catch(o){s(o);return}i(!0)}clearTimeout(){this._debounce!=null&&window.clearTimeout(this._debounce)}clearPromise(){this.promise=void 0,this.resolvePromise=void 0,this.rejectPromise=void 0}};var rn=A(pe(),1);var $e=globalThis,Es=$e.ShadowRoot&&($e.ShadyCSS===void 0||$e.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;var tn=(t,e)=>{if(Es)t.adoptedStyleSheets=e.map((r=>r instanceof CSSStyleSheet?r:r.styleSheet));else for(let r of e){let n=document.createElement("style"),s=$e.litNonce;s!==void 0&&n.setAttribute("nonce",s),n.textContent=r.cssText,t.appendChild(n)}};var We=class extends rn.LitElement{get scopedRegistryConstructor(){return this.constructor}createRenderRoot(){let e=this.scopedRegistryConstructor;e.elementDefinitions&&!e.registry&&(e.registry=new CustomElementRegistry,e.defineScopedElements(e.elementDefinitions));let r={...e.shadowRootOptions,customElements:e.registry},n=this.renderOptions.creationScope=this.attachShadow(r);return tn(n,e.elementStyles),n}static canDefineScopedElement(e){return!!this.registry&&!this.registry.get(e)}static defineScopedElements(e){Object.entries(e).forEach(([r,n])=>this.defineScopedElement(r,n))}static defineScopedElement(e,r){Ct(e)(r),this.canDefineScopedElement(e)&&this.registry.define(e,r)}canDefineScopedElement(e){return this.scopedRegistryConstructor.canDefineScopedElement(e)}defineScopedElements(e){this.scopedRegistryConstructor.defineScopedElements(e)}defineScopedElement(e,r){this.scopedRegistryConstructor.defineScopedElement(e,r)}};function nn(t,e,...r){var n;let s=t.querySelector(e);for(let i of r)s=(n=s?.shadowRoot)===null||n===void 0?void 0:n.querySelector(i);return s}var ve=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},un,sn=Symbol("constructorPrototype"),an=Symbol("constructorName"),cn=Symbol("exportpartsDebouncer"),on=Symbol("dynamicDependenciesLoaded"),ye=class t extends CustomEvent{constructor(){super(t.eventName,{bubbles:!0})}};ye.eventName="exportparts-updated";var V=class extends We{constructor(){super(),this.useAdoptedStyleSheets=!0,this.adoptedCustomStyleSheet=new CSSStyleSheet,this[un]=new ze(5),this.scheduleExportpartsUpdate=()=>{var e,r,n;(!((e=this.exportpartsPrefix)===null||e===void 0)&&e.trim()||(n=(r=this.exportpartsPrefixes)===null||r===void 0?void 0:r.length)!==null&&n!==void 0&&n)&&this[cn].run(()=>{var s,i;!((s=this.exportpartsPrefix)===null||s===void 0)&&s.trim()?this.setExportpartsAttribute([this.exportpartsPrefix]):this.exportpartsPrefixes!=null&&((i=this.exportpartsPrefixes)===null||i===void 0?void 0:i.length)>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)})},this[an]=this.constructor.name,this[sn]=this.constructor.prototype}adoptedCallback(){this.constructor.name!==this[an]&&Object.setPrototypeOf(this,this[sn])}connectedCallback(){var e;super.connectedCallback();try{this.shadowRoot&&!this.shadowRoot.adoptedStyleSheets.includes(this.adoptedCustomStyleSheet)&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,this.adoptedCustomStyleSheet]),this.useAdoptedStyleSheets=!0}catch(n){this.useAdoptedStyleSheets=!1,console.error("Cannot use adopted stylesheets",n)}let r=this.constructor;r[on]||(r[on]=!0,this.importDynamicDependencies()),(e=this.shadowRoot)===null||e===void 0||e.addEventListener(ye.eventName,this.scheduleExportpartsUpdate)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this.shadowRoot)===null||e===void 0||e.removeEventListener(ye.eventName,this.scheduleExportpartsUpdate)}importDynamicDependencies(){}updated(e){super.updated(e),this.updateComplete.then(()=>{this.contentAvailableCallback(e),this.focusElementToFocus(e),this.applyCustomStylesheet(e),this.scheduleExportpartsUpdate(),e.has("exportparts")&&this.dispatchEvent(new ye)})}contentAvailableCallback(e){}focusElementToFocus(e){if(e.has("elementToFocus")&&this.elementToFocus!=null){let{element:r,selector:n,shadowPath:s}=this.elementToFocus;if(n!=null){let i=[...s??[],n];r=nn(this.shadowRoot,...i)}r?.focus(),window.FluidTopicsA11yHints.isKeyboardNavigation||r?.blur(),this.elementToFocus=void 0}}applyCustomStylesheet(e){var r,n,s;if(((n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll(".ft-lit-element--custom-stylesheet"))!==null&&n!==void 0?n:[]).forEach(i=>i.remove()),this.useAdoptedStyleSheets){if(e.has("customStylesheet"))try{this.adoptedCustomStyleSheet.replaceSync((s=this.customStylesheet)!==null&&s!==void 0?s:"")}catch(i){console.error(i,this.customStylesheet),this.useAdoptedStyleSheets=!1}}else if(this.customStylesheet){let i=document.createElement("style");i.classList.add("ft-lit-element--custom-stylesheet"),i.innerHTML=this.customStylesheet,this.shadowRoot.append(i)}}setExportpartsAttribute(e){var r,n,s,i,a,o;let c=d=>d!=null&&d.trim().length>0,u=e.filter(c).map(d=>d.trim());if(u.length===0){this.exportparts=void 0;return}let l=new Set;for(let d of(n=(r=this.shadowRoot)===null||r===void 0?void 0:r.querySelectorAll("[part],[exportparts]"))!==null&&n!==void 0?n:[]){let m=(i=(s=d.getAttribute("part"))===null||s===void 0?void 0:s.split(" "))!==null&&i!==void 0?i:[],p=(o=(a=d.getAttribute("exportparts"))===null||a===void 0?void 0:a.split(",").map(v=>v.split(":")[1]))!==null&&o!==void 0?o:[],h=[...m,...p].filter(c).map(v=>v.trim());for(let v of h)l.add(v)}if(l.size===0){this.exportparts=void 0;return}let f=[...l.values()].flatMap(d=>u.map(m=>`${d}:${m}--${d}`));this.exportparts=[...this.part,...f].join(", ")}};un=cn;ve([(0,se.property)()],V.prototype,"exportpartsPrefix",void 0);ve([Zr([])],V.prototype,"exportpartsPrefixes",void 0);ve([(0,se.property)({reflect:!0})],V.prototype,"exportparts",void 0);ve([(0,se.property)()],V.prototype,"customStylesheet",void 0);ve([(0,se.property)()],V.prototype,"elementToFocus",void 0);ve([(0,se.state)()],V.prototype,"useAdoptedStyleSheets",void 0);function Qe(t){var e;return(e=t?.isFtReduxStore)!==null&&e!==void 0?e:!1}var Le=Symbol("internalReduxEventsUnsubscribers"),J=Symbol("internalStoresUnsubscribers"),ie=Symbol("internalStores"),bs=Ke(Symbol("withRedux"),function(t){var e,r,n;class s extends t{constructor(){super(...arguments),this[e]=new Map,this[r]=new Map,this[n]=new Map}get reduxConstructor(){return this.constructor}willUpdate(a){super.willUpdate(a),[...this.reduxConstructor.reduxReactiveProperties].some(o=>a.has(o))&&this.updateFromStores()}getUnnamedStore(){if(this[ie].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[ie].values()][0]}getStore(a){return a==null?this.getUnnamedStore():this[ie].get(a)}addStore(a,o){var c;o=(c=o??a.name)!==null&&c!==void 0?c:"default-store",this.unsubscribeFromStore(o),this[ie].set(o,a),this.subscribeToStore(o,a),this.updateFromStores()}removeStore(a){let o=typeof a=="string"?a:a.name;this.unsubscribeFromStore(o),this[ie].delete(o)}setupStores(){this.unsubscribeFromStores(),this[ie].forEach((a,o)=>this.subscribeToStore(o,a)),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach((a,o)=>{let c=this.constructor.getPropertyOptions(o);if(!c?.attribute||!this.hasAttribute(typeof c?.attribute=="string"?c.attribute:o)){let u=this.getStore(a.store);u&&(a.store?this[J].has(a.store):this[J].size>0)&&(this[o]=a.selector(u.getState(),this))}})}subscribeToStore(a,o){var c;this[J].set(a,o.subscribe(()=>this.updateFromStores())),this[Le].set(a,[]),Qe(o)&&o.eventBus&&((c=this.reduxConstructor.reduxEventListeners)===null||c===void 0||c.forEach((u,l)=>{if(typeof this[l]=="function"&&(!u.store||o.name===u.store)){let f=d=>this[l](d);o.addEventListener(u.eventName,f),this[Le].get(a).push(()=>o.removeEventListener(u.eventName,f))}})),this.onStoreAvailable(a)}unsubscribeFromStores(){this[J].forEach((a,o)=>this.unsubscribeFromStore(o))}unsubscribeFromStore(a){var o;this[J].has(a)&&this[J].get(a)(),this[J].delete(a),(o=this[Le].get(a))===null||o===void 0||o.forEach(c=>c()),this[Le].delete(a)}onStoreAvailable(a){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}return e=J,r=ie,n=Le,s.reduxProperties=new Map,s.reduxReactiveProperties=new Set,s.reduxEventListeners=new Map,s}),ln=class extends bs(V){};function U(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];if(0)var s,i;throw Error("[Immer] minified error nr: "+t+(r.length?" "+r.map((function(a){return"'"+a+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function $(t){return!!t&&!!t[C]}function q(t){var e;return!!t&&((function(r){if(!r||typeof r!="object")return!1;var n=Object.getPrototypeOf(r);if(n===null)return!0;var s=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;return s===Object||typeof s=="function"&&Function.toString.call(s)===Is})(t)||Array.isArray(t)||!!t[vn]||!!(!((e=t.constructor)===null||e===void 0)&&e[vn])||Lt(t)||kt(t))}function ae(t,e,r){r===void 0&&(r=!1),Ae(t)===0?(r?Object.keys:Se)(t).forEach((function(n){r&&typeof n=="symbol"||e(n,t[n],t)})):t.forEach((function(n,s){return e(s,n,t)}))}function Ae(t){var e=t[C];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:Lt(t)?2:kt(t)?3:0}function ge(t,e){return Ae(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Cs(t,e){return Ae(t)===2?t.get(e):t[e]}function gn(t,e,r){var n=Ae(t);n===2?t.set(e,r):n===3?t.add(r):t[e]=r}function Sn(t,e){return t===e?t!==0||1/t==1/e:t!=t&&e!=e}function Lt(t){return Rs&&t instanceof Map}function kt(t){return _s&&t instanceof Set}function Z(t){return t.o||t.t}function Pt(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=bn(t);delete e[C];for(var r=Se(e),n=0;n<r.length;n++){var s=r[n],i=e[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(e[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:t[s]})}return Object.create(Object.getPrototypeOf(t),e)}function Nt(t,e){return e===void 0&&(e=!1),Ft(t)||$(t)||!q(t)||(Ae(t)>1&&(t.set=t.add=t.clear=t.delete=Ts),Object.freeze(t),e&&ae(t,(function(r,n){return Nt(n,!0)}),!0)),t}function Ts(){U(2)}function Ft(t){return t==null||typeof t!="object"||Object.isFrozen(t)}function K(t){var e=Dt[t];return e||U(18,t),e}function Os(t,e){Dt[t]||(Dt[t]=e)}function _t(){return Pe}function Ot(t,e){e&&(K("Patches"),t.u=[],t.s=[],t.v=e)}function Ye(t){It(t),t.p.forEach(xs),t.p=null}function It(t){t===Pe&&(Pe=t.l)}function dn(t){return Pe={p:[],l:Pe,h:t,m:!0,_:0}}function xs(t){var e=t[C];e.i===0||e.i===1?e.j():e.g=!0}function xt(t,e){e._=e.p.length;var r=e.p[0],n=t!==void 0&&t!==r;return e.h.O||K("ES5").S(e,t,n),n?(r[C].P&&(Ye(e),U(4)),q(t)&&(t=Xe(e,t),e.l||Je(e,t)),e.u&&K("Patches").M(r[C].t,t,e.u,e.s)):t=Xe(e,r,[]),Ye(e),e.u&&e.v(e.u,e.s),t!==En?t:void 0}function Xe(t,e,r){if(Ft(e))return e;var n=e[C];if(!n)return ae(e,(function(o,c){return fn(t,n,e,o,c,r)}),!0),e;if(n.A!==t)return e;if(!n.P)return Je(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var s=n.i===4||n.i===5?n.o=Pt(n.k):n.o,i=s,a=!1;n.i===3&&(i=new Set(s),s.clear(),a=!0),ae(i,(function(o,c){return fn(t,n,s,o,c,r,a)})),Je(t,s,!1),r&&t.u&&K("Patches").N(n,r,t.u,t.s)}return n.o}function fn(t,e,r,n,s,i,a){if($(s)){var o=Xe(t,s,i&&e&&e.i!==3&&!ge(e.R,n)?i.concat(n):void 0);if(gn(r,n,o),!$(o))return;t.m=!1}else a&&r.add(s);if(q(s)&&!Ft(s)){if(!t.h.D&&t._<1)return;Xe(t,s),e&&e.A.l||Je(t,s)}}function Je(t,e,r){r===void 0&&(r=!1),!t.l&&t.h.D&&t.m&&Nt(e,r)}function wt(t,e){var r=t[C];return(r?Z(r):t)[e]}function pn(t,e){if(e in t)for(var r=Object.getPrototypeOf(t);r;){var n=Object.getOwnPropertyDescriptor(r,e);if(n)return n;r=Object.getPrototypeOf(r)}}function ee(t){t.P||(t.P=!0,t.l&&ee(t.l))}function Rt(t){t.o||(t.o=Pt(t.t))}function Mt(t,e,r){var n=Lt(e)?K("MapSet").F(e,r):kt(e)?K("MapSet").T(e,r):t.O?(function(s,i){var a=Array.isArray(s),o={i:a?1:0,A:i?i.A:_t(),P:!1,I:!1,R:{},l:i,t:s,k:null,o:null,j:null,C:!1},c=o,u=Ne;a&&(c=[o],u=ke);var l=Proxy.revocable(c,u),f=l.revoke,d=l.proxy;return o.k=d,o.j=f,d})(e,r):K("ES5").J(e,r);return(r?r.A:_t()).p.push(n),n}function ws(t){return $(t)||U(22,t),(function e(r){if(!q(r))return r;var n,s=r[C],i=Ae(r);if(s){if(!s.P&&(s.i<4||!K("ES5").K(s)))return s.t;s.I=!0,n=hn(r,i),s.I=!1}else n=hn(r,i);return ae(n,(function(a,o){s&&Cs(s.t,a)===o||gn(n,a,e(o))})),i===3?new Set(n):n})(t)}function hn(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Pt(t)}function An(){function t(a,o){var c=i[a];return c?c.enumerable=o:i[a]=c={configurable:!0,enumerable:o,get:function(){var u=this[C];return Ne.get(u,a)},set:function(u){var l=this[C];Ne.set(l,a,u)}},c}function e(a){for(var o=a.length-1;o>=0;o--){var c=a[o][C];if(!c.P)switch(c.i){case 5:n(c)&&ee(c);break;case 4:r(c)&&ee(c)}}}function r(a){for(var o=a.t,c=a.k,u=Se(c),l=u.length-1;l>=0;l--){var f=u[l];if(f!==C){var d=o[f];if(d===void 0&&!ge(o,f))return!0;var m=c[f],p=m&&m[C];if(p?p.t!==d:!Sn(m,d))return!0}}var h=!!o[C];return u.length!==Se(o).length+(h?0:1)}function n(a){var o=a.k;if(o.length!==a.t.length)return!0;var c=Object.getOwnPropertyDescriptor(o,o.length-1);if(c&&!c.get)return!0;for(var u=0;u<o.length;u++)if(!o.hasOwnProperty(u))return!0;return!1}function s(a){a.g&&U(3,JSON.stringify(Z(a)))}var i={};Os("ES5",{J:function(a,o){var c=Array.isArray(a),u=(function(f,d){if(f){for(var m=Array(d.length),p=0;p<d.length;p++)Object.defineProperty(m,""+p,t(p,!0));return m}var h=bn(d);delete h[C];for(var v=Se(h),g=0;g<v.length;g++){var S=v[g];h[S]=t(S,f||!!h[S].enumerable)}return Object.create(Object.getPrototypeOf(d),h)})(c,a),l={i:c?5:4,A:o?o.A:_t(),P:!1,I:!1,R:{},l:o,t:a,k:u,o:null,g:!1,C:!1};return Object.defineProperty(u,C,{value:l,writable:!0}),u},S:function(a,o,c){c?$(o)&&o[C].A===a&&e(a.p):(a.u&&(function u(l){if(l&&typeof l=="object"){var f=l[C];if(f){var d=f.t,m=f.k,p=f.R,h=f.i;if(h===4)ae(m,(function(E){E!==C&&(d[E]!==void 0||ge(d,E)?p[E]||u(m[E]):(p[E]=!0,ee(f)))})),ae(d,(function(E){m[E]!==void 0||ge(m,E)||(p[E]=!1,ee(f))}));else if(h===5){if(n(f)&&(ee(f),p.length=!0),m.length<d.length)for(var v=m.length;v<d.length;v++)p[v]=!1;else for(var g=d.length;g<m.length;g++)p[g]=!0;for(var S=Math.min(m.length,d.length),T=0;T<S;T++)m.hasOwnProperty(T)||(p[T]=!0),p[T]===void 0&&u(m[T])}}}})(a.p[0]),e(a.p))},K:function(a){return a.i===4?r(a):n(a)}})}var mn,Pe,Ut=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",Rs=typeof Map<"u",_s=typeof Set<"u",yn=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",En=Ut?Symbol.for("immer-nothing"):((mn={})["immer-nothing"]=!0,mn),vn=Ut?Symbol.for("immer-draftable"):"__$immer_draftable",C=Ut?Symbol.for("immer-state"):"__$immer_state";var Is=""+Object.prototype.constructor,Se=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,bn=Object.getOwnPropertyDescriptors||function(t){var e={};return Se(t).forEach((function(r){e[r]=Object.getOwnPropertyDescriptor(t,r)})),e},Dt={},Ne={get:function(t,e){if(e===C)return t;var r=Z(t);if(!ge(r,e))return(function(s,i,a){var o,c=pn(i,a);return c?"value"in c?c.value:(o=c.get)===null||o===void 0?void 0:o.call(s.k):void 0})(t,r,e);var n=r[e];return t.I||!q(n)?n:n===wt(t.t,e)?(Rt(t),t.o[e]=Mt(t.A.h,n,t)):n},has:function(t,e){return e in Z(t)},ownKeys:function(t){return Reflect.ownKeys(Z(t))},set:function(t,e,r){var n=pn(Z(t),e);if(n?.set)return n.set.call(t.k,r),!0;if(!t.P){var s=wt(Z(t),e),i=s?.[C];if(i&&i.t===r)return t.o[e]=r,t.R[e]=!1,!0;if(Sn(r,s)&&(r!==void 0||ge(t.t,e)))return!0;Rt(t),ee(t)}return t.o[e]===r&&(r!==void 0||e in t.o)||Number.isNaN(r)&&Number.isNaN(t.o[e])||(t.o[e]=r,t.R[e]=!0),!0},deleteProperty:function(t,e){return wt(t.t,e)!==void 0||e in t.t?(t.R[e]=!1,Rt(t),ee(t)):delete t.R[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var r=Z(t),n=Reflect.getOwnPropertyDescriptor(r,e);return n&&{writable:!0,configurable:t.i!==1||e!=="length",enumerable:n.enumerable,value:r[e]}},defineProperty:function(){U(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){U(12)}},ke={};ae(Ne,(function(t,e){ke[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),ke.deleteProperty=function(t,e){return ke.set.call(this,t,e,void 0)},ke.set=function(t,e,r){return Ne.set.call(this,t[0],e,r,t[0])};var Ms=(function(){function t(r){var n=this;this.O=yn,this.D=!0,this.produce=function(s,i,a){if(typeof s=="function"&&typeof i!="function"){var o=i;i=s;var c=n;return function(h){var v=this;h===void 0&&(h=o);for(var g=arguments.length,S=Array(g>1?g-1:0),T=1;T<g;T++)S[T-1]=arguments[T];return c.produce(h,(function(E){var Q;return(Q=i).call.apply(Q,[v,E].concat(S))}))}}var u;if(typeof i!="function"&&U(6),a!==void 0&&typeof a!="function"&&U(7),q(s)){var l=dn(n),f=Mt(n,s,void 0),d=!0;try{u=i(f),d=!1}finally{d?Ye(l):It(l)}return typeof Promise<"u"&&u instanceof Promise?u.then((function(h){return Ot(l,a),xt(h,l)}),(function(h){throw Ye(l),h})):(Ot(l,a),xt(u,l))}if(!s||typeof s!="object"){if((u=i(s))===void 0&&(u=s),u===En&&(u=void 0),n.D&&Nt(u,!0),a){var m=[],p=[];K("Patches").M(s,u,m,p),a(m,p)}return u}U(21,s)},this.produceWithPatches=function(s,i){if(typeof s=="function")return function(u){for(var l=arguments.length,f=Array(l>1?l-1:0),d=1;d<l;d++)f[d-1]=arguments[d];return n.produceWithPatches(u,(function(m){return s.apply(void 0,[m].concat(f))}))};var a,o,c=n.produce(s,i,(function(u,l){a=u,o=l}));return typeof Promise<"u"&&c instanceof Promise?c.then((function(u){return[u,a,o]})):[c,a,o]},typeof r?.useProxies=="boolean"&&this.setUseProxies(r.useProxies),typeof r?.autoFreeze=="boolean"&&this.setAutoFreeze(r.autoFreeze)}var e=t.prototype;return e.createDraft=function(r){q(r)||U(8),$(r)&&(r=ws(r));var n=dn(this),s=Mt(this,r,void 0);return s[C].C=!0,It(n),s},e.finishDraft=function(r,n){var s=r&&r[C],i=s.A;return Ot(i,n),xt(void 0,i)},e.setAutoFreeze=function(r){this.D=r},e.setUseProxies=function(r){r&&!yn&&U(20),this.O=r},e.applyPatches=function(r,n){var s;for(s=n.length-1;s>=0;s--){var i=n[s];if(i.path.length===0&&i.op==="replace"){r=i.value;break}}s>-1&&(n=n.slice(s+1));var a=K("Patches").$;return $(r)?a(r,n):this.produce(r,(function(o){return a(o,n)}))},t})(),P=new Ms,Ds=P.produce,ua=P.produceWithPatches.bind(P),ca=P.setAutoFreeze.bind(P),la=P.setUseProxies.bind(P),da=P.applyPatches.bind(P),fa=P.createDraft.bind(P),pa=P.finishDraft.bind(P),Ze=Ds;function oe(t){"@babel/helpers - typeof";return oe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oe(t)}function Cn(t,e){if(oe(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(oe(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Tn(t){var e=Cn(t,"string");return oe(e)=="symbol"?e:e+""}function On(t,e,r){return(e=Tn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xn(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function jt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xn(Object(r),!0).forEach(function(n){On(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xn(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function I(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var wn=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})(),Bt=function(){return Math.random().toString(36).substring(7).split("").join(".")},et={INIT:"@@redux/INIT"+Bt(),REPLACE:"@@redux/REPLACE"+Bt(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Bt()}};function Ls(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function qt(t,e,r){var n;if(typeof e=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(I(0));if(typeof e=="function"&&typeof r>"u"&&(r=e,e=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(I(1));return r(qt)(t,e)}if(typeof t!="function")throw new Error(I(2));var s=t,i=e,a=[],o=a,c=!1;function u(){o===a&&(o=a.slice())}function l(){if(c)throw new Error(I(3));return i}function f(h){if(typeof h!="function")throw new Error(I(4));if(c)throw new Error(I(5));var v=!0;return u(),o.push(h),function(){if(v){if(c)throw new Error(I(6));v=!1,u();var S=o.indexOf(h);o.splice(S,1),a=null}}}function d(h){if(!Ls(h))throw new Error(I(7));if(typeof h.type>"u")throw new Error(I(8));if(c)throw new Error(I(9));try{c=!0,i=s(i,h)}finally{c=!1}for(var v=a=o,g=0;g<v.length;g++){var S=v[g];S()}return h}function m(h){if(typeof h!="function")throw new Error(I(10));s=h,d({type:et.REPLACE})}function p(){var h,v=f;return h={subscribe:function(S){if(typeof S!="object"||S===null)throw new Error(I(11));function T(){S.next&&S.next(l())}T();var E=v(T);return{unsubscribe:E}}},h[wn]=function(){return this},h}return d({type:et.INIT}),n={dispatch:d,subscribe:f,getState:l,replaceReducer:m},n[wn]=p,n}function ks(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:et.INIT});if(typeof n>"u")throw new Error(I(12));if(typeof r(void 0,{type:et.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(I(13))})}function Rn(t){for(var e=Object.keys(t),r={},n=0;n<e.length;n++){var s=e[n];typeof t[s]=="function"&&(r[s]=t[s])}var i=Object.keys(r),a,o;try{ks(r)}catch(c){o=c}return function(u,l){if(u===void 0&&(u={}),o)throw o;if(0)var f;for(var d=!1,m={},p=0;p<i.length;p++){var h=i[p],v=r[h],g=u[h],S=v(g,l);if(typeof S>"u"){var T=l&&l.type;throw new Error(I(14))}m[h]=S,d=d||S!==g}return d=d||i.length!==Object.keys(u).length,d?m:u}}function Ee(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.length===0?function(n){return n}:e.length===1?e[0]:e.reduce(function(n,s){return function(){return n(s.apply(void 0,arguments))}})}function _n(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(n){return function(){var s=n.apply(void 0,arguments),i=function(){throw new Error(I(15))},a={getState:s.getState,dispatch:function(){return i.apply(void 0,arguments)}},o=e.map(function(c){return c(a)});return i=Ee.apply(void 0,o)(s.dispatch),jt(jt({},s),{},{dispatch:i})}}}function In(t){var e=function(n){var s=n.dispatch,i=n.getState;return function(a){return function(o){return typeof o=="function"?o(s,i,t):a(o)}}};return e}var Mn=In();Mn.withExtraArgument=In;var Ht=Mn;var Nn=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(n[i]=s[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Ps=function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,s,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,s&&(i=u[0]&2?s.return:u[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,u[1])).done)return i;switch(s=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,s=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],s=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},be=function(t,e){for(var r=0,n=e.length,s=t.length;r<n;r++,s++)t[s]=e[r];return t},Ns=Object.defineProperty,Fs=Object.defineProperties,Us=Object.getOwnPropertyDescriptors,Dn=Object.getOwnPropertySymbols,js=Object.prototype.hasOwnProperty,Bs=Object.prototype.propertyIsEnumerable,Ln=function(t,e,r){return e in t?Ns(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r},te=function(t,e){for(var r in e||(e={}))js.call(e,r)&&Ln(t,r,e[r]);if(Dn)for(var n=0,s=Dn(e);n<s.length;n++){var r=s[n];Bs.call(e,r)&&Ln(t,r,e[r])}return t},Vt=function(t,e){return Fs(t,Us(e))},qs=function(t,e,r){return new Promise(function(n,s){var i=function(c){try{o(r.next(c))}catch(u){s(u)}},a=function(c){try{o(r.throw(c))}catch(u){s(u)}},o=function(c){return c.done?n(c.value):Promise.resolve(c.value).then(i,a)};o((r=r.apply(t,e)).next())})};var Hs=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ee:Ee.apply(null,arguments)},Ma=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(t){return t}};function Vs(t){if(typeof t!="object"||t===null)return!1;var e=Object.getPrototypeOf(t);if(e===null)return!0;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return e===r}function re(t,e){function r(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];if(e){var i=e.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return te(te({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:n[0]}}return r.toString=function(){return""+t},r.type=t,r.match=function(n){return n.type===t},r}var Ks=(function(t){Nn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,be([void 0],r[0].concat(this)))):new(e.bind.apply(e,be([void 0],r.concat(this))))},e})(Array),Gs=(function(t){Nn(e,t);function e(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var s=t.apply(this,r)||this;return Object.setPrototypeOf(s,e.prototype),s}return Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.prototype.concat.apply(this,r)},e.prototype.prepend=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.length===1&&Array.isArray(r[0])?new(e.bind.apply(e,be([void 0],r[0].concat(this)))):new(e.bind.apply(e,be([void 0],r.concat(this))))},e})(Array);function zt(t){return q(t)?Ze(t,function(){}):t}function zs(t){return typeof t=="boolean"}function $s(){return function(e){return Ws(e)}}function Ws(t){t===void 0&&(t={});var e=t.thunk,r=e===void 0?!0:e,n=t.immutableCheck,s=n===void 0?!0:n,i=t.serializableCheck,a=i===void 0?!0:i,o=t.actionCreatorCheck,c=o===void 0?!0:o,u=new Ks;if(r&&(zs(r)?u.push(Ht):u.push(Ht.withExtraArgument(r.extraArgument))),0){if(s)var l;if(a)var f;if(c)var d}return u}var Kt=!0;function Fn(t){var e=$s(),r=t||{},n=r.reducer,s=n===void 0?void 0:n,i=r.middleware,a=i===void 0?e():i,o=r.devTools,c=o===void 0?!0:o,u=r.preloadedState,l=u===void 0?void 0:u,f=r.enhancers,d=f===void 0?void 0:f,m;if(typeof s=="function")m=s;else if(Vs(s))m=Rn(s);else throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');var p=a;if(typeof p=="function"&&(p=p(e),!Kt&&!Array.isArray(p)))throw new Error("when using a middleware builder function, an array of middleware must be returned");if(!Kt&&p.some(function(E){return typeof E!="function"}))throw new Error("each middleware provided to configureStore must be a function");var h=_n.apply(void 0,p),v=Ee;c&&(v=Hs(te({trace:!Kt},typeof c=="object"&&c)));var g=new Gs(h),S=g;Array.isArray(d)?S=be([h],d):typeof d=="function"&&(S=d(g));var T=v.apply(void 0,S);return qt(m,l,T)}function Un(t){var e={},r=[],n,s={addCase:function(i,a){var o=typeof i=="string"?i:i.type;if(!o)throw new Error("`builder.addCase` cannot be called with an empty action type");if(o in e)throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");return e[o]=a,s},addMatcher:function(i,a){return r.push({matcher:i,reducer:a}),s},addDefaultCase:function(i){return n=i,s}};return t(s),[e,r,n]}function Qs(t){return typeof t=="function"}function Ys(t,e,r,n){r===void 0&&(r=[]);var s=typeof e=="function"?Un(e):[e,r,n],i=s[0],a=s[1],o=s[2],c;if(Qs(t))c=function(){return zt(t())};else{var u=zt(t);c=function(){return u}}function l(f,d){f===void 0&&(f=c());var m=be([i[d.type]],a.filter(function(p){var h=p.matcher;return h(d)}).map(function(p){var h=p.reducer;return h}));return m.filter(function(p){return!!p}).length===0&&(m=[o]),m.reduce(function(p,h){if(h)if($(p)){var v=p,g=h(v,d);return g===void 0?p:g}else{if(q(p))return Ze(p,function(S){return h(S,d)});var g=h(p,d);if(g===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return g}return p},f)}return l.getInitialState=c,l}function Xs(t,e){return t+"/"+e}function jn(t){var e=t.name;if(!e)throw new Error("`name` is a required option for createSlice");typeof process<"u";var r=typeof t.initialState=="function"?t.initialState:zt(t.initialState),n=t.reducers||{},s=Object.keys(n),i={},a={},o={};s.forEach(function(l){var f=n[l],d=Xs(e,l),m,p;"reducer"in f?(m=f.reducer,p=f.prepare):m=f,i[l]=m,a[d]=m,o[l]=p?re(d,p):re(d)});function c(){var l=typeof t.extraReducers=="function"?Un(t.extraReducers):[t.extraReducers],f=l[0],d=f===void 0?{}:f,m=l[1],p=m===void 0?[]:m,h=l[2],v=h===void 0?void 0:h,g=te(te({},d),a);return Ys(r,function(S){for(var T in g)S.addCase(T,g[T]);for(var E=0,Q=p;E<Q.length;E++){var z=Q[E];S.addMatcher(z.matcher,z.reducer)}v&&S.addDefaultCase(v)})}var u;return{name:e,reducer:function(l,f){return u||(u=c()),u(l,f)},actions:o,caseReducers:i,getInitialState:function(){return u||(u=c()),u.getInitialState()}}}var Js="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",Zs=function(t){t===void 0&&(t=21);for(var e="",r=t;r--;)e+=Js[Math.random()*64|0];return e},ei=["name","message","stack","code"],Gt=(function(){function t(e,r){this.payload=e,this.meta=r}return t})(),kn=(function(){function t(e,r){this.payload=e,this.meta=r}return t})(),ti=function(t){if(typeof t=="object"&&t!==null){for(var e={},r=0,n=ei;r<n.length;r++){var s=n[r];typeof t[s]=="string"&&(e[s]=t[s])}return e}return{message:String(t)}},Pa=(function(){function t(e,r,n){var s=re(e+"/fulfilled",function(l,f,d,m){return{payload:l,meta:Vt(te({},m||{}),{arg:d,requestId:f,requestStatus:"fulfilled"})}}),i=re(e+"/pending",function(l,f,d){return{payload:void 0,meta:Vt(te({},d||{}),{arg:f,requestId:l,requestStatus:"pending"})}}),a=re(e+"/rejected",function(l,f,d,m,p){return{payload:m,error:(n&&n.serializeError||ti)(l||"Rejected"),meta:Vt(te({},p||{}),{arg:d,requestId:f,rejectedWithValue:!!m,requestStatus:"rejected",aborted:l?.name==="AbortError",condition:l?.name==="ConditionError"})}}),o=!1,c=typeof AbortController<"u"?AbortController:(function(){function l(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return l.prototype.abort=function(){},l})();function u(l){return function(f,d,m){var p=n?.idGenerator?n.idGenerator(l):Zs(),h=new c,v,g=!1;function S(E){v=E,h.abort()}var T=(function(){return qs(this,null,function(){var E,Q,z,we,cr,Re,lr;return Ps(this,function(fe){switch(fe.label){case 0:return fe.trys.push([0,4,,5]),we=(E=n?.condition)==null?void 0:E.call(n,l,{getState:d,extra:m}),ni(we)?[4,we]:[3,2];case 1:we=fe.sent(),fe.label=2;case 2:if(we===!1||h.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return g=!0,cr=new Promise(function(B,_e){return h.signal.addEventListener("abort",function(){return _e({name:"AbortError",message:v||"Aborted"})})}),f(i(p,l,(Q=n?.getPendingMeta)==null?void 0:Q.call(n,{requestId:p,arg:l},{getState:d,extra:m}))),[4,Promise.race([cr,Promise.resolve(r(l,{dispatch:f,getState:d,extra:m,requestId:p,signal:h.signal,abort:S,rejectWithValue:function(B,_e){return new Gt(B,_e)},fulfillWithValue:function(B,_e){return new kn(B,_e)}})).then(function(B){if(B instanceof Gt)throw B;return B instanceof kn?s(B.payload,p,l,B.meta):s(B,p,l)})])];case 3:return z=fe.sent(),[3,5];case 4:return Re=fe.sent(),z=Re instanceof Gt?a(null,p,l,Re.payload,Re.meta):a(Re,p,l),[3,5];case 5:return lr=n&&!n.dispatchConditionRejection&&a.match(z)&&z.meta.condition,lr||f(z),[2,z]}})})})();return Object.assign(T,{abort:S,requestId:p,arg:l,unwrap:function(){return T.then(ri)}})}}return Object.assign(u,{pending:i,rejected:a,fulfilled:s,typePrefix:e})}return t.withTypes=function(){return t},t})();function ri(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}function ni(t){return t!==null&&typeof t=="object"&&typeof t.then=="function"}var Bn="listener",qn="completed",Hn="cancelled",Na="task-"+Hn,Fa="task-"+qn,Ua=Bn+"-"+Hn,ja=Bn+"-"+qn;var $t="listenerMiddleware";var Ba=re($t+"/add"),qa=re($t+"/removeAll"),Ha=re($t+"/remove");var Pn,Va=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:typeof global<"u"?global:globalThis):function(t){return(Pn||(Pn=Promise.resolve())).then(t).catch(function(e){return setTimeout(function(){throw e},0)})},si=function(t){return function(e){setTimeout(e,t)}},Ka=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:si(10);An();var ii=Ke(Symbol("withEventBus"),function(t,e){return class extends t{constructor(){super(...arguments),this.eventBus=e??document.createElement("span")}addEventListener(r,n,s){this.eventBus.addEventListener(r,n,s)}dispatchEvent(r){return this.eventBus.dispatchEvent(r)}removeEventListener(r,n,s){this.eventBus.removeEventListener(r,n,s)}}}),tt=class extends ii(Object){};window.ftReduxStores||(window.ftReduxStores={});var Vn=class t extends tt{static get(e){var r;let n=typeof e=="string"?e:e.name,s=typeof e=="string"?void 0:e,i=window.ftReduxStores[n];if(Qe(i))return i;if(s==null)return;let a=jn({...s,reducers:(r=s.reducers)!==null&&r!==void 0?r:{}}),o=Fn({reducer:(c,u)=>{if(u.type==="CLEAR_FT_REDUX_STORE"){let l=Me(a.getInitialState());for(let f of u.keeping)l[f]=(c??l)[f];return l}else if(typeof u.type=="string"&&u.type.startsWith("DEFAULT_VALUE_SETTER__"))return{...c,...u.overwrites};return a.reducer(c,u)}});return window.ftReduxStores[s.name]=new t(a,o,s.eventBus)}constructor(e,r,n){super(),this.reduxSlice=e,this.reduxStore=r,this.isFtReduxStore=!0,this.commands=new Ge;let s=i=>i!=null?JSON.parse(JSON.stringify(i)):i;this.actions=new Proxy(this.reduxSlice.actions,{get:(i,a,o)=>{let c=a,u=i[c];return u?(...l)=>{let f=u(...l.map(s));return this.reduxStore.dispatch(f),f}:l=>{this.setState({[c]:s(l)})}}}),this.eventBus=n??this.eventBus}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:[]})}clearKeeping(...e){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE",keeping:e})}setState(e){this.reduxStore.dispatch({type:"DEFAULT_VALUE_SETTER__"+Object.keys(e).join("_"),overwrites:e})}get dispatch(){throw new Error("Don't use this method, actions are automatically dispatched when called.")}[Symbol.observable](){return this.reduxStore[Symbol.observable]()}getState(){return this.reduxStore.getState()}replaceReducer(e){throw new Error("Not implemented yet.")}subscribe(e){return this.reduxStore.subscribe(e)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}};var rt=class{static format(e,r,n,s,i){return window.moment?window.moment(e).locale(r).format(this.getMomentDateFormat(n,s,!!i)):this.getIntlDateTime(e,r,n,s,!!i)}static getMomentDateFormat(e,r,n){return n?"LT":e?r?"lll":"ll":r?"L LT":"L"}static getIntlDateTime(e,r,n,s,i){let a=typeof e=="string"?new Date(e):e,o=new Intl.DateTimeFormat(r,{dateStyle:n?"medium":"short"}).format(a),c=new Intl.DateTimeFormat(r,{timeStyle:"short"}).format(a);return i?c:s?`${o} ${c}`:o}static getTimezoneAsString(){let e=n=>String(Math.floor(n)).padStart(2,"0"),r=new Date().getTimezoneOffset();return`${r<0?"+":"-"}${e(Math.abs(r)/60)}:${e(Math.abs(r)%60)}`}};var nt=A(w()),ai="ft-app-info",Ce=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};Ce.eventName="authentication-change";var Fe=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:e})}};Fe.eventName="ui-locale-changed";var oi={session:(t,e)=>{(0,nt.deepEqual)(t.session,e.payload)||(t.session=e.payload,setTimeout(()=>y.dispatchEvent(new Ce(e.payload)),0))}},y=nt.FtReduxStore.get({name:ai,reducers:oi,initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,apiIntegrationAppVersion:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],availableContentLocales:[],defaultLocales:void 0,searchInAllLanguagesAllowed:!1,searchLanguageSetsUiLanguage:!1,uiLanguageSetsSearchLanguage:!1,uiLanguageSetsReaderLanguage:!1,metadataConfiguration:void 0,privacyPolicyConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1,navigatorOnline:!0,forcedOffline:!1,authenticationRequired:!1}});var Kn=A(w()),st=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},So=(0,Kn.applyMixinOnce)(Symbol("withDateFormat"),function(t){class e extends t{constructor(...n){super(n),this.useLongDateFormat=!1,this.useDateTimeFormat=!1,this.metadataDescriptors=[],this.uiLocale="en-US",this.addStore(y)}dateFormatOptionsChanged(n){return n.has("metadataDescriptors")||n.has("useLongDateFormat")||n.has("useDateTimeFormat")||n.has("uiLocale")}getDateFormatter(n){var s,i;return((i=(s=this.metadataDescriptors.find(o=>o.key===n))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1)?o=>rt.format(o,this.uiLocale,this.useLongDateFormat,this.useDateTimeFormat):void 0}}return st([(0,Wt.property)({type:Boolean})],e.prototype,"useLongDateFormat",void 0),st([(0,Wt.property)({type:Boolean})],e.prototype,"useDateTimeFormat",void 0),st([Tt({store:y.name,selector:r=>{var n,s;return(s=(n=r.metadataConfiguration)===null||n===void 0?void 0:n.descriptors)!==null&&s!==void 0?s:[]}})],e.prototype,"metadataDescriptors",void 0),st([Tt({store:y.name})],e.prototype,"uiLocale",void 0),e});var ct=A(w());var Qt=A(w());var ue=class t{static get(e){let{baseUrl:r,apiIntegrationIdentifier:n}=y.getState(),s=e??n;if(r&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(r,s,!0)}static await(e){return new Promise(r=>{let n=t.get(e);if(n)r(n);else{let s=y.subscribe(()=>{n=t.get(e),n&&(s(),r(n))})}})}};var Te=class{constructor(e){this.overrideApi=e}get api(){var e;return(e=this.overrideApi)!==null&&e!==void 0?e:ue.get()}get awaitApi(){return this.overrideApi?Promise.resolve(this.overrideApi):ue.await()}};var M=class extends Te{constructor(e=!0,r){var n;super(r),this.sortObjectFields=(i,a)=>typeof a!="object"||a==null||Array.isArray(a)?a:Object.fromEntries(Object.entries(a).sort(([o],[c])=>o.localeCompare(c)));let s=this.constructor;s.commonCache=(n=s.commonCache)!==null&&n!==void 0?n:new Qt.CacheRegistry,this.cache=e?s.commonCache:new Qt.CacheRegistry}clearCache(){this.cache.clearAll()}hash(e){return String(Array.from(JSON.stringify(e,this.sortObjectFields)).reduce((r,n)=>0|31*r+n.charCodeAt(0),0))}};var it=class extends M{async listMySearches(){let{session:e}=y.getState();return Xr(e,x.SAVED_SEARCH_USER)?this.cache.get("my-searches",async()=>(await this.awaitApi).listMySearches(e.profile.userId),300*1e3):[]}};var at=class extends M{async listMyBookmarks(){let e=y.getState().session;return e?.sessionAuthenticated?this.cache.get("my-bookmarks",async()=>(await this.awaitApi).listMyBookmarks(e.profile.userId),300*1e3):[]}};var ot=class extends M{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetCount(e){if(this.isAuthenticated())return this.cache.get(`user-asset-count-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/${e}`),this.CACHE_DURATION)}async getUserBookmarkCountByMap(e){if(this.isAuthenticated())return this.cache.get(`user-bookmark-count-by-map-${e}`,async()=>(await this.awaitApi).get(`/internal/api/webapp/user/assets/count/BOOKMARKS/${e}`),this.CACHE_DURATION)}isAuthenticated(){let e=y.getState().session;return!!e?.sessionAuthenticated}};var ut=class extends M{constructor(){super(...arguments),this.CACHE_DURATION=180*1e3}async getUserAssetLabels(){return this.isAuthenticated()?this.cache.get("user-asset-labels",async()=>(await this.awaitApi).get("/internal/api/webapp/user/assets/labels"),this.CACHE_DURATION):[]}isAuthenticated(){let e=y.getState().session;return!!e?.sessionAuthenticated}};var ui="ft-user-assets",ci={setAssetCount:(t,e)=>{let{userAssetType:r,count:n}=e.payload.assetCount;t.assetCounts.allAsset[r]=n},clearAssetCount:t=>{Object.values(F).forEach(e=>{t.assetCounts.allAsset[e]=void 0})},setBookmarkCountByMap:(t,e)=>{let r=e.payload.mapId;t.assetCounts.bookmarkByMap[r]=e.payload.count},clearBookmarkCountByMap:t=>{t.assetCounts.bookmarkByMap={}},addAsset:(t,e)=>{let{assetType:r,mapId:n,asset:s}=e.payload;Xt(t,r,[...Yt(t,r),s]),Gn(t,r,1,n),zn(t,s)},editAsset:(t,e)=>{let{assetType:r,asset:n}=e.payload;Xt(t,r,Yt(t,r).map(s=>s.id===n.id?n:s)),zn(t,n)},removeAsset:(t,e)=>{let{assetType:r,mapId:n,assetId:s}=e.payload;Xt(t,r,Yt(t,r).filter(i=>i.id!==s)),Gn(t,r,-1,n)}},$n={[F.SEARCHES]:"savedSearches",[F.BOOKMARKS]:"bookmarks",[F.BOOKS]:void 0,[F.COLLECTIONS]:void 0},Yt=(t,e)=>{var r;let n=$n[e];return n?(r=t[n])!==null&&r!==void 0?r:[]:[]},Xt=(t,e,r)=>{let n=$n[e];n&&(t[n]=r)},Gn=(t,e,r,n)=>{let s=t.assetCounts.allAsset[e];if(s!==void 0&&(t.assetCounts.allAsset[e]=Math.max(0,s+r),e===F.BOOKMARKS&&n)){let i=t.assetCounts.bookmarkByMap[n];t.assetCounts.bookmarkByMap[n]=Math.max(0,i+r)}},zn=(t,e)=>{let r=t.assetLabels.map(s=>s.title),n=e.labels.filter(s=>!r.includes(s)).map(s=>({title:s}));t.assetLabels.push(...n)},L=ct.FtReduxStore.get({name:ui,reducers:ci,initialState:{savedSearches:void 0,bookmarks:void 0,assetCounts:{allAsset:Object.fromEntries(Object.values(F).map(t=>[t,void 0])),bookmarkByMap:{}},assetLabels:[]}}),Jt=class{constructor(e=new ot,r=new ut){this.assetCountsService=e,this.assetLabelsService=r,this.currentSession=y.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new at,this.savedSearchesService=new it,y.subscribe(()=>this.reloadWhenUserSessionChanges())}reloadWhenUserSessionChanges(){var e;let{session:r}=y.getState();(0,ct.deepEqual)((e=this.currentSession)===null||e===void 0?void 0:e.profile,r?.profile)||(this.currentSession=r,this.clearMySearches(),this.reloadBookmarks(),this.clearUserAssetCounts(),this.reloadAssetLabels())}clearUserAssetCounts(){this.assetCountsService.clearCache(),L.actions.clearAssetCount(),L.actions.clearBookmarkCountByMap()}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),L.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),L.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();let e=await this.savedSearchesService.listMySearches();L.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async reloadAssetLabels(){this.assetLabelsService.clearCache();let e=await this.assetLabelsService.getUserAssetLabels();L.actions.assetLabels(e)}async loadAssetCount(e){let r=await this.assetCountsService.getUserAssetCount(e);r&&L.getState().assetCounts.allAsset[e]!==r.count&&L.actions.setAssetCount({assetCount:r})}async loadBookmarkByMapId(e){let r=await this.assetCountsService.getUserBookmarkCountByMap(e);r&&L.getState().assetCounts.bookmarkByMap[e]!==r.count&&L.actions.setBookmarkCountByMap({count:r.count,mapId:e})}async reloadAssetCount(e){this.assetCountsService.clearCache();let r=Object.keys(L.getState().assetCounts.bookmarkByMap).length!==0;e===F.BOOKMARKS&&r&&L.actions.clearBookmarkCountByMap(),L.getState().assetCounts.allAsset[e]!==void 0&&await this.loadAssetCount(e)}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var e;if(this.bookmarksAreUsed){let r=!((e=this.currentSession)===null||e===void 0)&&e.sessionAuthenticated?await this.bookmarksService.listMyBookmarks():void 0;L.actions.bookmarks(r)}}},Zt=new Jt;window.FluidTopicsUserAssetsActions==null&&(window.FluidTopicsUserAssetsActions=Zt);var er=class{addCommand(e,r=!1){y.commands.add(e,r)}consumeCommand(e){return y.commands.consume(e)}};window.FluidTopicsAppInfoStoreService=new er;var j=A(w());var Wn,Oe=class extends CustomEvent{constructor(e){super("ft-i18n-context-loaded",{detail:e})}},li=Symbol("clearAfterUnitTest"),lt=class extends(0,j.withEventBus)(M){constructor(e){super(),this.messageContextProvider=e,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Wn]=()=>{this.defaultMessages={},this.cache=new j.CacheRegistry,this.listeners={}},this.currentUiLocale=y.getState().uiLocale,y.subscribe(()=>this.clearWhenUiLocaleChanges())}clearWhenUiLocaleChanges(){let{uiLocale:e}=y.getState();this.currentUiLocale!==e&&(this.currentUiLocale=e,this.cache.clearAll(),this.notifyAll())}addContext(e){let r=e.name.toLowerCase();this.cache.setFinal(r,e),this.notify(r)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(e,r){var n;if(e=e.toLowerCase(),r&&Object.keys(r).length>0){let s={...(n=this.defaultMessages[e])!==null&&n!==void 0?n:{},...r};(0,j.deepEqual)(this.defaultMessages[e],s)||(this.defaultMessages[e]=s,await this.notify(e))}return this.fetchContext(e)}resolveContext(e){var r,n;return this.fetchContext(e),(n=(r=this.cache.getNow(e))===null||r===void 0?void 0:r.messages)!==null&&n!==void 0?n:{}}resolveRawMessage(e,r){let n=e.toLowerCase();return this.resolveContext(n)[r]}resolveMessage(e,r,...n){var s;let i=e.toLowerCase(),a=this.resolveContext(i);return new j.ParametrizedLabelResolver((s=this.defaultMessages[i])!==null&&s!==void 0?s:{},a).resolve(r,...n)}async fetchContext(e){let r=!this.cache.has(e),n;try{n=await this.cache.get(e,()=>this.messageContextProvider(this.currentUiLocale,e)),r&&await this.notify(e)}catch(s){!(s instanceof j.CanceledPromiseError)&&r&&console.error(s)}return n}subscribe(e,r){var n;return e=e.toLowerCase(),this.listeners[e]=(n=this.listeners[e])!==null&&n!==void 0?n:new Set,this.listeners[e].add(r),()=>{var s;return(s=this.listeners[e])===null||s===void 0?void 0:s.delete(r)}}async notifyAll(){let e=Object.keys(this.listeners);document.body.dispatchEvent(new Oe({loadedContexts:e})),this.dispatchEvent(new Oe({loadedContexts:e})),await Promise.all(e.map(r=>this.notify(r,!1)))}async notify(e,r=!0){r&&(document.body.dispatchEvent(new Oe({loadedContexts:[e]})),this.dispatchEvent(new Oe({loadedContexts:[e]}))),this.listeners[e]!=null&&await Promise.all([...this.listeners[e].values()].map(n=>(0,j.delay)(0).then(()=>n()).catch(()=>null)))}};Wn=li;window.FluidTopicsI18nService==null&&(window.FluidTopicsI18nService=new class extends lt{constructor(){super(async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e))}});window.FluidTopicsCustomI18nService==null&&(window.FluidTopicsCustomI18nService=new class extends lt{constructor(){super(async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e))}});var Qn=window.FluidTopicsI18nService,eu=window.FluidTopicsCustomI18nService;var Yn=A(w()),tr=class{highlightHtml(e,r,n){(0,Yn.highlightHtml)(e,r,n)}};window.FluidTopicsHighlightHtmlService=new tr;var Xn=A(w());var rr=class{isDate(e){var r,n,s,i;return(i=(s=((n=(r=y.getState().metadataConfiguration)===null||r===void 0?void 0:r.descriptors)!==null&&n!==void 0?n:[]).find(o=>o.key===e))===null||s===void 0?void 0:s.date)!==null&&i!==void 0?i:!1}format(e,r){var n,s,i,a;if(e==null)return"";try{return Xn.DateFormatter.format(e,(n=r?.locale)!==null&&n!==void 0?n:y.getState().uiLocale,(s=r?.longFormat)!==null&&s!==void 0?s:!1,(i=r?.withTime)!==null&&i!==void 0?i:!1,(a=r?.onlyTime)!==null&&a!==void 0?a:!1)}catch(o){throw console.error(`Date ${JSON.stringify(e)} is not valid`,o),o}}};window.FluidTopicsDateService=new rr;var Jn=A(w());var Ue=class{static get(e,r){var n,s;let i=y.getState(),{lang:a,region:o}=(s=(n=i.defaultLocales)===null||n===void 0?void 0:n.defaultContentLocale)!==null&&s!==void 0?s:{lang:"en",region:"US"};return new Jn.SearchPlaceConverter(i.baseUrl,e??20,i.searchInAllLanguagesAllowed,r??`${a}-${o}`)}};var dt=class extends M{async sendDocumentStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.start_display event")}async sendTopicStartDisplayEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.start_display event")}async sendKhubSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send khub.search event")}async sendDocumentSearchEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.search event")}async sendSearchPageSelectEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_page.select event")}async sendSearchResultOpenContextMenuEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send search_result.open_context_menu event")}async sendDocumentOnDemandTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send document.on_demand_translate event")}async sendTopicAiTranslateEvent(e){return this.sendEvents([this.sortEventArrays(e)],"Failed to send topic.ai_translate event")}convertMapToAnalyticsDocument(e){let r;switch(e.editorialType){case"BOOK":r="STRUCTURED_DOCUMENT";break;case"SHARED_BOOK":r="SHARED_PERSONAL_BOOK";break;case"ARTICLE":r="RESOURCE";break;case"HTML_PACKAGE":r="HTML_PACKAGE";break;default:throw new TypeError("Unknown editorial type for map : "+e.editorialType)}return{id:e.id,title:e.title,type:r,metadata:e.metadata}}sortEventArrays(e){let r=Object.entries(e).map(([n,s])=>Array.isArray(s)?[n,s.map(i=>typeof i=="object"&&i!=null&&!Array.isArray(i)?this.sortEventArrays(i):i).sort((i,a)=>typeof i=="object"&&i!==null&&"key"in i?i.key.localeCompare(a.key):typeof i=="string"&&typeof a=="string"?i.localeCompare(a):String(i).localeCompare(String(a)))]:typeof s=="object"&&s!==null?[n,this.sortEventArrays(s)]:[n,s]);return Object.fromEntries(r)}sendEvents(e,r){let n="anything not undefined";return this.cache.get("analytics-event-"+this.hash(e),async()=>(await this.awaitApi).sendEvents(e).then(()=>n).catch(s=>(console.info(r),console.debug(s),n)),1e3)}};var nr=class{urlToSearchRequest(e){return Ue.get().parse(e)}searchRequestToUrl(e){return Ue.get().serialize(e)}};window.FluidTopicsUrlService=new nr;var W=A(w());var ce=class t extends CustomEvent{constructor(e){super(t.eventName,{detail:{currentItem:e}})}};ce.eventName="change";var sr=class{itemName(e){return`fluid-topics-history-item-${e}`}get(e){let r=sessionStorage.getItem(this.itemName(e));return r?JSON.parse(r):void 0}set(e,r){sessionStorage.setItem(this.itemName(e),JSON.stringify(r))}},Zn=new sr;var ft=class t extends W.WithEventBus{static build(){return new t(window.history,Zn,()=>window.location,!1)}constructor(e,r,n,s){var i,a;super(),this.history=e,this.historyStorage=r,this.windowLocation=n,this.states=[],this.realPushState=e.pushState,this.realReplaceState=e.replaceState,this.initialIndex=(a=(i=e.state)===null||i===void 0?void 0:i.index)!==null&&a!==void 0?a:e.length-1,this.currentIndex=this.initialIndex,this.setCurrentState(this.buildCurrentState()),this.installProxies(),this.initEventListeners(),this.initData(s)}setCurrentState(e,r=!1){let n=r&&this.currentIndex===e.index-1;this.currentState={...this.buildCurrentState(),...e},this.currentIndex=this.currentState.index,this.states[this.currentIndex]=this.currentState,n&&(this.states=this.states.slice(0,this.currentIndex+1)),this.historyStorage.set(this.currentIndex,this.currentState),(0,W.deepEqual)(this.currentState,this.history.state)||this.realReplaceState.apply(this.history,[this.currentState,this.currentState.title,window.location.href]),setTimeout(()=>this.dispatchEvent(new ce(this.currentItem())),0)}installProxies(){let e=r=>(n,s,[i,a,o])=>{let c=r(),u={...c===this.currentIndex?this.currentState:void 0,...i,index:c,href:typeof o=="string"?o:(o??this.windowLocation()).href};n.apply(s,[u,a,o]),this.setCurrentState(u,!0)};this.history.pushState=new Proxy(this.history.pushState,{apply:e(()=>this.currentIndex+1)}),this.history.replaceState=new Proxy(this.history.replaceState,{apply:e(()=>this.currentIndex)})}initEventListeners(){window.addEventListener("popstate",e=>this.setCurrentState(e.state)),document.querySelector("title")==null&&document.head.append(document.createElement("title")),new MutationObserver(()=>this.updateCurrentState({title:document.title})).observe(document.querySelector("title"),{subtree:!0,characterData:!0,childList:!0})}initData(e){for(let r=this.history.length-1;r>=0;r--)e?this.states[r]=this.historyStorage.get(r):setTimeout(()=>this.states[r]=this.historyStorage.get(r),this.history.length-r)}updateCurrentState(e){var r;let n={...this.buildCurrentState(),...e,index:this.currentIndex,title:(r=e?.title)!==null&&r!==void 0?r:this.currentState.title};this.setCurrentState(n)}addHistoryChangeListener(e){this.addEventListener(ce.eventName,e)}removeHistoryChangeListener(e){this.removeEventListener(ce.eventName,e)}currentItem(){return(0,W.deepCopy)(this.currentState)}back(){let e=this.previousDifferentMajorPosition();e>=0?this.history.go(e-this.currentIndex):this.currentIndex!==this.initialIndex?this.history.go(this.initialIndex-this.currentIndex):this.history.back()}backwardItem(){return(0,W.deepCopy)(this.states[this.previousDifferentMajorPosition()])}backwardItemMatching(e){let r=this.states.filter(n=>!!n).filter(n=>n.index<this.currentIndex).reverse();return(0,W.deepCopy)(r.find(n=>e(n)))}previousDifferentMajorPosition(){let e=this.currentIndex>0?this.currentIndex-1:0;for(;e>0&&!this.isDifferentMajorState(e);)e--;return e}forward(){let e=this.nextMajorPosition();e&&e<this.states.length?this.history.go(e-this.currentIndex):this.history.forward()}forwardItem(){let e=this.nextMajorPosition();if(e)return(0,W.deepCopy)(this.states[e])}nextMajorPosition(){let e=this.currentIndex;if(!(e>=this.states.length)){do e++;while(e<this.states.length&&!this.isDifferentMajorState(e));return this.getHigherPositionInTheSameState(e)}}getHigherPositionInTheSameState(e){var r;let n=(r=this.states[e])===null||r===void 0?void 0:r.majorStateId;if(!n)return e;let s=e,i=e+1;for(;this.states.length>i&&!this.isDifferentMajorState(i,n);)this.hasState(i)&&(s=i),i++;return s}buildCurrentState(){var e,r;return{...this.history.state,index:this.currentIndex,href:this.windowLocation().href,title:(r=(e=this.history.state)===null||e===void 0?void 0:e.title)!==null&&r!==void 0?r:document.title}}hasState(e){return this.states[e]!=null}isDifferentMajorState(e,r){var n;if(!this.hasState(e))return!1;let s=r??this.currentState.majorStateId,i=(n=this.states[e])===null||n===void 0?void 0:n.majorStateId;return i==null||i!=s}};window.FluidTopicsInternalHistoryService==null&&(window.FluidTopicsInternalHistoryService=ft.build(),window.FluidTopicsHistoryService={currentItem:()=>window.FluidTopicsInternalHistoryService.currentItem(),back:()=>window.FluidTopicsInternalHistoryService.back(),forward:()=>window.FluidTopicsInternalHistoryService.forward(),backwardItem:()=>window.FluidTopicsInternalHistoryService.backwardItem(),forwardItem:()=>window.FluidTopicsInternalHistoryService.forwardItem(),backwardItemMatching:t=>window.FluidTopicsInternalHistoryService.backwardItemMatching(t),addHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.addHistoryChangeListener(t),removeHistoryChangeListener:t=>window.FluidTopicsInternalHistoryService.removeHistoryChangeListener(t)});var es=A(pe());var ts=es.css`
3
+ `;var ns=A(pe()),N=A(Y()),de=A(w());var le=A(w());function rs(t,e){let{authenticationRequired:r,session:n}=y.getState();return r&&!n?.sessionAuthenticated?Promise.resolve(e):t()}var pt=class extends Te{async updateUiLocale(e){return(await this.awaitApi).updateUiLocale(e)}};var ir=class t extends le.FtStateManager{static build(e){return new t(y,e)}constructor(e,r){super(),this.store=e,this.cache=new le.CacheRegistry,this.withManualResources=!0,this.localesConfiguration=null,this.userLocaleService=new pt,this.cleanSessionDebouncer=new le.Debouncer,this.reloadDebouncer=new le.Debouncer(500),this.apiProvider=r??(()=>ue.get())}setWithManualResources(e){this.withManualResources=e,this.updateIfNeeded()}async initService(){this.store.addEventListener(Ce.eventName,this.reloadConfiguration)}async updateIfNeeded(){this.apiProvider()&&(this.withManualResources||(this.store.getState().session==null&&this.updateSession(),this.store.getState().metadataConfiguration==null&&this.updateMetadataConfiguration()),this.localesConfiguration==null&&this.updateLocalesConfiguration(),(this.store.getState().availableContentLocales==null||this.store.getState().availableContentLocales.length==0)&&this.updateAvailableContentLocales())}async updateSession(){let e=await this.cache.get("session",async()=>{let r=await this.apiProvider().getCurrentSession();return r.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run(()=>{this.cache.clear("session"),this.setSession(void 0)},r.idleTimeoutInMillis),r});this.setSession(e)}async updateMetadataConfiguration(){this.setMetadataConfiguration(await this.cache.get("metadataConfiguration",()=>this.apiProvider().getMetadataConfiguration()))}async updateLocalesConfiguration(){this.setLocalesConfiguration(await this.cache.get("localesConfiguration",()=>this.apiProvider().getLocalesConfiguration()))}async updateAvailableContentLocales(){var e;let r=await this.cache.get("availableContentLocales",()=>rs(()=>this.apiProvider().getAvailableSearchLocales(),{contentLocales:[]}));this.setAvailableContentLocales((e=r.contentLocales)!==null&&e!==void 0?e:[])}reloadConfiguration(){var e;(e=this.cache)===null||e===void 0||e.clear("availableContentLocales"),typeof this.updateAvailableContentLocales=="function"&&this.updateAvailableContentLocales()}setBaseUrl(e){this.store.actions.baseUrl(e),window.fluidTopicsBaseUrl=e}setApiIntegrationIdentifier(e){this.store.actions.apiIntegrationIdentifier(e)}setApiIntegrationAppVersion(e){this.store.actions.apiIntegrationAppVersion(e)}setUiLocale(e){this.store.actions.uiLocale(e)}setLocalesConfiguration(e){var r,n,s,i,a;this.localesConfiguration=e,this.store.actions.defaultLocales(this.localesConfiguration.defaultLocales),this.store.actions.availableUiLocales((r=this.localesConfiguration.availableUiLocales)!==null&&r!==void 0?r:[]),this.store.actions.searchInAllLanguagesAllowed((n=this.localesConfiguration.allLanguagesAllowed)!==null&&n!==void 0?n:!1),this.store.actions.searchLanguageSetsUiLanguage((s=this.localesConfiguration.searchLanguageSetsUiLanguage)!==null&&s!==void 0?s:!1),this.store.actions.uiLanguageSetsSearchLanguage((i=this.localesConfiguration.uiLanguageSetsSearchLanguage)!==null&&i!==void 0?i:!1),this.store.actions.uiLanguageSetsReaderLanguage((a=this.localesConfiguration.uiLanguageSetsReaderLanguage)!==null&&a!==void 0?a:!1),setTimeout(()=>this.updateIfNeeded())}setAvailableContentLocales(e){this.store.actions.availableContentLocales(e),setTimeout(()=>this.updateIfNeeded())}stopReloadDebouncer(){this.reloadDebouncer.cancel()}requestUiLocaleUpdate(e){this.userLocaleService.updateUiLocale({uiLocale:e}).then(r=>{r.uiLocaleChanged&&(this.reloadDebouncer.run(()=>window.location.reload()),this.store.dispatchEvent(new Fe(r)))}).catch(()=>{})}setMetadataConfiguration(e){this.store.actions.metadataConfiguration(e),setTimeout(()=>this.updateIfNeeded())}setNoCustom(e){this.store.actions.noCustom(e)}setEditorMode(e){this.store.actions.editorMode(e)}setNoCustomComponent(e){this.store.actions.noCustomComponent(e)}setSession(e){this.store.actions.session(e),setTimeout(()=>this.updateIfNeeded())}setOpenExternalDocumentInNewTab(e){this.store.actions.openExternalDocumentInNewTab(e)}setNavigatorOnline(e){this.store.actions.navigatorOnline(e)}setForcedOffline(e){this.store.actions.forcedOffline(e)}setAuthenticationRequired(e){this.store.actions.authenticationRequired(e)}},je=ir.build();var D=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},O=class extends de.FtLitElementRedux{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.apiIntegrationAppVersion="ft-integration-app-version",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.authenticationRequired=!1,this.messageContexts=[],this.stateManager=je}render(){return ns.html`
5
4
  <slot></slot>
6
- `}connectedCallback(){super.connectedCallback(),this.stateManager.initService()}disconnectedCallback(){super.disconnectedCallback()}update(e){var r;super.update(e),e.has("baseUrl")&&this.stateManager.setBaseUrl(this.baseUrl),e.has("apiIntegrationIdentifier")&&this.stateManager.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&this.stateManager.setApiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&this.stateManager.setUiLocale(this.uiLocale),e.has("metadataConfiguration")&&this.stateManager.setMetadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&this.stateManager.setNoCustom(this.noCustom),e.has("editorMode")&&this.stateManager.setEditorMode(this.editorMode),e.has("noCustomComponent")&&this.stateManager.setNoCustomComponent(this.noCustomComponent),e.has("session")&&this.stateManager.setSession(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(n=>cs.addContext(n)),e.has("openExternalDocumentInNewTab")&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&this.stateManager.setNavigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&this.stateManager.setForcedOffline(this.forcedOffline),e.has("authenticationRequired")&&this.stateManager.setAuthenticationRequired(this.authenticationRequired),e.has("withManualResources")&&((r=this.stateManager)===null||r===void 0||r.setWithManualResources(this.withManualResources)),setTimeout(()=>this.stateManager.updateIfNeeded())}};M.elementDefinitions={};M.styles=ms;B([(0,G.property)()],M.prototype,"baseUrl",void 0);B([(0,G.property)()],M.prototype,"apiIntegrationIdentifier",void 0);B([(0,G.property)()],M.prototype,"apiIntegrationAppVersion",void 0);B([(0,G.property)()],M.prototype,"uiLocale",void 0);B([(0,Ee.jsonProperty)(null)],M.prototype,"availableUiLocales",void 0);B([(0,Ee.jsonProperty)(null)],M.prototype,"metadataConfiguration",void 0);B([(0,G.property)({type:Boolean})],M.prototype,"editorMode",void 0);B([(0,G.property)({type:Boolean})],M.prototype,"noCustom",void 0);B([(0,G.property)({type:Boolean})],M.prototype,"openExternalDocumentInNewTab",void 0);B([(0,G.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],M.prototype,"noCustomComponent",void 0);B([(0,G.property)({type:Boolean})],M.prototype,"withManualResources",void 0);B([(0,G.property)({type:Boolean})],M.prototype,"navigatorOnline",void 0);B([(0,G.property)({type:Boolean})],M.prototype,"forcedOffline",void 0);B([(0,G.property)({type:Boolean})],M.prototype,"authenticationRequired",void 0);B([(0,Ee.jsonProperty)([])],M.prototype,"messageContexts",void 0);B([(0,Ee.jsonProperty)(void 0)],M.prototype,"session",void 0);var Ss=w(L());var gs={"ft-app-context":M};(0,Ss.customElements)(gs);var xt=class extends j{constructor(e){super(!0,e),this.cache.registerFinal("search-configuration",async()=>(await this.awaitApi).getSearchConfiguration())}async launchSearch(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters),facets:[...e.facets].sort((n,s)=>n.id.localeCompare(s.id))};return this.cache.get("search-"+this.hash(r),async()=>(await this.awaitApi).search(e),120*1e3)}async launchSuggest(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters)};return this.cache.get("suggest-"+this.hash(r),async()=>(await this.awaitApi).getSuggestions(e),120*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}async getConfiguration(){return this.cache.get("search-configuration")}sortFilters(e){return e.map(r=>r.valueFilter==null?r:{...r,valueFilter:{...r.valueFilter,values:[...r.valueFilter.values].sort((n,s)=>n.localeCompare(s))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var Rt=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},_t=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},It=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n}})}},Qe=class t extends Event{constructor(){super(t.eventName)}};Qe.eventName="search-context-clear-all-filters";var Oi=t=>t.request.virtualField===Oe.TITLE_ONLY&&t.request.scope===xe.DOCUMENTS,xi=t=>t.request.keywordMatch==tt.MANDATORY,Xe=class t extends P.FtStateManager{static build(e,r){return new t(Ir(e.trim()||"context"),r)}constructor(e,r){super(),this.store=e,this.ignoreEmptyQuery=!1,this.canUpdateUiLocale=!1,this.openExternalDocumentInNewTab=!1,this.onNewNeededRequest=n=>{n==je.CLUSTERED_SEARCH&&this.launchSearch(this.buildSearchRequest(this.store.getState()))},this.localesDebouncer=new P.Debouncer(10),this.searchDebouncer=new P.Debouncer(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest(this.store.getState()))),this.buildSearchRequest=n=>({...n.request,facets:this.facetIds.map(s=>({id:s}))}),this.suggestDebouncer=new P.Debouncer(1e3),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest(this.store.getState()))),this.buildSuggestRequest=n=>{var s;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(s=n.request.sort)!==null&&s!==void 0?s:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch}},this.service=r??new xt,this.service.cache.addEventListener("clear-cache",n=>{n.detail.clearedKeys.includes("available-locales")&&this.updateLocales()}),this.searchWatcher=(0,P.watch)(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=(0,P.watch)(e,this.buildSuggestRequest,this.launchSuggest)}async initService(){return this.updateLocales(),this.service.getConfiguration().then(e=>{this.store.actions.configuration(e),this.setSortId(this.store.getState().request.sortId)}),this.launchSearch()}updateSearchRequest(e,r=!1){let n=(0,P.deepCopy)(this.store.getState().request);delete n.changedByConfiguration,this.store.actions.setRequest({...n,paging:{perPage:n.paging.perPage,page:r?1:n.paging.page},...e})}setQuery(e){this.updateSearchRequest({query:e},!0),this.setLiveQuery(e)}setContentLocale(e){var r,n;let s=(r=this.store.getState().locales)!==null&&r!==void 0?r:[],i=this.store.getState().request.contentLocale;if(e!=i){if(s.length>0){let a=o=>s.some(c=>c.lang==o);a(e)||(e=a(i)?i:s[0].lang)}this.updateSearchRequest({contentLocale:e,metadataFilters:[]},!0),this.canUpdateUiLocale&&(!((n=We.localesConfiguration)===null||n===void 0)&&n.searchLanguageSetsUiLanguage)&&e&&We.requestUiLocaleUpdate(e)}return e}forceContentLocale(e){this.updateSearchRequest({contentLocale:e})}setPageSize(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,perPage:isNaN(e)?20:(0,P.minmax)(1,e,1e3)}})}setPageNumber(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,page:isNaN(e)?1:Math.max(1,e)}})}get sortOptions(){var e,r;return(r=(e=this.store.getState().configuration)===null||e===void 0?void 0:e.sortOptions)!==null&&r!==void 0?r:[]}setSort(e){this.updateSearchRequest({sort:e},!0)}setSortId(e,r=!1){var n;let s=r?{changedByConfiguration:!0}:{};if(e==null||this.sortOptions.length==0)return this.updateSearchRequest({sortId:e,...s},!0),e;let i=(n=this.sortOptions.find(a=>a.id==e))!==null&&n!==void 0?n:this.sortOptions[0];return this.updateSearchRequest({sortId:i.id,...s},!0),i.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.updateSearchRequest({metadataFilters:r},!0)}setClusterSortCriterion(e){this.updateSearchRequest({clusterSortCriterions:e})}setSearchInDocumentTitlesOnly(e){e?this.updateSearchRequest({virtualField:Oe.TITLE_ONLY,scope:xe.DOCUMENTS},!0):this.updateSearchRequest({virtualField:Oe.EVERYWHERE,scope:xe.DEFAULT},!0)}setKeywordMatch(e){this.updateSearchRequest({keywordMatch:e},!0)}setVirtualField(e){this.updateSearchRequest({virtualField:e},!0)}get searchInDocumentTitlesOnly(){return Oi(this.store.getState())}get keywordMatch(){return xi(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new Qe)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(s=>s!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(s=>({id:s}));this.updateSearchRequest({facets:n})}setFilter(e,r){this.setValueFilter(e,r)}setValueFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(a=>!a.valueFilter),...n.filter(a=>a.valueFilter&&a.key!==s.key),s];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,dateFilter:{type:r}},i=[...n.filter(a=>!a.dateFilter),...n.filter(a=>a.dateFilter&&a.key!==s.key),s];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.dateFilter),...r.filter(s=>s.dateFilter&&s.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let s=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},a=[...s.filter(o=>!o.rangeFilter),...s.filter(o=>o.rangeFilter&&o.key!==i.key),i];this.setFilters(a)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.rangeFilter),...r.filter(s=>s.rangeFilter&&s.key!==e)];this.setFilters(n)}setLiveQuery(e){this.store.actions.liveQuery(e)}setRequest(e){this.updateSearchRequest({...e,facets:this.store.getState().request.facets},!0),this.setLiveQuery(e.query)}setScope(e){this.updateSearchRequest({scope:e})}setOtherQueryParams(e){this.updateSearchRequest({otherQueryParams:e})}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}setCanUpdateUiLocale(e){this.canUpdateUiLocale=e}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales))}async fetchSearchData(e){var r,n,s,i,a;if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),!!this.isRequestNeeded(je.CLUSTERED_SEARCH))try{if(this.store.actions.paging(void 0),this.ignoreEmptyQuery&&e.query.length==0)this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0);else{!((n=this.store.getState().results)===null||n===void 0)&&n.length||this.store.actions.results(void 0),this.cancelableSearch=(0,P.cancelable)(this.service.launchSearch(e));let o=await this.cancelableSearch;if(this.store.actions.announcements(o.announcements),o.paging.currentPage<=1)this.store.actions.results(o.results),this.store.actions.facets(o.facets),this.store.actions.spellcheck(o.spellcheck);else{let c=((s=this.store.getState().results)!==null&&s!==void 0?s:[]).concat(o.results);this.store.actions.results(c),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(o.paging.currentPage-1)*((i=e.paging.perPage)!==null&&i!==void 0?i:20)+1}`})}this.store.actions.paging(o.paging)}}catch(o){o instanceof P.CanceledPromiseError||(console.error(o),(a=this.errorHandler)===null||a===void 0||a.call(this,o))}}async fetchSuggestData(e){var r;try{if((r=this.cancelableSuggest)===null||r===void 0||r.cancel(),e.input.length!=0&&e.input.length<3)return;this.cancelableSuggest=(0,P.cancelable)(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof P.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(n)}}clear(){this.store.clear()}clearResults(){this.store.actions.paging(void 0),this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0)}};var bs=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},Ar=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},As=Symbol("registerInterval"),Sr=Symbol("registerAttempts"),Ri=40,_i=(0,Fe.applyMixinOnce)(Symbol("toFtSearchComponent"),function(t){class e extends t{constructor(){super(...arguments),this.neededSearchRequests=[]}willUpdate(n){var s,i,a;super.willUpdate(n),n.has("neededSearchRequests")&&((s=this.stateManager)===null||s===void 0||s.unregisterComponent(this,(i=n.get("neededSearchRequests"))!==null&&i!==void 0?i:[]),(a=this.stateManager)===null||a===void 0||a.registerComponent(this,this.neededSearchRequests))}setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.stateManager.registerComponent(this,this.neededSearchRequests),this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.stateManager.unregisterComponent(this,this.neededSearchRequests),this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[Sr]=0,this.tryToRegisterToContext(),this[As]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[Sr]>Ri?window.clearInterval(this[As]):(this[Sr]++,this.dispatchEvent(new Ar))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return bs([(0,br.state)()],e.prototype,"stateManager",void 0),bs([(0,br.state)({hasChanged:Fe.hasChanged})],e.prototype,"neededSearchRequests",void 0),e}),Es=class extends _i(Fe.FtLitElementRedux){};var Pt=w(L());function Mt(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function Dt(t){var e,r;return t.dateFilter?{key:t.key,type:"DATE",dateValue:t.dateFilter.type}:t.rangeFilter?{key:t.key,type:"RANGE",from:t.rangeFilter.from,to:t.rangeFilter.to}:{key:t.key,values:(e=t.valueFilter)===null||e===void 0?void 0:e.values,negative:(r=t.valueFilter)===null||r===void 0?void 0:r.negative}}var Lt=class{constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.enableAnalyticsEvents=!0,this.appName=void 0,this.appVersion=void 0,this.document=void 0,this.sendEvent=([n,s])=>{if(!this.canSendEvent()||!n)return;let i=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(i,n,s):this.sendDocumentSearchEvent(i,n,s)},this.eventsService=r??new wt,this.resultsWatcher=(0,Pt.watch)(e,n=>[n.results,n.paging],this.sendEvent)}setEnableAnalyticsEvents(e){this.enableAnalyticsEvents=e}setAppName(e){this.appName=e}setAppVersion(e){this.appVersion=e}setDocumentSearch(e){this.document=e}setDocumentSearchFromMap(e){this.setDocumentSearch(this.eventsService.convertMapToAnalyticsDocument(e))}initAppInfo(){let{apiIntegrationIdentifier:e,apiIntegrationAppVersion:r}=g.getState();this.setAppName(e??"unknown"),this.setAppVersion(r??"unknown")}canSendEvent(){if(this.appName==null||this.appVersion==null)return console.debug("ft-search-context.eventManager is not initialized. No events will be sent!"),!1;let{editorMode:e}=g.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r,n){let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n?n.totalClustersCount:r.length},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:Mt(e.metadataFilters),facets:e.metadataFilters.map(i=>Dt(i))}};this.eventsService.sendKhubSearchEvent(s)}sendDocumentSearchEvent(e,r,n){if(e.metadataFilters.find(i=>{var a;return i.key==="ft:publicationId"&&((a=i.valueFilter)===null||a===void 0?void 0:a.values[0])===this.document.id})!==void 0){let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n?n.totalClustersCount:r.length},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(i)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==Y.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:Mt(n.metadataFilters),facets:n.metadataFilters.map(a=>Dt(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==Y.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:pe.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:Mt(n.metadataFilters),facets:n.metadataFilters.map(a=>Dt(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case Y.MAP:return{id:e.map.mapId,title:e.map.title,type:ie.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case Y.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:ie.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case Y.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:ie.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};case Y.HTML_PACKAGE:return{id:e.htmlPackage.packageId,title:e.htmlPackage.title,type:ie.HTML_PACKAGE,metadata:e.htmlPackage.metadata};case Y.HTML_PACKAGE_PAGE:return{id:e.htmlPackagePage.packageId,title:e.htmlPackagePage.title,type:ie.HTML_PACKAGE,metadata:e.htmlPackagePage.metadata};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r;return(r=(0,Pt.accessResult)(e))===null||r===void 0?void 0:r.originUrl}};var k=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},R=class extends q.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=Xe.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=r=>this.handleLoadError(r),this.addStore(this.stateManager.store,"search")}return this._stateManager}get eventManager(){return this._eventManager==null&&(this._eventManager=new Lt(this.stateManager.store)),this._eventManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.otherQueryParams={},this._appIntegrationInfoReady=!1,this.addStore(g)}render(){return Ts.html`
5
+ `}connectedCallback(){super.connectedCallback(),this.stateManager.initService()}disconnectedCallback(){super.disconnectedCallback()}update(e){var r;super.update(e),e.has("baseUrl")&&this.stateManager.setBaseUrl(this.baseUrl),e.has("apiIntegrationIdentifier")&&this.stateManager.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),e.has("apiIntegrationAppVersion")&&this.stateManager.setApiIntegrationAppVersion(this.apiIntegrationAppVersion),e.has("uiLocale")&&this.stateManager.setUiLocale(this.uiLocale),e.has("metadataConfiguration")&&this.stateManager.setMetadataConfiguration(this.metadataConfiguration),e.has("noCustom")&&this.stateManager.setNoCustom(this.noCustom),e.has("editorMode")&&this.stateManager.setEditorMode(this.editorMode),e.has("noCustomComponent")&&this.stateManager.setNoCustomComponent(this.noCustomComponent),e.has("session")&&this.stateManager.setSession(this.session),e.has("messageContexts")&&this.messageContexts!=null&&this.messageContexts.forEach(n=>Qn.addContext(n)),e.has("openExternalDocumentInNewTab")&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("navigatorOnline")&&this.stateManager.setNavigatorOnline(this.navigatorOnline),e.has("forcedOffline")&&this.stateManager.setForcedOffline(this.forcedOffline),e.has("authenticationRequired")&&this.stateManager.setAuthenticationRequired(this.authenticationRequired),e.has("withManualResources")&&((r=this.stateManager)===null||r===void 0||r.setWithManualResources(this.withManualResources)),setTimeout(()=>this.stateManager.updateIfNeeded())}};O.elementDefinitions={};O.styles=ts;D([(0,N.property)()],O.prototype,"baseUrl",void 0);D([(0,N.property)()],O.prototype,"apiIntegrationIdentifier",void 0);D([(0,N.property)()],O.prototype,"apiIntegrationAppVersion",void 0);D([(0,N.property)()],O.prototype,"uiLocale",void 0);D([(0,de.jsonProperty)(null)],O.prototype,"availableUiLocales",void 0);D([(0,de.jsonProperty)(null)],O.prototype,"metadataConfiguration",void 0);D([(0,N.property)({type:Boolean})],O.prototype,"editorMode",void 0);D([(0,N.property)({type:Boolean})],O.prototype,"noCustom",void 0);D([(0,N.property)({type:Boolean})],O.prototype,"openExternalDocumentInNewTab",void 0);D([(0,N.property)({converter:{fromAttribute(t){return t==="false"?!1:t==="true"||(t??!1)}}})],O.prototype,"noCustomComponent",void 0);D([(0,N.property)({type:Boolean})],O.prototype,"withManualResources",void 0);D([(0,N.property)({type:Boolean})],O.prototype,"navigatorOnline",void 0);D([(0,N.property)({type:Boolean})],O.prototype,"forcedOffline",void 0);D([(0,N.property)({type:Boolean})],O.prototype,"authenticationRequired",void 0);D([(0,de.jsonProperty)([])],O.prototype,"messageContexts",void 0);D([(0,de.jsonProperty)(void 0)],O.prototype,"session",void 0);var is=A(w());var ss={"ft-app-context":O};(0,is.customElements)(ss);var ht=class extends M{constructor(e){super(!0,e),this.cache.registerFinal("search-configuration",async()=>(await this.awaitApi).getSearchConfiguration())}async launchSearch(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters),facets:[...e.facets].sort((n,s)=>n.id.localeCompare(s.id))};return this.cache.get("search-"+this.hash(r),async()=>(await this.awaitApi).search(e),120*1e3)}async launchSuggest(e){let r={...e,metadataFilters:this.sortFilters(e.metadataFilters)};return this.cache.get("suggest-"+this.hash(r),async()=>(await this.awaitApi).getSuggestions(e),120*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}async getConfiguration(){return this.cache.get("search-configuration")}sortFilters(e){return e.map(r=>r.valueFilter==null?r:{...r,valueFilter:{...r.valueFilter,values:[...r.valueFilter.values].sort((n,s)=>n.localeCompare(s))}}).sort((r,n)=>r.key.localeCompare(n.key))}};var mt=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},yt=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},vt=class extends CustomEvent{constructor(e,r,n){super("ft-search-results-change",{detail:{request:e,paging:r,spellcheck:n}})}},Be=class t extends Event{constructor(){super(t.eventName)}};Be.eventName="search-context-clear-all-filters";var di=t=>t.request.virtualField===he.TITLE_ONLY&&t.request.scope===me.DOCUMENTS,fi=t=>t.request.keywordMatch==He.MANDATORY,qe=class t extends R.FtStateManager{static build(e,r){return new t(gr(e.trim()||"context"),r)}constructor(e,r){super(),this.store=e,this.ignoreEmptyQuery=!1,this.canUpdateUiLocale=!1,this.openExternalDocumentInNewTab=!1,this.onNewNeededRequest=n=>{n==Ie.CLUSTERED_SEARCH&&this.launchSearch(this.buildSearchRequest(this.store.getState()))},this.localesDebouncer=new R.Debouncer(10),this.searchDebouncer=new R.Debouncer(100),this.launchSearch=n=>this.searchDebouncer.run(()=>this.fetchSearchData(n??this.buildSearchRequest(this.store.getState()))),this.buildSearchRequest=n=>({...n.request,facets:this.facetIds.map(s=>({id:s}))}),this.suggestDebouncer=new R.Debouncer(1e3),this.launchSuggest=n=>this.suggestDebouncer.run(()=>this.fetchSuggestData(n??this.buildSuggestRequest(this.store.getState()))),this.buildSuggestRequest=n=>{var s;return{input:n.liveQuery,metadataFilters:n.request.metadataFilters,sort:(s=n.request.sort)!==null&&s!==void 0?s:[],sortId:n.request.sortId,contentLocale:n.request.contentLocale,scope:n.request.scope,keywordMatch:n.request.keywordMatch}},this.service=r??new ht,this.service.cache.addEventListener("clear-cache",n=>{n.detail.clearedKeys.includes("available-locales")&&this.updateLocales()}),this.searchWatcher=(0,R.watch)(e,this.buildSearchRequest,this.launchSearch),this.suggestWatcher=(0,R.watch)(e,this.buildSuggestRequest,this.launchSuggest)}async initService(){return this.updateLocales(),this.service.getConfiguration().then(e=>{this.store.actions.configuration(e),this.setSortId(this.store.getState().request.sortId)}),this.launchSearch()}updateSearchRequest(e,r=!1){let n=(0,R.deepCopy)(this.store.getState().request);delete n.changedByConfiguration,this.store.actions.setRequest({...n,paging:{perPage:n.paging.perPage,page:r?1:n.paging.page},...e})}setQuery(e){this.updateSearchRequest({query:e},!0),this.setLiveQuery(e)}setContentLocale(e){var r,n;let s=(r=this.store.getState().locales)!==null&&r!==void 0?r:[],i=this.store.getState().request.contentLocale;if(e!=i){if(s.length>0){let a=o=>s.some(c=>c.lang==o);a(e)||(e=a(i)?i:s[0].lang)}this.updateSearchRequest({contentLocale:e,metadataFilters:[]},!0),this.canUpdateUiLocale&&(!((n=je.localesConfiguration)===null||n===void 0)&&n.searchLanguageSetsUiLanguage)&&e&&je.requestUiLocaleUpdate(e)}return e}forceContentLocale(e){this.updateSearchRequest({contentLocale:e})}setPageSize(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,perPage:isNaN(e)?20:(0,R.minmax)(1,e,1e3)}})}setPageNumber(e){let r=this.store.getState().request;this.updateSearchRequest({paging:{...r.paging,page:isNaN(e)?1:Math.max(1,e)}})}get sortOptions(){var e,r;return(r=(e=this.store.getState().configuration)===null||e===void 0?void 0:e.sortOptions)!==null&&r!==void 0?r:[]}setSort(e){this.updateSearchRequest({sort:e},!0)}setSortId(e,r=!1){var n;let s=r?{changedByConfiguration:!0}:{};if(e==null||this.sortOptions.length==0)return this.updateSearchRequest({sortId:e,...s},!0),e;let i=(n=this.sortOptions.find(a=>a.id==e))!==null&&n!==void 0?n:this.sortOptions[0];return this.updateSearchRequest({sortId:i.id,...s},!0),i.id}setFilters(e){let r=e.filter(n=>!n.valueFilter||n.valueFilter.values.length>0);this.updateSearchRequest({metadataFilters:r},!0)}setClusterSortCriterion(e){this.updateSearchRequest({clusterSortCriterions:e})}setSearchInDocumentTitlesOnly(e){e?this.updateSearchRequest({virtualField:he.TITLE_ONLY,scope:me.DOCUMENTS},!0):this.updateSearchRequest({virtualField:he.EVERYWHERE,scope:me.DEFAULT},!0)}setKeywordMatch(e){this.updateSearchRequest({keywordMatch:e},!0)}setVirtualField(e){this.updateSearchRequest({virtualField:e},!0)}get searchInDocumentTitlesOnly(){return di(this.store.getState())}get keywordMatch(){return fi(this.store.getState())}clearAllFilters(){this.setFilters([]),this.store.dispatchEvent(new Be)}addFacet(e){this.facetIds=[...this.facetIds,e]}replaceFacet(e,r){let n=this.facetIds.filter(s=>s!=e);r&&n.push(r),this.facetIds=n}get facetIds(){var e;let r=this.store.getState().request;return[...new Set([...r.facets.map(n=>n.id),...((e=r.metadataFilters)!==null&&e!==void 0?e:[]).map(n=>n.key)])]}set facetIds(e){let n=[...new Set(e)].map(s=>({id:s}));this.updateSearchRequest({facets:n})}setFilter(e,r){this.setValueFilter(e,r)}setValueFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,valueFilter:{values:r,negative:!1}},i=[...n.filter(a=>!a.valueFilter),...n.filter(a=>a.valueFilter&&a.key!==s.key),s];this.setFilters(i)}setDateFilter(e,r){let n=this.store.getState().request.metadataFilters,s={key:e,dateFilter:{type:r}},i=[...n.filter(a=>!a.dateFilter),...n.filter(a=>a.dateFilter&&a.key!==s.key),s];this.setFilters(i)}removeDateFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.dateFilter),...r.filter(s=>s.dateFilter&&s.key!==e)];this.setFilters(n)}setRangeFilter(e,r,n){let s=this.store.getState().request.metadataFilters,i={key:e,rangeFilter:{from:r,to:n}},a=[...s.filter(o=>!o.rangeFilter),...s.filter(o=>o.rangeFilter&&o.key!==i.key),i];this.setFilters(a)}removeRangeFilter(e){let r=this.store.getState().request.metadataFilters,n=[...r.filter(s=>!s.rangeFilter),...r.filter(s=>s.rangeFilter&&s.key!==e)];this.setFilters(n)}setLiveQuery(e){this.store.actions.liveQuery(e)}setRequest(e){this.updateSearchRequest({...e,facets:this.store.getState().request.facets},!0),this.setLiveQuery(e.query)}setScope(e){this.updateSearchRequest({scope:e})}setOtherQueryParams(e){this.updateSearchRequest({otherQueryParams:e})}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}setCanUpdateUiLocale(e){this.canUpdateUiLocale=e}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.locales((await this.service.getAvailableSearchLocales()).contentLocales))}async fetchSearchData(e){var r,n,s,i,a;if((r=this.cancelableSearch)===null||r===void 0||r.cancel(),!!this.isRequestNeeded(Ie.CLUSTERED_SEARCH))try{if(this.store.actions.paging(void 0),this.ignoreEmptyQuery&&e.query.length==0)this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0);else{!((n=this.store.getState().results)===null||n===void 0)&&n.length||this.store.actions.results(void 0),this.cancelableSearch=(0,R.cancelable)(this.service.launchSearch(e));let o=await this.cancelableSearch;if(this.store.actions.announcements(o.announcements),o.paging.currentPage<=1)this.store.actions.results(o.results),this.store.actions.facets(o.facets),this.store.actions.spellcheck(o.spellcheck);else{let c=((s=this.store.getState().results)!==null&&s!==void 0?s:[]).concat(o.results);this.store.actions.results(c),this.store.commands.clear(/^focus-result-/),this.store.commands.add({type:`focus-result-${(o.paging.currentPage-1)*((i=e.paging.perPage)!==null&&i!==void 0?i:20)+1}`})}this.store.actions.paging(o.paging)}}catch(o){o instanceof R.CanceledPromiseError||(console.error(o),(a=this.errorHandler)===null||a===void 0||a.call(this,o))}}async fetchSuggestData(e){var r;try{if((r=this.cancelableSuggest)===null||r===void 0||r.cancel(),e.input.length!=0&&e.input.length<3)return;this.cancelableSuggest=(0,R.cancelable)(this.service.launchSuggest(e));let n=await this.cancelableSuggest;this.store.actions.suggestResults(n.suggestions)}catch(n){!(n instanceof R.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(n)}}clear(){this.store.clear()}clearResults(){this.store.actions.paging(void 0),this.store.actions.results(void 0),this.store.actions.announcements(void 0),this.store.actions.facets(void 0),this.store.actions.spellcheck(void 0)}};var as=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},ur=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},os=Symbol("registerInterval"),ar=Symbol("registerAttempts"),pi=40,hi=(0,xe.applyMixinOnce)(Symbol("toFtSearchComponent"),function(t){class e extends t{constructor(){super(...arguments),this.neededSearchRequests=[]}willUpdate(n){var s,i,a;super.willUpdate(n),n.has("neededSearchRequests")&&((s=this.stateManager)===null||s===void 0||s.unregisterComponent(this,(i=n.get("neededSearchRequests"))!==null&&i!==void 0?i:[]),(a=this.stateManager)===null||a===void 0||a.registerComponent(this,this.neededSearchRequests))}setSearchStateManager(n){this.clearStateManager(),this.stateManager=n,this.stateManager.registerComponent(this,this.neededSearchRequests),this.addStore(n.store,"search")}clearStateManager(){this.stateManager&&(this.stateManager.unregisterComponent(this,this.neededSearchRequests),this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[ar]=0,this.tryToRegisterToContext(),this[os]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null||this[ar]>pi?window.clearInterval(this[os]):(this[ar]++,this.dispatchEvent(new ur))}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return as([(0,or.state)()],e.prototype,"stateManager",void 0),as([(0,or.state)({hasChanged:xe.hasChanged})],e.prototype,"neededSearchRequests",void 0),e}),us=class extends hi(xe.FtLitElementRedux){};var Et=A(w());function gt(t){return t.filter(e=>e.key==="ft:lastEdition").filter(e=>!e.valueFilter).map(e=>e.dateFilter?e.dateFilter.type:"CUSTOM").shift()}function St(t){var e,r;return t.dateFilter?{key:t.key,type:"DATE",dateValue:t.dateFilter.type}:t.rangeFilter?{key:t.key,type:"RANGE",from:t.rangeFilter.from,to:t.rangeFilter.to}:{key:t.key,values:(e=t.valueFilter)===null||e===void 0?void 0:e.values,negative:(r=t.valueFilter)===null||r===void 0?void 0:r.negative}}var At=class{constructor(e,r){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.enableAnalyticsEvents=!0,this.appName=void 0,this.appVersion=void 0,this.document=void 0,this.sendEvent=([n,s])=>{if(!this.canSendEvent()||!n)return;let i=this.store.getState().request;this.document==null?this.sendKhubSearchEvent(i,n,s):this.sendDocumentSearchEvent(i,n,s)},this.eventsService=r??new dt,this.resultsWatcher=(0,Et.watch)(e,n=>[n.results,n.paging],this.sendEvent)}setEnableAnalyticsEvents(e){this.enableAnalyticsEvents=e}setAppName(e){this.appName=e}setAppVersion(e){this.appVersion=e}setDocumentSearch(e){this.document=e}setDocumentSearchFromMap(e){this.setDocumentSearch(this.eventsService.convertMapToAnalyticsDocument(e))}initAppInfo(){let{apiIntegrationIdentifier:e,apiIntegrationAppVersion:r}=y.getState();this.setAppName(e??"unknown"),this.setAppVersion(r??"unknown")}canSendEvent(){if(this.appName==null||this.appVersion==null)return console.debug("ft-search-context.eventManager is not initialized. No events will be sent!"),!1;let{editorMode:e}=y.getState();return this.enableAnalyticsEvents&&!e}sendKhubSearchEvent(e,r,n){let s={offline:!1,appVersion:this.appVersion,appName:this.appName,name:ne.KHUB__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n?n.totalClustersCount:r.length},searchQuery:{terms:e.query,searchType:e.virtualField,lastUpdate:gt(e.metadataFilters),facets:e.metadataFilters.map(i=>St(i))}};this.eventsService.sendKhubSearchEvent(s)}sendDocumentSearchEvent(e,r,n){if(e.metadataFilters.find(i=>{var a;return i.key==="ft:publicationId"&&((a=i.valueFilter)===null||a===void 0?void 0:a.values[0])===this.document.id})!==void 0){let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:ne.DOCUMENT__SEARCH,searchResponse:{autocorrect:this.store.getState().spellcheck!=null,nbResults:n?n.totalClustersCount:r.length},searchQuery:{terms:e.query},document:this.document};this.eventsService.sendDocumentSearchEvent(i)}}sendResultClickedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==H.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:ne.SEARCH_PAGE__SELECT,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:gt(n.metadataFilters),facets:n.metadataFilters.map(a=>St(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchPageSelectEvent(i)}sendResultContextMenuOpenedEvent(e,r){if(!this.canSendEvent())return;let n=this.store.getState().request,s;e.type==H.TOPIC&&(s={tocId:e.topic.tocId,title:e.topic.title});let i={offline:!1,appVersion:this.appVersion,appName:this.appName,name:ne.SEARCH_RESULT__OPEN_BROWSER_CONTEXT_MENU,searchQuery:{terms:n.query,searchType:n.virtualField,lastUpdate:gt(n.metadataFilters),facets:n.metadataFilters.map(a=>St(a))},searchResult:{rank:r,type:e.type,document:this.convertDocument(e),topic:s},externalLink:this.convertExternalLink(e)};this.eventsService.sendSearchResultOpenContextMenuEvent(i)}convertDocument(e){switch(e.type){case H.MAP:return{id:e.map.mapId,title:e.map.title,type:X.STRUCTURED_DOCUMENT,metadata:e.map.metadata};case H.TOPIC:return{id:e.topic.mapId,title:e.topic.mapTitle,type:X.STRUCTURED_DOCUMENT,metadata:e.topic.metadata};case H.DOCUMENT:return{id:e.document.documentId,title:e.document.title,type:X.UNSTRUCTURED_DOCUMENT,metadata:e.document.metadata,mimeType:e.document.mimeType};case H.HTML_PACKAGE:return{id:e.htmlPackage.packageId,title:e.htmlPackage.title,type:X.HTML_PACKAGE,metadata:e.htmlPackage.metadata};case H.HTML_PACKAGE_PAGE:return{id:e.htmlPackagePage.packageId,title:e.htmlPackagePage.title,type:X.HTML_PACKAGE,metadata:e.htmlPackagePage.metadata};default:throw new TypeError("Unknown type "+e.type)}}convertExternalLink(e){var r;return(r=(0,Et.accessResult)(e))===null||r===void 0?void 0:r.originUrl}};var _=function(t,e,r,n){var s=arguments.length,i=s<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,r,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(i=(s<3?a(i):s>3?a(e,r,i):a(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i},b=class extends k.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=qe.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=r=>this.handleLoadError(r),this.addStore(this.stateManager.store,"search")}return this._stateManager}get eventManager(){return this._eventManager==null&&(this._eventManager=new At(this.stateManager.store)),this._eventManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.otherQueryParams={},this._appIntegrationInfoReady=!1,this.addStore(y)}render(){return cs.html`
7
6
  <slot @register-ft-search-component=${this.registerComponent} @ft-search-result-click=${this.onResultClicked}
8
7
  @ft-search-result-open-context-menu=${this.onResultContextMenuOpened}></slot>
9
- `}willUpdate(e){super.willUpdate(e),e.has("_appIntegrationInfoReady")&&this._appIntegrationInfoReady&&this.eventManager.initAppInfo(),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.forceContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sortId")&&this.stateManager.setSortId(this.sortId),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("keywordMatch")&&this.stateManager.setKeywordMatch(this.keywordMatch),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),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("otherQueryParams")&&this.otherQueryParams!==void 0&&this.stateManager.setOtherQueryParams(this.otherQueryParams),e.has("session")&&this.session!==void 0&&e.get("session")!=null&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.clearResults(),this.stateManager.setQuery(this.query),this.stateManager.forceContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort),this.stateManager.setOtherQueryParams(this.otherQueryParams)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new _t(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new It(this.request,this.paging,this.spellcheckAutocorrect))}registerComponent(e){e.stopPropagation();let r=e.composedPath()[0];this.register(r)}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new Rt(e))}reloadSavedSearches(){fr.clearMySearches()}clear(){this.stateManager.clear()}onResultClicked(e){this.eventManager.sendResultClickedEvent(e.detail.result,e.detail.rank)}onResultContextMenuOpened(e){this.eventManager.sendResultContextMenuOpenedEvent(e.detail.result,e.detail.rank)}};R.elementDefinitions={};R.styles=Rr;k([(0,q.redux)({store:g.name})],R.prototype,"session",void 0);k([(0,ee.property)()],R.prototype,"query",void 0);k([(0,ee.property)()],R.prototype,"contentLocale",void 0);k([(0,q.numberProperty)()],R.prototype,"pageSize",void 0);k([(0,ee.property)({type:Boolean})],R.prototype,"searchInDocumentTitlesOnly",void 0);k([(0,ee.property)()],R.prototype,"keywordMatch",void 0);k([(0,ee.property)()],R.prototype,"scope",void 0);k([(0,ee.property)()],R.prototype,"virtualField",void 0);k([(0,ee.property)({type:Boolean})],R.prototype,"ignoreEmptyQuery",void 0);k([(0,q.redux)({store:g.name})],R.prototype,"openExternalDocumentInNewTab",void 0);k([(0,q.jsonProperty)([])],R.prototype,"filters",void 0);k([(0,ee.property)()],R.prototype,"sortId",void 0);k([(0,q.jsonProperty)([])],R.prototype,"sort",void 0);k([(0,q.jsonProperty)({})],R.prototype,"otherQueryParams",void 0);k([(0,q.redux)({store:"search"})],R.prototype,"request",void 0);k([(0,q.redux)({store:"search"})],R.prototype,"paging",void 0);k([(0,q.redux)({store:"search",selector:t=>t.spellcheck})],R.prototype,"spellcheckAutocorrect",void 0);k([(0,q.redux)({store:g.name,selector:t=>t.apiIntegrationIdentifier!==void 0&&t.apiIntegrationAppVersion!==void 0})],R.prototype,"_appIntegrationInfoReady",void 0);k([(0,ee.property)({attribute:!1})],R.prototype,"searchServiceProvider",void 0);var ws={"ft-search-context":R};(0,Cs.customElements)(ws);})();
8
+ `}willUpdate(e){super.willUpdate(e),e.has("_appIntegrationInfoReady")&&this._appIntegrationInfoReady&&this.eventManager.initAppInfo(),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.forceContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sortId")&&this.stateManager.setSortId(this.sortId),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("keywordMatch")&&this.stateManager.setKeywordMatch(this.keywordMatch),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),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("otherQueryParams")&&this.otherQueryParams!==void 0&&this.stateManager.setOtherQueryParams(this.otherQueryParams),e.has("session")&&this.session!==void 0&&e.get("session")!=null&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.clearResults(),this.stateManager.setQuery(this.query),this.stateManager.forceContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort),this.stateManager.setOtherQueryParams(this.otherQueryParams)}disconnectedCallback(){super.disconnectedCallback(),this.stateManager.clearResults()}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new yt(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new vt(this.request,this.paging,this.spellcheckAutocorrect))}registerComponent(e){e.stopPropagation();let r=e.composedPath()[0];this.register(r)}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new mt(e))}reloadSavedSearches(){Zt.clearMySearches()}clear(){this.stateManager.clear()}onResultClicked(e){this.eventManager.sendResultClickedEvent(e.detail.result,e.detail.rank)}onResultContextMenuOpened(e){this.eventManager.sendResultContextMenuOpenedEvent(e.detail.result,e.detail.rank)}};b.elementDefinitions={};b.styles=yr;_([(0,k.redux)({store:y.name})],b.prototype,"session",void 0);_([(0,G.property)()],b.prototype,"query",void 0);_([(0,G.property)()],b.prototype,"contentLocale",void 0);_([(0,k.numberProperty)()],b.prototype,"pageSize",void 0);_([(0,G.property)({type:Boolean})],b.prototype,"searchInDocumentTitlesOnly",void 0);_([(0,G.property)()],b.prototype,"keywordMatch",void 0);_([(0,G.property)()],b.prototype,"scope",void 0);_([(0,G.property)()],b.prototype,"virtualField",void 0);_([(0,G.property)({type:Boolean})],b.prototype,"ignoreEmptyQuery",void 0);_([(0,k.redux)({store:y.name})],b.prototype,"openExternalDocumentInNewTab",void 0);_([(0,k.jsonProperty)([])],b.prototype,"filters",void 0);_([(0,G.property)()],b.prototype,"sortId",void 0);_([(0,k.jsonProperty)([])],b.prototype,"sort",void 0);_([(0,k.jsonProperty)({})],b.prototype,"otherQueryParams",void 0);_([(0,k.redux)({store:"search"})],b.prototype,"request",void 0);_([(0,k.redux)({store:"search"})],b.prototype,"paging",void 0);_([(0,k.redux)({store:"search",selector:t=>t.spellcheck})],b.prototype,"spellcheckAutocorrect",void 0);_([(0,k.redux)({store:y.name,selector:t=>t.apiIntegrationIdentifier!==void 0&&t.apiIntegrationAppVersion!==void 0})],b.prototype,"_appIntegrationInfoReady",void 0);_([(0,G.property)({attribute:!1})],b.prototype,"searchServiceProvider",void 0);var ls={"ft-search-context":b};(0,ds.customElements)(ls);})();
10
9
  /*! Bundled license information:
11
10
 
12
11
  @lit/reactive-element/css-tag.js: