{"version":3,"file":"event_modal_controller-C1YkgDrR.js","sources":["../../../app/javascript/controllers/track/event_modal_controller.js"],"sourcesContent":["import ApplicationController from '../application_controller'\n\nexport default class extends ApplicationController {\n static values = {\n destroyUrl: String,\n }\n\n static targets = ['form']\n\n show({ detail }) {\n const { id, size, groupId } = detail\n\n if(size > 1) {\n this.element.querySelector('[data-modal-target=\"title\"]').innerText = this.translations.track.events.modal.title.other.replace('%{count}', size)\n } else {\n this.element.querySelector('[data-modal-target=\"title\"]').innerText = this.translations.track.events.modal.title.one\n }\n\n const url = new URL(this.destroyUrlValue.replace(':id', id))\n\n if(groupId) {\n url.searchParams.set('group_id', groupId)\n }\n\n this.element.querySelector('form').action = url.toString()\n\n this.dispatch('open', { target: this.element })\n this.id = id\n }\n\n hide({ detail: id }) {\n if(this.id === id) {\n this.dispatch('close', { target: this.element })\n }\n }\n}\n"],"names":["event_modal_controller","ApplicationController","detail","id","size","groupId","url","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAOjD,KAAK,CAAE,OAAAC,GAAU,CACf,KAAM,CAAE,GAAAC,EAAI,KAAAC,EAAM,QAAAC,GAAYH,EAE3BE,EAAO,EACR,KAAK,QAAQ,cAAc,6BAA6B,EAAE,UAAY,KAAK,aAAa,MAAM,OAAO,MAAM,MAAM,MAAM,QAAQ,WAAYA,CAAI,EAE/I,KAAK,QAAQ,cAAc,6BAA6B,EAAE,UAAY,KAAK,aAAa,MAAM,OAAO,MAAM,MAAM,IAGnH,MAAME,EAAM,IAAI,IAAI,KAAK,gBAAgB,QAAQ,MAAOH,CAAE,CAAC,EAExDE,GACDC,EAAI,aAAa,IAAI,WAAYD,CAAO,EAG1C,KAAK,QAAQ,cAAc,MAAM,EAAE,OAASC,EAAI,SAAQ,EAExD,KAAK,SAAS,OAAQ,CAAE,OAAQ,KAAK,OAAS,CAAA,EAC9C,KAAK,GAAKH,CACd,CAEE,KAAK,CAAE,OAAQA,GAAM,CAChB,KAAK,KAAOA,GACb,KAAK,SAAS,QAAS,CAAE,OAAQ,KAAK,OAAS,CAAA,CAErD,CACA,CAhCEI,EADkBP,EACX,SAAS,CACd,WAAY,MAChB,GAEEO,EALkBP,EAKX,UAAU,CAAC,MAAM"}