Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openfin/bloomberg

Package Overview
Dependencies
Maintainers
52
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfin/bloomberg - npm Package Compare versions

Comparing version 1.1.0-beta.1 to 1.1.0

2

openfin.bloomberg.js

@@ -1,1 +0,1 @@

var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{MS:()=>ApiError,xc:()=>AppNotAuthorizedError,BT:()=>InteropError,ez:()=>TerminalCommandError,yW:()=>TerminalConnectionError,$j:()=>H,U$:()=>s,U7:()=>a,GS:()=>k,hN:()=>C,Yc:()=>A,eE:()=>O,C1:()=>x});const n=e=>{var t,n,r,o;if(e instanceof ApiError)return e;switch(!0){case(null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.indexOf("APPLICATION_VALIDATION"))>=0:return new AppNotAuthorizedError;case(null===(n=null==e?void 0:e.message)||void 0===n?void 0:n.indexOf("INVALID_COMMAND"))>=0:case(null===(r=null==e?void 0:e.message)||void 0===r?void 0:r.indexOf("INVALID_GROUP_VALUE"))>=0:case(null===(o=null==e?void 0:e.message)||void 0===o?void 0:o.indexOf("MNEMONIC_NOT_ALLOWED"))>=0:return new TerminalCommandError(void 0,e);case"[object Object]"===(null==e?void 0:e.message):return new TerminalConnectionError;default:return new ApiError(void 0,e)}};class ApiError extends Error{constructor(e="An unexpected error has occurred",t){var n;super(e),t&&(this.innerError=t),this.stack=null===(n=this.stack)||void 0===n?void 0:n.replace(/^(\w*Error)/,`${this.constructor.name}`)}}class AppNotAuthorizedError extends ApiError{constructor(e="App not authorized to use Terminal Connect API",t){super(e,t)}}class InteropError extends ApiError{constructor(e="Failed to execute the interop function",t){super(e,t)}}class TerminalCommandError extends ApiError{constructor(e="Failed to execute the terminal command",t){super(e,t)}}class TerminalConnectionError extends ApiError{constructor(e="Failed to connect to local terminal service",t){super(e,t)}}const r="1.1.0-beta.1";let o=!1;const i="[@openfin/bloomberg]",s=()=>{o=!1},a=()=>{o=!0,u(`v${r}`)},c=(e,t)=>{o&&(e.innerError?console.error(t?`${i} ${t}`:i,e,"\n\n(inner)",e.innerError):console.error(t?`${i} ${t}`:i,e))},u=(...e)=>{o&&console.log(i,...e)},l=(...e)=>{o&&console.warn(i,...e)};"undefined"==typeof fin&&Object.assign(window,{fin:{}}),Object.assign(fin,{Integrations:{Bloomberg:{enableLogging:a,disableLogging:s}}});class p{constructor(e,t,n){this._lastUpdate=0,this._securityCacheExpiration=15e3,this._securityCache="",this._name=t,this._type=n,this._terminalProxy=e}get name(){return this._name}get type(){return this._type}getSecurity(){return new Promise(((e,t)=>{this._terminalProxy.getAllGroups((n=>{const r=n.find((e=>e.name===this._name));r?(this._securityCache=r.security,this._lastUpdate=(new Date).getTime(),e(this._securityCache)):t(new Error(`Group ${name} is not found.`))}),((e,n)=>{t(new Error(n))}))}))}getCachedSecurity(){return new Promise((async(e,t)=>{const n=(new Date).getTime();(!this._securityCache||!this._lastUpdate||n-this._lastUpdate>this._securityCacheExpiration)&&await this.getSecurity(),e(this._securityCache)}))}setSecurity(e,t){return new Promise(((n,r)=>{this._terminalProxy.setGroupSecurity((()=>{this._securityCache=e,this._lastUpdate=(new Date).getTime(),n()}),((e,t)=>{r(new Error(t))}),this._name,e,t)}))}}function d(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n,r,o,i,s,a,c,u="",l=0;for(;l<e.length;)n=e.charCodeAt(l++),r=e.charCodeAt(l++),o=e.charCodeAt(l++),i=n>>2,s=(3&n)<<4|r>>4,a=(15&r)<<2|o>>6,c=63&o,isNaN(r)?a=c=64:isNaN(o)&&(c=64),u=u+t.charAt(i)+t.charAt(s)+t.charAt(a)+t.charAt(c);return u}class h{constructor(){this._seqNumber=0,this._isConnecting=!1,this._isConnected=!1,this._isRegistered=!1,this._sessionId="",this._queuedRequests=[],this._pendingRequests={},this._minPortRange=51800,this._maxPortRange=51820,this._currentPort=51800,this._responseTimeout=15e3,this._disconnectEventSubscriptions={},this._groupEventSubscriptions={},this.sendRemoteMessage=(e,t,n,r)=>{if(this._isRegistered||e.register||this.sendRemoteMessage({register:{}},12,null,console.error),this._sessionId||(this._sessionId=`{${function(){const e="0123456789ABCDEF".split("");let t,n=[],r=Math.random;n[8]=n[13]=n[18]=n[23]="-",n[14]="4";for(var o=0;o<36;o++)n[o]||(t=0|16*r(),n[o]=e[19==o?3&t|8:15&t]);return n.join("")}()}}`),e.setGroupValue&&!e.setGroupValue.cookie&&(e.setGroupValue.cookie=this._sessionId),e.subscribeGroupEvents){const t=e.subscribeGroupEvents.subId;delete e.subscribeGroupEvents.subId,r=e=>{delete this._groupEventSubscriptions[t],r&&r(e)}}const o={sessionId:this._sessionId,correlationId:++this._seqNumber,request:e},i=JSON.stringify(o),s=t>12,a=s?{appId:o.appId,sessionId:o.sessionId,correlationId:o.correlationId,payloadSchemaName:"ap3g_internal",payloadSchemaVersion:2,payloadMsgType:t,payload:d(i)}:void 0,c={envelope:{schemaName:s?"blp_lpad_msg":"blp_remote_controller",schemaVersion:2,message:s?JSON.stringify(a):i},correlationId:o.correlationId,expectResponse:!0,onsuccess:n,onerror:r};this._pendingRequests[o.correlationId]=c,this._isConnected?this.sendRequest(c):(this._queuedRequests.push(c),this.connect())}}addEventListener(e){const t=Object.keys(this._groupEventSubscriptions).length+1;return this._groupEventSubscriptions[t]=e,t}removeEventListener(e){return delete this._groupEventSubscriptions[e],Object.keys(this._groupEventSubscriptions).length}addDisconnectEventListener(e){const t=Object.keys(this._disconnectEventSubscriptions).length+1;return this._disconnectEventSubscriptions[t]=e,t}removeDisconnectEventListener(e){const t=Object.keys(this._disconnectEventSubscriptions).length;delete this._disconnectEventSubscriptions[e];return t!==Object.keys(this._disconnectEventSubscriptions).length}sendRequest(e){const t=JSON.stringify(e.envelope);this._webSocket&&this._webSocket.send(t),e.expectResponse?setTimeout((()=>{this._pendingRequests[e.correlationId]&&(delete this._pendingRequests[e.correlationId],e.onerror&&e.onerror(0,"Response Timeout"))}),this._responseTimeout):delete this._pendingRequests[e.correlationId]}connect(){try{if(this._isConnecting)return;this._isConnecting=!0,this._webSocket=new WebSocket("ws://localhost:"+this._currentPort,"terminal_api"),this._webSocket.onopen=this.onWebSocketOpen.bind(this),this._webSocket.onmessage=this.onWebSocketMessage.bind(this),this._webSocket.onclose=this.onWebSocketClose.bind(this),this._webSocket.onerror=this.onWebSocketError.bind(this)}catch(e){this._webSocket=void 0,this.cancelPendingRequests("WebSocket Exception "+e),console.error(e)}}cancelPendingRequests(e){this._isConnected=!1,this._isConnecting=!1,this._isRegistered=!1,this._sessionId="";for(let t in this._pendingRequests){const n=this._pendingRequests[t];n&&n.onerror&&n.onerror(0,e)}this._pendingRequests={}}onWebSocketClose(e){if(console.log("WebSocket Closed; Reason: "+e.reason+", Code: "+e.code+", WasClean: "+e.wasClean),this._isConnected){const t={};e&&void 0!==e.reason&&(t.reason=e.reason),e&&void 0!==e.code&&(t.code=e.code),e&&void 0!==e.wasClean&&(t.wasClean=e.wasClean),this._currentPort=this._minPortRange,this.cancelPendingRequests({status:"error",message:"Connection Closed",details:t});for(let e in this._disconnectEventSubscriptions){const t=this._disconnectEventSubscriptions[e];t&&t(e)}}}onWebSocketError(){if(console.log("WebSocket Error; readyState: "+(this._webSocket&&this._webSocket.readyState)),this._isConnecting=!1,this._currentPort<this._maxPortRange)this._currentPort+=1,this.connect();else{this._currentPort=this._minPortRange;const e={readyState:this._webSocket&&this._webSocket.readyState};this.cancelPendingRequests({status:"error",message:"Connection Error",details:e})}}onWebSocketOpen(){for(this._isConnected=!0,this._isConnecting=!1;this._queuedRequests.length>0;)this.sendRequest(this._queuedRequests.shift())}onWebSocketMessage(e){var t=e&&e.data?e.data:"null",n=JSON.parse(t),r=n?JSON.parse(n.message):null,o=r&&r.response?this._pendingRequests[r.correlationId]:null;o&&delete this._pendingRequests[r.correlationId],this.processResponse(o,r.response)}getGroupInfo(e){return e?{name:e.name,type:e.type,security:"security"===e.type&&e.value?e.value:void 0}:{}}processResponse(e,t){if(t.success)e.onsuccess&&e.onsuccess();else if(t.registrationComplete)this._isRegistered=!0,console.log("Registration Complete; Session: "+this._sessionId),e.onsuccess&&e.onsuccess();else if(t.getAllGroups){const n=t.getAllGroups.group;e.onsuccess&&e.onsuccess(n?n.map(this.getGroupInfo):[])}else if(t.groupValue)e.onsuccess&&e.onsuccess(this.getGroupInfo(t.groupValue.group));else if(t.groupEvent){if(t.groupEvent.valueChanged){const e=t.groupEvent.valueChanged.group,n=t.groupEvent.valueChanged.cookie===this._sessionId?void 0:t.groupEvent.valueChanged.cookie;for(let t in this._groupEventSubscriptions){const r=this._groupEventSubscriptions[t];r&&r(e,n)}}}else e.onerror&&e.onerror(t.failure&&t.failure.code||0,t.failure?`${t.failure.message} ${t.failure.humanMessage}`:"Unknown Response")}}class g{constructor(){this._webSocket=new h}runFunction(e,t,n,r,o,i,s,a){let c="";if(n&&n.length?1!==r&&2!==r&&3!==r&&4!==r&&5!==r&&(c="Invalid Or Missing Parameter: panel"):c="Invalid Or Missing Parameter: mnemonic",c)return console.error("runFunctionInPanel error: "+c),void(t&&t(0,c));const u={runFunctionInPanel:{mnemonic:n,panel:r}};if(o){const e=[];e.push(o),i&&e.push(i),u.runFunctionInPanel.securities=e}s&&(u.runFunctionInPanel.tails=s),a&&(u.runFunctionInPanel.applicationProperties=a),this._webSocket.sendRemoteMessage(u,0,e,t)}getAllGroups(e,t){this._webSocket.sendRemoteMessage({getAllGroups:{}},13,e,t)}getGroup(e,t,n){if(!n||!n.length){const e="Invalid Or Missing Parameter: name";return console.error(e),void(t&&t(0,e))}this._webSocket.sendRemoteMessage({getGroupValue:{name:n}},15,e,t)}setGroupSecurity(e,t,n,r,o){let i="";if(n&&n.length?r&&r.length||(i="Invalid Or Missing Parameter: security"):i="Invalid Or Missing Parameter: name",i)return console.error("setGroupContext error: "+i),void(t&&t(0,i));this._webSocket.sendRemoteMessage({setGroupValue:{name:n,value:r,cookie:o}},14,e,t)}subscribeGroupEvents(e,t,n){if(!n){const e="Invalid Or Missing Parameter: callback";return console.error("subscribeGroupEvents error: "+e),void(t&&t(0,e))}const r=this._webSocket.addEventListener(n);1===r?this._webSocket.sendRemoteMessage({subscribeGroupEvents:{subId:r}},16,(()=>{e&&e(r)}),(e=>{t&&t(0,e)})):e&&e(r)}unsubscribeGroupEvents(e,t,n){if(!n){const e="Invalid Or Missing Parameter: cookie";return console.error("unsubscribeGroupEvents error: "+e),void(t&&t(0,e))}0===this._webSocket.removeEventListener(n)?this._webSocket.sendRemoteMessage({unsubscribeGroupEvents:{}},17,e,t):e&&e()}subscribeDisconnectEvent(e,t,n){if(!n){const e="Invalid Or Missing Parameter: callback";return console.error("subscribeDisconnectEvent error: "+e),t&&t(0,e),null}const r=this._webSocket.addDisconnectEventListener(n);return e&&e(r),r}unsubscribeDisconnectEvent(e,t,n){if(!n){const e="Invalid Or Missing Parameter: cookie";return console.error("unsubscribeDisconnectEvent error: "+e),t&&t(0,e),!1}return this._webSocket.removeDisconnectEventListener(n)?(e&&e(),!0):(t&&t(0,"Invalid Subscription"),!1)}}class f{constructor(){this.runFunction=window.bb.apps.tc.runFunction,this.getGroup=window.bb.apps.tc.getGroup,this.setGroupSecurity=window.bb.apps.tc.setGroupSecurity,this.getAllGroups=window.bb.apps.tc.getAllGroups,this.subscribeGroupEvents=window.bb.apps.tc.subscribeGroupEvents,this.unsubscribeGroupEvents=window.bb.apps.tc.unsubscribeGroupEvents}subscribeDisconnectEvent(e,t,n){}unsubscribeDisconnectEvent(e,t,n){}}class m{constructor(e=!function(){return!!(window.bb&&window.bb.apps&&window.bb.apps.app&&window.bb.apps.event)}()){this._helperSetGroupValues=e=>{const t=new p(this._terminalProxy,e.name,e.type);return t._securityCache=e.security,t._lastUpdate=(new Date).getTime(),t},this._terminalProxy=e?new g:new f}runFunction(e,t,n,r,o){return new Promise(((i,s)=>{this._terminalProxy.runFunction(i,((e,t)=>{s(new Error(t))}),e,t,n||null,r||null,o||null)}))}getAllGroups(){return new Promise(((e,t)=>{this._terminalProxy.getAllGroups((t=>{e(Array.from(t,this._helperSetGroupValues))}),((e,n)=>{t(new Error(n))}))}))}getGroup(e){return new Promise(((t,n)=>{this._terminalProxy.getAllGroups((r=>{const o=r.find((t=>t.name===e));o?t(this._helperSetGroupValues(o)):n(new Error(`Group ${e} is not found.`))}),((e,t)=>{n(new Error(t))}))}))}subscribeGroupEvents(e){return new Promise(((t,n)=>{this._terminalProxy.subscribeGroupEvents((e=>{t(e)}),((e,t)=>{n(new Error(t))}),((t,n)=>{e(this._helperSetGroupValues(t),n)}))}))}unsubscribeGroupEvents(e){return new Promise(((t,n)=>{this._terminalProxy.unsubscribeGroupEvents((()=>{t()}),((e,t)=>{n(new Error(t))}),e)}))}}const v=(window.BB=window.BB||{},window.BB.Apps=window.BB.Apps||{},window.BB.Apps.Terminal=window.BB.Apps.Terminal||new m,window.BB.Apps.Terminal);var b,y,w;!function(e){e.AppNotFound="AppNotFound",e.ErrorOnLaunch="ErrorOnLaunch",e.AppTimeout="AppTimeout",e.ResolverUnavailable="ResolverUnavailable"}(b||(b={})),function(e){e.NoAppsFound="NoAppsFound",e.ResolverUnavailable="ResolverUnavailable",e.ResolverTimeout="ResolverTimeout"}(y||(y={})),function(e){e.NoChannelFound="NoChannelFound",e.AccessDenied="AccessDenied",e.CreationFailed="CreationFailed"}(w||(w={}));var _,E;_=function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),s=new x(r||[]);return i._invoke=function(e,t,n){var r=p;return function(o,i){if(r===h)throw new Error("Generator is already running");if(r===g){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===p)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var c=l(e,t,n);if("normal"===c.type){if(r=n.done?g:d,c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=g,n.method="throw",n.arg=c.arg)}}}(e,n,s),i}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var p="suspendedStart",d="suspendedYield",h="executing",g="completed",f={};function m(){}function v(){}function b(){}var y={};y[i]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(G([])));_&&_!==n&&r.call(_,i)&&(y=_);var E=b.prototype=m.prototype=Object.create(y);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function n(o,i,s,a){var c=l(e[o],e,i);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,a)}))}a(c.arg)}var o;this._invoke=function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}}function C(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method))return f;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,f;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,f):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function G(e){if(e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,s=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:P}}function P(){return{value:t,done:!0}}return v.prototype=E.constructor=b,b.constructor=v,v.displayName=c(b,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,a,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},S(I.prototype),I.prototype[s]=function(){return this},e.AsyncIterator=I,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var s=new I(u(t,n,r,o),i);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},S(E),c(E,a,"Generator"),E[i]=function(){return this},E.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=G,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return a.type="throw",a.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:G(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}},_(E={exports:{}},E.exports);var S;!function(e){e.Contact="fdc3.contact",e.ContactList="fdc3.contactList",e.Country="fdc3.country",e.Instrument="fdc3.instrument",e.Organization="fdc3.organization",e.Portfolio="fdc3.portfolio",e.Position="fdc3.position"}(S||(S={}));var I;!function(e){e.StartCall="StartCall",e.StartChat="StartChat",e.ViewChart="ViewChart",e.ViewContact="ViewContact",e.ViewQuote="ViewQuote",e.ViewNews="ViewNews",e.ViewInstrument="ViewInstrument",e.ViewAnalysis="ViewAnalysis"}(I||(I={}));const C=e=>!!e&&/^([A-Z0-9]{5})([A-Z0-9*@#]{3})(\d)$/i.test(e),A=e=>!!e&&/\b(EQUITY)$/i.test(e),O=e=>!!e&&/^(?!B[SM]|G[GBH]|KY|VG)([A-Z]{2})(G)(((?![AEIOU_])\w){8})(\d)$/i.test(e),x=e=>!!e&&/^([A-Z]{2})([A-Z0-9]{9})(\d)$/i.test(e),G="OF_BBG_API",P=(e,t,r)=>async(o,i)=>{var s;if(void 0===(null!==(s=null==o?void 0:o.name)&&void 0!==s?s:void 0)){const e=new ApiError(void 0,"Group event source is undefined");throw c(e),null==r||r(e),e}if("*"!==e&&o.name!==e||i===G)return;let a;try{a=await o.getSecurity()}catch(e){const t=n(e);throw c(t),null==r||r(t),t}u(`Launchpad group ${o.name} security changed to:`,a);const l=(e=>{const t={type:S.Instrument,id:{BBG:e}},n=(e=>{var t;if(null==e?void 0:e.trim())return(null!==(t=e.match(/^\w+/))&&void 0!==t?t:[])[0]})(e);if(!n)return t;switch(!0){case C(n):t.id.CUSIP=n;break;case O(n):t.id.FIGI=n;break;case x(n):t.id.ISIN=n;break;case A(e):t.id.ticker=n}return t})(a);l.openfinBbgApi=!0,null==t||t(l),u("Setting new context: ",l);try{await fin.me.interop.setContext(l)}catch(e){const t=new InteropError(void 0,e);c(t),null==r||r(t)}},k=async()=>{let e=!0;try{await v.getAllGroups()}catch(t){const r=n(t);if(!(r instanceof TerminalConnectionError))throw c(r),r;e=!1}return u("Bloomberg terminal ready: ",e),e},M=async(e,t,r,o,i)=>{if("number"==typeof e){u(`Running terminal function in panel ${e}: `,t,r,o,i);try{await v.runFunction(t,e,r,o,i)}catch(e){const t=n(e);throw c(t),t}}else u(`Unable to run function as target ${e} is not a panel`,t,r,o,i)},R={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};R.defaultMerge;function F(e,t){return t}function L(e){return"object"!=typeof e||null===e?0:Array.isArray(e)?2:function(e){if(!B.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(void 0===t)return!0;const n=t.prototype;if(null===n||"object"!=typeof n||!B.has(Object.prototype.toString.call(n)))return!1;if(!n.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)?1:e instanceof Set?3:e instanceof Map?4:5}function N(e){const t=new Set;for(const n of e)for(const e of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(e);return t}function j(e,t){return"object"==typeof e&&Object.prototype.propertyIsEnumerable.call(e,t)}function T(e){return{*[Symbol.iterator](){for(const t of e)for(const e of t)yield e}}}const B=new Set(["[object Object]","[object Module]"]);function V(e){return e[e.length-1]}var D=Object.freeze({__proto__:null,mergeRecords:function(e,t,n){const r={};for(const o of N(e)){const i=[];for(const t of e)j(t,o)&&i.push(t[o]);if(0===i.length)continue;const s=t.metaDataUpdater(n,{key:o,parents:e}),a=U(i,t,s);a!==R.skip&&("__proto__"===o?Object.defineProperty(r,o,{value:a,configurable:!0,enumerable:!0,writable:!0}):r[o]=a)}return r},mergeArrays:function(e){return e.flat()},mergeSets:function(e){return new Set(T(e))},mergeMaps:function(e){return new Map(T(e))},mergeOthers:V});function $(...e){return function(e,t){const n=function(e,t){var n,r;return{defaultMergeFunctions:D,mergeFunctions:{...D,...Object.fromEntries(Object.entries(e).filter((([e,t])=>Object.prototype.hasOwnProperty.call(D,e))).map((([e,t])=>!1===t?[e,V]:[e,t])))},metaDataUpdater:null!==(n=e.metaDataUpdater)&&void 0!==n?n:F,deepmerge:t,useImplicitDefaultMerging:null!==(r=e.enableImplicitDefaultMerging)&&void 0!==r&&r,actions:R}}(e,r);function r(...e){return U(e,n,t)}return r}({})(...e)}function U(e,t,n){if(0===e.length)return;if(1===e.length)return q(e,t,n);const r=L(e[0]);if(0!==r&&5!==r)for(let o=1;o<e.length;o++)if(L(e[o])!==r)return q(e,t,n);switch(r){case 1:return function(e,t,n){const r=t.mergeFunctions.mergeRecords(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords)return t.defaultMergeFunctions.mergeRecords(e,t,n);return r}(e,t,n);case 2:return function(e,t,n){const r=t.mergeFunctions.mergeArrays(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays)return t.defaultMergeFunctions.mergeArrays(e);return r}(e,t,n);case 3:return function(e,t,n){const r=t.mergeFunctions.mergeSets(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets)return t.defaultMergeFunctions.mergeSets(e);return r}(e,t,n);case 4:return function(e,t,n){const r=t.mergeFunctions.mergeMaps(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps)return t.defaultMergeFunctions.mergeMaps(e);return r}(e,t,n);default:return q(e,t,n)}}function q(e,t,n){const r=t.mergeFunctions.mergeOthers(e,t,n);return r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):r}const W=async(e,t,n)=>{const r=(()=>{const e=new Map,t=new Map,n={target:1,mnemonic:"DES"},r={target:1,mnemonic:"GP"},o={target:1,mnemonic:"Q"},i={target:1,mnemonic:"BIO"},s={target:1,mnemonic:"SEAR"};e.set(S.Instrument,Object.assign({},n)),e.set(S.Contact,Object.assign({},i)),e.set(S.Organization,Object.assign({},s));const a=new Map;a.set(S.Instrument,Object.assign({},r)),t.set(I.ViewChart,a);const c=new Map;c.set(S.Contact,Object.assign({},i)),t.set(I.ViewContact,c);const u=new Map;u.set(S.Instrument,Object.assign({},n)),t.set(I.ViewInstrument,u);const l=new Map;return l.set(S.Instrument,Object.assign({},o)),t.set(I.ViewQuote,l),{contexts:e,intents:t}})(),o=(e=>{var t,n,r,o;const i=e=>{const[t]=e;return!!(null!=t?t:"").trim()},s=[...null!==(n=null===(t=null==e?void 0:e.contexts)||void 0===t?void 0:t.entries())&&void 0!==n?n:[]].filter(i),a=[...null!==(o=null===(r=null==e?void 0:e.intents)||void 0===r?void 0:r.entries())&&void 0!==o?o:[]].filter((e=>{var t;const[n,r]=e,o=[...null!==(t=null==r?void 0:r.entries())&&void 0!==t?t:[]].filter(i);return!!(null!=n?n:"").trim()&&o.length>0}));return{contexts:new Map(s),intents:new Map(a)}})(e),i=$(r,o),s=i.contexts,a=i.intents,p=[];let d;p.push(fin.me.interop.addContextHandler(((e,t,n)=>async r=>{r?await z(r,e,t,n):u("No context info provided, ignoring")})(s,t,n))),a.forEach(((e,r)=>{p.push(fin.me.interop.registerIntentHandler(((e,t,n)=>async r=>{u("Intent received",r);const{context:o}=r;o?e?await z(o,e,t,n):l(`No actions have been provided for intent ${r.name}, ignoring`):l("No context info provided with intent, ignoring")})(e,t,n),r))}));try{d=await Promise.all(p)}catch(e){const t=new ApiError("Failed to register interop handlers",e);throw c(t),t}return d},z=async(e,t,n,r)=>{if(null==n||n(e),!0===e.openfinBbgApi)return;if(u("Processing context",e),!t.has(e.type)||!t.get(e.type))return void l(`No action has been defined for context type ${e.type}, ignoring`);const o=t.get(e.type);try{switch(!0){case e.type.toUpperCase().endsWith("CONTACT"):await Y(e,o);break;case e.type.toUpperCase().endsWith("INSTRUMENT"):await Z(e,o);break;case e.type.toUpperCase().endsWith("ORGANIZATION"):await J(e,o);break;default:return void l(`Context type ${e.type} is not supported, ignoring`)}}catch(e){let t;e instanceof ApiError?t=e:(t=new ApiError(void 0,e),c(t)),null==r||r(t)}},Y=async(e,t)=>{const{name:n}=e;if(!n)return void l("Contact context did not include a name, ignoring");if("string"==typeof t)return void l("Contact context is not compatible with group actions, ignoring");const{mnemonic:r,tails:o,target:i}=t,s=`${n} ${null!=o?o:""}`.trim();await M(i,r,void 0,void 0,s)},Z=async(e,t)=>{const r=(e=>{const{BBG:t,ticker:n}=e.id;return t||(n?`${n} US Equity`:void u("Instrument context does not contain a supported id",e))})(e);if(!r)return void l("Instrument context did not contain a valid security, ignoring");if("string"==typeof t)return void await(async(e,t)=>{if(u(`Setting ${"*"===e?"every group":`group ${e}`} security to ${t}`),"*"===e){const e=await v.getAllGroups();await Promise.all(e.map((e=>e.setSecurity(t,G))))}else try{const n=await v.getGroup(e);await n.setSecurity(t,G)}catch(e){const t=n(e);throw c(t),t}})(t,r);const{mnemonic:o,tails:i,target:s}=t;await M(s,o,r,void 0,i)},J=async(e,t)=>{const{name:n}=e;if(!n)return void l("Organization context did not include a name, ignoring");if("string"==typeof t)return void l("Organization context is not compatible with group actions, ignoring");const{mnemonic:r,tails:o,target:i}=t,s=`${n} ${null!=o?o:""}`.trim();await M(i,r,void 0,void 0,s)};var Q;!function(e){e.Bloomberg="BLOOMBERG"}(Q||(Q={}));const H=async e=>{(async e=>{try{await fin.System.registerUsage({type:"integration-feature",data:{apiVersion:r,componentName:e}})}catch(t){l(`Unable to register usage for feature ${e}: ${null==t?void 0:t.message}`)}})(Q.Bloomberg);const{group:t,actions:n,onContextChanged:o,onError:i}=null!=e?e:{};if(u("Creating interop connection",t,n),!await k()){const e=new TerminalConnectionError;throw c(e),e}let s;void 0!==(null!=t?t:void 0)&&(s=await v.subscribeGroupEvents(P(t,o,i)),u("Launchpad group subscription created: ",s));const a=await W(n,o,i);return{disconnect:K(a,s)}},K=(e,t)=>async()=>{u("Disconnecting interop connection"),e&&await Promise.all(e.map((async e=>{await e.unsubscribe()}))),void 0!==(null!=t?t:void 0)&&await v.unsubscribeGroupEvents(t)};var X=t.MS,ee=t.xc,te=t.BT,ne=t.ez,re=t.yW,oe=t.$j,ie=t.U$,se=t.U7,ae=t.GS,ce=t.hN,ue=t.Yc,le=t.eE,pe=t.C1;export{X as ApiError,ee as AppNotAuthorizedError,te as InteropError,ne as TerminalCommandError,re as TerminalConnectionError,oe as connect,ie as disableLogging,se as enableLogging,ae as isBloombergTerminalReady,ce as isCusip,ue as isEquity,le as isFigi,pe as isIsin};
var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{MS:()=>ApiError,xc:()=>AppNotAuthorizedError,BT:()=>InteropError,ez:()=>TerminalCommandError,yW:()=>TerminalConnectionError,$j:()=>H,U$:()=>s,U7:()=>a,GS:()=>k,hN:()=>C,Yc:()=>A,eE:()=>O,C1:()=>x});const n=e=>{var t,n,r,o;if(e instanceof ApiError)return e;switch(!0){case(null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.indexOf("APPLICATION_VALIDATION"))>=0:return new AppNotAuthorizedError;case(null===(n=null==e?void 0:e.message)||void 0===n?void 0:n.indexOf("INVALID_COMMAND"))>=0:case(null===(r=null==e?void 0:e.message)||void 0===r?void 0:r.indexOf("INVALID_GROUP_VALUE"))>=0:case(null===(o=null==e?void 0:e.message)||void 0===o?void 0:o.indexOf("MNEMONIC_NOT_ALLOWED"))>=0:return new TerminalCommandError(void 0,e);case"[object Object]"===(null==e?void 0:e.message):return new TerminalConnectionError;default:return new ApiError(void 0,e)}};class ApiError extends Error{constructor(e="An unexpected error has occurred",t){var n;super(e),t&&(this.innerError=t),this.stack=null===(n=this.stack)||void 0===n?void 0:n.replace(/^(\w*Error)/,`${this.constructor.name}`)}}class AppNotAuthorizedError extends ApiError{constructor(e="App not authorized to use Terminal Connect API",t){super(e,t)}}class InteropError extends ApiError{constructor(e="Failed to execute the interop function",t){super(e,t)}}class TerminalCommandError extends ApiError{constructor(e="Failed to execute the terminal command",t){super(e,t)}}class TerminalConnectionError extends ApiError{constructor(e="Failed to connect to local terminal service",t){super(e,t)}}const r="1.1.0";let o=!1;const i="[@openfin/bloomberg]",s=()=>{o=!1},a=()=>{o=!0,u(`v${r}`)},c=(e,t)=>{o&&(e.innerError?console.error(t?`${i} ${t}`:i,e,"\n\n(inner)",e.innerError):console.error(t?`${i} ${t}`:i,e))},u=(...e)=>{o&&console.log(i,...e)},l=(...e)=>{o&&console.warn(i,...e)};"undefined"==typeof fin&&Object.assign(window,{fin:{}}),Object.assign(fin,{Integrations:{Bloomberg:{enableLogging:a,disableLogging:s}}});class p{constructor(e,t,n){this._lastUpdate=0,this._securityCacheExpiration=15e3,this._securityCache="",this._name=t,this._type=n,this._terminalProxy=e}get name(){return this._name}get type(){return this._type}getSecurity(){return new Promise(((e,t)=>{this._terminalProxy.getAllGroups((n=>{const r=n.find((e=>e.name===this._name));r?(this._securityCache=r.security,this._lastUpdate=(new Date).getTime(),e(this._securityCache)):t(new Error(`Group ${name} is not found.`))}),((e,n)=>{t(new Error(n))}))}))}getCachedSecurity(){return new Promise((async(e,t)=>{const n=(new Date).getTime();(!this._securityCache||!this._lastUpdate||n-this._lastUpdate>this._securityCacheExpiration)&&await this.getSecurity(),e(this._securityCache)}))}setSecurity(e,t){return new Promise(((n,r)=>{this._terminalProxy.setGroupSecurity((()=>{this._securityCache=e,this._lastUpdate=(new Date).getTime(),n()}),((e,t)=>{r(new Error(t))}),this._name,e,t)}))}}function d(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n,r,o,i,s,a,c,u="",l=0;for(;l<e.length;)n=e.charCodeAt(l++),r=e.charCodeAt(l++),o=e.charCodeAt(l++),i=n>>2,s=(3&n)<<4|r>>4,a=(15&r)<<2|o>>6,c=63&o,isNaN(r)?a=c=64:isNaN(o)&&(c=64),u=u+t.charAt(i)+t.charAt(s)+t.charAt(a)+t.charAt(c);return u}class h{constructor(){this._seqNumber=0,this._isConnecting=!1,this._isConnected=!1,this._isRegistered=!1,this._sessionId="",this._queuedRequests=[],this._pendingRequests={},this._minPortRange=51800,this._maxPortRange=51820,this._currentPort=51800,this._responseTimeout=15e3,this._disconnectEventSubscriptions={},this._groupEventSubscriptions={},this.sendRemoteMessage=(e,t,n,r)=>{if(this._isRegistered||e.register||this.sendRemoteMessage({register:{}},12,null,console.error),this._sessionId||(this._sessionId=`{${function(){const e="0123456789ABCDEF".split("");let t,n=[],r=Math.random;n[8]=n[13]=n[18]=n[23]="-",n[14]="4";for(var o=0;o<36;o++)n[o]||(t=0|16*r(),n[o]=e[19==o?3&t|8:15&t]);return n.join("")}()}}`),e.setGroupValue&&!e.setGroupValue.cookie&&(e.setGroupValue.cookie=this._sessionId),e.subscribeGroupEvents){const t=e.subscribeGroupEvents.subId;delete e.subscribeGroupEvents.subId,r=e=>{delete this._groupEventSubscriptions[t],r&&r(e)}}const o={sessionId:this._sessionId,correlationId:++this._seqNumber,request:e},i=JSON.stringify(o),s=t>12,a=s?{appId:o.appId,sessionId:o.sessionId,correlationId:o.correlationId,payloadSchemaName:"ap3g_internal",payloadSchemaVersion:2,payloadMsgType:t,payload:d(i)}:void 0,c={envelope:{schemaName:s?"blp_lpad_msg":"blp_remote_controller",schemaVersion:2,message:s?JSON.stringify(a):i},correlationId:o.correlationId,expectResponse:!0,onsuccess:n,onerror:r};this._pendingRequests[o.correlationId]=c,this._isConnected?this.sendRequest(c):(this._queuedRequests.push(c),this.connect())}}addEventListener(e){const t=Object.keys(this._groupEventSubscriptions).length+1;return this._groupEventSubscriptions[t]=e,t}removeEventListener(e){return delete this._groupEventSubscriptions[e],Object.keys(this._groupEventSubscriptions).length}addDisconnectEventListener(e){const t=Object.keys(this._disconnectEventSubscriptions).length+1;return this._disconnectEventSubscriptions[t]=e,t}removeDisconnectEventListener(e){const t=Object.keys(this._disconnectEventSubscriptions).length;delete this._disconnectEventSubscriptions[e];return t!==Object.keys(this._disconnectEventSubscriptions).length}sendRequest(e){const t=JSON.stringify(e.envelope);this._webSocket&&this._webSocket.send(t),e.expectResponse?setTimeout((()=>{this._pendingRequests[e.correlationId]&&(delete this._pendingRequests[e.correlationId],e.onerror&&e.onerror(0,"Response Timeout"))}),this._responseTimeout):delete this._pendingRequests[e.correlationId]}connect(){try{if(this._isConnecting)return;this._isConnecting=!0,this._webSocket=new WebSocket("ws://localhost:"+this._currentPort,"terminal_api"),this._webSocket.onopen=this.onWebSocketOpen.bind(this),this._webSocket.onmessage=this.onWebSocketMessage.bind(this),this._webSocket.onclose=this.onWebSocketClose.bind(this),this._webSocket.onerror=this.onWebSocketError.bind(this)}catch(e){this._webSocket=void 0,this.cancelPendingRequests("WebSocket Exception "+e),console.error(e)}}cancelPendingRequests(e){this._isConnected=!1,this._isConnecting=!1,this._isRegistered=!1,this._sessionId="";for(let t in this._pendingRequests){const n=this._pendingRequests[t];n&&n.onerror&&n.onerror(0,e)}this._pendingRequests={}}onWebSocketClose(e){if(console.log("WebSocket Closed; Reason: "+e.reason+", Code: "+e.code+", WasClean: "+e.wasClean),this._isConnected){const t={};e&&void 0!==e.reason&&(t.reason=e.reason),e&&void 0!==e.code&&(t.code=e.code),e&&void 0!==e.wasClean&&(t.wasClean=e.wasClean),this._currentPort=this._minPortRange,this.cancelPendingRequests({status:"error",message:"Connection Closed",details:t});for(let e in this._disconnectEventSubscriptions){const t=this._disconnectEventSubscriptions[e];t&&t(e)}}}onWebSocketError(){if(console.log("WebSocket Error; readyState: "+(this._webSocket&&this._webSocket.readyState)),this._isConnecting=!1,this._currentPort<this._maxPortRange)this._currentPort+=1,this.connect();else{this._currentPort=this._minPortRange;const e={readyState:this._webSocket&&this._webSocket.readyState};this.cancelPendingRequests({status:"error",message:"Connection Error",details:e})}}onWebSocketOpen(){for(this._isConnected=!0,this._isConnecting=!1;this._queuedRequests.length>0;)this.sendRequest(this._queuedRequests.shift())}onWebSocketMessage(e){var t=e&&e.data?e.data:"null",n=JSON.parse(t),r=n?JSON.parse(n.message):null,o=r&&r.response?this._pendingRequests[r.correlationId]:null;o&&delete this._pendingRequests[r.correlationId],this.processResponse(o,r.response)}getGroupInfo(e){return e?{name:e.name,type:e.type,security:"security"===e.type&&e.value?e.value:void 0}:{}}processResponse(e,t){if(t.success)e.onsuccess&&e.onsuccess();else if(t.registrationComplete)this._isRegistered=!0,console.log("Registration Complete; Session: "+this._sessionId),e.onsuccess&&e.onsuccess();else if(t.getAllGroups){const n=t.getAllGroups.group;e.onsuccess&&e.onsuccess(n?n.map(this.getGroupInfo):[])}else if(t.groupValue)e.onsuccess&&e.onsuccess(this.getGroupInfo(t.groupValue.group));else if(t.groupEvent){if(t.groupEvent.valueChanged){const e=t.groupEvent.valueChanged.group,n=t.groupEvent.valueChanged.cookie===this._sessionId?void 0:t.groupEvent.valueChanged.cookie;for(let t in this._groupEventSubscriptions){const r=this._groupEventSubscriptions[t];r&&r(e,n)}}}else e.onerror&&e.onerror(t.failure&&t.failure.code||0,t.failure?`${t.failure.message} ${t.failure.humanMessage}`:"Unknown Response")}}class g{constructor(){this._webSocket=new h}runFunction(e,t,n,r,o,i,s,a){let c="";if(n&&n.length?1!==r&&2!==r&&3!==r&&4!==r&&5!==r&&(c="Invalid Or Missing Parameter: panel"):c="Invalid Or Missing Parameter: mnemonic",c)return console.error("runFunctionInPanel error: "+c),void(t&&t(0,c));const u={runFunctionInPanel:{mnemonic:n,panel:r}};if(o){const e=[];e.push(o),i&&e.push(i),u.runFunctionInPanel.securities=e}s&&(u.runFunctionInPanel.tails=s),a&&(u.runFunctionInPanel.applicationProperties=a),this._webSocket.sendRemoteMessage(u,0,e,t)}getAllGroups(e,t){this._webSocket.sendRemoteMessage({getAllGroups:{}},13,e,t)}getGroup(e,t,n){if(!n||!n.length){const e="Invalid Or Missing Parameter: name";return console.error(e),void(t&&t(0,e))}this._webSocket.sendRemoteMessage({getGroupValue:{name:n}},15,e,t)}setGroupSecurity(e,t,n,r,o){let i="";if(n&&n.length?r&&r.length||(i="Invalid Or Missing Parameter: security"):i="Invalid Or Missing Parameter: name",i)return console.error("setGroupContext error: "+i),void(t&&t(0,i));this._webSocket.sendRemoteMessage({setGroupValue:{name:n,value:r,cookie:o}},14,e,t)}subscribeGroupEvents(e,t,n){if(!n){const e="Invalid Or Missing Parameter: callback";return console.error("subscribeGroupEvents error: "+e),void(t&&t(0,e))}const r=this._webSocket.addEventListener(n);1===r?this._webSocket.sendRemoteMessage({subscribeGroupEvents:{subId:r}},16,(()=>{e&&e(r)}),(e=>{t&&t(0,e)})):e&&e(r)}unsubscribeGroupEvents(e,t,n){if(!n){const e="Invalid Or Missing Parameter: cookie";return console.error("unsubscribeGroupEvents error: "+e),void(t&&t(0,e))}0===this._webSocket.removeEventListener(n)?this._webSocket.sendRemoteMessage({unsubscribeGroupEvents:{}},17,e,t):e&&e()}subscribeDisconnectEvent(e,t,n){if(!n){const e="Invalid Or Missing Parameter: callback";return console.error("subscribeDisconnectEvent error: "+e),t&&t(0,e),null}const r=this._webSocket.addDisconnectEventListener(n);return e&&e(r),r}unsubscribeDisconnectEvent(e,t,n){if(!n){const e="Invalid Or Missing Parameter: cookie";return console.error("unsubscribeDisconnectEvent error: "+e),t&&t(0,e),!1}return this._webSocket.removeDisconnectEventListener(n)?(e&&e(),!0):(t&&t(0,"Invalid Subscription"),!1)}}class f{constructor(){this.runFunction=window.bb.apps.tc.runFunction,this.getGroup=window.bb.apps.tc.getGroup,this.setGroupSecurity=window.bb.apps.tc.setGroupSecurity,this.getAllGroups=window.bb.apps.tc.getAllGroups,this.subscribeGroupEvents=window.bb.apps.tc.subscribeGroupEvents,this.unsubscribeGroupEvents=window.bb.apps.tc.unsubscribeGroupEvents}subscribeDisconnectEvent(e,t,n){}unsubscribeDisconnectEvent(e,t,n){}}class m{constructor(e=!function(){return!!(window.bb&&window.bb.apps&&window.bb.apps.app&&window.bb.apps.event)}()){this._helperSetGroupValues=e=>{const t=new p(this._terminalProxy,e.name,e.type);return t._securityCache=e.security,t._lastUpdate=(new Date).getTime(),t},this._terminalProxy=e?new g:new f}runFunction(e,t,n,r,o){return new Promise(((i,s)=>{this._terminalProxy.runFunction(i,((e,t)=>{s(new Error(t))}),e,t,n||null,r||null,o||null)}))}getAllGroups(){return new Promise(((e,t)=>{this._terminalProxy.getAllGroups((t=>{e(Array.from(t,this._helperSetGroupValues))}),((e,n)=>{t(new Error(n))}))}))}getGroup(e){return new Promise(((t,n)=>{this._terminalProxy.getAllGroups((r=>{const o=r.find((t=>t.name===e));o?t(this._helperSetGroupValues(o)):n(new Error(`Group ${e} is not found.`))}),((e,t)=>{n(new Error(t))}))}))}subscribeGroupEvents(e){return new Promise(((t,n)=>{this._terminalProxy.subscribeGroupEvents((e=>{t(e)}),((e,t)=>{n(new Error(t))}),((t,n)=>{e(this._helperSetGroupValues(t),n)}))}))}unsubscribeGroupEvents(e){return new Promise(((t,n)=>{this._terminalProxy.unsubscribeGroupEvents((()=>{t()}),((e,t)=>{n(new Error(t))}),e)}))}}const v=(window.BB=window.BB||{},window.BB.Apps=window.BB.Apps||{},window.BB.Apps.Terminal=window.BB.Apps.Terminal||new m,window.BB.Apps.Terminal);var b,y,w;!function(e){e.AppNotFound="AppNotFound",e.ErrorOnLaunch="ErrorOnLaunch",e.AppTimeout="AppTimeout",e.ResolverUnavailable="ResolverUnavailable"}(b||(b={})),function(e){e.NoAppsFound="NoAppsFound",e.ResolverUnavailable="ResolverUnavailable",e.ResolverTimeout="ResolverTimeout"}(y||(y={})),function(e){e.NoChannelFound="NoChannelFound",e.AccessDenied="AccessDenied",e.CreationFailed="CreationFailed"}(w||(w={}));var _,E;_=function(e){var t=function(e){var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,i=Object.create(o.prototype),s=new x(r||[]);return i._invoke=function(e,t,n){var r=p;return function(o,i){if(r===h)throw new Error("Generator is already running");if(r===g){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===p)throw r=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var c=l(e,t,n);if("normal"===c.type){if(r=n.done?g:d,c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=g,n.method="throw",n.arg=c.arg)}}}(e,n,s),i}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var p="suspendedStart",d="suspendedYield",h="executing",g="completed",f={};function m(){}function v(){}function b(){}var y={};y[i]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(G([])));_&&_!==n&&r.call(_,i)&&(y=_);var E=b.prototype=m.prototype=Object.create(y);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function n(o,i,s,a){var c=l(e[o],e,i);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(p).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,a)}))}a(c.arg)}var o;this._invoke=function(e,r){function i(){return new t((function(t,o){n(e,r,t,o)}))}return o=o?o.then(i,i):i()}}function C(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method))return f;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,f;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,f):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function G(e){if(e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,s=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return s.next=s}}return{next:P}}function P(){return{value:t,done:!0}}return v.prototype=E.constructor=b,b.constructor=v,v.displayName=c(b,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,a,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},S(I.prototype),I.prototype[s]=function(){return this},e.AsyncIterator=I,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var s=new I(u(t,n,r,o),i);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},S(E),c(E,a,"Generator"),E[i]=function(){return this},E.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=G,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return a.type="throw",a.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return o("end");if(s.tryLoc<=this.prev){var c=r.call(s,"catchLoc"),u=r.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return o(s.catchLoc,!0);if(this.prev<s.finallyLoc)return o(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return o(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return o(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:G(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}},_(E={exports:{}},E.exports);var S;!function(e){e.Contact="fdc3.contact",e.ContactList="fdc3.contactList",e.Country="fdc3.country",e.Instrument="fdc3.instrument",e.Organization="fdc3.organization",e.Portfolio="fdc3.portfolio",e.Position="fdc3.position"}(S||(S={}));var I;!function(e){e.StartCall="StartCall",e.StartChat="StartChat",e.ViewChart="ViewChart",e.ViewContact="ViewContact",e.ViewQuote="ViewQuote",e.ViewNews="ViewNews",e.ViewInstrument="ViewInstrument",e.ViewAnalysis="ViewAnalysis"}(I||(I={}));const C=e=>!!e&&/^([A-Z0-9]{5})([A-Z0-9*@#]{3})(\d)$/i.test(e),A=e=>!!e&&/\b(EQUITY)$/i.test(e),O=e=>!!e&&/^(?!B[SM]|G[GBH]|KY|VG)([A-Z]{2})(G)(((?![AEIOU_])\w){8})(\d)$/i.test(e),x=e=>!!e&&/^([A-Z]{2})([A-Z0-9]{9})(\d)$/i.test(e),G="OF_BBG_API",P=(e,t,r)=>async(o,i)=>{var s;if(void 0===(null!==(s=null==o?void 0:o.name)&&void 0!==s?s:void 0)){const e=new ApiError(void 0,"Group event source is undefined");throw c(e),null==r||r(e),e}if("*"!==e&&o.name!==e||i===G)return;let a;try{a=await o.getSecurity()}catch(e){const t=n(e);throw c(t),null==r||r(t),t}u(`Launchpad group ${o.name} security changed to:`,a);const l=(e=>{const t={type:S.Instrument,id:{BBG:e}},n=(e=>{var t;if(null==e?void 0:e.trim())return(null!==(t=e.match(/^\w+/))&&void 0!==t?t:[])[0]})(e);if(!n)return t;switch(!0){case C(n):t.id.CUSIP=n;break;case O(n):t.id.FIGI=n;break;case x(n):t.id.ISIN=n;break;case A(e):t.id.ticker=n}return t})(a);l.openfinBbgApi=!0,null==t||t(l),u("Setting new context: ",l);try{await fin.me.interop.setContext(l)}catch(e){const t=new InteropError(void 0,e);c(t),null==r||r(t)}},k=async()=>{let e=!0;try{await v.getAllGroups()}catch(t){const r=n(t);if(!(r instanceof TerminalConnectionError))throw c(r),r;e=!1}return u("Bloomberg terminal ready: ",e),e},M=async(e,t,r,o,i)=>{if("number"==typeof e){u(`Running terminal function in panel ${e}: `,t,r,o,i);try{await v.runFunction(t,e,r,o,i)}catch(e){const t=n(e);throw c(t),t}}else u(`Unable to run function as target ${e} is not a panel`,t,r,o,i)},R={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};R.defaultMerge;function F(e,t){return t}function L(e){return"object"!=typeof e||null===e?0:Array.isArray(e)?2:function(e){if(!B.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(void 0===t)return!0;const n=t.prototype;if(null===n||"object"!=typeof n||!B.has(Object.prototype.toString.call(n)))return!1;if(!n.hasOwnProperty("isPrototypeOf"))return!1;return!0}(e)?1:e instanceof Set?3:e instanceof Map?4:5}function N(e){const t=new Set;for(const n of e)for(const e of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(e);return t}function j(e,t){return"object"==typeof e&&Object.prototype.propertyIsEnumerable.call(e,t)}function T(e){return{*[Symbol.iterator](){for(const t of e)for(const e of t)yield e}}}const B=new Set(["[object Object]","[object Module]"]);function V(e){return e[e.length-1]}var D=Object.freeze({__proto__:null,mergeRecords:function(e,t,n){const r={};for(const o of N(e)){const i=[];for(const t of e)j(t,o)&&i.push(t[o]);if(0===i.length)continue;const s=t.metaDataUpdater(n,{key:o,parents:e}),a=U(i,t,s);a!==R.skip&&("__proto__"===o?Object.defineProperty(r,o,{value:a,configurable:!0,enumerable:!0,writable:!0}):r[o]=a)}return r},mergeArrays:function(e){return e.flat()},mergeSets:function(e){return new Set(T(e))},mergeMaps:function(e){return new Map(T(e))},mergeOthers:V});function $(...e){return function(e,t){const n=function(e,t){var n,r;return{defaultMergeFunctions:D,mergeFunctions:{...D,...Object.fromEntries(Object.entries(e).filter((([e,t])=>Object.prototype.hasOwnProperty.call(D,e))).map((([e,t])=>!1===t?[e,V]:[e,t])))},metaDataUpdater:null!==(n=e.metaDataUpdater)&&void 0!==n?n:F,deepmerge:t,useImplicitDefaultMerging:null!==(r=e.enableImplicitDefaultMerging)&&void 0!==r&&r,actions:R}}(e,r);function r(...e){return U(e,n,t)}return r}({})(...e)}function U(e,t,n){if(0===e.length)return;if(1===e.length)return q(e,t,n);const r=L(e[0]);if(0!==r&&5!==r)for(let o=1;o<e.length;o++)if(L(e[o])!==r)return q(e,t,n);switch(r){case 1:return function(e,t,n){const r=t.mergeFunctions.mergeRecords(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords)return t.defaultMergeFunctions.mergeRecords(e,t,n);return r}(e,t,n);case 2:return function(e,t,n){const r=t.mergeFunctions.mergeArrays(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays)return t.defaultMergeFunctions.mergeArrays(e);return r}(e,t,n);case 3:return function(e,t,n){const r=t.mergeFunctions.mergeSets(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets)return t.defaultMergeFunctions.mergeSets(e);return r}(e,t,n);case 4:return function(e,t,n){const r=t.mergeFunctions.mergeMaps(e,t,n);if(r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps)return t.defaultMergeFunctions.mergeMaps(e);return r}(e,t,n);default:return q(e,t,n)}}function q(e,t,n){const r=t.mergeFunctions.mergeOthers(e,t,n);return r===R.defaultMerge||t.useImplicitDefaultMerging&&void 0===r&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):r}const W=async(e,t,n)=>{const r=(()=>{const e=new Map,t=new Map,n={target:1,mnemonic:"DES"},r={target:1,mnemonic:"GP"},o={target:1,mnemonic:"Q"},i={target:1,mnemonic:"BIO"},s={target:1,mnemonic:"SEAR"};e.set(S.Instrument,Object.assign({},n)),e.set(S.Contact,Object.assign({},i)),e.set(S.Organization,Object.assign({},s));const a=new Map;a.set(S.Instrument,Object.assign({},r)),t.set(I.ViewChart,a);const c=new Map;c.set(S.Contact,Object.assign({},i)),t.set(I.ViewContact,c);const u=new Map;u.set(S.Instrument,Object.assign({},n)),t.set(I.ViewInstrument,u);const l=new Map;return l.set(S.Instrument,Object.assign({},o)),t.set(I.ViewQuote,l),{contexts:e,intents:t}})(),o=(e=>{var t,n,r,o;const i=e=>{const[t]=e;return!!(null!=t?t:"").trim()},s=[...null!==(n=null===(t=null==e?void 0:e.contexts)||void 0===t?void 0:t.entries())&&void 0!==n?n:[]].filter(i),a=[...null!==(o=null===(r=null==e?void 0:e.intents)||void 0===r?void 0:r.entries())&&void 0!==o?o:[]].filter((e=>{var t;const[n,r]=e,o=[...null!==(t=null==r?void 0:r.entries())&&void 0!==t?t:[]].filter(i);return!!(null!=n?n:"").trim()&&o.length>0}));return{contexts:new Map(s),intents:new Map(a)}})(e),i=$(r,o),s=i.contexts,a=i.intents,p=[];let d;p.push(fin.me.interop.addContextHandler(((e,t,n)=>async r=>{r?await z(r,e,t,n):u("No context info provided, ignoring")})(s,t,n))),a.forEach(((e,r)=>{p.push(fin.me.interop.registerIntentHandler(((e,t,n)=>async r=>{u("Intent received",r);const{context:o}=r;o?e?await z(o,e,t,n):l(`No actions have been provided for intent ${r.name}, ignoring`):l("No context info provided with intent, ignoring")})(e,t,n),r))}));try{d=await Promise.all(p)}catch(e){const t=new ApiError("Failed to register interop handlers",e);throw c(t),t}return d},z=async(e,t,n,r)=>{if(null==n||n(e),!0===e.openfinBbgApi)return;if(u("Processing context",e),!t.has(e.type)||!t.get(e.type))return void l(`No action has been defined for context type ${e.type}, ignoring`);const o=t.get(e.type);try{switch(!0){case e.type.toUpperCase().endsWith("CONTACT"):await Y(e,o);break;case e.type.toUpperCase().endsWith("INSTRUMENT"):await Z(e,o);break;case e.type.toUpperCase().endsWith("ORGANIZATION"):await J(e,o);break;default:return void l(`Context type ${e.type} is not supported, ignoring`)}}catch(e){let t;e instanceof ApiError?t=e:(t=new ApiError(void 0,e),c(t)),null==r||r(t)}},Y=async(e,t)=>{const{name:n}=e;if(!n)return void l("Contact context did not include a name, ignoring");if("string"==typeof t)return void l("Contact context is not compatible with group actions, ignoring");const{mnemonic:r,tails:o,target:i}=t,s=`${n} ${null!=o?o:""}`.trim();await M(i,r,void 0,void 0,s)},Z=async(e,t)=>{const r=(e=>{const{BBG:t,ticker:n}=e.id;return t||(n?`${n} US Equity`:void u("Instrument context does not contain a supported id",e))})(e);if(!r)return void l("Instrument context did not contain a valid security, ignoring");if("string"==typeof t)return void await(async(e,t)=>{if(u(`Setting ${"*"===e?"every group":`group ${e}`} security to ${t}`),"*"===e){const e=await v.getAllGroups();await Promise.all(e.map((e=>e.setSecurity(t,G))))}else try{const n=await v.getGroup(e);await n.setSecurity(t,G)}catch(e){const t=n(e);throw c(t),t}})(t,r);const{mnemonic:o,tails:i,target:s}=t;await M(s,o,r,void 0,i)},J=async(e,t)=>{const{name:n}=e;if(!n)return void l("Organization context did not include a name, ignoring");if("string"==typeof t)return void l("Organization context is not compatible with group actions, ignoring");const{mnemonic:r,tails:o,target:i}=t,s=`${n} ${null!=o?o:""}`.trim();await M(i,r,void 0,void 0,s)};var Q;!function(e){e.Bloomberg="BLOOMBERG"}(Q||(Q={}));const H=async e=>{(async e=>{try{await fin.System.registerUsage({type:"integration-feature",data:{apiVersion:r,componentName:e}})}catch(t){l(`Unable to register usage for feature ${e}: ${null==t?void 0:t.message}`)}})(Q.Bloomberg);const{group:t,actions:n,onContextChanged:o,onError:i}=null!=e?e:{};if(u("Creating interop connection",t,n),!await k()){const e=new TerminalConnectionError;throw c(e),e}let s;void 0!==(null!=t?t:void 0)&&(s=await v.subscribeGroupEvents(P(t,o,i)),u("Launchpad group subscription created: ",s));const a=await W(n,o,i);return{disconnect:K(a,s)}},K=(e,t)=>async()=>{u("Disconnecting interop connection"),e&&await Promise.all(e.map((async e=>{await e.unsubscribe()}))),void 0!==(null!=t?t:void 0)&&await v.unsubscribeGroupEvents(t)};var X=t.MS,ee=t.xc,te=t.BT,ne=t.ez,re=t.yW,oe=t.$j,ie=t.U$,se=t.U7,ae=t.GS,ce=t.hN,ue=t.Yc,le=t.eE,pe=t.C1;export{X as ApiError,ee as AppNotAuthorizedError,te as InteropError,ne as TerminalCommandError,re as TerminalConnectionError,oe as connect,ie as disableLogging,se as enableLogging,ae as isBloombergTerminalReady,ce as isCusip,ue as isEquity,le as isFigi,pe as isIsin};
{
"name": "@openfin/bloomberg",
"description": "Connect apps running in OpenFin with the Bloomberg Terminal.",
"version": "1.1.0-beta.1",
"version": "1.1.0",
"author": "OpenFin Inc.",

@@ -6,0 +6,0 @@ "homepage": "https://www.openfin.co/",

import { BloombergConnection, BloombergConnectionConfig } from './connection.types';
/**
* Creates a connection to the Bloomberg Terminal enabling the handling of [context types](https://developers.openfin.co/of-docs/docs/interoperability-overview#context) and [intents](https://developers.openfin.co/of-docs/docs/interoperability-overview#intent).
* Creates a connection to the Bloomberg Terminal enabling the handling of {@link https://developers.openfin.co/of-docs/docs/interoperability-overview#context | context types} and {@link https://developers.openfin.co/of-docs/docs/interoperability-overview#intent | intents}.
*
* Note: The Terminal must be running locally and logged in, otherwise an error will be thrown.
*
* @param config Connection configuration settings. Uses [default configuration](https://developers.openfin.co/of-docs/docs/integration-with-terminal-connect#default-integration-configuration) if none provided.
* @param config - Connection configuration settings. Uses {@link https://developers.openfin.co/of-docs/docs/integration-with-terminal-connect#default-integration-configuration | default configuration} if none provided.
*

@@ -9,0 +9,0 @@ * @throws {@link TerminalConnectionError} if the Bloomberg Terminal is not running or logged in.

@@ -7,5 +7,5 @@ import * as fdc3 from '@finos/fdc3';

*
* If the action is a {@link BloombergTerminalCommand command}, the Terminal will execute the command in the specified panel.
* If the action is a {@link BloombergTerminalCommand | command}, the Terminal will execute the command in the specified panel.
*
* If the action is a {@link BloombergGroup group name}, the group’s security will be updated when handling [instrument](https://fdc3.finos.org/docs/context/ref/Instrument)
* If the action is a {@link BloombergGroup | group name}, the group’s security will be updated when handling {@link https://fdc3.finos.org/docs/context/ref/Instrument | instrument}
* contexts.

@@ -15,4 +15,4 @@ */

/**
* Configuration determining which [context types](https://developers.openfin.co/of-docs/docs/interoperability-overview#context) and
* [intents](https://developers.openfin.co/of-docs/docs/interoperability-overview#intent) will be handled by the Bloomberg Terminal, and how.
* Configuration determining which {@link https://developers.openfin.co/of-docs/docs/interoperability-overview#context | context types} and
* {@link https://developers.openfin.co/of-docs/docs/interoperability-overview#intent | intents} will be handled by the Bloomberg Terminal, and how.
*/

@@ -26,3 +26,3 @@ export type BloombergActionsConfig = {

/**
* A connection to the Bloomberg Terminal that enables [interoperability](https://developers.openfin.co/of-docs/docs/interoperability-overview)
* A connection to the Bloomberg Terminal that enables {@link https://developers.openfin.co/of-docs/docs/interoperability-overview | interoperability}
* with other OpenFin apps.

@@ -45,3 +45,3 @@ */

*
* @param context The new context.
* @param context - The new context.
*/

@@ -52,3 +52,3 @@ onContextChanged?: (context: fdc3.Context) => void;

*
* @param error Error that was detected.
* @param error - Error that was detected.
*/

@@ -73,3 +73,3 @@ onError?: (error: ApiError) => void;

/**
* Type name of a [context](https://developers.openfin.co/of-docs/docs/interoperability-overview#context) object.
* Type name of a {@link https://developers.openfin.co/of-docs/docs/interoperability-overview#context | context} object.
*/

@@ -82,4 +82,4 @@ export type ContextType = string;

/**
* Name of an [intent](https://developers.openfin.co/of-docs/docs/interoperability-overview#intent).
* Name of an {@link https://developers.openfin.co/of-docs/docs/interoperability-overview#intent | intent}.
*/
export type IntentName = string;
/**
* Gets the relevant API error for a given Terminal Connect API error.
* @param error Error generated by Terminal Connect API.
* @param error - Error generated by Terminal Connect API.
*

@@ -5,0 +5,0 @@ * @internal

@@ -6,5 +6,5 @@ import { Context, Instrument } from '@finos/fdc3';

/**
* Determines if the provided text is a [CUSIP](https://www.cusip.com/cusip/index.htm).
* Determines if the provided text is a {@link https://www.cusip.com/cusip/index.htm | CUSIP}.
*
* @param text String to check.
* @param text - String to check.
*/

@@ -15,17 +15,17 @@ export declare const isCusip: (text: string) => boolean;

*
* @param security Bloomberg security to check.
* @param security - Bloomberg security to check.
*/
export declare const isEquity: (security: string) => boolean;
/**
* Determines if the provided text is a [FIGI](https://www.openfigi.com/about/figi).
* Determines if the provided text is a {@link https://www.openfigi.com/about/figi | FIGI}.
*
* @param text String to check.
* @param text - String to check.
*/
export declare const isFigi: (text: string) => boolean;
/**
* Determines if the provided text is an [ISIN](https://www.isin.org/isin/).
* Determines if the provided text is an {@link https://www.isin.org/isin/ | ISIN}.
*
* @param text String to check.
* @param text - String to check.
*/
export declare const isIsin: (text: string) => boolean;
export declare const registerUsage: (featureName: UsageFeatureName) => Promise<void>;

@@ -1,1 +0,1 @@

export declare const API_VERSION = "1.1.0-beta.1";
export declare const API_VERSION = "1.1.0";
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc