text: var E=Object.defineProperty;var h=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var g=(s,t,e)=>t in s?E(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,x=(s,t)=>{for(var e in t||(t={}))P.call(t,e)&&g(s,e,t[e]);if(h)for(var e of h(t))T.call(t,e)&&g(s,e,t[e]);return s};import{i as k,g as F,k as L,r as w,o as l,c as i,b as r,t as n,w as p,y as o,s as O,v as D,x as m,z as U,a6 as G,A as N,T as H,a7 as W,F as C,H as q,a8 as J}from"./vendor.e9042f2c.js";import{g as K,r as Q,d as R,e as B}from"./main.d5eaf1d9.js";import{_ as X}from"./NoteModal.5994ebe7.js";const Y={class:"w-full"},Z={class:"overflow-hidden rounded-md shadow-lg ring-1 ring-black ring-opacity-5"},ee={class:"relative grid bg-white"},te={class:"relative p-4"},se={key:0,class:"relative flex flex-col overflow-auto list max-h-36"},oe=["onClick"],ae={class:"flex justify-between px-2"},ne={class:"m-0 text-base font-semibold leading-tight text-gray-700 cursor-pointer"},le={key:1,class:"flex justify-center p-5 text-gray-400"},re={class:"text-base text-gray-500"},ie={class:"m-0 ml-3 text-sm leading-none cursor-pointer font-base text-primary-400"},fe={props:{type:{type:String,default:null}},emits:["select"],setup(s,{emit:t}){const e=s;k(null);const{t:I}=F(),c=k(null),S=K(),d=Q(),y=R(),_=L(()=>c.value?d.notes.filter(function(a){return a.name.toLowerCase().indexOf(c.value.toLowerCase())!==-1}):d.notes);async function V(){await d.fetchNotes({filter:{},orderByField:"",orderBy:"",type:e.type?e.type:""})}function z(a,u){t("select",x({},d.notes[a])),c.value=null,u()}function j(){S.openModal({title:I("settings.customization.notes.add_note"),componentName:"NoteModal",size:"lg",data:e.type})}return(a,u)=>{const v=w("BaseIcon"),M=w("BaseInput");return l(),i(C,null,[r(X),n("div",Y,[r(o(J),null,{default:p(({isOpen:$})=>[o(y).hasAbilities(o(B).VIEW_NOTE)?(l(),O(o(G),{key:0,class:U([$?"":"text-opacity-90","flex items-center z-10 font-medium text-primary-400 focus:outline-none focus:border-none"]),onClick:V},{default:p(()=>[r(v,{name:"PlusIcon",class:"w-4 h-4 font-medium text-primary-400"}),D(" "+m(a.$t("general.insert_note")),1)]),_:2},1032,["class"])):N("",!0),r(H,{"enter-active-class":"transition duration-200 ease-out","enter-from-class":"translate-y-1 opacity-0","enter-to-class":"translate-y-0 opacity-100","leave-active-class":"transition duration-150 ease-in","leave-from-class":"translate-y-0 opacity-100","leave-to-class":"translate-y-1 opacity-0"},{default:p(()=>[r(o(W),{class:"absolute z-20 px-4 mt-3 transform sm:px-0 w-screen max-w-full left-0 top-3"},{default:p(({close:A})=>[n("div",Z,[n("div",ee,[n("div",te,[r(M,{modelValue:c.value,"onUpdate:modelValue":u[0]||(u[0]=f=>c.value=f),placeholder:a.$t("general.search"),type:"text",class:"text-black"},null,8,["modelValue","placeholder"])]),o(_).length>0?(l(),i("div",se,[(l(!0),i(C,null,q(o(_),(f,b)=>(l(),i("div",{key:b,tabindex:"2",class:"px-6 py-4 border-b border-gray-200 border-solid cursor-pointer hover:bg-gray-100 hover:cursor-pointer last:border-b-0",onClick:ce=>z(b,A)},[n("div",ae,[n("label",ne,m(f.name),1)])],8,oe))),128))])):(l(),i("div",le,[n("label",re,m(a.$t("general.no_note_found")),1)]))]),o(y).hasAbilities(o(B).MANAGE_NOTE)?(l(),i("button",{key:0,type:"button",class:"h-10 flex items-center justify-center w-full px-2 py-3 bg-gray-200 border-none outline-none",onClick:j},[r(v,{name:"CheckCircleIcon",class:"text-primary-400"}),n("label",ie,m(a.$t("settings.customization.notes.add_new_note")),1)])):N("",!0)])]),_:1})]),_:1})]),_:1})])],64)}}};export{fe as _};
  