@fluid-topics/ft-reader-attachments 1.1.39 → 1.1.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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>
|
|
@@ -351,14 +351,14 @@ let we=class extends Dt{constructor(){super(...arguments),this.renderOptions={ho
|
|
|
351
351
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
352
352
|
*/const{D:pi}=bt,hi=()=>document.createComment(""),di=(t,e,o)=>{const r=t._$AA.parentNode,i=void 0===e?t._$AB:e._$AA;if(void 0===o){const e=r.insertBefore(hi(),i),n=r.insertBefore(hi(),i);o=new pi(e,n,t,t.options)}else{const e=o._$AB.nextSibling,n=o._$AM,a=n!==t;if(a){let e;o._$AQ?.(t),o._$AM=t,void 0!==o._$AP&&(e=t._$AU)!==n._$AU&&o._$AP(e)}if(e!==i||a){let t=o._$AA;for(;t!==e;){const e=t.nextSibling;r.insertBefore(t,i),t=e}}}return o},ui=(t,e,o=t)=>(t._$AI(e,o),t),yi={},gi=t=>{t._$AP?.(!1,!0);let e=t._$AA;const o=t._$AB.nextSibling;for(;e!==o;){const t=e.nextSibling;e.remove(),e=t}},bi=(t,e,o)=>{const r=new Map;for(let i=e;i<=o;i++)r.set(t[i],i);return r},mi=li(class extends fi{constructor(t){if(super(t),t.type!==ci)throw Error("repeat() can only be used in text expressions")}ht(t,e,o){let r;void 0===o?o=e:void 0!==e&&(r=e);const i=[],n=[];let a=0;for(const e of t)i[a]=r?r(e,a):a,n[a]=o(e,a),a++;return{values:n,keys:i}}render(t,e,o){return this.ht(t,e,o).values}update(t,[e,o,r]){const i=(t=>t._$AH)(t),{values:n,keys:a}=this.ht(e,o,r);if(!Array.isArray(i))return this.dt=a,n;const s=this.dt??=[],c=[];let l,f,p=0,h=i.length-1,d=0,u=n.length-1;for(;p<=h&&d<=u;)if(null===i[p])p++;else if(null===i[h])h--;else if(s[p]===a[d])c[d]=ui(i[p],n[d]),p++,d++;else if(s[h]===a[u])c[u]=ui(i[h],n[u]),h--,u--;else if(s[p]===a[u])c[u]=ui(i[p],n[u]),di(t,c[u+1],i[p]),p++,u--;else if(s[h]===a[d])c[d]=ui(i[h],n[d]),di(t,i[p],i[h]),h--,d++;else if(void 0===l&&(l=bi(a,d,u),f=bi(s,p,h)),l.has(s[p]))if(l.has(s[h])){const e=f.get(a[d]),o=void 0!==e?i[e]:null;if(null===o){const e=di(t,i[p]);ui(e,n[d]),c[d]=e}else c[d]=ui(o,n[d]),di(t,i[p],o),i[e]=null;d++}else gi(i[h]),h--;else gi(i[p]),p++;for(;d<=u;){const e=di(t,c[u+1]);ui(e,n[d]),c[d++]=e}for(;p<=h;){const t=i[p++];null!==t&&gi(t)}return this.dt=a,((t,e=yi)=>{t._$AH=e})(t,c),ot}}),vi=Ct`
|
|
353
353
|
`,xi=Ct`
|
|
354
|
-
`,Oi=Br.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}});
|
|
354
|
+
`,Oi=Br.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}});
|
|
355
355
|
/**
|
|
356
356
|
* @license
|
|
357
357
|
* Copyright 2017 Google LLC
|
|
358
358
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
359
|
-
*/class wi{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Oi.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static get(t){var e;return null!=t?wi.build(t):null!==(e=wi.API)&&void 0!==e?e:wi.API=wi.build()}static await(t){return new Promise((e=>{let o=wi.get(t);if(o)e(o);else{const r=Oi.subscribe((()=>{o=wi.get(t),o&&(r(),e(o))}))}}))}}class Si{constructor(t=!0,e){var o;this.overrideApi=e;let i=this.constructor;i.commonCache=null!==(o=i.commonCache)&&void 0!==o?o:new r,this.cache=t?i.commonCache:new r}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:wi.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:wi.await()}clearCache(){this.cache.clearAll()}}var Ni;const Ci=Symbol("clearAfterUnitTest");class Ei extends Si{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Ni]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=Oi.getState().uiLocale,Oi.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Oi.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 o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};$(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new De(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...o)}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 o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.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=>{return(e=0,new Promise((t=>setTimeout(t,e)))).then((()=>t())).catch((()=>null));var e})))}}Ni=Ci,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ei{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ei{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Ui=window.FluidTopicsI18nService,Ri=window.FluidTopicsCustomI18nService;var Ii=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class ki extends Me{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>wi.get(),this.cache=new r,this.cleanSessionDebouncer=new i}render(){return se`
|
|
359
|
+
*/class wi{static build(t){const{baseUrl:e,apiIntegrationIdentifier:o}=Oi.getState(),r=null!=t?t:o;if(e&&r&&window.fluidtopics)return new window.fluidtopics.FluidTopicsApi(e,r,!0)}static get(t){var e;return null!=t?wi.build(t):null!==(e=wi.API)&&void 0!==e?e:wi.API=wi.build()}static await(t){return new Promise((e=>{let o=wi.get(t);if(o)e(o);else{const r=Oi.subscribe((()=>{o=wi.get(t),o&&(r(),e(o))}))}}))}}class Si{constructor(t=!0,e){var o;this.overrideApi=e;let i=this.constructor;i.commonCache=null!==(o=i.commonCache)&&void 0!==o?o:new r,this.cache=t?i.commonCache:new r}get api(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:wi.get()}get awaitApi(){var t;return null!==(t=this.overrideApi)&&void 0!==t?t:wi.await()}clearCache(){this.cache.clearAll()}}var Ni;const Ci=Symbol("clearAfterUnitTest");class Ei extends Si{constructor(t){super(),this.messageContextProvider=t,this.defaultMessages={},this.listeners={},this.currentUiLocale="",this[Ni]=()=>{this.defaultMessages={},this.cache=new r,this.listeners={}},this.currentUiLocale=Oi.getState().uiLocale,Oi.subscribe((()=>this.clearWhenUiLocaleChanges()))}clearWhenUiLocaleChanges(){const{uiLocale:t}=Oi.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 o;if(t=t.toLowerCase(),Object.keys(e).length>0){const r={...null!==(o=this.defaultMessages[t])&&void 0!==o?o:{},...e};$(this.defaultMessages[t],r)||(this.defaultMessages[t]=r,await this.notify(t))}await this.fetchContext(t)}resolveMessage(t,e,...o){var r,i,n;t=t.toLowerCase(),this.fetchContext(t);const a=null!==(i=null===(r=this.cache.getNow(t))||void 0===r?void 0:r.messages)&&void 0!==i?i:{};return new De(null!==(n=this.defaultMessages[t])&&void 0!==n?n:{},a).resolve(e,...o)}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 o;return t=t.toLowerCase(),this.listeners[t]=null!==(o=this.listeners[t])&&void 0!==o?o:new Set,this.listeners[t].add(e),()=>{var o;return null===(o=this.listeners[t])||void 0===o?void 0:o.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=>{return(e=0,new Promise((t=>setTimeout(t,e)))).then((()=>t())).catch((()=>null));var e})))}}Ni=Ci,null==window.FluidTopicsI18nService&&(window.FluidTopicsI18nService=new class extends Ei{constructor(){super((async(t,e)=>(await this.awaitApi).getFluidTopicsMessageContext(t,e)))}}),null==window.FluidTopicsCustomI18nService&&(window.FluidTopicsCustomI18nService=new class extends Ei{constructor(){super((async(t,e)=>(await this.awaitApi).getCustomMessageContext(t,e)))}});const Ui=window.FluidTopicsI18nService,Ri=window.FluidTopicsCustomI18nService;var Ii=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class ki extends Me{constructor(){super(...arguments),this.apiIntegrationIdentifier="ft-integration",this.uiLocale="en-US",this.editorMode=!1,this.noCustom=!1,this.openExternalDocumentInNewTab=!1,this.noCustomComponent=!1,this.withManualResources=!1,this.messageContexts=[],this.apiProvider=()=>wi.get(),this.cache=new r,this.cleanSessionDebouncer=new i}render(){return se`
|
|
360
360
|
<slot></slot>
|
|
361
|
-
`}update(t){super.update(t),t.has("baseUrl")&&(Oi.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Oi.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Oi.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Oi.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Oi.actions.noCustom(this.noCustom),t.has("editorMode")&&Oi.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Oi.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Oi.actions.session(this.session),t.has("availableUiLocales")&&Oi.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ui.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()))}}ki.elementDefinitions={},ki.styles=xi,Ii([R()],ki.prototype,"baseUrl",void 0),Ii([R()],ki.prototype,"apiIntegrationIdentifier",void 0),Ii([R()],ki.prototype,"uiLocale",void 0),Ii([K(null)],ki.prototype,"availableUiLocales",void 0),Ii([K(null)],ki.prototype,"metadataConfiguration",void 0),Ii([R({type:Boolean})],ki.prototype,"editorMode",void 0),Ii([R({type:Boolean})],ki.prototype,"noCustom",void 0),Ii([R({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],ki.prototype,"noCustomComponent",void 0),Ii([R({type:Boolean})],ki.prototype,"withManualResources",void 0),Ii([K([])],ki.prototype,"messageContexts",void 0),Ii([K(void 0)],ki.prototype,"session",void 0),Ii([R({type:Object})],ki.prototype,"apiProvider",void 0);class Wi extends Si{async listMySearches(){let t=Oi.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class $i extends Si{async listMyBookmarks(){let t=Oi.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Li=Br.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Oi.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new $i,this.savedSearchesService=new Wi,Oi.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Oi.getState();$(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(),Li.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Li.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Li.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 e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Li.actions.bookmarks(e)}}},L("ft-app-context")(ki);var Ki=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Ai=Symbol("i18nAttributes"),ji=Symbol("i18nProperties"),Fi=Symbol("i18nUnsubs");function Zi(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Ri:Ui}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Ai])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[ji])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Ai])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[ji])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[ji])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Ai])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Fi].has(t)||this[Fi].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Fi].forEach((t=>t())),this[Fi].clear()}}return e=Fi,Ki([R({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Mi extends(Zi(Me)){}class zi extends(Zi(Je)){}var Di=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Bi extends zi{constructor(){super(),this.editorMode=!1,this.addStore(Oi)}render(){return this.key&&this.context?se`
|
|
361
|
+
`}update(t){super.update(t),t.has("baseUrl")&&(Oi.actions.baseUrl(this.baseUrl),window.fluidTopicsBaseUrl=this.baseUrl),t.has("apiIntegrationIdentifier")&&Oi.actions.apiIntegrationIdentifier(this.apiIntegrationIdentifier),t.has("uiLocale")&&Oi.actions.uiLocale(this.uiLocale),t.has("metadataConfiguration")&&Oi.actions.metadataConfiguration(this.metadataConfiguration),t.has("noCustom")&&Oi.actions.noCustom(this.noCustom),t.has("editorMode")&&Oi.actions.editorMode(this.editorMode),t.has("noCustomComponent")&&Oi.actions.noCustomComponent(this.noCustomComponent),t.has("session")&&Oi.actions.session(this.session),t.has("availableUiLocales")&&Oi.actions.availableUiLocales(Array.isArray(this.availableUiLocales)?this.availableUiLocales:[]),t.has("messageContexts")&&null!=this.messageContexts&&this.messageContexts.forEach((t=>Ui.addContext(t))),t.has("openExternalDocumentInNewTab")&&Oi.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()))}}ki.elementDefinitions={},ki.styles=xi,Ii([R()],ki.prototype,"baseUrl",void 0),Ii([R()],ki.prototype,"apiIntegrationIdentifier",void 0),Ii([R()],ki.prototype,"uiLocale",void 0),Ii([K(null)],ki.prototype,"availableUiLocales",void 0),Ii([K(null)],ki.prototype,"metadataConfiguration",void 0),Ii([R({type:Boolean})],ki.prototype,"editorMode",void 0),Ii([R({type:Boolean})],ki.prototype,"noCustom",void 0),Ii([R({type:Boolean})],ki.prototype,"openExternalDocumentInNewTab",void 0),Ii([R({converter:{fromAttribute:t=>"false"!==t&&("true"===t||null!=t&&t)}})],ki.prototype,"noCustomComponent",void 0),Ii([R({type:Boolean})],ki.prototype,"withManualResources",void 0),Ii([K([])],ki.prototype,"messageContexts",void 0),Ii([K(void 0)],ki.prototype,"session",void 0),Ii([R({type:Object})],ki.prototype,"apiProvider",void 0);class Wi extends Si{async listMySearches(){let t=Oi.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-searches",(async()=>(await this.awaitApi).listMySearches(t.profile.userId)),3e5):[]}}class $i extends Si{async listMyBookmarks(){let t=Oi.getState().session;return(null==t?void 0:t.sessionAuthenticated)?this.cache.get("my-bookmarks",(async()=>(await this.awaitApi).listMyBookmarks(t.profile.userId)),3e5):[]}}const Li=Br.get({name:"ft-user-assets",initialState:{savedSearches:void 0,bookmarks:void 0}});new class{constructor(){this.currentSession=Oi.getState().session,this.bookmarksAreUsed=!1,this.bookmarksService=new $i,this.savedSearchesService=new Wi,Oi.subscribe((()=>this.reloadWhenUserSessionChanges()))}reloadWhenUserSessionChanges(){var t;const{session:e}=Oi.getState();$(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(),Li.actions.savedSearches(void 0)}clearMyBookmarks(){this.bookmarksService.clearCache(),Li.actions.bookmarks(void 0)}async reloadMySearches(){this.savedSearchesService.clearCache();const t=await this.savedSearchesService.listMySearches();Li.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 e=(null===(t=this.currentSession)||void 0===t?void 0:t.sessionAuthenticated)?await this.bookmarksService.listMyBookmarks():void 0;Li.actions.bookmarks(e)}}},L("ft-app-context")(ki);var Ki=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};const Ai=Symbol("i18nAttributes"),ji=Symbol("i18nProperties"),Fi=Symbol("i18nUnsubs");function Zi(t){var e;class o extends t{constructor(){super(...arguments),this.useCustomMessageContexts=!1,this[e]=new Map}get i18nService(){return this.useCustomMessageContexts?Ri:Ui}i18n(t,e,...o){var r;if("string"==typeof t)return this.i18nService.resolveMessage(t,e,...o);const i=null!==(r=t.args)&&void 0!==r?r:t.argsProvider?t.argsProvider(this):[];return this.i18nService.resolveMessage(t.context,t.key,...i)}onI18nUpdate(t){var e,o;null===(e=this[Ai])||void 0===e||e.forEach(((e,o)=>{var r;const i=this.getI18nAttributeValue(o);(null===(r=null==i?void 0:i.context)||void 0===r?void 0:r.toLowerCase())===t.toLowerCase()&&this.updateI18nAttributeMessage(o,i,e)})),null===(o=this[ji])||void 0===o||o.forEach(((e,o)=>{e.context.toLowerCase()===t.toLowerCase()&&(this[o]=this.i18n(e))})),setTimeout((()=>this.requestUpdate()),0)}updateI18nAttributeMessage(t,e,o){this[t]={...e,message:this.i18n({context:e.context,key:e.key,...o})}}update(t){var e,o;super.update(t),null===(e=this[Ai])||void 0===e||e.forEach(((e,o)=>{const r=this.getI18nAttributeValue(o);(null==r?void 0:r.context)&&r.key&&(t.has(o)||null!=e.argsProvider)&&(t.has(o)&&this.addI18nContext(r.context),this.updateI18nAttributeMessage(o,r,e))})),null===(o=this[ji])||void 0===o||o.forEach(((t,e)=>{null!=t.argsProvider&&(this[e]=this.i18n(t))}))}getI18nAttributeValue(t){return this[t]}connectedCallback(){var t,e,o,r;super.connectedCallback(),new Set([...null!==(e=null===(t=this[ji])||void 0===t?void 0:t.values())&&void 0!==e?e:[],...[...null!==(r=null===(o=this[Ai])||void 0===o?void 0:o.keys())&&void 0!==r?r:[]].map((t=>this.getI18nAttributeValue(t)))].map((t=>null==t?void 0:t.context))).forEach((t=>t&&this.addI18nMessages(t)))}addI18nMessages(t,e){t=t.toLowerCase(),this[Fi].has(t)||this[Fi].set(t,this.i18nService.subscribe(t,(()=>this.onI18nUpdate(t)))),this.i18nService.prepareContext(t,null!=e?e:{})}addI18nContext(t,e){this.addI18nMessages("string"==typeof t?t:t.name,e)}disconnectedCallback(){super.disconnectedCallback(),this[Fi].forEach((t=>t())),this[Fi].clear()}}return e=Fi,Ki([R({type:Boolean})],o.prototype,"useCustomMessageContexts",void 0),o}class Mi extends(Zi(Me)){}class zi extends(Zi(Je)){}var Di=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,s=t.length-1;s>=0;s--)(i=t[s])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Bi extends zi{constructor(){super(),this.editorMode=!1,this.addStore(Oi)}render(){return this.key&&this.context?se`
|
|
362
362
|
<span class="ft-i18n">
|
|
363
363
|
${this.i18n(this.context,this.key,...Array.isArray(this.args)?this.args:[])}
|
|
364
364
|
</span>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-reader-attachments",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.41",
|
|
4
4
|
"description": "Reader component to list map attachments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-app-context": "1.1.
|
|
23
|
-
"@fluid-topics/ft-i18n": "1.1.
|
|
24
|
-
"@fluid-topics/ft-icon": "1.1.
|
|
25
|
-
"@fluid-topics/ft-reader-context": "1.1.
|
|
26
|
-
"@fluid-topics/ft-ripple": "1.1.
|
|
27
|
-
"@fluid-topics/ft-typography": "1.1.
|
|
28
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-app-context": "1.1.41",
|
|
23
|
+
"@fluid-topics/ft-i18n": "1.1.41",
|
|
24
|
+
"@fluid-topics/ft-icon": "1.1.41",
|
|
25
|
+
"@fluid-topics/ft-reader-context": "1.1.41",
|
|
26
|
+
"@fluid-topics/ft-ripple": "1.1.41",
|
|
27
|
+
"@fluid-topics/ft-typography": "1.1.41",
|
|
28
|
+
"@fluid-topics/ft-wc-utils": "1.1.41",
|
|
29
29
|
"@fluid-topics/public-api": "1.0.60",
|
|
30
30
|
"lit": "3.1.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "9842020c30f172387107ab92ffa3d2c5a33edce6"
|
|
33
33
|
}
|