<script type="text/javascript">

    {% if isDev() is same as(false) %}

    {% endif %}

    const CLIENT_URL = '{{ getClientUrl() }}';
    const CLIENT_DOMAIN = '{{ getClientDomain() }}';
    const AIRLINE_IMGS_URL = '{{ getBaseCiaAerea() }}';
    const B2C_DOMINIO = '{{ getSiteDominio() }}';
    const B2C_CLIENTE = {{ getUsuario()|json_encode|raw }};
    const B2C_CLIENT_SG=  '{{ getClientSg() }}';
    const OS = '{{ osType() }}';
    const EMAIL_EMPRESA = '{{ getEmailEmpresa() }}';
    const CUSTOM_CHECKOUT_ERROR_MESSAGE = '{{ getCustomCheckoutErrorMessage() }}';
    const CUSTOM_NOT_RESULTS_MESSAGE = '{{ customNotResultsMessage()|raw }}';
    const INFOTRAVEL_LOG_ENDPOINT = '{{ getInfotravelLogUrl() }}';

    const AGENCIA = '{{ idUnidade ? idUnidade : null }}';
    const ST_IFRAME = {{ idUnidade and 'I' in idUnidade ? 'true' : 'false' }};
    const ST_DEV = {{ isDev() ? 'true' : 'false' }};

    const ST_QUASE_LA = {{ getStModalQuaseLa() ? 'true' : 'false' }};
    const ST_ORCAMENTO = {{ getStOrcamento() ? 'true' : 'false' }};
    const ST_MOSTRAR_PRECO = {{ getStMostrarPreco() ? 'true' : 'false' }};

    const ST_PAX_DOC = {{ getStPaxDoc() ? 'true' : 'false' }};
    const PAX_DOC_LIST = {{ documentosPermitidoCheckout()|json_encode|raw }};
    const PAX_DOC_PAG_LIST = {{ documentosPagantePermitidoCheckout()|json_encode|raw }};
    const ST_PAGTO_DOIS_CARD = {{ getStDoisCartoes() ? 'true' : 'false' }};

    const ST_PESQUISA_SERVICO = {{ getStPesquisaServico() ? 'true' : 'false' }};

    var msg = window.msg || $.extend({}, {{ ___()|raw }});

    function xhr_url() {
        return '{{ getBasePath() }}/aj/';
    }

    function site_url(path) {
        return '{{ getBasePath() }}/' + (typeof path != 'undefined' ? path : '');
    }

    function ajax_load_url() {
        return '{{ getBasePath() }}/load/';
    }

    function get_theme() {
        return '{{ getTemplatePath() }}';
    }

    window.IPADDRESS = '{{ getIP() }}';
    window.WSS_CONF = '{{ getAutenticacaoStr(idUnidade) }}';
    window.ST_B2C_SOCKET = {{ getStB2CSocket() ? 'true' : 'false' }};
</script>

{% if getStB2CSocket() == true %}
    <script src="{{ getWSPath() }}/socket.io/socket.io.js"></script>
{% endif %}

<script type="text/javascript">
    /* <![CDATA[ */

    /*]]>*/
</script>

{{ assets({files: [
    'assets/js/es6-promise.min.js',
    'assets/js/es6-promise.auto.min.js',
    'assets/js/axios.min.js',
    'assets/js/jquery-3.4.1.min.js',
    'assets/js/popper.min.js',
    'assets/js/handlebars.js',
    'assets/js/bootstrap.min.js',
    'assets/js/picturefill.min.js',
    'assets/js/jquery.mousewheel.min.js',
    'assets/js/lightgallery-all.min.js',
    'assets/js/bootstrap-select.min.js',
    'assets/js/ion.rangeSlider.min.js',
    'assets/js/lg-fullscreen.js',
    'assets/js/moment-with-locales.min.js',
    'assets/js/scripts.js'
], name: 'scripts.js'}) }}

<script type="text/javascript" src="{{ getTemplatePath() }}/assets/js/i18n/defaults-{{ getB2CIdioma() }}.js"></script>

{{ assets({files: [
    '@public/assets/js/jquery-ui.min.js',
    '@public/assets/js/plugins.js',
    '@public/assets/js/v2/b2c-masked-input.js',
    '@public/assets/js/v2/browserDetect.js',
    '@public/assets/js/v2/bundle.js'
], name: 'b2c.js'}) }}

{% if idUnidade and 'I' in idUnidade %}
    {{ assets({files: [
        '@public/integracao/iframe/iframeResizer.contentWindow.js',
    ], name: 'iframeContentWindow.js'}) }}
{% endif %}

<script>

    B2C.path = '{{ getBasePath() }}';
    B2C.reserva.tpReserva = '{{ tpPesquisa }}';
    B2C.lang = '{{ getB2CIdioma() }}';
    B2C.setConfig('{{ pesquisa ? pesquisa : '' }}', {{ getConfigMotor()|raw }}, {{ motor ? motor|json_encode|raw : 'null' }});

    B2C.scripts.opcoes = {{ getJsScripts()|json_encode|raw }};

</script>

{% if not getUsuario() and getFacebookConfig().ativo %}
    <script type="text/javascript">B2CSocial.fbLogin('{{ getFacebookConfig().chave }}');</script>
{% endif %}

{% if not getUsuario() and getGoogleConfig().ativo %}
    <script type="text/javascript" src="//apis.google.com/js/api:client.js"></script>
    <script type="text/javascript">B2CSocial.glLogin('{{ getGoogleConfig().chave }}');</script>
{% endif %}

<script type="text/javascript" src="{{ getBasePath() }}/motor/motorv2.js"></script>

<script type="text/javascript">
    /* <![CDATA[ */
    const motorConfig = {
        nmDominio: '{{ getClientDomainHttps() }}',
        nmDominioMotor: '{{ getMongoUrl() }}',
        nmDominioB2C: B2C_DOMINIO + '/',
        sg_idioma: B2C.lang,
        sgEmpresa: '{{ getClientSg() }}'
    };
    const CHAVE_MOTOR = '{{ getChaveMotor() }}';
    /*]]>*/
</script>

{{ getCustomEndBodyScriptsTagBodyEnd()|raw }}
