UNPKG

@salutejs/jazz-sdk-electron

Version:

Jazz SDK Electron

2 lines (1 loc) 24.1 kB
import{token as t,isToken as r,declareModule as e,resolveValue as n,bindModules as o,createContainer as i}from"ditox";import{ipcMain as u}from"electron";import{createScope as a}from"nrgy";import{promises as c}from"node:fs";import{declareController as f}from"nrgy/mvc";import{observe as s}from"nrgy/rxjs";import{Subject as l,zip as p,of as h,tap as v,firstValueFrom as y,filter as d,take as g}from"rxjs";import{createScope as m,createAction as b}from"rx-effects";function w(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void e(t)}a.done?r(c):Promise.resolve(c).then(n,o)}function _(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var i=t.apply(r,e);function u(t){w(i,n,o,u,a,"next",t)}function a(t){w(i,n,o,u,a,"throw",t)}u(void 0)}))}}function O(t){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(t)}var j,E=Object.prototype,S=E.hasOwnProperty,x="function"==typeof Symbol?Symbol:{},P=x.iterator||"@@iterator",L=x.asyncIterator||"@@asyncIterator",T=x.toStringTag||"@@toStringTag";function N(t,r,e,n){var o=r&&r.prototype instanceof F?r:F,i=Object.create(o.prototype),u=new B(n||[]);return i._invoke=function(t,r,e){var n=k;return function(o,i){if(n===I)throw new Error("Generator is already running");if(n===C){if("throw"===o)throw i;return q()}for(e.method=o,e.arg=i;;){var u=e.delegate;if(u){var a=U(u,e);if(a){if(a===M)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===k)throw n=C,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=I;var c=A(t,r,e);if("normal"===c.type){if(n=e.done?C:D,c.arg===M)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(n=C,e.method="throw",e.arg=c.arg)}}}(t,e,u),i}function A(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}var k="suspendedStart",D="suspendedYield",I="executing",C="completed",M={};function F(){}function K(){}function z(){}var R={};R[P]=function(){return this};var G=Object.getPrototypeOf,$=G&&G(G(H([])));$&&$!==E&&S.call($,P)&&(R=$);var Z=z.prototype=F.prototype=Object.create(R);function Y(t){["next","throw","return"].forEach((function(r){t[r]=function(t){return this._invoke(r,t)}}))}function J(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===K||"GeneratorFunction"===(r.displayName||r.name))}function V(t,r){function e(n,o,i,u){var a=A(t[n],t,o);if("throw"!==a.type){var c=a.arg,f=c.value;return f&&"object"===O(f)&&S.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,i,u)}),(function(t){e("throw",t,i,u)})):r.resolve(f).then((function(t){c.value=t,i(c)}),(function(t){return e("throw",t,i,u)}))}u(a.arg)}var n;this._invoke=function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}}function U(t,r){var e=t.iterator[r.method];if(e===j){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=j,U(t,r),"throw"===r.method))return M;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return M}var n=A(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,M;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=j),r.delegate=null,M):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,M)}function X(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function W(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(X,this),this.reset(!0)}function H(t){if(t){var r=t[P];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,n=function r(){for(;++e<t.length;)if(S.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=j,r.done=!0,r};return n.next=n}}return{next:q}}function q(){return{value:j,done:!0}}K.prototype=Z.constructor=z,z.constructor=K,z[T]=K.displayName="GeneratorFunction",Y(V.prototype),V.prototype[L]=function(){return this},Y(Z),Z[T]="Generator",Z[P]=function(){return this},Z.toString=function(){return"[object Generator]"},B.prototype={constructor:B,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=j,this.done=!1,this.delegate=null,this.method="next",this.arg=j,this.tryEntries.forEach(W),!t)for(var r in this)"t"===r.charAt(0)&&S.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=j)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return i.type="throw",i.arg=t,r.next=e,n&&(r.method="next",r.arg=j),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var u=S.call(o,"catchLoc"),a=S.call(o,"finallyLoc");if(u&&a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&S.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=r,o?(this.method="next",this.next=o.finallyLoc,M):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),M},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),W(e),M}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;W(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:H(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=j),M}};var Q={wrap:N,isGeneratorFunction:J,AsyncIterator:V,mark:function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,z):(t.__proto__=z,T in t||(t[T]="GeneratorFunction")),t.prototype=Object.create(Z),t},awrap:function(t){return{__await:t}},async:function(t,r,e,n,o){void 0===o&&(o=Promise);var i=new V(N(t,r,e,n),o);return J(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},keys:function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},values:H},tt=[],rt={Transport:t({key:"JAZZ_SDK_ELECTRON_MAIN_TOKENS_TRANSPORT_TOKEN"}),TransportEndpoints:t({key:"JAZZ_SDK_ELECTRON_MAIN_TOKENS_TRANSPORT_ENDPOINTS_TOKEN"})},et=t({key:"JAZZ_SDK_MAIN_CONTEXT_TOKEN"});function nt(t){var r=function(t,r){if("object"!=O(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==O(r)?r:r+""}function ot(t,r,e){return(r=nt(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function it(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function ut(t,r){if(t){if("string"==typeof t)return it(t,r);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?it(t,r):void 0}}function at(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;c=!1}else for(;!(c=(n=i.call(e)).done)&&(a.push(n.value),a.length!==r);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,r)||ut(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ct=["destroy"];function ft(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function st(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?ft(Object(e),!0).forEach((function(r){ot(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ft(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}function lt(t){var o=t.factory,i=t.exports,u=t.imports,c=void 0===u?{}:u,f=t.token,s=t.name,l=Object.entries(c).reduce((function(t,e){var n=at(e,2),o=n[0],i=n[1];return r(i)?t.deps[o]=i:(t.imports.push(i),t.deps[o]=i.token),t}),{deps:{},imports:[]});return function(){return{module:e({token:f,factory:function(t){var r=a(),e=o({scope:r,container:t,deps:pt(l.deps)?void 0:n(t,l.deps),name:s}),i=e.destroy;return st(st({},function(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(r.includes(n))continue;e[n]=t[n]}return e}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.includes(e)||{}.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}(e,ct)),{},{destroy:function(){null==i||i(),r.destroy()}})},exports:i,imports:l.imports}),key:s}}}function pt(t){return!t||0===Object.keys(t).length}var ht,vt,yt,dt,gt,mt,bt,wt,_t,Ot,jt,Et,St,xt,Pt,Lt,Tt,Nt,At,kt,Dt,It,Ct,Mt,Ft,Kt,zt,Rt,Gt,$t,Zt,Yt,Jt,Vt,Ut,Xt,Wt,Bt,Ht,qt,Qt,tr,rr,er,nr,or,ir,ur,ar,cr,fr,sr,lr,pr,hr,vr,yr,dr,gr,mr,br,wr,_r,Or,jr,Er,Sr,xr,Pr,Lr,Tr,Nr,Ar,kr,Dr,Ir,Cr,Mr,Fr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Kr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function zr(){if(vt)return ht;vt=1;var t="object"==O(Fr)&&Fr&&Fr.Object===Object&&Fr;return ht=t}function Rr(){if(dt)return yt;dt=1;var t=zr(),r="object"==("undefined"==typeof self?"undefined":O(self))&&self&&self.Object===Object&&self,e=t||r||Function("return this")();return yt=e}function Gr(){if(mt)return gt;mt=1;var t=Rr().Symbol;return gt=t}function $r(){if(wt)return bt;wt=1;var t=Gr(),r=Object.prototype,e=r.hasOwnProperty,n=r.toString,o=t?t.toStringTag:void 0;return bt=function(t){var r=e.call(t,o),i=t[o];try{t[o]=void 0;var u=!0}catch(t){}var a=n.call(t);return u&&(r?t[o]=i:delete t[o]),a}}function Zr(){if(Ot)return _t;Ot=1;var t=Object.prototype.toString;return _t=function(r){return t.call(r)}}function Yr(){if(Et)return jt;Et=1;var t=Gr(),r=$r(),e=Zr(),n=t?t.toStringTag:void 0;return jt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":n&&n in Object(t)?r(t):e(t)}}function Jr(){if(xt)return St;return xt=1,St=function(t){var r=O(t);return null!=t&&("object"==r||"function"==r)}}function Vr(){if(Lt)return Pt;Lt=1;var t=Yr(),r=Jr();return Pt=function(e){if(!r(e))return!1;var n=t(e);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function Ur(){if(Nt)return Tt;Nt=1;var t=Rr()["__core-js_shared__"];return Tt=t}function Xr(){if(kt)return At;kt=1;var t,r=Ur(),e=(t=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return At=function(t){return!!e&&e in t}}function Wr(){if(It)return Dt;It=1;var t=Function.prototype.toString;return Dt=function(r){if(null!=r){try{return t.call(r)}catch(t){}try{return r+""}catch(t){}}return""}}function Br(){if(Mt)return Ct;Mt=1;var t=Vr(),r=Xr(),e=Jr(),n=Wr(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,u=Object.prototype,a=i.toString,c=u.hasOwnProperty,f=RegExp("^"+a.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Ct=function(i){return!(!e(i)||r(i))&&(t(i)?f:o).test(n(i))}}function Hr(){if(Kt)return Ft;return Kt=1,Ft=function(t,r){return null==t?void 0:t[r]}}function qr(){if(Rt)return zt;Rt=1;var t=Br(),r=Hr();return zt=function(e,n){var o=r(e,n);return t(o)?o:void 0}}function Qr(){if($t)return Gt;$t=1;var t=qr()(Object,"create");return Gt=t}function te(){if(Yt)return Zt;Yt=1;var t=Qr();return Zt=function(){this.__data__=t?t(null):{},this.size=0}}function re(){if(Vt)return Jt;return Vt=1,Jt=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}}function ee(){if(Xt)return Ut;Xt=1;var t=Qr(),r=Object.prototype.hasOwnProperty;return Ut=function(e){var n=this.__data__;if(t){var o=n[e];return"__lodash_hash_undefined__"===o?void 0:o}return r.call(n,e)?n[e]:void 0}}function ne(){if(Bt)return Wt;Bt=1;var t=Qr(),r=Object.prototype.hasOwnProperty;return Wt=function(e){var n=this.__data__;return t?void 0!==n[e]:r.call(n,e)}}function oe(){if(qt)return Ht;qt=1;var t=Qr();return Ht=function(r,e){var n=this.__data__;return this.size+=this.has(r)?0:1,n[r]=t&&void 0===e?"__lodash_hash_undefined__":e,this}}function ie(){if(tr)return Qt;tr=1;var t=te(),r=re(),e=ee(),n=ne(),o=oe();function i(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=e,i.prototype.has=n,i.prototype.set=o,Qt=i}function ue(){if(er)return rr;return er=1,rr=function(){this.__data__=[],this.size=0}}function ae(){if(or)return nr;return or=1,nr=function(t,r){return t===r||t!=t&&r!=r}}function ce(){if(ur)return ir;ur=1;var t=ae();return ir=function(r,e){for(var n=r.length;n--;)if(t(r[n][0],e))return n;return-1}}function fe(){if(cr)return ar;cr=1;var t=ce(),r=Array.prototype.splice;return ar=function(e){var n=this.__data__,o=t(n,e);return!(o<0)&&(o==n.length-1?n.pop():r.call(n,o,1),--this.size,!0)}}function se(){if(sr)return fr;sr=1;var t=ce();return fr=function(r){var e=this.__data__,n=t(e,r);return n<0?void 0:e[n][1]}}function le(){if(pr)return lr;pr=1;var t=ce();return lr=function(r){return t(this.__data__,r)>-1}}function pe(){if(vr)return hr;vr=1;var t=ce();return hr=function(r,e){var n=this.__data__,o=t(n,r);return o<0?(++this.size,n.push([r,e])):n[o][1]=e,this}}function he(){if(dr)return yr;dr=1;var t=ue(),r=fe(),e=se(),n=le(),o=pe();function i(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=e,i.prototype.has=n,i.prototype.set=o,yr=i}function ve(){if(mr)return gr;mr=1;var t=qr()(Rr(),"Map");return gr=t}function ye(){if(wr)return br;wr=1;var t=ie(),r=he(),e=ve();return br=function(){this.size=0,this.__data__={hash:new t,map:new(e||r),string:new t}}}function de(){if(Or)return _r;return Or=1,_r=function(t){var r=O(t);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==t:null===t}}function ge(){if(Er)return jr;Er=1;var t=de();return jr=function(r,e){var n=r.__data__;return t(e)?n["string"==typeof e?"string":"hash"]:n.map}}function me(){if(xr)return Sr;xr=1;var t=ge();return Sr=function(r){var e=t(this,r).delete(r);return this.size-=e?1:0,e}}function be(){if(Lr)return Pr;Lr=1;var t=ge();return Pr=function(r){return t(this,r).get(r)}}function we(){if(Nr)return Tr;Nr=1;var t=ge();return Tr=function(r){return t(this,r).has(r)}}function _e(){if(kr)return Ar;kr=1;var t=ge();return Ar=function(r,e){var n=t(this,r),o=n.size;return n.set(r,e),this.size+=n.size==o?0:1,this}}function Oe(){if(Ir)return Dr;Ir=1;var t=ye(),r=me(),e=be(),n=we(),o=_e();function i(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=e,i.prototype.has=n,i.prototype.set=o,Dr=i}function je(){if(Mr)return Cr;Mr=1;var t=Oe();function r(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var o=function(){var t=arguments,r=n?n.apply(this,t):t[0],i=o.cache;if(i.has(r))return i.get(r);var u=e.apply(this,t);return o.cache=i.set(r,u)||i,u};return o.cache=new(r.Cache||t),o}return r.Cache=t,Cr=r}var Ee=Kr(je());function Se(t){return function(t){if(Array.isArray(t))return it(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ut(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xe(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function Pe(t){for(var r=1;r<arguments.length;r++){var e=null!=arguments[r]?arguments[r]:{};r%2?xe(Object(e),!0).forEach((function(r){ot(t,r,e[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):xe(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}))}return t}var Le=["debug","info","warn","error"];function Te(t){return Le.find((function(r){return r===t}))}var Ne,Ae,ke,De,Ie={debug:0,info:1,warn:2,error:3},Ce=Object.create(null),Me=(Ne=1e3,ke=-1,De=!1,{append:function(t){Ae||(Ae=new Array(Ne)),De=De||ke+1===Ne,Ae[ke=(ke+1)%Ne]=t},clear:function(){Ae=void 0,ke=-1,De=!1},getItems:function(){if(!Ae||ke<0)return[];var t=De?Ae.slice(ke+2):[],r=Ae.slice(0,ke+1);return[].concat(Se(t),Se(r))}});function Fe(){return Me.getItems()}var Ke,ze,Re=(Ke=new l,(ze=function(t){var r=Pe(Pe({},t),{},{meta:Pe(Pe({},Ce),t.meta)});Me.append(r),Ke.next(r)}).event$=Ke.asObservable(),ze);function Ge(t,r){return{getLogger:function(e,n){return Ge("".concat(t,".").concat(e),Pe(Pe({},r),n))},withMeta:function(e){return Ge(t,Pe(Pe({},r),e))},debug:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];Re({level:"debug",timestamp:Date.now(),tag:t,messages:n,meta:r})},log:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];Re({level:"info",timestamp:Date.now(),tag:t,messages:n,meta:r})},info:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];Re({level:"info",timestamp:Date.now(),tag:t,messages:n,meta:r})},warn:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];Re({level:"warn",timestamp:Date.now(),tag:t,messages:n,meta:r})},error:function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];Re({level:"error",timestamp:Date.now(),tag:t,messages:n,meta:r})}}}function $e(t,r){return Ee((function(){return Ge(t,r)}))}var Ze=function(){return{logEvent$:Re.event$,logLevelWeight:Ie,createLoggerFactory:$e,getLogBuffer:Fe,getLogger:Ge,logLevelValues:Le,logMessage:Re,parseLogLevel:Te}};function Ye(t){var r,e=t.container,n=t.plugins,i=t.defaultPlugins,u=m(),a=[].concat(Se(i),Se(n)),c=(a.length>0?p.apply(void 0,Se(a)):h([])).pipe(v((function(t){if(0!==t.length){var r=[],n=new Set;Se(t).reverse().forEach((function(t){var e=t(),o=e.key,i=e.module;o?n.has(o)||(n.add(o),r.push({module:i,options:{scope:"scoped"}})):r.push({module:i,options:{scope:"scoped"}})})),n.clear(),o(e,r),r.forEach((function(t){var r=t.module;e.resolve(r.token)}))}})));return{destroy:function(){u.destroy()},ready:(r=_(Q.mark((function t(){return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,y(c);case 2:case"end":return t.stop()}}),t)}))),function(){return r.apply(this,arguments)})}}function Je(){return b()}function Ve(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];var n=function(t){return r.includes(t.type)};return function(t){return t.pipe(d(n))}}function Ue(t){var r=t.split("\n"),e={};return r.forEach((function(t){var r,n=at(t.split("="),2),o=n[0],i=n[1];o&&i&&(e[o.trim().toLowerCase()]=null!==(r=null==i?void 0:i.trim())&&void 0!==r?r:"")})),e}var Xe=function(){var t=void 0,r=function(){var r=_(Q.mark((function r(){var e;return Q.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!t){r.next=2;break}return r.abrupt("return",t);case 2:if("linux"===process.platform){r.next=4;break}return r.abrupt("return",void 0);case 4:return r.prev=5,r.next=8,c.readFile("/etc/os-release",{encoding:"utf8"}).then(Ue);case 8:return e=r.sent,t=e,r.abrupt("return",e);case 13:return r.prev=13,r.t0=r.catch(5),r.abrupt("return",void 0);case 16:case"end":return r.stop()}}),r,null,[[5,13]])})));return function(){return r.apply(this,arguments)}}(),e=void 0;return{getLinuxDistributionInfo:r,getLinuxSessionInfo:function(){if(e)return e;if("linux"===process.platform){var t={desktopSession:process.env.DESKTOP_SESSION,xdgCurrentDesktop:process.env.XDG_CURRENT_DESKTOP,xdgSessionType:process.env.XDG_SESSION_TYPE,waylandDisplay:process.env.WAYLAND_DISPLAY};return e=t,t}},destroy:function(){}}},We="JAZZ_SDK_ELECTRON_IPC_CHANNEL",Be=f().params().apply((function(t){var r=t.scope,e=t.params.ipcMain,n=r.signal(),o=s(n),i=function(t,r){n([r,t])};e.on(We,i),r.onDestroy((function(){e.off(We,i)}));var u=new Map,a=function(t){return function(r){var e=at(r,2),n=e[0],o=e[1];"payload"in n?t(n.payload,o):t(o)}},c=function(t){var r;null===(r=u.get(t))||void 0===r||r.unsubscribe(),u.delete(t)},f={once:function(t,r){var e=o.pipe(d((function(r){return at(r,1)[0].type===t})),g(1)).subscribe(a(r));return function(){return e.unsubscribe()}},subscribe:function(t,r){var e=o.pipe(d((function(r){return at(r,1)[0].type===t}))).subscribe(a(r));return function(){return e.unsubscribe()}},on:function(t){var r=o.subscribe((function(r){var e=at(r,2),n=e[0],o=e[1];t(n,o)}));return u.set(t,r),function(){c(t)}},off:c,withType:function(){return f},send:function(t,r){t.webContents.send(We,r)}};return f})),He=f().params().apply((function(t){var r=t.scope,e=t.params.transport,n=new Set,o=new Map;r.onDestroy(e.on((function(t,r){"registerEndpoint"===t.type&&(o.has(r.frameId)||o.set(r.frameId,t.payload.endpointName)),i(r.frameId,t)})));var i=function(t,r){n.forEach((function(n){t!==n.id&&(r.to?o.get(n.id)===r.to&&e.send(n,r):e.send(n,r))}))};return{register:function(t){return n.add(t),function(){n.delete(t)}},unregister:function(t){var r=o.get(t.id);r&&i(t.id,{type:"unregisterEndpoint",payload:{endpointName:r}}),o.delete(t.id),n.delete(t)}}})),qe=function(){var t=_(Q.mark((function t(){var r,e,n,o,c,f,s,l,p,h,v,y=arguments;return Q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=y.length>0&&void 0!==y[0]?y[0]:{},n=a(),o=null!==(r=e.container)&&void 0!==r?r:i(),c=Ze(),f=c.getLogger("SDK_MAIN"),s=n.add(Xe()),l=n.add(new Be({ipcMain:u})),p=n.add(new He({transport:l})),h={logger:f,logs:c,platform:s,transport:l,transportEndpoints:p},o.bindValue(et,h),o.bindValue(rt.Transport,l),o.bindValue(rt.TransportEndpoints,p),v=n.add(Ye({logger:f,container:o,plugins:e.plugins||[],defaultPlugins:[]})),t.next=15,v.ready();case 15:return f.debug("Sdk started"),t.abrupt("return",{destroy:n.destroy,container:o});case 17:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();export{tt as DEFAULT_PLUGINS,et as JAZZ_SDK_MAIN_CONTEXT_TOKEN,rt as JazzSdkElectronMainTokens,He as TransportEndpointsController,Je as createEventBus,qe as createJazzSdkElectronMain,Ze as createLogs,lt as createModule,Ye as createPluginsController,Ve as filterByType};