!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.initLayoutContainer=e():t.initLayoutContainer=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e,i){"use strict";e.__esModule=!0;var o=function(t,e,i,o,n,a,r,h){for(var d,f,l,s,g,c,u,v,p=1;p<=n;p+=1){var m=p,b=Math.ceil(n/m);(v=(u=Math.floor(o/b))/(c=Math.floor(i/m)))>e?u=c*(v=e):v<t&&(c=u/(v=t));var w=(c=Math.min(a,c))*(u=Math.min(r,u))*n;if(void 0===d||w>=d){if(h&&w===d&&m*b%n>l*f%n)continue;d=w,s=u,g=c,f=m,l=b}}return{maxArea:d,targetCols:f,targetRows:l,targetHeight:s,targetWidth:g,ratio:s/g}},n=function(t,e){var i,n=t.maxRatio,a=t.minRatio,r=t.fixedRatio,h=t.containerWidth,d=t.containerHeight,f=t.offsetLeft,l=void 0===f?0:f,s=t.offsetTop,g=void 0===s?0:s,c=t.alignItems,u=void 0===c?"center":c,v=t.maxWidth,p=void 0===v?1/0:v,m=t.maxHeight,b=void 0===m?1/0:m,w=t.scaleLastRow,x=void 0===w||w,y=t.evenRows,R=void 0===y||y,M=e.map((function(t){return t.height/t.width})),H=M.length;if(r){var W=M.length>0?M[0]:null;i=o(W,W,h,d,H,p,b,R)}else i=o(a,n,h,d,H,p,b,R);for(var L,_=0,O=0,j=[],T=[],I=0;I<M.length;I+=1){I%i.targetCols==0&&(L={ratios:[],elements:[],width:0,height:0},j.push(L));W=M[I];var S=e[I];L.elements.push(S),L.ratios.push(W);var A=i.targetWidth,C=i.targetHeight;(r||S.fixedRatio)&&(A=C/W),L.width+=A,L.height=C}var P=0,E=0;for(I=0;I<j.length;I+=1)(L=j[I]).width>h?(L.height=Math.floor(L.height*(h/L.width)),L.width=h):L.width<h&&L.height<b&&(E+=1),P+=L.height;if(x&&P<d&&E>0){var k=d-P;P=0;for(I=0;I<j.length;I+=1){if((L=j[I]).width<h){var q=k/E;q/L.height>(h-L.width)/L.width&&(q=Math.floor((h-L.width)/L.width*L.height)),L.width+=Math.floor(q/L.height*L.width),L.height+=q,k-=q,E-=1}P+=L.height}}switch(u){case"start":O=0;break;case"end":O=d-P;break;case"center":default:O=(d-P)/2}for(I=0;I<j.length;I+=1){L=j[I];var N=void 0;switch(u){case"start":N=0;break;case"end":N=h-L.width;break;case"center":default:N=(h-L.width)/2}_=N;C=void 0;for(var F=0;F<L.ratios.length;F+=1){W=L.ratios[F],S=L.elements[F],A=i.targetWidth;C=L.height,r||S.fixedRatio?A=Math.floor(C/W):C/A!=i.targetHeight/i.targetWidth&&(A=Math.floor(i.targetWidth/i.targetHeight*C)),T.push({left:_+l,top:O+g,width:A,height:C}),_+=A}O+=C}return T};e.default=function(t,e){var i,a=t.maxRatio,r=void 0===a?1.5:a,h=t.minRatio,d=void 0===h?9/16:h,f=t.fixedRatio,l=void 0!==f&&f,s=t.bigPercentage,g=void 0===s?.8:s,c=t.minBigPercentage,u=void 0===c?0:c,v=t.bigFixedRatio,p=void 0!==v&&v,m=t.bigMaxRatio,b=void 0===m?1.5:m,w=t.bigMinRatio,x=void 0===w?9/16:w,y=t.bigFirst,R=void 0===y||y,M=t.containerWidth,H=void 0===M?640:M,W=t.containerHeight,L=void 0===W?480:W,_=t.alignItems,O=void 0===_?"center":_,j=t.bigAlignItems,T=void 0===j?"center":j,I=t.smallAlignItems,S=void 0===I?"center":I,A=t.maxWidth,C=void 0===A?1/0:A,P=t.maxHeight,E=void 0===P?1/0:P,k=t.smallMaxWidth,q=void 0===k?1/0:k,N=t.smallMaxHeight,F=void 0===N?1/0:N,$=t.bigMaxWidth,z=void 0===$?1/0:$,B=t.bigMaxHeight,V=void 0===B?1/0:B,D=t.scaleLastRow,G=void 0===D||D,J=t.bigScaleLastRow,K=void 0===J||J,Q=t.evenRows,U=void 0===Q||Q,X=L/H,Y=0,Z=0,tt=0,et=0,it=[],ot=e.filter((function(t,e){return!!t.big&&(it.push(e),!0)})),nt=e.filter((function(t){return!t.big})),at=[],rt=[],ht={};if(ot.length>0&&nt.length>0){var dt=void 0,ft=void 0,lt=!0===R;if(X>(i=ot[0]).height/i.width){if(dt=H,ft=Math.floor(L*g),u>0){var st=void 0;if(p){var gt=ot[0].height/ot[0].width;st=o(gt,gt,dt,ft,ot.length,z,V,U)}else st=o(x,b,dt,ft,ot.length,z,V,U);ft=Math.max(L*u,Math.min(ft,st.targetHeight*st.targetRows));var ct=n({containerWidth:H,containerHeight:L-ft,offsetLeft:0,offsetTop:0,fixedRatio:l,minRatio:d,maxRatio:r,alignItems:S,maxWidth:q,maxHeight:F,scaleLastRow:G,evenRows:U},nt),ut=0,vt=void 0;ct.forEach((function(t){vt!==t.top&&(vt=t.top,ut+=t.height)})),ft=Math.max(ft,L-ut)}tt=L-(Z=ft),"column"===R?lt=!1:"row"===R&&(lt=!0)}else{if(ft=L,dt=Math.floor(H*g),u>0){st=void 0;if(p){gt=ot[0].height/ot[0].width;st=o(gt,gt,dt,ft,ot.length,z,V,U)}else st=o(x,b,dt,ft,ot.length,z,V,U);dt=Math.max(H*u,Math.min(dt,st.targetWidth*st.targetCols));var pt=n({containerWidth:H-dt,containerHeight:L,offsetLeft:0,offsetTop:0,fixedRatio:l,minRatio:d,maxRatio:r,alignItems:S,maxWidth:q,maxHeight:F,scaleLastRow:G,evenRows:U},nt),mt=0,bt=0,wt=0;pt.forEach((function(t){t.top!==wt&&(bt=0,wt=t.top),bt+=t.width,mt=Math.max(mt,bt)})),dt=Math.max(dt,H-mt)}et=H-(Y=dt),"column"===R?lt=!0:"row"===R&&(lt=!1)}lt?(ht.big={top:0,left:0,width:dt,height:ft},ht.small={top:Z,left:Y,width:H-Y,height:L-Z}):(ht.big={left:et,top:tt,width:dt,height:ft},ht.small={top:0,left:0,width:H-Y,height:L-Z})}else ot.length>0&&0===nt.length?ht.big={top:0,left:0,width:H,height:L}:ht.small={top:Z,left:Y,width:H-Y,height:L-Z};ht.big&&(at=n({containerWidth:ht.big.width,containerHeight:ht.big.height,offsetLeft:ht.big.left,offsetTop:ht.big.top,fixedRatio:p,minRatio:x,maxRatio:b,alignItems:T,maxWidth:z,maxHeight:V,scaleLastRow:K,evenRows:U},ot)),ht.small&&(rt=n({containerWidth:ht.small.width,containerHeight:ht.small.height,offsetLeft:ht.small.left,offsetTop:ht.small.top,fixedRatio:l,minRatio:d,maxRatio:r,alignItems:ht.big?S:O,maxWidth:ht.big?q:C,maxHeight:ht.big?F:E,scaleLastRow:G,evenRows:U},nt));var xt=[],yt=0,Rt=0;return e.forEach((function(t,e){it.indexOf(e)>-1?(xt[e]=at[yt],yt+=1):(xt[e]=rt[Rt],Rt+=1)})),{boxes:xt,areas:ht}}},function(t,e,i){"use strict";
/*!
 *  opentok-layout-js (http://github.com/aullman/opentok-layout-js)
 *
 *  Automatic layout of video elements (publisher and subscriber) minimising
 *  white-space for the OpenTok on WebRTC API.
 *
 *  @Author: Adam Ullman (http://github.com/aullman)
 *  @Copyright (c) 2014 Adam Ullman
 *  @License: Released under the MIT license (http://opensource.org/licenses/MIT)
 * */var o=this&&this.__spreadArray||function(t,e,i){if(i||2===arguments.length)for(var o,n=0,a=e.length;n<a;n++)!o&&n in e||(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return t.concat(o||Array.prototype.slice.call(e))};e.__esModule=!0;var n=i(0),a=i(2);t.exports=function(t,e){var i=this,r=e,h=r&&r.window||("undefined"==typeof window?void 0:window);t="string"==typeof t?h.document.querySelector(t):t,void 0===(h&&h.HTMLElement)||t instanceof h.HTMLElement||r?r||(r={}):r=t;return{layout:function(){return a.default.apply(i,[t,r])},getLayout:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return console.log("getLayout apply"),n.default.apply(i,o([r],t,!0))},setOptions:function(t){r=t}}}},function(t,e,i){"use strict";var o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var n in e=arguments[i])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};e.__esModule=!0;var n=i(0);e.default=function(t,e){function i(t,o,n){if("string"==typeof o&&n)return t.style[o]=n,NaN;if("object"==typeof o)return Object.keys(o).forEach((function(e){i(t,e,o[e])})),NaN;var a=(e&&e.window||window).getComputedStyle(t).getPropertyValue(o);return""===a&&(a=t.style[o]),a}var a=function(t,e){var o=i(t,e);return o?parseInt(o,10):0},r=e.animate,h=void 0!==r&&r,d=e.bigClass,f=void 0===d?"OT_big":d,l=e.ignoreClass,s=void 0===l?"OT_ignore":l,g=e.fixedRatioClass,c=void 0===g?"OT_fixedRatio":g;if("none"!==i(t,"display")){var u,v,p=t.getAttribute("id");p||(p="OT_".concat((1e8*Math.random()).toFixed(0)),t.setAttribute("id",p)),e.containerHeight=((v=(u=t).offsetHeight>0?"".concat(u.offsetHeight,"px"):i(u,"height"))?parseInt(v,10):0)-a(t,"border-top")-a(t,"border-bottom"),e.containerWidth=function(t){var e,o=(e=t).offsetWidth>0?"".concat(e.offsetWidth,"px"):i(e,"width");return o?parseInt(o,10):0}(t)-a(t,"border-left")-a(t,"border-right");var m=Array.prototype.filter.call(t.querySelectorAll("#".concat(p,">*:not(.").concat(s,")")),(function(t){return"none"!==i(t,"display")})),b=m.map((function(t){return o(o({},function(t){if(t){if(t.videoHeight&&t.videoWidth)return{height:t.videoHeight,width:t.videoWidth};var e=t.querySelector("video");if(e&&e.videoHeight&&e.videoWidth)return{height:e.videoHeight,width:e.videoWidth}}return{height:480,width:640}}(t)),{big:t.classList.contains(f),fixedRatio:t.classList.contains(c)})}));(0,n.default)(e,b).boxes.forEach((function(t,o){var n=m[o];i(n,"position","absolute");var r=t.width-a(n,"margin-left")-a(n,"margin-right")-("border-box"!==i(n,"box-sizing")?a(n,"padding-left")+a(n,"padding-right")+a(n,"border-left")+a(n,"border-right"):0),d=t.height-a(n,"margin-top")-a(n,"margin-bottom")-("border-box"!==i(n,"box-sizing")?a(n,"padding-top")+a(n,"padding-bottom")+a(n,"border-top")+a(n,"border-bottom"):0);!function(t,e,o,n,a,r,h){var d=this,f={left:"".concat(e,"px"),top:"".concat(o,"px"),width:"".concat(n,"px"),height:"".concat(a,"px")},l=function(){var e=t.querySelector(".OT_root");if(e){var i=e.style.width;e.style.width="".concat(n,"px"),e.style.width=i||""}};if(r&&"undefined"!=typeof $){$(t).stop();var s="boolean"==typeof r?{duration:200,easing:"swing"}:r;$(t).animate(f,s.duration,s.easing,(function(){l(),s.complete&&s.complete.call(d),h&&h(t,{left:e,top:o,width:n,height:a})}))}else i(t,f),t.classList.contains("ot-layout")||t.classList.add("ot-layout"),h&&h(t,{left:e,top:o,width:n,height:a});l()}(n,t.left,t.top,r,d,h,e.onLayout)}))}}}])}));
//# sourceMappingURL=opentok-layout.min.js.map