!function(){"use strict";var e,t,r;!function(e){e[e.ERROR=0]="ERROR",e[e.WARN=1]="WARN",e[e.INFO=2]="INFO",e[e.DEBUG=3]="DEBUG"}(e||(e={})),function(e){e.EventEmpty="Empty Event",e.EventUnexpected="Unexpected Event",e.MonitorCallError="Monitor Call Error",e.MonitorCreateError="Monitor Creation Error",e.MonitorDuplicateProp="Monitor Duplicate Property",e.MonitorEmitError="Monitor Emit Error",e.MonitorRemoveError="Monitor Removal Error",e.OperatorError="Operator Error",e.ObserverMultipleLoad="Duplicate Observer",e.ObserverReadError="Read Error",e.ObserverRulesNone="No Rules Defined",e.RuleInvalid="Invalid Rule",e.RuleRegistrationError="Rule Registration Error",e.ObserverInitializationError="Observer Initialization Error",e.RegisterError="Register Error"}(t||(t={})),function(e){e.DataLayerMissing="Data layer not found",e.DuplicateValue="Value $0 already used",e.DuplicateDestination="Only one of destination or fsApi can be defined",e.DuplicateSource="Only one of source or domSource can be defined",e.MissingDestination="destination or fsApi must be defined",e.MissingSource="source or domSource must be defined",e.ShimFail="Shim not allowed because object is $0",e.SelectorInvalidIndex="Selector index $0 is not a number in $1",e.SelectorIncorrectTokenCount="Selector has incorrect number ($0) of tokens in $1",e.SelectorMalformed="Selector $0 is malformed",e.SelectorMissingToken="Selector is missing $0 in $1",e.SelectorNoProps="Selector is missing properties",e.SelectorSyntaxUnsupported="Selector syntax $0 is unsupported",e.TargetSubjectObject="Target subject must be an object",e.TargetPropertyMissing="Target property is missing",e.TargetPathMissing="Target path is missing",e.UnknownValue="Unknown value $0",e.UnsupportedFsApi="Unsupported fsApi $0",e.UnsupportedType="Unsupported type $0"}(r||(r={}));var n=function(){function t(){}return t.prototype.log=function(t){var r=t.context,n=t.level,o=t.message+(r?" "+JSON.stringify(r):"");switch(n){case e.ERROR:return console.error(o);case e.WARN:return console.warn(o);case e.INFO:return console.info(o);case e.DEBUG:default:return console.debug(o)}},t}(),o=function(){function e(){this.timeoutId=null}return e.prototype.log=function(t){var r=this,n=window[window._fs_namespace];if(n){var o=t.context,i=t.level,a=t.message,s=o?{level_int:i,message:a,context:o}:{level_int:i,message:a};this.isDuplicate(t)?("number"==typeof this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout((function(){r.timeoutId=null,n.event("Data Layer Observer",s,"dlo-log")}),e.debounceTime)):n.event("Data Layer Observer",s,"dlo-log"),this.prevEvent=t}},e.prototype.isDuplicate=function(e){var t=e.context,r=e.message;if(!this.prevEvent||!t||!this.prevEvent.context)return!1;var n=t.source,o=t.reason,i=this.prevEvent,a=i.message,s=i.context,u=s.source,p=s.reason;return r===a&&n===u&&o===p},e.debounceTime=250,e}(),i=function(){function t(e){switch(void 0===e&&(e="console"),this.level=1,e){case"fullstory":this.appender=new o;break;case"console":default:this.appender=new n}}return t.format=function(e){for(var t=[],r=1;r0&&(n=r),e.indexOf(t,n)===n}function u(e,t,r){var n;return n=void 0===r||isNaN(r)?e.length:r<0?0:Math.min(r,e.length),e.slice(Math.max(0,n-t.length),n)===t} /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ var p=function(e,t){return(p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function c(e,t){function r(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var l=function(){return(l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=e.MaxPropsCeiling&&this.validate()}return e.coerceNumSuffix=function(){return f.Real},e.coerceSuffix=function(t){if(void 0===t)return null;if(Array.isArray(t))return t.every((function(e){return"string"==typeof e}))?f.Strings:t.every((function(e){return"boolean"==typeof e}))?f.Bools:t.every((function(e){return"number"==typeof e}))?f.Reals:t.every((function(e){return e instanceof Date}))?f.Dates:t.every((function(e){return"object"==typeof e}))?f.Objs:null;if(t instanceof Date)return f.Date;switch(typeof t){case"string":return f.String;case"boolean":return f.Bool;case"number":return e.coerceNumSuffix();case"object":return f.Obj;default:return null}},e.isAlreadySuffixed=function(e){if(null==e)return!1;var t=e.lastIndexOf("_");if(t<0)return!1;var r=e.substring(t);return v.has(r)},e.prototype.mapToSuffix=function(t,r,n){var o=this;void 0===r&&(r=0),void 0===n&&(n=0);var i={};if(null==t)return i;var a=n+Object.getOwnPropertyNames(t).reduce((function(e,r){return void 0!==t[r]?e+1:e}),0);if(a>this.maxProps)throw Error("Number of object properties exceeds the limit ("+this.maxProps+"); increase maxProps to "+a);return Object.getOwnPropertyNames(t).forEach((function(n){var s=t[n],u=0===r&&("pageName"===n||"displayName"===n||"email"===n)||e.isAlreadySuffixed(n)?"":e.coerceSuffix(s),p=""+n+u;if(null!==u)switch(u){case f.Obj:r=0?this.index:e.length+this.index;return"string"==typeof e[t]&&(t-=1),"object"!=typeof e[t]?null:d(e,t,this.mapToSuffix(e[t]))},e.prototype.validate=function(){var t=new h(this.options);t.validate(e.specification);var r=this.options.maxProps;void 0!==r&&r>=e.MaxPropsCeiling&&t.throwError("maxProps","exceeds the FullStory limit ("+e.MaxPropsCeiling+"), use a lower value")},e.specification={index:{required:!1,type:["number"]},maxDepth:{required:!1,type:["number"]},maxProps:{required:!1,type:["number"]}},e.DefaultMaxProps=100,e.MaxPropsCeiling=5e3,e}(),m=function(){function e(e){this.options=e;var t=e.index,r=void 0===t?0:t;this.index=r}return e.convert=function(t,r){switch(t){case"bool":return"true"===r||"TRUE"===r||"True"===r;case"date":return new Date(r);case"int":case"real":return r?e.enumerate(r):0;case"string":switch(typeof r){case"boolean":return Boolean(r).toString();case"number":return r.toString();case"undefined":return"";default:return null===r?"":r}default:return r}},e.enumerate=function(e){var t=parseFloat(e);return isNaN(e)||Number.isNaN(t)?NaN:t},e.enumerableProperties=function(e){return Object.getOwnPropertyNames(e).filter((function(t){return"string"==typeof e[t]||Array.isArray(e[t])&&"string"==typeof e[t][0]}))},e.prototype.handleData=function(t){var r=this.index>=0?this.index:t.length+this.index,n=this.options,o=n.properties,i=n.ignore,a=this.options,s=a.enumerate,u=a.force,p=a.preserveArray,c=a.type,f=a.ignoreSuffixed,h=void 0===f||f,v=a.maxDepth,y=void 0===v?1:v;"string"==typeof o&&(o=o.split(",").map((function(e){return e.trim()}))),"string"==typeof i&&(i=i.split(",").map((function(e){return e.trim()})));var m=l({},t[r]);if(y>1)return this.deepConvert(t,r,s,o,c,u,i,h,y,p);if(s){var w=e.enumerableProperties(t[r]);if(i){var b=function(e){return!(null==i?void 0:i.includes(e))};w=w.filter(b)}if(h){b=function(e){return!g.isAlreadySuffixed(e)};w=w.filter(b)}w.forEach((function(n){if("string"==typeof t[r][n])""!==t[r][n]&&(m[n]=e.convert("real",t[r][n]),e.verifyConversion("real",n,m,t[r]));else{m[n]=[];for(var o=0;op||null!=t&&null!=r&&Object.getOwnPropertyNames(t).forEach((function(h){var d=!1,v=t[h],y=typeof v,m=("object"!==y||Array.isArray(v)&&v.length>0&&"object"!=typeof v[0])&&!(s&&s.includes(h))&&!(u&&g.isAlreadySuffixed(h));if(m&&i&&!d&&o&&o.length>0&&("*"===o[0]||o.includes(h))&&(null!=v||a)){if(Array.isArray(v)){r[h]=[];for(var w=0;w0&&"string"==typeof v[0]&&(v.forEach((function(t,n){""!==t&&r.hasOwnProperty(h)&&(r[h][n]=e.convert("real",t))})),e.verifyConversion("real",h,r,t)),d=!0),d||"object"!==y||null===v||(Array.isArray(v)&&v.length>0&&"object"==typeof v[0]?v.forEach((function(e,t){f.deepConvertHelper(e,r[h][t],n,o,i,a,s,u,p,c+1,l)})):f.deepConvertHelper(v,r[h],n,o,i,a,s,u,p,c+1,l))}))},e.prototype.preserveArrayHelper=function(e,t,r){var n=this;r>t||null==e||Object.getOwnPropertyNames(e).forEach((function(o){if(Array.isArray(e[o]))if(1===e[o].length){var i=e[o][0];e[o]=i,n.preserveArrayHelper(e[o],t,r+1)}else e[o].forEach((function(e){n.preserveArrayHelper(e,t,r+1)}));else"object"==typeof e[o]&&n.preserveArrayHelper(e[o],t,r+1)}))},e.prototype.validate=function(){var t=new h(this.options);t.validate(e.specification);var r=this.options,n=r.enumerate,o=r.force,i=r.properties,a=r.type;if(void 0===n&&void 0===i)throw t.throwError("properties","must be specified if 'enumerate' is undefined and vice versa");if(void 0!==n&&"boolean"!=typeof n)throw t.throwError("enumerate","should be a boolean");if(void 0!==o&&"boolean"!=typeof o)throw t.throwError("force","should be a boolean");if(void 0!==o&&o&&"date"===a)throw t.throwError("force","can not forcibly convert dates");if(void 0!==i&&!a)throw t.throwError("type","must be declared when using 'properties'");if(a&&"bool"!==a&&"int"!==a&&"real"!==a&&"string"!==a&&"date"!==a)throw t.throwError("type","unknown type '"+a+"' used")},e.verifyConversion=function(e,r,n,o){var a=n[r],s=o[r],u=!0;"int"!==e&&"real"!==e||(u=Array.isArray(a)?a.every((function(e){return!Number.isNaN(e)})):!Number.isNaN(a)),"date"===e&&(u=Array.isArray(a)?a.every((function(e){return!Number.isNaN(e.getTime())})):!Number.isNaN(a.getTime())),u||(n[r]=s,i.getInstance().debug(t.OperatorError,{operator:"convert",property:r.toString(),reason:"Failed to convert to "+e+" for value "+s}))},e.specification={enumerate:{required:!1,type:["boolean"]},force:{required:!1,type:["boolean"]},index:{required:!1,type:["number"]},preserveArray:{required:!1,type:["boolean"]},properties:{required:!1,type:["string,object"]},type:{required:!1,type:["string"]},ignore:{required:!1,type:["string,object"]},ignoreSuffixed:{required:!1,type:["boolean"]},maxDepth:{required:!1,type:["number"]}},e}(),w=function(){function e(e){this.options=e;var t=e.index,r=void 0===t?0:t,n=e.maxDepth,o=void 0===n?10:n;this.index=r,this.maxDepth=o}return e.prototype.flattenHelper=function(e,t,r){var n=this;void 0===r&&(r=0),Object.getOwnPropertyNames(t).forEach((function(o){"object"==typeof t[o]&&null!=t[o]&&!Array.isArray(t[o])&&r=60&&a<=62||94===a||36===a)0===t&&(t=o);else if(t>0){n=o;break}}var s=e.substring(t,n);if(0!==s.length){var u=this.raw.split(s);if(u.length>2)throw new Error(i.format(r.SelectorIncorrectTokenCount,u.length.toString(),e));if(2!==u.length)throw new Error(i.format(r.SelectorIncorrectTokenCount,u.length.toString(),e));this.name=u[0],this.value=u[1],this.operator="="===s||"==="===s?"==":s}else this.name=this.raw,this.value=null,this.operator=null},k=function(){function e(e){switch(this.raw=e,this.index=0,this.props=[],this.raw=e.trim(),this.raw[0]){case"(":if(")"!==this.raw[this.raw.length-1])throw new Error(i.format(r.SelectorMissingToken,")",e));this.kind=E.Pick,this.parseProps(this.raw.substring(1,this.raw.length-1));break;case"!":if("("!==this.raw[1])throw new Error(i.format(r.SelectorMissingToken,"(",e));if(")"!==this.raw[this.raw.length-1])throw new Error(i.format(r.SelectorMissingToken,")",e));this.kind=E.Omit,this.parseProps(this.raw.substring(2,this.raw.length-1));break;case"^":if("("!==this.raw[1])throw new Error(i.format(r.SelectorMissingToken,"(",e));if(")"!==this.raw[this.raw.length-1])throw new Error(i.format(r.SelectorMissingToken,")",e));this.kind=E.Prefix,this.parseProps(this.raw.substring(2,this.raw.length-1));break;case"$":if("("!==this.raw[1])throw new Error(i.format(r.SelectorMissingToken,"(",e));if(")"!==this.raw[this.raw.length-1])throw new Error(i.format(r.SelectorMissingToken,")",e));this.kind=E.Suffix,this.parseProps(this.raw.substring(2,this.raw.length-1));break;case"?":if("("!==this.raw[1])throw new Error(i.format(r.SelectorMissingToken,"(",e));if(")"!==this.raw[this.raw.length-1])throw new Error(i.format(r.SelectorMissingToken,")",e));this.kind=E.Filter,this.parseProps(this.raw.substring(2,this.raw.length-1));break;default:if(this.index=Number.parseInt(this.raw,10),Number.isNaN(this.index))throw new Error(i.format(r.SelectorInvalidIndex,this.index.toString(),e));this.kind=E.Index}this.propNames=this.props.map((function(e){return e.name}))}return e.prototype.parseProps=function(e){var t=this,n=e.trim();if(0===n.length)throw new Error(r.SelectorNoProps);n.split(",").forEach((function(e){t.props.push(new x(e))}))},e}(),S=function(e){if(this.raw=e,this.raw=this.raw.trim(),!1===this.raw.includes("["))throw new Error(i.format(r.SelectorMissingToken,"[",e));if(!1===this.raw.endsWith("]"))throw new Error(i.format(r.SelectorMissingToken,"]",e));var t=this.raw.split("[");if(2!==t.length)throw new Error(i.format(r.SelectorIncorrectTokenCount,t.length.toString(),e));this.prop=t[0],this.op=new k(t[1].substring(0,t[1].length-1))},P=function(){function e(t){this.raw=t,this.parsedInfo={},this.kind=e.sniffKind(t),this.parse()}return e.prototype.select=function(e){if(null!=e)switch(this.kind){case y.Pluck:return this.selectPluck(e);case y.Index:return this.selectIndex(e);case y.Pick:return this.selectPick(e);case y.Omit:return this.selectOmit(e);case y.Prefix:return this.selectPrefix(e);case y.Suffix:return this.selectSuffix(e);case y.Filter:return this.selectFilter(e);default:throw new Error(i.format(r.SelectorSyntaxUnsupported,this.kind))}},e.prototype.parse=function(){switch(this.kind){case y.Pluck:break;case y.Index:case y.Pick:case y.Omit:case y.Prefix:case y.Suffix:case y.Filter:this.brackets=new S(this.raw);break;default:throw new Error(i.format(r.SelectorSyntaxUnsupported,this.kind))}},e.prototype.selectPluck=function(e){return null===e?void 0:e[this.raw]},e.prototype.selectIndex=function(e){if(!this.brackets||this.brackets.op.kind!==E.Index)throw new Error(i.format(r.SelectorMissingToken,"[i]",this.raw));var t=e[this.brackets.prop];if(null!=t){var n=this.brackets.op.index;if(!(n>=t.length||(n<0&&(n=t.length+n),n<0)))try{return t[n]}catch(e){return}}},e.prototype.selectPick=function(e){if(!this.brackets||this.brackets.op.kind!==E.Pick)throw new Error(i.format(r.SelectorMissingToken,"[()]",this.raw));var t=e[this.brackets.prop];if(null!=t){var n={},o=!1;if(this.brackets.op.props.forEach((function(e){void 0!==t[e.name]&&(n[e.name]=t[e.name],o=!0)})),!1!==o)return n}},e.prototype.selectOmit=function(e){if(!this.brackets||this.brackets.op.kind!==E.Omit)throw new Error(i.format(r.SelectorMissingToken,"![()",this.raw));var t=e[this.brackets.prop];if(null!=t){for(var n={},o=!1,a=Object.getOwnPropertyNames(t),s=0;s="===o.operator&&t[o.name]o.value)return;if(">"===o.operator&&t[o.name]<=o.value)return;if("<"===o.operator&&t[o.name]>=o.value)return;break;case"undefined":case"object":if("=="===o.operator&&null!=t[o.name])return;if("!="===o.operator&&null==t[o.name])return;break;default:throw new Error(i.format(r.SelectorSyntaxUnsupported,o.raw))}}return t}},e.sniffKind=function(e){if(0===e.length)throw new Error(i.format(r.SelectorMalformed,e));for(var t=Object.keys(O),n=0;n=0?this.position:a.length-this.position,0,i),a},e.prototype.validate=function(){var t=new h(this.options);t.validate(e.specification);var r=this.options,n=r.select,o=r.value;n||void 0!==o||t.throwError("selection"," and 'value' are missing - at least one is required"),n&&void 0!==o&&t.throwError("selection"," and 'value' are both defined - use only one option")},e.specification={defaultValue:{required:!1,type:["boolean,string,number,object"]},index:{required:!1,type:["number"]},select:{required:!1,type:["string"]},value:{required:!1,type:["boolean,string,number,object"]},position:{required:!1,type:["number"]}},e}(),N=function(){function e(e){this.options=e;var t=e.index,r=void 0===t?0:t,n=e.properties,o=void 0===n?{}:n;this.index=r,this.properties=o}return e.prototype.handleRename=function(e){for(var t=Object.getOwnPropertyNames(this.properties),r=0;r1&&(o=a[0],i=a[1])}e.isValidProperty(o)?t[o]=i:(t[n.property]||(t[n.property]=[]),t[n.property].push(r))}))},e.prototype.handleData=function(e){var t={},r=e[this.index][this.property];return"string"!=typeof r?null:(this.parseHelper(t,r),d(e,this.index,t))},e.prototype.validate=function(){var t=new h(this.options);t.validate(e.specification);var r=this.options,n=r.propertyDelimiters,o=r.keyValueDelimiter,i=r.output,a=void 0===i?"keyValue":i;Array.isArray(n)?Array.isArray(n)&&!n.every((function(e){return"string"==typeof e}))&&t.throwError("propertyDelimiters","has to be an array of strings"):t.throwError("propertyDelimiters","has to be an array of strings"),"keyValue"!==a&&"array"!==a&&t.throwError("output","can only be keyValue or array"),"array"===a&&o&&t.throwError("output","you cannot specify keyValueDelimeter with output=array")},e.specification={propertyDelimiters:{required:!0,type:["object"]},property:{required:!0,type:["string"]},keyValueDelimiter:{required:!1,type:["string"]},output:{required:!1,type:["string"]},index:{required:!1,type:["number"]}},e}(),q=function(){function e(e){this.options=e}return e.prototype.handleData=function(e){var t=a(),r=t[t._fs_namespace];if("function"!=typeof r)throw new Error("_fs_namespace is not a function");var n=this.prepareData(e);if(null===n)return null;n.push("dlo");var o=r.apply(t,n);return null==o?null:[o]},e.prototype.validate=function(){new h(this.options).validate(e.specification)},e.specification={},e}(),U=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.prepareData=function(e){if(null===e||e.length<1)throw new Error("Input data is empty");var t=["setIdentity",{uid:e[0]}];return e.length>1&&(t[1].properties=e[1]),t},t}(q),V=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.prepareData=function(e){if(null===e||e.length<1)throw new Error("Input data is empty");return["setProperties",{type:"page",properties:e[0]}]},t}(q),$=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.prepareData=function(e){if(null===e||e.length<1)throw new Error("Input data is empty");return["setProperties",{type:"user",properties:e[0]}]},t}(q),F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.prepareData=function(e){if(null===e||e.length<1)throw new Error("Input data is empty");if(e.length<2)throw new Error("Input data expected to have two parameters");return["trackEvent",{name:e[0],properties:e[1]}]},t}(q),L=function(){function e(){}return e.create=function(t,n){if(!e.hasOperator(t))throw new Error(i.format(r.UnknownValue,t));return new this.operators[t](n)},e.hasOperator=function(e){return void 0!==this.operators[e]},e.operators={convert:m,flatten:w,function:j,insert:A,suffix:g,query:R,rename:N,"fan-out":T,parse:C},e}(),H=function(e,t,r){this.path=e,this.property=t,this.args=r},z=function(e,t,r){this.path=e,this.property=t,this.value=r};function W(e,t){return"datalayerobserver/"+e+"/"+t}var B,J="dlo_init_span",G="dlo_rule_collection_span",K="dlo_rule_registration_span",Y="dlo_handle_event_span",Z="dlo_client_error",Q="dlo_operator_error",X="dlo_monitor_removal_error",ee="dlo_monitor_call_error",te="dlo_monitor_emit_error",re="dlo_observer_read_error",ne="dlo_invalid_rule_error",oe="dlo_rule_registration_error",ie="dlo_observer_init_error",ae={version:"4.1.3"},se=function(){function e(t,r,n){this.name=t,this.sendSpan=r,this.attributes=n,this.startTime=e.getCurrentTime()}return e.prototype.end=function(){try{var t=e.getCurrentTime()-this.startTime;if(t<0||Number.isNaN(t))return void i.getInstance().debug("ignoring span, calculated an invalid duration: "+t);this.sendSpan({name:this.name,timestamp:(new Date).toISOString(),attributes:this.attributes,duration:t})}catch(e){i.getInstance().debug("Error sending telemetry span: "+e.message)}},e.getCurrentTime=function(){return window.performance&&window.performance.now()||(new Date).getTime()},e}(),ue=function(){function e(e){this.exporter=e,this.defaultAttributes={}}return e.prototype.startSpan=function(e,t){try{return new se(e,this.exporter.sendSpan,this.mergeWithDefaultAttributes(t))}catch(e){return i.getInstance().debug("Error starting telemetry span: "+e.message),{end:function(){}}}},e.prototype.count=function(e,t,r){try{this.exporter.sendCount({name:e,timestamp:(new Date).toISOString(),attributes:this.mergeWithDefaultAttributes(r),value:t})}catch(e){i.getInstance().debug("Error sending telemetry count: "+e.message)}},e.prototype.withDefaultAttributes=function(e){return this.defaultAttributes=e,this},e.prototype.mergeWithDefaultAttributes=function(e){return l(l({},this.defaultAttributes),e)},e}(),pe={sendSpan:function(e){console.debug("Telemetry Span",e)},sendCount:function(e){console.debug("Telemetry Count",e)}},ce={sendSpan:function(){},sendCount:function(){}},le=function(){function e(){}return e.setProvider=function(t){e.instance=t},e.withExporter=function(e){return new ue("console"===e?pe:e&&"string"!=typeof e?e:ce)},e.getInstance=function(){return e.instance||(e.instance=e.withExporter(ce)),e.instance},e.startSpan=function(t,r){return e.getInstance().startSpan(t,r)},e.count=function(t,r,n){e.getInstance().count(t,r,n)},e.error=function(t){e.count(Z,1,{errorType:t})},e}(),fe=function(){function e(t,n,o,i){if(void 0===o&&(o=!1),void 0===i&&(i=e.DefaultDebounceTime),this.source=t,this.target=n,this.debug=o,this.debounce=i,this.listener=null,this.operators=[],this.timeoutId=null,this.debugger=function(e,t,r){return console.debug(t?""+r+e+"\n"+r+JSON.stringify(t):""+r+e)},!n||!n.value)throw new Error(r.DataLayerMissing);this.start()}return e.prototype.fireEvent=function(e){void 0===e&&(e=this.target.query()),e&&this.handleData([e])},e.prototype.handleEvent=function(e){var r=this,n=e.detail,o=n.args,a=n.value,s=e.type,u=this.target.path;if(void 0===a&&void 0===o)i.getInstance().debug(t.EventEmpty,{path:u});else if(s===W(this.source,u))if(void 0!==a){"number"==typeof this.timeoutId&&window.clearTimeout(this.timeoutId);var p=this.target.query();p&&(this.timeoutId=window.setTimeout((function(){r.timeoutId=null,r.handleData([p])}),this.debounce))}else this.handleData(o||[]);else i.getInstance().warn(t.EventUnexpected,{path:u})},e.prototype.handleData=function(r,n){void 0===n&&(n=0);var o=le.startSpan(Y,{operatorCount:this.operators.length,operatorNames:this.operators.map((function(e){return e.options.name})).join(",")}),a=this.target.path;this.runDebugger(a+" handleData entry",r);for(var s=r,u=n;u0){var a=le.startSpan(K,{ruleCount:o.length});o.forEach((function(e){return t.registerRule(e)})),a.end()}}return e.prototype.addHandler=function(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=fe.DefaultDebounceTime);var o=new fe(e,t,r,n);return this.handlers.push(o),o},e.prototype.addMonitor=function(e,t){var r=t.subject,n=t.property,o=t.subjectPath,i=t.path,a=t.selector;if("function"===t.type)ve.getInstance().create(e,r,n,i);else{a&&ve.getInstance().create(e,r,n,o);var s=t.value;Object.getOwnPropertyNames(t.query()).forEach((function(t){ve.getInstance().create(e,s,t,i)}))}},e.prototype.addOperators=function(e,r,n,o,a){var s=this;void 0===n&&(n=void 0),void 0===o&&(o=void 0),void 0===a&&(a=1);var u=this.config,p=u.beforeDestination,c=u.previewDestination,l=void 0===c?"console.log":c,f=u.previewMode;try{if(r.forEach((function(t){e.push(s.getOperator(t))})),p&&1===a)(Array.isArray(p)?p:[p]).forEach((function(t){return e.push(s.getOperator(t))}));if(o)switch(o){case B.SET_IDENTITY:e.push(new U({name:B.SET_IDENTITY}));break;case B.SET_PAGE_PROPERTIES:e.push(new V({name:B.SET_PAGE_PROPERTIES}));break;case B.SET_USER_PROPERTIES:e.push(new $({name:B.SET_USER_PROPERTIES}));break;case B.TRACK_EVENT:e.push(new F({name:B.TRACK_EVENT}));break;default:i.getInstance().error("Unexpected coding error: Unknown fsApi value "+o)}else if(n){var h=f?l:n;a>1&&e.push(new A({name:"insert",position:-1,value:"dlo"})),e.push(new j({name:"function",func:h}))}else i.getInstance().error("Unexpected coding error: Missing fsApi or destination")}catch(n){throw this.removeHandler(e),i.getInstance().error(t.OperatorError,{operator:JSON.stringify(r)}),le.error(Q),n}},e.prototype.getOperator=function(e){try{var r=e.name,n=this.customOperators[r]?this.customOperators[r]:L.create(r,e);return this.config.validateRules&&n.validate(),n}catch(r){throw i.getInstance().error(t.OperatorError,{operator:JSON.stringify(e)}),le.error(Q),r}},e.prototype.isUrlValid=function(e){var t=this.config.urlValidator;return t?t(e):!e||RegExp(e).test(window.location.href)},e.prototype.registerTarget=function(e,r,n,o,a,s,u,p,c,l,f){void 0===n&&(n=void 0),void 0===o&&(o=void 0),void 0===a&&(a=void 0),void 0===s&&(s=void 0),void 0===u&&(u=!1),void 0===p&&(p=!0),void 0===c&&(c=!1),void 0===l&&(l=fe.DefaultDebounceTime),void 0===f&&(f=1);var h=e,d=h.value;p&&Array.isArray(d)&&(d.push&&d.unshift?(this.registerTarget(he.find(e.path+".unshift"),r,n,void 0,a,s,!1,!0,c,l,f),h=he.find(e.path+".push")):i.getInstance().warn(t.MonitorCreateError,{path:h.path,reason:"Browser does not support push and unshift"}));var v=null!=n?n:o,y=this.addHandler(v,h,!!c,l);if(this.addOperators(y,r,a,s,f),u)if(Array.isArray(d))for(var g=0;gn)r();else if(e())t();else{var s=Math.pow(2,o-1)*i+Math.random();setTimeout((function(){a.sleep(e,t,r,n,o+1,i)}),s)}},e.prototype.registerRule=function(n){var o=this,a=this.config.readOnLoad,s=n.id,u=void 0===s?"":s,p=n.debounce,c=n.debug,l=n.source,f=n.domSource,h=n.operators,d=void 0===h?[]:h,v=n.destination,y=n.fsApi,g=n.version,m=n.readOnLoad,w=n.url,b=n.monitor,E=void 0===b||b,O=n.waitUntil,x=void 0===O?e.DefaultWaitUntil:O,k=void 0===m?a:m;if(!l&&!f)return i.getInstance().error(t.RuleInvalid,{reason:r.MissingSource}),void le.error(ne);if(l&&f)return i.getInstance().error(t.RuleInvalid,{reason:r.DuplicateSource}),void le.error(ne);if(!v&&!y)return i.getInstance().error(t.OperatorError,{reason:r.MissingDestination}),void le.error(Q);if(v&&y)return i.getInstance().error(t.OperatorError,{reason:r.DuplicateDestination}),void le.error(Q);if(y&&!Object.values(B).includes(y)){var S=i.format(r.UnsupportedFsApi,y);return i.getInstance().error(t.OperatorError,{reason:S}),void le.error(Q)}if(this.isUrlValid(w))try{var P=function(){if(l){var e=he.find(l);o.registerTarget(e,d,l,void 0,v,y,k,E,c,p,g)}else if(f){document.querySelectorAll(f).forEach((function(e){try{if(e.textContent){var r=new ye(f,JSON.parse(e.textContent));k||i.getInstance().warn("readOnLoad set to false, but being ignored as domSource requires it to be true"),E&&i.getInstance().warn("monitor set to true, but being ignored as domSource requires it to be false"),o.registerTarget(r,d,void 0,f,v,y,!0,!1,c,p,g)}else i.getInstance().warn("Found element for "+f+" but had no text content")}catch(e){i.getInstance().warn(t.RuleRegistrationError,{rule:u,source:l,reason:e.message})}}))}else i.getInstance().warn("Unexpected path of code in registeringTarget")},D=n.maxRetry,I=void 0===D?5:D;if(f)"loading"!==document.readyState?P():document.addEventListener("DOMContentLoaded",(function(){P()}));else if(l)switch(typeof x){case"number":setTimeout((function(){P()}),x>-1?x:0);break;case"function":this.sleep((function(){return x(he.find(l))}),P,(function(){return i.getInstance().warn(t.RuleRegistrationError,{rule:u,source:l,reason:"Max Retries Attempted"})}),I);break;default:i.getInstance().warn(i.format(r.UnsupportedType,typeof x))}}catch(e){i.getInstance().warn(t.RuleRegistrationError,{rule:u,source:l,reason:e.message})}},e.prototype.registerOperator=function(e,t){if(L.hasOperator(e)||this.customOperators[e])throw new Error(i.format(r.DuplicateValue,e));this.customOperators[e]=t},e.prototype.removeHandler=function(e){e.stop();var t=this.handlers.indexOf(e);t>-1&&this.handlers.splice(t,1)},e.DefaultWaitUntil=function(e){var t=e.value;if(void 0===t&&("object"!=typeof t||"function"!=typeof t))return!1;if("object"==typeof t){var r=e.query();return void 0!==r&&Object.getOwnPropertyNames(r).length>0}return!0},e}();!function(){try{var e=window;i.getInstance(e._dlo_appender),e._dlo_telemetryProvider?le.setProvider(e._dlo_telemetryProvider):le.setProvider(le.withExporter(e._dlo_telemetryExporter).withDefaultAttributes(ae));var r=le.startSpan(J);if(e._dlo_observer)return void i.getInstance().warn(t.ObserverMultipleLoad);var n=function(){try{var e=le.startSpan(G),r=[];return Object.getOwnPropertyNames(window).forEach((function(e){if(!1!==s(e,"_dlo_rules")){var n=window[e];!1!==Array.isArray(n)?n.forEach((function(e){r.push(e)})):i.getInstance().warn(t.RuleInvalid,{property:n,reason:"Rules list must be an array"})}})),e.end(),r}catch(e){return i.getInstance().error(t.RuleRegistrationError,{reason:"Error: "+e}),le.error(oe),[]}}();0===n.length&&i.getInstance().warn(t.ObserverRulesNone),e._dlo_observer=new ge({appender:e._dlo_appender||void 0,beforeDestination:e._dlo_beforeDestination||void 0,logLevel:e._dlo_logLevel,previewMode:!0===e._dlo_previewMode,previewDestination:e._dlo_previewDestination||void 0,readOnLoad:!0===e._dlo_readOnLoad,validateRules:!0===e._dlo_validateRules,urlValidator:e._dlo_urlValidator||void 0,rules:n}),r.end()}catch(e){i.getInstance().error(t.ObserverInitializationError,{reason:"Error: "+e}),le.error(ie)}}()}();