@veltdev/sdk
Version:
Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.
37 lines (36 loc) • 9.15 MB
JavaScript
var SNIPPYLY_VERSION = '5.0.2-beta.7';
(function(c,E){"use strict";function U(){var e=X.splice(0,X.length);for(ue=0;e.length;)e.shift().call(null,e.shift())}function fe(e,t){for(var n=0,r=e.length;n<r;n++)Le(e[n],t)}function ot(e){for(var t,n=0,r=e.length;n<r;n++)t=e[n],_(t,B[pe(t)])}function de(e){return function(t){Lt(t)&&(Le(t,e),L.length&&fe(t.querySelectorAll(L),e))}}function pe(e){var t=ae.call(e,"is"),n=e.nodeName.toUpperCase(),r=H.call(D,t?J+t.toUpperCase():q+n);return t&&-1<r&&!Ie(n,t)?-1:r}function Ie(e,t){return-1<L.indexOf(e+'[is="'+t+'"]')}function Fe(e){var t=e.currentTarget,n=e.attrChange,r=e.attrName,o=e.target,l=e[Y]||2,a=e[ge]||3;!se||o&&o!==t||!t[C]||r==="style"||e.prevValue===e.newValue&&(e.newValue!==""||n!==l&&n!==a)||t[C](r,n===l?null:e.prevValue,n===a?null:e.newValue)}function Se(e){var t=de(e);return function(n){X.push(t,n.target),ue&&clearTimeout(ue),ue=setTimeout(U,1)}}function he(e){rt&&(rt=!1,e.currentTarget.removeEventListener(Ze,he)),L.length&&fe((e.target||u).querySelectorAll(L),e.detail===v?v:y),R&&at()}function lt(e,t){var n=this;Je.call(n,e,t),Ee.call(n,{target:n})}function Pe(e,t,n){var r=t.apply(e,n),o=pe(r);return-1<o&&_(r,B[o]),n.pop()&&L.length&&ot(r.querySelectorAll(L)),r}function Te(e,t){Tt(e,t),Q?Q.observe(e,gt):(ce&&(e.setAttribute=lt,e[g]=ve(e),e[b](st,Ee)),e[b](N,Fe)),e[x]&&se&&(e.created=!0,e[x](),e.created=!1)}function at(){for(var e,t=0,n=z.length;t<n;t++)e=z[t],P.contains(e)||(n--,z.splice(t--,1),Le(e,v))}function Ve(e){throw new Error("A "+e+" type is already registered")}function Le(e,t){var n,r,o=pe(e);-1<o&&!Mt.call(e,"TEMPLATE")&&(W(e,B[o]),o=0,t!==y||e[y]?t!==v||e[v]||(e[y]=!1,e[v]=!0,r="disconnected",o=1):(e[v]=!1,e[y]=!0,r="connected",o=1,R&&H.call(z,e)<0&&z.push(e)),o&&(n=e[t+O]||e[r+O])&&n.call(e))}function K(){}function Re(e,t,n){var r=n&&n[k]||"",o=t.prototype,l=we(o),a=t.observedAttributes||Ce,m={prototype:l};le(l,x,{value:function(){if(ne)ne=!1;else if(!this[j]){this[j]=!0,new t(this),o[x]&&o[x].call(this);var i=G[re.get(t)];(!Z||i.create.length>1)&&ke(this)}}}),le(l,C,{value:function(i){-1<H.call(a,i)&&o[C]&&o[C].apply(this,arguments)}}),o[Be]&&le(l,ut,{value:o[Be]}),o[je]&&le(l,ct,{value:o[je]}),r&&(m[k]=r),e=e.toUpperCase(),G[e]={constructor:t,create:r?[r,oe(e)]:[e]},re.set(t,e),u[S](e.toLowerCase(),m),Me(e),V[e].r()}function Ue(e){var t=G[e.toUpperCase()];return t&&t.constructor}function _e(e){return typeof e=="string"?e:e&&e.is||""}function ke(e){for(var t,n=e[C],r=n?e.attributes:Ce,o=r.length;o--;)t=r[o],n.call(e,t.name||t.nodeName,null,t.value||t.nodeValue)}function Me(e){return e=e.toUpperCase(),e in V||(V[e]={},V[e].p=new $e(function(t){V[e].r=t})),V[e].p}function xe(){w&&delete c.customElements,I(c,"customElements",{configurable:!0,value:new K}),I(c,"CustomElementRegistry",{configurable:!0,value:K});for(var e=it.get(/^HTML[A-Z]*[a-z]/),t=e.length;t--;(function(n){var r=c[n];if(r){c[n]=function(o){var l,a;return o||(o=this),o[j]||(ne=!0,l=G[re.get(o.constructor)],a=Z&&l.create.length===1,o=a?Reflect.construct(r,Ce,l.constructor):u.createElement.apply(u,l.create),o[j]=!0,ne=!1,a||ke(o)),o},c[n].prototype=r.prototype;try{r.prototype.constructor=c[n]}catch{pt=!0,I(r,j,{value:c[n]})}}})(e[t]));u.createElement=function(n,r){var o=_e(r);return o?Oe.call(this,n,oe(o)):Oe.call(this,n)},tt||(Ne=!0,u[S](""))}var u=c.document,T=c.Object,it=(function(e){var t,n,r,o,l=/^[A-Z]+[a-z]/,a=function(d){var f,h=[];for(f in i)d.test(f)&&h.push(f);return h},m=function(d,f){(f=f.toLowerCase())in i||(i[d]=(i[d]||[]).concat(f),i[f]=i[f.toUpperCase()]=d)},i=(T.create||T)(null),s={};for(n in e)for(o in e[n])for(r=e[n][o],i[o]=r,t=0;t<r.length;t++)i[r[t].toLowerCase()]=i[r[t].toUpperCase()]=o;return s.get=function(d){return typeof d=="string"?i[d]||(l.test(d)?[]:""):a(d)},s.set=function(d,f){return l.test(d)?m(d,f):m(f,d),s},s})({collections:{HTMLAllCollection:["all"],HTMLCollection:["forms"],HTMLFormControlsCollection:["elements"],HTMLOptionsCollection:["options"]},elements:{Element:["element"],HTMLAnchorElement:["a"],HTMLAppletElement:["applet"],HTMLAreaElement:["area"],HTMLAttachmentElement:["attachment"],HTMLAudioElement:["audio"],HTMLBRElement:["br"],HTMLBaseElement:["base"],HTMLBodyElement:["body"],HTMLButtonElement:["button"],HTMLCanvasElement:["canvas"],HTMLContentElement:["content"],HTMLDListElement:["dl"],HTMLDataElement:["data"],HTMLDataListElement:["datalist"],HTMLDetailsElement:["details"],HTMLDialogElement:["dialog"],HTMLDirectoryElement:["dir"],HTMLDivElement:["div"],HTMLDocument:["document"],HTMLElement:["element","abbr","address","article","aside","b","bdi","bdo","cite","code","command","dd","dfn","dt","em","figcaption","figure","footer","header","i","kbd","mark","nav","noscript","rp","rt","ruby","s","samp","section","small","strong","sub","summary","sup","u","var","wbr"],HTMLEmbedElement:["embed"],HTMLFieldSetElement:["fieldset"],HTMLFontElement:["font"],HTMLFormElement:["form"],HTMLFrameElement:["frame"],HTMLFrameSetElement:["frameset"],HTMLHRElement:["hr"],HTMLHeadElement:["head"],HTMLHeadingElement:["h1","h2","h3","h4","h5","h6"],HTMLHtmlElement:["html"],HTMLIFrameElement:["iframe"],HTMLImageElement:["img"],HTMLInputElement:["input"],HTMLKeygenElement:["keygen"],HTMLLIElement:["li"],HTMLLabelElement:["label"],HTMLLegendElement:["legend"],HTMLLinkElement:["link"],HTMLMapElement:["map"],HTMLMarqueeElement:["marquee"],HTMLMediaElement:["media"],HTMLMenuElement:["menu"],HTMLMenuItemElement:["menuitem"],HTMLMetaElement:["meta"],HTMLMeterElement:["meter"],HTMLModElement:["del","ins"],HTMLOListElement:["ol"],HTMLObjectElement:["object"],HTMLOptGroupElement:["optgroup"],HTMLOptionElement:["option"],HTMLOutputElement:["output"],HTMLParagraphElement:["p"],HTMLParamElement:["param"],HTMLPictureElement:["picture"],HTMLPreElement:["pre"],HTMLProgressElement:["progress"],HTMLQuoteElement:["blockquote","q","quote"],HTMLScriptElement:["script"],HTMLSelectElement:["select"],HTMLShadowElement:["shadow"],HTMLSlotElement:["slot"],HTMLSourceElement:["source"],HTMLSpanElement:["span"],HTMLStyleElement:["style"],HTMLTableCaptionElement:["caption"],HTMLTableCellElement:["td","th"],HTMLTableColElement:["col","colgroup"],HTMLTableElement:["table"],HTMLTableRowElement:["tr"],HTMLTableSectionElement:["thead","tbody","tfoot"],HTMLTemplateElement:["template"],HTMLTextAreaElement:["textarea"],HTMLTimeElement:["time"],HTMLTitleElement:["title"],HTMLTrackElement:["track"],HTMLUListElement:["ul"],HTMLUnknownElement:["unknown","vhgroupv","vkeygen"],HTMLVideoElement:["video"]},nodes:{Attr:["node"],Audio:["audio"],CDATASection:["node"],CharacterData:["node"],Comment:["#comment"],Document:["#document"],DocumentFragment:["#document-fragment"],DocumentType:["node"],HTMLDocument:["#document"],Image:["img"],Option:["option"],ProcessingInstruction:["node"],ShadowRoot:["#shadow-root"],Text:["#text"],XMLDocument:["xml"]}});typeof E!="object"&&(E={type:E||"auto"});var X,Ee,$,ve,Q,He,W,_,A,S="registerElement",qe=1e5*c.Math.random()>>0,g="__"+S+qe,b="addEventListener",y="attached",O="Callback",v="detached",k="extends",C="attributeChanged"+O,ut=y+O,Be="connected"+O,je="disconnected"+O,x="created"+O,ct=v+O,Y="ADDITION",ge="REMOVAL",N="DOMAttrModified",Ze="DOMContentLoaded",st="DOMSubtreeModified",q="<",J="=",mt=/^[A-Z][._A-Z0-9]*-[-._A-Z0-9]*$/,ft=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],D=[],B=[],L="",P=u.documentElement,H=D.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},be=T.prototype,ye=be.hasOwnProperty,ee=be.isPrototypeOf,I=T.defineProperty,Ce=[],te=T.getOwnPropertyDescriptor,Ge=T.getOwnPropertyNames,dt=T.getPrototypeOf,ze=T.setPrototypeOf,Ke=!!T.__proto__,pt=!1,j="__dreCEv1",w=c.customElements,Z=!/^force/.test(E.type)&&!!(w&&w.define&&w.get&&w.whenDefined),Xe=T.create||T,ht=c.Map||function(){var e,t=[],n=[];return{get:function(r){return n[H.call(t,r)]},set:function(r,o){e=H.call(t,r),e<0?n[t.push(r)-1]=o:n[e]=o}}},$e=c.Promise||function(e){function t(l){for(r=!0;n.length;)n.shift()(l)}var n=[],r=!1,o={catch:function(){return o},then:function(l){return n.push(l),r&&setTimeout(t,1),o}};return e(t),o},ne=!1,G=Xe(null),V=Xe(null),re=new ht,oe=function(e){return e.toLowerCase()},we=T.create||function e(t){return t?(e.prototype=t,new e):this},Tt=ze||(Ke?function(e,t){return e.__proto__=t,e}:Ge&&te?(function(){function e(t,n){for(var r,o=Ge(n),l=0,a=o.length;l<a;l++)r=o[l],ye.call(t,r)||I(t,r,te(n,r))}return function(t,n){do e(t,n);while((n=dt(n))&&!ee.call(n,t));return t}})():function(e,t){for(var n in t)e[n]=t[n];return e}),F=c.MutationObserver||c.WebKitMutationObserver,Qe=c.HTMLAnchorElement,p=(c.HTMLElement||c.Element||c.Node).prototype,R=!ee.call(p,P),le=R?function(e,t,n){return e[t]=n.value,e}:I,Lt=R?function(e){return e.nodeType===1}:function(e){return ee.call(p,e)},z=R&&[],We=p.attachShadow,Ye=p.cloneNode,Mt=p.closest||function(e){for(var t=this;t&&t.nodeName!==e;)t=t.parentNode;return t},Ae=p.dispatchEvent,ae=p.getAttribute,Et=p.hasAttribute,vt=p.removeAttribute,Je=p.setAttribute,ie=u.createElement,Ht=u.importNode,Oe=ie,gt=F&&{attributes:!0,characterData:!0,attributeOldValue:!0},et=F||function(e){ce=!1,P.removeEventListener(N,et)},ue=0,tt=S in u&&!/^force-all/.test(E.type),nt=!0,Ne=!1,ce=!0,rt=!0,se=!0;if(F&&(A=u.createElement("div"),A.innerHTML="<div><div></div></div>",new F(function(e,t){if(e[0]&&e[0].type=="childList"&&!e[0].removedNodes[0].childNodes.length){A=te(p,"innerHTML");var n=A&&A.set;n&&I(p,"innerHTML",{set:function(r){for(;this.lastChild;)this.removeChild(this.lastChild);n.call(this,r)}})}t.disconnect(),A=null}).observe(A,{childList:!0,subtree:!0}),A.innerHTML=""),tt||(ze||Ke?(W=function(e,t){ee.call(t,e)||Te(e,t)},_=Te):(W=function(e,t){e[g]||(e[g]=T(!0),Te(e,t))},_=W),R?(ce=!1,(function(){var e=te(p,b),t=e.value,n=function(l){var a=new CustomEvent(N,{bubbles:!0});a.attrName=l,a.prevValue=ae.call(this,l),a.newValue=null,a[ge]=a.attrChange=2,vt.call(this,l),Ae.call(this,a)},r=function(l,a){var m=Et.call(this,l),i=m&&ae.call(this,l),s=new CustomEvent(N,{bubbles:!0});Je.call(this,l,a),s.attrName=l,s.prevValue=m?i:null,s.newValue=a,m?s.MODIFICATION=s.attrChange=1:s[Y]=s.attrChange=0,Ae.call(this,s)},o=function(l){var a,m=l.currentTarget,i=m[g],s=l.propertyName;i.hasOwnProperty(s)&&(i=i[s],a=new CustomEvent(N,{bubbles:!0}),a.attrName=i.name,a.prevValue=i.value||null,a.newValue=i.value=m[s]||null,a.prevValue==null?a[Y]=a.attrChange=0:a.MODIFICATION=a.attrChange=1,Ae.call(m,a))};e.value=function(l,a,m){l===N&&this[C]&&this.setAttribute!==r&&(this[g]={className:{name:"class",value:this.className}},this.setAttribute=r,this.removeAttribute=n,t.call(this,"propertychange",o)),t.call(this,l,a,m)},I(p,b,e)})()):F||(P[b](N,et),P.setAttribute(g,1),P.removeAttribute(g),ce&&(Ee=function(e){var t,n,r,o=this;if(o===e.target){t=o[g],o[g]=n=ve(o);for(r in n){if(!(r in t))return $(0,o,r,t[r],n[r],Y);if(n[r]!==t[r])return $(1,o,r,t[r],n[r],"MODIFICATION")}for(r in t)if(!(r in n))return $(2,o,r,t[r],n[r],ge)}},$=function(e,t,n,r,o,l){var a={attrChange:e,currentTarget:t,attrName:n,prevValue:r,newValue:o};a[l]=e,Fe(a)},ve=function(e){for(var t,n,r={},o=e.attributes,l=0,a=o.length;l<a;l++)t=o[l],(n=t.name)!=="setAttribute"&&(r[n]=t.value);return r})),u[S]=function(e,t){if(n=e.toUpperCase(),nt&&(nt=!1,F?(Q=(function(i,s){function d(f,h){for(var M=0,me=f.length;M<me;h(f[M++]));}return new F(function(f){for(var h,M,me,De=0,bt=f.length;De<bt;De++)h=f[De],h.type==="childList"?(d(h.addedNodes,i),d(h.removedNodes,s)):(M=h.target,se&&M[C]&&h.attributeName!=="style"&&(me=ae.call(M,h.attributeName))!==h.oldValue&&M[C](h.attributeName,h.oldValue,me))})})(de(y),de(v)),He=function(i){return Q.observe(i,{childList:!0,subtree:!0}),i},He(u),We&&(p.attachShadow=function(){return He(We.apply(this,arguments))})):(X=[],u[b]("DOMNodeInserted",Se(y)),u[b]("DOMNodeRemoved",Se(v))),u[b](Ze,he),u[b]("readystatechange",he),u.importNode=function(i,s){switch(i.nodeType){case 1:return Pe(u,Ht,[i,!!s]);case 11:for(var d=u.createDocumentFragment(),f=i.childNodes,h=f.length,M=0;M<h;M++)d.appendChild(u.importNode(f[M],!!s));return d;default:return Ye.call(i,!!s)}},p.cloneNode=function(i){return Pe(this,Ye,[!!i])}),Ne)return Ne=!1;if(-2<H.call(D,J+n)+H.call(D,q+n)&&Ve(e),!mt.test(n)||-1<H.call(ft,n))throw new Error("The type "+e+" is invalid");var n,r,o=function(){return a?u.createElement(m,n):u.createElement(m)},l=t||be,a=ye.call(l,k),m=a?t[k].toUpperCase():n;return a&&-1<H.call(D,q+m)&&Ve(m),r=D.push((a?J:q)+n)-1,L=L.concat(L.length?",":"",a?m+'[is="'+e.toLowerCase()+'"]':m),o.prototype=B[r]=ye.call(l,"prototype")?l.prototype:we(p),L.length&&fe(u.querySelectorAll(L),y),o},u.createElement=Oe=function(e,t){var n=_e(t),r=n?ie.call(u,e,oe(n)):ie.call(u,e),o=""+e,l=H.call(D,(n?J:q)+(n||o).toUpperCase()),a=-1<l;return n&&(r.setAttribute("is",n=n.toLowerCase()),a&&(a=Ie(o.toUpperCase(),n))),se=!u.createElement.innerHTMLHelper,a&&_(r,B[l]),r}),addEventListener("beforeunload",function(){delete u.createElement,delete u.importNode,delete u[S]},!1),K.prototype={constructor:K,define:Z?function(e,t,n){if(n)Re(e,t,n);else{var r=e.toUpperCase();G[r]={constructor:t,create:[r]},re.set(t,r),w.define(e,t)}}:Re,get:Z?function(e){return w.get(e)||Ue(e)}:Ue,whenDefined:Z?function(e){return $e.race([w.whenDefined(e),Me(e)])}:Me},!w||/^force/.test(E.type))xe();else if(!E.noBuiltIn)try{(function(e,t,n){var r=new RegExp(`^<a\\s+is=('|")`+n+"\\1></a>$");if(t[k]="a",e.prototype=we(Qe.prototype),e.prototype.constructor=e,c.customElements.define(n,e,t),!r.test(u.createElement("a",{is:n}).outerHTML)||!r.test(new e().outerHTML))throw t})(function e(){return Reflect.construct(Qe,[],e)},{},"document-register-element-a"+qe)}catch{xe()}if(!E.noBuiltIn)try{if(ie.call(u,"a","a").outerHTML.indexOf("is")<0)throw{}}catch{oe=function(t){return{is:t.toLowerCase()}}}})(window);Promise.allSettled||(Promise.allSettled=function(c){return Promise.all(c.map(function(E){return Promise.resolve(E).then(function(U){return{status:"fulfilled",value:U}}).catch(function(U){return{status:"rejected",reason:U}})}))});
var OIe=Object.create;var T4=Object.defineProperty,PIe=Object.defineProperties,MIe=Object.getOwnPropertyDescriptor,RIe=Object.getOwnPropertyDescriptors,NIe=Object.getOwnPropertyNames,k4=Object.getOwnPropertySymbols,FZ=Object.getPrototypeOf,nF=Object.prototype.hasOwnProperty,LZ=Object.prototype.propertyIsEnumerable,FIe=Reflect.get;var NZ=(n,r,i)=>r in n?T4(n,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[r]=i,b=(n,r)=>{for(var i in r||={})nF.call(r,i)&&NZ(n,i,r[i]);if(k4)for(var i of k4(r))LZ.call(r,i)&&NZ(n,i,r[i]);return n},E=(n,r)=>PIe(n,RIe(r));var Np=(n,r)=>{var i={};for(var e in n)nF.call(n,e)&&r.indexOf(e)<0&&(i[e]=n[e]);if(n!=null&&k4)for(var e of k4(n))r.indexOf(e)<0&&LZ.call(n,e)&&(i[e]=n[e]);return i};var LIe=(n,r)=>()=>(r||n((r={exports:{}}).exports,r),r.exports),w4=(n,r)=>{for(var i in r)T4(n,i,{get:r[i],enumerable:!0})},UIe=(n,r,i,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of NIe(r))!nF.call(n,t)&&t!==i&&T4(n,t,{get:()=>r[t],enumerable:!(e=MIe(r,t))||e.enumerable});return n};var UZ=(n,r,i)=>(i=n!=null?OIe(FZ(n)):{},UIe(r||!n||!n.__esModule?T4(i,"default",{value:n,enumerable:!0}):i,n));var dv=(n,r,i)=>FIe(FZ(n),i,r);var X=(n,r,i)=>new Promise((e,t)=>{var o=s=>{try{l(i.next(s))}catch(d){t(d)}},a=s=>{try{l(i.throw(s))}catch(d){t(d)}},l=s=>s.done?e(s.value):Promise.resolve(s.value).then(o,a);l((i=i.apply(n,r)).next())});var tZ=LIe((izr,eZ)=>{"use strict";var Mt={};Mt.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)};Mt.localCName=Mt.generateIdentifier();Mt.splitLines=function(n){return n.trim().split(`
`).map(r=>r.trim())};Mt.splitSections=function(n){return n.split(`
m=`).map((i,e)=>(e>0?"m="+i:i).trim()+`\r
`)};Mt.getDescription=function(n){let r=Mt.splitSections(n);return r&&r[0]};Mt.getMediaSections=function(n){let r=Mt.splitSections(n);return r.shift(),r};Mt.matchPrefix=function(n,r){return Mt.splitLines(n).filter(i=>i.indexOf(r)===0)};Mt.parseCandidate=function(n){let r;n.indexOf("a=candidate:")===0?r=n.substring(12).split(" "):r=n.substring(10).split(" ");let i={foundation:r[0],component:{1:"rtp",2:"rtcp"}[r[1]]||r[1],protocol:r[2].toLowerCase(),priority:parseInt(r[3],10),ip:r[4],address:r[4],port:parseInt(r[5],10),type:r[7]};for(let e=8;e<r.length;e+=2)switch(r[e]){case"raddr":i.relatedAddress=r[e+1];break;case"rport":i.relatedPort=parseInt(r[e+1],10);break;case"tcptype":i.tcpType=r[e+1];break;case"ufrag":i.ufrag=r[e+1],i.usernameFragment=r[e+1];break;default:i[r[e]]===void 0&&(i[r[e]]=r[e+1]);break}return i};Mt.writeCandidate=function(n){let r=[];r.push(n.foundation);let i=n.component;i==="rtp"?r.push(1):i==="rtcp"?r.push(2):r.push(i),r.push(n.protocol.toUpperCase()),r.push(n.priority),r.push(n.address||n.ip),r.push(n.port);let e=n.type;return r.push("typ"),r.push(e),e!=="host"&&n.relatedAddress&&n.relatedPort&&(r.push("raddr"),r.push(n.relatedAddress),r.push("rport"),r.push(n.relatedPort)),n.tcpType&&n.protocol.toLowerCase()==="tcp"&&(r.push("tcptype"),r.push(n.tcpType)),(n.usernameFragment||n.ufrag)&&(r.push("ufrag"),r.push(n.usernameFragment||n.ufrag)),"candidate:"+r.join(" ")};Mt.parseIceOptions=function(n){return n.substring(14).split(" ")};Mt.parseRtpMap=function(n){let r=n.substring(9).split(" "),i={payloadType:parseInt(r.shift(),10)};return r=r[0].split("/"),i.name=r[0],i.clockRate=parseInt(r[1],10),i.channels=r.length===3?parseInt(r[2],10):1,i.numChannels=i.channels,i};Mt.writeRtpMap=function(n){let r=n.payloadType;n.preferredPayloadType!==void 0&&(r=n.preferredPayloadType);let i=n.channels||n.numChannels||1;return"a=rtpmap:"+r+" "+n.name+"/"+n.clockRate+(i!==1?"/"+i:"")+`\r
`};Mt.parseExtmap=function(n){let r=n.substring(9).split(" ");return{id:parseInt(r[0],10),direction:r[0].indexOf("/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1],attributes:r.slice(2).join(" ")}};Mt.writeExtmap=function(n){return"a=extmap:"+(n.id||n.preferredId)+(n.direction&&n.direction!=="sendrecv"?"/"+n.direction:"")+" "+n.uri+(n.attributes?" "+n.attributes:"")+`\r
`};Mt.parseFmtp=function(n){let r={},i,e=n.substring(n.indexOf(" ")+1).split(";");for(let t=0;t<e.length;t++)i=e[t].trim().split("="),r[i[0].trim()]=i[1];return r};Mt.writeFmtp=function(n){let r="",i=n.payloadType;if(n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType),n.parameters&&Object.keys(n.parameters).length){let e=[];Object.keys(n.parameters).forEach(t=>{n.parameters[t]!==void 0?e.push(t+"="+n.parameters[t]):e.push(t)}),r+="a=fmtp:"+i+" "+e.join(";")+`\r
`}return r};Mt.parseRtcpFb=function(n){let r=n.substring(n.indexOf(" ")+1).split(" ");return{type:r.shift(),parameter:r.join(" ")}};Mt.writeRtcpFb=function(n){let r="",i=n.payloadType;return n.preferredPayloadType!==void 0&&(i=n.preferredPayloadType),n.rtcpFeedback&&n.rtcpFeedback.length&&n.rtcpFeedback.forEach(e=>{r+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+`\r
`}),r};Mt.parseSsrcMedia=function(n){let r=n.indexOf(" "),i={ssrc:parseInt(n.substring(7,r),10)},e=n.indexOf(":",r);return e>-1?(i.attribute=n.substring(r+1,e),i.value=n.substring(e+1)):i.attribute=n.substring(r+1),i};Mt.parseSsrcGroup=function(n){let r=n.substring(13).split(" ");return{semantics:r.shift(),ssrcs:r.map(i=>parseInt(i,10))}};Mt.getMid=function(n){let r=Mt.matchPrefix(n,"a=mid:")[0];if(r)return r.substring(6)};Mt.parseFingerprint=function(n){let r=n.substring(14).split(" ");return{algorithm:r[0].toLowerCase(),value:r[1].toUpperCase()}};Mt.getDtlsParameters=function(n,r){return{role:"auto",fingerprints:Mt.matchPrefix(n+r,"a=fingerprint:").map(Mt.parseFingerprint)}};Mt.writeDtlsParameters=function(n,r){let i="a=setup:"+r+`\r
`;return n.fingerprints.forEach(e=>{i+="a=fingerprint:"+e.algorithm+" "+e.value+`\r
`}),i};Mt.parseCryptoLine=function(n){let r=n.substring(9).split(" ");return{tag:parseInt(r[0],10),cryptoSuite:r[1],keyParams:r[2],sessionParams:r.slice(3)}};Mt.writeCryptoLine=function(n){return"a=crypto:"+n.tag+" "+n.cryptoSuite+" "+(typeof n.keyParams=="object"?Mt.writeCryptoKeyParams(n.keyParams):n.keyParams)+(n.sessionParams?" "+n.sessionParams.join(" "):"")+`\r
`};Mt.parseCryptoKeyParams=function(n){if(n.indexOf("inline:")!==0)return null;let r=n.substring(7).split("|");return{keyMethod:"inline",keySalt:r[0],lifeTime:r[1],mkiValue:r[2]?r[2].split(":")[0]:void 0,mkiLength:r[2]?r[2].split(":")[1]:void 0}};Mt.writeCryptoKeyParams=function(n){return n.keyMethod+":"+n.keySalt+(n.lifeTime?"|"+n.lifeTime:"")+(n.mkiValue&&n.mkiLength?"|"+n.mkiValue+":"+n.mkiLength:"")};Mt.getCryptoParameters=function(n,r){return Mt.matchPrefix(n+r,"a=crypto:").map(Mt.parseCryptoLine)};Mt.getIceParameters=function(n,r){let i=Mt.matchPrefix(n+r,"a=ice-ufrag:")[0],e=Mt.matchPrefix(n+r,"a=ice-pwd:")[0];return i&&e?{usernameFragment:i.substring(12),password:e.substring(10)}:null};Mt.writeIceParameters=function(n){let r="a=ice-ufrag:"+n.usernameFragment+`\r
a=ice-pwd:`+n.password+`\r
`;return n.iceLite&&(r+=`a=ice-lite\r
`),r};Mt.parseRtpParameters=function(n){let r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},e=Mt.splitLines(n)[0].split(" ");r.profile=e[2];for(let o=3;o<e.length;o++){let a=e[o],l=Mt.matchPrefix(n,"a=rtpmap:"+a+" ")[0];if(l){let s=Mt.parseRtpMap(l),d=Mt.matchPrefix(n,"a=fmtp:"+a+" ");switch(s.parameters=d.length?Mt.parseFmtp(d[0]):{},s.rtcpFeedback=Mt.matchPrefix(n,"a=rtcp-fb:"+a+" ").map(Mt.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase());break;default:break}}}Mt.matchPrefix(n,"a=extmap:").forEach(o=>{r.headerExtensions.push(Mt.parseExtmap(o))});let t=Mt.matchPrefix(n,"a=rtcp-fb:* ").map(Mt.parseRtcpFb);return r.codecs.forEach(o=>{t.forEach(a=>{o.rtcpFeedback.find(s=>s.type===a.type&&s.parameter===a.parameter)||o.rtcpFeedback.push(a)})}),r};Mt.writeRtpDescription=function(n,r){let i="";i+="m="+n+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(t=>t.preferredPayloadType!==void 0?t.preferredPayloadType:t.payloadType).join(" ")+`\r
`,i+=`c=IN IP4 0.0.0.0\r
`,i+=`a=rtcp:9 IN IP4 0.0.0.0\r
`,r.codecs.forEach(t=>{i+=Mt.writeRtpMap(t),i+=Mt.writeFmtp(t),i+=Mt.writeRtcpFb(t)});let e=0;return r.codecs.forEach(t=>{t.maxptime>e&&(e=t.maxptime)}),e>0&&(i+="a=maxptime:"+e+`\r
`),r.headerExtensions&&r.headerExtensions.forEach(t=>{i+=Mt.writeExtmap(t)}),i};Mt.parseRtpEncodingParameters=function(n){let r=[],i=Mt.parseRtpParameters(n),e=i.fecMechanisms.indexOf("RED")!==-1,t=i.fecMechanisms.indexOf("ULPFEC")!==-1,o=Mt.matchPrefix(n,"a=ssrc:").map(v=>Mt.parseSsrcMedia(v)).filter(v=>v.attribute==="cname"),a=o.length>0&&o[0].ssrc,l,s=Mt.matchPrefix(n,"a=ssrc-group:FID").map(v=>v.substring(17).split(" ").map(S=>parseInt(S,10)));s.length>0&&s[0].length>1&&s[0][0]===a&&(l=s[0][1]),i.codecs.forEach(v=>{if(v.name.toUpperCase()==="RTX"&&v.parameters.apt){let u={ssrc:a,codecPayloadType:parseInt(v.parameters.apt,10)};a&&l&&(u.rtx={ssrc:l}),r.push(u),e&&(u=JSON.parse(JSON.stringify(u)),u.fec={ssrc:a,mechanism:t?"red+ulpfec":"red"},r.push(u))}}),r.length===0&&a&&r.push({ssrc:a});let d=Mt.matchPrefix(n,"b=");return d.length&&(d[0].indexOf("b=TIAS:")===0?d=parseInt(d[0].substring(7),10):d[0].indexOf("b=AS:")===0?d=parseInt(d[0].substring(5),10)*1e3*.95-2e3*8:d=void 0,r.forEach(v=>{v.maxBitrate=d})),r};Mt.parseRtcpParameters=function(n){let r={},i=Mt.matchPrefix(n,"a=ssrc:").map(o=>Mt.parseSsrcMedia(o)).filter(o=>o.attribute==="cname")[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);let e=Mt.matchPrefix(n,"a=rtcp-rsize");r.reducedSize=e.length>0,r.compound=e.length===0;let t=Mt.matchPrefix(n,"a=rtcp-mux");return r.mux=t.length>0,r};Mt.writeRtcpParameters=function(n){let r="";return n.reducedSize&&(r+=`a=rtcp-rsize\r
`),n.mux&&(r+=`a=rtcp-mux\r
`),n.ssrc!==void 0&&n.cname&&(r+="a=ssrc:"+n.ssrc+" cname:"+n.cname+`\r
`),r};Mt.parseMsid=function(n){let r,i=Mt.matchPrefix(n,"a=msid:");if(i.length===1)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};let e=Mt.matchPrefix(n,"a=ssrc:").map(t=>Mt.parseSsrcMedia(t)).filter(t=>t.attribute==="msid");if(e.length>0)return r=e[0].value.split(" "),{stream:r[0],track:r[1]}};Mt.parseSctpDescription=function(n){let r=Mt.parseMLine(n),i=Mt.matchPrefix(n,"a=max-message-size:"),e;i.length>0&&(e=parseInt(i[0].substring(19),10)),isNaN(e)&&(e=65536);let t=Mt.matchPrefix(n,"a=sctp-port:");if(t.length>0)return{port:parseInt(t[0].substring(12),10),protocol:r.fmt,maxMessageSize:e};let o=Mt.matchPrefix(n,"a=sctpmap:");if(o.length>0){let a=o[0].substring(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:e}}};Mt.writeSctpDescription=function(n,r){let i=[];return n.protocol!=="DTLS/SCTP"?i=["m="+n.kind+" 9 "+n.protocol+" "+r.protocol+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctp-port:"+r.port+`\r
`]:i=["m="+n.kind+" 9 "+n.protocol+" "+r.port+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctpmap:"+r.port+" "+r.protocol+` 65535\r
`],r.maxMessageSize!==void 0&&i.push("a=max-message-size:"+r.maxMessageSize+`\r
`),i.join("")};Mt.generateSessionId=function(){return Math.random().toString().substr(2,22)};Mt.writeSessionBoilerplate=function(n,r,i){let e,t=r!==void 0?r:2;return n?e=n:e=Mt.generateSessionId(),`v=0\r
o=`+(i||"thisisadapterortc")+" "+e+" "+t+` IN IP4 127.0.0.1\r
s=-\r
t=0 0\r
`};Mt.getDirection=function(n,r){let i=Mt.splitLines(n);for(let e=0;e<i.length;e++)switch(i[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[e].substring(2);default:}return r?Mt.getDirection(r):"sendrecv"};Mt.getKind=function(n){return Mt.splitLines(n)[0].split(" ")[0].substring(2)};Mt.isRejected=function(n){return n.split(" ",2)[1]==="0"};Mt.parseMLine=function(n){let i=Mt.splitLines(n)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}};Mt.parseOLine=function(n){let i=Mt.matchPrefix(n,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}};Mt.isValidSDP=function(n){if(typeof n!="string"||n.length===0)return!1;let r=Mt.splitLines(n);for(let i=0;i<r.length;i++)if(r[i].length<2||r[i].charAt(1)!=="=")return!1;return!0};typeof eZ=="object"&&(eZ.exports=Mt)});var iF;function D4(){return iF}function jd(n){let r=iF;return iF=n,r}var BZ=Symbol("NotFound");function y0(n){return n===BZ||n?.name==="\u0275NotFound"}var dl=null,A4=!1,rF=1,BIe=null,Ea=Symbol("SIGNAL");function Rn(n){let r=dl;return dl=n,r}function R4(){return dl}var Fp={version:0,lastCleanEpoch:0,dirty:!1,producers:void 0,producersTail:void 0,consumers:void 0,consumersTail:void 0,recomputing:!1,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,kind:"unknown",producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function x0(n){if(A4)throw new Error("");if(dl===null)return;dl.consumerOnSignalRead(n);let r=dl.producersTail;if(r!==void 0&&r.producer===n)return;let i,e=dl.recomputing;if(e&&(i=r!==void 0?r.nextProducer:dl.producers,i!==void 0&&i.producer===n)){dl.producersTail=i,i.lastReadVersion=n.version;return}let t=n.consumersTail;if(t!==void 0&&t.consumer===dl&&(!e||jIe(t,dl)))return;let o=k0(dl),a={producer:n,consumer:dl,nextProducer:i,prevConsumer:t,lastReadVersion:n.version,nextConsumer:void 0};dl.producersTail=a,r!==void 0?r.nextProducer=a:dl.producers=a,o&&HZ(n,a)}function VZ(){rF++}function N4(n){if(!(k0(n)&&!n.dirty)&&!(!n.dirty&&n.lastCleanEpoch===rF)){if(!n.producerMustRecompute(n)&&!E0(n)){M4(n);return}n.producerRecomputeValue(n),M4(n)}}function oF(n){if(n.consumers===void 0)return;let r=A4;A4=!0;try{for(let i=n.consumers;i!==void 0;i=i.nextConsumer){let e=i.consumer;e.dirty||VIe(e)}}finally{A4=r}}function aF(){return dl?.consumerAllowSignalWrites!==!1}function VIe(n){n.dirty=!0,oF(n),n.consumerMarkedDirty?.(n)}function M4(n){n.dirty=!1,n.lastCleanEpoch=rF}function Lp(n){return n&&jZ(n),Rn(n)}function jZ(n){n.producersTail=void 0,n.recomputing=!0}function I0(n,r){Rn(r),n&&$Z(n)}function $Z(n){n.recomputing=!1;let r=n.producersTail,i=r!==void 0?r.nextProducer:n.producers;if(i!==void 0){if(k0(n))do i=lF(i);while(i!==void 0);r!==void 0?r.nextProducer=void 0:n.producers=void 0}}function E0(n){for(let r=n.producers;r!==void 0;r=r.nextProducer){let i=r.producer,e=r.lastReadVersion;if(e!==i.version||(N4(i),e!==i.version))return!0}return!1}function Up(n){if(k0(n)){let r=n.producers;for(;r!==void 0;)r=lF(r)}n.producers=void 0,n.producersTail=void 0,n.consumers=void 0,n.consumersTail=void 0}function HZ(n,r){let i=n.consumersTail,e=k0(n);if(i!==void 0?(r.nextConsumer=i.nextConsumer,i.nextConsumer=r):(r.nextConsumer=void 0,n.consumers=r),r.prevConsumer=i,n.consumersTail=r,!e)for(let t=n.producers;t!==void 0;t=t.nextProducer)HZ(t.producer,t)}function lF(n){let r=n.producer,i=n.nextProducer,e=n.nextConsumer,t=n.prevConsumer;if(n.nextConsumer=void 0,n.prevConsumer=void 0,e!==void 0?e.prevConsumer=t:r.consumersTail=t,t!==void 0)t.nextConsumer=e;else if(r.consumers=e,!k0(r)){let o=r.producers;for(;o!==void 0;)o=lF(o)}return i}function k0(n){return n.consumerIsAlwaysLive||n.consumers!==void 0}function F4(n){BIe?.(n)}function jIe(n,r){let i=r.producersTail;if(i!==void 0){let e=r.producers;do{if(e===n)return!0;if(e===i)break;e=e.nextProducer}while(e!==void 0)}return!1}function L4(n,r){return Object.is(n,r)}function Tx(n,r){let i=Object.create($Ie);i.computation=n,r!==void 0&&(i.equal=r);let e=()=>{if(N4(i),x0(i),i.value===kx)throw i.error;return i.value};return e[Ea]=i,F4(i),e}var O4=Symbol("UNSET"),P4=Symbol("COMPUTING"),kx=Symbol("ERRORED"),$Ie=E(b({},Fp),{value:O4,dirty:!0,error:null,equal:L4,kind:"computed",producerMustRecompute(n){return n.value===O4||n.value===P4},producerRecomputeValue(n){if(n.value===P4)throw new Error("");let r=n.value;n.value=P4;let i=Lp(n),e,t=!1;try{e=n.computation(),Rn(null),t=r!==O4&&r!==kx&&e!==kx&&n.equal(r,e)}catch(o){e=kx,n.error=o}finally{I0(n,i)}if(t){n.value=r;return}n.value=e,n.version++}});function HIe(){throw new Error}var zZ=HIe;function GZ(n){zZ(n)}function sF(n){zZ=n}var zIe=null;function cF(n,r){let i=Object.create(U4);i.value=n,r!==void 0&&(i.equal=r);let e=()=>WZ(i);return e[Ea]=i,F4(i),[e,a=>T0(i,a),a=>dF(i,a)]}function WZ(n){return x0(n),n.value}function T0(n,r){aF()||GZ(n),n.equal(n.value,r)||(n.value=r,GIe(n))}function dF(n,r){aF()||GZ(n),T0(n,r(n.value))}var U4=E(b({},Fp),{equal:L4,value:void 0,kind:"signal"});function GIe(n){n.version++,VZ(),oF(n),zIe?.(n)}function Nn(n){return typeof n=="function"}function mv(n){let i=n(e=>{Error.call(e),e.stack=new Error().stack});return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i}var B4=mv(n=>function(i){n(this),this.message=i?`${i.length} errors occurred during unsubscription:
${i.map((e,t)=>`${t+1}) ${e.toString()}`).join(`
`)}`:"",this.name="UnsubscriptionError",this.errors=i});function Bp(n,r){if(n){let i=n.indexOf(r);0<=i&&n.splice(i,1)}}var Fn=class n{constructor(r){this.initialTeardown=r,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let r;if(!this.closed){this.closed=!0;let{_parentage:i}=this;if(i)if(this._parentage=null,Array.isArray(i))for(let o of i)o.remove(this);else i.remove(this);let{initialTeardown:e}=this;if(Nn(e))try{e()}catch(o){r=o instanceof B4?o.errors:[o]}let{_finalizers:t}=this;if(t){this._finalizers=null;for(let o of t)try{qZ(o)}catch(a){r=r??[],a instanceof B4?r=[...r,...a.errors]:r.push(a)}}if(r)throw new B4(r)}}add(r){var i;if(r&&r!==this)if(this.closed)qZ(r);else{if(r instanceof n){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=(i=this._finalizers)!==null&&i!==void 0?i:[]).push(r)}}_hasParent(r){let{_parentage:i}=this;return i===r||Array.isArray(i)&&i.includes(r)}_addParent(r){let{_parentage:i}=this;this._parentage=Array.isArray(i)?(i.push(r),i):i?[i,r]:r}_removeParent(r){let{_parentage:i}=this;i===r?this._parentage=null:Array.isArray(i)&&Bp(i,r)}remove(r){let{_finalizers:i}=this;i&&Bp(i,r),r instanceof n&&r._removeParent(this)}};Fn.EMPTY=(()=>{let n=new Fn;return n.closed=!0,n})();var mF=Fn.EMPTY;function V4(n){return n instanceof Fn||n&&"closed"in n&&Nn(n.remove)&&Nn(n.add)&&Nn(n.unsubscribe)}function qZ(n){Nn(n)?n():n.unsubscribe()}var $c={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var w0={setTimeout(n,r,...i){let{delegate:e}=w0;return e?.setTimeout?e.setTimeout(n,r,...i):setTimeout(n,r,...i)},clearTimeout(n){let{delegate:r}=w0;return(r?.clearTimeout||clearTimeout)(n)},delegate:void 0};function j4(n){w0.setTimeout(()=>{let{onUnhandledError:r}=$c;if(r)r(n);else throw n})}function ag(){}var YZ=gF("C",void 0,void 0);function KZ(n){return gF("E",void 0,n)}function ZZ(n){return gF("N",n,void 0)}function gF(n,r,i){return{kind:n,value:r,error:i}}var Vp=null;function D0(n){if($c.useDeprecatedSynchronousErrorHandling){let r=!Vp;if(r&&(Vp={errorThrown:!1,error:null}),n(),r){let{errorThrown:i,error:e}=Vp;if(Vp=null,i)throw e}}else n()}function XZ(n){$c.useDeprecatedSynchronousErrorHandling&&Vp&&(Vp.errorThrown=!0,Vp.error=n)}var jp=class extends Fn{constructor(r){super(),this.isStopped=!1,r?(this.destination=r,V4(r)&&r.add(this)):this.destination=YIe}static create(r,i,e){return new Hc(r,i,e)}next(r){this.isStopped?uF(ZZ(r),this):this._next(r)}error(r){this.isStopped?uF(KZ(r),this):(this.isStopped=!0,this._error(r))}complete(){this.isStopped?uF(YZ,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(r){this.destination.next(r)}_error(r){try{this.destination.error(r)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},WIe=Function.prototype.bind;function vF(n,r){return WIe.call(n,r)}var pF=class{constructor(r){this.partialObserver=r}next(r){let{partialObserver:i}=this;if(i.next)try{i.next(r)}catch(e){$4(e)}}error(r){let{partialObserver:i}=this;if(i.error)try{i.error(r)}catch(e){$4(e)}else $4(r)}complete(){let{partialObserver:r}=this;if(r.complete)try{r.complete()}catch(i){$4(i)}}},Hc=class extends jp{constructor(r,i,e){super();let t;if(Nn(r)||!r)t={next:r??void 0,error:i??void 0,complete:e??void 0};else{let o;this&&$c.useDeprecatedNextContext?(o=Object.create(r),o.unsubscribe=()=>this.unsubscribe(),t={next:r.next&&vF(r.next,o),error:r.error&&vF(r.error,o),complete:r.complete&&vF(r.complete,o)}):t=r}this.destination=new pF(t)}};function $4(n){$c.useDeprecatedSynchronousErrorHandling?XZ(n):j4(n)}function qIe(n){throw n}function uF(n,r){let{onStoppedNotification:i}=$c;i&&w0.setTimeout(()=>i(n,r))}var YIe={closed:!0,next:ag,error:qIe,complete:ag};var A0=typeof Symbol=="function"&&Symbol.observable||"@@observable";function zc(n){return n}function JZ(n){return n.length===0?zc:n.length===1?n[0]:function(i){return n.reduce((e,t)=>t(e),i)}}var zt=(()=>{class n{constructor(i){i&&(this._subscribe=i)}lift(i){let e=new n;return e.source=this,e.operator=i,e}subscribe(i,e,t){let o=ZIe(i)?i:new Hc(i,e,t);return D0(()=>{let{operator:a,source:l}=this;o.add(a?a.call(o,l):l?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(i){try{return this._subscribe(i)}catch(e){i.error(e)}}forEach(i,e){return e=QZ(e),new e((t,o)=>{let a=new Hc({next:l=>{try{i(l)}catch(s){o(s),a.unsubscribe()}},error:o,complete:t});this.subscribe(a)})}_subscribe(i){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(i)}[A0](){return this}pipe(...i){return JZ(i)(this)}toPromise(i){return i=QZ(i),new i((e,t)=>{let o;this.subscribe(a=>o=a,a=>t(a),()=>e(o))})}}return n.create=r=>new n(r),n})();function QZ(n){var r;return(r=n??$c.Promise)!==null&&r!==void 0?r:Promise}function KIe(n){return n&&Nn(n.next)&&Nn(n.error)&&Nn(n.complete)}function ZIe(n){return n&&n instanceof jp||KIe(n)&&V4(n)}function hF(n){return Nn(n?.lift)}function Un(n){return r=>{if(hF(r))return r.lift(function(i){try{return n(i,this)}catch(e){this.error(e)}});throw new TypeError("Unable to lift unknown Observable type")}}function Dn(n,r,i,e,t){return new fF(n,r,i,e,t)}var fF=class extends jp{constructor(r,i,e,t,o,a){super(r),this.onFinalize=o,this.shouldUnsubscribe=a,this._next=i?function(l){try{i(l)}catch(s){r.error(s)}}:super._next,this._error=t?function(l){try{t(l)}catch(s){r.error(s)}finally{this.unsubscribe()}}:super._error,this._complete=e?function(){try{e()}catch(l){r.error(l)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:i}=this;super.unsubscribe(),!i&&((r=this.onFinalize)===null||r===void 0||r.call(this))}}};function eX(){return Un((n,r)=>{let i=null;n._refCount++;let e=Dn(r,void 0,void 0,void 0,()=>{if(!n||n._refCount<=0||0<--n._refCount){i=null;return}let t=n._connection,o=i;i=null,t&&(!o||t===o)&&t.unsubscribe(),r.unsubscribe()});n.subscribe(e),e.closed||(i=n.connect())})}var wx=class extends zt{constructor(r,i){super(),this.source=r,this.subjectFactory=i,this._subject=null,this._refCount=0,this._connection=null,hF(r)&&(this.lift=r.lift)}_subscribe(r){return this.getSubject().subscribe(r)}getSubject(){let r=this._subject;return(!r||r.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;let{_connection:r}=this;this._subject=this._connection=null,r?.unsubscribe()}connect(){let r=this._connection;if(!r){r=this._connection=new Fn;let i=this.getSubject();r.add(this.source.subscribe(Dn(i,void 0,()=>{this._teardown(),i.complete()},e=>{this._teardown(),i.error(e)},()=>this._teardown()))),r.closed&&(this._connection=null,r=Fn.EMPTY)}return r}refCount(){return eX()(this)}};var O0={schedule(n){let r=requestAnimationFrame,i=cancelAnimationFrame,{delegate:e}=O0;e&&(r=e.requestAnimationFrame,i=e.cancelAnimationFrame);let t=r(o=>{i=void 0,n(o)});return new Fn(()=>i?.(t))},requestAnimationFrame(...n){let{delegate:r}=O0;return(r?.requestAnimationFrame||requestAnimationFrame)(...n)},cancelAnimationFrame(...n){let{delegate:r}=O0;return(r?.cancelAnimationFrame||cancelAnimationFrame)(...n)},delegate:void 0};var tX=mv(n=>function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var tt=(()=>{class n extends zt{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(i){let e=new H4(this,this);return e.operator=i,e}_throwIfClosed(){if(this.closed)throw new tX}next(i){D0(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let e of this.currentObservers)e.next(i)}})}error(i){D0(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=i;let{observers:e}=this;for(;e.length;)e.shift().error(i)}})}complete(){D0(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:i}=this;for(;i.length;)i.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var i;return((i=this.observers)===null||i===void 0?void 0:i.length)>0}_trySubscribe(i){return this._throwIfClosed(),super._trySubscribe(i)}_subscribe(i){return this._throwIfClosed(),this._checkFinalizedStatuses(i),this._innerSubscribe(i)}_innerSubscribe(i){let{hasError:e,isStopped:t,observers:o}=this;return e||t?mF:(this.currentObservers=null,o.push(i),new Fn(()=>{this.currentObservers=null,Bp(o,i)}))}_checkFinalizedStatuses(i){let{hasError:e,thrownError:t,isStopped:o}=this;e?i.error(t):o&&i.complete()}asObservable(){let i=new zt;return i.source=this,i}}return n.create=(r,i)=>new H4(r,i),n})(),H4=class extends tt{constructor(r,i){super(),this.destination=r,this.source=i}next(r){var i,e;(e=(i=this.destination)===null||i===void 0?void 0:i.next)===null||e===void 0||e.call(i,r)}error(r){var i,e;(e=(i=this.destination)===null||i===void 0?void 0:i.error)===null||e===void 0||e.call(i,r)}complete(){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||i===void 0||i.call(r)}_subscribe(r){var i,e;return(e=(i=this.source)===null||i===void 0?void 0:i.subscribe(r))!==null&&e!==void 0?e:mF}};var be=class extends tt{constructor(r){super(),this._value=r}get value(){return this.getValue()}_subscribe(r){let i=super._subscribe(r);return!i.closed&&r.next(this._value),i}getValue(){let{hasError:r,thrownError:i,_value:e}=this;if(r)throw i;return this._throwIfClosed(),e}next(r){super.next(this._value=r)}};var $p={now(){return($p.delegate||Date).now()},delegate:void 0};var $d=class extends tt{constructor(r=1/0,i=1/0,e=$p){super(),this._bufferSize=r,this._windowTime=i,this._timestampProvider=e,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=i===1/0,this._bufferSize=Math.max(1,r),this._windowTime=Math.max(1,i)}next(r){let{isStopped:i,_buffer:e,_infiniteTimeWindow:t,_timestampProvider:o,_windowTime:a}=this;i||(e.push(r),!t&&e.push(o.now()+a)),this._trimBuffer(),super.next(r)}_subscribe(r){this._throwIfClosed(),this._trimBuffer();let i=this._innerSubscribe(r),{_infiniteTimeWindow:e,_buffer:t}=this,o=t.slice();for(let a=0;a<o.length&&!r.closed;a+=e?1:2)r.next(o[a]);return this._checkFinalizedStatuses(r),i}_trimBuffer(){let{_bufferSize:r,_timestampProvider:i,_buffer:e,_infiniteTimeWindow:t}=this,o=(t?1:2)*r;if(r<1/0&&o<e.length&&e.splice(0,e.length-o),!t){let a=i.now(),l=0;for(let s=1;s<e.length&&e[s]<=a;s+=2)l=s;l&&e.splice(0,l+1)}}};var z4=class extends Fn{constructor(r,i){super()}schedule(r,i=0){return this}};var Dx={setInterval(n,r,...i){let{delegate:e}=Dx;return e?.setInterval?e.setInterval(n,r,...i):setInterval(n,r,...i)},clearInterval(n){let{delegate:r}=Dx;return(r?.clearInterval||clearInterval)(n)},delegate:void 0};var Hd=class extends z4{constructor(r,i){super(r,i),this.scheduler=r,this.work=i,this.pending=!1}schedule(r,i=0){var e;if(this.closed)return this;this.state=r;let t=this.id,o=this.scheduler;return t!=null&&(this.id=this.recycleAsyncId(o,t,i)),this.pending=!0,this.delay=i,this.id=(e=this.id)!==null&&e!==void 0?e:this.requestAsyncId(o,this.id,i),this}requestAsyncId(r,i,e=0){return Dx.setInterval(r.flush.bind(r,this),e)}recycleAsyncId(r,i,e=0){if(e!=null&&this.delay===e&&this.pending===!1)return i;i!=null&&Dx.clearInterval(i)}execute(r,i){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;let e=this._execute(r,i);if(e)return e;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(r,i){let e=!1,t;try{this.work(r)}catch(o){e=!0,t=o||new Error("Scheduled action threw falsy error")}if(e)return this.unsubscribe(),t}unsubscribe(){if(!this.closed){let{id:r,scheduler:i}=this,{actions:e}=i;this.work=this.state=this.scheduler=null,this.pending=!1,Bp(e,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,super.unsubscribe()}}};var XIe=1,CF,_F={};function nX(n){return n in _F?(delete _F[n],!0):!1}var iX={setImmediate(n){let r=XIe++;return _F[r]=!0,CF||(CF=Promise.resolve()),CF.then(()=>nX(r)&&n()),r},clearImmediate(n){nX(n)}};var{setImmediate:JIe,clearImmediate:QIe}=iX,Ax={setImmediate(...n){let{delegate:r}=Ax;return(r?.setImmediate||JIe)(...n)},clearImmediate(n){let{delegate:r}=Ax;return(r?.clearImmediate||QIe)(n)},delegate:void 0};var G4=class extends Hd{constructor(r,i){super(r,i),this.scheduler=r,this.work=i}requestAsyncId(r,i,e=0){return e!==null&&e>0?super.requestAsyncId(r,i,e):(r.actions.push(this),r._scheduled||(r._scheduled=Ax.setImmediate(r.flush.bind(r,void 0))))}recycleAsyncId(r,i,e=0){var t;if(e!=null?e>0:this.delay>0)return super.recycleAsyncId(r,i,e);let{actions:o}=r;i!=null&&((t=o[o.length-1])===null||t===void 0?void 0:t.id)!==i&&(Ax.clearImmediate(i),r._scheduled===i&&(r._scheduled=void 0))}};var P0=class n{constructor(r,i=n.now){this.schedulerActionCtor=r,this.now=i}schedule(r,i=0,e){return new this.schedulerActionCtor(this,r).schedule(e,i)}};P0.now=$p.now;var zd=class extends P0{constructor(r,i=P0.now){super(r,i),this.actions=[],this._active=!1}flush(r){let{actions:i}=this;if(this._active){i.push(r);return}let e;this._active=!0;do if(e=r.execute(r.state,r.delay))break;while(r=i.shift());if(this._active=!1,e){for(;r=i.shift();)r.unsubscribe();throw e}}};var W4=class extends zd{flush(r){this._active=!0;let i=this._scheduled;this._scheduled=void 0;let{actions:e}=this,t;r=r||e.shift();do if(t=r.execute(r.state,r.delay))break;while((r=e[0])&&r.id===i&&e.shift());if(this._active=!1,t){for(;(r=e[0])&&r.id===i&&e.shift();)r.unsubscribe();throw t}}};var bF=new W4(G4);var ml=new zd(Hd),SF=ml;var q4=class extends Hd{constructor(r,i){super(r,i),this.scheduler=r,this.work=i}schedule(r,i=0){return i>0?super.schedule(r,i):(this.delay=i,this.state=r,this.scheduler.flush(this),this)}execute(r,i){return i>0||this.closed?super.execute(r,i):this._execute(r,i)}requestAsyncId(r,i,e=0){return e!=null&&e>0||e==null&&this.delay>0?super.requestAsyncId(r,i,e):(r.flush(this),0)}};var Y4=class extends zd{};var yF=new Y4(q4);var K4=class extends Hd{constructor(r,i){super(r,i),this.scheduler=r,this.work=i}requestAsyncId(r,i,e=0){return e!==null&&e>0?super.requestAsyncId(r,i,e):(r.actions.push(this),r._scheduled||(r._scheduled=O0.requestAnimationFrame(()=>r.flush(void 0))))}recycleAsyncId(r,i,e=0){var t;if(e!=null?e>0:this.delay>0)return super.recycleAsyncId(r,i,e);let{actions:o}=r;i!=null&&i===r._scheduled&&((t=o[o.length-1])===null||t===void 0?void 0:t.id)!==i&&(O0.cancelAnimationFrame(i),r._scheduled=void 0)}};var Z4=class extends zd{flush(r){this._active=!0;let i;r?i=r.id:(i=this._scheduled,this._scheduled=void 0);let{actions:e}=this,t;r=r||e.shift();do if(t=r.execute(r.state,r.delay))break;while((r=e[0])&&r.id===i&&e.shift());if(this._active=!1,t){for(;(r=e[0])&&r.id===i&&e.shift();)r.unsubscribe();throw t}}};var lg=new Z4(K4);var ec=new zt(n=>n.complete());function X4(n){return n&&Nn(n.schedule)}function xF(n){return n[n.length-1]}function J4(n){return Nn(xF(n))?n.pop():void 0}function Gd(n){return X4(xF(n))?n.pop():void 0}function rX(n,r){return typeof xF(n)=="number"?n.pop():r}function IF(n,r){var i={};for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&r.indexOf(e)<0&&(i[e]=n[e]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var t=0,e=Object.getOwnPropertySymbols(n);t<e.length;t++)r.indexOf(e[t])<0&&Object.prototype.propertyIsEnumerable.call(n,e[t])&&(i[e[t]]=n[e[t]]);return i}function aX(n,r,i,e){function t(o){return o instanceof i?o:new i(function(a){a(o)})}return new(i||(i=Promise))(function(o,a){function l(v){try{d(e.next(v))}catch(u){a(u)}}function s(v){try{d(e.throw(v))}catch(u){a(u)}}function d(v){v.done?o(v.value):t(v.value).then(l,s)}d((e=e.apply(n,r||[])).next())})}function oX(n){var r=typeof Symbol=="function"&&Symbol.iterator,i=r&&n[r],e=0;if(i)return i.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&e>=n.length&&(n=void 0),{value:n&&n[e++],done:!n}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hp(n){return this instanceof Hp?(this.v=n,this):new Hp(n)}function lX(n,r,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=i.apply(n,r||[]),t,o=[];return t=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),t[Symbol.asyncIterator]=function(){return this},t;function a(k){return function(O){return Promise.resolve(O).then(k,u)}}function l(k,O){e[k]&&(t[k]=function(P){return new Promise(function(U,W){o.push([k,P,U,W])>1||s(k,P)})},O&&(t[k]=O(t[k])))}function s(k,O){try{d(e[k](O))}catch(P){S(o[0][3],P)}}function d(k){k.value instanceof Hp?Promise.resolve(k.value.v).then(v,u):S(o[0][2],k)}function v(k){s("next",k)}function u(k){s("throw",k)}function S(k,O){k(O),o.shift(),o.length&&s(o[0][0],o[0][1])}}function sX(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n[Symbol.asyncIterator],i;return r?r.call(n):(n=typeof oX=="function"?oX(n):n[Symbol.iterator](),i={},e("next"),e("throw"),e("return"),i[Symbol.asyncIterator]=function(){return this},i);function e(o){i[o]=n[o]&&function(a){return new Promise(function(l,s){a=n[o](a),t(l,s,a.done,a.value)})}}function t(o,a,l,s){Promise.resolve(s).then(function(d){o({value:d,done:l})},a)}}var M0=n=>n&&typeof n.length=="number"&&typeof n!="function";function Q4(n){return Nn(n?.then)}function e5(n){return Nn(n[A0])}function t5(n){return Symbol.asyncIterator&&Nn(n?.[Symbol.asyncIterator])}function n5(n){return new TypeError(`You provided ${n!==null&&typeof n=="object"?"an invalid object":`'${n}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function e2e(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var i5=e2e();function r5(n){return Nn(n?.[i5])}function o5(n){return lX(this,arguments,function*(){let i=n.getReader();try{for(;;){let{value:e,done:t}=yield Hp(i.read());if(t)return yield Hp(void 0);yield yield Hp(e)}}finally{i.releaseLock()}})}function a5(n){return Nn(n?.getReader)}function Ti(n){if(n instanceof zt)return n;if(n!=null){if(e5(n))return t2e(n);if(M0(n))return n2e(n);if(Q4(n))return i2e(n);if(t5(n))return cX(n);if(r5(n))return r2e(n);if(a5(n))return o2e(n)}throw n5(n)}function t2e(n){return new zt(r=>{let i=n[A0]();if(Nn(i.subscribe))return i.subscribe(r);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function n2e(n){return new zt(r=>{for(let i=0;i<n.length&&!r.closed;i++)r.next(n[i]);r.complete()})}function i2e(n){return new zt(r=>{n.then(i=>{r.closed||(r.next(i),r.complete())},i=>r.error(i)).then(null,j4)})}function r2e(n){return new zt(r=>{for(let i of n)if(r.next(i),r.closed)return;r.complete()})}function cX(n){return new zt(r=>{a2e(n,r).catch(i=>r.error(i))})}function o2e(n){return cX(o5(n))}function a2e(n,r){var i,e,t,o;return aX(this,void 0,void 0,function*(){try{for(i=