define("apex-metrics",["require","exports","tslib"],(function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=new RegExp("^[^0-9a-zA-Z]+"),o=new RegExp("[^0-9a-zA-Z._-]","g"),a=o,s=new RegExp("[^0-9a-zA-Z/._-]","g"),c=o;function u(t){return d(t,"namespace",256,r,a)}function l(t){return d(t,"metric name",256,r,s)}function p(t){return d(t,"tag name",256,r,c)}function _(t){return d(t,"tag value",256)}function d(t,e,n,i,r){var o=[];if(i&&i.test(t)&&o.push("invalid prefix"),r&&r.test(t)&&o.push("invalid characters"),t.length>n&&o.push("exceeds "+n+" characters"),0===t.length&&o.push("is empty"),0!==o.length)throw new Error(e+" identifier '"+t+"' is invalid: "+o);return t}function m(t,e){return{type:"tag",name:t,value:e}}e.validateNamespace=u,e.validateMetricName=l,e.validateTagName=p,e.validateTagValue=_,e.createMetricName=function(t){return{type:"metric_name",value:l(t)}},e.createNamespace=function(t){return{type:"namespace",value:u(t)}},e.createTagName=function(t){return{type:"tag_name",value:p(t)}},e.createTagValue=function(t){return{type:"tag_value",value:_(t)}},e.createTag=m,e.TimeUnit=i,(function(t){t[t.NANOSECONDS=0]="NANOSECONDS",t[t.MILLISECONDS=1]="MILLISECONDS",t[t.SECONDS=2]="SECONDS",t[t.MINUTES=3]="MINUTES",t[t.HOURS=4]="HOURS",t[t.DAYS=5]="DAYS"})(i||(e.TimeUnit=i={}));var h=(function(){function t(){}return t.toMilliseconds=function(t){switch(t.unit){case i.NANOSECONDS:return t.value/1e6;case i.MILLISECONDS:return t.value;case i.SECONDS:return 1e3*t.value;case i.MINUTES:return 6e4*t.value;case i.HOURS:return 36e5*t.value;case i.DAYS:return 24*t.value*36e5}},t})();e.Instant=h;var f=(function(){function t(){}return t.prototype.now=function(){return{value:performance.now(),unit:i.MILLISECONDS}},t})();e.BrowserPerformanceClock=f;var v=(function(){function t(t,e,n){void 0===n&&(n=new f),this.sink=t,this.periodicExecutor=e,this.clock=n}return t.prototype.createPeriodicMetrics=function(t,e,n){return new S(t,this.clock,e,n,this.sink,this.periodicExecutor)},t.prototype.createScopedMetrics=function(t){return new T(t,this.clock,[],this.sink)},t})();e.MetricsFactoryImpl=v;var g=(function(){function t(){}return t.prototype.executeEvery=function(t,e){var n=h.toMilliseconds(t),i=setInterval((function(){e()||clearInterval(i)}),n)},t})();e.SetIntervalExecutor=g;var w=(function(){function t(t,e,n){this.clock=e,this.timers=[],this.counters=[],this.samples={},this.closed=!1,this.namespace=t,this.tags=n}return t.prototype.createCounter=function(t){var e=new y(t);return this.closed||this.counters.push(e),e},t.prototype.createTimer=function(t){var e=new b(t,this.clock);return this.closed||this.timers.push(e),e},t.prototype.recordSample=function(t,e){this.closed||E(this.samples,t,e)},t.prototype.recordTime=function(t,e,n){this.closed||E(this.samples,t,h.toMilliseconds({value:e,unit:n}))},t})(),S=(function(t){function e(e,n,i,r,o,a){var s=t.call(this,e,n,i)||this;return s.sink=o,a.executeEvery(r,(function(){return s.recordData()})),s}return n.__extends(e,t),e.prototype.close=function(){this.closed||(this.closed=!0,this.recordData(!0),this.timers=[],this.counters=[])},e.prototype.recordData=function(t){return void 0===t&&(t=!1),!t&&this.closed||this.sink.recordMetrics(this.getSpans()),!this.closed},e.prototype.getSpans=function(){var t=this;this.timers.filter((function(t){return t.hasSamples()})).forEach((function(e){return x(t.samples,e.name,e.getValues())})),this.counters.filter((function(t){return t.hasSamples()})).forEach((function(e){return x(t.samples,e.name,e.getValues())}));var e=[];if(Object.keys(this.samples).length>0){for(var n={},i=0,r=this.tags;i0){for(var n={},i=0,r=this.tags;i0},t})(),b=(function(){function t(t,e){this.clock=e,this.samples=[],this.name=t,this.startTime=h.toMilliseconds(this.clock.now())}return t.prototype.record=function(){this.samples.push(h.toMilliseconds(this.clock.now())-this.startTime),this.reset()},t.prototype.reset=function(){this.startTime=h.toMilliseconds(this.clock.now())},t.prototype.getValues=function(){var t=this.samples;return this.samples=[],t},t.prototype.hasSamples=function(){return this.samples.length>0},t})();function E(t,e,n){t.hasOwnProperty(e.value)?t[e.value].push(n):t[e.value]=[n]}function x(t,e,n){if(t.hasOwnProperty(e.value)){var i=t[e.value];i.push.apply(i,n)}else t[e.value]=n}var I=(function(){function t(){}return t.prototype.recordMetrics=function(t){},t})();e.NoOpSink=I;var O=(function(){function t(){}return t.prototype.executeEvery=function(t,e){},t})();e.NoOpExecutor=O})),define("modules/clean/js_basic_stopwatch",["require","exports","modules/core/exception"],(function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=!(!window.performance||!window.performance.now),o=0;(function(t){t[t.Span=1]="Span",t[t.AsyncSpan=2]="AsyncSpan",t[t.Trace=3]="Trace"})(i=e.TimingDataType||(e.TimingDataType={}));var a=(function(){function t(t,e,n,i,r){void 0===i&&(i=!1),this.name=t,this.strictAssert=e,this.activeSpans={},this.aggregateSpans={},this._annotations=r||{},this.spanStack=[],this.stopwatchTags=n||[],this.detached=i}return t.prototype.reset=function(){this.activeSpans={},this.spanStack=[],this.aggregateSpans={},this._annotations={}},Object.defineProperty(t.prototype,"annotations",{get:function(){return this._annotations},enumerable:!0,configurable:!0}),t.prototype.addAnnotation=function(t,e){this._annotations[t]=e},t.prototype.removeAnnotation=function(t){delete this._annotations[t]},t.prototype.popResolvedSpans=function(){if(this.detached)return{};var t=this.aggregateSpans;return this.aggregateSpans={},t},t.prototype.peekResolvedSpans=function(){return this.detached?{}:this.aggregateSpans},t.newSpanID=function(){var t=String(o);return o++,t},t.resolveTime=function(t){return void 0===t&&(t=window.performance.now()),Math.round(t)},t.prototype._resolveParent=function(t){if(t.type===i.Span){var e=this.spanStack[this.spanStack.length-1];if(e)if(e!==t.name)this._report_sw_misuse("Closing "+e+" while the latest open span is "+t.name+".\n You are either mixing sync and async spans or closing sync spans out of order.");else{this.spanStack.pop();for(var n="",r=0,o=this.spanStack;r0?e.annotations:void 0,parent:e.parent||"",stopwatch_tags:t.length>0?t:void 0,type:e.type});var r=this.aggregateSpans[n];if(void 0!==e.end_time){if(r.type===i.Trace?(r.total_time=e.end_time-e.start_time,r.num_calls=1):(r.total_time+=e.end_time-e.start_time,r.num_calls+=1),Object.keys(e.annotations).length>0)if(r.annotations)for(var o in e.annotations)e.annotations.hasOwnProperty(o)&&(r.annotations[o]=e.annotations[o]);else r.annotations=e.annotations}else this._report_sw_misuse("Span "+n+" reported with undefined end_time")},t})();e.JSBasicStopwatchImpl=a;var s=(function(){function t(){this.name="",this.annotations={}}return t.prototype.reset=function(){},t.prototype.attach=function(){},t.prototype.addAnnotation=function(t,e){},t.prototype.removeAnnotation=function(t){},t.prototype.popResolvedSpans=function(){return{}},t.prototype.peekResolvedSpans=function(){return{}},t.prototype.start=function(t,e){void 0===e&&(e={})},t.prototype.end=function(t,e){void 0===e&&(e={})},t.prototype.recordTrace=function(t,e){void 0===e&&(e={})},t.prototype.addSpanAnnotation=function(t,e,n,i){},t})();e.NoopStopwatchInstance=new s,e.createStopwatch=function(t,n,i,o,s){return void 0===o&&(o=!1),r?new a(t,n,i,o,s):e.NoopStopwatchInstance}})),define("modules/clean/js_client_stopwatch",["require","exports","tslib","modules/core/xhr","modules/clean/js_basic_stopwatch","modules/constants/request","modules/core/browser","modules/core/exception"],(function(t,e,n,i,r,o,a,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),o=n.__importStar(o),a=n.__importStar(a);var c=(function(){function t(t){this.id=t}return t.REQUEST_ID=new t("dropbox.js_client_stopwatch.request_id"),t.CORRELATION_ID=new t("dropbox.js_client_stopwatch.correlation_id"),t.URL=new t("dropbox.js_client_stopwatch.url"),t})();e.ReservedAnnotationKey=c;var u=(function(){function t(){this.GLOBAL_SW_NAME="GLOBAL_STOPWATCH",this.flush_interval=6e4,this.debugEnabled=!0,this.strictAssert=!1,this.intervalId=null,this.clientStopwatchCounter=1,this.reset()}return t.prototype.reset=function(){this.globalStopwatches={},this.clientStopwatches={},this.clientStopwatchCounter=1,this.sentInitialData=!1,this.create_stopwatch(this.GLOBAL_SW_NAME),this.intervalId&&clearInterval(this.intervalId),this.intervalId=null},t.prototype.reset_individual_stopwatch=function(t){this.stopwatch_exists(t)?this.globalStopwatches[t].reset():this._report_sw_misuse("tried to reset the stopwatch "+t+" but it does not exist")},t.prototype.stopwatch_exists=function(t){return t in this.globalStopwatches},t.prototype.create_stopwatch=function(t,e){this.stopwatch_exists(t)?this._report_sw_misuse("tried to create a new stopwatch "+t+" but it already exists"):this.globalStopwatches[t]=r.createStopwatch(t,this.strictAssert,e)},t.prototype.createDetachedStopwatch=function(t,e){void 0===e&&(e={});var n=r.createStopwatch(t,this.strictAssert,e.tags,!0,e.annotations),i=new l(this.clientStopwatchCounter++,t,n,e.request_id,e.correlation_id,e.url);return this.clientStopwatches[i.id]=i,i},t.prototype.deleteStopwatch=function(t){delete this.clientStopwatches[t.id]},t.prototype.create_stopwatch_if_not_exist=function(t,e){this.stopwatch_exists(t)||this.create_stopwatch(t,e)},t.prototype.getStopwatch=function(t){return this.stopwatch_exists(t)?this.globalStopwatches[t]:(this._report_sw_misuse(t+" doesn't exist"),null)},t.prototype.recordTrace=function(t,e){void 0===e&&(e={});var n=this.getStopwatch(e.stopwatchName||this.GLOBAL_SW_NAME);if(null!=n){var i={traceTime:e.traceTime};return n.recordTrace(t,i)}},t.prototype.startSpan=function(t,e){void 0===e&&(e={});var n=this.getStopwatch(e.stopwatchName||this.GLOBAL_SW_NAME);if(null!=n){var i={startTime:e.startTime,async:e.async};return n.start(t,i)}},t.prototype.endSpan=function(t,e){void 0===e&&(e={});var n=this.getStopwatch(e.stopwatchName||this.GLOBAL_SW_NAME);if(null!=n)return n.end(t,{spanId:e.spanId,endTime:e.endTime})},t.prototype.addSpanAnnotation=function(t,e,n,i){void 0===i&&(i={});var r=this.getStopwatch(i.stopwatchName||this.GLOBAL_SW_NAME);null!=r&&r.addSpanAnnotation(t,e,n,i.spanId)},t.prototype.log_stored_results=function(){this.sentInitialData?this._report_sw_misuse("ClientStopwatch tried to log stored results, but the stopwatch is set to log immediately"):(this.flush_current_data(),this.sentInitialData=!0,this.intervalId=setInterval(this.flush_current_data.bind(this),this.flush_interval))},t.prototype._report_sw_misuse=function(t){t="ClientStopwatch: "+t,this.strictAssert?s.assert(!1,t):s.reportStack(t,{severity:s.SEVERITY.NONCRITICAL,tags:["log_js_stopwatch"]})},t.prototype.flush_current_data=function(){for(var e in this.globalStopwatches)this.globalStopwatches.hasOwnProperty(e)&&t.logStopwatchData(this.globalStopwatches[e]);for(var e in this.clientStopwatches)this.clientStopwatches.hasOwnProperty(e)&&t.logStopwatchData(this.clientStopwatches[e].stopwatch)},t.logStopwatchData=function(e){var n=e.popResolvedSpans(),i=e.name,r={};if(Object.keys(n).length>t.MAXSPANS){var o=0;for(var a in r[i]={},n)n.hasOwnProperty(a)&&(r[i][a]=n[a],o===t.MAXSPANS&&(r[i].annotations=e.annotations,t.send_spans(r),o=0,r[i]={}),o++)}else r[i]=n;0!==Object.keys(r[i]).length&&(r[i].annotations=e.annotations,t.send_spans(r))},t.send_spans=function(t){var e=JSON.stringify(t),n={request_id:o.REQUEST_ID,url:a.get_href().replace("/dws2",""),aggregated_sw_data:e};i.sendXhr("/log_js_sw_data",n)},t.prototype.print_stopwatches_debug=function(){var t=this.get_debug_data();console.table&&console.groupCollapsed&&console.groupEnd&&t&&t.length>0&&(console.groupCollapsed("Request timeline"),console.table(t),console.groupEnd())},t.prototype.get_debug_data=function(){var t=[];for(var e in this.globalStopwatches)if(this.globalStopwatches.hasOwnProperty(e)){var n=this.globalStopwatches[e].peekResolvedSpans();for(var i in n)if(n.hasOwnProperty(i)){var o=n[i],a={stopwatchName:e,spanName:o.name,time:o.start_time+o.total_time};o.type!==r.TimingDataType.AsyncSpan&&o.type!==r.TimingDataType.Span||(a.startTime=o.start_time),o.type===r.TimingDataType.Span&&(a.info="Total time: "+o.total_time+"ms"),t.push(a)}}return t.sort((function(t,e){return t.time-e.time})),t},t.MAXSPANS=2e3,t})();e.JSStopwatch=new u;var l=(function(){function t(t,e,n,i,r,o){this.sentInitialData=!1,this.strictAssert=!1,this.id=t,this.stopwatch=n,this._request_id=i,this._correlation_id=r,this._url=o,this._request_id&&this.stopwatch.addAnnotation(c.REQUEST_ID.id,this._request_id),this._correlation_id&&this.stopwatch.addAnnotation(c.CORRELATION_ID.id,this._correlation_id),this._url&&this.stopwatch.addAnnotation(c.URL.id,this._url)}return Object.defineProperty(t.prototype,"request_id",{set:function(t){this._request_id=t,this._request_id?this.stopwatch.addAnnotation(c.REQUEST_ID.id,this._request_id):this.stopwatch.removeAnnotation(c.REQUEST_ID.id)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"correlation_id",{set:function(t){this._correlation_id=t,this._correlation_id?this.stopwatch.addAnnotation(c.CORRELATION_ID.id,this._correlation_id):this.stopwatch.removeAnnotation(c.CORRELATION_ID.id)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"url",{set:function(t){this._url=t,this._url?this.stopwatch.addAnnotation(c.URL.id,this._url):this.stopwatch.removeAnnotation(c.URL.id)},enumerable:!0,configurable:!0}),t.prototype.startSpan=function(t,e){void 0===e&&(e={});var n={startTime:e.startTime,async:e.async};return this.stopwatch.start(t,n)},t.prototype.endSpan=function(t,e){return void 0===e&&(e={}),this.stopwatch.end(t,{spanId:e.spanId,endTime:e.endTime})},t.prototype.addSpanAnnotation=function(t,e,n,i){this.stopwatch.addSpanAnnotation(t,e,n,i)},t.prototype.recordTrace=function(t,e,n){var i={};if(n)for(var r in n)n.hasOwnProperty(r)&&(i[r]=n[r]);var o={traceTime:e,annotations:i};this.stopwatch.recordTrace(t,o)},t.prototype.logData=function(){this.sentInitialData?this.reportMisuse("ClientStopwatch tried to log stored results, but the stopwatch is set to log immediately"):(this.stopwatch.attach(),this.sentInitialData=!0,setTimeout((function(){e.JSStopwatch.flush_current_data()}),0))},t.prototype.addAnnotation=function(t,e){this.stopwatch.addAnnotation(t,e)},t.prototype.removeAnnotation=function(t){this.stopwatch.removeAnnotation(t)},t.prototype.reportMisuse=function(t){t="ClientStopwatch: "+t,this.strictAssert?s.assert(!1,t):s.reportStack(t,{severity:s.SEVERITY.NONCRITICAL,tags:["log_js_stopwatch"]})},t})()})),define("modules/clean/metrics/coin",["require","exports","apex-metrics"],(function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=(function(){function t(t,e,n,i){this.bias=t,this.clock=e,this.flipCondition=n,this.randomEngine=i}return t.prototype.observe=function(){return this.lastFlip&&!this.flipCondition(this.lastFlip)||(this.result=this.randomEngine()o}),t)}function a(t,e,n){return n.stickiness&&n.stickiness.limit&&"independent"===n.stickiness.limit[".tag"]?new i(n.fraction||0,e,(function(){return!0}),t):null}function s(t,e,n){return n.stickiness&&n.stickiness.limit&&"permanent"===n.stickiness.limit[".tag"]?new i(n.fraction||0,e,(function(){return!1}),t):null}e.StickyBiasedCoin=i,e.makeCoin=function(t,e,n){for(var i=0,c=[a,o,r,s];i0&&(n[i]=r)}return n}Object.defineProperty(e,"__esModule",{value:!0});var r=(function(){function t(t,e){this.maxScopes=t,this.coinMap=e}return t.prototype.extend=function(e,i){return new t(e||this.maxScopes,n.__assign({},this.coinMap,i))},t.prototype.partitionSpanGroups=function(t){var e=this,n=[],r=[];return t.forEach((function(t,o,a){var s=t[0].namespace,c=e.coinMap[s]||{},u=c.dropPeriodCoin,l=void 0===u?null:u,p=c.dropSamplesCoin,_=void 0===p?null:p;l&&l.observe()||(_&&(t=t.map((function(t){return{namespace:t.namespace,tags:t.tags,samples:i(t.samples,(function(){return!_.observe()}))}})).filter((function(t){return Object.keys(t.samples).length>0}))),0!==t.length&&(0===e.maxScopes||n.length0?[4,this.client.ns("client_metrics").rpc("record",{scopes:i.map((function(e){return a.formatSpanGroupAsScope(t,e)})).filter((function(t){return!!t})),known_namespaces:[],environment:"prod",artifact_version:s.REPO_REV,client_metadata:c,trigger:{".tag":"trigger_publish"}},{})]:[3,2]);case 1:o=n.sent(),this.updateConfiguration(o),n.label=2;case 2:return[2]}var u,l,p}))}))},t.prototype.recordMetrics=function(t){0!==t.length&&(this.queuedSpans=this.queuedSpans.concat(t),this.publishTimer||this.publishQueuedSpans())},t})();e.Apiv2MetricsSink=u})),define("modules/clean/perf_tools/browser_perf_utils",["require","exports","tslib","modules/core/browser","modules/core/xhr","modules/constants/request","modules/clean/js_client_stopwatch","modules/constants/webtiming"],(function(t,e,n,i,r,o,a,s){"use strict";function c(t){var e=i.performance();if(e&&e.timing){var n=e.timing,c={navigation_start:n.navigationStart,unload_event_start:n.unloadEventStart,unload_event_end:n.unloadEventEnd,redirect_start:n.redirectStart,redirect_end:n.redirectEnd,fetch_start:n.fetchStart,domain_lookup_start:n.domainLookupStart,domain_lookup_end:n.domainLookupEnd,connect_start:n.connectStart,secure_connect_start:n.secureConnectionStart,connect_end:n.connectEnd,request_start:n.requestStart,response_start:n.responseStart,response_end:n.responseEnd,dom_loading:n.domLoading,dom_interactive:n.domInteractive,dom_content_loaded_event_start:n.domContentLoadedEventStart,dom_content_loded_event_end:n.domContentLoadedEventEnd,dom_complete:n.domComplete,load_event_start:n.loadEventStart,load_event_end:n.loadEventEnd},u={};u.request_id=o.REQUEST_ID,u.referrer=document.referrer;var l=a.JSStopwatch.createDetachedStopwatch("browser_perf",t);for(var p in c)c.hasOwnProperty(p)&&(u[p]=c[p],c[p]&&l.recordTrace(p,c[p]-n.navigationStart));l.logData(),s.LOG_BROWSER_PERFORMANCE_INFO&&r.sendXhr("/alternate_wtl_browser_performance_info",u)}}Object.defineProperty(e,"__esModule",{value:!0}),i=n.__importStar(i),r=n.__importStar(r),o=n.__importStar(o),s=n.__importStar(s),e.logBrowserPerfData=function(t){(function(t){var e=i.performance();if(!e||!e.getEntriesByType)return;var n=a.JSStopwatch.createDetachedStopwatch("performance_marks",t),r=e.getEntriesByType("mark");if(r instanceof Array)for(var o=0,s=r;o0&&(_=_+"-"+d);var m=n.startSpan(_,{startTime:p.startTime,async:!0}),h=c(p);n.addSpanAnnotation(_,"type",h,m),0===p.transferSize?n.addSpanAnnotation(_,"cached","true",m):void 0===p.transferSize?n.addSpanAnnotation(_,"cached","unknown",m):n.addSpanAnnotation(_,"cached","false",m),p.responseEnd0){var r=e.substring(i);if([".png",".gif",".jpg",".svg"].indexOf(r)>-1)return"img";if(".js"===r)return"script";if(".css"===r)return"css"}return-1===["css","img","script","link"].indexOf(n)?"xmlhttprequest"===n?"ajax":"other":n}e.logResourceTiming=function(t){var e=i.performance();if(e&&e.getEntriesByType){var n=e.getEntriesByType("resource").filter((function(e){return-1!==e.name.indexOf(t)}))[0];if(n&&n.responseEnd){var o="resource_response_end_"+t;return r.JSStopwatch.create_stopwatch_if_not_exist("resource_timing"),r.JSStopwatch.recordTrace(o,{stopwatchName:"resource_timing",traceTime:n.responseEnd}),n}}},e.getResourceSummary=function(t){void 0===t&&(t=void 0);var e={pre:{},total:{}},n=i.performance();if(!n)return e;var o=n.getEntriesByType("resource");if(r.JSStopwatch.create_stopwatch_if_not_exist("resource_timeline"),o instanceof Array)for(var a=function(n){var i=c(n),r=[];if(t&&n.responseEnd<=t){var o=e.pre;i in o||(o[i]={count:0,total_time:0,last_transfer_end:0}),r.push(o[i])}i in e.total||(e.total[i]={count:0,total_time:0,last_transfer_end:0}),r.push(e.total[i]),r.forEach((function(t){var e;t.count++,t.total_time+=n.duration,t.last_transfer_end=Math.max(t.last_transfer_end,n.responseEnd),"css"!==(e=i)&&"script"!==e&&"img"!==e||void 0===n.transferSize||void 0===n.encodedBodySize||(t.total_size=t.total_size||0,t.transfer_size=t.transfer_size||0,0!==n.transferSize&&(t.transfer_size+=n.encodedBodySize),t.total_size=t.total_size||0,t.total_size+=n.encodedBodySize)}))},s=0,u=o;s0){var _=s/c;n.recordTrace(r+"_"+a+"_transferred_size",s),n.recordTrace(r+"_"+a+"_total_size",c),n.recordTrace(r+"_percent_"+a+"_transferred",100*_)}n.recordTrace(r+"_last_"+a+"_transfer_end",o[a].last_transfer_end)}}n.logData()})(c,s),d.JSStopwatch.addSpanAnnotation("process_nav_timing","logged_resources","1",{stopwatchName:"web_timing_logger"})}H(a),d.JSStopwatch.addSpanAnnotation("process_nav_timing","logged_modules","1",{stopwatchName:"web_timing_logger"}),d.JSStopwatch.endSpan("process_nav_timing",{stopwatchName:"web_timing_logger"}),t.is_pagelet&&(function(t,e){if(!window.ensemble||!window.ensemble.getJSStopwatchData)return;var n=window.ensemble.getJSStopwatchData(),i=(function(t,e){var n=f.listAnnotatedExecutionPerfMeasurementsForEnsemble(e),i=d.JSStopwatch.createDetachedStopwatch("ensemble",t),r=n.map((function(t){var e=t.measurement,n=t.annotations;return{name:e.name,startTime:e.startTime,endTime:e.startTime+e.totalTime,annotations:n}}));return V(i,r),i})(e,n),r=void 0,o=void 0;for(var a in n)n.hasOwnProperty(a)&&(G.includes(a)&&(t.timesStagesWereReached[a]=n[a].start),["ensemble_init","dws_embedded-app_require_config_callback"].includes(a)&&(r=r?Math.min(r,n[a].end):n[a].end),K.test(a)&&(o=o?Math.max(o,n[a].end):n[a].end));o&&i.recordTrace("last_js_const_end",o);r&&i.recordTrace("module_init",r)})(t,s),m.logBrowserPerfData(s),(function(t,e,n){f.logCumulativeExecutionTimes(t,f.cumulativeExecutionTimesBefore(e,n))})(s,t.timesStagesWereReached,o),(this.get_navigation_type()===p.NavigationType.NAVIGATE||g.LOG_NON_NAVIGATION_RESOURCES)&&((function(t){var e=h.getReactInitData();V(d.JSStopwatch.createDetachedStopwatch("init_react",t),e)})(s),l.logResourcesData(s)),d.JSStopwatch.log_stored_results();var u=(function(t,e,n){var r=[["browser",T.get_browser_info().browser],["is_dws",String(t.is_dws)],["is_dws2",String(t.is_dws2)],["is_early_ensemble",String(t.is_early_ensemble)],["source_type",String(t.source_type)],["is_page_restore",String(t.is_page_restore)],["log_source",n&&n.name?n.name:""],["is_http2",String(v.IS_HTTP2)]];return e.navigation_type&&r.push(["navigation_type",e.navigation_type]),r.map((function(t){var e=t[0],n=t[1];return i.createTag(i.createTagName(e),i.createTagValue(n))}))})(t,a,e),_=this.metricsFactory.createScopedMetrics(i.createNamespace("web_perf"));return _.addTags(u),(function(t,e){t.resource_script_count&&e.recordSample(i.createMetricName("temp/resource-script-count"),t.resource_script_count),t.time_to_interactive&&e.recordTime(i.createMetricName("temp/time-to-interactive"),t.time_to_interactive,i.TimeUnit.MILLISECONDS)})(a,_),(function(t,e,n){var r=f.cumulativeExecutionTimesBefore(e,t),o=function(t){r.hasOwnProperty(t)&&f.ALL_JS_EXECUTION_TYPES.forEach((function(e){n.recordTime(i.createMetricName("temp/cumulative-cpu-time/before-stage-"+t+"/due-to-"+e),r[t][e]||0,i.TimeUnit.MILLISECONDS)}))};for(var a in r)o(a)})(o,t.timesStagesWereReached,_),n&&n.getEntriesByType&&((function(t,e){t.getEntriesByType("mark").filter((function(t){return D.indexOf(t.name)>-1})).forEach((function(t){e.recordTime(i.createMetricName("temp/browser-perf/marks/"+t.name),t.startTime,i.TimeUnit.MILLISECONDS)}))})(n,_),(function(t,e){var n=t.getEntriesByType("navigation")[0],r=void 0===n?null:n;r&&([["temp/browser-perf/navigation/unload-event-start",r.unloadEventStart],["temp/browser-perf/navigation/unload-event-end",r.unloadEventEnd],["temp/browser-perf/navigation/dom-interactive",r.domInteractive],["temp/browser-perf/navigation/dom-content-loaded-event-start",r.domContentLoadedEventStart],["temp/browser-perf/navigation/dom-content-loaded-event-end",r.domContentLoadedEventEnd],["temp/browser-perf/navigation/dom-complete",r.domComplete],["temp/browser-perf/navigation/load-event-start",r.loadEventStart],["temp/browser-perf/navigation/load-event-end",r.loadEventEnd],["temp/browser-perf/navigation/redirect-count",r.redirectCount],["temp/browser-perf/navigation/worker-start",r.workerStart],["temp/browser-perf/navigation/redirect-start",r.redirectStart],["temp/browser-perf/navigation/redirect-end",r.redirectEnd],["temp/browser-perf/navigation/fetch-start",r.fetchStart],["temp/browser-perf/navigation/domain-lookup-start",r.domainLookupStart],["temp/browser-perf/navigation/domain-lookup-end",r.domainLookupEnd],["temp/browser-perf/navigation/connect-start",r.connectStart],["temp/browser-perf/navigation/connect-end",r.connectEnd],["temp/browser-perf/navigation/secure-connect-start",r.secureConnectionStart],["temp/browser-perf/navigation/request-start",r.requestStart],["temp/browser-perf/navigation/response-start",r.responseStart],["temp/browser-perf/navigation/response-end",r.responseEnd],["temp/browser-perf/navigation/transfer-size",r.transferSize]].forEach((function(t){var n=t[0],r=t[1];"number"==typeof r&&e.recordTime(i.createMetricName(n),r,i.TimeUnit.MILLISECONDS)})),[["temp/browser-perf/navigation/encoded-body-size",r.encodedBodySize],["temp/browser-perf/navigation/decoded-body-size",r.decodedBodySize]].forEach((function(t){var n=t[0],r=t[1];"number"==typeof r&&e.recordSample(i.createMetricName(n),r)})))})(n,_)),_.close(),t.have_logged_web_timing=!0,this.log(t,a,!0),s},e.prototype.log=function(e,n,i){void 0===i&&(i=!1),t.prototype.log.call(this,e,n,i)},e})(C),P=(function(){function t(t,e,n,i){this.childSpans=[],this.spanName=t,this.startTime=void 0!==n?n:_.WebTimingUtil.getNow(),this.originTs=e,this.startTimeOffsetMS=this.startTime-e,this.endCallback=i}return t.prototype.startSpan=function(e){var n=new t(e,this.originTs);return this.childSpans.push(n),n},t.prototype.markSpan=function(e,n){var i=new t(e,this.originTs,this.startTime);this.childSpans.push(i),i.endSpan(n)},t.prototype.endSpan=function(t){var e=this;this.endTime=void 0!==t?t:_.WebTimingUtil.getNow(),this.childSpans.forEach((function(t){t.hasEnded()||t.endSpan(e.endTime)})),this.endCallback&&this.endCallback(this)},t.prototype.getEndTimeOffsetMS=function(){return void 0!==this.endTime?this.endTime-this.originTs:void 0},t.prototype.hasEnded=function(){return void 0!==this.endTime},t})(),L=(function(){function t(t,e,n,i){void 0===i&&(i=!1),this.timerState=x.RUNNING,this.loggedEvents=0,this.activeSpans=[],this.endedSpans=[],this.context=t,this.timingStopwatch=e,this.userStopwatch=n,this.id=k++,this.strictAssert=i}return t.prototype.startSpan=function(t){var e=this,n=new P(t,this.context.start_time,void 0,(function(t){e.endSpan(t)}));return this.activeSpans.push(n),n},t.prototype.markSpan=function(t,e){if(void 0===e&&(e={}),this.userStopwatch){var n=void 0===e.startTime?0:e.startTime,i=this.timeSinceStart(e.endTime),r=this.userStopwatch.startSpan(t,{startTime:n});this.userStopwatch.endSpan(t,{spanId:r,endTime:i})}else{var o=new P(t,this.context.start_time,e.startTime);o.endSpan(e.endTime),this.endedSpans.push(o)}},t.prototype.endSpan=function(t){var e=this.activeSpans.indexOf(t);e>=0&&(delete this.activeSpans[e],this.userStopwatch?this.recordSpan(t):this.endedSpans.push(t))},t.prototype.recordSpan=function(t){var e=this,n=this.userStopwatch.startSpan(t.spanName,{startTime:t.startTimeOffsetMS});t.childSpans.forEach((function(t){e.recordSpan(t)})),this.userStopwatch.endSpan(t.spanName,{spanId:n,endTime:t.getEndTimeOffsetMS()})},t.prototype.getContextName=function(){return this.context.context_name},t.prototype.applicationStart=function(){this.logEvent(p.WebTimerEvent.APPLICATION_START)},t.prototype.fetchedDataRequiredForTTI=function(){this.logEvent(p.WebTimerEvent.FETCHED_DATA_FOR_TTI)},t.prototype.startTime=function(){return this.context.start_time},t.prototype.timeSinceStart=function(t){return(t||_.WebTimingUtil.getNow())-this.context.start_time},t.prototype.timeToView=function(){return this.context.time_to_view},t.prototype.timeToInteractive=function(){return this.context.time_to_interactive},t.prototype.reportTTIAfterPaint=function(){var t=this,e=new _.CancellableCallback((function(){t.reportTTI()}));return window.requestAnimationFrame((function(){window.requestAnimationFrame((function(){e.exec()}))})),e},t.prototype.setExtraColumns=function(t){this.context.extra_columns=t},t.prototype.excludeFromTTI=function(t){""!==this.context.tti_exclusion_flow&&(this.context.tti_exclusion_flow=this.context.tti_exclusion_flow+","),this.context.tti_exclusion_flow=this.context.tti_exclusion_flow+t},t.prototype.logEvent=function(t,e){this.logEventInternal(t,!0,e)},t.prototype.logSilentEvent=function(t,e){this.logEventInternal(t,!1,e)},t.prototype.logEventInternal=function(t,e,n){this.loggedEvents|=t.flag,t.ordered&&this.validateEventOrder(t);var i=this.timeSinceStart(n);this.context.timesStagesWereReached[t.name]=i,this.timingStopwatch.recordTrace(t.name,i),console.timeStamp&&console.timeStamp(t.timestampPrefix),e&&t.triggersLogging&&this.logIfReady(t)},t.prototype.validateEventOrder=function(t){for(var e=0,n=0,i=A;n0){var c=p.WebTimerEvent.allEvents.filter((function(t){return(t.flag&s)>0})).map((function(t){return t.name}));this.reportSwMisuse("Received "+t.name+" after ["+c.join(",")+"]")}},t.prototype.logIfReady=function(t){if(this.logger.shouldLog(this.context)){this.addEventBasedTiming();var e=this.logger.logTiming(this.context,t);J(this.timingStopwatch,e),J(this.userStopwatch,e),this.timingStopwatch.logData(),this.userStopwatch.logData(),this.timerState=x.CLOSED}},t.prototype.addEventBasedTiming=function(){var t=S.performance().timing;this.context.ttv_at_dom_interactive&&(this.context.is_pagelet&&window.ensemble?this.context.time_to_view=window.ensemble.getEmbeddedAppDOMInteractive():this.context.time_to_view=t.domInteractive,this.logSilentEvent(p.WebTimerEvent.MARK_TIME_TO_VIEW,this.context.time_to_view)),this.context.tti_at_dom_interactive&&(this.context.time_to_interactive=t.domInteractive,this.logSilentEvent(p.WebTimerEvent.MARK_TIME_TO_INTERACTIVE,this.context.time_to_interactive),this.logSilentEvent(p.WebTimerEvent.TIME_TO_INTERACTIVE,this.context.time_to_interactive))},t.prototype.reportSwMisuse=function(t){t="WebTimer: "+t,this.strictAssert?y.assert(!1,t):y.reportStack(t,{severity:y.SEVERITY.NONCRITICAL,tags:["web_timing_logger"]})},t})(),W=(function(t){function e(e){var n=t.call(this,e,d.JSStopwatch.createDetachedStopwatch("maestro_tracing",{correlation_id:e.correlation_id}),d.JSStopwatch.createDetachedStopwatch("user_tracing",{correlation_id:e.correlation_id}),!1)||this;return n.logger=new M,n}return n.__extends(e,t),e.prototype.initialize=function(t){this.context.initialized||(this.context.initialized=!0,this.context.log_time_to_view=t.requireTTV,this.context.log_time_to_interactive=t.requireTTI,this.context.tti_flow=t.url,this.timingStopwatch.url=this.context.tti_flow,this.userStopwatch.url=this.context.tti_flow)},e.prototype.start=function(){this.isUsable()&&this.timerState===x.NEW&&(this.context.start_time=_.WebTimingUtil.getNow(),this.timerState=x.RUNNING)},e.prototype.restart=function(){this.TTICallback&&(this.TTICallback.cancel(),this.TTICallback=void 0),this.loggedEvents=0,this.context.have_logged_web_timing=!1,this.context.correlation_id=_.WebTimingUtil.generateCorrelationId(),this.context.start_time=_.WebTimingUtil.getNow(),this.context.end_time=void 0,this.context.time_to_view=null,this.context.time_to_interactive=null,this.timerState=x.RUNNING,d.JSStopwatch.deleteStopwatch(this.timingStopwatch),this.timingStopwatch=d.JSStopwatch.createDetachedStopwatch("maestro_tracing",{request_id:this.context.request_id,url:this.context.tti_flow,correlation_id:this.context.correlation_id}),d.JSStopwatch.deleteStopwatch(this.userStopwatch),this.userStopwatch=d.JSStopwatch.createDetachedStopwatch("user_tracing",{request_id:this.context.request_id,url:this.context.tti_flow,correlation_id:this.context.correlation_id})},e.prototype.abort=function(){this.timerState!==x.CLOSED&&(this.timerState=x.ABORTED)},e.prototype.markTimeToView=function(){this.isUsable()&&(null==this.context.time_to_view&&(this.context.time_to_view=_.WebTimingUtil.getNow()),this.logEvent(p.WebTimerEvent.MARK_TIME_TO_VIEW))},e.prototype.markTimeToInteractive=function(){this.isUsable()&&(this.logEvent(p.WebTimerEvent.MARK_TIME_TO_INTERACTIVE),N()?this.reportTTI():this.TTICallback=this.reportTTIAfterPaint())},e.prototype.reportTTI=function(){null==this.context.time_to_interactive&&(this.context.time_to_interactive=_.WebTimingUtil.getNow(),this.logEvent(p.WebTimerEvent.TIME_TO_INTERACTIVE),Y(this.id))},e.prototype.end=function(t){this.isUsable()&&(void 0===this.context.end_time&&(this.context.end_time=_.WebTimingUtil.getNow()),this.context.request_id=t,this.timingStopwatch.request_id=t,this.userStopwatch.request_id=t,this.logEvent(p.WebTimerEvent.LOAD_END))},e.prototype.waitForTTI=function(t){var e=this;return new Promise((function(n,i){if(null==e.context.time_to_interactive){var r,o=function(t){window.removeEventListener("TTI."+e.id,o),clearTimeout(r),n()};window.addEventListener("TTI."+e.id,o),t&&void 0!==t.timeoutMS&&(r=setTimeout(o,t.timeoutMS))}else n()}))},e.prototype.isUsable=function(){return this.timerState===x.NEW||this.timerState===x.RUNNING},e})(L),q=(function(t){function e(e){var n=t.call(this,e,d.JSStopwatch.createDetachedStopwatch("maestro_tracing",{correlation_id:e.correlation_id}),d.JSStopwatch.createDetachedStopwatch("user_tracing",{correlation_id:e.correlation_id}),!1)||this;return n.logger=new R,n}return n.__extends(e,t),e.prototype.initialize=function(t){var e=this;if(!this.context.initialized){if(!S.performance())return;this.context.log_time_to_view=t.requireTTV,this.context.log_time_to_interactive=t.requireTTI,this.context.is_pagelet=!!t.is_pagelet,this.context.is_dws=!!t.is_dws,this.context.is_dws2=!!t.is_dws2,this.context.is_early_ensemble=!!t.is_early_ensemble,this.context.is_page_restore=!1,this.context.ttv_at_dom_interactive=!!t.ttv_at_dom_interactive,this.context.tti_at_dom_interactive=!!t.tti_at_dom_interactive,this.context.source_type=null!=t.source_type?t.source_type:"web",this.context.subtypes=null!=t.subtypes?t.subtypes:{},this.context.tti_exclusion_flow=null!=t.tti_exclusion_flow?t.tti_exclusion_flow:"",this.context.have_logged_web_timing=!1,this.context.delayed_tti_for_css=!1,this.context.initialized=!0,t.url&&(this.context.tti_flow=t.url,this.timingStopwatch.url=t.url,this.userStopwatch.url=t.url),this.context.subtypes.tti_flow&&(this.context.tti_flow=this.context.subtypes.tti_flow);var n=0;g.LOG_TIMING_DELAY&&(n=600),d.JSStopwatch.create_stopwatch_if_not_exist("web_timing_logger"),a.window_load((function(){setTimeout((function(){return e.end()}),n)})),u.onPageRestore((function(t){e.context.is_page_restore=!0;var n=d.JSStopwatch.createDetachedStopwatch("browser_perf",{correlation_id:e.context.correlation_id});n.recordTrace("page_restore"),n.logData()})),!this.context.ttv_at_dom_interactive&&window._timingData&&(null!=window._timingData.ttv&&(this.context.time_to_view=window._timingData.ttv.getTime(),this.logEvent(p.WebTimerEvent.MARK_TIME_TO_VIEW,this.context.time_to_view)),null!=window._timingData.tti&&(this.context.time_to_interactive=window._timingData.tti.getTime(),this.logEvent(p.WebTimerEvent.TIME_TO_INTERACTIVE,this.context.time_to_interactive),Y()))}},e.prototype.start=function(){this.isUsable()&&this.timerState===x.NEW&&(this.timerState=x.RUNNING)},e.prototype.restart=function(){this.TTICallback&&(this.TTICallback.cancel(),this.TTICallback=void 0),this.loggedEvents=0,this.context.correlation_id=_.WebTimingUtil.generateCorrelationId(),this.context.end_time=void 0,this.context.time_to_view=null,this.context.time_to_interactive=null,this.timerState=x.RUNNING,this.timingStopwatch=d.JSStopwatch.createDetachedStopwatch("maestro_tracing",{correlation_id:this.context.correlation_id}),this.userStopwatch=d.JSStopwatch.createDetachedStopwatch("user_tracing",{correlation_id:this.context.correlation_id})},e.prototype.abort=function(){this.timerState!==x.CLOSED&&(this.timerState=x.ABORTED)},e.prototype.markTimeToView=function(){this.isUsable()&&(null!=this.context.time_to_view||this.context.ttv_at_dom_interactive||(window._timingData&&null!=window._timingData.ttv?this.context.time_to_view=window._timingData.ttv.getTime():this.context.time_to_view=_.WebTimingUtil.getNow(),this.logEvent(p.WebTimerEvent.MARK_TIME_TO_VIEW,this.context.time_to_view)))},e.prototype.markTimeToInteractive=function(){var t=this;if(window.ensemble&&window.ensemble.waitingForCss)return this.context.delayed_tti_for_css=!0,void(window.ensemble.mark_tti_callback=function(){t.markTimeToInteractive()});null!=this.context.time_to_interactive||this.context.tti_at_dom_interactive||(this.logEvent(p.WebTimerEvent.MARK_TIME_TO_INTERACTIVE),N()?this.reportTTI():this.TTICallback=this.reportTTIAfterPaint())},e.prototype.reportTTI=function(){null==this.context.time_to_interactive&&(window._timingData&&null!=window._timingData.tti?this.context.time_to_interactive=window._timingData.tti.getTime():this.context.time_to_interactive=_.WebTimingUtil.getNow(),console.timeStamp&&console.timeStamp("TTI"),window.ensemble&&window.ensemble.snapshotTimingProfile&&(this.context.timing_results=window.ensemble.snapshotTimingProfile()||null),this.logEvent(p.WebTimerEvent.TIME_TO_INTERACTIVE,this.context.time_to_interactive),Y())},e.prototype.end=function(t){this.isUsable()&&void 0===this.context.end_time&&(this.context.end_time=_.WebTimingUtil.getNow(),this.logEvent(p.WebTimerEvent.LOAD_END),this.context.tti_at_dom_interactive&&Y())},e.prototype.waitForTTI=function(t){var e=this;return new Promise((function(n,i){if(window.ensemble){if(window.ensemble.ttiMarked)return void n()}else if(null!=e.context.time_to_interactive)return void n();var r,o=function(t){window.removeEventListener("TTI",o),clearTimeout(r),n()};window.addEventListener("TTI",o),t&&void 0!==t.timeoutMS&&(r=setTimeout(o,t.timeoutMS))}))},e.prototype.isUsable=function(){return this.timerState===x.NEW||this.timerState===x.RUNNING},e})(L),U={},j=new q(_.WebTimingUtil.newContext(!1,"default_timer"));function B(t,e){for(var n={},i=0,r=I;i>>3){case 1:r.isDws=t.bool();break;case 2:r.dwsOpts=c.web_timing_logger.WebTimingLoggerServerContext.DWSOptions.decode(t,t.uint32());break;case 3:r.sourceType=t.int32();break;case 4:t.skip().pos++,r.subtypes===s.emptyObject&&(r.subtypes={}),n=t.string(),t.pos++,r.subtypes[n]=t.string();break;case 5:r.url=t.string();break;default:t.skipType(7&a)}}return r},t.DWSOptions=(function(t){function t(t){if(t)for(var e=Object.keys(t),n=0;n>>3){case 1:i.isDws2=t.bool();break;case 2:i.isEarlyEnsemble=t.bool();break;case 3:i.jsPreloading=t.bool();break;default:t.skipType(7&r)}}return i},t})(t.DWSOptions||{}),t.SourceType=(e={},(n=Object.create(e))[e[0]="UNKNOWN"]=0,n[e[1]="DESKTOP_WEB"]=1,n[e[2]="MOBILE_WEB"]=2,n),t})(r.WebTimingLoggerServerContext||{}),r)})),define("proto/google/protobuf/any",["require","exports","tslib","protobufjs/minimal"],(function(t,e,n,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o,a=(i=n.__importStar(i)).Reader,s=i.Writer,c=i.util,u=i.roots.default||(i.roots.default={});e.default=u,e.google=u.google=((r=u.google||{}).protobuf=((o=r.protobuf||{}).Any=(function(t){function t(t){if(t)for(var e=Object.keys(t),n=0;n>>3){case 1:i.typeUrl=t.string();break;case 2:i.value=t.bytes();break;default:t.skipType(7&r)}}return i},t})(o.Any||{}),o),r)})),define("proto/utils/unpack",["require","exports","proto/google/protobuf/any"],(function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=function(t,e){for(var i=atob(t),r=i.length,o=new Uint8Array(r),a=0;a