!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict";
var g="undefined"!=typeof document&&document.documentMode,f={rootMargin:"0px",threshold:0,load:function(t){if("picture"===t.nodeName.toLowerCase()){var e=t.querySelector("img"),r=!1;null===e&&(e=document.createElement("img"),r=!0),g&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),r&&t.append(e)}if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){for(var a=t.children,o=void 0,i=0;i<=a.length-1;i++)(o=a[i].getAttribute("data-src"))&&(a[i].src=o);t.load()}t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));var n=",";if(t.getAttribute("data-background-delimiter")&&(n=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage="url('"+t.getAttribute("data-background-image").split(n).join("'),url('")+"')";else if(t.getAttribute("data-background-image-set")){var d=t.getAttribute("data-background-image-set").split(n),u=d[0].substr(0,d[0].indexOf(" "))||d[0];
u=-1===u.indexOf("url(")?"url("+u+")":u,1===d.length?t.style.backgroundImage=u:t.setAttribute("style",(t.getAttribute("style")||"")+"background-image: "+u+"; background-image: -webkit-image-set("+d+"); background-image: image-set("+d+")")}t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))},loaded:function(){}};function A(t){t.setAttribute("data-loaded",!0)}var m=function(t){return"true"===t.getAttribute("data-loaded")},v=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;return t instanceof Element?[t]:t instanceof NodeList?t:e.querySelectorAll(t)};return function(){var r,a,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:".lozad",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=Object.assign({},f,t),i=e.root,n=e.rootMargin,d=e.threshold,u=e.load,g=e.loaded,s=void 0;"undefined"!=typeof window&&window.IntersectionObserver&&(s=new IntersectionObserver((r=u,a=g,function(t,e){t.forEach(function(t){(0<t.intersectionRatio||t.isIntersecting)&&(e.unobserve(t.target),m(t.target)||(r(t.target),A(t.target),a(t.target)))})}),{root:i,rootMargin:n,threshold:d}));for(var c,l=v(o,i),b=0;b<l.length;b++)(c=l[b]).getAttribute("data-placeholder-background")&&(c.style.background=c.getAttribute("data-placeholder-background"));return{observe:function(){for(var t=v(o,i),e=0;e<t.length;e++)m(t[e])||(s?s.observe(t[e]):(u(t[e]),A(t[e]),g(t[e])))},triggerLoad:function(t){m(t)||(u(t),A(t),g(t))},observer:s}}});
var isTouchDevice=false;
if(( 'ontouchstart' in window)||(navigator.maxTouchPoints > 0)||(navigator.msMaxTouchPoints > 0) ){ isTouchDevice=true; }
var deviceAgent=navigator.userAgent.toLowerCase();
isTouchDevice=(deviceAgent.match(/(iphone|ipod|ipad)/)||deviceAgent.match(/(android)/)||deviceAgent.match(/(iemobile)/)||deviceAgent.match(/iphone/i)||deviceAgent.match(/ipad/i)||deviceAgent.match(/ipod/i)||deviceAgent.match(/blackberry/i)||deviceAgent.match(/bada/i));
(function(){
'use strict';
let m_init=false;
let m_initName='[DIADAO_SDK] diadao-starter-public.js';
let m_body=null;
let m_html=null;
let m_firstInteractionTriggered=false;
let m_firstHandleInteractionTriggered=false;
let m_hswInteractionEnabled=false;
let m_gsapEnabled=false;
let m_DiadaoWpSdk=null;
let m_debug={
'loading':false,
'js_load':false,
};
document.addEventListener("DOMContentLoaded",(event)=> {
if(m_debug['loading']) console.log('public ready 2');
startScript();
jQuery(window).on('resize', function (){
if(jQuery(window).outerWidth() < 992){
jQuery('html').attr('id', 'device-mobile');
jQuery('body').removeClass('device-desktop').addClass('device-mobile').addClass('device-responsive');
}else{
jQuery('html').attr('id', 'device-desktop');
jQuery('body').removeClass('device-mobile').removeClass('device-responsive').addClass('device-desktop');
}});
});
function startScript(){
m_body=jQuery('body');
m_html=jQuery('html');
if(typeof gsap!=='undefined'
&& typeof ScrollTrigger!=='undefined'
){
m_gsapEnabled=true;
}
if(m_debug['loading']) console.log("[DIADAO-SDK] -> doc ready JS", document.readyState);
if(m_gsapEnabled){
const checkLenisReady=setInterval(()=> {
if(typeof Lenis!=='undefined'){
clearInterval(checkLenisReady);
if(m_debug['loading']) console.log("[DIADAO-SDK] -> Lenis est prêt.");
initialize();
}else{
if(m_debug['loading']) console.log("[DIADAO-SDK] -> En attente du chargement de Lenis...");
}}, 10);
}else{
initialize();
}}
function init_first_interaction_wait(){
if(navigator.userActivation.hasBeenActive){
startFirstInteraction();
}else{
window.addEventListener('click', handleFirstInteraction);
window.addEventListener('keydown', handleFirstInteraction);
window.addEventListener('mousedown', handleFirstInteraction);
window.addEventListener('touchstart', handleFirstInteraction);
window.addEventListener('scroll', handleFirstInteraction);
jQuery('a, button').on('click', function(){
handleFirstInteraction();
});
if(window.location.hash!==undefined
&& window.location.hash!==null
&& window.location.hash!=='#'
&& window.location.hash!=='*'
&& window.location.hash.indexOf('booking')!==-1
){
handleFirstInteraction();
}}
}
function handleFirstInteraction(){
if(!m_firstHandleInteractionTriggered){
m_firstHandleInteractionTriggered=true;
window.removeEventListener('click', handleFirstInteraction);
window.removeEventListener('keydown', handleFirstInteraction);
window.removeEventListener('mousedown', handleFirstInteraction);
window.removeEventListener('touchstart', handleFirstInteraction);
window.removeEventListener('scroll', handleFirstInteraction);
startFirstInteraction();
}}
function startFirstInteraction(){
if(!m_firstInteractionTriggered){
m_firstInteractionTriggered=true;
jQuery('link[data-href]').each(function(){
jQuery(this).attr('href', jQuery(this).data('href') ).removeAttr('data-href');
});
jQuery('script[data-src]').each(function(){
jQuery(this).attr('src', jQuery(this).data('src') ).removeAttr('data-src');
});
const DiadaoWpSdkFirstInteraction=new Event("DiadaoWpSdkFirstInteraction");
window.dispatchEvent(DiadaoWpSdkFirstInteraction);
if(!isPortalHswIframe()
&& !isRestaurantCardPage()
){
(function(d, s){
var t=d.getElementsByTagName(s)[0], e=d.createElement(s);
e.defer=true; e.id='diadao-starter-fancybox-js'; e.src=window['diadao_starter_plugin_url'] + 'public/js/diadao-starter-fancybox.js' + window['diadao_starter_cache_ver'];
t.parentNode.insertBefore(e, t);
})(document, "script");
if(jQuery('.gform_wrapper')!==undefined
&& jQuery('.gform_wrapper').length
){
(function(d, s){
var t=d.getElementsByTagName(s)[0], e=d.createElement(s);
e.defer=true; e.id='diadao-starter-gravforms-js'; e.src=window['diadao_starter_plugin_url'] + 'public/js/diadao-starter-gravforms.js' + window['diadao_starter_cache_ver'];
t.parentNode.insertBefore(e, t);
})(document, "script");
}
if(jQuery('.dia-smartgallery__masonry')!==undefined
&& jQuery('.dia-smartgallery__masonry').length
){
(function(d, s){
var t=d.getElementsByTagName(s)[0], e=d.createElement(s);
e.defer=true; e.id='diadao-starter-smartgallery-js'; e.src=window['diadao_starter_plugin_url'] + 'public/js/diadao-starter-smartgallery.js' + window['diadao_starter_cache_ver'];
t.parentNode.insertBefore(e, t);
})(document, "script");
}
if(window['diadao_gmap_api_url']!==undefined
&& window['diadao_gmap_api_url']!==null
&& jQuery('#diadao-starter-gmap-init-js')!==undefined
&& jQuery('#diadao-starter-gmap-init-js').length
){
(function(d, s){
var t=d.getElementsByTagName(s)[0], e=d.createElement(s);
e.defer=true; e.id='diadao-starter-gmap-js'; e.src=window['diadao_gmap_api_url'];
t.parentNode.insertBefore(e, t);
})(document, "script");
}}
}}
function initialize(){
if((
jQuery('#diadao-hsw-dist-script-js')!==undefined
&& jQuery('#diadao-hsw-dist-script-js').length
&& jQuery('#diadao-hsw-dist-script-js')!==undefined
&& jQuery('#diadao-hsw-dist-script-js').length
)
||
(
jQuery('#diadao-hsw-qs-booking')!==undefined
&& jQuery('#diadao-hsw-qs-booking').length
)
){
m_hswInteractionEnabled=true;
}
init_first_interaction_wait();
init_js_load_trigger(m_html, null);
if(!isPortalHswIframe()
&& !isRestaurantCardPage()
){
if(DiadaoWpSdk!==undefined&&DiadaoWpSdk!==null){
m_DiadaoWpSdk=new DiadaoWpSdk.default();
if(m_init) console.log(m_DiadaoWpSdk);
}
initLazyLoad();
}else{
jQuery('body').addClass('diasdk-ready');
const DiadaoWpSdkStarted=new Event("DiadaoWpSdkStarted");
window.dispatchEvent(DiadaoWpSdkStarted);
}}
function isPortalHswIframe(){
if(window['diadao_hsw_page_iframe']!==undefined
&& parseInt(window['diadao_hsw_page_iframe'])===1
){
return true;
}else{
return false;
}}
function isRestaurantCardPage(){
if(window['diadao_restaurantcard_page']!==undefined
&& parseInt(window['diadao_restaurantcard_page'])===1
){
return true;
}else{
return false;
}}
function isResponsive(){
let res=false;
if(jQuery('body').hasClass('device-responsive')
|| jQuery('body').hasClass('device-mobile')
){
res=true;
}
return res;
}
function init_js_load_trigger(html, dom_document){
var t_html=m_html;
if(html!==null
&& html!==undefined
){
t_html=html;
}
var t_document=document;
if(dom_document!==null
&& dom_document!==undefined
){
t_document=dom_document;
}
if(t_html!==undefined
&& t_html!==null
){
if(m_debug['js_load']) console.log("=======> LOAD JS 0", t_html, t_html.find('.diadao-js-load-trigger[diadao-loaded="0"]').length);
if(t_html.find('.diadao-js-load-trigger[diadao-loaded="0"]')!==undefined
&& t_html.find('.diadao-js-load-trigger[diadao-loaded="0"]').length
){
t_html.find('.diadao-js-load-trigger[diadao-loaded="0"]').each(function(){
var t_script=jQuery(this);
if(m_debug['js_load']) console.log("=======> LOAD JS 1", t_script);
if(t_script.attr('type')==="text/plain"){
var t_id=t_script.attr('id');
var t_src=t_script.data('src');
if(t_src!==undefined
&& t_src!==null
){
if(m_debug['js_load']) console.log("=======> LOAD JS 1");
var head=t_document.head;
var script=t_document.createElement('script');
script.defer=false;
script.async=true;
if(t_id!==undefined
&& t_id!==null
){
script.id=t_id + '-js';
}
script.src=t_src;
head.appendChild(script);
t_script.remove();
}else{
if(m_debug['js_load']) console.log("=======> LOAD JS 2");
t_script.attr('type', 'text/javascript');
t_script.attr('id', t_id);
t_script.attr('diadao-loaded', '1');
t_script.attr('async', 'async');
}}
});
}}
}
function elem_valid(elem){
var t_elem=null;
if(typeof elem==='string'
|| elem instanceof String
){
t_elem=$(elem);
}else{
t_elem=elem;
}
if(t_elem!==undefined
&& t_elem!==null
&& t_elem.length
){
return true;
}else{
return false;
}}
function initLazyLoad(){
const initLozad=lozad('.lozad');
initLozad.observe();
}
window['DiadaoStarterManager']=new (function(){
var self=this;
this.init_js_load_trigger=function(html, dom_document){
init_js_load_trigger(html, dom_document);
}
this.update_lazy_load=function(){
}
this.elem_valid=function(elem){ elem_valid(elem); }})();
})(jQuery);