import{e,k as t,aO as a}from"./vendor-element-plus.js?ver=3.1.0";import{C as s}from"./CustomIcon.js?ver=3.1.0";import{r as o,c as r,o as l,d as n,w as i,b as d,L as c,Q as u,as as p,n as m,P as _,K as b,O as v,R as f,a as h}from"./vendor.js?ver=3.1.0";import{_ as y}from"./fc-bits-ui.js?ver=3.1.0";const S={name:"inputPopoverDropdownExtended",components:{CustomIcon:s},emits:["command"],props:{data:Array,close_on_insert:{type:Boolean,default:()=>!0},buttonText:{type:String,default:()=>"Add SmartCodes"},buttonIcon:{type:String,default:()=>""},buttonClass:{type:String,default:()=>""},buttonAriaLabel:{type:String,default:()=>""},btnType:{type:String,default:()=>"success"},btn_ref:{type:String,default:()=>"input-popover1"},doc_url:{type:String,default:()=>""}},data:()=>({activeIndex:0,visible:!1,searchQuery:""}),methods:{selectEmoji(e){this.insertShortcode(e.data)},insertShortcode(e){this.$emit("command",e),this.close_on_insert&&(this.visible=!1)},filteredShortcodes(e){if(!this.searchQuery)return e;const t=this.searchQuery.toLowerCase(),a={};return Object.entries(e).forEach(([e,s])=>{(e.toLowerCase().includes(t)||s.toLowerCase().includes(t))&&(a[e]=s)}),a}},mounted(){}},g={class:"el_pop_data_group"},k={class:"el_pop_data_headings"},C=["data-item_index","onClick"],x={key:0,class:"pop_doc"},I=["href"],L={class:"el_pop_data_body"},w={class:"el_pop_search"},T=["onClick"],j=["innerHTML"];const Q=y(S,[["render",function(s,y,S,Q,A,E){const M=e,O=o("custom-icon"),V=t,$=a;return l(),r("div",null,[n($,{ref:S.btn_ref,placement:"right-end",offset:50,width:"auto","popper-class":"fcrm-smartcodes-popover el-dropdown-list-wrapper",visible:A.visible,"onUpdate:visible":y[1]||(y[1]=e=>A.visible=e),trigger:"click"},{reference:i(()=>[n(V,{size:"small",class:m(S.buttonClass),type:S.btnType,"aria-label":S.buttonAriaLabel||S.buttonText},{default:i(()=>[S.buttonIcon?(l(),h(O,{key:0,type:S.buttonIcon},null,8,["type"])):(l(),r("span",{key:1,innerHTML:S.buttonText},null,8,j))],void 0,!0),_:1},8,["class","type","aria-label"])]),default:i(()=>[d("div",g,[d("div",k,[d("ul",null,[(l(!0),r(u,null,p(S.data,(e,t)=>(l(),r("li",{"data-item_index":t,key:t,class:m(A.activeIndex==t?"active_item_selected":""),onClick:e=>A.activeIndex=t},_(e.title),11,C))),128))]),S.doc_url?(l(),r("div",x,[d("a",{href:S.doc_url,target:"_blank",rel:"noopener"},_(s.$t("Learn More")),9,I)])):c("",!0)]),d("div",L,[d("div",w,[n(M,{modelValue:A.searchQuery,"onUpdate:modelValue":y[0]||(y[0]=e=>A.searchQuery=e),placeholder:s.$t("Search shortcodes..."),clearable:""},null,8,["modelValue","placeholder"])]),(l(!0),r(u,null,p(S.data,(e,t)=>(l(),r("div",{key:t},[b(d("ul",{class:m("el_pop_body_item_"+t)},[(l(!0),r(u,null,p(E.filteredShortcodes(e.shortcodes),(e,t)=>(l(),r("li",{onClick:e=>E.insertShortcode(t),key:t},[v(_(e),1),d("span",null,_(t),1)],8,T))),128))],2),[[f,A.activeIndex==t]])]))),128))])])],void 0),_:1},8,["visible"])])}]]);export{Q as I};
