<% screen.content.forEach(function(item, contentItemIndex) { %> <% if (item.hidden) { return } %> <% if (item['show-condition']) { let showCondition = evaluateFunction(item['show-condition'], user_properties); if (!showCondition) { return; } } %> <% if (item['visible'] == 'false' || item['visible'] == 'hide') { return; } %> <% if (item.type=='html' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- __(item.content) %>
<% } %> <% if (item.type=='js-script' ) { %> <% if (getParams('edit_mode') == 1) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
JS Code (executes after <%- item.timeout || 100 %>ms)
<% if (item.content && item.content.length > 0) { %>
<%- item.content.substring(0, 200) %><% if (item.content.length > 200) { %>...<% } %>
<% } %>
<% } else { %> <% } %> <% } %> <% if (item.type=='progress-bar-cards' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.options.forEach(function(option, index) { %>
<%- option.title %>
0%
<%- __(option.text) %>
<% }) %>
<% } %> <% if (item.type=='title' ) { %>

<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- __(item.content) %>

<% } %> <% if (item.type == 'express-checkout') { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
' data-oncancel="<%-item.oncancel || ''%>" data-oncancel-url="<%-item.oncancel_url || ''%>" data-phone-number-required="<%-item.phoneNumberRequired || ''%>" data-billing-address-required="<%-item.billingAddressRequired || ''%>"> <%-item.content%>
<% if (item['Fallback Button Text']) {%> <%- TemplateManager.renderTemplate('screen-content', {screen: { content: [ { "type": "pay-button", "content": item['Fallback Button Text'], "attrs": "data-express-fallback-btn", //"style": "display: none", "pay_button_onclick": item.pay_button_onclick, 'icon': " " } ] }}) %> <%} %> <% if (item['Other payment methods Button Text']) {%> <%- TemplateManager.renderTemplate('screen-content', {screen: { content: [ { "type": "pay-button", "content": item['Other payment methods Button Text'], "attrs": "data-express-other-payments-btn", "class": "button-inverted", "style": "display: none", "pay_button_onclick": item.pay_button_onclick, 'icon': " " } ] }}) %> <%} %>
<% } %> <% if (item.type == 'paddle-form') { %>
' data-block-area-index="<%-contentItemIndex%>" <%- item.attributes || '' %> >
<% } %> <% if (item.type == 'primer-form') { %> <% if (getParams('edit_mode') && ['primer', 'hubx'].indexOf(window?.paywall?.payment_system) == -1) { %>
Change 'Main Payment system' in Paywall Settings to Primer to use this block
<% } %> <% const isComponentsFormPreview = (item.checkoutVersion || 1) >= 2 || (typeof window !== 'undefined' && !!window.usesPrimerCheckoutComponents); %> <% if (isComponentsFormPreview) { %>
<%- __(item['Submit Button Text'] || 'Confirm purchase') %>
<% } else { %>
<% } %> <% } %> <% if (item.type == 'stripe-embedded-form') { %>
>
<% } %> <% if (item.type == 'hubx-form') { %>
' data-block-area-index="<%-contentItemIndex%>" data-payment-failed-actions='<%- escapeHtmlForAttribute(JSON.stringify(item["payment_failed_actions"]) || "") %>' <%- item.attributes || '' %> >
<% } %> <% if (item.type == 'solidgate-form') { %>
' data-form-styles='<%- JSON.stringify(item['formStyles'] || '') %>' data-form-params='<%- JSON.stringify(item['formParams'] || '') %>' data-block-area-index="<%-contentItemIndex%>" <%- item.attributes || '' %> >
<% } %> <% if (item.type == 'stripe-form') {%>
' data-form-appearance='<%-JSON.stringify(item['form-appearance']) || ''%>' data-auto-fill-billing-from-ip="<%- item['auto_fill_billing_from_ip'] || '' %>" data-custom-terms="<%- item['custom_terms'] ? 'true' : '' %>" data-block-area-index="<%-contentItemIndex%>" <%- item.attributes || '' %> <%- item.show_on_answer >= 0 ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>

Loading payment methods

<% // Extract form appearance variables for the fields let formAppearance = {}; let stripeFormBlock = null; // Find the stripe-form block to get its appearance settings if (screen && screen.content) { stripeFormBlock = screen.content.find(block => block.type === 'stripe-form'); } if (stripeFormBlock) { try { formAppearance = typeof stripeFormBlock['form-appearance'] === 'string' ? JSON.parse(stripeFormBlock['form-appearance']) : (stripeFormBlock['form-appearance'] || {}); } catch (e) { formAppearance = {}; } } const variables = formAppearance.variables || {}; // Build inline style string let inlineVarStyles = ''; if (variables.colorText) inlineVarStyles += `--stripe-input-text-color: ${variables.colorText}; `; if (variables.colorBackground) inlineVarStyles += `--stripe-input-bg-color: ${variables.colorBackground}; `; if (variables.borderRadius) inlineVarStyles += `--stripe-input-border-radius: ${variables.borderRadius}; `; if (variables.fontFamily) inlineVarStyles += `--stripe-input-font-family: ${variables.fontFamily}; `; if (variables.colorPrimary) inlineVarStyles += `--stripe-input-primary-color: ${variables.colorPrimary}; `; if (variables.spacingUnit) inlineVarStyles += `--stripe-input-spacing-unit: ${variables.spacingUnit}; `; %> <% if (item.add_email_field && !window.user_properties.email) { %> <% } %> <% if (item.add_name_field === 'above') { %>
<% } %>
<% if (item.add_name_field === 'below') { %>
<% } %> <% if (item.custom_terms && item.custom_terms.trim()) { %>

<%- __(item.custom_terms) %>

<% } %>
<% } %> <% if (item.type == 'stripe-payment-request-button') { %>
<% if (item['Other payment methods Button Text']) {%> <%- TemplateManager.renderTemplate('screen-content', {screen: { content: [ { "type": "pay-button", "content": item['Other payment methods Button Text'], "attrs": "data-payment-request-other-payments-btn", "class": "button-inverted", "style": "display: none", "pay_button_onclick": item.pay_button_onclick, 'icon': " " } ] }}) %> <%} %>
<% } %> <% if (item.type == 'google-pay-button') { %>
<% if (item['Other payment methods Button Text']) {%> <%- TemplateManager.renderTemplate('screen-content', {screen: { content: [ { "type": "pay-button", "content": item['Other payment methods Button Text'], "attrs": "data-payment-request-other-payments-btn", "class": "button-inverted", "style": "display: none", "pay_button_onclick": item.pay_button_onclick, 'icon': " " } ] }}) %> <%} %>
<% } %> <% if (item.type == 'primer-apple-pay-button') { %>
Apple Pay
<% } %> <% if (item.type == 'primer-google-pay-button') { %>
Google Pay
<% } %> <% if (item.type == 'primer-paypal-button') { %>
PayPal
<% } %> <% if (item.type == 'primer-adaptive-wallets-button') { %>
<%- item.applePayLabel || '' %>
<% } %> <% if (item.type == 'paypal-button') { %>
data-options='<%-JSON.stringify(item.options) || ''%>' data-only-paypal='<%-item.onlyPaypal%>'>
<% } %> <% if (item.type == 'paypal-card-form') { %>
>
<% } %> <% if (item.type=='paragraph' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>

<%- __(item.content) %>

<% } %> <% if (item.type=='time' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% } %> <% if (item.type=='duration' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<%- __('Duration') %>
<% } %> <% if (item.type=='spinner' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% } %> <% if (item.type=='auto-swiper' ) { %>
>
<% item.options.forEach(function(option, index) { %>

<%- __(option.content) %>

<% }) %>
<% } %> <% if (item.type=='auto-swiper-reviews' ) { %>
>
<% item.options.forEach(function(option, index) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (option.image) {%>
<% } %>
<% if (option.title) { %>
<%- __(option.title) %>
<% } %>
<%- __(option.content || option.review) %>
<%- __(option.name) %>
<% }) %>
<% } %> <% if (item.type=='country' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% let countriesList = [{"code":"AF","name":"Afghanistan","flag":"๐Ÿ‡ฆ๐Ÿ‡ซ"},{"code":"AL","name":"Albania","flag":"๐Ÿ‡ฆ๐Ÿ‡ฑ"},{"code":"DZ","name":"Algeria","flag":"๐Ÿ‡ฉ๐Ÿ‡ฟ"},{"code":"AS","name":"American Samoa","flag":"๐Ÿ‡ฆ๐Ÿ‡ธ"},{"code":"AD","name":"Andorra","flag":"๐Ÿ‡ฆ๐Ÿ‡ฉ"},{"code":"AO","name":"Angola","flag":"๐Ÿ‡ฆ๐Ÿ‡ด"},{"code":"AI","name":"Anguilla","flag":"๐Ÿ‡ฆ๐Ÿ‡ฎ"},{"code":"AG","name":"Antigua and Barbuda","flag":"๐Ÿ‡ฆ๐Ÿ‡ฌ"},{"code":"AR","name":"Argentina","flag":"๐Ÿ‡ฆ๐Ÿ‡ท"},{"code":"AM","name":"Armenia","flag":"๐Ÿ‡ฆ๐Ÿ‡ฒ"},{"code":"AW","name":"Aruba","flag":"๐Ÿ‡ฆ๐Ÿ‡ผ"},{"code":"AU","name":"Australia","flag":"๐Ÿ‡ฆ๐Ÿ‡บ"},{"code":"AT","name":"Austria","flag":"๐Ÿ‡ฆ๐Ÿ‡น"},{"code":"AZ","name":"Azerbaijan","flag":"๐Ÿ‡ฆ๐Ÿ‡ฟ"},{"code":"BS","name":"Bahamas","flag":"๐Ÿ‡ง๐Ÿ‡ธ"},{"code":"BH","name":"Bahrain","flag":"๐Ÿ‡ง๐Ÿ‡ญ"},{"code":"BD","name":"Bangladesh","flag":"๐Ÿ‡ง๐Ÿ‡ฉ"},{"code":"BB","name":"Barbados","flag":"๐Ÿ‡ง๐Ÿ‡ง"},{"code":"BY","name":"Belarus","flag":"๐Ÿ‡ง๐Ÿ‡พ"},{"code":"BE","name":"Belgium","flag":"๐Ÿ‡ง๐Ÿ‡ช"},{"code":"BZ","name":"Belize","flag":"๐Ÿ‡ง๐Ÿ‡ฟ"},{"code":"BJ","name":"Benin","flag":"๐Ÿ‡ง๐Ÿ‡ฏ"},{"code":"BM","name":"Bermuda Islands","flag":"๐Ÿ‡ง๐Ÿ‡ฒ"},{"code":"BT","name":"Bhutan","flag":"๐Ÿ‡ง๐Ÿ‡น"},{"code":"BO","name":"Bolivia","flag":"๐Ÿ‡ง๐Ÿ‡ด"},{"code":"BQ","name":"Bonaire, Sint Eustatius and Saba","flag":"๐Ÿ‡ง๐Ÿ‡ถ"},{"code":"BA","name":"Bosnia and Herzegovina","flag":"๐Ÿ‡ง๐Ÿ‡ฆ"},{"code":"BW","name":"Botswana","flag":"๐Ÿ‡ง๐Ÿ‡ผ"},{"code":"BR","name":"Brazil","flag":"๐Ÿ‡ง๐Ÿ‡ท"},{"code":"IO","name":"British Indian Ocean Territory","flag":"๐Ÿ‡ฎ๐Ÿ‡ด"},{"code":"VG","name":"British Virgin Islands","flag":"๐Ÿ‡ป๐Ÿ‡ฌ"},{"code":"BN","name":"Brunei","flag":"๐Ÿ‡ง๐Ÿ‡ณ"},{"code":"BG","name":"Bulgaria","flag":"๐Ÿ‡ง๐Ÿ‡ฌ"},{"code":"BF","name":"Burkina Faso","flag":"๐Ÿ‡ง๐Ÿ‡ซ"},{"code":"BI","name":"Burundi","flag":"๐Ÿ‡ง๐Ÿ‡ฎ"},{"code":"CV","name":"Cabo Verde","flag":"๐Ÿ‡จ๐Ÿ‡ป"},{"code":"KH","name":"Cambodia","flag":"๐Ÿ‡ฐ๐Ÿ‡ญ"},{"code":"CM","name":"Cameroon","flag":"๐Ÿ‡จ๐Ÿ‡ฒ"},{"code":"CA","name":"Canada","flag":"๐Ÿ‡จ๐Ÿ‡ฆ"},{"code":"CF","name":"CAR","flag":"๐Ÿ‡จ๐Ÿ‡ซ"},{"code":"KY","name":"Cayman Islands","flag":"๐Ÿ‡ฐ๐Ÿ‡พ"},{"code":"TD","name":"Chad","flag":"๐Ÿ‡น๐Ÿ‡ฉ"},{"code":"CL","name":"Chile","flag":"๐Ÿ‡จ๐Ÿ‡ฑ"},{"code":"TW","name":"China","flag":"๐Ÿ‡น๐Ÿ‡ผ"},{"code":"CX","name":"Christmas Island","flag":"๐Ÿ‡จ๐Ÿ‡ฝ"},{"code":"CO","name":"Colombia","flag":"๐Ÿ‡จ๐Ÿ‡ด"},{"code":"KM","name":"Comoros","flag":"๐Ÿ‡ฐ๐Ÿ‡ฒ"},{"code":"CK","name":"Cook Islands","flag":"๐Ÿ‡จ๐Ÿ‡ฐ"},{"code":"CR","name":"Costa Rica","flag":"๐Ÿ‡จ๐Ÿ‡ท"},{"code":"CI","name":"Cรดte d'Ivoire","flag":"๐Ÿ‡จ๐Ÿ‡ฎ"},{"code":"HR","name":"Croatia","flag":"๐Ÿ‡ญ๐Ÿ‡ท"},{"code":"CU","name":"Cuba","flag":"๐Ÿ‡จ๐Ÿ‡บ"},{"code":"CW","name":"Curaรงao","flag":"๐Ÿ‡จ๐Ÿ‡ผ"},{"code":"CY","name":"Cyprus","flag":"๐Ÿ‡จ๐Ÿ‡พ"},{"code":"CZ","name":"Czech Republic","flag":"๐Ÿ‡จ๐Ÿ‡ฟ"},{"code":"CD","name":"Democratic Republic of the Congo","flag":"๐Ÿ‡จ๐Ÿ‡ฉ"},{"code":"DK","name":"Denmark","flag":"๐Ÿ‡ฉ๐Ÿ‡ฐ"},{"code":"DJ","name":"Djibouti","flag":"๐Ÿ‡ฉ๐Ÿ‡ฏ"},{"code":"DM","name":"Dominica","flag":"๐Ÿ‡ฉ๐Ÿ‡ฒ"},{"code":"DO","name":"Dominican Republic","flag":"๐Ÿ‡ฉ๐Ÿ‡ด"},{"code":"KP","name":"DPRK","flag":"๐Ÿ‡ฐ๐Ÿ‡ต"},{"code":"TL","name":"East Timor","flag":"๐Ÿ‡น๐Ÿ‡ฑ"},{"code":"EC","name":"Ecuador","flag":"๐Ÿ‡ช๐Ÿ‡จ"},{"code":"EG","name":"Egypt","flag":"๐Ÿ‡ช๐Ÿ‡ฌ"},{"code":"SV","name":"El Salvador","flag":"๐Ÿ‡ธ๐Ÿ‡ป"},{"code":"GQ","name":"Equatorial Guinea","flag":"๐Ÿ‡ฌ๐Ÿ‡ถ"},{"code":"ER","name":"Eritrea","flag":"๐Ÿ‡ช๐Ÿ‡ท"},{"code":"EE","name":"Estonia","flag":"๐Ÿ‡ช๐Ÿ‡ช"},{"code":"SZ","name":"Eswatini","flag":"๐Ÿ‡ธ๐Ÿ‡ฟ"},{"code":"ET","name":"Ethiopia","flag":"๐Ÿ‡ช๐Ÿ‡น"},{"code":"FK","name":"Falkland Islands","flag":"๐Ÿ‡ซ๐Ÿ‡ฐ"},{"code":"FJ","name":"Fiji","flag":"๐Ÿ‡ซ๐Ÿ‡ฏ"},{"code":"FI","name":"Finland","flag":"๐Ÿ‡ซ๐Ÿ‡ฎ"},{"code":"FR","name":"France","flag":"๐Ÿ‡ซ๐Ÿ‡ท"},{"code":"PF","name":"French Polynesia","flag":"๐Ÿ‡ต๐Ÿ‡ซ"},{"code":"TF","name":"French Southern and Antarctic Lands","flag":"๐Ÿ‡น๐Ÿ‡ซ"},{"code":"GA","name":"Gabon","flag":"๐Ÿ‡ฌ๐Ÿ‡ฆ"},{"code":"GM","name":"Gambia","flag":"๐Ÿ‡ฌ๐Ÿ‡ฒ"},{"code":"GE","name":"Georgia","flag":"๐Ÿ‡ฌ๐Ÿ‡ช"},{"code":"DE","name":"Germany","flag":"๐Ÿ‡ฉ๐Ÿ‡ช"},{"code":"GH","name":"Ghana","flag":"๐Ÿ‡ฌ๐Ÿ‡ญ"},{"code":"GI","name":"Gibraltar","flag":"๐Ÿ‡ฌ๐Ÿ‡ฎ"},{"code":"GR","name":"Greece","flag":"๐Ÿ‡ฌ๐Ÿ‡ท"},{"code":"GL","name":"Greenland","flag":"๐Ÿ‡ฌ๐Ÿ‡ฑ"},{"code":"GD","name":"Grenada","flag":"๐Ÿ‡ฌ๐Ÿ‡ฉ"},{"code":"GP","name":"Guadeloupe","flag":"๐Ÿ‡ฌ๐Ÿ‡ต"},{"code":"GU","name":"Guam","flag":"๐Ÿ‡ฌ๐Ÿ‡บ"},{"code":"GT","name":"Guatemala","flag":"๐Ÿ‡ฌ๐Ÿ‡น"},{"code":"GG","name":"Guernsey","flag":"๐Ÿ‡ฌ๐Ÿ‡ฌ"},{"code":"GN","name":"Guinea","flag":"๐Ÿ‡ฌ๐Ÿ‡ณ"},{"code":"GW","name":"Guinea-Bissau","flag":"๐Ÿ‡ฌ๐Ÿ‡ผ"},{"code":"GF","name":"Guyana","flag":"๐Ÿ‡ฌ๐Ÿ‡ซ"},{"code":"GY","name":"Guyana","flag":"๐Ÿ‡ฌ๐Ÿ‡พ"},{"code":"HT","name":"Haiti","flag":"๐Ÿ‡ญ๐Ÿ‡น"},{"code":"HN","name":"Honduras","flag":"๐Ÿ‡ญ๐Ÿ‡ณ"},{"code":"HK","name":"Hong Kong","flag":"๐Ÿ‡ญ๐Ÿ‡ฐ"},{"code":"HU","name":"Hungary","flag":"๐Ÿ‡ญ๐Ÿ‡บ"},{"code":"IS","name":"Iceland","flag":"๐Ÿ‡ฎ๐Ÿ‡ธ"},{"code":"IN","name":"India","flag":"๐Ÿ‡ฎ๐Ÿ‡ณ"},{"code":"ID","name":"Indonesia","flag":"๐Ÿ‡ฎ๐Ÿ‡ฉ"},{"code":"IR","name":"Iran","flag":"๐Ÿ‡ฎ๐Ÿ‡ท"},{"code":"IQ","name":"Iraq","flag":"๐Ÿ‡ฎ๐Ÿ‡ถ"},{"code":"IE","name":"Ireland","flag":"๐Ÿ‡ฎ๐Ÿ‡ช"},{"code":"IL","name":"Israel","flag":"๐Ÿ‡ฎ๐Ÿ‡ฑ"},{"code":"IT","name":"Italy","flag":"๐Ÿ‡ฎ๐Ÿ‡น"},{"code":"JM","name":"Jamaica","flag":"๐Ÿ‡ฏ๐Ÿ‡ฒ"},{"code":"JP","name":"Japan","flag":"๐Ÿ‡ฏ๐Ÿ‡ต"},{"code":"JE","name":"Jersey","flag":"๐Ÿ‡ฏ๐Ÿ‡ช"},{"code":"JO","name":"Jordan","flag":"๐Ÿ‡ฏ๐Ÿ‡ด"},{"code":"KZ","name":"Kazakhstan","flag":"๐Ÿ‡ฐ๐Ÿ‡ฟ"},{"code":"KE","name":"Kenya","flag":"๐Ÿ‡ฐ๐Ÿ‡ช"},{"code":"KI","name":"Kiribati","flag":"๐Ÿ‡ฐ๐Ÿ‡ฎ"},{"code":"KW","name":"Kuwait","flag":"๐Ÿ‡ฐ๐Ÿ‡ผ"},{"code":"KG","name":"Kyrgyzstan","flag":"๐Ÿ‡ฐ๐Ÿ‡ฌ"},{"code":"LA","name":"Laos","flag":"๐Ÿ‡ฑ๐Ÿ‡ฆ"},{"code":"LV","name":"Latvia","flag":"๐Ÿ‡ฑ๐Ÿ‡ป"},{"code":"LB","name":"Lebanon","flag":"๐Ÿ‡ฑ๐Ÿ‡ง"},{"code":"LS","name":"Lesotho","flag":"๐Ÿ‡ฑ๐Ÿ‡ธ"},{"code":"LR","name":"Liberia","flag":"๐Ÿ‡ฑ๐Ÿ‡ท"},{"code":"LY","name":"Libya","flag":"๐Ÿ‡ฑ๐Ÿ‡พ"},{"code":"LI","name":"Liechtenstein","flag":"๐Ÿ‡ฑ๐Ÿ‡ฎ"},{"code":"LT","name":"Lithuania","flag":"๐Ÿ‡ฑ๐Ÿ‡น"},{"code":"LU","name":"Luxembourg","flag":"๐Ÿ‡ฑ๐Ÿ‡บ"},{"code":"MO","name":"Macau, Aomen","flag":"๐Ÿ‡ฒ๐Ÿ‡ด"},{"code":"MG","name":"Madagascar","flag":"๐Ÿ‡ฒ๐Ÿ‡ฌ"},{"code":"MW","name":"Malawi","flag":"๐Ÿ‡ฒ๐Ÿ‡ผ"},{"code":"MY","name":"Malaysia","flag":"๐Ÿ‡ฒ๐Ÿ‡พ"},{"code":"MV","name":"Maldives","flag":"๐Ÿ‡ฒ๐Ÿ‡ป"},{"code":"ML","name":"Mali","flag":"๐Ÿ‡ฒ๐Ÿ‡ฑ"},{"code":"MT","name":"Malta","flag":"๐Ÿ‡ฒ๐Ÿ‡น"},{"code":"MH","name":"Marshall Islands","flag":"๐Ÿ‡ฒ๐Ÿ‡ญ"},{"code":"MQ","name":"Martinique","flag":"๐Ÿ‡ฒ๐Ÿ‡ถ"},{"code":"MR","name":"Mauritania","flag":"๐Ÿ‡ฒ๐Ÿ‡ท"},{"code":"MU","name":"Mauritius","flag":"๐Ÿ‡ฒ๐Ÿ‡บ"},{"code":"YT","name":"Mayotte","flag":"๐Ÿ‡พ๐Ÿ‡น"},{"code":"MX","name":"Mexico","flag":"๐Ÿ‡ฒ๐Ÿ‡ฝ"},{"code":"FM","name":"Micronesia","flag":"๐Ÿ‡ซ๐Ÿ‡ฒ"},{"code":"MD","name":"Moldova","flag":"๐Ÿ‡ฒ๐Ÿ‡ฉ"},{"code":"MC","name":"Monaco","flag":"๐Ÿ‡ฒ๐Ÿ‡จ"},{"code":"MN","name":"Mongolia","flag":"๐Ÿ‡ฒ๐Ÿ‡ณ"},{"code":"ME","name":"Montenegro","flag":"๐Ÿ‡ฒ๐Ÿ‡ช"},{"code":"MS","name":"Montserrat","flag":"๐Ÿ‡ฒ๐Ÿ‡ธ"},{"code":"MA","name":"Morocco","flag":"๐Ÿ‡ฒ๐Ÿ‡ฆ"},{"code":"MZ","name":"Mozambique","flag":"๐Ÿ‡ฒ๐Ÿ‡ฟ"},{"code":"MM","name":"Myanmar","flag":"๐Ÿ‡ฒ๐Ÿ‡ฒ"},{"code":"NA","name":"Namibia","flag":"๐Ÿ‡ณ๐Ÿ‡ฆ"},{"code":"NR","name":"Nauru","flag":"๐Ÿ‡ณ๐Ÿ‡ท"},{"code":"NP","name":"Nepal","flag":"๐Ÿ‡ณ๐Ÿ‡ต"},{"code":"NL","name":"Netherlands","flag":"๐Ÿ‡ณ๐Ÿ‡ฑ"},{"code":"NC","name":"New Caledonia","flag":"๐Ÿ‡ณ๐Ÿ‡จ"},{"code":"NZ","name":"New Zealand","flag":"๐Ÿ‡ณ๐Ÿ‡ฟ"},{"code":"NI","name":"Nicaragua","flag":"๐Ÿ‡ณ๐Ÿ‡ฎ"},{"code":"NE","name":"Niger","flag":"๐Ÿ‡ณ๐Ÿ‡ช"},{"code":"NG","name":"Nigeria","flag":"๐Ÿ‡ณ๐Ÿ‡ฌ"},{"code":"NU","name":"Niue","flag":"๐Ÿ‡ณ๐Ÿ‡บ"},{"code":"NF","name":"Norfolk Island","flag":"๐Ÿ‡ณ๐Ÿ‡ซ"},{"code":"MK","name":"North Macedonia","flag":"๐Ÿ‡ฒ๐Ÿ‡ฐ"},{"code":"MP","name":"Northern Mariana Islands","flag":"๐Ÿ‡ฒ๐Ÿ‡ต"},{"code":"NO","name":"Norway","flag":"๐Ÿ‡ณ๐Ÿ‡ด"},{"code":"OM","name":"Oman","flag":"๐Ÿ‡ด๐Ÿ‡ฒ"},{"code":"PK","name":"Pakistan","flag":"๐Ÿ‡ต๐Ÿ‡ฐ"},{"code":"PW","name":"Palau","flag":"๐Ÿ‡ต๐Ÿ‡ผ"},{"code":"PA","name":"Panama","flag":"๐Ÿ‡ต๐Ÿ‡ฆ"},{"code":"PG","name":"Papua New Guinea","flag":"๐Ÿ‡ต๐Ÿ‡ฌ"},{"code":"PY","name":"Paraguay","flag":"๐Ÿ‡ต๐Ÿ‡พ"},{"code":"PE","name":"Peru","flag":"๐Ÿ‡ต๐Ÿ‡ช"},{"code":"PH","name":"Philippines","flag":"๐Ÿ‡ต๐Ÿ‡ญ"},{"code":"PN","name":"Pitcairn Islands","flag":"๐Ÿ‡ต๐Ÿ‡ณ"},{"code":"PL","name":"Poland","flag":"๐Ÿ‡ต๐Ÿ‡ฑ"},{"code":"PT","name":"Portugal","flag":"๐Ÿ‡ต๐Ÿ‡น"},{"code":"PR","name":"Puerto Rico","flag":"๐Ÿ‡ต๐Ÿ‡ท"},{"code":"QA","name":"Qatar","flag":"๐Ÿ‡ถ๐Ÿ‡ฆ"},{"code":"CG","name":"Republic of the Congo","flag":"๐Ÿ‡จ๐Ÿ‡ฌ"},{"code":"KR","name":"Republic of Korea","flag":"๐Ÿ‡ฐ๐Ÿ‡ท"},{"code":"RE","name":"Rรฉunion","flag":"๐Ÿ‡ท๐Ÿ‡ช"},{"code":"RO","name":"Romania","flag":"๐Ÿ‡ท๐Ÿ‡ด"},{"code":"RU","name":"Russia","flag":"๐Ÿ‡ท๐Ÿ‡บ"},{"code":"RW","name":"Rwanda","flag":"๐Ÿ‡ท๐Ÿ‡ผ"},{"code":"BL","name":"Saint Barthรฉlemy","flag":"๐Ÿ‡ง๐Ÿ‡ฑ"},{"code":"SH","name":"Saint Helena, Ascension and Tristan da Cunha","flag":"๐Ÿ‡ธ๐Ÿ‡ญ"},{"code":"KN","name":"Saint Kitts and Nevis","flag":"๐Ÿ‡ฐ๐Ÿ‡ณ"},{"code":"LC","name":"Saint Lucia","flag":"๐Ÿ‡ฑ๐Ÿ‡จ"},{"code":"MF","name":"Saint Martin","flag":"๐Ÿ‡ฒ๐Ÿ‡ซ"},{"code":"PM","name":"Saint Pierre and Miquelon","flag":"๐Ÿ‡ต๐Ÿ‡ฒ"},{"code":"VC","name":"Saint Vincent and the Grenadines","flag":"๐Ÿ‡ป๐Ÿ‡จ"},{"code":"WS","name":"Samoa","flag":"๐Ÿ‡ผ๐Ÿ‡ธ"},{"code":"SM","name":"San Marino","flag":"๐Ÿ‡ธ๐Ÿ‡ฒ"},{"code":"ST","name":"Sรฃo Tomรฉ and Prรญncipe","flag":"๐Ÿ‡ธ๐Ÿ‡น"},{"code":"SA","name":"Saudi Arabia","flag":"๐Ÿ‡ธ๐Ÿ‡ฆ"},{"code":"SN","name":"Senegal","flag":"๐Ÿ‡ธ๐Ÿ‡ณ"},{"code":"RS","name":"Serbia","flag":"๐Ÿ‡ท๐Ÿ‡ธ"},{"code":"SC","name":"Seychelles","flag":"๐Ÿ‡ธ๐Ÿ‡จ"},{"code":"SL","name":"Sierra Leone","flag":"๐Ÿ‡ธ๐Ÿ‡ฑ"},{"code":"SG","name":"Singapore","flag":"๐Ÿ‡ธ๐Ÿ‡ฌ"},{"code":"SX","name":"Sint Maarten","flag":"๐Ÿ‡ธ๐Ÿ‡ฝ"},{"code":"SK","name":"Slovakia","flag":"๐Ÿ‡ธ๐Ÿ‡ฐ"},{"code":"SI","name":"Slovenia","flag":"๐Ÿ‡ธ๐Ÿ‡ฎ"},{"code":"SB","name":"Solomon Islands","flag":"๐Ÿ‡ธ๐Ÿ‡ง"},{"code":"SO","name":"Somalia","flag":"๐Ÿ‡ธ๐Ÿ‡ด"},{"code":"ZA","name":"South Africa","flag":"๐Ÿ‡ฟ๐Ÿ‡ฆ"},{"code":"SS","name":"South Sudan","flag":"๐Ÿ‡ธ๐Ÿ‡ธ"},{"code":"ES","name":"Spain","flag":"๐Ÿ‡ช๐Ÿ‡ธ"},{"code":"LK","name":"Sri Lanka","flag":"๐Ÿ‡ฑ๐Ÿ‡ฐ"},{"code":"SD","name":"Sudan","flag":"๐Ÿ‡ธ๐Ÿ‡ฉ"},{"code":"SR","name":"Suriname","flag":"๐Ÿ‡ธ๐Ÿ‡ท"},{"code":"SJ","name":"Svalbard","flag":"๐Ÿ‡ธ๐Ÿ‡ฏ"},{"code":"SE","name":"Sweden","flag":"๐Ÿ‡ธ๐Ÿ‡ช"},{"code":"CH","name":"Switzerland","flag":"๐Ÿ‡จ๐Ÿ‡ญ"},{"code":"SY","name":"Syria","flag":"๐Ÿ‡ธ๐Ÿ‡พ"},{"code":"TJ","name":"Tajikistan","flag":"๐Ÿ‡น๐Ÿ‡ฏ"},{"code":"TZ","name":"Tanzania","flag":"๐Ÿ‡น๐Ÿ‡ฟ"},{"code":"TH","name":"Thailand","flag":"๐Ÿ‡น๐Ÿ‡ญ"},{"code":"TG","name":"Togo","flag":"๐Ÿ‡น๐Ÿ‡ฌ"},{"code":"TK","name":"Tokelau","flag":"๐Ÿ‡น๐Ÿ‡ฐ"},{"code":"TO","name":"Tonga","flag":"๐Ÿ‡น๐Ÿ‡ด"},{"code":"TT","name":"Trinidad and Tobago","flag":"๐Ÿ‡น๐Ÿ‡น"},{"code":"TN","name":"Tunisia","flag":"๐Ÿ‡น๐Ÿ‡ณ"},{"code":"TR","name":"Turkey","flag":"๐Ÿ‡น๐Ÿ‡ท"},{"code":"TM","name":"Turkmenistan","flag":"๐Ÿ‡น๐Ÿ‡ฒ"},{"code":"TC","name":"Turks and Caicos","flag":"๐Ÿ‡น๐Ÿ‡จ"},{"code":"TV","name":"Tuvalu","flag":"๐Ÿ‡น๐Ÿ‡ป"},{"code":"AE","name":"UAE","flag":"๐Ÿ‡ฆ๐Ÿ‡ช"},{"code":"UG","name":"Uganda","flag":"๐Ÿ‡บ๐Ÿ‡ฌ"},{"code":"UA","name":"Ukraine","flag":"๐Ÿ‡บ๐Ÿ‡ฆ"},{"code":"GB","name":"United Kingdom","flag":"๐Ÿ‡ฌ๐Ÿ‡ง"},{"code":"US","name":"United States of America","flag":"๐Ÿ‡บ๐Ÿ‡ธ"},{"code":"UY","name":"Uruguay","flag":"๐Ÿ‡บ๐Ÿ‡พ"},{"code":"UZ","name":"Uzbekistan","flag":"๐Ÿ‡บ๐Ÿ‡ฟ"},{"code":"VU","name":"Vanuatu","flag":"๐Ÿ‡ป๐Ÿ‡บ"},{"code":"VA","name":"Vatican","flag":"๐Ÿ‡ป๐Ÿ‡ฆ"},{"code":"VE","name":"Venezuela","flag":"๐Ÿ‡ป๐Ÿ‡ช"},{"code":"VN","name":"Vietnam","flag":"๐Ÿ‡ป๐Ÿ‡ณ"},{"code":"VI","name":"Virgin Islands (U.S.)","flag":"๐Ÿ‡ป๐Ÿ‡ฎ"},{"code":"WF","name":"Wallis and Futuna","flag":"๐Ÿ‡ผ๐Ÿ‡ซ"},{"code":"YE","name":"Yemen","flag":"๐Ÿ‡พ๐Ÿ‡ช"},{"code":"ZM","name":"Zambia","flag":"๐Ÿ‡ฟ๐Ÿ‡ฒ"},{"code":"ZW","name":"Zimbabwe","flag":"๐Ÿ‡ฟ๐Ÿ‡ผ"}]; // Get default value from locales.country_code or item.value const defaultValue = (typeof locales !== 'undefined' && locales.country_code) ? locales.country_code : (__(item.value || '')); let placeholderText = __(item.placeholder || 'Select country'); // If there's a default value, try to find matching country text if (defaultValue) { const matchingCountry = countriesList.find(country => country.code === defaultValue.toUpperCase() || country.name.toLowerCase() === defaultValue.toLowerCase() ); if (matchingCountry) { placeholderText = `${matchingCountry.flag} ${matchingCountry.name}`; } } else { // If no default value, use first country as placeholder const firstCountry = countriesList[0]; if (firstCountry) { placeholderText = `${firstCountry.flag} ${firstCountry.name}`; } } %>
<% } %> <% if (item.type=='options' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.options.forEach(function(option, index) { %>
<% }) %>
<% } %> <% if (item.type=='options-multiple' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.options.forEach(function(option, index){ %>
<% }) %>
<% } %> <% if (item.type=='list' ) { %> <% if (item.duration) { setTimeout(function(){ let els = $('[data-block-area-index=' + contentItemIndex + '] li.quiz__list-item'); els.css('opacity', '0'); els.each(function (index, el) { setTimeout(function(){ $(el).animate({opacity: 1}, item.duration) }, item.duration * index) }) }, 200) } %> <% } %> <% if (item.type=='review' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (item.title) {%>
<% if (item.image) {%>
<% } %> <%- __(item.title) %>
<% } %> <% var rating = parseFloat(item.star_rating) || 5; var fullStars = Math.floor(rating); var hasHalfStar = (rating % 1) >= 0.5; var emptyStars = 5 - fullStars - (hasHalfStar ? 1 : 0); %>
<%- __(item.content || item.review) %>
<%- __(item.name) %>
<% } %> <% if (item.type=='review-fb' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<%-__(item.name)%>
recommends
<%- __(item.app_name || window.app_name) %>
<%- __(item.date) %>

<%- __(item.comment) %>

<% } %> <% if (item.type=='review-card') { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% if (item.image) { %>
<%- item.name %>
<% } %>

<%- __(item.name) %>

<%- __(item.content) %>
<% } %> <% if (item.type=='image') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (item.image_prompt) { %>
[image: <%-item.image_prompt%>]
<% } else { %> <%- item.alt %> <% } %>
<% } %> <% if (item.type=='button' ) { %> <% } %> <% if (item.type=='button-link' || item.type=='button-after-pay' ) { %> data-block-area-index="<%-contentItemIndex%>" <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- __(item.content) %> <% } %> <% if (item.type=='button-inline' ) { %> <% } %> <% if (item.type=='sub-title' ) { %>

<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- __(item.content) %>

<% } %> <% if (item.type=='sub-title-gray' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- __(item.content) %>
<% } %> <% if (item.type=='preview-steps') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% item.steps.forEach(function(step, index) { %>
<% if (step.image_prompt) { %>
[image: <%-step.image_prompt%>]
<% } else { %> <% } %>

<%- __(step.title) %>

<% }) %>
<% } %> <% if (item.type=='sale-timer' ) { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<%-__('Applied limited discount')%>
<%- item.sale_old %><%- item.sale %>
<%- item.user_old %>
<%-__('Applicable for')%>
<%-__('minutes')%>
<%-__('seconds')%>
<% } %> <% if (item.type=='options-multiple-images' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.options.forEach(function(option, index) { %> <% }) %>
<% } %> <% if (item.type=='options-image-horizontal' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.options.forEach(function(option, index) { %>
<% }) %>
<% } %> <% if (item.type=='options-vertical' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.options.forEach(function(option, index) { %> <% }) %>
<% } %> <% if (item.type=='options-images-small' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.options.forEach(function(option, index) { %> <% }) %>
<% } %> <% if (item.type=='options-evaluation' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
> <% if (window.quiz.custom_json?.prefill_answers && window.user_properties[item.name || screen.id]) { var savedValue = window.user_properties[item.name || screen.id]; var displayValue = savedValue; for (var i = 0; i < item.options.length; i++) { var opt = item.options[i]; var optValue = opt.value || opt.content || (typeof opt == 'object' ? i : opt); if (String(optValue) === String(savedValue)) { displayValue = opt.content || opt.value || savedValue; break; } } %><%- displayValue %><% } else { %>ยท<% } %>
<%- __(item.text_left) %> <%- __(item.text_right) %>
<% }%> <% if (item.type=='progress-circle' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (item.text) { %>
<%- __(item.text) %>
<% } %>
style="display: none" <% } %>> 0%
<% if (item.questions_popups ) { %> <% item.questions_popups.forEach(function(option) { %>
<%- __(option.title) %>
<% if (option.image ) { %> <% } %>
<% (option.options || []).forEach(function(option1) { %> <% }) %>
<% }) %> <% } %> <% } %> <% if (item.type=='progress-bars' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-progress-complete-content="<%-item.progress_complete_content || ''%>"> <% if (item.checkmark_content) { %>
<%- item.checkmark_content %>
<% } %> <% item.options.forEach(function(option, index) { %>
data-percent="<%- option.percent%>"<% } %>>
<% if (item.list_icon && item.list_icon[index]) { %> <% } %> <%- __(option.content || option) %>
style="display: none"<%}%>>
0%
<% }) %>
<% if (item.questions_popups ) { %> <% item.questions_popups.forEach(function(option) { %>
<%- __(option.title) %>
<% if (option.image ) { %> <% } %>
<% (option.options || []).forEach(function(option1) { %> <% }) %>
<% }) %> <% } %> <% } %> <% if (item.type=='email' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
autocomplete="off" <%- item.attributes || '' %> data-email-input data-domains='<%= JSON.stringify(item.domains || []) %>' data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>">
<% } %> <% if (item.type=='popup-email' ) { %> <% } %> <% if (item.type=='text' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (item.isTextarea) { %> <% } else { %> required<% } %> value="<%-__(item.value || ((window.quiz.custom_json?.prefill_answers && window.user_properties[item.name || screen.id]) ? window.user_properties[item.name || screen.id] : ''))%>" <%= item.isAutofocus === "false" ? '' : 'data-autofocus' %> data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>" > <% } %>
<% } %> <% if (item.type=='city' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> required<% } %> value="<%-__(item.value || ((window.quiz.custom_json?.prefill_answers && window.user_properties[item.name || screen.id]) ? window.user_properties[item.name || screen.id] : ''))%>" autocomplete="off" <%= item.isAutofocus === "false" ? '' : 'data-autofocus' %>>
<% } %> <% if (item.type=='password' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> required<% } %> value="" <%= item.isAutofocus === "false" ? '' : 'data-autofocus' %> minlength="<%- item.minLength || '' %>">
<% } %> <% if (item.type=='time-input' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if(item.required == 'true') {%>required<% } %> value="<%- __(item.value || ((window.quiz.custom_json?.prefill_answers && window.user_properties[item.name || screen.id]) ? window.user_properties[item.name || screen.id] : '')) %>" autofocus>
<% } %> <% if (item.type=='time-select' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% const timeValue = __(item.value); const [hours, minutes] = timeValue ? timeValue.split(':').map(Number) : [0, 0]; const roundedMinutes = Math.round(minutes / 5) * 5; let adjustedHours = hours; let adjustedMinutes = roundedMinutes; if (roundedMinutes === 60) { adjustedHours = (hours + 1) % 24; adjustedMinutes = 0; } %>
:
<% } %> <% if (item.type=='number' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> required<% } %> value="<%-__(item.value || ((window.quiz.custom_json?.prefill_answers && window.user_properties[item.name || screen.id]) ? window.user_properties[item.name || screen.id] : ''))%>" <%= item.isAutofocus === "false" ? '' : 'data-autofocus' %> data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>" >
<% } %> <% if (item.type=='date' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> required<% } %> value="<%- __(item.value || ((window.quiz.custom_json?.prefill_answers && window.user_properties[item.name || screen.id]) ? window.user_properties[item.name || screen.id] : ''))%>" autofocus>
<% } %> <% if (item.type=='date-format' ) { %> <% var dateFormat = item.date_format || 'DD-MM-YYYY'; var dateOrder = []; if (dateFormat.toUpperCase().indexOf('DD') < dateFormat.toUpperCase().indexOf('MM') && dateFormat.toUpperCase().indexOf('MM') < dateFormat.toUpperCase().indexOf('YYYY')) { dateOrder = ['day', 'month', 'year']; // DD-MM-YYYY } else if (dateFormat.toUpperCase().indexOf('MM') < dateFormat.toUpperCase().indexOf('DD') && dateFormat.toUpperCase().indexOf('DD') < dateFormat.toUpperCase().indexOf('YYYY')) { dateOrder = ['month', 'day', 'year']; // MM-DD-YYYY } else if (dateFormat.toUpperCase().indexOf('YYYY') < dateFormat.toUpperCase().indexOf('MM') && dateFormat.toUpperCase().indexOf('MM') < dateFormat.toUpperCase().indexOf('DD')) { dateOrder = ['year', 'month', 'day']; // YYYY-MM-DD } else { dateOrder = ['day', 'month', 'year']; // default } var defaultDay = null; var defaultMonth = null; var defaultYear = null; if (item.value) { // Try to parse the value as a date var parsedDate = null; // Try different separators and formats var separators = ['-', '.', '/', ' ']; var parts = null; for (var i = 0; i < separators.length; i++) { if (item.value.indexOf(separators[i]) > -1) { parts = item.value.split(separators[i]); break; } } if (parts && parts.length === 3) { var p1 = parseInt(parts[0]); var p2 = parseInt(parts[1]); var p3 = parseInt(parts[2]); if (!isNaN(p1) && !isNaN(p2) && !isNaN(p3)) { // Determine format based on values and current format if (p3 > 31 || p3.toString().length === 4) { // Year is last if (p1 > 12) { defaultYear = p3; defaultMonth = p2; defaultDay = p1; // DD-MM-YYYY } else if (p2 > 12) { defaultYear = p3; defaultMonth = p1; defaultDay = p2; // MM-DD-YYYY } else { // Use current format preference if (dateFormat === 'MM-DD-YYYY') { defaultYear = p3; defaultMonth = p1; defaultDay = p2; } else { defaultYear = p3; defaultMonth = p2; defaultDay = p1; // default DD-MM-YYYY } } } else { // All values are ambiguous (โ‰ค31), use current format if (dateFormat === 'MM-DD-YYYY') { defaultYear = p3; defaultMonth = p1; defaultDay = p2; } else if (dateFormat === 'YYYY-MM-DD') { defaultYear = p1; defaultMonth = p2; defaultDay = p3; } else { defaultYear = p3; defaultMonth = p2; defaultDay = p1; // default DD-MM-YYYY } } } } // If parsing failed, try as ISO date if (defaultDay === null) { var isoDate = new Date(item.value); if (!isNaN(isoDate.getTime())) { defaultDay = isoDate.getDate(); defaultMonth = isoDate.getMonth() + 1; defaultYear = isoDate.getFullYear(); } } } var minDate = null; var maxDate = null; if (item.min_date) { minDate = new Date(item.min_date); } if (item.max_date) { maxDate = new Date(item.max_date); } var minYear = minDate ? minDate.getFullYear() : 1900; var maxYear = maxDate ? maxDate.getFullYear() : 2100; %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
<% if (item.label) { %> <% } %>
<% if (dateFormat === 'DD-MM-YYYY') { %>
<% } else if (dateFormat === 'MM-DD-YYYY') { %>
<% } %>
<% } %> <% if (item.type=='time-format' ) { %> <% // Parse item.value if provided (expects format like "02:30 PM") var defaultHour = null; var defaultMinute = null; var defaultPeriod = null; if (item.value) { var timeParts = item.value.trim().split(/[\s:]+/); if (timeParts.length >= 2) { var h = parseInt(timeParts[0]); var m = parseInt(timeParts[1]); if (!isNaN(h) && !isNaN(m)) { // Check if 12-hour format with AM/PM if (timeParts.length >= 3 && (timeParts[2].toUpperCase() === 'AM' || timeParts[2].toUpperCase() === 'PM')) { defaultHour = h; defaultMinute = m; defaultPeriod = timeParts[2].toUpperCase(); } else { // Convert 24h to 12h if no AM/PM provided if (h >= 12) { defaultPeriod = 'PM'; defaultHour = h > 12 ? h - 12 : 12; } else { defaultPeriod = 'AM'; defaultHour = h === 0 ? 12 : h; } defaultMinute = m; } } } } %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
<% if (item.label) { %> <% } %>
<% } %> <% if (item.type=='video' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% } %> <% if (item.type=='audio' ) { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
> <% if (item.show_time === true || item.show_time === 'true') { %>
0:00 0:00
<% } %>
<% } %> <% if (item.type=='sort-select' ) { %>
required<% } %> value="<%- (window.quiz.custom_json?.prefill_answers && window.user_properties[screen.id]) ? window.user_properties[screen.id] : '' %>">
<% } %> <% if (item.type=='block-back-time-counter') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>

<%- item.content %>

<% } %> <% if (item.type=='prices-list' ) { %> <% } %> <% if (item.type == 'safe-checkout-banners') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>

<%- __('Guaranteed safe checkout') %>

<%- __('All transactions are secure and encrypted') %>

<% } %> <% if (item.type == 'tos-check') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% } %> <% if (item.type == 'range-4-variants') { %>
<%- __(item.textLeft) %>
or
<%- __(item.textRight) %>
<%- __(item.variant1) %>
<%- __(item.variant2) %>
<%- __(item.variant3) %>
<%- __(item.variant4) %>
<% } %> <% if (item.type == 'slider-results') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
<% item.content.forEach(function(option, index) { %>
<% if (!item.hide_header) { %>
<%- __('Before') %>
<%- __('After') %>
<% } %>
<% if (option.name || option.text || option.title) { %>
<% if (option.name || option.title) { %>

<%- __(option.title || option.name)%>

<% } %> <% if (option.text) { %>

<%- __(option.text)%>

<% } %>
<% } %>
<% }) %>
<% } %> <% if (item.type == 'border-block') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- TemplateManager.renderTemplate('screen-content', { screen: item, prices: window?.paywall_products?.product_info?.product_data?.prices, product_info: window?.paywall_products?.product_info }) %>
<% } %> <% if (item.type == 'columns') { %>
<%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- TemplateManager.renderTemplate('screen-content', {screen: item}) %>
<% } %> <% if (item.type == 'container') { %> Container is not supported in this version of the template. <% } %> <% if (item.type == 'faq-question') { %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>

<%-__(item.content)%>

<% } %> <% if (item.type == 'pay-button') { %> <% } %> <% if (item.type == 'weight') { %> <% // Determine default unit system - imperial if not specified var isMetric = false; if (window.user_properties && window.user_properties.user_units_system) { isMetric = window.user_properties .user_units_system === 'metric'; } else { isMetric = item.default_user_units_system === 'metric'; } // Default to imperial (ft) if no system specified var showImperial = !isMetric; // Determine tab text style var tabTextStyle = item.tab_text_style || 'short'; var imperialTabText = tabTextStyle === 'full' ? 'Imperial' : 'lbs'; var metricTabText = tabTextStyle === 'full' ? 'Metric' : 'kg'; %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (item.second == 'true') { %> <% } %>
<% if (item.default) {%> value="<%- item.default %>" <% } %> <% if (item.min_kg) { %>min="<%- __(item.min_kg) %>"<% } %> <% if (item.max_kg) { %>max="<%- __(item.max_kg) %>"<% } %> <% if (item.placeholder_kg) { %>placeholder="<%- __(item.placeholder_kg) %>"<% } %> <% if(item.required == 'true') {%>required<% } %> data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>"/><%-__('kg')%>
<% if (item.second == 'true') { AnalyticsManager.setUserProperty("weight_selected_measure", "lbs"); %>
<% if (item.default) {%> value="<%- Math.round(item.default * 2.20462) %>" <% } %> <% if (item.min_lbs) { %>min="<%- __(item.min_lbs) %>"<% } %> <% if (item.max_lbs) { %>max="<%- __(item.max_lbs) %>"<% } %> <% if (item.placeholder_lbs) { %>placeholder="<%- __(item.placeholder_lbs) %>"<% } %> <% if(item.required == 'true') {%>required<% } %> data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>"/><%-__('lbs')%>
<% } %>
<% } %> <% if (item.type == 'weight-scroller') { %> <% var defaultUnitSystem = (item.default_user_units_system === 'imperial') ? 'imperial' : 'metric'; var unitLabelKg = (item.unit_label_metric != null && item.unit_label_metric !== '') ? item.unit_label_metric : __('kg'); var unitLabelLbs = (item.unit_label_imperial != null && item.unit_label_imperial !== '') ? item.unit_label_imperial : __('lbs'); %>
= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
data-min-kg="<%- item.min_kg != null && item.min_kg !== '' ? item.min_kg : 30 %>" data-max-kg="<%- item.max_kg != null && item.max_kg !== '' ? item.max_kg : 200 %>" data-min-lbs="<%- item.min_lbs != null && item.min_lbs !== '' ? item.min_lbs : 66 %>" data-max-lbs="<%- item.max_lbs != null && item.max_lbs !== '' ? item.max_lbs : 441 %>" data-default-kg="<%- item.default != null && item.default !== '' ? item.default : 70 %>" data-default-lbs="<%- item.default_lbs != null && item.default_lbs !== '' ? item.default_lbs : 154 %>" data-name="<%- (item.name && String(item.name).trim() !== '' && item.name !== 'weight') ? item.name : 'weight_scroller' %>" data-block-index="<%- screen.id %>-<%- contentItemIndex %>" data-default-unit-system="<%- defaultUnitSystem %>" data-unit-label-kg="<%- unitLabelKg %>" data-unit-label-lbs="<%- unitLabelLbs %>" data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>">
      <% } %> <% if (item.type == 'height-scroller') { %> <% var defaultUnitSystemHeight = (item.default_user_units_system === 'imperial') ? 'imperial' : 'metric'; var unitLabelCm = (item.unit_label_metric != null && item.unit_label_metric !== '') ? item.unit_label_metric : __('cm'); var unitLabelFt = (item.unit_label_imperial != null && item.unit_label_imperial !== '') ? item.unit_label_imperial : __('ft'); %>
      = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
      data-min-cm="<%- item.min_cm != null && item.min_cm !== '' ? item.min_cm : 90 %>" data-max-cm="<%- item.max_cm != null && item.max_cm !== '' ? item.max_cm : 240 %>" data-min-ft="<%- item.min_ft != null && item.min_ft !== '' ? item.min_ft : 3 %>" data-min-in="<%- item.min_in != null && item.min_in !== '' ? item.min_in : 0 %>" data-max-ft="<%- item.max_ft != null && item.max_ft !== '' ? item.max_ft : 7 %>" data-max-in="<%- item.max_in != null && item.max_in !== '' ? item.max_in : 11 %>" data-default-cm="<%- item.default != null && item.default !== '' ? item.default : 170 %>" data-default-ft="<%- item.default_ft != null && item.default_ft !== '' ? item.default_ft : 5 %>" data-default-in="<%- item.default_in != null && item.default_in !== '' ? item.default_in : 7 %>" data-name="<%- (item.name && String(item.name).trim() !== '' && item.name !== 'height') ? item.name : 'height_scroller' %>" data-block-index="<%- screen.id %>-<%- contentItemIndex %>" data-default-unit-system="<%- defaultUnitSystemHeight %>" data-unit-label-cm="<%- unitLabelCm %>" data-unit-label-ft="<%- unitLabelFt %>" data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>">
          <% } %> <% if (item.type == 'number-scroller') { %> <% var numberLabelText = (item.label_text != null && item.label_text !== '') ? item.label_text : ''; %>
          = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
          data-min="<%- item.min != null && item.min !== '' ? item.min : 1 %>" data-max="<%- item.max != null && item.max !== '' ? item.max : 100 %>" data-default="<%- item.default != null && item.default !== '' ? item.default : 50 %>" data-name="<%- (item.name && String(item.name).trim() !== '') ? item.name : 'number_scroller' %>" data-block-index="<%- screen.id %>-<%- contentItemIndex %>" data-label-text="<%- numberLabelText.replace(/"/g, '"') %>" data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>">
            <% if (numberLabelText) { %>
              <% } %>
              <% } %> <% if (item.type == 'diagram') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
              > <% var additionalScaleMaxX = 10; var additionalScaleMaxY = 10; var axisX = Array.isArray(item.axis_x) ? item.axis_x : []; var axisY = Array.isArray(item.axis_y) ? item.axis_y : []; var lineList = Array.isArray(item.lines) ? item.lines : []; var diagramPlotGridHorizontalOnly = item.horizontal_lines_only === true || item.horizontal_lines_only === 'true' || item.plot_grid === 'horizontal'; var isDiagramPreview = typeof getParams === 'function' && (getParams('edit_mode') == 1 || getParams('edit_mode') === '1' || getParams('edit_mode') === true); var hideAuxMarkup = item.hide_aux_markup === true || item.hide_aux_markup === 'true'; var showRuler = isDiagramPreview && item.show_aux_ruler !== false && item.show_aux_ruler !== 'false' && !hideAuxMarkup; var plotW; var plotH; var x0; var y0; var vbW; var vbH; var yRulerX0 = 14; var yRulerX1 = 22; var yRulerNumX = 12; var axisYLabelPad = 6; if (showRuler) { plotW = 250; plotH = 128; x0 = 60; y0 = 144; vbH = 202; axisYLabelPad = 8; } else { plotW = 276; plotH = 132; x0 = 40; y0 = 148; vbH = 180; axisYLabelPad = 8; } var hasAxisY = axisY.length > 0; var hasAxisX = axisX.length > 0; if (!hasAxisY) { if (showRuler) { x0 = 34; } else { x0 = 12; } axisYLabelPad = 4; } if (!hasAxisX && !showRuler) { vbH = y0 + 14; } var plotBleed = 10; vbW = Math.ceil(x0 + plotW + plotBleed); var xRulerSpineY = y0 + (hasAxisX ? 34 : 12); var xRulerTickY1 = y0 + (hasAxisX ? 42 : 20); var xRulerNumY = y0 + (hasAxisX ? 52 : 30); if (showRuler) { vbH = Math.ceil(xRulerNumY + 10); } var labelTopPad = 24; function diagramLabel(cell) { if (cell == null) return ''; if (typeof cell === 'object' && cell.label != null) return String(cell.label); return String(cell || ''); } function diagramNum(v) { var n = parseFloat(v); return isNaN(n) ? 0 : n; } function diagramPointLabelPaddingFromItem(it) { var defX = 6; var defY = 3; var cv = it && it.css_variables; if (!cv || typeof cv !== 'object') { return { padLeft: defX, padRight: defX, padTop: defY, padBottom: defY }; } var raw = cv['--type-diagram-point-label-bg-padding']; if (raw == null || String(raw).trim() === '') { return { padLeft: defX, padRight: defX, padTop: defY, padBottom: defY }; } var nums = String(raw).match(/[\d.]+/g); if (!nums || !nums.length) { return { padLeft: defX, padRight: defX, padTop: defY, padBottom: defY }; } var a = nums.map(function (x) { return parseFloat(x, 10); }); if (a.some(function (n) { return isNaN(n); })) { return { padLeft: defX, padRight: defX, padTop: defY, padBottom: defY }; } if (a.length === 1) { return { padLeft: a[0], padRight: a[0], padTop: a[0], padBottom: a[0] }; } if (a.length === 2) { return { padLeft: a[1], padRight: a[1], padTop: a[0], padBottom: a[0] }; } if (a.length === 3) { return { padLeft: a[1], padRight: a[1], padTop: a[0], padBottom: a[2] }; } return { padLeft: a[3], padRight: a[1], padTop: a[0], padBottom: a[2] }; } function diagramPointLabelBgRadiusFromItem(it) { var def = 3; var cv = it && it.css_variables; if (!cv || typeof cv !== 'object') { return def; } var raw = cv['--type-diagram-point-label-bg-border-radius']; if (raw == null || String(raw).trim() === '') { return def; } var m = String(raw).match(/[\d.]+/); if (!m) { return def; } var n = parseFloat(m[0], 10); if (isNaN(n) || n < 0) { return def; } return n; } function diagramPxX(raw) { var x = Math.max(0, Math.min(additionalScaleMaxX, diagramNum(raw))); return x0 + (x / additionalScaleMaxX) * plotW; } function diagramPyY(raw) { var y = Math.max(0, Math.min(additionalScaleMaxY, diagramNum(raw))); return y0 - (y / additionalScaleMaxY) * plotH; } function diagramAxisXTick(i) { var n = axisX.length; if (n <= 0) return 0; if (n === 1) return additionalScaleMaxX / 2; return (i / (n - 1)) * additionalScaleMaxX; } function diagramAxisYTick(j) { var n = axisY.length; if (n <= 0) return 0; if (n === 1) return additionalScaleMaxY / 2; return (j / (n - 1)) * additionalScaleMaxY; } var xTickEnd = Math.min(200, Math.max(0, Math.floor(Number(additionalScaleMaxX) + 1e-9))); var yTickEnd = Math.min(200, Math.max(0, Math.floor(Number(additionalScaleMaxY) + 1e-9))); var gridDivisions = 10; function diagramLineColorStops(line) { var raw = line && line.color; var arr = []; if (Array.isArray(raw)) { raw.forEach(function (c) { var t = c != null ? String(c).trim() : ''; if (t) arr.push(t); }); } else if (raw != null && String(raw).trim() !== '') { arr.push(String(raw).trim()); } if (!arr.length) { arr.push('#3B82F6'); } return arr; } function diagramLinePixelPoints(pts) { var out = []; if (!Array.isArray(pts)) { return out; } pts.forEach(function (p) { if (!p) { return; } out.push({ x: diagramPxX(p.x), y: diagramPyY(p.y) }); }); return out; } function diagramLinePathSmoothD(pts) { var pv = diagramLinePixelPoints(pts); var n = pv.length; if (n < 2) { return ''; } if (n === 2) { return 'M ' + pv[0].x + ',' + pv[0].y + ' L ' + pv[1].x + ',' + pv[1].y; } var d = 'M ' + pv[0].x + ',' + pv[0].y; for (var i = 0; i < n - 1; i++) { var p0 = pv[Math.max(0, i - 1)]; var p1 = pv[i]; var p2 = pv[i + 1]; var p3 = pv[Math.min(n - 1, i + 2)]; var c1x = p1.x + (p2.x - p0.x) / 6; var c1y = p1.y + (p2.y - p0.y) / 6; var c2x = p2.x - (p3.x - p1.x) / 6; var c2y = p2.y - (p3.y - p1.y) / 6; d += ' C ' + c1x + ',' + c1y + ' ' + c2x + ',' + c2y + ' ' + p2.x + ',' + p2.y; } return d; } function diagramLinePathFlatD(pts) { var pv = diagramLinePixelPoints(pts); if (pv.length < 2) { return ''; } var d = 'M ' + pv[0].x + ',' + pv[0].y; for (var k = 1; k < pv.length; k++) { d += ' L ' + pv[k].x + ',' + pv[k].y; } return d; } function diagramLineStrokePathD(line, pts) { if (line && (line.smooth === false || line.smooth === 'false')) { return diagramLinePathFlatD(pts); } return diagramLinePathSmoothD(pts); } function diagramLineAreaClosedPathD(line, pts) { var open = diagramLineStrokePathD(line, pts); if (!open) { return ''; } var pv = diagramLinePixelPoints(pts); if (pv.length < 2) { return ''; } var first = pv[0]; var last = pv[pv.length - 1]; return open + ' L ' + last.x + ',' + y0 + ' L ' + first.x + ',' + y0 + ' Z'; } var diagramBlockIx = typeof contentItemIndex !== 'undefined' ? contentItemIndex : 0; var diagramAreaFillGx = x0 + plotW / 2; %>
              <% lineList.forEach(function(line, lineIx) { if (!line || typeof line !== 'object') { return; } var ptsG = Array.isArray(line.points) ? line.points : []; var stopsG = diagramLineColorStops(line); var areaFillOff = line.area_fill === false || line.area_fill === 'false'; if (ptsG.length >= 2 && !areaFillOff) { var cArea = stopsG[0]; var areaFillGradId = 'diagram-area-fill-' + diagramBlockIx + '-' + lineIx; %> <% } if (stopsG.length < 2 || ptsG.length < 2) { return; } var p0g = ptsG[0]; var pLg = ptsG[ptsG.length - 1]; if (!p0g || !pLg) { return; } var ggx1 = diagramPxX(p0g.x); var ggy1 = diagramPyY(p0g.y); var ggx2 = diagramPxX(pLg.x); var ggy2 = diagramPyY(pLg.y); var gradId = 'diagram-grad-' + diagramBlockIx + '-' + lineIx; %> <% stopsG.forEach(function(col, si) { var pct = stopsG.length <= 1 ? 0 : (100 * si / (stopsG.length - 1)); %> <% }); %> <% }); %> <% for (var gi = 0; gi <= gridDivisions; gi++) { %> <% var gy = y0 - (gi / gridDivisions) * plotH; %> <% } %> <% if (!diagramPlotGridHorizontalOnly) { for (var gix = 0; gix <= gridDivisions; gix++) { var gx = x0 + (gix / gridDivisions) * plotW; %> <% } } %> <% lineList.forEach(function(line, lineIx) { if (!line || typeof line !== 'object') { return; } var pts = Array.isArray(line.points) ? line.points : []; var stops = diagramLineColorStops(line); var solidFill = stops[0]; var areaFillOffDraw = line.area_fill === false || line.area_fill === 'false'; var lineAnimateOn = !(line.line_animate === false || line.line_animate === 'false'); var hasArea = pts.length >= 2 && !areaFillOffDraw; var layerClasses = 'type-diagram__line-layer'; if (lineAnimateOn && pts.length >= 2) { layerClasses += ' type-diagram__line-layer--animate'; layerClasses += hasArea ? ' type-diagram__line-layer--with-area' : ' type-diagram__line-layer--no-area'; } var layerStyle = (lineAnimateOn && pts.length >= 2) ? '--diagram-line-ix: ' + lineIx + ';' : ''; var strokeDraw = solidFill; if (stops.length >= 2 && pts.length >= 2) { strokeDraw = 'url(#diagram-grad-' + diagramBlockIx + '-' + lineIx + ')'; } %> style="<%- layerStyle %>"<% } %>> <% if (hasArea) { var areaPathD = diagramLineAreaClosedPathD(line, pts); var areaFillId = 'diagram-area-fill-' + diagramBlockIx + '-' + lineIx; var areaClass = 'type-diagram__area'; if (lineAnimateOn) { areaClass += ' type-diagram__area--animate'; } %> <% } if (pts.length >= 2) { var pathD = diagramLineStrokePathD(line, pts); var linePathClass = 'type-diagram__line'; if (lineAnimateOn) { linePathClass += ' type-diagram__line-draw'; } %> pathLength="1"<% } %> /> <% } pts.forEach(function(p) { if (!p) { return; } var cx = diagramPxX(p.x); var cy = diagramPyY(p.y); var pl = diagramLabel({ label: p.label }); var diagramPointMarkerVisible = !(p.show_point === false || p.show_point === 'false'); %> <% if (diagramPointMarkerVisible) { var pointClass = 'type-diagram__point'; if (lineAnimateOn) { pointClass += ' type-diagram__point--after-line'; } %> <% } %> <% if (pl.length) { var dlabel = String(__(pl)); var plPad = diagramPointLabelPaddingFromItem(item); var plCharW = 6; var plLineH = 14; var plLabelH = plLineH + plPad.padTop + plPad.padBottom; var plLabelW = Math.max(28, dlabel.length * plCharW + plPad.padLeft + plPad.padRight); var plLabelBelow = p.label_position === 'below'; var plOffsetY = 18; var plCx = cx; var plCy = plLabelBelow ? (cy + plOffsetY) : (cy - plOffsetY); var plRraw = diagramPointLabelBgRadiusFromItem(item); var plRx = Math.min(plRraw, plLabelW / 2, plLabelH / 2); var plBx = plCx - plLabelW / 2; var plotL = x0; var plotR = x0 + plotW; plBx = Math.max(plotL, Math.min(plBx, plotR - plLabelW)); plCx = plBx + plLabelW / 2; var plBy = plCy - plLabelH / 2; var plTailHalf = 3; var plTailTipX = cx; var plTailBaseY; var plTailTipY; if (plLabelBelow) { plTailBaseY = plBy + 2; plTailTipY = Math.max(plTailBaseY - 9, cy - 6); if (plTailTipY >= plTailBaseY) { plTailTipY = plTailBaseY - 5; } } else { plTailBaseY = plBy + plLabelH - 2; plTailTipY = Math.min(plTailBaseY + 9, cy - 6); if (plTailTipY <= plTailBaseY) { plTailTipY = plTailBaseY + 5; } } var tailBaseCenter = Math.max(plBx + plTailHalf + 0.5, Math.min(plTailTipX, plBx + plLabelW - plTailHalf - 0.5)); var plTailPts = (tailBaseCenter - plTailHalf) + ',' + plTailBaseY + ' ' + (tailBaseCenter + plTailHalf) + ',' + plTailBaseY + ' ' + plTailTipX + ',' + plTailTipY; var labelGroupClass = 'type-diagram__point-label-group'; if (lineAnimateOn) { labelGroupClass += ' type-diagram__point-label-group--after-line'; } %> <%= dlabel %> <% } }); %> <% }); %> <% if (showRuler) { %> <% for (var ryv = 0; ryv <= yTickEnd; ryv++) { %> <% var rpy = diagramPyY(ryv); %> <%= String(ryv) %> <% } %> <% } %> <% axisY.forEach(function(cell, j) { %> <% var yTick = diagramAxisYTick(j); %> <% var ty = diagramPyY(yTick); %> <%= __(diagramLabel(cell)) %> <% }); %> <% axisX.forEach(function(cell, i) { %> <% var nX = axisX.length; %> <% var xTick = diagramAxisXTick(i); %> <% var tx = diagramPxX(xTick); %> <% if (nX > 1 && i === 0) { %> <%= __(diagramLabel(cell)) %> <% } else if (nX > 1 && i === nX - 1) { %> <%= __(diagramLabel(cell)) %> <% } else { %> <%= __(diagramLabel(cell)) %> <% } %> <% }); %> <% if (showRuler) { %> <% for (var rv = 0; rv <= xTickEnd; rv++) { %> <% var rx = diagramPxX(rv); %> <%= String(rv) %> <% } %> <% } %>
              <% } %> <% if (item.type == 'height') { %> <% // Determine default unit system - imperial if not specified var isMetric = false; if (window.user_properties && window.user_properties.user_units_system) { isMetric = window.user_properties.user_units_system === 'metric'; } else { isMetric = item.default_user_units_system === 'metric'; } // Default to imperial (ft) if no system specified var showImperial = !isMetric; // Determine tab text style var tabTextStyle = item.tab_text_style || 'short'; var imperialTabText = tabTextStyle === 'full' ? 'Imperial' : 'ft'; var metricTabText = tabTextStyle === 'full' ? 'Metric' : 'cm'; %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (item.second == 'true') { %> <% } %>
              name="<%- item.name || screen.id %>_cm" <% if (item.min_cm) { %>min="<%- __(item.min_cm) %>"<% } %> <% if (item.max_cm) { %>max="<%- __(item.max_cm) %>"<% } %> <% if (item.default) {%> value="<%- item.default %>" <% } %> <% if(item.required == 'true') {%>required<% } %> <% if (item.placeholder_cm) { %>placeholder="<%- __(item.placeholder_cm) %>"<% } %> data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>" /><%-__('cm')%>
              <% if (item.second == 'true') { %> <% AnalyticsManager.setUserProperty("height_selected_measure", "ft"); let d_in_total = item.default / 2.54; let d_ft = Math.floor(d_in_total / 12) || ''; d_in_total = Math.round(d_in_total - 12 * d_ft) || ''; %>
              <% if (item.min_ft) { %>min="<%- __(item.min_ft) %>"<% } %> <% if (item.max_ft) { %>max="<%- __(item.max_ft) %>"<% } %> value="<%- d_ft %>" <% if (item.placeholder_ft) { %>placeholder="<%- __(item.placeholder_ft) %>"<% } %> <% if(item.required == 'true') {%>required<% } %> data-callback="<%- JSON.stringify({callback: item.callback || ''}).replace(/"/g, '"') %>" /><%-__('ft')%>
              min="<%- __(item.min_in) %>"<% } %> <% if(item.max_in) { %>max="<%- __(item.max_in) %>"<% } %> value="<%- d_in_total %>" <% if (item.placeholder_in) { %>placeholder="<%- __(item.placeholder_in) %>"<% } %> /><%-__('in')%>
              <% } %>
              <% } %> <% if (item.type == 'options-images') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <% item.options.forEach(function(option, index) { %> <% }) %>
              <% } %> <% if (item.type == 'options-audio') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <% item.options.forEach(function(option, index) { %> <% }) %>
              <% } %> <% if (item.type == 'before-after-animated') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <%- __(item.content.before_text) %>

              <%- __(item.content.after_text) %>
              <% } %> <% if (item.type == 'personalization-block') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% item.blocks.forEach(function(option) { %>
              <%- __(option.text) %> <%- __(option.option) %>
              <% }) %>
              <% } %> <% if (item.type == 'twitter-review') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <%- item.name %>
              <% function replaceContent(text) { return text.replace(/([@#]\w+)/g, '$1'); } %> <%- replaceContent(item.comment) %>
              <%- item.comment_count %>
              <%- item.retweet_count %>
              <%- item.likes_count %>
              <% } %> <% if (item.type == 'graph') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (item.lines_count == '1' || item.lines_count == '2_wavy') { %>
              <% if (item.axis_y.length) { %>
              <% } %>
              <%- __(item.zero_point) %>
              <%- __(item.line_1_text) %>
              <%- __(item.line_2_text) %>
              <% if (item.line_1_point) { %>
              <%- __(item.line_1_point) %>
              <% } %> <% if (item.wavy_line) { %> <% } %> <% if (item.line_1_colors.length == 1) { %> <% } %> <% if (item.line_1_colors.length > 1) { %> <% } %> <% if (item.line_1_point.length) { %> <% } %> <% if (item.graph_direction == "up" && item.line_1_background) { %> <% } %> <% if (item.graph_direction != "up" && item.line_1_background) { %> <% } %> <% if (item.wavy_line && item.wavy_background) { %> <% } %>
              <% item.axis_y.forEach(function(option) { %>
              <%- __(option.content || option) %>
              <% }) %>
              <% item.axis_x.forEach(function(option) { %>
              <%- __(option.content || option) %>
              <% }) %>
              <% } %> <% if (item.lines_count == '2') { %>
              <% if (item.axis_y.length) { %>
              <% } %>
              <%- __(item.zero_point) %>
              <%- item.line_1_text %>
              <%- item.line_2_text %>
              <% if (item.line_1_point) { %>
              <%- __(item.line_1_point) %>
              <% } %> <% if (item.line_2_point) { %>
              <%- __(item.line_2_point) %>
              <% } %> <% if (item.line_1_colors.length == 1) { %> <% } %> <% if (item.line_2_colors.length == 1) { %> <% } %> <% if (item.line_1_colors.length > 1) { %> <% } %> <% if (item.line_2_colors.length > 1) { %> <% } %> <% if (item.line_1_point.length) { %> <% } %> <% if (item.line_2_point.length) { %> <% } %> <% if (item.graph_direction == "up") { %> <% if (item.line_1_background) { %> <% } %> <% if (item.line_2_background) { %> <% } %> <% } %> <% if (item.graph_direction != "up") { %> <% if (item.line_1_background) { %> <% } %> <% if (item.line_2_background) { %> <% } %> <% } %>
              <% item.axis_y.forEach(function(option) { %>
              <%- __(option.content || option) %>
              <% }) %>
              <% item.axis_x.forEach(function(option) { %>
              <%- __(option.content || option) %>
              <% }) %>
              <% } %>
              <% } %> <% if (item.type == 'graph-new') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% function topDownLength(str) { str = str.split(' '); return str.filter(line => line === "top_down").length; } %> <% function downTopLength(str) { str = str.split(' '); return str.filter(line => line === "down_top").length; } %> <% function topWavyLength(str) { str = str.split(' '); return str.filter(line => line === "top_wavy").length; } %>
              <% if (item.axis_y.length) { %>
              <% } %>
              <% if (item.top_zero_point.length) { %>
              <%- __(item.top_zero_point) %>
              <% } %> <% if (item.down_zero_point.length) { %>
              <%- __(item.down_zero_point) %>
              <% } %> <% if (item.down_line_1_point.length && downTopLength(item.set_lines) >= 1) { %>
              <%- __(item.down_line_1_point) %>
              <% } %> <% if (item.top_line_1_point.length && topDownLength(item.set_lines) >= 1) { %>
              <%- __(item.top_line_1_point) %>
              <% } %> <% if (item.top_line_2_point.length && topDownLength(item.set_lines) === 2) { %>
              <%- __(item.top_line_2_point) %>
              <% } %> <% if (item.down_line_2_point.length && downTopLength(item.set_lines) === 2) { %>
              <%- __(item.down_line_2_point) %>
              <% } %> <% if (item.top_wavy_background) { %> <% } %> <% if (item.top_down_2_background) { %> <% } %> <% if (item.top_down_1_background) { %> <% } %> <% if (item.down_top_2_background) { %> <% } %> <% if (item.down_top_1_background) { %> <% } %> <% if (topWavyLength(item.set_lines)) { %> <% } %> <% if (topDownLength(item.set_lines) >= 1) { %> <% } %> <% if (topDownLength(item.set_lines) === 2) { %> <% } %> <% if (downTopLength(item.set_lines) >= 1) { %> <% } %> <% if (downTopLength(item.set_lines) === 2) { %> <% } %> <% if (topDownLength(item.set_lines)) { %> <% } %> <% if (downTopLength(item.set_lines)) { %> <% } %>
              <% item.axis_x.forEach(function(option) { %>
              <%- __(option.content || option) %>
              <% }) %>
              <% item.axis_y.forEach(function(option) { %>
              <%- __(option.content || option) %>
              <% }) %>
              <% } %> <% if (item.type=='payment-accordion' ) { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <% item.options.forEach(function(option, index) { %> <% }) %>
              <% } %> <% if (item.type=='primer-payment-accordion' ) { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <% if (getParams('edit_mode') && ['primer', 'hubx'].indexOf(window?.paywall?.payment_system) == -1) { %>
              Change 'Main Payment system' in Paywall Settings to Primer to use this block
              <% } %>
              <% item.options.forEach(function(option, index) { %> <% }) %>
              <% } %> <% if (item.type == 'text-range-slider') { %>
              <%- item.title %>
              <%- item.options[item.start_option]?.content %>
              <%- item.start_content %> <%- item.end_content %>
              <% } %> <% if (item.type == 'timer-sticky') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>

              <%-__(item.content) %>

              <% } %> <% if (item.type == 'customers-joined') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <%- item.title %>
              <% item.customers.forEach(function(option) { %>
              <%- __(option) %>
              <% }) %>
              <% } %> <% if (item.type == 'range-slider') { %>
              Image Slider
              <%- item.title %>
              <%- item.options[item.start_option]?.content %>
              <%- item.options[0]?.content %> <%- item.options[item.options.length - 1]?.content %>
              <% } %> <% if (item.type == 'checkout-summary') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <%-__('Original price')%> <%-__('% OFF')%> <%# specialOfferText - removed from priceInfo %>

              <%-__('Total:')%>
              <%-__('No payment now')%>

              <%-item.content%>

              <% } %> <% if (item.type == 'powered-stripe') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%-__('Powered by')%>
              <% } %> <% if (item.type == 'download-app-banners') { %>
              > <% if (!item.download_app_mode) { if (detectPlatform() == 'iOS' || detectPlatform() == 'iPad') { %> <%} else if (detectPlatform() == 'Android') { %> <% } else { %>

              <%-__(item.qr_code_text)%>

              <% } } else { %>

              <%-__(item.qr_code_text)%>

              <% } %>
              <% } %> <% if (item.type == 'send-download-link') { %> <% } %> <% if (item.type == 'redirect-url') { %> <% if (getParams('edit_mode') == 1) { %>
              Redirect to <%-__(item.url)%>
              <% } else { %> <% } %> <% } %> <% if (item.type=='payment-terms' ) { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>

              <%- __(item.content) %>

              <% } %> <% if (item.type == 'one-click-pay-button') { %> <% } %> <% if (item.type == 'answer-hint') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> <%- __(item.content) %>
              <% } %> <% if (item.type == 'paywall-selector') { %> <%- TemplateManager.renderTemplate('screen-content', {screen: { content: [ { type: "options", name: "paywall_slug", class: "trial-selector", columns: item.options.length, options: item.options.map((el, index) => { el.onclick = '_nothing'; el.value = el.paywall_slug || '/'; el.selected = (index == item.selected_index) || (typeof item.selected_index == 'undefined' && index == item.options.length -1); return el; }) } ] }}) %>

              <%-__(item.content)%>

              arrow
              <% } %> <% if (item.type == 'lottie') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              '>
              <% } %> <% if (item.type == 'file-upload') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>> " <%- item.required ? 'required' : '' %> accept="<%- item.accept_types || '' %>" <%- item.attributes || '' %> />
              <% } %> <% if (item.type == 'subscriptions-list') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              <% if (window.subscriptions && window.subscriptions.length > 0) { %> <% // First show active subscriptions (excluding those scheduled for cancellation) const activeSubscriptions = window.subscriptions.filter(sub => ['active', 'trialing', 'past_due'].includes(sub.status) && sub.price?.period_interval > 0 && !sub.cancel_at_period_end ); const purchases = window.subscriptions.filter(sub => ['active', 'trialing', 'past_due'].includes(sub.status) && sub.price?.period_interval === 0 && !sub.cancel_at_period_end ); const canceledSubscriptions = window.subscriptions.filter(sub => sub.status === 'canceled' || sub.cancel_at_period_end ); %> <% if (activeSubscriptions.length > 0) { %>

              <%-__('Active Subscriptions')%>

              <% activeSubscriptions.forEach(function(subscription) { %>
              <% }); %>
              <% } %> <% if (purchases.length > 0) { %>

              <%-__('Purchases')%>

              <% purchases.forEach(function(subscription) { %>
              Purchase #<%= subscription.id %>
              <%= subscription.price?.price_option_text %>
              <%-__('Created at:')%> <%= new Date(subscription.created_at).toLocaleDateString() %>
              <% }); %>
              <% } %> <% if (canceledSubscriptions.length > 0) { %>

              <%-__('Canceled Subscriptions')%>

              <% canceledSubscriptions.forEach(function(subscription) { %>
              Subscription #<%= subscription.id %>
              <%= subscription.price?.price_option_text %>
              <% if (subscription.cancel_at_period_end && new Date(subscription.next_charge_date) > new Date()) { %> <%-__('Will be canceled at')%> <%= new Date(subscription.next_charge_date).toLocaleDateString() %> <% } else { %> <%-__('Status:')%> <%-__('Canceled')%> <% } %>
              <% }); %>
              <% } %> <% } else { %>
              <%-__('No active subscriptions found')%>
              <% } %>
              <% } %> <% if (item.type == 'cancel-subscription-button') { %> <% } %> <% if (item.type == 'translations') { %> <%# Select autocomplete field template with unified structure %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>"> <% // Get default value and find corresponding display text for translations const defaultValue = __(item.value || ''); let placeholderText = __(item.placeholder || 'Select language'); // If there are translations available, try to find current or first one if (typeof window.translationsVariants !== 'undefined' && window.translationsVariants && window.translationsVariants.length > 0) { const currentTranslation = window.translationsVariants.find(t => t.is_current); const firstTranslation = window.translationsVariants[0]; if (currentTranslation) { placeholderText = `${currentTranslation.emoji} ${currentTranslation.display_name} (${currentTranslation.display_name_en})`; } else if (firstTranslation) { placeholderText = `${firstTranslation.emoji} ${firstTranslation.display_name} (${firstTranslation.display_name_en})`; } } %>
              <% } %> <% if (item.type == 'background-draggable') { %>
              <%- (item.show_on_answer !== "" && item.show_on_answer >= 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %>>
              without-polygon
              with-polygon
              Drag me
              <% } %> <% if (item.type == 'required-checkbox') { %>
              <% } %> <% if (item.type == 'toggle') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
              >
              <% } %> <% if (item.type == 'signature') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
              >
              required<% } %> data-signature-value />
              <% } %> <% if (item.type == 'spin-wheel') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
              >
              <%- __(item.segment_1 || '') %>
              <%- __(item.segment_2 || '') %>
              <%- __(item.segment_3 || '') %>
              <%- __(item.segment_4 || '') %>
              <%- __(item.segment_5 || '') %>
              <%- __(item.segment_6 || '') %>
              <% } %> <% if (item.type == 'scratch-discount') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
              >
              <%- __(item.reveal_text || '') %>
              <% } %> <% if (item.type == 'update-subscription-button') { %>
              = 0) ? 'data-show-on-answer="' + item.show_on_answer + '"' : '' %> data-block-area-index="<%- contentItemIndex %>">
              <% } %> <% }) %>