{"version":3,"file":"js/devise/registration/new-92f2d2039374abd5b752.js","mappings":"6EAAA,SAASA,IACPC,QAAQC,IAAI,gBAGZ,IAAMC,EAAYC,SAASC,cAAc,sBACnCC,EAAiBF,SAASC,cAC9B,iCAEIE,EAAgBH,SAASC,cAAc,gCAEzCF,GAAaG,GAAkBC,GACjCJ,EAAUK,iBAAiB,SAAS,SAAUC,GAC5CR,QAAQC,IAAI,CAAEO,EAAAA,IACd,IACMC,EADOD,EAAEE,OAAOC,MACHC,MAAM,KAErBH,EAAMI,SACRR,EAAeM,MAAQF,EAAM,GAC7BA,EAAMK,QAGNR,EAAcK,MAAQF,EAAMM,KAAK,KAErC,GAEJ,CAE4B,aAAxBZ,SAASa,YAEXjB,IAEFI,SAASI,iBAAiB,cAAc,WAEtCR,GACF,G","sources":["webpack://app/./app/javascript/packs/devise/registration/new.js"],"sourcesContent":["function handleName() {\n console.log('Ready to go!');\n\n // Listen to name field change and update firstname and lastname fields.\n const nameField = document.querySelector('input[name=\"name\"]');\n const firstNameField = document.querySelector(\n 'input[name=\"user[firstname]\"]'\n );\n const lastNameField = document.querySelector('input[name=\"user[lastname]\"]');\n\n if (nameField && firstNameField && lastNameField) {\n nameField.addEventListener('input', function (e) {\n console.log({ e });\n const name = e.target.value;\n const names = name.split(' ');\n\n if (names.length) {\n firstNameField.value = names[0];\n names.shift(); // Remove the first name from the array.\n\n // We remove the first name from the array, so we can join the rest of the names.\n lastNameField.value = names.join(' ');\n }\n });\n }\n}\n\nif (document.readyState === 'complete') {\n // The page is already loaded before this script runs, which means turbo:load won't trigger on this page load. Trigger it manually.\n handleName();\n}\ndocument.addEventListener('turbo:load', function () {\n // This event will be fired every time a page is loaded (after the file is included in the document).\n handleName();\n});\n"],"names":["handleName","console","log","nameField","document","querySelector","firstNameField","lastNameField","addEventListener","e","names","target","value","split","length","shift","join","readyState"],"sourceRoot":""}