openc3-cosmos-tool-cmdtlmserver 6.1.0 → 6.2.0
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.
- checksums.yaml +4 -4
- data/tools/cmdtlmserver/ArrayWidget-BxEO5hEG-89ca0a2e546d77657dd9.js +2 -0
- data/tools/cmdtlmserver/{ArrayplotWidget-BDvziGSm-e2d9fd0c66b39266dc7c.js → ArrayplotWidget-B_VPoV4v-7b820a5e88bad1425d1c.js} +1 -1
- data/tools/cmdtlmserver/{BarColumn-CNhS2KKq-767c9486a4e443c42bc7.js → BarColumn-C9dkpg2O-7723dc0faa77b237d7f9.js} +1 -1
- data/tools/cmdtlmserver/{BlockWidget-D0On4x3d-54b0f07404fece73b33e.js → BlockWidget-CuefOin6-edc80607b7a1d528f5e3.js} +2 -2
- data/tools/cmdtlmserver/{ButtonWidget-BOYLHMt4-6ab7fb97fe052d8802a6.js → ButtonWidget-B6HM0Doo-ce7e70aebc6509184e26.js} +2 -2
- data/tools/cmdtlmserver/{CanvasWidget-CQIqiLEy-8134fbc55f313a763f32.js → CanvasWidget-DZQGG-yQ-6864bab874dccb2db67c.js} +1 -1
- data/tools/cmdtlmserver/CanvasdotWidget-6wuCSnw_-e0f154be630a0c8394bc.js +1 -0
- data/tools/cmdtlmserver/{CanvasimageWidget-ayu_ASKf-7b3ed2be4b78024a32e9.js → CanvasimageWidget-mhcPpAuN-441a8a40b76b47f0e9dd.js} +1 -1
- data/tools/cmdtlmserver/{CanvasimagevalueWidget-mv319g5T-deaaf709ef21cf5db0e9.js → CanvasimagevalueWidget-Cx-dH8Gc-c505d808df433d5fd979.js} +1 -1
- data/tools/cmdtlmserver/CanvaslabelWidget-CQZCeohU-85c23c2118739625a3a1.js +1 -0
- data/tools/cmdtlmserver/{CanvaslabelvalueWidget-CrhPwTSP-44116d33f8a81a77b89e.js → CanvaslabelvalueWidget-CwmYDCjr-aca636f4d86f04fc6120.js} +1 -1
- data/tools/cmdtlmserver/CanvaslineWidget-nTP3fJB4-78e605105cd357f98670.js +1 -0
- data/tools/cmdtlmserver/{CanvaslinevalueWidget-CJsuF6RY-ce76d2dccf8f9edc4699.js → CanvaslinevalueWidget-C3sJnjLQ-c20af62fc101f2e6d9e7.js} +1 -1
- data/tools/cmdtlmserver/{CheckbuttonWidget-CQ2HlgIk-c98446c9ffe1e6405baa.js → CheckbuttonWidget-5-8YDsQL-e19c2b901eae43feeb7c.js} +1 -1
- data/tools/cmdtlmserver/{CmdPacketsTab-2c0c4903f7cd5e2d492f.js → CmdPacketsTab-543bcdcded38905596c1.js} +1 -1
- data/tools/cmdtlmserver/{CmdTlmServer-d13edb0abf2c53a5bcbf.js → CmdTlmServer-c5e0c27cd668cb4acdd2.js} +2 -2
- data/tools/cmdtlmserver/ComboboxWidget-DzBL8h9f-d1afd3d09dbb57142156.js +1 -0
- data/tools/cmdtlmserver/{DateWidget-CIkO0xqH-d3da4940b3f961694415.js → DateWidget-CW7Od7lB-14c75cebe909660c92a6.js} +1 -1
- data/tools/cmdtlmserver/{DetailsDialog-DyGpm5TP-c2adbdd157ab5f884f6f.js → DetailsDialog-BvbziA7Y-a6d191d4c24ae44227f5.js} +1 -1
- data/tools/cmdtlmserver/{DynamicWidget-gFSYxzvT-c7ac8d6e5d3f41824765.js → DynamicWidget-gFSYxzvT-5b7c1448f53e03ca3e91.js} +1 -1
- data/tools/cmdtlmserver/{FormatvalueWidget-D8-EO_3E-2503055f4eccb3a4b79e.js → FormatvalueWidget-CGpnTqVH-5a4cac76beeee76398b5.js} +1 -1
- data/tools/cmdtlmserver/{Graph-EV7oK3qM-f7f07aa312f5934b97f9.js → Graph-3rkhFP3G-b8db0cdb9ecf80ac5155.js} +1 -1
- data/tools/cmdtlmserver/GraphWidget-Dycey-mj-d4aa575ef98087670b47.js +1 -0
- data/tools/cmdtlmserver/{HorizontalWidget-Bp-qtqoh-5637173d360666d3182e.js → HorizontalWidget-D31NRWy5-567abe97366db941d1d0.js} +1 -1
- data/tools/cmdtlmserver/HorizontalboxWidget-Br8dSVHD-7c9a14b981c6d7631921.js +1 -0
- data/tools/cmdtlmserver/{HorizontallineWidget-CbxREBYI-61a8a8088971c3f08034.js → HorizontallineWidget-CbxREBYI-cd6486b6aeb6fbdd102b.js} +1 -1
- data/tools/cmdtlmserver/{IframeWidget-DusiWNNj-32cb5541afdd5fe67f67.js → IframeWidget-Ctj8OIcG-8eb7274680df97862be9.js} +1 -1
- data/tools/cmdtlmserver/{ImageLoader-BapCB-Li-f461eddb2af2e265fd48.js → ImageLoader-BrNrCBvi-c56dfbfda95fe546284c.js} +1 -1
- data/tools/cmdtlmserver/{ImageviewerWidget-c0gJ9VDC-5af6501486a08bc8532e.js → ImageviewerWidget-XrsqxmLo-e5e72a6a85a49cb007ad.js} +1 -1
- data/tools/cmdtlmserver/{InterfacesTab-d900a3491d1da534368e.js → InterfacesTab-5fe4b0f137ffde75f928.js} +1 -1
- data/tools/cmdtlmserver/{LabelWidget-pPgc0ve3-a8c20e96febfb654ebbc.js → LabelWidget-t7I87dp7-c8e7d564e904105dba56.js} +1 -1
- data/tools/cmdtlmserver/{LabelledWidget-CkNjby55-17d35c79064d8ced688b.js → LabelledWidget-C7TDf92M-e5c2e34c391a4721e565.js} +1 -1
- data/tools/cmdtlmserver/{LabelprogressbarWidget-e2R2yQKw-32ba7d925d5938b9e647.js → LabelprogressbarWidget-wwLURt1u-c12f252a4577e90e8ba4.js} +1 -1
- data/tools/cmdtlmserver/LabelsparklineWidget-B3awLUyP-dafc251f2886e5de7219.js +1 -0
- data/tools/cmdtlmserver/LabelvalueWidget-Zx_yHCtl-761beda3ba9005900e83.js +1 -0
- data/tools/cmdtlmserver/{LabelvaluedescWidget-Z1m8Bi6N-84bd53d94bc877e5a83b.js → LabelvaluedescWidget-BBSBh4vI-7930a82f5e07d7ac49ee.js} +1 -1
- data/tools/cmdtlmserver/LabelvaluelimitsbarWidget-CZueHYWG-24b90c24e80fd1a209b0.js +1 -0
- data/tools/cmdtlmserver/LabelvaluelimitscolumnWidget-BTvzyQMq-8ef478f7a9ed47139a9b.js +1 -0
- data/tools/cmdtlmserver/{LabelvaluerangebarWidget-BR9vXOlt-b683cd94686b6a02b94f.js → LabelvaluerangebarWidget-BhYTBgDq-f7d7ee8128f9058ef8c3.js} +1 -1
- data/tools/cmdtlmserver/{Layout-Bk8EGxbP-aa19b0fb74b246a1ce88.js → Layout-Bh7VzCZd-dcb9c3641454e6c67c47.js} +1 -1
- data/tools/cmdtlmserver/{LedWidget-f7bf8ls_-dc76da1106f2ea6ba1c1.js → LedWidget-CxJjJBBS-71046e57b3786c5a7889.js} +1 -1
- data/tools/cmdtlmserver/{LimitsbarWidget-B7fHaDcJ-6401cd1dca32d9d23e9d.js → LimitsbarWidget-Djui0IpK-c1dec25b5074f46c266b.js} +1 -1
- data/tools/cmdtlmserver/LimitscolorWidget-DdmvKzmx-6cf2a6f3dc4493ea0ef5.js +1 -0
- data/tools/cmdtlmserver/{LimitscolumnWidget-C9FbNC-U-69b1a5ce1e37519311a9.js → LimitscolumnWidget-Cc19IEjq-bc58d443d9a79a05718e.js} +1 -1
- data/tools/cmdtlmserver/{LinegraphWidget-DkWDQ_3K-a2e11e9260d6be61a562.js → LinegraphWidget-BtieJxeL-be15f3c0e6a500ecc463.js} +1 -1
- data/tools/cmdtlmserver/{MatrixbycolumnsWidget-CHJDyYa3-e7cbac8e29ec890726df.js → MatrixbycolumnsWidget-DnExVRF8-4a69d3f7ece972d3f5e2.js} +1 -1
- data/tools/cmdtlmserver/{ProgressbarWidget-CRZDxClT-97ca0eb1a7d82a61f1bf.js → ProgressbarWidget-DIfqhHRE-aebd8d5a762deda63d9c.js} +1 -1
- data/tools/cmdtlmserver/RadiobuttonWidget-QzIkNP7m-300018a2418b2cbe7f09.js +1 -0
- data/tools/cmdtlmserver/{RadiogroupWidget-_0bVCHjr-21b6a6a889648dc39713.js → RadiogroupWidget-Ci9sCX39-db829f94bee5140bb9cc.js} +1 -1
- data/tools/cmdtlmserver/{RangebarWidget-CEQFiG4l-88e919bc219c10974ea9.js → RangebarWidget-CN0YuHqy-9b49a64ed4d1a23e9fa2.js} +1 -1
- data/tools/cmdtlmserver/{RawDialog-4fc24b3a5134f08b5233.js → RawDialog-2b725610c629b9879bac.js} +1 -1
- data/tools/cmdtlmserver/{RollupWidget-579c7y0R-6dc6a63ce8ba38021e87.js → RollupWidget-y4jBtJB2-2fa7012d1e3c1cc9a765.js} +1 -1
- data/tools/cmdtlmserver/{RoutersTab-bd726501304a35125437.js → RoutersTab-97a4ce9897517bb6bde4.js} +1 -1
- data/tools/cmdtlmserver/{ScrollwindowWidget-Kcre9gM3-a4242c83569b10650eb0.js → ScrollwindowWidget-CBzYk4Y3-48abadd8da946b6c65a5.js} +1 -1
- data/tools/cmdtlmserver/{SignalWidget-D55Myd0q-82abf10be1d381cebe25.js → SignalWidget-DQ5Uc2uV-864549b10d055bc6c168.js} +1 -1
- data/tools/cmdtlmserver/{SpacerWidget-DBDv_w_s-1a2edb5ee70ddb76a3b2.js → SpacerWidget-6rsc_dSM-4c67a06ee2036a93075a.js} +1 -1
- data/tools/cmdtlmserver/{SparklineWidget-DJvIL24z-aca49e14883f617297b1.js → SparklineWidget-CZtvu2ss-a652a442fd625a97a9b0.js} +1 -1
- data/tools/cmdtlmserver/{StatusTab-70f7f21eb7f45c574053.js → StatusTab-ebf6453fac33bf59a564.js} +1 -1
- data/tools/cmdtlmserver/{TabbookWidget-DH9DHnp1-f9eb87a79548613c9d87.js → TabbookWidget-DNALU0jl-ae79a3b9beef34b7efde.js} +1 -1
- data/tools/cmdtlmserver/{TargetsTab-7af853e3096b44615549.js → TargetsTab-ae3381cde4d9b22a9272.js} +1 -1
- data/tools/cmdtlmserver/TextboxWidget-5hqPj74D-292f2786815b2027f6e6.js +1 -0
- data/tools/cmdtlmserver/{TextfieldWidget-BRQ6oPzR-fe6ec784f241da3b1dfb.js → TextfieldWidget-Df0ANSiU-a45885e9c031fa702946.js} +1 -1
- data/tools/cmdtlmserver/{TimeWidget-pXtrK5IC-93e17a05d6ecf2eccade.js → TimeWidget-C6XQMUG2-fa62efc8fea7b7a08ccc.js} +1 -1
- data/tools/cmdtlmserver/TitleWidget-B9SPUlbW-55092f64413a6ce5551d.js +1 -0
- data/tools/cmdtlmserver/{TlmPacketsTab-60a107b4ac232aac2322.js → TlmPacketsTab-60429ad30f45f45c7ac9.js} +1 -1
- data/tools/cmdtlmserver/{Updater-ebc27e8a2a7fdd687c65.js → Updater-82fa1a354a9721098906.js} +1 -1
- data/tools/cmdtlmserver/{VWidget-CN_afCKJ-b8a49f5b611e52c35dd5.js → VWidget-C4spAawK-e7dee3c34a6d790327ec.js} +1 -1
- data/tools/cmdtlmserver/ValueWidget-D4RrYVEK-c90078a7e58747e8aa55.js +1 -0
- data/tools/cmdtlmserver/ValuelimitsbarWidget-Bc9_Vj_f-b088c7ef6cd4bf20f55e.js +1 -0
- data/tools/cmdtlmserver/{ValuelimitscolumnWidget-D8bgZ7YP-cc6ddac478a316c83821.js → ValuelimitscolumnWidget-DHKIL7sf-72a766dafcef2f6c4767.js} +1 -1
- data/tools/cmdtlmserver/{ValuerangebarWidget-VKygtFwP-545f2608d522c90b483d.js → ValuerangebarWidget-CecQRIok-5cef01f82763ccf9350a.js} +1 -1
- data/tools/cmdtlmserver/{VerticalWidget-BuvedA_b-b5c11afb3b194946a478.js → VerticalWidget-D8jUFxjS-dc1f1f22baae1b1bf9ee.js} +1 -1
- data/tools/cmdtlmserver/VerticalboxWidget-B4eGUSYH-24dd29d0e54de2ba61eb.js +1 -0
- data/tools/cmdtlmserver/{Widget-CERFa1CU-5311b94ad21a3c7b3574.js → Widget-fRCERxGf-6cf6e886d2d5ee76cfc6.js} +1 -1
- data/tools/cmdtlmserver/main-4bad43bda3e8a8483ba9.js +1423 -0
- data/tools/cmdtlmserver/main.js +1 -1
- data/tools/cmdtlmserver/services-6c036365da68dd4327ff.js +7 -0
- metadata +78 -78
- data/tools/cmdtlmserver/ArrayWidget-DzHELdHv-1cfde870ea63d4573d20.js +0 -2
- data/tools/cmdtlmserver/CanvasdotWidget-BVWutPMF-f506e882c3236b53896a.js +0 -1
- data/tools/cmdtlmserver/CanvaslabelWidget-BNjbXDb8-8ceda00adbbd3da999d4.js +0 -1
- data/tools/cmdtlmserver/CanvaslineWidget--HdKH6oO-72eb687891a0213a981a.js +0 -1
- data/tools/cmdtlmserver/ComboboxWidget-BxILACwz-cfb4c1ffd4cb57d959ac.js +0 -1
- data/tools/cmdtlmserver/GraphWidget-BTNYbd21-fbea3cc94b9a4190d464.js +0 -1
- data/tools/cmdtlmserver/HorizontalboxWidget-CrJuGY3s-e2fe9300840c97ddddef.js +0 -1
- data/tools/cmdtlmserver/LabelsparklineWidget-D7MQ_oNw-6b2f73958f78cd48cf72.js +0 -1
- data/tools/cmdtlmserver/LabelvalueWidget-4DShBBvr-2989613328b42b690607.js +0 -1
- data/tools/cmdtlmserver/LabelvaluelimitsbarWidget-DVa-oYxU-65dac25a645be58bc69d.js +0 -1
- data/tools/cmdtlmserver/LabelvaluelimitscolumnWidget-DduuX632-da2af8fa3f16e0ca4bc6.js +0 -1
- data/tools/cmdtlmserver/LimitscolorWidget-CpC4D_TC-fa80d8dccfdbce9a3085.js +0 -1
- data/tools/cmdtlmserver/RadiobuttonWidget-BW4yFweH-303da45be9f3bc5c02ef.js +0 -1
- data/tools/cmdtlmserver/TextboxWidget-DCjIEzJn-1d6d9572908a65421217.js +0 -1
- data/tools/cmdtlmserver/TitleWidget-CfAa2SyT-e9f3d1a8a71d4118fdd9.js +0 -1
- data/tools/cmdtlmserver/ValueWidget-DIFivXw_-c4ebf34840bab5aca614.js +0 -1
- data/tools/cmdtlmserver/ValuelimitsbarWidget-Cb7_SIUF-dd0cab6a7600b9eb6fc8.js +0 -1
- data/tools/cmdtlmserver/VerticalboxWidget-D_LcL3GF-ff10f59775ba060533af.js +0 -1
- data/tools/cmdtlmserver/main-30c8b9128a62bc0a519c.js +0 -1422
- data/tools/cmdtlmserver/services-7ecf8098cef34840e93e.js +0 -6
@@ -1,6 +0,0 @@
|
|
1
|
-
System.register([],function(ae,Ur){"use strict";return{execute:function(){var vt=Object.defineProperty,Ot=(t,e,n)=>e in t?vt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,le=(t,e,n)=>Ot(t,typeof e!="symbol"?e+"":e,n);function Ae(t,e){return function(){return t.apply(e,arguments)}}const{toString:Tt}=Object.prototype,{getPrototypeOf:ue}=Object,G=(t=>e=>{const n=Tt.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),v=t=>(t=t.toLowerCase(),e=>G(e)===t),X=t=>e=>typeof e===t,{isArray:D}=Array,z=X("undefined");function At(t){return t!==null&&!z(t)&&t.constructor!==null&&!z(t.constructor)&&x(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Pe=v("ArrayBuffer");function Pt(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Pe(t.buffer),e}const Ct=X("string"),x=X("function"),Ce=X("number"),Q=t=>t!==null&&typeof t=="object",kt=t=>t===!0||t===!1,Y=t=>{if(G(t)!=="object")return!1;const e=ue(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},jt=v("Date"),It=v("File"),Nt=v("Blob"),Lt=v("FileList"),Ut=t=>Q(t)&&x(t.pipe),Ft=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||x(t.append)&&((e=G(t))==="formdata"||e==="object"&&x(t.toString)&&t.toString()==="[object FormData]"))},qt=v("URLSearchParams"),[Dt,Bt,$t,Mt]=["ReadableStream","Request","Response","Headers"].map(v),zt=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function H(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),D(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let a;for(r=0;r<o;r++)a=i[r],e.call(null,t[a],a,t)}}function ke(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const N=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,je=t=>!z(t)&&t!==N;function he(){const{caseless:t}=je(this)&&this||{},e={},n=(r,s)=>{const i=t&&ke(e,s)||s;Y(e[i])&&Y(r)?e[i]=he(e[i],r):Y(r)?e[i]=he({},r):D(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&H(arguments[r],n);return e}const Ht=(t,e,n,{allOwnKeys:r}={})=>(H(e,(s,i)=>{n&&x(s)?t[i]=Ae(s,n):t[i]=s},{allOwnKeys:r}),t),Wt=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Vt=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Jt=(t,e,n,r)=>{let s,i,o;const a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&ue(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Kt=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Gt=t=>{if(!t)return null;if(D(t))return t;let e=t.length;if(!Ce(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Xt=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&ue(Uint8Array)),Qt=(t,e)=>{const n=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=n.next())&&!r.done;){const s=r.value;e.call(t,s[0],s[1])}},Yt=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Zt=v("HTMLFormElement"),en=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,n,r){return n.toUpperCase()+r}),Ie=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),tn=v("RegExp"),Ne=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};H(n,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(r[i]=o||s)}),Object.defineProperties(t,r)},nn=t=>{Ne(t,(e,n)=>{if(x(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(x(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},rn=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return D(t)?r(t):r(String(t).split(e)),n},sn=()=>{},on=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e,de="abcdefghijklmnopqrstuvwxyz",Le="0123456789",Ue={DIGIT:Le,ALPHA:de,ALPHA_DIGIT:de+de.toUpperCase()+Le},cn=(t=16,e=Ue.ALPHA_DIGIT)=>{let n="";const{length:r}=e;for(;t--;)n+=e[Math.random()*r|0];return n};function an(t){return!!(t&&x(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const ln=t=>{const e=new Array(10),n=(r,s)=>{if(Q(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const i=D(r)?[]:{};return H(r,(o,a)=>{const u=n(o,s+1);!z(u)&&(i[a]=u)}),e[s]=void 0,i}}return r};return n(t,0)},un=v("AsyncFunction"),hn=t=>t&&(Q(t)||x(t))&&x(t.then)&&x(t.catch),Fe=((t,e)=>t?setImmediate:e?((n,r)=>(N.addEventListener("message",({source:s,data:i})=>{s===N&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),N.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",x(N.postMessage)),dn=typeof queueMicrotask<"u"?queueMicrotask.bind(N):typeof process<"u"&&process.nextTick||Fe,c={isArray:D,isArrayBuffer:Pe,isBuffer:At,isFormData:Ft,isArrayBufferView:Pt,isString:Ct,isNumber:Ce,isBoolean:kt,isObject:Q,isPlainObject:Y,isReadableStream:Dt,isRequest:Bt,isResponse:$t,isHeaders:Mt,isUndefined:z,isDate:jt,isFile:It,isBlob:Nt,isRegExp:tn,isFunction:x,isStream:Ut,isURLSearchParams:qt,isTypedArray:Xt,isFileList:Lt,forEach:H,merge:he,extend:Ht,trim:zt,stripBOM:Wt,inherits:Vt,toFlatObject:Jt,kindOf:G,kindOfTest:v,endsWith:Kt,toArray:Gt,forEachEntry:Qt,matchAll:Yt,isHTMLForm:Zt,hasOwnProperty:Ie,hasOwnProp:Ie,reduceDescriptors:Ne,freezeMethods:nn,toObjectSet:rn,toCamelCase:en,noop:sn,toFiniteNumber:on,findKey:ke,global:N,isContextDefined:je,ALPHABET:Ue,generateString:cn,isSpecCompliantForm:an,toJSONObject:ln,isAsyncFn:un,isThenable:hn,setImmediate:Fe,asap:dn};function p(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}c.inherits(p,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:c.toJSONObject(this.config),code:this.code,status:this.status}}});const qe=p.prototype,De={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{De[t]={value:t}}),Object.defineProperties(p,De),Object.defineProperty(qe,"isAxiosError",{value:!0}),p.from=(t,e,n,r,s,i)=>{const o=Object.create(qe);return c.toFlatObject(t,o,function(a){return a!==Error.prototype},a=>a!=="isAxiosError"),p.call(o,t.message,e,n,r,s),o.cause=t,o.name=t.name,i&&Object.assign(o,i),o};const fn=null;function fe(t){return c.isPlainObject(t)||c.isArray(t)}function Be(t){return c.endsWith(t,"[]")?t.slice(0,-2):t}function $e(t,e,n){return t?t.concat(e).map(function(r,s){return r=Be(r),!n&&s?"["+r+"]":r}).join(n?".":""):e}function pn(t){return c.isArray(t)&&!t.some(fe)}const gn=c.toFlatObject(c,{},null,function(t){return/^is[A-Z]/.test(t)});function Z(t,e,n){if(!c.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=c.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,b){return!c.isUndefined(b[d])});const r=n.metaTokens,s=n.visitor||l,i=n.dots,o=n.indexes,a=(n.Blob||typeof Blob<"u"&&Blob)&&c.isSpecCompliantForm(e);if(!c.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(c.isDate(d))return d.toISOString();if(!a&&c.isBlob(d))throw new p("Blob is not supported. Use a Buffer instead.");return c.isArrayBuffer(d)||c.isTypedArray(d)?a&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function l(d,b,f){let S=d;if(d&&!f&&typeof d=="object"){if(c.endsWith(b,"{}"))b=r?b:b.slice(0,-2),d=JSON.stringify(d);else if(c.isArray(d)&&pn(d)||(c.isFileList(d)||c.endsWith(b,"[]"))&&(S=c.toArray(d)))return b=Be(b),S.forEach(function(y,_){!(c.isUndefined(y)||y===null)&&e.append(o===!0?$e([b],_,i):o===null?b:b+"[]",u(y))}),!1}return fe(d)?!0:(e.append($e(f,b,i),u(d)),!1)}const h=[],g=Object.assign(gn,{defaultVisitor:l,convertValue:u,isVisitable:fe});function m(d,b){if(!c.isUndefined(d)){if(h.indexOf(d)!==-1)throw Error("Circular reference detected in "+b.join("."));h.push(d),c.forEach(d,function(f,S){(!(c.isUndefined(f)||f===null)&&s.call(e,f,c.isString(S)?S.trim():S,b,g))===!0&&m(f,b?b.concat(S):[S])}),h.pop()}}if(!c.isObject(t))throw new TypeError("data must be an object");return m(t),e}function Me(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function pe(t,e){this._pairs=[],t&&Z(t,this,e)}const ze=pe.prototype;ze.append=function(t,e){this._pairs.push([t,e])},ze.toString=function(t){const e=t?function(n){return t.call(this,n,Me)}:Me;return this._pairs.map(function(n){return e(n[0])+"="+e(n[1])},"").join("&")};function mn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function He(t,e,n){if(!e)return t;const r=n&&n.encode||mn;c.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=c.isURLSearchParams(e)?e.toString():new pe(e,n).toString(r),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class We{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){c.forEach(this.handlers,function(n){n!==null&&e(n)})}}const Ve={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},bn=typeof URLSearchParams<"u"?URLSearchParams:pe,_n=typeof FormData<"u"?FormData:null,yn=typeof Blob<"u"?Blob:null,wn={isBrowser:!0,classes:{URLSearchParams:bn,FormData:_n,Blob:yn},protocols:["http","https","file","blob","url","data"]},ge=typeof window<"u"&&typeof document<"u",me=typeof navigator=="object"&&navigator||void 0,En=ge&&(!me||["ReactNative","NativeScript","NS"].indexOf(me.product)<0),Sn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Rn=ge&&window.location.href||"http://localhost",xn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ge,hasStandardBrowserEnv:En,hasStandardBrowserWebWorkerEnv:Sn,navigator:me,origin:Rn},Symbol.toStringTag,{value:"Module"})),E={...xn,...wn};function vn(t,e){return Z(t,new E.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return E.isNode&&c.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function On(t){return c.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Tn(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function Je(t){function e(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),u=i>=n.length;return o=!o&&c.isArray(s)?s.length:o,u?(c.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!c.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],i)&&c.isArray(s[o])&&(s[o]=Tn(s[o])),!a)}if(c.isFormData(t)&&c.isFunction(t.entries)){const n={};return c.forEachEntry(t,(r,s)=>{e(On(r),s,n,0)}),n}return null}function An(t,e,n){if(c.isString(t))try{return(e||JSON.parse)(t),c.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const W={transitional:Ve,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const n=e.getContentType()||"",r=n.indexOf("application/json")>-1,s=c.isObject(t);if(s&&c.isHTMLForm(t)&&(t=new FormData(t)),c.isFormData(t))return r?JSON.stringify(Je(t)):t;if(c.isArrayBuffer(t)||c.isBuffer(t)||c.isStream(t)||c.isFile(t)||c.isBlob(t)||c.isReadableStream(t))return t;if(c.isArrayBufferView(t))return t.buffer;if(c.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let i;if(s){if(n.indexOf("application/x-www-form-urlencoded")>-1)return vn(t,this.formSerializer).toString();if((i=c.isFileList(t))||n.indexOf("multipart/form-data")>-1){const o=this.env&&this.env.FormData;return Z(i?{"files[]":t}:t,o&&new o,this.formSerializer)}}return s||r?(e.setContentType("application/json",!1),An(t)):t}],transformResponse:[function(t){const e=this.transitional||W.transitional,n=e&&e.forcedJSONParsing,r=this.responseType==="json";if(c.isResponse(t)||c.isReadableStream(t))return t;if(t&&c.isString(t)&&(n&&!this.responseType||r)){const s=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(i){if(s)throw i.name==="SyntaxError"?p.from(i,p.ERR_BAD_RESPONSE,this,null,this.response):i}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:E.classes.FormData,Blob:E.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};c.forEach(["delete","get","head","post","put","patch"],t=>{W.headers[t]={}});const Pn=c.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Cn=t=>{const e={};let n,r,s;return t&&t.split(`
|
2
|
-
`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||e[n]&&Pn[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},Ke=Symbol("internals");function V(t){return t&&String(t).trim().toLowerCase()}function ee(t){return t===!1||t==null?t:c.isArray(t)?t.map(ee):String(t)}function kn(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const jn=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function be(t,e,n,r,s){if(c.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!c.isString(e)){if(c.isString(r))return e.indexOf(r)!==-1;if(c.isRegExp(r))return r.test(e)}}function In(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function Nn(t,e){const n=c.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}let R=class{constructor(t){t&&this.set(t)}set(t,e,n){const r=this;function s(o,a,u){const l=V(a);if(!l)throw new Error("header name must be a non-empty string");const h=c.findKey(r,l);(!h||r[h]===void 0||u===!0||u===void 0&&r[h]!==!1)&&(r[h||a]=ee(o))}const i=(o,a)=>c.forEach(o,(u,l)=>s(u,l,a));if(c.isPlainObject(t)||t instanceof this.constructor)i(t,e);else if(c.isString(t)&&(t=t.trim())&&!jn(t))i(Cn(t),e);else if(c.isHeaders(t))for(const[o,a]of t.entries())s(a,o,n);else t!=null&&s(e,t,n);return this}get(t,e){if(t=V(t),t){const n=c.findKey(this,t);if(n){const r=this[n];if(!e)return r;if(e===!0)return kn(r);if(c.isFunction(e))return e.call(this,r,n);if(c.isRegExp(e))return e.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=V(t),t){const n=c.findKey(this,t);return!!(n&&this[n]!==void 0&&(!e||be(this,this[n],n,e)))}return!1}delete(t,e){const n=this;let r=!1;function s(i){if(i=V(i),i){const o=c.findKey(n,i);o&&(!e||be(n,n[o],o,e))&&(delete n[o],r=!0)}}return c.isArray(t)?t.forEach(s):s(t),r}clear(t){const e=Object.keys(this);let n=e.length,r=!1;for(;n--;){const s=e[n];(!t||be(this,this[s],s,t,!0))&&(delete this[s],r=!0)}return r}normalize(t){const e=this,n={};return c.forEach(this,(r,s)=>{const i=c.findKey(n,s);if(i){e[i]=ee(r),delete e[s];return}const o=t?In(s):String(s).trim();o!==s&&delete e[s],e[o]=ee(r),n[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return c.forEach(this,(n,r)=>{n!=null&&n!==!1&&(e[r]=t&&c.isArray(n)?n.join(", "):n)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join(`
|
3
|
-
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);return e.forEach(r=>n.set(r)),n}static accessor(t){const e=(this[Ke]=this[Ke]={accessors:{}}).accessors,n=this.prototype;function r(s){const i=V(s);e[i]||(Nn(n,s),e[i]=!0)}return c.isArray(t)?t.forEach(r):r(t),this}};R.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),c.reduceDescriptors(R.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),c.freezeMethods(R);function _e(t,e){const n=this||W,r=e||n,s=R.from(r.headers);let i=r.data;return c.forEach(t,function(o){i=o.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Ge(t){return!!(t&&t.__CANCEL__)}function B(t,e,n){p.call(this,t??"canceled",p.ERR_CANCELED,e,n),this.name="CanceledError"}c.inherits(B,p,{__CANCEL__:!0});function Xe(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new p("Request failed with status code "+n.status,[p.ERR_BAD_REQUEST,p.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Ln(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Un(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(a){const u=Date.now(),l=r[i];o||(o=u),n[s]=a,r[s]=u;let h=i,g=0;for(;h!==s;)g+=n[h++],h=h%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),u-o<e)return;const m=l&&u-l;return m?Math.round(g*1e3/m):void 0}}function Fn(t,e){let n=0,r=1e3/e,s,i;const o=(a,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),t.apply(null,a)};return[(...a)=>{const u=Date.now(),l=u-n;l>=r?o(a,u):(s=a,i||(i=setTimeout(()=>{i=null,o(s)},r-l)))},()=>s&&o(s)]}const te=(t,e,n=3)=>{let r=0;const s=Un(50,250);return Fn(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,u=o-r,l=s(u),h=o<=a;r=o;const g={loaded:o,total:a,progress:a?o/a:void 0,bytes:u,rate:l||void 0,estimated:l&&a&&h?(a-o)/l:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(g)},n)},Qe=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},Ye=t=>(...e)=>c.asap(()=>t(...e)),qn=E.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,E.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(E.origin),E.navigator&&/(msie|trident)/i.test(E.navigator.userAgent)):()=>!0,Dn=E.hasStandardBrowserEnv?{write(t,e,n,r,s,i){const o=[t+"="+encodeURIComponent(e)];c.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),c.isString(r)&&o.push("path="+r),c.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Bn(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function $n(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Ze(t,e){return t&&!Bn(e)?$n(t,e):e}const et=t=>t instanceof R?{...t}:t;function L(t,e){e=e||{};const n={};function r(l,h,g,m){return c.isPlainObject(l)&&c.isPlainObject(h)?c.merge.call({caseless:m},l,h):c.isPlainObject(h)?c.merge({},h):c.isArray(h)?h.slice():h}function s(l,h,g,m){if(c.isUndefined(h)){if(!c.isUndefined(l))return r(void 0,l,g,m)}else return r(l,h,g,m)}function i(l,h){if(!c.isUndefined(h))return r(void 0,h)}function o(l,h){if(c.isUndefined(h)){if(!c.isUndefined(l))return r(void 0,l)}else return r(void 0,h)}function a(l,h,g){if(g in e)return r(l,h);if(g in t)return r(void 0,l)}const u={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,h,g)=>s(et(l),et(h),g,!0)};return c.forEach(Object.keys(Object.assign({},t,e)),function(l){const h=u[l]||s,g=h(t[l],e[l],l);c.isUndefined(g)&&h!==a||(n[l]=g)}),n}const tt=t=>{const e=L({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;e.headers=o=R.from(o),e.url=He(Ze(e.baseURL,e.url),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let u;if(c.isFormData(n)){if(E.hasStandardBrowserEnv||E.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((u=o.getContentType())!==!1){const[l,...h]=u?u.split(";").map(g=>g.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...h].join("; "))}}if(E.hasStandardBrowserEnv&&(r&&c.isFunction(r)&&(r=r(e)),r||r!==!1&&qn(e.url))){const l=s&&i&&Dn.read(i);l&&o.set(s,l)}return e},Mn=typeof XMLHttpRequest<"u",zn=Mn&&function(t){return new Promise(function(e,n){const r=tt(t);let s=r.data;const i=R.from(r.headers).normalize();let{responseType:o,onUploadProgress:a,onDownloadProgress:u}=r,l,h,g,m,d;function b(){m&&m(),d&&d(),r.cancelToken&&r.cancelToken.unsubscribe(l),r.signal&&r.signal.removeEventListener("abort",l)}let f=new XMLHttpRequest;f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout;function S(){if(!f)return;const _=R.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),A={data:!o||o==="text"||o==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:_,config:t,request:f};Xe(function(P){e(P),b()},function(P){n(P),b()},A),f=null}"onloadend"in f?f.onloadend=S:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(S)},f.onabort=function(){f&&(n(new p("Request aborted",p.ECONNABORTED,t,f)),f=null)},f.onerror=function(){n(new p("Network Error",p.ERR_NETWORK,t,f)),f=null},f.ontimeout=function(){let _=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const A=r.transitional||Ve;r.timeoutErrorMessage&&(_=r.timeoutErrorMessage),n(new p(_,A.clarifyTimeoutError?p.ETIMEDOUT:p.ECONNABORTED,t,f)),f=null},s===void 0&&i.setContentType(null),"setRequestHeader"in f&&c.forEach(i.toJSON(),function(_,A){f.setRequestHeader(A,_)}),c.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),o&&o!=="json"&&(f.responseType=r.responseType),u&&([g,d]=te(u,!0),f.addEventListener("progress",g)),a&&f.upload&&([h,m]=te(a),f.upload.addEventListener("progress",h),f.upload.addEventListener("loadend",m)),(r.cancelToken||r.signal)&&(l=_=>{f&&(n(!_||_.type?new B(null,t,f):_),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(l),r.signal&&(r.signal.aborted?l():r.signal.addEventListener("abort",l)));const y=Ln(r.url);if(y&&E.protocols.indexOf(y)===-1){n(new p("Unsupported protocol "+y+":",p.ERR_BAD_REQUEST,t));return}f.send(s||null)})},Hn=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(l){if(!s){s=!0,a();const h=l instanceof Error?l:this.reason;r.abort(h instanceof p?h:new B(h instanceof Error?h.message:h))}};let o=e&&setTimeout(()=>{o=null,i(new p(`timeout ${e} of ms exceeded`,p.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),t=null)};t.forEach(l=>l.addEventListener("abort",i));const{signal:u}=r;return u.unsubscribe=()=>c.asap(a),u}},Wn=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},Vn=async function*(t,e){for await(const n of Jn(t))yield*Wn(n,e)},Jn=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},nt=(t,e,n,r)=>{const s=Vn(t,e);let i=0,o,a=u=>{o||(o=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:l,value:h}=await s.next();if(l){a(),u.close();return}let g=h.byteLength;if(n){let m=i+=g;n(m)}u.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(u){return a(u),s.return()}},{highWaterMark:2})},ne=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",rt=ne&&typeof ReadableStream=="function",Kn=ne&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),st=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Gn=rt&&st(()=>{let t=!1;const e=new Request(E.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),it=64*1024,ye=rt&&st(()=>c.isReadableStream(new Response("").body)),re={stream:ye&&(t=>t.body)};ne&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!re[e]&&(re[e]=c.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new p(`Response type '${e}' is not supported`,p.ERR_NOT_SUPPORT,r)})})})(new Response);const Xn=async t=>{if(t==null)return 0;if(c.isBlob(t))return t.size;if(c.isSpecCompliantForm(t))return(await new Request(E.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(c.isArrayBufferView(t)||c.isArrayBuffer(t))return t.byteLength;if(c.isURLSearchParams(t)&&(t=t+""),c.isString(t))return(await Kn(t)).byteLength},Qn=async(t,e)=>c.toFiniteNumber(t.getContentLength())??Xn(e),Yn=ne&&(async t=>{let{url:e,method:n,data:r,signal:s,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:l,headers:h,withCredentials:g="same-origin",fetchOptions:m}=tt(t);l=l?(l+"").toLowerCase():"text";let d=Hn([s,i&&i.toAbortSignal()],o),b;const f=d&&d.unsubscribe&&(()=>{d.unsubscribe()});let S;try{if(u&&Gn&&n!=="get"&&n!=="head"&&(S=await Qn(h,r))!==0){let C=new Request(e,{method:"POST",body:r,duplex:"half"}),I;if(c.isFormData(r)&&(I=C.headers.get("content-type"))&&h.setContentType(I),C.body){const[k,j]=Qe(S,te(Ye(u)));r=nt(C.body,it,k,j)}}c.isString(g)||(g=g?"include":"omit");const y="credentials"in Request.prototype;b=new Request(e,{...m,signal:d,method:n.toUpperCase(),headers:h.normalize().toJSON(),body:r,duplex:"half",credentials:y?g:void 0});let _=await fetch(b);const A=ye&&(l==="stream"||l==="response");if(ye&&(a||A&&f)){const C={};["status","statusText","headers"].forEach(M=>{C[M]=_[M]});const I=c.toFiniteNumber(_.headers.get("content-length")),[k,j]=a&&Qe(I,te(Ye(a),!0))||[];_=new Response(nt(_.body,it,k,()=>{j&&j(),f&&f()}),C)}l=l||"text";let P=await re[c.findKey(re,l)||"text"](_,t);return!A&&f&&f(),await new Promise((C,I)=>{Xe(C,I,{data:P,headers:R.from(_.headers),status:_.status,statusText:_.statusText,config:t,request:b})})}catch(y){throw f&&f(),y&&y.name==="TypeError"&&/fetch/i.test(y.message)?Object.assign(new p("Network Error",p.ERR_NETWORK,t,b),{cause:y.cause||y}):p.from(y,y&&y.code,t,b)}}),we={http:fn,xhr:zn,fetch:Yn};c.forEach(we,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ot=t=>`- ${t}`,Zn=t=>c.isFunction(t)||t===null||t===!1,ct={getAdapter:t=>{t=c.isArray(t)?t:[t];const{length:e}=t;let n,r;const s={};for(let i=0;i<e;i++){n=t[i];let o;if(r=n,!Zn(n)&&(r=we[(o=String(n)).toLowerCase()],r===void 0))throw new p(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+i]=r}if(!r){const i=Object.entries(s).map(([a,u])=>`adapter ${a} `+(u===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
|
4
|
-
`+i.map(ot).join(`
|
5
|
-
`):" "+ot(i[0]):"as no adapter specified";throw new p("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:we};function Ee(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new B(null,t)}function at(t){return Ee(t),t.headers=R.from(t.headers),t.data=_e.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),ct.getAdapter(t.adapter||W.adapter)(t).then(function(e){return Ee(t),e.data=_e.call(t,t.transformResponse,e),e.headers=R.from(e.headers),e},function(e){return Ge(e)||(Ee(t),e&&e.response&&(e.response.data=_e.call(t,t.transformResponse,e.response),e.response.headers=R.from(e.response.headers))),Promise.reject(e)})}const lt="1.7.9",se={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{se[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});const ut={};se.transitional=function(t,e,n){function r(s,i){return"[Axios v"+lt+"] Transitional option '"+s+"'"+i+(n?". "+n:"")}return(s,i,o)=>{if(t===!1)throw new p(r(i," has been removed"+(e?" in "+e:"")),p.ERR_DEPRECATED);return e&&!ut[i]&&(ut[i]=!0,console.warn(r(i," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,i,o):!0}},se.spelling=function(t){return(e,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function er(t,e,n){if(typeof t!="object")throw new p("options must be an object",p.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],o=e[i];if(o){const a=t[i],u=a===void 0||o(a,i,t);if(u!==!0)throw new p("option "+i+" must be "+u,p.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new p("Unknown option "+i,p.ERR_BAD_OPTION)}}const ie={assertOptions:er,validators:se},T=ie.validators;let U=class{constructor(t){this.defaults=t,this.interceptors={request:new We,response:new We}}async request(t,e){try{return await this._request(t,e)}catch(n){if(n instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{n.stack?s&&!String(n.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(n.stack+=`
|
6
|
-
`+s):n.stack=s}catch{}}throw n}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=L(this.defaults,e);const{transitional:n,paramsSerializer:r,headers:s}=e;n!==void 0&&ie.assertOptions(n,{silentJSONParsing:T.transitional(T.boolean),forcedJSONParsing:T.transitional(T.boolean),clarifyTimeoutError:T.transitional(T.boolean)},!1),r!=null&&(c.isFunction(r)?e.paramsSerializer={serialize:r}:ie.assertOptions(r,{encode:T.function,serialize:T.function},!0)),ie.assertOptions(e,{baseUrl:T.spelling("baseURL"),withXsrfToken:T.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let i=s&&c.merge(s.common,s[e.method]);s&&c.forEach(["delete","get","head","post","put","patch","common"],d=>{delete s[d]}),e.headers=R.concat(i,s);const o=[];let a=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(a=a&&d.synchronous,o.unshift(d.fulfilled,d.rejected))});const u=[];this.interceptors.response.forEach(function(d){u.push(d.fulfilled,d.rejected)});let l,h=0,g;if(!a){const d=[at.bind(this),void 0];for(d.unshift.apply(d,o),d.push.apply(d,u),g=d.length,l=Promise.resolve(e);h<g;)l=l.then(d[h++],d[h++]);return l}g=o.length;let m=e;for(h=0;h<g;){const d=o[h++],b=o[h++];try{m=d(m)}catch(f){b.call(this,f);break}}try{l=at.call(this,m)}catch(d){return Promise.reject(d)}for(h=0,g=u.length;h<g;)l=l.then(u[h++],u[h++]);return l}getUri(t){t=L(this.defaults,t);const e=Ze(t.baseURL,t.url);return He(e,t.params,t.paramsSerializer)}};c.forEach(["delete","get","head","options"],function(t){U.prototype[t]=function(e,n){return this.request(L(n||{},{method:t,url:e,data:(n||{}).data}))}}),c.forEach(["post","put","patch"],function(t){function e(n){return function(r,s,i){return this.request(L(i||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}U.prototype[t]=e(),U.prototype[t+"Form"]=e(!0)});let tr=class xt{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(s,i,o){r.reason||(r.reason=new B(s,i,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new xt(function(n){e=n}),cancel:e}}};function nr(t){return function(e){return t.apply(null,e)}}function rr(t){return c.isObject(t)&&t.isAxiosError===!0}const Se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Se).forEach(([t,e])=>{Se[e]=t});function ht(t){const e=new U(t),n=Ae(U.prototype.request,e);return c.extend(n,U.prototype,e,{allOwnKeys:!0}),c.extend(n,e,null,{allOwnKeys:!0}),n.create=function(r){return ht(L(t,r))},n}const w=ht(W);w.Axios=U,w.CanceledError=B,w.CancelToken=tr,w.isCancel=Ge,w.VERSION=lt,w.toFormData=Z,w.AxiosError=p,w.Cancel=w.CanceledError,w.all=function(t){return Promise.all(t)},w.spread=nr,w.isAxiosError=rr,w.mergeConfig=L,w.AxiosHeaders=R,w.formToJSON=t=>Je(c.isHTMLForm(t)?new FormData(t):t),w.getAdapter=ct.getAdapter,w.HttpStatusCode=Se,w.default=w;const{Axios:Fr,AxiosError:qr,CanceledError:Dr,isCancel:Br,CancelToken:$r,VERSION:Mr,all:zr,Cancel:Hr,isAxiosError:Wr,spread:Vr,toFormData:Jr,AxiosHeaders:Kr,HttpStatusCode:Gr,formToJSON:Xr,getAdapter:Qr,mergeConfig:Yr}=w,Re=w.create({baseURL:location.origin,timeout:6e4,params:{}});Re.interceptors.response.use(t=>t,t=>{var e,n,r,s,i,o,a,u,l,h,g;if(t.response){if(t.response.status===401&&OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity,!0).then(function(b){b&&OpenC3Auth.setTokens()}),t.response.config.headers["Ignore-Errors"]&&t.response.config.headers["Ignore-Errors"].includes(t.response.status.toString()))return Promise.reject(t);let m=`HTTP ${t.response.status} - `;(e=t.response)!=null&&e.statusText&&(m+=`${t.response.statusText} `),(r=(n=t.response)==null?void 0:n.config)!=null&&r.data&&(m+=`${t.response.config.data} `),(i=(s=t.response)==null?void 0:s.data)!=null&&i.message?m+=`${t.response.data.message}`:(a=(o=t.response)==null?void 0:o.data)!=null&&a.exception?m+=`${t.response.data.exception}`:(h=(l=(u=t.response)==null?void 0:u.data)==null?void 0:l.error)!=null&&h.message?(t.response.data.error.class&&(m+=`${t.response.data.error.class} `),m+=`${t.response.data.error.message}`):m+=`${(g=t.response)==null?void 0:g.data}`;const{$cosmosNotify:d}=window;throw d&&d.serious({title:"Network error",body:m}),t}else throw t});const oe=async function(t,e,{data:n,params:r={},headers:s,noAuth:i=!1,noScope:o=!1,onUploadProgress:a=!1}={}){if(!i){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}s.Authorization=localStorage.openc3Token}return s.manual=!0,!o&&!r.scope&&(r.scope=window.openc3Scope),Re({method:t,url:e,data:n,params:r,headers:s,onUploadProgress:a})},xe={Accept:"application/json"},dt={...xe,"Content-Type":"application/json"},Zr=ae("Z",{get:function(t,{params:e,headers:n=xe,noScope:r,noAuth:s,onUploadProgress:i}={}){return oe("get",t,{params:e,headers:n,noScope:r,noAuth:s,onUploadProgress:i})},put:function(t,{data:e,params:n,headers:r=dt,noScope:s,noAuth:i,onUploadProgress:o}={}){return oe("put",t,{data:e,params:n,headers:r,noScope:s,noAuth:i,onUploadProgress:o})},post:function(t,{data:e,params:n,headers:r=dt,noScope:s,noAuth:i,onUploadProgress:o}={}){return oe("post",t,{data:e,params:n,headers:r,noScope:s,noAuth:i,onUploadProgress:o})},delete:function(t,{params:e,headers:n=xe,noScope:r,noAuth:s,onUploadProgress:i}={}){return oe("delete",t,{params:e,headers:n,noScope:r,noAuth:s,onUploadProgress:i})}});let ce=()=>({emit(t,...e){for(let n=this.events[t]||[],r=0,s=n.length;r<s;r++)n[r](...e)},events:{},on(t,e){var n;return((n=this.events)[t]||(n[t]=[])).push(e),()=>{var r;this.events[t]=(r=this.events[t])==null?void 0:r.filter(s=>e!==s)}}});class J extends Error{constructor(e,n){e instanceof Error?(super(e.message),this.cause=e):super(e),this.reason=n,this.name="ReasonError"}}class ve extends J{constructor(e){super("Rejected",e),this.name="SubscriptionRejectedError"}}class sr extends J{constructor(e){super(e||"Timed out to receive subscription ack"),this.name="SubscriptionTimeoutError"}}class O extends J{constructor(e,n){n?super(e,n):super("Disconnected",e),this.name="DisconnectedError"}}class ir extends O{constructor(e){super(e,"stale_connection"),this.name="StaleConnectionError"}}function ft(t){return t?`{${Object.keys(t).sort().filter(e=>t[e]!==void 0).map(e=>{let n=JSON.stringify(t[e]);return`${JSON.stringify(e)}:${n}`}).join(",")}}`:""}class or{constructor(e){this.channel=e,this.listeners=[]}watch(){this.listeners.push(this.channel.on("presence",e=>{if(e.type==="info"){this._state||(this._state=this.stateFromInfo(e));return}this._state&&(e.type==="join"?this._state[e.id]=e.info:e.type==="leave"&&delete this._state[e.id])}))}reset(){delete this._state}dispose(){delete this._info,delete this._state,this.listeners.forEach(e=>e()),this.listeners.length=0}async join(e,n){if(!this._info)return this._info={id:e,info:n},this.channel.perform("$presence:join",this._info)}async leave(){if(!this._info)return;let e=await this.channel.perform("$presence:leave");return delete this._info,e}async info(){return this._state?this._state:(this._promise||(this._promise=this._sync()),await this._promise,this._state)}async _sync(){this.watch();try{let e=await this.channel.perform("$presence:info",{});return this._state=this.stateFromInfo(e),this._state}finally{delete this._promise}}stateFromInfo(e){return e.records.reduce((n,{id:r,info:s})=>(n[r]=s,n),{})}}const F=Symbol("state");class pt{constructor(e={}){this.emitter=ce(),this.params=Object.freeze(e),this.presence=new or(this),this.initialConnect=!0,this[F]="idle"}get identifier(){return this._identifier?this._identifier:(this._identifier=ft({channel:this.channelId,...this.params}),this._identifier)}get channelId(){return this.constructor.identifier}get state(){return this[F]}attached(e){if(this.receiver){if(this.receiver!==e)throw Error("Already connected to a different receiver");return!1}return this.receiver=e,!0}connecting(){this[F]="connecting"}connected(){if(this.state==="connected"||this.state==="closed")return;this[F]="connected";let e=!1;this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:e})):this.emit("connect",{reconnect:!0,restored:e})}restored(){if(this.state==="connected")throw Error("Already connected");this[F]="connected";let e=!0,n=!0;this.initialConnect=!1,this.emit("connect",{reconnect:n,restored:e})}disconnected(e){this.state==="disconnected"||this.state==="closed"||(this[F]="disconnected",this.presence.reset(),this.emit("disconnect",e))}closed(e){this.state!=="closed"&&(this[F]="closed",delete this.receiver,this.initialConnect=!0,this.presence.dispose(),this.emit("close",e))}disconnect(){this.state==="idle"||this.state==="closed"||this.receiver.unsubscribe(this)}async perform(e,n){if(this.state==="idle"||this.state==="closed")throw Error("Channel is not subscribed");return this.receiver.perform(this.identifier,e,n)}async send(e){return this.perform(void 0,e)}async whisper(e){try{await this.perform("$whisper",e)}catch(n){let r=this.receiver?this.receiver.logger:null;r&&r.warn("whisper failed: ",n)}}receive(e,n){this.emit("message",e,n)}on(e,n){return this.emitter.on(e,n)}once(e,n){let r=this.emitter.on(e,(...s)=>{r(),n(...s)});return r}emit(e,...n){return this.emitter.emit(e,...n)}ensureSubscribed(){return this.state==="connected"?Promise.resolve():this.state==="closed"?Promise.reject(Error("Channel is unsubscribed")):this.pendingSubscribe()}pendingSubscribe(){return this._pendingSubscribe?this._pendingSubscribe:(this._pendingSubscribe=new Promise((e,n)=>{let r=[()=>delete this._pendingSubscribe];r.push(this.on("connect",()=>{r.forEach(s=>s()),e()})),r.push(this.on("close",s=>{r.forEach(i=>i()),n(s||new J("Channel was disconnected before subscribing","canceled"))}))}),this._pendingSubscribe)}}class cr{constructor(e){this.id=e,this.intent="unsubscribed",this.state="idle",this.channels=[],this.disposed=!1,this._pendings=[]}add(e){this.channels.includes(e)||this.channels.push(e)}remove(e){let n=this.channels.indexOf(e);n>-1&&this.channels.splice(n,1)}notify(e,...n){this.state=e==="restored"?"connected":e,n.length===1?this.channels.forEach(r=>r[e](n[0])):this.channels.forEach(r=>r[e]())}pending(e){this._checkIntent(e);let n=this._pendings[0];return!n||n.intent!==e?Promise.resolve():n.promise}ensureResubscribed(){this.disposed||(this.intent=void 0,this.ensureSubscribed())}ensureSubscribed(){if(this.intent!=="subscribed"){if(this.disposed)throw Error("Subscription is disposed");this.intent="subscribed",!this._mergeWithPending("unsubscribed")&&this.subscriber(this)}}maybeUnsubscribe(){this.disposed||this.intent==="unsubscribed"||this.channels.length>0||(this.intent="unsubscribed",this._mergeWithPending("subscribed"))||this.unsubscriber(this)}async acquire(e){this._checkIntent(e);let n,r={promise:new Promise(i=>{n=i}),intent:e,release:()=>{this._pendings.splice(this._pendings.indexOf(r),1),n(r)},canceled:!1,acquired:!1},s=this._pendingTop;return this._pendings.push(r),s&&await s.promise,this.gvl&&await this.gvl.acquire(r,e),r.acquired=!0,r}close(e){this.disposed=!0,this.intent=void 0,this.notify("closed",e)}_checkIntent(e){if(!(e==="unsubscribed"||e==="subscribed"))throw Error(`Unknown subscription intent: ${e}`)}get _pendingTop(){return this._pendings.length?this._pendings[this._pendings.length-1]:void 0}_mergeWithPending(e){let n=this._pendingTop;return!n||n.acquired||n.intent!==e?!1:(this._pendings.pop(),n.canceled=!0,!0)}}class ar{constructor(){this.queue=[]}async acquire(e,n){n==="subscribed"&&(this.queue.push(e.promise.then(()=>{this.queue.splice(this.queue.indexOf(e),1)})),this.queue.length>1&&await this.queue[this.queue.length-2])}}class lr{constructor(e){e.concurrentSubscribes===!1&&(this.glv=new ar),this._subscriptions={},this._localToRemote={}}all(){return Object.values(this._subscriptions)}get(e){return this._subscriptions[e]}create(e,{subscribe:n,unsubscribe:r}){let s=this._subscriptions[e]=new cr(e);return s.remoteId=this._localToRemote[e],s.subscriber=n,s.unsubscriber=r,s.gvl=this.glv,s}remove(e){delete this._subscriptions[e],delete this._localToRemote[e]}storeRemoteId(e,n){this._localToRemote[e]=n;let r=this.get(e);r&&(r.remoteId=n)}}class ur{constructor(e={}){this.subscriptions=new lr(e),this._pendingMessages=[],this._remoteToLocal={}}subscribe(e,n){this._remoteToLocal[n]=e,this.subscriptions.storeRemoteId(e,n),this.flush(n)}unsubscribe(e){let n=this.subscriptions.get(e);if(!n)return;let r=n.remoteId;r&&delete this._remoteToLocal[r],this.subscriptions.remove(e)}transmit(e,n,r){let s=this._remoteToLocal[e];if(!s){this._pendingMessages.push([e,n,r]);return}let i=this.subscriptions.get(s);i&&i.channels.forEach(o=>{o.receive(n,r)})}notify(e,n,r){let s=this._remoteToLocal[e];if(!s)return;let i=this.subscriptions.get(s);i&&i.channels.forEach(o=>o.emit(n,r))}close(){this._pendingMessages.length=0}get size(){return this.channels.length}get channels(){return this.subscriptions.all().flatMap(e=>e.channels)}flush(e){let n=[];for(let r of this._pendingMessages)r[0]===e?this.transmit(r[0],r[1],r[2]):n.push(r);this._pendingMessages=n}}const gt={debug:0,info:1,warn:2,error:3};class mt{constructor(e){this.level=e||"warn"}log(e,n,r){gt[e]<gt[this.level]||this.writeLogEntry(e,n,r)}writeLogEntry(){throw Error("Not implemented")}debug(e,n){this.log("debug",e,n)}info(e,n){this.log("info",e,n)}warn(e,n){this.log("warn",e,n)}error(e,n){this.log("error",e,n)}}class K extends mt{writeLogEntry(){}}class hr{encode(e){return JSON.stringify(e)}decode(e){try{return JSON.parse(e)}catch{}}}let dr=0;class bt{constructor(e={}){let{logger:n}=e;this.logger=n||new K,this.pendingSubscriptions={},this.pendingUnsubscriptions={},this.subscribeCooldownInterval=e.subscribeCooldownInterval||250,this.subscribeRetryInterval=e.subscribeRetryInterval||5e3}attached(e){this.cable=e}subscribe(e,n){let r={channel:e};n&&Object.assign(r,n);let s=ft(r);if(this.pendingUnsubscriptions[s]){let o=this.subscribeCooldownInterval*1.5;return this.logger.debug(`unsubscribed recently, cooldown for ${o}`,s),new Promise(a=>{setTimeout(()=>{a(this.subscribe(e,n))},o)})}if(this.pendingSubscriptions[s])return this.logger.warn("subscription is already pending, skipping",s),Promise.reject(Error("Already subscribing"));let i=this.subscribeRetryInterval;return new Promise((o,a)=>{let u=++dr;this.pendingSubscriptions[s]={resolve:o,reject:a,id:u},this.cable.send(this.buildSubscribeRequest(s)),this.maybeRetrySubscribe(u,s,i)})}buildSubscribeRequest(e){return{command:"subscribe",identifier:e}}maybeRetrySubscribe(e,n,r){setTimeout(()=>{let s=this.pendingSubscriptions[n];s&&s.id===e&&(this.logger.warn(`no subscription ack received in ${r}ms, retrying subscribe`,n),this.cable.send(this.buildSubscribeRequest(n)),this.maybeExpireSubscribe(e,n,r))},r)}maybeExpireSubscribe(e,n,r){setTimeout(()=>{let s=this.pendingSubscriptions[n];s&&s.id===e&&(delete this.pendingSubscriptions[n],s.reject(new sr(`Haven't received subscription ack in ${r*2}ms for ${n}`)))},r)}unsubscribe(e){return this.cable.send({command:"unsubscribe",identifier:e}),this.pendingUnsubscriptions[e]=!0,setTimeout(()=>{delete this.pendingUnsubscriptions[e]},this.subscribeCooldownInterval),Promise.resolve()}perform(e,n,r){return n==="$whisper"?this.whisper(e,r):(r||(r={}),r.action=n,this.cable.send({command:"message",identifier:e,data:JSON.stringify(r)}),Promise.resolve())}whisper(e,n){return this.cable.send({command:"whisper",identifier:e,data:n}),Promise.resolve()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:n,identifier:r,message:s,reason:i,reconnect:o}=e;if(n==="ping")return this.cable.keepalive(e.message);if(this.cable.keepalive(),n==="welcome"){let a=e.sid;return a&&this.cable.setSessionId(a),this.cable.connected()}if(n==="disconnect"){let a=new O(i);this.reset(a),o===!1?this.cable.closed(a):this.cable.disconnected(a);return}if(n==="confirm_subscription"){let a=this.pendingSubscriptions[r];if(!a){this.logger.error("subscription not found, unsubscribing",{type:n,identifier:r}),this.unsubscribe(r);return}return delete this.pendingSubscriptions[r],a.resolve(r)}if(n==="reject_subscription"){let a=this.pendingSubscriptions[r];return a?(delete this.pendingSubscriptions[r],a.reject(new ve)):this.logger.error("subscription not found",{type:n,identifier:r})}if(s)return{identifier:r,message:s};this.logger.warn(`unknown message type: ${n}`,{message:e})}reset(e){for(let n in this.pendingSubscriptions)this.pendingSubscriptions[n].reject(e);this.pendingSubscriptions={}}recoverableClosure(){return!1}}const _t=()=>Date.now()/1e3|0;class fr extends bt{constructor(e={}){super(e),this.streamsPositions={},this.subscriptionStreams={},this.pendingHistory={},this.pendingPresence={},this.presenceInfo={},this.restoreSince=e.historyTimestamp,this.restoreSince===void 0&&(this.restoreSince=_t()),this.sessionId=void 0,this.sendPongs=e.pongs}reset(e){for(let n in this.pendingPresence)this.pendingPresence[n].reject(e);return this.pendingPresence={},super.reset()}receive(e){if(typeof e!="object"){this.logger.error("unsupported message format",{message:e});return}let{type:n,identifier:r,message:s}=e;if(n==="disconnect"||n==="reject_subscription")return super.receive(e);if(n==="confirm_subscription")return this.subscriptionStreams[r]||(this.subscriptionStreams[r]=new Set),super.receive(e);if(n==="ping")return this.restoreSince&&(this.restoreSince=_t()),this.sendPongs&&this.sendPong(),this.cable.keepalive(e.message);if(this.cable.keepalive(),n==="confirm_history"){this.logger.debug("history result received",e),this.cable.notify("history_received",r);return}if(n==="reject_history"){this.logger.warn("failed to retrieve history",e),this.cable.notify("history_not_found",r);return}if(n==="welcome"){if(this.sessionId=e.sid,this.sessionId&&this.cable.setSessionId(this.sessionId),e.restored){let i=e.restored_ids||Object.keys(this.subscriptionStreams);for(let o of i)this.cable.send({identifier:o,command:"history",history:this.historyRequestFor(o)}),this.presenceInfo[o]&&this.cable.send({identifier:o,command:"join",presence:this.presenceInfo[o]});return this.cable.restored(i)}return this.cable.connected(this.sessionId)}if(n==="presence"){let i=s.type;if(i==="info"){let o=this.pendingPresence[r];o&&(delete this.pendingPresence[r],o.resolve(s))}else if(i==="error"){let o=this.pendingPresence[r];o&&(delete this.pendingPresence[r],o.reject(new Error("failed to retrieve presence")))}return{type:n,identifier:r,message:s}}if(s){let i=this.trackStreamPosition(r,e.stream_id,e.epoch,e.offset);return{identifier:r,message:s,meta:i}}this.logger.warn(`unknown message type: ${n}`,{message:e})}perform(e,n,r){switch(n){case"$presence:join":return this.join(e,r);case"$presence:leave":return this.leave(e,r);case"$presence:info":return this.presence(e,r)}return super.perform(e,n,r)}unsubscribe(e){return delete this.presenceInfo[e],super.unsubscribe(e)}buildSubscribeRequest(e){let n=super.buildSubscribeRequest(e),r=this.historyRequestFor(e);r&&(n.history=r,this.pendingHistory[e]=!0);let s=this.presenceInfo[e];return s&&(n.presence=s),n}recoverableClosure(){return!!this.sessionId}historyRequestFor(e){let n={},r=!1;if(this.subscriptionStreams[e])for(let s of this.subscriptionStreams[e]){let i=this.streamsPositions[s];i&&(r=!0,n[s]=i)}if(!(!r&&!this.restoreSince))return{since:this.restoreSince,streams:n}}trackStreamPosition(e,n,r,s){if(!(!n||!r))return this.subscriptionStreams[e]||(this.subscriptionStreams[e]=new Set),this.subscriptionStreams[e].add(n),this.streamsPositions[n]={epoch:r,offset:s},{stream:n,epoch:r,offset:s}}async sendPong(){await new Promise(e=>setTimeout(e,0)),this.cable.state==="connected"&&this.cable.send({command:"pong"})}async join(e,n){return this.presenceInfo[e]=n,this.cable.send({command:"join",identifier:e,presence:n}),Promise.resolve()}async leave(e,n){return delete this.presenceInfo[e],this.cable.send({command:"leave",identifier:e,presence:n}),Promise.resolve()}presence(e,n){return this.pendingPresence[e]?(this.logger.warn("presence is already pending, skipping",e),Promise.reject(Error("presence request is already pending"))):new Promise((r,s)=>{this.pendingPresence[e]={resolve:r,reject:s},this.cable.send({command:"presence",identifier:e,data:n})})}}class pr extends J{constructor(){super("No connection","closed"),this.name="NoConnectionError"}}class Oe extends pt{constructor(e,n){super(n),this.channelId=e}set channelId(e){this._channelId=e}get channelId(){return this._channelId}}le(Oe,"identifier","__ghost__");const gr="$pubsub";class Te extends pt{async perform(e,n){if(e.startsWith("$"))return super.perform(e,n);throw Error("not implemented")}}le(Te,"identifier",gr);const q=Symbol("state");let mr=class{constructor({transport:t,protocol:e,encoder:n,logger:r,lazy:s,hubOptions:i,performFailures:o}){this.emitter=ce(),this.transport=t,this.encoder=n,this.logger=r||new K,this.protocol=e,this.performFailures=o||"throw",this.protocol.attached(this),this.hub=new ur(i||{}),this[q]="idle",this.handleClose=this.handleClose.bind(this),this.handleIncoming=this.handleIncoming.bind(this),this.transport.on("close",this.handleClose),this.transport.on("data",this.handleIncoming),this.initialConnect=!0,this.recovering=!1,s===!1&&this.connect().catch(()=>{})}get state(){return this[q]}async connect(){if(this.state==="connected")return Promise.resolve();if(this.state==="connecting")return this.pendingConnect();this[q]="connecting";let t=this.pendingConnect();this.logger.debug("connecting");try{await this.transport.open()}catch(e){this.handleClose(e)}return t}setSessionId(t){this.sessionId=t,this.transport.setParam("sid",t)}connected(){if(this.state==="connected")return;this.logger.info("connected"),this[q]="connected",this.recovering&&this.hub.subscriptions.all().forEach(e=>e.notify("disconnected",new O("recovery_failed"))),this.hub.subscriptions.all().forEach(e=>this._resubscribe(e));let t=!1;this.recovering=!1,this.initialConnect?(this.initialConnect=!1,this.emit("connect",{reconnect:!1,restored:t})):this.emit("connect",{reconnect:!0,restored:t})}restored(t){this.logger.info("connection recovered",{remoteIds:t}),this[q]="connected",this.hub.subscriptions.all().forEach(r=>{t&&r.remoteId&&t.includes(r.remoteId)?r.notify("restored"):(r.notify("disconnected",new O("recovery_failed")),this._resubscribe(r))});let e=!this.initialConnect,n=!0;this.recovering=!1,this.initialConnect=!1,this.emit("connect",{reconnect:e,restored:n})}notify(t,e,n){e&&typeof e!="string"&&(n=e,e=void 0),e?this.hub.notify(e,"info",{type:t,data:n}):this.emit("info",{type:t,data:n})}handleClose(t){this.logger.debug("transport closed",{error:t}),this.disconnected(new O(t,"transport_closed"))}disconnected(t){(this.state==="connected"||this.state==="connecting")&&(this.logger.info("disconnected",{reason:t}),this[q]="disconnected",this.recovering=this.protocol.recoverableClosure(t),this.recovering?this.hub.subscriptions.all().forEach(e=>e.notify("connecting")):this.hub.subscriptions.all().forEach(e=>{e.notify("disconnected",t)}),this.protocol.reset(t),this.hub.close(),this.transport.close(),this.emit("disconnect",t))}closed(t){if(this.state==="closed"||this.state==="idle")return;let e;t&&(e=t instanceof O?t:new O(t,void 0)),this.logger.info("closed",{reason:t||"user"}),this[q]="closed";let n=e||new O("cable_closed");this.hub.subscriptions.all().forEach(r=>r.notify("disconnected",n)),this.hub.close(),this.protocol.reset(),this.transport.close(),this.initialConnect=!0,this.emit("close",e)}disconnect(){this.closed()}handleIncoming(t){if(this.state==="closed"||this.state==="idle")return;let e=this.encoder.decode(t);if(e===void 0){this.logger.error("failed to decode message",{message:t});return}this.logger.debug("incoming data",e);let n=this.protocol.receive(e);if(n){this.logger.debug("processed incoming message",n);let{type:r,identifier:s,message:i,meta:o}=n;r?this.hub.notify(s,r,i):this.hub.transmit(s,i,o)}}send(t){if(this.state==="closed")throw Error("Cable is closed");let e=this.encoder.encode(t);if(e===void 0){this.logger.error("failed to encode message",{message:t});return}this.logger.debug("outgoing message",t),this.transport.send(e)}keepalive(t){this.emit("keepalive",t)}streamFrom(t){let e=new Te({stream_name:t});return this.subscribe(e)}streamFromSigned(t){let e=new Te({signed_stream_name:t});return this.subscribe(e)}subscribeTo(t,e){let n,r;return typeof t=="string"&&(r=t,t=Oe),n=r?new t(r,e):new t(e),this.subscribe(n)}subscribe(t){if(!t.attached(this))return t;let e=t.identifier;t.connecting();let n=this.hub.subscriptions.get(e)||this.hub.subscriptions.create(e,{subscribe:r=>this._subscribe(r,t.channelId,t.params),unsubscribe:r=>this._unsubscribe(r)});return n.add(t),n.intent==="subscribed"&&n.state==="connected"&&t.connected(),n.ensureSubscribed(),t}async _resubscribe(t){t.intent!=="subscribed"||!t.channels[0]||(t.notify("connecting"),t.ensureResubscribed())}async _subscribe(t,e,n){let r=t.id;if(this.state==="idle"&&this.connect().catch(()=>{}),this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r});return}this.logger.debug("acquiring subscribe lock",{identifier:r});let s=await t.acquire("subscribed");if(s.canceled){this.logger.debug("subscribe lock has been canceled",{identifier:r}),s.release();return}if(this.logger.debug("subscribe lock has been acquired",{identifier:r}),t.intent!=="subscribed"){this.logger.debug("cancel subscribe request, already unsubscribed"),s.release();return}if(this.state!=="connected"){this.logger.debug("cancel subscribe, no connection",{identifier:r}),s.release();return}if(t.state==="connected"){this.logger.debug("already connected, skip subscribe command",{identifier:r}),t.notify("connected"),s.release();return}let i={identifier:e,params:n};this.logger.debug("subscribing",i);try{let o=await this.protocol.subscribe(e,n);this.hub.subscribe(r,o),this.logger.debug("subscribed",{...i,remoteId:o}),t.notify("connected")}catch(o){if(o){if(o instanceof ve&&this.logger.warn("rejected",i),o instanceof O){this.logger.debug("disconnected during subscription; will retry on connect",i),s.release();return}this.logger.error("failed to subscribe",{error:o,...i})}t.close(o),this.hub.unsubscribe(r)}s.release()}unsubscribe(t){let e=t.identifier,n=this.hub.subscriptions.get(e);if(!n)throw Error(`Subscription not found: ${e}`);n.remove(t),t.closed(),n.maybeUnsubscribe()}async _unsubscribe(t){let e=t.id;this.logger.debug("acquiring unsubscribe lock",{identifier:e});let n=await t.acquire("unsubscribed");if(n.canceled){this.logger.debug("unsubscribe lock has been canceled",{identifier:e}),n.release();return}if(this.logger.debug("unsubscribe lock has been acquired",{identifier:e}),t.intent!=="unsubscribed"){this.logger.debug("cancel unsubscribe, no longer needed",{identifier:e,intent:t.intent}),n.release();return}if(t.state==="disconnected"||t.state==="closed"){this.logger.debug(`already ${t.state} connected, skip unsubscribe command`,{identifier:e}),n.release();return}let r=t.remoteId;if(this.logger.debug("unsubscribing...",{remoteId:r}),this.state!=="connected"){this.logger.debug("unsubscribe skipped (cable is not connected)",{id:e}),t.close(),this.hub.unsubscribe(e),n.release();return}try{await this.protocol.unsubscribe(r),this.logger.debug("unsubscribed remotely",{id:e})}catch(s){s&&(s instanceof O?this.logger.debug("cable disconnected during the unsubscribe command execution",{id:e,error:s}):this.logger.error("unsubscribe failed",{id:e,error:s}))}t.intent==="unsubscribed"?(t.close(),this.hub.unsubscribe(e)):t.state="closed",n.release()}async perform(t,e,n){if(this.performFailures==="throw")return this._perform(t,e,n);try{return await this._perform(t,e,n)}catch(r){this.performFailures==="warn"&&this.logger.warn("perform failed",{error:r});return}}async _perform(t,e,n){if(this.state==="connecting"&&await this.pendingConnect(),this.state==="closed"||this.state==="disconnected")throw new pr;let r=this.hub.subscriptions.get(t);if(!r)throw Error(`Subscription not found: ${t}`);if(await r.pending("subscribed"),r.intent!=="subscribed")throw Error(`Subscription is closed: ${t}`);let s=r.remoteId,i={id:s,action:e,payload:n};this.logger.debug("perform",i);try{let o=await this.protocol.perform(s,e,n);return o&&this.logger.debug("perform result",{message:o,request:i}),o}catch(o){throw this.logger.error("perform failed",{error:o,request:i}),o}}on(t,e){return this.emitter.on(t,e)}once(t,e){let n=this.emitter.on(t,(...r)=>{n(),e(...r)});return n}emit(t,...e){return this.emitter.emit(t,...e)}pendingConnect(){return this._pendingConnect?this._pendingConnect:(this._pendingConnect=new Promise((t,e)=>{let n=[()=>delete this._pendingConnect];n.push(this.on("connect",()=>{n.forEach(r=>r()),t()})),n.push(this.on("close",r=>{n.forEach(s=>s()),e(r)})),n.push(this.on("disconnect",r=>{n.forEach(s=>s()),e(r)}))}),this._pendingConnect)}};const br={maxMissingPings:2,maxReconnectAttempts:1/0},$=()=>Date.now(),yt=(t,e)=>{e=e||{};let{backoffRate:n,jitterRatio:r,maxInterval:s}=e;return n=n||2,r===void 0&&(r=.5),i=>{let o=t*n**i,a=o*n,u=o+(a-o)*Math.random(),l=2*(Math.random()-.5)*r;return u=u*(1+l),s&&s<u&&(u=s),u}};let wt=class{constructor({pingInterval:t,...e}){if(this.pingInterval=t,!this.pingInterval)throw Error(`Incorrect pingInterval is provided: ${t}`);if(e=Object.assign({},br,e),this.strategy=e.reconnectStrategy,!this.strategy)throw Error("Reconnect strategy must be provided");this.maxMissingPings=e.maxMissingPings,this.maxReconnectAttempts=e.maxReconnectAttempts,this.logger=e.logger||new K,this.state="pending_connect",this.attempts=0,this.disconnectedAt=$()}watch(t){this.target=t,this.initListeners()}reconnectNow(){return this.state==="connected"||this.state==="pending_connect"||this.state==="closed"?!1:(this.cancelReconnect(),this.state="pending_connect",this.target.connect().catch(t=>{this.logger.info("Failed at reconnecting: "+t)}),!0)}initListeners(){this.unbind=[],this.unbind.push(this.target.on("connect",()=>{this.attempts=0,this.pingedAt=$(),this.state="connected",this.cancelReconnect(),this.startPolling()})),this.unbind.push(this.target.on("disconnect",()=>{this.disconnectedAt=$(),this.state="disconnected",this.stopPolling(),this.scheduleReconnect()})),this.unbind.push(this.target.on("close",()=>{this.disconnectedAt=$(),this.state="closed",this.cancelReconnect(),this.stopPolling()})),this.unbind.push(this.target.on("keepalive",()=>{this.pingedAt=$()})),this.unbind.push(()=>{this.cancelReconnect(),this.stopPolling()})}dispose(){delete this.target,this.unbind&&this.unbind.forEach(t=>t()),delete this.unbind}startPolling(){this.pollId&&clearTimeout(this.pollId);let t=this.pingInterval+(Math.random()-.5)*this.pingInterval*.5;this.pollId=setTimeout(()=>{this.checkStale(),this.state==="connected"&&this.startPolling()},t)}stopPolling(){this.pollId&&clearTimeout(this.pollId)}checkStale(){let t=$()-this.pingedAt;t>this.maxMissingPings*this.pingInterval&&(this.logger.warn(`Stale connection: ${t}ms without pings`),this.state="pending_disconnect",this.target.disconnected(new ir))}scheduleReconnect(){if(this.attempts>=this.maxReconnectAttempts){this.target.close();return}let t=this.strategy(this.attempts);this.attempts++,this.logger.info(`Reconnecting in ${t}ms (${this.attempts} attempt)`),this.state="pending_reconnect",this.reconnnectId=setTimeout(()=>this.reconnectNow(),t)}cancelReconnect(){this.reconnnectId&&(clearTimeout(this.reconnnectId),delete this.reconnnectId)}};class _r{constructor(e,n={}){this.transports=e,this.transport=null,this.emitter=ce(),this.unbind=[],this.logger=n.logger||new K}displayName(){return"fallbacked transport"}async open(){for(let e=0;e<this.transports.length;e++){let n=this.transports[e];try{this.transport=n,this.resetListeners(),this.logger.debug(`Trying to connect via ${n.displayName()}`),await n.open(),this.logger.debug(`Connected via ${n.displayName()}`);return}catch(r){this.logger.debug(`Failed to connect via ${n.displayName()}: ${r.message}`)}}throw this.transport=null,this.resetListeners(),new Error("Couldn't connect via any available transport")}send(e){if(!this.transport)throw new Error("No transport is open");this.transport.send(e)}async close(){if(!this.transport)throw new Error("No transport is open");await this.transport.close(),this.transport=null}setURL(){throw new Error("Not implemented. Set URL for each transport separately")}setParam(e,n){this.transports.forEach(r=>{r.setParam(e,n)})}on(e,n){return this.emitter.on(e,n)}once(e,n){let r=this.emitter.on(e,(...s)=>{r(),n(...s)});return r}get url(){return this.transport?this.transport.url:""}resetListeners(){this.unbind.forEach(e=>e()),this.unbind.length=0,this.transport&&this.unbind.push(this.transport.on("open",()=>{this.emitter.emit("open")}),this.transport.on("data",e=>{this.emitter.emit("data",e)}),this.transport.on("close",e=>{this.emitter.emit("close",e)}),this.transport.on("error",e=>{this.emitter.emit("error",e)}))}}class yr{constructor(e,n={}){this.url=e;let r=n.websocketImplementation;if(r)this.Impl=r;else if(typeof WebSocket<"u")this.Impl=WebSocket;else throw new Error("No WebSocket support");this.connected=!1,this.emitter=ce();let{format:s,subprotocol:i}=n;this.format=s||"text",this.connectionOptions=n.websocketOptions,this.subprotocol=i}displayName(){return"WebSocket("+this.url+")"}open(){return this.connectionOptions?this.ws=new this.Impl(this.url,this.subprotocol,this.connectionOptions):this.ws=new this.Impl(this.url,this.subprotocol),this.ws.binaryType="arraybuffer",this.initListeners(),new Promise((e,n)=>{let r=[];r.push(this.once("open",()=>{r.forEach(s=>s()),e()})),r.push(this.once("close",()=>{r.forEach(s=>s()),n(Error("WS connection closed"))}))})}setURL(e){this.url=e}setParam(e,n){let r=new URL(this.url);r.searchParams.set(e,n);let s=`${r.protocol}//${r.host}${r.pathname}?${r.searchParams}`;this.setURL(s)}send(e){if(!this.ws||!this.connected)throw Error("WebSocket is not connected");this.ws.send(e)}close(){this.ws?this.onclose():this.connected=!1}on(e,n){return this.emitter.on(e,n)}once(e,n){let r=this.emitter.on(e,(...s)=>{r(),n(...s)});return r}initListeners(){this.ws.onerror=e=>{this.connected&&this.emitter.emit("error",e.error||new Error("WS Error"))},this.ws.onclose=()=>{this.onclose()},this.ws.onmessage=e=>{let n=e.data;this.format==="binary"&&(n=new Uint8Array(n)),this.emitter.emit("data",n)},this.ws.onopen=()=>{this.connected=!0,this.emitter.emit("open")}}onclose(){this.ws.onclose=void 0,this.ws.onmessage=void 0,this.ws.onopen=void 0,this.ws.close(),delete this.ws,this.connected=!1,this.emitter.emit("close")}}const Et={protocol:"actioncable-v1-json",pingInterval:3e3,maxReconnectAttempts:1/0,maxMissingPings:2,logLevel:"warn",lazy:!0};function wr(t,e){if(typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),e=e||{},!t&&!e.transport)throw Error("URL or transport must be specified");e=Object.assign({},Et,e);let{protocol:n,websocketImplementation:r,websocketFormat:s,websocketOptions:i,fallbacks:o,logLevel:a,logger:u,transport:l,encoder:h,lazy:g,monitor:m,pingInterval:d,reconnectStrategy:b,maxMissingPings:f,maxReconnectAttempts:S,subprotocol:y,tokenRefresher:_,historyTimestamp:A,protocolOptions:P,concurrentSubscribes:C}=e;if(u=u||new K(a),typeof n=="string"){y=y||n;let j=n.substring(0,n.lastIndexOf("-")),M=n.substring(n.lastIndexOf("-")+1);if(P=P||{},j==="actioncable-v1")n=new bt({logger:u,...P});else if(j==="actioncable-v1-ext")n=new fr({logger:u,historyTimestamp:A,...P});else throw Error(`Protocol is not supported yet: ${n}`);if(M==="json")h=h||new hr,s=s||"text";else if(M==="msgpack"){if(s="binary",!h)throw Error("Msgpack encoder must be specified explicitly. Use `@anycable/msgpack-encoder` package or build your own")}else if(M==="protobuf"){if(s=s||"binary",!h)throw Error("Protobuf encoder must be specified explicitly. Use `@anycable/protobuf-encoder` package or build your own")}else throw Error(`Protocol is not supported yet: ${n}`)}if(!n)throw Error("Protocol must be specified");l=l||new yr(t,{websocketImplementation:r,websocketOptions:i,subprotocol:y,format:s}),o&&(l=new _r([l,...o],{logger:u})),b=b||yt(d),m!==!1&&(m=m||new wt({pingInterval:d,reconnectStrategy:b,maxMissingPings:f,maxReconnectAttempts:S,logger:u}));let I={concurrentSubscribes:C},k=new mr({protocol:n,transport:l,encoder:h,logger:u,lazy:g,hubOptions:I});return m&&(m.watch(k),k.monitor=m),_&&Er(k,async()=>{try{await _(l)}catch(j){return u.error("Failed to refresh authentication token: "+j),!1}return k.connect().catch(()=>{}),!0}),k}function Er(t,e){let n=!1;t.on("connect",()=>n=!1),t.on("close",async r=>{if(r){if(n){t.logger.warn("Token auto-refresh is disabled",r);return}r.reason==="token_expired"&&(n=!0,await e())}})}class Sr{constructor(e){this.channel=e}notify(e,...n){typeof this[e]=="function"&&this[e](...n)}perform(e,n={}){this.channel.perform(e,n)}send(e){this.channel.send(e)}get identifier(){return this.channel.identifier}unsubscribe(){return this.channel.disconnect()}}class Rr extends Oe{constructor(e,n,r){super(e,n),this.subscription=new Sr(this),Object.assign(this.subscription,r),this.on("connect",()=>this.subscription.notify("connected")),this.on("disconnect",()=>this.subscription.notify("disconnected",{allowReconnect:!0})),this.on("message",s=>this.subscription.notify("received",s)),this.on("close",s=>{s&&s instanceof ve?this.subscription.notify("rejected"):this.subscription.notify("disconnected",{allowReconnect:!1})})}}class xr{constructor(e){this.cable=e}create(e,n){let r,s;typeof e=="object"?(r=e.channel,delete e.channel,s=e):(r=e,s={});let i=new Rr(r,s,n);return i.subscription.notify("initialized"),this.cable.subscribe(i),i.subscription}findAll(e){return this.cable.hub.channels.filter(n=>n.identifier===e).map(n=>n.subscription)}}class vr{constructor(e){this.cable=e,this.subscriptions=new xr(e)}}class Or extends mt{writeLogEntry(e,n,r){r?console[e](n,r):console[e](n)}}class Tr extends wt{watch(e){super.watch(e),this.initActivityListeners()}initActivityListeners(){if(typeof document<"u"&&typeof window<"u"&&document.addEventListener&&window.addEventListener){let e=()=>{document.hidden||this.reconnectNow()&&this.logger.debug("Trigger reconnect due to visibility change")},n=s=>{this.reconnectNow()&&this.logger.debug("Trigger reconnect",{event:s})},r=()=>this.disconnect(new O("page_frozen"));document.addEventListener("visibilitychange",e,!1),window.addEventListener("focus",n,!1),window.addEventListener("online",n,!1),window.addEventListener("resume",n,!1),window.addEventListener("freeze",r,!1),this.unbind.push(()=>{document.removeEventListener("visibilitychange",e,!1),window.removeEventListener("focus",n,!1),window.removeEventListener("online",n,!1),window.removeEventListener("resume",n,!1),window.removeEventListener("freeze",r,!1)})}}disconnect(e){this.state==="disconnected"||this.state==="closed"||(this.logger.info("Disconnecting",{reason:e.message}),this.cancelReconnect(),this.stopPolling(),this.state="pending_disconnect",this.target.disconnected(e))}}const Ar=["cable","action-cable"],Pr="/cable",St=(t,e)=>{for(let n of Ar){let r=t.head.querySelector(`meta[name='${n}-${e}']`);if(r)return r.getAttribute("content")}},Rt=t=>t.match(/wss?:\/\//)?t:typeof window<"u"?`${window.location.protocol.replace("http","ws")}//${window.location.host}${t}`:t,Cr=()=>{if(typeof document<"u"&&document.head){let t=St(document,"url");if(t)return Rt(t)}return Rt(Pr)},kr=()=>{if(typeof document<"u"&&document.head){let t=St(document,"history-timestamp");if(t)return t|0}};function jr(t,e){typeof t=="object"&&typeof e>"u"&&(e=t,t=void 0),t=t||Cr(),e=e||{},e.historyTimestamp||(e.historyTimestamp=kr()),e=Object.assign({},Et,e);let{logLevel:n,logger:r,pingInterval:s,reconnectStrategy:i,maxMissingPings:o,maxReconnectAttempts:a}=e;return r=e.logger=e.logger||new Or(n),i=e.reconnectStrategy=e.reconnectStrategy||yt(s),e.monitor!==!1&&(e.monitor=e.monitor||new Tr({pingInterval:s,reconnectStrategy:i,maxMissingPings:o,maxReconnectAttempts:a,logger:r})),wr(t,e)}function Ir(t,e){let n=jr(t,e);return new vr(n)}class Nr{constructor(e="/openc3-api/cable"){this._cable=null,this._url=e}disconnect(){this._cable&&(this._cable.cable.disconnect(),this._cable=null)}createSubscription(e,n,r={},s={}){return OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity).then(i=>{if(i&&OpenC3Auth.setTokens(),this._cable==null){let o=this._url+"?scope="+encodeURIComponent(window.openc3Scope)+"&authorization="+encodeURIComponent(localStorage.openc3Token);o=new URL(o,document.baseURI).href,this._cable=Ir(o)}return this._cable.subscriptions.create({channel:e,...s},r)})}recordPing(){}}ae("n",Nr);class Lr{constructor(){le(this,"id",1)}async exec(e,n,r={},s={},i=6e4){try{await OpenC3Auth.updateToken(OpenC3Auth.defaultMinValidity)&&OpenC3Auth.setTokens()}catch{OpenC3Auth.login()}this.id=this.id+1;try{return r.scope=window.openc3Scope,s.manual=!0,(await Re.post("/openc3-api/api",{jsonrpc:"2.0",method:e,params:n,id:this.id,keyword_params:r},{headers:{Authorization:localStorage.openc3Token,"Content-Type":"application/json-rpc",...s},timeout:i})).data.result}catch(o){let a=new Error;throw o.response?(a.name=o.response.data.error.data.class,a.message=o.response.data.error.data.message,a.object=o.response.data.error):o.request?(a.name="Request error",a.message="Request error, no response received"):a.name="Unknown error",a}}decode_openc3_type(e){if(e!==null&&typeof e=="object"&&e.json_class=="Float"&&e.raw){if(e.raw=="NaN")return NaN;if(e.raw=="Infinity")return 1/0;if(e.raw=="-Infinity")return-1/0}return null}encode_openc3_type(e){return Number.isNaN(e)?{json_class:"Float",raw:"NaN"}:e==Number.POSITIVE_INFINITY?{json_class:"Float",raw:"Infinity"}:e==Number.NEGATIVE_INFINITY?{json_class:"Float",raw:"-Infinity"}:null}ensure_offline_access(){this.offline_access_needed().then(e=>{e&&(localStorage.openc3OfflineToken?this.set_offline_access(localStorage.openc3OfflineToken).then(()=>{delete localStorage.openc3OfflineToken}):OpenC3Auth.getOfflineAccess())})}offline_access_needed(){return this.exec("offline_access_needed",[])}set_offline_access(e){return this.exec("set_offline_access",[e])}get_all_interface_info(){return this.exec("get_all_interface_info",[])}map_target_to_interface(e,n){return this.exec("map_target_to_interface",[e,n])}connect_interface(e,...n){return n.length>0?this.exec("connect_interface",[e,...n]):this.exec("connect_interface",[e])}disconnect_interface(e){return this.exec("disconnect_interface",[e])}interface_cmd(e,n,...r){return this.exec("interface_cmd",[e,n,...r])}get_all_router_info(){return this.exec("get_all_router_info",[])}connect_router(e){return this.exec("connect_router",[e])}disconnect_router(e){return this.exec("disconnect_router",[e])}get_target_interfaces(){return this.exec("get_target_interfaces",[])}get_tlm_cnts(e){return this.exec("get_tlm_cnts",[e])}get_item(e,n,r){return this.exec("get_item",[e,n,r])}get_param(e,n,r){return this.exec("get_param",[e,n,r])}get_parameter(e,n,r){return this.exec("get_param",[e,n,r])}get_limits_sets(){return this.exec("get_limits_sets",[])}get_limits_set(){return this.exec("get_limits_set",[])}set_limits_set(e){return this.exec("set_limits_set",[e])}get_target(e){return this.exec("get_target",[e])}get_target_names(){return this.exec("get_target_names",[])}get_target_list(){return this.exec("get_target_names",[])}get_tlm(e,n){return this.exec("get_tlm",[e,n])}get_telemetry(e,n){return this.exec("get_tlm",[e,n])}get_all_tlm(e){return this.exec("get_all_tlm",[e])}get_all_telemetry(e){return this.exec("get_all_tlm",[e])}get_all_tlm_names(e,n=!1){return this.exec("get_all_tlm_names",[e],{hidden:n})}get_all_telemetry_names(e){return this.exec("get_all_tlm_names",[e])}async get_tlm_packet(e,n,r,s=30){const i=await this.exec("get_tlm_packet",[e,n],{type:r,stale_time:s});if(i!=null){let o=i.length,a=null;for(let u=0;u<o;u++)a=this.decode_openc3_type(i[u][1]),a!==null&&(i[u][1]=a)}return i}get_packet_derived_items(e,n){return this.exec("get_packet_derived_items",[e,n])}get_tlm_buffer(e,n){return this.exec("get_tlm_buffer",[e,n])}async get_tlm_values(e,n=30,r=null){let s={stale_time:n};r!==null&&(s.cache_timeout=r);const i=await this.exec("get_tlm_values",[e],s,{},1e4);let o=i[0].length,a=null;for(let u=0;u<o;u++)a=this.decode_openc3_type(i[0][u]),a!==null&&(i[0][u]=a);return i}get_limits(e,n,r){return this.exec("get_limits",[e,n,r])}async tlm(e,n,r,s="CONVERTED"){let i=null;if(n===void 0)i=await this.exec("tlm",[e]);else if(r===void 0)if(["RAW","CONVERTED","FORMATTED","WITH_UNITS"].includes(n))i=await this.exec("tlm",[e],{type:n});else{let a=new Error;throw a.name="TypeError",a.message=`Invalid data type ${n}. Valid options are RAW, CONVERTED, FORMATTED, and WITH_UNITS.`,a}else i=await this.exec("tlm",[e,n,r],{type:s});let o=this.decode_openc3_type(i);return o!==null&&(i=o),i}async inject_tlm(e,n,r=null,s="CONVERTED"){data=await this.exec("inject_tlm",[e,n,r],{type:s})}set_tlm(e,n,r,s){return this.exec("set_tlm",[e,n,r],{type:s})}override_tlm(e,n,r,s){return this.exec("override_tlm",[e,n,r],{type:s})}get_overrides(){return this.exec("get_overrides")}normalize_tlm(e,n,r,s){return this.exec("normalize_tlm",[e,n,r],{type:s})}get_all_cmds(e){return this.exec("get_all_cmds",[e])}get_all_commands(e){return this.exec("get_all_cmds",[e])}get_all_cmd_names(e,n=!1){return this.exec("get_all_cmd_names",[e],{hidden:n})}get_all_command_names(e){return this.exec("get_all_cmd_names",[e])}get_cmd(e,n){return this.exec("get_cmd",[e,n])}get_command(e,n){return this.exec("get_cmd",[e,n])}get_cmd_cnts(e){return this.exec("get_cmd_cnts",[e])}get_cmd_value(e,n,r,s="CONVERTED"){return this.exec("get_cmd_value",[e,n,r,s])}get_cmd_buffer(e,n){return this.exec("get_cmd_buffer",[e,n])}_cmd(e,n,r,s,i){let o=null;for(let a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o=this.encode_openc3_type(s[a]),o!==null&&(s[a]=o));return this.exec(e,[n,r,s],{},i)}get_cmd_hazardous(e,n,r,s={}){return n===void 0?this.exec("get_cmd_hazardous",e,{},s):this._cmd("get_cmd_hazardous",e,n,r,s)}cmd(e,n,r,s={}){return n===void 0?this.exec("cmd",e,{},s):this._cmd("cmd",e,n,r,s)}cmd_no_range_check(e,n,r,s={}){return n===void 0?this.exec("cmd_no_range_check",e,{},s):this._cmd("cmd_no_range_check",e,n,r,s)}cmd_raw(e,n,r,s={}){return n===void 0?this.exec("cmd_raw",e,{},s):this._cmd("cmd_raw",e,n,r,s)}cmd_raw_no_range_check(e,n,r,s={}){return n===void 0?this.exec("cmd_raw_no_range_check",e,{},s):this._cmd("cmd_raw_no_range_check",e,n,r,s)}cmd_no_hazardous_check(e,n,r,s={}){return n===void 0?this.exec("cmd_no_hazardous_check",e,{},s):this._cmd("cmd_no_hazardous_check",e,n,r,s)}cmd_no_checks(e,n,r,s={}){return n===void 0?this.exec("cmd_no_checks",e,{},s):this._cmd("cmd_no_checks",e,n,r,s)}cmd_raw_no_hazardous_check(e,n,r,s={}){return n===void 0?this.exec("cmd_raw_no_hazardous_check",e,{},s):this._cmd("cmd_raw_no_hazardous_check",e,n,r,s)}cmd_raw_no_checks(e,n,r,s={}){return n===void 0?this.exec("cmd_raw_no_checks",e,{},s):this._cmd("cmd_raw_no_checks",e,n,r,s)}build_cmd(e,n,r){return n===void 0?this.exec("build_cmd",e):this._cmd("build_cmd",e,n,r)}build_command(e,n,r){return n===void 0?this.exec("build_cmd",e):this._cmd("build_cmd",e,n,r)}get_interface_names(){return this.exec("get_interface_names",[])}send_raw(e,n){return this.exec("send_raw",[e,n])}list_configs(e){return this.exec("list_configs",[e])}load_config(e,n){return this.exec("load_config",[e,n])}save_config(e,n,r){return this.exec("save_config",[e,n,r])}delete_config(e,n){return this.exec("delete_config",[e,n])}enable_limits(e,n,r){return this.exec("enable_limits",[e,n,r])}disable_limits(e,n,r){return this.exec("disable_limits",[e,n,r])}get_out_of_limits(){return this.exec("get_out_of_limits",[])}get_overall_limits_state(e){return this.exec("get_overall_limits_state",[e])}list_settings(){return this.exec("list_settings",[])}get_all_settings(){return this.exec("get_all_settings",[])}get_setting(e){return this.exec("get_setting",[e])}get_settings(e){return this.exec("get_settings",e)}set_setting(e,n){return this.exec("set_setting",[e,n])}update_news(){return this.exec("update_news",[])}save_setting(e,n){return this.exec("set_setting",[e,n])}get_metrics(){return this.exec("get_metrics",[])}async hashString(e){if(window.isSecureContext){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n),s=new Uint8Array(r);return Array.from(s).map(i=>i.toString(16).padStart(2,"0")).join("")}}}ae("r",Lr)}}});
|