@fluid-topics/ft-search-result-metadata 1.2.37 → 1.2.39

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.
@@ -15,10 +15,11 @@ import { adminContext, defaultAdminMessages } from "./SearchResultMetadataAdminM
15
15
  import { FtTooltip } from "@fluid-topics/ft-tooltip";
16
16
  import { FtChip } from "@fluid-topics/ft-chip";
17
17
  import { FtFloatingMenu, FtFloatingMenuItem, FtFloatingMenuLabel } from "@fluid-topics/ft-floating-menu";
18
- import { getResultUrl, SearchResultClickEvent } from "@fluid-topics/ft-search-result-context/build/utils";
18
+ import { getResultUrl } from "@fluid-topics/ft-search-result-context/build/utils";
19
19
  import { repeat } from "lit/directives/repeat.js";
20
20
  import { context, defaultMessages } from "./SearchResultMetadataMessages";
21
21
  import { withDateFormat } from "@fluid-topics/ft-app-context/build/mixins/withDateFormat";
22
+ import { SearchResultClickEvent } from "@fluid-topics/ft-search-context/build/utils";
22
23
  class FtSearchResultMetadata extends withDateFormat(withI18n(FtSearchResultComponent)) {
23
24
  constructor() {
24
25
  super();
@@ -1497,7 +1497,7 @@ Also for action icons.`,s.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1497
1497
  <slot></slot>
1498
1498
  </ft-typography>
1499
1499
  </div>
1500
- `}};Ot.elementDefinitions={"ft-typography":se};Ot.styles=Ll;(0,Hr.customElement)("ft-floating-menu")(St);(0,Hr.customElement)("ftds-floating-menu")(fr);(0,Hr.customElement)("ft-floating-menu-item")(Le);(0,Hr.customElement)("ft-floating-menu-label")(Ot);function fp(e){var t,o,n,a,i;return((a=(o=(t=e.map)===null||t===void 0?void 0:t.openMode)!==null&&o!==void 0?o:(n=e.topic)===null||n===void 0?void 0:n.openMode)!==null&&a!==void 0?a:(i=e.document)===null||i===void 0?void 0:i.openMode)===Kr.EXTERNAL}function _l(e){var t,o,n,a,i;if(fp(e))return(a=(o=(t=e.map)===null||t===void 0?void 0:t.originUrl)!==null&&o!==void 0?o:(n=e.topic)===null||n===void 0?void 0:n.originUrl)!==null&&a!==void 0?a:(i=e.document)===null||i===void 0?void 0:i.originUrl;switch(e.type){case Wt.MAP:return e.map.readerUrl;case Wt.DOCUMENT:return e.document.viewerUrl;case Wt.TOPIC:return e.topic.readerUrl}return""}var Jo=class extends CustomEvent{constructor(t,o){super("ft-search-result-click",{detail:{result:t,rank:o},bubbles:!0,composed:!0})}};var Bl=b(kl());var en=Kt.build("designedSearchResultMetadata"),Dl={itemWithNoValueForClusterSwitch:"No value"};var be=function(e,t,o,n){var a=arguments.length,i=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(i=(a<3?c(i):a>3?c(t,o,i):c(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i},ee=class extends qi(Oo(bo)){constructor(){super(),this.useChip=!1,this.useAsClusterSwitch=!1,this.goToDocumentOnSwitch=!1,this.displayLabel=!1,this.hierarchicalValueTruncatingLevel=3,this.forceTooltip=!1,this.editorMode=!1,this.metadataDescriptors=[],this.clustersByValue={},this.displayCluster=!1,this.addStore(_),this.addI18nContext(en,Dl),this.addI18nContext(wr,is)}setResultStateManager(t){super.setResultStateManager(t),this.key&&this.useAsClusterSwitch&&t.registerMetadata(this.key)}render(){return ge.html`
1500
+ `}};Ot.elementDefinitions={"ft-typography":se};Ot.styles=Ll;(0,Hr.customElement)("ft-floating-menu")(St);(0,Hr.customElement)("ftds-floating-menu")(fr);(0,Hr.customElement)("ft-floating-menu-item")(Le);(0,Hr.customElement)("ft-floating-menu-label")(Ot);function fp(e){var t,o,n,a,i;return((a=(o=(t=e.map)===null||t===void 0?void 0:t.openMode)!==null&&o!==void 0?o:(n=e.topic)===null||n===void 0?void 0:n.openMode)!==null&&a!==void 0?a:(i=e.document)===null||i===void 0?void 0:i.openMode)===Kr.EXTERNAL}function _l(e){var t,o,n,a,i;if(fp(e))return(a=(o=(t=e.map)===null||t===void 0?void 0:t.originUrl)!==null&&o!==void 0?o:(n=e.topic)===null||n===void 0?void 0:n.originUrl)!==null&&a!==void 0?a:(i=e.document)===null||i===void 0?void 0:i.originUrl;switch(e.type){case Wt.MAP:return e.map.readerUrl;case Wt.DOCUMENT:return e.document.viewerUrl;case Wt.TOPIC:return e.topic.readerUrl}return""}var Bl=b(kl());var Jo=Kt.build("designedSearchResultMetadata"),Dl={itemWithNoValueForClusterSwitch:"No value"};var en=class extends CustomEvent{constructor(t,o){super("ft-search-result-click",{detail:{result:t,rank:o},bubbles:!0,composed:!0})}};var be=function(e,t,o,n){var a=arguments.length,i=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,o):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(i=(a<3?c(i):a>3?c(t,o,i):c(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i},ee=class extends qi(Oo(bo)){constructor(){super(),this.useChip=!1,this.useAsClusterSwitch=!1,this.goToDocumentOnSwitch=!1,this.displayLabel=!1,this.hierarchicalValueTruncatingLevel=3,this.forceTooltip=!1,this.editorMode=!1,this.metadataDescriptors=[],this.clustersByValue={},this.displayCluster=!1,this.addStore(_),this.addI18nContext(Jo,Dl),this.addI18nContext(wr,is)}setResultStateManager(t){super.setResultStateManager(t),this.key&&this.useAsClusterSwitch&&t.registerMetadata(this.key)}render(){return ge.html`
1501
1501
  ${this.displayCluster?this.renderClusterList():this.renderChip()}
1502
1502
  ${this.hideIfEmpty()}
1503
1503
  `}hideIfEmpty(){return this.flatMetadata==null&&!this.editorMode&&!this.displayCluster?ge.html`
@@ -1514,7 +1514,7 @@ Also for action icons.`,s.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1514
1514
  ${(0,Bl.repeat)((t=this.clusterItems)!==null&&t!==void 0?t:[],o=>o.metadata.value,o=>this.renderClusterItem(o.result,o.metadata))}
1515
1515
  </ft-floating-menu>
1516
1516
  </div>
1517
- `}onClusterSelected(t){var o;(o=this.resultStateManager)===null||o===void 0||o.selectResult(this.clustersByValue[t.detail].result)}computeClusters(){var t,o;let n={},a=new Ct.ClusteringHelper((t=this.cluster)===null||t===void 0?void 0:t.entries,this.result,this.resultStateManager.registeredMetadata,this.metadataDescriptors);this.clusterItems=a.computeClustersItemsForMetadata(this.key,((o=this.request)===null||o===void 0?void 0:o.contentLocale)||"en",en.messages.itemWithNoValueForClusterSwitch(),this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key)),this.clusterItems.forEach(i=>{var c;n[(c=i.metadata.value)!==null&&c!==void 0?c:"ft:no_value"]=i}),this.clustersByValue=n}renderClusterItem(t,o){return this.goToDocumentOnSwitch?ge.html`
1517
+ `}onClusterSelected(t){var o;(o=this.resultStateManager)===null||o===void 0||o.selectResult(this.clustersByValue[t.detail].result)}computeClusters(){var t,o;let n={},a=new Ct.ClusteringHelper((t=this.cluster)===null||t===void 0?void 0:t.entries,this.result,this.resultStateManager.registeredMetadata,this.metadataDescriptors);this.clusterItems=a.computeClustersItemsForMetadata(this.key,((o=this.request)===null||o===void 0?void 0:o.contentLocale)||"en",Jo.messages.itemWithNoValueForClusterSwitch(),this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key)),this.clusterItems.forEach(i=>{var c;n[(c=i.metadata.value)!==null&&c!==void 0?c:"ft:no_value"]=i}),this.clustersByValue=n}renderClusterItem(t,o){return this.goToDocumentOnSwitch?ge.html`
1518
1518
  <a href="${_l(t)}" @click=${()=>this.onResultClick(t)}>
1519
1519
  ${this.renderClusterItemValue(o.value,o.displayValue)}
1520
1520
  </a>
@@ -1522,7 +1522,7 @@ Also for action icons.`,s.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1522
1522
  <ft-floating-menu-item value="${t??"ft:no_value"}">
1523
1523
  ${o}
1524
1524
  </ft-floating-menu-item>
1525
- `}onResultClick(t){this.dispatchEvent(new Jo(t,this.rank))}renderChip(t){var o,n;if(this.useChip){let a=!this.forceTooltip&&this.displayLabel&&((o=this.flatMetadata)===null||o===void 0?void 0:o.displayTooltipValue)==((n=this.flatMetadata)===null||n===void 0?void 0:n.displayValue),i=ge.html`
1525
+ `}onResultClick(t){this.dispatchEvent(new en(t,this.rank))}renderChip(t){var o,n;if(this.useChip){let a=!this.forceTooltip&&this.displayLabel&&((o=this.flatMetadata)===null||o===void 0?void 0:o.displayTooltipValue)==((n=this.flatMetadata)===null||n===void 0?void 0:n.displayValue),i=ge.html`
1526
1526
  <ft-chip icon="${this.displayCluster?"THIN_ARROW":""}"
1527
1527
  ?clickable=${this.displayCluster}
1528
1528
  trailingIcon
@@ -1541,7 +1541,7 @@ Also for action icons.`,s.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1541
1541
  ${this.metadataValue.length===0?ge.nothing:ge.html`
1542
1542
  <span part="values">${this.metadataValue}</span>
1543
1543
  `}
1544
- `}get metadataValue(){return this.flatMetadata?this.getEllipsis(this.flatMetadata.displayValue):this.editorMode?this.key?wr.messages.noValuePresent(this.key):wr.messages.noKeySelected():en.messages.itemWithNoValueForClusterSwitch()}get clusterHasMultipleValues(){var t,o,n;let a=(n=(o=(t=this.cluster)===null||t===void 0?void 0:t.entries)===null||o===void 0?void 0:o.map(i=>Ct.ClusteringHelper.extractResultMetadata({result:i})))===null||n===void 0?void 0:n.map(i=>{var c;return(c=i.find(l=>l.key==this.key))===null||c===void 0?void 0:c.value});return new Set(a).size>1}getEllipsis(t){let o=this.maxLength?t.substring(0,this.maxLength):t;return o+(o.length<t.length?"\u2026":"")}update(t){var o,n,a,i,c,l,u,p;if(super.update(t),(t.has("result")||t.has("key")||this.dateFormatOptionsChanged(t))&&this.key&&this.result){let y=(o=this.resultData())===null||o===void 0?void 0:o.metadata.find(f=>f.key==this.key&&f.values.length>0);this.metadataLabel=(n=y?.label)!==null&&n!==void 0?n:this.findClusterMetadataLabel(),this.flatMetadata=Ct.ClusteringHelper.flattenMetadata(y,this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key))}t.has("key")&&this.useAsClusterSwitch&&(t.get("key")&&((a=this.resultStateManager)===null||a===void 0||a.unregisterMetadata(t.get("key"))),this.key&&((i=this.resultStateManager)===null||i===void 0||i.registerMetadata(this.key))),t.has("useAsClusterSwitch")&&this.key&&(this.useAsClusterSwitch?(c=this.resultStateManager)===null||c===void 0||c.registerMetadata(this.key):(l=this.resultStateManager)===null||l===void 0||l.unregisterMetadata(this.key)),(t.has("cluster")||t.has("result")||t.has("key")||t.has("useAsClusterSwitch")||t.has("hierarchicalValueTruncatingLevel"))&&(this.cluster&&this.result&&this.key&&this.useAsClusterSwitch?(this.computeClusters(),this.displayCluster=this.useAsClusterSwitch&&((p=(u=this.cluster)===null||u===void 0?void 0:u.entries.length)!==null&&p!==void 0?p:0)>1&&this.clusterHasMultipleValues):this.displayCluster=!1)}resultData(t){var o,n;return t=t??this.result,(n=(o=t?.map)!==null&&o!==void 0?o:t?.topic)!==null&&n!==void 0?n:t?.document}get tooltipText(){return this.flatMetadata?`${this.metadataLabel}: ${this.flatMetadata.displayTooltipValue}`:this.useAsClusterSwitch?`${this.metadataLabel}: ${wr.messages.noValueInCluster()}`:""}findClusterMetadataLabel(){var t,o;let n=(t=this.cluster)===null||t===void 0?void 0:t.entries.flatMap(a=>this.resultData(a).metadata.filter(i=>i.key==this.key))[0];return(o=n?.label)!==null&&o!==void 0?o:this.key}};ee.elementDefinitions={"ft-tooltip":j,"ft-chip":te,"ft-floating-menu":St,"ft-floating-menu-item":Le,"ft-floating-menu-label":Ot};ee.styles=Na;be([(0,Oe.property)()],ee.prototype,"key",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"useChip",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"useAsClusterSwitch",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"goToDocumentOnSwitch",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"displayLabel",void 0);be([(0,Oe.property)({type:Number})],ee.prototype,"hierarchicalValueTruncatingLevel",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"forceTooltip",void 0);be([(0,Oe.property)({type:Number,attribute:"max-length"})],ee.prototype,"maxLength",void 0);be([(0,Ct.redux)({store:_.name})],ee.prototype,"editorMode",void 0);be([(0,Ct.redux)({store:_.name,selector:e=>{var t,o;return(o=(t=e.metadataConfiguration)===null||t===void 0?void 0:t.descriptors)!==null&&o!==void 0?o:[]}})],ee.prototype,"metadataDescriptors",void 0);be([(0,Ct.redux)({store:"search"})],ee.prototype,"request",void 0);be([(0,Oe.state)()],ee.prototype,"metadataLabel",void 0);be([(0,Oe.state)()],ee.prototype,"clustersByValue",void 0);be([(0,Oe.state)()],ee.prototype,"clusterItems",void 0);be([(0,Oe.state)()],ee.prototype,"flatMetadata",void 0);be([(0,Oe.state)()],ee.prototype,"displayCluster",void 0);(0,$l.customElement)("ft-search-result-metadata")(ee);})();
1544
+ `}get metadataValue(){return this.flatMetadata?this.getEllipsis(this.flatMetadata.displayValue):this.editorMode?this.key?wr.messages.noValuePresent(this.key):wr.messages.noKeySelected():Jo.messages.itemWithNoValueForClusterSwitch()}get clusterHasMultipleValues(){var t,o,n;let a=(n=(o=(t=this.cluster)===null||t===void 0?void 0:t.entries)===null||o===void 0?void 0:o.map(i=>Ct.ClusteringHelper.extractResultMetadata({result:i})))===null||n===void 0?void 0:n.map(i=>{var c;return(c=i.find(l=>l.key==this.key))===null||c===void 0?void 0:c.value});return new Set(a).size>1}getEllipsis(t){let o=this.maxLength?t.substring(0,this.maxLength):t;return o+(o.length<t.length?"\u2026":"")}update(t){var o,n,a,i,c,l,u,p;if(super.update(t),(t.has("result")||t.has("key")||this.dateFormatOptionsChanged(t))&&this.key&&this.result){let y=(o=this.resultData())===null||o===void 0?void 0:o.metadata.find(f=>f.key==this.key&&f.values.length>0);this.metadataLabel=(n=y?.label)!==null&&n!==void 0?n:this.findClusterMetadataLabel(),this.flatMetadata=Ct.ClusteringHelper.flattenMetadata(y,this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key))}t.has("key")&&this.useAsClusterSwitch&&(t.get("key")&&((a=this.resultStateManager)===null||a===void 0||a.unregisterMetadata(t.get("key"))),this.key&&((i=this.resultStateManager)===null||i===void 0||i.registerMetadata(this.key))),t.has("useAsClusterSwitch")&&this.key&&(this.useAsClusterSwitch?(c=this.resultStateManager)===null||c===void 0||c.registerMetadata(this.key):(l=this.resultStateManager)===null||l===void 0||l.unregisterMetadata(this.key)),(t.has("cluster")||t.has("result")||t.has("key")||t.has("useAsClusterSwitch")||t.has("hierarchicalValueTruncatingLevel"))&&(this.cluster&&this.result&&this.key&&this.useAsClusterSwitch?(this.computeClusters(),this.displayCluster=this.useAsClusterSwitch&&((p=(u=this.cluster)===null||u===void 0?void 0:u.entries.length)!==null&&p!==void 0?p:0)>1&&this.clusterHasMultipleValues):this.displayCluster=!1)}resultData(t){var o,n;return t=t??this.result,(n=(o=t?.map)!==null&&o!==void 0?o:t?.topic)!==null&&n!==void 0?n:t?.document}get tooltipText(){return this.flatMetadata?`${this.metadataLabel}: ${this.flatMetadata.displayTooltipValue}`:this.useAsClusterSwitch?`${this.metadataLabel}: ${wr.messages.noValueInCluster()}`:""}findClusterMetadataLabel(){var t,o;let n=(t=this.cluster)===null||t===void 0?void 0:t.entries.flatMap(a=>this.resultData(a).metadata.filter(i=>i.key==this.key))[0];return(o=n?.label)!==null&&o!==void 0?o:this.key}};ee.elementDefinitions={"ft-tooltip":j,"ft-chip":te,"ft-floating-menu":St,"ft-floating-menu-item":Le,"ft-floating-menu-label":Ot};ee.styles=Na;be([(0,Oe.property)()],ee.prototype,"key",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"useChip",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"useAsClusterSwitch",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"goToDocumentOnSwitch",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"displayLabel",void 0);be([(0,Oe.property)({type:Number})],ee.prototype,"hierarchicalValueTruncatingLevel",void 0);be([(0,Oe.property)({type:Boolean})],ee.prototype,"forceTooltip",void 0);be([(0,Oe.property)({type:Number,attribute:"max-length"})],ee.prototype,"maxLength",void 0);be([(0,Ct.redux)({store:_.name})],ee.prototype,"editorMode",void 0);be([(0,Ct.redux)({store:_.name,selector:e=>{var t,o;return(o=(t=e.metadataConfiguration)===null||t===void 0?void 0:t.descriptors)!==null&&o!==void 0?o:[]}})],ee.prototype,"metadataDescriptors",void 0);be([(0,Ct.redux)({store:"search"})],ee.prototype,"request",void 0);be([(0,Oe.state)()],ee.prototype,"metadataLabel",void 0);be([(0,Oe.state)()],ee.prototype,"clustersByValue",void 0);be([(0,Oe.state)()],ee.prototype,"clusterItems",void 0);be([(0,Oe.state)()],ee.prototype,"flatMetadata",void 0);be([(0,Oe.state)()],ee.prototype,"displayCluster",void 0);(0,$l.customElement)("ft-search-result-metadata")(ee);})();
1545
1545
  /*! Bundled license information:
1546
1546
 
1547
1547
  @lit/reactive-element/css-tag.js:
@@ -1540,7 +1540,7 @@ Also for action icons.`,l.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1540
1540
  <slot></slot>
1541
1541
  </ft-typography>
1542
1542
  </div>
1543
- `}};At.elementDefinitions={"ft-typography":fe};At.styles=zc;q("ft-floating-menu")(wt);q("ftds-floating-menu")(_r);q("ft-floating-menu-item")(Re);q("ft-floating-menu-label")(At);function Tu(t){var e,o,n,a,i;return((a=(o=(e=t.map)===null||e===void 0?void 0:e.openMode)!==null&&o!==void 0?o:(n=t.topic)===null||n===void 0?void 0:n.openMode)!==null&&a!==void 0?a:(i=t.document)===null||i===void 0?void 0:i.openMode)===Fo.EXTERNAL}function Vc(t){var e,o,n,a,i;if(Tu(t))return(a=(o=(e=t.map)===null||e===void 0?void 0:e.originUrl)!==null&&o!==void 0?o:(n=t.topic)===null||n===void 0?void 0:n.originUrl)!==null&&a!==void 0?a:(i=t.document)===null||i===void 0?void 0:i.originUrl;switch(t.type){case gr.MAP:return t.map.readerUrl;case gr.DOCUMENT:return t.document.viewerUrl;case gr.TOPIC:return t.topic.readerUrl}return""}var sn=class extends CustomEvent{constructor(e,o){super("ft-search-result-click",{detail:{result:e,rank:o},bubbles:!0,composed:!0})}};var ln=br.build("designedSearchResultMetadata"),jc={itemWithNoValueForClusterSwitch:"No value"};var Se=function(t,e,o,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(i=(a<3?s(i):a>3?s(e,o,i):s(e,o))||i);return a>3&&i&&Object.defineProperty(e,o,i),i},le=class extends oc(Xo(Zo)){constructor(){super(),this.useChip=!1,this.useAsClusterSwitch=!1,this.goToDocumentOnSwitch=!1,this.displayLabel=!1,this.hierarchicalValueTruncatingLevel=3,this.forceTooltip=!1,this.editorMode=!1,this.metadataDescriptors=[],this.clustersByValue={},this.displayCluster=!1,this.addStore(B),this.addI18nContext(ln,jc),this.addI18nContext(io,ic)}setResultStateManager(e){super.setResultStateManager(e),this.key&&this.useAsClusterSwitch&&e.registerMetadata(this.key)}render(){return $`
1543
+ `}};At.elementDefinitions={"ft-typography":fe};At.styles=zc;q("ft-floating-menu")(wt);q("ftds-floating-menu")(_r);q("ft-floating-menu-item")(Re);q("ft-floating-menu-label")(At);function Tu(t){var e,o,n,a,i;return((a=(o=(e=t.map)===null||e===void 0?void 0:e.openMode)!==null&&o!==void 0?o:(n=t.topic)===null||n===void 0?void 0:n.openMode)!==null&&a!==void 0?a:(i=t.document)===null||i===void 0?void 0:i.openMode)===Fo.EXTERNAL}function Vc(t){var e,o,n,a,i;if(Tu(t))return(a=(o=(e=t.map)===null||e===void 0?void 0:e.originUrl)!==null&&o!==void 0?o:(n=t.topic)===null||n===void 0?void 0:n.originUrl)!==null&&a!==void 0?a:(i=t.document)===null||i===void 0?void 0:i.originUrl;switch(t.type){case gr.MAP:return t.map.readerUrl;case gr.DOCUMENT:return t.document.viewerUrl;case gr.TOPIC:return t.topic.readerUrl}return""}var sn=br.build("designedSearchResultMetadata"),jc={itemWithNoValueForClusterSwitch:"No value"};var ln=class extends CustomEvent{constructor(e,o){super("ft-search-result-click",{detail:{result:e,rank:o},bubbles:!0,composed:!0})}};var Se=function(t,e,o,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,o,n);else for(var c=t.length-1;c>=0;c--)(s=t[c])&&(i=(a<3?s(i):a>3?s(e,o,i):s(e,o))||i);return a>3&&i&&Object.defineProperty(e,o,i),i},le=class extends oc(Xo(Zo)){constructor(){super(),this.useChip=!1,this.useAsClusterSwitch=!1,this.goToDocumentOnSwitch=!1,this.displayLabel=!1,this.hierarchicalValueTruncatingLevel=3,this.forceTooltip=!1,this.editorMode=!1,this.metadataDescriptors=[],this.clustersByValue={},this.displayCluster=!1,this.addStore(B),this.addI18nContext(sn,jc),this.addI18nContext(io,ic)}setResultStateManager(e){super.setResultStateManager(e),this.key&&this.useAsClusterSwitch&&e.registerMetadata(this.key)}render(){return $`
1544
1544
  ${this.displayCluster?this.renderClusterList():this.renderChip()}
1545
1545
  ${this.hideIfEmpty()}
1546
1546
  `}hideIfEmpty(){return this.flatMetadata==null&&!this.editorMode&&!this.displayCluster?$`
@@ -1557,7 +1557,7 @@ Also for action icons.`,l.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1557
1557
  ${Rn((e=this.clusterItems)!==null&&e!==void 0?e:[],o=>o.metadata.value,o=>this.renderClusterItem(o.result,o.metadata))}
1558
1558
  </ft-floating-menu>
1559
1559
  </div>
1560
- `}onClusterSelected(e){var o;(o=this.resultStateManager)===null||o===void 0||o.selectResult(this.clustersByValue[e.detail].result)}computeClusters(){var e,o;let n={},a=new kt((e=this.cluster)===null||e===void 0?void 0:e.entries,this.result,this.resultStateManager.registeredMetadata,this.metadataDescriptors);this.clusterItems=a.computeClustersItemsForMetadata(this.key,((o=this.request)===null||o===void 0?void 0:o.contentLocale)||"en",ln.messages.itemWithNoValueForClusterSwitch(),this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key)),this.clusterItems.forEach(i=>{var s;n[(s=i.metadata.value)!==null&&s!==void 0?s:"ft:no_value"]=i}),this.clustersByValue=n}renderClusterItem(e,o){return this.goToDocumentOnSwitch?$`
1560
+ `}onClusterSelected(e){var o;(o=this.resultStateManager)===null||o===void 0||o.selectResult(this.clustersByValue[e.detail].result)}computeClusters(){var e,o;let n={},a=new kt((e=this.cluster)===null||e===void 0?void 0:e.entries,this.result,this.resultStateManager.registeredMetadata,this.metadataDescriptors);this.clusterItems=a.computeClustersItemsForMetadata(this.key,((o=this.request)===null||o===void 0?void 0:o.contentLocale)||"en",sn.messages.itemWithNoValueForClusterSwitch(),this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key)),this.clusterItems.forEach(i=>{var s;n[(s=i.metadata.value)!==null&&s!==void 0?s:"ft:no_value"]=i}),this.clustersByValue=n}renderClusterItem(e,o){return this.goToDocumentOnSwitch?$`
1561
1561
  <a href="${Vc(e)}" @click=${()=>this.onResultClick(e)}>
1562
1562
  ${this.renderClusterItemValue(o.value,o.displayValue)}
1563
1563
  </a>
@@ -1565,7 +1565,7 @@ Also for action icons.`,l.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1565
1565
  <ft-floating-menu-item value="${e??"ft:no_value"}">
1566
1566
  ${o}
1567
1567
  </ft-floating-menu-item>
1568
- `}onResultClick(e){this.dispatchEvent(new sn(e,this.rank))}renderChip(e){var o,n;if(this.useChip){let a=!this.forceTooltip&&this.displayLabel&&((o=this.flatMetadata)===null||o===void 0?void 0:o.displayTooltipValue)==((n=this.flatMetadata)===null||n===void 0?void 0:n.displayValue),i=$`
1568
+ `}onResultClick(e){this.dispatchEvent(new ln(e,this.rank))}renderChip(e){var o,n;if(this.useChip){let a=!this.forceTooltip&&this.displayLabel&&((o=this.flatMetadata)===null||o===void 0?void 0:o.displayTooltipValue)==((n=this.flatMetadata)===null||n===void 0?void 0:n.displayValue),i=$`
1569
1569
  <ft-chip icon="${this.displayCluster?"THIN_ARROW":""}"
1570
1570
  ?clickable=${this.displayCluster}
1571
1571
  trailingIcon
@@ -1584,7 +1584,7 @@ Also for action icons.`,l.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
1584
1584
  ${this.metadataValue.length===0?W:$`
1585
1585
  <span part="values">${this.metadataValue}</span>
1586
1586
  `}
1587
- `}get metadataValue(){return this.flatMetadata?this.getEllipsis(this.flatMetadata.displayValue):this.editorMode?this.key?io.messages.noValuePresent(this.key):io.messages.noKeySelected():ln.messages.itemWithNoValueForClusterSwitch()}get clusterHasMultipleValues(){var e,o,n;let a=(n=(o=(e=this.cluster)===null||e===void 0?void 0:e.entries)===null||o===void 0?void 0:o.map(i=>kt.extractResultMetadata({result:i})))===null||n===void 0?void 0:n.map(i=>{var s;return(s=i.find(c=>c.key==this.key))===null||s===void 0?void 0:s.value});return new Set(a).size>1}getEllipsis(e){let o=this.maxLength?e.substring(0,this.maxLength):e;return o+(o.length<e.length?"\u2026":"")}update(e){var o,n,a,i,s,c,d,u;if(super.update(e),(e.has("result")||e.has("key")||this.dateFormatOptionsChanged(e))&&this.key&&this.result){let h=(o=this.resultData())===null||o===void 0?void 0:o.metadata.find(f=>f.key==this.key&&f.values.length>0);this.metadataLabel=(n=h?.label)!==null&&n!==void 0?n:this.findClusterMetadataLabel(),this.flatMetadata=kt.flattenMetadata(h,this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key))}e.has("key")&&this.useAsClusterSwitch&&(e.get("key")&&((a=this.resultStateManager)===null||a===void 0||a.unregisterMetadata(e.get("key"))),this.key&&((i=this.resultStateManager)===null||i===void 0||i.registerMetadata(this.key))),e.has("useAsClusterSwitch")&&this.key&&(this.useAsClusterSwitch?(s=this.resultStateManager)===null||s===void 0||s.registerMetadata(this.key):(c=this.resultStateManager)===null||c===void 0||c.unregisterMetadata(this.key)),(e.has("cluster")||e.has("result")||e.has("key")||e.has("useAsClusterSwitch")||e.has("hierarchicalValueTruncatingLevel"))&&(this.cluster&&this.result&&this.key&&this.useAsClusterSwitch?(this.computeClusters(),this.displayCluster=this.useAsClusterSwitch&&((u=(d=this.cluster)===null||d===void 0?void 0:d.entries.length)!==null&&u!==void 0?u:0)>1&&this.clusterHasMultipleValues):this.displayCluster=!1)}resultData(e){var o,n;return e=e??this.result,(n=(o=e?.map)!==null&&o!==void 0?o:e?.topic)!==null&&n!==void 0?n:e?.document}get tooltipText(){return this.flatMetadata?`${this.metadataLabel}: ${this.flatMetadata.displayTooltipValue}`:this.useAsClusterSwitch?`${this.metadataLabel}: ${io.messages.noValueInCluster()}`:""}findClusterMetadataLabel(){var e,o;let n=(e=this.cluster)===null||e===void 0?void 0:e.entries.flatMap(a=>this.resultData(a).metadata.filter(i=>i.key==this.key))[0];return(o=n?.label)!==null&&o!==void 0?o:this.key}};le.elementDefinitions={"ft-tooltip":re,"ft-chip":ce,"ft-floating-menu":wt,"ft-floating-menu-item":Re,"ft-floating-menu-label":At};le.styles=Jl;Se([v()],le.prototype,"key",void 0);Se([v({type:Boolean})],le.prototype,"useChip",void 0);Se([v({type:Boolean})],le.prototype,"useAsClusterSwitch",void 0);Se([v({type:Boolean})],le.prototype,"goToDocumentOnSwitch",void 0);Se([v({type:Boolean})],le.prototype,"displayLabel",void 0);Se([v({type:Number})],le.prototype,"hierarchicalValueTruncatingLevel",void 0);Se([v({type:Boolean})],le.prototype,"forceTooltip",void 0);Se([v({type:Number,attribute:"max-length"})],le.prototype,"maxLength",void 0);Se([Ye({store:B.name})],le.prototype,"editorMode",void 0);Se([Ye({store:B.name,selector:t=>{var e,o;return(o=(e=t.metadataConfiguration)===null||e===void 0?void 0:e.descriptors)!==null&&o!==void 0?o:[]}})],le.prototype,"metadataDescriptors",void 0);Se([Ye({store:"search"})],le.prototype,"request",void 0);Se([X()],le.prototype,"metadataLabel",void 0);Se([X()],le.prototype,"clustersByValue",void 0);Se([X()],le.prototype,"clusterItems",void 0);Se([X()],le.prototype,"flatMetadata",void 0);Se([X()],le.prototype,"displayCluster",void 0);q("ft-search-result-metadata")(le);})();
1587
+ `}get metadataValue(){return this.flatMetadata?this.getEllipsis(this.flatMetadata.displayValue):this.editorMode?this.key?io.messages.noValuePresent(this.key):io.messages.noKeySelected():sn.messages.itemWithNoValueForClusterSwitch()}get clusterHasMultipleValues(){var e,o,n;let a=(n=(o=(e=this.cluster)===null||e===void 0?void 0:e.entries)===null||o===void 0?void 0:o.map(i=>kt.extractResultMetadata({result:i})))===null||n===void 0?void 0:n.map(i=>{var s;return(s=i.find(c=>c.key==this.key))===null||s===void 0?void 0:s.value});return new Set(a).size>1}getEllipsis(e){let o=this.maxLength?e.substring(0,this.maxLength):e;return o+(o.length<e.length?"\u2026":"")}update(e){var o,n,a,i,s,c,d,u;if(super.update(e),(e.has("result")||e.has("key")||this.dateFormatOptionsChanged(e))&&this.key&&this.result){let h=(o=this.resultData())===null||o===void 0?void 0:o.metadata.find(f=>f.key==this.key&&f.values.length>0);this.metadataLabel=(n=h?.label)!==null&&n!==void 0?n:this.findClusterMetadataLabel(),this.flatMetadata=kt.flattenMetadata(h,this.hierarchicalValueTruncatingLevel,this.getDateFormatter(this.key))}e.has("key")&&this.useAsClusterSwitch&&(e.get("key")&&((a=this.resultStateManager)===null||a===void 0||a.unregisterMetadata(e.get("key"))),this.key&&((i=this.resultStateManager)===null||i===void 0||i.registerMetadata(this.key))),e.has("useAsClusterSwitch")&&this.key&&(this.useAsClusterSwitch?(s=this.resultStateManager)===null||s===void 0||s.registerMetadata(this.key):(c=this.resultStateManager)===null||c===void 0||c.unregisterMetadata(this.key)),(e.has("cluster")||e.has("result")||e.has("key")||e.has("useAsClusterSwitch")||e.has("hierarchicalValueTruncatingLevel"))&&(this.cluster&&this.result&&this.key&&this.useAsClusterSwitch?(this.computeClusters(),this.displayCluster=this.useAsClusterSwitch&&((u=(d=this.cluster)===null||d===void 0?void 0:d.entries.length)!==null&&u!==void 0?u:0)>1&&this.clusterHasMultipleValues):this.displayCluster=!1)}resultData(e){var o,n;return e=e??this.result,(n=(o=e?.map)!==null&&o!==void 0?o:e?.topic)!==null&&n!==void 0?n:e?.document}get tooltipText(){return this.flatMetadata?`${this.metadataLabel}: ${this.flatMetadata.displayTooltipValue}`:this.useAsClusterSwitch?`${this.metadataLabel}: ${io.messages.noValueInCluster()}`:""}findClusterMetadataLabel(){var e,o;let n=(e=this.cluster)===null||e===void 0?void 0:e.entries.flatMap(a=>this.resultData(a).metadata.filter(i=>i.key==this.key))[0];return(o=n?.label)!==null&&o!==void 0?o:this.key}};le.elementDefinitions={"ft-tooltip":re,"ft-chip":ce,"ft-floating-menu":wt,"ft-floating-menu-item":Re,"ft-floating-menu-label":At};le.styles=Jl;Se([v()],le.prototype,"key",void 0);Se([v({type:Boolean})],le.prototype,"useChip",void 0);Se([v({type:Boolean})],le.prototype,"useAsClusterSwitch",void 0);Se([v({type:Boolean})],le.prototype,"goToDocumentOnSwitch",void 0);Se([v({type:Boolean})],le.prototype,"displayLabel",void 0);Se([v({type:Number})],le.prototype,"hierarchicalValueTruncatingLevel",void 0);Se([v({type:Boolean})],le.prototype,"forceTooltip",void 0);Se([v({type:Number,attribute:"max-length"})],le.prototype,"maxLength",void 0);Se([Ye({store:B.name})],le.prototype,"editorMode",void 0);Se([Ye({store:B.name,selector:t=>{var e,o;return(o=(e=t.metadataConfiguration)===null||e===void 0?void 0:e.descriptors)!==null&&o!==void 0?o:[]}})],le.prototype,"metadataDescriptors",void 0);Se([Ye({store:"search"})],le.prototype,"request",void 0);Se([X()],le.prototype,"metadataLabel",void 0);Se([X()],le.prototype,"clustersByValue",void 0);Se([X()],le.prototype,"clusterItems",void 0);Se([X()],le.prototype,"flatMetadata",void 0);Se([X()],le.prototype,"displayCluster",void 0);q("ft-search-result-metadata")(le);})();
1588
1588
  /*! Bundled license information:
1589
1589
 
1590
1590
  @webcomponents/scoped-custom-element-registry/src/scoped-custom-element-registry.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-search-result-metadata",
3
- "version": "1.2.37",
3
+ "version": "1.2.39",
4
4
  "description": "Search result metadata for integrated search component",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,16 +19,16 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-chip": "1.2.37",
23
- "@fluid-topics/ft-floating-menu": "1.2.37",
24
- "@fluid-topics/ft-search-result-context": "1.2.37",
25
- "@fluid-topics/ft-tooltip": "1.2.37",
26
- "@fluid-topics/ft-wc-utils": "1.2.37",
22
+ "@fluid-topics/ft-chip": "1.2.39",
23
+ "@fluid-topics/ft-floating-menu": "1.2.39",
24
+ "@fluid-topics/ft-search-result-context": "1.2.39",
25
+ "@fluid-topics/ft-tooltip": "1.2.39",
26
+ "@fluid-topics/ft-wc-utils": "1.2.39",
27
27
  "lit": "3.1.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@fluid-topics/ft-wc-test-utils": "1.2.37",
30
+ "@fluid-topics/ft-wc-test-utils": "1.2.39",
31
31
  "@fluid-topics/public-api": "1.0.88"
32
32
  },
33
- "gitHead": "5e3e862fb02153f9318a9ac3439617694151a43c"
33
+ "gitHead": "b5772ed3ef0ed0ffc2465cfb8307593eacb6ad27"
34
34
  }