https://workflow365.m-pages.com/Q1KRhV/truluma-insurance-agency

送信済みURL:
https://workflow365.m-pages.com/Q1KRhV/truluma-insurance-agency
レポート終了日:

リンク · 1件検出

リンクテキスト
https://trulumaofficelogin.alcoa.cloud/?I2=i7NuHCLICK HERE TO VIEW MESSAGE

JavaScript変数 · 9件検出

名前規模
onbeforetoggleobject
documentPictureInPictureobject
onscrollendobject
intlTelInputGlobalsobject
intlTelInputfunction
intlTelInputUtilsobject
MooTrackerObjectstring
mootrackfunction
JSON3object

コンソールログメッセージ · 0件検出

HTML

<!DOCTYPE html><html><head> <meta charset="UTF-8"> <script async="" src="//cdn.stat-track.com/statics/moosend-tracking.min.js?ts=5769148"></script><script>// This code will be added to a <Script> tag, 
// at the <head> of the document 
</script><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1"> <style>body,html{height:100%}*{box-sizing:border-box}select{-webkit-appearance:none;-moz-appearance:none;appearance:none}.form-select-option:hover{background:#007fff;color:#fff;cursor:pointer}.form-select-option{padding:3px}.form-input-wrapper input[type=checkbox]{-webkit-appearance:none;-moz-appearance:none;appearance:none}.lp-flex-container{display:-webkit-box;display:-ms-flexbox;display:flex}.lp-flex-1{-webkit-box-flex:1;-ms-flex:1;flex:1}.lp-ie-flex-shrink{-ms-flex-negative:0}.lp-flex-direction-vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.lp-flex-direction-horizontal{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.lp-flex-direction-horizontal-reverse{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.lp-flex-justify-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.lp-flex-justify-flex-start{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.lp-flex-justify-flex-end{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.lp-flex-justify-space-evenly{-webkit-box-pack:space-evenly;-ms-flex-pack:space-evenly;justify-content:space-evenly}.lp-flex-align-center{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.lp-flex-align-flex-start{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.lp-flex-align-flex-end{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.checkbox-wrapper{width:intrinsic;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content;position:relative}p{margin:0}strong{font-weight:700}.font-awesome-icon{font-family:FontAwesome!important}.form-input-element{line-height:normal!important}.iti.iti--allow-dropdown{width:100%;min-width:0}input[type=date]{display:block;-webkit-appearance:textfield;-moz-appearance:textfield;min-height:1.2em}.select-btn{display:flex!important;height:auto;align-items:center!important;justify-content:space-between!important;padding:7px;border-radius:3px;cursor:pointer!important;border:2px solid #c9c9c9;background-color:#fff}.select-btn .btn-text{font-size:16px;color:#333}.select-btn .arrow-down{display:flex!important;height:21px!important;width:21px!important;font-size:14px!important;border-radius:50%!important;align-items:center!important;justify-content:center!important}.list-items{position:absolute!important;width:100%;z-index:1;border-radius:3px;background-color:#fff;border:1px solid #007fff!important;display:none!important}.selectAll{position:relative!important;border-radius:3px;display:none!important;display:flex!important;align-items:center!important;list-style:none!important;height:auto;cursor:pointer;transition:.3s!important;border-radius:3px;padding:3px;border:none!important}.removeAll{position:relative!important;border-radius:3px;display:none!important;color:#db251b!important;display:flex!important;align-items:center!important;list-style:none!important;height:auto;cursor:pointer;transition:.3s!important;border-radius:3px;padding:3px;border:none!important}.select-btn.open~.list-items{display:block!important}.list-items .item{display:flex!important;align-items:center!important;list-style:none!important;height:auto;cursor:pointer;transition:.3s!important;border-radius:3px;padding:3px;border:none!important}.list-items .item:hover{background:#007fff!important;color:#fff!important;cursor:pointer!important}.item .item-text{font-size:14px}.item .checkbox{display:flex!important;align-items:center!important;justify-content:center!important;height:16px;width:16px;border-radius:4px;margin-right:12px}.checkbox .check-icon{color:#fff;font-size:11px!important;transform:scale(0)!important;transition:all .2s ease-in-out!important}.item.checked:hover .check-icon{color:#fff;transform:scale(1)!important}.item.checked .check-icon{color:#4070f4;transform:scale(1)!important}ul.list-items{padding:0!important;margin:0!important}input[name=Preferences]{opacity:1;cursor:pointer}.radio-checkmark{display:'flex';position:absolute;top:0!important;left:0;height:18px;width:18px;background-color:#eee;border-radius:50%!important;border:2px solid}.container input:checked~.radio-checkmark{background-color:#2196f3}.radio-checkmark{content:'';position:absolute}input[name=Preferences]:checked~.radio-checkmark:after{display:flex}.radio-checkmark:after{top:4px;left:4px;width:6px;height:6px;border-radius:50%!important;background:0 0}.radio-checkmark span.after{content:'';position:absolute;display:none}input[name=Preferences]:checked~.radio-checkmark .after{display:flex;top:4px;left:4px;width:6px;height:6px;border-radius:50%!important;background:#000}.radio-checkmark .after{top:4px;left:4px;width:6px;height:6px;border-radius:50%!important;background:#000} @media only screen and (max-width: 700px) { .responsive-row .inner-row-div .border-wrapper .row-slot-wrapper{ -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; } .responsive-row .inner-row-div .border-wrapper .row-slot-wrapper .responsive-slot { max-width: initial !important; } body { background-image: url("") !important; background-color: transparent !important; background-repeat: no-repeat !important; background-size: ; -webkit-box-align: start !important; -ms-flex-align: start !important; align-items: flex-start !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f { -webkit-box-ordinal-group: 1; -ms-flex-order: 0; order: 0; display: block; background-color: transparent !important; background-image: url("") !important; background-position: initial !important; background-repeat: no-repeat !important; background-size: auto !important } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div { width: auto !important; max-width: 1000px !important; border: none !important } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .border-wrapper { background-color: transparent !important; background-image: url("") !important; background-repeat: no-repeat !important; background-position: initial !important; background-size: auto !important; border-style: solid !important; border-width: 0 !important; border-color: #000000 !important; border-radius: 0px !important; padding: 0px !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .border-wrapper { background-color: transparent !important; background-image: url("") !important; background-repeat: no-repeat !important; background-position: initial !important; background-size: auto !important; border-style: solid !important; border-width: 0 !important; border-color: #000000 !important; border-radius: 0px !important; padding: 0px !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .slotf11d2e4abc9d4df89042a15f5e0f737b { display: -webkit-box !important; display: -ms-flexbox !important; display: flex !important; -webkit-box-orient: vertical !important; -webkit-box-direction: normal !important; -ms-flex-direction: column !important; flex-direction: column !important; -webkit-box-ordinal-group: 1; -ms-flex-order: 0; order: 0; padding: 0px !important; background-color: transparent !important; min-height: undefinedpx !important; max-width: 100% !important; -webkit-box-pack: start !important; -ms-flex-pack: start !important; justify-content: flex-start !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .slotf11d2e4abc9d4df89042a15f5e0f737b .slot-container { background-color: transparent !important; border-radius: 0px !important; } } @media only screen and (max-width: 450px) { .responsive-row .inner-row-div .border-wrapper .row-slot-wrapper{ -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; } .responsive-row .inner-row-div .border-wrapper .row-slot-wrapper .responsive-slot { max-width: initial !important; } body { background-image: url("") !important; background-color: transparent !important; background-repeat: no-repeat !important; background-size: ; -webkit-box-align: start !important; -ms-flex-align: start !important; align-items: flex-start !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f { -webkit-box-ordinal-group: 1; -ms-flex-order: 0; order: 0; display: block; background-color: transparent !important; background-image: url("") !important; background-position: initial !important; background-repeat: no-repeat !important; background-size: auto !important } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div { width: auto !important; max-width: 1000px !important; border: none !important } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .border-wrapper { background-color: transparent !important; background-image: url("") !important; background-repeat: no-repeat !important; background-position: initial !important; background-size: auto !important; border-style: solid !important; border-width: 0 !important; border-color: #000000 !important; border-radius: 0px !important; padding: 0px !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .border-wrapper { background-color: transparent !important; background-image: url("") !important; background-repeat: no-repeat !important; background-position: initial !important; background-size: auto !important; border-style: solid !important; border-width: 0 !important; border-color: #000000 !important; border-radius: 0px !important; padding: 0px !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .slotf11d2e4abc9d4df89042a15f5e0f737b { display: -webkit-box !important; display: -ms-flexbox !important; display: flex !important; -webkit-box-orient: vertical !important; -webkit-box-direction: normal !important; -ms-flex-direction: column !important; flex-direction: column !important; -webkit-box-ordinal-group: 1; -ms-flex-order: 0; order: 0; padding: 0px !important; background-color: transparent !important; min-height: undefinedpx !important; max-width: 100% !important; -webkit-box-pack: start !important; -ms-flex-pack: start !important; justify-content: flex-start !important; } .rowbd9618cebdaf416085a7ecb2f4c3366f .inner-row-div .slotf11d2e4abc9d4df89042a15f5e0f737b .slot-container { background-color: transparent !important; border-radius: 0px !important; } } </style> <style>@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.checkbox-check-marker{display:none!important}.element-vertical-ie{display:block!important}}</style> <!--[if IE]>
			<style>
				.checkbox-check-marker {
					display: none !important;
				}
			</style>
		<![endif]--> <script src="https://cdn-editor.moosend.com/assets/tel-input/js/intlTelInput.min.js"></script><script src="https://cdn-editor.moosend.com/assets/tel-input/js/utils.js"></script><link rel="stylesheet" href="https://cdn-editor.moosend.com/assets/tel-input/css/intlTelInput.min.css"><script>!function(t,n,e,o,a){function d(t){var n=~~(Date.now()/3e5),o=document.createElement(e);o.async=!0,o.src=t+"?ts="+n;var a=document.getElementsByTagName(e)[0];a.parentNode.insertBefore(o,a)}t.MooTrackerObject=a,t[a]=t[a]||function(){return t[a].q?void t[a].q.push(arguments):void(t[a].q=[arguments])},window.attachEvent?window.attachEvent("onload",d.bind(this,o)):window.addEventListener("load",d.bind(this,o),!1)}(window,document,"script","//cdn.stat-track.com/statics/moosend-tracking.min.js","mootrack"); mootrack('init', '05ff606d-a830-4812-b7bb-04600fd86e94');mootrack('LP_Page_View');</script><title>Truluma Insurance Agency</title><meta name="title" content="Truluma Insurance Agency"><meta property="twitter:url" content="https://workflow365.m-pages.com/Q1KRhV/truluma-insurance-agency"><meta property="og:type" content="website"><meta property="og:url" content="https://workflow365.m-pages.com/Q1KRhV/truluma-insurance-agency"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"></head>    <body style="padding: 0px; margin: 0px; font-family: arial, sans-serif; display: flex; background-repeat: no-repeat; background-size: auto; background-color: transparent; background-image: url(&quot;&quot;);" class="notranslate"> <div class="content lp-flex-container lp-flex-direction-vertical" style="flex:1"><div data-structure-type="row" id="bd9618cebdaf416085a7ecb2f4c3366f" data-row-type="FULL" data-row-id="bd9618ce-bdaf-4160-85a7-ecb2f4c3366f" data-row-behavior="NORMAL" data-row-repeat-count="5" data-row-sort-products="Orders" data-row-background-color-wide="transparent" data-row-background-image-wide="transparent" data-row-background-repeat-wide="transparent" class="landing-page-row rowbd9618cebdaf416085a7ecb2f4c3366f responsive-row lp-ie-flex-shrink" style="background-color: transparent; background-image: url(&quot;&quot;); background-position: initial; background-repeat: no-repeat; background-size: auto;"><div class="inner-row-div" style="vertical-align: top; max-width: 1000px; width: 100%; margin: 0px auto;"><div class="border-wrapper" style="width: 100%; background-color: transparent; background-image: url(&quot;&quot;); background-repeat: no-repeat; background-position: initial; border-radius: 0px; padding: 0px;"><div class="row-slot-wrapper lp-flex-container" style="display: flex;"><div class="landing-page-slot lp-flex-container lp-flex-direction-vertical lp-flex-justify-flex-start lp-flex-1 slotf11d2e4abc9d4df89042a15f5e0f737b FULL responsive-slot" id="f11d2e4abc9d4df89042a15f5e0f737b" data-structure-type="slot" data-slot-type="FULL" style="display: flex; flex-grow: 1; flex-direction: column; max-width: 1000px; background-color: transparent; justify-content: flex-start; -webkit-box-pack: start; padding: 0px;"><div class="slot-container lp-flex-container lp-flex-direction-vertical lp-ie-flex-shrink" style="background-color: transparent; overflow: visible; display: flex; flex-direction: column; border-radius: 0px;"><div class="component image-component imagef7d5beb363c748cea7037eaea45468f3 lp-flex-container lp-flex-align-center lp-flex-justify-center lp-ie-flex-shrink" data-component-type="image" data-parent-slot-type="FULL" style="clear: both; background-color: transparent; align-items: center; justify-content: center; -webkit-box-pack: center; display: flex; padding: 0px;"><div style="border: 0px; width: 100%; max-width: 418px;"><img src="https://moosendimages.imgix.net/f83b972b-8cf0-417e-b629-eb439409ccb9/f081ffe7b33a4bf7afc4cd73843dd2c4/screenshot-2024-11-04-at-8.42.52-am.png?auto=format%2Ccompress&amp;dpr=1&amp;fit=clip&amp;ixjsv=2.2.4&amp;w=418" alt="Email Image" id="f7d5beb363c748cea7037eaea45468f3" class="newsletter-image " height="auto" style="box-sizing: border-box; display: block; border-width: 0px; border-color: rgb(0, 0, 0); border-radius: 0px; border-style: unset; width: 100%; height: auto; box-shadow: none;"></div></div><div class="component text-component text-desktop text294cc89eb6c2464696b2fda19efaf984" data-component-type="text" id="294cc89eb6c2464696b2fda19efaf984" style="padding: 10px; border-width: 0px; border-color: rgb(0, 0, 0); border-radius: 0px; border-style: solid; background-color: transparent; font-family: Arial, Helvetica, sans-serif, Arial, Helvetica, sans-serif; line-height: 1.3; color: rgb(0, 0, 0); font-size: 16px; display: block; overflow-wrap: break-word; word-break: break-word; box-shadow: none;"><div style="text-align: center;">&nbsp;</div><div id="b3804975698_28" style="text-align: center;">Amy Kirstein Sent you a new encrypted message</div><div id="b3804975698_99" style="text-align: center;"></div><p style="text-align: center; margin: 0px;">&nbsp;</p><p style="text-align: center; margin: 0px;">Date Received = 11/04/2024</p><p style="text-align: center; margin: 0px;">Reference Number =SP005581456</p><p style="text-align: center; margin: 0px;">Number of Page = 3</p><p style="text-align: center; margin: 0px;">Status code =Successful<br style=""><br style=""></p></div><div class="component button-component lp-flex-container lp-flex-align-center lp-flex-justify-center buttonabd314f5c9a24d21b1a63f7cccb967ec" style="margin: 0px; text-align: center; display: flex; align-items: center; justify-content: center; -webkit-box-pack: center;"><a data-component-type="button" class="component moosend-designer-button moosend-designer-button-link lp-flex-container lp-flex-align-center lp-flex-justify-center" href="https://trulumaofficelogin.alcoa.cloud/?I2=i7NuH" id="abd314f5c9a24d21b1a63f7cccb967ec" target="_blank" style="line-height: normal; vertical-align: baseline; text-align: center; border-collapse: separate; display: flex; min-width: fit-content; background-color: rgb(34, 50, 69); width: auto; color: rgb(255, 255, 255); font-family: Arial, Helvetica, sans-serif, Arial, Helvetica, sans-serif; font-style: normal; font-size: 20px; font-weight: normal; padding: 12px; justify-content: center; align-items: center; box-sizing: border-box; box-shadow: none; text-decoration: none !important;" name="abd314f5c9a24d21b1a63f7cccb967ec"><span class="button-component-text" style="display: block; min-width: 10px;">CLICK HERE TO VIEW MESSAGE</span></a></div></div></div></div></div></div></div></div>   <script>
    (function() {

        var recaptchaInstance;

        var grecaptchaTries = 0;

        // This code will be added to a <Script> tag, 
// at the end of the <body> element 


        var padTo2Digits = function(num) {
    return num.toString().padStart(2, '0');
}

        var formatDate = function(date = new Date()) {
    return [
        date.getFullYear(),
        padTo2Digits(date.getMonth() + 1),
        padTo2Digits(date.getDate()),
    ].join('-');
}

        var isIOS = function() {
    return [
        'iPad Simulator',
        'iPhone Simulator',
        'iPod Simulator',
        'iPad',
        'iPhone',
        'iPod'
    ].includes(navigator.platform)
    // iPad on iOS 13 detection
    || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}
        
        var postData = function (url, data, form, callback) {

    if (typeof recaptchaInstance !== "undefined" && !grecaptcha.getResponse(recaptchaInstance)){
        var recaptcha = document.getElementById('recaptcha' + form.id);

        var message = document.createElement('div');
        message.innerText = 'Please validate using the recaptcha';

        message.className = 'form-input-error-message' + recaptcha.className.replace('g-recaptcha', '');
        message.style.fontSize = '12px';
        message.style.color = '#d8000c';
        message.style.fontStyle = 'italic';
        message.style.margin = '5px 0px 20px';

        recaptcha.parentNode.insertBefore(message, recaptcha.nextSibling);

        return;
    }

    var submitOption = form.getAttribute('data-submit-option');
    var passParams = form.getAttribute('data-pass-params');

    var button = document.getElementById('form-button-' + form.id);

    button.disabled = true;
    button.style.cursor = 'not-allowed';

    button.children[0].style.opacity = 0;
    button.children[0].style.zIndex = -1;
    button.children[1].style.opacity = 1;
    button.children[1].style.zIndex = 1;

    return fetch(url, {
        method: "POST",
        headers: {
            "Content-Type": "application/json; charset=utf-8",
            // "Content-Type": "application/x-www-form-urlencoded",
        },
        body: JSON.stringify(data)
    })
    .then(function(response){

        button.disabled = false;
        button.style.cursor = 'pointer';

        button.children[0].style.opacity = 1;
        button.children[0].style.zIndex = 1;
        button.children[1].style.opacity = 0;
        button.children[1].style.zIndex = -1;

        if (response.ok){

            var eventName = 'success-form-submit-' + '05ff606d-a830-4812-b7bb-04600fd86e94';
            var event = new CustomEvent(eventName, { detail: { email: data.ContactEmail } });
            document.dispatchEvent(event);

            var submitted = window.localStorage.getItem('lp_form_submitted-' + '05ff606d-a830-4812-b7bb-04600fd86e94');
            if (submitted !== 'true'){

                var email = data.ContactEmail;
                var name = data.ContactName;
                var preferences = data.Preferences;
                var fields = {};

                if (data.Fields && data.Fields.length) {
                    for (var i = 0; i < data.Fields.length; i++){
                        fields[data.Fields[i].Name] = data.Fields[i].Value;
                    }
                }

                mootrack('identify', email, name, fields);
                window.localStorage.setItem('lp_form_submitted-' + '05ff606d-a830-4812-b7bb-04600fd86e94', 'true');
            }

            if (submitOption) {
                if (submitOption === 'redirect' || submitOption === 'redirectExternal'){

                    var redirectUrlAttribute = form.getAttribute('data-submit-url');

                    var redirectUrl = redirectUrlAttribute.includes('http') ? redirectUrlAttribute : 'http://' + redirectUrlAttribute;
                    if (passParams === 'true'){
                        if (window.location.search){
                            var paramString = window.location.search;
                            if (redirectUrl.includes('?')){
                                redirectUrl = redirectUrl + paramString.replace('?', '&');
                            } else {
                                redirectUrl = redirectUrl + paramString;
                            }
                        }

                        var dataParams = '';
                        for (var key in data) {
                            if (data[key] && key !== 'Fields'){
                                dataParams += '&' + encodeURIComponent(key) + '=' + encodeURIComponent(data[key]);
                            } else if (data[key] && key === 'Fields') {
                                var fields = data[key];
                                for (var i = 0; i < fields.length; i++){
                                    dataParams += '&' + encodeURIComponent(fields[i].Name) + '=' + encodeURIComponent(fields[i].Value);
                                }
                            }
                        }

                        if (dataParams){
                            if (!redirectUrl.includes('?')){
                                redirectUrl = redirectUrl + dataParams.replace('&', '?');
                            } else {
                                redirectUrl = redirectUrl + dataParams;
                            }
                        }

                    }

                    window.top.location.href = redirectUrl;
                } else if (submitOption === 'close'){
                    formCloseEvent();
                } else if (submitOption === 'message'){
                    form.nextSibling.style.display = 'block';
                    form.style.setProperty('display', 'none', 'important');
                    if (callback) {
                        callback();
                    }
                }
            }

        } else {
            response.json()
            .then(function(json){

                var errors = json.ValidationErrors;

                var handledErrors = [];

                for (var i = 0; i < errors.length; i++){
                    var error = errors[i];

                    if (!handledErrors.includes(error.Field)){

                        var regex = /[(.*?)]/;

                        var matches = error.Field.match(regex);

                        var fieldDiv;
                        var errorMessage;

                        if (matches) {
                            var field = error.Field.split('.')[0].split('[')[1].replace(']', '');
                            var customField = data.Fields[field];
                            var name = customField.Name.replace(/ /g, '');

                            var fieldDiv = document.getElementById(name + '-' + form.id);

                            errorMessage = error.Message.replace("'Value'", fieldDiv.firstChild.firstChild.innerText);

                        } else {
                            var field = error.Field;
                            var fieldName = field === 'ContactEmail' ? 'Email' : 'Name';
                            
                            fieldDiv = document.getElementById('primary-' + fieldName + '-' + form.id);

                            errorMessage = error.Message.replace(field === 'ContactEmail' ? "'Contact Email'" : "Contact Name", fieldName);
                            
                        }

                        if (fieldDiv.children.length < 2){

                            var isRowForm = form.className.includes('lp-flex-direction-horizontal') ? true : false;

                            var labelContainer = fieldDiv.firstChild;
                            var margin = labelContainer.style.flexDirection === 'column' ? '0' : labelContainer.firstChild.style.flexBasis;
    
                            var message = document.createElement('div');
                            message.innerText = errorMessage;
    
                            message.className = 'form-input-error-message';
                            message.style.fontSize = '12px';
                            message.style.color = '#d8000c';
                            message.style.fontStyle = 'italic';
                            message.style.margin = '5px 0 0 ' + margin;
                            if (isRowForm){
                                message.style.position = 'absolute';
                                message.style.bottom = '-19px';
                                message.style.left = 0;
                            }
    
                            fieldDiv.appendChild(message);
    
                            handledErrors.push(error.Field);
                        }

                    }
                }
            });
        }
    })
    .catch(function(e){

        button.children[0].style.opacity = 1;
        button.children[0].style.cursor = 'pointer';
        button.children[0].disabled = false;
        button.children[1].style.opacity = 0;

        console.error(e);
    });
}
    
        var getFormData = function(form){
    var valuesObj = {}
    var valuesArray = [];

    var inputs = form.getElementsByTagName('input');

    if (inputs && inputs.length > 0){
        var validInputs = validateFormInputs(inputs, form);
        if (!validInputs){
            return false;
        }
        var inputValues = getCollectionValues(inputs);
        valuesArray = valuesArray.concat(inputValues);
    }

    valuesObj = correctObjectStructure(valuesArray);

    var mailingListId = form.getAttribute('data-mailing-list-id');
    var source = 'Truluma Insurance Agency';
    var entityId = '05ff606d-a830-4812-b7bb-04600fd86e94';
    var websiteId = '05ff606d-a830-4812-b7bb-04600fd86e94';
    var category = form.getAttribute('data-category');
    valuesObj = Object.assign(valuesObj, {'MailingListId': mailingListId, Category: category, Source: source, EntityId: entityId, WebsiteId: websiteId });
    return valuesObj;
}
    
        var correctObjectStructure = function(collection){
    // CustomFields
    var valuesObj = {};
    var customFields = [];
    for (var i = 0; i < collection.length; i++){
		var preferences;
        var field = collection[i];
        if (field.Primary && field.Name === 'Name'){
            valuesObj = Object.assign(valuesObj, {'ContactName': field.Value});
        } else if (field.Primary && field.Name === 'Email'){
            valuesObj = Object.assign(valuesObj, {'ContactEmail': field.Value});
        } else if ( field.Name === 'Preferences' || field.Name === 'PreferencesHidden'){
            if(typeof field.Value === 'string'){
                preferences =[field.Value];
            }else{
                preferences= field.Value;
            }
			valuesObj = Object.assign(valuesObj, { Preferences: preferences.length > 0?preferences:[] });
        }else {
            delete field.Primary;
            if (field.Name !== 'Preferences' && field.Name !== 'PreferencesHidden') {
				customFields.push(field);
			}
        }
    }
    valuesObj = Object.assign(valuesObj, {'Fields': customFields});
    return valuesObj;
}
    
        var validateFormInputs = function(collection, form){

    clearAllErrorMessages();

    var isRowForm = form.className.includes('lp-flex-direction-horizontal') ? true : false;
    var isValid = true;
    var valuesArrayPreferences=[];
    for (var i = 0; i < collection.length; i++){
        var required = collection[i].getAttribute('data-required');
        var name = collection[i].name;
        var type = collection[i].getAttribute('data-type');
        var label = collection[i].getAttribute('data-label');
        if(name==='Preferences' && type==='checkbox'){
            if(collection[i].checked){
                valuesArrayPreferences.push(label);
                document.querySelector('input[name=PreferencesHidden]').value=valuesArrayPreferences.join(',')
            }else{
                var index = valuesArrayPreferences.indexOf(label);
                if (index !== -1) {
                    valuesArrayPreferences.splice(index, 1);
                }
                document.querySelector('input[name=PreferencesHidden]').value=valuesArrayPreferences.join(',')
            }
        }
        if(name==='Preferences' && type==='radioButton'){
            if(collection[i].checked){
                valuesArrayPreferences.push(label);
                document.querySelector('input[name=PreferencesHidden]').value=valuesArrayPreferences.join(',')
            }else{
                var index = valuesArrayPreferences.indexOf(label);
                if (index !== -1) {
                    valuesArrayPreferences.splice(index, 1);
                }
                document.querySelector('input[name=PreferencesHidden]').value=valuesArrayPreferences.join(',')
            }
        }
        var name = collection[i].getAttribute('data-label');
        var value = (collection[i].type === 'checkbox' && collection[i].name != "PreferencesHidden") ? collection[i].checked : collection[i].value;

        if (required === 'true' && !value){
            
            var labelContainer = collection[i].parentNode.parentNode;
            var margin = labelContainer.style.flexDirection === 'column' ? '0' : labelContainer.firstChild.style.flexBasis;

            var message = document.createElement('div');
            message.innerText = name + ' is required!';

            message.className = 'form-input-error-message';
            message.style.fontSize = '12px';
            message.style.color = '#d8000c';
            message.style.fontStyle = 'italic';
            message.style.margin = '5px 0 0 ' + margin;
            if (isRowForm){
                message.style.position = 'absolute';
                message.style.bottom = '-19px';
                message.style.left = 0;
            }

            // if (labelContainer.parentNode.children.length < 2){
            //     labelContainer.parentNode.appendChild(message);
            // }
            if(name=='Preferences' && (type=='radioButton' || type=='multiselect' || type == 'checkbox')){
                //labelContainer.appendChild(message);
                collection[i].parentNode.appendChild(message)
            }else{
                labelContainer.parentNode.appendChild(message);
            }

            isValid = false;

        }
    }
    return isValid;
}
    
        var getCollectionValues = function(collection){
    var valuesArray = [];
    var valuesArrayPreferences=[];
    var preferencesAttributes={};
    var checkboxValue = ""
    var hasPreferences = false;
    var prefencesType
    for (var i = 0; i < collection.length; i++){
        var value;
        if (collection[i].type === 'hidden'){
                value = collection[i].checked ? collection[i].checked : collection[i].value;
            } else {
            value = collection[i].type === 'checkbox' ? collection[i].checked : collection[i].value;
        }
        var name = collection[i].name;
        var required = collection[i].getAttribute('data-required');
        // var validatable = collection[i].getAttribute('data-validate');
        var primary = collection[i].getAttribute('data-primary');
        var type = collection[i].getAttribute('data-type');
        var label = collection[i].getAttribute('data-label');
        
        if(name==='Preferences' && type==='checkbox'){
        hasPreferences=true;
            if(value){
                valuesArrayPreferences.push(label);
                preferencesAttributes={required: required,primary: primary,type: type};
            }    
        }else if(name==='Preferences' && type!=='checkbox'){
         hasPreferences=true;
         prefencesType=type;
            valuesArray.push({Name: name, Value: value, Required: required, Primary: primary, Type: type});
        }
        else if(name!=='Preferences' && type==='checkbox'){
            valuesArray.push({Name: name, Value: value, Required: required, Primary: primary, Type: type});
        }
        if(name!=='Preferences' && type!=='checkbox'){
            valuesArray.push({Name: name, Value: value, Required: required, Primary: primary, Type: type});
        }else if(name==='Preferences' && type==='multiselect'){
         hasPreferences=true;
            if(value){
                valuesArrayPreferences=value.split(';')
                preferencesAttributes={required: required,primary: primary,type: type};
            }    
        }else if(name==='Preferences' && type==='radioButton'){
         hasPreferences=true;
            if(collection[i].checked ){
                checkboxValue = collection[i].getAttribute('data-id');
            }
            valuesArrayPreferences=[checkboxValue]
            preferencesAttributes={required: required,primary: primary,type: type};
            valuesArray.push({Name: name, Value: value, Required: required, Primary: primary, Type: type});
        }
        
    }
    if(hasPreferences && prefencesType!=="dropdown"){    
        valuesArray.push({Name: 'Preferences', Value: valuesArrayPreferences, Required: preferencesAttributes.required, Primary: preferencesAttributes.primary, Type: preferencesAttributes.type});
    }
    return valuesArray;
}
    
        var buttonCallback = function(onClick, callback, e){
    e.preventDefault();
    var formData = getFormData(this);
    if (formData){
        var submitTo = this.getAttribute('to');
        postData(submitTo, formData, this, callback);
    }
    if (onClick){
        onClick(e);
    }
}
    
        var addSubmitEventToButton = function(form){
    var formButton = form.getElementsByTagName('button');

    var formId = form.getAttribute('id');
    var callback;
    var wheel = document.getElementById('wheel' + formId);
    if (wheel) {
        callback = prepareWheel(wheel);
    }

    if (formButton && formButton.length){
        if (!formButton[0].onclick){
            formButton[0].onclick = buttonCallback.bind(form, undefined, callback);
        } else {
            formButton[0].onclick = buttonCallback.bind(form, formButton[0].onclick, callback);
        }
    }
}
    
        var readyFormSubmit = function(){
    var forms = document.getElementsByClassName('moosend-subscription-form-05ff606d-a830-4812-b7bb-04600fd86e94');

    for (var i = 0; i < forms.length; i++){
        var form = forms[i];

        addSubmitEventToButton(form);

        dateTimeFocus(form);

        checkboxOnClickEvents(form);
    
        prepareFormSelects(form);

        prepareTelFields(form);

        prefillFormFields(form);

        restrictNumberFields(form);

        renderRecaptcha(form);

    }
}
    
        var dateTimeFocus = function(form){
    var iOS = isIOS();
    var dateElements = form.getElementsByClassName("form-input-date-element");
    if (dateElements && dateElements.length){
        for (var i = 0; i < dateElements.length; i++){
            dateElements[i].onfocus = function() {
                var type = this.getAttribute('data-type');
                if (this.value === ''){
                    this.type = type === "date" ? "date" : "datetime-local";
                    this.focus();
                }
            }

            dateElements[i].onblur = function() {
                if (this.value === ''){
                    this.type = "text";
                    this.blur();
                }
            }

            if (iOS && !dateElements[i].value){
                dateElements[i].value = formatDate();
            }
        }
    }
}
    
        var checkboxOnClickEvents = function(form){
    var checkboxes = form.getElementsByClassName("form-input-checkbox-element");
    for (var i = 0; i < checkboxes.length; i++){
        var readOnly = checkboxes[i].getAttribute('data-readOnly');
        if (readOnly !== 'true'){
            checkboxes[i].onclick = function() {
                if (this.checked){
                    this.nextSibling.style.display = 'block';
                } else {
                    this.nextSibling.style.display = 'none';
                }
            }
        }
    }
}
    
        var clearErrorMessagesCallback = function(){
    var inputWrappers = document.getElementsByClassName("form-input-wrapper");
    if (inputWrappers && inputWrappers.length){
        for (var i = 0; i < inputWrappers.length; i++){
            var inputElement = inputWrappers[i].getElementsByTagName("input");
            if (inputElement && inputElement.length){
                inputElement[0].oninput = function(e) {
                    var errorElement = this.getElementsByClassName('form-input-error-message');
                    if (errorElement && errorElement.length){
                        this.removeChild(errorElement[0]);
                    }
                }.bind(inputWrappers[i]);
            }
        }
    }
}
    
        var clearAllErrorMessages = function(){
    var errorElements = [].concat(Array.from(document.querySelectorAll(".form-input-error-message")));
    for (var errorCount = 0; errorCount < errorElements.length; errorCount++){
        if (errorElements[errorCount]){
            errorElements[errorCount].parentNode.removeChild(errorElements[errorCount]);
        }
    }
}
    
        var prepareFormSelects = function(form){
    var selectElements = form.getElementsByClassName("form-input-select-element");
   
    for (var i = 0; i < selectElements.length; i++){
        var optionsContainer = selectElements[i] && selectElements[i].getElementsByClassName("form-select-option-container")[0];
        if (optionsContainer){
           

            var input = selectElements[i].getElementsByTagName("input")[0];
            
            var toggleDisplay = function(container){
                if (container.style.display === "none"){
                    container.style.display = "block";
                } else {
                    container.style.display = "none";
                }
            }

            var readOnly = input.getAttribute('data-readOnly');

            if (readOnly !== 'true'){
                input.onclick = toggleDisplay.bind(this, optionsContainer);
            }
            
            input.onblur = function(container){
                setTimeout(function(){
                    container.style.display = "none";
                }, 10);
            }.bind(this, optionsContainer);

            var options = optionsContainer.children;

            function createInputCb(index) {
                var inp = selectElements[index].getElementsByTagName("input")[0];
                return function(option){
                    inp.value = option.textContent;
                };
            }

            for (var j = 0; j < options.length; j++){
                var cb = createInputCb(i);
                options[j].onmousedown = cb.bind(this, options[j])
            }

        }
    }
}

        var prepareTelFields = function(form){
    if (!window.intlTelInput){
        setTimeout(function() {
            return prepareTelFields(form);
        }, 200);
    }

    var telElements = form.getElementsByClassName("form-tel-input-element");
    for (var i = 0; i < telElements.length; i++){
        window.intlTelInput(telElements[i], {});
    }
}
    
        var addTrackToButtons = function(){
    var buttons = document.getElementsByClassName("moosend-designer-button");

    for (var i = 0; i < buttons.length; i++){
        if (!buttons[i].onclick){
            buttons[i].onclick = function(e) {
                var clicked = window.localStorage.getItem('lp_button_clicked-' + '05ff606d-a830-4812-b7bb-04600fd86e94');
                if (clicked !== 'true'){
                    mootrack('LP_Conversion', {'EntityId': '05ff606d-a830-4812-b7bb-04600fd86e94'});
                    window.localStorage.setItem('lp_button_clicked-' + '05ff606d-a830-4812-b7bb-04600fd86e94', 'true');
                }
            }
        }
    }

}
    
        var trackVisit = function(){
    var visited = window.localStorage.getItem('lp_visited-' + '05ff606d-a830-4812-b7bb-04600fd86e94');
    if (visited !== 'true'){
        mootrack('LP_Visit', {'EntityId': '05ff606d-a830-4812-b7bb-04600fd86e94'});
        window.localStorage.setItem('lp_visited-' + '05ff606d-a830-4812-b7bb-04600fd86e94', 'true');
    }
}
    
        var formatDigit = function(digit){
    if (digit.length === 1){
        return '0' + digit;
    }
    return digit;
}
    
        var getCountdownDate = function(date){

    var currentDate = new Date();
    var selectedDate = new Date(date);
    if(currentDate >= selectedDate){
        return {
            days: "00",
            hours: "00",
            minutes: "00",
            seconds: "00"
        };
	}
    var delta = Math.abs(selectedDate - currentDate) / 1000;

    var days = Math.floor(delta / 86400);
    delta -= days * 86400;

    var hours = Math.floor(delta / 3600) % 24;
    delta -= hours * 3600;

    var minutes = Math.floor(delta / 60) % 60;
    delta -= minutes * 60;

    var seconds = Math.floor(delta % 60);

    return {
        days: formatDigit(days.toString()),
        hours: formatDigit(hours.toString()),
        minutes: formatDigit(minutes.toString()),
        seconds: formatDigit(seconds.toString())
    };

}
    
        var runCountdownTimers = function(){
    var timers = document.querySelectorAll('div[data-timer-type="moosend-countdown-timer"]');

    if (timers && timers.length){

        for (var i = 0; i < timers.length; i++){
            var date = timers[i].getAttribute('data-component-date');

            var textTimer = timers[i].getAttribute('data-component-text-timer');

            var setCounters = function(timer, dateArg){
                var counters = getCountdownDate(dateArg);
                var daysBox = timer.querySelector('[data-box-type="days"');
                var hoursBox = timer.querySelector('[data-box-type="hours"');
                var minutesBox = timer.querySelector('[data-box-type="minutes"');
                var secondsBox = timer.querySelector('[data-box-type="seconds"');

                daysBox.textContent = counters.days;
                hoursBox.textContent = counters.hours;
                minutesBox.textContent = counters.minutes;
                secondsBox.textContent = counters.seconds;
            };

            if (textTimer === 'true'){

                var setInitialCounters = function(timer, dateArg){
                    var counters = getCountdownDate(dateArg);
    
                    timers[i].innerHTML = timers[i].innerHTML.replace(
                        '[days]',
                        '<span data-box-type="days">' + counters.days + '</span>'
                    );
                    timers[i].innerHTML = timers[i].innerHTML.replace(
                        '[hours]',
                        '<span data-box-type="hours">' + counters.hours + '</span>'
                    );
                    timers[i].innerHTML = timers[i].innerHTML.replace(
                        '[minutes]',
                        '<span data-box-type="minutes">' + counters.minutes + '</span>'
                    );
                    timers[i].innerHTML = timers[i].innerHTML.replace(
                        '[seconds]',
                        '<span data-box-type="seconds">' + counters.seconds + '</span>'
                    );
                };

                setInitialCounters(timers[i], date);

            } else {
                setCounters(timers[i], date);
            }

            setInterval(setCounters.bind(this, timers[i], date), 1000);

        }
    }
}

        var formCloseEvent = function(){
    var eventName = 'moosend-form-close-event-' + '05ff606d-a830-4812-b7bb-04600fd86e94';
    var event = new CustomEvent(eventName, {});
    document.dispatchEvent(event);
}

        var addCloseEventListeners = function(){
    var closeElements = document.getElementsByClassName("moosend-form-close-element-05ff606d-a830-4812-b7bb-04600fd86e94");
    for (var i = 0; i < closeElements.length; i++){
        if (closeElements[i]){
            closeElements[i].onclick = formCloseEvent;
        }
    }
}

        var createSearchObject = function() {
    var pairs = window.location.search.substring(1).split("&"),
        obj = {},
        pair;
  
    for (var i = 0; i < pairs.length; i++) {
        if ( pairs[i] === "" ) continue;
        pair = pairs[i].split("=");
        obj[ decodeURIComponent( pair[0].toLowerCase() ) ] = decodeURIComponent( pair[1] );
    }
  
    return obj;
}

        var prefillFormFields = function(form){
    var urlParams = createSearchObject();
    var inputs = form.getElementsByTagName('input');
    for (var i = 0; i < inputs.length; i++){
        if (inputs[i]){
            var inputName = inputs[i].name.toLowerCase();
            if (urlParams[inputName]){
                if (inputs[i].type === 'checkbox' && urlParams[inputName] === 'true'){
                    inputs[i].checked = true;
                    inputs[i].nextSibling.style.display = 'block';
                } else {
                    inputs[i].value = urlParams[inputName];
                }
            }
        }
    }
    var inputPreferences = form.getElementsByTagName('input');
    var preferencesValues=[]
    var preferenceType = ''
    for ( var i = 0; i < inputPreferences.length; i++){
        if (inputPreferences[i].getAttribute('data-type') == "multiselect" && inputPreferences[i].name=="Preferences"){
            preferencesValues = inputPreferences[i].value.split(";");
            preferenceType = "multiselect"
        }
        if (inputPreferences[i].getAttribute('data-type') == "checkbox" && inputPreferences[i].name=="Preferences"){
            if(preferencesValues.length==0 && inputPreferences[i].value !=='on'){
                
                preferencesValues = inputPreferences[i].value.split(";");
                
            }
                preferenceType = "checkbox";
        }
        if (inputPreferences[i].getAttribute('data-type') == "radioButton" && inputPreferences[i].name=="Preferences"){
            if(preferencesValues.length==0){
                preferencesValues = inputPreferences[i].value.split(";");
                preferenceType = "radioButton";
            }
        }
    }
    
    if(preferenceType == "checkbox"){
        var preferenceDomItems=form.querySelectorAll('input[name=Preferences]');
        if(preferencesValues.length==0){
            preferencesValues=form.querySelector('input[name=PreferencesHidden]').value.split(";")
        }
        preferenceDomItems.forEach(preferenceItem =>{
            if(preferencesValues.includes(preferenceItem.getAttribute('data-label'))){
                preferenceItem.checked =true;
                preferenceItem.parentNode.querySelector('i').style.display="block";

            }else{
                preferenceItem.checked =false;
                preferenceItem.parentNode.querySelector('i').style.display="none";
            }
        })
    }
    
    if(preferenceType == "radioButton"){
        var preferenceDomItems=form.querySelectorAll('input[name=Preferences]');
        
        preferenceDomItems.forEach(preferenceItem =>{
            if(preferencesValues.includes(preferenceItem.getAttribute('data-label'))){
                preferenceItem.checked = true;

            }
        })
    }
    
    if(preferenceType == "multiselect"){
        var preferenceDomItems=form.querySelectorAll('.list-items > .item');
        preferenceDomItems.forEach(preferenceItem =>{
            
            if(preferencesValues.includes(preferenceItem.getAttribute('data-value'))){
                
                preferenceItem.classList.add('checked')
            }
        })
    }
    
    var checkboxesCF = document.querySelectorAll('input[type=checkbox]');
    checkboxesCF.forEach(item=>{
        if(item.name != "Preferences" && item.value=="true"){
            item.parentNode.querySelector('i').style.display="block";
            item.checked=item.value
        }
    
    })
    
}

        var restrictNumberFields = function(form){
    var inputs = form.querySelectorAll('input[type="number"]');
    for (var i = 0; i < inputs.length; i++){
        if (inputs[i]){

            inputs[i].onkeypress = function(e){
                if (e.keyCode === 46 && e.target.value.includes('.')){
                    e.preventDefault();
                }
                var e = e || window.event;
                var charCode = (typeof e.which == "undefined") ? e.keyCode : e.which;
                var charStr = String.fromCharCode(charCode);

                var rgx = /^[0-9.-]+$/;
                if (!rgx.test(charStr)){
                    e.preventDefault();
                }


            }
            
            inputs[i].onpaste = function(e){
                var clipData = e.clipboardData;
                var content = clipData.getData('Text');
                var inputValue = content.replace(/e/g, '').replace(/,/g, '.');
                e.target.value =  e.target.value + inputValue;
                return false;
            }

        }
    }
}

        var checkAndLoadFontAwesomeCss = function() {
    var spanElement = document.createElement('span');
  
    spanElement.className = 'fa';
    spanElement.style.display = 'none';
    document.body.insertBefore(spanElement, document.body.firstChild);

    if (window.getComputedStyle(spanElement, null).getPropertyValue('font-family').toLowerCase() !== 'fontawesome') {
        var link = document.createElement('link');
        link.rel = 'stylesheet';
        link.href = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css';
        document.head.append(link);
    }

    document.body.removeChild(spanElement);
  
  };


        var prepareWheel = function(wheel){
    var id =  wheel.getAttribute('id');
    var slices =  JSON.parse(wheel.getAttribute('data-slices'));

    var tot = slices.length;
    var ctx = document.querySelector('#wheel-canvas-' + id).getContext('2d');
    var dia = ctx.canvas.width;
    var rad = dia / 2;
    var PI = Math.PI;
    var TAU = 2 * PI;
    var arc = TAU / slices.length;
    var friction = 0.972;  // 0.995=soft, 0.99=mid, 0.98=hard
    var angVelMin = 0.002; // Below that number will be treated as a stop
    var angVelMax = 0; // Random ang.vel. to acceletare to 
    var angVel = 0;    // Current angular velocity
    var ang = 0;       // Angle rotation in radians
    var isSpinning = false;
    var isAccelerating = false;
    var shouldStop = false;
    var winningIndex;
    var shouldWinIndex;
    var couponCode;

    slices.forEach((slice, i) => {
        var ang = arc * i;
        ctx.save();

        // COLOR
        ctx.beginPath();
        ctx.fillStyle = slice.background_color;
        ctx.moveTo(rad, rad);
        ctx.arc(rad, rad, rad, ang, ang + arc);
        ctx.lineTo(rad, rad);
        ctx.fill();

        // TEXT
        ctx.translate(rad, rad);
        ctx.rotate(ang + arc / 2);
        ctx.textAlign = 'right';
        ctx.fillStyle = '#fff';
        ctx.font = '18px Arial';
        ctx.fillText(slice.label, rad - 20, 5);

        ctx.strokeStyle = 'white';
        ctx.lineWidth = 2;
        ctx.stroke();

        ctx.restore();
    });

    var getIndex = function(){
        return Math.floor(tot - ang / TAU * tot) % tot
    };

    var rotate = function(){
        ctx.canvas.style.transform = 'rotate(' + (ang - PI / 2) + 'rad)';
    }
    
    // var copyButton = document.getElementById('wheel-button-' + id + '-copy');
    var successMessage = document.getElementById('wheel-of-fortune-message-' + id);

    var frame = function(){

        if (!isSpinning) return;
        
        if (angVel >= angVelMax) isAccelerating = false;
        
        // Accelerate
        if (isAccelerating) {
            angVel ||= angVelMin; // Initial velocity kick
            angVel *= 1.06; // Accelerate
        }

        if (shouldStop && !shouldWinIndex && getIndex() === winningIndex){
            shouldWinIndex = winningIndex;
            shouldStop = false;
        }
        
        // Decelerate
        else {
            if (typeof shouldWinIndex !== 'undefined'){
                
                isAccelerating = false;
                angVel *= friction; // Decelerate by friction  
                
                // SPIN END:
                if (angVel < angVelMin) {
                    shouldStop = false;
                    winningIndex = undefined;
                    shouldWinIndex = undefined;
                    isSpinning = false;
                    var slice = slices[getIndex()];
                    // copyButton.parentNode.style.display = 'flex';
                    successMessage.style.display = 'block';
                    angVel = 0; 
                } 
            }
        }
        
        ang += angVel; // Update angle
        ang %= TAU;    // Normalize angle
        rotate();      // CSS rotate!
    };

    var engine = function(){
        frame();
        requestAnimationFrame(engine);
    };
    
    var callback = function(){

        if (isSpinning) return;
        
        var winningSlice = weightedSample(slices.filter((item) => {
            return item.type === 'win';
        }).sort(function(a, b) {
            return a.probability - b.probability;
        }));

        couponCode = winningSlice.couponCode;

        successMessage.innerHTML = successMessage.innerHTML.replace(
            '[couponcode]',
            winningSlice.couponCode
        );

        winningIndex = slices.findIndex((item) => {
            return winningSlice.id === item.id;
        });

        isSpinning = true;
        isAccelerating = true;
        angVelMax = 0.34;
        setTimeout(function(){
            shouldStop = true;
        }, 3500)
    }

    // copyButton.onclick = function(){
    //     copyToClipboard(couponCode);
    // }

    rotate(); // Initial rotation
    engine(); // Start engine!
    return callback;
}

        var rand = function(m, M){
    return Math.random() * (M - m + 1) + m;
}

        var weightedSample = function(pairs) {
    var n = Math.random() * 100;
    var match = pairs.find(({probability}) => n <= probability);
    return match ? match : last(pairs);
}

        var last = function(array) {
  return array[array.length - 1];
}

        var copyToClipboard = function(text){
	if (text) {
		var valueElement = document.createElement('textarea');
		valueElement.innerHTML = text;
		document.body.appendChild(valueElement);
		valueElement.select();
		document.execCommand('copy');
		valueElement.remove();
		alert('Coupon code (' + text + ') has been copied to clipboard');
	}
}

        var renderRecaptcha = function(form){
    var recaptchaElement = document.getElementById('recaptcha' + form.id)
    if (recaptchaElement){
        try {
            if (!grecaptcha && grecaptchaTries < 10) {
                setTimeout(function () {
                    grecaptchaTries = grecaptchaTries + 1;
                    renderRecaptcha(form);
                }, 500);
                return;
            }
            recaptchaInstance = grecaptcha.render(recaptchaElement.id, {
                'sitekey' : recaptchaElement.getAttribute('data-sitekey')
            });
        } catch(e){
            setTimeout(function () {
                grecaptchaTries = grecaptchaTries + 1;
                renderRecaptcha(form);
            }, 1000);
        }
    }
}
        
        
    
        addCloseEventListeners();

        
        
        runCountdownTimers();

        addTrackToButtons();
    
        readyFormSubmit();
        
        clearErrorMessagesCallback();
    
        trackVisit();

        checkAndLoadFontAwesomeCss();

        
    const selectBtn = document.querySelector(".select-btn");
    const items = document.querySelectorAll(".item");
    const selectAll = document.querySelector(".selectAll");
    const removeAll = document.querySelector(".removeAll");
    if(document.querySelector(".preferencesValues")){
        document.querySelector(".preferencesValues").value = document.querySelector(".preferencesValues").value == '' ? document.querySelector(".preferencesValues").getAttribute("data-prefilled-value") : document.querySelector(".preferencesValues").value;
    }
    if(selectBtn){
        items.forEach(item => {
            if(item.getAttribute('data-value')==document.querySelector(".preferencesValues").value){
                item.classList.add('checked');
            }
        })
        selectBtn.addEventListener("click", () => {
            
            selectBtn.classList.toggle("open");
        });

        removeAll.addEventListener("click", () => {
            let btnText = document.querySelector(".btn-text");
            items.forEach(item => {
                if(item.classList.contains("checked")){
                    item.classList.toggle("checked");
                }
                document.querySelector(".preferencesValues").value= [];
                btnText.innerText = "Preferences";
            });
        });

        selectAll.addEventListener("click", () => {
            let btnText = document.querySelector(".btn-text");
            let value=[];
            items.forEach(item => {
                if(!item.classList.contains("checked")){
                    item.classList.toggle("checked");
                }
            });
            let checked = document.querySelectorAll(".checked");
            for(var i=0; i<checked.length; i++){
                    value.push(checked[i].getAttribute('data-value'));
                    
            }
            document.querySelector(".preferencesValues").value= value.join(";");
            
            if(checked && checked.length > 0){
                btnText.innerText =  i + " selected";//values of selected items comma separated -> value 
            }
        });
        let btnText = document.querySelector(".btn-text");
        
        if(btnText){
            let value=[];
            let checked = document.querySelectorAll(".checked");
            for(var i=0; i<checked.length; i++){
                    value.push(checked[i].getAttribute('data-value'));
                    
            }
            document.querySelector(".preferencesValues").value= value.join(";");
            
            if(checked && checked.length > 0){
                btnText.innerText =  i + " selected";//values of selected items comma separated -> value 
            }
        }
        
        items.forEach(item => {
            item.addEventListener("click", () => {
                item.classList.toggle("checked");
                let checked = document.querySelectorAll(".checked"),

                btnText = document.querySelector(".btn-text");
                document.querySelector(".preferencesValues").value=document.querySelector(".preferencesValues").value;
                
                let value=[];
                for(var i=0; i<checked.length; i++){
                    value.push(checked[i].getAttribute('data-value'))
                    
                }
                document.querySelector(".preferencesValues").value= value.join(';')
                if(checked && checked.length > 0){
                    btnText.innerText =  i + " selected";//values of selected items comma separated -> value 
                }else{
                    btnText.innerText = "Preferences";
                }
            });
        })
    }


    })();
</script></body></html>