var Guid,FrameEventsBus,FrameEventType,FrameEventsHelper,ToolsHelpers;(function(n){function u(){return i()}function i(n){n===void 0&&(n=0);var u=f();return t[u]?n>=r?"":i(++n):(t[u]=u,u)}function f(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=Math.random()*16|0,i=n==="x"?t:t&3|8;return i.toString(16)})}var t={},r=10;n.get=u})(Guid||(Guid={}));String.prototype.endsWith||(String.prototype.endsWith=function(n,t){var i=t;return(void 0===t||t>this.length)&&(i=this.length),this.substring(i-n.length,i)===n}),function(n){var i=[];n.notify=function(n,t,i){void 0===i&&(i=window.parent);i.postMessage(JSON.stringify({type:n,params:t,source:window.location.toString()}),"*")};n.subscribe=function(n,t,r){i.push({type:n,eventSourceFrameSelector:t,callback:r})};window.addEventListener("message",function(n){var e=r(n),o,s,t,f;if(e)for(o=0,s=i;o<s.length;o++)if(t=s[o],t.type===e.type){if(f=document.querySelector(t.eventSourceFrameSelector),t.eventSourceFrameSelector&&!f)continue;t.eventSourceFrameSelector&&!u(e.source,f&&f.getAttribute("src"))||t.callback({frame:f,params:e.params})}});var r=function(n){if(!t(n.origin))return null;try{if(n.data&&"string"==typeof n.data){var i=JSON.parse(n.data);if(i.type&&i.source)return i}}catch(n){return null}return null},u=function(n,t){if(!t)return!0;var r=-1===n.indexOf("?")?n:n.split("?")[0],i=-1===t.indexOf("?")?t:t.split("?")[0];return r.indexOf("http://localhost")>-1&&n!==window.location.toString()||(0!==i.indexOf("http")?0===i.indexOf("//")?r===window.location.protocol+i:r===window.location.origin+i:r===i)},t=function(n){var i,r,u;if(n.indexOf("?")>-1)return t(n.substring(0,n.indexOf("?")));if(n.indexOf("#")>-1)return t(n.substring(0,n.indexOf("#")));if(n.indexOf("http://localhost")>-1)return!0;for(i=0,r=["uptrends.com","uptrends.nl","uptrends.de","uptrends.fr","uptrends.lan","uptrends.net"];i<r.length;i++)if(u=r[i],n.endsWith(u))return!0;return!1}}(FrameEventsBus||(FrameEventsBus={}));!function(n){n.RESIZE="SIZE";n.SIZEREQUEST="SIZEREQUEST";n.GETMETADATA="GET-METADATA";n.SETMETADATA="SET-METADATA";n.SIGNUPANALYTICS="SIGNUPANALYTICS";n.SIGNUPSUCCESS="SUCCESS";n.RequestParentUrl="RequestParentUrl";n.ParentUrlResponse="ParentUrlResponse";n.RequestParentParams="RequestParentParams";n.ParentParamsResponse="ParentParamsResponse"}(FrameEventType||(FrameEventType={}));FrameEventsHelper=function(){function n(){}return n.HandleFrameEvents=function(n,t){var u=this,r,i;void 0===t&&(t="{}");r={};try{r=JSON.parse(t)}catch(n){throw Error("Invalid parameter string passed to FrameEventsHelper: "+t+". "+n.toString());}FrameEventsBus.subscribe(FrameEventType.RESIZE,n,function(n){n.frame.style.height=n.params.height+"px"});FrameEventsBus.subscribe(FrameEventType.SIGNUPANALYTICS,n,function(n){"function"==typeof registerSignup&&n.params&&n.params.data&&window.registerSignup(n.params.data)});FrameEventsBus.subscribe(FrameEventType.GETMETADATA,n,function(n){u.EmitMetadata(n.frame.contentWindow)});i=document.querySelector(n);i&&(i.addEventListener("load",function(){FrameEventsBus.notify(FrameEventType.SIZEREQUEST,null,i.contentWindow);window.requestAnimationFrame(function(){FrameEventsBus.notify(FrameEventType.SIZEREQUEST,null,i.contentWindow)});setTimeout(function(){FrameEventsBus.notify(FrameEventType.SIZEREQUEST,null,i.contentWindow)},1e3)}),FrameEventsBus.subscribe(FrameEventType.RequestParentUrl,n,function(){FrameEventsBus.notify(FrameEventType.ParentUrlResponse,{url:window.location.href},i.contentWindow)}),FrameEventsBus.subscribe(FrameEventType.RequestParentParams,n,function(n){var e={},t,f,u,o;if(n.params.paramNames){for(t=0,f=n.params.paramNames;t<f.length;t++)u=f[t],o=ToolsHelpers.getQueryStringParameter(u),e[u]=o||r[u];FrameEventsBus.notify(FrameEventType.ParentParamsResponse,e,i.contentWindow)}}))},n.EmitMetadata=function(n){var t=document.querySelector("#cloudamp__data__c");FrameEventsBus.notify(FrameEventType.SETMETADATA,{CloudAmp:t.value},n)},n.SupplyAppAuthToken=function(n){FrameEventsBus.notify(FrameEventType.SIGNUPSUCCESS,n)},n}();ToolsHelpers=function(){function n(){}return n.getQueryStringParameter=function(n){n=n.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(location.search);return null==t?"":decodeURIComponent(t[1].replace(/\+/g," "))},n.FormatDecimalsAccordingToCulture=function(n){return n.toString().replace(".",Formatting.DecimalSeparator)},n.FriendlyUtcDate=function(n){var t=n;return(t=t.replace("T"," ")).substr(0,16)},n}()