-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoffice.js
18 lines (14 loc) · 28.8 KB
/
office.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* Office JavaScript API library */
/*
Copyright (c) Microsoft Corporation. All rights reserved.
*/
/*
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.HostSpecificFileVersionDefault="16.00";OSF.HostSpecificFileVersionMap={access:{web:"16.00"},agavito:{winrt:"16.00"},excel:{ios:"16.00",mac:"16.00",web:"16.00",win32:"16.01",winrt:"16.00"},onenote:{android:"16.00",web:"16.00",win32:"16.00",winrt:"16.00"},outlook:{ios:"16.00",mac:"16.00",web:"16.01",win32:"16.02"},powerpoint:{ios:"16.00",mac:"16.00",web:"16.00",win32:"16.01",winrt:"16.00"},project:{win32:"16.00"},sway:{web:"16.00"},word:{ios:"16.00",mac:"16.00",web:"16.00",win32:"16.01",winrt:"16.00"},visio:{web:"16.00",win32:"16.00"}};OSF.SupportedLocales={"ar-sa":true,"bg-bg":true,"bn-in":true,"ca-es":true,"cs-cz":true,"da-dk":true,"de-de":true,"el-gr":true,"en-us":true,"es-es":true,"et-ee":true,"eu-es":true,"fa-ir":true,"fi-fi":true,"fr-fr":true,"gl-es":true,"he-il":true,"hi-in":true,"hr-hr":true,"hu-hu":true,"id-id":true,"it-it":true,"ja-jp":true,"kk-kz":true,"ko-kr":true,"lo-la":true,"lt-lt":true,"lv-lv":true,"ms-my":true,"nb-no":true,"nl-nl":true,"nn-no":true,"pl-pl":true,"pt-br":true,"pt-pt":true,"ro-ro":true,"ru-ru":true,"sk-sk":true,"sl-si":true,"sr-cyrl-cs":true,"sr-cyrl-rs":true,"sr-latn-cs":true,"sr-latn-rs":true,"sv-se":true,"th-th":true,"tr-tr":true,"uk-ua":true,"ur-pk":true,"vi-vn":true,"zh-cn":true,"zh-tw":true};OSF.AssociatedLocales={ar:"ar-sa",bg:"bg-bg",bn:"bn-in",ca:"ca-es",cs:"cs-cz",da:"da-dk",de:"de-de",el:"el-gr",en:"en-us",es:"es-es",et:"et-ee",eu:"eu-es",fa:"fa-ir",fi:"fi-fi",fr:"fr-fr",gl:"gl-es",he:"he-il",hi:"hi-in",hr:"hr-hr",hu:"hu-hu",id:"id-id",it:"it-it",ja:"ja-jp",kk:"kk-kz",ko:"ko-kr",lo:"lo-la",lt:"lt-lt",lv:"lv-lv",ms:"ms-my",nb:"nb-no",nl:"nl-nl",nn:"nn-no",pl:"pl-pl",pt:"pt-br",ro:"ro-ro",ru:"ru-ru",sk:"sk-sk",sl:"sl-si",sr:"sr-cyrl-cs",sv:"sv-se",th:"th-th",tr:"tr-tr",uk:"uk-ua",ur:"ur-pk",vi:"vi-vn",zh:"zh-cn"};OSF.getSupportedLocale=function(a,c){if(c===void 0)c="en-us";if(!a)return c;var b;a=a.toLowerCase();if(a in OSF.SupportedLocales)b=a;else{var d=a.split("-",1);if(d&&d.length>0)b=OSF.AssociatedLocales[d[0]]}if(!b)b=c;return b};var ScriptLoading;(function(e){var a=false,b=function(){function b(g,e,d,f,c){var b=this;b.url=g;b.isReady=e;b.hasStarted=d;b.timer=f;b.hasError=a;b.pendingCallbacks=[];b.pendingCallbacks.push(c)}return b}(),d=function(){function a(c,b,a){this.scriptId=c;this.startTime=b;this.msResponseTime=a}return a}(),c=function(){var c=true,e=null;function f(b){var a=this;if(b===void 0)b={OfficeJS:"office.js",OfficeDebugJS:"office.debug.js"};a.constantNames=b;a.defaultScriptLoadingTimeout=1e4;a.loadedScriptByIds={};a.scriptTelemetryBuffer=[];a.osfControlAppCorrelationId="";a.basePath=e}f.prototype.isScriptLoading=function(a){return !!(this.loadedScriptByIds[a]&&this.loadedScriptByIds[a].hasStarted)};f.prototype.getOfficeJsBasePath=function(){var a=this;if(a.basePath)return a.basePath;else{for(var g=function(b,c){var d,a,e;e=b.toLowerCase();a=e.indexOf(c);if(a>=0&&a===b.length-c.length&&(a===0||b.charAt(a-1)==="/"||b.charAt(a-1)==="\\"))d=b.substring(0,a);else if(a>=0&&a<b.length-c.length&&b.charAt(a+c.length)==="?"&&(a===0||b.charAt(a-1)==="/"||b.charAt(a-1)==="\\"))d=b.substring(0,a);return d},d=document.getElementsByTagName("script"),h=d.length,e=[a.constantNames.OfficeJS,a.constantNames.OfficeDebugJS],f=e.length,c,b=0;!a.basePath&&b<h;b++)if(d[b].src)for(c=0;!a.basePath&&c<f;c++)a.basePath=g(d[b].src,e[c]);return a.basePath}};f.prototype.loadScript=function(e,d,c,a,b){this.loadScriptInternal(e,d,c,a,b)};f.prototype.loadScriptParallel=function(d,c,b){this.loadScriptInternal(d,c,e,a,b)};f.prototype.waitForFunction=function(g,e,h,i){var b=h,f,d=function(){b--;if(g()){e(c);return}else if(b>0){f=window.setTimeout(d,i);b--}else{window.clearTimeout(f);e(a)}};d()};f.prototype.waitForScripts=function(b,e){var f=this;if(this.invokeCallbackIfScriptsReady(b,e)==a)for(var c=0;c<b.length;c++){var g=b[c],d=this.loadedScriptByIds[g];d&&d.pendingCallbacks.push(function(){f.invokeCallbackIfScriptsReady(b,e)})}};f.prototype.logScriptLoading=function(c,a,b){a=Math.floor(a);if(OSF.AppTelemetry&&OSF.AppTelemetry.onScriptDone)if(OSF.AppTelemetry.onScriptDone.length==3)OSF.AppTelemetry.onScriptDone(c,a,b);else OSF.AppTelemetry.onScriptDone(c,a,b,this.osfControlAppCorrelationId);else{var e=new d(c,a,b);this.scriptTelemetryBuffer.push(e)}};f.prototype.setAppCorrelationId=function(a){this.osfControlAppCorrelationId=a};f.prototype.invokeCallbackIfScriptsReady=function(h,j){for(var g=a,f=0;f<h.length;f++){var i=h[f],d=this.loadedScriptByIds[i];if(!d){d=new b("",a,a,e,e);this.loadedScriptByIds[i]=d}if(d.isReady==a)return a;else if(d.hasError)g=c}j(!g);return c};f.prototype.getScriptEntryByUrl=function(c){for(var b in this.loadedScriptByIds){var a=this.loadedScriptByIds[b];if(this.loadedScriptByIds.hasOwnProperty(b)&&a.url===c)return a}return e};f.prototype.loadScriptInternal=function(h,g,i,n,k){var j=this;if(h){var q=j,r=window.document,d=g&&j.loadedScriptByIds[g]?j.loadedScriptByIds[g]:j.getScriptEntryByUrl(h);if(!d||d.hasError||d.url.toLowerCase()!=h.toLowerCase()){var f=r.createElement("script");f.type="text/javascript";if(g)f.id=g;if(!d){d=new b(h,a,a,e,e);j.loadedScriptByIds[g?g:h]=d}else{d.url=h;d.hasError=a;d.isReady=a}if(i)if(n)d.pendingCallbacks.unshift(i);else d.pendingCallbacks.push(i);var l=-1;if(window.performance&&window.performance.now)l=window.performance.now();var s=(new Date).getTime(),o=function(b){if(g){var a=(new Date).getTime()-s;if(!b)a=-a;q.logScriptLoading(g,l,a)}q.flushTelemetryBuffer()},m=function(){var b="undefined";if(OSF._OfficeAppFactory.getHostInfo().hostType=="onenote"&&typeof OSF.AppTelemetry!==b&&typeof OSF.AppTelemetry.enableTelemetry!==b)OSF.AppTelemetry.enableTelemetry=a;if(!OSF._OfficeAppFactory.getLoggingAllowed()&&typeof OSF.AppTelemetry!==b)OSF.AppTelemetry.enableTelemetry=a;o(c);d.isReady=c;if(d.timer!=e){clearTimeout(d.timer);delete d.timer}for(var h=d.pendingCallbacks.length,g=0;g<h;g++){var f=d.pendingCallbacks.shift();if(f){var i=f(c);if(i===a)break}}},p=function(){o(a);d.hasError=c;d.isReady=c;if(d.timer!=e){clearTimeout(d.timer);delete d.timer}for(var g=d.pendingCallbacks.length,f=0;f<g;f++){var b=d.pendingCallbacks.shift();if(b){var h=b(a);if(h===a)break}}};if(f.readyState)f.onreadystatechange=function(){if(f.readyState=="loaded"||f.readyState=="complete"){f.onreadystatechange=e;m()}};else f.onload=m;f.onerror=p;k=k||j.defaultScriptLoadingTimeout;d.timer=setTimeout(p,k);d.hasStarted=c;f.setAttribute("crossOrigin","anonymous");f.src=h;r.getElementsByTagName("head")[0].appendChild(f)}else if(d.isReady)i(c);else if(n)d.pendingCallbacks.unshift(i);else d.pendingCallbacks.push(i)}};f.prototype.flushTelemetryBuffer=function(){var b=this;if(OSF.AppTelemetry&&OSF.AppTelemetry.onScriptDone){for(var c=0;c<b.scriptTelemetryBuffer.length;c++){var a=b.scriptTelemetryBuffer[c];if(OSF.AppTelemetry.onScriptDone.length==3)OSF.AppTelemetry.onScriptDone(a.scriptId,a.startTime,a.msResponseTime);else OSF.AppTelemetry.onScriptDone(a.scriptId,a.startTime,a.msResponseTime,b.osfControlAppCorrelationId)}b.scriptTelemetryBuffer=[]}};return f}();e.LoadScriptHelper=c})(ScriptLoading||(ScriptLoading={}));var OfficeExt;(function(a){var b;(function(a){var b=function(){function a(){var a=this;a.getDiagnostics=function(b){var a={host:this.getHost(),version:b||this.getDefaultVersion(),platform:this.getPlatform()};return a};a.platformRemappings={web:Microsoft.Office.WebExtension.PlatformType.OfficeOnline,winrt:Microsoft.Office.WebExtension.PlatformType.Universal,win32:Microsoft.Office.WebExtension.PlatformType.PC,mac:Microsoft.Office.WebExtension.PlatformType.Mac,ios:Microsoft.Office.WebExtension.PlatformType.iOS,android:Microsoft.Office.WebExtension.PlatformType.Android};a.camelCaseMappings={powerpoint:Microsoft.Office.WebExtension.HostType.PowerPoint,onenote:Microsoft.Office.WebExtension.HostType.OneNote};a.hostInfo=OSF._OfficeAppFactory.getHostInfo();a.getHost=a.getHost.bind(a);a.getPlatform=a.getPlatform.bind(a);a.getDiagnostics=a.getDiagnostics.bind(a)}a.prototype.capitalizeFirstLetter=function(a){if(a)return a[0].toUpperCase()+a.slice(1).toLowerCase();return a};a.getInstance=function(){if(a.hostObj===undefined)a.hostObj=new a;return a.hostObj};a.prototype.getPlatform=function(){var a=this;if(a.hostInfo.hostPlatform){var b=a.hostInfo.hostPlatform.toLowerCase();if(a.platformRemappings[b])return a.platformRemappings[b]}return null};a.prototype.getHost=function(){var a=this;if(a.hostInfo.hostType){var b=a.hostInfo.hostType.toLowerCase();if(a.camelCaseMappings[b])return a.camelCaseMappings[b];b=a.capitalizeFirstLetter(a.hostInfo.hostType);if(Microsoft.Office.WebExtension.HostType[b])return Microsoft.Office.WebExtension.HostType[b]}return null};a.prototype.getDefaultVersion=function(){if(this.getHost())return "16.0.0000.0000";return null};return a}();a.Host=b})(b=a.HostName||(a.HostName={}))})(OfficeExt||(OfficeExt={}));var Office;(function(d){var a=true,b="undefined",c="function",e;(function(d){var e;(function(d){function e(){return function(){var d=null,e="object";"use strict";function R(a){return typeof a===c||typeof a===e&&a!==d}function y(a){return typeof a===c}function U(a){return typeof a===e&&a!==d}var z;if(!Array.isArray)z=function(a){return Object.prototype.toString.call(a)==="[object Array]"};else z=Array.isArray;var E=z,r=0,pb={}.toString,kb,w,l=function(a,b){q[r]=a;q[r+1]=b;r+=2;if(r===2)if(w)w(p);else s()};function db(a){w=a}function mb(a){l=a}var Y=typeof window!==b?window:undefined,D=Y||{},A=D.MutationObserver||D.WebKitMutationObserver,nb=typeof process!==b&&{}.toString.call(process)==="[object process]",lb=typeof Uint8ClampedArray!==b&&typeof importScripts!==b&&typeof MessageChannel!==b;function fb(){var b=process.nextTick,a=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(a)&&a[1]==="0"&&a[2]==="10")b=setImmediate;return function(){b(p)}}function M(){var b=0,d=new A(p),c=document.createTextNode("");d.observe(c,{characterData:a});return function(){c.data=b=++b%2}}function P(){var a=new MessageChannel;a.port1.onmessage=p;return function(){a.port2.postMessage(0)}}function Z(){return function(){setTimeout(p,1)}}var q=new Array(1e3);function p(){for(var a=0;a<r;a+=2){var b=q[a],c=q[a+1];b(c);q[a]=undefined;q[a+1]=undefined}r=0}var s;if(nb)s=fb();else if(A)s=M();else if(lb)s=P();else s=Z();function o(){}var k=void 0,m=1,j=2,t=new C;function K(){return new TypeError("You cannot resolve a promise with itself")}function L(){return new TypeError("A promises callback cannot return that same promise.")}function bb(b){try{return b.then}catch(a){t.error=a;return t}}function cb(e,d,b,c){try{e.call(d,b,c)}catch(a){return a}}function F(c,b,d){l(function(e){var c=false,g=cb(d,b,function(d){if(c)return;c=a;if(b!==d)n(e,d);else h(e,d)},function(b){if(c)return;c=a;f(e,b)},"Settle: "+(e._label||" unknown promise"));if(!c&&g){c=a;f(e,g)}},c)}function H(b,a){if(a._state===m)h(b,a._result);else if(a._state===j)f(b,a._result);else u(a,undefined,function(a){n(b,a)},function(a){f(b,a)})}function G(b,a){if(a.constructor===b.constructor)H(b,a);else{var c=bb(a);if(c===t)f(b,t.error);else if(c===undefined)h(b,a);else if(y(c))F(b,a,c);else h(b,a)}}function n(a,b){if(a===b)f(a,K());else if(R(b))G(a,b);else h(a,b)}function J(a){a._onerror&&a._onerror(a._result);x(a)}function h(a,b){if(a._state!==k)return;a._result=b;a._state=m;a._subscribers.length!==0&&l(x,a)}function f(a,b){if(a._state!==k)return;a._state=j;a._result=b;l(J,a)}function u(c,g,e,f){var a=c._subscribers,b=a.length;c._onerror=d;a[b]=g;a[b+m]=e;a[b+j]=f;b===0&&c._state&&l(x,c)}function x(b){var a=b._subscribers,f=b._state;if(a.length===0)return;for(var e,d,g=b._result,c=0;c<a.length;c+=3){e=a[c];d=a[c+f];if(e)B(f,e,d,g);else d(g)}b._subscribers.length=0}function C(){this.error=d}var v=new C;function X(b,c){try{return b(c)}catch(a){v.error=a;return v}}function B(l,c,i,o){var g=y(i),b,q,e,p;if(g){b=X(i,o);if(b===v){p=a;q=b.error;b=d}else e=a;if(c===b){f(c,L());return}}else{b=o;e=a}if(c._state===k)if(g&&e)n(c,b);else if(p)f(c,q);else if(l===m)h(c,b);else l===j&&f(c,b)}function I(a,c){try{c(function(b){n(a,b)},function(b){f(a,b)})}catch(b){f(a,b)}}function i(c,b){var a=this;a._instanceConstructor=c;a.promise=new c(o);if(a._validateInput(b)){a._input=b;a.length=b.length;a._remaining=b.length;a._init();if(a.length===0)h(a.promise,a._result);else{a.length=a.length||0;a._enumerate();a._remaining===0&&h(a.promise,a._result)}}else f(a.promise,a._validationError())}i.prototype._validateInput=function(a){return E(a)};i.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")};i.prototype._init=function(){this._result=new Array(this.length)};var ab=i;i.prototype._enumerate=function(){for(var a=this,d=a.length,c=a.promise,e=a._input,b=0;c._state===k&&b<d;b++)a._eachEntry(e[b],b)};i.prototype._eachEntry=function(a,c){var b=this,e=b._instanceConstructor;if(U(a))if(a.constructor===e&&a._state!==k){a._onerror=d;b._settledAt(a._state,c,a._result)}else b._willSettleAt(e.resolve(a),c);else{b._remaining--;b._result[c]=a}};i.prototype._settledAt=function(d,e,c){var a=this,b=a.promise;if(b._state===k){a._remaining--;if(d===j)f(b,c);else a._result[e]=c}a._remaining===0&&h(b,a._result)};i.prototype._willSettleAt=function(c,b){var a=this;u(c,undefined,function(c){a._settledAt(m,b,c)},function(c){a._settledAt(j,b,c)})};function jb(a){return (new ab(this,a)).promise}var W=jb;function eb(b){var d=this,a=new d(o);if(!E(b)){f(a,new TypeError("You must pass an array to race."));return a}var h=b.length;function e(b){n(a,b)}function g(b){f(a,b)}for(var c=0;a._state===k&&c<h;c++)u(d.resolve(b[c]),undefined,e,g);return a}var V=eb;function O(a){var b=this;if(a&&typeof a===e&&a.constructor===b)return a;var c=new b(o);n(c,a);return c}var N=O;function T(c){var b=this,a=new b(o);f(a,c);return a}var Q=T,hb=0;function S(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function gb(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var ib=g;function g(b){var a=this;a._id=hb++;a._state=undefined;a._result=undefined;a._subscribers=[];if(o!==b){!y(b)&&S();!(a instanceof g)&&gb();I(a,b)}}g.all=W;g.race=V;g.resolve=N;g.reject=Q;g._setScheduler=db;g._setAsap=mb;g._asap=l;g.prototype={constructor:g,then:function(d,e){var b=this,a=b._state;if(a===m&&!d||a===j&&!e)return this;var c=new this.constructor(o),g=b._result;if(a){var f=arguments[a-1];l(function(){B(a,c,f,g)})}else u(b,c,d,e);return c},"catch":function(a){return this.then(d,a)}};return ib}.call(this)}d.Init=e})(e=d.PromiseImpl||(d.PromiseImpl={}))})(e=d._Internal||(d._Internal={}));var e;(function(d){function f(){var b=window.navigator.userAgent,c=b.indexOf("Edge/");if(c>=0){b=b.substring(c+5,b.length);if(b<"14.14393")return a;else return false}return false}function e(){if(typeof window===b&&typeof Promise===c)return Promise;if(typeof window!==b&&window.Promise)if(f())return d.PromiseImpl.Init();else return window.Promise;else return d.PromiseImpl.Init()}d.OfficePromise=e()})(e=d._Internal||(d._Internal={}));var f=e.OfficePromise;d.Promise=f})(Office||(Office={}));var OTel;(function(d){var b="telemetry/oteljs.js",a="telemetry/oteljs_agave.js",c=function(){function c(){}c.loaded=function(){return !(c.logger===undefined)};c.getOtelCDNLocation=function(){return OSF._OfficeAppFactory.getLoadScriptHelper().getOfficeJsBasePath()+b};c.getOtelSinkCDNLocation=function(){return OSF._OfficeAppFactory.getLoadScriptHelper().getOfficeJsBasePath()+a};c.getMapName=function(b,a){if(a!==undefined&&b.hasOwnProperty(a))return b[a];return a};c.getHost=function(){var b=OSF._OfficeAppFactory.getHostInfo()["hostType"],d={excel:"Excel",onenote:"OneNote",outlook:"Outlook",powerpoint:"PowerPoint",project:"Project",visio:"Visio",word:"Word"},a=c.getMapName(d,b);return a};c.getFlavor=function(){var b=OSF._OfficeAppFactory.getHostInfo()["hostPlatform"],d={android:"Android",ios:"iOS",mac:"Mac",universal:"Universal",web:"Web",win32:"Win32"},a=c.getMapName(d,b);return a};c.ensureValue=function(a,b){if(!a)return b;return a};c.create=function(a){var h={id:a.appId,assetId:a.assetId,officeJsVersion:a.officeJSVersion,hostJsVersion:a.hostJSVersion,browserToken:a.clientId,instanceId:a.appInstanceId,name:a.name,sessionId:a.sessionId},k=oteljs.Contracts.Office.System.SDX.getFields("SDX",h),l=c.getHost(),d=c.getFlavor(),j=d==="Web"&&a.hostVersion.slice(0,2)==="0."?"16.0.0.0":a.hostVersion,i={"App.Name":l,"App.Platform":d,"App.Version":j,"Session.Id":c.ensureValue(a.correlationId,"00000000-0000-0000-0000-000000000000")},m=oteljs_agave.AgaveSink.createInstance(i),g="Office.Extensibility.OfficeJs",f="db334b301e7b474db5e0f02f07c51a47-a1b5bc36-1bbe-482f-a64a-c2d9cb606706-7439",e=1755,b=new oteljs.TelemetryLogger(undefined,k);b.addSink(m);b.setTenantToken(g,f,e);return b};c.initialize=function(f){if(!c.Enabled){c.promises=[];return}var a=1e3,e=function(){var a="undefined";if(typeof oteljs===a||typeof oteljs_agave===a)return;if(!c.loaded())c.logger=c.create(f);c.loaded()&&c.promises.forEach(function(a){a()})},b=function(){Microsoft.Office.WebExtension.onReadyInternal().then(function(){return e()})},d=function(){OSF.OUtil.loadScript(c.getOtelSinkCDNLocation(),b,a)};OSF.OUtil.loadScript(c.getOtelCDNLocation(),d,a)};c.sendTelemetryEvent=function(a){c.onTelemetryLoaded(function(){try{c.logger.sendTelemetryEvent(a)}catch(b){}})};c.onTelemetryLoaded=function(a){if(!c.Enabled)return;if(c.loaded())a();else c.promises.push(a)};c.promises=[];c.Enabled=true;return c}();d.OTelLogger=c})(OTel||(OTel={}));(function(){var a=OSF.ConstantNames||{};OSF.ConstantNames={FileVersion:"0.0.0.0",OfficeJS:"office.js",OfficeDebugJS:"office.debug.js",DefaultLocale:"en-us",LocaleStringLoadingTimeout:5e3,MicrosoftAjaxId:"MSAJAX",OfficeStringsId:"OFFICESTRINGS",OfficeJsId:"OFFICEJS",HostFileId:"HOST",O15MappingId:"O15Mapping",OfficeStringJS:"office_strings.js",O15InitHelper:"o15apptofilemappingtable.js",SupportedLocales:OSF.SupportedLocales,AssociatedLocales:OSF.AssociatedLocales};for(var b in a)OSF.ConstantNames[b]=a[b]})();OSF.InitializationHelper=function(d,b,f,e,c){var a=this;a._hostInfo=d;a._webAppState=b;a._context=f;a._settings=e;a._hostFacade=c};OSF.InitializationHelper.prototype.saveAndSetDialogInfo=function(){};OSF.InitializationHelper.prototype.getAppContext=function(){};OSF.InitializationHelper.prototype.setAgaveHostCommunication=function(){};OSF.InitializationHelper.prototype.prepareRightBeforeWebExtensionInitialize=function(){};OSF.InitializationHelper.prototype.loadAppSpecificScriptAndCreateOM=function(){};OSF.InitializationHelper.prototype.prepareRightAfterWebExtensionInitialize=function(){};OSF._OfficeAppFactory=function(){var l="_host_Info",c="undefined",h="function",f="",b=true,e=false,d=null,o=function(b,a){if(a&&b&&!a[b])a[b]={}};o("Office",window);o("Microsoft",window);o("Office",Microsoft);o("WebExtension",Microsoft.Office);if(window.Office.Promise)Microsoft.Office.WebExtension.Promise=window.Office.Promise;window.Office=Microsoft.Office.WebExtension;Microsoft.Office.WebExtension.PlatformType={PC:"PC",OfficeOnline:"OfficeOnline",Mac:"Mac",iOS:"iOS",Android:"Android",Universal:"Universal"};Microsoft.Office.WebExtension.HostType={Word:"Word",Excel:"Excel",PowerPoint:"PowerPoint",Outlook:"Outlook",OneNote:"OneNote",Project:"Project",Access:"Access",Visio:"Visio"};var r={},F={},q={},j={id:d,webAppUrl:d,conversationID:d,clientEndPoint:d,wnd:window.parent,focused:e},a={isO15:b,isRichClient:b,hostType:f,hostPlatform:f,hostSpecificFileVersion:f,hostLocale:f,osfControlAppCorrelationId:f,isDialog:e,disableLogging:e},k=b,i={},v=d,u=e,n=[],t=e,m={host:d,platform:d},g=new ScriptLoading.LoadScriptHelper({OfficeJS:OSF.ConstantNames.OfficeJS,OfficeDebugJS:OSF.ConstantNames.OfficeDebugJS});window.performance&&window.performance.now&&g.logScriptLoading(OSF.ConstantNames.OfficeJsId,-1,window.performance.now());var z=window.location.hash,y=window.location.search,w=window.name,s=function(a){var d=a.host,c=a.platform;u=b;m={host:d,platform:c};while(n.length>0)n.shift()(m)};Microsoft.Office.WebExtension.FeatureGates={};Microsoft.Office.WebExtension.sendTelemetryEvent=function(a){OTel.OTelLogger.sendTelemetryEvent(a)};Microsoft.Office.WebExtension.onReadyInternal=function(a){if(u){var d=m.host,c=m.platform;if(a){var b=a({host:d,platform:c});if(b&&b.then&&typeof b.then===h)return b.then(function(){return Office.Promise.resolve({host:d,platform:c})})}return Office.Promise.resolve({host:d,platform:c})}if(a)return new Office.Promise(function(b){n.push(function(d){var c=a(d);if(c&&c.then&&typeof c.then===h)return c.then(function(){return b(d)});b(d)})});return new Office.Promise(function(a){n.push(a)})};Microsoft.Office.WebExtension.onReady=function(a){t=b;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},D=function(f,g){var c=f.split("."),d=g.split("."),a;for(a in c)if(parseInt(c[a])<parseInt(d[a]))return e;else if(parseInt(c[a])>parseInt(d[a]))return b;return e},B=function(){var b="15.30.1128.0",a=window.external.GetContext().GetHostFullVersion();return !!D(b,a)},x=function(){k=b;try{if(a.disableLogging){k=e;return}window.external=window.external||{};if(typeof window.external.GetLoggingAllowed===c)k=b;else k=window.external.GetLoggingAllowed()}catch(d){}},C=function(){var i="hostInfoValue",m="isDialog",o=l,h=p(o);if(!h)try{var r=JSON.parse(w);h=r?r["hostInfo"]:d}catch(s){}if(!h)try{window.external=window.external||{};if(typeof agaveHost!==c&&agaveHost.GetHostInfo)window.external.GetHostInfo=function(){return agaveHost.GetHostInfo()};var k=window.external.GetHostInfo();if(k==m){a.isO15=b;a.isDialog=b}else if(k.toLowerCase().indexOf("mac")!==-1&&k.toLowerCase().indexOf("outlook")!==-1&&B())a.isO15=b;else{var q=k.split(o+"=");if(q.length>1)h=q[1];else h=k}}catch(s){}var u=function(){var a=d;try{if(window.sessionStorage)a=window.sessionStorage}catch(b){}return a},j=u();if(!h&&j&&j.getItem(i))h=j.getItem(i);if(h){h=decodeURIComponent(h);a.isO15=e;var g=h.split("$");if(typeof g[2]==c)g=h.split("|");a.hostType=typeof g[0]==c?f:g[0].toLowerCase();a.hostPlatform=typeof g[1]==c?f:g[1].toLowerCase();a.hostSpecificFileVersion=typeof g[2]==c?f:g[2].toLowerCase();a.hostLocale=typeof g[3]==c?f:g[3].toLowerCase();a.osfControlAppCorrelationId=typeof g[4]==c?f:g[4];if(a.osfControlAppCorrelationId=="telemetry")a.osfControlAppCorrelationId=f;a.isDialog=typeof g[5]!=c&&g[5]==m?b:e;a.disableLogging=typeof g[6]!=c&&g[6]=="disableLogging"?b:e;var t=parseFloat(a.hostSpecificFileVersion),n=OSF.HostSpecificFileVersionDefault;if(OSF.HostSpecificFileVersionMap[a.hostType]&&OSF.HostSpecificFileVersionMap[a.hostType][a.hostPlatform])n=OSF.HostSpecificFileVersionMap[a.hostType][a.hostPlatform];if(t>parseFloat(n))a.hostSpecificFileVersion=n;if(j)try{j.setItem(i,h)}catch(v){}}else{a.isO15=b;a.hostLocale=p("locale")}},A=function(b,a){OSF.AppTelemetry&&OSF.AppTelemetry.logAppCommonMessage&&OSF.AppTelemetry.logAppCommonMessage("getAppContextAsync starts");i.getAppContext(b,a)},E=function(){C();x();if(a.hostPlatform=="web"&&a.isDialog&&window==window.top&&window.opener==d){window.open(f,"_self",f);window.close()}g.setAppCorrelationId(a.osfControlAppCorrelationId);var k=g.getOfficeJsBasePath(),B=e;if(!k)throw"Office Web Extension script library file name should be "+OSF.ConstantNames.OfficeJS+" or "+OSF.ConstantNames.OfficeDebugJS+".";var m=function(){if(typeof Sys!==c&&typeof Type!==c&&Sys.StringBuilder&&typeof Sys.StringBuilder===h&&Type.registerNamespace&&typeof Type.registerNamespace===h&&Type.registerClass&&typeof Type.registerClass===h||typeof OfficeExt!==c&&OfficeExt.MsAjaxError)return b;else return e},n=d,u=function(f){var a=e,d=function(){if(typeof Strings==c||typeof Strings.OfficeOM==c)if(!a){a=b;var h=k+OSF.ConstantNames.DefaultLocale+"/"+OSF.ConstantNames.OfficeStringJS;g.loadScript(h,OSF.ConstantNames.OfficeStringsId,d,b,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{a=e;n=Strings.OfficeOM}};if(!m()){window.Type=Function;Type.registerNamespace=function(a){window[a]=window[a]||{}};Type.prototype.registerClass=function(a){a={}}}var h=k+OSF.getSupportedLocale(f,OSF.ConstantNames.DefaultLocale)+"/"+OSF.ConstantNames.OfficeStringJS;g.loadScript(h,OSF.ConstantNames.OfficeStringsId,d,b,OSF.ConstantNames.LocaleStringLoadingTimeout)},o=function(o){if(o){i=new OSF.InitializationHelper(a,j,r,F,q);a.hostPlatform=="web"&&i.saveAndSetDialogInfo&&i.saveAndSetDialogInfo(p(l));i.setAgaveHostCommunication();A(j.wnd,function(b){OSF.AppTelemetry&&OSF.AppTelemetry.logAppCommonMessage&&OSF.AppTelemetry.logAppCommonMessage("getAppContextAsync callback start");v=b._appInstanceId;if(b.get_featureGates){var c=b.get_featureGates();if(c)Microsoft.Office.WebExtension.FeatureGates=c}var d=function(){var c=a.hostSpecificFileVersion.split(".");if(b.get_appMinorVersion){var d=a.hostPlatform=="ios";if(!d)if(isNaN(b.get_appMinorVersion()))b._appMinorVersion=parseInt(c[1]);else if(c.length>1&&!isNaN(Number(c[1])))b._appMinorVersion=parseInt(c[1])}if(a.isDialog)b._isDialog=a.isDialog};d();var e=function(){i.prepareApiSurface&&i.prepareApiSurface(b);g.waitForFunction(function(){return Microsoft.Office.WebExtension.initialize!=undefined||t},function(c){if(c){if(i.prepareApiSurface)Microsoft.Office.WebExtension.initialize&&Microsoft.Office.WebExtension.initialize(i.getInitializationReason(b));else{if(!Microsoft.Office.WebExtension.initialize)Microsoft.Office.WebExtension.initialize=function(){};i.prepareRightBeforeWebExtensionInitialize(b)}i.prepareRightAfterWebExtensionInitialize&&i.prepareRightAfterWebExtensionInitialize();var a=b.get_appName();s({host:OfficeExt.HostName.Host.getInstance().getHost(a),platform:OfficeExt.HostName.Host.getInstance().getPlatform(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)};!g.isScriptLoading(OSF.ConstantNames.OfficeStringsId)&&u(b.get_appUILocale());g.waitForScripts([OSF.ConstantNames.OfficeStringsId],function(){if(n&&!Strings.OfficeOM)Strings.OfficeOM=n;i.loadAppSpecificScriptAndCreateOM(b,e,k)})});if(a.isO15){var m=OSF.OUtil.parseXdmInfo()==d;if(m){var f=b;if(window.external&&typeof window.external.GetContext!==c)try{window.external.GetContext();f=e}catch(w){}f&&s({host:d,platform:d})}}}else{var h="MicrosoftAjax.js is not loaded successfully.";OSF.AppTelemetry&&OSF.AppTelemetry.logAppException&&OSF.AppTelemetry.logAppException(h);throw h}},w=function(){OSF.AppTelemetry&&OSF.AppTelemetry.setOsfControlAppCorrelationId&&OSF.AppTelemetry.setOsfControlAppCorrelationId(a.osfControlAppCorrelationId);if(g.isScriptLoading(OSF.ConstantNames.MicrosoftAjaxId))g.waitForScripts([OSF.ConstantNames.MicrosoftAjaxId],o);else g.waitForFunction(m,o,500,100)};if(a.isO15)g.loadScript(k+OSF.ConstantNames.O15InitHelper,OSF.ConstantNames.O15MappingId,w);else{var y=[a.hostType,a.hostPlatform,a.hostSpecificFileVersion,OSF.ConstantNames.HostFileScriptSuffix||d].filter(function(a){return a!=d}).join("-")+".js";g.loadScript(k+y.toLowerCase(),OSF.ConstantNames.HostFileId,w)}a.hostLocale&&u(a.hostLocale);if(B&&!m()){var D=(window.location.protocol.toLowerCase()==="https:"?"https:":"http:")+"//ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js";g.loadScriptParallel(D,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=a.hostType=="outlook"&&a.hostPlatform=="android";if(!z){window.history.replaceState=d;window.history.pushState=d}};E();return {getId:function(){return j.id},getClientEndPoint:function(){return j.clientEndPoint},getContext:function(){return r},setContext:function(a){r=a},getHostInfo:function(){return a},getLoggingAllowed:function(){return k},getHostFacade:function(){return q},setHostFacade:function(a){q=a},getInitializationHelper:function(){return i},getCachedSessionSettingsKey:function(){return (j.conversationID!=d?j.conversationID:v)+"CachedSessionSettings"},getWebAppState:function(){return j},getWindowLocationHash:function(){return z},getWindowLocationSearch:function(){return y},getLoadScriptHelper:function(){return g},getWindowName:function(){return w}}}()