import{e,aN as t,k as a,aO as s}from"./vendor-element-plus.js?ver=3.1.0";import{a as o,o as r,w as l,b as d,c as i,L as n,Q as c,as as p,n as u,P as h,d as _,K as m,O as v,R as f,aU as y,aV as b}from"./vendor.js?ver=3.1.0";import{_ as k}from"./fc-bits-ui.js?ver=3.1.0";const S={name:"inputPopoverDropdownExtended",emits:["command"],props:{data:{type:Array,default:()=>[]},close_on_insert:{type:Boolean,default:()=>!0},buttonText:{type:String,default:()=>"Add SmartCodes"},btnType:{type:String,default:()=>"success"},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(){}},x={class:"el_pop_data_group"},g={class:"el_pop_data_headings"},C=["data-item_index","onClick"],L={key:0,class:"pop_doc"},w=["href"],Q={class:"el_pop_data_body"},T={class:"el_pop_search"},$=["onClick"];const j=k(S,[["render",function(k,S,j,I,M,V){const E=e,O=a,U=t,A=s;return r(),o(A,{placement:"right-end",offset:50,"popper-class":"fcrm-smartcodes-popover el-dropdown-list-wrapper",visible:M.visible,"onUpdate:visible":S[1]||(S[1]=e=>M.visible=e),trigger:"click"},{reference:l(()=>[d("div",y(b(k.$attrs)),[_(U,null,{default:l(()=>[_(O,{class:"editor-add-shortcode",size:"small",type:j.btnType,innerHTML:j.buttonText},null,8,["type","innerHTML"])],void 0,!0),_:1})],16)]),default:l(()=>[d("div",x,[d("div",g,[d("ul",null,[(r(!0),i(c,null,p(j.data,(e,t)=>(r(),i("li",{"data-item_index":t,key:t,class:u(M.activeIndex==t?"active_item_selected":""),onClick:e=>M.activeIndex=t},h(e.title),11,C))),128))]),j.doc_url?(r(),i("div",L,[d("a",{href:j.doc_url,target:"_blank",rel:"noopener"},h(k.$t?k.$t("Learn More"):"Learn More"),9,w)])):n("",!0)]),d("div",Q,[d("div",T,[_(E,{modelValue:M.searchQuery,"onUpdate:modelValue":S[0]||(S[0]=e=>M.searchQuery=e),placeholder:k.$t?k.$t("Search shortcodes..."):"Search shortcodes...",clearable:""},null,8,["modelValue","placeholder"])]),(r(!0),i(c,null,p(j.data,(e,t)=>(r(),i("div",{key:t},[m(d("ul",{class:u("el_pop_body_item_"+t)},[(r(!0),i(c,null,p(V.filteredShortcodes(e.shortcodes),(e,t)=>(r(),i("li",{onClick:e=>V.insertShortcode(t),key:t},[v(h(e),1),d("span",null,h(t),1)],8,$))),128))],2),[[f,M.activeIndex==t]])]))),128))])])],void 0),_:1},8,["visible"])}]]);export{j as p};
