{"version":3,"file":"journey_search_controller-DsJ779Wz.js","sources":["../../../app/javascript/controllers/automation/journey_search_controller.js"],"sourcesContent":["import { get } from '@rails/request.js'\nimport PopoverController from '../ui/popover_controller'\n\nexport default class extends PopoverController {\n static values = {\n url: String,\n }\n\n static targets = [\n 'input',\n ]\n\n debounceAndSearch({ target }) {\n this.debounce(() => {\n this.search(target.value)\n }, 300)\n }\n\n async search(value) {\n if(!value) {\n return this.hide()\n }\n\n await get(this.urlValue, {\n responseKind: 'turbo-stream',\n query: {\n element: this.element.id,\n search: value,\n }\n })\n\n this.show()\n }\n\n set({ currentTarget }) {\n const { name, id } = currentTarget.dataset\n\n this.inputTarget.value = name\n this.hide()\n\n this.dispatch('set', {\n detail: {\n id,\n name\n }\n })\n }\n}\n"],"names":["journey_search_controller","PopoverController","target","value","get","currentTarget","name","id","__publicField"],"mappings":"iQAGe,MAAKA,UAASC,CAAkB,CAS7C,kBAAkB,CAAE,OAAAC,GAAU,CAC5B,KAAK,SAAS,IAAM,CAClB,KAAK,OAAOA,EAAO,KAAK,CAC9B,EAAO,GAAG,CACV,CAEE,MAAM,OAAOC,EAAO,CAClB,GAAG,CAACA,EACF,OAAO,KAAK,KAAI,EAGlB,MAAMC,EAAI,KAAK,SAAU,CACvB,aAAc,eACd,MAAO,CACL,QAAS,KAAK,QAAQ,GACtB,OAAQD,CAChB,CACK,CAAA,EAED,KAAK,KAAI,CACb,CAEE,IAAI,CAAE,cAAAE,GAAiB,CACrB,KAAM,CAAE,KAAAC,EAAM,GAAAC,CAAI,EAAGF,EAAc,QAEnC,KAAK,YAAY,MAAQC,EACzB,KAAK,KAAI,EAET,KAAK,SAAS,MAAO,CACnB,OAAQ,CACN,GAAAC,EACA,KAAAD,CACR,CACK,CAAA,CACL,CACA,CA3CEE,EADkBR,EACX,SAAS,CACd,IAAK,MACT,GAEEQ,EALkBR,EAKX,UAAU,CACf,OACJ"}