403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Program Files/Microsoft Office/root/Office16/AugLoop/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Program Files/Microsoft Office/root/Office16/AugLoop/bundle.js
"use strict";(()=>{var Lh=Object.create;var As=Object.defineProperty;var Wh=Object.getOwnPropertyDescriptor;var Fh=Object.getOwnPropertyNames;var Gh=Object.getPrototypeOf,$h=Object.prototype.hasOwnProperty;var Uh=(t,n)=>()=>(t&&(n=t(t=0)),n);var j=(t,n)=>()=>(n||t((n={exports:{}}).exports,n),n.exports),qh=(t,n)=>{for(var e in n)As(t,e,{get:n[e],enumerable:!0})},xs=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Fh(n))!$h.call(t,o)&&o!==e&&As(t,o,{get:()=>n[o],enumerable:!(r=Wh(n,o))||r.enumerable});return t},nt=(t,n,e)=>(xs(t,n,"default"),e&&xs(e,n,"default")),C=(t,n,e)=>(e=t!=null?Lh(Gh(t)):{},xs(n||!t||!t.__esModule?As(e,"default",{value:t,enumerable:!0}):e,t));var pl=j((exports,module)=>{p();if(exports.__platformBundles!==void 0)for(platformBundles=exports.__platformBundles.concat(),Reflect.deleteProperty(exports,"__platformBundles"),i=0;i<platformBundles.length;++i)console.log("PB start "+(i+1)+"/"+platformBundles.length),eval(platformBundles[i]),console.log("PB done  "+(i+1)+"/"+platformBundles.length);var platformBundles,i});var global,p=Uh(()=>{global=new Function("return this;")();pl()});var ml=j((SC,hl)=>{p();hl.exports=OfficePlatformGlobal.ReactNativeReka});var vl=j((_C,yl)=>{p();yl.exports=OfficePlatformGlobal.Reka});var Rs=j((IC,br)=>{p();function Sl(t,n,e,r,o,s,a){try{var u=t[s](a),l=u.value}catch(c){return void e(c)}u.done?n(l):Promise.resolve(l).then(r,o)}function zh(t){return function(){var n=this,e=arguments;return new Promise(function(r,o){var s=t.apply(n,e);function a(l){Sl(s,r,o,a,u,"next",l)}function u(l){Sl(s,r,o,a,u,"throw",l)}a(void 0)})}}br.exports=zh,br.exports.__esModule=!0,br.exports.default=br.exports});var Ds=j((AC,Mr)=>{p();function jh(t){if(Array.isArray(t))return t}Mr.exports=jh,Mr.exports.__esModule=!0,Mr.exports.default=Mr.exports});var kl=j((DC,Ir)=>{p();function Jh(t,n){var e=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var r,o,s,a,u=[],l=!0,c=!1;try{if(s=(e=e.call(t)).next,n===0){if(Object(e)!==e)return;l=!1}else for(;!(l=(r=s.call(e)).done)&&(u.push(r.value),u.length!==n);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&e.return!=null&&(a=e.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}Ir.exports=Jh,Ir.exports.__esModule=!0,Ir.exports.default=Ir.exports});var Ps=j((NC,xr)=>{p();function Kh(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}xr.exports=Kh,xr.exports.__esModule=!0,xr.exports.default=xr.exports});var Ui=j((BC,Ar)=>{p();var _l=Ps();function Qh(t,n){if(t){if(typeof t=="string")return _l(t,n);var e={}.toString.call(t).slice(8,-1);return e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set"?Array.from(t):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_l(t,n):void 0}}Ar.exports=Qh,Ar.exports.__esModule=!0,Ar.exports.default=Ar.exports});var Ns=j((LC,Rr)=>{p();function Yh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}Rr.exports=Yh,Rr.exports.__esModule=!0,Rr.exports.default=Rr.exports});var mt=j((FC,Dr)=>{p();var Xh=Ds(),Zh=kl(),em=Ui(),tm=Ns();function nm(t,n){return Xh(t)||Zh(t,n)||em(t,n)||tm()}Dr.exports=nm,Dr.exports.__esModule=!0,Dr.exports.default=Dr.exports});var wl=j(($C,Pr)=>{p();var rm=Ps();function im(t){if(Array.isArray(t))return rm(t)}Pr.exports=im,Pr.exports.__esModule=!0,Pr.exports.default=Pr.exports});var Os=j((qC,Nr)=>{p();function om(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}Nr.exports=om,Nr.exports.__esModule=!0,Nr.exports.default=Nr.exports});var Tl=j((VC,Or)=>{p();function sm(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}Or.exports=sm,Or.exports.__esModule=!0,Or.exports.default=Or.exports});var Re=j((jC,Br)=>{p();var am=wl(),um=Os(),lm=Ui(),cm=Tl();function fm(t){return am(t)||um(t)||lm(t)||cm()}Br.exports=fm,Br.exports.__esModule=!0,Br.exports.default=Br.exports});var F=j((KC,Er)=>{p();function dm(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Er.exports=dm,Er.exports.__esModule=!0,Er.exports.default=Er.exports});var qi=j((YC,Pt)=>{p();function Bs(t){"@babel/helpers - typeof";return Pt.exports=Bs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Pt.exports.__esModule=!0,Pt.exports.default=Pt.exports,Bs(t)}Pt.exports=Bs,Pt.exports.__esModule=!0,Pt.exports.default=Pt.exports});var Ml=j((ZC,Lr)=>{p();var bl=qi().default;function gm(t,n){if(bl(t)!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var r=e.call(t,n||"default");if(bl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(t)}Lr.exports=gm,Lr.exports.__esModule=!0,Lr.exports.default=Lr.exports});var Es=j((tS,Wr)=>{p();var pm=qi().default,hm=Ml();function mm(t){var n=hm(t,"string");return pm(n)=="symbol"?n:n+""}Wr.exports=mm,Wr.exports.__esModule=!0,Wr.exports.default=Wr.exports});var G=j((rS,Fr)=>{p();var ym=Es();function Il(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ym(r.key),r)}}function vm(t,n,e){return n&&Il(t.prototype,n),e&&Il(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}Fr.exports=vm,Fr.exports.__esModule=!0,Fr.exports.default=Fr.exports});var Wl=j((ek,Ur)=>{p();function Sm(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}Ur.exports=Sm,Ur.exports.__esModule=!0,Ur.exports.default=Ur.exports});var ut=j((nk,qr)=>{p();var km=qi().default,_m=Wl();function wm(t,n){if(n&&(km(n)=="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _m(t)}qr.exports=wm,qr.exports.__esModule=!0,qr.exports.default=qr.exports});var Je=j((ik,Et)=>{p();function $s(t){return Et.exports=$s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Et.exports.__esModule=!0,Et.exports.default=Et.exports,$s(t)}Et.exports=$s,Et.exports.__esModule=!0,Et.exports.default=Et.exports});var Po=j((sk,Lt)=>{p();function Us(t,n){return Lt.exports=Us=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,r){return e.__proto__=r,e},Lt.exports.__esModule=!0,Lt.exports.default=Lt.exports,Us(t,n)}Lt.exports=Us,Lt.exports.__esModule=!0,Lt.exports.default=Lt.exports});var lt=j((uk,Hr)=>{p();var Tm=Po();function bm(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&Tm(t,n)}Hr.exports=bm,Hr.exports.__esModule=!0,Hr.exports.default=Hr.exports});var Fl=j((ck,Vr)=>{p();function Mm(t){try{return Function.toString.call(t).indexOf("[native code]")!==-1}catch(n){return typeof t=="function"}}Vr.exports=Mm,Vr.exports.__esModule=!0,Vr.exports.default=Vr.exports});var $l=j((dk,Wt)=>{p();function Gl(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(Wt.exports=Gl=function(){return!!t},Wt.exports.__esModule=!0,Wt.exports.default=Wt.exports)()}Wt.exports=Gl,Wt.exports.__esModule=!0,Wt.exports.default=Wt.exports});var Ul=j((pk,zr)=>{p();var Im=$l(),xm=Po();function Am(t,n,e){if(Im())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,n);var o=new(t.bind.apply(t,r));return e&&xm(o,e.prototype),o}zr.exports=Am,zr.exports.__esModule=!0,zr.exports.default=zr.exports});var ql=j((mk,Ft)=>{p();var Rm=Je(),Dm=Po(),Pm=Fl(),Nm=Ul();function qs(t){var n=typeof Map=="function"?new Map:void 0;return Ft.exports=qs=function(r){if(r===null||!Pm(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(n!==void 0){if(n.has(r))return n.get(r);n.set(r,o)}function o(){return Nm(r,arguments,Rm(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Dm(o,r)},Ft.exports.__esModule=!0,Ft.exports.default=Ft.exports,qs(t)}Ft.exports=qs,Ft.exports.__esModule=!0,Ft.exports.default=Ft.exports});var Uo=j((P_,In)=>{p();In.exports=global.fetch;In.exports.default=global.fetch;In.exports.fetch=global.fetch;In.exports.Headers=global.Headers;In.exports.Request=global.Request;In.exports.Response=global.Response});var sf=j((vw,ii)=>{p();var py=Je();function hy(t,n){for(;!{}.hasOwnProperty.call(t,n)&&(t=py(t))!==null;);return t}ii.exports=hy,ii.exports.__esModule=!0,ii.exports.default=ii.exports});var af=j((Sw,Ht)=>{p();var my=sf();function Ta(){return Ht.exports=Ta=typeof Reflect!="undefined"&&Reflect.get?Reflect.get.bind():function(t,n,e){var r=my(t,n);if(r){var o=Object.getOwnPropertyDescriptor(r,n);return o.get?o.get.call(arguments.length<3?t:e):o.value}},Ht.exports.__esModule=!0,Ht.exports.default=Ht.exports,Ta.apply(null,arguments)}Ht.exports=Ta,Ht.exports.__esModule=!0,Ht.exports.default=Ht.exports});var zo=j((_w,uf)=>{"use strict";p();uf.exports=function t(n,e){if(n===e)return!0;if(n&&e&&typeof n=="object"&&typeof e=="object"){if(n.constructor!==e.constructor)return!1;var r,o,s;if(Array.isArray(n)){if(r=n.length,r!=e.length)return!1;for(o=r;o--!==0;)if(!t(n[o],e[o]))return!1;return!0}if(n.constructor===RegExp)return n.source===e.source&&n.flags===e.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===e.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===e.toString();if(s=Object.keys(n),r=s.length,r!==Object.keys(e).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[o]))return!1;for(o=r;o--!==0;){var a=s[o];if(!t(n[a],e[a]))return!1}return!0}return n!==n&&e!==e}});var Rf=j((jw,Af)=>{p();Af.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://augloop.office.com/settings.json",definitions:{environments:{type:"array",uniqueItems:!0,minItems:1,items:{type:"string",enum:["dev","test","int","dogfood","msit","prod","fairfax","gcchigh","dod","ag08","ag09","gallatin","bleu","delos","copperstone"]}},regions:{type:"array",uniqueItems:!0,minItems:1,items:{type:"string",enum:["australiaeast","australiasoutheast","brazilsouth","canadacentral","centralindia","centralus","chilecentral","chinaeast3","chinanorth3","eastus","eastus2","eastus2euap","francecentral","germanywestcentral","japaneast","japanwest","koreacentral","northeurope","southcentralus","swedencentral","switzerlandnorth","northcentralus","southeastasia","westcentralus","westeurope","westus","westus2","usdodcentral","usdodeast","usgovarizona","usgovtexas","usgovvirginia","usnateast","usnatwest","usseceast","ussecwest","bleufrancesouth","bleufrancecentral","deloscloudgermanycentral","deloscloudgermanynorth"]}},dataBoundaries:{type:"array",uniqueItems:!0,minItems:1,items:{type:"string",enum:["eudb"]}},serviceNames:{type:"array",uniqueItems:!0,minItems:1,items:{type:"string",enum:["gateway","matchmaker","httpproxy","utility","textanalysis","proofing","acronyms","classification","mastermind","excel-ecs-proxy","automatic-clp","fileio","powerpoint-getitems-proxy","tricorder","image-services","natural-language","role-detection","doc-xray","compose","voice","incubation","canvas","excel","ink","extension","observational-assistance","personalization","security","generative-text"]}},IConfigValue:{type:"object",properties:{value:{description:"An untyped setting",type:["array","boolean","integer","null","number","object","string"]},environments:{$ref:"#/definitions/environments"},regions:{$ref:"#/definitions/regions"},dataBoundaries:{$ref:"#/definitions/dataBoundaries"},serviceNames:{$ref:"#/definitions/serviceNames"},lastModifiedBy:{type:"string",format:"email"},lastModifiedTime:{type:"string",format:"date-time"}},required:["value"],additionalProperties:!1},IConfigSetting:{type:"array",minItems:1,items:{$ref:"#/definitions/IConfigValue"}},IStringConfigSetting:{type:"array",minItems:1,items:{allOf:[{type:"object",properties:{value:{description:"A string setting",type:"string"}}},{$ref:"#/definitions/IConfigValue"}]}},INumericConfigSetting:{type:"array",minItems:1,items:{allOf:[{type:"object",properties:{value:{description:"A number setting",type:"number"}}},{$ref:"#/definitions/IConfigValue"}]}},IBooleanConfigSetting:{type:"array",minItems:1,items:{allOf:[{type:"object",properties:{value:{description:"A boolean setting",type:"boolean"}}},{$ref:"#/definitions/IConfigValue"}]}},IObjectConfigSetting:{type:"array",minItems:1,items:{allOf:[{type:"object",properties:{value:{description:"An object setting",type:"object"}}},{$ref:"#/definitions/IConfigValue"}]}},IArrayConfigSetting:{type:"array",minItems:1,items:{allOf:[{type:"object",properties:{value:{description:"An array setting",type:"array"}}},{$ref:"#/definitions/IConfigValue"}]}}},title:"Config",properties:{$schema:!0},additionalProperties:{$ref:"#/definitions/IConfigSetting"}}});var Zo=j((lT,Ia)=>{"use strict";p();var Ty=Object.prototype.hasOwnProperty,Ge="~";function si(){}Object.create&&(si.prototype=Object.create(null),new si().__proto__||(Ge=!1));function by(t,n,e){this.fn=t,this.context=n,this.once=e||!1}function Ef(t,n,e,r,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new by(e,r||t,o),a=Ge?Ge+n:n;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],s]:t._events[a].push(s):(t._events[a]=s,t._eventsCount++),t}function Xo(t,n){--t._eventsCount===0?t._events=new si:delete t._events[n]}function Ee(){this._events=new si,this._eventsCount=0}Ee.prototype.eventNames=function(){var n=[],e,r;if(this._eventsCount===0)return n;for(r in e=this._events)Ty.call(e,r)&&n.push(Ge?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n};Ee.prototype.listeners=function(n){var e=Ge?Ge+n:n,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,s=r.length,a=new Array(s);o<s;o++)a[o]=r[o].fn;return a};Ee.prototype.listenerCount=function(n){var e=Ge?Ge+n:n,r=this._events[e];return r?r.fn?1:r.length:0};Ee.prototype.emit=function(n,e,r,o,s,a){var u=Ge?Ge+n:n;if(!this._events[u])return!1;var l=this._events[u],c=arguments.length,f,d;if(l.fn){switch(l.once&&this.removeListener(n,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,o),!0;case 5:return l.fn.call(l.context,e,r,o,s),!0;case 6:return l.fn.call(l.context,e,r,o,s,a),!0}for(d=1,f=new Array(c-1);d<c;d++)f[d-1]=arguments[d];l.fn.apply(l.context,f)}else{var m=l.length,v;for(d=0;d<m;d++)switch(l[d].once&&this.removeListener(n,l[d].fn,void 0,!0),c){case 1:l[d].fn.call(l[d].context);break;case 2:l[d].fn.call(l[d].context,e);break;case 3:l[d].fn.call(l[d].context,e,r);break;case 4:l[d].fn.call(l[d].context,e,r,o);break;default:if(!f)for(v=1,f=new Array(c-1);v<c;v++)f[v-1]=arguments[v];l[d].fn.apply(l[d].context,f)}}return!0};Ee.prototype.on=function(n,e,r){return Ef(this,n,e,r,!1)};Ee.prototype.once=function(n,e,r){return Ef(this,n,e,r,!0)};Ee.prototype.removeListener=function(n,e,r,o){var s=Ge?Ge+n:n;if(!this._events[s])return this;if(!e)return Xo(this,s),this;var a=this._events[s];if(a.fn)a.fn===e&&(!o||a.once)&&(!r||a.context===r)&&Xo(this,s);else{for(var u=0,l=[],c=a.length;u<c;u++)(a[u].fn!==e||o&&!a[u].once||r&&a[u].context!==r)&&l.push(a[u]);l.length?this._events[s]=l.length===1?l[0]:l:Xo(this,s)}return this};Ee.prototype.removeAllListeners=function(n){var e;return n?(e=Ge?Ge+n:n,this._events[e]&&Xo(this,e)):(this._events=new si,this._eventsCount=0),this};Ee.prototype.off=Ee.prototype.removeListener;Ee.prototype.addListener=Ee.prototype.on;Ee.prefixed=Ge;Ee.EventEmitter=Ee;typeof Ia!="undefined"&&(Ia.exports=Ee)});var es=j((gT,ai)=>{p();var My=Es();function Iy(t,n,e){return(n=My(n))in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}ai.exports=Iy,ai.exports.__esModule=!0,ai.exports.default=ai.exports});var $f=j((bT,li)=>{p();var xy=Ds(),Ay=Os(),Ry=Ui(),Dy=Ns();function Py(t){return xy(t)||Ay(t)||Ry(t)||Dy()}li.exports=Py,li.exports.__esModule=!0,li.exports.default=li.exports});var Nd=j(Pd=>{p();(function(t){"use strict";function n(k,w){var P;return k instanceof Buffer?P=k:P=Buffer.from(k.buffer,k.byteOffset,k.byteLength),P.toString(w)}var e=function(w){return Buffer.from(w)};function r(k){for(var w=0,P=Math.min(65536,k.length+1),R=new Uint16Array(P),B=[],W=0;;){var I=w<k.length;if(!I||W>=P-1){var X=R.subarray(0,W),Z=X;if(B.push(String.fromCharCode.apply(null,Z)),!I)return B.join("");k=k.subarray(w),w=0,W=0}var U=k[w++];if((U&128)===0)R[W++]=U;else if((U&224)===192){var E=k[w++]&63;R[W++]=(U&31)<<6|E}else if((U&240)===224){var E=k[w++]&63,$=k[w++]&63;R[W++]=(U&31)<<12|E<<6|$}else if((U&248)===240){var E=k[w++]&63,$=k[w++]&63,K=k[w++]&63,ge=(U&7)<<18|E<<12|$<<6|K;ge>65535&&(ge-=65536,R[W++]=ge>>>10&1023|55296,ge=56320|ge&1023),R[W++]=ge}}}function o(k){for(var w=0,P=k.length,R=0,B=Math.max(32,P+(P>>>1)+7),W=new Uint8Array(B>>>3<<3);w<P;){var I=k.charCodeAt(w++);if(I>=55296&&I<=56319){if(w<P){var X=k.charCodeAt(w);(X&64512)===56320&&(++w,I=((I&1023)<<10)+(X&1023)+65536)}if(I>=55296&&I<=56319)continue}if(R+4>W.length){B+=8,B*=1+w/k.length*2,B=B>>>3<<3;var Z=new Uint8Array(B);Z.set(W),W=Z}if((I&4294967168)===0){W[R++]=I;continue}else if((I&4294965248)===0)W[R++]=I>>>6&31|192;else if((I&4294901760)===0)W[R++]=I>>>12&15|224,W[R++]=I>>>6&63|128;else if((I&4292870144)===0)W[R++]=I>>>18&7|240,W[R++]=I>>>12&63|128,W[R++]=I>>>6&63|128;else continue;W[R++]=I&63|128}return W.slice?W.slice(0,R):W.subarray(0,R)}var s="Failed to ",a=function(w,P,R){if(w)throw new Error("".concat(s).concat(P,": the '").concat(R,"' option is unsupported."))},u=typeof Buffer=="function"&&Buffer.from,l=u?e:o;function c(){this.encoding="utf-8"}c.prototype.encode=function(k,w){return a(w&&w.stream,"encode","stream"),l(k)};function f(k){var w;try{var P=new Blob([k],{type:"text/plain;charset=UTF-8"});w=URL.createObjectURL(P);var R=new XMLHttpRequest;return R.open("GET",w,!1),R.send(),R.responseText}finally{w&&URL.revokeObjectURL(w)}}var d=!u&&typeof Blob=="function"&&typeof URL=="function"&&typeof URL.createObjectURL=="function",m=["utf-8","utf8","unicode-1-1-utf-8"],v=r;u?v=n:d&&(v=function(w){try{return f(w)}catch(P){return r(w)}});var _="construct 'TextDecoder'",S="".concat(s," ").concat(_,": the ");function M(k,w){a(w&&w.fatal,_,"fatal"),k=k||"utf-8";var P;if(u?P=Buffer.isEncoding(k):P=m.indexOf(k.toLowerCase())!==-1,!P)throw new RangeError("".concat(S," encoding label provided ('").concat(k,"') is invalid."));this.encoding=k,this.fatal=!1,this.ignoreBOM=!1}M.prototype.decode=function(k,w){a(w&&w.stream,"decode","stream");var P;return k instanceof Uint8Array?P=k:k.buffer instanceof ArrayBuffer?P=new Uint8Array(k.buffer):P=new Uint8Array(k),v(P,this.encoding)},t.TextEncoder=t.TextEncoder||c,t.TextDecoder=t.TextDecoder||M})(typeof window!="undefined"?window:typeof global!="undefined"?global:Pd)});var Eu=j((OI,yg)=>{"use strict";p();function ae(t){if(this._capacity=mg(t),this._length=0,this._front=0,hg(t)){for(var n=t.length,e=0;e<n;++e)this[e]=t[e];this._length=n}}ae.prototype.toArray=function(){for(var n=this._length,e=new Array(n),r=this._front,o=this._capacity,s=0;s<n;++s)e[s]=this[r+s&o-1];return e};ae.prototype.push=function(n){var e=arguments.length,r=this._length;if(e>1){var o=this._capacity;if(r+e>o){for(var a=0;a<e;++a){this._checkCapacity(r+1);var s=this._front+r&this._capacity-1;this[s]=arguments[a],r++,this._length=r}return r}else{for(var s=this._front,a=0;a<e;++a)this[s+r&o-1]=arguments[a],s++;return this._length=r+e,r+e}}if(e===0)return r;this._checkCapacity(r+1);var a=this._front+r&this._capacity-1;return this[a]=n,this._length=r+1,r+1};ae.prototype.pop=function(){var n=this._length;if(n!==0){var e=this._front+n-1&this._capacity-1,r=this[e];return this[e]=void 0,this._length=n-1,r}};ae.prototype.shift=function(){var n=this._length;if(n!==0){var e=this._front,r=this[e];return this[e]=void 0,this._front=e+1&this._capacity-1,this._length=n-1,r}};ae.prototype.unshift=function(n){var e=this._length,r=arguments.length;if(r>1){var a=this._capacity;if(e+r>a){for(var u=r-1;u>=0;u--){this._checkCapacity(e+1);var a=this._capacity,o=(this._front-1&a-1^a)-a;this[o]=arguments[u],e++,this._length=e,this._front=o}return e}else{for(var s=this._front,u=r-1;u>=0;u--){var o=(s-1&a-1^a)-a;this[o]=arguments[u],s=o}return this._front=s,this._length=e+r,e+r}}if(r===0)return e;this._checkCapacity(e+1);var a=this._capacity,u=(this._front-1&a-1^a)-a;return this[u]=n,this._length=e+1,this._front=u,e+1};ae.prototype.peekBack=function(){var n=this._length;if(n!==0){var e=this._front+n-1&this._capacity-1;return this[e]}};ae.prototype.peekFront=function(){if(this._length!==0)return this[this._front]};ae.prototype.get=function(n){var e=n;if(e===(e|0)){var r=this._length;if(e<0&&(e=e+r),!(e<0||e>=r))return this[this._front+e&this._capacity-1]}};ae.prototype.isEmpty=function(){return this._length===0};ae.prototype.clear=function(){for(var n=this._length,e=this._front,r=this._capacity,o=0;o<n;++o)this[e+o&r-1]=void 0;this._length=0,this._front=0};ae.prototype.toString=function(){return this.toArray().toString()};ae.prototype.valueOf=ae.prototype.toString;ae.prototype.removeFront=ae.prototype.shift;ae.prototype.removeBack=ae.prototype.pop;ae.prototype.insertFront=ae.prototype.unshift;ae.prototype.insertBack=ae.prototype.push;ae.prototype.enqueue=ae.prototype.push;ae.prototype.dequeue=ae.prototype.shift;ae.prototype.toJSON=ae.prototype.toArray;Object.defineProperty(ae.prototype,"length",{get:function(){return this._length},set:function(){throw new RangeError("")}});ae.prototype._checkCapacity=function(n){this._capacity<n&&this._resizeTo(mg(this._capacity*1.5+16))};ae.prototype._resizeTo=function(n){var e=this._capacity;this._capacity=n;var r=this._front,o=this._length;if(r+o>e){var s=r+o&e-1;lv(this,0,this,e,s)}};var hg=Array.isArray;function lv(t,n,e,r,o){for(var s=0;s<o;++s)e[s+r]=t[s+n],t[s+n]=void 0}function cv(t){return t=t>>>0,t=t-1,t=t|t>>1,t=t|t>>2,t=t|t>>4,t=t|t>>8,t=t|t>>16,t+1}function mg(t){if(typeof t!="number")if(hg(t))t=t.length;else return 16;return cv(Math.min(Math.max(16,t),1073741824))}yg.exports=ae});var Sp=j((tA,Cp)=>{p();Cp.exports={version:"2.37.2387"}});var eh=j((FR,Zp)=>{p();Zp.exports=OfficePlatformGlobal.Telemetry.OTel});var nh=j(($R,th)=>{p();th.exports=OfficePlatformGlobal.Telemetry.OTelSDX});var fh=j(Ss=>{"use strict";p();Object.defineProperty(Ss,"__esModule",{value:!0});var qv;(function(t){t.DesignerSlideSuggestion="Designer.Slides",t.TextToSmartArtSuggestion="Designer.TextToSmartArt",t.PowerPointTextTileChanged="PowerPoint.TextTileChanged",t.SlideContentChange="PowerPoint.SlideContentChange",t.IdeasExecuteAction="Ideas.ExecuteAction"})(qv=Ss.MessageType||(Ss.MessageType={}))});var dh=j(ks=>{"use strict";p();Object.defineProperty(ks,"__esModule",{value:!0});var Hv;(function(t){t[t.Error=0]="Error",t[t.Warn=1]="Warn",t[t.Info=2]="Info",t[t.Debug=3]="Debug"})(Hv=ks.LoggingLevel||(ks.LoggingLevel={}))});var gh=j(_s=>{"use strict";p();Object.defineProperty(_s,"__esModule",{value:!0});var Vv;(function(t){t.NotSet="NotSet",t.Timeout="Timeout",t.NetworkError="NetworkError",t.ServiceError="ServiceError",t.ParsingError="ParsingError",t.AuthenticationError="AuthenticationError",t.UnhandledException="UnhandledException"})(Vv=_s.ProviderErrorType||(_s.ProviderErrorType={}))});var ph=j(ws=>{"use strict";p();Object.defineProperty(ws,"__esModule",{value:!0});var zv;(function(t){t.Invalid="Invalid",t.Success="Success",t.Error="Error",t.Pending="Pending",t.NoResult="NoResult"})(zv=ws.ProviderResultStatus||(ws.ProviderResultStatus={}))});var hh=j(Ts=>{"use strict";p();Object.defineProperty(Ts,"__esModule",{value:!0});var jv;(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"})(jv=Ts.SamplingPolicy||(Ts.SamplingPolicy={}))});var mh=j(xe=>{"use strict";p();Object.defineProperty(xe,"__esModule",{value:!0});var Jv;(function(t){t.DESIGNER_SLIDE_PROVIDER_ID="Provider.Designer.Slide",t.SLIDE_SUGGESTION_ID="EntityGroup.Designer.Slide.Suggestion"})(Jv=xe.DesignerSlideProviderIdentifier||(xe.DesignerSlideProviderIdentifier={}));var Kv;(function(t){t.MAKE_IT_VISUAL_PROVIDER_ID="Provider.UCI.MakeItVisual",t.MAKE_IT_VISUAL_KEYWORDS_ID="EntityGroup.UCI.MakeItVisual.Keywords"})(Kv=xe.MakeItVisualProviderIdentifier||(xe.MakeItVisualProviderIdentifier={}));var Qv;(function(t){t.DESIGNER_TEXT_TO_SMARTART_PROVIDER_ID="Provider.Designer.TextToSmartArt",t.TEXT_TO_SMARTART_SUGGESTION_ID="EntityGroup.Designer.TextToSmartArt.Suggestion"})(Qv=xe.DesignerTextToSmartArtProviderIdentifier||(xe.DesignerTextToSmartArtProviderIdentifier={}));var Yv;(function(t){t.HUBBLE_PROVIDER_ID="Provider.Hubble",t.HUBBLE_IMAGES_GROUP_ID="EntityGroup.Hubble.Images"})(Yv=xe.HubbleProviderIdentifier||(xe.HubbleProviderIdentifier={}));var Xv;(function(t){t.TAP_SEARCH_QF_PROVIDER_ID="Provider.Tap.Search.QF",t.TAP_SEARCH_QF_AND_OLS_PROVIDER_ID="Provider.Tap.Search.QFAndOLS",t.TAP_SEARCH_OLS_PROVIDER_ID="Provider.Tap.Search.OLS",t.TAP_SEARCH_SP_PROVIDER_ID="Provider.Tap.Search.SP",t.TAP_SEARCH_ZERO_TERM_QF_PROVIDER_ID="Provider.Tap.Search.ZeroTerm.QF",t.TAP_SEARCH_ZERO_TERM_QF_AND_OLS_PROVIDER_ID="Provider.Tap.Search.ZeroTerm.QFAndOLS",t.TAP_SEARCH_ZERO_TERM_OLS_PROVIDER_ID="Provider.Tap.Search.ZeroTerm.OLS",t.TAP_SEARCH_ZERO_TERM_SP_PROVIDER_ID="Provider.Tap.Search.ZeroTerm.SP",t.DOCUMENT_ID="EntityGroup.Tap.Document"})(Xv=xe.TapProviderIdentifier||(xe.TapProviderIdentifier={}));var Zv;(function(t){t.DICTIONARY_PROVIDER_ID="Provider.UCI.Dictionary",t.DICTIONARY_WORDS_GROUP_ID="EntityGroup.UCI.Dictionary.Words"})(Zv=xe.DictionaryProviderIdentifier||(xe.DictionaryProviderIdentifier={}));var eC;(function(t){t.IMAGES_PROVIDER_ID="Provider.UCI.Images",t.IMAGES_ID="EntityGroup.UCI.Images.Images"})(eC=xe.ImagesProviderIdentifier||(xe.ImagesProviderIdentifier={}));var tC;(function(t){t.INSIGHTS_PROVIDER_ID="Provider.UCI.Insights",t.BINGANSWER_COMPUTATION_ID="EntityGroup.UCI.Insights.BingAnswer.Computation",t.BINGANSWER_CURRENCY_ID="EntityGroup.UCI.Insights.BingAnswer.Currency",t.BINGANSWER_FACTS_ID="EntityGroup.UCI.Insights.BingAnswer.Facts",t.BINGANSWER_FINANCE_ID="EntityGroup.UCI.Insights.BingAnswer.Finance",t.BINGANSWER_NEWS_ID="EntityGroup.UCI.Insights.BingAnswer.News",t.BINGANSWER_WEATHER_ID="EntityGroup.UCI.Insights.BingAnswer.Weather",t.DICTIONARY_ID="EntityGroup.UCI.Insights.Dictionary",t.ENTITIES_ID="EntityGroup.UCI.Insights.Entities",t.IMAGES_ID="EntityGroup.UCI.Insights.Images",t.WEBRESULTS_ID="EntityGroup.UCI.Insights.WebResults",t.WIKIPEDIARESULTS_ID="EntityGroup.UCI.Insights.WikipediaResults"})(tC=xe.InsightsProviderIdentifier||(xe.InsightsProviderIdentifier={}))});var al=j(He=>{"use strict";p();Object.defineProperty(He,"__esModule",{value:!0});var nC=fh();He.MessageType=nC.MessageType;var rC=dh();He.LoggingLevel=rC.LoggingLevel;var iC=gh();He.ProviderErrorType=iC.ProviderErrorType;var oC=ph();He.ProviderResultStatus=oC.ProviderResultStatus;var sC=hh();He.SamplingPolicy=sC.SamplingPolicy;var yn=mh();He.DesignerSlideProviderIdentifier=yn.DesignerSlideProviderIdentifier;He.MakeItVisualProviderIdentifier=yn.MakeItVisualProviderIdentifier;He.DesignerTextToSmartArtProviderIdentifier=yn.DesignerTextToSmartArtProviderIdentifier;He.HubbleProviderIdentifier=yn.HubbleProviderIdentifier;He.TapProviderIdentifier=yn.TapProviderIdentifier;He.DictionaryProviderIdentifier=yn.DictionaryProviderIdentifier;He.ImagesProviderIdentifier=yn.ImagesProviderIdentifier;He.InsightsProviderIdentifier=yn.InsightsProviderIdentifier});var yh=j(ul=>{"use strict";p();Object.defineProperty(ul,"__esModule",{value:!0});var Fi=al(),aC=(function(){function t(n,e){this.logger=n,this.configuration=e,this.shouldMatchDocumentTitle=!1,this.shouldMatchDocumentTitle=this.configuration?this.configuration.shouldQueryMatchQfDocumentTitle:t.defaultShouldQueryMatchQfDocumentTitle}return t.prototype.rank=function(n,e){var r=this,o=e.rankedEntityGroups.slice();return o.sort(function(s,a){var u=r.getProviderRank(n,s),l=r.getProviderRank(n,a);return s.providerId==a.providerId&&s.providerId==Fi.InsightsProviderIdentifier.INSIGHTS_PROVIDER_ID?s.rank-a.rank:u-l}),e.rankedEntityGroups=o,this.logger.info(595994314,"[SmartLookupRanker] RankedResults",{interactionId:n.interactionId,transactionId:n.transactionId,queryMatchEnabled:this.shouldMatchDocumentTitle,ranking:e.rankedEntityGroups.map(function(s){return s.groupTypeId})}),e},t.prototype.getProviderRank=function(n,e){var r=this;if(e.providerId==Fi.TapProviderIdentifier.TAP_SEARCH_QF_PROVIDER_ID&&this.shouldMatchDocumentTitle){var o=e;if(o.groupTypeId==Fi.TapProviderIdentifier.DOCUMENT_ID){var s=n,a=s!=null&&s.tapContext!=null?s.tapContext.queryText.toLocaleLowerCase().split(t.separators).filter(function(u){return u}):void 0;if(o.data.find(function(u){return r.isTextContainsSearchWords(u.Title.toLocaleLowerCase(),a)}))this.logger.debug(595973527,"[SmartLookupRanker] Query match with Qf Document succeeded",{interactionId:n.interactionId,transactionId:n.transactionId});else return this.logger.debug(595973526,"[SmartLookupRanker] Query match with Qf Document failed",{interactionId:n.interactionId,transactionId:n.transactionId}),Number.MAX_VALUE}}return t.providerRank[e.providerId]?t.providerRank[e.providerId]:Number.MAX_VALUE},t.prototype.isTextContainsSearchWords=function(n,e){if(e==null||n==null)return!1;var r=n.split(t.separators);return e.every(function(o){return r.find(function(s){return s.indexOf(o)>=0})!=null})},t.providerRank=(bs={},bs[Fi.TapProviderIdentifier.TAP_SEARCH_QF_PROVIDER_ID]=1,bs[Fi.InsightsProviderIdentifier.INSIGHTS_PROVIDER_ID]=2,bs),t.separators=/[\s]+/,t.defaultShouldQueryMatchQfDocumentTitle=!1,t})();ul.SmartLookupRanker=aC;var bs});var vh=j(ll=>{"use strict";p();Object.defineProperty(ll,"__esModule",{value:!0});var uC=yh();ll.SmartLookupRanker=uC.SmartLookupRanker});var Ch=j((AD,Gi)=>{p();function lC(t){if(t==null)throw new TypeError("Cannot destructure "+t)}Gi.exports=lC,Gi.exports.__esModule=!0,Gi.exports.default=Gi.exports});p();var Nh=C(ml());p();var $i=C(vl());p();var he=(function(t){return t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=3]="Info",t[t.Metric=4]="Metric",t[t.Verbose=5]="Verbose",t[t.Debug=6]="Debug",t})({});$i.CustomTypeRegistry.registerTypeInfos({"AugLoopData::InputData":{InputSchema:"$string",InputJson:"$string",CorrelationVector:"$string"},"AugLoopData::ResultData":{InputSchema:"$string",InputJson:"$string",OutputSchema:"$string",OutputJson:"$string"},"AugLoopData::ServiceGroups":{OfficeServiceGroup:"$number",ControllerServiceGroup:"$number"},"AugLoopData::HostMetadata":{AppName:"$string",AppPlatform:"$string",AppVersion:"$string",UILanguage:"$string",ClientId:"$string",ReleaseAudienceGroup:"$string",ReleaseChannel:"$string",ReleaseFork:"$string",SessionId:"$string",Flights:"$string",PrivateMode:"$boolean",DisabledServiceGroups:["$array","AugLoopData::ServiceGroups"],SystemTimezone:["opt-field","$string"],IsClientTelemetrySampled:["opt-field","$boolean"]},"AugLoopData::ConfigTicket":{Provider:"$number",Policy:"$string",Target:"$string",ResourceId:"$string",AuthorityUrl:"$string"},"AugLoopData::ConnectParams":{isSeedingRequired:["opt-field","$boolean"],sessionUrl:["opt-field","$string"],origin:["opt-field","$string"],authToken:["opt-field","$string"],routingSessionKey:["opt-field","$string"],blobFileId:["opt-field","$string"]},"AugLoopData::AuthTokenRequest":{Tickets:["$array","AugLoopData::ConfigTicket"],DocId:["opt-field","$string"],DocSessionId:["opt-field","$string"],TokenType:["opt-field","$number"],ConnectParams:["opt-field","AugLoopData::ConnectParams"],Claims:["opt-field","$string"],Interactive:["opt-field","$boolean"]},"AugLoopData::AuthTokenResponse":{Token:"$string",TokenError:["opt-field","$number"]},"AugLoopData::IdentityWithToken":{IdentityId:"$string",Token:"$string"},"AugLoopData::AuthTokensResponse":{Identites:["$array","AugLoopData::IdentityWithToken"]},"AugLoopData::CreateSessionParameters":{docSessionId:["opt-field","$string"],extensionConfigs:["opt-field",["$array","$string"]],flights:["opt-field","$string"],serviceUrl:["opt-field","$string"],offlineMode:["opt-field","$boolean"],tid3pHost:["opt-field","$string"]},"AugLoopData::ActivateAnnotationParameters":{annotationType:"$string",token:"$string",config:["opt-field","$string"],docSessionId:["opt-field","$string"],forceReturnCachedAnnotations:["opt-field","$boolean"],sendApologies:["opt-field","$boolean"]},"AugLoopData::ReleaseAnnotationParameters":{token:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::SubmitOperationsParameters":{operations:["$array","$string"],cv:["opt-field","$string"],docSessionId:["opt-field","$string"]},"AugLoopData::SubmitSeedGroupOperationsParameters":{operations:["$array","$string"],groupComplete:["opt-field","$boolean"],cv:["opt-field","$string"],docSessionId:["opt-field","$string"]},"AugLoopData::SubmitCustomMessageParameters":{message:"$string",messageId:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::ForceReconnectParameters":{docSessionId:["opt-field","$string"],extensionConfigs:["opt-field",["$array","$string"]]},"AugLoopData::CloseParameters":{docSessionId:["opt-field","$string"]},"AugLoopData::AuthenticateInteractiveParameters":{docSessionId:["opt-field","$string"],token:["opt-field","$string"]},"AugLoopData::SetSessionCloseCallbackParameters":{docSessionId:["opt-field","$string"]},"AugLoopData::SetConnectCallbackParameters":{docSessionId:["opt-field","$string"]},"AugLoopData::SetDisconnectCallbackParameters":{docSessionId:["opt-field","$string"]},"AugLoopData::SetClaimsChallengeCallbackParameters":{docSessionId:["opt-field","$string"],token:["opt-field","$number"]},"AugLoopData::SetSeedingStatusChangeCallbackParameters":{docSessionId:["opt-field","$string"],token:["opt-field","$number"]},"AugLoopData::SetOfflineModeParameters":{docSessionId:["opt-field","$string"]},"AugLoopData::SDXBridgeMessageParameters":{bridgeMessage:"$string"},"AugLoopData::SetServerAuthenticationStateChangeCallbackParameters":{docSessionId:["opt-field","$string"]},"AugLoopData::ActivateServerRequestResponseParameters":{annotationType:"$string",token:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::CreateSessionResult":{errMessage:["opt-field","$string"],docSessionId:["opt-field","$string"]},"AugLoopData::ActivateAnnotationResult":{errMessage:["opt-field","$string"],token:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::AnnotationResult":{operation:"$string",token:"$string",docSessionId:["opt-field","$string"],annotationType:"$string",areApologies:["opt-field","$boolean"],cv:["opt-field","$string"]},"AugLoopData::ReleaseAnnotationResult":{errMessage:["opt-field","$string"],token:"$string",result:["opt-field","$boolean"]},"AugLoopData::SubmitCustomMessageResult":{errMessage:["opt-field","$string"],response:["opt-field","$string"],messageId:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::ForceReconnectResult":{errMessage:["opt-field","$string"],docSessionId:["opt-field","$string"]},"AugLoopData::SessionCloseResult":{sessionCloseMessage:["opt-field","$string"],docSessionId:["opt-field","$string"]},"AugLoopData::AuthenticateInteractiveResult":{errMessage:["opt-field","$string"],token:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::ConnectResult":{isSeedingRequired:"$boolean",sessionUrl:"$string",origin:"$string",authToken:"$string",docSessionId:["opt-field","$string"],routingSessionKey:["opt-field","$string"],blobFileId:["opt-field","$string"]},"AugLoopData::DisconnectResult":{error:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::ClaimsChallengeResult":{claimsChallengeMessage:["opt-field","$string"],docSessionId:["opt-field","$string"],token:["opt-field","$number"]},"AugLoopData::SeedingStatusChangeResult":{seedingStatusChangeMessage:["opt-field","$string"],docSessionId:["opt-field","$string"],token:["opt-field","$number"]},"AugLoopData::ServerAuthenticationStateChangeResult":{state:["opt-field","$number"],docSessionId:["opt-field","$string"]},"AugLoopData::ActivateServerRequestResponseResult":{errMessage:["opt-field","$string"],token:"$string",docSessionId:["opt-field","$string"]},"AugLoopData::ServerRequestResponseAnnotationResult":{annotation:"$string",token:"$string",docSessionId:["opt-field","$string"],annotationType:"$string"}});var Hh={NativeService:["AugLoopData::NativeService",{OnResult:["FireAndForgetMethod",["AugLoopData::ResultData"]],OnCreateSessionResult:["FireAndForgetMethod",["AugLoopData::CreateSessionResult"]],OnActivateAnnotationResult:["FireAndForgetMethod",["AugLoopData::ActivateAnnotationResult"]],OnAnnotationResult:["FireAndForgetMethod",["AugLoopData::AnnotationResult"]],OnReleaseAnnotationResult:["FireAndForgetMethod",["AugLoopData::ReleaseAnnotationResult"]],OnSubmitCustomMessageResult:["FireAndForgetMethod",["AugLoopData::SubmitCustomMessageResult"]],OnForceReconnectResult:["FireAndForgetMethod",["AugLoopData::ForceReconnectResult"]],OnSessionCloseResult:["FireAndForgetMethod",["AugLoopData::SessionCloseResult"]],OnAuthenticateInteractiveResult:["FireAndForgetMethod",["AugLoopData::AuthenticateInteractiveResult"]],OnConnectResult:["FireAndForgetMethod",["AugLoopData::ConnectResult"]],OnDisconnectResult:["FireAndForgetMethod",["AugLoopData::DisconnectResult"]],OnClaimsChallengeResult:["FireAndForgetMethod",["AugLoopData::ClaimsChallengeResult"]],OnSeedingStatusChangeResult:["FireAndForgetMethod",["AugLoopData::SeedingStatusChangeResult"]],OnSDXBridgeMessageResult:["FireAndForgetMethod",["AugLoopData::SDXBridgeMessageParameters"]],OnSetServerAuthenticationStateChangeCallbackResult:["FireAndForgetMethod",["AugLoopData::ServerAuthenticationStateChangeResult"]],OnActivateServerRequestResponseResult:["FireAndForgetMethod",["AugLoopData::ActivateServerRequestResponseResult"]],OnServerRequestResponseAnnotationResult:["FireAndForgetMethod",["AugLoopData::ServerRequestResponseAnnotationResult"]],RequestAuthToken:["ReturnsPromiseMethod","AugLoopData::AuthTokenResponse",["AugLoopData::AuthTokenRequest"]],RequestAuthTokens:["ReturnsPromiseMethod","AugLoopData::AuthTokensResponse",["AugLoopData::AuthTokenRequest"]],IsFeatureEnabled:["ReturnsPromiseMethod","$boolean",["$string","$string"]],IsChangeGateEnabled:["ReturnsPromiseMethod","$boolean",["$string"]],ExecuteLocalLambda:["ReturnsPromiseMethod","$string",["AugLoopData::InputData","$string","$string"]],AreLicenseFeaturesEnabled:["ReturnsPromiseMethod","$boolean",[["$array","$number"]]],SendDiagnosticTrace:["FireAndForgetMethod",["$number","$number","$string"]],OnSetServiceUrl:["Event","$string"],OnSetHostMetadata:["Event","AugLoopData::HostMetadata"],OnSubmit:["Event","AugLoopData::InputData"],OnCreateSession:["Event","AugLoopData::CreateSessionParameters"],OnActivateAnnotation:["Event","AugLoopData::ActivateAnnotationParameters"],OnReleaseAnnotation:["Event","AugLoopData::ReleaseAnnotationParameters"],OnSubmitOperations:["Event","AugLoopData::SubmitOperationsParameters"],OnSubmitSeedGroupOperations:["Event","AugLoopData::SubmitSeedGroupOperationsParameters"],OnSubmitCustomMessage:["Event","AugLoopData::SubmitCustomMessageParameters"],OnForceReconnect:["Event","AugLoopData::ForceReconnectParameters"],OnClose:["Event","AugLoopData::CloseParameters"],OnAuthenticateInteractive:["Event","AugLoopData::AuthenticateInteractiveParameters"],OnSetSessionCloseCallback:["Event","AugLoopData::SetSessionCloseCallbackParameters"],OnSetConnectCallback:["Event","AugLoopData::SetConnectCallbackParameters"],OnSetDisconnectCallback:["Event","AugLoopData::SetDisconnectCallbackParameters"],OnSetClaimsChallengeCallback:["Event","AugLoopData::SetClaimsChallengeCallbackParameters"],OnSetSeedingStatusChangeCallback:["Event","AugLoopData::SetSeedingStatusChangeCallbackParameters"],OnSetOfflineMode:["Event","AugLoopData::SetOfflineModeParameters"],OnSDXBridgeMessageFromNative:["Event","AugLoopData::SDXBridgeMessageParameters"],OnSetServerAuthenticationStateChangeCallback:["Event","AugLoopData::SetServerAuthenticationStateChangeCallbackParameters"],OnActivateServerRequestResponse:["Event","AugLoopData::ActivateServerRequestResponseParameters"]}]},Cl={NativeService:$i.RekaServiceRegistry.getNativeService(Hh.NativeService)};p();var fl=C(Rs()),Rh=C(mt());p();p();var Li=C(Re()),el=C(F()),tl=C(G());p();p();var xl;(function(t){t[t.Unknown=0]="Unknown",t[t.LiveId=1]="LiveId",t[t.OrgId=2]="OrgId",t[t.ActiveDirectory=3]="ActiveDirectory",t[t.ADAL=4]="ADAL",t[t.SSPI=5]="SSPI",t[t.OAuth2=6]="OAuth2",t[t.Badger=7]="Badger"})(xl||(xl={}));var rn;(function(t){t[t.Augloop=0]="Augloop",t[t.Substrate=1]="Substrate"})(rn||(rn={}));var Gr;(function(t){t[t.Unknown=0]="Unknown",t[t.TokenMissingInteractionRequired=1]="TokenMissingInteractionRequired"})(Gr||(Gr={}));p();var ot;(function(t){t[t.Input=0]="Input",t[t.Exception=1]="Exception",t[t.WaitOn=2]="WaitOn",t[t.StopAndFilterWorkflow=3]="StopAndFilterWorkflow"})(ot||(ot={}));var te;(function(t){t[t.Unknown=0]="Unknown",t[t.NoOutput=1]="NoOutput",t[t.Authentication=2]="Authentication",t[t.JoinTimedOut=3]="JoinTimedOut",t[t.LambdaThrow=4]="LambdaThrow",t[t.LambdaErrorCallback=5]="LambdaErrorCallback"})(te||(te={}));p();var $r;(function(t){var n;(function(e){e[e.Undefined=0]="Undefined",e[e.Delete=1]="Delete",e[e.Add=2]="Add",e[e.Change=3]="Change",e[e.Refresh=4]="Refresh"})(n=t.SlideTileEventType||(t.SlideTileEventType={}))})($r||($r={}));p();var kn;(function(t){var n;(function(u){u[u.Unknown=0]="Unknown",u[u.Text=1]="Text",u[u.Slide=2]="Slide"})(n=t.TileType||(t.TileType={}));var e;(function(u){u[u.Generic=0]="Generic",u[u.Title=1]="Title",u[u.SmartArt=2]="SmartArt",u[u.TableCell=3]="TableCell",u[u.TextBox=4]="TextBox",u[u.Notes=5]="Notes"})(e=t.TextTileType||(t.TextTileType={}));var r;(function(u){u[u.Undefined=0]="Undefined",u[u.Word=1]="Word",u[u.Phrase=2]="Phrase",u[u.Sentence=3]="Sentence",u[u.Paragraph=4]="Paragraph"})(r=t.TextTileElementUnit||(t.TextTileElementUnit={}));var o;(function(u){u[u.Undefined=0]="Undefined",u[u.Bullet=1]="Bullet",u[u.Numbered=2]="Numbered"})(o=t.ListType||(t.ListType={}));var s;(function(u){u[u.Undefined=0]="Undefined",u[u.AlphaLcParenBoth=1]="AlphaLcParenBoth",u[u.AlphaUcParenBoth=2]="AlphaUcParenBoth",u[u.AlphaLcParenR=3]="AlphaLcParenR",u[u.AlphaUcParenR=4]="AlphaUcParenR",u[u.AlphaLcPeriod=5]="AlphaLcPeriod",u[u.AlphaUcPeriod=6]="AlphaUcPeriod",u[u.ArabicParenBoth=7]="ArabicParenBoth",u[u.ArabicParenR=8]="ArabicParenR",u[u.ArabicPeriod=9]="ArabicPeriod",u[u.ArabicPlain=10]="ArabicPlain",u[u.RomanLcParenBoth=11]="RomanLcParenBoth",u[u.RomanUcParenBoth=12]="RomanUcParenBoth",u[u.RomanLcParenR=13]="RomanLcParenR",u[u.RomanUcParenR=14]="RomanUcParenR",u[u.RomanLcPeriod=15]="RomanLcPeriod",u[u.RomanUcPeriod=16]="RomanUcPeriod",u[u.CircleNumDbPlain=17]="CircleNumDbPlain",u[u.CircleNumWdBlackPlain=18]="CircleNumWdBlackPlain",u[u.CircleNumWdWhitePlain=19]="CircleNumWdWhitePlain",u[u.ArabicDbPeriod=20]="ArabicDbPeriod",u[u.ArabicDbPlain=21]="ArabicDbPlain",u[u.Ea1ChsPeriod=22]="Ea1ChsPeriod",u[u.Ea1ChsPlain=23]="Ea1ChsPlain",u[u.Ea1ChtPeriod=24]="Ea1ChtPeriod",u[u.Ea1ChtPlain=25]="Ea1ChtPlain",u[u.Ea1JpnChsDbPeriod=26]="Ea1JpnChsDbPeriod",u[u.Ea1JpnKorPlain=27]="Ea1JpnKorPlain",u[u.Ea1JpnKorPeriod=28]="Ea1JpnKorPeriod",u[u.Arabic1Minus=29]="Arabic1Minus",u[u.Arabic2Minus=30]="Arabic2Minus",u[u.Hebrew2Minus=31]="Hebrew2Minus",u[u.ThaiAlphaPeriod=32]="ThaiAlphaPeriod",u[u.ThaiAlphaParenR=33]="ThaiAlphaParenR",u[u.ThaiAlphaParenBoth=34]="ThaiAlphaParenBoth",u[u.ThaiNumPeriod=35]="ThaiNumPeriod",u[u.ThaiNumParenR=36]="ThaiNumParenR",u[u.ThaiNumParenBoth=37]="ThaiNumParenBoth",u[u.HindiAlphaPeriod=38]="HindiAlphaPeriod",u[u.HindiNumPeriod=39]="HindiNumPeriod",u[u.HindiNumParenR=40]="HindiNumParenR",u[u.HindiAlpha1Period=41]="HindiAlpha1Period"})(s=t.ListNumeration||(t.ListNumeration={}));var a;(function(u){u[u.Undefined=0]="Undefined",u[u.Delete=1]="Delete",u[u.Add=2]="Add",u[u.Change=3]="Change",u[u.Refresh=4]="Refresh"})(a=t.TextTileEventType||(t.TextTileEventType={}))})(kn||(kn={}));p();var yt;(function(t){t[t.Undefined=0]="Undefined",t[t.Schema=1]="Schema",t[t.Boolean=2]="Boolean",t[t.Number=3]="Number",t[t.String=4]="String",t[t.Buffer=5]="Buffer",t[t.Function=6]="Function"})(yt||(yt={}));var Cm={category:yt.Schema,schema:{name:"Exception",path:"message-schema.proto"}},mS={category:yt.Schema,schema:{name:"Filter",path:"message-schema.proto"}},_n=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(n==null)return"Invalid message passed";if(n.payload==null)return`${te[te.NoOutput]}: Payload is null`;if(n.payload.exceptionType==null)return"Payload is not an exception";var r=te[n.payload.exceptionType];return r+=n.payload.message?`: ${n.payload.message}`:": No description",r+=e&&n.payload.data?`
${n.payload.data.toString()}`:"",r},Al=function(n){return n==null||n.payload==null||n.payload.exceptionType==null?te.Unknown:n.payload.exceptionType},Nt=function(n,e){if(n==null)throw new Error("Cannot set exception on null message");n.payload=e,n.payloadSchema=Cm,n.messageType=ot.Exception};p();p();var tc=C(G()),nc=C(F());p();var Xn;(function(t){t[t.EditorLowPrivilege=0]="EditorLowPrivilege",t[t.AugLoopLowPrivilege=1]="AugLoopLowPrivilege",t[t.Anonymous=2]="Anonymous",t[t.ClientAssertion=3]="ClientAssertion",t[t.ClientAssertionV2=4]="ClientAssertionV2",t[t.AutoClpLowPrivilege=5]="AutoClpLowPrivilege",t[t.AutoClpAppOnlyLowPrivilege=6]="AutoClpAppOnlyLowPrivilege",t[t.Substrate=7]="Substrate",t[t.WacUserInfo=8]="WacUserInfo",t[t.OwaExchange=9]="OwaExchange",t[t.SmartCompose=10]="SmartCompose",t[t.WritingAnalyticsLowPrivilege=11]="WritingAnalyticsLowPrivilege",t[t.DWEngineLowPrivilege=12]="DWEngineLowPrivilege",t[t.SubstrateApp=13]="SubstrateApp",t[t.CortanaAppPop=14]="CortanaAppPop",t[t.OfficeAppsAppOnly=15]="OfficeAppsAppOnly",t[t.PPTFrontdoorAppPop=16]="PPTFrontdoorAppPop",t[t.EditorAppOnlyLowPrivilege=17]="EditorAppOnlyLowPrivilege",t[t.AugLoopApp=18]="AugLoopApp",t[t.MeetingIntelligenceApp=19]="MeetingIntelligenceApp",t[t.GraphApp=20]="GraphApp",t[t.IceServicesApp=21]="IceServicesApp",t[t.AzureMapsApp=22]="AzureMapsApp",t[t.SpoApp=23]="SpoApp",t[t.OneDrive=24]="OneDrive",t[t.GoogleDrive=25]="GoogleDrive",t[t.GettyApp=26]="GettyApp",t[t.Dropbox=27]="Dropbox",t[t.GooglePhotos=28]="GooglePhotos",t[t.EditorApp=29]="EditorApp",t[t.AmazonKindle=30]="AmazonKindle",t[t.ShredderApp=31]="ShredderApp",t[t.FormsLowPrivilege=32]="FormsLowPrivilege",t[t.VivaSalesLowPrivilege=33]="VivaSalesLowPrivilege",t[t.IntentSvcApp=34]="IntentSvcApp",t[t.DcgLowPrivilege=35]="DcgLowPrivilege",t[t.CSALowPrivilege=36]="CSALowPrivilege",t[t.ConsumerSydneyLowPrivilege=37]="ConsumerSydneyLowPrivilege",t[t.CompliantSydneyApp=38]="CompliantSydneyApp",t[t.M365AdminApp=39]="M365AdminApp",t[t.MeetingArtifactsServiceLowPrivilege=40]="MeetingArtifactsServiceLowPrivilege",t[t.AlchemyApp=41]="AlchemyApp",t[t.M365Admin=42]="M365Admin",t[t.ConsumerShellApp=43]="ConsumerShellApp",t[t.PowerQueryLowPrivilege=44]="PowerQueryLowPrivilege",t[t.CIIApp=45]="CIIApp",t[t.ConsumerShell=46]="ConsumerShell",t[t.AssistCopilotLowPrivilege=47]="AssistCopilotLowPrivilege",t[t.Pva=48]="Pva",t[t.TeamsCopilotServiceLowPrivilege=49]="TeamsCopilotServiceLowPrivilege",t[t.CallAnalytics=50]="CallAnalytics",t[t.IncomingPFT=51]="IncomingPFT",t[t.GraphExchange=52]="GraphExchange",t[t.EXOAdmin=53]="EXOAdmin",t[t.InsightsServicesLowPrivilege=54]="InsightsServicesLowPrivilege",t[t.VivaServicesLowPrivilege=55]="VivaServicesLowPrivilege",t[t.EcsAppOnly=56]="EcsAppOnly",t[t.ShredderLowPrivilege=57]="ShredderLowPrivilege",t[t.SpoLowPrivilege=58]="SpoLowPrivilege",t[t.PromptValidationApp=59]="PromptValidationApp",t[t.CompliantSydneyLowPrivilege=60]="CompliantSydneyLowPrivilege",t[t.SubstrateTenantFeedbackApp=61]="SubstrateTenantFeedbackApp",t[t.MonitoringPlatform=62]="MonitoringPlatform",t[t.YammerLowPrivilege=63]="YammerLowPrivilege",t[t.VivaLearningLowPrivilege=64]="VivaLearningLowPrivilege",t[t.VivaInsightsLowPrivilege=65]="VivaInsightsLowPrivilege",t[t.ClientAugLoopApp=66]="ClientAugLoopApp",t[t.AssistAuthLowPrivilege=67]="AssistAuthLowPrivilege",t[t.VivaLearningSearchPreProdLowPrivilege=68]="VivaLearningSearchPreProdLowPrivilege",t[t.SubstrateSearchApp=69]="SubstrateSearchApp",t[t.SparkContentPlatformLowPrivilege=70]="SparkContentPlatformLowPrivilege",t[t.SparkContentPlatformPopApp=71]="SparkContentPlatformPopApp",t[t.ConsumerSydneyApp=72]="ConsumerSydneyApp",t[t.BusinessAssistAuthLowPrivilege=73]="BusinessAssistAuthLowPrivilege",t[t.AzureResourceManager=74]="AzureResourceManager",t[t.AlchemyPortal=75]="AlchemyPortal",t[t.VivaUserSkillsApp=76]="VivaUserSkillsApp",t[t.VivaEngageAppPop=77]="VivaEngageAppPop",t[t.SubstrateAppOnly=78]="SubstrateAppOnly",t[t.PowerAutomateFlowCreationLowPrivilege=79]="PowerAutomateFlowCreationLowPrivilege",t[t.PowerAutomateConnectionCreationLowPrivilege=80]="PowerAutomateConnectionCreationLowPrivilege",t[t.PowerAutomateAuthorizeConnectionLowPrivilege=81]="PowerAutomateAuthorizeConnectionLowPrivilege",t[t.TCAAppPop=82]="TCAAppPop",t[t.BusinessAssistAuthAppPop=83]="BusinessAssistAuthAppPop",t[t.HolmesApp=84]="HolmesApp",t[t.GraphAppOnly=85]="GraphAppOnly",t[t.SimsApp=86]="SimsApp",t[t.VivaOrgInsightsLowPrivilege=87]="VivaOrgInsightsLowPrivilege",t[t.VivaGoalsAppPop=88]="VivaGoalsAppPop",t[t.GCBotAppPop=89]="GCBotAppPop",t[t.ShredderV2App=90]="ShredderV2App",t[t.ShredderV2LowPrivilege=91]="ShredderV2LowPrivilege",t[t.AmplifyProfileService=92]="AmplifyProfileService",t[t.AzureDevopsLowPrivilege=93]="AzureDevopsLowPrivilege",t[t.CommuteServices=94]="CommuteServices",t[t.GCBotAppOnly=95]="GCBotAppOnly",t[t.TCAAppOnly=96]="TCAAppOnly",t[t.MavenAgentLowPrivilege=97]="MavenAgentLowPrivilege",t[t.VivaOrgInsightsAppPop=98]="VivaOrgInsightsAppPop",t[t.EduAssignmentsPftAtPop=99]="EduAssignmentsPftAtPop",t[t.AugloopAppPop=100]="AugloopAppPop",t[t.OneNoteLowPrivilege=101]="OneNoteLowPrivilege",t[t.TeamsAuthzSvcAppPop=102]="TeamsAuthzSvcAppPop",t[t.LoopAppPop=103]="LoopAppPop",t[t.LoopAppOnly=104]="LoopAppOnly",t[t.BapLowPrivilege=105]="BapLowPrivilege",t[t.IC3AppPop=106]="IC3AppPop",t[t.PowerPlatformApiGateway=107]="PowerPlatformApiGateway",t[t.OdspNotifyAppPop=108]="OdspNotifyAppPop",t[t.MIPSyncService=109]="MIPSyncService",t[t.RightsManagementServices=110]="RightsManagementServices",t[t.TCAV2AppPop=111]="TCAV2AppPop",t[t.SubstrateLLMLowPrivilege=112]="SubstrateLLMLowPrivilege",t[t.SubstrateSearchLowPrivilege=113]="SubstrateSearchLowPrivilege",t[t.CloudPolicyServiceAppPop=114]="CloudPolicyServiceAppPop",t[t.TCAV2LowPrivilege=115]="TCAV2LowPrivilege",t[t.AiHubServicesAppPop=116]="AiHubServicesAppPop",t[t.TMRAppOnly=117]="TMRAppOnly",t[t.PacmanAppPop=118]="PacmanAppPop",t[t.AugloopAlternativeIdentity=119]="AugloopAlternativeIdentity",t[t.SpoAppOnly=120]="SpoAppOnly",t[t.DataverseLowPrivilege=121]="DataverseLowPrivilege",t[t.SubstrateLLMApp=122]="SubstrateLLMApp",t[t.SimsAppOnly=123]="SimsAppOnly",t[t.PythonService=124]="PythonService",t[t.PythonServiceAppOnly=125]="PythonServiceAppOnly",t[t.DesignerAppServiceLowPrivilege=126]="DesignerAppServiceLowPrivilege",t[t.DesignerAppServiceAppPop=127]="DesignerAppServiceAppPop",t[t.AmplifyProfileServiceAppOnly=128]="AmplifyProfileServiceAppOnly",t[t.MARSAppPop=129]="MARSAppPop",t[t.PlannerAppPop=130]="PlannerAppPop",t[t.BingForBusinessLowPrivilege=131]="BingForBusinessLowPrivilege",t[t.OLS=132]="OLS",t[t.OLSAppPop=133]="OLSAppPop",t[t.GCS=134]="GCS",t[t.AugLoopConsumer=135]="AugLoopConsumer",t[t.ContentValidationServiceAppOnly=136]="ContentValidationServiceAppOnly",t[t.FabricLowPrivilege=137]="FabricLowPrivilege",t[t.FeatureAccessManagementAppPop=138]="FeatureAccessManagementAppPop",t[t.FireIntelligenceAppOnly=139]="FireIntelligenceAppOnly",t[t.MARSLowPrivilege=140]="MARSLowPrivilege",t[t.EXOAdminAppPop=141]="EXOAdminAppPop",t[t.IncomingAT=142]="IncomingAT",t[t.CopilotLabLowPrivilege=143]="CopilotLabLowPrivilege",t[t.VivaPulseLowPrivilege=144]="VivaPulseLowPrivilege",t[t.WacAppPop=145]="WacAppPop",t[t.PowerAppsAiBuilderLowPrivilege=146]="PowerAppsAiBuilderLowPrivilege",t[t.CognitiveApiAppOnly=147]="CognitiveApiAppOnly",t[t.CopilotMetricsAppOnly=148]="CopilotMetricsAppOnly",t[t.ShredderAppOnly=149]="ShredderAppOnly",t[t.TeamsAuthzSvcLowPrivilege=150]="TeamsAuthzSvcLowPrivilege",t[t.PlannerLowPrivilege=151]="PlannerLowPrivilege",t[t.VivaGlintLowPrivilege=152]="VivaGlintLowPrivilege",t[t.DiscoveryServiceAppPop=153]="DiscoveryServiceAppPop",t[t.PowerAppsOrchardLowPrivilege=154]="PowerAppsOrchardLowPrivilege",t[t.EduSkillingPlatformPftAtPop=155]="EduSkillingPlatformPftAtPop",t[t.IncomingPFTAppOnly=156]="IncomingPFTAppOnly",t[t.EduSkillingPlatformLowPrivilege=157]="EduSkillingPlatformLowPrivilege",t[t.MCPSAppOnly=158]="MCPSAppOnly",t[t.TeamsMiddleTierLowPrivilege=159]="TeamsMiddleTierLowPrivilege",t[t.SharePointESignatureAppPop=160]="SharePointESignatureAppPop",t[t.SparkContentPlatformAppOnly=161]="SparkContentPlatformAppOnly",t[t.LuminaLowPrivilege=162]="LuminaLowPrivilege",t[t.OfficeScriptsServiceAppPop=163]="OfficeScriptsServiceAppPop",t[t.OfficeScriptsServiceLowPrivilege=164]="OfficeScriptsServiceLowPrivilege",t[t.BingApisAppOnly=165]="BingApisAppOnly",t[t.ChronosAppPop=166]="ChronosAppPop",t[t.AsyncMediaServiceLowPrivilege=167]="AsyncMediaServiceLowPrivilege",t[t.CompliantSydneyV2App=168]="CompliantSydneyV2App",t[t.McpPlatformLowPrivilege=169]="McpPlatformLowPrivilege",t[t.McpPlatformAppPop=170]="McpPlatformAppPop",t[t.LuminaApp=171]="LuminaApp",t[t.MetaOsLowPrivilege=172]="MetaOsLowPrivilege",t[t.MetaOsAppPop=173]="MetaOsAppPop",t[t.AugLoopKustoClusterLowPrivilege=174]="AugLoopKustoClusterLowPrivilege",t[t.InsightsServicesAppPop=175]="InsightsServicesAppPop",t[t.TeamsAuthzSvcAppOnly=176]="TeamsAuthzSvcAppOnly",t[t.PowerPlatformApiGatewayProd=177]="PowerPlatformApiGatewayProd",t[t.CallRecorderAppPop=178]="CallRecorderAppPop",t[t.TeamsAdminCenterLowPrivilege=179]="TeamsAdminCenterLowPrivilege",t[t.TeamsAdminCenterAppPop=180]="TeamsAdminCenterAppPop",t[t.LokiAppPop=181]="LokiAppPop",t[t.PowerPlatformApiTestLowPrivilege=182]="PowerPlatformApiTestLowPrivilege",t[t.PowerAppsOrchardTestLowPrivilege=183]="PowerAppsOrchardTestLowPrivilege",t[t.CloudPolicyServiceLowPrivilege=184]="CloudPolicyServiceLowPrivilege",t[t.GCBotLowPrivilege=185]="GCBotLowPrivilege",t[t.AlchemyLowPrivilege=186]="AlchemyLowPrivilege",t[t.LoopLowPrivilege=187]="LoopLowPrivilege",t[t.IceServicesLowPrivilege=188]="IceServicesLowPrivilege",t[t.WacLowPrivilege=189]="WacLowPrivilege",t[t.TCALowPrivilege=190]="TCALowPrivilege",t[t.CollaborationProtectionLowPrivilege=191]="CollaborationProtectionLowPrivilege",t[t.FirenzeAppOnly=192]="FirenzeAppOnly",t[t.IC3TeamsSchedulerLowPrivilege=193]="IC3TeamsSchedulerLowPrivilege",t[t.IC3TeamsSchedulerAppPop=194]="IC3TeamsSchedulerAppPop",t[t.BingV3AppOnly=195]="BingV3AppOnly",t[t.OdspNotifyLowPrivilege=196]="OdspNotifyLowPrivilege",t[t.SimsLowPrivilege=197]="SimsLowPrivilege"})(Xn||(Xn={}));var Rl;(function(t){t[t.Unknown=0]="Unknown",t[t.Consumer=1]="Consumer",t[t.Enterprise=2]="Enterprise"})(Rl||(Rl={}));var Hi;(function(t){t[t.Default=0]="Default",t[t.EDPSCompliant=1]="EDPSCompliant"})(Hi||(Hi={}));var Dl;(function(t){t.AuthorizationCode="authorization_code",t.ClientCredentials="client_credentials",t.RefreshToken="refresh_token"})(Dl||(Dl={}));var Pl;(function(t){t[t.LoggedIn=0]="LoggedIn",t[t.LoggedOut=1]="LoggedOut"})(Pl||(Pl={}));p();p();var on;(function(t){t[t.Undefined=0]="Undefined",t[t.Created=10]="Created",t[t.Sent=20]="Sent",t[t.Duplicated=30]="Duplicated",t[t.Seen=40]="Seen",t[t.Tried=50]="Tried",t[t.Kept=60]="Kept",t[t.Rejected=70]="Rejected"})(on||(on={}));var Ls;(function(t){t.Working="working",t.Completed="completed",t.Failed="failed",t.Cancelled="cancelled",t.InputRequired="input_required"})(Ls||(Ls={}));p();var Nl=C(G()),Ol=C(F());var wn;(function(t){t[t.None=0]="None",t[t.HttpsGetDownloadUrl=1]="HttpsGetDownloadUrl",t[t.AlCodedLocation=2]="AlCodedLocation",t[t.Token=3]="Token",t[t.SpeAlCodedLocation=4]="SpeAlCodedLocation",t[t.LocalAlCodedLocation=5]="LocalAlCodedLocation"})(wn||(wn={}));var Ws;(function(t){t[t.NewDocument=0]="NewDocument",t[t.EditDocument=1]="EditDocument",t[t.ViewOnlyDocument=2]="ViewOnlyDocument"})(Ws||(Ws={}));var Zn=(0,Nl.default)(function t(){(0,Ol.default)(this,t)});Zn.lowerIndexBound=1;Zn.maxNumberOfRows=1048576;Zn.maxNumberOfColumns=16384;Zn.firstColumnName="A";Zn.lastColumnName="XFD";var Fs;(function(t){t.TokenProvisionMessage="TokenProvisionMessage",t.RefreshCopilotLicenseSignal="RefreshCopilotLicenseSignal"})(Fs||(Fs={}));p();var vt=C(F()),Ct=C(G());p();var Bl=C(Re()),El=C(F()),Ll=C(G()),g=(function(){function t(n){(0,El.default)(this,t),t.assign(t,this,n)}return(0,Ll.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_SchemaObject"}},{key:"getBaseTypes",value:function(){return[]}},{key:"getTypeNameFor",value:function(e){return e&&e.H_?e.H_.T_:void 0}},{key:"getBaseTypesFor",value:function(e){return e&&e.H_&&e.H_.B_&&Array.isArray(e.H_.B_)?e.H_.B_:[]}},{key:"getAllTypesFor",value:function(e){var r=t.getTypeNameFor(e);return r?[r].concat((0,Bl.default)(t.getBaseTypesFor(e))):[]}},{key:"matchesTypesFor",value:function(e,r){if(!Array.isArray(r)||r.length===0)return!0;var o=t.getTypeNameFor(e),s=t.getBaseTypesFor(e);for(var a of r)if(a===o||s.indexOf(a)>=0)return!0;return!1}},{key:"assign",value:function(e,r,o){if(o)for(var s of Object.keys(o))r[s]=o[s];return r.H_=e.H_,r}}])})();g.H_={T_:g.getTypeName(),B_:g.getBaseTypes()};var st=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_Annotation"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();st.H_={T_:st.getTypeName(),B_:st.getBaseTypes()};var Vi=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_BinaryClassificationAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Vi.H_={T_:Vi.getTypeName(),B_:Vi.getBaseTypes()};var zi=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_StreamAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();zi.H_={T_:zi.getTypeName(),B_:zi.getBaseTypes()};var ji=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_ExecutionCorrelatedAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ji.H_={T_:ji.getTypeName(),B_:ji.getBaseTypes()};var Ji=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_ClaimsChallengeAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ji.H_={T_:Ji.getTypeName(),B_:Ji.getBaseTypes()};var Ki=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_TaskInformationAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ki.H_={T_:Ki.getTypeName(),B_:Ki.getBaseTypes()};var Qi=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_TasksGetAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Qi.H_={T_:Qi.getTypeName(),B_:Qi.getBaseTypes()};var Yi=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_TaskAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Yi.H_={T_:Yi.getTypeName(),B_:Yi.getBaseTypes()};var Xi=(function(){function t(n){(0,vt.default)(this,t),g.assign(t,this,n)}return(0,Ct.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_TaskResourceAnnotation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_TaskAnnotation","AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Xi.H_={T_:Xi.getTypeName(),B_:Xi.getBaseTypes()};p();var _e=C(F()),we=C(G());var Zi=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_ItemDelta"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Zi.H_={T_:Zi.getTypeName(),B_:Zi.getBaseTypes()};var eo=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_ItemChangesDelta"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_ItemDelta"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();eo.H_={T_:eo.getTypeName(),B_:eo.getBaseTypes()};var Ot=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_Operation"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ot.H_={T_:Ot.getTypeName(),B_:Ot.getBaseTypes()};var to=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_OperationWithSiblingContext"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();to.H_={T_:to.getTypeName(),B_:to.getBaseTypes()};var Me=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_AddOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_OperationWithSiblingContext","AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Me.H_={T_:Me.getTypeName(),B_:Me.getBaseTypes()};var er=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_MoveOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_OperationWithSiblingContext","AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();er.H_={T_:er.getTypeName(),B_:er.getBaseTypes()};var Bt=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_UpdateAnnotationMetaDataOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Bt.H_={T_:Bt.getTypeName(),B_:Bt.getBaseTypes()};var Ve=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_UpdateOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ve.H_={T_:Ve.getTypeName(),B_:Ve.getBaseTypes()};var St=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_DeleteOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();St.H_={T_:St.getTypeName(),B_:St.getBaseTypes()};var no=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_PurgeOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();no.H_={T_:no.getTypeName(),B_:no.getBaseTypes()};var ro=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_PurgeSubtreeExceptTypesOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ro.H_={T_:ro.getTypeName(),B_:ro.getBaseTypes()};var io=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_PurgeByTypesOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();io.H_={T_:io.getTypeName(),B_:io.getBaseTypes()};var oo=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_FocusOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();oo.H_={T_:oo.getTypeName(),B_:oo.getBaseTypes()};var so=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_VisibilityOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();so.H_={T_:so.getTypeName(),B_:so.getBaseTypes()};var We=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_DeltaUpdateOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();We.H_={T_:We.getTypeName(),B_:We.getBaseTypes()};var ao=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_MicroSyncOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ao.H_={T_:ao.getTypeName(),B_:ao.getBaseTypes()};var at=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Signals_SignalOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();at.H_={T_:at.getTypeName(),B_:at.getBaseTypes()};var uo=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_CancelSignalTriggeredWorkflowExecutionOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();uo.H_={T_:uo.getTypeName(),B_:uo.getBaseTypes()};var Gs=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_OperationWithResourceId"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Gs.H_={T_:Gs.getTypeName(),B_:Gs.getBaseTypes()};var lo=(function(){function t(n){(0,_e.default)(this,t),g.assign(t,this,n)}return(0,we.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_InvalidateWorkflowOperation"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_OperationWithResourceId","AugLoop_Core_Operation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();lo.H_={T_:lo.getTypeName(),B_:lo.getBaseTypes()};p();var an=C(F()),un=C(G());var sn=(function(){function t(n){(0,an.default)(this,t),g.assign(t,this,n)}return(0,un.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Signals_Signal"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();sn.H_={T_:sn.getTypeName(),B_:sn.getBaseTypes()};var co=(function(){function t(n){(0,an.default)(this,t),g.assign(t,this,n)}return(0,un.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_TaskSignal"}},{key:"getBaseTypes",value:function(){return["AugLoop_Signals_Signal"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();co.H_={T_:co.getTypeName(),B_:co.getBaseTypes()};var fo=(function(){function t(n){(0,an.default)(this,t),g.assign(t,this,n)}return(0,un.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_DirtyAreaSignal"}},{key:"getBaseTypes",value:function(){return["AugLoop_Signals_Signal"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();fo.H_={T_:fo.getTypeName(),B_:fo.getBaseTypes()};var go=(function(){function t(n){(0,an.default)(this,t),g.assign(t,this,n)}return(0,un.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_DirtyDocumentSignal"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_DirtyAreaSignal","AugLoop_Signals_Signal"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();go.H_={T_:go.getTypeName(),B_:go.getBaseTypes()};var po=(function(){function t(n){(0,an.default)(this,t),g.assign(t,this,n)}return(0,un.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_TaskSubscribeSignal"}},{key:"getBaseTypes",value:function(){return["AugLoop_Signals_Signal"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();po.H_={T_:po.getTypeName(),B_:po.getBaseTypes()};var ho=(function(){function t(n){(0,an.default)(this,t),g.assign(t,this,n)}return(0,un.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_TaskDeleteSignal"}},{key:"getBaseTypes",value:function(){return["AugLoop_Signals_Signal"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ho.H_={T_:ho.getTypeName(),B_:ho.getBaseTypes()};var mo=(function(){function t(n){(0,an.default)(this,t),g.assign(t,this,n)}return(0,un.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_TasksGetSignal"}},{key:"getBaseTypes",value:function(){return["AugLoop_Signals_Signal"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();mo.H_={T_:mo.getTypeName(),B_:mo.getBaseTypes()};p();var De=C(F()),Pe=C(G());var yo=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_BlobContainer"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();yo.H_={T_:yo.getTypeName(),B_:yo.getBaseTypes()};var vo=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_Blob"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();vo.H_={T_:vo.getTypeName(),B_:vo.getBaseTypes()};var Co=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_Binary"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Co.H_={T_:Co.getTypeName(),B_:Co.getBaseTypes()};var So=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_TileGroup"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();So.H_={T_:So.getTypeName(),B_:So.getBaseTypes()};var ko=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_Session"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_TileGroup"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ko.H_={T_:ko.getTypeName(),B_:ko.getBaseTypes()};var tr=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_Document"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_TileGroup"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();tr.H_={T_:tr.getTypeName(),B_:tr.getBaseTypes()};var nr=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_SubDocument"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();nr.H_={T_:nr.getTypeName(),B_:nr.getBaseTypes()};var _o=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_GridCell"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();_o.H_={T_:_o.getTypeName(),B_:_o.getBaseTypes()};var wo=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_GridNeighborhoodContext"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();wo.H_={T_:wo.getTypeName(),B_:wo.getBaseTypes()};var To=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_ItemFilter"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();To.H_={T_:To.getTypeName(),B_:To.getBaseTypes()};var bo=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_DynamicContext"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();bo.H_={T_:bo.getTypeName(),B_:bo.getBaseTypes()};var rr=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_ContextHolder"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();rr.H_={T_:rr.getTypeName(),B_:rr.getBaseTypes()};var Tn=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_UserContextHolder"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_ContextHolder"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Tn.H_={T_:Tn.getTypeName(),B_:Tn.getBaseTypes()};var bn=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_TenantContextHolder"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_ContextHolder"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();bn.H_={T_:bn.getTypeName(),B_:bn.getBaseTypes()};var Mo=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_EventsHolder"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Mo.H_={T_:Mo.getTypeName(),B_:Mo.getBaseTypes()};var Io=(function(){function t(n){(0,De.default)(this,t),g.assign(t,this,n)}return(0,Pe.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_UserCommandsHolder"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_EventsHolder"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Io.H_={T_:Io.getTypeName(),B_:Io.getBaseTypes()};p();var or=C(F()),sr=C(G());var ir=(function(){function t(n){(0,or.default)(this,t),g.assign(t,this,n)}return(0,sr.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_Apology"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ir.H_={T_:ir.getTypeName(),B_:ir.getBaseTypes()};var xo=(function(){function t(n){(0,or.default)(this,t),g.assign(t,this,n)}return(0,sr.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_SecondaryApology"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Apology","AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();xo.H_={T_:xo.getTypeName(),B_:xo.getBaseTypes()};var Ao=(function(){function t(n){(0,or.default)(this,t),g.assign(t,this,n)}return(0,sr.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_WorkflowActivationFailureDetails"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ao.H_={T_:Ao.getTypeName(),B_:Ao.getBaseTypes()};var Ro=(function(){function t(n){(0,or.default)(this,t),g.assign(t,this,n)}return(0,sr.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Core_AuthTokenIsMissingDetails"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_WorkflowActivationFailureDetails"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ro.H_={T_:Ro.getTypeName(),B_:Ro.getBaseTypes()};var Do=(function(){function t(n){(0,or.default)(this,t),g.assign(t,this,n)}return(0,sr.default)(t,[{key:"metadata",get:function(){return this.M_},set:function(e){this.M_=e}}],[{key:"getTypeName",value:function(){return"AugLoop_Core_NotActivatedWorkflowApology"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_Apology","AugLoop_Core_Annotation"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Do.H_={T_:Do.getTypeName(),B_:Do.getBaseTypes()};p();var Om=C(G()),Bm=C(F()),Em=C(ut()),Lm=C(Je()),Wm=C(lt()),Fm=C(ql());var jr;(function(t){t[t.JoinContext=0]="JoinContext",t[t.Session=1]="Session"})(jr||(jr={}));p();var q;(function(t){t[t.error=0]="error",t[t.warn=1]="warn",t[t.info=3]="info",t[t.metric=4]="metric",t[t.verbose=5]="verbose",t[t.debug=6]="debug",t[t.disabled=7]="disabled"})(q||(q={}));p();var Jr;(function(t){t[t.ProductServiceUsage=2]="ProductServiceUsage",t[t.ProductServicePerformance=4]="ProductServicePerformance"})(Jr||(Jr={}));var No;(function(t){t[t.BasicEvent=10]="BasicEvent",t[t.FullEvent=100]="FullEvent",t[t.RequiredServiceDataEvent=110]="RequiredServiceDataEvent"})(No||(No={}));p();var Ce;(function(t){t[t.SingleItem=0]="SingleItem",t[t.Reduce=1]="Reduce",t[t.Grid=2]="Grid",t[t.Join=4]="Join",t[t.Generic=5]="Generic"})(Ce||(Ce={}));var Hl;(function(t){t.Default="Default",t.Copilot="Copilot"})(Hl||(Hl={}));var Vl;(function(t){t[t.None=0]="None",t[t.ContentFiltering_M365Copilot=1]="ContentFiltering_M365Copilot"})(Vl||(Vl={}));var Kr;(function(t){t[t.Default=0]="Default",t[t.LocalOnly=1]="LocalOnly",t[t.Exclusive=2]="Exclusive"})(Kr||(Kr={}));var zl;(function(t){t[t.PreActivate=0]="PreActivate",t[t.Default=1]="Default",t[t.DelayActivate=1]="DelayActivate",t[t.NeverActivate=2]="NeverActivate"})(zl||(zl={}));var Oo;(function(t){t[t.Required=-3]="Required",t[t.Optional=-1]="Optional"})(Oo||(Oo={}));var jl;(function(t){t[t.Never=0]="Never",t[t.Always=1]="Always"})(jl||(jl={}));var Jl;(function(t){t[t.PreSeed=1]="PreSeed",t[t.OnSeed=2]="OnSeed",t[t.PostSeed=4]="PostSeed",t[t.All=5]="All"})(Jl||(Jl={}));var Kl;(function(t){t[t.UpstreamWorkflowsReady=0]="UpstreamWorkflowsReady",t[t.AnnotationMetadataUpdated=1]="AnnotationMetadataUpdated",t[t.DeltaUpdate=2]="DeltaUpdate",t[t.NonExclusiveTriggerSignals=3]="NonExclusiveTriggerSignals"})(Kl||(Kl={}));var Ql;(function(t){t.Input="Input",t.Delta="Delta",t.UILanguage="UILanguage",t.MaxInputCount="MaxInputCount",t.ExtensionLimits="ExtensionLimits",t.CacheValidity="CacheValidity"})(Ql||(Ql={}));var Yl;(function(t){t.Flight="Flight",t.Setting="Setting",t.ChangeGate="ChangeGate"})(Yl||(Yl={}));var Xl;(function(t){t.SetPredefinedAnnotation="SetPredefinedAnnotation",t.ClearAnnotations="ClearAnnotations"})(Xl||(Xl={}));p();var Bo;(function(t){t.Log="Log"})(Bo||(Bo={}));var Gm=typeof process!="undefined"&&process.env?process.env.SERVICE_NAME:"client",Qr="abcdefghijklmnopqrstuvwxyz0123456789",Yr={97:0,98:1,99:2,100:3,101:4,102:5,103:6,104:7,105:8,106:9,107:10,108:11,109:12,110:13,111:14,112:15,113:16,114:17,115:18,116:19,117:20,118:21,119:22,120:23,121:24,122:25,48:26,49:27,50:28,51:29,52:30,53:31,54:32,55:33,56:34,57:35},Eo=[],Lo=[],Gt,rc=function(n){return null},ic=function(n){},ur=new Map,Hs=new Map,Vs=new Map,zs=new Map,Fo;(function(t){t.Default="",t.EDPSCompliant="edps"})(Fo||(Fo={}));var h;(function(t){t.defineCoreLogCategory=function(n){return{root:"Core",name:n}},t.defineWorkflowLogCategory=function(n){return{root:"Workflow",name:n}},t.clearLoggers=function(){Eo=[],Lo=[],Hs.clear(),Vs.clear()},t.clearAggregators=function(){ur.clear()},t.addLogger=function(n){Eo.indexOf(n)===-1&&(Eo.push(n),Zl(Hs,n))},t.addDecidingLogger=function(n){Lo.indexOf(n)===-1&&(Lo.push(n),Zl(Vs,n))},t.setCorrelationContextCallback=function(n){Gt=n},t.setStartPerformanceEventCallback=function(n){rc=n},t.setStopPerformanceEventCallback=function(n){ic=n},t.addAggregator=function(n){n.init(function(e,r){Xr(e,r)}),ur.has(n.eventName)?ur.get(n.eventName).push(n):ur.set(n.eventName,[n])},t.flushAggregators=function(n){ur.forEach(function(e){e.forEach(function(r){return r.flush(n)})})},t.setTagLevelOverride=function(n,e){var r=jm(n);zs.set(r,e)},t.resetTagLevelOverrides=function(){zs.clear()},t.error=function(n,e,r,o,s,a,u,l,c,f){ar(n,e,q.error,r,o,s,a,u,l,c,f)},t.warn=function(n,e,r,o,s,a,u,l,c,f){ar(n,e,q.warn,r,o,s,a,u,l,c,f)},t.info=function(n,e,r,o,s,a,u,l,c,f){ar(n,e,q.info,r,o,s,a,u,l,c,f)},t.verbose=function(n,e,r,o,s,a,u,l,c,f){ar(n,e,q.verbose,r,o,s,a,u,l,c,f)},t.debug=function(n,e,r,o,s,a,u,l,c,f){ar(n,e,q.debug,r,o,s,a,u,l,c,f)},t.metric=function(n,e,r,o,s,a,u,l,c,f){ar(n,e,q.metric,r,o,s,a,u,l,c,f)},t.formatMetric=function(n,e,r,o){var s={};return s[n]={dimensionNames:r,dimensionValues:o,value:e},s},t.dynamic=function(n){Xr(n)}})(h||(h={}));var Zl=function(n,e){var r=e.level;Object.keys(q).map(function(o){return q[o]}).filter(function(o){return typeof o!="string"}).filter(function(o){return o<=r}).forEach(function(o){n.has(o)?n.get(o).push(e):n.set(o,[e])})},$m=function(n,e,r,o,s,a,u,l){if(e===void 0&&(typeof n=="string"||typeof n=="object"))return n;if(e===void 0&&typeof n=="function")return n();var c=[];for(var f of[n,e,r,o,s,a,u,l])f!==void 0&&c.push(typeof f=="function"?f():f);return c},oc=function(n){if(typeof n=="string")return n;for(var e="",r=0;r<n.length;r++){r>0&&(e+=" ");var o=n[r];o instanceof Error?e+=JSON.stringify({message:o.message,name:o.name,stack:o.stack}):typeof o=="object"?e+=JSON.stringify(o):e+=o}return e},Wo=function(n){return`${n.root}.${n.name}`},sc=[],Um=["Level","Tag"],qm=["Level","Tag","Workflow"],Go=function(n){return js(n).length},js=function(n){return n!==void 0?Hs.get(n)||sc:Eo},Hm=function(n,e){var r=n!==void 0?Vs.get(n)||[]:Lo;return r.filter(function(o){return o.shouldLog(e)})},ar=function(n,e,r,o,s,a,u,l,c,f,d){var m;r=zs.get(n)||r;var v=js(r),_=Hm(r,o);if(!(v.length==0&&_.length==0)){var S=rc(Bo.Log),M=ac(n),k=$m(o,s,a,u,l,c,f,d);if(Vm(e))ec(k)&&Xr({eventName:"Metrics",tagId:M,category:Wo(e),traceLevel:r,message:"",getMetrics:function(){return k}},!1,v,_);else if(ec(k)){var w=k;w.tagId=M,w.category=Wo(e),w.eventName==="Operation"&&(Gt&&(w.workflow=(m=Gt())===null||m===void 0?void 0:m.workflow),e.root==="Workflow"&&(w.eventName="WorkflowOperation",Gt&&(w.joinContextId=Gt().joinContextId))),w.traceLevel=r;var P=ur.get(w.eventName);if(P)for(var R=0;R<P.length;++R){var B=P[R];if(B&&B.add(w,R===P.length-1))break}else Xr(w,!1,v,_)}else{var W=function(){var X;return e.root==="Core"?{TraceEventV2:{dimensionNames:function(){return Um},dimensionValues:[String(r),M],value:1}}:{WorkflowTraceEvent:{dimensionNames:function(){return qm},dimensionValues:[String(r),M,Gt?(X=Gt())===null||X===void 0?void 0:X.workflow:""],value:1}}};Xr({eventName:"Log",tagId:M,category:Wo(e),traceLevel:r,message:oc(k),getMetrics:W},!1,v,_)}ic(S)}},Xr=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,s,a,u,l,c,f,d,m,v,_,S,M,k,w;r==null&&(r=js(n.traceLevel)),o=o||sc;var P;if(r.length>0||o.length>0){if(n.serviceName=Gm,!e&&Gt){var R=Gt();R&&(P={disableLogging:R.disableLogging,userDataBoundaryType:(a=(s=R.sessionDescriptor)===null||s===void 0?void 0:s.userContext)===null||a===void 0?void 0:a.userDataBoundaryType},n.cv=n.cv?n.cv:R.cv.toString(),n.sessionKey=n.sessionKey?n.sessionKey:R.sessionKey,n.userTenantId=n.userTenantId?n.userTenantId:R.userTenantId,n.workflow=n.workflow?n.workflow:R.workflow,n.clientAppName=n.clientAppName?n.clientAppName:(u=R.clientMetadata)===null||u===void 0?void 0:u.appName,n.clientAppPlatform=n.clientAppPlatform?n.clientAppPlatform:(l=R.clientMetadata)===null||l===void 0?void 0:l.appPlatform,n.clientAppVersion=n.clientAppVersion?n.clientAppVersion:(c=R.clientMetadata)===null||c===void 0?void 0:c.appVersion,n.clientDocSessionId=n.clientDocSessionId?n.clientDocSessionId:(f=R.clientMetadata)===null||f===void 0?void 0:f.docSessionId,n.clientReleaseAudienceGroup=n.clientReleaseAudienceGroup?n.clientReleaseAudienceGroup:(d=R.clientMetadata)===null||d===void 0?void 0:d.releaseAudienceGroup,n.clientReleaseChannel=n.clientReleaseChannel?n.clientReleaseChannel:(m=R.clientMetadata)===null||m===void 0?void 0:m.releaseChannel,n.clientReleaseFork=n.clientReleaseFork?n.clientReleaseFork:(v=R.clientMetadata)===null||v===void 0?void 0:v.releaseFork,n.clientRuntimeVersion=n.clientRuntimeVersion?n.clientRuntimeVersion:(_=R.clientMetadata)===null||_===void 0?void 0:_.runtimeVersion,n.clientSessionId=n.clientSessionId?n.clientSessionId:(S=R.clientMetadata)===null||S===void 0?void 0:S.sessionId,n.clientUserAgent=n.clientUserAgent?n.clientUserAgent:(M=R.clientMetadata)===null||M===void 0?void 0:M.userAgent,n.traceId=n.traceId||R.traceId,n.isClientTelemetrySampled=n.isClientTelemetrySampled?n.isClientTelemetrySampled:(k=R.clientMetadata)===null||k===void 0?void 0:k.isClientTelemetrySampled,n.userDataBoundaryType=zm(P),n.ecsConfigIDs=(w=R.ecsConfigIDsManager)===null||w===void 0?void 0:w.getAllConfigIDsString())}for(var B of r)B.log(n,P);for(var W of o)W.log(n)}},Vm=function(n){return n.name===y.WorkflowMetricsOnly.name&&n.root===y.WorkflowMetricsOnly.root},ec=function(n){return!Array.isArray(n)&&typeof n=="object"},zm=function(n){switch(n==null?void 0:n.userDataBoundaryType){case Hi.EDPSCompliant:return Fo.EDPSCompliant;default:return Fo.Default}},ac=function(n){return Qr[n>>24&63]+Qr[n>>18&63]+Qr[n>>12&63]+Qr[n>>6&63]+Qr[n>>0&63]},jm=function(n){return n&&n.length===5?Yr[n.charCodeAt(0)]<<24|Yr[n.charCodeAt(1)]<<18|Yr[n.charCodeAt(2)]<<12|Yr[n.charCodeAt(3)]<<6|Yr[n.charCodeAt(4)]:-1},y=(0,tc.default)(function t(){(0,nc.default)(this,t)});y.CoreDefault=h.defineCoreLogCategory("Default");y.CoreSystem=h.defineCoreLogCategory("System");y.CoreUnsampled=h.defineCoreLogCategory("Unsampled");y.CoreMetricsOnly=h.defineCoreLogCategory("MetricsOnly");y.WorkflowDefault=h.defineWorkflowLogCategory("Default");y.WorkflowUnsampled=h.defineWorkflowLogCategory("Unsampled");y.WorkflowMetricsOnly=h.defineWorkflowLogCategory("MetricsOnly");y.PrivacyGuardEvent=h.defineCoreLogCategory("PrivacyGuardEvent");p();var Zr=C(Re()),fc=C(F()),dc=C(G()),gc=C(ut()),Ys=C(Je()),pc=C(lt());p();var Js={util:{},roots:{default:{}}},Pk=Js.util,Nk=Js.roots.default||(Js.roots.default={}),uc=(function(){function t(n){if(n)for(var e in n)n[e]!=null&&(this[e]=n[e])}return t.prototype.count=0,t.prototype.cv="",t.prototype.serviceName="",t.prototype.sessionKey="",t.prototype.traceId="",t.prototype.durationMs=0,t.prototype.success=!1,t.prototype.resultDescription="",t.prototype.resultJSON="",t.prototype.resultSignature="",t.prototype.operationName="",t.prototype.resourceId="",t.prototype.dimension0="",t.prototype.dimension1="",t.prototype.dimension2="",t.prototype.dimension3="",t.prototype.clientAppName="",t.prototype.clientAppPlatform="",t.prototype.clientRuntimeVersion="",t.prototype.clientAppVersion="",t.prototype.clientReleaseAudienceGroup="",t.prototype.clientReleaseChannel="",t.prototype.clientReleaseFork="",t.prototype.clientSessionId="",t.prototype.clientFlights="",t.prototype.clientIPRange="",t.prototype.clientDocSessionId="",t.prototype.clientUserAgent="",t.prototype.userType="",t.prototype.userId="",t.prototype.userTenantId="",t.prototype.workflow="",t.prototype.joinContextId="",t.prototype.ariaTenant="",t.prototype.ariaNamespace="",t.prototype.dataFields="",t.prototype.userDataBoundaryType="",t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/OperationEvent"},t})();p();var Ks={util:{},roots:{default:{}}},Ek=Ks.util,Lk=Ks.roots.default||(Ks.roots.default={}),lc=(function(){function t(n){if(n)for(var e in n)n[e]!=null&&(this[e]=n[e])}return t.prototype.sessionKey="",t.prototype.annotationType="",t.prototype.annotationState=0,t.prototype.workflowId="",t.prototype.traceId="",t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/AnnotationMetaDataChangeEvent"},t})();p();var Qs={util:{},roots:{default:{}}},Gk=Qs.util,$k=Qs.roots.default||(Qs.roots.default={}),cc=(function(){function t(n){if(n)for(var e in n)n[e]!=null&&(this[e]=n[e])}return t.prototype.cv="",t.prototype.serviceName="",t.prototype.sessionKey="",t.prototype.traceId="",t.prototype.clientAppName="",t.prototype.clientAppPlatform="",t.prototype.clientRuntimeVersion="",t.prototype.clientAppVersion="",t.prototype.clientReleaseAudienceGroup="",t.prototype.clientReleaseChannel="",t.prototype.clientReleaseFork="",t.prototype.clientSessionId="",t.prototype.clientFlights="",t.prototype.clientIPRange="",t.prototype.clientDocSessionId="",t.prototype.clientUserAgent="",t.prototype.userType="",t.prototype.userId="",t.prototype.userTenantId="",t.prototype.sessionHealthEventName="",t.prototype.source="",t.prototype.reason="",t.prototype.reasonDependency="",t.prototype.subReason="",t.prototype.impact="",t.prototype.success=!1,t.prototype.durationMs=0,t.prototype.count=0,t.prototype.message="",t.prototype.affectedWorkflows="",t.prototype.resourceId="",t.prototype.dimension0="",t.prototype.dimension1="",t.prototype.dimension2="",t.prototype.dimension3="",t.prototype.resultDescription="",t.prototype.resultSignature="",t.prototype.joinContextId="",t.prototype.userDataBoundaryType="",t.getTypeUrl=function(e){return e===void 0&&(e="type.googleapis.com"),e+"/SessionHealthEvent"},t})();p();var Jm=1e3,Km=1e6,Qm=1e6,Ym=1e3,Mn=(function(){return typeof process!="undefined"&&process.hrtime?function(){var t=process.hrtime();return t[0]*Jm+t[1]/Km}:typeof performance!="undefined"&&performance.now?function(){return performance.now()}:function(){return Date.now()}})(),Hk=(function(){return typeof process!="undefined"&&process.hrtime?function(){var t=process.hrtime();return t[0]*Qm+t[1]/Ym}:typeof performance!="undefined"&&performance.now?function(){return Math.round(performance.now()*1e3)}:function(){return Date.now()*1e3}})();function Xm(t,n,e){return n=(0,Ys.default)(n),(0,gc.default)(t,hc()?Reflect.construct(n,e||[],(0,Ys.default)(t).constructor):n.apply(t,e))}function hc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(hc=function(){return!!t})()}var kt=Symbol("dataFieldsObject"),lr=Symbol("dataFieldsAreDirty"),$o=Symbol("_dataFields"),b=(function(t){function n(e,r){var o;return(0,fc.default)(this,n),o=Xm(this,n,[e]),o.eventName="Operation",o.options=r,o.durationMs=e==null?void 0:e.durationMs,(!e||e.count==null)&&(o.count=1),e!=null&&e.dataFields&&(o.dataFields=e.dataFields),o}return(0,pc.default)(n,t),(0,dc.default)(n,[{key:"setClientMetadata",value:function(r,o){return r&&(this.clientAppName=r.appName,this.clientAppPlatform=r.appPlatform,this.clientAppVersion=r.appVersion,(o==null||!o)&&(this.clientFlights=r.flights),this.clientReleaseAudienceGroup=r.releaseAudienceGroup,this.clientReleaseChannel=r.releaseChannel,this.clientReleaseFork=r.releaseFork,this.clientRuntimeVersion=r.runtimeVersion,this.clientSessionId=r.sessionId,this.clientDocSessionId=r.docSessionId,this.clientUserAgent=r.userAgent),this}},{key:"setUserContext",value:function(r){return r&&(this.userId=r.puid||r.oid,this.userType=r.userType&&r.userType.toString(),this.userTenantId=r.tid),this}},{key:"setMetricCustomDimensions",value:function(r,o){if(!this.options)throw new Error(`Attempting to set custom dimensions ${r} to operation ${this.operationName} without activating MetricCount or MetricDuration`);this.options.metricCustomDimensions=this.options.metricCustomDimensions||{},this.options.metricCustomDimensions[r]=o}},{key:"setDataField",value:function(r,o){this[kt]||(this[kt]={}),this[kt][r]=o,this[lr]=!0}},{key:"setDataFields",value:function(r){this[kt]||(this[kt]={}),this[kt]=Object.assign(Object.assign({},this[kt]),r),this[lr]=!0}},{key:"start",value:function(){return this.startTime=Mn(),this}},{key:"recordStep",value:function(r){return this.setDataField(r,Math.floor(Mn()-this.startTime)),this}},{key:"stop",value:function(){var r=Mn();return this.durationMs=Math.round(r-this.startTime),this}},{key:"addCustomMetric",value:function(r){this.customMetrics===void 0&&(this.customMetrics=[]),this.customMetrics.push(r)}},{key:"getCustomMetrics",value:function(){var r=this,o=[];if(this.customMetrics!==void 0){var s=function(c){return[].concat((0,Zr.default)(r.getDimensionNames()),(0,Zr.default)(c.extraDimensions.map(function(f){return f.name})))},a=function(c){var f={};f[`${r.operationName}.${c.nameSuffix}`]={dimensionNames:function(){return s(c)},dimensionValues:[].concat((0,Zr.default)(r.getDimensionValues()),(0,Zr.default)(c.extraDimensions.map(function(d){return d.value}))),value:c.value},o.push(f)};for(var u of this.customMetrics)a(u)}return o}},{key:"getMetrics",value:function(r){var o,s,a={};if(this.operationName)switch(this.operationName){case"SessionHealthOrphanedEventsWithoutProperSessionKey":case"SessionHealthOrphanedSessions":case"WorkflowActivationState":a[this.operationName+".CountV2"]={dimensionNames:n.getOrphanedSessionHealthDimensionNames.bind(n),dimensionValues:this.getOrphanedSessionHealthDimensionValues(),value:this.count};break;case"MarkUnhealthySession":case"MarkHealthWarningSession":a[this.operationName+".Reason"]={dimensionNames:n.getSessionHealthDimensionNames.bind(n),dimensionValues:this.getSessionHealthDimensionValues(),value:1};break;default:if(this.operationName==="matchmaker_timer"&&(a["Workflow.DurationMs"]={dimensionNames:n.getWorkflowDimensionNames.bind(n),dimensionValues:this.getWorkflowDimensionValues(),value:this.durationMs||0},a["Workflow.Count"]={dimensionNames:n.getWorkflowDimensionNames.bind(n),dimensionValues:this.getWorkflowDimensionValues(),value:1}),this.durationMs!==void 0){var u=`${this.operationName}.DurationMsV2`;(!((o=this.options)===null||o===void 0)&&o.metricDuration||r.indexOf(u)>=0)&&(a[u]={dimensionNames:this.getDimensionNames.bind(this),dimensionValues:this.getDimensionValues(),value:this.durationMs})}{var l=`${this.operationName}.CountV2`;(!((s=this.options)===null||s===void 0)&&s.metricCount||r.indexOf(l)>=0)&&(a[l]={dimensionNames:this.getDimensionNames.bind(this),dimensionValues:this.getDimensionValues(),value:this.count})}}return a}},{key:"getDimensionNames",value:function(){var r,o,s=n.dimensionNames;if(!((r=this.options)===null||r===void 0)&&r.metricCustomDimensions){s=s.slice();for(var a in(o=this.options)===null||o===void 0?void 0:o.metricCustomDimensions)s.push(a)}return s}},{key:"getDimensionValues",value:function(){var r,o,s=[this.success,this.clientAppName,this.clientAppPlatform,this.resourceId,this.dimension0,this.dimension1,this.dimension2,this.dimension3];if(!((r=this.options)===null||r===void 0)&&r.metricCustomDimensions)for(var a in(o=this.options)===null||o===void 0?void 0:o.metricCustomDimensions)s.push(this.options.metricCustomDimensions[a]);return s}},{key:"getOrphanedSessionHealthDimensionValues",value:function(){return[this.success,this.clientAppName,this.clientAppPlatform,this.clientReleaseAudienceGroup,this.resourceId,this.dimension0,this.dimension1,this.dimension2,this.dimension3]}},{key:"getSessionHealthDimensionValues",value:function(){return[this.resultSignature,this.clientAppName,this.clientAppPlatform,this.clientAppVersion,this.dimension0,this.dimension1,this.dimension2,this.dimension3]}},{key:"getWorkflowDimensionValues",value:function(){return[this.resultSignature,this.resourceId,this.resourceId,this.success]}}],[{key:"getOrphanedSessionHealthDimensionNames",value:function(){return this.orphanedSessionHealthDimensionNames}},{key:"getSessionHealthDimensionNames",value:function(){return this.sessionHealthDimensionNames}},{key:"getWorkflowDimensionNames",value:function(){return this.workflowDimensionNames}}])})(uc);b.dimensionNames=["Success","ClientAppName","ClientAppPlatform","ResourceId","Dimension0","Dimension1","Dimension2","Dimension3"];b.orphanedSessionHealthDimensionNames=["Success","ClientAppName","ClientAppPlatform","ClientReleaseAudienceGroup","ResourceId","Dimension0","Dimension1","Dimension2","Dimension3"];b.sessionHealthDimensionNames=["Reason","ClientAppName","ClientAppPlatform","ClientAppVersion","Dimension0","Dimension1","Dimension2","Dimension3"];b.workflowDimensionNames=["ResultSignature","WorkflowId","ResourceId","Success"];Object.defineProperty(b.prototype,"dataFields",{get:function(){var n,e;return this[lr]&&(this[$o]=JSON.stringify((n=this[kt])!==null&&n!==void 0?n:{}),this[lr]=!1),this[lr]!==void 0?this[$o]:(e=this[$o])!==null&&e!==void 0?e:""},set:function(n){!n||n===""?this[kt]={}:this[kt]=JSON.parse(n),this[$o]=n,this[lr]=!1},enumerable:!0,configurable:!0});p();var vc=C(F()),Cc=C(G()),Ke=(function(){function t(n){(0,vc.default)(this,t),this.childCount=0,this.id=n||Zm()}return(0,Cc.default)(t,[{key:"newChild",value:function(){return++this.childCount,new t(this.id+"."+this.childCount.toString())}},{key:"toString",value:function(){return this.id.length>127?this.id.substring(0,127)+"!":this.id}}],[{key:"fromString",value:function(e,r){if(!e)throw new Error("Received invalid correlation vector string");var o;return e.endsWith(".0")?o=new t(e.substring(0,e.length-2)):o=new t(e),r&&(o.childCount=r),o}}])})(),mc=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],Sc=22,yc=new Array(Sc);function Zm(){for(var t=0;t<Sc;t++)yc[t]=mc[Math.floor(Math.random()*mc.length)];return yc.join("")}p();var Zs=C(G()),ea=C(F()),kc="|",_c="b~",ey="b~true",Xs="n~",ty=/\|\~/g,ny="_",ry=(0,Zs.default)(function t(){(0,ea.default)(this,t),this.count=0,this.measureSums=new Map}),ta=(0,Zs.default)(function t(n,e,r,o,s){var a=this;(0,ea.default)(this,t),this.buckets=new Map,this.init=function(u){a.log=u},this.add=function(u){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!a.condition||!a.condition(u))return l===!0&&a.log(u,!1),!1;var c=[];for(var f of a.dimensions)if(u[f]===void 0||u[f]===null)c.push(null);else{var d="";typeof u[f]=="boolean"?d=_c:typeof u[f]=="number"&&(d=Xs),c.push(`${d}${u[f].toString().replace(ty,ny)}`)}var m=c.join(kc),v=a.buckets.get(m);if(!v){v=new ry,v.traceLevel=u.traceLevel;for(var _ of a.avgMeasures)v.measureSums.set(_,0);a.buckets.set(m,v)}v.count++;for(var S of a.avgMeasures)u[S]&&v.measureSums.set(S,v.measureSums.get(S)+u[S]);return!0},this.flush=function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;a.buckets.forEach(function(l,c){for(var f={traceLevel:l.traceLevel,eventName:a.eventName,count:l.count},d=c.split(kc),m=0;m<a.dimensions.length;m++){var v=a.dimensions[m],_=d[m];_.indexOf(_c)===0?f[v]=_===ey:_.indexOf(Xs)===0?f[v]=parseInt(_.slice(Xs.length),10):f[v]=_}for(var S of a.avgMeasures)f[S]=Math.round(l.measureSums.get(S)/l.count);a.log(f,!0)}),a.buckets.clear(),u&&(a.condition=null,clearInterval(a.interval))},this.eventName=n,this.condition=e,this.dimensions=r,this.avgMeasures=o,s>0&&(this.interval=setInterval(this.flush,s*1e3))});p();var wc=C(G()),Tc=C(F()),bc=C(ut()),na=C(Je()),Mc=C(lt());function iy(t,n,e){return n=(0,na.default)(n),(0,bc.default)(t,Ic()?Reflect.construct(n,e||[],(0,na.default)(t).constructor):n.apply(t,e))}function Ic(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(Ic=function(){return!!t})()}var ra=(function(t){function n(e){var r;return(0,Tc.default)(this,n),r=iy(this,n,[e]),r.eventName="AnnotationMetaDataChange",r}return(0,Mc.default)(n,t),(0,wc.default)(n)})(lc);p();var xc=C(F()),Ac=C(G()),Rc=C(ut()),ia=C(Je()),Dc=C(lt());function oy(t,n,e){return n=(0,ia.default)(n),(0,Rc.default)(t,Pc()?Reflect.construct(n,e||[],(0,ia.default)(t).constructor):n.apply(t,e))}function Pc(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(Pc=function(){return!!t})()}var _t;(function(t){t[t.Unknown=0]="Unknown",t[t.Core=1]="Core",t[t.Workflow=2]="Workflow",t[t.SessionExtension=3]="SessionExtension",t[t.Client=4]="Client",t[t.ClientRuntime=5]="ClientRuntime"})(_t||(_t={}));var ln;(function(t){t[t.Unknown=0]="Unknown",t[t.Core=1]="Core",t[t.Workflow=2]="Workflow",t[t.SessionExtension=3]="SessionExtension",t[t.Client=4]="Client",t[t.Network=5]="Network",t[t.AugLoopDependency=6]="AugLoopDependency",t[t.WorkflowDependency=7]="WorkflowDependency",t[t.ClientRuntime=8]="ClientRuntime"})(ln||(ln={}));var wt;(function(t){t[t.Unknown=0]="Unknown",t[t.None=1]="None",t[t.MissingInput=2]="MissingInput",t[t.MissingOutput=3]="MissingOutput"})(wt||(wt={}));var ei=(function(t){function n(e,r){var o;(0,xc.default)(this,n);var s,a;return o=oy(this,n,[{source:_t[e.source],reason:ln[e.reason],reasonDependency:e.reasonDependency,subReason:e.subReason,sessionHealthEventName:e.sessionHealthEventName,impact:wt[e.impact],success:e.success,durationMs:(s=e.durationMs)!==null&&s!==void 0?s:0,count:typeof e.count=="number"?e.count:1,message:e.message,affectedWorkflows:((a=e.affectedWorkflows)!==null&&a!==void 0?a:[]).join(","),resourceId:e.resourceId,dimension0:e.dimension0,dimension1:e.dimension1,dimension2:e.dimension2,dimension3:e.dimension3,cv:e.cv,resultSignature:e.resultSignature,resultDescription:e.resultDescription,joinContextId:e.joinContextId}]),o.eventName="SessionHealth",o.aggregationEnabled=!1,r&&o.setClientMetadata(r,!0),o.metricCount=e.metricCount,o.metricDuration=e.metricDuration,o}return(0,Dc.default)(n,t),(0,Ac.default)(n,[{key:"getMetrics",value:function(){var r={};return(this.metricCount===void 0||this.metricCount)&&(r[`${this.sessionHealthEventName}.CountV2`]={dimensionNames:function(){return n.dimensionNames},dimensionValues:this.getDimensionValues(),value:this.count}),(this.metricDuration===void 0||this.metricDuration)&&(r[`${this.sessionHealthEventName}.DurationMsV2`]={dimensionNames:function(){return n.dimensionNames},dimensionValues:this.getDimensionValues(),value:this.durationMs}),r}},{key:"setClientMetadata",value:function(r){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return r&&(this.clientAppName=r.appName,this.clientAppPlatform=r.appPlatform,this.clientAppVersion=r.appVersion,this.clientReleaseAudienceGroup=r.releaseAudienceGroup,this.clientReleaseChannel=r.releaseChannel,this.clientReleaseFork=r.releaseFork,this.clientRuntimeVersion=r.runtimeVersion,this.clientSessionId=r.sessionId,this.clientDocSessionId=r.docSessionId,this.clientUserAgent=r.userAgent,o&&(this.clientFlights=r.flights)),this}},{key:"setUserContext",value:function(r){return r&&(this.userId=r.puid||r.oid,this.userType=r.userType&&r.userType.toString(),this.userTenantId=r.tid),this}},{key:"setReason",value:function(r){return this.reason=ln[r],this}},{key:"setSource",value:function(r){return this.source=_t[r],this}},{key:"setImpact",value:function(r){return this.impact=wt[r],this}},{key:"setAffectedWorkflows",value:function(r){return this.affectedWorkflows=(r!=null?r:[]).join(","),this}},{key:"getAffectedWorkflows",value:function(){return this.affectedWorkflows.split(",")}},{key:"enableAggregation",value:function(){return this.aggregationEnabled=!0,this}},{key:"shouldBeAggregated",value:function(){return this.aggregationEnabled}},{key:"start",value:function(){return this.startTime=Mn(),this}},{key:"stop",value:function(){var r=Mn();return this.durationMs=Math.round(r-this.startTime),this}},{key:"getDimensionValues",value:function(){var r;return[this.clientAppName,this.clientAppPlatform,this.clientAppVersion,this.success?"1":"0",`${this.reason}_${this.reasonDependency}`,this.impact,(r=this.getAffectedWorkflows()[0])!==null&&r!==void 0?r:"",this.resourceId,this.dimension0,this.dimension1,this.dimension2,this.dimension3]}}])})(cc);ei.dimensionNames=["ClientAppName","ClientAppPlatform","ClientAppVersion","Success","Reason","Impact","FirstAffectedWorkflow","ResourceId","Dimension0","Dimension1","Dimension2","Dimension3"];p();p();var Nc=C(F()),Oc=C(G()),oa=(function(){function t(n){if((0,Nc.default)(this,t),this.cache=new Map,this.options=n||{sweepInterval:100},this.options.idleDurationMs!=null&&this.options.idleDurationMs<=0)throw new Error("Idle duration must be positive");if(this.interval=this.options.sweepInterval||100,this.interval<=0)throw new Error("Sweep interval must be a positive number")}return(0,Oc.default)(t,[{key:"put",value:function(e,r,o,s,a,u,l){if(o==null||o<=0)throw new Error("Cache timeout must be a positive number");(a==null||a<=0)&&(a=this.options.idleDurationMs);var c={value:r,lastUsed:a?Date.now():void 0,expire:o+Date.now(),idleDurationMs:a,expireCallback:s,expiringTriggerTime:u+Date.now(),expiringCallback:l};return this.cache.set(e,c),this.timeout||(this.timeout=setInterval(this.onInterval.bind(this),this.interval),this.timeout.unref&&this.timeout.unref()),r}},{key:"del",value:function(e){if(this.options.delCallback){var r=this.cache.get(e);r&&this.options.delCallback(e,r.value)}var o=this.cache.delete(e);return this.size()===0&&this.clear(),o}},{key:"clear",value:function(){this.timeout&&(clearInterval(this.timeout),this.timeout=void 0),this.cache.clear()}},{key:"get",value:function(e){var r=this.cache.get(e);if(r)return this.options.idleDurationMs&&(r.lastUsed=Date.now()),r.expire<Date.now()&&(this.del(e),r.expireCallback&&r.expireCallback(e,r.value),r=this.cache.get(e),!r)?void 0:r.value}},{key:"keys",value:function(){return this.cache.keys()}},{key:"forEach",value:function(e){this.cache.forEach(function(r,o){e(r.value,o)})}},{key:"size",value:function(){return this.cache.size}},{key:"updateExpireTime",value:function(e,r){return this.cache.has(e)&&r>=0?(this.cache.get(e).expire=r+Date.now(),!0):!1}},{key:"onInterval",value:function(){var e=this,r=Date.now();this.cache.forEach(function(o,s){try{if(o.idleDurationMs&&o.lastUsed<r-o.idleDurationMs){e.del(s),e.options.idleCallback&&e.options.idleCallback(s,o.value);return}o.expire<r&&(e.del(s),o.expireCallback&&o.expireCallback(s,o.value)),o.expiringTriggerTime<r&&o.expiringCallback&&(o.expiringCallback(s,o.value),o.expiringCallback=void 0)}catch(a){t.logIntervalError&&t.logIntervalError(a)}})}}],[{key:"setLogIntervalError",value:function(e){t.logIntervalError=e}}])})();p();p();var sa=C(mt()),aa=C(Re()),Bc=C(F()),Ec=C(G());var ti;(function(t){t[t.ExceedingMaxSize=0]="ExceedingMaxSize",t[t.GroupComplete=1]="GroupComplete",t[t.BatchIntervalElapsed=2]="BatchIntervalElapsed"})(ti||(ti={}));var cr=(function(){function t(n,e,r,o,s){(0,Bc.default)(this,t),this.batchesByGroupingKey=new Map,this.getOrderOfMagnitudeDimension=function(a){return a<0?"Negative":a===0?"0":a===1?"1":`Magnitude ${a.toString().length}`},this.submit=n,this.onSummary=o,this.reduceBatchOperationsEnabled=e,this.batchMessagesEnabled=r,this.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled=s}return(0,Ec.default)(t,[{key:"addBatchItem",value:function(e,r,o,s,a,u){var l=this,c=r.delayMs,f=r.delayMsMax,d=r.maxInputSize,m=r.estimateSize,v=r.groupingKeyExtractor,_=m(e),S=v(e);if(r.split&&_>d){var M;try{M=r.split(e)}catch(Z){var k=new Error("Split error: "+Z.message);u?u(k):h.error(573366352,y.CoreDefault,k);return}if(M&&Array.isArray(M.inputs)&&M.inputs.length>1){for(var w,P=[],R=u?function(Z,U){if(w=w||Z,P.push(U),P.length===M.inputs.length){var E;try{E=M.join(P)}catch($){u(new Error("Join error: "+$.message));return}u(w,E)}}:void 0,B=0;B<M.inputs.length;B++){var W=M.inputs[B];this.addBatchItem(W,r,o,s,a&&B===M.inputs.length-1,R)}return}}var I=this.batchesByGroupingKey.get(S);if(I&&I.size+_>d&&(this.executeBatch(S,I,r,ti.ExceedingMaxSize),I=void 0),I||(I={items:[],size:0,hasItemsWithCallbacks:!1,context:o,creationTime:Date.now()},this.batchesByGroupingKey.set(S,I)),!this.batchMessagesEnabled)I.items.push({input:e,size:_,callback:u,creationTime:Date.now()});else{var X=I.items[I.items.length-1];X&&X.cv===s&&X.callback===u?(X.input=[].concat((0,aa.default)(X.input),(0,aa.default)(e)),X.size+=_):I.items.push({input:e,size:_,cv:s,callback:u,creationTime:Date.now()})}I.size+=_,I.hasItemsWithCallbacks=I.hasItemsWithCallbacks||!!u,this.batchMessagesEnabled||(I.cv=s),I.groupComplete=a,I.groupComplete?this.executeBatch(S,I,r,ti.GroupComplete):(Date.now()-I.creationTime+c<f&&(clearTimeout(I.timeout),I.timeout=void 0),I.timeout||(I.timeout=setTimeout(function(){l.executeBatch(S,I,r,ti.BatchIntervalElapsed)},c)))}},{key:"removeAllBatchedItems",value:function(){this.batchesByGroupingKey.forEach(function(e){e.timeout&&clearTimeout(e.timeout)}),this.batchesByGroupingKey.clear()}},{key:"close",value:function(){for(var e of this.batchesByGroupingKey){var r=(0,sa.default)(e,2),o=r[0],s=r[1],a=1e3;s.creationTime!==void 0&&s.timeout!==void 0&&s.timeoutDuration!==void 0&&Date.now()-s.creationTime>s.timeoutDuration+a&&h.info(504690067,y.CoreDefault,{operationName:"BatchStillPendingAfterTimeout",resourceId:s.context.name,resultDescription:`Batch with groupingKey "${o}" still pending after timeout. Items: ${s.items.length}, Size: ${s.size}`,dimension0:s.items.length>0?`LastItemAge: ${Date.now()-s.items[s.items.length-1].creationTime}ms`:"No items in batch"})}}},{key:"reduceBatchOperations",value:function(e){var r=new b({operationName:"ReduceBatchOperations"}).start(),o=0,s=0,a=0,u=new Set,l=[],c=function(P,R){return P.parentPath.toString()+"/"+P.parentRevId+"/"+R.id};for(var f of e.input.reverse()){var d=[];for(var m of f.input.reverse())if(Ve.typeGuard(m)){var v=[];for(var _ of m.items){a++;var S=c(m,_);u.has(S)?s++:(v.push(_),u.add(S),o++)}v.length!==0&&(m.items=v,d.push(m))}else if(Me.typeGuard(m)){for(var M of m.items){var k=c(m,M);u.delete(k)}d.push(m)}else d.push(m);d.length!==0&&l.push({input:d.reverse(),size:f.size,cv:f.cv,callback:f.callback,creationTime:f.creationTime})}e.input=l.reverse(),a!=0&&(r.dimension0=`${this.getOrderOfMagnitudeDimension(s)}`,r.dimension1=`noOp: ${s===0}`),a-s==o?r.success=!0:r.success=!1,h.info(507839488,y.CoreDefault,r.stop())}},{key:"maxNumberOfDeltaUpdateOpsPerItemPerBatch",value:function(e){var r=function(f,d){return f.parentPath.toString()+"/"+d.id},o=0,s=new Map;for(var a of e.input)if(We.typeGuard(a))for(var u of a.items){var l=r(a,u);s.has(l)||s.set(l,0),s.set(l,s.get(l)+1),o=Math.max(o,s.get(l))}return o}},{key:"executeBatch",value:function(e,r,o,s){var a=this;clearTimeout(r.timeout),r.timeout=void 0,this.batchesByGroupingKey.delete(e);var u=r.items,l=new b({operationName:"ExecuteBatch",cv:this.batchMessagesEnabled?"":r.cv,resourceId:r.context.name,resultDescription:`batching duration: ${Date.now()-r.creationTime}ms`,dimension0:`${this.batchMessagesEnabled?"Batched items count":"Batched ops count:"} ${this.getOrderOfMagnitudeDimension(u.length)}`,dimension1:`Size ${this.getOrderOfMagnitudeDimension(r.size)}`,dimension2:s.toString()}).start(),c=function(m,v,_){var S;if(v&&v.exceptionType===te.NoOutput)l.success=!0,h.info(573366353,y.CoreDefault,l.stop());else{var M=`${m} error: ${v?v.message||v:"Unknown error"}`;S=v||new Error(M),l.success=!1,l.resultDescription=`Batch of ${u.length} items of size ${r.size} with ${M}`,l.resultSignature=`${m} Error`,h.error(573366354,y.CoreDefault,l.stop())}if(r.hasItemsWithCallbacks)for(var k of u)k.callback&&k.callback(S,_)},f;try{f=o.multiplex(this.batchMessagesEnabled?u:u.map(function(d){return d.input}))}catch(d){c("Multiplex",d);return}this.reduceBatchOperationsEnabled&&this.batchMessagesEnabled&&e=="operations"&&this.reduceBatchOperations(f),!this.batchMessagesEnabled&&e=="operations"&&this.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled&&(l.dimension3=this.getOrderOfMagnitudeDimension(this.maxNumberOfDeltaUpdateOpsPerItemPerBatch(f))),this.submit(f.input,r,function(d,m){if(d||m&&("exceptionType"in m||m instanceof Error))c("Submit",d||m,m);else if(r.hasItemsWithCallbacks||o.summaryExtractor){var v;if(r.hasItemsWithCallbacks)try{if(v=f.demultiplex(m),v.length!==u.length)throw new Error("Mismatched output length")}catch(P){c("Demultiplex",P);return}var _,S;if(o.summaryExtractor)try{var M=o.summaryExtractor(m),k=(0,sa.default)(M,2);S=k[0],_=k[1]}catch(P){c("SummaryExtractor",P);return}if(l.success=!0,h.info(573366342,y.CoreDefault,l.stop()),r.hasItemsWithCallbacks)for(var w=0;w<u.length;w++)u[w].callback&&u[w].callback(void 0,v[w]);_&&a.onSummary(S,_,r.context)}else l.success=!0,h.info(573366343,y.CoreDefault,l.stop())})}}])})();p();p();var Lc=C(mt()),Wc=C(F()),Fc=C(G()),ua=(function(){function t(n,e,r){if((0,Wc.default)(this,t),this.requestInProgress=!1,this.queuedRequests=[],n==null)throw new Error("No request.");this.fetch=n,this.fetchTimeout=e,this.queueTimeout=r}return(0,Fc.default)(t,[{key:"tryProcessNextRequest",value:function(){if(this.requestInProgress=!1,this.queuedRequests.length>0){var e=this.queuedRequests.shift(),r=(0,Lc.default)(e,3),o=r[0],s=r[1],a=r[2];clearTimeout(a),this.add(o,s)}}},{key:"add",value:function(e,r){var o=this;if(this.requestInProgress){var s=setTimeout(function(){r(new Error("Timed out waiting in queue"),null),o.queuedRequests.shift()},this.queueTimeout);this.queuedRequests.push([e,r,s])}else{this.requestInProgress=!0;var a=new Promise(function(u,l){var c=!1,f=setTimeout(function(){c=!0,l(new Error("Fetch timed out"))},o.fetchTimeout);o.fetch(e).then(function(d){c||(clearTimeout(f),u(d))}).catch(function(d){c||(clearTimeout(f),l(d))})});a.then(function(u){r(null,u),o.tryProcessNextRequest()}).catch(function(u){r(u,null),o.tryProcessNextRequest()})}}}])})();var fr=C(Uo()),Gc=2e4,$c=12e4,qo="Request timed out";function xn(t,n,e,r){var o=new fr.Request(t,n);return r?uy.add(o,e):ay.add(o,e)}var sy=function(n){return(0,fr.fetch)(n)},ay=new ua(fr.fetch,Gc,$c),uy=new ua(sy,Gc,$c);function Uc(t,n,e){return new Promise(function(r,o){var s=setTimeout(function(){o(new Error(qo))},n);(0,fr.fetch)(t,e||{}).then(function(a){clearTimeout(s),r(a)}).catch(function(a){clearTimeout(s),o(a)})})}p();function ni(){return"xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=Math.random()*16|0,e=t==="x"?n:n&3|8;return e.toString(16)})}p();var Ho=function(n){return ly(n,Number.POSITIVE_INFINITY)};var ly=function(n,e){for(var r=0,o=[],s=[n];s.length>0;){var a=s.pop(),u=typeof a;if(u==="boolean")r+=4;else if(u==="string")r+=2*a.length;else if(u==="number")r+=8;else if(u==="object"&&a&&o.indexOf(a)===-1)if(a instanceof Uint8Array)r+=a.length;else{o.push(a);for(var l in a)s.push(a[l])}if(r>e)return r}return r};p();var Ip=C(F()),xp=C(G());p();var qc="_acceptsClaimsChallengeMessages",Hc="_acceptsSeedingStatusChangeMessages";p();var zc=C(F()),jc=C(G());p();var Vc=function(n,e,r){var o=n.get(e);return o||(o=r(),n.set(e,o)),o},la=function(n){return{id:n.id,kind:n.kind,visibility:n.visibility,collectionScopeType:n.collectionScopeType,inputTypes:n.inputTypes,outputTypes:n.outputTypes,correlatedSignals:n.correlatedSignals}},ri=function(n,e){return n==null||e==null?!1:n.length>0&&(n===e||e.indexOf(n)===0&&e.charAt(n.length)===".")};var Vo;(function(t){t.JsClient="C",t.Server="S"})(Vo||(Vo={}));var ca=new Set([Me.getTypeName(),Ve.getTypeName(),at.getTypeName(),We.getTypeName()]),cn=(function(){function t(n,e){(0,zc.default)(this,t),this.nextId=1,this.runtimeKind=n,this.workflowGraph=e}return(0,jc.default)(t,[{key:"applyContextIdOnOperations",value:function(e){var r=void 0;for(var o of e){var s=g.getTypeNameFor(o);if(this.isSupportedOperation(s))for(var a of o.items){if(!a.contextId){a.contextId=this.addNewContextId();continue}if(a.source&&this.workflowGraph.getWorkflow(a.source,!1)){a.contextId=this.addNewContextId(a.contextId);continue}r||(r=new b({operationName:"ApplyContextIdOnOperations",success:!0,resultDescription:"Item with a contextId but without a workflow source attribute"})),h.verbose(495837581,y.CoreDefault,r)}}}},{key:"addNewContextId",value:function(e){var r=`${this.runtimeKind}${this.nextId++}`;return e?`${e}.${r}`:r}},{key:"isSupportedOperation",value:function(e){return ca.has(e)}}],[{key:"isParentContextId",value:function(e,r){return ri(e,r)}}])})();p();var $t;(function(t){t[t.Idle=1]="Idle",t[t.Pending=2]="Pending",t[t.Running=3]="Running",t[t.Executed=4]="Executed"})($t||($t={}));p();var ka=C(Re());p();var Q;(function(t){t[t.Add=0]="Add",t[t.Delete=1]="Delete",t[t.Update=2]="Update",t[t.CursorUpdate=3]="CursorUpdate",t[t.FormattingUpdate=4]="FormattingUpdate",t[t.OtherNonContentUpdate=5]="OtherNonContentUpdate",t[t.AttributionUpdate=6]="AttributionUpdate"})(Q||(Q={}));var me;(function(t){t[t.Chars=0]="Chars",t[t.Word=1]="Word",t[t.PartialSentence=2]="PartialSentence",t[t.Sentence=3]="Sentence",t[t.Paragraph=4]="Paragraph"})(me||(me={}));var Jc;(function(t){t[t.SessionUser=0]="SessionUser",t[t.Programmatic=1]="Programmatic",t[t.Collaborator=2]="Collaborator"})(Jc||(Jc={}));p();var fa=C(F()),da=C(G());var Ut=(function(){function t(n){(0,fa.default)(this,t),g.assign(t,this,n)}return(0,da.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_TextTileDelta"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_ItemDelta"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ut.H_={T_:Ut.getTypeName(),B_:Ut.getBaseTypes()};var ze=(function(){function t(n){(0,fa.default)(this,t),g.assign(t,this,n)}return(0,da.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_FormattedTextTileDelta"}},{key:"getBaseTypes",value:function(){return["AugLoop_Text_TextTileDelta","AugLoop_Core_ItemDelta"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ze.H_={T_:ze.getTypeName(),B_:ze.getBaseTypes()};p();var Tt=C(F()),bt=C(G());var Qe=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_TextTile"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Qe.H_={T_:Qe.getTypeName(),B_:Qe.getBaseTypes()};var Fe=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_FormattedTextTile"}},{key:"getBaseTypes",value:function(){return["AugLoop_Text_TextTile"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Fe.H_={T_:Fe.getTypeName(),B_:Fe.getBaseTypes()};var ga=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_InlineTile"}},{key:"getBaseTypes",value:function(){return["AugLoop_Text_TextTile"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ga.H_={T_:ga.getTypeName(),B_:ga.getBaseTypes()};var pa=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_DynamicTextContext"}},{key:"getBaseTypes",value:function(){return["AugLoop_Core_DynamicContext"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();pa.H_={T_:pa.getTypeName(),B_:pa.getBaseTypes()};var ha=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_TaskTile"}},{key:"getBaseTypes",value:function(){return["AugLoop_Text_FormattedTextTile","AugLoop_Text_TextTile"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ha.H_={T_:ha.getTypeName(),B_:ha.getBaseTypes()};var ma=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_PersonTile"}},{key:"getBaseTypes",value:function(){return["AugLoop_Text_InlineTile","AugLoop_Text_TextTile"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ma.H_={T_:ma.getTypeName(),B_:ma.getBaseTypes()};var ya=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_DateTile"}},{key:"getBaseTypes",value:function(){return["AugLoop_Text_InlineTile","AugLoop_Text_TextTile"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ya.H_={T_:ya.getTypeName(),B_:ya.getBaseTypes()};var va=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_LinkTile"}},{key:"getBaseTypes",value:function(){return["AugLoop_Text_InlineTile","AugLoop_Text_TextTile"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();va.H_={T_:va.getTypeName(),B_:va.getBaseTypes()};var Ca=(function(){function t(n){(0,Tt.default)(this,t),g.assign(t,this,n)}return(0,bt.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Text_CommentTile"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ca.H_={T_:Ca.getTypeName(),B_:Ca.getBaseTypes()};var cy=[Q.CursorUpdate,Q.FormattingUpdate,Q.OtherNonContentUpdate,Q.AttributionUpdate];function Qc(t,n,e){var r=new b({operationName:"ApplyTextTileDeltaForLocalWorkflows",dimension0:"0",success:!0}).start();try{if(!n){r.success=!1,r.resultDescription="Unable to apply text tile delta, parent tile is undefined",h.info(495837580,y.CoreDefault,r.stop());return}if(g.getTypeNameFor(n)!==Qe.getTypeName()){r.success=!1,r.resultDescription=`Unable to apply text tile delta, parent tile is not proper type: expected ${Ut.getTypeName()}, received ${g.getTypeNameFor(n)}`,h.info(495837579,y.CoreDefault,r.stop());return}var o=n,s=t,a=o.content,u="";if(s.position===void 0||s.position<0){r.success=!1,r.resultDescription="Unable to apply text tile delta, invalid text tile position",h.info(495837578,y.CoreDefault,r.stop());return}switch(s.deltaType){case Q.Add:s.position<a.length?u=`${a.slice(0,s.position)}${s.content}${a.slice(s.position,a.length)}`:u=a+s.content;break;case Q.Update:!s.content&&s.unit===me.Sentence&&(r.dimension0="1"),u=`${a.slice(0,s.position)}${s.content}${a.slice(s.position+(s.length||0),a.length)}`;break;case Q.Delete:u=`${a.slice(0,s.position)}${a.slice(s.position+(s.length||0),a.length)}`}return h.info(495837577,y.CoreDefault,r.stop()),new Qe({content:u})}catch(l){r.success=!1,r.resultDescription=`Error applying text tile delta: ${l}`,h.info(495837576,y.CoreDefault,r.stop());return}}function fy(t,n){var e,r,o,s,a=Xc(t.formattedRanges,n.deltaType,n.position),u=t.formattedRanges?(0,ka.default)(t.formattedRanges):[],l=a?u.indexOf(a):-1;l!==-1&&(n.position+(n.length||0)>a.start+a.length?a.length=n.position+((e=n.content)!==null&&e!==void 0?e:"").length-a.start:a.length+=((r=n.content)!==null&&r!==void 0?r:"").length-(n.length||0),u[l]=a);for(var c of u.slice(l+1))c.start<n.position||(n.position+(n.length||0)>c.start?(c.length=c.start+c.length-(n.position+(n.length||0)),c.start=n.position+((o=n.content)!==null&&o!==void 0?o:"").length):c.start+=((s=n.content)!==null&&s!==void 0?s:"").length-(n.length||0));return u=u.filter(function(f){return f.length>0}),u}function Kc(t,n){var e,r,o,s,a,u=((e=n.attributionData)===null||e===void 0?void 0:e.ranges)||n.attributionRanges;if(!((r=n.attributionData)===null||r===void 0)&&r.isFullUpdate||n.deltaType!==Q.AttributionUpdate&&u!==void 0)return u;if(!(!((o=t.attributionRanges)===null||o===void 0)&&o.length)&&!u||n.deltaType===Q.Update&&n.length===0)return t.attributionRanges;var l=t.attributionRanges?(0,ka.default)(t.attributionRanges):[];if(n.deltaType!==Q.AttributionUpdate){var c=Xc(t.attributionRanges,n.deltaType,n.position),f=c?l.indexOf(c):-1;f!==-1&&(c.length=n.position-c.start);var d=((s=n.content)!==null&&s!==void 0?s:"").length,m=(a=n.length)!==null&&a!==void 0?a:0,v=n.position+m,_=n.position+d;for(var S of l.slice(f+1))if(!(S.start<n.position)){var M=S.start+S.length;v>S.start&&(S.length=M-v),S.start=Math.max(S.start+d-m,_)}return l=l.filter(function(I){return I.length>0}),l}var k=[];for(var w of u){if(k.length===0){k.push({start:w.start,length:w.length});continue}k[k.length-1].start+k[k.length-1].length>=w.start?k[k.length-1].length=w.start+w.length-k[k.length-1].start:k.push({start:w.start,length:w.length})}var P=function(X){for(var Z of k)if(Z.start<=X.start&&Z.start+Z.length>=X.start+X.length)return!0;return!1};l=l.filter(function(I){return I.length>0&&!P(I)}),u==null||u.forEach(function(I){l.push(I)}),l.sort(function(I,X){return I.start-X.start});var R=[];for(var B of l){var W=R.length>0?R[R.length-1]:void 0;W&&W.start+W.length>B.start&&(W.length=Math.max(B.start-W.start,0)),!W||!dy(W,B)||B.start>W.start+W.length?R.push(B):W.length+=Math.max(B.start+B.length-(W.start+W.length),0)}return R}function Yc(t,n,e){var r,o,s,a,u=new b({operationName:"ApplyFormattedTextTileDeltaForLocalWorkflows",dimension0:"0",success:!0}).start();u.clientFlights=e;try{if(!n){u.success=!1,u.resultDescription="Unable to apply formatted text tile delta, parent tile is undefined",h.info(495837575,y.CoreDefault,u.stop());return}if(g.getTypeNameFor(n)!==Fe.getTypeName()){u.success=!1,u.resultDescription=`Unable to apply formatted text tile delta, parent tile is not proper type: expected ${Fe.getTypeName()}, received ${g.getTypeNameFor(n)}`,h.info(495837574,y.CoreDefault,u.stop());return}var l=n,c=t,f=l.content,d="";if((c.position===void 0||c.position<0)&&!Sa(c.deltaType)){u.success=!1,u.resultDescription="Unable to apply formatted text tile delta, invalid text tile position",h.info(495837573,y.CoreDefault,u.stop());return}else if(c.content===void 0&&!Sa(c.deltaType)){u.success=!1,u.resultDescription="Unable to apply formatted text tile delta, non-delete, non-formatting, non-other-non-content-update and non-cursor-update operation without content defined",h.info(495837572,y.CoreDefault,u.stop());return}if(c.deltaType===Q.Add&&c.length!==0?h.info(495837571,y.CoreDefault,new b({operationName:"ApplyDeltaChecks",resultDescription:"Received formatted text tile delta add operation with delta length, expected length 0",success:!0})):Sa(c.deltaType)&&c.content!==void 0&&h.info(495837570,y.CoreDefault,new b({operationName:"ApplyDeltaChecks",resultDescription:"Received formatted text tile delta delete or non-content related operation with content defined, expected undefined",success:!0})),Zc(c.deltaType)){if(c.deltaType===Q.CursorUpdate)return new Fe(Object.assign(Object.assign({},l),{ipPosition:(s=c.cursorData)===null||s===void 0?void 0:s.ipPosition,isColdIp:(a=c.cursorData)===null||a===void 0?void 0:a.isColdIp}));if(c.deltaType===Q.FormattingUpdate)return new Fe(Object.assign(Object.assign({},l),{formattedRanges:c.formattedRanges}));if(c.deltaType===Q.OtherNonContentUpdate){var M,k={};for(M in c.otherNonContentData)k[M]=c.otherNonContentData[M];return new Fe(Object.assign(Object.assign({},l),k))}else if(c.deltaType===Q.AttributionUpdate)return new Fe(Object.assign(Object.assign({},l),{attributionRanges:Kc(l,c)}))}else{var m=fy(l,c),v=Kc(l,c),_=l.ipPosition;switch(c.deltaType){case Q.Add:c.position<f.length?d=`${f.slice(0,c.position)}${c.content}${f.slice(c.position,f.length)}`:d=f+c.content,_=c.position+c.length;break;case Q.Update:!c.content&&c.unit===me.Sentence&&(u.dimension0="1"),d=`${f.slice(0,c.position)}${c.content}${f.slice(c.position+((r=c.length)!==null&&r!==void 0?r:0),f.length)}`,_=c.position+c.content.length;break;case Q.Delete:d=`${f.slice(0,c.position)}${f.slice(c.position+((o=c.length)!==null&&o!==void 0?o:0),f.length)}`,_=c.position;break}var S=new Fe(Object.assign(Object.assign({},l),{ipPosition:_,content:d,formattedRanges:m,attributionRanges:v,queryRange:c.queryRange}));return h.info(495837569,y.CoreDefault,u.stop()),S}return}catch(w){u.success=!1,u.resultDescription=`Error applying formatted text tile delta: ${w}`,h.info(495837568,y.CoreDefault,u.stop());return}}function Xc(t,n,e){var r=new b({operationName:"FindRangeForDelta",success:!0});if(r.start(),!t){r.resultDescription="No formatted ranges found within the tile, skipping.",h.info(495837539,y.CoreDefault,r.stop());return}if(n===Q.Add){var o=t.find(function(a){return a.start===e&&a.length===0});if(o)return r.resultDescription=`Found a zero-length formatted range for add operation with start ${o.start}.`,h.info(495837538,y.CoreDefault,r.stop()),o;e=Math.max(e-1,0)}var s=t.find(function(a){return a.length===0?a.start===e:a.start<=e&&e<a.start+a.length});return s?(r.resultDescription=`Updating formatted range for operation with start: ${s.start} and length: ${s.length}`,h.info(495837537,y.CoreDefault,r.stop())):(r.resultDescription=`Unable to find formatted range for operation at position ${e}, skipping.`,h.info(495837536,y.CoreDefault,r.stop())),s}function Zc(t){return cy.indexOf(t)!==-1}function Sa(t){return Zc(t)||Q.Delete===t}function dy(t,n){return t.attribution.userId===n.attribution.userId&&t.attribution.timestamp===n.attribution.timestamp&&t.attribution.dataSource===n.attribution.dataSource}p();var ef=C(F()),tf=C(G());var nf=(function(){function t(){(0,ef.default)(this,t),this.workflowDefByWorkflowAndContextId=new Map,this.workflowDefByWorkflow=new Map}return(0,tf.default)(t,[{key:"mergeWorkflowDefinition",value:function(e,r,o){if(o){var s=Vc(this.workflowDefByWorkflowAndContextId,e.id,function(){return new Map});s.set(o,t.mergeDefinitions(e,s.get(o),r))}else this.workflowDefByWorkflow.set(e.id,t.mergeDefinitions(e,this.workflowDefByWorkflow.get(e.id),r))}},{key:"getWorkflowDefinition",value:function(e,r){var o,s;return r&&(s=(o=this.workflowDefByWorkflowAndContextId.get(e.id))===null||o===void 0?void 0:o.get(r)),s||(s=this.workflowDefByWorkflow.get(e.id)),s||(s=e),s}},{key:"deleteWorkflowDefinition",value:function(e,r){var o=this.workflowDefByWorkflowAndContextId.get(e.id);o&&(o.delete(r),o.size===0&&this.workflowDefByWorkflowAndContextId.delete(e.id))}}],[{key:"mergeDefinitions",value:function(e,r,o){return Object.assign(Object.assign(Object.assign({},e),r),o)}}])})();p();var rf=C(Re()),_a=C(F()),wa=C(G());var qt;(function(t){t[t.Local=0]="Local",t[t.External=1]="External"})(qt||(qt={}));var of=(function(){function t(){(0,_a.default)(this,t),this.graphNodeByLocationAndWorkflowId=new Map}return(0,wa.default)(t,[{key:"getWorkflow",value:function(e,r){var o,s=this.getLocation(r);return(o=this.graphNodeByLocationAndWorkflowId.get(s))===null||o===void 0?void 0:o.get(e)}},{key:"addWorkflow",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(this.getWorkflow(e.id,r)){var o=new b({operationName:"AddWorkflowToGraphFailure",success:!1,resourceId:e.id,resultDescription:`Adding a new with workflow with a duplicated workflowId: ${r}`}).start();h.error(495837535,y.CoreDefault,o.stop());return}var s=this.getLocation(r),a=new gy(e,s);this.addWorkflowAsDependency(a);var u=this.graphNodeByLocationAndWorkflowId.get(s);u||(u=new Map,this.graphNodeByLocationAndWorkflowId.set(s,u)),u.set(e.id,a)}},{key:"getUpstreamRuntimeVisibleWorkflows",value:function(){var e=[];for(var r of this.graphNodeByLocationAndWorkflowId.values()||[])for(var o of r.values()||[]){var s=this.createWorkflowDefinition(o.workflow);if(o.workflow.visibility===Kr.LocalOnly)this.compressDownstreamWorkflows(s,o);else{var a;(a=s.outputTypes).push.apply(a,(0,rf.default)(o.workflow.outputTypes))}s.inputTypes.length!==0&&e.push(s)}return e}},{key:"removeWorkflows",value:function(e){var r=this.getLocation(e),o=this.graphNodeByLocationAndWorkflowId.get(r),s=Array.from((o==null?void 0:o.values())||[]);for(var a of s){for(var u of a.upstreamWorkflows.values())u.downstreamWorkflows.delete(a);for(var l of a.downstreamWorkflows.values())l.upstreamWorkflows.delete(a);o.delete(a.workflow.id)}}},{key:"getWorkflowsDefinitions",value:function(){var e=[];for(var r of this.graphNodeByLocationAndWorkflowId.values()||[])for(var o of r.values()||[])e.push(o.workflow);return e}},{key:"getWorkflowNodes",value:function(e){var r=[];for(var o of this.graphNodeByLocationAndWorkflowId.values())for(var s of o.values())r.push(s);return r}},{key:"getLocation",value:function(e){return e?qt.External:qt.Local}},{key:"createWorkflowDefinition",value:function(e){return Object.assign(Object.assign({},e),{outputTypes:[]})}},{key:"compressDownstreamWorkflows",value:function(e,r){for(var o of r.downstreamWorkflows){if(o.workflow.visibility===Kr.LocalOnly){this.compressDownstreamWorkflows(e,o);continue}if(!(o.workflow.kind===Ce.Join&&e.inputTypes.indexOf(o.workflow.collectionScopeType)===-1))for(var s of o.workflow.outputTypes)e.outputTypes.indexOf(s)===-1&&e.outputTypes.push(s)}}},{key:"addWorkflowAsDependency",value:function(e){for(var r of this.graphNodeByLocationAndWorkflowId.values())for(var o of r.values()){for(var s of o.workflow.inputTypes)e.workflow.outputTypes.indexOf(s)!==-1&&this.addWorkflowChain(e,o);for(var a of o.workflow.outputTypes)e.workflow.inputTypes.indexOf(a)!==-1&&this.addWorkflowChain(o,e)}}},{key:"addWorkflowChain",value:function(e,r){e.downstreamWorkflows.add(r),r.upstreamWorkflows.add(e)}}])})(),gy=(0,wa.default)(function t(n,e){(0,_a.default)(this,t),this.isActivated=!0,this.upstreamWorkflows=new Set,this.downstreamWorkflows=new Set,this.location=e,this.workflow=Object.assign(Object.assign({},n),{inputTypes:Array.isArray(n.inputTypes)?n.inputTypes:[],outputTypes:Array.isArray(n.outputTypes)?n.outputTypes:[]})});p();var Lf=C(mt()),xa=C(Re()),Wf=C(F()),Ff=C(G());var je={};qh(je,{ChangeGate:()=>Vt,ChangeGateInstance:()=>Cy,DataListener:()=>An,ModuleSettings:()=>Sy,Setting:()=>Ye,SettingInstance:()=>Mt,SettingInstanceCollection:()=>ky,SettingPatternInstance:()=>yy,SettingsRegistry:()=>Mf,TestSettingsProvider:()=>wy,isValidateCorrectUsageOfGetValue:()=>Cf});p();p();var Sf=C(F()),kf=C(G());p();var gf=C(af()),pf=C(mt()),Ko=C(F()),Qo=C(G()),hf=C(ut()),jo=C(Je()),Yo=C(lt());var vf=C(zo());p();var lf=C(F()),cf=C(G()),An=(function(){function t(){(0,lf.default)(this,t),this.listeners=new Map,this.lastId=0}return(0,cf.default)(t,[{key:"addListener",value:function(e){if(!e)throw new Error("No callback provided for data listener");return this.listeners.set(this.lastId,e),this.lastId++}},{key:"removeListener",value:function(e){this.listeners.delete(e)}},{key:"notifyListeners",value:function(e){this.listeners.forEach(function(r){r(e)})}}])})();p();var ff=C(F()),df=C(G());var oi,rt;(function(t){t.Add="Add",t.Remove="Remove",t.Set="Set",t.Delete="Delete"})(rt||(rt={}));var fn=(function(){function t(){(0,ff.default)(this,t)}return(0,df.default)(t,null,[{key:"applyECSPatchOperation",value:function(e,r){var o=!1;if(typeof r=="object"||Array.isArray(r))switch(e.operation){case rt.Add:case rt.Remove:o=oi.applyAddOrRemoveOperation(e.path,r,e.value,e.operation);break;case rt.Set:o=oi.applySetOperation(e.path,r,e.value);break;case rt.Delete:o=oi.applyDeleteOperation(e.path,r,e.value);break}return o?h.verbose(505956121,y.CoreDefault,`PATCH operation succeeded for ${e.operation} on ${e.settingName} with path: ${e.path}.`):h.error(505956122,y.CoreDefault,`PATCH operation failed for ${e.operation} on ${e.settingName} with path: ${e.path}`),o}},{key:"applyAddOrRemoveOperation",value:function(e,r,o,s){var a=!1;try{var u=[];if(typeof r=="object"&&!Array.isArray(r)?u=e.reduce(function(c,f){return c&&c[f]},r):Array.isArray(r)&&(u=r),Array.isArray(u)){if(s===rt.Add)u.push(o),a=!0;else if(s===rt.Remove){var l=u.indexOf(o);l>=0&&(u.splice(l,1),a=!0)}}}catch(c){h.info(505968832,y.CoreDefault,`Exception thrown while applying operation type: ${s} for an array. Error: ${c}`),a=!1}return a}},{key:"applySetOperation",value:function(e,r,o){var s=!1;try{var a=e.slice(0,-1),u=e[e.length-1],l={};typeof r=="object"&&!Array.isArray(r)&&(l=a.reduce(function(c,f){return c&&c[f]},r),typeof l=="object"&&!Array.isArray(l)&&(l[u]=o,s=!0))}catch(c){h.info(505968802,y.CoreDefault,`Exception thrown while applying set operation. Error: ${c}`),s=!1}return s}},{key:"applyDeleteOperation",value:function(e,r,o){var s=!1;try{var a={};typeof r=="object"&&!Array.isArray(r)&&(a=e.reduce(function(u,l){return u&&u[l]},r),typeof a=="object"&&!Array.isArray(a)&&typeof o=="string"&&a.hasOwnProperty(o)&&(delete a[o],s=!0))}catch(u){h.info(505968801,y.CoreDefault,`Exception thrown while applying delete operation. Error: ${u}`),s=!1}return s}}])})();oi=fn;fn.parseECSOperation=function(t,n){if(!n.hasOwnProperty("operationType")||!n.hasOwnProperty("path")||!n.hasOwnProperty("value"))throw new Error(`Invalid format for PATCH operation on setting: ${t}`);var e=n.operationType.toLowerCase(),r=oi.convertToConfigPatchOperationType(e),o=n.path?n.path.split("."):[],s={settingName:t,path:o,operation:r,value:n.value};return s};fn.convertToConfigPatchOperationType=function(t){switch(t){case"add":return rt.Add;case"remove":return rt.Remove;case"set":return rt.Set;case"delete":return rt.Delete;default:throw new Error(`Invalid operation type: ${t}`)}};function Jo(t,n,e,r){var o=(0,gf.default)((0,jo.default)(1&r?t.prototype:t),n,e);return 2&r&&typeof o=="function"?function(s){return o.apply(e,s)}:o}function ba(t,n,e){return n=(0,jo.default)(n),(0,hf.default)(t,mf()?Reflect.construct(n,e||[],(0,jo.default)(t).constructor):n.apply(t,e))}function mf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(mf=function(){return!!t})()}var yf=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})};function Cf(){var t;return typeof globalThis.process!="undefined"&&((t=globalThis.process.env)===null||t===void 0?void 0:t.VALIDATE_CORRECT_USAGE_OF_GET_VALUE)==="true"}var Ye=(function(t){function n(e){var r;return(0,Ko.default)(this,n),r=ba(this,n),r.name=e,r}return(0,Yo.default)(n,t),(0,Qo.default)(n,[{key:"getName",value:function(){return this.name}},{key:"getValue",value:function(){if(Cf()&&this.listeners.size===0){var r=new Error(`SettingInstance or ChangeGate is being used incorrectly. Make sure .getValue() or ChangeGate is called during runtime or there is a listener set up on the setting. For more info visit: ${n.troubleshootUrl}`);throw r.name="Incorrect usage of getValue()",r}return this.value}},{key:"getValueAdvancedAsync",value:function(r){return yf(this,void 0,void 0,function*(){var o=new b({operationName:"ECSGetValueAsync"},{metricDuration:!0}).start(),s;try{var a=yield n.ecsSettingsProvider.getSettingValue(this.name,r);o.dimension0=a.userAuthenticated?"Authenticated":"Anonymous",o.success=!0;var u=a.value,l=a.ecsSection;return u==null&&(u=n.tryGetConfigProperty(n.localConfig,this.name).value,u&&a.patchValue&&(u=n.applyPatchOperationOnSetting(this.name,u,a.patchValue),l=a.ecsPatchSection)),s=`Setting value for ${this.name} is ${JSON.stringify(u)}.
 Config IDs: ${JSON.stringify(l)}.`,u}catch(d){if(process.env.DEPLOYMENT_ENV!=="dev"){var c=`Exception thrown while getting setting value for ${this.name}. Error: ${d}
 Error stack trace: ${d.stack}`;d.StackTrace&&(c+=`
 CLR Stack Trace: ${d.StackTrace}`),h.error(505226379,y.CoreDefault,c),o.success=!1}var f=n.tryGetConfigProperty(n.localConfig,this.name).value;return s=`Setting value for ${this.name} is ${JSON.stringify(f)}.`,f}finally{h.info(506053839,y.CoreDefault,o.stop()),h.info(505821320,y.CoreDefault,s)}})}},{key:"updateValue",value:function(r){if(!(0,vf.default)(this.value,r)){try{var o=`Received new property value for ${this.getName()}: ${JSON.stringify(r)}`.substring(0,25e3);h.info(572837968,y.CoreDefault,o)}catch(s){h.info(495457426,y.CoreDefault,`Failed to log the new property value for ${this.getName()} as it is not a valid JSON`)}return this.value=r,!0}return!1}}],[{key:"initEcsSettingsProvider",value:function(r){h.info(505999498,y.CoreDefault,"Initializing ECS settings provider."),n.ecsSettingsProvider=r}},{key:"enableEcsPatchConfig",value:function(r){n.ecsPatchConfigEnabled=r}},{key:"getInstance",value:function(r){var o=this.allSettings.get(r);if(!o){o=new n(r);var s=n.tryGetConfigProperty(n.currentConfig,r);s.success&&o.updateValue(s.value),this.allSettings.set(r,o)}return o}},{key:"getPatternInstance",value:function(r){var o=this.allPatternSettings.get(r);if(!o){o={regex:new RegExp(r),setting:new n(r)};var s=n.tryGetConfigPropertyByPattern(n.currentConfig,o.regex);o.setting.updateValue(s),this.allPatternSettings.set(r,o)}return o.setting}},{key:"setNewConfig",value:function(r){n.currentConfig=r,h.info(572837966,y.CoreDefault,`New config: ${JSON.stringify(r)}`),n.allSettings.forEach(function(o,s){var a=n.tryGetConfigProperty(n.currentConfig,s).value;o.updateValue(a)&&(h.info(572837967,y.CoreDefault,`Setting new value for ${s}: ${a instanceof Object?JSON.stringify(a):a}`),o.notifyListeners(a))}),n.allPatternSettings.forEach(function(o,s){var a=n.tryGetConfigPropertyByPattern(r,o.regex);o.setting.updateValue(a)&&(h.info(508432774,y.CoreDefault,`Setting new value for pattern ${s}: ${JSON.stringify(a)}`),o.setting.notifyListeners(a))})}},{key:"tryGetConfigProperty",value:function(r,o){return r&&r.hasOwnProperty(o)?{success:!0,value:n.selectApplicableValue(r[o])}:{success:!1,value:void 0}}},{key:"tryGetConfigPropertyByPattern",value:function(r,o){var s=[];if(r){var a=Object.getOwnPropertyNames(r).filter(function(l){return o.test(l)});for(var u of a)s.push({name:u,value:n.selectApplicableValue(r[u])})}return s}},{key:"setGlobalFilter",value:function(r){n.globalFilter=r}},{key:"setLocalConfig",value:function(r){n.localConfig=r,h.info(506053841,y.CoreDefault,`Setting localConfig field in Setting class: ${JSON.stringify(n.localConfig)}`)}},{key:"clear",value:function(){n.currentConfig=void 0,n.localConfig=void 0,n.allSettings.clear(),n.allPatternSettings.clear(),n.ecsSettingsProvider=void 0}},{key:"selectApplicableValue",value:function(r){var o;if(r){var s=r.find(function(a){return!n.globalFilter||n.globalFilter(a)});s&&(o=s.value)}return o}},{key:"applyPatchOperationsOnConfig",value:function(r){try{if(!n.ecsPatchConfigEnabled)return r;var o=this.tryGetConfigProperty(r,"patchOperations").value;if(!o||o.length===0)return r;var s=[];for(var a of Object.entries(o)){var u=(0,pf.default)(a,2),l=u[0],c=u[1];try{s.push(fn.parseECSOperation(l,c))}catch(M){h.error(505734922,y.CoreDefault,`Exception thrown while parsing ECS PATCH operation for setting: ${l}. Error: ${M}`);continue}}var f=new Map;for(var d of s)if(r!=null&&r.hasOwnProperty(d.settingName)){var m=JSON.parse(JSON.stringify(r[d.settingName])),v=n.selectApplicableValue(m),_=fn.applyECSPatchOperation(d,v);_&&(f.set(d.settingName,v),r[d.settingName]=m)}if(f.size>0){var S={};f.forEach(function(M,k){S[k]=M}),h.info(505788322,y.CoreDefault,`Resulting settings after PATCHes were applied: ${JSON.stringify(S)}`)}return r}catch(M){return h.error(505788321,y.CoreDefault,`Exception thrown while applying ECS PATCH operations. Error: ${M}`),r}}},{key:"applyPatchOperationOnSetting",value:function(r,o,s){try{if(!n.ecsPatchConfigEnabled)return o;var a=JSON.parse(JSON.stringify(o)),u=s,l=fn.parseECSOperation(r,u);return fn.applyECSPatchOperation(l,a),a}catch(c){return h.error(505788323,y.CoreDefault,`Exception thrown while applying ECS PATCH operation on setting. Error: ${c}`),o}}}])})(An);Ye.allSettings=new Map;Ye.allPatternSettings=new Map;Ye.ecsPatchConfigEnabled=!1;Ye.troubleshootUrl="https://eng.ms/docs/experiences-devices/opg/office-ai/augloop-ai-platform/augmentation-loop/documentation/server-workflow-tutorials/settings/troubleshoot";var Mt=(function(t){function n(e,r){var o;return(0,Ko.default)(this,n),o=ba(this,n),o.listenerId=NaN,o.defaultValue=r,o.setting=Ye.getInstance(e),o}return(0,Yo.default)(n,t),(0,Qo.default)(n,[{key:"getDefaultValue",value:function(){return this.defaultValue}},{key:"addListener",value:function(r){var o=this;return Number.isNaN(this.listenerId)&&(this.listenerId=this.setting.addListener(function(){o.notifyListeners(o.getValue())})),Jo(n,"addListener",this,3)([r])}},{key:"removeListener",value:function(r){Jo(n,"removeListener",this,3)([r]),this.listeners.size===0&&!Number.isNaN(this.listenerId)&&(this.setting.removeListener(this.listenerId),this.listenerId=NaN)}},{key:"getValue",value:function(){var r=this.setting.getValue();return r===void 0?this.defaultValue:r}},{key:"getValueAdvancedAsync",value:function(r){return yf(this,void 0,void 0,function*(){var o=yield this.setting.getValueAdvancedAsync(r);return o===void 0?this.defaultValue:o})}}])})(An),yy=(function(t){function n(e){var r;return(0,Ko.default)(this,n),r=ba(this,n),r.listenerId=NaN,r.setting=Ye.getPatternInstance(e),r}return(0,Yo.default)(n,t),(0,Qo.default)(n,[{key:"addListener",value:function(r){var o=this;return Number.isNaN(this.listenerId)&&(this.listenerId=this.setting.addListener(function(){o.notifyListeners(o.getValue())})),Jo(n,"addListener",this,3)([r])}},{key:"removeListener",value:function(r){Jo(n,"removeListener",this,3)([r]),this.listeners.size===0&&!Number.isNaN(this.listenerId)&&(this.setting.removeListener(this.listenerId),this.listenerId=NaN)}},{key:"getValue",value:function(){var r=this.setting.getValue();return r===void 0?[]:r}}])})(An);var vy=new Mt("disabledChangeGates",[]),Vt=function(n,e){var r=vy.getValue().indexOf(n)===-1;if(!e)return r;if(r){for(var o=arguments.length,s=new Array(o>2?o-2:0),a=2;a<o;a++)s[a-2]=arguments[a];return e.apply(void 0,s)}},Cy=(function(){function t(n){(0,Sf.default)(this,t),this.changeGateInstance=Ye.getInstance(n),this.changeGateName=n;var e=n.indexOf(".");this.extractedChangeGateName=e!==-1?n.substring(e+1):n}return(0,kf.default)(t,[{key:"getValue",value:function(){var e=this.changeGateInstance.getValue();if(e!==void 0&&typeof e=="boolean")return e;var r=Vt(this.changeGateName)&&Vt(this.extractedChangeGateName);return r}}])})();p();var _f=C(F()),wf=C(G());var Sy=(function(){function t(n,e){(0,_f.default)(this,t),this.moduleName=n!=null?n:"",this.moduleVersion=e!=null?e:""}return(0,wf.default)(t,[{key:"getInstance",value:function(e,r){return new Mt(`${this.moduleName}.${e}`,r)}}])})();p();var Tf=C(F()),bf=C(G());var Mf=(function(){function t(){(0,Tf.default)(this,t)}return(0,bf.default)(t,null,[{key:"addProvider",value:function(e){var r=e.addListener(function(){h.info(572837969,y.CoreDefault,`Received new settings from ${e.constructor.name}`),t.currentConfig=t.buildConfig(),Ye.setNewConfig(t.currentConfig)});t.providers.push({provider:e,listenerId:r}),t.currentConfig=t.buildConfig(),Ye.setNewConfig(t.currentConfig)}},{key:"getCurrentConfig",value:function(){return t.currentConfig}},{key:"clear",value:function(){t.currentConfig=void 0,t.providers.forEach(function(e){e.provider.removeListener(e.listenerId)}),t.providers=[]}},{key:"buildConfig",value:function(){var e={};for(var r of t.providers){var o=r.provider.getSettings()||{};e=Object.assign(e,o)}return e=Ye.applyPatchOperationsOnConfig(e),e}}])})();Mf.providers=[];p();var If=C(F()),xf=C(G());var ky=(function(){function t(n,e){(0,If.default)(this,t),this.prefix=n,this.defaultValue=e,this.listeners=[],this.settingInstances=new Map}return(0,xf.default)(t,[{key:"getSettingInstance",value:function(e){var r=this,o=`${this.prefix}${e}`,s=this.settingInstances.get(o);return s===void 0&&(s=new Mt(o,this.defaultValue),this.listeners.length>0&&s.addListener(function(a){r.notifyListeners(s,a)}),this.settingInstances.set(o,s)),s}},{key:"addListener",value:function(e){var r=this;if(!e)throw new Error("No callback provided for data listener");if(this.listeners.length===0){var o=function(u){u.addListener(function(l){r.notifyListeners(u,l)})};for(var s of this.settingInstances.values())o(s)}this.listeners.push(e)}},{key:"notifyListeners",value:function(e,r){for(var o of this.listeners)o(e,r)}}])})();nt(je,C(Rf()));p();var Df=C(F()),Pf=C(G()),Nf=C(ut()),Ma=C(Je()),Of=C(lt());function _y(t,n,e){return n=(0,Ma.default)(n),(0,Nf.default)(t,Bf()?Reflect.construct(n,e||[],(0,Ma.default)(t).constructor):n.apply(t,e))}function Bf(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(Bf=function(){return!!t})()}var wy=(function(t){function n(e){var r;return(0,Df.default)(this,n),r=_y(this,n),r.currentSettings=e,r}return(0,Of.default)(n,t),(0,Pf.default)(n,[{key:"setSettings",value:function(r){this.currentSettings=r,this.notifyListeners(r)}},{key:"getSettings",value:function(){return this.currentSettings}}])})(An);p();var ct="\\";var Rn=function(n,e){return Object.assign(Object.assign({},e),{parentPath:n})},ft=function(n){return Array.isArray(n)?n.length===5?`${n[0]}${ct}${n[1]}${ct}${n[2]}${ct}${n[3]}${ct}${n[4]}`:n.length===4?`${n[0]}${ct}${n[1]}${ct}${n[2]}${ct}${n[3]}`:n.length===3?`${n[0]}${ct}${n[1]}${ct}${n[2]}`:n.length===2?`${n[0]}${ct}${n[1]}`:n.length===1?n[0]:n.join(ct):"(malformed path)"};var Gf=(function(){function t(n){(0,Wf.default)(this,t),this.scopeItemsByContextId=new Map,this.itemsByWorkflowAndContextId=new Map,this.workflowDefinitionManager=n}return(0,Ff.default)(t,[{key:"setScopeItem",value:function(e,r){var o,s=e.contextId;if(s){if(this.itemsByWorkflowAndContextId.has(r.id)||this.itemsByWorkflowAndContextId.set(r.id,new Map),this.itemsByWorkflowAndContextId.get(r.id).set(s,[]),!this.scopeItemsByContextId.has(s))this.scopeItemsByContextId.set(s,e);else if(!((o=this.itemsByWorkflowAndContextId.get(r.id))===null||o===void 0)&&o.has(s)){var a=new b({resultDescription:`Trying to set new scope item: ${e.id} with already existing contextId ${s} for workflow ${r.id}`,operationName:"WIS.setScopeItem",resourceId:r.id,success:!0}).start();h.verbose(495837534,y.CoreDefault,a.stop())}}}},{key:"updateScopeItemPath",value:function(e,r,o){var s,a;if(e){var u=this.scopeItemsByContextId.get(e);if(u){var l=u.parentPath;this.scopeItemsByContextId.set(e,Rn(r,u));for(var c=(a=(s=this.itemsByWorkflowAndContextId.get(o.id))===null||s===void 0?void 0:s.get(e))!==null&&a!==void 0?a:[],f=0;f<c.length;f++)c[f]=Rn([].concat((0,xa.default)(r),(0,xa.default)(c[f].parentPath.slice(0,l.length))),c[f])}}}},{key:"getScopeItem",value:function(e,r){var o;for(var s of((o=this.itemsByWorkflowAndContextId.get(r.id))===null||o===void 0?void 0:o.keys())||[])if(ri(s,e))return this.scopeItemsByContextId.get(s)}},{key:"addItemToWorkflowList",value:function(e,r){var o=e.contextId;if(o){var s=this.itemsByWorkflowAndContextId.get(r.id);if(s)for(var a of s){var u=(0,Lf.default)(a,2),l=u[0],c=u[1];if(ri(l,o)){c.push(e);var f=new b({resultDescription:`Items for contextId ${l}: [${c.map(function(d){return d.id}).join(",")}]`,operationName:"WIS.addItemOnContextIdList",resourceId:r.id,success:!0}).start();h.info(495837533,y.CoreDefault,f.stop())}}}}},{key:"isWorkflowReady",value:function(e,r){var o=this.workflowDefinitionManager.getWorkflowDefinition(r,e).maxAnnotations;return this.getGeneratedItems(e,r).length>=o}},{key:"getItemsToExecute",value:function(e,r){var o=this.getGeneratedItems(e,r);return this.itemsByWorkflowAndContextId.get(r.id).delete(e),o}},{key:"onWorkflowExecuted",value:function(e,r){var o=e.contextId,s=this.itemsByWorkflowAndContextId.get(r.id);s&&(s.delete(o),s.size===0&&this.itemsByWorkflowAndContextId.delete(r.id)),this.hasWorkflowsAwaitingExecution(o)||this.scopeItemsByContextId.delete(o)}},{key:"getGeneratedItems",value:function(e,r){var o;if(!(!((o=this.itemsByWorkflowAndContextId.get(r.id))===null||o===void 0)&&o.get(e)))return[];var s=this.workflowDefinitionManager.getWorkflowDefinition(r,e).maxAnnotations;return this.itemsByWorkflowAndContextId.get(r.id).get(e).slice(0,s)}},{key:"hasWorkflowsAwaitingExecution",value:function(e){for(var r of this.itemsByWorkflowAndContextId.values())for(var o of r.keys())if(o===e)return!0;return!1}}])})();p();var ce;(function(t){t[t.JSWebSockets=0]="JSWebSockets",t[t.LocalWorkflowsOnly=1]="LocalWorkflowsOnly",t[t.HostWebSockets=2]="HostWebSockets",t[t.HttpFallback=3]="HttpFallback"})(ce||(ce={}));var ts;(function(t){t.Workflow="Workflow",t.Client="Client",t.HttpEndpoint="HttpEndpoint"})(ts||(ts={}));p();var $e=C(F()),Ue=C(G());var Aa=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_WorkflowRegistrationMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Aa.H_={T_:Aa.getTypeName(),B_:Aa.getBaseTypes()};var Ra=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_WorkflowExecutionRequest"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ra.H_={T_:Ra.getTypeName(),B_:Ra.getBaseTypes()};var Da=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_WorkflowCancellationRequest"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Da.H_={T_:Da.getTypeName(),B_:Da.getBaseTypes()};var Pa=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_WorkflowExecutionResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Pa.H_={T_:Pa.getTypeName(),B_:Pa.getBaseTypes()};var Na=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_RuntimeInitMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Na.H_={T_:Na.getTypeName(),B_:Na.getBaseTypes()};var Oa=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_DiagnosticTraceMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Oa.H_={T_:Oa.getTypeName(),B_:Oa.getBaseTypes()};var Ba=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_TelemetryMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ba.H_={T_:Ba.getTypeName(),B_:Ba.getBaseTypes()};var Ea=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_TelemetryFlushMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ea.H_={T_:Ea.getTypeName(),B_:Ea.getBaseTypes()};var La=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_SessionCloseResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();La.H_={T_:La.getTypeName(),B_:La.getBaseTypes()};var ui=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_WorkflowDefinitionOverrideMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ui.H_={T_:ui.getTypeName(),B_:ui.getBaseTypes()};var Xe=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_GetAnnotationsRequestMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_StreamingRequest","AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Xe.H_={T_:Xe.getTypeName(),B_:Xe.getBaseTypes()};var zt=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_GetAnnotationsResponseMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_StreamingResponse","AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();zt.H_={T_:zt.getTypeName(),B_:zt.getBaseTypes()};var Wa=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_TokenTypeRequestMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Wa.H_={T_:Wa.getTypeName(),B_:Wa.getBaseTypes()};var Fa=(function(){function t(n){(0,$e.default)(this,t),g.assign(t,this,n)}return(0,Ue.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Internal_TokenTypeResponseMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Fa.H_={T_:Fa.getTypeName(),B_:Fa.getBaseTypes()};p();p();var Uf=C(F()),qf=C(G()),Hf=C($f());function Ny(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}var Ga=";",$a=":",Oy=".";function ci(t){if(!t)return new dr([],new Set,new Map,new Map);var n=t.split(Ga),e=new Set,r=new Map,o=new Map;for(var s of n){var a=s.trim();if(a!==""){e.add(dr.normalizeName(a));var u=a.split($a),l=(0,Hf.default)(u),c=l[0],f=Ny(l).slice(1),d=f.join($a),m=dr.normalizeName(c);if(m){r.set(m,d);var v=dr.parseName(m);v&&v!==m&&o.set(v,m)}}}return new dr(n,e,r,o)}function fi(t){if(!t)return"";var n=new Set,e=[];for(var r of t.split(Ga).reverse()){var o=r.split($a)[0],s=dr.normalizeName(o);n.has(s)||(n.add(s),e.push(r))}return e.reverse().join(Ga)}var dr=(function(){function t(n,e,r,o){(0,Uf.default)(this,t),this.originalFlights=n,this.normalizedFlights=e,this.keyValueFlightsMap=r,this.parsedFlightsMap=o}return(0,qf.default)(t,[{key:"hasFlight",value:function(e){var r=t.normalizeName(e),o=this.normalizedFlights.has(r),s=this.keyValueFlightsMap.has(r),a=this.parsedFlightsMap.has(r);return o||s||a}},{key:"getBooleanValue",value:function(e,r){var o,s,a=(o=this.getStringValue(e))===null||o===void 0?void 0:o.toLowerCase(),u=(s=this.getStringValue(this.parsedFlightsMap.get(t.normalizeName(e))))===null||s===void 0?void 0:s.toLowerCase();return a==="true"||u==="true"?!0:a==="false"||u==="false"?!1:r}},{key:"getIntValue",value:function(e,r){var o=this.getStringValue(e),s=Number.parseInt(o,10);return Number.isNaN(s)?r:s}},{key:"getStringValue",value:function(e,r){var o;return(o=this.keyValueFlightsMap.get(t.normalizeName(e)))!==null&&o!==void 0?o:r}},{key:"getAll",value:function(){return this.originalFlights}},{key:"getAllParsed",value:function(){var e=[];return this.keyValueFlightsMap.forEach(function(r,o){var s=r==null?void 0:r.toLowerCase();switch(s){case"true":e.push({name:o,value:!0});break;case"false":e.push({name:o,value:!1});break;default:{var a=Number.parseInt(s,10);Number.isNaN(a)?e.push({name:o,value:r}):e.push({name:o,value:a})}break}}),e}}],[{key:"normalizeName",value:function(e){return e==null?void 0:e.toLowerCase()}},{key:"parseName",value:function(e){var r=e==null?void 0:e.split(Oy);return r?r[r.length-1]:void 0}}])})();p();var od=C(F()),sd=C(G());p();var Zf=C(F()),ed=C(G());p();var Qf=C(F()),Yf=C(G());p();var jf=C(F()),Jf=C(G());p();p();var Vf=C(F()),zf=C(G());var ns=(function(){function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:500,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;(0,Vf.default)(this,t),this.prevSeq=-1,this.bufferingTimeMs=n,this.rejectOutdatedSequenceNumbers=e}return(0,zf.default)(t,[{key:"sequence",value:function(e){var r=this;return new Promise(function(o,s){if(e<r.prevSeq)if(r.rejectOutdatedSequenceNumbers){var a=new Error(`BufferingSequencer: Item out of order. Expecting seqId > ${r.prevSeq}. Actual seqId ${e}`);a.name=t.Rejected,s(a);return}else r.prevSeq=-1;e!=r.prevSeq+1&&h.warn(542712385,y.CoreDefault,`BufferingSequencer: got out of order sequence number. Got ${e}, expected ${r.prevSeq+1}`);var u={seq:e,resolve:o};r.insertItem(u),r.runInOrder(u,!0,!1)})}},{key:"insertItem",value:function(e){if(!this.firstQueueItem){this.firstQueueItem=e,this.lastQueueItem=e;return}var r=this.lastQueueItem,o=null;do{if(e.seq>r.seq){e.prev=r,r.next=e,o?(o.prev=e,e.next=o):this.lastQueueItem=e;return}o=r,r=r.prev}while(r);o&&(o.prev=e),e.next=o,this.firstQueueItem=e}},{key:"runInOrder",value:function(e,r,o){for(var s=this,a=this.prevSeq,u=!1,l=[];this.firstQueueItem;){var c=this.firstQueueItem;if(a+1!=c.seq&&(!o||c.seq>e.seq))break;a=c.seq,c.timeout&&clearTimeout(c.timeout),l.push(c),e==c&&(u=!0),this.firstQueueItem=this.firstQueueItem.next,this.firstQueueItem&&(this.firstQueueItem.prev=null)}l.length>0&&setTimeout(function(){for(var f of l)f.resolve(f.seq)},0),this.prevSeq=a,!u&&r&&(e.timeout=setTimeout(function(){s.runInOrder(e,!1,!0)},this.bufferingTimeMs))}}])})();ns.Rejected="SequenceItemRejected";var Kf=(function(){function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:500;(0,jf.default)(this,t),this.bufferingTimeMs=500,this.workflowIdToSequencersMap=new Map,this.bufferingTimeMs=n}return(0,Jf.default)(t,[{key:"create",value:function(e){if(!e.ownerId)return null;var r=this.workflowIdToSequencersMap.get(e.ownerId);return r||(r=new ns(this.bufferingTimeMs),this.workflowIdToSequencersMap.set(e.ownerId,r)),r}}])})();var By=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},Xf=(function(){function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:500,e=arguments.length>1?arguments[1]:void 0;(0,Qf.default)(this,t),this.sequencerFactory=e!=null?e:new Kf(n)}return(0,Yf.default)(t,[{key:"sequence",value:function(e){return By(this,void 0,void 0,function*(){var r,o=(r=e==null?void 0:e.M_)===null||r===void 0?void 0:r.seq;if(o!=null){var s=this.sequencerFactory.create(e);s&&(yield s.sequence(e.M_.seq))}})}}])})();var td=(function(){function t(n){(0,Zf.default)(this,t),this.annotationSequencer=n!=null?n:new Xf}return(0,ed.default)(t,[{key:"process",value:function(e,r,o,s){var a=this,u=[],l=function(d){var m=[];if(d!=null&&d.items){var v=function(M){var k=a.annotationSequencer.sequence(M.body).then(function(){r(d,M)});m.push(k)};for(var _ of d.items)v(_)}u.push(Promise.all(m).then(function(){o(d,e.cv)}))};for(var c of e.ops)l(c);Promise.all(u).then(function(){return s(e)})}}])})();p();var nd=C(F()),rd=C(G()),id=(function(){function t(){(0,nd.default)(this,t)}return(0,rd.default)(t,[{key:"process",value:function(e,r,o,s){for(var a of e.ops){if(a!=null&&a.items)for(var u of a.items)r(a,u);o(a,e.cv)}s(e)}}])})();var ad=(function(){function t(n,e,r){(0,od.default)(this,t),this.isOrderingEnabled=n,this.orderedAnnotationResultsProcessor=e!=null?e:new td,this.unorderedAnnotationResultsProcessor=r!=null?r:new id}return(0,sd.default)(t,[{key:"process",value:function(e,r,o,s){this.isOrderingEnabled()?this.orderedAnnotationResultsProcessor.process(e,r,o,s):this.unorderedAnnotationResultsProcessor.process(e,r,o,s)}}])})();p();var ld=C(F()),cd=C(G());var ud=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},fd=(function(){function t(n,e){(0,ld.default)(this,t),this.changeGatesInitialized=!1,this.hostCallbacks=n,this.changeGateMap=e||new Map}return(0,cd.default)(t,[{key:"init",value:function(){return ud(this,void 0,void 0,function*(){var e=this,r=[];this.hostCallbacks&&this.hostCallbacks.isChangeGateEnabled&&this.changeGateMap.forEach(function(o,s){r.push(e.hostCallbacks.isChangeGateEnabled(s).then(function(a){e.changeGateMap.set(s,a)}))}),yield Promise.all(r).then(function(){e.changeGatesInitialized=!0}).catch(function(o){})})}},{key:"isFeatureEnabled",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"None";return this.hostCallbacks&&this.hostCallbacks.isFeatureEnabled?this.hostCallbacks.isFeatureEnabled(e,o).catch(function(){return Promise.resolve(r)}):Promise.resolve(r)}},{key:"isChangeGateEnabled",value:function(e){return ud(this,void 0,void 0,function*(){var r;return this.changeGateMap?this.changeGatesInitialized&&this.changeGateMap.has(e)?this.changeGateMap.get(e):!this.changeGatesInitialized&&(!((r=this.hostCallbacks)===null||r===void 0)&&r.isChangeGateEnabled)?yield this.hostCallbacks.isChangeGateEnabled(e):!0:!0})}},{key:"isChangeGateEnabledSync",value:function(e){var r;if(!this.changeGatesInitialized&&(!((r=this.hostCallbacks)===null||r===void 0)&&r.isChangeGateEnabled)){var o=new b({operationName:"GateUtilsNotInitialized",success:!1,resultDescription:`${e}`});h.error(505529628,y.CoreDefault,o)}return this.changeGateMap&&this.changeGatesInitialized&&this.changeGateMap.has(e)?this.changeGateMap.get(e):!0}},{key:"isChangeGatesInitialized",value:function(){return this.changeGatesInitialized}},{key:"getChangeGateMap",value:function(){return this.changeGateMap}}])})();p();var ls=C(Re()),hn=C(mt()),sg=C(F()),ag=C(G());p();var au=C(Re()),pd=C(F()),hd=C(G());p();var gd=2,di;(function(t){t[t.ServerError=0]="ServerError",t[t.WorkflowDisabled=100]="WorkflowDisabled",t[t.TokenNotReady=101]="TokenNotReady",t[t.FlightNotReady=102]="FlightNotReady",t[t.ContextNotReady=103]="ContextNotReady",t[t.WorkflowExcluded=104]="WorkflowExcluded",t[t.WorkflowExecutionTimeout=105]="WorkflowExecutionTimeout",t[t.LambdaExecutionError=106]="LambdaExecutionError",t[t.UnexpectedOutput=107]="UnexpectedOutput",t[t.FailedToFetchInputs=108]="FailedToFetchInputs",t[t.FailedToFetchRequestedContexts=109]="FailedToFetchRequestedContexts",t[t.Unauthorized=110]="Unauthorized",t[t.WorkflowExecutionCancelled=111]="WorkflowExecutionCancelled"})(di||(di={}));var gi;(function(t){t[t.Unknown=0]="Unknown",t[t.InvalidRequest=1]="InvalidRequest",t[t.InvalidResponse=2]="InvalidResponse",t[t.RuntimeNotInitialized=3]="RuntimeNotInitialized",t[t.RequestCancelled=4]="RequestCancelled",t[t.ResponseReceivedAfterFinalResponse=5]="ResponseReceivedAfterFinalResponse"})(gi||(gi={}));var Ie;(function(t){t[t.Unknown=0]="Unknown",t[t.Found=302]="Found",t[t.BadRequest=400]="BadRequest",t[t.Unauthorized=401]="Unauthorized",t[t.Forbidden=403]="Forbidden",t[t.NotFound=404]="NotFound",t[t.RequestTimeout=408]="RequestTimeout",t[t.Conflict=409]="Conflict",t[t.Gone=410]="Gone",t[t.RequestEntityTooLarge=413]="RequestEntityTooLarge",t[t.UnsupportedMediaType=415]="UnsupportedMediaType",t[t.UnprocessableContent=422]="UnprocessableContent",t[t.TooManyRequests=429]="TooManyRequests",t[t.SocketDisconnect=499]="SocketDisconnect",t[t.InternalServerError=500]="InternalServerError",t[t.ServiceUnavailable=503]="ServiceUnavailable",t[t.GatewayTimeout=504]="GatewayTimeout",t[t.UnsupportedMessage=1e3]="UnsupportedMessage",t[t.Cancelled=1001]="Cancelled",t[t.EgressError=1002]="EgressError",t[t.MessageValidationError=1003]="MessageValidationError",t[t.SyncMessageException=2e3]="SyncMessageException",t[t.SyncMessageUnsupported=2001]="SyncMessageUnsupported",t[t.SyncMessageUnexpectedSeed=2002]="SyncMessageUnexpectedSeed",t[t.SyncMessageUnsupportedBatch=2003]="SyncMessageUnsupportedBatch",t[t.SyncMessageQueueFull=2004]="SyncMessageQueueFull",t[t.SyncMessageTooLateOrDuplicate=2005]="SyncMessageTooLateOrDuplicate",t[t.SyncMessageGroupIdMismatch=2006]="SyncMessageGroupIdMismatch",t[t.SyncMessageGroupStop=2007]="SyncMessageGroupStop",t[t.SyncMessageLost=2008]="SyncMessageLost",t[t.SyncMessageUnprocessedDuplicate=2009]="SyncMessageUnprocessedDuplicate",t[t.SyncMessageSessionClosed=2010]="SyncMessageSessionClosed",t[t.SyncMessageAbandoned=2011]="SyncMessageAbandoned",t[t.SyncMessageTooManyDeltaOperations=2012]="SyncMessageTooManyDeltaOperations",t[t.SyncMessageSessionSizeLimitExceeded=2013]="SyncMessageSessionSizeLimitExceeded",t[t.TokenValidationError=2100]="TokenValidationError",t[t.TokenDecryptError=2101]="TokenDecryptError",t[t.TokenTypeError=2102]="TokenTypeError",t[t.TokenUserBlocked=2103]="TokenUserBlocked",t[t.AnnotationActivationInvalidType=2200]="AnnotationActivationInvalidType",t[t.AnnotationReleaseTokenNotFound=2300]="AnnotationReleaseTokenNotFound",t[t.ForbiddenByDlpCopilotPolicy=2400]="ForbiddenByDlpCopilotPolicy"})(Ie||(Ie={}));var jt;(function(t){t[t.UnKnown=0]="UnKnown",t[t.Start=1]="Start",t[t.Regular=2]="Regular",t[t.CheckConnection=3]="CheckConnection",t[t.PostEgress=4]="PostEgress",t[t.TimeoutResend=5]="TimeoutResend",t[t.FailResend=6]="FailResend"})(jt||(jt={}));var dd;(function(t){t[t.IdentityChange=0]="IdentityChange"})(dd||(dd={}));var gr;(function(t){t[t.Idle=0]="Idle",t[t.Pending=1]="Pending"})(gr||(gr={}));var pr;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Started=1]="Started",t[t.Incomplete=2]="Incomplete",t[t.Finished=3]="Finished"})(pr||(pr={}));p();var H=C(F()),V=C(G());var Ua=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Message"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ua.H_={T_:Ua.getTypeName(),B_:Ua.getBaseTypes()};var Te=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_Response"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Te.H_={T_:Te.getTypeName(),B_:Te.getBaseTypes()};var pi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_StreamingResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();pi.H_={T_:pi.getTypeName(),B_:pi.getBaseTypes()};var hi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_StreamingRequest"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();hi.H_={T_:hi.getTypeName(),B_:hi.getBaseTypes()};var qa=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_ExecutionError"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();qa.H_={T_:qa.getTypeName(),B_:qa.getBaseTypes()};var Ha=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_GetAnnotationsClientError"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ha.H_={T_:Ha.getTypeName(),B_:Ha.getBaseTypes()};var Va=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_GetAnnotationsErrorInfo"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Va.H_={T_:Va.getTypeName(),B_:Va.getBaseTypes()};var ee=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_ErrorResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ee.H_={T_:ee.getTypeName(),B_:ee.getBaseTypes()};var mi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_TimeoutErrorResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_ErrorResponse","AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();mi.H_={T_:mi.getTypeName(),B_:mi.getBaseTypes()};var yi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_RateLimitErrorResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_ErrorResponse","AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();yi.H_={T_:yi.getTypeName(),B_:yi.getBaseTypes()};var Ne=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionInitMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ne.H_={T_:Ne.getTypeName(),B_:Ne.getBaseTypes()};var It=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionInitResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();It.H_={T_:It.getTypeName(),B_:It.getBaseTypes()};var Dn=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionLongPollMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Dn.H_={T_:Dn.getTypeName(),B_:Dn.getBaseTypes()};var Jt=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionLongPollResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Jt.H_={T_:Jt.getTypeName(),B_:Jt.getBaseTypes()};var vi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionCloseReason"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();vi.H_={T_:vi.getTypeName(),B_:vi.getBaseTypes()};var za=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionSwapOnClose"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_SessionCloseReason"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();za.H_={T_:za.getTypeName(),B_:za.getBaseTypes()};var be=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionCloseMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();be.H_={T_:be.getTypeName(),B_:be.getBaseTypes()};var Ci=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_CacheDumpRequestMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ci.H_={T_:Ci.getTypeName(),B_:Ci.getBaseTypes()};var ja=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_CacheDumpRequestResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ja.H_={T_:ja.getTypeName(),B_:ja.getBaseTypes()};var Kt=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationActivationMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Kt.H_={T_:Kt.getTypeName(),B_:Kt.getBaseTypes()};var Qt=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationActivationResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Qt.H_={T_:Qt.getTypeName(),B_:Qt.getBaseTypes()};var Si=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationResultStateMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Si.H_={T_:Si.getTypeName(),B_:Si.getBaseTypes()};var Yt=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationReleaseMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Yt.H_={T_:Yt.getTypeName(),B_:Yt.getBaseTypes()};var Pn=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationReleaseResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Pn.H_={T_:Pn.getTypeName(),B_:Pn.getBaseTypes()};var ki=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationConfigUpdateMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ki.H_={T_:ki.getTypeName(),B_:ki.getBaseTypes()};var Ja=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationConfigUpdateResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ja.H_={T_:Ja.getTypeName(),B_:Ja.getBaseTypes()};var dt=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_BatchedMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();dt.H_={T_:dt.getTypeName(),B_:dt.getBaseTypes()};var le=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SyncMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();le.H_={T_:le.getTypeName(),B_:le.getBaseTypes()};var Nn=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_MicroSyncMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Nn.H_={T_:Nn.getTypeName(),B_:Nn.getBaseTypes()};var _i=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SyncResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();_i.H_={T_:_i.getTypeName(),B_:_i.getBaseTypes()};var Ka=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionDeleteMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ka.H_={T_:Ka.getTypeName(),B_:Ka.getBaseTypes()};var Oe=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_AnnotationResultsMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_SyncMessage","AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Oe.H_={T_:Oe.getTypeName(),B_:Oe.getBaseTypes()};var dn=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_TokenProvisionMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();dn.H_={T_:dn.getTypeName(),B_:dn.getBaseTypes()};var Xt=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_TokenFailureMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Xt.H_={T_:Xt.getTypeName(),B_:Xt.getBaseTypes()};var Qa=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_TokenProvisionResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Qa.H_={T_:Qa.getTypeName(),B_:Qa.getBaseTypes()};var Ya=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_KeepAlive"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ya.H_={T_:Ya.getTypeName(),B_:Ya.getBaseTypes()};var wi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_WorkflowGraphInitMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();wi.H_={T_:wi.getTypeName(),B_:wi.getBaseTypes()};var Xa=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_WorkflowGraphInitResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Xa.H_={T_:Xa.getTypeName(),B_:Xa.getBaseTypes()};var Ti=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_WorkflowExecutionCompleteMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_SyncMessage","AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ti.H_={T_:Ti.getTypeName(),B_:Ti.getBaseTypes()};var On=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SeedingStatusChangeMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();On.H_={T_:On.getTypeName(),B_:On.getBaseTypes()};var Za=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_OAuth2InitV2Message"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Za.H_={T_:Za.getTypeName(),B_:Za.getBaseTypes()};var eu=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_OAuth2InitV2Response"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();eu.H_={T_:eu.getTypeName(),B_:eu.getBaseTypes()};var tu=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_OAuth2InitMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();tu.H_={T_:tu.getTypeName(),B_:tu.getBaseTypes()};var nu=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_OAuth2InitResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();nu.H_={T_:nu.getTypeName(),B_:nu.getBaseTypes()};var ru=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_OAuth2CallbackMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ru.H_={T_:ru.getTypeName(),B_:ru.getBaseTypes()};var gn=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_BridgeMessage"}},{key:"getBaseTypes",value:function(){return[]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();gn.H_={T_:gn.getTypeName(),B_:gn.getBaseTypes()};var Bn=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionConnectMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Bn.H_={T_:Bn.getTypeName(),B_:Bn.getBaseTypes()};var En=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionDisconnectMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();En.H_={T_:En.getTypeName(),B_:En.getBaseTypes()};var Ln=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SessionReconnectMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Ln.H_={T_:Ln.getTypeName(),B_:Ln.getBaseTypes()};var Wn=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SubmittedCustomMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Wn.H_={T_:Wn.getTypeName(),B_:Wn.getBaseTypes()};var Zt=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_ServerAuthenticationStateChangeMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Zt.H_={T_:Zt.getTypeName(),B_:Zt.getBaseTypes()};var bi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_ClaimsChallengeMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();bi.H_={T_:bi.getTypeName(),B_:bi.getBaseTypes()};var iu=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_BlobUploadResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();iu.H_={T_:iu.getTypeName(),B_:iu.getBaseTypes()};var ou=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_GetPluginsMetadataMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();ou.H_={T_:ou.getTypeName(),B_:ou.getBaseTypes()};var su=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_GetPluginsMetadataResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();su.H_={T_:su.getTypeName(),B_:su.getBaseTypes()};var Mi=(function(){function t(n){(0,H.default)(this,t),g.assign(t,this,n)}return(0,V.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_ExecutionCorrelatedClientResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Mi.H_={T_:Mi.getTypeName(),B_:Mi.getBaseTypes()};p();p();var Ey=C(Re()),pn;(function(t){t.InvalidType="invalid_type",t.InvalidEnum="invalid_enum",t.NumberMax="number_max",t.NumberMin="number_min",t.LengthMin="length_min",t.LengthMax="length_max",t.ItemsMax="items_max",t.ItemsMin="items_min",t.ItemsUnique="items_unique",t.PropertiesMax="properties_max",t.PropertiesMin="properties_min",t.Required="required",t.Custom="custom"})(pn||(pn={}));var Ly=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},Wy=new Mt("processAndRejectMessageEndpointValidation",!0),rs=new Mt("messageValidationAllowList",[{code:pn.Required,className:"",path:[],message:""},{code:pn.InvalidType,className:"SchemaObjectHeader",path:["config"],message:"SchemaObjectHeader: Expected object, got undefined object for SchemaObjectHeaderValidator"},{code:pn.InvalidType,className:"Item",path:["item","id"],message:'Required field "id" is wrong type'},{code:pn.InvalidType,className:"Item",path:["ops","*","items","0","id"],message:'Required field "id" is wrong type'}]),Ze;(function(t){t.ClientDisconnected="Client disconnected.",t.ClientClosed="Client closed",t.UnsupportedSyncMessage="SyncMessages with seq = -1 are not supported anymore.",t.UnexpectedSeedMessage="Unexpected seed message",t.SyncMessageUnsupportedBatch="SyncMessage with unsupported batching.",t.AnnotationTokenNotFound="Token not found",t.TooManyDeltaOperations="SyncMessage with too many delta operations",t.UnsupportedSyncMessageSeq0NonSeeding="SyncMessages with seq 0 are not supported in non seeding sequencer (SenderId)."})(Ze||(Ze={}));var uu;(function(t){t.ProvisionTokenValidationError="Token provision message didn't pass token validation.",t.ProvisionTokenDecryptAndTransformError="Token provision message didn't pass token decrypt and transform.",t.SessionUserMismatch="Session invoked by a different user."})(uu||(uu={}));function Ii(t){var n=["AugLoop_Excel_Session_Protocol_","AugLoop_Powerpoint_Session_Protocol_","AugLoop_Session_Protocol_"],e;for(var r of n)if(t.indexOf(r)===0){e=r;break}if(!e)return"MalformedMessageName";var o="Message",s=t.indexOf(o,t.length-o.length)===t.length-o.length;return t.slice(e.length,s?-o.length:void 0)}var Fy=5e3,Gy=12e4,$y=15e3,Uy=3e5,qy=12e4,md=(function(){function t(n){(0,pd.default)(this,t),this.config=n,this.nextMessageId=1,this.pendingResponseCallbacks=new oa({sweepInterval:Fy}),this.messageCallbacks=new Map,this.messageValidators=new Map,this.secondaryEgresses=new Map,this.messageIdPrefix=n.messageIdPrefix,this.source=n.messageIdPrefix==="c"?_t.ClientRuntime:_t.Core,this.stats={sendMessageCount:0,sendMessageClientDisconnectedErrors:0,sendMessageErrors:0,sendMessageDurationMsMax:0,processMessageCount:0,processMessageProvisionTokenErrors:0,processMessageErrors:0,processMessageDurationMsMax:0};var e=function(a){return a.map(function(u){return{code:(u==null?void 0:u.code)||"",className:(u==null?void 0:u.className)||"",path:(u==null?void 0:u.path)||[]}})},r=e(rs.getDefaultValue()),o=e(rs.getValue());rs.getDefaultValue()===rs.getValue()?this.messageValidationAllowListFull=r:this.messageValidationAllowListFull=[].concat((0,au.default)(r),(0,au.default)(o.filter(function(s){return s.code})))}return(0,hd.default)(t,[{key:"setClientMetadata",value:function(e){this.clientMetadata=e}},{key:"setEgress",value:function(e){var r=this;this.egress=e,this.config.resendPendingMessagesOnReconnect&&this.egress&&this.pendingResponseCallbacks.forEach(function(o,s){o.logOp.dimension1=(o.sendCount++).toString(),r.egress(o.message,function(a){return r.onEgressError(a,o)})})}},{key:"registerEgress",value:function(e,r){this.secondaryEgresses.set(e,r)}},{key:"unregisterEgress",value:function(e){this.secondaryEgresses.delete(e)}},{key:"secondaryEgressCount",get:function(){return this.secondaryEgresses.size}},{key:"ingress",value:function(e,r){Te.typeGuard(e)?(this.processResponse(e),r()):this.processMessage(e,r),be.typeGuard(e)&&!e.reconnectAllowed&&this.clearAllPendingResponses()}},{key:"sendMessage",value:function(e,r,o){var s=this,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,u,l,c=new ei({sessionHealthEventName:"SendMessage",source:this.source,reason:ln.Client,impact:this.source===_t.ClientRuntime?wt.MissingInput:wt.MissingOutput,success:!0,message:"",affectedWorkflows:["All"],cv:e.cv,resourceId:Ii(g.getTypeNameFor(e)),dimension0:a.toString()}).start().enableAggregation(),f=function(){if(c.setClientMetadata(s.clientMetadata,!Vt("SendMessageFlights")),c.success)h.info(572836e3,y.CoreDefault,c.stop());else{var P=c.resultSignature==="ErrorWithoutPendingResponse"||c.resultSignature==="ResponseCallbackException"||c.message!=="We called into done callback";c.message=JSON.stringify({errorNotPropagatedToDoneCallback:P}),h.error(572836001,y.CoreDefault,c.stop())}};Vt("PersistMessageId")?e.messageId=(u=e.messageId)!==null&&u!==void 0?u:`${this.messageIdPrefix}${this.nextMessageId++}`:e.messageId=`${this.messageIdPrefix}${this.nextMessageId++}`,dt.typeGuard(e)&&e.messages.forEach(function(w,P){return w.messageId=e.messageId+"."+P});var d=g.getTypeNameFor(e)===be.getTypeName(),m=!o&&!d,v={message:e,logOp:c,logEvent:f,callback:void 0,sendCount:1};if(m){v.callback=function(w,P){var R;if(w?Vt("IgnoreUnsupportedMessageErrorForOldClientVersion")&&w.code===Ie.UnsupportedMessage?(c.resultSignature="Success",c.resultDescription=`Ignore error for ${g.getTypeNameFor(e)} message ${e.messageId}${le.typeGuard(e)?`, seq ${e.seq}`:""}: ${w.error}`):(c.success=!1,c.resultSignature=w.error,c.resultDescription=`Error for ${g.getTypeNameFor(e)} message ${e.messageId}${le.typeGuard(e)?`, seq ${e.seq}`:""}: ${w.error}`):c.resultSignature="Success",r)try{c.message="We called into done callback",r(w,P)}catch(B){c.success=!1,c.resultSignature="ResponseCallbackException",c.resultDescription=((R=s.clientMetadata)===null||R===void 0?void 0:R.appPlatform)==="Web"?JSON.stringify({message:B.message,stack:B.stack}):JSON.stringify({message:B.message})}f(),s.updateSendMessageStats(c.success,c.durationMs,w?new Error(w.error):void 0)};var _=function(){v.callback(new mi({code:Ie.RequestTimeout,error:"Timeout waiting for response"}),void 0)},S=this.config.responseTimeoutMs;if(Dn.typeGuard(e)){var M=e;M.longPollTimeoutHint>=$y&&M.longPollTimeoutHint<=Uy?S=M.longPollTimeoutHint+5e3:S=Gy}else hi.typeGuard(e)&&(S=(l=e.maxDelayMs)!==null&&l!==void 0?l:qy);this.pendingResponseCallbacks.put(e.messageId,v,S,_)}this.egress&&this.egress(e,function(w){return s.onEgressError(w,v)},a);for(var k of this.secondaryEgresses.values())k(e,function(w){return s.onEgressError(w,v)},a)}},{key:"onEgressError",value:function(e,r){var o,s;if(e){var a=r.message,u=this.pendingResponseCallbacks.get(r.message.messageId);u?(this.pendingResponseCallbacks.del(a.messageId),u.callback(new ee({messageId:a.messageId,code:Ie.EgressError,error:e.message}))):be.typeGuard(a)?(r.logOp.success=(s=(o=e.message)===null||o===void 0?void 0:o.endsWith("Client disconnected."))!==null&&s!==void 0?s:!1,r.logOp.resultSignature="ErrorSendingSessionCloseMessage",r.logOp.resultDescription=`Error for ${g.getTypeNameFor(a)} message ${a.messageId}: ${e.message}`,r.logEvent()):(r.logOp.success=!1,r.logOp.resultSignature="ErrorWithoutPendingResponse",r.logOp.resultDescription=`Error for ${g.getTypeNameFor(a)} message ${a.messageId}: ${e.message}`,r.logEvent())}}},{key:"queryEgressCacheSize",value:function(){return this.pendingResponseCallbacks.size()}},{key:"onMessage",value:function(e,r,o){this.messageCallbacks.set(e,r),o&&this.messageValidators.set(e,o)}},{key:"onMessageAsync",value:function(e,r,o){var s=this;this.messageCallbacks.set(e,function(a,u){return Ly(s,void 0,void 0,function*(){try{var l=yield r(a);ee.typeGuard(l)?u(l,void 0):u(void 0,l)}catch(c){u(c)}})}),o&&this.messageValidators.set(e,o)}},{key:"getStats",value:function(){return this.stats}},{key:"hasMessageCallback",value:function(e){return this.messageCallbacks.has(e)}},{key:"cancelPendingResponseCallbacks",value:function(e){var r=this;this.pendingResponseCallbacks.forEach(function(o,s){o&&(r.pendingResponseCallbacks.del(s),o.callback(new ee({messageId:s,code:Ie.Cancelled,error:`Cancelled. Reason: ${e}`})))})}},{key:"clearAllPendingResponses",value:function(){if(this.pendingResponseCallbacks.size()!=0){var e=new b({operationName:"PurgePendingResponses",resultDescription:this.pendingResponseCallbacks.size().toString(),success:!0});h.info(572836002,y.CoreDefault,e),this.pendingResponseCallbacks.clear()}}},{key:"processMessage",value:function(e,r){var o=this,s,a,u,l,c=new ei({sessionHealthEventName:"ProcessMessage",source:this.source,reason:ln.Client,impact:this.source===_t.ClientRuntime?wt.MissingOutput:wt.MissingInput,success:!0,message:"",affectedWorkflows:["All"],cv:e.cv}).start().enableAggregation(),f=function(){if(c.setClientMetadata(o.clientMetadata,!Vt("ProcessMessageFlights")),c.success)h.info(572836003,y.CoreDefault,c.stop());else{var E=c.resourceId==="UnsupportedMessage"||c.resultSignature==="Timeout"||c.resultSignature==="OnResponseInvokedMoreThanOnce"||c.resultSignature==="MessageCallbackException"||c.message!=="We called into messageCallback";c.message=JSON.stringify({errorHappenedOutsideRegisteredMessageCallback:E}),h.error(572836032,y.CoreDefault,c.stop())}},d=this.messageValidators.get(g.getTypeNameFor(e)),m=((a=(s=this.clientMetadata)===null||s===void 0?void 0:s.userAgent)===null||a===void 0?void 0:a.startsWith("test-suite"))||((l=(u=this.clientMetadata)===null||u===void 0?void 0:u.userAgent)===null||l===void 0?void 0:l.startsWith("e2e-test")),v;if(Vt("enableMessageValidation")&&d&&!m){var _=new b({operationName:"MessageValidationFailure",resourceId:Ii(g.getTypeNameFor(e)),success:!1,resultDescription:""},{metricDuration:!0}).start(),S=d.validate(e);if(_.success=S.success,!S.success){var M=S.errors,k=!0;for(var w of M){var P=!1,R=function(E){if(w.code===E.code&&!E.className&&E.path.length===0)P=!0;else if(w.code===E.code&&w.className===E.className&&w.path.length===E.path.length&&w.path.every(function($,K){return $===E.path[K]||E.path[K]==="*"}))return P=!0,1};for(var B of this.messageValidationAllowListFull)if(R(B))break;k=k&&P}k?_.dimension0="ValidationErrorAllowed":(_.dimension0="ValidationErrorNotAllowed",v=`Message type ${g.getTypeNameFor(e)} had a type validation error`),S.errors?(S.errors.length>0&&(_.dimension1=S.errors[0].code),_.setDataFields({errors:JSON.stringify(S.errors)}),_.resultDescription="List of error messages: "+S.errors.map(function(U){return U.message}).join(", ")):(_.setDataFields({errors:"No validation errors provided"}),_.resultDescription="Validation failed with no specific errors"),h.info(504971855,y.CoreDefault,_.stop())}}var W=this.messageCallbacks.get(g.getTypeNameFor(e));W?(c.resourceId=Ii(g.getTypeNameFor(e)),Wy.getValue()&&v&&(h.error(504729920,y.CoreDefault,`Rejecting message ${e.messageId} due to validation error`),W=function(E,$){$(new ee({messageId:E.messageId,code:Ie.MessageValidationError,error:v}))})):W=function(E,$){c.resourceId=Ii(g.getTypeNameFor(E)),c.resourceId!=="MalformedMessageName"&&(c.resourceId="UnsupportedMessage"),$(new ee({messageId:E.messageId,code:Ie.UnsupportedMessage,error:`Message type ${g.getTypeNameFor(E)} is not supported`}))};var I=function(E,$){return $!==void 0?JSON.stringify({message:E,stack:$}):E},X=!1,Z=function(E,$){if(X){c.success=!1,c.resultSignature="OnResponseInvokedMoreThanOnce";var K=`Invoked onResponse for ${g.getTypeNameFor(e)} message ${e.messageId} more than once`;c.resultDescription=I(K)}else if(E){c.success=!1,c.resultSignature=E.error,E.code!==void 0&&(c.dimension0=Ie[E.code]);var ge=`Error for ${g.getTypeNameFor(e)} message ${e.messageId}: ${E.error}`;c.resultDescription=I(ge)}else c.resultSignature="Success",c.resultDescription=I("");X=!0,f(),E&&!g.matchesTypesFor(E,[ee.getTypeName()])&&(E=new ee({error:"Internal Server Error"})),o.updateProcessMessageStats(c.success,c.durationMs,E?new Error(E.error):void 0),E?(E.messageId=e.messageId,r(E)):$?($.messageId=e.messageId,r(void 0,$)):r()};try{c.message="We called into messageCallback",W(e,Z)}catch(U){c.success=!1,c.resultSignature="MessageCallbackException",c.resultDescription=I(U.message,U.stack),f(),this.updateProcessMessageStats(!1,c.durationMs,U),r()}}},{key:"processResponse",value:function(e){var r,o=new b({operationName:"ProcessResponse"});if(o.success=!0,o.setClientMetadata(this.clientMetadata),o.start(),e.messageId){var s=this.pendingResponseCallbacks.get(e.messageId),a=s==null?void 0:s.callback;if(a){if(pi.typeGuard(e)&&!e.finalResponse){var u=s.message.maxDelayMs;this.pendingResponseCallbacks.updateExpireTime(e.messageId,u)}else this.pendingResponseCallbacks.del(e.messageId);g.matchesTypesFor(e,[ee.getTypeName()])?a(e):a(void 0,e)}else o.resultSignature="NoPendingMessage",o.resultDescription=`${e.messageId}`,o.success=!1}else o.resultSignature="NoMessageIdSetInResponse",ee.typeGuard(e)?o.resultDescription=e.error:o.resultDescription="MessageId is not available",o.success=!1;((r=this.clientMetadata)===null||r===void 0?void 0:r.releaseAudienceGroup)!=="Production"&&(o.resourceId=Ii(g.getTypeNameFor(e)),h.info(572836034,y.CoreDefault,o.stop()))}},{key:"updateSendMessageStats",value:function(e,r,o){this.stats.sendMessageCount++,this.stats.sendMessageDurationMsMax=Math.max(r,this.stats.sendMessageDurationMsMax),!e&&!o?h.warn(572836035,y.CoreDefault,"Failed send message did not provide error object."):e&&o&&h.warn(572836036,y.CoreDefault,"Succeeded send message provided error object."),!e&&(o&&o.message===Ze.ClientDisconnected?this.stats.sendMessageClientDisconnectedErrors++:this.stats.sendMessageErrors++)}},{key:"updateProcessMessageStats",value:function(e,r,o){this.stats.processMessageCount++,this.stats.processMessageDurationMsMax=Math.max(r,this.stats.processMessageDurationMsMax),!e&&!o?h.warn(572836037,y.CoreDefault,"Failed process message did not provide error object."):e&&o&&h.warn(572836038,y.CoreDefault,"Succeeded process message provided error object."),!e&&(o&&o.message===uu.ProvisionTokenValidationError?this.stats.processMessageProvisionTokenErrors++:this.stats.processMessageErrors++)}}])})();p();var fe;(function(t){t[t.NotAuthenticated=0]="NotAuthenticated",t[t.Pending=1]="Pending",t[t.Authenticated=2]="Authenticated",t[t.WacUserInfoAuthenticated=3]="WacUserInfoAuthenticated",t[t.TokenMissingInteractionRequired=4]="TokenMissingInteractionRequired"})(fe||(fe={}));p();var en=C(F()),tn=C(G());var Fn=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SetClaimsChallengeCallbackMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Fn.H_={T_:Fn.getTypeName(),B_:Fn.getBaseTypes()};var Gn=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_FireClaimsChallengeCallbackResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Gn.H_={T_:Gn.getTypeName(),B_:Gn.getBaseTypes()};var $n=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_SetSeedingStatusChangeCallbackMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();$n.H_={T_:$n.getTypeName(),B_:$n.getBaseTypes()};var Un=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_FireSeedingStatusChangeCallbackResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Un.H_={T_:Un.getTypeName(),B_:Un.getBaseTypes()};var qn=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_InteractiveAuthMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();qn.H_={T_:qn.getTypeName(),B_:qn.getBaseTypes()};var Hn=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_GetAnnotationsResponseBridgeMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Hn.H_={T_:Hn.getTypeName(),B_:Hn.getBaseTypes()};var Vn=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_GetHostBridgeSessionRequestMessage"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Message"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();Vn.H_={T_:Vn.getTypeName(),B_:Vn.getBaseTypes()};var zn=(function(){function t(n){(0,en.default)(this,t),g.assign(t,this,n)}return(0,tn.default)(t,null,[{key:"getTypeName",value:function(){return"AugLoop_Session_Protocol_GetHostBridgeSessionResponse"}},{key:"getBaseTypes",value:function(){return["AugLoop_Session_Protocol_Response"]}},{key:"typeGuard",value:function(e){return g.matchesTypesFor(e,[t.getTypeName()])}}])})();zn.H_={T_:zn.getTypeName(),B_:zn.getBaseTypes()};p();var Kd=C(es()),Jn=C(Re()),Kn=C(mt()),Qd=C(F()),Yd=C(G());p();var bd=C(mt()),Md=C(F()),Id=C(G()),xd=C(Re());p();var _d=C(F()),wd=C(G());p();var vd=C(Re());p();function yd(t,n){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r={firstDiffLeft:0,firstDiffRight:n.length},o,s;return t.length<n.length?(o=t,s=n):(o=n,s=t),s.indexOf(o)===0?(r.firstDiffLeft=o.length,r.firstDiffRight=0):s.endsWith(o)?(r.firstDiffLeft=0,r.firstDiffRight=o.length):(r=Vy(t,n,e),r.firstDiffLeft+r.firstDiffRight>o.length&&(r.firstDiffRight=o.length-r.firstDiffLeft)),Hy(r,t,n),r}function Hy(t,n,e){if(t.firstDiffLeft>0){var r=t.firstDiffLeft<n.length&&os(n,t.firstDiffLeft),o=t.firstDiffLeft<e.length&&os(e,t.firstDiffLeft);(r||o)&&(t.firstDiffLeft-=1)}if(t.firstDiffRight>1){var s=t.firstDiffRight<n.length&&os(n,n.length-t.firstDiffRight),a=t.firstDiffRight<e.length&&os(e,e.length-t.firstDiffRight);(s||a)&&(t.firstDiffRight-=1)}}function Vy(t,n){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r={firstDiffLeft:0,firstDiffRight:n.length},o;for(o=0;o<t.length&&o<n.length;o+=1){var s=t.charCodeAt(o),a=n.charCodeAt(o);if(s!==a&&!(is(s,e)&&is(a,e)))break}for(r.firstDiffLeft=o,o=0;o<t.length&&o<n.length;o+=1){var u=t.charCodeAt(t.length-o-1),l=n.charCodeAt(n.length-o-1);if(u!==l&&!(is(u,e)&&is(l,e)))break}return r.firstDiffRight=o,r}function is(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;switch(t){case 12288:case 8197:case 32:case 11:case 9:case 160:return!0;case 13:case 10:case 65532:return!n}return!1}function os(t,n){return t.charCodeAt(n)>=56320&&t.charCodeAt(n)<=57343}var mr=C(zo()),hr=/[ \u00a0\u2000-\u200a\u202f\u205f\u3000\t]/g,xi=/[.!?]/g;function Cd(t,n){var e=[],r=kd(t,n);return r&&e.push(r),e}function Sd(t,n){var e=[],r=kd(t,n);r&&e.push(r);var o=zy(t,n,r);o&&e.push(o);var s=jy(t,n,r);s&&e.push(s);var a=Jy(t,n,r);a&&e.push(a);var u=Ky(t,n);return u&&e.push(u),e}function kd(t,n){var e=t.content,r=n.content,o=yd(e,r),s=o.firstDiffLeft,a=e.length-o.firstDiffRight,u=r.length-o.firstDiffRight,l=Q.Update,c=void 0;if(e.length!==r.length)a===s?(l=Q.Add,c=e[e.length-1]):u===s&&(l=Q.Delete,c=r[r.length-1]);else if(e===r)return;var f=0,d;switch(l){case Q.Update:f=a-s,d=r.substring(s,u);break;case Q.Add:d=r.substring(s,u);break;case Q.Delete:f=a-s,d=e.substring(s,a);break}var m=Yy(d,c);if(m!==void 0)return new ze({content:l!==Q.Delete?d:void 0,deltaType:l,unit:m,position:s,length:l!==Q.Add?f:0})}function zy(t,n,e){var r,o,s,a,u,l,c=t,f=n;if(!((c==null?void 0:c.ipPosition)===(f==null?void 0:f.ipPosition)&&(c==null?void 0:c.isColdIp)===(f==null?void 0:f.isColdIp))){if((c==null?void 0:c.isColdIp)===(f==null?void 0:f.isColdIp)&&e){if(e.deltaType===Q.Add){if((f==null?void 0:f.ipPosition)===((r=e.position)!==null&&r!==void 0?r:0)+((o=e.length)!==null&&o!==void 0?o:0))return}else if(e.deltaType===Q.Update){if((f==null?void 0:f.ipPosition)===((s=e.position)!==null&&s!==void 0?s:0)+((u=(a=e.content)===null||a===void 0?void 0:a.length)!==null&&u!==void 0?u:0))return}else if(e.deltaType===Q.Delete&&(f==null?void 0:f.ipPosition)===((l=e.position)!==null&&l!==void 0?l:0))return}return new ze({deltaType:Q.CursorUpdate,cursorData:{ipPosition:f==null?void 0:f.ipPosition,isColdIp:f==null?void 0:f.isColdIp}})}}function jy(t,n,e){var r,o,s,a,u,l,c,f=t,d=n;if(((r=d.formattedRanges)===null||r===void 0?void 0:r.length)<=((o=f.formattedRanges)===null||o===void 0?void 0:o.length)){if(e){var m=f.formattedRanges?(0,vd.default)(f.formattedRanges):[],v=Qy(f.formattedRanges,e,e.position),_=v?m.indexOf(v):-1;if(_!==-1&&(e.position+(e.length||0)>v.start+v.length?v.length=e.position+((s=e.content)!==null&&s!==void 0?s:"").length-v.start:v.length+=((a=e.content)!==null&&a!==void 0?a:"").length-(e.length||0),m[_]=v),m.length>0){for(var S of m.slice(_+1))S.start<e.position||(e.position+(e.length||0)>S.start?(S.length=S.start+S.length-(e.position+(e.length||0)),S.start=e.position+((u=e.content)!==null&&u!==void 0?u:"").length):S.start+=((l=e.content)!==null&&l!==void 0?l:"").length-(e.length||0));m=m.filter(function(k){return k.length>0})}var M=(c=d==null?void 0:d.formattedRanges)!==null&&c!==void 0?c:[];if((0,mr.default)(m,M)||m.length===0&&M.length===0)return}else if((0,mr.default)(f==null?void 0:f.formattedRanges,d==null?void 0:d.formattedRanges))return}return new ze({deltaType:Q.FormattingUpdate,formattedRanges:d==null?void 0:d.formattedRanges})}function Jy(t,n,e){var r,o=t,s=n;if(!(!(o!=null&&o.attributionRanges)&&!s.attributionRanges&&!(!((r=e==null?void 0:e.attributionData)===null||r===void 0)&&r.ranges)||(0,mr.default)(o==null?void 0:o.attributionRanges,s==null?void 0:s.attributionRanges))){if(o.attributionRanges&&s.attributionRanges){var a=[],u=function(f){o.attributionRanges.some(function(d){return(0,mr.default)(d,f)})||a.push(f)};for(var l of s.attributionRanges)u(l);return a.length===0?void 0:new ze({deltaType:Q.AttributionUpdate,attributionData:{ranges:a}})}return new ze({deltaType:Q.AttributionUpdate,attributionData:{ranges:s==null?void 0:s.attributionRanges}})}}function Ky(t,n){var e=t,r=n,o,s={},a=!1;for(o in r)["ipPosition","isColdIp","content","formattedRanges","attributionRanges"].indexOf(o)===-1&&((0,mr.default)(r[o],e[o])||(a=!0,s[o]=r[o]));if(a)return new ze({deltaType:Q.OtherNonContentUpdate,otherNonContentData:s})}function Qy(t,n,e){if(t){if(n.deltaType===Q.Add){var r=t.find(function(s){return s.start===e&&s.length===0});if(r)return r;e=Math.max(e-1,0)}var o=t.find(function(s){return s.length===0?s.start===e:s.start<=e&&e<s.start+s.length});return o}}function Yy(t,n){var e=Array.from(t.matchAll(hr));if(hr.lastIndex=0,e.length===0)return me.Chars;if(e.length===1){if(e[0].index===0)return n&&xi.test(n)?me.Sentence:n&&!hr.test(n)?me.Word:me.Chars;if(e[0].index+1===t.length)return xi.test(t[e[0].index-1])?me.Sentence:hr.test(t[e[0].index-1])?me.Chars:me.Word;if(t[e[0].index-1]){var r=t[e[0].index-1];if(xi.test(r))return me.Sentence;if(hr.test(r))return me.Chars}return me.Word}var o=Array.from(t.matchAll(xi));if(xi.lastIndex=0,o.length===0)return me.PartialSentence;if(o.length>1)return me.Paragraph;if(o[0].index+1<=t.length)return hr.test(t[o[0].index+1])?me.Sentence:me.Paragraph}var Td=(function(){function t(){(0,_d.default)(this,t),this.deltaBuilderHandlers=new Map,this.registerDeltaBuilderHandler(Qe.getTypeName(),Cd),this.registerDeltaBuilderHandler(Fe.getTypeName(),Sd)}return(0,wd.default)(t,[{key:"registerDeltaBuilderHandler",value:function(e,r){this.deltaBuilderHandlers.set(e,r)}},{key:"executeDeltaBuilderHandler",value:function(e,r,o){var s=this.deltaBuilderHandlers.get(e);return s?s(r,o):[]}}])})();var cu="\\",lu=function(n,e){return e?fu([].concat((0,xd.default)(e),[n])):n},fu=function(n){return n.join(cu)},Ad=(function(){function t(n){var e=this;(0,Md.default)(this,t),this.createTextTileDeltasFromItem=function(r,o){var s,a=new b({operationName:"CreateTextTileDeltaFromItem",success:!0}).start();try{if(!r){a.success=!1,a.resultDescription="Unable to create text tile delta, parent item is undefined",h.info(524883085,y.CoreDefault,a.stop());return}if(!r.body){a.success=!1,a.resultDescription="Unable to create text tile delta, parent item has undefined body",h.info(524883086,y.CoreDefault,a.stop());return}var u=r.body;if(!Qe.typeGuard(u)){a.success=!1,a.resultDescription=`Unable to create text tile delta, parent item body is not proper type: expected ${Qe.getTypeName()}, received ${g.getTypeNameFor(u)}`;return}var l=lu(r.id,o),c=(s=e.lastSeenTileByTileId.get(l))!==null&&s!==void 0?s:new Qe({content:""}),f=e.createDeltas(c,u);return!f||f.length===0?(a.dimension0="0",a.resultDescription="No delta differences found"):(a.dimension0=f.length.toString(),e.lastSeenTileByTileId.set(l,u)),h.info(524883087,y.CoreDefault,a.stop()),f}catch(d){a.success=!1,a.resultDescription=`Error creating text tile delta: ${d}`,h.info(524883088,y.CoreDefault,a.stop());return}},this.lastSeenTileByTileId=n!=null?n:new Map,this.deltaBuilder=new Td}return(0,Id.default)(t,[{key:"addItemToLocalMap",value:function(e,r){var o=lu(e.id,r),s=e.body;Qe.typeGuard(s)&&!this.lastSeenTileByTileId.has(o)&&this.lastSeenTileByTileId.set(o,s)}},{key:"deleteItemFromLocalMap",value:function(e,r){var o=lu(e.id,r);this.lastSeenTileByTileId.has(o)&&this.lastSeenTileByTileId.delete(o)}},{key:"moveItemsInLocalMap",value:function(e,r,o){var s=new Set(o),a=fu(r),u=fu(e),l=[],c=function(w,P){return w.length>P.length?w.substring(P.length+cu.length).split(cu)[0]:void 0};for(var f of this.lastSeenTileByTileId){var d=(0,bd.default)(f,2),m=d[0],v=d[1];if(m.startsWith(a)){var _=c(m,a);if(_===void 0||s.has(_)){var S=m.replace(a,u);l.push({item:v,newPathKey:S,prevPathKey:m})}}}for(var M of l)this.lastSeenTileByTileId.delete(M.prevPathKey),this.lastSeenTileByTileId.set(M.newPathKey,M.item)}},{key:"createDeltas",value:function(e,r){return this.deltaBuilder.executeDeltaBuilderHandler(g.getTypeNameFor(r),e,r)}}])})();p();var Ai=function(n,e){var r=[];for(var o of n!=null?n:[])if(!(e!==void 0&&e!==o.cardinality))for(var s of o.contextTypes)r.push([s,o.cardinality,o.producerWaitPolicy]);return r};p();var Rd=C(F()),Dd=C(G());var du=(function(){function t(n,e,r){(0,Rd.default)(this,t),this.sendMessage=n,this.annotationType=e,this.options=r,this.token=`${e}-${t.nextActivationResultBatchId++}`}return(0,Dd.default)(t,[{key:"activate",value:function(e,r,o){var s=this;return new Promise(function(a,u){s.sendMessage(new Kt({annotationType:s.annotationType,token:s.token,config:s.options?s.options.config:void 0,ignoreExistingAnnotations:e,sendStateUpdates:s.options?!!s.options.stateUpdateCallback:void 0,forceReturnCachedAnnotations:s.options?s.options.forceReturnCachedAnnotations:void 0,returnAnnotationDoesNotExist:!0,sendApologies:o}),function(l,c){l?u(new Error(l.error)):(Qt.typeGuard(c)&&(s.annotationDoesNotExistOnService=c.annotationNotExists),a({token:s.token}))},r)})}},{key:"release",value:function(){var e=this;return new Promise(function(r,o){if(e.annotationDoesNotExistOnService){r(!1);return}e.sendMessage(new Yt({token:e.token}),function(s,a){s?o(new Error(s.error)):r(a.lastRelease)})})}}])})();du.nextActivationResultBatchId=1;p();var Ld=C(Uo());p();p();var Xy=function(){if(typeof TextEncoder=="undefined"||typeof TextDecoder=="undefined"){Nd();var n={AugLoopTextEncoder:TextEncoder,AugLoopTextDecoder:TextDecoder};return TextEncoder=void 0,TextDecoder=void 0,n}else return{AugLoopTextEncoder:TextEncoder,AugLoopTextDecoder:TextDecoder}},Od=Xy(),gu=Od.AugLoopTextEncoder,pu=Od.AugLoopTextDecoder;p();var mu=C(es()),Bd=C(F()),Ed=C(G());var hu=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},xt=(function(){function t(){(0,Bd.default)(this,t)}return(0,Ed.default)(t,null,[{key:"extractFragments",value:function(e){if(e[0]!==t.IDENTIFIERBYTE)throw new Error("Invalid Binary: Incorrect Identifier");for(var r=1,o=[],s=new DataView(e.buffer,e.byteOffset,e.byteLength);r<e.byteLength;){if(r+4>e.byteLength)throw new Error("Invalid Binary: Error reading fragment length");var a=s.getUint32(r);if(r+a+4>e.byteLength)throw new Error("Invalid Binary: Fragment out of range");typeof Buffer!="undefined"&&Buffer.from?o.push(Buffer.from(e.buffer,e.byteOffset+r+4,a)):o.push(new Uint8Array(e.buffer,e.byteOffset+r+4,a)),r+=4+a}if(o.length<1)throw new Error("Invalid Binary: No fragments found");return o}},{key:"deserialize",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(u){return u},o=t.extractFragments(e),s=t.textDecoder.decode(o[0]),a=function(l,c){if(typeof c=="string"){if(c.substring(0,t.BINARYKEYWORD.length)===t.BINARYKEYWORD){var f=parseInt(c.substring(t.BINARYKEYWORD.length),10);if(typeof f!="number"||f>=o.length-1)throw new Error("Invalid Binary: Binary index out of range");return r(o[f+1])}else if(c.substring(0,t.ESCAPEKEYWORD.length)===t.ESCAPEKEYWORD)return c.substring(t.ESCAPEKEYWORD.length)}return c};return JSON.parse(s,a)}},{key:"deserializeAsync",value:function(e){return hu(this,arguments,void 0,function(r){var o=this,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(a){return hu(o,void 0,void 0,function*(){return a})};return(function*(){var a=t.extractFragments(r),u=t.textDecoder.decode(a[0]),l=[],c=function(S){var M=(0,mu.default)((0,mu.default)({},d,!0),"value",void 0);return S.then(function(k){M.value=k}),M},f=function(S,M){if(typeof M=="string"){if(M.startsWith(t.BINARYKEYWORD)){var k=parseInt(M.substring(t.BINARYKEYWORD.length),10);if(typeof k!="number"||k>=a.length-1)throw new Error("Invalid Binary: Binary index out of range");var w=s(a[k+1]);return l.push(w),c(w)}else if(M.startsWith(t.ESCAPEKEYWORD))return M.substring(t.ESCAPEKEYWORD.length)}return M},d=Symbol("placeholder"),m=function(S){if(Array.isArray(S)){for(var M=0;M<S.length;M++)S[M]=m(S[M]);return S}else if(S!==null&&typeof S=="object"){if(S[d])return S.value;for(var k of Object.keys(S))S[k]=m(S[k]);return S}else return S},v=JSON.parse(u,f);return yield Promise.all(l),v=yield m(v),v})()})}},{key:"serializeInternal",value:function(e){var r=[void 0],o=function(m,v){return ArrayBuffer.isView(v)?(r.push(v),`${t.BINARYKEYWORD}${r.length-2}`):v&&v.type==="Buffer"&&Array.isArray(v.data)?(r.push(new Uint8Array(v.data)),`${t.BINARYKEYWORD}${r.length-2}`):typeof v=="string"&&v.substring(0,t.ESCAPEKEYWORD.length)===t.ESCAPEKEYWORD?t.ESCAPEKEYWORD+v:v},s=JSON.stringify(e,o);r[0]=t.textEncoder.encode(s);var a=r.reduce(function(d,m){return d+4+m.byteLength},0),u=new Uint8Array(a+1);u[0]=t.IDENTIFIERBYTE;var l=1,c=new DataView(u.buffer,u.byteOffset,u.byteLength);for(var f of r)c.setUint32(l,f.byteLength),u.set(f,l+4),l+=4+f.byteLength;return u}},{key:"serialize",value:function(e){return t.serializeInternal(e)}},{key:"serializeAsync",value:function(e){return hu(this,void 0,void 0,function*(){return new Promise(function(r,o){try{r(t.serializeInternal(e))}catch(s){o(s)}})})}}])})();xt.IDENTIFIERBYTE=3;xt.BINARYKEYWORD=":b";xt.ESCAPEKEYWORD=":";xt.textDecoder=new pu;xt.textEncoder=new gu;var Zy=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})};function yu(t,n){return Zy(this,void 0,void 0,function*(){var e=t.authToken,r=t.origin,o=t.sessionUrl,s=n.body,a=n.cv,u=n.method,l=n.requestUrl,c=yield(0,Ld.fetch)(l||o,{method:u,headers:Object.assign({Authorization:`Bearer ${e}`,"x-origin":r,"x-correlationid":a},n.headers),body:s});if(c.status!==200)throw new Error(`Unexpected status code: ${c.status}`);return c})}var vu=function(n,e){e?(n.resultDescription=e,n.success=!1,h.error(507646878,y.CoreDefault,n.stop())):h.info(507646877,y.CoreDefault,n.stop())};function Cu(t,n,e,r){var o;yu(t,{headers:{"Content-Type":"application/jsond"},body:xt.serialize(n),cv:e.cv,method:"POST"}).then(function(s){return s.json()}).catch(function(s){o=new ee({messageId:n.messageId,error:s.message})}).then(function(s){vu(e,o?o.error:void 0),r(o,s)})}function Su(t,n,e,r){var o;yu(t,{headers:{"Content-Type":"application/octet-stream"},body:n,cv:e.cv,method:"POST",requestUrl:`${t.sessionUrl}/blob`}).then(function(s){return s.json()}).catch(function(s){o=new ee({error:s.message})}).then(function(s){vu(e,o?o.error:void 0),r(o,s)})}function ku(t,n,e,r){var o=t.sessionUrl,s;yu(t,{cv:r.cv,method:"GET",requestUrl:n.refType===wn.AlCodedLocation?`${o}/blob/${n.value}`:n.value}).then(function(a){return a.arrayBuffer()}).then(function(a){return new Uint8Array(a)}).catch(function(a){s=a}).then(function(a){vu(r,s?s.message:void 0),e(s,a)})}p();var Wd=C(F()),Fd=C(G()),Gd=C(ut()),_u=C(Je()),$d=C(lt());var qd=C(Zo());function ev(t,n,e){return n=(0,_u.default)(n),(0,Gd.default)(t,Ud()?Reflect.construct(n,e||[],(0,_u.default)(t).constructor):n.apply(t,e))}function Ud(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(Ud=function(){return!!t})()}var Ri=(function(t){function n(){return(0,Wd.default)(this,n),ev(this,n,arguments)}return(0,$d.default)(n,t),(0,Fd.default)(n,[{key:"init",value:function(){return Promise.resolve()}},{key:"sendMessage",value:function(r,o,s){}},{key:"onMessage",value:function(r,o){}},{key:"forceReconnect",value:function(){return Promise.resolve()}},{key:"closeSession",value:function(){}},{key:"sendBytes",value:function(r){}},{key:"getCorrelationVector",value:function(){return new Ke}},{key:"getNetworkWorkerManager",value:function(){}},{key:"setState",value:function(r){}}])})(qd.EventEmitter);p();var wu=function(n){var e,r;if(Oe.typeGuard(n)){var o=n.ops.filter(function(u){return g.matchesTypesFor(u,["AugLoop_Core_AddOperation"])});for(var s of o)for(var a of s.items)if(a.body&&(!((e=a.body)===null||e===void 0)&&e.isFirstUserPerceivedResponse))return!0}else if(zt.typeGuard(n))return(r=n.content)===null||r===void 0?void 0:r.some(function(u){var l;return(l=u.body)===null||l===void 0?void 0:l.isFirstUserPerceivedResponse});return!1},tv=function(n){var e=n.filter(function(s){return g.matchesTypesFor(s,["AugLoop_Signals_SignalOperation"])});for(var r of e)for(var o of r.items)if(o.body&&g.matchesTypesFor(o.body,["AugLoop_CopilotChatHistory_CopilotChatHistorySignal","AugLoop_Copilot_CopilotInputSignal"]))return o},Hd=function(n,e,r){var o,s,a,u;r.resultSignature=e,r.resourceId=`${(o=n.sourceInfo)===null||o===void 0?void 0:o.featureId}-${(s=n.sourceInfo)===null||s===void 0?void 0:s.entryPoint}`,r.cv=n.cv,r.setDataFields({AnnotationTypes:(a=n.annotationTypes)===null||a===void 0?void 0:a.toString(),MaxDelayMs:(u=n.maxDelayMs)===null||u===void 0?void 0:u.toString()}),h.info(505455200,y.CoreDefault,r.stop())},Tu=function(n,e,r,o,s){var a=tv(n);a&&(s.setDataField("CurrentTimestamp",r),s.cv=e||"",s.resultSignature=o,s.resourceId=g.getTypeNameFor(a.body),a.contextId&&s.setDataField("ContextId",a.contextId),a.sourceTimestamp&&s.setDataField("SourceTimestamp",a.sourceTimestamp),h.info(505983429,y.CoreDefault,s.stop()))},Vd=function(n,e,r,o){Tu(n.ops,n.cv,e,r,o)},ss=function(n,e,r,o,s){o&&!wu(n)||(s.setDataField("CurrentTimestamp",e),s.cv=n.cv,s.resultSignature=r,s.resourceId=n.annotationType,s.dimension1=`AreApologies: ${n.areApologies}`,h.info(505983428,y.CoreDefault,s.stop()))};p();var nv=C(Re()),bu=C(F()),Mu=C(G());var zd=C(zo()),Y=(function(){function t(){(0,bu.default)(this,t)}return(0,Mu.default)(t,null,[{key:"createHealthCheckRequest",value:function(e){return{payload:{},payloadSchema:{category:yt.Schema,schema:{name:"HealthCheckRequest"}},requestedSchema:{category:yt.Schema,schema:{name:"HealthCheckResponse"}},clientMetadata:Object.assign(Object.assign({},e),{flights:""})}}},{key:"isFeatureEnabled",value:function(e,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"None";return e&&e.isFeatureEnabled?e.isFeatureEnabled("Microsoft.Office.AugLoop."+r,s).catch(function(){return Promise.resolve(o)}):Promise.resolve(o)}},{key:"isChangeGateEnabled",value:function(e,r){return e&&e.isChangeGateEnabled?e.isChangeGateEnabled(r):Promise.resolve(!1)}},{key:"convertWebSocketUrlToHttp",value:function(e){return this.convertUrl(e,!1)}},{key:"convertServiceUrlToWebSocket",value:function(e){return this.convertUrl(e,!0)}},{key:"convertUrl",value:function(e,r){if(!e)return e;var o=e.split(":"),s=o[0].toLowerCase();return s.indexOf(r?"http":"ws")==0?(s=r?s.replace("http","ws"):s.replace("ws","http"),o[0]=s,o.join(":")):e}},{key:"deepEquals",value:function(e,r){return(0,zd.default)(e,r)}},{key:"collectTelemetry",value:function(e,r,o,s,a,u){var l,c,f,d;e.start(),e.resultSignature=s!=null?s:"",e.resultDescription=a!=null?a:"",e.success=o,u?(e.dimension0=(l=u[0])!==null&&l!==void 0?l:"",e.dimension1=(c=u[1])!==null&&c!==void 0?c:"",e.dimension2=(f=u[2])!==null&&f!==void 0?f:"",e.dimension3=(d=u[3])!==null&&d!==void 0?d:""):(e.dimension0="",e.dimension1="",e.dimension2="",e.dimension3=""),r.log(function(){return h.info(508367457,y.CoreDefault,e.stop())})}}])})();Y.getCurrentTimeMs=function(){return Date.now?Date.now():new Date().getTime()};var jn=(function(){function t(n){(0,bu.default)(this,t),this.maxNumberOfLogs=40,this.numberOfLogs=0,this.id=n}return(0,Mu.default)(t,[{key:"log",value:function(e){if(this.numberOfLogs<this.maxNumberOfLogs&&(this.numberOfLogs++,e(),this.numberOfLogs===this.maxNumberOfLogs)){var r=new b({operationName:"OnLastLog",success:!0,resourceId:this.id,resultDescription:`Limit for number of logs for id: ${this.id} reached - all next logs will be dropped`});h.warn(572838107,y.CoreDefault,r)}}}])})(),bM=[g.getTypeName(),st.getTypeName(),sn.getTypeName()];var Iu=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return Number.isFinite(n)?n:e},jd=function(n,e){if(!Array.isArray(e)||e.length===0||We.typeGuard(n)||Bt.typeGuard(n))return!0;for(var r of n.items)if(!r.body||g.matchesTypesFor(r.body,e))return!0;return!1};p();function Di(t){var n;if(!t)return t;try{var e=t;return e=e.replace(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b/g,"[EMAIL]"),e=e.replace(/\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b/g,function(r){var o=r.split(".");return o.every(function(s){return parseInt(s,10)<=255})?"[IP]":r}),e=e.replace(/[A-Za-z]:\\[^<>"|]*?\\(?=\s)/g,"[PATH]"),e=e.replace(/[A-Za-z]:\\[^<>"|]*?(?=\s+[A-Z][a-z]*\s|$)/g,function(r){var o=r.replace(/[.!?,:;)\]}\s]*$/,""),s=o.lastIndexOf("\\");if(s>2){var a=o.substring(s+1);return a?`[PATH]\\${a}`+r.substring(o.length):"[PATH]"+r.substring(o.length)}return"[PATH]"+r.substring(o.length)}),e=e.replace(/[A-Za-z]:\\[^<>"|]*?(?=\s+[a-z])/g,function(r){var o=r.lastIndexOf("\\");if(o>2){var s=r.substring(o+1);return s?`[PATH]\\${s}`:"[PATH]"}return"[PATH]"}),e=e.replace(/[A-Za-z]:\\[^<>"|]*[^<>"|?\s]/g,function(r){var o=r.lastIndexOf("\\");if(o>2){var s=r.substring(o+1);return s?`[PATH]\\${s}`:"[PATH]"}return"[PATH]"}),e=e.replace(/\/[^<>"|?\r\n]+/g,function(r,o,s){var a=s.substring(Math.max(0,o-10),o);if(a.includes("://")||r.length<4||/^\/[a-z0-9]{1,3}$/i.test(r))return r;var u=r,l=r.indexOf(" ");if(l>0){var c=r.substring(l);/^\s+(to|from|in|at|on|by|with|for|and|or|but|the|a|an)\s/i.test(c)&&(u=r.substring(0,l))}if(u.endsWith("/"))return"[PATH]"+r.substring(u.length);var f=u.lastIndexOf("/");if(f>=0){var d=u.substring(f+1);return d?`[PATH]/${d}`+r.substring(u.length):"[PATH]"+r.substring(u.length)}return"[PATH]"+r.substring(u.length)}),e}catch(r){return h.error(503628995,y.WorkflowDefault,"Error occurred while scrubbing sensitive information",{errorType:(n=r==null?void 0:r.constructor)===null||n===void 0?void 0:n.name}),"[SCRUBBING_ERROR]"}}var xu=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},Qn=function(t){return this instanceof Qn?(this.v=t,this):new Qn(t)},rv=function(t,n,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(t,n||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(v){return function(_){return Promise.resolve(_).then(v,d)}}function u(v,_){r[v]&&(o[v]=function(S){return new Promise(function(M,k){s.push([v,S,M,k])>1||l(v,S)})},_&&(o[v]=_(o[v])))}function l(v,_){try{c(r[v](_))}catch(S){m(s[0][3],S)}}function c(v){v.value instanceof Qn?Promise.resolve(v.value.v).then(f,d):m(s[0][2],v)}function f(v){l("next",v)}function d(v){l("throw",v)}function m(v,_){v(_),s.shift(),s.length&&l(s[0][0],s[0][1])}},iv=10,ov=function(n){if(n===Xn.Substrate)return rn.Substrate},qe;(function(t){t[t.LocalWorkflow=0]="LocalWorkflow",t[t.ServerWorkflow=1]="ServerWorkflow",t[t.Submitted=2]="Submitted"})(qe||(qe={}));var Se=function(n,e){e?(n.resultDescription=e,n.success=!1,h.error(509203144,y.CoreDefault,n.stop())):h.info(509203143,y.CoreDefault,n.stop())},Jd=function(n){return!n.items.some(function(e){return e.source&&e.source.indexOf("ThirdParty")===0})},Au=(function(){function t(n){(0,Qd.default)(this,t);var e,r;this.annotationActivationTrackers=new Map,this.annotationCallbacks=new Map,this.apologyCallbacks=new Map,this.annotationResultStates=new Map,this.tokensByAnnotationType=new Map,this.registeredContextTypes=new Set,this.availableContexts=new Map,this.nextSyncSequenceId=1,this.allowSeed=!0,this.allowGroupSeed=!0,this.seedGroupSize=0,this.batchedSeedMessageGroupSize=0,this.hasSessionConnected=!1,this.isSessionClosed=!1,this.serverAuthenticationState=fe.NotAuthenticated,this.sessionCloseCallbacks=new Map,this.connectCallbacks=new Map,this.reconnectCallbacks=new Map,this.disconnectCallbacks=new Map,this.sessionStateCallbackToken=0,this.workflowGraph=new of,this.workflowDefinitionManager=new nf,this.contextIdManager=new cn(Vo.JsClient,this.workflowGraph),this.workflowItemStorage=new Gf(this.workflowDefinitionManager),this.pendingConnectCallbacks=[],this.onAnnotationsSubmittedEnabled=!1,this.reduceBatchOperationsEnabled=!1,this.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled=!1,this.batchMessagesEnabled=!1,this.scrubSensitiveInfoEnabled=!0,this.seedingStatus=pr.NotStarted,this.cachedClaimsChallenge={claimsVersion:0,actionRequired:!1},this.tokenMessageVersion=1,this.hostCallbacks=n.hostCallbacks,this.sessionManager=n.sessionManager,this.batchMessagesEnabled=n.batchMessagesEnabled||!1,this.reduceBatchOperationsEnabled=n.reduceBatchOperationsEnabled||!1,this.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled=n.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled||!1,this.operationBatchConfig=n.batchOptions?this.getOperationBatchConfig(n.batchOptions):void 0,this.extensionConfigs=n.extensionConfigs,this.clientMetadata=n.clientMetadata,this.userContext=n.userContext,this.localWorkflowManager=n.localWorkflowManager,this.annotationResultsProcessor=n.annotationResultsProcessor,this.gateUtils=n.gateUtils,this.localRegisteredWorkflows=n.localRegisteredWorkflows||[],this.enableRemoteExecutionNotification=n.enableRemoteExecutionNotification||!1,this.networkMode=n.networkMode,this.egress=n.egress,this.serverAuthenticationStateChangeCallback=[],this.claimsChallengeCallback=[],this.seedingStatusChangeCallbacks=[],this.onAnnotationsSubmittedEnabled=n.onAnnotationsSubmittedEnabled||!1,this.scrubSensitiveInfoEnabled=(e=n.scrubSensitiveInfoEnabled)!==null&&e!==void 0?e:!0,this.sessionManager.on("sessionClose",this.onSessionClose.bind(this)),this.sessionManager.on("reconnect",this.onReconnect.bind(this)),this.sessionManager.on("connect",this.onConnect.bind(this)),this.sessionManager.on("disconnect",this.onDisconnect.bind(this)),this.sessionManager.on("resetNextSyncSequenceId",this.resetNextSyncSequenceId.bind(this)),this.sessionManager.on("serverAuthenticationStateChange",this.onServerAuthenticationStateChange.bind(this)),this.sessionManager.onMessage(Oe.getTypeName(),this.onAnnotationResultsFromServer.bind(this)),this.sessionManager.onMessage(Si.getTypeName(),this.onAnnotationResultStateMessage.bind(this)),this.sessionManager.onMessage(Ti.getTypeName(),this.onWorkflowExecutionCompleteMessage.bind(this)),this.sessionManager.onMessage(bi.getTypeName(),this.onClaimsChallengeMessage.bind(this)),this.sessionManager.onMessage(On.getTypeName(),this.onSeedingStatusChangeMessage.bind(this)),n.isDeltaGeneratorEnabled&&(this.enableSyncDeltaSending=!n.disableSyncDeltaSending,this.syncDeltaTimeout=(r=n.syncDeltaTimeout)!==null&&r!==void 0?r:700,this.enableDeltaGenerator()),this.setServerAuthenticationStateChangeCallback(this.updateGraphOnAuthStateChange.bind(this))}return(0,Yd.default)(t,[{key:"enabledRemoteExecutionNotification",value:function(){return this.enableRemoteExecutionNotification}},{key:"getSessionReconnectParams",value:function(){if(!this.connectParams)throw new Error("Session has not been established yet.");return{sessionUrl:this.connectParams.sessionUrl,origin:this.connectParams.origin,authToken:this.connectParams.authToken,nextSyncSequenceId:this.nextSyncSequenceId}}},{key:"setNextSequenceId",value:function(e){this.nextSyncSequenceId=e}},{key:"tryGetDocSessionId",value:function(){if(!(!this.clientMetadata||!this.clientMetadata.docSessionId))return this.clientMetadata.docSessionId}},{key:"getSessionStateCallbackToken",value:function(e){var r;return e+"-callback-"+((r=this.tryGetDocSessionId())!==null&&r!==void 0?r:"unknown")+"-"+this.sessionStateCallbackToken++}},{key:"updateGraphOnAuthStateChange",value:function(e){this.tryActivateWorkflows()}},{key:"tryActivateWorkflows",value:function(){var e=this;if(this.enableRemoteExecutionNotification){var r=new b({operationName:"GraphServerWorkflowActivation",success:!0}).setClientMetadata(this.clientMetadata).start(),o=[];this.workflowGraph.getWorkflowNodes().filter(function(s){return s.location===qt.External}).forEach(function(s){e.localWorkflowManager.canActivateWorkflow(s,e)?s.isActivated=!0:(e.localWorkflowManager.deactivateServerWorkflow(s,e),o.push(s.workflow.id))}),r.resultDescription=`deactivated workflows: [${o.join()}]`,h.info(508879493,y.CoreDefault,r.stop())}}},{key:"initialize",value:function(){return xu(this,void 0,void 0,function*(){return this.localWorkflowManager&&this.localWorkflowManager.addSession(this),this.registerLocalWorkflowsWithoutGraphInit(this.localRegisteredWorkflows),yield this.sessionManager.init(this.extensionConfigs,this.hostCallbacks.onInitSession?this.hostCallbacks.onInitSession:void 0,this.egress),this.localWorkflowManager&&this.localWorkflowManager.setTokenCallback(this.getAuthToken.bind(this)),this})}},{key:"isLocalWorkflowRegistered",value:function(e){var r=this.getLocalRegisteredWorkflows();return r.some(function(o){return e===o.id})}},{key:"isConnected",get:function(){return!!this.connectParams}},{key:"hasConnected",get:function(){return this.hasSessionConnected}},{key:"isClosed",get:function(){return this.isSessionClosed}},{key:"getServerAuthenticationState",value:function(){return this.serverAuthenticationState}},{key:"getContextIdManager",value:function(){return this.contextIdManager}},{key:"getWorkflowItemStorage",value:function(){return this.workflowItemStorage}},{key:"getWorkflowDefinition",value:function(e,r){return this.workflowDefinitionManager.getWorkflowDefinition(e,r)}},{key:"registerLocalWorkflows",value:function(e){var r;this.registerLocalWorkflowsWithoutGraphInit(e),!((r=this.gateUtils)===null||r===void 0)&&r.isChangeGateEnabledSync(Du)||this.trySendWorkflowGraphInitMessage()}},{key:"registerLocalWorkflowsWithoutGraphInit",value:function(e){if(e.length&&this.localWorkflowManager)for(var r of e)this.localWorkflowManager.registerLocalWorkflow(r,this)}},{key:"registerLocalWorkflow",value:function(e){this.registerLocalWorkflows([e]);var r=new b({operationName:"SessionRegisterLocalWorkflow",resourceId:e.id,success:!0}).setClientMetadata(this.clientMetadata).start();Se(r)}},{key:"activateAnnotation",value:function(e,r,o){var s,a=new du(this.sendMessageToSession.bind(this),e,r),u=function(f,d){var m=f.get(e);m||(m=new Map,f.set(e,m)),m.set(a.token,d)};r!=null&&r.callback&&u(this.annotationCallbacks,r==null?void 0:r.callback),r!=null&&r.apologyCallback&&u(this.apologyCallbacks,r==null?void 0:r.apologyCallback);var l=(s=this.tokensByAnnotationType.get(e))!==null&&s!==void 0?s:[];return l.indexOf(a.token)===-1&&l.push(a.token),this.tokensByAnnotationType.set(e,l),this.annotationActivationTrackers.set(a.token,a),this.activateAnnotationForTracker(a,{ignoreExistingAnnotations:!1,sendOnlyIfConnected:!1,sendApologies:(r==null?void 0:r.apologyCallback)!==void 0})}},{key:"activateServerRequestResponse",value:function(e,r,o){return xu(this,void 0,void 0,function*(){var s=this,a=function(l,c){var f=function(){var v=new b({operationName:"ServerRequestResponseAnnotationReceived",success:!0}).setClientMetadata(s.clientMetadata).start(),_=d.body;if(!(_!=null&&_.workflowExecutionCorrelation)){var S="Received annotation without workflowExecutionCorrelation";throw Se(v,S),new Error(S)}var M=!1,k=function(P,R){if(M){var B="Final response has already been sent for this annotation";throw Se(v,B),new Error(B)}M=R!==void 0?R:!0;var W=new Mi({workflowExecutionCorrelation:_.workflowExecutionCorrelation,finalResponse:M,content:P}),I=s.submitCustomMessage(W).catch(function(X){throw Se(v,`Error submitting response: ${X.message}`),X});return R&&Se(v),I};r==null||r.onAnnotationCallback(_,k).catch(function(w){Se(v,`Error in onAnnotationCallback: ${w.message}`)})};for(var d of l.items)f()};yield this.activateAnnotation(e,{callback:a},o)})}},{key:"activateAnnotationForTracker",value:function(e,r){var o=new b({operationName:"ActivateAnnotation",resourceId:e.annotationType,success:!0}).setClientMetadata(this.clientMetadata).start();return o.setDataField("StartTimestamp",Date.now()),e.activate(r.ignoreExistingAnnotations,r.sendOnlyIfConnected,r.sendApologies).then(function(s){return o.resultSignature="Ok",o.resultDescription=`Activated annotation ${e.annotationType} with token ${e.token}; sendOnlyIfConnected: ${r.sendOnlyIfConnected}`,Se(o),s}).catch(function(s){throw Se(o,`error on activate annotation type ${e.annotationType}: ${s}; sendOnlyIfConnected: ${r.sendOnlyIfConnected}`),s})}},{key:"updateAnnotationConfig",value:function(e,r){var o=new ki({token:e,config:r});this.sendMessageToSession(o);var s=this.annotationActivationTrackers.get(e);s&&s.options&&(s.options.config=r)}},{key:"releaseAnnotation",value:function(e){var r=this.annotationActivationTrackers.get(e);if(r){this.annotationActivationTrackers.delete(e);var o=function(a){var u=a.get(r.annotationType);u&&(u.delete(e),u.size==0&&a.delete(r.annotationType))};return o(this.annotationCallbacks),o(this.apologyCallbacks),r.release()}return Promise.resolve(!1)}},{key:"setAnnotationState",value:function(e,r,o){var s={state:o};this.submitOperation(new Bt({parentPath:e,items:[{id:r}],M_:s}))}},{key:"setAnnotationMetadata",value:function(e,r,o){this.submitOperation(new Bt({parentPath:e,items:[{id:r}],M_:o}))}},{key:"submitOperation",value:function(e,r){this.submitOperations([e],r)}},{key:"submitOperations",value:function(e,r){var o,s;if(r||(r=this.generateCorrelationId()),Tu(e,r,Date.now(),"SubmitInRuntimeClient",new b({operationName:"AugloopClientPerfTracker",success:!0}).setClientMetadata(this.clientMetadata).start()),this.contextIdManager.applyContextIdOnOperations(e),this.updateWorkflowExecutionStates(e),!this.onAnnotationsSubmittedEnabled){var a=this.partitionAnnotationOperations(e),u=(0,Kn.default)(a,2),l=u[0],c=u[1];this.executeCallbacksOnAnnotationSubmitted(l,r)}var f=e.filter(this.filterOperationsForSession.bind(this)).filter(Jd),d=[];if(this.deltaGenerator){var m=new b({operationName:"ExecuteDeltaGenerator",success:!0}).setClientMetadata(this.clientMetadata).start();for(var v of f)if(Ve.typeGuard(v))d.push.apply(d,(0,Jn.default)(this.createDeltasFromUpdateOperation(v)));else{var _=v;for(var S of _.items)Me.typeGuard(v)?this.deltaGenerator.addItemToLocalMap(S,_.parentPath):St.typeGuard(v)?this.deltaGenerator.deleteItemFromLocalMap(S,_.parentPath):er.typeGuard(v)&&this.deltaGenerator.moveItemsInLocalMap(v.parentPath,v.prevParentPath,(s=(o=v.items)===null||o===void 0?void 0:o.map(function(R){return R.id}))!==null&&s!==void 0?s:[]);d.push(v)}Se(m)}if(this.onAnnotationsSubmittedEnabled){var M=this.partitionAnnotationOperations(d.length?d:f),k=(0,Kn.default)(M,2),w=k[0],P=k[1];this.onAnnotationsSubmitted(w,r),this.submitOperationsToSession(P,r)}else this.submitOperationsToSession(d.length?d:f,r);this.localWorkflowManager&&this.localWorkflowManager.runLocalWorkflows(e,this,!0)}},{key:"submitSeedOperations",value:function(e,r){if(!this.allowSeed)throw new Error("Cannot submit seed operations more than once per session");if(this.networkMode===ce.LocalWorkflowsOnly&&this.localWorkflowManager){this.localWorkflowManager.runLocalWorkflows(e,this);return}r||(r=this.generateCorrelationId()),this.allowSeed=!1,this.allowGroupSeed=!1;var o=this.partitionAnnotationOperations(e),s=(0,Kn.default)(o,2),a=s[0],u=s[1];this.onAnnotationsSubmittedEnabled?this.onAnnotationsSubmitted(a,r):this.executeCallbacksOnAnnotationSubmitted(a,r),this.operationBatchConfig?this.sendSeedMessagesViaBatchManager(this.onAnnotationsSubmittedEnabled?u:e,!0,r):this.sendMessageToSession(new le({cv:r,seq:0,ops:this.onAnnotationsSubmittedEnabled?u:e}))}},{key:"submitSeedGroupOperations",value:function(e,r,o){if(!this.allowGroupSeed)throw new Error("Seed operations are not allowed for this session");if(this.networkMode===ce.LocalWorkflowsOnly&&this.localWorkflowManager){this.localWorkflowManager.runLocalWorkflows(e,this);return}o||(o=this.generateCorrelationId()),r&&(this.allowGroupSeed=!1),this.allowSeed=!1;var s=this.partitionAnnotationOperations(e),a=(0,Kn.default)(s,2),u=a[0],l=a[1];this.executeCallbacksOnAnnotationSubmitted(u,o),this.onAnnotationsSubmittedEnabled?this.onAnnotationsSubmitted(u,o):this.executeCallbacksOnAnnotationSubmitted(u,o),this.operationBatchConfig?this.sendSeedMessagesViaBatchManager(this.onAnnotationsSubmittedEnabled?l:e,!!r,o):(this.seedGroupSize++,this.sendMessageToSession(new le({cv:o,seq:0,ops:this.onAnnotationsSubmittedEnabled?l:e,groupId:"Seed",groupSize:r?this.seedGroupSize:void 0,groupComplete:r||void 0})))}},{key:"submitCustomMessage",value:function(e){var r=this;return new Promise(function(o,s){r.sendMessageToSession(e,function(a,u){a?s(new Error(`${a.error}; for message type: ${g.getTypeNameFor(e)}`)):o(u)})})}},{key:"submitLargeBinaryDataMessage",value:function(e){var r=this;return new Promise(function(o,s){r.sendMessageToSessionPostEndpoint(e,function(a,u){a?s(new Error(a.error)):o(u)})})}},{key:"submitBinaryStreamUploadMessage",value:function(e){var r=this;return new Promise(function(o,s){var a=new b({operationName:"sendBinaryStreamUploadMessage",success:!0}).setClientMetadata(r.clientMetadata).start();if(r.connectParams)Su(r.connectParams,e,a,function(l,c){l?s(new Error(l.error)):o(c)});else{var u=function(l){return Su(l,e,a,function(c,f){c?s(new Error(c.error)):o(f)})}.bind(r);r.pendingConnectCallbacks.push(u)}})}},{key:"requestBinaryDataForBlob",value:function(e){var r=this;return e.data?Promise.resolve(e.data):!e.dataPointer||e.dataPointer.refType===wn.None?Promise.reject(new Error("Blob does not have a data pointer")):new Promise(function(o,s){r.requestBinaryDataFromSessionBlobEndpoint(e.dataPointer,function(a,u){a?s(a):o(u)})})}},{key:"requestCacheDump",value:function(e){if(e)throw new Error("NYI");return this.submitCustomMessage(new Ci)}},{key:"forceReconnect",value:function(e){return this.extensionConfigs=e,this.sessionManager.forceReconnect(e)}},{key:"close",value:function(e){var r,o;if(this.isSessionClosed=!0,this.sessionManager.closeSession(e),this.localWorkflowManager&&this.localWorkflowManager.closeSession(this),this.graphInitMessageTimer&&(clearTimeout(this.graphInitMessageTimer),this.graphInitMessageTimer=void 0),!((r=this.gateUtils)===null||r===void 0)&&r.isChangeGateEnabledSync(as)&&this.syncDeltaTimers){for(var s of this.syncDeltaTimers.values())clearTimeout(s);this.syncDeltaTimers.clear()}!((o=this.gateUtils)===null||o===void 0)&&o.isChangeGateEnabledSync(Ru)||this.batchedOperationsManager&&this.batchedOperationsManager.close()}},{key:"authenticateInteractive",value:function(e){return xu(this,void 0,void 0,function*(){var r=e&&e.forceUserPrompt;if(!(!r&&this.cachedClaimsChallenge.claimsVersion>0&&!this.cachedClaimsChallenge.actionRequired)){var o=yield this.requestAuthTokenInteractive(this.cachedClaimsChallenge,{interactive:!0});if(Xt.typeGuard(o))throw new Error(o.reason)}})}},{key:"getClientMetadata",value:function(){return this.clientMetadata}},{key:"getUserContext",value:function(){return this.userContext}},{key:"setSessionCloseCallback",value:function(e){var r=this.getSessionStateCallbackToken("close");return e&&this.sessionCloseCallbacks.set(r,e),r}},{key:"setConnectCallback",value:function(e){var r=this.getSessionStateCallbackToken("connect");return e&&this.connectCallbacks.set(r,e),r}},{key:"setDisconnectCallback",value:function(e){var r=this.getSessionStateCallbackToken("disconnect");return e&&this.disconnectCallbacks.set(r,e),r}},{key:"setReconnectCallback",value:function(e){var r=this.getSessionStateCallbackToken("reconnect");return e&&this.reconnectCallbacks.set(r,e),r}},{key:"removeSessionStateCallback",value:function(e){function r(o){return o.has(e)?(o.delete(e),!0):!1}return r(this.sessionCloseCallbacks)||r(this.reconnectCallbacks)||r(this.disconnectCallbacks)||r(this.connectCallbacks)}},{key:"setServerAuthenticationStateChangeCallback",value:function(e){this.serverAuthenticationStateChangeCallback.push(e),e(this.serverAuthenticationState)}},{key:"setClaimsChallengeCallback",value:function(e){this.cachedClaimsChallenge.actionRequired&&e(this.cachedClaimsChallenge),this.claimsChallengeCallback.push(e)}},{key:"setSeedingStatusChangeCallback",value:function(e){e(new On({newStatus:this.seedingStatus})),this.seedingStatusChangeCallbacks.push(e)}},{key:"getConnectParams",value:function(){return this.connectParams}},{key:"setOfflineMode",value:function(){this.sessionManager=new Ri}},{key:"onAnnotationResults",value:function(e,r,o){var s=this,a;h.info(508916486,y.CoreDefault,new b({operationName:"OnAnnotationResultsEgress",dimension0:e==null?void 0:e.annotationType,success:!0,cv:e.cv})),o(void 0,new Te),r===qe.LocalWorkflow?this.contextIdManager.applyContextIdOnOperations(e.ops):!((a=this.gateUtils)===null||a===void 0)&&a.isChangeGateEnabledSync(us)&&r===qe.ServerWorkflow&&ss(e,Date.now(),"CallbackInRuntimeClient",!0,new b({operationName:"AugloopClientPerfTracker",success:!0}).setClientMetadata(this.clientMetadata).start()),this.updateWorkflowExecutionStates(e.ops),this.egress&&this.egress(e,function(){}),this.annotationResultsProcessor.process(e,function(u,l){s.applyOperationForContext(u,l,r)},function(u,l){var c,f=Date.now();s.triggerRegisteredAnnotationCallbacks(u,e.annotationType,l,e.areApologies),!(!((c=s.gateUtils)===null||c===void 0)&&c.isChangeGateEnabledSync(us))&&r===qe.ServerWorkflow&&ss(e,f,"CallbackInRuntimeClient",!0,new b({operationName:"AugloopClientPerfTracker",success:!0}).setClientMetadata(s.clientMetadata).start())},function(u){if(r!==qe.ServerWorkflow){var l=u.ops.filter(s.filterOperationsForSession.bind(s)).filter(Jd);s.submitOperationsToSession(l,u.cv)}s.localWorkflowManager&&s.localWorkflowManager.runLocalWorkflows(u.ops,s)})}},{key:"onAnnotationResultStateMessage",value:function(e,r){var o;r(void 0,new Te);for(var s of e.updates){var a=s.annotationType,u=s.state;if(this.tokensByAnnotationType.has(a)){var l=void 0;this.annotationResultStates.has(a)?l=this.annotationResultStates.get(a):u===gr.Idle?l=gr.Pending:l=gr.Idle;for(var c of this.tokensByAnnotationType.get(a)){var f=this.annotationActivationTrackers.get(c);!((o=f.options)===null||o===void 0)&&o.stateUpdateCallback&&f.options.stateUpdateCallback(l,u)}}}}},{key:"submitOperationsToSession",value:function(e,r){var o=this;r||(r=this.generateCorrelationId());var s=e.filter(function(l){return at.typeGuard(l)}),a=e.filter(function(l){return!at.typeGuard(l)});if(s.length>0&&this.sendMessageToSession(new le({cv:r,ops:s})),a.length>0)if(this.operationBatchConfig){if(!this.batchedOperationsManager){var u=void 0;this.batchMessagesEnabled?u=function(c,f,d){if(c.length){var m=new dt;m.messages=[],c.forEach(function(v){m.messages.push(new le({cv:v.cv,seq:o.nextSyncSequenceId++,ops:v.input}))}),o.sendMessageToSession(m,function(v){d(v?new Error(v.error):void 0)})}}:u=function(c,f,d){o.sendMessageToSession(new le({cv:f.cv,seq:o.nextSyncSequenceId++,ops:c}),function(m){d(m?new Error(m.error):void 0)})},this.batchedOperationsManager=new cr(u,this.reduceBatchOperationsEnabled,this.batchMessagesEnabled,void 0,this.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled)}this.batchedOperationsManager.addBatchItem(a,this.operationBatchConfig,{name:"SubmitOperations"},r)}else this.sendMessageToSession(new le({cv:r,seq:this.nextSyncSequenceId++,ops:a}))}},{key:"sendMessageToSession",value:function(e,r){this.sessionManager.sendMessage(e,r),be.typeGuard(e)&&this.close()}},{key:"sendMessageToSessionPostEndpoint",value:function(e,r){var o=new b({operationName:"SendLargeBinaryDataMessage",success:!0,cv:e.cv}).setClientMetadata(this.clientMetadata).start();if(this.connectParams)Cu(this.connectParams,e,o,r);else{var s=function(a){return Cu(a,e,o,r)}.bind(this);this.pendingConnectCallbacks.push(s)}}},{key:"requestBinaryDataFromSessionBlobEndpoint",value:function(e,r){var o=new b({operationName:"RequestBinaryData",success:!0,cv:new Ke().toString()}).setClientMetadata(this.clientMetadata).start();if(this.connectParams)ku(this.connectParams,e,r,o);else{var s=function(a){return ku(a,e,r,o)}.bind(this);this.pendingConnectCallbacks.push(s)}}},{key:"registerContextTypes",value:function(e){for(var r of e)this.activateAnnotation(r),this.registeredContextTypes.add(r)}},{key:"applyOperationForContext",value:function(e,r,o){var s=this,a=g.getTypeNameFor(e);if(!(a!=Me.getTypeName()&&a!=Ot.getTypeName()&&a!=Ve.getTypeName()&&a!=St.getTypeName())){a==Ot.getTypeName()&&(a=Me.getTypeName());var u=Rn(this.resolvePlaceholdersInOperationParentPath(e.parentPath),r),l=ft(u.parentPath);if(a==Me.getTypeName()||a==Ve.getTypeName()){if(!u.body)return;var c=g.getTypeNameFor(u.body);if(!this.registeredContextTypes.has(c))return;var f=this.availableContexts.get(c);f||(f=new Map,this.availableContexts.set(c,f));var d=f.get(o);if(d||(d=[],f.set(o,d)),u.id||this.localWorkflowManager&&(u.id=this.localWorkflowManager.getNextClientAnnotationId()),a==Me.getTypeName())d.filter(function(v){return ft(v.parentPath)==l&&v.id==u.id}).length==0?d.push(u):h.info(540848911,y.CoreDefault,`AddOperation for (${o}, ${u.id}, ${u.source}) can't be applied as the context item with matching path and ID already exists. Use UpdateOperation instead.`);else for(var m=0;m<d.length;m++)if(d[m].id==u.id&&ft(d[m].parentPath)==l)if(d[m].source==u.source){d[m]=u;break}else h.warn(540848912,y.CoreDefault,`UpdateOperation for (${o}, ${u.id}, ${u.source}) can't be applied as the context item with provided path and ID has different source: ${d[m].source}`);else h.warn(540848913,y.CoreDefault,`UpdateOperation for (${o}, ${u.id}, ${u.source}) can't be applied as the context item with matching path and ID was not found. AddOperation should be used instead`)}else if(a==St.getTypeName()){if(!u.id)return;this.availableContexts.forEach(function(v,_){var S=v.get(o);S&&(S=S.filter(function(M){return!(ft(M.parentPath)==l&&M.id==u.id)}),S.length==0?v.delete(o):v.set(o,S),v.size==0?s.availableContexts.delete(_):s.availableContexts.set(_,v))})}}}},{key:"updateWorkflowExecutionStates",value:function(e){if(this.localWorkflowManager){var r=this.enableRemoteExecutionNotification?this.workflowGraph.getWorkflowNodes().map(function(u){return u.workflow}):this.localWorkflowManager.getAllRegisteredWorkflowsFromSession(this);for(var o of e)if(ca.has(g.getTypeNameFor(o)))for(var s of o.items)for(var a of r||[])this.localWorkflowManager.preProcessItemToWorkflow(a,s,this)}}},{key:"resolveRequestedContexts",value:function(e){var r=[];for(var o of Ai(e.requestedContextTypesRules)){var s=(0,Kn.default)(o,3),a=s[0],u=s[1],l=s[2];if(!this.availableContexts.has(a)){if(u==Oo.Required)return[!1,[]];continue}var c=Array.from(this.availableContexts.get(a).values()).reduce(function(f,d){return f.concat(d)},[]);if(c.length==0)throw new Error(`Assert: availableContexts have the entry for ${a} which does not contain any context annotation.`);r.push.apply(r,(0,Jn.default)(c))}return[!0,this.removeDuplicatedContextItems(r)]}},{key:"removeDuplicatedContextItems",value:function(e){return e.filter(function(r,o,s){return s.findIndex(function(a){return Y.deepEquals(a,r)})===o})}},{key:"getContextAnnotations",value:function(e,r,o,s){var a,u,l=o?ft(o):void 0;return(u=(a=this.availableContexts.get(e))===null||a===void 0?void 0:a.get(r))===null||u===void 0?void 0:u.filter(function(c){return(!l||ft(c.parentPath)==l)&&(!s||c.source==s)})}},{key:"onWorkflowDefinitionOverrideMessage",value:function(e){var r=new b({operationName:"WorkflowDefinitionOverride",success:!0}).setClientMetadata(this.clientMetadata).start(),o=function(c){throw Se(r,c),Error(`WorkflowDefinitionOverride: ${c}`)};if(!this.localWorkflowManager){o("Not supported by this local SessionProxy instance.");return}var s=this.localWorkflowManager.getWorkflowDefinitionsByName(this),a=s.get(e.sourceWorkflowId);if(!a){o(`Workflow registration for source workflow '${e.targetWorkflowId}' was not found.`);return}r.resourceId=a.id;var u=s.get(e.targetWorkflowId);if(u){if(!u.allowDefinitionOverride){o(`Workflow '${u.id}' does not allow workflow definition override.`);return}if(!a.definitionOverrideTargetWorkflows||a.definitionOverrideTargetWorkflows.indexOf(u.id)===-1){o(`Workflow '${a.id}' does not allow workflow definition for workflow '${u.id}'.`);return}this.workflowDefinitionManager.mergeWorkflowDefinition(u,e.definition,e.contextId),r.resultDescription=`Updated config for workflow: ${e.targetWorkflowId}, context id: ${e.contextId}`,Se(r)}}},{key:"applyContextIdOnOperations",value:function(e){this.contextIdManager.applyContextIdOnOperations(e)}},{key:"attachToWorkflowGraph",value:function(e){this.addToWorkflowGraph(e),this.attachExecutionTrackerToEachWorkflow()}},{key:"triggerRegisteredAnnotationCallbacks",value:function(e,r,o,s){if(this.callAnnotationCallbacks(e,r,o,s),this.hostCallbacks.onAnnotationResult)try{s?this.hostCallbacks.onApologyResult&&this.hostCallbacks.onApologyResult(e,o):this.hostCallbacks.onAnnotationResult(e,o)}catch(a){h.error(540301151,y.CoreDefault,new b({operationName:"HostCallbackOnAnnotationResultError",dimension0:r,resultDescription:`onAnnotationResult error: ${a}`}))}}},{key:"attachExecutionTrackerToEachWorkflow",value:function(){this.localWorkflowManager&&this.localWorkflowManager.attachExecutionTrackerToEachWorkflow(this.workflowGraph,this,this.onWorkflowExecutionComplete.bind(this))}},{key:"onWorkflowExecutionCompleteMessage",value:function(e,r){r(void 0,new Te),this.localWorkflowManager&&this.localWorkflowManager.onExternalWorkflowExecuted(e.contextId,e.workflowId,this)}},{key:"onWorkflowExecutionComplete",value:function(e,r){}},{key:"enableDeltaGenerator",value:function(){var e,r;this.deltaGenerator=(e=this.deltaGenerator)!==null&&e!==void 0?e:new Ad,this.syncDeltaTimers=(r=this.syncDeltaTimers)!==null&&r!==void 0?r:new Map}},{key:"createDeltasFromUpdateOperation",value:function(e){var r,o,s=[];h.info(523776396,y.CoreDefault,`Calling delta create for UpdateOperation under parent path [${e.parentPath}] (${(r=e.items)===null||r===void 0?void 0:r.length} item(s), first item id: ${((o=e.items)===null||o===void 0?void 0:o.length)>0?e.items[0].id:"(no items)"})`);var a=(0,Jn.default)(e.parentPath);for(var u of e.items){var l=[],c=this.deltaGenerator.createTextTileDeltasFromItem(u,e.parentPath);if(!(c!=null&&c.length)){h.info(523329632,y.CoreDefault,`Failed to create delta on item ${u.id}`);continue}for(var f of c){var d=ni();a=[].concat((0,Jn.default)(e.parentPath),[u.id]);var m={id:d,revId:u.revId,body:f,contextId:u.contextId,source:u.source};l.push(m)}l.length>0&&(s.push(new We({parentPath:a,items:l})),this.enableSyncDeltaSending&&this.setupSyncDeltaAfterDelay(u,a,l))}return s}},{key:"setupSyncDeltaAfterDelay",value:function(e,r,o){var s=this,a,u,l,c=this.syncDeltaTimers.get(e.id);c&&(clearTimeout(c),this.syncDeltaTimers.delete(e.id));var f=o.find(function(k){var w;return((w=k.body)===null||w===void 0?void 0:w.unit)===me.Chars});if(f){var d=f.body,m={content:"",deltaType:Q.Update,length:0,position:((a=d==null?void 0:d.position)!==null&&a!==void 0?a:0)+((l=(u=d==null?void 0:d.content)===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0),unit:me.Sentence},v=Fe.typeGuard(e.body)?new ze(m):new Ut(m),_={id:ni(),revId:e.revId,body:v,contextId:e.contextId,source:e.source},S=new We({parentPath:r,items:[_]}),M=setTimeout(function(k,w){s.submitOperation(k),s.syncDeltaTimers.delete(w)},this.syncDeltaTimeout,S,e.id);this.syncDeltaTimers.set(e.id,M)}}},{key:"addToWorkflowGraph",value:function(e){this.workflowGraph.addWorkflow(la(e))}},{key:"getAnnotations",value:function(e,r){var o,s,a,u=(o=e.cv)!==null&&o!==void 0?o:this.sessionManager.getCorrelationVector().newChild().toString(),l=new b({operationName:"GetAnnotations",success:!0,resultSignature:"GetAnnotationsEntry",resourceId:`${e.sourceInfo.featureId}-${e.sourceInfo.entryPoint}`,cv:u}).setClientMetadata(this.clientMetadata).start();l.setDataFields({AnnotationType:(s=e.annotationType)===null||s===void 0?void 0:s.toString(),MaxDelayMs:(a=e.maxDelayMs)===null||a===void 0?void 0:a.toString()});var c=new Xe({annotationTypes:e.annotationType,transientItems:e.transientItems,configs:e.configs,maxDelayMs:e.maxDelayMs,sourceInfo:e.sourceInfo,caller:ts.Client,tryResolveUpstreamDependencies:e.tryResolveUpstreamDependencies,correlationInfo:{cvString:u},cv:u}),f=[],d;Se(l),this.sendMessageToSession(c,function(S,M){r!=null&&r.IsCancellationRequested||(f.push({error:S,response:M}),d==null||d(!0))});var m=this,v=!1,_=new Promise(function(S,M){r==null||r.onCancel(function(k){v?S():M(new Error(t.requestCancelledError))})});return(0,Kd.default)({},Symbol.asyncIterator,function(){return rv(this,arguments,function*(){for(var M,k,w,P,R,B,W;!v;)try{f.length===0&&(yield Qn(Promise.race([new Promise(function(O){return d=O}),_]))),l.resultSignature="AnnotationReceived";var I=f.shift();if(r!=null&&r.IsCancellationRequested)throw new Error(t.requestCancelledError);v=((M=I.response)===null||M===void 0?void 0:M.finalResponse)||I.error!==void 0,l.setDataField("FinalResponse",v);var X=wu(I.response);l.setDataField("FirstUserPerceivedResponse",X);var Z=void 0,U=void 0,E=void 0;if(I.error)if(m!=null&&m.scrubSensitiveInfoEnabled){var $=Di(I.error.error),K=`ErrorCode: ${I.error.code}, Error: ${$}, Retryable: ${I.error.retryable}`;l.setDataField("ServerError",K),E=$,Z={serviceError:[{code:di.ServerError,error:$,retryable:m==null?void 0:m.canBeRetried(I.error)}]}}else{var ge=`ErrorCode: ${I.error.code}, Error: ${I.error.error}, Retryable: ${I.error.retryable}`;l.setDataField("ServerError",ge),E=I.error.error,Z={serviceError:[{code:di.ServerError,error:I.error.error,retryable:m==null?void 0:m.canBeRetried(I.error)}]}}else if(((w=(k=I.response)===null||k===void 0?void 0:k.errorInfo)===null||w===void 0?void 0:w.length)>0)if(m!=null&&m.scrubSensitiveInfoEnabled){var N=I.response.errorInfo.map(function(O){return Object.assign(Object.assign({},O),{error:Di(O.error)})});l.setDataField("WorkflowErrors",N.map(function(O){return JSON.stringify(O)}).join(`
`)),E="Workflow execution error",Z={serviceError:N}}else{var T=I.response.errorInfo.map(function(O){return`ErrorCode: ${O.code}, Error: ${O.error}, Retryable: ${O.retryable}, ResourceId: ${O.resourceId}`}).join(`
`);l.setDataField("WorkflowErrors",T),E="Workflow execution error",Z={serviceError:I.response.errorInfo}}else l.resultDescription="OK";if(((R=(P=I.response)===null||P===void 0?void 0:P.warningInfo)===null||R===void 0?void 0:R.length)>0)if(m!=null&&m.scrubSensitiveInfoEnabled){var A=I.response.warningInfo.map(function(O){return Object.assign(Object.assign({},O),{error:Di(O.error)})});l.setDataField("WorkflowWarnings",A.map(function(O){return JSON.stringify(O)}).join(`
`)),U={serviceError:A}}else{U={serviceError:I.response.warningInfo};var D=I.response.warningInfo.map(function(O){return`ErrorCode: ${O.code}, Error: ${O.error}, Retryable: ${O.retryable}, ResourceId: ${O.resourceId}`}).join(`
`);l.setDataField("WorkflowWarnings",D)}Se(l,E),yield yield Qn({content:(B=I.response)===null||B===void 0?void 0:B.content,error:Z!=null?Z:void 0,warning:U!=null?U:void 0,finalResponse:(W=I.response)===null||W===void 0?void 0:W.finalResponse})}catch(O){var x=(O==null?void 0:O.message)===t.requestCancelledError?gi.RequestCancelled:gi.Unknown;if(m!=null&&m.scrubSensitiveInfoEnabled){var L=Di(O==null?void 0:O.message);l.setDataField("ClientError",`ErrorCode: ${x}, Error: ${L}`),Se(l,L),yield yield Qn({content:void 0,error:{clientError:{code:x,error:L}}})}else l.setDataField("ClientError",`ErrorCode: ${x}, Error: ${O==null?void 0:O.message}`),Se(l,O==null?void 0:O.message),yield yield Qn({content:void 0,error:{clientError:{code:x,error:O==null?void 0:O.message}}});v=!0;break}})})}},{key:"isHttpFallback",value:function(){var e=this.sessionManager.getNetworkWorkerManager();return!!(e&&e.getInitNetworkMode()===ce.JSWebSockets&&e.getNetworkMode()===ce.HttpFallback)}},{key:"canBeRetried",value:function(e){return(e==null?void 0:e.code)===Ie.TooManyRequests||(e==null?void 0:e.code)===Ie.RequestTimeout||e.error.includes(Ze.ClientDisconnected)}},{key:"getAuthToken",value:function(e,r){var o={Tickets:[]};this.clientMetadata.docSessionId&&(o.DocSessionId=this.clientMetadata.docSessionId);var s=ov(e);s&&(o.TokenType=s),this.hostCallbacks.requestAuthToken(o).then(function(a){var u;if(!a)throw new Error("Missing AuthTokenResponse from requestAuthToken");if(!a.Token)throw new Error("Missing Token from requestAuthToken");r(void 0,a.Token,{returnedTokenType:e,timeToLiveSec:(u=a.TokenProperties)===null||u===void 0?void 0:u.timeToLiveSec})}).catch(function(a){r(a)})}},{key:"resetNextSyncSequenceId",value:function(){this.nextSyncSequenceId=1}},{key:"onReconnect",value:function(){var e=this;if(this.annotationActivationTrackers.forEach(function(r){var o;e.activateAnnotationForTracker(r,{ignoreExistingAnnotations:!0,sendOnlyIfConnected:!0,sendApologies:((o=r.options)===null||o===void 0?void 0:o.apologyCallback)!==void 0}).catch(function(){})}),this.reconnectCallbacks.forEach(function(r,o){r()}),!this.connectParams)throw new Error("Expected onConnect before onReconnect")}},{key:"onSessionClose",value:function(e){var r;if(this.isSessionClosed=!0,this.connectParams=void 0,this.sessionCloseCallbacks.forEach(function(s,a){s(e)}),!((r=this.gateUtils)===null||r===void 0)&&r.isChangeGateEnabledSync(as)&&(this.graphInitMessageTimer&&(clearTimeout(this.graphInitMessageTimer),this.graphInitMessageTimer=void 0),this.syncDeltaTimers)){for(var o of this.syncDeltaTimers.values())clearTimeout(o);this.syncDeltaTimers.clear()}}},{key:"onConnect",value:function(e,r,o,s,a,u,l,c){var f=new b({operationName:"OnConnect",success:!0}).setClientMetadata(this.clientMetadata).start();f.setDataField("HasSessionConnected",this.hasSessionConnected),f.setDataField("IsSeedingRequired",e),f.setDataField("SeedingStatus",this.seedingStatus);var d=!1;e&&(this.hasSessionConnected&&(this.allowSeed=!0,this.allowGroupSeed=!0,d=this.changeSeedingStatus(pr.NotStarted,"ReconnectReset",!1),this.seedGroupSize=0,this.batchedSeedMessageGroupSize=0,this.seedBatchedOperationsManager&&(this.seedBatchedOperationsManager.removeAllBatchedItems(),this.seedBatchedOperationsManager=void 0),this.batchedOperationsManager&&(this.batchedOperationsManager.removeAllBatchedItems(),this.batchedOperationsManager=void 0)),this.cachedClaimsChallenge=Object.assign(Object.assign({},this.cachedClaimsChallenge),{claimsVersion:0})),this.enableRemoteExecutionNotification&&!this.hasSessionConnected&&this.addDownstreamWorkflowsIntoClientGraph(u),this.connectParams={isSeedingRequired:e,sessionUrl:r,origin:o,authToken:s,routingSessionKey:l,blobFileId:c},this.hasSessionConnected=!0,this.tryActivateWorkflows();for(var m of this.pendingConnectCallbacks)m(this.connectParams);this.connectCallbacks.forEach(function(v,_){v(e,r,o,s,l,c)}),d&&this.triggerSeedingStatusChangeCallbacks(),this.serverInputTypes=a,Se(f)}},{key:"onDisconnect",value:function(e){this.connectParams=void 0,this.disconnectCallbacks.forEach(function(r,o){r(e)})}},{key:"onSeedingStatusChangeMessage",value:function(e,r){r(void 0,new Te),this.changeSeedingStatus(e.newStatus,"SeedingStatusChangeMessage")}},{key:"changeSeedingStatus",value:function(e,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=new b({operationName:"SeedingStatusChange",success:!0}).setClientMetadata(this.clientMetadata).start();return s.setDataField("Status",pr[e]),s.setDataField("Reason",r),Se(s),this.seedingStatus==e?!1:(this.seedingStatus=e,o&&this.triggerSeedingStatusChangeCallbacks(),!0)}},{key:"triggerSeedingStatusChangeCallbacks",value:function(){var e=this;this.seedingStatusChangeCallbacks.forEach(function(r){r(new On({newStatus:e.seedingStatus}))})}},{key:"onServerAuthenticationStateChange",value:function(e){if(e!=this.serverAuthenticationState){if(this.serverAuthenticationState==fe.Authenticated&&e==fe.Pending)return;var r=new b({operationName:"ServerAuthStateChange",dimension0:fe[e],dimension1:fe[this.serverAuthenticationState],success:!0}).setClientMetadata(this.clientMetadata).start();r.resultDescription=`Changing Server Authentication State newState: ${fe[e]}, previousState: ${fe[this.serverAuthenticationState]}`,Se(r),this.serverAuthenticationState=e;for(var o of this.serverAuthenticationStateChangeCallback)o(this.serverAuthenticationState)}}},{key:"callAnnotationCallbacks",value:function(e,r,o,s){if(!(this.annotationCallbacks.size===0&&this.apologyCallbacks.size===0)){var a=s?this.apologyCallbacks.get(r):this.annotationCallbacks.get(r);a&&a.forEach(function(u){u(e,o)})}}},{key:"getOperationBatchConfig",value:function(e){var r=function(){return"operations"},o=void 0;this.batchMessagesEnabled?o=function(u){return{input:u,demultiplex:function(){return[[]]}}}:o=function(u){return{input:u.filter(function(l){return l.length}).reduce(function(l,c){return l.concat(c)},[]),demultiplex:function(){return[[]]}}};var s=function(u){if(!(u.length<=1))return{inputs:u.reduce(function(l,c){return l.push([c]),l},[]),join:function(){return[]}}};return{delayMs:e.delayMs,delayMsMax:e.delayMsMax,maxInputSize:e.maxInputSize,estimateSize:Ho,groupingKeyExtractor:r,multiplex:o,split:s}}},{key:"sendSeedMessagesViaBatchManager",value:function(e,r,o){var s=this;if(!this.seedBatchedOperationsManager){var a=void 0;this.batchMessagesEnabled?a=function(l,c,f){if(s.batchedSeedMessageGroupSize+=l.length,l.length){var d=new dt;d.messages=[],l.forEach(function(m){d.messages.push(new le({cv:m.cv,seq:0,ops:m.input,groupId:"Seed",groupSize:c.groupComplete?s.batchedSeedMessageGroupSize:void 0,groupComplete:c.groupComplete?c.groupComplete:void 0}))}),s.sendMessageToSession(d,function(m){f(m?new Error(m.error):void 0)})}}:a=function(l,c,f){s.seedGroupSize++,s.sendMessageToSession(new le({cv:c.cv,seq:0,ops:l,groupId:"Seed",groupSize:c.groupComplete?s.seedGroupSize:void 0,groupComplete:c.groupComplete?c.groupComplete:void 0}),function(d){f(d?new Error(d.error):void 0)})},this.seedBatchedOperationsManager=new cr(a,this.reduceBatchOperationsEnabled,this.batchMessagesEnabled,void 0,this.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled)}this.seedBatchedOperationsManager.addBatchItem(e,this.operationBatchConfig,{name:"SubmitSeedOperations"},o,r)}},{key:"onAnnotationResultsFromServer",value:function(e,r){ss(e,Date.now(),"ReceiveFromNetwork",!0,new b({operationName:"AugloopClientPerfTracker",success:!0}).setClientMetadata(this.clientMetadata).start()),this.onAnnotationResults(e,qe.ServerWorkflow,r)}},{key:"getLocalRegisteredWorkflows",value:function(){return this.localWorkflowManager?this.localWorkflowManager.getAllRegisteredWorkflowsFromSession(this).map(function(e){return la(e)}):[]}},{key:"sendWorkflowGraphInitMessage",value:function(){var e=this,r=this.getLocalRegisteredWorkflows(),o=new b({operationName:"WorkflowGraphInit",success:!0}).setClientMetadata(this.clientMetadata).start(),s=new wi({upstreamRuntimeWorkflows:r});this.sendMessageToSession(s,function(a,u){if(a){Se(o,a.error);return}o.resultDescription=`local workflows: ${r.map(function(l){return l.id})}, remote workflows: ${u.downstreamRuntimeWorkflows.map(function(l){return l.id})}`,Se(o),e.onWorkflowGraphInitResponse(u)})}},{key:"trySendWorkflowGraphInitMessage",value:function(){var e=this;!this.graphInitMessageTimer&&this.enableRemoteExecutionNotification&&(this.graphInitMessageTimer=setTimeout(function(){e.graphInitMessageTimer=void 0,e.sendWorkflowGraphInitMessage()},iv))}},{key:"onWorkflowGraphInitResponse",value:function(e){this.addDownstreamWorkflowsIntoClientGraph(e.downstreamRuntimeWorkflows),this.tryActivateWorkflows()}},{key:"addDownstreamWorkflowsIntoClientGraph",value:function(e){this.workflowGraph.removeWorkflows(!0);for(var r of e||[])this.workflowGraph.addWorkflow(r,!0);this.attachExecutionTrackerToEachWorkflow()}},{key:"resolvePlaceholdersInOperationParentPath",value:function(e){var r=e;return r.length==3&&r[0]=="session"&&r[1]=="user"&&r[2].startsWith("user_")&&(h.info(540848914,y.CoreDefault,`Replacing user context placeholder for: ${ft(e)}.`),r=["session","#userContext#"]),r.length==3&&r[0]=="session"&&r[1]=="user"&&r[2].startsWith("tenant_")&&(h.info(540848915,y.CoreDefault,`Replacing tenant context placeholder for: ${ft(e)}.`),r=["session","#tenantContext#"]),r}},{key:"filterOperationsForSession",value:function(e){return jd(e,this.serverInputTypes)}},{key:"executeCallbacksOnAnnotationSubmitted",value:function(e,r){var o=this,s=this.getAnnotationOperationsByType(e),a=s.annotationOpsMap,u=s.apologyOpsMap;a.forEach(function(l,c){Array.from(l).forEach(function(f){return o.triggerRegisteredAnnotationCallbacks(f,c,r,!1)})}),u.forEach(function(l,c){Array.from(l).forEach(function(f){return o.triggerRegisteredAnnotationCallbacks(f,c,r,!0)})})}},{key:"partitionAnnotationOperations",value:function(e){return e.reduce(function(r,o){var s=(0,Kn.default)(r,2),a=s[0],u=s[1];return o.items.some(function(l){return l.body&&st.typeGuard(l.body)})?[[].concat((0,Jn.default)(a),[o]),u]:[a,[].concat((0,Jn.default)(u),[o])]},[[],[]])}},{key:"onAnnotationsSubmitted",value:function(e,r){var o=this,s=this.getAnnotationOperationsByType(e),a=s.annotationOpsMap,u=s.apologyOpsMap;a.forEach(function(l,c){var f=Array.from(l);o.onAnnotationResults(new Oe({annotationType:c,ops:f,cv:r,areApologies:!1}),qe.Submitted,function(){})}),u.forEach(function(l,c){var f=Array.from(l);o.onAnnotationResults(new Oe({annotationType:c,ops:f,cv:r,areApologies:!0}),qe.Submitted,function(){})})}},{key:"getAnnotationOperationsByType",value:function(e){var r=new Map,o=new Map,s=function(l){for(var c of l.items)if(c.body&&st.typeGuard(c.body)){var f=function(m,v){var _=m.get(v)||new Set;_.add(l),m.set(v,_)};ir.typeGuard(c.body)?f(o,c.body.annotationTypeName):f(r,g.getTypeNameFor(c.body))}};for(var a of e)s(a);return{annotationOpsMap:r,apologyOpsMap:o}}},{key:"onClaimsChallengeMessage",value:function(e,r){var o=this,s=new b({operationName:"OnClaimsChallengeMessage",dimension0:e.claimsVersion.toString(),dimension1:e.error,success:!0}).setClientMetadata(this.clientMetadata).start(),a=e.claims&&e.claims.length>0;s.resultSignature=`HasClaims: ${a}`,s.resultDescription="Received Claims Challenge Message from Server",Se(s),e.claimsVersion>this.cachedClaimsChallenge.claimsVersion&&(this.cachedClaimsChallenge=Object.assign(Object.assign({},e),{actionRequired:!0})),this.requestAuthTokenInteractive(e).then(function(u){Xt.typeGuard(u)&&o.invokeClaimsChallengeCallbacks()}).catch(function(){}),r(void 0,new Te)}},{key:"generateCorrelationId",value:function(){return this.sessionManager.getCorrelationVector().newChild().toString()}},{key:"onTokenProvisionResponse",value:function(e){e&&this.onServerAuthenticationStateChange(fe.Authenticated)}},{key:"invokeClaimsChallengeCallbacks",value:function(){for(var e of this.claimsChallengeCallback)e(this.cachedClaimsChallenge)}},{key:"requestAuthTokenInteractive",value:function(e,r){var o=this,s,a=new b({operationName:"RequestAuthTokenInteractive",success:!0,dimension0:`isInteractive: ${(s=r==null?void 0:r.interactive)!==null&&s!==void 0?s:!1}`}).start();a.dimension1=`HasClaims: ${e.claims?e.claims.length>0:!1}`;var u={Tickets:[],DocSessionId:this.clientMetadata.docSessionId,TokenType:rn.Augloop,ConnectParams:this.connectParams,Claims:e.claims,Interactive:r==null?void 0:r.interactive};return this.hostCallbacks.requestAuthToken(u).then(function(l){if(!l)throw new Error("Missing AuthTokenResponse from requestAuthToken claims");if(!l.Token)throw new Error("Missing Token from requestAuthToken claims");return a.resultSignature="Token",new dn({authToken:l.Token,version:++o.tokenMessageVersion,claimsVersion:e.claimsVersion})}).catch(function(l){return a.resultSignature="NoToken",a.dimension2=l.message,new Xt({reason:l.message,version:++o.tokenMessageVersion,claimsVersion:e.claimsVersion,clientHandlesResponse:!0})}).then(function(l){return new Promise(function(c,f){o.sendMessageToSession(l,function(d,m){Se(a,d==null?void 0:d.error),d?f(new Error(d.error)):(dn.typeGuard(l)&&(o.cachedClaimsChallenge.actionRequired=!1,o.onTokenProvisionResponse(m)),c(l))})})})}},{key:"ensureConnection",value:function(){return Promise.resolve()}},{key:"keepAlive",value:function(){}}])})();Au.requestCancelledError="Request cancelled";p();var Pu=C(Re()),Nu=C(F()),Ou=C(G());var sv=(function(){function t(n){(0,Nu.default)(this,t),this.item=n,this.operation=n.op,this.delta=n.delta,this.deltas=n.deltas,this.id=ft(this.itemPath),this.revId=n.revId}return(0,Ou.default)(t,[{key:"itemPath",get:function(){return[].concat((0,Pu.default)(this.item.parentPath),[this.item.id])}},{key:"getModelIterator",value:function(){throw new Error("Method not implemented.")}},{key:"getBody",value:function(){return this.item.body}},{key:"getItemReference",value:function(){throw new Error("Method not implemented.")}},{key:"getParentItem",value:function(e){throw new Error("Method not implemented.")}},{key:"getParentItemBody",value:function(e){throw new Error("Method not implemented.")}},{key:"getPrevItem",value:function(e,r){throw new Error("Method not implemented.")}},{key:"getPrevItemBody",value:function(e,r){throw new Error("Method not implemented.")}},{key:"getNextItem",value:function(e,r){throw new Error("Method not implemented.")}},{key:"getNextItemBody",value:function(e,r){throw new Error("Method not implemented.")}},{key:"getChildItem",value:function(e){throw new Error("Method not implemented.")}},{key:"getChildItemBody",value:function(e){throw new Error("Method not implemented.")}},{key:"getChildItems",value:function(e){throw new Error("Method not implemented.")}},{key:"getChildItemBodies",value:function(e){throw new Error("Method not implemented.")}},{key:"getSubtreeItem",value:function(e){throw new Error("Method not implemented.")}},{key:"getSubtreeItemBody",value:function(e){throw new Error("Method not implemented.")}},{key:"getSubtreeItems",value:function(e){throw new Error("Method not implemented.")}},{key:"getSubtreeItemBodies",value:function(e){throw new Error("Method not implemented.")}},{key:"getContextItem",value:function(e){throw new Error("Method not implemented.")}},{key:"getContextItemBody",value:function(e){throw new Error("Method not implemented.")}},{key:"getContextItems",value:function(e){throw new Error("Method not implemented.")}},{key:"getContextItemBodies",value:function(e){throw new Error("Method not implemented.")}},{key:"addAnnotation",value:function(e,r){throw new Error("Method not implemented.")}},{key:"updateAnnotation",value:function(e,r){throw new Error("Method not implemented.")}},{key:"deleteAnnotation",value:function(e){throw new Error("Method not implemented.")}},{key:"loadSubtree",value:function(e){throw new Error("Method not implemented.")}},{key:"getSourceTimestamp",value:function(){return this.item.sourceTimestamp}},{key:"getContextId",value:function(){return this.item.contextId}}])})(),Xd=(function(){function t(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];(0,Nu.default)(this,t),this.scopeItem=void 0,this.rootItem=void 0,this.normalizeFilter=function(r){if(!r)return function(o){return o!==void 0};if(typeof r=="function")throw new Error("Not implemented yet");if((r.id?1:0)+(r.ids?1:0)+(r.itemType?1:0)+(r.itemTypes?1:0)!=1)throw new Error("Exactly one condition expected on IItemFilter");if(r.itemType)return function(o){return o&&g.matchesTypesFor(o.body,[r.itemType])};if(r.itemTypes)return function(o){return o&&g.matchesTypesFor(o.body,r.itemTypes)};throw new Error("Not implemented yet")},this.items=[].concat((0,Pu.default)(e),[n]),this.scopeItem=new sv(n)}return(0,Ou.default)(t,[{key:"getItem",value:function(e){throw new Error("Method not implemented.")}},{key:"getItems",value:function(e){throw new Error("Method not implemented.")}},{key:"getItemBody",value:function(e){var r=this.getItemBodies(e);return r[0]}},{key:"getItemBodies",value:function(e){var r=this.normalizeFilter(e);return this.items.filter(r).map(function(o){return o.body})}},{key:"getItemByReference",value:function(e){throw new Error("Method not implemented.")}},{key:"getItemBodyByReference",value:function(e){throw new Error("Method not implemented.")}}])})();p();var Zd=C(F()),eg=C(G());var Bu=(function(){function t(n){(0,Zd.default)(this,t),this.model=n.model,this.clientMetadata=n.clientMetadata,this.userContext=n.userContext,this.site=n.site,this.getTokenCallback=n.getTokenCallback}return(0,eg.default)(t,[{key:"flights",get:function(){var e;return(e=this._flights)!==null&&e!==void 0||(this._flights=ci(this.clientMetadata.flights)),this._flights}},{key:"getToken",value:function(e,r){return this.getTokenCallback(e,r)}},{key:"getTokenAsync",value:function(e){var r=this;return new Promise(function(o,s){r.getToken(e,function(a,u,l){a?s(a):o(Object.assign(Object.assign({},l),{token:u}))})})}}])})();p();var tg=C(mt()),ng=C(F()),rg=C(G());var ig=(function(){function t(n,e,r){(0,ng.default)(this,t),this.itemsContextId=new Set,this.executionState=new Map,this.graphNode=n,this.onContextIdWorkflowExecutionComplete=e,r&&(this.itemsContextId=r.itemsContextId,this.executionState=r.executionState)}return(0,rg.default)(t,[{key:"addInputItemToProcess",value:function(e){this.itemsContextId.add(e)}},{key:"removeProcessedInputItem",value:function(e){this.itemsContextId.delete(e)}},{key:"countItemsToProcess",value:function(e){var r=0;for(var o of this.itemsContextId)o.indexOf(e)===0&&(r+=1);return r}},{key:"getExecutionState",value:function(){return this.executionState}},{key:"setExecutionState",value:function(e,r){return this.graphNode.isActivated?e?(this.executionState.set(e,r),!0):(h.info(520217546,y.CoreDefault,new b({operationName:"WorkflowExecutionTracker",resourceId:this.graphNode.workflow.id,joinContextId:e,resultDescription:`Trying to set state ${r} for a undefined contextId (setExecutionState)`})),!1):(h.info(508883415,y.CoreDefault,new b({operationName:"WorkflowExecutionTracker",resourceId:this.graphNode.workflow.id,joinContextId:e,resultDescription:`Trying to set state ${r} for a not activated workflow`})),!1)}},{key:"beforeWorkflowExecution",value:function(e){this.setExecutionState(e,$t.Pending)}},{key:"afterWorkflowExecution",value:function(e){this.setExecutionState(e,$t.Executed)&&this.tryToCompleteWorkflowExecution(e)}},{key:"clearWorkflowExecutions",value:function(){var e=this;this.executionState.forEach(function(r,o){return e.afterWorkflowExecution(o)})}},{key:"tryToCompleteWorkflowExecution",value:function(e){var r=this.executionState.get(e);if(r===$t.Executed&&this.canCompleteExecution(e)){this.executionState.delete(e),this.onContextIdWorkflowExecutionComplete&&this.onContextIdWorkflowExecutionComplete(this.graphNode.workflow.id,e);for(var o of this.downstreamWorkflowExecutionTrackers)for(var s of o.getExecutionState()){var a=(0,tg.default)(s,2),u=a[0],l=a[1];l===$t.Executed&&cn.isParentContextId(e,u)&&o.tryToCompleteWorkflowExecution(u)}}}},{key:"canCompleteExecution",value:function(e){for(var r of this.upstreamWorkflowExecutionTrackers)for(var o of r.getExecutionState().keys())if(cn.isParentContextId(o,e))return!1;return!0}}])})();var og=500,At;(function(t){t.Unknown="",t.InputReceived="input",t.JoinMaxAnnnotation="maxAnnotation",t.JoinMaxTimeout="maxTimeout",t.JoinEarlyCompletion="earlyCompletion"})(At||(At={}));var ug=(function(){function t(n,e,r){var o=this;(0,sg.default)(this,t),this.executionTrackersByWorkflowNameBySession=new Map,this.workflowsWithSessionAffinity=new Map,this.workflowDefinitionsWithSessionAffinity=[],this.workflowsWithoutSessionAffinity=[],this.pendingScopeExecutionNotificationsByWorkflow=new Map,this.sweepIntervalMs=200,this.sweepTimers=new Map,this.getResourceAsArrayBuffer=function(s,a,u){return o.modelDownloader?o.modelDownloader.getResourceAsArrayBuffer(s,a,u):Promise.reject(new Error("Resource Downloader never created"))},this.getResourceAsURL=function(s,a,u){return o.modelDownloader?o.modelDownloader.getResourceAsURL(s,a,u):Promise.reject(new Error("Resource Downloader never created"))},this.createModel=function(s){return!o.inferenceService&&o.inferenceServiceFactory&&(o.inferenceService=o.inferenceServiceFactory()),o.inferenceService?o.inferenceService.then(function(a){return a.createModel(s)}):Promise.reject(new Error("Inference Service never created"))},this.createModelInputs=function(){if(!o.inferenceService&&o.inferenceServiceFactory&&(o.inferenceService=o.inferenceServiceFactory()),o.inferenceService)return o.inferenceService.then(function(s){return s.createInputs()});throw new Error("Inference Service never created")},this.nextAnnotationId=1,this.nextSignalId=1,this.modelDownloader=n,this.inferenceServiceFactory=e,r.enableDeltas&&(this.deltaHandlers=new Map().set(g.getTypeNameFor(Ut),Qc).set(g.getTypeNameFor(ze),Yc),this.itemsForDelta=new Map),this.enableEarlyJoin=r.enableEarlyJoin||!1,this.site={getResourceAsArrayBuffer:this.getResourceAsArrayBuffer,getResourceAsURL:this.getResourceAsURL,createModel:this.createModel,createModelInputs:this.createModelInputs}}return(0,ag.default)(t,[{key:"getNextClientAnnotationId",value:function(){return"#AC"+this.nextAnnotationId++}},{key:"getNextClientSignalId",value:function(){return"#SC"+this.nextSignalId++}},{key:"registerLocalWorkflow",value:function(e,r){var o=this,s=new b({operationName:"WorkflowRegistration",resourceId:e.id}).start();if(e.inputTypes.length===0)throw new Error("Invalid workflow params");r?(this.workflowsWithSessionAffinity.get(r).push(this.createWorkflowImplementation(e,r)),r.registerContextTypes(Ai(e.requestedContextTypesRules).map(function(a){var u=(0,hn.default)(a,2),l=u[0],c=u[1];return l})),r.attachToWorkflowGraph(e),s.setClientMetadata(r.getClientMetadata())):(e.isStateful?(this.workflowDefinitionsWithSessionAffinity.push(e),this.workflowsWithSessionAffinity.forEach(function(a,u){a.push(o.createWorkflowImplementation(e,u))})):this.workflowsWithoutSessionAffinity.push(this.createWorkflowImplementation(e)),this.workflowsWithSessionAffinity.forEach(function(a,u){u.registerContextTypes(Ai(e.requestedContextTypesRules).map(function(l){var c=(0,hn.default)(l,2),f=c[0],d=c[1];return f})),u.attachToWorkflowGraph(e)})),s.success=!0,h.info(572838110,y.CoreDefault,s.stop())}},{key:"getAllRegisteredWorkflowsFromSession",value:function(e){var r=[];return r.push.apply(r,(0,ls.default)(this.workflowsWithoutSessionAffinity||[])),r.push.apply(r,(0,ls.default)(this.workflowsWithSessionAffinity.get(e)||[])),r.map(function(o){return o.workflow})}},{key:"getWorkflowDefinitionsByName",value:function(e){var r,o=new Map;return(r=this.workflowsWithSessionAffinity.get(e))===null||r===void 0||r.forEach(function(s){return o.set(s.workflow.id,s.workflow)}),o}},{key:"getWorkflowDefinitionsWithSessionAffinity",value:function(){return this.workflowDefinitionsWithSessionAffinity}},{key:"attachExecutionTrackerToEachWorkflow",value:function(e,r,o){var s=this,a=e.getWorkflowNodes(),u=this.executionTrackersByWorkflowNameBySession.get(r),l=function(_,S){if(o&&o(_,S),s.enableEarlyJoin){var M=function(){var w;for(var P of((w=s.executionTrackersByWorkflowNameBySession.get(r))===null||w===void 0?void 0:w.values())||[])if(P.graphNode.workflow.kind===Ce.Join){for(var R of P.getExecutionState().keys())if(cn.isParentContextId(R,S))return!0}return!1};M()&&(s.cancelSweepTimer(r),s.ensureSweepTimer(r),s.sweepScopeExecutionNotifications())}};if(u){for(var c of a){var f=u.get(c.workflow.id),d=new ig(c,l.bind(this),f);u.set(c.workflow.id,d)}for(var m of u.values())this.setDownstreamWorkflowExecutionTrackers(m,u),this.setUpstreamWorkflowExecutionTrackers(m,u)}}},{key:"canActivateWorkflow",value:function(e,r){var o;return e.location===qt.Local?!0:!(!r.hasConnected||((o=e.workflow.requiredTokenTypes)===null||o===void 0?void 0:o.length)>0&&r.getServerAuthenticationState()===fe.NotAuthenticated)}},{key:"setDownstreamWorkflowExecutionTrackers",value:function(e,r){if(e.downstreamWorkflowExecutionTrackers===void 0){e.downstreamWorkflowExecutionTrackers=new Set;var o=e.graphNode;for(var s of o.downstreamWorkflows||[]){var a=r.get(s.workflow.id);this.setDownstreamWorkflowExecutionTrackers(a,r),e.downstreamWorkflowExecutionTrackers.add(a)}}}},{key:"setUpstreamWorkflowExecutionTrackers",value:function(e,r){if(e.upstreamWorkflowExecutionTrackers===void 0){e.upstreamWorkflowExecutionTrackers=new Set;var o=e.graphNode;for(var s of o.upstreamWorkflows||[]){var a=r.get(s.workflow.id);this.setUpstreamWorkflowExecutionTrackers(a,r),e.upstreamWorkflowExecutionTrackers.add(a)}}}},{key:"deactivateServerWorkflow",value:function(e,r){var o,s;e.location!==qt.Local&&((s=(o=this.executionTrackersByWorkflowNameBySession.get(r))===null||o===void 0?void 0:o.get(e.workflow.id))===null||s===void 0||s.clearWorkflowExecutions(),e.isActivated=!1)}},{key:"addSession",value:function(e){this.isWorkflowTrackingEnabled(e)&&this.executionTrackersByWorkflowNameBySession.set(e,new Map);var r=[];for(var o of this.workflowDefinitionsWithSessionAffinity)r.push(this.createWorkflowImplementation(o)),e.attachToWorkflowGraph(o);this.workflowsWithSessionAffinity.set(e,r);for(var s of this.workflowsWithoutSessionAffinity)e.attachToWorkflowGraph(s.workflow)}},{key:"isWorkflowTrackingEnabled",value:function(e){return this.enableEarlyJoin||e.enabledRemoteExecutionNotification()}},{key:"closeSession",value:function(e){this.cancelSweepTimer(e);for(var r of this.workflowsWithSessionAffinity.get(e)||[])r.workflowLambda.dispose();this.workflowsWithSessionAffinity.delete(e),this.isWorkflowTrackingEnabled(e)&&this.executionTrackersByWorkflowNameBySession.delete(e)}},{key:"setTokenCallback",value:function(e){this.getAuthTokenCallback=e}},{key:"preProcessItemToWorkflow",value:function(e,r,o){var s,a=(s=this.executionTrackersByWorkflowNameBySession.get(o))===null||s===void 0?void 0:s.get(e.id);a&&(e.kind===Ce.Join&&g.matchesTypesFor(r.body,e.inputTypes)&&a.addInputItemToProcess(r.contextId),(e.kind===Ce.SingleItem&&g.matchesTypesFor(r.body,e.inputTypes)||e.kind===Ce.Join&&g.matchesTypesFor(r.body,[e.collectionScopeType]))&&a.beforeWorkflowExecution(r.contextId))}},{key:"isReadyToEarlyJoin",value:function(e,r,o){var s=this;if(!e)return!1;var a=function(m){var v,_=Array.from((v=m.states)!==null&&v!==void 0?v:[]).map(function(M){return`${M[0]}: ${M[1].map(function(k){return k.join()})}`}).join(),S=new b({operationName:"EarlyJoinCompletion",resourceId:e.graphNode.workflow.id,joinContextId:r,success:!0}).start();S.setClientMetadata(o),S.resultDescription=`isReadyToEarlyJoin (${s.enableEarlyJoin}) -> hasProcessedAllInputItems: ${m.hasProcessedAllInputItems}, allUpstreamComplete: ${m.allUpstreamComplete}, states: ${_}`,h.info(512550800,y.CoreDefault,S.stop())},u=e.countItemsToProcess(r)===0;if(!u)return this.enableEarlyJoin||a({hasProcessedAllInputItems:u}),!1;var l=this.areAllUpstreamWorkflowComplete(e,r),c=l.allUpstreamComplete,f=l.states;return this.enableEarlyJoin?c:(a({hasProcessedAllInputItems:u,allUpstreamComplete:c,states:f}),!1)}},{key:"areAllUpstreamWorkflowComplete",value:function(e,r){var o=new Map;for(var s of e.upstreamWorkflowExecutionTrackers){var a=[];for(var u of s.getExecutionState()){var l=(0,hn.default)(u,2),c=l[0],f=l[1];if(a.push([c,f]),cn.isParentContextId(r,c))return o.set(s.graphNode.workflow.id,a),{allUpstreamComplete:!1,states:o}}a.length>0&&o.set(s.graphNode.workflow.id,a)}return{allUpstreamComplete:!0,states:o}}},{key:"runLocalWorkflows",value:function(e,r){var o=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a,u,l,c=function(k,w,P){var R,B,W=r.getWorkflowItemStorage(),I=k.workflow,X=(R=o.executionTrackersByWorkflowNameBySession.get(r))===null||R===void 0?void 0:R.get(I.id),Z=I.inputTypes.concat(I.kind===Ce.Join?I.collectionScopeType:[]),U=new b({operationName:"RunLocalWorkflows",success:!0,resourceId:I.id,joinContextId:w.contextId}).start();if(U.setClientMetadata(r.getClientMetadata()),g.matchesTypesFor(w.body,Z)){var E=Rn(P.parentPath,w);if(I.kind===Ce.Join)if(g.matchesTypesFor(E.body,[I.collectionScopeType])){W.setScopeItem(E,I),U.resultDescription=`Scope item: ${w.id} (${g.getTypeNameFor(w.body)})`,h.info(524126153,y.CoreDefault,U.stop()),o.setScopeExecutionNotification(r,k,E);return}else{X==null||X.removeProcessedInputItem(E.contextId);var $=W.getScopeItem(E.contextId,I);if(!$){U.resultDescription=`Filtered out join invalidation: out of scope type (${I.collectionScopeType}), item id: ${E.id}`,h.info(541173894,y.CoreDefault,U.stop());return}W.addItemToWorkflowList(E,I),U.joinContextId=$.contextId,U.resultDescription=`Input item: ${w.id} (${g.getTypeNameFor(w.body)})`}if(g.getBaseTypesFor(E.body).indexOf(rr.getTypeName())>=0){var K=[].concat((0,ls.default)(E.parentPath),[E.id]),ge=!0;for(var N of(B=I.outputTypes)!==null&&B!==void 0?B:[])if(!r.getContextAnnotations(N,qe.LocalWorkflow,K,I.id)){ge=!1;break}if(ge)return}var T=function(){var D,x=r.resolveRequestedContexts(I),L=(0,hn.default)(x,2),O=L[0],J=L[1];if(!O){U.resultDescription=`Required contexts are not ready for ${I.id}. Retrying execution in ${og} milliseconds...`,h.info(545837259,y.CoreDefault,U.stop()),setTimeout(T,og);return}if(I.kind===Ce.SingleItem)o.queueWorkflow({workflowInfo:k,scopeItem:E,inputItems:[E],requestedContexts:J,session:r,triggerReason:At.InputReceived,onCompleteCallback:o.onWorkflowExecuted.bind(o,E,I,r)}).then(function(){h.info(509154263,y.WorkflowDefault,U.stop())}).catch(function(ke){U.resultDescription=ke,h.error(572838111,y.CoreDefault,U.stop())});else if(I.kind===Ce.Join){var ie=w.contextId,z=W.getScopeItem(ie,k.workflow);if(!z){U.resultDescription=`No scope item for ${I.id} workflow from contextId ${ie}`,h.info(526758475,y.CoreDefault,U.stop());return}var re=o.isReadyToEarlyJoin(X,z.contextId,r.getClientMetadata()),oe=re?At.JoinEarlyCompletion:At.JoinMaxAnnnotation;if(W.isWorkflowReady(z.contextId,I)||re){var se=(D=o.pendingScopeExecutionNotificationsByWorkflow.get(I.id))===null||D===void 0?void 0:D.get(z.contextId);if(!se){U.resultDescription=`Workflow ${I.id}, contextId ${z.contextId}, already queued, skipping new scope execution`,h.info(528048977,y.CoreDefault,U.stop());return}var pe=W.getItemsToExecute(z.contextId,I);o.queueWorkflow({workflowInfo:k,scopeItem:z,inputItems:pe,requestedContexts:J,session:r,triggerReason:oe,onCompleteCallback:o.onWorkflowExecuted.bind(o,z,I,r)}).then(function(){h.info(509154262,y.WorkflowDefault,U.stop())}).catch(function(ke){U.resultDescription=ke,h.error(541173895,y.CoreDefault,U.stop())}),o.pendingScopeExecutionNotificationsByWorkflow.get(I.id).delete(z.contextId),o.pendingScopeExecutionNotificationsByWorkflow.get(I.id).size===0&&o.pendingScopeExecutionNotificationsByWorkflow.delete(I.id)}}};T()}},f=e;s&&(f=[new Me({parentPath:["session"],items:[{id:"#userContext#",body:new Tn}]}),new Me({parentPath:["session"],items:[{id:"#tenantContext#",body:new bn}]})],r.getContextIdManager().applyContextIdOnOperations(f),f=f.concat(e));for(var d of f){var m=g.getTypeNameFor(d);for(var v of d.items){if(r.applyOperationForContext(d,v,qe.Submitted),m===St.getTypeName()){(a=this.itemsForDelta)===null||a===void 0||a.delete(d.parentPath.concat(v.id).toString());continue}else if(v.body)if(m===We.getTypeName()&&this.deltaHandlers&&this.itemsForDelta){this.handleLocalDeltaUpdate(v,d,r);continue}else(u=this.itemsForDelta)===null||u===void 0||u.set(d.parentPath.concat(v.id).toString(),v);else continue;for(var _ of this.workflowsWithoutSessionAffinity)c(_,v,d);for(var S of(l=this.workflowsWithSessionAffinity.get(r))!==null&&l!==void 0?l:[])c(S,v,d)}}}},{key:"handleLocalDeltaUpdate",value:function(e,r,o){var s=new b({operationName:"LocalDeltaUpdate",dimension0:g.getTypeNameFor(e.body),success:!0});s.start();try{var a=this.deltaHandlers.get(g.getTypeNameFor(e.body)),u=this.itemsForDelta.get(r.parentPath.toString());if(a&&u){var l=r.parentPath.length>0?r.parentPath.slice(0,r.parentPath.length-1):r.parentPath,c=a(e.body,u.body);if(c){var f={id:u.id,revId:e.revId,body:c,parentPath:l,delta:e.body,contextId:e.contextId},d=new Ot({parentPath:f.parentPath,items:[f]});h.info(539637591,y.CoreDefault,s.stop()),this.runLocalWorkflows([d],o)}else s.success=!1,s.resultDescription="Failed because the handler did not produce valid updated item",h.info(539637592,y.CoreDefault,s.stop())}else s.success=!1,s.resultDescription="Failed due to lack of handler or parent item",h.info(539637593,y.CoreDefault,s.stop())}catch(m){s.success=!1,s.resultDescription=`Failed to apply delta, error: ${m}`,h.info(539637594,y.CoreDefault,s.stop())}}},{key:"createWorkflowImplementation",value:function(e,r){var o=e.factory(),s={workflow:e,workflowLambda:o,initPromise:this.initWorkflow(e.kind,o,r)};return s}},{key:"initWorkflow",value:function(e,r,o){var s=new Bu({model:void 0,clientMetadata:o?o.getClientMetadata():void 0,userContext:o?o.getUserContext():void 0,site:this.site,getTokenCallback:this.getAuthTokenCallback});return e===Ce.SingleItem?r.init(this.site,s):e===Ce.Join?r.init(this.site,s):Promise.resolve()}},{key:"queueWorkflow",value:function(e){var r=this,o,s;return(s=(o=this.executionTrackersByWorkflowNameBySession.get(e.session))===null||o===void 0?void 0:o.get(e.workflowInfo.workflow.id))===null||s===void 0||s.setExecutionState(e.scopeItem.contextId,$t.Running),this.executeLocalWorkflow(e.workflowInfo,e.scopeItem,e.inputItems,e.session,e.requestedContexts,e.triggerReason).then(function(a){r.processAnnotationResults(a,e.session),e.onCompleteCallback()}).catch(function(a){throw e.onCompleteCallback(),a})}},{key:"processAnnotationResults",value:function(e,r){for(var o of e)r.onAnnotationResults(o,qe.LocalWorkflow,function(){})}},{key:"executeLocalWorkflow",value:function(e,r,o,s,a,u){var l=this;return new Promise(function(c,f){var d,m,v,_=[],S=e.workflow,M=new b({operationName:"ExecuteWorkflow",resourceId:S.id,joinContextId:(d=r==null?void 0:r.contextId)!==null&&d!==void 0?d:"",resultDescription:u!=null?u:"",success:!0}).setClientMetadata(s.getClientMetadata());M.start();var k=(m=r==null?void 0:r.contextId)!==null&&m!==void 0?m:o[0].contextId,w=(v=r==null?void 0:r.revId)!==null&&v!==void 0?v:o[0].revId,P=function(){var T=new Map;if(r&&(r.parentPath||h.error(525382231,y.CoreDefault,`Missing scope item parent. Workflow: ${S.id}. Type: ${g.getTypeNameFor(r.body)}`),T.set(r.body,r)),Array.isArray(o))for(var A of o)A&&A.body&&(A.parentPath||h.error(525382232,y.CoreDefault,`Missing parent. Workflow: ${S.id}. Type: ${g.getTypeNameFor(A.body)}`),T.set(A.body,A));return T},R=P(),B=function(T){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:M;if(T)return A.success=!1,A.resultDescription+=typeof T=="string"?T:T.message,A.resultSignature="Exception",h.error(572838112,y.CoreDefault,A.stop()),typeof T=="string"?new Error(T):T;h.info(572838113,y.CoreDefault,A.stop())},W=function(T,A,D,x){var L,O=new b({operationName:"SetAnnotations",resourceId:A,joinContextId:(L=r==null?void 0:r.contextId)!==null&&L!==void 0?L:"",success:!0}).setClientMetadata(s.getClientMetadata());O.start();var J=function(ke){h.info(555866112,y.CoreDefault,new ra({annotationType:A,annotationState:ke,workflowId:e.workflow.id}))};for(var ie of D)ie.metadata=Object.assign(Object.assign({},ie.metadata),{state:on.Created}),J(on.Created);var z=R.get(T),re=g.getTypeNameFor(z.body),oe=function(){var ke;if(S.kind===Ce.SingleItem&&o[0].body!==T){var tt=`Expected obj to be ${o[0].body} but instead it was ${T}`;B(tt,O),f(B(tt));return}var Be;if(!Array.isArray(D))Be="Workflow produced an invalid annotation array";else if(!S.outputTypes||S.outputTypes.indexOf(A)<0)Be=`Workflow said it would output one of [${S.outputTypes}] but instead output ${A}`;else if(!z)Be="No item provided";else for(var pt of D)g.matchesTypesFor(pt,[st.getTypeName()])?g.getTypeNameFor(pt)!==A&&(Be=`Workflow produced inconsistent annotation types in setAnnotations call (${g.getTypeNameFor(pt)} did not match expected ${A})`):Be=`Workflow produced an output that is not an annotation ${g.getTypeNameFor(pt)}`;if(Be){B(Be,O),f(B(Be));return}var it;x&&x.isSessionAnnotation?it=["session"]:x&&x.ancestorType?it=z.parentPath:it=z.parentPath.concat(z.id);var vn=[],de=[],ve=function(){Ae.metadata=Object.assign(Object.assign({},Ae.metadata),{state:on.Sent}),J(on.Sent);var Cn=Ae.id,nn=Cn?(ke=s.getContextAnnotations(A,qe.LocalWorkflow,it,S.id))===null||ke===void 0?void 0:ke.filter(function(Sn){var Yn;return((Yn=Sn.body)===null||Yn===void 0?void 0:Yn.id)==Cn}):void 0;(nn==null?void 0:nn.length)==1?nn.length==1?de.push({id:nn[0].id,source:S.id,revId:w,body:Ae,contextId:k}):h.error(545837260,y.CoreDefault,`Assert: Multiple existing context annotations with body id ${Cn} found for ${A} and local workflow ${S.id}).`):vn.push({id:l.getNextClientAnnotationId(),source:S.id,revId:w,body:Ae,contextId:k})};for(var Ae of D)ve();var ht=[];return vn.length>0&&ht.push(new Me({parentPath:it,items:vn,parentRevId:w})),de.length>0&&ht.push(new Ve({parentPath:it,items:de,parentRevId:w})),new Oe({annotationType:A,ops:ht})},se=oe();if(!se){h.info(509644823,y.CoreDefault,O.stop());return}x&&x.immediate?s.onAnnotationResults(se,qe.LocalWorkflow,function(){}):_.push(se),(re==Tn.getTypeName()||re==bn.getTypeName()||g.matchesTypesFor(z.body,[tr.getTypeName(),nr.getTypeName()]))&&s.submitOperationsToSession(se.ops),h.info(509644822,y.CoreDefault,O.stop())},I=function(T){var A=new b({operationName:"submitSignalsAction",resourceId:S.id,success:!0}).setClientMetadata(s.getClientMetadata());for(var D of T){var x=g.getTypeNameFor(D);g.matchesTypesFor(D,[sn.getTypeName()])||(A.resultDescription=`Workflow produced an output that is not an signal (${g.getTypeNameFor(D)})`,h.info(521413954,y.CoreDefault,A)),(!S.outputTypes||S.outputTypes.indexOf(x)===-1)&&(A.resultDescription=`Workflow said it would output one of [${S.outputTypes}] but instead output ${x}`,h.info(521413953,y.CoreDefault,A)),D.timestamp&&(t.logTimestampUsageByWorkflowId.has(S.id)||(t.logTimestampUsageByWorkflowId.add(S.id),A.resultDescription=`Workflow "${S.id}" sets signal.timeStamp`,h.info(509212803,y.CoreDefault,A)))}var L=T.map(function(J){return{id:l.getNextClientSignalId(),source:S.id,revId:w,body:J,contextId:k}}),O=new at({parentPath:["session"],parentRevId:w,items:L});s.submitOperations([O])},X=function(T,A,D){var x;switch(D){case jr.JoinContext:{if(!r.contextId){var L="ContextId is not defined for this scope item.";throw h.error(527472289,y.CoreDefault,L),new Error(L)}x=r.contextId;break}case jr.Session:{x=void 0;break}default:{var O="Defined scope is not supported. "+D;throw h.error(527472290,y.CoreDefault,O),new Error(O)}}var J=new ui({definition:A,contextId:x,sourceWorkflowId:S.id,targetWorkflowId:T});s.onWorkflowDefinitionOverrideMessage(J)},Z=new Bu({model:new Xd(o[0],a),clientMetadata:s.getClientMetadata(),userContext:s.getUserContext(),site:l.site,getTokenCallback:l.getAuthTokenCallback}),U=function(T){B(T?T.message:void 0),T?f(T):c(_)},E={setAnnotations:W,submitSignals:I,done:U,overrideWorkflowDefinition:X,getDynamicAnnotations:void 0,setBillingDomain:void 0,sendClientRequest:void 0,sendClientRequestStreaming:void 0},$=e.workflowLambda;if(S.kind===Ce.SingleItem){o.length!==1&&U(new Error("Single item workflows expect a single input")),Z.delta=o[0].delta,Z.deltas=o[0].deltas;try{var K=$;e.initPromise||(e.initPromise=K.init(l.site,Z)),e.initPromise.then(function(){K.execute(o[0].body,Z,E)}).catch(function(N){B(N)})}catch(N){B(N)}}else if(S.kind===Ce.Join){o.length===0&&U(new Error("Join workflows expect an inputs array")),Z.delta=r.delta,Z.deltas=r.deltas;try{var ge=$;e.initPromise||(e.initPromise=ge.init(l.site,Z)),e.initPromise.then(function(){ge.execute(r.body,o.map(function(N){return N.body}),Z,E)}).catch(function(N){B(N)})}catch(N){B(N)}}else B(`Workflow kind ${S.kind} not supported`)})}},{key:"ensureSweepTimer",value:function(e){if(!this.sweepTimers.get(e)){var r=setInterval(this.onSweep.bind(this),this.sweepIntervalMs);this.sweepTimers.set(e,r)}}},{key:"cancelSweepTimer",value:function(e){var r=this.sweepTimers.get(e);this.sweepTimers.get(e)&&(clearInterval(r),this.sweepTimers.delete(e))}},{key:"onSweep",value:function(){this.sweepScopeExecutionNotifications()}},{key:"setScopeExecutionNotification",value:function(e,r,o){var s,a,u=Date.now(),l=u+Iu(r.workflow.minDelayMs,1e3),c=u+Iu(r.workflow.maxDelayMs,5e3),f={session:e,workflowImplementation:r,scopeItem:o,startTime:u,minTime:l,maxTime:c},d=r.workflow.kind===Ce.Join?o.contextId:f.scopeItem.parentPath.concat(o.id).join("\\");this.pendingScopeExecutionNotificationsByWorkflow.get(r.workflow.id)||this.pendingScopeExecutionNotificationsByWorkflow.set(r.workflow.id,new Map);var m=this.pendingScopeExecutionNotificationsByWorkflow.get(r.workflow.id).get(d);if(m){var _=new b({resultDescription:`Duplicated pending scope execution for ${r.workflow.id} at ${d}`,operationName:"LocalScopeExecutionNotification",resourceId:r.workflow.id,joinContextId:(a=o==null?void 0:o.contextId)!==null&&a!==void 0?a:"",success:!0}).setClientMetadata(e.getClientMetadata()).start();h.info(509727899,y.CoreDefault,_.stop())}else{var v=new b({resultDescription:`New pending scope execution for ${r.workflow.id} at ${d}`,operationName:"LocalScopeExecutionNotification",resourceId:r.workflow.id,joinContextId:(s=o==null?void 0:o.contextId)!==null&&s!==void 0?s:"",success:!0}).setClientMetadata(e.getClientMetadata()).start();h.info(539883075,y.CoreDefault,v.stop()),this.pendingScopeExecutionNotificationsByWorkflow.get(r.workflow.id).set(d,f)}this.ensureSweepTimer(e)}},{key:"sweepScopeExecutionNotifications",value:function(){var e=this,r,o,s=new Set(Array.from(this.sweepTimers.keys()));for(var a of Array.from(this.pendingScopeExecutionNotificationsByWorkflow.entries())){var u=(0,hn.default)(a,2),l=u[0],c=u[1],f=function(w){var P=w.session,R=w.workflowImplementation.workflow,B=P.getWorkflowItemStorage(),W=new b({operationName:"LocalScopeExecutionNotification",resourceId:R.id,joinContextId:(o=(r=w.scopeItem)===null||r===void 0?void 0:r.contextId)!==null&&o!==void 0?o:"",success:!0}).setClientMetadata(P.getClientMetadata()).start(),I=function(){var U;if(R.kind===Ce.Join){var E=Date.now(),$=w.workflowImplementation.workflow,K=w.scopeItem.contextId,ge=P.getWorkflowDefinition($,K).maxDelayMs;return B.isWorkflowReady(K,$)?(W.resultDescription=`Join Workflow: ${$.id} queuing by maxAnnotation, contextId: ${K}`,h.info(528048978,y.CoreDefault,W.stop()),{isValid:!0,triggerReason:At.JoinMaxAnnnotation}):w.startTime+ge<E?(W.resultDescription=`Join Workflow: ${$.id} queuing by maxTimeout, contextId: ${K}`,h.info(528048979,y.CoreDefault,W.stop()),{isValid:!0,triggerReason:At.JoinMaxTimeout}):e.isReadyToEarlyJoin((U=e.executionTrackersByWorkflowNameBySession.get(P))===null||U===void 0?void 0:U.get($.id),K,P.getClientMetadata())?(h.info(512550856,y.CoreDefault,`Workflow: ${$.id} queuing by early completion, contextId: ${K}, timeout: ${ge}`),{isValid:!0,triggerReason:At.JoinEarlyCompletion}):{isValid:!1,triggerReason:At.Unknown}}return{isValid:!0,triggerReason:At.Unknown}},X=function(){var U=I(),E=U.isValid,$=U.triggerReason;if(!E)return!1;var K=P.resolveRequestedContexts(R),ge=(0,hn.default)(K,2),N=ge[0],T=ge[1];if(!N)return!1;try{if(R.kind===Ce.Join){var A=w.scopeItem.contextId,D=B.getScopeItem(A,R);if(D){var x=B.getItemsToExecute(D.contextId,R);if(x.length===0)return W.resultDescription=`Failed to retrieve items for workflow: ${R.id}, contextId: ${A}, skipping execution`,h.info(527472291,y.CoreDefault,W.stop()),e.onWorkflowExecuted(D,R,P),!0;e.queueWorkflow({workflowInfo:w.workflowImplementation,scopeItem:D,inputItems:x,requestedContexts:T,session:P,triggerReason:$,onCompleteCallback:e.onWorkflowExecuted.bind(e,D,R,P)}).catch(function(L){W.success=!1,W.resultDescription=L.message,h.error(509092189,y.CoreDefault,W.stop())})}else W.resultDescription="ContextId no longer exists, skipping workflow execution",h.info(539883076,y.CoreDefault,W.stop())}else W.resultDescription=`Workflow in type ${R.kind} is not supported`,h.error(539883077,y.CoreDefault,W.stop())}catch(L){W.resultDescription=`Trying to execute ${R.id} caused an exception: ${L}`,h.warn(539883078,y.CoreDefault,W.stop())}return!0};X()?(e.pendingScopeExecutionNotificationsByWorkflow.get(l).delete(v),e.pendingScopeExecutionNotificationsByWorkflow.get(l).size===0&&e.pendingScopeExecutionNotificationsByWorkflow.delete(l)):s.delete(P)};for(var d of Array.from(c.entries())){var m=(0,hn.default)(d,2),v=m[0],_=m[1];f(_)}}if(s.size!==0)for(var S of Array.from(s)){var M=new b({resultDescription:"No pending scope notifications left, cancelling sweep timer",operationName:"LocalScopeExecutionNotification",success:!0}).start();h.debug(539883079,y.CoreDefault,M.stop()),this.cancelSweepTimer(S)}}},{key:"onExternalWorkflowExecuted",value:function(e,r,o){var s={id:"",parentPath:[],contextId:e},a={id:r};this.onWorkflowExecuted(s,a,o,!1)}},{key:"onWorkflowExecuted",value:function(e,r,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a,u;(u=(a=this.executionTrackersByWorkflowNameBySession.get(o))===null||a===void 0?void 0:a.get(r.id))===null||u===void 0||u.afterWorkflowExecution(e.contextId),s&&r.kind===Ce.Join&&o.getWorkflowItemStorage().onWorkflowExecuted(e,r)}}])})();p();var lg=C(F()),cg=C(G());var fg=C(Uo());var av=2e4,uv=JSON.stringify(new Jt({error:qo})),cs=(function(){function t(n,e){(0,lg.default)(this,t),this.networkOverrideOptions=n,this.settings=e,this.isClosed=!1,this.pendingEgress=[]}return(0,cg.default)(t,[{key:"init",value:function(e,r,o,s){var a=new b({operationName:"HttpWorkerInit",success:!0}).start(),u=e.split("/?x-origin=");u.length===2?(this.url=Y.convertWebSocketUrlToHttp(u[0]),this.origin=u[1]):(this.url=Y.convertWebSocketUrlToHttp(e),this.origin=void 0),this.ingress=r,this.onOpen=o,this.onClose=s,h.info(507839180,y.CoreDefault,a.stop())}},{key:"egress",value:function(e){var r=this,o,s=new b({operationName:"HttpEgress",success:!0}).start();if(!(this.isConnectedToSession()||e.isHttpSessionInitMessage)){this.pendingEgress.push(e),s.success=!1,s.resultDescription="NotConnected, pendingQueueSize:  "+this.pendingEgress.length.toString(),h.info(508163394,y.CoreDefault,s.stop());return}var a=this.getRequestInfo(e,s);if(!a.url){s.success=!1,s.resultDescription="Could not generate HTTP request",h.error(508163393,y.CoreDefault,s.stop());return}if(e.isHttpSessionLongPollMessage){this.egressLongPoll(a,s);return}xn(a.url,a.request,function(u,l){u?r.onEgressError(s,"OnEgressError:"+(u==null?void 0:u.message)):!l||!l.ok?r.onEgressError(s,"OnEgressResponseError: "+(u==null?void 0:u.message)+`, Status ${l==null?void 0:l.status}: ${l==null?void 0:l.statusText}`):l.text().then(function(c){s.success=!0,h.info(508163362,y.CoreDefault,s.stop()),r.ingressInternal(c)}).catch(function(c){r.onEgressError(s,"OnEgressParseError: "+(c==null?void 0:c.message))})},(o=this.settings)===null||o===void 0?void 0:o.useWrappedFetchInHttpWorker)}},{key:"close",value:function(){var e=new b({operationName:"HttpWorkerClose",success:!0}).start();if(this.isClosed){e.resultDescription="AlreadyClosed",h.info(508163360,y.CoreDefault,e.stop());return}h.info(508163359,y.CoreDefault,e.stop()),this.isClosed=!0,this.sessionSettings=void 0,this.onClose&&(this.onClose(void 0),this.onClose=void 0)}},{key:"onEgressError",value:function(e,r){e.success=!1,e.resultDescription=r,h.error(508163358,y.CoreDefault,e.stop()),this.isClosed||this.close()}},{key:"ingressInternal",value:function(e,r){var o=this,s=e;r||(s=this.formatServerInput(e));var a=function(l){It.typeGuard(l)&&o.onSessionInitResponse(l)};s&&(this.logIngressCount(s),this.ingress(s,a))}},{key:"onSessionInitResponse",value:function(e){var r=this,o=new b({operationName:"HttpWorkerOpen",success:!0}).start();if(!e.sessionKey||!e.origin||!e.anonymousToken||!e.sessionUrlBase){o.success=!1,o.resultDescription="SessionInitResponse missing information",h.error(507809949,y.CoreDefault,o.stop());return}h.info(508163357,y.CoreDefault,o.stop()),this.setSessionSettings(e.sessionKey,e.origin,e.anonymousToken,e.sessionUrlBase),this.onOpen(),this.pendingEgress.forEach(function(s){r.egress(s)}),this.pendingEgress=[]}},{key:"egressLongPoll",value:function(e,r){var o=this;Uc(e.url,av,e.request).then(function(s){!s||!s.ok?o.onEgressError(r,"LongPollFetchStatusFailure: "+(s==null?void 0:s.statusText)):s.text().then(function(a){r.success=!0,r.resourceId="LongPoll",h.info(508163355,y.CoreDefault,r.stop()),o.ingressInternal(a)}).catch(function(a){o.onEgressError(r,"LongPollFetchParseError: "+(a==null?void 0:a.message))})}).catch(function(s){s.message===qo?(r.success=!1,r.resultDescription="LongPollFetchResponseTimeout:"+(s==null?void 0:s.message),h.error(508163353,y.CoreDefault,r.stop()),o.ingressInternal(uv,!0)):o.onEgressError(r,"LongPollFetchResponseError: "+(s==null?void 0:s.message))})}},{key:"getRequestInfo",value:function(e,r){var o=this.getUrl(e==null?void 0:e.isHttpSessionInitMessage),s=this.getHeader(e,r);return r.resultSignature=o,{url:o,request:{method:"POST",headers:s,body:e.obj}}}},{key:"getUrl",value:function(e){var r=this.sessionSettings&&this.sessionSettings.sliceUrl?this.sessionSettings.sliceUrl:this.url;return e?r+"/sessioninit":this.isConnectedToSession()?r+"/session/"+this.sessionSettings.sessionKey:""}},{key:"getHeader",value:function(e,r){var o,s=new fg.Headers;return e!=null&&e.isHttpSessionInitMessage?(s.set("Content-Type","application/json"),this.origin&&s.set("x-origin",this.origin)):this.isConnectedToSession()&&(e.obj instanceof Uint8Array||e.obj instanceof ArrayBuffer?(s.set("Content-Type","application/jsond2"),r.dimension0=e.obj.byteLength.toString().length.toString()):s.set("Content-Type","application/json"),s.append("Authorization",`Bearer ${this.sessionSettings.anonymousToken}`),s.set("x-origin",this.sessionSettings.origin)),!((o=this.networkOverrideOptions)===null||o===void 0)&&o.hostHeader&&s.set("host",this.networkOverrideOptions.hostHeader),s}},{key:"setSessionSettings",value:function(e,r,o,s){var a=s.replace("/session","");this.sessionSettings={sessionKey:e,origin:r,anonymousToken:o,sliceUrl:a}}},{key:"isConnectedToSession",value:function(){return this.sessionSettings&&this.sessionSettings.sessionKey.length>0&&this.sessionSettings.anonymousToken.length>0&&this.sessionSettings.origin.length>0&&this.sessionSettings.sliceUrl.length>0&&!this.isClosed}},{key:"formatServerInput",value:function(e){return e.length>1?e.substring(1,e.length-1):""}},{key:"logIngressCount",value:function(e){var r=e.length;if(r>1e5){var o=new b({operationName:"HttpIngressByteOrderOfMagnitude",success:!0}).start();o.dimension2=r.toString().length.toString(),h.info(508409622,y.CoreDefault,o.stop())}}}])})();p();var dg=C(G()),gg=C(F()),pg=(0,dg.default)(function t(){(0,gg.default)(this,t)});p();var Oi=C(es()),np=C(F()),rp=C(G()),ip=C(ut()),Uu=C(Je()),op=C(lt());var ap=C(Zo());p();var Cg=C(F()),Sg=C(G());var kg=C(Eu());var Rt;(function(t){t.ArrivedBeforeReseeding="Message is dropped from queue since it arrived before reseeding is started",t.DroppedAsOldestInQueue="Message is dropped as oldest in full queue",t.DroppedBecauseClientDisconnected="Message is dropped because client is disconnected from server"})(Rt||(Rt={}));var vg=1e3,_g=(function(){function t(n){(0,Cg.default)(this,t),this.logOp=new b({operationName:"MessageQueue",success:!0}),this.queue=new kg.default(vg),this.callbacks=n}return(0,Sg.default)(t,[{key:"clear",value:function(){this.queue.clear()}},{key:"size",value:function(){return this.queue.length}},{key:"push",value:function(e,r,o){this.logOp.start();var s=this.queue;if(s.length===vg){this.logOp.resourceId="QueueFull",this.logOp.success=!1,h.warn(508843746,y.CoreDefault,this.logOp.stop());var a=s.shift();a.onResponse&&a.onResponse(new ee({error:Rt.DroppedAsOldestInQueue}))}s.push({message:e,onResponse:r,timeQueued:Y.getCurrentTimeMs(),attemptNumber:o})}},{key:"sendOnSessionInitialized",value:function(e){this.logOp.start();var r=this.queue.length,o=0;if(r>0){for(var s=Y.getCurrentTimeMs()-this.queue.get(0).timeQueued;this.queue.length>0&&this.callbacks.canSendMessage();){var a=this.queue.shift();e&&this.containSequencedSyncMessage(a)?(o++,a.onResponse&&a.onResponse(new ee({error:Rt.ArrivedBeforeReseeding}))):a.message instanceof Uint8Array?this.callbacks.sendBytes(a.message):this.callbacks.sendMessage(a.message,a.onResponse,a.attemptNumber)}this.logOp.resourceId="SendOnSessionInitialized",this.logOp.resultDescription=`Queue size before: ${r}, after: ${this.queue.length}. droppedSyncMessages: ${o}`,this.logOp.setDataField("OldestMessageInQueueTimeWaitingMs",s),this.logOp.success=!0,h.warn(508843745,y.CoreDefault,this.logOp.stop())}}},{key:"containSequencedSyncMessage",value:function(e){return e.message instanceof le&&g.matchesTypesFor(e.message,[le.getTypeName()])&&e.message.seq>=0||e.message instanceof dt&&g.matchesTypesFor(e.message,[dt.getTypeName()])}}])})();p();var wg=C(ut()),Lu=C(Je()),Pi=C(lt()),yr=C(F()),vr=C(G());function fs(t,n,e){return n=(0,Lu.default)(n),(0,wg.default)(t,Tg()?Reflect.construct(n,e||[],(0,Lu.default)(t).constructor):n.apply(t,e))}function Tg(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(Tg=function(){return!!t})()}var ue;(function(t){t[t.Initing=0]="Initing",t[t.Running=1]="Running",t[t.Disconnected=2]="Disconnected",t[t.Closed=3]="Closed"})(ue||(ue={}));var Wu=function(n,e,r,o){e&&(e.cv||(e.cv=n.cvParent.newChild().toString()),n.messageEndpoint.sendMessage(e,function(s,a){!s&&g.getTypeNameFor(a)===_i.getTypeName()&&(n.stats.lastSyncMessage=Date.now()),r&&r(s,a)},void 0,o))},bg=function(n,e,r,o){e&&(n.messageQueue.push(e,r,o),n.networkWorkerManager.init(void 0,n.customInitPromise).catch(function(s){var a=new b({operationName:"WorkerManagerInit",success:!1,resultDescription:`${s}`});h.error(508843789,y.CoreDefault,a)}))},Mg=function(n,e){e&&(n.messageQueue.push(e),n.networkWorkerManager.init(void 0,n.customInitPromise).catch(function(r){h.error(508843788,y.CoreDefault,`Init failed: ${r}`)}))},ds=(function(){function t(n){(0,yr.default)(this,t),this.context=n}return(0,vr.default)(t,[{key:"onEnter",value:function(e){}},{key:"sendMessage",value:function(e,r,o,s){}},{key:"sendBytes",value:function(e){}},{key:"canSendMessage",value:function(){return!1}},{key:"onConnectionClose",value:function(){}}])})(),Ig=(function(t){function n(){var e;return(0,yr.default)(this,n),e=fs(this,n,arguments),e.stateName=ue.Initing,e.possibleNextStates=[ue.Running,ue.Disconnected,ue.Closed],e}return(0,Pi.default)(n,t),(0,vr.default)(n,[{key:"sendMessage",value:function(r,o,s){g.matchesTypesFor(r,[Ne.getTypeName()])?Wu(this.context,r,o,s):bg(this.context,r,o)}},{key:"sendBytes",value:function(r){Mg(this.context,r)}},{key:"onConnectionClose",value:function(){this.context.setState(ue.Disconnected)}}])})(ds),xg=(function(t){function n(){var e;return(0,yr.default)(this,n),e=fs(this,n,arguments),e.stateName=ue.Running,e.possibleNextStates=[ue.Disconnected,ue.Closed],e}return(0,Pi.default)(n,t),(0,vr.default)(n,[{key:"onEnter",value:function(r){r&&r.isSessionReseedingStarted&&this.context.resetNextSyncSequenceId(),this.context.messageQueue.sendOnSessionInitialized(r&&r.isSessionReseedingStarted)}},{key:"sendMessage",value:function(r,o,s,a){Wu(this.context,r,o,s)}},{key:"sendBytes",value:function(r){r&&this.context.networkWorkerManager.egressBytes(r)}},{key:"canSendMessage",value:function(){return!0}},{key:"onConnectionClose",value:function(){this.context.setState(ue.Disconnected)}}])})(ds),Ag=(function(t){function n(){var e;return(0,yr.default)(this,n),e=fs(this,n,arguments),e.stateName=ue.Disconnected,e.possibleNextStates=[ue.Initing,ue.Closed],e}return(0,Pi.default)(n,t),(0,vr.default)(n,[{key:"onEnter",value:function(r){this.context.messageEndpoint.cancelPendingResponseCallbacks(Ze.ClientDisconnected)}},{key:"sendMessage",value:function(r,o,s,a){if(g.matchesTypesFor(r,[Ne.getTypeName()]))this.context.setState(ue.Initing),Wu(this.context,r,o,s);else if(g.matchesTypesFor(r,[be.getTypeName()]))this.context.setState(ue.Closed);else{if(!a){bg(this.context,r,o,s);return}o&&o(new ee({messageId:r.messageId,error:Rt.DroppedBecauseClientDisconnected}))}}},{key:"sendBytes",value:function(r){Mg(this.context,r)}}])})(ds),Rg=(function(t){function n(){var e;return(0,yr.default)(this,n),e=fs(this,n,arguments),e.stateName=ue.Closed,e.possibleNextStates=[],e}return(0,Pi.default)(n,t),(0,vr.default)(n,[{key:"onEnter",value:function(r){this.context.messageEndpoint.cancelPendingResponseCallbacks(Ze.ClientClosed)}}])})(ds);p();var Zg=C(F()),ep=C(G());p();var zg=C(F()),jg=C(G());p();p();var Pg=C(F()),Ng=C(G());var Dg=3e4,Fu=(function(){function t(n,e,r){(0,Pg.default)(this,t),this.lastPingTime=0,this.lastPongTime=0,this.isPingPongSuccessful=!1,this.pingPongLogOp=new b({operationName:"WebSocketReliabilityManager",success:!0,resourceId:""}).start(),this.pingPongLogOp.setClientMetadata(r,!0),this.worker=n,this.rateControllerClose=e}return(0,Ng.default)(t,[{key:"start",value:function(){this.pingPongLogOp.start(),this.pingPongLogOp.resultSignature="initial ping",this.ping(),this.isPingPongSuccessful=!0,this.startInterval()}},{key:"onResponse",value:function(){this.lastPongTime=Date.now(),this.pingPongLogOp.success=!0,h.info(506795283,y.CoreDefault,this.pingPongLogOp.stop())}},{key:"isReliabilityResponse",value:function(e){return typeof e=="string"&&e.length===1&&e===t.pingPongMessage}},{key:"close",value:function(){this.pingPongLogOp.start(),this.pingPongLogOp.success=!0,this.pingPongLogOp.resultSignature="close",h.info(506795282,y.CoreDefault,this.pingPongLogOp.stop()),this.lastPingTime=0,this.lastPongTime=0,this.isPingPongSuccessful=!1,this.clearPingInterval(),this.worker=void 0}},{key:"checkConnection",value:function(){return this.isPingPongSuccessful}},{key:"postEgress",value:function(){}},{key:"needsParsedResponses",value:function(){return!1}},{key:"ping",value:function(){this.worker?(this.lastPingTime=Date.now(),this.worker.egress({obj:t.pingPongMessage})):(this.pingPongLogOp.success=!1,this.pingPongLogOp.resultDescription="websocket worker undefined",this.rateControllerClose(),h.info(506795281,y.CoreDefault,this.pingPongLogOp.stop()))}},{key:"startInterval",value:function(){var e=this;this.pingInterval=setInterval(function(){e.lastPongTime<e.lastPingTime&&Date.now()-e.lastPingTime<Dg||(e.isPingPongSuccessful=e.lastPongTime>=e.lastPingTime,e.pingPongLogOp.start(),e.isPingPongSuccessful?(e.pingPongLogOp.resultSignature="ping",e.ping()):(e.pingPongLogOp.success=!1,e.pingPongLogOp.resultDescription="Pong not received",h.info(506795280,y.CoreDefault,e.pingPongLogOp.stop()),e.worker?e.worker.close():e.rateControllerClose()))},Dg)}},{key:"clearPingInterval",value:function(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=void 0)}}])})();Fu.pingPongMessage="~";p();var Eg=C(F()),Lg=C(G());var fv=15e3,dv=2e4,gv=6e4,Og="Request timed out",Bg=4,Wg=(function(){function t(n,e,r){(0,Eg.default)(this,t),this.remainingRetryAttempts=Bg,this.isAsleep=!1,this.isLongPollSuccessful=!1,this.isActiveLongPoll=!1,this.isResponseReceived=!1,this.lastEgressTime=0,this.longPollLogOp=new b({operationName:"OnLongPollMessage",success:!0}),this.clientMetadata=e,this.sessionCorrelationVector=r,this.longPollLogOp.setClientMetadata(this.clientMetadata,!0),this.worker=n}return(0,Lg.default)(t,[{key:"start",value:function(){var e=new b({operationName:"StartHttpReliabilityManager",success:!0}).start();e.setClientMetadata(this.clientMetadata,!0),h.info(508163399,y.CoreDefault,e.stop()),this.trySendLongPoll(jt.Start,!0),this.isLongPollSuccessful=!0}},{key:"onResponse",value:function(e){if(!e||this.isResponseReceived){var r=new b({operationName:"HttpReliabilityManagerFailure",success:!1}).start();r.setClientMetadata(this.clientMetadata,!0),h.info(508162497,y.CoreDefault,r.stop());return}this.isResponseReceived=!0,this.isActiveLongPoll=!1;var o=e;if(o.error)if(this.isLongPollSuccessful=!1,--this.remainingRetryAttempts,this.remainingRetryAttempts>0){this.longPollLogOp.success=!1,this.longPollLogOp.resultDescription=`Retry attempts left : ${this.remainingRetryAttempts}`,this.longPollLogOp.resultSignature=o.error,h.info(508163398,y.CoreDefault,this.longPollLogOp.stop());var s=o.error===Og?jt.TimeoutResend:jt.FailResend;o.error===Og||this.remainingRetryAttempts===3?this.trySendLongPoll(s,!0):this.enqueueSendLongPoll(s)}else this.longPollLogOp.success=!1,this.longPollLogOp.resultDescription="Long poll still not received after all retry attempts",h.info(508163397,y.CoreDefault,this.longPollLogOp.stop()),this.worker&&this.worker.close();else this.longPollLogOp.success=!0,this.longPollLogOp.resultDescription="Long poll received",h.info(508163401,y.CoreDefault,this.longPollLogOp.stop()),this.remainingRetryAttempts=Bg,this.isLongPollSuccessful=!0,this.trySendLongPoll(jt.Regular)}},{key:"close",value:function(){var e=new b({operationName:"CloseHttpReliabilityManager",success:!0}).start();e.setClientMetadata(this.clientMetadata,!0),h.info(508162467,y.CoreDefault,e.stop()),this.sendLongPollTimer&&(clearTimeout(this.sendLongPollTimer),this.sendLongPollTimer=void 0),this.isActiveLongPoll=!1,this.isLongPollSuccessful=!1,this.worker=void 0}},{key:"checkConnection",value:function(){if(this.isAsleep){this.isAsleep=!1;var e=new b({operationName:"AwakenHttpReliabilityManager",success:!0}).start();e.setClientMetadata(this.clientMetadata,!0),h.info(508162496,y.CoreDefault,e.stop()),this.trySendLongPoll(jt.CheckConnection,!0)}return this.isLongPollSuccessful}},{key:"isReliabilityResponse",value:function(e){return typeof e!="string"&&Jt.typeGuard(e)}},{key:"postEgress",value:function(){this.lastEgressTime=Date.now(),this.trySendLongPoll(jt.PostEgress)}},{key:"needsParsedResponses",value:function(){return!0}},{key:"enqueueSendLongPoll",value:function(e){var r=this;this.sendLongPollTimer=setTimeout(function(){r.trySendLongPoll(e,!0)},dv)}},{key:"trySendLongPoll",value:function(e,r){if(!this.worker){var o=new b({operationName:"LongPollNoOp",success:!0}).start();o.setClientMetadata(this.clientMetadata,!0),o.resultDescription="Worker is undefined",h.info(507281438,y.CoreDefault,o.stop());return}if(this.isActiveLongPoll===!0){var s=new b({operationName:"LongPollNoOp",success:!0}).start();s.setClientMetadata(this.clientMetadata,!0),s.resultDescription="Already active long poll",h.info(508163396,y.CoreDefault,s.stop());return}if(this.isActiveLongPoll=!0,Date.now()-this.lastEgressTime>gv&&!r){this.isActiveLongPoll=!1,this.isAsleep=!0;var a=new b({operationName:"LongPollSleep",success:!0}).start();a.setClientMetadata(this.clientMetadata),a.resultDescription=`isAsleep: ${this.isAsleep}, isActiveLongPoll: ${this.isActiveLongPoll}`,h.info(507278739,y.CoreDefault,a.stop());return}this.longPollLogOp.start(),this.isResponseReceived=!1,this.worker.egress({obj:this.getLongPollMessageString(e),isHttpSessionLongPollMessage:!0,isHttpSessionInitMessage:!1})}},{key:"getLongPollMessageString",value:function(e){var r=new Dn({longPollTimeoutHint:fv,type:e});return this.sessionCorrelationVector&&(r.cv=this.sessionCorrelationVector().newChild().toString()),JSON.stringify(r)}}])})();var Fg=function(n,e,r,o){return n instanceof cs?new Wg(n,r,o):new Fu(n,e,r)};var Jg=C(Eu());var Gg=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},$g=50,Ug=1e5,qg=3e6,Hg=1e3,pv=1e4,Vg=.8,Kg=(function(){function t(){var n=this;(0,zg.default)(this,t),this.emptyMessageId=0,this.egressMessageCount=0,this.egressByteCount=0,this.prevSeq=-1,this.rpsThreshold=150,this.bpsThreshold=5e8,this.isClosing=!1,this.messageQueue=void 0,this.egressRateLogOp=new b({operationName:"NetworkEgressRate",success:!0}),this.egressedCache=new Map,this.initPromise=new Promise(function(e){n.resolveInitPromise=e}),this.messageQueue=new Jg.default}return(0,jg.default)(t,[{key:"init",value:function(e,r,o,s,a){var u=this;this.worker=e,this.ingress=r,this.clientMetadata=s,this.networkMode=o,this.reliabilityManager=Fg(this.worker,this.close.bind(this),void 0,a),this.egressRateLogOp.setClientMetadata(this.clientMetadata,!0),this.resetRateLimiter(),this.onCloseController=new Promise(function(l){u.resolveCloseControllerPromise=l}),this.queueProcessingCompletePromise=new Promise(function(l){u.resolveQueueProcessingCompletePromise=l}),this.resolveInitPromise()}},{key:"open",value:function(){var e=this,r=new b({operationName:"NetworkRateControllerOpen",success:!0,dimension3:`networkMode: ${this.networkMode}`}).start();r.setClientMetadata(this.clientMetadata,!0),this.initPromise.then(function(){if(!e.reliabilityManager){r.success=!1,r.resultDescription="Reliability Manager is undefined";return}e.egressRateControlIntervalStart=Date.now(),e.reliabilityManager.start(),e.processQueue()}).catch(function(o){var s;r.success=!1,r.resultDescription="Catch: "+((s=o==null?void 0:o.message)!==null&&s!==void 0?s:"")}).finally(function(){h.info(507834384,y.CoreDefault,r.stop())})}},{key:"ingressFromWorker",value:function(e,r){var o=this;if(!this.reliabilityManager){this.ingress(e,r);return}if(!this.reliabilityManager.needsParsedResponses()&&this.reliabilityManager.isReliabilityResponse(e)){this.reliabilityManager.onResponse();return}this.ingress(e,function(s){r==null||r(s),o.reliabilityManager.needsParsedResponses()&&o.reliabilityManager.isReliabilityResponse(s)&&o.reliabilityManager.onResponse(s)})}},{key:"onRateLimitErrorResponse",value:function(e){var r=new b({operationName:"NetworkRateControllerOnRateLimitResponse",success:!0}).start();r.setClientMetadata(this.clientMetadata,!0),r.resultSignature=`rateLimitAlreadyStarted: ${this.rateLimitTimeout!==void 0}`,r.setDataField("RetryAfterMs",e.retryAfterMs),r.setDataField("QueueSize",this.messageQueue.length),this.startRateLimiting(e.retryAfterMs),h.info(507388684,y.CoreDefault,r.stop())}},{key:"setRpsBps",value:function(e,r){var o=new b({operationName:"NetworkRateControllerRateLimitsSet",success:!0}).start();o.setClientMetadata(this.clientMetadata,!0),e&&(this.rpsThreshold=Vg*e,o.resultDescription+=`maxRPS: ${e}, rpsThreshold: ${this.rpsThreshold}; `),r&&(this.bpsThreshold=Vg*r,o.resultDescription+=`maxRPS: ${r}, rpsThreshold: ${this.bpsThreshold}; `),h.info(507388683,y.CoreDefault,o.stop())}},{key:"close",value:function(){return Gg(this,void 0,void 0,function*(){var e,r,o=new b({operationName:"NetworkRateControllerClose",success:!0,dimension3:`networkMode: ${this.networkMode}`}).start();o.setClientMetadata(this.clientMetadata,!0),this.isClosing=!0,(e=this.resolveCloseControllerPromise)===null||e===void 0||e.call(this);var s=(r=this.reliabilityManager)===null||r===void 0?void 0:r.checkConnection();o.setDataField("QueueSizeBeforeFlush",this.messageQueue.length),this.messageQueue.length!=0&&s&&(yield this.queueProcessingCompletePromise),o.setDataField("QueueSizeAfterFlush",this.messageQueue.length),o.setDataField("IsConnected",s),this.reliabilityManager?this.reliabilityManager.close():o.resultDescription="Reliability Manager is undefined",this.worker=void 0,this.prevSeq=-1,this.clearEgressControlTimeout(),this.reliabilityManager=void 0,h.info(507834381,y.CoreDefault,o.stop())})}},{key:"clearMessageQueues",value:function(){this.egressedCache.clear(),this.messageQueue=void 0}},{key:"egress",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o,s;if(!this.reliabilityManager){this.logEgressActivity(!1,"Reliability Manager is undefined","");return}var a=this.getMessageSize(e);if(a>=qg){this.logEgressActivity(!1,`Message size exceeded ${qg}`,`Message size: ${a}`);return}if((e.obj instanceof ArrayBuffer||e.isHttpSessionInitMessage)&&this.worker){this.logEgressActivity(!0,`isArrayBuffer: ${e.obj instanceof ArrayBuffer}, isHttpSessionInitMessage: ${e.isHttpSessionInitMessage}`,""),this.worker.egress(e);return}this.validateSyncMessage(e.messageId,e.seqId);var u=(o=e.messageId)!==null&&o!==void 0?o:`id${this.emptyMessageId++}`,l={obj:e.obj,seqId:e==null?void 0:e.seqId,messageId:u,isHttpSessionInitMessage:e==null?void 0:e.isHttpSessionInitMessage},c=r>0,f=new b({operationName:"NetworkRateControllerQueueItem",success:!0,dimension3:`isRetry: ${c}`}).start();f.setClientMetadata(this.clientMetadata,!0);var d={message:l,logOp:f};if(c?this.messageQueue.unshift(d):this.messageQueue.push(d),this.messageQueue.length>pv){var m=this.messageQueue.shift(),v=`NetworkRateControllerQueue max size reached. Dropping messageId: ${m.message.messageId}`;throw m.logOp.resultDescription=v,m.logOp.success=!1,h.info(506001225,y.CoreDefault,m.logOp.stop()),new Error(v)}(s=this.resolveQueueNotEmptyPromise)===null||s===void 0||s.call(this)}},{key:"getMessageSize",value:function(e){return e.obj instanceof ArrayBuffer?e.obj.byteLength:e.obj.length}},{key:"sendToNetworkWorker",value:function(e){var r;try{if(!this.worker){this.logEgressActivity(!1,"NetworkWorker is undefined","SendToNetworkWorkerFailure");return}if(!this.reliabilityManager){this.logEgressActivity(!1,"Reliability Manager is undefined","SendToNetworkWorkerFailure");return}this.worker.egress(e),this.onSendToNetworkWorker(e),(r=this.reliabilityManager)===null||r===void 0||r.postEgress();var o=this.getMessageSize(e);this.logEgressCount(o)}catch(s){this.logEgressActivity(!1,"SendToNetworkWorkerFailure",s?s.message:"")}}},{key:"onSendToNetworkWorker",value:function(e){if(typeof e.obj=="string")try{var r=JSON.parse(e.obj);if(le.typeGuard(r)){var o=r;Vd(o,Date.now(),"SendToNetwork",new b({operationName:"AugloopClientPerfTracker",success:!0}).setClientMetadata(this.clientMetadata).start())}else if(Xe.typeGuard(r)){var s=r;Hd(s,"GetAnnotationsSendToNetwork",new b({operationName:"AugloopClientPerfTracker",success:!0}).setClientMetadata(this.clientMetadata).start())}}catch(a){}}},{key:"processQueue",value:function(){return Gg(this,void 0,void 0,function*(){var e,r,o;if(!this.reliabilityManager){var s=new b({operationName:"NetworkRateControllerProcessQueueFailure",success:!1,dimension3:`networkMode: ${this.networkMode}`}).start();s.setClientMetadata(this.clientMetadata,!0),s.resultDescription="Reliability Manager is undefined",h.info(507573643,y.CoreDefault,s.stop());return}for(var a=new b({operationName:"NetworkRateControllerProcessQueue",success:!0}).start();;){if(this.messageQueue.length===0){if(this.isClosing){a.setDataField("ExitReason","Stage#1 Closing");break}yield Promise.race([this.queueNotEmpty(),this.onCloseController])}if(this.rateLimitTimeout){var u=new b({operationName:"NetworkRateControllerRateLimitBackoff",dimension3:`networkMode: ${this.networkMode}`}).start();u.setClientMetadata(this.clientMetadata,!0),u.setDataField("QueueLengthBeforeBackoff",this.messageQueue.length),yield Promise.race([this.rateLimitTimeout,this.onCloseController]),u.setDataField("QueueLengthAfterBackoff",this.messageQueue.length),u.setDataField("IsClosing",this.isClosing),u.success=!0,this.rateLimitTimeout=void 0,this.resetRateLimiter(),h.info(507281410,y.CoreDefault,u.stop())}if(!(!((e=this.reliabilityManager)===null||e===void 0)&&e.checkConnection())){if(this.isClosing){a.setDataField("ExitReason","Stage#2 Closing");break}yield this.checkConnectionPromise(),this.connectionPromise=void 0}if(!this.reliabilityManager){a.setDataField("ExitReason","Stage#2 ReliabilityManager null");break}for(;this.messageQueue.length>0&&this.reliabilityManager.checkConnection();){var l=Date.now()-this.egressRateControlIntervalStart;if(l>=Hg)this.resetRateLimiter();else if(this.egressMessageCount>=this.rpsThreshold||this.egressByteCount>=this.bpsThreshold){var c=1100,f="";this.egressMessageCount>=this.rpsThreshold&&(f+="RPS exceeded."),this.egressByteCount>=this.bpsThreshold&&(f+="BPS exceeded.");var d="rateLimitHit",m=new b({operationName:"NetworkRateControllerEgress",dimension3:`networkMode: ${this.networkMode}`}).start();m.setClientMetadata(this.clientMetadata,!0),m.success=!0,m.resultDescription=d,m.resultSignature=f,m.dimension0=this.messageQueue.length.toString().length.toString(),m.dimension1="rateLimitHit",m.setDataField("QueueLength",this.messageQueue.length),m.setDataField("RateLimitDelayMs",c),h.info(507281409,y.CoreDefault,m.stop()),this.startRateLimiting(c);break}var v=this.messageQueue.shift();this.sendToNetworkWorker(v.message),h.info(507388682,y.CoreDefault,v.logOp.stop())}this.onQueueNotEmpty=void 0,this.resolveQueueNotEmptyPromise=void 0}(r=this.resolveQueueProcessingCompletePromise)===null||r===void 0||r.call(this),this.resolveQueueProcessingCompletePromise=void 0,a.setClientMetadata(this.clientMetadata,!0),a.setDataField("QueueSize",this.messageQueue.length),a.setDataField("IsConnected",(o=this.reliabilityManager)===null||o===void 0?void 0:o.checkConnection()),a.setDataField("IsClosing",this.isClosing),h.info(507368671,y.CoreDefault,a.stop())})}},{key:"queueNotEmpty",value:function(){var e=this;return this.onQueueNotEmpty||(this.onQueueNotEmpty=new Promise(function(r){e.resolveQueueNotEmptyPromise=r})),this.onQueueNotEmpty}},{key:"checkConnectionPromise",value:function(){return this.connectionPromise||(this.connectionPromise=new Promise(function(e){setTimeout(e,1e3)})),this.connectionPromise}},{key:"startRateLimiting",value:function(e){this.rateLimitTimeout||(this.rateLimitTimeout=new Promise(function(r){setTimeout(r,e)}))}},{key:"resetRateLimiter",value:function(){this.egressRateControlIntervalStart=Date.now(),this.egressMessageCount=0,this.egressByteCount=0}},{key:"clearEgressControlTimeout",value:function(){this.egressRateControlTimer&&(clearInterval(this.egressRateControlTimer),this.egressRateControlTimer=void 0)}},{key:"validateSyncMessage",value:function(e,r){if(!(r===void 0||e===void 0||r<=this.prevSeq)){if(r&&r!==this.prevSeq+1){var o=new b({operationName:"NetworkRateControllerAbandonedSyncMessage",success:!0,dimension3:`networkMode: ${this.networkMode}`}).start();o.setClientMetadata(this.clientMetadata,!0),o.resultDescription="Gap in sync message",o.dimension0=`${this.prevSeq}`,o.dimension1=`${r}`,o.dimension2=`${r-this.prevSeq}`,h.info(507834370,y.CoreDefault,o.stop())}this.prevSeq=r}}},{key:"logEgressActivity",value:function(e,r,o,s){var a,u,l,c,f=new b({operationName:"NetworkRateControllerEgress",dimension3:`networkMode: ${this.networkMode}`}).start();f.setClientMetadata(this.clientMetadata,!0),f.success=e,f.resultDescription=r,f.resultSignature=o,s&&(f.dimension0=(a=s[0])!==null&&a!==void 0?a:"",f.dimension1=(u=s[1])!==null&&u!==void 0?u:"",f.dimension2=(l=s[2])!==null&&l!==void 0?l:"",f.dimension3=(c=s[3])!==null&&c!==void 0?c:""),h.info(507626007,y.CoreDefault,f.stop())}},{key:"logEgressCount",value:function(e){var r=Date.now();r-this.egressRateControlIntervalStart>Hg&&((this.egressMessageCount>$g||this.egressByteCount>Ug)&&(this.egressRateLogOp.start(),this.egressRateLogOp.resultDescription=this.egressMessageCount>$g?"rps logging threshold exceeded":"",this.egressRateLogOp.resultDescription=this.egressByteCount>Ug?"bps logging threshold exceeded":"",this.egressRateLogOp.dimension0=(r-this.egressRateControlIntervalStart).toString(),this.egressRateLogOp.dimension1=`${this.egressMessageCount}`,this.egressRateLogOp.dimension2=`${this.egressByteCount}`,this.egressRateLogOp.dimension3=`networkMode: ${this.networkMode}`,h.info(508843792,y.CoreDefault,this.egressRateLogOp.stop())),this.egressRateControlIntervalStart=r,this.egressMessageCount=0,this.egressByteCount=0),this.egressMessageCount++,this.egressByteCount+=e!=null?e:0}}])})();p();var Qg=C(F()),Yg=C(G()),Xg=C(Re());var hv=1e3,Gu=["cloud.dev.microsoft","officeppe.com","cloud.microsoft","office.com","office365.us","ic.gov","microsoft.scloud","microsoftonline.cn"],Cr=function(n,e,r,o){return new ta(n,function(s){return s.success&&r.indexOf(s[e])>=0},[e,"ariaNamespace","resourceId","success","resultSignature","clientDocSessionId","dimension0","dimension1","dimension2","dimension3"],["durationMs"],o)},$u=function(n){Gu.push.apply(Gu,(0,Xg.default)(n))},et=function(n){if(!n)return n;for(var e of Gu)if(n.indexOf(e)>=0)return n;return"**redacted**"},Sr=(function(){function t(n){(0,Qg.default)(this,t),this.level=q.info,this.hostCallbacks=n}return(0,Yg.default)(t,[{key:"log",value:function(e){var r=this;if(!(this.hostCallbacks==null||this.hostCallbacks.sendTelemetryEvent==null)){var o=function(f,d,m,v,_){var S=d.charAt(0).toUpperCase()+d.slice(1),M={DocSessionId:f.clientDocSessionId,ResourceId:f.resourceId,ResultDescription:f.resultDescription,ResultSignature:f.resultSignature,Dimension0:f.dimension0,Dimension1:f.dimension1,Dimension2:f.dimension2,Dimension3:f.dimension3,JoinContextId:f.joinContextId,ServerSessionKey:r.serverSessionKey};m&&(M=Object.assign(Object.assign({},M),JSON.parse(m)));var k=v||t.augLoopAriaTenantToken,w=!_&&k==t.augLoopAriaTenantToken?t.augLoopAriaNamespace:_;S=S||t.operationNamePlaceholder;var P={CV:f.cv,Duration:(f.durationMs||0)*hv,Count:f.count,AggMode:2,Success:f.success};r.hostCallbacks.sendTelemetryEvent(k,w?`${w}_${S}`:S,M,"Office.System.Activity",P,!1,Jr.ProductServiceUsage|Jr.ProductServicePerformance,No.RequiredServiceDataEvent)},s=function(f,d,m){r.hostCallbacks.sendDiagnosticTrace&&r.hostCallbacks.sendDiagnosticTrace(f,d,m)};if(e.category!="Workflow.MetricsOnly")if(e.eventName==="Operation"){var a=e;o(a,a.operationName,a.dataFields,void 0,a.ariaNamespace)}else if(e.eventName==="SessionHealth"){var u=e;o(u,u.sessionHealthEventName)}else if(e.eventName==="WorkflowOperation"){var l=e;o(l,l.operationName,l.dataFields,l.ariaTenant,l.ariaNamespace)}else e.eventName==="Log"&&s(e.tagId,e.traceLevel,e.message)}}},{key:"setServerSessionKey",value:function(e){this.serverSessionKey=e}}])})();Sr.augLoopAriaTenantToken="3de4087d4de34817b1c376e3d1e6e293-983c4292-5ba9-485a-ab10-9797863c788b-6770";Sr.augLoopAriaNamespace="Office_AugLoop_Client";Sr.operationNamePlaceholder="OperationNameNotProvided";var tp=1e3,mv=function(n,e,r){var o=0,s=Y.getCurrentTimeMs()?Y.getCurrentTimeMs()-e:0,a=[1e3,2e3,5e3,1e4,6e4];return o=a[Math.max(0,Math.min(a.length-1,n-1))],o=Math.max(o-s,tp),o=r&&r>0?Math.min(5e3,o):o,o},Ni=(function(){function t(n,e,r,o,s,a,u,l,c){var f=this;(0,Zg.default)(this,t),this.logCountLimiter=new jn(t.className),this.isWorkerReady=!1,this.permanentlyClosed=!1,this.currentReconnectAttempt=0,this.lastInitializationAttemptTimeMs=0,this.offlineInterval=void 0,this.alreadyLoggedReconnectAttempt=!1,this.httpTestsLeft=5,this.httpTestsSuccessCount=0,this.workerOpenCount=0,this.testHttpConnection=function(d){var m=Y.convertWebSocketUrlToHttp(f.globalUrl),v=!d,_=d!=null?d:new b({operationName:"HttpsTest",resourceId:et(m),success:!1,resultDescription:"",resultSignature:"HttpResponse:"}).start(),S={method:"POST",headers:{"content-type":"application/json","X-CorrelationId":_.cv},body:JSON.stringify(Y.createHealthCheckRequest(f.clientMetadata))};return new Promise(function(M){xn(m,S,function(k,w){var P=!1;k?(_.dimension1="HttpErr",_.resultDescription+=`HttpErr: ${k.message}`):!w||!w.ok?(_.dimension1="HttpNoResp",_.resultDescription+=`HttpStatus: ${w==null?void 0:w.status}`):(_.dimension1="HttpOK",f.leaveOfflineMode(),f.httpTestsSuccessCount++,P=!0,v&&(_.success=!0)),v&&_.stop(),f.logCountLimiter.log(function(){h.info(508843780,y.CoreDefault,_)}),M(P)})})},this.globalUrl=n,this.clientMetadata=e,this.workerFactory=r,this.sessionInitializer=o,this.ingress=s,this.onConnectionClose=a,this.sessionCorrelationVector=u,this.preserveSliceUrlOnOffline=l.preserveSliceUrlOnOffline,this.offlineConnectionCheckIntervalMs=l.offlineConnectionCheckIntervalMs,this.networkWorkerLogOp=new b({operationName:"CreateNetworkWorker",success:!0}),this.networkMode=c||ce.JSWebSockets,this.initNetworkMode=this.networkMode}return(0,ep.default)(t,[{key:"init",value:function(e,r){var o=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(this.permanentlyClosed)return Promise.reject(new Error("permanentlyClosed"));if(this.isWorkerReady||this.pendingInitPromise)return this.pendingInitPromise?this.pendingInitPromise:Promise.resolve();this.extensionConfigs=e||this.extensionConfigs;var a=function(){if(s||!o.alreadyLoggedReconnectAttempt){var l=s?t.initialAttemptTimeout:t.reconnectAttemptTimeout;o.connTimeout=setTimeout(function(){var c=new b({operationName:"ConnectionFailingOrSlow",dimension0:s?"Initial":"Reconnect",dimension1:l.toString(),dimension2:o.currentReconnectAttempt.toString()});h.info(508843787,y.CoreDefault,c),o.alreadyLoggedReconnectAttempt=!s,o.connTimeout=void 0},l)}};return r?this.pendingInitPromise=r().catch(function(u){var l=new b({operationName:"WorkerManagerCustomInit",success:!1,resultDescription:`${u}`});h.error(508843786,y.CoreDefault,l)}).then(function(){a(),o.initInternal()}):(this.pendingInitPromise=Promise.resolve(),a(),this.initInternal()),this.pendingInitPromise}},{key:"egress",value:function(e,r){var o=this;return!this.isWorkerReady&&this.pendingInitPromise?this.pendingInitPromise.then(function(){o.egressInternal(e,r)}):(this.egressInternal(e,r),Promise.resolve())}},{key:"egressBytes",value:function(e){var r=this;return!this.isWorkerReady&&this.pendingInitPromise?this.pendingInitPromise.then(function(){r.egressBytesInternal(e)}):(this.egressBytesInternal(e),Promise.resolve())}},{key:"getNetworkMode",value:function(){return this.networkMode}},{key:"getInitNetworkMode",value:function(){return this.initNetworkMode}},{key:"onRateLimitErrorResponse",value:function(e){this.getNetworkRateController().onRateLimitErrorResponse(e)}},{key:"close",value:function(e){this.isWorkerReady=!1,this.networkRateController&&this.getNetworkRateController().close(),this.worker&&(this.worker.close(),this.worker=null),this.networkRateController=null,this.permanentlyClosed=e||this.permanentlyClosed,this.permanentlyClosed&&(this.leaveOfflineMode(),clearTimeout(this.connTimeout))}},{key:"initInternal",value:function(){var e=this;if(this.isWorkerReady=!1,this.permanentlyClosed||this.isOffline()){var r=new b({operationName:"WorkerManagerInitOffline",success:!0,resultSignature:this.permanentlyClosed?"PermanentlyClosed":"Offline"});h.info(508843785,y.CoreDefault,r);return}this.currentReconnectAttempt>0?setTimeout(function(){e.tryToConnectAndInitializeSession()},mv(this.currentReconnectAttempt,this.lastInitializationAttemptTimeMs,this.httpTestsSuccessCount)):this.getNetworkMode()===ce.HttpFallback?setTimeout(function(){e.tryToConnectAndInitializeSession()},100):this.tryToConnectAndInitializeSession()}},{key:"egressInternal",value:function(e,r){if(!this.isWorkerReady&&!g.matchesTypesFor(e,[Ne.getTypeName()])){g.matchesTypesFor(e,[Te.getTypeName()])||h.error(508843784,y.CoreDefault,new b({operationName:"UnexpectedEgressCall",resultDescription:`isWorkerReady: ${this.isWorkerReady}`}));return}var o;g.matchesTypesFor(e,[Nn.getTypeName()])?(this.castBinaryData(e),o=xt.serialize(e)):o=JSON.stringify(e);var s;if(le.typeGuard(e)&&(s=e.seq),this.bypassRateController(e)){this.worker.egress({obj:o});return}var a=Ne.typeGuard(e)&&this.getNetworkMode()===ce.HttpFallback;this.getNetworkRateController().egress({obj:o,isHttpSessionInitMessage:a,messageId:e.messageId,seqId:s},r)}},{key:"bypassRateController",value:function(e){return be.typeGuard(e)}},{key:"egressBytesInternal",value:function(e){if(!this.isWorkerReady){h.error(508843783,y.CoreDefault,new b({operationName:"UnexpectedEgressBytesCall",resultDescription:`isWorkerReady: ${this.isWorkerReady}`}));return}this.getNetworkRateController().egress({obj:e})}},{key:"tryToConnectAndInitializeSession",value:function(){var e=this;this.currentReconnectAttempt++,this.lastInitializationAttemptTimeMs=Y.getCurrentTimeMs();var r=function(a){if(!(e.permanentlyClosed||e.isOffline())){var u=e.sliceUrl?e.sliceUrl:e.globalUrl;a.setDataField("connectionUrl",et(u)),e.connect(u),e.sessionInitializer.initSession({isTokenRefresh:!1,isReconnectOnSameSlice:!!e.sliceUrl,extensionConfigs:e.extensionConfigs,onResponse:function(c,f){if(a.success=!c,a.resourceId=f?et(f.sliceUrl):"",a.dimension2=e.getNetworkModeLogString(),e.getNetworkMode()===ce.HttpFallback?(a.resultDescription=c?`HTTP Error: ${c.error}`:"",a.dimension0=a.success?"HTTPOK":"HTTPFail"):(a.resultDescription=c?`WS Error: ${c.error}`:"",a.dimension0=a.success?"WSOK":"WSFail"),c||!e.worker){e.preserveSliceUrlOnOffline?e.sliceUrl&&(a.resultDescription+=" SliceUrlPreserved"):(e.sliceUrl=void 0,a.resultDescription+=" SliceUrlCleared"),e.close(),e.httpTestsLeft>0?(e.httpTestsLeft--,e.testHttpConnection(a.stop()).then(function(m){m&&e.preserveSliceUrlOnOffline&&e.httpTestsSuccessCount>1&&(e.sliceUrl=void 0,h.info(495842882,y.CoreDefault,new b({operationName:"SliceUrlClearedAfterHttpSuccess",success:!0})))})):(e.getNetworkMode()===ce.JSWebSockets?e.workerOpenCount===0&&e.httpTestsSuccessCount>=5?(a.dimension1="WSBlocked",a.dimension3="HTTP Fallback",e.networkMode=ce.HttpFallback,e.currentReconnectAttempt=0,e.resetHttpTestsCounter()):e.httpTestsSuccessCount===0&&(e.startOfflineMode(),a.dimension1="WSOffline"):e.httpTestsSuccessCount===0&&(e.startOfflineMode(),a.dimension1="HTTPOffline"),e.logCountLimiter.log(function(){h.info(508843782,y.CoreDefault,a.stop())})),e.initInternal();return}else if(e.logCountLimiter.log(function(){h.info(508843781,y.CoreDefault,a.stop())}),f.forceReconnect){e.close();var d=new b({operationName:"ForcedReconnect"}).start();d.resultSignature=`globalUrl: ${e.globalUrl}. sliceUrl: ${e.sliceUrl}`,e.sliceUrl=void 0,setTimeout(function(){r(d)},tp)}else clearTimeout(e.connTimeout),e.sliceUrl=f.sliceUrl,e.getNetworkRateController().setRpsBps(f.maxRPS,f.maxBPS),e.ready();e.resetHttpTestsCounter()}})}},o=new b({operationName:"TryToConnectAndInitializeSession",resultSignature:`Reconnection attempt #${this.currentReconnectAttempt}`}).start();r(o)}},{key:"getNetworkRateController",value:function(){return this.networkRateController||(this.networkRateController=new Kg),this.networkRateController}},{key:"connect",value:function(e){var r=this,o=this.getNetworkMode();this.networkWorkerLogOp.start(),this.networkWorkerLogOp.resultDescription=this.getNetworkModeLogString(),this.networkWorkerLogOp.dimension0=o.toString(),this.logCountLimiter.log(function(){return h.info(508372418,y.CoreDefault,r.networkWorkerLogOp.stop())}),this.worker=this.workerFactory(o),this.worker.init(e,this.getNetworkRateController().ingressFromWorker.bind(this.networkRateController),function(){r.workerOpenCount++,r.getNetworkRateController().open(),r.leaveOfflineMode()},function(s){r.close(),r.onConnectionClose(s)},this.clientMetadata),this.getNetworkRateController().init(this.worker,this.ingress,o,this.clientMetadata,this.sessionCorrelationVector)}},{key:"ready",value:function(){this.isWorkerReady=!0,this.pendingInitPromise=void 0,this.currentReconnectAttempt=0}},{key:"castBinaryData",value:function(e){if(e){if(Array.isArray(e.__binaryMembers__))for(var r of e.__binaryMembers__)ArrayBuffer.isView(e[r])||(e[r]=new Uint8Array(e[r]));for(var o of Object.keys(e))typeof e[o]=="object"&&e[o]!==null&&this.castBinaryData(e[o])}}},{key:"isOffline",value:function(){return!!this.offlineInterval}},{key:"startOfflineMode",value:function(){var e=this;this.offlineInterval=setInterval(function(){e.testHttpConnection()},this.offlineConnectionCheckIntervalMs)}},{key:"leaveOfflineMode",value:function(){this.isOffline()&&(clearInterval(this.offlineInterval),this.offlineInterval=void 0,this.resetHttpTestsCounter(),this.tryToConnectAndInitializeSession())}},{key:"resetHttpTestsCounter",value:function(){this.httpTestsLeft=5,this.httpTestsSuccessCount=0}},{key:"getNetworkModeLogString",value:function(){return"NetworkMode: "+(this.getNetworkMode()===ce.JSWebSockets?"WebSocket":"HTTP")}}])})();Ni.initialAttemptTimeout=1e5;Ni.reconnectAttemptTimeout=2e4;Ni.className="NetworkWorkerManager";function yv(t,n,e){return n=(0,Uu.default)(n),(0,ip.default)(t,sp()?Reflect.construct(n,e||[],(0,Uu.default)(t).constructor):n.apply(t,e))}function sp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(sp=function(){return!!t})()}var qu=(function(t){function n(e,r,o,s,a,u,l,c,f){var d;return(0,np.default)(this,n),d=yv(this,n),d.cvParent=new Ke,d.logOp=new b({operationName:"SessionState",success:!0}).start(),d.sessionStateChangeLogCountLimiter=new jn("SessionState"),d.stats=r,d.allStates=(0,Oi.default)((0,Oi.default)((0,Oi.default)((0,Oi.default)({},ue.Initing,new Ig(d)),ue.Running,new xg(d)),ue.Disconnected,new Ag(d)),ue.Closed,new Rg(d)),d.setState(ue.Initing),d.messageEndpoint=new md({messageIdPrefix:"c",responseTimeoutMs:3e4,resendPendingMessagesOnReconnect:!1}),d.messageEndpoint.setClientMetadata(a),d.messageEndpoint.setEgress(d.egress.bind(d)),d.messageEndpoint.onMessage(be.getTypeName(),function(m,v){d.onSessionCloseMessage(m,v)}),d.networkWorkerManager=new Ni(e,a,o,s,d.ingress.bind(d),d.onConnectionClose.bind(d),d.getCorrelationVector.bind(d),l,f),d.messageQueue=new _g({sendMessage:function(v,_,S,M){return d.state.sendMessage(v,_,S,M)},sendBytes:d.sendBytes.bind(d),canSendMessage:function(){return d.state.canSendMessage()}}),s.on("connect",function(m,v,_,S,M,k,w,P,R){d.setState(ue.Running,"",{isSessionReseedingStarted:m&&v}),d.emit("connect",m,_,S,M,k,w,P,R)}),s.on("reconnect",function(){return d.emit("reconnect")}),s.on("serverAuthenticationStateChange",function(m){return d.emit("serverAuthenticationStateChange",m)}),d.resetNextSyncSequenceId=function(){return d.emit("resetNextSyncSequenceId")},d.tokenRefreshManager=u,d.gateUtils=c,d}return(0,op.default)(n,t),(0,rp.default)(n,[{key:"setState",value:function(r,o,s){var a=this;if(!(this.state&&r===this.state.stateName)){var u=this.state?ue[this.state.stateName]:"undefined",l=this.state?this.state.possibleNextStates.indexOf(r)>=0:r===ue.Initing;this.sessionStateChangeLogCountLimiter.log(function(){a.logOp.stop(),a.logOp.resourceId=`New state: ${l?ue[r]:u}`,a.logOp.resultDescription=`Previous state: ${u}`,a.logOp.dimension0=`Attempted state: ${ue[r]||"undefined"}`,a.logOp.resultSignature=o+(a.state&&!l?"Unexpected state change":""),a.logOp.success=l,h.info(508843791,y.CoreDefault,a.logOp)}),l&&(this.state=this.allStates[r],this.logOp.start(),this.state.onEnter(s))}}},{key:"init",value:function(r,o){return this.extensionConfigs=r,this.customInitPromise=o,this.networkWorkerManager.init(this.extensionConfigs,this.customInitPromise,!0)}},{key:"sendMessage",value:function(r,o,s){this.retrySendMessage(r,o,n.maxRetries,s)}},{key:"sendBytes",value:function(r){this.state.sendBytes(r)}},{key:"onMessage",value:function(r,o){this.messageEndpoint.onMessage(r,o)}},{key:"getCorrelationVector",value:function(){return this.cvParent}},{key:"getNetworkWorkerManager",value:function(){return this.networkWorkerManager}},{key:"forceReconnect",value:function(r){var o=this;return this.extensionConfigs=r||this.extensionConfigs,this.networkWorkerManager.close(!1),new Promise(function(s){return setTimeout(function(){s(o.networkWorkerManager.init(o.extensionConfigs))},100)})}},{key:"closeSession",value:function(r){this.sendMessage(new be),this.networkWorkerManager.close(!0);var o=r||new vi({reasonDescription:"ClientRequested"});this.onSessionClose(new be({reconnectAllowed:!1,reason:o}),"ClientRequested")}},{key:"ingress",value:function(r,o){var s=this,a;try{a=JSON.parse(r)}catch(c){h.error(508843790,y.CoreDefault,new b({operationName:"ProcessMessage",resourceId:"Unknown",success:!1,resultSignature:"ParseError",resultDescription:c.message,durationMs:0}))}if(a){if(o&&Te.typeGuard(a)&&o(a),this.networkWorkerManager.getNetworkMode()===ce.HttpFallback&&Jt.typeGuard(a)){var u=a;if(u.batch)for(var l of u.batch)this.messageEndpoint.ingress(l,function(c,f){return s.egress(c||f,function(){})});return}this.messageEndpoint.ingress(a,function(c,f){return s.egress(c||f,function(){})})}}},{key:"egress",value:function(r,o,s){r&&this.networkWorkerManager.egress(r,s).then(function(){return o()}).catch(function(a){return o(a)})}},{key:"onSessionCloseMessage",value:function(r,o){r.reconnectAllowed?this.networkWorkerManager.close():this.onSessionClose(r,"CloseMessageReceived"),o()}},{key:"onSessionClose",value:function(r,o){this.setState(ue.Closed,o),this.tokenRefreshManager.clearAllTimeouts(),this.onConnectionClose(void 0),r&&this.emit("sessionClose",r)}},{key:"onConnectionClose",value:function(r){this.state.onConnectionClose(),this.stats.lastConnectionClose=Y.getCurrentTimeMs(),this.emit("disconnect",r)}},{key:"retrySendMessage",value:function(r,o,s,a,u){var l=this,c=n.maxRetries-s;this.state.sendMessage(r,function(f,d){var m,v,_,S,M,k;u&&(f&&s==0?(u.dimension0=(c+1).toString(),u.success=!1,h.info(507025311,y.CoreDefault,u.stop())):f&&s>0?(u.dimension0=(c+1).toString(),u.dimension1=(v=(m=f.code)===null||m===void 0?void 0:m.toString())!==null&&v!==void 0?v:"NoErrorCode",u.resultSignature=(_=f.error)!==null&&_!==void 0?_:"NoErrorMessage"):(u.success=!0,h.info(507025310,y.CoreDefault,u.stop()))),f&&s>0&&l.canBeRetried(r)&&l.isTransientError(f)?(u||(u=new b({operationName:"RetrySendMessage",success:!0,dimension0:(c+1).toString()}).start(),u.resourceId=g.getTypeNameFor(r),u.dimension1=(M=(S=f.code)===null||S===void 0?void 0:S.toString())!==null&&M!==void 0?M:"NoErrorCode",u.resultSignature=(k=f.error)!==null&&k!==void 0?k:"NoErrorMessage",u.resultDescription=`Retrying message with messageId: ${r.messageId}${le.typeGuard(r)?`, seq: ${r.seq}`:""}`),g.matchesTypesFor(f,[yi.getTypeName()])&&l.networkWorkerManager.onRateLimitErrorResponse(f),l.retrySendMessage(r,o,s-1,a,u)):o&&o(f,d)},c,a)}},{key:"canBeRetried",value:function(r){return!g.matchesTypesFor(r,[Ne.getTypeName(),Nn.getTypeName(),Xe.getTypeName()])}},{key:"isTransientError",value:function(r){var o=r.error,s=r.code;return s===Ie.TokenValidationError||s===Ie.TokenDecryptError||s===Ie.SyncMessageTooLateOrDuplicate||s===Ie.Gone?!1:o!==Ze.SyncMessageUnsupportedBatch&&o!==Ze.UnexpectedSeedMessage&&o!==Ze.UnsupportedSyncMessage&&o!==Ze.AnnotationTokenNotFound&&o!==Rt.ArrivedBeforeReseeding&&o!==Rt.DroppedAsOldestInQueue&&o!==Rt.DroppedBecauseClientDisconnected}}])})(ap.EventEmitter);qu.maxRetries=2;p();var cp=C(F()),fp=C(G()),dp=C(ut()),Hu=C(Je()),gp=C(lt());p();var up=C(F()),lp=C(G()),Bi;(function(t){t[t.Anonymous=0]="Anonymous",t[t.Host=1]="Host"})(Bi||(Bi={}));var kr=(function(){function t(){(0,up.default)(this,t),this.timers=new Map}return(0,lp.default)(t,[{key:"scheduleRefresh",value:function(e,r,o,s){var a=this.timers.get(e);a||(a={numberOfAttempts:0},this.timers.set(e,a)),a.refreshTimeoutId&&(clearTimeout(a.refreshTimeoutId),a.refreshTimeoutId=void 0),a.expiredTimeoutId&&(clearTimeout(a.expiredTimeoutId),a.expiredTimeoutId=void 0);var u=r*1e3-t.tokenRefreshBufferMs,l=r*1e3-t.tokenExpirationBufferMs;u>0?a.numberOfAttempts=0:(++a.numberOfAttempts,u=t.tokenRefreshBackoffIntervalMs,l=t.tokenExpirationBufferMs),a.numberOfAttempts<=t.tokenRefreshMaximumAttempts&&(a.refreshTimeoutId=setTimeout(function(){o()},u)),s&&(a.expiredTimeoutId=setTimeout(function(){s()},l))}},{key:"clearRefreshTimeouts",value:function(){this.clearTimeouts(!1)}},{key:"clearAllTimeouts",value:function(){this.clearTimeouts(!0)}},{key:"clearTimeouts",value:function(e){var r=this;this.timers.forEach(function(o,s){o.refreshTimeoutId&&(clearTimeout(o.refreshTimeoutId),o.refreshTimeoutId=void 0),e&&o.expiredTimeoutId&&(clearTimeout(o.expiredTimeoutId),o.expiredTimeoutId=void 0),o.expiredTimeoutId||r.timers.delete(s)})}}])})();kr.tokenRefreshBufferMs=24e4;kr.tokenExpirationBufferMs=12e4;kr.tokenRefreshBackoffIntervalMs=3e4;kr.tokenRefreshMaximumAttempts=3;var hp=C(Zo());function vv(t,n,e){return n=(0,Hu.default)(n),(0,dp.default)(t,pp()?Reflect.construct(n,e||[],(0,Hu.default)(t).constructor):n.apply(t,e))}function pp(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(n){}return(pp=function(){return!!t})()}var Cv=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},Vu=(function(t){function n(e,r,o,s,a){var u;if((0,cp.default)(this,n),u=vv(this,n),u.getSessionStats=e,u.clientMetadata=r,u.tokenRefreshManager=o,u.sendMessage=s,u.options=a||{},u.options.overrideSessionInitMessage=u.options.overrideSessionInitMessage||function(l){return l},u.clientMetadata&&!u.clientMetadata.userSystemTimezone)try{u.clientMetadata.userSystemTimezone=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(l){}return u}return(0,gp.default)(n,t),(0,fp.default)(n,[{key:"initSession",value:function(r){var o=this;r.onResponse=r.onResponse||function(){};var s=Y.getCurrentTimeMs(),a=this.getSessionStats().lastConnectionClose&&s-this.getSessionStats().lastConnectionClose,u=this.getSessionStats().lastSyncMessage&&s-this.getSessionStats().lastSyncMessage,l=new b({operationName:"SessionInit"}).start(),c={sessionKey:this.sessionKey,sessionId:this.clientMetadata.sessionId,timeSinceLastConnectionClose:a,timeSinceLastSyncMessage:u,isTokenRefresh:r.isTokenRefresh,enableRemoteExecutionNotification:this.options.enableRemoteExecutionNotification,error:void 0,isSeedingRequired:void 0,enableCreateBlobStorageContainer:this.options.createBlobStorageContainerEnabled},f=void 0;this.options.createCopyOfClientMetadataInSessionInit?f=Object.assign({},this.clientMetadata):f=this.clientMetadata;var d=this.options.overrideSessionInitMessage(new Ne({protocolVersion:gd,clientMetadata:f,sessionKey:this.sessionKey,origin:this.origin,authToken:this.anonymousToken,extensionConfigs:r.extensionConfigs,returnWorkflowInputTypes:!0,enableRemoteExecutionNotification:this.options.enableRemoteExecutionNotification,createBlobStorageContainer:this.options.createBlobStorageContainerEnabled}));this.sendMessage(d,function(m,v){if(l.success=!m,l.resultSignature=o.getSessionStats().lastConnectionClose?"Reconnect":"FirstConnect",l.resourceId=et(v==null?void 0:v.sliceUrl),l.setClientMetadata(o.clientMetadata),v!=null&&v.sessionKey&&c.sessionKey!==v.sessionKey&&(c.sessionKey=v.sessionKey),m&&(c.error=m.error),c.isSeedingRequired=o.sessionKey!==(v==null?void 0:v.sessionKey),l.resultDescription=JSON.stringify(c),h.info(508843779,y.CoreDefault,l.stop()),r.onResponse(m,v),m){o.emit("serverAuthenticationStateChange",fe.NotAuthenticated);return}if(r.isReconnectOnSameSlice&&v.forceReconnect){o.emit("serverAuthenticationStateChange",fe.NotAuthenticated);return}if(!v.anonymousToken||!v.tokenExpirationSeconds){o.emit("serverAuthenticationStateChange",fe.NotAuthenticated),h.error(508843778,y.CoreDefault,"AL Anonymous token was not generated for the session");return}o.anonymousToken=v.anonymousToken,o.onSuccessfulSessionInitOnServerSide(v)})}},{key:"onSuccessfulSessionInitOnServerSide",value:function(r){var o=this,s;this.tokenRefreshManager.scheduleRefresh(Bi.Anonymous,r.tokenExpirationSeconds,this.initSession.bind(this,{isTokenRefresh:!0}),function(){o.anonymousToken=void 0}),this.connectParams={isSeedingRequired:this.sessionKey!==r.sessionKey,sessionUrl:`${r.sessionUrlBase}/${r.sessionKey}`,origin:r.origin,authToken:this.anonymousToken},(!r.existingTokenProvisionResponse||((s=r.existingTokenProvisionResponse)===null||s===void 0?void 0:s.tokenType)!==Xn.AugLoopLowPrivilege)&&(this.options.sendTokenFailureMessageChangeGate?this.initHostAuthTokenNew().catch(function(){}):this.initHostAuthToken());var a=!!this.sessionKey;this.sessionKey=r.sessionKey,this.origin=r.origin,this.emit("connect",this.connectParams.isSeedingRequired,a,this.connectParams.sessionUrl,this.connectParams.origin,this.connectParams.authToken,r.workflowInputTypes,r.downstreamRuntimeWorkflows,r.routingSessionKey,r.blobFileId),a&&this.emit("reconnect")}},{key:"getAuthToken",value:function(){var r={Tickets:[],DocSessionId:this.clientMetadata.docSessionId,TokenType:rn.Augloop,ConnectParams:this.connectParams};return this.options.requestAuthToken(r).then(function(o){return o}).catch(function(){})}},{key:"getAuthTokenNew",value:function(){var r={Tickets:[],DocSessionId:this.clientMetadata.docSessionId,TokenType:rn.Augloop,ConnectParams:this.connectParams};return this.options.requestAuthToken(r).then(function(o){return o})}},{key:"getAuthTokenTimeoutPromise",value:function(){var r=this.options.authTokenTimeoutMs;return new Promise(function(o,s){setTimeout(function(){s(new Error(`Host auth token provision took longer than ${r} ms`))},r)})}},{key:"initHostAuthToken",value:function(){var r=this,o=this.getAuthToken.bind(this);if(this.options.requestAuthToken&&o){var s=new b({operationName:"RefreshAuthToken",success:!0}).setClientMetadata(this.clientMetadata).start();o().then(function(a){if(!a){s.resultDescription="TokenResponse is not set";return}if(!a.Token){a.TokenError==Gr.TokenMissingInteractionRequired?(r.emit("serverAuthenticationStateChange",fe.TokenMissingInteractionRequired),s.resultDescription="Host auth token provision failed interaction required"):(r.emit("serverAuthenticationStateChange",fe.NotAuthenticated),s.resultDescription="Host auth token provision failed"),s.success=!1,h.info(508843777,y.CoreDefault,s.stop());return}h.info(508843776,y.CoreDefault,s.stop()),r.sendTokenProvisionMessage(a.Token)}).catch(function(a){r.emit("serverAuthenticationStateChange",fe.NotAuthenticated),s.success=!1,s.resultDescription=`Error happened while attempting to fetch host token: ${a}`,h.error(508843747,y.CoreDefault,s.stop())})}}},{key:"initHostAuthTokenNew",value:function(){return Cv(this,void 0,void 0,function*(){var r=this.getAuthTokenNew.bind(this);if(this.options.requestAuthToken&&r){var o=new b({operationName:"RefreshAuthToken",success:!0}).setClientMetadata(this.clientMetadata).start(),s,a,u=fe.NotAuthenticated;try{if(this.options.authTokenTimeoutMs>0?s=yield Promise.race([r(),this.getAuthTokenTimeoutPromise()]):s=yield r(),!s)throw new Error("TokenResponse is not set");if(!s.Token)throw s.TokenError==Gr.TokenMissingInteractionRequired?(u=fe.TokenMissingInteractionRequired,new Error("Host auth token provision failed interaction required")):new Error("Host auth token provision failed")}catch(l){a=l.message,this.emit("serverAuthenticationStateChange",u),o.success=!1,o.resultDescription=`Error happened while attempting to fetch host token: ${l}`}try{a?this.sendMessage(new Xt({reason:a,version:n.initialTokenVersion,clientHandlesResponse:!0})):this.sendTokenProvisionMessage(s.Token)}catch(l){a||(a=l.message,this.emit("serverAuthenticationStateChange",u),o.success=!1,o.resultDescription=`Error happened while attempting to send host token: ${l}`)}finally{a?h.error(506074845,y.CoreDefault,o.stop()):h.info(506074846,y.CoreDefault,o.stop())}}})}},{key:"sendTokenProvisionMessage",value:function(r){var o=new dn({authToken:r,version:n.initialTokenVersion});this.emit("serverAuthenticationStateChange",fe.Pending),this.sendMessage(o,this.onTokenProvisionResponse.bind(this),!0)}},{key:"onTokenProvisionResponse",value:function(r,o){if(r||!o||!o.tokenExpirationSeconds){this.emit("serverAuthenticationStateChange",fe.NotAuthenticated);return}this.emit("serverAuthenticationStateChange",fe.Authenticated),this.tokenRefreshManager.scheduleRefresh(Bi.Host,o.tokenExpirationSeconds,this.initHostAuthToken.bind(this))}}])})(hp.EventEmitter);Vu.initialTokenVersion=1;p();var yp=C(F()),vp=C(G());p();var _r=null;typeof WebSocket!="undefined"?_r=WebSocket:typeof MozWebSocket!="undefined"?_r=MozWebSocket:typeof global!="undefined"?_r=global.WebSocket||global.MozWebSocket:typeof window!="undefined"?_r=window.WebSocket||window.MozWebSocket:typeof self!="undefined"&&(_r=self.WebSocket||self.MozWebSocket);var Ei=_r;var Sv=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node!="undefined",mp=1e5,zu=(function(){function t(n,e){(0,yp.default)(this,t),this.networkOverrideOptions=n,this.settings=e,this.hadEgressError=!1,this.isClosing=!1,this.pendingEgress=[]}return(0,vp.default)(t,[{key:"egressByteCountOp",get:function(){return this._egressByteCountOp||(this._egressByteCountOp=new b({operationName:"WSEgressByteOrderOfMagnitude",success:!0}),this._egressByteCountOp.setClientMetadata(this.clientMetadata,!0)),this._egressByteCountOp}},{key:"init",value:function(e,r,o,s,a){var u=this,l,c;if(this.clientMetadata=a,Sv&&this.networkOverrideOptions){var f={servername:(l=this.networkOverrideOptions)===null||l===void 0?void 0:l.hostHeader,headers:!((c=this.networkOverrideOptions)===null||c===void 0)&&c.hostHeader?{host:this.networkOverrideOptions.hostHeader}:void 0};this.ws=new Ei(e,f)}else this.ws=new Ei(e);this.logOp=new b({operationName:t.className,success:!0}).start(),this.logOp.setClientMetadata(a,!0),this.ingressByteCountOp=new b({operationName:"WSIngressByteOrderOfMagnitude",success:!0}),this.ingressByteCountOp.setClientMetadata(a,!0),this.ws.addEventListener("open",function(d){o(),u.logOp.resourceId="OnOpen",u.logOp.resultDescription="",u.logOp.success=!0,u.logOp.dimension0=u.pendingEgress.length.toString(),h.info(508843801,y.CoreDefault,u.logOp.stop())}),this.ws.addEventListener("message",function(d){u.logIngressCount(d.data),r(d.data)}),this.ws.addEventListener("error",function(d){u.errorMessage=d.message,u.logOp.resourceId="OnError",u.logOp.resultDescription=u.errorMessage,u.logOp.success=!1,h.info(508843800,y.CoreDefault,u.logOp.stop()),u.ws?u.ws.close():u.logWsUndefinedError("error event handler")}),this.ws.addEventListener("close",function(d){u.logOp.resourceId="OnClose",u.logOp.resultDescription=d?`code: ${d.code}. reason: ${d.reason}`:"",u.logOp.success=!0,h.info(508843799,y.CoreDefault,u.logOp.stop()),s(u.errorMessage),u.isClosing=!1})}},{key:"egress",value:function(e){var r=this,o,s=e.obj;!((o=this.settings)===null||o===void 0)&&o.webSocketWorkerShouldLogEgressCount&&this.logEgressCount(s),this.ws.send(s,function(a){a&&!r.hadEgressError&&(r.hadEgressError=!0,r.logOp.resourceId="OnEgressError",r.logOp.resultDescription=a.message,r.logOp.success=!1,h.info(508843797,y.CoreDefault,r.logOp.stop()))})}},{key:"close",value:function(){this.isClosing||(this.isClosing=!0,this.ws?this.ws.close():this.logWsUndefinedError("close"))}},{key:"logIngressCount",value:function(e){var r=e.length;r>mp&&(this.ingressByteCountOp.start(),this.ingressByteCountOp.dimension2=r.toString().length.toString(),h.info(508843794,y.CoreDefault,this.ingressByteCountOp.stop()))}},{key:"logEgressCount",value:function(e){var r=typeof e=="string"?e.length:e.byteLength;r>mp&&(this.egressByteCountOp.start(),this.egressByteCountOp.dimension2=r.toString().length.toString(),h.info(505710625,y.CoreDefault,this.egressByteCountOp.stop()))}},{key:"logWsUndefinedError",value:function(e){var r=new b({operationName:t.className,success:!1}).start();r.setClientMetadata(this.clientMetadata,!0),r.resourceId="webSocketUndefined",r.resultDescription=e+": this.ws null or undefined",h.info(506566722,y.CoreDefault,r.stop())}}])})();zu.className="WebSocketWorker";var kp=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},kv=30,_p="ShouldAppendClientFeatureFlights",wp="WebSocketWorkerShouldLogEgressCount",Ru="LogExpiredTimeoutTasksInBatchManager",Du="DisableWorkflowGraphInitMessage",as="ClearSyncDeltaTimersOnSessionClose",Tp="UseWrappedFetchInHttpWorker",bp="DefaultBatchingCG",Mp="ScrubSensitiveInfo",us="LogAnnotationTelemetryOncePerMessage",gs=function(){return Sp().version},_v=function(){var n=[qc,Hc];return n.join(";")},Ap=(function(){function t(n,e,r,o){var s=this;(0,Ip.default)(this,t),this.sessionsByDocSessionId=new Map,this.isDeltaGeneratorEnabled=!1,this.disableSyncDeltaSending=!1,this.hasBeenInitialized=!1,this.telemetryLogger=null,this.changeGateList=new Map([["SkipCheckingCachedClaimsChallenge",!0],[_p,!0],[wp,!0],[Ru,!0],[as,!0],[Du,!0],[us,!0],[Tp,!0],[bp,!0],[Mp,!0]]),this.settings={annotationsOrderingEnabled:!0,deltaOperationsEnabled:!1,defaultBatchingCG:!0,batchingWith20msIntervalEnabled:!0,onAnnotationsSubmittedEnabled:!1,reduceBatchOperationsEnabled:!1,batchMessagesEnabled:!1,removeDuplicateFlights:!0,maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled:!1,sendTokenFailureMessage:!0,shouldAppendClientFeatureFlights:!0,authTokenTimeoutMs:0,webSocketWorkerShouldLogEgressCount:!0,createBlobStorageContainerEnabled:!1,createCopyOfClientMetadataInSessionInit:!0,doNotAddCustomLogger:!1,useWrappedFetchInHttpWorker:!1,scrubSensitiveInfoEnabled:!0,preserveSliceUrlOnOffline:!1,offlineConnectionCheckIntervalMs:6e4},this.settingToChangeGateName={shouldAppendClientFeatureFlights:_p,webSocketWorkerShouldLogEgressCount:wp,useWrappedFetchInHttpWorker:Tp,defaultBatchingCG:bp,scrubSensitiveInfoEnabled:Mp},this.isDownloaderCompatible=function(){return typeof Array!="undefined"&&typeof Array.from!="undefined"&&typeof URL!="undefined"&&typeof URL.createObjectURL!="undefined"},o&&(this.settings=o),this.workerFactory=n||function(u){return u&&u===ce.HttpFallback?new cs(void 0,s.settings):new zu(void 0,s.settings)};var a=this.createDefaultSessionManagerFactory();this.sessionManagerFactory=function(){return(e==null?void 0:e.apply(void 0,arguments))||a.apply(void 0,arguments)},this.sessionFactory=r||function(u){return new Au(u)}}return(0,xp.default)(t,[{key:"init",value:function(e,r,o,s){var a=this,u,l,c,f,d,m,v,_,S,M=new b({operationName:"InitRuntime",resourceId:et(e),dimension1:this.hasBeenInitialized.toString()});M.start(),this.hasBeenInitialized=!0,this.hostCallbacks=o,this.gateUtils=new fd(this.hostCallbacks,this.changeGateList),this.clientMetadata=r,this.clientMetadata&&(this.clientMetadata.runtimeVersion=gs()),this.telemetryLogger=new Sr(this.hostCallbacks),this.settings.doNotAddCustomLogger=this.settings.doNotAddCustomLogger||!!s.doNotAddCustomLogger,this.settings.doNotAddCustomLogger||(this.shouldAddLogger(M)?(h.addLogger(this.telemetryLogger),this.addLoggingAggregator(s)):(h.clearLoggers(),h.addLogger(this.telemetryLogger))),t.haveCalledInit=!0,this.annotationResultsProcessor=new ad(function(){return a.settings.annotationsOrderingEnabled}),this.inferenceServiceFactory=s.inferenceServiceFactory,M.dimension2=Go(q.info).toString();var k=[];e&&(this.defaultServiceUrl=Y.convertServiceUrlToWebSocket(e),this.serviceProtocol=this.defaultServiceUrl.split(":")[0].toLowerCase()),k.push(this.gateUtils.init().then(function(){return kp(a,void 0,void 0,function*(){var R=this;yield Promise.all(Object.keys(this.settingToChangeGateName).map(function(B){return kp(R,void 0,void 0,function*(){try{var W=yield this.gateUtils.isChangeGateEnabled(this.settingToChangeGateName[B]);this.settings[B]=W}catch(I){this.settings[B]=!1}})}))})})),k.push(this.isFeatureEnabled("AnnotationsOrderingEnabled",!0).then(function(R){a.settings.annotationsOrderingEnabled=R})),k.push(this.isFeatureEnabled("BatchingWith20msIntervalDisabled").then(function(R){var B;(B=a.settings).batchingWith20msIntervalEnabled&&(B.batchingWith20msIntervalEnabled=!R)})),k.push(this.isFeatureEnabled("OnAnnotationsSubmittedDisabled").then(function(R){var B;(B=a.settings).onAnnotationsSubmittedEnabled&&(B.onAnnotationsSubmittedEnabled=!R)})),k.push(this.isFeatureEnabled("ReduceBatchOperationsEnabled").then(function(R){var B;(B=a.settings).reduceBatchOperationsEnabled||(B.reduceBatchOperationsEnabled=R)})),k.push(this.isFeatureEnabled("BatchMessagesEnabled").then(function(R){var B;(B=a.settings).batchMessagesEnabled||(B.batchMessagesEnabled=R)})),k.push(this.isFeatureEnabled("MaxNumberOfDeltaUpdateOpsPerItemPerBatch").then(function(R){var B;(B=a.settings).maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled||(B.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled=R)})),k.push(Y.isChangeGateEnabled(this.hostCallbacks,"SendTokenFailureMessage").then(function(R){a.settings.sendTokenFailureMessage=R})),k.push(this.isFeatureEnabled("CreateBlobStorageContainerEnabled").then(function(R){var B;(B=a.settings).createBlobStorageContainerEnabled||(B.createBlobStorageContainerEnabled=R)})),k.push(Y.isChangeGateEnabled(this.hostCallbacks,"CreateCopyOfClientMetadataInSessionInit").then(function(R){var B;(B=a.settings).createCopyOfClientMetadataInSessionInit||(B.createCopyOfClientMetadataInSessionInit=R)}));var w={enableDeltas:!1,enableEarlyJoin:!1};k.push(Promise.all([this.isFeatureEnabled("DeltaOperationsEnabled").then(function(R){return w.enableDeltas=R}).catch(function(){return w.enableDeltas=!1}),this.isFeatureEnabled("EarlyJoinCompletionEnabled").then(function(R){return w.enableEarlyJoin=R}).catch(function(){return w.enableEarlyJoin=!1})]).then(function(){a.localWorkflowManager=new ug(s.modelDownloader&&a.isDownloaderCompatible()?s.modelDownloader:void 0,a.inferenceServiceFactory,w)}));var P=ci((u=r.flights)!==null&&u!==void 0?u:"");return this.isDeltaGeneratorEnabled=P.getBooleanValue("Microsoft.Office.WordOnline.AugloopDeltas",(l=s.isDeltaGeneratorEnabled)!==null&&l!==void 0?l:!1),this.disableSyncDeltaSending=P.getBooleanValue("Microsoft.Office.WordOnline.DisableSyncDeltaSending",(c=s.disableSyncDeltaSending)!==null&&c!==void 0?c:!1),this.syncDeltaTimeout=P.getIntValue("Microsoft.Office.WordOnline.SyncDeltaTimeout",s.syncDeltaTimeout),(f=this.settings).defaultBatchingCG&&(f.defaultBatchingCG=P.getBooleanValue("DefaultBatchingCG",!0)),(d=this.settings).batchingWith20msIntervalEnabled&&(d.batchingWith20msIntervalEnabled=!P.getBooleanValue("BatchingWith20msIntervalDisabled",!1)),(m=this.settings).reduceBatchOperationsEnabled||(m.reduceBatchOperationsEnabled=P.getBooleanValue("ReduceBatchOperationsEnabled",!1)),(v=this.settings).batchMessagesEnabled||(v.batchMessagesEnabled=P.getBooleanValue("BatchMessagesEnabled",!1)),(_=this.settings).removeDuplicateFlights&&(_.removeDuplicateFlights=P.getBooleanValue("RemoveDuplicateFlights",!0)),(S=this.settings).maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled||(S.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled=P.getBooleanValue("maxNumberOfDeltaUpdateOpsPerItemPerBatch",!1)),this.settings.authTokenTimeoutMs=P.getIntValue("Microsoft.Office.AugLoop.AuthTokenTimeoutMs",0),this.settings.preserveSliceUrlOnOffline=P.getBooleanValue("Microsoft.Office.AugLoop.PreserveSliceUrlOnOffline",!1),this.settings.offlineConnectionCheckIntervalMs=P.getIntValue("Microsoft.Office.AugLoop.OfflineConnectionCheckIntervalMs",6e4),M.setDataField("Flights",JSON.stringify(this.settings)),s&&s.loggableUrls&&$u(s.loggableUrls),Promise.all(k).then(function(){a.batchOptions=s.batchOptions,!a.batchOptions&&a.settings.defaultBatchingCG&&(a.batchOptions={delayMs:1,maxInputSize:1e6,delayMsMax:50},a.settings.batchingWith20msIntervalEnabled&&(a.batchOptions.delayMs=20)),a.batchOptions&&!a.batchOptions.delayMsMax&&(a.batchOptions.delayMsMax=50),s&&s.networkMode&&(a.networkMode=s.networkMode,s.networkMode===ce.LocalWorkflowsOnly&&(a.sessionManagerFactory=function(){return new Ri})),M.dimension0=JSON.stringify(a.batchOptions),a.logOperation(M,!0)}).catch(function(R){a.logOperation(M,!1,"Error",R?R.message:"(no error)")})}},{key:"getServiceProtocol",value:function(){return this.serviceProtocol}},{key:"registerLocalWorkflow",value:function(e){this.localWorkflowManager.registerLocalWorkflow(e)}},{key:"flushTelemetry",value:function(e){h.flushAggregators(e)}},{key:"createSession",value:function(e){var r,o=e&&e.docSessionId?e.docSessionId:ni(),s=e&&e.documentId?e.documentId:void 0,a=this.sessionsByDocSessionId.get(o),u=new b({operationName:"CreateSession",resourceId:o,dimension1:this.hasBeenInitialized.toString()});if(u.start(),a&&a.isClosed===!1)throw this.logOperation(u,!1,"Error","docSessionId already exists"),new Error("docSessionId already exists");var l=e?(r=e.serviceUrl)!==null&&r!==void 0?r:this.defaultServiceUrl:this.defaultServiceUrl;l=Y.convertServiceUrlToWebSocket(l),l||(e=e||{},e.networkMode=ce.LocalWorkflowsOnly),this.networkMode&&((e==null?void 0:e.networkMode)===void 0||(e==null?void 0:e.networkMode)===null)&&(e=e||{},e.networkMode=this.networkMode),((e==null?void 0:e.networkMode)===void 0||(e==null?void 0:e.networkMode)===null||(e==null?void 0:e.networkMode)===ce.JSWebSockets)&&this.hasHttpFallbackSession()&&(e=e||{},e.networkMode=ce.HttpFallback);var c=Object.assign({},this.clientMetadata);if(c.docSessionId=o,s&&(c.documentId=s),e&&e.tid3pHost&&(c.tid3pHost=e.tid3pHost),e&&e.flights&&(c.flights=c.flights?c.flights+";"+e.flights:e.flights),this.settings.shouldAppendClientFeatureFlights){var f=_v();c.flights=c.flights?`${c.flights};${f}`:f}this.settings.removeDuplicateFlights&&c.flights&&(c.flights=fi(c.flights)),u.setDataField("Flights",c.flights||"");var d=this.sessionFactory({hostCallbacks:this.hostCallbacks,sessionManager:this.sessionManagerFactory(c,l,e),batchOptions:this.batchOptions,extensionConfigs:(e==null?void 0:e.extensionConfigs)||[],clientMetadata:c,userContext:e?e.userContext:void 0,localWorkflowManager:this.localWorkflowManager,annotationResultsProcessor:this.annotationResultsProcessor,localRegisteredWorkflows:(e==null?void 0:e.localRegisteredWorkflows)||[],enableRemoteExecutionNotification:(e==null?void 0:e.enableRemoteExecutionNotification)||!1,networkMode:e==null?void 0:e.networkMode,egress:e?e.egress:void 0,isDeltaGeneratorEnabled:this.isDeltaGeneratorEnabled,onAnnotationsSubmittedEnabled:this.settings.onAnnotationsSubmittedEnabled,disableSyncDeltaSending:this.disableSyncDeltaSending,syncDeltaTimeout:this.syncDeltaTimeout,reduceBatchOperationsEnabled:this.settings.reduceBatchOperationsEnabled,batchMessagesEnabled:this.settings.batchMessagesEnabled,maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled:this.settings.maxNumberOfDeltaUpdateOpsPerItemPerBatchEnabled,scrubSensitiveInfoEnabled:this.settings.scrubSensitiveInfoEnabled,gateUtils:this.gateUtils});return this.sessionsByDocSessionId.set(o,d),e&&(e.onSessionConnect&&d.setConnectCallback(e.onSessionConnect),e.onSessionDisconnect&&d.setDisconnectCallback(e.onSessionDisconnect),e.onSessionReconnect&&d.setReconnectCallback(e.onSessionReconnect),e.onSessionClose&&d.setSessionCloseCallback(e.onSessionClose),e.onServerAuthenticationStateChangeCallback&&d.setServerAuthenticationStateChangeCallback(e.onServerAuthenticationStateChangeCallback),e.onClaimsChallengeCallback&&d.setClaimsChallengeCallback(e.onClaimsChallengeCallback),e.onSeedingStatusChangeCallback&&d.setSeedingStatusChangeCallback(e.onSeedingStatusChangeCallback)),this.logOperation(u,!0),d.initialize?d.initialize():Promise.resolve(d)}},{key:"getSession",value:function(e){return this.sessionsByDocSessionId.get(e)}},{key:"getSessionManagerFactory",value:function(){return this.sessionManagerFactory}},{key:"shouldAddLogger",value:function(e){if(t.haveCalledInit){var r=new Error("Runtime already initialized");return e.dimension3=r.stack,e.dimension2=Go(q.info).toString(),this.logOperation(e,!1,"Error",r.message),!1}else return!0}},{key:"createDefaultSessionManagerFactory",value:function(){var e=this;return function(r,o,s){if(s&&s.networkMode==ce.LocalWorkflowsOnly)return new Ri;var a=new kr,u=new pg,l=function(){h.error(573321615,y.CoreDefault,"Unexpectedly not set sendMessage")},c=new Vu(function(){return u},r,a,function(d,m,v){l(d,m,v)},{requestAuthToken:e.hostCallbacks.requestAuthToken,overrideSessionInitMessage:e.hostCallbacks.overrideSessionInitMessage,enableRemoteExecutionNotification:(s==null?void 0:s.enableRemoteExecutionNotification)||!1,sendTokenFailureMessageChangeGate:e.settings.sendTokenFailureMessage,authTokenTimeoutMs:e.settings.authTokenTimeoutMs,createBlobStorageContainerEnabled:e.settings.createBlobStorageContainerEnabled,createCopyOfClientMetadataInSessionInit:e.settings.createCopyOfClientMetadataInSessionInit}),f=new qu(Y.convertServiceUrlToWebSocket(o),u,e.workerFactory,c,r,a,e.settings,e.gateUtils,s==null?void 0:s.networkMode);return l=f.sendMessage.bind(f),f.on("disconnect",function(){return a.clearRefreshTimeouts()}),f.on("connect",function(d,m,v,_){d&&e.hostCallbacks.setSessionData&&e.hostCallbacks.setSessionData(m,v,_);var S=m.substring(m.lastIndexOf("/")+1);e.telemetryLogger.setServerSessionKey(S)}),f}}},{key:"isFeatureEnabled",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"None";return Y.isFeatureEnabled(this.hostCallbacks,e,r,o)}},{key:"hasHttpFallbackSession",value:function(){var e=!1;return this.sessionsByDocSessionId.forEach(function(r){r.isHttpFallback()&&(e=!0)}),e}},{key:"logOperation",value:function(e,r,o,s){e.stop(),e.success=r,e.resultSignature=o,e.resultDescription=s,h.info(573321622,y.CoreDefault,e)}},{key:"addLoggingAggregator",value:function(e){var r,o,s,a;this.clientMetadata.releaseAudienceGroup==="Dogfood"||this.clientMetadata.releaseAudienceGroup==="Automation"||(h.addAggregator(Cr("Operation","operationName",["ExecuteBatch","ReduceBatchOperations","ProcessResponse","LocalDeltaUpdate","ApplyFormattedTextTileDeltaForLocalWorkflows","ApplyTextTileDeltaForLocalWorkflows","FindRangeForDelta","RunModelForInferencing","GetResource","CreateTextTileDeltaFromItem","NetworkEgressControl","HttpEgress","LongPollNoOp","NetworkRateControllerAbandonedSyncMessage","NetworkRateControllerEgress","NetworkRateControllerQueueItem","NetworkRateControllerOnRateLimitResponse","NetworkRateControllerOnRateLimitError","NetworkRateControllerRateLimitsSet"],(r=e.telemetryAggregationIntervalSec)!==null&&r!==void 0?r:kv)),h.addAggregator(Cr("Operation","operationName",["ExecuteWorkflow","ExecuteLambda","EarlyJoinCompletion","OnLongPollMessage","OnAnnotationResultsEgress"],(o=e.telemetryAggregationIntervalSec)!==null&&o!==void 0?o:60)),h.addAggregator(Cr("Operation","operationName",["LocalScopeExecutionNotification","RunLocalWorkflows","EarlyJoinCompletion","SetAnnotations","WIS.addItemOnContextIdList","WIS.setScopeItem"],(s=e.telemetryAggregationIntervalSec)!==null&&s!==void 0?s:120)),h.addAggregator(Cr("SessionHealth","sessionHealthEventName",["SendMessage","ProcessMessage"],(a=e.telemetryAggregationIntervalSec)!==null&&a!==void 0?a:60)))}},{key:"uninitialize",value:function(){this.sessionsByDocSessionId.forEach(function(e){e.close()}),this.sessionsByDocSessionId.clear(),this.flushTelemetry(!0),this.hostCallbacks=null,this.hasBeenInitialized=!1,this.telemetryLogger=null,t.haveCalledInit=!1,this.settings.doNotAddCustomLogger||(h.clearAggregators(),h.clearLoggers())}}])})(),ps=new Ap;p();var Rp=C(F()),Dp=C(G()),Pp=(function(){function t(){(0,Rp.default)(this,t),this.cache=new Map}return(0,Dp.default)(t,[{key:"setReduceTimer",value:function(e,r,o){var s=this,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:500,u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:function(){return!1},l=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5e3;this.cache.has(e)||this.cache.set(e,new Map);var c=this.cache.get(e);c.has(r)&&clearTimeout(c.get(r).timer);var f=function(){var m=c.get(r),v=Date.now()-m.start;u()&&v<l?m.timer=setTimeout(m.timerCallback,Math.min(a,l-v)):(c.size>1?c.delete(r):s.cache.delete(e),o())};c.set(r,{start:Date.now(),timerCallback:f,timer:setTimeout(f,a)})}},{key:"clear",value:function(e,r){this.cache.forEach(function(o,s){(!e||e===s)&&o.forEach(function(a,u){(!r||r===u)&&clearTimeout(a.timer)})}),this.cache.clear()}}])})();p();p();var Np=C(G()),Op=C(F());var hs=(function(){function t(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:33e5;(0,Op.default)(this,t),this.tokenCache=new Map,this.requestMap=new Map,this.requestRecordMap=new Map,this.tokenExpirationMs=n}return(0,Np.default)(t,[{key:"updateAuthToken",value:function(e,r){var o=this,s=JSON.stringify(r),a=this.requestRecordMap.get(s);return(a===void 0||this.isTokenExpired(a))&&(a={requestPromise:e.requestAuthToken(r).then(function(u){if(!u||!u.Token)throw new Error(`No token available for request ${s}`);o.tokenCache.set(s,u.Token)}),requestTime:Y.getCurrentTimeMs()},this.requestRecordMap.set(s,a)),a.requestPromise}},{key:"getAuthTokenEntries",value:function(e,r){var o=this;return Array.from(this.tokenCache.keys()).map(function(s){var a=o.requestMap.get(s);return a===void 0&&(a=JSON.parse(s),o.requestMap.set(s,a)),{requestKey:s,request:a}}).filter(function(s){var a=s.request;return r?a.DocId===r:!0}).map(function(s){var a=s.requestKey,u=s.request;return o.isTokenExpired(o.requestRecordMap.get(a))&&o.updateAuthToken(e,u),{ticket:u.Tickets[0],token:o.tokenCache.get(a)}})}},{key:"isTokenExpired",value:function(e){return Y.getCurrentTimeMs()>e.requestTime+this.tokenExpirationMs}}])})();var ms,Ju=function(){ms=new hs};Ju();var ju=function(n,e,r,o,s,a,u,l,c,f){var d={method:"POST",headers:{"content-type":"application/json","X-CorrelationId":s},body:JSON.stringify({payload:e.payload,payloadSchema:r,requestedSchema:o,clientMetadata:a,tokens:ms.getAuthTokenEntries(u,c.docId)})};xn(n,d,function(m,v){m?f(new Error(`Fetch error in remote lambda request to ${n}: ${m}`)):v.status===401?l>0?(h.info(572838109,y.CoreDefault,"Auth token required for remote lambda request"),v.json().then(function(_){return ms.updateAuthToken(u,{Tickets:[_],DocId:c.docId})}).then(function(){ju(n,e,r,o,s,a,u,l-1,c,f)}).catch(function(_){f({exceptionType:te.Authentication,message:_.message})})):f({exceptionType:te.Authentication,message:"Remote lambda request retry with authentication token failed"}):v.ok?v.json().then(function(_){if(!Array.isArray(_))f(new Error("Did not receive a valid response for remote lambda request"));else if(_.length>0){var S=0;for(var M of _)e.moreResults=++S<_.length,f(null,M)}else f(new Error("No output"))}).catch(function(_){f({exceptionType:te.LambdaThrow,message:_.message})}):f(new Error(`Remote lambda request failed with status ${v.status}`))})},Bp=function(n,e,r,o,s,a,u,l,c){Array.isArray(l.authTickets)?ms.updateAuthToken(u,{Tickets:l.authTickets,DocId:l.docId}).then(function(){ju(n,e,r,o,s.id,a,u,1,l,c)}).catch(function(f){c({exceptionType:te.Authentication,message:f.message})}):ju(n,e,r,o,s.id,a,u,1,l,c)};p();p();var Ep=C(F()),Lp=C(G());var wr=(function(){function t(){(0,Ep.default)(this,t),this.hasBeenOpened=!1,this.hadEgressError=!1,this.lastEgressTime=0,this.lastPongTime=0,this.remainingPingFailures=3,this.egressMessageCount=0,this.egressByteCount=0,this.isClosing=!1,this.pendingEgress=[]}return(0,Lp.default)(t,[{key:"init",value:function(e,r,o,s){var a=this;this.ws=new Ei(e),this.logOp=new b({operationName:t.className,success:!0,dimension1:"V1"}).start(),this.egressTimer=Date.now(),this.egressMessageCountOp=new b({operationName:"WSEgressMessageCount",success:!0,dimension1:"V1"}),this.egressByteCountOp=new b({operationName:"WSEgressByteOrderOfMagnitude",success:!0,dimension1:"V1"}),this.ingressByteCountOp=new b({operationName:"WSIngressByteOrderOfMagnitude",success:!0,dimension1:"V1"});var u=function(c){a.logPingLatencyOp&&(a.logPingLatencyOp.success=c,h.info(507789790,y.CoreDefault,a.logPingLatencyOp.stop()),a.logPingLatencyOp=void 0)};this.ws.addEventListener("open",function(l){o(),t.logCountLimiter.log(function(){a.logOp.resourceId="OnOpen",a.logOp.resultDescription="",a.logOp.success=!0,a.logOp.dimension0=a.pendingEgress.length.toString(),h.info(507789789,y.CoreDefault,a.logOp.stop())}),a.hasBeenOpened=!0,a.pendingEgress.forEach(function(c){a.egress({obj:c})}),a.pendingEgress=[],a.pingInterval=setInterval(function(){a.logPingLatencyOp&&(--a.remainingPingFailures,u(!1)),a.remainingPingFailures>0&&a.hasBeenOpened&&a.lastPongTime<a.lastEgressTime&&(a.logPingLatencyOp=new b({operationName:"Ping",success:!0,dimension0:a.ws.bufferedAmount>=0?a.ws.bufferedAmount.toString().length.toString():void 0,dimension1:"V1"}).start(),a.ws.send(t.pingPongMessage,function(c){c&&(--a.remainingPingFailures,u(!1))}))},3e4)}),this.ws.addEventListener("message",function(l){a.logPingLatencyOp&&typeof l.data=="string"&&l.data.length===1&&l.data[0]===t.pingPongMessage?(u(!0),a.lastPongTime=Date.now()):(a.logIngressCount(l.data),r(l.data))}),this.ws.addEventListener("error",function(l){a.errorMessage=l.message,t.logCountLimiter.log(function(){a.logOp.resourceId="OnError",a.logOp.resultDescription=a.errorMessage,a.logOp.success=!1,h.info(507789788,y.CoreDefault,a.logOp.stop())}),a.ws.close()}),this.ws.addEventListener("close",function(l){t.logCountLimiter.log(function(){a.logOp.resourceId="OnClose",a.logOp.resultDescription=l?`code: ${l.code}. reason: ${l.reason}`:"",a.logOp.success=!0,h.info(507789787,y.CoreDefault,a.logOp.stop())}),a.pingInterval&&(clearInterval(a.pingInterval),a.pingInterval=void 0),s(a.errorMessage),a.isClosing=!1})}},{key:"egress",value:function(e){var r=this,o=e.obj;this.logEgressCount(o instanceof ArrayBuffer||o instanceof Uint8Array?o.byteLength:o.length),this.lastEgressTime=Date.now(),this.hasBeenOpened?this.ws.send(o,function(s){s&&!r.hadEgressError&&(r.hadEgressError=!0,t.logCountLimiter.log(function(){r.logOp.resourceId="OnFirstEgressError",r.logOp.resultDescription=s.message,r.logOp.success=!1,h.info(507789786,y.CoreDefault,r.logOp.stop())}))}):this.pendingEgress.push(o)}},{key:"close",value:function(){this.isClosing||(this.isClosing=!0,this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=void 0),this.ws.close())}},{key:"logEgressCount",value:function(e){var r=Date.now(),o=r-this.egressTimer;o>1e3&&(this.egressMessageCount>50&&(this.egressMessageCountOp.start(),this.egressMessageCountOp.resultDescription="Egress message count: "+this.egressMessageCount.toString()+", Buffered amount: "+(this.ws.bufferedAmount>=0?this.ws.bufferedAmount.toString():"-")+", Time elapsed: "+o.toString(),h.info(507789785,y.CoreDefault,this.egressMessageCountOp.stop())),this.egressByteCount>1e5&&(this.egressByteCountOp.start(),this.egressByteCountOp.dimension2=this.egressByteCount.toString().length.toString(),this.egressMessageCountOp.resultDescription="Buffered amount: "+(this.ws.bufferedAmount>=0?this.ws.bufferedAmount.toString():"-")+", Time elapsed: "+o.toString(),h.info(507789784,y.CoreDefault,this.egressByteCountOp.stop())),this.egressTimer=r,this.egressMessageCount=0,this.egressByteCount=0),this.egressMessageCount++,this.egressByteCount+=e!=null?e:0}},{key:"logIngressCount",value:function(e){var r=e.length;r>1e5&&(this.ingressByteCountOp.start(),this.ingressByteCountOp.dimension2=r.toString().length.toString(),h.info(507789783,y.CoreDefault,this.ingressByteCountOp.stop()))}}])})();wr.className="WebSocketWorker";wr.logCountLimiter=new jn(wr.className);wr.pingPongMessage="~";p();var Ku=C(F()),Qu=C(G());var Tv=(function(){function t(n,e,r,o,s,a){(0,Ku.default)(this,t),this.requestId=n,this.correlationId=e,this.schemaName=r,this.data=o,this.callback=s,this.requestTimeoutInMs=a,this.ended=!1,this.startTime=0}return(0,Qu.default)(t,[{key:"startRequest",value:function(){this.startTime=Y.getCurrentTimeMs()}},{key:"getMsUntilTimeout",value:function(){var e=Y.getCurrentTimeMs()-this.startTime;return this.requestTimeoutInMs-e}},{key:"endRequest",value:function(e){this.ended||(this.invokeCallback(null,e,!0),this.ended=!0)}},{key:"addResponseData",value:function(e){this.invokeCallback(e,null,!1)}},{key:"invokeCallback",value:function(e,r,o){var s=this;new Promise(function(){return s.callback(e,r,o)}).catch(function(a){})}}])})(),Wp=(function(){function t(n,e,r){(0,Ku.default)(this,t),this.requestCounter=0,this.activeRequests=[],this.pendingRequests=[],this.requestTimeoutInMs=n,this.workerFactory=e,this.maxActiveRequests=r}return(0,Qu.default)(t,[{key:"testConnection",value:function(e,r){var o=this,s=!1,a=new b({cv:new Ke().toString(),operationName:"WebSocketTest",resourceId:et(e),success:!0}).start();return new Promise(function(u){var l=Y.createHealthCheckRequest(r);e?o.addRequest(e,l,a.cv,"HealthCheckRequest",function(c,f,d){f&&(a.success=!1,a.resultSignature="Error",a.resultDescription=f.message||f),c&&c.status==="OK"&&(s=!0),d&&(a.success&&!s&&(a.success=!1,a.resultSignature="NoResponseData"),h.info(556617949,y.CoreDefault,a.stop()),u(a.success))}):(a.success=!1,a.resultSignature="EmptyUrl",h.info(557641870,y.CoreDefault,a.stop()),u(a.success))})}},{key:"addRequest",value:function(e,r,o,s,a){var u=(this.requestCounter++).toString(),l=new Tv(u,o,s,r,a,this.requestTimeoutInMs);this.getWorker(e),this.pendingRequests.push(l),this.egressPendingRequests()}},{key:"egressPendingRequests",value:function(){for(;this.pendingRequests.length>0&&this.activeRequests.length<this.maxActiveRequests;){var e=this.pendingRequests.shift();if(this.activeRequests.push(e),this.activeRequests.length===1){var r=e.getMsUntilTimeout();setTimeout(this.onTimeout.bind(this),r)}e.startRequest(),this.worker&&this.worker.egress({obj:this.createRequestMessage(e.data,e.requestId,e.correlationId)})}}},{key:"createRequestMessage",value:function(e,r,o){return JSON.stringify({correlationId:o,requestId:r,body:e})}},{key:"onTimeout",value:function(){for(;this.activeRequests.length>0;){var e=this.activeRequests[0],r=e.getMsUntilTimeout();if(r<=0){var o=new Error("Request timed out");e.endRequest(o),this.activeRequests.shift(),this.egressPendingRequests()}else{setTimeout(this.onTimeout.bind(this),r);return}}}},{key:"onMessage",value:function(e){try{for(var r=JSON.parse(e),o=0;o<this.activeRequests.length;o++){var s=this.activeRequests[o];if(s.requestId===r.requestId){r.end?(this.activeRequests.splice(o,1),s.endRequest(r.error),this.egressPendingRequests()):r.body&&s.addResponseData(r.body);break}}}catch(a){h.error(557641871,y.CoreDefault,a)}}},{key:"onClose",value:function(e){var r=new Error(`Connection closed: ${e}`);for(var o of this.activeRequests)o.endRequest(r);this.activeRequests=[];for(var s of this.pendingRequests)s.endRequest(r);this.pendingRequests=[],this.worker=void 0}},{key:"getWorker",value:function(e){return this.worker||(this.worker=this.workerFactory(),this.worker.init(e,this.onMessage.bind(this),function(){},this.onClose.bind(this))),this.worker}}])})();var bv=3e4,Mv=50,ys,Xu=function(){ys=new hs};Xu();var Fp=new Wp(bv,function(){return new wr},Mv),Yu=function(n,e,r,o,s,a,u,l,c,f){var d={payload:e.payload,payloadSchema:r,requestedSchema:o,clientMetadata:a,tokens:ys.getAuthTokenEntries(u,c.docId)},m="";o&&o.schema&&(m=o.schema.name);var v=!1;Fp.addRequest(n,d,s,m,function(_,S,M){if(!v)if(v=!0,S!=null)if(S.exceptionType===te.Authentication)try{var k=JSON.parse(S.data);l>0?(h.info(572838108,y.CoreDefault,"Auth token required for remote lambda WebSocket request"),ys.updateAuthToken(u,{Tickets:[k],DocId:c.docId}).then(function(){Yu(n,e,r,o,s,a,u,l-1,c,f)}).catch(function(w){f({exceptionType:te.Authentication,message:w.message})})):f({exceptionType:te.Authentication,message:"Remote lambda request retry with authentication token failed"})}catch(w){f({exceptionType:te.Authentication,message:w.message})}else f(new Error(`Error in remote lambda WebSocket request to ${n}: ${S}`));else e.moreResults=!1,f(null,_)})},Gp=function(n,e,r,o,s,a,u,l,c){Array.isArray(l.authTickets)?ys.updateAuthToken(u,{Tickets:l.authTickets,DocId:l.docId}).then(function(){Yu(n,e,r,o,s.id,a,u,1,l,c)}).catch(function(f){c({exceptionType:te.Authentication,message:f.message})}):Yu(n,e,r,o,s.id,a,u,1,l,c)},$p=function(n,e){return Fp.testConnection(n,e)};p();var Up=C(F()),qp=C(G()),Hp=(function(){function t(){(0,Up.default)(this,t),this.cache=new Map,this.bucketSizes=new Map}return(0,qp.default)(t,[{key:"setBucketSize",value:function(e,r){this.bucketSizes.set(e,r)}},{key:"setResult",value:function(e,r,o){if(r.primary){var s=this.cache.get(e);s||(s=new Map,this.cache.set(e,s));var a=s.get(r.primary);if(a||(a=r.secondary?new Map:[],s.set(r.primary,a)),r.secondary){var u=a;u.set(r.secondary,o)}else{var l=a;l.length==this.getBucketSize(e)&&l.shift(),l.push(o)}}}},{key:"getResults",value:function(e,r){var o=this.cache.get(e);if(o){var s=o.get(r.primary);if(s){if(!r.secondary)return s;var a=Array.from(s.values());if(a.length>0)return a}}return[]}},{key:"clear",value:function(e,r){r?this.cache.forEach(function(o,s){if(!e||e===s)if(r.secondary){var a=o.get(r.primary);a&&a.delete(r.secondary)}else o.delete(r.primary)}):e?this.cache.delete(e):this.cache.clear()}},{key:"getBucketSize",value:function(e){return this.bucketSizes.get(e)||10}}])})();p();var ne;(function(t){t[t.Unknown=0]="Unknown",t[t.Local=1]="Local",t[t.Custom=2]="Custom",t[t.Remote=3]="Remote",t[t.BatchedRemote=4]="BatchedRemote"})(ne||(ne={}));p();var Vp=C(F()),zp=C(G());var jp=(function(){function t(){(0,Vp.default)(this,t),this.throttleInfoMap=new Map}return(0,zp.default)(t,[{key:"execute",value:function(e,r,o){var s=this;if(!r.throttleSettings.shouldBeThrottled||!(r.throttleSettings.throttlingInterval>0))o();else{var a=this.getWorkflowThrottleInfo(r.name);if(a.currentTileId==null)a.currentTileId=e,a.timeOfPreviousStartedEvent=Y.getCurrentTimeMs(),o();else if(a.currentTileId===e){var u=Y.getCurrentTimeMs(),l=this.delayTime(a,u,r.throttleSettings.throttlingInterval);l>0?(a.latestCallback=o,a.lastTimeout==null&&(a.lastTimeout=setTimeout(function(){var c=s.getWorkflowThrottleInfo(r.name);c.lastTimeout=void 0,c.timeOfPreviousStartedEvent=Y.getCurrentTimeMs(),c.latestCallback()},l))):(a.timeOfPreviousStartedEvent=u,o())}else a.lastTimeout!=null&&(clearTimeout(a.lastTimeout),a.latestCallback(),a.lastTimeout=void 0),a.currentTileId=e,a.timeOfPreviousStartedEvent=Y.getCurrentTimeMs(),o()}}},{key:"delayTime",value:function(e,r,o){var s=r-e.timeOfPreviousStartedEvent;return Math.max(o-s,0)}},{key:"getWorkflowThrottleInfo",value:function(e){var r=this.throttleInfoMap.get(e);return r||(r={currentTileId:void 0,timeOfPreviousStartedEvent:-1,latestCallback:function(){},lastTimeout:void 0},this.throttleInfoMap.set(e,r)),r}}])})();var Dt;(function(t){t[t.Restricted=0]="Restricted",t[t.Unrestricted=1]="Unrestricted",t[t.Suppressed=2]="Suppressed"})(Dt||(Dt={}));var Zu=(function(){function t(){(0,el.default)(this,t),this.canaryTextTileEventSubmittedByDocSessionId=new Set,this.stateByDocSessionId=new Map,this.executionQueueByDocSessionId=new Map,this.executionCountByDocSessionId=new Map}return(0,tl.default)(t,[{key:"getOutputSchema",value:function(){return this.lambdas[this.lambdas.length-1].outputSchema}},{key:"scheduleExecution",value:function(e,r){var o=this.docSessionIdExtractor?this.docSessionIdExtractor(e):void 0,s=this.getStateForDocSessionId(o);if(s===Dt.Restricted){var a=this.getExecutionQueueForDocSessionId(o);a.push(r),a.length===1&&r()}else s===Dt.Unrestricted?r():Dt.Suppressed}},{key:"onStart",value:function(e){this.incrementExecutionCountForDocSessionId(e)}},{key:"onFinish",value:function(e,r){if(this.decrementExecutionCountForDocSessionId(e),r===te.Authentication)this.stateByDocSessionId.set(e,Dt.Suppressed),this.executionQueueByDocSessionId.delete(e);else if(this.stateByDocSessionId.get(e)===Dt.Restricted){var o=this.getExecutionQueueForDocSessionId(e);if(o.shift(),r===void 0){this.stateByDocSessionId.set(e,Dt.Unrestricted),this.executionQueueByDocSessionId.delete(e);for(var s of o)s()}else if(o.length>0){var a=o[0];a()}}}},{key:"onRefresh",value:function(e){this.stateByDocSessionId=new Map,this.triggerOnRefresh&&(e?(this.executionQueueByDocSessionId.delete(e),this.executionCountByDocSessionId.delete(e)):(this.executionQueueByDocSessionId=new Map,this.executionCountByDocSessionId=new Map)),this.canaryTextTileEventSubmittedByDocSessionId.delete(e)}},{key:"getStateForDocSessionId",value:function(e){var r=this.stateByDocSessionId.get(e);return r===void 0&&(r=t.executionQueuesEnabled?Dt.Restricted:Dt.Unrestricted,this.stateByDocSessionId.set(e,r)),r}},{key:"getExecutionQueueForDocSessionId",value:function(e){var r=this.executionQueueByDocSessionId.get(e);return r===void 0&&(r=[],this.executionQueueByDocSessionId.set(e,r)),r}},{key:"incrementExecutionCountForDocSessionId",value:function(e){var r=this.executionCountByDocSessionId.get(e)||0;this.executionCountByDocSessionId.set(e,r+1)}},{key:"decrementExecutionCountForDocSessionId",value:function(e){var r=this.executionCountByDocSessionId.get(e)||0;r<=1?this.executionCountByDocSessionId.delete(e):this.executionCountByDocSessionId.set(e,r-1)}}])})();Zu.executionQueuesEnabled=!0;var mn=function(n){return{category:yt.Schema,schema:{name:n}}},Wi="Tiling.TextTileEvent",nl="ClpSlideTile",xv=function(n,e){return n===Wi&&e&&e.type==kn.TextTileEventType.Delete||n===nl&&e&&e.eventType==$r.SlideTileEventType.Delete},Kp=function(n,e){return n===Wi&&e&&e.type==kn.TextTileEventType.Refresh},Qp=function(n,e){return n===nl&&e&&e.eventType==$r.SlideTileEventType.Refresh},Jp=function(n,e){return Kp(n,e)||Qp(n,e)},Av=function(n,e){var r,o;return Kp(n,e)?(o=(r=e.tile)===null||r===void 0?void 0:r.metadata)===null||o===void 0?void 0:o.seqnoCLPRefresh:(Qp(n,e),-1)},vs=function(n,e){var r,o;if(n===Wi)return(o=(r=e.tile)===null||r===void 0?void 0:r.metadata)===null||o===void 0?void 0:o.docSessionId;if(n===nl)return e.docId},Rv=function(n){return{type:n.type,tile:{metadata:{docSessionId:n.tile.metadata.docSessionId,docId:n.tile.metadata.docId,seqnoCLPRefresh:n.tile.metadata.seqnoCLPRefresh,tileId:"A56B3127DBDFD0D6"},elements:[{text:"B91153AE828B4E48"}]}}},Dv=(function(){function t(){(0,el.default)(this,t),this.inputSchemasToWorkflows=new Map,this.inputSchemasToReduceWorkflows=new Map,this.reduceWorkflowsGroupingKeyExtractors=new Map,this.defaultWorkflowOptions={canProduceNullResult:!1,shouldSendResultsToHost:!0,enabledByDefault:!1,throttleSettings:{shouldBeThrottled:!1},triggerOnRefresh:!1},this.resultCache=new Hp,this.reduceTimerCache=new Pp,this.lookupTableCache=new Map,this.throttling=new jp,this.lastTileRefreshSeq=-1,this.lastTileRefreshSeqByDocSessionId=new Map,this.tileRefreshByDocSessionIdEnabled=!0}return(0,tl.default)(t,[{key:"init",value:function(e,r,o){var s=this,a=new b({operationName:"InitRuntimeALv1",resourceId:et(e)});a.start(),this.clientMetadata=r,this.clientMetadata&&(this.clientMetadata.runtimeVersion=gs(),this.clientMetadata.flights&&(this.clientMetadata.flights=fi(this.clientMetadata.flights))),this.hostCallbacks=o;var u=[];return u.push(this.isFeatureEnabled("DisableWebSocket").then(function(l){var c=!l;if(!c)return!1;var f=["Outlook Mac","Outlook Win32","PowerPoint Mac","PowerPoint Web","PowerPoint Win32","Word Mac","Word Win32"];return f.indexOf(`${r.appName} ${r.appPlatform}`)>=0?$p(Y.convertServiceUrlToWebSocket(e),s.clientMetadata):!0}).then(function(l){e&&(s.serviceUrl=l?Y.convertServiceUrlToWebSocket(e):e,s.executeRemoteLambda=l?Gp:Bp,s.clearRemoteLambdaTokenCache=l?Xu:Ju,s.serviceProtocol=s.serviceUrl.split(":")[0].toLowerCase())})),u.push(this.isFeatureEnabled("WorkflowQueuesDisabled").then(function(l){Zu.executionQueuesEnabled=!l})),u.push(this.isFeatureEnabled("TileRefreshByDocSessionIdDisabled").then(function(l){s.tileRefreshByDocSessionIdEnabled=!l})),Promise.all(u).then(function(){s.logOperation(a,!0)}).catch(function(l){s.logOperation(a,!1,"Error",l?l.message:"(no error)")})}},{key:"getServiceProtocol",value:function(){return this.serviceProtocol}},{key:"registerSchemas",value:function(e,r){return Promise.resolve()}},{key:"registerSimpleLocalWorkflow",value:function(e,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.defaultWorkflowOptions;return r.source=r.source||ne.Custom,this.registerHardcodedWorkflow(e,[r],this.inputSchemasToWorkflows,o)}},{key:"registerSimpleRemoteWorkflow",value:function(e,r,o,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.defaultWorkflowOptions,u=[];return r&&(r.source=ne.Custom,u.push(r)),o.source=o.func?ne.Custom:ne.Remote,u.push(o),s&&(s.source=ne.Custom,u.push(s)),this.registerHardcodedWorkflow(e,u,this.inputSchemasToWorkflows,a)}},{key:"registerMultipleLambdasWorkflow",value:function(e,r){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.defaultWorkflowOptions;return this.registerHardcodedWorkflow(e,r,this.inputSchemasToWorkflows,o)}},{key:"registerReduceWorkflow",value:function(e,r,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.defaultWorkflowOptions;return this.reduceWorkflowsGroupingKeyExtractors.set(r.inputSchema,o),this.resultCache.setBucketSize(r.inputSchema,s),r.source=r.source||ne.Custom,this.registerHardcodedWorkflow(e,[r],this.inputSchemasToReduceWorkflows,a)}},{key:"registerMultipleLambdasReduceWorkflow",value:function(e,r,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.defaultWorkflowOptions;return this.reduceWorkflowsGroupingKeyExtractors.set(r[0].inputSchema,o),this.resultCache.setBucketSize(r[0].inputSchema,s),this.registerHardcodedWorkflow(e,r,this.inputSchemasToReduceWorkflows,a)}},{key:"submit",value:function(e,r,o){this.submitToWorkflows(e,r,o,this.inputSchemasToWorkflows)}},{key:"getGroupingKey",value:function(e,r,o){var s=this.reduceWorkflowsGroupingKeyExtractors.get(o);if(s==null)throw new Error("Reduce workflow does not have a grouping extractor");return s(r,e)}},{key:"submitToWorkflows",value:function(e,r,o){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:this.inputSchemasToWorkflows;if(this.hostCallbacks){var a;o?a=Ke.fromString(o):a=new Ke,this.handleTileRefresh(e,r,a);var u=s.get(e)||[];for(var l of u)Jp(e,r)&&!l.triggerOnRefresh||(l.useCanaryTextTile&&e===Wi&&!l.canaryTextTileEventSubmittedByDocSessionId.has(vs(e,r))&&(this.submitToWorkflow(Wi,Rv(r),a,l,s),l.canaryTextTileEventSubmittedByDocSessionId.add(vs(e,r))),this.submitToWorkflow(e,r,a,l,s))}}},{key:"submitToWorkflow",value:function(e,r,o,s,a){var u=this,l={messageType:ot.Input,correlationVector:o.newChild(),payload:r,payloadSchema:mn(s.lambdas[0].inputSchema),clientMetadata:this.clientMetadata},c=new b({cv:l.correlationVector.toString(),operationName:"ExecuteWorkflow",resourceId:s.name});c.setClientMetadata(this.clientMetadata),c.start(),s.scheduleExecution(r,function(){try{if(!l.payload||!l.payload.tile||!l.payload.tile.metadata||!l.payload.tile.metadata.tileId)u.executeWorkflow(c,l,r,s,e,a);else{var f=l.payload.tile.metadata.tileId;u.throttling.execute(f,s,function(){return u.executeWorkflow(c,l,r,s,e,a)})}}catch(d){c.success=!1,c.resultSignature="ExecuteException",c.resultDescription=d?d.message:"(no error)",h.error(559290447,y.CoreDefault,c.stop())}})}},{key:"handleTileRefresh",value:function(e,r,o){var s=this;if(Jp(e,r)){var a=this.tileRefreshByDocSessionIdEnabled?vs(e,r):void 0,u=Av(e,r);if(this.tileRefreshByDocSessionIdEnabled){var l=this.lastTileRefreshSeqByDocSessionId.get(a);if(l>=0&&u<=l)return}else if(u<=this.lastTileRefreshSeq)return;var c=new b({cv:o.toString(),operationName:"TileRefresh",resultDescription:"",success:!0});if(c.start(),this.tileRefreshByDocSessionIdEnabled&&!a){c.success=!1,c.resultDescription="NoDocSessionId",h.info(559290448,y.CoreDefault,c.stop());return}this.inputSchemasToReduceWorkflows.forEach(function(m,v){m.some(function(_){return _.triggerOnRefresh})&&(s.tileRefreshByDocSessionIdEnabled?(s.resultCache.clear(v,{primary:a}),s.resultCache.clear(s.getForcedDocLevelSchema(v),{primary:a}),s.reduceTimerCache.clear(v,a)):(s.resultCache.clear(v),s.resultCache.clear(s.getForcedDocLevelSchema(v)),s.reduceTimerCache.clear(v)),m.some(function(_){return!_.triggerOnRefresh})&&(c.resultDescription+="X_"),c.resultDescription+=v+" ")}),this.clearRemoteLambdaTokenCache();var f=[];this.inputSchemasToWorkflows.forEach(function(m){return f.push.apply(f,(0,Li.default)(m))}),this.inputSchemasToReduceWorkflows.forEach(function(m){return f.push.apply(f,(0,Li.default)(m))});for(var d of f)this.tileRefreshByDocSessionIdEnabled?d.onRefresh(a):d.onRefresh();this.tileRefreshByDocSessionIdEnabled?this.lastTileRefreshSeqByDocSessionId.set(a,u):this.lastTileRefreshSeq=u,h.info(559290449,y.CoreDefault,c.stop())}}},{key:"executeWorkflow",value:function(e,r,o,s,a,u){var l=this,c=s.docIdExtractor?s.docIdExtractor(r.payload):void 0,f=s.docSessionIdExtractor(o),d=this.tileRefreshByDocSessionIdEnabled?this.lastTileRefreshSeqByDocSessionId.get(f):this.lastTileRefreshSeq;s.onStart(f);var m=function(_){var S=l.tileRefreshByDocSessionIdEnabled?l.lastTileRefreshSeqByDocSessionId.get(f):l.lastTileRefreshSeq;if(s.triggerOnRefresh&&S!==d){e.success=!0,e.resultSignature="TileRefreshIgnore",h.info(559290450,y.CoreDefault,e.stop());return}var M=_.messageType==ot.Exception&&_.payload.exceptionType==te.NoOutput,k=M&&s.canProduceNullResult,w=k?s.lambdas[s.lambdas.length-1].outputSchema:_.payloadSchema.schema.name,P=k?null:_.payload;_.messageType===ot.Input||k?(s.shouldSendResultsToHost&&(u===l.inputSchemasToReduceWorkflows?l.hostCallbacks.onResult("Reduce.Input",o,w,P):l.hostCallbacks.onResult(a,o,w,P)),e.success=!0,e.resultSignature=M?"NoOutput":"ValidOutput"):M?(e.success=!0,e.resultSignature="NoOutput"):(e.success=!1,e.resultSignature="Exception",e.resultDescription=_n(_)),u!==l.inputSchemasToReduceWorkflows&&l.updateResultCacheForReduceWorkflows(a,o,w,P,_.correlationVector.toString()),_.moreResults||(e.stop(),h.info(559290451,y.CoreDefault,e),s.onFinish(f,_.payload&&_.payload.exceptionType?Al(_):void 0))};s.preExecutionPromise.then(function(){for(var v={lookupTable:l.lookupTableCache.get(s.name),docId:c,docSessionId:f},_=m,S=s.lambdas.length-1;S>=0;S--)_=l.createLambdaExecutionStep(s.name,s.lambdas[S],v,_,m);_(r)})}},{key:"getForcedDocLevelSchema",value:function(e){return`~${e}`}},{key:"updateResultCacheForReduceWorkflows",value:function(e,r,o,s,a){var u=this,l=this.inputSchemasToReduceWorkflows.get(o);if(l){var c;e==="docSessionId"?(c=this.getGroupingKey(e,r,o),this.resultCache.setResult(this.getForcedDocLevelSchema(o),c,s),c.secondary="*"):(c=this.getGroupingKey(e,r,o),xv(e,r)&&c.primary!=null&&c.secondary!=null?this.resultCache.clear(void 0,c):this.resultCache.setResult(o,c,s));var f=l.some(function(_){return _.deferReduceUntilIdle}),d=[];this.inputSchemasToWorkflows.forEach(function(_){return d.push.apply(d,(0,Li.default)(_.filter(function(S){return S.getOutputSchema()===o})))});var m=function(){return f&&d.some(function(S){return S.executionCountByDocSessionId.get(c.primary)>0})},v=l.map(function(_){return _.deferReduceUntilIdleMaxDelayMs||0}).reduce(function(_,S){return Math.max(_,S)});this.reduceTimerCache.setReduceTimer(o,c.primary,function(){var _=u.resultCache.getResults(o,c);if(_.push.apply(_,(0,Li.default)(u.resultCache.getResults(u.getForcedDocLevelSchema(o),{primary:c.primary}))),Array.isArray(_)){var S={id:c.primary,values:_,isReduceInput:!0};u.submitToWorkflows(o,S,a,u.inputSchemasToReduceWorkflows)}else h.error(559290452,y.CoreDefault,`Cached results have unexpected type "${typeof _}"`)},500,m,v)}}},{key:"isFeatureEnabled",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"None";return this.hostCallbacks&&this.hostCallbacks.isFeatureEnabled?this.hostCallbacks.isFeatureEnabled("Microsoft.Office.AugLoop."+e,o).catch(function(){return Promise.resolve(r)}):Promise.resolve(r)}},{key:"areLicenseFeaturesEnabled",value:function(e){return this.hostCallbacks&&this.hostCallbacks.areLicenseFeaturesEnabled?this.hostCallbacks.areLicenseFeaturesEnabled(e).catch(function(){return Promise.resolve(!1)}):Promise.resolve(!1)}},{key:"isWorkflowEnabled",value:function(e,r,o,s,a){var u=this,l=r.some(function(f){return f.source===ne.Remote||f.source===ne.BatchedRemote});if(l){if(!this.serviceUrl)return a.resultDescription="Disabled because no service URL available for remote workflow",Promise.resolve(!1);if(this.clientMetadata&&this.clientMetadata.privateMode&&r.some(function(f){return(f.source===ne.Remote||f.source===ne.BatchedRemote)&&!f.canRunInPrivateMode}))return a.resultDescription="Disabled because we are running in private mode",Promise.resolve(!1)}(!this.clientMetadata||this.clientMetadata.appPlatform!=="Mac"&&this.clientMetadata.appPlatform!=="Win32")&&(s=!0,a.resultDescription="Enabled by default due to platform name");var c;return s?c=Promise.resolve(!0):c=this.isFeatureEnabled("WorkflowEnabled."+e),c.then(function(f){return f?u.isFeatureEnabled("WorkflowDisabled."+e).then(function(d){return d?(a.resultDescription="Disabled because explicitly disabled",!1):o?u.areLicenseFeaturesEnabled(o).then(function(m){return m||(a.resultDescription="Disabled because license check failed"),m}):!0}):(a.resultDescription="Disabled because not explicitly enabled",!1)})}},{key:"registerHardcodedWorkflow",value:function(e,r){var o=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.inputSchemasToWorkflows,a=arguments.length>3?arguments[3]:void 0;if(!e||e.length>40)throw new Error("Workflow name has invalid length");if(new RegExp(/^[A-Z][a-zA-Z0-9_]+$/).test(e)===!1)throw new Error("Workflow name has invalid format");s.forEach(function(l){if(l.some(function(c){return c.name===e}))throw new Error("Workflow name already registered.")});var u=new b({operationName:"WorkflowRegistration",resourceId:e,success:!0});return u.setClientMetadata(this.clientMetadata),u.start(),this.isWorkflowEnabled(e,r,a.licenseFeatures,a.enabledByDefault,u).then(function(l){if(u.resultSignature=l?"Enabled":"Disabled",u.stop(),h.info(559290453,y.CoreDefault,u),l){var c=r[0].inputSchema,f=s.get(c);f||(f=[],s.set(c,f));var d=Promise.resolve();a.lookupTableLambda&&(d=new Promise(function(v,_){var S=new Ke,M={messageType:ot.Input,correlationVector:S,payloadSchema:mn(a.lookupTableLambda.inputSchema),clientMetadata:o.clientMetadata,payload:{}},k=function(R){R.messageType===ot.Input&&R.payload&&o.lookupTableCache.set(e,R.payload),v()},w=o.createLambdaExecutionStep("",a.lookupTableLambda,{},k,k);w(M)}));var m=new Zu;m.name=e,m.lambdas=r,m.canProduceNullResult=a.canProduceNullResult,m.shouldSendResultsToHost=a.shouldSendResultsToHost,m.triggerOnRefresh=a.triggerOnRefresh,m.throttleSettings=a.throttleSettings||o.defaultWorkflowOptions.throttleSettings,m.docIdExtractor=a.docIdExtractor,m.docSessionIdExtractor=function(v){return v.isReduceInput?v.id:vs(c,v)},m.deferReduceUntilIdle=a.deferReduceUntilIdle,m.deferReduceUntilIdleMaxDelayMs=a.deferReduceUntilIdleMaxDelayMs,m.useCanaryTextTile=a.useCanaryTextTile,m.preExecutionPromise=d,f.push(m)}})}},{key:"logOperation",value:function(e,r,o,s){e.stop(),e.success=r,e.resultSignature=o,e.resultDescription=s,h.info(559290454,y.CoreDefault,e)}},{key:"handleLambdaError",value:function(e,r,o,s,a){e.exceptionType!=null?Nt(r,e):e instanceof Error?Nt(r,{exceptionType:s,message:e.message}):Nt(r,{exceptionType:te.Unknown,message:e?e.toString():void 0}),this.logOperation(o,!1,"Exception",_n(r)),a(r)}},{key:"handleLambdaOutput",value:function(e,r,o,s,a,u){e&&e.exceptionType!==te.NoOutput?e.exceptionType!=null?this.handleLambdaError(e,r,o,e.exceptionType,u):e instanceof Error?this.handleLambdaError(e,r,o,te.LambdaErrorCallback,u):(r.payload=e,r.payloadSchema=mn(s),this.logOperation(o,!0),a(r)):(Nt(r,{exceptionType:te.NoOutput}),this.logOperation(o,!0,"NoOutput"),u(r))}},{key:"executeCustomLambdaStep",value:function(e,r,o,s,a,u){var l=this;if(o.func==null)Nt(e,{exceptionType:te.LambdaThrow,message:"No lambda function set"}),this.logOperation(r,!1,"Error",_n(e)),u(e);else{var c=function(m){l.handleLambdaOutput(m,e,r,o.outputSchema,a,u)},f=function(m,v){l.handleLambdaOutput(m,e,r,v,u,u)};try{o.func(e.payload,o.config,s,c,f)}catch(d){this.handleLambdaError(d,e,r,te.LambdaThrow,u)}}}},{key:"executeLocalLambdaStep",value:function(e,r,o,s,a){var u=this;this.hostCallbacks.executeLocalLambda==null?(Nt(e,{exceptionType:te.LambdaThrow,message:"No local lambda host callback set"}),this.logOperation(r,!1,"Error",_n(e)),a(e)):this.hostCallbacks.executeLocalLambda(o.inputSchema,e.payload,o.outputSchema).then(function(l){u.handleLambdaOutput(l,e,r,o.outputSchema,s,a)}).catch(function(l){u.handleLambdaError(l,e,r,te.LambdaThrow,a)})}},{key:"executeRemoteLambdaStep",value:function(e,r,o,s,a,u){var l=this;if(this.serviceUrl){r.resourceId+=`.${this.serviceProtocol}`;var c=function(S,M){S?l.handleLambdaError(S,e,r,S.exceptionType||te.LambdaErrorCallback,u):l.handleLambdaOutput(M,e,r,o.outputSchema,a,u)};if(s.authTickets=o.authTickets,o.source===ne.Remote)this.executeRemoteLambda(this.serviceUrl,e,mn(o.inputSchema),mn(o.outputSchema),e.correlationVector,this.clientMetadata,this.hostCallbacks,s,c);else{this.batchedRemoteLambdaManager||(this.batchedRemoteLambdaManager=new cr(function(_,S,M){var k=S.context,w=k.remoteLambda,P=k.lambdaContext;l.executeRemoteLambda(l.serviceUrl,{messageType:ot.Input,correlationVector:{id:S.cv},payload:_,payloadSchema:mn(w.inputSchema),clientMetadata:l.clientMetadata},mn(w.remoteInputSchema),mn(w.remoteOutputSchema),{id:S.cv},l.clientMetadata,l.hostCallbacks,P,M)},!1,!1,function(_,S,M){var k,w=M.lambdaContext;l.updateResultCacheForReduceWorkflows("docSessionId",(k=w.docSessionId)!==null&&k!==void 0?k:w.docId,_,S)}));var f=o.batchOptions,d=this.normalizeBatchOptions(f),m=d.groupingKeyExtractor;d.groupingKeyExtractor=function(_){return`${o.name}-${m(_)}`};var v={name:o.name,remoteLambda:o,lambdaContext:s};this.batchedRemoteLambdaManager.addBatchItem(e.payload,d,v,e.correlationVector.id.length>127?e.correlationVector.id.substring(0,127)+"!":e.correlationVector.id,void 0,c)}}else Nt(e,{exceptionType:te.LambdaThrow,message:"No URL for remote lambda"}),this.logOperation(r,!1,"Error",_n(e)),u(e)}},{key:"createLambdaExecutionStep",value:function(e,r,o,s,a){var u=this;return function(l){var c=new b({cv:l.correlationVector.toString(),operationName:"ExecuteLambda",resourceId:r.name,dimension0:e});c.start(),r.source===ne.Custom?u.executeCustomLambdaStep(l,c,r,o,s,a):r.source===ne.Local?u.executeLocalLambdaStep(l,c,r,s,a):r.source===ne.Remote||r.source===ne.BatchedRemote?u.executeRemoteLambdaStep(l,c,r,o,s,a):(Nt(l,{exceptionType:te.LambdaThrow,message:"Unknown/No lambda location set"}),u.logOperation(c,!1,"Error",_n(l)),a(l))}}},{key:"normalizeBatchOptions",value:function(e){if(!e)throw new Error("Expected batchConfig");var r=Object.assign({},e);return e.estimateSize||(r.estimateSize=Ho),r}}])})(),gt=new Dv;p();p();var Yp=C(F()),Xp=C(G());var Pv=function(t,n,e,r){function o(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function u(f){try{c(r.next(f))}catch(d){a(d)}}function l(f){try{c(r.throw(f))}catch(d){a(d)}}function c(f){f.done?s(f.value):o(f.value).then(u,l)}c((r=r.apply(t,n||[])).next())})},Nv=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t[Symbol.asyncIterator],e;return n?n.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(s){e[s]=t[s]&&function(a){return new Promise(function(u,l){a=t[s](a),o(u,l,a.done,a.value)})}}function o(s,a,u,l){Promise.resolve(l).then(function(c){s({value:c,done:u})},a)}},rl=(function(){function t(){var n=this;(0,Yp.default)(this,t),this.bridgeMessageSequenceId=0,this.sessionCloseReasonMap=new Map,this.addCallbacksAlreadySet=new Set,this.sendBridgeMessage=function(e){n.messageBridge&&(e.seq=n.bridgeMessageSequenceId++,n.messageBridge.sendMessage(JSON.stringify(new gn(e))))},this.sendResponseAcrossBridge=function(e,r,o,s){e.catch(function(a){return n.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,a.message),new ee({messageId:r.messageId,error:a.message})}).then(function(a){n.sendBridgeMessage({bridgeId:o,docSessionId:s,response:a})}).catch(function(a){n.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,a.message)})}}return(0,Xp.default)(t,[{key:"initialize",value:function(e){this.messageBridge=e.messageBridge,this.getSessionCallback=e.getSessionCallback,this.hostTelemetryCallbacks=e.hostTelemetryCallbacks,this.messageBridge.registerMessageReceivedCallback(this.onBridgeMessageReceived.bind(this))}},{key:"setInterceptor",value:function(e){this.interceptorBridge=e,this.interceptorBridge.registerMessageReceivedCallback(this.onBridgeMessageReceivedFromInterceptor.bind(this))}},{key:"onBridgeMessageReceived",value:function(e){this.interceptorBridge!=null?this.interceptorBridge.sendMessage(e):this.handleBridgeMessage(e)}},{key:"onBridgeMessageReceivedFromInterceptor",value:function(e){this.handleBridgeMessage(e)}},{key:"handleBridgeMessage",value:function(e){var r=this;try{var o=JSON.parse(e),s=o.bridgeId,a=o.docSessionId,u=o.message,l=g.getTypeNameFor(u);this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Received message with messageTypeName ${l} on bridgeId ${s} and docSessionId ${a}`);var c=this.getSessionCallback(a);if(this.sessionCloseReasonMap.has(a)){var f=this.sessionCloseReasonMap.get(a);this.sendBridgeMessage({bridgeId:s,docSessionId:a,message:new be({reason:f})}),this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Session whose doc session id is ${a} is close due to ${f}`)}if(Vn.typeGuard(u))if(this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Sending GetHostBridgeSessionResponse to bridge with docSessionId ${a}`),c)c.then(function(k){r.sendBridgeMessage({bridgeId:s,docSessionId:a,response:new zn({messageId:u.messageId,isConnected:k.isConnected,isClosed:k.isClosed})})}).catch(function(k){r.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,k),r.sendBridgeMessage({bridgeId:s,docSessionId:a,response:new ee({messageId:u.messageId,error:k})})});else{var d="GetHostBridgeSessionRequestMessage called before session init";this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,d),this.sendBridgeMessage({bridgeId:s,docSessionId:a,response:new ee({messageId:u.messageId,error:d})})}else if(Kt.typeGuard(u))this.handleAnnotationActivationMessage(u,s,a,c);else if(Xe.typeGuard(u))this.handleGetAnnotationRequestBridgeMessage(u,s,a,c);else if(le.typeGuard(u)){this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,"Receiving Sync Message");var m=function(w){c.then(function(P){P.submitOperation(w,u.cv)}).catch(function(P){r.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,P.message)})};for(var v of u.ops)m(v);this.sendBridgeMessage({bridgeId:s,docSessionId:a,response:new Te({messageId:u.messageId})})}else if(Yt.typeGuard(u)){this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Releasing Annotation Activation token = ${u.token}`);var _=c.then(function(k){return k.releaseAnnotation(u.token).then(function(w){return r.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Sending Annotation Activation token = ${u.token}`),new Pn({messageId:u.messageId,lastRelease:w})})});this.sendResponseAcrossBridge(_,u,s,a)}else if(Wn.typeGuard(u))this.handleSubmittedCustomMessage(u,s,a,c);else if(Ne.typeGuard(u))this.handleSessionInitMessage(s,a,c);else if(g.matchesTypesFor(u,[qn.getTypeName()]))this.handleInteractiveAuthMessage(u,s,a,c);else if(g.matchesTypesFor(u,[$n.getTypeName()])){this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,"Setting seeding status change callback");var S=function(k){r.sendBridgeMessage({bridgeId:s,docSessionId:a,message:new Un({messageId:u.messageId,seedingStatusChangeMessage:k})})}.bind(this);c.then(function(k){k.setSeedingStatusChangeCallback(S)}).catch(function(k){r.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,k.message)})}else if(g.matchesTypesFor(u,[Fn.getTypeName()])){this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,"Setting claims challenge callback");var M=function(k){r.sendBridgeMessage({bridgeId:s,docSessionId:a,message:new Gn({messageId:u.messageId,claimsChallengeMessage:k})})}.bind(this);c.then(function(k){k.setClaimsChallengeCallback(M)}).catch(function(k){r.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,k.message)})}else this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,`Did not respond to ${l} with Id ${u.messageId}`),this.sendBridgeMessage({bridgeId:s,docSessionId:a,response:new ee({messageId:u.messageId,error:"Unknown message type to handle"})})}catch(k){this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,k.message),this.sendBridgeMessage({bridgeId:"unknown",docSessionId:"unknown",response:new ee({messageId:"unknown",error:k.message})})}}},{key:"addBridgeCallbacksForSession",value:function(e,r){var o=this;e.then(function(s){s.setServerAuthenticationStateChangeCallback(function(a){o.sendBridgeMessage({bridgeId:"*",docSessionId:r,message:new Zt({serverAuthenticationState:a})})}),s.setSessionCloseCallback(function(a){o.sessionCloseReasonMap.set(r,a.reason),o.sendBridgeMessage({bridgeId:"*",docSessionId:r,message:a})}),s.setConnectCallback(function(a,u,l,c,f,d){o.sendBridgeMessage({bridgeId:"*",docSessionId:r,message:new It({origin:l,sessionKey:u.split("/").pop(),sessionUrlBase:u.split("/").slice(0,-1).join("/"),anonymousToken:c,routingSessionKey:f,blobFileId:d})}),o.sendBridgeMessage({bridgeId:"*",docSessionId:r,message:new Bn({isSeedingRequired:a,sessionUrl:u,origin:l,authToken:c,routingSessionKey:f,blobFileId:d})})}),s.setReconnectCallback(function(){o.sendBridgeMessage({bridgeId:"*",docSessionId:r,message:new Ln})}),s.setDisconnectCallback(function(a){o.sendBridgeMessage({bridgeId:"*",docSessionId:r,message:new En({error:a})})})}).catch(function(s){o.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,s.message)})}},{key:"handleAnnotationActivationMessage",value:function(e,r,o,s){var a=this;this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Activate Annotation of type = ${e.annotationType} token = ${e.token}`);var u=function(c,f){a.sendBridgeMessage({bridgeId:r,docSessionId:o,message:new Oe({annotationType:e.annotationType,areApologies:!0,ops:[c],cv:f})})}.bind(this),l=s.then(function(c){return c.activateAnnotation(e.annotationType,{config:e.config,callback:function(d,m){a.sendBridgeMessage({bridgeId:r,docSessionId:o,message:new Oe({annotationType:e.annotationType,ops:[d],cv:m})})},apologyCallback:e.sendApologies?u:void 0,forceReturnCachedAnnotations:e.forceReturnCachedAnnotations}).then(function(f){return a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Annotation Activation Response Recieved with token = ${f.token}`),new Qt({messageId:e.messageId,token:f.token})})});this.sendResponseAcrossBridge(l,e,r,o)}},{key:"handleSessionInitMessage",value:function(e,r,o){var s=this;this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Initing session with doc session id ${r}`),this.addCallbacksAlreadySet.has(r)||(this.addBridgeCallbacksForSession(o,r),this.addCallbacksAlreadySet.add(r)),o.then(function(a){var u=a.getConnectParams();if(u!==void 0){var l=u.sessionUrl;s.sendBridgeMessage({bridgeId:e,docSessionId:r,message:new It({origin:u.origin,sessionKey:l.split("/").pop(),sessionUrlBase:l.split("/").slice(0,-1).join("/"),anonymousToken:u.authToken,routingSessionKey:u.routingSessionKey,blobFileId:u.blobFileId})}),s.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Inited session with doc session id ${r}`),s.sendBridgeMessage({bridgeId:e,docSessionId:r,message:new Zt({serverAuthenticationState:a.getServerAuthenticationState()})})}}).catch(function(a){s.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,a.message)})}},{key:"handleGetAnnotationRequestBridgeMessage",value:function(e,r,o,s){var a=this;this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,"Sending Get Annotation request");var u=s.then(function(l){return l.getAnnotations({annotationType:e.annotationTypes,sourceInfo:e.sourceInfo,configs:e.configs,transientItems:e.transientItems,maxDelayMs:e.maxDelayMs,tryResolveUpstreamDependencies:e.tryResolveUpstreamDependencies,cv:e.cv})});Promise.resolve(u).then(function(l){return Pv(a,void 0,void 0,function*(){var c,f,d,m,v,_,S,M,k,w;try{for(c=!0,f=Nv(l);d=yield f.next(),m=d.done,!m;c=!0){S=d.value,c=!1;var P=S;this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,"Receiving Get Annotation request");var R=new zt({content:P.content,errorInfo:(M=P.error)===null||M===void 0?void 0:M.serviceError,warningInfo:(k=P.warning)===null||k===void 0?void 0:k.serviceError}),B=new Hn({messageId:e.messageId,serverResponse:JSON.stringify(R),clientError:(w=P.error)===null||w===void 0?void 0:w.clientError,finalResponse:P.finalResponse});this.sendBridgeMessage({bridgeId:r,docSessionId:o,response:B})}}catch(W){v={error:W}}finally{try{!c&&!m&&(_=f.return)&&(yield _.call(f))}finally{if(v)throw v.error}}})}).catch(function(l){a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,l.message)})}},{key:"handleSubmittedCustomMessage",value:function(e,r,o,s){var a=this;this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Receiving SubmittedCustomMessage via message ${e.messageId}`),s.then(function(u){u.submitCustomMessage(e.customMessage).then(function(l){Te.typeGuard(l)?l.messageId=e.messageId:a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,"Unexpeced response type from SubmitCustomMessage"),a.sendBridgeMessage({bridgeId:r,docSessionId:o,response:l})}).catch(function(l){a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,l.message),a.sendBridgeMessage({bridgeId:r,docSessionId:o,response:new ee({messageId:e.messageId,error:l.message})})})}).catch(function(u){a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,u.message)})}},{key:"handleInteractiveAuthMessage",value:function(e,r,o,s){var a=this;this.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Interactive auth requested via message ${e.messageId}`);var u;s.then(function(l){l.authenticateInteractive().then(function(){a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.info,`Interactive auth succeeded for message ${e.messageId}`),u=new Te({messageId:e.messageId})}).catch(function(c){a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,`Interactive auth failed for message ${e.messageId}`),u=new ee({messageId:e.messageId,error:c.message})}).finally(function(){a.sendBridgeMessage({bridgeId:r,docSessionId:o,response:u})})}).catch(function(l){a.hostTelemetryCallbacks.sendDiagnosticTrace(0,q.error,l.message)})}}])})();var Le=C(eh()),Dh=C(nh());p();var rh=C(Rs());p();var il={documents:new Map,officeUILanguage:"",serviceUrl:"",docSessionIdToDocIdMap:new Map,docIdToDocSessionIdMap:new Map,classificationResponse:"Classification.Response",classificationBatchedResponse:"Classification.BatchResponse",classificationReduce:"Classification.Reduce",classificationReduceResponse:"Labelling.Response",labellingEditorUIResponse:"Labelling.EditorUIResponse",autoClpLicenseFeatures:[76080228,31135922],defaultBatchIntervalSeconds:3,defaultBatchSizeKB:20,defaultThrottlingIntervalSeconds:3,maxReduceDelayUntilIdleSeconds:5};function Cs(t,n){return ol.apply(this,arguments)}function ol(){return ol=(0,rh.default)(function*(t,n){il.officeUILanguage=t.uiLanguage,il.serviceUrl=n}),ol.apply(this,arguments)}p();p();var ih=function(n){return n.type===kn.TextTileEventType.Delete||n.tile.elements===void 0||n.tile.elements===null||n.tile.elements.length===0||n.tile.elements[0].text===void 0||n.tile.elements[0].text===null||n.tile.elements[0].text.length===0?null:n};var oh="Tiling.TextTileEvent",Ov="LangDetect.Request",Bv="LangDetect.Response",Ev=function(n){var e={name:"LangDetectLambdaBefore",source:ne.Custom,inputSchema:oh,outputSchema:oh,func:function(s,a,u,l){var c=ih(s);if(!c)l(null);else{var f={context:c.tile.elements.map(function(d){return d.text}).join(" ")};l(f)}}},r={name:"LangDetectLambdaRemote",source:ne.Remote,inputSchema:Ov,outputSchema:Bv};return n.registerSimpleRemoteWorkflow("LangDetectWorkflow",e,r,null,{canProduceNullResult:!0,shouldSendResultsToHost:!0,enabledByDefault:!0})};function sh(t){return Ev(t)}p();p();p();var ah="SlideTile";var lh="Proofing.",Lv="ProofingRequest",Wv="ProofingResponse",uh=`${lh}${Lv}`,Fv=`${lh}${Wv}`,Gv="827D1907-1E10-4F04-987A-B13FEC819C3C",$v="818BCDBE-64CE-46E8-A3D7-75A1EA8365A8",Uv=function(n,e){if(e.slides.length===0)return null;var r=[];n.appMetadata&&n.appMetadata.overriddenCritiqueTypeOptions&&(r=n.appMetadata.overriddenCritiqueTypeOptions),r.push({id:$v,languageId:"en-US",value:"0"});var o={documentId:n.docId,languageUxId:n.appMetadata?n.appMetadata.languageUxId:"en-US",descriptors:{isCompliant:n.appMetadata?n.appMetadata.descriptor.isCompliant:!0,licenseType:n.appMetadata?n.appMetadata.descriptor.licenseType:2},tiles:[],requestOrderInSession:n.reqOrd,runOnProfileId:Gv,overriddenCritiqueTypeOptions:r},s=e.slides[0];if(s.drawingElems)for(var a of s.drawingElems){var u=a.textTile;u.metadata={tileId:a.id,revisionId:"revision",tileType:1};for(var l=0,c=u.elements;l<c.length;l++){var f=c[l];f.languageId||(f.languageId="en-US"),f.textUnit=4}o.tiles.push(u)}return o},ch=function(n){var e={name:"ProofingLambdaBefore",source:ne.Custom,inputSchema:ah,outputSchema:uh,func:function(a,u,l,c){var f=a,d=JSON.parse(f.content),m=Uv(f,d);c(m)}},r={name:"ProofingLambdaRemote",source:ne.Remote,inputSchema:uh,outputSchema:Fv},o={canProduceNullResult:!1,shouldSendResultsToHost:!0,enabledByDefault:!0};return n.registerSimpleRemoteWorkflow("ProofingWorkflow",e,r,null,o)};function sl(t){return ch(t)}p();var Tr=C(al()),wh=C(vh());p();var ye=C(Ch()),Sh=C(F()),kh=C(G()),_h=(function(){function t(){(0,Sh.default)(this,t)}return(0,kh.default)(t,[{key:"log",value:function(e,r,o,s){(0,ye.default)(e),(0,ye.default)(r),(0,ye.default)(o),(0,ye.default)(s)}},{key:"info",value:function(e,r,o){(0,ye.default)(e),(0,ye.default)(r),(0,ye.default)(o)}},{key:"warn",value:function(e,r,o){(0,ye.default)(e),(0,ye.default)(r),(0,ye.default)(o)}},{key:"error",value:function(e,r,o){(0,ye.default)(e),(0,ye.default)(r),(0,ye.default)(o)}},{key:"debug",value:function(e,r,o){(0,ye.default)(e),(0,ye.default)(r),(0,ye.default)(o)}},{key:"logEvent",value:function(e,r,o,s,a,u){(0,ye.default)(e),(0,ye.default)(r),(0,ye.default)(o),(0,ye.default)(s),(0,ye.default)(a),(0,ye.default)(u)}}])})();var Th="Skills.Signal",cC="Skills.Intent",bh="Skills.ProviderResult",fC="Skills.RankedResult",cl,Mh=function(n){var e={name:"IntentClassifierLambdaRemote",source:ne.Remote,inputSchema:Th,outputSchema:cC};return n.registerSimpleRemoteWorkflow("IntentClassifierWorkflow",null,e,null)},Ih=function(n){var e={name:"ProviderResultLambdaRemote",source:ne.Remote,inputSchema:Th,outputSchema:bh};return n.registerSimpleRemoteWorkflow("ProviderResultWorkflow",null,e,null)},dC=function(n){var e={},r=[];for(var o of n.values)if(o){var s=o;try{var a={id:s.id,surfaceType:s.surfaceType,providerId:s.providerId,resultStatus:Tr.ProviderResultStatus[s.resultStatus],statusCode:s.statusCode,error:s.error?{errorType:Tr.ProviderErrorType[s.error.errorType],detail:s.error.detail}:null,additionalInfo:s.additionalInfo?JSON.parse(s.additionalInfo):null,entityGroups:s.entityGroups.map(function(l){return{groupTypeId:l.groupTypeId,providerId:l.providerId,data:l.data?JSON.parse(l.data):null,rank:l.rank}})},u={providerId:a.providerId,resultStatus:a.resultStatus,statusCode:a.statusCode,error:a.error,additionalInfo:a.additionalInfo,entityGroups:a.entityGroups,id:s.id,surfaceType:s.surfaceType};a.resultStatus===Tr.ProviderResultStatus.Success&&a.entityGroups?r=r.concat(a.entityGroups):a.resultStatus===Tr.ProviderResultStatus.NoResult&&a.entityGroups&&(u.entityGroups=void 0),e[a.providerId]=u}catch(l){e[s.providerId]=void 0}}return{transactionId:null,providerStatuses:e,rankedEntityGroups:r}},gC=function(){return{transactionId:null,interactionId:null}},pC=function(){if(!cl){var n={shouldQueryMatchQfDocumentTitle:!0},e=new _h;cl=new wh.SmartLookupRanker(e,n)}return cl},xh=function(n){var e={name:"InterProviderRanker",source:ne.Custom,inputSchema:bh,outputSchema:fC,func:function(s,a,u,l){var c=dC(s),f=pC();f.rank(gC(),c),l(c)}},r=function(s){var a={primary:s.id,secondary:null};return a};return n.registerReduceWorkflow("InterProviderRankerWorkflow",e,r)};p();var hC=function(n){if(!n)return null;var e={bar:n.baz,baz:n.bar};return e},Ah=function(n){var e={name:"BazBarLambda",source:ne.Custom,inputSchema:"Microsoft.AugLoop.BazBar",outputSchema:"Microsoft.AugLoop.BazBar",func:function(u,l,c,f){var d=hC(u);f(d)}},r={name:"HealthCheckRemoteLambda",source:ne.Remote,inputSchema:"HealthCheckRequest",outputSchema:"HealthCheckResponse"},o={name:"BazBarNativeLambda",source:ne.Local,inputSchema:"BazBarNativeRequest",outputSchema:"BazBarNativeResponse"},s={name:"BazBarMissingNativeLambda",source:ne.Local,inputSchema:"BazBarMissingNativeRequest",outputSchema:"BazBarNativeResponse"};return Promise.all([n.registerSimpleLocalWorkflow("BazBarWorkflow",e),n.registerSimpleLocalWorkflow("BazBarNativeWorkflow",o),n.registerSimpleLocalWorkflow("BazBarMissingNativeWorkflow",s),n.registerSimpleRemoteWorkflow("HealthCheckWorkflow",null,r,null)]).then(function(){})};function mC(t){var n,e,r,o=2;for(typeof Symbol!="undefined"&&(e=Symbol.asyncIterator,r=Symbol.iterator);o--;){if(e&&(n=t[e])!=null)return n.call(t);if(r&&(n=t[r])!=null)return new Ms(n.call(t));e="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ms(t){function n(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var r=e.done;return Promise.resolve(e.value).then(function(o){return{value:o,done:r}})}return Ms=function(r){this.s=r,this.n=r.next},Ms.prototype={s:null,n:null,next:function(){return n(this.n.apply(this.s,arguments))},return:function(r){var o=this.s.return;return o===void 0?Promise.resolve({value:r,done:!0}):n(o.apply(this.s,arguments))},throw:function(r){var o=this.s.return;return o===void 0?Promise.reject(r):n(o.apply(this.s,arguments))}},new Ms(t)}var Ph=function(n){var e,r,o=null,s=0,a=!1,u,l=null,c={sendConnectionParamsAcrossBridge:!1,stampBridgeMessageWithSequenceId:!1},f=new Map,d=new Map,m=new Map,v=new Map,_=function(T,A,D,x){n.OnResult({InputSchema:T,InputJson:JSON.stringify(A),OutputSchema:D,OutputJson:JSON.stringify(x)})},S=function(T){return n.RequestAuthToken(T)},M=function(T,A){return T.startsWith("Microsoft.Office")||(T="Microsoft.Office.AugLoop."+T),n.IsFeatureEnabled(T,A)},k=function(T){return n.IsChangeGateEnabled(T)},w=function(T){return n.AreLicenseFeaturesEnabled(T)},P=function(T,A,D,x){var L={InputSchema:T,InputJson:JSON.stringify(A),CorrelationVector:""};return n.ExecuteLocalLambda(L,D,"").then(function(O){return O?JSON.parse(O):void 0})},R=function(){var T=new Le.TelemetryLogger;T.setTenantTokens({Office:{AugLoop:{ariaTenantToken:"3de4087d4de34817b1c376e3d1e6e293-983c4292-5ba9-485a-ab10-9797863c788b-6770",nexusTenantToken:1780,Client:{}}}}),T.addSink((0,Dh.createOTelSink)());var A=function(x,L){var O=x.charAt(0).toUpperCase()+x.slice(1);if(typeof L=="string")return{name:O,dataType:Le.DataFieldType.String,value:L};if(typeof L=="boolean")return{name:O,dataType:Le.DataFieldType.Boolean,value:L};if(typeof L=="number")return{name:O,dataType:Le.DataFieldType.Double,value:L};if(typeof L=="object"&&L.isInteger)return{name:O,dataType:Le.DataFieldType.Int64,value:L.value}};return function(D,x,L,O,J,ie){var z={eventName:x.replace(/_/g,".")};z.eventFlags={samplingPolicy:Le.SamplingPolicy.Measure,dataCategories:Le.DataCategories.ProductServiceUsage|Le.DataCategories.ProductServicePerformance,diagnosticLevel:Le.DiagnosticLevel.NecessaryServiceDataEvent},O==="Office.System.Activity"&&(z.eventContract={name:O,dataFields:Le.Contracts.Office.System.Activity.getFields({duration:J.Duration,count:J.Count,aggMode:J.AggMode,cV:J.CV,success:J.Success,result:J.Result?{code:J.Result.Code||0,type:J.Result.Type,tag:J.Result.Tag}:void 0})}),z.dataFields=Object.keys(L).filter(function(re){return L[re]!==void 0}).map(function(re){return A(re,L[re])}),T.sendTelemetryEvent(z),r&&r.appName&&r.appName.toLowerCase()==="testing"&&n.SendDiagnosticTrace(0,he.Info,`EventName: ${x} Contract: ${O} ContractData: ${JSON.stringify(J)} Data: ${JSON.stringify(L)}`)}},B={onResult:_,onAnnotationResult:null,requestAuthToken:S,sendTelemetryEvent:R(),isFeatureEnabled:M,isChangeGateEnabled:k,executeLocalLambda:P,areLicenseFeaturesEnabled:w};h.addLogger({level:q.info,log:function(T){if(T.eventName==="Log"){var A,D,x;n.SendDiagnosticTrace((A=T.tagId)!=null?A:0,(D=T.traceLevel)!=null?D:he.Info,(x=T.message)!=null?x:"")}}});var W=function(){return o!==null||(o=Promise.all([n.IsFeatureEnabled("Microsoft.Office.AugLoop.EnableAugLoopPhase3","None"),n.IsFeatureEnabled("Microsoft.Office.AugLoop.EnablePhase3Service","None"),n.IsFeatureEnabled("Microsoft.Office.AugLoop.UseBridgePackage","None"),n.IsChangeGateEnabled("SendConnectionParamsAcrossBridge"),n.IsChangeGateEnabled("StampBridgeMessageWithSequenceId")]).then(function(T){var A=(0,Rh.default)(T,5),D=A[0],x=A[1],L=A[2],O=A[3],J=A[4];if(a=L,a){var ie={sendMessage:function(oe){n.OnSDXBridgeMessageResult({bridgeMessage:oe})},registerMessageReceivedCallback:function(oe){l=oe}},z={messageBridge:ie,getSessionCallback:function(oe){return f.get(oe)},hostTelemetryCallbacks:{sendDiagnosticTrace:function(oe,se,pe){var ke=(function(){switch(se){case q.error:return he.Error;case q.warn:return he.Warning;case q.info:return he.Info;case q.metric:return he.Metric;case q.verbose:return he.Verbose;case q.debug:return he.Debug;default:return he.Debug}})();n.SendDiagnosticTrace(oe,ke,pe)},sendTelemetryEvent:function(oe,se,pe,ke,tt,Be,pt,it){throw new Error("Method not implemented.")}},changeGateFeatureGateCallbacks:{isFeatureEnabled:function(oe,se){return n.IsFeatureEnabled(oe,se)},isChangeGateEnabled:function(oe){return n.IsChangeGateEnabled(oe)}}};u=new rl,u.initialize(z)}return h.debug(0,y.CoreDefault,`Use bridge package: ${a}`),c.sendConnectionParamsAcrossBridge=O,c.stampBridgeMessageWithSequenceId=J,ps.init(e,r,B,{networkMode:D&&x?ce.LocalWorkflowsOnly:void 0,telemetryAggregationIntervalSec:30,batchOptions:{delayMs:100,maxInputSize:1048576}}).then(function(){return gt.init(e,r,B)}).then(function(){if(r.appName==="PowerPoint")return Promise.all([sl(gt),Mh(gt),Cs(r,e)]).then(function(){});if(r.appName==="Word")return Promise.all([Ih(gt),xh(gt),Cs(r,e)]).then(function(){});if(r.appName==="Outlook")return Promise.all([Cs(r,e)]).then(function(){});if(r.appName==="OneNote")return sh(gt);if(r.appName==="Testing")return Promise.all([Ah(gt),sl(gt)]).then(function(){})})})),o};n.OnSubmit.subscribe(function(N){var T="RekaPing";if(N.InputSchema===T){n.OnResult({InputSchema:T,InputJson:N.InputJson,OutputSchema:T,OutputJson:N.InputJson});return}W().then(function(){gt.submit(N.InputSchema,JSON.parse(N.InputJson),N.CorrelationVector)})}),n.OnSetServiceUrl.subscribe(function(N){e=N}),n.OnSetHostMetadata.subscribe(function(N){var T=[];for(var A of N.DisabledServiceGroups)T.push({officeServiceGroup:A.OfficeServiceGroup,controllerServiceGroup:A.ControllerServiceGroup});r={appName:N.AppName,appPlatform:N.AppPlatform,appVersion:N.AppVersion,uiLanguage:N.UILanguage,releaseAudienceGroup:N.ReleaseAudienceGroup,releaseChannel:N.ReleaseChannel,releaseFork:N.ReleaseFork,sessionId:N.SessionId,flights:N.Flights,privateMode:N.PrivateMode,disabledServiceGroups:T,userSystemTimezone:N.SystemTimezone,isClientTelemetrySampled:N.IsClientTelemetrySampled}});var I=function(T,A){h.error(593892183,y.CoreDefault,`Session not found for ${T} event, docSessionId: ${A}`)},X=function(T){h.warn(0,y.CoreDefault,`Annotation token not found for ${T} event`)},Z=function(T,A,D){h.error(0,y.CoreDefault,`Bad input for ${T}: ${A}, docSessionId: ${D}`)},U=function(T,A,D){var x=new b({operationName:T,success:D,ariaNamespace:"Office_AugLoop_Client_SDXAugLoop",clientDocSessionId:A}).start();return x},E=function(T,A,D){var x=U("InteropPromiseRejected",D,!1);x.resourceId=T,x.resultDescription=A,h.error(593892186,y.CoreDefault,x.stop())},$=function(T){if(T){if(typeof T=="string")return T;if(typeof T.message=="string")return T.message}return"Unknown error"},K=function(T){c.stampBridgeMessageWithSequenceId&&(T.seq=s++),n.OnSDXBridgeMessageResult({bridgeMessage:JSON.stringify(new gn(T))})},ge=function(T,A){if(v.has(A)&&c.sendConnectionParamsAcrossBridge){var D=v.get(A),x=D.sessionUrl,L=new gn({bridgeId:T,docSessionId:A,message:new It({origin:D.origin,sessionKey:x.split("/").pop(),sessionUrlBase:x.split("/").slice(0,-1).join("/"),anonymousToken:D.authToken,routingSessionKey:D.routingSessionKey,blobFileId:D.blobFileId})});K(L)}};n.OnCreateSession.subscribe(function(N){var T=N.docSessionId,A=N.flights,D=N.serviceUrl,x=N.offlineMode;if(f.has(T)){n.OnCreateSessionResult({errMessage:"docSessionId already exists",docSessionId:T});return}var L,O=W().then(function(){var J=[];try{for(var ie of N.extensionConfigs||[])J.push(JSON.parse(ie))}catch(oe){throw Z("OnCreateSession",$(oe),T),new Error("Bad extension configs")}var z="*",re=a?{docSessionId:T,extensionConfigs:J,flights:A,serviceUrl:D}:{docSessionId:T,onSessionConnect:function(se,pe,ke,tt,Be,pt){if(h.debug(0,y.CoreDefault,"In AL Session onSessionConnect"),!v.has(T)&&c.sendConnectionParamsAcrossBridge){var it={authToken:tt,isSeedingRequired:se,sessionUrl:pe,origin:ke,routingSessionKey:Be,blobFileId:pt};v.set(T,it),ge(z,T)}var vn={bridgeId:z,docSessionId:T,message:new Bn({isSeedingRequired:se,sessionUrl:pe,origin:ke,authToken:tt,routingSessionKey:Be,blobFileId:pt})};K(vn)},onSessionDisconnect:function(se){h.debug(0,y.CoreDefault,"In AL Session onSessionDisconnect"),v.delete(T);var pe={bridgeId:z,docSessionId:T,message:new En({error:se})};K(pe)},onSessionReconnect:function(){h.debug(0,y.CoreDefault,"In AL Session onSessionReconnect");var se={bridgeId:z,docSessionId:T,message:new Ln};K(se)},onSessionClose:function(se){h.debug(0,y.CoreDefault,"In AL Session onSessionClose");var pe={bridgeId:z,docSessionId:T,message:se};K(pe)},onServerAuthenticationStateChangeCallback:function(se){h.debug(0,y.CoreDefault,"In AL Session onServerAuthenticationStateChangeCallback"),m.set(T,se);var pe={bridgeId:z,docSessionId:T,message:new Zt({serverAuthenticationState:se})};K(pe)},onClaimsChallengeCallback:function(se){h.debug(0,y.CoreDefault,"In AL Session onClaimsChallengeCallback");var pe={bridgeId:z,docSessionId:T,message:se};K(pe)},onSeedingStatusChangeCallback:function(se){h.debug(0,y.CoreDefault,"In AL Session onSeedingStatusChangeCallback");var pe={bridgeId:z,docSessionId:T,message:se};K(pe)},extensionConfigs:J,flights:A,serviceUrl:D};return x&&(re.networkMode=ce.LocalWorkflowsOnly),N.tid3pHost&&(re.tid3pHost=N.tid3pHost),ps.createSession(re)}).then(function(J){return n.OnCreateSessionResult({errMessage:L,docSessionId:T}),J}).catch(function(J){throw f.delete(T),L=$(J),E("OnCreateSession",L,T),n.OnCreateSessionResult({errMessage:L,docSessionId:T}),new Error(L)});f.set(T,O)}),n.OnActivateAnnotation.subscribe(function(N){var T=N.annotationType,A=N.token,D=N.config,x=N.docSessionId,L=N.forceReturnCachedAnnotations,O=N.sendApologies,J=f.get(x);if(!J){I("OnActivateAnnotation",x);return}var ie;J.then(function(z){var re=D?JSON.parse(D):void 0,oe=function(ke,tt){n.OnAnnotationResult({operation:JSON.stringify(ke),token:A,docSessionId:x,annotationType:T,cv:tt})},se=function(ke,tt){n.OnAnnotationResult({operation:JSON.stringify(ke),token:A,docSessionId:x,annotationType:T,areApologies:!0,cv:tt})};return z.activateAnnotation(T,{config:re,callback:oe,apologyCallback:O?se:void 0,forceReturnCachedAnnotations:L})}).then(function(z){z&&z.token&&d.set(A,z.token)}).catch(function(z){ie=$(z)}).then(function(){n.OnActivateAnnotationResult({errMessage:ie,token:A,docSessionId:x})}).catch(function(z){E("OnActivateAnnotation",$(z),x)})}),n.OnReleaseAnnotation.subscribe(function(N){var T=N.token,A=N.docSessionId,D=d.get(T);if(!D){X("OnReleaseAnnotation");return}var x=f.get(A);if(!x){I("OnReleaseAnnotation",A);return}var L;x.then(function(O){return O.releaseAnnotation(D)}).catch(function(O){L=$(O)}).then(function(O){O&&d.delete(T),n.OnReleaseAnnotationResult({errMessage:L,token:T,result:O})}).catch(function(O){E("OnReleaseAnnotation",$(O),A)})}),n.OnSubmitOperations.subscribe(function(N){var T=N.operations,A=N.cv,D=N.docSessionId,x=f.get(D);if(!x){I("OnSubmitOperations",D);return}x.then(function(L){L.submitOperations(T.map(function(O){return JSON.parse(O)}),A)}).catch(function(L){E("OnSubmitOperations",$(L),D)})}),n.OnSubmitSeedGroupOperations.subscribe(function(N){var T=N.operations,A=N.groupComplete,D=N.cv,x=N.docSessionId,L=f.get(x);if(!L){I("OnSubmitSeedGroupOperations",x);return}L.then(function(O){O.submitSeedGroupOperations(T.map(function(J){return JSON.parse(J)}),A,D)}).catch(function(O){E("OnSubmitSeedGroupOperations",$(O),x)})}),n.OnSubmitCustomMessage.subscribe(function(N){var T=N.message,A=N.messageId,D=N.docSessionId,x=f.get(D);if(!x){I("OnSubmitCustomMessage",D);return}var L,O;x.then(function(J){return J.submitCustomMessage(JSON.parse(T))}).then(function(J){O=J}).catch(function(J){L=$(J)}).then(function(){n.OnSubmitCustomMessageResult({errMessage:L,response:JSON.stringify(O),messageId:A,docSessionId:D})}).catch(function(J){E("OnSubmitCustomMessage",$(J),D)})}),n.OnForceReconnect.subscribe(function(N){var T=N.docSessionId,A=f.get(T);if(!A){I("OnForceReconnect",T);return}var D=[];try{for(var x of N.extensionConfigs||[])D.push(JSON.parse(x))}catch(O){Z("OnForceReconnect",$(O),T);return}var L;A.then(function(O){return O.forceReconnect()}).catch(function(O){L=$(O)}).then(function(){n.OnForceReconnectResult({errMessage:L,docSessionId:T})}).catch(function(O){E("OnForceReconnect",$(O),T)})}),n.OnClose.subscribe(function(N){var T=N.docSessionId,A=f.get(T);if(!A){I("OnClose",T);return}A.then(function(D){D.close(),f.delete(T),m.delete(T)}).catch(function(D){E("OnClose",$(D),T)})}),n.OnAuthenticateInteractive.subscribe(function(N){var T=N.docSessionId,A=N.token,D=f.get(T);if(!D){I("OnAuthenticateInteractive",T);return}var x;D.then(function(L){return L.authenticateInteractive()}).catch(function(L){x=$(L)}).then(function(){n.OnAuthenticateInteractiveResult({errMessage:x,token:A,docSessionId:T})}).catch(function(L){E("OnAuthenticateInteractive",$(L),T)})}),n.OnSetSessionCloseCallback.subscribe(function(N){var T=N.docSessionId,A=f.get(T);if(!A){I("OnSetSessionCloseCallback",T);return}A.then(function(D){D.setSessionCloseCallback(function(x){n.OnSessionCloseResult({docSessionId:T,sessionCloseMessage:x?JSON.stringify(x):void 0})})}).catch(function(D){E("OnSetSessionCloseCallback",$(D),T)})}),n.OnSetConnectCallback.subscribe(function(N){var T=N.docSessionId,A=f.get(T);if(!A){I("OnSetConnectCallback",T);return}A.then(function(D){D.setConnectCallback(function(x,L,O,J,ie,z){var re=U("OnConnectCallback",T,!0);re.setClientMetadata(r,!0),re.setDataField("IsSeedingRequired",x);var oe=L.substring(L.lastIndexOf("/")+1);re.setDataField("ServerSessionKey",oe),n.OnConnectResult({docSessionId:T,isSeedingRequired:x,sessionUrl:L,origin:O,authToken:J,routingSessionKey:ie,blobFileId:z}),h.info(0,y.CoreDefault,re.stop())})}).catch(function(D){E("OnSetConnectCallback",$(D),T)})}),n.OnSetDisconnectCallback.subscribe(function(N){var T=N.docSessionId,A=f.get(T);if(!A){I("OnSetDisconnectCallback",T);return}A.then(function(D){D.setDisconnectCallback(function(x){n.OnDisconnectResult({error:x,docSessionId:T})})}).catch(function(D){E("OnSetDisconnectCallback",$(D),T)})}),n.OnSetClaimsChallengeCallback.subscribe(function(N){var T=N.docSessionId,A=N.token,D=f.get(T);if(!D){I("OnSetClaimsChallengeCallback",T);return}D.then(function(x){x.setClaimsChallengeCallback(function(L){n.OnClaimsChallengeResult({docSessionId:T,token:A,claimsChallengeMessage:L?JSON.stringify(L):void 0})})}).catch(function(x){E("OnSetClaimsChallengeCallback",$(x),T)})}),n.OnSetSeedingStatusChangeCallback.subscribe(function(N){var T=N.docSessionId,A=N.token,D=f.get(T);if(!D){I("OnSetSeedingStatusChangeCallback",T);return}D.then(function(x){x.setSeedingStatusChangeCallback(function(L){n.OnSeedingStatusChangeResult({docSessionId:T,token:A,seedingStatusChangeMessage:L?JSON.stringify(L):void 0})})}).catch(function(x){E("OnSetSeedingStatusChangeCallback",$(x),T)})}),n.OnSetOfflineMode.subscribe(function(N){var T=N.docSessionId,A=f.get(T);if(!A){I("OnSetOfflineMode",T);return}A.then(function(D){D.setOfflineMode()}).catch(function(D){E("OnSetOfflineMode",$(D),T)})}),n.OnSDXBridgeMessageFromNative.subscribe(function(N){if(l){l(N.bridgeMessage);return}var T=JSON.parse(N.bridgeMessage),A=T.bridgeId,D=T.docSessionId,x=T.message,L=g.getTypeNameFor(x);n.SendDiagnosticTrace(0,he.Info,"TS Received Brige Message of type = "+L);var O=f.get(D);if(!O){I("OnSDXBridgeMessageFromNative",D);var J={bridgeId:A,docSessionId:D,response:new ee({messageId:x.messageId,error:"Session not found"})};K(J);return}O.then(function(ie){if(Vn.typeGuard(x))n.SendDiagnosticTrace(0,he.Info,`Sending GetHostBridgeSessionResponse to bridge with docSessionId ${D}`),K({bridgeId:A,docSessionId:D,response:new zn({messageId:x.messageId,isConnected:ie.isConnected,isClosed:ie.isClosed})});else if(Kt.typeGuard(x)){var z=x.annotationType,re=x.config;n.SendDiagnosticTrace(0,he.Info,"TS Activate Annotation of type = "+z+" token = "+x.token);var oe=function(ve,Ae){var ht={bridgeId:A,docSessionId:D,message:new Oe({annotationType:z,areApologies:!0,ops:[ve],cv:Ae})};K(ht)};ie.activateAnnotation(z,{config:re,callback:function(ve,Ae){var ht={bridgeId:A,docSessionId:D,message:new Oe({annotationType:z,ops:[ve],cv:Ae})};K(ht)},apologyCallback:x.sendApologies?oe:void 0,forceReturnCachedAnnotations:x.forceReturnCachedAnnotations}).then(function(de){n.SendDiagnosticTrace(0,he.Info,"TS Annotation Activation Response Received with token = "+de.token);var ve={bridgeId:A,docSessionId:D,response:new Qt({messageId:x.messageId,token:de.token})};K(ve)}).catch(function(de){var ve={bridgeId:A,docSessionId:D,response:new ee({messageId:x.messageId,error:$(de)})};K(ve)})}else if(Xe.typeGuard(x)){n.SendDiagnosticTrace(0,he.Info,"TS Sending Get Annotation request");var se=ie.getAnnotations({annotationType:x.annotationTypes,sourceInfo:x.sourceInfo,configs:x.configs,transientItems:x.transientItems,maxDelayMs:x.maxDelayMs,tryResolveUpstreamDependencies:x.tryResolveUpstreamDependencies,cv:x.cv});Promise.resolve(se).then((function(){var de=(0,fl.default)(function*(ve){var Ae=!1,ht=!1,Is;try{for(var Cn=mC(ve),nn;Ae=!(nn=yield Cn.next()).done;Ae=!1){var Sn=nn.value;{var Yn,dl,gl;n.SendDiagnosticTrace(0,he.Info,"TS Receiving Get Annotation response");var Oh=new zt({content:Sn.content,errorInfo:(Yn=Sn.error)==null?void 0:Yn.serviceError,warningInfo:(dl=Sn.warning)==null?void 0:dl.serviceError}),Bh=new Hn({messageId:x.messageId,serverResponse:JSON.stringify(Oh),clientError:(gl=Sn.error)==null?void 0:gl.clientError,finalResponse:Sn.finalResponse});K({bridgeId:A,docSessionId:D,response:Bh})}}}catch(Eh){ht=!0,Is=Eh}finally{try{Ae&&Cn.return!=null&&(yield Cn.return())}finally{if(ht)throw Is}}});return function(ve){return de.apply(this,arguments)}})())}else if(le.typeGuard(x)){var pe=x.ops;for(var ke of pe)ie.submitOperation(ke,x.cv)}else if(Yt.typeGuard(x))n.SendDiagnosticTrace(0,he.Info,"TS Releasing Annotation Activation token = "+x.token),ie.releaseAnnotation(x.token).then(function(de){n.SendDiagnosticTrace(0,he.Info,"TS Sending Annotation Release Response token = "+x.token);var ve={bridgeId:A,docSessionId:D,response:new Pn({messageId:x.messageId,lastRelease:de})};K(ve)});else if(Wn.typeGuard(x))ie.submitCustomMessage(x.customMessage).then(function(de){de.messageId=x.messageId,n.SendDiagnosticTrace(0,he.Info,`Responded to ${L}`);var ve={bridgeId:A,docSessionId:D,response:de};K(ve)}).catch(function(de){n.SendDiagnosticTrace(0,he.Info,de.message);var ve={bridgeId:A,docSessionId:D,response:new ee({messageId:x.messageId,error:de.message})};K(ve)});else if(Ne.typeGuard(x)){ge(A,D);var tt={bridgeId:A,docSessionId:D,message:new Zt({serverAuthenticationState:m.has(D)?m.get(D):fe.Pending})};K(tt)}else if(g.matchesTypesFor(x,[qn.getTypeName()])){n.SendDiagnosticTrace(0,he.Info,`Interactive auth requested via message ${x.messageId}`);var Be;ie.authenticateInteractive().then(function(){n.SendDiagnosticTrace(0,he.Info,`Interactive auth succeeded for message ${x.messageId}`),Be=new Te({messageId:x.messageId})}).catch(function(de){n.SendDiagnosticTrace(0,he.Error,`Interactive auth failed for message ${x.messageId}`),Be=new ee({messageId:x.messageId,error:$(de)})}).finally(function(){var de={bridgeId:A,docSessionId:D,response:Be};K(de)})}else if(g.matchesTypesFor(x,[Fn.getTypeName()])){var pt=function(ve){var Ae={bridgeId:A,docSessionId:D,message:new Gn({messageId:x.messageId,claimsChallengeMessage:ve})};K(Ae)};ie.setClaimsChallengeCallback(pt)}else if(g.matchesTypesFor(x,[$n.getTypeName()])){var it=function(ve){var Ae={bridgeId:A,docSessionId:D,message:new Un({messageId:x.messageId,seedingStatusChangeMessage:ve})};K(Ae)};ie.setSeedingStatusChangeCallback(it)}else{var vn={bridgeId:A,docSessionId:D,response:new ee({messageId:x.messageId,error:"Unknown message type to handle"})};K(vn)}}).catch(function(ie){E("OnReceiveBridgeMessageFromNative",$(ie),D);var z={bridgeId:A,docSessionId:D,response:new ee({messageId:x.messageId,error:$(ie)})};K(z)})}),n.OnSetServerAuthenticationStateChangeCallback.subscribe(function(N){var T=N.docSessionId,A=f.get(T);if(!A){I("OnSetServerAuthenticationStateChangeCallback",T);return}A.then(function(D){D.setServerAuthenticationStateChangeCallback(function(x){n.OnSetServerAuthenticationStateChangeCallbackResult({docSessionId:T,state:x})})}).catch(function(D){E("OnSetServerAuthenticationStateChangeCallback",$(D),T)})}),n.OnActivateServerRequestResponse.subscribe(function(N){var T=N.annotationType,A=N.token,D=N.docSessionId,x=f.get(D);if(!x){I("OnActivateServerRequestResponse",D);return}var L;x.then(function(O){return O.activateServerRequestResponse(T,{onAnnotationCallback:(function(){var J=(0,fl.default)(function*(z,re){n.OnServerRequestResponseAnnotationResult({annotation:JSON.stringify(z),token:A,docSessionId:D,annotationType:T})});function ie(z,re){return J.apply(this,arguments)}return ie})()})}).catch(function(O){L=$(O)}).then(function(){n.OnActivateServerRequestResponseResult({errMessage:L,token:A,docSessionId:D})}).catch(function(O){E("OnActivateServerRequestResponse",$(O),D)})})};(0,Nh.initReka)();Ph(Cl.NativeService);})();
//# sourceMappingURL=index.win32.bundle.map

Youez - 2016 - github.com/yon3zu
LinuXploit