@fluid-topics/ft-reader-attachments 1.1.40 → 1.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ft-reader-attachments.js +1 -1
- package/build/ft-reader-attachments.light.js +2 -2
- package/build/ft-reader-attachments.min.js +218 -184
- package/build/{ft-reader-attachments.css.js → ft-reader-attachments.styles.js} +2 -2
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/package.json +9 -9
- /package/build/{ft-reader-attachments.css.d.ts → ft-reader-attachments.styles.d.ts} +0 -0
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
8
|
import { property, state } from "lit/decorators.js";
|
|
9
9
|
import { last, redux } from "@fluid-topics/ft-wc-utils";
|
|
10
|
-
import { styles } from "./ft-reader-attachments.
|
|
10
|
+
import { styles } from "./ft-reader-attachments.styles";
|
|
11
11
|
import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
|
|
12
12
|
import { repeat } from "lit/directives/repeat.js";
|
|
13
13
|
import { attachmentsMessages, defaultMessages } from "./DesignedReaderAttachmentsMessages";
|
|
@@ -227,9 +227,9 @@
|
|
|
227
227
|
}
|
|
228
228
|
`;var O;!function(t){t.FEEDBACK="FEEDBACK",t.RATING="RATING",t.PRINT="PRINT",t.BOOKMARK="BOOKMARK",t.COLLECTIONS="COLLECTIONS",t.PERSONAL_BOOKS="PERSONAL_BOOKS"}(O||(O={}));var N=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class v extends Event{constructor(){super("register-ft-reader-component",{bubbles:!0,composed:!0})}}const S=Symbol("registerInterval");class w extends(function(t){var o;class e extends t{constructor(){super(...arguments),this[o]=0}setReaderStateManager(t){this.clearStateManager(),this.stateManager=t,this.addStore(t.store,"reader")}clearStateManager(){this.stateManager&&(this.removeStore("reader"),this.stateManager=void 0)}get service(){var t;return null===(t=this.stateManager)||void 0===t?void 0:t.service}connectedCallback(){super.connectedCallback(),this[S]=window.setInterval((()=>this.tryToRegisterToContext()),50)}tryToRegisterToContext(){null!=this.stateManager?window.clearInterval(this[S]):this.dispatchEvent(new v)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return o=S,N([a.state()],e.prototype,"stateManager",void 0),e}(o.FtLitElementRedux)){}const C=e.css`
|
|
229
229
|
`,I=e.css`
|
|
230
|
-
`,U=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0}});class E{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=U.getState(),a=null!=t?t:e;if(o&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,a,!0)}static get(t){var o;return null!=t?E.build(t):null!==(o=E.API)&&void 0!==o?o:E.API=E.build()}static await(t){return new Promise((o=>{let e=E.get(t);if(e)o(e);else{const a=U.subscribe((()=>{e=E.get(t),e&&(a(),o(e))}))}}))}}class W{constructor(t=!0,e){var a;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(a=r.commonCache)&&void 0!==a?a:new o.CacheRegistry,this.cache=t?r.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:E.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:E.await()}clearCache(){this.cache.clearAll()}}var R;const k=Symbol("clearAfterUnitTest");class L extends W{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[R]=()=>{this.defaultMessages={},this.cache=new o.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 o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var a;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},...e};o.deepEqual(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...a){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...a)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>o.delay(0).then((()=>t())).catch((()=>null)))))}}R=k,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const $=window.FluidTopicsI18nService,K=window.FluidTopicsCustomI18nService;var Z=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class z extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>E.get(),this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
|
|
230
|
+
`,U=o.FtReduxStore.get({name:"ft-app-info",reducers:{},initialState:{baseUrl:void 0,apiIntegrationIdentifier:void 0,uiLocale:document.documentElement.lang||"en-US",availableUiLocales:[],metadataConfiguration:void 0,editorMode:!1,noCustom:!1,noCustomComponent:!1,session:void 0,openExternalDocumentInNewTab:!1}});class E{static build(t){const{baseUrl:o,apiIntegrationIdentifier:e}=U.getState(),a=null!=t?t:e;if(o&&a&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(o,a,!0)}static get(t){var o;return null!=t?E.build(t):null!==(o=E.API)&&void 0!==o?o:E.API=E.build()}static await(t){return new Promise((o=>{let e=E.get(t);if(e)o(e);else{const a=U.subscribe((()=>{e=E.get(t),e&&(a(),o(e))}))}}))}}class W{constructor(t=!0,e){var a;this.overrideApi=e;let r=this.constructor;r.commonCache=null!==(a=r.commonCache)&&void 0!==a?a:new o.CacheRegistry,this.cache=t?r.commonCache:new o.CacheRegistry}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:E.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:E.await()}clearCache(){this.cache.clearAll()}}var R;const k=Symbol("clearAfterUnitTest");class L extends W{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[R]=()=>{this.defaultMessages={},this.cache=new o.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 o=t.name.toLowerCase();this.cache.setFinal(o,t),this.notify(o)}getAllContexts(){return this.cache.resolvedValues()}async prepareContext(t,e){var a;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(a=this.defaultMessages[t])&&void 0!==a?a:{},...e};o.deepEqual(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...a){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const l=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new o.ParametrizedLabelResolver(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},l).resolve(e,...a)}async fetchContext(t){if(!this.cache.has(t))try{await this.cache.get(t,(()=>this.messageContextProvider(this.currentUiLocale,t))),await this.notify(t)}catch(t){console.error(t)}}subscribe(t,o){var e;return t=t.toLowerCase(),this.listeners[t]=null!==(e=this.listeners[t])&&void 0!==e?e:new Set,this.listeners[t].add(o),()=>{var e;return null===(e=this.listeners[t])||void 0===e?void 0:e.delete(o)}}async notifyAll(){await Promise.all(Object.keys(this.listeners).map((t=>this.notify(t))))}async notify(t){null!=this.listeners[t]&&await Promise.all([...this.listeners[t].values()].map((t=>o.delay(0).then((()=>t())).catch((()=>null)))))}}R=k,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getFluidTopicsMessageContext(t,o)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends L{constructor(){super((async(t,o)=>(await this.awaitApi).getCustomMessageContext(t,o)))}});const $=window.FluidTopicsI18nService,K=window.FluidTopicsCustomI18nService;var Z=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class z extends o.FtLitElement{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>E.get(),this.cache=new o.CacheRegistry,this.cleanSessionDebouncer=new o.Debouncer}render(){return e.html`
|
|
231
231
|
<slot></slot>
|
|
232
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(U.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&U.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&U.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&U.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&U.actions.noCustom(this.noCustom),t.has("editorMode")&&U.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&U.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&U.actions.session(this.session),t.has("availableUiLocales")&&U.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>$.addContext(t))),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}z.elementDefinitions={},z.styles=I,Z([a.property()],z.prototype,"baseUrl",void 0),Z([a.property()],z.prototype,"apiIntegrationIdentifier",void 0),Z([a.property()],z.prototype,"uiLocale",void 0),Z([o.jsonProperty(null)],z.prototype,"availableUiLocales",void 0),Z([o.jsonProperty(null)],z.prototype,"metadataConfiguration",void 0),Z([a.property({type:Boolean})],z.prototype,"editorMode",void 0),Z([a.property({type:Boolean})],z.prototype,"noCustom",void 0),Z([a.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],z.prototype,"noCustomComponent",void 0),Z([a.property({type:Boolean})],z.prototype,"withManualResources",void 0),Z([o.jsonProperty([])],z.prototype,"messageContexts",void 0),Z([o.jsonProperty(void 0)],z.prototype,"session",void 0),Z([a.property({type:Object})],z.prototype,"apiProvider",void 0);class B extends W{async listMySearches(){let t=U.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class F extends W{async listMyBookmarks(){let t=U.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const D=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=U.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new F,this.savedSearchesService=new B,U.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=U.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),D.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),D.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();D.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;D.actions.bookmarks(o)}}},o.customElement("ft-app-context")(z);var A=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};const H=Symbol("i18nAttributes"),G=Symbol("i18nProperties"),M=Symbol("i18nUnsubs");function j(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?K:$}i18n(t,o,...e){var a;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);const r=null!==(a=t.args)&&void 0!==a?a:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var o,e;null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{var a;const r=this.getI18nAttributeValue(e);(null===(a=null==r?void 0:r.context)||void 0===a?void 0:a.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,r,o)})),null===(e=this[G])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{const a=this.getI18nAttributeValue(e);(null==a?void 0:a.context)&&a.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(a.context),this.updateI18nAttributeMessage(e,a,o))})),null===(e=this[G])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,a;super.connectedCallback(),new Set([...null!==(o=null===(t=this[G])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(a=null===(e=this[H])||void 0===e?void 0:e.keys())&&void 0!==a?a:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[M].has(t)||this[M].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[M].forEach((t=>t())),this[M].clear()}}return o=M,A([a.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class P extends(j(o.FtLitElement)){}class T extends(j(o.FtLitElementRedux)){}var _=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Y extends T{constructor(){super(),this.editorMode=!1,this.addStore(U)}render(){return this.key&&this.context?e.html`
|
|
232
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(U.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&U.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&U.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&U.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&U.actions.noCustom(this.noCustom),t.has("editorMode")&&U.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&U.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&U.actions.session(this.session),t.has("availableUiLocales")&&U.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>$.addContext(t))),t.has("openExternalDocumentInNewTab")&&U.actions.openExternalDocumentInNewTab(this.openExternalDocumentInNewTab),setTimeout((()=>this.updateIfNeeded()))}async updateIfNeeded(){!this.withManualResources&&this.apiProvider()&&(null==this.session&&this.updateSession(),null==this.availableUiLocales&&this.updateUiLocales(),null==this.metadataConfiguration&&this.updateMetadataConfiguration())}async updateSession(){this.session=await this.cache.get("session",(async()=>{const t=await this.apiProvider().getCurrentSession();return t.idleTimeoutInMillis>0&&this.cleanSessionDebouncer.run((()=>{this.cache.clear("session"),this.session=void 0}),t.idleTimeoutInMillis),t}))}async updateUiLocales(){this.availableUiLocales=await this.cache.get("availableUiLocales",(()=>this.apiProvider().getAvailableUiLocales()))}async updateMetadataConfiguration(){this.metadataConfiguration=await this.cache.get("metadataConfiguration",(()=>this.apiProvider().getMetadataConfiguration()))}}z.elementDefinitions={},z.styles=I,Z([a.property()],z.prototype,"baseUrl",void 0),Z([a.property()],z.prototype,"apiIntegrationIdentifier",void 0),Z([a.property()],z.prototype,"uiLocale",void 0),Z([o.jsonProperty(null)],z.prototype,"availableUiLocales",void 0),Z([o.jsonProperty(null)],z.prototype,"metadataConfiguration",void 0),Z([a.property({type:Boolean})],z.prototype,"editorMode",void 0),Z([a.property({type:Boolean})],z.prototype,"noCustom",void 0),Z([a.property({type:Boolean})],z.prototype,"openExternalDocumentInNewTab",void 0),Z([a.property({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],z.prototype,"noCustomComponent",void 0),Z([a.property({type:Boolean})],z.prototype,"withManualResources",void 0),Z([o.jsonProperty([])],z.prototype,"messageContexts",void 0),Z([o.jsonProperty(void 0)],z.prototype,"session",void 0),Z([a.property({type:Object})],z.prototype,"apiProvider",void 0);class B extends W{async listMySearches(){let t=U.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class F extends W{async listMyBookmarks(){let t=U.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const D=o.FtReduxStore.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=U.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new F,this.savedSearchesService=new B,U.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=U.getState();o.deepEqual(null===(t=this.currentSession)||void 0===t?void 0:t.profile,null==e?void 0:e.profile)||(this.currentSession=e,this.clearMySearches(),this.reloadBookmarks())}clear(){this.clearMySearches(),this.clearMyBookmarks()}clearMySearches(){this.savedSearchesService.clearCache(),D.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),D.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();D.actions.savedSearches(t)}async reloadBookmarks(){this.bookmarksService.clearCache(),await this.updateBookmarksIfUsed()}async registerBookmarkComponent(){this.bookmarksAreUsed=!0,await this.updateBookmarksIfUsed()}async updateBookmarksIfUsed(){var t;if(this.bookmarksAreUsed){const o=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;D.actions.bookmarks(o)}}},o.customElement("ft-app-context")(z);var A=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};const H=Symbol("i18nAttributes"),G=Symbol("i18nProperties"),M=Symbol("i18nUnsubs");function j(t){var o;class e extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[o]=new Map}get i18nService(){return this.useCustomMessageContexts?K:$}i18n(t,o,...e){var a;if("string"==typeof t)return this.i18nService.resolveMessage(t,o,...e);const r=null!==(a=t.args)&&void 0!==a?a:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...r)}onI18nUpdate(t){var o,e;null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{var a;const r=this.getI18nAttributeValue(e);(null===(a=null==r?void 0:r.context)||void 0===a?void 0:a.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(e,r,o)})),null===(e=this[G])||void 0===e||e.forEach(((o,e)=>{o.context.toLowerCase()===t.toLowerCase()&&(this[e]=this.i18n(o))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,o,e){this[t]={...o,message:this.i18n({context:o.context,key:o.key,...e})}}update(t){var o,e;super.update(t),null===(o=this[H])||void 0===o||o.forEach(((o,e)=>{const a=this.getI18nAttributeValue(e);(null==a?void 0:a.context)&&a.key&&(t.has(e)||null!=o.argsProvider)&&(t.has(e)&&this.addI18nContext(a.context),this.updateI18nAttributeMessage(e,a,o))})),null===(e=this[G])||void 0===e||e.forEach(((t,o)=>{null!=t.argsProvider&&(this[o]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,o,e,a;super.connectedCallback(),new Set([...null!==(o=null===(t=this[G])||void 0===t?void 0:t.values())&&void 0!==o?o:[],...[...null!==(a=null===(e=this[H])||void 0===e?void 0:e.keys())&&void 0!==a?a:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,o){t=t.toLowerCase(),this[M].has(t)||this[M].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=o?o:{})}addI18nContext(t,o){this.addI18nMessages("string"==typeof t?t:t.name,o)}disconnectedCallback(){super.disconnectedCallback(),this[M].forEach((t=>t())),this[M].clear()}}return o=M,A([a.property({type:Boolean})],e.prototype,"useCustomMessageContexts",void 0),e}class P extends(j(o.FtLitElement)){}class T extends(j(o.FtLitElementRedux)){}var _=function(t,o,e,a){for(var r,i=arguments.length,n=i<3?o:null===a?a=Object.getOwnPropertyDescriptor(o,e):a,l=t.length-1;l>=0;l--)(r=t[l])&&(n=(i<3?r(n):i>3?r(o,e,n):r(o,e))||n);return i>3&&n&&Object.defineProperty(o,e,n),n};class Y extends T{constructor(){super(),this.editorMode=!1,this.addStore(U)}render(){return this.key&&this.context?e.html`
|
|
233
233
|
<span class="ft-i18n">
|
|
234
234
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
235
235
|
</span>
|