From b843849af96f59a999278e6f8c5e0ca5d6e83e60 Mon Sep 17 00:00:00 2001 From: Teddy Middleton-Smith Date: Thu, 13 Mar 2025 15:36:41 +0000 Subject: [PATCH] Feat: Replace Google ReCAPTCHA with ALTCHA using API - non-tracking, GDPR compliant without cookies or fingerprinting. --- config.py | 6 + controllers/core.py | 95 +- forms/contact.py | 58 +- models/model_view_base.py | 2 +- models/model_view_contact.py | 1 + requirements.txt | 3 +- static/dist/js/main.bundle.js | 693 +------- static/js/pages/core/contact.js | 23 + static/js/pages/core/home.js | 39 +- static/js/vendor/altcha.js | 2636 ++++++++++++++++++++++++++++ templates/layouts/layout.html | 2 +- templates/pages/core/_contact.html | 20 +- 12 files changed, 2856 insertions(+), 722 deletions(-) create mode 100644 static/js/vendor/altcha.js diff --git a/config.py b/config.py index 7c8bc070..8edeeec5 100644 --- a/config.py +++ b/config.py @@ -81,9 +81,15 @@ class Config: MAIL_PASSWORD = os.getenv('MAIL_PASSWORD') MAIL_DEFAULT_SENDER = os.getenv('MAIL_DEFAULT_SENDER') MAIL_CONTACT_PUBLIC = os.getenv('MAIL_CONTACT_PUBLIC') + """ # Recaptcha RECAPTCHA_PUBLIC_KEY = os.getenv('RECAPTCHA_PUBLIC_KEY') RECAPTCHA_PRIVATE_KEY = os.getenv('RECAPTCHA_PRIVATE_KEY') + """ + # ALTCHA + ALTCHA_API_KEY = os.getenv('ALTCHA_API_KEY') + ALTCHA_SECRET_KEY = os.getenv('ALTCHA_SECRET_KEY') + ALTCHA_REGION = 'eu' class DevelopmentConfig(Config): is_development = True diff --git a/controllers/core.py b/controllers/core.py index 009ab5e5..fdddb99f 100644 --- a/controllers/core.py +++ b/controllers/core.py @@ -18,14 +18,17 @@ from models.model_view_contact import Model_View_Contact from models.model_view_home import Model_View_Home import lib.argument_validation as av # external -from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session, Blueprint, current_app +from flask import Flask, render_template, jsonify, request, render_template_string, send_from_directory, redirect, url_for, session, Blueprint, current_app, flash from flask_mail import Mail, Message from extensions import db, oauth, mail from urllib.parse import quote_plus, urlencode from authlib.integrations.flask_client import OAuth from authlib.integrations.base_client import OAuthError from urllib.parse import quote, urlparse, parse_qs - +import json +import base64 +import hmac +import hashlib routes_core = Blueprint('routes_core', __name__) @@ -54,20 +57,82 @@ def contact_post(): try: form = Form_Contact() if form.validate_on_submit(): - # Handle form submission - email = form.email.data - CC = form.CC.data # not in use - contact_name = form.contact_name.data - company_name = form.company_name.data - message = form.message.data - receive_marketing = form.receive_marketing.data - receive_marketing_text = "I would like to receive marketing emails." if receive_marketing else "" - # send email - mailItem = Message("PARTS Website Contact Us Message", recipients=[current_app.config['MAIL_CONTACT_PUBLIC']]) - mailItem.body = f"Dear Lord Edward Middleton-Smith,\n\n{message}\n{receive_marketing_text}\nKind regards,\n{contact_name}\n{company_name}\n{email}" - mail.send(mailItem) - return "Submitted." + altcha_payload = form.altcha.data + if not altcha_payload: + flash('Please complete the ALTCHA challenge', 'danger') + return "Invalid. ALTCHA challenge failed." + # Decode and verify the ALTCHA payload + try: + decoded_payload = json.loads(base64.b64decode(altcha_payload)) + + # Verify the signature + if verify_altcha_signature(decoded_payload): + # Parse the verification data + verification_data = urllib.parse.parse_qs(decoded_payload['verificationData']) + + # Check if the verification was successful + if verification_data.get('verified', ['false'])[0] == 'true': + # If spam filter is enabled, check the classification + if 'classification' in verification_data: + classification = verification_data.get('classification', [''])[0] + score = float(verification_data.get('score', ['0'])[0]) + + # If the classification is BAD and score is high, reject the submission + if classification == 'BAD' and score > 5: + flash('Your submission was flagged as potential spam', 'error') + return render_template('contact.html', form=form) + + # Process the form submission + email = form.email.data + CC = form.CC.data # not in use + contact_name = form.contact_name.data + company_name = form.company_name.data + message = form.message.data + receive_marketing = form.receive_marketing.data + receive_marketing_text = "I would like to receive marketing emails." if receive_marketing else "" + # send email + mailItem = Message("PARTS Website Contact Us Message", recipients=[current_app.config['MAIL_CONTACT_PUBLIC']]) + mailItem.body = f"Dear Lord Edward Middleton-Smith,\n\n{message}\n{receive_marketing_text}\nKind regards,\n{contact_name}\n{company_name}\n{email}" + mail.send(mailItem) + flash('Thank you for your message. We will get back to you soon!', 'success') + return "Submitted." + else: + flash('CAPTCHA verification failed', 'error') + else: + flash('Invalid verification signature', 'error') + except Exception as e: + flash(f'Error verifying CAPTCHA: {str(e)}', 'error') return "Invalid. Failed to submit." # html_body = render_template('pages/core/_contact.html', model = model) except Exception as e: return jsonify(error=str(e)), 403 + + +def verify_altcha_signature(payload): + """Verify the ALTCHA signature""" + if 'algorithm' not in payload or 'signature' not in payload or 'verificationData' not in payload: + return False + + algorithm = payload['algorithm'] + signature = payload['signature'] + verification_data = payload['verificationData'] + + # Calculate SHA hash of the verification data + if algorithm == 'SHA-256': + hash_func = hashlib.sha256 + else: + # Fallback to SHA-256 if algorithm not specified + hash_func = hashlib.sha256 + + # Calculate the hash of verification_data + data_hash = hash_func(verification_data.encode('utf-8')).digest() + + # Calculate the HMAC signature + calculated_signature = hmac.new( + current_app.config["ALTCHA_SECRET_KEY"].encode('utf-8'), + data_hash, + hash_func + ).hexdigest() + + # Compare the calculated signature with the provided signature + return hmac.compare_digest(calculated_signature, signature) \ No newline at end of file diff --git a/forms/contact.py b/forms/contact.py index 4e2a5ed5..59dc2257 100644 --- a/forms/contact.py +++ b/forms/contact.py @@ -16,12 +16,63 @@ Defines Flask-WTF form for handling user input on Contact Us page. # from models.model_view_store import Model_View_Store # circular from forms.base import Form_Base # external +from flask import Flask, render_template, request, flash, redirect, url_for, current_app from flask_wtf import FlaskForm -from wtforms import StringField, TextAreaField, SubmitField, BooleanField, IntegerField, SelectField, FloatField -from wtforms.validators import InputRequired, NumberRange, Regexp, DataRequired, Optional +from wtforms import StringField, TextAreaField, SubmitField, HiddenField, BooleanField +from wtforms.validators import DataRequired, Email, ValidationError from flask_wtf.recaptcha import RecaptchaField from abc import ABCMeta, abstractmethod +import requests +import json +import hmac +import hashlib +import base64 +import urllib.parse +""" +def validate_altcha(form, field): + if not field.data: + raise ValidationError('Please complete the ALTCHA challenge') + + try: + # Decode the base64-encoded payload + payload_json = base64.b64decode(field.data).decode('utf-8') + payload = json.loads(payload_json) + + # Verify ALTCHA response + if not payload.get('verified', False): + raise ValidationError('ALTCHA verification failed') + + # Verify signature + verification_data = payload.get('verificationData', '') + received_signature = payload.get('signature', '') + algorithm = payload.get('algorithm', 'SHA-256') + + # Calculate the hash of verification data + verification_hash = hashlib.sha256(verification_data.encode()).digest() + + # Calculate HMAC signature + hmac_key = current_app.config['ALTCHA_SECRET_KEY'].encode() + calculated_signature = hmac.new( + hmac_key, + verification_hash, + getattr(hashlib, algorithm.lower().replace('-', '')) + ).hexdigest() + + if calculated_signature != received_signature: + raise ValidationError('Invalid ALTCHA signature') + + # Optional: If using the spam filter, you could parse verification_data + # and reject submissions classified as spam + # Example: + parsed_data = dict(urllib.parse.parse_qsl(verification_data)) + if parsed_data.get('classification') == 'BAD': + raise ValidationError('This submission was classified as spam') + + except Exception as e: + current_app.logger.error(f"ALTCHA validation error: {str(e)}") + raise ValidationError('ALTCHA validation failed') +""" class Form_Contact(FlaskForm): email = StringField('Email') @@ -29,5 +80,6 @@ class Form_Contact(FlaskForm): company_name = StringField('Company') message = TextAreaField('Message') receive_marketing = BooleanField('I would like to receive marketing emails.') - recaptcha = RecaptchaField() + # recaptcha = RecaptchaField() + altcha = HiddenField('ALTCHA') # , validators=[validate_altcha] submit = SubmitField('Send Message') diff --git a/models/model_view_base.py b/models/model_view_base.py index a92bba32..6dc1c451 100644 --- a/models/model_view_base.py +++ b/models/model_view_base.py @@ -133,7 +133,7 @@ class Model_View_Base(BaseModel, ABC): FLAG_PAGE_BODY: ClassVar[str] = 'page-body' FLAG_PHONE_NUMBER: ClassVar[str] = Base.FLAG_PHONE_NUMBER FLAG_POSTCODE: ClassVar[str] = Base.FLAG_POSTCODE - FLAG_RECAPTCHA: ClassVar[str] = 'recaptcha' + FLAG_CAPTCHA: ClassVar[str] = 'recaptcha' FLAG_RIGHT_HAND_SIDE: ClassVar[str] = 'rhs' FLAG_ROW: ClassVar[str] = 'row' FLAG_ROW_NEW: ClassVar[str] = 'row-new' diff --git a/models/model_view_contact.py b/models/model_view_contact.py index 67124483..96fb6208 100644 --- a/models/model_view_contact.py +++ b/models/model_view_contact.py @@ -26,6 +26,7 @@ class Model_View_Contact(Model_View_Base): FLAG_COMPANY_NAME: ClassVar[str] = 'company_name' FLAG_CONTACT_NAME: ClassVar[str] = 'contact_name' FLAG_RECEIVE_MARKETING: ClassVar[str] = 'receive_marketing' + ID_CONTACT_FORM: ClassVar[str] = 'contact-form' """ ID_EMAIL: ClassVar[str] = 'email' ID_COMPANY_NAME: ClassVar[str] = 'company_name' diff --git a/requirements.txt b/requirements.txt index 08e0ffd0..7cb5c623 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,5 @@ python_dotenv authlib pydantic # psycopg2 -requests \ No newline at end of file +requests +cryptography \ No newline at end of file diff --git a/static/dist/js/main.bundle.js b/static/dist/js/main.bundle.js index 588feae8..980950fe 100644 --- a/static/dist/js/main.bundle.js +++ b/static/dist/js/main.bundle.js @@ -1,603 +1,7 @@ /******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 431: -/***/ (function(module) { - -!function (e, t) { - true ? module.exports = t() : 0; -}(this, function () { - return function (e) { - function t(o) { - if (n[o]) return n[o].exports; - var i = n[o] = { - exports: {}, - id: o, - loaded: !1 - }; - return e[o].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports; - } - var n = {}; - return t.m = e, t.c = n, t.p = "dist/", t(0); - }([function (e, t, n) { - "use strict"; - - function o(e) { - return e && e.__esModule ? e : { - default: e - }; - } - var i = Object.assign || function (e) { - for (var t = 1; t < arguments.length; t++) { - var n = arguments[t]; - for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]); - } - return e; - }, - r = n(1), - a = (o(r), n(6)), - u = o(a), - c = n(7), - s = o(c), - f = n(8), - d = o(f), - l = n(9), - p = o(l), - m = n(10), - b = o(m), - v = n(11), - y = o(v), - g = n(14), - h = o(g), - w = [], - k = !1, - x = { - offset: 120, - delay: 0, - easing: "ease", - duration: 400, - disable: !1, - once: !1, - startEvent: "DOMContentLoaded", - throttleDelay: 99, - debounceDelay: 50, - disableMutationObserver: !1 - }, - j = function () { - var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; - if (e && (k = !0), k) return w = (0, y.default)(w, x), (0, b.default)(w, x.once), w; - }, - O = function () { - w = (0, h.default)(), j(); - }, - M = function () { - w.forEach(function (e, t) { - e.node.removeAttribute("data-aos"), e.node.removeAttribute("data-aos-easing"), e.node.removeAttribute("data-aos-duration"), e.node.removeAttribute("data-aos-delay"); - }); - }, - S = function (e) { - return e === !0 || "mobile" === e && p.default.mobile() || "phone" === e && p.default.phone() || "tablet" === e && p.default.tablet() || "function" == typeof e && e() === !0; - }, - _ = function (e) { - x = i(x, e), w = (0, h.default)(); - var t = document.all && !window.atob; - return S(x.disable) || t ? M() : (x.disableMutationObserver || d.default.isSupported() || (console.info('\n aos: MutationObserver is not supported on this browser,\n code mutations observing has been disabled.\n You may have to call "refreshHard()" by yourself.\n '), x.disableMutationObserver = !0), document.querySelector("body").setAttribute("data-aos-easing", x.easing), document.querySelector("body").setAttribute("data-aos-duration", x.duration), document.querySelector("body").setAttribute("data-aos-delay", x.delay), "DOMContentLoaded" === x.startEvent && ["complete", "interactive"].indexOf(document.readyState) > -1 ? j(!0) : "load" === x.startEvent ? window.addEventListener(x.startEvent, function () { - j(!0); - }) : document.addEventListener(x.startEvent, function () { - j(!0); - }), window.addEventListener("resize", (0, s.default)(j, x.debounceDelay, !0)), window.addEventListener("orientationchange", (0, s.default)(j, x.debounceDelay, !0)), window.addEventListener("scroll", (0, u.default)(function () { - (0, b.default)(w, x.once); - }, x.throttleDelay)), x.disableMutationObserver || d.default.ready("[data-aos]", O), w); - }; - e.exports = { - init: _, - refresh: j, - refreshHard: O - }; - }, function (e, t) {},,,,, function (e, t) { - (function (t) { - "use strict"; - - function n(e, t, n) { - function o(t) { - var n = b, - o = v; - return b = v = void 0, k = t, g = e.apply(o, n); - } - function r(e) { - return k = e, h = setTimeout(f, t), M ? o(e) : g; - } - function a(e) { - var n = e - w, - o = e - k, - i = t - n; - return S ? j(i, y - o) : i; - } - function c(e) { - var n = e - w, - o = e - k; - return void 0 === w || n >= t || n < 0 || S && o >= y; - } - function f() { - var e = O(); - return c(e) ? d(e) : void (h = setTimeout(f, a(e))); - } - function d(e) { - return h = void 0, _ && b ? o(e) : (b = v = void 0, g); - } - function l() { - void 0 !== h && clearTimeout(h), k = 0, b = w = v = h = void 0; - } - function p() { - return void 0 === h ? g : d(O()); - } - function m() { - var e = O(), - n = c(e); - if (b = arguments, v = this, w = e, n) { - if (void 0 === h) return r(w); - if (S) return h = setTimeout(f, t), o(w); - } - return void 0 === h && (h = setTimeout(f, t)), g; - } - var b, - v, - y, - g, - h, - w, - k = 0, - M = !1, - S = !1, - _ = !0; - if ("function" != typeof e) throw new TypeError(s); - return t = u(t) || 0, i(n) && (M = !!n.leading, S = "maxWait" in n, y = S ? x(u(n.maxWait) || 0, t) : y, _ = "trailing" in n ? !!n.trailing : _), m.cancel = l, m.flush = p, m; - } - function o(e, t, o) { - var r = !0, - a = !0; - if ("function" != typeof e) throw new TypeError(s); - return i(o) && (r = "leading" in o ? !!o.leading : r, a = "trailing" in o ? !!o.trailing : a), n(e, t, { - leading: r, - maxWait: t, - trailing: a - }); - } - function i(e) { - var t = "undefined" == typeof e ? "undefined" : c(e); - return !!e && ("object" == t || "function" == t); - } - function r(e) { - return !!e && "object" == ("undefined" == typeof e ? "undefined" : c(e)); - } - function a(e) { - return "symbol" == ("undefined" == typeof e ? "undefined" : c(e)) || r(e) && k.call(e) == d; - } - function u(e) { - if ("number" == typeof e) return e; - if (a(e)) return f; - if (i(e)) { - var t = "function" == typeof e.valueOf ? e.valueOf() : e; - e = i(t) ? t + "" : t; - } - if ("string" != typeof e) return 0 === e ? e : +e; - e = e.replace(l, ""); - var n = m.test(e); - return n || b.test(e) ? v(e.slice(2), n ? 2 : 8) : p.test(e) ? f : +e; - } - var c = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { - return typeof e; - } : function (e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; - }, - s = "Expected a function", - f = NaN, - d = "[object Symbol]", - l = /^\s+|\s+$/g, - p = /^[-+]0x[0-9a-f]+$/i, - m = /^0b[01]+$/i, - b = /^0o[0-7]+$/i, - v = parseInt, - y = "object" == ("undefined" == typeof t ? "undefined" : c(t)) && t && t.Object === Object && t, - g = "object" == ("undefined" == typeof self ? "undefined" : c(self)) && self && self.Object === Object && self, - h = y || g || Function("return this")(), - w = Object.prototype, - k = w.toString, - x = Math.max, - j = Math.min, - O = function () { - return h.Date.now(); - }; - e.exports = o; - }).call(t, function () { - return this; - }()); - }, function (e, t) { - (function (t) { - "use strict"; - - function n(e, t, n) { - function i(t) { - var n = b, - o = v; - return b = v = void 0, O = t, g = e.apply(o, n); - } - function r(e) { - return O = e, h = setTimeout(f, t), M ? i(e) : g; - } - function u(e) { - var n = e - w, - o = e - O, - i = t - n; - return S ? x(i, y - o) : i; - } - function s(e) { - var n = e - w, - o = e - O; - return void 0 === w || n >= t || n < 0 || S && o >= y; - } - function f() { - var e = j(); - return s(e) ? d(e) : void (h = setTimeout(f, u(e))); - } - function d(e) { - return h = void 0, _ && b ? i(e) : (b = v = void 0, g); - } - function l() { - void 0 !== h && clearTimeout(h), O = 0, b = w = v = h = void 0; - } - function p() { - return void 0 === h ? g : d(j()); - } - function m() { - var e = j(), - n = s(e); - if (b = arguments, v = this, w = e, n) { - if (void 0 === h) return r(w); - if (S) return h = setTimeout(f, t), i(w); - } - return void 0 === h && (h = setTimeout(f, t)), g; - } - var b, - v, - y, - g, - h, - w, - O = 0, - M = !1, - S = !1, - _ = !0; - if ("function" != typeof e) throw new TypeError(c); - return t = a(t) || 0, o(n) && (M = !!n.leading, S = "maxWait" in n, y = S ? k(a(n.maxWait) || 0, t) : y, _ = "trailing" in n ? !!n.trailing : _), m.cancel = l, m.flush = p, m; - } - function o(e) { - var t = "undefined" == typeof e ? "undefined" : u(e); - return !!e && ("object" == t || "function" == t); - } - function i(e) { - return !!e && "object" == ("undefined" == typeof e ? "undefined" : u(e)); - } - function r(e) { - return "symbol" == ("undefined" == typeof e ? "undefined" : u(e)) || i(e) && w.call(e) == f; - } - function a(e) { - if ("number" == typeof e) return e; - if (r(e)) return s; - if (o(e)) { - var t = "function" == typeof e.valueOf ? e.valueOf() : e; - e = o(t) ? t + "" : t; - } - if ("string" != typeof e) return 0 === e ? e : +e; - e = e.replace(d, ""); - var n = p.test(e); - return n || m.test(e) ? b(e.slice(2), n ? 2 : 8) : l.test(e) ? s : +e; - } - var u = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { - return typeof e; - } : function (e) { - return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; - }, - c = "Expected a function", - s = NaN, - f = "[object Symbol]", - d = /^\s+|\s+$/g, - l = /^[-+]0x[0-9a-f]+$/i, - p = /^0b[01]+$/i, - m = /^0o[0-7]+$/i, - b = parseInt, - v = "object" == ("undefined" == typeof t ? "undefined" : u(t)) && t && t.Object === Object && t, - y = "object" == ("undefined" == typeof self ? "undefined" : u(self)) && self && self.Object === Object && self, - g = v || y || Function("return this")(), - h = Object.prototype, - w = h.toString, - k = Math.max, - x = Math.min, - j = function () { - return g.Date.now(); - }; - e.exports = n; - }).call(t, function () { - return this; - }()); - }, function (e, t) { - "use strict"; - - function n(e) { - var t = void 0, - o = void 0, - i = void 0; - for (t = 0; t < e.length; t += 1) { - if (o = e[t], o.dataset && o.dataset.aos) return !0; - if (i = o.children && n(o.children)) return !0; - } - return !1; - } - function o() { - return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; - } - function i() { - return !!o(); - } - function r(e, t) { - var n = window.document, - i = o(), - r = new i(a); - u = t, r.observe(n.documentElement, { - childList: !0, - subtree: !0, - removedNodes: !0 - }); - } - function a(e) { - e && e.forEach(function (e) { - var t = Array.prototype.slice.call(e.addedNodes), - o = Array.prototype.slice.call(e.removedNodes), - i = t.concat(o); - if (n(i)) return u(); - }); - } - Object.defineProperty(t, "__esModule", { - value: !0 - }); - var u = function () {}; - t.default = { - isSupported: i, - ready: r - }; - }, function (e, t) { - "use strict"; - - function n(e, t) { - if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); - } - function o() { - return navigator.userAgent || navigator.vendor || window.opera || ""; - } - Object.defineProperty(t, "__esModule", { - value: !0 - }); - var i = function () { - function e(e, t) { - for (var n = 0; n < t.length; n++) { - var o = t[n]; - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o); - } - } - return function (t, n, o) { - return n && e(t.prototype, n), o && e(t, o), t; - }; - }(), - r = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i, - a = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i, - u = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i, - c = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i, - s = function () { - function e() { - n(this, e); - } - return i(e, [{ - key: "phone", - value: function () { - var e = o(); - return !(!r.test(e) && !a.test(e.substr(0, 4))); - } - }, { - key: "mobile", - value: function () { - var e = o(); - return !(!u.test(e) && !c.test(e.substr(0, 4))); - } - }, { - key: "tablet", - value: function () { - return this.mobile() && !this.phone(); - } - }]), e; - }(); - t.default = new s(); - }, function (e, t) { - "use strict"; - - Object.defineProperty(t, "__esModule", { - value: !0 - }); - var n = function (e, t, n) { - var o = e.node.getAttribute("data-aos-once"); - t > e.position ? e.node.classList.add("aos-animate") : "undefined" != typeof o && ("false" === o || !n && "true" !== o) && e.node.classList.remove("aos-animate"); - }, - o = function (e, t) { - var o = window.pageYOffset, - i = window.innerHeight; - e.forEach(function (e, r) { - n(e, i + o, t); - }); - }; - t.default = o; - }, function (e, t, n) { - "use strict"; - - function o(e) { - return e && e.__esModule ? e : { - default: e - }; - } - Object.defineProperty(t, "__esModule", { - value: !0 - }); - var i = n(12), - r = o(i), - a = function (e, t) { - return e.forEach(function (e, n) { - e.node.classList.add("aos-init"), e.position = (0, r.default)(e.node, t.offset); - }), e; - }; - t.default = a; - }, function (e, t, n) { - "use strict"; - - function o(e) { - return e && e.__esModule ? e : { - default: e - }; - } - Object.defineProperty(t, "__esModule", { - value: !0 - }); - var i = n(13), - r = o(i), - a = function (e, t) { - var n = 0, - o = 0, - i = window.innerHeight, - a = { - offset: e.getAttribute("data-aos-offset"), - anchor: e.getAttribute("data-aos-anchor"), - anchorPlacement: e.getAttribute("data-aos-anchor-placement") - }; - switch (a.offset && !isNaN(a.offset) && (o = parseInt(a.offset)), a.anchor && document.querySelectorAll(a.anchor) && (e = document.querySelectorAll(a.anchor)[0]), n = (0, r.default)(e).top, a.anchorPlacement) { - case "top-bottom": - break; - case "center-bottom": - n += e.offsetHeight / 2; - break; - case "bottom-bottom": - n += e.offsetHeight; - break; - case "top-center": - n += i / 2; - break; - case "bottom-center": - n += i / 2 + e.offsetHeight; - break; - case "center-center": - n += i / 2 + e.offsetHeight / 2; - break; - case "top-top": - n += i; - break; - case "bottom-top": - n += e.offsetHeight + i; - break; - case "center-top": - n += e.offsetHeight / 2 + i; - } - return a.anchorPlacement || a.offset || isNaN(t) || (o = t), n + o; - }; - t.default = a; - }, function (e, t) { - "use strict"; - - Object.defineProperty(t, "__esModule", { - value: !0 - }); - var n = function (e) { - for (var t = 0, n = 0; e && !isNaN(e.offsetLeft) && !isNaN(e.offsetTop);) t += e.offsetLeft - ("BODY" != e.tagName ? e.scrollLeft : 0), n += e.offsetTop - ("BODY" != e.tagName ? e.scrollTop : 0), e = e.offsetParent; - return { - top: n, - left: t - }; - }; - t.default = n; - }, function (e, t) { - "use strict"; - - Object.defineProperty(t, "__esModule", { - value: !0 - }); - var n = function (e) { - return e = e || document.querySelectorAll("[data-aos]"), Array.prototype.map.call(e, function (e) { - return { - node: e - }; - }); - }; - t.default = n; - }]); -}); - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/************************************************************************/ -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +/******/ "use strict"; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // UNUSED EXPORTS: default @@ -1320,9 +724,6 @@ var BasePage = /*#__PURE__*/function () { }]); }(); -// EXTERNAL MODULE: ./node_modules/aos/dist/aos.js -var aos = __webpack_require__(431); -var aos_default = /*#__PURE__*/__webpack_require__.n(aos); ;// ./static/js/pages/core/home.js function home_typeof(o) { "@babel/helpers - typeof"; return home_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, home_typeof(o); } function home_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } @@ -1344,7 +745,6 @@ function home_toPrimitive(t, r) { if ("object" != home_typeof(t) || !t) return t // internal // external - var PageHome = /*#__PURE__*/function (_BasePage) { function PageHome(router) { home_classCallCheck(this, PageHome); @@ -1356,45 +756,7 @@ var PageHome = /*#__PURE__*/function (_BasePage) { value: function initialize() { this.sharedInitialize(); this.hookupButtonsNavContact(); - // this.initialiseAOS(); - this.initialiseAnimations(); } - - /* AOS */ - }, { - key: "initialiseAOS", - value: function initialiseAOS() { - aos_default().init({ - duration: 1000, - once: true - }); - } - /* Manual animations * - initialiseAnimations() { - // Check if IntersectionObserver is supported - if ('IntersectionObserver' in window) { - const observer = new IntersectionObserver((entries) => { - entries.forEach(entry => { - if (entry.isIntersecting) { - entry.target.classList.add('active'); - } - }); - }, { - threshold: 0.1, - rootMargin: '50px' - }); - // Observe all elements with 'reveal' class - document.querySelectorAll('.reveal').forEach((element) => { - observer.observe(element); - }); - } else { - // If IntersectionObserver is not supported, make all elements visible - document.querySelectorAll('.reveal').forEach((element) => { - element.style.opacity = 1; - }); - } - } - */ }, { key: "leave", value: function leave() { @@ -1430,8 +792,32 @@ var PageContact = /*#__PURE__*/function (_BasePage) { key: "initialize", value: function initialize() { this.sharedInitialize(); + this.hookupCaptcha(); this.hookupButtonSubmitFormContactUs(); } + }, { + key: "hookupCaptcha", + value: function hookupCaptcha() { + var form = document.querySelector(idContactForm); + var altchaWidget = form.querySelector('altcha-widget'); + + // Listen for verification events from the ALTCHA widget + if (altchaWidget) { + altchaWidget.addEventListener('serververification', function (event) { + // Create or update the hidden input for ALTCHA + var altchaInput = form.querySelector('input[name="altcha"]'); + if (!altchaInput) { + altchaInput = document.createElement('input'); + altchaInput.type = 'hidden'; + altchaInput.name = 'altcha'; + form.appendChild(altchaInput); + } + + // Set the verification payload + altchaInput.value = event.detail.payload; + }); + } + } }, { key: "hookupButtonSubmitFormContactUs", value: function hookupButtonSubmitFormContactUs() { @@ -2301,65 +1687,56 @@ window.app = app; /* harmony default export */ const js_app = ((/* unused pure expression or super */ null && (app))); })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other entry modules. (() => { -"use strict"; // extracted by mini-css-extract-plugin })(); diff --git a/static/js/pages/core/contact.js b/static/js/pages/core/contact.js index 8924a0ba..07b3bc52 100644 --- a/static/js/pages/core/contact.js +++ b/static/js/pages/core/contact.js @@ -10,9 +10,32 @@ export default class PageContact extends BasePage { initialize() { this.sharedInitialize(); + this.hookupCaptcha(); this.hookupButtonSubmitFormContactUs(); } + hookupCaptcha() { + const form = document.querySelector(idContactForm); + const altchaWidget = form.querySelector('altcha-widget'); + + // Listen for verification events from the ALTCHA widget + if (altchaWidget) { + altchaWidget.addEventListener('serververification', function(event) { + // Create or update the hidden input for ALTCHA + let altchaInput = form.querySelector('input[name="altcha"]'); + if (!altchaInput) { + altchaInput = document.createElement('input'); + altchaInput.type = 'hidden'; + altchaInput.name = 'altcha'; + form.appendChild(altchaInput); + } + + // Set the verification payload + altchaInput.value = event.detail.payload; + }); + } + } + hookupButtonSubmitFormContactUs() { const button = document.querySelector('form input[type="submit"]'); button.classList.add(flagButton); diff --git a/static/js/pages/core/home.js b/static/js/pages/core/home.js index ecd48415..b6e063ed 100644 --- a/static/js/pages/core/home.js +++ b/static/js/pages/core/home.js @@ -2,7 +2,6 @@ // internal import BasePage from "../base.js"; // external -import AOS from 'aos'; export default class PageHome extends BasePage { @@ -15,46 +14,10 @@ export default class PageHome extends BasePage { initialize() { this.sharedInitialize(); this.hookupButtonsNavContact(); - // this.initialiseAOS(); - this.initialiseAnimations(); } - /* AOS */ - initialiseAOS() { - AOS.init({ - duration: 1000, - once: true, - }); - } - /* Manual animations * - initialiseAnimations() { - // Check if IntersectionObserver is supported - if ('IntersectionObserver' in window) { - const observer = new IntersectionObserver((entries) => { - entries.forEach(entry => { - if (entry.isIntersecting) { - entry.target.classList.add('active'); - } - }); - }, { - threshold: 0.1, - rootMargin: '50px' - }); - - // Observe all elements with 'reveal' class - document.querySelectorAll('.reveal').forEach((element) => { - observer.observe(element); - }); - } else { - // If IntersectionObserver is not supported, make all elements visible - document.querySelectorAll('.reveal').forEach((element) => { - element.style.opacity = 1; - }); - } - } - */ - leave() { super.leave(); } } + diff --git a/static/js/vendor/altcha.js b/static/js/vendor/altcha.js new file mode 100644 index 00000000..e983197e --- /dev/null +++ b/static/js/vendor/altcha.js @@ -0,0 +1,2636 @@ +var hi = Object.defineProperty; +var Or = (e) => { + throw TypeError(e); +}; +var gi = (e, t, r) => t in e ? hi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r; +var ne = (e, t, r) => gi(e, typeof t != "symbol" ? t + "" : t, r), zr = (e, t, r) => t.has(e) || Or("Cannot " + r); +var H = (e, t, r) => (zr(e, t, "read from private field"), r ? r.call(e) : t.get(e)), Mt = (e, t, r) => t.has(e) ? Or("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), Ut = (e, t, r, l) => (zr(e, t, "write to private field"), l ? l.call(e, r) : t.set(e, r), r); +const en = `(function(){"use strict";const d=new TextEncoder;function p(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}async function b(e,t,r){if(typeof crypto>"u"||!("subtle"in crypto)||!("digest"in crypto.subtle))throw new Error("Web Crypto is not available. Secure context is required (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");return p(await crypto.subtle.digest(r.toUpperCase(),d.encode(e+t)))}function w(e,t,r="SHA-256",n=1e6,s=0){const o=new AbortController,a=Date.now();return{promise:(async()=>{for(let c=s;c<=n;c+=1){if(o.signal.aborted)return null;if(await b(t,c,r)===e)return{number:c,took:Date.now()-a}}return null})(),controller:o}}function h(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n{for(let u=n;u<=r;u+=1){if(o.signal.aborted||!c||!y)return null;try{const f=await crypto.subtle.decrypt({name:s,iv:g(u)},c,y);if(f)return{clearText:new TextDecoder().decode(f),took:Date.now()-a}}catch{}}return null};let c=null,y=null;try{y=h(e);const u=await crypto.subtle.digest("SHA-256",d.encode(t));c=await crypto.subtle.importKey("raw",u,s,!1,["decrypt"])}catch{return{promise:Promise.reject(),controller:o}}return{promise:l(),controller:o}}let i;onmessage=async e=>{const{type:t,payload:r,start:n,max:s}=e.data;let o=null;if(t==="abort")i==null||i.abort(),i=void 0;else if(t==="work"){if("obfuscated"in r){const{key:a,obfuscated:l}=r||{};o=await m(l,a,s,n)}else{const{algorithm:a,challenge:l,salt:c}=r||{};o=w(l,c,a,s,n)}i=o.controller,o.promise.then(a=>{self.postMessage(a&&{...a,worker:!0})})}}})(); +`, Fr = typeof self < "u" && self.Blob && new Blob([en], { type: "text/javascript;charset=utf-8" }); +function _i(e) { + let t; + try { + if (t = Fr && (self.URL || self.webkitURL).createObjectURL(Fr), !t) throw ""; + const r = new Worker(t, { + name: e == null ? void 0 : e.name + }); + return r.addEventListener("error", () => { + (self.URL || self.webkitURL).revokeObjectURL(t); + }), r; + } catch { + return new Worker( + "data:text/javascript;charset=utf-8," + encodeURIComponent(en), + { + name: e == null ? void 0 : e.name + } + ); + } finally { + t && (self.URL || self.webkitURL).revokeObjectURL(t); + } +} +const mi = "5"; +var Qr; +typeof window < "u" && ((Qr = window.__svelte ?? (window.__svelte = {})).v ?? (Qr.v = /* @__PURE__ */ new Set())).add(mi); +const wi = 1, pi = 4, yi = 8, bi = 16, Ei = 1, xi = 2, Wt = "[", tn = "[!", rn = "]", Je = {}, W = Symbol(), $i = "http://www.w3.org/1999/xhtml", Mr = !1, oe = 2, nn = 4, It = 8, Yt = 16, pe = 32, ze = 64, yt = 128, re = 256, bt = 512, K = 1024, ye = 2048, et = 4096, Ke = 8192, St = 16384, ki = 32768, Zt = 65536, Ci = 1 << 19, ln = 1 << 20, ut = Symbol("$state"), an = Symbol("legacy props"), Ai = Symbol(""); +var on = Array.isArray, Ri = Array.prototype.indexOf, Ii = Array.from, Et = Object.keys, xt = Object.defineProperty, Pe = Object.getOwnPropertyDescriptor, Si = Object.getOwnPropertyDescriptors, Ti = Object.prototype, Ni = Array.prototype, sn = Object.getPrototypeOf; +function fn(e) { + for (var t = 0; t < e.length; t++) + e[t](); +} +const Li = typeof requestIdleCallback > "u" ? (e) => setTimeout(e, 1) : requestIdleCallback; +let dt = [], vt = []; +function un() { + var e = dt; + dt = [], fn(e); +} +function cn() { + var e = vt; + vt = [], fn(e); +} +function Gt(e) { + dt.length === 0 && queueMicrotask(un), dt.push(e); +} +function Di(e) { + vt.length === 0 && Li(cn), vt.push(e); +} +function Ur() { + dt.length > 0 && un(), vt.length > 0 && cn(); +} +function dn(e) { + return e === this.v; +} +function Pi(e, t) { + return e != e ? t == t : e !== t || e !== null && typeof e == "object" || typeof e == "function"; +} +function vn(e) { + return !Pi(e, this.v); +} +function Oi(e) { + throw new Error("https://svelte.dev/e/effect_in_teardown"); +} +function zi() { + throw new Error("https://svelte.dev/e/effect_in_unowned_derived"); +} +function Fi(e) { + throw new Error("https://svelte.dev/e/effect_orphan"); +} +function Mi() { + throw new Error("https://svelte.dev/e/effect_update_depth_exceeded"); +} +function Ui() { + throw new Error("https://svelte.dev/e/hydration_failed"); +} +function ji(e) { + throw new Error("https://svelte.dev/e/props_invalid_value"); +} +function Vi() { + throw new Error("https://svelte.dev/e/state_descriptors_fixed"); +} +function Bi() { + throw new Error("https://svelte.dev/e/state_prototype_fixed"); +} +function qi() { + throw new Error("https://svelte.dev/e/state_unsafe_local_read"); +} +function Hi() { + throw new Error("https://svelte.dev/e/state_unsafe_mutation"); +} +let Wi = !1; +function ue(e, t) { + var r = { + f: 0, + // TODO ideally we could skip this altogether, but it causes type errors + v: e, + reactions: null, + equals: dn, + rv: 0, + wv: 0 + }; + return r; +} +function He(e) { + return /* @__PURE__ */ Yi(ue(e)); +} +// @__NO_SIDE_EFFECTS__ +function hn(e, t = !1) { + const r = ue(e); + return t || (r.equals = vn), r; +} +// @__NO_SIDE_EFFECTS__ +function Yi(e) { + return k !== null && !ae && (k.f & oe) !== 0 && (ce === null ? Qi([e]) : ce.push(e)), e; +} +function P(e, t) { + return k !== null && !ae && Dn() && (k.f & (oe | Yt)) !== 0 && // If the source was created locally within the current derived, then + // we allow the mutation. + (ce === null || !ce.includes(e)) && Hi(), Zi(e, t); +} +function Zi(e, t) { + return e.equals(t) || (e.v, e.v = t, e.wv = En(), gn(e, ye), A !== null && (A.f & K) !== 0 && (A.f & (pe | ze)) === 0 && (ge === null ? el([e]) : ge.push(e))), t; +} +function gn(e, t) { + var r = e.reactions; + if (r !== null) + for (var l = r.length, i = 0; i < l; i++) { + var a = r[i], o = a.f; + (o & ye) === 0 && (de(a, t), (o & (K | re)) !== 0 && ((o & oe) !== 0 ? gn( + /** @type {Derived} */ + a, + et + ) : Lt( + /** @type {Effect} */ + a + ))); + } +} +// @__NO_SIDE_EFFECTS__ +function De(e) { + var t = oe | ye, r = k !== null && (k.f & oe) !== 0 ? ( + /** @type {Derived} */ + k + ) : null; + return A === null || r !== null && (r.f & re) !== 0 ? t |= re : A.f |= ln, { + ctx: B, + deps: null, + effects: null, + equals: dn, + f: t, + fn: e, + reactions: null, + rv: 0, + v: ( + /** @type {V} */ + null + ), + wv: 0, + parent: r ?? A + }; +} +function _n(e) { + var t = e.effects; + if (t !== null) { + e.effects = null; + for (var r = 0; r < t.length; r += 1) + we( + /** @type {Effect} */ + t[r] + ); + } +} +function Gi(e) { + for (var t = e.parent; t !== null; ) { + if ((t.f & oe) === 0) + return ( + /** @type {Effect} */ + t + ); + t = t.parent; + } + return null; +} +function Ji(e) { + var t, r = A; + Se(Gi(e)); + try { + _n(e), t = $n(e); + } finally { + Se(r); + } + return t; +} +function mn(e) { + var t = Ji(e), r = (Ce || (e.f & re) !== 0) && e.deps !== null ? et : K; + de(e, r), e.equals(t) || (e.v = t, e.wv = En()); +} +function Tt(e) { + console.warn("https://svelte.dev/e/hydration_mismatch"); +} +let D = !1; +function Ge(e) { + D = e; +} +let O; +function Re(e) { + if (e === null) + throw Tt(), Je; + return O = e; +} +function Xe() { + return Re( + /** @type {TemplateNode} */ + /* @__PURE__ */ Te(O) + ); +} +function Z(e) { + if (D) { + if (/* @__PURE__ */ Te(O) !== null) + throw Tt(), Je; + O = e; + } +} +function Ki() { + for (var e = 0, t = O; ; ) { + if (t.nodeType === 8) { + var r = ( + /** @type {Comment} */ + t.data + ); + if (r === rn) { + if (e === 0) return t; + e -= 1; + } else (r === Wt || r === tn) && (e += 1); + } + var l = ( + /** @type {TemplateNode} */ + /* @__PURE__ */ Te(t) + ); + t.remove(), t = l; + } +} +function le(e, t = null, r) { + if (typeof e != "object" || e === null || ut in e) + return e; + const l = sn(e); + if (l !== Ti && l !== Ni) + return e; + var i = /* @__PURE__ */ new Map(), a = on(e), o = ue(0); + a && i.set("length", ue( + /** @type {any[]} */ + e.length + )); + var f; + return new Proxy( + /** @type {any} */ + e, + { + defineProperty(s, c, v) { + (!("value" in v) || v.configurable === !1 || v.enumerable === !1 || v.writable === !1) && Vi(); + var h = i.get(c); + return h === void 0 ? (h = ue(v.value), i.set(c, h)) : P(h, le(v.value, f)), !0; + }, + deleteProperty(s, c) { + var v = i.get(c); + if (v === void 0) + c in s && i.set(c, ue(W)); + else { + if (a && typeof c == "string") { + var h = ( + /** @type {Source} */ + i.get("length") + ), g = Number(c); + Number.isInteger(g) && g < h.v && P(h, g); + } + P(v, W), jr(o); + } + return !0; + }, + get(s, c, v) { + var w; + if (c === ut) + return e; + var h = i.get(c), g = c in s; + if (h === void 0 && (!g || (w = Pe(s, c)) != null && w.writable) && (h = ue(le(g ? s[c] : W, f)), i.set(c, h)), h !== void 0) { + var m = d(h); + return m === W ? void 0 : m; + } + return Reflect.get(s, c, v); + }, + getOwnPropertyDescriptor(s, c) { + var v = Reflect.getOwnPropertyDescriptor(s, c); + if (v && "value" in v) { + var h = i.get(c); + h && (v.value = d(h)); + } else if (v === void 0) { + var g = i.get(c), m = g == null ? void 0 : g.v; + if (g !== void 0 && m !== W) + return { + enumerable: !0, + configurable: !0, + value: m, + writable: !0 + }; + } + return v; + }, + has(s, c) { + var m; + if (c === ut) + return !0; + var v = i.get(c), h = v !== void 0 && v.v !== W || Reflect.has(s, c); + if (v !== void 0 || A !== null && (!h || (m = Pe(s, c)) != null && m.writable)) { + v === void 0 && (v = ue(h ? le(s[c], f) : W), i.set(c, v)); + var g = d(v); + if (g === W) + return !1; + } + return h; + }, + set(s, c, v, h) { + var F; + var g = i.get(c), m = c in s; + if (a && c === "length") + for (var w = v; w < /** @type {Source} */ + g.v; w += 1) { + var z = i.get(w + ""); + z !== void 0 ? P(z, W) : w in s && (z = ue(W), i.set(w + "", z)); + } + g === void 0 ? (!m || (F = Pe(s, c)) != null && F.writable) && (g = ue(void 0), P(g, le(v, f)), i.set(c, g)) : (m = g.v !== W, P(g, le(v, f))); + var T = Reflect.getOwnPropertyDescriptor(s, c); + if (T != null && T.set && T.set.call(h, v), !m) { + if (a && typeof c == "string") { + var Y = ( + /** @type {Source} */ + i.get("length") + ), M = Number(c); + Number.isInteger(M) && M >= Y.v && P(Y, M + 1); + } + jr(o); + } + return !0; + }, + ownKeys(s) { + d(o); + var c = Reflect.ownKeys(s).filter((g) => { + var m = i.get(g); + return m === void 0 || m.v !== W; + }); + for (var [v, h] of i) + h.v !== W && !(v in s) && c.push(v); + return c; + }, + setPrototypeOf() { + Bi(); + } + } + ); +} +function jr(e, t = 1) { + P(e, e.v + t); +} +var Vr, wn, pn, yn; +function jt() { + if (Vr === void 0) { + Vr = window, wn = /Firefox/.test(navigator.userAgent); + var e = Element.prototype, t = Node.prototype; + pn = Pe(t, "firstChild").get, yn = Pe(t, "nextSibling").get, e.__click = void 0, e.__className = void 0, e.__attributes = null, e.__style = void 0, e.__e = void 0, Text.prototype.__t = void 0; + } +} +function Jt(e = "") { + return document.createTextNode(e); +} +// @__NO_SIDE_EFFECTS__ +function me(e) { + return pn.call(e); +} +// @__NO_SIDE_EFFECTS__ +function Te(e) { + return yn.call(e); +} +function G(e, t) { + if (!D) + return /* @__PURE__ */ me(e); + var r = ( + /** @type {TemplateNode} */ + /* @__PURE__ */ me(O) + ); + return r === null && (r = O.appendChild(Jt())), Re(r), r; +} +function Br(e, t) { + if (!D) { + var r = ( + /** @type {DocumentFragment} */ + /* @__PURE__ */ me( + /** @type {Node} */ + e + ) + ); + return r instanceof Comment && r.data === "" ? /* @__PURE__ */ Te(r) : r; + } + return O; +} +function he(e, t = 1, r = !1) { + let l = D ? O : e; + for (var i; t--; ) + i = l, l = /** @type {TemplateNode} */ + /* @__PURE__ */ Te(l); + if (!D) + return l; + var a = l == null ? void 0 : l.nodeType; + if (r && a !== 3) { + var o = Jt(); + return l === null ? i == null || i.after(o) : l.before(o), Re(o), o; + } + return Re(l), /** @type {TemplateNode} */ + l; +} +function Xi(e) { + e.textContent = ""; +} +let wt = !1, $t = !1, kt = null, Oe = !1, Kt = !1; +function qr(e) { + Kt = e; +} +let ct = []; +let k = null, ae = !1; +function Ie(e) { + k = e; +} +let A = null; +function Se(e) { + A = e; +} +let ce = null; +function Qi(e) { + ce = e; +} +let V = null, J = 0, ge = null; +function el(e) { + ge = e; +} +let bn = 1, Ct = 0, Ce = !1; +function En() { + return ++bn; +} +function ht(e) { + var h; + var t = e.f; + if ((t & ye) !== 0) + return !0; + if ((t & et) !== 0) { + var r = e.deps, l = (t & re) !== 0; + if (r !== null) { + var i, a, o = (t & bt) !== 0, f = l && A !== null && !Ce, s = r.length; + if (o || f) { + var c = ( + /** @type {Derived} */ + e + ), v = c.parent; + for (i = 0; i < s; i++) + a = r[i], (o || !((h = a == null ? void 0 : a.reactions) != null && h.includes(c))) && (a.reactions ?? (a.reactions = [])).push(c); + o && (c.f ^= bt), f && v !== null && (v.f & re) === 0 && (c.f ^= re); + } + for (i = 0; i < s; i++) + if (a = r[i], ht( + /** @type {Derived} */ + a + ) && mn( + /** @type {Derived} */ + a + ), a.wv > e.wv) + return !0; + } + (!l || A !== null && !Ce) && de(e, K); + } + return !1; +} +function tl(e, t) { + for (var r = t; r !== null; ) { + if ((r.f & yt) !== 0) + try { + r.fn(e); + return; + } catch { + r.f ^= yt; + } + r = r.parent; + } + throw wt = !1, e; +} +function rl(e) { + return (e.f & St) === 0 && (e.parent === null || (e.parent.f & yt) === 0); +} +function Nt(e, t, r, l) { + if (wt) { + if (r === null && (wt = !1), rl(t)) + throw e; + return; + } + r !== null && (wt = !0); + { + tl(e, t); + return; + } +} +function xn(e, t, r = !0) { + var l = e.reactions; + if (l !== null) + for (var i = 0; i < l.length; i++) { + var a = l[i]; + (a.f & oe) !== 0 ? xn( + /** @type {Derived} */ + a, + t, + !1 + ) : t === a && (r ? de(a, ye) : (a.f & K) !== 0 && de(a, et), Lt( + /** @type {Effect} */ + a + )); + } +} +function $n(e) { + var m; + var t = V, r = J, l = ge, i = k, a = Ce, o = ce, f = B, s = ae, c = e.f; + V = /** @type {null | Value[]} */ + null, J = 0, ge = null, Ce = (c & re) !== 0 && (ae || !Oe || k === null), k = (c & (pe | ze)) === 0 ? e : null, ce = null, Wr(e.ctx), ae = !1, Ct++; + try { + var v = ( + /** @type {Function} */ + (0, e.fn)() + ), h = e.deps; + if (V !== null) { + var g; + if (At(e, J), h !== null && J > 0) + for (h.length = J + V.length, g = 0; g < V.length; g++) + h[J + g] = V[g]; + else + e.deps = h = V; + if (!Ce) + for (g = J; g < h.length; g++) + ((m = h[g]).reactions ?? (m.reactions = [])).push(e); + } else h !== null && J < h.length && (At(e, J), h.length = J); + if (Dn() && ge !== null && !ae && h !== null && (e.f & (oe | et | ye)) === 0) + for (g = 0; g < /** @type {Source[]} */ + ge.length; g++) + xn( + ge[g], + /** @type {Effect} */ + e + ); + return i !== null && Ct++, v; + } finally { + V = t, J = r, ge = l, k = i, Ce = a, ce = o, Wr(f), ae = s; + } +} +function nl(e, t) { + let r = t.reactions; + if (r !== null) { + var l = Ri.call(r, e); + if (l !== -1) { + var i = r.length - 1; + i === 0 ? r = t.reactions = null : (r[l] = r[i], r.pop()); + } + } + r === null && (t.f & oe) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear + // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps` + // allows us to skip the expensive work of disconnecting and immediately reconnecting it + (V === null || !V.includes(t)) && (de(t, et), (t.f & (re | bt)) === 0 && (t.f ^= bt), _n( + /** @type {Derived} **/ + t + ), At( + /** @type {Derived} **/ + t, + 0 + )); +} +function At(e, t) { + var r = e.deps; + if (r !== null) + for (var l = t; l < r.length; l++) + nl(e, r[l]); +} +function Xt(e) { + var t = e.f; + if ((t & St) === 0) { + de(e, K); + var r = A, l = B, i = Oe; + A = e, Oe = !0; + try { + (t & Yt) !== 0 ? hl(e) : An(e), Cn(e); + var a = $n(e); + e.teardown = typeof a == "function" ? a : null, e.wv = bn; + var o = e.deps, f; + Mr && Wi && e.f & ye; + } catch (s) { + Nt(s, e, r, l || e.ctx); + } finally { + Oe = i, A = r; + } + } +} +function il() { + try { + Mi(); + } catch (e) { + if (kt !== null) + Nt(e, kt, null); + else + throw e; + } +} +function kn() { + var e = Oe; + try { + var t = 0; + for (Oe = !0; ct.length > 0; ) { + t++ > 1e3 && il(); + var r = ct, l = r.length; + ct = []; + for (var i = 0; i < l; i++) { + var a = al(r[i]); + ll(a); + } + } + } finally { + $t = !1, Oe = e, kt = null; + } +} +function ll(e) { + var t = e.length; + if (t !== 0) + for (var r = 0; r < t; r++) { + var l = e[r]; + if ((l.f & (St | Ke)) === 0) + try { + ht(l) && (Xt(l), l.deps === null && l.first === null && l.nodes_start === null && (l.teardown === null ? Rn(l) : l.fn = null)); + } catch (i) { + Nt(i, l, null, l.ctx); + } + } +} +function Lt(e) { + $t || ($t = !0, queueMicrotask(kn)); + for (var t = kt = e; t.parent !== null; ) { + t = t.parent; + var r = t.f; + if ((r & (ze | pe)) !== 0) { + if ((r & K) === 0) return; + t.f ^= K; + } + } + ct.push(t); +} +function al(e) { + for (var t = [], r = e; r !== null; ) { + var l = r.f, i = (l & (pe | ze)) !== 0, a = i && (l & K) !== 0; + if (!a && (l & Ke) === 0) { + if ((l & nn) !== 0) + t.push(r); + else if (i) + r.f ^= K; + else { + var o = k; + try { + k = r, ht(r) && Xt(r); + } catch (c) { + Nt(c, r, null, r.ctx); + } finally { + k = o; + } + } + var f = r.first; + if (f !== null) { + r = f; + continue; + } + } + var s = r.parent; + for (r = r.next; r === null && s !== null; ) + r = s.next, s = s.parent; + } + return t; +} +function $(e) { + var t; + for (Ur(); ct.length > 0; ) + $t = !0, kn(), Ur(); + return ( + /** @type {T} */ + t + ); +} +async function ol() { + await Promise.resolve(), $(); +} +function d(e) { + var t = e.f, r = (t & oe) !== 0; + if (k !== null && !ae) { + ce !== null && ce.includes(e) && qi(); + var l = k.deps; + e.rv < Ct && (e.rv = Ct, V === null && l !== null && l[J] === e ? J++ : V === null ? V = [e] : (!Ce || !V.includes(e)) && V.push(e)); + } else if (r && /** @type {Derived} */ + e.deps === null && /** @type {Derived} */ + e.effects === null) { + var i = ( + /** @type {Derived} */ + e + ), a = i.parent; + a !== null && (a.f & re) === 0 && (i.f ^= re); + } + return r && (i = /** @type {Derived} */ + e, ht(i) && mn(i)), e.v; +} +function Qe(e) { + var t = ae; + try { + return ae = !0, e(); + } finally { + ae = t; + } +} +const sl = -7169; +function de(e, t) { + e.f = e.f & sl | t; +} +function fl(e) { + A === null && k === null && Fi(), k !== null && (k.f & re) !== 0 && A === null && zi(), Kt && Oi(); +} +function ul(e, t) { + var r = t.last; + r === null ? t.last = t.first = e : (r.next = e, e.prev = r, t.last = e); +} +function Fe(e, t, r, l = !0) { + var i = A, a = { + ctx: B, + deps: null, + nodes_start: null, + nodes_end: null, + f: e | ye, + first: null, + fn: t, + last: null, + next: null, + parent: i, + prev: null, + teardown: null, + transitions: null, + wv: 0 + }; + if (r) + try { + Xt(a), a.f |= ki; + } catch (s) { + throw we(a), s; + } + else t !== null && Lt(a); + var o = r && a.deps === null && a.first === null && a.nodes_start === null && a.teardown === null && (a.f & (ln | yt)) === 0; + if (!o && l && (i !== null && ul(a, i), k !== null && (k.f & oe) !== 0)) { + var f = ( + /** @type {Derived} */ + k + ); + (f.effects ?? (f.effects = [])).push(a); + } + return a; +} +function cl(e) { + const t = Fe(It, null, !1); + return de(t, K), t.teardown = e, t; +} +function Vt(e) { + fl(); + var t = A !== null && (A.f & pe) !== 0 && B !== null && !B.m; + if (t) { + var r = ( + /** @type {ComponentContext} */ + B + ); + (r.e ?? (r.e = [])).push({ + fn: e, + effect: A, + reaction: k + }); + } else { + var l = Qt(e); + return l; + } +} +function dl(e) { + const t = Fe(ze, e, !0); + return () => { + we(t); + }; +} +function vl(e) { + const t = Fe(ze, e, !0); + return (r = {}) => new Promise((l) => { + r.outro ? Bt(t, () => { + we(t), l(void 0); + }) : (we(t), l(void 0)); + }); +} +function Qt(e) { + return Fe(nn, e, !1); +} +function er(e) { + return Fe(It, e, !0); +} +function We(e, t = [], r = De) { + const l = t.map(r); + return tr(() => e(...l.map(d))); +} +function tr(e, t = 0) { + return Fe(It | Yt | t, e, !0); +} +function Rt(e, t = !0) { + return Fe(It | pe, e, !0, t); +} +function Cn(e) { + var t = e.teardown; + if (t !== null) { + const r = Kt, l = k; + qr(!0), Ie(null); + try { + t.call(null); + } finally { + qr(r), Ie(l); + } + } +} +function An(e, t = !1) { + var r = e.first; + for (e.first = e.last = null; r !== null; ) { + var l = r.next; + (r.f & ze) !== 0 ? r.parent = null : we(r, t), r = l; + } +} +function hl(e) { + for (var t = e.first; t !== null; ) { + var r = t.next; + (t.f & pe) === 0 && we(t), t = r; + } +} +function we(e, t = !0) { + var r = !1; + if ((t || (e.f & Ci) !== 0) && e.nodes_start !== null) { + for (var l = e.nodes_start, i = e.nodes_end; l !== null; ) { + var a = l === i ? null : ( + /** @type {TemplateNode} */ + /* @__PURE__ */ Te(l) + ); + l.remove(), l = a; + } + r = !0; + } + An(e, t && !r), At(e, 0), de(e, St); + var o = e.transitions; + if (o !== null) + for (const s of o) + s.stop(); + Cn(e); + var f = e.parent; + f !== null && f.first !== null && Rn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes_start = e.nodes_end = null; +} +function Rn(e) { + var t = e.parent, r = e.prev, l = e.next; + r !== null && (r.next = l), l !== null && (l.prev = r), t !== null && (t.first === e && (t.first = l), t.last === e && (t.last = r)); +} +function Bt(e, t) { + var r = []; + In(e, r, !0), gl(r, () => { + we(e), t && t(); + }); +} +function gl(e, t) { + var r = e.length; + if (r > 0) { + var l = () => --r || t(); + for (var i of e) + i.out(l); + } else + t(); +} +function In(e, t, r) { + if ((e.f & Ke) === 0) { + if (e.f ^= Ke, e.transitions !== null) + for (const o of e.transitions) + (o.is_global || r) && t.push(o); + for (var l = e.first; l !== null; ) { + var i = l.next, a = (l.f & Zt) !== 0 || (l.f & pe) !== 0; + In(l, t, a ? r : !1), l = i; + } + } +} +function Hr(e) { + Sn(e, !0); +} +function Sn(e, t) { + if ((e.f & Ke) !== 0) { + e.f ^= Ke, (e.f & K) === 0 && (e.f ^= K), ht(e) && (de(e, ye), Lt(e)); + for (var r = e.first; r !== null; ) { + var l = r.next, i = (r.f & Zt) !== 0 || (r.f & pe) !== 0; + Sn(r, i ? t : !1), r = l; + } + if (e.transitions !== null) + for (const a of e.transitions) + (a.is_global || t) && a.in(); + } +} +function Tn(e) { + throw new Error("https://svelte.dev/e/lifecycle_outside_component"); +} +let B = null; +function Wr(e) { + B = e; +} +function Nn(e, t = !1, r) { + B = { + p: B, + c: null, + e: null, + m: !1, + s: e, + x: null, + l: null + }; +} +function Ln(e) { + const t = B; + if (t !== null) { + e !== void 0 && (t.x = e); + const o = t.e; + if (o !== null) { + var r = A, l = k; + t.e = null; + try { + for (var i = 0; i < o.length; i++) { + var a = o[i]; + Se(a.effect), Ie(a.reaction), Qt(a.fn); + } + } finally { + Se(r), Ie(l); + } + } + B = t.p, t.m = !0; + } + return e || /** @type {T} */ + {}; +} +function Dn() { + return !0; +} +const _l = ["touchstart", "touchmove"]; +function ml(e) { + return _l.includes(e); +} +let Yr = !1; +function Pn() { + Yr || (Yr = !0, document.addEventListener( + "reset", + (e) => { + Promise.resolve().then(() => { + var t; + if (!e.defaultPrevented) + for ( + const r of + /**@type {HTMLFormElement} */ + e.target.elements + ) + (t = r.__on_r) == null || t.call(r); + }); + }, + // In the capture phase to guarantee we get noticed of it (no possiblity of stopPropagation) + { capture: !0 } + )); +} +function On(e) { + var t = k, r = A; + Ie(null), Se(null); + try { + return e(); + } finally { + Ie(t), Se(r); + } +} +function wl(e, t, r, l = r) { + e.addEventListener(t, () => On(r)); + const i = e.__on_r; + i ? e.__on_r = () => { + i(), l(!0); + } : e.__on_r = () => l(!0), Pn(); +} +const zn = /* @__PURE__ */ new Set(), qt = /* @__PURE__ */ new Set(); +function pl(e, t, r, l = {}) { + function i(a) { + if (l.capture || ft.call(t, a), !a.cancelBubble) + return On(() => r == null ? void 0 : r.call(this, a)); + } + return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Gt(() => { + t.addEventListener(e, i, l); + }) : t.addEventListener(e, i, l), i; +} +function yl(e, t, r, l, i) { + var a = { capture: l, passive: i }, o = pl(e, t, r, a); + (t === document.body || t === window || t === document) && cl(() => { + t.removeEventListener(e, o, a); + }); +} +function bl(e) { + for (var t = 0; t < e.length; t++) + zn.add(e[t]); + for (var r of qt) + r(e); +} +function ft(e) { + var M; + var t = this, r = ( + /** @type {Node} */ + t.ownerDocument + ), l = e.type, i = ((M = e.composedPath) == null ? void 0 : M.call(e)) || [], a = ( + /** @type {null | Element} */ + i[0] || e.target + ), o = 0, f = e.__root; + if (f) { + var s = i.indexOf(f); + if (s !== -1 && (t === document || t === /** @type {any} */ + window)) { + e.__root = t; + return; + } + var c = i.indexOf(t); + if (c === -1) + return; + s <= c && (o = s); + } + if (a = /** @type {Element} */ + i[o] || e.target, a !== t) { + xt(e, "currentTarget", { + configurable: !0, + get() { + return a || r; + } + }); + var v = k, h = A; + Ie(null), Se(null); + try { + for (var g, m = []; a !== null; ) { + var w = a.assignedSlot || a.parentNode || /** @type {any} */ + a.host || null; + try { + var z = a["__" + l]; + if (z != null && (!/** @type {any} */ + a.disabled || // DOM could've been updated already by the time this is reached, so we check this as well + // -> the target could not have been disabled because it emits the event in the first place + e.target === a)) + if (on(z)) { + var [T, ...Y] = z; + T.apply(a, [e, ...Y]); + } else + z.call(a, e); + } catch (F) { + g ? m.push(F) : g = F; + } + if (e.cancelBubble || w === t || w === null) + break; + a = w; + } + if (g) { + for (let F of m) + queueMicrotask(() => { + throw F; + }); + throw g; + } + } finally { + e.__root = t, delete e.currentTarget, Ie(v), Se(h); + } + } +} +function rr(e) { + var t = document.createElement("template"); + return t.innerHTML = e, t.content; +} +function Ae(e, t) { + var r = ( + /** @type {Effect} */ + A + ); + r.nodes_start === null && (r.nodes_start = e, r.nodes_end = t); +} +// @__NO_SIDE_EFFECTS__ +function ve(e, t) { + var r = (t & Ei) !== 0, l = (t & xi) !== 0, i, a = !e.startsWith(""); + return () => { + if (D) + return Ae(O, null), O; + i === void 0 && (i = rr(a ? e : "" + e), r || (i = /** @type {Node} */ + /* @__PURE__ */ me(i))); + var o = ( + /** @type {TemplateNode} */ + l || wn ? document.importNode(i, !0) : i.cloneNode(!0) + ); + if (r) { + var f = ( + /** @type {TemplateNode} */ + /* @__PURE__ */ me(o) + ), s = ( + /** @type {TemplateNode} */ + o.lastChild + ); + Ae(f, s); + } else + Ae(o, o); + return o; + }; +} +// @__NO_SIDE_EFFECTS__ +function El(e, t, r = "svg") { + var l = !e.startsWith(""), i = `<${r}>${l ? e : "" + e}`, a; + return () => { + if (D) + return Ae(O, null), O; + if (!a) { + var o = ( + /** @type {DocumentFragment} */ + rr(i) + ), f = ( + /** @type {Element} */ + /* @__PURE__ */ me(o) + ); + a = /** @type {Element} */ + /* @__PURE__ */ me(f); + } + var s = ( + /** @type {TemplateNode} */ + a.cloneNode(!0) + ); + return Ae(s, s), s; + }; +} +function ee(e, t) { + if (D) { + A.nodes_end = O, Xe(); + return; + } + e !== null && e.before( + /** @type {Node} */ + t + ); +} +function Fn(e, t) { + return Mn(e, t); +} +function xl(e, t) { + jt(), t.intro = t.intro ?? !1; + const r = t.target, l = D, i = O; + try { + for (var a = ( + /** @type {TemplateNode} */ + /* @__PURE__ */ me(r) + ); a && (a.nodeType !== 8 || /** @type {Comment} */ + a.data !== Wt); ) + a = /** @type {TemplateNode} */ + /* @__PURE__ */ Te(a); + if (!a) + throw Je; + Ge(!0), Re( + /** @type {Comment} */ + a + ), Xe(); + const o = Mn(e, { ...t, anchor: a }); + if (O === null || O.nodeType !== 8 || /** @type {Comment} */ + O.data !== rn) + throw Tt(), Je; + return Ge(!1), /** @type {Exports} */ + o; + } catch (o) { + if (o === Je) + return t.recover === !1 && Ui(), jt(), Xi(r), Ge(!1), Fn(e, t); + throw o; + } finally { + Ge(l), Re(i); + } +} +const Ye = /* @__PURE__ */ new Map(); +function Mn(e, { target: t, anchor: r, props: l = {}, events: i, context: a, intro: o = !0 }) { + jt(); + var f = /* @__PURE__ */ new Set(), s = (h) => { + for (var g = 0; g < h.length; g++) { + var m = h[g]; + if (!f.has(m)) { + f.add(m); + var w = ml(m); + t.addEventListener(m, ft, { passive: w }); + var z = Ye.get(m); + z === void 0 ? (document.addEventListener(m, ft, { passive: w }), Ye.set(m, 1)) : Ye.set(m, z + 1); + } + } + }; + s(Ii(zn)), qt.add(s); + var c = void 0, v = vl(() => { + var h = r ?? t.appendChild(Jt()); + return Rt(() => { + if (a) { + Nn({}); + var g = ( + /** @type {ComponentContext} */ + B + ); + g.c = a; + } + i && (l.$$events = i), D && Ae( + /** @type {TemplateNode} */ + h, + null + ), c = e(h, l) || {}, D && (A.nodes_end = O), a && Ln(); + }), () => { + var w; + for (var g of f) { + t.removeEventListener(g, ft); + var m = ( + /** @type {number} */ + Ye.get(g) + ); + --m === 0 ? (document.removeEventListener(g, ft), Ye.delete(g)) : Ye.set(g, m); + } + qt.delete(s), h !== r && ((w = h.parentNode) == null || w.removeChild(h)); + }; + }); + return Ht.set(c, v), c; +} +let Ht = /* @__PURE__ */ new WeakMap(); +function $l(e, t) { + const r = Ht.get(e); + return r ? (Ht.delete(e), r(t)) : Promise.resolve(); +} +function ke(e, t, [r, l] = [0, 0]) { + D && r === 0 && Xe(); + var i = e, a = null, o = null, f = W, s = r > 0 ? Zt : 0, c = !1; + const v = (g, m = !0) => { + c = !0, h(m, g); + }, h = (g, m) => { + if (f === (f = g)) return; + let w = !1; + if (D && l !== -1) { + if (r === 0) { + const T = ( + /** @type {Comment} */ + i.data + ); + T === Wt ? l = 0 : T === tn ? l = 1 / 0 : (l = parseInt(T.substring(1)), l !== l && (l = f ? 1 / 0 : -1)); + } + const z = l > r; + !!f === z && (i = Ki(), Re(i), Ge(!1), w = !0, l = -1); + } + f ? (a ? Hr(a) : m && (a = Rt(() => m(i))), o && Bt(o, () => { + o = null; + })) : (o ? Hr(o) : m && (o = Rt(() => m(i, [r + 1, l]))), a && Bt(a, () => { + a = null; + })), w && Ge(!0); + }; + tr(() => { + c = !1, t(v), c || h(null, null); + }, s), D && (i = O); +} +function Ze(e, t, r, l, i) { + var a = e, o = "", f; + tr(() => { + if (o === (o = t() ?? "")) { + D && Xe(); + return; + } + f !== void 0 && (we(f), f = void 0), o !== "" && (f = Rt(() => { + if (D) { + O.data; + for (var s = Xe(), c = s; s !== null && (s.nodeType !== 8 || /** @type {Comment} */ + s.data !== ""); ) + c = s, s = /** @type {TemplateNode} */ + /* @__PURE__ */ Te(s); + if (s === null) + throw Tt(), Je; + Ae(O, c), a = Re(s); + return; + } + var v = o + "", h = rr(v); + Ae( + /** @type {TemplateNode} */ + /* @__PURE__ */ me(h), + /** @type {TemplateNode} */ + h.lastChild + ), a.before(h); + })); + }); +} +function kl(e, t, r, l, i) { + var f; + D && Xe(); + var a = (f = t.$$slots) == null ? void 0 : f[r], o = !1; + a === !0 && (a = t.children, o = !0), a === void 0 || a(e, o ? () => l : l); +} +function Cl(e, t) { + Gt(() => { + var r = e.getRootNode(), l = ( + /** @type {ShadowRoot} */ + r.host ? ( + /** @type {ShadowRoot} */ + r + ) : ( + /** @type {Document} */ + r.head ?? /** @type {Document} */ + r.ownerDocument.head + ) + ); + if (!l.querySelector("#" + t.hash)) { + const i = document.createElement("style"); + i.id = t.hash, i.textContent = t.code, l.appendChild(i); + } + }); +} +const Zr = [...` +\r\f \v\uFEFF`]; +function Al(e, t, r) { + var l = "" + e; + if (r) { + for (var i in r) + if (r[i]) + l = l ? l + " " + i : i; + else if (l.length) + for (var a = i.length, o = 0; (o = l.indexOf(i, o)) >= 0; ) { + var f = o + a; + (o === 0 || Zr.includes(l[o - 1])) && (f === l.length || Zr.includes(l[f])) ? l = (o === 0 ? "" : l.substring(0, o)) + l.substring(f + 1) : o = f; + } + } + return l === "" ? null : l; +} +function Rl(e, t, r, l, i, a) { + var o = e.__className; + if (D || o !== r) { + var f = Al(r, l, a); + (!D || f !== e.getAttribute("class")) && (f == null ? e.removeAttribute("class") : e.className = f), e.__className = r; + } else if (a && i !== a) + for (var s in a) { + var c = !!a[s]; + (i == null || c !== !!i[s]) && e.classList.toggle(s, c); + } + return a; +} +const Il = Symbol("is custom element"), Sl = Symbol("is html"); +function Gr(e) { + if (D) { + var t = !1, r = () => { + if (!t) { + if (t = !0, e.hasAttribute("value")) { + var l = e.value; + ie(e, "value", null), e.value = l; + } + if (e.hasAttribute("checked")) { + var i = e.checked; + ie(e, "checked", null), e.checked = i; + } + } + }; + e.__on_r = r, Di(r), Pn(); + } +} +function Tl(e, t) { + var r = Un(e); + r.value === (r.value = // treat null and undefined the same for the initial value + t ?? void 0) || // @ts-expect-error + // `progress` elements always need their value set when it's `0` + e.value === t && (t !== 0 || e.nodeName !== "PROGRESS") || (e.value = t ?? ""); +} +function ie(e, t, r, l) { + var i = Un(e); + D && (i[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === "LINK") || i[t] !== (i[t] = r) && (t === "loading" && (e[Ai] = r), r == null ? e.removeAttribute(t) : typeof r != "string" && Nl(e).includes(t) ? e[t] = r : e.setAttribute(t, r)); +} +function Un(e) { + return ( + /** @type {Record} **/ + // @ts-expect-error + e.__attributes ?? (e.__attributes = { + [Il]: e.nodeName.includes("-"), + [Sl]: e.namespaceURI === $i + }) + ); +} +var Jr = /* @__PURE__ */ new Map(); +function Nl(e) { + var t = Jr.get(e.nodeName); + if (t) return t; + Jr.set(e.nodeName, t = []); + for (var r, l = e, i = Element.prototype; i !== l; ) { + r = Si(l); + for (var a in r) + r[a].set && t.push(a); + l = sn(l); + } + return t; +} +function Ll(e, t, r = t) { + wl(e, "change", (l) => { + var i = l ? e.defaultChecked : e.checked; + r(i); + }), // If we are hydrating and the value has since changed, + // then use the update value from the input instead. + (D && e.defaultChecked !== e.checked || // If defaultChecked is set, then checked == defaultChecked + Qe(t) == null) && r(e.checked), er(() => { + var l = t(); + e.checked = !!l; + }); +} +function Kr(e, t) { + return e === t || (e == null ? void 0 : e[ut]) === t; +} +function Xr(e = {}, t, r, l) { + return Qt(() => { + var i, a; + return er(() => { + i = a, a = [], Qe(() => { + e !== r(...a) && (t(e, ...a), i && Kr(r(...i), e) && t(null, ...i)); + }); + }), () => { + Gt(() => { + a && Kr(r(...a), e) && t(null, ...a); + }); + }; + }), e; +} +function jn(e) { + B === null && Tn(), Vt(() => { + const t = Qe(e); + if (typeof t == "function") return ( + /** @type {() => void} */ + t + ); + }); +} +function Dl(e) { + B === null && Tn(), jn(() => () => Qe(e)); +} +let mt = !1; +function Pl(e) { + var t = mt; + try { + return mt = !1, [e(), mt]; + } finally { + mt = t; + } +} +function C(e, t, r, l) { + var be; + var i = (r & wi) !== 0, a = !0, o = (r & yi) !== 0, f = (r & bi) !== 0, s = !1, c; + o ? [c, s] = Pl(() => ( + /** @type {V} */ + e[t] + )) : c = /** @type {V} */ + e[t]; + var v = ut in e || an in e, h = o && (((be = Pe(e, t)) == null ? void 0 : be.set) ?? (v && t in e && ((N) => e[t] = N))) || void 0, g = ( + /** @type {V} */ + l + ), m = !0, w = !1, z = () => (w = !0, m && (m = !1, f ? g = Qe( + /** @type {() => V} */ + l + ) : g = /** @type {V} */ + l), g); + c === void 0 && l !== void 0 && (h && a && ji(), c = z(), h && h(c)); + var T; + if (T = () => { + var N = ( + /** @type {V} */ + e[t] + ); + return N === void 0 ? z() : (m = !0, w = !1, N); + }, (r & pi) === 0) + return T; + if (h) { + var Y = e.$$legacy; + return function(N, X) { + return arguments.length > 0 ? ((!X || Y || s) && h(X ? T() : N), N) : T(); + }; + } + var M = !1, F = /* @__PURE__ */ hn(c), se = /* @__PURE__ */ De(() => { + var N = T(), X = d(F); + return M ? (M = !1, X) : F.v = N; + }); + return i || (se.equals = vn), function(N, X) { + if (arguments.length > 0) { + const U = X ? d(se) : o ? le(N) : N; + return se.equals(U) || (M = !0, P(F, U), w && g !== void 0 && (g = U), Qe(() => d(se))), N; + } + return d(se); + }; +} +function Ol(e) { + return new zl(e); +} +var _e, te; +class zl { + /** + * @param {ComponentConstructorOptions & { + * component: any; + * }} options + */ + constructor(t) { + /** @type {any} */ + Mt(this, _e); + /** @type {Record} */ + Mt(this, te); + var a; + var r = /* @__PURE__ */ new Map(), l = (o, f) => { + var s = /* @__PURE__ */ hn(f); + return r.set(o, s), s; + }; + const i = new Proxy( + { ...t.props || {}, $$events: {} }, + { + get(o, f) { + return d(r.get(f) ?? l(f, Reflect.get(o, f))); + }, + has(o, f) { + return f === an ? !0 : (d(r.get(f) ?? l(f, Reflect.get(o, f))), Reflect.has(o, f)); + }, + set(o, f, s) { + return P(r.get(f) ?? l(f, s), s), Reflect.set(o, f, s); + } + } + ); + Ut(this, te, (t.hydrate ? xl : Fn)(t.component, { + target: t.target, + anchor: t.anchor, + props: i, + context: t.context, + intro: t.intro ?? !1, + recover: t.recover + })), (!((a = t == null ? void 0 : t.props) != null && a.$$host) || t.sync === !1) && $(), Ut(this, _e, i.$$events); + for (const o of Object.keys(H(this, te))) + o === "$set" || o === "$destroy" || o === "$on" || xt(this, o, { + get() { + return H(this, te)[o]; + }, + /** @param {any} value */ + set(f) { + H(this, te)[o] = f; + }, + enumerable: !0 + }); + H(this, te).$set = /** @param {Record} next */ + (o) => { + Object.assign(i, o); + }, H(this, te).$destroy = () => { + $l(H(this, te)); + }; + } + /** @param {Record} props */ + $set(t) { + H(this, te).$set(t); + } + /** + * @param {string} event + * @param {(...args: any[]) => any} callback + * @returns {any} + */ + $on(t, r) { + H(this, _e)[t] = H(this, _e)[t] || []; + const l = (...i) => r.call(this, ...i); + return H(this, _e)[t].push(l), () => { + H(this, _e)[t] = H(this, _e)[t].filter( + /** @param {any} fn */ + (i) => i !== l + ); + }; + } + $destroy() { + H(this, te).$destroy(); + } +} +_e = new WeakMap(), te = new WeakMap(); +let Vn; +typeof HTMLElement == "function" && (Vn = class extends HTMLElement { + /** + * @param {*} $$componentCtor + * @param {*} $$slots + * @param {*} use_shadow_dom + */ + constructor(t, r, l) { + super(); + /** The Svelte component constructor */ + ne(this, "$$ctor"); + /** Slots */ + ne(this, "$$s"); + /** @type {any} The Svelte component instance */ + ne(this, "$$c"); + /** Whether or not the custom element is connected */ + ne(this, "$$cn", !1); + /** @type {Record} Component props data */ + ne(this, "$$d", {}); + /** `true` if currently in the process of reflecting component props back to attributes */ + ne(this, "$$r", !1); + /** @type {Record} Props definition (name, reflected, type etc) */ + ne(this, "$$p_d", {}); + /** @type {Record} Event listeners */ + ne(this, "$$l", {}); + /** @type {Map} Event listener unsubscribe functions */ + ne(this, "$$l_u", /* @__PURE__ */ new Map()); + /** @type {any} The managed render effect for reflecting attributes */ + ne(this, "$$me"); + this.$$ctor = t, this.$$s = r, l && this.attachShadow({ mode: "open" }); + } + /** + * @param {string} type + * @param {EventListenerOrEventListenerObject} listener + * @param {boolean | AddEventListenerOptions} [options] + */ + addEventListener(t, r, l) { + if (this.$$l[t] = this.$$l[t] || [], this.$$l[t].push(r), this.$$c) { + const i = this.$$c.$on(t, r); + this.$$l_u.set(r, i); + } + super.addEventListener(t, r, l); + } + /** + * @param {string} type + * @param {EventListenerOrEventListenerObject} listener + * @param {boolean | AddEventListenerOptions} [options] + */ + removeEventListener(t, r, l) { + if (super.removeEventListener(t, r, l), this.$$c) { + const i = this.$$l_u.get(r); + i && (i(), this.$$l_u.delete(r)); + } + } + async connectedCallback() { + if (this.$$cn = !0, !this.$$c) { + let t = function(i) { + return (a) => { + const o = document.createElement("slot"); + i !== "default" && (o.name = i), ee(a, o); + }; + }; + if (await Promise.resolve(), !this.$$cn || this.$$c) + return; + const r = {}, l = Fl(this); + for (const i of this.$$s) + i in l && (i === "default" && !this.$$d.children ? (this.$$d.children = t(i), r.default = !0) : r[i] = t(i)); + for (const i of this.attributes) { + const a = this.$$g_p(i.name); + a in this.$$d || (this.$$d[a] = pt(a, i.value, this.$$p_d, "toProp")); + } + for (const i in this.$$p_d) + !(i in this.$$d) && this[i] !== void 0 && (this.$$d[i] = this[i], delete this[i]); + this.$$c = Ol({ + component: this.$$ctor, + target: this.shadowRoot || this, + props: { + ...this.$$d, + $$slots: r, + $$host: this + } + }), this.$$me = dl(() => { + er(() => { + var i; + this.$$r = !0; + for (const a of Et(this.$$c)) { + if (!((i = this.$$p_d[a]) != null && i.reflect)) continue; + this.$$d[a] = this.$$c[a]; + const o = pt( + a, + this.$$d[a], + this.$$p_d, + "toAttribute" + ); + o == null ? this.removeAttribute(this.$$p_d[a].attribute || a) : this.setAttribute(this.$$p_d[a].attribute || a, o); + } + this.$$r = !1; + }); + }); + for (const i in this.$$l) + for (const a of this.$$l[i]) { + const o = this.$$c.$on(i, a); + this.$$l_u.set(a, o); + } + this.$$l = {}; + } + } + // We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte + // and setting attributes through setAttribute etc, this is helpful + /** + * @param {string} attr + * @param {string} _oldValue + * @param {string} newValue + */ + attributeChangedCallback(t, r, l) { + var i; + this.$$r || (t = this.$$g_p(t), this.$$d[t] = pt(t, l, this.$$p_d, "toProp"), (i = this.$$c) == null || i.$set({ [t]: this.$$d[t] })); + } + disconnectedCallback() { + this.$$cn = !1, Promise.resolve().then(() => { + !this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0); + }); + } + /** + * @param {string} attribute_name + */ + $$g_p(t) { + return Et(this.$$p_d).find( + (r) => this.$$p_d[r].attribute === t || !this.$$p_d[r].attribute && r.toLowerCase() === t + ) || t; + } +}); +function pt(e, t, r, l) { + var a; + const i = (a = r[e]) == null ? void 0 : a.type; + if (t = i === "Boolean" && typeof t != "boolean" ? t != null : t, !l || !r[e]) + return t; + if (l === "toAttribute") + switch (i) { + case "Object": + case "Array": + return t == null ? null : JSON.stringify(t); + case "Boolean": + return t ? "" : null; + case "Number": + return t ?? null; + default: + return t; + } + else + switch (i) { + case "Object": + case "Array": + return t && JSON.parse(t); + case "Boolean": + return t; + // conversion already handled above + case "Number": + return t != null ? +t : t; + default: + return t; + } +} +function Fl(e) { + const t = {}; + return e.childNodes.forEach((r) => { + t[ + /** @type {Element} node */ + r.slot || "default" + ] = !0; + }), t; +} +function Ml(e, t, r, l, i, a) { + let o = class extends Vn { + constructor() { + super(e, r, i), this.$$p_d = t; + } + static get observedAttributes() { + return Et(t).map( + (f) => (t[f].attribute || f).toLowerCase() + ); + } + }; + return Et(t).forEach((f) => { + xt(o.prototype, f, { + get() { + return this.$$c && f in this.$$c ? this.$$c[f] : this.$$d[f]; + }, + set(s) { + var h; + s = pt(f, s, t), this.$$d[f] = s; + var c = this.$$c; + if (c) { + var v = (h = Pe(c, f)) == null ? void 0 : h.get; + v ? c[f] = s : c.$set({ [f]: s }); + } + } + }); + }), l.forEach((f) => { + xt(o.prototype, f, { + get() { + var s; + return (s = this.$$c) == null ? void 0 : s[f]; + } + }); + }), e.element = /** @type {any} */ + o, o; +} +const Bn = new TextEncoder(); +function Ul(e) { + return [...new Uint8Array(e)].map((t) => t.toString(16).padStart(2, "0")).join(""); +} +async function jl(e, t = "SHA-256", r = 1e5) { + const l = Date.now().toString(16); + e || (e = Math.round(Math.random() * r)); + const i = await qn(l, e, t); + return { + algorithm: t, + challenge: i, + salt: l, + signature: "" + }; +} +async function qn(e, t, r) { + if (typeof crypto > "u" || !("subtle" in crypto) || !("digest" in crypto.subtle)) + throw new Error("Web Crypto is not available. Secure context is required (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts)."); + return Ul( + await crypto.subtle.digest( + r.toUpperCase(), + Bn.encode(e + t) + ) + ); +} +function Vl(e, t, r = "SHA-256", l = 1e6, i = 0) { + const a = new AbortController(), o = Date.now(); + return { + promise: (async () => { + for (let s = i; s <= l; s += 1) { + if (a.signal.aborted) + return null; + if (await qn(t, s, r) === e) + return { + number: s, + took: Date.now() - o + }; + } + return null; + })(), + controller: a + }; +} +function Bl() { + try { + return Intl.DateTimeFormat().resolvedOptions().timeZone; + } catch { + } +} +function ql(e) { + const t = atob(e), r = new Uint8Array(t.length); + for (let l = 0; l < t.length; l++) + r[l] = t.charCodeAt(l); + return r; +} +function Hl(e, t = 12) { + const r = new Uint8Array(t); + for (let l = 0; l < t; l++) + r[l] = e % 256, e = Math.floor(e / 256); + return r; +} +async function Wl(e, t = "", r = 1e6, l = 0) { + const i = "AES-GCM", a = new AbortController(), o = Date.now(), f = async () => { + for (let v = l; v <= r; v += 1) { + if (a.signal.aborted || !s || !c) + return null; + try { + const h = await crypto.subtle.decrypt( + { + name: i, + iv: Hl(v) + }, + s, + c + ); + if (h) + return { + clearText: new TextDecoder().decode(h), + took: Date.now() - o + }; + } catch { + } + } + return null; + }; + let s = null, c = null; + try { + c = ql(e); + const v = await crypto.subtle.digest( + "SHA-256", + Bn.encode(t) + ); + s = await crypto.subtle.importKey( + "raw", + v, + i, + !1, + ["decrypt"] + ); + } catch { + return { + promise: Promise.reject(), + controller: a + }; + } + return { + promise: f(), + controller: a + }; +} +var E = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.VERIFIED = "verified", e.VERIFYING = "verifying", e.UNVERIFIED = "unverified", e.EXPIRED = "expired", e))(E || {}), Yl = /* @__PURE__ */ El(''), Zl = /* @__PURE__ */ ve(' ', 1), Gl = /* @__PURE__ */ ve(''), Jl = /* @__PURE__ */ ve(''), Kl = /* @__PURE__ */ ve('
'), Xl = /* @__PURE__ */ ve('
'), Ql = /* @__PURE__ */ ve('
'), ea = /* @__PURE__ */ ve('
'), ta = /* @__PURE__ */ ve(''), ra = /* @__PURE__ */ ve('
'), na = /* @__PURE__ */ ve('
', 1); +const ia = { + hash: "svelte-ddsc3z", + code: `.altcha.svelte-ddsc3z {background:var(--altcha-color-base, transparent);border:var(--altcha-border-width, 1px) solid var(--altcha-color-border, #a0a0a0);border-radius:var(--altcha-border-radius, 3px);color:var(--altcha-color-text, currentColor);display:flex;flex-direction:column;max-width:var(--altcha-max-width, 260px);position:relative;text-align:left;}.altcha.svelte-ddsc3z:focus-within {border-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating].svelte-ddsc3z {background:var(--altcha-color-base, white);display:none;filter:drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.2));left:-100%;position:fixed;top:-100%;width:var(--altcha-max-width, 260px);z-index:999999;}.altcha[data-floating=top].svelte-ddsc3z .altcha-anchor-arrow:where(.svelte-ddsc3z) {border-bottom-color:transparent;border-top-color:var(--altcha-color-border, #a0a0a0);bottom:-12px;top:auto;}.altcha[data-floating=bottom].svelte-ddsc3z:focus-within::after {border-bottom-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating=top].svelte-ddsc3z:focus-within::after {border-top-color:var(--altcha-color-border-focus, currentColor);}.altcha[data-floating].svelte-ddsc3z:not([data-state=unverified]) {display:block;}.altcha-anchor-arrow.svelte-ddsc3z {border:6px solid transparent;border-bottom-color:var(--altcha-color-border, #a0a0a0);content:"";height:0;left:12px;position:absolute;top:-12px;width:0;}.altcha-main.svelte-ddsc3z {align-items:center;display:flex;gap:0.4rem;padding:0.7rem;}.altcha-label.svelte-ddsc3z {flex-grow:1;}.altcha-label.svelte-ddsc3z label:where(.svelte-ddsc3z) {cursor:pointer;}.altcha-logo.svelte-ddsc3z {color:currentColor;opacity:0.3;}.altcha-logo.svelte-ddsc3z:hover {opacity:1;}.altcha-error.svelte-ddsc3z {color:var(--altcha-color-error-text, #f23939);display:flex;font-size:0.85rem;gap:0.3rem;padding:0 0.7rem 0.7rem;}.altcha-footer.svelte-ddsc3z {align-items:center;background-color:var(--altcha-color-footer-bg, transparent);display:flex;font-size:0.75rem;opacity:0.4;padding:0.2rem 0.7rem;text-align:right;}.altcha-footer.svelte-ddsc3z:hover {opacity:1;}.altcha-footer.svelte-ddsc3z > :where(.svelte-ddsc3z):first-child {flex-grow:1;}.altcha-footer.svelte-ddsc3z a {color:currentColor;}.altcha-checkbox.svelte-ddsc3z {display:flex;align-items:center;height:24px;width:24px;}.altcha-checkbox.svelte-ddsc3z input:where(.svelte-ddsc3z) {width:18px;height:18px;margin:0;}.altcha-hidden.svelte-ddsc3z {display:none;}.altcha-spinner.svelte-ddsc3z { + animation: svelte-ddsc3z-altcha-spinner 0.75s infinite linear;transform-origin:center;} + +@keyframes svelte-ddsc3z-altcha-spinner { + 100% { + transform: rotate(360deg); + } +}` +}; +function la(e, t) { + var Lr, Dr; + Nn(t, !0), Cl(e, ia); + let r = C(t, "auto", 7, void 0), l = C(t, "blockspam", 7, void 0), i = C(t, "challengeurl", 7, void 0), a = C(t, "challengejson", 7, void 0), o = C(t, "customfetch", 7, void 0), f = C(t, "debug", 7, !1), s = C(t, "delay", 7, 0), c = C(t, "expire", 7, void 0), v = C(t, "floating", 7, void 0), h = C(t, "floatinganchor", 7, void 0), g = C(t, "floatingoffset", 7, void 0), m = C(t, "hidefooter", 7, !1), w = C(t, "hidelogo", 7, !1), z = C(t, "id", 7, void 0), T = C(t, "name", 7, "altcha"), Y = C(t, "maxnumber", 7, 1e6), M = C(t, "mockerror", 7, !1), F = C(t, "obfuscated", 7, void 0), se = C(t, "plugins", 7, void 0), be = C(t, "refetchonexpire", 7, !0), N = C(t, "spamfilter", 7, !1), X = C(t, "strings", 7, void 0), U = C(t, "test", 7, !1), Ee = C(t, "verifyurl", 7, void 0), Me = C(t, "workers", 23, () => Math.min(16, navigator.hardwareConcurrency || 8)), tt = C(t, "workerurl", 7, void 0); + const nr = ["SHA-256", "SHA-384", "SHA-512"], ir = "Visit Altcha.org", lr = "https://altcha.org/", rt = (n, u) => { + t.$$host.dispatchEvent(new CustomEvent(n, { detail: u })); + }, ar = (Dr = (Lr = document.documentElement.lang) == null ? void 0 : Lr.split("-")) == null ? void 0 : Dr[0], Dt = /* @__PURE__ */ De(() => { + var n; + return i() && new URL(i(), location.origin).host.endsWith(".altcha.org") && !!((n = i()) != null && n.includes("apiKey=ckey_")); + }), Pt = /* @__PURE__ */ De(() => a() ? wr(a()) : void 0), or = /* @__PURE__ */ De(() => X() ? wr(X()) : {}), Q = /* @__PURE__ */ De(() => { + var n; + return { + ariaLinkLabel: ir, + error: "Verification failed. Try again later.", + expired: "Verification expired. Try again.", + footer: `Protected by ALTCHA`, + label: "I'm not a robot", + verified: "Verified", + verifying: "Verifying...", + waitAlert: "Verifying... please wait.", + ...d(or) + }; + }), sr = /* @__PURE__ */ De(() => z() || `${T()}_checkbox`); + let Ue = He(!1), R = He(le(E.UNVERIFIED)), j = He(void 0), nt = He(null), je = null, y = null, Ve = He(null), fe = null, xe = [], Ne = He(null); + Vt(() => { + Xn(d(Ve)); + }), Vt(() => { + Qn(d(R)); + }), Dl(() => { + Hn(), y && (y.removeEventListener("submit", hr), y.removeEventListener("reset", gr), y.removeEventListener("focusin", vr), y = null), fe && (clearTimeout(fe), fe = null), document.removeEventListener("click", cr), document.removeEventListener("scroll", dr), window.removeEventListener("resize", mr); + }), jn(() => { + var n; + I("mounted", "1.3.0"), I("workers", Me()), Jn(), I("plugins", xe.length ? xe.map((u) => u.constructor.pluginName).join(", ") : "none"), U() && I("using test mode"), c() && Ot(c()), r() !== void 0 && I("auto", r()), v() !== void 0 && pr(v()), y = (n = d(j)) == null ? void 0 : n.closest("form"), y && (y.addEventListener("submit", hr, { capture: !0 }), y.addEventListener("reset", gr), r() === "onfocus" && y.addEventListener("focusin", vr)), r() === "onload" && (F() ? it() : $e()), d(Dt) && (m() || w()) && I("Attributes hidefooter and hidelogo ignored because usage with free API Keys requires attribution."), requestAnimationFrame(() => { + rt("load"); + }); + }); + function fr(n, u) { + return btoa(JSON.stringify({ + algorithm: n.algorithm, + challenge: n.challenge, + number: u.number, + salt: n.salt, + signature: n.signature, + test: U() ? !0 : void 0, + took: u.took + })); + } + function Hn() { + for (const n of xe) + n.destroy(); + } + function ur() { + i() && be() && d(R) === E.VERIFIED ? $e() : lt(E.EXPIRED, d(Q).expired); + } + async function Wn() { + var n; + if (M()) + throw I("mocking error"), new Error("Mocked error."); + if (d(Pt)) + return I("using provided json data"), d(Pt); + if (U()) + return I("generating test challenge", { test: U() }), jl(typeof U() != "boolean" ? +U() : void 0); + { + if (!i() && y) { + const L = y.getAttribute("action"); + L != null && L.includes("/form/") && i(L + "/altcha"); + } + if (!i()) + throw new Error("Attribute challengeurl not set."); + I("fetching challenge from", i()); + let u = null, _ = null; + if (o()) + if (I("using customfetch"), typeof o() == "string") { + if (u = globalThis[o()] || null, !u) + throw new Error(`Custom fetch function not found: ${o()}`); + } else + u = o(); + const b = { + headers: N() !== !1 ? { "x-altcha-spam-filter": "1" } : {} + }; + if (u) { + if (_ = await u(i(), b), !_ || !(_ instanceof Response)) + throw new Error("Custom fetch function did not return a response."); + } else + _ = await fetch(i(), b); + if (_.status !== 200) + throw new Error(`Server responded with ${_.status}.`); + const S = _.headers.get("X-Altcha-Config"), x = await _.json(), p = new URLSearchParams((n = x.salt.split("?")) == null ? void 0 : n[1]), q = p.get("expires") || p.get("expire"); + if (q) { + const L = new Date(+q * 1e3), qe = isNaN(L.getTime()) ? 0 : L.getTime() - Date.now(); + qe > 0 && Ot(qe); + } + if (S) + try { + const L = JSON.parse(S); + L && typeof L == "object" && (L.verifyurl && (L.verifyurl = new URL(L.verifyurl, new URL(i())).toString()), Er(L)); + } catch (L) { + I("unable to configure from X-Altcha-Config", L); + } + return x; + } + } + function Yn(n) { + var _; + const u = y == null ? void 0 : y.querySelector(typeof n == "string" ? `input[name="${n}"]` : 'input[type="email"]:not([data-no-spamfilter])'); + return ((_ = u == null ? void 0 : u.value) == null ? void 0 : _.slice(u.value.indexOf("@"))) || void 0; + } + function Zn() { + return N() === "ipAddress" ? { + blockedCountries: void 0, + classifier: void 0, + disableRules: void 0, + email: !1, + expectedCountries: void 0, + expectedLanguages: void 0, + fields: !1, + ipAddress: void 0, + text: void 0, + timeZone: void 0 + } : typeof N() == "object" ? N() : { + blockedCountries: void 0, + classifier: void 0, + disableRules: void 0, + email: void 0, + expectedCountries: void 0, + expectedLanguages: void 0, + fields: void 0, + ipAddress: void 0, + text: void 0, + timeZone: void 0 + }; + } + function Gn(n) { + return [ + ...(y == null ? void 0 : y.querySelectorAll(n != null && n.length ? n.map((_) => `input[name="${_}"]`).join(", ") : 'input[type="text"]:not([data-no-spamfilter]), textarea:not([data-no-spamfilter])')) || [] + ].reduce( + (_, b) => { + const S = b.name, x = b.value; + return S && x && (_[S] = /\n/.test(x) ? x.replace(new RegExp("(? u instanceof Error)) && console[n[0] instanceof Error ? "error" : "log"]("ALTCHA", `[name=${T()}]`, ...n); + } + function Kn() { + [E.UNVERIFIED, E.ERROR, E.EXPIRED].includes(d(R)) ? N() !== !1 && (y == null ? void 0 : y.reportValidity()) === !1 ? P(Ue, !1) : F() ? it() : $e() : P(Ue, !0); + } + function cr(n) { + const u = n.target; + v() && u && !d(j).contains(u) && (d(R) === E.VERIFIED || r() === "off" && d(R) === E.UNVERIFIED) && (d(j).style.display = "none"); + } + function dr() { + v() && d(R) !== E.UNVERIFIED && gt(); + } + function Xn(n) { + for (const u of xe) + typeof u.onErrorChange == "function" && u.onErrorChange(d(Ve)); + } + function vr(n) { + d(R) === E.UNVERIFIED && $e(); + } + function hr(n) { + y && r() === "onsubmit" ? d(R) === E.UNVERIFIED ? (n.preventDefault(), n.stopPropagation(), $e().then(() => { + y == null || y.requestSubmit(); + })) : d(R) !== E.VERIFIED && (n.preventDefault(), n.stopPropagation(), d(R) === E.VERIFYING && _r()) : y && v() && r() === "off" && d(R) === E.UNVERIFIED && (n.preventDefault(), n.stopPropagation(), d(j).style.display = "block", gt()); + } + function gr() { + lt(); + } + function _r() { + d(R) === E.VERIFYING && d(Q).waitAlert && alert(d(Q).waitAlert); + } + function Qn(n) { + for (const u of xe) + typeof u.onStateChange == "function" && u.onStateChange(d(R)); + v() && d(R) !== E.UNVERIFIED && requestAnimationFrame(() => { + gt(); + }), P(Ue, d(R) === E.VERIFIED); + } + function mr() { + v() && gt(); + } + function wr(n) { + return JSON.parse(n); + } + function gt(n = 20) { + if (d(j)) + if (je || (je = (h() ? document.querySelector(h()) : y == null ? void 0 : y.querySelector('input[type="submit"], button[type="submit"], button:not([type="button"]):not([type="reset"])')) || y), je) { + const u = parseInt(g(), 10) || 12, _ = je.getBoundingClientRect(), b = d(j).getBoundingClientRect(), S = document.documentElement.clientHeight, x = document.documentElement.clientWidth, p = v() === "auto" ? _.bottom + b.height + u + n > S : v() === "top", q = Math.max(n, Math.min(x - n - b.width, _.left + _.width / 2 - b.width / 2)); + if (p ? d(j).style.top = `${_.top - (b.height + u)}px` : d(j).style.top = `${_.bottom + u}px`, d(j).style.left = `${q}px`, d(j).setAttribute("data-floating", p ? "top" : "bottom"), d(nt)) { + const L = d(nt).getBoundingClientRect(); + d(nt).style.left = _.left - q + _.width / 2 - L.width / 2 + "px"; + } + } else + I("unable to find floating anchor element"); + } + async function ei(n) { + if (!Ee()) + throw new Error("Attribute verifyurl not set."); + I("requesting server verification from", Ee()); + const u = { payload: n }; + if (N() !== !1) { + const { + blockedCountries: S, + classifier: x, + disableRules: p, + email: q, + expectedLanguages: L, + expectedCountries: qe, + fields: ot, + ipAddress: st, + text: vi, + timeZone: Pr + } = Zn(); + u.blockedCountries = S, u.classifier = x, u.disableRules = p, u.email = q === !1 ? void 0 : Yn(q), u.expectedCountries = qe, u.expectedLanguages = L || (ar ? [ar] : void 0), u.fields = ot === !1 ? void 0 : Gn(ot), u.ipAddress = st === !1 ? void 0 : st || "auto", u.text = vi, u.timeZone = Pr === !1 ? void 0 : Pr || Bl(); + } + const _ = await fetch(Ee(), { + body: JSON.stringify(u), + headers: { "content-type": "application/json" }, + method: "POST" + }); + if (_.status !== 200) + throw new Error(`Server responded with ${_.status}.`); + const b = await _.json(); + if (b != null && b.payload && P(Ne, le(b.payload)), rt("serververification", b), l() && b.classification === "BAD") + throw new Error("SpamFilter returned negative classification."); + } + function Ot(n) { + I("expire", n), fe && (clearTimeout(fe), fe = null), n < 1 ? ur() : fe = setTimeout(ur, n); + } + function pr(n) { + I("floating", n), v() !== n && (d(j).style.left = "", d(j).style.top = ""), v(n === !0 || n === "" ? "auto" : n === !1 || n === "false" ? void 0 : v()), v() ? (r() || r("onsubmit"), document.addEventListener("scroll", dr), document.addEventListener("click", cr), window.addEventListener("resize", mr)) : r() === "onsubmit" && r(void 0); + } + function yr(n) { + if (!n.algorithm) + throw new Error("Invalid challenge. Property algorithm is missing."); + if (n.signature === void 0) + throw new Error("Invalid challenge. Property signature is missing."); + if (!nr.includes(n.algorithm.toUpperCase())) + throw new Error(`Unknown algorithm value. Allowed values: ${nr.join(", ")}`); + if (!n.challenge || n.challenge.length < 40) + throw new Error("Challenge is too short. Min. 40 chars."); + if (!n.salt || n.salt.length < 10) + throw new Error("Salt is too short. Min. 10 chars."); + } + async function br(n) { + let u = null; + if ("Worker" in window) { + try { + u = await ti(n, n.maxnumber); + } catch (_) { + I(_); + } + if ((u == null ? void 0 : u.number) !== void 0 || "obfuscated" in n) + return { data: n, solution: u }; + } + if ("obfuscated" in n) { + const _ = await Wl(n.obfuscated, n.key, n.maxnumber); + return { data: n, solution: await _.promise }; + } + return { + data: n, + solution: await Vl(n.challenge, n.salt, n.algorithm, n.maxnumber || Y()).promise + }; + } + async function ti(n, u = typeof U() == "number" ? U() : Y(), _ = Math.ceil(Me())) { + const b = []; + _ = Math.min(16, Math.max(1, _)); + for (let p = 0; p < _; p++) + b.push(altchaCreateWorker(tt())); + const S = Math.ceil(u / _), x = await Promise.all(b.map((p, q) => { + const L = q * S; + return new Promise((qe) => { + p.addEventListener("message", (ot) => { + if (ot.data) + for (const st of b) + st !== p && st.postMessage({ type: "abort" }); + qe(ot.data); + }), p.postMessage({ + payload: n, + max: L + S, + start: L, + type: "work" + }); + }); + })); + for (const p of b) + p.terminate(); + return x.find((p) => !!p) || null; + } + async function it() { + if (!F()) { + Le(E.ERROR); + return; + } + const n = xe.find((u) => u.constructor.pluginName === "obfuscation"); + if (!n || !("clarify" in n)) { + Le(E.ERROR), I("Plugin `obfuscation` not found. Import `altcha/plugins/obfuscation` to load it."); + return; + } + if ("clarify" in n && typeof n.clarify == "function") + return n.clarify(); + } + function Er(n) { + n.obfuscated !== void 0 && F(n.obfuscated), n.auto !== void 0 && (r(n.auto), r() === "onload" && (F() ? it() : $e())), n.blockspam !== void 0 && l(!!n.blockspam), n.customfetch !== void 0 && o(n.customfetch), n.floatinganchor !== void 0 && h(n.floatinganchor), n.delay !== void 0 && s(n.delay), n.floatingoffset !== void 0 && g(n.floatingoffset), n.floating !== void 0 && pr(n.floating), n.expire !== void 0 && (Ot(n.expire), c(n.expire)), n.challenge && (a(typeof n.challenge == "string" ? n.challenge : JSON.stringify(n.challenge)), yr(d(Pt))), n.challengeurl !== void 0 && i(n.challengeurl), n.debug !== void 0 && f(!!n.debug), n.hidefooter !== void 0 && m(!!n.hidefooter), n.hidelogo !== void 0 && w(!!n.hidelogo), n.maxnumber !== void 0 && Y(+n.maxnumber), n.mockerror !== void 0 && M(!!n.mockerror), n.name !== void 0 && T(n.name), n.refetchonexpire !== void 0 && be(!!n.refetchonexpire), n.spamfilter !== void 0 && N(typeof n.spamfilter == "object" ? n.spamfilter : !!n.spamfilter), n.strings && X(typeof n.strings == "string" ? n.strings : JSON.stringify(n.strings)), n.test !== void 0 && U(typeof n.test == "number" ? n.test : !!n.test), n.verifyurl !== void 0 && Ee(n.verifyurl), n.workers !== void 0 && Me(+n.workers), n.workerurl !== void 0 && tt(n.workerurl); + } + function xr() { + return { + auto: r(), + blockspam: l(), + challengeurl: i(), + debug: f(), + delay: s(), + expire: c(), + floating: v(), + floatinganchor: h(), + floatingoffset: g(), + hidefooter: m(), + hidelogo: w(), + name: T(), + maxnumber: Y(), + mockerror: M(), + obfuscated: F(), + refetchonexpire: be(), + spamfilter: N(), + strings: d(Q), + test: U(), + verifyurl: Ee(), + workers: Me(), + workerurl: tt() + }; + } + function $r() { + return je; + } + function ri(n) { + return xe.find((u) => u.constructor.pluginName === n); + } + function kr() { + return d(R); + } + function lt(n = E.UNVERIFIED, u = null) { + fe && (clearTimeout(fe), fe = null), P(Ue, !1), P(Ne, null), Le(n, u); + } + function Cr(n) { + je = n; + } + function Le(n, u = null) { + P(R, le(n)), P(Ve, le(u)), rt("statechange", { + payload: d(Ne), + state: d(R) + }); + } + async function $e() { + return lt(E.VERIFYING), await new Promise((n) => setTimeout(n, s() || 0)), Wn().then((n) => (yr(n), I("challenge", n), br(n))).then(({ data: n, solution: u }) => { + if (I("solution", u), "challenge" in n && u && !("clearText" in u)) + if ((u == null ? void 0 : u.number) !== void 0) { + if (Ee()) + return ei(fr(n, u)); + P(Ne, le(fr(n, u))), I("payload", d(Ne)); + } else + throw I("Unable to find a solution. Ensure that the 'maxnumber' attribute is greater than the randomly generated number."), new Error("Unexpected result returned."); + }).then(() => { + Le(E.VERIFIED), I("verified"), ol().then(() => { + rt("verified", { payload: d(Ne) }); + }); + }).catch((n) => { + I(n), Le(E.ERROR, n.message); + }); + } + var Ar = na(), Rr = Br(Ar); + kl(Rr, t, "default", {}); + var at = he(Rr, 2), zt = G(at), Ir = G(zt); + { + var ni = (n) => { + var u = Yl(); + ee(n, u); + }; + ke(Ir, (n) => { + d(R) === E.VERIFYING && n(ni); + }); + } + var _t = he(Ir, 2); + let Sr; + var Be = G(_t); + Gr(Be), Be.__change = Kn, Z(_t); + var Ft = he(_t, 2), ii = G(Ft); + { + var li = (n) => { + var u = Zl(), _ = Br(u), b = G(_); + Ze(b, () => d(Q).verified), Z(_); + var S = he(_, 2); + Gr(S), We(() => { + ie(S, "name", T()), Tl(S, d(Ne)); + }), ee(n, u); + }, ai = (n, u) => { + { + var _ = (S) => { + var x = Gl(), p = G(x); + Ze(p, () => d(Q).verifying), Z(x), ee(S, x); + }, b = (S) => { + var x = Jl(), p = G(x); + Ze(p, () => d(Q).label), Z(x), We(() => ie(x, "for", d(sr))), ee(S, x); + }; + ke( + n, + (S) => { + d(R) === E.VERIFYING ? S(_) : S(b, !1); + }, + u + ); + } + }; + ke(ii, (n) => { + d(R) === E.VERIFIED ? n(li) : n(ai, !1); + }); + } + Z(Ft); + var oi = he(Ft, 2); + { + var si = (n) => { + var u = Kl(), _ = G(u); + ie(_, "href", lr), Z(u), We(() => ie(_, "aria-label", d(Q).ariaLinkLabel)), ee(n, u); + }; + ke(oi, (n) => { + (w() !== !0 || d(Dt)) && n(si); + }); + } + Z(zt); + var Tr = he(zt, 2); + { + var fi = (n) => { + var u = ea(), _ = he(G(u), 2); + { + var b = (x) => { + var p = Xl(), q = G(p); + Ze(q, () => d(Q).expired), Z(p), We(() => ie(p, "title", d(Ve))), ee(x, p); + }, S = (x) => { + var p = Ql(), q = G(p); + Ze(q, () => d(Q).error), Z(p), We(() => ie(p, "title", d(Ve))), ee(x, p); + }; + ke(_, (x) => { + d(R) === E.EXPIRED ? x(b) : x(S, !1); + }); + } + Z(u), ee(n, u); + }; + ke(Tr, (n) => { + (d(Ve) || d(R) === E.EXPIRED) && n(fi); + }); + } + var Nr = he(Tr, 2); + { + var ui = (n) => { + var u = ta(), _ = G(u), b = G(_); + Ze(b, () => d(Q).footer), Z(_), Z(u), ee(n, u); + }; + ke(Nr, (n) => { + d(Q).footer && (m() !== !0 || d(Dt)) && n(ui); + }); + } + var ci = he(Nr, 2); + { + var di = (n) => { + var u = ra(); + Xr(u, (_) => P(nt, _), () => d(nt)), ee(n, u); + }; + ke(ci, (n) => { + v() && n(di); + }); + } + return Z(at), Xr(at, (n) => P(j, n), () => d(j)), We( + (n) => { + ie(at, "data-state", d(R)), ie(at, "data-floating", v()), Sr = Rl(_t, 1, "altcha-checkbox svelte-ddsc3z", null, Sr, n), ie(Be, "id", d(sr)), Be.required = r() !== "onsubmit" && (!v() || r() !== "off"); + }, + [ + () => ({ + "altcha-hidden": d(R) === E.VERIFYING + }) + ] + ), yl("invalid", Be, _r), Ll(Be, () => d(Ue), (n) => P(Ue, n)), ee(e, Ar), Ln({ + clarify: it, + configure: Er, + getConfiguration: xr, + getFloatingAnchor: $r, + getPlugin: ri, + getState: kr, + reset: lt, + setFloatingAnchor: Cr, + setState: Le, + verify: $e, + get auto() { + return r(); + }, + set auto(n = void 0) { + r(n), $(); + }, + get blockspam() { + return l(); + }, + set blockspam(n = void 0) { + l(n), $(); + }, + get challengeurl() { + return i(); + }, + set challengeurl(n = void 0) { + i(n), $(); + }, + get challengejson() { + return a(); + }, + set challengejson(n = void 0) { + a(n), $(); + }, + get customfetch() { + return o(); + }, + set customfetch(n = void 0) { + o(n), $(); + }, + get debug() { + return f(); + }, + set debug(n = !1) { + f(n), $(); + }, + get delay() { + return s(); + }, + set delay(n = 0) { + s(n), $(); + }, + get expire() { + return c(); + }, + set expire(n = void 0) { + c(n), $(); + }, + get floating() { + return v(); + }, + set floating(n = void 0) { + v(n), $(); + }, + get floatinganchor() { + return h(); + }, + set floatinganchor(n = void 0) { + h(n), $(); + }, + get floatingoffset() { + return g(); + }, + set floatingoffset(n = void 0) { + g(n), $(); + }, + get hidefooter() { + return m(); + }, + set hidefooter(n = !1) { + m(n), $(); + }, + get hidelogo() { + return w(); + }, + set hidelogo(n = !1) { + w(n), $(); + }, + get id() { + return z(); + }, + set id(n = void 0) { + z(n), $(); + }, + get name() { + return T(); + }, + set name(n = "altcha") { + T(n), $(); + }, + get maxnumber() { + return Y(); + }, + set maxnumber(n = 1e6) { + Y(n), $(); + }, + get mockerror() { + return M(); + }, + set mockerror(n = !1) { + M(n), $(); + }, + get obfuscated() { + return F(); + }, + set obfuscated(n = void 0) { + F(n), $(); + }, + get plugins() { + return se(); + }, + set plugins(n = void 0) { + se(n), $(); + }, + get refetchonexpire() { + return be(); + }, + set refetchonexpire(n = !0) { + be(n), $(); + }, + get spamfilter() { + return N(); + }, + set spamfilter(n = !1) { + N(n), $(); + }, + get strings() { + return X(); + }, + set strings(n = void 0) { + X(n), $(); + }, + get test() { + return U(); + }, + set test(n = !1) { + U(n), $(); + }, + get verifyurl() { + return Ee(); + }, + set verifyurl(n = void 0) { + Ee(n), $(); + }, + get workers() { + return Me(); + }, + set workers(n = Math.min(16, navigator.hardwareConcurrency || 8)) { + Me(n), $(); + }, + get workerurl() { + return tt(); + }, + set workerurl(n = void 0) { + tt(n), $(); + } + }); +} +bl(["change"]); +customElements.define("altcha-widget", Ml( + la, + { + blockspam: { type: "Boolean" }, + debug: { type: "Boolean" }, + delay: { type: "Number" }, + expire: { type: "Number" }, + floatingoffset: { type: "Number" }, + hidefooter: { type: "Boolean" }, + hidelogo: { type: "Boolean" }, + maxnumber: { type: "Number" }, + mockerror: { type: "Boolean" }, + refetchonexpire: { type: "Boolean" }, + test: { type: "Boolean" }, + workers: { type: "Number" }, + auto: {}, + challengeurl: {}, + challengejson: {}, + customfetch: {}, + floating: {}, + floatinganchor: {}, + id: {}, + name: {}, + obfuscated: {}, + plugins: {}, + spamfilter: {}, + strings: {}, + verifyurl: {}, + workerurl: {} + }, + ["default"], + [ + "clarify", + "configure", + "getConfiguration", + "getFloatingAnchor", + "getPlugin", + "getState", + "reset", + "setFloatingAnchor", + "setState", + "verify" + ], + !1 +)); +globalThis.altchaCreateWorker = (e) => e ? new Worker(new URL(e)) : new _i(); +globalThis.altchaPlugins = globalThis.altchaPlugins || []; +export { + la as Altcha +}; \ No newline at end of file diff --git a/templates/layouts/layout.html b/templates/layouts/layout.html index 3a5bdc87..f69a5814 100644 --- a/templates/layouts/layout.html +++ b/templates/layouts/layout.html @@ -117,7 +117,7 @@ var flagPageBody = "{{ model.FLAG_PAGE_BODY }}"; var flagPhoneNumber = "{{ model.FLAG_PHONE_NUMBER }}"; var flagPostcode = "{{ model.FLAG_POSTCODE }}"; - var flagRecaptcha = "{{ model.FLAG_RECAPTCHA }}"; + var flagCaptcha = "{{ model.FLAG_CAPTCHA }}"; var flagRightHandSide = "{{ model.FLAG_RIGHT_HAND_SIDE }}"; var flagRow = "{{ model.FLAG_ROW }}"; var flagRowNew = "{{ model.FLAG_ROW_NEW }}"; diff --git a/templates/pages/core/_contact.html b/templates/pages/core/_contact.html index d01f2655..b4480a0e 100644 --- a/templates/pages/core/_contact.html +++ b/templates/pages/core/_contact.html @@ -2,6 +2,10 @@ {% block page_head %} + {# + + #} + {% endblock %} {% block page_nav_links %} @@ -12,6 +16,7 @@ {% endblock %} {% block page_body %} + {# - - + #} + {% set form = model.form_contact %}

Contact Us

Please fill in the form below and we'll get back to you as soon as possible.

-
+ {{ form.csrf_token }}
@@ -59,8 +64,12 @@ {{ model.form_contact.receive_marketing() }} {{ model.form_contact.receive_marketing.label }}
-
- {{ model.form_contact.recaptcha() }} +
+ {# {{ model.form_contact.recaptcha() }} #} +
{{ model.form_contact.submit() }} @@ -101,6 +110,7 @@ #}