cnhis-design-vue 2.2.3 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -10
- package/es/affix/index.js +8 -8
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/anchor/index.js +8 -8
- package/es/auto-complete/index.js +8 -8
- package/es/avatar/index.js +8 -8
- package/es/back-top/index.js +8 -8
- package/es/badge/index.js +8 -8
- package/es/base/index.js +8 -8
- package/es/big-table/index.js +102 -102
- package/es/big-table/style.css +1 -1
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +33 -33
- package/es/calendar/index.js +8 -8
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/card-reader-sdk/index.js +1 -1
- package/es/carousel/index.js +8 -8
- package/es/cascader/index.js +8 -8
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/collapse/index.js +8 -8
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/config-provider/index.js +8 -8
- package/es/date-picker/index.js +8 -8
- package/es/descriptions/index.js +8 -8
- package/es/direct/index.js +16 -16
- package/es/divider/index.js +8 -8
- package/es/drag-layout/index.js +3 -3
- package/es/drawer/index.js +8 -8
- package/es/dropdown/index.js +8 -8
- package/es/editor/index.js +1 -1
- package/es/ellipsis/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +262 -183
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +74 -74
- package/es/full-calendar/index.js +4 -4
- package/es/index/index.js +778 -689
- package/es/index/style.css +1 -1
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/layout/index.js +8 -8
- package/es/list/index.js +8 -8
- package/es/locale-provider/index.js +8 -8
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/menu/index.js +8 -8
- package/es/message/index.js +8 -8
- package/es/multi-chat/index.js +76 -76
- package/es/multi-chat-client/index.js +70 -70
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +14 -14
- package/es/multi-chat-setting/index.js +22 -22
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/page-header/index.js +8 -8
- package/es/pagination/index.js +8 -8
- package/es/popconfirm/index.js +8 -8
- package/es/popover/index.js +8 -8
- package/es/progress/index.js +8 -8
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/result/index.js +8 -8
- package/es/row/index.js +8 -8
- package/es/scale-container/index.js +9 -9
- package/es/scale-view/index.js +27 -27
- package/es/select/index.js +36 -21
- package/es/select-label/index.js +11 -11
- package/es/select-person/index.js +2 -2
- package/es/select-tag/index.js +4 -4
- package/es/shortcut-setter/index.js +10 -10
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/slider-tree/index.js +9 -9
- package/es/space/index.js +8 -8
- package/es/spin/index.js +8 -8
- package/es/statistic/index.js +8 -8
- package/es/steps/index.js +8 -8
- package/es/switch/index.js +8 -8
- package/es/table-filter/index.js +112 -117
- package/es/table-filter/style.css +1 -1
- package/es/tabs/index.js +8 -8
- package/es/tag/index.js +9 -9
- package/es/time-picker/index.js +8 -8
- package/es/timeline/index.js +8 -8
- package/es/tooltip/index.js +8 -8
- package/es/transfer/index.js +8 -8
- package/es/tree/index.js +8 -8
- package/es/tree-select/index.js +8 -8
- package/es/upload/index.js +8 -8
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +719 -632
- package/lib/cui.umd.js +719 -632
- package/lib/cui.umd.min.js +18 -18
- package/package.json +1 -1
- package/.prettierrc.js +0 -27
- package/packages/affix/index.js +0 -12
- package/packages/affix/src/Affix.jsx +0 -12
- package/packages/age/index.js +0 -27
- package/packages/age/src/age/index.vue +0 -140
- package/packages/age/src/age-com/index.vue +0 -210
- package/packages/alert/index.js +0 -12
- package/packages/alert/src/Alert.jsx +0 -11
- package/packages/anchor/index.js +0 -18
- package/packages/anchor/src/Anchor.jsx +0 -11
- package/packages/anchor/src/Link.jsx +0 -11
- package/packages/auto-complete/index.js +0 -12
- package/packages/auto-complete/src/AutoComplete.jsx +0 -12
- package/packages/avatar/index.js +0 -12
- package/packages/avatar/src/Avatar.jsx +0 -11
- package/packages/back-top/index.js +0 -12
- package/packages/back-top/src/BackTop.jsx +0 -11
- package/packages/badge/index.js +0 -12
- package/packages/badge/src/Badge.jsx +0 -11
- package/packages/base/index.js +0 -3
- package/packages/big-table/index.js +0 -20
- package/packages/big-table/src/BigTable.vue +0 -2977
- package/packages/big-table/src/Fieldset.vue +0 -2067
- package/packages/big-table/src/assets/iconfont/iconfont.css +0 -25
- package/packages/big-table/src/assets/iconfont/iconfont.ttf +0 -0
- package/packages/big-table/src/assets/img/failure.png +0 -0
- package/packages/big-table/src/assets/img/icon-asc.png +0 -0
- package/packages/big-table/src/assets/img/icon-desc.png +0 -0
- package/packages/big-table/src/assets/img/no-permission.png +0 -0
- package/packages/big-table/src/assets/img/nodata.png +0 -0
- package/packages/big-table/src/assets/img/notfound.png +0 -0
- package/packages/big-table/src/assets/img/qr.png +0 -0
- package/packages/big-table/src/assets/img/video_default_cover.png +0 -0
- package/packages/big-table/src/assets/img/xb_big.png +0 -0
- package/packages/big-table/src/assets/img/xb_small.png +0 -0
- package/packages/big-table/src/assets/style/table-base.less +0 -425
- package/packages/big-table/src/assets/style/table-global.less +0 -20
- package/packages/big-table/src/components/AutoLayoutButton.vue +0 -285
- package/packages/big-table/src/components/HeaderFilter.vue +0 -371
- package/packages/big-table/src/components/NoData.vue +0 -81
- package/packages/big-table/src/components/TextOverTooltip.vue +0 -120
- package/packages/big-table/src/components/edit-form/EditForm.vue +0 -518
- package/packages/big-table/src/components/edit-form/edit-component/config-data/index.js +0 -68
- package/packages/big-table/src/components/edit-form/edit-component/edit-date-picker/edit-date-picker.vue +0 -60
- package/packages/big-table/src/components/edit-form/edit-component/edit-digital/edit-digital.vue +0 -54
- package/packages/big-table/src/components/edit-form/edit-component/edit-input/edit-input.vue +0 -39
- package/packages/big-table/src/components/edit-form/edit-component/edit-input-password/edit-input-password.vue +0 -79
- package/packages/big-table/src/components/edit-form/edit-component/edit-month-picker/edit-month-picker.vue +0 -37
- package/packages/big-table/src/components/edit-form/edit-component/edit-search/edit-search.vue +0 -156
- package/packages/big-table/src/components/edit-form/edit-component/edit-search-more/edit-search-more.vue +0 -151
- package/packages/big-table/src/components/edit-form/edit-component/edit-select/edit-select.vue +0 -40
- package/packages/big-table/src/components/edit-form/edit-component/edit-select-multiple/edit-select-multiple.vue +0 -55
- package/packages/big-table/src/components/edit-form/edit-component/edit-switch/edit-switch.vue +0 -43
- package/packages/big-table/src/components/edit-form/edit-component/edit-textarea/edit-textarea.vue +0 -41
- package/packages/big-table/src/components/edit-form/edit-component/edit-time-picker/edit-time-picker.vue +0 -40
- package/packages/big-table/src/components/edit-form/edit-component/mixins/bound-date.js +0 -3
- package/packages/big-table/src/components/edit-form/edit-component/mixins/dateType.js +0 -217
- package/packages/big-table/src/components/edit-form/edit-component/mixins/item-default.js +0 -639
- package/packages/big-table/src/components/edit-form/edit-component/mixins/search.js +0 -1223
- package/packages/big-table/src/components/edit-form/edit-component/register-com.js +0 -26
- package/packages/big-table/src/components/edit-form/edit-item/form-event.js +0 -80
- package/packages/big-table/src/components/edit-form/edit-item/global-props.js +0 -33
- package/packages/big-table/src/components/edit-form/edit-item/index.js +0 -4
- package/packages/big-table/src/components/edit-form/edit-item/render-methods.js +0 -28
- package/packages/big-table/src/components/edit-form/edit-item/validate-rules.js +0 -463
- package/packages/big-table/src/components/edit-form/edit-mixins/form-commom.js +0 -673
- package/packages/big-table/src/components/edit-form/edit-mixins/index.js +0 -3
- package/packages/big-table/src/components/edit-form/edit-utils/index.js +0 -112
- package/packages/big-table/src/components/password-com.vue +0 -58
- package/packages/big-table/src/components/player-vod/index.vue +0 -57
- package/packages/big-table/src/components/player-vod/player.vue +0 -193
- package/packages/big-table/src/components/player-vod/video-list.vue +0 -265
- package/packages/big-table/src/components/player-vod/video-modal.vue +0 -131
- package/packages/big-table/src/utils/CustomPagination.vue +0 -86
- package/packages/big-table/src/utils/batchEditing.js +0 -613
- package/packages/big-table/src/utils/bigTableProps.js +0 -112
- package/packages/big-table/src/utils/checkStrictly.js +0 -58
- package/packages/big-table/src/utils/eventBroadcast.js +0 -24
- package/packages/big-table/src/utils/format.js +0 -577
- package/packages/big-table/src/utils/headerFilter.js +0 -691
- package/packages/big-table/src/utils/nestTable.js +0 -109
- package/packages/big-table/src/utils/tableParse.js +0 -234
- package/packages/breadcrumb/index.js +0 -21
- package/packages/breadcrumb/src/Breadcrumb.jsx +0 -11
- package/packages/breadcrumb/src/BreadcrumbItem.jsx +0 -11
- package/packages/breadcrumb/src/BreadcrumbSeparator.jsx +0 -11
- package/packages/button/index.js +0 -21
- package/packages/button/src/Button.jsx +0 -11
- package/packages/button/src/ButtonGroup.jsx +0 -11
- package/packages/button/src/ButtonPrint/components/IdentityVerification.vue +0 -181
- package/packages/button/src/ButtonPrint/index.vue +0 -165
- package/packages/button/src/ButtonPrint/js/print.es.min.js +0 -1
- package/packages/button/src/ButtonPrint/js/print.es.min1.js +0 -1
- package/packages/button/src/ButtonPrint/mixin/his-print.js +0 -95
- package/packages/button/src/ButtonPrint/new.vue +0 -1476
- package/packages/button/src/ButtonPrint/old.vue +0 -870
- package/packages/calendar/index.js +0 -12
- package/packages/calendar/src/Calendar.jsx +0 -11
- package/packages/captcha/index.js +0 -10
- package/packages/captcha/src/Captcha.vue +0 -164
- package/packages/captcha/src/Index.vue +0 -47
- package/packages/captcha/src/SlideVerify.vue +0 -285
- package/packages/card/index.js +0 -21
- package/packages/card/src/Card.jsx +0 -12
- package/packages/card/src/CardGrid.js +0 -7
- package/packages/card/src/CardMeta.js +0 -7
- package/packages/card-reader-sdk/index.js +0 -4
- package/packages/card-reader-sdk/src/cardReaderSDK.js +0 -149
- package/packages/card-reader-sdk/src/components/readCardDialog.vue +0 -48
- package/packages/card-reader-sdk/src/constants/index.js +0 -76
- package/packages/card-reader-sdk/src/insuranceSDK.js +0 -111
- package/packages/card-reader-sdk/src/utils/index.js +0 -84
- package/packages/card-reader-sdk/src/utils/readHealthCard.jsx +0 -57
- package/packages/carousel/index.js +0 -12
- package/packages/carousel/src/Carousel.jsx +0 -12
- package/packages/cascader/index.js +0 -12
- package/packages/cascader/src/Cascader.jsx +0 -11
- package/packages/checkbox/index.js +0 -30
- package/packages/checkbox/src/Checkbox.jsx +0 -11
- package/packages/checkbox/src/CheckboxImg/index.vue +0 -142
- package/packages/checkbox/src/Group.jsx +0 -11
- package/packages/col/index.js +0 -13
- package/packages/col/src/Col.jsx +0 -11
- package/packages/collapse/index.js +0 -18
- package/packages/collapse/src/Collapse.jsx +0 -11
- package/packages/collapse/src/Panel.jsx +0 -11
- package/packages/color-picker/index.js +0 -10
- package/packages/color-picker/src/color-picker.vue +0 -191
- package/packages/color-picker/src/style.less +0 -109
- package/packages/comment/index.js +0 -12
- package/packages/comment/src/Comment.jsx +0 -11
- package/packages/config-provider/index.js +0 -12
- package/packages/config-provider/src/ConfigProvider.jsx +0 -11
- package/packages/date-picker/index.js +0 -26
- package/packages/date-picker/src/DatePicker.jsx +0 -12
- package/packages/date-picker/src/MonthPicker.jsx +0 -11
- package/packages/date-picker/src/RangePicker.jsx +0 -11
- package/packages/date-picker/src/WeekPicker.jsx +0 -11
- package/packages/date-picker/src/utils/index.js +0 -374
- package/packages/descriptions/index.js +0 -18
- package/packages/descriptions/src/Descriptions.jsx +0 -11
- package/packages/descriptions/src/Item.jsx +0 -11
- package/packages/direct/index.js +0 -3
- package/packages/divider/index.js +0 -12
- package/packages/divider/src/Divider.jsx +0 -11
- package/packages/drag-layout/DragFormLeftItem.vue +0 -173
- package/packages/drag-layout/DragFormRightItem.vue +0 -284
- package/packages/drag-layout/I18n-mixins.js +0 -10
- package/packages/drag-layout/drag-layout.vue +0 -778
- package/packages/drag-layout/index.js +0 -12
- package/packages/drawer/index.js +0 -12
- package/packages/drawer/src/Drawer.jsx +0 -11
- package/packages/dropdown/index.js +0 -12
- package/packages/dropdown/src/Dropdown.jsx +0 -11
- package/packages/editor/index.js +0 -10
- package/packages/editor/src/Editor.vue +0 -201
- package/packages/editor/src/utils.js +0 -65
- package/packages/ellipsis/index.js +0 -9
- package/packages/ellipsis/src/Ellipsis.vue +0 -65
- package/packages/empty/index.js +0 -12
- package/packages/empty/src/Empty.jsx +0 -11
- package/packages/fabric-chart/index.js +0 -10
- package/packages/fabric-chart/src/FabricChart.vue +0 -153
- package/packages/fabric-chart/src/FabricGrid.vue +0 -67
- package/packages/fabric-chart/src/components/DropPopup.vue +0 -90
- package/packages/fabric-chart/src/components/MouseRightClick.vue +0 -168
- package/packages/fabric-chart/src/components/TimeScaleValue.vue +0 -125
- package/packages/fabric-chart/src/const/defaultVaule.js +0 -61
- package/packages/fabric-chart/src/fabric-chart/FabricCanvas.vue +0 -396
- package/packages/fabric-chart/src/fabric-chart/FabricLines.vue +0 -641
- package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +0 -1447
- package/packages/fabric-chart/src/fabric-chart/FabricScaleValue.vue +0 -142
- package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +0 -928
- package/packages/fabric-chart/src/mixins/draw.js +0 -444
- package/packages/fabric-chart/src/mixins/drawExtracorporealCirculation.js +0 -222
- package/packages/fabric-chart/src/mixins/eventCommon.js +0 -107
- package/packages/fabric-chart/src/mixins/fabricCommon.js +0 -77
- package/packages/fabric-chart/src/mixins/fabricObject.js +0 -193
- package/packages/fabric-chart/src/utils/bus.js +0 -2
- package/packages/fabric-chart/src/utils/index.js +0 -104
- package/packages/form/index.js +0 -16
- package/packages/form/src/Form.jsx +0 -11
- package/packages/form/src/Item.jsx +0 -11
- package/packages/form-model/index.js +0 -14
- package/packages/form-model/src/FormModel.jsx +0 -11
- package/packages/form-model/src/Item.jsx +0 -11
- package/packages/form-table/index.js +0 -16
- package/packages/form-table/src/FormTable.vue +0 -1110
- package/packages/form-table/src/components/table-component/config-data/index.js +0 -80
- package/packages/form-table/src/components/table-component/global-props.js +0 -22
- package/packages/form-table/src/components/table-component/index.js +0 -8
- package/packages/form-table/src/components/table-component/mixins/bound-date.js +0 -455
- package/packages/form-table/src/components/table-component/mixins/dateType.js +0 -217
- package/packages/form-table/src/components/table-component/mixins/item-default.js +0 -257
- package/packages/form-table/src/components/table-component/mixins/search.js +0 -1242
- package/packages/form-table/src/components/table-component/register-com.js +0 -30
- package/packages/form-table/src/components/table-component/table-age/table-age.vue +0 -175
- package/packages/form-table/src/components/table-component/table-date-picker/table-date-picker.vue +0 -87
- package/packages/form-table/src/components/table-component/table-digital/table-digital.vue +0 -93
- package/packages/form-table/src/components/table-component/table-input/table-input.vue +0 -81
- package/packages/form-table/src/components/table-component/table-input-password/table-input-password.vue +0 -126
- package/packages/form-table/src/components/table-component/table-month-picker/table-month-picker.vue +0 -55
- package/packages/form-table/src/components/table-component/table-search/table-search.vue +0 -174
- package/packages/form-table/src/components/table-component/table-search-more/table-search-more.vue +0 -191
- package/packages/form-table/src/components/table-component/table-select/table-select.vue +0 -64
- package/packages/form-table/src/components/table-component/table-select-multiple/table-select-multiple.vue +0 -81
- package/packages/form-table/src/components/table-component/table-textarea/table-textarea.vue +0 -76
- package/packages/form-table/src/components/table-component/table-time-picker/table-time-picker.vue +0 -55
- package/packages/form-table/src/components/table-component/table-tree-select/table-tree-select.vue +0 -135
- package/packages/form-table/src/components/table-component/text-over-tooltip/TextOverTooltip.vue +0 -97
- package/packages/form-table/src/components/table-item/form-event.js +0 -81
- package/packages/form-table/src/components/table-item/global-props.js +0 -27
- package/packages/form-table/src/components/table-item/index.js +0 -4
- package/packages/form-table/src/components/table-item/render-methods.js +0 -28
- package/packages/form-table/src/components/table-item/validate-rules.js +0 -520
- package/packages/form-table/src/components/table-mixins/form-commom.js +0 -98
- package/packages/form-table/src/components/table-mixins/index.js +0 -3
- package/packages/form-table/src/components/table-utils/index.js +0 -112
- package/packages/form-table/src/disabledDetail.less +0 -46
- package/packages/full-calendar/index.js +0 -10
- package/packages/full-calendar/src/FullCalendar.vue +0 -775
- package/packages/full-calendar/src/api/index.js +0 -71
- package/packages/full-calendar/src/components/ListTag.vue +0 -184
- package/packages/full-calendar/src/components/Tag.vue +0 -300
- package/packages/full-calendar/src/components/TagDetail.vue +0 -288
- package/packages/full-calendar/src/utils/index.js +0 -217
- package/packages/grid/index.js +0 -10
- package/packages/grid/src/grid.js +0 -27
- package/packages/icon/index.js +0 -10
- package/packages/icon/src/icon.js +0 -13
- package/packages/index.js +0 -325
- package/packages/input/index.js +0 -30
- package/packages/input/src/Group.jsx +0 -11
- package/packages/input/src/Input.jsx +0 -11
- package/packages/input/src/Password.jsx +0 -11
- package/packages/input/src/Search.jsx +0 -11
- package/packages/input/src/TextArea.jsx +0 -11
- package/packages/input/src/input-quick/components/quick-item.vue +0 -284
- package/packages/input/src/input-quick/components/quick-popover.vue +0 -596
- package/packages/input/src/input-quick/index.vue +0 -137
- package/packages/input-number/index.js +0 -12
- package/packages/input-number/src/InputNumber.jsx +0 -11
- package/packages/keep-cache/KeepCache.js +0 -236
- package/packages/keep-cache/index.css +0 -3
- package/packages/keep-cache/index.js +0 -8
- package/packages/layout/index.js +0 -27
- package/packages/layout/src/Content.jsx +0 -11
- package/packages/layout/src/Footer.jsx +0 -11
- package/packages/layout/src/Header.jsx +0 -11
- package/packages/layout/src/Layout.jsx +0 -11
- package/packages/layout/src/Sider.jsx +0 -11
- package/packages/list/index.js +0 -21
- package/packages/list/src/Item.jsx +0 -11
- package/packages/list/src/ItemMeta.jsx +0 -11
- package/packages/list/src/List.jsx +0 -11
- package/packages/locale-provider/index.js +0 -12
- package/packages/locale-provider/src/LocaleProvider.jsx +0 -11
- package/packages/map/index.js +0 -10
- package/packages/map/src/Map.vue +0 -484
- package/packages/map/src/popup-map.vue +0 -53
- package/packages/mentions/index.js +0 -18
- package/packages/mentions/src/Mentions.jsx +0 -11
- package/packages/mentions/src/Option.jsx +0 -11
- package/packages/menu/index.js +0 -27
- package/packages/menu/src/Divider.jsx +0 -11
- package/packages/menu/src/Item.jsx +0 -11
- package/packages/menu/src/ItemGroup.jsx +0 -11
- package/packages/menu/src/Menu.jsx +0 -11
- package/packages/menu/src/SubMenu.jsx +0 -11
- package/packages/message/index.js +0 -8
- package/packages/modal/index.js +0 -10
- package/packages/modal/src/Modal.js +0 -7
- package/packages/multi-chat/chat/addConference.vue +0 -200
- package/packages/multi-chat/chat/addMembers.vue +0 -411
- package/packages/multi-chat/chat/advancedFilter.vue +0 -372
- package/packages/multi-chat/chat/audio.vue +0 -599
- package/packages/multi-chat/chat/calling.vue +0 -246
- package/packages/multi-chat/chat/chatFooter.vue +0 -1647
- package/packages/multi-chat/chat/chatHeader.vue +0 -493
- package/packages/multi-chat/chat/chatHistory.vue +0 -605
- package/packages/multi-chat/chat/chatMain.vue +0 -1490
- package/packages/multi-chat/chat/client/clientChat.vue +0 -731
- package/packages/multi-chat/chat/client/index.vue +0 -149
- package/packages/multi-chat/chat/delay.vue +0 -177
- package/packages/multi-chat/chat/evaluate.vue +0 -343
- package/packages/multi-chat/chat/index.vue +0 -2419
- package/packages/multi-chat/chat/messageRecord.vue +0 -324
- package/packages/multi-chat/chat/mixins/NoData.js +0 -20
- package/packages/multi-chat/chat/mixins/base.js +0 -97
- package/packages/multi-chat/chat/mixins/uniRTCAPI.js +0 -80
- package/packages/multi-chat/chat/mixins/viewerOptions.js +0 -67
- package/packages/multi-chat/chat/multiVideo.vue +0 -1426
- package/packages/multi-chat/chat/quickReply.vue +0 -439
- package/packages/multi-chat/chat/robot/index.vue +0 -312
- package/packages/multi-chat/chat/scrollList.vue +0 -1259
- package/packages/multi-chat/chat/video.vue +0 -404
- package/packages/multi-chat/chat/videoVoiceList.vue +0 -348
- package/packages/multi-chat/chat/voice.vue +0 -431
- package/packages/multi-chat/components/avatar.vue +0 -113
- package/packages/multi-chat/components/chat-tabs-header.vue +0 -251
- package/packages/multi-chat/components/classify-tabs.vue +0 -185
- package/packages/multi-chat/components/empty.vue +0 -24
- package/packages/multi-chat/components/modal-refuse-reason.vue +0 -112
- package/packages/multi-chat/components/modal-sip.vue +0 -160
- package/packages/multi-chat/components/modal-user-transfer.vue +0 -98
- package/packages/multi-chat/components/msg-describe.vue +0 -138
- package/packages/multi-chat/components/msg-picture.vue +0 -68
- package/packages/multi-chat/components/msg-prescription.vue +0 -205
- package/packages/multi-chat/components/read-record.vue +0 -133
- package/packages/multi-chat/components/read-status.vue +0 -34
- package/packages/multi-chat/components/user-status.vue +0 -198
- package/packages/multi-chat/components/vuecmf-dialog.vue +0 -323
- package/packages/multi-chat/img/OFF-LINE.png +0 -0
- package/packages/multi-chat/img/ON-LINE.png +0 -0
- package/packages/multi-chat/img/accept.png +0 -0
- package/packages/multi-chat/img/add-person.png +0 -0
- package/packages/multi-chat/img/add_prescription.png +0 -0
- package/packages/multi-chat/img/all-voice.png +0 -0
- package/packages/multi-chat/img/audio-new.png +0 -0
- package/packages/multi-chat/img/audio-play.gif +0 -0
- package/packages/multi-chat/img/audio.png +0 -0
- package/packages/multi-chat/img/base-info-active.png +0 -0
- package/packages/multi-chat/img/base-info.png +0 -0
- package/packages/multi-chat/img/busy_line.png +0 -0
- package/packages/multi-chat/img/call.png +0 -0
- package/packages/multi-chat/img/callin.png +0 -0
- package/packages/multi-chat/img/callin_cancel.png +0 -0
- package/packages/multi-chat/img/calling.png +0 -0
- package/packages/multi-chat/img/callout.png +0 -0
- package/packages/multi-chat/img/callout_cancel.png +0 -0
- package/packages/multi-chat/img/close.png +0 -0
- package/packages/multi-chat/img/close_video.png +0 -0
- package/packages/multi-chat/img/customer-service-active.png +0 -0
- package/packages/multi-chat/img/customer-service.png +0 -0
- package/packages/multi-chat/img/customer.png +0 -0
- package/packages/multi-chat/img/customer_staff.png +0 -0
- package/packages/multi-chat/img/default.png +0 -0
- package/packages/multi-chat/img/ellipsis.png +0 -0
- package/packages/multi-chat/img/end-voice.png +0 -0
- package/packages/multi-chat/img/event-active.png +0 -0
- package/packages/multi-chat/img/event.png +0 -0
- package/packages/multi-chat/img/exp.png +0 -0
- package/packages/multi-chat/img/full-sceen-close.png +0 -0
- package/packages/multi-chat/img/full-sceen.png +0 -0
- package/packages/multi-chat/img/icon_list.png +0 -0
- package/packages/multi-chat/img/icon_list_active.png +0 -0
- package/packages/multi-chat/img/icon_table.png +0 -0
- package/packages/multi-chat/img/icon_table_active.png +0 -0
- package/packages/multi-chat/img/join-video.png +0 -0
- package/packages/multi-chat/img/large.png +0 -0
- package/packages/multi-chat/img/left-wrapper.png +0 -0
- package/packages/multi-chat/img/left.png +0 -0
- package/packages/multi-chat/img/medical_record.png +0 -0
- package/packages/multi-chat/img/middle.png +0 -0
- package/packages/multi-chat/img/msgTip.mp3 +0 -0
- package/packages/multi-chat/img/multi-video.png +0 -0
- package/packages/multi-chat/img/multi-voice.png +0 -0
- package/packages/multi-chat/img/mute-audio.png +0 -0
- package/packages/multi-chat/img/muted-audio.png +0 -0
- package/packages/multi-chat/img/muted-screen.png +0 -0
- package/packages/multi-chat/img/muted-video.png +0 -0
- package/packages/multi-chat/img/no-all-voice.png +0 -0
- package/packages/multi-chat/img/no-data.png +0 -0
- package/packages/multi-chat/img/no-data2.png +0 -0
- package/packages/multi-chat/img/no-screen.png +0 -0
- package/packages/multi-chat/img/no-video.png +0 -0
- package/packages/multi-chat/img/no-voice.png +0 -0
- package/packages/multi-chat/img/no-voiced.png +0 -0
- package/packages/multi-chat/img/normal-screen.png +0 -0
- package/packages/multi-chat/img/normal-video.png +0 -0
- package/packages/multi-chat/img/over.png +0 -0
- package/packages/multi-chat/img/portrait.png +0 -0
- package/packages/multi-chat/img/prescription.png +0 -0
- package/packages/multi-chat/img/receive.png +0 -0
- package/packages/multi-chat/img/reject.png +0 -0
- package/packages/multi-chat/img/remove.png +0 -0
- package/packages/multi-chat/img/replay.png +0 -0
- package/packages/multi-chat/img/required.png +0 -0
- package/packages/multi-chat/img/screen.png +0 -0
- package/packages/multi-chat/img/send_prescription.png +0 -0
- package/packages/multi-chat/img/setting.png +0 -0
- package/packages/multi-chat/img/small.png +0 -0
- package/packages/multi-chat/img/sound.png +0 -0
- package/packages/multi-chat/img/sound_forbid.png +0 -0
- package/packages/multi-chat/img/start_video.png +0 -0
- package/packages/multi-chat/img/system_message.png +0 -0
- package/packages/multi-chat/img/to-session.png +0 -0
- package/packages/multi-chat/img/transfer.png +0 -0
- package/packages/multi-chat/img/transfer2.png +0 -0
- package/packages/multi-chat/img/video-accept.png +0 -0
- package/packages/multi-chat/img/video.png +0 -0
- package/packages/multi-chat/img/video_consult.png +0 -0
- package/packages/multi-chat/img/voice.png +0 -0
- package/packages/multi-chat/img/worktime-active.png +0 -0
- package/packages/multi-chat/img/worktime.png +0 -0
- package/packages/multi-chat/index.js +0 -7
- package/packages/multi-chat/setting/authority/index.vue +0 -156
- package/packages/multi-chat/setting/authority/roleSetting.vue +0 -204
- package/packages/multi-chat/setting/baseInfo/index.vue +0 -1343
- package/packages/multi-chat/setting/configuration/index.vue +0 -334
- package/packages/multi-chat/setting/customerService/batchSelect.vue +0 -403
- package/packages/multi-chat/setting/customerService/index.vue +0 -273
- package/packages/multi-chat/setting/event/edit/condition.vue +0 -128
- package/packages/multi-chat/setting/event/edit/index.vue +0 -437
- package/packages/multi-chat/setting/event/edit/notice.vue +0 -129
- package/packages/multi-chat/setting/event/edit/strategy.vue +0 -98
- package/packages/multi-chat/setting/event/index.vue +0 -249
- package/packages/multi-chat/setting/index.vue +0 -281
- package/packages/multi-chat/setting/page.vue +0 -14
- package/packages/multi-chat/setting/sessionList/index.vue +0 -412
- package/packages/multi-chat/setting/sessionList/messageRecord.vue +0 -372
- package/packages/multi-chat/setting/userConfig/index.vue +0 -124
- package/packages/multi-chat/setting/worktime/index.vue +0 -274
- package/packages/multi-chat/store/actions.js +0 -452
- package/packages/multi-chat/store/getters.js +0 -380
- package/packages/multi-chat/store/helper.js +0 -66
- package/packages/multi-chat/store/index.js +0 -50
- package/packages/multi-chat/store/mutation.js +0 -305
- package/packages/multi-chat/store/state.js +0 -120
- package/packages/multi-chat/style/emoji.css +0 -315
- package/packages/multi-chat/style/message.mixin.less +0 -38
- package/packages/multi-chat/utils/chatSock.js +0 -93
- package/packages/multi-chat/utils/compressImage.js +0 -115
- package/packages/multi-chat/utils/emoji.json +0 -68
- package/packages/multi-chat/utils/index.js +0 -259
- package/packages/multi-chat/utils/observer-scroll.js +0 -49
- package/packages/multi-chat/utils/panelsetting.js +0 -48
- package/packages/multi-chat/utils/rtc-client-multi.js +0 -397
- package/packages/multi-chat/utils/rtc-client.js +0 -469
- package/packages/multi-chat-client/index.js +0 -7
- package/packages/multi-chat-history/index.js +0 -7
- package/packages/multi-chat-record/index.js +0 -7
- package/packages/multi-chat-setting/index.js +0 -7
- package/packages/multi-chat-sip/index.js +0 -6
- package/packages/notification/index.js +0 -8
- package/packages/page-header/index.js +0 -12
- package/packages/page-header/src/PageHeader.jsx +0 -11
- package/packages/pagination/index.js +0 -12
- package/packages/pagination/src/Pagination.jsx +0 -11
- package/packages/popconfirm/index.js +0 -12
- package/packages/popconfirm/src/Popconfirm.jsx +0 -11
- package/packages/popover/index.js +0 -12
- package/packages/popover/src/Popover.jsx +0 -11
- package/packages/progress/index.js +0 -12
- package/packages/progress/src/Progress.jsx +0 -11
- package/packages/radio/index.js +0 -33
- package/packages/radio/src/Group.jsx +0 -11
- package/packages/radio/src/Radio.jsx +0 -11
- package/packages/radio/src/RadioButton.jsx +0 -11
- package/packages/radio/src/RadioImg/index.vue +0 -125
- package/packages/rate/index.js +0 -12
- package/packages/rate/src/Rate.jsx +0 -11
- package/packages/result/index.js +0 -12
- package/packages/result/src/Result.jsx +0 -11
- package/packages/row/index.js +0 -12
- package/packages/row/src/Row.jsx +0 -11
- package/packages/scale-container/index.js +0 -9
- package/packages/scale-container/src/ScaleContainer.vue +0 -202
- package/packages/scale-container/src/scale.png +0 -0
- package/packages/scale-view/NoData.vue +0 -81
- package/packages/scale-view/answerParse.vue +0 -133
- package/packages/scale-view/assets/img/failure.png +0 -0
- package/packages/scale-view/assets/img/no-permission.png +0 -0
- package/packages/scale-view/assets/img/nodata.png +0 -0
- package/packages/scale-view/assets/img/notfound.png +0 -0
- package/packages/scale-view/customList.vue +0 -801
- package/packages/scale-view/data.js +0 -80
- package/packages/scale-view/directive/drag-move.js +0 -132
- package/packages/scale-view/evaluateCountdown.vue +0 -157
- package/packages/scale-view/evaluatePage.vue +0 -203
- package/packages/scale-view/formitem/data.js +0 -3991
- package/packages/scale-view/formitem/index.js +0 -7
- package/packages/scale-view/formitem/r-address.vue +0 -245
- package/packages/scale-view/formitem/r-choice.vue +0 -755
- package/packages/scale-view/formitem/r-input.vue +0 -93
- package/packages/scale-view/formitem/r-prompt.vue +0 -52
- package/packages/scale-view/formitem/r-sign.vue +0 -218
- package/packages/scale-view/formitem/r-time.vue +0 -285
- package/packages/scale-view/formitem/r-upload-custom-list.vue +0 -242
- package/packages/scale-view/formitem/r-upload.vue +0 -321
- package/packages/scale-view/formitem/sign-com.vue +0 -316
- package/packages/scale-view/formitem/text-over-tooltip/TextOverTooltip.vue +0 -98
- package/packages/scale-view/index.js +0 -17
- package/packages/scale-view/mixin/NoData.js +0 -38
- package/packages/scale-view/mixin/addressVal.js +0 -156
- package/packages/scale-view/mixin/evaluate.js +0 -146
- package/packages/scale-view/mixin/index.js +0 -337
- package/packages/scale-view/mixin/judgeTypes.js +0 -267
- package/packages/scale-view/scaleView.vue +0 -2086
- package/packages/select/index.js +0 -30
- package/packages/select/src/CustomSelect/index.vue +0 -130
- package/packages/select/src/OptGroup.jsx +0 -11
- package/packages/select/src/Option.jsx +0 -11
- package/packages/select/src/PagerSelect/index.vue +0 -92
- package/packages/select/src/Select/Select.vue +0 -231
- package/packages/select/src/Select/index.js +0 -12
- package/packages/select/src/TableSelect/index.vue +0 -514
- package/packages/select-label/index.js +0 -14
- package/packages/select-label/label-classify.vue +0 -129
- package/packages/select-label/labelFormContent.vue +0 -787
- package/packages/select-label/select-label.vue +0 -597
- package/packages/select-person/index.js +0 -10
- package/packages/select-person/search-tree.vue +0 -373
- package/packages/select-person/select-person.vue +0 -1736
- package/packages/select-tag/index.js +0 -14
- package/packages/select-tag/label-classify.vue +0 -133
- package/packages/select-tag/labelFormContent.vue +0 -295
- package/packages/select-tag/select-label.vue +0 -274
- package/packages/shortcut-provider/index.js +0 -10
- package/packages/shortcut-provider/src/ShortcutProvider.vue +0 -33
- package/packages/shortcut-provider/src/constants/index.js +0 -4
- package/packages/shortcut-provider/src/hooks/index.js +0 -1
- package/packages/shortcut-provider/src/hooks/useShortcuts.js +0 -129
- package/packages/shortcut-provider/src/utils/index.js +0 -107
- package/packages/shortcut-setter/index.js +0 -12
- package/packages/shortcut-setter/src/ShortcutSetter.vue +0 -55
- package/packages/shortcut-setter/src/ShortcutSetterItem.vue +0 -97
- package/packages/shortcut-setter/src/utils/index.js +0 -63
- package/packages/skeleton/index.js +0 -12
- package/packages/skeleton/src/Skeleton.jsx +0 -11
- package/packages/slider/index.js +0 -12
- package/packages/slider/src/Slider.jsx +0 -11
- package/packages/slider-tree/hooks/useAsyncData.js +0 -53
- package/packages/slider-tree/index.js +0 -7
- package/packages/slider-tree/index.vue +0 -391
- package/packages/slider-tree/utils/index.js +0 -10
- package/packages/space/index.js +0 -12
- package/packages/space/src/Space.jsx +0 -11
- package/packages/spin/index.js +0 -12
- package/packages/spin/src/Spin.jsx +0 -11
- package/packages/statistic/index.js +0 -18
- package/packages/statistic/src/Countdown.jsx +0 -11
- package/packages/statistic/src/Statistic.jsx +0 -11
- package/packages/steps/index.js +0 -18
- package/packages/steps/src/Step.jsx +0 -11
- package/packages/steps/src/Steps.jsx +0 -11
- package/packages/switch/index.js +0 -12
- package/packages/switch/src/Switch.jsx +0 -11
- package/packages/table-filter/index.js +0 -27
- package/packages/table-filter/src/base-search-com/BaseSearch.vue +0 -2690
- package/packages/table-filter/src/classification/Classification-com.vue +0 -1765
- package/packages/table-filter/src/classification/search-class-name.vue +0 -266
- package/packages/table-filter/src/classification/search-professional-model.vue +0 -680
- package/packages/table-filter/src/components/TextOverTooltip.vue +0 -120
- package/packages/table-filter/src/components/age-com/index.vue +0 -205
- package/packages/table-filter/src/components/button-group/ButtonGroup.vue +0 -162
- package/packages/table-filter/src/components/button-icon/button-icon.js +0 -33
- package/packages/table-filter/src/components/button-icon/getBtnIcon.js +0 -34
- package/packages/table-filter/src/components/c-tree-select/tree-select.vue +0 -336
- package/packages/table-filter/src/components/checkbox-group/CheckboxGroup.vue +0 -53
- package/packages/table-filter/src/components/drop-button/drop-button.vue +0 -224
- package/packages/table-filter/src/components/drop-button/head-btn-icon.js +0 -33
- package/packages/table-filter/src/components/drop-view/drop-view.vue +0 -89
- package/packages/table-filter/src/components/multi-select/multi-select.vue +0 -242
- package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +0 -232
- package/packages/table-filter/src/components/range-age/index.vue +0 -171
- package/packages/table-filter/src/components/render-widget/components/CheckboxGroup.vue +0 -68
- package/packages/table-filter/src/components/render-widget/components/DateRangeQuick.vue +0 -216
- package/packages/table-filter/src/components/render-widget/components/Label.vue +0 -209
- package/packages/table-filter/src/components/render-widget/components/NumberRange.vue +0 -157
- package/packages/table-filter/src/components/render-widget/components/Select.vue +0 -62
- package/packages/table-filter/src/components/render-widget/components/SelectDynamic.vue +0 -287
- package/packages/table-filter/src/components/render-widget/components/SelectLabel.vue +0 -80
- package/packages/table-filter/src/components/render-widget/components/SelectTree.vue +0 -145
- package/packages/table-filter/src/components/render-widget/components/Text.vue +0 -58
- package/packages/table-filter/src/components/render-widget/components/index.js +0 -11
- package/packages/table-filter/src/components/render-widget/enums.js +0 -60
- package/packages/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +0 -282
- package/packages/table-filter/src/components/render-widget/index.vue +0 -150
- package/packages/table-filter/src/components/render-widget/mixins/dynamic-method.js +0 -185
- package/packages/table-filter/src/components/render-widget/mixins/label-method.js +0 -23
- package/packages/table-filter/src/components/render-widget/widgetCfgMaps.js +0 -354
- package/packages/table-filter/src/components/search-condition/SearchCondition.vue +0 -2016
- package/packages/table-filter/src/components/search-condition/fieldTypeList.js +0 -169
- package/packages/table-filter/src/components/search-filter/SearchFilter.vue +0 -280
- package/packages/table-filter/src/components/search-modal/set-classification.vue +0 -340
- package/packages/table-filter/src/components/table-modal/TableModal.vue +0 -477
- package/packages/table-filter/src/const/dataOptions.js +0 -43
- package/packages/table-filter/src/const/index.js +0 -1
- package/packages/table-filter/src/index.vue +0 -584
- package/packages/table-filter/src/mixins/mixins.js +0 -870
- package/packages/table-filter/src/mixins/out-quick-method.js +0 -123
- package/packages/table-filter/src/mixins/printNew.js +0 -190
- package/packages/table-filter/src/mixins/renderWidget.js +0 -122
- package/packages/table-filter/src/mixins/tableSearchCon.js +0 -128
- package/packages/table-filter/src/mixins/wordBookutils.js +0 -130
- package/packages/table-filter/src/quick-search/QuickSearch.vue +0 -2272
- package/packages/tabs/index.js +0 -18
- package/packages/tabs/src/TabPane.jsx +0 -11
- package/packages/tabs/src/Tabs.jsx +0 -11
- package/packages/tag/index.js +0 -21
- package/packages/tag/src/CheckableTag.jsx +0 -11
- package/packages/tag/src/Tag.jsx +0 -11
- package/packages/tag/src/TagGroup.vue +0 -622
- package/packages/time-picker/index.js +0 -12
- package/packages/time-picker/src/TimePicker.jsx +0 -11
- package/packages/timeline/index.js +0 -14
- package/packages/timeline/src/Item.jsx +0 -11
- package/packages/timeline/src/Timeline.jsx +0 -11
- package/packages/tooltip/index.js +0 -12
- package/packages/tooltip/src/Tooltip.jsx +0 -11
- package/packages/transfer/index.js +0 -12
- package/packages/transfer/src/Transfer.jsx +0 -11
- package/packages/tree/index.js +0 -18
- package/packages/tree/src/Tree.jsx +0 -11
- package/packages/tree/src/TreeNode.jsx +0 -11
- package/packages/tree-select/index.js +0 -18
- package/packages/tree-select/src/TreeNode.jsx +0 -11
- package/packages/tree-select/src/TreeSelect.jsx +0 -11
- package/packages/upload/chunk-upload/chunk-upload-new.vue +0 -1006
- package/packages/upload/chunk-upload/vod-chunk-upload.vue +0 -757
- package/packages/upload/chunk-upload/vod-upload-modal.vue +0 -100
- package/packages/upload/index.js +0 -12
- package/packages/upload/src/Upload.jsx +0 -11
- package/packages/verification-code/SlideVerify.vue +0 -306
- package/packages/verification-code/index.js +0 -17
- package/packages/verification-code/verification-code.vue +0 -147
- package/src/assets/img/nodata.png +0 -0
- package/src/assets/img/success.png +0 -0
- package/src/assets/img/video.png +0 -0
- package/src/assets/img/video_default_cover.png +0 -0
- package/src/assets/img/video_hover.png +0 -0
- package/src/assets/img/video_play_hover.png +0 -0
- package/src/component/player-vod/index.vue +0 -57
- package/src/component/player-vod/player.vue +0 -192
- package/src/component/player-vod/video-list.vue +0 -262
- package/src/component/player-vod/video-modal.vue +0 -128
- package/src/component/select-options/index.vue +0 -430
- package/src/component/select-pages/index.vue +0 -95
- package/src/component/svg/index.vue +0 -59
- package/src/core/create.js +0 -6
- package/src/core/event.js +0 -23
- package/src/core/table-methods.js +0 -447
- package/src/directive/flexibleResize.js +0 -162
- package/src/directive/preventReClick.js +0 -12
- package/src/directive/scroll.js +0 -230
- package/src/global/variable.js +0 -2
- package/src/style/normalize.css +0 -424
- package/src/style/style.less +0 -49
- package/src/utils/UniRTCv2.js +0 -627
- package/src/utils/chatFetch.js +0 -61
- package/src/utils/clickoutside.js +0 -75
- package/src/utils/crypto.js +0 -25
- package/src/utils/index.js +0 -103
- package/src/utils/kty-sdk.js +0 -582
- package/src/utils/kty.min-1.0.0.js +0 -14378
- package/src/utils/sip-device.js +0 -79
- package/src/utils/time-domain.js +0 -270
- package/src/utils/trtc.js +0 -1
- package/src/utils/utils-map.js +0 -485
- package/src/utils/vexutils.js +0 -836
package/src/utils/trtc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).TRTC=t()}(this,(function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var n=function(e){return e&&e.Math==Math&&e},r=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(t){return!0}},a=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,c={f:s&&!o.call({1:2},1)?function(e){var t=s(this,e);return!!t&&t.enumerable}:o},u=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},d={}.toString,l=function(e){return d.call(e).slice(8,-1)},h="".split,p=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==l(e)?h.call(e,""):Object(e)}:Object,f=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},m=function(e){return p(f(e))},_=function(e){return"object"==typeof e?null!==e:"function"==typeof e},v=function(e,t){if(!_(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!_(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!_(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!_(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},g={}.hasOwnProperty,S=function(e,t){return g.call(e,t)},y=r.document,b=_(y)&&_(y.createElement),k=function(e){return b?y.createElement(e):{}},T=!a&&!i((function(){return 7!=Object.defineProperty(k("div"),"a",{get:function(){return 7}}).a})),R=Object.getOwnPropertyDescriptor,E={f:a?R:function(e,t){if(e=m(e),t=v(t,!0),T)try{return R(e,t)}catch(n){}if(S(e,t))return u(!c.f.call(e,t),e[t])}},C=function(e){if(!_(e))throw TypeError(String(e)+" is not an object");return e},I=Object.defineProperty,w={f:a?I:function(e,t,n){if(C(e),t=v(t,!0),C(n),T)try{return I(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},A=a?function(e,t,n){return w.f(e,t,u(1,n))}:function(e,t,n){return e[t]=n,e},x=function(e,t){try{A(r,e,t)}catch(n){r[e]=t}return t},P=r["__core-js_shared__"]||x("__core-js_shared__",{}),D=Function.toString;"function"!=typeof P.inspectSource&&(P.inspectSource=function(e){return D.call(e)});var M,O,L,N=P.inspectSource,U=r.WeakMap,V="function"==typeof U&&/native code/.test(N(U)),j=t((function(e){(e.exports=function(e,t){return P[e]||(P[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.8.1",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),F=0,B=Math.random(),J=function(e){return"Symbol("+String(void 0===e?"":e)+")_"+(++F+B).toString(36)},H=j("keys"),G=function(e){return H[e]||(H[e]=J(e))},z={},W=r.WeakMap;if(V){var Q=P.state||(P.state=new W),q=Q.get,K=Q.has,Y=Q.set;M=function(e,t){return t.facade=e,Y.call(Q,e,t),t},O=function(e){return q.call(Q,e)||{}},L=function(e){return K.call(Q,e)}}else{var $=G("state");z[$]=!0,M=function(e,t){return t.facade=e,A(e,$,t),t},O=function(e){return S(e,$)?e[$]:{}},L=function(e){return S(e,$)}}var X,Z,ee={set:M,get:O,has:L,enforce:function(e){return L(e)?O(e):M(e,{})},getterFor:function(e){return function(t){var n;if(!_(t)||(n=O(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}}},te=t((function(e){var t=ee.get,n=ee.enforce,i=String(String).split("String");(e.exports=function(e,t,a,o){var s,c=!!o&&!!o.unsafe,u=!!o&&!!o.enumerable,d=!!o&&!!o.noTargetGet;"function"==typeof a&&("string"!=typeof t||S(a,"name")||A(a,"name",t),(s=n(a)).source||(s.source=i.join("string"==typeof t?t:""))),e!==r?(c?!d&&e[t]&&(u=!0):delete e[t],u?e[t]=a:A(e,t,a)):u?e[t]=a:x(t,a)})(Function.prototype,"toString",(function(){return"function"==typeof this&&t(this).source||N(this)}))})),ne=r,re=function(e){return"function"==typeof e?e:void 0},ie=function(e,t){return arguments.length<2?re(ne[e])||re(r[e]):ne[e]&&ne[e][t]||r[e]&&r[e][t]},ae=Math.ceil,oe=Math.floor,se=function(e){return isNaN(e=+e)?0:(e>0?oe:ae)(e)},ce=Math.min,ue=function(e){return e>0?ce(se(e),9007199254740991):0},de=Math.max,le=Math.min,he=function(e,t){var n=se(e);return n<0?de(n+t,0):le(n,t)},pe=function(e){return function(t,n,r){var i,a=m(t),o=ue(a.length),s=he(r,o);if(e&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===n)return e||s||0;return!e&&-1}},fe={includes:pe(!0),indexOf:pe(!1)},me=fe.indexOf,_e=function(e,t){var n,r=m(e),i=0,a=[];for(n in r)!S(z,n)&&S(r,n)&&a.push(n);for(;t.length>i;)S(r,n=t[i++])&&(~me(a,n)||a.push(n));return a},ve=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ge=ve.concat("length","prototype"),Se={f:Object.getOwnPropertyNames||function(e){return _e(e,ge)}},ye={f:Object.getOwnPropertySymbols},be=ie("Reflect","ownKeys")||function(e){var t=Se.f(C(e)),n=ye.f;return n?t.concat(n(e)):t},ke=function(e,t){for(var n=be(t),r=w.f,i=E.f,a=0;a<n.length;a++){var o=n[a];S(e,o)||r(e,o,i(t,o))}},Te=/#|\.prototype\./,Re=function(e,t){var n=Ce[Ee(e)];return n==we||n!=Ie&&("function"==typeof t?i(t):!!t)},Ee=Re.normalize=function(e){return String(e).replace(Te,".").toLowerCase()},Ce=Re.data={},Ie=Re.NATIVE="N",we=Re.POLYFILL="P",Ae=Re,xe=E.f,Pe=function(e,t){var n,i,a,o,s,c=e.target,u=e.global,d=e.stat;if(n=u?r:d?r[c]||x(c,{}):(r[c]||{}).prototype)for(i in t){if(o=t[i],a=e.noTargetGet?(s=xe(n,i))&&s.value:n[i],!Ae(u?i:c+(d?".":"#")+i,e.forced)&&void 0!==a){if(typeof o==typeof a)continue;ke(o,a)}(e.sham||a&&a.sham)&&A(o,"sham",!0),te(n,i,o,e)}},De=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e},Me=function(e,t,n){if(De(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}},Oe=function(e){return Object(f(e))},Le=Array.isArray||function(e){return"Array"==l(e)},Ne=!!Object.getOwnPropertySymbols&&!i((function(){return!String(Symbol())})),Ue=Ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ve=j("wks"),je=r.Symbol,Fe=Ue?je:je&&je.withoutSetter||J,Be=function(e){return S(Ve,e)||(Ne&&S(je,e)?Ve[e]=je[e]:Ve[e]=Fe("Symbol."+e)),Ve[e]},Je=Be("species"),He=function(e,t){var n;return Le(e)&&("function"!=typeof(n=e.constructor)||n!==Array&&!Le(n.prototype)?_(n)&&null===(n=n[Je])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===t?0:t)},Ge=[].push,ze=function(e){var t=1==e,n=2==e,r=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(c,u,d,l){for(var h,f,m=Oe(c),_=p(m),v=Me(u,d,3),g=ue(_.length),S=0,y=l||He,b=t?y(c,g):n||o?y(c,0):void 0;g>S;S++)if((s||S in _)&&(f=v(h=_[S],S,m),e))if(t)b[S]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:Ge.call(b,h)}else switch(e){case 4:return!1;case 7:Ge.call(b,h)}return a?-1:r||i?i:b}},We={forEach:ze(0),map:ze(1),filter:ze(2),some:ze(3),every:ze(4),find:ze(5),findIndex:ze(6),filterOut:ze(7)},Qe=ie("navigator","userAgent")||"",qe=r.process,Ke=qe&&qe.versions,Ye=Ke&&Ke.v8;Ye?Z=(X=Ye.split("."))[0]+X[1]:Qe&&(!(X=Qe.match(/Edge\/(\d+)/))||X[1]>=74)&&(X=Qe.match(/Chrome\/(\d+)/))&&(Z=X[1]);var $e=Z&&+Z,Xe=Be("species"),Ze=function(e){return $e>=51||!i((function(){var t=[];return(t.constructor={})[Xe]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},et=Object.defineProperty,tt={},nt=function(e){throw e},rt=function(e,t){if(S(tt,e))return tt[e];t||(t={});var n=[][e],r=!!S(t,"ACCESSORS")&&t.ACCESSORS,o=S(t,0)?t[0]:nt,s=S(t,1)?t[1]:void 0;return tt[e]=!!n&&!i((function(){if(r&&!a)return!0;var e={length:-1};r?et(e,1,{enumerable:!0,get:nt}):e[1]=1,n.call(e,o,s)}))},it=We.filter,at=Ze("filter"),ot=rt("filter");Pe({target:"Array",proto:!0,forced:!at||!ot},{filter:function(e){return it(this,e,arguments.length>1?arguments[1]:void 0)}});var st=We.map,ct=Ze("map"),ut=rt("map");Pe({target:"Array",proto:!0,forced:!ct||!ut},{map:function(e){return st(this,e,arguments.length>1?arguments[1]:void 0)}});var dt="\t\n\v\f\r \u2028\u2029\ufeff",lt="["+dt+"]",ht=RegExp("^"+lt+lt+"*"),pt=RegExp(lt+lt+"*$"),ft=function(e){return function(t){var n=String(f(t));return 1&e&&(n=n.replace(ht,"")),2&e&&(n=n.replace(pt,"")),n}},mt={start:ft(1),end:ft(2),trim:ft(3)},_t=mt.trim;function vt(e){return(vt="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 gt(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(r,i)}function St(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function o(e){gt(a,r,i,o,s,"next",e)}function s(e){gt(a,r,i,o,s,"throw",e)}o(void 0)}))}}function yt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bt(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)}}function kt(e,t,n){return t&&bt(e.prototype,t),n&&bt(e,n),e}function Tt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Rt(Object(n),!0).forEach((function(t){Tt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Rt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ct(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&&wt(e,t)}function It(e){return(It=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function wt(e,t){return(wt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function At(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function xt(e,t,n){return(xt=At()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&wt(i,n.prototype),i}).apply(null,arguments)}function Pt(e){var t="function"==typeof Map?new Map:void 0;return(Pt=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return xt(e,arguments,It(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),wt(r,e)})(e)}function Dt(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Mt(e){var t=At();return function(){var n,r=It(e);if(t){var i=It(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Dt(this,n)}}function Ot(e,t,n){return(Ot="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=It(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Lt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(c){i=!0,a=c}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||Ut(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nt(e){return function(e){if(Array.isArray(e))return Vt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Ut(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ut(e,t){if(e){if("string"==typeof e)return Vt(e,t);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)?Vt(e,t):void 0}}function Vt(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}function jt(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=Ut(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}Pe({target:"String",proto:!0,forced:function(e){return i((function(){return!!dt[e]()||"
"!="
"[e]()||dt[e].name!==e}))}("trim")},{trim:function(){return _t(this)}});t((function(e){var t=function(e){var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(C){s=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var i=t&&t.prototype instanceof l?t:l,a=Object.create(i.prototype),o=new T(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return E()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=y(o,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("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===d)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}(e,n,o),a}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(C){return{type:"throw",arg:C}}}e.wrap=c;var d={};function l(){}function h(){}function p(){}var f={};f[i]=function(){return this};var m=Object.getPrototypeOf,_=m&&m(m(R([])));_&&_!==t&&n.call(_,i)&&(f=_);var v=p.prototype=l.prototype=Object.create(f);function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var c=u(e[i],e,a);if("throw"!==c.type){var d=c.arg,l=d.value;return l&&"object"==typeof l&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(l).then((function(e){d.value=e,o(d)}),(function(e){return r("throw",e,o,s)}))}s(c.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function y(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,y(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=u(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;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,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}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 k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(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,a=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 a.next=a}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=v.constructor=p,p.constructor=h,h.displayName=s(p,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,s(e,o,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(S.prototype),S.prototype[a]=function(){return this},e.AsyncIterator=S,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new S(c(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},g(v),s(v,o,"Generator"),v[i]=function(){return this},v.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,T.prototype={constructor:T,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(k),!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 o.type="throw",o.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 a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.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 a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(o)},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),k(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;k(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),d}},e}(e.exports);try{regeneratorRuntime=t}catch(n){Function("r","regeneratorRuntime = r")(t)}}));let Ft=!0,Bt=!0;function Jt(e,t,n){const r=e.match(t);return r&&r.length>=n&&parseInt(r[n],10)}function Ht(e,t,n){if(!e.RTCPeerConnection)return;const r=e.RTCPeerConnection.prototype,i=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return i.apply(this,arguments);const a=e=>{const t=n(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,a),i.apply(this,[e,a])};const a=r.removeEventListener;r.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(n))return a.apply(this,arguments);const r=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function Gt(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Ft=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function zt(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Bt=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Wt(){if("object"==typeof window){if(Ft)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Qt(e,t){Bt&&console.warn(e+" is deprecated, please use "+t+" instead.")}function qt(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.mozGetUserMedia)t.browser="firefox",t.version=Jt(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=Jt(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=Jt(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=Jt(n.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Kt(e){return"[object Object]"===Object.prototype.toString.call(e)}function Yt(e){return Kt(e)?Object.keys(e).reduce((function(t,n){const r=Kt(e[n]),i=r?Yt(e[n]):e[n],a=r&&!Object.keys(i).length;return void 0===i||a?t:Object.assign(t,{[n]:i})}),{}):e}function $t(e,t,n){const r=n?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const a=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)}),a.forEach(t=>{e.forEach(n=>{n.type===r&&n.trackId===t.id&&function e(t,n,r){n&&!r.has(n.id)&&(r.set(n.id,n),Object.keys(n).forEach(i=>{i.endsWith("Id")?e(t,t.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(n=>{e(t,t.get(n),r)})}))}(e,n,i)})}),i}const Xt=Wt;function Zt(e){const t=e&&e.navigator;if(!t.mediaDevices)return;const n=qt(e),r=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const r="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==r.exact&&"number"==typeof r.exact&&(r.min=r.max=r.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==r.ideal){t.optional=t.optional||[];let e={};"number"==typeof r.ideal?(e[i("min",n)]=r.ideal,t.optional.push(e),e={},e[i("max",n)]=r.ideal,t.optional.push(e)):(e[i("",n)]=r.ideal,t.optional.push(e))}void 0!==r.exact&&"number"!=typeof r.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",n)]=r.exact):["min","max"].forEach(e=>{void 0!==r[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,n)]=r[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(n.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=r(e.audio)}if(e&&"object"==typeof e.video){let a=e.video.facingMode;a=a&&("object"==typeof a?a:{ideal:a});const o=n.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!t.mediaDevices.getSupportedConstraints||!t.mediaDevices.getSupportedConstraints().facingMode||o)){let n;if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?n=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(n=["front"]),n)return t.mediaDevices.enumerateDevices().then(t=>{let o=(t=t.filter(e=>"videoinput"===e.kind)).find(e=>n.some(t=>e.label.toLowerCase().includes(t)));return!o&&t.length&&n.includes("back")&&(o=t[t.length-1]),o&&(e.video.deviceId=a.exact?{exact:o.deviceId}:{ideal:o.deviceId}),e.video=r(e.video),Xt("chrome: "+JSON.stringify(e)),i(e)})}e.video=r(e.video)}return Xt("chrome: "+JSON.stringify(e)),i(e)},a=function(e){return n.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(t.getUserMedia=function(e,n,r){i(e,e=>{t.webkitGetUserMedia(e,n,e=>{r&&r(a(e))})})}.bind(t),t.mediaDevices.getUserMedia){const e=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(t){return i(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(a(e))))}}}function en(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function tn(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const i=new Event("track");i.track=n.track,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)}),t.stream.getTracks().forEach(n=>{let r;r=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const i=new Event("track");i.track=n,i.receiver=r,i.transceiver={receiver:r},i.streams=[t.stream],this.dispatchEvent(i)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Ht(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function nn(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){let i=n.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const r=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){r.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function rn(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,r]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach(e=>{const n={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{n[t]=e.stat(t)}),t[n.id]=n}),t},a=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const r=function(e){n(a(i(e)))};return t.apply(this,[r,e])}return new Promise((e,n)=>{t.apply(this,[function(t){e(a(i(t)))},n])}).then(n,r)}}function an(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>$t(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Ht(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>$t(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,r;return this.getSenders().forEach(n=>{n.track===e&&(t?r=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?r=!0:n=t),t.track===e)),r||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function on(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const r=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(r)&&this._shimmedLocalStreams[n.id].push(r):this._shimmedLocalStreams[n.id]=[n,r],r};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();n.apply(this,arguments);const r=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(r)};const r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),i.apply(this,arguments)}}function sn(e){if(!e.RTCPeerConnection)return;const t=qt(e);if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return on(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function a(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(i.id,"g"),r.id)}),new RTCSessionDescription({type:t.type,sdp:n})}function o(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const r=e._reverseStreams[t],i=e._streams[r.id];n=n.replace(new RegExp(r.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const r=[].slice.call(arguments,1);if(1!==r.length||!r[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const i=this.getSenders().find(e=>e.track===t);if(i)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const a=this._streams[n.id];if(a)a.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const r=new e.MediaStream([t]);this._streams[n.id]=r,this._reverseStreams[r.id]=n,this.addStream(r)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=a(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>a(this,e))}};e.RTCPeerConnection.prototype[t]=r[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=o(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:a(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function cn(e){const t=qt(e);if(!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),!e.RTCPeerConnection)return;const n=0===e.RTCPeerConnection.prototype.addIceCandidate.length;t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]}));const r=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return n||arguments[0]?t.version<78&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}function un(e){const t=qt(e);Ht(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}var dn=Object.freeze({__proto__:null,shimMediaStream:en,shimOnTrack:tn,shimGetSendersWithDtmf:nn,shimGetStats:rn,shimSenderReceiverGetStats:an,shimAddTrackRemoveTrackWithNative:on,shimAddTrackRemoveTrack:sn,shimPeerConnection:cn,fixNegotiationNeeded:un,shimGetUserMedia:Zt,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(n){return t(n).then(t=>{const r=n.video&&n.video.width,i=n.video&&n.video.height,a=n.video&&n.video.frameRate;return n.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},r&&(n.video.mandatory.maxWidth=r),i&&(n.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(n)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var ln=t((function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){var n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter((function(e){return 0===e.indexOf(n)}))},t.parseCandidate=function(e){for(var t,n={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":n.relatedAddress=t[r+1];break;case"rport":n.relatedPort=parseInt(t[r+1],10);break;case"tcptype":n.tcpType=t[r+1];break;case"ufrag":n.ufrag=t[r+1],n.usernameFragment=t[r+1];break;default:n[t[r]]=t[r+1]}return n},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,n={},r=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<r.length;i++)n[(t=r[i].trim().split("="))[0].trim()]=t[1];return n},t.writeFmtp=function(e){var t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+n+" "+r.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),n={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(n.attribute=e.substr(t+1,r-t-1),n.value=e.substr(r+1)):n.attribute=e.substr(t+1),n},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var n="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),n},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){var r=t.matchPrefix(e+n,"a=ice-ufrag:")[0],i=t.matchPrefix(e+n,"a=ice-pwd:")[0];return r&&i?{usernameFragment:r.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=t.splitLines(e)[0].split(" "),i=3;i<r.length;i++){var a=r[i],o=t.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(o){var s=t.parseRtpMap(o),c=t.matchPrefix(e,"a=fmtp:"+a+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(t.parseRtcpFb),n.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){n.headerExtensions.push(t.parseExtmap(e))})),n},t.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=n.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach((function(e){r+=t.writeRtpMap(e),r+=t.writeFmtp(e),r+=t.writeRtcpFb(e)}));var i=0;return n.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(r+="a=maxptime:"+i+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach((function(e){r+=t.writeExtmap(e)})),r},t.parseRtpEncodingParameters=function(e){var n,r=[],i=t.parseRtpParameters(e),a=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(n=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&n&&(t.rtx={ssrc:n}),r.push(t),a&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&c&&r.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){var n={},r=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=0===i.length;var a=t.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},t.parseMsid=function(e){var n,r=t.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(n=i[0].value.split(" "))[0],track:n[1]}:void 0},t.parseSctpDescription=function(e){var n,r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(n=parseInt(i[0].substr(19),10)),isNaN(n)&&(n=65536);var a=t.matchPrefix(e,"a=sctp-port:");if(a.length>0)return{port:parseInt(a[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(t.matchPrefix(e,"a=sctpmap:").length>0){var o=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(o[0],10),protocol:o[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){var n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,n,r){var i=void 0!==n?n:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,n,r,i){var a=t.writeRtpDescription(e.kind,n);if(a+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),a+="a=mid:"+e.mid+"\r\n",e.direction?a+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";a+="a="+o,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+o,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+o,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),a},t.getDirection=function(e,n){for(var r=t.splitLines(e),i=0;i<r.length;i++)switch(r[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[i].substr(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var n=t.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){var n=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=t.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},e.exports=t}));function hn(e,t,n,r,i){var a=ln.writeRtpDescription(e.kind,t);if(a+=ln.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=ln.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":i||"active"),a+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var o=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=o;var s="msid:"+(r?r.id:"-")+" "+o+"\r\n";a+="a="+s,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+ln.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+ln.localCName+"\r\n"),a}function pn(e,t){var n={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(e,t){e=parseInt(e,10);for(var n=0;n<t.length;n++)if(t[n].payloadType===e||t[n].preferredPayloadType===e)return t[n]},i=function(e,t,n,i){var a=r(e.parameters.apt,n),o=r(t.parameters.apt,i);return a&&o&&a.name.toLowerCase()===o.name.toLowerCase()};return e.codecs.forEach((function(r){for(var a=0;a<t.codecs.length;a++){var o=t.codecs[a];if(r.name.toLowerCase()===o.name.toLowerCase()&&r.clockRate===o.clockRate){if("rtx"===r.name.toLowerCase()&&r.parameters&&o.parameters.apt&&!i(r,o,e.codecs,t.codecs))continue;(o=JSON.parse(JSON.stringify(o))).numChannels=Math.min(r.numChannels,o.numChannels),n.codecs.push(o),o.rtcpFeedback=o.rtcpFeedback.filter((function(e){for(var t=0;t<r.rtcpFeedback.length;t++)if(r.rtcpFeedback[t].type===e.type&&r.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var r=0;r<t.headerExtensions.length;r++){var i=t.headerExtensions[r];if(e.uri===i.uri){n.headerExtensions.push(i);break}}})),n}function fn(e,t,n){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(n)}function mn(e,t){var n=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return n||e.addRemoteCandidate(t),!n}function _n(e,t){var n=new Error(t);return n.name=e,n.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],n}var vn=function(e,t){function n(t,n){n.addTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,n,r,i){var a=new Event("track");a.track=n,a.receiver=r,a.transceiver={receiver:r},a.streams=i,e.setTimeout((function(){t._dispatchEvent("track",a)}))}var i=function(n){var r=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){r[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",n=JSON.parse(JSON.stringify(n||{})),this.usingBundle="max-bundle"===n.bundlePolicy,"negotiate"===n.rtcpMuxPolicy)throw _n("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(n.rtcpMuxPolicy||(n.rtcpMuxPolicy="require"),n.iceTransportPolicy){case"all":case"relay":break;default:n.iceTransportPolicy="all"}switch(n.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:n.bundlePolicy="balanced"}if(n.iceServers=function(e,t){var n=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter((function(e){return 0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!n?(n=!0,!0):0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp")})),delete e.url,e.urls=i?r[0]:r,!!r.length}}))}(n.iceServers||[],t),this._iceGatherers=[],n.iceCandidatePoolSize)for(var a=n.iceCandidatePoolSize;a>0;a--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:n.iceServers,gatherPolicy:n.iceTransportPolicy}));else n.iceCandidatePoolSize=0;this._config=n,this.transceivers=[],this._sdpSessionId=ln.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var n=this.transceivers.length>0,r={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&n)r.iceTransport=this.transceivers[0].iceTransport,r.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();r.iceTransport=i.iceTransport,r.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(r),r},i.prototype.addTrack=function(t,n){if(this._isClosed)throw _n("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var r;if(this.transceivers.find((function(e){return e.track===t})))throw _n("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(r=this.transceivers[i]);return r||(r=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(n)&&this.localStreams.push(n),r.track=t,r.stream=n,r.rtpSender=new e.RTCRtpSender(t,r.dtlsTransport),r.rtpSender},i.prototype.addStream=function(e){var n=this;if(t>=15025)e.getTracks().forEach((function(t){n.addTrack(t,e)}));else{var r=e.clone();e.getTracks().forEach((function(e,t){var n=r.getTracks()[t];e.addEventListener("enabled",(function(e){n.enabled=e.enabled}))})),r.getTracks().forEach((function(e){n.addTrack(e,r)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw _n("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var n=this.transceivers.find((function(e){return e.rtpSender===t}));if(!n)throw _n("InvalidAccessError","Sender was not created by this connection.");var r=n.stream;n.rtpSender.stop(),n.rtpSender=null,n.track=null,n.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(r)&&this.localStreams.indexOf(r)>-1&&this.localStreams.splice(this.localStreams.indexOf(r),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var n=t.getSenders().find((function(t){return t.track===e}));n&&t.removeTrack(n)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,n){var r=this;if(n&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var n=!e.candidate||0===Object.keys(e.candidate).length;i.state=n?"completed":"gathering",null!==r.transceivers[t].bufferedCandidateEvents&&r.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,n){var r=this,i=this.transceivers[n].iceGatherer;if(!i.onlocalcandidate){var a=this.transceivers[n].bufferedCandidateEvents;this.transceivers[n].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[n].bufferCandidates),i.onlocalcandidate=function(e){if(!(r.usingBundle&&n>0)){var a=new Event("icecandidate");a.candidate={sdpMid:t,sdpMLineIndex:n};var o=e.candidate,s=!o||0===Object.keys(o).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),o.component=1,o.ufrag=i.getLocalParameters().usernameFragment;var c=ln.writeCandidate(o);a.candidate=Object.assign(a.candidate,ln.parseCandidate(c)),a.candidate.candidate=c,a.candidate.toJSON=function(){return{candidate:a.candidate.candidate,sdpMid:a.candidate.sdpMid,sdpMLineIndex:a.candidate.sdpMLineIndex,usernameFragment:a.candidate.usernameFragment}}}var u=ln.getMediaSections(r._localDescription.sdp);u[a.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",r._localDescription.sdp=ln.getDescription(r._localDescription.sdp)+u.join("");var d=r.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==r.iceGatheringState&&(r.iceGatheringState="gathering",r._emitGatheringStateChange()),s||r._dispatchEvent("icecandidate",a),d&&(r._dispatchEvent("icecandidate",new Event("icecandidate")),r.iceGatheringState="complete",r._emitGatheringStateChange())}},e.setTimeout((function(){a.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,n=new e.RTCIceTransport(null);n.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var r=new e.RTCDtlsTransport(n);return r.ondtlsstatechange=function(){t._updateConnectionState()},r.onerror=function(){Object.defineProperty(r,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:n,dtlsTransport:r}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var n=this.transceivers[e].iceTransport;n&&(delete n.onicestatechange,delete this.transceivers[e].iceTransport);var r=this.transceivers[e].dtlsTransport;r&&(delete r.ondtlsstatechange,delete r.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,n,r){var i=pn(e.localCapabilities,e.remoteCapabilities);n&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:ln.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),r&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,n,r=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(_n("TypeError",'Unsupported type "'+e.type+'"'));if(!fn("setLocalDescription",e.type,r.signalingState)||r._isClosed)return Promise.reject(_n("InvalidStateError","Can not set local "+e.type+" in state "+r.signalingState));if("offer"===e.type)t=ln.splitSections(e.sdp),n=t.shift(),t.forEach((function(e,t){var n=ln.parseRtpParameters(e);r.transceivers[t].localCapabilities=n})),r.transceivers.forEach((function(e,t){r._gather(e.mid,t)}));else if("answer"===e.type){t=ln.splitSections(r._remoteDescription.sdp),n=t.shift();var i=ln.matchPrefix(n,"a=ice-lite").length>0;t.forEach((function(e,t){var a=r.transceivers[t],o=a.iceGatherer,s=a.iceTransport,c=a.dtlsTransport,u=a.localCapabilities,d=a.remoteCapabilities;if(!(ln.isRejected(e)&&0===ln.matchPrefix(e,"a=bundle-only").length)&&!a.rejected){var l=ln.getIceParameters(e,n),h=ln.getDtlsParameters(e,n);i&&(h.role="server"),r.usingBundle&&0!==t||(r._gather(a.mid,t),"new"===s.state&&s.start(o,l,i?"controlling":"controlled"),"new"===c.state&&c.start(h));var p=pn(u,d);r._transceive(a,p.codecs.length>0,!1)}}))}return r._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?r._updateSignalingState("have-local-offer"):r._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var a=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(_n("TypeError",'Unsupported type "'+i.type+'"'));if(!fn("setRemoteDescription",i.type,a.signalingState)||a._isClosed)return Promise.reject(_n("InvalidStateError","Can not set remote "+i.type+" in state "+a.signalingState));var o={};a.remoteStreams.forEach((function(e){o[e.id]=e}));var s=[],c=ln.splitSections(i.sdp),u=c.shift(),d=ln.matchPrefix(u,"a=ice-lite").length>0,l=ln.matchPrefix(u,"a=group:BUNDLE ").length>0;a.usingBundle=l;var h=ln.matchPrefix(u,"a=ice-options:")[0];return a.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(r,c){var h=ln.splitLines(r),p=ln.getKind(r),f=ln.isRejected(r)&&0===ln.matchPrefix(r,"a=bundle-only").length,m=h[0].substr(2).split(" ")[2],_=ln.getDirection(r,u),v=ln.parseMsid(r),g=ln.getMid(r)||ln.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===m||"UDP/DTLS/SCTP"===m))a.transceivers[c]={mid:g,kind:p,protocol:m,rejected:!0};else{var S,y,b,k,T,R,E,C,I;!f&&a.transceivers[c]&&a.transceivers[c].rejected&&(a.transceivers[c]=a._createTransceiver(p,!0));var w,A,x=ln.parseRtpParameters(r);f||(w=ln.getIceParameters(r,u),(A=ln.getDtlsParameters(r,u)).role="client"),E=ln.parseRtpEncodingParameters(r);var P=ln.parseRtcpParameters(r),D=ln.matchPrefix(r,"a=end-of-candidates",u).length>0,M=ln.matchPrefix(r,"a=candidate:").map((function(e){return ln.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!f&&l&&c>0&&a.transceivers[c]&&(a._disposeIceAndDtlsTransports(c),a.transceivers[c].iceGatherer=a.transceivers[0].iceGatherer,a.transceivers[c].iceTransport=a.transceivers[0].iceTransport,a.transceivers[c].dtlsTransport=a.transceivers[0].dtlsTransport,a.transceivers[c].rtpSender&&a.transceivers[c].rtpSender.setTransport(a.transceivers[0].dtlsTransport),a.transceivers[c].rtpReceiver&&a.transceivers[c].rtpReceiver.setTransport(a.transceivers[0].dtlsTransport)),"offer"!==i.type||f){if("answer"===i.type&&!f){y=(S=a.transceivers[c]).iceGatherer,b=S.iceTransport,k=S.dtlsTransport,T=S.rtpReceiver,R=S.sendEncodingParameters,C=S.localCapabilities,a.transceivers[c].recvEncodingParameters=E,a.transceivers[c].remoteCapabilities=x,a.transceivers[c].rtcpParameters=P,M.length&&"new"===b.state&&(!d&&!D||l&&0!==c?M.forEach((function(e){mn(S.iceTransport,e)})):b.setRemoteCandidates(M)),l&&0!==c||("new"===b.state&&b.start(y,w,"controlling"),"new"===k.state&&k.start(A)),!pn(S.localCapabilities,S.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&S.sendEncodingParameters[0].rtx&&delete S.sendEncodingParameters[0].rtx,a._transceive(S,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),!T||"sendrecv"!==_&&"sendonly"!==_?delete S.rtpReceiver:(I=T.track,v?(o[v.stream]||(o[v.stream]=new e.MediaStream),n(I,o[v.stream]),s.push([I,T,o[v.stream]])):(o.default||(o.default=new e.MediaStream),n(I,o.default),s.push([I,T,o.default])))}}else{(S=a.transceivers[c]||a._createTransceiver(p)).mid=g,S.iceGatherer||(S.iceGatherer=a._createIceGatherer(c,l)),M.length&&"new"===S.iceTransport.state&&(!D||l&&0!==c?M.forEach((function(e){mn(S.iceTransport,e)})):S.iceTransport.setRemoteCandidates(M)),C=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(C.codecs=C.codecs.filter((function(e){return"rtx"!==e.name}))),R=S.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var O,L=!1;if("sendrecv"===_||"sendonly"===_){if(L=!S.rtpReceiver,T=S.rtpReceiver||new e.RTCRtpReceiver(S.dtlsTransport,p),L)I=T.track,v&&"-"===v.stream||(v?(o[v.stream]||(o[v.stream]=new e.MediaStream,Object.defineProperty(o[v.stream],"id",{get:function(){return v.stream}})),Object.defineProperty(I,"id",{get:function(){return v.track}}),O=o[v.stream]):(o.default||(o.default=new e.MediaStream),O=o.default)),O&&(n(I,O),S.associatedRemoteMediaStreams.push(O)),s.push([I,T,O])}else S.rtpReceiver&&S.rtpReceiver.track&&(S.associatedRemoteMediaStreams.forEach((function(t){var n=t.getTracks().find((function(e){return e.id===S.rtpReceiver.track.id}));n&&function(t,n){n.removeTrack(t),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(n,t)})),S.associatedRemoteMediaStreams=[]);S.localCapabilities=C,S.remoteCapabilities=x,S.rtpReceiver=T,S.rtcpParameters=P,S.sendEncodingParameters=R,S.recvEncodingParameters=E,a._transceive(a.transceivers[c],!1,L)}}})),void 0===a._dtlsRole&&(a._dtlsRole="offer"===i.type?"active":"passive"),a._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?a._updateSignalingState("have-remote-offer"):a._updateSignalingState("stable"),Object.keys(o).forEach((function(t){var n=o[t];if(n.getTracks().length){if(-1===a.remoteStreams.indexOf(n)){a.remoteStreams.push(n);var i=new Event("addstream");i.stream=n,e.setTimeout((function(){a._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];n.id===e[2].id&&r(a,t,i,[n])}))}})),s.forEach((function(e){e[2]||r(a,e[0],e[1],[])})),e.setTimeout((function(){a&&a.transceivers&&a.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var n=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",n)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var n=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",n)}},i.prototype.createOffer=function(){var n=this;if(n._isClosed)return Promise.reject(_n("InvalidStateError","Can not call createOffer after close"));var r=n.transceivers.filter((function(e){return"audio"===e.kind})).length,i=n.transceivers.filter((function(e){return"video"===e.kind})).length,a=arguments[0];if(a){if(a.mandatory||a.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==a.offerToReceiveAudio&&(r=!0===a.offerToReceiveAudio?1:!1===a.offerToReceiveAudio?0:a.offerToReceiveAudio),void 0!==a.offerToReceiveVideo&&(i=!0===a.offerToReceiveVideo?1:!1===a.offerToReceiveVideo?0:a.offerToReceiveVideo)}for(n.transceivers.forEach((function(e){"audio"===e.kind?--r<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));r>0||i>0;)r>0&&(n._createTransceiver("audio"),r--),i>0&&(n._createTransceiver("video"),i--);var o=ln.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.transceivers.forEach((function(r,i){var a=r.track,o=r.kind,s=r.mid||ln.generateIdentifier();r.mid=s,r.iceGatherer||(r.iceGatherer=n._createIceGatherer(i,n.usingBundle));var c=e.RTCRtpSender.getCapabilities(o);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),r.remoteCapabilities&&r.remoteCapabilities.codecs&&r.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(r.remoteCapabilities&&r.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=r.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];a&&t>=15019&&"video"===o&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),r.wantReceive&&(r.rtpReceiver=new e.RTCRtpReceiver(r.dtlsTransport,o)),r.localCapabilities=c,r.sendEncodingParameters=u})),"max-compat"!==n._config.bundlePolicy&&(o+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),o+="a=ice-options:trickle\r\n",n.transceivers.forEach((function(e,t){o+=hn(e,e.localCapabilities,"offer",e.stream,n._dtlsRole),o+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===n.iceGatheringState||0!==t&&n.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,o+="a="+ln.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(o+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:o});return Promise.resolve(s)},i.prototype.createAnswer=function(){var n=this;if(n._isClosed)return Promise.reject(_n("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==n.signalingState&&"have-local-pranswer"!==n.signalingState)return Promise.reject(_n("InvalidStateError","Can not call createAnswer in signalingState "+n.signalingState));var r=ln.writeSessionBoilerplate(n._sdpSessionId,n._sdpSessionVersion++);n.usingBundle&&(r+="a=group:BUNDLE "+n.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),r+="a=ice-options:trickle\r\n";var i=ln.getMediaSections(n._remoteDescription.sdp).length;n.transceivers.forEach((function(e,a){if(!(a+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?r+="m=application 0 DTLS/SCTP 5000\r\n":r+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?r+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(r+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(r+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var o;if(e.stream)"audio"===e.kind?o=e.stream.getAudioTracks()[0]:"video"===e.kind&&(o=e.stream.getVideoTracks()[0]),o&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=pn(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,r+=hn(e,s,"answer",e.stream,n._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(r+="a=rtcp-rsize\r\n")}}));var a=new e.RTCSessionDescription({type:"answer",sdp:r});return Promise.resolve(a)},i.prototype.addIceCandidate=function(e){var t,n=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(r,i){if(!n._remoteDescription)return i(_n("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var a=e.sdpMLineIndex;if(e.sdpMid)for(var o=0;o<n.transceivers.length;o++)if(n.transceivers[o].mid===e.sdpMid){a=o;break}var s=n.transceivers[a];if(!s)return i(_n("OperationError","Can not add ICE candidate"));if(s.rejected)return r();var c=Object.keys(e.candidate).length>0?ln.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return r();if(c.component&&1!==c.component)return r();if((0===a||a>0&&s.iceTransport!==n.transceivers[0].iceTransport)&&!mn(s.iceTransport,c))return i(_n("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=ln.getMediaSections(n._remoteDescription.sdp))[a]+="a="+(c.type?u:"end-of-candidates")+"\r\n",n._remoteDescription.sdp=ln.getDescription(n._remoteDescription.sdp)+t.join("")}else for(var d=0;d<n.transceivers.length&&(n.transceivers[d].rejected||(n.transceivers[d].iceTransport.addRemoteCandidate({}),(t=ln.getMediaSections(n._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",n._remoteDescription.sdp=ln.getDescription(n._remoteDescription.sdp)+t.join(""),!n.usingBundle));d++);r()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var n=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?n=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(n=e.rtpReceiver)})),!n)throw _n("InvalidAccessError","Invalid selector.");return n.getStats()}var r=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&r.push(e[t].getStats())}))})),Promise.all(r).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var n=e[t];if(n&&n.prototype&&n.prototype.getStats){var r=n.prototype.getStats;n.prototype.getStats=function(){return r.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(n){var r;e[n].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(r=e[n]).type]||r.type,t.set(n,e[n])})),t}))}}}));var a=["createOffer","createAnswer"];return a.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(a=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function gn(e){const t=e&&e.navigator,n=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return n(e).catch(e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function Sn(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function yn(e){const t=qt(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const n=new Event("enabled");n.enabled=e,this.dispatchEvent(n)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const n=vn(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){let n=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let t=e.urls||e.url;e.url&&!e.urls&&Qt("RTCIceServer.url","RTCIceServer.urls");const r="string"==typeof t;return r&&(t=[t]),t=t.filter(e=>{if(0===e.indexOf("stun:"))return!1;const t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!n?(n=!0,!0):t&&!n}),delete e.url,e.urls=r?t[0]:t,!!t.length}})}(e.iceServers,t.version),Wt("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function bn(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var kn=Object.freeze({__proto__:null,shimPeerConnection:yn,shimReplaceTrack:bn,shimGetUserMedia:gn,shimGetDisplayMedia:Sn});function Tn(e){const t=qt(e),n=e&&e.navigator,r=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,r){Qt("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),n.mediaDevices.getUserMedia(e).then(t,r)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},r&&r.prototype.getSettings){const t=r.prototype.getSettings;r.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(r&&r.prototype.applyConstraints){const t=r.prototype.applyConstraints;r.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function Rn(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function En(e){const t=qt(e);if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;if(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const n=e.RTCPeerConnection.prototype[t],r={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=r[t]})),t.version<68){const t=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?arguments[0]&&""===arguments[0].candidate?Promise.resolve():t.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},r=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,a]=arguments;return r.apply(this,[e||null]).then(e=>{if(t.version<53&&!i)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(r){if("TypeError"!==r.name)throw r;e.forEach((t,r)=>{e.set(r,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(i,a)}}function Cn(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function In(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Ht(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function wn(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Qt("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function An(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function xn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],n=e&&"sendEncodings"in e;n&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=t.apply(this,arguments);if(n){const{sender:t}=r,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return r})}function Pn(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Dn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function Mn(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var On=Object.freeze({__proto__:null,shimOnTrack:Rn,shimPeerConnection:En,shimSenderGetStats:Cn,shimReceiverGetStats:In,shimRemoveStream:wn,shimRTCDataChannel:An,shimAddTransceiver:xn,shimGetParameters:Pn,shimCreateOffer:Dn,shimCreateAnswer:Mn,shimGetUserMedia:Tn,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})}});function Ln(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...n){return n&&n.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Nn(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Un(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,r=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,n){const r=i.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r};t.setLocalDescription=s,s=function(e,t,n){const r=a.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.setRemoteDescription=s,s=function(e,t,n){const r=o.apply(this,[e]);return n?(r.then(t,n),Promise.resolve()):r},t.addIceCandidate=s}function Vn(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(jn(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,r){t.mediaDevices.getUserMedia(e).then(n,r)}.bind(t))}function jn(e){return e&&void 0!==e.video?Object.assign({},e,{video:Yt(e.video)}):e}function Fn(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let r=e.iceServers[n];!r.hasOwnProperty("urls")&&r.hasOwnProperty("url")?(Qt("RTCIceServer.url","RTCIceServer.urls"),r=JSON.parse(JSON.stringify(r)),r.urls=r.url,delete r.url,t.push(r)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Bn(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Jn(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}}function Hn(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Gn=Object.freeze({__proto__:null,shimLocalStreamsAPI:Ln,shimRemoteStreamsAPI:Nn,shimCallbacksAPI:Un,shimGetUserMedia:Vn,shimConstraints:jn,shimRTCIceServerUrls:Fn,shimTrackEventTransceiver:Bn,shimCreateOfferLegacy:Jn,shimAudioContext:Hn});function zn(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const n=new t(e),r=ln.parseCandidate(e.candidate),i=Object.assign(n,r);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Ht(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Wn(e){if(!e.RTCPeerConnection)return;const t=qt(e);"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=function(e){if(!e||!e.sdp)return!1;const t=ln.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=ln.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},r=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n},i=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n},a=function(e,n){let r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);const i=ln.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?r=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==n&&(r=2147483637),r},o=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(n(arguments[0])){const e=r(arguments[0]),t=i(e),n=a(arguments[0],e);let o;o=0===t&&0===n?Number.POSITIVE_INFINITY:0===t||0===n?Math.max(t,n):Math.min(t,n);const s={};Object.defineProperty(s,"maxMessageSize",{get:()=>o}),this._sctp=s}return o.apply(this,arguments)}}function Qn(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const r=arguments[0],i=r.length||r.size||r.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},Ht(e,"datachannel",e=>(t(e.channel,e.target),e))}function qn(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Kn(e){if(!e.RTCPeerConnection)return;const t=qt(e);if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){return e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")&&(e.sdp=e.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n")),n.apply(this,arguments)}}var Yn=Object.freeze({__proto__:null,shimRTCIceCandidate:zn,shimMaxMessageSize:Wn,shimSendThrowTypeError:Qn,shimConnectionState:qn,removeAllowExtmapMixed:Kn});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const n=Wt,r=qt(e),i={browserDetails:r,commonShim:Yn,extractVersion:Jt,disableLog:Gt,disableWarnings:zt};switch(r.browser){case"chrome":if(!dn||!cn||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),i;if(null===r.version)return n("Chrome shim can not determine version, not shimming."),i;n("adapter.js shimming chrome."),i.browserShim=dn,Zt(e),en(e),cn(e),tn(e),sn(e),nn(e),rn(e),an(e),un(e),zn(e),qn(e),Wn(e),Qn(e),Kn(e);break;case"firefox":if(!On||!En||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),i;n("adapter.js shimming firefox."),i.browserShim=On,Tn(e),En(e),Rn(e),wn(e),Cn(e),In(e),An(e),xn(e),Pn(e),Dn(e),Mn(e),zn(e),qn(e),Wn(e),Qn(e);break;case"edge":if(!kn||!yn||!t.shimEdge)return n("MS edge shim is not included in this adapter release."),i;n("adapter.js shimming edge."),i.browserShim=kn,gn(e),Sn(e),yn(e),bn(e),Wn(e),Qn(e);break;case"safari":if(!Gn||!t.shimSafari)return n("Safari shim is not included in this adapter release."),i;n("adapter.js shimming safari."),i.browserShim=Gn,Fn(e),Jn(e),Un(e),Ln(e),Nn(e),Bn(e),Vn(e),Hn(e),zn(e),Wn(e),Qn(e),Kn(e);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var $n=[].slice,Xn={},Zn=function(e,t,n){if(!(t in Xn)){for(var r=[],i=0;i<t;i++)r[i]="a["+i+"]";Xn[t]=Function("C,a","return new C("+r.join(",")+")")}return Xn[t](e,n)},er=Function.bind||function(e){var t=De(this),n=$n.call(arguments,1),r=function(){var i=n.concat($n.call(arguments));return this instanceof r?Zn(t,i.length,i):t.apply(e,i)};return _(t.prototype)&&(r.prototype=t.prototype),r};Pe({target:"Function",proto:!0},{bind:er});var tr=w.f,nr=Function.prototype,rr=nr.toString,ir=/^\s*function ([^ (]*)/;a&&!("name"in nr)&&tr(nr,"name",{configurable:!0,get:function(){try{return rr.call(this).match(ir)[1]}catch(e){return""}}});var ar=function(e,t,n){var r=v(t);r in e?w.f(e,r,u(0,n)):e[r]=n},or=Be("isConcatSpreadable"),sr=$e>=51||!i((function(){var e=[];return e[or]=!1,e.concat()[0]!==e})),cr=Ze("concat"),ur=function(e){if(!_(e))return!1;var t=e[or];return void 0!==t?!!t:Le(e)};Pe({target:"Array",proto:!0,forced:!sr||!cr},{concat:function(e){var t,n,r,i,a,o=Oe(this),s=He(o,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(ur(a=-1===t?o:arguments[t])){if(c+(i=ue(a.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<i;n++,c++)n in a&&ar(s,c,a[n])}else{if(c>=9007199254740991)throw TypeError("Maximum allowed index exceeded");ar(s,c++,a)}return s.length=c,s}});var dr=function(e,t){var n=[][e];return!!n&&i((function(){n.call(null,t||function(){throw 1},1)}))},lr=fe.indexOf,hr=[].indexOf,pr=!!hr&&1/[1].indexOf(1,-0)<0,fr=dr("indexOf"),mr=rt("indexOf",{ACCESSORS:!0,1:0});Pe({target:"Array",proto:!0,forced:pr||!fr||!mr},{indexOf:function(e){return pr?hr.apply(this,arguments)||0:lr(this,e,arguments.length>1?arguments[1]:void 0)}});var _r=Date.prototype,vr=_r.toString,gr=_r.getTime;new Date(NaN)+""!="Invalid Date"&&te(_r,"toString",(function(){var e=gr.call(this);return e==e?vr.call(this):"Invalid Date"}));var Sr,yr=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),t=n instanceof Array}catch(r){}return function(n,r){return C(n),function(e){if(!_(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}(r),t?e.call(n,r):n.__proto__=r,n}}():void 0),br=function(e,t,n){var r,i;return yr&&"function"==typeof(r=t.constructor)&&r!==n&&_(i=r.prototype)&&i!==n.prototype&&yr(e,i),e},kr=Object.keys||function(e){return _e(e,ve)},Tr=a?Object.defineProperties:function(e,t){C(e);for(var n,r=kr(t),i=r.length,a=0;i>a;)w.f(e,n=r[a++],t[n]);return e},Rr=ie("document","documentElement"),Er=G("IE_PROTO"),Cr=function(){},Ir=function(e){return"<script>"+e+"<\/script>"},wr=function(){try{Sr=document.domain&&new ActiveXObject("htmlfile")}catch(r){}var e,t;wr=Sr?function(e){e.write(Ir("")),e.close();var t=e.parentWindow.Object;return e=null,t}(Sr):((t=k("iframe")).style.display="none",Rr.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Ir("document.F=Object")),e.close(),e.F);for(var n=ve.length;n--;)delete wr.prototype[ve[n]];return wr()};z[Er]=!0;var Ar=Object.create||function(e,t){var n;return null!==e?(Cr.prototype=C(e),n=new Cr,Cr.prototype=null,n[Er]=e):n=wr(),void 0===t?n:Tr(n,t)},xr=Se.f,Pr=E.f,Dr=w.f,Mr=mt.trim,Or=r.Number,Lr=Or.prototype,Nr="Number"==l(Ar(Lr)),Ur=function(e){var t,n,r,i,a,o,s,c,u=v(e,!1);if("string"==typeof u&&u.length>2)if(43===(t=(u=Mr(u)).charCodeAt(0))||45===t){if(88===(n=u.charCodeAt(2))||120===n)return NaN}else if(48===t){switch(u.charCodeAt(1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+u}for(o=(a=u.slice(2)).length,s=0;s<o;s++)if((c=a.charCodeAt(s))<48||c>i)return NaN;return parseInt(a,r)}return+u};if(Ae("Number",!Or(" 0o1")||!Or("0b1")||Or("+0x1"))){for(var Vr,jr=function(e){var t=arguments.length<1?0:e,n=this;return n instanceof jr&&(Nr?i((function(){Lr.valueOf.call(n)})):"Number"!=l(n))?br(new Or(Ur(t)),n,jr):Ur(t)},Fr=a?xr(Or):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),Br=0;Fr.length>Br;Br++)S(Or,Vr=Fr[Br])&&!S(jr,Vr)&&Dr(jr,Vr,Pr(Or,Vr));jr.prototype=Lr,Lr.constructor=jr,te(r,"Number",jr)}var Jr=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Hr=G("IE_PROTO"),Gr=Object.prototype,zr=Jr?Object.getPrototypeOf:function(e){return e=Oe(e),S(e,Hr)?e[Hr]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?Gr:null},Wr=i((function(){zr(1)}));Pe({target:"Object",stat:!0,forced:Wr,sham:!Jr},{getPrototypeOf:function(e){return zr(Oe(e))}});var Qr={};Qr[Be("toStringTag")]="z";var qr="[object z]"===String(Qr),Kr=Be("toStringTag"),Yr="Arguments"==l(function(){return arguments}()),$r=qr?l:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(n){}}(t=Object(e),Kr))?n:Yr?l(t):"Object"==(r=l(t))&&"function"==typeof t.callee?"Arguments":r},Xr=qr?{}.toString:function(){return"[object "+$r(this)+"]"};qr||te(Object.prototype,"toString",Xr,{unsafe:!0});var Zr=ie("Reflect","apply"),ei=Function.apply,ti=!i((function(){Zr((function(){}))}));Pe({target:"Reflect",stat:!0,forced:ti},{apply:function(e,t,n){return De(e),C(n),Zr?Zr(e,t,n):ei.call(e,t,n)}});var ni=Be("match"),ri=function(e){var t;return _(e)&&(void 0!==(t=e[ni])?!!t:"RegExp"==l(e))},ii=function(){var e=C(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t};function ai(e,t){return RegExp(e,t)}var oi={UNSUPPORTED_Y:i((function(){var e=ai("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET:i((function(){var e=ai("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},si=Be("species"),ci=function(e){var t=ie(e),n=w.f;a&&t&&!t[si]&&n(t,si,{configurable:!0,get:function(){return this}})},ui=w.f,di=Se.f,li=ee.set,hi=Be("match"),pi=r.RegExp,fi=pi.prototype,mi=/a/g,_i=/a/g,vi=new pi(mi)!==mi,gi=oi.UNSUPPORTED_Y;if(a&&Ae("RegExp",!vi||gi||i((function(){return _i[hi]=!1,pi(mi)!=mi||pi(_i)==_i||"/a/i"!=pi(mi,"i")})))){for(var Si=function(e,t){var n,r=this instanceof Si,i=ri(e),a=void 0===t;if(!r&&i&&e.constructor===Si&&a)return e;vi?i&&!a&&(e=e.source):e instanceof Si&&(a&&(t=ii.call(e)),e=e.source),gi&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var o=br(vi?new pi(e,t):pi(e,t),r?this:fi,Si);return gi&&n&&li(o,{sticky:n}),o},yi=function(e){e in Si||ui(Si,e,{configurable:!0,get:function(){return pi[e]},set:function(t){pi[e]=t}})},bi=di(pi),ki=0;bi.length>ki;)yi(bi[ki++]);fi.constructor=Si,Si.prototype=fi,te(r,"RegExp",Si)}ci("RegExp");var Ti=RegExp.prototype.exec,Ri=String.prototype.replace,Ei=Ti,Ci=function(){var e=/a/,t=/b*/g;return Ti.call(e,"a"),Ti.call(t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Ii=oi.UNSUPPORTED_Y||oi.BROKEN_CARET,wi=void 0!==/()??/.exec("")[1];(Ci||wi||Ii)&&(Ei=function(e){var t,n,r,i,a=this,o=Ii&&a.sticky,s=ii.call(a),c=a.source,u=0,d=e;return o&&(-1===(s=s.replace("y","")).indexOf("g")&&(s+="g"),d=String(e).slice(a.lastIndex),a.lastIndex>0&&(!a.multiline||a.multiline&&"\n"!==e[a.lastIndex-1])&&(c="(?: "+c+")",d=" "+d,u++),n=new RegExp("^(?:"+c+")",s)),wi&&(n=new RegExp("^"+c+"$(?!\\s)",s)),Ci&&(t=a.lastIndex),r=Ti.call(o?n:a,d),o?r?(r.input=r.input.slice(u),r[0]=r[0].slice(u),r.index=a.lastIndex,a.lastIndex+=r[0].length):a.lastIndex=0:Ci&&r&&(a.lastIndex=a.global?r.index+r[0].length:t),wi&&r&&r.length>1&&Ri.call(r[0],n,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(r[i]=void 0)})),r});var Ai=Ei;Pe({target:"RegExp",proto:!0,forced:/./.exec!==Ai},{exec:Ai});var xi=RegExp.prototype,Pi=xi.toString,Di=i((function(){return"/a/b"!=Pi.call({source:"a",flags:"b"})})),Mi="toString"!=Pi.name;(Di||Mi)&&te(RegExp.prototype,"toString",(function(){var e=C(this),t=String(e.source),n=e.flags;return"/"+t+"/"+String(void 0===n&&e instanceof RegExp&&!("flags"in xi)?ii.call(e):n)}),{unsafe:!0});var Oi=Be("species"),Li=!i((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")})),Ni="$0"==="a".replace(/./,"$0"),Ui=Be("replace"),Vi=!!/./[Ui]&&""===/./[Ui]("a","$0"),ji=!i((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var n="ab".split(e);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),Fi=function(e,t,n,r){var a=Be(e),o=!i((function(){var t={};return t[a]=function(){return 7},7!=""[e](t)})),s=o&&!i((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[Oi]=function(){return n},n.flags="",n[a]=/./[a]),n.exec=function(){return t=!0,null},n[a](""),!t}));if(!o||!s||"replace"===e&&(!Li||!Ni||Vi)||"split"===e&&!ji){var c=/./[a],u=n(a,""[e],(function(e,t,n,r,i){return t.exec===Ai?o&&!i?{done:!0,value:c.call(t,n,r)}:{done:!0,value:e.call(n,t,r)}:{done:!1}}),{REPLACE_KEEPS_$0:Ni,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:Vi}),d=u[0],l=u[1];te(String.prototype,e,d),te(RegExp.prototype,a,2==t?function(e,t){return l.call(e,this,t)}:function(e){return l.call(e,this)})}r&&A(RegExp.prototype[a],"sham",!0)},Bi=function(e){return function(t,n){var r,i,a=String(f(t)),o=se(n),s=a.length;return o<0||o>=s?e?"":void 0:(r=a.charCodeAt(o))<55296||r>56319||o+1===s||(i=a.charCodeAt(o+1))<56320||i>57343?e?a.charAt(o):r:e?a.slice(o,o+2):i-56320+(r-55296<<10)+65536}},Ji={codeAt:Bi(!1),charAt:Bi(!0)},Hi=Ji.charAt,Gi=function(e,t,n){return t+(n?Hi(e,t).length:1)},zi=function(e,t){var n=e.exec;if("function"==typeof n){var r=n.call(e,t);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==l(e))throw TypeError("RegExp#exec called on incompatible receiver");return Ai.call(e,t)};Fi("match",1,(function(e,t,n){return[function(t){var n=f(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=C(e),a=String(this);if(!i.global)return zi(i,a);var o=i.unicode;i.lastIndex=0;for(var s,c=[],u=0;null!==(s=zi(i,a));){var d=String(s[0]);c[u]=d,""===d&&(i.lastIndex=Gi(a,ue(i.lastIndex),o)),u++}return 0===u?null:c}]}));var Wi=Math.max,Qi=Math.min,qi=Math.floor,Ki=/\$([$&'`]|\d\d?|<[^>]*>)/g,Yi=/\$([$&'`]|\d\d?)/g;Fi("replace",2,(function(e,t,n,r){var i=r.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,a=r.REPLACE_KEEPS_$0,o=i?"$":"$0";return[function(n,r){var i=f(this),a=null==n?void 0:n[e];return void 0!==a?a.call(n,i,r):t.call(String(i),n,r)},function(e,r){if(!i&&a||"string"==typeof r&&-1===r.indexOf(o)){var c=n(t,e,this,r);if(c.done)return c.value}var u=C(e),d=String(this),l="function"==typeof r;l||(r=String(r));var h=u.global;if(h){var p=u.unicode;u.lastIndex=0}for(var f=[];;){var m=zi(u,d);if(null===m)break;if(f.push(m),!h)break;""===String(m[0])&&(u.lastIndex=Gi(d,ue(u.lastIndex),p))}for(var _,v="",g=0,S=0;S<f.length;S++){m=f[S];for(var y=String(m[0]),b=Wi(Qi(se(m.index),d.length),0),k=[],T=1;T<m.length;T++)k.push(void 0===(_=m[T])?_:String(_));var R=m.groups;if(l){var E=[y].concat(k,b,d);void 0!==R&&E.push(R);var I=String(r.apply(void 0,E))}else I=s(y,d,b,k,R,r);b>=g&&(v+=d.slice(g,b)+I,g=b+y.length)}return v+d.slice(g)}];function s(e,n,r,i,a,o){var s=r+e.length,c=i.length,u=Yi;return void 0!==a&&(a=Oe(a),u=Ki),t.call(o,u,(function(t,o){var u;switch(o.charAt(0)){case"$":return"$";case"&":return e;case"`":return n.slice(0,r);case"'":return n.slice(s);case"<":u=a[o.slice(1,-1)];break;default:var d=+o;if(0===d)return t;if(d>c){var l=qi(d/10);return 0===l?t:l<=c?void 0===i[l-1]?o.charAt(1):i[l-1]+o.charAt(1):t}u=i[d-1]}return void 0===u?"":u}))}}));var $i=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};Fi("search",1,(function(e,t,n){return[function(t){var n=f(this),r=null==t?void 0:t[e];return void 0!==r?r.call(t,n):new RegExp(t)[e](String(n))},function(e){var r=n(t,e,this);if(r.done)return r.value;var i=C(e),a=String(this),o=i.lastIndex;$i(o,0)||(i.lastIndex=0);var s=zi(i,a);return $i(i.lastIndex,o)||(i.lastIndex=o),null===s?-1:s.index}]}));var Xi=Be("species"),Zi=function(e,t){var n,r=C(e).constructor;return void 0===r||null==(n=C(r)[Xi])?t:De(n)},ea=[].push,ta=Math.min,na=!i((function(){return!RegExp(4294967295,"y")}));Fi("split",2,(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=String(f(this)),i=void 0===n?4294967295:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!ri(e))return t.call(r,e,i);for(var a,o,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(a=Ai.call(l,r))&&!((o=l.lastIndex)>d&&(c.push(r.slice(d,a.index)),a.length>1&&a.index<r.length&&ea.apply(c,a.slice(1)),s=a[0].length,d=o,c.length>=i));)l.lastIndex===a.index&&l.lastIndex++;return d===r.length?!s&&l.test("")||c.push(""):c.push(r.slice(d)),c.length>i?c.slice(0,i):c}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var i=f(this),a=null==t?void 0:t[e];return void 0!==a?a.call(t,i,n):r.call(String(i),t,n)},function(e,i){var a=n(r,e,this,i,r!==t);if(a.done)return a.value;var o=C(e),s=String(this),c=Zi(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(na?"y":"g"),l=new c(na?o:"^(?:"+o.source+")",d),h=void 0===i?4294967295:i>>>0;if(0===h)return[];if(0===s.length)return null===zi(l,s)?[s]:[];for(var p=0,f=0,m=[];f<s.length;){l.lastIndex=na?f:0;var _,v=zi(l,na?s:s.slice(f));if(null===v||(_=ta(ue(l.lastIndex+(na?0:f)),s.length))===p)f=Gi(s,f,u);else{if(m.push(s.slice(p,f)),m.length===h)return m;for(var g=1;g<=v.length-1;g++)if(m.push(v[g]),m.length===h)return m;f=p=_}}return m.push(s.slice(p)),m}]}),!na);var ra=mt.trim,ia=r.parseFloat,aa=1/ia(dt+"-0")!=-Infinity?function(e){var t=ra(String(e)),n=ia(t);return 0===n&&"-"==t.charAt(0)?-0:n}:ia;Pe({global:!0,forced:parseFloat!=aa},{parseFloat:aa});var oa=window.navigator&&window.navigator.userAgent||"",sa=/AppleWebKit\/([\d.]+)/i.exec(oa),ca=(sa&&parseFloat(sa.pop()),/iPad/i.test(oa)),ua=/iPhone/i.test(oa)&&!ca,da=/iPod/i.test(oa),la=ua||ca||da,ha=(la&&function(){var e=oa.match(/OS (\d+)_/i);e&&e[1]&&e[1]}(),/Android/i.test(oa)),pa=ha&&function(){var e=oa.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),fa=(ha&&/webkit/i.test(oa),/Firefox/i.test(oa)),ma=fa&&function(){var e=oa.match(/Firefox\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),_a=/Edge\//i.test(oa),va=_a&&function(){var e=oa.match(/Edge\/(\d+)/i);if(e&&e[1])return e[1]}(),ga=/Edg\//i.test(oa),Sa=ga&&function(){var e=oa.match(/Edg\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),ya=/SogouMobileBrowser\//i.test(oa),ba=ya&&function(){var e=oa.match(/SogouMobileBrowser\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),ka=/MetaSr\s/i.test(oa),Ta=ka&&function(){var e=oa.match(/MetaSr(\s\d+(\.\d+)+)/);return e&&e[1]?parseFloat(e[1]):null}(),Ra=/TBS\/\d+/i.test(oa),Ea=Ra&&function(){var e=oa.match(/TBS\/(\d+)/i);if(e&&e[1])return e[1]}(),Ca=/XWEB\/\d+/i.test(oa),Ia=Ca&&function(){var e=oa.match(/XWEB\/(\d+)/i);if(e&&e[1])return e[1]}(),wa=(/MSIE\s8\.0/.test(oa),/MSIE\/\d+/i.test(oa)&&function(){var e=/MSIE\s(\d+)\.\d/.exec(oa),t=e&&parseFloat(e[1]);!t&&/Trident\/7.0/i.test(oa)&&/rv:11.0/.test(oa)&&(t=11)}(),/(micromessenger|webbrowser)/i.test(oa)),Aa=wa&&function(){var e=oa.match(/MicroMessenger\/(\d+)/i);if(e&&e[1])return e[1]}(),xa=!Ra&&/MQQBrowser\/\d+/i.test(oa)&&/COVC\/\d+/i.test(oa),Pa=!Ra&&/MQQBrowser\/\d+/i.test(oa)&&!/COVC\/\d+/i.test(oa),Da=(Pa||xa)&&function(){var e=oa.match(/ MQQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Ma=!Ra&&/ QQBrowser\/\d+/i.test(oa),Oa=Ma&&function(){var e=oa.match(/ QQBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),La=!Ra&&/QQBrowserLite\/\d+/i.test(oa),Na=La&&function(){var e=oa.match(/QQBrowserLite\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Ua=!Ra&&/MQBHD\/\d+/i.test(oa),Va=Ua&&function(){var e=oa.match(/MQBHD\/([\d.]+)/);return e&&e[1]?e[1]:null}(),ja=/Windows/i.test(oa),Fa=!la&&/MAC OS X/i.test(oa),Ba=!ha&&/Linux/i.test(oa),Ja=(/MicroMessenger/i.test(oa),/UCBrowser/i.test(oa)),Ha=(/Electron/i.test(oa),/MiuiBrowser/i.test(oa)),Ga=Ha&&function(){var e=oa.match(/MiuiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),za=/HuaweiBrowser/i.test(oa),Wa=/Huawei/i.test(oa),Qa=za&&function(){var e=oa.match(/HuaweiBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),qa=/SamsungBrowser/i.test(oa),Ka=qa&&function(){var e=oa.match(/SamsungBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Ya=/HeyTapBrowser/i.test(oa),$a=Ya&&function(){var e=oa.match(/HeyTapBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),Xa=/VivoBrowser/i.test(oa),Za=Xa&&function(){var e=oa.match(/VivoBrowser\/([\d.]+)/);return e&&e[1]?e[1]:null}(),eo=/Chrome/i.test(oa),to=!_a&&!ka&&!ya&&!Ra&&!Ca&&!ga&&!Ma&&!Ha&&!za&&!qa&&!Ya&&!Xa&&/Chrome/i.test(oa),no=to&&function(){var e=oa.match(/Chrome\/(\d+)/);return e&&e[1]?parseFloat(e[1]):null}(),ro=to&&function(){var e=oa.match(/Chrome\/([\d.]+)/);return e&&e[1]?e[1]:null}(),io=!eo&&!Pa&&!xa&&!La&&!Ua&&/Safari/i.test(oa),ao=io&&function(){var e=oa.match(/Version\/([\d.]+)/);return e&&e[1]?e[1]:null}(),oo=to?"Chrome/"+ro:io?"Safari/"+ao:"NotSupportedBrowser",so="file:"===location.protocol||"localhost"===location.hostname||/^\d+\.\d+\.\d+\.\d+$/.test(location.hostname),co="wss://bk.rtc.qq.com",uo="wss://trtc.rtc.qq.com",lo="wss://webrtc.qq.com",ho="".concat("wss://qcloud.rtc.qq.com",":443"),po="".concat(co,":443"),fo="",mo=function(e){return fo=e},_o=1,vo=2,go=20,So=21,yo="5Y2wZK8nANNAoVw6dSAHVjNxrD1ObBM2kBPV",bo="224d130c-7b5c-415b-aaa2-79c2eb5a6df2",ko=2,To="DISCONNECTED",Ro="CONNECTING",Eo="RECONNECTING",Co="CONNECTED",Io="join",wo="delta-join",Ao="rejoin",xo="leave",Po="delta-leave",Do="publish",Mo="delta-publish",Oo="unpublish",Lo="subscribe",No="unsubscribe",Uo="uplink-connection",Vo="uplink-reconnection",jo="downlink-connection",Fo="downlink-reconnection",Bo="setLocalDescription",Jo="setRemoteDescription",Ho="iceConnectionState",Go="stream-initialize",zo="websocketConnectionState",Wo="websocketReconnectionState",Qo="update-stream",qo="recover-subscription",Ko="start-mix-transcode",Yo="stop-mix-transcode",$o="player-error",Xo="unsubscribe",Zo="subscribe_change",es={MANUAL:"manual",PRESET_LAYOUT:"preset-layout"},ts={REMOTE:"$PLACE_HOLDER_REMOTE$"},ns={IT_AUDIO_VIDEO:0,IT_PICTURE:2,IT_CANVAS:3,IT_PURE_AUDIO:4,IT_PURE_VIDEO:5},rs="String",is="Number",as="Boolean",os="Array",ss="audio",cs="video",us="auxiliary",ds="add",ls="remove",hs={unknown:0,wifi:1,"3g":2,"2g":3,"4g":4,wired:5},ps=-1,fs=0,ms=1,_s={INVALID_PARAMETER:4096,INVALID_OPERATION:4097,NOT_SUPPORTED:4098,DEVICE_NOT_FOUND:4099,SIGNAL_CHANNEL_SETUP_FAILED:16385,SIGNAL_CHANNEL_ERROR:16386,ICE_TRANSPORT_ERROR:16387,JOIN_ROOM_FAILED:16388,CREATE_OFFER_FAILED:16389,SIGNAL_CHANNEL_RECONNECTION_FAILED:16390,UPLINK_RECONNECTION_FAILED:16391,DOWNLINK_RECONNECTION_FAILED:16392,CLIENT_BANNED:16448,SERVER_TIMEOUT:16449,SUBSCRIPTION_TIMEOUT:16450,PLAY_NOT_ALLOWED:16451,DEVICE_AUTO_RECOVER_FAILED:16452,START_PUBLISH_CDN_FAILED:16453,STOP_PUBLISH_CDN_FAILED:16454,START_MIX_TRANSCODE_FAILED:16455,STOP_MIX_TRANSCODE_FAILED:16456,NOT_SUPPORTED_H264:16457,SWITCH_ROLE_FAILED:16458,UNKNOWN:65535},vs=function(e){Ct(n,e);var t=Mt(n);function n(e){var r,i=e.message,a=e.code,o=void 0===a?_s.UNKNOWN:a,s=e.extraCode,c=void 0===s?0:s;return yt(this,n),(r=t.call(this,i+" <".concat(function(e){for(var t in _s)if(_s[t]===e)return t;return"UNKNOWN"}(o)," 0x").concat(o.toString(16),"> https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/module-ErrorCode.html"))).code_=o,r.extraCode_=c,r.name="RtcError",r.message_=i,r}return kt(n,[{key:"getCode",value:function(){return this.code_}},{key:"getExtraCode",value:function(){return this.extraCode_}}]),n}(Pt(Error)),gs=function(e){var t=window.location.search.match(new RegExp("(\\?|&)"+e+"=([^&]*)(&|$)"));return t?decodeURIComponent(t[2]):""},Ss=function(){return gs("trtc_env")},ys=function(e){var t=e,n=gs("trtc_env");return n&&(t="wss://"+n+".rtc.qq.com:443"),t},bs=function(){return"".concat(fo||"https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_log")};function ks(){var e=navigator.userAgent,t=navigator.connection,n=e.match(/NetType\/\w+/)?e.match(/NetType\/\w+/)[0]:"";"3gnet"===(n=n.toLowerCase().replace("nettype/",""))&&(n="3g");var r=t&&t.type&&t.type.toLowerCase(),i=t&&t.effectiveType&&t.effectiveType.toLowerCase();"slow-2"===i&&(i="2g");var a=n||"unknown";if(r)switch(r){case"cellular":case"wimax":a=i||"unknown";break;case"wifi":a="wifi";break;case"ethernet":a="wired";break;case"none":case"other":case"unknown":a="unknown"}return Os.info("networkType:",a),a}var Ts=function(e){if(!e||"object"!==vt(e)||"[object Object]"!=Object.prototype.toString.call(e))return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Function.prototype.toString.call(n)===Function.prototype.toString.call(Object)};function Rs(e){var t=Math.round(e/2)+1;return t>6?13e3:1e3*function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return t<=1?r:e(t-1,r,n+r)}(t)}var Es=function(e){return"function"==typeof e},Cs=function(e){return void 0===e},Is=function(e){return"string"==typeof e},ws=function(e){return"number"==typeof e};function As(e){return Reflect.apply(Object.prototype.toString,e,[]).replace(/^\[object\s(\w+)\]$/,"$1").toLowerCase()}function xs(e,t){for(var n in e)if(t[n]&&"undefined"!==As(e[n])&&As(e[n])!==t[n].toLowerCase())return{ret:!1,message:"".concat(n," should be ").concat(t[n])};return{ret:!0}}function Ps(e){var t={};return t.urls="turn:".concat(e.url),Cs(e.username)||Cs(e.credential)||(t.username=e.username,t.credential=e.credential,t.credentialType="password",Cs(e.credentialType)||(t.credentialType=e.credentialType)),t}function Ds(){return Math.floor(performance.now())}function Ms(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"big";if(!Is(e))return 0;var n=e.split(".");return"big"===t?(Number(n[0])<<24|Number(n[1])<<16|Number(n[2])<<8|Number(n[3]))>>>0:(Number(n[3])<<24|Number(n[2])<<16|Number(n[1])<<8|Number(n[0]))>>>0}var Os=function(){var e=function(){},t=["trace","debug","info","warn","error"];function n(e,t){var n=e[t];if(Es(n.bind))return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(r){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function r(t){return"debug"===t&&(t="log"),"undefined"!==("undefined"==typeof console?"undefined":vt(console))&&(void 0!==console[t]?n(console,t):void 0!==console.log?n(console,"log"):e)}function i(e,n){for(var r=0;r<t.length;r++){var i=t[r];this[i]=this.methodFactory(i,e,n)}this.log=this.debug}function a(e,t,n){return function(){"undefined"!==("undefined"==typeof console?"undefined":vt(console))&&(i.call(this,t,n),this[e].apply(this,arguments))}}function o(e,t,n){return r(e)||a.apply(this,arguments)}function s(e,n,r){var a,s=this,c="loglevel";function u(){var e;if("undefined"!==("undefined"==typeof window?"undefined":vt(window))){try{e=window.localStorage[c]}catch(t){}return void 0===s.levels[e]&&(e=void 0),e}}e&&(c+=":"+e),s.name=e,s.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},s.methodFactory=r||o,s.getLevel=function(){return a},s.setLevel=function(n,r){if(Is(n)&&void 0!==s.levels[n.toUpperCase()]&&(n=s.levels[n.toUpperCase()]),!(ws(n)&&n>=0&&n<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(a=n,!1!==r&&function(e){var n=(t[e]||"silent").toUpperCase();if("undefined"!==("undefined"==typeof window?"undefined":vt(window)))try{window.localStorage[c]=n}catch(r){}}(n),i.call(s,n,e),"undefined"===("undefined"==typeof console?"undefined":vt(console))&&n<s.levels.SILENT)return"No console available for logging"},s.setDefaultLevel=function(e){u()||s.setLevel(e,!1)},s.enableAll=function(e){s.setLevel(s.levels.TRACE,e)},s.disableAll=function(e){s.setLevel(s.levels.SILENT,e)};var d=u();null==d&&(d=null==n?"WARN":n),s.setLevel(d,!1)}var c=new s,u={};c.getLogger=function(e){if(!Is(e)||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=u[e];return t||(t=u[e]=new s(e,c.getLevel(),c.methodFactory)),t};var d="undefined"!==("undefined"==typeof window?"undefined":vt(window))?window.log:void 0;return c.noConflict=function(){return"undefined"!==("undefined"==typeof window?"undefined":vt(window))&&window.log===c&&(window.log=d),c},c.getLoggers=function(){return u},c}();Pe({target:"Array",stat:!0},{isArray:Le});var Ls=[].join,Ns=p!=Object,Us=dr("join",",");Pe({target:"Array",proto:!0,forced:Ns||!Us},{join:function(e){return Ls.call(m(this),void 0===e?",":e)}});var Vs=Ze("slice"),js=rt("slice",{ACCESSORS:!0,0:0,1:2}),Fs=Be("species"),Bs=[].slice,Js=Math.max;Pe({target:"Array",proto:!0,forced:!Vs||!js},{slice:function(e,t){var n,r,i,a=m(this),o=ue(a.length),s=he(e,o),c=he(void 0===t?o:t,o);if(Le(a)&&("function"!=typeof(n=a.constructor)||n!==Array&&!Le(n.prototype)?_(n)&&null===(n=n[Fs])&&(n=void 0):n=void 0,n===Array||void 0===n))return Bs.call(a,s,c);for(r=new(void 0===n?Array:n)(Js(c-s,0)),i=0;s<c;s++,i++)s in a&&ar(r,i,a[s]);return r.length=i,r}});var Hs=We.some,Gs=dr("some"),zs=rt("some");Pe({target:"Array",proto:!0,forced:!Gs||!zs},{some:function(e){return Hs(this,e,arguments.length>1?arguments[1]:void 0)}});var Ws=Ze("splice"),Qs=rt("splice",{ACCESSORS:!0,0:0,1:2}),qs=Math.max,Ks=Math.min;Pe({target:"Array",proto:!0,forced:!Ws||!Qs},{splice:function(e,t){var n,r,i,a,o,s,c=Oe(this),u=ue(c.length),d=he(e,u),l=arguments.length;if(0===l?n=r=0:1===l?(n=0,r=u-d):(n=l-2,r=Ks(qs(se(t),0),u-d)),u+n-r>9007199254740991)throw TypeError("Maximum allowed length exceeded");for(i=He(c,r),a=0;a<r;a++)(o=d+a)in c&&ar(i,a,c[o]);if(i.length=r,n<r){for(a=d;a<u-r;a++)s=a+n,(o=a+r)in c?c[s]=c[o]:delete c[s];for(a=u;a>u-r+n;a--)delete c[a-1]}else if(n>r)for(a=u-r;a>d;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:delete c[s];for(a=0;a<n;a++)c[a+d]=arguments[a+2];return c.length=u-r+n,i}});var Ys="".repeat||function(e){var t=String(f(this)),n="",r=se(e);if(r<0||Infinity==r)throw RangeError("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n},$s=Math.ceil,Xs=function(e){return function(t,n,r){var i,a,o=String(f(t)),s=o.length,c=void 0===r?" ":String(r),u=ue(n);return u<=s||""==c?o:(i=u-s,(a=Ys.call(c,$s(i/c.length))).length>i&&(a=a.slice(0,i)),e?o+a:a+o)}},Zs={start:Xs(!1),end:Xs(!0)}.start,ec=Math.abs,tc=Date.prototype,nc=tc.getTime,rc=tc.toISOString,ic=i((function(){return"0385-07-25T07:06:39.999Z"!=rc.call(new Date(-50000000000001))}))||!i((function(){rc.call(new Date(NaN))}))?function(){if(!isFinite(nc.call(this)))throw RangeError("Invalid time value");var e=this.getUTCFullYear(),t=this.getUTCMilliseconds(),n=e<0?"-":e>9999?"+":"";return n+Zs(ec(e),n?6:4,0)+"-"+Zs(this.getUTCMonth()+1,2,0)+"-"+Zs(this.getUTCDate(),2,0)+"T"+Zs(this.getUTCHours(),2,0)+":"+Zs(this.getUTCMinutes(),2,0)+":"+Zs(this.getUTCSeconds(),2,0)+"."+Zs(t,3,0)+"Z"}:rc;Pe({target:"Date",proto:!0,forced:Date.prototype.toISOString!==ic},{toISOString:ic});var ac=E.f,oc=i((function(){ac(1)}));Pe({target:"Object",stat:!0,forced:!a||oc,sham:!a},{getOwnPropertyDescriptor:function(e,t){return ac(m(e),t)}});var sc=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},cc=Object.prototype.toString;function uc(e){return"[object Array]"===cc.call(e)}function dc(e){return void 0===e}function lc(e){return null!==e&&"object"==typeof e}function hc(e){return"[object Function]"===cc.call(e)}function pc(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),uc(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var fc={isArray:uc,isArrayBuffer:function(e){return"[object ArrayBuffer]"===cc.call(e)},isBuffer:function(e){return null!==e&&!dc(e)&&null!==e.constructor&&!dc(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:lc,isUndefined:dc,isDate:function(e){return"[object Date]"===cc.call(e)},isFile:function(e){return"[object File]"===cc.call(e)},isBlob:function(e){return"[object Blob]"===cc.call(e)},isFunction:hc,isStream:function(e){return lc(e)&&hc(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:pc,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,i=arguments.length;r<i;r++)pc(arguments[r],n);return t},deepMerge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]="object"==typeof n?e({},n):n}for(var r=0,i=arguments.length;r<i;r++)pc(arguments[r],n);return t},extend:function(e,t,n){return pc(t,(function(t,r){e[r]=n&&"function"==typeof t?sc(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}};function mc(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var _c=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(fc.isURLSearchParams(t))r=t.toString();else{var i=[];fc.forEach(t,(function(e,t){null!=e&&(fc.isArray(e)?t+="[]":e=[e],fc.forEach(e,(function(e){fc.isDate(e)?e=e.toISOString():fc.isObject(e)&&(e=JSON.stringify(e)),i.push(mc(t)+"="+mc(e))})))})),r=i.join("&")}if(r){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function vc(){this.handlers=[]}vc.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},vc.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},vc.prototype.forEach=function(e){fc.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var gc=vc,Sc=function(e,t,n){return fc.forEach(n,(function(n){e=n(e,t)})),e},yc=function(e){return!(!e||!e.__CANCEL__)},bc="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function kc(){throw new Error("setTimeout has not been defined")}function Tc(){throw new Error("clearTimeout has not been defined")}var Rc=kc,Ec=Tc;function Cc(e){if(Rc===setTimeout)return setTimeout(e,0);if((Rc===kc||!Rc)&&setTimeout)return Rc=setTimeout,setTimeout(e,0);try{return Rc(e,0)}catch(t){try{return Rc.call(null,e,0)}catch(t){return Rc.call(this,e,0)}}}"function"==typeof bc.setTimeout&&(Rc=setTimeout),"function"==typeof bc.clearTimeout&&(Ec=clearTimeout);var Ic,wc=[],Ac=!1,xc=-1;function Pc(){Ac&&Ic&&(Ac=!1,Ic.length?wc=Ic.concat(wc):xc=-1,wc.length&&Dc())}function Dc(){if(!Ac){var e=Cc(Pc);Ac=!0;for(var t=wc.length;t;){for(Ic=wc,wc=[];++xc<t;)Ic&&Ic[xc].run();xc=-1,t=wc.length}Ic=null,Ac=!1,function(e){if(Ec===clearTimeout)return clearTimeout(e);if((Ec===Tc||!Ec)&&clearTimeout)return Ec=clearTimeout,clearTimeout(e);try{Ec(e)}catch(t){try{return Ec.call(null,e)}catch(t){return Ec.call(this,e)}}}(e)}}function Mc(e,t){this.fun=e,this.array=t}Mc.prototype.run=function(){this.fun.apply(null,this.array)};function Oc(){}var Lc=Oc,Nc=Oc,Uc=Oc,Vc=Oc,jc=Oc,Fc=Oc,Bc=Oc;var Jc=bc.performance||{},Hc=Jc.now||Jc.mozNow||Jc.msNow||Jc.oNow||Jc.webkitNow||function(){return(new Date).getTime()};var Gc=new Date;var zc={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];wc.push(new Mc(e,t)),1!==wc.length||Ac||Cc(Dc)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:Lc,addListener:Nc,once:Uc,off:Vc,removeListener:jc,removeAllListeners:Fc,emit:Bc,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*Hc.call(Jc),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Gc)/1e3}},Wc=function(e,t){fc.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},Qc=function(e,t,n,r,i){return function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,i)},qc=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],Kc=fc.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=fc.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},Yc=fc.isStandardBrowserEnv()?{write:function(e,t,n,r,i,a){var o=[];o.push(e+"="+encodeURIComponent(t)),fc.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),fc.isString(r)&&o.push("path="+r),fc.isString(i)&&o.push("domain="+i),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},$c=function(e){return new Promise((function(t,n){var r=e.data,i=e.headers;fc.isFormData(r)&&delete i["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var o=e.auth.username||"",s=e.auth.password||"";i.Authorization="Basic "+btoa(o+":"+s)}var c,u,d=(c=e.baseURL,u=e.url,c&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(c,u):u);if(a.open(e.method.toUpperCase(),_c(d,e.params,e.paramsSerializer),!0),a.timeout=e.timeout,a.onreadystatechange=function(){if(a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in a?function(e){var t,n,r,i={};return e?(fc.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=fc.trim(e.substr(0,r)).toLowerCase(),n=fc.trim(e.substr(r+1)),t){if(i[t]&&qc.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([n]):i[t]?i[t]+", "+n:n}})),i):i}(a.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:r,config:e,request:a};!function(e,t,n){var r=n.config.validateStatus;!r||r(n.status)?e(n):t(Qc("Request failed with status code "+n.status,n.config,null,n.request,n))}(t,n,i),a=null}},a.onabort=function(){a&&(n(Qc("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(Qc("Network Error",e,null,a)),a=null},a.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(Qc(t,e,"ECONNABORTED",a)),a=null},fc.isStandardBrowserEnv()){var l=Yc,h=(e.withCredentials||Kc(d))&&e.xsrfCookieName?l.read(e.xsrfCookieName):void 0;h&&(i[e.xsrfHeaderName]=h)}if("setRequestHeader"in a&&fc.forEach(i,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete i[t]:a.setRequestHeader(t,e)})),fc.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),e.responseType)try{a.responseType=e.responseType}catch(p){if("json"!==e.responseType)throw p}"function"==typeof e.onDownloadProgress&&a.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){a&&(a.abort(),n(e),a=null)})),void 0===r&&(r=null),a.send(r)}))},Xc={"Content-Type":"application/x-www-form-urlencoded"};function Zc(e,t){!fc.isUndefined(e)&&fc.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var eu={adapter:function(){var e;return("undefined"!=typeof XMLHttpRequest||void 0!==zc&&"[object process]"===Object.prototype.toString.call(zc))&&(e=$c),e}(),transformRequest:[function(e,t){return Wc(t,"Accept"),Wc(t,"Content-Type"),fc.isFormData(e)||fc.isArrayBuffer(e)||fc.isBuffer(e)||fc.isStream(e)||fc.isFile(e)||fc.isBlob(e)?e:fc.isArrayBufferView(e)?e.buffer:fc.isURLSearchParams(e)?(Zc(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):fc.isObject(e)?(Zc(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(t){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};fc.forEach(["delete","get","head"],(function(e){eu.headers[e]={}})),fc.forEach(["post","put","patch"],(function(e){eu.headers[e]=fc.merge(Xc)}));var tu=eu;function nu(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var ru=function(e){return nu(e),e.headers=e.headers||{},e.data=Sc(e.data,e.headers,e.transformRequest),e.headers=fc.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),fc.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||tu.adapter)(e).then((function(t){return nu(e),t.data=Sc(t.data,t.headers,e.transformResponse),t}),(function(t){return yc(t)||(nu(e),t&&t.response&&(t.response.data=Sc(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},iu=function(e,t){t=t||{};var n={},r=["url","method","params","data"],i=["headers","auth","proxy"],a=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];fc.forEach(r,(function(e){void 0!==t[e]&&(n[e]=t[e])})),fc.forEach(i,(function(r){fc.isObject(t[r])?n[r]=fc.deepMerge(e[r],t[r]):void 0!==t[r]?n[r]=t[r]:fc.isObject(e[r])?n[r]=fc.deepMerge(e[r]):void 0!==e[r]&&(n[r]=e[r])})),fc.forEach(a,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])}));var o=r.concat(i).concat(a),s=Object.keys(t).filter((function(e){return-1===o.indexOf(e)}));return fc.forEach(s,(function(r){void 0!==t[r]?n[r]=t[r]:void 0!==e[r]&&(n[r]=e[r])})),n};function au(e){this.defaults=e,this.interceptors={request:new gc,response:new gc}}au.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=iu(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[ru,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},au.prototype.getUri=function(e){return e=iu(this.defaults,e),_c(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},fc.forEach(["delete","get","head","options"],(function(e){au.prototype[e]=function(t,n){return this.request(fc.merge(n||{},{method:e,url:t}))}})),fc.forEach(["post","put","patch"],(function(e){au.prototype[e]=function(t,n,r){return this.request(fc.merge(r||{},{method:e,url:t,data:n}))}}));var ou=au;function su(e){this.message=e}su.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},su.prototype.__CANCEL__=!0;var cu=su;function uu(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new cu(e),t(n.reason))}))}uu.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},uu.source=function(){var e;return{token:new uu((function(t){e=t})),cancel:e}};var du=uu;function lu(e){var t=new ou(e),n=sc(ou.prototype.request,t);return fc.extend(n,ou.prototype,t),fc.extend(n,t),n}var hu=lu(tu);hu.Axios=ou,hu.create=function(e){return lu(iu(hu.defaults,e))},hu.Cancel=cu,hu.CancelToken=du,hu.isCancel=yc,hu.all=function(e){return Promise.all(e)},hu.spread=function(e){return function(t){return e.apply(null,t)}};var pu=hu,fu=hu;pu.default=fu;var mu=pu,_u=Be("unscopables"),vu=Array.prototype;null==vu[_u]&&w.f(vu,_u,{configurable:!0,value:Ar(null)});var gu,Su,yu,bu=function(e){vu[_u][e]=!0},ku={},Tu=Be("iterator"),Ru=!1;[].keys&&("next"in(yu=[].keys())?(Su=zr(zr(yu)))!==Object.prototype&&(gu=Su):Ru=!0),null==gu&&(gu={}),S(gu,Tu)||A(gu,Tu,(function(){return this}));var Eu={IteratorPrototype:gu,BUGGY_SAFARI_ITERATORS:Ru},Cu=w.f,Iu=Be("toStringTag"),wu=function(e,t,n){e&&!S(e=n?e:e.prototype,Iu)&&Cu(e,Iu,{configurable:!0,value:t})},Au=Eu.IteratorPrototype,xu=function(){return this},Pu=Eu.IteratorPrototype,Du=Eu.BUGGY_SAFARI_ITERATORS,Mu=Be("iterator"),Ou=function(){return this},Lu=function(e,t,n,r,i,a,o){!function(e,t,n){var r=t+" Iterator";e.prototype=Ar(Au,{next:u(1,n)}),wu(e,r,!1),ku[r]=xu}(n,t,r);var s,c,d,l=function(e){if(e===i&&_)return _;if(!Du&&e in f)return f[e];switch(e){case"keys":case"values":case"entries":return function(){return new n(this,e)}}return function(){return new n(this)}},h=t+" Iterator",p=!1,f=e.prototype,m=f[Mu]||f["@@iterator"]||i&&f[i],_=!Du&&m||l(i),v="Array"==t&&f.entries||m;if(v&&(s=zr(v.call(new e)),Pu!==Object.prototype&&s.next&&(zr(s)!==Pu&&(yr?yr(s,Pu):"function"!=typeof s[Mu]&&A(s,Mu,Ou)),wu(s,h,!0))),"values"==i&&m&&"values"!==m.name&&(p=!0,_=function(){return m.call(this)}),f[Mu]!==_&&A(f,Mu,_),ku[t]=_,i)if(c={values:l("values"),keys:a?_:l("keys"),entries:l("entries")},o)for(d in c)(Du||p||!(d in f))&&te(f,d,c[d]);else Pe({target:t,proto:!0,forced:Du||p},c);return c},Nu=ee.set,Uu=ee.getterFor("Array Iterator"),Vu=Lu(Array,"Array",(function(e,t){Nu(this,{type:"Array Iterator",target:m(e),index:0,kind:t})}),(function(){var e=Uu(this),t=e.target,n=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values");ku.Arguments=ku.Array,bu("keys"),bu("values"),bu("entries");var ju=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),Fu=t((function(e){var t=w.f,n=J("meta"),r=0,i=Object.isExtensible||function(){return!0},a=function(e){t(e,n,{value:{objectID:"O"+ ++r,weakData:{}}})},o=e.exports={REQUIRED:!1,fastKey:function(e,t){if(!_(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!S(e,n)){if(!i(e))return"F";if(!t)return"E";a(e)}return e[n].objectID},getWeakData:function(e,t){if(!S(e,n)){if(!i(e))return!0;if(!t)return!1;a(e)}return e[n].weakData},onFreeze:function(e){return ju&&o.REQUIRED&&i(e)&&!S(e,n)&&a(e),e}};z[n]=!0})),Bu=(Fu.REQUIRED,Fu.fastKey,Fu.getWeakData,Fu.onFreeze,Be("iterator")),Ju=Array.prototype,Hu=Be("iterator"),Gu=function(e){var t=e.return;if(void 0!==t)return C(t.call(e)).value},zu=function(e,t){this.stopped=e,this.result=t},Wu=function(e,t,n){var r,i,a,o,s,c,u,d,l=n&&n.that,h=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),f=!(!n||!n.INTERRUPTED),m=Me(t,l,1+h+f),_=function(e){return r&&Gu(r),new zu(!0,e)},v=function(e){return h?(C(e),f?m(e[0],e[1],_):m(e[0],e[1])):f?m(e,_):m(e)};if(p)r=e;else{if("function"!=typeof(i=function(e){if(null!=e)return e[Hu]||e["@@iterator"]||ku[$r(e)]}(e)))throw TypeError("Target is not iterable");if(void 0!==(d=i)&&(ku.Array===d||Ju[Bu]===d)){for(a=0,o=ue(e.length);o>a;a++)if((s=v(e[a]))&&s instanceof zu)return s;return new zu(!1)}r=i.call(e)}for(c=r.next;!(u=c.call(r)).done;){try{s=v(u.value)}catch(g){throw Gu(r),g}if("object"==typeof s&&s&&s instanceof zu)return s}return new zu(!1)},Qu=function(e,t,n){if(!(e instanceof t))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return e},qu=Be("iterator"),Ku=!1;try{var Yu=0,$u={next:function(){return{done:!!Yu++}},return:function(){Ku=!0}};$u[qu]=function(){return this},Array.from($u,(function(){throw 2}))}catch(T_){}var Xu=function(e,t){if(!t&&!Ku)return!1;var n=!1;try{var r={};r[qu]=function(){return{next:function(){return{done:n=!0}}}},e(r)}catch(T_){}return n},Zu=function(e,t,n){for(var r in t)te(e,r,t[r],n);return e},ed=w.f,td=Fu.fastKey,nd=ee.set,rd=ee.getterFor,id=(function(e,t,n){var a=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),s=a?"set":"add",c=r[e],u=c&&c.prototype,d=c,l={},h=function(e){var t=u[e];te(u,e,"add"==e?function(e){return t.call(this,0===e?0:e),this}:"delete"==e?function(e){return!(o&&!_(e))&&t.call(this,0===e?0:e)}:"get"==e?function(e){return o&&!_(e)?void 0:t.call(this,0===e?0:e)}:"has"==e?function(e){return!(o&&!_(e))&&t.call(this,0===e?0:e)}:function(e,n){return t.call(this,0===e?0:e,n),this})};if(Ae(e,"function"!=typeof c||!(o||u.forEach&&!i((function(){(new c).entries().next()})))))d=n.getConstructor(t,e,a,s),Fu.REQUIRED=!0;else if(Ae(e,!0)){var p=new d,f=p[s](o?{}:-0,1)!=p,m=i((function(){p.has(1)})),v=Xu((function(e){new c(e)})),g=!o&&i((function(){for(var e=new c,t=5;t--;)e[s](t,t);return!e.has(-0)}));v||((d=t((function(t,n){Qu(t,d,e);var r=br(new c,t,d);return null!=n&&Wu(n,r[s],{that:r,AS_ENTRIES:a}),r}))).prototype=u,u.constructor=d),(m||g)&&(h("delete"),h("has"),a&&h("get")),(g||f)&&h(s),o&&u.clear&&delete u.clear}l[e]=d,Pe({global:!0,forced:d!=c},l),wu(d,e),o||n.setStrong(d,e,a)}("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(e,t,n,r){var i=e((function(e,o){Qu(e,i,t),nd(e,{type:t,index:Ar(null),first:void 0,last:void 0,size:0}),a||(e.size=0),null!=o&&Wu(o,e[r],{that:e,AS_ENTRIES:n})})),o=rd(t),s=function(e,t,n){var r,i,s=o(e),u=c(e,t);return u?u.value=n:(s.last=u={index:i=td(t,!0),key:t,value:n,previous:r=s.last,next:void 0,removed:!1},s.first||(s.first=u),r&&(r.next=u),a?s.size++:e.size++,"F"!==i&&(s.index[i]=u)),e},c=function(e,t){var n,r=o(e),i=td(t);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key==t)return n};return Zu(i.prototype,{clear:function(){for(var e=o(this),t=e.index,n=e.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete t[n.index],n=n.next;e.first=e.last=void 0,a?e.size=0:this.size=0},delete:function(e){var t=o(this),n=c(this,e);if(n){var r=n.next,i=n.previous;delete t.index[n.index],n.removed=!0,i&&(i.next=r),r&&(r.previous=i),t.first==n&&(t.first=r),t.last==n&&(t.last=i),a?t.size--:this.size--}return!!n},forEach:function(e){for(var t,n=o(this),r=Me(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.next:n.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Zu(i.prototype,n?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),a&&ed(i.prototype,"size",{get:function(){return o(this).size}}),i},setStrong:function(e,t,n){var r=t+" Iterator",i=rd(t),a=rd(r);Lu(e,t,(function(e,t){nd(this,{type:r,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,n=e.last;n&&n.removed;)n=n.previous;return e.target&&(e.last=n=n?n.next:e.state.first)?"keys"==t?{value:n.key,done:!1}:"values"==t?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),ci(t)}}),Ji.charAt),ad=ee.set,od=ee.getterFor("String Iterator");Lu(String,"String",(function(e){ad(this,{type:"String Iterator",string:String(e),index:0})}),(function(){var e,t=od(this),n=t.string,r=t.index;return r>=n.length?{value:void 0,done:!0}:(e=id(n,r),t.index+=e.length,{value:e,done:!1})}));var sd={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},cd=Be("iterator"),ud=Be("toStringTag"),dd=Vu.values;for(var ld in sd){var hd=r[ld],pd=hd&&hd.prototype;if(pd){if(pd[cd]!==dd)try{A(pd,cd,dd)}catch(T_){pd[cd]=dd}if(pd[ud]||A(pd,ud,ld),sd[ld])for(var fd in Vu)if(pd[fd]!==Vu[fd])try{A(pd,fd,Vu[fd])}catch(T_){pd[fd]=Vu[fd]}}}var md=[].slice,_d=/MSIE .\./.test(Qe),vd=function(e){return function(t,n){var r=arguments.length>2,i=r?md.call(arguments,2):void 0;return e(r?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};Pe({global:!0,bind:!0,forced:_d},{setTimeout:vd(r.setTimeout),setInterval:vd(r.setInterval)});var gd,Sd=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))},yd=new(function(){function e(){yt(this,e),this.intervalMap_=new Map}return kt(e,[{key:"setInterval",value:function(e,t){var n=this,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=Sd(),a=Ds(),o=a;this.intervalMap_.set(i,{rafId:null,timeoutId:null,onVisibilityChange:null});var s=function s(){if(r&&document.hidden){e();var c=setTimeout(s,t);n.setTimeoutId(i,c),a=Ds(),o=a}else{(o=Ds())-a>=t&&(a=o,e());var u=requestAnimationFrame(s);n.setRafId(i,u)}},c=requestAnimationFrame(s);if(this.setRafId(i,c),r){var u=function(){if(document.hidden){var e=Ds()-a;if(e>=t)s();else{var r=setTimeout(s,t-e);n.setTimeoutId(i,r)}}};document.addEventListener("visibilitychange",u),this.setOnVisibilityChange(i,u)}return i}},{key:"clearInterval",value:function(e){if(this.intervalMap_.has(e)){var t=this.intervalMap_.get(e),n=t.rafId,r=t.timeoutId,i=t.onVisibilityChange;cancelAnimationFrame(n),clearTimeout(r),document.removeEventListener("visibilitychange",i),this.intervalMap_.delete(e)}}},{key:"setTimeoutId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.timeoutId&&clearTimeout(n.timeoutId),n.timeoutId=t}}},{key:"setRafId",value:function(e,t){if(this.intervalMap_.has(e)){var n=this.intervalMap_.get(e);n.rafId&&cancelAnimationFrame(n.rafId),n.rafId=t}}},{key:"setOnVisibilityChange",value:function(e,t){this.intervalMap_.has(e)&&(this.intervalMap_.get(e).onVisibilityChange=t)}}]),e}()),bd=((new Date).getTime(),0),kd=function(){return(new Date).getTime()+bd},Td=function(){var e=new Date;return e.setTime(kd()),e.toLocaleString()};function Rd(e){try{return JSON.stringify(e)}catch(T_){if(!gd)try{var t={};t.a=t,JSON.stringify(t)}catch(n){gd=n.message}if(T_.message===gd)return"[Circular]";throw T_}}function Ed(e){var t="",n=0;return e.length>1&&Is(e[0])&&(t=(t=e[0].replace(/(%?)(%([sdjo]))/g,(function(t,r,i,a){if(!r){var o=e[n+=1],s="";switch(a){case"s":s+=o;break;case"d":s+=+o;break;case"j":s=Rd(o);break;case"o":var c=Rd(o);"{"!==c[0]&&"["!==c[0]&&(c="<".concat(c,">")),s=function(e){if(!Object.getOwnPropertyDescriptor||!Object.getPrototypeOf)return Object.prototype.toString.call(e).slice(8,-1);for(;e;){var t=Object.getOwnPropertyDescriptor(e,"constructor");if(void 0!==t&&Es(t.value)&&""!==t.value.name)return t.value.name;e=Object.getPrototypeOf(e)}return""}(o)+c}return s}return t}))).replace(/%{2,2}/g,"%"),n+=1),e.length>n&&(t&&(t+=" "),t+=e.slice(n).join(" ")),t}var Cd=Object.prototype.hasOwnProperty;function Id(){try{throw new Error}catch(e){return e.stack}}function wd(e){var t=this,n=[],r=[];this.length=function(){return n.length},this.sent=function(){return r.length},this.push=function(t){n.push(t),n.length>e&&n.shift()},this.send=function(){return r.length||(r=n,n=[]),r},this.confirm=function(){r=[],t.content=""},this.fail=function(){n=r.concat(n),t.confirm();var i=1+n.length+r.length-e;i>0&&(r.splice(0,i),n=r.concat(n),t.confirm())}}var Ad,xd,Pd,Dd=!!Id();function Md(e){return"[".concat(e.timestamp,"] <").concat(e.level.label.toUpperCase(),">").concat(e.logger?" (".concat(e.logger,")"):"",": ").concat(e.message).concat(e.stacktrace?"\n".concat(e.stacktrace):"")}var Od={interval:1e3,level:"trace",capacity:0,stacktrace:{levels:["trace","warn","error"],depth:3,excess:0},timestamp:function(){return(new Date).toISOString()},format:Md},Ld=-1,Nd=!1,Ud="",Vd="",jd="",Fd=function(e){Nd||(Ud="".concat(e.sdkAppId),Vd="".concat(e.userId),jd="".concat(e.version),Nd=!0)},Bd=function(e,t){if(!e||!e.getLogger)throw new TypeError("Argument is not a root loglevel object");if(Ad)throw new Error("You can assign a plugin only one time");Ad=e;var n=function e(){for(var t={},n=0;n<arguments.length;n+=1){var r=Object(arguments[n]);for(var i in r)Cd.call(r,i)&&(t[i]="object"!==vt(r[i])||Array.isArray(r[i])?r[i]:e(t[i],r[i]))}return t}(Od,t);n.capacity=n.capacity||500;var r,i=n.interval;Ld=yd.setInterval((function(){if(!Nd)return;if(!a.sent()){if(!a.length())return;var e=a.send();a.content=r?'{"logs":['.concat(e.join(","),"]}"):e.join("\n"),function(e){if(!Nd)return;var t=JSON.stringify({timestamp:Td(),sdkAppId:Ud,userId:Vd,version:jd,log:e});mu.post(bs(),t).then((function(){a.confirm()})).catch((function(){a.fail()}))}(a.content)}}),i);var a=new wd(n.capacity);return xd=e.methodFactory,Pd=function(e,t,i){var o=xd(e,t,i),s=Dd&&n.stacktrace.levels.some((function(t){return t===e})),c=Ad.levels[e.toUpperCase()];return function(){for(var u=arguments.length,d=new Array(u),l=0;l<u;l++)d[l]=arguments[l];var h=Ed(d),p=c>=t;if(p){var f=new Date;f.setTime(kd());var m=f.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/,"$1"),_="["+m+"] <"+e.toUpperCase()+"> "+h;o.apply(void 0,[_])}var v=Td(),g=s?Id():"";if(g){var S=g.split("\n");S.splice(0,n.stacktrace.excess+3);var y=n.stacktrace.depth;if(y&&S.length!==y+1){var b=S.splice(0,y);g=b.join("\n"),S.length&&(g+="\n and ".concat(S.length," more"))}else g=S.join("\n")}var k=n.format({message:h,level:{label:e,value:c},logger:i||"",timestamp:v,stacktrace:g});void 0===r&&(r=!Is(k));var T="";if(r)try{T+=JSON.stringify(k)}catch(T_){return o.apply(void 0,d),void Ad.getLogger("logger").error(T_)}else T+=k;a.push(T)}},e.methodFactory=Pd,e.setLevel(e.getLevel()),e},Jd=function(){if(!Ad)throw new Error("You can't disable a not appled plugin");if(Pd!==Ad.methodFactory)throw new Error("You can't disable a plugin after appling another plugin");Ad.methodFactory=xd,Ad.setLevel(Ad.getLevel()),Ad=void 0,yd.clearInterval(Ld)},Hd=!1;Os.setConfig=function(e){Fd(e)},Os.setLogLevel=function(e){Os.setLevel(e)},Os.getLogLevel=function(e){return Os.getLevel(e)},Os.enableUploadLog=function(){Hd||(Bd(Os),Hd=!0)},Os.disableUploadLog=function(){Hd&&(Os.warn("disable upload log! Without log we are difficult to help you triage the issue you might run into!"),Jd(),Hd=!1)},Os.enableUploadLog(),Os.setLevel("INFO");var Gd=!0,zd=We.findIndex,Wd=!0,Qd=rt("findIndex");"findIndex"in[]&&Array(1).findIndex((function(){Wd=!1})),Pe({target:"Array",proto:!0,forced:Wd||!Qd},{findIndex:function(e){return zd(this,e,arguments.length>1?arguments[1]:void 0)}}),bu("findIndex");var qd=We.forEach,Kd=dr("forEach"),Yd=rt("forEach"),$d=Kd&&Yd?[].forEach:function(e){return qd(this,e,arguments.length>1?arguments[1]:void 0)};Pe({target:"Array",proto:!0,forced:[].forEach!=$d},{forEach:$d});var Xd=Math.floor;Pe({target:"Number",stat:!0},{isInteger:function(e){return!_(e)&&isFinite(e)&&Xd(e)===e}});var Zd=i((function(){kr(1)}));Pe({target:"Object",stat:!0,forced:Zd},{keys:function(e){return kr(Oe(e))}});var el=mt.trim,tl=r.parseInt,nl=/^[+-]?0[Xx]/,rl=8!==tl(dt+"08")||22!==tl(dt+"0x16")?function(e,t){var n=el(String(e));return tl(n,t>>>0||(nl.test(n)?16:10))}:tl;Pe({global:!0,forced:parseInt!=rl},{parseInt:rl});var il,al,ol,sl=r.Promise,cl=/(iphone|ipod|ipad).*applewebkit/i.test(Qe),ul="process"==l(r.process),dl=r.location,ll=r.setImmediate,hl=r.clearImmediate,pl=r.process,fl=r.MessageChannel,ml=r.Dispatch,_l=0,vl={},gl=function(e){if(vl.hasOwnProperty(e)){var t=vl[e];delete vl[e],t()}},Sl=function(e){return function(){gl(e)}},yl=function(e){gl(e.data)},bl=function(e){r.postMessage(e+"",dl.protocol+"//"+dl.host)};ll&&hl||(ll=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return vl[++_l]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},il(_l),_l},hl=function(e){delete vl[e]},ul?il=function(e){pl.nextTick(Sl(e))}:ml&&ml.now?il=function(e){ml.now(Sl(e))}:fl&&!cl?(ol=(al=new fl).port2,al.port1.onmessage=yl,il=Me(ol.postMessage,ol,1)):r.addEventListener&&"function"==typeof postMessage&&!r.importScripts&&dl&&"file:"!==dl.protocol&&!i(bl)?(il=bl,r.addEventListener("message",yl,!1)):il="onreadystatechange"in k("script")?function(e){Rr.appendChild(k("script")).onreadystatechange=function(){Rr.removeChild(this),gl(e)}}:function(e){setTimeout(Sl(e),0)});var kl,Tl,Rl,El,Cl,Il,wl,Al,xl={set:ll,clear:hl},Pl=E.f,Dl=xl.set,Ml=r.MutationObserver||r.WebKitMutationObserver,Ol=r.document,Ll=r.process,Nl=r.Promise,Ul=Pl(r,"queueMicrotask"),Vl=Ul&&Ul.value;Vl||(kl=function(){var e,t;for(ul&&(e=Ll.domain)&&e.exit();Tl;){t=Tl.fn,Tl=Tl.next;try{t()}catch(T_){throw Tl?El():Rl=void 0,T_}}Rl=void 0,e&&e.enter()},!cl&&!ul&&Ml&&Ol?(Cl=!0,Il=Ol.createTextNode(""),new Ml(kl).observe(Il,{characterData:!0}),El=function(){Il.data=Cl=!Cl}):Nl&&Nl.resolve?(wl=Nl.resolve(void 0),Al=wl.then,El=function(){Al.call(wl,kl)}):El=ul?function(){Ll.nextTick(kl)}:function(){Dl.call(r,kl)});var jl,Fl,Bl,Jl,Hl=Vl||function(e){var t={fn:e,next:void 0};Rl&&(Rl.next=t),Tl||(Tl=t,El()),Rl=t},Gl=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=De(t),this.reject=De(n)},zl={f:function(e){return new Gl(e)}},Wl=function(e,t){if(C(e),_(t)&&t.constructor===e)return t;var n=zl.f(e);return(0,n.resolve)(t),n.promise},Ql=function(e){try{return{error:!1,value:e()}}catch(T_){return{error:!0,value:T_}}},ql=xl.set,Kl=Be("species"),Yl="Promise",$l=ee.get,Xl=ee.set,Zl=ee.getterFor(Yl),eh=sl,th=r.TypeError,nh=r.document,rh=r.process,ih=ie("fetch"),ah=zl.f,oh=ah,sh=!!(nh&&nh.createEvent&&r.dispatchEvent),ch="function"==typeof PromiseRejectionEvent,uh=Ae(Yl,(function(){if(!(N(eh)!==String(eh))){if(66===$e)return!0;if(!ul&&!ch)return!0}if($e>=51&&/native code/.test(eh))return!1;var e=eh.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[Kl]=t,!(e.then((function(){}))instanceof t)})),dh=uh||!Xu((function(e){eh.all(e).catch((function(){}))})),lh=function(e){var t;return!(!_(e)||"function"!=typeof(t=e.then))&&t},hh=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;Hl((function(){for(var r=e.value,i=1==e.state,a=0;n.length>a;){var o,s,c,u=n[a++],d=i?u.ok:u.fail,l=u.resolve,h=u.reject,p=u.domain;try{d?(i||(2===e.rejection&&_h(e),e.rejection=1),!0===d?o=r:(p&&p.enter(),o=d(r),p&&(p.exit(),c=!0)),o===u.promise?h(th("Promise-chain cycle")):(s=lh(o))?s.call(o,l,h):l(o)):h(r)}catch(T_){p&&!c&&p.exit(),h(T_)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&fh(e)}))}},ph=function(e,t,n){var i,a;sh?((i=nh.createEvent("Event")).promise=t,i.reason=n,i.initEvent(e,!1,!0),r.dispatchEvent(i)):i={promise:t,reason:n},!ch&&(a=r["on"+e])?a(i):"unhandledrejection"===e&&function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}("Unhandled promise rejection",n)},fh=function(e){ql.call(r,(function(){var t,n=e.facade,r=e.value;if(mh(e)&&(t=Ql((function(){ul?rh.emit("unhandledRejection",r,n):ph("unhandledrejection",n,r)})),e.rejection=ul||mh(e)?2:1,t.error))throw t.value}))},mh=function(e){return 1!==e.rejection&&!e.parent},_h=function(e){ql.call(r,(function(){var t=e.facade;ul?rh.emit("rejectionHandled",t):ph("rejectionhandled",t,e.value)}))},vh=function(e,t,n){return function(r){e(t,r,n)}},gh=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,hh(e,!0))},Sh=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw th("Promise can't be resolved itself");var r=lh(t);r?Hl((function(){var n={done:!1};try{r.call(t,vh(Sh,n,e),vh(gh,n,e))}catch(T_){gh(n,T_,e)}})):(e.value=t,e.state=1,hh(e,!1))}catch(T_){gh({done:!1},T_,e)}}};uh&&(eh=function(e){Qu(this,eh,Yl),De(e),jl.call(this);var t=$l(this);try{e(vh(Sh,t),vh(gh,t))}catch(T_){gh(t,T_)}},(jl=function(e){Xl(this,{type:Yl,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=Zu(eh.prototype,{then:function(e,t){var n=Zl(this),r=ah(Zi(this,eh));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=ul?rh.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&hh(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),Fl=function(){var e=new jl,t=$l(e);this.promise=e,this.resolve=vh(Sh,t),this.reject=vh(gh,t)},zl.f=ah=function(e){return e===eh||e===Bl?new Fl(e):oh(e)},"function"==typeof sl&&(Jl=sl.prototype.then,te(sl.prototype,"then",(function(e,t){var n=this;return new eh((function(e,t){Jl.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof ih&&Pe({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Wl(eh,ih.apply(r,arguments))}}))),Pe({global:!0,wrap:!0,forced:uh},{Promise:eh}),wu(eh,Yl,!1),ci(Yl),Bl=ie(Yl),Pe({target:Yl,stat:!0,forced:uh},{reject:function(e){var t=ah(this);return t.reject.call(void 0,e),t.promise}}),Pe({target:Yl,stat:!0,forced:uh},{resolve:function(e){return Wl(this,e)}}),Pe({target:Yl,stat:!0,forced:dh},{all:function(e){var t=this,n=ah(t),r=n.resolve,i=n.reject,a=Ql((function(){var n=De(t.resolve),a=[],o=0,s=1;Wu(e,(function(e){var c=o++,u=!1;a.push(void 0),s++,n.call(t,e).then((function(e){u||(u=!0,a[c]=e,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise},race:function(e){var t=this,n=ah(t),r=n.reject,i=Ql((function(){var i=De(t.resolve);Wu(e,(function(e){i.call(t,e).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var yh,bh=function(e){if(ri(e))throw TypeError("The method doesn't accept regular expressions");return e},kh=Be("match"),Th=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[kh]=!1,"/./"[e](t)}catch(r){}}return!1},Rh=E.f,Eh="".startsWith,Ch=Math.min,Ih=Th("startsWith"),wh=!(Ih||(yh=Rh(String.prototype,"startsWith"),!yh||yh.writable));for(var Ah in Pe({target:"String",proto:!0,forced:!wh&&!Ih},{startsWith:function(e){var t=String(f(this));bh(e);var n=ue(Ch(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return Eh?Eh.call(t,r,n):t.slice(n,n+r.length)===r}}),sd){var xh=r[Ah],Ph=xh&&xh.prototype;if(Ph&&Ph.forEach!==$d)try{A(Ph,"forEach",$d)}catch(T_){Ph.forEach=$d}}var Dh=fe.includes,Mh=rt("indexOf",{ACCESSORS:!0,1:0});Pe({target:"Array",proto:!0,forced:!Mh},{includes:function(e){return Dh(this,e,arguments.length>1?arguments[1]:void 0)}}),bu("includes");var Oh=c.f,Lh=function(e){return function(t){for(var n,r=m(t),i=kr(r),o=i.length,s=0,c=[];o>s;)n=i[s++],a&&!Oh.call(r,n)||c.push(e?[n,r[n]]:r[n]);return c}},Nh={entries:Lh(!0),values:Lh(!1)}.values;Pe({target:"Object",stat:!0},{values:function(e){return Nh(e)}}),Pe({target:"String",proto:!0,forced:!Th("includes")},{includes:function(e){return!!~String(f(this)).indexOf(bh(e),arguments.length>1?arguments[1]:void 0)}});var Uh=t((function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,i),!0;case 5:return d.fn.call(d.context,t,r,i,a),!0;case 6:return d.fn.call(d.context,t,r,i,a,o),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||o(this,a);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[a]=1===u.length?u[0]:u:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s})),Vh="connection-state-changed",jh="connected",Fh="error",Bh="DISCONNECTED",Jh="CONNECTING",Hh="RECONNECTING",Gh="CONNECTED",zh={ON_PUBLISH_RESPONSE:2,NEW_ICE_CANDIDATE:4,CLINET_BANNED:8,CHANNEL_SETUP_SUCCESS:19,CHANNEL_SETUP_FAILED:80,REBUILD_SESSION_RESULT:514,JOIN_ROOM_RESULT:20,PEER_JOIN:4134,PEER_LEAVE:4135,STREAM_ADDED:16,STREAM_REMOVED:18,UPDATE_REMOTE_SDP:48,UPDATE_AUDIO_SSRC:50,UPDATE_VIDEO_SSRC:52,UPLINK_NETWORK_STATS:22,UPDATE_REMOTE_MUTE_STAT:23,CLOSE_PEER_ACK:10,SUBSCRIBE_ACK:26,PONG:775,PUBLISH_RESULT:4098,UNPUBLISH_RESULT:4100,SUBSCRIBE_RESULT:4102,UNSUBSCRIBE_RESULT:4104,SUBSCRIBE_CHANGE_RESULT:4106,UPDATE_OFFER_RESULT:4128,REMOTE_STREAM_UPDATE:4130,START_PUBLISH_TENCENT_CDN_RES:1286,STOP_PUBLISH_TENCENT_CDN_RES:1288,START_PUBLISH_GIVEN_CDN_RES:777,STOP_PUBLISH_GIVEN_CDN_RES:779,START_MIX_TRANSCODE_RES:781,STOP_MIX_TRANSCODE_RES:783,USER_LIST_RES:4137,SWITCH_ROLE_RES:4110},Wh=[zh.UPDATE_REMOTE_MUTE_STAT,zh.UPLINK_NETWORK_STATS,zh.PONG,zh.REMOTE_STREAM_UPDATE,zh.USER_LIST_RES],Qh={ON_PUBLISH_RESPONSE:"on-publish-response",NEW_ICE_CANDIDATE:"new-ice-candidate",CLINET_BANNED:"client-banned",CHANNEL_SETUP_SUCCESS:"channel-setup-success",CHANNEL_SETUP_FAILED:"channel-setup-failed",REBUILD_SESSION_RESULT:"channel-reconnect-result",JOIN_ROOM_RESULT:"join-room-result",PEER_JOIN:"peer-join",PEER_LEAVE:"peer-leave",STREAM_ADDED:"stream-added",STREAM_REMOVED:"stream-removed",UPDATE_REMOTE_SDP:"update-remote-sdp",UPDATE_AUDIO_SSRC:"update-audio-ssrc",UPDATE_VIDEO_SSRC:"update-video-ssrc",UPLINK_NETWORK_STATS:"uplink-network-stats",UPDATE_REMOTE_MUTE_STAT:"update-remote-mute-stat",CLOSE_PEER_ACK:"close-peer-ack",SUBSCRIBE_ACK:"subscribe-ack",REQUEST_REBUILD_SESSION:"request-rebuild-session",CLIENT_REJOIN:"client-rejoin",PONG:"pong",PUBLISH_RESULT:"publish-result",UNPUBLISH_RESULT:"unpublish-result",SUBSCRIBE_RESULT:"subscribe-result",SUBSCRIBE_CHANGE_RESULT:"subscribe-change-result",UNSUBSCRIBE_RESULT:"unsubscribe-result",UPDATE_OFFER_RESULT:"update-offer-result",REMOTE_STREAM_UPDATE:"remote-stream-update",START_PUBLISH_TENCENT_CDN_RES:"start-publish-tencent-cdn-res",STOP_PUBLISH_TENCENT_CDN_RES:"stop-publish-tencent-cdn-res",START_PUBLISH_GIVEN_CDN_RES:"start-publish-given-cdn-res",STOP_PUBLISH_GIVEN_CDN_RES:"stop-publish-given-cdn-res",START_MIX_TRANSCODE_RES:"start-mix-transcode-res",STOP_MIX_TRANSCODE_RES:"stop-mix-transcode-res",USER_LIST_RES:"user-list-res",SWITCH_ROLE_RES:"switch_role_res"},qh="on_update_track",Kh="on_create_room",Yh="on_quit_room",$h="on_quality_report",Xh="on_rebuild_session",Zh="on_mute_uplink",ep="on_constraints_config",tp="ping",np="on_publish",rp="on_unpublish",ip="on_sub",ap="on_unsub",op="on_sub_change",sp="on_start_publishing",cp="on_stop_publishing",up="on_start_push_user_cdn",dp="on_stop_push_user_cdn",lp="on_start_mcu_mix",hp="on_stop_mcu_mix",pp="on_get_user_list",fp="on_switch_role",mp="on_change_video_type",_p=32768,vp=32769,gp=32770,Sp=32771,yp=32772,bp=32773,kp=32774,Tp=32775,Rp=32777,Ep=32778,Cp=32779,Ip=32780,wp=32781,Ap=32782,xp=32783,Pp=32784,Dp=32785,Mp=32786,Op=32787,Lp=32788,Np=32789,Up=32790,Vp=32791,jp=32792,Fp=32793,Bp=32794,Jp=32795,Hp=32796,Gp=32797,zp=32798,Wp=32799,Qp=32800,qp=32801,Kp=32802,Yp=new Map,$p=function(e,t){var n=Yp.get(e);n||(Yp.set(e,[]),n=Yp.get(e)),n.push(t)},Xp=function(e){var t=Yp.get(e);return t?Yp.delete(e):t=[],t},Zp={sdkAppId:"",userId:"",version:"",env:"qcloud",browserVersion:"",ua:""},ef=function(e){Zp.sdkAppId="".concat(e.sdkAppId),Zp.version="".concat(e.version),Zp.env=e.env,Zp.userId=e.userId,Zp.browserVersion=e.browserVersion,Zp.ua=e.ua},tf=function(e,t){var n={timestamp:Td(),sdkAppId:Zp.sdkAppId,userId:Zp.userId,version:Zp.version,log:e};t&&(n.errorInfo=t.message),mu.post(bs(),JSON.stringify(n)).catch((function(){}))},nf=function(e){var t="stat-".concat(e.eventType,"-").concat(e.result);"delta-join"!==e.eventType&&"delta-leave"!==e.eventType&&"delta-publish"!==e.eventType||(t="".concat(e.eventType,":").concat(e.delta)),tf(t),"failed"===e.result&&(t="stat-".concat(e.eventType,"-").concat(e.result,"-").concat(e.code),tf(t,e.error))},rf=function(e){if(!so){var t=Et(Et({},e),Zp);Cs(t.code)&&(t.code="failed"===t.result?_s.UNKNOWN:0),mu.post("".concat(fo||"https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?sdkappid=1&cmdtype=jssdk_event"),JSON.stringify(t)).catch((function(){}))}},af=function(e){so||(rf(Et(Et({},e),{},{result:"success"})),"qcloud"===Zp.env&&nf(Et(Et({},e),{},{result:"success"})))},of=function(e){if(!so){var t=e.eventType,n=e.code,r=e.error,i={eventType:t,result:"failed",code:n||(r instanceof vs?r.getExtraCode()||r.getCode():_s.UNKNOWN)};rf(i),"qcloud"===Zp.env&&nf(Et(Et({},i),{},{error:r}))}},sf=Object.prototype.hasOwnProperty;function cf(e){if(null==e)return!0;if("boolean"==typeof e)return!1;if("number"==typeof e)return 0===e;if("string"==typeof e)return 0===e.length;if("function"==typeof e)return 0===e.length;if(Array.isArray(e))return 0===e.length;if(e instanceof Error)return""===e.message;if(Ts(e))switch(Object.prototype.toString.call(e)){case"[object File]":case"[object Map]":case"[object Set]":return 0===e.size;case"[object Object]":for(var t in e)if(sf.call(e,t))return!1;return!0}return!1}var uf=function(){function e(t){yt(this,e),this.sdkAppId_=t.sdkAppId,this.userId_=t.userId,this.userSig_=t.userSig,this.url_=t.url,this.backupUrl_=t.backupUrl,this.version_=t.version,this.urlWithParam_="".concat(this.url_,"?sdkAppid=").concat(this.sdkAppId_,"&identifier=").concat(this.userId_,"&userSig=").concat(this.userSig_),this.backupUrlWithParam_="".concat(this.backupUrl_,"?sdkAppid=").concat(this.sdkAppId_,"&identifier=").concat(this.userId_,"&userSig=").concat(this.userSig_),this.isConnected_=!1,this.isConnecting_=!1,this.socketInUse_=null,this.socket_=null,this.backupSocket_=null,this.backupTimer_=-1,this.signalInfo_={},this.currentState_=Bh,this.reconnectionCount_=0,this.reconnectionTimer_=-1,this.pingPongTimeoutId_=-1,this.pingTimeoutId_=-1,this.emitter_=new Uh}var t;return kt(e,[{key:"connect",value:function(){var e=this;Os.info("connect to url: ".concat(this.urlWithParam_)),this.emitter_.emit(Vh,{prevState:this.currentState_,state:Jh}),this.currentState_=Jh,this.socket_=new WebSocket(this.urlWithParam_),this.bindSocket(this.socket_),this.backupTimer_=setTimeout((function(){e.isConnected_||(Os.info("trying to connect to backupUrl"),e.tryConnectBackup())}),5e3)}},{key:"tryConnectBackup",value:function(){this.backupSocket_||(this.unbindAndCloseSocket("main"),Os.debug("try to connect to url: ".concat(this.backupUrlWithParam_)),this.backupSocket_=new WebSocket(this.backupUrlWithParam_),this.bindSocket(this.backupSocket_))}},{key:"bindSocket",value:function(e){e.onopen=this.onopen.bind(this),e.onclose=this.onclose.bind(this),e.onerror=this.onerror.bind(this),e.onmessage=this.onmessage.bind(this)}},{key:"unbindSocket",value:function(e){e.onopen=function(){},e.onclose=function(){},e.onerror=function(){},e.onmessage=function(){}}},{key:"unbindAndCloseSocket",value:function(e){if("main"===e){if(this.socket_){this.unbindSocket(this.socket_);try{this.socket_.close(1e3)}catch(T_){}this.socket_=null}}else if(this.backupSocket_){this.unbindSocket(this.backupSocket_);try{this.backupSocket_.close(1e3)}catch(T_){}this.backupSocket_=null}}},{key:"clearBackupTimer",value:function(){-1!==this.backupTimer_&&(clearTimeout(this.backupTimer_),this.backupTimer_=-1)}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"onopen",value:function(e){if(!this.isConnected_){this.isConnected_=!0,this.isConnecting_=!1,this.clearBackupTimer(),e.target===this.socket_?(this.unbindAndCloseSocket("backup"),this.socketInUse_=this.socket_):(this.unbindAndCloseSocket("main"),this.socketInUse_=this.backupSocket_);var t=e.target.url;Os.info("[".concat(this.userId_,"] websocket[").concat(t,"] is connected")),this.emitter_.emit(Vh,{prevState:this.currentState_,state:Gh}),this.currentState_===Jh?this.addSignalEvent(Vp,"signal channel is connected"):this.currentState_===Hh&&this.addSignalEvent(Jp,"signal channel reconnect success"),this.currentState_=Gh,this.emitter_.emit(jh)}}},{key:"onclose",value:function(e){var t=e.target.url,n=e.target===this.socketInUse_;Os.info("[".concat(this.userId_,"] websocket[").concat(t," InUse: ").concat(n,"] is closed with code: ").concat(e.code)),e.target===this.socketInUse_&&(this.isConnected_=!1,e.wasClean&&1e3===e.code?(this.emitter_.emit(Vh,{prevState:this.currentState_,state:Bh}),this.currentState_=Bh,this.addSignalEvent(Up,"signal channel is disconnected")):(Os.warn("[".concat(this.userId_,"] onclose code:").concat(e.code," reason:").concat(e.reason)),Os.warn("close current websocket and schedule a reconnect timeout"),this.socketInUse_.onclose=function(){},this.socketInUse_.close(4011),this.socket_=this.backupSocket_=this.socketInUse_=null,this.reconnect("main")))}},{key:"onerror",value:function(e){var t=e.target.url;Os.debug("[".concat(this.userId_,"] websocket[").concat(t,"] error observed")),this.isConnected_?e.target===this.socketInUse_&&(this.isConnected_=!1,this.unbindAndCloseSocket("main"),this.unbindAndCloseSocket("backup"),this.socketInUse_=null,this.reconnect("main")):(this.isReconnecting_||of({eventType:zo,code:_s.UNKNOWN}),e.target==this.socket_?(this.unbindAndCloseSocket("main"),this.reconnect("backup")):(this.unbindAndCloseSocket("backup"),this.reconnect("main"))),this.isConnecting_=!1,this.isConnected_=!1}},{key:"onmessage",value:function(e){var t=this;if(this.isConnected_){var n=JSON.parse(e.data),r=n.cmd,i=n.content,a=Object.values(zh),o=Object.keys(zh)[a.indexOf(r)],s=Qh[o];if(!Wh.includes(r)){var c=e.target==this.socket_?this.url_:this.backupUrl_;if(Os.debug("[".concat(this.userId_,"] websocket[").concat(c,"] received message: ").concat(e.data)),Os.info("[".concat(this.userId_,"] Received event: [ ").concat(s||"unknown cmd: "+r," ]")),(s===Qh.UPDATE_REMOTE_SDP||s===Qh.UPDATE_AUDIO_SSRC||s===Qh.UPDATE_VIDEO_SSRC)&&i.offersdp)try{var u=JSON.parse(i.offersdp),d=u.audiossrc,l=u.videossrc,h=u.rtxssrc;Os.info("[".concat(this.userId_,"] ssrc info in offersdp: [ audiossrc: ").concat(d," videossrc: ").concat(l," rtxssrc: ").concat(h," ]"))}catch(m){}}switch(r){case zh.CHANNEL_SETUP_SUCCESS:this.signalInfo_.relayIp=i.relayip,this.signalInfo_.relayInnerIp=i.innerip,this.signalInfo_.signalIp=i.signalip,this.signalInfo_.localIp=i.localip,this.signalInfo_.dataPort=i.dataport,this.signalInfo_.stunPort=i.stunport,this.signalInfo_.checkSigSeq=i.checkSigSeq,this.signalInfo_.socketId=i.socketid,this.signalInfo_.tinyId=i.tinyid,this.signalInfo_.openId=i.openid,this.signalInfo_.stunPortList=i.stunportList,!i.stunportList||i.stunportList.length<=0?this.signalInfo_.stunServers="stun:"+i.relayip+":"+i.stunport:(this.signalInfo_.stunServers=[],i.stunportList.forEach((function(e){var n="stun:"+i.relayip+":"+e;t.signalInfo_.stunServers.push(n)}))),i.cgiurl&&(this.signalInfo_.logCgiUrl=i.cgiurl),i.svrTime&&function(e){bd=e-(new Date).getTime();var t=new Date;t.setTime(e),Os.info("baseTime from server: "+t+" offset: "+bd)}(i.svrTime),Os.info("ChannelSetup Success: signalIp:".concat(i.signalip," relayIp:").concat(i.relayip," clientIp:").concat(i.localip," checkSigSeq:").concat(i.checkSigSeq)),Os.info("start ping pong"),this.startPingPong(),this.isReconnecting_&&(this.reconnectionCount_=0,this.clearReconnectionTimer(),1===i.rc&&this.emitter_.emit(Qh.REQUEST_REBUILD_SESSION,{signalInfo:this.signalInfo_})),this.emitter_.emit(s,{signalInfo:this.signalInfo_});break;case zh.REBUILD_SESSION_RESULT:0===i.result?Os.info("reconnect - rebuild session succeeded"):(this.emitter_.emit(Qh.CLIENT_REJOIN),Os.error("reconnect - rebuild session failed: ".concat(JSON.stringify(i))));break;case zh.CHANNEL_SETUP_FAILED:if(!this.isReconnecting_){var p="sdkAppId invalid",f="";Cs(i.errorCode)||(p=i.errorCode,f=i.errorMsg);var m=new vs({code:_s.SIGNAL_CHANNEL_SETUP_FAILED,extraCode:p,message:"SignalChannel setup failure: ('errorCode': ".concat(p,", 'errorMsg': ").concat(f," })")});this.close(),of({eventType:zo,error:m}),this.emitter_.emit(Fh,m)}break;default:this.emitter_.emit(s,{data:n})}}}},{key:"addSignalEvent",value:function(e,t){$p(this.userId_,{eventId:e,eventDesc:t,timestamp:kd(),userId:this.userId_,tinyId:this.signalInfo_.tinyId})}},{key:"reconnect",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"main";if(this.isConnecting_||-1!==this.reconnectionTimer_)Os.info("signal channel is reconnecting, ignoring current reconnection");else{if(this.reconnectionCount_>=30){Os.warn("SDK has tried reconnect signal channel for ".concat(30," times, but all failed. please check your network"));var n=new vs({code:_s.SIGNAL_CHANNEL_RECONNECTION_FAILED,message:"signal channel reconnection failed, please check your network"});return of({eventType:Wo,error:n}),this.addSignalEvent(Hp,"signal channel reconnect fail"),void this.emitter_.emit(Fh,n)}this.isConnecting_=!0,this.reconnectionCount_++,this.currentState_!==Hh&&(this.emitter_.emit(Vh,{prevState:this.currentState_,state:Hh}),this.currentState_=Hh,this.addSignalEvent(Bp,"signal channel is reconnecting")),Os.warn("reconnecting to ".concat(t," signal channel [").concat(this.reconnectionCount_,"/").concat(30,"]"));var r=this.getReconnectionUrl(t);"main"===t?(this.socket_=new WebSocket(r),this.bindSocket(this.socket_)):(this.backupSocket_=new WebSocket(r),this.bindSocket(this.backupSocket_));var i=Rs(this.reconnectionCount_);this.reconnectionTimer_=setTimeout((function(){Os.warn("reconnect ".concat(t," signal channel timeout(").concat(i/1e3,"s), close and try again")),e.isConnecting_=!1,e.clearReconnectionTimer(),e.unbindAndCloseSocket(t),e.reconnect("main"===t?"backup":"main")}),i)}}},{key:"isConnected",value:function(){return this.isConnected_}},{key:"getReconnectionUrl",value:function(e){var t="main"===e?this.urlWithParam_:this.backupUrlWithParam_;return cf(this.signalInfo_)||-1!==t.indexOf("&rc=1")||(t+="&iip="+this.signalInfo_.relayInnerIp+"&dp="+this.signalInfo_.dataPort+"&oip="+this.signalInfo_.relayIp+"&sp="+this.signalInfo_.stunPort+"&rc=1"),t}},{key:"send",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e);r.data=t,void 0!==n&&(r.srctinyid=n),this.socketInUse_.send(JSON.stringify(r))}}},{key:"sendWithoutUA",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e,!1);r.data=t,void 0!==n&&(r.srctinyid=n),this.socketInUse_.send(JSON.stringify(r))}}},{key:"sendWithReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;if(this.isConnected_){var r=this.createSendMessage(e);r.data=t,r.report=n,this.socketInUse_.send(JSON.stringify(r))}}},{key:"startPingPong",value:(t=St(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,-1===this.pingPongTimeoutId_){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.ping();case 5:this.pingPongTimeoutId_=setTimeout((function(){t.pingPongTimeoutId_=-1,t.startPingPong()}),1e4),e.next=13;break;case 8:e.prev=8,e.t0=e.catch(0),Os.warn("ping-pong failed, start signal reconnection"),this.close(),this.reconnect("main");case 13:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return t.apply(this,arguments)})},{key:"stopPingPong",value:function(){Os.info("stop ping pong"),clearTimeout(this.pingTimeoutId_),clearTimeout(this.pingPongTimeoutId_),this.pingTimeoutId_=-1,this.pingPongTimeoutId_=-1}},{key:"ping",value:function(){var e=this;return new Promise((function(t,n){if(-1!==e.pingTimeoutId_)return t();e.sendWithoutUA(tp),e.once(Qh.PONG,(function(){clearTimeout(e.pingTimeoutId_),e.pingTimeoutId_=-1,t()})),e.pingTimeoutId_=setTimeout((function(){e.pingTimeoutId_=-1,n()}),1e4)}))}},{key:"createSendMessage",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n={tag_key:e,data:"",openid:this.userId_,tinyid:this.signalInfo_.tinyId,version:this.version_};return t&&(n.ua=navigator.userAgent),n}},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"getSocketId",value:function(){return this.signalInfo_.socketId}},{key:"close",value:function(){Os.info("close SignalChannel"),this.clearBackupTimer(),this.clearReconnectionTimer(),this.stopPingPong(),this.isConnecting_=!1,this.isConnected_=!1,this.socketInUse_=null,this.unbindAndCloseSocket("main"),this.unbindAndCloseSocket("backup")}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"removeListener",value:function(e,t,n){this.emitter_.removeListener(e,t,n)}},{key:"once",value:function(e,t,n){this.emitter_.once(e,t,n)}},{key:"off",value:function(e,t,n){this.emitter_.off(e,t,n)}},{key:"isReconnecting_",get:function(){return-1!==this.reconnectionTimer_}}]),e}(),df={result:!1,detail:{isBrowserSupported:!1,isWebRTCSupported:!1,isMediaDevicesSupported:!1,isH264EncodeSupported:!1,isVp8EncodeSupported:!1,isH264DecodeSupported:!1,isVp8DecodeSupported:!1}},lf=new Map([[fa,["Firefox",ma]],[ga,["Edg",Sa]],[to,["Chrome",ro]],[io,["Safari",ao]],[Ra,["TBS",Ea]],[Ca,["XWEB",Ia]],[wa&&ua,["WeChat",Aa]],[Ma,["QQ(Win)",Oa]],[Pa,["QQ(Mobile)",Da]],[xa,["QQ(Mobile X5)",Da]],[La,["QQ(Mac)",Na]],[Ua,["QQ(iPad)",Va]],[Ha,["MI",Ga]],[za,["HW",Qa]],[qa,["Samsung",Ka]],[Ya,["OPPO",$a]],[Xa,["VIVO",Za]],[_a,["EDGE",va]],[ya,["SogouMobile",ba]],[ka,["Sogou",Ta]]]);function hf(){var e="unknown",t="unknown";return lf.get(!0)&&(e=lf.get(!0)[0],t=lf.get(!0)[1]),{browserName:e,browserVersion:t}}var pf=function(){return!Ja&&!_a&&(!(ga&&Sa<80)&&!(fa&&ma<56))},ff=function(){return["RTCPeerConnection","webkitRTCPeerConnection","RTCIceGatherer"].filter((function(e){return e in window})).length>0},mf=function(){if(!navigator.mediaDevices)return!1;var e=["getUserMedia","enumerateDevices"];return e.filter((function(e){return e in navigator.mediaDevices})).length===e.length},_f=function(){var e=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!df.detail.isH264EncodeSupported&&!df.detail.isVp8EncodeSupported){e.next=2;break}return e.abrupt("return",{isH264EncodeSupported:df.detail.isH264EncodeSupported,isVp8EncodeSupported:df.detail.isVp8EncodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,(a=document.createElement("canvas")).getContext("2d"),o=a.captureStream(0),i.addTrack(o.getVideoTracks()[0],o),e.next=13,i.createOffer();case 13:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),df.detail.isH264EncodeSupported=n,df.detail.isVp8EncodeSupported=r,e.abrupt("return",{isH264EncodeSupported:df.detail.isH264EncodeSupported,isVp8EncodeSupported:df.detail.isVp8EncodeSupported});case 22:return e.prev=22,e.t0=e.catch(5),e.abrupt("return",{isH264EncodeSupported:!1,isVp8EncodeSupported:!1});case 25:case"end":return e.stop()}}),e,null,[[5,22]])})));return function(){return e.apply(this,arguments)}}(),vf=function(){var e=St(regeneratorRuntime.mark((function e(){var t,n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!df.detail.isH264DecodeSupported&&!df.detail.isVp8DecodeSupported){e.next=2;break}return e.abrupt("return",{isH264DecodeSupported:df.detail.isH264DecodeSupported,isVp8DecodeSupported:df.detail.isVp8DecodeSupported});case 2:return t="",n=!1,r=!1,e.prev=5,i=new RTCPeerConnection,e.next=9,i.createOffer({offerToReceiveAudio:1,offerToReceiveVideo:1});case 9:return-1!==(t=e.sent).sdp.toLowerCase().indexOf("h264")&&(n=!0),-1!==t.sdp.toLowerCase().indexOf("vp8")&&(r=!0),i.close(),e.abrupt("return",{isH264DecodeSupported:n,isVp8DecodeSupported:r});case 16:return e.prev=16,e.t0=e.catch(5),e.abrupt("return",{isH264DecodeSupported:!1,isVp8DecodeSupported:!1});case 19:case"end":return e.stop()}}),e,null,[[5,16]])})));return function(){return e.apply(this,arguments)}}(),gf=function(){var e=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!df.result){e.next=2;break}return e.abrupt("return",df);case 2:return t=pf(),n=ff(),r=mf(),e.next=7,_f();case 7:return i=e.sent,a=i.isH264EncodeSupported,o=i.isVp8EncodeSupported,e.next=12,vf();case 12:return s=e.sent,c=s.isH264DecodeSupported,u=s.isVp8DecodeSupported,df.result=t&&n&&r&&(a||o)&&(c||u),df.detail.isBrowserSupported=t,df.detail.isWebRTCSupported=n,df.detail.isMediaDevicesSupported=r,df.detail.isH264EncodeSupported=a,df.detail.isVp8EncodeSupported=o,df.detail.isH264DecodeSupported=c,df.detail.isVp8DecodeSupported=u,df.result||Os.error("".concat(navigator.userAgent," isBrowserSupported: ").concat(t)+"isWebRTCSupported: ".concat(n," isMediaSupported: ").concat(r," ")+"isH264EncodeSupported: ".concat(a," isVp8EncodeSupported: ").concat(o," ")+"isH264DecodeSupported: ".concat(c," isVp8DecodeSupported: ").concat(u," ")),e.abrupt("return",df);case 25:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Sf=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},yf=function(){return"RTCPeerConnection"in window&&"getReceivers"in window.RTCPeerConnection.prototype},bf=function(){return"RTCPeerConnection"in window&&"getSenders"in window.RTCPeerConnection.prototype},kf=function(){return"RTCRtpTransceiver"in window&&"stop"in window.RTCRtpTransceiver.prototype},Tf=function(){return"RTCRtpSender"in window&&"setParameters"in window.RTCRtpSender.prototype&&bf()},Rf=function(){return!!Cs(navigator.mediaDevices)&&(Os.error("navigator.mediaDevices is not supported on your browser"),!0)},Ef=function(){return"http:"===location.protocol&&!so&&(Os.error("not supported in http protocol, please use https protocol"),!0)},Cf=function(e){return!("candidate-pair"!==e.type||!e.nominated||"in-progress"!==e.state&&"succeeded"!==e.state)&&!("boolean"==typeof e.selected&&!e.selected)},If=new Map([[ha,"Android"],[la,"iOS"],[ja,"Windows"],[Fa,"MacOS"],[Ba,"Linux"]]),wf=function(){var e="unknown";return If.get(!0)&&(e=If.get(!0)),e};function Af(){var e="";screen.width&&(e+=(screen.width?screen.width*window.devicePixelRatio:"")+" * "+(screen.height?screen.height*window.devicePixelRatio:""));return e}function xf(){var e=!1;return(navigator.getUserMedia||navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)&&(e=!0),e}function Pf(){for(var e={isSupported:!1},t=["AudioContext","webkitAudioContext","mozAudioContext","msAudioContext"],n=0;n<t.length;n++)if(t[n]in window){e.isSupported=!0;break}return e.isSupported}function Df(){return!wa&&!la&&!(!pf()||!("captureStream"in HTMLCanvasElement.prototype))}gf();var Mf="stream-added",Of="stream-removed",Lf="stream-updated",Nf="stream-subscribed",Uf="error",Vf="connection-state-changed",jf="stream-added",Ff="stream-removed",Bf="stream-updated",Jf="stream-subscribed",Hf="connection-state-changed",Gf="peer-join",zf="peer-leave",Wf="mute-audio",Qf="mute-video",qf="unmute-audio",Kf="unmute-video",Yf="client-banned",$f="network-quality",Xf="audio-volume",Zf="error",em="player-state-changed",tm="screen-sharing-stopped",nm="connection-state-changed",rm="error",im="player-state-changed",am=function(){function e(t){yt(this,e),this.prevReport_={}}var t,n,r,i;return kt(e,[{key:"getSenderStats",value:(i=St(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={audio:{bytesSent:0,packetsSent:0,audioLevel:0,totalAudioEnergy:0},video:{bytesSent:0,packetsSent:0,framesEncoded:0,frameWidth:0,frameHeight:0,framesSent:0},rtt:0},!(r=t.getPeerConnection())){e.next=13;break}return e.prev=3,e.next=6,r.getStats();case 6:e.sent.forEach((function(e){if("outbound-rtp"===e.type)if("video"===e.mediaType){if(!fa&&Cs(e.trackId))return;var r=t.getSSRC();e.ssrc===r.video?(n.video.bytesSent=e.bytesSent,n.video.packetsSent=e.packetsSent,n.video.framesEncoded=e.framesEncoded):n.video.smallBytesSent=e.bytesSent}else"audio"===e.mediaType&&(n.audio.bytesSent=e.bytesSent,n.audio.packetsSent=e.packetsSent);else"candidate-pair"===e.type?Cf(e)&&ws(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime)):"track"===e.type?(Cs(e.frameWidth)||(e.trackIdentifier===t.getLocalStreamVideoTrackId()?(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight,n.video.framesSent=e.framesSent):(n.video.smallFrameWidth=e.frameWidth,n.video.smallFrameHeight=e.frameHeight,n.video.smallFramesSent=e.framesSent)),Cs(e.audioLevel)||(n.audio.audioLevel=e.audioLevel||0)):"media-source"===e.type&&"audio"===e.kind&&(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0)})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),Os.warn("failed to getStats on sender connection");case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[3,10]])}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(r=St(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={tinyId:t.getTinyId(),userId:t.getUserId(),rtt:0,hasAudio:!1,hasVideo:!1,hasAuxiliary:!1,audio:{bytesReceived:0,packetsReceived:0,packetsLost:0,jitter:0,audioLevel:0,totalAudioEnergy:0},video:{bytesReceived:0,packetsReceived:0,packetsLost:0,framesDecoded:0,frameWidth:0,frameHeight:0},auxiliary:{bytesReceived:0,packetsReceived:0,packetsLost:0,framesDecoded:0,frameWidth:0,frameHeight:0}},!(r=t.getPeerConnection())){e.next=13;break}return e.prev=3,e.next=6,r.getStats();case 6:e.sent.forEach((function(e){if("inbound-rtp"===e.type){if("audio"===e.mediaType)n.audio.packetsReceived=e.packetsReceived,n.audio.bytesReceived=e.bytesReceived,n.audio.packetsLost=e.packetsLost,n.audio.jitter=e.jitter,n.hasAudio=!0;else if("video"===e.mediaType){if(fa&&0===e.bytesReceived)return;var r=t.getSSRC();e.ssrc===r.video&&(n.video.packetsReceived=e.packetsReceived,n.video.bytesReceived=e.bytesReceived,n.video.packetsLost=e.packetsLost,n.video.framesDecoded=e.framesDecoded,n.hasVideo=!0),e.ssrc===r.auxiliary&&(n.auxiliary.packetsReceived=e.packetsReceived,n.auxiliary.bytesReceived=e.bytesReceived,n.auxiliary.packetsLost=e.packetsLost,n.auxiliary.framesDecoded=e.framesDecoded,n.hasAuxiliary=!0)}}else"track"===e.type?(Cs(e.frameWidth)||(e.trackIdentifier===t.getMainStreamVideoTrackId()&&(n.video.frameWidth=e.frameWidth,n.video.frameHeight=e.frameHeight),e.trackIdentifier===t.getAuxStreamVideoTrackId()&&(n.auxiliary.frameWidth=e.frameWidth,n.auxiliary.frameHeight=e.frameHeight)),"audio"===e.kind&&(n.audio.audioLevel=e.audioLevel||0,n.audio.totalAudioEnergy=e.totalAudioEnergy||0)):"candidate-pair"===e.type&&Cf(e)&&ws(e.currentRoundTripTime)&&(n.rtt=Math.floor(1e3*e.currentRoundTripTime))})),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),Os.warn("failed to getStats on receiver connection");case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e,null,[[3,10]])}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(n=St(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r={},!t){e.next=5;break}return e.next=4,this.getSenderStats(t);case 4:r=e.sent;case 5:i=[],a=jt(n),e.prev=7,a.s();case 9:if((o=a.n()).done){e.next=17;break}return(s=Lt(o.value,2))[0],c=s[1],e.next=13,this.getReceiverStats(c);case 13:u=e.sent,i.push(u);case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),a.e(e.t0);case 22:return e.prev=22,a.f(),e.finish(22);case 25:return e.abrupt("return",{senderStats:r,receiverStats:i});case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(e,t){return n.apply(this,arguments)})},{key:"prepareReport",value:function(e){var t=e.stats,n=e.report,r=e.freezeMap;if(!cf(t.senderStats)&&(n.uint32_delay=t.senderStats.rtt,n.RTTReportState.uint32_delay=t.senderStats.rtt,n.AudioReportState.sentAudioLevel=t.senderStats.audio.audioLevel,n.AudioReportState.sentAudioEnergy=t.senderStats.audio.totalAudioEnergy,n.AudioReportState.uint32_audio_enc_pkg_br=t.senderStats.audio.bytesSent,n.VideoReportState.uint32_video_snd_br=t.senderStats.video.bytesSent,n.VideoReportState.uint32_send_total_pkg=t.senderStats.video.packetsSent,n.VideoReportState.VideoEncState[0].uint32_enc_width=t.senderStats.video.frameWidth,n.VideoReportState.VideoEncState[0].uint32_enc_height=t.senderStats.video.frameHeight,n.VideoReportState.VideoEncState[0].uint32_enc_fps=t.senderStats.video.framesSent,t.senderStats.video.smallBytesSent)){n.VideoReportState.uint32_small_video_snd_br=t.senderStats.video.smallBytesSent;var i={uint32_enc_width:t.senderStats.video.smallFrameWidth||0,uint32_enc_height:t.senderStats.video.smallFrameHeight||0,uint32_enc_fps:t.senderStats.video.smallFramesSent||0,uint32_capture_fps:0};n.VideoReportState.VideoEncState.push(i)}t.receiverStats.forEach((function(e){var t=e.userId;if(n.RTTReportState.RTTDecState.push({uint32_delay:e.rtt,uint64_sender_uin:e.tinyId}),e.hasAudio&&(n.AudioReportState.AudioDecState.push({uint32_audio_delay:0,uint32_audio_jitter:e.audio.jitter,uint32_audio_real_recv_pkg:e.audio.packetsReceived,uint32_audio_flow:e.audio.bytesReceived,uint32_audio_real_recv_br:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.audio.packetsLost,totalPacketsLost:e.audio.packetsLost,audioLevel:e.audio.audioLevel,audioEnergy:e.audio.totalAudioEnergy}),n.AudioReportState.uint32_audio_real_recv_pkg+=e.audio.packetsReceived,n.AudioReportState.uint32_audio_flow+=e.audio.bytesReceived,n.uint32_real_num+=e.audio.packetsReceived),e.hasVideo){var i=r.get(t+"_main"),a=i?i.duration:0;n.VideoReportState.VideoDecState.push({uint32_video_recv_fps:e.video.framesDecoded,uint32_video_recv_br:e.video.bytesReceived,uint32_video_real_recv_pkg:e.video.packetsReceived,uint32_dec_height:e.video.frameHeight,uint32_dec_width:e.video.frameWidth,uint32_video_jitter:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.video.packetsLost,totalPacketsLost:e.video.packetsLost,uint32_video_strtype:0,int32_video_freeze_ms:a}),n.VideoReportState.uint32_video_total_real_recv_pkg+=e.video.packetsReceived,n.VideoReportState.uint32_video_rcv_br+=e.video.bytesReceived}if(e.hasAuxiliary){var o=r.get(t+"_auxiliary"),s=o?o.duration:0;n.VideoReportState.VideoDecState.push({uint32_video_recv_fps:e.auxiliary.framesDecoded,uint32_video_recv_br:e.auxiliary.bytesReceived,uint32_video_real_recv_pkg:e.auxiliary.packetsReceived,uint32_dec_height:e.auxiliary.frameHeight,uint32_dec_width:e.auxiliary.frameWidth,uint32_video_jitter:0,uint64_sender_uin:e.tinyId,userId:e.userId,packetsLost:e.auxiliary.packetsLost,totalPacketsLost:e.auxiliary.packetsLost,uint32_video_strtype:2,int32_video_freeze_ms:s})}})),n.uint64_end_utime=(new Date).getTime();var a=this.prevReport_;if(this.prevReport_=JSON.parse(JSON.stringify(n)),cf(a))n.AudioReportState.uint32_audio_enc_pkg_br=8*n.AudioReportState.uint32_audio_enc_pkg_br/2,n.VideoReportState.uint32_video_rcv_br=8*n.VideoReportState.uint32_video_rcv_br/2,n.VideoReportState.uint32_video_snd_br=8*n.VideoReportState.uint32_video_snd_br/2,n.VideoReportState.uint32_small_video_snd_br&&(n.VideoReportState.uint32_small_video_snd_br=8*n.VideoReportState.uint32_small_video_snd_br/2),n.VideoReportState.VideoDecState.forEach((function(e){e.uint32_video_recv_br=8*e.uint32_video_recv_br/2,n.uint32_total_send_bps=n.AudioReportState.uint32_audio_enc_pkg_br+n.VideoReportState.uint32_video_snd_br}));else{if(n.uint64_begine_utime=a.uint64_end_utime,n.uint32_real_num-=a.uint32_real_num,n.uint32_real_num<=0&&(n.uint32_real_num=0),n.AudioReportState.uint32_audio_real_recv_pkg-=a.AudioReportState.uint32_audio_real_recv_pkg,n.AudioReportState.uint32_audio_real_recv_pkg<=0&&(n.AudioReportState.uint32_audio_real_recv_pkg=0),n.AudioReportState.uint32_audio_enc_pkg_br-=a.AudioReportState.uint32_audio_enc_pkg_br,n.AudioReportState.uint32_audio_enc_pkg_br<=0&&(n.AudioReportState.uint32_audio_enc_pkg_br=0),n.AudioReportState.uint32_audio_enc_pkg_br=8*n.AudioReportState.uint32_audio_enc_pkg_br/2,n.VideoReportState.uint32_video_snd_br-=a.VideoReportState.uint32_video_snd_br,n.VideoReportState.uint32_video_snd_br<=0&&(n.VideoReportState.uint32_video_snd_br=0),n.VideoReportState.uint32_video_snd_br=8*n.VideoReportState.uint32_video_snd_br/2,n.VideoReportState.uint32_small_video_snd_br&&(n.VideoReportState.uint32_small_video_snd_br-=a.VideoReportState.uint32_small_video_snd_br,n.VideoReportState.uint32_small_video_snd_br<=0&&(n.VideoReportState.uint32_small_video_snd_br=0),n.VideoReportState.uint32_small_video_snd_br=8*n.VideoReportState.uint32_small_video_snd_br/2),n.AudioReportState.uint32_audio_flow-=a.AudioReportState.uint32_audio_flow,n.AudioReportState.uint32_audio_flow<=0&&(n.AudioReportState.uint32_audio_flow=0),n.VideoReportState.uint32_send_total_pkg-=a.VideoReportState.uint32_send_total_pkg,n.VideoReportState.uint32_send_total_pkg<=0&&(n.VideoReportState.uint32_send_total_pkg=0),n.VideoReportState.uint32_video_rcv_br-=a.VideoReportState.uint32_video_rcv_br,n.VideoReportState.uint32_video_rcv_br<=0&&(n.VideoReportState.uint32_video_rcv_br=0),n.VideoReportState.uint32_video_rcv_br=8*n.VideoReportState.uint32_video_rcv_br/2,n.VideoReportState.uint32_video_total_real_recv_pkg-=a.VideoReportState.uint32_video_total_real_recv_pkg,n.VideoReportState.uint32_video_total_real_recv_pkg<=0&&(n.VideoReportState.uint32_video_total_real_recv_pkg=0),n.VideoReportState.VideoEncState[0].uint32_enc_fps-=a.VideoReportState.VideoEncState[0].uint32_enc_fps,n.VideoReportState.VideoEncState[0].uint32_enc_fps<0&&(n.VideoReportState.VideoEncState[0].uint32_enc_fps=0),n.VideoReportState.VideoEncState[0].uint32_enc_fps=n.VideoReportState.VideoEncState[0].uint32_enc_fps/2,n.VideoReportState.VideoEncState[1]){var o=0;a.VideoReportState.VideoEncState[1]&&(o=a.VideoReportState.VideoEncState[1].uint32_enc_fps),n.VideoReportState.VideoEncState[1].uint32_enc_fps-=o,n.VideoReportState.VideoEncState[1].uint32_enc_fps<0&&(n.VideoReportState.VideoEncState[1].uint32_enc_fps=0),n.VideoReportState.VideoEncState[1].uint32_enc_fps=n.VideoReportState.VideoEncState[1].uint32_enc_fps/2}for(var s=n.VideoReportState.VideoDecState.length,c=0;c<s;c++){for(var u=n.VideoReportState.VideoDecState[c],d=u.uint64_sender_uin,l=u.uint32_video_strtype,h=u.uint32_video_real_recv_pkg,p=u.uint32_video_recv_br,f=u.uint32_video_recv_fps,m=0;m<a.VideoReportState.VideoDecState.length;m++){var _=a.VideoReportState.VideoDecState[m];if(_.uint64_sender_uin===d&&_.uint32_video_strtype===l){u.packetsLost=u.totalPacketsLost-_.totalPacketsLost,(h-=_.uint32_video_real_recv_pkg)<=0&&(h=0),(p-=_.uint32_video_recv_br)<=0&&(p=0),(f-=_.uint32_video_recv_fps)<0&&(f=0);break}}n.VideoReportState.VideoDecState[c].uint32_video_real_recv_pkg=h,n.VideoReportState.VideoDecState[c].uint32_video_recv_br=8*p/2,n.VideoReportState.VideoDecState[c].uint32_video_recv_fps=f/2}s=n.AudioReportState.AudioDecState.length;for(var v=0;v<s;v++){for(var g=n.AudioReportState.AudioDecState[v],S=g.uint32_audio_real_recv_pkg,y=g.uint32_audio_flow,b=g.uint64_sender_uin,k=0;k<a.AudioReportState.AudioDecState.length;k++){var T=a.AudioReportState.AudioDecState[k];if(T.uint64_sender_uin===b){g.packetsLost=g.totalPacketsLost-T.totalPacketsLost,(S-=T.uint32_audio_real_recv_pkg)<=0&&(S=0),(y-=T.uint32_audio_flow)<=0&&(y=0);break}}n.AudioReportState.AudioDecState[v].uint32_audio_real_recv_pkg=S,n.AudioReportState.AudioDecState[v].uint32_audio_flow=y,n.AudioReportState.AudioDecState[v].uint32_audio_real_recv_br=8*y/2}n.AudioReportState.uint32_audio_real_recv_br=8*n.AudioReportState.uint32_audio_flow/2,n.uint32_real_num=n.AudioReportState.uint32_audio_real_recv_pkg+n.VideoReportState.uint32_video_total_real_recv_pkg,n.uint32_total_send_bps=n.AudioReportState.uint32_audio_enc_pkg_br+n.VideoReportState.uint32_video_snd_br,n.uint32_total_recv_bps=n.AudioReportState.uint32_audio_real_recv_br+n.VideoReportState.uint32_video_rcv_br}return n}},{key:"getStatsReport",value:(t=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.uplinkConnection,r=t.downlinkConnections,i=t.freezeMap,a={uint64_begine_utime:(new Date).getTime(),uint64_end_utime:0,uint32_real_num:0,uint32_delay:0,uint32_CPU_curfreq:0,uint32_total_send_bps:0,uint32_total_recv_bps:0,AudioReportState:{uint32_audio_enc_pkg_br:0,uint32_audio_real_recv_pkg:0,uint32_audio_flow:0,uint32_audio_real_recv_br:0,uint32_audio_delay:0,uint32_audio_jitter:0,uint32_microphone_status:1,sentAudioLevel:0,sentAudioEnergy:0,AudioDecState:[]},VideoReportState:{uint32_video_delay:0,uint32_video_snd_br:0,uint32_video_total_real_recv_pkg:0,uint32_video_rcv_br:0,uint32_send_total_pkg:0,VideoEncState:[{uint32_enc_width:0,uint32_enc_height:0,uint32_capture_fps:0,uint32_enc_fps:0}],VideoDecState:[]},RTTReportState:{uint32_delay:0,RTTDecState:[]}},e.next=4,this.getStats(n,r);case 4:return o=e.sent,this.prepareReport({stats:o,report:a,freezeMap:i}),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),om=function(){function e(t){yt(this,e),this.id_=t.id,this.direction_=t.direction,this.type_=t.type,this.directionPrefix_="local"===this.direction_?"":"*"}return kt(e,[{key:"log",value:function(e,t){Os[e]("[".concat(this.directionPrefix_).concat(this.id_,"] ").concat(this.type_," ").concat(t))}},{key:"info",value:function(e){this.log("info",e)}},{key:"debug",value:function(e){this.log("debug",e)}},{key:"warn",value:function(e){this.log("warn",e)}},{key:"error",value:function(e){this.log("error",e)}}]),e}(),sm=new Uh,cm={JOIN_START:1,JOIN_SEND_CMD:2,JOIN_RECEIVED_CMD_RES:3,JOIN_SUCCESS:4,JOIN_FAILED:5,LEAVE_START:20,LEAVE_SEND_CMD:21,LEAVE_SUCCESS:22,HEARTBEAT_STATS:23,RECEIVED_PUBLISHED_USER_LIST:24,CALL_STATS:25,PUBLISH_START:27,STREAM_PLAY_SUCCESS:100,PLAYER_STATE_CHANGED:101,VIDEO_PLAYING:102,AUDIO_PLAYING:103,REMOTE_STREAM_TRACK_UPDATED:110,REMOTE_STREAM_ADDED:111,REMOTE_STREAM_SUBSCRIBE_START:112,REMOTE_STREAM_SUBSCRIBED:113,REMOTE_STREAM_UNSUBSCRIBED:114,REMOTE_STREAM_UPDATED:115,REMOTE_STREAM_REMOVED:116,LOCAL_STREAM_PUBLISHED:120,LOCAL_STREAM_INITIALIZE_START:121,LOCAL_STREAM_INITIALIZE_END:122,LOCAL_STREAM_INITIALIZE_FAILED:123,VIDEO_TRACK_MUTED:130,VIDEO_TRACK_UNMUTED:131,PLAY_STREAM_START:132,VIDEO_LOADED_DATA:133,PLAY_VIDEO_START:134,CONNECTION_STATE_CHANGED:200,CONNECTION_SEND_SUBSCRIBE_CMD:201,NETWORK_QUALITY:300},um=function(){function e(t){var n=t.signalChannel,r=t.connections,i=t.userId,a=t.client;yt(this,e),this.client_=a,this.signalChannel_=n,this.connections_=r,this.log_=new om({id:"q|"+i,direction:"local",type:""}),this.uplinkConnection_=null,this.uplinkNetworkQuality_=0,this.uplinkRTT_=0,this.uplinkLoss_=0,this.downlinkNetworkQuality_=0,this.downlinkRTT_=0,this.downlinkLoss_=0,this.downlinkPrevStatMap_=new Map,this.downlinkLossAndRTTMap_=new Map,this.interval_=-1,this.emitter_=new Uh,this.initialize()}var t,n;return kt(e,[{key:"initialize",value:function(){var e=this;this.signalChannel_.on(Qh.UPLINK_NETWORK_STATS,(function(t){e.handleUplinkNetworkQuality(t)})),this.signalChannel_.on(Vh,this.handleSignalConnectionStateChange.bind(this)),this.start()}},{key:"handleUplinkNetworkQuality",value:function(e){if(!this.uplinkConnection_)return this.uplinkNetworkQuality=0,this.uplinkLoss_=0,void(this.uplinkRTT_=0);var t=this.uplinkConnection_.getPeerConnection();if(t&&this.isPeerConnectionDisconnected(t))return this.uplinkNetworkQuality=6,this.uplinkLoss_=0,void(this.uplinkRTT_=0);var n=e.data.content;if(0===n.result){var r=n.expectAudPkg+n.expectVidPkg,i=n.recvAudPkg+n.recvVidPkg,a=r-i;if(0===r&&0===i)return;this.uplinkLoss_=a<=0?0:Math.round(a/r*100),this.uplinkRTT_=n.rtt,this.uplinkNetworkQuality=this.getNetworkQuality(this.uplinkLoss_,this.uplinkRTT_)}}},{key:"handleDownlinkNetworkQuality",value:(n=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h,p,f,m,_=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connections_&&0!==this.connections_.size){e.next=3;break}return this.downlinkNetworkQuality=0,e.abrupt("return");case 3:if(t=Nt(this.connections_.values()),n=t.filter((function(e){return e.getPeerConnection()&&"connected"===e.getPeerConnection().connectionState})),t.filter((function(e){return e.getPeerConnection()&&_.isPeerConnectionDisconnected(e.getPeerConnection())})).length!==t.length){e.next=9;break}return this.downlinkNetworkQuality=6,e.abrupt("return");case 9:r=0;case 10:if(!(r<n.length)){e.next=31;break}return i=n[r].getPeerConnection(),e.next=14,this.getStat(i);case 14:if(a=e.sent,o=a.rtt,s=a.totalPacketsLost,c=a.totalPacketsReceived,this.downlinkPrevStatMap_.has(i)){e.next=21;break}return this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),e.abrupt("continue",28);case 21:u=0,d=this.downlinkPrevStatMap_.get(i),l=s-d.totalPacketsLost,h=c-d.totalPacketsReceived,u=l<=0||h<0?0:Math.round(l/(l+h)*100),this.downlinkPrevStatMap_.set(i,{totalPacketsLost:s,totalPacketsReceived:c}),this.downlinkLossAndRTTMap_.set(i,{rtt:o,loss:u,userId:n[r].getUserId()});case 28:r++,e.next=10;break;case 31:if(Nt(this.downlinkPrevStatMap_.keys()).forEach((function(e){_.isPeerConnectionDisconnected(e)&&(_.downlinkPrevStatMap_.delete(e),_.downlinkLossAndRTTMap_.delete(e))})),0!==this.downlinkLossAndRTTMap_.size){e.next=34;break}return e.abrupt("return");case 34:p=this.getAverageLossAndRTT(Nt(this.downlinkLossAndRTTMap_.values())),f=p.rtt,m=p.loss,this.downlinkRTT_=f,this.downlinkLoss_=m,this.downlinkNetworkQuality=this.getNetworkQuality(m,f);case 38:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getStat",value:(t=St(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={rtt:0,totalPacketsLost:0,totalPacketsReceived:0},t&&yf()){e.next=3;break}return e.abrupt("return",n);case 3:r=t.getReceivers(),e.prev=4,i=0;case 6:if(!(i<r.length)){e.next=15;break}return a=r[i],e.next=10,a.getStats();case 10:e.sent.forEach((function(e){"candidate-pair"===e.type&&ws(e.currentRoundTripTime)&&(n.rtt=Math.round(1e3*e.currentRoundTripTime)),"inbound-rtp"!==e.type||"audio"!==e.mediaType&&"video"!==e.mediaType||(n.totalPacketsLost+=e.packetsLost,n.totalPacketsReceived+=e.packetsReceived)}));case 12:i++,e.next=6;break;case 15:return e.abrupt("return",n);case 18:return e.prev=18,e.t0=e.catch(4),e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,null,[[4,18]])}))),function(e){return t.apply(this,arguments)})},{key:"getAverageLossAndRTT",value:function(e){var t={rtt:0,loss:0};return Array.isArray(e)&&e.length>0&&(e.forEach((function(e){t.rtt+=e.rtt,t.loss+=e.loss})),Object.keys(t).forEach((function(n){t[n]=Math.round(t[n]/e.length)}))),t}},{key:"getNetworkQuality",value:function(e,t){return e>50||t>500?5:e>30||t>350?4:e>20||t>200?3:e>10||t>100?2:e>=0||t>=0?1:0}},{key:"handleSignalConnectionStateChange",value:function(e){e.state===Bh?(this.uplinkRTT_=0,this.uplinkLoss_=0,this.uplinkNetworkQuality=6):e.state===Gh&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"handleUplinkConnectionStateChange",value:function(e){var t=e.state;t===To?(this.uplinkLoss_=0,this.uplinkRTT_=0,this.uplinkNetworkQuality=6):t===Co&&6===this.uplinkNetworkQuality&&(this.uplinkNetworkQuality=5)}},{key:"isPeerConnectionDisconnected",value:function(e){return!(!e||"disconnected"!==e.connectionState&&"failed"!==e.connectionState&&"closed"!==e.connectionState)}},{key:"setUplinkConnection",value:function(e){this.uplinkConnection_=e,this.uplinkConnection_?this.uplinkConnection_.on(Vf,this.handleUplinkConnectionStateChange.bind(this)):(this.uplinkNetworkQuality=0,this.uplinkRTT_=0,this.uplinkLoss_=0)}},{key:"start",value:function(){var e=this;-1===this.interval_?(this.log_.info("start network quality calculating"),this.interval_=yd.setInterval((function(){e.handleDownlinkNetworkQuality(),sm.emit(cm.NETWORK_QUALITY,{client:e.client_,uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_,downlinkLossAndRTTMap:e.downlinkLossAndRTTMap_}),e.emitter_.emit($f,{uplinkNetworkQuality:e.uplinkNetworkQuality,downlinkNetworkQuality:e.downlinkNetworkQuality,uplinkRTT:e.uplinkRTT_,uplinkLoss:e.uplinkLoss_,downlinkRTT:e.downlinkRTT_,downlinkLoss:e.downlinkLoss_})}),2e3)):this.log_.info("network quality calculating is already started")}},{key:"stop",value:function(){this.log_.info("stop network quality calculating"),-1!==this.interval_&&(yd.clearInterval(this.interval_),this.interval_=-1)}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}},{key:"uplinkNetworkQuality",get:function(){return this.uplinkNetworkQuality_},set:function(e){e!==this.uplinkNetworkQuality_&&this.log_.info("uplink network quality change ".concat(this.uplinkNetworkQuality," -> ").concat(e,", rtt: ").concat(this.uplinkRTT_,", loss: ").concat(this.uplinkLoss_)),this.uplinkNetworkQuality_=e}},{key:"downlinkNetworkQuality",get:function(){return this.downlinkNetworkQuality_},set:function(e){if(e!==this.downlinkNetworkQuality_){var t=this.getAverageLossAndRTT(Nt(this.downlinkLossAndRTTMap_.values())),n=t.rtt,r=t.loss;this.log_.info("downlink network quality change ".concat(this.downlinkNetworkQuality," -> ").concat(e,", rtt: ").concat(n,", loss: ").concat(r))}this.downlinkNetworkQuality_=e}}]),e}(),dm=function(){function e(){yt(this,e),this.log_=Os,this.localStream_=null,this.prevDevices_=[],this.initialize()}var t,n,r;return kt(e,[{key:"initialize",value:(r=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",this.onDeviceChange.bind(this));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"onDeviceChange",value:(n=St(regeneratorRuntime.mark((function e(){var t,n,r,i=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.localStream_&&this.localStream_.getMediaStream()&&!this.localStream_.getScreen()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,k_.getDevices();case 4:t=e.sent,n=t.filter((function(e){return i.prevDevices_.findIndex((function(t){var n=t.deviceId;return e.deviceId===n}))<0})),r=this.prevDevices_.filter((function(e){return t.findIndex((function(t){var n=t.deviceId;return e.deviceId===n}))<0})),n.length>0&&this.handleDeviceAdded(this.prevDevices_,n),r.length>0&&this.handleDeviceRemoved(t,r),this.prevDevices_=t;case 10:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"setLocalStream",value:(t=St(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}return e.next=3,k_.getDevices();case 3:this.prevDevices_=e.sent;case 4:this.localStream_=t;case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"handleDeviceAdded",value:function(e,t){this.log_.warn("devicesAdded: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=t.filter((function(e){return"videoinput"===e.kind})),r=t.filter((function(e){return"audioinput"===e.kind})),i=e.filter((function(e){return"videoinput"===e.kind})),a=e.filter((function(e){return"audioinput"===e.kind})),o=n.length>0&&0===i.length&&this.localStream_.getVideo(),s=r.length>0&&0===a.length&&this.localStream_.getAudio();if(s&&o)return this.log_.info("new microphone and camera detected, but there was no device before."),void this.localStream_.updateStream({audio:!0,video:!0,cameraId:n[0].deviceId,microphoneId:r[0].deviceId});o&&(this.log_.info("new camera detected, but there was no camera before."),this.localStream_.updateStream({audio:!1,video:!0,cameraId:n[0].deviceId})),s&&(this.log_.info("new microphone detected, but there was no microphone before."),this.localStream_.updateStream({audio:!0,video:!1,microphoneId:r[0].deviceId}))}},{key:"handleDeviceRemoved",value:function(e,t){this.log_.warn("devicesRemoved: ".concat(JSON.stringify(t))),this.localStream_.updateDeviceIdInUse();var n=!1,r=!1,i=this.localStream_.getCameraId(),a=this.localStream_.getMicrophoneId();if("default"===a){var o=this.localStream_.getMicrophoneGroupId(),s=e.filter((function(e){return"default"===e.deviceId&&"audioinput"===e.kind}))[0];s&&s.groupId!==o&&(r=!0)}if(t.forEach((function(e){var t=e.deviceId;i.length>0&&t===i?n=!0:a.length>0&&t===a&&(r=!0)})),n&&r)return this.log_.warn("current camera and microphone in use is lost, cameraId: ".concat(i,", microphoneId: ").concat(a)),void((this.localStream_.getAudio()||this.localStream_.getVideo())&&this.localStream_.updateStream({video:!0,audio:!0}));n&&(this.log_.warn("current camera in use is lost, deviceId: ".concat(i)),this.localStream_.getVideo()&&this.localStream_.updateStream({video:!0,audio:!1})),r&&(this.log_.warn("current microphone in use is lost, deviceId: ".concat(a)),this.localStream_.getAudio()&&this.localStream_.updateStream({video:!1,audio:!0}))}}]),e}(),lm=We.find,hm=!0,pm=rt("find");"find"in[]&&Array(1).find((function(){hm=!1})),Pe({target:"Array",proto:!0,forced:hm||!pm},{find:function(e){return lm(this,e,arguments.length>1?arguments[1]:void 0)}}),bu("find");var fm=1..toFixed,mm=Math.floor,_m=function(e,t,n){return 0===t?n:t%2==1?_m(e,t-1,n*e):_m(e*e,t/2,n)},vm=fm&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!i((function(){fm.call({})}));Pe({target:"Number",proto:!0,forced:vm},{toFixed:function(e){var t,n,r,i,a=function(e){if("number"!=typeof e&&"Number"!=l(e))throw TypeError("Incorrect invocation");return+e}(this),o=se(e),s=[0,0,0,0,0,0],c="",u="0",d=function(e,t){for(var n=-1,r=t;++n<6;)r+=e*s[n],s[n]=r%1e7,r=mm(r/1e7)},h=function(e){for(var t=6,n=0;--t>=0;)n+=s[t],s[t]=mm(n/e),n=n%e*1e7},p=function(){for(var e=6,t="";--e>=0;)if(""!==t||0===e||0!==s[e]){var n=String(s[e]);t=""===t?n:t+Ys.call("0",7-n.length)+n}return t};if(o<0||o>20)throw RangeError("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return String(a);if(a<0&&(c="-",a=-a),a>1e-21)if(n=(t=function(e){for(var t=0,n=e;n>=4096;)t+=12,n/=4096;for(;n>=2;)t+=1,n/=2;return t}(a*_m(2,69,1))-69)<0?a*_m(2,-t,1):a/_m(2,t,1),n*=4503599627370496,(t=52-t)>0){for(d(0,n),r=o;r>=7;)d(1e7,0),r-=7;for(d(_m(10,r,1),0),r=t-1;r>=23;)h(1<<23),r-=23;h(1<<r),d(1,1),h(2),u=p()}else d(0,n),d(1<<-t,0),u=p()+Ys.call("0",o);return u=o>0?c+((i=u.length)<=o?"0."+Ys.call("0",o-i)+u:u.slice(0,i-o)+"."+u.slice(i-o)):c+u}});var gm=window.AudioContext||window.webkitAudioContext,Sm=null,ym=function(){function e(){var t=this;yt(this,e),Sm||(Sm=new gm),this.context_=Sm,this.instant_=0,this.slow_=0,this.clip_=0,this.script_=this.context_.createScriptProcessor(2048,1,1),this.script_.onaudioprocess=function(e){var n,r=e.inputBuffer.getChannelData(0),i=0,a=0;for(n=0;n<r.length;++n)i+=r[n]*r[n],Math.abs(r[n])>.99&&(a+=1);t.instant_=Math.sqrt(i/r.length),t.slow_=.95*t.slow_+.05*t.instant_,t.clip_=a/r.length}}return kt(e,[{key:"connectToSource",value:function(e,t){try{var n=new MediaStream;n.addTrack(e),this.mic_=this.context_.createMediaStreamSource(n),this.mic_.connect(this.script_),this.script_.connect(this.context_.destination),Cs(t)||t(null)}catch(T_){Os.error("soundMeter connectToSource error: "+T_),Cs(t)||t(T_)}}},{key:"stop",value:function(){this.mic_.disconnect(),this.script_.disconnect()}},{key:"resume",value:function(){this.context_&&this.context_.resume()}},{key:"getVolume",value:function(){return this.instant_.toFixed(2)}}]),e}(),bm=function(){function e(t){yt(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getIDLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.outputDeviceId_=t.outputDeviceId,this.volume_=t.volume,this.emitter_=new Uh,this.initializeElement(),this.state_="NONE",this.soundMeter_=null}var t,n,r,i;return kt(e,[{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement("audio");t.srcObject=e,t.muted=this.muted_,t.setAttribute("id","audio_".concat(this.stream_.getId())),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.div_.appendChild(t),this.element_=t,this.handleEvents()}},{key:"play",value:(i=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.outputDeviceId_){e.next=3;break}return e.next=3,this.element_.setSinkId(this.outputDeviceId_);case 3:return this.setVolume(this.volume_),e.prev=4,e.next=7,this.element_.play();case 7:e.next=15;break;case 9:if(e.prev=9,e.t0=e.catch(4),this.log_.warn("<audio> play() error: "+e.t0),!(t=e.t0.toString()+" <audio>").startsWith("NotAllowedError")){e.next=15;break}throw new vs({code:_s.PLAY_NOT_ALLOWED,message:t});case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(){return i.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener("playing",this.handleElementEvent),this.element_.addEventListener("ended",this.handleElementEvent),this.element_.addEventListener("pause",this.handleElementEvent),this.element_.addEventListener("error",this.handleElementEvent),this.track_.addEventListener("ended",this.handleTrackEvent),this.track_.addEventListener("mute",this.handleTrackEvent),this.track_.addEventListener("unmute",this.handleTrackEvent)}},{key:"handleElementEvent",value:(r=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.type,e.t0=n,e.next="playing"===e.t0?4:"ended"===e.t0?9:"pause"===e.t0?12:"error"===e.t0?16:27;break;case 4:return this.log_.info("stream - audio player is starting playing"),this.state_="PLAYING",sm.emit(cm.AUDIO_PLAYING,{stream:this.stream_}),this.emitter_.emit(im,{state:this.state_,reason:"playing"}),e.abrupt("break",27);case 9:return this.log_.info("stream - audio player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(im,{state:this.state_,reason:"ended"})),e.abrupt("break",27);case 12:return this.log_.info("stream - audio player is paused"),this.state_="PAUSED",this.emitter_.emit(im,{state:this.state_,reason:"pause"}),e.abrupt("break",27);case 16:if(!this.element_||!this.element_.error){e.next=26;break}return r="".concat(wf(),"/").concat(hf().browserName,"/").concat(hf().browserVersion),e.next=20,k_.getSpeakers();case 20:i=e.sent,a=i[0].label,(o=i.find((function(e){return e.deviceId===s.outputDeviceId_})))&&(a=o.label),this.log_.error("stream - audio player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(r," speaker: ").concat(a)),tf("stat-".concat(this.stream_.getType(),"-audio-").concat($o,"-").concat(this.element_.error.code,"-").concat(r,"-").concat(a),this.element_.error);case 26:return e.abrupt("break",27);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"handleTrackEvent",value:function(e){switch(e.type){case"ended":this.log_.info("stream - audio player track is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(im,{state:this.state_,reason:"ended"}));break;case"mute":this.log_.info("stream - audio track is unable to provide media output"),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit(im,{state:this.state_,reason:"mute"}));break;case"unmute":this.log_.info("stream - audio track is able to provide media output"),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit(im,{state:this.state_,reason:"unmute"}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener("playing",this.handleElementEvent),this.element_.removeEventListener("ended",this.handleElementEvent),this.element_.removeEventListener("pause",this.handleElementEvent),this.element_.removeEventListener("error",this.handleElementEvent)),this.track_&&(this.track_.removeEventListener("ended",this.handleTrackEvent),this.track_.removeEventListener("mute",this.handleTrackEvent),this.track_.removeEventListener("unmute",this.handleTrackEvent))}},{key:"setSinkId",value:(n=St(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.outputDeviceId_===t){e.next=4;break}return e.next=3,this.element_.setSinkId(t);case 3:this.outputDeviceId_=t;case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setVolume",value:function(e){this.log_.info("stream - audioElement setVolume to : ".concat(e)),this.element_.volume=e}},{key:"getAudioLevel",value:function(){return this.soundMeter_||(this.soundMeter_=new ym,this.soundMeter_.connectToSource(this.track_)),this.soundMeter_.getVolume()}},{key:"stop",value:function(){this.unbindEvents(),this.div_.removeChild(this.element_),this.element_.srcObject=null,this.soundMeter_&&(this.soundMeter_.stop(),this.soundMeter_=null),this.element_=null}},{key:"resume",value:(t=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.soundMeter_&&this.soundMeter_.resume(),e.next=4,this.element_.play();case 4:e.next=12;break;case 6:if(e.prev=6,e.t0=e.catch(0),this.log_.warn("<audio> play() error: "+e.t0),!(t=e.t0.toString()+" <audio>").startsWith("NotAllowedError")){e.next=12;break}throw new vs({code:_s.PLAY_NOT_ALLOWED,message:t});case 12:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(){return t.apply(this,arguments)})},{key:"on",value:function(e,t){this.emitter_.on(e,t)}}]),e}(),km=function(){function e(t){yt(this,e),this.stream_=t.stream,this.userId_=t.stream.getUserId(),this.log_=this.stream_.getIDLogger(),this.track_=t.track,this.div_=t.div,this.muted_=t.muted,this.objectFit_=t.objectFit,this.mirror_=t.mirror,this.emitter_=new Uh,this.initializeElement(),this.state_="NONE"}var t,n;return kt(e,[{key:"initializeElement",value:function(){var e=new MediaStream;e.addTrack(this.track_);var t=document.createElement("video");t.srcObject=e,t.muted=!0;var n="width: 100%; height: 100%; object-fit: ".concat(this.objectFit_,";");this.mirror_&&(n+="transform: rotateY(180deg);"),t.setAttribute("id","video_".concat(this.stream_.getId())),t.setAttribute("style",n),t.setAttribute("autoplay","autoplay"),t.setAttribute("playsinline","playsinline"),this.div_.appendChild(t),this.element_=t,this.handleEvents()}},{key:"play",value:(n=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.element_.play();case 3:e.next=11;break;case 5:if(e.prev=5,e.t0=e.catch(0),this.log_.warn("<video> play() error: "+e.t0),!(t=e.t0.toString()+" <video>").startsWith("NotAllowedError")){e.next=11;break}throw new vs({code:_s.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return n.apply(this,arguments)})},{key:"handleEvents",value:function(){this.handleElementEvent=this.handleElementEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.element_.addEventListener("playing",this.handleElementEvent),this.element_.addEventListener("ended",this.handleElementEvent),this.element_.addEventListener("pause",this.handleElementEvent),this.element_.addEventListener("error",this.handleElementEvent),this.element_.addEventListener("loadeddata",this.handleElementEvent),this.track_.addEventListener("ended",this.handleTrackEvent),this.track_.addEventListener("mute",this.handleTrackEvent),this.track_.addEventListener("unmute",this.handleTrackEvent)}},{key:"handleElementEvent",value:function(e){switch(e.type){case"playing":this.log_.info("stream - video player is starting playing"),this.state_="PLAYING",sm.emit(cm.VIDEO_PLAYING,{stream:this.stream_}),this.emitter_.emit(im,{state:this.state_,reason:"playing"});break;case"ended":this.log_.info("stream - video player is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(im,{state:this.state_,reason:"ended"}));break;case"pause":this.log_.info("stream - video player is paused"),this.state_="PAUSED",this.emitter_.emit(im,{state:this.state_,reason:"pause"});break;case"error":if(this.element_&&this.element_.error){var t="".concat(wf(),"/").concat(hf().browserName,"/").concat(hf().browserVersion);this.log_.error("stream - video player error observed. code: ".concat(this.element_.error.code," message: ").concat(this.element_.error.message," deviceInfo: ").concat(t)),tf("stat-".concat(this.stream_.getType(),"-video-").concat($o,"-").concat(this.element_.error.code,"-").concat(t),this.element_.error)}break;case"loadeddata":sm.emit(cm.VIDEO_LOADED_DATA,{stream:this.stream_})}}},{key:"handleTrackEvent",value:function(e){switch(e.type){case"ended":this.log_.info("stream - video player track is ended"),"STOPPED"!==this.state_&&(this.state_="STOPPED",this.emitter_.emit(im,{state:this.state_,reason:"ended"}));break;case"mute":this.log_.info("stream - video track is unable to provide media output"),"PAUSED"!==this.state_&&(this.state_="PAUSED",this.emitter_.emit(im,{state:this.state_,reason:"mute"}),sm.emit(cm.VIDEO_TRACK_MUTED,{stream:this.stream_}));break;case"unmute":this.log_.info("stream - video track is able to provide media output"),"PAUSED"===this.state_&&(this.state_="PLAYING",this.emitter_.emit(im,{state:this.state_,reason:"unmute"}),sm.emit(cm.VIDEO_TRACK_UNMUTED,{stream:this.stream_}))}}},{key:"unbindEvents",value:function(){this.element_&&(this.element_.removeEventListener("playing",this.handleElementEvent),this.element_.removeEventListener("ended",this.handleElementEvent),this.element_.removeEventListener("pause",this.handleElementEvent),this.element_.removeEventListener("error",this.handleElementEvent),this.element_.removeEventListener("loadeddata",this.handleElementEvent)),this.track_&&(this.track_.removeEventListener("ended",this.handleTrackEvent),this.track_.removeEventListener("mute",this.handleTrackEvent),this.track_.removeEventListener("unmute",this.handleTrackEvent))}},{key:"stop",value:function(){this.unbindEvents(),this.div_.removeChild(this.element_),this.element_.srcObject=null,this.element_=null}},{key:"resume",value:(t=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.element_.play();case 3:e.next=11;break;case 5:if(e.prev=5,e.t0=e.catch(0),this.log_.warn("<video> play() error: "+e.t0),!(t=e.t0.toString()+" <video>").startsWith("NotAllowedError")){e.next=11;break}throw new vs({code:_s.PLAY_NOT_ALLOWED,message:t});case 11:case"end":return e.stop()}}),e,this,[[0,5]])}))),function(){return t.apply(this,arguments)})},{key:"getVideoFrame",value:function(){var e=document.createElement("canvas");return e.width=this.element_.videoWidth,e.height=this.element_.videoHeight,e.getContext("2d").drawImage(this.element_,0,0),e.toDataURL("image/png")}},{key:"on",value:function(e,t){this.emitter_.on(e,t)}}]),e}(),Tm=function(){function e(t){yt(this,e),this.userId_=t.userId,this.tinyId_=t.tinyId,this.client_=t.client,this.sdpSemantics_=t.client.getSdpSemantics(),this.isUplink_=t.isUplink,this.log_=new om({id:"n|"+this.userId_,direction:this.isUplink_?"local":"remote",type:""}),this.signalChannel_=t.signalChannel,this.peerConnection_=null,this.connectTimer_=-1,this.isErrorObserved_=!1,this.emitter_=new Uh,this.currentState_=To}var t;return kt(e,[{key:"initialize",value:function(){var e={iceServers:this.client_.getIceServers(),iceTransportPolicy:this.client_.getIceTransportPolicy(),sdpSemantics:this.sdpSemantics_,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",tcpCandidatePolicy:"disable",IceTransportsType:"nohost"};this.peerConnection_=new RTCPeerConnection(e),this.peerConnection_.onconnectionstatechange=this.onConnectionStateChange.bind(this)}},{key:"close",value:function(){this.log_.info("closing connection"),this.clearConnectTimer(),this.closePeerConnection()}},{key:"closePeerConnection",value:function(){this.peerConnection_&&(this.peerConnection_.onconnectionstatechange=function(e){},this.peerConnection_.close(),this.peerConnection_=null)}},{key:"getDTLSTransportState",value:function(){if(!this.peerConnection_)return"unknown";var e=null;if(this.isUplink_){if(!bf()||0===this.peerConnection_.getSenders().length)return"unknown";e=this.peerConnection_.getSenders()[0].transport}else{if(!yf()||0===this.peerConnection_.getReceivers().length)return"unknown";e=this.peerConnection_.getReceivers()[0].transport}return e?e.state:"unknown"}},{key:"onConnectionStateChange",value:function(e){var t=this,n=this.peerConnection_.iceConnectionState,r=this.getDTLSTransportState();if(this.log_.info("onConnectionStateChange() connectionState: "+e.target.connectionState),this.log_.info("ICE Transport state: ".concat(n,", DTLS Transport state: ").concat(r)),"connecting"===e.target.connectionState){this.clearConnectTimer();this.connectTimer_=setTimeout((function(){var e="".concat(t.isUplink_?"uplink":"downlink"," DTLS Transport connection timeout (").concat(10,"s). ICE Transport state: ").concat(t.peerConnection_.iceConnectionState,", DTLS Transport state: ").concat(t.getDTLSTransportState());t.emitConnectionStateChangedEvent(To),t.isErrorObserved_=!0;var n=new vs({message:e,code:_s.ICE_TRANSPORT_ERROR});of({eventType:Ho,error:n}),t.emitter_.emit(Uf,n)}),1e4),this.emitConnectionStateChangedEvent(Ro)}else this.clearConnectTimer();if("failed"===e.target.connectionState||"closed"===e.target.connectionState){var i="".concat(this.isUplink_?"uplink":"downlink"," ICE/DTLS Transport connection ").concat(e.target.connectionState,". ICE Transport state: ").concat(n,", DTLS Transport state: ").concat(r),a=new vs({message:i,code:_s.ICE_TRANSPORT_ERROR});of({eventType:Ho,error:a}),this.emitConnectionStateChangedEvent(To),this.isErrorObserved_||this.emitter_.emit(Uf,a)}if(("connected"===e.target.connectionState||"completed"===e.target.connectionState)&&(this.logSelectedCandidate(),af({eventType:Ho}),this.emitConnectionStateChangedEvent(Co),!this.isUplink_&&!this.sentSubscriptionAfterConnected_&&this.pendingSubscription_.length>0)){this.log_.info("send pending subscription after RTCPeerConnection is connected");var o=this.pendingSubscription_[0];this.doSendSubscription(o.data,o.stream,o.type),this.sentSubscriptionAfterConnected_=!0}}},{key:"emitConnectionStateChangedEvent",value:function(e){e!==this.currentState_&&(this.currentState_===Eo&&e===Ro||(sm.emit(cm.CONNECTION_STATE_CHANGED,{client:this.client_,connection:this,prevState:this.currentState_,state:e}),this.emitter_.emit(Vf,{prevState:this.currentState_,state:e}),this.currentState_=e))}},{key:"hitTest",value:function(e){return(0===e||"0"===e)&&this.isUplink_||e===this.tinyId_}},{key:"addEventInternal",value:function(e,t){var n=this.client_.getUserId(),r={eventId:e,eventDesc:t,timestamp:kd(),userId:n,tinyId:this.client_.getTinyId()};this.isUplink_||(r.remoteUserId=this.userId_,r.remoteTinyId=this.tinyId_),$p(n,r)}},{key:"getPeerConnection",value:function(){return this.peerConnection_}},{key:"getClient",value:function(){return this.client_}},{key:"getUserId",value:function(){return this.userId_}},{key:"getTinyId",value:function(){return this.tinyId_}},{key:"clearConnectTimer",value:function(){-1!==this.connectTimer_&&(clearTimeout(this.connectTimer_),this.connectTimer_=-1)}},{key:"logSelectedCandidate",value:(t=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.peerConnection_){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.peerConnection_.getStats();case 4:t=e.sent,n=jt(t),e.prev=6,n.s();case 8:if((r=n.n()).done){e.next=18;break}if((i=Lt(r.value,2))[0],a=i[1],!Cf(a)){e.next=16;break}return o=t.get(a.localCandidateId),s=t.get(a.remoteCandidateId),o&&this.log_.debug("local candidate: ".concat(o.candidateType," ").concat(o.protocol,":").concat(o.ip||o.address,":").concat(o.port," ").concat(o.networkType||""," ").concat("relay"===o.candidateType?"relayProtocol:"+o.relayProtocol:"")),s&&this.log_.debug("remote candidate: ".concat(s.candidateType," ").concat(s.protocol,":").concat(s.ip||s.address,":").concat(s.port)),e.abrupt("break",18);case 16:e.next=8;break;case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(6),n.e(e.t0);case 23:return e.prev=23,n.f(),e.finish(23);case 26:case"end":return e.stop()}}),e,this,[[6,20,23,26]])}))),function(){return t.apply(this,arguments)})},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){this.emitter_.off(e,t,n)}}]),e}(),Rm=function(){function e(t){yt(this,e),this.userId_=t.userId,this.isRemote_=t.isRemote,this.type_=t.type,this.log_=new om({id:"s|"+this.userId_,direction:this.isRemote_?"remote":"local",type:this.isRemote_?this.type_:""}),this.mirror_=!1,this.isRemote_||(this.mirror_=!0),Cs(t.mirror)||(this.mirror_=t.mirror),this.client_=null,Cs(t.client)||(this.client_=t.client),this.mediaStream_=null,this.div_=null,this.isPlaying_=!1,this.connection_=null,this.audioPlayer_=null,this.videoPlayer_=null,this.muted_=!1,this.objectFit_="cover",this.id_=Sd(),this.audioOutputDeviceId_=0,this.audioVolume_=1,this.emitter_=new Uh,this.connectionState_=To}var t,n,r,i,a;return kt(e,[{key:"getType",value:function(){return this.type_}},{key:"getIDLogger",value:function(){return this.log_}},{key:"emitConnectionStateChanged",value:function(e){e.state!==this.connectionState_&&(e.state!==To&&this.isRemote_&&!this.isSubscribed||(this.emitter_.emit(nm,e),this.connectionState_=e.state))}},{key:"setConnection",value:function(e){this.connection_!==e&&(e instanceof Tm?(null!==this.connection_&&this.connection_.off(Vf,this.emitConnectionStateChanged,this),e.on(Vf,this.emitConnectionStateChanged,this)):null===e&&this.connection_.off(Vf,this.emitConnectionStateChanged,this),this.connection_=e)}},{key:"getConnection",value:function(){return this.connection_}},{key:"play",value:(a=St(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPlaying_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"duplicated play() call observed, please stop() firstly"});case 2:return this.isPlaying_=!0,this.log_.info("stream start to play with options: ".concat(JSON.stringify(n))),(r=document.createElement("div")).setAttribute("id","player_".concat(this.id_)),r.setAttribute("style","width: 100%; height: 100%; position: relative; background-color: black; overflow: hidden;"),i=t,"object"!==vt(t)&&(i=document.getElementById(t)),i.appendChild(r),this.div_=r,this.isRemote_||(this.muted_=!0),n&&!Cs(n.muted)&&(this.muted_=n.muted),this.isRemote_&&"auxiliary"===this.getType()&&(this.objectFit_="contain"),n&&!Cs(n.objectFit)&&(this.objectFit_=n.objectFit),sm.emit(cm.PLAY_STREAM_START,{stream:this}),e.next=18,Promise.all([this.playAudio(),this.playVideo()]);case 18:sm.emit(cm.STREAM_PLAY_SUCCESS,{stream:this});case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"playAudio",value:(i=St(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasAudio()&&(!this.isRemote_||this.isMainAudioSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(t=this.getAudioTrack(),this.audioPlayer_||!t){e.next=16;break}return this.log_.info("stream - create AudioPlayer and play"),this.audioPlayer_=new bm({stream:this,track:t,div:this.div_,muted:this.muted_,outputDeviceId:this.audioOutputDeviceId_,volume:this.audioVolume_}),this.audioPlayer_.on(im,(function(e){var t={type:"audio",state:e.state,reason:e.reason};sm.emit(cm.PLAYER_STATE_CHANGED,Et({stream:n},t)),n.emitter_.emit(em,t)})),e.prev=7,e.next=10,this.audioPlayer_.play();case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(7),this.emitter_.emit(rm,e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[7,12]])}))),function(){return i.apply(this,arguments)})},{key:"playVideo",value:(r=St(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.hasVideo()&&(!this.isRemote_||this.isMainVideoSubscribed||this.isAuxVideoSubscribed)){e.next=2;break}return e.abrupt("return");case 2:if(t=this.getVideoTrack(),this.videoPlayer_||!t){e.next=17;break}return sm.emit(cm.PLAY_VIDEO_START,{stream:this}),this.log_.info("stream - create VideoPlayer and play"),this.videoPlayer_=new km({stream:this,track:t,div:this.div_,muted:this.muted_,objectFit:this.objectFit_,mirror:this.mirror_}),this.videoPlayer_.on(im,(function(e){var t={type:"video",state:e.state,reason:e.reason};sm.emit(cm.PLAYER_STATE_CHANGED,Et({stream:n},t)),n.emitter_.emit(em,t)})),e.prev=8,e.next=11,this.videoPlayer_.play();case 11:e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(8),this.emitter_.emit(rm,e.t0),e.t0;case 17:case"end":return e.stop()}}),e,this,[[8,13]])}))),function(){return r.apply(this,arguments)})},{key:"stopAudio",value:function(){this.audioPlayer_&&(this.log_.info("stream - stop AudioPlayer"),this.audioPlayer_.stop(),this.audioPlayer_=null)}},{key:"stopVideo",value:function(){this.videoPlayer_&&(this.log_.info("stream - stop VideoPlayer"),this.videoPlayer_.stop(),this.videoPlayer_=null)}},{key:"restartAudio",value:function(){this.isPlaying_&&(this.stopAudio(),this.playAudio().catch((function(e){})))}},{key:"restartVideo",value:function(){this.isPlaying_&&(this.stopVideo(),this.playVideo().catch((function(e){})))}},{key:"stop",value:function(){this.isPlaying_&&(this.isPlaying_=!1,this.stopAudio(),this.stopVideo(),this.div_.parentNode.removeChild(this.div_))}},{key:"resume",value:(n=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isPlaying_){e.next=2;break}return e.abrupt("return");case 2:if(this.log_.info("stream - resume"),!this.audioPlayer_){e.next=6;break}return e.next=6,this.audioPlayer_.resume();case 6:if(!this.videoPlayer_){e.next=9;break}return e.next=9,this.videoPlayer_.resume();case 9:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"close",value:function(){this.isPlaying_&&this.stop(),this.mediaStream_&&(this.mediaStream_.preventEvent=1,this.mediaStream_.getTracks().forEach((function(e){e.stop()})),this.mediaStream_=null)}},{key:"muteAudio",value:function(){return this.addRemoteEvent(!0,"audio"),this.doEnableTrack("audio",!1)}},{key:"muteVideo",value:function(){return this.addRemoteEvent(!0,"video"),this.doEnableTrack("video",!1)}},{key:"unmuteAudio",value:function(){return this.addRemoteEvent(!1,"audio"),this.doEnableTrack("audio",!0)}},{key:"unmuteVideo",value:function(){return this.addRemoteEvent(!1,"video"),this.doEnableTrack("video",!0)}},{key:"addRemoteEvent",value:function(e,t){if(this.isRemote_&&this.client_){var n=this.client_.getUserId(),r="".concat(e?"mute":"unmute"," remote ").concat(t);$p(n,{eventId:"audio"===t?e?Dp:Op:e?Pp:Mp,eventDesc:r,timestamp:(new Date).getTime(),userId:n,tinyId:this.client_.getTinyId(),remoteUserId:this.userId_,remoteTinyId:this.connection_.getTinyId()})}}},{key:"doEnableTrack",value:function(e,t){var n=!1;return"audio"===e?this.mediaStream_.getAudioTracks().forEach((function(e){n=!0,e.enabled=t})):this.mediaStream_.getVideoTracks().forEach((function(e){n=!0,e.enabled=t})),n}},{key:"getId",value:function(){return this.id_}},{key:"getUserId",value:function(){return this.userId_}},{key:"getTinyId",value:function(){return this.connection_?this.connection_.getTinyId():""}},{key:"isPlaying",value:function(){return this.isPlaying_}},{key:"setAudioOutput",value:(t=St(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioOutputDeviceId_=t,!this.audioPlayer_){e.next=4;break}return e.next=4,this.audioPlayer_.setSinkId(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setAudioVolume",value:function(e){this.audioVolume_=e,this.log_.info("setAudioVolume to ".concat(e)),this.audioPlayer_&&this.audioPlayer_.setVolume(e)}},{key:"getAudioLevel",value:function(){var e=0;return this.audioPlayer_&&(e=this.audioPlayer_.getAudioLevel()),e}},{key:"hasAudio",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return"main"===this.type_&&e.audio}return!!this.getAudioTrack()}},{key:"hasVideo",value:function(){if(this.isRemote_){if(!this.connection_)return!1;var e=this.connection_.getTrackState();return"auxiliary"===this.type_?e.auxiliary:e.video}return!!this.getVideoTrack()}},{key:"getSubscribedState",value:function(){return this.isRemote_&&this.connection_?this.connection_.getSubscribeState():null}},{key:"getAudioTrack",value:function(){var e=null;if(this.mediaStream_){var t=this.mediaStream_.getAudioTracks();t.length>0&&(e=t[0])}return e}},{key:"getVideoTrack",value:function(){var e=null;if(this.mediaStream_){var t=this.mediaStream_.getVideoTracks();t.length>0&&(e=t[0])}return e}},{key:"getVideoFrame",value:function(){return this.videoPlayer_?this.videoPlayer_.getVideoFrame():null}},{key:"getMediaStream",value:function(){return this.mediaStream_}},{key:"setMediaStream",value:function(e){e!==this.mediaStream_&&(this.mediaStream_&&this.mediaStream_.getTracks().forEach((function(e){return e.stop()})),this.mediaStream_=e)}},{key:"updateVideoPlayingState",value:function(e){this.isPlaying_&&(e?(this.log_.info("playing state updated, play video"),this.playVideo().catch((function(e){}))):(this.log_.info("playing state updated, stop video"),this.stopVideo()))}},{key:"updateAudioPlayingState",value:function(e){this.isPlaying_&&(e?(this.log_.info("playing state updated, play audio"),this.playAudio().catch((function(e){}))):(this.log_.info("playing state updated, stop audio"),this.stopAudio()))}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){"*"===e?this.emitter_.removeAllListeners():this.emitter_.off(e,t,n)}},{key:"isRemote",value:function(){return this.isRemote_}},{key:"getDiv",value:function(){return this.div_}},{key:"getObjectFit",value:function(){return this.objectFit_}},{key:"getMuted",value:function(){return this.muted_}},{key:"getClient",value:function(){return this.client_}},{key:"isSubscribed",get:function(){return"main"===this.type_&&this.connection_.isMainStreamSubscribed||"auxiliary"===this.type_&&this.connection_.isAuxStreamSubscribed}},{key:"isMainVideoSubscribed",get:function(){var e=this.getSubscribedState();return"main"===this.type_&&e&&e.video}},{key:"isMainAudioSubscribed",get:function(){var e=this.getSubscribedState();return"main"===this.type_&&e&&e.audio}},{key:"isAuxVideoSubscribed",get:function(){var e=this.getSubscribedState();return"auxiliary"===this.type_&&e&&e.auxiliary}}]),e}(),Em=function(e){Ct(n,e);var t=Mt(n);function n(e){var r;yt(this,n);var i={isRemote:!0,type:e.type},a=Et(Et({},e),i);return(r=t.call(this,a)).isInSubscriptionCycle_=!1,r.isStreamAddedEventEmitted_=!1,r.installEvents(),r}return kt(n,[{key:"installEvents",value:function(){sm.on(cm.REMOTE_STREAM_SUBSCRIBED,this.handleStreamSubscribed,this),sm.on(cm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamUnsubscribed,this)}},{key:"uninstallEvents",value:function(){sm.off(cm.REMOTE_STREAM_SUBSCRIBED,this.handleStreamSubscribed,this),sm.off(cm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamUnsubscribed,this)}},{key:"handleStreamSubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.connection_.getCurrentState()===Co&&this.emitConnectionStateChanged({prevState:To,state:Co})}},{key:"handleStreamUnsubscribed",value:function(e){e.client===this.client_&&e.stream===this&&this.emitConnectionStateChanged({prevState:Co,state:To})}},{key:"getType",value:function(){return Ot(It(n.prototype),"getType",this).call(this)}},{key:"setInSubscriptionCycle",value:function(e){this.isInSubscriptionCycle_=e}},{key:"isInSubscriptionCycle",value:function(){return this.isInSubscriptionCycle_}},{key:"setIsStreamAddedEventEmitted",value:function(e){this.isStreamAddedEventEmitted_=e}},{key:"getIsStreamAddedEventEmitted",value:function(){return this.isStreamAddedEventEmitted_}},{key:"getAudioTrack",value:function(){return this.connection_&&this.connection_.getTrackState().audio?Ot(It(n.prototype),"getAudioTrack",this).call(this):null}},{key:"getVideoTrack",value:function(){if(!this.connection_)return null;var e=this.connection_.getTrackState();return("main"!==this.type_||e.video)&&("auxiliary"!==this.type_||e.auxiliary)?Ot(It(n.prototype),"getVideoTrack",this).call(this):null}},{key:"close",value:function(){this.uninstallEvents(),Ot(It(n.prototype),"close",this).call(this)}}]),n}(Rm),Cm=function(){function e(t){yt(this,e),this.client_=t.client,this.subscribedStreams_=new Map,this.unsubscribedStreams_=new Map,this.subscriptedOptions_=new Map,this.autoRecoveryFlags_=new Map}var t,n,r;return kt(e,[{key:"recover",value:(r=St(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.getUserId(),r=t.getType(),this.hasAutoRecoveryFlag(n,r)){e.next=5;break}return e.abrupt("return");case 5:if(i=this.getUnsubscribedStream(n,r)?"unsubscribe":"subscribe",e.prev=6,Os.warn("recover() try to recover subscription [".concat(i,"][").concat(n,"][").concat(r,"]")),"subscribe"!==i){e.next=13;break}return e.next=11,this.recoverSubscription(n,t);case 11:e.next=15;break;case 13:return e.next=15,this.recoverUnsubscription(n,t);case 15:af({eventType:qo}),Os.warn("recover() recover successfully [".concat(i,"][").concat(n,"][").concat(r,"]")),e.next=23;break;case 19:e.prev=19,e.t0=e.catch(6),Os.error("recover() recover failed [".concat(i,"][").concat(n,"][").concat(r,"]"),e.t0),of({eventType:qo,error:e.t0});case 23:this.deleteAutoRecoveryFlag(n,r);case 24:case"end":return e.stop()}}),e,this,[[6,19]])}))),function(e){return r.apply(this,arguments)})},{key:"recoverSubscription",value:(n=St(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getOptions(t,n.getType()),i=this.getSubscribedStream(t,n.getType()),r&&i){e.next=4;break}return e.abrupt("return");case 4:return a=this.getStreamMuteState(i),o=a.isAudioMuted,s=a.isVideoMuted,this.mergeStream(i,n),c=i.getConnection(),e.next=9,c.subscribe(i,r);case 9:this.recoverPlayingState(i),o&&i.doEnableTrack("audio",!1),s&&i.doEnableTrack("video",!1);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"recoverUnsubscription",value:(t=St(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.getUnsubscribedStream(t,n.getType())){e.next=3;break}return e.abrupt("return");case 3:return this.mergeStream(r,n),i=r.getConnection(),e.next=7,i.unsubscribe(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})},{key:"getStreamMuteState",value:function(e){var t={isAudioMuted:!1,isVideoMuted:!1},n=e.getMediaStream();return n&&(t.isAudioMuted=n.getAudioTracks().map((function(e){return e.enabled})).includes(!1),t.isVideoMuted=n.getVideoTracks().map((function(e){return e.enabled})).includes(!1)),t}},{key:"recoverPlayingState",value:function(e){var t=e.isPlaying(),n=e.getDiv();if(t&&n){var r=n.parentNode;e.stop(),e.play(r,{objectFit:e.getObjectFit(),muted:e.getMuted()})}}},{key:"mergeStream",value:function(e,t){var n=t.getConnection(),r=t.getMediaStream();e.setConnection(n),n.setRemoteStream(r.id,e),e.setMediaStream(r),e.updateAudioPlayingState(t.hasAudio()),e.updateVideoPlayingState(t.hasVideo())}},{key:"addSubscriptionRecord",value:function(e,t,n){var r=t.getType();if(this.subscribedStreams_.has(e))this.subscribedStreams_.get(e).set(r,t);else{var i=new Map;i.set(t.getType(),t),this.subscribedStreams_.set(e,i)}if(this.subscriptedOptions_.has(e))this.subscriptedOptions_.get(e).set(r,n);else{var a=new Map;a.set(t.getType(),n),this.subscriptedOptions_.set(e,a)}this.deleteUnsubscriptionRecord(e,r)}},{key:"addUnsubscriptionRecord",value:function(e,t){if(this.unsubscribedStreams_.has(e))this.unsubscribedStreams_.get(e).set(t.getType(),t);else{var n=new Map;n.set(t.getType(),t),this.unsubscribedStreams_.set(e,n)}this.deleteSubscriptionRecord(e,t.getType())}},{key:"getSubscribedStream",value:function(e,t){return this.subscribedStreams_.has(e)&&this.subscribedStreams_.get(e).has(t)?this.subscribedStreams_.get(e).get(t):null}},{key:"getOptions",value:function(e,t){return this.subscriptedOptions_.has(e)&&this.subscriptedOptions_.get(e).has(t)?this.subscriptedOptions_.get(e).get(t):null}},{key:"getUnsubscribedStream",value:function(e,t){return this.unsubscribedStreams_.has(e)&&this.unsubscribedStreams_.get(e).has(t)?this.unsubscribedStreams_.get(e).get(t):null}},{key:"deleteSubscriptionRecord",value:function(e,t){this.subscribedStreams_.has(e)&&this.subscribedStreams_.get(e).delete(t),this.subscriptedOptions_.has(e)&&this.subscriptedOptions_.get(e).delete(t)}},{key:"deleteUnsubscriptionRecord",value:function(e,t){this.unsubscribedStreams_.has(e)&&this.unsubscribedStreams_.get(e).delete(t)}},{key:"markAllStream",value:function(){for(var e=0,t=Nt(this.subscribedStreams_.entries());e<t.length;e++)for(var n=Lt(t[e],2),r=n[0],i=0,a=Nt(n[1].entries());i<a.length;i++){var o=Lt(a[i],1)[0];this.setAutoRecoveryFlag(r,o)}for(var s=0,c=Nt(this.unsubscribedStreams_.entries());s<c.length;s++)for(var u=Lt(c[s],2),d=u[0],l=0,h=Nt(u[1].entries());l<h.length;l++){var p=Lt(h[l],1)[0];this.setAutoRecoveryFlag(d,p)}}},{key:"setAutoRecoveryFlag",value:function(e,t){if(Os.info("setAutoRecoveryFlag() mark [".concat(e,"][").concat(t,"]")),this.autoRecoveryFlags_.has(e))this.autoRecoveryFlags_.get(e).set(t);else{var n=new Map;n.set(t),this.autoRecoveryFlags_.set(e,n)}}},{key:"hasAutoRecoveryFlag",value:function(e,t){return!!this.isEnabled&&(this.autoRecoveryFlags_.has(e)&&this.autoRecoveryFlags_.get(e).has(t))}},{key:"deleteAutoRecoveryFlag",value:function(e,t){this.autoRecoveryFlags_.has(e)&&this.autoRecoveryFlags_.get(e).delete(t)}},{key:"delete",value:function(e){this.unsubscribedStreams_.delete(e),this.subscribedStreams_.delete(e),this.subscriptedOptions_.delete(e),this.autoRecoveryFlags_.delete(e)}},{key:"isEnabled",get:function(){return"webrtc"!==this.client_.getEnv()}}]),e}(),Im=t((function(e){var t=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),wm=(Im.v,Im.o,Im.s,Im.i,Im.u,Im.e,Im.p,Im.z,Im.r,Im.t,Im.c,Im.b,Im.m,Im.a,t((function(e,t){var n=function(e){return String(Number(e))===e?Number(e):e},r=function(e,t,r){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var a=e.push?{}:i?t[e.name]:t;!function(e,t,r,i){if(i&&!r)t[i]=n(e[1]);else for(var a=0;a<r.length;a+=1)null!=e[a+1]&&(t[r[a]]=n(e[a+1]))}(r.match(e.reg),a,e.names,e.name),e.push&&t[e.push].push(a)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},n=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(n.push({rtp:[],fmtp:[]}),a=n[n.length-1]);for(var o=0;o<(Im[t]||[]).length;o+=1){var s=Im[t][o];if(s.reg.test(i))return r(s,a,i)}})),t.media=n,t};var a=function(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=n(r[1]):1===r.length&&t.length>1&&(e[r[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(a,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(n),i=0;i<r.length;i+=3)t.push({component:r[i],ip:r[i+1],port:r[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(a,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,r=!1;return"~"!==e[0]?t=n(e):(t=n(e.substring(1,e.length)),r=!0),{scid:t,paused:r}}))}))}}))),Am=(wm.parse,wm.parseParams,wm.parseFmtpConfig,wm.parsePayloads,wm.parseRemoteCandidates,wm.parseImageAttributes,wm.parseSimulcastStreamList,/%[sdv%]/g),xm=function(e){var t=1,n=arguments,r=n.length;return e.replace(Am,(function(e){if(t>=r)return e;var i=n[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},Pm=function(e,t,n){var r=[e+"="+(t.format instanceof Function?t.format(t.push?n:n[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var a=t.names[i];t.name?r.push(n[t.name][a]):r.push(n[t.names[i]])}else r.push(n[t.name]);return xm.apply(null,r)},Dm=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Mm=["i","c","b","a"],Om={write:function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var n=t.outerOrder||Dm,r=t.innerOrder||Mm,i=[];return n.forEach((function(t){Im[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(Pm(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(Pm(t,n,e))}))}))})),e.media.forEach((function(e){i.push(Pm("m",Im.m[0],e)),r.forEach((function(t){Im[t].forEach((function(n){n.name in e&&null!=e[n.name]?i.push(Pm(t,n,e)):n.push in e&&null!=e[n.push]&&e[n.push].forEach((function(e){i.push(Pm(t,n,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:wm.parse,parseParams:wm.parseParams,parseFmtpConfig:wm.parseFmtpConfig,parsePayloads:wm.parsePayloads,parseRemoteCandidates:wm.parseRemoteCandidates,parseImageAttributes:wm.parseImageAttributes,parseSimulcastStreamList:wm.parseSimulcastStreamList},Lm=function(e){return Om.parse(e)},Nm=function(e){return Om.write(e)},Um=function(e){var t=Lm(e);return t.media.forEach((function(e){"audio"===e.type&&e.fmtp.forEach((function(e){e.config+=";sprop-stereo=1;stereo=1"}))})),Nm(t)},Vm=function(){function e(){yt(this,e),this.video_=document.createElement("video"),this.video_.autoplay=!0,this.canvas_=document.createElement("canvas"),this.canvasCtx_=this.canvas_.getContext("2d")}return kt(e,[{key:"setSrc",value:function(e){this.video_.srcObject=e}},{key:"setCanvasRect",value:function(e,t){this.canvas_.width=e,this.canvas_.height=t}},{key:"drawVideoToCanvas",value:function(){this.canvasCtx_.drawImage(this.video_,0,0,this.canvas_.width,this.canvas_.height)}},{key:"generateVideoTrackFromCanvasCapture",value:function(e){return this.canvas_.captureStream(e).getVideoTracks()[0]}},{key:"generateStreamFromTrack",value:function(e){var t=new MediaStream;return t.addTrack(e),t}},{key:"canvas",get:function(){return this.canvas_}},{key:"canvasCtx",get:function(){return this.canvasCtx_}},{key:"canDrawVideoToCanvas",get:function(){return this.video_.readyState===this.video_.HAVE_ENOUGH_DATA}}]),e}(),jm=function(){function e(){yt(this,e),this.processor_=new Vm}return kt(e,[{key:"generateSmallVideoTrack",value:function(e){var t=this.getSmallVideoProfile(e),n=this.processor_.generateStreamFromTrack(e.videoTrack);this.processor_.setSrc(n),this.processor_.setCanvasRect(t.width,t.height);var r=this.processor_.generateVideoTrackFromCanvasCapture(t.framerate);return this.interval_=yd.setInterval(this.render.bind(this),Math.ceil(1e3/t.framerate)),r}},{key:"render",value:function(){this.processor_.canDrawVideoToCanvas&&this.processor_.drawVideoToCanvas()}},{key:"destroy",value:function(){yd.clearInterval(this.interval_)}},{key:"getSmallVideoProfile",value:function(e){var t,n=e.videoTrack,r=e.smallStreamConfig,i=n.getSettings(),a=i?{width:i.width,height:i.height}:e.videoProfile,o=a.width*a.height,s=r.width*r.height;return o>s?t=o/s:(Os.warn("Small stream resolution is larger than big stream, which is invalid."),t=o/19200),{width:parseInt(a.width/Math.sqrt(t)),height:parseInt(a.height/Math.sqrt(t)),framerate:r.framerate}}}]),e}(),Fm={voiceActivityDetection:!1},Bm=function(e){Ct(f,e);var t,n,r,i,a,o,s,c,u,d,l,h,p=Mt(f);function f(e){var t;return yt(this,f),(t=p.call(this,e)).localStream_=null,t.publishTimeout_=-1,t.isReconnecting_=!1,t.reconnectionCount_=0,t.reconnectionTimer_=-1,t.isFirstConnection_=!0,t.generator_=null,t.ssrc_={audio:0,video:0},t}return kt(f,[{key:"initialize",value:function(){Ot(It(f.prototype),"initialize",this).call(this),this.installEvents()}},{key:"reset",value:function(){Ot(It(f.prototype),"close",this).call(this),this.uninstallEvents(),this.clearPublishTimeout()}},{key:"close",value:function(){this.reset(),this.emitConnectionStateChangedEvent(To),this.generator_&&(this.generator_.destroy(),this.generator_=null)}},{key:"installEvents",value:function(){this.emitter_.on(Uf,this.handleError,this),this.emitter_.on(Vf,this.handleConnectionStateChange,this)}},{key:"uninstallEvents",value:function(){this.emitter_.off(Uf,this.handleError,this),this.emitter_.off(Vf,this.handleConnectionStateChange,this)}},{key:"publish",value:(h=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.localStream_=t,n=t.getMediaStream(),this.log_.info("is publishing stream: ".concat(t.getId())),r=this.localStream_.getAudioTrack(),i=this.localStream_.getVideoTrack(),r&&this.peerConnection_.addTrack(r,n),i&&(this.peerConnection_.addTrack(i,n),this.client_.getIsEnableSmallStream()&&(a=this.localStream_.getVideoProfile(),this.generator_=new jm,o=this.generator_.generateSmallVideoTrack({videoTrack:i,videoProfile:a,smallStreamConfig:this.client_.smallStreamConfig_}),this.peerConnection_.addTrack(o,n))),this.updateMediaSettings(n),e.next=10,this.exchangeSDP();case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"updateMediaSettings",value:function(e){var t=this,n=this.client_.getSystemResult().detail,r=n.isH264EncodeSupported,i=n.isVp8EncodeSupported,a="";r?a="H264":i&&(a="VP8");var o={EncVideoCodec:a,EncVideoWidth:0,EncVideoHeight:0,EncVideoBr:"0",EncVideoFps:0,EncAudioCodec:"opus",EncAudioFS:0,EncAudioCh:0,EncAudioBr:"0"};"getSettings"in MediaStreamTrack.prototype?e.getTracks().forEach((function(e){var n=e.getSettings();if("audio"===e.kind){var r=1;n.channelCount&&(r=n.channelCount),o.EncAudioCh=r,o.EncAudioBr="".concat(1e3*t.localStream_.getAudioBitrate()),o.EncAudioFS=n.sampleRate}else"video"===e.kind&&(t.client_.getIsEnableSmallStream()&&(o.EncSmallVideoWidth=t.client_.smallStreamConfig.width,o.EncSmallVideoHeight=t.client_.smallStreamConfig.height,o.EncSmallVideoFps=t.client_.smallStreamConfig.framerate,o.EncSmallVideoBr="".concat(1e3*t.client_.smallStreamConfig.bitrate)),o.EncVideoWidth=n.width,o.EncVideoHeight=n.height,o.EncVideoFps=n.frameRate,o.EncVideoBr="".concat(1e3*t.localStream_.getVideoBitrate()))})):o=this.getMediaSettingsFromProfile(o),this.log_.info("updateMediaSettings: "+JSON.stringify(o)),this.signalChannel_.send(ep,o)}},{key:"getMediaSettingsFromProfile",value:function(e){var t=this.localStream_;if(t){if(t.getAudioTrack()){var n=t.getAudioProfile();e.EncAudioCh=n.channelCount,e.EncAudioBr="".concat(1e3*n.bitrate),e.EncAudioFS=n.sampleRate}if(t.getVideoTrack()){var r=t.getVideoProfile();e.EncVideoWidth=r.width,e.EncVideoHeight=r.height,e.EncVideoFps=r.frameRate,e.EncVideoBr="".concat(1e3*r.bitrate)}}return e}},{key:"addTrack",value:(l=St(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_){e.next=19;break}if(this.log_.info("is adding ".concat(t.kind," track to current published local stream")),!(this.peerConnection_.getTransceivers().findIndex((function(e){return"stopped"===e.direction}))>=0)){e.next=6;break}return this.log_.warn("transceiver is stopping, negotiate sdp first"),e.next=6,this.updateOffer(ls,t);case 6:if(!(n=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===t.kind})))){e.next=13;break}return this.log_.warn("sender already exists, remove sender first"),r=n.track,this.removeSender(n),e.next=13,this.updateOffer(ls,r);case 13:return i=this.localStream_.getMediaStream(),this.peerConnection_.addTrack(t,i),this.updateMediaSettings(i),e.next=18,this.updateOffer(ds,t);case 18:$p(this.userId_,{eventId:t.kind===ss?vp:_p,eventDesc:"add ".concat(t.kind," track to current published stream"),timestamp:kd(),userId:this.userId_,tinyId:this.tinyId_});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"isNeedToResetOfferOrder",value:function(){if("plan-b"===this.sdpSemantics_||!this.peerConnection_||!this.peerConnection_.localDescription)return!1;for(var e=this.peerConnection_.localDescription.sdp,t=Lm(e),n=0;n<t.media.length;n++)if(0===t.media[n].mid&&"video"===t.media[n].type)return!0;return!1}},{key:"removeSender",value:function(e){var t=null;"RTCPeerConnection"in window&&"getTransceivers"in window.RTCPeerConnection.prototype&&(t=this.peerConnection_.getTransceivers().find((function(t){return t.sender&&t.sender.track===e.track}))),this.peerConnection_.removeTrack(e),t&&Es(t.stop)&&(this.log_.info("stop transceiver"),t.stop())}},{key:"removeTrack",value:(d=St(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.peerConnection_||!bf()){e.next=13;break}if(this.log_.info("is removing ".concat(t.kind," track from current published local stream")),"video"!==t.kind||!this.isNeedToResetOfferOrder()){e.next=8;break}return this.reset(),this.initialize(),e.next=7,this.publish(this.localStream_);case 7:return e.abrupt("return");case 8:return(n=this.peerConnection_.getSenders().find((function(e){return e.track===t})))&&(this.removeSender(n),this.updateMediaSettings(this.localStream_.getMediaStream())),e.next=12,this.updateOffer(ls,t);case 12:$p(this.userId_,{eventId:t.kind===ss?Sp:gp,eventDesc:"remove ".concat(t.kind," track from current published stream"),timestamp:kd(),userId:this.userId_,tinyId:this.tinyId_});case 13:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"isReplaceTrackAvailable",value:function(){return"RTCRtpSender"in window&&"replaceTrack"in window.RTCRtpSender.prototype}},{key:"replaceTrack",value:(u=St(regeneratorRuntime.mark((function e(t){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isReplaceTrackAvailable()&&bf()){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"replaceTrack is not supported in this browser, please use switchDevice or addTrack instead"});case 2:if(this.peerConnection_){e.next=4;break}throw new vs({code:_s.INVALID_OPERATION,message:"replaceTrack() is only valid after the LocalStream has been published"});case 4:if(0!==(n=this.peerConnection_.getSenders()).length){e.next=7;break}throw new vs({code:_s.INVALID_OPERATION,message:"replaceTrack() is only valid after the LocalStream has been published"});case 7:n.forEach((function(e){e.track&&e.track.kind===t.kind&&(r.log_.info("is replacing ".concat(t.kind," track to current published local stream")),e.replaceTrack(t))})),$p(this.userId_,{eventId:t.kind===ss?xp:Ap,eventDesc:"replace ".concat(t.kind," track from current published stream"),timestamp:kd(),userId:this.userId_,tinyId:this.tinyId_});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"setBandwidth",value:(c=St(regeneratorRuntime.mark((function e(t,n,r){var i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",r);case 2:if(Tf()){e.next=4;break}return e.abrupt("return","video"===n?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 4:if(!(i=this.peerConnection_.getSenders().find((function(e){return e.track&&e.track.kind===n})))){e.next=20;break}return(a=i.getParameters()).encodings&&0!==a.encodings.length||(a.encodings=[{}]),"unlimited"===t?delete a.encodings[0].maxBitrate:a.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,i.setParameters(a);case 12:return this.log_.debug(n+" bandwidth was set to "+t+" kbps"),e.abrupt("return",r);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.info("failed to set bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return","video"===n?this.updateVideoBandwidthRestriction(r,t):this.updateAudioBandwidthRestriction(r,t));case 20:return e.abrupt("return",r);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t,n){return c.apply(this,arguments)})},{key:"setSmallStreamBandwidth",value:(s=St(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isUplink_){e.next=2;break}return e.abrupt("return",n);case 2:if(Tf()){e.next=4;break}return e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 4:if(!(r=this.peerConnection_.getSenders().filter((function(e){return e.track&&"video"===e.track.kind}))[1])){e.next=20;break}return(i=r.getParameters()).encodings&&0!==i.encodings.length||(i.encodings=[{}]),"unlimited"===t?delete i.encodings[0].maxBitrate:i.encodings[0].maxBitrate=1e3*t,e.prev=9,e.next=12,r.setParameters(i);case 12:return this.log_.info("small stream bandwidth was set to "+t+" kbps"),e.abrupt("return",n);case 16:return e.prev=16,e.t0=e.catch(9),this.log_.debug("failed to set small stream bandwidth by setting maxBitrate: "+e.t0),e.abrupt("return",this.updateSmallVideoBandwidthRestriction(n,t));case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[9,16]])}))),function(e,t){return s.apply(this,arguments)})},{key:"updateVideoBandwidthRestriction",value:function(e,t){var n="AS";return fa&&(n="TIAS",t*=1e3),e=-1===e.indexOf("b="+n+":")?e.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n"):e.replace(new RegExp("b="+n+":.*\r\n"),"b="+n+":"+t+"\r\n")}},{key:"updateAudioBandwidthRestriction",value:function(e,t){var n="AS";return fa&&(n="TIAS",t*=1e3),e=e.replace(/m=audio (.*)\r\nc=IN (.*)\r\n/,"m=audio $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n")}},{key:"updateSmallVideoBandwidthRestriction",value:function(e,t){var n="AS";fa&&(n="TIAS",t*=1e3);var r=/m=video (.*)\r\nc=IN (.*)\r\n/g,i=[],a=r.exec(e);for(i.push(a);null!==a;)a=r.exec(e),i.push(a);var o=i[i.length-2],s=e.slice(0,o.index),c=e.slice(o.index);return e=-1===e.indexOf("b="+n+":")?s+(c=c.replace(/m=video (.*)\r\nc=IN (.*)\r\n/,"m=video $1\r\nc=IN $2\r\nb="+n+":"+t+"\r\n")):s+(c=c.replace(new RegExp("b="+n+":.*\r\n"),"b="+n+":"+t+"\r\n"))}},{key:"removeBandwidthRestriction",value:function(e){return e.replace(/b=AS:.*\r\n/,"").replace(/b=TIAS:.*\r\n/,"")}},{key:"removeVideoOrientation",value:function(e){return e.replace(/urn:3gpp:video-orientation/,"")}},{key:"exchangeSDP",value:(o=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.createOffer();case 2:return this.log_.info("createOffer success, sending offer to remote server"),e.next=5,this.doExchangeSDP();case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"createOffer",value:(a=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(Fm);case 3:return t=e.sent,e.next=6,this.peerConnection_.setLocalDescription(t);case 6:this.updateSSRC(t.sdp),af({eventType:Bo,kind:"offer"}),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),of({eventType:Bo,kind:"offer",error:e.t0}),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return a.apply(this,arguments)})},{key:"doExchangeSDP",value:function(){var e=this;return new Promise((function(t,n){e.publishTimeout_=setTimeout((function(){e.signalChannel_.off(Qh.PUBLISH_RESULT,r),e.signalChannel_.off(Qh.ON_PUBLISH_RESPONSE,r);var t=new vs({code:_s.UNKNOWN,message:"publish timeout"});n(t)}),1e4);var r=function(){var r=St(regeneratorRuntime.mark((function r(i){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,e.clearPublishTimeout(),r.next=4,e.acceptAnswer(i.data.content);case 4:t(),r.next=10;break;case 7:r.prev=7,r.t0=r.catch(0),n(r.t0);case 10:case"end":return r.stop()}}),r,null,[[0,7]])})));return function(e){return r.apply(this,arguments)}}(),i={type:e.peerConnection_.localDescription.type,sdp:e.removeVideoOrientation(e.peerConnection_.localDescription.sdp)};e.signalChannel_.once(Qh.PUBLISH_RESULT,r),e.signalChannel_.once(Qh.ON_PUBLISH_RESPONSE,r),e.log_.debug("sending sdp offer: "+i.sdp),e.signalChannel_.send(np,i,0)}))}},{key:"setSDPDirection",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all",r=Lm(e);return r.media.forEach((function(e){"all"!==n&&e.type!==n||(e.direction=t)})),Nm(r)}},{key:"updateOffer",value:(i=St(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection_.createOffer(Fm);case 3:return r=e.sent,fa&&(r.sdp=this.setSDPDirection(r.sdp,"sendrecv")),e.next=7,this.peerConnection_.setLocalDescription(r);case 7:return i={action:t,trackId:n.id,kind:n.kind,type:"offer",sdp:this.peerConnection_.localDescription.sdp},this.log_.info("createOffer success, sending updated offer to remote server"),this.log_.debug("updatedOffer: "+i.sdp),e.next=12,this.doUpdateOffer(i);case 12:af({eventType:Bo,kind:"offer"}),e.next=20;break;case 15:throw e.prev=15,e.t0=e.catch(0),this.log_.error(e.t0),of({eventType:Bo,kind:"offer",error:e.t0}),e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(e,t){return i.apply(this,arguments)})},{key:"doUpdateOffer",value:function(e){var t=this;return new Promise((function(n,r){t.signalChannel_.send(qh,e,0);var i=setTimeout((function(){t.signalChannel_.off(Qh.UPDATE_OFFER_RESULT,a),r(new vs({code:_s.UNKNOWN,message:"update offer timeout observed"}))}),1e4),a=function(){var e=St(regeneratorRuntime.mark((function e(a){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,clearTimeout(i),e.next=4,t.acceptAnswer(a.data.content);case 4:n(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),r(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}();t.signalChannel_.once(Qh.UPDATE_OFFER_RESULT,a)}))}},{key:"acceptAnswer",value:(r=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(77392!==t.result){e.next=4;break}throw n="your device does not support H.264 encoding.",this.log_.error(n),new vs({code:_s.NOT_SUPPORTED_H264,message:n});case 4:return r=this.localStream_.getVideoBitrate(),i=this.localStream_.getAudioBitrate(),a=this.removeVideoOrientation(t.sdp),e.prev=7,e.next=10,this.setBandwidth(r,"video",a);case 10:return a=e.sent,e.next=13,this.setBandwidth(i,"audio",a);case 13:if(a=e.sent,!this.client_.getIsEnableSmallStream()){e.next=19;break}return o=this.client_.smallStreamConfig,e.next=18,this.setSmallStreamBandwidth(o.bitrate,a);case 18:a=e.sent;case 19:return s={type:t.type,sdp:a},e.next=22,this.peerConnection_.setRemoteDescription(s);case 22:this.log_.debug("accepted answer: "+a),af({eventType:Jo,kind:"answer"}),e.next=31;break;case 26:throw e.prev=26,e.t0=e.catch(7),of({eventType:Jo,kind:"answer",error:e.t0}),this.log_.error("failed to accept remote answer "+e.t0),e.t0;case 31:case"end":return e.stop()}}),e,this,[[7,26]])}))),function(e){return r.apply(this,arguments)})},{key:"sendMutedFlag",value:function(e){var t={srctinyid:0,userid:this.userId_,flag:e};this.log_.info("send muted flag: ".concat(e)),this.signalChannel_.send(Zh,t)}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"reconnect",value:(n=St(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(-1===this.reconnectionTimer_){e.next=3;break}return this.log_.warn("reconnect() uplink is reconnecting, ignore current reconnection"),e.abrupt("return");case 3:if(!(this.reconnectionCount_>=30)){e.next=12;break}return this.log_.warn("SDK has tried reconnect uplink for ".concat(30," times, but all failed, please check your network")),this.stopReconnection(),t=new vs({code:_s.UPLINK_RECONNECTION_FAILED,message:"uplink reconnect failed, please check your network and publish again"}),of({eventType:Vo,error:t}),this.addEventInternal(Wp,"uplink-connection reconnect fail"),this.emitConnectionStateChangedEvent(To),this.emitter_.emit(Uf,t),e.abrupt("return");case 12:if(this.signalChannel_.getCurrentState()===Gh){e.next=16;break}return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),this.signalChannel_.once(jh,this.reconnect,this),e.abrupt("return");case 16:this.reconnectionCount_++;try{this.log_.warn("reconnect() try to reconnect uplink [".concat(this.reconnectionCount_,"/").concat(30,"]")),n=Rs(this.reconnectionCount_),this.reconnectionTimer_=setTimeout((function(){r.log_.warn("reconnect() uplink reconnect timeout(".concat(n/1e3,"s), try again")),r.signalChannel_.off(Qh.UNPUBLISH_RESULT,r.onUnpublishResult,r),r.clearReconnectionTimer(),r.reconnect()}),n),this.signalChannel_.send(rp),this.signalChannel_.once(Qh.UNPUBLISH_RESULT,this.onUnpublishResult,this)}catch(t){}case 18:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"onUnpublishResult",value:(t=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.reset(),this.initialize(),e.next=5,this.publish(this.localStream_);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(){return t.apply(this,arguments)})},{key:"clearPublishTimeout",value:function(){-1!==this.publishTimeout_&&(clearTimeout(this.publishTimeout_),this.publishTimeout_=-1)}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"stopReconnection",value:function(){this.log_.info("stop uplink reconnection"),this.isReconnecting_=!1,this.reconnectionCount_=0,this.clearReconnectionTimer(),this.signalChannel_.off(jh,this.reconnect,this)}},{key:"handleError",value:function(e){e.getCode()===_s.ICE_TRANSPORT_ERROR&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,of({eventType:Uo,error:e})),this.isReconnecting_||(this.isReconnecting_=!0,this.emitConnectionStateChangedEvent(Eo),this.reconnect(),this.addEventInternal(Gp,"uplink-connection is reconnecting")))}},{key:"handleConnectionStateChange",value:function(e){e.state===Co&&(this.isFirstConnection_&&(this.isFirstConnection_=!1,af({eventType:Uo}),this.addEventInternal(jp,"uplink-connection is connected")),this.isReconnecting_&&(af({eventType:Vo}),this.log_.warn("reconnect() uplink reconnect successfully"),this.addEventInternal(zp,"uplink-connection reconnect success"),this.stopReconnection()))}},{key:"updateSSRC",value:function(e){var t=this;try{var n=!1;Lm(e).media.forEach((function(e){if("audio"===e.type){var r=e.ssrcs[0];r&&(t.ssrc_.audio=r.id)}else if(!n){var i=e.ssrcs[0];i&&(t.ssrc_.video=i.id),n=!0}}))}catch(T_){}}},{key:"getLocalStreamVideoTrackId",value:function(){if(this.localStream_){var e=this.localStream_.getVideoTrack();if(e)return e.id}return""}},{key:"getSSRC",value:function(){return this.ssrc_}}]),f}(Tm),Jm=function(e){Ct(a,e);var t,n,r,i=Mt(a);function a(e){var t;return yt(this,a),(t=i.call(this,e)).remoteStreams_=new Map,t.autoSubscribe=e.autoSubscribe,t.trackState_={audio:e.trackState.audio,video:e.trackState.video,auxiliary:e.trackState.auxiliary},t.ssrc_={audio:0,video:0,auxiliary:0},t.subscribeState_={audio:e.autoSubscribe,video:e.autoSubscribe,auxiliary:e.autoSubscribe},t.pendingSubscription_=[],t.pendingStreams_=[],t.subscriptionTimeout_=-1,t.subscriptionRetryCount_=0,t.isSubscriptionPending_=!1,t.sentSubscriptionAfterConnected_=!1,t.isSDPExchanging_=!1,t.exchangeSDPResolve_=null,t.exchangeSDPReject_=null,t.isReconnecting_=!1,t.reconnectionCount_=0,t.reconnectionTimer_=-1,t.isFirstConnection_=!0,t.installEvents(),t}return kt(a,[{key:"initialize",value:function(){Ot(It(a.prototype),"initialize",this).call(this),this.peerConnection_.ontrack=this.onTrack.bind(this)}},{key:"close",value:function(){var e=this;Ot(It(a.prototype),"close",this).call(this),this.emitConnectionStateChangedEvent(To),-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1),this.remoteStreams_.forEach((function(t){var n=t;n.setConnection(null),n.getIsStreamAddedEventEmitted()&&e.emitter_.emit(Of,{stream:n})})),this.remoteStreams_.clear(),this.uninstallEvents()}},{key:"installEvents",value:function(){var e=this;sm.on(cm.REMOTE_STREAM_TRACK_UPDATED,this.onRemoteStreamUpdate,this),this.signalChannel_.on(Qh.SUBSCRIBE_RESULT,this.onSubscribeResult,this),this.signalChannel_.on(Qh.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.on(Qh.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,this),this.emitter_.on(Uf,(function(t){if(t.getCode()===_s.ICE_TRANSPORT_ERROR&&(e.isFirstConnection_&&(e.isFirstConnection_=!1,of({eventType:jo,error:t})),!e.isReconnecting_)){e.isReconnecting_=!0;var n=e.client_.getSubscriptionManager();if(n){var r,i=jt(e.remoteStreams_.values());try{for(i.s();!(r=i.n()).done;){var a=r.value,o=a.getType();("main"===o&&(e.trackState_.audio||e.trackState_.video)||"auxiliary"===o&&e.trackState_.auxiliary)&&n.setAutoRecoveryFlag(e.userId_,a.getType())}}catch(s){i.e(s)}finally{i.f()}}e.emitConnectionStateChangedEvent(Eo),e.reconnect(),e.addEventInternal(Qp,"downlink-connection is reconnecting")}})),this.emitter_.on(Vf,(function(t){t.state===Co&&(e.isFirstConnection_&&(e.isFirstConnection_=!1,af({eventType:jo}),e.addEventInternal(Fp,"downlink-connection is connected")),e.isReconnecting_&&(af({eventType:Fo}),e.log_.warn("reconnect() downlink reconnect successfully"),e.addEventInternal(qp,"downlink-connection reconnect success"),e.stopReconnection()))}))}},{key:"uninstallEvents",value:function(){sm.removeListener(cm.REMOTE_STREAM_TRACK_UPDATED,this.onRemoteStreamUpdate,this),this.signalChannel_.removeListener(Qh.SUBSCRIBE_CHANGE_RESULT,this.onSubscribeChangeResult,this),this.signalChannel_.removeListener(Qh.UNSUBSCRIBE_RESULT,this.onUnsubscribeResult,this),this.signalChannel_.removeListener(Qh.SUBSCRIBE_RESULT,this.onSubscribeResult,this)}},{key:"onRemoteStreamUpdate",value:function(e){if(this.hitTest(e.tinyId)&&e.client===this.client_){this.updateTrackState(e.action,e.kind);var t=e.kind===us?bo:yo,n=this.remoteStreams_.get(t);if(!n)return;e.action===ds?this.handleRemoteAddTrack(e.kind,n):this.handleRemoteRemoveTrack(e.kind,n)}}},{key:"handleRemoteAddTrack",value:function(e,t){this.log_.info("remote add ".concat(e," track")),"audio"===e?t.updateAudioPlayingState(this.subscribeState_.audio):t.updateVideoPlayingState(e===us?this.subscribeState_.auxiliary:this.subscribeState_.video),t.getIsStreamAddedEventEmitted()?this.emitter_.emit(Lf,{stream:t}):(this.emitter_.emit(Mf,{stream:t}),this.currentState_===Co&&t.emitConnectionStateChanged({prevState:To,state:Co}))}},{key:"handleRemoteRemoveTrack",value:function(e,t){t.getIsStreamAddedEventEmitted()&&(this.log_.info("remote remove ".concat(e," track")),e!==us&&(this.trackState_.audio||this.trackState_.video)||t.isInSubscriptionCycle()?("audio"===e?t.updateAudioPlayingState(!1):t.updateVideoPlayingState(!1),this.emitter_.emit(Lf,{stream:t})):(this.log_.info("remote stream ".concat(t.getType()," removed")),this.currentState_===Co&&t.emitConnectionStateChanged({prevState:Co,state:To}),this.emitter_.emit(Of,{stream:t})))}},{key:"updateTrackState",value:function(e,t){var n=e===ds;switch(t){case ss:this.trackState_.audio=n;break;case cs:this.trackState_.video=n;break;case us:this.trackState_.auxiliary=n}this.log_.info("trackState updated: ".concat(JSON.stringify(this.trackState_)))}},{key:"onTrack",value:function(e){var t=e.streams[0],n=e.track;if(this.log_.info("ontrack() kind: ".concat(n.kind," id: ").concat(n.id," streamId: ").concat(t.id)),"unified-plan"===this.sdpSemantics_){var r=function(e){var t=Om.parse(e),n={audio:[],video:[]};return t.media.forEach((function(e){if(e.ssrcs){var t=e.ssrcs[0].id>>16&255;if("audio"===e.type)n.audio.push(yo);else if("video"==e.type){var r=t===ko?yo:bo;n.video.push(r)}}})),n}(this.peerConnection_.remoteDescription.sdp);if("audio"===n.kind){if(0===r.audio.length||t.id!==yo)return void this.log_.debug("skip this invalid audio track")}else if(-1===r.video.indexOf(t.id))return void this.log_.debug("skip this invalid video track: ".concat(n.id," msid: ").concat(t.id))}rf({eventType:"ontrack",kind:n.kind});var i=!1,a=this.remoteStreams_.get(t.id),o=t.id===yo?"main":"auxiliary";if(Cs(a)&&((a=new Em({type:o,userId:this.userId_,client:this.client_})).setConnection(this),this.remoteStreams_.set(t.id,a),i=!0),a.setMediaStream(t),n.kind===ss?a.updateAudioPlayingState(this.subscribeState_.audio):"main"===o?a.updateVideoPlayingState(this.subscribeState_.video):a.updateVideoPlayingState(this.subscribeState_.auxiliary),("auxiliary"!==o||this.trackState_.auxiliary)&&("main"!==o||this.trackState_.audio||this.trackState_.video)){var s=this.client_.getSubscriptionManager();s&&s.hasAutoRecoveryFlag(this.userId_,o)?s.recover(a):i?this.emitter_.emit(Mf,{stream:a}):this.emitter_.emit(Lf,{stream:a})}}},{key:"addRRTRLine",value:function(e){var t=e.split("\r\n"),n=new Map;t.forEach((function(e,r){/^a=rtcp-fb:/.test(e)&&t[r+1]&&!/^a=rtcp-fb:/.test(t[r+1])&&n.set(r+1,e.match(/^a=rtcp-fb:\d+/)[0]+" rrtr")}));for(var r=Nt(n),i=0;i<r.length;i++){var a=Lt(r[i],2),o=a[0],s=a[1];t.splice(o+i,0,s)}return t.join("\r\n")}},{key:"addSPSDescription",value:function(e){var t=Lm(e);return t.media.forEach((function(e){"video"===e.type&&e.fmtp.forEach((function(e){e.config+=";sps-pps-idr-in-keyframe=1"}))})),Nm(t)}},{key:"removeSDESDescription",value:function(e){var t=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"],n=Lm(e);return n.media.forEach((function(e){e.ext=e.ext.filter((function(e){return!t.includes(e.uri)}))})),Nm(n)}},{key:"subscribe",value:(r=St(regeneratorRuntime.mark((function e(t,n){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(("main"!==(r=t.getType())||Cs(n.audio)||Cs(n.video)||n.audio!==this.subscribeState_.audio||n.video!==this.subscribeState_.video)&&("auxiliary"!==r||Cs(n.video)||this.subscribeState_.auxiliary!==n.video)){e.next=4;break}return this.emitter_.emit(Nf,{stream:t,result:!0}),e.abrupt("return",t);case 4:if("main"===r?(Cs(n.audio)||(this.subscribeState_.audio=n.audio),Cs(n.video)||(this.subscribeState_.video=n.video),this.addEventInternal(this.subscribeState_.audio?Rp:Cp,this.subscribeState_.audio?"subscribe audio":"unsubscribe audio"),this.addEventInternal(this.subscribeState_.video?Rp:Cp,this.subscribeState_.video?"subscribe video":"unsubscribe video")):Cs(n.video)||(this.subscribeState_.auxiliary=n.video),this.log_.info("subscribe ".concat(r," stream with options ").concat(JSON.stringify(n)," current state: ").concat(JSON.stringify(this.subscribeState_))),!this.peerConnection_&&!this.isSDPExchanging_){e.next=14;break}return i=Zo,this.isMainStreamSubscribed||this.isAuxStreamSubscribed||(i=Xo),e.next=11,this.sendSubscription(t,i);case 11:"main"===r?(t.updateAudioPlayingState(this.subscribeState_.audio),t.updateVideoPlayingState(this.subscribeState_.video)):t.updateVideoPlayingState(this.subscribeState_.auxiliary),e.next=17;break;case 14:return this.initialize(),e.next=17,this.exchangeSDP();case 17:return this.emitter_.emit(Nf,{stream:t,result:!0}),e.abrupt("return",t);case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unsubscribe",value:(n=St(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("main"!==(n=t.getType())){e.next=9;break}if(this.isMainStreamSubscribed){e.next=5;break}return this.log_.info("main stream already unsubscribed"),e.abrupt("return",t);case 5:this.subscribeState_.audio=!1,this.subscribeState_.video=!1,e.next=13;break;case 9:if(this.isAuxStreamSubscribed){e.next=12;break}return this.log_.info("auxiliary stream already unsubscribed"),e.abrupt("return",t);case 12:this.subscribeState_.auxiliary=!1;case 13:return r=Xo,("main"===n&&this.isAuxStreamSubscribed||"auxiliary"===n&&this.isMainStreamSubscribed)&&(r=Zo),this.log_.info("unsubscribe ".concat(n," stream with ").concat(JSON.stringify(this.subscribeState_))),e.next=18,this.sendSubscription(t,r);case 18:return t.updateVideoPlayingState(!1),t.updateAudioPlayingState(!1),r===Xo&&((i=t.getMediaStream())&&i.getTracks().forEach((function(e){return i.removeTrack(e)})),this.closePeerConnection(),this.emitConnectionStateChangedEvent(To)),this.addEventInternal(Cp,"unsubscribe audio"),this.addEventInternal(Ep,"unsubscribe video"),e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendSubscription",value:function(e,t){var n=this;return new Promise((function(r,i){var a={srctinyid:n.tinyId_,userid:n.userId_,audio:n.subscribeState_.audio,bigVideo:n.subscribeState_.video,auxVideo:n.subscribeState_.auxiliary};n.pendingSubscription_.length>0?n.log_.debug("queue the subscription for later handling"):n.doSendSubscription(a,e,t),n.pendingSubscription_.push({stream:e,type:t,data:a,callback:function(e){var a=e.code,o=e.message;if(0===a)r();else{var s="".concat(t," failed");o&&(s="".concat(s,": ").concat(o));var c=new vs({code:a,message:s});n.log_.error(c),i(c)}}}),e.setInSubscriptionCycle(!0)}))}},{key:"doSendSubscription",value:function(e,t,n){var r=this;if(!this.peerConnection_||"connected"!==this.peerConnection_.connectionState&&"completed"!==this.peerConnection_.connectionState)return this.log_.debug("try to send subscription [".concat(n,"] when peeConnection connected")),void(this.sentSubscriptionAfterConnected_=!1);t&&this.pendingStreams_.push(t),this.log_.debug("doSendSubscription() send SUBSCRIBE command with data: ".concat(JSON.stringify(e))),n===Zo?this.signalChannel_.send(op,e):n===Xo&&this.signalChannel_.send(ap,e),this.isSubscriptionPending_=!0,this.subscriptionTimeout_=setTimeout((function(){if(r.isSubscriptionPending_)if(r.log_.debug("subscription timeout"),r.subscriptionRetryCount_+=1,r.subscriptionRetryCount_<=3){r.log_.debug("resend subscription");var e=r.pendingSubscription_[0].data;r.doSendSubscription(e,t,n)}else r.log_.error("remote server not response to subscription"),r.pendingSubscription_.shift(),r.pendingStreams_.shift(),r.isSubscriptionPending_=!1,r.subscriptionRetryCount_=0,r.emitter_.emit(Uf,new vs({code:_s.SUBSCRIPTION_TIMEOUT,message:"remote server not response to subscription"}))}),5e3)}},{key:"onSubscribeChangeResult",value:function(e){var t=e.data.content,n=t.srctinyid;if(this.hitTest(n)){var r=this.pendingSubscription_[0];r&&r.type===Zo&&r.callback({code:t.errCode,message:t.errMsg}),this.sendNextSubscription()}}},{key:"onUnsubscribeResult",value:function(e){var t=e.data.content,n=t.srctinyid;if(this.hitTest(n)){var r=this.pendingSubscription_[0];r&&r.type===Xo&&r.callback({code:t.errCode,message:t.errMsg}),this.sendNextSubscription()}}},{key:"exchangeSDP",value:function(){var e=this;return new Promise(function(){var t=St(regeneratorRuntime.mark((function t(n,r){var i,a,o;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,"RTCPeerConnection"in window&&"addTransceiver"in window.RTCPeerConnection.prototype&&"unified-plan"===e.sdpSemantics_&&(e.peerConnection_.addTransceiver("audio",{direction:"recvonly"}),e.peerConnection_.addTransceiver("video",{direction:"recvonly"}),e.peerConnection_.addTransceiver("video",{direction:"recvonly"})),e.isSDPExchanging_=!0,t.next=5,e.peerConnection_.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,voiceActivityDetection:!1});case 5:return(i=t.sent).sdp=e.addRRTRLine(i.sdp),i.sdp=e.addSPSDescription(i.sdp),i.sdp=Um(i.sdp),"unified-plan"===e.sdpSemantics_&&(i.sdp=e.removeSDESDescription(i.sdp)),t.next=12,e.peerConnection_.setLocalDescription(i);case 12:e.log_.info("createOffer success, sending offer to remote server"),a=e.peerConnection_.localDescription,o={type:a.type,sdp:a.sdp,userid:e.userId_,srctinyid:e.tinyId_,audio:e.subscribeState_.audio,bigVideo:e.subscribeState_.video,auxVideo:e.subscribeState_.auxiliary},e.exchangeSDPResolve_=n,e.exchangeSDPReject_=r,sm.emit(cm.CONNECTION_SEND_SUBSCRIBE_CMD,{client:e.client_,connection:e,userId:e.userId_,tinyId:e.tinyId_,role:go,subscribeState:e.subscribeState_,trackState:e.trackState_}),e.signalChannel_.send(ip,o),t.next=25;break;case 21:t.prev=21,t.t0=t.catch(0),e.isSDPExchanging_=!1,r(t.t0);case 25:case"end":return t.stop()}}),t,null,[[0,21]])})));return function(e,n){return t.apply(this,arguments)}}())}},{key:"onSubscribeResult",value:(t=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data.content||77393!==t.data.content.errCode){e.next=6;break}return n="your device does not support H.264 decoding.",this.log_.error(n),r=new vs({code:_s.NOT_SUPPORTED_H264,message:n}),this.emitter_.emit(Uf,r),e.abrupt("return");case 6:if(i=t.data.content,a=i.srctinyid,o=i.type,s=i.sdp,c=i.errCode,u=i.errMsg,!this.hitTest(a)){e.next=26;break}if(e.prev=8,this.log_.debug("accept remote answer: "+s),0!==c){e.next=16;break}return e.next=13,this.peerConnection_.setRemoteDescription({type:o,sdp:s});case 13:this.exchangeSDPResolve_&&(this.updateSSRC(s),this.exchangeSDPResolve_()),e.next=17;break;case 16:this.exchangeSDPReject_&&(d="exchange sdp failed",u&&(d+=" ".concat(u)),this.exchangeSDPReject_(new vs({code:c,message:d})));case 17:e.next=23;break;case 19:e.prev=19,e.t0=e.catch(8),this.log_.error("exchange sdp failed: "+e.t0),this.exchangeSDPReject_&&this.exchangeSDPReject_(e.t0);case 23:this.exchangeSDPResolve_=null,this.exchangeSDPReject_=null,this.isSDPExchanging_=!1;case 26:case"end":return e.stop()}}),e,this,[[8,19]])}))),function(e){return t.apply(this,arguments)})},{key:"updateSSRC",value:function(e){var t=this;try{Lm(e).media.forEach((function(e){if("audio"===e.type){var n=e.ssrcs.find((function(e){return e.value.includes(yo)}));n&&(t.ssrc_.audio=n.id)}else{var r=e.ssrcs.find((function(e){return e.value.includes(yo)})),i=e.ssrcs.find((function(e){return e.value.includes(bo)}));r&&(t.ssrc_.video=r.id),i&&(t.ssrc_.auxiliary=i.id)}}))}catch(T_){}}},{key:"sendNextSubscription",value:function(){void 0!==this.pendingSubscription_.shift()&&(this.subscriptionRetryCount_=0,this.isSubscriptionPending_=!1,-1!==this.subscriptionTimeout_&&(clearTimeout(this.subscriptionTimeout_),this.subscriptionTimeout_=-1));var e=this.pendingStreams_.shift();if(e&&(this.log_.debug("mark ".concat(e.getType()," stream exit subscription cycle")),e.setInSubscriptionCycle(!1)),this.pendingSubscription_.length>0){var t=this.pendingSubscription_[0];this.log_.info("schedule a pending subscription"),this.doSendSubscription(t.data,t.stream,t.type)}}},{key:"setRemoteStream",value:function(e,t){this.remoteStreams_.set(e,t)}},{key:"getSubscribeState",value:function(){return this.subscribeState_}},{key:"getTrackState",value:function(){return this.trackState_}},{key:"getSSRC",value:function(){return this.ssrc_}},{key:"getMainStream",value:function(){return this.remoteStreams_.get(yo)}},{key:"getAuxStream",value:function(){return this.remoteStreams_.get(bo)}},{key:"getMainStreamVideoTrackId",value:function(){var e=this.getMainStream();if(e){var t=e.getVideoTrack();if(t)return t.id}return""}},{key:"getAuxStreamVideoTrackId",value:function(){var e=this.getAuxStream();if(e){var t=e.getVideoTrack();if(t)return t.id}return""}},{key:"reconnect",value:function(){var e=this;if(-1===this.reconnectionTimer_){if(this.reconnectionCount_>=30){this.log_.warn("SDK has tried reconnect downlink [".concat(this.userId_,"] for ").concat(30," times, but all failed, please check your network")),this.stopReconnection();var t=new vs({code:_s.DOWNLINK_RECONNECTION_FAILED,message:"downlink reconnect failed, please check your network and re-join room"});return of({eventType:Fo,error:t}),this.addEventInternal(Kp,"downlink-connection reconnect fail"),this.emitConnectionStateChangedEvent(To),void this.emitter_.emit(Uf,t)}if(this.signalChannel_.getCurrentState()!==Gh)return this.log_.warn("reconnect() signal channel is not connected, suspend reconnection until signal is connected"),void this.signalChannel_.once(jh,this.reconnect,this);this.reconnectionCount_++,this.log_.warn("reconnect() try to reconnect downlink [".concat(this.reconnectionCount_,"/").concat(30,"]"));var n=Rs(this.reconnectionCount_);this.reconnectionTimer_=setTimeout((function(){e.log_.warn("reconnect() downlink [".concat(e.userId_,"] reconnect timeout(").concat(n/1e3,"s), try again")),e.clearReconnectionTimer(),e.reconnect()}),n),this.closePeerConnection(),this.sentSubscriptionAfterConnected_=!1,this.initialize(),this.exchangeSDP()}else this.log_.warn("reconnect() downlink is reconnecting, ignore current reconnection")}},{key:"getIsReconnecting",value:function(){return this.isReconnecting_}},{key:"getSubscribedMainStream",value:function(){var e=null;return this.isMainStreamSubscribed&&(e=this.remoteStreams_.get(yo)),e}},{key:"clearReconnectionTimer",value:function(){-1!==this.reconnectionTimer_&&(clearTimeout(this.reconnectionTimer_),this.reconnectionTimer_=-1)}},{key:"stopReconnection",value:function(){this.log_.info("stop downlink reconnection"),this.isReconnecting_=!1,this.reconnectionCount_=0,this.clearReconnectionTimer(),this.signalChannel_.off(jh,this.reconnect,this)}},{key:"getCurrentState",value:function(){return this.currentState_}},{key:"isMainStreamSubscribed",get:function(){return(this.subscribeState_.audio||this.subscribeState_.video)&&(this.trackState_.audio||this.trackState_.video)}},{key:"isAuxStreamSubscribed",get:function(){return this.subscribeState_.auxiliary&&this.trackState_.auxiliary}}]),a}(Tm),Hm=function(e){return function(t,n,r,i){De(n);var a=Oe(t),o=p(a),s=ue(a.length),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in o){i=o[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw TypeError("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in o&&(i=n(i,o[c],c,a));return i}},Gm={left:Hm(!1),right:Hm(!0)}.left,zm=dr("reduce"),Wm=rt("reduce",{1:0});Pe({target:"Array",proto:!0,forced:!zm||!Wm||!ul&&$e>79&&$e<83},{reduce:function(e){return Gm(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}});var Qm=function(){function e(){yt(this,e),this.startTime=0,this.endTime=0,this.start()}return kt(e,[{key:"start",value:function(){0===this.startTime&&(this.startTime=Ds())}},{key:"stop",value:function(){0===this.endTime&&(this.endTime=Ds())}},{key:"getDuration",value:function(){return 0===this.endTime?Ds()-this.startTime:this.endTime-this.startTime}}]),e}(),qm=function(){function e(t){yt(this,e),this.client_=t.client,this.intervalId_=-1,this.statsCalculator_=new am,this.prevStats_=null,this.renderFreezeMap_=new Map,this.remoteStreamMap_=new Map,this.dataFreezeMap_=new Map,this.monitorFreezeData_=new Map}var t,n,r;return kt(e,[{key:"installEvents",value:function(){sm.on(cm.PLAY_VIDEO_START,this.handlePlayVideoStart,this),sm.on(cm.VIDEO_TRACK_MUTED,this.onVideoTrackMuted,this),sm.on(cm.VIDEO_TRACK_UNMUTED,this.onVideoTrackUnmuted,this),sm.on(cm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this),sm.on(cm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),sm.on(cm.VIDEO_PLAYING,this.handleVideoPlaying,this)}},{key:"uninstallEvents",value:function(){sm.off(cm.PLAY_VIDEO_START,this.handlePlayVideoStart,this),sm.off(cm.VIDEO_TRACK_MUTED,this.onVideoTrackMuted,this),sm.off(cm.VIDEO_TRACK_UNMUTED,this.onVideoTrackUnmuted,this),sm.off(cm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this),sm.off(cm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),sm.off(cm.VIDEO_PLAYING,this.handleVideoPlaying,this)}},{key:"start",value:function(){var e=this;-1===this.intervalId_&&(this.installEvents(),this.intervalId_=yd.setInterval(St(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e.detectFPS();case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])}))),1e3))}},{key:"stop",value:function(){-1!==this.intervalId_&&(this.uninstallEvents(),yd.clearInterval(this.intervalId_),this.intervalId_=-1,this.renderFreezeMap_.clear(),this.dataFreezeMap_.clear(),this.remoteStreamMap_.clear())}},{key:"onVideoTrackMuted",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()){var n=t.userId_,r=t.type_,i="".concat(n,"_").concat(r),a=this.dataFreezeMap_.get(i),o=new Qm;a?a.durationItemList.push(o):this.dataFreezeMap_.set(i,{userId:n,type:r,durationItemList:[o],isFreezing:function(){var e=this.durationItemList[this.durationItemList.length-1];return e&&0===e.endTime}})}}},{key:"onVideoTrackUnmuted",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()){var n=t.userId_,r=t.type_,i="".concat(n,"_").concat(r);this.stopDataFreeze({key:i,userId:n,type:r})}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDataFreeze({key:a,userId:r,type:i})}}},{key:"stopDataFreeze",value:function(e){var t=e.key,n=e.userId,r=e.type,i=this.dataFreezeMap_.get(t);if(i&&i.isFreezing()){var a=i.durationItemList[i.durationItemList.length-1];a.stop();var o=a.getDuration();o>500?this.monitorFreezeData_.set(t,{userId:n,type:r,duration:o}):i.durationItemList.pop()}}},{key:"getTotalDuration",value:function(e){return e.reduce((function(e,t){var n=t.getDuration();return e+Math.min(n,5e3)}),0)}},{key:"getStats",value:(r=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=this.client_.getConnections(),n={},r=jt(t),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=20;break}if(a=Lt(i.value,2),o=a[0],(s=a[1]).getPeerConnection()){e.next=9;break}return e.abrupt("continue",18);case 9:return c=s.getSubscribeState(),u=s.getTrackState(),e.next=13,this.statsCalculator_.getReceiverStats(s);case 13:d=e.sent,(l={userId:d.userId,tinyId:o,hasVideo:u.video&&c.video,hasAuxiliary:u.auxiliary&&c.auxiliary,video:{framesDecoded:0},auxiliary:{framesDecoded:0}}).hasVideo&&(l.video.framesDecoded=d.video.framesDecoded),l.hasAuxiliary&&(l.auxiliary.framesDecoded=d.auxiliary.framesDecoded),n[d.userId]=l;case 18:e.next=5;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(3),r.e(e.t0);case 25:return e.prev=25,r.f(),e.finish(25);case 28:return e.abrupt("return",n);case 29:case"end":return e.stop()}}),e,this,[[3,22,25,28]])}))),function(){return r.apply(this,arguments)})},{key:"detectFPS",value:(n=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getStats();case 2:if(t=e.sent,this.prevStats_){e.next=6;break}return this.prevStats_=t,e.abrupt("return");case 6:e.t0=regeneratorRuntime.keys(t);case 7:if((e.t1=e.t0()).done){e.next=17;break}if(n=e.t1.value,this.prevStats_[n]){e.next=11;break}return e.abrupt("continue",7);case 11:r=t[n].tinyId,i=this.client_.getMutedStates(),t[n].hasVideo&&this.prevStats_[n].hasVideo&&i.has(r)&&!i.get(r).videoMuted&&(a=t[n].video.framesDecoded-this.prevStats_[n].video.framesDecoded,this.handleRenderFreeze({userId:n,type:"main",fps:a})),t[n].hasAuxiliary&&this.prevStats_[n].hasAuxiliary&&(o=t[n].auxiliary.framesDecoded-this.prevStats_[n].auxiliary.framesDecoded,this.handleRenderFreeze({userId:n,type:"auxiliary",fps:o})),e.next=7;break;case 17:this.prevStats_=t;case 18:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"handleRenderFreeze",value:(t=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.userId,r=t.fps,i=t.type,a="".concat(n,"_").concat(i),o=this.renderFreezeMap_.get(a),r<=2?(s=Ds(),o&&!o.isFreeze&&(o.freezeTimeline.push({startTime:s,endTime:void 0}),o.isFreeze=!0),o||this.renderFreezeMap_.set(a,{userId:n,type:i,isFreeze:!0,freezeTimeline:[{startTime:s,endTime:void 0}],renderFreezeTotal:0})):o&&o.isFreeze&&(o.isFreeze=!1,(c=o.freezeTimeline.pop()).endTime=Ds(),u=c.endTime-c.startTime,o.freezeTimeline.push(c),o.renderFreezeTotal+=Math.min(5e3,u));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"handlePlayVideoStart",value:function(e){var t=e.stream;if(t.getClient()===this.client_&&t.isRemote()&&t.hasVideo()){var n="".concat(t.getUserId(),"_").concat(t.getType());if(this.remoteStreamMap_.has(n))this.remoteStreamMap_.get(n).remoteStream=t;else this.remoteStreamMap_.set(n,{isPlayingFired:!1,remoteStream:t})}}},{key:"handleVideoPlaying",value:function(e){var t=e.stream;if(t.isRemote()&&t.getClient()===this.client_){var n="".concat(t.getUserId(),"_").concat(t.getType());if(this.remoteStreamMap_.has(n))this.remoteStreamMap_.get(n).isPlayingFired=!0}}},{key:"getDataFreezeDuration",value:function(e){var t={dataFreeze:0,count:0},n=this.dataFreezeMap_.get(e);if(n){if(n.isFreezing()){var r=n.durationItemList[n.durationItemList.length-1];r.stop(),r.getDuration()<500&&n.durationItemList.pop()}t.dataFreeze=this.getTotalDuration(n.durationItemList),t.count=n.durationItemList.length}return t}},{key:"getRenderFreezeDuration",value:function(e){var t=this.renderFreezeMap_.get(e),n=0,r=0;if(t)if(t.isFreeze){var i=Ds()-t.freezeTimeline[t.freezeTimeline.length-1].startTime;n=t.renderFreezeTotal+Math.min(i,5e3),r=t.freezeTimeline.length}else n=t.renderFreezeTotal;return{renderFreeze:n,count:r}}},{key:"getMonitorFreeze",value:function(){return this.monitorFreezeData_}},{key:"isBlackStream",value:function(e){return!!this.remoteStreamMap_.has(e)&&!this.remoteStreamMap_.get(e).isPlayingFired}},{key:"resetMonitor",value:function(){this.monitorFreezeData_.clear()}}]),e}(),Km=function e(t){yt(this,e),this.userId=t.userId,this.tinyId=t.tinyId,this.role=t.role===go?"anchor":"audience"};function Ym(e){var t=e.retryFunction,n=e.settings,r=e.onError,i=e.onRetrying,a=e.context;return function(){for(var e=this,o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];var u=n.retries||5,d=0,l=-1,h=0,p=function(){var o=St(regeneratorRuntime.mark((function o(c,f){var m,_,v,g;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.prev=0,m=a||e,o.next=4,t.apply(m,s);case 4:_=o.sent,d=0,c(_),o.next=14;break;case 9:o.prev=9,o.t0=o.catch(0),v=function(){clearTimeout(l),d=0,h=2,f(o.t0)},g=function(){2!==h&&d<u?(d++,h=1,Es(i)&&i(d,v),l=setTimeout((function(){l=-1,p(c,f)}),n.timeout||1e3)):v()},r(o.t0,g,f);case 14:case"end":return o.stop()}}),o,null,[[0,9]])})));return function(e,t){return o.apply(this,arguments)}}();return new Promise(p)}}Pe({target:"Date",stat:!0},{now:function(){return(new Date).getTime()}});var $m=t((function(t){!function(e){function n(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function r(e,t,r,i,a,o){return n((s=n(n(t,e),n(i,o)))<<(c=a)|s>>>32-c,r);var s,c}function i(e,t,n,i,a,o,s){return r(t&n|~t&i,e,t,a,o,s)}function a(e,t,n,i,a,o,s){return r(t&i|n&~i,e,t,a,o,s)}function o(e,t,n,i,a,o,s){return r(t^n^i,e,t,a,o,s)}function s(e,t,n,i,a,o,s){return r(n^(t|~i),e,t,a,o,s)}function c(e,t){var r,c,u,d,l;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,p=-271733879,f=-1732584194,m=271733878;for(r=0;r<e.length;r+=16)c=h,u=p,d=f,l=m,h=i(h,p,f,m,e[r],7,-680876936),m=i(m,h,p,f,e[r+1],12,-389564586),f=i(f,m,h,p,e[r+2],17,606105819),p=i(p,f,m,h,e[r+3],22,-1044525330),h=i(h,p,f,m,e[r+4],7,-176418897),m=i(m,h,p,f,e[r+5],12,1200080426),f=i(f,m,h,p,e[r+6],17,-1473231341),p=i(p,f,m,h,e[r+7],22,-45705983),h=i(h,p,f,m,e[r+8],7,1770035416),m=i(m,h,p,f,e[r+9],12,-1958414417),f=i(f,m,h,p,e[r+10],17,-42063),p=i(p,f,m,h,e[r+11],22,-1990404162),h=i(h,p,f,m,e[r+12],7,1804603682),m=i(m,h,p,f,e[r+13],12,-40341101),f=i(f,m,h,p,e[r+14],17,-1502002290),h=a(h,p=i(p,f,m,h,e[r+15],22,1236535329),f,m,e[r+1],5,-165796510),m=a(m,h,p,f,e[r+6],9,-1069501632),f=a(f,m,h,p,e[r+11],14,643717713),p=a(p,f,m,h,e[r],20,-373897302),h=a(h,p,f,m,e[r+5],5,-701558691),m=a(m,h,p,f,e[r+10],9,38016083),f=a(f,m,h,p,e[r+15],14,-660478335),p=a(p,f,m,h,e[r+4],20,-405537848),h=a(h,p,f,m,e[r+9],5,568446438),m=a(m,h,p,f,e[r+14],9,-1019803690),f=a(f,m,h,p,e[r+3],14,-187363961),p=a(p,f,m,h,e[r+8],20,1163531501),h=a(h,p,f,m,e[r+13],5,-1444681467),m=a(m,h,p,f,e[r+2],9,-51403784),f=a(f,m,h,p,e[r+7],14,1735328473),h=o(h,p=a(p,f,m,h,e[r+12],20,-1926607734),f,m,e[r+5],4,-378558),m=o(m,h,p,f,e[r+8],11,-2022574463),f=o(f,m,h,p,e[r+11],16,1839030562),p=o(p,f,m,h,e[r+14],23,-35309556),h=o(h,p,f,m,e[r+1],4,-1530992060),m=o(m,h,p,f,e[r+4],11,1272893353),f=o(f,m,h,p,e[r+7],16,-155497632),p=o(p,f,m,h,e[r+10],23,-1094730640),h=o(h,p,f,m,e[r+13],4,681279174),m=o(m,h,p,f,e[r],11,-358537222),f=o(f,m,h,p,e[r+3],16,-722521979),p=o(p,f,m,h,e[r+6],23,76029189),h=o(h,p,f,m,e[r+9],4,-640364487),m=o(m,h,p,f,e[r+12],11,-421815835),f=o(f,m,h,p,e[r+15],16,530742520),h=s(h,p=o(p,f,m,h,e[r+2],23,-995338651),f,m,e[r],6,-198630844),m=s(m,h,p,f,e[r+7],10,1126891415),f=s(f,m,h,p,e[r+14],15,-1416354905),p=s(p,f,m,h,e[r+5],21,-57434055),h=s(h,p,f,m,e[r+12],6,1700485571),m=s(m,h,p,f,e[r+3],10,-1894986606),f=s(f,m,h,p,e[r+10],15,-1051523),p=s(p,f,m,h,e[r+1],21,-2054922799),h=s(h,p,f,m,e[r+8],6,1873313359),m=s(m,h,p,f,e[r+15],10,-30611744),f=s(f,m,h,p,e[r+6],15,-1560198380),p=s(p,f,m,h,e[r+13],21,1309151649),h=s(h,p,f,m,e[r+4],6,-145523070),m=s(m,h,p,f,e[r+11],10,-1120210379),f=s(f,m,h,p,e[r+2],15,718787259),p=s(p,f,m,h,e[r+9],21,-343485551),h=n(h,c),p=n(p,u),f=n(f,d),m=n(m,l);return[h,p,f,m]}function u(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function d(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function l(e){var t,n,r="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),r+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return r}function h(e){return unescape(encodeURIComponent(e))}function p(e){return function(e){return u(c(d(e),8*e.length))}(h(e))}function f(e,t){return function(e,t){var n,r,i=d(e),a=[],o=[];for(a[15]=o[15]=void 0,i.length>16&&(i=c(i,8*e.length)),n=0;n<16;n+=1)a[n]=909522486^i[n],o[n]=1549556828^i[n];return r=c(a.concat(d(t)),512+8*t.length),u(c(o.concat(r),640))}(h(e),h(t))}function m(e,t,n){return t?n?f(t,e):l(f(t,e)):n?p(e):l(p(e))}t.exports?t.exports=m:e.md5=m}(e)})),Xm=function(){function e(t){yt(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.isMixing_=!1,this.config_=null,this.data_=null,this.remoteStreamMap_=new Map,this.installEvents()}var t,n;return kt(e,[{key:"installEvents",value:function(){sm.on(cm.REMOTE_STREAM_SUBSCRIBED,this.onStreamSubscribed,this),sm.on(cm.REMOTE_STREAM_UNSUBSCRIBED,this.onStreamUnsubscribed,this),this.client_.on("stream-removed",this.onStreamRemoved,this)}},{key:"uninstallEvents",value:function(){sm.off(cm.REMOTE_STREAM_SUBSCRIBED,this.onStreamSubscribed,this),sm.off(cm.REMOTE_STREAM_UNSUBSCRIBED,this.onStreamUnsubscribed,this),this.client_.off("stream-removed",this.onStreamRemoved,this)}},{key:"stop",value:function(){this.uninstallEvents()}},{key:"onStreamSubscribed",value:function(e){var t=e.client,n=e.stream;t===this.client_&&(this.remoteStreamMap_.set(n.getId(),{remoteStream:n,isUsed:!1}),this.isMixing_&&this.hasAvailablePlaceHolder()&&this.startMixTranscode(this.config_))}},{key:"onStreamUnsubscribed",value:function(e){var t=e.client,n=e.stream;t===this.client_&&this.onStreamRemoved({stream:n})}},{key:"onStreamRemoved",value:function(e){var t=e.stream;if(this.remoteStreamMap_.has(t.getId())){var n=this.remoteStreamMap_.get(t.getId()).isUsed;this.remoteStreamMap_.delete(t.getId()),this.isMixing_&&this.isPresetLayoutMode&&n&&this.startMixTranscode(this.config_)}}},{key:"startMixTranscode",value:(n=St(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.resetIsUsedFlag(),this.validateMixTranscodeParamsType(t),this.config_=t,n=this.getInputParam(t,this.remoteStreamMap_),r=this.getOutputParam(t),i=this.getOutputSessionId({config:t,roomId:this.client_.getRoomId(),userId:this.client_.getUserId()}),this.validateMixTranscodeParamsValue(n,r),!this.isMixing_||!this.data_||i===this.data_.outputSessionId){e.next=12;break}return Os.info("startMixTranscode() streamId changed, stop mixing before start"),e.next=12,this.doStopMixTranscode();case 12:return e.next=14,this.doStartMixTranscode({outputSessionId:i,inputParam:n,outputParam:r});case 14:e.next=20;break;case 16:throw e.prev=16,e.t0=e.catch(0),this.resetIsUsedFlag(),e.t0;case 20:case"end":return e.stop()}}),e,this,[[0,16]])}))),function(e){return n.apply(this,arguments)})},{key:"doStartMixTranscode",value:function(e){var t=this,n=e.outputSessionId,r=e.inputParam,i=e.outputParam;return new Promise((function(e,a){var o={roomid:String(t.client_.getRoomId()),sdkAppID:String(t.client_.getSDKAppId()),socketid:t.signalChannel_.getSocketId(),mcuRequestTime:Date.now(),outputSessionId:n,inputParam:r,outputParam:i};t.data_=o,Os.info("startMixTranscode: ".concat(JSON.stringify(o))),t.signalChannel_.send(lp,o),t.isMixing_=!0;var s=setTimeout((function(){Os.error("startMixTranscode timeout observed"),t.isMixing_=!1,t.signalChannel_.off(Qh.START_MIX_TRANSCODE_RES,c),a(new vs({code:_s.START_MIX_TRANSCODE_FAILED,message:"startMixTranscode timeout"}))}),5e3),c=function(n){clearTimeout(s),n.data.content.errCode?(Os.error("startMixTranscode failed, errCode: ".concat(n.data.content.errCode," errMsg: ").concat(n.data.content.errMsg)),t.isMixing_=!1,a(new vs({code:_s.START_MIX_TRANSCODE_FAILED,message:"startMixTranscode failed, errMsg: ".concat(n.data.content.errMsg)}))):e()};t.signalChannel_.once(Qh.START_MIX_TRANSCODE_RES,c)}))}},{key:"stopMixTranscode",value:(t=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isMixing_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"mixTranscode hasn't been started"});case 2:return e.next=4,this.doStopMixTranscode();case 4:this.resetIsUsedFlag();case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"doStopMixTranscode",value:function(){var e=this;return new Promise((function(t,n){var r={roomid:String(e.client_.getRoomId()),sdkAppID:String(e.client_.getSDKAppId()),socketid:e.signalChannel_.getSocketId(),userid:e.client_.getUserId(),mcuRequestTime:Date.now(),outPutSessionId:e.data_.outputSessionId,streamType:e.data_.outputParam.streamType};Os.info("stopMixTranscode: ".concat(JSON.stringify(r))),e.signalChannel_.send(hp,r);var i=setTimeout((function(){Os.error("stopMixTranscode timeout observed"),e.signalChannel_.off(Qh.STOP_MIX_TRANSCODE_RES,a),n(new vs({code:_s.STOP_MIX_TRANSCODE_FAILED,message:"stopMixTranscode timeout"}))}),5e3),a=function(r){clearTimeout(i),r.data.content.errCode?(Os.error("stopMixTranscode failed, errCode: ".concat(r.data.content.errCode," errMsg: ").concat(r.data.content.errMsg)),n(new vs({code:_s.STOP_MIX_TRANSCODE_FAILED,message:"stopMixTranscode failed, errMsg: ".concat(r.data.content.errMsg)}))):(e.isMixing_=!1,t())};e.signalChannel_.once(Qh.STOP_MIX_TRANSCODE_RES,a)}))}},{key:"validateMixTranscodeParamsType",value:function(e){if("object"!==As(e))throw new vs({code:_s.INVALID_PARAMETER,message:"param should be object when start mix transcoding"});var t=xs(e,{streamId:rs,videoWidth:is,videoHeight:is,videoBitrate:is,videoFramerate:is,videoGOP:is,audioSampleRate:is,audioBitrate:is,audioChannels:is,backgroundColor:is,backgroundImage:rs,mixUsers:os});if(!t.ret)throw new vs({code:_s.INVALID_PARAMETER,message:t.message});var n={userId:rs,pureAudio:as,width:is,height:is,locationX:is,locationY:is,zOrder:is};e.mixUsers.forEach((function(e){var t=xs(e,n);if(!t.ret)throw new vs({code:_s.INVALID_PARAMETER,message:"mixUser.".concat(t.message)})}))}},{key:"getOutputSessionId",value:function(e){var t=e.config,n=e.userId,r=e.roomId;return Is(t.streamId)&&t.streamId.length>0?t.streamId:$m("".concat(r,"_").concat(n,"_main"))}},{key:"getInputParam",value:function(e,t){var n=e.mixUsers.map((function(e){return{userid:e.userId,width:e.width||0,height:e.height||0,locationX:e.locationX||0,locationY:e.locationY||0,zOrder:e.zOrder,streamType:Cs(e.streamType)||"auxiliary"!==e.streamType?0:1,inputType:e.pureAudio?ns.IT_PURE_AUDIO:ns.IT_AUDIO_VIDEO}}));return e.mode===es.PRESET_LAYOUT&&(n.forEach((function(e){if(e.userid===ts.REMOTE){var n=Nt(t.values()).find((function(e){return!e.isUsed}));n&&(e.userid=n.remoteStream.getUserId(),e.streamType="auxiliary"===n.remoteStream.getType()?1:0,n.isUsed=!0)}})),n=n.filter((function(e){return e.userid!==ts.REMOTE}))),n}},{key:"getOutputParam",value:function(e){var t=e.streamId||"";return{streamId:t,streamType:t.length>0?1:0,videoWidth:Cs(e.videoWidth)?640:e.videoWidth,videoHeight:Cs(e.videoHeight)?480:e.videoHeight,videoBitrate:e.videoBitrate||0,videoFramerate:e.videoFramerate||15,videoGOP:e.videoGOP||2,audioSampleRate:e.audioSampleRate||48e3,audioBitrate:e.audioBitrate||64,audioChannels:e.audioChannels||1,backgroundColor:e.backgroundColor||0,backgroundImage:e.backgroundImage||"",extraInfo:"",VCodec:2,ACodec:0}}},{key:"validateMixTranscodeParamsValue",value:function(e,t){var n=0,r=0;if(e.forEach((function(e){if(Cs(e.userid))throw new vs({code:_s.INVALID_PARAMETER,message:"mixUser.userId is required"});if(e.inputType!==ns.IT_PURE_AUDIO){if(e.width<0||e.height<0)throw new vs({code:_s.INVALID_PARAMETER,message:"mixUser.width and mixUser.height can't be less than 0"});if(e.locationX<0||e.locationY<0)throw new vs({code:_s.INVALID_PARAMETER,message:"mixUser.locationX and mixUser.locationY can't be less than 0"});if(!e.zOrder||e.zOrder<1||e>15)throw new vs({code:_s.INVALID_PARAMETER,message:"mixUser.zOrder should between 1 and 15"});e.width+e.locationX>n&&(n=e.width+e.locationX),e.height+e.locationY>r&&(r=e.height+e.locationY)}})),t.videoWidth<0||t.videoWidth<0)throw new vs({code:_s.INVALID_PARAMETER,message:"videoWidth and videoHeight of output stream can't be less than 0"});if(t.videoWidth<n||t.videoHeight<r)throw new vs({code:_s.INVALID_PARAMETER,message:"videoWidth and videoHeight of output stream should be contain all mix stream"})}},{key:"hasAvailablePlaceHolder",value:function(){return!!this.isPresetLayoutMode&&this.data_.inputParam.length!==this.config_.mixUsers.length}},{key:"resetIsUsedFlag",value:function(){this.remoteStreamMap_.forEach((function(e){return e.isUsed=!1}))}},{key:"isPresetLayoutMode",get:function(){return this.config_&&this.config_.mode===es.PRESET_LAYOUT}}]),e}(),Zm=function(){function e(t){yt(this,e),this.client_=t.client,this.signalChannel_=t.signalChannel,this.isPublishingTencentCDN_=!1,this.publishGivenCDNData_=null,this.isPublishingGivenCDN_=!1}return kt(e,[{key:"getIsPublishingTencentCDN",value:function(){return this.isPublishingTencentCDN_}},{key:"getIsPublishingGivenCDN",value:function(){return this.isPublishingGivenCDN_}},{key:"startPublishTencentCDN",value:function(e){var t=this;e=e||"".concat(this.client_.getSDKAppId(),"_").concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main");var n={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),requestTime:Date.now(),sessionId:$m("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main")),streamId:e,streamType:0};return Os.info("startPublishTencentCDN: "+JSON.stringify(n)),new Promise((function(e,r){t.isPublishingTencentCDN_=!0;var i=setTimeout((function(){Os.error("startPublishTencentCDN timeout observed"),t.isPublishingTencentCDN_=!1,t.signalChannel_.off(Qh.START_PUBLISH_TENCENT_CDN_RES,a),r(new Error("startPublishTencentCDN timeout"))}),5e3),a=function(n){clearTimeout(i);var a=n.data.content,o=a.errCode,s=a.errMsg;0===o?e():(t.isPublishingTencentCDN_=!1,-102083===o&&(s="Please enable relayed-push in https://console.cloud.tencent.com/trtc/ and try later, refer to https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-26-advanced-publish-cdn-stream.html"),Os.error("startPublishTencentCDN failed, errCode: ".concat(o,", errMsg: ").concat(s)),r(new Error(s)))};t.signalChannel_.once(Qh.START_PUBLISH_TENCENT_CDN_RES,a),t.signalChannel_.send(sp,n)}))}},{key:"stopPublishTencentCDN",value:function(){var e=this,t={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),requestTime:Date.now(),sessionId:$m("".concat(this.client_.getRoomId(),"_").concat(this.client_.getUserId(),"_main"))};return Os.info("stopPublishTencentCDN: "+JSON.stringify(t)),new Promise((function(n,r){var i=setTimeout((function(){Os.error("stopPublishTencentCDN timeout observed"),e.signalChannel_.off(Qh.STOP_PUBLISH_TENCENT_CDN_RES,a),r(new Error("stopPublishTencentCDN timeout"))}),5e3),a=function(t){clearTimeout(i);var a=t.data.content,o=a.errCode,s=a.errMsg;0===o?(e.isPublishingTencentCDN_=!1,n()):-102069===o?(Os.warn("stopPublishTencentCDN failed, can not stopPublishTencentCDN in auto relayed-push mode"),e.isPublishingTencentCDN_=!1,n()):(Os.error("stopPublishTencentCDN failed, errCode: ".concat(o," errMsg: ").concat(s)),r(new Error(s)))};e.signalChannel_.once(Qh.STOP_PUBLISH_TENCENT_CDN_RES,a),e.signalChannel_.send(cp,t)}))}},{key:"startPublishGivenCDN",value:function(e){var t=this,n={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),socketid:this.signalChannel_.getSocketId(),pushRequestTime:Date.now(),pushAppid:e.appId,pushBizId:e.bizId,pushCdnUrl:e.url,pushStreamType:"main"};return Os.info("startPublishGivenCDN: "+JSON.stringify(n)),this.publishGivenCDNData_=n,new Promise((function(e,r){t.isPublishingGivenCDN_=!0;var i=setTimeout((function(){Os.error("startPublishGivenCDN timeout observed"),t.isPublishingGivenCDN_=!1,t.signalChannel_.off(Qh.START_PUBLISH_GIVEN_CDN_RES,a),r(new Error("startPublishGivenCDN timeout"))}),5e3),a=function(n){clearTimeout(i);var a=n.data.content,o=a.errCode,s=a.errMsg;0===o?e():(Os.error("startPublishGivenCDN failed, errCode: ".concat(o,", errMsg: ").concat(s)),t.isPublishingGivenCDN_=!1,r(new Error(s)))};t.signalChannel_.once(Qh.START_PUBLISH_GIVEN_CDN_RES,a),t.signalChannel_.send(up,n)}))}},{key:"stopPublishGivenCDN",value:function(){var e=this,t=this.publishGivenCDNData_,n=t.pushAppid,r=t.pushBizId,i=t.pushCdnUrl,a=t.pushStreamType,o={roomid:String(this.client_.getRoomId()),sdkAppID:String(this.client_.getSDKAppId()),socketid:this.signalChannel_.getSocketId(),pushRequestTime:Date.now(),pushAppid:n,pushBizId:r,pushCdnUrl:i,pushStreamType:a};return Os.info("stopPublishGivenCDN: "+JSON.stringify(o)),new Promise((function(t,n){var r=setTimeout((function(){Os.error("stopPublishGivenCDN timeout observed"),e.signalChannel_.off(Qh.STOP_PUBLISH_GIVEN_CDN_RES,i),n(new Error("stopPublishGivenCDN timeout"))}),5e3),i=function(i){clearTimeout(r);var a=i.data.content,o=a.errCode,s=a.errMsg;0===o?(e.isPublishingGivenCDN_=!1,t()):(Os.error("stopPublishGivenCDN failed, errCode: ".concat(o," errMsg: ").concat(s)),n(new Error(s)))};e.signalChannel_.once(Qh.STOP_PUBLISH_GIVEN_CDN_RES,i),e.signalChannel_.send(dp,o)}))}}]),e}(),e_=function(){function e(t){yt(this,e),this.client_=t.client,this.durationMap_=new Map,this.installEvents()}return kt(e,[{key:"installEvents",value:function(){sm.on(cm.REMOTE_STREAM_SUBSCRIBED,this.handleSubscribed,this),sm.on(cm.REMOTE_STREAM_TRACK_UPDATED,this.handleStreamTrackUpdated,this),sm.on(cm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),sm.on(cm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this)}},{key:"uninstallEvents",value:function(){sm.off(cm.REMOTE_STREAM_SUBSCRIBED,this.handleSubscribed,this),sm.off(cm.REMOTE_STREAM_UPDATED,this.handleStreamTrackUpdated,this),sm.off(cm.REMOTE_STREAM_UNSUBSCRIBED,this.handleStreamStopped,this),sm.off(cm.REMOTE_STREAM_REMOVED,this.handleStreamStopped,this)}},{key:"handleSubscribed",value:function(e){var t=e.client,n=e.stream;if(t===this.client_){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);if(n.hasAudio())if(n.isMainAudioSubscribed){var o=new Qm,s=this.durationMap_.get(a);s?this.isRecording(s.audio)||s.audio.push(o):this.durationMap_.set(a,{userId:r,type:i,audio:[o],video:[]})}else this.stopDurationItem(a,"audio");if(n.hasVideo())if("main"===i&&n.isMainVideoSubscribed||"auxiliary"===i&&n.isAuxVideoSubscribed){var c=new Qm,u=this.durationMap_.get(a);u?this.isRecording(u.video)||u.video.push(c):this.durationMap_.set(a,{userId:r,type:i,audio:[],video:[c]})}else this.stopDurationItem(a,"video")}}},{key:"handleStreamStopped",value:function(e){var t=e.client,n=e.stream;if(this.clientHitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i);this.stopDurationItem(a,"audio"),this.stopDurationItem(a,"video")}}},{key:"handleStreamTrackUpdated",value:function(e){var t=e.client,n=e.userId,r=e.tinyId,i=e.kind,a=e.action;if(this.clientHitTest(t)&&this.client_.getConnections().has(r)){var o=i===us?i:"main",s="".concat(n,"_").concat(o);if(a===ds){var c=this.client_.getConnections().get(r).getSubscribeState();if(i===ss&&!c.audio||i===cs&&!c.video||i===us&&!c.auxiliary)return;var u=new Qm,d=this.durationMap_.get(s);d?(i!==ss||this.isRecording(d.audio)||d.audio.push(u),i===ss||this.isRecording(d.video)||d.video.push(u)):this.durationMap_.set(s,{userId:n,type:o,audio:i===ss?[u]:[],video:i===ss?[]:[u]})}else this.stopDurationItem(s,i===ss?"audio":"video")}}},{key:"isRecording",value:function(e){return e.findIndex((function(e){return 0===e.endTime}))>=0}},{key:"stopDurationItem",value:function(e,t){if(this.durationMap_.has(e)){var n=this.durationMap_.get(e)[t].find((function(e){return 0===e.endTime}));n&&n.stop()}}},{key:"clientHitTest",value:function(e){return this.client_===e}},{key:"getDuration",value:function(e,t){return this.durationMap_.has(e)?this.durationMap_.get(e)[t].reduce((function(e,t){return e+t.getDuration()}),0):0}},{key:"getDurationMap",value:function(){return this.durationMap_}},{key:"reset",value:function(){this.durationMap_.clear()}}]),e}(),t_=Se.f,n_={}.toString,r_="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],i_=function(e){return r_&&"[object Window]"==n_.call(e)?function(e){try{return t_(e)}catch(T_){return r_.slice()}}(e):t_(m(e))},a_=i((function(){return!Object.getOwnPropertyNames(1)}));Pe({target:"Object",stat:!0,forced:a_},{getOwnPropertyNames:i_});var o_=new(function(){function e(){yt(this,e),this.prefix_="TRTC",this.queue_=new Map,this.intervalId_=yd.setInterval(this.doFlush.bind(this),2e4),this.checkStorage()}return kt(e,[{key:"getRealKey",value:function(e){return"".concat(this.prefix_,"_").concat(e)}},{key:"checkStorage",value:function(){var e=this;Object.keys(localStorage).filter((function(t){if(t.startsWith(e.prefix_)){var n=JSON.parse(localStorage.getItem(t));if(n&&n.expiresIn<Date.now())return!0}return!1})).forEach((function(e){return localStorage.removeItem(e)}))}},{key:"doFlush",value:function(){if(window.localStorage)try{var e,t=jt(this.queue_);try{for(t.s();!(e=t.n()).done;){var n=Lt(e.value,2),r=n[0],i=n[1];localStorage.setItem(r,JSON.stringify(i))}}catch(a){t.e(a)}finally{t.f()}}catch(T_){Os.warn(T_)}}},{key:"getItem",value:function(e){if(!window.localStorage)return null;try{var t=JSON.parse(localStorage.getItem(this.getRealKey(e)));return t&&t.expiresIn>=Date.now()?t.value:null}catch(T_){Os.warn(T_)}}},{key:"setItem",value:function(e,t){if(window.localStorage)try{var n={expiresIn:Date.now()+6048e5,value:t};this.queue_.set(this.getRealKey(e),n)}catch(T_){Os.warn(T_)}}},{key:"deleteItem",value:function(e){if(!window.localStorage)return!1;try{return e=this.getRealKey(e),this.queue_.delete(e),localStorage.removeItem(e),!0}catch(T_){return Os.warn(T_),!1}}},{key:"clear",value:function(){if(window.localStorage)try{localStorage.clear()}catch(T_){Os.warn(T_)}}}]),e}()),s_={unknown:0,wifi:1,"4g":2,"3g":3,"2g":4,wired:5},c_={msg_user_info:0,uint32_video_avg_fps:0,uint32_video_width:0,uint32_video_height:0,uint32_video_avg_bitrate:0,uint32_video_block_time:0,uint32_video_play_time:0,uint32_audio_block_time:0,uint32_audio_play_time:0,uint32_audio_play_db:0,uint32_avg_down_loss:0,uint32_stream_type:0,uint32_video_render_first:0,uint32_video_block_count:0,uint32_audio_block_count:0,uint32_audio_bitrate:0,uint32_video_black_screen_subjective:0,uint32_audio_recv_bitrate:0,uint32_video_external_block_time:0},u_=function e(t){yt(this,e),this.str_identifier=String(t.userId),this.uint64_tinyid=Number(t.tinyId),this.uint32_role=t.role},d_=function(){function e(t){var n=this;yt(this,e),this.frameWorkType_=t.frameWorkType||30,this.client_=t.client,this.keyPrefix_="key_point",this.storageKey_="".concat(this.keyPrefix_,"_").concat(this.client_.getUserId()),this.log_=new om({id:"kpm|"+this.client_.getUserId(),direction:"local",type:""}),this.upload=Ym({retryFunction:this.upload,settings:{timeout:500,retries:3},onError:function(e,t){return t()}}),Object.getOwnPropertyNames(this.__proto__).forEach((function(e){e.startsWith("handle")&&Es(n[e])&&(n[e]=function(e){var t=e.fn,n=e.context;return St(regeneratorRuntime.mark((function e(){var r,i,a,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(e.prev=0,r=o.length,i=new Array(r),a=0;a<r;a++)i[a]=o[a];return e.next=4,t.apply(n||this,i);case 4:return e.abrupt("return",e.sent);case 7:e.prev=7,e.t0=e.catch(0),Os.error("".concat(t.name,"() error observed ")+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])})))}({fn:n[e],context:n}))})),this.initData(),this.installEvents(),this.intervalId_=yd.setInterval(this.setStorage.bind(this),2e4)}var t,n,r;return kt(e,[{key:"initData",value:function(){this.firstPublishedUserList_=[],this.networkQuality_={totalUplinkRTT:0,totalUplinkLoss:0,count:0,totalDownlinkRTTAndLossMap:new Map},this.basicInfo={string_sdk_version:"4.11.1",uint32_os_type:15,string_device_name:"",string_http_user_agent:navigator.userAgent,string_os_version:"",uint32_avg_rtt:0,uint32_avg_up_loss:0,uint32_scene:"live"===this.client_.getMode()?1:0,uint32_joining_duration:0,uint32_networkType:s_[ks()],uint32_framework:this.frameWorkType_},this.pathJoinRoom_={uint64_start_time:0,uint64_init_audio_start_time:0,uint64_init_audio_end_time:0,uint64_init_camera_start_time:0,uint64_init_camera_end_time:0,uint64_send_request_enter_room_cmd_start_time:0,uint64_send_request_enter_room_cmd_end_time:0,uint64_send_first_video_frame_time:0,uint64_recv_userlist_time:0,uint64_end_time:0,int32_init_audio_ret:0,int32_init_camera_ret:0,int32_send_request_enter_room_cmd_ret:0,int32_end_ret:0},this.pathLeaveRoom_={uint64_start_time:0,uint64_send_request_exit_room_cmd_start_time:0,uint64_send_request_exit_room_cmd_end_time:0,uint64_end_time:0,int32_send_request_exit_room_cmd_ret:0,int32_end_ret:0},this.pathMainVideoMap_=new Map,this.pathMainAudioMap_=new Map,this.pathAuxiliaryMap_=new Map,this.localStreamStats_={totalVideoBitrate:0,totalVideoFPS:0,totalVideoHeight:0,totalVideoWidth:0,totalAudioLevel:0,videoCount:0,audioLevelCount:0,publishStartTime:0,statsToReport:{uint32_audio_capture_db:0,uint32_video_big_capture_fps:0,uint32_video_big_bitrate:0,uint32_video_big_resolution:0}},this.remoteStreamStatsMap_=new Map}},{key:"installEvents",value:function(){sm.on(cm.JOIN_START,this.handleJoinStart,this),sm.on(cm.JOIN_SEND_CMD,this.handleJoinSendCMD,this),sm.on(cm.JOIN_RECEIVED_CMD_RES,this.handleJoinReceivedCMDResponce,this),sm.on(cm.JOIN_SUCCESS,this.handleJoinSuccess,this),sm.on(cm.JOIN_FAILED,this.handleJoinFailed,this),sm.on(cm.RECEIVED_PUBLISHED_USER_LIST,this.handleReceivedPublishUserList,this),sm.on(cm.CONNECTION_STATE_CHANGED,this.handleConnectionStateChanged,this),sm.on(cm.LEAVE_START,this.handleLeaveStart,this),sm.on(cm.LEAVE_SUCCESS,this.handleLeaveSuccess,this),sm.on(cm.LEAVE_SEND_CMD,this.handleLeaveSendCMD,this),sm.on(cm.CONNECTION_SEND_SUBSCRIBE_CMD,this.handleSendSubscribeCMD,this),sm.on(cm.VIDEO_PLAYING,this.handleVideoPlaying,this),sm.on(cm.AUDIO_PLAYING,this.handleAudioPlaying,this),sm.on(cm.NETWORK_QUALITY,this.handleNetworkQuality,this),sm.on(cm.HEARTBEAT_STATS,this.handleHeartbeatStats,this),sm.on(cm.REMOTE_STREAM_ADDED,this.handleRemoteStreamAdded,this),sm.on(cm.REMOTE_STREAM_SUBSCRIBE_START,this.handleRemoteStreamSubscribeStart,this),sm.on(cm.REMOTE_STREAM_SUBSCRIBED,this.handleRemoteStreamSubscribed,this),sm.on(cm.VIDEO_LOADED_DATA,this.handleVideoLoadedData,this),sm.on(cm.PLAY_STREAM_START,this.handlePlayStream,this),sm.on(cm.PUBLISH_START,this.handlePublishStart,this),sm.on(cm.LOCAL_STREAM_INITIALIZE_START,this.handleLocalStreamInitStart,this),sm.on(cm.LOCAL_STREAM_INITIALIZE_END,this.handleLocalStreamInitEnd,this),sm.on(cm.LOCAL_STREAM_INITIALIZE_FAILED,this.handleLocalStreamInitFailed,this)}},{key:"uninstallEvents",value:function(){sm.off(cm.JOIN_START,this.handleJoinStart,this),sm.off(cm.JOIN_SEND_CMD,this.handleJoinSendCMD,this),sm.off(cm.JOIN_RECEIVED_CMD_RES,this.handleJoinReceivedCMDResponce,this),sm.off(cm.RECEIVED_PUBLISHED_USER_LIST,this.handleReceivedPublishUserList,this),sm.off(cm.CONNECTION_STATE_CHANGED,this.handleConnectionStateChanged,this),sm.off(cm.LEAVE_START,this.handleLeaveStart,this),sm.off(cm.LEAVE_SUCCESS,this.handleLeaveSuccess,this),sm.off(cm.JOIN_FAILED,this.handleJoinFailed,this),sm.off(cm.LEAVE_SEND_CMD,this.handleLeaveSendCMD,this),sm.off(cm.CONNECTION_SEND_SUBSCRIBE_CMD,this.handleSendSubscribeCMD,this),sm.off(cm.VIDEO_LOADED_META_DATA,this.handleVideoPlaying,this),sm.off(cm.AUDIO_LOADED_META_DATA,this.handleAudioPlaying,this),sm.off(cm.NETWORK_QUALITY,this.handleNetworkQuality,this),sm.off(cm.HEARTBEAT_STATS,this.handleHeartbeatStats,this),sm.off(cm.REMOTE_STREAM_ADDED,this.handleRemoteStreamAdded,this),sm.off(cm.REMOTE_STREAM_SUBSCRIBE_START,this.handleRemoteStreamSubscribeStart,this),sm.off(cm.REMOTE_STREAM_SUBSCRIBED,this.handleRemoteStreamSubscribed,this),sm.off(cm.VIDEO_LOADED_DATA,this.handleVideoLoadedData,this),sm.off(cm.PLAY_STREAM_START,this.handlePlayStream,this),sm.off(cm.PUBLISH_START,this.handlePublishStart,this),sm.off(cm.LOCAL_STREAM_INITIALIZE_START,this.handleLocalStreamInitStart,this),sm.off(cm.LOCAL_STREAM_INITIALIZE_END,this.handleLocalStreamInitEnd,this),sm.off(cm.LOCAL_STREAM_INITIALIZE_FAILED,this.handleLocalStreamInitFailed,this)}},{key:"handleJoinStart",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_start_time&&(this.pathJoinRoom_.uint64_start_time=Date.now(),this.checkStorage())}},{key:"handleJoinSendCMD",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time&&(this.pathJoinRoom_.uint64_send_request_enter_room_cmd_start_time=Date.now())}},{key:"handleJoinReceivedCMDResponce",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time&&(this.pathJoinRoom_.uint64_send_request_enter_room_cmd_end_time=Date.now(),this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret=e.code,0!==e.code&&(this.pathJoinRoom_.int32_end_ret=3))}},{key:"handleJoinSuccess",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_end_time&&(this.pathJoinRoom_.uint64_end_time=Date.now(),this.pathJoinRoom_.int32_end_ret=0)}},{key:"handleJoinFailed",value:function(e){var t=e.client,n=e.error;this.hitTest(t)&&(this.pathJoinRoom_.uint64_end_time=Date.now(),this.pathJoinRoom_.int32_end_ret=3,this.pathJoinRoom_.int32_send_request_enter_room_cmd_ret=n instanceof vs?Number(n.getExtraCode()||n.getCode()):_s.UNKNOWN,this.prepareReport(),this.report())}},{key:"handleReceivedPublishUserList",value:function(e){this.hitTest(e.client)&&0===this.pathJoinRoom_.uint64_recv_userlist_time&&(this.pathJoinRoom_.uint64_recv_userlist_time=Date.now(),this.firstPublishedUserList_=e.data.content.userlist)}},{key:"handleConnectionStateChanged",value:function(e){var t=e.client,n=e.state,r=e.connection;if(this.hitTest(t)&&n===Co){this.client_.getUplinkConnection()===r&&0===this.pathJoinRoom_.uint64_send_first_video_frame_time&&this.localStreamStats_.publishStartTime>this.pathJoinRoom_.uint64_end_time&&this.localStreamStats_.publishStartTime-this.pathJoinRoom_.uint64_end_time<=100&&(this.pathJoinRoom_.uint64_send_first_video_frame_time=Date.now());var i=this.pathMainVideoMap_.get("".concat(r.getUserId(),"_").concat("main"));i&&0===i.statsToReport.uint64_pc_connected_time&&(i.statsToReport.uint64_pc_connected_time=Date.now())}}},{key:"handleLeaveStart",value:function(e){this.hitTest(e.client)&&(this.pathLeaveRoom_.uint64_start_time=Date.now())}},{key:"handleLeaveSuccess",value:function(e){this.hitTest(e.client)&&0===this.pathLeaveRoom_.uint64_end_time&&(this.pathLeaveRoom_.uint64_end_time=Date.now(),0!==this.pathJoinRoom_.uint64_end_time?this.basicInfo.uint32_joining_duration=this.pathLeaveRoom_.uint64_end_time-this.pathJoinRoom_.uint64_end_time:this.log_.warn("pathJoinRoom endTime is 0"),this.report())}},{key:"handleLeaveSendCMD",value:function(e){this.hitTest(e.client)&&(this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_start_time=Date.now(),this.pathLeaveRoom_.uint64_send_request_exit_room_cmd_end_time=Date.now())}},{key:"handleRemoteStreamAdded",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),o=this.remoteStreamStatsMap_.get(a);if(o)o.stream=n;else{var s={userId:r,totalVideoFPS:0,totalVideoBitrate:0,totalAudioLevel:0,totalAudioBitrate:0,totalLoss:0,audioCount:0,audioLevelCount:0,videoCount:0,networkQualityCount:0,streamAddedTime:Date.now(),subscribeStartTime:0,subscribedTime:0,playStreamTime:0,statsToReport:Et({},c_),stream:n};s.statsToReport.msg_user_info=new u_({userId:r,tinyId:n.getTinyId(),role:go}),s.statsToReport.uint32_stream_type="main"===i?2:7,this.remoteStreamStatsMap_.set(a,s)}}}},{key:"handleRemoteStreamSubscribeStart",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribeStartTime&&(o.subscribeStartTime=Date.now())}}},{key:"handleSendSubscribeCMD",value:function(e){if(this.hitTest(e.client)){var t=new u_(e),n=Date.now(),r="".concat(e.userId,"_").concat("main");e.trackState.video&&e.subscribeState.video&&!this.pathMainVideoMap_.has(r)&&this.pathMainVideoMap_.set(r,{statsToReport:{msg_user_info:t,uint64_start_enter_time:this.pathJoinRoom_.uint64_start_time,uint64_render_first_frame_time:0,uint64_combine_first_frame_time:0,uint64_pc_connected_time:0},userId:e.userId,sendSubscribeCMDTime:n}),e.trackState.audio&&e.subscribeState.audio&&!this.pathMainAudioMap_.has(r)&&this.pathMainAudioMap_.set(r,{statsToReport:{msg_user_info:t,uint64_start_enter_time:this.pathJoinRoom_.uint64_start_time,uint64_play_first_frame_time:0},userId:e.userId,sendSubscribeCMDTime:n});var i="".concat(e.userId,"_").concat("auxiliary");e.trackState.auxiliary&&e.subscribeState.auxiliary&&!this.pathAuxiliaryMap_.has(i)&&this.pathAuxiliaryMap_.set(i,{sendSubscribeCMDTime:n})}}},{key:"handleRemoteStreamSubscribed",value:function(e){var t=e.client,n=e.stream;if(this.hitTest(t)){var r=n.getUserId(),i=n.getType(),a="".concat(r,"_").concat(i),o=this.remoteStreamStatsMap_.get(a);o&&0===o.subscribedTime&&(o.subscribedTime=Date.now(),o.stream=n)}}},{key:"handlePlayStream",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType());if(this.remoteStreamStatsMap_.has(r)){var i=this.remoteStreamStatsMap_.get(r);0===i.playStreamTime&&(i.playStreamTime=Date.now())}}}},{key:"handleVideoLoadedData",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType());if(this.pathMainVideoMap_.has(r)){var i=this.pathMainVideoMap_.get(r);0===i.statsToReport.uint64_combine_first_frame_time&&(i.statsToReport.uint64_combine_first_frame_time=Date.now())}}}},{key:"handleVideoPlaying",value:function(e){var t=e.stream;if(t.isRemote()&&t.getConnection()&&this.hitTest(t.getConnection().getClient())){var n=t.getConnection().getUserId(),r="".concat(n,"_").concat(t.getType()),i=Date.now();if(this.pathMainVideoMap_.has(r)){var a=this.pathMainVideoMap_.get(r);if(0===a.statsToReport.uint64_render_first_frame_time&&(a.statsToReport.uint64_render_first_frame_time=i),this.remoteStreamStatsMap_.has(r)){var o=this.remoteStreamStatsMap_.get(r),s=o.statsToReport,c=o.playStreamTime,u=o.subscribedTime;0===s.uint32_video_render_first&&c-u<=100&&(s.uint32_video_render_first=i-a.sendSubscribeCMDTime)}}if("auxiliary"===t.getType()&&this.pathAuxiliaryMap_.has(r)&&this.remoteStreamStatsMap_.has(r)){var d=this.remoteStreamStatsMap_.get(r),l=d.statsToReport,h=d.playStreamTime,p=d.subscribedTime;0===l.uint32_video_render_first&&h-p<=100&&(l.uint32_video_render_first=i-this.pathAuxiliaryMap_.get(r).sendSubscribeCMDTime)}}}},{key:"handleAudioPlaying",value:function(e){if(e.stream.isRemote()&&e.stream.getConnection()&&this.hitTest(e.stream.getConnection().getClient())){var t=e.stream.getConnection().getUserId(),n="".concat(t,"_").concat(e.stream.getType());if(this.pathMainAudioMap_.has(n)){var r=this.pathMainAudioMap_.get(n);0===r.statsToReport.uint64_play_first_frame_time&&(r.statsToReport.uint64_play_first_frame_time=Date.now())}}}},{key:"handleNetworkQuality",value:function(e){var t=this;this.hitTest(e.client)&&(this.networkQuality_.totalUplinkLoss+=e.uplinkLoss,this.networkQuality_.totalUplinkRTT+=e.uplinkRTT,this.networkQuality_.count++,e.downlinkLossAndRTTMap.forEach((function(e){var n=e.rtt,r=e.loss,i=e.userId,a=t.networkQuality_.totalDownlinkRTTAndLossMap.get(i);a?(a.totalRTT+=n,a.totalLoss+=r,a.count++):t.networkQuality_.totalDownlinkRTTAndLossMap.set(i,{totalRTT:n,totalLoss:r,count:1})})))}},{key:"handleHeartbeatStats",value:function(e){var t=this;if(this.hitTest(e.client)){var n=e.stats,r=n.VideoReportState,i=n.AudioReportState;r.VideoEncState[0]&&(this.localStreamStats_.totalVideoBitrate+=r.uint32_video_snd_br,this.localStreamStats_.totalVideoFPS+=r.VideoEncState[0].uint32_enc_fps,this.localStreamStats_.totalVideoWidth+=r.VideoEncState[0].uint32_enc_width,this.localStreamStats_.totalVideoHeight+=r.VideoEncState[0].uint32_enc_height,this.localStreamStats_.videoCount++),r.VideoDecState.forEach((function(e){var n=0===e.uint32_video_strtype,r=2===e.uint32_video_strtype,i="".concat(e.userId,"_").concat(n?"main":"auxiliary");if(t.remoteStreamStatsMap_.has(i)){var a=t.remoteStreamStatsMap_.get(i);(n&&a.stream.isMainVideoSubscribed||r&&a.stream.isAuxVideoSubscribed)&&(a.totalVideoFPS+=e.uint32_video_recv_fps,a.totalVideoBitrate+=e.uint32_video_recv_br,a.videoCount++,0===a.statsToReport.uint32_video_width&&(a.statsToReport.uint32_video_width=e.uint32_dec_width),0===a.statsToReport.uint32_video_height&&(a.statsToReport.uint32_video_height=e.uint32_dec_height))}})),i&&(i.AudioDecState.forEach((function(e){var n="".concat(e.userId,"_").concat("main");if(t.remoteStreamStatsMap_.has(n)){var r=t.remoteStreamStatsMap_.get(n);r.stream.isMainAudioSubscribed&&(r.totalAudioBitrate+=e.uint32_audio_real_recv_br,r.audioCount++,Math.floor(100*e.audioLevel)>0&&(r.totalAudioLevel+=e.audioLevel,r.audioLevelCount++))}})),Math.floor(100*i.sentAudioLevel)>0&&(this.localStreamStats_.totalAudioLevel+=i.sentAudioLevel,this.localStreamStats_.audioLevelCount++))}}},{key:"handlePublishStart",value:function(e){var t=e.client;this.hitTest(t)&&0===this.localStreamStats_.publishStartTime&&(this.localStreamStats_.publishStartTime=Date.now())}},{key:"handleLocalStreamInitStart",value:function(e){var t=e.audio,n=e.video;t&&0===this.pathJoinRoom_.uint64_init_audio_start_time&&(this.pathJoinRoom_.uint64_init_audio_start_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_start_time&&(this.pathJoinRoom_.uint64_init_camera_start_time=Date.now())}},{key:"handleLocalStreamInitEnd",value:function(e){var t=e.audio,n=e.video;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.uint64_init_camera_end_time=Date.now())}},{key:"handleLocalStreamInitFailed",value:function(e){var t=e.audio,n=e.video,r=e.error,i=r instanceof vs?r.getExtraCode()||r.getCode():{NotFoundError:1,NotAllowedError:2,NotReadableError:3,OverConstrainedError:4,AbortError:5}[r.name]||_s.UNKNOWN;t&&0===this.pathJoinRoom_.uint64_init_audio_end_time&&(this.pathJoinRoom_.int32_init_audio_ret=i,this.pathJoinRoom_.uint64_init_audio_end_time=Date.now()),n&&0===this.pathJoinRoom_.uint64_init_camera_end_time&&(this.pathJoinRoom_.int32_init_camera_ret=i,this.pathJoinRoom_.uint64_init_camera_end_time=Date.now())}},{key:"hasVideoFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userid===e&&1&t.flag}))>=0}},{key:"hasAudioFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userid===e&&8&t.flag}))>=0}},{key:"hasAuxFlag",value:function(e){return this.firstPublishedUserList_.findIndex((function(t){return t.userid===e&&4&t.flag}))>=0}},{key:"hitTest",value:function(e){return e===this.client_}},{key:"checkStorage",value:(r=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(t=o_.getItem(this.storageKey_))){e.next=6;break}return e.next=5,this.upload(t);case 5:o_.deleteItem(this.storageKey_);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn(e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return r.apply(this,arguments)})},{key:"setStorage",value:function(){this.prepareReport();var e=this.getReportData();0!==e.msg_path_enter_room.uint64_start_time&&o_.setItem(this.storageKey_,e)}},{key:"prepareReport",value:function(){var e=this;if(this.networkQuality_.count>0&&(this.basicInfo.uint32_avg_rtt=Math.floor(this.networkQuality_.totalUplinkRTT/this.networkQuality_.count),this.basicInfo.uint32_avg_up_loss=Math.floor(this.networkQuality_.totalUplinkLoss/this.networkQuality_.count)),this.localStreamStats_.videoCount>0){this.localStreamStats_.statsToReport.uint32_video_big_capture_fps=Math.floor(this.localStreamStats_.totalVideoFPS/this.localStreamStats_.videoCount),this.localStreamStats_.statsToReport.uint32_video_big_bitrate=Math.floor(this.localStreamStats_.totalVideoBitrate/this.localStreamStats_.videoCount);var t=Math.floor(this.localStreamStats_.totalVideoWidth/this.localStreamStats_.videoCount),n=Math.floor(this.localStreamStats_.totalVideoHeight/this.localStreamStats_.videoCount);this.localStreamStats_.statsToReport.uint32_video_big_resolution=t<<16|n}this.localStreamStats_.audioLevelCount>0&&(this.localStreamStats_.statsToReport.uint32_audio_capture_db=Math.floor(this.localStreamStats_.totalAudioLevel/this.localStreamStats_.audioLevelCount*100)),this.remoteStreamStatsMap_.forEach((function(t,n){var r=t.userId;if(e.networkQuality_.totalDownlinkRTTAndLossMap.has(r)){var i=e.networkQuality_.totalDownlinkRTTAndLossMap.get(r),a=i.totalLoss,o=i.count;t.statsToReport.uint32_avg_down_loss=Math.floor(a/o)}t.videoCount>0&&(t.statsToReport.uint32_video_avg_fps=Math.floor(t.totalVideoFPS/t.videoCount),t.statsToReport.uint32_video_avg_bitrate=Math.floor(t.totalVideoBitrate/t.videoCount)),t.audioCount>0&&(t.statsToReport.uint32_audio_recv_bitrate=t.statsToReport.uint32_audio_bitrate=Math.floor(t.totalAudioBitrate/t.audioCount)),t.audioLevelCount>0&&(t.statsToReport.uint32_audio_play_db=Math.floor(t.totalAudioLevel/t.audioLevelCount*100));var s=e.client_.getCallDurationCalculator();s&&(t.statsToReport.uint32_audio_play_time=s.getDuration(n,"audio"),t.statsToReport.uint32_video_play_time=s.getDuration(n,"video")),t.statsToReport.uint32_video_render_first=Math.min(t.statsToReport.uint32_video_render_first,5e3);var c=e.client_.getBadCaseDetector();if(c){var u=c.getDataFreezeDuration(n),d=u.dataFreeze,l=u.count,h=c.getRenderFreezeDuration(n).renderFreeze;t.statsToReport.uint32_video_block_count=l,t.statsToReport.uint32_video_block_time=Math.min(d,t.statsToReport.uint32_video_play_time),t.statsToReport.uint32_video_external_block_time=Math.min(h,t.statsToReport.uint32_video_play_time),c.isBlackStream(n)&&0===t.statsToReport.uint32_video_avg_fps?t.statsToReport.uint32_video_black_screen_subjective=1:t.statsToReport.uint32_video_black_screen_subjective=0}(0===t.subscribeStartTime||t.subscribeStartTime-t.streamAddedTime>100||0===t.playStreamTime)&&(e.pathMainAudioMap_.delete(n),e.pathMainVideoMap_.delete(n),t.statsToReport.uint32_video_render_first=0)})),this.pathMainAudioMap_.forEach((function(t,n){e.hasAudioFlag(t.userId)?t.statsToReport.uint64_play_first_frame_time-t.statsToReport.uint64_start_enter_time>5e3&&(t.statsToReport.uint64_play_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):e.pathMainAudioMap_.delete(n)})),this.pathMainVideoMap_.forEach((function(t,n){e.hasVideoFlag(t.userId)?t.statsToReport.uint64_render_first_frame_time-t.statsToReport.uint64_start_enter_time>5e3&&(t.statsToReport.uint64_render_first_frame_time=t.statsToReport.uint64_start_enter_time+5e3):e.pathMainVideoMap_.delete(n)})),this.pathJoinRoom_.uint64_end_time-this.pathJoinRoom_.uint64_start_time>5e3&&(this.pathJoinRoom_.uint64_end_time=this.pathJoinRoom_.uint64_start_time+5e3)}},{key:"getReportData",value:function(){var e=this.client_.getSignalInfo();return{uint32_sdk_app_id:Number(this.client_.getSDKAppId()),msg_user_info:new u_({userId:this.client_.getUserId(),tinyId:this.client_.getTinyId(),role:"anchor"===this.client_.getRole()?go:So}),msg_basic_info:this.basicInfo,uint32_acc_ip:Ms(e.relayIp),uint32_client_ip:Ms(e.localIp,"small"),uint32_acc_port:0,uint64_timestamp:Date.now(),uint32_seq:Math.floor(Math.random()*Math.pow(2,31)),msg_path_enter_room:this.pathJoinRoom_,msg_path_exit_room:this.pathLeaveRoom_,msg_path_recv_video:Nt(this.pathMainVideoMap_.values()).map((function(e){return e.statsToReport})),msg_quality_statistics:Nt(this.remoteStreamStatsMap_.values()).map((function(e){return e.statsToReport})),str_room_name:String(this.client_.getRoomId()),msg_path_recv_audio:Nt(this.pathMainAudioMap_.values()).map((function(e){return e.statsToReport})),uint32_info_client_ip:Ms(e.localIp,"small"),error_code:[],msg_local_statistics:this.localStreamStats_.statsToReport}}},{key:"report",value:(n=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=this.getReportData(),e.next=4,this.upload(t);case 4:o_.deleteItem(this.storageKey_),this.initData(),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn(e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return n.apply(this,arguments)})},{key:"upload",value:(t=St(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!so&&0!==t.msg_path_enter_room.uint64_start_time){e.next=2;break}return e.abrupt("return");case 2:return n=Math.floor(Math.random()*Math.pow(2,31)),r=Number(this.client_.getSDKAppId()),i="".concat("https://yun.tim.qq.com","/v5/AVQualityReportSvc/C2S?random=").concat(n,"&sdkappid=").concat(r,"&cmdtype=jssdk_new_endreport"),e.next=7,mu.post(i,JSON.stringify(t));case 7:if("ok"===(a=e.sent).data){e.next=10;break}throw"key point upload failed: ".concat(a.data);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),l_=function(){function e(t){var n=this;if(yt(this,e),this.mode_=t.mode,this.sdpSemantics_="plan-b",Cs(t.sdpSemantics)?function(){if(!kf())return!1;if(Cs(window.RTCRtpTransceiver))return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;var e=new RTCPeerConnection,t=!1;try{e.addTransceiver("audio"),t=!0}catch(T_){}return e.close(),t}()&&(this.sdpSemantics_="unified-plan"):this.sdpSemantics_=t.sdpSemantics,this.sdkAppId_=t.sdkAppId,this.userId_=t.userId,this.log_=new om({id:"c|"+this.userId_,direction:"local",type:""}),this.userSig_=t.userSig,this.roomId_=0,this.useStringRoomId_=t.useStringRoomId||!1,this.recordId_=null,this.pureAudioPushMode_=null,this.version_=t.version,this.log_.info("using sdpSemantics: "+this.sdpSemantics_),Os.setConfig({sdkAppId:this.sdkAppId_,userId:this.userId_,version:this.version_}),!Cs(t.recordId)){if(!Number.isInteger(Number(t.recordId)))throw new vs({code:_s.INVALID_PARAMETER,message:"recordId must be an integer number"});this.recordId_=t.recordId}this.signalChannel_=null,this.isScreenShareOnly_=0,Cs(t.isScreenShareOnly)||(this.isScreenShareOnly_=t.isScreenShareOnly?1:0),this.role_="anchor",this.privateMapKey_="",this.tinyId_=0,this.env_="",this.proxy_=null,this.turnServers_=[],this.connections_=new Map,this.mutedStates_=new Map,this.userMap_=new Map,this.syncUserListInterval_=-1,this.localStream_=null,this.isUplinkClosing_=!1,this.uplinkConnection_=null,this.emitter_=new Uh,this.signalInfo_={},this.isSignalReady_=!1,this.isJoined_=!1,this.heartbeat_=-1,this.stats_=new am,this.joinTimeout_=-1,this.unpublishTimeout_=-1,this.networkQuality_=null,this.badCaseDetector_=null,this.autoSubscribe_=!!Cs(t.autoSubscribe)||t.autoSubscribe,this.startJoinTimestamp_=0,this.joinedTimestamp_=0,this.joinOptions={},this.basis_={browser:hf().browserName+"/"+hf().browserVersion,os:wf(),displayResolution:Af(),isScreenShareSupported:Sf(),isWebRTCSupported:ff(),isGetUserMediaSupported:xf(),isWebAudioSupported:Pf(),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING},this.initBussinessInfo_(t),this.publishedCDN_=!1,this.publishCDNData_=null,this.mixedMCU_=!1,this.mixTranscodeData_=null,this.checkSystemResult_=null,this.enableAudioVolumeEvaluation_=!1,this.audioVolumeIntervalId_=null,this.mixTranscodeManager_=null,this.publishCDNManager_=null,this.keyPointManager_=new d_({client:this,frameWorkType:t.frameWorkType}),this.iceTransportPolicy_=Cs(t.iceTransportPolicy)?"all":t.iceTransportPolicy,["join","leave","publish","unpublish","switchRole"].forEach((function(e){Es(n[e])&&(n[e]=function(e){var t=e.fn,n=e.context,r=e.name,i=!1;return St(regeneratorRuntime.mark((function e(){var a,o,s,c,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"previous ".concat(r,"() is ongoing, please avoid repeated calls")});case 2:for(e.prev=2,i=!0,a=u.length,o=new Array(a),s=0;s<a;s++)o[s]=u[s];return e.next=7,t.apply(n||this,o);case 7:return c=e.sent,i=!1,e.abrupt("return",c);case 12:throw e.prev=12,e.t0=e.catch(2),i=!1,e.t0;case 16:case"end":return e.stop()}}),e,this,[[2,12]])})))}({fn:n[e],context:n,name:e}))})),this.getUserList=Ym({retryFunction:this.getUserList,settings:{retries:3},onError:function(e,t){return t()},onRetrying:function(e){n.log_.info("retrying to get user list [".concat(e,"/3]"))}}),this.isPublishing_=!1,this.isEnableSmallStream_=!1,this.smallStreamConfig_={bitrate:100,framerate:15,height:120,width:160}}var t,n,r,i,a,o,s,c,u,d,l,h,p,f,m,_,v,g,S,y,b,k,T;return kt(e,[{key:"initBussinessInfo_",value:function(e){this.bussinessInfo_=e.bussinessInfo;var t={};if(Is(e.bussinessInfo)&&(t=JSON.parse(e.bussinessInfo)),!Cs(e.pureAudioPushMode)){if(!Number.isInteger(Number(e.pureAudioPushMode)))throw new vs({code:_s.INVALID_PARAMETER,message:"pureAudioPushMode must be an integer number"});this.pureAudioPushMode_=e.pureAudioPushMode,t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.pure_audio_push_mod=this.pureAudioPushMode_}if(!Cs(e.streamId)){if(!(Is(e.streamId)&&String(e.streamId)&&String(e.streamId).length<=64))throw new vs({code:_s.INVALID_PARAMETER,message:"streamId must be a sting literal within 64 bytes, and not be empty"});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_streamid_main=e.streamId}if(!Cs(e.userDefineRecordId)){if(null===e.userDefineRecordId.match(/^[A-Za-z0-9_-]{1,64}$/gi))throw new vs({code:_s.INVALID_PARAMETER,message:"userDefineRecordId must be a sting literal contains (a-zA-Z),(0-9), underline and hyphen, within 64 bytes, and not be empty"});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_record_id=e.userDefineRecordId}if(!Cs(e.userDefinePushArgs)){if(!(Is(e.userDefinePushArgs)&&String(e.userDefinePushArgs)&&String(e.userDefinePushArgs).length<=256))throw new vs({code:_s.INVALID_PARAMETER,message:"userDefinePushArgs must be a sting literal within 256 bytes, and not be empty"});t.Str_uc_params||(t.Str_uc_params={}),t.Str_uc_params.userdefine_push_args=e.userDefinePushArgs}cf(t)||(this.bussinessInfo_=JSON.stringify(t))}},{key:"setProxyServer",value:function(e){if(this.log_.info("set proxy server: ".concat(JSON.stringify(e))),Is(e)){if(!e.startsWith("wss://"))throw new vs({code:_s.INVALID_PARAMETER,message:'proxy server url shall be started with "wss://"'});this.proxy_=e}else if(Ts(e)){var t=e.websocketProxy,n=e.loggerProxy;t&&(this.proxy_=t),n&&mo(n)}}},{key:"getUrl",value:function(e){var t=ys(e);return!Ss()&&this.proxy_&&(t=this.proxy_),t}},{key:"getBackupUrl",value:function(){return this.proxy_?this.proxy_:ys(po)}},{key:"getUserId",value:function(){return this.userId_}},{key:"getUserSig",value:function(){return this.userSig_}},{key:"getRole",value:function(){return this.role_}},{key:"getSignalInfo",value:function(){return this.signalInfo_}},{key:"getRoomId",value:function(){return this.roomId_}},{key:"getSDKAppId",value:function(){return this.sdkAppId_}},{key:"getTinyId",value:function(){return this.tinyId_}},{key:"setTurnServer",value:function(e){this.log_.info("set turn server: "+JSON.stringify(e));var t=[];Array.isArray(e)?e.forEach((function(e){return t.push(Ps(e))})):Ts(e)&&t.push(Ps(e)),this.turnServers_=t}},{key:"getIceTransportPolicy",value:function(){return this.iceTransportPolicy_}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){e.log_.info("setup signal channel"),e.signalChannel_=new uf({sdkAppId:e.sdkAppId_,userId:e.userId_,userSig:e.userSig_,url:e.getUrl(ho),backupUrl:e.getUrl(po),version:e.version_}),e.networkQuality_||(e.networkQuality_=new um({connections:e.connections_,signalChannel:e.signalChannel_,userId:e.userId_,client:e}),e.networkQuality_.on($f,(function(t){e.emitter_.emit($f,t)}))),e.deviceDetector_||(e.deviceDetector_=new dm),e.subscriptionManager_||(e.subscriptionManager_=new Cm({client:e})),e.badCaseDetector_||(e.badCaseDetector_=new qm({client:e})),e.callDurationCalculator_||(e.callDurationCalculator_=new e_({client:e})),e.mixTranscodeManager_||(e.mixTranscodeManager_=new Xm({client:e,signalChannel:e.signalChannel_})),e.publishCDNManager_||(e.publishCDNManager_=new Zm({client:e,signalChannel:e.signalChannel_})),e.signalChannel_.on(Vh,(function(t){switch(e.log_.info("SignalChannel state changed from ".concat(t.prevState," to ").concat(t.state)),t.state){case Gh:t.prevState===Hh?(e.log_.warn("signal channel reconnect successfully"),e.syncUserList(),af({eventType:Wo})):t.prevState===Jh&&af({eventType:zo})}e.emitter_.emit(Hf,t)})),e.signalChannel_.on(Fh,(function(t){e.isSignalReady_?(e.closeUplink(),e.closeConnections(),e.emitter_.emit(Zf,t)):n(t)})),e.signalChannel_.on(Qh.CHANNEL_SETUP_FAILED,(function(t){e.log_.error("signal channel setup failed"),n(t)})),e.signalChannel_.on(Qh.CHANNEL_SETUP_SUCCESS,(function(n){e.signalInfo_=n.signalInfo,e.tinyId_=e.signalInfo_.tinyId,e.isSignalReady_||(e.isSignalReady_=!0,t())})),e.signalChannel_.on(Qh.PEER_JOIN,e.onPeerJoin,e),e.signalChannel_.on(Qh.PEER_LEAVE,e.onPeerLeave,e),e.signalChannel_.on(Qh.STREAM_ADDED,(function(t){e.onRemoteStreamAdded(t.data)})),e.signalChannel_.on(Qh.STREAM_REMOVED,(function(t){e.onRemoteStreamRemoved(t.data)})),e.signalChannel_.on(Qh.UPDATE_REMOTE_MUTE_STAT,(function(t){sm.emit(cm.RECEIVED_PUBLISHED_USER_LIST,{client:e,data:t.data}),e.onPublishedUserList(t.data),e.onUpdateRemoteMuteStat(t.data)})),e.signalChannel_.on(Qh.CLINET_BANNED,function(){var t=St(regeneratorRuntime.mark((function t(n){var r,i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.data.content,t.next=3,e.reset();case 3:i=r.type,"banned"===r.type?i="you got banned by account admin":"kick"===r.type&&(i="duplicated userId joining the room"),e.log_.error("user was banned because of [".concat(r.type,"]")),e.onClientBanned(i);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e.signalChannel_.on(Qh.REQUEST_REBUILD_SESSION,(function(t){e.signalInfo_=t.signalInfo;var n=[];e.connections_&&n.push(0);var r,i=[],a=jt(e.connections_);try{for(a.s();!(r=a.n()).done;){var o=Lt(r.value,2),s=o[0],c=o[1];n.push(s);var u=c.getPeerConnection();if(u){var d=u.remoteDescription;d&&i.push(d.sdp)}}}catch(h){a.e(h)}finally{a.f()}var l={socketid:e.signalInfo_.socketId,tinyid:e.tinyId_,appid:e.sdkAppId_,openid:e.userId_,sessionid:String(e.roomId_),sids:n,relayInfo:e.signalInfo_.relayInnerIp,remotesdp:i,useStrRoomid:!!e.useStringRoomId_&&1};e.log_.debug("reconnect - rebuild session with data: ".concat(JSON.stringify(l))),e.signalChannel_.send(Xh,l)})),e.signalChannel_.on(Qh.CLIENT_REJOIN,function(){var t=St(regeneratorRuntime.mark((function t(n){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.reJoin();case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e.signalChannel_.connect()}))}},{key:"join",value:(T=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isJoined_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"duplicate join() called"});case 2:return n=hf(),e.next=5,gf();case 5:if(this.checkSystemResult_=e.sent,(r=Ss())||(r="qcloud",this.proxy_&&(this.proxy_.startsWith(uo)?r="trtc":this.proxy_.startsWith(lo)&&(r="webrtc"))),this.env_=r,ef({env:r,sdkAppId:this.sdkAppId_,userId:this.userId_,version:this.version_,browserVersion:n.name+n.version,ua:navigator.userAgent}),this.uploadTrtcStats(),i=this.checkSystemResult_.detail,a=i.isH264EncodeSupported,o=i.isVp8EncodeSupported,ff()&&(a||o)){e.next=14;break}throw new vs({code:_s.NOT_SUPPORTED,message:"the browser does NOT support WebRTC!"});case 14:if(!this.useStringRoomId_){e.next=20;break}if(Is(t.roomId)&&/^[A-Za-z\d\s!#$%&()+\-:;<=.>?@[\]^_{}|~,]{1,64}$/.test(t.roomId)){e.next=18;break}throw new vs({code:_s.INVALID_PARAMETER,message:"roomId must be validate string when useStringRoomId is true"});case 18:e.next=23;break;case 20:if(ws(t.roomId)&&/^[1-9]\d*$/.test(String(t.roomId))&&t.roomId<4294967295){e.next=23;break}throw new vs({code:_s.INVALID_PARAMETER,message:"roomId must be validate integer when useStringRoomId is false"});case 23:return this.joinOptions=t,this.startJoinTimestamp_=Ds(),sm.emit(cm.JOIN_START,{client:this}),$p(this.userId_,{eventId:Lp,eventDesc:"joining room",timestamp:kd(),userId:this.userId_,tinyId:this.tinyId_}),e.prev=27,e.next=30,this.initialize();case 30:e.next=37;break;case 32:throw e.prev=32,e.t0=e.catch(27),sm.emit(cm.JOIN_FAILED,{client:this,error:e.t0}),of({eventType:Io,error:e.t0}),e.t0;case 37:return e.prev=37,e.next=40,this.doJoin(t);case 40:e.next=47;break;case 42:throw e.prev=42,e.t1=e.catch(37),sm.emit(cm.JOIN_FAILED,{client:this,error:e.t1}),of({eventType:Io,error:e.t1}),e.t1;case 47:sm.emit(cm.JOIN_SUCCESS,{client:this}),this.joinedTimestamp_=Ds(),s=this.joinedTimestamp_-this.startJoinTimestamp_,af({eventType:wo,delta:s}),af({eventType:Io});case 52:case"end":return e.stop()}}),e,this,[[27,32],[37,42]])}))),function(e){return T.apply(this,arguments)})},{key:"uploadTrtcStats",value:(k=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c,u,d,l,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,k_.getMicrophones();case 3:r=e.sent,t=r&&r.length,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(0);case 9:return e.prev=9,e.next=12,k_.getCameras();case 12:i=e.sent,n=i&&i.length,e.next=18;break;case 16:e.prev=16,e.t1=e.catch(9);case 18:a={microphone:t,camera:n},o=this.checkSystemResult_.detail,s=o.isH264EncodeSupported,c=o.isVp8EncodeSupported,u=o.isH264DecodeSupported,d=o.isVp8DecodeSupported,l={webRTC:this.basis_.isWebRTCSupported,getUserMedia:this.basis_.isGetUserMediaSupported,webSocket:this.basis_.isWebSocketsSupported,screenShare:this.basis_.isScreenShareSupported,webAudio:this.basis_.isWebAudioSupported,h264Encode:s,h264Decode:u,vp8Encode:c,vp8Decode:d},h={browser:this.basis_.browser,os:this.basis_.os,trtc:l,devices:a},tf("trtcstats-"+JSON.stringify(h)),this.log_.info("TrtcStats-"+JSON.stringify(h));case 24:case"end":return e.stop()}}),e,this,[[0,7],[9,16]])}))),function(){return k.apply(this,arguments)})},{key:"getVersion",value:function(){var e=this.version_.split(".");return 1e3*parseInt(e[0])+100*parseInt(e[1])+parseInt(e[2])}},{key:"doJoin",value:function(e){var t=this;return new Promise((function(n,r){if(!t.isSignalReady_)throw new vs({code:_s.INVALID_OPERATION,message:"SignalChannel is not ready yet"});t.roomId_=e.roomId,Cs(e.role)||(t.role_=e.role);var i="";Cs(e.privateMapKey)||(i=e.privateMapKey),t.privateMapKey_=i,t.log_.info("Join() => joining room: ".concat(e.roomId," useStringRoomId: ").concat(t.useStringRoomId_," mode: ").concat(t.mode_," role: ").concat(t.role_));var a=t.signalInfo_,o={openid:a.openId,tinyid:a.tinyId,peerconnectionport:"",useStrRoomid:!!t.useStringRoomId_&&1,roomid:String(e.roomId),sdkAppID:String(t.sdkAppId_),socketid:a.socketId,userSig:t.userSig_,privMapEncrypt:i,privMap:"",relayip:a.relayInnerIp,dataport:a.dataPort,stunport:a.stunPort,checkSigSeq:a.checkSigSeq,pstnBizType:0,pstnPhoneNumber:null,recordId:t.recordId_,role:"user",jsSdkVersion:String(t.getVersion()),sdpSemantics:t.sdpSemantics_,browserVersion:oo,closeLocalMedia:!0,trtcscene:"live"===t.mode_?vo:_o,trtcrole:"anchor"===t.role_?go:So,bussinessInfo:t.bussinessInfo_,isAuxUser:t.isScreenShareOnly_,autoSubscribe:t.autoSubscribe_};t.joinTimeout_=setTimeout((function(){t.log_.error("join room timeout observed"),r(new vs({code:_s.JOIN_ROOM_FAILED,message:"join room timeout"}))}),5e3),sm.emit(cm.JOIN_SEND_CMD,{client:t});var s={AbilityOption:{GeneralLimit:{CPULimit:{uint32_CPU_num:String(navigator.hardwareConcurrency||0),str_CPU_name:String(navigator.platform),uint32_CPU_maxfreq:String(0),model:"",uint32_total_memory:String(0)},uint32_terminal_type:String(ha?4:ua?2:ca?3:Fa?12:ja?5:Ba?13:1),uint32_device_type:String(0),str_os_verion:ha?"Android":ua?"iPhone":ca?"iPad":Fa?"Mac":ja?"Windows":Ba?"Linux":"unknown",uint32_link_type:String(1),str_client_version:"4.11.1",uint32_net_type:String(hs[ks()]),ua:navigator.userAgent,version:""}}},c=t.getSystemResult().detail,u=c.isH264EncodeSupported,d=c.isVp8EncodeSupported,l="";u?l="H264":d&&(l="VP8");var h={EncVideoCodec:l,EncVideoWidth:0,EncVideoHeight:0,EncVideoBr:"0",EncVideoFps:0,EncAudioCodec:"opus",EncAudioFS:0,EncAudioCh:0,EncAudioBr:"0"};s.AbilityOption.AVLimit=h,t.signalChannel_.sendWithReport(Kh,o,s),t.signalChannel_.once(Qh.JOIN_ROOM_RESULT,(function(e){clearTimeout(t.joinTimeout_),t.joinTimeout_=-1;var i=e.data.content.ret;sm.emit(cm.JOIN_RECEIVED_CMD_RES,{client:t,code:i}),i?(t.log_.error("Join room failed result: "+i+" error: "+e.data.content.error),r(new vs({code:_s.JOIN_ROOM_FAILED,extraCode:i,message:"Failed to join room - "+e.data.content.error}))):(t.isJoined_=!0,t.log_.info("Join room success, start heartbeat"),t.startHeartbeat(),t.badCaseDetector_&&t.badCaseDetector_.start(),t.syncUserList(),t.startSyncUserListInterval(),n())}))}))}},{key:"connectSignalBeforeReJoin",value:function(){var e=this;return new Promise((function(t,n){e.log_.warn("connectSignalBeforeReJoin() try to connect signal before reJoin"),e.isSignalReady_=!1,e.signalChannel_.close(),e.signalChannel_.once(Qh.CHANNEL_SETUP_SUCCESS,(function(n){e.log_.warn("connectSignalBeforeReJoin() signal setup successfully"),t()})),e.signalChannel_.once(Fh,(function(t){e.log_.warn("connectSignalBeforeReJoin() signal setup failed"),n(t)})),e.signalChannel_.connect()}))}},{key:"reJoin",value:(b=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_){e.next=3;break}return this.log_.warn("reJoin() you haven't join room yet, abort reJoin"),e.abrupt("return");case 3:return this.isJoined_=!1,e.prev=4,this.log_.warn("reJoin() try to reJoin room: ".concat(this.joinOptions.roomId)),this.subscriptionManager_&&this.subscriptionManager_.markAllStream(),e.next=9,this.connectSignalBeforeReJoin();case 9:return e.next=11,this.doJoin(this.joinOptions);case 11:if(this.log_.warn("reJoin() reJoin successfully"),af({eventType:Ao}),e.prev=13,!this.uplinkConnection_||!this.localStream_||this.uplinkConnection_.getIsReconnecting()){e.next=17;break}return e.next=17,this.republish();case 17:e.next=21;break;case 19:e.prev=19,e.t0=e.catch(13);case 21:e.next=28;break;case 23:e.prev=23,e.t1=e.catch(4),this.log_.warn("reJoin() reJoin failed"+e.t1),of({eventType:Ao,error:e.t1}),this.emitter_.emit(Zf,new vs({code:_s.JOIN_ROOM_FAILED,message:"reJoin room: ".concat(this.joinOptions.roomId," failed, please check your network")}));case 28:case"end":return e.stop()}}),e,this,[[4,23],[13,19]])}))),function(){return b.apply(this,arguments)})},{key:"republish",value:(y=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.log_.warn("republish() try to re-publish localStream"),t=this.localStream_,e.next=5,this.doUnpublish(t);case 5:return e.next=7,this.publish(t);case 7:this.log_.warn("republish() re-publish localStream successfully"),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(0),this.log_.warn("republish() re-publish localStream failed "+e.t0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[0,10]])}))),function(){return y.apply(this,arguments)})},{key:"leave",value:(S=St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return sm.emit(cm.LEAVE_START,{client:this}),$p(this.userId_,{eventId:Np,eventDesc:"leaving room",timestamp:kd(),userId:this.userId_,tinyId:this.tinyId_}),e.prev=2,e.next=5,this.doHeartbeat();case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return e.prev=9,e.next=12,this.doLeave();case 12:e.next=16;break;case 14:e.prev=14,e.t1=e.catch(9);case 16:sm.emit(cm.LEAVE_SUCCESS,{client:this}),af({eventType:xo}),t=Math.floor((Ds()-this.joinedTimestamp_)/1e3),af({eventType:Po,delta:t});case 20:case"end":return e.stop()}}),e,this,[[2,7],[9,14]])}))),function(){return S.apply(this,arguments)})},{key:"doLeave",value:function(){var e=this;return new Promise(function(){var t=St(regeneratorRuntime.mark((function t(n,r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.isJoined_){t.next=2;break}return t.abrupt("return",n());case 2:return sm.emit(cm.LEAVE_SEND_CMD,{client:e}),e.log_.info("leave() => leaving room"),e.signalChannel_.send(Yh),t.next=7,e.reset();case 7:return t.abrupt("return",n());case 8:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}())}},{key:"clearUnpublishTimeout",value:function(){this.unpublishTimeout_&&(clearTimeout(this.unpublishTimeout_),this.unpublishTimeout_=-1)}},{key:"clearNetworkQuality",value:function(){this.networkQuality_&&(this.networkQuality_.stop(),this.networkQuality_=null)}},{key:"closeConnections",value:function(){var e=this;this.connections_.forEach((function(t){e.closeDownLink(t.getTinyId())}))}},{key:"destroy",value:function(){if(this.isJoined_)throw this.log_.warn("please call leave() before destroy() client"),new vs({code:_s.INVALID_OPERATION,message:"Please call leave() before destory() the client"});this.log_.info("destroying SignalChannel"),this.signalChannel_&&(this.signalChannel_.close(),this.signalChannel_=null)}},{key:"reset",value:(g=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.keyPointManager_&&this.keyPointManager_.prepareReport(),this.mixTranscodeManager_&&(this.mixTranscodeManager_.stop(),this.mixTranscodeManager_=null),this.publishCDNManager_&&(this.publishCDNManager_=null),this.stopSyncUserListInterval(),this.stopHeartbeat(),this.closeConnections(),this.mutedStates_.clear(),this.clearUnpublishTimeout(),this.clearNetworkQuality(),this.badCaseDetector_&&this.callDurationCalculator_&&this.uploadAllCallStats(),e.prev=10,e.next=13,this.closeUplink();case 13:e.next=17;break;case 15:e.prev=15,e.t0=e.catch(10);case 17:this.isJoined_=!1,this.isSignalReady_=!1,this.destroy();case 20:case"end":return e.stop()}}),e,this,[[10,15]])}))),function(){return g.apply(this,arguments)})},{key:"startSyncUserListInterval",value:function(){"live"===this.mode_&&"audience"===this.role_&&-1===this.syncUserListInterval_&&(this.syncUserListInterval_=yd.setInterval(this.syncUserList.bind(this),1e4))}},{key:"stopSyncUserListInterval",value:function(){yd.clearInterval(this.syncUserListInterval_),this.syncUserListInterval_=-1}},{key:"syncUserList",value:(v=St(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getUserList();case 3:t=e.sent,0!==this.userMap_.size&&this.userMap_.forEach((function(e){t.findIndex((function(t){return t.userId===e.userId}))<0&&(n.log_.info("peer leave detected: ".concat(e.userId)),n.cleanUser({userId:e.userId,tinyId:e.tinyId}))})),t.forEach((function(e){var t=e.userId;n.userMap_.has(t)||t===n.userId_||(n.userMap_.set(t,e),n.emitter_.emit(Gf,{userId:t}))})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.log_.warn("sync user list failed: "+e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),function(){return v.apply(this,arguments)})},{key:"getUserList",value:function(){var e=this;return new Promise((function(t,n){e.signalChannel_.send(pp),e.signalChannel_.once(Qh.USER_LIST_RES,(function(e){var n=e.data.content.userlist.map((function(e){var t=e.userid,n=e.srctinyid,r=e.role;return new Km({userId:t,tinyId:n,role:r})}));t(n)})),setTimeout(n,2e3)}))}},{key:"publish",value:function(e){var t=this;return new Promise(function(){var n=St(regeneratorRuntime.mark((function n(r,i){var a,o,s,c;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.isPublishing_=!0,df.result){n.next=3;break}throw new vs({code:_s.NOT_SUPPORTED,message:"the browser does NOT support TRTC!"});case 3:if(t.isJoined_){n.next=5;break}throw new vs({code:_s.INVALID_OPERATION,message:"please call join() before publish()"});case 5:if("live"!==t.mode_||"audience"!==t.role_){n.next=7;break}throw new vs({code:_s.INVALID_OPERATION,message:"no permission to publish() under live/".concat("audience",', please call switchRole("').concat("anchor",'") firstly before publish()')});case 7:if(!t.localStream_){n.next=9;break}throw new vs({code:_s.INVALID_OPERATION,message:"duplicate publishing, please unpublish and then re-publish"});case 9:if(e.getIsReadyToPublish()){n.next=11;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot publish stream because stream is not initialized or is switching device"});case 11:return e.setPublishState(fs),a=Ds(),sm.emit(cm.PUBLISH_START,{client:t,stream:e}),t.log_.info("publish() => publishing local stream"),(o=new Bm({userId:t.userId_,tinyId:t.tinyId_,client:t,isUplink:!0,signalChannel:t.signalChannel_})).initialize(),o.on(Uf,function(){var e=St(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=n.getCode())!==_s.ICE_TRANSPORT_ERROR){e.next=3;break}return e.abrupt("return");case 3:if(r!==_s.UPLINK_RECONNECTION_FAILED){e.next=6;break}return e.next=6,t.closeUplink();case 6:t.emitter_.emit(Zf,n);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n.prev=18,n.next=21,o.publish(e);case 21:t.localStream_=n.sent,t.log_.info("local stream publish successfully"),t.isPublishing_=!1,e.setPublishState(ms),t.localStream_.setConnection(o),t.uplinkConnection_=o,s=Ds(),c=s-a,af({eventType:Do}),af({eventType:Mo,delta:c}),e.hasAudio()&&$p(t.userId_,{eventId:vp,eventDesc:"publish audio track",timestamp:kd(),userId:t.userId_,tinyId:t.tinyId_}),e.hasVideo()&&$p(t.userId_,{eventId:_p,eventDesc:"publish video track",timestamp:kd(),userId:t.userId_,tinyId:t.tinyId_}),t.networkQuality_&&t.networkQuality_.setUplinkConnection(t.uplinkConnection_),t.deviceDetector_&&t.deviceDetector_.setLocalStream(t.localStream_),sm.emit(cm.LOCAL_STREAM_PUBLISHED,{localStream:t.localStream_}),r(),n.next=47;break;case 39:n.prev=39,n.t0=n.catch(18),e.setPublishState(ps),o.close(),t.log_.error("failed to publish stream "+n.t0),t.isPublishing_=!1,of({eventType:Do,error:n.t0}),i(n.t0);case 47:case"end":return n.stop()}}),n,null,[[18,39]])})));return function(e,t){return n.apply(this,arguments)}}())}},{key:"unpublish",value:function(e){var t=this;return new Promise((function(n,r){if(e!==t.localStream_)throw new vs({code:_s.INVALID_PARAMETER,message:"stream has not been published yet"});t.log_.info("unpublish() => unpublishing local stream"),t.doUnpublish().then((function(){af({eventType:Oo}),n()})).catch((function(e){of({eventType:Oo,error:e}),r(e)}))}))}},{key:"doUnpublish",value:function(){var e=this;return new Promise((function(t,n){e.signalChannel_.send(rp),e.unpublishTimeout_=setTimeout(St(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e.log_.warn("unpublish() timeout observed"),n.next=3,e.closeUplink();case 3:return n.abrupt("return",t());case 4:case"end":return n.stop()}}),n)}))),5e3),e.signalChannel_.once(Qh.UNPUBLISH_RESULT,function(){var n=St(regeneratorRuntime.mark((function n(r){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return e.clearUnpublishTimeout(),e.log_.info("received UNPUBLISH_RESULT, close uplink connection"),n.next=4,e.closeUplink();case 4:return n.abrupt("return",t());case 5:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}())}))}},{key:"closeUplink",value:(_=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isUplinkClosing_){e.next=3;break}return this.log_.warn("uplink is closing, abort current closeUplink request"),e.abrupt("return");case 3:this.isUplinkClosing_=!0,this.uplinkConnection_&&(this.uplinkConnection_.getIsReconnecting()&&this.uplinkConnection_.stopReconnection(),this.uplinkConnection_.close(),this.uplinkConnection_=null,this.networkQuality_&&this.networkQuality_.setUplinkConnection(null),this.localStream_.hasAudio()&&$p(this.userId_,{eventId:Sp,eventDesc:"unpublish audio track",timestamp:kd(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.hasVideo()&&$p(this.userId_,{eventId:gp,eventDesc:"unpublish video track",timestamp:kd(),userId:this.userId_,tinyId:this.tinyId_}),this.localStream_.setConnection(null),this.localStream_=null,this.deviceDetector_&&this.deviceDetector_.setLocalStream(null)),this.isUplinkClosing_=!1;case 6:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"closeDownLink",value:function(e){var t=this.connections_.get(e);t&&(t.getIsReconnecting()&&t.stopReconnection(),this.subscriptionManager_&&this.subscriptionManager_.delete(t.getUserId()),t.close(),this.connections_.delete(e),this.mutedStates_.delete(e))}},{key:"subscribe",value:(m=St(regeneratorRuntime.mark((function e(t,n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new vs({code:_s.INVALID_PARAMETER,message:"stream is undefined or null"});case 2:if(t.isRemote()){e.next=4;break}throw new vs({code:_s.INVALID_PARAMETER,message:"try to subscribe a local stream"});case 4:return this.log_.info("subscribe() => subscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream with options: ").concat(JSON.stringify(n))),Cs(n)&&(n={audio:!0,video:!0}),Cs(n.video)&&(n.video=!0),Cs(n.audio)&&(n.audio=!0),r=t.getConnection(),e.prev=9,sm.emit(cm.REMOTE_STREAM_SUBSCRIBE_START,{client:this,stream:t}),e.next=13,r.subscribe(t,n);case 13:this.subscriptionManager_&&this.subscriptionManager_.addSubscriptionRecord(t.getUserId(),t,n),af({eventType:Lo}),e.next=21;break;case 17:throw e.prev=17,e.t0=e.catch(9),of({eventType:Lo,error:e.t0}),e.t0;case 21:case"end":return e.stop()}}),e,this,[[9,17]])}))),function(e,t){return m.apply(this,arguments)})},{key:"unsubscribe",value:(f=St(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}throw new vs({code:_s.INVALID_PARAMETER,message:"stream is undefined or null"});case 2:if(t.isRemote()){e.next=4;break}throw new vs({code:_s.INVALID_PARAMETER,message:"try to unsubscribe a local stream"});case 4:return this.log_.info("unsubscribe() => unsubscribe to [".concat(t.getUserId(),"] ").concat(t.getType()," stream")),n=t.getConnection(),e.prev=6,e.next=9,n.unsubscribe(t);case 9:this.subscriptionManager_&&this.subscriptionManager_.addUnsubscriptionRecord(t.getUserId(),t),sm.emit(cm.REMOTE_STREAM_UNSUBSCRIBED,{client:this,stream:t}),af({eventType:No}),e.next=18;break;case 14:throw e.prev=14,e.t0=e.catch(6),of({eventType:No,error:e.t0}),e.t0;case 18:case"end":return e.stop()}}),e,this,[[6,14]])}))),function(e){return f.apply(this,arguments)})},{key:"switchRole",value:(p=St(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("live"===this.mode_){e.next=2;break}throw new vs({code:_s.INVALID_PARAMETER,message:"role is only valid in live mode"});case 2:if("anchor"===t||"audience"===t){e.next=4;break}throw new vs({code:_s.INVALID_PARAMETER,message:"role could only be set to a value as ".concat("anchor"," or ").concat("audience")});case 4:if(this.isJoined_){e.next=6;break}throw new vs({code:_s.INVALID_OPERATION,message:"Please call join() before switchRole()"});case 6:if(this.role_!==t){e.next=8;break}return e.abrupt("return");case 8:if("audience"!==t||!this.localStream_){e.next=11;break}return e.next=11,this.unpublish(this.localStream_);case 11:return this.log_.info("switchRole() => switch role to: "+t),e.next=14,this.doSwitchRole(t);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"doSwitchRole",value:function(e){var t=this;return new Promise((function(n,r){var i={trtcscene:"live"===t.mode_?vo:_o,trtcrole:"anchor"===e?go:So};t.log_.info("switchRole signal data: "+JSON.stringify(i));var a=setTimeout((function(){t.log_.error("switchRole timeout observed"),t.signalChannel_.off(Qh.SWITCH_ROLE_RES,o),r(new vs({code:_s.SWITCH_ROLE_FAILED,message:"switchRole timeout"}))}),5e3),o=function(i){clearTimeout(a);var o=i.data.content,s=o.errCode,c=o.errMsg;0===s?(t.role_=e,n()):(t.log_.error("switchRole failed, errCode: ".concat(s,", errMsg: ").concat(c)),r(new vs({code:_s.SWITCH_ROLE_FAILED,message:"switchRole failed, errMsg: ".concat(c)})))};t.signalChannel_.once(Qh.SWITCH_ROLE_RES,o),t.signalChannel_.send(fp,i)}))}},{key:"on",value:function(e,t,n){this.emitter_.on(e,t,n)}},{key:"off",value:function(e,t,n){"*"===e?this.emitter_.removeAllListeners():this.emitter_.off(e,t,n)}},{key:"getRemoteMutedState",value:function(){var e=this,t=[];return this.mutedStates_.forEach((function(n,r,i){var a=e.connections_.get(r);a&&t.push(Et({userId:a.getUserId()},n))})),t}},{key:"getTransportStats",value:(h=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={rtt:0,downlinksRTT:{}},!this.uplinkConnection_){e.next=6;break}return e.next=4,this.stats_.getSenderStats(this.uplinkConnection_);case 4:n=e.sent,t.rtt=n.rtt;case 6:r=jt(this.connections_),e.prev=7,r.s();case 9:if((i=r.n()).done){e.next=17;break}return(a=Lt(i.value,2))[0],o=a[1],e.next=13,this.stats_.getReceiverStats(o);case 13:s=e.sent,t.downlinksRTT[s.userId]=s.rtt;case 15:e.next=9;break;case 17:e.next=22;break;case 19:e.prev=19,e.t0=e.catch(7),r.e(e.t0);case 22:return e.prev=22,r.f(),e.finish(22);case 25:return e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this,[[7,19,22,25]])}))),function(){return h.apply(this,arguments)})},{key:"getLocalAudioStats",value:(l=St(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t={})[this.userId_]={bytesSent:0,packetsSent:0},!this.uplinkConnection_){e.next=7;break}return e.next=5,this.stats_.getSenderStats(this.uplinkConnection_);case 5:n=e.sent,t[this.userId_]={bytesSent:n.audio.bytesSent,packetsSent:n.audio.packetsSent};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"getLocalVideoStats",value:(d=St(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((t={})[this.userId_]={bytesSent:0,packetsSent:0,framesEncoded:0,framesSent:0,frameWidth:0,frameHeight:0},!this.uplinkConnection_){e.next=7;break}return e.next=5,this.stats_.getSenderStats(this.uplinkConnection_);case 5:n=e.sent,t[this.userId_]={bytesSent:n.video.bytesSent,packetsSent:n.video.packetsSent,framesEncoded:n.video.framesEncoded,framesSent:n.video.framesSent,frameWidth:n.video.frameWidth,frameHeight:n.video.frameHeight};case 7:return e.abrupt("return",t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"getRemoteAudioStats",value:(u=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t={},n=jt(this.connections_),e.prev=2,n.s();case 4:if((r=n.n()).done){e.next=12;break}return(i=Lt(r.value,2))[0],a=i[1],e.next=8,this.stats_.getReceiverStats(a);case 8:(o=e.sent).hasAudio&&(t[o.userId]={bytesReceived:o.audio.bytesReceived,packetsReceived:o.audio.packetsReceived,packetsLost:o.audio.packetsLost});case 10:e.next=4;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(2),n.e(e.t0);case 17:return e.prev=17,n.f(),e.finish(17);case 20:return e.abrupt("return",t);case 21:case"end":return e.stop()}}),e,this,[[2,14,17,20]])}))),function(){return u.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(c=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o,s,c=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=c.length>0&&void 0!==c[0]?c[0]:"main",n={},r=jt(this.connections_),e.prev=3,r.s();case 5:if((i=r.n()).done){e.next=14;break}return(a=Lt(i.value,2))[0],o=a[1],e.next=9,this.stats_.getReceiverStats(o);case 9:s=e.sent,"main"===t&&s.hasVideo&&(n[s.userId]={bytesReceived:s.video.bytesReceived,packetsReceived:s.video.packetsReceived,packetsLost:s.video.packetsLost,framesDecoded:s.video.framesDecoded,frameWidth:s.video.frameWidth,frameHeight:s.video.frameHeight}),"auxiliary"===t&&s.hasAuxiliary&&(n[s.userId]={bytesReceived:s.auxiliary.bytesReceived,packetsReceived:s.auxiliary.packetsReceived,packetsLost:s.auxiliary.packetsLost,framesDecoded:s.auxiliary.framesDecoded,frameWidth:s.auxiliary.frameWidth,frameHeight:s.auxiliary.frameHeight});case 12:e.next=5;break;case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(3),r.e(e.t0);case 19:return e.prev=19,r.f(),e.finish(19);case 22:return e.abrupt("return",n);case 23:case"end":return e.stop()}}),e,this,[[3,16,19,22]])}))),function(){return c.apply(this,arguments)})},{key:"getSdpSemantics",value:function(){return this.sdpSemantics_}},{key:"getIceServers",value:function(){return this.turnServers_}},{key:"getConnections",value:function(){return this.connections_}},{key:"getMutedStates",value:function(){return this.mutedStates_}},{key:"startHeartbeat",value:function(){if(-1===this.heartbeat_){this.log_.info("startHeartbeat..."),this.heartbeat_=yd.setInterval(this.doHeartbeat.bind(this),2e3)}}},{key:"stopHeartbeat",value:function(){-1!==this.heartbeat_&&(this.log_.info("stopHeartbeat"),yd.clearInterval(this.heartbeat_),this.heartbeat_=-1)}},{key:"doHeartbeat",value:(s=St(regeneratorRuntime.mark((function e(){var t,n,r,i,a,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.badCaseDetector_.getMonitorFreeze(),e.next=3,this.stats_.getStatsReport({uplinkConnection:this.uplinkConnection_,downlinkConnections:this.connections_,freezeMap:t});case 3:if(n=e.sent,sm.emit(cm.HEARTBEAT_STATS,{client:this,stats:n}),this.badCaseDetector_.resetMonitor(),this.signalChannel_){e.next=8;break}return e.abrupt("return");case 8:r=this.signalChannel_.isConnected()?Xp(this.userId_):[],i={WebRTCQualityReq:n,eventList:r,sdkAppId:this.sdkAppId_,tinyid:this.tinyId_,roomid:this.roomId_,socketid:this.signalInfo_.socketId,clientip:this.signalInfo_.localIp,serverip:this.signalInfo_.relayIp,cpunumber:navigator.hardwareConcurrency||0,cpudevice:navigator.platform,devicename:navigator.platform,ostype:navigator.platform,mode:this.localStream_?this.localStream_.getScreen()?"screen":"video":""},a=0,this.localStream_&&this.localStream_.getMediaStream()&&(o=this.localStream_.getMediaStream().getAudioTracks(),a=o.length>0&&o[0].muted?3:1),i.WebRTCQualityReq.AudioReportState.uint32_microphone_status=a,this.signalChannel_.send($h,i);case 14:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"onRemoteStreamAdded",value:function(e){var t=e.content,n=t.srcopenid,r=t.srctinyid;if(null!==n){"live"!==this.mode_||"audience"!==this.role_||this.userMap_.has(n)||(this.userMap_.set(n,new Km({userId:n,tinyId:r,role:"anchor"})),this.emitter_.emit(Gf,{userId:n}));var i=this.connections_.get(r);if(i){if(i.getIsReconnecting())return;this.log_.warn("duplicated stream-added observed, rebuild the connection"),i.close(),this.connections_.delete(r)}var a={audio:t.audio,video:t.bigVideo,auxiliary:t.auxVideo};this.log_.info("remote peer [".concat(n,"] published stream. trackState: ").concat(JSON.stringify(a))),this.createDownlinkConnection({userId:n,tinyId:r,trackState:a})}else this.log_.warn("received null userId on stream added")}},{key:"createDownlinkConnection",value:function(e){var t=e.userId,n=e.tinyId,r=e.trackState,i=new Jm({userId:t,tinyId:n,client:this,isUplink:!1,signalChannel:this.signalChannel_,autoSubscribe:this.autoSubscribe_,trackState:r});if(this.connections_.set(n,i),this.installDownlinkEvents(i,t,n),this.autoSubscribe_)i.initialize(),i.exchangeSDP();else{if(r.audio||r.video){var a=new Em({type:"main",userId:t,client:this});a.setConnection(i),i.setRemoteStream(yo,a),a.setIsStreamAddedEventEmitted(!0),sm.emit(cm.REMOTE_STREAM_ADDED,{client:this,stream:a}),this.emitter_.emit(jf,{stream:a})}if(r.auxiliary){var o=new Em({type:"auxiliary",userId:t,client:this});o.setConnection(i),i.setRemoteStream(bo,o),o.setIsStreamAddedEventEmitted(!0),sm.emit(cm.REMOTE_STREAM_ADDED,{client:this,stream:o}),this.emitter_.emit(jf,{stream:o})}}}},{key:"installDownlinkEvents",value:function(e,t,n){var r=this;e.on(Mf,(function(e){e.stream.setIsStreamAddedEventEmitted(!0),sm.emit(cm.REMOTE_STREAM_ADDED,{client:r,stream:e.stream}),r.emitter_.emit(jf,{stream:e.stream})})),e.on(Of,(function(e){e.stream.setIsStreamAddedEventEmitted(!1),r.subscriptionManager_&&r.subscriptionManager_.deleteAutoRecoveryFlag(e.stream.getUserId(),e.stream.getType()),sm.emit(cm.REMOTE_STREAM_REMOVED,{client:r,stream:e.stream}),r.emitter_.emit(Ff,{stream:e.stream})})),e.on(Lf,(function(e){sm.emit(cm.REMOTE_STREAM_UPDATED,{client:r,stream:e.stream}),r.emitter_.emit(Bf,{stream:e.stream})})),e.on(Nf,(function(e){sm.emit(cm.REMOTE_STREAM_SUBSCRIBED,{client:r,stream:e.stream}),r.emitter_.emit(Jf,{stream:e.stream})})),e.on(Uf,(function(e){var t=e.getCode();t!==_s.ICE_TRANSPORT_ERROR&&(t===_s.DOWNLINK_RECONNECTION_FAILED&&r.closeDownLink(n),r.emitter_.emit(Zf,e))}))}},{key:"onRemoteStreamRemoved",value:function(e){var t=e.content,n=t.srctinyid,r=t.srcopenid,i=this.connections_.get(n);i&&(void 0===r&&(r=i.getUserId()),this.log_.info("remote peer [".concat(r,"] unpublished stream")),this.closeDownLink(n))}},{key:"onPeerJoin",value:function(e){var t=e.data.content,n=t.srctinyid,r=t.userid,i=t.role;this.userMap_.has(r)||(this.userMap_.set(r,new Km({userId:r,tinyId:n,role:i})),this.emitter_.emit(Gf,{userId:r}))}},{key:"onPeerLeave",value:function(e){var t=e.data.content,n=t.srctinyid,r=t.userid;this.log_.info("peer leave [".concat(r,"]")),this.cleanUser({userId:r,tinyId:n})}},{key:"cleanUser",value:function(e){var t=e.userId,n=e.tinyId;this.userMap_.delete(t),this.closeDownLink(n),this.emitter_.emit(zf,{userId:t})}},{key:"onPublishedUserList",value:function(e){var t=this;try{var n=e.content.userlist.map((function(e){return e.userid}));this.connections_.forEach((function(e){var r=e.getUserId(),i=e.getTinyId();n.findIndex((function(e){return e===r}))<0&&(t.log_.info("peer unpublished detected [".concat(r,"]")),t.closeDownLink(i))})),e.content.userlist.forEach((function(e){var n=e.userid,r=e.srctinyid,i=e.flag;if(n!==t.userId_&&t.connections_.has(r)){var a=1&i,o=8&i,s=4&i,c=t.connections_.get(r).getTrackState(),u=c.audio,d=c.video,l=c.auxiliary;!d&&a&&sm.emit(cm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ds,kind:cs}),!u&&o&&sm.emit(cm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ds,kind:ss}),!l&&s&&sm.emit(cm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ds,kind:us}),d&&!a&&sm.emit(cm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ls,kind:cs}),u&&!o&&sm.emit(cm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ls,kind:ss}),l&&!s&&sm.emit(cm.REMOTE_STREAM_TRACK_UPDATED,{client:t,tinyId:r,userId:n,action:ls,kind:us})}}))}catch(T_){}}},{key:"onUpdateRemoteMuteStat",value:function(e){var t=this,n=e.content;n.userlist.forEach((function(e){var n=e.srctinyid,r=e.userid;if(0!==n&&n!==t.tinyId_){var i=t.connections_.get(n);if(i){var a=i.getMainStream();if(a&&a.getIsStreamAddedEventEmitted()){var o=!!(1&e.flag),s=!!(8&e.flag),c=!!(64&e.flag),u=!!(16&e.flag),d=t.mutedStates_.get(n);if(void 0===d)return t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,audioMuted:c,videoMuted:u}),o?u?t.emitter_.emit(Qf,{userId:r}):t.emitter_.emit(Kf,{userId:r}):t.emitter_.emit(Qf,{userId:r}),void(s?c?t.emitter_.emit(Wf,{userId:r}):t.emitter_.emit(qf,{userId:r}):t.emitter_.emit(Wf,{userId:r}));var l=!c&&s;(!d.audioMuted&&d.hasAudio)!==l&&(l?t.emitter_.emit(qf,{userId:r}):t.emitter_.emit(Wf,{userId:r}));var h=!u&&o;(!d.videoMuted&&d.hasVideo)!==h&&(h?t.emitter_.emit(Kf,{userId:r}):t.emitter_.emit(Qf,{userId:r})),t.mutedStates_.set(n,{hasAudio:s,hasVideo:o,audioMuted:c,videoMuted:u})}}else t.mutedStates_.delete(n)}}))}},{key:"onClientBanned",value:function(e){this.emitter_.emit(Yf,new vs({code:_s.CLIENT_BANNED,message:"client was banned because of "+e}))}},{key:"getEnv",value:function(){return this.env_}},{key:"getSubscriptionManager",value:function(){return this.subscriptionManager_}},{key:"startPublishCDNStream",value:(o=St(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.localStream_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"please call publish() before startPublishCDNStream()"});case 2:if(Cs(t.streamId)||Is(t.streamId)){e.next=4;break}throw new vs({code:_s.INVALID_PARAMETER,message:"option.streamId must be valid string or undefined"});case 4:return this.log_.info("startPublishCDNStream params: ".concat(JSON.stringify(t))),e.prev=5,e.next=8,this.publishCDNManager_.startPublishTencentCDN(t.streamId);case 8:if(!(t.appId&&t.bizId&&t.url)){e.next=11;break}return e.next=11,this.publishCDNManager_.startPublishGivenCDN(t);case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new vs({code:_s.START_PUBLISH_CDN_FAILED,message:"startPublishCDNStream failed, errMsg: ".concat(e.t0.message)});case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return o.apply(this,arguments)})},{key:"stopPublishCDNStream",value:(a=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.publishCDNManager_.getIsPublishingTencentCDN()){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"please call startPublishCDNStream() before stopPublishCDNStream()"});case 2:return this.log_.info("stopPublishCDNStream"),e.prev=3,e.next=6,this.publishCDNManager_.stopPublishTencentCDN();case 6:if(!this.publishCDNManager_.getIsPublishingGivenCDN()){e.next=9;break}return e.next=9,this.publishCDNManager_.stopPublishGivenCDN();case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(3),new vs({code:_s.STOP_PUBLISH_CDN_FAILED,message:"stopPublishCDNStream failed, errMsg: ".concat(e.t0.message)});case 14:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(){return a.apply(this,arguments)})},{key:"startMixTranscode",value:(i=St(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"please call startMixTranscode() after join()"});case 2:return Cs(t.mode)&&(t.mode=es.MANUAL),e.prev=3,this.log_.info("startMixTranscode with config ".concat(JSON.stringify(t))),tf("mix-transcode-mode:".concat(t.mode)),e.next=8,this.mixTranscodeManager_.startMixTranscode(t);case 8:af({eventType:Ko}),e.next=15;break;case 11:throw e.prev=11,e.t0=e.catch(3),of({eventType:Ko,error:e.t0}),e.t0;case 15:case"end":return e.stop()}}),e,this,[[3,11]])}))),function(e){return i.apply(this,arguments)})},{key:"stopMixTranscode",value:(r=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isJoined_&&this.mixTranscodeManager_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"please call startMixTranscode() after join()"});case 2:return e.prev=2,e.next=5,this.mixTranscodeManager_.stopMixTranscode();case 5:af({eventType:Yo}),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(2),of({eventType:Yo,error:e.t0}),e.t0;case 12:case"end":return e.stop()}}),e,this,[[2,8]])}))),function(){return r.apply(this,arguments)})},{key:"getSystemResult",value:function(){return this.checkSystemResult_}},{key:"enableAudioVolumeEvaluation",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e3,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!ws(t))throw new vs({code:_s.INVALID_PARAMETER,message:"parameter must be numeric type"});if(this.log_.info("enableAudioVolumeEvaluation with interval: "+t),t<=0)return this.enableAudioVolumeEvaluation_=!1,yd.clearInterval(this.audioVolumeIntervalId_),void(this.audioVolumeIntervalId_=null);t=Math.floor(Math.max(t,16)),this.audioVolumeIntervalId_&&(yd.clearInterval(this.audioVolumeIntervalId_),this.audioVolumeIntervalId_=null),this.enableAudioVolumeEvaluation_=!0,this.audioVolumeIntervalId_=yd.setInterval((function(){var t=[];if(e.localStream_){var n=Math.floor(100*e.localStream_.getAudioLevel());t.push({userId:e.userId_,audioVolume:n,stream:e.localStream_})}e.connections_.forEach((function(e){var n=e.getSubscribedMainStream();if(n){var r=Math.floor(100*n.getAudioLevel());t.push({userId:e.getUserId(),audioVolume:r,stream:n})}})),e.emitter_.emit(Xf,{result:t})}),t,n)}},{key:"uploadAllCallStats",value:function(){var e=this;this.callDurationCalculator_.getDurationMap().forEach((function(t,n){var r={userId:t.userId,type:t.type,duration:e.callDurationCalculator_.getDuration(n,"video"),dataFreeze:e.badCaseDetector_.getDataFreezeDuration(n).dataFreeze,renderFreeze:e.badCaseDetector_.getRenderFreezeDuration(n).renderFreeze};tf("callStats-"+JSON.stringify(r))})),this.badCaseDetector_.stop(),this.callDurationCalculator_.reset()}},{key:"enableSmallStream",value:(n=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"Cannot enable small stream after localStream published."});case 2:if(!Df()){e.next=7;break}this.setIsEnableSmallStream(!0),this.log_.info("SmallStream successfully enabled"),e.next=8;break;case 7:throw new vs({code:_s.INVALID_OPERATION,message:"Your browser does not support opening small stream"});case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"disableSmallStream",value:(t=St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isPublished()&&!this.isPublishing_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"Cannot enable small stream after having published."});case 2:this.setIsEnableSmallStream(!1),this.log_.info("SmallStream successfully disabled");case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"setSmallStreamProfile",value:function(e){var t=this;Object.keys(this.smallStreamConfig_).forEach((function(n){e[n]&&(t.smallStreamConfig_[n]=e[n])})),this.log_.info("setSmallStreamProfile: bitrate=".concat(this.smallStreamConfig_.bitrate,", framerate=").concat(this.smallStreamConfig_.framerate,", height=").concat(this.smallStreamConfig_.height,", width=").concat(this.smallStreamConfig_.width));var n=this.smallStreamConfig_,r=n.width,i=n.height,a=n.bitrate,o=n.framerate;if(r<0||i<0||a<0||o<0)throw new vs({code:_s.INVALID_PARAMETER,message:"Small stream profile is invalid."})}},{key:"setRemoteVideoStreamType",value:function(e,t){switch(this.log_.info("setRemoteVideoStreamType: streamType=".concat(e.getType(),", set ").concat(t)),t){case"big":case"small":this.changeVideoType(e,t)}}},{key:"changeVideoType",value:function(e,t){if(!(e instanceof Em))throw new vs({code:_s.INVALID_PARAMETER,message:"remoteStream is invalid"});this.log_.info("change video type: streamType=".concat(e.getType(),", set ").concat(t));var n=e.getConnection().getTinyId(),r=1;"big"===t&&(r=0),this.signalChannel_.send(mp,{type:r,srctinyid:n})}},{key:"setIsEnableSmallStream",value:function(e){this.isEnableSmallStream_=e}},{key:"getIsEnableSmallStream",value:function(){return this.isEnableSmallStream_}},{key:"isPublished",value:function(){return!!this.localStream_}},{key:"getUplinkConnection",value:function(){return this.uplinkConnection_}},{key:"getLocalStream",value:function(){return this.localStream_}},{key:"getMode",value:function(){return this.mode_}},{key:"getBadCaseDetector",value:function(){return this.badCaseDetector_}},{key:"getCallDurationCalculator",value:function(){return this.callDurationCalculator_}},{key:"smallStreamConfig",get:function(){return this.smallStreamConfig_}}]),e}(),h_=Ym({retryFunction:function(){var e=St(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Rf()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,p_(t);case 4:if(n=e.sent,Os.info("getUserMedia with constraints: "+JSON.stringify(n)),!n.audio){e.next=13;break}return e.next=9,k_.getMicrophones();case 9:if(r=e.sent,Os.info("microphones: ".concat(JSON.stringify(r))),0!==r.length){e.next=13;break}throw new vs({code:_s.DEVICE_NOT_FOUND,message:"no microphone detected, but you are trying to get audio stream, please check your microphone and the configeration on TRTC.createStream."});case 13:if(!n.video){e.next=20;break}return e.next=16,k_.getCameras();case 16:if(i=e.sent,Os.info("cameras: ".concat(JSON.stringify(i))),0!==i.length){e.next=20;break}throw new vs({code:_s.DEVICE_NOT_FOUND,message:"no camera detected, but you are trying to get video stream, please check your camera and the configeration on TRTC.createStream."});case 20:return e.next=22,navigator.mediaDevices.getUserMedia(n);case 22:return e.abrupt("return",e.sent);case 23:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),settings:{retries:3,timeout:500},onError:function(e,t,n){"NotReadableError"===e.name?t():n(e)},onRetrying:function(e){Os.warn("getUserMedia NotReadableError observed, retrying [".concat(e,"/3]"))}});function p_(e){return f_.apply(this,arguments)}function f_(){return(f_=St(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={echoCancellation:t.echoCancellation,autoGainControl:t.autoGainControl,noiseSuppression:t.noiseSuppression},t.audio){e.next=5;break}n=!1,e.next=15;break;case 5:if(cf(t.microphoneId)){e.next=9;break}n=Et({deviceId:{exact:t.microphoneId},sampleRate:t.sampleRate,channelCount:t.channelCount},n),e.next=15;break;case 9:return n=Et({sampleRate:t.sampleRate,channelCount:t.channelCount},n),e.next=12,k_.getMicrophones();case 12:r=e.sent,(i=r.filter((function(e){var t=e.deviceId;return t.length>0&&"default"!==t}))).length>0&&(n.deviceId={exact:i[0].deviceId});case 15:return a={},a=!Cs(t.facingMode)&&t.video?{facingMode:t.facingMode,width:t.width,height:t.height,frameRate:t.frameRate}:!cf(t.cameraId)&&t.video?{deviceId:{exact:t.cameraId},width:t.width,height:t.height,frameRate:t.frameRate}:!!t.video&&(!!Cs(t.width)||{width:t.width,height:t.height,frameRate:t.frameRate}),e.abrupt("return",{audio:n,video:a});case 18:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var m_=function(){var e=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Rf()){e.next=2;break}return e.abrupt("return");case 2:if(n=null,!(to&&no<74||io)){e.next=27;break}return r=v_(t),Os.info("getDisplayMedia with constraints: "+JSON.stringify(r)),e.next=8,navigator.mediaDevices.getDisplayMedia(r);case 8:if(i=e.sent,!t.screenAudio){e.next=14;break}return Os.warn("Your browser not support capture system audio"),e.abrupt("return",i);case 14:if(!t.audio){e.next=24;break}return a=__(t),Os.info("getUserMedia with constraints: "+JSON.stringify(a)),e.next=19,navigator.mediaDevices.getUserMedia(a);case 19:return n=e.sent,i.addTrack(n.getAudioTracks()[0]),e.abrupt("return",i);case 24:return e.abrupt("return",i);case 25:e.next=53;break;case 27:if(!t.screenAudio){e.next=37;break}return t.audioConstraints={echoCancellation:!0,noiseSuppression:!0,sampleRate:44100},o=v_(t),Os.info("getDisplayMedia with constraints: "+JSON.stringify(o)),e.next=33,navigator.mediaDevices.getDisplayMedia(o);case 33:return s=e.sent,e.abrupt("return",s);case 37:return c=v_(t),Os.info("getDisplayMedia with constraints: "+JSON.stringify(c)),e.next=41,navigator.mediaDevices.getDisplayMedia(c);case 41:if(u=e.sent,!t.audio){e.next=52;break}return d=__(t),Os.info("getUserMedia with constraints: "+JSON.stringify(d)),e.next=47,navigator.mediaDevices.getUserMedia(d);case 47:return n=e.sent,u.addTrack(n.getAudioTracks()[0]),e.abrupt("return",u);case 52:return e.abrupt("return",u);case 53:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function __(e){var t={echoCancellation:e.echoCancellation,autoGainControl:e.autoGainControl,noiseSuppression:e.noiseSuppression,sampleRate:e.sampleRate,channelCount:e.channelCount};return Cs(e.microphoneId)||(t.deviceId={exact:e.microphoneId}),{audio:t,video:!1}}function v_(e){var t={},n={width:e.width,height:e.height,frameRate:e.frameRate};return Cs(e.screenSource)||(n.displaySurface=e.screenSource),t.video=n,Cs(e.audioConstraints)||(t.audio=e.audioConstraints),t}var g_=new Map;g_.set("120p",{width:160,height:120,frameRate:15,bitrate:200}),g_.set("180p",{width:320,height:180,frameRate:15,bitrate:350}),g_.set("240p",{width:320,height:240,frameRate:15,bitrate:400}),g_.set("360p",{width:640,height:360,frameRate:15,bitrate:800}),g_.set("480p",{width:640,height:480,frameRate:15,bitrate:900}),g_.set("720p",{width:1280,height:720,frameRate:15,bitrate:1500}),g_.set("1080p",{width:1920,height:1080,frameRate:15,bitrate:2e3}),g_.set("1440p",{width:2560,height:1440,frameRate:30,bitrate:4860}),g_.set("4K",{width:3840,height:2160,frameRate:30,bitrate:9e3});var S_=new Map;S_.set("480p",{width:640,height:480,frameRate:5,bitrate:900}),S_.set("480p_2",{width:640,height:480,frameRate:30,bitrate:1e3}),S_.set("720p",{width:1280,height:720,frameRate:5,bitrate:1200}),S_.set("720p_2",{width:1280,height:720,frameRate:30,bitrate:3e3}),S_.set("1080p",{width:1920,height:1080,frameRate:5,bitrate:1600}),S_.set("1080p_2",{width:1920,height:1080,frameRate:30,bitrate:4e3});var y_=new Map;y_.set("standard",{sampleRate:48e3,channelCount:1,bitrate:40}),y_.set("standard-stereo",{sampleRate:48e3,channelCount:2,bitrate:64}),y_.set("high",{sampleRate:48e3,channelCount:1,bitrate:192}),y_.set("high-stereo",{sampleRate:48e3,channelCount:2,bitrate:192});var b_=function(e){Ct(u,e);var t,n,r,i,a,o,s,c=Mt(u);function u(e){var t;yt(this,u);var n=Et(Et({},e),{isRemote:!1,type:"local"});return e.screen&&(n.mirror=!1),(t=c.call(this,n)).video_=e.video,t.audio_=e.audio,t.cameraId_=e.cameraId,t.cameraGroupId_="",t.facingMode_=e.facingMode,t.microphoneId_=e.microphoneId,t.microphoneGroupId_="",t.videoSource_=e.videoSource,t.audioSource_=e.audioSource,t.screen_=e.screen,t.screenSource_=e.screenSource,t.screenAudio_=e.screenAudio,t.audioProfile_={echoCancellation:!!Cs(e.echoCancellation)||e.echoCancellation,autoGainControl:!!Cs(e.autoGainControl)||e.autoGainControl,noiseSuppression:!!Cs(e.noiseSuppression)||e.noiseSuppression,sampleRate:48e3,channelCount:1,bitrate:40},t.videoProfile_={width:640,height:480,frameRate:15,bitrate:900},t.screenProfile_={width:1920,height:1080,frameRate:5,bitrate:1600},t.videoBitrate_=t.screen_?1600:900,t.videoSetting_=null,t.mutedFlag_=0,t.initState(),t.installEvents(),t}return kt(u,[{key:"initState",value:function(){this.isAddingTrack_=!1,this.isRemovingTrack_=!1,this.setIsReadyToPublish(!1),this.setPublishState(ps)}},{key:"installEvents",value:function(){sm.on(cm.LOCAL_STREAM_PUBLISHED,this.onStreamPublished,this)}},{key:"uninstallEvents",value:function(){sm.off(cm.LOCAL_STREAM_PUBLISHED,this.onStreamPublished,this)}},{key:"initialize",value:function(){var e=this;return new Promise((function(t,n){if(Ef())n(new vs({code:_s.INVALID_OPERATION,message:"not supported in http protocol, please use https protocol"}));else{if(Cs(e.audio_)){var r=new MediaStream;return Cs(e.audioSource_)||(r.addTrack(e.audioSource_),e.updateAudioPlayingState(!0)),Cs(e.videoSource_)||(r.addTrack(e.videoSource_),e.updateVideoPlayingState(!0)),e.setMediaStream(r),af({eventType:Go,kind:"custom"}),e.setIsReadyToPublish(!0),t()}e.screen_?(e.log_.info("initialize stream audio: "+e.audio_+" screenAudio: "+e.screenAudio_+" screen: "+e.screen_),m_({audio:e.audio_,screenAudio:e.screenAudio_,microphoneId:e.microphoneId_,screenSource:e.screenSource_,width:e.screenProfile_.width,height:e.screenProfile_.height,frameRate:e.screenProfile_.frameRate,sampleRate:e.audioProfile_.sampleRate,channelCount:e.audioProfile_.channelCount,autoGainControl:e.audioProfile_.autoGainControl,noiseSuppression:e.audioProfile_.noiseSuppression,echoCancellation:e.audioProfile_.echoCancellation}).then((function(n){return e.setMediaStream(n),e.updateAudioPlayingState(e.audio_||e.screenAudio_),e.updateVideoPlayingState(!0),e.listenForScreenSharingStopped(e.getVideoTrack()),e.setVideoContentHint("detail"),e.updateDeviceIdInUse(),e.setIsReadyToPublish(!0),af({eventType:Go,kind:"getDisplayMedia"}),t()})).catch((function(t){of({eventType:Go,kind:"getDisplayMedia",error:t}),e.log_.error("getDisplayMedia error observed "+t),n(t)}))):(sm.emit(cm.LOCAL_STREAM_INITIALIZE_START,{stream:e,audio:e.audio_,video:e.video_}),e.log_.info("initialize stream audio: "+e.audio_+" video: "+e.video_),h_({audio:e.audio_,video:e.video_,facingMode:e.facingMode_,cameraId:e.cameraId_,microphoneId:e.microphoneId_,width:e.videoProfile_.width,height:e.videoProfile_.height,frameRate:e.videoProfile_.frameRate,sampleRate:e.audioProfile_.sampleRate,channelCount:e.audioProfile_.channelCount,autoGainControl:e.audioProfile_.autoGainControl,noiseSuppression:e.audioProfile_.noiseSuppression,echoCancellation:e.audioProfile_.echoCancellation}).then((function(n){return sm.emit(cm.LOCAL_STREAM_INITIALIZE_END,{stream:e,audio:e.audio_,video:e.video_}),"getSettings"in MediaStreamTrack.prototype&&(e.videoSetting_=n.getVideoTracks().length>0&&n.getVideoTracks()[0].getSettings()),e.setMediaStream(n),e.updateAudioPlayingState(e.audio_),e.updateVideoPlayingState(e.video_),e.updateDeviceIdInUse(),e.log_.debug("gotStream hasAudio: "+e.hasAudio()+" hasVideo: "+e.hasVideo()),e.setIsReadyToPublish(!0),af({eventType:Go,kind:"getUserMedia"}),t()})).catch((function(t){sm.emit(cm.LOCAL_STREAM_INITIALIZE_FAILED,{stream:e,audio:e.audio_,video:e.video_,error:t}),of({eventType:Go,kind:"getUserMedia",error:t}),e.log_.error("getUserMedia error observed "+t),n(t)})))}}))}},{key:"listenForScreenSharingStopped",value:function(e){var t=this;e.addEventListener("ended",(function(e){t.log_.info("screen sharing was stopped because the video track is ended"),t.emitter_.emit(tm)}))}},{key:"muteAudio",value:function(){var e=Ot(It(u.prototype),"muteAudio",this).call(this);return e&&(this.log_.info("localStream mute audio"),this.sendMutedFlag(ss,!0)),e}},{key:"muteVideo",value:function(){var e=Ot(It(u.prototype),"muteVideo",this).call(this);return e&&(this.log_.info("localStream mute video"),this.sendMutedFlag(cs,!0)),e}},{key:"unmuteAudio",value:function(){var e=Ot(It(u.prototype),"unmuteAudio",this).call(this);return e&&(this.log_.info("localStream unmute audio"),this.sendMutedFlag(ss,!1)),e}},{key:"unmuteVideo",value:function(){var e=Ot(It(u.prototype),"unmuteVideo",this).call(this);return e&&(this.log_.info("localStream unmute video"),this.sendMutedFlag(cs,!1)),e}},{key:"sendMutedFlag",value:function(e,t){this.setMutedFlag(e,t);var n=this.getConnection();if(n){n.sendMutedFlag(this.mutedFlag_);var r=n.getUserId(),i=n.getTinyId(),a="".concat(t?"mute":"unmute"," local ").concat(e," track");$p(r,{eventId:e===ss?t?yp:kp:t?bp:Tp,eventDesc:a,timestamp:kd(),userId:r,tinyId:i})}}},{key:"setMutedFlag",value:function(e,t){e===ss?t?this.mutedFlag_|=4:this.mutedFlag_&=-5:t?this.mutedFlag_|=1:this.mutedFlag_&=-2,this.log_.info("set ".concat(e," muted state: [").concat(t?"mute":"unmute","]"))}},{key:"setAudioProfile",value:function(e){var t;"object"===vt(e)?t=e:void 0===(t=y_.get(e))&&(t=y_.get("standard")),this.log_.info("setAudioProfile: "+JSON.stringify(t)),this.audioProfile_=Et(Et({},this.audioProfile_),t)}},{key:"setVideoProfile",value:(s=St(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connection_||Tf()){e.next=2;break}throw new vs({code:_s.NOT_SUPPORTED,message:"not supported on current browser"});case 2:if(Ts(t)?n=Et(Et({},this.videoProfile_),t):Is(t)&&(n=g_.get(t),Cs(n)&&(n=g_.get("480p"))),this.log_.info("setVideoProfile "+JSON.stringify(n)),!(r=this.getVideoTrack())){e.next=8;break}return e.next=8,r.applyConstraints(n);case 8:if(this.videoBitrate_===n.bitrate){e.next=13;break}if(!this.connection_){e.next=12;break}return e.next=12,this.connection_.setBandwidth(n.bitrate,"video");case 12:this.videoBitrate_=n.bitrate;case 13:this.videoProfile_=n;case 14:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getVideoBitrate",value:function(){return this.videoBitrate_}},{key:"getAudioBitrate",value:function(){return this.audioProfile_.bitrate}},{key:"setScreenProfile",value:function(e){var t=e;"object"!==vt(e)&&void 0===(t=S_.get(e))&&(t=S_.get("1080p")),this.log_.info("setScreenProfile "+JSON.stringify(e)),this.screenProfile_=t,this.videoBitrate_=t.bitrate}},{key:"getVideoProfile",value:function(){return this.screen_?this.screenProfile_:this.videoProfile_}},{key:"getAudioProfile",value:function(){return this.audioProfile_}},{key:"setVideoContentHint",value:function(e){var t=this.getVideoTrack();t&&"contentHint"in t&&(this.log_.info("set video track contentHint to: "+e),t.contentHint=e,t.contentHint!==e&&this.log_.warn("Invalid video track contentHint: "+e))}},{key:"switchDevice",value:(o=St(regeneratorRuntime.mark((function e(t,n){var r,i,a,o,s,c,u,d,l,h,p,f,m,_,v,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.screen_||this.audioSource_||this.videoSource_)){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot switch device on current stream"});case 2:if(this.publishState_!==fs){e.next=4;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot switch device when publishing localStream"});case 4:if(!("audio"===t&&this.microphoneId_===n||"video"===t&&this.cameraId_===n)){e.next=6;break}return e.abrupt("return");case 6:if("audio"===t&&(this.microphoneId_=n,this.audio_||(this.audio_=!0)),"video"===t&&("user"===n||"environment"===n?this.facingMode_=n:this.cameraId_=n,this.video_||(this.video_=!0)),this.getMediaStream()){e.next=10;break}return e.abrupt("return");case 10:return this.setIsReadyToPublish(!1),this.log_.info("switchDevice "+t+" to: "+n),"video"===t&&(ha||la||fa)&&((r=this.getVideoTrack())&&r.stop(),Wa&&(i=this.getAudioTrack())&&(this.log_.info("stop audio track first in huawei env"),i.stop())),"audio"===t&&fa&&(a=this.getAudioTrack(),o=this.getMicrophoneTrackMixed(),a&&a.stop(),o&&o.stop()),e.next=16,h_({audio:this.audio_&&"audio"===t||Wa,video:this.video_&&"video"===t,facingMode:"user"===n||"environment"===n?n:void 0,cameraId:this.cameraId_,microphoneId:this.microphoneId_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount});case 16:if(s=e.sent,c=null,"audio"!==t){e.next=23;break}(u=s.getAudioTracks()[0])&&this.isAudioTrackMixed()?(d=this.getAudioTrack(),l=k_.AudioMixerPlugin.getAudioTrackMap(),h=k_.AudioMixerPlugin.mix({targetTrack:u,sourceList:l.get(d.id).sourceList}),c=h):c=u,e.next=29;break;case 23:if((c=s.getVideoTracks()[0])&&this.isVideoTrackBeautified()&&(c=this.generateBeautyTrack(c)),!(p=s.getAudioTracks()[0])||!Wa){e.next=29;break}return e.next=29,this.replaceTrack_(p);case 29:return e.next=31,this.replaceTrack_(c);case 31:this.updateDeviceIdInUse(),(f=this.getConnection())&&(m=f.getUserId(),_=f.getTinyId(),v=Ip,g="switch camera","audio"===t&&(v=wp,g="switch microphone"),$p(m,{eventId:v,eventDesc:g,timestamp:kd(),userId:m,tinyId:_})),this.log_.info("switch ".concat("audio"===t?"microphone":"camera"," success ")),this.setIsReadyToPublish(!0);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"addTrack",value:(a=St(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isAddingTrack_){e.next=2;break}throw new vs({code:_s.INVALID_OPERATION,message:"previous addTrack is ongoing, please avoid repetitive execution"});case 2:if(!this.isRemovingTrack_){e.next=4;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot add track when a track is removing"});case 4:if(this.publishState_!==fs){e.next=6;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot add track when publishing localStream"});case 6:if(n=this.getMediaStream()){e.next=9;break}throw new vs({code:_s.INVALID_OPERATION,message:"the local stream is not initialized yet"});case 9:if(!("audio"===t.kind&&n.getAudioTracks().length>0||"video"===t.kind&&n.getVideoTracks().length>0)){e.next=11;break}throw new vs({code:_s.INVALID_OPERATION,message:"A Stream has at most one audio track and one video track"});case 11:if("video"===t.kind&&"getSettings"in MediaStreamTrack.prototype&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),e.prev=12,this.isAddingTrack_=!0,!(i=this.getConnection())){e.next=18;break}return e.next=18,i.addTrack(t);case 18:n.addTrack(t),"audio"===t.kind?(this.audio_=!0,this.updateAudioPlayingState(!0)):(this.video_=!0,this.updateVideoPlayingState(!0)),this.isAddingTrack_=!1,e.next=27;break;case 23:throw e.prev=23,e.t0=e.catch(12),this.isAddingTrack_=!1,e.t0;case 27:case"end":return e.stop()}}),e,this,[[12,23]])}))),function(e){return a.apply(this,arguments)})},{key:"removeTrack",value:(i=St(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("audio"!==t.kind){e.next=2;break}throw new vs({code:_s.INVALID_PARAMETER,message:"remove audio track is not supported"});case 2:if(!this.isAddingTrack_){e.next=4;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot remove track when a track is adding"});case 4:if(!this.isRemovingTrack_){e.next=6;break}throw new vs({code:_s.INVALID_OPERATION,message:"previous removeTrack is ongoing, please avoid repetitive execution"});case 6:if(this.publishState_!==fs){e.next=8;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot remove track when publishing localStream"});case 8:if(n=this.getMediaStream()){e.next=11;break}throw new vs({code:_s.INVALID_OPERATION,message:"the local stream is not initialized yet"});case 11:if(-1!==n.getTracks().indexOf(t)){e.next=13;break}throw new vs({code:_s.INVALID_PARAMETER,message:"the track to be removed is not being publishing"});case 13:if(1!==n.getTracks().length){e.next=15;break}throw new vs({code:_s.INVALID_OPERATION,message:"remove the only video track is not supported, please use replaceTrack or muteVideo"});case 15:if(e.prev=15,this.isRemovingTrack_=!0,!(r=this.getConnection())){e.next=21;break}return e.next=21,r.removeTrack(t);case 21:n.removeTrack(t),"audio"===t.kind?(this.audio_=!1,this.updateAudioPlayingState(!1)):(this.video_=!1,this.updateVideoPlayingState(!1)),this.isRemovingTrack_=!1,e.next=30;break;case 26:throw e.prev=26,e.t0=e.catch(15),this.isRemovingTrack_=!1,e.t0;case 30:case"end":return e.stop()}}),e,this,[[15,26]])}))),function(e){return i.apply(this,arguments)})},{key:"replaceTrack",value:(r=St(regeneratorRuntime.mark((function e(t){var n,r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.getMediaStream()){e.next=3;break}throw new vs({code:_s.INVALID_OPERATION,message:"the local stream is not initialized yet"});case 3:if(this.publishState_!==fs){e.next=5;break}throw new vs({code:_s.INVALID_OPERATION,message:"cannot replace track when publishing localStream"});case 5:if(!("audio"===t.kind&&n.getAudioTracks().length<=0||"video"===t.kind&&n.getVideoTracks().length<=0)){e.next=7;break}throw new vs({code:_s.INVALID_PARAMETER,message:"try to replace ".concat(t.kind," track but there's no previous ").concat(t.kind," being published")});case 7:if("video"===t.kind&&"getSettings"in MediaStreamTrack.prototype&&(r=t.getSettings(),!this.videoSetting_||r.width===this.videoSetting_.width&&r.height===this.videoSetting_.height||this.log_.warn("video resolution of the track (".concat(r.width," x ").concat(r.height,") shall be kept the same as the previous: ").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,". It may cause abnormal Cloud Recording."))),"audio"===t.kind?(n.removeTrack(n.getAudioTracks()[0]),n.addTrack(t),Ot(It(u.prototype),"restartAudio",this).call(this)):(n.removeTrack(n.getVideoTracks()[0]),n.addTrack(t),Ot(It(u.prototype),"restartVideo",this).call(this)),!(i=this.getConnection())){e.next=13;break}return e.next=13,i.replaceTrack(t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"updateStream",value:(n=St(regeneratorRuntime.mark((function e(t){var n,r,i,a,o,s,c,u,d,l,h,p,f,m,_,v,g;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mediaStream_){e.next=2;break}return e.abrupt("return");case 2:return this.log_.info("updateStream() try to recover local stream"),e.prev=3,e.next=6,k_.getCameras();case 6:return n=e.sent,e.next=9,k_.getMicrophones();case 9:if(r=e.sent,i=this.audio_&&t.audio,(a=this.video_&&t.video)&&0===n.length&&(a=!1,this.log_.info("updateStream() video flag is true, but no camera detected, set video to false")),i&&0===r.length&&(i=!1,this.log_.info("updateStream() audio flag is true, but no microphone detected, set audio to false")),!1!==i||!1!==a){e.next=17;break}return this.log_.info("updateStream() both audio and video are false, recover stream aborted"),e.abrupt("return");case 17:return o=this.mediaStream_.getAudioTracks().map((function(e){return e.enabled})).includes(!1),s=this.mediaStream_.getVideoTracks().map((function(e){return e.enabled})).includes(!1),c=t&&n.findIndex((function(e){return e.deviceId===t.cameraId}))>=0,u=t&&r.findIndex((function(e){return e.deviceId===t.microphoneId}))>=0,e.next=23,h_({audio:i,video:a,cameraId:c?t.cameraId:void 0,microphoneId:u?t.microphoneId:void 0,facingMode:this.facingMode_,width:this.videoProfile_.width,height:this.videoProfile_.height,frameRate:this.videoProfile_.frameRate,sampleRate:this.audioProfile_.sampleRate,channelCount:this.audioProfile_.channelCount});case 23:d=e.sent,l=d.getTracks(),h=0;case 26:if(!(h<l.length)){e.next=49;break}if("audio"!==(p=l[h]).kind||!this.isAudioTrackMixed()){e.next=39;break}if(f=this.getAudioTrack(),m=k_.AudioMixerPlugin.getAudioTrackMap(),(_=m.get(f.id)).hasMicrophone){e.next=35;break}return p.stop(),e.abrupt("continue",46);case 35:return v=k_.AudioMixerPlugin.mix({targetTrack:p,sourceList:_.sourceList}),e.next=38,this.replaceTrack_(v);case 38:return e.abrupt("continue",46);case 39:if("video"!==p.kind||!this.isVideoTrackBeautified()){e.next=44;break}return g=this.generateBeautyTrack(p),e.next=43,this.replaceTrack_(g);case 43:return e.abrupt("continue",46);case 44:return e.next=46,this.replaceTrack_(p);case 46:h++,e.next=26;break;case 49:o&&(this.log_.info("updateStream() prev audio tracks is muted, keep current audio tracks muted"),this.doEnableTrack("audio",!1)),s&&(this.log_.info("updateStream() prev video tracks is muted, keep current video tracks muted"),this.doEnableTrack("video",!1)),this.updateDeviceIdInUse(),af({eventType:Qo}),this.log_.info("updateStream() recover local stream successfully"),e.next=61;break;case 56:e.prev=56,e.t0=e.catch(3),of({eventType:Qo,error:e.t0}),this.log_.error("updateStream() failed to recover local stream, "+e.t0),this.emitter_.emit(rm,new vs({code:_s.DEVICE_AUTO_RECOVER_FAILED,message:e.t0.message}));case 61:case"end":return e.stop()}}),e,this,[[3,56]])}))),function(e){return n.apply(this,arguments)})},{key:"replaceTrack_",value:(t=St(regeneratorRuntime.mark((function e(t){var n,r,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.mediaStream_.getAudioTracks(),r=this.mediaStream_.getVideoTracks(),!("audio"===t.kind&&n.length<=0||"video"===t.kind&&r.length<=0)){e.next=5;break}return this.log_.info("there is no previous ".concat(t.kind," track, replacement ignored")),e.abrupt("return");case 5:if("audio"===t.kind?(this.mediaStream_.removeTrack(n[0]),this.mediaStream_.addTrack(t),Ot(It(u.prototype),"restartAudio",this).call(this)):("getSettings"in MediaStreamTrack.prototype&&(i=t.getSettings(),!this.videoSetting_||i.width===this.videoSetting_.width&&i.height===this.videoSetting_.height||this.log_.warn("the resolution of video track to be replaced (".concat(i.width," x ").concat(i.height,") is different from the previous video settings (").concat(this.videoSetting_.width," x ").concat(this.videoSetting_.height,"). It may cause a cloud recording exception"))),this.mediaStream_.removeTrack(r[0]),this.mediaStream_.addTrack(t),Ot(It(u.prototype),"restartVideo",this).call(this)),!(a=this.getConnection())){e.next=10;break}return e.next=10,a.replaceTrack(t);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"updateDeviceIdInUse",value:function(){var e=this;if(!this.mediaStream_)return this.cameraId_="",this.cameraGroupId_="",this.microphoneId_="",void(this.microphoneGroupId_="");"getSettings"in MediaStreamTrack.prototype&&this.mediaStream_.getTracks().forEach((function(t){if("audio"===t.kind&&e.isAudioTrackMixed()){var n=e.getMicrophoneTrackMixed();if(n){var r=n.getSettings(),i=r.deviceId,a=r.groupId;i&&(e.microphoneId_=i,e.microphoneGroupId_=a)}}else if("video"===t.kind&&e.isVideoTrackBeautified()){var o=e.getBeautyOriginTrack();if(o){var s=o.getSettings(),c=s.deviceId,u=s.groupId;c&&(e.cameraId_=c,e.cameraGroupId_=u)}}else{var d=t.getSettings(),l=d.deviceId,h=d.groupId;l&&("audio"===t.kind?(e.microphoneId_=l,e.microphoneGroupId_=h):"video"!==t.kind||e.screen_||(e.cameraId_=l,e.cameraGroupId_=h))}}));var t=this.mediaStream_.getAudioTracks(),n=this.mediaStream_.getVideoTracks();t&&0===t.length&&(this.microphoneId_="",this.microphoneGroupId_=""),n&&0===n.length&&(this.cameraId_="",this.cameraGroupId_="")}},{key:"isAudioTrackMixed",value:function(){if(k_.AudioMixerPlugin){var e=k_.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id))return!0}return!1}},{key:"getMicrophoneTrackMixed",value:function(){if(k_.AudioMixerPlugin){var e=k_.AudioMixerPlugin.getAudioTrackMap(),t=this.getAudioTrack();if(e&&t&&e.has(t.id)){var n=e.get(t.id);return n.hasMicrophone?n.microphoneTrack:null}}return null}},{key:"isVideoTrackBeautified",value:function(){if(k_.beautyTrackMap){var e=k_.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id))return!0}return!1}},{key:"getBeautyOriginTrack",value:function(){if(k_.beautyTrackMap){var e=k_.beautyTrackMap,t=this.getVideoTrack();if(t&&e.has(t.id)){var n=e.get(t.id);if(n.originTrack)return n.originTrack}}return null}},{key:"generateBeautyTrack",value:function(e){var t=this.getVideoTrack(),n=k_.beautyTrackMap.get(t.id).pluginInstance.generateBeautyTrack(e);return this.log_.info("regenerate beauty track, track id = ".concat(e.id)),n}},{key:"getScreen",value:function(){return this.screen_}},{key:"getVideo",value:function(){return this.video_}},{key:"getAudio",value:function(){return this.audio_}},{key:"getCameraId",value:function(){return this.cameraId_}},{key:"getMicrophoneId",value:function(){return this.microphoneId_}},{key:"getMicrophoneGroupId",value:function(){return this.microphoneGroupId_}},{key:"getIsReadyToPublish",value:function(){return this.isReadyToPublish_}},{key:"setIsReadyToPublish",value:function(e){this.isReadyToPublish_=e}},{key:"setPublishState",value:function(e){this.publishState_=e}},{key:"onStreamPublished",value:function(e){if(e.localStream===this){var t=this.getAudioTrack(),n=this.getVideoTrack();if(t){var r=!t.enabled;this.setMutedFlag(ss,r)}if(n){var i=!n.enabled;this.setMutedFlag(cs,i)}this.connection_&&this.connection_.sendMutedFlag(this.mutedFlag_)}}},{key:"setAudioVolume",value:function(e){Ot(It(u.prototype),"setAudioVolume",this).call(this,e)}},{key:"close",value:function(){Ot(It(u.prototype),"close",this).call(this),this.uninstallEvents()}}]),u}(Rm),k_={VERSION:"4.11.1",Logger:{LogLevel:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,NONE:5},setLogLevel:function(e){Os.setLogLevel(e)},enableUploadLog:function(){Os.enableUploadLog()},disableUploadLog:function(){Os.disableUploadLog()}},checkSystemRequirements:function(){return St(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,gf();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))()},isScreenShareSupported:function(){return Sf()},isSmallStreamSupported:function(){return Df()},getDevices:function(){return St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ef()&&!Rf()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.map((function(e,t){var n=e.label;e.label||(n=e.kind+"_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)})))()},getCameras:function(){return St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ef()&&!Rf()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return"videoinput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="camera_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)})))()},getMicrophones:function(){return St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ef()&&!Rf()){e.next=2;break}return e.abrupt("return",[]);case 2:return e.next=4,navigator.mediaDevices.enumerateDevices();case 4:return t=e.sent,e.abrupt("return",t.filter((function(e){return"audioinput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="microphone_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 6:case"end":return e.stop()}}),e)})))()},getSpeakers:function(){return St(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.enumerateDevices();case 2:return t=e.sent,e.abrupt("return",t.filter((function(e){return"audiooutput"===e.kind})).map((function(e,t){var n=e.label;e.label||(n="speaker_"+t);var r={label:n,deviceId:e.deviceId,kind:e.kind};return e.groupId&&(r.groupId=e.groupId),r})));case 4:case"end":return e.stop()}}),e)})))()},createClient:function(e){if(!(""!==e.userId.trim()))throw new vs({code:_s.INVALID_PARAMETER,message:"userId cannot be all spaces"});Gd&&(Gd=!1,Os.getLogLevel()!=k_.Logger.LogLevel.NONE&&(console.info("******************************************************************************"),console.info("* 欢迎使用 TRTC Web SDK - 腾讯云实时音视频通信"),console.info("* API 文档:https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/index.html"),console.info("* 版本更新日志:https://cloud.tencent.com/document/product/647/38958"),console.info("* 反馈问题:https://github.com/tencentyun/TRTCSDK/issues"),console.info("******************************************************************************")),Os.info("TRTC Web SDK Version: 4.11.1"),Os.info("UserAgent: "+navigator.userAgent),Os.info("URL of current page: "+location.href));var t={version:this.VERSION};return new l_(Et(Et({},t),e))},createStream:function(e){if(!Cs(e.screen)&&e.screen&&Cs(e.audio)&&(e.audio=!1),!(Cs(e.audio)&&Cs(e.video)||Cs(e.audioSource)&&Cs(e.videoSource)))throw new vs({code:_s.INVALID_PARAMETER,message:"LocalStream must be created by createStream() with either audio/video or audioSource/videoSourcebut can not be mixed with audio/video and audioSource/videoSource"});if(!Cs(e.screen)&&!0===e.screen&&!0===e.video)throw new vs({code:_s.INVALID_PARAMETER,message:"screen/video options are mutually exclusive, they can not be both true"});if(e.audio&&e.screenAudio)throw new vs({code:_s.INVALID_PARAMETER,message:"audio/screenAudio options are mutually exclusive, they can not be both true"});if(!0!==e.screen&&!0===e.screenAudio)throw new vs({code:_s.INVALID_PARAMETER,message:"screenAudio options are configurable while screen options is true"});if(!Cs(e.screen)&&!0===e.screen&&!this.isScreenShareSupported())throw new vs({code:_s.INVALID_OPERATION,message:"screen capture is not supported, please use the latest chrome browser"});return new b_(e)}};return k_}));
|