{"version":3,"file":"1716.f5807c42.js","mappings":"ilBAGA,sBAA6BA,EAAAA,GAAWC,WAAAA,GAAA,SAAAC,WAAAC,EAAA,gBACzB,KAAI,CAEfC,oBAAAA,GAAqC,IAAhBC,EAAOH,UAAAI,OAAA,QAAAC,IAAAL,UAAA,GAAAA,UAAA,GAAG,IAC3B,MAAMM,EAAQC,KAAKC,MAEnB,OAAO,IAAIC,SAEX,SAASC,EAAiBC,EAASC,GAEN,oBAAdC,UAA2BF,EAAQE,WACrCV,GAAWI,KAAKC,MAAQF,GAASH,EAASS,EAAO,IAAIE,MAAM,YAC/DC,WAAWL,EAAiBM,KAAKC,KAAMN,EAASC,GAAS,GAClE,GACJ,CAEAM,OAAAA,GAEID,KAAKf,uBAAuBiB,MAAK,KAE7BF,KAAKG,SAAWP,UAAUQ,OAAO,uBAAwB,CAErDC,SAAWC,IACP,MAAMC,EAAeP,KAAKQ,QAAQC,cAAc,yBAC5CF,GACAA,EAAaG,gBAAgB,WACjC,IAGRC,QAAQC,KAAK,mBAAmB,GAExC,CAEAC,UAAAA,GACQb,KAAKG,UAELP,UAAUkB,OAAOd,KAAKG,SAE9B,E","sources":["webpack://@bang/www/./assets/controllers/turnstile_controller.js"],"sourcesContent":["import {Controller} from '@hotwired/stimulus';\n\n/* stimulusFetch: 'lazy' */\nexport default class extends Controller {\n    widgetId = null;\n\n    ensureTurnstileIsSet(timeout = 5000) {\n        const start = Date.now();\n\n        return new Promise(waitForTurnstile);\n\n        function waitForTurnstile(resolve, reject) {\n            // eslint-disable-next-line no-undef\n            if (typeof turnstile !== 'undefined') resolve(turnstile);\n            else if (timeout && Date.now() - start >= timeout) reject(new Error('timeout'));\n            else setTimeout(waitForTurnstile.bind(this, resolve, reject), 30);\n        }\n    }\n\n    connect() {\n        // eslint-disable-next-line no-undef\n        this.ensureTurnstileIsSet().then(() => {\n            // eslint-disable-next-line no-undef\n            this.widgetId = turnstile.render('#turnstile-container', {\n                // eslint-disable-next-line no-unused-vars\n                callback: (token) => {\n                    const submitButton = this.element.querySelector('button[type=\"submit\"]');\n                    if (submitButton) {\n                        submitButton.removeAttribute('disabled');\n                    }\n                },\n            });\n            console.warn('turnstile loaded');\n        });\n    }\n\n    disconnect() {\n        if (this.widgetId) {\n            // eslint-disable-next-line no-undef\n            turnstile.remove(this.widgetId);\n        }\n    }\n}\n"],"names":["Controller","constructor","arguments","_defineProperty","ensureTurnstileIsSet","timeout","length","undefined","start","Date","now","Promise","waitForTurnstile","resolve","reject","turnstile","Error","setTimeout","bind","this","connect","then","widgetId","render","callback","token","submitButton","element","querySelector","removeAttribute","console","warn","disconnect","remove"],"sourceRoot":""}