import{e as h,f as d,C,i as M,_ as w,m as L,o as n,c as r,a as e,t as y,h as v,F as S,k as x,p as k,j as T,q as j,B as q}from"./app-DWPMZhx6.js";function ne(a){h({});const o=h({}),s=d(!0),t=d(a),i=M("create-notification");d("");const g="?page="+1+"&perPage="+1e4+"&filter="+""+"&sortCol="+""+"&sortOrd="+"";return C.get("/api/"+t.value+"/"+g,{}).then(_=>{Object.assign(o,_.data.data),s.value=!1}).catch(_=>{i({type:"danger",title:"Error",message:_.response.data.message})}),{results:o,isLoading:s}}const B={props:{modelOptions:{type:Object},options:{type:Object,required:!0},msLabel:{type:String,required:!0},msValue:{type:String,required:!0},fieldType:{type:String,required:!0},errors:!1,keepOpenOnSelect:!1},setup(a,{emit:o}){const s=d(!1),t=d(),i=h([]),u=h([]),l=d(null);t.value=a.options;function p(){s.value=!s.value}function m(c,f=!1){const b=i.indexOf(c);b>-1?(i.splice(b,1),u.splice(b,1)):(i.push(c),u.push(c)),a.keepOpenOnSelect&&!f&&(s.value=!0),o("optionsUpdated",i)}function O(){i.splice(0,i.length)}function g(){t.value=a.options,document.getElementById("select-multi-typeahead-expanded-typeahead").value=""}function _(c){s.value=!0,t.value=[],Object.keys(a.options).forEach(f=>{a.options[f][a.msLabel].toLowerCase().includes(c.target.value.toLowerCase())&&t.value.push(a.options[f])})}return L(l,c=>s.value=!1),a.modelOptions&&a.modelOptions.forEach(c=>{i.push(c),u.push(c.id)}),{clearSelected:O,clearText:g,clickOutsideMultiSelect:l,filteredOptions:t,getInput:_,selectedOptions:i,showMultiSelect:s,toggleMultiSelect:p,toggleSelectedOptions:m}}},E={class:"pf-c-form__group"},P={class:"pf-c-form__group-label"},I={class:"pf-c-form__label",for:"form-demo-basic-name"},N={class:"pf-c-form__label-text"},V=e("span",{class:"pf-c-form__label-required","aria-hidden":"true"},"*",-1),F={key:0,id:"select-multi-typeahead-label",ref:"clickOutsideMultiSelect"},R={class:"pf-c-select__toggle pf-m-typeahead",style:{cursor:"default"}},U={class:"pf-c-select__toggle-wrapper"},z={class:"pf-c-chip-group"},A={class:"pf-c-chip-group__main"},D={class:"pf-c-chip-group__list",role:"list","aria-label":"Chip group list"},G={class:"pf-c-chip"},H={class:"pf-c-chip__text"},J=["onClick"],K=e("i",{class:"fas fa-times","aria-hidden":"true"},null,-1),Q=[K],W=["placeholder"],X=e("i",{class:"fas fa-times-circle","aria-hidden":"true"},null,-1),Y=[X],Z=e("i",{class:"fas fa-caret-down pf-c-select__toggle-arrow","aria-hidden":"true"},null,-1),$=[Z],ee={key:1,class:"pf-c-select__menu multi-select-dropdown-overflow","aria-labelledby":"select-multi-typeahead-label ",role:"listbox"},te=["onClick"],le={key:0,class:"pf-c-select__menu-item-icon"},se=e("i",{class:"fas fa-check","aria-hidden":"true"},null,-1),ae=[se],oe={class:"pf-c-form__helper-text"};function ie(a,o,s,t,i,u){return n(),r("div",E,[e("div",P,[e("label",I,[e("span",N,"Select "+y(s.fieldType),1),V])]),e("div",{class:j(["pf-c-select pf-m-expanded",s.errors?"pf-m-invalid":""])},[t.showMultiSelect||!1?(n(),r("span",F,null,512)):v("",!0),e("div",R,[e("div",U,[e("div",z,[e("div",A,[e("ul",D,[(n(!0),r(S,null,x(t.selectedOptions,l=>(n(),r("li",{class:"pf-c-chip-group__list-item",key:l},[e("div",G,[e("span",H,y(l[s.msLabel]),1),e("button",{class:"pf-c-button pf-m-plain",type:"button","aria-labelledby":"remove_select-multi-typeahead-expanded_chip_three select-multi-typeahead-expanded-chip_three","aria-label":"Remove",onClick:k(p=>t.toggleSelectedOptions(l,!0),["prevent"])},Q,8,J)])]))),128))])])]),e("input",{class:"pf-c-form-control pf-c-select__toggle-typeahead",type:"text",id:"select-multi-typeahead-expanded-typeahead","aria-label":"Type to filter",placeholder:"Choose "+s.fieldType,onInput:o[0]||(o[0]=l=>t.getInput(l)),autocomplete:"off"},null,40,W)]),e("button",{tabindex:"-1",class:"pf-c-button pf-m-plain pf-c-select__toggle-clear",type:"button","aria-label":"Clear all",onClick:o[1]||(o[1]=(...l)=>t.clearText&&t.clearText(...l))},Y),e("button",{class:"pf-c-button pf-m-plain pf-c-select__toggle-button",type:"button",id:"select-multi-typeahead-toggle","aria-haspopup":"true","aria-expanded":"false","aria-labelledby":"select-multi-typeahead-label select-multi-typeahead-toggle","aria-label":"Select",onClick:o[2]||(o[2]=(...l)=>t.toggleMultiSelect&&t.toggleMultiSelect(...l))},$)]),t.showMultiSelect||!1?(n(),r("ul",ee,[(n(!0),r(S,null,x(t.filteredOptions,(l,p)=>(n(),r("li",{role:"presentation",key:p},[e("button",{class:"pf-c-select__menu-item",role:"option",onClick:k(m=>t.toggleSelectedOptions(l),["prevent"])},[T(y(l[s.msLabel])+" ",1),t.selectedOptions.includes(l)?(n(),r("span",le,ae)):v("",!0)],8,te)]))),128))])):v("",!0)],2),e("div",oe,[q(a.$slots,"multi-select-subtext")])])}const re=w(B,[["render",ie]]);export{re as M,ne as u};
