@fluid-topics/ft-reader-context 1.1.30 → 1.1.31

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,12 @@
1
- !function(t,i,e,s){class n{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,i,e){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,e)),null==t.tocId?this.extractPagesToc(t.children,i,e):[{tocId:t.tocId,title:t.title,depth:i,children:this.extractPagesToc(t.children,i+1,t.tocId)}])))}convertNodes(t,i,e){return t.flatMap((t=>{var s,n,r;if(null==t.tocId)return[...this.convertSectionNodes(null!==(s=t.pageToc)&&void 0!==s?s:[],i,t.tocId),...this.convertNodes(t.children,i,t.tocId)];let o=null===(n=t.prettyUrl)||void 0===n?void 0:n.replace(/^\//,"");const a={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:o,depth:i,parentTocId:e,children:[]};this.register(a);const h=this.convertSectionNodes(null!==(r=t.pageToc)&&void 0!==r?r:[],i+1,t.tocId),u=this.convertNodes(t.children,i+1,a.tocId);return a.children=[...h,...u],[a]}))}convertSectionNodes(t,i,e){return t.flatMap((t=>{var s;let n=null===(s=t.prettyUrl)||void 0===s?void 0:s.replace(/^\//,"");const r={...t,prettyUrl:n,depth:i,parentTocId:e,children:[]};return this.register(r),r.children=this.convertSectionNodes(t.children,i+1,t.tocId),[r]}))}buildPage(t,i){var e,s,n,r,o,a;const h={number:this.pages.length+1,title:null!==(e=t.title)&&void 0!==e?e:"",rootTocId:null!==(s=t.tocId)&&void 0!==s?s:"root",toc:(null!==(n=t.pageToc)&&void 0!==n?n:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:i?this.buildBreadcrumb(this.nodeByTocId[i]):[]},u=(t,i)=>(i?h.topics:h.hiddenTopics).push(t),c=null!==(o=null===(r=t.pageConfiguration)||void 0===r?void 0:r.parentsVisibility)&&void 0!==o?o:[];return h.breadcrumb.forEach(((t,i)=>{u(t,c[i])})),t.tocId&&u(t.tocId,t.pageConfiguration.isVisible),h.topics.push(...this.tocIds(null!==(a=t.pageToc)&&void 0!==a?a:[])),h}registerPage(t){for(let i of[...t.topics,...t.hiddenTopics])this.pageByTocId[i]||(this.pageByTocId[i]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const i=[t.tocId];for(;null==t?void 0:t.parentTocId;)i.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return i}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class r{convertPaginatedToc(t){return new n(t).build()}}var o,a,h,u,c,l,d,v,f,p,w,y,g,m,T,E,b,A;!function(t){!function(i){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function r(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function o(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var i={next:function(){var i=t.shift();return{done:void 0===i,value:i}}};return e.iterable&&(i[Symbol.iterator]=function(){return i}),i}function h(t){this.map={},t instanceof h?t.forEach((function(t,i){this.append(i,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(i){this.append(i,t[i])}),this)}function u(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function c(t){return new Promise((function(i,e){t.onload=function(){i(t.result)},t.onerror=function(){e(t.error)}}))}function l(t){var i=new FileReader,e=c(i);return i.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var i;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((i=t)&&DataView.prototype.isPrototypeOf(i))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,i,e,s=u(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,i=new FileReader,e=c(i),i.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var i=new Uint8Array(t),e=new Array(i.length),s=0;s<i.length;s++)e[s]=String.fromCharCode(i[s]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,i){t=r(t),i=o(i);var e=this.map[t];this.map[t]=e?e+", "+i:i},h.prototype.delete=function(t){delete this.map[r(t)]},h.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},h.prototype.set=function(t,i){this.map[r(t)]=o(i)},h.prototype.forEach=function(t,i){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(i,this.map[e],e,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(i,e){t.push(e)})),a(t)},h.prototype.values=function(){var t=[];return this.forEach((function(i){t.push(i)})),a(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(i,e){t.push([e,i])})),a(t)},e.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var f=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function p(t,i){var e,s,n=(i=i||{}).body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new h(i.headers)),this.method=(e=i.method||this.method||"GET",s=e.toUpperCase(),f.indexOf(s)>-1?s:e),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(t){var i=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),s=e.shift().replace(/\+/g," "),n=e.join("=").replace(/\+/g," ");i.append(decodeURIComponent(s),decodeURIComponent(n))}})),i}function y(t,i){i||(i={}),this.type="default",this.status=void 0===i.status?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new h(i.headers),this.url=i.url||"",this._initBody(t)}p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},v.call(p.prototype),v.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var g=[301,302,303,307,308];y.redirect=function(t,i){if(-1===g.indexOf(i))throw new RangeError("Invalid status code");return new y(null,{status:i,headers:{location:t}})},i.DOMException=t.DOMException;try{new i.DOMException}catch(t){i.DOMException=function(t,i){this.message=t,this.name=i;var e=Error(t);this.stack=e.stack},i.DOMException.prototype=Object.create(Error.prototype),i.DOMException.prototype.constructor=i.DOMException}function m(t,s){return new Promise((function(n,r){var o=new p(t,s);if(o.signal&&o.signal.aborted)return r(new i.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,i,e={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",i=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),s=e.shift().trim();if(s){var n=e.join(":").trim();i.append(s,n)}})),i)};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var s="response"in a?a.response:a.responseText;n(new y(s,e))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.onabort=function(){r(new i.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),o.headers.forEach((function(t,i){a.setRequestHeader(i,t)})),o.signal&&(o.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",u)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=h,t.Request=p,t.Response=y),i.Headers=h,i.Request=p,i.Response=y,i.fetch=m,Object.defineProperty(i,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(o||(o={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(a||(a={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(h||(h={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(u||(u={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(c||(c={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(l||(l={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(d||(d={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(v||(v={})),function(t){t.ASC="ASC",t.DESC="DESC"}(f||(f={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(p||(p={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(w||(w={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(y||(y={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(g||(g={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(m||(m={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(T||(T={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(E||(E={})),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.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(b||(b={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(A||(A={}));const S={[b.PERSONAL_BOOK_SHARE_USER]:[b.PERSONAL_BOOK_USER],[b.HTML_EXPORT_USER]:[b.PERSONAL_BOOK_USER],[b.PDF_EXPORT_USER]:[b.PERSONAL_BOOK_USER],[b.KHUB_ADMIN]:[b.CONTENT_PUBLISHER],[b.ADMIN]:[b.KHUB_ADMIN,b.USERS_ADMIN,b.PORTAL_ADMIN],[b.DEVELOPER]:[b.BETA_USER,b.DEBUG_USER]};function R(t,i){return t===i||(S[t]??[]).some((t=>R(t,i)))}function I(t,i){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>R(t,i)))}var O;t.FtReaderFeatures=void 0,(O=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",O.RATING="RATING",O.PRINT="PRINT",O.BOOKMARK="BOOKMARK",O.COLLECTIONS="COLLECTIONS",O.PERSONAL_BOOKS="PERSONAL_BOOKS";const C=e.css`
2
- `,U=i.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class P{static build(t){const{baseUrl:i,apiIntegrationIdentifier:e}=U.getState(),s=null!=t?t:e;if(i&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,s,!0)}static get(t){var i;return null!=t?P.build(t):null!==(i=P.API)&&void 0!==i?i:P.API=P.build()}static await(t){return new Promise((i=>{let e=P.get(t);if(e)i(e);else{const s=U.subscribe((()=>{e=P.get(t),e&&(s(),i(e))}))}}))}}var N;const L=Symbol("clearAfterUnitTest");class D{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[N]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=U.getState().uiLocale,U.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=U.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var s;if(t=t.toLowerCase(),Object.keys(e).length>0){const n={...null!==(s=this.defaultMessages[t])&&void 0!==s?s:{},...e};i.deepEqual(this.defaultMessages[t],n)||(this.defaultMessages[t]=n,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...s){var n,r,o;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(r=null===(n=this.cache.getNow(t))||void 0===n?void 0:n.messages)&&void 0!==r?r:{};return new i.ParametrizedLabelResolver(null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},a).resolve(e,...s)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,i){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(i),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(i)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>i.delay(0).then((()=>t())).catch((()=>null)))))}}N=L,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new D((async(t,i)=>(await P.await()).getFluidTopicsMessageContext(t,i)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new D((async(t,i)=>(await P.await()).getCustomMessageContext(t,i))));const M=window.FluidTopicsI18nService;var _=function(t,i,e,s){for(var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o};class k extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>P.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return e.html`
1
+ !function(t,i,e,s){class n{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,i,e){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,e)),null==t.tocId?this.extractPagesToc(t.children,i,e):[{tocId:t.tocId,title:t.title,depth:i,children:this.extractPagesToc(t.children,i+1,t.tocId)}])))}convertNodes(t,i,e){return t.flatMap((t=>{var s,n,r;if(null==t.tocId)return[...this.convertSectionNodes(null!==(s=t.pageToc)&&void 0!==s?s:[],i,t.tocId),...this.convertNodes(t.children,i,t.tocId)];let o=null===(n=t.prettyUrl)||void 0===n?void 0:n.replace(/^\//,"");const a={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:o,depth:i,parentTocId:e,children:[]};this.register(a);const h=this.convertSectionNodes(null!==(r=t.pageToc)&&void 0!==r?r:[],i+1,t.tocId),u=this.convertNodes(t.children,i+1,a.tocId);return a.children=[...h,...u],[a]}))}convertSectionNodes(t,i,e){return t.flatMap((t=>{var s;let n=null===(s=t.prettyUrl)||void 0===s?void 0:s.replace(/^\//,"");const r={...t,prettyUrl:n,depth:i,parentTocId:e,children:[]};return this.register(r),r.children=this.convertSectionNodes(t.children,i+1,t.tocId),[r]}))}buildPage(t,i){var e,s,n,r,o,a;const h={number:this.pages.length+1,title:null!==(e=t.title)&&void 0!==e?e:"",rootTocId:null!==(s=t.tocId)&&void 0!==s?s:"root",toc:(null!==(n=t.pageToc)&&void 0!==n?n:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:i?this.buildBreadcrumb(this.nodeByTocId[i]):[]},u=(t,i)=>(i?h.topics:h.hiddenTopics).push(t),c=null!==(o=null===(r=t.pageConfiguration)||void 0===r?void 0:r.parentsVisibility)&&void 0!==o?o:[];return h.breadcrumb.forEach(((t,i)=>{u(t,c[i])})),t.tocId&&u(t.tocId,t.pageConfiguration.isVisible),h.topics.push(...this.tocIds(null!==(a=t.pageToc)&&void 0!==a?a:[])),h}registerPage(t){for(let i of[...t.topics,...t.hiddenTopics])this.pageByTocId[i]||(this.pageByTocId[i]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const i=[t.tocId];for(;null==t?void 0:t.parentTocId;)i.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return i}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class r{convertPaginatedToc(t){return new n(t).build()}}var o,a,h,u,c,l,d,v,f,p,w,y,g,m,T,E,b,A;!function(t){!function(i){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function r(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function o(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var i={next:function(){var i=t.shift();return{done:void 0===i,value:i}}};return e.iterable&&(i[Symbol.iterator]=function(){return i}),i}function h(t){this.map={},t instanceof h?t.forEach((function(t,i){this.append(i,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(i){this.append(i,t[i])}),this)}function u(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function c(t){return new Promise((function(i,e){t.onload=function(){i(t.result)},t.onerror=function(){e(t.error)}}))}function l(t){var i=new FileReader,e=c(i);return i.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var i;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((i=t)&&DataView.prototype.isPrototypeOf(i))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,i,e,s=u(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,i=new FileReader,e=c(i),i.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var i=new Uint8Array(t),e=new Array(i.length),s=0;s<i.length;s++)e[s]=String.fromCharCode(i[s]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,i){t=r(t),i=o(i);var e=this.map[t];this.map[t]=e?e+", "+i:i},h.prototype.delete=function(t){delete this.map[r(t)]},h.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},h.prototype.set=function(t,i){this.map[r(t)]=o(i)},h.prototype.forEach=function(t,i){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(i,this.map[e],e,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(i,e){t.push(e)})),a(t)},h.prototype.values=function(){var t=[];return this.forEach((function(i){t.push(i)})),a(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(i,e){t.push([e,i])})),a(t)},e.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var f=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function p(t,i){var e,s,n=(i=i||{}).body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new h(i.headers)),this.method=(e=i.method||this.method||"GET",s=e.toUpperCase(),f.indexOf(s)>-1?s:e),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(t){var i=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),s=e.shift().replace(/\+/g," "),n=e.join("=").replace(/\+/g," ");i.append(decodeURIComponent(s),decodeURIComponent(n))}})),i}function y(t,i){i||(i={}),this.type="default",this.status=void 0===i.status?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new h(i.headers),this.url=i.url||"",this._initBody(t)}p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},v.call(p.prototype),v.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var g=[301,302,303,307,308];y.redirect=function(t,i){if(-1===g.indexOf(i))throw new RangeError("Invalid status code");return new y(null,{status:i,headers:{location:t}})},i.DOMException=t.DOMException;try{new i.DOMException}catch(t){i.DOMException=function(t,i){this.message=t,this.name=i;var e=Error(t);this.stack=e.stack},i.DOMException.prototype=Object.create(Error.prototype),i.DOMException.prototype.constructor=i.DOMException}function m(t,s){return new Promise((function(n,r){var o=new p(t,s);if(o.signal&&o.signal.aborted)return r(new i.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,i,e={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",i=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),s=e.shift().trim();if(s){var n=e.join(":").trim();i.append(s,n)}})),i)};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var s="response"in a?a.response:a.responseText;n(new y(s,e))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.onabort=function(){r(new i.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),o.headers.forEach((function(t,i){a.setRequestHeader(i,t)})),o.signal&&(o.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",u)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=h,t.Request=p,t.Response=y),i.Headers=h,i.Request=p,i.Response=y,i.fetch=m,Object.defineProperty(i,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(o||(o={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(a||(a={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(h||(h={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(u||(u={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(c||(c={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(l||(l={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(d||(d={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(v||(v={})),function(t){t.ASC="ASC",t.DESC="DESC"}(f||(f={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(p||(p={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(w||(w={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(y||(y={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(g||(g={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(m||(m={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(T||(T={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(E||(E={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(b||(b={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(A||(A={}));const S={[b.PERSONAL_BOOK_SHARE_USER]:[b.PERSONAL_BOOK_USER],[b.HTML_EXPORT_USER]:[b.PERSONAL_BOOK_USER],[b.PDF_EXPORT_USER]:[b.PERSONAL_BOOK_USER],[b.KHUB_ADMIN]:[b.CONTENT_PUBLISHER],[b.ADMIN]:[b.KHUB_ADMIN,b.USERS_ADMIN,b.PORTAL_ADMIN],[b.DEVELOPER]:[b.BETA_USER,b.DEBUG_USER]};function R(t,i){return t===i||(S[t]??[]).some((t=>R(t,i)))}function I(t,i){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>R(t,i)))}var O;t.FtReaderFeatures=void 0,(O=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",O.RATING="RATING",O.PRINT="PRINT",O.BOOKMARK="BOOKMARK",O.COLLECTIONS="COLLECTIONS",O.PERSONAL_BOOKS="PERSONAL_BOOKS";const U=e.css`
2
+ `,C=i.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class P{static build(t){const{baseUrl:i,apiIntegrationIdentifier:e}=C.getState(),s=null!=t?t:e;if(i&&s&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(i,s,!0)}static get(t){var i;return null!=t?P.build(t):null!==(i=P.API)&&void 0!==i?i:P.API=P.build()}static await(t){return new Promise((i=>{let e=P.get(t);if(e)i(e);else{const s=C.subscribe((()=>{e=P.get(t),e&&(s(),i(e))}))}}))}}var N;const L=Symbol("clearAfterUnitTest");class D{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[N]=()=>{this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={}},this.currentUiLocale=C.getState().uiLocale,C.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=C.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const i=t.name.toLowerCase();this.cache.setFinal(i,t),this.notify(i)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var s;if(t=t.toLowerCase(),Object.keys(e).length>0){const n={...null!==(s=this.defaultMessages[t])&&void 0!==s?s:{},...e};i.deepEqual(this.defaultMessages[t],n)||(this.defaultMessages[t]=n,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...s){var n,r,o;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(r=null===(n=this.cache.getNow(t))||void 0===n?void 0:n.messages)&&void 0!==r?r:{};return new i.ParametrizedLabelResolver(null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},a).resolve(e,...s)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,i){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(i),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(i)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>i.delay(0).then((()=>t())).catch((()=>null)))))}}N=L,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new D((async(t,i)=>(await P.await()).getFluidTopicsMessageContext(t,i)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new D((async(t,i)=>(await P.await()).getCustomMessageContext(t,i))));const M=window.FluidTopicsI18nService;var _=function(t,i,e,s){for(var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o};class k extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>P.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return e.html`
3
3
  <slot></slot>
4
- `}update(t){super.update(t),t.has("baseUrl")&&(U.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&U.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&U.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&U.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&U.actions.noCustom(this.noCustom),t.has("editorMode")&&U.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&U.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&U.actions.session(this.session),t.has("availableUiLocales")&&U.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>M.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}k.elementDefinitions={},k.styles=C,_([s.property()],k.prototype,"baseUrl",void 0),_([s.property()],k.prototype,"apiIntegrationIdentifier",void 0),_([s.property()],k.prototype,"uiLocale",void 0),_([i.jsonProperty(null)],k.prototype,"availableUiLocales",void 0),_([i.jsonProperty(null)],k.prototype,"metadataConfiguration",void 0),_([s.property({type:Boolean})],k.prototype,"editorMode",void 0),_([s.property({type:Boolean})],k.prototype,"noCustom",void 0),_([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],k.prototype,"noCustomComponent",void 0),_([s.property({type:Boolean})],k.prototype,"withManualResources",void 0),_([i.jsonProperty([])],k.prototype,"messageContexts",void 0),_([i.jsonProperty(void 0)],k.prototype,"session",void 0),_([s.property({type:Object})],k.prototype,"apiProvider",void 0);class B{async listMySearches(){var t;return(null===(t=U.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await P.await()).listMySearches(U.getState().session.profile.userId):[]}}const F=new i.CacheRegistry;class x{async listMyBookmarks(){return F.get("bookmarks",(async()=>(await P.await()).listMyBookmarks(U.getState().session.profile.userId)))}clearCache(){F.clear("bookmarks")}}const j=i.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const H=new class{constructor(){this.currentSession=U.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new x,U.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=U.getState();i.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){j.actions.savedSearches(void 0)}clearMyBookmarks(){j.actions.bookmarks(void 0)}async reloadMySearches(){const t=new B,i=await t.listMySearches();j.actions.savedSearches(i)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const i=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;j.actions.bookmarks(i)}}};i.customElement("ft-app-context")(k);class G{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,i,e,s){this.converter=t,this.api=i,this.cache=e,this._mapId=s,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,i;return I(null!==(i=null===(t=U.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==i?i:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var i;return null===(i=this.enrichedToc)||void 0===i?void 0:i.nodeByTocId[t]}async getPage(t){const i=await this.getEnrichedToc();return i.pages[t-1]||i.pages[0]}async getPageByTocId(t){const i=await this.getEnrichedToc();return i.pageByTocId[t]||i.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getAttachments(){return this.cache.get("map-attachments",(()=>this.fetchAttachments()))}getRelativesForDocument(t,i){return this.cache.get("document-relatives-"+t+"-"+i.join("-"),(()=>this.fetchRelativesForDocument(t,i)))}getRelativesForTopicInMap(t,i,e){return this.cache.get("topic-relatives-"+[t,i,...e].join("-"),(()=>this.fetchRelativesForTopicInMap(t,i,e)))}getAttachmentDownloadLink(t){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(t).content}?download=true`)}getLink(t,i,e){const s=this.getNavigationData(t,i,e),n=this.getReaderLinkPrefix()+(s.prettyUrl?s.prettyUrl:`${s.mapId}/${s.tocId}`),r=new URL(n,this.api.tenantBaseUrl);return null!=s.page&&r.searchParams.set("page",`${s.page}`),s.prettyUrlDuplicated&&r.searchParams.set("tocId",s.tocId),null!=s.section&&r.searchParams.set("section",s.section),r.href}getNavigationData(t,i,e){var s,n;t=t||"root";const r=this.enrichedToc,o=null==r?void 0:r.pageByTocId[t],a=null==r?void 0:r.nodeByTocId[t],h=null==a?void 0:a.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(s=null==a?void 0:a.title)&&void 0!==s?s:"",page:i&&o&&o.number!==i?i:void 0,prettyUrl:null!=h?h.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(n=null==r?void 0:r.duplicatedPrettyUrls.has(null!=h?h:""))&&void 0!==n&&n,section:e}}async getAccurateNavigationData(t,i,e){return await this.getEnrichedToc(),this.getNavigationData(t,i,e)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((i=>{var e;return i?{type:i.topics.type,rating:null===(e=i.topics)||void 0===e?void 0:e.ratings.find((i=>i.tocId===t))}:void 0}))}rateMap(t,i){return this.makeRateMapRequest(t,i).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,i){return this.makeMapFeedbackRequest(t,i)}rateTopic(t,i,e){return this.makeRateTopicRequest(t,i,e).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=U.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,i,e){return this.makeTopicFeedbackRequest(t,i,e)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let i=this.getTocNodeNow(t),e=[{tocId:i.tocId,title:i.title}],s=this.getTocNodeNow(i.parentTocId);for(;s;)e.unshift({tocId:s.tocId,title:s.title}),s=this.getTocNodeNow(s.parentTocId);return e}isFeatureAccessible(i,{session:e,ratingType:s}){if(!this.isFeatureAvailable(i))return!1;switch(i){case t.FtReaderFeatures.FEEDBACK:return I(null!=e?e:[],b.FEEDBACK_USER);case t.FtReaderFeatures.RATING:return I(null!=e?e:[],b.RATING_USER)&&null!=s&&s!==d.NO_RATING;case t.FtReaderFeatures.PRINT:return I(null!=e?e:[],b.PRINT_USER);case t.FtReaderFeatures.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case t.FtReaderFeatures.COLLECTIONS:return I(null!=e?e:[],b.COLLECTION_USER);case t.FtReaderFeatures.PERSONAL_BOOKS:return I(null!=e?e:[],b.PERSONAL_BOOK_USER);default:return!1}}makeAbsolute(t){return this.api.makeAbsolute(t)}}class K extends G{static async build(t){return new K(new r,await P.await(),new i.CacheRegistry,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){const i=await this.api.getMap(t);return this.fingerprint=i.fingerprint,i}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch((()=>[]))}fetchRelativesForDocument(t,i){return this.api.search({query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",filters:[{negative:!1,values:i,key:t}],sort:[],facets:[]})}fetchRelativesForTopicInMap(t,i,e){return this.api.search({query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",filters:[{negative:!1,values:e,key:i},{negative:!1,values:[t],key:"ft:publicationId"}],sort:[],facets:[]})}makeMapFeedbackRequest(t,i){return this.api.sendMapFeedback(this.mapId,t,i)}makeRateMapRequest(t,i){return this.api.rateMap(this.mapId,t,i)}makeRateTopicRequest(t,i,e){return this.api.rateTopic(this.mapId,t,i,e)}makeTopicFeedbackRequest(t,i,e){return this.api.sendTopicFeedback(this.mapId,t,i,e)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class q{static build(t,e){return new q((t=>i.FtReduxStore.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0}}))(t.trim()||"context"),null!=e?e:K.build)}constructor(t,e){this.store=t,this.metadataForSwitchToRelatives=new Set,this.loadDebouncer=new i.Debouncer(10),this.initService(e)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){return i.waitFor((()=>this.service))}async navigateToTopic(t,i,e){const s=await this.awaitService(),n=await(null!=e?s.getPage(e):s.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(n),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,n),section:i})}resolveValidNonRootTocId(t,i){var e,s,n;let r=null!==(e="root"===t?void 0:t)&&void 0!==e?e:i.rootTocId;return i.topics.includes(r)?r:null!==(n=null!==(s=i.topics[0])&&void 0!==s?s:i.hiddenTopics[0])&&void 0!==n?n:"root"}async navigateToPage(t){const i=await this.awaitService();let e=await i.getPage(t);this.store.actions.currentPage(e)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var t;(null===(t=this.service)||void 0===t?void 0:t.mapId)&&null==this.store.getState().map&&await this.loadDebouncer.run((()=>this.fetchData()))}clear(){var t;this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),this.store.actions.relatives(void 0),null===(t=this.service)||void 0===t||t.clear(),this.metadataForSwitchToRelatives=new Set,this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}async fetchData(){var t,e,s,n,r;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.map(t))),null===(s=this.service)||void 0===s?void 0:s.getToc().then((t=>this.store.actions.toc(t))),null===(n=this.service)||void 0===n?void 0:n.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(r=this.service)||void 0===r?void 0:r.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))]).then((()=>{this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives()}))}catch(t){!this.errorHandler||t instanceof i.CanceledPromiseError||this.errorHandler(t)}}fetchRelatives(){var t,i,e;const s=null===(t=this.store.getState().map)||void 0===t?void 0:t.metadata.filter((t=>{var i;return t.key==(null===(i=this.store.getState().configuration)||void 0===i?void 0:i.relativePivotMetadata)})).flatMap((t=>t.values));void 0!==s&&s.length>0&&(null===(i=this.service)||void 0===i||i.getRelativesForDocument(null===(e=this.store.getState().configuration)||void 0===e?void 0:e.relativePivotMetadata,s).then((t=>{const i=t.results.flatMap((t=>t.entries));this.store.actions.relatives(i),this.createClusteringHelper()})))}createClusteringHelper(){var t,e;this.store.getState().relatives&&(this.clusteringHelper=new i.ClusteringHelper(this.store.getState().relatives,this.store.getState().relatives.find((t=>{var i;return(null===(i=t.map)||void 0===i?void 0:i.mapId)==this.store.getState().mapId})),this.metadataForSwitchToRelatives,null!==(e=null===(t=U.getState().metadataConfiguration)||void 0===t?void 0:t.descriptors)&&void 0!==e?e:[]),this.store.eventBus.dispatchEvent(new CustomEvent("clustering-helper-created")))}async navigateToRelativeTopicIfFound(t){var e,s,n;const r=await i.waitFor((()=>{var t;return null===(t=this.store.getState().configuration)||void 0===t?void 0:t.relativeTopicPivotMetadata})),o=this.store.getState().mapId,a=await this.awaitService(),h=await a.getRelativesForTopicInMap(o,r,[t]);if(null===(n=null===(s=null===(e=null==h?void 0:h.results)||void 0===e?void 0:e[0])||void 0===s?void 0:s.entries)||void 0===n?void 0:n[0]){const t=h.results[0].entries[0].topic.tocId;return await this.navigateToTopic(t),!0}return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}registerMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.add(t),null==this.store.getState().relatives?this.fetchRelatives():this.createClusteringHelper()}unregisterMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.delete(t),this.createClusteringHelper()}}const V=e.css`
5
- `;class $ extends CustomEvent{constructor(t,i){super("ft-reader-map-loaded",{detail:{map:t,toc:i}})}}class X extends CustomEvent{constructor(t,i){super("ft-reader-visible-topics-change",{detail:{visibleTopics:i}})}}class Y extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class Q extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class W extends Event{constructor(){super("ft-reader-map-not-found")}}class z extends Event{constructor(){super("ft-reader-map-unauthorized")}}class J extends Event{constructor(){super("ft-reader-map-forbidden")}}class Z extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}}var tt=function(t,i,e,s){for(var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o};class it extends i.FtLitElementRedux{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new i.Debouncer(5),this.navigationDebouncer=new i.Debouncer(10),this.addStore(U)}render(){return e.html`
4
+ `}update(t){super.update(t),t.has("baseUrl")&&(C.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&C.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&C.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&C.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&C.actions.noCustom(this.noCustom),t.has("editorMode")&&C.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&C.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&C.actions.session(this.session),t.has("availableUiLocales")&&C.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>M.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}k.elementDefinitions={},k.styles=U,_([s.property()],k.prototype,"baseUrl",void 0),_([s.property()],k.prototype,"apiIntegrationIdentifier",void 0),_([s.property()],k.prototype,"uiLocale",void 0),_([i.jsonProperty(null)],k.prototype,"availableUiLocales",void 0),_([i.jsonProperty(null)],k.prototype,"metadataConfiguration",void 0),_([s.property({type:Boolean})],k.prototype,"editorMode",void 0),_([s.property({type:Boolean})],k.prototype,"noCustom",void 0),_([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],k.prototype,"noCustomComponent",void 0),_([s.property({type:Boolean})],k.prototype,"withManualResources",void 0),_([i.jsonProperty([])],k.prototype,"messageContexts",void 0),_([i.jsonProperty(void 0)],k.prototype,"session",void 0),_([s.property({type:Object})],k.prototype,"apiProvider",void 0);class B{async listMySearches(){var t;return(null===(t=C.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await P.await()).listMySearches(C.getState().session.profile.userId):[]}}const F=new i.CacheRegistry;class x{async listMyBookmarks(){return F.get("bookmarks",(async()=>(await P.await()).listMyBookmarks(C.getState().session.profile.userId)))}clearCache(){F.clear("bookmarks")}}const j=i.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const H=new class{constructor(){this.currentSession=C.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new x,C.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=C.getState();i.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){j.actions.savedSearches(void 0)}clearMyBookmarks(){j.actions.bookmarks(void 0)}async reloadMySearches(){const t=new B,i=await t.listMySearches();j.actions.savedSearches(i)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const i=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;j.actions.bookmarks(i)}}};i.customElement("ft-app-context")(k);class G{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,i,e,s){this.converter=t,this.api=i,this.cache=e,this._mapId=s,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,i;return I(null!==(i=null===(t=C.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==i?i:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var i;return null===(i=this.enrichedToc)||void 0===i?void 0:i.nodeByTocId[t]}async getPage(t){const i=await this.getEnrichedToc();return i.pages[t-1]||i.pages[0]}async getPageByTocId(t){const i=await this.getEnrichedToc();return i.pageByTocId[t]||i.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getAttachments(){return this.cache.get("map-attachments",(()=>this.fetchAttachments()))}getRelativesForDocument(t,i){return this.cache.get("document-relatives-"+t+"-"+i.join("-"),(()=>this.fetchRelativesForDocument(t,i)))}getRelativesForTopicInMap(t,i,e){return this.cache.get("topic-relatives-"+[t,i,...e].join("-"),(()=>this.fetchRelativesForTopicInMap(t,i,e)))}getAttachmentDownloadLink(t){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(t).content}?download=true`)}getLink(t,i,e){const s=this.getNavigationData(t,i,e),n=this.getReaderLinkPrefix()+(s.prettyUrl?s.prettyUrl:`${s.mapId}/${s.tocId}`),r=new URL(n,this.api.tenantBaseUrl);return null!=s.page&&r.searchParams.set("page",`${s.page}`),s.prettyUrlDuplicated&&r.searchParams.set("tocId",s.tocId),null!=s.section&&r.searchParams.set("section",s.section),r.href}getNavigationData(t,i,e){var s,n;t=t||"root";const r=this.enrichedToc,o=null==r?void 0:r.pageByTocId[t],a=null==r?void 0:r.nodeByTocId[t],h=null==a?void 0:a.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(s=null==a?void 0:a.title)&&void 0!==s?s:"",page:i&&o&&o.number!==i?i:void 0,prettyUrl:null!=h?h.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(n=null==r?void 0:r.duplicatedPrettyUrls.has(null!=h?h:""))&&void 0!==n&&n,section:e}}async getAccurateNavigationData(t,i,e){return await this.getEnrichedToc(),this.getNavigationData(t,i,e)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((i=>{var e;return i?{type:i.topics.type,rating:null===(e=i.topics)||void 0===e?void 0:e.ratings.find((i=>i.tocId===t))}:void 0}))}rateMap(t,i){return this.makeRateMapRequest(t,i).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,i){return this.makeMapFeedbackRequest(t,i)}rateTopic(t,i,e){return this.makeRateTopicRequest(t,i,e).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=C.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,i,e){return this.makeTopicFeedbackRequest(t,i,e)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let i=this.getTocNodeNow(t),e=[{tocId:i.tocId,title:i.title}],s=this.getTocNodeNow(i.parentTocId);for(;s;)e.unshift({tocId:s.tocId,title:s.title}),s=this.getTocNodeNow(s.parentTocId);return e}isFeatureAccessible(i,{session:e,ratingType:s}){if(!this.isFeatureAvailable(i))return!1;switch(i){case t.FtReaderFeatures.FEEDBACK:return I(null!=e?e:[],b.FEEDBACK_USER);case t.FtReaderFeatures.RATING:return I(null!=e?e:[],b.RATING_USER)&&null!=s&&s!==d.NO_RATING;case t.FtReaderFeatures.PRINT:return I(null!=e?e:[],b.PRINT_USER);case t.FtReaderFeatures.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case t.FtReaderFeatures.COLLECTIONS:return I(null!=e?e:[],b.COLLECTION_USER);case t.FtReaderFeatures.PERSONAL_BOOKS:return I(null!=e?e:[],b.PERSONAL_BOOK_USER);default:return!1}}makeAbsolute(t){return this.api.makeAbsolute(t)}}class K extends G{static async build(t){return new K(new r,await P.await(),new i.CacheRegistry,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){const i=await this.api.getMap(t);return this.fingerprint=i.fingerprint,i}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch((()=>[]))}fetchRelativesForDocument(t,i){return this.api.search({query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",filters:[{negative:!1,values:i,key:t}],sort:[],facets:[]})}fetchRelativesForTopicInMap(t,i,e){return this.api.search({query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",filters:[{negative:!1,values:e,key:i},{negative:!1,values:[t],key:"ft:publicationId"}],sort:[],facets:[]})}makeMapFeedbackRequest(t,i){return this.api.sendMapFeedback(this.mapId,t,i)}makeRateMapRequest(t,i){return this.api.rateMap(this.mapId,t,i)}makeRateTopicRequest(t,i,e){return this.api.rateTopic(this.mapId,t,i,e)}makeTopicFeedbackRequest(t,i,e){return this.api.sendTopicFeedback(this.mapId,t,i,e)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class q{static build(t,e){return new q((t=>i.FtReduxStore.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0}}))(t.trim()||"context"),null!=e?e:K.build)}constructor(t,e){this.store=t,this.metadataForSwitchToRelatives=new Set,this.loadDebouncer=new i.Debouncer(10),this.initService(e)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){return i.waitFor((()=>this.service))}async navigateToTopic(t,i,e){const s=await this.awaitService(),n=await(null!=e?s.getPage(e):s.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(n),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,n),section:i})}resolveValidNonRootTocId(t,i){var e,s,n;let r=null!==(e="root"===t?void 0:t)&&void 0!==e?e:i.rootTocId;return i.topics.includes(r)?r:null!==(n=null!==(s=i.topics[0])&&void 0!==s?s:i.hiddenTopics[0])&&void 0!==n?n:"root"}async navigateToPage(t){const i=await this.awaitService();let e=await i.getPage(t);this.store.actions.currentPage(e)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var t;(null===(t=this.service)||void 0===t?void 0:t.mapId)&&null==this.store.getState().map&&await this.loadDebouncer.run((()=>this.fetchData()))}clear(){var t;this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),this.store.actions.relatives(void 0),null===(t=this.service)||void 0===t||t.clear(),this.metadataForSwitchToRelatives=new Set,this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}async fetchData(){var t,e,s,n,r;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.map(t))),null===(s=this.service)||void 0===s?void 0:s.getToc().then((t=>this.store.actions.toc(t))),null===(n=this.service)||void 0===n?void 0:n.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(r=this.service)||void 0===r?void 0:r.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))]).then((()=>{this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives()}))}catch(t){!this.errorHandler||t instanceof i.CanceledPromiseError||this.errorHandler(t)}}fetchRelatives(){var t,i,e;const s=null===(t=this.store.getState().map)||void 0===t?void 0:t.metadata.filter((t=>{var i;return t.key==(null===(i=this.store.getState().configuration)||void 0===i?void 0:i.relativePivotMetadata)})).flatMap((t=>t.values));void 0!==s&&s.length>0&&(null===(i=this.service)||void 0===i||i.getRelativesForDocument(null===(e=this.store.getState().configuration)||void 0===e?void 0:e.relativePivotMetadata,s).then((t=>{const i=t.results.flatMap((t=>t.entries));this.store.actions.relatives(i),this.createClusteringHelper()})))}createClusteringHelper(){var t,e;this.store.getState().relatives&&(this.clusteringHelper=new i.ClusteringHelper(this.store.getState().relatives,this.store.getState().relatives.find((t=>{var i;return(null===(i=t.map)||void 0===i?void 0:i.mapId)==this.store.getState().mapId})),this.metadataForSwitchToRelatives,null!==(e=null===(t=C.getState().metadataConfiguration)||void 0===t?void 0:t.descriptors)&&void 0!==e?e:[]),this.store.eventBus.dispatchEvent(new CustomEvent("clustering-helper-created")))}async navigateToRelativeTopicIfFound(t){var e,s,n;const r=await i.waitFor((()=>{var t;return null===(t=this.store.getState().configuration)||void 0===t?void 0:t.relativeTopicPivotMetadata})),o=this.store.getState().mapId,a=await this.awaitService(),h=await a.getRelativesForTopicInMap(o,r,[t]);if(null===(n=null===(s=null===(e=null==h?void 0:h.results)||void 0===e?void 0:e[0])||void 0===s?void 0:s.entries)||void 0===n?void 0:n[0]){const t=h.results[0].entries[0].topic.tocId;return await this.navigateToTopic(t),!0}return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}registerMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.add(t),null==this.store.getState().relatives?this.fetchRelatives():this.createClusteringHelper()}unregisterMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.delete(t),this.createClusteringHelper()}}const V=e.css`
5
+ `;class $ extends CustomEvent{constructor(t,i){super("ft-reader-map-loaded",{detail:{map:t,toc:i}})}}class X extends CustomEvent{constructor(t,i){super("ft-reader-visible-topics-change",{detail:{visibleTopics:i}})}}class Y extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class Q extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class W extends Event{constructor(){super("ft-reader-map-not-found")}}class z extends Event{constructor(){super("ft-reader-map-unauthorized")}}class J extends Event{constructor(){super("ft-reader-map-forbidden")}}class Z extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}}var tt=function(t,i,e,s){for(var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o};class it extends i.FtLitElementRedux{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new i.Debouncer(5),this.navigationDebouncer=new i.Debouncer(10),this.addStore(C)}render(){return e.html`
6
6
  ${this.importStyleIfNeeded()}
7
7
  <slot @register-ft-reader-component=${this.registerComponent}></slot>
8
8
  `}importStyleIfNeeded(){var t,i;const s=null===(t=this.stateManager.service)||void 0===t?void 0:t.themeStylesheet();return!s||window.location.href.startsWith(null!==(i=this.baseUrl)&&void 0!==i?i:"")?e.nothing:e.html`
9
9
  <style>
10
10
  @import "${s}"
11
11
  </style>
12
- `}get stateManager(){return null==this._stateManager&&(this._stateManager=q.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const i=t.fontsStylesheet();if(i&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${i}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",i),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&this.stateManager.setMapId(this.mapId),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((i=>t.has(i)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var i;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new $(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(i=this.scrollTarget)||void 0===i?void 0:i.tocId)){const i=t.get("scrollTarget");null!=(null==i?void 0:i.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(i.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,i.section).then((t=>this.dispatchEvent(new Y(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var i;return this.stateManager.service.getAccurateNavigationData(t,null===(i=this.currentPage)||void 0===i?void 0:i.number)}))).then((t=>{let i=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var i;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(i=this.stateManager.service)||void 0===i?void 0:i.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new X(this.map,i))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.dispatchEvent(new Z)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const i=t.composedPath()[0];this.register(i)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const i=t;401===i.status?this.dispatchEvent(new z):403===i.status?this.dispatchEvent(new J):404===i.status?this.dispatchEvent(new W):this.dispatchEvent(new Q(t))}reloadBookmarks(){H.reloadBookmarks()}reloadRating(){var t;null===(t=this.stateManager.service)||void 0===t||t.reloadRating()}}var et;it.styles=V,tt([i.redux({store:U.name})],it.prototype,"baseUrl",void 0),tt([s.property()],it.prototype,"mapId",void 0),tt([s.property()],it.prototype,"tocId",void 0),tt([s.property()],it.prototype,"section",void 0),tt([s.property()],it.prototype,"topicPivot",void 0),tt([s.property()],it.prototype,"searchInDocumentQuery",void 0),tt([s.property({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:et}})],it.prototype,"page",void 0),tt([i.redux({store:"reader"})],it.prototype,"map",void 0),tt([i.redux({store:"reader"})],it.prototype,"toc",void 0),tt([i.redux({store:"reader"})],it.prototype,"visibleTopics",void 0),tt([i.redux({store:"reader"})],it.prototype,"currentPage",void 0),tt([i.redux({store:"reader"})],it.prototype,"scrollTarget",void 0),tt([s.property({attribute:!1})],it.prototype,"readerServiceProvider",void 0),i.customElement("ft-reader-context")(it),t.ForbiddenErrorEvent=J,t.FtOfficialReaderService=K,t.FtReaderContext=it,t.FtReaderContextCssVariables={},t.FtReaderConverter=r,t.FtReaderService=G,t.LoadErrorEvent=Q,t.MapLoadedEvent=$,t.NavigationDoneEvent=Y,t.NotFoundErrorEvent=W,t.TopicRelativeNotFoundEvent=Z,t.UnauthorizedErrorEvent=z,t.VisibleTopicsChangeEvent=X,t.styles=V}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
12
+ `}get stateManager(){return null==this._stateManager&&(this._stateManager=q.build(this.id||(""+Math.round(999e3*Math.random())).padStart(6,"0"),this.readerServiceProvider),this._stateManager.errorHandler=t=>this.handleLoadError(t),this.addStore(this.stateManager.store,"reader")),this._stateManager}connectedCallback(){super.connectedCallback(),this.stateManager.setMapId(this.mapId),this.stateManager.awaitService().then((t=>{const i=t.fontsStylesheet();if(i&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${i}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",i),document.head.append(t)}}))}update(t){super.update(t),t.has("readerServiceProvider")&&this.readerServiceProvider&&this.stateManager.initService(this.readerServiceProvider),t.has("mapId")&&this.mapId&&this.stateManager.setMapId(this.mapId),t.has("searchInDocumentQuery")&&null!=this.searchInDocumentQuery&&this.stateManager.setSearchInDocumentQuery(this.searchInDocumentQuery),["tocId","section","page","mapId","topicPivot"].some((i=>t.has(i)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var i;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new $(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(i=this.scrollTarget)||void 0===i?void 0:i.tocId)){const i=t.get("scrollTarget");null!=(null==i?void 0:i.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(i.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,i.section).then((t=>this.dispatchEvent(new Y(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var i;return this.stateManager.service.getAccurateNavigationData(t,null===(i=this.currentPage)||void 0===i?void 0:i.number)}))).then((t=>{let i=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var i;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(i=this.stateManager.service)||void 0===i?void 0:i.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new X(this.map,i))}))}clear(){this.stateManager.clear()}async reload(){this.clear(),await this.navigateToTarget()}async navigateToTarget(){await this.stateManager.load(),await this.navigationDebouncer.run((async()=>{if(null!=this.topicPivot){await this.stateManager.navigateToRelativeTopicIfFound(this.topicPivot)||this.dispatchEvent(new Z)}else null!=this.tocId?await this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&await this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const i=t.composedPath()[0];this.register(i)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const i=t;401===i.status?this.dispatchEvent(new z):403===i.status?this.dispatchEvent(new J):404===i.status?this.dispatchEvent(new W):this.dispatchEvent(new Q(t))}reloadBookmarks(){H.reloadBookmarks()}reloadRating(){var t;null===(t=this.stateManager.service)||void 0===t||t.reloadRating()}}var et;it.styles=V,tt([i.redux({store:C.name})],it.prototype,"baseUrl",void 0),tt([s.property()],it.prototype,"mapId",void 0),tt([s.property()],it.prototype,"tocId",void 0),tt([s.property()],it.prototype,"section",void 0),tt([s.property()],it.prototype,"topicPivot",void 0),tt([s.property()],it.prototype,"searchInDocumentQuery",void 0),tt([s.property({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:et}})],it.prototype,"page",void 0),tt([i.redux({store:"reader"})],it.prototype,"map",void 0),tt([i.redux({store:"reader"})],it.prototype,"toc",void 0),tt([i.redux({store:"reader"})],it.prototype,"visibleTopics",void 0),tt([i.redux({store:"reader"})],it.prototype,"currentPage",void 0),tt([i.redux({store:"reader"})],it.prototype,"scrollTarget",void 0),tt([s.property({attribute:!1})],it.prototype,"readerServiceProvider",void 0),i.customElement("ft-reader-context")(it),t.ForbiddenErrorEvent=J,t.FtOfficialReaderService=K,t.FtReaderContext=it,t.FtReaderContextCssVariables={},t.FtReaderConverter=r,t.FtReaderService=G,t.LoadErrorEvent=Q,t.MapLoadedEvent=$,t.NavigationDoneEvent=Y,t.NotFoundErrorEvent=W,t.TopicRelativeNotFoundEvent=Z,t.UnauthorizedErrorEvent=z,t.VisibleTopicsChangeEvent=X,t.styles=V}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
@@ -33,7 +33,7 @@ const R={attribute:!0,type:String,converter:S,reflect:!1,hasChanged:E},U=(t=R,o,
33
33
  * @license
34
34
  * Copyright 2017 Google LLC
35
35
  * SPDX-License-Identifier: BSD-3-Clause
36
- */const T=globalThis,M=T.trustedTypes,P=M?M.createPolicy("lit-html",{createHTML:t=>t}):void 0,j="$lit$",D=`lit$${(Math.random()+"").slice(9)}$`,F="?"+D,Z=`<${F}>`,B=document,_=()=>B.createComment(""),$=t=>null===t||"object"!=typeof t&&"function"!=typeof t,z=Array.isArray,H="[ \t\n\f\r]",G=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,q=/-->/g,V=/>/g,Y=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),J=/'/g,X=/"/g,Q=/^(?:script|style|textarea|title)$/i,tt=Symbol.for("lit-noChange"),ot=Symbol.for("lit-nothing"),et=new WeakMap,rt=B.createTreeWalker(B,129);function it(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(o):o}let nt=class t{constructor({strings:o,_$litType$:e},r){let i;this.parts=[];let n=0,a=0;const s=o.length-1,c=this.parts,[l,f]=((t,o)=>{const e=t.length-1,r=[];let i,n=2===o?"<svg>":"",a=G;for(let o=0;o<e;o++){const e=t[o];let s,c,l=-1,f=0;for(;f<e.length&&(a.lastIndex=f,c=a.exec(e),null!==c);)f=a.lastIndex,a===G?"!--"===c[1]?a=q:void 0!==c[1]?a=V:void 0!==c[2]?(Q.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Y):void 0!==c[3]&&(a=Y):a===Y?">"===c[0]?(a=i??G,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?Y:'"'===c[3]?X:J):a===X||a===J?a=Y:a===q||a===V?a=G:(a=Y,i=void 0);const h=a===Y&&t[o+1].startsWith("/>")?" ":"";n+=a===G?e+Z:l>=0?(r.push(s),e.slice(0,l)+j+e.slice(l)+D+h):e+D+(-2===l?o:h)}return[it(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),r]})(o,e);if(this.el=t.createElement(l,r),rt.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=rt.nextNode())&&c.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(j)){const o=f[a++],e=i.getAttribute(t).split(D),r=/([.?@])?(.*)/.exec(o);c.push({type:1,index:n,name:r[2],strings:e,ctor:"."===r[1]?lt:"?"===r[1]?ft:"@"===r[1]?ht:ct}),i.removeAttribute(t)}else t.startsWith(D)&&(c.push({type:6,index:n}),i.removeAttribute(t));if(Q.test(i.tagName)){const t=i.textContent.split(D),o=t.length-1;if(o>0){i.textContent=M?M.emptyScript:"";for(let e=0;e<o;e++)i.append(t[e],_()),rt.nextNode(),c.push({type:2,index:++n});i.append(t[o],_())}}}else if(8===i.nodeType)if(i.data===F)c.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf(D,t+1));)c.push({type:7,index:n}),t+=D.length-1}n++}}static createElement(t,o){const e=B.createElement("template");return e.innerHTML=t,e}};function at(t,o,e=t,r){if(o===tt)return o;let i=void 0!==r?e._$Co?.[r]:e._$Cl;const n=$(o)?void 0:o._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),void 0===n?i=void 0:(i=new n(t),i._$AT(t,e,r)),void 0!==r?(e._$Co??=[])[r]=i:e._$Cl=i),void 0!==i&&(o=at(t,i._$AS(t,o.values),i,r)),o}let st=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,e,r){this.type=2,this._$AH=ot,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===t?.nodeType&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=at(this,t,o),$(t)?t===ot||null==t||""===t?(this._$AH!==ot&&this._$AR(),this._$AH=ot):t!==this._$AH&&t!==tt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>z(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==ot&&$(this._$AH)?this._$AA.nextSibling.data=t:this.$(B.createTextNode(t)),this._$AH=t}g(t){const{values:o,_$litType$:e}=t,r="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=nt.createElement(it(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(o);else{const t=new class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:o},parts:e}=this._$AD,r=(t?.creationScope??B).importNode(o,!0);rt.currentNode=r;let i=rt.nextNode(),n=0,a=0,s=e[0];for(;void 0!==s;){if(n===s.index){let o;2===s.type?o=new st(i,i.nextSibling,this,t):1===s.type?o=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(o=new ut(i,this,t)),this._$AV.push(o),s=e[++a]}n!==s?.index&&(i=rt.nextNode(),n++)}return rt.currentNode=B,r}p(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}}(r,this),e=t.u(this.options);t.p(o),this.$(e),this._$AH=t}}_$AC(t){let o=et.get(t.strings);return void 0===o&&et.set(t.strings,o=new nt(t)),o}T(o){z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of o)i===e.length?e.push(r=new t(this.k(_()),this.k(_()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},ct=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,e,r,i){this.type=1,this._$AH=ot,this._$AN=void 0,this.element=t,this.name=o,this._$AM=r,this.options=i,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=ot}_$AI(t,o=this,e,r){const i=this.strings;let n=!1;if(void 0===i)t=at(this,t,o,0),n=!$(t)||t!==this._$AH&&t!==tt,n&&(this._$AH=t);else{const r=t;let a,s;for(t=i[0],a=0;a<i.length-1;a++)s=at(this,r[e+a],o,a),s===tt&&(s=this._$AH[a]),n||=!$(s)||s!==this._$AH[a],s===ot?t=ot:t!==ot&&(t+=(s??"")+i[a+1]),this._$AH[a]=s}n&&!r&&this.O(t)}O(t){t===ot?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},lt=class extends ct{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===ot?void 0:t}},ft=class extends ct{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==ot)}},ht=class extends ct{constructor(t,o,e,r,i){super(t,o,e,r,i),this.type=5}_$AI(t,o=this){if((t=at(this,t,o,0)??ot)===tt)return;const e=this._$AH,r=t===ot&&e!==ot||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,i=t!==ot&&(e===ot||r);r&&this.element.removeEventListener(this.name,this,e),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ut=class{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){at(this,t)}};const dt=T.litHtmlPolyfillSupport;dt?.(nt,st),(T.litHtmlVersions??=[]).push("3.1.0");
36
+ */const T=globalThis,M=T.trustedTypes,P=M?M.createPolicy("lit-html",{createHTML:t=>t}):void 0,j="$lit$",D=`lit$${(Math.random()+"").slice(9)}$`,F="?"+D,Z=`<${F}>`,_=document,B=()=>_.createComment(""),$=t=>null===t||"object"!=typeof t&&"function"!=typeof t,z=Array.isArray,H="[ \t\n\f\r]",G=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,q=/-->/g,V=/>/g,Y=RegExp(`>|${H}(?:([^\\s"'>=/]+)(${H}*=${H}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),J=/'/g,X=/"/g,Q=/^(?:script|style|textarea|title)$/i,tt=Symbol.for("lit-noChange"),ot=Symbol.for("lit-nothing"),et=new WeakMap,rt=_.createTreeWalker(_,129);function it(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(o):o}let nt=class t{constructor({strings:o,_$litType$:e},r){let i;this.parts=[];let n=0,a=0;const s=o.length-1,c=this.parts,[l,f]=((t,o)=>{const e=t.length-1,r=[];let i,n=2===o?"<svg>":"",a=G;for(let o=0;o<e;o++){const e=t[o];let s,c,l=-1,f=0;for(;f<e.length&&(a.lastIndex=f,c=a.exec(e),null!==c);)f=a.lastIndex,a===G?"!--"===c[1]?a=q:void 0!==c[1]?a=V:void 0!==c[2]?(Q.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Y):void 0!==c[3]&&(a=Y):a===Y?">"===c[0]?(a=i??G,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?Y:'"'===c[3]?X:J):a===X||a===J?a=Y:a===q||a===V?a=G:(a=Y,i=void 0);const h=a===Y&&t[o+1].startsWith("/>")?" ":"";n+=a===G?e+Z:l>=0?(r.push(s),e.slice(0,l)+j+e.slice(l)+D+h):e+D+(-2===l?o:h)}return[it(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),r]})(o,e);if(this.el=t.createElement(l,r),rt.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=rt.nextNode())&&c.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(j)){const o=f[a++],e=i.getAttribute(t).split(D),r=/([.?@])?(.*)/.exec(o);c.push({type:1,index:n,name:r[2],strings:e,ctor:"."===r[1]?lt:"?"===r[1]?ft:"@"===r[1]?ht:ct}),i.removeAttribute(t)}else t.startsWith(D)&&(c.push({type:6,index:n}),i.removeAttribute(t));if(Q.test(i.tagName)){const t=i.textContent.split(D),o=t.length-1;if(o>0){i.textContent=M?M.emptyScript:"";for(let e=0;e<o;e++)i.append(t[e],B()),rt.nextNode(),c.push({type:2,index:++n});i.append(t[o],B())}}}else if(8===i.nodeType)if(i.data===F)c.push({type:2,index:n});else{let t=-1;for(;-1!==(t=i.data.indexOf(D,t+1));)c.push({type:7,index:n}),t+=D.length-1}n++}}static createElement(t,o){const e=_.createElement("template");return e.innerHTML=t,e}};function at(t,o,e=t,r){if(o===tt)return o;let i=void 0!==r?e._$Co?.[r]:e._$Cl;const n=$(o)?void 0:o._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),void 0===n?i=void 0:(i=new n(t),i._$AT(t,e,r)),void 0!==r?(e._$Co??=[])[r]=i:e._$Cl=i),void 0!==i&&(o=at(t,i._$AS(t,o.values),i,r)),o}let st=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,e,r){this.type=2,this._$AH=ot,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===t?.nodeType&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=at(this,t,o),$(t)?t===ot||null==t||""===t?(this._$AH!==ot&&this._$AR(),this._$AH=ot):t!==this._$AH&&t!==tt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>z(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==ot&&$(this._$AH)?this._$AA.nextSibling.data=t:this.$(_.createTextNode(t)),this._$AH=t}g(t){const{values:o,_$litType$:e}=t,r="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=nt.createElement(it(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(o);else{const t=new class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:o},parts:e}=this._$AD,r=(t?.creationScope??_).importNode(o,!0);rt.currentNode=r;let i=rt.nextNode(),n=0,a=0,s=e[0];for(;void 0!==s;){if(n===s.index){let o;2===s.type?o=new st(i,i.nextSibling,this,t):1===s.type?o=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(o=new ut(i,this,t)),this._$AV.push(o),s=e[++a]}n!==s?.index&&(i=rt.nextNode(),n++)}return rt.currentNode=_,r}p(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}}(r,this),e=t.u(this.options);t.p(o),this.$(e),this._$AH=t}}_$AC(t){let o=et.get(t.strings);return void 0===o&&et.set(t.strings,o=new nt(t)),o}T(o){z(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of o)i===e.length?e.push(r=new t(this.k(B()),this.k(B()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},ct=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,e,r,i){this.type=1,this._$AH=ot,this._$AN=void 0,this.element=t,this.name=o,this._$AM=r,this.options=i,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=ot}_$AI(t,o=this,e,r){const i=this.strings;let n=!1;if(void 0===i)t=at(this,t,o,0),n=!$(t)||t!==this._$AH&&t!==tt,n&&(this._$AH=t);else{const r=t;let a,s;for(t=i[0],a=0;a<i.length-1;a++)s=at(this,r[e+a],o,a),s===tt&&(s=this._$AH[a]),n||=!$(s)||s!==this._$AH[a],s===ot?t=ot:t!==ot&&(t+=(s??"")+i[a+1]),this._$AH[a]=s}n&&!r&&this.O(t)}O(t){t===ot?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},lt=class extends ct{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===ot?void 0:t}},ft=class extends ct{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==ot)}},ht=class extends ct{constructor(t,o,e,r,i){super(t,o,e,r,i),this.type=5}_$AI(t,o=this){if((t=at(this,t,o,0)??ot)===tt)return;const e=this._$AH,r=t===ot&&e!==ot||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,i=t!==ot&&(e===ot||r);r&&this.element.removeEventListener(this.name,this,e),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ut=class{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){at(this,t)}};const dt=T.litHtmlPolyfillSupport;dt?.(nt,st),(T.litHtmlVersions??=[]).push("3.1.0");
37
37
  /**
38
38
  * @license
39
39
  * Copyright 2019 Google LLC
@@ -50,7 +50,7 @@ const pt=globalThis,yt=pt.ShadowRoot&&(void 0===pt.ShadyCSS||pt.ShadyCSS.nativeS
50
50
  * Copyright 2017 Google LLC
51
51
  * SPDX-License-Identifier: BSD-3-Clause
52
52
  */
53
- const Pt=globalThis,jt=Pt.trustedTypes,Dt=jt?jt.createPolicy("lit-html",{createHTML:t=>t}):void 0,Ft="$lit$",Zt=`lit$${(Math.random()+"").slice(9)}$`,Bt="?"+Zt,_t=`<${Bt}>`,$t=document,zt=()=>$t.createComment(""),Ht=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Gt=Array.isArray,qt="[ \t\n\f\r]",Vt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Yt=/-->/g,Jt=/>/g,Xt=RegExp(`>|${qt}(?:([^\\s"'>=/]+)(${qt}*=${qt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Qt=/'/g,to=/"/g,oo=/^(?:script|style|textarea|title)$/i,eo=(t=>(o,...e)=>({_$litType$:t,strings:o,values:e}))(1),ro=Symbol.for("lit-noChange"),io=Symbol.for("lit-nothing"),no=new WeakMap,ao=$t.createTreeWalker($t,129);function so(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Dt?Dt.createHTML(o):o}class co{constructor({strings:t,_$litType$:o},e){let r;this.parts=[];let i=0,n=0;const a=t.length-1,s=this.parts,[c,l]=((t,o)=>{const e=t.length-1,r=[];let i,n=2===o?"<svg>":"",a=Vt;for(let o=0;o<e;o++){const e=t[o];let s,c,l=-1,f=0;for(;f<e.length&&(a.lastIndex=f,c=a.exec(e),null!==c);)f=a.lastIndex,a===Vt?"!--"===c[1]?a=Yt:void 0!==c[1]?a=Jt:void 0!==c[2]?(oo.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Xt):void 0!==c[3]&&(a=Xt):a===Xt?">"===c[0]?(a=i??Vt,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?Xt:'"'===c[3]?to:Qt):a===to||a===Qt?a=Xt:a===Yt||a===Jt?a=Vt:(a=Xt,i=void 0);const h=a===Xt&&t[o+1].startsWith("/>")?" ":"";n+=a===Vt?e+_t:l>=0?(r.push(s),e.slice(0,l)+Ft+e.slice(l)+Zt+h):e+Zt+(-2===l?o:h)}return[so(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),r]})(t,o);if(this.el=co.createElement(c,e),ao.currentNode=this.el.content,2===o){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=ao.nextNode())&&s.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(Ft)){const o=l[n++],e=r.getAttribute(t).split(Zt),a=/([.?@])?(.*)/.exec(o);s.push({type:1,index:i,name:a[2],strings:e,ctor:"."===a[1]?uo:"?"===a[1]?po:"@"===a[1]?yo:ho}),r.removeAttribute(t)}else t.startsWith(Zt)&&(s.push({type:6,index:i}),r.removeAttribute(t));if(oo.test(r.tagName)){const t=r.textContent.split(Zt),o=t.length-1;if(o>0){r.textContent=jt?jt.emptyScript:"";for(let e=0;e<o;e++)r.append(t[e],zt()),ao.nextNode(),s.push({type:2,index:++i});r.append(t[o],zt())}}}else if(8===r.nodeType)if(r.data===Bt)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(Zt,t+1));)s.push({type:7,index:i}),t+=Zt.length-1}i++}}static createElement(t,o){const e=$t.createElement("template");return e.innerHTML=t,e}}function lo(t,o,e=t,r){if(o===ro)return o;let i=void 0!==r?e._$Co?.[r]:e._$Cl;const n=Ht(o)?void 0:o._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),void 0===n?i=void 0:(i=new n(t),i._$AT(t,e,r)),void 0!==r?(e._$Co??=[])[r]=i:e._$Cl=i),void 0!==i&&(o=lo(t,i._$AS(t,o.values),i,r)),o}let fo=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,e,r){this.type=2,this._$AH=io,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===t?.nodeType&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=lo(this,t,o),Ht(t)?t===io||null==t||""===t?(this._$AH!==io&&this._$AR(),this._$AH=io):t!==this._$AH&&t!==ro&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>Gt(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==io&&Ht(this._$AH)?this._$AA.nextSibling.data=t:this.$($t.createTextNode(t)),this._$AH=t}g(t){const{values:o,_$litType$:e}=t,r="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=co.createElement(so(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(o);else{const t=new class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:o},parts:e}=this._$AD,r=(t?.creationScope??$t).importNode(o,!0);ao.currentNode=r;let i=ao.nextNode(),n=0,a=0,s=e[0];for(;void 0!==s;){if(n===s.index){let o;2===s.type?o=new fo(i,i.nextSibling,this,t):1===s.type?o=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(o=new go(i,this,t)),this._$AV.push(o),s=e[++a]}n!==s?.index&&(i=ao.nextNode(),n++)}return ao.currentNode=$t,r}p(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}}(r,this),e=t.u(this.options);t.p(o),this.$(e),this._$AH=t}}_$AC(t){let o=no.get(t.strings);return void 0===o&&no.set(t.strings,o=new co(t)),o}T(o){Gt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of o)i===e.length?e.push(r=new t(this.k(zt()),this.k(zt()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},ho=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,e,r,i){this.type=1,this._$AH=io,this._$AN=void 0,this.element=t,this.name=o,this._$AM=r,this.options=i,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=io}_$AI(t,o=this,e,r){const i=this.strings;let n=!1;if(void 0===i)t=lo(this,t,o,0),n=!Ht(t)||t!==this._$AH&&t!==ro,n&&(this._$AH=t);else{const r=t;let a,s;for(t=i[0],a=0;a<i.length-1;a++)s=lo(this,r[e+a],o,a),s===ro&&(s=this._$AH[a]),n||=!Ht(s)||s!==this._$AH[a],s===io?t=io:t!==io&&(t+=(s??"")+i[a+1]),this._$AH[a]=s}n&&!r&&this.O(t)}O(t){t===io?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},uo=class extends ho{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===io?void 0:t}},po=class extends ho{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==io)}},yo=class extends ho{constructor(t,o,e,r,i){super(t,o,e,r,i),this.type=5}_$AI(t,o=this){if((t=lo(this,t,o,0)??io)===ro)return;const e=this._$AH,r=t===io&&e!==io||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,i=t!==io&&(e===io||r);r&&this.element.removeEventListener(this.name,this,e),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},go=class{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){lo(this,t)}};const bo=Pt.litHtmlPolyfillSupport;bo?.(co,fo),(Pt.litHtmlVersions??=[]).push("3.1.0");
53
+ const Pt=globalThis,jt=Pt.trustedTypes,Dt=jt?jt.createPolicy("lit-html",{createHTML:t=>t}):void 0,Ft="$lit$",Zt=`lit$${(Math.random()+"").slice(9)}$`,_t="?"+Zt,Bt=`<${_t}>`,$t=document,zt=()=>$t.createComment(""),Ht=t=>null===t||"object"!=typeof t&&"function"!=typeof t,Gt=Array.isArray,qt="[ \t\n\f\r]",Vt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Yt=/-->/g,Jt=/>/g,Xt=RegExp(`>|${qt}(?:([^\\s"'>=/]+)(${qt}*=${qt}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Qt=/'/g,to=/"/g,oo=/^(?:script|style|textarea|title)$/i,eo=(t=>(o,...e)=>({_$litType$:t,strings:o,values:e}))(1),ro=Symbol.for("lit-noChange"),io=Symbol.for("lit-nothing"),no=new WeakMap,ao=$t.createTreeWalker($t,129);function so(t,o){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Dt?Dt.createHTML(o):o}class co{constructor({strings:t,_$litType$:o},e){let r;this.parts=[];let i=0,n=0;const a=t.length-1,s=this.parts,[c,l]=((t,o)=>{const e=t.length-1,r=[];let i,n=2===o?"<svg>":"",a=Vt;for(let o=0;o<e;o++){const e=t[o];let s,c,l=-1,f=0;for(;f<e.length&&(a.lastIndex=f,c=a.exec(e),null!==c);)f=a.lastIndex,a===Vt?"!--"===c[1]?a=Yt:void 0!==c[1]?a=Jt:void 0!==c[2]?(oo.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Xt):void 0!==c[3]&&(a=Xt):a===Xt?">"===c[0]?(a=i??Vt,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?Xt:'"'===c[3]?to:Qt):a===to||a===Qt?a=Xt:a===Yt||a===Jt?a=Vt:(a=Xt,i=void 0);const h=a===Xt&&t[o+1].startsWith("/>")?" ":"";n+=a===Vt?e+Bt:l>=0?(r.push(s),e.slice(0,l)+Ft+e.slice(l)+Zt+h):e+Zt+(-2===l?o:h)}return[so(t,n+(t[e]||"<?>")+(2===o?"</svg>":"")),r]})(t,o);if(this.el=co.createElement(c,e),ao.currentNode=this.el.content,2===o){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=ao.nextNode())&&s.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(Ft)){const o=l[n++],e=r.getAttribute(t).split(Zt),a=/([.?@])?(.*)/.exec(o);s.push({type:1,index:i,name:a[2],strings:e,ctor:"."===a[1]?uo:"?"===a[1]?po:"@"===a[1]?yo:ho}),r.removeAttribute(t)}else t.startsWith(Zt)&&(s.push({type:6,index:i}),r.removeAttribute(t));if(oo.test(r.tagName)){const t=r.textContent.split(Zt),o=t.length-1;if(o>0){r.textContent=jt?jt.emptyScript:"";for(let e=0;e<o;e++)r.append(t[e],zt()),ao.nextNode(),s.push({type:2,index:++i});r.append(t[o],zt())}}}else if(8===r.nodeType)if(r.data===_t)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(Zt,t+1));)s.push({type:7,index:i}),t+=Zt.length-1}i++}}static createElement(t,o){const e=$t.createElement("template");return e.innerHTML=t,e}}function lo(t,o,e=t,r){if(o===ro)return o;let i=void 0!==r?e._$Co?.[r]:e._$Cl;const n=Ht(o)?void 0:o._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),void 0===n?i=void 0:(i=new n(t),i._$AT(t,e,r)),void 0!==r?(e._$Co??=[])[r]=i:e._$Cl=i),void 0!==i&&(o=lo(t,i._$AS(t,o.values),i,r)),o}let fo=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,o,e,r){this.type=2,this._$AH=io,this._$AN=void 0,this._$AA=t,this._$AB=o,this._$AM=e,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const o=this._$AM;return void 0!==o&&11===t?.nodeType&&(t=o.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,o=this){t=lo(this,t,o),Ht(t)?t===io||null==t||""===t?(this._$AH!==io&&this._$AR(),this._$AH=io):t!==this._$AH&&t!==ro&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>Gt(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==io&&Ht(this._$AH)?this._$AA.nextSibling.data=t:this.$($t.createTextNode(t)),this._$AH=t}g(t){const{values:o,_$litType$:e}=t,r="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=co.createElement(so(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===r)this._$AH.p(o);else{const t=new class{constructor(t,o){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:o},parts:e}=this._$AD,r=(t?.creationScope??$t).importNode(o,!0);ao.currentNode=r;let i=ao.nextNode(),n=0,a=0,s=e[0];for(;void 0!==s;){if(n===s.index){let o;2===s.type?o=new fo(i,i.nextSibling,this,t):1===s.type?o=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(o=new go(i,this,t)),this._$AV.push(o),s=e[++a]}n!==s?.index&&(i=ao.nextNode(),n++)}return ao.currentNode=$t,r}p(t){let o=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,o),o+=e.strings.length-2):e._$AI(t[o])),o++}}(r,this),e=t.u(this.options);t.p(o),this.$(e),this._$AH=t}}_$AC(t){let o=no.get(t.strings);return void 0===o&&no.set(t.strings,o=new co(t)),o}T(o){Gt(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,i=0;for(const n of o)i===e.length?e.push(r=new t(this.k(zt()),this.k(zt()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,o){for(this._$AP?.(!1,!0,o);t&&t!==this._$AB;){const o=t.nextSibling;t.remove(),t=o}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}},ho=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,o,e,r,i){this.type=1,this._$AH=io,this._$AN=void 0,this.element=t,this.name=o,this._$AM=r,this.options=i,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=io}_$AI(t,o=this,e,r){const i=this.strings;let n=!1;if(void 0===i)t=lo(this,t,o,0),n=!Ht(t)||t!==this._$AH&&t!==ro,n&&(this._$AH=t);else{const r=t;let a,s;for(t=i[0],a=0;a<i.length-1;a++)s=lo(this,r[e+a],o,a),s===ro&&(s=this._$AH[a]),n||=!Ht(s)||s!==this._$AH[a],s===io?t=io:t!==io&&(t+=(s??"")+i[a+1]),this._$AH[a]=s}n&&!r&&this.O(t)}O(t){t===io?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},uo=class extends ho{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===io?void 0:t}},po=class extends ho{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==io)}},yo=class extends ho{constructor(t,o,e,r,i){super(t,o,e,r,i),this.type=5}_$AI(t,o=this){if((t=lo(this,t,o,0)??io)===ro)return;const e=this._$AH,r=t===io&&e!==io||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,i=t!==io&&(e===io||r);r&&this.element.removeEventListener(this.name,this,e),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},go=class{constructor(t,o,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=o,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){lo(this,t)}};const bo=Pt.litHtmlPolyfillSupport;bo?.(co,fo),(Pt.litHtmlVersions??=[]).push("3.1.0");
54
54
  /**
55
55
  * @license
56
56
  * Copyright 2017 Google LLC
@@ -98,10 +98,10 @@ const Eo=window,xo=Eo.ShadowRoot&&(void 0===Eo.ShadyCSS||Eo.ShadyCSS.nativeShado
98
98
  display: inline-block;
99
99
  width: 0;
100
100
  }
101
- `;class Ko{constructor(t,o){this.defaultLabels=t,this.labels=o}resolve(t,...o){var e,r;t=this.resolvePluralKey(t,o);let i=null!==(r=null!==(e=this.labels[t])&&void 0!==e?e:this.defaultLabels[t])&&void 0!==r?r:"";return o.forEach(((t,o)=>i=i.replace(new RegExp(`\\{${o}([^}]*)\\}`,"g"),((o,e)=>this.formatValue(t,e))))),i}resolvePluralKey(t,o){for(let e of o)if("number"==typeof e){const o=`${String(t)}[\\=${e}]`;if(o in this.labels||o in this.defaultLabels)return o}return t}formatValue(t,o){return t instanceof Date?this.formatDate(t,o):null!=t?t:""}formatDate(t,o){const e=e=>(null==o?void 0:o.includes("date"))?t.toLocaleDateString(e):(null==o?void 0:o.includes("time"))?t.toLocaleTimeString(e):t.toLocaleString(e);try{return e(document.documentElement.lang)}catch(t){return e()}}}const To=t=>{const o=null!=t?t:{};return(t,e)=>{var r;const i={hasChanged:(t,o)=>!W(t,o),attribute:!1,...o};I(i)(t,e);const n=t.constructor;n.reduxProperties=new Map(n.reduxProperties),n.reduxProperties.set(e,{selector:null!==(r=o.selector)&&void 0!==r?r:t=>t[e],store:o.store})}};class Mo{constructor(){this.queue=[]}add(t,o=!1){o&&(this.queue=this.queue.filter((o=>o.type!==t.type))),this.queue.push(t)}consume(t){const o=this.queue.find((o=>o.type===t));return o&&(this.queue=this.queue.filter((t=>t!==o))),o}}function Po(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var jo,Do,Fo;const Zo=Symbol("internalReduxEventsUnsubscribers"),Bo=Symbol("internalStoresUnsubscribers"),_o=Symbol("internalStores");class $o extends Wo{constructor(){super(...arguments),this[jo]=new Map,this[Do]=new Map,this[Fo]=[]}get reduxConstructor(){return this.constructor}update(t){super.update(t),[...this.reduxConstructor.reduxReactiveProperties].some((o=>t.has(o)))&&this.updateFromStores()}getUnnamedStore(){if(this[_o].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[_o].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[_o].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:Po(t)?t.name:void 0)&&void 0!==e?e:"default-store",this.unsubscribeFromStore(o),this.setupStore(o,t)}removeStore(t){const o="string"==typeof t?t:t.name;this.unsubscribeFromStore(o),this[_o].delete(o)}setupStore(t,o){this[_o].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[_o].forEach(((t,o)=>this.subscribeToStore(o,t))),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach(((t,o)=>{const e=this.constructor.getPropertyOptions(o);if(!(null==e?void 0:e.attribute)||!this.hasAttribute("string"==typeof(null==e?void 0:e.attribute)?e.attribute:o)){const e=this.getStore(t.store);e&&(t.store?this[Bo].has(t.store):this[Bo].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[Bo].set(t,o.subscribe((()=>this.updateFromStores()))),Po(o)&&o.eventBus&&(null===(e=this.reduxConstructor.reduxEventListeners)||void 0===e||e.forEach(((t,e)=>{if("function"==typeof this[e]&&(!t.store||o.name===t.store)){const r=t=>this[e](t);o.eventBus.addEventListener(t.eventName,r),this[Zo].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Bo].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[Zo].forEach((t=>t())),this[Zo]=[]}unsubscribeFromStore(t){this[Bo].has(t)&&this[Bo].get(t)(),this[Bo].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}function zo(t){for(var o=arguments.length,e=Array(o>1?o-1:0),r=1;r<o;r++)e[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+t+(e.length?" "+e.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Ho(t){return!!t&&!!t[We]}function Go(t){var o;return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;var e=Object.hasOwnProperty.call(o,"constructor")&&o.constructor;return e===Object||"function"==typeof e&&Function.toString.call(e)===ke}(t)||Array.isArray(t)||!!t[Ae]||!!(null===(o=t.constructor)||void 0===o?void 0:o[Ae])||Qo(t)||te(t))}function qo(t,o,e){void 0===e&&(e=!1),0===Vo(t)?(e?Object.keys:Ke)(t).forEach((function(r){e&&"symbol"==typeof r||o(r,t[r],t)})):t.forEach((function(e,r){return o(r,e,t)}))}function Vo(t){var o=t[We];return o?o.i>3?o.i-4:o.i:Array.isArray(t)?1:Qo(t)?2:te(t)?3:0}function Yo(t,o){return 2===Vo(t)?t.has(o):Object.prototype.hasOwnProperty.call(t,o)}function Jo(t,o,e){var r=Vo(t);2===r?t.set(o,e):3===r?t.add(e):t[o]=e}function Xo(t,o){return t===o?0!==t||1/t==1/o:t!=t&&o!=o}function Qo(t){return Re&&t instanceof Map}function te(t){return Ue&&t instanceof Set}function oe(t){return t.o||t.t}function ee(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var o=Te(t);delete o[We];for(var e=Ke(o),r=0;r<e.length;r++){var i=e[r],n=o[i];!1===n.writable&&(n.writable=!0,n.configurable=!0),(n.get||n.set)&&(o[i]={configurable:!0,writable:!0,enumerable:n.enumerable,value:t[i]})}return Object.create(Object.getPrototypeOf(t),o)}function re(t,o){return void 0===o&&(o=!1),ne(t)||Ho(t)||!Go(t)||(Vo(t)>1&&(t.set=t.add=t.clear=t.delete=ie),Object.freeze(t),o&&qo(t,(function(t,o){return re(o,!0)}),!0)),t}function ie(){zo(2)}function ne(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function ae(t){var o=Me[t];return o||zo(18,t),o}function se(){return xe}function ce(t,o){o&&(ae("Patches"),t.u=[],t.s=[],t.v=o)}function le(t){fe(t),t.p.forEach(ue),t.p=null}function fe(t){t===xe&&(xe=t.l)}function he(t){return xe={p:[],l:xe,h:t,m:!0,_:0}}function ue(t){var o=t[We];0===o.i||1===o.i?o.j():o.g=!0}function de(t,o){o._=o.p.length;var e=o.p[0],r=void 0!==t&&t!==e;return o.h.O||ae("ES5").S(o,t,r),r?(e[We].P&&(le(o),zo(4)),Go(t)&&(t=pe(o,t),o.l||ge(o,t)),o.u&&ae("Patches").M(e[We].t,t,o.u,o.s)):t=pe(o,e,[]),le(o),o.u&&o.v(o.u,o.s),t!==Le?t:void 0}function pe(t,o,e){if(ne(o))return o;var r=o[We];if(!r)return qo(o,(function(i,n){return ye(t,r,o,i,n,e)}),!0),o;if(r.A!==t)return o;if(!r.P)return ge(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=ee(r.k):r.o,n=i,a=!1;3===r.i&&(n=new Set(i),i.clear(),a=!0),qo(n,(function(o,n){return ye(t,r,i,o,n,e,a)})),ge(t,i,!1),e&&t.u&&ae("Patches").N(r,e,t.u,t.s)}return r.o}function ye(t,o,e,r,i,n,a){if(Ho(i)){var s=pe(t,i,n&&o&&3!==o.i&&!Yo(o.R,r)?n.concat(r):void 0);if(Jo(e,r,s),!Ho(s))return;t.m=!1}else a&&e.add(i);if(Go(i)&&!ne(i)){if(!t.h.D&&t._<1)return;pe(t,i),o&&o.A.l||ge(t,i)}}function ge(t,o,e){void 0===e&&(e=!1),!t.l&&t.h.D&&t.m&&re(o,e)}function be(t,o){var e=t[We];return(e?oe(e):t)[o]}function me(t,o){if(o in t)for(var e=Object.getPrototypeOf(t);e;){var r=Object.getOwnPropertyDescriptor(e,o);if(r)return r;e=Object.getPrototypeOf(e)}}function ve(t){t.P||(t.P=!0,t.l&&ve(t.l))}function Oe(t){t.o||(t.o=ee(t.t))}function we(t,o,e){var r=Qo(o)?ae("MapSet").F(o,e):te(o)?ae("MapSet").T(o,e):t.O?function(t,o){var e=Array.isArray(t),r={i:e?1:0,A:o?o.A:se(),P:!1,I:!1,R:{},l:o,t,k:null,o:null,j:null,C:!1},i=r,n=Pe;e&&(i=[r],n=je);var a=Proxy.revocable(i,n),s=a.revoke,c=a.proxy;return r.k=c,r.j=s,c}(o,e):ae("ES5").J(o,e);return(e?e.A:se()).p.push(r),r}function Ne(t){return Ho(t)||zo(22,t),function t(o){if(!Go(o))return o;var e,r=o[We],i=Vo(o);if(r){if(!r.P&&(r.i<4||!ae("ES5").K(r)))return r.t;r.I=!0,e=Se(o,i),r.I=!1}else e=Se(o,i);return qo(e,(function(o,i){r&&function(t,o){return 2===Vo(t)?t.get(o):t[o]}(r.t,o)===i||Jo(e,o,t(i))})),3===i?new Set(e):e}(t)}function Se(t,o){switch(o){case 2:return new Map(t);case 3:return Array.from(t)}return ee(t)}jo=Bo,Do=_o,Fo=Zo,$o.reduxProperties=new Map,$o.reduxReactiveProperties=new Set,$o.reduxEventListeners=new Map;var Ee,xe,Ce="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Re="undefined"!=typeof Map,Ue="undefined"!=typeof Set,Ie="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Le=Ce?Symbol.for("immer-nothing"):((Ee={})["immer-nothing"]=!0,Ee),Ae=Ce?Symbol.for("immer-draftable"):"__$immer_draftable",We=Ce?Symbol.for("immer-state"):"__$immer_state",ke=""+Object.prototype.constructor,Ke="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,Te=Object.getOwnPropertyDescriptors||function(t){var o={};return Ke(t).forEach((function(e){o[e]=Object.getOwnPropertyDescriptor(t,e)})),o},Me={},Pe={get:function(t,o){if(o===We)return t;var e=oe(t);if(!Yo(e,o))return function(t,o,e){var r,i=me(o,e);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(t.k):void 0}(t,e,o);var r=e[o];return t.I||!Go(r)?r:r===be(t.t,o)?(Oe(t),t.o[o]=we(t.A.h,r,t)):r},has:function(t,o){return o in oe(t)},ownKeys:function(t){return Reflect.ownKeys(oe(t))},set:function(t,o,e){var r=me(oe(t),o);if(null==r?void 0:r.set)return r.set.call(t.k,e),!0;if(!t.P){var i=be(oe(t),o),n=null==i?void 0:i[We];if(n&&n.t===e)return t.o[o]=e,t.R[o]=!1,!0;if(Xo(e,i)&&(void 0!==e||Yo(t.t,o)))return!0;Oe(t),ve(t)}return t.o[o]===e&&(void 0!==e||o in t.o)||Number.isNaN(e)&&Number.isNaN(t.o[o])||(t.o[o]=e,t.R[o]=!0),!0},deleteProperty:function(t,o){return void 0!==be(t.t,o)||o in t.t?(t.R[o]=!1,Oe(t),ve(t)):delete t.R[o],t.o&&delete t.o[o],!0},getOwnPropertyDescriptor:function(t,o){var e=oe(t),r=Reflect.getOwnPropertyDescriptor(e,o);return r?{writable:!0,configurable:1!==t.i||"length"!==o,enumerable:r.enumerable,value:e[o]}:r},defineProperty:function(){zo(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){zo(12)}},je={};qo(Pe,(function(t,o){je[t]=function(){return arguments[0]=arguments[0][0],o.apply(this,arguments)}})),je.deleteProperty=function(t,o){return je.set.call(this,t,o,void 0)},je.set=function(t,o,e){return Pe.set.call(this,t[0],o,e,t[0])};var De=function(){function t(t){var o=this;this.O=Ie,this.D=!0,this.produce=function(t,e,r){if("function"==typeof t&&"function"!=typeof e){var i=e;e=t;var n=o;return function(t){var o=this;void 0===t&&(t=i);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return n.produce(t,(function(t){var r;return(r=e).call.apply(r,[o,t].concat(a))}))}}var a;if("function"!=typeof e&&zo(6),void 0!==r&&"function"!=typeof r&&zo(7),Go(t)){var s=he(o),c=we(o,t,void 0),l=!0;try{a=e(c),l=!1}finally{l?le(s):fe(s)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(t){return ce(s,r),de(t,s)}),(function(t){throw le(s),t})):(ce(s,r),de(a,s))}if(!t||"object"!=typeof t){if(void 0===(a=e(t))&&(a=t),a===Le&&(a=void 0),o.D&&re(a,!0),r){var f=[],h=[];ae("Patches").M(t,a,f,h),r(f,h)}return a}zo(21,t)},this.produceWithPatches=function(t,e){if("function"==typeof t)return function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o.produceWithPatches(e,(function(o){return t.apply(void 0,[o].concat(i))}))};var r,i,n=o.produce(t,e,(function(t,o){r=t,i=o}));return"undefined"!=typeof Promise&&n instanceof Promise?n.then((function(t){return[t,r,i]})):[n,r,i]},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var o=t.prototype;return o.createDraft=function(t){Go(t)||zo(8),Ho(t)&&(t=Ne(t));var o=he(this),e=we(this,t,void 0);return e[We].C=!0,fe(o),e},o.finishDraft=function(t,o){var e=(t&&t[We]).A;return ce(e,o),de(void 0,e)},o.setAutoFreeze=function(t){this.D=t},o.setUseProxies=function(t){t&&!Ie&&zo(20),this.O=t},o.applyPatches=function(t,o){var e;for(e=o.length-1;e>=0;e--){var r=o[e];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}e>-1&&(o=o.slice(e+1));var i=ae("Patches").$;return Ho(t)?i(t,o):this.produce(t,(function(t){return i(t,o)}))},t}(),Fe=new De,Ze=Fe.produce;function Be(t){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Be(t)}function _e(t){var o=function(t,o){if("object"!==Be(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,o||"default");if("object"!==Be(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===o?String:Number)(t)}(t,"string");return"symbol"===Be(o)?o:String(o)}function $e(t,o,e){return(o=_e(o))in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function ze(t,o){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),e.push.apply(e,r)}return e}function He(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{};o%2?ze(Object(e),!0).forEach((function(o){$e(t,o,e[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ze(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}))}return t}function Ge(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. "}Fe.produceWithPatches.bind(Fe),Fe.setAutoFreeze.bind(Fe),Fe.setUseProxies.bind(Fe),Fe.applyPatches.bind(Fe),Fe.createDraft.bind(Fe),Fe.finishDraft.bind(Fe);var qe="function"==typeof Symbol&&Symbol.observable||"@@observable",Ve=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ye={INIT:"@@redux/INIT"+Ve(),REPLACE:"@@redux/REPLACE"+Ve(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ve()}};function Je(t,o,e){var r;if("function"==typeof o&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(Ge(0));if("function"==typeof o&&void 0===e&&(e=o,o=void 0),void 0!==e){if("function"!=typeof e)throw new Error(Ge(1));return e(Je)(t,o)}if("function"!=typeof t)throw new Error(Ge(2));var i=t,n=o,a=[],s=a,c=!1;function l(){s===a&&(s=a.slice())}function f(){if(c)throw new Error(Ge(3));return n}function h(t){if("function"!=typeof t)throw new Error(Ge(4));if(c)throw new Error(Ge(5));var o=!0;return l(),s.push(t),function(){if(o){if(c)throw new Error(Ge(6));o=!1,l();var e=s.indexOf(t);s.splice(e,1),a=null}}}function u(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var o=t;null!==Object.getPrototypeOf(o);)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(t)===o}(t))throw new Error(Ge(7));if(void 0===t.type)throw new Error(Ge(8));if(c)throw new Error(Ge(9));try{c=!0,n=i(n,t)}finally{c=!1}for(var o=a=s,e=0;e<o.length;e++){(0,o[e])()}return t}return u({type:Ye.INIT}),(r={dispatch:u,subscribe:h,getState:f,replaceReducer:function(t){if("function"!=typeof t)throw new Error(Ge(10));i=t,u({type:Ye.REPLACE})}})[qe]=function(){var t,o=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(Ge(11));function e(){t.next&&t.next(f())}return e(),{unsubscribe:o(e)}}})[qe]=function(){return this},t},r}function Xe(t){for(var o=Object.keys(t),e={},r=0;r<o.length;r++){var i=o[r];"function"==typeof t[i]&&(e[i]=t[i])}var n,a=Object.keys(e);try{!function(t){Object.keys(t).forEach((function(o){var e=t[o];if(void 0===e(void 0,{type:Ye.INIT}))throw new Error(Ge(12));if(void 0===e(void 0,{type:Ye.PROBE_UNKNOWN_ACTION()}))throw new Error(Ge(13))}))}(e)}catch(t){n=t}return function(t,o){if(void 0===t&&(t={}),n)throw n;for(var r=!1,i={},s=0;s<a.length;s++){var c=a[s],l=e[c],f=t[c],h=l(f,o);if(void 0===h)throw o&&o.type,new Error(Ge(14));i[c]=h,r=r||h!==f}return(r=r||a.length!==Object.keys(t).length)?i:t}}function Qe(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return 0===o.length?function(t){return t}:1===o.length?o[0]:o.reduce((function(t,o){return function(){return t(o.apply(void 0,arguments))}}))}function tr(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return function(t){return function(){var e=t.apply(void 0,arguments),r=function(){throw new Error(Ge(15))},i={getState:e.getState,dispatch:function(){return r.apply(void 0,arguments)}},n=o.map((function(t){return t(i)}));return r=Qe.apply(void 0,n)(e.dispatch),He(He({},e),{},{dispatch:r})}}}function or(t){return function(o){var e=o.dispatch,r=o.getState;return function(o){return function(i){return"function"==typeof i?i(e,r,t):o(i)}}}}var er=or();er.withExtraArgument=or;var rr,ir=er,nr=(rr=function(t,o){return rr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])},rr(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}rr(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}),ar=function(t,o){var e,r,i,n,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(n){return function(s){return function(n){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,r&&(i=2&n[0]?r.return:n[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,n[1])).done)return i;switch(r=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){a.label=n[1];break}if(6===n[0]&&a.label<i[1]){a.label=i[1],i=n;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(n);break}i[2]&&a.ops.pop(),a.trys.pop();continue}n=o.call(t,a)}catch(t){n=[6,t],r=0}finally{e=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}},sr=function(t,o){for(var e=0,r=o.length,i=t.length;e<r;e++,i++)t[i]=o[e];return t},cr=Object.defineProperty,lr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,hr=Object.getOwnPropertySymbols,ur=Object.prototype.hasOwnProperty,dr=Object.prototype.propertyIsEnumerable,pr=function(t,o,e){return o in t?cr(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e},yr=function(t,o){for(var e in o||(o={}))ur.call(o,e)&&pr(t,e,o[e]);if(hr)for(var r=0,i=hr(o);r<i.length;r++){e=i[r];dr.call(o,e)&&pr(t,e,o[e])}return t},gr=function(t,o){return lr(t,fr(o))},br="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Qe:Qe.apply(null,arguments)};var mr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return nr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,sr([void 0],t[0].concat(this)))):new(o.bind.apply(o,sr([void 0],t.concat(this))))},o}(Array),vr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return nr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,sr([void 0],t[0].concat(this)))):new(o.bind.apply(o,sr([void 0],t.concat(this))))},o}(Array);function Or(t){return Go(t)?Ze(t,(function(){})):t}function wr(){return function(t){return function(t){void 0===t&&(t={});var o=t.thunk,e=void 0===o||o;t.immutableCheck,t.serializableCheck;var r=new mr;e&&(!function(t){return"boolean"==typeof t}(e)?r.push(ir.withExtraArgument(e.extraArgument)):r.push(ir));return r}(t)}}function Nr(t){var o,e=wr(),r=t||{},i=r.reducer,n=void 0===i?void 0:i,a=r.middleware,s=void 0===a?e():a,c=r.devTools,l=void 0===c||c,f=r.preloadedState,h=void 0===f?void 0:f,u=r.enhancers,d=void 0===u?void 0:u;if("function"==typeof n)o=n;else{if(!function(t){if("object"!=typeof t||null===t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;for(var e=o;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return o===e}(n))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');o=Xe(n)}var p=s;"function"==typeof p&&(p=p(e));var y=tr.apply(void 0,p),g=Qe;l&&(g=br(yr({trace:!1},"object"==typeof l&&l)));var b=new vr(y),m=b;return Array.isArray(d)?m=sr([y],d):"function"==typeof d&&(m=d(b)),Je(o,h,g.apply(void 0,m))}function Sr(t,o){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(o){var i=o.apply(void 0,e);if(!i)throw new Error("prepareAction did not return an object");return yr(yr({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:e[0]}}return e.toString=function(){return""+t},e.type=t,e.match=function(o){return o.type===t},e}function Er(t){var o,e={},r=[],i={addCase:function(t,o){var r="string"==typeof t?t:t.type;if(r in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[r]=o,i},addMatcher:function(t,o){return r.push({matcher:t,reducer:o}),i},addDefaultCase:function(t){return o=t,i}};return t(i),[e,r,o]}function xr(t){var o=t.name;if(!o)throw new Error("`name` is a required option for createSlice");var e,r="function"==typeof t.initialState?t.initialState:Or(t.initialState),i=t.reducers||{},n=Object.keys(i),a={},s={},c={};function l(){var o="function"==typeof t.extraReducers?Er(t.extraReducers):[t.extraReducers],e=o[0],i=void 0===e?{}:e,n=o[1],a=void 0===n?[]:n,c=o[2],l=void 0===c?void 0:c,f=yr(yr({},i),s);return function(t,o,e,r){void 0===e&&(e=[]);var i,n="function"==typeof o?Er(o):[o,e,r],a=n[0],s=n[1],c=n[2];if(function(t){return"function"==typeof t}(t))i=function(){return Or(t())};else{var l=Or(t);i=function(){return l}}function f(t,o){void 0===t&&(t=i());var e=sr([a[o.type]],s.filter((function(t){return(0,t.matcher)(o)})).map((function(t){return t.reducer})));return 0===e.filter((function(t){return!!t})).length&&(e=[c]),e.reduce((function(t,e){if(e){var r;if(Ho(t))return void 0===(r=e(t,o))?t:r;if(Go(t))return Ze(t,(function(t){return e(t,o)}));if(void 0===(r=e(t,o))){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return t}),t)}return f.getInitialState=i,f}(r,(function(t){for(var o in f)t.addCase(o,f[o]);for(var e=0,r=a;e<r.length;e++){var i=r[e];t.addMatcher(i.matcher,i.reducer)}l&&t.addDefaultCase(l)}))}return n.forEach((function(t){var e,r,n=i[t],l=o+"/"+t;"reducer"in n?(e=n.reducer,r=n.prepare):e=n,a[t]=e,s[l]=e,c[t]=r?Sr(l,r):Sr(l)})),{name:o,reducer:function(t,o){return e||(e=l()),e(t,o)},actions:c,caseReducers:a,getInitialState:function(){return e||(e=l()),e.getInitialState()}}}var Cr=["name","message","stack","code"],Rr=function(t,o){this.payload=t,this.meta=o},Ur=function(t,o){this.payload=t,this.meta=o},Ir=function(t){if("object"==typeof t&&null!==t){for(var o={},e=0,r=Cr;e<r.length;e++){var i=r[e];"string"==typeof t[i]&&(o[i]=t[i])}return o}return{message:String(t)}};function Lr(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}!function(){function t(t,o,e){var r=Sr(t+"/fulfilled",(function(t,o,e,r){return{payload:t,meta:gr(yr({},r||{}),{arg:e,requestId:o,requestStatus:"fulfilled"})}})),i=Sr(t+"/pending",(function(t,o,e){return{payload:void 0,meta:gr(yr({},e||{}),{arg:o,requestId:t,requestStatus:"pending"})}})),n=Sr(t+"/rejected",(function(t,o,r,i,n){return{payload:i,error:(e&&e.serializeError||Ir)(t||"Rejected"),meta:gr(yr({},n||{}),{arg:r,requestId:o,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===(null==t?void 0:t.name),condition:"ConditionError"===(null==t?void 0:t.name)})}})),a="undefined"!=typeof AbortController?AbortController:function(){function t(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return t.prototype.abort=function(){},t}();return Object.assign((function(t){return function(s,c,l){var f,h=(null==e?void 0:e.idGenerator)?e.idGenerator(t):function(t){void 0===t&&(t=21);for(var o="",e=t;e--;)o+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return o}(),u=new a;function d(t){f=t,u.abort()}var p=function(){return a=this,p=null,y=function(){var a,p,y,g,b,m;return ar(this,(function(v){switch(v.label){case 0:return v.trys.push([0,4,,5]),g=null==(a=null==e?void 0:e.condition)?void 0:a.call(e,t,{getState:c,extra:l}),null===(O=g)||"object"!=typeof O||"function"!=typeof O.then?[3,2]:[4,g];case 1:g=v.sent(),v.label=2;case 2:if(!1===g||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return b=new Promise((function(t,o){return u.signal.addEventListener("abort",(function(){return o({name:"AbortError",message:f||"Aborted"})}))})),s(i(h,t,null==(p=null==e?void 0:e.getPendingMeta)?void 0:p.call(e,{requestId:h,arg:t},{getState:c,extra:l}))),[4,Promise.race([b,Promise.resolve(o(t,{dispatch:s,getState:c,extra:l,requestId:h,signal:u.signal,abort:d,rejectWithValue:function(t,o){return new Rr(t,o)},fulfillWithValue:function(t,o){return new Ur(t,o)}})).then((function(o){if(o instanceof Rr)throw o;return o instanceof Ur?r(o.payload,h,t,o.meta):r(o,h,t)}))])];case 3:return y=v.sent(),[3,5];case 4:return m=v.sent(),y=m instanceof Rr?n(null,h,t,m.payload,m.meta):n(m,h,t),[3,5];case 5:return e&&!e.dispatchConditionRejection&&n.match(y)&&y.meta.condition||s(y),[2,y]}var O}))},new Promise((function(t,o){var e=function(t){try{i(y.next(t))}catch(t){o(t)}},r=function(t){try{i(y.throw(t))}catch(t){o(t)}},i=function(o){return o.done?t(o.value):Promise.resolve(o.value).then(e,r)};i((y=y.apply(a,p)).next())}));var a,p,y}();return Object.assign(p,{abort:d,requestId:h,arg:t,unwrap:function(){return p.then(Lr)}})}}),{pending:i,rejected:n,fulfilled:r,typePrefix:t})}t.withTypes=function(){return t}}();var Ar,Wr,kr="listenerMiddleware";Sr(kr+"/add"),Sr(kr+"/removeAll"),Sr(kr+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function t(t,o){var e=i[t];return e?e.enumerable=o:i[t]=e={configurable:!0,enumerable:o,get:function(){var o=this[We];return Pe.get(o,t)},set:function(o){var e=this[We];Pe.set(e,t,o)}},e}function o(t){for(var o=t.length-1;o>=0;o--){var i=t[o][We];if(!i.P)switch(i.i){case 5:r(i)&&ve(i);break;case 4:e(i)&&ve(i)}}}function e(t){for(var o=t.t,e=t.k,r=Ke(e),i=r.length-1;i>=0;i--){var n=r[i];if(n!==We){var a=o[n];if(void 0===a&&!Yo(o,n))return!0;var s=e[n],c=s&&s[We];if(c?c.t!==a:!Xo(s,a))return!0}}var l=!!o[We];return r.length!==Ke(o).length+(l?0:1)}function r(t){var o=t.k;if(o.length!==t.t.length)return!0;var e=Object.getOwnPropertyDescriptor(o,o.length-1);if(e&&!e.get)return!0;for(var r=0;r<o.length;r++)if(!o.hasOwnProperty(r))return!0;return!1}var i={};!function(t,o){Me[t]||(Me[t]=o)}("ES5",{J:function(o,e){var r=Array.isArray(o),i=function(o,e){if(o){for(var r=Array(e.length),i=0;i<e.length;i++)Object.defineProperty(r,""+i,t(i,!0));return r}var n=Te(e);delete n[We];for(var a=Ke(n),s=0;s<a.length;s++){var c=a[s];n[c]=t(c,o||!!n[c].enumerable)}return Object.create(Object.getPrototypeOf(e),n)}(r,o),n={i:r?5:4,A:e?e.A:se(),P:!1,I:!1,R:{},l:e,t:o,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,We,{value:n,writable:!0}),i},S:function(t,e,i){i?Ho(e)&&e[We].A===t&&o(t.p):(t.u&&function t(o){if(o&&"object"==typeof o){var e=o[We];if(e){var i=e.t,n=e.k,a=e.R,s=e.i;if(4===s)qo(n,(function(o){o!==We&&(void 0!==i[o]||Yo(i,o)?a[o]||t(n[o]):(a[o]=!0,ve(e)))})),qo(i,(function(t){void 0!==n[t]||Yo(n,t)||(a[t]=!1,ve(e))}));else if(5===s){if(r(e)&&(ve(e),a.length=!0),n.length<i.length)for(var c=n.length;c<i.length;c++)a[c]=!1;else for(var l=i.length;l<n.length;l++)a[l]=!0;for(var f=Math.min(n.length,i.length),h=0;h<f;h++)n.hasOwnProperty(h)||(a[h]=!0),void 0===a[h]&&t(n[h])}}}}(t.p[0]),o(t.p))},K:function(t){return 4===t.i?e(t):r(t)}})}(),window.ftReduxStores||(window.ftReduxStores={});class Kr{static get(t){var o;const e="string"==typeof t?t:t.name,r="string"==typeof t?void 0:t,i=window.ftReduxStores[e];if(Po(i))return i;if(null==r)return;const n=xr({...r,reducers:null!==(o=r.reducers)&&void 0!==o?o:{}}),a=Nr({reducer:(t,o)=>{var e;switch(o.type){case"CLEAR_FT_REDUX_STORE":return n.getInitialState();case"DEFAULT_STATE_FIELDS_VALUES_SETTER":return{...t,...null!==(e=o.overwrites)&&void 0!==e?e:{}};default:return n.reducer(t,o)}}});return window.ftReduxStores[r.name]=new Kr(n,a)}constructor(t,o){this.reduxSlice=t,this.reduxStore=o,this.isFtReduxStore=!0,this.eventBus=document.createElement("event-bus"),this.commands=new Mo,this.actions=new Proxy(this.reduxSlice.actions,{get:(t,o,e)=>{const r=o,i=t[r];return i?(...t)=>{const o=i(...t);return this.reduxStore.dispatch(o),o}:t=>{this.setState({[r]:t})}}})}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE"})}setState(t){this.reduxStore.dispatch({type:"DEFAULT_STATE_FIELDS_VALUES_SETTER",overwrites:t})}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(t){throw new Error("Not implemented yet.")}subscribe(t){return this.reduxStore.subscribe(t)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}}navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Wr=null===(Ar=window.safari)||void 0===Ar?void 0:Ar.pushNotification)||void 0===Wr||Wr.toString());class Tr{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,o,e){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,e)),null==t.tocId?this.extractPagesToc(t.children,o,e):[{tocId:t.tocId,title:t.title,depth:o,children:this.extractPagesToc(t.children,o+1,t.tocId)}])))}convertNodes(t,o,e){return t.flatMap((t=>{var r,i,n;if(null==t.tocId)return[...this.convertSectionNodes(null!==(r=t.pageToc)&&void 0!==r?r:[],o,t.tocId),...this.convertNodes(t.children,o,t.tocId)];let a=null===(i=t.prettyUrl)||void 0===i?void 0:i.replace(/^\//,"");const s={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:a,depth:o,parentTocId:e,children:[]};this.register(s);const c=this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],o+1,t.tocId),l=this.convertNodes(t.children,o+1,s.tocId);return s.children=[...c,...l],[s]}))}convertSectionNodes(t,o,e){return t.flatMap((t=>{var r;let i=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const n={...t,prettyUrl:i,depth:o,parentTocId:e,children:[]};return this.register(n),n.children=this.convertSectionNodes(t.children,o+1,t.tocId),[n]}))}buildPage(t,o){var e,r,i,n,a,s;const c={number:this.pages.length+1,title:null!==(e=t.title)&&void 0!==e?e:"",rootTocId:null!==(r=t.tocId)&&void 0!==r?r:"root",toc:(null!==(i=t.pageToc)&&void 0!==i?i:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:o?this.buildBreadcrumb(this.nodeByTocId[o]):[]},l=(t,o)=>(o?c.topics:c.hiddenTopics).push(t),f=null!==(a=null===(n=t.pageConfiguration)||void 0===n?void 0:n.parentsVisibility)&&void 0!==a?a:[];return c.breadcrumb.forEach(((t,o)=>{l(t,f[o])})),t.tocId&&l(t.tocId,t.pageConfiguration.isVisible),c.topics.push(...this.tocIds(null!==(s=t.pageToc)&&void 0!==s?s:[])),c}registerPage(t){for(let o of[...t.topics,...t.hiddenTopics])this.pageByTocId[o]||(this.pageByTocId[o]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const o=[t.tocId];for(;null==t?void 0:t.parentTocId;)o.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return o}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class Mr{convertPaginatedToc(t){return new Tr(t).build()}}var Pr,jr,Dr,Fr,Zr,Br,_r,$r,zr,Hr,Gr,qr,Vr,Yr,Jr,Xr,Qr,ti;!function(t){!function(o){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(t){this.map={},t instanceof c?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function h(t){var o=new FileReader,e=f(o);return o.readAsArrayBuffer(t),e}function u(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=u(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var o=new FileReader,e=f(o);return o.readAsText(t),e}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),r=0;r<o.length;r++)e[r]=String.fromCharCode(o[r]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[n(t)]},c.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},c.prototype.set=function(t,o){this.map[n(t)]=a(o)},c.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),s(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),s(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),s(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,o){var e,r,i=(o=o||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new c(o.headers)),this.method=(e=o.method||this.method||"GET",r=e.toUpperCase(),p.indexOf(r)>-1?r:e),this.mode=o.mode||this.mode||null,this.signal=o.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function g(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),r=e.shift().replace(/\+/g," "),i=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(r),decodeURIComponent(i))}})),o}function b(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function v(t,r){return new Promise((function(i,n){var a=new y(t,r);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var t,o,e={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),r=e.shift().trim();if(r){var i=e.join(":").trim();o.append(r,i)}})),o)};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new b(r,e))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new o.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&e.blob&&(s.responseType="blob"),a.headers.forEach((function(t,o){s.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",l)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=c,t.Request=y,t.Response=b),o.Headers=c,o.Request=y,o.Response=b,o.fetch=v,Object.defineProperty(o,"U",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Pr||(Pr={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(jr||(jr={})),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"}(Dr||(Dr={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Fr||(Fr={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Zr||(Zr={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(Br||(Br={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(_r||(_r={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}($r||($r={})),function(t){t.ASC="ASC",t.DESC="DESC"}(zr||(zr={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(Hr||(Hr={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Gr||(Gr={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(qr||(qr={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Vr||(Vr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Yr||(Yr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Jr||(Jr={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(Xr||(Xr={})),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.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Qr||(Qr={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(ti||(ti={}));const oi={[Qr.PERSONAL_BOOK_SHARE_USER]:[Qr.PERSONAL_BOOK_USER],[Qr.HTML_EXPORT_USER]:[Qr.PERSONAL_BOOK_USER],[Qr.PDF_EXPORT_USER]:[Qr.PERSONAL_BOOK_USER],[Qr.KHUB_ADMIN]:[Qr.CONTENT_PUBLISHER],[Qr.ADMIN]:[Qr.KHUB_ADMIN,Qr.USERS_ADMIN,Qr.PORTAL_ADMIN],[Qr.DEVELOPER]:[Qr.BETA_USER,Qr.DEBUG_USER]};function ei(t,o){return t===o||(oi[t]??[]).some((t=>ei(t,o)))}function ri(t,o){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>ei(t,o)))}var ii;t.FtReaderFeatures=void 0,(ii=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",ii.RATING="RATING",ii.PRINT="PRINT",ii.BOOKMARK="BOOKMARK",ii.COLLECTIONS="COLLECTIONS",ii.PERSONAL_BOOKS="PERSONAL_BOOKS";const ni=Ot`
101
+ `;class Ko{constructor(t,o){this.defaultLabels=t,this.labels=o}resolve(t,...o){var e,r;t=this.resolvePluralKey(t,o);let i=null!==(r=null!==(e=this.labels[t])&&void 0!==e?e:this.defaultLabels[t])&&void 0!==r?r:"";return o.forEach(((t,o)=>i=i.replace(new RegExp(`\\{${o}([^}]*)\\}`,"g"),((o,e)=>this.formatValue(t,e))))),i}resolvePluralKey(t,o){for(let e of o)if("number"==typeof e){const o=`${String(t)}[\\=${e}]`;if(o in this.labels||o in this.defaultLabels)return o}return t}formatValue(t,o){return t instanceof Date?this.formatDate(t,o):null!=t?t:""}formatDate(t,o){const e=e=>(null==o?void 0:o.includes("date"))?t.toLocaleDateString(e):(null==o?void 0:o.includes("time"))?t.toLocaleTimeString(e):t.toLocaleString(e);try{return e(document.documentElement.lang)}catch(t){return e()}}}const To=t=>{const o=null!=t?t:{};return(t,e)=>{var r;const i={hasChanged:(t,o)=>!W(t,o),attribute:!1,...o};I(i)(t,e);const n=t.constructor;n.reduxProperties=new Map(n.reduxProperties),n.reduxProperties.set(e,{selector:null!==(r=o.selector)&&void 0!==r?r:t=>t[e],store:o.store})}};class Mo{constructor(){this.queue=[]}add(t,o=!1){o&&(this.queue=this.queue.filter((o=>o.type!==t.type))),this.queue.push(t)}consume(t){const o=this.queue.find((o=>o.type===t));return o&&(this.queue=this.queue.filter((t=>t!==o))),o}}function Po(t){var o;return null!==(o=null==t?void 0:t.isFtReduxStore)&&void 0!==o&&o}var jo,Do,Fo;const Zo=Symbol("internalReduxEventsUnsubscribers"),_o=Symbol("internalStoresUnsubscribers"),Bo=Symbol("internalStores");class $o extends Wo{constructor(){super(...arguments),this[jo]=new Map,this[Do]=new Map,this[Fo]=[]}get reduxConstructor(){return this.constructor}update(t){super.update(t),[...this.reduxConstructor.reduxReactiveProperties].some((o=>t.has(o)))&&this.updateFromStores()}getUnnamedStore(){if(this[Bo].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[Bo].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[Bo].get(t)}addStore(t,o){var e;o=null!==(e=null!=o?o:Po(t)?t.name:void 0)&&void 0!==e?e:"default-store",this.unsubscribeFromStore(o),this.setupStore(o,t)}removeStore(t){const o="string"==typeof t?t:t.name;this.unsubscribeFromStore(o),this[Bo].delete(o)}setupStore(t,o){this[Bo].set(t,o),this.subscribeToStore(t,o),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[Bo].forEach(((t,o)=>this.subscribeToStore(o,t))),this.updateFromStores()}updateFromStores(){this.reduxConstructor.reduxProperties.forEach(((t,o)=>{const e=this.constructor.getPropertyOptions(o);if(!(null==e?void 0:e.attribute)||!this.hasAttribute("string"==typeof(null==e?void 0:e.attribute)?e.attribute:o)){const e=this.getStore(t.store);e&&(t.store?this[_o].has(t.store):this[_o].size>0)&&(this[o]=t.selector(e.getState(),this))}}))}subscribeToStore(t,o){var e;this[_o].set(t,o.subscribe((()=>this.updateFromStores()))),Po(o)&&o.eventBus&&(null===(e=this.reduxConstructor.reduxEventListeners)||void 0===e||e.forEach(((t,e)=>{if("function"==typeof this[e]&&(!t.store||o.name===t.store)){const r=t=>this[e](t);o.eventBus.addEventListener(t.eventName,r),this[Zo].push((()=>o.eventBus.removeEventListener(t.eventName,r)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[_o].forEach(((t,o)=>this.unsubscribeFromStore(o))),this[Zo].forEach((t=>t())),this[Zo]=[]}unsubscribeFromStore(t){this[_o].has(t)&&this[_o].get(t)(),this[_o].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}function zo(t){for(var o=arguments.length,e=Array(o>1?o-1:0),r=1;r<o;r++)e[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+t+(e.length?" "+e.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Ho(t){return!!t&&!!t[We]}function Go(t){var o;return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;var e=Object.hasOwnProperty.call(o,"constructor")&&o.constructor;return e===Object||"function"==typeof e&&Function.toString.call(e)===ke}(t)||Array.isArray(t)||!!t[Ae]||!!(null===(o=t.constructor)||void 0===o?void 0:o[Ae])||Qo(t)||te(t))}function qo(t,o,e){void 0===e&&(e=!1),0===Vo(t)?(e?Object.keys:Ke)(t).forEach((function(r){e&&"symbol"==typeof r||o(r,t[r],t)})):t.forEach((function(e,r){return o(r,e,t)}))}function Vo(t){var o=t[We];return o?o.i>3?o.i-4:o.i:Array.isArray(t)?1:Qo(t)?2:te(t)?3:0}function Yo(t,o){return 2===Vo(t)?t.has(o):Object.prototype.hasOwnProperty.call(t,o)}function Jo(t,o,e){var r=Vo(t);2===r?t.set(o,e):3===r?t.add(e):t[o]=e}function Xo(t,o){return t===o?0!==t||1/t==1/o:t!=t&&o!=o}function Qo(t){return Re&&t instanceof Map}function te(t){return Ue&&t instanceof Set}function oe(t){return t.o||t.t}function ee(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var o=Te(t);delete o[We];for(var e=Ke(o),r=0;r<e.length;r++){var i=e[r],n=o[i];!1===n.writable&&(n.writable=!0,n.configurable=!0),(n.get||n.set)&&(o[i]={configurable:!0,writable:!0,enumerable:n.enumerable,value:t[i]})}return Object.create(Object.getPrototypeOf(t),o)}function re(t,o){return void 0===o&&(o=!1),ne(t)||Ho(t)||!Go(t)||(Vo(t)>1&&(t.set=t.add=t.clear=t.delete=ie),Object.freeze(t),o&&qo(t,(function(t,o){return re(o,!0)}),!0)),t}function ie(){zo(2)}function ne(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function ae(t){var o=Me[t];return o||zo(18,t),o}function se(){return xe}function ce(t,o){o&&(ae("Patches"),t.u=[],t.s=[],t.v=o)}function le(t){fe(t),t.p.forEach(ue),t.p=null}function fe(t){t===xe&&(xe=t.l)}function he(t){return xe={p:[],l:xe,h:t,m:!0,_:0}}function ue(t){var o=t[We];0===o.i||1===o.i?o.j():o.g=!0}function de(t,o){o._=o.p.length;var e=o.p[0],r=void 0!==t&&t!==e;return o.h.O||ae("ES5").S(o,t,r),r?(e[We].P&&(le(o),zo(4)),Go(t)&&(t=pe(o,t),o.l||ge(o,t)),o.u&&ae("Patches").M(e[We].t,t,o.u,o.s)):t=pe(o,e,[]),le(o),o.u&&o.v(o.u,o.s),t!==Le?t:void 0}function pe(t,o,e){if(ne(o))return o;var r=o[We];if(!r)return qo(o,(function(i,n){return ye(t,r,o,i,n,e)}),!0),o;if(r.A!==t)return o;if(!r.P)return ge(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=ee(r.k):r.o,n=i,a=!1;3===r.i&&(n=new Set(i),i.clear(),a=!0),qo(n,(function(o,n){return ye(t,r,i,o,n,e,a)})),ge(t,i,!1),e&&t.u&&ae("Patches").N(r,e,t.u,t.s)}return r.o}function ye(t,o,e,r,i,n,a){if(Ho(i)){var s=pe(t,i,n&&o&&3!==o.i&&!Yo(o.R,r)?n.concat(r):void 0);if(Jo(e,r,s),!Ho(s))return;t.m=!1}else a&&e.add(i);if(Go(i)&&!ne(i)){if(!t.h.D&&t._<1)return;pe(t,i),o&&o.A.l||ge(t,i)}}function ge(t,o,e){void 0===e&&(e=!1),!t.l&&t.h.D&&t.m&&re(o,e)}function be(t,o){var e=t[We];return(e?oe(e):t)[o]}function me(t,o){if(o in t)for(var e=Object.getPrototypeOf(t);e;){var r=Object.getOwnPropertyDescriptor(e,o);if(r)return r;e=Object.getPrototypeOf(e)}}function ve(t){t.P||(t.P=!0,t.l&&ve(t.l))}function Oe(t){t.o||(t.o=ee(t.t))}function we(t,o,e){var r=Qo(o)?ae("MapSet").F(o,e):te(o)?ae("MapSet").T(o,e):t.O?function(t,o){var e=Array.isArray(t),r={i:e?1:0,A:o?o.A:se(),P:!1,I:!1,R:{},l:o,t,k:null,o:null,j:null,C:!1},i=r,n=Pe;e&&(i=[r],n=je);var a=Proxy.revocable(i,n),s=a.revoke,c=a.proxy;return r.k=c,r.j=s,c}(o,e):ae("ES5").J(o,e);return(e?e.A:se()).p.push(r),r}function Ne(t){return Ho(t)||zo(22,t),function t(o){if(!Go(o))return o;var e,r=o[We],i=Vo(o);if(r){if(!r.P&&(r.i<4||!ae("ES5").K(r)))return r.t;r.I=!0,e=Se(o,i),r.I=!1}else e=Se(o,i);return qo(e,(function(o,i){r&&function(t,o){return 2===Vo(t)?t.get(o):t[o]}(r.t,o)===i||Jo(e,o,t(i))})),3===i?new Set(e):e}(t)}function Se(t,o){switch(o){case 2:return new Map(t);case 3:return Array.from(t)}return ee(t)}jo=_o,Do=Bo,Fo=Zo,$o.reduxProperties=new Map,$o.reduxReactiveProperties=new Set,$o.reduxEventListeners=new Map;var Ee,xe,Ce="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Re="undefined"!=typeof Map,Ue="undefined"!=typeof Set,Ie="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Le=Ce?Symbol.for("immer-nothing"):((Ee={})["immer-nothing"]=!0,Ee),Ae=Ce?Symbol.for("immer-draftable"):"__$immer_draftable",We=Ce?Symbol.for("immer-state"):"__$immer_state",ke=""+Object.prototype.constructor,Ke="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,Te=Object.getOwnPropertyDescriptors||function(t){var o={};return Ke(t).forEach((function(e){o[e]=Object.getOwnPropertyDescriptor(t,e)})),o},Me={},Pe={get:function(t,o){if(o===We)return t;var e=oe(t);if(!Yo(e,o))return function(t,o,e){var r,i=me(o,e);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(t.k):void 0}(t,e,o);var r=e[o];return t.I||!Go(r)?r:r===be(t.t,o)?(Oe(t),t.o[o]=we(t.A.h,r,t)):r},has:function(t,o){return o in oe(t)},ownKeys:function(t){return Reflect.ownKeys(oe(t))},set:function(t,o,e){var r=me(oe(t),o);if(null==r?void 0:r.set)return r.set.call(t.k,e),!0;if(!t.P){var i=be(oe(t),o),n=null==i?void 0:i[We];if(n&&n.t===e)return t.o[o]=e,t.R[o]=!1,!0;if(Xo(e,i)&&(void 0!==e||Yo(t.t,o)))return!0;Oe(t),ve(t)}return t.o[o]===e&&(void 0!==e||o in t.o)||Number.isNaN(e)&&Number.isNaN(t.o[o])||(t.o[o]=e,t.R[o]=!0),!0},deleteProperty:function(t,o){return void 0!==be(t.t,o)||o in t.t?(t.R[o]=!1,Oe(t),ve(t)):delete t.R[o],t.o&&delete t.o[o],!0},getOwnPropertyDescriptor:function(t,o){var e=oe(t),r=Reflect.getOwnPropertyDescriptor(e,o);return r?{writable:!0,configurable:1!==t.i||"length"!==o,enumerable:r.enumerable,value:e[o]}:r},defineProperty:function(){zo(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){zo(12)}},je={};qo(Pe,(function(t,o){je[t]=function(){return arguments[0]=arguments[0][0],o.apply(this,arguments)}})),je.deleteProperty=function(t,o){return je.set.call(this,t,o,void 0)},je.set=function(t,o,e){return Pe.set.call(this,t[0],o,e,t[0])};var De=function(){function t(t){var o=this;this.O=Ie,this.D=!0,this.produce=function(t,e,r){if("function"==typeof t&&"function"!=typeof e){var i=e;e=t;var n=o;return function(t){var o=this;void 0===t&&(t=i);for(var r=arguments.length,a=Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];return n.produce(t,(function(t){var r;return(r=e).call.apply(r,[o,t].concat(a))}))}}var a;if("function"!=typeof e&&zo(6),void 0!==r&&"function"!=typeof r&&zo(7),Go(t)){var s=he(o),c=we(o,t,void 0),l=!0;try{a=e(c),l=!1}finally{l?le(s):fe(s)}return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(t){return ce(s,r),de(t,s)}),(function(t){throw le(s),t})):(ce(s,r),de(a,s))}if(!t||"object"!=typeof t){if(void 0===(a=e(t))&&(a=t),a===Le&&(a=void 0),o.D&&re(a,!0),r){var f=[],h=[];ae("Patches").M(t,a,f,h),r(f,h)}return a}zo(21,t)},this.produceWithPatches=function(t,e){if("function"==typeof t)return function(e){for(var r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return o.produceWithPatches(e,(function(o){return t.apply(void 0,[o].concat(i))}))};var r,i,n=o.produce(t,e,(function(t,o){r=t,i=o}));return"undefined"!=typeof Promise&&n instanceof Promise?n.then((function(t){return[t,r,i]})):[n,r,i]},"boolean"==typeof(null==t?void 0:t.useProxies)&&this.setUseProxies(t.useProxies),"boolean"==typeof(null==t?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze)}var o=t.prototype;return o.createDraft=function(t){Go(t)||zo(8),Ho(t)&&(t=Ne(t));var o=he(this),e=we(this,t,void 0);return e[We].C=!0,fe(o),e},o.finishDraft=function(t,o){var e=(t&&t[We]).A;return ce(e,o),de(void 0,e)},o.setAutoFreeze=function(t){this.D=t},o.setUseProxies=function(t){t&&!Ie&&zo(20),this.O=t},o.applyPatches=function(t,o){var e;for(e=o.length-1;e>=0;e--){var r=o[e];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}e>-1&&(o=o.slice(e+1));var i=ae("Patches").$;return Ho(t)?i(t,o):this.produce(t,(function(t){return i(t,o)}))},t}(),Fe=new De,Ze=Fe.produce;function _e(t){return _e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_e(t)}function Be(t){var o=function(t,o){if("object"!==_e(t)||null===t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,o||"default");if("object"!==_e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===o?String:Number)(t)}(t,"string");return"symbol"===_e(o)?o:String(o)}function $e(t,o,e){return(o=Be(o))in t?Object.defineProperty(t,o,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[o]=e,t}function ze(t,o){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);o&&(r=r.filter((function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),e.push.apply(e,r)}return e}function He(t){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{};o%2?ze(Object(e),!0).forEach((function(o){$e(t,o,e[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ze(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}))}return t}function Ge(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. "}Fe.produceWithPatches.bind(Fe),Fe.setAutoFreeze.bind(Fe),Fe.setUseProxies.bind(Fe),Fe.applyPatches.bind(Fe),Fe.createDraft.bind(Fe),Fe.finishDraft.bind(Fe);var qe="function"==typeof Symbol&&Symbol.observable||"@@observable",Ve=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ye={INIT:"@@redux/INIT"+Ve(),REPLACE:"@@redux/REPLACE"+Ve(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ve()}};function Je(t,o,e){var r;if("function"==typeof o&&"function"==typeof e||"function"==typeof e&&"function"==typeof arguments[3])throw new Error(Ge(0));if("function"==typeof o&&void 0===e&&(e=o,o=void 0),void 0!==e){if("function"!=typeof e)throw new Error(Ge(1));return e(Je)(t,o)}if("function"!=typeof t)throw new Error(Ge(2));var i=t,n=o,a=[],s=a,c=!1;function l(){s===a&&(s=a.slice())}function f(){if(c)throw new Error(Ge(3));return n}function h(t){if("function"!=typeof t)throw new Error(Ge(4));if(c)throw new Error(Ge(5));var o=!0;return l(),s.push(t),function(){if(o){if(c)throw new Error(Ge(6));o=!1,l();var e=s.indexOf(t);s.splice(e,1),a=null}}}function u(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var o=t;null!==Object.getPrototypeOf(o);)o=Object.getPrototypeOf(o);return Object.getPrototypeOf(t)===o}(t))throw new Error(Ge(7));if(void 0===t.type)throw new Error(Ge(8));if(c)throw new Error(Ge(9));try{c=!0,n=i(n,t)}finally{c=!1}for(var o=a=s,e=0;e<o.length;e++){(0,o[e])()}return t}return u({type:Ye.INIT}),(r={dispatch:u,subscribe:h,getState:f,replaceReducer:function(t){if("function"!=typeof t)throw new Error(Ge(10));i=t,u({type:Ye.REPLACE})}})[qe]=function(){var t,o=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(Ge(11));function e(){t.next&&t.next(f())}return e(),{unsubscribe:o(e)}}})[qe]=function(){return this},t},r}function Xe(t){for(var o=Object.keys(t),e={},r=0;r<o.length;r++){var i=o[r];"function"==typeof t[i]&&(e[i]=t[i])}var n,a=Object.keys(e);try{!function(t){Object.keys(t).forEach((function(o){var e=t[o];if(void 0===e(void 0,{type:Ye.INIT}))throw new Error(Ge(12));if(void 0===e(void 0,{type:Ye.PROBE_UNKNOWN_ACTION()}))throw new Error(Ge(13))}))}(e)}catch(t){n=t}return function(t,o){if(void 0===t&&(t={}),n)throw n;for(var r=!1,i={},s=0;s<a.length;s++){var c=a[s],l=e[c],f=t[c],h=l(f,o);if(void 0===h)throw o&&o.type,new Error(Ge(14));i[c]=h,r=r||h!==f}return(r=r||a.length!==Object.keys(t).length)?i:t}}function Qe(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return 0===o.length?function(t){return t}:1===o.length?o[0]:o.reduce((function(t,o){return function(){return t(o.apply(void 0,arguments))}}))}function tr(){for(var t=arguments.length,o=new Array(t),e=0;e<t;e++)o[e]=arguments[e];return function(t){return function(){var e=t.apply(void 0,arguments),r=function(){throw new Error(Ge(15))},i={getState:e.getState,dispatch:function(){return r.apply(void 0,arguments)}},n=o.map((function(t){return t(i)}));return r=Qe.apply(void 0,n)(e.dispatch),He(He({},e),{},{dispatch:r})}}}function or(t){return function(o){var e=o.dispatch,r=o.getState;return function(o){return function(i){return"function"==typeof i?i(e,r,t):o(i)}}}}var er=or();er.withExtraArgument=or;var rr,ir=er,nr=(rr=function(t,o){return rr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,o){t.__proto__=o}||function(t,o){for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])},rr(t,o)},function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}rr(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}),ar=function(t,o){var e,r,i,n,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(n){return function(s){return function(n){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,r&&(i=2&n[0]?r.return:n[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,n[1])).done)return i;switch(r=0,i&&(n=[2&n[0],i.value]),n[0]){case 0:case 1:i=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,r=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]<i[3])){a.label=n[1];break}if(6===n[0]&&a.label<i[1]){a.label=i[1],i=n;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(n);break}i[2]&&a.ops.pop(),a.trys.pop();continue}n=o.call(t,a)}catch(t){n=[6,t],r=0}finally{e=i=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}},sr=function(t,o){for(var e=0,r=o.length,i=t.length;e<r;e++,i++)t[i]=o[e];return t},cr=Object.defineProperty,lr=Object.defineProperties,fr=Object.getOwnPropertyDescriptors,hr=Object.getOwnPropertySymbols,ur=Object.prototype.hasOwnProperty,dr=Object.prototype.propertyIsEnumerable,pr=function(t,o,e){return o in t?cr(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e},yr=function(t,o){for(var e in o||(o={}))ur.call(o,e)&&pr(t,e,o[e]);if(hr)for(var r=0,i=hr(o);r<i.length;r++){e=i[r];dr.call(o,e)&&pr(t,e,o[e])}return t},gr=function(t,o){return lr(t,fr(o))},br="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Qe:Qe.apply(null,arguments)};var mr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return nr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,sr([void 0],t[0].concat(this)))):new(o.bind.apply(o,sr([void 0],t.concat(this))))},o}(Array),vr=function(t){function o(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=t.apply(this,e)||this;return Object.setPrototypeOf(i,o.prototype),i}return nr(o,t),Object.defineProperty(o,Symbol.species,{get:function(){return o},enumerable:!1,configurable:!0}),o.prototype.concat=function(){for(var o=[],e=0;e<arguments.length;e++)o[e]=arguments[e];return t.prototype.concat.apply(this,o)},o.prototype.prepend=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 1===t.length&&Array.isArray(t[0])?new(o.bind.apply(o,sr([void 0],t[0].concat(this)))):new(o.bind.apply(o,sr([void 0],t.concat(this))))},o}(Array);function Or(t){return Go(t)?Ze(t,(function(){})):t}function wr(){return function(t){return function(t){void 0===t&&(t={});var o=t.thunk,e=void 0===o||o;t.immutableCheck,t.serializableCheck;var r=new mr;e&&(!function(t){return"boolean"==typeof t}(e)?r.push(ir.withExtraArgument(e.extraArgument)):r.push(ir));return r}(t)}}function Nr(t){var o,e=wr(),r=t||{},i=r.reducer,n=void 0===i?void 0:i,a=r.middleware,s=void 0===a?e():a,c=r.devTools,l=void 0===c||c,f=r.preloadedState,h=void 0===f?void 0:f,u=r.enhancers,d=void 0===u?void 0:u;if("function"==typeof n)o=n;else{if(!function(t){if("object"!=typeof t||null===t)return!1;var o=Object.getPrototypeOf(t);if(null===o)return!0;for(var e=o;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return o===e}(n))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');o=Xe(n)}var p=s;"function"==typeof p&&(p=p(e));var y=tr.apply(void 0,p),g=Qe;l&&(g=br(yr({trace:!1},"object"==typeof l&&l)));var b=new vr(y),m=b;return Array.isArray(d)?m=sr([y],d):"function"==typeof d&&(m=d(b)),Je(o,h,g.apply(void 0,m))}function Sr(t,o){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(o){var i=o.apply(void 0,e);if(!i)throw new Error("prepareAction did not return an object");return yr(yr({type:t,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:t,payload:e[0]}}return e.toString=function(){return""+t},e.type=t,e.match=function(o){return o.type===t},e}function Er(t){var o,e={},r=[],i={addCase:function(t,o){var r="string"==typeof t?t:t.type;if(r in e)throw new Error("addCase cannot be called with two reducers for the same action type");return e[r]=o,i},addMatcher:function(t,o){return r.push({matcher:t,reducer:o}),i},addDefaultCase:function(t){return o=t,i}};return t(i),[e,r,o]}function xr(t){var o=t.name;if(!o)throw new Error("`name` is a required option for createSlice");var e,r="function"==typeof t.initialState?t.initialState:Or(t.initialState),i=t.reducers||{},n=Object.keys(i),a={},s={},c={};function l(){var o="function"==typeof t.extraReducers?Er(t.extraReducers):[t.extraReducers],e=o[0],i=void 0===e?{}:e,n=o[1],a=void 0===n?[]:n,c=o[2],l=void 0===c?void 0:c,f=yr(yr({},i),s);return function(t,o,e,r){void 0===e&&(e=[]);var i,n="function"==typeof o?Er(o):[o,e,r],a=n[0],s=n[1],c=n[2];if(function(t){return"function"==typeof t}(t))i=function(){return Or(t())};else{var l=Or(t);i=function(){return l}}function f(t,o){void 0===t&&(t=i());var e=sr([a[o.type]],s.filter((function(t){return(0,t.matcher)(o)})).map((function(t){return t.reducer})));return 0===e.filter((function(t){return!!t})).length&&(e=[c]),e.reduce((function(t,e){if(e){var r;if(Ho(t))return void 0===(r=e(t,o))?t:r;if(Go(t))return Ze(t,(function(t){return e(t,o)}));if(void 0===(r=e(t,o))){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return r}return t}),t)}return f.getInitialState=i,f}(r,(function(t){for(var o in f)t.addCase(o,f[o]);for(var e=0,r=a;e<r.length;e++){var i=r[e];t.addMatcher(i.matcher,i.reducer)}l&&t.addDefaultCase(l)}))}return n.forEach((function(t){var e,r,n=i[t],l=o+"/"+t;"reducer"in n?(e=n.reducer,r=n.prepare):e=n,a[t]=e,s[l]=e,c[t]=r?Sr(l,r):Sr(l)})),{name:o,reducer:function(t,o){return e||(e=l()),e(t,o)},actions:c,caseReducers:a,getInitialState:function(){return e||(e=l()),e.getInitialState()}}}var Cr=["name","message","stack","code"],Rr=function(t,o){this.payload=t,this.meta=o},Ur=function(t,o){this.payload=t,this.meta=o},Ir=function(t){if("object"==typeof t&&null!==t){for(var o={},e=0,r=Cr;e<r.length;e++){var i=r[e];"string"==typeof t[i]&&(o[i]=t[i])}return o}return{message:String(t)}};function Lr(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}!function(){function t(t,o,e){var r=Sr(t+"/fulfilled",(function(t,o,e,r){return{payload:t,meta:gr(yr({},r||{}),{arg:e,requestId:o,requestStatus:"fulfilled"})}})),i=Sr(t+"/pending",(function(t,o,e){return{payload:void 0,meta:gr(yr({},e||{}),{arg:o,requestId:t,requestStatus:"pending"})}})),n=Sr(t+"/rejected",(function(t,o,r,i,n){return{payload:i,error:(e&&e.serializeError||Ir)(t||"Rejected"),meta:gr(yr({},n||{}),{arg:r,requestId:o,rejectedWithValue:!!i,requestStatus:"rejected",aborted:"AbortError"===(null==t?void 0:t.name),condition:"ConditionError"===(null==t?void 0:t.name)})}})),a="undefined"!=typeof AbortController?AbortController:function(){function t(){this.signal={aborted:!1,addEventListener:function(){},dispatchEvent:function(){return!1},onabort:function(){},removeEventListener:function(){},reason:void 0,throwIfAborted:function(){}}}return t.prototype.abort=function(){},t}();return Object.assign((function(t){return function(s,c,l){var f,h=(null==e?void 0:e.idGenerator)?e.idGenerator(t):function(t){void 0===t&&(t=21);for(var o="",e=t;e--;)o+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return o}(),u=new a;function d(t){f=t,u.abort()}var p=function(){return a=this,p=null,y=function(){var a,p,y,g,b,m;return ar(this,(function(v){switch(v.label){case 0:return v.trys.push([0,4,,5]),g=null==(a=null==e?void 0:e.condition)?void 0:a.call(e,t,{getState:c,extra:l}),null===(O=g)||"object"!=typeof O||"function"!=typeof O.then?[3,2]:[4,g];case 1:g=v.sent(),v.label=2;case 2:if(!1===g||u.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return b=new Promise((function(t,o){return u.signal.addEventListener("abort",(function(){return o({name:"AbortError",message:f||"Aborted"})}))})),s(i(h,t,null==(p=null==e?void 0:e.getPendingMeta)?void 0:p.call(e,{requestId:h,arg:t},{getState:c,extra:l}))),[4,Promise.race([b,Promise.resolve(o(t,{dispatch:s,getState:c,extra:l,requestId:h,signal:u.signal,abort:d,rejectWithValue:function(t,o){return new Rr(t,o)},fulfillWithValue:function(t,o){return new Ur(t,o)}})).then((function(o){if(o instanceof Rr)throw o;return o instanceof Ur?r(o.payload,h,t,o.meta):r(o,h,t)}))])];case 3:return y=v.sent(),[3,5];case 4:return m=v.sent(),y=m instanceof Rr?n(null,h,t,m.payload,m.meta):n(m,h,t),[3,5];case 5:return e&&!e.dispatchConditionRejection&&n.match(y)&&y.meta.condition||s(y),[2,y]}var O}))},new Promise((function(t,o){var e=function(t){try{i(y.next(t))}catch(t){o(t)}},r=function(t){try{i(y.throw(t))}catch(t){o(t)}},i=function(o){return o.done?t(o.value):Promise.resolve(o.value).then(e,r)};i((y=y.apply(a,p)).next())}));var a,p,y}();return Object.assign(p,{abort:d,requestId:h,arg:t,unwrap:function(){return p.then(Lr)}})}}),{pending:i,rejected:n,fulfilled:r,typePrefix:t})}t.withTypes=function(){return t}}();var Ar,Wr,kr="listenerMiddleware";Sr(kr+"/add"),Sr(kr+"/removeAll"),Sr(kr+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function t(t,o){var e=i[t];return e?e.enumerable=o:i[t]=e={configurable:!0,enumerable:o,get:function(){var o=this[We];return Pe.get(o,t)},set:function(o){var e=this[We];Pe.set(e,t,o)}},e}function o(t){for(var o=t.length-1;o>=0;o--){var i=t[o][We];if(!i.P)switch(i.i){case 5:r(i)&&ve(i);break;case 4:e(i)&&ve(i)}}}function e(t){for(var o=t.t,e=t.k,r=Ke(e),i=r.length-1;i>=0;i--){var n=r[i];if(n!==We){var a=o[n];if(void 0===a&&!Yo(o,n))return!0;var s=e[n],c=s&&s[We];if(c?c.t!==a:!Xo(s,a))return!0}}var l=!!o[We];return r.length!==Ke(o).length+(l?0:1)}function r(t){var o=t.k;if(o.length!==t.t.length)return!0;var e=Object.getOwnPropertyDescriptor(o,o.length-1);if(e&&!e.get)return!0;for(var r=0;r<o.length;r++)if(!o.hasOwnProperty(r))return!0;return!1}var i={};!function(t,o){Me[t]||(Me[t]=o)}("ES5",{J:function(o,e){var r=Array.isArray(o),i=function(o,e){if(o){for(var r=Array(e.length),i=0;i<e.length;i++)Object.defineProperty(r,""+i,t(i,!0));return r}var n=Te(e);delete n[We];for(var a=Ke(n),s=0;s<a.length;s++){var c=a[s];n[c]=t(c,o||!!n[c].enumerable)}return Object.create(Object.getPrototypeOf(e),n)}(r,o),n={i:r?5:4,A:e?e.A:se(),P:!1,I:!1,R:{},l:e,t:o,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,We,{value:n,writable:!0}),i},S:function(t,e,i){i?Ho(e)&&e[We].A===t&&o(t.p):(t.u&&function t(o){if(o&&"object"==typeof o){var e=o[We];if(e){var i=e.t,n=e.k,a=e.R,s=e.i;if(4===s)qo(n,(function(o){o!==We&&(void 0!==i[o]||Yo(i,o)?a[o]||t(n[o]):(a[o]=!0,ve(e)))})),qo(i,(function(t){void 0!==n[t]||Yo(n,t)||(a[t]=!1,ve(e))}));else if(5===s){if(r(e)&&(ve(e),a.length=!0),n.length<i.length)for(var c=n.length;c<i.length;c++)a[c]=!1;else for(var l=i.length;l<n.length;l++)a[l]=!0;for(var f=Math.min(n.length,i.length),h=0;h<f;h++)n.hasOwnProperty(h)||(a[h]=!0),void 0===a[h]&&t(n[h])}}}}(t.p[0]),o(t.p))},K:function(t){return 4===t.i?e(t):r(t)}})}(),window.ftReduxStores||(window.ftReduxStores={});class Kr{static get(t){var o;const e="string"==typeof t?t:t.name,r="string"==typeof t?void 0:t,i=window.ftReduxStores[e];if(Po(i))return i;if(null==r)return;const n=xr({...r,reducers:null!==(o=r.reducers)&&void 0!==o?o:{}}),a=Nr({reducer:(t,o)=>{var e;switch(o.type){case"CLEAR_FT_REDUX_STORE":return n.getInitialState();case"DEFAULT_STATE_FIELDS_VALUES_SETTER":return{...t,...null!==(e=o.overwrites)&&void 0!==e?e:{}};default:return n.reducer(t,o)}}});return window.ftReduxStores[r.name]=new Kr(n,a)}constructor(t,o){this.reduxSlice=t,this.reduxStore=o,this.isFtReduxStore=!0,this.eventBus=document.createElement("event-bus"),this.commands=new Mo,this.actions=new Proxy(this.reduxSlice.actions,{get:(t,o,e)=>{const r=o,i=t[r];return i?(...t)=>{const o=i(...t);return this.reduxStore.dispatch(o),o}:t=>{this.setState({[r]:t})}}})}clear(){this.reduxStore.dispatch({type:"CLEAR_FT_REDUX_STORE"})}setState(t){this.reduxStore.dispatch({type:"DEFAULT_STATE_FIELDS_VALUES_SETTER",overwrites:t})}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(t){throw new Error("Not implemented yet.")}subscribe(t){return this.reduxStore.subscribe(t)}get name(){return this.reduxSlice.name}get reducer(){return this.reduxSlice.reducer}get caseReducers(){return this.reduxSlice.caseReducers}getInitialState(){return this.reduxSlice.getInitialState()}}navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Wr=null===(Ar=window.safari)||void 0===Ar?void 0:Ar.pushNotification)||void 0===Wr||Wr.toString());class Tr{constructor(t){this.paginatedToc=t,this.nodeByTocId={},this.knownPrettyUrls=new Set,this.duplicatedPrettyUrls=new Set,this.pages=[],this.pageByTocId={}}build(){return{paginationConfiguration:this.paginatedToc.configuration,toc:this.convertNodes(this.paginatedToc.paginatedToc,1),pagesToc:this.extractPagesToc(this.paginatedToc.paginatedToc,1),nodeByTocId:this.nodeByTocId,duplicatedPrettyUrls:this.duplicatedPrettyUrls,pages:this.pages,pageByTocId:this.pageByTocId}}extractPagesToc(t,o,e){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,e)),null==t.tocId?this.extractPagesToc(t.children,o,e):[{tocId:t.tocId,title:t.title,depth:o,children:this.extractPagesToc(t.children,o+1,t.tocId)}])))}convertNodes(t,o,e){return t.flatMap((t=>{var r,i,n;if(null==t.tocId)return[...this.convertSectionNodes(null!==(r=t.pageToc)&&void 0!==r?r:[],o,t.tocId),...this.convertNodes(t.children,o,t.tocId)];let a=null===(i=t.prettyUrl)||void 0===i?void 0:i.replace(/^\//,"");const s={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:a,depth:o,parentTocId:e,children:[]};this.register(s);const c=this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],o+1,t.tocId),l=this.convertNodes(t.children,o+1,s.tocId);return s.children=[...c,...l],[s]}))}convertSectionNodes(t,o,e){return t.flatMap((t=>{var r;let i=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const n={...t,prettyUrl:i,depth:o,parentTocId:e,children:[]};return this.register(n),n.children=this.convertSectionNodes(t.children,o+1,t.tocId),[n]}))}buildPage(t,o){var e,r,i,n,a,s;const c={number:this.pages.length+1,title:null!==(e=t.title)&&void 0!==e?e:"",rootTocId:null!==(r=t.tocId)&&void 0!==r?r:"root",toc:(null!==(i=t.pageToc)&&void 0!==i?i:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:o?this.buildBreadcrumb(this.nodeByTocId[o]):[]},l=(t,o)=>(o?c.topics:c.hiddenTopics).push(t),f=null!==(a=null===(n=t.pageConfiguration)||void 0===n?void 0:n.parentsVisibility)&&void 0!==a?a:[];return c.breadcrumb.forEach(((t,o)=>{l(t,f[o])})),t.tocId&&l(t.tocId,t.pageConfiguration.isVisible),c.topics.push(...this.tocIds(null!==(s=t.pageToc)&&void 0!==s?s:[])),c}registerPage(t){for(let o of[...t.topics,...t.hiddenTopics])this.pageByTocId[o]||(this.pageByTocId[o]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const o=[t.tocId];for(;null==t?void 0:t.parentTocId;)o.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return o}register(t){t.prettyUrl&&(this.knownPrettyUrls.has(t.prettyUrl)&&this.duplicatedPrettyUrls.add(t.prettyUrl),this.knownPrettyUrls.add(t.prettyUrl)),this.nodeByTocId[t.tocId]=t}}class Mr{convertPaginatedToc(t){return new Tr(t).build()}}var Pr,jr,Dr,Fr,Zr,_r,Br,$r,zr,Hr,Gr,qr,Vr,Yr,Jr,Xr,Qr,ti;!function(t){!function(o){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(t){this.map={},t instanceof c?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function l(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function h(t){var o=new FileReader,e=f(o);return o.readAsArrayBuffer(t),e}function u(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=u(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=u(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?l(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=l(this);if(t)return t;if(this._bodyBlob)return function(t){var o=new FileReader,e=f(o);return o.readAsText(t),e}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),r=0;r<o.length;r++)e[r]=String.fromCharCode(o[r]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[n(t)]},c.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},c.prototype.set=function(t,o){this.map[n(t)]=a(o)},c.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),s(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),s(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),s(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function y(t,o){var e,r,i=(o=o||{}).body;if(t instanceof y){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new c(o.headers)),this.method=(e=o.method||this.method||"GET",r=e.toUpperCase(),p.indexOf(r)>-1?r:e),this.mode=o.mode||this.mode||null,this.signal=o.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function g(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),r=e.shift().replace(/\+/g," "),i=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(r),decodeURIComponent(i))}})),o}function b(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(t)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},d.call(y.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function v(t,r){return new Promise((function(i,n){var a=new y(t,r);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var t,o,e={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),r=e.shift().trim();if(r){var i=e.join(":").trim();o.append(r,i)}})),o)};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new b(r,e))},s.onerror=function(){n(new TypeError("Network request failed"))},s.ontimeout=function(){n(new TypeError("Network request failed"))},s.onabort=function(){n(new o.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&e.blob&&(s.responseType="blob"),a.headers.forEach((function(t,o){s.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",l)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}v.polyfill=!0,t.fetch||(t.fetch=v,t.Headers=c,t.Request=y,t.Response=b),o.Headers=c,o.Request=y,o.Response=b,o.fetch=v,Object.defineProperty(o,"U",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Pr||(Pr={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(jr||(jr={})),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"}(Dr||(Dr={})),function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Fr||(Fr={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Zr||(Zr={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(_r||(_r={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Br||(Br={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}($r||($r={})),function(t){t.ASC="ASC",t.DESC="DESC"}(zr||(zr={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(Hr||(Hr={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(Gr||(Gr={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(qr||(qr={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Vr||(Vr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Yr||(Yr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Jr||(Jr={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(Xr||(Xr={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.GENERATIVE_AI_USER="GENERATIVE_AI_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Qr||(Qr={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(ti||(ti={}));const oi={[Qr.PERSONAL_BOOK_SHARE_USER]:[Qr.PERSONAL_BOOK_USER],[Qr.HTML_EXPORT_USER]:[Qr.PERSONAL_BOOK_USER],[Qr.PDF_EXPORT_USER]:[Qr.PERSONAL_BOOK_USER],[Qr.KHUB_ADMIN]:[Qr.CONTENT_PUBLISHER],[Qr.ADMIN]:[Qr.KHUB_ADMIN,Qr.USERS_ADMIN,Qr.PORTAL_ADMIN],[Qr.DEVELOPER]:[Qr.BETA_USER,Qr.DEBUG_USER]};function ei(t,o){return t===o||(oi[t]??[]).some((t=>ei(t,o)))}function ri(t,o){if(null==t)return!1;return(Array.isArray(t)?t:Array.isArray(t.roles)?t.roles:Array.isArray(t.profile?.roles)?t.profile.roles:[]).some((t=>ei(t,o)))}var ii;t.FtReaderFeatures=void 0,(ii=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",ii.RATING="RATING",ii.PRINT="PRINT",ii.BOOKMARK="BOOKMARK",ii.COLLECTIONS="COLLECTIONS",ii.PERSONAL_BOOKS="PERSONAL_BOOKS";const ni=Ot`
102
102
  `,ai=Kr.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class si{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=ai.getState(),r=null!=t?t:e;if(o&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,r,!0)}static get(t){var o;return null!=t?si.build(t):null!==(o=si.API)&&void 0!==o?o:si.API=si.build()}static await(t){return new Promise((o=>{let e=si.get(t);if(e)o(e);else{const r=ai.subscribe((()=>{e=si.get(t),e&&(r(),o(e))}))}}))}}var ci;const li=Symbol("clearAfterUnitTest");class fi{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new r,this.listeners={},this.currentUiLocale="",this[ci]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=ai.getState().uiLocale,ai.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=ai.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,o){var e;if(t=t.toLowerCase(),Object.keys(o).length>0){const r={...null!==(e=this.defaultMessages[t])&&void 0!==e?e:{},...o};W(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,o,...e){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new Ko(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(o,...e)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>L(0).then((()=>t())).catch((()=>null)))))}}ci=li,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new fi((async(t,o)=>(await si.await()).getFluidTopicsMessageContext(t,o)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new fi((async(t,o)=>(await si.await()).getCustomMessageContext(t,o))));const hi=window.FluidTopicsI18nService;var ui=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class di extends Wo{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>si.get(),this.cache=new r,this.cleanSessionDebouncer=new n}render(){return eo`
103
103
  <slot></slot>
104
- `}update(t){super.update(t),t.has("baseUrl")&&(ai.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ai.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ai.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ai.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ai.actions.noCustom(this.noCustom),t.has("editorMode")&&ai.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ai.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ai.actions.session(this.session),t.has("availableUiLocales")&&ai.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>hi.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}di.elementDefinitions={},di.styles=ni,ui([I()],di.prototype,"baseUrl",void 0),ui([I()],di.prototype,"apiIntegrationIdentifier",void 0),ui([I()],di.prototype,"uiLocale",void 0),ui([K(null)],di.prototype,"availableUiLocales",void 0),ui([K(null)],di.prototype,"metadataConfiguration",void 0),ui([I({type:Boolean})],di.prototype,"editorMode",void 0),ui([I({type:Boolean})],di.prototype,"noCustom",void 0),ui([I({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],di.prototype,"noCustomComponent",void 0),ui([I({type:Boolean})],di.prototype,"withManualResources",void 0),ui([K([])],di.prototype,"messageContexts",void 0),ui([K(void 0)],di.prototype,"session",void 0),ui([I({type:Object})],di.prototype,"apiProvider",void 0);class pi{async listMySearches(){var t;return(null===(t=ai.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await si.await()).listMySearches(ai.getState().session.profile.userId):[]}}const yi=new r;class gi{async listMyBookmarks(){return yi.get("bookmarks",(async()=>(await si.await()).listMyBookmarks(ai.getState().session.profile.userId)))}clearCache(){yi.clear("bookmarks")}}const bi=Kr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const mi=new class{constructor(){this.currentSession=ai.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new gi,ai.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=ai.getState();W(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){bi.actions.savedSearches(void 0)}clearMyBookmarks(){bi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new pi,o=await t.listMySearches();bi.actions.savedSearches(o)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;bi.actions.bookmarks(o)}}};k("ft-app-context")(di);class vi{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,o,e,r){this.converter=t,this.api=o,this.cache=e,this._mapId=r,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,o;return ri(null!==(o=null===(t=ai.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==o?o:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var o;return null===(o=this.enrichedToc)||void 0===o?void 0:o.nodeByTocId[t]}async getPage(t){const o=await this.getEnrichedToc();return o.pages[t-1]||o.pages[0]}async getPageByTocId(t){const o=await this.getEnrichedToc();return o.pageByTocId[t]||o.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getAttachments(){return this.cache.get("map-attachments",(()=>this.fetchAttachments()))}getRelativesForDocument(t,o){return this.cache.get("document-relatives-"+t+"-"+o.join("-"),(()=>this.fetchRelativesForDocument(t,o)))}getRelativesForTopicInMap(t,o,e){return this.cache.get("topic-relatives-"+[t,o,...e].join("-"),(()=>this.fetchRelativesForTopicInMap(t,o,e)))}getAttachmentDownloadLink(t){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(t).content}?download=true`)}getLink(t,o,e){const r=this.getNavigationData(t,o,e),i=this.getReaderLinkPrefix()+(r.prettyUrl?r.prettyUrl:`${r.mapId}/${r.tocId}`),n=new URL(i,this.api.tenantBaseUrl);return null!=r.page&&n.searchParams.set("page",`${r.page}`),r.prettyUrlDuplicated&&n.searchParams.set("tocId",r.tocId),null!=r.section&&n.searchParams.set("section",r.section),n.href}getNavigationData(t,o,e){var r,i;t=t||"root";const n=this.enrichedToc,a=null==n?void 0:n.pageByTocId[t],s=null==n?void 0:n.nodeByTocId[t],c=null==s?void 0:s.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(r=null==s?void 0:s.title)&&void 0!==r?r:"",page:o&&a&&a.number!==o?o:void 0,prettyUrl:null!=c?c.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(i=null==n?void 0:n.duplicatedPrettyUrls.has(null!=c?c:""))&&void 0!==i&&i,section:e}}async getAccurateNavigationData(t,o,e){return await this.getEnrichedToc(),this.getNavigationData(t,o,e)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((o=>{var e;return o?{type:o.topics.type,rating:null===(e=o.topics)||void 0===e?void 0:e.ratings.find((o=>o.tocId===t))}:void 0}))}rateMap(t,o){return this.makeRateMapRequest(t,o).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,o){return this.makeMapFeedbackRequest(t,o)}rateTopic(t,o,e){return this.makeRateTopicRequest(t,o,e).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=ai.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,o,e){return this.makeTopicFeedbackRequest(t,o,e)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let o=this.getTocNodeNow(t),e=[{tocId:o.tocId,title:o.title}],r=this.getTocNodeNow(o.parentTocId);for(;r;)e.unshift({tocId:r.tocId,title:r.title}),r=this.getTocNodeNow(r.parentTocId);return e}isFeatureAccessible(o,{session:e,ratingType:r}){if(!this.isFeatureAvailable(o))return!1;switch(o){case t.FtReaderFeatures.FEEDBACK:return ri(null!=e?e:[],Qr.FEEDBACK_USER);case t.FtReaderFeatures.RATING:return ri(null!=e?e:[],Qr.RATING_USER)&&null!=r&&r!==_r.NO_RATING;case t.FtReaderFeatures.PRINT:return ri(null!=e?e:[],Qr.PRINT_USER);case t.FtReaderFeatures.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case t.FtReaderFeatures.COLLECTIONS:return ri(null!=e?e:[],Qr.COLLECTION_USER);case t.FtReaderFeatures.PERSONAL_BOOKS:return ri(null!=e?e:[],Qr.PERSONAL_BOOK_USER);default:return!1}}makeAbsolute(t){return this.api.makeAbsolute(t)}}class Oi extends vi{static async build(t){return new Oi(new Mr,await si.await(),new r,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){const o=await this.api.getMap(t);return this.fingerprint=o.fingerprint,o}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch((()=>[]))}fetchRelativesForDocument(t,o){return this.api.search({query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",filters:[{negative:!1,values:o,key:t}],sort:[],facets:[]})}fetchRelativesForTopicInMap(t,o,e){return this.api.search({query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",filters:[{negative:!1,values:e,key:o},{negative:!1,values:[t],key:"ft:publicationId"}],sort:[],facets:[]})}makeMapFeedbackRequest(t,o){return this.api.sendMapFeedback(this.mapId,t,o)}makeRateMapRequest(t,o){return this.api.rateMap(this.mapId,t,o)}makeRateTopicRequest(t,o,e){return this.api.rateTopic(this.mapId,t,o,e)}makeTopicFeedbackRequest(t,o,e){return this.api.sendTopicFeedback(this.mapId,t,o,e)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class wi{static build(t,o){return new wi((t=>Kr.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0}}))(t.trim()||"context"),null!=o?o:Oi.build)}constructor(t,o){this.store=t,this.metadataForSwitchToRelatives=new Set,this.loadDebouncer=new n(10),this.initService(o)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){return A((()=>this.service))}async navigateToTopic(t,o,e){const r=await this.awaitService(),i=await(null!=e?r.getPage(e):r.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(i),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,i),section:o})}resolveValidNonRootTocId(t,o){var e,r,i;let n=null!==(e="root"===t?void 0:t)&&void 0!==e?e:o.rootTocId;return o.topics.includes(n)?n:null!==(i=null!==(r=o.topics[0])&&void 0!==r?r:o.hiddenTopics[0])&&void 0!==i?i:"root"}async navigateToPage(t){const o=await this.awaitService();let e=await o.getPage(t);this.store.actions.currentPage(e)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var t;(null===(t=this.service)||void 0===t?void 0:t.mapId)&&null==this.store.getState().map&&await this.loadDebouncer.run((()=>this.fetchData()))}clear(){var t;this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),this.store.actions.relatives(void 0),null===(t=this.service)||void 0===t||t.clear(),this.metadataForSwitchToRelatives=new Set,this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}async fetchData(){var t,e,r,i,n;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.map(t))),null===(r=this.service)||void 0===r?void 0:r.getToc().then((t=>this.store.actions.toc(t))),null===(i=this.service)||void 0===i?void 0:i.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))]).then((()=>{this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives()}))}catch(t){!this.errorHandler||t instanceof o||this.errorHandler(t)}}fetchRelatives(){var t,o,e;const r=null===(t=this.store.getState().map)||void 0===t?void 0:t.metadata.filter((t=>{var o;return t.key==(null===(o=this.store.getState().configuration)||void 0===o?void 0:o.relativePivotMetadata)})).flatMap((t=>t.values));void 0!==r&&r.length>0&&(null===(o=this.service)||void 0===o||o.getRelativesForDocument(null===(e=this.store.getState().configuration)||void 0===e?void 0:e.relativePivotMetadata,r).then((t=>{const o=t.results.flatMap((t=>t.entries));this.store.actions.relatives(o),this.createClusteringHelper()})))}createClusteringHelper(){var t,o;this.store.getState().relatives&&(this.clusteringHelper=new i(this.store.getState().relatives,this.store.getState().relatives.find((t=>{var o;return(null===(o=t.map)||void 0===o?void 0:o.mapId)==this.store.getState().mapId})),this.metadataForSwitchToRelatives,null!==(o=null===(t=ai.getState().metadataConfiguration)||void 0===t?void 0:t.descriptors)&&void 0!==o?o:[]),this.store.eventBus.dispatchEvent(new CustomEvent("clustering-helper-created")))}async navigateToRelativeTopicIfFound(t){var o,e,r;const i=await A((()=>{var t;return null===(t=this.store.getState().configuration)||void 0===t?void 0:t.relativeTopicPivotMetadata})),n=this.store.getState().mapId,a=await this.awaitService(),s=await a.getRelativesForTopicInMap(n,i,[t]);if(null===(r=null===(e=null===(o=null==s?void 0:s.results)||void 0===o?void 0:o[0])||void 0===e?void 0:e.entries)||void 0===r?void 0:r[0]){const t=s.results[0].entries[0].topic.tocId;return await this.navigateToTopic(t),!0}return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}registerMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.add(t),null==this.store.getState().relatives?this.fetchRelatives():this.createClusteringHelper()}unregisterMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.delete(t),this.createClusteringHelper()}}const Ni=Ot`
104
+ `}update(t){super.update(t),t.has("baseUrl")&&(ai.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&ai.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&ai.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&ai.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&ai.actions.noCustom(this.noCustom),t.has("editorMode")&&ai.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&ai.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&ai.actions.session(this.session),t.has("availableUiLocales")&&ai.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>hi.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}di.elementDefinitions={},di.styles=ni,ui([I()],di.prototype,"baseUrl",void 0),ui([I()],di.prototype,"apiIntegrationIdentifier",void 0),ui([I()],di.prototype,"uiLocale",void 0),ui([K(null)],di.prototype,"availableUiLocales",void 0),ui([K(null)],di.prototype,"metadataConfiguration",void 0),ui([I({type:Boolean})],di.prototype,"editorMode",void 0),ui([I({type:Boolean})],di.prototype,"noCustom",void 0),ui([I({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],di.prototype,"noCustomComponent",void 0),ui([I({type:Boolean})],di.prototype,"withManualResources",void 0),ui([K([])],di.prototype,"messageContexts",void 0),ui([K(void 0)],di.prototype,"session",void 0),ui([I({type:Object})],di.prototype,"apiProvider",void 0);class pi{async listMySearches(){var t;return(null===(t=ai.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await si.await()).listMySearches(ai.getState().session.profile.userId):[]}}const yi=new r;class gi{async listMyBookmarks(){return yi.get("bookmarks",(async()=>(await si.await()).listMyBookmarks(ai.getState().session.profile.userId)))}clearCache(){yi.clear("bookmarks")}}const bi=Kr.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const mi=new class{constructor(){this.currentSession=ai.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new gi,ai.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:o}=ai.getState();W(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==o?void 0:o.profile)||(this.currentSession=o,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){bi.actions.savedSearches(void 0)}clearMyBookmarks(){bi.actions.bookmarks(void 0)}async reloadMySearches(){const t=new pi,o=await t.listMySearches();bi.actions.savedSearches(o)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;bi.actions.bookmarks(o)}}};k("ft-app-context")(di);class vi{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,o,e,r){this.converter=t,this.api=o,this.cache=e,this._mapId=r,this.initCache()}async withMapId(t){return this._mapId?t(this._mapId):void 0}initCache(){this.cache.registerFinal("configuration",(()=>this.api.getReaderConfiguration())),this.cache.register("map",(()=>this.withMapId((t=>this.fetchMap(t))))),this.cache.register("enrichedToc",(()=>this.withMapId((t=>this.fetchPages(t).then((t=>this.converter.convertPaginatedToc(t))))))),this.cache.register("ratingSummary",(()=>{var t,o;return ri(null!==(o=null===(t=ai.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==o?o:[],"RATING_USER")?this.withMapId((t=>this.fetchMapRating(t))):Promise.resolve()}))}clear(){this.cache.clearAll()}getMap(){return this.cache.get("map")}getConfiguration(){return this.cache.get("configuration")}getEnrichedToc(){return this.cache.get("enrichedToc")}get enrichedToc(){return this.cache.getNow("enrichedToc")}async getPaginationConfiguration(){return(await this.getEnrichedToc()).paginationConfiguration}async getToc(){return(await this.getEnrichedToc()).toc}async getPagesToc(){return(await this.getEnrichedToc()).pagesToc}async getTocNode(t){return(await this.getEnrichedToc()).nodeByTocId[t]}getTocNodeNow(t){var o;return null===(o=this.enrichedToc)||void 0===o?void 0:o.nodeByTocId[t]}async getPage(t){const o=await this.getEnrichedToc();return o.pages[t-1]||o.pages[0]}async getPageByTocId(t){const o=await this.getEnrichedToc();return o.pageByTocId[t]||o.pages[0]}getTopicInfo(t){return this.cache.get("topic-"+t.tocId,(()=>this.fetchTopicMetadata(t)))}getTopicContent(t){return this.cache.get("topic-content-"+t.tocId,(()=>this.fetchTopicHTMLContent(t)))}getAttachments(){return this.cache.get("map-attachments",(()=>this.fetchAttachments()))}getRelativesForDocument(t,o){return this.cache.get("document-relatives-"+t+"-"+o.join("-"),(()=>this.fetchRelativesForDocument(t,o)))}getRelativesForTopicInMap(t,o,e){return this.cache.get("topic-relatives-"+[t,o,...e].join("-"),(()=>this.fetchRelativesForTopicInMap(t,o,e)))}getAttachmentDownloadLink(t){return this.makeAbsolute(`${this.api.endpoints.khub.maps.mapId(this.mapId).attachments.attachmentId(t).content}?download=true`)}getLink(t,o,e){const r=this.getNavigationData(t,o,e),i=this.getReaderLinkPrefix()+(r.prettyUrl?r.prettyUrl:`${r.mapId}/${r.tocId}`),n=new URL(i,this.api.tenantBaseUrl);return null!=r.page&&n.searchParams.set("page",`${r.page}`),r.prettyUrlDuplicated&&n.searchParams.set("tocId",r.tocId),null!=r.section&&n.searchParams.set("section",r.section),n.href}getNavigationData(t,o,e){var r,i;t=t||"root";const n=this.enrichedToc,a=null==n?void 0:n.pageByTocId[t],s=null==n?void 0:n.nodeByTocId[t],c=null==s?void 0:s.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(r=null==s?void 0:s.title)&&void 0!==r?r:"",page:o&&a&&a.number!==o?o:void 0,prettyUrl:null!=c?c.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(i=null==n?void 0:n.duplicatedPrettyUrls.has(null!=c?c:""))&&void 0!==i&&i,section:e}}async getAccurateNavigationData(t,o,e){return await this.getEnrichedToc(),this.getNavigationData(t,o,e)}getRatingSummary(){return this.cache.get("ratingSummary")}reloadRating(){this.cache.clear("ratingSummary"),this.getRatingSummary()}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((o=>{var e;return o?{type:o.topics.type,rating:null===(e=o.topics)||void 0===e?void 0:e.ratings.find((o=>o.tocId===t))}:void 0}))}rateMap(t,o){return this.makeRateMapRequest(t,o).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,o){return this.makeMapFeedbackRequest(t,o)}rateTopic(t,o,e){return this.makeRateTopicRequest(t,o,e).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=ai.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,o,e){return this.makeTopicFeedbackRequest(t,o,e)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let o=this.getTocNodeNow(t),e=[{tocId:o.tocId,title:o.title}],r=this.getTocNodeNow(o.parentTocId);for(;r;)e.unshift({tocId:r.tocId,title:r.title}),r=this.getTocNodeNow(r.parentTocId);return e}isFeatureAccessible(o,{session:e,ratingType:r}){if(!this.isFeatureAvailable(o))return!1;switch(o){case t.FtReaderFeatures.FEEDBACK:return ri(null!=e?e:[],Qr.FEEDBACK_USER);case t.FtReaderFeatures.RATING:return ri(null!=e?e:[],Qr.RATING_USER)&&null!=r&&r!==Br.NO_RATING;case t.FtReaderFeatures.PRINT:return ri(null!=e?e:[],Qr.PRINT_USER);case t.FtReaderFeatures.BOOKMARK:return!!(null==e?void 0:e.sessionAuthenticated);case t.FtReaderFeatures.COLLECTIONS:return ri(null!=e?e:[],Qr.COLLECTION_USER);case t.FtReaderFeatures.PERSONAL_BOOKS:return ri(null!=e?e:[],Qr.PERSONAL_BOOK_USER);default:return!1}}makeAbsolute(t){return this.api.makeAbsolute(t)}}class Oi extends vi{static async build(t){return new Oi(new Mr,await si.await(),new r,t)}clear(){super.clear(),this.fingerprint=void 0}async fetchMap(t){const o=await this.api.getMap(t);return this.fingerprint=o.fingerprint,o}fetchMapRating(t){return this.api.getMapRating(t)}async fetchPages(t){return await this.getMap(),this.api.getPages(t,this.fingerprint)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER",this.fingerprint)}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId,this.fingerprint)}fetchAttachments(){return this.api.getMapAttachments(this.mapId).catch((()=>[]))}fetchRelativesForDocument(t,o){return this.api.search({query:"",paging:{page:1,perPage:-1},scope:"DOCUMENTS",filters:[{negative:!1,values:o,key:t}],sort:[],facets:[]})}fetchRelativesForTopicInMap(t,o,e){return this.api.search({query:"",paging:{page:1,perPage:1},scope:"ALL_TOPICS",filters:[{negative:!1,values:e,key:o},{negative:!1,values:[t],key:"ft:publicationId"}],sort:[],facets:[]})}makeMapFeedbackRequest(t,o){return this.api.sendMapFeedback(this.mapId,t,o)}makeRateMapRequest(t,o){return this.api.rateMap(this.mapId,t,o)}makeRateTopicRequest(t,o,e){return this.api.rateTopic(this.mapId,t,o,e)}makeTopicFeedbackRequest(t,o,e){return this.api.sendTopicFeedback(this.mapId,t,o,e)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAvailable(t){return!0}}class wi{static build(t,o){return new wi((t=>Kr.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[],map:void 0,toc:void 0,pagesToc:void 0,paginationConfiguration:void 0,currentPage:void 0,scrollTarget:void 0,configuration:void 0,searchInDocumentQuery:void 0,relatives:void 0}}))(t.trim()||"context"),null!=o?o:Oi.build)}constructor(t,o){this.store=t,this.metadataForSwitchToRelatives=new Set,this.loadDebouncer=new n(10),this.initService(o)}async initService(t){return this.service=await t(),this.service.mapId=this.store.getState().mapId,this.reload()}async setMapId(t){t!==this.store.getState().mapId&&(this.store.actions.mapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.visibleTopics(t)}async awaitService(){return A((()=>this.service))}async navigateToTopic(t,o,e){const r=await this.awaitService(),i=await(null!=e?r.getPage(e):r.getPageByTocId(null!=t?t:"root"));this.store.actions.currentPage(i),this.store.actions.scrollTarget({tocId:this.resolveValidNonRootTocId(t,i),section:o})}resolveValidNonRootTocId(t,o){var e,r,i;let n=null!==(e="root"===t?void 0:t)&&void 0!==e?e:o.rootTocId;return o.topics.includes(n)?n:null!==(i=null!==(r=o.topics[0])&&void 0!==r?r:o.hiddenTopics[0])&&void 0!==i?i:"root"}async navigateToPage(t){const o=await this.awaitService();let e=await o.getPage(t);this.store.actions.currentPage(e)}scrollDone(){this.store.actions.scrollTarget({})}async load(){var t;(null===(t=this.service)||void 0===t?void 0:t.mapId)&&null==this.store.getState().map&&await this.loadDebouncer.run((()=>this.fetchData()))}clear(){var t;this.store.actions.configuration(void 0),this.store.actions.map(void 0),this.store.actions.toc(void 0),this.store.actions.pagesToc(void 0),this.store.actions.currentPage(void 0),this.store.actions.searchInDocumentQuery(""),this.store.actions.relatives(void 0),null===(t=this.service)||void 0===t||t.clear(),this.metadataForSwitchToRelatives=new Set,this.clusteringHelper=void 0}reload(){return this.clear(),this.load()}async fetchData(){var t,e,r,i,n;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.configuration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.map(t))),null===(r=this.service)||void 0===r?void 0:r.getToc().then((t=>this.store.actions.toc(t))),null===(i=this.service)||void 0===i?void 0:i.getPagesToc().then((t=>this.store.actions.pagesToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPaginationConfiguration().then((t=>this.store.actions.paginationConfiguration(t)))]).then((()=>{this.metadataForSwitchToRelatives.size>0&&this.fetchRelatives()}))}catch(t){!this.errorHandler||t instanceof o||this.errorHandler(t)}}fetchRelatives(){var t,o,e;const r=null===(t=this.store.getState().map)||void 0===t?void 0:t.metadata.filter((t=>{var o;return t.key==(null===(o=this.store.getState().configuration)||void 0===o?void 0:o.relativePivotMetadata)})).flatMap((t=>t.values));void 0!==r&&r.length>0&&(null===(o=this.service)||void 0===o||o.getRelativesForDocument(null===(e=this.store.getState().configuration)||void 0===e?void 0:e.relativePivotMetadata,r).then((t=>{const o=t.results.flatMap((t=>t.entries));this.store.actions.relatives(o),this.createClusteringHelper()})))}createClusteringHelper(){var t,o;this.store.getState().relatives&&(this.clusteringHelper=new i(this.store.getState().relatives,this.store.getState().relatives.find((t=>{var o;return(null===(o=t.map)||void 0===o?void 0:o.mapId)==this.store.getState().mapId})),this.metadataForSwitchToRelatives,null!==(o=null===(t=ai.getState().metadataConfiguration)||void 0===t?void 0:t.descriptors)&&void 0!==o?o:[]),this.store.eventBus.dispatchEvent(new CustomEvent("clustering-helper-created")))}async navigateToRelativeTopicIfFound(t){var o,e,r;const i=await A((()=>{var t;return null===(t=this.store.getState().configuration)||void 0===t?void 0:t.relativeTopicPivotMetadata})),n=this.store.getState().mapId,a=await this.awaitService(),s=await a.getRelativesForTopicInMap(n,i,[t]);if(null===(r=null===(e=null===(o=null==s?void 0:s.results)||void 0===o?void 0:o[0])||void 0===e?void 0:e.entries)||void 0===r?void 0:r[0]){const t=s.results[0].entries[0].topic.tocId;return await this.navigateToTopic(t),!0}return await this.navigateToTopic("root"),!1}setSearchInDocumentQuery(t){this.store.actions.searchInDocumentQuery(t)}registerMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.add(t),null==this.store.getState().relatives?this.fetchRelatives():this.createClusteringHelper()}unregisterMetadataForSwitchToRelatives(t){this.metadataForSwitchToRelatives.delete(t),this.createClusteringHelper()}}const Ni=Ot`
105
105
  `;class Si extends CustomEvent{constructor(t,o){super("ft-reader-map-loaded",{detail:{map:t,toc:o}})}}class Ei extends CustomEvent{constructor(t,o){super("ft-reader-visible-topics-change",{detail:{visibleTopics:o}})}}class xi extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class Ci extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class Ri extends Event{constructor(){super("ft-reader-map-not-found")}}class Ui extends Event{constructor(){super("ft-reader-map-unauthorized")}}class Ii extends Event{constructor(){super("ft-reader-map-forbidden")}}class Li extends Event{constructor(){super("ft-reader-topic-relative-not-found",{bubbles:!0,composed:!0})}}var Ai=function(t,o,e,r){for(var i,n=arguments.length,a=n<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(o,e,a):i(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class Wi extends $o{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new n(5),this.navigationDebouncer=new n(10),this.addStore(ai)}render(){return eo`
106
106
  ${this.importStyleIfNeeded()}
107
107
  <slot @register-ft-reader-component=${this.registerComponent}></slot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-context",
3
- "version": "1.1.30",
3
+ "version": "1.1.31",
4
4
  "description": "Context block for integrated reader components",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,13 +19,13 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-app-context": "1.1.30",
23
- "@fluid-topics/ft-wc-utils": "1.1.30",
22
+ "@fluid-topics/ft-app-context": "1.1.31",
23
+ "@fluid-topics/ft-wc-utils": "1.1.31",
24
24
  "@reduxjs/toolkit": "^1.6.2",
25
25
  "lit": "3.1.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@fluid-topics/public-api": "1.0.57"
28
+ "@fluid-topics/public-api": "1.0.58"
29
29
  },
30
- "gitHead": "2eadc3ab5cdc677c1db2564a74d18440cd553d42"
30
+ "gitHead": "e9db5f3c700c9d25c85c211c8875686bb989da96"
31
31
  }