// source --> https://helixxfoods.ca/wp-content/plugins/dd-woocommerce-affiliates/assets/js/front.js?ver=1.0.3 
(()=>{var t={7757:(t,e,r)=>{t.exports=r(5666)},514:()=>{},5666:t=>{var e=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,a=Object.create(o.prototype),i=new O(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return P()}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=w(i,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function d(){}function p(){}var h={};h[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(j([])));y&&y!==e&&r.call(y,o)&&(h=y);var m=p.prototype=f.prototype=Object.create(h);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(o,a){function i(){return new e((function(n,i){!function n(o,a,i,c){var u=s(t[o],t,a);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,i,c)}),(function(t){n("throw",t,i,c)})):e.resolve(f).then((function(t){l.value=t,i(l)}),(function(t){return n("throw",t,i,c)}))}c(u.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function j(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:P}}function P(){return{value:void 0,done:!0}}return d.prototype=m.constructor=p,p.constructor=d,d.displayName=c(p,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,i,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(b.prototype),b.prototype[a]=function(){return this},t.AsyncIterator=b,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new b(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},g(m),c(m,i,"Generator"),m[o]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function e(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function c(t){e(i,o,a,c,u,"next",t)}function u(t){e(i,o,a,c,u,"throw",t)}c(void 0)}))}}r.r(n);var a=r(7757),i=r.n(a);r(514);function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?c(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}document.addEventListener("DOMContentLoaded",(function(){var t=function(){var t=document.querySelectorAll(".ddwcaf-copy-trigger");if(t.length){var e=function(t,e){t.innerHTML=e||ddwcafFrontObject.i18n.copied};t.forEach((function(t){t.addEventListener("click",(function(t){t.preventDefault();var r=t.target.closest(".ddwcaf-copy-field-container"),n=r.querySelector(".ddwcaf-copy-target").getAttribute("data-copy-text");navigator.clipboard.writeText(n),e(r.querySelector(".ddwcaf-copy-tooltip"))})),t.addEventListener("mouseover",(function(t){t.preventDefault();var r=t.target.closest(".ddwcaf-copy-trigger");e(r.querySelector(".ddwcaf-copy-tooltip"),r.getAttribute("data-tooltip"))}))}))}};t();var e="",r=function(r){if(e&&clearTimeout(e),r.target.value){var o=r.target.closest(".ddwcaf-details-container");e=setTimeout((function(){o.style.opacity=.5,fetch(ddwcafFrontObject.ajax.ajaxUrl,{method:"POST",headers:new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),body:"action=ddwcaf_get_custom_referral_html&nonce=".concat(ddwcafFrontObject.ajax.ajaxNonce,"&custom_page_url=").concat(encodeURIComponent(r.target.value))}).then((function(t){return t.json()})).then((function(e){o.style.opacity=1,e.success&&(o.innerHTML=e.html,t(),n())})).catch((function(t){o.style.opacity=1,console.log(t)}))}),500)}},n=function(){var t=document.querySelector(".ddwcaf-custom-page-url");t&&(t.addEventListener("keyup",(function(t){return r(t)})),t.addEventListener("change",(function(t){return r(t)})))};n();var a,c=document.querySelectorAll(".ddwcaf-analytic-chart");if(c.length){var s=function(){var t=o(i().mark((function t(){var e,r,n,o,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(a in r=[],n=0,o=function(t){r[n]=new Promise((function(r,n){l(t).then((function(n){n&&(e[t]=n),r(e)}))})),++n},e={commissions:{},visits:{}})o(a);return t.next=7,Promise.all(r).then((function(t){return e}));case 7:return t.abrupt("return",t.sent);case 8:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),l=function(){var t=o(i().mark((function t(e){var r,n,o,a,c,s,l,d,p,h,v,y,m,g,b,w,x;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=100,n={parse:!1},o=document.querySelector(".ddwcaf-month").value,a=document.querySelector(".ddwcaf-year").value,c=(c=new Date(a,o,0)).getDate(),(s=new URL("".concat(ddwcafFrontObject.SITE_URL,"/wp-json/ddwcaf/v1/reports/").concat(e,"/stats"))).searchParams.append("order","asc"),s.searchParams.append("interval","day"),s.searchParams.append("per_page",r),s.searchParams.append("affiliate_id",ddwcafFrontObject.affiliate_id),s.searchParams.append("after","".concat(a,"-").concat(o,"-01T00:00:00")),s.searchParams.append("before","".concat(a,"-").concat(o,"-").concat(c,"T23:59:59")),n.path=s,t.prev=14,t.next=17,fetch(n.path);case 17:return l=t.sent,t.next=20,l.json();case 20:if(d=t.sent,p=parseInt(l.headers.get("x-wp-total")),!d){t.next=48;break}if(h=d&&d.totals||null,v=d&&d.intervals||[],!(p>r)){t.next=47;break}y=!0,m=[],g=Math.ceil(p/r),b=1,w=2;case 31:if(!(w<=g)){t.next=44;break}return s.searchParams.set("page",w),t.next=35,f(s).then((function(t){return t}));case 35:if(x=t.sent,m.push(x),++b!==g){t.next=41;break}return y=!1,t.abrupt("break",44);case 41:w++,t.next=31;break;case 44:if(!y){t.next=46;break}return t.abrupt("return",u({},l));case 46:m.forEach((function(t){v=v.concat(t.intervals)}));case 47:return t.abrupt("return",u(u({},l),{totals:h,intervals:v}));case 48:t.next=53;break;case 50:return t.prev=50,t.t0=t.catch(14),t.abrupt("return",t.t0);case 53:case"end":return t.stop()}}),t,null,[[14,50]])})));return function(e){return t.apply(this,arguments)}}(),f=function(){var t=o(i().mark((function t(e){var r,n,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(r={parse:!1}).path=e,t.prev=2,t.next=5,fetch(r.path);case 5:return n=t.sent,t.next=8,n.json();case 8:return o=t.sent,t.abrupt("return",o);case 12:return t.prev=12,t.t0=t.catch(2),t.abrupt("return",t.t0);case 15:case"end":return t.stop()}}),t,null,[[2,12]])})));return function(e){return t.apply(this,arguments)}}();a=document.querySelectorAll(".ddwcaf-loader"),s().then((function(t){a.forEach((function(t){t.classList.add("ddwcaf-hide")}));var e=document.querySelector(".ddwcaf-month").value,r=document.querySelector(".ddwcaf-year").value,n=new Date(r,e,0);n=n.getDate();for(var o=[],i=1;i<=n;i++)o.push(i);c.forEach((function(n){var a=n.getAttribute("data-report"),i=n.getAttribute("data-endpoint"),c=n.getAttribute("data-title"),u=t[i].intervals.map((function(t){return t.subtotals[a]})),s=t[i].totals[a];n.closest(".ddwcaf-chart-wrapper").querySelector(".ddwcaf-total-amount").innerHTML="commissions"===i?formatPrice(s):"conversion_rate"===a?s+"%":s,new Chart(n,{type:"line",data:{labels:o,datasets:[{label:c,data:u,lineTension:.3,backgroundColor:"rgba(78, 115, 223, 0.05)",borderColor:ddwcafFrontObject.primaryColor,pointRadius:2,pointBackgroundColor:ddwcafFrontObject.primaryColor,pointBorderColor:ddwcafFrontObject.primaryColor,pointHoverRadius:2,pointHoverBackgroundColor:ddwcafFrontObject.primaryColor,pointHoverBorderColor:ddwcafFrontObject.primaryColor,pointHitRadius:10,pointBorderWidth:2}]},options:{maintainAspectRatio:!1,scales:{xAxes:[{time:{unit:"date"},gridLines:{display:!1,drawBorder:!1},ticks:{maxTicksLimit:10,padding:10}}],yAxes:[{ticks:{maxTicksLimit:5,padding:10,beginAtZero:!0,callback:function(t){return"commissions"===i?formatPrice(t):"conversion_rate"===a?t+"%":t}},gridLines:{color:"rgb(234, 236, 244)",zeroLineColor:"rgb(234, 236, 244)",drawBorder:!1,borderDash:[2],zeroLineBorderDash:[2]}}]},legend:{display:!1},tooltips:{backgroundColor:"rgb(255,255,255)",bodyFontColor:"#858796",titleMarginBottom:10,titleFontColor:ddwcafFrontObject.primaryColor,titleFontSize:14,borderColor:"#dddfeb",borderWidth:1,xPadding:15,yPadding:15,displayColors:!1,intersect:!1,mode:"index",caretPadding:10,callbacks:{title:function(t,n){var o=t[0].label.toString();return o<=9&&(o="0".concat(o)),"".concat(r,"-").concat(e,"-").concat(o)},label:function(t,e){var r=e.datasets[t.datasetIndex].label;return r+="commissions"===i?": ".concat(formatPrice(t.yLabel)):"conversion_rate"===a?" ".concat(t.yLabel,"%"):" ".concat(t.yLabel),r}}}}})}))})).catch((function(t){console.log(t)}))}}))})();for(var o in n)this[o]=n[o];n.__esModule&&Object.defineProperty(this,"__esModule",{value:!0})})();