/* 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&&a0){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=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;e0)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 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=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=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;n0},e._getLocalDocumentUrlPrefixLength=function(e){for(var t=["http://document.localhost","https://document.localhost","//document.localhost"],n=e.toLowerCase().trim(),r=0;r0){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;i0){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=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;i0)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=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=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;u0?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=65&&e.charCodeAt(t)<=90;)t++;return t0?".":"")+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;r0&&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;r0;)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;rn)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;n0){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;n0){for(var i=0;i0){for(var i=0;i0&&(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=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;n0)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;b0&&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=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;n0},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=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=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>>>>"),i.push(this.m_statements[t]),i.push("// <<<<<");for(var a=t+1;a0)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;n0&&(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-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-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;a0&&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;n0&&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=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=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;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]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]