@maveio/components 0.0.172 → 0.0.174
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/dist/chunk-3FKZJPP6.cjs +2 -0
- package/dist/chunk-HDVI5ING.js +2583 -0
- package/dist/chunk-KCEF7VQS.cjs +2583 -0
- package/dist/chunk-SWNRHAZK.js +2 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +9 -3
- package/dist/config.d.ts +9 -3
- package/dist/config.js +1 -1
- package/dist/de-4HGSV4NX.cjs +1 -0
- package/dist/de-AM53RBF2.js +1 -0
- package/dist/{themes/default.cjs → default-LFHA4VXP.cjs} +3 -3
- package/dist/{themes/default.js → default-OIQBJJAX.js} +3 -3
- package/dist/{themes/dolphin.cjs → dolphin-B2Z26DWX.cjs} +2 -2
- package/dist/{themes/dolphin.js → dolphin-JJOJS5EI.js} +2 -2
- package/dist/en-H7UBETC6.js +1 -0
- package/dist/en-M6OWHDJ2.cjs +1 -0
- package/dist/fr-2IL2CZKO.js +1 -0
- package/dist/fr-OXQSVAX4.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +470 -16
- package/dist/index.d.ts +470 -16
- package/dist/index.js +1 -1
- package/dist/nl-CPFN66G7.js +1 -0
- package/dist/nl-YHUQM5IK.cjs +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.d.cts +2 -11
- package/dist/react.d.ts +2 -11
- package/dist/react.js +1 -1
- package/dist/{themes/synthwave.cjs → synthwave-JAIVYLQN.cjs} +2 -2
- package/dist/{themes/synthwave.js → synthwave-X45G4Z3J.js} +2 -2
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.cts +1 -0
- package/dist/vue.d.ts +1 -0
- package/dist/vue.js +1 -1
- package/package.json +7 -2
- package/dist/chunk-2E5GLLOS.cjs +0 -19
- package/dist/chunk-2FUCHY2J.cjs +0 -35
- package/dist/chunk-2JCNQPEK.js +0 -1
- package/dist/chunk-3BAQWQNY.cjs +0 -25
- package/dist/chunk-3UQNIS3L.js +0 -194
- package/dist/chunk-474VILDO.cjs +0 -194
- package/dist/chunk-5NKBIUPL.cjs +0 -1
- package/dist/chunk-5PIHL662.js +0 -19
- package/dist/chunk-5ZZKAVXJ.js +0 -38
- package/dist/chunk-6DDQAAOQ.cjs +0 -211
- package/dist/chunk-AOBEOJ2U.cjs +0 -10
- package/dist/chunk-B5K5JDPC.cjs +0 -7
- package/dist/chunk-B6P2GJBQ.js +0 -9
- package/dist/chunk-BL5IEXIA.cjs +0 -1
- package/dist/chunk-BTCK3T4L.cjs +0 -24
- package/dist/chunk-CNPQ5Q2M.js +0 -1
- package/dist/chunk-CVXHA76S.js +0 -3
- package/dist/chunk-CWZPXTU2.cjs +0 -154
- package/dist/chunk-DL4BV5IH.cjs +0 -24
- package/dist/chunk-DXS4BF7U.js +0 -33
- package/dist/chunk-EVKPEPYP.cjs +0 -2
- package/dist/chunk-FAONFKQ2.cjs +0 -9
- package/dist/chunk-GXOLIMQT.js +0 -1
- package/dist/chunk-HMVS6DJE.js +0 -186
- package/dist/chunk-IBQULJZC.cjs +0 -3
- package/dist/chunk-J7OISSKU.cjs +0 -1
- package/dist/chunk-JN3JQJEF.js +0 -1639
- package/dist/chunk-K5Z7QHTN.cjs +0 -1
- package/dist/chunk-KHVG2CY5.js +0 -7
- package/dist/chunk-KNLOZXCA.cjs +0 -33
- package/dist/chunk-KO3CETGD.js +0 -25
- package/dist/chunk-KZGLJUFY.cjs +0 -38
- package/dist/chunk-LVGLIRQU.cjs +0 -186
- package/dist/chunk-MK4VIJT3.js +0 -1
- package/dist/chunk-MMHEOMF5.js +0 -9
- package/dist/chunk-NDPOBFNC.js +0 -20
- package/dist/chunk-NPP5B5PV.cjs +0 -16
- package/dist/chunk-OX42Y2HR.js +0 -1
- package/dist/chunk-P6SBZPDR.js +0 -1
- package/dist/chunk-PTN427IG.js +0 -24
- package/dist/chunk-QFF6OUH6.js +0 -9
- package/dist/chunk-QOM4AP6R.cjs +0 -9
- package/dist/chunk-QQDH35OW.cjs +0 -9
- package/dist/chunk-R3SDTEHC.js +0 -9
- package/dist/chunk-RHTBV6KZ.js +0 -24
- package/dist/chunk-RKL7JR7S.js +0 -211
- package/dist/chunk-RQN3DXJB.cjs +0 -1
- package/dist/chunk-RRCW5BBR.cjs +0 -9
- package/dist/chunk-S3D62CAG.js +0 -154
- package/dist/chunk-SDKTBB4N.cjs +0 -1
- package/dist/chunk-SWRFZ3FV.js +0 -1
- package/dist/chunk-TAKTIPT7.cjs +0 -1639
- package/dist/chunk-TH3DUBVR.js +0 -35
- package/dist/chunk-TJ5F2FGY.cjs +0 -20
- package/dist/chunk-TKJYRGEU.cjs +0 -1
- package/dist/chunk-WE5NUDRY.js +0 -0
- package/dist/chunk-WOXKZOJ3.js +0 -10
- package/dist/chunk-X7OGQ4KH.cjs +0 -1
- package/dist/chunk-YPCQNE3R.js +0 -16
- package/dist/chunk-ZTDQPDC6.js +0 -2
- package/dist/components/audio-track-menu.cjs +0 -1
- package/dist/components/audio-track-menu.d.cts +0 -27
- package/dist/components/audio-track-menu.d.ts +0 -27
- package/dist/components/audio-track-menu.js +0 -1
- package/dist/components/captions-menu-button.cjs +0 -1
- package/dist/components/captions-menu-button.d.cts +0 -10
- package/dist/components/captions-menu-button.d.ts +0 -10
- package/dist/components/captions-menu-button.js +0 -1
- package/dist/components/clip.cjs +0 -1
- package/dist/components/clip.d.cts +0 -55
- package/dist/components/clip.d.ts +0 -55
- package/dist/components/clip.js +0 -1
- package/dist/components/files.cjs +0 -1
- package/dist/components/files.d.cts +0 -22
- package/dist/components/files.d.ts +0 -22
- package/dist/components/files.js +0 -1
- package/dist/components/img.cjs +0 -1
- package/dist/components/img.d.cts +0 -16
- package/dist/components/img.d.ts +0 -16
- package/dist/components/img.js +0 -1
- package/dist/components/list.cjs +0 -1
- package/dist/components/list.d.cts +0 -29
- package/dist/components/list.d.ts +0 -29
- package/dist/components/list.js +0 -1
- package/dist/components/player.cjs +0 -1
- package/dist/components/player.d.cts +0 -104
- package/dist/components/player.d.ts +0 -104
- package/dist/components/player.js +0 -1
- package/dist/components/pop.cjs +0 -1
- package/dist/components/pop.d.cts +0 -37
- package/dist/components/pop.d.ts +0 -37
- package/dist/components/pop.js +0 -1
- package/dist/components/text.cjs +0 -1
- package/dist/components/text.d.cts +0 -55
- package/dist/components/text.d.ts +0 -55
- package/dist/components/text.js +0 -1
- package/dist/components/upload.cjs +0 -1
- package/dist/components/upload.d.cts +0 -94
- package/dist/components/upload.d.ts +0 -94
- package/dist/components/upload.js +0 -1
- package/dist/embed/api.cjs +0 -1
- package/dist/embed/api.d.cts +0 -112
- package/dist/embed/api.d.ts +0 -112
- package/dist/embed/api.js +0 -1
- package/dist/embed/caption.cjs +0 -1
- package/dist/embed/caption.d.cts +0 -24
- package/dist/embed/caption.d.ts +0 -24
- package/dist/embed/caption.js +0 -1
- package/dist/embed/controller.cjs +0 -1
- package/dist/embed/controller.d.cts +0 -34
- package/dist/embed/controller.d.ts +0 -34
- package/dist/embed/controller.js +0 -1
- package/dist/embed/socket.cjs +0 -1
- package/dist/embed/socket.d.cts +0 -14
- package/dist/embed/socket.d.ts +0 -14
- package/dist/embed/socket.js +0 -1
- package/dist/generated/locales/de.cjs +0 -1
- package/dist/generated/locales/de.d.cts +0 -17
- package/dist/generated/locales/de.d.ts +0 -17
- package/dist/generated/locales/de.js +0 -1
- package/dist/generated/locales/en.cjs +0 -1
- package/dist/generated/locales/en.d.cts +0 -17
- package/dist/generated/locales/en.d.ts +0 -17
- package/dist/generated/locales/en.js +0 -1
- package/dist/generated/locales/fr.cjs +0 -1
- package/dist/generated/locales/fr.d.cts +0 -17
- package/dist/generated/locales/fr.d.ts +0 -17
- package/dist/generated/locales/fr.js +0 -1
- package/dist/generated/locales/nl.cjs +0 -1
- package/dist/generated/locales/nl.d.cts +0 -17
- package/dist/generated/locales/nl.d.ts +0 -17
- package/dist/generated/locales/nl.js +0 -1
- package/dist/themes/default.d.cts +0 -3
- package/dist/themes/default.d.ts +0 -3
- package/dist/themes/dolphin.d.cts +0 -3
- package/dist/themes/dolphin.d.ts +0 -3
- package/dist/themes/loader.cjs +0 -1
- package/dist/themes/loader.d.cts +0 -11
- package/dist/themes/loader.d.ts +0 -11
- package/dist/themes/loader.js +0 -1
- package/dist/themes/synthwave.d.cts +0 -3
- package/dist/themes/synthwave.d.ts +0 -3
- package/dist/utils/localization.cjs +0 -1
- package/dist/utils/localization.d.cts +0 -24
- package/dist/utils/localization.d.ts +0 -24
- package/dist/utils/localization.js +0 -1
- package/dist/utils/mave_element.cjs +0 -1
- package/dist/utils/mave_element.d.cts +0 -19
- package/dist/utils/mave_element.d.ts +0 -19
- package/dist/utils/mave_element.js +0 -1
- package/dist/utils/origin.cjs +0 -1
- package/dist/utils/origin.d.cts +0 -3
- package/dist/utils/origin.d.ts +0 -3
- package/dist/utils/origin.js +0 -1
- package/dist/utils/video_events.cjs +0 -1
- package/dist/utils/video_events.d.cts +0 -3
- package/dist/utils/video_events.d.ts +0 -3
- package/dist/utils/video_events.js +0 -1
package/dist/chunk-CVXHA76S.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-ZTDQPDC6.js';var b=e=>typeof e=="function"?e:function(){return e},_=typeof self<"u"?self:null,m=typeof window<"u"?window:null,f=_||m||globalThis,H="2.0.0",u={connecting:0,open:1,closing:2,closed:3},P=1e4,x=1e3,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},p={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},R={longpoll:"longpoll",websocket:"websocket"},B={complete:4},k="base64url.bearer.phx.",v=class{constructor(e,t,i,s){this.channel=e,this.event=t,this.payload=i||function(){return {}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=false;}resend(e){this.timeout=e,this.reset(),this.send();}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=true,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}));}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=false;}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t));}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent);}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null;}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e);}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{});},this.timeout);}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t});}},j=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0;}reset(){this.tries=0,clearTimeout(this.timer);}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback();},this.timerCalc(this.tries+1));}},$=class{constructor(e,t,i){this.state=c.closed,this.topic=e,this.params=b(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=false,this.joinPush=new v(this,p.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new j(()=>{this.socket.isConnected()&&this.rejoin();},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin();})),this.joinPush.receive("ok",()=>{this.state=c.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[];}),this.joinPush.receive("error",()=>{this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=c.closed,this.socket.remove(this);}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new v(this,p.leave,b({}),this.timeout).send(),this.state=c.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.on(p.reply,(s,r)=>{this.trigger(this.replyEventName(r),s);});}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=true,this.rejoin(),this.joinPush}onClose(e){this.on(p.close,e);}onError(e){return this.on(p.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t>"u"||t===i.ref)));}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new v(this,e,function(){return t},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=c.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(p.close,"leave");},i=new v(this,p.leave,b({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,s){return this.topic!==e?false:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:s}),false):true}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=c.joining,this.joinPush.resend(e));}trigger(e,t,i,s){let r=this.onMessage(e,t,i,s);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let n=this.bindings.filter(h=>h.event===e);for(let h=0;h<n.length;h++)n[h].callback(r,i,s||this.joinRef());}replyEventName(e){return `chan_reply_${e}`}isClosed(){return this.state===c.closed}isErrored(){return this.state===c.errored}isJoined(){return this.state===c.joined}isJoining(){return this.state===c.joining}isLeaving(){return this.state===c.leaving}},E=class{static request(e,t,i,s,r,n,h){if(f.XDomainRequest){let o=new f.XDomainRequest;return this.xdomainRequest(o,e,t,s,r,n,h)}else if(f.XMLHttpRequest){let o=new f.XMLHttpRequest;return this.xhrRequest(o,e,t,i,s,r,n,h)}else {if(f.fetch&&f.AbortController)return this.fetchRequest(e,t,i,s,r,n,h);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,i,s,r,n,h){let o={method:e,headers:i,body:s},a=null;if(r){a=new AbortController;setTimeout(()=>a.abort(),r);o.signal=a.signal;}return f.fetch(t,o).then(l=>l.text()).then(l=>this.parseJSON(l)).then(l=>h&&h(l)).catch(l=>{l.name==="AbortError"&&n?n():h&&h(null);}),a}static xdomainRequest(e,t,i,s,r,n,h){return e.timeout=r,e.open(t,i),e.onload=()=>{let o=this.parseJSON(e.responseText);h&&h(o);},n&&(e.ontimeout=n),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,i,s,r,n,h,o){e.open(t,i,true),e.timeout=n;for(let[a,l]of Object.entries(s))e.setRequestHeader(a,l);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===B.complete&&o){let a=this.parseJSON(e.responseText);o(a);}},h&&(e.ontimeout=h),e.send(r),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let r=t?`${t}[${s}]`:s,n=e[s];typeof n=="object"?i.push(this.serialize(n,r)):i.push(encodeURIComponent(r)+"="+encodeURIComponent(n));}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return `${e}${i}${this.serialize(t)}`}},O=e=>{let t="",i=new Uint8Array(e),s=i.byteLength;for(let r=0;r<s;r++)t+=String.fromCharCode(i[r]);return btoa(t)},T=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(k)&&(this.authToken=atob(t[1].slice(k.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=true,this.reqs=new Set,this.awaitingBatchAck=false,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=u.connecting,setTimeout(()=>this.poll(),0);}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R.websocket),"$1/"+R.longpoll)}endpointURL(){return E.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=u.connecting;}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",false);}isActive(){return this.readyState===u.open||this.readyState===u.connecting}poll(){let e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:i,token:s,messages:r}=t;if(i===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",false);return}this.token=s;}else i=0;switch(i){case 200:r.forEach(n=>{setTimeout(()=>this.onmessage({data:n}),0);}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=u.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",false);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${i}`)}});}send(e){typeof e!="string"&&(e=O(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null;},0));}batchSend(e){this.awaitingBatchAck=true,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
|
|
2
|
-
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=false,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",false)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]);});}close(e,t,i){for(let r of this.reqs)r.abort();this.readyState=u.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:true},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s);}ajax(e,t,i,s,r){let n,h=()=>{this.reqs.delete(n),s();};n=E.request(e,this.endpointURL(),t,i,this.timeout,h,o=>{this.reqs.delete(n),this.isActive()&&r(o);}),this.reqs.add(n);}};var C={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,r,n,h]=JSON.parse(e);return t({join_ref:i,ref:s,topic:r,event:n,payload:h})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:r,payload:n}=e,h=this.META_LENGTH+t.length+i.length+r.length+s.length,o=new ArrayBuffer(this.HEADER_LENGTH+h),a=new DataView(o),l=0;a.setUint8(l++,this.KINDS.push),a.setUint8(l++,t.length),a.setUint8(l++,i.length),a.setUint8(l++,r.length),a.setUint8(l++,s.length),Array.from(t,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(i,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(r,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(s,d=>a.setUint8(l++,d.charCodeAt(0)));var g=new Uint8Array(o.byteLength+n.byteLength);return g.set(new Uint8Array(o),0),g.set(new Uint8Array(n),o.byteLength),g.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,o=i.decode(e.slice(h,h+s));h=h+s;let a=i.decode(e.slice(h,h+r));h=h+r;let l=i.decode(e.slice(h,h+n));h=h+n;let g=e.slice(h,e.byteLength);return {join_ref:o,ref:null,topic:a,event:l,payload:g}},decodeReply(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,a=i.decode(e.slice(o,o+s));o=o+s;let l=i.decode(e.slice(o,o+r));o=o+r;let g=i.decode(e.slice(o,o+n));o=o+n;let d=i.decode(e.slice(o,o+h));o=o+h;let A=e.slice(o,e.byteLength),L={status:d,response:A};return {join_ref:a,ref:l,topic:g,event:p.reply,payload:L}},decodeBroadcast(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=this.HEADER_LENGTH+2,h=i.decode(e.slice(n,n+s));n=n+s;let o=i.decode(e.slice(n,n+r));n=n+r;let a=e.slice(n,e.byteLength);return {join_ref:null,ref:null,topic:h,event:o,payload:a}}},w=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||P,this.transport=t.transport||f.WebSocket||T,this.primaryPassedHealthCheck=false,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||f&&f.sessionStorage,this.establishedConnections=0,this.defaultEncoder=C.encode.bind(C),this.defaultDecoder=C.decode.bind(C),this.closeWasClean=false,this.disconnecting=false,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=false,this.transport!==T?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;m&&m.addEventListener&&(m.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock);}),m.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect());}),m.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=true:(this.pageHidden=false,this.isConnected()||this.teardown(()=>this.connect()));})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,r,n)=>{console.log(`${s}: ${r}`,n);}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=b(t.params||{}),this.endPoint=`${e}/${R.websocket}`,this.vsn=t.vsn||H,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new j(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect());},this.reconnectAfterMs),this.authToken=t.authToken;}getLongPollTransport(){return T}replaceTransport(e){this.connectClock++,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e;}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=E.appendParams(E.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.disconnecting=true,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=false,e&&e();},t,i);}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=b(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==T?this.connectWithFallback(T,this.longPollFallbackMs):this.transportConnect());}log(e,t,i){this.logger&&this.logger(e,t,i);}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return false;let t=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(r=>{r.ref===t&&(this.off([s]),e(Date.now()-i));});return true}transportConnect(){this.connectClock++,this.closeWasClean=false;let e;this.authToken&&(e=["phoenix",`${k}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t);}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t);}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let i=false,s=true,r,n,h=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([r,n]),s=false,this.replaceTransport(e),this.transportConnect();};if(this.getSession(`phx:fallback:${e.name}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),n=this.onError(o=>{this.log("transport","error",o),s&&!i&&(clearTimeout(this.fallbackTimer),h(o));}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=true,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(o=>{this.log("transport","connected to primary after",o),this.primaryPassedHealthCheck=true,clearTimeout(this.fallbackTimer);});}),this.transportConnect();}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer);}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=false,this.disconnecting=false,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e());}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=false,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),x,"heartbeat timeout"));}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs));}teardown(e,t,i){if(!this.conn)return e&&e();let s=this.connectClock;this.waitForBufferDone(()=>{s===this.connectClock&&(this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{s===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e());}));});}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1);},150*t);}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===u.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1);},150*t);}onConnClose(e){this.conn&&(this.conn.onclose=()=>{});let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e));}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(e,t,i);}),(t===this.transport||i>0)&&this.triggerChanError();}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(p.error);});}connectionState(){switch(this.conn&&this.conn.readyState){case u.connecting:return "connecting";case u.open:return "open";case u.closing:return "closing";default:return "closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e);}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1);}channel(e,t={}){let i=new $(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:s,ref:r,join_ref:n}=e;this.log("push",`${t} ${i} (${n}, ${r})`,s);}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)));}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs));}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[]);}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:s,payload:r,ref:n,join_ref:h}=t;n&&n===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${i} ${s} ${n&&"("+n+")"||""}`,r);for(let o=0;o<this.channels.length;o++){let a=this.channels[o];a.isMember(i,s,r,h)&&a.trigger(s,r,n,h);}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,a]=this.stateChangeCallbacks.message[o];a(t);}});}leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave());}};var y=class{static connect(t){if(typeof window>"u"){let n={on:()=>n,push:()=>n,join:()=>n,leave:()=>Promise.resolve(),off:()=>{}};return {token:t,channel:n}}let i=new w(a.upload.socket,{params:{token:t},reconnectAfterMs:n=>[1e3,3e3,5e3,1e4][n-1]||1e4});i.connect();let s=i.channel(`embed:${t}`),r={token:t,channel:s,socket:i};return s.on("initiate",({upload_id:n})=>{r.upload_id=n;}),s.join(),r}static async disconnect(t){if(t){try{await t.channel.leave();}catch{}t.socket?.disconnect();}}};
|
|
3
|
-
export{y as a};
|
package/dist/chunk-CWZPXTU2.cjs
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkTAKTIPT7_cjs=require('./chunk-TAKTIPT7.cjs'),chunkQQDH35OW_cjs=require('./chunk-QQDH35OW.cjs'),chunkDL4BV5IH_cjs=require('./chunk-DL4BV5IH.cjs'),chunk2E5GLLOS_cjs=require('./chunk-2E5GLLOS.cjs'),chunkNPP5B5PV_cjs=require('./chunk-NPP5B5PV.cjs'),chunkJHSFSCC2_cjs=require('./chunk-JHSFSCC2.cjs');var n=class extends chunk2E5GLLOS_cjs.g{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return chunkQQDH35OW_cjs.a(t)}open(t){if(this._player=t,t.aspect_ratio){let[i,s]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",i),this.style.setProperty("--frame-ratio-h",s);}this.style.display="block";let o=i=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",s=>{s.preventDefault(),this.close();},{once:true}),i(this);};return new Promise(i=>{if(this._dialog)o(i);else {let s=setInterval(()=>{this._dialog&&(o(i),clearInterval(s));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return chunk2E5GLLOS_cjs.a`
|
|
2
|
-
<dialog style=${this.styles}>
|
|
3
|
-
<div class="backdrop"></div>
|
|
4
|
-
<div class="content" @click=${this.possibleClose}>
|
|
5
|
-
<div class="wrapper">
|
|
6
|
-
<slot style="display: none;"></slot>
|
|
7
|
-
<div class="frame"></div>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="button-close" @click=${this.close}>
|
|
11
|
-
<svg
|
|
12
|
-
width="24px"
|
|
13
|
-
height="24px"
|
|
14
|
-
stroke-width="1"
|
|
15
|
-
viewBox="0 0 24 24"
|
|
16
|
-
fill="none"
|
|
17
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
-
color="currentColor"
|
|
19
|
-
>
|
|
20
|
-
<path
|
|
21
|
-
d="M6 12h6m6 0h-6m0 0V6m0 6v6"
|
|
22
|
-
stroke="currentColor"
|
|
23
|
-
stroke-width="1"
|
|
24
|
-
stroke-linecap="round"
|
|
25
|
-
stroke-linejoin="round"
|
|
26
|
-
></path>
|
|
27
|
-
</svg>
|
|
28
|
-
</div>
|
|
29
|
-
</dialog>
|
|
30
|
-
`}};n.styles=chunkNPP5B5PV_cjs.a`
|
|
31
|
-
:host {
|
|
32
|
-
all: initial;
|
|
33
|
-
--backdrop: black;
|
|
34
|
-
--frame-max-height: 100vh;
|
|
35
|
-
--frame-ratio-w: 16;
|
|
36
|
-
--frame-ratio-h: 9;
|
|
37
|
-
--backdrop-filter: blur(0);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
slot {
|
|
41
|
-
all: initial;
|
|
42
|
-
position: fixed;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
dialog {
|
|
46
|
-
display: block;
|
|
47
|
-
margin: 0;
|
|
48
|
-
padding: 0;
|
|
49
|
-
border: 0;
|
|
50
|
-
pointer-events: none;
|
|
51
|
-
background: transparent;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
dialog .content {
|
|
55
|
-
position: fixed;
|
|
56
|
-
width: 100vw;
|
|
57
|
-
height: 100vh;
|
|
58
|
-
top: 0;
|
|
59
|
-
left: 0;
|
|
60
|
-
opacity: 0;
|
|
61
|
-
display: flex;
|
|
62
|
-
justify-content: center;
|
|
63
|
-
align-items: center;
|
|
64
|
-
transform: scale(0.96);
|
|
65
|
-
transition-property: transform, opacity;
|
|
66
|
-
transition-duration: 200ms;
|
|
67
|
-
transition-timing-function: ease-out;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.backdrop {
|
|
71
|
-
position: fixed;
|
|
72
|
-
background: var(--backdrop);
|
|
73
|
-
backdrop-filter: var(--backdrop-filter);
|
|
74
|
-
opacity: 0;
|
|
75
|
-
top: 0;
|
|
76
|
-
left: 0;
|
|
77
|
-
width: 100vw;
|
|
78
|
-
height: 100vh;
|
|
79
|
-
transition-property: opacity;
|
|
80
|
-
transition-duration: 200ms;
|
|
81
|
-
transition-timing-function: ease-out;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
dialog[open] .backdrop {
|
|
85
|
-
opacity: 1;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
dialog::backdrop {
|
|
89
|
-
background: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
dialog[open] {
|
|
93
|
-
pointer-events: auto;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
dialog[open] .content {
|
|
97
|
-
opacity: 1;
|
|
98
|
-
transform: scale(1);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
dialog[open] .button-close {
|
|
102
|
-
display: block;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.button-close {
|
|
106
|
-
display: none;
|
|
107
|
-
position: fixed;
|
|
108
|
-
top: 0.8rem;
|
|
109
|
-
right: 0.6rem;
|
|
110
|
-
width: 2.75rem;
|
|
111
|
-
height: 2.75rem;
|
|
112
|
-
transition-property: transform;
|
|
113
|
-
transition-duration: 100ms;
|
|
114
|
-
transition-timing-function: ease-out;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.button-close:hover {
|
|
118
|
-
cursor: pointer;
|
|
119
|
-
transform: scale(1.3);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.button-close svg {
|
|
123
|
-
color: white;
|
|
124
|
-
width: 2.75rem;
|
|
125
|
-
height: 2.75rem;
|
|
126
|
-
transform: rotate(45deg);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.wrapper {
|
|
130
|
-
display: flex;
|
|
131
|
-
align-items: center;
|
|
132
|
-
justify-content: center;
|
|
133
|
-
width: 100%;
|
|
134
|
-
height: 100%;
|
|
135
|
-
max-width: 100vw;
|
|
136
|
-
max-height: var(--frame-max-height);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.frame {
|
|
140
|
-
--ratio: calc(var(--frame-ratio-h, 1) / var(--frame-ratio-w, 1) * 100%);
|
|
141
|
-
--frame-height: min(var(--ratio), var(--frame-max-height));
|
|
142
|
-
position: relative;
|
|
143
|
-
padding-bottom: var(--frame-height);
|
|
144
|
-
width: min(
|
|
145
|
-
calc(var(--frame-height, 0) * (var(--frame-ratio-w) / var(--frame-ratio-h))),
|
|
146
|
-
100%
|
|
147
|
-
);
|
|
148
|
-
height: 0;
|
|
149
|
-
overflow: hidden;
|
|
150
|
-
background-size: contain;
|
|
151
|
-
background-position: center center;
|
|
152
|
-
background-repeat: no-repeat;
|
|
153
|
-
}
|
|
154
|
-
`,chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.c("dialog")],n.prototype,"_dialog",2),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.c(".content")],n.prototype,"_content",2),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.c(".frame")],n.prototype,"_frame",2),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.c(".backdrop")],n.prototype,"_backdrop",2),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a()],n.prototype,"backdrop",1),chunkJHSFSCC2_cjs.c([chunkDL4BV5IH_cjs.a({attribute:"backdrop-filter"})],n.prototype,"backdropFilter",1);typeof window<"u"&&window.customElements&&(window.customElements.get("mave-pop")||window.customElements.define("mave-pop",n));function E(l){let t={};if(!l)return t;for(let o=0;o<l.attributes.length;o++){let i=l.attributes[o];t[i.name]=i.value;}return t}var x=()=>typeof document<"u"?document:void 0,_=l=>{let t=x();if(!t)return;let o=t;function i(c){let e,r,a=o.querySelector(`mave-pop[embed="${c}"]`);if(a)return r=E(a.querySelector("mave-player")),e=a,{pop:e,attributes:r};let p=o.querySelector("mave-pop:not([embed])");return p?(r=E(p.querySelector("mave-player")),e=p,{pop:e,attributes:r}):(e=new n,o.body.appendChild(e),{pop:e})}function s(c,e){let r=new chunkTAKTIPT7_cjs.a;if(e)for(let a in e)r.setAttribute(a,e[a]);return r.embed=c,r}function g(c){c.querySelectorAll("[x-mave-pop]").forEach(e=>{let r=e.getAttribute("x-mave-pop")||e.getAttribute("embed");if(!r)return;let{pop:a,attributes:p}=i(r);s(r,p),e.addEventListener("click",L=>{L.preventDefault();let M=o.querySelectorAll("mave-player");if(!Array.from(M).find(m=>m.popped)){let m=s(r,p);a.open(m).then(()=>{m.play();}),a.addEventListener("closed",()=>{m.pause();});}});});}g(l),new MutationObserver(c=>{for(let e of c)e.type==="childList"&&e.addedNodes.forEach(r=>{r instanceof HTMLElement&&g(r);});}).observe(o.body,{childList:true,subtree:true});},f=x();f&&(f.readyState==="loading"?f.addEventListener("DOMContentLoaded",()=>{_(f);}):setTimeout(()=>_(f),500));exports.a=n;exports.b=_;
|
package/dist/chunk-DL4BV5IH.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkNPP5B5PV_cjs=require('./chunk-NPP5B5PV.cjs');var f={attribute:true,type:String,converter:chunkNPP5B5PV_cjs.b,reflect:false,hasChanged:chunkNPP5B5PV_cjs.c},h=(e=f,o,t)=>{let{kind:a,metadata:c}=t,i=globalThis.litPropertyMetadata.get(c);if(i===void 0&&globalThis.litPropertyMetadata.set(c,i=new Map),a==="setter"&&((e=Object.create(e)).wrapped=true),i.set(t.name,e),a==="accessor"){let{name:n}=t;return {set(s){let r=o.get.call(this);o.set.call(this,s),this.requestUpdate(n,r,e,true,s);},init(s){return s!==void 0&&this.C(n,void 0,e,s),s}}}if(a==="setter"){let{name:n}=t;return function(s){let r=this[n];o.call(this,s),this.requestUpdate(n,r,e,true,s);}}throw Error("Unsupported decorator location: "+a)};function d(e){return (o,t)=>typeof t=="object"?h(e,o,t):((a,c,i)=>{let n=c.hasOwnProperty(i);return c.constructor.createProperty(i,a),n?Object.getOwnPropertyDescriptor(c,i):void 0})(e,o,t)}function b(e){return d({...e,state:true,attribute:false})}var u=(e,o,t)=>(t.configurable=true,t.enumerable=true,Reflect.decorate&&typeof o!="object"&&Object.defineProperty(e,o,t),t);function E(e,o){return (t,a,c)=>{let i=n=>n.renderRoot?.querySelector(e)??null;if(o){let{get:n,set:s}=typeof a=="object"?t:c??(()=>{let r=Symbol();return {get(){return this[r]},set(m){this[r]=m;}}})();return u(t,a,{get(){let r=n.call(this);return r===void 0&&(r=i(this),(r!==null||this.hasUpdated)&&s.call(this,r)),r}})}return u(t,a,{get(){return i(this)}})}}/*! Bundled license information:
|
|
2
|
-
|
|
3
|
-
@lit/reactive-element/decorators/property.js:
|
|
4
|
-
@lit/reactive-element/decorators/state.js:
|
|
5
|
-
@lit/reactive-element/decorators/base.js:
|
|
6
|
-
@lit/reactive-element/decorators/query.js:
|
|
7
|
-
@lit/reactive-element/decorators/custom-element.js:
|
|
8
|
-
@lit/reactive-element/decorators/event-options.js:
|
|
9
|
-
@lit/reactive-element/decorators/query-all.js:
|
|
10
|
-
@lit/reactive-element/decorators/query-async.js:
|
|
11
|
-
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
12
|
-
(**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2017 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*)
|
|
17
|
-
|
|
18
|
-
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
19
|
-
(**
|
|
20
|
-
* @license
|
|
21
|
-
* Copyright 2021 Google LLC
|
|
22
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*)
|
|
24
|
-
*/exports.a=d;exports.b=b;exports.c=E;
|
package/dist/chunk-DXS4BF7U.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-P6SBZPDR.js';var c="lit-localize-status";var I=t=>typeof t!="string"&&"strTag"in t,p=(t,e,o)=>{let n=t[0];for(let r=1;r<t.length;r++)n+=e[o?o[r-1]:r-1],n+=t[r];return n};var d=(t=>I(t)?p(t.strings,t.values):t);var _=d,C=false;function E(t){if(C)throw new Error("lit-localize can only be configured once");_=t,C=true;}var w=class{constructor(e){this.__litLocalizeEventHandler=o=>{o.detail.status==="ready"&&this.host.requestUpdate();},this.host=e;}hostConnected(){window.addEventListener(c,this.__litLocalizeEventHandler);}hostDisconnected(){window.removeEventListener(c,this.__litLocalizeEventHandler);}},N=t=>t.addController(new w(t)),z=N;var W=()=>(t,e)=>(t.addInitializer(z),t);var u=class{constructor(){this.settled=false,this.promise=new Promise((e,o)=>{this._resolve=e,this._reject=o;});}resolve(e){this.settled=true,this._resolve(e);}reject(e){this.settled=true,this._reject(e);}};var i=[];for(let t=0;t<256;t++)i[t]=(t>>4&15).toString(16)+(t&15).toString(16);function A(t){let e=0,o=8997,n=0,r=33826,s=0,l=40164,L=0,f=52210;for(let v=0;v<t.length;v++)o^=t.charCodeAt(v),e=o*435,n=r*435,s=l*435,L=f*435,s+=o<<8,L+=r<<8,n+=e>>>16,o=e&65535,s+=n>>>16,r=n&65535,f=L+(s>>>16)&65535,l=s&65535;return i[f>>8]+i[f&255]+i[l>>8]+i[l&255]+i[r>>8]+i[r&255]+i[o>>8]+i[o&255]}var $="",b="h",O="s";function R(t,e){return (e?b:O)+A(typeof t=="string"?t:t.join($))}var j=new WeakMap,H=new Map;function P(t,e,o){if(t){let n=o?.id??k(e),r=t[n];if(r){if(typeof r=="string")return r;if("strTag"in r)return p(r.strings,e.values,r.values);{let s=j.get(r);return s===void 0&&(s=r.values,j.set(r,s)),{...r,values:s.map(l=>e.values[l])}}}}return d(e)}function k(t){let e=typeof t=="string"?t:t.strings,o=H.get(e);return o===void 0&&(o=R(e,typeof t!="string"&&!("strTag"in t)),H.set(e,o)),o}function S(t){window.dispatchEvent(new CustomEvent(c,{detail:t}));}var g="",y,U,h,T,V,a=new u;a.resolve();var m=0,q=t=>(E(((e,o)=>P(V,e,o))),g=U=t.sourceLocale,h=new Set(t.targetLocales),h.add(t.sourceLocale),T=t.loadLocale,{getLocale:X,setLocale:G}),X=()=>g,G=t=>{if(t===(y??g))return a.promise;if(!h||!T)throw new Error("Internal error");if(!h.has(t))throw new Error("Invalid locale code");m++;let e=m;return y=t,a.settled&&(a=new u),S({status:"loading",loadingLocale:t}),(t===U?Promise.resolve({templates:void 0}):T(t)).then(n=>{m===e&&(g=t,y=void 0,V=n.templates,S({status:"ready",readyLocale:t}),a.resolve());},n=>{m===e&&(S({status:"error",errorLocale:t,errorMessage:n.toString()}),a.reject(n));}),a.promise};var B={en:()=>import('./generated/locales/en.js'),nl:()=>import('./generated/locales/nl.js'),de:()=>import('./generated/locales/de.js'),fr:()=>import('./generated/locales/fr.js')};function J(t){return B[t]}async function D(t){let e=a$1();if(!e)return null;try{return await import(new URL(`./${e}generated/locales/${t}.js`,import.meta.url).href)}catch{return null}}var K=q({sourceLocale:"default",targetLocales:["en","nl","de","fr"],loadLocale:async t=>{if(a$1()){let n=await D(t);if(n)return n}let e=J(t);if(e)try{return await e()}catch(n){console.error(`[mave-player]: failed to load locale ${t}`,n);}let o=await D(t);return o||(console.log(`[mave-player]: locale not loaded for ${t}`),null)}}),M=false,F=class{constructor(e){this._onLoad=e=>{e.detail.status==="loading"?M=false:e.detail.status==="ready"&&(M=true),this.host.requestUpdate();};this.host=e,e.addController(this);}get loaded(){return M}set locale(e){this._locale!==e&&(K.setLocale(e),this.host.requestUpdate());}get locale(){return this._locale}hostConnected(){typeof window<"u"&&window.addEventListener("lit-localize-status",this._onLoad);}hostDisconnected(){typeof window<"u"&&window.removeEventListener("lit-localize-status",this._onLoad);}};/*! Bundled license information:
|
|
2
|
-
|
|
3
|
-
@lit/localize/internal/locale-status-event.js:
|
|
4
|
-
@lit/localize/internal/str-tag.js:
|
|
5
|
-
@lit/localize/internal/types.js:
|
|
6
|
-
@lit/localize/internal/default-msg.js:
|
|
7
|
-
@lit/localize/internal/localized-controller.js:
|
|
8
|
-
@lit/localize/internal/localized-decorator.js:
|
|
9
|
-
@lit/localize/internal/runtime-msg.js:
|
|
10
|
-
@lit/localize/init/runtime.js:
|
|
11
|
-
@lit/localize/init/transform.js:
|
|
12
|
-
(**
|
|
13
|
-
* @license
|
|
14
|
-
* Copyright 2021 Google LLC
|
|
15
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*)
|
|
17
|
-
|
|
18
|
-
@lit/localize/internal/deferred.js:
|
|
19
|
-
@lit/localize/internal/id-generation.js:
|
|
20
|
-
@lit/localize/lit-localize.js:
|
|
21
|
-
(**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2020 Google LLC
|
|
24
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*)
|
|
26
|
-
|
|
27
|
-
@lit/localize/internal/fnv1a64.js:
|
|
28
|
-
(**
|
|
29
|
-
* @license
|
|
30
|
-
* Copyright 2014 Travis Webb
|
|
31
|
-
* SPDX-License-Identifier: MIT
|
|
32
|
-
*)
|
|
33
|
-
*/export{_ as a,W as b,K as c,F as d};
|
package/dist/chunk-EVKPEPYP.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var e={metrics:{enabled:true,endpoint:"https://metrics.video-dns.com/v1/events"},upload:{socket:"wss://app.mave.io/api/v1/socket",endpoint:"https://upload.mave.io/files"},api:{endpoint:"https://mave.io/api/v1"},cdn:{endpoint:"https://space-${this.spaceId}.video-dns.com"}};function o(t){Object.assign(e,t);}
|
|
2
|
-
exports.a=e;exports.b=o;
|
package/dist/chunk-FAONFKQ2.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';var chunk2E5GLLOS_cjs=require('./chunk-2E5GLLOS.cjs');var e=t=>t??chunk2E5GLLOS_cjs.e;/*! Bundled license information:
|
|
2
|
-
|
|
3
|
-
lit-html/directives/if-defined.js:
|
|
4
|
-
(**
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright 2018 Google LLC
|
|
7
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
-
*)
|
|
9
|
-
*/exports.a=e;
|
package/dist/chunk-GXOLIMQT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-P6SBZPDR.js';import {g,a}from'./chunk-5PIHL662.js';import {a as a$1}from'./chunk-YPCQNE3R.js';var d=["default","synthwave","dolphin"],h={default:()=>import('./themes/default.js'),synthwave:()=>import('./themes/synthwave.js'),dolphin:()=>import('./themes/dolphin.js')};async function p(t){if(!d.includes(t))return;let n=!!a$2();if(!n){let c=h[t];if(c)try{return await c()}catch{}}let s=n?`./dist/themes/${t}.js`:`./themes/${t}.js`,e=new URL(s,import.meta.url).href;return l(e)}async function l(t){return import(t)}var m=class t{constructor(){this.themes=[];}static async get(n,s){if(t.instance||(t.instance=new t),t.instance.themes.find(e=>e.name===n))return t.instance.currentTheme=n,Promise.resolve(t.instance);t.instance.themes.push({name:n}),t.instance.currentTheme=n;try{if(typeof document<"u"&&!d.includes(n)){let e=document.createElement("link");e.rel="stylesheet",e.href=`${s}/${n}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}try{if(s&&!d.includes(n)){let{build:e}=await l(`${s}/${n}.js`);e(n,g,a,a$1);}else {let e=await p(n);if(e)e.build(n,g,a,a$1);else {let c=`./${a$2()}themes/${n}.js`,{build:u}=await l(c);u(n,g,a,a$1);}}}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static async external(n){t.instance||(t.instance=new t);let s=n.split("/").pop()?.replace(".js","")||"";try{if(typeof document<"u"){let e=document.createElement("link");e.rel="stylesheet",e.href=`${n.replace(".js","")}.css`,document.head.appendChild(e);}}catch(e){console.log("[mave-player]: theme css not loaded",e);}if(t.instance.themes.find(e=>e.name===s))return t.instance.currentTheme=s,Promise.resolve(t.instance);t.instance.themes.push({name:s}),t.instance.currentTheme=s;try{let{build:e}=await l(n);e(s,g,a,a$1);}catch(e){console.log("[mave-player]: theme not loaded",e);}return Promise.resolve(t.instance)}static getTheme(){return t.instance?t.instance.currentTheme:""}};export{m as a};
|
package/dist/chunk-HMVS6DJE.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {o as o$1,q as q$1,b as b$1,C as C$1,s,L as L$1,y,x as x$1,w as w$1,r as r$1,n,M as M$1,a as a$1,p as p$1,v as v$1,K as K$1}from'./chunk-3UQNIS3L.js';import {e,g as g$1,d,f}from'./chunk-KA24PL7V.js';function Le({anchor:t,floating:e,placement:i}){let n=Je({anchor:t,floating:e}),{x:s,y:l}=je(n,i);return {x:s,y:l}}function Je({anchor:t,floating:e}){return {anchor:Ve(t,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function Ve(t,e){var i;let n=t.getBoundingClientRect(),s=(i=e?.getBoundingClientRect())!=null?i:{x:0,y:0};return {x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height}}function je({anchor:t,floating:e},i){let n=et(i)==="x"?"y":"x",s=n==="y"?"height":"width",l=Re(i),h=t.x+t.width/2-e.width/2,c=t.y+t.height/2-e.height/2,d=t[s]/2-e[s]/2,f;switch(l){case "top":f={x:h,y:t.y-e.height};break;case "bottom":f={x:h,y:t.y+t.height};break;case "right":f={x:t.x+t.width,y:c};break;case "left":f={x:t.x-e.width,y:c};break;default:f={x:t.x,y:t.y};}switch(i.split("-")[1]){case "start":f[n]-=d;break;case "end":f[n]+=d;break}return f}function Re(t){return t.split("-")[0]}function et(t){return ["top","bottom"].includes(Re(t))?"y":"x"}var We=new WeakMap,ie=t=>{let e=We.get(t);return e||We.set(t,e=new Set),e},He=new o$1.ResizeObserver(t=>{for(let e of t)for(let i of ie(e.target))i(e);});function L(t,e){ie(t).add(e),He.observe(t);}function R(t,e){let i=ie(t);i.delete(e),i.size||He.unobserve(t);}var fe=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},o=(t,e,i)=>(fe(t,e,"read from private field"),i?i.call(t):e.get(t)),a=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i);},p=(t,e,i,n)=>(fe(t,e,"write to private field"),e.set(t,i),i),r=(t,e,i)=>(fe(t,e,"access private method"),i),v,w,x,z,N,E,O,ne,Oe,Z,pe,F,K,se,oe,De,ae,Pe,re,qe,I,C,M,D,Y,ve,le,$e,ge,Be,he,ze,be,Ne,de,Ke,ce,Ue,W,G,ue,Ze,H,Q,U,me;function Fe({type:t,text:e,value:i,checked:n}){let s=p$1.createElement("media-chrome-menu-item");s.type=t??"",s.part.add("menu-item"),t&&s.part.add(t),s.value=i,s.checked=n;let l=p$1.createElement("span");return l.textContent=e,s.append(l),s}function Ye(t,e){let i=t.querySelector(`:scope > [slot="${e}"]`);if(i?.nodeName=="SLOT"&&(i=i.assignedElements({flatten:true})[0]),i)return i=i.cloneNode(true),i;let n=t.shadowRoot.querySelector(`[name="${e}"] > svg`);return n?n.cloneNode(true):""}function tt(t){return `
|
|
2
|
-
<style>
|
|
3
|
-
:host {
|
|
4
|
-
font: var(--media-font,
|
|
5
|
-
var(--media-font-weight, normal)
|
|
6
|
-
var(--media-font-size, 14px) /
|
|
7
|
-
var(--media-text-content-height, var(--media-control-height, 24px))
|
|
8
|
-
var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));
|
|
9
|
-
color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));
|
|
10
|
-
--_menu-bg: rgb(20 20 30 / .8);
|
|
11
|
-
background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg))));
|
|
12
|
-
border-radius: var(--media-menu-border-radius);
|
|
13
|
-
border: var(--media-menu-border, none);
|
|
14
|
-
display: var(--media-menu-display, inline-flex) !important;
|
|
15
|
-
|
|
16
|
-
transition: var(--media-menu-transition-in,
|
|
17
|
-
visibility 0s,
|
|
18
|
-
opacity .2s ease-out,
|
|
19
|
-
transform .15s ease-out,
|
|
20
|
-
left .2s ease-in-out,
|
|
21
|
-
min-width .2s ease-in-out,
|
|
22
|
-
min-height .2s ease-in-out
|
|
23
|
-
) !important;
|
|
24
|
-
|
|
25
|
-
visibility: var(--media-menu-visibility, visible);
|
|
26
|
-
opacity: var(--media-menu-opacity, 1);
|
|
27
|
-
max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px));
|
|
28
|
-
transform: var(--media-menu-transform-in, translateY(0) scale(1));
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
|
|
31
|
-
min-height: 0;
|
|
32
|
-
position: relative;
|
|
33
|
-
bottom: var(--_menu-bottom);
|
|
34
|
-
box-sizing: border-box;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@-moz-document url-prefix() {
|
|
38
|
-
:host{
|
|
39
|
-
--_menu-bg: rgb(20 20 30);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
:host([hidden]) {
|
|
44
|
-
transition: var(--media-menu-transition-out,
|
|
45
|
-
visibility .15s ease-in,
|
|
46
|
-
opacity .15s ease-in,
|
|
47
|
-
transform .15s ease-in
|
|
48
|
-
) !important;
|
|
49
|
-
visibility: var(--media-menu-hidden-visibility, hidden);
|
|
50
|
-
opacity: var(--media-menu-hidden-opacity, 0);
|
|
51
|
-
max-height: var(--media-menu-hidden-max-height,
|
|
52
|
-
var(--media-menu-max-height, var(--_menu-max-height, 300px)));
|
|
53
|
-
transform: var(--media-menu-transform-out, translateY(2px) scale(.99));
|
|
54
|
-
pointer-events: none;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
:host([slot="submenu"]) {
|
|
58
|
-
background: none;
|
|
59
|
-
width: 100%;
|
|
60
|
-
min-height: 100%;
|
|
61
|
-
position: absolute;
|
|
62
|
-
bottom: 0;
|
|
63
|
-
right: -100%;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
#container {
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-direction: column;
|
|
69
|
-
min-height: 0;
|
|
70
|
-
transition: transform .2s ease-out;
|
|
71
|
-
transform: translate(0, 0);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
#container.has-expanded {
|
|
75
|
-
transition: transform .2s ease-in;
|
|
76
|
-
transform: translate(-100%, 0);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
button {
|
|
80
|
-
background: none;
|
|
81
|
-
color: inherit;
|
|
82
|
-
border: none;
|
|
83
|
-
padding: 0;
|
|
84
|
-
font: inherit;
|
|
85
|
-
outline: inherit;
|
|
86
|
-
display: inline-flex;
|
|
87
|
-
align-items: center;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
slot[name="header"][hidden] {
|
|
91
|
-
display: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
slot[name="header"] > *,
|
|
95
|
-
slot[name="header"]::slotted(*) {
|
|
96
|
-
padding: .4em .7em;
|
|
97
|
-
border-bottom: 1px solid rgb(255 255 255 / .25);
|
|
98
|
-
cursor: var(--media-cursor, default);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
slot[name="header"] > button[part~="back"],
|
|
102
|
-
slot[name="header"]::slotted(button[part~="back"]) {
|
|
103
|
-
cursor: var(--media-cursor, pointer);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
svg[part~="back"] {
|
|
107
|
-
height: var(--media-menu-icon-height, var(--media-control-height, 24px));
|
|
108
|
-
fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));
|
|
109
|
-
display: block;
|
|
110
|
-
margin-right: .5ch;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
slot:not([name]) {
|
|
114
|
-
gap: var(--media-menu-gap);
|
|
115
|
-
flex-direction: var(--media-menu-flex-direction, column);
|
|
116
|
-
overflow: var(--media-menu-overflow, hidden auto);
|
|
117
|
-
display: flex;
|
|
118
|
-
min-height: 0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
:host([role="menu"]) slot:not([name]) {
|
|
122
|
-
padding-block: .4em;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
slot:not([name])::slotted([role="menu"]) {
|
|
126
|
-
background: none;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
media-chrome-menu-item > span {
|
|
130
|
-
margin-right: .5ch;
|
|
131
|
-
max-width: var(--media-menu-item-max-width);
|
|
132
|
-
text-overflow: ellipsis;
|
|
133
|
-
overflow: hidden;
|
|
134
|
-
}
|
|
135
|
-
</style>
|
|
136
|
-
<style id="layout-row" media="width:0">
|
|
137
|
-
|
|
138
|
-
slot[name="header"] > *,
|
|
139
|
-
slot[name="header"]::slotted(*) {
|
|
140
|
-
padding: .4em .5em;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
slot:not([name]) {
|
|
144
|
-
gap: var(--media-menu-gap, .25em);
|
|
145
|
-
flex-direction: var(--media-menu-flex-direction, row);
|
|
146
|
-
padding-inline: .5em;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
media-chrome-menu-item {
|
|
150
|
-
padding: .3em .5em;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
media-chrome-menu-item[aria-checked="true"] {
|
|
154
|
-
background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2));
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
media-chrome-menu-item::part(checked-indicator) {
|
|
159
|
-
display: var(--media-menu-item-checked-indicator-display, none);
|
|
160
|
-
}
|
|
161
|
-
</style>
|
|
162
|
-
<div id="container" part="container">
|
|
163
|
-
<slot name="header" hidden>
|
|
164
|
-
<button part="back button" aria-label="Back to previous menu">
|
|
165
|
-
<slot name="back-icon">
|
|
166
|
-
<svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator">
|
|
167
|
-
<path d="m11.88 17.585.742-.669-4.2-4.665 4.2-4.666-.743-.669-4.803 5.335 4.803 5.334Z"/>
|
|
168
|
-
</svg>
|
|
169
|
-
</slot>
|
|
170
|
-
<slot name="title"></slot>
|
|
171
|
-
</button>
|
|
172
|
-
</slot>
|
|
173
|
-
<slot></slot>
|
|
174
|
-
</div>
|
|
175
|
-
<slot name="checked-indicator" hidden></slot>
|
|
176
|
-
`}var _={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"},S=class extends o$1.HTMLElement{constructor(){if(super(),a(this,ne),a(this,Z),a(this,K),a(this,oe),a(this,ae),a(this,re),a(this,M),a(this,Y),a(this,le),a(this,ge),a(this,he),a(this,be),a(this,de),a(this,ce),a(this,W),a(this,ue),a(this,H),a(this,U),a(this,v,null),a(this,w,null),a(this,x,null),a(this,z,new Set),a(this,N,void 0),a(this,E,false),a(this,O,null),a(this,F,()=>{let e=o(this,z),i=new Set(this.items);for(let n of e)i.has(n)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:n}));for(let n of i)e.has(n)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:n}));p(this,z,i);}),a(this,I,()=>{r(this,M,D).call(this),r(this,Y,ve).call(this,false);}),a(this,C,()=>{r(this,M,D).call(this);}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=q$1(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e);}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),p(this,N,new MutationObserver(o(this,F))),o(this,N).observe(this.defaultSlot,{childList:true});}static get observedAttributes(){return [_.DISABLED,_.HIDDEN,_.STYLE,_.ANCHOR,b$1.MEDIA_CONTROLLER]}static formatMenuItemText(e,i){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this);}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this);}handleEvent(e){switch(e.type){case "slotchange":r(this,ne,Oe).call(this,e);break;case "invoke":r(this,oe,De).call(this,e);break;case "click":r(this,le,$e).call(this,e);break;case "toggle":r(this,he,ze).call(this,e);break;case "focusout":r(this,de,Ke).call(this,e);break;case "keydown":r(this,ce,Ue).call(this,e);break}}connectedCallback(){var e,i;p(this,O,C$1(this.shadowRoot,":host")),r(this,K,se).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),p(this,v,s(this)),(i=(e=o(this,v))==null?void 0:e.associateElement)==null||i.call(e,this),this.hidden||(L(P(this),o(this,I)),L(this,o(this,C))),r(this,Z,pe).call(this);}disconnectedCallback(){var e,i;R(P(this),o(this,I)),R(this,o(this,C)),this.disable(),(i=(e=o(this,v))==null?void 0:e.unassociateElement)==null||i.call(e,this),p(this,v,null);}attributeChangedCallback(e,i,n){var s$1,l,h,c;e===_.HIDDEN&&n!==i?(o(this,E)||p(this,E,true),this.hidden?r(this,re,qe).call(this):r(this,ae,Pe).call(this),this.dispatchEvent(new L$1({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:true}))):e===b$1.MEDIA_CONTROLLER?(i&&((l=(s$1=o(this,v))==null?void 0:s$1.unassociateElement)==null||l.call(s$1,this),p(this,v,null)),n&&this.isConnected&&(p(this,v,s(this)),(c=(h=o(this,v))==null?void 0:h.associateElement)==null||c.call(h,this))):e===_.DISABLED&&n!==i?n==null?this.enable():this.disable():e===_.STYLE&&n!==i&&r(this,K,se).call(this);}formatMenuItemText(e,i){return this.constructor.formatMenuItemText(e,i)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`);}get anchorElement(){var e;return this.anchor?(e=y(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:true}).filter(it)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,i;return (i=(e=this.checkedItems[0])==null?void 0:e.value)!=null?i:""}set value(e){let i=this.items.find(n=>n.value===e);i&&r(this,U,me).call(this,i);}focus(){if(p(this,w,x$1()),this.items.length){r(this,H,Q).call(this,this.items[0]),this.items[0].focus();return}let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e?.focus();}handleSelect(e){var i;let n=r(this,W,G).call(this,e);n&&(r(this,U,me).call(this,n,n.type==="checkbox"),o(this,x)&&!this.hidden&&((i=o(this,w))==null||i.focus(),this.hidden=true));}get keysUsed(){return ["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var i,n;let{key:s}=e,l=this.items,h=(n=(i=r(this,W,G).call(this,e))!=null?i:r(this,ue,Ze).call(this))!=null?n:l[0],c=l.indexOf(h),d=Math.max(0,c);s==="ArrowDown"?d++:s==="ArrowUp"?d--:e.key==="Home"?d=0:e.key==="End"&&(d=l.length-1),d<0&&(d=l.length-1),d>l.length-1&&(d=0),r(this,H,Q).call(this,l[d]),l[d].focus();}};v=new WeakMap;w=new WeakMap;x=new WeakMap;z=new WeakMap;N=new WeakMap;E=new WeakMap;O=new WeakMap;ne=new WeakSet;Oe=function(t){let e=t.target;for(let i of e.assignedNodes({flatten:true}))i.nodeType===3&&i.textContent.trim()===""&&i.remove();["header","title"].includes(e.name)&&r(this,Z,pe).call(this),e.name||o(this,F).call(this);};Z=new WeakSet;pe=function(){let t=this.shadowRoot.querySelector('slot[name="header"]'),e=this.shadowRoot.querySelector('slot[name="title"]');t.hidden=e.assignedNodes().length===0&&t.assignedNodes().length===0;};F=new WeakMap;K=new WeakSet;se=function(){var t;let e=this.shadowRoot.querySelector("#layout-row"),i=(t=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:t.trim();e.setAttribute("media",i==="row"?"":"width:0");};oe=new WeakSet;De=function(t){p(this,x,t.relatedTarget),v$1(this,t.relatedTarget)||(this.hidden=!this.hidden);};ae=new WeakSet;Pe=function(){var t;(t=o(this,x))==null||t.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:true}),L(P(this),o(this,I)),L(this,o(this,C));};re=new WeakSet;qe=function(){var t;(t=o(this,x))==null||t.setAttribute("aria-expanded","false"),R(P(this),o(this,I)),R(this,o(this,C));};I=new WeakMap;C=new WeakMap;M=new WeakSet;D=function(t){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:e,y:i}=Le({anchor:this.anchorElement,floating:this,placement:"top-start"});t??(t=this.offsetWidth);let s=P(this).getBoundingClientRect(),l=s.width-e-t,h=s.height-i-this.offsetHeight,{style:c}=o(this,O);c.setProperty("position","absolute"),c.setProperty("right",`${Math.max(0,l)}px`),c.setProperty("--_menu-bottom",`${h}px`);let d=getComputedStyle(this),Qe=c.getPropertyValue("--_menu-bottom")===d.bottom?h:parseFloat(d.bottom),Xe=s.height-Qe-parseFloat(d.marginBottom);this.style.setProperty("--_menu-max-height",`${Xe}px`);};Y=new WeakSet;ve=function(t){let e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=e?.querySelector('[role="menu"]'),{style:n}=o(this,O);if(t||n.setProperty("--media-menu-transition-in","none"),i){let s=i.offsetHeight,l=Math.max(i.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${l}px`),this.style.setProperty("min-height",`${s}px`),r(this,M,D).call(this,l);}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),r(this,M,D).call(this);n.removeProperty("--media-menu-transition-in");};le=new WeakSet;$e=function(t){var e;if(t.stopPropagation(),t.composedPath().includes(o(this,ge,Be))){(e=o(this,w))==null||e.focus(),this.hidden=true;return}let i=r(this,W,G).call(this,t);!i||i.hasAttribute("disabled")||(r(this,H,Q).call(this,i),this.handleSelect(t));};ge=new WeakSet;Be=function(){var t;return (t=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:true}))==null?void 0:t.find(i=>i.matches('button[part~="back"]'))};he=new WeakSet;ze=function(t){if(t.target===this)return;r(this,be,Ne).call(this);let e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of e)i.invokeTargetElement!=t.target&&t.newState=="open"&&i.getAttribute("aria-expanded")=="true"&&!i.invokeTargetElement.hidden&&i.invokeTargetElement.dispatchEvent(new K$1({relatedTarget:i}));for(let i of e)i.setAttribute("aria-expanded",`${!i.submenuElement.hidden}`);r(this,Y,ve).call(this,true);};be=new WeakSet;Ne=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e);};de=new WeakSet;Ke=function(t){var e;v$1(this,t.relatedTarget)||(o(this,E)&&((e=o(this,w))==null||e.focus()),o(this,x)&&o(this,x)!==t.relatedTarget&&!this.hidden&&(this.hidden=true));};ce=new WeakSet;Ue=function(t){var e,i,n,s,l;let{key:h,ctrlKey:c,altKey:d,metaKey:f}=t;if(!(c||d||f)&&this.keysUsed.includes(h))if(t.preventDefault(),t.stopPropagation(),h==="Tab"){if(o(this,E)){this.hidden=true;return}t.shiftKey?(i=(e=this.previousElementSibling)==null?void 0:e.focus)==null||i.call(e):(s=(n=this.nextElementSibling)==null?void 0:n.focus)==null||s.call(n),this.blur();}else h==="Escape"?((l=o(this,w))==null||l.focus(),o(this,E)&&(this.hidden=true)):h==="Enter"||h===" "?this.handleSelect(t):this.handleMove(t);};W=new WeakSet;G=function(t){return t.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};ue=new WeakSet;Ze=function(){return this.items.find(t=>t.tabIndex===0)};H=new WeakSet;Q=function(t){for(let e of this.items)e.tabIndex=e===t?0:-1;};U=new WeakSet;me=function(t,e){let i=[...this.checkedItems];t.type==="radio"&&this.radioGroupItems.forEach(n=>n.checked=false),e?t.checked=!t.checked:t.checked=true,this.checkedItems.some((n,s)=>n!=i[s])&&this.dispatchEvent(new Event("change",{bubbles:true,composed:true}));};S.shadowRootOptions={mode:"open"};S.getTemplateHTML=tt;function it(t){return ["menuitem","menuitemradio","menuitemcheckbox"].includes(t?.role)}function P(t){var e;return (e=t.getAttribute("bounds")?w$1(t,`#${t.getAttribute("bounds")}`):r$1(t)||t.parentElement)!=null?e:t}o$1.customElements.get("media-chrome-menu")||o$1.customElements.define("media-chrome-menu",S);var nt=`<svg aria-hidden="true" viewBox="0 0 24 24">
|
|
177
|
-
<path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>
|
|
178
|
-
<path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/>
|
|
179
|
-
</svg>`,k,g,b,ye,q,B,ke=class extends S{constructor(){super(...arguments);e(this,b);e(this,k,[]);e(this,g);e(this,B,()=>{let i=this.value??d(this,g);i!=null&&(f(this,g,String(i)),this.dispatchEvent(new o$1.CustomEvent(a$1.MEDIA_AUDIO_TRACK_REQUEST,{detail:d(this,g),composed:true,bubbles:true})),g$1(this,b,q).call(this));});}get tracks(){return d(this,k)}set tracks(i){f(this,k,[...i??[]]),g$1(this,b,ye).call(this);}get selected(){return d(this,g)}set selected(i){f(this,g,i??void 0),g$1(this,b,q).call(this);}connectedCallback(){super.connectedCallback(),this.addEventListener("change",d(this,B)),g$1(this,b,ye).call(this),g$1(this,b,q).call(this);}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",d(this,B));}};k=new WeakMap,g=new WeakMap,b=new WeakSet,ye=function(){let i=this.defaultSlot;if(i){i.textContent="";for(let n of d(this,k)){let s=Fe({type:"radio",text:n.label??n.language??"",value:n.id,checked:!!n.enabled});s.prepend(Ye(this,"checked-indicator")),i.append(s);}g$1(this,b,q).call(this);}},q=function(){let i=d(this,k).find(h=>h.enabled)??(d(this,k).length?d(this,k)[0]:void 0),n=d(this,g)??i?.id;f(this,g,n);let l=this.defaultSlot?.querySelectorAll("media-chrome-menu-item")??this.querySelectorAll("media-chrome-menu-item");for(let h of Array.from(l))"checked"in h&&"value"in h&&(h.checked=h.value===n);n!=null?this.value=n:(this.value="",this.removeAttribute("value"));},B=new WeakMap;var X,Ge,$=class extends M$1{constructor(){super(...arguments);e(this,X);}connectedCallback(){super.connectedCallback(),g$1(this,X,Ge).call(this);}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:this.closest("media-controller, mave-player")?.querySelector("mave-audio-track-menu")??null}};X=new WeakSet,Ge=function(){let i=n("audio tracks");this.setAttribute("aria-label",i);},$.getSlotTemplateHTML=()=>`
|
|
180
|
-
<style>
|
|
181
|
-
:host([aria-expanded="true"]) slot[name='tooltip'] {
|
|
182
|
-
display: none;
|
|
183
|
-
}
|
|
184
|
-
</style>
|
|
185
|
-
<slot name="icon">${nt}</slot>
|
|
186
|
-
`,$.getTooltipContentHTML=()=>n("audio tracks");o$1.customElements.get("mave-audio-track-menu")||o$1.customElements.define("mave-audio-track-menu",ke);o$1.customElements.get("mave-audio-track-menu-button")||o$1.customElements.define("mave-audio-track-menu-button",$);export{L as a,R as b,Fe as c,Ye as d,S as e,ke as f,$ as g};
|
package/dist/chunk-IBQULJZC.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkEVKPEPYP_cjs=require('./chunk-EVKPEPYP.cjs');var b=e=>typeof e=="function"?e:function(){return e},_=typeof self<"u"?self:null,m=typeof window<"u"?window:null,f=_||m||globalThis,H="2.0.0",u={connecting:0,open:1,closing:2,closed:3},P=1e4,x=1e3,c={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},p={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},R={longpoll:"longpoll",websocket:"websocket"},B={complete:4},k="base64url.bearer.phx.",v=class{constructor(e,t,i,s){this.channel=e,this.event=t,this.payload=i||function(){return {}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=false;}resend(e){this.timeout=e,this.reset(),this.send();}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=true,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}));}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=false;}matchReceive({status:e,response:t,_ref:i}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t));}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent);}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null;}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e);}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{});},this.timeout);}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t});}},j=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0;}reset(){this.tries=0,clearTimeout(this.timer);}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback();},this.timerCalc(this.tries+1));}},$=class{constructor(e,t,i){this.state=c.closed,this.topic=e,this.params=b(t||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=false,this.joinPush=new v(this,p.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new j(()=>{this.socket.isConnected()&&this.rejoin();},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin();})),this.joinPush.receive("ok",()=>{this.state=c.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[];}),this.joinPush.receive("error",()=>{this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=c.closed,this.socket.remove(this);}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=c.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new v(this,p.leave,b({}),this.timeout).send(),this.state=c.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout();}),this.on(p.reply,(s,r)=>{this.trigger(this.replyEventName(r),s);});}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=true,this.rejoin(),this.joinPush}onClose(e){this.on(p.close,e);}onError(e){return this.on(p.error,t=>e(t))}on(e,t){let i=this.bindingRef++;return this.bindings.push({event:e,ref:i,callback:t}),i}off(e,t){this.bindings=this.bindings.filter(i=>!(i.event===e&&(typeof t>"u"||t===i.ref)));}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,i=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new v(this,e,function(){return t},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=c.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(p.close,"leave");},i=new v(this,p.leave,b({}),e);return i.receive("ok",()=>t()).receive("timeout",()=>t()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,i){return t}isMember(e,t,i,s){return this.topic!==e?false:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:i,joinRef:s}),false):true}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=c.joining,this.joinPush.resend(e));}trigger(e,t,i,s){let r=this.onMessage(e,t,i,s);if(t&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let n=this.bindings.filter(h=>h.event===e);for(let h=0;h<n.length;h++)n[h].callback(r,i,s||this.joinRef());}replyEventName(e){return `chan_reply_${e}`}isClosed(){return this.state===c.closed}isErrored(){return this.state===c.errored}isJoined(){return this.state===c.joined}isJoining(){return this.state===c.joining}isLeaving(){return this.state===c.leaving}},E=class{static request(e,t,i,s,r,n,h){if(f.XDomainRequest){let o=new f.XDomainRequest;return this.xdomainRequest(o,e,t,s,r,n,h)}else if(f.XMLHttpRequest){let o=new f.XMLHttpRequest;return this.xhrRequest(o,e,t,i,s,r,n,h)}else {if(f.fetch&&f.AbortController)return this.fetchRequest(e,t,i,s,r,n,h);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,i,s,r,n,h){let o={method:e,headers:i,body:s},a=null;if(r){a=new AbortController;setTimeout(()=>a.abort(),r);o.signal=a.signal;}return f.fetch(t,o).then(l=>l.text()).then(l=>this.parseJSON(l)).then(l=>h&&h(l)).catch(l=>{l.name==="AbortError"&&n?n():h&&h(null);}),a}static xdomainRequest(e,t,i,s,r,n,h){return e.timeout=r,e.open(t,i),e.onload=()=>{let o=this.parseJSON(e.responseText);h&&h(o);},n&&(e.ontimeout=n),e.onprogress=()=>{},e.send(s),e}static xhrRequest(e,t,i,s,r,n,h,o){e.open(t,i,true),e.timeout=n;for(let[a,l]of Object.entries(s))e.setRequestHeader(a,l);return e.onerror=()=>o&&o(null),e.onreadystatechange=()=>{if(e.readyState===B.complete&&o){let a=this.parseJSON(e.responseText);o(a);}},h&&(e.ontimeout=h),e.send(r),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let i=[];for(var s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;let r=t?`${t}[${s}]`:s,n=e[s];typeof n=="object"?i.push(this.serialize(n,r)):i.push(encodeURIComponent(r)+"="+encodeURIComponent(n));}return i.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let i=e.match(/\?/)?"&":"?";return `${e}${i}${this.serialize(t)}`}},O=e=>{let t="",i=new Uint8Array(e),s=i.byteLength;for(let r=0;r<s;r++)t+=String.fromCharCode(i[r]);return btoa(t)},T=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(k)&&(this.authToken=atob(t[1].slice(k.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=true,this.reqs=new Set,this.awaitingBatchAck=false,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=u.connecting,setTimeout(()=>this.poll(),0);}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R.websocket),"$1/"+R.longpoll)}endpointURL(){return E.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,i){this.close(e,t,i),this.readyState=u.connecting;}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",false);}isActive(){return this.readyState===u.open||this.readyState===u.connecting}poll(){let e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:i,token:s,messages:r}=t;if(i===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",false);return}this.token=s;}else i=0;switch(i){case 200:r.forEach(n=>{setTimeout(()=>this.onmessage({data:n}),0);}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=u.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",false);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${i}`)}});}send(e){typeof e!="string"&&(e=O(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null;},0));}batchSend(e){this.awaitingBatchAck=true,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
|
|
2
|
-
`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=false,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",false)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]);});}close(e,t,i){for(let r of this.reqs)r.abort();this.readyState=u.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:true},{code:e,reason:t,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",s)):this.onclose(s);}ajax(e,t,i,s,r){let n,h=()=>{this.reqs.delete(n),s();};n=E.request(e,this.endpointURL(),t,i,this.timeout,h,o=>{this.reqs.delete(n),this.isActive()&&r(o);}),this.reqs.add(n);}};var C={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let i=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(i))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[i,s,r,n,h]=JSON.parse(e);return t({join_ref:i,ref:s,topic:r,event:n,payload:h})}},binaryEncode(e){let{join_ref:t,ref:i,event:s,topic:r,payload:n}=e,h=this.META_LENGTH+t.length+i.length+r.length+s.length,o=new ArrayBuffer(this.HEADER_LENGTH+h),a=new DataView(o),l=0;a.setUint8(l++,this.KINDS.push),a.setUint8(l++,t.length),a.setUint8(l++,i.length),a.setUint8(l++,r.length),a.setUint8(l++,s.length),Array.from(t,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(i,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(r,d=>a.setUint8(l++,d.charCodeAt(0))),Array.from(s,d=>a.setUint8(l++,d.charCodeAt(0)));var g=new Uint8Array(o.byteLength+n.byteLength);return g.set(new Uint8Array(o),0),g.set(new Uint8Array(n),o.byteLength),g.buffer},binaryDecode(e){let t=new DataView(e),i=t.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(e,t,s);case this.KINDS.reply:return this.decodeReply(e,t,s);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,s)}},decodePush(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,o=i.decode(e.slice(h,h+s));h=h+s;let a=i.decode(e.slice(h,h+r));h=h+r;let l=i.decode(e.slice(h,h+n));h=h+n;let g=e.slice(h,e.byteLength);return {join_ref:o,ref:null,topic:a,event:l,payload:g}},decodeReply(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=t.getUint8(3),h=t.getUint8(4),o=this.HEADER_LENGTH+this.META_LENGTH,a=i.decode(e.slice(o,o+s));o=o+s;let l=i.decode(e.slice(o,o+r));o=o+r;let g=i.decode(e.slice(o,o+n));o=o+n;let d=i.decode(e.slice(o,o+h));o=o+h;let A=e.slice(o,e.byteLength),L={status:d,response:A};return {join_ref:a,ref:l,topic:g,event:p.reply,payload:L}},decodeBroadcast(e,t,i){let s=t.getUint8(1),r=t.getUint8(2),n=this.HEADER_LENGTH+2,h=i.decode(e.slice(n,n+s));n=n+s;let o=i.decode(e.slice(n,n+r));n=n+r;let a=e.slice(n,e.byteLength);return {join_ref:null,ref:null,topic:h,event:o,payload:a}}},w=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||P,this.transport=t.transport||f.WebSocket||T,this.primaryPassedHealthCheck=false,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||f&&f.sessionStorage,this.establishedConnections=0,this.defaultEncoder=C.encode.bind(C),this.defaultDecoder=C.decode.bind(C),this.closeWasClean=false,this.disconnecting=false,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=false,this.transport!==T?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;m&&m.addEventListener&&(m.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock);}),m.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect());}),m.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=true:(this.pageHidden=false,this.isConnected()||this.teardown(()=>this.connect()));})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>t.rejoinAfterMs?t.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>t.reconnectAfterMs?t.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(s,r,n)=>{console.log(`${s}: ${r}`,n);}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=b(t.params||{}),this.endPoint=`${e}/${R.websocket}`,this.vsn=t.vsn||H,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new j(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect());},this.reconnectAfterMs),this.authToken=t.authToken;}getLongPollTransport(){return T}replaceTransport(e){this.connectClock++,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e;}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=E.appendParams(E.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,i){this.connectClock++,this.disconnecting=true,this.closeWasClean=true,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=false,e&&e();},t,i);}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=b(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==T?this.connectWithFallback(T,this.longPollFallbackMs):this.transportConnect());}log(e,t,i){this.logger&&this.logger(e,t,i);}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return false;let t=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let s=this.onMessage(r=>{r.ref===t&&(this.off([s]),e(Date.now()-i));});return true}transportConnect(){this.connectClock++,this.closeWasClean=false;let e;this.authToken&&(e=["phoenix",`${k}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t);}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t);}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let i=false,s=true,r,n,h=o=>{this.log("transport",`falling back to ${e.name}...`,o),this.off([r,n]),s=false,this.replaceTransport(e),this.transportConnect();};if(this.getSession(`phx:fallback:${e.name}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),n=this.onError(o=>{this.log("transport","error",o),s&&!i&&(clearTimeout(this.fallbackTimer),h(o));}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=true,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(o=>{this.log("transport","connected to primary after",o),this.primaryPassedHealthCheck=true,clearTimeout(this.fallbackTimer);});}),this.transportConnect();}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer);}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=false,this.disconnecting=false,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e());}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=false,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),x,"heartbeat timeout"));}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs));}teardown(e,t,i){if(!this.conn)return e&&e();let s=this.connectClock;this.waitForBufferDone(()=>{s===this.connectClock&&(this.conn&&(t?this.conn.close(t,i||""):this.conn.close()),this.waitForSocketClosed(()=>{s===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e());}));});}waitForBufferDone(e,t=1){if(t===5||!this.conn||!this.conn.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(e,t+1);},150*t);}waitForSocketClosed(e,t=1){if(t===5||!this.conn||this.conn.readyState===u.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(e,t+1);},150*t);}onConnClose(e){this.conn&&(this.conn.onclose=()=>{});let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&t!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(e));}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(e,t,i);}),(t===this.transport||i>0)&&this.triggerChanError();}triggerChanError(){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(p.error);});}connectionState(){switch(this.conn&&this.conn.readyState){case u.connecting:return "connecting";case u.open:return "open";case u.closing:return "closing";default:return "closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e);}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([i])=>e.indexOf(i)===-1);}channel(e,t={}){let i=new $(e,t,this);return this.channels.push(i),i}push(e){if(this.hasLogger()){let{topic:t,event:i,payload:s,ref:r,join_ref:n}=e;this.log("push",`${t} ${i} (${n}, ${r})`,s);}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)));}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs));}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[]);}onConnMessage(e){this.decode(e.data,t=>{let{topic:i,event:s,payload:r,ref:n,join_ref:h}=t;n&&n===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${i} ${s} ${n&&"("+n+")"||""}`,r);for(let o=0;o<this.channels.length;o++){let a=this.channels[o];a.isMember(i,s,r,h)&&a.trigger(s,r,n,h);}for(let o=0;o<this.stateChangeCallbacks.message.length;o++){let[,a]=this.stateChangeCallbacks.message[o];a(t);}});}leaveOpenTopic(e){let t=this.channels.find(i=>i.topic===e&&(i.isJoined()||i.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave());}};var y=class{static connect(t){if(typeof window>"u"){let n={on:()=>n,push:()=>n,join:()=>n,leave:()=>Promise.resolve(),off:()=>{}};return {token:t,channel:n}}let i=new w(chunkEVKPEPYP_cjs.a.upload.socket,{params:{token:t},reconnectAfterMs:n=>[1e3,3e3,5e3,1e4][n-1]||1e4});i.connect();let s=i.channel(`embed:${t}`),r={token:t,channel:s,socket:i};return s.on("initiate",({upload_id:n})=>{r.upload_id=n;}),s.join(),r}static async disconnect(t){if(t){try{await t.channel.leave();}catch{}t.socket?.disconnect();}}};
|
|
3
|
-
exports.a=y;
|
package/dist/chunk-J7OISSKU.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function e(){return typeof document>"u"?"":new URL((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-J7OISSKU.cjs', document.baseURI).href))).pathname.includes("+esm")?"dist/":""}exports.a=e;
|