@fluid-topics/ft-reader-metadata 1.1.28 → 1.1.30

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.
@@ -22,7 +22,7 @@ export declare class FtReaderMetadata extends FtReaderComponent implements FtRea
22
22
  private hideIfEmpty;
23
23
  private get valueText();
24
24
  private get tooltipText();
25
- private addTopicPivotCommand;
25
+ private addTopicPivotParam;
26
26
  private setRelatives;
27
27
  protected update(props: PropertyValues): void;
28
28
  }
@@ -73,9 +73,9 @@ class FtReaderMetadata extends FtReaderComponent {
73
73
  }
74
74
  renderRelativeItem(result, metadata) {
75
75
  return html `
76
- <a href=${getResultUrl(result)} @click=${(e) => this.addTopicPivotCommand(e, result)}>
76
+ <a href=${getResultUrl(result)} @click=${(e) => this.addTopicPivotParam(e, result)}>
77
77
  <ft-ripple></ft-ripple>
78
- <ft-floating-menu-item value="${metadata.value}" notFocusable="true">
78
+ <ft-floating-menu-item value="${metadata.value}" notFocusable>
79
79
  ${this.renderRelativeItemValue(metadata.value, metadata.displayValue)}
80
80
  </ft-floating-menu-item>
81
81
  </a>
@@ -105,17 +105,26 @@ class FtReaderMetadata extends FtReaderComponent {
105
105
  var _a, _b;
106
106
  return this.metadata ? `${(_b = (_a = this.metadata) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : this.metadata.key}: ${this.valueText}` : "";
107
107
  }
108
- addTopicPivotCommand(e, result) {
108
+ addTopicPivotParam(e, result) {
109
109
  var _a, _b;
110
110
  const currentTocId = this.stateManager.store.getState().visibleTopics[0];
111
- if (!e.ctrlKey && !e.metaKey && currentTocId) {
111
+ if (currentTocId && result.type == "MAP") {
112
112
  e.stopPropagation();
113
113
  e.preventDefault();
114
114
  const tocNode = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getTocNodeNow(currentTocId);
115
115
  (_b = this.service) === null || _b === void 0 ? void 0 : _b.getTopicInfo(tocNode).then((topicInfo) => {
116
- var _a, _b;
117
116
  const topicPivotMetadataValue = topicInfo === null || topicInfo === void 0 ? void 0 : topicInfo.metadata.find((metadata) => metadata.key == this.relativeTopicPivotMetadata);
118
- (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.navigateToRelativeTopicIfFound((_b = result.map) === null || _b === void 0 ? void 0 : _b.mapId, topicPivotMetadataValue);
117
+ let url = new URL(getResultUrl(result));
118
+ if (topicPivotMetadataValue) {
119
+ topicPivotMetadataValue.values.forEach(value => url.searchParams.append("topicPivot", value));
120
+ }
121
+ const link = document.createElement("a");
122
+ link.href = url.toString();
123
+ if (e.ctrlKey || e.metaKey) {
124
+ link.target = "_blank";
125
+ }
126
+ this.append(link);
127
+ link.click();
119
128
  });
120
129
  }
121
130
  }
@@ -1103,7 +1103,7 @@ const V=Symbol.for(""),X=t=>{if(t?.r===V)return t?._$litStatic$},q=t=>({_$litSta
1103
1103
  <slot></slot>
1104
1104
  </ft-typography>
1105
1105
  </div>
1106
- `}}var _i,Mi,ji,Yi,Vi,Xi,qi,Ji,Qi,tr,or,er,ir,rr,nr,ar,lr,cr;Gi.elementDefinitions={"ft-typography":vo},Gi.styles=Pi,o.customElement("ft-floating-menu")(Fi),o.customElement("ftds-floating-menu")(Ti),o.customElement("ft-floating-menu-item")(Zi),o.customElement("ft-floating-menu-label")(Gi),function(t){!function(o){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var i=["[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&&i.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(t){this.map={},t instanceof c?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function s(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function f(t){var o=new FileReader,e=p(o);return o.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(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=s(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?s(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,o,e,i=s(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,o=new FileReader,e=p(o),o.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),i=0;i<o.length;i++)e[i]=String.fromCharCode(o[i]);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(y)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[n(t)]},c.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},c.prototype.set=function(t,o){this.map[n(t)]=a(o)},c.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),l(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),l(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),l(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function u(t,o){var e,i,r=(o=o||{}).body;if(t instanceof u){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new c(o.headers)),this.method=(e=o.method||this.method||"GET",i=e.toUpperCase(),g.indexOf(i)>-1?i:e),this.mode=o.mode||this.mode||null,this.signal=o.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 y(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),i=e.shift().replace(/\+/g," "),r=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(i),decodeURIComponent(r))}})),o}function b(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(t)}u.prototype.clone=function(){return new u(this,{body:this._bodyInit})},h.call(u.prototype),h.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function x(t,i){return new Promise((function(r,n){var a=new u(t,i);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function s(){l.abort()}l.onload=function(){var t,o,e={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),i=e.shift().trim();if(i){var r=e.join(":").trim();o.append(i,r)}})),o)};e.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL");var i="response"in l?l.response:l.responseText;r(new b(i,e))},l.onerror=function(){n(new TypeError("Network request failed"))},l.ontimeout=function(){n(new TypeError("Network request failed"))},l.onabort=function(){n(new o.DOMException("Aborted","AbortError"))},l.open(a.method,a.url,!0),"include"===a.credentials?l.withCredentials=!0:"omit"===a.credentials&&(l.withCredentials=!1),"responseType"in l&&e.blob&&(l.responseType="blob"),a.headers.forEach((function(t,o){l.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",s),l.onreadystatechange=function(){4===l.readyState&&a.signal.removeEventListener("abort",s)}),l.send(void 0===a._bodyInit?null:a._bodyInit)}))}x.polyfill=!0,t.fetch||(t.fetch=x,t.Headers=c,t.Request=u,t.Response=b),o.Headers=c,o.Request=u,o.Response=b,o.fetch=x,Object.defineProperty(o,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(_i||(_i={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Mi||(Mi={})),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.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Yi||(Yi={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Vi||(Vi={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(Xi||(Xi={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(qi||(qi={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Ji||(Ji={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Qi||(Qi={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(tr||(tr={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(or||(or={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(er||(er={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(ir||(ir={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(rr||(rr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(nr||(nr={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(ar||(ar={})),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"}(lr||(lr={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(cr||(cr={})),lr.PERSONAL_BOOK_SHARE_USER,lr.PERSONAL_BOOK_USER,lr.HTML_EXPORT_USER,lr.PERSONAL_BOOK_USER,lr.PDF_EXPORT_USER,lr.PERSONAL_BOOK_USER,lr.KHUB_ADMIN,lr.CONTENT_PUBLISHER,lr.ADMIN,lr.KHUB_ADMIN,lr.USERS_ADMIN,lr.PORTAL_ADMIN,lr.DEVELOPER,lr.BETA_USER,lr.DEBUG_USER;var sr=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class pr extends d{constructor(){super(...arguments),this.useForSwitchingToRelatives=!1,this.editorMode=!1,this.relatives=[]}setReaderStateManager(t){var o;super.setReaderStateManager(t),this.key&&this.useForSwitchingToRelatives&&t.registerMetadataForSwitchToRelatives(this.key),null===(o=this.stateManager)||void 0===o||o.store.eventBus.addEventListener("clustering-helper-created",this.setRelatives)}render(){return e.html`
1106
+ `}}var _i,Mi,ji,Yi,Vi,Xi,qi,Ji,Qi,tr,or,er,ir,rr,nr,ar,lr,cr;function sr(t){var o,e,i,r,n,a,l,c,s,p;if("EXTERNAL"===(null!==(r=null!==(e=null===(o=t.map)||void 0===o?void 0:o.openMode)&&void 0!==e?e:null===(i=t.topic)||void 0===i?void 0:i.openMode)&&void 0!==r?r:null===(n=t.document)||void 0===n?void 0:n.openMode))return null!==(s=null!==(l=null===(a=t.map)||void 0===a?void 0:a.originUrl)&&void 0!==l?l:null===(c=t.topic)||void 0===c?void 0:c.originUrl)&&void 0!==s?s:null===(p=t.document)||void 0===p?void 0:p.originUrl;switch(t.type){case nr.MAP:return t.map.readerUrl;case nr.DOCUMENT:return t.document.viewerUrl;case nr.TOPIC:return t.topic.readerUrl}return""}Gi.elementDefinitions={"ft-typography":vo},Gi.styles=Pi,o.customElement("ft-floating-menu")(Fi),o.customElement("ftds-floating-menu")(Ti),o.customElement("ft-floating-menu-item")(Zi),o.customElement("ft-floating-menu-label")(Gi),function(t){!function(o){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var i=["[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&&i.indexOf(Object.prototype.toString.call(t))>-1};function n(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var o={next:function(){var o=t.shift();return{done:void 0===o,value:o}}};return e.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(t){this.map={},t instanceof c?t.forEach((function(t,o){this.append(o,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(o){this.append(o,t[o])}),this)}function s(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(o,e){t.onload=function(){o(t.result)},t.onerror=function(){e(t.error)}}))}function f(t){var o=new FileReader,e=p(o);return o.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var o=new Uint8Array(t.byteLength);return o.set(new Uint8Array(t)),o.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){var o;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((o=t)&&DataView.prototype.isPrototypeOf(o))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||r(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=s(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?s(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,o,e,i=s(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,o=new FileReader,e=p(o),o.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var o=new Uint8Array(t),e=new Array(o.length),i=0;i<o.length;i++)e[i]=String.fromCharCode(o[i]);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(y)}),this.json=function(){return this.text().then(JSON.parse)},this}c.prototype.append=function(t,o){t=n(t),o=a(o);var e=this.map[t];this.map[t]=e?e+", "+o:o},c.prototype.delete=function(t){delete this.map[n(t)]},c.prototype.get=function(t){return t=n(t),this.has(t)?this.map[t]:null},c.prototype.has=function(t){return this.map.hasOwnProperty(n(t))},c.prototype.set=function(t,o){this.map[n(t)]=a(o)},c.prototype.forEach=function(t,o){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(o,this.map[e],e,this)},c.prototype.keys=function(){var t=[];return this.forEach((function(o,e){t.push(e)})),l(t)},c.prototype.values=function(){var t=[];return this.forEach((function(o){t.push(o)})),l(t)},c.prototype.entries=function(){var t=[];return this.forEach((function(o,e){t.push([e,o])})),l(t)},e.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var g=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function u(t,o){var e,i,r=(o=o||{}).body;if(t instanceof u){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,o.headers||(this.headers=new c(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=o.credentials||this.credentials||"same-origin",!o.headers&&this.headers||(this.headers=new c(o.headers)),this.method=(e=o.method||this.method||"GET",i=e.toUpperCase(),g.indexOf(i)>-1?i:e),this.mode=o.mode||this.mode||null,this.signal=o.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 y(t){var o=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),i=e.shift().replace(/\+/g," "),r=e.join("=").replace(/\+/g," ");o.append(decodeURIComponent(i),decodeURIComponent(r))}})),o}function b(t,o){o||(o={}),this.type="default",this.status=void 0===o.status?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(t)}u.prototype.clone=function(){return new u(this,{body:this._bodyInit})},h.call(u.prototype),h.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];b.redirect=function(t,o){if(-1===m.indexOf(o))throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:t}})},o.DOMException=t.DOMException;try{new o.DOMException}catch(t){o.DOMException=function(t,o){this.message=t,this.name=o;var e=Error(t);this.stack=e.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function x(t,i){return new Promise((function(r,n){var a=new u(t,i);if(a.signal&&a.signal.aborted)return n(new o.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function s(){l.abort()}l.onload=function(){var t,o,e={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",o=new c,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),i=e.shift().trim();if(i){var r=e.join(":").trim();o.append(i,r)}})),o)};e.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL");var i="response"in l?l.response:l.responseText;r(new b(i,e))},l.onerror=function(){n(new TypeError("Network request failed"))},l.ontimeout=function(){n(new TypeError("Network request failed"))},l.onabort=function(){n(new o.DOMException("Aborted","AbortError"))},l.open(a.method,a.url,!0),"include"===a.credentials?l.withCredentials=!0:"omit"===a.credentials&&(l.withCredentials=!1),"responseType"in l&&e.blob&&(l.responseType="blob"),a.headers.forEach((function(t,o){l.setRequestHeader(o,t)})),a.signal&&(a.signal.addEventListener("abort",s),l.onreadystatechange=function(){4===l.readyState&&a.signal.removeEventListener("abort",s)}),l.send(void 0===a._bodyInit?null:a._bodyInit)}))}x.polyfill=!0,t.fetch||(t.fetch=x,t.Headers=c,t.Request=u,t.Response=b),o.Headers=c,o.Request=u,o.Response=b,o.fetch=x,Object.defineProperty(o,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(_i||(_i={})),function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"}(Mi||(Mi={})),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.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"}(Yi||(Yi={})),function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"}(Vi||(Vi={})),function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"}(Xi||(Xi={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(qi||(qi={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(Ji||(Ji={})),function(t){t.ASC="ASC",t.DESC="DESC"}(Qi||(Qi={})),function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"}(tr||(tr={})),function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"}(or||(or={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"}(er||(er={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(ir||(ir={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(rr||(rr={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(nr||(nr={})),function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"}(ar||(ar={})),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"}(lr||(lr={})),function(t){t.VALID="VALID",t.INVALID="INVALID"}(cr||(cr={})),lr.PERSONAL_BOOK_SHARE_USER,lr.PERSONAL_BOOK_USER,lr.HTML_EXPORT_USER,lr.PERSONAL_BOOK_USER,lr.PDF_EXPORT_USER,lr.PERSONAL_BOOK_USER,lr.KHUB_ADMIN,lr.CONTENT_PUBLISHER,lr.ADMIN,lr.KHUB_ADMIN,lr.USERS_ADMIN,lr.PORTAL_ADMIN,lr.DEVELOPER,lr.BETA_USER,lr.DEBUG_USER;var pr=function(t,o,e,i){for(var r,n=arguments.length,a=n<3?o:null===i?i=Object.getOwnPropertyDescriptor(o,e):i,l=t.length-1;l>=0;l--)(r=t[l])&&(a=(n<3?r(a):n>3?r(o,e,a):r(o,e))||a);return n>3&&a&&Object.defineProperty(o,e,a),a};class fr extends d{constructor(){super(...arguments),this.useForSwitchingToRelatives=!1,this.editorMode=!1,this.relatives=[]}setReaderStateManager(t){var o;super.setReaderStateManager(t),this.key&&this.useForSwitchingToRelatives&&t.registerMetadataForSwitchToRelatives(this.key),null===(o=this.stateManager)||void 0===o||o.store.eventBus.addEventListener("clustering-helper-created",this.setRelatives)}render(){return e.html`
1107
1107
  <ft-tooltip text="${this.tooltipText}">
1108
1108
  ${this.useForSwitchingToRelatives&&this.metadata&&this.metadata.values.length>0?this.renderSwitchToRelatives():e.html`
1109
1109
  <ft-chip>
@@ -1123,9 +1123,9 @@ const V=Symbol.for(""),X=t=>{if(t?.r===V)return t?._$litStatic$},q=t=>({_$litSta
1123
1123
  </ft-floating-menu>
1124
1124
  </div>
1125
1125
  `}renderRelativeItem(t,o){return e.html`
1126
- <a href=${function(t){var o,e,i,r,n,a,l,c,s,p;if("EXTERNAL"===(null!==(r=null!==(e=null===(o=t.map)||void 0===o?void 0:o.openMode)&&void 0!==e?e:null===(i=t.topic)||void 0===i?void 0:i.openMode)&&void 0!==r?r:null===(n=t.document)||void 0===n?void 0:n.openMode))return null!==(s=null!==(l=null===(a=t.map)||void 0===a?void 0:a.originUrl)&&void 0!==l?l:null===(c=t.topic)||void 0===c?void 0:c.originUrl)&&void 0!==s?s:null===(p=t.document)||void 0===p?void 0:p.originUrl;switch(t.type){case nr.MAP:return t.map.readerUrl;case nr.DOCUMENT:return t.document.viewerUrl;case nr.TOPIC:return t.topic.readerUrl}return""}(t)} @click=${o=>this.addTopicPivotCommand(o,t)}>
1126
+ <a href=${sr(t)} @click=${o=>this.addTopicPivotParam(o,t)}>
1127
1127
  <ft-ripple></ft-ripple>
1128
- <ft-floating-menu-item value="${o.value}" notFocusable="true">
1128
+ <ft-floating-menu-item value="${o.value}" notFocusable>
1129
1129
  ${this.renderRelativeItemValue(o.value,o.displayValue)}
1130
1130
  </ft-floating-menu-item>
1131
1131
  </a>
@@ -1136,4 +1136,4 @@ const V=Symbol.for(""),X=t=>{if(t?.r===V)return t?._$litStatic$},q=t=>({_$litSta
1136
1136
  display: none !important;
1137
1137
  }
1138
1138
  </style>
1139
- `}get valueText(){var t,o;return null!==(o=null===(t=this.metadata)||void 0===t?void 0:t.values.join(", "))&&void 0!==o?o:""}get tooltipText(){var t,o;return this.metadata?`${null!==(o=null===(t=this.metadata)||void 0===t?void 0:t.label)&&void 0!==o?o:this.metadata.key}: ${this.valueText}`:""}addTopicPivotCommand(t,o){var e,i;const r=this.stateManager.store.getState().visibleTopics[0];if(!t.ctrlKey&&!t.metaKey&&r){t.stopPropagation(),t.preventDefault();const n=null===(e=this.service)||void 0===e?void 0:e.getTocNodeNow(r);null===(i=this.service)||void 0===i||i.getTopicInfo(n).then((t=>{var e,i;const r=null==t?void 0:t.metadata.find((t=>t.key==this.relativeTopicPivotMetadata));null===(e=this.stateManager)||void 0===e||e.navigateToRelativeTopicIfFound(null===(i=o.map)||void 0===i?void 0:i.mapId,r)}))}}setRelatives(){var t;this.metadata&&this.mapRelatives&&(this.relatives=this.stateManager.clusteringHelper.computeClustersItemsForMetadata(this.key,(null===(t=this.map)||void 0===t?void 0:t.lang)||"en"))}update(t){var o,e,i,r;super.update(t),(t.has("metadata")||t.has("mapRelatives"))&&this.setRelatives(),t.has("key")&&this.useForSwitchingToRelatives&&(t.get("key")&&(null===(o=this.stateManager)||void 0===o||o.unregisterMetadataForSwitchToRelatives(t.get("key"))),this.key&&(null===(e=this.stateManager)||void 0===e||e.registerMetadataForSwitchToRelatives(this.key))),t.has("useForSwitchingToRelatives")&&this.key&&(this.useForSwitchingToRelatives?null===(i=this.stateManager)||void 0===i||i.registerMetadataForSwitchToRelatives(this.key):null===(r=this.stateManager)||void 0===r||r.unregisterMetadataForSwitchToRelatives(this.key))}}pr.elementDefinitions={"ft-chip":wi,"ft-floating-menu":Fi,"ft-floating-menu-item":Zi,"ft-ripple":Ge,"ft-tooltip":ke},pr.styles=l,sr([i.property(),o.reduxReactive()],pr.prototype,"key",void 0),sr([i.property({type:Boolean})],pr.prototype,"useForSwitchingToRelatives",void 0),sr([i.property({attribute:!1})],pr.prototype,"editorMode",void 0),sr([o.redux({selector:(t,o)=>{var e,i;return null===(i=null===(e=t.map)||void 0===e?void 0:e.metadata)||void 0===i?void 0:i.find((t=>t.key===o.key))}})],pr.prototype,"metadata",void 0),sr([o.redux({selector:t=>t.relatives})],pr.prototype,"mapRelatives",void 0),sr([o.redux()],pr.prototype,"map",void 0),sr([o.redux({selector:t=>{var o;return null===(o=t.configuration)||void 0===o?void 0:o.relativeTopicPivotMetadata}})],pr.prototype,"relativeTopicPivotMetadata",void 0),sr([i.state()],pr.prototype,"relatives",void 0),o.customElement("ft-reader-metadata")(pr),t.FtReaderMetadata=pr,t.FtReaderMetadataCssVariables={},t.styles=l}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML,ftGlobals.litRepeat);
1139
+ `}get valueText(){var t,o;return null!==(o=null===(t=this.metadata)||void 0===t?void 0:t.values.join(", "))&&void 0!==o?o:""}get tooltipText(){var t,o;return this.metadata?`${null!==(o=null===(t=this.metadata)||void 0===t?void 0:t.label)&&void 0!==o?o:this.metadata.key}: ${this.valueText}`:""}addTopicPivotParam(t,o){var e,i;const r=this.stateManager.store.getState().visibleTopics[0];if(r&&"MAP"==o.type){t.stopPropagation(),t.preventDefault();const n=null===(e=this.service)||void 0===e?void 0:e.getTocNodeNow(r);null===(i=this.service)||void 0===i||i.getTopicInfo(n).then((e=>{const i=null==e?void 0:e.metadata.find((t=>t.key==this.relativeTopicPivotMetadata));let r=new URL(sr(o));i&&i.values.forEach((t=>r.searchParams.append("topicPivot",t)));const n=document.createElement("a");n.href=r.toString(),(t.ctrlKey||t.metaKey)&&(n.target="_blank"),this.append(n),n.click()}))}}setRelatives(){var t;this.metadata&&this.mapRelatives&&(this.relatives=this.stateManager.clusteringHelper.computeClustersItemsForMetadata(this.key,(null===(t=this.map)||void 0===t?void 0:t.lang)||"en"))}update(t){var o,e,i,r;super.update(t),(t.has("metadata")||t.has("mapRelatives"))&&this.setRelatives(),t.has("key")&&this.useForSwitchingToRelatives&&(t.get("key")&&(null===(o=this.stateManager)||void 0===o||o.unregisterMetadataForSwitchToRelatives(t.get("key"))),this.key&&(null===(e=this.stateManager)||void 0===e||e.registerMetadataForSwitchToRelatives(this.key))),t.has("useForSwitchingToRelatives")&&this.key&&(this.useForSwitchingToRelatives?null===(i=this.stateManager)||void 0===i||i.registerMetadataForSwitchToRelatives(this.key):null===(r=this.stateManager)||void 0===r||r.unregisterMetadataForSwitchToRelatives(this.key))}}fr.elementDefinitions={"ft-chip":wi,"ft-floating-menu":Fi,"ft-floating-menu-item":Zi,"ft-ripple":Ge,"ft-tooltip":ke},fr.styles=l,pr([i.property(),o.reduxReactive()],fr.prototype,"key",void 0),pr([i.property({type:Boolean})],fr.prototype,"useForSwitchingToRelatives",void 0),pr([i.property({attribute:!1})],fr.prototype,"editorMode",void 0),pr([o.redux({selector:(t,o)=>{var e,i;return null===(i=null===(e=t.map)||void 0===e?void 0:e.metadata)||void 0===i?void 0:i.find((t=>t.key===o.key))}})],fr.prototype,"metadata",void 0),pr([o.redux({selector:t=>t.relatives})],fr.prototype,"mapRelatives",void 0),pr([o.redux()],fr.prototype,"map",void 0),pr([o.redux({selector:t=>{var o;return null===(o=t.configuration)||void 0===o?void 0:o.relativeTopicPivotMetadata}})],fr.prototype,"relativeTopicPivotMetadata",void 0),pr([i.state()],fr.prototype,"relatives",void 0),o.customElement("ft-reader-metadata")(fr),t.FtReaderMetadata=fr,t.FtReaderMetadataCssVariables={},t.styles=l}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML,ftGlobals.litRepeat);