{"version":3,"file":"form_controller-g28v71W7.js","sources":["../../../app/javascript/controllers/business/form_controller.js"],"sourcesContent":["import ApplicationController from '../application_controller'\n\nexport default class extends ApplicationController {\n static values = {\n country: String\n }\n\n static targets = [\n 'nameInput',\n 'slugInput',\n 'submitButton',\n ]\n\n suggestSlug({ target }) {\n const value = target.value.trim().toLowerCase().normalize(\"NFD\").replace(/\\p{Diacritic}/gu, \"\")\n const regex = new RegExp(/[\\W_\\s]+/, \"g\")\n\n this.slugInputTarget.value = value.trim().replaceAll(regex, \"-\")\n }\n\n sync() {\n this.submitButtonTarget.disabled = this.nameInputTarget.value.trim() === \"\" || this.slugInputTarget.value.trim() === \"\" || this.countryValue === \"\"\n }\n\n countryChanged({ target }) {\n this.countryValue = target.value\n this.sync()\n }\n}\n"],"names":["form_controller","ApplicationController","target","value","regex","__publicField"],"mappings":"uNAEe,MAAKA,UAASC,CAAsB,CAWjD,YAAY,CAAE,OAAAC,GAAU,CACtB,MAAMC,EAAQD,EAAO,MAAM,KAAI,EAAG,cAAc,UAAU,KAAK,EAAE,QAAQ,WAAiB,iBAAA,IAAA,EAAE,EAAE,EACxFE,EAAQ,IAAI,OAAO,WAAY,GAAG,EAExC,KAAK,gBAAgB,MAAQD,EAAM,OAAO,WAAWC,EAAO,GAAG,CACnE,CAEE,MAAO,CACL,KAAK,mBAAmB,SAAW,KAAK,gBAAgB,MAAM,KAAM,IAAK,IAAM,KAAK,gBAAgB,MAAM,KAAM,IAAK,IAAM,KAAK,eAAiB,EACrJ,CAEE,eAAe,CAAE,OAAAF,GAAU,CACzB,KAAK,aAAeA,EAAO,MAC3B,KAAK,KAAI,CACb,CACA,CAzBEG,EADkBL,EACX,SAAS,CACd,QAAS,MACb,GAEEK,EALkBL,EAKX,UAAU,CACf,YACA,YACA,cACJ"}