import{e,k as t,aO as a}from"./vendor-element-plus.js?ver=3.1.10";import{aQ as s,W as o,X as r,ab as l,a5 as n,Z as i,J as d,az as c,a0 as u,aa as p,a8 as m,a6 as _,a9 as b,ac as v,Y as f}from"./vendor.js?ver=3.1.10";import{C as h}from"./CustomIcon.js?ver=3.1.10";import{_ as y}from"./fc-bits-ui.js?ver=3.1.10";const S={name:"inputPopoverDropdownExtended",components:{CustomIcon:h},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(h,y,S,Q,A,E){const M=e,V=s("custom-icon"),$=t,z=a;return o(),r("div",null,[l(z,{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:n(()=>[l($,{size:"small",class:u(S.buttonClass),type:S.btnType,"aria-label":S.buttonAriaLabel||S.buttonText},{default:n(()=>[S.buttonIcon?(o(),f(V,{key:0,type:S.buttonIcon},null,8,["type"])):(o(),r("span",{key:1,innerHTML:S.buttonText},null,8,j))],void 0,!0),_:1},8,["class","type","aria-label"])]),default:n(()=>[i("div",g,[i("div",k,[i("ul",null,[(o(!0),r(d,null,c(S.data,(e,t)=>(o(),r("li",{"data-item_index":t,key:t,class:u(A.activeIndex==t?"active_item_selected":""),onClick:e=>A.activeIndex=t},p(e.title),11,C))),128))]),S.doc_url?(o(),r("div",x,[i("a",{href:S.doc_url,target:"_blank",rel:"noopener"},p(h.$t("Learn More")),9,I)])):m("",!0)]),i("div",L,[i("div",w,[l(M,{modelValue:A.searchQuery,"onUpdate:modelValue":y[0]||(y[0]=e=>A.searchQuery=e),placeholder:h.$t("Search shortcodes..."),clearable:""},null,8,["modelValue","placeholder"])]),(o(!0),r(d,null,c(S.data,(e,t)=>(o(),r("div",{key:t},[_(i("ul",{class:u("el_pop_body_item_"+t)},[(o(!0),r(d,null,c(E.filteredShortcodes(e.shortcodes),(e,t)=>(o(),r("li",{onClick:e=>E.insertShortcode(t),key:t},[b(p(e),1),i("span",null,p(t),1)],8,T))),128))],2),[[v,A.activeIndex==t]])]))),128))])])],void 0),_:1},8,["visible"])])}]]);export{Q as I};
