/home/blackyak/www/wordpress/wp-content/plugins/wp-travel-engine/dist/global/wte-global.js
(()=>{var t={420:()=>{window.wteL10n=window.wteL10n||{},window.wteL10n.api=window.wteapi=window.WTEApi=class{constructor(){}static async get(t,e={},i={}){let a={packages:this.getPackages,categories:this.getPackageCategories,trip:this.getTrip};return wteL10n.locale&&(e.lang=wteL10n.locale),this[t]||(this[t]="trip"==t?await a[t](e,i):lodash.keyBy(await a[t](e,i),"id")),this[t]}static async getTrip(t,e){const i=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}trip/${t.id}?context=${t.context||"view"}`,e);return await i.json()}static async getPackageCategories(t){const e=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}package-categories?per_page=100`);return await e.json()}static async getPackages(t,e){var i;const a=Object.entries(t).map((([t,e])=>`${t}=${e}`)).join("&"),n=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}packages/${null!==(i=t.id)&&void 0!==i?i:`?${a}`}`,e);return await n.json()}static async addNewPackage(t){const e=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}packages`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":wteL10n.wpapi.nonce},body:JSON.stringify({title:"Untitled Package",status:"publish",post_type:"trip-packages",...t})});return await e.json()}static async removePackage(t){const e=await fetch(`${wteL10n.wpapi.root+wteL10n.wpapi.versionString}packages/${t.id}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":wteL10n.wpapi.nonce}});return await e.json()}}},1778:(t,e,i)=>{"use strict";function a(){}i.d(e,{A:()=>n}),a.hasClass=function(t,e){return t.classList?t.classList.contains(e):!!t.getAttribute("class").match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},a.addClass=function(t,e){var i=e.split(" ");t.classList?t.classList.add(i[0]):a.hasClass(t,i[0])||t.setAttribute("class",t.getAttribute("class")+" "+i[0]),i.length>1&&a.addClass(t,i.slice(1).join(" "))},a.removeClass=function(t,e){var i=e.split(" ");if(t.classList)t.classList.remove(i[0]);else if(a.hasClass(t,i[0])){var n=new RegExp("(\\s|^)"+i[0]+"(\\s|$)");t.setAttribute("class",t.getAttribute("class").replace(n," "))}i.length>1&&a.removeClass(t,i.slice(1).join(" "))},a.toggleClass=function(t,e,i){i?a.addClass(t,e):a.removeClass(t,e)},a.setAttributes=function(t,e){for(var i in e)t?.setAttribute&&t.setAttribute(i,e[i])},a.getChildrenByClassName=function(t,e){t.children;for(var i=[],n=0;n<t.children.length;n++)a.hasClass(t.children[n],e)&&i.push(t.children[n]);return i},a.getIndexInArray=function(t,e){return Array.prototype.indexOf.call(t,e)},a.on=function(t,e,i){document.addEventListener(t,(function(t){for(var a=t.target;a&&a!=this;a=a.parentNode)if(a.matches(e)){i.call(a,t);break}}),!1)};const n=a}},e={};function i(a){var n=e[a];if(void 0!==n)return n.exports;var r=e[a]={exports:{}};return t[a](r,r.exports,i),r.exports}i.d=(t,e)=>{for(var a in e)i.o(e,a)&&!i.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};i.r(t),i.d(t,{calculateGrandTotal:()=>o,numberFormat:()=>c,phpToMomentDF:()=>w,priceFormat:()=>u,wteGetFormatedPrice:()=>a,wteGetFormatedPriceWithCurrencyCode:()=>n,wteGetFormatedPriceWithCurrencyCodeSymbol:()=>r,wteGetFormatedPriceWithCurrencySymbol:()=>s});var e=i(1778);function a(t,e,i){return t=t||0,e=e||!0,i=i||0,"undefined"!=typeof WTE_CC_convData&&WTE_CC_convData.rate&&(t*=parseFloat(WTE_CC_convData.rate)),0==e?t:(t=(t=(t=parseFloat(t)).toFixed(i)).replace(".00",""),t=addCommas(t))}function n(t,e,i,a){return wteL10n.priceFormat(t).format(!0,!!i)}function r(t,e,i,a,n){return wteL10n.priceFormat(t).format(!1,!!a)}function s(t,e,i,a){return wteL10n.priceFormat(t).format(!1,!!i)}function o(){return parseFloat(window.wte.trip.travellersCost)+parseFloat(window.wte.trip.extraServicesCost)}function c(t,e=2,i=".",a=",",n=!0,r=!1){try{e=Math.abs(e),e=isNaN(e)?2:e;const s=t<0?"-":"";if(n){const e=Math.abs(Number(t)||0),{integerPart:n,decimalPart:r}=l(e.toString());let o="";if(r){const t=r.replace(/0+$/,"");t&&(o=i+t)}return s+d(n,a)+o}{let n=Math.abs(Number(t)||0);if(r)n=parseFloat(n.toFixed(e));else{const t=Math.pow(10,e);n=Math.floor(n*t)/t}const{integerPart:o,decimalPart:c}=l(n.toString()),u=d(o,a);let w=function(t,e,i){return e>0&&t?i+t.padEnd(e,"0").substr(0,e):e>0?i+"0".repeat(e):""}(c,e,i);return w&&(w=w.replace(/0+$/,""),w===i&&(w="")),s+u+w}}catch(t){console.log(t)}}function l(t){const e=t.split(".");return{integerPart:e[0],decimalPart:e[1]||""}}function d(t,e){const i=t,a=i.length>3?i.length%3:0;return(a?i.substr(0,a)+e:"")+i.substr(a).replace(/(\d{3})(?=\d)/g,"$1"+e)}function u(t,e,i,a="%CURRENCY_SYMBOL%%FORMATED_AMOUNT%",n=2,r=".",s=",",o=!1,l=!1){t<0&&(a.includes("%AMOUNT%")||a.includes("%FORMATED_AMOUNT%"))&&(t=Math.abs(t),a="-"+a);let d=!0;isNaN(n)||(d=!1),["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","VND","VUV","XAF","XOF","XPF"].includes(e)&&(n=0,d=!1,l=!0);let u={"%CURRENCY_CODE%":o?e:`<span class="wpte-currency-code currency">${e}</span>`,"%CURRENCY_SYMBOL%":o?i:`<span class="wpte-currency-code currency">${i}</span>`,"%AMOUNT%":o?t:`<strong class="wpte-price amount">${t}</strong>`,"%FORMATED_AMOUNT%":o?c(t,n,r,s,d,l):`<strong class="wpte-price amount">${c(t,n,r,s,d,l)}</strong>`};return a.split(/(%\w+%)/g).reduce(((t="",e)=>{const i=u[e];return i||0===i?t+i:t+e}))}function w(t){let e={d:"DD",D:"ddd",j:"D",l:"dddd",w:"d",F:"MMMM",M:"MMM",m:"MM",n:"M",S:"o",jS:"Do",Y:"YYYY",y:"YY"};return t.match(/(\\?\\?[\w\W])/g)?.map((t=>e[t]||t)).join("")}i(420),window.wteL10n.util=window.wteutil=e.A,window.wteL10n.ui=window.wteui=window.wteL10n.ui||{},window.wteL10n.ui.Accordion=window.wteui.Accordion=class{constructor(t){this.element=t,e.A.addClass(this.element,"wte-accordion-initialized"),this.items=e.A.getChildrenByClassName(this.element,"wte-accordion-item"),this.version=this.element.getAttribute("data-version")?"-"+this.element.getAttribute("data-version"):"",this.showClass="wte-accordion-open",this.animateHeight="on"==this.element.getAttribute("data-animation"),this.multiItems=!("off"==this.element.getAttribute("data-multi-items")),this.deepLinkOn="on"==this.element.getAttribute("data-deep-link"),this.initAccordion()}initAccordion(){for(var t=0;t<this.items.length;t++){var i=this.items[t].getElementsByClassName("wte-accordion-button")[0];if(i){var a=this.items[t].getElementsByClassName("wte-accordion-collapse")[0],n=e.A.hasClass(this.items[t],this.showClass)?"true":"false";e.A.setAttributes(i,{"aria-expanded":n,"aria-controls":"accordion-content-"+t,id:"accordion-header-"+t}),e.A.addClass(i,"wte-accordion-trigger"),e.A.setAttributes(a,{"aria-labelledby":"accordion-header-"+t,id:"accordion-content-"+t})}}this.initAccordionEvents(),this.initDeepLink()}initAccordionEvents(){var t=this;this.element.addEventListener("click",(function(i){var a=i.target.closest(".wte-accordion-trigger");a&&e.A.getIndexInArray(t.items,a.closest(".wte-accordion-item"))>=0&&t.triggerAccordion(a)}))}triggerAccordion(t){var e="true"===t.getAttribute("aria-expanded");this.animateAccordion(t,e,!1),!e&&this.deepLinkOn&&history.replaceState(null,"","#"+t.getAttribute("aria-controls"))}animateAccordion(t,i,a){var n=t.closest(".wte-accordion-item"),r=n.getElementsByClassName("wte-accordion-collapse")[0],s=i?"false":"true";e.A.toggleClass(n,this.showClass,!i),t.setAttribute("aria-expanded",s),r&&this.resetContentVisibility(n,r,i),(!this.multiItems&&!i||a)&&this.closeSiblings(n)}resetContentVisibility(t,i,a){e.A.toggleClass(t,this.showClass,!a),i.removeAttribute("style"),a&&!this.multiItems&&this.moveContent()}closeSiblings(t){for(var i=e.A.getIndexInArray(this.items,t),a=0;a<this.items.length;a++)if(e.A.hasClass(this.items[a],this.showClass)&&a!=i)return this.animateAccordion(this.items[a].getElementsByClassName("wte-accordion-trigger")[0],!0,!1),!1}moveContent(){var t=this.element.getElementsByClassName(this.showClass);if(0!=t.length){var e=t[0].getBoundingClientRect();if(e.top<0||e.top>window.innerHeight){var i=window.scrollY||document.documentElement.scrollTop;window.scrollTo(0,e.top+i)}}}initDeepLink(){if(this.deepLinkOn){var t=window.location.hash.substr(1);if(t&&""!=t){var e=this.element.querySelector('.wte-accordion-trigger[aria-controls="'+t+'"]');e&&"true"!==e.getAttribute("aria-expanded")&&(this.animateAccordion(e,!1,!0),setTimeout((function(){e.scrollIntoView(!0)})))}}}},window.wteL10n.helpers=window.wtehelpers=t,window.addCommas||(window.addCommas=t=>{for(var e=(t+="").split("."),i=e[0],a=e.length>1?"."+e[1]:"",n=/(\d+)(\d{3})/;n.test(i);)i=i.replace(n,"$1"+WPTE_Price_Separator+"$2");return i+a}),window.wteGetFormatedPrice=a,window.wteGetFormatedPriceWithCurrencyCode=n,window.wteGetFormatedPriceWithCurrencyCodeSymbol=r,window.wteGetFormatedPriceWithCurrencySymbol=s,window.calculateGrandTotal=o;const p=function(t){const{currency:e,baseCurrency:i,currencySymbol:a,format:{number:n,price:r}}=wteL10n;let s={"%CURRENCY_CODE%":`${e}`,"%CURRENCY_SYMBOL%":`${a}`,"%AMOUNT%":""+(t*=+{[i]:1}[e]),"%FORMATED_AMOUNT%":`${c(t,+n.decimal,n.decimalSeparator,n.thousansSeparator,!0,format.enableRound)}`};return r.split(/(%\w+%)/g).reduce(((t="",e)=>s[e]?t+s[e]:t+e))};e.A.on("click",".wte-popper button",(function(t){let i=this.closest(".wte-popper");i&&e.A.toggleClass(i,"active",!e.A.hasClass(i,"active"))}));const m=function(t){if(!e.A.hasClass(t,"wte-price-field")){let e=t.parentElement,i=document.createElement("input");i.type="hidden",i.name=t.name,i.value=t.value,t.name="",t.value=p(t.value),e.appendChild(i),t.addEventListener("focus",(function(){t.value=i.value})),t.addEventListener("blur",(function(){i.value=t.value,t.value=p(t.value)})),t.classList.add("wte-price-field")}};function h(t){var e=wteL10n.version,i=document.querySelectorAll("[class*=_wte_update_notice_], [data-wte-update]");if(i)for(var a in i){var n=i[a];if(n.classList)if(n.classList.contains(`_wte_update_notice_${e}`))n.classList.remove(`_wte_update_notice_${e}`);else{var r=new RegExp(`^(wte_(new|updated|note)_${e})$`);if(n.dataset.wteUpdate.match(r)){var s=n.dataset.wteUpdate;n.classList.add(s),n.removeAttribute("data-wte-update")}}}}window.wteL10n.ui.priceField=m,document.addEventListener("wteEditPackageRender",(function(){document.querySelectorAll('[data-wte-field-type="price"]')?.forEach((function(t){m(t)}))})),e.A.on("change","[data-toggle-target]",(function(t){let e=document.querySelector(this.dataset.toggleTarget);e&&(this.checked?e.style.removeProperty("display"):e.style.display="none")})),e.A.on("click",".wpte-edit-booking-detail",(function(t){t.preventDefault(),this.closest(".wpte-block").querySelectorAll("select, input").forEach((function(t){t.dataset.attribName&&(t.name=t.dataset.attribName),t.dataset.attribValue&&(t.value=t.dataset.attribValue),t.dataset.attribType&&(t.type=t.dataset.attribType),t.disabled&&(t.disabled=!1),t.type&&(t.readOnly=!1)})),this.closest(".wpte-block").querySelectorAll(".show_on_edit").forEach((function(){this.style.removeProperty("display")}))})),e.A.on("click",".wpte-edit-additional-note",(function(t){t.preventDefault(),this.closest(".wpte-block").querySelectorAll("select, input").forEach((function(t){t.dataset.attribName&&(t.name=t.dataset.attribName),t.dataset.attribValue&&(t.value=t.dataset.attribValue),t.dataset.attribType&&(t.type=t.dataset.attribType),t.disabled&&(t.disabled=!1),t.type&&(t.readOnly=!1)})),this.closest(".wpte-block").querySelectorAll(".show_on_edit").forEach((function(){this.style.removeProperty("display")}))})),e.A.on("click",".wte-email-template-updater",(function(t){t.preventDefault();var e=document.getElementById(this.dataset.target);e&&e.submit()})),document.addEventListener("wteSettingsTabContentLoaded",h),document.addEventListener("DOMContentLoaded",(t=>{h();var i=document.querySelectorAll(".wte-code");i&&i.forEach((function(t){t.dataset.height&&(t.style.height=t.dataset.height+"px"),hljs&&hljs.highlightBlock(t)})),e.A.on("click",".wte-onclick-toggler",(function(t){if(t.preventDefault(),this.dataset.target){var e=document.querySelector(this.dataset.target);e&&(Array.from(e.classList).includes("visible")?(e.classList.remove("visible"),e.style.display="none"):(e.style.removeProperty("display"),e.classList.add("visible")))}}))})),window.wteL10n=window.wteL10n||{};const f=function(t){this._value=t,this._getPriceFormat=function(){return wteL10n.format.price},this.get=function(){return this._value},this.format=function(t=!1,e=!0){const{currency:i,baseCurrency:a,currencySymbol:n,baseCurrencySymbol:r,format:{number:s,price:o,enableRound:c}}=wteL10n;let l={[a]:1};if("undefined"!=typeof wteCc&&wteCc?.code&&e)for(let t in wteCc.code)l={...l,[wteCc.code[t]]:wteCc.rate[t]};let d=+this._value*(e?+l[i]:1),u=+s.decimal;return wtehelpers.priceFormat(d,e?i:a,e?n:r,o,u,s.decimalSeparator,s.thousandSeparator,t,c)}};window.wteL10n.priceFormat=window.wteL10n.priceFormat||function(t){return new f(t)};const g=function(t){this._time=t,this.get=function(){return this._time},this.set=function(t){this._time=t},this._getTimeFormat=function(){return wteL10n.helpers.phpToMomentDF(wteL10n.format.datetime.date)},this.format=function(t=null,e=!1){if(wteL10n.format.datetime.timezone,!this._time)return this._time;if(t)return moment(this._time).format(t);let i=moment(this._time).format(this._getTimeFormat());return i+=e?" at "+moment(this._time).format("h:mm A"):"",i},this.getDatewithOffset=function(t){if(this._time){let e=moment(this._time).utc().format("YYYY-MM-DDTHH:mm:ss")+t;return new Date(e)}}};window.wteL10n.dateFormat=window.wteL10n.dateFormat||function(t){return new g(t)}})()})();