You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
6.9 KiB

!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=25)}({2:function(e,t,n){"use strict";t.decode=t.parse=n(6),t.encode=t.stringify=n(7)},25:function(e,t,n){"use strict";n.r(t);var i=n(2),r=n(5);n(26);let o,s,a,c,u,d,l=!1;function p(){l=!l,document.getElementById("jitsiContainer").style.visibility=l?"unset":"hidden",document.getElementById("joinButtonContainer").style.visibility=l?"hidden":"unset"}!async function(){try{const e=i.parse(window.location.hash.substring(1)),t=Object.assign({},i.parse(window.location.search.substring(1)),e),n=(e,n=!1)=>{if(!(n||t[e]&&"string"==typeof t[e]))throw new Error("Expected singular ".concat(e," in query string"));return t[e]},l=n("parentUrl",!0),f=n("widgetId",!0);l&&f&&(d=new r.c(n("parentUrl"),n("widgetId"),[r.a.AlwaysOnScreen]),d.expectingExplicitReady=!0),o=n("conferenceDomain"),s=n("conferenceId"),a=n("displayName",!0),c=n("avatarUrl",!0),u=n("userId"),d&&(await d.waitReady(),await d.setAlwaysOnScreen(!1)),document.getElementById("joinButton").onclick=()=>function(){p(),d&&d.setAlwaysOnScreen(!0);console.warn("[Jitsi Widget] The next few errors about failing to parse URL parameters are fine if they mention 'external_api' or 'jitsi' in the stack. They're just Jitsi Meet trying to parse our fragment values and not recognizing the options.");const e=new JitsiMeetExternalAPI(o,{width:"100%",height:"100%",parentNode:document.querySelector("#jitsiContainer"),roomName:s,interfaceConfigOverwrite:{SHOW_JITSI_WATERMARK:!1,SHOW_WATERMARK_FOR_GUESTS:!1,MAIN_TOOLBAR_BUTTONS:[],VIDEO_LAYOUT_FIT:"height"}});a&&e.executeCommand("displayName",a);c&&e.executeCommand("avatarUrl",c);u&&e.executeCommand("email",u);e.on("readyToClose",()=>{p(),d&&d.setAlwaysOnScreen(!1),document.getElementById("jitsiContainer").innerHTML=""})}()}catch(e){console.error("Error setting up Jitsi widget",e),document.getElementById("jitsiContainer").innerText="Failed to load Jitsi widget",p()}}()},26:function(e,t,n){},3:function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},5:function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return u}));var i=n(3),r=n.n(i),o=n(9);let s,a,c;!function(e){e.Screenshot="m.capability.screenshot",e.Sticker="m.sticker",e.AlwaysOnScreen="m.always_on_screen"}(s||(s={})),function(e){e.GetSupportedApiVersions="supported_api_versions",e.TakeScreenshot="screenshot",e.GetCapabilities="capabilities",e.SendEvent="send_event",e.UpdateVisibility="visibility",e.ReceiveOpenIDCredentials="openid_credentials",e.SetAlwaysOnScreen="set_always_on_screen",e.ClientReady="im.vector.ready"}(a||(a={})),function(e){e.ToWidget="toWidget",e.FromWidget="fromWidget"}(c||(c={}));class u{constructor(e,t,n){this.widgetId=t,this.requestedCapabilities=n,r()(this,"origin",void 0),r()(this,"inFlightRequests",{}),r()(this,"readyPromise",void 0),r()(this,"readyPromiseResolve",void 0),r()(this,"expectingExplicitReady",!1),this.origin=new URL(e).origin,this.readyPromise=new Promise(e=>this.readyPromiseResolve=e),window.addEventListener("message",e=>{if(e.origin!==this.origin)return;if(!e.data)return;if(e.data.widgetId!==this.widgetId)return;const t=e.data;if(t.api===c.ToWidget&&t.action)console.log("[WidgetAPI] Got request: ".concat(JSON.stringify(t))),t.action===a.GetCapabilities?(this.onCapabilitiesRequest(t),this.expectingExplicitReady||this.readyPromiseResolve()):t.action===a.ClientReady?(this.readyPromiseResolve(),this.replyToRequest(t,{})):console.warn("[WidgetAPI] Got unexpected action: ".concat(t.action));else if(t.api===c.FromWidget&&this.inFlightRequests[t.requestId]){console.log("[WidgetAPI] Got reply: ".concat(JSON.stringify(t)));const e=this.inFlightRequests[t.requestId];delete this.inFlightRequests[t.requestId],e(t)}else console.warn("[WidgetAPI] Unhandled payload: ".concat(JSON.stringify(t)))})}waitReady(){return this.readyPromise}replyToRequest(e,t){if(!window.parent)return;const n=JSON.parse(JSON.stringify(e));n.response=t,window.parent.postMessage(n,this.origin)}onCapabilitiesRequest(e){return this.replyToRequest(e,{capabilities:this.requestedCapabilities})}callAction(e,t,n){if(!window.parent)return;const i={api:c.FromWidget,widgetId:this.widgetId,action:e,requestId:Object(o.a)(160),data:t,response:{}};n&&(this.inFlightRequests[i.requestId]=n),console.log("[WidgetAPI] Sending request: ",i),window.parent.postMessage(i,"*")}setAlwaysOnScreen(e){return new Promise(t=>{this.callAction(a.SetAlwaysOnScreen,{value:e},null),t()})}}},6:function(e,t,n){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var d=0;d<u;++d){var l,p,f,y,g=e[d].replace(a,"%20"),h=g.indexOf(n);h>=0?(l=g.substr(0,h),p=g.substr(h+1)):(l=g,p=""),f=decodeURIComponent(l),y=decodeURIComponent(p),i(s,f)?r(s[f])?s[f].push(y):s[f]=[s[f],y]:s[f]=y}return s};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},7:function(e,t,n){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(s(e),(function(s){var a=encodeURIComponent(i(s))+n;return r(e[s])?o(e[s],(function(e){return a+encodeURIComponent(i(e))})).join(t):a+encodeURIComponent(i(e[s]))})).join(t):a?encodeURIComponent(i(a))+n+encodeURIComponent(i(e)):""};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],i=0;i<e.length;i++)n.push(t(e[i],i));return n}var s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},9:function(e,t,n){"use strict";function i(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;++i)t+=n.charAt(Math.floor(Math.random()*n.length));return t}n.d(t,"a",(function(){return i}))}});