"use strict";(self.webpackChunktainacan=self.webpackChunktainacan||[]).push([[2144,9763],{93353(e,t,a){a.d(t,{A:()=>i});const i={props:{itemMetadatum:Object,value:[String,Number,Array],disabled:!1},emits:["update:value","blur"],data:function(){return{localValue:"",isPreviewingHtml:!1,singleHTMLPreview:""}},created:function(){this.localValue=this.value?JSON.parse(JSON.stringify(this.value)):""},methods:{onInput:function(e){this.isPreviewingHtml=!1,this.singleHTMLPreview="",this.localValue=e,this.changeValue(e)},changeValue:_.debounce((function(e){this.$emit("update:value",e)}),750),onBlur:function(){this.$emit("blur")},createElementFromHTML:function(e){var t=document.createElement("div");return t.innerHTML=e.trim(),t},previewHtml:function(){var e=this;if(!this.isPreviewingHtml)if("yes"==this.itemMetadatum.metadatum.multiple){var t=this.createElementFromHTML(this.itemMetadatum.value_as_html),a=Object.values(t.children).filter((function(e){return'<span class="multivalue-separator"> | </span>'!=e.outerHTML})),i=this.itemMetadatum.value.findIndex((function(t){return t==e.localValue}));i>=0&&(this.singleHTMLPreview=a[i].outerHTML)}else this.singleHTMLPreview=this.itemMetadatum.value_as_html;this.isPreviewingHtml=!this.isPreviewingHtml}}}},29549(e,t,a){a.d(t,{X:()=>m});var i=a(6934),n={key:0},l={key:0,class:"add-new-term"},r={style:{"font-size":"0.75em"}},u=["innerHTML"];function m(e,t,a,m,s,d){var c=(0,i.g2)("b-input");return a.itemMetadatum?((0,i.uX)(),(0,i.CE)("div",n,[(0,i.bF)(c,{id:"tainacan-item-metadatum_id-"+a.itemMetadatum.metadatum.id+(a.itemMetadatum.parent_meta_id?"_parent_meta_id-"+a.itemMetadatum.parent_meta_id:""),disabled:a.disabled,"model-value":s.localValue,placeholder:a.itemMetadatum.metadatum.placeholder?a.itemMetadatum.metadatum.placeholder:"[link](https://url.com)","onUpdate:modelValue":t[0]||(t[0]=function(e){return d.onInput(e)}),onBlur:d.onBlur},null,8,["id","disabled","model-value","placeholder","onBlur"]),s.localValue&&a.itemMetadatum.item&&a.itemMetadatum.item.id?((0,i.uX)(),(0,i.CE)("div",l,[(0,i.Lk)("a",{class:"add-link",role:"button",tabindex:"0",onClick:t[1]||(t[1]=function(){return d.previewHtml&&d.previewHtml.apply(d,arguments)}),onKeydown:[t[2]||(t[2]=(0,i.jR)((0,i.D$)((function(){return d.previewHtml&&d.previewHtml.apply(d,arguments)}),["prevent"]),["enter"])),t[3]||(t[3]=(0,i.jR)((0,i.D$)((function(){return d.previewHtml&&d.previewHtml.apply(d,arguments)}),["prevent"]),["space"]))]},[t[4]||(t[4]=(0,i.Lk)("span",{"aria-hidden":"true",class:"icon"},[(0,i.Lk)("i",{class:"tainacan-icon has-text-secondary tainacan-icon-see"})],-1)),(0,i.Lk)("span",r," "+(0,i.v_)(e.$i18n.get("label_preview","tainacan")),1)],32)])):(0,i.Q3)("",!0),(0,i.bF)(i.eB,{name:"filter-item"},{default:(0,i.k6)((function(){return[s.isPreviewingHtml?((0,i.uX)(),(0,i.CE)("div",{key:0,innerHTML:s.singleHTMLPreview},null,8,u)):(0,i.Q3)("",!0)]})),_:1})])):(0,i.Q3)("",!0)}},39763(e,t,a){a.r(t),a.d(t,{default:()=>l});var i=a(23628),n=a(95864);const l=(0,a(66262).A)(n.A,[["render",i.X]])},95864(e,t,a){a.d(t,{A:()=>i.A});var i=a(93353)},23628(e,t,a){a.d(t,{X:()=>i.X});var i=a(29549)}}]);