Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@daily-co/daily-react-hooks

Package Overview
Dependencies
Maintainers
24
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daily-co/daily-react-hooks - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

dist/daily-react-hooks.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@daily-co/daily-js")),n=require("react"),r=e(n),i=require("recoil"),o=e(require("lodash.throttle"));function a(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function u(e){a(o,r,i,u,c,"next",e)}function c(e){a(o,r,i,u,c,"throw",e)}u(void 0)}))}}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var l=n.createContext(null),f=n.createContext({on:function(){},off:function(){}});function d(e,t){return e(t={exports:{}},t.exports),t.exports}var p=d((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(e,t,n,r){var i=Object.create((t&&t.prototype instanceof l?t:l).prototype),o=new x(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=k(a,n);if(u){if(u===s)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=c(e,t,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===s)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(e,n,o),i}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 s={};function l(){}function f(){}function d(){}var p={};p[i]=function(){return this};var v=Object.getPrototypeOf,h=v&&v(v(R([])));h&&h!==t&&n.call(h,i)&&(p=h);var g=d.prototype=l.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function y(e,t){var r;this._invoke=function(i,o){function a(){return new t((function(r,a){!function r(i,o,a,u){var s=c(e[i],e,o);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function k(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return s;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,s;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,s):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,s)}function b(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function R(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return f.prototype=g.constructor=d,d.constructor=f,d[a]=f.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(y.prototype),y.prototype[o]=function(){return this},e.AsyncIterator=y,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new y(u(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),g[a]="Generator",g[i]=function(){return this},g.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=R,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.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,s):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),s},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),w(n),s}},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;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:R(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),s}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),v=function(){return n.useContext(l)},h=0,g=function(){return h++},m=function(e,t){var r=n.useContext(f),i=r.on,o=r.off,a=n.useState(!1),u=a[0],c=a[1],s=n.useRef(0),l=n.useMemo((function(){return g()}),[]);n.useEffect((function(){if(e&&!u){if(s.current>1e5)return console.error("useDailyEvent called with potentially non-memoized event callback or due to too many re-renders.\n Memoize using useCallback to avoid re-render loop or reduce the amount of state transitions the callback depends on.\n Passed callback for '"+e+"' event is NOT registered.",t),void c(!0);s.current++;var n=setTimeout((function(){s.current=0}),50);return i(e,t,l),function(){clearTimeout(n),o(e,l)}}}),[t,e,l,u,o,i])},y=function(e,t,r){void 0===r&&(r=100);var i=n.useContext(f),a=i.on,u=i.off,c=n.useMemo((function(){return g()}),[]),s=n.useRef([]),l=n.useMemo((function(){return o((function(){0!==s.current.length&&(t(s.current),s.current=[])}),r,{trailing:!0})}),[t,r]);n.useEffect((function(){if(e)return a(e,(function(e){s.current.push(e),setTimeout(l,0)}),c),function(){u(e,c)}}),[l,e,c,u,a])},k=i.atom({key:"participants-objects",default:[]}),b=i.selectorFamily({key:"participant",get:function(e){return function(t){var n;return null!=(n=(0,t.get)(k).find((function(t){return t.session_id===e})))?n:null}}}),w=function(e){var t=e.children,o=v();m("active-speaker-change",i.useRecoilCallback((function(e){var t=e.set,n=e.snapshot;return function(){var e=u(p.mark((function e(r){var i,a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.activeSpeaker.peerId,e.next=3,n.getPromise(b(i));case 3:if(!(a=e.sent)&&o&&(a=o.participants()[i]),a){e.next=7;break}return e.abrupt("return");case 7:t(k,(function(e){return[].concat(e).map((function(e){return e.session_id===i?c({},e,{last_active:new Date}):e}))}));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[o]));var a=i.useRecoilCallback((function(e){var t=e.set;return function(){var e=u(p.mark((function e(n){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t(k,(function(e){return[].concat(e,Object.values(n)).filter((function(e,t,n){return n.findIndex((function(t){return t.session_id===e.session_id}))==t}))}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[]);return n.useEffect((function(){if(o){var e=setInterval((function(){var t=o.participants();"local"in t&&(a(t),clearInterval(e))}),100);return function(){clearInterval(e)}}}),[o,a]),m("joined-meeting",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(k,(function(t){return t.some((function(e){return e.local}))?[].concat(t).map((function(t){return t.local?e.participants.local:t})):[].concat(t,[e.participants.local])}))}}))),y("participant-joined",i.useRecoilCallback((function(e){var t=e.set;return function(){var e=u(p.mark((function e(n){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.length){e.next=2;break}return e.abrupt("return");case 2:t(k,(function(e){return[].concat(e,n.map((function(e){return e.participant}))).filter((function(e,t,n){return n.findIndex((function(t){return t.session_id===e.session_id}))==t}))}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[])),y("participant-updated",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;e.forEach((function(e){var t=e.participant;n(k,(function(e){return[].concat(e).map((function(e){return e.session_id===t.session_id?t:e}))}))}))}))}}),[])),y("participant-left",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(k,(function(t){return[].concat(t).filter((function(t){return!e.some((function(e){return e.participant.session_id===t.session_id}))}))}))}}),[])),r.createElement(r.Fragment,null,t)},x=i.atom({key:"room",default:null}),R=function(e){var t=e.children,o=v(),a=i.useRecoilCallback((function(e){var t=e.set;return u(p.mark((function e(){var n;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,o.room();case 4:return t(x,n=e.sent),e.abrupt("return",n);case 7:case"end":return e.stop()}}),e)})))}),[o]);return n.useEffect((function(){if(o){var e,t,n=function(){e=setInterval(u(p.mark((function t(){var n;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,a();case 2:(n=t.sent)&&"config"in n&&clearInterval(e);case 4:case"end":return t.stop()}}),t)}))),250)},r=function(){clearInterval(e),t=setInterval(u(p.mark((function e(){var n;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a();case 2:(n=e.sent)&&"config"in n&&clearInterval(t);case 4:case"end":return e.stop()}}),e)}))),250)},i=setTimeout((function(){a()}),0);return o.on("access-state-updated",n),o.on("joining-meeting",r),function(){o.off("access-state-updated",n),o.off("joining-meeting",r),clearTimeout(i)}}}),[o,a]),r.createElement(r.Fragment,null,t)},S=["children"],C=function(e,t){var r=void 0===t?{}:t,o=r.onParticipantLeft,a=r.onParticipantUpdated,u=i.useRecoilValue(b(e));return y("participant-updated",n.useCallback((function(t){var n=t.filter((function(t){return t.participant.session_id===e}));n.length&&n.forEach((function(e){setTimeout((function(){return null==a?void 0:a(e)}),0)}))}),[a,e])),y("participant-left",n.useCallback((function(t){if(t.filter((function(t){return t.participant.session_id===e})).length){var n=t[t.length-1];setTimeout((function(){return null==o?void 0:o(n)}),0)}}),[o,e])),u},E=i.atom({key:"active-id",default:""}),L=i.atomFamily({key:"media-track",default:{state:"loading",subscribed:!1}}),_=function(e,t){void 0===t&&(t="video");var r=v(),o=n.useMemo((function(){return e+"-"+t}),[e,t]),a=i.useRecoilValue(L(o)),u=i.useRecoilCallback((function(n){var r=n.transact_UNSTABLE;return function(n){var i=n.filter((function(t){return t.participant.session_id===e}));i.length&&r((function(e){var n=e.set,r=e.reset;i.forEach((function(e){switch(e.action){case"participant-joined":case"participant-updated":n(L(o),e.participant.tracks[t]);break;case"participant-left":r(L(o))}}))}))}}),[o,e,t]);y("participant-joined",u),y("participant-updated",u),y("participant-left",u),m("joined-meeting",i.useRecoilCallback((function(e){var n=e.set;return function(e){n(L(o),e.participants.local.tracks[t])}}),[o,t]));var s=i.useRecoilCallback((function(e){var t=e.set;return function(e){e&&t(L(o),e)}}),[o]);return n.useEffect((function(){if(r){var n=null==r?void 0:r.participants();if(n){var i=Object.values(n).find((function(t){return t.session_id===e}));i&&s(i.tracks[t])}}}),[r,e,s,t]),c({},a,{isOff:"blocked"===a.state||"off"===a.state})},T=i.atom({key:"general-camera-state",default:"pending"}),I=i.atom({key:"general-microphone-state",default:"pending"}),j=i.atom({key:"camera-devices",default:[]}),P=i.atom({key:"microphone-devices",default:[]}),A=i.atom({key:"speaker-devices",default:[]}),O=i.atom({key:"input-settings",default:null}),M=i.atom({key:"input-settings-error",default:null}),D=i.atom({key:"live-streaming",default:{errorMsg:void 0,isLiveStreaming:!1,layout:void 0}}),V=i.atom({key:"local-id",default:""}),N=function(){var e=v(),t=i.useRecoilValue(V),r=i.useRecoilCallback((function(e){var t=e.set;return function(e){e&&t(V,e)}}),[]);return n.useEffect((function(){var n;if(e&&!t){if(null==(n=e.participants())||!n.local){var i=function(e){var t,n;null!=e&&null!=(t=e.participant)&&t.local&&r(null==e||null==(n=e.participant)?void 0:n.session_id)};return e.on("participant-updated",i),function(){e.off("participant-updated",i)}}r(e.participants().local.session_id)}}),[e,r,t]),C(t)},U=i.atom({key:"topology",default:"peer"}),B=i.atom({key:"networkQuality",default:100}),F=i.atom({key:"networkThreshold",default:"good"}),q=Boolean,G=function(){return 0},W=function(e){var t=void 0===e?{filter:q,sort:G}:e,r=t.filter,o=void 0===r?q:r,a=t.onActiveSpeakerChange,c=t.onParticipantJoined,s=t.onParticipantLeft,l=t.onParticipantUpdated,f=t.sort,d=void 0===f?G:f,v=i.useRecoilValue(k),h=n.useMemo((function(){var e,t=q;switch(o){case"local":t=function(e){return e.local};break;case"owner":t=function(e){return e.owner};break;case"record":t=function(e){return e.record};break;case"remote":t=function(e){return!e.local};break;case"screen":t=function(e){return e.screen};break;default:t=o}switch(d){case"joined_at":case"session_id":case"user_id":case"user_name":e=function(e,t){return e[d]<t[d]?-1:e[d]>t[d]?1:0};break;default:e=d}return v.filter(t).sort(e).map((function(e){return e.session_id})).filter(Boolean)}),[v,o,d]);return y("participant-joined",n.useCallback((function(e){e.length&&e.forEach((function(e){return setTimeout((function(){return null==c?void 0:c(e)}),0)}))}),[c])),y("participant-updated",n.useCallback((function(e){e.length&&e.forEach((function(e){return setTimeout((function(){return null==l?void 0:l(e)}),0)}))}),[l])),y("active-speaker-change",n.useCallback(function(){var e=u(p.mark((function e(t){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:t.forEach((function(e){return setTimeout((function(){return null==a?void 0:a(e)}),0)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[a])),y("participant-left",n.useCallback((function(e){e.length&&e.forEach((function(e){return setTimeout((function(){return null==s?void 0:s(e)}),0)}))}),[s])),h},z=i.atomFamily({key:"participant-receive-settings",default:{}}),Q=i.atom({key:"recording",default:{isLocalParticipantRecorded:!1,isRecording:!1}}),Y=i.atom({key:"waiting-participants",default:[]}),J=i.atomFamily({key:"waiting-participant",default:{awaitingAccess:{level:"full"},id:"",name:""}}),$=i.selector({key:"waitingParticipantsSelector",get:function(e){var t=e.get;return t(Y).map((function(e){return t(J(e))}))}});exports.DailyProvider=function(e){var o=e.children,a=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,S),u=n.useState("callObject"in a?a.callObject:null),c=u[0],d=u[1],p=n.useRef({}),v=n.useCallback((function(e){if("action"in e)for(var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return s(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,void 0):void 0}}(e))){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(null!=(r=null==(i=p.current)||null==(o=i[e.action])?void 0:o.values())?r:[]);!(t=n()).done;){var r,i,o;(0,t.value)(e)}}),[]),h=n.useCallback((function(e){e&&Object.keys(p.current).forEach((function(t){e.off(t,v).on(t,v)}))}),[v]);n.useEffect((function(){if(!c){if("callObject"in a)return d(a.callObject),void h(a.callObject);var e=t.createCallObject(a);d(e),h(e)}}),[c,h,a]);var g=n.useCallback((function(e,t,n){var r,i;p.current[e]||(p.current[e]=new Map,c&&c.off(e,v).on(e,v)),null!=(r=p.current[e])&&r.has(n)||null==(i=p.current[e])||i.set(n,t)}),[c,v]),m=n.useCallback((function(e,t){var n,r;null==(n=p.current[e])||n.delete(t),0===(null==(r=p.current[e])?void 0:r.size)&&(null==c||c.off(e,v),delete p.current[e])}),[c,v]);return r.createElement(i.RecoilRoot,null,r.createElement(l.Provider,{value:c},r.createElement(f.Provider,{value:{on:g,off:m}},r.createElement(R,null,r.createElement(w,null,o)))))},exports.useActiveParticipant=function(e){var t=void 0===e?{}:e,r=t.ignoreLocal,o=void 0!==r&&r,a=t.onActiveSpeakerChange,u=v(),c=i.useRecoilValue(E),s=n.useState(""),l=s[1],f=C(s[0]);return n.useEffect((function(){var e;if(u){var t=null==u||null==(e=u.participants())?void 0:e.local;o&&c===(null==t?void 0:t.session_id)||l(c)}}),[u,o,c]),m("active-speaker-change",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(E,e.activeSpeaker.peerId),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a])),f},exports.useAppMessage=function(e){var t=(void 0===e?{}:e).onAppMessage,r=v(),i=n.useCallback((function(e,t){void 0===t&&(t="*"),r&&r.sendAppMessage(e,t)}),[r]),o=n.useCallback((function(e){null==t||t(e,i)}),[t,i]);return m("app-message",o),i},exports.useAudioTrack=function(e){return _(e,"audio")},exports.useDaily=v,exports.useDailyEvent=m,exports.useDevices=function(){var e=v(),t=i.useRecoilValue(T),r=i.useRecoilValue(I),o=i.useRecoilValue(j),a=i.useRecoilValue(P),s=i.useRecoilValue(A),l=i.useRecoilCallback((function(t){var n=t.transact_UNSTABLE;return u(p.mark((function t(){var r,i,o,a,u,c,s,l,f,d,v,h,g,m;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(null==(r=navigator)||null==(i=r.mediaDevices)?void 0:i.getUserMedia)&&void 0!==(null==(o=navigator)||null==(a=o.mediaDevices)?void 0:a.enumerateDevices)){t.next=3;break}return n((function(e){var t=e.set;t(T,"not-supported"),t(I,"not-supported")})),t.abrupt("return");case 3:if(e){t.next=5;break}return t.abrupt("return");case 5:return t.prev=5,t.next=8,e.enumerateDevices();case 8:return c=(u=t.sent.devices).filter((function(e){return"videoinput"===e.kind&&""!==e.deviceId})),s=u.filter((function(e){return"audioinput"===e.kind&&""!==e.deviceId})),l=u.filter((function(e){return"audiooutput"===e.kind&&""!==e.deviceId})),t.next=15,e.getInputDevices();case 15:d=(f=t.sent).camera,v=f.mic,h=f.speaker,g=function(e,t,n){var r,i;return{device:t,selected:"deviceId"in e&&t.deviceId===e.deviceId,state:null!=(r=null==(i=n.find((function(e){return e.device.deviceId===t.deviceId})))?void 0:i.state)?r:"granted"}},m=function(e,t){return"default"===e.device.deviceId?-1:"default"===t.device.deviceId?1:e.device.label<t.device.label?-1:e.device.label>t.device.label?1:0},n((function(e){var t=e.set;t(j,(function(e){return c.filter(Boolean).map((function(t){return g(d,t,e)})).sort(m)})),t(P,(function(e){return s.filter(Boolean).map((function(t){return g(v,t,e)})).sort(m)})),t(A,(function(e){return l.filter(Boolean).map((function(t){return g(h,t,e)})).sort(m)}))})),t.next=27;break;case 24:t.prev=24,t.t0=t.catch(5),n((function(e){var t=e.set;t(T,"not-supported"),t(I,"not-supported")}));case 27:case"end":return t.stop()}}),t,null,[[5,24]])})))}),[e]),f=i.useRecoilCallback((function(t){var n=t.set,r=t.snapshot,i=t.transact_UNSTABLE;return u(p.mark((function t(){var o,a,u,s,f,d,v,h,g,m,y,k,b,w,x,R,S;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,r.getPromise(T);case 4:return b=t.sent,t.next=7,r.getPromise(I);case 7:w=t.sent,x=e.participants().local.tracks,R="pending"===b&&"interrupted"===x.video.state,S="pending"===w&&"interrupted"===x.audio.state,null!=(o=x.audio)&&null!=(a=o.blocked)&&a.byDeviceInUse?i((function(e){var t=e.set;t(I,"in-use"),t(P,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"in-use"}):e}))}))})):null!=(u=x.audio)&&null!=(s=u.blocked)&&s.byDeviceMissing?n(I,"not-found"):null!=(f=x.audio)&&null!=(d=f.blocked)&&d.byPermissions?n(I,"blocked"):S||i((function(e){var t=e.set;t(I,"granted"),t(P,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"granted"}):e}))}))})),null!=(v=x.video)&&null!=(h=v.blocked)&&h.byDeviceInUse?i((function(e){var t=e.set;t(T,"in-use"),t(j,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"in-use"}):e}))}))})):null!=(g=x.video)&&null!=(m=g.blocked)&&m.byDeviceMissing?n(T,"not-found"):null!=(y=x.video)&&null!=(k=y.blocked)&&k.byPermissions?n(T,"blocked"):R||i((function(e){var t=e.set;t(T,"granted"),t(j,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"granted"}):e}))}))})),l();case 14:case"end":return t.stop()}}),t)})))}),[e,l]);m("participant-updated",n.useCallback((function(e){e.participant.local&&f()}),[f])),m("camera-error",i.useRecoilCallback((function(e){var t=e.set,n=e.transact_UNSTABLE;return function(e){var r=e.errorMsg,i=r.errorMsg,o=r.audioOk,a=r.videoOk,u=e.error;switch(null==u?void 0:u.type){case"cam-in-use":t(T,"in-use");break;case"mic-in-use":t(I,"in-use");break;case"cam-mic-in-use":n((function(e){var t=e.set;t(T,"in-use"),t(I,"in-use")}));break;default:switch(i){case"devices error":n((function(e){var t=e.set;a||t(T,"not-found"),o||t(I,"not-found")}));break;case"not allowed":n((function(e){var t=e.set;t(T,"blocked"),t(I,"blocked")})),f()}}}}),[f])),m("error",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){switch(e.errorMsg){case"not allowed":t((function(e){var t=e.set;t(T,"blocked"),t(I,"blocked")})),f()}}}),[f])),m("started-camera",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(){t((function(e){var t=e.set;t(T,"granted"),t(I,"granted")})),f()}}),[f]));var d=n.useCallback(function(){var t=u(p.mark((function t(n){return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,null==e?void 0:e.setInputDevicesAsync({videoDeviceId:n});case 2:l();case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[e,l]),h=n.useCallback(function(){var t=u(p.mark((function t(n){return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,null==e?void 0:e.setInputDevicesAsync({audioDeviceId:n});case 2:l();case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[e,l]),g=n.useCallback(function(){var t=u(p.mark((function t(n){return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null==e||e.setOutputDevice({outputDeviceId:n}),l();case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[e,l]);return{cameras:o,camState:t,hasCamError:["blocked","in-use","not-found"].includes(t),hasMicError:["blocked","in-use","not-found"].includes(r),microphones:a,micState:r,refreshDevices:l,setCamera:d,setMicrophone:h,setSpeaker:g,speakers:s}},exports.useInputSettings=function(e){var t=void 0===e?{}:e,r=t.onError,o=t.onInputSettingsUpdated,a=i.useRecoilValue(O),u=i.useRecoilValue(M),c=v(),s=i.useRecoilCallback((function(e){var t=e.set;return function(e){t(O,e)}}),[]);return n.useEffect((function(){c&&c.getInputSettings().then(s)}),[c,s]),m("input-settings-updated",n.useCallback((function(e){s(e.inputSettings),setTimeout((function(){return null==o?void 0:o(e)}),0)}),[o,s])),m("nonfatal-error",i.useRecoilCallback((function(e){var t=e.set;return function(e){"input-settings-error"===e.type&&(t(M,e.errorMsg),setTimeout((function(){return null==r?void 0:r(e)}),0))}}),[r])),{errorMsg:u,inputSettings:a,updateInputSettings:n.useCallback((function(e){null==c||c.updateInputSettings(e)}),[c])}},exports.useLiveStreaming=function(e){var t=void 0===e?{}:e,r=t.onLiveStreamingStarted,o=t.onLiveStreamingStopped,a=t.onLiveStreamingError,u=v(),s=i.useRecoilValue(D);return m("live-streaming-started",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(D,{isLiveStreaming:!0,layout:null==e?void 0:e.layout}),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[r])),m("live-streaming-stopped",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(D,(function(e){return c({},e,{isLiveStreaming:!1,layout:void 0})})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o])),m("live-streaming-error",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(D,(function(t){return c({},t,{errorMsg:e.errorMsg})})),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a])),c({},s,{startLiveStreaming:n.useCallback((function(e){u&&u.startLiveStreaming(e)}),[u]),stopLiveStreaming:n.useCallback((function(){u&&u.stopLiveStreaming()}),[u]),updateLiveStreaming:n.useCallback((function(e){u&&u.updateLiveStreaming({layout:e.layout})}),[u])})},exports.useLocalParticipant=N,exports.useMediaTrack=_,exports.useNetwork=function(e){var t=void 0===e?{}:e,r=t.onNetworkConnection,o=t.onNetworkQualityChange,a=v(),c=i.useRecoilValue(U),s=i.useRecoilValue(B),l=i.useRecoilValue(F),f=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;switch(e.event){case"connected":"peer-to-peer"===e.type&&n(U,"peer"),"sfu"===e.type&&n(U,"sfu")}})),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[r]),d=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;n(B,(function(t){return t!==e.quality?e.quality:t})),n(F,(function(t){return t!==e.threshold?e.threshold:t}))})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o]);return m("network-connection",f),m("network-quality-change",d),{getStats:n.useCallback(u(p.mark((function e(){var t;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==a?void 0:a.getNetworkStats();case 2:return e.abrupt("return",null==(t=e.sent)?void 0:t.stats);case 4:case"end":return e.stop()}}),e)}))),[a]),quality:s,threshold:l,topology:c}},exports.useParticipant=C,exports.useParticipantIds=W,exports.useReceiveSettings=function(e){var t=void 0===e?{}:e,r=t.id,o=void 0===r?"base":r,a=t.onReceiveSettingsUpdated,u=i.useRecoilValue(z("base")),s=i.useRecoilValue(z(o)),l=v();m("receive-settings-updated",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){for(var n=t.set,r=t.reset,i=c({},e.receiveSettings),a=0,u=Object.entries(i);a<u.length;a++){var s=u[a],l=s[1];n(z(s[0]),l)}o in i||r(z(o))})),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[o,a]));var f=n.useCallback((function(e){l&&"joined-meeting"===l.meetingState()&&(null==l||null==l.updateReceiveSettings||l.updateReceiveSettings(e))}),[l]);return{receiveSettings:"base"===o||0===Object.keys(s).length?u:s,updateReceiveSettings:f}},exports.useRecording=function(e){var t=void 0===e?{}:e,r=t.onRecordingStarted,o=t.onRecordingStopped,a=t.onRecordingError,u=t.onRecordingData,s=v(),l=i.useRecoilValue(Q),f=i.useSetRecoilState(Q),d=N(),p=W({filter:"record"});return n.useEffect((function(){var e,t=p.length>0,n=p.includes(null!=(e=null==d?void 0:d.session_id)?e:"local");f((function(e){return c({},e,{isLocalParticipantRecorded:"local"!==(null==e?void 0:e.type)&&null!=e&&e.type?e.isLocalParticipantRecorded:t,isRecording:"local"!==(null==e?void 0:e.type)&&null!=e&&e.type?e.isRecording:t,local:"local"!==(null==e?void 0:e.type)&&null!=e&&e.type||!t?null==e?void 0:e.local:n,type:t?"local":null==e?void 0:e.type})}))}),[null==d?void 0:d.session_id,p,f]),m("recording-started",i.useRecoilCallback((function(e){var t=e.set;return function(e){var n=!0;switch(e.type){case"cloud-beta":case"cloud":var i;d&&"single-participant"===(null==(i=e.layout)?void 0:i.preset)&&e.layout.session_id!==(null==d?void 0:d.session_id)&&(n=!1)}t(Q,{error:!1,isLocalParticipantRecorded:n,isRecording:!0,layout:null==e?void 0:e.layout,local:null==e?void 0:e.local,recordingId:null==e?void 0:e.recordingId,recordingStartedDate:new Date,startedBy:null==e?void 0:e.startedBy,type:null==e?void 0:e.type}),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[d,r])),m("recording-stopped",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(Q,(function(e){return c({},e,{isLocalParticipantRecorded:!1,isRecording:!1})})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o])),m("recording-error",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(Q,(function(e){return c({},e,{error:!0,isLocalParticipantRecorded:!1,isRecording:!1})})),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a])),m("recording-data",n.useCallback((function(e){null==u||u(e)}),[u])),c({},l,{startRecording:n.useCallback((function(e){s&&s.startRecording(e)}),[s]),stopRecording:n.useCallback((function(){s&&s.stopRecording()}),[s]),updateRecording:n.useCallback((function(e){s&&s.updateRecording(e)}),[s])})},exports.useRoom=function(){return i.useRecoilValue(x)},exports.useScreenAudioTrack=function(e){return _(e,"screenAudio")},exports.useScreenShare=function(e){var t=void 0===e?{}:e,r=t.onLocalScreenShareStarted,i=t.onLocalScreenShareStopped,o=v(),a=n.useCallback((function(e){null==o||o.startScreenShare(e)}),[o]),u=n.useCallback((function(){null==o||o.stopScreenShare()}),[o]);m("local-screen-share-started",n.useCallback((function(){return null==r?void 0:r()}),[r])),m("local-screen-share-stopped",n.useCallback((function(){return null==i?void 0:i()}),[i]));var c=W({filter:"screen"}),s=n.useMemo((function(){return c.map((function(e){var t,n=Object.values(null!=(t=null==o||null==o.participants?void 0:o.participants())?t:{}).find((function(t){return t.session_id===e}));if(n)return{local:n.local,screenAudio:n.tracks.screenAudio,screenVideo:n.tracks.screenVideo,screenId:e+"-screen",session_id:e}})).filter((function(e){return!!e}))}),[o,c]);return{isSharingScreen:s.some((function(e){return e.local})),screens:s,startScreenShare:a,stopScreenShare:u}},exports.useScreenVideoTrack=function(e){return _(e,"screenVideo")},exports.useThrottledDailyEvent=y,exports.useVideoTrack=function(e){return _(e,"video")},exports.useWaitingParticipants=function(e){var t=void 0===e?{}:e,r=t.onWaitingParticipantAdded,o=t.onWaitingParticipantRemoved,a=t.onWaitingParticipantUpdated,u=v(),c=i.useRecoilValue($),s=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;n(Y,(function(t){return t.includes(e.participant.id)?t:[].concat(t,[e.participant.id])})),n(J(e.participant.id),e.participant)})),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[r]),l=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.reset;(0,t.set)(Y,(function(t){return t.filter((function(t){return t!==e.participant.id}))})),n(J(e.participant.id))})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o]),f=i.useRecoilCallback((function(e){var t=e.set;return function(e){t(J(e.participant.id),e.participant),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a]);m("waiting-participant-added",s),m("waiting-participant-removed",l),m("waiting-participant-updated",f);var d=n.useCallback((function(e,t){"*"!==e?null==u||u.updateWaitingParticipant(e,{grantRequestedAccess:t}):null==u||u.updateWaitingParticipants({"*":{grantRequestedAccess:t}})}),[u]);return{waitingParticipants:c,grantAccess:n.useCallback((function(e){d(e,!0)}),[d]),denyAccess:n.useCallback((function(e){d(e,!1)}),[d])}};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@daily-co/daily-js")),n=require("react"),r=e(n),i=require("recoil"),o=e(require("lodash.throttle"));function a(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function u(e){a(o,r,i,u,c,"next",e)}function c(e){a(o,r,i,u,c,"throw",e)}u(void 0)}))}}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=n.createContext(null),f=n.createContext({on:function(){},off:function(){}});function d(e,t){return e(t={exports:{}},t.exports),t.exports}var p=d((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(e,t,n,r){var i=Object.create((t&&t.prototype instanceof s?t:s).prototype),o=new S(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=k(a,n);if(u){if(u===l)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(e,n,o),i}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={};function s(){}function f(){}function d(){}var p={};p[i]=function(){return this};var v=Object.getPrototypeOf,h=v&&v(v(x([])));h&&h!==t&&n.call(h,i)&&(p=h);var g=d.prototype=s.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function y(e,t){var r;this._invoke=function(i,o){function a(){return new t((function(r,a){!function r(i,o,a,u){var l=c(e[i],e,o);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,u)}))}u(l.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function k(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(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 w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function x(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=g.constructor=d,d.constructor=f,d[a]=f.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(y.prototype),y.prototype[o]=function(){return this},e.AsyncIterator=y,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new y(u(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),g[a]="Generator",g[i]=function(){return this},g.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=x,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.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,l):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),l},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),w(n),l}},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;w(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),v=function(){return n.useContext(s)},h=0,g=function(){return h++},m=function(e,t){var r=n.useContext(f),i=r.on,o=r.off,a=n.useState(!1),u=a[0],c=a[1],l=n.useRef(0),s=n.useMemo((function(){return g()}),[]);n.useEffect((function(){if(e&&!u){if(l.current>1e5)return console.error("useDailyEvent called with potentially non-memoized event callback or due to too many re-renders.\n Memoize using useCallback to avoid re-render loop or reduce the amount of state transitions the callback depends on.\n Passed callback for '"+e+"' event is NOT registered.",t),void c(!0);l.current++;var n=setTimeout((function(){l.current=0}),50);return i(e,t,s),function(){clearTimeout(n),o(e,s)}}}),[t,e,s,u,o,i])},y=function(e,t,r){void 0===r&&(r=100);var i=n.useContext(f),a=i.on,u=i.off,c=n.useMemo((function(){return g()}),[]),l=n.useRef([]),s=n.useMemo((function(){return o((function(){0!==l.current.length&&(t(l.current),l.current=[])}),r,{trailing:!0})}),[t,r]);n.useEffect((function(){if(e)return a(e,(function(e){l.current.push(e),setTimeout(s,0)}),c),function(){u(e,c)}}),[s,e,c,u,a])},k=i.atom({key:"participants-objects",default:[]}),b=i.selectorFamily({key:"participant",get:function(e){return function(t){var n;return null!=(n=(0,t.get)(k).find((function(t){return t.session_id===e})))?n:null}}}),w=function(e){var t=e.children,o=v();m("active-speaker-change",i.useRecoilCallback((function(e){var t=e.set,n=e.snapshot;return function(){var e=u(p.mark((function e(r){var i,a;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.activeSpeaker.peerId,e.next=3,n.getPromise(b(i));case 3:if(!(a=e.sent)&&o&&(a=o.participants()[i]),a){e.next=7;break}return e.abrupt("return");case 7:t(k,(function(e){return[].concat(e).map((function(e){return e.session_id===i?c({},e,{last_active:new Date}):e}))}));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[o]));var a=i.useRecoilCallback((function(e){var t=e.set;return function(){var e=u(p.mark((function e(n){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t(k,(function(e){return[].concat(e,Object.values(n)).filter((function(e,t,n){return n.findIndex((function(t){return t.session_id===e.session_id}))==t}))}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[]);return n.useEffect((function(){if(o){var e=setInterval((function(){var t=o.participants();"local"in t&&(a(t),clearInterval(e))}),100);return function(){clearInterval(e)}}}),[o,a]),m("joined-meeting",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(k,(function(t){return t.some((function(e){return e.local}))?[].concat(t).map((function(t){return t.local?e.participants.local:t})):[].concat(t,[e.participants.local])}))}}))),y("participant-joined",i.useRecoilCallback((function(e){var t=e.set;return function(){var e=u(p.mark((function e(n){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.length){e.next=2;break}return e.abrupt("return");case 2:t(k,(function(e){return[].concat(e,n.map((function(e){return e.participant}))).filter((function(e,t,n){return n.findIndex((function(t){return t.session_id===e.session_id}))==t}))}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[])),y("participant-updated",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;e.forEach((function(e){var t=e.participant;n(k,(function(e){return[].concat(e).map((function(e){return e.session_id===t.session_id?t:e}))}))}))}))}}),[])),y("participant-left",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(k,(function(t){return[].concat(t).filter((function(t){return!e.some((function(e){return e.participant.session_id===t.session_id}))}))}))}}),[])),r.createElement(r.Fragment,null,t)},S=i.atom({key:"room",default:null}),x=function(e){var t=e.children,n=v(),o=i.useRecoilCallback((function(e){var t=e.set;return u(p.mark((function e(){var r;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n&&"left-meeting"!==n.meetingState()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,n.room();case 4:return(r=e.sent)&&"id"in r&&t(S,r),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e)})))}),[n]);return m("access-state-updated",o),r.createElement(r.Fragment,null,t)},R=["children"],C=function(e,t){var r=void 0===t?{}:t,o=r.onParticipantLeft,a=r.onParticipantUpdated,u=i.useRecoilValue(b(e));return y("participant-updated",n.useCallback((function(t){var n=t.filter((function(t){return t.participant.session_id===e}));n.length&&n.forEach((function(e){setTimeout((function(){return null==a?void 0:a(e)}),0)}))}),[a,e])),y("participant-left",n.useCallback((function(t){if(t.filter((function(t){return t.participant.session_id===e})).length){var n=t[t.length-1];setTimeout((function(){return null==o?void 0:o(n)}),0)}}),[o,e])),u},E=i.atom({key:"active-id",default:""}),L=i.atomFamily({key:"media-track",default:{state:"loading",subscribed:!1}}),_=function(e,t){void 0===t&&(t="video");var r=v(),o=n.useMemo((function(){return e+"-"+t}),[e,t]),a=i.useRecoilValue(L(o)),u=i.useRecoilCallback((function(n){var r=n.transact_UNSTABLE;return function(n){var i=n.filter((function(t){return t.participant.session_id===e}));i.length&&r((function(e){var n=e.set,r=e.reset;i.forEach((function(e){switch(e.action){case"participant-joined":case"participant-updated":n(L(o),e.participant.tracks[t]);break;case"participant-left":r(L(o))}}))}))}}),[o,e,t]);y("participant-joined",u),y("participant-updated",u),y("participant-left",u),m("joined-meeting",i.useRecoilCallback((function(e){var n=e.set;return function(e){n(L(o),e.participants.local.tracks[t])}}),[o,t]));var l=i.useRecoilCallback((function(e){var t=e.set;return function(e){e&&t(L(o),e)}}),[o]);return n.useEffect((function(){if(r){var n=null==r?void 0:r.participants();if(n){var i=Object.values(n).find((function(t){return t.session_id===e}));i&&l(i.tracks[t])}}}),[r,e,l,t]),c({},a,{isOff:"blocked"===a.state||"off"===a.state})},T=i.atom({key:"general-camera-state",default:"pending"}),P=i.atom({key:"general-microphone-state",default:"pending"}),j=i.atom({key:"camera-devices",default:[]}),I=i.atom({key:"microphone-devices",default:[]}),A=i.atom({key:"speaker-devices",default:[]}),O=i.atom({key:"input-settings",default:null}),M=i.atom({key:"input-settings-error",default:null}),D=i.atom({key:"live-streaming",default:{errorMsg:void 0,isLiveStreaming:!1,layout:void 0}}),V=i.atom({key:"local-id",default:""}),N=function(){var e=v(),t=i.useRecoilValue(V),r=i.useRecoilCallback((function(e){var t=e.set;return function(e){e&&t(V,e)}}),[]);return n.useEffect((function(){var n;if(e&&!t){if(null==(n=e.participants())||!n.local){var i=function(e){var t,n;null!=e&&null!=(t=e.participant)&&t.local&&r(null==e||null==(n=e.participant)?void 0:n.session_id)};return e.on("participant-updated",i),function(){e.off("participant-updated",i)}}r(e.participants().local.session_id)}}),[e,r,t]),C(t)},U=i.atom({key:"topology",default:"peer"}),B=i.atom({key:"networkQuality",default:100}),F=i.atom({key:"networkThreshold",default:"good"}),q=Boolean,G=function(){return 0},W=function(e){var t=void 0===e?{filter:q,sort:G}:e,r=t.filter,o=void 0===r?q:r,a=t.onActiveSpeakerChange,c=t.onParticipantJoined,l=t.onParticipantLeft,s=t.onParticipantUpdated,f=t.sort,d=void 0===f?G:f,v=i.useRecoilValue(k),h=n.useMemo((function(){var e,t=q;switch(o){case"local":t=function(e){return e.local};break;case"owner":t=function(e){return e.owner};break;case"record":t=function(e){return e.record};break;case"remote":t=function(e){return!e.local};break;case"screen":t=function(e){return e.screen};break;default:t=o}switch(d){case"joined_at":case"session_id":case"user_id":case"user_name":e=function(e,t){return e[d]<t[d]?-1:e[d]>t[d]?1:0};break;default:e=d}return v.filter(t).sort(e).map((function(e){return e.session_id})).filter(Boolean)}),[v,o,d]);return y("participant-joined",n.useCallback((function(e){e.length&&e.forEach((function(e){return setTimeout((function(){return null==c?void 0:c(e)}),0)}))}),[c])),y("participant-updated",n.useCallback((function(e){e.length&&e.forEach((function(e){return setTimeout((function(){return null==s?void 0:s(e)}),0)}))}),[s])),y("active-speaker-change",n.useCallback(function(){var e=u(p.mark((function e(t){return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length){e.next=2;break}return e.abrupt("return");case 2:t.forEach((function(e){return setTimeout((function(){return null==a?void 0:a(e)}),0)}));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[a])),y("participant-left",n.useCallback((function(e){e.length&&e.forEach((function(e){return setTimeout((function(){return null==l?void 0:l(e)}),0)}))}),[l])),h},z=i.atomFamily({key:"participant-receive-settings",default:{}}),Q=i.atom({key:"recording",default:{isLocalParticipantRecorded:!1,isRecording:!1}}),Y=i.atom({key:"waiting-participants",default:[]}),J=i.atomFamily({key:"waiting-participant",default:{awaitingAccess:{level:"full"},id:"",name:""}}),$=i.selector({key:"waitingParticipantsSelector",get:function(e){var t=e.get;return t(Y).map((function(e){return t(J(e))}))}});exports.DailyProvider=function(e){var o=e.children,a=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,R),u=n.useState("callObject"in a?a.callObject:null),c=u[0],d=u[1],p=n.useRef({}),v=n.useCallback((function(e){if("action"in e)for(var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,void 0):void 0}}(e))){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(null!=(r=null==(i=p.current)||null==(o=i[e.action])?void 0:o.values())?r:[]);!(t=n()).done;){var r,i,o;(0,t.value)(e)}}),[]),h=n.useCallback((function(e){e&&Object.keys(p.current).forEach((function(t){e.off(t,v).on(t,v)}))}),[v]);n.useEffect((function(){if(!c){if("callObject"in a)return d(a.callObject),void h(a.callObject);var e=t.createCallObject(a);d(e),h(e)}}),[c,h,a]);var g=n.useCallback((function(e,t,n){var r,i;p.current[e]||(p.current[e]=new Map,c&&c.off(e,v).on(e,v)),null!=(r=p.current[e])&&r.has(n)||null==(i=p.current[e])||i.set(n,t)}),[c,v]),m=n.useCallback((function(e,t){var n,r;null==(n=p.current[e])||n.delete(t),0===(null==(r=p.current[e])?void 0:r.size)&&(null==c||c.off(e,v),delete p.current[e])}),[c,v]);return r.createElement(i.RecoilRoot,null,r.createElement(s.Provider,{value:c},r.createElement(f.Provider,{value:{on:g,off:m}},r.createElement(x,null,r.createElement(w,null,o)))))},exports.useActiveParticipant=function(e){var t=void 0===e?{}:e,r=t.ignoreLocal,o=void 0!==r&&r,a=t.onActiveSpeakerChange,u=v(),c=i.useRecoilValue(E),l=n.useState(""),s=l[1],f=C(l[0]);return n.useEffect((function(){var e;if(u){var t=null==u||null==(e=u.participants())?void 0:e.local;o&&c===(null==t?void 0:t.session_id)||s(c)}}),[u,o,c]),m("active-speaker-change",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(E,e.activeSpeaker.peerId),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a])),f},exports.useAppMessage=function(e){var t=(void 0===e?{}:e).onAppMessage,r=v(),i=n.useCallback((function(e,t){void 0===t&&(t="*"),r&&r.sendAppMessage(e,t)}),[r]),o=n.useCallback((function(e){null==t||t(e,i)}),[t,i]);return m("app-message",o),i},exports.useAudioTrack=function(e){return _(e,"audio")},exports.useDaily=v,exports.useDailyEvent=m,exports.useDevices=function(){var e=v(),t=i.useRecoilValue(T),r=i.useRecoilValue(P),o=i.useRecoilValue(j),a=i.useRecoilValue(I),l=i.useRecoilValue(A),s=i.useRecoilCallback((function(t){var n=t.transact_UNSTABLE;return u(p.mark((function t(){var r,i,o,a,u,c,l,s,f,d,v,h,g,m;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(null==(r=navigator)||null==(i=r.mediaDevices)?void 0:i.getUserMedia)&&void 0!==(null==(o=navigator)||null==(a=o.mediaDevices)?void 0:a.enumerateDevices)){t.next=3;break}return n((function(e){var t=e.set;t(T,"not-supported"),t(P,"not-supported")})),t.abrupt("return");case 3:if(e){t.next=5;break}return t.abrupt("return");case 5:return t.prev=5,t.next=8,e.enumerateDevices();case 8:return c=(u=t.sent.devices).filter((function(e){return"videoinput"===e.kind&&""!==e.deviceId})),l=u.filter((function(e){return"audioinput"===e.kind&&""!==e.deviceId})),s=u.filter((function(e){return"audiooutput"===e.kind&&""!==e.deviceId})),t.next=15,e.getInputDevices();case 15:d=(f=t.sent).camera,v=f.mic,h=f.speaker,g=function(e,t,n){var r,i;return{device:t,selected:"deviceId"in e&&t.deviceId===e.deviceId,state:null!=(r=null==(i=n.find((function(e){return e.device.deviceId===t.deviceId})))?void 0:i.state)?r:"granted"}},m=function(e,t){return"default"===e.device.deviceId?-1:"default"===t.device.deviceId?1:e.device.label<t.device.label?-1:e.device.label>t.device.label?1:0},n((function(e){var t=e.set;t(j,(function(e){return c.filter(Boolean).map((function(t){return g(d,t,e)})).sort(m)})),t(I,(function(e){return l.filter(Boolean).map((function(t){return g(v,t,e)})).sort(m)})),t(A,(function(e){return s.filter(Boolean).map((function(t){return g(h,t,e)})).sort(m)}))})),t.next=27;break;case 24:t.prev=24,t.t0=t.catch(5),n((function(e){var t=e.set;t(T,"not-supported"),t(P,"not-supported")}));case 27:case"end":return t.stop()}}),t,null,[[5,24]])})))}),[e]),f=i.useRecoilCallback((function(t){var n=t.set,r=t.snapshot,i=t.transact_UNSTABLE;return u(p.mark((function t(){var o,a,u,l,f,d,v,h,g,m,y,k,b,w,S,x,R;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,r.getPromise(T);case 4:return b=t.sent,t.next=7,r.getPromise(P);case 7:w=t.sent,S=e.participants().local.tracks,x="pending"===b&&"interrupted"===S.video.state,R="pending"===w&&"interrupted"===S.audio.state,null!=(o=S.audio)&&null!=(a=o.blocked)&&a.byDeviceInUse?i((function(e){var t=e.set;t(P,"in-use"),t(I,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"in-use"}):e}))}))})):null!=(u=S.audio)&&null!=(l=u.blocked)&&l.byDeviceMissing?n(P,"not-found"):null!=(f=S.audio)&&null!=(d=f.blocked)&&d.byPermissions?n(P,"blocked"):R||i((function(e){var t=e.set;t(P,"granted"),t(I,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"granted"}):e}))}))})),null!=(v=S.video)&&null!=(h=v.blocked)&&h.byDeviceInUse?i((function(e){var t=e.set;t(T,"in-use"),t(j,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"in-use"}):e}))}))})):null!=(g=S.video)&&null!=(m=g.blocked)&&m.byDeviceMissing?n(T,"not-found"):null!=(y=S.video)&&null!=(k=y.blocked)&&k.byPermissions?n(T,"blocked"):x||i((function(e){var t=e.set;t(T,"granted"),t(j,(function(e){return e.map((function(e){return e.selected?c({},e,{state:"granted"}):e}))}))})),s();case 14:case"end":return t.stop()}}),t)})))}),[e,s]);m("participant-updated",n.useCallback((function(e){e.participant.local&&f()}),[f])),m("camera-error",i.useRecoilCallback((function(e){var t=e.set,n=e.transact_UNSTABLE;return function(e){var r=e.errorMsg,i=r.errorMsg,o=r.audioOk,a=r.videoOk,u=e.error;switch(null==u?void 0:u.type){case"cam-in-use":t(T,"in-use");break;case"mic-in-use":t(P,"in-use");break;case"cam-mic-in-use":n((function(e){var t=e.set;t(T,"in-use"),t(P,"in-use")}));break;default:switch(i){case"devices error":n((function(e){var t=e.set;a||t(T,"not-found"),o||t(P,"not-found")}));break;case"not allowed":n((function(e){var t=e.set;t(T,"blocked"),t(P,"blocked")})),f()}}}}),[f])),m("error",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){switch(e.errorMsg){case"not allowed":t((function(e){var t=e.set;t(T,"blocked"),t(P,"blocked")})),f()}}}),[f])),m("started-camera",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(){t((function(e){var t=e.set;t(T,"granted"),t(P,"granted")})),f()}}),[f]));var d=n.useCallback(function(){var t=u(p.mark((function t(n){return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,null==e?void 0:e.setInputDevicesAsync({videoDeviceId:n});case 2:s();case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[e,s]),h=n.useCallback(function(){var t=u(p.mark((function t(n){return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,null==e?void 0:e.setInputDevicesAsync({audioDeviceId:n});case 2:s();case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[e,s]),g=n.useCallback(function(){var t=u(p.mark((function t(n){return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null==e||e.setOutputDevice({outputDeviceId:n}),s();case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),[e,s]);return{cameras:o,camState:t,hasCamError:["blocked","in-use","not-found"].includes(t),hasMicError:["blocked","in-use","not-found"].includes(r),microphones:a,micState:r,refreshDevices:s,setCamera:d,setMicrophone:h,setSpeaker:g,speakers:l}},exports.useInputSettings=function(e){var t=void 0===e?{}:e,r=t.onError,o=t.onInputSettingsUpdated,a=i.useRecoilValue(O),u=i.useRecoilValue(M),c=v(),l=i.useRecoilCallback((function(e){var t=e.set;return function(e){t(O,e)}}),[]);return n.useEffect((function(){c&&c.getInputSettings().then(l)}),[c,l]),m("input-settings-updated",n.useCallback((function(e){l(e.inputSettings),setTimeout((function(){return null==o?void 0:o(e)}),0)}),[o,l])),m("nonfatal-error",i.useRecoilCallback((function(e){var t=e.set;return function(e){"input-settings-error"===e.type&&(t(M,e.errorMsg),setTimeout((function(){return null==r?void 0:r(e)}),0))}}),[r])),{errorMsg:u,inputSettings:a,updateInputSettings:n.useCallback((function(e){null==c||c.updateInputSettings(e)}),[c])}},exports.useLiveStreaming=function(e){var t=void 0===e?{}:e,r=t.onLiveStreamingStarted,o=t.onLiveStreamingStopped,a=t.onLiveStreamingError,u=v(),l=i.useRecoilValue(D);return m("live-streaming-started",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(D,{isLiveStreaming:!0,layout:null==e?void 0:e.layout}),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[r])),m("live-streaming-stopped",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(D,(function(e){return c({},e,{isLiveStreaming:!1,layout:void 0})})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o])),m("live-streaming-error",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(D,(function(t){return c({},t,{errorMsg:e.errorMsg})})),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a])),c({},l,{startLiveStreaming:n.useCallback((function(e){u&&u.startLiveStreaming(e)}),[u]),stopLiveStreaming:n.useCallback((function(){u&&u.stopLiveStreaming()}),[u]),updateLiveStreaming:n.useCallback((function(e){u&&u.updateLiveStreaming({layout:e.layout})}),[u])})},exports.useLocalParticipant=N,exports.useMediaTrack=_,exports.useNetwork=function(e){var t=void 0===e?{}:e,r=t.onNetworkConnection,o=t.onNetworkQualityChange,a=v(),c=i.useRecoilValue(U),l=i.useRecoilValue(B),s=i.useRecoilValue(F),f=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;switch(e.event){case"connected":"peer-to-peer"===e.type&&n(U,"peer"),"sfu"===e.type&&n(U,"sfu")}})),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[r]),d=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;n(B,(function(t){return t!==e.quality?e.quality:t})),n(F,(function(t){return t!==e.threshold?e.threshold:t}))})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o]);return m("network-connection",f),m("network-quality-change",d),{getStats:n.useCallback(u(p.mark((function e(){var t;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null==a?void 0:a.getNetworkStats();case 2:return e.abrupt("return",null==(t=e.sent)?void 0:t.stats);case 4:case"end":return e.stop()}}),e)}))),[a]),quality:l,threshold:s,topology:c}},exports.useParticipant=C,exports.useParticipantIds=W,exports.useReceiveSettings=function(e){var t=void 0===e?{}:e,r=t.id,o=void 0===r?"base":r,a=t.onReceiveSettingsUpdated,u=i.useRecoilValue(z("base")),l=i.useRecoilValue(z(o)),s=v();m("receive-settings-updated",i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){for(var n=t.set,r=t.reset,i=c({},e.receiveSettings),a=0,u=Object.entries(i);a<u.length;a++){var l=u[a],s=l[1];n(z(l[0]),s)}o in i||r(z(o))})),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[o,a]));var f=n.useCallback((function(e){s&&"joined-meeting"===s.meetingState()&&(null==s||null==s.updateReceiveSettings||s.updateReceiveSettings(e))}),[s]);return{receiveSettings:"base"===o||0===Object.keys(l).length?u:l,updateReceiveSettings:f}},exports.useRecording=function(e){var t=void 0===e?{}:e,r=t.onRecordingStarted,o=t.onRecordingStopped,a=t.onRecordingError,u=t.onRecordingData,l=v(),s=i.useRecoilValue(Q),f=i.useSetRecoilState(Q),d=N(),p=W({filter:"record"});return n.useEffect((function(){var e,t=p.length>0,n=p.includes(null!=(e=null==d?void 0:d.session_id)?e:"local");f((function(e){return c({},e,{isLocalParticipantRecorded:"local"!==(null==e?void 0:e.type)&&null!=e&&e.type?e.isLocalParticipantRecorded:t,isRecording:"local"!==(null==e?void 0:e.type)&&null!=e&&e.type?e.isRecording:t,local:"local"!==(null==e?void 0:e.type)&&null!=e&&e.type||!t?null==e?void 0:e.local:n,type:t?"local":null==e?void 0:e.type})}))}),[null==d?void 0:d.session_id,p,f]),m("recording-started",i.useRecoilCallback((function(e){var t=e.set;return function(e){var n=!0;switch(e.type){case"cloud-beta":case"cloud":var i;d&&"single-participant"===(null==(i=e.layout)?void 0:i.preset)&&e.layout.session_id!==(null==d?void 0:d.session_id)&&(n=!1)}t(Q,{error:!1,isLocalParticipantRecorded:n,isRecording:!0,layout:null==e?void 0:e.layout,local:null==e?void 0:e.local,recordingId:null==e?void 0:e.recordingId,recordingStartedDate:new Date,startedBy:null==e?void 0:e.startedBy,type:null==e?void 0:e.type}),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[d,r])),m("recording-stopped",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(Q,(function(e){return c({},e,{isLocalParticipantRecorded:!1,isRecording:!1})})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o])),m("recording-error",i.useRecoilCallback((function(e){var t=e.set;return function(e){t(Q,(function(e){return c({},e,{error:!0,isLocalParticipantRecorded:!1,isRecording:!1})})),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a])),m("recording-data",n.useCallback((function(e){null==u||u(e)}),[u])),c({},s,{startRecording:n.useCallback((function(e){l&&l.startRecording(e)}),[l]),stopRecording:n.useCallback((function(){l&&l.stopRecording()}),[l]),updateRecording:n.useCallback((function(e){l&&l.updateRecording(e)}),[l])})},exports.useRoom=function(){return i.useRecoilValue(S)},exports.useScreenAudioTrack=function(e){return _(e,"screenAudio")},exports.useScreenShare=function(e){var t=void 0===e?{}:e,r=t.onLocalScreenShareStarted,i=t.onLocalScreenShareStopped,o=v(),a=n.useCallback((function(e){null==o||o.startScreenShare(e)}),[o]),u=n.useCallback((function(){null==o||o.stopScreenShare()}),[o]);m("local-screen-share-started",n.useCallback((function(){return null==r?void 0:r()}),[r])),m("local-screen-share-stopped",n.useCallback((function(){return null==i?void 0:i()}),[i]));var c=W({filter:"screen"}),l=n.useMemo((function(){return c.map((function(e){var t,n=Object.values(null!=(t=null==o||null==o.participants?void 0:o.participants())?t:{}).find((function(t){return t.session_id===e}));if(n)return{local:n.local,screenAudio:n.tracks.screenAudio,screenVideo:n.tracks.screenVideo,screenId:e+"-screen",session_id:e}})).filter((function(e){return!!e}))}),[o,c]);return{isSharingScreen:l.some((function(e){return e.local})),screens:l,startScreenShare:a,stopScreenShare:u}},exports.useScreenVideoTrack=function(e){return _(e,"screenVideo")},exports.useThrottledDailyEvent=y,exports.useVideoTrack=function(e){return _(e,"video")},exports.useWaitingParticipants=function(e){var t=void 0===e?{}:e,r=t.onWaitingParticipantAdded,o=t.onWaitingParticipantRemoved,a=t.onWaitingParticipantUpdated,u=v(),c=i.useRecoilValue($),l=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.set;n(Y,(function(t){return t.includes(e.participant.id)?t:[].concat(t,[e.participant.id])})),n(J(e.participant.id),e.participant)})),setTimeout((function(){return null==r?void 0:r(e)}),0)}}),[r]),s=i.useRecoilCallback((function(e){var t=e.transact_UNSTABLE;return function(e){t((function(t){var n=t.reset;(0,t.set)(Y,(function(t){return t.filter((function(t){return t!==e.participant.id}))})),n(J(e.participant.id))})),setTimeout((function(){return null==o?void 0:o(e)}),0)}}),[o]),f=i.useRecoilCallback((function(e){var t=e.set;return function(e){t(J(e.participant.id),e.participant),setTimeout((function(){return null==a?void 0:a(e)}),0)}}),[a]);m("waiting-participant-added",l),m("waiting-participant-removed",s),m("waiting-participant-updated",f);var d=n.useCallback((function(e,t){"*"!==e?null==u||u.updateWaitingParticipant(e,{grantRequestedAccess:t}):null==u||u.updateWaitingParticipants({"*":{grantRequestedAccess:t}})}),[u]);return{waitingParticipants:c,grantAccess:n.useCallback((function(e){d(e,!0)}),[d]),denyAccess:n.useCallback((function(e){d(e,!1)}),[d])}};
//# sourceMappingURL=daily-react-hooks.cjs.production.min.js.map

@@ -1,4 +0,4 @@

import { DailyPendingRoomInfo, DailyRoomInfo } from '@daily-co/daily-js';
import { DailyRoomInfo } from '@daily-co/daily-js';
import React from 'react';
export declare const roomState: import("recoil").RecoilState<DailyPendingRoomInfo | DailyRoomInfo | null>;
export declare const roomState: import("recoil").RecoilState<DailyRoomInfo | null>;
export declare const DailyRoom: React.FC;

@@ -0,1 +1,2 @@

import { DailyRoomInfo } from '@daily-co/daily-js';
/**

@@ -5,2 +6,2 @@ * Stateful hook to work with room, domain and token configuration for a daily room.

*/
export declare const useRoom: () => import("@daily-co/daily-js").DailyPendingRoomInfo | import("@daily-co/daily-js").DailyRoomInfo | null;
export declare const useRoom: () => DailyRoomInfo | null;
{
"version": "0.2.1",
"version": "0.2.2",
"license": "BSD-2-Clause",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -0,1 +1,2 @@

import { DailyRoomInfo } from '@daily-co/daily-js';
import { useRecoilValue } from 'recoil';

@@ -9,5 +10,5 @@

*/
export const useRoom = () => {
export const useRoom = (): DailyRoomInfo | null => {
const room = useRecoilValue(roomState);
return room;
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc