"use strict";(self.webpackChunktainacan=self.webpackChunktainacan||[]).push([[9788],{50274(e,t,a){a.d(t,{A:()=>i});var l=a(75552),n=a(8926);const i={mixins:[n.s,n.F],emits:["input","update-parent-collapse"],data:function(){return{options:[],selected:""}},watch:{facetsFromItemSearch:{handler:function(){this.isUsingElasticSearch&&this.loadOptions()},immediate:!0,deep:!0}},mounted:function(){this.isUsingElasticSearch||this.loadOptions()},created:function(){this.$eventBusSearchEmitter.on("hasToReloadFacets",this.reloadOptions)},beforeUnmount:function(){this.$eventBusSearchEmitter.off("hasToReloadFacets",this.reloadOptions)},methods:{getFocusRestoreElement:function(){var e=this.$refs.filterSelect&&this.$refs.filterSelect.$el;return e?e.querySelector("select")||e:null},getUnescapedLabel:function(e){return"function"==typeof _.unescape?_.unescape(e):e},reloadOptions:function(e){!this.isUsingElasticSearch&&e&&this.loadOptions()},loadOptions:function(){var e=this;null!=this.getOptionsValuesCancel&&this.getOptionsValuesCancel.cancel("Facet search Canceled.");var t=this.getValuesPlainText({metadatumId:this.metadatumId,search:null,isRepositoryLevel:this.isRepositoryLevel,number:this.filter.max_options,offset:0});t.request.then((function(t){e.updateSelectedValues(),t&&t.data&&t.data.values&&e.$emit("update-parent-collapse",t.data.values.length>0),e.$nextTick((function(){return e.tryRestoreFocus()}))})).catch((function(t){(0,l.FZ)(t)?e.$console.log("Request canceled: "+t.message):e.$console.error(t)})),this.getOptionsValuesCancel=t.source},updateSelectedValues:function(){var e=this;if(this.query&&this.query.metaquery&&Array.isArray(this.query.metaquery)){var t=this.query.metaquery.findIndex((function(t){return t.key==e.metadatumId}));if(t>=0){var a=this.query.metaquery[t];this.selected!=a.value&&(this.selected=a.value)}else this.selected=""}else this.selected=""},onSelect:function(e){this.$emit("input",{filter:"selectbox",metadatum_id:this.metadatumId,collection_id:this.collectionId,value:e}),this.updateSelectedValues()}}}},79922(e,t,a){a.d(t,{X:()=>o});var l=a(6934),n={class:"block"},i={value:""},s=["value"];function o(e,t,a,o,r,c){var u=(0,l.g2)("b-select");return(0,l.uX)(),(0,l.CE)("div",n,[(0,l.bF)(u,{ref:"filterSelect",loading:e.isLoadingOptions,disabled:!e.isLoadingOptions&&r.options.length<=0,"model-value":r.selected,"aria-labelledby":"filter-label-id-"+e.filter.id,placeholder:e.filter.placeholder?e.filter.placeholder:e.$i18n.get("label_selectbox_init"),expanded:"","onUpdate:modelValue":t[0]||(t[0]=function(t){e.resetPage(),c.onSelect(t)})},{default:(0,l.k6)((function(){return[(0,l.Lk)("option",i,(0,l.v_)(e.filter.placeholder?e.filter.placeholder:e.$i18n.get("label_selectbox_init")),1),((0,l.uX)(!0),(0,l.CE)(l.FK,null,(0,l.pI)(r.options,(function(e,t){return(0,l.uX)(),(0,l.CE)("option",{key:t,value:e.value},(0,l.v_)(c.getUnescapedLabel(e.label)+(e.total_items?" ("+e.total_items+")":"")),9,s)})),128))]})),_:1},8,["loading","disabled","model-value","aria-labelledby","placeholder"])])}},27340(e,t,a){a.d(t,{A:()=>o});var l=a(31601),n=a.n(l),i=a(76314),s=a.n(i)()(n());s.push([e.id,"\n.skeleton[data-v-2da260aa] {\n        min-height: 36px;\n}\n",""]);const o=s},86380(e,t,a){var l=a(85072),n=a.n(l),i=a(97825),s=a.n(i),o=a(77659),r=a.n(o),c=a(55056),u=a.n(c),d=a(10540),h=a.n(d),p=a(63494),f=a.n(p),m=a(27340),v={};v.styleTagTransform=f(),v.setAttributes=u(),v.insert=r().bind(null,"head"),v.domAPI=s(),v.insertStyleElement=h();n()(m.A,v),m.A&&m.A.locals&&m.A.locals},69788(e,t,a){a.r(t),a.d(t,{default:()=>i});var l=a(37479),n=a(23663);a(26400);const i=(0,a(66262).A)(n.A,[["render",l.X],["__scopeId","data-v-2da260aa"]])},23663(e,t,a){a.d(t,{A:()=>l.A});var l=a(50274)},37479(e,t,a){a.d(t,{X:()=>l.X});var l=a(79922)},26400(e,t,a){a(86380)}}]);