UNPKG

@googleworkspace/meet-addons

Version:

The Google Meet Add-ons SDK lets you embed your app into Google Meet as an add-on where users can discover, share, and collaborate in the app without leaving Meet

71 lines (69 loc) 47.1 kB
const topLevel = typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {};(function() {'use strict';var aa=Object.defineProperty;function ba(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var ca=ba(this); function da(a,b){if(b)a:{var c=ca;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&b!=null&&aa(c,a,{configurable:!0,writable:!0,value:b})}}da("Symbol.dispose",function(a){return a?a:Symbol("Symbol.dispose")});/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ var l=this||self;function ea(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var d=c.slice();d.push.apply(d,arguments);return a.apply(this,d)}}function fa(a,b){function c(){}c.prototype=b.prototype;a.qa=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.oa=function(d,e,f){for(var g=Array(arguments.length-2),k=2;k<arguments.length;k++)g[k-2]=arguments[k];return b.prototype[e].apply(d,g)}};function ha(a,b){if(Error.captureStackTrace)Error.captureStackTrace(this,ha);else{const c=Error().stack;c&&(this.stack=c)}a&&(this.message=String(a));b!==void 0&&(this.cause=b)}fa(ha,Error);ha.prototype.name="CustomError";function m(a){l.setTimeout(()=>{throw a;},0)};var ia,ja;a:{for(var ka=["CLOSURE_FLAGS"],la=l,ma=0;ma<ka.length;ma++)if(la=la[ka[ma]],la==null){ja=null;break a}ja=la}var na=ja&&ja[610401301];ia=na!=null?na:!1;var oa;const pa=l.navigator;oa=pa?pa.userAgentData||null:null;function qa(a){return ia?oa?oa.brands.some(({brand:b})=>b&&b.indexOf(a)!=-1):!1:!1}function n(a){var b;a:{if(b=l.navigator)if(b=b.userAgent)break a;b=""}return b.indexOf(a)!=-1};function p(){return ia?!!oa&&oa.brands.length>0:!1}function ra(){return p()?qa("Chromium"):(n("Chrome")||n("CriOS"))&&!(p()?0:n("Edge"))||n("Silk")};function sa(a,b){b=Array.prototype.indexOf.call(a,b,void 0);b>=0&&Array.prototype.splice.call(a,b,1)};!n("Android")||ra();ra();n("Safari")&&(ra()||(p()?0:n("Coast"))||(p()?0:n("Opera"))||(p()?0:n("Edge"))||(p()?qa("Microsoft Edge"):n("Edg/"))||p()&&qa("Opera"));function ta(a){let b="",c=0;const d=a.length-10240;for(;c<d;)b+=String.fromCharCode.apply(null,a.subarray(c,c+=10240));b+=String.fromCharCode.apply(null,c?a.subarray(c):a);return btoa(b)}const ua=/[-_.]/g,va={"-":"+",_:"/",".":"="};function wa(a){return va[a]||""}function xa(a){return a!=null&&a instanceof Uint8Array}var ya={};function za(){return Aa||(Aa=new Ba(null,ya))}var Ba=class{constructor(a,b){Ca(b);this.g=a;if(a!=null&&a.length===0)throw Error("ByteString should be constructed with non-empty values");}};let Aa;function Ca(a){if(a!==ya)throw Error("illegal external caller");};function Da(a,b){a.__closure__error__context__984382||(a.__closure__error__context__984382={});a.__closure__error__context__984382.severity=b};let Ea;function Fa(){const a=Error();Da(a,"incident");m(a)}function Ga(a){a=Error(a);Da(a,"warning");return a};function Ha(){return typeof BigInt==="function"};function Ia(a){return Array.prototype.slice.call(a)};function q(a,b){return b&&Symbol.for&&a?Symbol.for(a):a!=null?Symbol(a):Symbol()}var r=q("jas",!0);q();var La=q(),Ma=q();q();q();function Na(a,b){b[r]=(a|0)&-30975}function Oa(a,b){b[r]=(a|34)&-30941};var Pa={},Qa={};function Ra(a){return!(!a||typeof a!=="object"||a.g!==Qa)}function Sa(a){return a!==null&&typeof a==="object"&&!Array.isArray(a)&&a.constructor===Object}function Ta(a,b){if(a!=null)if(typeof a==="string")a=a?new Ba(a,ya):za();else if(a.constructor!==Ba)if(xa(a))a=a.length?new Ba(new Uint8Array(a),ya):za();else{if(!b)throw Error();a=void 0}return a}function Ua(a){return!Array.isArray(a)||a.length?!1:(a[r]|0)&1?!0:!1}var Va;const Wa=[];Wa[r]=55;Va=Object.freeze(Wa); function Xa(a){if(a&2)throw Error();}var Ya=Object.freeze({});function Za(a){a.pa=!0;return a};var $a=Za(a=>typeof a==="number"),ab=Za(a=>typeof a==="string"),bb=Za(a=>typeof a==="boolean");var cb=typeof l.BigInt==="function"&&typeof l.BigInt(0)==="bigint";var ib=Za(a=>cb?a>=db&&a<=eb:a[0]==="-"?fb(a,gb):fb(a,hb));const gb=Number.MIN_SAFE_INTEGER.toString(),db=cb?BigInt(Number.MIN_SAFE_INTEGER):void 0,hb=Number.MAX_SAFE_INTEGER.toString(),eb=cb?BigInt(Number.MAX_SAFE_INTEGER):void 0;function fb(a,b){if(a.length>b.length)return!1;if(a.length<b.length||a===b)return!0;for(let c=0;c<a.length;c++){const d=a[c],e=b[c];if(d>e)return!1;if(d<e)return!0}};let u=0,w=0;function jb(a){const b=a>>>0;u=b;w=(a-b)/4294967296>>>0}function kb(a){if(a<0){jb(-a);const [b,c]=lb(u,w);u=b>>>0;w=c>>>0}else jb(a)}function mb(a,b){b>>>=0;a>>>=0;if(b<=2097151)var c=""+(4294967296*b+a);else Ha()?c=""+(BigInt(b)<<BigInt(32)|BigInt(a)):(c=(a>>>24|b<<8)&16777215,b=b>>16&65535,a=(a&16777215)+c*6777216+b*6710656,c+=b*8147497,b*=2,a>=1E7&&(c+=a/1E7>>>0,a%=1E7),c>=1E7&&(b+=c/1E7>>>0,c%=1E7),c=b+nb(c)+nb(a));return c} function nb(a){a=String(a);return"0000000".slice(a.length)+a}function lb(a,b){b=~b;a?a=~a+1:b+=1;return[a,b]};function ob(a){if(a==null||typeof a==="boolean")return a;if(typeof a==="number")return!!a}const pb=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function qb(a){const b=typeof a;switch(b){case "bigint":return!0;case "number":return Number.isFinite(a)}return b!=="string"?!1:pb.test(a)}function y(a){if(a!=null){if(!Number.isFinite(a))throw Ga("enum");a|=0}return a}function rb(a){if(a!=null){if(typeof a==="string"){if(!a)return;a=+a}typeof a==="number"&&Number.isFinite(a)}} function sb(a){if(a!=null)a:{if(!qb(a))throw Ga("int64");switch(typeof a){case "string":a=xb(a);break a;case "bigint":var b=a=BigInt.asIntN(64,a);if(ab(b)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(b))throw Error(String(b));}else if($a(b)&&!Number.isSafeInteger(b))throw Error(String(b));cb?a=BigInt(a):a=bb(a)?a?"1":"0":ab(a)?a.trim()||"0":String(a);break a;default:a=yb(a)}}return a} function yb(a){a=Math.trunc(a);if(!Number.isSafeInteger(a)){kb(a);var b=u,c=w;if(a=c&2147483648)b=~b+1>>>0,c=~c>>>0,b==0&&(c=c+1>>>0);const d=c*4294967296+(b>>>0);b=Number.isSafeInteger(d)?d:mb(b,c);a=typeof b==="number"?a?-b:b:a?"-"+b:b}return a} function xb(a){var b=Math.trunc(Number(a));if(Number.isSafeInteger(b))return String(b);b=a.indexOf(".");b!==-1&&(a=a.substring(0,b));if(!(a[0]==="-"?a.length<20||a.length===20&&Number(a.substring(0,7))>-922337:a.length<19||a.length===19&&Number(a.substring(0,6))<922337)){if(a.length<16)kb(Number(a));else if(Ha())a=BigInt(a),u=Number(a&BigInt(4294967295))>>>0,w=Number(a>>BigInt(32)&BigInt(4294967295));else{b=+(a[0]==="-");w=u=0;const c=a.length;for(let d=b,e=(c-b)%6+b;e<=c;d=e,e+=6){const f=Number(a.slice(d, e));w*=1E6;u=u*1E6+f;u>=4294967296&&(w+=Math.trunc(u/4294967296),w>>>=0,u>>>=0)}if(b){const [d,e]=lb(u,w);u=d;w=e}}a=u;b=w;if(b&2147483648)if(Ha())a=""+(BigInt(b|0)<<BigInt(32)|BigInt(a>>>0));else{const [c,d]=lb(a,b);a="-"+mb(c,d)}else a=mb(a,b)}return a}function z(a){if(a!=null&&typeof a!=="string")throw Error();return a}function zb(a,b,c){if(a!=null&&typeof a==="object"&&a.H===Pa)return a;if(Array.isArray(a)){var d=a[r]|0,e=d;e===0&&(e|=c&32);e|=c&2;e!==d&&(a[r]=e);return new b(a)}};function Ab(a){Bb===void 0&&(Bb=typeof Proxy==="function"?Cb(Proxy):null);var b;(b=!Bb)||(Db===void 0&&(Db=typeof WeakMap==="function"?Cb(WeakMap):null),b=!Db);if(b)return a;if(b=Eb(a))return b;if(Math.random()>.01)return a;Fb(a);b=new Bb(a,{set(c,d,e){Gb();c[d]=e;return!0}});Hb(a,b);return b}function Gb(){Fa()}let Ib=void 0,Jb=void 0;function Eb(a){let b;return(b=Ib)==null?void 0:b.get(a)}function Hb(a,b){(Ib||(Ib=new Db)).set(a,b);(Jb||(Jb=new Db)).set(b,a)}let Bb=void 0,Db=void 0; function Cb(a){try{return a.toString().indexOf("[native code]")!==-1?a:null}catch{return null}}let Kb=void 0;function Fb(a){if(Kb===void 0){const b=new Bb([],{});Kb=Array.prototype.concat.call([],b).length===1}Kb&&typeof Symbol==="function"&&Symbol.isConcatSpreadable&&(a[Symbol.isConcatSpreadable]=!0)};function Lb(a,b){return Mb(b)}function Mb(a){switch(typeof a){case "number":return isFinite(a)?a:String(a);case "bigint":return ib(a)?Number(a):String(a);case "boolean":return a?1:0;case "object":if(a)if(Array.isArray(a)){if(Ua(a))return}else{if(xa(a))return ta(a);if(a instanceof Ba){const b=a.g;return b==null?"":typeof b==="string"?b:a.g=ta(b)}}}return a};function Nb(a,b,c){a=Ia(a);var d=a.length;const e=b&256?a[d-1]:void 0;d+=e?-1:0;for(b=b&512?1:0;b<d;b++)a[b]=c(a[b]);if(e){b=a[b]={};for(const f in e)b[f]=c(e[f])}return a}function Ob(a,b,c,d,e){if(a!=null){if(Array.isArray(a))a=Ua(a)?void 0:e&&(a[r]|0)&2?a:Pb(a,b,c,d!==void 0,e);else if(Sa(a)){const f={};for(let g in a)f[g]=Ob(a[g],b,c,d,e);a=f}else a=b(a,d);return a}} function Pb(a,b,c,d,e){const f=d||c?a[r]|0:0;d=d?!!(f&32):void 0;a=Ia(a);for(let g=0;g<a.length;g++)a[g]=Ob(a[g],b,c,d,e);c&&c(f,a);return a}function Qb(a){return a.H===Pa?a.toJSON():Mb(a)};function Rb(a,b,c=Oa){if(a!=null){if(a instanceof Uint8Array)return b?a:new Uint8Array(a);if(Array.isArray(a)){var d=a[r]|0;if(d&2)return a;b&&(b=d===0||!!(d&32)&&!(d&64||!(d&16)));return b?(a[r]=(d|34)&-12293,a):Pb(a,Rb,d&4?Oa:c,!0,!0)}a.H===Pa&&(c=a.m,d=c[r],a=d&2?a:new a.constructor(Sb(c,d,!0)));return a}}function Sb(a,b,c){const d=c||b&2?Oa:Na,e=!!(b&32);a=Nb(a,b,f=>Rb(f,e,d));a[r]=a[r]|32|(c?2:0);return a}function Tb(a){const b=a.m,c=b[r];return c&2?new a.constructor(Sb(b,c,!1)):a};function A(a,b){a=a.m;return B(a,a[r],b)}function Ub(a,b,c,d){b=d+(+!!(b&512)-1);if(!(b<0||b>=a.length||b>=c))return a[b]}function B(a,b,c,d){if(c===-1)return null;const e=b>>15&1023||536870912;if(c>=e){if(b&256)return a[a.length-1][c]}else{var f=a.length;if(d&&b&256&&(d=a[f-1][c],d!=null)){if(Ub(a,b,e,c)&&La!=null){var g;a=(g=Ea)!=null?g:Ea={};g=a[La]||0;g>=4||(a[La]=g+1,Fa())}return d}return Ub(a,b,e,c)}}function Vb(a,b,c){const d=a.m;let e=d[r];Xa(e);C(d,e,b,c);return a} function C(a,b,c,d){const e=b>>15&1023||536870912;if(c>=e){let f,g=b;if(b&256)f=a[a.length-1];else{if(d==null)return g;f=a[e+(+!!(b&512)-1)]={};g|=256}f[c]=d;c<e&&(a[c+(+!!(b&512)-1)]=void 0);g!==b&&(a[r]=g);return g}a[c+(+!!(b&512)-1)]=d;b&256&&(a=a[a.length-1],c in a&&delete a[c]);return b}function D(a,b,c,d){c=E(a,d)===c?c:-1;return Wb(a,b,c)!==void 0}function Xb(a){return!!(2&a)&&!!(4&a)||!!(2048&a)} function F(a,b,c,d){const e=a.m;let f=e[r];Xa(f);C(e,f,b,(d==="0"?Number(c)===0:c===d)?void 0:c);return a}function E(a,b){a=a.m;return Yb(Zb(a),a,a[r],b)}function Zb(a){let b;return(b=a[Ma])!=null?b:a[Ma]=new Map}function Yb(a,b,c,d){let e=a.get(d);if(e!=null)return e;e=0;for(let f=0;f<d.length;f++){const g=d[f];B(b,c,g)!=null&&(e!==0&&(c=C(b,c,e)),e=g)}a.set(d,e);return e}function Wb(a,b,c,d){a=a.m;let e=a[r];d=B(a,e,c,d);b=zb(d,b,e);b!==d&&b!=null&&C(a,e,c,b);return b} function $b(a,b,c){b=Wb(a,b,c,!1);if(b==null)return b;a=a.m;let d=a[r];if(!(d&2)){const e=Tb(b);e!==b&&(b=e,C(a,d,c,b))}return b}function ac(a,b,c){c==null&&(c=void 0);return Vb(a,b,c)}function G(a,b,c,d){d==null&&(d=void 0);a:{const g=a.m;var e=g[r];Xa(e);if(d==null){var f=Zb(g);if(Yb(f,g,e,c)===b)f.set(c,0);else break a}else{f=g;const k=Zb(f),h=Yb(k,f,e,c);h!==b&&(h&&(e=C(f,e,h)),k.set(c,b))}C(g,e,b,d)}return a} function bc(a,b){const c=a.m;let d=c[r];Xa(d);if(b==null)return C(c,d,1),a;var e=b,f;b=((f=Jb)==null?void 0:f.get(e))||e;f=e=b[r]|0;const g=Xb(e),k=g||Object.isFrozen(b);let h=!0,t=!0;for(let x=0;x<b.length;x++){var v=b[x];g||(v=!!((v.m[r]|0)&2),h&&(h=!v),t&&(t=v))}g||(e=h?13:5,e=t?e|16:e&-17);k&&e===f||(b=Ia(b),f=0,e=cc(e,d),e=dc(e,d,!0));e!==f&&(b[r]=e);C(c,d,1,b);return a}function cc(a,b){a=(2&b?a|2:a&-3)|32;return a&=-2049}function dc(a,b,c){32&b&&c||(a&=-33);return a} function ec(a,b){return a!=null?a:b}function fc(a){a=A(a,1);a!=null&&(typeof a==="bigint"?ib(a)?a=Number(a):(a=BigInt.asIntN(64,a),a=ib(a)?Number(a):String(a)):a=qb(a)?typeof a==="number"?yb(a):xb(a):void 0);return ec(a,0)}function H(a,b){a=A(a,b);return ec(a==null||typeof a==="string"?a:void 0,"")}function I(a,b){a=A(a,b);a=a==null?a:Number.isFinite(a)?a|0:void 0;return ec(a,0)}function J(a,b,c,d){c=E(a,d)===c?c:-1;return $b(a,b,c)};let gc;function hc(a){try{return gc=!0,JSON.stringify(ic(a),Lb)}finally{gc=!1}}function jc(){var a=kc||(kc=lc("[1,2,0]"));a=Tb(a);a=Vb(a,4,z("dev-706864954"));const b=a.m,c=b[r];return c&2?a:new a.constructor(Sb(b,c,!0))} var K=class{constructor(a){a:{var b=b!=null?b:0;if(a==null){var c=96;a=[]}else{if(!Array.isArray(a))throw Error("narr");c=a[r]|0;if(c&2048)throw Error("farr");if(c&64)break a;b===1||b===2||(c|=64);b=a;var d=b.length;if(d&&(--d,Sa(b[d]))){c|=256;b=d-(+!!(c&512)-1);if(b>=1024)throw Error("pvtlmt");c=c&-33521665|(b&1023)<<15}}a[r]=c}this.m=a}toJSON(){return ic(this)}};K.prototype.H=Pa;K.prototype.toString=function(){try{return gc=!0,ic(this).toString()}finally{gc=!1}}; function ic(a){a=a.m;a=gc?a:Pb(a,Qb,void 0,void 0,!1);{var b=!gc;let t=a.length;if(t){var c=a[t-1],d=Sa(c);d?t--:c=void 0;var e=a;if(d){b:{var f=c;var g;var k=!1;if(f)for(let v in f)if(isNaN(+v)){let x;((x=g)!=null?x:g={})[v]=f[v]}else if(d=f[v],Array.isArray(d)&&(Ua(d)||Ra(d)&&d.size===0)&&(d=null),d==null&&(k=!0),d!=null){let x;((x=g)!=null?x:g={})[v]=d}k||(g=f);if(g)for(let v in g){k=g;break b}k=null}f=k==null?c!=null:k!==c}for(;t>0;t--){g=e[t-1];if(!(g==null||Ua(g)||Ra(g)&&g.size===0))break;var h= !0}if(e!==a||f||h){if(!b)e=Array.prototype.slice.call(e,0,t);else if(h||f||k)e.length=t;k&&e.push(k)}h=e}else h=a}return h};function mc(a){return b=>{if(b==null||b=="")b=new a;else{b=JSON.parse(b);if(!Array.isArray(b))throw Error("dnarr");b[r]|=32;b=new a(b)}return b}};var lc=function(a){return b=>{b=JSON.parse(b);if(!Array.isArray(b)){var c=typeof b;throw Error("Expected jspb data to be an array, got "+(c!="object"?c:b?Array.isArray(b)?"array":c:"null")+": "+b);}b[r]|=34;return new a(b)}}(class extends K{});var nc=class extends K{};function oc(a){var b=new pc(500);let c=0,d;return(...e)=>{qc(b)?a(...e):(d=()=>void a(...e),c||(c=setTimeout(()=>{c=0;let f;(f=d)==null||f()},rc(b))))}}function sc(a){var b=new pc(100),c=Promise.resolve();return(...d)=>qc(b)?a(...d):c};function qc(a){return tc(a,a.index)>=a.g?(a.h[a.index]=Date.now(),a.index=(a.index+1)%1,!0):!1}function rc(a){const b=a.g;a=tc(a,a.index);return a>=b?0:b-a}function tc(a,b){let c;return Date.now()-((c=a.h[b])!=null?c:-1*a.g)}var pc=class{constructor(a){this.g=a;this.h=[];this.index=0}};var uc=class extends K{},vc=[2,3];var wc=class extends K{};var L=class extends Error{constructor({errorType:a,message:b,i:c}){super(`Meet Add-on SDK error: ${`${b}${c?` - ${c}`:""}`}`);this.errorType=a}},M={errorType:"InternalError",message:"An unexpected error has occurred.",i:"No further information is available."},xc={errorType:"MissingUrlParameter",message:"Missing required Meet SDK URL parameter",i:"This parameter is automatically appended by Meet to the iframe URL. Ensure that your infrastructure does not strip URL parameters (e.g. as part of a redirect)."}, yc={errorType:"NeedsMainStageContext",message:"This method can only be invoked if the addon is running in the main stage.",i:"Use getFrameType to check whether the addon is running in the main stage before invoking this method."},zc={errorType:"NeedsSidePanelContext",message:"This method can only be invoked if the addon is running in the side panel.",i:"Use getFrameType to check whether the addon is running in the side panel before invoking this method."},Ac={errorType:"NotSupportedInStandalone", message:"This method is not supported in standalone mode.",i:"Do not call this method in standalone mode."},Bc={errorType:"InternalError",message:"The frame type URL parameter is set to an unexpected value.",i:"This parameter is automatically appended by Meet to the iframe URL. Ensure that your infrastructure does not modify URL parameters (e.g. as part of a redirect)."},Cc={errorType:"InvalidCloudProjectNumber",message:"Cloud Project Number provided by meet does not match the one passed in by the SDK. Ensure that the correct Cloud Project Number is passed to the SDK as a string.", i:"This parameter is automatically appended by Meet to the iframe URL. Ensure that your infrastructure does not modify URL parameters (e.g. as part of a redirect) and ensure that the correct Cloud Project Number was passed into the SDK as a string."},Dc={errorType:"DestinationNotReady",message:"The recipient frame is not connected via the addon SDK and cannot receive the notification.",i:"Make sure the destination frame has connected before sending messages to it."},Ec={errorType:"InvalidActivityStartingState", message:"Origin of the ActivityStartingState iframeURLs does not match the origin of the URLs provided in the Add-on manifest.",i:"Ensure that the ActivityStartingState iframeURL origins match the origins of the URLs provided in the Add-on manifest."},Fc={errorType:"ActivityStartingStateMissingAttributes",message:"The supplied ActivityStartingState object does not contain any recognized attributes.",i:"Ensure that the ActivityStartingState object contains at least one of the following attributes: mainStageUrl, sidePanelUrl, additionalData."}, Gc={errorType:"ActivityStartingStateUnrecognizedAttributes",message:"The supplied ActivityStartingState object contains attributes that are not recognized.",i:"Ensure that the ActivityStartingState object has only the following attributes: mainStageUrl, sidePanelUrl, additionalData."},Hc={errorType:"AddonStartingStateMissingAttributes",message:"The supplied AddonStartingState object does not contain any recognized attributes.",i:"Ensure that the AddonStartingState object contains at least one of the following attributes: sidePanelUrl, additionalData."}, Ic={errorType:"AddonStartingStateUnrecognizedAttributes",message:"The supplied AddonStartingState object contains attributes that are not recognized.",i:"Ensure that the AddonStartingState object has only the following attributes: sidePanelUrl, additionalData."},Jc=a=>({errorType:"ArgumentNullError",message:`The argument supplied for '${a}' was 'null' but a value was expected.`,i:"Ensure you are passing a value of the expected type for the argument."}),N=(a,b,c)=>({errorType:"ArgumentTypeError",message:`The type '${b}' of argument supplied for '${a}' did not match the expected type '${c}'.`, i:"Ensure the type of the argument provided matches the expected type."}),Kc=a=>({errorType:"InternalError",message:`Could not connect to ${a} channel. Unknown error`,i:"No further information is available."}),Mc={errorType:"ActivityIsOngoing",message:"Operation cannot be performed while an activity is ongoing.",i:"Ensure that no activity is ongoing."},Nc={errorType:"InternalError",message:"Frame message missing required Meet SDK command.",i:"Send one of the available commands in the frame message."}, Oc={errorType:"NoActivityFound",message:"No activity found.",i:"Ensure that the activity is started before performing this operation."},Pc={errorType:"RequiresEapEnrollment",message:"This feature is only available to early access partners.",i:"Meet add-on early access enrollment is currently closed."},Qc={errorType:"UserNotInitiator",message:"Operation cannot be performed because the user is not the initiator of the current activity.",i:"Ensure that the user is the initiator of the current activity or that the activity has ended."}, Rc={errorType:"SizeLimitExceededActivityStartingState",message:"The size of the activityStartingState URLs and/or its data exceed the limits allowed.",i:"Ensure that the activityStartingState URL size is less than 512 characters and the additional data size is less than 4096 characters."},Sc={errorType:"SizeLimitExceededFrameToFrameMessage",message:"The size of the frame to frame message exceeds the limits allowed.",i:"Ensure that the frame to frame message size is less than 1,000,000 characters."}, Tc={errorType:"AddonSessionAlreadyCreated",message:"The addon session has already been created.",i:"Only instantiate the AddonSession once."},Uc={errorType:"UserCancelled",message:"The user cancelled starting an activity.",i:"The user needs to click continue to start the activity."},Vc={errorType:"NotSupportedInMeetCall",message:"This method is not supported during a Meet call.",i:"Do not call this method during a Meet call."},Wc={errorType:"InvalidAddonStartingState",message:"Origin of the AddonStartingState iframeURLs does not match the origin of the URLs provided in the Add-on manifest.", i:"Ensure that the AddonStartingState iframeURL origins match the origins of the URLs provided in the Add-on manifest."},Xc={errorType:"SizeLimitExceededAddonStartingState",message:"The size of the AddonStartingState URLs and/or its data exceed the limits allowed.",i:"Ensure that the AddonStartingState URL size is less than 512 characters and the additional data size is less than 4096 characters."},Yc={errorType:"MeetingPolicyPreventsStartingActivity",message:"A meeting policy (such as using host control settings) prevents the user from starting the activity.", i:"Have a meeting host or administrator modify the necessary settings to allow the current user to start the activity."};function Zc(a){switch(a){case 0:return M;case 1:return Dc;case 2:return Ec;case 3:return Mc;case 4:return Nc;case 5:return Pc;case 6:return Ac;case 7:return Qc;case 8:return Rc;case 9:return Sc;case 10:return Uc;case 11:return Vc;case 12:return Wc;case 13:return Xc;case 14:return Oc;case 15:return Yc;default:return M}} function $c(a){let b;var c=(b=I(a,1))!=null?b:0;a=ad(E(a,vc));switch(c){case 1:return{errorType:"InternalError",message:`Could not connect to ${a} channel. Meet did not respond with a MessagePort.`,i:"No further information is available."};case 2:return{errorType:"InternalError",message:`Could not connect to ${a}. A conflicting ${a} exists.`,i:"No further information is available."};case 3:return{errorType:"InternalError",message:`Could not connect to ${a} channel. The addon does not have permission to open a ${a}.`, i:"This method might require EAP enrollment."};case 4:return{errorType:"InternalError",message:`Could not connect to ${a} channel. The addon is not authorized for this ${a}.`,i:"No further information is available."};case 0:return Kc(a);case 5:a:switch(a){case "co":c={errorType:"InternalError",message:`Could not connect to ${a} channel. The coActivity was not found.`,i:`Consider starting the ${a} only after after the startActivity promise returns.`};break a;default:c={errorType:"InternalError",message:`Could not connect to ${a} channel.`, i:"No further information is available."}}return c;default:return Kc(a)}}function ad(a){switch(a){case 2:return"co";case 3:return"gd";case 0:return"unknown";default:return"unknown"}}function bd({errorType:a,message:b,i:c},d=""){throw new L({errorType:a,message:d?`${b} ${d}`:b,i:c});}function cd(a,b){bd({...xc,message:`${xc.message}: ${a}. In URL ${b}`})};function dd(a){var b=new ed;return F(b,1,y(a),0)}function fd(a,b){return F(a,2,z(b),"")}function gd(a,b){return F(a,3,z(b),"")}var ed=class extends K{getFrameType(){return I(this,1)}};function hd(a){var b;void 0===Ya?b=2:b=4;var c=a.m[r],d=c,e=!(2&c),f=ed;a=a.m;b=(c=!!(2&d))?1:b;e&&(e=!c);c=B(a,d,1);c=Array.isArray(c)?c:Va;var g=c[r]|0,k=!!(4&g);if(!k){var h=g;h===0&&(h=cc(h,d));g=c;h|=1;var t=d;const Ja=!!(2&h);Ja&&(t|=2);let tb=!Ja,ub=!0,Ka=0,vb=0;for(;Ka<g.length;Ka++){const wb=zb(g[Ka],f,t);if(wb instanceof f){if(!Ja){const Lc=!!((wb.m[r]|0)&2);tb&&(tb=!Lc);ub&&(ub=Lc)}g[vb++]=wb}}vb<Ka&&(g.length=vb);h|=4;h=ub?h|16:h&-17;h=tb?h|8:h&-9;g[r]=h;Ja&&Object.freeze(g);g=h}if(e&& !(8&g||!c.length&&(b===1||b===4&&32&g))){Xb(g)&&(c=Ia(c),g=cc(g,d),d=C(a,d,1,c));e=c;f=g;for(g=0;g<e.length;g++)h=e[g],t=Tb(h),h!==t&&(e[g]=t);f|=8;f=e.length?f&-17:f|16;g=e[r]=f}let v;if(b===1||b===4&&32&g){if(!Xb(g)){d=g;var x=!!(32&g);g|=!c.length||16&g&&(!k||x)?2:2048;g!==d&&(c[r]=g);Object.freeze(c)}}else k=b!==5?!1:!!(32&g)||Xb(g)||!!Eb(c),(b===2||k)&&Xb(g)&&(c=Ia(c),g=cc(g,d),g=dc(g,d,!1),c[r]=g,d=C(a,d,1,c)),Xb(g)||(a=g,g=dc(g,d,!1),g!==a&&(c[r]=g)),k?v=Ab(c):b===2&&((x=Ib)==null||x.delete(c)); return v||c}function id(a){var b=new jd;return bc(b,a)}var jd=class extends K{};var kd=class extends K{};function ld(a){var b=new md;return F(b,1,y(a),0)}var md=class extends K{};var nd=class extends K{};var od=class extends K{};var pd=class extends K{};var rd=class extends K{getMeetingInfo(){return J(this,pd,3,qd)}getMeetPlatformInfo(){return J(this,od,4,qd)}},qd=[2,3,4,5];var sd=class extends K{},td=[1,4,5,6,7,8,9,10,11,12,13,14,15,16,17];var ud=class extends K{};var vd=class extends K{};var wd=new Map([[2,"MAIN_STAGE"],[1,"SIDE_PANEL"]]),xd=new Map([[0,"UNKNOWN"],[1,"OPEN_ADDON"],[2,"START_ACTIVITY"],[3,"JOIN_ACTIVITY"]]);function yd(a){a&&typeof a.dispose=="function"&&a.dispose()};function O(){this.s=this.s;this.g=this.g}O.prototype.s=!1;O.prototype.dispose=function(){this.s||(this.s=!0,this.G())};O.prototype[Symbol.dispose]=function(){this.dispose()};function zd(a,b){a.s?b():(a.g||(a.g=[]),a.g.push(b))}O.prototype.G=function(){if(this.g)for(;this.g.length;)this.g.shift()()};function Ad({J:a,R:b}){if(a===null)throw new L(Jc("activityStartingState"));if(b||a!==void 0){if(typeof a!=="object")throw new L(N("activityStartingState",typeof a,`object${b?"":" | undefined"}`));if(a.mainStageUrl!==void 0&&typeof a.mainStageUrl!=="string")throw new L(N("mainStageUrl",typeof a.mainStageUrl,"string | undefined"));if(a.sidePanelUrl!==void 0&&typeof a.sidePanelUrl!=="string")throw new L(N("sidePanelUrl",typeof a.sidePanelUrl,"string | undefined"));if(a.additionalData!==void 0&&typeof a.additionalData!== "string")throw new L(N("additionalData",typeof a.additionalData,"string | undefined"));if(Object.keys(a).length!==+!!a.mainStageUrl+ +!!a.sidePanelUrl+ +!!a.additionalData)throw new L(Gc);if(Object.keys(a).length===0)throw new L(Fc);}}function Bd(a){const b=[];b.push(gd(fd(dd(2),a.mainStageUrl),a.additionalData));b.push(gd(fd(dd(1),a.sidePanelUrl),a.additionalData));return b} var Id=class extends O{constructor(a){super();this.context=a;this.h={};Cd(this.context.g.U,b=>{switch(E(b.content,td)){case 7:const d=this.h.frameToFrameMessage;b=J(b.content,nd,7,td);if(d&&b){var c=I(b,1);c=wd.get(c);if(c===void 0)throw Error("Unknown frame type.");d({originator:c,payload:H(b,2)})}}})}async getMeetingInfo(){const a=await Dd(this.context.g,ld(2));return{meetingId:H(a.getMeetingInfo(),1),meetingCode:H(a.getMeetingInfo(),2)}}async getFrameOpenReason(){let a;const b=(a=this.context.h.ca)!= null?a:0;let c;return(c=xd.get(b))!=null?c:"UNKNOWN"}async getActivityStartingState(){var a=J(await Dd(this.context.g,ld(1)),jd,2,qd);const b=a==null?void 0:hd(a).find(c=>c.getFrameType()===2);a=a==null?void 0:hd(a).find(c=>c.getFrameType()===1);return{mainStageUrl:(b==null?void 0:H(b,2))||void 0,sidePanelUrl:(a==null?void 0:H(a,2))||void 0,additionalData:(a==null?void 0:H(a,3))||void 0}}async setActivityStartingState(a){Ad({J:a,R:!0});var b=Bd(a);a=Ed;var c=this.context.g;var d=new ud;b=id(b);d= ac(d,1,b);await a(c,d)}on(a,b){this.h[a]=b}async getMeetPlatformInfo(){const a=await Dd(this.context.g,ld(3));return{isMeetHardware:ec(ob(A(a.getMeetPlatformInfo(),1)),!1)}}async closeAddon(){await Fd(this.context.g)}async startActivity(a){Ad({J:a,R:!1});const b=new vd;a&&(a=Bd(a),a=id(a),ac(b,1,a));await Gd(this.context.g,b)}async endActivity(a){var b=Hd,c=this.context.g,d=new kd;a=F(d,1,y(a==="aab61ee0-51b4-475d-aa4d-849f2498640d"?999:0),0);await b(c,a)}};var Jd=mc(class extends K{getFrameOpenReason(){return I(this,5)}});function Kd(){var a=window.location.href;var b=window.location.href;var c=(new URL(b)).searchParams.get("meet_sdk");c?b=Jd(atob(c)):(cd("meet_sdk",b),b=void 0);(c=H(b,1))||cd("meet_addon_frame_type",a);c=Number(c);if(c!==2&&c!==1)throw new L(Bc);const d=H(b,2);d||cd("meet_control_channel_name",a);const e=H(b,4);e||cd("addon_cloud_project_number",a);var f;a=(f=b.getFrameOpenReason())!=null?f:0;f=H(b,3)||"https://meet.google.com";return{ca:a,frameType:c,ba:d,cloudProjectNumber:e,S:f}};var Ld=class extends K{};var Md=class extends K{};function Nd(){var a=new Od,b=new Md;return G(a,1,Pd,b)}var Od=class extends K{},Pd=[1,2];function Qd(a){var b=new Rd;return ac(b,2,a)}function Sd(a,b){return F(a,3,z(b),"")}var Rd=class extends K{};var Td=class extends K{};var Ud=class extends K{};var Vd=class extends K{};var Wd=class extends K{};var Xd=class extends K{setAddonStartingState(a){return ac(this,1,a)}};var Yd=class extends K{};function Zd(a,b){return G(a,2,P,b)}var Q=class extends K{},P=[1,2,5,6,7,8,9,10,11,13,14,15,16];var $d=class extends K{},ae=mc($d),be=[1,2];class ce{constructor(a,b){this.data=a;this.channel=b}};var de=Promise;function ee(a){const b=new MessageChannel;fe(b.port1,a);return b}function ge(a,b){fe(a,b);return new he(a)}class he{constructor(a){this.g=a}send(a,b,c=[]){b=ee(b);this.g.postMessage(a,[b.port2].concat(c))}C(a,b){return new de(c=>{this.send(a,c,b)})}}function fe(a,b){b&&(a.onmessage=c=>{var d=c.data;c=ge(c.ports[0]);b(new ce(d,c))})};var ie=typeof AsyncContext!=="undefined"&&typeof AsyncContext.Snapshot==="function"?a=>a&&AsyncContext.Snapshot.wrap(a):a=>a;function je(a,b){a.l(b);a.h<100&&(a.h++,b.next=a.g,a.g=b)}class ke{constructor(a,b){this.j=a;this.l=b;this.h=0;this.g=null}get(){let a;this.h>0?(this.h--,a=this.g,this.g=a.next,a.next=null):a=this.j();return a}};function le(){var a=me;let b=null;a.g&&(b=a.g,a.g=a.g.next,a.g||(a.h=null),b.next=null);return b}class ne{constructor(){this.h=this.g=null}add(a,b){const c=oe.get();c.set(a,b);this.h?this.h.next=c:this.g=c;this.h=c}}var oe=new ke(()=>new pe,a=>a.reset());class pe{constructor(){this.next=this.g=this.h=null}set(a,b){this.h=a;this.g=b;this.next=null}reset(){this.next=this.g=this.h=null}};let qe,re=!1,me=new ne,te=(a,b)=>{qe||se();re||(qe(),re=!0);me.add(a,b)},se=()=>{const a=Promise.resolve(void 0);qe=()=>{a.then(ue)}};function ue(){let a;for(;a=le();){try{a.h.call(a.g)}catch(b){m(b)}je(oe,a)}re=!1};function ve(){};function R(a){this.g=0;this.T=void 0;this.l=this.h=this.j=null;this.v=this.B=!1;if(a!=ve)try{const b=this;a.call(void 0,function(c){we(b,2,c)},function(c){we(b,3,c)})}catch(b){we(this,3,b)}}function xe(){this.next=this.context=this.h=this.l=this.g=null;this.j=!1}xe.prototype.reset=function(){this.context=this.h=this.l=this.g=null;this.j=!1};var ye=new ke(function(){return new xe},function(a){a.reset()});function ze(a,b,c){const d=ye.get();d.l=a;d.h=b;d.context=c;return d} function Ae(){let a,b;const c=new R(function(d,e){a=d;b=e});return new Be(c,a,b)}R.prototype.then=function(a,b,c){return Ce(this,ie(typeof a==="function"?a:null),ie(typeof b==="function"?b:null),c)};R.prototype.$goog_Thenable=!0;function De(a,b){b=ie(b);b=ze(b,b);b.j=!0;Ee(a,b)}R.prototype.cancel=function(a){if(this.g==0){const b=new S(a);te(function(){Fe(this,b)},this)}}; function Fe(a,b){if(a.g==0)if(a.j){var c=a.j;if(c.h){var d=0,e=null,f=null;for(let g=c.h;g&&(g.j||(d++,g.g==a&&(e=g),!(e&&d>1)));g=g.next)e||(f=g);e&&(c.g==0&&d==1?Fe(c,b):(f?(d=f,d.next==c.l&&(c.l=d),d.next=d.next.next):Ge(c),He(c,e,3,b)))}a.j=null}else we(a,3,b)}function Ee(a,b){a.h||a.g!=2&&a.g!=3||Ie(a);a.l?a.l.next=b:a.h=b;a.l=b} function Ce(a,b,c,d){const e=ze(null,null,null);e.g=new R(function(f,g){e.l=b?function(k){try{const h=b.call(d,k);f(h)}catch(h){g(h)}}:f;e.h=c?function(k){try{const h=c.call(d,k);h===void 0&&k instanceof S?g(k):f(h)}catch(h){g(h)}}:g});e.g.j=a;Ee(a,e);return e.g}R.prototype.ma=function(a){this.g=0;we(this,2,a)};R.prototype.na=function(a){this.g=0;we(this,3,a)}; function we(a,b,c){if(a.g==0){a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself"));a.g=1;a:{var d=c,e=a.ma,f=a.na;if(d instanceof R){Ee(d,ze(e||ve,f||null,a));var g=!0}else{if(d)try{var k=!!d.$goog_Thenable}catch(h){k=!1}else k=!1;if(k)d.then(e,f,a),g=!0;else{k=typeof d;if(k=="object"&&d!=null||k=="function")try{const h=d.then;if(typeof h==="function"){Je(d,h,e,f,a);g=!0;break a}}catch(h){f.call(a,h);g=!0;break a}g=!1}}}g||(a.T=c,a.g=b,a.j=null,Ie(a),b!=3||c instanceof S||Ke(a,c))}} function Je(a,b,c,d,e){function f(h){k||(k=!0,d.call(e,h))}function g(h){k||(k=!0,c.call(e,h))}let k=!1;try{b.call(a,g,f)}catch(h){f(h)}}function Ie(a){a.B||(a.B=!0,te(a.la,a))}function Ge(a){let b=null;a.h&&(b=a.h,a.h=b.next,b.next=null);a.h||(a.l=null);return b}R.prototype.la=function(){let a;for(;a=Ge(this);)He(this,a,this.g,this.T);this.B=!1}; function He(a,b,c,d){if(c==3&&b.h&&!b.j)for(;a&&a.v;a=a.j)a.v=!1;if(b.g)b.g.j=null,Le(b,c,d);else try{b.j?b.l.call(b.context):Le(b,c,d)}catch(e){Me.call(null,e)}je(ye,b)}function Le(a,b,c){b==2?a.l.call(a.context,c):a.h&&a.h.call(a.context,c)}function Ke(a,b){a.v=!0;te(function(){a.v&&Me.call(null,b)})}var Me=m;function S(a){ha.call(this,a)}fa(S,ha);S.prototype.name="cancel";function Be(a,b,c){this.promise=a;this.resolve=b;this.reject=c};let Ne=1,Oe=new WeakMap;function Pe(a,b,c){var d=Qe;a.h.has(b);d(b,c)}var Se=class extends O{constructor(){super();this.h=new Set}signal(){const a=new Re;this.h.add(a);zd(this,ea(yd,a));return a}};function Qe(a,b){return new Promise(c=>{Te(()=>{a.L&&(a.ea=b,a.P=!0);for(const {I:d,slot:e}of a.o.values())try{e(b,{signal:a,I:d})}catch(f){m(f)}for(const d of a.A)d.resolve(b);a.A.clear();c()})})}function Cd(a,b,c){const d=Ne++;Te(()=>{Ue(a,d,b,c)});return d} function Ue(a,b,c,d){if(!a.s)if(d){if(!d.s){const e=()=>{Te(()=>{a.o.delete(b);const f=Oe.get(d);f&&sa(f,e)})};a.o.set(b,{I:b,slot:c,F:e});Ve(d,e)}}else a.o.set(b,{I:b,slot:c,F:()=>a.o.delete(b)})} var Re=class extends O{constructor(){super();this.L=!1;this.o=new Map;this.A=new Set;this.P=!1}detach(a){Te(()=>{const b=this.o.get(a);b&&b.F()})}value(a){return this.promise(!0,a)}next(a){return this.promise(!1,a)}promise(a,b){const c=Ae();Te(()=>{if(this.s)c.reject(new S("Signal initially disposed"));else if(b&&b.s)c.reject(new S("Owner initially disposed"));else if(a&&this.L&&this.P)c.resolve(this.ea);else if(this.A.add(c),De(c.promise,()=>{this.A.delete(c)}),b){const d=()=>{c.reject(new S("Owner asynchronously disposed"))}; De(c.promise,()=>{const e=Oe.get(b);e&&sa(e,d)});Ve(b,d)}});return c.promise}G(){super.G();Te(()=>{for(const {F:a}of this.o.values())a();this.o.clear();for(const a of this.A)a.reject(new S("Signal asynchronously disposed"));this.A.clear()})}};const We=[];let Xe=!1;function Te(a){We.push(a);Ye()}async function Ye(){if(!Xe)try{Xe=!0;let a=Ze(0);for(;a<We.length;)await Promise.resolve(),a=Ze(a)}catch(a){m(a)}finally{We.length=0,Xe=!1}} function Ze(a){const b=a+100;for(;a<b&&a<We.length;)try{We[a++]()}catch(c){m(c)}return a}function Ve(a,b){if(a.s)b();else{var c=Oe.get(a);if(c)c.push(b);else{const d=[b];Oe.set(a,d);zd(a,()=>{for(const e of[...d])e();Oe.delete(a)})}}};function T(a){var b=new $d;a=G(b,1,be,a);return{content:hc(a)}}const $e=new Se;function af(a,b){const c=$e.signal();return{channel:ge(a,d=>{const e=b(d.data);Pe($e,c,{content:e,ka:d})}),signal:c}};let kc;var U=class extends K{};var V=class extends K{};var cf=class extends K{h(){return J(this,U,2,bf)}g(){return D(this,U,2,bf)}j(){return J(this,V,3,bf)}l(){return D(this,V,3,bf)}},bf=[2,3];var df=mc(class extends K{});var ef=mc(class extends K{}),ff=[1,2];var gf=({destination:a,origin:b,ra:c,Y:d="ZNWN1d",onMessage:e})=>{if(b==="*")throw Error("Sending to wildcard origin not allowed.");const f=ee(e);a.postMessage(c?{n:d,t:c}:d,b,[f.port2]);return ge(f.port1,e)};function hf(a,b,c){const d=new Se,e=d.signal();a=gf({destination:window.parent,origin:b,Y:a,onMessage:f=>{const g=ae(f.data.content);E(g,be)===2&&Pe(d,e,{content:J(g,sd,2,be),ka:f,messagePort:f.data.messagePort})}});return new jf(e,a,c)}async function Dd(a,b){var c=W,d=new Q;b=G(d,9,P,b);a=await c(a,T(b));let e;return(e=J(ae(a.data.content),sd,2,be))==null?void 0:J(e,rd,9,td)}async function Ed(a,b){var c=W,d=new Q;b=G(d,8,P,b);await c(a,T(b))} async function Fd(a){var b=W;var c=new Q;var d=new Ld;c=G(c,11,P,d);await b(a,T(c))}async function Gd(a,b){var c=W,d=new Q;b=G(d,14,P,b);await c(a,T(b))}async function Hd(a,b){var c=W,d=new Q;b=G(d,15,P,b);await c(a,T(b))}async function kf(a){await a.h()} async function W(a,b){(a=await a.channel.C(b))||bd(M,"Falsy response received from the message channel."+` ${JSON.stringify(a)}`);(b=a.data)||bd(M,"Data field in the response from the message channel is falsy."+` ${JSON.stringify(b)}`);(b=b.content)||bd(M,"Content field in the response from the message channel is falsy."+` ${JSON.stringify(b)}`);let c=void 0;try{c=ae(b)}catch(d){bd(M,"The ControlMessage can't be deserialized."+` ${JSON.stringify(b)}. ${JSON.stringify(d)}`)}(b=J(c,sd,2,be))||bd(M, "MeetToAddonMessage field on ControlMessage is falsy."+` ${JSON.stringify(b)}`);b=b==null?void 0:J(b,wc,10,td);if((b==null?void 0:I(b,1))!==void 0)throw new L(Zc(I(b,1)));return a}async function lf(a,b,c){var d=W,e=new Q;b=G(e,1,P,b);d=await d(a,T(b));a=d.data.messagePort;var f;(d=(f=J(ae(d.data.content),sd,2,be))==null?void 0:J(f,uc,1,td))!=null?f=d:(f=new uc,f=F(f,1,y(0),0));return{channel:a?af(a,c):void 0,response:f}} async function mf(a){const b=Nd(),{channel:c,response:d}=await lf(a,b,e=>ef(e));if(!c)throw new L($c(d));return c}async function nf(a){var b=W;var c=new Q;var d=new Yd;c=G(c,5,P,d);await b(a,T(c))}async function of(a){var b=W;var c=new Q;var d=new Td;c=G(c,6,P,d);await b(a,T(c))}async function pf(a,b,c){var d=W,e=new Q,f=new Ud;b=F(f,1,y(b),0);c=F(b,2,z(c),"");e=G(e,7,P,c);await d(a,T(e))}async function qf(a,b){var c=W,d=new Q;b=G(d,16,P,b);await c(a,T(b))} class jf extends O{constructor(a,b,c){super();this.U=a;this.channel=b;this.h=sc(async()=>{var d=this.channel,e=d.C;var f=new Q;var g=new Vd;f=G(f,13,P,g);await e.call(d,T(f))});a=jc();H(a,4);rb(A(a,1));rb(A(a,2));rb(A(a,3));c=Zd(new Q,Sd(Qd(a),c));this.channel.send(T(c));Cd(this.U,async d=>{switch(E(d.content,td)){case 16:await kf(this)}})}};let rf;var sf=class{constructor(a){var b=rf;this.h=a;this.g=b}delete(){throw Error("Not implemented.");}};var uf=class extends K{h(){return J(this,U,2,tf)}g(){return D(this,U,2,tf)}j(){return J(this,V,3,tf)}l(){return D(this,V,3,tf)}},tf=[2,3];var vf=class extends K{};var wf=class extends K{};var xf=class extends K{};var zf=class extends K{h(){return J(this,U,2,yf)}g(){return D(this,U,2,yf)}j(){return J(this,V,3,yf)}l(){return D(this,V,3,yf)}},yf=[2,3],Af=[5,6];var Bf=class extends K{};var Cf=class extends K{},Df=[1,2,3];var Ef=class extends Error{constructor(){super("Failed to create CoActivity: Connection refused - Meet refused to begin Live Sharing")}};var Ff=class{constructor(a){this.config=a}start(){this.g!=null||(this.g=setInterval(()=>{this.config.ha()},this.config.da));return this}shutdown(){clearInterval(this.g)}};function Gf(){const a=new Map,b={set(c,d){a.set(c,d);return b},D:()=>a};return b};function Hf(a){if(a.g()){a=a.h().m;var b=a[r];var c=B(a,b,1),d=Ta(c,!0);d!=null&&d!==c&&C(a,b,1,d);a=d;b=a==null?za():a;a=Uint8Array;Ca(ya);c=b.g;if(c!=null&&!xa(c))if(typeof c==="string"){ua.test(c)&&(c=c.replace(ua,wa));c=atob(c);d=new Uint8Array(c.length);for(let e=0;e<c.length;e++)d[e]=c.charCodeAt(e);c=d}else c=null;b=c==null?c:b.g=c;return{bytes:new a(b||0)}}}function If(a,b){b=Jf(b);G(a,2,yf,b);return a}function Kf(a,b){b=Jf(b);G(a,2,tf,b);return a} function Jf(a){var b=new U;return F(b,1,Ta(a.bytes,!1),za())}function Lf(a){if(a.l()){a=a.j();var b,c,d=H(a,1),e=(c=(b=$b(a,nc,2))==null?void 0:fc(b))!=null?c:0;c=a.m;let f=c[r];const g=B(c,f,4);b=g==null||typeof g==="number"?g:g==="NaN"||g==="Infinity"||g==="-Infinity"?Number(g):void 0;b!=null&&b!==g&&C(c,f,4,b);return{mediaId:d,mediaPlayoutPosition:e,mediaPlayoutRate:ec(b,0),playbackState:Mf.get(I(a,3))}}}function Nf(a,b){b=Of(b);G(a,3,yf,b);return a} function Pf(a,b){b=Of(b);G(a,3,tf,b);return a}const Mf=Gf().set(0,"INVALID").set(1,"BUFFERING").set(2,"PLAY").set(3,"PAUSE").set(4,"ENDED").D(),Qf=Gf().set("INVALID",0).set("BUFFERING",1).set("PLAY",2).set("PAUSE",3).set("ENDED",4).D(); function Of(a){var b=new V;b=F(b,1,z(a.mediaId),"");var c=a.mediaPlayoutRate;if(c!=null&&typeof c!=="number")throw Error(`Value of float/double field must be a number, found ${typeof c}: ${c}`);b=F(b,4,c,0);c=new nc;c=F(c,1,sb(a.mediaPlayoutPosition),"0");b=ac(b,2,c);a=Qf.get(a.playbackState);return F(b,3,y(a),0)}function Rf({activityTitle:a}){var b=new xf;return Vb(b,4,z(a))}function Sf(a,b){var c=new wf;b=F(c,1,y(b.u),0);G(a,6,Af,b);return a}function Tf(a){var b=new vf;G(a,5,Af,b);return a};const Uf=Gf().set("co-doing",1).set("co-watching",2).D();async function Vf(a,b,c){var d=b.C,e=new Cf;var f=new Bf;f=F(f,1,z(a.activityTitle),"");var g=Uf.get(a.K);f=F(f,2,y(g),0);e=G(e,3,Df,f);d=await d.call(b,e,df);let k;if((k=ec(ob(A(d,1)),!1))!=null&&k)return new Wf(a,b,c,$b(d,cf,2));throw new Ef;}function Xf(a,b){const c=a.config.N(b);c&&!a.config.M(a.g,c)&&(a.g=c,a.j=fc(b),a.v(a.g))}function X(a,b){const {state:c,fa:d,context:e}=b(a.g);a.g=c;a.notify(a.g,e,d)} class Wf{constructor(a,b,c,d){this.l=a;this.h=b;this.config=c;this.v=oc(e=>void this.l.O(e));Yf(this.h,e=>{const f=E(e,ff);switch(f){case 1:Xf(this,J(e,cf,1,ff));break;case 2:case 0:console.warn(`IllegalMessage: ${f} - ${"Unhandled message"} - ${"Please raise a bug with the MeetJS team"}`)}});this.B=(new Ff({da:1E3,ha:()=>{var e,f,g=(f=(e=this.l).ja)==null?void 0:f.call(e);if(this.g!==null){this.g={...this.g,...g};e=new Cf;f=this.config;g=f.W;var k=new uf;k=F(k,1,sb(this.j),"0");f=g.call(f,k,this.g); e=G(e,1,Df,f);this.h.send(e)}}})).start();this.g=null;this.j=0;d&&Xf(this,d)}disconnect(){this.h.shutdown();this.B.shutdown()}notify(a,b,c){var d=c?Rf(c):void 0;c=this.config;var e=c.X;var f=new zf;f=F(f,1,sb(this.j),"0");d=ac(f,4,d);a=e.call(c,d,a);a=this.config.V(a,b);b=this.h;c=b.send;e=new Cf;a=G(e,2,Df,a);c.call(b,a)}};var Zf=class{constructor(a){this.g=a}broadcastStateUpdate(a){X(this.g,()=>({state:a,context:{}}))}disconnect(){this.g.disconnect()}};function $f(a,b){return a==null||b==null?!1:a.bytes.length===b.bytes.length&&a.bytes.every((c,d)=>c===b.bytes[d])};var ag=class{constructor(a){this.g=a}notifySwitchedToMedia(a,b,c){X(this.g,()=>({state:{mediaId:b,mediaPlayoutRate:1,mediaPlayoutPosition:c,playbackState:"PLAY"},fa:{activityTitle:a},context:{u:1}}))}notifyPauseState(a,b){X(this.g,c=>{if(c==null)throw Error("Invalid before coWatchingState");return{state:{...c,playbackState:a?"PAUSE":"PLAY",mediaPlayoutPosition:b},context:{u:3}}})}notifySeekToTimestamp(a){X(this.g,b=>{if(b==null)throw Error("Invalid before coWatchingState");return{state:{...b,mediaPlayoutPosition:a}, context:{u:2}}})}notifyPlayoutRate(a){X(this.g,b=>{if(b==null)throw Error("Invalid before coWatchingState");return{state:{...b,mediaPlayoutRate:a},context:{u:4}}})}notifyBuffering(a){X(this.g,b=>{if(b==null)throw Error("Invalid before coWatchingState");return{state:{...b,mediaPlayoutPosition:a,playbackState:"BUFFERING"},context:{u:3}}})}notifyReady(a){X(this.g,b=>{if(b==null)throw Error("Invalid before coWatchingState");return{state:{...b,mediaPlayoutPosition:a},context:{u:3}}})}disconnect(){this.g.disconnect()}}; function bg(a,b){if(a==null||b==null)return!1;const c=a.playbackState==="PLAY"?3*Math.max(a.mediaPlayoutRate,1):0,d=Math.abs(a.mediaPlayoutPosition-b.mediaPlayoutPosition);return a.mediaId===b.mediaId&&a.mediaPlayoutRate===b.mediaPlayoutRate&&d<=c&&a.playbackState===b.playbackState};function Yf(a,b){const c=Cd(a.signal,d=>{b(d)});a.o.push(c)}var cg=class{constructor(a,b){this.channel=a;this.signal=b;this.o=[]}send(a){this.channel.send(hc(a))}async C(a,b){a=await this.channel.C(hc(a));return b(a.data)}shutdown(){this.o.forEach(a=>{this.signal.detach(a)})}};function dg(a,b){var c=eg;const d=a.signal(),e=a.signal();Cd(b,f=>{const g=c(f)?d:e;Pe(a,g,f)},a);return{ia:d,ga:e}}function fg(a,b,c,d=e=>e){Cd(c,e=>{Pe(a,b,d(e))},a)};async function gg(a,b){if(b)return a=await Vf({activityTitle:b.activityTitle,K:"co-watching",ja:()=>b.onCoWatchingStateQuery(),O:c=>{b.onCoWatchingStateChanged(c)}},a,{X:Nf,W:Pf,V:Sf,N:Lf,M:bg}),new ag(a)}async function hg(a,b){if(b)return a=await Vf({activityTitle:b.activityTitle,K:"co-doing",O:c=>{b.onCoDoingStateChanged(c)}},a,{X:If,W:Kf,V:Tf,N:Hf,M:$f}),new Zf(a)} async function ig(a){const b=new Se,c=b.signal();a=await a;fg(b,c,a.signal,f=>f.content);const {ia:d,ga:e}=dg(b,c);return{Z:new cg(a.channel,d),aa:new cg(a.channel,e)}}function eg(a){a:switch(E(a,ff)){case 1:a=J(a,cf,1,ff);break a;default:throw Error("CA Message arrived with no known content message set");}return a.g()};async function jg(a,b){({Z:a}=await ig(mf(a.g)));b=await hg(a,b);if(!b)throw Error("Failed to create co-doing session");return b}async function kg(a,b){({aa:a}=await ig(mf(a.g)));b=await gg(a,b);if(!b)throw Error("Failed to create co-watching session");return b};var lg=class extends Id{async notifySidePanel(a){await pf(this.context.g,1,a)}async unloadSidePanel(){await nf(this.context.g)}async loadSidePanel(){await of(this.context.g)}};var mg=class extends Id{async setAddonStartingState(a){if(a===null)throw new L(Jc("addonStartingState"));if(typeof a!=="object")throw new L(N("addonStartingState",typeof a,"object | undefined"));if(a.sidePanelUrl!==void 0&&typeof a.sidePanelUrl!=="string")throw new L(N("sidePanelUrl",typeof a.sidePanelUrl,"string | undefined"));if(a.additionalData!==void 0&&typeof a.additionalData!=="string")throw new L(N("additionalData",typeof a.additionalData,"string | undefined"));if(Object.keys(a).length!==+!!a.sidePanelUrl+ +!!a.additionalData)throw new L(Ic);if(Object.keys(a).length===0)throw new L(Hc);var b=[];b.push(gd(fd(dd(1),a.sidePanelUrl),a.additionalData));a=this.context.g;var c=new Xd,d=c.setAddonStartingState,e=new Wd;b=bc(e,b);await qf(a,d.call(c,b))}};var ng=class extends Id{async notifyMainStage(a){await pf(this.context.g,2,a)}};var og=class{constructor(a){a=a.cloudProjectNumber;const b=Kd();if(b.cloudProjectNumber!==a)throw new L(Cc);const c=b.S,d=b.ba;let e;rf=(e=rf)!=null?e:hf(d,c,a);this.g=new sf(b)}async createMainStageClient(){var a=this.g;if(a.h.frameType!==2)throw new L(yc);return await Promise.resolve(new lg(a))}async createSidePanelClient(){var a=this.g;if(a.h.frameType!==1)throw new L(zc);return await Promise.resolve(new ng(a))}async createCoWatchingClient(a){return await kg(this.g,a)}async createCoDoingClient(a){return await jg(this.g, a)}async createRoomsStandaloneClient(){var a=this.g;if(a.h.frameType!==2)throw new L(yc);return await Promise.resolve(new mg(a))}};let pg=null;var qg={addon:{getFrameType:function(){a:{var a=Kd().frameType;switch(a){case 2:a="MAIN_STAGE";break a;case 1:a="SIDE_PANEL";break a;default:throw Error(`Unknown frame type: ${a}`);}}return a},createAddonSession:async function(a){if(a===null)throw new L(Jc("config"));if(typeof a!=="object")throw new L(N("config",typeof a,"object"));if(typeof a.cloudProjectNumber!=="string")throw new L(N("cloudProjectNumber",typeof a.cloudProjectNumber,"string"));if(pg&&Kd().S!=="integration.test.google.com")throw new L(Tc); return pg=new og(a)}}},rg=["meet"],Y=l;rg[0]in Y||typeof Y.execScript=="undefined"||Y.execScript("var "+rg[0]);for(var Z;rg.length&&(Z=rg.shift());)rg.length||qg===void 0?Y[Z]&&Y[Z]!==Object.prototype[Z]?Y=Y[Z]:Y=Y[Z]={}:Y[Z]=qg;}).apply(topLevel);export const meet = topLevel.meet;