import{$ as e,C as t,G as n,S as r,U as i,Wt as a,_ as o,d as s,dt as c,g as l,h as u,n as d,v as f,vt as p,y as m,z as h,zt as g}from"./vue.runtime.esm-bundler-DAWRyTnP.js";import{t as _}from"./user-BMY0vNyo.js";import{n as v}from"./vue-i18n-C4HYJWrq.js";import{t as y}from"./note-BFZSw3HN.js";import{F as b,I as x,L as S,Nn as C,tt as w}from"./main-Gn9UsJwa.js";import{t as T}from"./NoteModal-s-WiGJxR.js";var E={class:`w-full`},D={class:`overflow-hidden rounded-md shadow-lg ring-1 ring-black/5`},O={class:`relative grid bg-white`},k={class:`relative p-4`},A={key:0,class:`relative flex flex-col overflow-auto list max-h-36`},j=[`onClick`],M={class:`flex justify-between px-2`},N={class:`m-0 text-base font-semibold leading-tight text-gray-700 cursor-pointer`},P={key:1,class:`flex justify-center p-5 text-gray-400`},F={class:`text-base text-gray-500`},I={class:`m-0 ml-3 text-sm leading-none cursor-pointer font-base text-primary-400`},L={__name:`SelectNotePopup`,props:{type:{type:String,default:null}},emits:[`select`],setup(L,{emit:R}){let z=L,B=R;c(null);let{t:V}=v(),H=c(null),U=w(),W=y(),G=_(),K=u(()=>H.value?W.notes.filter(function(e){return e.name.toLowerCase().indexOf(H.value.toLowerCase())!==-1}):W.notes);async function q(){await W.fetchNotes({filter:{},orderByField:``,orderBy:``,type:z.type?z.type:``})}function J(e,t){B(`select`,{...W.notes[e]}),H.value=null,t()}function Y(){U.openModal({title:V(`settings.customization.notes.add_note`),componentName:`NoteModal`,size:`lg`,data:z.type})}return(c,u)=>{let _=n(`BaseIcon`),v=n(`BaseInput`);return h(),m(s,null,[t(T),l(`div`,E,[t(p(S),null,{default:e(({isOpen:n})=>[p(G).hasAbilities(p(C).VIEW_NOTE)?(h(),o(p(b),{key:0,class:g([``,`flex items-center z-10 font-medium text-primary-400 focus:outline-hidden focus:border-none`]),onClick:q},{default:e(()=>[t(_,{name:`PlusIcon`,class:`w-4 h-4 font-medium text-primary-400`}),r(` `+a(c.$t(`general.insert_note`)),1)]),_:1},8,[`class`])):f(``,!0),t(d,{"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:e(()=>[t(p(x),{class:`absolute z-20 px-4 mt-3 sm:px-0 w-screen max-w-full left-0 top-3`},{default:e(({close:e})=>[l(`div`,D,[l(`div`,O,[l(`div`,k,[t(v,{modelValue:H.value,"onUpdate:modelValue":u[0]||=e=>H.value=e,placeholder:c.$t(`general.search`),type:`text`,class:`text-black`},null,8,[`modelValue`,`placeholder`])]),K.value.length>0?(h(),m(`div`,A,[(h(!0),m(s,null,i(K.value,(t,n)=>(h(),m(`div`,{key:n,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:t=>J(n,e)},[l(`div`,M,[l(`label`,N,a(t.name),1)])],8,j))),128))])):(h(),m(`div`,P,[l(`label`,F,a(c.$t(`general.no_note_found`)),1)]))]),p(G).hasAbilities(p(C).MANAGE_NOTE)?(h(),m(`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-hidden`,onClick:Y},[t(_,{name:`CheckCircleIcon`,class:`text-primary-400`}),l(`label`,I,a(c.$t(`settings.customization.notes.add_new_note`)),1)])):f(``,!0)])]),_:1})]),_:1})]),_:1})])],64)}}};export{L as t};