@fluid-topics/ft-reader-context 1.0.55 → 1.0.57
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.
|
@@ -24,7 +24,7 @@ export declare class FtReaderContext extends FtLitElementRedux implements FtRead
|
|
|
24
24
|
private _stateManager?;
|
|
25
25
|
private get stateManager();
|
|
26
26
|
connectedCallback(): void;
|
|
27
|
-
protected
|
|
27
|
+
protected update(props: PropertyValues): void;
|
|
28
28
|
private scrollToTargetDebouncer;
|
|
29
29
|
protected contentAvailableCallback(props: PropertyValues): void;
|
|
30
30
|
reload(): Promise<void>;
|
|
@@ -59,12 +59,12 @@ class FtReaderContext extends FtLitElementRedux {
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
super.
|
|
62
|
+
update(props) {
|
|
63
|
+
super.update(props);
|
|
64
64
|
if (props.has("readerServiceProvider") && this.readerServiceProvider) {
|
|
65
65
|
this.stateManager.initService(this.readerServiceProvider);
|
|
66
66
|
}
|
|
67
|
-
if (props.has("mapId")) {
|
|
67
|
+
if (props.has("mapId") && this.mapId) {
|
|
68
68
|
this.stateManager.setMapId(this.mapId);
|
|
69
69
|
}
|
|
70
70
|
if (["tocId", "section", "page", "mapId"].some(p => props.has(p)) && this.mapId) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
!function(t,i,e,s){const n={setMapId:(t,i)=>{t.mapId=i.payload},setTocId:(t,i)=>{t.tocId=i.payload},setMap:(t,i)=>{t.map=i.payload},setToc:(t,i)=>{t.toc=i.payload},setPagesToc:(t,i)=>{t.pagesToc=i.payload},setPaginationConfiguration:(t,i)=>{t.paginationConfiguration=i.payload},setCurrentPage:(t,i)=>{t.currentPage=i.payload},setScrollTarget:(t,i)=>{t.scrollTarget=i.payload},setVisibleTopics:(t,i)=>{t.visibleTopics=i.payload},setConfiguration:(t,i)=>{t.configuration=i.payload}};class r{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 o{convertPaginatedToc(t){return new r(t).build()}}!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 E(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(E.prototype),E.prototype.clone=function(){return new E(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},E.error=function(){var t=new E(null,{status:0,statusText:""});return t.type="error",t};var y=[301,302,303,307,308];E.redirect=function(t,i){if(-1===y.indexOf(i))throw new RangeError("Invalid status code");return new E(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 T(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 E(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)}))}T.polyfill=!0,t.fetch||(t.fetch=T,t.Headers=h,t.Request=p,t.Response=E),i.Headers=h,i.Request=p,i.Response=E,i.fetch=T,Object.defineProperty(i,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0);const a=t=>"object"==typeof t&&null!=t,h=t=>"string"==typeof t;var u,c,l,d,v,f,p,w,E,y,T,m;!function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(u||(u={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(c||(c={})),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"}(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.ARTICLE="ARTICLE",t.BOOK="BOOK"}(w||(w={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(E||(E={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(y||(y={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(T||(T={})),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"}(m||(m={}));const g=t=>a(t)&&(null==t.authenticationIdentifier||(t=>a(t)&&h(t.identifier)&&h(t.realm))(t.authenticationIdentifier))&&(t=>"number"==typeof t)(t.idleTimeoutInMillis)&&S(t.profile)&&(t=>"boolean"==typeof t)(t.sessionAuthenticated),S=t=>a(t)&&(null==t.emailAddress||h(t.emailAddress))&&(null==t.displayName||h(t.displayName))&&Array.isArray(t.roles)&&t.roles.every((t=>(t=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(t))(t)))&&(null==t.userId||h(t.userId)),R={[m.PERSONAL_BOOK_SHARE_USER]:[m.PERSONAL_BOOK_USER],[m.HTML_EXPORT_USER]:[m.PERSONAL_BOOK_USER],[m.PDF_EXPORT_USER]:[m.PERSONAL_BOOK_USER],[m.KHUB_ADMIN]:[m.CONTENT_PUBLISHER],[m.ADMIN]:[m.KHUB_ADMIN,m.USERS_ADMIN,m.PORTAL_ADMIN],[m.DEVELOPER]:[m.BETA_USER,m.DEBUG_USER]};function b(t,i){return t===i||(R[t]??[]).some((t=>b(t,i)))}function A(t,i){return(g(t)?t.profile.roles:S(t)?t.roles:t).some((t=>b(t,i)))}const I=e.css`
|
|
2
2
|
`,U=i.FtReduxStore.get({name:"ft-app-info",reducers:{setBaseUrl:(t,i)=>{t.baseUrl=i.payload},setApiIntegrationIdentifier:(t,i)=>{t.apiIntegrationIdentifier=i.payload},setUiLocale:(t,i)=>{t.uiLocale=i.payload},setAvailableUiLocales:(t,i)=>{t.availableUiLocales=i.payload},setEditorMode:(t,i)=>{t.editorMode=i.payload},setNoCustom:(t,i)=>{t.noCustom=i.payload},setNoCustomComponent:(t,i)=>{t.noCustomComponent=i.payload},setSession:(t,i)=>{t.session=i.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class O{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?O.build(t):null!==(i=O.API)&&void 0!==i?i:O.API=O.build()}static await(t){return new Promise((i=>{let e=O.get(t);if(e)i(e);else{const s=U.subscribe((()=>{e=O.get(t),e&&(s(),i(e))}))}}))}}var P;const C=Symbol("clearAfterUnitTest");class N{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new i.CacheRegistry,this.listeners={},this.currentUiLocale="",this[P]=()=>{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)))))}}P=C,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new N((async(t,i)=>(await O.await()).getFluidTopicsMessageContext(t,i)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new N((async(t,i)=>(await O.await()).getCustomMessageContext(t,i))));const _=window.FluidTopicsI18nService;var L=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 D extends i.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>O.get(),this.cache=new i.CacheRegistry,this.cleanSessionDebouncer=new i.Debouncer}render(){return e.html`
|
|
3
3
|
<slot></slot>
|
|
4
|
-
`}updated(t){super.updated(t),t.has("baseUrl")&&U.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&U.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&U.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&U.actions.setNoCustom(this.noCustom),t.has("editorMode")&&U.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&U.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&U.actions.setSession(this.session),t.has("availableUiLocales")&&U.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>_.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const i=await t.getCurrentSession();return i.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),i.idleTimeoutInMillis),i}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}D.elementDefinitions={},D.styles=I,L([s.property()],D.prototype,"baseUrl",void 0),L([s.property()],D.prototype,"apiIntegrationIdentifier",void 0),L([s.property()],D.prototype,"uiLocale",void 0),L([i.jsonProperty([])],D.prototype,"availableUiLocales",void 0),L([s.property({type:Boolean})],D.prototype,"editorMode",void 0),L([s.property({type:Boolean})],D.prototype,"noCustom",void 0),L([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],D.prototype,"noCustomComponent",void 0),L([s.property({type:Boolean})],D.prototype,"withManualResources",void 0),L([i.jsonProperty([])],D.prototype,"messageContexts",void 0),L([i.jsonProperty(void 0)],D.prototype,"session",void 0),L([s.property({type:Object})],D.prototype,"apiProvider",void 0);class M{async listMySearches(){var t;return(null===(t=U.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await O.await()).listMySearches(U.getState().session.profile.userId):[]}}const B=new i.CacheRegistry;class k{async listMyBookmarks(){return B.get("bookmarks",(async()=>(await O.await()).listMyBookmarks(U.getState().session.profile.userId)))}clearCache(){B.clear("bookmarks")}}const F=i.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const x=new class{constructor(){this.currentSession=U.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new k,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(){F.actions.savedSearches(void 0)}clearMyBookmarks(){F.actions.bookmarks(void 0)}async reloadMySearches(){const t=new M,i=await t.listMySearches();F.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;F.actions.bookmarks(i)}}};var j;i.customElement("ft-app-context")(D),t.FtReaderFeatures=void 0,(j=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",j.RATING="RATING",j.PRINT="PRINT",j.BOOKMARK="BOOKMARK",j.COLLECTIONS="COLLECTIONS";class H{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 A(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)))}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")}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}}class G extends H{static async build(t){return new G(new o,await O.await(),new i.CacheRegistry,t)}fetchMap(t){return this.api.getMap(t)}fetchMapRating(t){return this.api.getMapRating(t)}fetchPages(t){return this.api.getPages(t)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER")}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId)}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/"}isFeatureAccessible(t){return!0}}class K{static build(t,e){return new K((t=>i.FtReduxStore.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[]},reducers:n}))(t.trim()||"context"),null!=e?e:G.build)}constructor(t,e){this.store=t,this.reloadDebouncer=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.setMapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.setVisibleTopics(t)}async awaitService(){for(;null==this.service;)await i.delay(5);return 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.setCurrentPage(n),this.store.actions.setScrollTarget({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.setCurrentPage(e)}scrollDone(){this.store.actions.setScrollTarget({})}async reload(){var t,i;this.store.actions.setConfiguration(void 0),this.store.actions.setMap(void 0),this.store.actions.setToc(void 0),this.store.actions.setPagesToc(void 0),this.store.actions.setCurrentPage(void 0),null===(t=this.service)||void 0===t||t.clear(),(null===(i=this.service)||void 0===i?void 0:i.mapId)&&await this.reloadDebouncer.run((()=>this.fetchData()))}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.setConfiguration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.setMap(t))),null===(s=this.service)||void 0===s?void 0:s.getToc().then((t=>this.store.actions.setToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPagesToc().then((t=>this.store.actions.setPagesToc(t))),null===(r=this.service)||void 0===r?void 0:r.getPaginationConfiguration().then((t=>this.store.actions.setPaginationConfiguration(t)))])}catch(t){!this.errorHandler||t instanceof i.CanceledPromiseError||this.errorHandler(t)}}}const q=e.css`
|
|
4
|
+
`}update(t){super.update(t),t.has("baseUrl")&&U.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&U.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&U.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&U.actions.setNoCustom(this.noCustom),t.has("editorMode")&&U.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&U.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&U.actions.setSession(this.session),t.has("availableUiLocales")&&U.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>_.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const i=await t.getCurrentSession();return i.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),i.idleTimeoutInMillis),i}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}D.elementDefinitions={},D.styles=I,L([s.property()],D.prototype,"baseUrl",void 0),L([s.property()],D.prototype,"apiIntegrationIdentifier",void 0),L([s.property()],D.prototype,"uiLocale",void 0),L([i.jsonProperty([])],D.prototype,"availableUiLocales",void 0),L([s.property({type:Boolean})],D.prototype,"editorMode",void 0),L([s.property({type:Boolean})],D.prototype,"noCustom",void 0),L([s.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],D.prototype,"noCustomComponent",void 0),L([s.property({type:Boolean})],D.prototype,"withManualResources",void 0),L([i.jsonProperty([])],D.prototype,"messageContexts",void 0),L([i.jsonProperty(void 0)],D.prototype,"session",void 0),L([s.property({type:Object})],D.prototype,"apiProvider",void 0);class M{async listMySearches(){var t;return(null===(t=U.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await O.await()).listMySearches(U.getState().session.profile.userId):[]}}const B=new i.CacheRegistry;class k{async listMyBookmarks(){return B.get("bookmarks",(async()=>(await O.await()).listMyBookmarks(U.getState().session.profile.userId)))}clearCache(){B.clear("bookmarks")}}const F=i.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const x=new class{constructor(){this.currentSession=U.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new k,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(){F.actions.savedSearches(void 0)}clearMyBookmarks(){F.actions.bookmarks(void 0)}async reloadMySearches(){const t=new M,i=await t.listMySearches();F.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;F.actions.bookmarks(i)}}};var j;i.customElement("ft-app-context")(D),t.FtReaderFeatures=void 0,(j=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",j.RATING="RATING",j.PRINT="PRINT",j.BOOKMARK="BOOKMARK",j.COLLECTIONS="COLLECTIONS";class H{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 A(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)))}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")}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}}class G extends H{static async build(t){return new G(new o,await O.await(),new i.CacheRegistry,t)}fetchMap(t){return this.api.getMap(t)}fetchMapRating(t){return this.api.getMapRating(t)}fetchPages(t){return this.api.getPages(t)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER")}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId)}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/"}isFeatureAccessible(t){return!0}}class K{static build(t,e){return new K((t=>i.FtReduxStore.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[]},reducers:n}))(t.trim()||"context"),null!=e?e:G.build)}constructor(t,e){this.store=t,this.reloadDebouncer=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.setMapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.setVisibleTopics(t)}async awaitService(){for(;null==this.service;)await i.delay(5);return 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.setCurrentPage(n),this.store.actions.setScrollTarget({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.setCurrentPage(e)}scrollDone(){this.store.actions.setScrollTarget({})}async reload(){var t,i;this.store.actions.setConfiguration(void 0),this.store.actions.setMap(void 0),this.store.actions.setToc(void 0),this.store.actions.setPagesToc(void 0),this.store.actions.setCurrentPage(void 0),null===(t=this.service)||void 0===t||t.clear(),(null===(i=this.service)||void 0===i?void 0:i.mapId)&&await this.reloadDebouncer.run((()=>this.fetchData()))}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.setConfiguration(t))),null===(e=this.service)||void 0===e?void 0:e.getMap().then((t=>this.store.actions.setMap(t))),null===(s=this.service)||void 0===s?void 0:s.getToc().then((t=>this.store.actions.setToc(t))),null===(n=this.service)||void 0===n?void 0:n.getPagesToc().then((t=>this.store.actions.setPagesToc(t))),null===(r=this.service)||void 0===r?void 0:r.getPaginationConfiguration().then((t=>this.store.actions.setPaginationConfiguration(t)))])}catch(t){!this.errorHandler||t instanceof i.CanceledPromiseError||this.errorHandler(t)}}}const q=e.css`
|
|
5
5
|
`;class V extends CustomEvent{constructor(t,i){super("ft-reader-map-loaded",{detail:{map:t,toc:i}})}}class $ extends CustomEvent{constructor(t,i){super("ft-reader-visible-topics-change",{detail:{visibleTopics:i}})}}class X extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class Y 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")}}var J=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 Q extends i.FtLitElementRedux{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new i.Debouncer(5),this.navigationDebouncer=new i.Debouncer(50),this.addStore(U)}render(){return e.html`
|
|
6
6
|
${this.importStyleIfNeeded()}
|
|
7
7
|
<slot @register-ft-reader-component=${this.registerComponent}></slot>
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
<style>
|
|
10
10
|
@import "${s}"
|
|
11
11
|
</style>
|
|
12
|
-
`}get stateManager(){return null==this._stateManager&&(this._stateManager=K.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)}}))}
|
|
12
|
+
`}get stateManager(){return null==this._stateManager&&(this._stateManager=K.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),["tocId","section","page","mapId"].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 V(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 X(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 $(this.map,i))}))}async reload(){await this.stateManager.reload(),this.navigateToTarget()}navigateToTarget(){this.navigationDebouncer.run((()=>{null!=this.tocId?this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&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;404===i.status?this.dispatchEvent(new W):401===i.status?this.dispatchEvent(new z):this.dispatchEvent(new Y(t))}reloadBookmarks(){x.reloadBookmarks()}}var Z;Q.styles=q,J([i.redux({store:U.name})],Q.prototype,"baseUrl",void 0),J([s.property()],Q.prototype,"mapId",void 0),J([s.property()],Q.prototype,"tocId",void 0),J([s.property()],Q.prototype,"section",void 0),J([s.property({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:Z}})],Q.prototype,"page",void 0),J([i.redux({store:"reader"})],Q.prototype,"map",void 0),J([i.redux({store:"reader"})],Q.prototype,"toc",void 0),J([i.redux({store:"reader"})],Q.prototype,"visibleTopics",void 0),J([i.redux({store:"reader"})],Q.prototype,"currentPage",void 0),J([i.redux({store:"reader"})],Q.prototype,"scrollTarget",void 0),J([s.property({attribute:!1})],Q.prototype,"readerServiceProvider",void 0),i.customElement("ft-reader-context")(Q),t.FtOfficialReaderService=G,t.FtReaderContext=Q,t.FtReaderContextCssVariables={},t.FtReaderConverter=o,t.FtReaderService=H,t.LoadErrorEvent=Y,t.MapLoadedEvent=V,t.NavigationDoneEvent=X,t.NotFoundErrorEvent=W,t.UnauthorizedErrorEvent=z,t.VisibleTopicsChangeEvent=$,t.styles=q}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
|
|
@@ -78,10 +78,10 @@ var ft,dt;let vt=class extends N{constructor(){super(...arguments),this.renderOp
|
|
|
78
78
|
display: inline-block;
|
|
79
79
|
width: 0;
|
|
80
80
|
}
|
|
81
|
-
`;class xt{constructor(t,e){this.defaultLabels=t,this.labels=e}resolve(t,...e){var i,n;t=this.resolvePluralKey(t,e);let r=null!==(n=null!==(i=this.labels[t])&&void 0!==i?i:this.defaultLabels[t])&&void 0!==n?n:"";return e.forEach(((t,e)=>r=r.replace(new RegExp(`\\{${e}([^}]*)\\}`,"g"),((e,i)=>this.formatValue(t,i))))),r}resolvePluralKey(t,e){for(let i of e)if("number"==typeof i){const e=`${String(t)}[\\=${i}]`;if(e in this.labels||e in this.defaultLabels)return e}return t}formatValue(t,e){return t instanceof Date?this.formatDate(t,e):null!=t?t:""}formatDate(t,e){const i=i=>(null==e?void 0:e.includes("date"))?t.toLocaleDateString(i):(null==e?void 0:e.includes("time"))?t.toLocaleTimeString(i):t.toLocaleString(i);try{return i(document.documentElement.lang)}catch(t){return i()}}}function Rt(t){var e;return null!==(e=null==t?void 0:t.isFtReduxStore)&&void 0!==e&&e}var At,Tt,Ct;const Nt=Symbol("internalReduxEventsUnsubscribers"),Ut=Symbol("internalStoresUnsubscribers"),jt=Symbol("internalStores");class Mt extends Ot{constructor(){super(...arguments),this[At]=new Map,this[Tt]=new Map,this[Ct]=[]}updated(t){var e;super.updated(t),(null===(e=this.reduxReactiveProperties)||void 0===e?void 0:e.some((e=>t.has(e))))&&this.updateFromStores()}getUnnamedStore(){if(this[jt].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[jt].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[jt].get(t)}addStore(t,e){var i;e=null!==(i=null!=e?e:Rt(t)?t.name:void 0)&&void 0!==i?i:"default-store",this.unsubscribeFromStore(e),this.setupStore(e,t)}removeStore(t){const e="string"==typeof t?t:t.name;this.unsubscribeFromStore(e),this[jt].delete(e)}setupStore(t,e){this[jt].set(t,e),this.subscribeToStore(t,e),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[jt].forEach(((t,e)=>this.subscribeToStore(e,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,e)=>{const i=this.constructor.getPropertyOptions(e);if(!(null==i?void 0:i.attribute)||!this.hasAttribute("string"==typeof(null==i?void 0:i.attribute)?i.attribute:e)){const i=this.getStore(t.store);i&&(t.store?this[Ut].has(t.store):this[Ut].size>0)&&(this[e]=t.selector(i.getState(),this))}}))}subscribeToStore(t,e){var i;this[Ut].set(t,e.subscribe((()=>this.updateFromStores()))),Rt(e)&&e.eventBus&&(null===(i=this.reduxEventListeners)||void 0===i||i.forEach(((t,i)=>{if("function"==typeof this[i]&&(!t.store||e.name===t.store)){const n=t=>this[i](t);e.eventBus.addEventListener(t.eventName,n),this[Nt].push((()=>e.eventBus.removeEventListener(t.eventName,n)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Ut].forEach(((t,e)=>this.unsubscribeFromStore(e))),this[Nt].forEach((t=>t())),this[Nt]=[]}unsubscribeFromStore(t){this[Ut].has(t)&&this[Ut].get(t)(),this[Ut].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}function It(t){for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+t+(i.length?" "+i.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Pt(t){return!!t&&!!t[ge]}function _t(t){var e;return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Ee}(t)||Array.isArray(t)||!!t[me]||!!(null===(e=t.constructor)||void 0===e?void 0:e[me])||$t(t)||Kt(t))}function kt(t,e,i){void 0===i&&(i=!1),0===Lt(t)?(i?Object.keys:Se)(t).forEach((function(n){i&&"symbol"==typeof n||e(n,t[n],t)})):t.forEach((function(i,n){return e(n,i,t)}))}function Lt(t){var e=t[ge];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:$t(t)?2:Kt(t)?3:0}function Ft(t,e){return 2===Lt(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Bt(t,e,i){var n=Lt(t);2===n?t.set(e,i):3===n?t.add(i):t[e]=i}function Dt(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function $t(t){return pe&&t instanceof Map}function Kt(t){return be&&t instanceof Set}function Ht(t){return t.o||t.t}function Wt(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=Oe(t);delete e[ge];for(var i=Se(e),n=0;n<i.length;n++){var r=i[n],o=e[r];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(e[r]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[r]})}return Object.create(Object.getPrototypeOf(t),e)}function qt(t,e){return void 0===e&&(e=!1),Gt(t)||Pt(t)||!_t(t)||(Lt(t)>1&&(t.set=t.add=t.clear=t.delete=Vt),Object.freeze(t),e&&kt(t,(function(t,e){return qt(e,!0)}),!0)),t}function Vt(){It(2)}function Gt(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function zt(t){var e=xe[t];return e||It(18,t),e}function Xt(){return de}function Jt(t,e){e&&(zt("Patches"),t.u=[],t.s=[],t.v=e)}function Zt(t){Yt(t),t.p.forEach(te),t.p=null}function Yt(t){t===de&&(de=t.l)}function Qt(t){return de={p:[],l:de,h:t,m:!0,_:0}}function te(t){var e=t[ge];0===e.i||1===e.i?e.j():e.g=!0}function ee(t,e){e._=e.p.length;var i=e.p[0],n=void 0!==t&&t!==i;return e.h.O||zt("ES5").S(e,t,n),n?(i[ge].P&&(Zt(e),It(4)),_t(t)&&(t=ie(e,t),e.l||re(e,t)),e.u&&zt("Patches").M(i[ge].t,t,e.u,e.s)):t=ie(e,i,[]),Zt(e),e.u&&e.v(e.u,e.s),t!==we?t:void 0}function ie(t,e,i){if(Gt(e))return e;var n=e[ge];if(!n)return kt(e,(function(r,o){return ne(t,n,e,r,o,i)}),!0),e;if(n.A!==t)return e;if(!n.P)return re(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var r=4===n.i||5===n.i?n.o=Wt(n.k):n.o,o=r,s=!1;3===n.i&&(o=new Set(r),r.clear(),s=!0),kt(o,(function(e,o){return ne(t,n,r,e,o,i,s)})),re(t,r,!1),i&&t.u&&zt("Patches").N(n,i,t.u,t.s)}return n.o}function ne(t,e,i,n,r,o,s){if(Pt(r)){var a=ie(t,r,o&&e&&3!==e.i&&!Ft(e.R,n)?o.concat(n):void 0);if(Bt(i,n,a),!Pt(a))return;t.m=!1}else s&&i.add(r);if(_t(r)&&!Gt(r)){if(!t.h.D&&t._<1)return;ie(t,r),e&&e.A.l||re(t,r)}}function re(t,e,i){void 0===i&&(i=!1),!t.l&&t.h.D&&t.m&&qt(e,i)}function oe(t,e){var i=t[ge];return(i?Ht(i):t)[e]}function se(t,e){if(e in t)for(var i=Object.getPrototypeOf(t);i;){var n=Object.getOwnPropertyDescriptor(i,e);if(n)return n;i=Object.getPrototypeOf(i)}}function ae(t){t.P||(t.P=!0,t.l&&ae(t.l))}function ue(t){t.o||(t.o=Wt(t.t))}function ce(t,e,i){var n=$t(e)?zt("MapSet").F(e,i):Kt(e)?zt("MapSet").T(e,i):t.O?function(t,e){var i=Array.isArray(t),n={i:i?1:0,A:e?e.A:Xt(),P:!1,I:!1,R:{},l:e,t,k:null,o:null,j:null,C:!1},r=n,o=Re;i&&(r=[n],o=Ae);var s=Proxy.revocable(r,o),a=s.revoke,u=s.proxy;return n.k=u,n.j=a,u}(e,i):zt("ES5").J(e,i);return(i?i.A:Xt()).p.push(n),n}function le(t){return Pt(t)||It(22,t),function t(e){if(!_t(e))return e;var i,n=e[ge],r=Lt(e);if(n){if(!n.P&&(n.i<4||!zt("ES5").K(n)))return n.t;n.I=!0,i=he(e,r),n.I=!1}else i=he(e,r);return kt(i,(function(e,r){n&&function(t,e){return 2===Lt(t)?t.get(e):t[e]}(n.t,e)===r||Bt(i,e,t(r))})),3===r?new Set(i):i}(t)}function he(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Wt(t)}At=Ut,Tt=jt,Ct=Nt;var fe,de,ve="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),pe="undefined"!=typeof Map,be="undefined"!=typeof Set,ye="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,we=ve?Symbol.for("immer-nothing"):((fe={})["immer-nothing"]=!0,fe),me=ve?Symbol.for("immer-draftable"):"__$immer_draftable",ge=ve?Symbol.for("immer-state"):"__$immer_state",Ee=""+Object.prototype.constructor,Se="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,Oe=Object.getOwnPropertyDescriptors||function(t){var e={};return Se(t).forEach((function(i){e[i]=Object.getOwnPropertyDescriptor(t,i)})),e},xe={},Re={get:function(t,e){if(e===ge)return t;var i=Ht(t);if(!Ft(i,e))return function(t,e,i){var n,r=se(e,i);return r?"value"in r?r.value:null===(n=r.get)||void 0===n?void 0:n.call(t.k):void 0}(t,i,e);var n=i[e];return t.I||!_t(n)?n:n===oe(t.t,e)?(ue(t),t.o[e]=ce(t.A.h,n,t)):n},has:function(t,e){return e in Ht(t)},ownKeys:function(t){return Reflect.ownKeys(Ht(t))},set:function(t,e,i){var n=se(Ht(t),e);if(null==n?void 0:n.set)return n.set.call(t.k,i),!0;if(!t.P){var r=oe(Ht(t),e),o=null==r?void 0:r[ge];if(o&&o.t===i)return t.o[e]=i,t.R[e]=!1,!0;if(Dt(i,r)&&(void 0!==i||Ft(t.t,e)))return!0;ue(t),ae(t)}return t.o[e]===i&&(void 0!==i||e in t.o)||Number.isNaN(i)&&Number.isNaN(t.o[e])||(t.o[e]=i,t.R[e]=!0),!0},deleteProperty:function(t,e){return void 0!==oe(t.t,e)||e in t.t?(t.R[e]=!1,ue(t),ae(t)):delete t.R[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var i=Ht(t),n=Reflect.getOwnPropertyDescriptor(i,e);return n?{writable:!0,configurable:1!==t.i||"length"!==e,enumerable:n.enumerable,value:i[e]}:n},defineProperty:function(){It(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){It(12)}},Ae={};kt(Re,(function(t,e){Ae[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),Ae.deleteProperty=function(t,e){return Ae.set.call(this,t,e,void 0)},Ae.set=function(t,e,i){return Re.set.call(this,t[0],e,i,t[0])};var Te=function(){function t(t){var e=this;this.O=ye,this.D=!0,this.produce=function(t,i,n){if("function"==typeof t&&"function"!=typeof i){var r=i;i=t;var o=e;return function(t){var e=this;void 0===t&&(t=r);for(var n=arguments.length,s=Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return o.produce(t,(function(t){var n;return(n=i).call.apply(n,[e,t].concat(s))}))}}var s;if("function"!=typeof i&&It(6),void 0!==n&&"function"!=typeof n&&It(7),_t(t)){var a=Qt(e),u=ce(e,t,void 0),c=!0;try{s=i(u),c=!1}finally{c?Zt(a):Yt(a)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(t){return Jt(a,n),ee(t,a)}),(function(t){throw Zt(a),t})):(Jt(a,n),ee(s,a))}if(!t||"object"!=typeof t){if(void 0===(s=i(t))&&(s=t),s===we&&(s=void 0),e.D&&qt(s,!0),n){var l=[],h=[];zt("Patches").M(t,s,l,h),n(l,h)}return s}It(21,t)},this.produceWithPatches=function(t,i){if("function"==typeof t)return function(i){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return e.produceWithPatches(i,(function(e){return t.apply(void 0,[e].concat(r))}))};var n,r,o=e.produce(t,i,(function(t,e){n=t,r=e}));return"undefined"!=typeof Promise&&o instanceof Promise?o.then((function(t){return[t,n,r]})):[o,n,r]},"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 e=t.prototype;return e.createDraft=function(t){_t(t)||It(8),Pt(t)&&(t=le(t));var e=Qt(this),i=ce(this,t,void 0);return i[ge].C=!0,Yt(e),i},e.finishDraft=function(t,e){var i=(t&&t[ge]).A;return Jt(i,e),ee(void 0,i)},e.setAutoFreeze=function(t){this.D=t},e.setUseProxies=function(t){t&&!ye&&It(20),this.O=t},e.applyPatches=function(t,e){var i;for(i=e.length-1;i>=0;i--){var n=e[i];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}i>-1&&(e=e.slice(i+1));var r=zt("Patches").$;return Pt(t)?r(t,e):this.produce(t,(function(t){return r(t,e)}))},t}(),Ce=new Te,Ne=Ce.produce;function Ue(t){return Ue="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},Ue(t)}function je(t){var e=function(t,e){if("object"!==Ue(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!==Ue(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===Ue(e)?e:String(e)}function Me(t,e,i){return(e=je(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ie(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Pe(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ie(Object(i),!0).forEach((function(e){Me(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ie(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _e(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. "}Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce);var ke="function"==typeof Symbol&&Symbol.observable||"@@observable",Le=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fe={INIT:"@@redux/INIT"+Le(),REPLACE:"@@redux/REPLACE"+Le(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Le()}};function Be(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_e(1));return i(Be)(t,e)}if("function"!=typeof t)throw new Error(_e(2));var r=t,o=e,s=[],a=s,u=!1;function c(){a===s&&(a=s.slice())}function l(){if(u)throw new Error(_e(3));return o}function h(t){if("function"!=typeof t)throw new Error(_e(4));if(u)throw new Error(_e(5));var e=!0;return c(),a.push(t),function(){if(e){if(u)throw new Error(_e(6));e=!1,c();var i=a.indexOf(t);a.splice(i,1),s=null}}}function f(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t))throw new Error(_e(7));if(void 0===t.type)throw new Error(_e(8));if(u)throw new Error(_e(9));try{u=!0,o=r(o,t)}finally{u=!1}for(var e=s=a,i=0;i<e.length;i++){(0,e[i])()}return t}return f({type:Fe.INIT}),(n={dispatch:f,subscribe:h,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error(_e(10));r=t,f({type:Fe.REPLACE})}})[ke]=function(){var t,e=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(_e(11));function i(){t.next&&t.next(l())}return i(),{unsubscribe:e(i)}}})[ke]=function(){return this},t},n}function De(t){for(var e=Object.keys(t),i={},n=0;n<e.length;n++){var r=e[n];"function"==typeof t[r]&&(i[r]=t[r])}var o,s=Object.keys(i);try{!function(t){Object.keys(t).forEach((function(e){var i=t[e];if(void 0===i(void 0,{type:Fe.INIT}))throw new Error(_e(12));if(void 0===i(void 0,{type:Fe.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(i)}catch(t){o=t}return function(t,e){if(void 0===t&&(t={}),o)throw o;for(var n=!1,r={},a=0;a<s.length;a++){var u=s[a],c=i[u],l=t[u],h=c(l,e);if(void 0===h)throw e&&e.type,new Error(_e(14));r[u]=h,n=n||h!==l}return(n=n||s.length!==Object.keys(t).length)?r:t}}function $e(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce((function(t,e){return function(){return t(e.apply(void 0,arguments))}}))}function Ke(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return function(){var i=t.apply(void 0,arguments),n=function(){throw new Error(_e(15))},r={getState:i.getState,dispatch:function(){return n.apply(void 0,arguments)}},o=e.map((function(t){return t(r)}));return n=$e.apply(void 0,o)(i.dispatch),Pe(Pe({},i),{},{dispatch:n})}}}function He(t){return function(e){var i=e.dispatch,n=e.getState;return function(e){return function(r){return"function"==typeof r?r(i,n,t):e(r)}}}}var We=He();We.withExtraArgument=He;var qe,Ve=We,Ge=(qe=function(t,e){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},qe(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}qe(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),ze=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Xe=function(t,e){for(var i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t},Je=Object.defineProperty,Ze=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,ti=Object.prototype.hasOwnProperty,ei=Object.prototype.propertyIsEnumerable,ii=function(t,e,i){return e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i},ni=function(t,e){for(var i in e||(e={}))ti.call(e,i)&&ii(t,i,e[i]);if(Qe)for(var n=0,r=Qe(e);n<r.length;n++){i=r[n];ei.call(e,i)&&ii(t,i,e[i])}return t},ri=function(t,e){return Ze(t,Ye(e))},oi="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?$e:$e.apply(null,arguments)};var si=function(t){function e(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var r=t.apply(this,i)||this;return Object.setPrototypeOf(r,e.prototype),r}return Ge(e,t),Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.prototype.concat.apply(this,e)},e.prototype.prepend=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 1===t.length&&Array.isArray(t[0])?new(e.bind.apply(e,Xe([void 0],t[0].concat(this)))):new(e.bind.apply(e,Xe([void 0],t.concat(this))))},e}(Array),ai=function(t){function e(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var r=t.apply(this,i)||this;return Object.setPrototypeOf(r,e.prototype),r}return Ge(e,t),Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.prototype.concat.apply(this,e)},e.prototype.prepend=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 1===t.length&&Array.isArray(t[0])?new(e.bind.apply(e,Xe([void 0],t[0].concat(this)))):new(e.bind.apply(e,Xe([void 0],t.concat(this))))},e}(Array);function ui(t){return _t(t)?Ne(t,(function(){})):t}function ci(){return function(t){return function(t){void 0===t&&(t={});var e=t.thunk,i=void 0===e||e;t.immutableCheck,t.serializableCheck;var n=new si;i&&(!function(t){return"boolean"==typeof t}(i)?n.push(Ve.withExtraArgument(i.extraArgument)):n.push(Ve));return n}(t)}}function li(t){var e,i=ci(),n=t||{},r=n.reducer,o=void 0===r?void 0:r,s=n.middleware,a=void 0===s?i():s,u=n.devTools,c=void 0===u||u,l=n.preloadedState,h=void 0===l?void 0:l,f=n.enhancers,d=void 0===f?void 0:f;if("function"==typeof o)e=o;else{if(!function(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;for(var i=e;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return e===i}(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');e=De(o)}var v=a;"function"==typeof v&&(v=v(i));var p=Ke.apply(void 0,v),b=$e;c&&(b=oi(ni({trace:!1},"object"==typeof c&&c)));var y=new ai(p),w=y;return Array.isArray(d)?w=Xe([p],d):"function"==typeof d&&(w=d(y)),Be(e,h,b.apply(void 0,w))}function hi(t,e){function i(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];if(e){var r=e.apply(void 0,i);if(!r)throw new Error("prepareAction did not return an object");return ni(ni({type:t,payload:r.payload},"meta"in r&&{meta:r.meta}),"error"in r&&{error:r.error})}return{type:t,payload:i[0]}}return i.toString=function(){return""+t},i.type=t,i.match=function(e){return e.type===t},i}function fi(t){var e,i={},n=[],r={addCase:function(t,e){var n="string"==typeof t?t:t.type;if(n in i)throw new Error("addCase cannot be called with two reducers for the same action type");return i[n]=e,r},addMatcher:function(t,e){return n.push({matcher:t,reducer:e}),r},addDefaultCase:function(t){return e=t,r}};return t(r),[i,n,e]}function di(t){var e=t.name;if(!e)throw new Error("`name` is a required option for createSlice");var i,n="function"==typeof t.initialState?t.initialState:ui(t.initialState),r=t.reducers||{},o=Object.keys(r),s={},a={},u={};function c(){var e="function"==typeof t.extraReducers?fi(t.extraReducers):[t.extraReducers],i=e[0],r=void 0===i?{}:i,o=e[1],s=void 0===o?[]:o,u=e[2],c=void 0===u?void 0:u,l=ni(ni({},r),a);return function(t,e,i,n){void 0===i&&(i=[]);var r,o="function"==typeof e?fi(e):[e,i,n],s=o[0],a=o[1],u=o[2];if(function(t){return"function"==typeof t}(t))r=function(){return ui(t())};else{var c=ui(t);r=function(){return c}}function l(t,e){void 0===t&&(t=r());var i=Xe([s[e.type]],a.filter((function(t){return(0,t.matcher)(e)})).map((function(t){return t.reducer})));return 0===i.filter((function(t){return!!t})).length&&(i=[u]),i.reduce((function(t,i){if(i){var n;if(Pt(t))return void 0===(n=i(t,e))?t:n;if(_t(t))return Ne(t,(function(t){return i(t,e)}));if(void 0===(n=i(t,e))){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}return t}),t)}return l.getInitialState=r,l}(n,(function(t){for(var e in l)t.addCase(e,l[e]);for(var i=0,n=s;i<n.length;i++){var r=n[i];t.addMatcher(r.matcher,r.reducer)}c&&t.addDefaultCase(c)}))}return o.forEach((function(t){var i,n,o=r[t],c=e+"/"+t;"reducer"in o?(i=o.reducer,n=o.prepare):i=o,s[t]=i,a[c]=i,u[t]=n?hi(c,n):hi(c)})),{name:e,reducer:function(t,e){return i||(i=c()),i(t,e)},actions:u,caseReducers:s,getInitialState:function(){return i||(i=c()),i.getInitialState()}}}var vi=["name","message","stack","code"],pi=function(t,e){this.payload=t,this.meta=e},bi=function(t,e){this.payload=t,this.meta=e},yi=function(t){if("object"==typeof t&&null!==t){for(var e={},i=0,n=vi;i<n.length;i++){var r=n[i];"string"==typeof t[r]&&(e[r]=t[r])}return e}return{message:String(t)}};function wi(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}!function(){function t(t,e,i){var n=hi(t+"/fulfilled",(function(t,e,i,n){return{payload:t,meta:ri(ni({},n||{}),{arg:i,requestId:e,requestStatus:"fulfilled"})}})),r=hi(t+"/pending",(function(t,e,i){return{payload:void 0,meta:ri(ni({},i||{}),{arg:e,requestId:t,requestStatus:"pending"})}})),o=hi(t+"/rejected",(function(t,e,n,r,o){return{payload:r,error:(i&&i.serializeError||yi)(t||"Rejected"),meta:ri(ni({},o||{}),{arg:n,requestId:e,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===(null==t?void 0:t.name),condition:"ConditionError"===(null==t?void 0:t.name)})}})),s="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(a,u,c){var l,h=(null==i?void 0:i.idGenerator)?i.idGenerator(t):function(t){void 0===t&&(t=21);for(var e="",i=t;i--;)e+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return e}(),f=new s;function d(t){l=t,f.abort()}var v=function(){return s=this,v=null,p=function(){var s,v,p,b,y,w;return ze(this,(function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),b=null==(s=null==i?void 0:i.condition)?void 0:s.call(i,t,{getState:u,extra:c}),null===(g=b)||"object"!=typeof g||"function"!=typeof g.then?[3,2]:[4,b];case 1:b=m.sent(),m.label=2;case 2:if(!1===b||f.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=new Promise((function(t,e){return f.signal.addEventListener("abort",(function(){return e({name:"AbortError",message:l||"Aborted"})}))})),a(r(h,t,null==(v=null==i?void 0:i.getPendingMeta)?void 0:v.call(i,{requestId:h,arg:t},{getState:u,extra:c}))),[4,Promise.race([y,Promise.resolve(e(t,{dispatch:a,getState:u,extra:c,requestId:h,signal:f.signal,abort:d,rejectWithValue:function(t,e){return new pi(t,e)},fulfillWithValue:function(t,e){return new bi(t,e)}})).then((function(e){if(e instanceof pi)throw e;return e instanceof bi?n(e.payload,h,t,e.meta):n(e,h,t)}))])];case 3:return p=m.sent(),[3,5];case 4:return w=m.sent(),p=w instanceof pi?o(null,h,t,w.payload,w.meta):o(w,h,t),[3,5];case 5:return i&&!i.dispatchConditionRejection&&o.match(p)&&p.meta.condition||a(p),[2,p]}var g}))},new Promise((function(t,e){var i=function(t){try{r(p.next(t))}catch(t){e(t)}},n=function(t){try{r(p.throw(t))}catch(t){e(t)}},r=function(e){return e.done?t(e.value):Promise.resolve(e.value).then(i,n)};r((p=p.apply(s,v)).next())}));var s,v,p}();return Object.assign(v,{abort:d,requestId:h,arg:t,unwrap:function(){return v.then(wi)}})}}),{pending:r,rejected:o,fulfilled:n,typePrefix:t})}t.withTypes=function(){return t}}();var mi="listenerMiddleware";hi(mi+"/add"),hi(mi+"/removeAll"),hi(mi+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function t(t,e){var i=r[t];return i?i.enumerable=e:r[t]=i={configurable:!0,enumerable:e,get:function(){var e=this[ge];return Re.get(e,t)},set:function(e){var i=this[ge];Re.set(i,t,e)}},i}function e(t){for(var e=t.length-1;e>=0;e--){var r=t[e][ge];if(!r.P)switch(r.i){case 5:n(r)&&ae(r);break;case 4:i(r)&&ae(r)}}}function i(t){for(var e=t.t,i=t.k,n=Se(i),r=n.length-1;r>=0;r--){var o=n[r];if(o!==ge){var s=e[o];if(void 0===s&&!Ft(e,o))return!0;var a=i[o],u=a&&a[ge];if(u?u.t!==s:!Dt(a,s))return!0}}var c=!!e[ge];return n.length!==Se(e).length+(c?0:1)}function n(t){var e=t.k;if(e.length!==t.t.length)return!0;var i=Object.getOwnPropertyDescriptor(e,e.length-1);if(i&&!i.get)return!0;for(var n=0;n<e.length;n++)if(!e.hasOwnProperty(n))return!0;return!1}var r={};!function(t,e){xe[t]||(xe[t]=e)}("ES5",{J:function(e,i){var n=Array.isArray(e),r=function(e,i){if(e){for(var n=Array(i.length),r=0;r<i.length;r++)Object.defineProperty(n,""+r,t(r,!0));return n}var o=Oe(i);delete o[ge];for(var s=Se(o),a=0;a<s.length;a++){var u=s[a];o[u]=t(u,e||!!o[u].enumerable)}return Object.create(Object.getPrototypeOf(i),o)}(n,e),o={i:n?5:4,A:i?i.A:Xt(),P:!1,I:!1,R:{},l:i,t:e,k:r,o:null,g:!1,C:!1};return Object.defineProperty(r,ge,{value:o,writable:!0}),r},S:function(t,i,r){r?Pt(i)&&i[ge].A===t&&e(t.p):(t.u&&function t(e){if(e&&"object"==typeof e){var i=e[ge];if(i){var r=i.t,o=i.k,s=i.R,a=i.i;if(4===a)kt(o,(function(e){e!==ge&&(void 0!==r[e]||Ft(r,e)?s[e]||t(o[e]):(s[e]=!0,ae(i)))})),kt(r,(function(t){void 0!==o[t]||Ft(o,t)||(s[t]=!1,ae(i))}));else if(5===a){if(n(i)&&(ae(i),s.length=!0),o.length<r.length)for(var u=o.length;u<r.length;u++)s[u]=!1;else for(var c=r.length;c<o.length;c++)s[c]=!0;for(var l=Math.min(o.length,r.length),h=0;h<l;h++)o.hasOwnProperty(h)||(s[h]=!0),void 0===s[h]&&t(o[h])}}}}(t.p[0]),e(t.p))},K:function(t){return 4===t.i?i(t):n(t)}})}(),window.ftReduxStores||(window.ftReduxStores={});class gi{static get(t){var e;const i="string"==typeof t?t:t.name,n="string"==typeof t?void 0:t,r=window.ftReduxStores[i];if(Rt(r))return r;if(null==n)return;const o=di({...n,reducers:null!==(e=n.reducers)&&void 0!==e?e:{}}),s=li({reducer:(t,e)=>{var i;switch(e.type){case"CLEAR_FT_REDUX_STORE":return o.getInitialState();case"DEFAULT_STATE_FIELDS_VALUES_SETTER":return{...t,...null!==(i=e.overwrites)&&void 0!==i?i:{}};default:return o.reducer(t,e)}}});return window.ftReduxStores[n.name]=new gi(o,s)}constructor(t,e){this.reduxSlice=t,this.reduxStore=e,this.isFtReduxStore=!0,this.eventBus=document.createElement("event-bus"),this.actions=new Proxy(this.reduxSlice.actions,{get:(t,e,i)=>{const n=e,r=t[n];return r?(...t)=>{const e=r(...t);return this.reduxStore.dispatch(e),e}:t=>{this.setState({[n]: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()}}const Ei=t=>{const e=null!=t?t:{};return(t,i)=>{var n;const r={hasChanged:(t,e)=>!c(t,e),attribute:!1,...e};s(r)(t,i);const o=t;o.reduxProperties=o.reduxProperties||new Map,o.reduxProperties.set(i,{selector:null!==(n=e.selector)&&void 0!==n?n:t=>t[i],store:e.store})}};var Si,Oi;navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Oi=null===(Si=window.safari)||void 0===Si?void 0:Si.pushNotification)||void 0===Oi||Oi.toString());const xi={setMapId:(t,e)=>{t.mapId=e.payload},setTocId:(t,e)=>{t.tocId=e.payload},setMap:(t,e)=>{t.map=e.payload},setToc:(t,e)=>{t.toc=e.payload},setPagesToc:(t,e)=>{t.pagesToc=e.payload},setPaginationConfiguration:(t,e)=>{t.paginationConfiguration=e.payload},setCurrentPage:(t,e)=>{t.currentPage=e.payload},setScrollTarget:(t,e)=>{t.scrollTarget=e.payload},setVisibleTopics:(t,e)=>{t.visibleTopics=e.payload},setConfiguration:(t,e)=>{t.configuration=e.payload}};class Ri{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,e,i){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,i)),null==t.tocId?this.extractPagesToc(t.children,e,i):[{tocId:t.tocId,title:t.title,depth:e,children:this.extractPagesToc(t.children,e+1,t.tocId)}])))}convertNodes(t,e,i){return t.flatMap((t=>{var n,r,o;if(null==t.tocId)return[...this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],e,t.tocId),...this.convertNodes(t.children,e,t.tocId)];let s=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const a={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:s,depth:e,parentTocId:i,children:[]};this.register(a);const u=this.convertSectionNodes(null!==(o=t.pageToc)&&void 0!==o?o:[],e+1,t.tocId),c=this.convertNodes(t.children,e+1,a.tocId);return a.children=[...u,...c],[a]}))}convertSectionNodes(t,e,i){return t.flatMap((t=>{var n;let r=null===(n=t.prettyUrl)||void 0===n?void 0:n.replace(/^\//,"");const o={...t,prettyUrl:r,depth:e,parentTocId:i,children:[]};return this.register(o),o.children=this.convertSectionNodes(t.children,e+1,t.tocId),[o]}))}buildPage(t,e){var i,n,r,o,s,a;const u={number:this.pages.length+1,title:null!==(i=t.title)&&void 0!==i?i:"",rootTocId:null!==(n=t.tocId)&&void 0!==n?n:"root",toc:(null!==(r=t.pageToc)&&void 0!==r?r:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:e?this.buildBreadcrumb(this.nodeByTocId[e]):[]},c=(t,e)=>(e?u.topics:u.hiddenTopics).push(t),l=null!==(s=null===(o=t.pageConfiguration)||void 0===o?void 0:o.parentsVisibility)&&void 0!==s?s:[];return u.breadcrumb.forEach(((t,e)=>{c(t,l[e])})),t.tocId&&c(t.tocId,t.pageConfiguration.isVisible),u.topics.push(...this.tocIds(null!==(a=t.pageToc)&&void 0!==a?a:[])),u}registerPage(t){for(let e of[...t.topics,...t.hiddenTopics])this.pageByTocId[e]||(this.pageByTocId[e]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const e=[t.tocId];for(;null==t?void 0:t.parentTocId;)e.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return e}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 Ai{convertPaginatedToc(t){return new Ri(t).build()}}!function(t){!function(e){var i={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(i.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};function o(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 s(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function h(t){var e=new FileReader,i=l(e);return e.readAsArrayBuffer(t),i}function f(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():i.arrayBuffer&&i.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=f(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):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,i=l(e);return e.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),n=0;n<e.length;n++)i[n]=String.fromCharCode(e[n]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(t,e){t=o(t),e=s(e);var i=this.map[t];this.map[t]=i?i+", "+e:e},u.prototype.delete=function(t){delete this.map[o(t)]},u.prototype.get=function(t){return t=o(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(o(t))},u.prototype.set=function(t,e){this.map[o(t)]=s(e)},u.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)},u.prototype.keys=function(){var t=[];return this.forEach((function(e,i){t.push(i)})),a(t)},u.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),a(t)},u.prototype.entries=function(){var t=[];return this.forEach((function(e,i){t.push([i,e])})),a(t)},i.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function p(t,e){var i,n,r=(e=e||{}).body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new u(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new u(e.headers)),this.method=(i=e.method||this.method||"GET",n=i.toUpperCase(),v.indexOf(n)>-1?n:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),n=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(r))}})),e}function y(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},d.call(p.prototype),d.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];y.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function m(t,n){return new Promise((function(r,o){var s=new p(t,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,i={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new u,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),n=i.shift().trim();if(n){var r=i.join(":").trim();e.append(n,r)}})),e)};i.url="responseURL"in a?a.responseURL:i.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;r(new y(n,i))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i.blob&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=u,t.Request=p,t.Response=y),e.Headers=u,e.Request=p,e.Response=y,e.fetch=m,Object.defineProperty(e,"U",{value:!0})}({})}("undefined"!=typeof self?self:void 0);const Ti=t=>"object"==typeof t&&null!=t,Ci=t=>"string"==typeof t;var Ni,Ui,ji,Mi,Ii,Pi,_i,ki,Li,Fi,Bi,Di;!function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Ni||(Ni={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Ui||(Ui={})),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"}(ji||(ji={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Mi||(Mi={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Ii||(Ii={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Pi||(Pi={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(_i||(_i={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK"}(ki||(ki={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Li||(Li={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Fi||(Fi={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Bi||(Bi={})),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"}(Di||(Di={}));const $i=t=>Ti(t)&&(null==t.authenticationIdentifier||(t=>Ti(t)&&Ci(t.identifier)&&Ci(t.realm))(t.authenticationIdentifier))&&(t=>"number"==typeof t)(t.idleTimeoutInMillis)&&Ki(t.profile)&&(t=>"boolean"==typeof t)(t.sessionAuthenticated),Ki=t=>Ti(t)&&(null==t.emailAddress||Ci(t.emailAddress))&&(null==t.displayName||Ci(t.displayName))&&Array.isArray(t.roles)&&t.roles.every((t=>(t=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(t))(t)))&&(null==t.userId||Ci(t.userId)),Hi={[Di.PERSONAL_BOOK_SHARE_USER]:[Di.PERSONAL_BOOK_USER],[Di.HTML_EXPORT_USER]:[Di.PERSONAL_BOOK_USER],[Di.PDF_EXPORT_USER]:[Di.PERSONAL_BOOK_USER],[Di.KHUB_ADMIN]:[Di.CONTENT_PUBLISHER],[Di.ADMIN]:[Di.KHUB_ADMIN,Di.USERS_ADMIN,Di.PORTAL_ADMIN],[Di.DEVELOPER]:[Di.BETA_USER,Di.DEBUG_USER]};function Wi(t,e){return t===e||(Hi[t]??[]).some((t=>Wi(t,e)))}function qi(t,e){return($i(t)?t.profile.roles:Ki(t)?t.roles:t).some((t=>Wi(t,e)))}const Vi=w`
|
|
81
|
+
`;class xt{constructor(t,e){this.defaultLabels=t,this.labels=e}resolve(t,...e){var i,n;t=this.resolvePluralKey(t,e);let r=null!==(n=null!==(i=this.labels[t])&&void 0!==i?i:this.defaultLabels[t])&&void 0!==n?n:"";return e.forEach(((t,e)=>r=r.replace(new RegExp(`\\{${e}([^}]*)\\}`,"g"),((e,i)=>this.formatValue(t,i))))),r}resolvePluralKey(t,e){for(let i of e)if("number"==typeof i){const e=`${String(t)}[\\=${i}]`;if(e in this.labels||e in this.defaultLabels)return e}return t}formatValue(t,e){return t instanceof Date?this.formatDate(t,e):null!=t?t:""}formatDate(t,e){const i=i=>(null==e?void 0:e.includes("date"))?t.toLocaleDateString(i):(null==e?void 0:e.includes("time"))?t.toLocaleTimeString(i):t.toLocaleString(i);try{return i(document.documentElement.lang)}catch(t){return i()}}}function Rt(t){var e;return null!==(e=null==t?void 0:t.isFtReduxStore)&&void 0!==e&&e}var At,Tt,Ct;const Nt=Symbol("internalReduxEventsUnsubscribers"),Ut=Symbol("internalStoresUnsubscribers"),jt=Symbol("internalStores");class Mt extends Ot{constructor(){super(...arguments),this[At]=new Map,this[Tt]=new Map,this[Ct]=[]}update(t){var e;super.update(t),(null===(e=this.reduxReactiveProperties)||void 0===e?void 0:e.some((e=>t.has(e))))&&this.updateFromStores()}getUnnamedStore(){if(this[jt].size>1)throw new Error("Cannot resolve unnamed store when multiple stores are configured.");return[...this[jt].values()][0]}getStore(t){return null==t?this.getUnnamedStore():this[jt].get(t)}addStore(t,e){var i;e=null!==(i=null!=e?e:Rt(t)?t.name:void 0)&&void 0!==i?i:"default-store",this.unsubscribeFromStore(e),this.setupStore(e,t)}removeStore(t){const e="string"==typeof t?t:t.name;this.unsubscribeFromStore(e),this[jt].delete(e)}setupStore(t,e){this[jt].set(t,e),this.subscribeToStore(t,e),this.updateFromStores()}setupStores(){this.unsubscribeFromStores(),this[jt].forEach(((t,e)=>this.subscribeToStore(e,t))),this.updateFromStores()}updateFromStores(){this.reduxProperties&&this.reduxProperties.forEach(((t,e)=>{const i=this.constructor.getPropertyOptions(e);if(!(null==i?void 0:i.attribute)||!this.hasAttribute("string"==typeof(null==i?void 0:i.attribute)?i.attribute:e)){const i=this.getStore(t.store);i&&(t.store?this[Ut].has(t.store):this[Ut].size>0)&&(this[e]=t.selector(i.getState(),this))}}))}subscribeToStore(t,e){var i;this[Ut].set(t,e.subscribe((()=>this.updateFromStores()))),Rt(e)&&e.eventBus&&(null===(i=this.reduxEventListeners)||void 0===i||i.forEach(((t,i)=>{if("function"==typeof this[i]&&(!t.store||e.name===t.store)){const n=t=>this[i](t);e.eventBus.addEventListener(t.eventName,n),this[Nt].push((()=>e.eventBus.removeEventListener(t.eventName,n)))}}))),this.onStoreAvailable(t)}unsubscribeFromStores(){this[Ut].forEach(((t,e)=>this.unsubscribeFromStore(e))),this[Nt].forEach((t=>t())),this[Nt]=[]}unsubscribeFromStore(t){this[Ut].has(t)&&this[Ut].get(t)(),this[Ut].delete(t)}onStoreAvailable(t){}connectedCallback(){super.connectedCallback(),this.setupStores()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromStores()}}function It(t){for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+t+(i.length?" "+i.map((function(t){return"'"+t+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Pt(t){return!!t&&!!t[ge]}function _t(t){var e;return!!t&&(function(t){if(!t||"object"!=typeof t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Ee}(t)||Array.isArray(t)||!!t[me]||!!(null===(e=t.constructor)||void 0===e?void 0:e[me])||$t(t)||Kt(t))}function kt(t,e,i){void 0===i&&(i=!1),0===Lt(t)?(i?Object.keys:Se)(t).forEach((function(n){i&&"symbol"==typeof n||e(n,t[n],t)})):t.forEach((function(i,n){return e(n,i,t)}))}function Lt(t){var e=t[ge];return e?e.i>3?e.i-4:e.i:Array.isArray(t)?1:$t(t)?2:Kt(t)?3:0}function Ft(t,e){return 2===Lt(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Bt(t,e,i){var n=Lt(t);2===n?t.set(e,i):3===n?t.add(i):t[e]=i}function Dt(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function $t(t){return pe&&t instanceof Map}function Kt(t){return be&&t instanceof Set}function Ht(t){return t.o||t.t}function Wt(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=Oe(t);delete e[ge];for(var i=Se(e),n=0;n<i.length;n++){var r=i[n],o=e[r];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(e[r]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[r]})}return Object.create(Object.getPrototypeOf(t),e)}function qt(t,e){return void 0===e&&(e=!1),Gt(t)||Pt(t)||!_t(t)||(Lt(t)>1&&(t.set=t.add=t.clear=t.delete=Vt),Object.freeze(t),e&&kt(t,(function(t,e){return qt(e,!0)}),!0)),t}function Vt(){It(2)}function Gt(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function zt(t){var e=xe[t];return e||It(18,t),e}function Xt(){return de}function Jt(t,e){e&&(zt("Patches"),t.u=[],t.s=[],t.v=e)}function Zt(t){Yt(t),t.p.forEach(te),t.p=null}function Yt(t){t===de&&(de=t.l)}function Qt(t){return de={p:[],l:de,h:t,m:!0,_:0}}function te(t){var e=t[ge];0===e.i||1===e.i?e.j():e.g=!0}function ee(t,e){e._=e.p.length;var i=e.p[0],n=void 0!==t&&t!==i;return e.h.O||zt("ES5").S(e,t,n),n?(i[ge].P&&(Zt(e),It(4)),_t(t)&&(t=ie(e,t),e.l||re(e,t)),e.u&&zt("Patches").M(i[ge].t,t,e.u,e.s)):t=ie(e,i,[]),Zt(e),e.u&&e.v(e.u,e.s),t!==we?t:void 0}function ie(t,e,i){if(Gt(e))return e;var n=e[ge];if(!n)return kt(e,(function(r,o){return ne(t,n,e,r,o,i)}),!0),e;if(n.A!==t)return e;if(!n.P)return re(t,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var r=4===n.i||5===n.i?n.o=Wt(n.k):n.o,o=r,s=!1;3===n.i&&(o=new Set(r),r.clear(),s=!0),kt(o,(function(e,o){return ne(t,n,r,e,o,i,s)})),re(t,r,!1),i&&t.u&&zt("Patches").N(n,i,t.u,t.s)}return n.o}function ne(t,e,i,n,r,o,s){if(Pt(r)){var a=ie(t,r,o&&e&&3!==e.i&&!Ft(e.R,n)?o.concat(n):void 0);if(Bt(i,n,a),!Pt(a))return;t.m=!1}else s&&i.add(r);if(_t(r)&&!Gt(r)){if(!t.h.D&&t._<1)return;ie(t,r),e&&e.A.l||re(t,r)}}function re(t,e,i){void 0===i&&(i=!1),!t.l&&t.h.D&&t.m&&qt(e,i)}function oe(t,e){var i=t[ge];return(i?Ht(i):t)[e]}function se(t,e){if(e in t)for(var i=Object.getPrototypeOf(t);i;){var n=Object.getOwnPropertyDescriptor(i,e);if(n)return n;i=Object.getPrototypeOf(i)}}function ae(t){t.P||(t.P=!0,t.l&&ae(t.l))}function ue(t){t.o||(t.o=Wt(t.t))}function ce(t,e,i){var n=$t(e)?zt("MapSet").F(e,i):Kt(e)?zt("MapSet").T(e,i):t.O?function(t,e){var i=Array.isArray(t),n={i:i?1:0,A:e?e.A:Xt(),P:!1,I:!1,R:{},l:e,t,k:null,o:null,j:null,C:!1},r=n,o=Re;i&&(r=[n],o=Ae);var s=Proxy.revocable(r,o),a=s.revoke,u=s.proxy;return n.k=u,n.j=a,u}(e,i):zt("ES5").J(e,i);return(i?i.A:Xt()).p.push(n),n}function le(t){return Pt(t)||It(22,t),function t(e){if(!_t(e))return e;var i,n=e[ge],r=Lt(e);if(n){if(!n.P&&(n.i<4||!zt("ES5").K(n)))return n.t;n.I=!0,i=he(e,r),n.I=!1}else i=he(e,r);return kt(i,(function(e,r){n&&function(t,e){return 2===Lt(t)?t.get(e):t[e]}(n.t,e)===r||Bt(i,e,t(r))})),3===r?new Set(i):i}(t)}function he(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return Wt(t)}At=Ut,Tt=jt,Ct=Nt;var fe,de,ve="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),pe="undefined"!=typeof Map,be="undefined"!=typeof Set,ye="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,we=ve?Symbol.for("immer-nothing"):((fe={})["immer-nothing"]=!0,fe),me=ve?Symbol.for("immer-draftable"):"__$immer_draftable",ge=ve?Symbol.for("immer-state"):"__$immer_state",Ee=""+Object.prototype.constructor,Se="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,Oe=Object.getOwnPropertyDescriptors||function(t){var e={};return Se(t).forEach((function(i){e[i]=Object.getOwnPropertyDescriptor(t,i)})),e},xe={},Re={get:function(t,e){if(e===ge)return t;var i=Ht(t);if(!Ft(i,e))return function(t,e,i){var n,r=se(e,i);return r?"value"in r?r.value:null===(n=r.get)||void 0===n?void 0:n.call(t.k):void 0}(t,i,e);var n=i[e];return t.I||!_t(n)?n:n===oe(t.t,e)?(ue(t),t.o[e]=ce(t.A.h,n,t)):n},has:function(t,e){return e in Ht(t)},ownKeys:function(t){return Reflect.ownKeys(Ht(t))},set:function(t,e,i){var n=se(Ht(t),e);if(null==n?void 0:n.set)return n.set.call(t.k,i),!0;if(!t.P){var r=oe(Ht(t),e),o=null==r?void 0:r[ge];if(o&&o.t===i)return t.o[e]=i,t.R[e]=!1,!0;if(Dt(i,r)&&(void 0!==i||Ft(t.t,e)))return!0;ue(t),ae(t)}return t.o[e]===i&&(void 0!==i||e in t.o)||Number.isNaN(i)&&Number.isNaN(t.o[e])||(t.o[e]=i,t.R[e]=!0),!0},deleteProperty:function(t,e){return void 0!==oe(t.t,e)||e in t.t?(t.R[e]=!1,ue(t),ae(t)):delete t.R[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var i=Ht(t),n=Reflect.getOwnPropertyDescriptor(i,e);return n?{writable:!0,configurable:1!==t.i||"length"!==e,enumerable:n.enumerable,value:i[e]}:n},defineProperty:function(){It(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){It(12)}},Ae={};kt(Re,(function(t,e){Ae[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),Ae.deleteProperty=function(t,e){return Ae.set.call(this,t,e,void 0)},Ae.set=function(t,e,i){return Re.set.call(this,t[0],e,i,t[0])};var Te=function(){function t(t){var e=this;this.O=ye,this.D=!0,this.produce=function(t,i,n){if("function"==typeof t&&"function"!=typeof i){var r=i;i=t;var o=e;return function(t){var e=this;void 0===t&&(t=r);for(var n=arguments.length,s=Array(n>1?n-1:0),a=1;a<n;a++)s[a-1]=arguments[a];return o.produce(t,(function(t){var n;return(n=i).call.apply(n,[e,t].concat(s))}))}}var s;if("function"!=typeof i&&It(6),void 0!==n&&"function"!=typeof n&&It(7),_t(t)){var a=Qt(e),u=ce(e,t,void 0),c=!0;try{s=i(u),c=!1}finally{c?Zt(a):Yt(a)}return"undefined"!=typeof Promise&&s instanceof Promise?s.then((function(t){return Jt(a,n),ee(t,a)}),(function(t){throw Zt(a),t})):(Jt(a,n),ee(s,a))}if(!t||"object"!=typeof t){if(void 0===(s=i(t))&&(s=t),s===we&&(s=void 0),e.D&&qt(s,!0),n){var l=[],h=[];zt("Patches").M(t,s,l,h),n(l,h)}return s}It(21,t)},this.produceWithPatches=function(t,i){if("function"==typeof t)return function(i){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return e.produceWithPatches(i,(function(e){return t.apply(void 0,[e].concat(r))}))};var n,r,o=e.produce(t,i,(function(t,e){n=t,r=e}));return"undefined"!=typeof Promise&&o instanceof Promise?o.then((function(t){return[t,n,r]})):[o,n,r]},"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 e=t.prototype;return e.createDraft=function(t){_t(t)||It(8),Pt(t)&&(t=le(t));var e=Qt(this),i=ce(this,t,void 0);return i[ge].C=!0,Yt(e),i},e.finishDraft=function(t,e){var i=(t&&t[ge]).A;return Jt(i,e),ee(void 0,i)},e.setAutoFreeze=function(t){this.D=t},e.setUseProxies=function(t){t&&!ye&&It(20),this.O=t},e.applyPatches=function(t,e){var i;for(i=e.length-1;i>=0;i--){var n=e[i];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}i>-1&&(e=e.slice(i+1));var r=zt("Patches").$;return Pt(t)?r(t,e):this.produce(t,(function(t){return r(t,e)}))},t}(),Ce=new Te,Ne=Ce.produce;function Ue(t){return Ue="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},Ue(t)}function je(t){var e=function(t,e){if("object"!==Ue(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!==Ue(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===Ue(e)?e:String(e)}function Me(t,e,i){return(e=je(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Ie(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Pe(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ie(Object(i),!0).forEach((function(e){Me(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ie(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function _e(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. "}Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce);var ke="function"==typeof Symbol&&Symbol.observable||"@@observable",Le=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fe={INIT:"@@redux/INIT"+Le(),REPLACE:"@@redux/REPLACE"+Le(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Le()}};function Be(t,e,i){var n;if("function"==typeof e&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof e&&void 0===i&&(i=e,e=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_e(1));return i(Be)(t,e)}if("function"!=typeof t)throw new Error(_e(2));var r=t,o=e,s=[],a=s,u=!1;function c(){a===s&&(a=s.slice())}function l(){if(u)throw new Error(_e(3));return o}function h(t){if("function"!=typeof t)throw new Error(_e(4));if(u)throw new Error(_e(5));var e=!0;return c(),a.push(t),function(){if(e){if(u)throw new Error(_e(6));e=!1,c();var i=a.indexOf(t);a.splice(i,1),s=null}}}function f(t){if(!function(t){if("object"!=typeof t||null===t)return!1;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}(t))throw new Error(_e(7));if(void 0===t.type)throw new Error(_e(8));if(u)throw new Error(_e(9));try{u=!0,o=r(o,t)}finally{u=!1}for(var e=s=a,i=0;i<e.length;i++){(0,e[i])()}return t}return f({type:Fe.INIT}),(n={dispatch:f,subscribe:h,getState:l,replaceReducer:function(t){if("function"!=typeof t)throw new Error(_e(10));r=t,f({type:Fe.REPLACE})}})[ke]=function(){var t,e=h;return(t={subscribe:function(t){if("object"!=typeof t||null===t)throw new Error(_e(11));function i(){t.next&&t.next(l())}return i(),{unsubscribe:e(i)}}})[ke]=function(){return this},t},n}function De(t){for(var e=Object.keys(t),i={},n=0;n<e.length;n++){var r=e[n];"function"==typeof t[r]&&(i[r]=t[r])}var o,s=Object.keys(i);try{!function(t){Object.keys(t).forEach((function(e){var i=t[e];if(void 0===i(void 0,{type:Fe.INIT}))throw new Error(_e(12));if(void 0===i(void 0,{type:Fe.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(i)}catch(t){o=t}return function(t,e){if(void 0===t&&(t={}),o)throw o;for(var n=!1,r={},a=0;a<s.length;a++){var u=s[a],c=i[u],l=t[u],h=c(l,e);if(void 0===h)throw e&&e.type,new Error(_e(14));r[u]=h,n=n||h!==l}return(n=n||s.length!==Object.keys(t).length)?r:t}}function $e(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return 0===e.length?function(t){return t}:1===e.length?e[0]:e.reduce((function(t,e){return function(){return t(e.apply(void 0,arguments))}}))}function Ke(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return function(){var i=t.apply(void 0,arguments),n=function(){throw new Error(_e(15))},r={getState:i.getState,dispatch:function(){return n.apply(void 0,arguments)}},o=e.map((function(t){return t(r)}));return n=$e.apply(void 0,o)(i.dispatch),Pe(Pe({},i),{},{dispatch:n})}}}function He(t){return function(e){var i=e.dispatch,n=e.getState;return function(e){return function(r){return"function"==typeof r?r(i,n,t):e(r)}}}}var We=He();We.withExtraArgument=He;var qe,Ve=We,Ge=(qe=function(t,e){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},qe(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}qe(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),ze=function(t,e){var i,n,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{i=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Xe=function(t,e){for(var i=0,n=e.length,r=t.length;i<n;i++,r++)t[r]=e[i];return t},Je=Object.defineProperty,Ze=Object.defineProperties,Ye=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,ti=Object.prototype.hasOwnProperty,ei=Object.prototype.propertyIsEnumerable,ii=function(t,e,i){return e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i},ni=function(t,e){for(var i in e||(e={}))ti.call(e,i)&&ii(t,i,e[i]);if(Qe)for(var n=0,r=Qe(e);n<r.length;n++){i=r[n];ei.call(e,i)&&ii(t,i,e[i])}return t},ri=function(t,e){return Ze(t,Ye(e))},oi="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?$e:$e.apply(null,arguments)};var si=function(t){function e(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var r=t.apply(this,i)||this;return Object.setPrototypeOf(r,e.prototype),r}return Ge(e,t),Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.prototype.concat.apply(this,e)},e.prototype.prepend=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 1===t.length&&Array.isArray(t[0])?new(e.bind.apply(e,Xe([void 0],t[0].concat(this)))):new(e.bind.apply(e,Xe([void 0],t.concat(this))))},e}(Array),ai=function(t){function e(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var r=t.apply(this,i)||this;return Object.setPrototypeOf(r,e.prototype),r}return Ge(e,t),Object.defineProperty(e,Symbol.species,{get:function(){return e},enumerable:!1,configurable:!0}),e.prototype.concat=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.prototype.concat.apply(this,e)},e.prototype.prepend=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return 1===t.length&&Array.isArray(t[0])?new(e.bind.apply(e,Xe([void 0],t[0].concat(this)))):new(e.bind.apply(e,Xe([void 0],t.concat(this))))},e}(Array);function ui(t){return _t(t)?Ne(t,(function(){})):t}function ci(){return function(t){return function(t){void 0===t&&(t={});var e=t.thunk,i=void 0===e||e;t.immutableCheck,t.serializableCheck;var n=new si;i&&(!function(t){return"boolean"==typeof t}(i)?n.push(Ve.withExtraArgument(i.extraArgument)):n.push(Ve));return n}(t)}}function li(t){var e,i=ci(),n=t||{},r=n.reducer,o=void 0===r?void 0:r,s=n.middleware,a=void 0===s?i():s,u=n.devTools,c=void 0===u||u,l=n.preloadedState,h=void 0===l?void 0:l,f=n.enhancers,d=void 0===f?void 0:f;if("function"==typeof o)e=o;else{if(!function(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;for(var i=e;null!==Object.getPrototypeOf(i);)i=Object.getPrototypeOf(i);return e===i}(o))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');e=De(o)}var v=a;"function"==typeof v&&(v=v(i));var p=Ke.apply(void 0,v),b=$e;c&&(b=oi(ni({trace:!1},"object"==typeof c&&c)));var y=new ai(p),w=y;return Array.isArray(d)?w=Xe([p],d):"function"==typeof d&&(w=d(y)),Be(e,h,b.apply(void 0,w))}function hi(t,e){function i(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];if(e){var r=e.apply(void 0,i);if(!r)throw new Error("prepareAction did not return an object");return ni(ni({type:t,payload:r.payload},"meta"in r&&{meta:r.meta}),"error"in r&&{error:r.error})}return{type:t,payload:i[0]}}return i.toString=function(){return""+t},i.type=t,i.match=function(e){return e.type===t},i}function fi(t){var e,i={},n=[],r={addCase:function(t,e){var n="string"==typeof t?t:t.type;if(n in i)throw new Error("addCase cannot be called with two reducers for the same action type");return i[n]=e,r},addMatcher:function(t,e){return n.push({matcher:t,reducer:e}),r},addDefaultCase:function(t){return e=t,r}};return t(r),[i,n,e]}function di(t){var e=t.name;if(!e)throw new Error("`name` is a required option for createSlice");var i,n="function"==typeof t.initialState?t.initialState:ui(t.initialState),r=t.reducers||{},o=Object.keys(r),s={},a={},u={};function c(){var e="function"==typeof t.extraReducers?fi(t.extraReducers):[t.extraReducers],i=e[0],r=void 0===i?{}:i,o=e[1],s=void 0===o?[]:o,u=e[2],c=void 0===u?void 0:u,l=ni(ni({},r),a);return function(t,e,i,n){void 0===i&&(i=[]);var r,o="function"==typeof e?fi(e):[e,i,n],s=o[0],a=o[1],u=o[2];if(function(t){return"function"==typeof t}(t))r=function(){return ui(t())};else{var c=ui(t);r=function(){return c}}function l(t,e){void 0===t&&(t=r());var i=Xe([s[e.type]],a.filter((function(t){return(0,t.matcher)(e)})).map((function(t){return t.reducer})));return 0===i.filter((function(t){return!!t})).length&&(i=[u]),i.reduce((function(t,i){if(i){var n;if(Pt(t))return void 0===(n=i(t,e))?t:n;if(_t(t))return Ne(t,(function(t){return i(t,e)}));if(void 0===(n=i(t,e))){if(null===t)return t;throw Error("A case reducer on a non-draftable value must not return undefined")}return n}return t}),t)}return l.getInitialState=r,l}(n,(function(t){for(var e in l)t.addCase(e,l[e]);for(var i=0,n=s;i<n.length;i++){var r=n[i];t.addMatcher(r.matcher,r.reducer)}c&&t.addDefaultCase(c)}))}return o.forEach((function(t){var i,n,o=r[t],c=e+"/"+t;"reducer"in o?(i=o.reducer,n=o.prepare):i=o,s[t]=i,a[c]=i,u[t]=n?hi(c,n):hi(c)})),{name:e,reducer:function(t,e){return i||(i=c()),i(t,e)},actions:u,caseReducers:s,getInitialState:function(){return i||(i=c()),i.getInitialState()}}}var vi=["name","message","stack","code"],pi=function(t,e){this.payload=t,this.meta=e},bi=function(t,e){this.payload=t,this.meta=e},yi=function(t){if("object"==typeof t&&null!==t){for(var e={},i=0,n=vi;i<n.length;i++){var r=n[i];"string"==typeof t[r]&&(e[r]=t[r])}return e}return{message:String(t)}};function wi(t){if(t.meta&&t.meta.rejectedWithValue)throw t.payload;if(t.error)throw t.error;return t.payload}!function(){function t(t,e,i){var n=hi(t+"/fulfilled",(function(t,e,i,n){return{payload:t,meta:ri(ni({},n||{}),{arg:i,requestId:e,requestStatus:"fulfilled"})}})),r=hi(t+"/pending",(function(t,e,i){return{payload:void 0,meta:ri(ni({},i||{}),{arg:e,requestId:t,requestStatus:"pending"})}})),o=hi(t+"/rejected",(function(t,e,n,r,o){return{payload:r,error:(i&&i.serializeError||yi)(t||"Rejected"),meta:ri(ni({},o||{}),{arg:n,requestId:e,rejectedWithValue:!!r,requestStatus:"rejected",aborted:"AbortError"===(null==t?void 0:t.name),condition:"ConditionError"===(null==t?void 0:t.name)})}})),s="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(a,u,c){var l,h=(null==i?void 0:i.idGenerator)?i.idGenerator(t):function(t){void 0===t&&(t=21);for(var e="",i=t;i--;)e+="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"[64*Math.random()|0];return e}(),f=new s;function d(t){l=t,f.abort()}var v=function(){return s=this,v=null,p=function(){var s,v,p,b,y,w;return ze(this,(function(m){switch(m.label){case 0:return m.trys.push([0,4,,5]),b=null==(s=null==i?void 0:i.condition)?void 0:s.call(i,t,{getState:u,extra:c}),null===(g=b)||"object"!=typeof g||"function"!=typeof g.then?[3,2]:[4,b];case 1:b=m.sent(),m.label=2;case 2:if(!1===b||f.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};return y=new Promise((function(t,e){return f.signal.addEventListener("abort",(function(){return e({name:"AbortError",message:l||"Aborted"})}))})),a(r(h,t,null==(v=null==i?void 0:i.getPendingMeta)?void 0:v.call(i,{requestId:h,arg:t},{getState:u,extra:c}))),[4,Promise.race([y,Promise.resolve(e(t,{dispatch:a,getState:u,extra:c,requestId:h,signal:f.signal,abort:d,rejectWithValue:function(t,e){return new pi(t,e)},fulfillWithValue:function(t,e){return new bi(t,e)}})).then((function(e){if(e instanceof pi)throw e;return e instanceof bi?n(e.payload,h,t,e.meta):n(e,h,t)}))])];case 3:return p=m.sent(),[3,5];case 4:return w=m.sent(),p=w instanceof pi?o(null,h,t,w.payload,w.meta):o(w,h,t),[3,5];case 5:return i&&!i.dispatchConditionRejection&&o.match(p)&&p.meta.condition||a(p),[2,p]}var g}))},new Promise((function(t,e){var i=function(t){try{r(p.next(t))}catch(t){e(t)}},n=function(t){try{r(p.throw(t))}catch(t){e(t)}},r=function(e){return e.done?t(e.value):Promise.resolve(e.value).then(i,n)};r((p=p.apply(s,v)).next())}));var s,v,p}();return Object.assign(v,{abort:d,requestId:h,arg:t,unwrap:function(){return v.then(wi)}})}}),{pending:r,rejected:o,fulfilled:n,typePrefix:t})}t.withTypes=function(){return t}}();var mi="listenerMiddleware";hi(mi+"/add"),hi(mi+"/removeAll"),hi(mi+"/remove"),"function"==typeof queueMicrotask&&queueMicrotask.bind("undefined"!=typeof window?window:"undefined"!=typeof global?global:globalThis),function(){function t(t,e){var i=r[t];return i?i.enumerable=e:r[t]=i={configurable:!0,enumerable:e,get:function(){var e=this[ge];return Re.get(e,t)},set:function(e){var i=this[ge];Re.set(i,t,e)}},i}function e(t){for(var e=t.length-1;e>=0;e--){var r=t[e][ge];if(!r.P)switch(r.i){case 5:n(r)&&ae(r);break;case 4:i(r)&&ae(r)}}}function i(t){for(var e=t.t,i=t.k,n=Se(i),r=n.length-1;r>=0;r--){var o=n[r];if(o!==ge){var s=e[o];if(void 0===s&&!Ft(e,o))return!0;var a=i[o],u=a&&a[ge];if(u?u.t!==s:!Dt(a,s))return!0}}var c=!!e[ge];return n.length!==Se(e).length+(c?0:1)}function n(t){var e=t.k;if(e.length!==t.t.length)return!0;var i=Object.getOwnPropertyDescriptor(e,e.length-1);if(i&&!i.get)return!0;for(var n=0;n<e.length;n++)if(!e.hasOwnProperty(n))return!0;return!1}var r={};!function(t,e){xe[t]||(xe[t]=e)}("ES5",{J:function(e,i){var n=Array.isArray(e),r=function(e,i){if(e){for(var n=Array(i.length),r=0;r<i.length;r++)Object.defineProperty(n,""+r,t(r,!0));return n}var o=Oe(i);delete o[ge];for(var s=Se(o),a=0;a<s.length;a++){var u=s[a];o[u]=t(u,e||!!o[u].enumerable)}return Object.create(Object.getPrototypeOf(i),o)}(n,e),o={i:n?5:4,A:i?i.A:Xt(),P:!1,I:!1,R:{},l:i,t:e,k:r,o:null,g:!1,C:!1};return Object.defineProperty(r,ge,{value:o,writable:!0}),r},S:function(t,i,r){r?Pt(i)&&i[ge].A===t&&e(t.p):(t.u&&function t(e){if(e&&"object"==typeof e){var i=e[ge];if(i){var r=i.t,o=i.k,s=i.R,a=i.i;if(4===a)kt(o,(function(e){e!==ge&&(void 0!==r[e]||Ft(r,e)?s[e]||t(o[e]):(s[e]=!0,ae(i)))})),kt(r,(function(t){void 0!==o[t]||Ft(o,t)||(s[t]=!1,ae(i))}));else if(5===a){if(n(i)&&(ae(i),s.length=!0),o.length<r.length)for(var u=o.length;u<r.length;u++)s[u]=!1;else for(var c=r.length;c<o.length;c++)s[c]=!0;for(var l=Math.min(o.length,r.length),h=0;h<l;h++)o.hasOwnProperty(h)||(s[h]=!0),void 0===s[h]&&t(o[h])}}}}(t.p[0]),e(t.p))},K:function(t){return 4===t.i?i(t):n(t)}})}(),window.ftReduxStores||(window.ftReduxStores={});class gi{static get(t){var e;const i="string"==typeof t?t:t.name,n="string"==typeof t?void 0:t,r=window.ftReduxStores[i];if(Rt(r))return r;if(null==n)return;const o=di({...n,reducers:null!==(e=n.reducers)&&void 0!==e?e:{}}),s=li({reducer:(t,e)=>{var i;switch(e.type){case"CLEAR_FT_REDUX_STORE":return o.getInitialState();case"DEFAULT_STATE_FIELDS_VALUES_SETTER":return{...t,...null!==(i=e.overwrites)&&void 0!==i?i:{}};default:return o.reducer(t,e)}}});return window.ftReduxStores[n.name]=new gi(o,s)}constructor(t,e){this.reduxSlice=t,this.reduxStore=e,this.isFtReduxStore=!0,this.eventBus=document.createElement("event-bus"),this.actions=new Proxy(this.reduxSlice.actions,{get:(t,e,i)=>{const n=e,r=t[n];return r?(...t)=>{const e=r(...t);return this.reduxStore.dispatch(e),e}:t=>{this.setState({[n]: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()}}const Ei=t=>{const e=null!=t?t:{};return(t,i)=>{var n;const r={hasChanged:(t,e)=>!c(t,e),attribute:!1,...e};s(r)(t,i);const o=t;o.reduxProperties=o.reduxProperties||new Map,o.reduxProperties.set(i,{selector:null!==(n=e.selector)&&void 0!==n?n:t=>t[i],store:e.store})}};var Si,Oi;navigator.vendor&&navigator.vendor.match(/apple/i)||(null===(Oi=null===(Si=window.safari)||void 0===Si?void 0:Si.pushNotification)||void 0===Oi||Oi.toString());const xi={setMapId:(t,e)=>{t.mapId=e.payload},setTocId:(t,e)=>{t.tocId=e.payload},setMap:(t,e)=>{t.map=e.payload},setToc:(t,e)=>{t.toc=e.payload},setPagesToc:(t,e)=>{t.pagesToc=e.payload},setPaginationConfiguration:(t,e)=>{t.paginationConfiguration=e.payload},setCurrentPage:(t,e)=>{t.currentPage=e.payload},setScrollTarget:(t,e)=>{t.scrollTarget=e.payload},setVisibleTopics:(t,e)=>{t.visibleTopics=e.payload},setConfiguration:(t,e)=>{t.configuration=e.payload}};class Ri{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,e,i){return t.flatMap((t=>(t.pageConfiguration&&this.registerPage(this.buildPage(t,i)),null==t.tocId?this.extractPagesToc(t.children,e,i):[{tocId:t.tocId,title:t.title,depth:e,children:this.extractPagesToc(t.children,e+1,t.tocId)}])))}convertNodes(t,e,i){return t.flatMap((t=>{var n,r,o;if(null==t.tocId)return[...this.convertSectionNodes(null!==(n=t.pageToc)&&void 0!==n?n:[],e,t.tocId),...this.convertNodes(t.children,e,t.tocId)];let s=null===(r=t.prettyUrl)||void 0===r?void 0:r.replace(/^\//,"");const a={tocId:t.tocId,contentId:t.contentId,title:t.title,hasRating:t.hasRating,origin:t.origin,prettyUrl:s,depth:e,parentTocId:i,children:[]};this.register(a);const u=this.convertSectionNodes(null!==(o=t.pageToc)&&void 0!==o?o:[],e+1,t.tocId),c=this.convertNodes(t.children,e+1,a.tocId);return a.children=[...u,...c],[a]}))}convertSectionNodes(t,e,i){return t.flatMap((t=>{var n;let r=null===(n=t.prettyUrl)||void 0===n?void 0:n.replace(/^\//,"");const o={...t,prettyUrl:r,depth:e,parentTocId:i,children:[]};return this.register(o),o.children=this.convertSectionNodes(t.children,e+1,t.tocId),[o]}))}buildPage(t,e){var i,n,r,o,s,a;const u={number:this.pages.length+1,title:null!==(i=t.title)&&void 0!==i?i:"",rootTocId:null!==(n=t.tocId)&&void 0!==n?n:"root",toc:(null!==(r=t.pageToc)&&void 0!==r?r:[]).map((t=>this.nodeByTocId[t.tocId])),topics:[],hiddenTopics:[],breadcrumb:e?this.buildBreadcrumb(this.nodeByTocId[e]):[]},c=(t,e)=>(e?u.topics:u.hiddenTopics).push(t),l=null!==(s=null===(o=t.pageConfiguration)||void 0===o?void 0:o.parentsVisibility)&&void 0!==s?s:[];return u.breadcrumb.forEach(((t,e)=>{c(t,l[e])})),t.tocId&&c(t.tocId,t.pageConfiguration.isVisible),u.topics.push(...this.tocIds(null!==(a=t.pageToc)&&void 0!==a?a:[])),u}registerPage(t){for(let e of[...t.topics,...t.hiddenTopics])this.pageByTocId[e]||(this.pageByTocId[e]=t);this.pages.push(t)}tocIds(t){return t.flatMap((t=>[t.tocId,...this.tocIds(t.children)]))}buildBreadcrumb(t){const e=[t.tocId];for(;null==t?void 0:t.parentTocId;)e.unshift(t.parentTocId),t=this.nodeByTocId[t.parentTocId];return e}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 Ai{convertPaginatedToc(t){return new Ri(t).build()}}!function(t){!function(e){var i={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(i.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};function o(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 s(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function h(t){var e=new FileReader,i=l(e);return e.readAsArrayBuffer(t),i}function f(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function d(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:i.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():i.arrayBuffer&&i.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=f(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(t))?this._bodyArrayBuffer=f(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):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,i=l(e);return e.readAsText(t),i}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),n=0;n<e.length;n++)i[n]=String.fromCharCode(e[n]);return i.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},i.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(t,e){t=o(t),e=s(e);var i=this.map[t];this.map[t]=i?i+", "+e:e},u.prototype.delete=function(t){delete this.map[o(t)]},u.prototype.get=function(t){return t=o(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(o(t))},u.prototype.set=function(t,e){this.map[o(t)]=s(e)},u.prototype.forEach=function(t,e){for(var i in this.map)this.map.hasOwnProperty(i)&&t.call(e,this.map[i],i,this)},u.prototype.keys=function(){var t=[];return this.forEach((function(e,i){t.push(i)})),a(t)},u.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),a(t)},u.prototype.entries=function(){var t=[];return this.forEach((function(e,i){t.push([i,e])})),a(t)},i.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function p(t,e){var i,n,r=(e=e||{}).body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new u(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new u(e.headers)),this.method=(i=e.method||this.method||"GET",n=i.toUpperCase(),v.indexOf(n)>-1?n:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function b(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),n=i.shift().replace(/\+/g," "),r=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(r))}})),e}function y(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},d.call(p.prototype),d.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];y.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function m(t,n){return new Promise((function(r,o){var s=new p(t,n);if(s.signal&&s.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,i={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new u,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var i=t.split(":"),n=i.shift().trim();if(n){var r=i.join(":").trim();e.append(n,r)}})),e)};i.url="responseURL"in a?a.responseURL:i.headers.get("X-Request-URL");var n="response"in a?a.response:a.responseText;r(new y(n,i))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i.blob&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=u,t.Request=p,t.Response=y),e.Headers=u,e.Request=p,e.Response=y,e.fetch=m,Object.defineProperty(e,"U",{value:!0})}({})}("undefined"!=typeof self?self:void 0);const Ti=t=>"object"==typeof t&&null!=t,Ci=t=>"string"==typeof t;var Ni,Ui,ji,Mi,Ii,Pi,_i,ki,Li,Fi,Bi,Di;!function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Ni||(Ni={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Ui||(Ui={})),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"}(ji||(ji={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Mi||(Mi={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Ii||(Ii={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Pi||(Pi={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(_i||(_i={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK"}(ki||(ki={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(Li||(Li={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Fi||(Fi={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Bi||(Bi={})),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"}(Di||(Di={}));const $i=t=>Ti(t)&&(null==t.authenticationIdentifier||(t=>Ti(t)&&Ci(t.identifier)&&Ci(t.realm))(t.authenticationIdentifier))&&(t=>"number"==typeof t)(t.idleTimeoutInMillis)&&Ki(t.profile)&&(t=>"boolean"==typeof t)(t.sessionAuthenticated),Ki=t=>Ti(t)&&(null==t.emailAddress||Ci(t.emailAddress))&&(null==t.displayName||Ci(t.displayName))&&Array.isArray(t.roles)&&t.roles.every((t=>(t=>["PERSONAL_BOOK_USER","PERSONAL_BOOK_SHARE_USER","HTML_EXPORT_USER","PDF_EXPORT_USER","SAVED_SEARCH_USER","COLLECTION_USER","OFFLINE_USER","ANALYTICS_USER","BETA_USER","DEBUG_USER","PRINT_USER","RATING_USER","FEEDBACK_USER","CONTENT_PUBLISHER","KHUB_ADMIN","USERS_ADMIN","PORTAL_ADMIN","ADMIN","DEVELOPER"].includes(t))(t)))&&(null==t.userId||Ci(t.userId)),Hi={[Di.PERSONAL_BOOK_SHARE_USER]:[Di.PERSONAL_BOOK_USER],[Di.HTML_EXPORT_USER]:[Di.PERSONAL_BOOK_USER],[Di.PDF_EXPORT_USER]:[Di.PERSONAL_BOOK_USER],[Di.KHUB_ADMIN]:[Di.CONTENT_PUBLISHER],[Di.ADMIN]:[Di.KHUB_ADMIN,Di.USERS_ADMIN,Di.PORTAL_ADMIN],[Di.DEVELOPER]:[Di.BETA_USER,Di.DEBUG_USER]};function Wi(t,e){return t===e||(Hi[t]??[]).some((t=>Wi(t,e)))}function qi(t,e){return($i(t)?t.profile.roles:Ki(t)?t.roles:t).some((t=>Wi(t,e)))}const Vi=w`
|
|
82
82
|
`,Gi=gi.get({name:"ft-app-info",reducers:{setBaseUrl:(t,e)=>{t.baseUrl=e.payload},setApiIntegrationIdentifier:(t,e)=>{t.apiIntegrationIdentifier=e.payload},setUiLocale:(t,e)=>{t.uiLocale=e.payload},setAvailableUiLocales:(t,e)=>{t.availableUiLocales=e.payload},setEditorMode:(t,e)=>{t.editorMode=e.payload},setNoCustom:(t,e)=>{t.noCustom=e.payload},setNoCustomComponent:(t,e)=>{t.noCustomComponent=e.payload},setSession:(t,e)=>{t.session=e.payload}},initialState:{uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],editorMode:!1,noCustom:!1,noCustomComponent:!1}});class zi{static build(t){const{baseUrl:e,apiIntegrationIdentifier:i}=Gi.getState(),n=null!=t?t:i;if(e&&n&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,n,!0)}static get(t){var e;return null!=t?zi.build(t):null!==(e=zi.API)&&void 0!==e?e:zi.API=zi.build()}static await(t){return new Promise((e=>{let i=zi.get(t);if(i)e(i);else{const n=Gi.subscribe((()=>{i=zi.get(t),i&&(n(),e(i))}))}}))}}var Xi;const Ji=Symbol("clearAfterUnitTest");class Zi{constructor(t){this.messageContextProvider=t,this.defaultMessages={},this.cache=new n,this.listeners={},this.currentUiLocale="",this[Xi]=()=>{this.defaultMessages={},this.cache=new n,this.listeners={}},this.currentUiLocale=Gi.getState().uiLocale,Gi.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Gi.getState();this.currentUiLocale!==t&&(this.currentUiLocale=t,this.cache.clearAll(),this.notifyAll())}addContext(t){const e=t.name.toLowerCase();this.cache.setFinal(e,t),this.notify(e)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var i;if(t=t.toLowerCase(),Object.keys(e).length>0){const n={...null!==(i=this.defaultMessages[t])&&void 0!==i?i:{},...e};c(this.defaultMessages[t],n)||(this.defaultMessages[t]=n,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...i){var n,r,o;t=t.toLowerCase(),this.fetchContext(t);const s=null!==(r=null===(n=this.cache.getNow(t))||void 0===n?void 0:n.messages)&&void 0!==r?r:{};return new xt(null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},s).resolve(e,...i)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,e){var i;return t=t.toLowerCase(),this.listeners[t]=null!==(i=this.listeners[t])&&void 0!==i?i:new Set,this.listeners[t].add(e),()=>{var i;return null===(i=this.listeners[t])||void 0===i?void 0:i.delete(e)}}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=>u(0).then((()=>t())).catch((()=>null)))))}}Xi=Ji,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new Zi((async(t,e)=>(await zi.await()).getFluidTopicsMessageContext(t,e)))),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new Zi((async(t,e)=>(await zi.await()).getCustomMessageContext(t,e))));const Yi=window.FluidTopicsI18nService;var Qi=function(t,e,i,n){for(var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};class tn extends Ot{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.availableUiLocales=[],this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>zi.get(),this.cache=new n,this.cleanSessionDebouncer=new r}render(){return J`
|
|
83
83
|
<slot></slot>
|
|
84
|
-
`}updated(t){super.updated(t),t.has("baseUrl")&&Gi.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Gi.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Gi.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&Gi.actions.setNoCustom(this.noCustom),t.has("editorMode")&&Gi.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&Gi.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&Gi.actions.setSession(this.session),t.has("availableUiLocales")&&Gi.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Yi.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const e=await t.getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),e.idleTimeoutInMillis),e}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}tn.elementDefinitions={},tn.styles=Vi,Qi([s()],tn.prototype,"baseUrl",void 0),Qi([s()],tn.prototype,"apiIntegrationIdentifier",void 0),Qi([s()],tn.prototype,"uiLocale",void 0),Qi([h([])],tn.prototype,"availableUiLocales",void 0),Qi([s({type:Boolean})],tn.prototype,"editorMode",void 0),Qi([s({type:Boolean})],tn.prototype,"noCustom",void 0),Qi([s({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],tn.prototype,"noCustomComponent",void 0),Qi([s({type:Boolean})],tn.prototype,"withManualResources",void 0),Qi([h([])],tn.prototype,"messageContexts",void 0),Qi([h(void 0)],tn.prototype,"session",void 0),Qi([s({type:Object})],tn.prototype,"apiProvider",void 0);class en{async listMySearches(){var t;return(null===(t=Gi.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await zi.await()).listMySearches(Gi.getState().session.profile.userId):[]}}const nn=new n;class rn{async listMyBookmarks(){return nn.get("bookmarks",(async()=>(await zi.await()).listMyBookmarks(Gi.getState().session.profile.userId)))}clearCache(){nn.clear("bookmarks")}}const on=gi.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const sn=new class{constructor(){this.currentSession=Gi.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new rn,Gi.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Gi.getState();c(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(){on.actions.savedSearches(void 0)}clearMyBookmarks(){on.actions.bookmarks(void 0)}async reloadMySearches(){const t=new en,e=await t.listMySearches();on.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;on.actions.bookmarks(e)}}};var an;l("ft-app-context")(tn),t.FtReaderFeatures=void 0,(an=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",an.RATING="RATING",an.PRINT="PRINT",an.BOOKMARK="BOOKMARK",an.COLLECTIONS="COLLECTIONS";class un{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,e,i,n){this.converter=t,this.api=e,this.cache=i,this._mapId=n,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,e;return qi(null!==(e=null===(t=Gi.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==e?e:[],"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 e;return null===(e=this.enrichedToc)||void 0===e?void 0:e.nodeByTocId[t]}async getPage(t){const e=await this.getEnrichedToc();return e.pages[t-1]||e.pages[0]}async getPageByTocId(t){const e=await this.getEnrichedToc();return e.pageByTocId[t]||e.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)))}getLink(t,e,i){const n=this.getNavigationData(t,e,i),r=this.getReaderLinkPrefix()+(n.prettyUrl?n.prettyUrl:`${n.mapId}/${n.tocId}`),o=new URL(r,this.api.tenantBaseUrl);return null!=n.page&&o.searchParams.set("page",`${n.page}`),n.prettyUrlDuplicated&&o.searchParams.set("tocId",n.tocId),null!=n.section&&o.searchParams.set("section",n.section),o.href}getNavigationData(t,e,i){var n,r;t=t||"root";const o=this.enrichedToc,s=null==o?void 0:o.pageByTocId[t],a=null==o?void 0:o.nodeByTocId[t],u=null==a?void 0:a.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(n=null==a?void 0:a.title)&&void 0!==n?n:"",page:e&&s&&s.number!==e?e:void 0,prettyUrl:null!=u?u.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(r=null==o?void 0:o.duplicatedPrettyUrls.has(null!=u?u:""))&&void 0!==r&&r,section:i}}async getAccurateNavigationData(t,e,i){return await this.getEnrichedToc(),this.getNavigationData(t,e,i)}getRatingSummary(){return this.cache.get("ratingSummary")}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((e=>{var i;return e?{type:e.topics.type,rating:null===(i=e.topics)||void 0===i?void 0:i.ratings.find((e=>e.tocId===t))}:void 0}))}rateMap(t,e){return this.makeRateMapRequest(t,e).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,e){return this.makeMapFeedbackRequest(t,e)}rateTopic(t,e,i){return this.makeRateTopicRequest(t,e,i).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=Gi.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,e,i){return this.makeTopicFeedbackRequest(t,e,i)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let e=this.getTocNodeNow(t),i=[{tocId:e.tocId,title:e.title}],n=this.getTocNodeNow(e.parentTocId);for(;n;)i.unshift({tocId:n.tocId,title:n.title}),n=this.getTocNodeNow(n.parentTocId);return i}}class cn extends un{static async build(t){return new cn(new Ai,await zi.await(),new n,t)}fetchMap(t){return this.api.getMap(t)}fetchMapRating(t){return this.api.getMapRating(t)}fetchPages(t){return this.api.getPages(t)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER")}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId)}makeMapFeedbackRequest(t,e){return this.api.sendMapFeedback(this.mapId,t,e)}makeRateMapRequest(t,e){return this.api.rateMap(this.mapId,t,e)}makeRateTopicRequest(t,e,i){return this.api.rateTopic(this.mapId,t,e,i)}makeTopicFeedbackRequest(t,e,i){return this.api.sendTopicFeedback(this.mapId,t,e,i)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAccessible(t){return!0}}class ln{static build(t,e){return new ln((t=>gi.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[]},reducers:xi}))(t.trim()||"context"),null!=e?e:cn.build)}constructor(t,e){this.store=t,this.reloadDebouncer=new r(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.setMapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.setVisibleTopics(t)}async awaitService(){for(;null==this.service;)await u(5);return this.service}async navigateToTopic(t,e,i){const n=await this.awaitService(),r=await(null!=i?n.getPage(i):n.getPageByTocId(null!=t?t:"root"));this.store.actions.setCurrentPage(r),this.store.actions.setScrollTarget({tocId:this.resolveValidNonRootTocId(t,r),section:e})}resolveValidNonRootTocId(t,e){var i,n,r;let o=null!==(i="root"===t?void 0:t)&&void 0!==i?i:e.rootTocId;return e.topics.includes(o)?o:null!==(r=null!==(n=e.topics[0])&&void 0!==n?n:e.hiddenTopics[0])&&void 0!==r?r:"root"}async navigateToPage(t){const e=await this.awaitService();let i=await e.getPage(t);this.store.actions.setCurrentPage(i)}scrollDone(){this.store.actions.setScrollTarget({})}async reload(){var t,e;this.store.actions.setConfiguration(void 0),this.store.actions.setMap(void 0),this.store.actions.setToc(void 0),this.store.actions.setPagesToc(void 0),this.store.actions.setCurrentPage(void 0),null===(t=this.service)||void 0===t||t.clear(),(null===(e=this.service)||void 0===e?void 0:e.mapId)&&await this.reloadDebouncer.run((()=>this.fetchData()))}async fetchData(){var t,i,n,r,o;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.setConfiguration(t))),null===(i=this.service)||void 0===i?void 0:i.getMap().then((t=>this.store.actions.setMap(t))),null===(n=this.service)||void 0===n?void 0:n.getToc().then((t=>this.store.actions.setToc(t))),null===(r=this.service)||void 0===r?void 0:r.getPagesToc().then((t=>this.store.actions.setPagesToc(t))),null===(o=this.service)||void 0===o?void 0:o.getPaginationConfiguration().then((t=>this.store.actions.setPaginationConfiguration(t)))])}catch(t){!this.errorHandler||t instanceof e||this.errorHandler(t)}}}const hn=w`
|
|
84
|
+
`}update(t){super.update(t),t.has("baseUrl")&&Gi.actions.setBaseUrl(this.baseUrl),t.has("apiIntegrationIdentifier")&&Gi.actions.setApiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Gi.actions.setUiLocale(this.uiLocale),t.has("noCustom")&&Gi.actions.setNoCustom(this.noCustom),t.has("editorMode")&&Gi.actions.setEditorMode(this.editorMode),t.has("noCustomComponent")&&Gi.actions.setNoCustomComponent(this.noCustomComponent),t.has("session")&&Gi.actions.setSession(this.session),t.has("availableUiLocales")&&Gi.actions.setAvailableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Yi.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){const t=this.apiProvider();!this.withManualResources&&t&&(null==this.session&&(this.session=await this.cache.get("session",(async()=>{const e=await t.getCurrentSession();return e.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),e.idleTimeoutInMillis),e}))),null==this.availableUiLocales&&(this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>t.getAvailableUiLocales()))))}}tn.elementDefinitions={},tn.styles=Vi,Qi([s()],tn.prototype,"baseUrl",void 0),Qi([s()],tn.prototype,"apiIntegrationIdentifier",void 0),Qi([s()],tn.prototype,"uiLocale",void 0),Qi([h([])],tn.prototype,"availableUiLocales",void 0),Qi([s({type:Boolean})],tn.prototype,"editorMode",void 0),Qi([s({type:Boolean})],tn.prototype,"noCustom",void 0),Qi([s({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],tn.prototype,"noCustomComponent",void 0),Qi([s({type:Boolean})],tn.prototype,"withManualResources",void 0),Qi([h([])],tn.prototype,"messageContexts",void 0),Qi([h(void 0)],tn.prototype,"session",void 0),Qi([s({type:Object})],tn.prototype,"apiProvider",void 0);class en{async listMySearches(){var t;return(null===(t=Gi.getState().session)||void 0===t?void 0:t.sessionAuthenticated)?(await zi.await()).listMySearches(Gi.getState().session.profile.userId):[]}}const nn=new n;class rn{async listMyBookmarks(){return nn.get("bookmarks",(async()=>(await zi.await()).listMyBookmarks(Gi.getState().session.profile.userId)))}clearCache(){nn.clear("bookmarks")}}const on=gi.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});const sn=new class{constructor(){this.currentSession=Gi.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new rn,Gi.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Gi.getState();c(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(){on.actions.savedSearches(void 0)}clearMyBookmarks(){on.actions.bookmarks(void 0)}async reloadMySearches(){const t=new en,e=await t.listMySearches();on.actions.savedSearches(e)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;on.actions.bookmarks(e)}}};var an;l("ft-app-context")(tn),t.FtReaderFeatures=void 0,(an=t.FtReaderFeatures||(t.FtReaderFeatures={})).FEEDBACK="FEEDBACK",an.RATING="RATING",an.PRINT="PRINT",an.BOOKMARK="BOOKMARK",an.COLLECTIONS="COLLECTIONS";class un{get mapId(){return this._mapId}set mapId(t){t!==this._mapId&&this.clear(),this._mapId=t}constructor(t,e,i,n){this.converter=t,this.api=e,this.cache=i,this._mapId=n,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,e;return qi(null!==(e=null===(t=Gi.getState().session)||void 0===t?void 0:t.profile.roles)&&void 0!==e?e:[],"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 e;return null===(e=this.enrichedToc)||void 0===e?void 0:e.nodeByTocId[t]}async getPage(t){const e=await this.getEnrichedToc();return e.pages[t-1]||e.pages[0]}async getPageByTocId(t){const e=await this.getEnrichedToc();return e.pageByTocId[t]||e.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)))}getLink(t,e,i){const n=this.getNavigationData(t,e,i),r=this.getReaderLinkPrefix()+(n.prettyUrl?n.prettyUrl:`${n.mapId}/${n.tocId}`),o=new URL(r,this.api.tenantBaseUrl);return null!=n.page&&o.searchParams.set("page",`${n.page}`),n.prettyUrlDuplicated&&o.searchParams.set("tocId",n.tocId),null!=n.section&&o.searchParams.set("section",n.section),o.href}getNavigationData(t,e,i){var n,r;t=t||"root";const o=this.enrichedToc,s=null==o?void 0:o.pageByTocId[t],a=null==o?void 0:o.nodeByTocId[t],u=null==a?void 0:a.prettyUrl;return{mapId:this.mapId,tocId:t,topicTitle:null!==(n=null==a?void 0:a.title)&&void 0!==n?n:"",page:e&&s&&s.number!==e?e:void 0,prettyUrl:null!=u?u.replace(/^r\//,""):void 0,prettyUrlDuplicated:null!==(r=null==o?void 0:o.duplicatedPrettyUrls.has(null!=u?u:""))&&void 0!==r&&r,section:i}}async getAccurateNavigationData(t,e,i){return await this.getEnrichedToc(),this.getNavigationData(t,e,i)}getRatingSummary(){return this.cache.get("ratingSummary")}getMapRating(){return this.getRatingSummary().then((t=>null==t?void 0:t.publication))}getTopicRating(t){return this.getRatingSummary().then((e=>{var i;return e?{type:e.topics.type,rating:null===(i=e.topics)||void 0===i?void 0:i.ratings.find((e=>e.tocId===t))}:void 0}))}rateMap(t,e){return this.makeRateMapRequest(t,e).then((()=>this.clearRatingIfNecessary()))}unrateMap(){return this.makeUnrateMapRequest().then((()=>this.clearRatingIfNecessary()))}sendMapFeedback(t,e){return this.makeMapFeedbackRequest(t,e)}rateTopic(t,e,i){return this.makeRateTopicRequest(t,e,i).then((()=>this.clearRatingIfNecessary()))}unrateTopic(t){return this.makeUnrateTopicRequest(t).then((()=>this.clearRatingIfNecessary()))}async clearRatingIfNecessary(){const t=Gi.getState().session;(null==t?void 0:t.sessionAuthenticated)&&this.cache.clear("ratingSummary")}sendTopicFeedback(t,e,i){return this.makeTopicFeedbackRequest(t,e,i)}fontsStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.fonts)}themeStylesheet(){return this.api.makeAbsolute(this.api.endpoints.stylesheets.theme)}buildBreadcrumb(t){let e=this.getTocNodeNow(t),i=[{tocId:e.tocId,title:e.title}],n=this.getTocNodeNow(e.parentTocId);for(;n;)i.unshift({tocId:n.tocId,title:n.title}),n=this.getTocNodeNow(n.parentTocId);return i}}class cn extends un{static async build(t){return new cn(new Ai,await zi.await(),new n,t)}fetchMap(t){return this.api.getMap(t)}fetchMapRating(t){return this.api.getMapRating(t)}fetchPages(t){return this.api.getPages(t)}fetchTopicHTMLContent(t){return this.api.getTopicHTMLContent(this.mapId,t.contentId,"DESIGNED_READER")}fetchTopicMetadata(t){return this.api.getTopic(this.mapId,t.contentId)}makeMapFeedbackRequest(t,e){return this.api.sendMapFeedback(this.mapId,t,e)}makeRateMapRequest(t,e){return this.api.rateMap(this.mapId,t,e)}makeRateTopicRequest(t,e,i){return this.api.rateTopic(this.mapId,t,e,i)}makeTopicFeedbackRequest(t,e,i){return this.api.sendTopicFeedback(this.mapId,t,e,i)}makeUnrateMapRequest(){return this.api.unrateMap(this.mapId)}makeUnrateTopicRequest(t){return this.api.unrateTopic(this.mapId,t)}getReaderLinkPrefix(){return"r/"}isFeatureAccessible(t){return!0}}class ln{static build(t,e){return new ln((t=>gi.get({name:"ft-reader-"+t,initialState:{mapId:void 0,visibleTopics:[]},reducers:xi}))(t.trim()||"context"),null!=e?e:cn.build)}constructor(t,e){this.store=t,this.reloadDebouncer=new r(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.setMapId(t),this.service&&(this.service.mapId=t),await this.reload())}setVisibleTopics(t){this.store.actions.setVisibleTopics(t)}async awaitService(){for(;null==this.service;)await u(5);return this.service}async navigateToTopic(t,e,i){const n=await this.awaitService(),r=await(null!=i?n.getPage(i):n.getPageByTocId(null!=t?t:"root"));this.store.actions.setCurrentPage(r),this.store.actions.setScrollTarget({tocId:this.resolveValidNonRootTocId(t,r),section:e})}resolveValidNonRootTocId(t,e){var i,n,r;let o=null!==(i="root"===t?void 0:t)&&void 0!==i?i:e.rootTocId;return e.topics.includes(o)?o:null!==(r=null!==(n=e.topics[0])&&void 0!==n?n:e.hiddenTopics[0])&&void 0!==r?r:"root"}async navigateToPage(t){const e=await this.awaitService();let i=await e.getPage(t);this.store.actions.setCurrentPage(i)}scrollDone(){this.store.actions.setScrollTarget({})}async reload(){var t,e;this.store.actions.setConfiguration(void 0),this.store.actions.setMap(void 0),this.store.actions.setToc(void 0),this.store.actions.setPagesToc(void 0),this.store.actions.setCurrentPage(void 0),null===(t=this.service)||void 0===t||t.clear(),(null===(e=this.service)||void 0===e?void 0:e.mapId)&&await this.reloadDebouncer.run((()=>this.fetchData()))}async fetchData(){var t,i,n,r,o;try{await Promise.all([null===(t=this.service)||void 0===t?void 0:t.getConfiguration().then((t=>this.store.actions.setConfiguration(t))),null===(i=this.service)||void 0===i?void 0:i.getMap().then((t=>this.store.actions.setMap(t))),null===(n=this.service)||void 0===n?void 0:n.getToc().then((t=>this.store.actions.setToc(t))),null===(r=this.service)||void 0===r?void 0:r.getPagesToc().then((t=>this.store.actions.setPagesToc(t))),null===(o=this.service)||void 0===o?void 0:o.getPaginationConfiguration().then((t=>this.store.actions.setPaginationConfiguration(t)))])}catch(t){!this.errorHandler||t instanceof e||this.errorHandler(t)}}}const hn=w`
|
|
85
85
|
`;class fn extends CustomEvent{constructor(t,e){super("ft-reader-map-loaded",{detail:{map:t,toc:e}})}}class dn extends CustomEvent{constructor(t,e){super("ft-reader-visible-topics-change",{detail:{visibleTopics:e}})}}class vn extends CustomEvent{constructor(t){super("ft-reader-navigation-done",{detail:t})}}class pn extends CustomEvent{constructor(t){super("ft-reader-load-error",{detail:t})}}class bn extends Event{constructor(){super("ft-reader-map-not-found")}}class yn extends Event{constructor(){super("ft-reader-map-unauthorized")}}var wn=function(t,e,i,n){for(var r,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o<3?r(s):o>3?r(e,i,s):r(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s};class mn extends Mt{constructor(){super(),this.visibleTopics=[],this.scrollToTargetDebouncer=new r(5),this.navigationDebouncer=new r(50),this.addStore(Gi)}render(){return J`
|
|
86
86
|
${this.importStyleIfNeeded()}
|
|
87
87
|
<slot @register-ft-reader-component=${this.registerComponent}></slot>
|
|
@@ -89,4 +89,4 @@ var ft,dt;let vt=class extends N{constructor(){super(...arguments),this.renderOp
|
|
|
89
89
|
<style>
|
|
90
90
|
@import "${i}"
|
|
91
91
|
</style>
|
|
92
|
-
`}get stateManager(){return null==this._stateManager&&(this._stateManager=ln.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 e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),document.head.append(t)}}))}
|
|
92
|
+
`}get stateManager(){return null==this._stateManager&&(this._stateManager=ln.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 e=t.fontsStylesheet();if(e&&!window.location.href.startsWith(this.baseUrl)&&!document.querySelector(`head link[href="${e}"]`)){const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",e),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),["tocId","section","page","mapId"].some((e=>t.has(e)))&&this.mapId&&this.navigateToTarget()}contentAvailableCallback(t){var e;if(super.contentAvailableCallback(t),(t.has("map")||t.has("toc"))&&this.map&&this.toc&&this.dispatchEvent(new fn(this.map,this.toc)),t.has("scrollTarget")&&null==(null===(e=this.scrollTarget)||void 0===e?void 0:e.tocId)){const e=t.get("scrollTarget");null!=(null==e?void 0:e.tocId)&&this.scrollToTargetDebouncer.run((()=>{var t;return this.stateManager.service.getAccurateNavigationData(e.tocId,null===(t=this.currentPage)||void 0===t?void 0:t.number,e.section).then((t=>this.dispatchEvent(new vn(t))))}))}t.has("visibleTopics")&&Promise.all(this.visibleTopics.map((t=>{var e;return this.stateManager.service.getAccurateNavigationData(t,null===(e=this.currentPage)||void 0===e?void 0:e.number)}))).then((t=>{let e=t.filter((t=>null!=t&&""!==t.topicTitle)).map((t=>{var e;return{tocId:t.tocId,title:t.topicTitle,page:t.page,prettyUrl:t.prettyUrl,prettyUrlDuplicated:t.prettyUrlDuplicated,breadcrumb:null===(e=this.stateManager.service)||void 0===e?void 0:e.buildBreadcrumb(t.tocId)}}));this.dispatchEvent(new dn(this.map,e))}))}async reload(){await this.stateManager.reload(),this.navigateToTarget()}navigateToTarget(){this.navigationDebouncer.run((()=>{null!=this.tocId?this.stateManager.navigateToTopic(this.tocId,this.section,this.page):null!=this.page&&this.stateManager.navigateToPage(this.page)}))}registerComponent(t){t.stopPropagation();const e=t.composedPath()[0];this.register(e)}register(t){t.setReaderStateManager(this.stateManager)}handleLoadError(t){const e=t;404===e.status?this.dispatchEvent(new bn):401===e.status?this.dispatchEvent(new yn):this.dispatchEvent(new pn(t))}reloadBookmarks(){sn.reloadBookmarks()}}var gn;mn.styles=hn,wn([Ei({store:Gi.name})],mn.prototype,"baseUrl",void 0),wn([s()],mn.prototype,"mapId",void 0),wn([s()],mn.prototype,"tocId",void 0),wn([s()],mn.prototype,"section",void 0),wn([s({type:Number,converter:{fromAttribute:t=>+(null!=t?t:"NaN")>0?+t:gn}})],mn.prototype,"page",void 0),wn([Ei({store:"reader"})],mn.prototype,"map",void 0),wn([Ei({store:"reader"})],mn.prototype,"toc",void 0),wn([Ei({store:"reader"})],mn.prototype,"visibleTopics",void 0),wn([Ei({store:"reader"})],mn.prototype,"currentPage",void 0),wn([Ei({store:"reader"})],mn.prototype,"scrollTarget",void 0),wn([s({attribute:!1})],mn.prototype,"readerServiceProvider",void 0),l("ft-reader-context")(mn),t.FtOfficialReaderService=cn,t.FtReaderContext=mn,t.FtReaderContextCssVariables={},t.FtReaderConverter=Ai,t.FtReaderService=un,t.LoadErrorEvent=pn,t.MapLoadedEvent=fn,t.NavigationDoneEvent=vn,t.NotFoundErrorEvent=bn,t.UnauthorizedErrorEvent=yn,t.VisibleTopicsChangeEvent=dn,t.styles=hn}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-context",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.57",
|
|
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.0.
|
|
23
|
-
"@fluid-topics/ft-wc-utils": "1.0.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.0.57",
|
|
23
|
+
"@fluid-topics/ft-wc-utils": "1.0.57",
|
|
24
24
|
"@reduxjs/toolkit": "^1.6.2",
|
|
25
25
|
"lit": "2.7.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluid-topics/public-api": "1.0.45"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "f4480503246fb16f02f9e0265e15b7e53e09a23a"
|
|
31
31
|
}
|