@daily-co/daily-js
Advanced tools
Comparing version 0.3.1 to 0.9.0
@@ -1,1 +0,1 @@ | ||
var e,t="object"==typeof Reflect?Reflect:null,i=t&&"function"==typeof t.apply?t.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function n(){n.init.call(this)}var s=n;n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var a=10;function o(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function c(e,t,i,r){var n,s,a,c;if("function"!=typeof i)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i);if(void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),a=s[t]),void 0===a)a=s[t]=i,++e._eventsCount;else if("function"==typeof a?a=s[t]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),(n=o(e))>0&&a.length>n&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,c=l,console&&console.warn&&console.warn(c)}return e}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,i(this.listener,this.target,e))}.bind(n);return s.listener=r,n.wrapFn=s,s}function u(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):d(n,n.length)}function p(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function d(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),n.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return o(this)},n.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var l=c.length,u=d(c,l);for(r=0;r<l;++r)i(u[r],this,t)}return!0},n.prototype.addListener=function(e,t){return c(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return c(this,e,t,!0)},n.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,l(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,l(this,e,t)),this},n.prototype.removeListener=function(e,t){var i,r,n,s,a;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,s=Object.keys(i);for(r=0;r<s.length;++r)"removeListener"!==(n=s[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},n.prototype.listeners=function(e){return u(this,e,!0)},n.prototype.rawListeners=function(e){return u(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},n.prototype.listenerCount=p,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]};var h="function"==typeof Map,f="function"==typeof Set,m="function"==typeof WeakSet,v=Object.keys,g=function(e,t){return e&&"object"==typeof e&&t.add(e)},y=function(e,t,i,r){for(var n,s=0;s<e.length;s++)if(i((n=e[s])[0],t[0],r)&&i(n[1],t[1],r))return!0;return!1},_=function(e,t,i,r){for(var n=0;n<e.length;n++)if(i(e[n],t,r))return!0;return!1},b=function(e,t){return e===t||e!=e&&t!=t},w=function(e){return e.constructor===Object},k=function(e){return"function"==typeof e.then},M=function(e){return!(!e.$$typeof||!e._store)},L=function(e){return function(t){var i=e||t;return function(e,t,r){void 0===r&&(r=m?new WeakSet:Object.create({_values:[],add:function(e){this._values.push(e)},has:function(e){return!!~this._values.indexOf(e)}}));var n=r.has(e),s=r.has(t);return n||s?n&&s:(g(e,r),g(t,r),i(e,t,r))}}},S=function(e){var t=[];return e.forEach(function(e,i){return t.push([i,e])}),t},C=function(e){var t=[];return e.forEach(function(e){return t.push(e)}),t},j=function(e,t,i,r){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!i(e[n],t[n],r))return!1;return!0},x=function(e,t,i,r){var n=S(e),s=S(t);if(n.length!==s.length)return!1;for(var a=0;a<n.length;a++)if(!y(s,n[a],i,r)||!y(n,s[a],i,r))return!1;return!0},I=function(e,t,i,r){var n,s=v(e),a=v(t);if(s.length!==a.length)return!1;for(var o=0;o<s.length;o++){if(n=s[o],!_(a,n,b))return!1;if(("_owner"!==n||!M(e)||!M(t))&&!i(e[n],t[n],r))return!1}return!0},E=function(e,t){return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline&&e.unicode===t.unicode&&e.sticky===t.sticky&&e.lastIndex===t.lastIndex},P=function(e,t,i,r){var n=C(e),s=C(t);if(n.length!==s.length)return!1;for(var a=0;a<n.length;a++)if(!_(s,n[a],i,r)||!_(n,s[a],i,r))return!1;return!0},O=Array.isArray,T=function(e){var t="function"==typeof e?e(i):i;function i(e,i,r){if(b(e,i))return!0;var n=typeof e;if(n!==typeof i||"object"!==n||!e||!i)return!1;if(w(e)&&w(i))return I(e,i,t,r);var s=O(e),a=O(i);if(s||a)return s===a&&j(e,i,t,r);var o=e instanceof Date,c=i instanceof Date;if(o||c)return o===c&&b(e.getTime(),i.getTime());var l=e instanceof RegExp,u=i instanceof RegExp;if(l||u)return l===u&&E(e,i);if(k(e)||k(i))return e===i;if(h){var p=e instanceof Map,d=i instanceof Map;if(p||d)return p===d&&x(e,i,t,r)}if(f){var m=e instanceof Set,v=i instanceof Set;if(m||v)return m===v&&P(e,i,t,r)}return I(e,i,t,r)}return i},F=(T(L()),T(L(b)),T());T(function(){return b});const D="new",R="loading",A="loaded",N="joining-meeting",$="joined-meeting",U="left-meeting",W="error",q="loading",z="loaded",V="started-camera",K="camera-error",B="joining-meeting",H="joined-meeting",J="left-meeting",G="participant-joined",Q="participant-updated",X="participant-left",Y="recording-started",Z="recording-stopped",ee="recording-stats",te="recording-error",ie="recording-upload-completed",re="app-message",ne="input-event",se="error",ae=4096,oe="iframe-call-message",ce="start-camera",le="set-input-devices",ue="set-output-device",pe="get-input-devices",de="join-meeting",he="leave-meeting",fe="update-participant",me="local-audio",ve="local-video",ge="local-screen-start",ye="local-screen-stop",_e="local-recording-start",be="local-recording-stop",we="load-css",ke="set-bandwidth",Me="get-calc-stats",Le="enumerate-devices",Se="cycle-camera",Ce="cycle-mic",je="app-msg",xe="add-fake-participant",Ie="set-show-names",Ee={url:{validate:e=>"string"==typeof e,help:"url should be a string"},token:{validate:e=>"string"==typeof e,help:"token should be a string",queryString:"t"},iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,layout:{validate:e=>"custom-v1"===e||"browser"===e,help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"}},Pe={styles:{validate:e=>{for(var t in e)if("cam"!==t&&"screen"!==t)return!1;if(e.cam)for(var t in e.cam)if("div"!==t&&"video"!==t)return!1;if(e.screen)for(var t in e.screen)if("div"!==t&&"video"!==t)return!1;return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setAudio:!0,setVideo:!0,eject:!0};class Oe extends s{static wrap(e,t={}){if(!e||!e.contentWindow||"string"!=typeof e.src)throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return t.layout||(t.customLayout?t.layout="custom-v1":t.layout="browser"),new Oe(e,t)}static createFrame(e,t){let i,r;e&&t?(i=e,r=t):e&&e.append?(i=e,r={}):(i=document.body,r=e||{});let n=r.iframeStyle;n||(n=i===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:375,height:450,right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});let s=document.createElement("iframe");return s.allow="microphone; camera; autoplay",s.style.visibility="hidden",i.appendChild(s),s.style.visibility=null,Object.keys(n).forEach(e=>s.style[e]=n[e]),r.layout||(r.customLayout?r.layout="custom-v1":r.layout="browser"),new Oe(s,r)}static createTransparentFrame(e={}){let t=document.createElement("iframe");return t.allow="microphone; camera; autoplay",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n pointer-events: none;\n ",document.body.appendChild(t),e.layout||(e.layout="custom-v1"),Oe.wrap(t,e)}constructor(e,t={}){super(),this.validateProperties(t),this.properties={...t},this._iframe=e,this._loaded=!1,this._meetingState=D,this._participants={},this._messageCallbacks={},window.addEventListener("message",e=>{e.data&&"iframe-call-message"===e.data.what&&this.handleMessage(e.data)})}loadCss({bodyClass:e,cssFile:t,cssText:i}){return this._sendIframeMsg({action:we,cssFile:this.absoluteUrl(t),bodyClass:e,cssText:i}),this}iframe(){return this._iframe}meetingState(){return this._meetingState}participants(){return this._participants}updateParticipant(e,t){if(e&&t&&this._participants[e]){for(var i in t){if(!Pe[i])throw new Error(`unrecognized updateParticipant property ${i}`);if(Pe[i].validate&&!Pe[i].validate(t[i]))throw new Error(Pe[i].help)}this._sendIframeMsg({action:fe,id:e,properties:t})}return this}updateParticipants(e){for(var t in e)this.updateParticipant(t,e[t]);return this}localAudio(){return this._participants.local?this._participants.local.audio:null}localVideo(){return this._participants.local?this._participants.local.video:null}setLocalAudio(e){return this._sendIframeMsg({action:me,state:e}),this}setLocalVideo(e){return this._sendIframeMsg({action:ve,state:e}),this}setBandwidth({kbs:e,trackConstraints:t}){return this._sendIframeMsg({action:ke,kbs:e,trackConstraints:t}),this}startCamera(){return new Promise((e,t)=>{this._sendIframeMsg({action:ce},t=>{delete t.action,delete t.callbackStamp,e(t)})})}cycleCamera(){return new Promise((e,t)=>{this._sendIframeMsg({action:Se},t=>{e({device:t.device})})})}cycleMic(){return new Promise((e,t)=>{this._sendIframeMsg({action:Ce},t=>{e({device:t.device})})})}setInputDevices({audioDeviceId:e,videoDeviceId:t}){return this._sendIframeMsg({action:le,audioDeviceId:e,videoDeviceId:t}),this}setOutputDevice({outputDeviceId:e}){return this._sendIframeMsg({action:ue,outputDeviceId:e}),this}getInputDevices(){return new Promise((e,t)=>{this._sendIframeMsg({action:pe},t=>{delete t.action,delete t.callbackStamp,e(t)})})}async load(e){if(e&&(this.validateProperties(e),this.properties={...this.properties,...e}),!this.properties.url)throw new Error("can't load meeting because url property isn't set");return this._meetingState=R,this.emit(q,{action:q}),this._iframe.src=this.assembleMeetingUrl(),new Promise((e,t)=>{this._loadedCallback=(()=>{this._loaded=!0,this._meetingState=A,(this.properties.cssFile||this.properties.cssText)&&this.loadCss(this.properties),e()})})}async join(e={}){let t=!1;if(this._loaded){if(t=!(!this.properties.cssFile&&!this.properties.cssText),e.url&&e.url!==this.properties.url)return void console.error("error: can't change the daily.co call url after load()")}else await this.load(e);return this._meetingState=N,this.emit(B,{action:B}),this._sendIframeMsg({action:de}),new Promise((e,i)=>{this._joinedCallback=(i=>{if(this._meetingState=$,i)for(var r in i)this.fixupParticipant(i[r]),this._participants[r]={...i[r]};t&&this.loadCss(this.properties),e(i)})})}async leave(){return new Promise((e,t)=>{this._sendIframeMsg({action:he},()=>{this._iframe.src="",this._loaded=!1,this._meetingState=U,this.emit(U,{action:U}),e()})})}startScreenShare(){this._sendIframeMsg({action:ge})}stopScreenShare(){this._sendIframeMsg({action:ye})}startRecording(){this._sendIframeMsg({action:_e})}stopRecording(){this._sendIframeMsg({action:be})}getNetworkStats(){return new Promise((e,t)=>{this._sendIframeMsg({action:Me},t=>{e({stats:t.stats})})})}enumerateDevices(e){return new Promise((t,i)=>{this._sendIframeMsg({action:Le,kind:e},e=>{t({devices:e.devices})})})}sendAppMessage(e,t="*"){if(JSON.stringify(e).length>ae)throw new Error("Message data too large. Max size is "+ae);return this._sendIframeMsg({action:je,data:e,to:t}),this}addFakeParticipant(e){return this._sendIframeMsg({action:xe,...e}),this}setShowNamesMode(e){return e&&"always"!==e&&"never"!==e?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this._sendIframeMsg({action:Ie,mode:e}),this)}validateProperties(e){for(var t in e){if(!Ee[t])throw new Error(`unrecognized property '${t}'`);if(Ee[t].validate&&!Ee[t].validate(e[t]))throw new Error(`property '${t}': ${Ee[t].help}`)}}assembleMeetingUrl(){let e={...this.properties,emb:"t"},t=e.url.match(/\?/)?"&":"?";return e.url+t+Object.keys(Ee).filter(t=>Ee[t].queryString&&void 0!==e[t]).map(t=>`${Ee[t].queryString}=${e[t]}`).join("&")}_sendIframeMsg(e,t){let i={...e};if(i.what=oe,t){let e=Date.now();this._messageCallbacks[e]=t,i.callbackStamp=e}this._iframe.contentWindow.postMessage(i,"*")}handleMessage(e){switch(e.callbackStamp&&this._messageCallbacks[e.callbackStamp]&&(this._messageCallbacks[e.callbackStamp].call(this,e),delete this._messageCallbacks[e.callbackStamp]),delete e.what,delete e.callbackStamp,e.action){case z:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emit(e.action,e);break;case H:this._joinedCallback&&(this._joinedCallback(e.participants),this._joinedCallback=null),this.emit(e.action,e);break;case G:case Q:if(this.fixupParticipant(e),e.participant&&e.participant.session_id){let t=e.participant.local?"local":e.participant.session_id;F(e.participant,this._participants[t])||(this._participants[t]={...e.participant},this.emit(e.action,e))}break;case X:this.fixupParticipant(e),e.participant&&e.participant.session_id&&(delete this._participants[e.participant.session_id],this.emit(e.action,e));break;case se:this._meetingState=W,this.emit(e.action,e);break;case J:this._meetingState!==W&&(this._meetingState=U),this.emit(e.action,e);break;case ne:let t=this._participants[e.session_id];t||(t=e.session_id===this._participants.local.session_id?this._participants.local:{}),this.emit(e.action,{action:e.action,event:e.event,participant:{...t}});break;case Y:case Z:case ee:case te:case ie:case V:case K:case re:this.emit(e.action,e)}}fixupParticipant(e){let t=e.participant?e.participant:e;t.id&&(t.owner=!!t.owner,t.session_id=t.id,t.user_name=t.name,t.joined_at=t.joinedAt,delete t.id,delete t.name,delete t.joinedAt)}absoluteUrl(e){if(void 0===e)return;let t=document.createElement("a");return t.href=e,t.href}sayHello(){const e="hello, world.";return console.log(e),e}}export default Oe;export{H as DAILY_EVENT_JOINED_MEETING,B as DAILY_EVENT_JOINING_MEETING,J as DAILY_EVENT_LEFT_MEETING,W as DAILY_STATE_ERROR,$ as DAILY_STATE_JOINED,N as DAILY_STATE_JOINING,U as DAILY_STATE_LEFT,D as DAILY_STATE_NEW}; | ||
var e,t="object"==typeof Reflect?Reflect:null,i=t&&"function"==typeof t.apply?t.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function n(){n.init.call(this)}var s=n;n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var a=10;function o(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function c(e,t,i,r){var n,s,a,c;if("function"!=typeof i)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i);if(void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),s=e._events),a=s[t]),void 0===a)a=s[t]=i,++e._eventsCount;else if("function"==typeof a?a=s[t]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),(n=o(e))>0&&a.length>n&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,c=l,console&&console.warn&&console.warn(c)}return e}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,i(this.listener,this.target,e))}.bind(n);return s.listener=r,n.wrapFn=s,s}function u(e,t,i){var r=e._events;if(void 0===r)return[];var n=r[t];return void 0===n?[]:"function"==typeof n?i?[n.listener||n]:[n]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(n):h(n,n.length)}function p(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function h(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),n.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return o(this)},n.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var c=s[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var l=c.length,u=h(c,l);for(r=0;r<l;++r)i(u[r],this,t)}return!0},n.prototype.addListener=function(e,t){return c(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return c(this,e,t,!0)},n.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,l(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,l(this,e,t)),this},n.prototype.removeListener=function(e,t){var i,r,n,s,a;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(n=-1,s=i.length-1;s>=0;s--)if(i[s]===t||i[s].listener===t){a=i[s].listener,n=s;break}if(n<0)return this;0===n?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,n),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var n,s=Object.keys(i);for(r=0;r<s.length;++r)"removeListener"!==(n=s[r])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},n.prototype.listeners=function(e){return u(this,e,!0)},n.prototype.rawListeners=function(e){return u(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},n.prototype.listenerCount=p,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]};var f="function"==typeof Map,d="function"==typeof Set,m="function"==typeof WeakSet,v=Object.keys,g=function(e,t){return e&&"object"==typeof e&&t.add(e)},y=function(e,t,i,r){for(var n,s=0;s<e.length;s++)if(i((n=e[s])[0],t[0],r)&&i(n[1],t[1],r))return!0;return!1},_=function(e,t,i,r){for(var n=0;n<e.length;n++)if(i(e[n],t,r))return!0;return!1},b=function(e,t){return e===t||e!=e&&t!=t},w=function(e){return e.constructor===Object},k=function(e){return"function"==typeof e.then},M=function(e){return!(!e.$$typeof||!e._store)},L=function(e){return function(t){var i=e||t;return function(e,t,r){void 0===r&&(r=m?new WeakSet:Object.create({_values:[],add:function(e){this._values.push(e)},has:function(e){return!!~this._values.indexOf(e)}}));var n=r.has(e),s=r.has(t);return n||s?n&&s:(g(e,r),g(t,r),i(e,t,r))}}},S=function(e){var t=[];return e.forEach(function(e,i){return t.push([i,e])}),t},C=function(e){var t=[];return e.forEach(function(e){return t.push(e)}),t},I=function(e,t,i,r){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!i(e[n],t[n],r))return!1;return!0},j=function(e,t,i,r){var n=S(e),s=S(t);if(n.length!==s.length)return!1;for(var a=0;a<n.length;a++)if(!y(s,n[a],i,r)||!y(n,s[a],i,r))return!1;return!0},x=function(e,t,i,r){var n,s=v(e),a=v(t);if(s.length!==a.length)return!1;for(var o=0;o<s.length;o++){if(n=s[o],!_(a,n,b))return!1;if(("_owner"!==n||!M(e)||!M(t))&&!i(e[n],t[n],r))return!1}return!0},E=function(e,t){return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline&&e.unicode===t.unicode&&e.sticky===t.sticky&&e.lastIndex===t.lastIndex},O=function(e,t,i,r){var n=C(e),s=C(t);if(n.length!==s.length)return!1;for(var a=0;a<n.length;a++)if(!_(s,n[a],i,r)||!_(n,s[a],i,r))return!1;return!0},P=Array.isArray,T=function(e){var t="function"==typeof e?e(i):i;function i(e,i,r){if(b(e,i))return!0;var n=typeof e;if(n!==typeof i||"object"!==n||!e||!i)return!1;if(w(e)&&w(i))return x(e,i,t,r);var s=P(e),a=P(i);if(s||a)return s===a&&I(e,i,t,r);var o=e instanceof Date,c=i instanceof Date;if(o||c)return o===c&&b(e.getTime(),i.getTime());var l=e instanceof RegExp,u=i instanceof RegExp;if(l||u)return l===u&&E(e,i);if(k(e)||k(i))return e===i;if(f){var p=e instanceof Map,h=i instanceof Map;if(p||h)return p===h&&j(e,i,t,r)}if(d){var m=e instanceof Set,v=i instanceof Set;if(m||v)return m===v&&O(e,i,t,r)}return x(e,i,t,r)}return i},F=(T(L()),T(L(b)),T());T(function(){return b});const D="new",R="loading",A="loaded",N="joining-meeting",$="joined-meeting",U="left-meeting",W="error",q="loading",z="loaded",V="started-camera",K="camera-error",B="joining-meeting",H="joined-meeting",J="left-meeting",G="participant-joined",Q="participant-updated",X="participant-left",Y="recording-started",Z="recording-stopped",ee="recording-stats",te="recording-error",ie="recording-upload-completed",re="app-message",ne="input-event",se="error",ae=4096,oe="iframe-call-message",ce="start-camera",le="set-input-devices",ue="set-output-device",pe="get-input-devices",he="join-meeting",fe="leave-meeting",de="update-participant",me="local-audio",ve="local-video",ge="local-screen-start",ye="local-screen-stop",_e="local-recording-start",be="local-recording-stop",we="load-css",ke="set-bandwidth",Me="get-calc-stats",Le="enumerate-devices",Se="cycle-camera",Ce="cycle-mic",Ie="app-msg",je="add-fake-participant",xe="set-show-names",Ee="register-input-handler",Oe={url:{validate:e=>"string"==typeof e,help:"url should be a string"},token:{validate:e=>"string"==typeof e,help:"token should be a string",queryString:"t"},iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,layout:{validate:e=>"custom-v1"===e||"browser"===e,help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"}},Pe={styles:{validate:e=>{for(var t in e)if("cam"!==t&&"screen"!==t)return!1;if(e.cam)for(var t in e.cam)if("div"!==t&&"video"!==t)return!1;if(e.screen)for(var t in e.screen)if("div"!==t&&"video"!==t)return!1;return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setAudio:!0,setVideo:!0,eject:!0};class Te extends s{static wrap(e,t={}){if(!e||!e.contentWindow||"string"!=typeof e.src)throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return t.layout||(t.customLayout?t.layout="custom-v1":t.layout="browser"),new Te(e,t)}static createFrame(e,t){let i,r;e&&t?(i=e,r=t):e&&e.append?(i=e,r={}):(i=document.body,r=e||{});let n=r.iframeStyle;n||(n=i===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:375,height:450,right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});let s=document.createElement("iframe");return s.allow="microphone; camera; autoplay",s.style.visibility="hidden",i.appendChild(s),s.style.visibility=null,Object.keys(n).forEach(e=>s.style[e]=n[e]),r.layout||(r.customLayout?r.layout="custom-v1":r.layout="browser"),new Te(s,r)}static createTransparentFrame(e={}){let t=document.createElement("iframe");return t.allow="microphone; camera; autoplay",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n pointer-events: none;\n ",document.body.appendChild(t),e.layout||(e.layout="custom-v1"),Te.wrap(t,e)}constructor(e,t={}){super(),this.validateProperties(t),this.properties={...t},this._iframe=e,this._loaded=!1,this._meetingState=D,this._participants={},this._inputEventsOn={},this._messageCallbacks={},window.addEventListener("message",e=>{e.data&&"iframe-call-message"===e.data.what&&this.handleMessage(e.data)})}loadCss({bodyClass:e,cssFile:t,cssText:i}){return this._sendIframeMsg({action:we,cssFile:this.absoluteUrl(t),bodyClass:e,cssText:i}),this}iframe(){return this._iframe}meetingState(){return this._meetingState}participants(){return this._participants}updateParticipant(e,t){if(this._participants.local&&this._participants.local.session_id===e&&(e="local"),e&&t&&this._participants[e]){for(var i in t){if(!Pe[i])throw new Error(`unrecognized updateParticipant property ${i}`);if(Pe[i].validate&&!Pe[i].validate(t[i]))throw new Error(Pe[i].help)}this._sendIframeMsg({action:de,id:e,properties:t})}return this}updateParticipants(e){for(var t in e)this.updateParticipant(t,e[t]);return this}localAudio(){return this._participants.local?this._participants.local.audio:null}localVideo(){return this._participants.local?this._participants.local.video:null}setLocalAudio(e){return this._sendIframeMsg({action:me,state:e}),this}setLocalVideo(e){return this._sendIframeMsg({action:ve,state:e}),this}setBandwidth({kbs:e,trackConstraints:t}){return this._sendIframeMsg({action:ke,kbs:e,trackConstraints:t}),this}startCamera(){return new Promise((e,t)=>{this._sendIframeMsg({action:ce},t=>{delete t.action,delete t.callbackStamp,e(t)})})}cycleCamera(){return new Promise((e,t)=>{this._sendIframeMsg({action:Se},t=>{e({device:t.device})})})}cycleMic(){return new Promise((e,t)=>{this._sendIframeMsg({action:Ce},t=>{e({device:t.device})})})}setInputDevices({audioDeviceId:e,videoDeviceId:t}){return this._sendIframeMsg({action:le,audioDeviceId:e,videoDeviceId:t}),this}setOutputDevice({outputDeviceId:e}){return this._sendIframeMsg({action:ue,outputDeviceId:e}),this}getInputDevices(){return new Promise((e,t)=>{this._sendIframeMsg({action:pe},t=>{delete t.action,delete t.callbackStamp,e(t)})})}async load(e){if(e&&(this.validateProperties(e),this.properties={...this.properties,...e}),!this.properties.url)throw new Error("can't load meeting because url property isn't set");return this._meetingState=R,this.emit(q,{action:q}),this._iframe.src=this.assembleMeetingUrl(),new Promise((e,t)=>{this._loadedCallback=(()=>{this._loaded=!0,this._meetingState=A,(this.properties.cssFile||this.properties.cssText)&&this.loadCss(this.properties);for(let e in this._inputEventsOn)this._sendIframeMsg({action:Ee,on:e});e()})})}async join(e={}){let t=!1;if(this._loaded){if(t=!(!this.properties.cssFile&&!this.properties.cssText),e.url&&e.url!==this.properties.url)return void console.error("error: can't change the daily.co call url after load()")}else await this.load(e);return this._meetingState=N,this.emit(B,{action:B}),this._sendIframeMsg({action:he}),new Promise((e,i)=>{this._joinedCallback=(i=>{if(this._meetingState=$,i)for(var r in i)this.fixupParticipant(i[r]),this._participants[r]={...i[r]};t&&this.loadCss(this.properties),e(i)})})}async leave(){return new Promise((e,t)=>{this._sendIframeMsg({action:fe},()=>{this._iframe.src="",this._loaded=!1,this._meetingState=U,this.emit(U,{action:U}),e()})})}startScreenShare(){this._sendIframeMsg({action:ge})}stopScreenShare(){this._sendIframeMsg({action:ye})}startRecording(){this._sendIframeMsg({action:_e})}stopRecording(){this._sendIframeMsg({action:be})}getNetworkStats(){return new Promise((e,t)=>{this._sendIframeMsg({action:Me},t=>{e({stats:t.stats})})})}enumerateDevices(e){return new Promise((t,i)=>{this._sendIframeMsg({action:Le,kind:e},e=>{t({devices:e.devices})})})}sendAppMessage(e,t="*"){if(JSON.stringify(e).length>ae)throw new Error("Message data too large. Max size is "+ae);return this._sendIframeMsg({action:Ie,data:e,to:t}),this}addFakeParticipant(e){return this._sendIframeMsg({action:je,...e}),this}setShowNamesMode(e){return e&&"always"!==e&&"never"!==e?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this._sendIframeMsg({action:xe,mode:e}),this)}validateProperties(e){for(var t in e){if(!Oe[t])throw new Error(`unrecognized property '${t}'`);if(Oe[t].validate&&!Oe[t].validate(e[t]))throw new Error(`property '${t}': ${Oe[t].help}`)}}assembleMeetingUrl(){let e={...this.properties,emb:"t"},t=e.url.match(/\?/)?"&":"?";return e.url+t+Object.keys(Oe).filter(t=>Oe[t].queryString&&void 0!==e[t]).map(t=>`${Oe[t].queryString}=${e[t]}`).join("&")}_sendIframeMsg(e,t){let i={...e};if(i.what=oe,t){let e=Date.now();this._messageCallbacks[e]=t,i.callbackStamp=e}this._iframe.contentWindow.postMessage(i,"*")}handleMessage(e){switch(e.callbackStamp&&this._messageCallbacks[e.callbackStamp]&&(this._messageCallbacks[e.callbackStamp].call(this,e),delete this._messageCallbacks[e.callbackStamp]),delete e.what,delete e.callbackStamp,e.action){case z:this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emit(e.action,e);break;case H:this._joinedCallback&&(this._joinedCallback(e.participants),this._joinedCallback=null),this.emit(e.action,e);break;case G:case Q:if(this.fixupParticipant(e),e.participant&&e.participant.session_id){let t=e.participant.local?"local":e.participant.session_id;F(e.participant,this._participants[t])||(this._participants[t]={...e.participant},this.emit(e.action,e))}break;case X:this.fixupParticipant(e),e.participant&&e.participant.session_id&&(delete this._participants[e.participant.session_id],this.emit(e.action,e));break;case se:this._iframe.src="",this._loaded=!1,this._meetingState=W,this.emit(e.action,e);break;case J:this._meetingState!==W&&(this._meetingState=U),this.emit(e.action,e);break;case ne:let t=this._participants[e.session_id];t||(t=e.session_id===this._participants.local.session_id?this._participants.local:{}),this.emit(e.event.type,{action:e.event.type,event:e.event,participant:{...t}});break;case Y:case Z:case ee:case te:case ie:case V:case K:case re:this.emit(e.action,e)}}fixupParticipant(e){let t=e.participant?e.participant:e;t.id&&(t.owner=!!t.owner,t.session_id=t.id,t.user_name=t.name,t.joined_at=t.joinedAt,delete t.id,delete t.name,delete t.joinedAt)}absoluteUrl(e){if(void 0===e)return;let t=document.createElement("a");return t.href=e,t.href}on(e,t){return this._inputEventsOn[e]={},this._sendIframeMsg({action:Ee,on:e}),s.prototype.on.call(this,e,t)}once(e,t){return this._inputEventsOn[e]={},this._sendIframeMsg({action:Ee,on:e}),s.prototype.once.call(this,e,t)}off(e,t){return delete this._inputEventsOn[e],this._sendIframeMsg({action:Ee,off:e}),s.prototype.off.call(this,e,t)}sayHello(){const e="hello, world.";return console.log(e),e}}export default Te;export{H as DAILY_EVENT_JOINED_MEETING,B as DAILY_EVENT_JOINING_MEETING,J as DAILY_EVENT_LEFT_MEETING,W as DAILY_STATE_ERROR,$ as DAILY_STATE_JOINED,N as DAILY_STATE_JOINING,U as DAILY_STATE_LEFT,D as DAILY_STATE_NEW}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DailyIframe=t():e.DailyIframe=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([function(e,t,n){var r=n(12);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){r(e,t,n[t])})}return e}},function(e,t,n){e.exports=n(11)},function(e,t){function n(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise(function(i,o){var a=e.apply(t,r);function s(e){n(a,i,o,s,u,"next",e)}function u(e){n(a,i,o,s,u,"throw",e)}s(void 0)})}}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var r=n(13),i=n(14);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(15);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=c(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,o(this.listener,this.target,e))}.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):d(i,i.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function d(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=d(u,c);for(n=0;n<c;++n)o(l[n],this,t)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){!function(e){"use strict";var t="function"==typeof Map,n="function"==typeof Set,r="function"==typeof WeakSet,i=Object.keys,o=function(e,t){return e&&"object"==typeof e&&t.add(e)},a=function(e,t,n,r){for(var i,o=0;o<e.length;o++)if(i=e[o],n(i[0],t[0],r)&&n(i[1],t[1],r))return!0;return!1},s=function(e,t,n,r){for(var i=0;i<e.length;i++)if(n(e[i],t,r))return!0;return!1},u=function(e,t){return e===t||e!=e&&t!=t},c=function(e){return e.constructor===Object},l=function(e){return"function"==typeof e.then},f=function(e){return!(!e.$$typeof||!e._store)},p=function(e){return function(t){var n=e||t;return function(e,t,i){void 0===i&&(i=r?new WeakSet:Object.create({_values:[],add:function(e){this._values.push(e)},has:function(e){return!!~this._values.indexOf(e)}}));var a=i.has(e),s=i.has(t);return a||s?a&&s:(o(e,i),o(t,i),n(e,t,i))}}},h=function(e){var t=[];return e.forEach(function(e,n){return t.push([n,e])}),t},d=function(e){var t=[];return e.forEach(function(e){return t.push(e)}),t},v=function(e,t,n,r){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!n(e[i],t[i],r))return!1;return!0},y=function(e,t,n,r){var i=h(e),o=h(t);if(i.length!==o.length)return!1;for(var s=0;s<i.length;s++)if(!a(o,i[s],n,r)||!a(i,o[s],n,r))return!1;return!0},m=function(e,t,n,r){var o,a=i(e),c=i(t);if(a.length!==c.length)return!1;for(var l=0;l<a.length;l++){if(o=a[l],!s(c,o,u))return!1;if(!("_owner"===o&&f(e)&&f(t)||n(e[o],t[o],r)))return!1}return!0},g=function(e,t){return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline&&e.unicode===t.unicode&&e.sticky===t.sticky&&e.lastIndex===t.lastIndex},b=function(e,t,n,r){var i=d(e),o=d(t);if(i.length!==o.length)return!1;for(var a=0;a<i.length;a++)if(!s(o,i[a],n,r)||!s(i,o[a],n,r))return!1;return!0},_=Array.isArray,w=function(e){var r="function"==typeof e?e(i):i;function i(e,i,o){if(u(e,i))return!0;var a=typeof e;if(a!==typeof i||"object"!==a||!e||!i)return!1;if(c(e)&&c(i))return m(e,i,r,o);var s=_(e),f=_(i);if(s||f)return s===f&&v(e,i,r,o);var p=e instanceof Date,h=i instanceof Date;if(p||h)return p===h&&u(e.getTime(),i.getTime());var d=e instanceof RegExp,w=i instanceof RegExp;if(d||w)return d===w&&g(e,i);if(l(e)||l(i))return e===i;if(t){var k=e instanceof Map,x=i instanceof Map;if(k||x)return k===x&&y(e,i,r,o)}if(n){var E=e instanceof Set,L=i instanceof Set;if(E||L)return E===L&&b(e,i,r,o)}return m(e,i,r,o)}return i},k=w(p()),x=w(p(u)),E=w(),L=w(function(){return u}),j={circularDeep:k,circularShallow:x,createCustom:w,deep:E,sameValueZero:u,shallow:L};e.createCustomEqual=w,e.sameValueZeroEqual=u,e.circularDeepEqual=k,e.circularShallowEqual=x,e.deepEqual=E,e.shallowEqual=L,e.default=j,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,n){var r=n(16);e.exports=r.default},function(e,t,n){var r=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(e,t,n){var r=l;return function(i,o){if(r===p)throw new Error("Generator is already running");if(r===h){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?h:f,u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=h,n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",f="suspendedYield",p="executing",h="completed",d={};function v(){}function y(){}function m(){}var g={};g[o]=function(){return this};var b=Object.getPrototypeOf,_=b&&b(b(O([])));_&&_!==n&&r.call(_,o)&&(g=_);var w=m.prototype=v.prototype=Object.create(g);function k(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function x(e){var t;this._invoke=function(n,i){function o(){return new Promise(function(t,o){!function t(n,i,o,a){var s=c(e[n],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(l).then(function(e){u.value=e,o(u)},function(e){return t("throw",e,o,a)})}a(s.arg)}(n,i,t,o)})}return t=t?t.then(o,o):o()}}function E(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return d;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function O(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:I}}function I(){return{value:t,done:!0}}return y.prototype=w.constructor=m,m.constructor=y,m[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(x.prototype),x.prototype[a]=function(){return this},e.AsyncIterator=x,e.async=function(t,n,r,i){var o=new x(u(t,n,r,i));return e.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},k(w),w[s]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=O,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},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}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(e){return n(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},r(t)}e.exports=r},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=n(2),a=n.n(o),s=n(0),u=n.n(s),c=n(4),l=n.n(c),f=n(5),p=n.n(f),h=n(6),d=n.n(h),v=n(3),y=n.n(v),m=n(7),g=n.n(m),b=n(8),_=n.n(b),w=n(9),k="new";n.d(t,"default",function(){return L}),n.d(t,"DAILY_STATE_NEW",function(){return k}),n.d(t,"DAILY_STATE_JOINING",function(){return"joining-meeting"}),n.d(t,"DAILY_STATE_JOINED",function(){return"joined-meeting"}),n.d(t,"DAILY_STATE_LEFT",function(){return"left-meeting"}),n.d(t,"DAILY_STATE_ERROR",function(){return"error"}),n.d(t,"DAILY_EVENT_JOINING_MEETING",function(){return"joining-meeting"}),n.d(t,"DAILY_EVENT_JOINED_MEETING",function(){return"joined-meeting"}),n.d(t,"DAILY_EVENT_LEFT_MEETING",function(){return"left-meeting"});var x={url:{validate:function(e){return"string"==typeof e},help:"url should be a string"},token:{validate:function(e){return"string"==typeof e},help:"token should be a string",queryString:"t"},iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,layout:{validate:function(e){return"custom-v1"===e||"browser"===e},help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"}},E={styles:{validate:function(e){for(var t in e)if("cam"!==t&&"screen"!==t)return!1;if(e.cam)for(var t in e.cam)if("div"!==t&&"video"!==t)return!1;if(e.screen)for(var t in e.screen)if("div"!==t&&"video"!==t)return!1;return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setAudio:!0,setVideo:!0,eject:!0},L=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l()(this,t),(n=p()(this,d()(t).call(this))).validateProperties(r),n.properties=u()({},r),n._iframe=e,n._loaded=!1,n._meetingState=k,n._participants={},n._messageCallbacks={},window.addEventListener("message",function(e){e.data&&"iframe-call-message"===e.data.what&&n.handleMessage(e.data)}),n}return g()(t,e),y()(t,null,[{key:"wrap",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!e.contentWindow||"string"!=typeof e.src)throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return n.layout||(n.customLayout?n.layout="custom-v1":n.layout="browser"),new t(e,n)}},{key:"createFrame",value:function(e,n){var r,i;e&&n?(r=e,i=n):e&&e.append?(r=e,i={}):(r=document.body,i=e||{});var o=i.iframeStyle;o||(o=r===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:375,height:450,right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});var a=document.createElement("iframe");return a.allow="microphone; camera; autoplay",a.style.visibility="hidden",r.appendChild(a),a.style.visibility=null,Object.keys(o).forEach(function(e){return a.style[e]=o[e]}),i.layout||(i.customLayout?i.layout="custom-v1":i.layout="browser"),new t(a,i)}},{key:"createTransparentFrame",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=document.createElement("iframe");return n.allow="microphone; camera; autoplay",n.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n pointer-events: none;\n ",document.body.appendChild(n),e.layout||(e.layout="custom-v1"),t.wrap(n,e)}}]),y()(t,[{key:"loadCss",value:function(e){var t=e.bodyClass,n=e.cssFile,r=e.cssText;return this._sendIframeMsg({action:"load-css",cssFile:this.absoluteUrl(n),bodyClass:t,cssText:r}),this}},{key:"iframe",value:function(){return this._iframe}},{key:"meetingState",value:function(){return this._meetingState}},{key:"participants",value:function(){return this._participants}},{key:"updateParticipant",value:function(e,t){if(e&&t&&this._participants[e]){for(var n in t){if(!E[n])throw new Error("unrecognized updateParticipant property ".concat(n));if(E[n].validate&&!E[n].validate(t[n]))throw new Error(E[n].help)}this._sendIframeMsg({action:"update-participant",id:e,properties:t})}return this}},{key:"updateParticipants",value:function(e){for(var t in e)this.updateParticipant(t,e[t]);return this}},{key:"localAudio",value:function(){return this._participants.local?this._participants.local.audio:null}},{key:"localVideo",value:function(){return this._participants.local?this._participants.local.video:null}},{key:"setLocalAudio",value:function(e){return this._sendIframeMsg({action:"local-audio",state:e}),this}},{key:"setLocalVideo",value:function(e){return this._sendIframeMsg({action:"local-video",state:e}),this}},{key:"setBandwidth",value:function(e){var t=e.kbs,n=e.trackConstraints;return this._sendIframeMsg({action:"set-bandwidth",kbs:t,trackConstraints:n}),this}},{key:"startCamera",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"start-camera"},function(e){delete e.action,delete e.callbackStamp,t(e)})})}},{key:"cycleCamera",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"cycle-camera"},function(e){t({device:e.device})})})}},{key:"cycleMic",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"cycle-mic"},function(e){t({device:e.device})})})}},{key:"setInputDevices",value:function(e){var t=e.audioDeviceId,n=e.videoDeviceId;return this._sendIframeMsg({action:"set-input-devices",audioDeviceId:t,videoDeviceId:n}),this}},{key:"setOutputDevice",value:function(e){var t=e.outputDeviceId;return this._sendIframeMsg({action:"set-output-device",outputDeviceId:t}),this}},{key:"getInputDevices",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"get-input-devices"},function(e){delete e.action,delete e.callbackStamp,t(e)})})}},{key:"load",value:function(){var e=a()(i.a.mark(function e(t){var n=this;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&(this.validateProperties(t),this.properties=u()({},this.properties,t)),this.properties.url){e.next=3;break}throw new Error("can't load meeting because url property isn't set");case 3:return this._meetingState="loading",this.emit("loading",{action:"loading"}),this._iframe.src=this.assembleMeetingUrl(),e.abrupt("return",new Promise(function(e,t){n._loadedCallback=function(){n._loaded=!0,n._meetingState="loaded",(n.properties.cssFile||n.properties.cssText)&&n.loadCss(n.properties),e()}}));case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"join",value:function(){var e=a()(i.a.mark(function e(){var t,n,r=this,o=arguments;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:{},n=!1,this._loaded){e.next=7;break}return e.next=5,this.load(t);case 5:e.next=11;break;case 7:if(n=!(!this.properties.cssFile&&!this.properties.cssText),!t.url||t.url===this.properties.url){e.next=11;break}return console.error("error: can't change the daily.co call url after load()"),e.abrupt("return");case 11:return this._meetingState="joining-meeting",this.emit("joining-meeting",{action:"joining-meeting"}),this._sendIframeMsg({action:"join-meeting"}),e.abrupt("return",new Promise(function(e,t){r._joinedCallback=function(t){if(r._meetingState="joined-meeting",t)for(var i in t)r.fixupParticipant(t[i]),r._participants[i]=u()({},t[i]);n&&r.loadCss(r.properties),e(t)}}));case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"leave",value:function(){var e=a()(i.a.mark(function e(){var t=this;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,n){t._sendIframeMsg({action:"leave-meeting"},function(){t._iframe.src="",t._loaded=!1,t._meetingState="left-meeting",t.emit("left-meeting",{action:"left-meeting"}),e()})}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"startScreenShare",value:function(){this._sendIframeMsg({action:"local-screen-start"})}},{key:"stopScreenShare",value:function(){this._sendIframeMsg({action:"local-screen-stop"})}},{key:"startRecording",value:function(){this._sendIframeMsg({action:"local-recording-start"})}},{key:"stopRecording",value:function(){this._sendIframeMsg({action:"local-recording-stop"})}},{key:"getNetworkStats",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"get-calc-stats"},function(e){t({stats:e.stats})})})}},{key:"enumerateDevices",value:function(e){var t=this;return new Promise(function(n,r){t._sendIframeMsg({action:"enumerate-devices",kind:e},function(e){n({devices:e.devices})})})}},{key:"sendAppMessage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*";if(JSON.stringify(e).length>4096)throw new Error("Message data too large. Max size is 4096");return this._sendIframeMsg({action:"app-msg",data:e,to:t}),this}},{key:"addFakeParticipant",value:function(e){return this._sendIframeMsg(u()({action:"add-fake-participant"},e)),this}},{key:"setShowNamesMode",value:function(e){return e&&"always"!==e&&"never"!==e?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this._sendIframeMsg({action:"set-show-names",mode:e}),this)}},{key:"validateProperties",value:function(e){for(var t in e){if(!x[t])throw new Error("unrecognized property '".concat(t,"'"));if(x[t].validate&&!x[t].validate(e[t]))throw new Error("property '".concat(t,"': ").concat(x[t].help))}}},{key:"assembleMeetingUrl",value:function(){var e=u()({},this.properties,{emb:"t"}),t=e.url.match(/\?/)?"&":"?";return e.url+t+Object.keys(x).filter(function(t){return x[t].queryString&&void 0!==e[t]}).map(function(t){return"".concat(x[t].queryString,"=").concat(e[t])}).join("&")}},{key:"_sendIframeMsg",value:function(e,t){var n=u()({},e);if(n.what="iframe-call-message",t){var r=Date.now();this._messageCallbacks[r]=t,n.callbackStamp=r}this._iframe.contentWindow.postMessage(n,"*")}},{key:"handleMessage",value:function(e){switch(e.callbackStamp&&this._messageCallbacks[e.callbackStamp]&&(this._messageCallbacks[e.callbackStamp].call(this,e),delete this._messageCallbacks[e.callbackStamp]),delete e.what,delete e.callbackStamp,e.action){case"loaded":this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emit(e.action,e);break;case"joined-meeting":this._joinedCallback&&(this._joinedCallback(e.participants),this._joinedCallback=null),this.emit(e.action,e);break;case"participant-joined":case"participant-updated":if(this.fixupParticipant(e),e.participant&&e.participant.session_id){var t=e.participant.local?"local":e.participant.session_id;Object(w.deepEqual)(e.participant,this._participants[t])||(this._participants[t]=u()({},e.participant),this.emit(e.action,e))}break;case"participant-left":this.fixupParticipant(e),e.participant&&e.participant.session_id&&(delete this._participants[e.participant.session_id],this.emit(e.action,e));break;case"error":this._meetingState="error",this.emit(e.action,e);break;case"left-meeting":"error"!==this._meetingState&&(this._meetingState="left-meeting"),this.emit(e.action,e);break;case"input-event":var n=this._participants[e.session_id];n||(n=e.session_id===this._participants.local.session_id?this._participants.local:{}),this.emit(e.action,{action:e.action,event:e.event,participant:u()({},n)});break;case"recording-started":case"recording-stopped":case"recording-stats":case"recording-error":case"recording-upload-completed":case"started-camera":case"camera-error":case"app-message":this.emit(e.action,e)}}},{key:"fixupParticipant",value:function(e){var t=e.participant?e.participant:e;t.id&&(t.owner=!!t.owner,t.session_id=t.id,t.user_name=t.name,t.joined_at=t.joinedAt,delete t.id,delete t.name,delete t.joinedAt)}},{key:"absoluteUrl",value:function(e){if(void 0!==e){var t=document.createElement("a");return t.href=e,t.href}}},{key:"sayHello",value:function(){var e="hello, world.";return console.log(e),e}}]),t}(_.a)}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DailyIframe=t():e.DailyIframe=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([function(e,t,n){var r=n(12);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){r(e,t,n[t])})}return e}},function(e,t,n){e.exports=n(11)},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,o,a,s;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=c(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,o(this.listener,this.target,e))}.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):d(i,i.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function d(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=d(u,c);for(n=0;n<c;++n)o(l[n],this,t)}return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,o,a;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t){function n(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise(function(i,o){var a=e.apply(t,r);function s(e){n(a,i,o,s,u,"next",e)}function u(e){n(a,i,o,s,u,"throw",e)}s(void 0)})}}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){var r=n(13),i=n(14);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(15);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){!function(e){"use strict";var t="function"==typeof Map,n="function"==typeof Set,r="function"==typeof WeakSet,i=Object.keys,o=function(e,t){return e&&"object"==typeof e&&t.add(e)},a=function(e,t,n,r){for(var i,o=0;o<e.length;o++)if(i=e[o],n(i[0],t[0],r)&&n(i[1],t[1],r))return!0;return!1},s=function(e,t,n,r){for(var i=0;i<e.length;i++)if(n(e[i],t,r))return!0;return!1},u=function(e,t){return e===t||e!=e&&t!=t},c=function(e){return e.constructor===Object},l=function(e){return"function"==typeof e.then},f=function(e){return!(!e.$$typeof||!e._store)},p=function(e){return function(t){var n=e||t;return function(e,t,i){void 0===i&&(i=r?new WeakSet:Object.create({_values:[],add:function(e){this._values.push(e)},has:function(e){return!!~this._values.indexOf(e)}}));var a=i.has(e),s=i.has(t);return a||s?a&&s:(o(e,i),o(t,i),n(e,t,i))}}},h=function(e){var t=[];return e.forEach(function(e,n){return t.push([n,e])}),t},d=function(e){var t=[];return e.forEach(function(e){return t.push(e)}),t},v=function(e,t,n,r){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!n(e[i],t[i],r))return!1;return!0},y=function(e,t,n,r){var i=h(e),o=h(t);if(i.length!==o.length)return!1;for(var s=0;s<i.length;s++)if(!a(o,i[s],n,r)||!a(i,o[s],n,r))return!1;return!0},m=function(e,t,n,r){var o,a=i(e),c=i(t);if(a.length!==c.length)return!1;for(var l=0;l<a.length;l++){if(o=a[l],!s(c,o,u))return!1;if(!("_owner"===o&&f(e)&&f(t)||n(e[o],t[o],r)))return!1}return!0},g=function(e,t){return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline&&e.unicode===t.unicode&&e.sticky===t.sticky&&e.lastIndex===t.lastIndex},b=function(e,t,n,r){var i=d(e),o=d(t);if(i.length!==o.length)return!1;for(var a=0;a<i.length;a++)if(!s(o,i[a],n,r)||!s(i,o[a],n,r))return!1;return!0},_=Array.isArray,w=function(e){var r="function"==typeof e?e(i):i;function i(e,i,o){if(u(e,i))return!0;var a=typeof e;if(a!==typeof i||"object"!==a||!e||!i)return!1;if(c(e)&&c(i))return m(e,i,r,o);var s=_(e),f=_(i);if(s||f)return s===f&&v(e,i,r,o);var p=e instanceof Date,h=i instanceof Date;if(p||h)return p===h&&u(e.getTime(),i.getTime());var d=e instanceof RegExp,w=i instanceof RegExp;if(d||w)return d===w&&g(e,i);if(l(e)||l(i))return e===i;if(t){var k=e instanceof Map,x=i instanceof Map;if(k||x)return k===x&&y(e,i,r,o)}if(n){var E=e instanceof Set,L=i instanceof Set;if(E||L)return E===L&&b(e,i,r,o)}return m(e,i,r,o)}return i},k=w(p()),x=w(p(u)),E=w(),L=w(function(){return u}),j={circularDeep:k,circularShallow:x,createCustom:w,deep:E,sameValueZero:u,shallow:L};e.createCustomEqual=w,e.sameValueZeroEqual=u,e.circularDeepEqual=k,e.circularShallowEqual=x,e.deepEqual=E,e.shallowEqual=L,e.default=j,Object.defineProperty(e,"__esModule",{value:!0})}(t)},function(e,t,n){var r=n(16);e.exports=r.default},function(e,t,n){var r=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(e,t,n,r){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),a=new O(r||[]);return o._invoke=function(e,t,n){var r=l;return function(i,o){if(r===p)throw new Error("Generator is already running");if(r===h){if("throw"===i)throw o;return I()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var u=c(e,t,n);if("normal"===u.type){if(r=n.done?h:f,u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=h,n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",f="suspendedYield",p="executing",h="completed",d={};function v(){}function y(){}function m(){}var g={};g[o]=function(){return this};var b=Object.getPrototypeOf,_=b&&b(b(S([])));_&&_!==n&&r.call(_,o)&&(g=_);var w=m.prototype=v.prototype=Object.create(g);function k(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function x(e){var t;this._invoke=function(n,i){function o(){return new Promise(function(t,o){!function t(n,i,o,a){var s=c(e[n],e,i);if("throw"!==s.type){var u=s.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(l).then(function(e){u.value=e,o(u)},function(e){return t("throw",e,o,a)})}a(s.arg)}(n,i,t,o)})}return t=t?t.then(o,o):o()}}function E(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return d;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=c(r,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,d;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,d):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,d)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function S(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}return{next:I}}function I(){return{value:t,done:!0}}return y.prototype=w.constructor=m,m.constructor=y,m[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(w),e},e.awrap=function(e){return{__await:e}},k(x.prototype),x.prototype[a]=function(){return this},e.AsyncIterator=x,e.async=function(t,n,r,i){var o=new x(u(t,n,r,i));return e.isGeneratorFunction(n)?o:o.next().then(function(e){return e.done?e.value:o.next()})},k(w),w[s]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=S,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),j(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:S(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),d}},e}(e.exports);try{regeneratorRuntime=r}catch(e){Function("r","regeneratorRuntime = r")(r)}},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}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(e){return n(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},r(t)}e.exports=r},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=n(3),a=n.n(o),s=n(0),u=n.n(s),c=n(5),l=n.n(c),f=n(6),p=n.n(f),h=n(7),d=n.n(h),v=n(4),y=n.n(v),m=n(8),g=n.n(m),b=n(2),_=n.n(b),w=n(9),k="new";n.d(t,"default",function(){return L}),n.d(t,"DAILY_STATE_NEW",function(){return k}),n.d(t,"DAILY_STATE_JOINING",function(){return"joining-meeting"}),n.d(t,"DAILY_STATE_JOINED",function(){return"joined-meeting"}),n.d(t,"DAILY_STATE_LEFT",function(){return"left-meeting"}),n.d(t,"DAILY_STATE_ERROR",function(){return"error"}),n.d(t,"DAILY_EVENT_JOINING_MEETING",function(){return"joining-meeting"}),n.d(t,"DAILY_EVENT_JOINED_MEETING",function(){return"joined-meeting"}),n.d(t,"DAILY_EVENT_LEFT_MEETING",function(){return"left-meeting"});var x={url:{validate:function(e){return"string"==typeof e},help:"url should be a string"},token:{validate:function(e){return"string"==typeof e},help:"token should be a string",queryString:"t"},iframeStyle:!0,customLayout:!0,cssFile:!0,cssText:!0,bodyClass:!0,layout:{validate:function(e){return"custom-v1"===e||"browser"===e},help:'layout may only be set to "custom-v1"',queryString:"layout"},emb:{queryString:"emb"}},E={styles:{validate:function(e){for(var t in e)if("cam"!==t&&"screen"!==t)return!1;if(e.cam)for(var t in e.cam)if("div"!==t&&"video"!==t)return!1;if(e.screen)for(var t in e.screen)if("div"!==t&&"video"!==t)return!1;return!0},help:"styles format should be a subset of: { cam: {div: {}, video: {}}, screen: {div: {}, video: {}} }"},setAudio:!0,setVideo:!0,eject:!0},L=function(e){function t(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l()(this,t),(n=p()(this,d()(t).call(this))).validateProperties(r),n.properties=u()({},r),n._iframe=e,n._loaded=!1,n._meetingState=k,n._participants={},n._inputEventsOn={},n._messageCallbacks={},window.addEventListener("message",function(e){e.data&&"iframe-call-message"===e.data.what&&n.handleMessage(e.data)}),n}return g()(t,e),y()(t,null,[{key:"wrap",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e||!e.contentWindow||"string"!=typeof e.src)throw new Error("DailyIframe::Wrap needs an iframe-like first argument");return n.layout||(n.customLayout?n.layout="custom-v1":n.layout="browser"),new t(e,n)}},{key:"createFrame",value:function(e,n){var r,i;e&&n?(r=e,i=n):e&&e.append?(r=e,i={}):(r=document.body,i=e||{});var o=i.iframeStyle;o||(o=r===document.body?{position:"fixed",border:"1px solid black",backgroundColor:"white",width:375,height:450,right:"1em",bottom:"1em"}:{border:0,width:"100%",height:"100%"});var a=document.createElement("iframe");return a.allow="microphone; camera; autoplay",a.style.visibility="hidden",r.appendChild(a),a.style.visibility=null,Object.keys(o).forEach(function(e){return a.style[e]=o[e]}),i.layout||(i.customLayout?i.layout="custom-v1":i.layout="browser"),new t(a,i)}},{key:"createTransparentFrame",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=document.createElement("iframe");return n.allow="microphone; camera; autoplay",n.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n pointer-events: none;\n ",document.body.appendChild(n),e.layout||(e.layout="custom-v1"),t.wrap(n,e)}}]),y()(t,[{key:"loadCss",value:function(e){var t=e.bodyClass,n=e.cssFile,r=e.cssText;return this._sendIframeMsg({action:"load-css",cssFile:this.absoluteUrl(n),bodyClass:t,cssText:r}),this}},{key:"iframe",value:function(){return this._iframe}},{key:"meetingState",value:function(){return this._meetingState}},{key:"participants",value:function(){return this._participants}},{key:"updateParticipant",value:function(e,t){if(this._participants.local&&this._participants.local.session_id===e&&(e="local"),e&&t&&this._participants[e]){for(var n in t){if(!E[n])throw new Error("unrecognized updateParticipant property ".concat(n));if(E[n].validate&&!E[n].validate(t[n]))throw new Error(E[n].help)}this._sendIframeMsg({action:"update-participant",id:e,properties:t})}return this}},{key:"updateParticipants",value:function(e){for(var t in e)this.updateParticipant(t,e[t]);return this}},{key:"localAudio",value:function(){return this._participants.local?this._participants.local.audio:null}},{key:"localVideo",value:function(){return this._participants.local?this._participants.local.video:null}},{key:"setLocalAudio",value:function(e){return this._sendIframeMsg({action:"local-audio",state:e}),this}},{key:"setLocalVideo",value:function(e){return this._sendIframeMsg({action:"local-video",state:e}),this}},{key:"setBandwidth",value:function(e){var t=e.kbs,n=e.trackConstraints;return this._sendIframeMsg({action:"set-bandwidth",kbs:t,trackConstraints:n}),this}},{key:"startCamera",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"start-camera"},function(e){delete e.action,delete e.callbackStamp,t(e)})})}},{key:"cycleCamera",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"cycle-camera"},function(e){t({device:e.device})})})}},{key:"cycleMic",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"cycle-mic"},function(e){t({device:e.device})})})}},{key:"setInputDevices",value:function(e){var t=e.audioDeviceId,n=e.videoDeviceId;return this._sendIframeMsg({action:"set-input-devices",audioDeviceId:t,videoDeviceId:n}),this}},{key:"setOutputDevice",value:function(e){var t=e.outputDeviceId;return this._sendIframeMsg({action:"set-output-device",outputDeviceId:t}),this}},{key:"getInputDevices",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"get-input-devices"},function(e){delete e.action,delete e.callbackStamp,t(e)})})}},{key:"load",value:function(){var e=a()(i.a.mark(function e(t){var n=this;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&(this.validateProperties(t),this.properties=u()({},this.properties,t)),this.properties.url){e.next=3;break}throw new Error("can't load meeting because url property isn't set");case 3:return this._meetingState="loading",this.emit("loading",{action:"loading"}),this._iframe.src=this.assembleMeetingUrl(),e.abrupt("return",new Promise(function(e,t){n._loadedCallback=function(){for(var t in n._loaded=!0,n._meetingState="loaded",(n.properties.cssFile||n.properties.cssText)&&n.loadCss(n.properties),n._inputEventsOn)n._sendIframeMsg({action:"register-input-handler",on:t});e()}}));case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"join",value:function(){var e=a()(i.a.mark(function e(){var t,n,r=this,o=arguments;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>0&&void 0!==o[0]?o[0]:{},n=!1,this._loaded){e.next=7;break}return e.next=5,this.load(t);case 5:e.next=11;break;case 7:if(n=!(!this.properties.cssFile&&!this.properties.cssText),!t.url||t.url===this.properties.url){e.next=11;break}return console.error("error: can't change the daily.co call url after load()"),e.abrupt("return");case 11:return this._meetingState="joining-meeting",this.emit("joining-meeting",{action:"joining-meeting"}),this._sendIframeMsg({action:"join-meeting"}),e.abrupt("return",new Promise(function(e,t){r._joinedCallback=function(t){if(r._meetingState="joined-meeting",t)for(var i in t)r.fixupParticipant(t[i]),r._participants[i]=u()({},t[i]);n&&r.loadCss(r.properties),e(t)}}));case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"leave",value:function(){var e=a()(i.a.mark(function e(){var t=this;return i.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,n){t._sendIframeMsg({action:"leave-meeting"},function(){t._iframe.src="",t._loaded=!1,t._meetingState="left-meeting",t.emit("left-meeting",{action:"left-meeting"}),e()})}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"startScreenShare",value:function(){this._sendIframeMsg({action:"local-screen-start"})}},{key:"stopScreenShare",value:function(){this._sendIframeMsg({action:"local-screen-stop"})}},{key:"startRecording",value:function(){this._sendIframeMsg({action:"local-recording-start"})}},{key:"stopRecording",value:function(){this._sendIframeMsg({action:"local-recording-stop"})}},{key:"getNetworkStats",value:function(){var e=this;return new Promise(function(t,n){e._sendIframeMsg({action:"get-calc-stats"},function(e){t({stats:e.stats})})})}},{key:"enumerateDevices",value:function(e){var t=this;return new Promise(function(n,r){t._sendIframeMsg({action:"enumerate-devices",kind:e},function(e){n({devices:e.devices})})})}},{key:"sendAppMessage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"*";if(JSON.stringify(e).length>4096)throw new Error("Message data too large. Max size is 4096");return this._sendIframeMsg({action:"app-msg",data:e,to:t}),this}},{key:"addFakeParticipant",value:function(e){return this._sendIframeMsg(u()({action:"add-fake-participant"},e)),this}},{key:"setShowNamesMode",value:function(e){return e&&"always"!==e&&"never"!==e?(console.error('setShowNamesMode argument should be "always", "never", or false'),this):(this._sendIframeMsg({action:"set-show-names",mode:e}),this)}},{key:"validateProperties",value:function(e){for(var t in e){if(!x[t])throw new Error("unrecognized property '".concat(t,"'"));if(x[t].validate&&!x[t].validate(e[t]))throw new Error("property '".concat(t,"': ").concat(x[t].help))}}},{key:"assembleMeetingUrl",value:function(){var e=u()({},this.properties,{emb:"t"}),t=e.url.match(/\?/)?"&":"?";return e.url+t+Object.keys(x).filter(function(t){return x[t].queryString&&void 0!==e[t]}).map(function(t){return"".concat(x[t].queryString,"=").concat(e[t])}).join("&")}},{key:"_sendIframeMsg",value:function(e,t){var n=u()({},e);if(n.what="iframe-call-message",t){var r=Date.now();this._messageCallbacks[r]=t,n.callbackStamp=r}this._iframe.contentWindow.postMessage(n,"*")}},{key:"handleMessage",value:function(e){switch(e.callbackStamp&&this._messageCallbacks[e.callbackStamp]&&(this._messageCallbacks[e.callbackStamp].call(this,e),delete this._messageCallbacks[e.callbackStamp]),delete e.what,delete e.callbackStamp,e.action){case"loaded":this._loadedCallback&&(this._loadedCallback(),this._loadedCallback=null),this.emit(e.action,e);break;case"joined-meeting":this._joinedCallback&&(this._joinedCallback(e.participants),this._joinedCallback=null),this.emit(e.action,e);break;case"participant-joined":case"participant-updated":if(this.fixupParticipant(e),e.participant&&e.participant.session_id){var t=e.participant.local?"local":e.participant.session_id;Object(w.deepEqual)(e.participant,this._participants[t])||(this._participants[t]=u()({},e.participant),this.emit(e.action,e))}break;case"participant-left":this.fixupParticipant(e),e.participant&&e.participant.session_id&&(delete this._participants[e.participant.session_id],this.emit(e.action,e));break;case"error":this._iframe.src="",this._loaded=!1,this._meetingState="error",this.emit(e.action,e);break;case"left-meeting":"error"!==this._meetingState&&(this._meetingState="left-meeting"),this.emit(e.action,e);break;case"input-event":var n=this._participants[e.session_id];n||(n=e.session_id===this._participants.local.session_id?this._participants.local:{}),this.emit(e.event.type,{action:e.event.type,event:e.event,participant:u()({},n)});break;case"recording-started":case"recording-stopped":case"recording-stats":case"recording-error":case"recording-upload-completed":case"started-camera":case"camera-error":case"app-message":this.emit(e.action,e)}}},{key:"fixupParticipant",value:function(e){var t=e.participant?e.participant:e;t.id&&(t.owner=!!t.owner,t.session_id=t.id,t.user_name=t.name,t.joined_at=t.joinedAt,delete t.id,delete t.name,delete t.joinedAt)}},{key:"absoluteUrl",value:function(e){if(void 0!==e){var t=document.createElement("a");return t.href=e,t.href}}},{key:"on",value:function(e,t){return this._inputEventsOn[e]={},this._sendIframeMsg({action:"register-input-handler",on:e}),_.a.prototype.on.call(this,e,t)}},{key:"once",value:function(e,t){return this._inputEventsOn[e]={},this._sendIframeMsg({action:"register-input-handler",on:e}),_.a.prototype.once.call(this,e,t)}},{key:"off",value:function(e,t){return delete this._inputEventsOn[e],this._sendIframeMsg({action:"register-input-handler",off:e}),_.a.prototype.off.call(this,e,t)}},{key:"sayHello",value:function(){var e="hello, world.";return console.log(e),e}}]),t}(_.a)}])}); |
{ | ||
"name": "@daily-co/daily-js", | ||
"version": "0.3.1", | ||
"version": "0.9.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10.0.0" |
@@ -9,12 +9,17 @@ # daily-js | ||
API docs for creating and managing rooms, permission tokens, | ||
recordings, and other resources are here: | ||
More information about the Daily.co API for video calls here: | ||
https://www.daily.co/api | ||
API "getting started" info and reference docs for creating and | ||
managing rooms, permission tokens, recordings, and other resources are | ||
here: | ||
https://docs.daily.co/reference | ||
See a demo here: | ||
Demos and sample code for this library are here: | ||
https://www.daily.co/api/demo | ||
https://github.com/daily-co/daily-js/tree/master/demo | ||
## Getting started | ||
## Using this library | ||
@@ -155,6 +160,6 @@ You can use this library from a `<script>` tag, as a CommonJS-style | ||
callFrame = window.DailyIframe.createFrame({ | ||
iframeStyle = { | ||
iframeStyle: { | ||
position: 'fixed', | ||
width: 100%, | ||
height: 100% | ||
width: '100%', | ||
height: '100%' | ||
} | ||
@@ -857,3 +862,10 @@ }); | ||
- app-message | ||
- input-event | ||
- click | ||
- mousedown | ||
- mouseup | ||
- mouseover | ||
- mousemove | ||
- touchstart | ||
- touchmove | ||
- touchend | ||
- error | ||
@@ -996,2 +1008,30 @@ | ||
#### `click`, `mousedown`, `mouseup`, `mouseover`, `mousemove`, `touchstart`, `touchmove`, `touchend` | ||
Emitted when corresponding input event fires for a participant video. | ||
``` | ||
// example event object | ||
{ | ||
action: 'click', | ||
event: { | ||
type: 'click' | ||
altKey: false | ||
button: 0 | ||
ctrlKey: false | ||
metaKey: false | ||
offsetX: 40 | ||
offsetY: 46 | ||
pageX: 134 | ||
pageY: 46 | ||
screenX: 2706 | ||
screenY: 298 | ||
shiftKey: false | ||
x: 134 | ||
y: 46 | ||
}, | ||
participant: <participant object> | ||
} | ||
``` | ||
#### `error` | ||
@@ -998,0 +1038,0 @@ |
@@ -67,1 +67,2 @@ | ||
export const DAILY_METHOD_SET_SHOW_NAMES = 'set-show-names'; | ||
export const DAILY_METHOD_REGISTER_INPUT_HANDLER = 'register-input-handler'; |
@@ -60,2 +60,3 @@ import EventEmitter from 'events'; | ||
MAX_APP_MSG_SIZE, | ||
DAILY_METHOD_REGISTER_INPUT_HANDLER, | ||
} from './CommonIncludes.js'; | ||
@@ -227,2 +228,3 @@ | ||
this._participants = {}; | ||
this._inputEventsOn = {}; // need to cache these until loaded | ||
@@ -258,2 +260,6 @@ this._messageCallbacks = {}; | ||
updateParticipant(sessionId, properties) { | ||
if (this._participants.local && | ||
this._participants.local.session_id === sessionId) { | ||
sessionId = 'local'; | ||
} | ||
if (sessionId && properties && this._participants[sessionId]) { | ||
@@ -385,2 +391,6 @@ for (var prop in properties) { | ||
} | ||
for (let eventName in this._inputEventsOn) { | ||
this._sendIframeMsg({ action: DAILY_METHOD_REGISTER_INPUT_HANDLER, | ||
on: eventName }); | ||
} | ||
resolve(); | ||
@@ -583,2 +593,4 @@ } | ||
case DAILY_EVENT_ERROR: | ||
this._iframe.src = ''; | ||
this._loaded = false; | ||
this._meetingState = DAILY_STATE_ERROR; | ||
@@ -602,5 +614,5 @@ this.emit(msg.action, msg); | ||
} | ||
this.emit(msg.action, { action: msg.action, | ||
event: msg.event, | ||
participant: {...p} }); | ||
this.emit(msg.event.type, { action: msg.event.type, | ||
event: msg.event, | ||
participant: {...p} }); | ||
break; | ||
@@ -645,2 +657,27 @@ case DAILY_EVENT_RECORDING_STARTED: | ||
on(eventName, k) { | ||
this._inputEventsOn[eventName] = {}; | ||
this._sendIframeMsg({ action: DAILY_METHOD_REGISTER_INPUT_HANDLER, | ||
on: eventName }); | ||
return EventEmitter.prototype.on.call(this, eventName, k); | ||
} | ||
// todo: once is almost certainly implemented incorrectly. read the | ||
// EventEmitter source to figure out how to do this properly. since | ||
// overriding on/off/once are optimizations, anyway, we won't worry | ||
// about it right now. | ||
once(eventName, k) { | ||
this._inputEventsOn[eventName] = {}; | ||
this._sendIframeMsg({ action: DAILY_METHOD_REGISTER_INPUT_HANDLER, | ||
on: eventName }); | ||
return EventEmitter.prototype.once.call(this, eventName, k); | ||
} | ||
off(eventName, k) { | ||
delete this._inputEventsOn[eventName]; | ||
this._sendIframeMsg({ action: DAILY_METHOD_REGISTER_INPUT_HANDLER, | ||
off: eventName }); | ||
return EventEmitter.prototype.off.call(this, eventName, k); | ||
} | ||
sayHello() { | ||
@@ -647,0 +684,0 @@ const str = 'hello, world.'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2193276
22
812
1048