/* Office JavaScript API library - Custom Functions */

/*
	Copyright (c) Microsoft Corporation.  All rights reserved.
*/

/*
	This file incorporates the "whatwg-fetch" implementation, version 2.0.3, licensed under MIT with the following licensing notice:
	(See github.com/github/fetch/blob/master/LICENSE)

		Copyright (c) 2014-2016 GitHub, Inc.

		Permission is hereby granted, free of charge, to any person obtaining
		a copy of this software and associated documentation files (the
		"Software"), to deal in the Software without restriction, including
		without limitation the rights to use, copy, modify, merge, publish,
		distribute, sublicense, and/or sell copies of the Software, and to
		permit persons to whom the Software is furnished to do so, subject to
		the following conditions:

		The above copyright notice and this permission notice shall be
		included in all copies or substantial portions of the Software.

		THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
		EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
		MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
		NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
		LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
		OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
		WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/

/*
    Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419.

    This file also contains the following Promise implementation (with a few small modifications):
        * @overview es6-promise - a tiny implementation of Promises/A+.
        * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
        * @license   Licensed under MIT license
        *            See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
        * @version   2.3.0
*/
var OSF=OSF||{};OSF.ConstantNames={FileVersion:"0.0.0.0",OfficeJS:"custom-functions-runtime.js",OfficeDebugJS:"custom-functions-runtime.debug.js",HostFileScriptSuffix:"core",IsCustomFunctionsRuntime:true};var OSF=OSF||{};OSF.HostSpecificFileVersionDefault="16.00";OSF.HostSpecificFileVersionMap={access:{web:"16.00"},agavito:{winrt:"16.00"},excel:{ios:"16.00",mac:"16.00",web:"16.00",win32:"16.01",winrt:"16.00"},onenote:{android:"16.00",web:"16.00",win32:"16.00",winrt:"16.00"},outlook:{ios:"16.00",mac:"16.00",web:"16.01",win32:"16.02"},powerpoint:{ios:"16.00",mac:"16.00",web:"16.00",win32:"16.01",winrt:"16.00"},project:{win32:"16.00"},sway:{web:"16.00"},word:{ios:"16.00",mac:"16.00",web:"16.00",win32:"16.01",winrt:"16.00"},visio:{web:"16.00",win32:"16.00"}};OSF.SupportedLocales={"ar-sa":true,"bg-bg":true,"bn-in":true,"ca-es":true,"cs-cz":true,"da-dk":true,"de-de":true,"el-gr":true,"en-us":true,"es-es":true,"et-ee":true,"eu-es":true,"fa-ir":true,"fi-fi":true,"fr-fr":true,"gl-es":true,"he-il":true,"hi-in":true,"hr-hr":true,"hu-hu":true,"id-id":true,"it-it":true,"ja-jp":true,"kk-kz":true,"ko-kr":true,"lo-la":true,"lt-lt":true,"lv-lv":true,"ms-my":true,"nb-no":true,"nl-nl":true,"nn-no":true,"pl-pl":true,"pt-br":true,"pt-pt":true,"ro-ro":true,"ru-ru":true,"sk-sk":true,"sl-si":true,"sr-cyrl-cs":true,"sr-cyrl-rs":true,"sr-latn-cs":true,"sr-latn-rs":true,"sv-se":true,"th-th":true,"tr-tr":true,"uk-ua":true,"ur-pk":true,"vi-vn":true,"zh-cn":true,"zh-tw":true};OSF.AssociatedLocales={ar:"ar-sa",bg:"bg-bg",bn:"bn-in",ca:"ca-es",cs:"cs-cz",da:"da-dk",de:"de-de",el:"el-gr",en:"en-us",es:"es-es",et:"et-ee",eu:"eu-es",fa:"fa-ir",fi:"fi-fi",fr:"fr-fr",gl:"gl-es",he:"he-il",hi:"hi-in",hr:"hr-hr",hu:"hu-hu",id:"id-id",it:"it-it",ja:"ja-jp",kk:"kk-kz",ko:"ko-kr",lo:"lo-la",lt:"lt-lt",lv:"lv-lv",ms:"ms-my",nb:"nb-no",nl:"nl-nl",nn:"nn-no",pl:"pl-pl",pt:"pt-br",ro:"ro-ro",ru:"ru-ru",sk:"sk-sk",sl:"sl-si",sr:"sr-cyrl-cs",sv:"sv-se",th:"th-th",tr:"tr-tr",uk:"uk-ua",ur:"ur-pk",vi:"vi-vn",zh:"zh-cn"};OSF.getSupportedLocale=function(a,c){if(c===void 0)c="en-us";if(!a)return c;var b;a=a.toLowerCase();if(a in OSF.SupportedLocales)b=a;else{var d=a.split("-",1);if(d&&d.length>0)b=OSF.AssociatedLocales[d[0]]}if(!b)b=c;return b};var ScriptLoading;(function(e){var a=false,b=function(){function b(g,e,d,f,c){var b=this;b.url=g;b.isReady=e;b.hasStarted=d;b.timer=f;b.hasError=a;b.pendingCallbacks=[];b.pendingCallbacks.push(c)}return b}(),d=function(){function a(c,b,a){this.scriptId=c;this.startTime=b;this.msResponseTime=a}return a}(),c=function(){var c=true,e=null;function f(b){var a=this;if(b===void 0)b={OfficeJS:"office.js",OfficeDebugJS:"office.debug.js"};a.constantNames=b;a.defaultScriptLoadingTimeout=1e4;a.loadedScriptByIds={};a.scriptTelemetryBuffer=[];a.osfControlAppCorrelationId="";a.basePath=e}f.prototype.isScriptLoading=function(a){return !!(this.loadedScriptByIds[a]&&this.loadedScriptByIds[a].hasStarted)};f.prototype.getOfficeJsBasePath=function(){var a=this;if(a.basePath)return a.basePath;else{for(var g=function(b,c){var d,a,e;e=b.toLowerCase();a=e.indexOf(c);if(a>=0&&a===b.length-c.length&&(a===0||b.charAt(a-1)==="/"||b.charAt(a-1)==="\\"))d=b.substring(0,a);else if(a>=0&&a<b.length-c.length&&b.charAt(a+c.length)==="?"&&(a===0||b.charAt(a-1)==="/"||b.charAt(a-1)==="\\"))d=b.substring(0,a);return d},d=document.getElementsByTagName("script"),h=d.length,e=[a.constantNames.OfficeJS,a.constantNames.OfficeDebugJS],f=e.length,c,b=0;!a.basePath&&b<h;b++)if(d[b].src)for(c=0;!a.basePath&&c<f;c++)a.basePath=g(d[b].src,e[c]);return a.basePath}};f.prototype.loadScript=function(e,d,c,a,b){this.loadScriptInternal(e,d,c,a,b)};f.prototype.loadScriptParallel=function(d,c,b){this.loadScriptInternal(d,c,e,a,b)};f.prototype.waitForFunction=function(g,e,h,i){var b=h,f,d=function(){b--;if(g()){e(c);return}else if(b>0){f=window.setTimeout(d,i);b--}else{window.clearTimeout(f);e(a)}};d()};f.prototype.waitForScripts=function(b,e){var f=this;if(this.invokeCallbackIfScriptsReady(b,e)==a)for(var c=0;c<b.length;c++){var g=b[c],d=this.loadedScriptByIds[g];d&&d.pendingCallbacks.push(function(){f.invokeCallbackIfScriptsReady(b,e)})}};f.prototype.logScriptLoading=function(c,a,b){a=Math.floor(a);if(OSF.AppTelemetry&&OSF.AppTelemetry.onScriptDone)if(OSF.AppTelemetry.onScriptDone.length==3)OSF.AppTelemetry.onScriptDone(c,a,b);else OSF.AppTelemetry.onScriptDone(c,a,b,this.osfControlAppCorrelationId);else{var e=new d(c,a,b);this.scriptTelemetryBuffer.push(e)}};f.prototype.setAppCorrelationId=function(a){this.osfControlAppCorrelationId=a};f.prototype.invokeCallbackIfScriptsReady=function(h,j){for(var g=a,f=0;f<h.length;f++){var i=h[f],d=this.loadedScriptByIds[i];if(!d){d=new b("",a,a,e,e);this.loadedScriptByIds[i]=d}if(d.isReady==a)return a;else if(d.hasError)g=c}j(!g);return c};f.prototype.getScriptEntryByUrl=function(c){for(var b in this.loadedScriptByIds){var a=this.loadedScriptByIds[b];if(this.loadedScriptByIds.hasOwnProperty(b)&&a.url===c)return a}return e};f.prototype.loadScriptInternal=function(h,g,i,n,k){var j=this;if(h){var q=j,r=window.document,d=g&&j.loadedScriptByIds[g]?j.loadedScriptByIds[g]:j.getScriptEntryByUrl(h);if(!d||d.hasError||d.url.toLowerCase()!=h.toLowerCase()){var f=r.createElement("script");f.type="text/javascript";if(g)f.id=g;if(!d){d=new b(h,a,a,e,e);j.loadedScriptByIds[g?g:h]=d}else{d.url=h;d.hasError=a;d.isReady=a}if(i)if(n)d.pendingCallbacks.unshift(i);else d.pendingCallbacks.push(i);var l=-1;if(window.performance&&window.performance.now)l=window.performance.now();var s=(new Date).getTime(),o=function(b){if(g){var a=(new Date).getTime()-s;if(!b)a=-a;q.logScriptLoading(g,l,a)}q.flushTelemetryBuffer()},m=function(){if(!OSF._OfficeAppFactory.getLoggingAllowed()&&typeof OSF.AppTelemetry!=="undefined")OSF.AppTelemetry.enableTelemetry=a;o(c);d.isReady=c;if(d.timer!=e){clearTimeout(d.timer);delete d.timer}for(var g=d.pendingCallbacks.length,f=0;f<g;f++){var b=d.pendingCallbacks.shift();if(b){var h=b(c);if(h===a)break}}},p=function(){o(a);d.hasError=c;d.isReady=c;if(d.timer!=e){clearTimeout(d.timer);delete d.timer}for(var g=d.pendingCallbacks.length,f=0;f<g;f++){var b=d.pendingCallbacks.shift();if(b){var h=b(a);if(h===a)break}}};if(f.readyState)f.onreadystatechange=function(){if(f.readyState=="loaded"||f.readyState=="complete"){f.onreadystatechange=e;m()}};else f.onload=m;f.onerror=p;k=k||j.defaultScriptLoadingTimeout;d.timer=setTimeout(p,k);d.hasStarted=c;f.setAttribute("crossOrigin","anonymous");f.src=h;r.getElementsByTagName("head")[0].appendChild(f)}else if(d.isReady)i(c);else if(n)d.pendingCallbacks.unshift(i);else d.pendingCallbacks.push(i)}};f.prototype.flushTelemetryBuffer=function(){var b=this;if(OSF.AppTelemetry&&OSF.AppTelemetry.onScriptDone){for(var c=0;c<b.scriptTelemetryBuffer.length;c++){var a=b.scriptTelemetryBuffer[c];if(OSF.AppTelemetry.onScriptDone.length==3)OSF.AppTelemetry.onScriptDone(a.scriptId,a.startTime,a.msResponseTime);else OSF.AppTelemetry.onScriptDone(a.scriptId,a.startTime,a.msResponseTime,b.osfControlAppCorrelationId)}b.scriptTelemetryBuffer=[]}};return f}();e.LoadScriptHelper=c})(ScriptLoading||(ScriptLoading={}));var OfficeExt;(function(a){var b;(function(a){var b=function(){function a(){var a=this;a.getDiagnostics=function(b){var a={host:this.getHost(),version:b||this.getDefaultVersion(),platform:this.getPlatform()};return a};a.platformRemappings={web:Microsoft.Office.WebExtension.PlatformType.OfficeOnline,winrt:Microsoft.Office.WebExtension.PlatformType.Universal,win32:Microsoft.Office.WebExtension.PlatformType.PC,mac:Microsoft.Office.WebExtension.PlatformType.Mac,ios:Microsoft.Office.WebExtension.PlatformType.iOS,android:Microsoft.Office.WebExtension.PlatformType.Android};a.camelCaseMappings={powerpoint:Microsoft.Office.WebExtension.HostType.PowerPoint,onenote:Microsoft.Office.WebExtension.HostType.OneNote};a.hostInfo=OSF._OfficeAppFactory.getHostInfo();a.getHost=a.getHost.bind(a);a.getPlatform=a.getPlatform.bind(a);a.getDiagnostics=a.getDiagnostics.bind(a)}a.prototype.capitalizeFirstLetter=function(a){if(a)return a[0].toUpperCase()+a.slice(1).toLowerCase();return a};a.getInstance=function(){if(a.hostObj===undefined)a.hostObj=new a;return a.hostObj};a.prototype.getPlatform=function(){var a=this;if(a.hostInfo.hostPlatform){var b=a.hostInfo.hostPlatform.toLowerCase();if(a.platformRemappings[b])return a.platformRemappings[b]}return null};a.prototype.getHost=function(){var a=this;if(a.hostInfo.hostType){var b=a.hostInfo.hostType.toLowerCase();if(a.camelCaseMappings[b])return a.camelCaseMappings[b];b=a.capitalizeFirstLetter(a.hostInfo.hostType);if(Microsoft.Office.WebExtension.HostType[b])return Microsoft.Office.WebExtension.HostType[b]}return null};a.prototype.getDefaultVersion=function(){if(this.getHost())return "16.0.0000.0000";return null};return a}();a.Host=b})(b=a.HostName||(a.HostName={}))})(OfficeExt||(OfficeExt={}));var Office;(function(d){var a=true,b="undefined",c="function",e;(function(d){var e;(function(d){function e(){return function(){var d=null,e="object";"use strict";function Q(a){return typeof a===c||typeof a===e&&a!==d}function y(a){return typeof a===c}function T(a){return typeof a===e&&a!==d}var z;if(!Array.isArray)z=function(a){return Object.prototype.toString.call(a)==="[object Array]"};else z=Array.isArray;var D=z,r=0,pb={}.toString,jb,w,l=function(a,b){q[r]=a;q[r+1]=b;r+=2;if(r===2)if(w)w(p);else u()};function cb(a){w=a}function lb(a){l=a}var X=typeof window!==b?window:undefined,C=X||{},G=C.MutationObserver||C.WebKitMutationObserver,mb=typeof process!==b&&{}.toString.call(process)==="[object process]",kb=typeof Uint8ClampedArray!==b&&typeof importScripts!==b&&typeof MessageChannel!==b;function eb(){var b=process.nextTick,a=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(a)&&a[1]==="0"&&a[2]==="10")b=setImmediate;return function(){b(p)}}function O(){var a=new MessageChannel;a.port1.onmessage=p;return function(){a.port2.postMessage(0)}}function Y(){return function(){setTimeout(p,1)}}var q=new Array(1e3);function p(){for(var a=0;a<r;a+=2){var b=q[a],c=q[a+1];b(c);q[a]=undefined;q[a+1]=undefined}r=0}var u;if(mb)u=eb();else if(kb)u=O();else u=Y();function o(){}var k=void 0,m=1,j=2,s=new B;function K(){return new TypeError("You cannot resolve a promise with itself")}function L(){return new TypeError("A promises callback cannot return that same promise.")}function ab(b){try{return b.then}catch(a){s.error=a;return s}}function bb(e,d,b,c){try{e.call(d,b,c)}catch(a){return a}}function E(c,b,d){l(function(e){var c=false,g=bb(d,b,function(d){if(c)return;c=a;if(b!==d)n(e,d);else h(e,d)},function(b){if(c)return;c=a;f(e,b)},"Settle: "+(e._label||" unknown promise"));if(!c&&g){c=a;f(e,g)}},c)}function H(b,a){if(a._state===m)h(b,a._result);else if(a._state===j)f(b,a._result);else t(a,undefined,function(a){n(b,a)},function(a){f(b,a)})}function F(b,a){if(a.constructor===b.constructor)H(b,a);else{var c=ab(a);if(c===s)f(b,s.error);else if(c===undefined)h(b,a);else if(y(c))E(b,a,c);else h(b,a)}}function n(a,b){if(a===b)f(a,K());else if(Q(b))F(a,b);else h(a,b)}function J(a){a._onerror&&a._onerror(a._result);x(a)}function h(a,b){if(a._state!==k)return;a._result=b;a._state=m;a._subscribers.length!==0&&l(x,a)}function f(a,b){if(a._state!==k)return;a._state=j;a._result=b;l(J,a)}function t(c,g,e,f){var a=c._subscribers,b=a.length;c._onerror=d;a[b]=g;a[b+m]=e;a[b+j]=f;b===0&&c._state&&l(x,c)}function x(b){var a=b._subscribers,f=b._state;if(a.length===0)return;for(var e,d,g=b._result,c=0;c<a.length;c+=3){e=a[c];d=a[c+f];if(e)A(f,e,d,g);else d(g)}b._subscribers.length=0}function B(){this.error=d}var v=new B;function W(b,c){try{return b(c)}catch(a){v.error=a;return v}}function A(l,c,i,o){var g=y(i),b,q,e,p;if(g){b=W(i,o);if(b===v){p=a;q=b.error;b=d}else e=a;if(c===b){f(c,L());return}}else{b=o;e=a}if(c._state===k)if(g&&e)n(c,b);else if(p)f(c,q);else if(l===m)h(c,b);else l===j&&f(c,b)}function I(a,c){try{c(function(b){n(a,b)},function(b){f(a,b)})}catch(b){f(a,b)}}function i(c,b){var a=this;a._instanceConstructor=c;a.promise=new c(o);if(a._validateInput(b)){a._input=b;a.length=b.length;a._remaining=b.length;a._init();if(a.length===0)h(a.promise,a._result);else{a.length=a.length||0;a._enumerate();a._remaining===0&&h(a.promise,a._result)}}else f(a.promise,a._validationError())}i.prototype._validateInput=function(a){return D(a)};i.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")};i.prototype._init=function(){this._result=new Array(this.length)};var Z=i;i.prototype._enumerate=function(){for(var a=this,d=a.length,c=a.promise,e=a._input,b=0;c._state===k&&b<d;b++)a._eachEntry(e[b],b)};i.prototype._eachEntry=function(a,c){var b=this,e=b._instanceConstructor;if(T(a))if(a.constructor===e&&a._state!==k){a._onerror=d;b._settledAt(a._state,c,a._result)}else b._willSettleAt(e.resolve(a),c);else{b._remaining--;b._result[c]=a}};i.prototype._settledAt=function(d,e,c){var a=this,b=a.promise;if(b._state===k){a._remaining--;if(d===j)f(b,c);else a._result[e]=c}a._remaining===0&&h(b,a._result)};i.prototype._willSettleAt=function(c,b){var a=this;t(c,undefined,function(c){a._settledAt(m,b,c)},function(c){a._settledAt(j,b,c)})};function ib(a){return (new Z(this,a)).promise}var V=ib;function db(b){var d=this,a=new d(o);if(!D(b)){f(a,new TypeError("You must pass an array to race."));return a}var h=b.length;function e(b){n(a,b)}function g(b){f(a,b)}for(var c=0;a._state===k&&c<h;c++)t(d.resolve(b[c]),undefined,e,g);return a}var U=db;function N(a){var b=this;if(a&&typeof a===e&&a.constructor===b)return a;var c=new b(o);n(c,a);return c}var M=N;function S(c){var b=this,a=new b(o);f(a,c);return a}var P=S,gb=0;function R(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function fb(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var hb=g;function g(b){var a=this;a._id=gb++;a._state=undefined;a._result=undefined;a._subscribers=[];if(o!==b){!y(b)&&R();!(a instanceof g)&&fb();I(a,b)}}g.all=V;g.race=U;g.resolve=M;g.reject=P;g._setScheduler=cb;g._setAsap=lb;g._asap=l;g.prototype={constructor:g,then:function(d,e){var b=this,a=b._state;if(a===m&&!d||a===j&&!e)return this;var c=new this.constructor(o),g=b._result;if(a){var f=arguments[a-1];l(function(){A(a,c,f,g)})}else t(b,c,d,e);return c},"catch":function(a){return this.then(d,a)}};return hb}.call(this)}d.Init=e})(e=d.PromiseImpl||(d.PromiseImpl={}))})(e=d._Internal||(d._Internal={}));(function(d){function f(){var b=window.navigator.userAgent,c=b.indexOf("Edge/");if(c>=0){b=b.substring(c+5,b.length);if(b<"14.14393")return a;else return false}return false}function e(){if(typeof window===b&&typeof Promise===c)return Promise;if(typeof window!==b&&window.Promise)if(f())return d.PromiseImpl.Init();else return window.Promise;else return d.PromiseImpl.Init()}d.OfficePromise=e()})(e=d._Internal||(d._Internal={}));var f=e.OfficePromise;d.Promise=f})(Office||(Office={}));var OTel;(function(c){var a="telemetry/oteljs_agave.js",b=function(){var c="undefined";function b(){}b.loaded=function(){return !(b.logger===undefined||b.sink===undefined)};b.getOtelSinkCDNLocation=function(){return OSF._OfficeAppFactory.getLoadScriptHelper().getOfficeJsBasePath()+a};b.getMapName=function(b,a){if(a!==undefined&&b.hasOwnProperty(a))return b[a];return a};b.getHost=function(){var c=OSF._OfficeAppFactory.getHostInfo()["hostType"],d={excel:"Excel",onenote:"OneNote",outlook:"Outlook",powerpoint:"PowerPoint",project:"Project",visio:"Visio",word:"Word"},a=b.getMapName(d,c);return a};b.getFlavor=function(){var c=OSF._OfficeAppFactory.getHostInfo()["hostPlatform"],d={android:"Android",ios:"iOS",mac:"Mac",universal:"Universal",web:"Web",win32:"Win32"},a=b.getMapName(d,c);return a};b.ensureValue=function(a,b){if(!a)return b;return a};b.create=function(a){var i={id:a.appId,assetId:a.assetId,officeJsVersion:a.officeJSVersion,hostJsVersion:a.hostJSVersion,browserToken:a.clientId,instanceId:a.appInstanceId,sessionId:a.sessionId},k=oteljs.Contracts.Office.System.SDX.getFields("SDX",i),l=b.getHost(),e=b.getFlavor(),j=e==="Web"&&a.hostVersion.slice(0,2)==="0."?"16.0.0.0":a.hostVersion,d={"App.Name":l,"App.Platform":e,"App.Version":j,"Session.Id":b.ensureValue(a.correlationId,"00000000-0000-0000-0000-000000000000")},h="Office.Extensibility.OfficeJs",g="db334b301e7b474db5e0f02f07c51a47-a1b5bc36-1bbe-482f-a64a-c2d9cb606706-7439",f=1755,c=new oteljs.SimpleTelemetryLogger(undefined,k);c.setTenantToken(h,g,f);if(oteljs.AgaveSink)b.sink=oteljs.AgaveSink.createInstance(d);if(b.sink===undefined)b.attachLegacyAgaveSink(d);else c.addSink(b.sink);return c};b.attachLegacyAgaveSink=function(e){var d=function(){if(typeof oteljs_agave!==c)b.sink=oteljs_agave.AgaveSink.createInstance(e);if(b.sink===undefined||b.logger===undefined){b.Enabled=false;b.promises=[];b.logger=undefined;b.sink=undefined;return}b.logger.addSink(b.sink);b.promises.forEach(function(a){a()})},a=5e3;OSF.OUtil.loadScript(b.getOtelSinkCDNLocation(),d,a)};b.initialize=function(d){if(!b.Enabled){b.promises=[];return}var a=function(){if(typeof oteljs===c)return;if(!b.loaded())b.logger=b.create(d);b.loaded()&&b.promises.forEach(function(a){a()})};Microsoft.Office.WebExtension.onReadyInternal().then(function(){return a()})};b.sendTelemetryEvent=function(a){b.onTelemetryLoaded(function(){try{b.logger.sendTelemetryEvent(a)}catch(c){}})};b.sendCustomerContent=function(a){b.onTelemetryLoaded(function(){try{b.logger.sendCustomerContent(a)}catch(c){}})};b.onTelemetryLoaded=function(a){if(!b.Enabled)return;if(b.loaded())a();else b.promises.push(a)};b.promises=[];b.Enabled=true;return b}();c.OTelLogger=b})(OTel||(OTel={}));(function(b){var a=function(){function a(){this.m_mappings={};this.m_onchangeHandlers=[]}a.prototype.associate=function(){var a="[InvalidArg] Function=associate",b=this;function c(a){typeof console!=="undefined"&&console.warn&&console.warn(a)}if(arguments.length==1&&typeof arguments[0]==="object"&&arguments[0]){var g=arguments[0];for(var i in g)b.associate(i,g[i])}else if(arguments.length==2){var d=arguments[0],h=arguments[1];if(typeof d!=="string"){c(a);return}if(typeof h!=="function"){c(a);return}var f=d.toUpperCase();b.m_mappings[f]&&c("[DuplicatedName] Function="+d);b.m_mappings[f]=h;for(var e=0;e<b.m_onchangeHandlers.length;e++)b.m_onchangeHandlers[e]()}else c(a)};a.prototype.onchange=function(a){a&&this.m_onchangeHandlers.push(a)};Object.defineProperty(a.prototype,"mappings",{"get":function(){return this.m_mappings},enumerable:true,configurable:true});return a}();b.Association=a})(OfficeExt||(OfficeExt={}));var CustomFunctionMappings=window.CustomFunctionMappings||{},CustomFunctions;(function(a){var b="__delay__";function c(){CustomFunctionMappings[b]=true}a.delayInitialization=c;a._association=new OfficeExt.Association;function d(){a._association.associate.apply(a._association,arguments);delete CustomFunctionMappings[b]}a.associate=d})(CustomFunctions||(CustomFunctions={}));(function(a){var b;(function(a){a._association=new OfficeExt.Association;function b(){a._association.associate.apply(a._association,arguments)}a.associate=b})(b=a.actions||(a.actions={}))})(Office||(Office={}));var g_isExpEnabled=g_isExpEnabled||false,g_isOfflineLibrary=g_isOfflineLibrary||false;(function(){var a=OSF.ConstantNames||{};OSF.ConstantNames={FileVersion:"0.0.0.0",OfficeJS:"office.js",OfficeDebugJS:"office.debug.js",DefaultLocale:"en-us",LocaleStringLoadingTimeout:5e3,MicrosoftAjaxId:"MSAJAX",OfficeStringsId:"OFFICESTRINGS",OfficeJsId:"OFFICEJS",HostFileId:"HOST",O15MappingId:"O15Mapping",OfficeStringJS:"office_strings.js",O15InitHelper:"o15apptofilemappingtable.js",SupportedLocales:OSF.SupportedLocales,AssociatedLocales:OSF.AssociatedLocales,ExperimentScriptSuffix:"experiment"};for(var b in a)OSF.ConstantNames[b]=a[b]})();OSF.InitializationHelper=function(d,b,f,e,c){var a=this;a._hostInfo=d;a._webAppState=b;a._context=f;a._settings=e;a._hostFacade=c};OSF.InitializationHelper.prototype.saveAndSetDialogInfo=function(){};OSF.InitializationHelper.prototype.getAppContext=function(){};OSF.InitializationHelper.prototype.setAgaveHostCommunication=function(){};OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function(){};OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function(){};OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function(){};OSF.HostInfoFlags={SharedApp:1,CustomFunction:2,ProtectedDocDisable:4,ExperimentJsEnabled:8,PublicAddin:16};OSF._OfficeAppFactory=function(){var m="_host_Info",g="function",a="undefined",f="",d=true,e=false,b=null,o=function(b,a){if(a&&b&&!a[b])a[b]={}};o("Office",window);o("Microsoft",window);o("Office",Microsoft);o("WebExtension",Microsoft.Office);if(typeof window.Office==="object")for(var s in window.Office)if(window.Office.hasOwnProperty(s))Microsoft.Office.WebExtension[s]=window.Office[s];window.Office=Microsoft.Office.WebExtension;var y={0:"Unknown",1:"Hidden",2:"Taskpane",3:"Dialog"};Microsoft.Office.WebExtension.PlatformType={PC:"PC",OfficeOnline:"OfficeOnline",Mac:"Mac",iOS:"iOS",Android:"Android",Universal:"Universal"};Microsoft.Office.WebExtension.HostType={Word:"Word",Excel:"Excel",PowerPoint:"PowerPoint",Outlook:"Outlook",OneNote:"OneNote",Project:"Project",Access:"Access",Visio:"Visio"};var r={},H={},q={},j={id:b,webAppUrl:b,conversationID:b,clientEndPoint:b,wnd:window.parent,focused:e},c={isO15:d,isRichClient:d,hostType:f,hostPlatform:f,hostSpecificFileVersion:f,hostLocale:f,osfControlAppCorrelationId:f,isDialog:e,disableLogging:e,flags:0},l=d,i={},w=b,v=e,n=[],u=e,k={host:b,platform:b,addin:b},h=new ScriptLoading.LoadScriptHelper({OfficeJS:OSF.ConstantNames.OfficeJS,OfficeDebugJS:OSF.ConstantNames.OfficeDebugJS});window.performance&&window.performance.now&&h.logScriptLoading(OSF.ConstantNames.OfficeJsId,-1,window.performance.now());var C=window.location.hash,B=window.location.search,x=window.name,t=function(b){var f=b.host,c=b.platform,e=b.addin;v=d;if(typeof OSFPerformance!==a)OSFPerformance.officeOnReady=OSFPerformance.now();k={host:f,platform:c,addin:e};while(n.length>0)n.shift()(k)};Microsoft.Office.WebExtension.FeatureGates={};Microsoft.Office.WebExtension.sendTelemetryEvent=function(a){OTel.OTelLogger.sendTelemetryEvent(a)};Microsoft.Office.WebExtension.telemetrySink=OTel.OTelLogger;Microsoft.Office.WebExtension.onReadyInternal=function(a){if(v){var e=k.host,c=k.platform,d=k.addin;if(a){var b=a({host:e,platform:c,addin:d});if(b&&b.then&&typeof b.then===g)return b.then(function(){return Office.Promise.resolve({host:e,platform:c,addin:d})})}return Office.Promise.resolve({host:e,platform:c,addin:d})}if(a)return new Office.Promise(function(b){n.push(function(d){var c=a(d);if(c&&c.then&&typeof c.then===g)return c.then(function(){return b(d)});b(d)})});return new Office.Promise(function(a){n.push(a)})};Microsoft.Office.WebExtension.onReady=function(a){u=d;return Microsoft.Office.WebExtension.onReadyInternal(a)};var p=function(g){var c,d=window.location.search;if(d){var b=d.split(g+"=");if(b.length>1){var e=b[1],f=new RegExp("[&#]","g"),a=e.split(f);if(a.length>0)c=a[0]}}return c},F=function(f,g){var b=f.split("."),c=g.split("."),a;for(a in b)if(parseInt(b[a])<parseInt(c[a]))return e;else if(parseInt(b[a])>parseInt(c[a]))return d;return e},z=function(){try{var b="15.30.1128.0",a=window.external.GetContext().GetHostFullVersion()}catch(c){return e}return !!F(b,a)},A=function(){l=d;try{if(c.disableLogging){l=e;return}window.external=window.external||{};if(typeof window.external.GetLoggingAllowed===a)l=d;else l=window.external.GetLoggingAllowed()}catch(b){}},E=function(){var i="hostInfoValue",l="isDialog",o=m,h=p(o);if(!h)try{var r=JSON.parse(x);h=r?r["hostInfo"]:b}catch(s){}if(!h)try{window.external=window.external||{};if(typeof agaveHost!==a&&agaveHost.GetHostInfo)window.external.GetHostInfo=function(){return agaveHost.GetHostInfo()};var k=window.external.GetHostInfo();if(k==l){c.isO15=d;c.isDialog=d}else if(k.toLowerCase().indexOf("mac")!==-1&&k.toLowerCase().indexOf("outlook")!==-1&&z())c.isO15=d;else{var q=k.split(o+"=");if(q.length>1)h=q[1];else h=k}}catch(s){}var u=function(){var a=b;try{if(window.sessionStorage)a=window.sessionStorage}catch(c){}return a},j=u();if(!h&&j&&j.getItem(i))h=j.getItem(i);if(h){h=decodeURIComponent(h);c.isO15=e;var g=h.split("$");if(typeof g[2]==a)g=h.split("|");c.hostType=typeof g[0]==a?f:g[0].toLowerCase();c.hostPlatform=typeof g[1]==a?f:g[1].toLowerCase();c.hostSpecificFileVersion=typeof g[2]==a?f:g[2].toLowerCase();c.hostLocale=typeof g[3]==a?f:g[3].toLowerCase();c.osfControlAppCorrelationId=typeof g[4]==a?f:g[4];if(c.osfControlAppCorrelationId=="telemetry")c.osfControlAppCorrelationId=f;c.isDialog=typeof g[5]!=a&&g[5]==l?d:e;c.disableLogging=typeof g[6]!=a&&g[6]=="disableLogging"?d:e;c.flags=typeof g[7]==="string"&&g[7].length>0?parseInt(g[7]):0;if(g_isOfflineLibrary)g_isExpEnabled=e;else g_isExpEnabled=g_isExpEnabled||!!(c.flags&OSF.HostInfoFlags.ExperimentJsEnabled);var t=parseFloat(c.hostSpecificFileVersion),n=OSF.HostSpecificFileVersionDefault;if(OSF.HostSpecificFileVersionMap[c.hostType]&&OSF.HostSpecificFileVersionMap[c.hostType][c.hostPlatform])n=OSF.HostSpecificFileVersionMap[c.hostType][c.hostPlatform];if(t>parseFloat(n))c.hostSpecificFileVersion=n;if(j)try{j.setItem(i,h)}catch(v){}}else{c.isO15=d;c.hostLocale=p("locale")}},D=function(b,a){OSF.AppTelemetry&&OSF.AppTelemetry.logAppCommonMessage&&OSF.AppTelemetry.logAppCommonMessage("getAppContextAsync starts");i.getAppContext(b,a)},G=function(){E();A();if(c.hostPlatform=="web"&&c.isDialog&&window==window.top&&window.opener==b){window.open(f,"_self",f);window.close()}if((c.flags&(OSF.HostInfoFlags.SharedApp|OSF.HostInfoFlags.CustomFunction))!==0)if(typeof window.Promise===a)window.Promise=window.Office.Promise;h.setAppCorrelationId(c.osfControlAppCorrelationId);var k=h.getOfficeJsBasePath(),B=e;if(!k)throw"Office Web Extension script library file name should be "+OSF.ConstantNames.OfficeJS+" or "+OSF.ConstantNames.OfficeDebugJS+".";var n=function(){if(typeof Sys!==a&&typeof Type!==a&&Sys.StringBuilder&&typeof Sys.StringBuilder===g&&Type.registerNamespace&&typeof Type.registerNamespace===g&&Type.registerClass&&typeof Type.registerClass===g||typeof OfficeExt!==a&&OfficeExt.MsAjaxError)return d;else return e},o=b,v=function(f){var b=e,c=function(){if(typeof Strings==a||typeof Strings.OfficeOM==a)if(!b){b=d;var g=k+OSF.ConstantNames.DefaultLocale+"/"+OSF.ConstantNames.OfficeStringJS;h.loadScript(g,OSF.ConstantNames.OfficeStringsId,c,d,OSF.ConstantNames.LocaleStringLoadingTimeout);return e}else throw"Neither the locale, "+f.toLowerCase()+", provided by the host app nor the fallback locale "+OSF.ConstantNames.DefaultLocale+" are supported.";else{b=e;o=Strings.OfficeOM}};if(!n()){window.Type=Function;Type.registerNamespace=function(a){window[a]=window[a]||{}};Type.prototype.registerClass=function(a){a={}}}var g=k+OSF.getSupportedLocale(f,OSF.ConstantNames.DefaultLocale)+"/"+OSF.ConstantNames.OfficeStringJS;h.loadScript(g,OSF.ConstantNames.OfficeStringsId,c,d,OSF.ConstantNames.LocaleStringLoadingTimeout)},s=function(s){if(s){i=new OSF.InitializationHelper(c,j,r,H,q);c.hostPlatform=="web"&&i.saveAndSetDialogInfo&&i.saveAndSetDialogInfo(p(m));i.setAgaveHostCommunication();if(typeof OSFPerformance!==a)OSFPerformance.getAppContextStart=OSFPerformance.now();D(j.wnd,function(d){if(typeof OSFPerformance!==a)OSFPerformance.getAppContextEnd=OSFPerformance.now();OSF.AppTelemetry&&OSF.AppTelemetry.logAppCommonMessage&&OSF.AppTelemetry.logAppCommonMessage("getAppContextAsync callback start");w=d._appInstanceId;if(d.get_featureGates){var e=d.get_featureGates();if(e)Microsoft.Office.WebExtension.FeatureGates=e}var f=function(){var a=c.hostSpecificFileVersion.split(".");if(d.get_appMinorVersion){var b=c.hostPlatform=="ios";if(!b)if(isNaN(d.get_appMinorVersion()))d._appMinorVersion=parseInt(a[1]);else if(a.length>1&&!isNaN(Number(a[1])))d._appMinorVersion=parseInt(a[1])}if(c.isDialog)d._isDialog=c.isDialog};f();var j=function(){i.prepareApiSurface&&i.prepareApiSurface(d);h.waitForFunction(function(){return Microsoft.Office.WebExtension.initialize!=undefined||u},function(f){if(f){if(i.prepareApiSurface)Microsoft.Office.WebExtension.initialize&&Microsoft.Office.WebExtension.initialize(i.getInitializationReason(d));else{if(!Microsoft.Office.WebExtension.initialize)Microsoft.Office.WebExtension.initialize=function(){};i.prepareRightBeforeWebExtensionInitialize(d)}i.prepareRightAfterWebExtensionInitialize&&i.prepareRightAfterWebExtensionInitialize();var e=d.get_appName(),a=b;if((c.flags&OSF.HostInfoFlags.SharedApp)!==0)a={visibilityMode:y[d.get_initialDisplayMode&&typeof d.get_initialDisplayMode===g?d.get_initialDisplayMode():0]};t({host:OfficeExt.HostName.Host.getInstance().getHost(e),platform:OfficeExt.HostName.Host.getInstance().getPlatform(e),addin:a})}else throw new Error('Office.js has not fully loaded. Your app must call "Office.onReady()" as part of it\'s loading sequence (or set the "Office.initialize" function). If your app has this functionality, try reloading this page.')},400,50)};!h.isScriptLoading(OSF.ConstantNames.OfficeStringsId)&&v(d.get_appUILocale());h.waitForScripts([OSF.ConstantNames.OfficeStringsId],function(){if(o&&!Strings.OfficeOM)Strings.OfficeOM=o;i.loadAppSpecificScriptAndCreateOM(d,j,k);if(typeof OSFPerformance!==a)OSFPerformance.createOMEnd=OSFPerformance.now()})});if(c.isO15){var n=OSF.OUtil.parseXdmInfo()==b;if(n){var f=d;if(window.external&&typeof window.external.GetContext!==a)try{window.external.GetContext();f=e}catch(x){}if(typeof OsfOptOut===a&&f&&window.top!==window.self){window.console&&window.console.log&&window.console.log("The add-in is not hosted in plain browser top window.");window.location.href="about:blank"}f&&t({host:b,platform:b,addin:b})}}}else{var l="MicrosoftAjax.js is not loaded successfully.";OSF.AppTelemetry&&OSF.AppTelemetry.logAppException&&OSF.AppTelemetry.logAppException(l);throw l}},x=function(){OSF.AppTelemetry&&OSF.AppTelemetry.setOsfControlAppCorrelationId&&OSF.AppTelemetry.setOsfControlAppCorrelationId(c.osfControlAppCorrelationId);if(h.isScriptLoading(OSF.ConstantNames.MicrosoftAjaxId))h.waitForScripts([OSF.ConstantNames.MicrosoftAjaxId],s);else h.waitForFunction(n,s,500,100)};if(c.isO15)h.loadScript(k+OSF.ConstantNames.O15InitHelper,OSF.ConstantNames.O15MappingId,x);else{var l;if(g_isExpEnabled)l=[c.hostType,c.hostPlatform,OSF.ConstantNames.ExperimentScriptSuffix||b,OSF.ConstantNames.HostFileScriptSuffix||b].filter(function(a){return a!=b}).join("-")+".js";else l=[c.hostType,c.hostPlatform,c.hostSpecificFileVersion,OSF.ConstantNames.HostFileScriptSuffix||b].filter(function(a){return a!=b}).join("-")+".js";h.loadScript(k+l.toLowerCase(),OSF.ConstantNames.HostFileId,x);if(typeof OSFPerformance!==a)OSFPerformance.hostSpecificFileName=l.toLowerCase()}c.hostLocale&&v(c.hostLocale);if(B&&!n()){var C=(window.location.protocol.toLowerCase()==="https:"?"https:":"http:")+"//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js";h.loadScriptParallel(C,OSF.ConstantNames.MicrosoftAjaxId)}window.confirm=function(){throw new Error("Function window.confirm is not supported.")};window.alert=function(){throw new Error("Function window.alert is not supported.")};window.prompt=function(){throw new Error("Function window.prompt is not supported.")};var z=c.hostType=="outlook"&&c.hostPlatform=="android";if(!z){window.history.replaceState=b;window.history.pushState=b}};G();window.addEventListener&&window.addEventListener("DOMContentLoaded",function(){Microsoft.Office.WebExtension.onReadyInternal(function(){typeof OSFPerfUtil!==a&&OSFPerfUtil.sendPerformanceTelemetry()})});return {getId:function(){return j.id},getClientEndPoint:function(){return j.clientEndPoint},getContext:function(){return r},setContext:function(a){r=a},getHostInfo:function(){return c},getLoggingAllowed:function(){return l},getHostFacade:function(){return q},setHostFacade:function(a){q=a},getInitializationHelper:function(){return i},getCachedSessionSettingsKey:function(){return (j.conversationID!=b?j.conversationID:w)+"CachedSessionSettings"},getWebAppState:function(){return j},getWindowLocationHash:function(){return C},getWindowLocationSearch:function(){return B},getLoadScriptHelper:function(){return h},getWindowName:function(){return x}}}()



!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.TestUtility=t.CoreUtility=t.RichApiMessageUtility=t.CoreConstants=t.CoreResourceStrings=t.CoreErrorCodes=t.Provider=t.Attribution=t.WebImage=t.Entity=t.FormattedNumber=t.Error=t._Internal=t.HostBridge=t.HttpUtility=t.SessionBase=void 0;var i=function(){function e(){}return e.prototype._resolveRequestUrlAndHeaderInfo=function(){return f._createPromiseFromResult(null)},e.prototype._createRequestExecutorOrNull=function(){return null},Object.defineProperty(e.prototype,"eventRegistration",{get:function(){return null},enumerable:!1,configurable:!0}),e}();t.SessionBase=i;var s=function(){function e(){}return e.setCustomSendRequestFunc=function(t){e.s_customSendRequestFunc=t},e.xhrSendRequestFunc=function(e){return f.createPromise((function(t,n){var r=new XMLHttpRequest;if(r.open(e.method,e.url),r.onload=function(){var e={statusCode:r.status,headers:f._parseHttpResponseHeaders(r.getAllResponseHeaders()),body:r.responseText};t(e)},r.onerror=function(){n(new a.RuntimeError({code:c.connectionFailure,httpStatusCode:r.status,message:f._getResourceString(l.connectionFailureWithStatus,r.statusText)}))},e.headers)for(var o in e.headers)r.setRequestHeader(o,e.headers[o]);r.send(f._getRequestBodyText(e))}))},e.fetchSendRequestFunc=function(e){var t=f._getRequestBodyText(e);return""===t&&(t=void 0),fetch(e.url,{method:e.method,headers:e.headers,body:t}).then((function(e){return e.text().then((function(t){var n=e.status,r={};return e.headers.forEach((function(e,t){r[t]=e})),{statusCode:n,headers:r,body:t}}))}))},e.sendRequest=function(t){e.validateAndNormalizeRequest(t);var n=e.s_customSendRequestFunc;return n||(n="undefined"!=typeof fetch?e.fetchSendRequestFunc:e.xhrSendRequestFunc),n(t)},e.setCustomSendLocalDocumentRequestFunc=function(t){e.s_customSendLocalDocumentRequestFunc=t},e.sendLocalDocumentRequest=function(t){return e.validateAndNormalizeRequest(t),(e.s_customSendLocalDocumentRequestFunc||e.officeJsSendLocalDocumentRequestFunc)(t)},e.officeJsSendLocalDocumentRequestFunc=function(e){e=f._validateLocalDocumentRequest(e);var t=f._buildRequestMessageSafeArray(e);return f.createPromise((function(e,n){OSF.DDA.RichApi.executeRichApiRequestAsync(t,(function(t){var n;n="succeeded"==t.status?{statusCode:p.getResponseStatusCode(t),headers:p.getResponseHeaders(t),body:p.getResponseBody(t)}:p.buildHttpResponseFromOfficeJsError(t.error.code,t.error.message),f.log("Response:"),f.log(JSON.stringify(n)),e(n)}))}))},e.validateAndNormalizeRequest=function(e){if(f.isNullOrUndefined(e))throw a.RuntimeError._createInvalidArgError({argumentName:"request"});f.isNullOrEmptyString(e.method)&&(e.method="GET"),e.method=e.method.toUpperCase()},e.logRequest=function(t){if(f._logEnabled){if(f.log("---HTTP Request---"),f.log(t.method+" "+t.url),t.headers)for(var n in t.headers)f.log(n+": "+t.headers[n]);e._logBodyEnabled&&f.log(f._getRequestBodyText(t))}},e.logResponse=function(t){if(f._logEnabled){if(f.log("---HTTP Response---"),f.log(""+t.statusCode),t.headers)for(var n in t.headers)f.log(n+": "+t.headers[n]);e._logBodyEnabled&&f.log(t.body)}},e._logBodyEnabled=!1,e}();t.HttpUtility=s;var a,u=function(){function e(e){var t=this;this.m_bridge=e,this.m_promiseResolver={},this.m_handlers=[],this.m_bridge.onMessageFromHost=function(e){var n=JSON.parse(e);if(3==n.type){var r=n.message;if(r&&r.entries)for(var o=0;o<r.entries.length;o++){var i=r.entries[o];if(Array.isArray(i)){var s={messageCategory:i[0],messageType:i[1],targetId:i[2],message:i[3],id:i[4]};r.entries[o]=s}}}t.dispatchMessage(n)}}return e.init=function(t){if("object"==typeof t&&t){var n=new e(t);e.s_instance=n,s.setCustomSendLocalDocumentRequestFunc((function(t){t=f._validateLocalDocumentRequest(t);var r=0;f.isReadonlyRestRequest(t.method)||(r=1);var o=t.url.indexOf("?");if(o>=0){var i=t.url.substr(o+1),s=f._parseRequestFlagsAndCustomDataFromQueryStringIfAny(i);s.flags>=0&&(r=s.flags)}var a={id:e.nextId(),type:1,flags:r,message:t};return n.sendMessageToHostAndExpectResponse(a).then((function(e){return e.message}))}));for(var r=0;r<e.s_onInitedHandlers.length;r++)e.s_onInitedHandlers[r](n)}},Object.defineProperty(e,"instance",{get:function(){return e.s_instance},enumerable:!1,configurable:!0}),e.prototype.sendMessageToHost=function(e){this.m_bridge.sendMessageToHost(JSON.stringify(e))},e.prototype.sendMessageToHostAndExpectResponse=function(e){var t=this,n=f.createPromise((function(n,r){t.m_promiseResolver[e.id]=n}));return this.m_bridge.sendMessageToHost(JSON.stringify(e)),n},e.prototype.addHostMessageHandler=function(e){this.m_handlers.push(e)},e.prototype.removeHostMessageHandler=function(e){var t=this.m_handlers.indexOf(e);t>=0&&this.m_handlers.splice(t,1)},e.onInited=function(t){e.s_onInitedHandlers.push(t),e.s_instance&&t(e.s_instance)},e.prototype.dispatchMessage=function(e){if("number"==typeof e.id){var t=this.m_promiseResolver[e.id];if(t)return t(e),void delete this.m_promiseResolver[e.id]}for(var n=0;n<this.m_handlers.length;n++)this.m_handlers[n](e)},e.nextId=function(){return e.s_nextId++},e.s_onInitedHandlers=[],e.s_nextId=1,e}();t.HostBridge=u,"object"==typeof _richApiNativeBridge&&_richApiNativeBridge&&u.init(_richApiNativeBridge),function(e){var t=function(t){function n(e){var r=t.call(this,"string"==typeof e?e:e.message)||this;if(Object.setPrototypeOf(r,n.prototype),r.name="RichApi.Error","string"==typeof e?r.message=e:(r.code=e.code,r.message=e.message,r.traceMessages=e.traceMessages||[],r.innerError=e.innerError||null,r.debugInfo=r._createDebugInfo(e.debugInfo||{}),r.httpStatusCode=e.httpStatusCode,r.data=e.data),f.isNullOrUndefined(r.httpStatusCode)||200===r.httpStatusCode){var o={};o[c.accessDenied]=401,o[c.connectionFailure]=500,o[c.generalException]=500,o[c.invalidArgument]=400,o[c.invalidObjectPath]=400,o[c.invalidOrTimedOutSession]=408,o[c.invalidRequestContext]=400,o[c.timeout]=408,o[c.valueNotLoaded]=400,r.httpStatusCode=o[r.code]}return f.isNullOrUndefined(r.httpStatusCode)&&(r.httpStatusCode=500),r}return o(n,t),n.prototype.toString=function(){return this.code+": "+this.message},n.prototype._createDebugInfo=function(t){var n={code:this.code,message:this.message,toString:function(){return JSON.stringify(this)}};for(var r in t)n[r]=t[r];return this.innerError&&(this.innerError instanceof e.RuntimeError?n.innerError=this.innerError.debugInfo:n.innerError=this.innerError),n},n._createInvalidArgError=function(t){return new e.RuntimeError({code:c.invalidArgument,httpStatusCode:400,message:f.isNullOrEmptyString(t.argumentName)?f._getResourceString(l.invalidArgumentGeneric):f._getResourceString(l.invalidArgument,t.argumentName),debugInfo:t.errorLocation?{errorLocation:t.errorLocation}:{},innerError:t.innerError})},n}(Error);e.RuntimeError=t}(a=t._Internal||(t._Internal={})),t.Error=a.RuntimeError,t.FormattedNumber=a.FormattedNumber,t.Entity=a.Entity,t.WebImage=a.WebImage,t.Attribution=a.Attribution,t.Provider=a.Provider;var c=function(){function e(){}return e.apiNotFound="ApiNotFound",e.accessDenied="AccessDenied",e.generalException="GeneralException",e.activityLimitReached="ActivityLimitReached",e.invalidArgument="InvalidArgument",e.connectionFailure="ConnectionFailure",e.timeout="Timeout",e.invalidOrTimedOutSession="InvalidOrTimedOutSession",e.invalidObjectPath="InvalidObjectPath",e.invalidRequestContext="InvalidRequestContext",e.valueNotLoaded="ValueNotLoaded",e.requestPayloadSizeLimitExceeded="RequestPayloadSizeLimitExceeded",e}();t.CoreErrorCodes=c;var l=function(){function e(){}return e.apiNotFoundDetails="ApiNotFoundDetails",e.connectionFailureWithStatus="ConnectionFailureWithStatus",e.connectionFailureWithDetails="ConnectionFailureWithDetails",e.invalidArgument="InvalidArgument",e.invalidArgumentGeneric="InvalidArgumentGeneric",e.timeout="Timeout",e.invalidOrTimedOutSessionMessage="InvalidOrTimedOutSessionMessage",e.invalidObjectPath="InvalidObjectPath",e.invalidRequestContext="InvalidRequestContext",e.valueNotLoaded="ValueNotLoaded",e}();t.CoreResourceStrings=l;var d=function(){function e(){}return e.flags="flags",e.sourceLibHeader="SdkVersion",e.processQuery="ProcessQuery",e.localDocument="http://document.localhost/",e.localDocumentApiPrefix="http://document.localhost/_api/",e.customData="customdata",e}();t.CoreConstants=d;var p=function(){function e(){}return e.buildMessageArrayForIRequestExecutor=function(t,n,r,o){var i=JSON.stringify(r.Body);f.log("Request:"),f.log(i);var s={};return f._copyHeaders(r.Headers,s),s[d.sourceLibHeader]=o,e.buildRequestMessageSafeArray(t,n,"POST",d.processQuery,s,i)},e.buildResponseOnSuccess=function(e,t){var n={HttpStatusCode:200,ErrorCode:"",ErrorMessage:"",Headers:null,Body:null};return n.Body=JSON.parse(e),n.Headers=t,n},e.buildResponseOnError=function(t,n){var r={HttpStatusCode:500,ErrorCode:"",ErrorMessage:"",Headers:null,Body:null};return r.ErrorCode=c.generalException,r.ErrorMessage=n,t==e.OfficeJsErrorCode_ooeNoCapability?(r.ErrorCode=c.accessDenied,r.HttpStatusCode=401):t==e.OfficeJsErrorCode_ooeActivityLimitReached?(r.ErrorCode=c.activityLimitReached,r.HttpStatusCode=429):t==e.OfficeJsErrorCode_ooeInvalidOrTimedOutSession?(r.ErrorCode=c.invalidOrTimedOutSession,r.HttpStatusCode=408,r.ErrorMessage=f._getResourceString(l.invalidOrTimedOutSessionMessage)):t==e.OfficeJsErrorCode_ooeRequestPayloadSizeLimitExceeded&&(r.ErrorCode=c.requestPayloadSizeLimitExceeded,r.HttpStatusCode=400),r},e.buildHttpResponseFromOfficeJsError=function(t,n){var r=500,o={error:{}};return o.error.code=c.generalException,o.error.message=n,t===e.OfficeJsErrorCode_ooeNoCapability?(r=403,o.error.code=c.accessDenied):t===e.OfficeJsErrorCode_ooeActivityLimitReached&&(r=429,o.error.code=c.activityLimitReached),{statusCode:r,headers:{},body:JSON.stringify(o)}},e.buildRequestMessageSafeArray=function(e,t,n,r,o,i){var s=[];if(o)for(var a in o)s.push(a),s.push(o[a]);return[e,n,r,s,i,0,t,"","",""]},e.getResponseBody=function(t){return e.getResponseBodyFromSafeArray(t.value.data)},e.getResponseHeaders=function(t){return e.getResponseHeadersFromSafeArray(t.value.data)},e.getResponseBodyFromSafeArray=function(e){var t=e[2];return"string"==typeof t?t:t.join("")},e.getResponseHeadersFromSafeArray=function(e){var t=e[1];if(!t)return null;for(var n={},r=0;r<t.length-1;r+=2)n[t[r]]=t[r+1];return n},e.getResponseStatusCode=function(t){return e.getResponseStatusCodeFromSafeArray(t.value.data)},e.getResponseStatusCodeFromSafeArray=function(e){return e[0]},e.OfficeJsErrorCode_ooeInvalidOrTimedOutSession=5012,e.OfficeJsErrorCode_ooeActivityLimitReached=5102,e.OfficeJsErrorCode_ooeNoCapability=7e3,e.OfficeJsErrorCode_ooeRequestPayloadSizeLimitExceeded=5103,e}();t.RichApiMessageUtility=p,function(e){e.getPromiseType=function(){if("undefined"!=typeof Promise)return Promise;if("undefined"!=typeof Office&&Office.Promise)return Office.Promise;if("undefined"!=typeof OfficeExtension&&OfficeExtension.Promise)return OfficeExtension.Promise;throw new e.Error("No Promise implementation found")}}(a=t._Internal||(t._Internal={}));var f=function(){function e(){}return e.log=function(t){e._logEnabled&&"undefined"!=typeof console&&console.log&&console.log(t)},e.checkArgumentNull=function(t,n){if(e.isNullOrUndefined(t))throw a.RuntimeError._createInvalidArgError({argumentName:n})},e.isNullOrUndefined=function(e){return null==e},e.isUndefined=function(e){return void 0===e},e.isNullOrEmptyString=function(e){return null==e||0==e.length},e.isPlainJsonObject=function(t){if(e.isNullOrUndefined(t))return!1;if("object"!=typeof t)return!1;if("[object Object]"!==Object.prototype.toString.apply(t))return!1;if(t.constructor&&!Object.prototype.hasOwnProperty.call(t,"constructor")&&!Object.prototype.hasOwnProperty.call(t.constructor.prototype,"hasOwnProperty"))return!1;for(var n in t)if(!Object.prototype.hasOwnProperty.call(t,n))return!1;return!0},e.trim=function(e){return e.replace(new RegExp("^\\s+|\\s+$","g"),"")},e.caseInsensitiveCompareString=function(t,n){return e.isNullOrUndefined(t)?e.isNullOrUndefined(n):!e.isNullOrUndefined(n)&&t.toUpperCase()==n.toUpperCase()},e.isReadonlyRestRequest=function(t){return e.caseInsensitiveCompareString(t,"GET")},e._getResourceString=function(t,n){var r;if("undefined"!=typeof window&&window.Strings&&window.Strings.OfficeOM){var o="L_"+t,i=window.Strings.OfficeOM[o];i&&(r=i)}if(r||(r=e.s_resourceStringValues[t]),r||(r=t),!e.isNullOrUndefined(n))if(Array.isArray(n)){var s=n;r=e._formatString(r,s)}else r=r.replace("{0}",n);return r},e._formatString=function(e,t){return e.replace(/\{\d\}/g,(function(e){var n=parseInt(e.substr(1,e.length-2));if(n<t.length)return t[n];throw a.RuntimeError._createInvalidArgError({argumentName:"format"})}))},Object.defineProperty(e,"Promise",{get:function(){return a.getPromiseType()},enumerable:!1,configurable:!0}),e.createPromise=function(t){return new e.Promise(t)},e._createPromiseFromResult=function(t){return e.createPromise((function(e,n){e(t)}))},e._createPromiseFromException=function(t){return e.createPromise((function(e,n){n(t)}))},e._createTimeoutPromise=function(t){return e.createPromise((function(e,n){setTimeout((function(){e(null)}),t)}))},e._createInvalidArgError=function(e){return a.RuntimeError._createInvalidArgError(e)},e._isLocalDocumentUrl=function(t){return e._getLocalDocumentUrlPrefixLength(t)>0},e._getLocalDocumentUrlPrefixLength=function(e){for(var t=["http://document.localhost","https://document.localhost","//document.localhost"],n=e.toLowerCase().trim(),r=0;r<t.length;r++){if(n===t[r])return t[r].length;if(n.substr(0,t[r].length+1)===t[r]+"/")return t[r].length+1}return 0},e._validateLocalDocumentRequest=function(t){var n=e._getLocalDocumentUrlPrefixLength(t.url);if(n<=0)throw a.RuntimeError._createInvalidArgError({argumentName:"request"});var r=t.url.substr(n),o=r.toLowerCase();return"_api"===o?r="":"_api/"===o.substr(0,"_api/".length)&&(r=r.substr("_api/".length)),{method:t.method,url:r,headers:t.headers,body:t.body}},e._parseRequestFlagsAndCustomDataFromQueryStringIfAny=function(e){for(var t={flags:-1,customData:""},n=e.split("&"),r=0;r<n.length;r++){var o=n[r].split("=");if(o[0].toLowerCase()===d.flags){var i=parseInt(o[1]);i&=4095,t.flags=i}else o[0].toLowerCase()===d.customData&&(t.customData=decodeURIComponent(o[1]))}return t},e._getRequestBodyText=function(e){var t="";return"string"==typeof e.body?t=e.body:e.body&&"object"==typeof e.body&&(t=JSON.stringify(e.body)),t},e._parseResponseBody=function(t){if("string"==typeof t.body){var n=e.trim(t.body);return JSON.parse(n)}return t.body},e._buildRequestMessageSafeArray=function(t){var n=0;e.isReadonlyRestRequest(t.method)||(n=1);var r="";if(t.url.substr(0,d.processQuery.length).toLowerCase()===d.processQuery.toLowerCase()){var o=t.url.indexOf("?");if(o>0){var i=t.url.substr(o+1),s=e._parseRequestFlagsAndCustomDataFromQueryStringIfAny(i);s.flags>=0&&(n=s.flags),r=s.customData}}return p.buildRequestMessageSafeArray(r,n,t.method,t.url,t.headers,e._getRequestBodyText(t))},e._parseHttpResponseHeaders=function(t){var n={};if(!e.isNullOrEmptyString(t))for(var r=new RegExp("\r?\n"),o=t.split(r),i=0;i<o.length;i++){var s=o[i];if(null!=s){var a=s.indexOf(":");if(a>0){var u=s.substr(0,a),c=s.substr(a+1);u=e.trim(u),c=e.trim(c),n[u.toUpperCase()]=c}}}return n},e._parseErrorResponse=function(t){var n=null;if(e.isPlainJsonObject(t.body))n=t.body;else if(!e.isNullOrEmptyString(t.body)){var r=e.trim(t.body);try{n=JSON.parse(r)}catch(t){e.log("Error when parse "+r)}}var o=t.statusCode.toString();if(e.isNullOrUndefined(n)||"object"!=typeof n||!n.error)return e._createDefaultErrorResponse(o);var i=n.error,s=i.innerError;return s&&s.code?e._createErrorResponse(s.code,o,s.message):i.code?e._createErrorResponse(i.code,o,i.message):e._createDefaultErrorResponse(o)},e._createDefaultErrorResponse=function(t){return{errorCode:c.connectionFailure,errorMessage:e._getResourceString(l.connectionFailureWithStatus,t)}},e._createErrorResponse=function(t,n,r){return{errorCode:t,errorMessage:e._getResourceString(l.connectionFailureWithDetails,[n,t,r])}},e._copyHeaders=function(e,t){if(e&&t)for(var n in e)t[n]=e[n]},e.addResourceStringValues=function(t){for(var n in t)e.s_resourceStringValues[n]=t[n]},e._logEnabled=!1,e.s_resourceStringValues={ApiNotFoundDetails:"The method or property {0} is part of the {1} requirement set, which is not available in your version of {2}.",ConnectionFailureWithStatus:"The request failed with status code of {0}.",ConnectionFailureWithDetails:"The request failed with status code of {0}, error code {1} and the following error message: {2}",InvalidArgument:"The argument '{0}' doesn't work for this situation, is missing, or isn't in the right format.",InvalidObjectPath:'The object path \'{0}\' isn\'t working for what you\'re trying to do. If you\'re using the object across multiple "context.sync" calls and outside the sequential execution of a ".run" batch, please use the "context.trackedObjects.add()" and "context.trackedObjects.remove()" methods to manage the object\'s lifetime.',InvalidRequestContext:"Cannot use the object across different request contexts.",Timeout:"The operation has timed out.",ValueNotLoaded:'The value of the result object has not been loaded yet. Before reading the value property, call "context.sync()" on the associated request context.'},e}();t.CoreUtility=f;var h=function(){function e(){}return e.setMock=function(t){e.s_isMock=t},e.isMock=function(){return e.s_isMock},e}();t.TestUtility=h},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.CommonResourceStrings=t.CommonUtility=t.CommonConstants=t.HttpRequestExecutor=t.ClientResult=t.ClientRequestBase=t.ClientRequestContextBase=t.ObjectPath=t.Action=t.ClientObjectBase=t.CommonActionFactory=t.config=t._internalConfig=void 0;var a=n(0);s(n(0),t),t._internalConfig={showDisposeInfoInDebugInfo:!1,showInternalApiInDebugInfo:!1,enableEarlyDispose:!0,alwaysPolyfillClientObjectUpdateMethod:!1,alwaysPolyfillClientObjectRetrieveMethod:!1,enableConcurrentFlag:!0,enableUndoableFlag:!0,appendTypeNameToObjectPathInfo:!1},t.config={extendedErrorLogging:!1};var u=function(){function e(){}return e.createSetPropertyAction=function(e,t,n,r,o){_.validateObjectPath(t);var i={Id:e._nextId(),ActionType:4,Name:n,ObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},s=[r],a=_.setMethodArguments(e,i.ArgumentInfo,s);_.validateReferencedObjectPaths(a);var u=new l(i,0,o);return u.referencedObjectPath=t._objectPath,u.referencedArgumentObjectPaths=a,t._addAction(u)},e.createQueryAction=function(e,t,n,r){_.validateObjectPath(t);var o={Id:e._nextId(),ActionType:2,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},i=new l(o,1,4);return i.referencedObjectPath=t._objectPath,t._addAction(i,r)},e.createQueryAsJsonAction=function(e,t,n,r){_.validateObjectPath(t);var o={Id:e._nextId(),ActionType:7,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},i=new l(o,1,4);return i.referencedObjectPath=t._objectPath,t._addAction(i,r)},e.createUpdateAction=function(e,t,n){_.validateObjectPath(t);var r={Id:e._nextId(),ActionType:9,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,ObjectState:n},o=new l(r,0,0);return o.referencedObjectPath=t._objectPath,t._addAction(o)},e}();t.CommonActionFactory=u;var c=function(){function e(e,t){this.m_contextBase=e,this.m_objectPath=t}return Object.defineProperty(e.prototype,"_objectPath",{get:function(){return this.m_objectPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_context",{get:function(){return this.m_contextBase},enumerable:!1,configurable:!0}),e.prototype._addAction=function(e,t){var n=this;return void 0===t&&(t=null),a.CoreUtility.createPromise((function(r,o){n._context._addServiceApiAction(e,t,r,o)}))},e.prototype._retrieve=function(e,n){var r=t._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;r||(r=!_.isSetSupported("RichApiRuntime","1.1"));var o=p._parseQueryOption(e);return r?u.createQueryAction(this._context,this,o,n):u.createQueryAsJsonAction(this._context,this,o,n)},e.prototype._recursivelyUpdate=function(e){var n=t._internalConfig.alwaysPolyfillClientObjectUpdateMethod;n||(n=!_.isSetSupported("RichApiRuntime","1.2"));try{var r=this[b.scalarPropertyNames];r||(r=[]);var o=this[b.scalarPropertyUpdateable];if(!o){o=[];for(var i=0;i<r.length;i++)o.push(!1)}var s=this[b.navigationPropertyNames];s||(s=[]);var c={},l={},d=0;for(var p in e){var f=r.indexOf(p);if(f>=0){if(!o[f])throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(v.attemptingToSetReadOnlyProperty,p),debugInfo:{errorLocation:p}});c[p]=e[p],++d}else{if(!(s.indexOf(p)>=0))throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(v.propertyDoesNotExist,p),debugInfo:{errorLocation:p}});l[p]=e[p]}}if(d>0)if(n)for(i=0;i<r.length;i++){var h=c[p=r[i]];_.isUndefined(h)||u.createSetPropertyAction(this._context,this,p,h)}else u.createUpdateAction(this._context,this,c);for(var p in l){var m=this[p],g=l[p];m._recursivelyUpdate(g)}}catch(e){throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidArgument,"properties"),debugInfo:{errorLocation:this._className+".update"},innerError:e})}},e}();t.ClientObjectBase=c;var l=function(){function e(e,t,n){this.m_actionInfo=e,this.m_operationType=t,this.m_flags=n}return Object.defineProperty(e.prototype,"actionInfo",{get:function(){return this.m_actionInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"operationType",{get:function(){return this.m_operationType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return this.m_flags},enumerable:!1,configurable:!0}),e}();t.Action=l;var d=function(){function e(e,t,n,r,o,i){this.m_objectPathInfo=e,this.m_parentObjectPath=t,this.m_isCollection=n,this.m_isInvalidAfterRequest=r,this.m_isValid=!0,this.m_operationType=o,this.m_flags=i}return Object.defineProperty(e.prototype,"id",{get:function(){var e=this.m_objectPathInfo.ArgumentInfo;if(e){var t=e.Arguments;if(t)return t[0]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var e=this.m_parentObjectPath;if(e)return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentId",{get:function(){return this.parent?this.parent.id:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"objectPathInfo",{get:function(){return this.m_objectPathInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"operationType",{get:function(){return this.m_operationType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return this.m_flags},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCollection",{get:function(){return this.m_isCollection},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInvalidAfterRequest",{get:function(){return this.m_isInvalidAfterRequest},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentObjectPath",{get:function(){return this.m_parentObjectPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"argumentObjectPaths",{get:function(){return this.m_argumentObjectPaths},set:function(e){this.m_argumentObjectPaths=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.m_isValid},set:function(t){this.m_isValid=t,!t&&6===this.m_objectPathInfo.ObjectPathType&&this.m_savedObjectPathInfo&&(e.copyObjectPathInfo(this.m_savedObjectPathInfo.pathInfo,this.m_objectPathInfo),this.m_parentObjectPath=this.m_savedObjectPathInfo.parent,this.m_isValid=!0,this.m_savedObjectPathInfo=null)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalObjectPathInfo",{get:function(){return this.m_originalObjectPathInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getByIdMethodName",{get:function(){return this.m_getByIdMethodName},set:function(e){this.m_getByIdMethodName=e},enumerable:!1,configurable:!0}),e.prototype._updateAsNullObject=function(){this.resetForUpdateUsingObjectData(),this.m_objectPathInfo.ObjectPathType=7,this.m_objectPathInfo.Name="",this.m_parentObjectPath=null},e.prototype.saveOriginalObjectPathInfo=function(){t.config.extendedErrorLogging&&!this.m_originalObjectPathInfo&&(this.m_originalObjectPathInfo={},e.copyObjectPathInfo(this.m_objectPathInfo,this.m_originalObjectPathInfo))},e.prototype.updateUsingObjectData=function(t,n){var r=t[b.referenceId];if(!a.CoreUtility.isNullOrEmptyString(r)){if(!this.m_savedObjectPathInfo&&!this.isInvalidAfterRequest&&e.isRestorableObjectPath(this.m_objectPathInfo.ObjectPathType)){var o={};e.copyObjectPathInfo(this.m_objectPathInfo,o),this.m_savedObjectPathInfo={pathInfo:o,parent:this.m_parentObjectPath}}return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),this.m_objectPathInfo.ObjectPathType=6,this.m_objectPathInfo.Name=r,delete this.m_objectPathInfo.ParentObjectPathId,void(this.m_parentObjectPath=null)}if(n){var i=n[b.collectionPropertyPath];if(!a.CoreUtility.isNullOrEmptyString(i)&&n.context){var s=_.tryGetObjectIdFromLoadOrRetrieveResult(t);if(!a.CoreUtility.isNullOrUndefined(s)){for(var u=i.split("."),c=n.context[u[0]],l=1;l<u.length;l++)c=c[u[l]];return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),this.m_parentObjectPath=c._objectPath,this.m_objectPathInfo.ParentObjectPathId=this.m_parentObjectPath.objectPathInfo.Id,this.m_objectPathInfo.ObjectPathType=5,this.m_objectPathInfo.Name="",void(this.m_objectPathInfo.ArgumentInfo.Arguments=[s])}}}var d=this.parentObjectPath&&this.parentObjectPath.isCollection,p=this.getByIdMethodName;if((d||!a.CoreUtility.isNullOrEmptyString(p))&&(s=_.tryGetObjectIdFromLoadOrRetrieveResult(t),!a.CoreUtility.isNullOrUndefined(s)))return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),a.CoreUtility.isNullOrEmptyString(p)?(this.m_objectPathInfo.ObjectPathType=5,this.m_objectPathInfo.Name=""):(this.m_objectPathInfo.ObjectPathType=3,this.m_objectPathInfo.Name=p),void(this.m_objectPathInfo.ArgumentInfo.Arguments=[s])},e.prototype.resetForUpdateUsingObjectData=function(){this.m_isInvalidAfterRequest=!1,this.m_isValid=!0,this.m_operationType=1,this.m_flags=4,this.m_objectPathInfo.ArgumentInfo={},this.m_argumentObjectPaths=null,this.m_getByIdMethodName=null},e.isRestorableObjectPath=function(e){return 1===e||5===e||3===e||4===e},e.copyObjectPathInfo=function(e,t){t.Id=e.Id,t.ArgumentInfo=e.ArgumentInfo,t.Name=e.Name,t.ObjectPathType=e.ObjectPathType,t.ParentObjectPathId=e.ParentObjectPathId},e}();t.ObjectPath=d;var p=function(){function e(){this.m_nextId=0}return e.prototype._nextId=function(){return++this.m_nextId},e.prototype._addServiceApiAction=function(e,t,n,r){this.m_serviceApiQueue||(this.m_serviceApiQueue=new g(this)),this.m_serviceApiQueue.add(e,t,n,r)},e._parseQueryOption=function(t){var n={};if("string"==typeof t){var r=t;n.Select=_._parseSelectExpand(r)}else if(Array.isArray(t))n.Select=t;else if("object"==typeof t){var o=t;if(e.isLoadOption(o)){if("string"==typeof o.select)n.Select=_._parseSelectExpand(o.select);else if(Array.isArray(o.select))n.Select=o.select;else if(!_.isNullOrUndefined(o.select))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.select"});if("string"==typeof o.expand)n.Expand=_._parseSelectExpand(o.expand);else if(Array.isArray(o.expand))n.Expand=o.expand;else if(!_.isNullOrUndefined(o.expand))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.expand"});if("number"==typeof o.top)n.Top=o.top;else if(!_.isNullOrUndefined(o.top))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.top"});if("number"==typeof o.skip)n.Skip=o.skip;else if(!_.isNullOrUndefined(o.skip))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.skip"})}else n=e.parseStrictLoadOption(t)}else if(!_.isNullOrUndefined(t))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option"});return n},e.isLoadOption=function(e){if(!_.isUndefined(e.select)&&("string"==typeof e.select||Array.isArray(e.select)))return!0;if(!_.isUndefined(e.expand)&&("string"==typeof e.expand||Array.isArray(e.expand)))return!0;if(!_.isUndefined(e.top)&&"number"==typeof e.top)return!0;if(!_.isUndefined(e.skip)&&"number"==typeof e.skip)return!0;for(var t in e)return!1;return!0},e.parseStrictLoadOption=function(t){var n={Select:[]};return e.parseStrictLoadOptionHelper(n,"","option",t),n},e.combineQueryPath=function(e,t,n){return 0===e.length?t:e+n+t},e.parseStrictLoadOptionHelper=function(t,n,r,o){for(var i in o){var s=o[i];if("$all"===i){if("boolean"!=typeof s)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});s&&t.Select.push(e.combineQueryPath(n,"*","/"))}else if("$top"===i){if("number"!=typeof s||n.length>0)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});t.Top=s}else if("$skip"===i){if("number"!=typeof s||n.length>0)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});t.Skip=s}else if("boolean"==typeof s)s&&t.Select.push(e.combineQueryPath(n,i,"/"));else{if("object"!=typeof s)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});e.parseStrictLoadOptionHelper(t,e.combineQueryPath(n,i,"/"),e.combineQueryPath(r,i,"."),s)}}},e}();t.ClientRequestContextBase=p;var f=function(){function e(e){this.m_objectPath=e}return e.prototype._handleResult=function(e){a.CoreUtility.isNullOrUndefined(e)?this.m_objectPath._updateAsNullObject():this.m_objectPath.updateUsingObjectData(e,null)},e}(),h=function(){function e(e){this.m_contextBase=e,this.m_actions=[],this.m_actionResultHandler={},this.m_referencedObjectPaths={},this.m_instantiatedObjectPaths={},this.m_preSyncPromises=[]}return e.prototype.addAction=function(e){this.m_actions.push(e),1==e.actionInfo.ActionType&&(this.m_instantiatedObjectPaths[e.actionInfo.ObjectPathId]=e)},Object.defineProperty(e.prototype,"hasActions",{get:function(){return this.m_actions.length>0},enumerable:!1,configurable:!0}),e.prototype._getLastAction=function(){return this.m_actions[this.m_actions.length-1]},e.prototype.ensureInstantiateObjectPath=function(e){if(e){if(this.m_instantiatedObjectPaths[e.objectPathInfo.Id])return;if(this.ensureInstantiateObjectPath(e.parentObjectPath),this.ensureInstantiateObjectPaths(e.argumentObjectPaths),!this.m_instantiatedObjectPaths[e.objectPathInfo.Id]){var t={Id:this.m_contextBase._nextId(),ActionType:1,Name:"",ObjectPathId:e.objectPathInfo.Id},n=new l(t,1,4);n.referencedObjectPath=e,this.addReferencedObjectPath(e),this.addAction(n);var r=new f(e);this.addActionResultHandler(n,r)}}},e.prototype.ensureInstantiateObjectPaths=function(e){if(e)for(var t=0;t<e.length;t++)this.ensureInstantiateObjectPath(e[t])},e.prototype.addReferencedObjectPath=function(e){if(e&&!this.m_referencedObjectPaths[e.objectPathInfo.Id]){if(!e.isValid)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidObjectPath,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidObjectPath,_.getObjectPathExpression(e)),debugInfo:{errorLocation:_.getObjectPathExpression(e)}});for(;e;)this.m_referencedObjectPaths[e.objectPathInfo.Id]=e,3==e.objectPathInfo.ObjectPathType&&this.addReferencedObjectPaths(e.argumentObjectPaths),e=e.parentObjectPath}},e.prototype.addReferencedObjectPaths=function(e){if(e)for(var t=0;t<e.length;t++)this.addReferencedObjectPath(e[t])},e.prototype.addActionResultHandler=function(e,t){this.m_actionResultHandler[e.actionInfo.Id]=t},e.prototype.aggregrateRequestFlags=function(e,t,n){return 0===t&&(e|=1,0==(2&n)&&(e&=-17),0==(8&n)&&(e&=-257),e&=-5),1&n&&(e|=2),0==(4&n)&&(e&=-5),e},e.prototype.finallyNormalizeFlags=function(e){return 0==(1&e)&&(e&=-17,e&=-257),t._internalConfig.enableConcurrentFlag||(e&=-5),t._internalConfig.enableUndoableFlag||(e&=-17),_.isSetSupported("RichApiRuntimeFlag","1.1")||(e&=-5,e&=-17),_.isSetSupported("RichApiRuntimeFlag","1.2")||(e&=-257),"number"==typeof this.m_flagsForTesting&&(e=this.m_flagsForTesting),e},e.prototype.buildRequestMessageBodyAndRequestFlags=function(){t._internalConfig.enableEarlyDispose&&e._calculateLastUsedObjectPathIds(this.m_actions);var n=276,r={};for(var o in this.m_referencedObjectPaths)n=this.aggregrateRequestFlags(n,this.m_referencedObjectPaths[o].operationType,this.m_referencedObjectPaths[o].flags),r[o]=this.m_referencedObjectPaths[o].objectPathInfo;for(var i=[],s=!1,a=0;a<this.m_actions.length;a++){var u=this.m_actions[a];3===u.actionInfo.ActionType&&u.actionInfo.Name===b.keepReference&&(s=!0),n=this.aggregrateRequestFlags(n,u.operationType,u.flags),i.push(u.actionInfo)}return n=this.finallyNormalizeFlags(n),{body:{AutoKeepReference:this.m_contextBase._autoCleanup&&s,Actions:i,ObjectPaths:r},flags:n}},e.prototype.processResponse=function(e){if(e)for(var t=0;t<e.length;t++){var n=e[t],r=this.m_actionResultHandler[n.ActionId];r&&r._handleResult(n.Value)}},e.prototype.invalidatePendingInvalidObjectPaths=function(){for(var e in this.m_referencedObjectPaths)this.m_referencedObjectPaths[e].isInvalidAfterRequest&&(this.m_referencedObjectPaths[e].isValid=!1)},e.prototype._addPreSyncPromise=function(e){this.m_preSyncPromises.push(e)},Object.defineProperty(e.prototype,"_preSyncPromises",{get:function(){return this.m_preSyncPromises},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_actions",{get:function(){return this.m_actions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_objectPaths",{get:function(){return this.m_referencedObjectPaths},enumerable:!1,configurable:!0}),e.prototype._removeKeepReferenceAction=function(e){for(var t=this.m_actions.length-1;t>=0;t--){var n=this.m_actions[t].actionInfo;if(n.ObjectPathId===e&&3===n.ActionType&&n.Name===b.keepReference){this.m_actions.splice(t,1);break}}},e._updateLastUsedActionIdOfObjectPathId=function(t,n,r){for(;n;){if(t[n.objectPathInfo.Id])return;t[n.objectPathInfo.Id]=r;var o=n.argumentObjectPaths;if(o)for(var i=o.length,s=0;s<i;s++)e._updateLastUsedActionIdOfObjectPathId(t,o[s],r);n=n.parentObjectPath}},e._calculateLastUsedObjectPathIds=function(t){for(var n={},r=t.length,o=r-1;o>=0;--o){var i=(p=t[o]).actionInfo.Id;p.referencedObjectPath&&e._updateLastUsedActionIdOfObjectPathId(n,p.referencedObjectPath,i);var s=p.referencedArgumentObjectPaths;if(s)for(var a=s.length,u=0;u<a;u++)e._updateLastUsedActionIdOfObjectPathId(n,s[u],i)}var c={};for(var l in n){var d=c[i=n[l]];d||(d=[],c[i]=d),d.push(parseInt(l))}for(o=0;o<r;o++){var p,f=c[(p=t[o]).actionInfo.Id];f&&f.length>0?p.actionInfo.L=f:p.actionInfo.L&&delete p.actionInfo.L}},e}();t.ClientRequestBase=h;var m=function(){function e(e){this.m_type=e}return Object.defineProperty(e.prototype,"value",{get:function(){if(!this.m_isLoaded)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.valueNotLoaded,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.valueNotLoaded),debugInfo:{errorLocation:"clientResult.value"}});return this.m_value},enumerable:!1,configurable:!0}),e.prototype._handleResult=function(e){this.m_isLoaded=!0,"object"==typeof e&&e&&e._IsNull||(1===this.m_type?this.m_value=_.adjustToDateTime(e):this.m_value=e)},e}();t.ClientResult=m;var g=function(){function e(e){this.m_context=e,this.m_actions=[]}return e.prototype.add=function(e,t,n,r){var o=this;this.m_actions.push({action:e,resultHandler:t,resolve:n,reject:r}),1===this.m_actions.length&&setTimeout((function(){return o.processActions()}),0)},e.prototype.processActions=function(){var e=this;if(0!==this.m_actions.length){var t=this.m_actions;this.m_actions=[];for(var n=new h(this.m_context),r=0;r<t.length;r++){var o=t[r];n.ensureInstantiateObjectPath(o.action.referencedObjectPath),n.ensureInstantiateObjectPaths(o.action.referencedArgumentObjectPaths),n.addAction(o.action),n.addReferencedObjectPath(o.action.referencedObjectPath),n.addReferencedObjectPaths(o.action.referencedArgumentObjectPaths)}var i=n.buildRequestMessageBodyAndRequestFlags(),s=i.body,u=i.flags,c={Url:a.CoreConstants.localDocumentApiPrefix,Headers:null,Body:s};a.CoreUtility.log("Request:"),a.CoreUtility.log(JSON.stringify(s)),(new y).executeAsync(this.m_context._customData,u,c).then((function(r){e.processResponse(n,t,r)})).catch((function(e){for(var n=0;n<t.length;n++)t[n].reject(e)}))}},e.prototype.processResponse=function(e,t,n){var r=this.getErrorFromResponse(n),o=null;n.Body.Results?o=n.Body.Results:n.Body.ProcessedResults&&n.Body.ProcessedResults.Results&&(o=n.Body.ProcessedResults.Results),o||(o=[]),this.processActionResults(e,t,o,r)},e.prototype.getErrorFromResponse=function(e){return a.CoreUtility.isNullOrEmptyString(e.ErrorCode)?e.Body&&e.Body.Error?new a._Internal.RuntimeError({code:e.Body.Error.Code,httpStatusCode:e.Body.Error.HttpStatusCode,message:e.Body.Error.Message}):null:new a._Internal.RuntimeError({code:e.ErrorCode,httpStatusCode:e.HttpStatusCode,message:e.ErrorMessage})},e.prototype.processActionResults=function(e,t,n,r){e.processResponse(n);for(var o=0;o<t.length;o++){for(var i=t[o],s=i.action.actionInfo.Id,a=!1,u=0;u<n.length;u++)if(s==n[u].ActionId){var c=n[u].Value;i.resultHandler&&(i.resultHandler._handleResult(c),c=i.resultHandler.value),i.resolve&&i.resolve(c),a=!0;break}!a&&i.reject&&(r?i.reject(r):i.reject("No response for the action."))}},e}(),y=function(){function e(){}return e.prototype.getRequestUrl=function(e,t){return"/"!=e.charAt(e.length-1)&&(e+="/"),(e+=a.CoreConstants.processQuery)+"?"+a.CoreConstants.flags+"="+t.toString()},e.prototype.executeAsync=function(t,n,r){var o={method:"POST",url:this.getRequestUrl(r.Url,n),headers:{},body:r.Body};if(o.headers[a.CoreConstants.sourceLibHeader]=e.SourceLibHeaderValue,o.headers["CONTENT-TYPE"]="application/json",r.Headers)for(var i in r.Headers)o.headers[i]=r.Headers[i];return(a.CoreUtility._isLocalDocumentUrl(o.url)?a.HttpUtility.sendLocalDocumentRequest:a.HttpUtility.sendRequest)(o).then((function(e){var t;if(200===e.statusCode)t={HttpStatusCode:e.statusCode,ErrorCode:null,ErrorMessage:null,Headers:e.headers,Body:a.CoreUtility._parseResponseBody(e)};else{a.CoreUtility.log("Error Response:"+e.body);var n=a.CoreUtility._parseErrorResponse(e);t={HttpStatusCode:e.statusCode,ErrorCode:n.errorCode,ErrorMessage:n.errorMessage,Headers:e.headers,Body:null}}return t}))},e.SourceLibHeaderValue="officejs-rest",e}();t.HttpRequestExecutor=y;var b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.collectionPropertyPath="_collectionPropertyPath",t.id="Id",t.idLowerCase="id",t.idPrivate="_Id",t.keepReference="_KeepReference",t.objectPathIdPrivate="_ObjectPathId",t.referenceId="_ReferenceId",t.items="_Items",t.itemsLowerCase="items",t.scalarPropertyNames="_scalarPropertyNames",t.scalarPropertyOriginalNames="_scalarPropertyOriginalNames",t.navigationPropertyNames="_navigationPropertyNames",t.scalarPropertyUpdateable="_scalarPropertyUpdateable",t}(a.CoreConstants);t.CommonConstants=b;var _=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.validateObjectPath=function(e){for(var n=e._objectPath;n;){if(!n.isValid)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidObjectPath,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidObjectPath,t.getObjectPathExpression(n)),debugInfo:{errorLocation:t.getObjectPathExpression(n)}});n=n.parentObjectPath}},t.validateReferencedObjectPaths=function(e){if(e)for(var n=0;n<e.length;n++)for(var r=e[n];r;){if(!r.isValid)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidObjectPath,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidObjectPath,t.getObjectPathExpression(r))});r=r.parentObjectPath}},t._toCamelLowerCase=function(e){if(a.CoreUtility.isNullOrEmptyString(e))return e;for(var t=0;t<e.length&&e.charCodeAt(t)>=65&&e.charCodeAt(t)<=90;)t++;return t<e.length?e.substr(0,t).toLowerCase()+e.substr(t):e.toLowerCase()},t.adjustToDateTime=function(e){if(a.CoreUtility.isNullOrUndefined(e))return null;if("string"==typeof e)return new Date(e);if(Array.isArray(e)){for(var n=e,r=0;r<n.length;r++)n[r]=t.adjustToDateTime(n[r]);return n}throw a.CoreUtility._createInvalidArgError({argumentName:"date"})},t.tryGetObjectIdFromLoadOrRetrieveResult=function(e){var t=e[b.id];return a.CoreUtility.isNullOrUndefined(t)&&(t=e[b.idLowerCase]),a.CoreUtility.isNullOrUndefined(t)&&(t=e[b.idPrivate]),t},t.getObjectPathExpression=function(e){for(var n="";e;){switch(e.objectPathInfo.ObjectPathType){case 1:n=n;break;case 2:n="new()"+(n.length>0?".":"")+n;break;case 3:n=t.normalizeName(e.objectPathInfo.Name)+"()"+(n.length>0?".":"")+n;break;case 4:n=t.normalizeName(e.objectPathInfo.Name)+(n.length>0?".":"")+n;break;case 5:n="getItem()"+(n.length>0?".":"")+n;break;case 6:n="_reference()"+(n.length>0?".":"")+n}e=e.parentObjectPath}return n},t.setMethodArguments=function(e,n,r){if(a.CoreUtility.isNullOrUndefined(r))return null;var o=new Array,i=new Array,s=t.collectObjectPathInfos(e,r,o,i);return n.Arguments=r,s&&(n.ReferencedObjectPathIds=i),o},t.validateContext=function(e,t){if(e&&t&&t._context!==e)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidRequestContext,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidRequestContext)})},t.isSetSupported=function(e,t){return!("undefined"!=typeof window&&window.Office&&window.Office.context&&window.Office.context.requirements)||window.Office.context.requirements.isSetSupported(e,t)},t.throwIfApiNotSupported=function(e,n,r,o){if(t._doApiNotSupportedCheck&&!t.isSetSupported(n,r)){var i=a.CoreUtility._getResourceString(a.CoreResourceStrings.apiNotFoundDetails,[e,n+" "+r,o]);throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.apiNotFound,httpStatusCode:404,message:i,debugInfo:{errorLocation:e}})}},t.calculateApiFlags=function(e,n,r){return t.isSetSupported(n,r)||(e&=-3),e},t._parseSelectExpand=function(e){var t=[];if(!a.CoreUtility.isNullOrEmptyString(e))for(var n=e.split(","),r=0;r<n.length;r++){var o=n[r];(o=i(o.trim())).length>0&&t.push(o)}return t;function i(e){var t=e.toLowerCase();return"items"===t||"items/"===t?"*":(("items/"===t.substr(0,6)||"items."===t.substr(0,6))&&(e=e.substr(6)),e.replace(new RegExp("[/.]items[/.]","gi"),"/"))}},t.changePropertyNameToCamelLowerCase=function(e){if(Array.isArray(e)){for(var n=[],r=0;r<e.length;r++)n.push(this.changePropertyNameToCamelLowerCase(e[r]));return n}if("object"==typeof e&&null!==e){for(var o in n={},e){var i=e[o];if(o===b.items){(n={})[b.itemsLowerCase]=this.changePropertyNameToCamelLowerCase(i);break}n[t._toCamelLowerCase(o)]=this.changePropertyNameToCamelLowerCase(i)}return n}return e},t.purifyJson=function(e){if(Array.isArray(e)){for(var t=[],n=0;n<e.length;n++)t.push(this.purifyJson(e[n]));return t}if("object"==typeof e&&null!==e){for(var r in t={},e)if(95!==r.charCodeAt(0)){var o=e[r];"object"==typeof o&&null!==o&&Array.isArray(o.items)&&(o=o.items),t[r]=this.purifyJson(o)}return t}return e},t.collectObjectPathInfos=function(e,n,r,o){for(var i=!1,s=0;s<n.length;s++)if(n[s]instanceof c){var u=n[s];t.validateContext(e,u),n[s]=u._objectPath.objectPathInfo.Id,o.push(u._objectPath.objectPathInfo.Id),r.push(u._objectPath),i=!0}else if(Array.isArray(n[s])){var l=new Array;t.collectObjectPathInfos(e,n[s],r,l)?(o.push(l),i=!0):o.push(0)}else a.CoreUtility.isPlainJsonObject(n[s])?(o.push(0),t.replaceClientObjectPropertiesWithObjectPathIds(n[s],r)):o.push(0);return i},t.replaceClientObjectPropertiesWithObjectPathIds=function(e,n){var r,o;for(var i in e){var s=e[i];if(s instanceof c)n.push(s._objectPath),e[i]=((r={})[b.objectPathIdPrivate]=s._objectPath.objectPathInfo.Id,r);else if(Array.isArray(s))for(var u=0;u<s.length;u++)if(s[u]instanceof c){var l=s[u];n.push(l._objectPath),s[u]=((o={})[b.objectPathIdPrivate]=l._objectPath.objectPathInfo.Id,o)}else a.CoreUtility.isPlainJsonObject(s[u])&&t.replaceClientObjectPropertiesWithObjectPathIds(s[u],n);else a.CoreUtility.isPlainJsonObject(s)&&t.replaceClientObjectPropertiesWithObjectPathIds(s,n)}},t.normalizeName=function(e){return e.substr(0,1).toLowerCase()+e.substr(1)},t._doApiNotSupportedCheck=!1,t}(a.CoreUtility);t.CommonUtility=_;var v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyDoesNotExist="PropertyDoesNotExist",t.attemptingToSetReadOnlyProperty="AttemptingToSetReadOnlyProperty",t}(a.CoreResourceStrings);t.CommonResourceStrings=v},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LibraryBuilder=t.BatchApiHelper=t._internalConfig=t.WebImage=t.Utility=t.SessionBase=t.ResourceStrings=t.Provider=t.HttpUtility=t.GenericEventHandlers=t.FormattedNumber=t.EventHandlers=t.ErrorCodes=t.Error=t.Entity=t.CoreUtility=t.Constants=t.config=t.CommonUtility=t.ClientObject=t.ClientResult=t.ClientRequestContext=t.Attribution=void 0;var r=n(0);Object.defineProperty(t,"Attribution",{enumerable:!0,get:function(){return r.Attribution}}),Object.defineProperty(t,"CoreUtility",{enumerable:!0,get:function(){return r.CoreUtility}}),Object.defineProperty(t,"Entity",{enumerable:!0,get:function(){return r.Entity}}),Object.defineProperty(t,"Error",{enumerable:!0,get:function(){return r.Error}}),Object.defineProperty(t,"FormattedNumber",{enumerable:!0,get:function(){return r.FormattedNumber}}),Object.defineProperty(t,"HttpUtility",{enumerable:!0,get:function(){return r.HttpUtility}}),Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return r.Provider}}),Object.defineProperty(t,"SessionBase",{enumerable:!0,get:function(){return r.SessionBase}}),Object.defineProperty(t,"WebImage",{enumerable:!0,get:function(){return r.WebImage}});var o=n(1);Object.defineProperty(t,"CommonUtility",{enumerable:!0,get:function(){return o.CommonUtility}}),Object.defineProperty(t,"ClientResult",{enumerable:!0,get:function(){return o.ClientResult}});var i=n(4);Object.defineProperty(t,"ClientRequestContext",{enumerable:!0,get:function(){return i.ClientRequestContext}}),Object.defineProperty(t,"ClientObject",{enumerable:!0,get:function(){return i.ClientObject}}),Object.defineProperty(t,"config",{enumerable:!0,get:function(){return i.config}}),Object.defineProperty(t,"Constants",{enumerable:!0,get:function(){return i.Constants}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return i.ErrorCodes}}),Object.defineProperty(t,"EventHandlers",{enumerable:!0,get:function(){return i.EventHandlers}}),Object.defineProperty(t,"GenericEventHandlers",{enumerable:!0,get:function(){return i.GenericEventHandlers}}),Object.defineProperty(t,"ResourceStrings",{enumerable:!0,get:function(){return i.ResourceStrings}}),Object.defineProperty(t,"Utility",{enumerable:!0,get:function(){return i.Utility}}),Object.defineProperty(t,"_internalConfig",{enumerable:!0,get:function(){return i._internalConfig}});var s=function(){function e(){}return e.invokeMethod=function(e,t,n,r,s,a){var u=i.ActionFactory.createMethodAction(e.context,e,t,n,r,s),c=new o.ClientResult(a);return i.Utility._addActionResultHandler(e,u,c),c},e.invokeEnsureUnchanged=function(e,t){i.ActionFactory.createEnsureUnchangedAction(e.context,e,t)},e.invokeSetProperty=function(e,t,n,r){i.ActionFactory.createSetPropertyAction(e.context,e,t,n,r)},e.createRootServiceObject=function(e,t){return new e(t,i.ObjectPathFactory.createGlobalObjectObjectPath(t))},e.createObjectFromReferenceId=function(e,t,n){return new e(t,i.ObjectPathFactory.createReferenceIdObjectPath(t,n))},e.createTopLevelServiceObject=function(e,t,n,r,o){return new e(t,i.ObjectPathFactory.createNewObjectObjectPath(t,n,r,o))},e.createPropertyObject=function(e,t,n,r,o){var s=i.ObjectPathFactory.createPropertyObjectPath(t.context,t,n,r,!1,o);return new e(t.context,s)},e.createIndexerObject=function(e,t,n){var r=i.ObjectPathFactory.createIndexerObjectPath(t.context,t,n);return new e(t.context,r)},e.createMethodObject=function(e,t,n,r,o,s,a,u,c){var l=i.ObjectPathFactory.createMethodObjectPath(t.context,t,n,r,o,s,a,u,c);return new e(t.context,l)},e.createChildItemObject=function(e,t,n,r,o){var s=i.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt(t,n.context,n,r,o);return new e(n.context,s)},e}();t.BatchApiHelper=s;var a=function(){function e(e){if(this.m_namespaceMap={},this.m_namespace=e.metadata.name,this.m_targetNamespaceObject=e.targetNamespaceObject,this.m_namespaceMap[this.m_namespace]=e.targetNamespaceObject,e.namespaceMap)for(var t in e.namespaceMap)this.m_namespaceMap[t]=e.namespaceMap[t];this.m_defaultApiSetName=e.metadata.defaultApiSetName,this.m_hostName=e.metadata.hostName;var n=e.metadata;if(n.enumTypes)for(var r=0;r<n.enumTypes.length;r++)this.buildEnumType(n.enumTypes[r]);if(n.apiSets){for(r=0;r<n.apiSets.length;r++){var o=n.apiSets[r];Array.isArray(o)&&(n.apiSets[r]={version:o[0],name:o[1]||this.m_defaultApiSetName})}this.m_apiSets=n.apiSets}if(this.m_strings=n.strings,n.clientObjectTypes)for(r=0;r<n.clientObjectTypes.length;r++)o=n.clientObjectTypes[r],Array.isArray(o)&&(this.ensureArraySize(o,11),n.clientObjectTypes[r]={name:this.getString(o[0]),behaviorFlags:o[1],collectionPropertyPath:this.getString(o[6]),newObjectServerTypeFullName:this.getString(o[9]),newObjectApiFlags:o[10],childItemTypeFullName:this.getString(o[7]),scalarProperties:o[2],navigationProperties:o[3],scalarMethods:o[4],navigationMethods:o[5],events:o[8]}),this.buildClientObjectType(n.clientObjectTypes[r],e.fullyInitialize)}return e.prototype.ensureArraySize=function(e,t){for(var n=t-e.length;n>0;)e.push(0),n--},e.prototype.getString=function(e){return"number"==typeof e?e>0?this.m_strings[e-1]:null:e},e.prototype.buildEnumType=function(e){var t;if(Array.isArray(e)){(t={name:e[0],fields:e[2]}).fields||(t.fields={});var n=e[1];if(Array.isArray(n))for(var r=0;r<n.length;r++)t.fields[n[r]]=this.toSimpleCamelUpperCase(n[r])}else t=e;this.m_targetNamespaceObject[t.name]=t.fields},e.prototype.buildClientObjectType=function(t,n){var r=this,o=function(e,n){i.ClientObject.apply(this,arguments),r.m_targetNamespaceObject[t.name]._typeInited||(r.buildPrototype(r.m_targetNamespaceObject[t.name],t),r.m_targetNamespaceObject[t.name]._typeInited=!0),i._internalConfig.appendTypeNameToObjectPathInfo&&this._objectPath&&this._objectPath.objectPathInfo&&this._className&&(this._objectPath.objectPathInfo.T=this._className)};this.m_targetNamespaceObject[t.name]=o,this.extendsType(o,i.ClientObject),this.buildNewObject(o,t),0!=(2&t.behaviorFlags)&&(o.prototype._KeepReference=function(){s.invokeMethod(this,"_KeepReference",1,[],0,0)}),0!=(32&t.behaviorFlags)&&this.getFunction(e.CustomizationCodeNamespace+"."+t.name+"_StaticCustomize").call(null,o),n&&(this.buildPrototype(o,t),o._typeInited=!0)},e.prototype.extendsType=function(e,t){function n(){this.constructor=e}e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},e.prototype.findObjectUnderPath=function(e,t,n){for(var o=e,i=n;i<t.length;i++){if("object"!=typeof o)throw new r.Error("Cannot find "+t.join("."));o=o[t[i]]}return o},e.prototype.getFunction=function(e){var t=this.resolveObjectByFullName(e);if("function"!=typeof t)throw new r.Error("Cannot find function or type: "+e);return t},e.prototype.resolveObjectByFullName=function(e){var t=e.split(".");if(1===t.length)return this.m_targetNamespaceObject[t[0]];var n=t[0];return n===this.m_namespace?this.findObjectUnderPath(this.m_targetNamespaceObject,t,1):this.m_namespaceMap[n]?this.findObjectUnderPath(this.m_namespaceMap[n],t,1):this.findObjectUnderPath(this.m_targetNamespaceObject,t,0)},e.prototype.evaluateSimpleExpression=function(e,t){if(i.Utility.isNullOrUndefined(e))return null;var n=e.split(".");if(3===n.length&&"OfficeExtension"===n[0]&&"Constants"===n[1])return i.Constants[n[2]];if("this"===n[0]){for(var o=t,s=1;s<n.length;s++)o="toString()"==n[s]?o.toString():"()"===n[s].substr(n[s].length-2)?o[n[s].substr(0,n[s].length-2)]():o[n[s]];return o}throw new r.Error("Cannot evaluate: "+e)},e.prototype.evaluateEventTargetId=function(e,t){return i.Utility.isNullOrEmptyString(e)?"":this.evaluateSimpleExpression(e,t)},e.prototype.isAllDigits=function(e){for(var t="0".charCodeAt(0),n="9".charCodeAt(0),r=0;r<e.length;r++)if(e.charCodeAt(r)<t||e.charCodeAt(r)>n)return!1;return!0},e.prototype.evaluateEventType=function(e){if(i.Utility.isNullOrEmptyString(e))return 0;if(this.isAllDigits(e))return parseInt(e);var t=this.resolveObjectByFullName(e);if("number"!=typeof t)throw new r.Error("Invalid event type: "+e);return t},e.prototype.buildPrototype=function(e,t){this.buildScalarProperties(e,t),this.buildNavigationProperties(e,t),this.buildScalarMethods(e,t),this.buildNavigationMethods(e,t),this.buildEvents(e,t),this.buildHandleResult(e,t),this.buildHandleIdResult(e,t),this.buildHandleRetrieveResult(e,t),this.buildLoad(e,t),this.buildRetrieve(e,t),this.buildSetMockData(e,t),this.buildEnsureUnchanged(e,t),this.buildUpdate(e,t),this.buildSet(e,t),this.buildToJSON(e,t),this.buildItems(e,t),this.buildTypeMetadataInfo(e,t),this.buildTrackUntrack(e,t),this.buildMixin(e,t)},e.prototype.toSimpleCamelUpperCase=function(e){return e.substr(0,1).toUpperCase()+e.substr(1)},e.prototype.ensureOriginalName=function(e){null===e.originalName&&(e.originalName=this.toSimpleCamelUpperCase(e.name))},e.prototype.getFieldName=function(e){return"m_"+e.name},e.prototype.throwIfApiNotSupported=function(e,t){if(this.m_apiSets&&t.apiSetInfoOrdinal>0){var n=this.m_apiSets[t.apiSetInfoOrdinal-1];n&&i.Utility.throwIfApiNotSupported(e.name+"."+t.name,n.name,n.version,this.m_hostName)}},e.prototype.buildScalarProperties=function(e,t){if(Array.isArray(t.scalarProperties))for(var n=0;n<t.scalarProperties.length;n++){var r=t.scalarProperties[n];Array.isArray(r)&&(this.ensureArraySize(r,6),t.scalarProperties[n]={name:this.getString(r[0]),behaviorFlags:r[1],apiSetInfoOrdinal:r[2],originalName:this.getString(r[3]),setMethodApiFlags:r[4],undoableApiSetInfoOrdinal:r[5]}),this.buildScalarProperty(e,t,t.scalarProperties[n])}},e.prototype.calculateApiFlags=function(e,t){if(t>0){var n=this.m_apiSets[t-1];n&&(e=o.CommonUtility.calculateApiFlags(e,n.name,n.version))}return e},e.prototype.buildScalarProperty=function(t,n,r){this.ensureOriginalName(r);var o=this,a=this.getFieldName(r),u={get:function(){return i.Utility.throwIfNotLoaded(r.name,this[a],n.name,this._isNull),o.throwIfApiNotSupported(n,r),this[a]},enumerable:!0,configurable:!0};0==(2&r.behaviorFlags)&&(u.set=function(t){if(!(4&r.behaviorFlags&&o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName+"_Set").call(this,this,t).handled)){this[a]=t;var i=o.calculateApiFlags(r.setMethodApiFlags,r.undoableApiSetInfoOrdinal);s.invokeSetProperty(this,r.originalName,t,i)}}),Object.defineProperty(t.prototype,r.name,u)},e.prototype.buildNavigationProperties=function(e,t){if(Array.isArray(t.navigationProperties))for(var n=0;n<t.navigationProperties.length;n++){var r=t.navigationProperties[n];Array.isArray(r)&&(this.ensureArraySize(r,8),t.navigationProperties[n]={name:this.getString(r[0]),behaviorFlags:r[2],apiSetInfoOrdinal:r[3],originalName:this.getString(r[4]),getMethodApiFlags:r[5],setMethodApiFlags:r[6],propertyTypeFullName:this.getString(r[1]),undoableApiSetInfoOrdinal:r[7]}),this.buildNavigationProperty(e,t,t.navigationProperties[n])}},e.prototype.buildNavigationProperty=function(t,n,r){this.ensureOriginalName(r);var o=this,i=this.getFieldName(r),a={get:function(){return this[o.getFieldName(r)]||(o.throwIfApiNotSupported(n,r),this[i]=s.createPropertyObject(o.getFunction(r.propertyTypeFullName),this,r.originalName,0!=(16&r.behaviorFlags),r.getMethodApiFlags)),64&r.behaviorFlags&&o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName+"_Get").call(this,this,this[i]),this[i]},enumerable:!0,configurable:!0};0==(2&r.behaviorFlags)&&(a.set=function(t){if(!(4&r.behaviorFlags&&o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName+"_Set").call(this,this,t).handled)){this[i]=t;var a=o.calculateApiFlags(r.setMethodApiFlags,r.undoableApiSetInfoOrdinal);s.invokeSetProperty(this,r.originalName,t,a)}}),Object.defineProperty(t.prototype,r.name,a)},e.prototype.buildScalarMethods=function(e,t){if(Array.isArray(t.scalarMethods))for(var n=0;n<t.scalarMethods.length;n++){var r=t.scalarMethods[n];Array.isArray(r)&&(this.ensureArraySize(r,7),t.scalarMethods[n]={name:this.getString(r[0]),behaviorFlags:r[2],apiSetInfoOrdinal:r[3],originalName:this.getString(r[5]),apiFlags:r[4],parameterCount:r[1],undoableApiSetInfoOrdinal:r[6]}),this.buildScalarMethod(e,t,t.scalarMethods[n])}},e.prototype.buildScalarMethod=function(t,n,r){this.ensureOriginalName(r);var o=this;t.prototype[r.name]=function(){var t=[];if(64&r.behaviorFlags&&r.parameterCount>0){for(var i=0;i<r.parameterCount-1;i++)t.push(arguments[i]);var a=[];for(i=r.parameterCount-1;i<arguments.length;i++)a.push(arguments[i]);t.push(a)}else for(i=0;i<arguments.length;i++)t.push(arguments[i]);if(1&r.behaviorFlags){var u=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName),c=[this];for(i=0;i<t.length;i++)c.push(t[i]);var l=u.apply(this,c),d=l.handled,p=l.result;if(d)return p}o.throwIfApiNotSupported(n,r);var f=0;32&r.behaviorFlags&&(f=1);var h=0;2&r.behaviorFlags&&(h=1);var m=o.calculateApiFlags(r.apiFlags,r.undoableApiSetInfoOrdinal);return s.invokeMethod(this,r.originalName,h,t,m,f)}},e.prototype.buildNavigationMethods=function(e,t){if(Array.isArray(t.navigationMethods))for(var n=0;n<t.navigationMethods.length;n++){var r=t.navigationMethods[n];Array.isArray(r)&&(this.ensureArraySize(r,9),t.navigationMethods[n]={name:this.getString(r[0]),behaviorFlags:r[3],apiSetInfoOrdinal:r[4],originalName:this.getString(r[6]),apiFlags:r[5],parameterCount:r[2],returnTypeFullName:this.getString(r[1]),returnObjectGetByIdMethodName:this.getString(r[7]),undoableApiSetInfoOrdinal:r[8]}),this.buildNavigationMethod(e,t,t.navigationMethods[n])}},e.prototype.buildNavigationMethod=function(t,n,r){this.ensureOriginalName(r);var o=this;t.prototype[r.name]=function(){var t=[];if(64&r.behaviorFlags&&r.parameterCount>0){for(var i=0;i<r.parameterCount-1;i++)t.push(arguments[i]);var a=[];for(i=r.parameterCount-1;i<arguments.length;i++)a.push(arguments[i]);t.push(a)}else for(i=0;i<arguments.length;i++)t.push(arguments[i]);if(1&r.behaviorFlags){var u=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName),c=[this];for(i=0;i<t.length;i++)c.push(t[i]);var l=u.apply(this,c),d=l.handled,p=l.result;if(d)return p}if(o.throwIfApiNotSupported(n,r),0!=(16&r.behaviorFlags))return s.createIndexerObject(o.getFunction(r.returnTypeFullName),this,t);var f=0;2&r.behaviorFlags&&(f=1);var h=o.calculateApiFlags(r.apiFlags,r.undoableApiSetInfoOrdinal);return s.createMethodObject(o.getFunction(r.returnTypeFullName),this,r.originalName,f,t,0!=(4&r.behaviorFlags),0!=(8&r.behaviorFlags),r.returnObjectGetByIdMethodName,h)}},e.prototype.buildHandleResult=function(t,n){var r=this;t.prototype._handleResult=function(t){if(i.ClientObject.prototype._handleResult.call(this,t),!i.Utility.isNullOrUndefined(t)){if(i.Utility.fixObjectPathIfNecessary(this,t),8&n.behaviorFlags&&r.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_HandleResult").call(this,this,t),n.scalarProperties)for(var o=0;o<n.scalarProperties.length;o++)i.Utility.isUndefined(t[n.scalarProperties[o].originalName])||(0!=(8&n.scalarProperties[o].behaviorFlags)?this[r.getFieldName(n.scalarProperties[o])]=i.Utility.adjustToDateTime(t[n.scalarProperties[o].originalName]):this[r.getFieldName(n.scalarProperties[o])]=t[n.scalarProperties[o].originalName]);if(n.navigationProperties){for(var a=[],u=0;u<n.navigationProperties.length;u++)a.push(n.navigationProperties[u].name),a.push(n.navigationProperties[u].originalName);i.Utility._handleNavigationPropertyResults(this,t,a)}if(0!=(1&n.behaviorFlags)){var c=r.hasIndexMethod(n);if(!i.Utility.isNullOrUndefined(t[i.Constants.items])){this.m__items=[];for(var l=t[i.Constants.items],d=r.getFunction(n.childItemTypeFullName),p=0;p<l.length;p++){var f=s.createChildItemObject(d,c,this,l[p],p);f._handleResult(l[p]),this.m__items.push(f)}}}}}},e.prototype.buildHandleRetrieveResult=function(e,t){var n=this;e.prototype._handleRetrieveResult=function(e,r){if(i.ClientObject.prototype._handleRetrieveResult.call(this,e,r),!i.Utility.isNullOrUndefined(e)){if(t.scalarProperties)for(var o=0;o<t.scalarProperties.length;o++)8&t.scalarProperties[o].behaviorFlags&&(i.Utility.isNullOrUndefined(e[t.scalarProperties[o].name])||(e[t.scalarProperties[o].name]=i.Utility.adjustToDateTime(e[t.scalarProperties[o].name])));if(1&t.behaviorFlags){var a=n.hasIndexMethod(t),u=n.getFunction(t.childItemTypeFullName),c=this;i.Utility.processRetrieveResult(c,e,r,(function(e,t){return s.createChildItemObject(u,a,c,e,t)}))}else i.Utility.processRetrieveResult(this,e,r)}}},e.prototype.buildHandleIdResult=function(t,n){var r=this;t.prototype._handleIdResult=function(t){if(i.ClientObject.prototype._handleIdResult.call(this,t),!i.Utility.isNullOrUndefined(t)&&(16&n.behaviorFlags&&r.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_HandleIdResult").call(this,this,t),n.scalarProperties))for(var o=0;o<n.scalarProperties.length;o++){var s=n.scalarProperties[o].originalName;"Id"!==s&&"_Id"!==s&&"_ReferenceId"!==s||i.Utility.isNullOrUndefined(t[n.scalarProperties[o].originalName])||(this[r.getFieldName(n.scalarProperties[o])]=t[n.scalarProperties[o].originalName])}}},e.prototype.buildLoad=function(e,t){e.prototype.load=function(e){return i.Utility.load(this,e)}},e.prototype.buildRetrieve=function(e,t){e.prototype.retrieve=function(e){return i.Utility.retrieve(this,e)}},e.prototype.buildNewObject=function(e,t){i.Utility.isNullOrEmptyString(t.newObjectServerTypeFullName)||(e.newObject=function(n){return s.createTopLevelServiceObject(e,n,t.newObjectServerTypeFullName,0!=(1&t.behaviorFlags),t.newObjectApiFlags)})},e.prototype.buildSetMockData=function(e,t){var n=this;if(1&t.behaviorFlags){var r=n.hasIndexMethod(t);e.prototype.setMockData=function(e){var o=this;i.Utility.setMockData(o,e,(function(e,i){return s.createChildItemObject(n.getFunction(t.childItemTypeFullName),r,o,e,i)}),(function(e){o.m__items=e}))}}else e.prototype.setMockData=function(e){i.Utility.setMockData(this,e)}},e.prototype.buildEnsureUnchanged=function(e,t){e.prototype.ensureUnchanged=function(e){s.invokeEnsureUnchanged(this,e)}},e.prototype.buildUpdate=function(e,t){e.prototype.update=function(e){this._recursivelyUpdate(e)}},e.prototype.buildSet=function(e,t){if(0==(1&t.behaviorFlags)){var n=[],r=[];if(t.scalarProperties)for(var o=0;o<t.scalarProperties.length;o++)0==(2&t.scalarProperties[o].behaviorFlags)&&0!=(1&t.scalarProperties[o].behaviorFlags)?r.push(t.scalarProperties[o].name):n.push(t.scalarProperties[o].name);var i=[];if(t.navigationProperties)for(o=0;o<t.navigationProperties.length;o++)0!=(16&t.navigationProperties[o].behaviorFlags)||0==(1&t.navigationProperties[o].behaviorFlags)||0==(32&t.navigationProperties[o].behaviorFlags)?n.push(t.navigationProperties[o].name):i.push(t.navigationProperties[o].name);0===i.length&&0===r.length||(e.prototype.set=function(e,t){this._recursivelySet(e,t,r,i,n)})}},e.prototype.buildItems=function(e,t){0!=(1&t.behaviorFlags)&&Object.defineProperty(e.prototype,"items",{get:function(){return i.Utility.throwIfNotLoaded("items",this.m__items,t.name,this._isNull),this.m__items},enumerable:!0,configurable:!0})},e.prototype.buildToJSON=function(e,t){var n=this;0==(1&t.behaviorFlags)?e.prototype.toJSON=function(){var e={};if(t.scalarProperties)for(var r=0;r<t.scalarProperties.length;r++)0!=(1&t.scalarProperties[r].behaviorFlags)&&(e[t.scalarProperties[r].name]=this[n.getFieldName(t.scalarProperties[r])]);var o={};if(t.navigationProperties)for(r=0;r<t.navigationProperties.length;r++)0!=(1&t.navigationProperties[r].behaviorFlags)&&(o[t.navigationProperties[r].name]=this[n.getFieldName(t.navigationProperties[r])]);return i.Utility.toJson(this,e,o)}:e.prototype.toJSON=function(){return i.Utility.toJson(this,{},{},this.m__items)}},e.prototype.buildTypeMetadataInfo=function(e,t){Object.defineProperty(e.prototype,"_className",{get:function(){return t.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_isCollection",{get:function(){return 0!=(1&t.behaviorFlags)},enumerable:!0,configurable:!0}),i.Utility.isNullOrEmptyString(t.collectionPropertyPath)||Object.defineProperty(e.prototype,"_collectionPropertyPath",{get:function(){return t.collectionPropertyPath},enumerable:!0,configurable:!0}),t.scalarProperties&&t.scalarProperties.length>0&&(Object.defineProperty(e.prototype,"_scalarPropertyNames",{get:function(){return this.m__scalarPropertyNames||(this.m__scalarPropertyNames=t.scalarProperties.map((function(e){return e.name}))),this.m__scalarPropertyNames},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_scalarPropertyOriginalNames",{get:function(){return this.m__scalarPropertyOriginalNames||(this.m__scalarPropertyOriginalNames=t.scalarProperties.map((function(e){return e.originalName}))),this.m__scalarPropertyOriginalNames},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_scalarPropertyUpdateable",{get:function(){return this.m__scalarPropertyUpdateable||(this.m__scalarPropertyUpdateable=t.scalarProperties.map((function(e){return 0==(2&e.behaviorFlags)}))),this.m__scalarPropertyUpdateable},enumerable:!0,configurable:!0})),t.navigationProperties&&t.navigationProperties.length>0&&Object.defineProperty(e.prototype,"_navigationPropertyNames",{get:function(){return this.m__navigationPropertyNames||(this.m__navigationPropertyNames=t.navigationProperties.map((function(e){return e.name}))),this.m__navigationPropertyNames},enumerable:!0,configurable:!0})},e.prototype.buildTrackUntrack=function(e,t){2&t.behaviorFlags&&(e.prototype.track=function(){return this.context.trackedObjects.add(this),this},e.prototype.untrack=function(){return this.context.trackedObjects.remove(this),this})},e.prototype.buildMixin=function(e,t){if(4&t.behaviorFlags){var n=this.getFunction(t.name+"Custom");i.Utility.applyMixin(e,n)}},e.prototype.getOnEventName=function(e){return"_"===e[0]?"_on"+e.substr(1):"on"+e},e.prototype.buildEvents=function(e,t){if(t.events)for(var n=0;n<t.events.length;n++){var r=t.events[n];Array.isArray(r)&&(this.ensureArraySize(r,7),t.events[n]={name:this.getString(r[0]),behaviorFlags:r[1],apiSetInfoOrdinal:r[2],typeExpression:this.getString(r[3]),targetIdExpression:this.getString(r[4]),register:this.getString(r[5]),unregister:this.getString(r[6])}),this.buildEvent(e,t,t.events[n])}},e.prototype.buildEvent=function(e,t,n){1&n.behaviorFlags?this.buildV0Event(e,t,n):this.buildV2Event(e,t,n)},e.prototype.buildV2Event=function(t,n,r){var o=this,s=this.getOnEventName(r.name),a=this.getFieldName(r);Object.defineProperty(t.prototype,s,{get:function(){if(!this[a]){o.throwIfApiNotSupported(n,r);var t=this,s=null;"null"!==r.register&&(s=this[r.register].bind(this));var u=null;"null"!==r.unregister&&(u=this[r.unregister].bind(this));var c=null;2&r.behaviorFlags&&(c=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.name+"_EventArgsTransform"));var l=o.evaluateEventType(r.typeExpression);this[a]=new i.GenericEventHandlers(this.context,this,r.name,{eventType:l,getTargetIdFunc:function(){return o.evaluateEventTargetId(r.targetIdExpression,t)},registerFunc:s,unregisterFunc:u,eventArgsTransformFunc:function(e){return c&&(e=c.call(t,t,e)),i.Utility._createPromiseFromResult(e)}})}return this[a]},enumerable:!0,configurable:!0})},e.prototype.buildV0Event=function(t,n,r){var o=this,s=this.getOnEventName(r.name),a=this.getFieldName(r);Object.defineProperty(t.prototype,s,{get:function(){if(!this[a]){o.throwIfApiNotSupported(n,r);var t=this,s=null;if(i.Utility.isNullOrEmptyString(r.register)){var u=o.evaluateEventType(r.typeExpression);s=function(e){var n=o.evaluateEventTargetId(r.targetIdExpression,t);return t.context.eventRegistration.register(u,n,e)}}else if("null"!==r.register){var c=o.getFunction(r.register);s=function(e){return c.call(t,t,e)}}var l=null;if(i.Utility.isNullOrEmptyString(r.unregister)){var d=o.evaluateEventType(r.typeExpression);l=function(e){var n=o.evaluateEventTargetId(r.targetIdExpression,t);return t.context.eventRegistration.unregister(d,n,e)}}else if("null"!==r.unregister){var p=o.getFunction(r.unregister);l=function(e){return p.call(t,t,e)}}var f=null;2&r.behaviorFlags&&(f=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.name+"_EventArgsTransform")),this[a]=new i.EventHandlers(this.context,this,r.name,{registerFunc:s,unregisterFunc:l,eventArgsTransformFunc:function(e){return f&&(e=f.call(t,t,e)),i.Utility._createPromiseFromResult(e)}})}return this[a]},enumerable:!0,configurable:!0})},e.prototype.hasIndexMethod=function(e){var t=!1;if(e.navigationMethods)for(var n=0;n<e.navigationMethods.length;n++)if(0!=(16&e.navigationMethods[n].behaviorFlags)){t=!0;break}return t},e.CustomizationCodeNamespace="_CC",e}();t.LibraryBuilder=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);n(5),n(6),window.OfficeExtensionBatch=r,"undefined"==typeof CustomFunctionMappings&&(window.CustomFunctionMappings={}),"undefined"==typeof Promise&&(window.Promise=Office.Promise),window.OfficeExtension={Promise:Promise,Error:r.Error,ErrorCodes:r.ErrorCodes,FormattedNumber:r.FormattedNumber,Entity:r.Entity,WebImage:r.WebImage,Attribution:r.Attribution,Provider:r.Provider},n(7).default(!0)},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Utility=t.ResourceStrings=t.TrackedObjects=t.ObjectPathFactory=t.GenericEventHandlers=t._testTriggerRichApiMessageEvent=t._testSetRichApiMessageReadyImpl=t.GenericEventRegistration=t.EventRegistration=t._Internal=t.EventHandlerResult=t.EventHandlers=t.ClientRequest=t.Constants=t.ClientRequestContext=t.HostBridgeSession=t.ClientObject=t.ActionFactory=t.ErrorCodes=void 0;var a=n(0),u=n(1);s(n(1),t);var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyNotLoaded="PropertyNotLoaded",t.runMustReturnPromise="RunMustReturnPromise",t.cannotRegisterEvent="CannotRegisterEvent",t.invalidOrTimedOutSession="InvalidOrTimedOutSession",t.cannotUpdateReadOnlyProperty="CannotUpdateReadOnlyProperty",t}(a.CoreErrorCodes);t.ErrorCodes=c;var l=function(){function e(e){this.m_callback=e}return e.prototype._handleResult=function(e){this.m_callback&&this.m_callback()},e}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.createMethodAction=function(e,t,n,r,o,i){N.validateObjectPath(t);var s={Id:e._nextId(),ActionType:3,Name:n,ObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},a=N.setMethodArguments(e,s.ArgumentInfo,o);N.validateReferencedObjectPaths(a);var c=new u.Action(s,r,N._fixupApiFlags(i));return c.referencedObjectPath=t._objectPath,c.referencedArgumentObjectPaths=a,t._addAction(c),c},t.createRecursiveQueryAction=function(e,t,n){N.validateObjectPath(t);var r={Id:e._nextId(),ActionType:6,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,RecursiveQueryInfo:n},o=new u.Action(r,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o),o},t.createEnsureUnchangedAction=function(e,t,n){N.validateObjectPath(t);var r={Id:e._nextId(),ActionType:8,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,ObjectState:n},o=new u.Action(r,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o),o},t.createInstantiateAction=function(e,t){N.validateObjectPath(t),e._pendingRequest.ensureInstantiateObjectPath(t._objectPath.parentObjectPath),e._pendingRequest.ensureInstantiateObjectPaths(t._objectPath.argumentObjectPaths);var n={Id:e._nextId(),ActionType:1,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id},r=new u.Action(n,1,4);return r.referencedObjectPath=t._objectPath,t._addAction(r,new R(t),!0),r},t.createTraceAction=function(e,t,n){var r={Id:e._nextId(),ActionType:5,Name:"Trace",ObjectPathId:0},o=new u.Action(r,1,4);return e._pendingRequest.addAction(o),n&&e._pendingRequest.addTrace(r.Id,t),o},t.createTraceMarkerForCallback=function(e,n){var r=t.createTraceAction(e,null,!1);e._pendingRequest.addActionResultHandler(r,new l(n))},t}(u.CommonActionFactory);t.ActionFactory=d;var p=function(e){function t(t,n){var r=e.call(this,t,n)||this;return N.checkArgumentNull(t,"context"),r.m_context=t,r._objectPath&&(!t._processingResult&&t._pendingRequest&&(d.createInstantiateAction(t,r),t._autoCleanup&&r._KeepReference&&t.trackedObjects._autoAdd(r)),u._internalConfig.appendTypeNameToObjectPathInfo&&r._objectPath.objectPathInfo&&r._className&&(r._objectPath.objectPathInfo.T=r._className)),r}return o(t,e),Object.defineProperty(t.prototype,"context",{get:function(){return this.m_context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isNull",{get:function(){return(void 0!==this.m_isNull||!a.TestUtility.isMock())&&(N.throwIfNotLoaded("isNull",this._isNull,null,this._isNull),this._isNull)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isNullObject",{get:function(){return(void 0!==this.m_isNull||!a.TestUtility.isMock())&&(N.throwIfNotLoaded("isNullObject",this._isNull,null,this._isNull),this._isNull)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isNull",{get:function(){return this.m_isNull},set:function(e){this.m_isNull=e,e&&this._objectPath&&this._objectPath._updateAsNullObject()},enumerable:!1,configurable:!0}),t.prototype._addAction=function(e,t,n){return void 0===t&&(t=null),n||(this.context._pendingRequest.ensureInstantiateObjectPath(this._objectPath),this.context._pendingRequest.ensureInstantiateObjectPaths(e.referencedArgumentObjectPaths)),this.context._pendingRequest.addAction(e),this.context._pendingRequest.addReferencedObjectPath(this._objectPath),this.context._pendingRequest.addReferencedObjectPaths(e.referencedArgumentObjectPaths),this.context._pendingRequest.addActionResultHandler(e,t),a.CoreUtility._createPromiseFromResult(null)},t.prototype._handleResult=function(e){this._isNull=N.isNullOrUndefined(e),this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this,e)},t.prototype._handleIdResult=function(e){this._isNull=N.isNullOrUndefined(e),N.fixObjectPathIfNecessary(this,e),this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this,e)},t.prototype._handleRetrieveResult=function(e,t){this._handleIdResult(e)},t.prototype._recursivelySet=function(e,n,r,o,i){var s=e instanceof t,c=e;if(s){if(Object.getPrototypeOf(this)!==Object.getPrototypeOf(e))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"properties",errorLocation:this._className+".set"});e=JSON.parse(JSON.stringify(e))}try{for(var l,d=0;d<r.length;d++)l=r[d],e.hasOwnProperty(l)&&void 0!==e[l]&&(this[l]=e[l]);for(d=0;d<o.length;d++)if(l=o[d],e.hasOwnProperty(l)&&void 0!==e[l]){var p=s?c[l]:e[l];this[l].set(p,n)}var f=!s;for(n&&!N.isNullOrUndefined(f)&&(f=n.throwOnReadOnly),d=0;d<i.length;d++)if(l=i[d],e.hasOwnProperty(l)&&void 0!==e[l]&&f)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.cannotApplyPropertyThroughSetMethod,l),debugInfo:{errorLocation:l}});for(l in e)if(r.indexOf(l)<0&&o.indexOf(l)<0){var h=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),l);if(!h)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(u.CommonResourceStrings.propertyDoesNotExist,l),debugInfo:{errorLocation:l}});if(f&&!h.set)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(u.CommonResourceStrings.attemptingToSetReadOnlyProperty,l),debugInfo:{errorLocation:l}})}}catch(e){throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidArgument,"properties"),debugInfo:{errorLocation:this._className+".set"},innerError:e})}},t}(u.ClientObjectBase);t.ClientObject=p;var f=function(){function e(e){this.m_session=e}return e.prototype.executeAsync=function(e,t,n){var r={url:a.CoreConstants.processQuery,method:"POST",headers:n.Headers,body:n.Body},o={id:a.HostBridge.nextId(),type:1,flags:t,message:r};return a.CoreUtility.log(JSON.stringify(o)),this.m_session.sendMessageToHost(o).then((function(e){a.CoreUtility.log("Received response: "+JSON.stringify(e));var t,n=e.message;if(200===n.statusCode)t={HttpStatusCode:n.statusCode,ErrorCode:null,ErrorMessage:null,Headers:n.headers,Body:a.CoreUtility._parseResponseBody(n)};else{a.CoreUtility.log("Error Response:"+n.body);var r=a.CoreUtility._parseErrorResponse(n);t={HttpStatusCode:n.statusCode,ErrorCode:r.errorCode,ErrorMessage:r.errorMessage,Headers:n.headers,Body:null}}return t}))},e}(),h=function(e){function t(t){var n=e.call(this)||this;return n.m_bridge=t,n.m_bridge.addHostMessageHandler((function(e){3===e.type&&C.getGenericEventRegistration()._handleRichApiMessage(e.message)})),n}return o(t,e),t.getInstanceIfHostBridgeInited=function(){return a.HostBridge.instance?((a.CoreUtility.isNullOrUndefined(t.s_instance)||t.s_instance.m_bridge!==a.HostBridge.instance)&&(t.s_instance=new t(a.HostBridge.instance)),t.s_instance):null},t.prototype._resolveRequestUrlAndHeaderInfo=function(){return a.CoreUtility._createPromiseFromResult(null)},t.prototype._createRequestExecutorOrNull=function(){return a.CoreUtility.log("NativeBridgeSession::CreateRequestExecutor"),new f(this)},Object.defineProperty(t.prototype,"eventRegistration",{get:function(){return C.getGenericEventRegistration()},enumerable:!1,configurable:!0}),t.prototype.sendMessageToHost=function(e){return this.m_bridge.sendMessageToHostAndExpectResponse(e)},t}(a.SessionBase);t.HostBridgeSession=h;var m=function(e){function t(n){var r=e.call(this)||this;if(r.m_customRequestHeaders={},r.m_batchMode=0,r._onRunFinishedNotifiers=[],a.SessionBase._overrideSession)r.m_requestUrlAndHeaderInfoResolver=a.SessionBase._overrideSession;else if((N.isNullOrUndefined(n)||"string"==typeof n&&0===n.length)&&((n=t.defaultRequestUrlAndHeaders)||(n={url:a.CoreConstants.localDocument,headers:{}})),"string"==typeof n)r.m_requestUrlAndHeaderInfo={url:n,headers:{}};else if(t.isRequestUrlAndHeaderInfoResolver(n))r.m_requestUrlAndHeaderInfoResolver=n;else{if(!t.isRequestUrlAndHeaderInfo(n))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"url"});var o=n;r.m_requestUrlAndHeaderInfo={url:o.url,headers:{}},a.CoreUtility._copyHeaders(o.headers,r.m_requestUrlAndHeaderInfo.headers)}return!r.m_requestUrlAndHeaderInfoResolver&&r.m_requestUrlAndHeaderInfo&&a.CoreUtility._isLocalDocumentUrl(r.m_requestUrlAndHeaderInfo.url)&&h.getInstanceIfHostBridgeInited()&&(r.m_requestUrlAndHeaderInfo=null,r.m_requestUrlAndHeaderInfoResolver=h.getInstanceIfHostBridgeInited()),r.m_requestUrlAndHeaderInfoResolver instanceof a.SessionBase&&(r.m_session=r.m_requestUrlAndHeaderInfoResolver),r._processingResult=!1,r._customData=y.iterativeExecutor,r.sync=r.sync.bind(r),r}return o(t,e),Object.defineProperty(t.prototype,"session",{get:function(){return this.m_session},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"eventRegistration",{get:function(){return this.m_session?this.m_session.eventRegistration:v.officeJsEventRegistration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_url",{get:function(){return this.m_requestUrlAndHeaderInfo?this.m_requestUrlAndHeaderInfo.url:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_pendingRequest",{get:function(){return null==this.m_pendingRequest&&(this.m_pendingRequest=new b(this)),this.m_pendingRequest},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugInfo",{get:function(){return{pendingStatements:new S(this._rootObjectPropertyName,this._pendingRequest._objectPaths,this._pendingRequest._actions,u._internalConfig.showDisposeInfoInDebugInfo).process()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trackedObjects",{get:function(){return this.m_trackedObjects||(this.m_trackedObjects=new A(this)),this.m_trackedObjects},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestHeaders",{get:function(){return this.m_customRequestHeaders},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"batchMode",{get:function(){return this.m_batchMode},enumerable:!1,configurable:!0}),t.prototype.ensureInProgressBatchIfBatchMode=function(){if(1===this.m_batchMode&&!this.m_explicitBatchInProgress)throw N.createRuntimeError(a.CoreErrorCodes.generalException,a.CoreUtility._getResourceString(F.notInsideBatch),null)},t.prototype.load=function(e,n){N.validateContext(this,e);var r=t._parseQueryOption(n);u.CommonActionFactory.createQueryAction(this,e,r,e)},t.prototype.loadRecursive=function(e,n,r){if(!N.isPlainJsonObject(n))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"options"});var o={};for(var i in n)o[i]=t._parseQueryOption(n[i]);var s=d.createRecursiveQueryAction(this,e,{Queries:o,MaxDepth:r});this._pendingRequest.addActionResultHandler(s,e)},t.prototype.trace=function(e){d.createTraceAction(this,e,!0)},t.prototype._processOfficeJsErrorResponse=function(e,t){},t.prototype.ensureRequestUrlAndHeaderInfo=function(){var e=this;return N._createPromiseFromResult(null).then((function(){if(!e.m_requestUrlAndHeaderInfo)return e.m_requestUrlAndHeaderInfoResolver._resolveRequestUrlAndHeaderInfo().then((function(t){if(e.m_requestUrlAndHeaderInfo=t,e.m_requestUrlAndHeaderInfo||(e.m_requestUrlAndHeaderInfo={url:a.CoreConstants.localDocument,headers:{}}),N.isNullOrEmptyString(e.m_requestUrlAndHeaderInfo.url)&&(e.m_requestUrlAndHeaderInfo.url=a.CoreConstants.localDocument),e.m_requestUrlAndHeaderInfo.headers||(e.m_requestUrlAndHeaderInfo.headers={}),"function"==typeof e.m_requestUrlAndHeaderInfoResolver._createRequestExecutorOrNull){var n=e.m_requestUrlAndHeaderInfoResolver._createRequestExecutorOrNull();n&&(e._requestExecutor=n)}}))}))},t.prototype.syncPrivateMain=function(){var e=this;return this.ensureRequestUrlAndHeaderInfo().then((function(){var t=e._pendingRequest;return e.m_pendingRequest=null,e.processPreSyncPromises(t).then((function(){return e.syncPrivate(t)}))}))},t.prototype.syncPrivate=function(e){var t=this;if(a.TestUtility.isMock())return a.CoreUtility._createPromiseFromResult(null);if(!e.hasActions)return this.processPendingEventHandlers(e);var n=e.buildRequestMessageBodyAndRequestFlags(),r=n.body,o=n.flags;this._requestFlagModifier&&(o|=this._requestFlagModifier),this._requestExecutor||(a.CoreUtility._isLocalDocumentUrl(this.m_requestUrlAndHeaderInfo.url)?this._requestExecutor=new E(this):this._requestExecutor=new u.HttpRequestExecutor);var i=this._requestExecutor,s={};a.CoreUtility._copyHeaders(this.m_requestUrlAndHeaderInfo.headers,s),a.CoreUtility._copyHeaders(this.m_customRequestHeaders,s),delete this.m_customRequestHeaders[y.officeScriptEventId];var l={Url:this.m_requestUrlAndHeaderInfo.url,Headers:s,Body:r};e.invalidatePendingInvalidObjectPaths();var d=null,p=null;return this._lastSyncStart="undefined"==typeof performance?0:performance.now(),this._lastRequestFlags=o,i.executeAsync(this._customData,o,l).then((function(n){return t._lastSyncEnd="undefined"==typeof performance?0:performance.now(),d=t.processRequestExecutorResponseMessage(e,n),t.processPendingEventHandlers(e).catch((function(e){a.CoreUtility.log("Error in processPendingEventHandlers"),a.CoreUtility.log(JSON.stringify(e)),p=e}))})).then((function(){if(d)throw a.CoreUtility.log("Throw error from response: "+JSON.stringify(d)),d;if(p){a.CoreUtility.log("Throw error from ProcessEventHandler: "+JSON.stringify(p));var t=null;if(p instanceof a._Internal.RuntimeError)(t=p).traceMessages=e._responseTraceMessages;else{var n=null;n="string"==typeof p?p:p.message,N.isNullOrEmptyString(n)&&(n=a.CoreUtility._getResourceString(F.cannotRegisterEvent)),t=new a._Internal.RuntimeError({code:c.cannotRegisterEvent,httpStatusCode:400,message:n,traceMessages:e._responseTraceMessages})}throw t}}))},t.prototype.processRequestExecutorResponseMessage=function(e,t){t.Body&&t.Body.TraceIds&&e._setResponseTraceIds(t.Body.TraceIds);var n=e._responseTraceMessages,r=null;if(t.Body){if(t.Body.Error&&t.Body.Error.ActionIndex>=0){var o=new S(this._rootObjectPropertyName,e._objectPaths,e._actions,!1,!0),i=o.processForDebugStatementInfo(t.Body.Error.ActionIndex);r={statement:i.statement,surroundingStatements:i.surroundingStatements,fullStatements:["Please enable config.extendedErrorLogging to see full statements."]},u.config.extendedErrorLogging&&(o=new S(this._rootObjectPropertyName,e._objectPaths,e._actions,!1,!1),r.fullStatements=o.process())}var s=null;if(t.Body.Results?s=t.Body.Results:t.Body.ProcessedResults&&t.Body.ProcessedResults.Results&&(s=t.Body.ProcessedResults.Results),s){this._processingResult=!0;try{e.processResponse(s)}finally{this._processingResult=!1}}}if(!N.isNullOrEmptyString(t.ErrorCode))return new a._Internal.RuntimeError({code:t.ErrorCode,httpStatusCode:t.HttpStatusCode,message:t.ErrorMessage,traceMessages:n});if(t.Body&&t.Body.Error){var c={errorLocation:t.Body.Error.Location};return r&&(c.statement=r.statement,c.surroundingStatements=r.surroundingStatements,c.fullStatements=r.fullStatements),new a._Internal.RuntimeError({code:t.Body.Error.Code,httpStatusCode:t.Body.Error.HttpStatusCode,message:t.Body.Error.Message,traceMessages:n,debugInfo:c})}return null},t.prototype.processPendingEventHandlers=function(e){for(var t=N._createPromiseFromResult(null),n=0;n<e._pendingProcessEventHandlers.length;n++){var r=e._pendingProcessEventHandlers[n];t=t.then(this.createProcessOneEventHandlersFunc(r,e))}return t},t.prototype.createProcessOneEventHandlersFunc=function(e,t){return function(){return e._processRegistration(t)}},t.prototype.processPreSyncPromises=function(e){for(var t=N._createPromiseFromResult(null),n=0;n<e._preSyncPromises.length;n++){var r=e._preSyncPromises[n];t=t.then(this.createProcessOneProSyncFunc(r))}return t},t.prototype.createProcessOneProSyncFunc=function(e){return function(){return e}},t.prototype.sync=function(e){return a.TestUtility.isMock()?a.CoreUtility._createPromiseFromResult(e):this.syncPrivateMain().then((function(){return e}))},t.prototype.batch=function(e){var t=this;if(1!==this.m_batchMode)return a.CoreUtility._createPromiseFromException(N.createRuntimeError(a.CoreErrorCodes.generalException,null,null));if(this.m_explicitBatchInProgress)return a.CoreUtility._createPromiseFromException(N.createRuntimeError(a.CoreErrorCodes.generalException,a.CoreUtility._getResourceString(F.pendingBatchInProgress),null));if(N.isNullOrUndefined(e))return N._createPromiseFromResult(null);this.m_explicitBatchInProgress=!0;var n,r,o,i=this.m_pendingRequest;this.m_pendingRequest=new b(this);try{n=e(this._rootObject,this)}catch(e){return this.m_explicitBatchInProgress=!1,this.m_pendingRequest=i,a.CoreUtility._createPromiseFromException(e)}return"object"==typeof n&&n&&"function"==typeof n.then?o=N._createPromiseFromResult(null).then((function(){return n})).then((function(e){return t.m_explicitBatchInProgress=!1,r=t.m_pendingRequest,t.m_pendingRequest=i,e})).catch((function(e){return t.m_explicitBatchInProgress=!1,r=t.m_pendingRequest,t.m_pendingRequest=i,a.CoreUtility._createPromiseFromException(e)})):(this.m_explicitBatchInProgress=!1,r=this.m_pendingRequest,this.m_pendingRequest=i,o=N._createPromiseFromResult(n)),o.then((function(e){return t.ensureRequestUrlAndHeaderInfo().then((function(){return t.syncPrivate(r)})).then((function(){return e}))}))},t._run=function(e,n,r,o,i,s){return void 0===r&&(r=3),void 0===o&&(o=5e3),t._runCommon("run",null,e,0,n,r,o,null,i,s)},t.isValidRequestInfo=function(e){return"string"==typeof e||t.isRequestUrlAndHeaderInfo(e)||t.isRequestUrlAndHeaderInfoResolver(e)},t.isRequestUrlAndHeaderInfo=function(e){return"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.getPrototypeOf({})&&!N.isNullOrUndefined(e.url)},t.isRequestUrlAndHeaderInfoResolver=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e._resolveRequestUrlAndHeaderInfo},t._runBatch=function(e,n,r,o,i,s,a,u){return void 0===i&&(i=3),void 0===s&&(s=5e3),t._runBatchCommon(0,e,n,r,i,s,o,a,u)},t._runExplicitBatch=function(e,n,r,o,i,s,a,u){return void 0===i&&(i=3),void 0===s&&(s=5e3),t._runBatchCommon(1,e,n,r,i,s,o,a,u)},t._runBatchCommon=function(e,n,r,o,i,s,a,u,c){var l,d;void 0===i&&(i=3),void 0===s&&(s=5e3);var f=null,h=null,m=0,g=null;if(r.length>0)if(t.isValidRequestInfo(r[0]))f=r[0],m=1;else if(N.isPlainJsonObject(r[0])){if(null!=(f=(g=r[0]).session)&&!t.isValidRequestInfo(f))return t.createErrorPromise(n);h=g.previousObjects,m=1}if(r.length==m+1)d=r[m+0];else{if(null!=g||r.length!=m+2)return t.createErrorPromise(n);h=r[m+0],d=r[m+1]}if(null!=h)if(h instanceof p)l=function(){return h.context};else if(h instanceof t)l=function(){return h};else{if(!Array.isArray(h))return t.createErrorPromise(n);var y=h;if(0==y.length)return t.createErrorPromise(n);for(var b=0;b<y.length;b++){if(!(y[b]instanceof p))return t.createErrorPromise(n);if(y[b].context!=y[0].context)return t.createErrorPromise(n,F.invalidRequestContext)}l=function(){return y[0].context}}else l=o;var _=null;return a&&(_=function(e){return a(g||{},e)}),t._runCommon(n,f,l,e,d,i,s,_,u,c)},t.createErrorPromise=function(e,t){return void 0===t&&(t=a.CoreResourceStrings.invalidArgument),a.CoreUtility._createPromiseFromException(N.createRuntimeError(t,a.CoreUtility._getResourceString(t),e))},t._runCommon=function(e,n,r,o,i,s,u,c,l,d){a.SessionBase._overrideSession&&(n=a.SessionBase._overrideSession);var p,f,h,m=a.CoreUtility.createPromise((function(e,t){e()})),g=!1;return m.then((function(){if((p=r(n))._autoCleanup)return new Promise((function(e,t){p._onRunFinishedNotifiers.push((function(){p._autoCleanup=!0,e()}))}));p._autoCleanup=!0})).then((function(){return"function"!=typeof i?t.createErrorPromise(e):(h=p.m_batchMode,p.m_batchMode=o,c&&c(p),n=i(1==o?p.batch.bind(p):p),(N.isNullOrUndefined(n)||"function"!=typeof n.then)&&N.throwError(F.runMustReturnPromise),n);var n})).then((function(e){return 1===o?e:p.sync(e)})).then((function(e){g=!0,f=e})).catch((function(e){f=e})).then((function(){var e=p.trackedObjects._retrieveAndClearAutoCleanupList();for(var r in p._autoCleanup=!1,p.m_batchMode=h,e)e[r]._objectPath.isValid=!1;var o=0;if(N._synchronousCleanup||t.isRequestUrlAndHeaderInfoResolver(n))return i();function i(){o++;var t=p.m_pendingRequest,n=p.m_batchMode,r=new b(p);p.m_pendingRequest=r,p.m_batchMode=0;try{for(var a in e)p.trackedObjects.remove(e[a])}finally{p.m_batchMode=n,p.m_pendingRequest=t}return p.syncPrivate(r).then((function(){l&&l(o)})).catch((function(){d&&d(o),o<s&&setTimeout((function(){i()}),u)}))}i()})).then((function(){if(p._onRunFinishedNotifiers&&p._onRunFinishedNotifiers.length>0&&p._onRunFinishedNotifiers.shift()(),g)return f;throw f}))},t}(u.ClientRequestContextBase);t.ClientRequestContext=m;var g=function(){function e(e,t){this.m_proxy=e,this.m_shouldPolyfill=t;var n=e[y.scalarPropertyNames],r=e[y.navigationPropertyNames],o=e[y.className],i=e[y.isCollection];if(n)for(var s=0;s<n.length;s++)N.definePropertyThrowUnloadedException(this,o,n[s]);if(r)for(s=0;s<r.length;s++)N.definePropertyThrowUnloadedException(this,o,r[s]);i&&N.definePropertyThrowUnloadedException(this,o,y.itemsLowerCase)}return Object.defineProperty(e.prototype,"$proxy",{get:function(){return this.m_proxy},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$isNullObject",{get:function(){if(!this.m_isLoaded)throw new a._Internal.RuntimeError({code:c.valueNotLoaded,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.valueNotLoaded),debugInfo:{errorLocation:"retrieveResult.$isNullObject"}});return this.m_isNullObject},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){if(this.m_isLoaded)return this.m_isNullObject?null:(N.isUndefined(this.m_json)&&(this.m_json=N.purifyJson(this.m_value)),this.m_json)},e.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.prototype._handleResult=function(e){this.m_isLoaded=!0,null===e||"object"==typeof e&&e&&e._IsNull?(this.m_isNullObject=!0,e=null):this.m_isNullObject=!1,this.m_shouldPolyfill&&(e=N.changePropertyNameToCamelLowerCase(e)),this.m_value=e,this.m_proxy._handleRetrieveResult(e,this)},e}(),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.getItemAt="GetItemAt",t.index="_Index",t.iterativeExecutor="IterativeExecutor",t.isTracked="_IsTracked",t.eventMessageCategory=65536,t.eventWorkbookId="Workbook",t.eventSourceRemote="Remote",t.proxy="$proxy",t.className="_className",t.isCollection="_isCollection",t.collectionPropertyPath="_collectionPropertyPath",t.objectPathInfoDoNotKeepReferenceFieldName="D",t.officeScriptEventId="X-OfficeScriptEventId",t.officeScriptFireRecordingEvent="X-OfficeScriptFireRecordingEvent",t}(u.CommonConstants);t.Constants=y;var b=function(e){function t(t){var n=e.call(this,t)||this;return n.m_context=t,n.m_pendingProcessEventHandlers=[],n.m_pendingEventHandlerActions={},n.m_traceInfos={},n.m_responseTraceIds={},n.m_responseTraceMessages=[],n}return o(t,e),Object.defineProperty(t.prototype,"traceInfos",{get:function(){return this.m_traceInfos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_responseTraceMessages",{get:function(){return this.m_responseTraceMessages},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_responseTraceIds",{get:function(){return this.m_responseTraceIds},enumerable:!1,configurable:!0}),t.prototype._setResponseTraceIds=function(e){if(e)for(var t=0;t<e.length;t++){var n=e[t];this.m_responseTraceIds[n]=n;var r=this.m_traceInfos[n];a.CoreUtility.isNullOrUndefined(r)||this.m_responseTraceMessages.push(r)}},t.prototype.addTrace=function(e,t){this.m_traceInfos[e]=t},t.prototype._addPendingEventHandlerAction=function(e,t){this.m_pendingEventHandlerActions[e._id]||(this.m_pendingEventHandlerActions[e._id]=[],this.m_pendingProcessEventHandlers.push(e)),this.m_pendingEventHandlerActions[e._id].push(t)},Object.defineProperty(t.prototype,"_pendingProcessEventHandlers",{get:function(){return this.m_pendingProcessEventHandlers},enumerable:!1,configurable:!0}),t.prototype._getPendingEventHandlerActions=function(e){return this.m_pendingEventHandlerActions[e._id]},t}(u.ClientRequestBase);t.ClientRequest=b;var _=function(){function e(e,t,n,r){var o=this;this.m_id=e._nextId(),this.m_context=e,this.m_name=n,this.m_handlers=[],this.m_registered=!1,this.m_eventInfo=r,this.m_callback=function(e){o.m_eventInfo.eventArgsTransformFunc(e).then((function(e){return o.fireEvent(e)}))}}return Object.defineProperty(e.prototype,"_registered",{get:function(){return this.m_registered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_id",{get:function(){return this.m_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_handlers",{get:function(){return this.m_handlers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_context",{get:function(){return this.m_context},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_callback",{get:function(){return this.m_callback},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=d.createTraceAction(this.m_context,null,!1);return this.m_context._pendingRequest._addPendingEventHandlerAction(this,{id:t.actionInfo.Id,handler:e,operation:0}),new P(this.m_context,this,e)},e.prototype.remove=function(e){var t=d.createTraceAction(this.m_context,null,!1);this.m_context._pendingRequest._addPendingEventHandlerAction(this,{id:t.actionInfo.Id,handler:e,operation:1})},e.prototype.removeAll=function(){var e=d.createTraceAction(this.m_context,null,!1);this.m_context._pendingRequest._addPendingEventHandlerAction(this,{id:e.actionInfo.Id,handler:null,operation:2})},e.prototype._processRegistration=function(e){var t=this,n=a.CoreUtility._createPromiseFromResult(null),r=e._getPendingEventHandlerActions(this);if(!r)return n;for(var o=[],i=0;i<this.m_handlers.length;i++)o.push(this.m_handlers[i]);var s=!1;for(i=0;i<r.length;i++)if(e._responseTraceIds[r[i].id])switch(s=!0,r[i].operation){case 0:o.push(r[i].handler);break;case 1:for(var u=o.length-1;u>=0;u--)if(o[u]===r[i].handler){o.splice(u,1);break}break;case 2:o=[]}return s&&(!this.m_registered&&o.length>0?n=n.then((function(){return t.m_eventInfo.registerFunc(t.m_callback)})).then((function(){return t.m_registered=!0})):this.m_registered&&0==o.length&&(n=n.then((function(){return t.m_eventInfo.unregisterFunc(t.m_callback)})).catch((function(e){a.CoreUtility.log("Error when unregister event: "+JSON.stringify(e))})).then((function(){return t.m_registered=!1}))),n=n.then((function(){return t.m_handlers=o}))),n},e.prototype.fireEvent=function(e){for(var t=[],n=0;n<this.m_handlers.length;n++){var r=this.m_handlers[n],o=a.CoreUtility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(r,e)).catch((function(e){a.CoreUtility.log("Error when invoke handler: "+JSON.stringify(e))}));t.push(o)}a.CoreUtility.Promise.all(t)},e.prototype.createFireOneEventHandlerFunc=function(e,t){return function(){return e(t)}},e}();t.EventHandlers=_;var v,P=function(){function e(e,t,n){this.m_context=e,this.m_allHandlers=t,this.m_handler=n}return Object.defineProperty(e.prototype,"context",{get:function(){return this.m_context},enumerable:!1,configurable:!0}),e.prototype.remove=function(){this.m_allHandlers&&this.m_handler&&(this.m_allHandlers.remove(this.m_handler),this.m_allHandlers=null,this.m_handler=null)},e}();t.EventHandlerResult=P,function(e){var t=function(){function e(){}return e.prototype.register=function(e,t,n){switch(e){case 4:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.addHandlerAsync(Office.EventType.BindingDataChanged,n,t)}))}));case 3:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.addHandlerAsync(Office.EventType.BindingSelectionChanged,n,t)}))}));case 2:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.DocumentSelectionChanged,n,e)}));case 1:return N.promisify((function(e){return Office.context.document.settings.addHandlerAsync(Office.EventType.SettingsChanged,n,e)}));case 5:return N.promisify((function(e){return OSF.DDA.RichApi.richApiMessageManager.addHandlerAsync("richApiMessage",n,e)}));case 13:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectDeleted,n,{id:t},e)}));case 14:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectSelectionChanged,n,{id:t},e)}));case 15:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectDataChanged,n,{id:t},e)}));case 16:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ContentControlAdded,n,{id:t},e)}));default:throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"eventId"})}},e.prototype.unregister=function(e,t,n){switch(e){case 4:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.removeHandlerAsync(Office.EventType.BindingDataChanged,{handler:n},t)}))}));case 3:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.removeHandlerAsync(Office.EventType.BindingSelectionChanged,{handler:n},t)}))}));case 2:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.DocumentSelectionChanged,{handler:n},e)}));case 1:return N.promisify((function(e){return Office.context.document.settings.removeHandlerAsync(Office.EventType.SettingsChanged,{handler:n},e)}));case 5:return N.promisify((function(e){return OSF.DDA.RichApi.richApiMessageManager.removeHandlerAsync("richApiMessage",{handler:n},e)}));case 13:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectDeleted,{id:t,handler:n},e)}));case 14:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectSelectionChanged,{id:t,handler:n},e)}));case 15:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectDataChanged,{id:t,handler:n},e)}));case 16:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ContentControlAdded,{id:t,handler:n},e)}));default:throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"eventId"})}},e}();e.officeJsEventRegistration=new t}(v=t._Internal||(t._Internal={}));var O=function(){function e(e,t){this.m_handlersByEventByTarget={},this.m_registerEventImpl=e,this.m_unregisterEventImpl=t}return e.getTargetIdOrDefault=function(e){return N.isNullOrUndefined(e)?"":e},e.prototype.getHandlers=function(t,n){n=e.getTargetIdOrDefault(n);var r=this.m_handlersByEventByTarget[t];r||(r={},this.m_handlersByEventByTarget[t]=r);var o=r[n];return o||(o=[],r[n]=o),o},e.prototype.callHandlers=function(e,t,n){for(var r=this.getHandlers(e,t),o=0;o<r.length;o++)r[o](n)},e.prototype.hasHandlers=function(e,t){return this.getHandlers(e,t).length>0},e.prototype.register=function(e,t,n){if(!n)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"handler"});var r=this.getHandlers(e,t);return r.push(n),1===r.length?this.m_registerEventImpl(e,t):N._createPromiseFromResult(null)},e.prototype.unregister=function(e,t,n){if(!n)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"handler"});for(var r=this.getHandlers(e,t),o=r.length-1;o>=0;o--)if(r[o]===n){r.splice(o,1);break}return 0===r.length?this.m_unregisterEventImpl(e,t):N._createPromiseFromResult(null)},e}();t.EventRegistration=O;var C=function(){function e(){this.m_eventRegistration=new O(this._registerEventImpl.bind(this),this._unregisterEventImpl.bind(this)),this.m_richApiMessageHandler=this._handleRichApiMessage.bind(this)}return e.prototype.ready=function(){var t=this;return this.m_ready||(e._testReadyImpl?this.m_ready=e._testReadyImpl().then((function(){t.m_isReady=!0})):a.HostBridge.instance?this.m_ready=N._createPromiseFromResult(null).then((function(){t.m_isReady=!0})):this.m_ready=v.officeJsEventRegistration.register(5,"",this.m_richApiMessageHandler).then((function(){t.m_isReady=!0}))),this.m_ready},Object.defineProperty(e.prototype,"isReady",{get:function(){return this.m_isReady},enumerable:!1,configurable:!0}),e.prototype.register=function(e,t,n){var r=this;return this.ready().then((function(){return r.m_eventRegistration.register(e,t,n)}))},e.prototype.unregister=function(e,t,n){var r=this;return this.ready().then((function(){return r.m_eventRegistration.unregister(e,t,n)}))},e.prototype._registerEventImpl=function(e,t){return N._createPromiseFromResult(null)},e.prototype._unregisterEventImpl=function(e,t){return N._createPromiseFromResult(null)},e.prototype._handleRichApiMessage=function(e){if(e&&e.entries)for(var t=0;t<e.entries.length;t++){var n=e.entries[t];if(n.messageCategory==y.eventMessageCategory){a.CoreUtility._logEnabled&&a.CoreUtility.log(JSON.stringify(n));var r=n.messageType,o=n.targetId;if(this.m_eventRegistration.hasHandlers(r,o)){var i=JSON.parse(n.message);n.isRemoteOverride&&(i.source=y.eventSourceRemote),this.m_eventRegistration.callHandlers(r,o,i)}}}},e.getGenericEventRegistration=function(){return e.s_genericEventRegistration||(e.s_genericEventRegistration=new e),e.s_genericEventRegistration},e.richApiMessageEventCategory=65536,e}();t.GenericEventRegistration=C,t._testSetRichApiMessageReadyImpl=function(e){C._testReadyImpl=e},t._testTriggerRichApiMessageEvent=function(e){C.getGenericEventRegistration()._handleRichApiMessage(e)};var I=function(e){function t(t,n,r,o){var i=e.call(this,t,n,r,o)||this;return i.m_genericEventInfo=o,i}return o(t,e),t.prototype.add=function(e){var t=this;return 0==this._handlers.length&&this.m_genericEventInfo.registerFunc&&this.m_genericEventInfo.registerFunc(),C.getGenericEventRegistration().isReady||this._context._pendingRequest._addPreSyncPromise(C.getGenericEventRegistration().ready()),d.createTraceMarkerForCallback(this._context,(function(){t._handlers.push(e),1==t._handlers.length&&C.getGenericEventRegistration().register(t.m_genericEventInfo.eventType,t.m_genericEventInfo.getTargetIdFunc(),t._callback)})),new P(this._context,this,e)},t.prototype.remove=function(e){var t=this;1==this._handlers.length&&this.m_genericEventInfo.unregisterFunc&&this.m_genericEventInfo.unregisterFunc(),d.createTraceMarkerForCallback(this._context,(function(){for(var n=t._handlers,r=n.length-1;r>=0;r--)if(n[r]===e){n.splice(r,1);break}0==n.length&&C.getGenericEventRegistration().unregister(t.m_genericEventInfo.eventType,t.m_genericEventInfo.getTargetIdFunc(),t._callback)}))},t.prototype.removeAll=function(){},t}(_);t.GenericEventHandlers=I;var R=function(){function e(e){this.m_clientObject=e}return e.prototype._handleResult=function(e){this.m_clientObject._handleIdResult(e)},e}(),j=function(){function e(){}return e.createGlobalObjectObjectPath=function(e){var t={Id:e._nextId(),ObjectPathType:1,Name:""};return new u.ObjectPath(t,null,!1,!1,1,4)},e.createNewObjectObjectPath=function(e,t,n,r){var o={Id:e._nextId(),ObjectPathType:2,Name:t};return new u.ObjectPath(o,null,n,!1,1,N._fixupApiFlags(r))},e.createPropertyObjectPath=function(e,t,n,r,o,i){var s={Id:e._nextId(),ObjectPathType:4,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id};return new u.ObjectPath(s,t._objectPath,r,o,1,N._fixupApiFlags(i))},e.createIndexerObjectPath=function(e,t,n){var r={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return r.ArgumentInfo.Arguments=n,new u.ObjectPath(r,t._objectPath,!1,!1,1,4)},e.createIndexerObjectPathUsingParentPath=function(e,t,n){var r={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t.objectPathInfo.Id,ArgumentInfo:{}};return r.ArgumentInfo.Arguments=n,new u.ObjectPath(r,t,!1,!1,1,4)},e.createMethodObjectPath=function(e,t,n,r,o,i,s,a,c){var l={Id:e._nextId(),ObjectPathType:3,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},d=N.setMethodArguments(e,l.ArgumentInfo,o),p=new u.ObjectPath(l,t._objectPath,i,s,r,N._fixupApiFlags(c));return p.argumentObjectPaths=d,p.getByIdMethodName=a,p},e.createReferenceIdObjectPath=function(e,t){var n={Id:e._nextId(),ObjectPathType:6,Name:t,ArgumentInfo:{}};return new u.ObjectPath(n,null,!1,!1,1,4)},e.createChildItemObjectPathUsingIndexerOrGetItemAt=function(t,n,r,o,i){var s=N.tryGetObjectIdFromLoadOrRetrieveResult(o);return t&&!N.isNullOrUndefined(s)?e.createChildItemObjectPathUsingIndexer(n,r,o):e.createChildItemObjectPathUsingGetItemAt(n,r,o,i)},e.createChildItemObjectPathUsingIndexer=function(e,t,n){var r=N.tryGetObjectIdFromLoadOrRetrieveResult(n),o=o={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return o.ArgumentInfo.Arguments=[r],new u.ObjectPath(o,t._objectPath,!1,!1,1,4)},e.createChildItemObjectPathUsingGetItemAt=function(e,t,n,r){var o=n[y.index];o&&(r=o);var i={Id:e._nextId(),ObjectPathType:3,Name:y.getItemAt,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return i.ArgumentInfo.Arguments=[r],new u.ObjectPath(i,t._objectPath,!1,!1,1,4)},e}();t.ObjectPathFactory=j;var E=function(){function e(e){this.m_context=e}return e.prototype.executeAsync=function(t,n,r){var o=this,i=a.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(t,n,r,e.SourceLibHeaderValue);return new Promise((function(e,t){OSF.DDA.RichApi.executeRichApiRequestAsync(i,(function(t){var n;a.CoreUtility.log("Response:"),a.CoreUtility.log(JSON.stringify(t)),"succeeded"==t.status?n=a.RichApiMessageUtility.buildResponseOnSuccess(a.RichApiMessageUtility.getResponseBody(t),a.RichApiMessageUtility.getResponseHeaders(t)):(n=a.RichApiMessageUtility.buildResponseOnError(t.error.code,t.error.message),o.m_context._processOfficeJsErrorResponse(t.error.code,n)),e(n)}))}))},e.SourceLibHeaderValue="officejs",e}(),A=function(){function e(e){this._autoCleanupList={},this.m_context=e}return e.prototype.add=function(e){var t=this;Array.isArray(e)?e.forEach((function(e){return t._addCommon(e,!0)})):this._addCommon(e,!0)},e.prototype._autoAdd=function(e){this._addCommon(e,!1),this._autoCleanupList[e._objectPath.objectPathInfo.Id]=e},e.prototype._autoTrackIfNecessaryWhenHandleObjectResultValue=function(e,t){this.m_context._autoCleanup&&!e[y.isTracked]&&e!==this.m_context._rootObject&&t&&!N.isNullOrEmptyString(t[y.referenceId])&&(this._autoCleanupList[e._objectPath.objectPathInfo.Id]=e,e[y.isTracked]=!0)},e.prototype._addCommon=function(e,t){if(e[y.isTracked])t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id];else{var n=e[y.referenceId];if(e._objectPath.objectPathInfo[y.objectPathInfoDoNotKeepReferenceFieldName])throw N.createRuntimeError(a.CoreErrorCodes.generalException,a.CoreUtility._getResourceString(F.objectIsUntracked),null);N.isNullOrEmptyString(n)&&e._KeepReference&&(e._KeepReference(),d.createInstantiateAction(this.m_context,e),t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id],e[y.isTracked]=!0)}},e.prototype.remove=function(e){var t=this;Array.isArray(e)?e.forEach((function(e){return t._removeCommon(e)})):this._removeCommon(e)},e.prototype._removeCommon=function(e){e._objectPath.objectPathInfo[y.objectPathInfoDoNotKeepReferenceFieldName]=!0,e.context._pendingRequest._removeKeepReferenceAction(e._objectPath.objectPathInfo.Id);var t=e[y.referenceId];if(!N.isNullOrEmptyString(t)){var n=this.m_context._rootObject;n._RemoveReference&&n._RemoveReference(t)}delete e[y.isTracked]},e.prototype._retrieveAndClearAutoCleanupList=function(){var e=this._autoCleanupList;return this._autoCleanupList={},e},e}();t.TrackedObjects=A;var S=function(){function e(e,t,n,r,o){e||(e="root"),this.m_globalObjName=e,this.m_referencedObjectPaths=t,this.m_actions=n,this.m_statements=[],this.m_variableNameForObjectPathMap={},this.m_variableNameToObjectPathMap={},this.m_declaredObjectPathMap={},this.m_showDispose=r,this.m_removePII=o}return e.prototype.process=function(){this.m_showDispose&&b._calculateLastUsedObjectPathIds(this.m_actions);for(var e=0;e<this.m_actions.length;e++)this.processOneAction(this.m_actions[e]);return this.m_statements},e.prototype.processForDebugStatementInfo=function(e){this.m_showDispose&&b._calculateLastUsedObjectPathIds(this.m_actions),this.m_statements=[];for(var t=-1,n=0;n<this.m_actions.length&&(this.processOneAction(this.m_actions[n]),e==n&&(t=this.m_statements.length-1),!(t>=0&&this.m_statements.length>t+5+1));n++);if(t<0)return null;var r=t-5;r<0&&(r=0);var o=t+1+5;o>this.m_statements.length&&(o=this.m_statements.length);var i=[];0!=r&&i.push("...");for(var s=r;s<t;s++)i.push(this.m_statements[s]);i.push("// >>>>>"),i.push(this.m_statements[t]),i.push("// <<<<<");for(var a=t+1;a<o;a++)i.push(this.m_statements[a]);return o<this.m_statements.length&&i.push("..."),{statement:this.m_statements[t],surroundingStatements:i}},e.prototype.processOneAction=function(e){switch(e.actionInfo.ActionType){case 1:this.processInstantiateAction(e);break;case 3:this.processMethodAction(e);break;case 2:this.processQueryAction(e);break;case 7:this.processQueryAsJsonAction(e);break;case 6:this.processRecursiveQueryAction(e);break;case 4:this.processSetPropertyAction(e);break;case 5:this.processTraceAction(e);break;case 8:this.processEnsureUnchangedAction(e);break;case 9:this.processUpdateAction(e)}},e.prototype.processInstantiateAction=function(e){var t=e.actionInfo.ObjectPathId,n=this.m_referencedObjectPaths[t],r=this.getObjVarName(t);if(this.m_declaredObjectPathMap[t])o="// Instantiate {"+r+"}",o=this.appendDisposeCommentIfRelevant(o,e),this.m_statements.push(o);else{var o="var "+r+" = "+this.buildObjectPathExpressionWithParent(n)+";";o=this.appendDisposeCommentIfRelevant(o,e),this.m_statements.push(o),this.m_declaredObjectPathMap[t]=r}},e.prototype.processMethodAction=function(e){var t=e.actionInfo.Name;if("_KeepReference"===t){if(!u._internalConfig.showInternalApiInDebugInfo)return;t="track"}var n=this.getObjVarName(e.actionInfo.ObjectPathId)+"."+N._toCamelLowerCase(t)+"("+this.buildArgumentsExpression(e.actionInfo.ArgumentInfo)+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},e.prototype.processQueryAction=function(e){var t=this.buildQueryExpression(e),n=this.getObjVarName(e.actionInfo.ObjectPathId)+".load("+t+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},e.prototype.processQueryAsJsonAction=function(e){var t=this.buildQueryExpression(e),n=this.getObjVarName(e.actionInfo.ObjectPathId)+".retrieve("+t+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},e.prototype.processRecursiveQueryAction=function(e){var t="";e.actionInfo.RecursiveQueryInfo&&(t=JSON.stringify(e.actionInfo.RecursiveQueryInfo));var n=this.getObjVarName(e.actionInfo.ObjectPathId)+".loadRecursive("+t+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},e.prototype.processSetPropertyAction=function(e){var t=this.getObjVarName(e.actionInfo.ObjectPathId)+"."+N._toCamelLowerCase(e.actionInfo.Name)+" = "+this.buildArgumentsExpression(e.actionInfo.ArgumentInfo)+";";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},e.prototype.processTraceAction=function(e){var t="context.trace();";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},e.prototype.processEnsureUnchangedAction=function(e){var t=this.getObjVarName(e.actionInfo.ObjectPathId)+".ensureUnchanged("+JSON.stringify(e.actionInfo.ObjectState)+");";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},e.prototype.processUpdateAction=function(e){var t=this.getObjVarName(e.actionInfo.ObjectPathId)+".update("+JSON.stringify(e.actionInfo.ObjectState)+");";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},e.prototype.appendDisposeCommentIfRelevant=function(e,t){var n=this;if(this.m_showDispose){var r=t.actionInfo.L;if(r&&r.length>0)return e+" // And then dispose {"+r.map((function(e){return n.getObjVarName(e)})).join(", ")+"}"}return e},e.prototype.buildQueryExpression=function(e){if(e.actionInfo.QueryInfo){var t={};return t.select=e.actionInfo.QueryInfo.Select,t.expand=e.actionInfo.QueryInfo.Expand,t.skip=e.actionInfo.QueryInfo.Skip,t.top=e.actionInfo.QueryInfo.Top,void 0===t.top&&void 0===t.skip&&void 0===t.expand?void 0===t.select?"":JSON.stringify(t.select):JSON.stringify(t)}return""},e.prototype.buildObjectPathExpressionWithParent=function(e){return 5!=e.objectPathInfo.ObjectPathType&&3!=e.objectPathInfo.ObjectPathType&&4!=e.objectPathInfo.ObjectPathType||!e.objectPathInfo.ParentObjectPathId?this.buildObjectPathExpression(e):this.getObjVarName(e.objectPathInfo.ParentObjectPathId)+"."+this.buildObjectPathExpression(e)},e.prototype.buildObjectPathExpression=function(e){var t=this.buildObjectPathInfoExpression(e.objectPathInfo),n=e.originalObjectPathInfo;return n&&(t=t+" /* originally "+this.buildObjectPathInfoExpression(n)+" */"),t},e.prototype.buildObjectPathInfoExpression=function(e){switch(e.ObjectPathType){case 1:return"context."+this.m_globalObjName;case 5:return"getItem("+this.buildArgumentsExpression(e.ArgumentInfo)+")";case 3:return N._toCamelLowerCase(e.Name)+"("+this.buildArgumentsExpression(e.ArgumentInfo)+")";case 2:return e.Name+".newObject()";case 7:return"null";case 4:return N._toCamelLowerCase(e.Name);case 6:return"context."+this.m_globalObjName+"._getObjectByReferenceId("+JSON.stringify(e.Name)+")"}},e.prototype.buildArgumentsExpression=function(e){var t="";if(!e.Arguments||0===e.Arguments.length)return t;if(this.m_removePII)return void 0===e.Arguments[0]?t:"...";for(var n=0;n<e.Arguments.length;n++)n>0&&(t+=", "),t+=this.buildArgumentLiteral(e.Arguments[n],e.ReferencedObjectPathIds?e.ReferencedObjectPathIds[n]:null);return"undefined"===t&&(t=""),t},e.prototype.buildArgumentLiteral=function(e,t){return"number"==typeof e&&e===t?this.getObjVarName(t):JSON.stringify(e)},e.prototype.getObjVarNameBase=function(e){var t="v",n=this.m_referencedObjectPaths[e];if(n)switch(n.objectPathInfo.ObjectPathType){case 1:t=this.m_globalObjName;break;case 4:t=N._toCamelLowerCase(n.objectPathInfo.Name);break;case 3:var r=n.objectPathInfo.Name;r.length>3&&"Get"===r.substr(0,3)&&(r=r.substr(3)),t=N._toCamelLowerCase(r);break;case 5:var o=this.getObjVarNameBase(n.objectPathInfo.ParentObjectPathId);t="s"===o.charAt(o.length-1)?o.substr(0,o.length-1):o+"Item"}return t},e.prototype.getObjVarName=function(e){if(this.m_variableNameForObjectPathMap[e])return this.m_variableNameForObjectPathMap[e];var t=this.getObjVarNameBase(e);if(!this.m_variableNameToObjectPathMap[t])return this.m_variableNameForObjectPathMap[e]=t,this.m_variableNameToObjectPathMap[t]=e,t;for(var n=1;this.m_variableNameToObjectPathMap[t+n.toString()];)n++;return t+=n.toString(),this.m_variableNameForObjectPathMap[e]=t,this.m_variableNameToObjectPathMap[t]=e,t},e}(),F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.cannotRegisterEvent="CannotRegisterEvent",t.connectionFailureWithStatus="ConnectionFailureWithStatus",t.connectionFailureWithDetails="ConnectionFailureWithDetails",t.propertyNotLoaded="PropertyNotLoaded",t.runMustReturnPromise="RunMustReturnPromise",t.moreInfoInnerError="MoreInfoInnerError",t.cannotApplyPropertyThroughSetMethod="CannotApplyPropertyThroughSetMethod",t.invalidOperationInCellEditMode="InvalidOperationInCellEditMode",t.objectIsUntracked="ObjectIsUntracked",t.customFunctionDefintionMissing="CustomFunctionDefintionMissing",t.customFunctionImplementationMissing="CustomFunctionImplementationMissing",t.customFunctionNameContainsBadChars="CustomFunctionNameContainsBadChars",t.customFunctionNameCannotSplit="CustomFunctionNameCannotSplit",t.customFunctionUnexpectedNumberOfEntriesInResultBatch="CustomFunctionUnexpectedNumberOfEntriesInResultBatch",t.customFunctionCancellationHandlerMissing="CustomFunctionCancellationHandlerMissing",t.customFunctionInvalidFunction="CustomFunctionInvalidFunction",t.customFunctionInvalidFunctionMapping="CustomFunctionInvalidFunctionMapping",t.customFunctionWindowMissing="CustomFunctionWindowMissing",t.customFunctionDefintionMissingOnWindow="CustomFunctionDefintionMissingOnWindow",t.pendingBatchInProgress="PendingBatchInProgress",t.notInsideBatch="NotInsideBatch",t.cannotUpdateReadOnlyProperty="CannotUpdateReadOnlyProperty",t}(u.CommonResourceStrings);t.ResourceStrings=F,a.CoreUtility.addResourceStringValues({CannotRegisterEvent:"The event handler cannot be registered.",PropertyNotLoaded:"The property '{0}' is not available. Before reading the property's value, call the load method on the containing object and call \"context.sync()\" on the associated request context.",RunMustReturnPromise:'The batch function passed to the ".run" method didn\'t return a promise. The function must return a promise, so that any automatically-tracked objects can be released at the completion of the batch operation. Typically, you return a promise by returning the response from "context.sync()".',InvalidOrTimedOutSessionMessage:"Your Office Online session has expired or is invalid. To continue, refresh the page.",InvalidOperationInCellEditMode:"Excel is in cell-editing mode. Please exit the edit mode by pressing ENTER or TAB or selecting another cell, and then try again.",CustomFunctionDefintionMissing:"A property with the name '{0}' that represents the function's definition must exist on Excel.Script.CustomFunctions.",CustomFunctionDefintionMissingOnWindow:"A property with the name '{0}' that represents the function's definition must exist on the window object.",CustomFunctionImplementationMissing:"The property with the name '{0}' on Excel.Script.CustomFunctions that represents the function's definition must contain a 'call' property that implements the function.",CustomFunctionNameContainsBadChars:"The function name may only contain letters, digits, underscores, and periods.",CustomFunctionNameCannotSplit:"The function name must contain a non-empty namespace and a non-empty short name.",CustomFunctionUnexpectedNumberOfEntriesInResultBatch:"The batching function returned a number of results that doesn't match the number of parameter value sets that were passed into it.",CustomFunctionCancellationHandlerMissing:"The cancellation handler onCanceled is missing in the function. The handler must be present as the function is defined as cancelable.",CustomFunctionInvalidFunction:"The property with the name '{0}' that represents the function's definition is not a valid function.",CustomFunctionInvalidFunctionMapping:"The property with the name '{0}' on CustomFunctionMappings that represents the function's definition is not a valid function.",CustomFunctionWindowMissing:"The window object was not found.",PendingBatchInProgress:"There is a pending batch in progress. The batch method may not be called inside another batch, or simultaneously with another batch.",NotInsideBatch:"Operations may not be invoked outside of a batch method.",CannotUpdateReadOnlyProperty:"The property '{0}' is read-only and it cannot be updated.",ObjectIsUntracked:"The object is untracked."});var N=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.fixObjectPathIfNecessary=function(e,t){e&&e._objectPath&&t&&e._objectPath.updateUsingObjectData(t,e)},t.load=function(e,t){return e.context.load(e,t),e},t.loadAndSync=function(e,t){return e.context.load(e,t),e.context.sync().then((function(){return e}))},t.retrieve=function(e,n){var r=u._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;r||(r=!t.isSetSupported("RichApiRuntime","1.1"));var o=new g(e,r);return e._retrieve(n,o),o},t.retrieveAndSync=function(e,n){var r=t.retrieve(e,n);return e.context.sync().then((function(){return r}))},t.toJson=function(e,n,r,o){var i={};for(var s in n)void 0!==(a=n[s])&&(i[s]=a);for(var s in r){var a;void 0!==(a=r[s])&&(a[t.fieldName_isCollection]&&void 0!==a[t.fieldName_m__items]?i[s]=a.toJSON().items:i[s]=a.toJSON())}return o&&(i.items=o.map((function(e){return e.toJSON()}))),i},t.throwError=function(e,t,n){throw new a._Internal.RuntimeError({code:e,httpStatusCode:400,message:a.CoreUtility._getResourceString(e,t),debugInfo:n?{errorLocation:n}:void 0})},t.createRuntimeError=function(e,t,n,r,o){return new a._Internal.RuntimeError({code:e,httpStatusCode:r,message:t,debugInfo:{errorLocation:n},data:o})},t.throwIfNotLoaded=function(e,n,r,o){if(!o&&a.CoreUtility.isUndefined(n)&&e.charCodeAt(0)!=t.s_underscoreCharCode)throw t.createPropertyNotLoadedException(r,e)},t.createPropertyNotLoadedException=function(e,t){return new a._Internal.RuntimeError({code:c.propertyNotLoaded,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.propertyNotLoaded,t),debugInfo:e?{errorLocation:e+"."+t}:void 0})},t.createCannotUpdateReadOnlyPropertyException=function(e,t){return new a._Internal.RuntimeError({code:c.cannotUpdateReadOnlyProperty,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.cannotUpdateReadOnlyProperty,t),debugInfo:e?{errorLocation:e+"."+t}:void 0})},t.promisify=function(e){return new Promise((function(t,n){e((function(e){"failed"==e.status?n(e.error):t(e.value)}))}))},t._addActionResultHandler=function(e,t,n){e.context._pendingRequest.addActionResultHandler(t,n)},t._handleNavigationPropertyResults=function(e,t,n){for(var r=0;r<n.length-1;r+=2)a.CoreUtility.isUndefined(t[n[r+1]])||e[n[r]]._handleResult(t[n[r+1]])},t._fixupApiFlags=function(e){return"boolean"==typeof e&&(e=e?1:0),e},t.definePropertyThrowUnloadedException=function(e,n,r){Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get:function(){throw t.createPropertyNotLoadedException(n,r)},set:function(){throw t.createCannotUpdateReadOnlyPropertyException(n,r)}})},t.defineReadOnlyPropertyWithValue=function(e,n,r){Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return r},set:function(){throw t.createCannotUpdateReadOnlyPropertyException(null,n)}})},t.processRetrieveResult=function(e,n,r,o){if(!a.CoreUtility.isNullOrUndefined(n))if(o){var i=n[y.itemsLowerCase];if(Array.isArray(i)){for(var s=[],u=0;u<i.length;u++){var c=o(i[u],u),l={};l[y.proxy]=c,c._handleRetrieveResult(i[u],l),s.push(l)}t.defineReadOnlyPropertyWithValue(r,y.itemsLowerCase,s)}}else{var d=e[y.scalarPropertyNames],p=e[y.navigationPropertyNames],f=e[y.className];if(d)for(u=0;u<d.length;u++){var h=n[m=d[u]];a.CoreUtility.isUndefined(h)?t.definePropertyThrowUnloadedException(r,f,m):t.defineReadOnlyPropertyWithValue(r,m,h)}if(p)for(u=0;u<p.length;u++){var m;if(h=n[m=p[u]],a.CoreUtility.isUndefined(h))t.definePropertyThrowUnloadedException(r,f,m);else{var g=e[m],b={};g._handleRetrieveResult(h,b),b[y.proxy]=g,Array.isArray(b[y.itemsLowerCase])&&(b=b[y.itemsLowerCase]),t.defineReadOnlyPropertyWithValue(r,m,b)}}}},t.setMockData=function(e,n,r,o){if(a.CoreUtility.isNullOrUndefined(n))e._handleResult(n);else{if(e[y.scalarPropertyOriginalNames]){for(var i={},s=e[y.scalarPropertyOriginalNames],u=e[y.scalarPropertyNames],c=0;c<u.length;c++)void 0!==n[u[c]]&&(i[s[c]]=n[u[c]]);e._handleResult(i)}if(e[y.navigationPropertyNames]){var l=e[y.navigationPropertyNames];for(c=0;c<l.length;c++)if(void 0!==n[l[c]]){var d=e[l[c]];d.setMockData&&d.setMockData(n[l[c]])}}if(e[y.isCollection]&&r){var p=Array.isArray(n)?n:n[y.itemsLowerCase];if(Array.isArray(p)){var f=[];for(c=0;c<p.length;c++){var h=r(p,c);t.setMockData(h,p[c]),f.push(h)}o(f)}}}},t.applyMixin=function(e,t){Object.getOwnPropertyNames(t.prototype).forEach((function(n){"constructor"!==n&&Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))}))},t.fieldName_m__items="m__items",t.fieldName_isCollection="_isCollection",t._synchronousCleanup=!1,t.s_underscoreCharCode="_".charCodeAt(0),t}(u.CommonUtility);t.Utility=N},function(e,t){var n,r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function o(e){return window[e.platform===Office.PlatformType.OfficeOnline?"_OfficeRuntimeWeb":"_OfficeRuntimeNative"]}function i(e){return function(t){return function(e,t){return s((function(n){return n[e][t]}))}(e,t)}}function s(e){return function(){var t=this,n=arguments;return Office.onReady().then((function(r){return e(o(r)).apply(t,n)}))}}Office.onReady((function(e){window.OfficeRuntime=r(r({},window.OfficeRuntime),o(e))})),window.OfficeRuntime={AsyncStorage:function(){return{getItem:e("getItem"),setItem:e("setItem"),removeItem:e("removeItem"),getAllKeys:e("getAllKeys"),multiSet:e("multiSet"),multiRemove:e("multiRemove"),multiGet:e("multiGet")};function e(e){return s((function(t){return t.storage[e]}))}}(),displayWebDialog:s((function(e){return e.displayWebDialog})),storage:function(){return{getItem:e("getItem"),setItem:e("setItem"),removeItem:e("removeItem"),getKeys:e("getKeys"),setItems:e("setItems"),removeItems:e("removeItems"),getItems:e("getItems")};function e(e){return s((function(t){return t.storage[e]}))}}(),experimentation:function(){return{getBooleanFeatureGateAsync:e("getBooleanFeatureGateAsync"),getIntFeatureGateAsync:e("getIntFeatureGateAsync"),getStringFeatureGateAsync:e("getStringFeatureGateAsync")};function e(e){return s((function(t){return t.experimentation[e]}))}}(),apiInformation:{isSetSupported:function(e,t){return Office.context.requirements.isSetSupported(e,Number(t))}},message:(n=i("message"),{on:n("on"),off:n("off"),emit:n("emit")}),auth:{getAccessToken:i("auth")("getAccessToken")},ui:{getRibbon:i("ui")("getRibbon")}}},function(e,t){!function(e){"use strict";if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,r="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,i="ArrayBuffer"in e;if(i)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=function(e){return e&&DataView.prototype.isPrototypeOf(e)},u=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};h.prototype.append=function(e,t){e=d(e),t=p(t);var n=this.map[e];this.map[e]=n?n+","+t:t},h.prototype.delete=function(e){delete this.map[d(e)]},h.prototype.get=function(e){return e=d(e),this.has(e)?this.map[e]:null},h.prototype.has=function(e){return this.map.hasOwnProperty(d(e))},h.prototype.set=function(e,t){this.map[d(e)]=p(t)},h.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},h.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),f(e)},h.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),f(e)},h.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),f(e)},n&&(h.prototype[Symbol.iterator]=h.prototype.entries);var c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},_.call(v.prototype),_.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},O.error=function(){var e=new O(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];O.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new O(null,{status:t,headers:{location:e}})},e.Headers=h,e.Request=v,e.Response=O,e.fetch=function(e,t){return new Promise((function(n,o){var i=new v(e,t),s=new XMLHttpRequest;s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new h,e.split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;n(new O(o,r))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials&&(s.withCredentials=!0),"responseType"in s&&r&&(s.responseType="blob"),i.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),s.send(void 0===i._bodyInit?null:i._bodyInit)}))},e.fetch.polyfill=!0}function d(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function p(e){return"string"!=typeof e&&(e=String(e)),e}function f(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function m(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function g(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function y(e){var t=new FileReader,n=g(t);return t.readAsArrayBuffer(e),n}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(r&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(o&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(i&&r&&a(e))this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(e)&&!u(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=b(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var e=m(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?m(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var e,t,n,r=m(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,n=g(t=new FileReader),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(P)}),this.json=function(){return this.text().then(JSON.parse)},this}function v(e,t){var n,r,o=(t=t||{}).body;if(e instanceof v){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new h(e.headers)),this.method=e.method,this.mode=e.mode,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new h(t.headers)),this.method=(r=(n=t.method||this.method||"GET").toUpperCase(),c.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function P(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}})),t}function O(e,t){t||(t={}),this.type="default",this.status="status"in t?t.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8);t.default=function(e){function t(){Office.onReady((function(e){e.host===Office.HostType.Excel?function e(){CustomFunctionMappings&&CustomFunctionMappings.__delay__?setTimeout(e,50):r.CustomFunctions.initialize()}():console.warn("Warning: Expected to be loaded inside of an Excel add-in.")}))}window.CustomFunctions=window.CustomFunctions||{},window.CustomFunctions.setCustomFunctionInvoker=r.setCustomFunctionInvoker,window.CustomFunctions.Error=r.CustomFunctionError,window.CustomFunctions.ErrorCode=r.ErrorCode,window.CustomFunctions.FormattedNumber=r.CustomFunctionFormattedNumber,window.CustomFunctions.Entity=r.CustomFunctionEntity,window.CustomFunctions.WebImage=r.CustomFunctionWebImage,window.CustomFunctions.Attribution=r.CustomFunctionAttribution,window.CustomFunctions.Provider=r.CustomFunctionProvider,r.setCustomFunctionAssociation(window.CustomFunctions._association),e&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t())}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CustomFunctionsContainer=t.CustomFunctions=t.setCustomFunctionInvoker=t.setCustomFunctionAssociation=t.customFunctionProxy=t.CustomFunctionProxy=t.CreateCustomFunctionInstance=t.CustomFunctionProvider=t.CustomFunctionAttribution=t.CustomFunctionWebImage=t.CustomFunctionFormattedNumber=t.CustomFunctionEntity=t.CustomFunctionError=t.ErrorCode=t.InvocationContext=t.Script=void 0;var i=n(2),s=n(0),a=i.BatchApiHelper.createPropertyObject,u=(i.BatchApiHelper.createMethodObject,i.BatchApiHelper.createIndexerObject,i.BatchApiHelper.createRootServiceObject),c=i.BatchApiHelper.createTopLevelServiceObject,l=(i.BatchApiHelper.createChildItemObject,i.BatchApiHelper.invokeMethod),d=(i.BatchApiHelper.invokeEnsureUnchanged,i.BatchApiHelper.invokeSetProperty,i.Utility.isNullOrUndefined),p=(i.Utility.isUndefined,i.Utility.throwIfNotLoaded,i.Utility.throwIfApiNotSupported),f=i.Utility.load,h=(i.Utility.retrieve,i.Utility.toJson),m=i.Utility.fixObjectPathIfNecessary,g=i.Utility._handleNavigationPropertyResults,y=(i.Utility.adjustToDateTime,i.Utility.processRetrieveResult),b=(i.Utility.setMockData,i.CommonUtility.calculateApiFlags,function(e){function t(t){var n=e.call(this,t)||this;return n.m_customFunctions=N.newObject(n),n.m_container=u(U,n),n._rootObject=n.m_container,n._rootObjectPropertyName="customFunctionsContainer",n._requestFlagModifier=2176,n}return o(t,e),Object.defineProperty(t.prototype,"customFunctions",{get:function(){return this.m_customFunctions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customFunctionsContainer",{get:function(){return this.m_container},enumerable:!1,configurable:!0}),t.prototype._processOfficeJsErrorResponse=function(e,t){5004===e&&(t.ErrorCode=x.invalidOperationInCellEditMode,t.ErrorMessage=i.Utility._getResourceString(i.ResourceStrings.invalidOperationInCellEditMode))},t}(i.ClientRequestContext));t.Script={_CustomFunctionMetadata:{}};var _,v=function(){function e(e,t,n,r,o){this._functionName=e,d(t)||(this._address=t),d(n)||(this._parameterAddresses=n),this.setResult=r,this.setError=o}return Object.defineProperty(e.prototype,"onCanceled",{get:function(){if(!d(this._onCanceled)&&"function"==typeof this._onCanceled)return this._onCanceled},set:function(e){this._onCanceled=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"functionName",{get:function(){return this._functionName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"address",{get:function(){return this._address},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parameterAddresses",{get:function(){return this._parameterAddresses},enumerable:!1,configurable:!0}),e}();t.InvocationContext=v,function(e){e.Info="Medium",e.Error="Unexpected",e.Verbose="Verbose"}(_||(_={}));var P,O=function(e,t){this.Severity=e,this.Message=t},C=function(){function e(){}return e.logEvent=function(t,n,r){if(e.s_shouldLog||i.CoreUtility._logEnabled){var o=t.Severity+" "+t.Message+n;if(r&&(o=o+" "+r),i.Utility.log(o),e.s_shouldLog)switch(t.Severity){case _.Verbose:null!==console.log&&console.log(o);break;case _.Info:null!==console.info&&console.info(o);break;case _.Error:null!==console.error&&console.error(o)}}},e.shouldLog=function(){try{return!d(console)&&!d(window)&&window.name&&"string"==typeof window.name&&JSON.parse(window.name)[e.CustomFunctionLoggingFlag]}catch(e){return i.Utility.log(JSON.stringify(e)),!1}},e.CustomFunctionLoggingFlag="CustomFunctionsRuntimeLogging",e.s_shouldLog=e.shouldLog(),e}();!function(e){e.invalidValue="#VALUE!",e.notAvailable="#N/A",e.divisionByZero="#DIV/0!",e.invalidNumber="#NUM!",e.nullReference="#NULL!",e.invalidName="#NAME?",e.invalidReference="#REF!"}(P=t.ErrorCode||(t.ErrorCode={}));var I=function(e){function t(n,r,o){var i=e.call(this,r||"")||this;return i.type=t.valueType,i.basicType=t.valueType,Object.setPrototypeOf(i,t.prototype),i.code=n||P.invalidValue,i.basicValue=n||P.invalidValue,i.errorSubType=o,i.stack=void 0,i}return o(t,e),t.prototype.toJSON=function(){return{valueType:"CustomFunctionError",code:this.code,type:this.type,basicValue:this.basicValue,basicType:this.type,errorSubType:this.errorSubType,message:this._getMessage(),errorType:this._getErrorType()}},t.prototype._getErrorType=function(){switch(this.basicValue){case P.invalidValue:return"Value";case P.divisionByZero:return"Div0";case P.notAvailable:return"Na";case P.invalidNumber:return"Num";case P.invalidName:return"Name";case P.invalidReference:return"Ref";case P.nullReference:return"Null";default:return}},t.prototype._getMessage=function(){switch(this.basicValue){case P.invalidValue:case P.notAvailable:return""==this.message?void 0:this.message;case P.divisionByZero:case P.invalidNumber:case P.invalidName:case P.invalidReference:case P.nullReference:default:return}},t.valueType="Error",t}(Error);t.CustomFunctionError=I;var R=function(){function e(t,n){this.type=e.valueType,this.basicValue="#VALUE!",this.basicType="Error",Object.setPrototypeOf(this,e.prototype),this.text=t,this.properties=n}return e.prototype.toJSON=function(){return{type:this.type,text:this.text,basicValue:this.basicValue,basicType:this.basicType,properties:this.properties}},e.valueType="Entity",e}();t.CustomFunctionEntity=R;var j=function(){function e(t,n){this.type=e.valueType,this.basicValue=t,this.numberFormat=n}return e.prototype.toJSON=function(){return{type:this.type,basicValue:this.basicValue,numberFormat:this.numberFormat}},e.valueType="FormattedNumber",e}();t.CustomFunctionFormattedNumber=j;var E=function(){function e(t,n,r,o,i){this.type=e.valueType,this.basicValue="#VALUE!",this.basicType="Error",this.address=t,null!=o&&(this.attribution=o),null!=i&&(this.provider=i),null!=n&&(this.altText=n),null!=r&&(this.relatedImagesAddress=r)}return e.prototype.toJSON=function(){return{type:this.type,basicValue:this.basicValue,basicType:this.basicType,address:this.address,altText:this.altText,relatedImagesAddress:this.relatedImagesAddress,attribution:null==this.attribution?void 0:this.attribution.map((function(e){return e.toJSON()})),provider:null==this.provider?void 0:this.provider.toJSON()}},e.valueType="WebImage",e}();t.CustomFunctionWebImage=E;var A=function(){function e(e,t,n,r){null!=e&&(this.licenseAddress=e),null!=t&&(this.licenseText=t),null!=n&&(this.sourceAddress=n),null!=r&&(this.sourceText=r)}return e.prototype.toJSON=function(){return{licenseAddress:this.licenseAddress,licenseText:this.licenseText,sourceAddress:this.sourceAddress,sourceText:this.sourceText}},e}();t.CustomFunctionAttribution=A;var S=function(){function e(e,t,n){this.description=e,null!=t&&(this.logoSourceAddress=t),null!=n&&(this.logoTargetAddress=n)}return e.prototype.toJSON=function(){return{description:this.description,logoSourceAddress:this.logoSourceAddress,logoTargetAddress:this.logoTargetAddress}},e}();t.CustomFunctionProvider=S,t.CreateCustomFunctionInstance=function e(t){if(t instanceof Array)return t.map((function(t){return e(t)}));if(!(t instanceof Object))return t;var n=JSON.parse(t.value);switch(n.type){case R.valueType:return new R(n.text,n.properties);case j.valueType:return new j(n.primitive,n.numberFormat);case I.valueType:return new I(n.primitive,void 0,n.errorSubCode);case E.valueType:return new E(n.address,n.altText,n.relatedImagesAddress,n.attribution,n.provider);case"Double":case"String":case"Boolean":return n.primitive;default:throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy.createRichDataFromJsonString")}};var F=function(){function e(){this._whenInit=void 0,this._isInit=!1,this._setResultsDelayMillis=50,this._setResultsOverdueDelayMillis=2e3,this._maxContextSyncExecutionDurationMills=15e3,this._minContextSyncIntervalMills=500,this._smallerMinContextSyncIntervalMills=200,this._maxContextSyncIntervalMills=2e3,this._setResultsLifeMillis=6e4,this._ensureInitRetryDelayMillis=500,this._resultEntryBuffer={},this._resultEntryRetryBuffer={},this._retryBufferBodySize=0,this._isSetResultsTaskScheduled=!1,this._setResultsTaskOverdueTime=0,this._inProgressContextSyncExpectedFinishTime=0,this._batchQuotaMillis=1e3,this._invocationContextMap={},this._maxResultSize=2e6}return e.prototype._initSettings=function(){if("object"==typeof t.Script&&"object"==typeof t.Script._CustomFunctionSettings){if("number"==typeof t.Script._CustomFunctionSettings.setResultsDelayMillis){var e=t.Script._CustomFunctionSettings.setResultsDelayMillis;e=Math.max(0,e),e=Math.min(1e3,e),this._setResultsDelayMillis=e}if("number"==typeof t.Script._CustomFunctionSettings.ensureInitRetryDelayMillis){var n=t.Script._CustomFunctionSettings.ensureInitRetryDelayMillis;n=Math.max(0,n),n=Math.min(2e3,n),this._ensureInitRetryDelayMillis=n}if("number"==typeof t.Script._CustomFunctionSettings.setResultsLifeMillis){var r=t.Script._CustomFunctionSettings.setResultsLifeMillis;r=Math.max(0,r),r=Math.min(6e5,r),this._setResultsLifeMillis=r}if("number"==typeof t.Script._CustomFunctionSettings.batchQuotaMillis){var o=t.Script._CustomFunctionSettings.batchQuotaMillis;o=Math.max(0,o),o=Math.min(1e3,o),this._batchQuotaMillis=o}}},e.prototype.ensureInit=function(e){var t=this;return this._initSettings(),void 0===this._whenInit&&(this._whenInit=i.Utility._createPromiseFromResult(null).then((function(){if(!t._isInit)return e.eventRegistration.register(5,"",t._handleMessage.bind(t))})).then((function(){t._isInit=!0}))),this._isInit||e._pendingRequest._addPreSyncPromise(this._whenInit),this._whenInit},e.prototype.setCustomFunctionInvoker=function(e){"object"==typeof CustomFunctionMappings&&delete CustomFunctionMappings.__delay__,this._invoker=e},e.prototype.setCustomFunctionAssociation=function(e){var t=this;this._customFunctionMappingsUpperCase=void 0,this._association=e,this._association&&this._association.onchange((function(){t._customFunctionMappingsUpperCase=void 0}))},e.prototype._initFromHostBridge=function(e){var t=this;this._initSettings(),e.addHostMessageHandler((function(e){3===e.type?t._handleMessage(e.message):4===e.type&&t._handleSettings(e.message)})),this._isInit=!0,this._whenInit=i.CoreUtility.Promise.resolve()},e.prototype._handleSettings=function(e){i.Utility.log("CustomFunctionProxy._handleSettings:"+JSON.stringify(e)),e&&"object"==typeof e&&(C.s_shouldLog=e[C.CustomFunctionLoggingFlag])},e.prototype._handleMessage=function(t){try{i.Utility.log("CustomFunctionProxy._handleMessage"),i.Utility.checkArgumentNull(t,"args");for(var n=t.entries,r=[],o=[],s=[],a=0;a<n.length;a++)1===n[a].messageCategory&&("string"==typeof n[a].message&&(n[a].message=JSON.parse(n[a].message)),1e3===n[a].messageType?r.push(n[a]):1001===n[a].messageType?o.push(n[a]):1002===n[a].messageType?s.push(n[a]):i.Utility.log("CustomFunctionProxy._handleMessage unknown message type "+n[a].messageType));if(s.length>0&&this._handleMetadataEntries(s),r.length>0){var u=this._batchInvocationEntries(r);u.length>0&&this._invokeRemainingBatchEntries(u,0)}o.length>0&&this._handleCancellationEntries(o)}catch(t){throw e._tryLog(t),t}return i.Utility._createPromiseFromResult(null)},e.toLogMessage=function(e){var t="Unknown Error";if(e)try{e.toString&&(t=e.toString()),t=t+" "+JSON.stringify(e)}catch(e){t="Unexpected Error"}return t},e._tryLog=function(t){var n=e.toLogMessage(t);i.Utility.log(n)},e.prototype._handleMetadataEntries=function(e){for(var n=0;n<e.length;n++){var r=e[n].message;if(d(r))throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy._handleMetadataEntries");t.Script._CustomFunctionMetadata[r.functionName]={options:{stream:r.isStream,cancelable:r.isCancelable}}}},e.prototype._handleCancellationEntries=function(t){for(var n=0;n<t.length;n++){var r=t[n].message;if(d(r))throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy._handleCancellationEntries");var o=r.invocationId,s=this._invocationContextMap[o];d(s)||(delete this._invocationContextMap[o],C.logEvent(e.CustomFunctionCancellation,s.functionName),d(s.onCanceled)||s.onCanceled())}},e.prototype._transferCustomFunctionError=function(e){var t=this;return e.map((function(e,n){return null===e?e:null!=e.code&&"CustomFunctionError"==e.type?new I(e.code):e instanceof Array?t._transferCustomFunctionError(e):e}))},e.prototype._transferCustomFunctionRichData=function(e){var t=this;return e.map((function(e,n){return e instanceof Array?t._transferCustomFunctionRichData(e):e instanceof Object?JSON.parse(e.value):e}))},e.prototype._batchInvocationEntries=function(n){for(var r=this,o=[],s=function(s){var u,c=n[s].message;if(Array.isArray(c)?(u={invocationId:c[0],functionName:c[1],parameterValues:c[2],address:c[3],flags:c[4],parameterAddresses:null},d(c[5])||(u.parameterAddresses=c[5])):u=c,d(u))throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy._batchInvocationEntries");if(d(u.invocationId)||u.invocationId<0)throw i.Utility.createRuntimeError(x.generalException,"invocationId","CustomFunctionProxy._batchInvocationEntries");if(d(u.functionName))throw i.Utility.createRuntimeError(x.generalException,"functionName","CustomFunctionProxy._batchInvocationEntries");var l=null,p=!1,f=!1,h=!1;if("number"==typeof u.flags)p=0!=(1&u.flags),f=0!=(2&u.flags),h=0!=(4&u.flags),0!=(8&u.flags)&&(u.parameterValues=a._transferCustomFunctionRichData(u.parameterValues)),h&&(u.parameterValues=a._transferCustomFunctionError(u.parameterValues));else{var m=t.Script._CustomFunctionMetadata[u.functionName];if(d(m))return C.logEvent(e.CustomFunctionExecutionNotFoundLog,u.functionName),i.Utility.isSetSupported("CustomFunctions","1.8")?a._setError(u.invocationId,null,9):a._setError(u.invocationId,"N/A",1),"continue";p=m.options.cancelable,f=m.options.stream}if(a._invoker&&!a._customFunctionMappingsContains(u.functionName))return a._invokeFunctionUsingInvoker(u),"continue";try{l=a._getFunction(u.functionName)}catch(t){return C.logEvent(e.CustomFunctionExecutionNotFoundLog,u.functionName),i.Utility.isSetSupported("CustomFunctions","1.8")?a._setError(u.invocationId,t,10):a._setError(u.invocationId,t,1),"continue"}var g=void 0;if(f||p){var y=void 0,b=void 0;f&&(y=function(t){r._invocationContextMap[u.invocationId]?r._setResult(u.invocationId,t):C.logEvent(e.CustomFunctionAlreadyCancelled,u.functionName)},b=function(t){r._invocationContextMap[u.invocationId]?r._setError(u.invocationId,t.message,r._getCustomFunctionResultErrorCodeFromErrorCode(t.code)):C.logEvent(e.CustomFunctionAlreadyCancelled,u.functionName)}),g=new v(u.functionName,u.address,u.parameterAddresses,y,b),a._invocationContextMap[u.invocationId]=g}else g=new v(u.functionName,u.address,u.parameterAddresses);u.parameterValues.push(g),o.push({call:l,isBatching:!1,isStreaming:f,invocationIds:[u.invocationId],parameterValueSets:[u.parameterValues],functionName:u.functionName})},a=this,u=0;u<n.length;u++)s(u);return o},e.prototype._invokeFunctionUsingInvoker=function(e){var t=this,n=0!=(1&e.flags),r=0!=(2&e.flags),o=e.invocationId,i=void 0,s=void 0;if(r)i=function(e){t._invocationContextMap[o]&&t._setResult(o,e)},s=function(e){t._invocationContextMap[o]&&t._setError(o,e.message,t._getCustomFunctionResultErrorCodeFromErrorCode(e.code))};else{var a=!1;i=function(e){a||t._setResult(o,e),a=!0},s=function(e){a||t._setError(o,e.message,t._getCustomFunctionResultErrorCodeFromErrorCode(e.code)),a=!0}}var u=new v(e.functionName,e.address,e.parameterAddresses,i,s);(r||n)&&(this._invocationContextMap[o]=u),this._invoker.invoke(e.functionName,e.parameterValues,u)},e.prototype._ensureCustomFunctionMappingsUpperCase=function(){if(d(this._customFunctionMappingsUpperCase)){if(this._customFunctionMappingsUpperCase={},"object"==typeof CustomFunctionMappings)for(var t in i.CoreUtility.log("CustomFunctionMappings.Keys="+JSON.stringify(Object.keys(CustomFunctionMappings))),CustomFunctionMappings)this._customFunctionMappingsUpperCase[t.toUpperCase()]&&C.logEvent(e.CustomFunctionDuplicatedName,t),this._customFunctionMappingsUpperCase[t.toUpperCase()]=CustomFunctionMappings[t];if(this._association)for(var t in i.CoreUtility.log("CustomFunctionAssociateMappings.Keys="+JSON.stringify(Object.keys(this._association.mappings))),this._association.mappings)this._customFunctionMappingsUpperCase[t.toUpperCase()]&&C.logEvent(e.CustomFunctionDuplicatedName,t),this._customFunctionMappingsUpperCase[t.toUpperCase()]=this._association.mappings[t]}},e.prototype._customFunctionMappingsContains=function(e){this._ensureCustomFunctionMappingsUpperCase();var t=e.toUpperCase();if(!d(this._customFunctionMappingsUpperCase[t]))return!0;if("undefined"!=typeof window){for(var n=window,r=e.split("."),o=0;o<r.length-1;o++)if(n=n[r[o]],d(n)||"object"!=typeof n)return!1;if("function"==typeof n[r[r.length-1]])return!0}return!1},e.prototype._getCustomFunctionMappings=function(e){this._ensureCustomFunctionMappingsUpperCase();var t=e.toUpperCase();if(!d(this._customFunctionMappingsUpperCase[t])){if("function"==typeof this._customFunctionMappingsUpperCase[t])return this._customFunctionMappingsUpperCase[t];throw i.Utility.createRuntimeError(x.invalidOperation,i.Utility._getResourceString(i.ResourceStrings.customFunctionInvalidFunctionMapping,e),"CustomFunctionProxy._getCustomFunctionMappings")}},e.prototype._getFunction=function(e){var t=this._getCustomFunctionMappings(e);if(!d(t))return t;if(d(window))throw i.Utility.createRuntimeError(x.invalidOperation,i.Utility._getResourceString(i.ResourceStrings.customFunctionWindowMissing),"CustomFunctionProxy._getFunction");for(var n=window,r=e.split("."),o=0;o<r.length-1;o++)if(n=n[r[o]],d(n)||"object"!=typeof n)throw i.Utility.createRuntimeError(x.invalidOperation,i.Utility._getResourceString(i.ResourceStrings.customFunctionDefintionMissingOnWindow,e),"CustomFunctionProxy._getFunction");if("function"!=typeof(t=n[r[r.length-1]]))throw i.Utility.createRuntimeError(x.invalidOperation,i.Utility._getResourceString(i.ResourceStrings.customFunctionInvalidFunction,e),"CustomFunctionProxy._getFunction");return t},e.prototype._invokeRemainingBatchEntries=function(e,t){i.Utility.log("CustomFunctionProxy._invokeRemainingBatchEntries");for(var n=Date.now(),r=t;r<e.length;r++){if(!(Date.now()-n<this._batchQuotaMillis)){i.Utility.log("setTimeout(CustomFunctionProxy._invokeRemainingBatchEntries)"),setTimeout(this._invokeRemainingBatchEntries.bind(this),0,e,r);break}this._invokeFunctionAndSetResult(e[r])}},e.prototype._invokeFunctionAndSetResult=function(t){var n,r=this;C.logEvent(e.CustomFunctionExecutionStartLog,t.functionName);var o=Date.now();try{n=t.isBatching?t.call.call(null,t.parameterValueSets):[t.call.apply(null,t.parameterValueSets[0])]}catch(n){var s=[];s.push(Date.now()-o);for(var a=0;a<t.invocationIds.length;a++)n instanceof I?this._setErrorWithOutboundData(t.invocationIds[a],n.message,this._getCustomFunctionResultErrorCodeFromErrorCode(n.code),s):this._setErrorWithOutboundData(t.invocationIds[a],n,2,s);return void C.logEvent(e.CustomFunctionExecutionExceptionThrownLog,t.functionName,e.toLogMessage(n))}var u=[];if(N.isFeatureEnabled(3)||u.push(Date.now()-o),t.isStreaming);else if(n.length===t.parameterValueSets.length){var c=function(i){d(n[i])||"object"!=typeof n[i]||"function"!=typeof n[i].then?(N.isFeatureEnabled(3)&&u.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionFinishLog,t.functionName),l._setResultWithOutboundData(t.invocationIds[i],n[i],u)):n[i].then((function(n){N.isFeatureEnabled(3)&&u.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionFinishLog,t.functionName),r._setResultWithOutboundData(t.invocationIds[i],n,u)}),(function(n){N.isFeatureEnabled(3)&&u.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionRejectedPromoseLog,t.functionName,e.toLogMessage(n)),n instanceof I?r._setErrorWithOutboundData(t.invocationIds[i],n,r._getCustomFunctionResultErrorCodeFromErrorCode(n.code),u):r._setErrorWithOutboundData(t.invocationIds[i],n,3,u)}))},l=this;for(a=0;a<n.length;a++)c(a)}else for(N.isFeatureEnabled(3)&&u.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionBatchMismatchLog,t.functionName),a=0;a<t.invocationIds.length;a++)this._setErrorWithOutboundData(t.invocationIds[a],i.Utility._getResourceString(i.ResourceStrings.customFunctionUnexpectedNumberOfEntriesInResultBatch),4,u)},e.prototype._setResult=function(e,t){var n=[];n.push(0),this._setResultWithOutboundData(e,t,n)},e.prototype._setResultWithOutboundData=function(t,n,r){var o={id:t,value:n,outboundData:r};"number"==typeof n?isNaN(n)?(o.failed=!0,o.value="NaN"):isFinite(n)||(o.failed=!0,o.value="Infinity",o.errorCode=6):n instanceof I||n instanceof R||n instanceof j||n instanceof E?(o.failed=!1,o.value=n.toJSON()):n instanceof Error&&(o.failed=!0,o.value=e.toLogMessage(n),o.errorCode=0);var i=Date.now();this._resultEntryBuffer[t]={timeCreated:i,result:o},this._ensureSetResultsTaskIsScheduled(i)},e.prototype._setError=function(e,t,n){var r=[];r.push(0),this._setErrorWithOutboundData(e,t,n,r)},e.prototype._setErrorWithOutboundData=function(e,t,n,r){var o="";d(t)||(t instanceof I&&!d(t.message)?o=t.message:"string"==typeof t&&(o=t));var i={id:e,failed:!0,value:o,errorCode:n,outboundData:r},s=Date.now();this._resultEntryBuffer[e]={timeCreated:s,result:i},this._ensureSetResultsTaskIsScheduled(s)},e.prototype._getCustomFunctionResultErrorCodeFromErrorCode=function(e){var t;switch(e){case P.notAvailable:t=1;break;case P.divisionByZero:t=5;break;case P.invalidValue:t=7;break;case P.invalidNumber:t=6;break;case P.nullReference:t=8;break;default:t=7}return t},e.prototype._ensureSetResultsTaskIsScheduled=function(e){if(this._setResultsTaskOverdueTime>0&&e>this._setResultsTaskOverdueTime)return i.Utility.log("SetResultsTask overdue"),void this._executeSetResultsTask();this._isSetResultsTaskScheduled||(i.Utility.log("setTimeout(CustomFunctionProxy._executeSetResultsTask)"),setTimeout(this._executeSetResultsTask.bind(this),this._setResultsDelayMillis),this._isSetResultsTaskScheduled=!0,this._setResultsTaskOverdueTime=e+this._setResultsDelayMillis+this._setResultsOverdueDelayMillis)},e.prototype._convertCustomFunctionInvocationResultToArray=function(e){var t=[];return t.push(e.id),t.push(!e.failed),i.CoreUtility.isUndefined(e.value)?t.push(null):t.push(e.value),e.failed&&(i.CoreUtility.isUndefined(e.errorCode)?t.push(0):t.push(e.errorCode)),i.Utility.isSetSupported("CustomFunctions","1.9")&&t.push(e.outboundData),t},e.prototype._executeSetResultsTask=function(){var e=this;i.Utility.log("CustomFunctionProxy._executeSetResultsTask");var t=Date.now();if(this._inProgressContextSyncExpectedFinishTime>0&&this._inProgressContextSyncExpectedFinishTime>t)return i.Utility.log("context.sync() is in progress. setTimeout(CustomFunctionProxy._executeSetResultsTask)"),setTimeout(this._executeSetResultsTask.bind(this),this._setResultsDelayMillis),void(this._setResultsTaskOverdueTime=t+this._setResultsDelayMillis+this._setResultsOverdueDelayMillis);this._isSetResultsTaskScheduled=!1,this._setResultsTaskOverdueTime=0;var n={},r=!1;N.isFeatureEnabled(1)&&Object.keys(this._resultEntryRetryBuffer).length>0?(n=this._resultEntryRetryBuffer,this._resultEntryRetryBuffer={},this._retryBufferBodySize=2,r=!0):(n=this._resultEntryBuffer,this._resultEntryBuffer={});var o=i.Utility.isSetSupported("CustomFunctions","1.7"),s=[];for(var a in n)o?s.push(this._convertCustomFunctionInvocationResultToArray(n[a].result)):s.push(n[a].result);if(0!==s.length){var u=new b;o?u.customFunctions.setInvocationArrayResults(s):u.customFunctions.setInvocationResults(s);var c=Date.now();this._inProgressContextSyncExpectedFinishTime=c+this._maxContextSyncExecutionDurationMills,u.sync().then((function(t){var n=Date.now();e._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval(n-c),r&&e._ensureSetResultsTaskIsScheduled(n)}),(function(t){var r=Date.now();e._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval(r-c),N.isFeatureEnabled(1)&&t.code==i.ErrorCodes.requestPayloadSizeLimitExceeded?e._restoreAndSliceResultEntries(r,n):e._restoreResultEntries(r,n),e._ensureSetResultsTaskIsScheduled(r)}))}},e.prototype._restoreResultEntries=function(e,t){for(var n in t){var r=t[n];e-r.timeCreated<=this._setResultsLifeMillis&&(this._resultEntryBuffer[n]||(this._resultEntryBuffer[n]=r))}},e.prototype._restoreAndSliceResultEntries=function(e,t){for(var n in t){var r=t[n],o=void 0;if(e-r.timeCreated<=this._setResultsLifeMillis&&!this._resultEntryBuffer[n]){try{o=JSON.stringify(this._convertCustomFunctionInvocationResultToArray(r.result)).length+1}catch(e){this._resultEntryBuffer[n]=r,i.Utility.log("Result can't pass in JSON.stringify");continue}this._retryBufferBodySize+o<this._maxResultSize?(this._resultEntryRetryBuffer[n]=r,this._retryBufferBodySize+=o):this._resultEntryBuffer[n]=r}}},e.prototype._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval=function(e){var t=this,n=N.isFeatureEnabled(2)?this._smallerMinContextSyncIntervalMills:this._minContextSyncIntervalMills,r=Math.max(n,2*e),o=N.isFeatureEnabled(4)?Math.min(this._maxContextSyncIntervalMills,r):r;i.Utility.log("setTimeout(clearInProgressContestSyncExpectedFinishedTime,"+r+")"),setTimeout((function(){i.Utility.log("clearInProgressContestSyncExpectedFinishedTime"),t._inProgressContextSyncExpectedFinishTime=0}),o)},e.CustomFunctionExecutionStartLog=new O(_.Verbose,"CustomFunctions [Execution] [Begin] Function="),e.CustomFunctionExecutionFailureLog=new O(_.Error,"CustomFunctions [Execution] [End] [Failure] Function="),e.CustomFunctionExecutionRejectedPromoseLog=new O(_.Error,"CustomFunctions [Execution] [End] [Failure] [RejectedPromise] Function="),e.CustomFunctionExecutionExceptionThrownLog=new O(_.Error,"CustomFunctions [Execution] [End] [Failure] [ExceptionThrown] Function="),e.CustomFunctionExecutionBatchMismatchLog=new O(_.Error,"CustomFunctions [Execution] [End] [Failure] [BatchMismatch] Function="),e.CustomFunctionExecutionFinishLog=new O(_.Info,"CustomFunctions [Execution] [End] [Success] Function="),e.CustomFunctionExecutionNotFoundLog=new O(_.Error,"CustomFunctions [Execution] [NotFound] Function="),e.CustomFunctionCancellation=new O(_.Info,"CustomFunctions [Cancellation] Function="),e.CustomFunctionAlreadyCancelled=new O(_.Info,"CustomFunctions [AlreadyCancelled] Function="),e.CustomFunctionDuplicatedName=new O(_.Error,"CustomFunctions [DuplicatedName] Function="),e.CustomFunctionInvalidArg=new O(_.Error,"CustomFunctions [InvalidArg] Name="),e}();t.CustomFunctionProxy=F,t.customFunctionProxy=new F,t.setCustomFunctionAssociation=t.customFunctionProxy.setCustomFunctionAssociation.bind(t.customFunctionProxy),t.setCustomFunctionInvoker=t.customFunctionProxy.setCustomFunctionInvoker.bind(t.customFunctionProxy),s.HostBridge.onInited((function(e){t.customFunctionProxy._initFromHostBridge(e)}));var N=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return o(n,e),Object.defineProperty(n.prototype,"_className",{get:function(){return"CustomFunctions"},enumerable:!1,configurable:!0}),n.isFeatureEnabled=function(e){return this._enabledFeature instanceof Array&&this._enabledFeature.indexOf(e)>=0},n.initialize=function(){var e=this,r=new b;return t.customFunctionProxy.ensureInit(r).then((function(){var o;return r.customFunctions._SetOsfControlContainerReadyForCustomFunctions(),i.Utility.isSetSupported("CustomFunctions","1.9")&&(o=r.customFunctions._GetEnabledFeatures()),i.Utility.log("OsfControl activation lifecycle: Set OsfControlContainer ready for CustomFunctions"),r._customData="SetOsfControlContainerReadyForCustomFunctions",r.sync().then((function(){d(o)||(e._enabledFeature=o.value)})).catch((function(e){!function(e,r){var o=e instanceof i.Error&&e.code===x.invalidOperationInCellEditMode;if(i.CoreUtility.log("Error on starting custom functions: "+e),o){i.CoreUtility.log("Was in cell-edit mode, will try again");var s=t.customFunctionProxy._ensureInitRetryDelayMillis;return new i.CoreUtility.Promise((function(e){return setTimeout(e,s)})).then((function(){return n.initialize()}))}throw e}(e)}))}))},n.prototype.setInvocationArrayResults=function(e){p("CustomFunctions.setInvocationArrayResults","CustomFunctions","1.4","Excel"),l(this,"SetInvocationArrayResults",0,[e],2,0)},n.prototype.setInvocationResults=function(e){l(this,"SetInvocationResults",0,[e],2,0)},n.prototype._GetEnabledFeatures=function(){return p("CustomFunctions._GetEnabledFeatures","CustomFunctions","1.4","Excel"),l(this,"_GetEnabledFeatures",1,[],4,0)},n.prototype._SetInvocationError=function(e,t){l(this,"_SetInvocationError",0,[e,t],2,0)},n.prototype._SetInvocationResult=function(e,t){l(this,"_SetInvocationResult",0,[e,t],2,0)},n.prototype._SetOsfControlContainerReadyForCustomFunctions=function(){l(this,"_SetOsfControlContainerReadyForCustomFunctions",0,[],10,0)},n.prototype._handleResult=function(t){e.prototype._handleResult.call(this,t),d(t)||m(this,t)},n.prototype._handleRetrieveResult=function(t,n){e.prototype._handleRetrieveResult.call(this,t,n),y(this,t,n)},n.newObject=function(e){return c(n,e,"Microsoft.ExcelServices.CustomFunctions",!1,4)},n.prototype.toJSON=function(){return h(this,{},{})},n}(i.ClientObject);t.CustomFunctions=N;var x,U=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),Object.defineProperty(t.prototype,"_className",{get:function(){return"CustomFunctionsContainer"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_navigationPropertyNames",{get:function(){return["customFunctions"]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customFunctions",{get:function(){return p("CustomFunctionsContainer.customFunctions","CustomFunctions","1.2","Excel"),this._C||(this._C=a(N,this,"CustomFunctions",!1,4)),this._C},enumerable:!1,configurable:!0}),t.prototype._handleResult=function(t){if(e.prototype._handleResult.call(this,t),!d(t)){var n=t;m(this,n),g(this,n,["customFunctions","CustomFunctions"])}},t.prototype.load=function(e){return f(this,e)},t.prototype._handleRetrieveResult=function(t,n){e.prototype._handleRetrieveResult.call(this,t,n),y(this,t,n)},t.prototype.toJSON=function(){return h(this,{},{})},t}(i.ClientObject);t.CustomFunctionsContainer=U,function(e){e.generalException="GeneralException",e.invalidOperation="InvalidOperation",e.invalidOperationInCellEditMode="InvalidOperationInCellEditMode"}(x||(x={}))}]);



var oteljs=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=19)}([function(t,e,n){"use strict";n.d(e,"a",(function(){return o})),n.d(e,"d",(function(){return a})),n.d(e,"b",(function(){return c})),n.d(e,"e",(function(){return s})),n.d(e,"c",(function(){return u}));var r=n(3),i=n(4);function o(t,e){return{name:t,dataType:r.a.Boolean,value:e,classification:i.a.SystemMetadata}}function a(t,e){return{name:t,dataType:r.a.Int64,value:e,classification:i.a.SystemMetadata}}function c(t,e){return{name:t,dataType:r.a.Double,value:e,classification:i.a.SystemMetadata}}function s(t,e){return{name:t,dataType:r.a.String,value:e,classification:i.a.SystemMetadata}}function u(t,e){return{name:t,dataType:r.a.Guid,value:e,classification:i.a.SystemMetadata}}},function(t,e,n){"use strict";n.d(e,"b",(function(){return r})),n.d(e,"a",(function(){return i})),n.d(e,"e",(function(){return a})),n.d(e,"d",(function(){return c})),n.d(e,"c",(function(){return s}));var r,i,o=new(n(10).a);function a(){return o}function c(t,e,n){o.fireEvent({level:t,category:e,message:n})}function s(t,e,n){c(r.Error,t,(function(){var t=n instanceof Error?n.message:"";return e+": "+t}))}!function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose"}(r||(r={})),function(t){t[t.Core=0]="Core",t[t.Sink=1]="Sink",t[t.Transport=2]="Transport"}(i||(i={}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(0);function i(t,e,n){t.push(Object(r.e)("zC."+e,n))}},function(t,e,n){"use strict";var r;n.d(e,"a",(function(){return r})),function(t){t[t.String=0]="String",t[t.Boolean=1]="Boolean",t[t.Int64=2]="Int64",t[t.Double=3]="Double",t[t.Guid=4]="Guid"}(r||(r={}))},function(t,e,n){"use strict";var r;n.d(e,"a",(function(){return r})),function(t){t[t.EssentialServiceMetadata=1]="EssentialServiceMetadata",t[t.AccountData=2]="AccountData",t[t.SystemMetadata=4]="SystemMetadata",t[t.OrganizationIdentifiableInformation=8]="OrganizationIdentifiableInformation",t[t.EndUserIdentifiableInformation=16]="EndUserIdentifiableInformation",t[t.CustomerContent=32]="CustomerContent",t[t.AccessControl=64]="AccessControl"}(r||(r={}))},function(t,e,n){"use strict";var r,i,o,a,c;n.d(e,"e",(function(){return r})),n.d(e,"d",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return c})),function(t){t[t.NotSet=0]="NotSet",t[t.Measure=1]="Measure",t[t.Diagnostics=2]="Diagnostics",t[t.CriticalBusinessImpact=191]="CriticalBusinessImpact",t[t.CriticalCensus=192]="CriticalCensus",t[t.CriticalExperimentation=193]="CriticalExperimentation",t[t.CriticalUsage=194]="CriticalUsage"}(r||(r={})),function(t){t[t.NotSet=0]="NotSet",t[t.Normal=1]="Normal",t[t.High=2]="High"}(i||(i={})),function(t){t[t.NotSet=0]="NotSet",t[t.Normal=1]="Normal",t[t.High=2]="High"}(o||(o={})),function(t){t[t.NotSet=0]="NotSet",t[t.SoftwareSetup=1]="SoftwareSetup",t[t.ProductServiceUsage=2]="ProductServiceUsage",t[t.ProductServicePerformance=4]="ProductServicePerformance",t[t.DeviceConfiguration=8]="DeviceConfiguration",t[t.InkingTypingSpeech=16]="InkingTypingSpeech"}(a||(a={})),function(t){t[t.ReservedDoNotUse=0]="ReservedDoNotUse",t[t.BasicEvent=10]="BasicEvent",t[t.FullEvent=100]="FullEvent",t[t.NecessaryServiceDataEvent=110]="NecessaryServiceDataEvent",t[t.AlwaysOnNecessaryServiceDataEvent=120]="AlwaysOnNecessaryServiceDataEvent"}(c||(c={}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return p}));var r,i,o,a,c,s,u,d,f,l=n(0),v=n(2);(r||(r={})).getFields=function(t,e){var n=[];return n.push(Object(l.d)(t+".Code",e.code)),void 0!==e.type&&n.push(Object(l.e)(t+".Type",e.type)),void 0!==e.tag&&n.push(Object(l.d)(t+".Tag",e.tag)),void 0!==e.isExpected&&n.push(Object(l.a)(t+".IsExpected",e.isExpected)),Object(v.a)(n,t,"Office.System.Result"),n},(o=i||(i={})).contractName="Office.System.Activity",o.getFields=function(t){var e=[];return void 0!==t.cV&&e.push(Object(l.e)("Activity.CV",t.cV)),e.push(Object(l.d)("Activity.Duration",t.duration)),e.push(Object(l.d)("Activity.Count",t.count)),e.push(Object(l.d)("Activity.AggMode",t.aggMode)),void 0!==t.success&&e.push(Object(l.a)("Activity.Success",t.success)),void 0!==t.result&&e.push.apply(e,r.getFields("Activity.Result",t.result)),Object(v.a)(e,"Activity",o.contractName),e},(a||(a={})).getFields=function(t,e){var n=[];return void 0!==e.id&&n.push(Object(l.e)(t+".Id",e.id)),void 0!==e.version&&n.push(Object(l.e)(t+".Version",e.version)),void 0!==e.sessionId&&n.push(Object(l.e)(t+".SessionId",e.sessionId)),Object(v.a)(n,t,"Office.System.Host"),n},(c||(c={})).getFields=function(t,e){var n=[];return void 0!==e.alias&&n.push(Object(l.e)(t+".Alias",e.alias)),void 0!==e.primaryIdentityHash&&n.push(Object(l.e)(t+".PrimaryIdentityHash",e.primaryIdentityHash)),void 0!==e.primaryIdentitySpace&&n.push(Object(l.e)(t+".PrimaryIdentitySpace",e.primaryIdentitySpace)),void 0!==e.tenantId&&n.push(Object(l.e)(t+".TenantId",e.tenantId)),void 0!==e.tenantGroup&&n.push(Object(l.e)(t+".TenantGroup",e.tenantGroup)),void 0!==e.isAnonymous&&n.push(Object(l.a)(t+".IsAnonymous",e.isAnonymous)),Object(v.a)(n,t,"Office.System.User"),n},(s||(s={})).getFields=function(t,e){var n=[];return void 0!==e.id&&n.push(Object(l.e)(t+".Id",e.id)),void 0!==e.version&&n.push(Object(l.e)(t+".Version",e.version)),void 0!==e.instanceId&&n.push(Object(l.e)(t+".InstanceId",e.instanceId)),void 0!==e.name&&n.push(Object(l.e)(t+".Name",e.name)),void 0!==e.marketplaceType&&n.push(Object(l.e)(t+".MarketplaceType",e.marketplaceType)),void 0!==e.sessionId&&n.push(Object(l.e)(t+".SessionId",e.sessionId)),void 0!==e.browserToken&&n.push(Object(l.e)(t+".BrowserToken",e.browserToken)),void 0!==e.osfRuntimeVersion&&n.push(Object(l.e)(t+".OsfRuntimeVersion",e.osfRuntimeVersion)),void 0!==e.officeJsVersion&&n.push(Object(l.e)(t+".OfficeJsVersion",e.officeJsVersion)),void 0!==e.hostJsVersion&&n.push(Object(l.e)(t+".HostJsVersion",e.hostJsVersion)),void 0!==e.assetId&&n.push(Object(l.e)(t+".AssetId",e.assetId)),void 0!==e.providerName&&n.push(Object(l.e)(t+".ProviderName",e.providerName)),void 0!==e.type&&n.push(Object(l.e)(t+".Type",e.type)),Object(v.a)(n,t,"Office.System.SDX"),n},(u||(u={})).getFields=function(t,e){var n=[];return void 0!==e.name&&n.push(Object(l.e)(t+".Name",e.name)),void 0!==e.state&&n.push(Object(l.e)(t+".State",e.state)),Object(v.a)(n,t,"Office.System.Funnel"),n},(d||(d={})).getFields=function(t,e){var n=[];return void 0!==e.id&&n.push(Object(l.d)(t+".Id",e.id)),void 0!==e.name&&n.push(Object(l.e)(t+".Name",e.name)),void 0!==e.commandSurface&&n.push(Object(l.e)(t+".CommandSurface",e.commandSurface)),void 0!==e.parentName&&n.push(Object(l.e)(t+".ParentName",e.parentName)),void 0!==e.triggerMethod&&n.push(Object(l.e)(t+".TriggerMethod",e.triggerMethod)),void 0!==e.timeOffsetMs&&n.push(Object(l.d)(t+".TimeOffsetMs",e.timeOffsetMs)),Object(v.a)(n,t,"Office.System.UserAction"),n},function(t){t.getFields=function(t,e){var n=[];return n.push(Object(l.e)(t+".ErrorGroup",e.errorGroup)),n.push(Object(l.d)(t+".Tag",e.tag)),void 0!==e.code&&n.push(Object(l.d)(t+".Code",e.code)),void 0!==e.id&&n.push(Object(l.d)(t+".Id",e.id)),void 0!==e.count&&n.push(Object(l.d)(t+".Count",e.count)),Object(v.a)(n,t,"Office.System.Error"),n}}(f||(f={}));var p,y=i,h=r,g=f,m=u,b=a,F=s,O=d,S=c;!function(t){!function(t){!function(t){t.Activity=y,t.Result=h,t.Error=g,t.Funnel=m,t.Host=b,t.SDX=F,t.User=S,t.UserAction=O}(t.System||(t.System={}))}(t.Office||(t.Office={}))}(p||(p={}))},function(t,e,n){"use strict";function r(t){var e={eventName:t.eventName,eventFlags:t.eventFlags};return t.telemetryProperties&&(e.telemetryProperties={ariaTenantToken:t.telemetryProperties.ariaTenantToken,nexusTenantToken:t.telemetryProperties.nexusTenantToken}),t.eventContract&&(e.eventContract={name:t.eventContract.name,dataFields:t.eventContract.dataFields.slice()}),e.dataFields=t.dataFields?t.dataFields.slice():[],e}n.d(e,"a",(function(){return r}))},function(t,e,n){"use strict";n.d(e,"b",(function(){return l})),n.d(e,"a",(function(){return v}));var r,i,o=n(7),a=n(1);!function(t){t[t.Aria=0]="Aria",t[t.Nexus=1]="Nexus"}(r||(r={})),function(t){var e={},n={},i={};function o(t){if("object"!=typeof t)throw new Error("tokenTree must be an object");i=function t(e,n){if("object"!=typeof n)return n;for(var r=0,i=Object.keys(n);r<i.length;r++){var o=i[r];o in e&&(e[o],1)?e[o]=t(e[o],n[o]):e[o]=n[o]}return e}(i,t)}function c(t){if(e[t])return e[t];var n=u(t,r.Aria);return"string"==typeof n?(e[t]=n,n):void 0}function s(t){if(n[t])return n[t];var e=u(t,r.Nexus);return"number"==typeof e?(n[t]=e,e):void 0}function u(t,e){var n=t.split("."),o=i,a=void 0;if(o){for(var c=0;c<n.length-1;c++)o[n[c]]&&(o=o[n[c]],e===r.Aria&&"string"==typeof o.ariaTenantToken?a=o.ariaTenantToken:e===r.Nexus&&"number"==typeof o.nexusTenantToken&&(a=o.nexusTenantToken));return a}}t.setTenantToken=function(t,e,n){var r=t.split(".");if(r.length<2||"Office"!==r[0])Object(a.d)(a.b.Error,a.a.Core,(function(){return"Invalid namespace: "+t}));else{var i=Object.create(Object.prototype);e&&(i.ariaTenantToken=e),n&&(i.nexusTenantToken=n);var c,s=i;for(c=r.length-1;c>=0;--c){var u=Object.create(Object.prototype);u[r[c]]=s,s=u}o(s)}},t.setTenantTokens=o,t.getTenantTokens=function(t){var e=c(t),n=s(t);if(!n||!e)throw new Error("Could not find tenant token for "+t);return{ariaTenantToken:e,nexusTenantToken:n}},t.getAriaTenantToken=c,t.getNexusTenantToken=s,t.clear=function(){e={},n={},i={}}}(i||(i={}));var c,s=n(3);!function(t){var e=/^[A-Z][a-zA-Z0-9]*$/,n=/^[a-zA-Z0-9_\.]*$/;function r(t){return void 0!==t&&n.test(t)}function i(t){if(!((e=t.name)&&r(e)&&e.length+5<100))throw new Error("Invalid dataField name");var e;t.dataType===s.a.Int64&&o(t.value)}function o(t){if("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t<-9007199254740991||t>9007199254740991)throw new Error("Invalid integer "+JSON.stringify(t))}t.validateTelemetryEvent=function(t){if(!function(t){if(!t||t.length>98)return!1;var n=t.split("."),r=n[n.length-1];return function(t){return!!t&&t.length>=3&&"Office"===t[0]}(n)&&(i=r,void 0!==i&&e.test(i));var i}(t.eventName))throw new Error("Invalid eventName");if(t.eventContract&&!r(t.eventContract.name))throw new Error("Invalid eventContract");if(null!=t.dataFields)for(var n=0;n<t.dataFields.length;n++)i(t.dataFields[n])},t.validateInt=o}(c||(c={}));var u=n(10),d=n(0),f=function(){return(f=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},l=-1,v=function(){function t(t,e,n){var r,i;this.onSendEvent=new u.a,this.persistentDataFields=[],this.config=n||{},t&&(this.onSendEvent=t.onSendEvent,(r=this.persistentDataFields).push.apply(r,t.persistentDataFields),this.config=f(f({},t.getConfig()),this.config)),e&&(i=this.persistentDataFields).push.apply(i,e)}return t.prototype.sendTelemetryEvent=function(t){var e;try{if(0===this.onSendEvent.getListenerCount())return void Object(a.d)(a.b.Warning,a.a.Core,(function(){return"No telemetry sinks are attached."}));e=this.cloneEvent(t),this.processTelemetryEvent(e)}catch(t){return void Object(a.c)(a.a.Core,"SendTelemetryEvent",t)}try{this.onSendEvent.fireEvent(e)}catch(t){}},t.prototype.processTelemetryEvent=function(t){var e;t.telemetryProperties||(t.telemetryProperties=i.getTenantTokens(t.eventName)),t.dataFields&&(t.dataFields.unshift(Object(d.e)("OTelJS.Version","3.1.74")),this.persistentDataFields&&(e=t.dataFields).unshift.apply(e,this.persistentDataFields)),this.config.disableValidation||c.validateTelemetryEvent(t)},t.prototype.addSink=function(t){this.onSendEvent.addListener((function(e){return t.sendTelemetryEvent(e)}))},t.prototype.setTenantToken=function(t,e,n){i.setTenantToken(t,e,n)},t.prototype.setTenantTokens=function(t){i.setTenantTokens(t)},t.prototype.cloneEvent=function(t){return Object(o.a)(t)},t.prototype.getConfig=function(){return this.config},t}()},function(t,e,n){"use strict";var r;n.d(e,"a",(function(){return s})),function(t){var e,n=0;t.getNext=function(){return void 0===e&&(e=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=[],n=0;n<22;n++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}()),new r(e,++n)},t.getNextChild=function(t){return new r(t.getString(),++t.nextChild)};var r=function(){function t(t,e){this.base=t,this.id=e,this.nextChild=0}return t.prototype.getString=function(){return this.base+"."+this.id},t}();t.CV=r}(r||(r={}));var i=n(1),o=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function c(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))},a=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},c=function(){return 1e3*Date.now()};"object"==typeof window&&"object"==typeof window.performance&&"now"in window.performance&&(c=function(){return 1e3*Math.floor(window.performance.now())});var s=function(){function t(t,e,n){this._optionalEventFlags={},this._ended=!1,this._telemetryLogger=t,this._activityName=e,this._cv=n?r.getNextChild(n._cv):r.getNext(),this._dataFields=[],this._success=void 0,this._startTime=c()}return t.createNew=function(e,n){return new t(e,n)},t.prototype.createChildActivity=function(e){return new t(this._telemetryLogger,e,this)},t.prototype.setEventFlags=function(t){this._optionalEventFlags=t},t.prototype.addDataField=function(t){this._dataFields.push(t)},t.prototype.addDataFields=function(t){var e;(e=this._dataFields).push.apply(e,t)},t.prototype.setSuccess=function(t){this._success=t},t.prototype.setResult=function(t,e,n){this._result={code:t,type:e,tag:n}},t.prototype.endNow=function(){if(!this._ended){void 0===this._success&&void 0===this._result&&Object(i.d)(i.b.Warning,i.a.Core,(function(){return"Activity does not have success or result set"}));var t=c()-this._startTime;this._ended=!0;var e={duration:t,count:1,aggMode:0,cV:this._cv.getString(),success:this._success,result:this._result};return this._telemetryLogger.sendActivity(this._activityName,e,this._dataFields,this._optionalEventFlags)}Object(i.d)(i.b.Error,i.a.Core,(function(){return"Activity has already ended"}))},t.prototype.executeAsync=function(t){return o(this,void 0,void 0,(function(){var e=this;return a(this,(function(n){return[2,t(this).then((function(t){return e.endNow(),t})).catch((function(t){throw e.endNow(),t}))]}))}))},t.prototype.executeSync=function(t){try{var e=t(this);return this.endNow(),e}catch(t){throw this.endNow(),t}},t.prototype.executeChildActivityAsync=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(n){return[2,this.createChildActivity(t).executeAsync(e)]}))}))},t.prototype.executeChildActivitySync=function(t,e){return this.createChildActivity(t).executeSync(e)},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(){function t(){this._listeners=[]}return t.prototype.fireEvent=function(t){this._listeners.forEach((function(e){return e(t)}))},t.prototype.addListener=function(t){t&&this._listeners.push(t)},t.prototype.removeListener=function(t){this._listeners=this._listeners.filter((function(e){return e!==t}))},t.prototype.getListenerCount=function(){return this._listeners.length},t}()},function(t,e,n){"use strict";n.r(e);var r=n(6);n.d(e,"Contracts",(function(){return r.a}));var i=n(9);n.d(e,"ActivityScope",(function(){return i.a}));var o=n(2);n.d(e,"addContractField",(function(){return o.a}));var a=n(12);n.d(e,"getFieldsForContract",(function(){return a.a}));var c=n(4);n.d(e,"DataClassification",(function(){return c.a}));var s=n(13);for(var u in s)["default","Contracts","ActivityScope","addContractField","getFieldsForContract","DataClassification"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return s[t]}))}(u);var d=n(0);n.d(e,"makeBooleanDataField",(function(){return d.a})),n.d(e,"makeInt64DataField",(function(){return d.d})),n.d(e,"makeDoubleDataField",(function(){return d.b})),n.d(e,"makeStringDataField",(function(){return d.e})),n.d(e,"makeGuidDataField",(function(){return d.c}));var f=n(3);n.d(e,"DataFieldType",(function(){return f.a}));var l=n(14);n.d(e,"getEffectiveEventFlags",(function(){return l.a}));var v=n(5);n.d(e,"SamplingPolicy",(function(){return v.e})),n.d(e,"PersistencePriority",(function(){return v.d})),n.d(e,"CostPriority",(function(){return v.a})),n.d(e,"DataCategories",(function(){return v.b})),n.d(e,"DiagnosticLevel",(function(){return v.c}));var p=n(15);for(var u in p)["default","Contracts","ActivityScope","addContractField","getFieldsForContract","DataClassification","makeBooleanDataField","makeInt64DataField","makeDoubleDataField","makeStringDataField","makeGuidDataField","DataFieldType","getEffectiveEventFlags","SamplingPolicy","PersistencePriority","CostPriority","DataCategories","DiagnosticLevel"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return p[t]}))}(u);var y=n(1);n.d(e,"LogLevel",(function(){return y.b})),n.d(e,"Category",(function(){return y.a})),n.d(e,"onNotification",(function(){return y.e})),n.d(e,"logNotification",(function(){return y.d})),n.d(e,"logError",(function(){return y.c}));var h=n(8);n.d(e,"SuppressNexus",(function(){return h.b})),n.d(e,"SimpleTelemetryLogger",(function(){return h.a}));var g=n(16);n.d(e,"TelemetryLogger",(function(){return g.a}));var m=n(7);n.d(e,"cloneEvent",(function(){return m.a}));var b=n(17);for(var u in b)["default","Contracts","ActivityScope","addContractField","getFieldsForContract","DataClassification","makeBooleanDataField","makeInt64DataField","makeDoubleDataField","makeStringDataField","makeGuidDataField","DataFieldType","getEffectiveEventFlags","SamplingPolicy","PersistencePriority","CostPriority","DataCategories","DiagnosticLevel","LogLevel","Category","onNotification","logNotification","logError","SuppressNexus","SimpleTelemetryLogger","TelemetryLogger","cloneEvent"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return b[t]}))}(u);var F=n(18);for(var u in F)["default","Contracts","ActivityScope","addContractField","getFieldsForContract","DataClassification","makeBooleanDataField","makeInt64DataField","makeDoubleDataField","makeStringDataField","makeGuidDataField","DataFieldType","getEffectiveEventFlags","SamplingPolicy","PersistencePriority","CostPriority","DataCategories","DiagnosticLevel","LogLevel","Category","onNotification","logNotification","logError","SuppressNexus","SimpleTelemetryLogger","TelemetryLogger","cloneEvent"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return F[t]}))}(u)},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(2);function i(t,e,n){var i=n.map((function(e){return{name:t+"."+e.name,value:e.value,dataType:e.dataType}}));return Object(r.a)(i,t,e),i}},function(t,e){},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(5),i=n(1);function o(t){var e={costPriority:r.a.Normal,samplingPolicy:r.e.Measure,persistencePriority:r.d.Normal,dataCategories:r.b.NotSet,diagnosticLevel:r.c.FullEvent};return t.eventFlags&&t.eventFlags.dataCategories||Object(i.d)(i.b.Error,i.a.Core,(function(){return"Event is missing DataCategories event flag"})),t.eventFlags?(t.eventFlags.costPriority&&(e.costPriority=t.eventFlags.costPriority),t.eventFlags.samplingPolicy&&(e.samplingPolicy=t.eventFlags.samplingPolicy),t.eventFlags.persistencePriority&&(e.persistencePriority=t.eventFlags.persistencePriority),t.eventFlags.dataCategories&&(e.dataCategories=t.eventFlags.dataCategories),t.eventFlags.diagnosticLevel&&(e.diagnosticLevel=t.eventFlags.diagnosticLevel),e):e}},function(t,e){},function(t,e,n){"use strict";n.d(e,"a",(function(){return d}));var r,i=n(8),o=n(9),a=n(6),c=(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),s=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function c(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,c)}s((r=r.apply(t,e||[])).next())}))},u=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e.prototype.executeActivityAsync=function(t,e){return s(this,void 0,void 0,(function(){return u(this,(function(n){return[2,this.createNewActivity(t).executeAsync(e)]}))}))},e.prototype.executeActivitySync=function(t,e){return this.createNewActivity(t).executeSync(e)},e.prototype.createNewActivity=function(t){return o.a.createNew(this,t)},e.prototype.sendActivity=function(t,e,n,r){return this.sendTelemetryEvent({eventName:t,eventContract:{name:a.a.Office.System.Activity.contractName,dataFields:a.a.Office.System.Activity.getFields(e)},dataFields:n,eventFlags:r})},e.prototype.sendError=function(t){var e=a.a.Office.System.Error.getFields("Error",t.error);return null!=t.dataFields&&e.push.apply(e,t.dataFields),this.sendTelemetryEvent({eventName:t.eventName,dataFields:e,eventFlags:t.eventFlags})},e}(i.a)},function(t,e){},function(t,e){},function(t,e,n){t.exports=n(11)}]);