marketplacepos 6.36.2 → 6.36.5

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.
Files changed (62) hide show
  1. package/Marketplace/{chunk-EBP36E3A.js → chunk-2DIGZDRS.js} +1 -1
  2. package/Marketplace/{chunk-263UWLK2.js → chunk-2P6KOYAL.js} +1 -1
  3. package/Marketplace/{chunk-YXL5QN4Q.js → chunk-4HX4WWTE.js} +1 -1
  4. package/Marketplace/{chunk-EHFG3EIP.js → chunk-4UTSQBQJ.js} +1 -1
  5. package/Marketplace/{chunk-ED4KKCK5.js → chunk-5MTZVL5P.js} +1 -1
  6. package/Marketplace/{chunk-2P37VNQU.js → chunk-5QXMW5DY.js} +1 -1
  7. package/Marketplace/{chunk-HWYSCJ43.js → chunk-62IN5X7K.js} +1 -1
  8. package/Marketplace/{chunk-FGKESPPZ.js → chunk-6BIRYTBG.js} +1 -1
  9. package/Marketplace/{chunk-QTPS2MS5.js → chunk-6T6RYA4J.js} +1 -1
  10. package/Marketplace/{chunk-XZKAZQ76.js → chunk-6TAES6UG.js} +1 -1
  11. package/Marketplace/{chunk-JOTSMBFF.js → chunk-A23NT52P.js} +1 -1
  12. package/Marketplace/{chunk-XWXDPONM.js → chunk-AOYNKLB5.js} +1 -1
  13. package/Marketplace/{chunk-AJF4SJ6X.js → chunk-AU47TFHV.js} +1 -1
  14. package/Marketplace/{chunk-67PLIDKU.js → chunk-B4ADV7OV.js} +1 -1
  15. package/Marketplace/{chunk-UW7RDW7F.js → chunk-B6DYSUSR.js} +1 -1
  16. package/Marketplace/{chunk-RPWJAOFD.js → chunk-BMUITO4G.js} +1 -1
  17. package/Marketplace/{chunk-OP4J64JZ.js → chunk-BTT6JR3D.js} +1 -1
  18. package/Marketplace/{chunk-QFI7LBJD.js → chunk-CEXG4XVI.js} +1 -1
  19. package/Marketplace/{chunk-YPIXAXNT.js → chunk-CP3FDSXO.js} +1 -1
  20. package/Marketplace/{chunk-ABRPVDVO.js → chunk-DA7HEIQY.js} +1 -1
  21. package/Marketplace/{chunk-JTQIWQDJ.js → chunk-DFIXIX34.js} +1 -1
  22. package/Marketplace/{chunk-HSFTVR6F.js → chunk-DMJOFKOP.js} +1 -1
  23. package/Marketplace/{chunk-2DMZJZC4.js → chunk-EPCHDRVS.js} +1 -1
  24. package/Marketplace/{chunk-RNF3DKK3.js → chunk-F2UY56QS.js} +1 -1
  25. package/Marketplace/{chunk-G24YLVF3.js → chunk-F7IBFDPW.js} +2 -2
  26. package/Marketplace/{chunk-TP7GPZVD.js → chunk-FDQYECQQ.js} +1 -1
  27. package/Marketplace/{chunk-5HJUNSIL.js → chunk-FIA66EOR.js} +1 -1
  28. package/Marketplace/{chunk-YFWWAZIP.js → chunk-G4HNUEOX.js} +1 -1
  29. package/Marketplace/{chunk-7AZA5UAP.js → chunk-GWHPDJXS.js} +1 -1
  30. package/Marketplace/{chunk-TBTZ3FUB.js → chunk-I2MXG2G3.js} +1 -1
  31. package/Marketplace/{chunk-PH4PTFRX.js → chunk-IF7UDZ6X.js} +1 -1
  32. package/Marketplace/{chunk-P3XRMO2U.js → chunk-ITCRSTHM.js} +1 -1
  33. package/Marketplace/{chunk-CZKJ4ZWT.js → chunk-IZAMPDCO.js} +1 -1
  34. package/Marketplace/{chunk-GE7DDJPK.js → chunk-JLU2MW53.js} +1 -1
  35. package/Marketplace/{chunk-I2KOLUPT.js → chunk-KCCL2O6G.js} +1 -1
  36. package/Marketplace/{chunk-4ZYEP5TH.js → chunk-LIIYZGRF.js} +1 -1
  37. package/Marketplace/{chunk-RIB4DH2E.js → chunk-LTSJDVQM.js} +1 -1
  38. package/Marketplace/{chunk-AL7KWTNP.js → chunk-N32FRIIQ.js} +1 -1
  39. package/Marketplace/{chunk-3CCS27RO.js → chunk-N4Q24OJA.js} +1 -1
  40. package/Marketplace/{chunk-Q4KEN7SJ.js → chunk-NJNLCE3I.js} +1 -1
  41. package/Marketplace/{chunk-4ZDHG6SI.js → chunk-OIJU2U25.js} +1 -1
  42. package/Marketplace/{chunk-FLHD7JFM.js → chunk-PHMBEWNE.js} +1 -1
  43. package/Marketplace/{chunk-6N6TWBA6.js → chunk-PL5KKNUE.js} +1 -1
  44. package/Marketplace/{chunk-HHXAB5QS.js → chunk-POYU2L63.js} +1 -1
  45. package/Marketplace/{chunk-OE5JC2VK.js → chunk-QGAOMEBW.js} +1 -1
  46. package/Marketplace/{chunk-IQ2QCUYQ.js → chunk-QKYLEIXT.js} +1 -1
  47. package/Marketplace/{chunk-BSUHNUUX.js → chunk-QUVUH345.js} +1 -1
  48. package/Marketplace/{chunk-4LSPDP5E.js → chunk-R5GKNGOV.js} +1 -1
  49. package/Marketplace/{chunk-S5QLFJEV.js → chunk-RERNIQQO.js} +1 -1
  50. package/Marketplace/{chunk-6KDJ7QW2.js → chunk-SIHK35QZ.js} +1 -1
  51. package/Marketplace/{chunk-32JJARCP.js → chunk-TT62YX47.js} +1 -1
  52. package/Marketplace/{chunk-5BONDPXS.js → chunk-UAUVFF7M.js} +1 -1
  53. package/Marketplace/{chunk-GEZFQI25.js → chunk-UMKNVGSN.js} +1 -1
  54. package/Marketplace/{chunk-3UKM6LS7.js → chunk-VKO32IBK.js} +1 -1
  55. package/Marketplace/{chunk-CKFYYQ5S.js → chunk-YITE3UJJ.js} +1 -1
  56. package/Marketplace/{chunk-K4BDZSWZ.js → chunk-YUZRU4KA.js} +1 -1
  57. package/Marketplace/{chunk-A34RPI3X.js → chunk-ZQFZZMOG.js} +1 -1
  58. package/Marketplace/{chunk-A2YYUZWU.js → chunk-ZRHC6QS2.js} +1 -1
  59. package/Marketplace/{chunk-2ZILXTWC.js → chunk-ZY3P6SKZ.js} +1 -1
  60. package/Marketplace/index.html +2 -2
  61. package/Marketplace/{main-4EWC7FQU.js → main-25OQ26B2.js} +2 -2
  62. package/package.json +1 -1
@@ -1 +1 @@
1
- import{a as be}from"./chunk-BGFEVOPZ.js";import{b as de,h as we}from"./chunk-EHFG3EIP.js";import{a as me}from"./chunk-HZRIS4FA.js";import{b as pe,e as _e}from"./chunk-UC7FUQNJ.js";import{ba as U,d as ge,e as fe,fa as B,ga as ae}from"./chunk-YU6N3IVV.js";import{a as _,b as $,c as N,h as g}from"./chunk-QWWW7GFA.js";var C=class extends Error{constructor(e,t){let n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}},P=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},S=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},O=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}},F=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}},q=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}},M=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},z=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}};var A=class{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}},k=class{get(e,t){return this.send($(_({},t),{method:"GET",url:e}))}post(e,t){return this.send($(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send($(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var i=(function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r})(i||{});var I=class{constructor(){}log(e,t){}};I.instance=new I;var Se="10.0.0";var d=class{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}},p=class r{static get isBrowser(){return!r.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!r.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!r.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function x(r,e){let t="";return v(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Ee(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Ee(r){let e=new Uint8Array(r),t="";return e.forEach(n=>{let o=n<16?"0":"";t+=`0x${o}${n.toString(16)} `}),t.substring(0,t.length-1)}function v(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function V(r,e,t,n,o,s){return g(this,null,function*(){let c={},[a,l]=E();c[a]=l,r.log(i.Trace,`(${e} transport) sending data. ${x(o,s.logMessageContent)}.`);let u=v(o)?"arraybuffer":"text",f=yield t.post(n,{content:o,headers:_(_({},c),s.headers),responseType:u,timeout:s.timeout,withCredentials:s.withCredentials});r.log(i.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function Ce(r){return r===void 0?new R(i.Information):r===null?I.instance:r.log!==void 0?r:new R(r)}var J=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},R=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let n=`[${new Date().toISOString()}] ${i[e]}: ${t}`;switch(e){case i.Critical:case i.Error:this.out.error(n);break;case i.Warning:this.out.warn(n);break;case i.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function E(){let r="X-SignalR-User-Agent";return p.isNode&&(r="User-Agent"),[r,Te(Se,Pe(),Re(),xe())]}function Te(r,e,t,n){let o="Microsoft SignalR/",s=r.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${r}; `,e&&e!==""?o+=`${e}; `:o+="Unknown OS; ",o+=`${t}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function Pe(){if(p.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function xe(){if(p.isNode)return process.versions.node}function Re(){return p.isNode?"NodeJS":"Browser"}function K(r){return r.stack?r.stack:r.message?r.message:`${r}`}function ye(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var X=class extends k{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(ye());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return g(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new S;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new S});let o=null;if(e.timeout){let l=e.timeout;o=setTimeout(()=>{t.abort(),this._logger.log(i.Warning,"Timeout from HTTP request."),n=new P},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},v(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:_({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(l){throw n||(this._logger.log(i.Warning,`Error from HTTP request. ${l}.`),l)}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!s.ok){let l=yield ve(s,"text");throw new C(l||s.statusText,s.status)}let a=yield ve(s,e.responseType);return new A(s.status,s.statusText,a)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(n,o)=>t=o.join("; ")),t}};function ve(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var G=class extends k{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?new Promise((t,n)=>{let o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(v(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let s=e.headers;s&&Object.keys(s).forEach(c=>{o.setRequestHeader(c,s[c])}),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{o.abort(),n(new S)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new A(o.status,o.statusText,o.response||o.responseText)):n(new C(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(i.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new C(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(i.Warning,"Timeout from HTTP request."),n(new P)},o.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var Y=class extends k{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new X(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new G(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}};var y=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};y.RecordSeparatorCode=30;y.RecordSeparator=String.fromCharCode(y.RecordSeparatorCode);var Q=class{writeHandshakeRequest(e){return y.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(v(e)){let a=new Uint8Array(e),l=a.indexOf(y.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),n=a.byteLength>u?a.slice(u).buffer:null}else{let a=e,l=a.indexOf(y.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=a.substring(0,u),n=a.length>u?a.substring(u):null}let o=y.parse(t),s=JSON.parse(o[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[n,s]}};var h=(function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence",r})(h||{});var Z=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new J(this,e)}};var ee=class{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}_send(e){return g(this,null,function*(){let t=this._protocol.writeMessage(e),n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let o=()=>{},s=()=>{};v(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((c,a)=>{o=c,s=a})),this._messages.push(new le(t,this._totalMessageCount,o,s))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch{this._disconnected()}yield n})}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){let o=this._messages[n];if(o._id<=e.sequenceId)t=n,v(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==h.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;let t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return g(this,null,function*(){let e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:h.Sequence,sequenceId:e}));let t=this._messages;for(let n of t)yield this._connection.send(n._message);this._reconnectInProgress=!1})}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(let t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case h.Invocation:case h.StreamItem:case h.Completion:case h.StreamInvocation:case h.CancelInvocation:return!0;case h.Close:case h.Sequence:case h.Ping:case h.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>g(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:h.Ack,sequenceId:this._latestReceivedSequenceId})))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}},le=class{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}};var De=30*1e3,$e=15*1e3,Ne=1e5,m=(function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r})(m||{}),te=class r{static create(e,t,n,o,s,c,a){return new r(e,t,n,o,s,c,a)}constructor(e,t,n,o,s,c,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},d.isRequired(e,"connection"),d.isRequired(t,"logger"),d.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=s??De,this.keepAliveIntervalInMilliseconds=c??$e,this._statefulReconnectBufferSize=a??Ne,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new Q,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=m.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:h.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==m.Disconnected&&this._connectionState!==m.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return g(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(i.Debug,"Starting HubConnection.");try{yield this._startInternal(),p.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(i.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(i.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return g(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);let n={protocol:this._protocol.name,version:t};if(this._logger.log(i.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new ee(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return g(this,null,function*(){let e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){if(this._connectionState===m.Disconnected)return this._logger.log(i.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===m.Disconnecting)return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let t=this._connectionState;return this._connectionState=m.Disconnecting,this._logger.log(i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===m.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new S("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return g(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[n,o]=this._replaceStreamingParams(t),s=this._createStreamInvocation(e,t,o),c,a=new Z;return a.cancelCallback=()=>{let l=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],c.then(()=>this._sendWithProtocol(l))},this._callbacks[s.invocationId]=(l,u)=>{if(u){a.error(u);return}else l&&(l.type===h.Completion?l.error?a.error(new Error(l.error)):a.complete():a.next(l.item))},c=this._sendWithProtocol(s).catch(l=>{a.error(l),delete this._callbacks[s.invocationId]}),this._launchStreams(n,c),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[n,o]=this._replaceStreamingParams(t),s=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,s),s}invoke(e,...t){let[n,o]=this._replaceStreamingParams(t),s=this._createInvocation(e,t,!1,o);return new Promise((a,l)=>{this._callbacks[s.invocationId]=(f,T)=>{if(T){l(T);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):a(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(s).catch(f=>{l(f),delete this._callbacks[s.invocationId]});this._launchStreams(n,u)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();let n=this._methods[e];if(n)if(t){let o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){let t=this._protocol.parseMessages(e,this._logger);for(let n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case h.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(i.Error,`Invoke client method threw error: ${K(o)}`)});break;case h.StreamItem:case h.Completion:{let o=this._callbacks[n.invocationId];if(o){n.type===h.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(s){this._logger.log(i.Error,`Stream callback threw error: ${K(s)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(i.Information,"Close message received from server.");let o=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(o):this._stopPromise=this._stopInternal(o);break}case h.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case h.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(i.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(o){let s="Error parsing handshake response: "+o;this._logger.log(i.Error,s);let c=new Error(s);throw this._handshakeRejecter(c),c}if(t.error){let o="Server returned handshake error: "+t.error;this._logger.log(i.Error,o);let s=new Error(o);throw this._handshakeRejecter(s),s}else this._logger.log(i.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let e=this._nextKeepAlive-new Date().getTime();if(e<0){this._connectionState===m.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(e<0&&(e=0),this._pingServerHandle=setTimeout(()=>g(this,null,function*(){this._connectionState===m.Connected&&(yield this._trySendPingMessage())}),e))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return g(this,null,function*(){let t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(i.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let o=n.slice(),s=!!e.invocationId,c,a,l;for(let u of o)try{let f=c;c=yield u.apply(this,e.arguments),s&&c&&f&&(this._logger.log(i.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(f){a=f,this._logger.log(i.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):s?(a?l=this._createCompletionMessage(e.invocationId,`${a}`,null):c!==void 0?l=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(l)):c&&this._logger.log(i.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(i.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new S("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===m.Disconnecting?this._completeClose(e):this._connectionState===m.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===m.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=m.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),p.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(i.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return g(this,null,function*(){let t=Date.now(),n=0,o=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(n,0,o);if(s===null){this._logger.log(i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(i.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(i.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(i.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(i.Information,`Reconnect attempt number ${n+1} will start in ${s} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(i.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(i.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n++,o=c instanceof Error?c:new Error(c.toString()),s=this._getNextRetryDelay(n,Date.now()-t,o)}}this._logger.log(i.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(o){return this._logger.log(i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${o}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{let o=t[n];try{o(null,e)}catch(s){this._logger.log(i.Error,`Stream 'error' callback called with '${e}' threw error: ${K(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,o){if(n)return o.length!==0?{target:e,arguments:t,streamIds:o,type:h.Invocation}:{target:e,arguments:t,type:h.Invocation};{let s=this._invocationId;return this._invocationId++,o.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:o,type:h.Invocation}:{target:e,arguments:t,invocationId:s.toString(),type:h.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let s;o instanceof Error?s=o.message:o&&o.toString?s=o.toString():s="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,s)))},next:o=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(e){let t=[],n=[];for(let o=0;o<e.length;o++){let s=e[o];if(this._isObservable(s)){let c=this._invocationId;this._invocationId++,t[c]=s,n.push(c.toString()),e.splice(o,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){let o=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:o.toString(),streamIds:n,type:h.StreamInvocation}:{target:e,arguments:t,invocationId:o.toString(),type:h.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:h.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:h.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:h.Completion}:{invocationId:e,result:n,type:h.Completion}}_createCloseMessage(){return{type:h.Close}}_trySendPingMessage(){return g(this,null,function*(){try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}})}};var Ae=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ae}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var D=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var ne=class extends k{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return g(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);let n=yield this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):n})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[D.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[D.Authorization]&&delete e.headers[D.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var b=(function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r})(b||{}),w=(function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r})(w||{});var oe=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new oe,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){if(d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(i.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[n,o]=E(),s=_({[n]:o},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let a=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${a}.`);let l=yield this._httpClient.get(a,c);l.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new C(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return g(this,null,function*(){try{for(;this._running;)try{let n=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${n}.`);let o=yield this._httpClient.get(n,t);o.statusCode===204?(this._logger.log(i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new C(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(i.Trace,`(LongPolling transport) data received. ${x(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof P?this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(i.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return g(this,null,function*(){return this._running?V(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return g(this,null,function*(){this._logger.log(i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,n]=E();e[t]=n;let o={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},s;try{yield this._httpClient.delete(this._url,o)}catch(c){s=c}s?s instanceof C&&(s.statusCode===404?this._logger.log(i.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(i.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(i.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(i.Trace,e),this.onclose(this._closeError)}}};var re=class{constructor(e,t,n,o){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){return d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let s=!1;if(t!==w.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(p.isBrowser||p.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(e),l={};l.Cookie=a;let[u,f]=E();l[u]=f,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{c.onmessage=a=>{if(this.onreceive)try{this._logger.log(i.Trace,`(SSE transport) data received. ${x(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(l){this._close(l);return}},c.onerror=a=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(i.Information,`SSE connected to ${this._url}`),this._eventSource=c,s=!0,n()}}catch(a){o(a);return}})})}send(e){return g(this,null,function*(){return this._eventSource?V(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var se=class{constructor(e,t,n,o,s,c){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=s,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return g(this,null,function*(){d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=yield this._accessTokenFactory()),new Promise((o,s)=>{e=e.replace(/^http/,"ws");let c,a=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,T]=E();u[f]=T,n&&(u[D.Authorization]=`Bearer ${n}`),a&&(u[D.Cookie]=a),c=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=u=>{this._logger.log(i.Information,`WebSocket connected to ${e}.`),this._webSocket=c,l=!0,o()},c.onerror=u=>{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="There was an error with the transport",this._logger.log(i.Information,`(WebSockets transport) ${f}.`)},c.onmessage=u=>{if(this._logger.log(i.Trace,`(WebSockets transport) data received. ${x(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},c.onclose=u=>{if(l)this._close(u);else{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(i.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var ke=100,ie=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,d.isRequired(e,"url"),this._logger=Ce(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,o=null;if(p.isNode&&typeof N<"u"){let s=typeof __webpack_require__=="function"?__non_webpack_require__:N;n=s("ws"),o=s("eventsource")}!p.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:p.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!p.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:p.isNode&&!t.EventSource&&typeof o<"u"&&(t.EventSource=o),this._httpClient=new ne(t.httpClient||new Y(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return g(this,null,function*(){if(e=e||w.Binary,d.isIn(e,w,"transferFormat"),this._logger.log(i.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(i.Error,t),yield this._stopPromise,Promise.reject(new S(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(i.Error,t),Promise.reject(new S(t))}this._connectionStarted=!0})}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new he(this.transport)),this._sendQueue.send(e))}stop(e){return g(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return g(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return g(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===b.WebSockets)this.transport=this._constructTransport(b.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new S("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){let s=n.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<ke);if(o===ke&&n.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,n,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(i.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}})}_getNegotiationResponse(e){return g(this,null,function*(){let t={},[n,o]=E();t[n]=o;let s=this._resolveNegotiateUrl(e);this._logger.log(i.Debug,`Sending negotiation request: ${s}.`);try{let c=yield this._httpClient.post(s,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let a=JSON.parse(c.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new M("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(c){let a="Failed to complete negotiation with the server: "+c;return c instanceof C&&c.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(i.Error,a),Promise.reject(new M(a))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,n,o){return g(this,null,function*(){let s=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(s,o),this.connectionId=n.connectionId;return}let c=[],a=n.availableTransports||[],l=n;for(let u of a){let f=this._resolveTransportOrError(u,t,o,l?.useStatefulReconnect===!0);if(f instanceof Error)c.push(`${u.transport} failed:`),c.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(T){return Promise.reject(T)}s=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(s,o),this.connectionId=l.connectionId;return}catch(T){if(this._logger.log(i.Error,`Failed to start the transport '${u.transport}': ${T}`),l=void 0,c.push(new q(`${u.transport} failed: ${T}`,b[u.transport])),this._connectionState!=="Connecting"){let ue="Failed to select transport before stop() was called.";return this._logger.log(i.Debug,ue),Promise.reject(new S(ue))}}}}return c.length>0?Promise.reject(new z(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case b.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new se(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case b.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new re(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case b.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=n=>g(this,null,function*(){let o=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch{o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}):this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){let s=b[e.transport];if(s==null)return this._logger.log(i.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(He(t,s))if(e.transferFormats.map(a=>w[a]).indexOf(n)>=0){if(s===b.WebSockets&&!this._options.WebSocket||s===b.ServerSentEvents&&!this._options.EventSource)return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it is not supported in your environment.'`),new O(`'${b[s]}' is not supported in your environment.`,s);this._logger.log(i.Debug,`Selecting transport '${b[s]}'.`);try{return this.features.reconnect=s===b.WebSockets?o:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it does not support the requested transfer format '${w[n]}'.`),new Error(`'${b[s]}' does not support ${w[n]}.`);else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it was disabled by the client.`),new F(`'${b[s]}' is disabled by the client.`,s)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(i.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(i.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(i.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(i.Error,`Connection disconnected with error '${e}'.`):this._logger.log(i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(i.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!p.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(i.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";let n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}};function He(r,e){return!r||(e&r)!==0}var he=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new H,this._transportResult=new H,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new H),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return g(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new H;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}})}static _concatBuffers(e){let t=e.map(s=>s.byteLength).reduce((s,c)=>s+c),n=new Uint8Array(t),o=0;for(let s of e)n.set(new Uint8Array(s),o),o+=s.byteLength;return n.buffer}},H=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Me="json",ce=class{constructor(){this.name=Me,this.version=2,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=I.instance);let n=y.parse(e),o=[];for(let s of n){let c=JSON.parse(s);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case h.Invocation:this._isInvocationMessage(c);break;case h.StreamItem:this._isStreamItemMessage(c);break;case h.Completion:this._isCompletionMessage(c);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(c);break;case h.Sequence:this._isSequenceMessage(c);break;default:t.log(i.Information,"Unknown message type '"+c.type+"' ignored.");continue}o.push(c)}return o}writeMessage(e){return y.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var Le={trace:i.Trace,debug:i.Debug,info:i.Information,information:i.Information,warn:i.Warning,warning:i.Warning,error:i.Error,critical:i.Critical,none:i.None};function We(r){let e=Le[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var j=class{configureLogging(e){if(d.isRequired(e,"logging"),je(e))this.logger=e;else if(typeof e=="string"){let t=We(e);this.logger=new R(t)}else this.logger=new R(e);return this}withUrl(e,t){return d.isRequired(e,"url"),d.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=$(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return d.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}withServerTimeout(e){return d.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return d.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){let e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let t=new ie(this.url,e);return te.create(t,this.logger||I.instance,this.protocol||new ce,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function je(r){return r.log!==void 0}var Ie=(()=>{class r{constructor(){this._onShowToast=new ge,this.onShowToast$=this._onShowToast.asObservable()}showToast(t){t.sticky=!0,this._onShowToast.next(t)}static{this.\u0275fac=function(n){return new(n||r)}}static{this.\u0275prov=U({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var Xn=(()=>{class r{constructor(t,n,o){this.decodeTokenService=t,this.toastr=n,this.httpService=o,this.scanChannelToastr=ae(Ie),this.authService=ae(we),this.channels=this.authService.getChannels(),this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let t=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new fe(t||[])}setNotification(t){let o=[...this._notifications.value,t];this.saveNotificationTotal(o),this._notifications.next(o)}saveNotificationTotal(t=[]){localStorage.setItem("Notifications",JSON.stringify(t))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(t){return this.httpService.post("/api/notification/GetByID",{ID:t})}getNotificationV2Detail(t){return this.httpService.post(me.GetJobScanDetail,{ID:t})}buildConnection(){this.hubConnection=new j().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(i.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}subscribeToJobGroup(t){try{this.hubConnection.send("SubscribeGroup",t)}catch(n){console.error("Error subscribing to job group:",n)}}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(t=>console.log("Error while starting connection: "+t))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",t=>{this.handleNotification(t)})}handleNotification(t){let n;try{n=JSON.parse(t)}catch{console.warn("Invalid JSON notification:",t);return}this.setNotification(n),n.ChannelID?be.IsNotEmpty(n.Issue)?this.handlingErrorNotification(n):this.handlingSuccessNotification(n):n.ID==this.parseToken.PID&&(n.StatusCode!=200?this.toastr.error(n.Message,n.Title,{enableHtml:!0}):this.toastr.success(n.Message,n.Title,{enableHtml:!0}))}handlingSuccessNotification(t){let n=this.channels.find(s=>s.ID===t.ChannelID),o=t.Duration?Math.floor(t.Duration/1e3):0;this.scanChannelToastr.showToast({text:"Scan Job Succeded",detail:`The Job takes <strong>${o}s</strong> to complete.`,severity:"success",data:{channelName:n.Name,channelTypeId:n.TypeID}})}handlingErrorNotification(t){let n=this.channels.find(s=>s.ID===t.ChannelID),o=t.Issue||"Unknown Error";this.scanChannelToastr.showToast({text:"Scan Job Failed",detail:o,severity:"error",data:{channelName:n.Name,channelTypeId:n.TypeID}})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}static{this.\u0275fac=function(n){return new(n||r)(B(de),B(pe),B(_e))}}static{this.\u0275prov=U({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{Ie as a,Xn as b};
1
+ import{a as be}from"./chunk-BGFEVOPZ.js";import{b as de,h as we}from"./chunk-4UTSQBQJ.js";import{a as me}from"./chunk-HZRIS4FA.js";import{b as pe,e as _e}from"./chunk-UC7FUQNJ.js";import{ba as U,d as ge,e as fe,fa as B,ga as ae}from"./chunk-YU6N3IVV.js";import{a as _,b as $,c as N,h as g}from"./chunk-QWWW7GFA.js";var C=class extends Error{constructor(e,t){let n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}},P=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},S=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},O=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}},F=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}},q=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}},M=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},z=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}};var A=class{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}},k=class{get(e,t){return this.send($(_({},t),{method:"GET",url:e}))}post(e,t){return this.send($(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send($(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var i=(function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r})(i||{});var I=class{constructor(){}log(e,t){}};I.instance=new I;var Se="10.0.0";var d=class{static isRequired(e,t){if(e==null)throw new Error(`The '${t}' argument is required.`)}static isNotEmpty(e,t){if(!e||e.match(/^\s*$/))throw new Error(`The '${t}' argument should not be empty.`)}static isIn(e,t,n){if(!(e in t))throw new Error(`Unknown ${n} value: ${e}.`)}},p=class r{static get isBrowser(){return!r.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!r.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!r.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function x(r,e){let t="";return v(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${Ee(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function Ee(r){let e=new Uint8Array(r),t="";return e.forEach(n=>{let o=n<16?"0":"";t+=`0x${o}${n.toString(16)} `}),t.substring(0,t.length-1)}function v(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function V(r,e,t,n,o,s){return g(this,null,function*(){let c={},[a,l]=E();c[a]=l,r.log(i.Trace,`(${e} transport) sending data. ${x(o,s.logMessageContent)}.`);let u=v(o)?"arraybuffer":"text",f=yield t.post(n,{content:o,headers:_(_({},c),s.headers),responseType:u,timeout:s.timeout,withCredentials:s.withCredentials});r.log(i.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function Ce(r){return r===void 0?new R(i.Information):r===null?I.instance:r.log!==void 0?r:new R(r)}var J=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},R=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let n=`[${new Date().toISOString()}] ${i[e]}: ${t}`;switch(e){case i.Critical:case i.Error:this.out.error(n);break;case i.Warning:this.out.warn(n);break;case i.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function E(){let r="X-SignalR-User-Agent";return p.isNode&&(r="User-Agent"),[r,Te(Se,Pe(),Re(),xe())]}function Te(r,e,t,n){let o="Microsoft SignalR/",s=r.split(".");return o+=`${s[0]}.${s[1]}`,o+=` (${r}; `,e&&e!==""?o+=`${e}; `:o+="Unknown OS; ",o+=`${t}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function Pe(){if(p.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function xe(){if(p.isNode)return process.versions.node}function Re(){return p.isNode?"NodeJS":"Browser"}function K(r){return r.stack?r.stack:r.message?r.message:`${r}`}function ye(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var X=class extends k{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._jar=new(t("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=t("node-fetch"):this._fetchType=fetch,this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(ye());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:N;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return g(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new S;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,n;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),n=new S});let o=null;if(e.timeout){let l=e.timeout;o=setTimeout(()=>{t.abort(),this._logger.log(i.Warning,"Timeout from HTTP request."),n=new P},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},v(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:_({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(l){throw n||(this._logger.log(i.Warning,`Error from HTTP request. ${l}.`),l)}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!s.ok){let l=yield ve(s,"text");throw new C(l||s.statusText,s.status)}let a=yield ve(s,e.responseType);return new A(s.status,s.statusText,a)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(n,o)=>t=o.join("; ")),t}};function ve(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var G=class extends k{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?new Promise((t,n)=>{let o=new XMLHttpRequest;o.open(e.method,e.url,!0),o.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,o.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(v(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let s=e.headers;s&&Object.keys(s).forEach(c=>{o.setRequestHeader(c,s[c])}),e.responseType&&(o.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{o.abort(),n(new S)}),e.timeout&&(o.timeout=e.timeout),o.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),o.status>=200&&o.status<300?t(new A(o.status,o.statusText,o.response||o.responseText)):n(new C(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(i.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new C(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(i.Warning,"Timeout from HTTP request."),n(new P)},o.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var Y=class extends k{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new X(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new G(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new S):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}};var y=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};y.RecordSeparatorCode=30;y.RecordSeparator=String.fromCharCode(y.RecordSeparatorCode);var Q=class{writeHandshakeRequest(e){return y.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(v(e)){let a=new Uint8Array(e),l=a.indexOf(y.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),n=a.byteLength>u?a.slice(u).buffer:null}else{let a=e,l=a.indexOf(y.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=a.substring(0,u),n=a.length>u?a.substring(u):null}let o=y.parse(t),s=JSON.parse(o[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[n,s]}};var h=(function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r[r.Ack=8]="Ack",r[r.Sequence=9]="Sequence",r})(h||{});var Z=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new J(this,e)}};var ee=class{constructor(e,t,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=t,this._bufferSize=n}_send(e){return g(this,null,function*(){let t=this._protocol.writeMessage(e),n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let o=()=>{},s=()=>{};v(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((c,a)=>{o=c,s=a})),this._messages.push(new le(t,this._totalMessageCount,o,s))}try{this._reconnectInProgress||(yield this._connection.send(t))}catch{this._disconnected()}yield n})}_ack(e){let t=-1;for(let n=0;n<this._messages.length;n++){let o=this._messages[n];if(o._id<=e.sequenceId)t=n,v(o._message)?this._bufferedByteCount-=o._message.byteLength:this._bufferedByteCount-=o._message.length,o._resolver();else if(this._bufferedByteCount<this._bufferSize)o._resolver();else break}t!==-1&&(this._messages=this._messages.slice(t+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==h.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;let t=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,t<=this._latestReceivedSequenceId?(t===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=t,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}_resend(){return g(this,null,function*(){let e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;yield this._connection.send(this._protocol.writeMessage({type:h.Sequence,sequenceId:e}));let t=this._messages;for(let n of t)yield this._connection.send(n._message);this._reconnectInProgress=!1})}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(let t of this._messages)t._rejector(e)}_isInvocationMessage(e){switch(e.type){case h.Invocation:case h.StreamItem:case h.Completion:case h.StreamInvocation:case h.CancelInvocation:return!0;case h.Close:case h.Sequence:case h.Ping:case h.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(()=>g(this,null,function*(){try{this._reconnectInProgress||(yield this._connection.send(this._protocol.writeMessage({type:h.Ack,sequenceId:this._latestReceivedSequenceId})))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0}),1e3))}},le=class{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}};var De=30*1e3,$e=15*1e3,Ne=1e5,m=(function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r})(m||{}),te=class r{static create(e,t,n,o,s,c,a){return new r(e,t,n,o,s,c,a)}constructor(e,t,n,o,s,c,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},d.isRequired(e,"connection"),d.isRequired(t,"logger"),d.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=s??De,this.keepAliveIntervalInMilliseconds=c??$e,this._statefulReconnectBufferSize=a??Ne,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new Q,this.connection.onreceive=l=>this._processIncomingData(l),this.connection.onclose=l=>this._connectionClosed(l),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=m.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:h.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==m.Disconnected&&this._connectionState!==m.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}_startWithStateTransitions(){return g(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(i.Debug,"Starting HubConnection.");try{yield this._startInternal(),p.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(i.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(i.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return g(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,n)=>{this._handshakeResolver=t,this._handshakeRejecter=n});yield this.connection.start(this._protocol.transferFormat);try{let t=this._protocol.version;this.connection.features.reconnect||(t=1);let n={protocol:this._protocol.name,version:t};if(this._logger.log(i.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new ee(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return g(this,null,function*(){let e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){if(this._connectionState===m.Disconnected)return this._logger.log(i.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===m.Disconnecting)return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let t=this._connectionState;return this._connectionState=m.Disconnecting,this._logger.log(i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(t===m.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new S("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}_sendCloseMessage(){return g(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[n,o]=this._replaceStreamingParams(t),s=this._createStreamInvocation(e,t,o),c,a=new Z;return a.cancelCallback=()=>{let l=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],c.then(()=>this._sendWithProtocol(l))},this._callbacks[s.invocationId]=(l,u)=>{if(u){a.error(u);return}else l&&(l.type===h.Completion?l.error?a.error(new Error(l.error)):a.complete():a.next(l.item))},c=this._sendWithProtocol(s).catch(l=>{a.error(l),delete this._callbacks[s.invocationId]}),this._launchStreams(n,c),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[n,o]=this._replaceStreamingParams(t),s=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,s),s}invoke(e,...t){let[n,o]=this._replaceStreamingParams(t),s=this._createInvocation(e,t,!1,o);return new Promise((a,l)=>{this._callbacks[s.invocationId]=(f,T)=>{if(T){l(T);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):a(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(s).catch(f=>{l(f),delete this._callbacks[s.invocationId]});this._launchStreams(n,u)})}on(e,t){!e||!t||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(t)===-1&&this._methods[e].push(t))}off(e,t){if(!e)return;e=e.toLowerCase();let n=this._methods[e];if(n)if(t){let o=n.indexOf(t);o!==-1&&(n.splice(o,1),n.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){let t=this._protocol.parseMessages(e,this._logger);for(let n of t)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case h.Invocation:this._invokeClientMethod(n).catch(o=>{this._logger.log(i.Error,`Invoke client method threw error: ${K(o)}`)});break;case h.StreamItem:case h.Completion:{let o=this._callbacks[n.invocationId];if(o){n.type===h.Completion&&delete this._callbacks[n.invocationId];try{o(n)}catch(s){this._logger.log(i.Error,`Stream callback threw error: ${K(s)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(i.Information,"Close message received from server.");let o=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(o):this._stopPromise=this._stopInternal(o);break}case h.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case h.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(i.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(o){let s="Error parsing handshake response: "+o;this._logger.log(i.Error,s);let c=new Error(s);throw this._handshakeRejecter(c),c}if(t.error){let o="Server returned handshake error: "+t.error;this._logger.log(i.Error,o);let s=new Error(o);throw this._handshakeRejecter(s),s}else this._logger.log(i.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let e=this._nextKeepAlive-new Date().getTime();if(e<0){this._connectionState===m.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(e<0&&(e=0),this._pingServerHandle=setTimeout(()=>g(this,null,function*(){this._connectionState===m.Connected&&(yield this._trySendPingMessage())}),e))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return g(this,null,function*(){let t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(i.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let o=n.slice(),s=!!e.invocationId,c,a,l;for(let u of o)try{let f=c;c=yield u.apply(this,e.arguments),s&&c&&f&&(this._logger.log(i.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(f){a=f,this._logger.log(i.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):s?(a?l=this._createCompletionMessage(e.invocationId,`${a}`,null):c!==void 0?l=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),l=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(l)):c&&this._logger.log(i.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(i.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new S("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===m.Disconnecting?this._completeClose(e):this._connectionState===m.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===m.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=m.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),p.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(i.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return g(this,null,function*(){let t=Date.now(),n=0,o=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(n,0,o);if(s===null){this._logger.log(i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(i.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(i.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(i.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(i.Information,`Reconnect attempt number ${n+1} will start in ${s} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(i.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(i.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n++,o=c instanceof Error?c:new Error(c.toString()),s=this._getNextRetryDelay(n,Date.now()-t,o)}}this._logger.log(i.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:n})}catch(o){return this._logger.log(i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${o}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(n=>{let o=t[n];try{o(null,e)}catch(s){this._logger.log(i.Error,`Stream 'error' callback called with '${e}' threw error: ${K(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,n,o){if(n)return o.length!==0?{target:e,arguments:t,streamIds:o,type:h.Invocation}:{target:e,arguments:t,type:h.Invocation};{let s=this._invocationId;return this._invocationId++,o.length!==0?{target:e,arguments:t,invocationId:s.toString(),streamIds:o,type:h.Invocation}:{target:e,arguments:t,invocationId:s.toString(),type:h.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let n in e)e[n].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:o=>{let s;o instanceof Error?s=o.message:o&&o.toString?s=o.toString():s="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,s)))},next:o=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,o)))}})}}_replaceStreamingParams(e){let t=[],n=[];for(let o=0;o<e.length;o++){let s=e[o];if(this._isObservable(s)){let c=this._invocationId;this._invocationId++,t[c]=s,n.push(c.toString()),e.splice(o,1)}}return[t,n]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,n){let o=this._invocationId;return this._invocationId++,n.length!==0?{target:e,arguments:t,invocationId:o.toString(),streamIds:n,type:h.StreamInvocation}:{target:e,arguments:t,invocationId:o.toString(),type:h.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:h.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:h.StreamItem}}_createCompletionMessage(e,t,n){return t?{error:t,invocationId:e,type:h.Completion}:{invocationId:e,result:n,type:h.Completion}}_createCloseMessage(){return{type:h.Close}}_trySendPingMessage(){return g(this,null,function*(){try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}})}};var Ae=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ae}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var D=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var ne=class extends k{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return g(this,null,function*(){let t=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(t=!1,this._accessToken=yield this._accessTokenFactory()),this._setAuthorizationHeader(e);let n=yield this._innerClient.send(e);return t&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):n})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[D.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[D.Authorization]&&delete e.headers[D.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var b=(function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r})(b||{}),w=(function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r})(w||{});var oe=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new oe,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){if(d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(i.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[n,o]=E(),s=_({[n]:o},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let a=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${a}.`);let l=yield this._httpClient.get(a,c);l.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new C(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return g(this,null,function*(){try{for(;this._running;)try{let n=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${n}.`);let o=yield this._httpClient.get(n,t);o.statusCode===204?(this._logger.log(i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new C(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(i.Trace,`(LongPolling transport) data received. ${x(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof P?this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(i.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return g(this,null,function*(){return this._running?V(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return g(this,null,function*(){this._logger.log(i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,n]=E();e[t]=n;let o={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},s;try{yield this._httpClient.delete(this._url,o)}catch(c){s=c}s?s instanceof C&&(s.statusCode===404?this._logger.log(i.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(i.Trace,`(LongPolling transport) Error sending a DELETE request: ${s}`)):this._logger.log(i.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(i.Trace,e),this.onclose(this._closeError)}}};var re=class{constructor(e,t,n,o){this._httpClient=e,this._accessToken=t,this._logger=n,this._options=o,this.onreceive=null,this.onclose=null}connect(e,t){return g(this,null,function*(){return d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let s=!1;if(t!==w.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(p.isBrowser||p.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(e),l={};l.Cookie=a;let[u,f]=E();l[u]=f,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{c.onmessage=a=>{if(this.onreceive)try{this._logger.log(i.Trace,`(SSE transport) data received. ${x(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(l){this._close(l);return}},c.onerror=a=>{s?this._close():o(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(i.Information,`SSE connected to ${this._url}`),this._eventSource=c,s=!0,n()}}catch(a){o(a);return}})})}send(e){return g(this,null,function*(){return this._eventSource?V(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var se=class{constructor(e,t,n,o,s,c){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=s,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return g(this,null,function*(){d.isRequired(e,"url"),d.isRequired(t,"transferFormat"),d.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=yield this._accessTokenFactory()),new Promise((o,s)=>{e=e.replace(/^http/,"ws");let c,a=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,T]=E();u[f]=T,n&&(u[D.Authorization]=`Bearer ${n}`),a&&(u[D.Cookie]=a),c=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=u=>{this._logger.log(i.Information,`WebSocket connected to ${e}.`),this._webSocket=c,l=!0,o()},c.onerror=u=>{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="There was an error with the transport",this._logger.log(i.Information,`(WebSockets transport) ${f}.`)},c.onmessage=u=>{if(this._logger.log(i.Trace,`(WebSockets transport) data received. ${x(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},c.onclose=u=>{if(l)this._close(u);else{let f=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?f=u.error:f="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(i.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var ke=100,ie=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,d.isRequired(e,"url"),this._logger=Ce(t.logger),this.baseUrl=this._resolveUrl(e),t=t||{},t.logMessageContent=t.logMessageContent===void 0?!1:t.logMessageContent,typeof t.withCredentials=="boolean"||t.withCredentials===void 0)t.withCredentials=t.withCredentials===void 0?!0:t.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");t.timeout=t.timeout===void 0?100*1e3:t.timeout;let n=null,o=null;if(p.isNode&&typeof N<"u"){let s=typeof __webpack_require__=="function"?__non_webpack_require__:N;n=s("ws"),o=s("eventsource")}!p.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:p.isNode&&!t.WebSocket&&n&&(t.WebSocket=n),!p.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:p.isNode&&!t.EventSource&&typeof o<"u"&&(t.EventSource=o),this._httpClient=new ne(t.httpClient||new Y(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return g(this,null,function*(){if(e=e||w.Binary,d.isIn(e,w,"transferFormat"),this._logger.log(i.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(i.Error,t),yield this._stopPromise,Promise.reject(new S(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(i.Error,t),Promise.reject(new S(t))}this._connectionStarted=!0})}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new he(this.transport)),this._sendQueue.send(e))}stop(e){return g(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return g(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return g(this,null,function*(){let t=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===b.WebSockets)this.transport=this._constructTransport(b.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,o=0;do{if(n=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new S("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(t=n.url),n.accessToken){let s=n.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<ke);if(o===ke&&n.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,n,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(i.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}})}_getNegotiationResponse(e){return g(this,null,function*(){let t={},[n,o]=E();t[n]=o;let s=this._resolveNegotiateUrl(e);this._logger.log(i.Debug,`Sending negotiation request: ${s}.`);try{let c=yield this._httpClient.post(s,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let a=JSON.parse(c.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new M("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(c){let a="Failed to complete negotiation with the server: "+c;return c instanceof C&&c.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(i.Error,a),Promise.reject(new M(a))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,n,o){return g(this,null,function*(){let s=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(s,o),this.connectionId=n.connectionId;return}let c=[],a=n.availableTransports||[],l=n;for(let u of a){let f=this._resolveTransportOrError(u,t,o,l?.useStatefulReconnect===!0);if(f instanceof Error)c.push(`${u.transport} failed:`),c.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(T){return Promise.reject(T)}s=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(s,o),this.connectionId=l.connectionId;return}catch(T){if(this._logger.log(i.Error,`Failed to start the transport '${u.transport}': ${T}`),l=void 0,c.push(new q(`${u.transport} failed: ${T}`,b[u.transport])),this._connectionState!=="Connecting"){let ue="Failed to select transport before stop() was called.";return this._logger.log(i.Debug,ue),Promise.reject(new S(ue))}}}}return c.length>0?Promise.reject(new z(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case b.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new se(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case b.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new re(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case b.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=n=>g(this,null,function*(){let o=!1;if(this.features.reconnect)try{this.features.disconnected(),yield this.transport.connect(e,t),yield this.features.resend()}catch{o=!0}else{this._stopConnection(n);return}o&&this._stopConnection(n)}):this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(e,t)}_resolveTransportOrError(e,t,n,o){let s=b[e.transport];if(s==null)return this._logger.log(i.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(He(t,s))if(e.transferFormats.map(a=>w[a]).indexOf(n)>=0){if(s===b.WebSockets&&!this._options.WebSocket||s===b.ServerSentEvents&&!this._options.EventSource)return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it is not supported in your environment.'`),new O(`'${b[s]}' is not supported in your environment.`,s);this._logger.log(i.Debug,`Selecting transport '${b[s]}'.`);try{return this.features.reconnect=s===b.WebSockets?o:void 0,this._constructTransport(s)}catch(a){return a}}else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it does not support the requested transfer format '${w[n]}'.`),new Error(`'${b[s]}' does not support ${w[n]}.`);else return this._logger.log(i.Debug,`Skipping transport '${b[s]}' because it was disabled by the client.`),new F(`'${b[s]}' is disabled by the client.`,s)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(i.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(i.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(i.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(i.Error,`Connection disconnected with error '${e}'.`):this._logger.log(i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(i.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!p.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(i.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=new URL(e);t.pathname.endsWith("/")?t.pathname+="negotiate":t.pathname+="/negotiate";let n=new URLSearchParams(t.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),t.search=n.toString(),t.toString()}};function He(r,e){return!r||(e&r)!==0}var he=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new H,this._transportResult=new H,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new H),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}_sendLoop(){return g(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new H;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(n){e.reject(n)}}})}static _concatBuffers(e){let t=e.map(s=>s.byteLength).reduce((s,c)=>s+c),n=new Uint8Array(t),o=0;for(let s of e)n.set(new Uint8Array(s),o),o+=s.byteLength;return n.buffer}},H=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Me="json",ce=class{constructor(){this.name=Me,this.version=2,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=I.instance);let n=y.parse(e),o=[];for(let s of n){let c=JSON.parse(s);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case h.Invocation:this._isInvocationMessage(c);break;case h.StreamItem:this._isStreamItemMessage(c);break;case h.Completion:this._isCompletionMessage(c);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(c);break;case h.Sequence:this._isSequenceMessage(c);break;default:t.log(i.Information,"Unknown message type '"+c.type+"' ignored.");continue}o.push(c)}return o}writeMessage(e){return y.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var Le={trace:i.Trace,debug:i.Debug,info:i.Information,information:i.Information,warn:i.Warning,warning:i.Warning,error:i.Error,critical:i.Critical,none:i.None};function We(r){let e=Le[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var j=class{configureLogging(e){if(d.isRequired(e,"logging"),je(e))this.logger=e;else if(typeof e=="string"){let t=We(e);this.logger=new R(t)}else this.logger=new R(e);return this}withUrl(e,t){return d.isRequired(e,"url"),d.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=$(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return d.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}withServerTimeout(e){return d.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return d.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e?.bufferSize,this}build(){let e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let t=new ie(this.url,e);return te.create(t,this.logger||I.instance,this.protocol||new ce,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function je(r){return r.log!==void 0}var Ie=(()=>{class r{constructor(){this._onShowToast=new ge,this.onShowToast$=this._onShowToast.asObservable()}showToast(t){t.sticky=!0,this._onShowToast.next(t)}static{this.\u0275fac=function(n){return new(n||r)}}static{this.\u0275prov=U({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var Xn=(()=>{class r{constructor(t,n,o){this.decodeTokenService=t,this.toastr=n,this.httpService=o,this.scanChannelToastr=ae(Ie),this.authService=ae(we),this.channels=this.authService.getChannels(),this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let t=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new fe(t||[])}setNotification(t){let o=[...this._notifications.value,t];this.saveNotificationTotal(o),this._notifications.next(o)}saveNotificationTotal(t=[]){localStorage.setItem("Notifications",JSON.stringify(t))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(t){return this.httpService.post("/api/notification/GetByID",{ID:t})}getNotificationV2Detail(t){return this.httpService.post(me.GetJobScanDetail,{ID:t})}buildConnection(){this.hubConnection=new j().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(i.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}subscribeToJobGroup(t){try{this.hubConnection.send("SubscribeGroup",t)}catch(n){console.error("Error subscribing to job group:",n)}}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(t=>console.log("Error while starting connection: "+t))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",t=>{this.handleNotification(t)})}handleNotification(t){let n;try{n=JSON.parse(t)}catch{console.warn("Invalid JSON notification:",t);return}this.setNotification(n),n.ChannelID?be.IsNotEmpty(n.Issue)?this.handlingErrorNotification(n):this.handlingSuccessNotification(n):n.ID==this.parseToken.PID&&(n.StatusCode!=200?this.toastr.error(n.Message,n.Title,{enableHtml:!0}):this.toastr.success(n.Message,n.Title,{enableHtml:!0}))}handlingSuccessNotification(t){let n=this.channels.find(s=>s.ID===t.ChannelID),o=t.Duration?Math.floor(t.Duration/1e3):0;this.scanChannelToastr.showToast({text:"Scan Job Succeded",detail:`The Job takes <strong>${o}s</strong> to complete.`,severity:"success",data:{channelName:n.Name,channelTypeId:n.TypeID}})}handlingErrorNotification(t){let n=this.channels.find(s=>s.ID===t.ChannelID),o=t.Issue||"Unknown Error";this.scanChannelToastr.showToast({text:"Scan Job Failed",detail:o,severity:"error",data:{channelName:n.Name,channelTypeId:n.TypeID}})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}static{this.\u0275fac=function(n){return new(n||r)(B(de),B(pe),B(_e))}}static{this.\u0275prov=U({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{Ie as a,Xn as b};
@@ -1 +1 @@
1
- import{a as re}from"./chunk-2ZILXTWC.js";import{a as E}from"./chunk-5XFVP3GT.js";import{a as ne}from"./chunk-RIX56SWS.js";import{a as ie}from"./chunk-4IMPHM2L.js";import{a as te}from"./chunk-IQ2QCUYQ.js";import"./chunk-OQVWI5RR.js";import"./chunk-6EZURWCE.js";import"./chunk-IUP257JK.js";import"./chunk-G7EFF2OH.js";import{a as ee}from"./chunk-WFQ6MTNV.js";import{a as $}from"./chunk-FBZA4TL3.js";import"./chunk-GRBY6A25.js";import"./chunk-XJ647P3Z.js";import"./chunk-NVFPEIBK.js";import"./chunk-2WNLMFBJ.js";import"./chunk-HHIYV6SY.js";import"./chunk-KOBEFS2S.js";import"./chunk-3E64KI3Y.js";import"./chunk-6IBSQ4O6.js";import"./chunk-BGFEVOPZ.js";import"./chunk-Q3STYUEA.js";import"./chunk-DIWXDN75.js";import"./chunk-MZNVUECO.js";import{b as Z}from"./chunk-ZOV7OQE6.js";import"./chunk-HDNULDU2.js";import"./chunk-VSXPCIHS.js";import{a as Y}from"./chunk-6GXJ4SD6.js";import"./chunk-FI7KHIPS.js";import"./chunk-2767EOG5.js";import"./chunk-6UFKTBFI.js";import"./chunk-EYRMOG2V.js";import"./chunk-H5YNAWK2.js";import"./chunk-F7U7V7F4.js";import"./chunk-QUDI2RQN.js";import"./chunk-Y3LPTD5V.js";import"./chunk-G6DXF6MT.js";import"./chunk-XU7ZLD5O.js";import"./chunk-GMRSDMCF.js";import"./chunk-TFHB3OE5.js";import"./chunk-XE7FN7WV.js";import"./chunk-FQLH72J4.js";import"./chunk-HD5RAZOS.js";import"./chunk-KOOWEFV6.js";import"./chunk-J7VARP7L.js";import"./chunk-U5LGPDSJ.js";import{b as X}from"./chunk-NCHJULNE.js";import"./chunk-KZWEUXCA.js";import"./chunk-EHFG3EIP.js";import"./chunk-O2GBNE2A.js";import"./chunk-QXRG5XYP.js";import"./chunk-HZRIS4FA.js";import"./chunk-Q5PH4VIQ.js";import"./chunk-NNVT5X6O.js";import{c as G,h as J,m as K,o as Q,z as U}from"./chunk-NZPISKQV.js";import"./chunk-UC7FUQNJ.js";import"./chunk-67URAZUP.js";import"./chunk-MXZNUKSS.js";import{B as j,D as q,z as R}from"./chunk-OOGQ5PSL.js";import"./chunk-ASFPLYOZ.js";import{$b as B,Gc as l,Hc as h,Kc as c,Lc as u,Mc as C,Nc as I,Oc as k,Pc as A,R as V,Tc as z,Vb as W,Xb as F,Yb as N,_b as L,ac as g,bc as e,cc as t,cd as w,dc as _,dd as x,eb as a,ed as H,ga as P,kc as b,na as p,oa as s,pc as v,rc as y,wb as D,za as O}from"./chunk-YU6N3IVV.js";import{a as M,b as T}from"./chunk-QWWW7GFA.js";function ae(d,S){if(d&1&&(e(0,"tr")(1,"td"),l(2),t(),e(3,"td"),_(4,"order-link",26),t(),e(5,"td"),l(6),t(),e(7,"td"),l(8),w(9,"number"),t(),e(10,"td"),l(11),w(12,"date"),t(),e(13,"td"),_(14,"app-channel-logo",27),t()()),d&2){let r=S.$implicit;a(2),h(r.Outlet),a(2),g("order",r),a(2),h(r.Customer),a(2),h(x(9,6,r.Amount)),a(3),h(H(12,8,r.Created,"dd MMM yyyy HH:mm")),a(3),g("typeId",r==null?null:r.TypeID)}}function le(d,S){if(d&1){let r=b();e(0,"div",15)(1,"table",17)(2,"thead",18)(3,"tr",19)(4,"th",20),l(5,"Outlet"),t(),e(6,"th",21),l(7,"Order number"),t(),e(8,"th"),l(9,"Customer"),t(),e(10,"th",22),l(11,"Amount"),t(),e(12,"th",23),l(13," Created On "),t(),e(14,"th",24),l(15,"Channel"),t()()(),e(16,"tbody"),L(17,ae,15,11,"tr",null,N),t()(),e(19,"app-custom-paginator",25),v("next",function(){p(r);let i=y();return s(i.initCancelledOrders())})("previous",function(){p(r);let i=y();return s(i.initCancelledOrders())}),t()()}if(d&2){let r=y(),o=A(0);a(17),B(o),a(2),g("filter",r.filter())("totaldata",o==null?null:o.length)("paginationTotal",o==null?null:o.length)("hasClicked",!0)("nextButtonAlwaysVisible",!0)}}function oe(d,S){d&1&&(e(0,"div",16),_(1,"app-empty-state"),t())}var Te=(()=>{class d{constructor(){this.orderService=P(E),this.filter=O({PageNumber:1,PageSize:20,ListChannelID:[],From:null,To:null,Number:null})}ngOnInit(){this.orderService.getOrderDefaultValue().subscribe({next:r=>{this.initFromDate(r)},error:r=>{console.error("Error fetching default date:",r),this.initFromDate(null)}})}initFromDate(r){this.filter.update(o=>T(M({},o),{From:r})),this.initCancelledOrders()}initCancelledOrders(){this.cancelledOrders$=this.orderService.getCancelledOrders(this.filter()).pipe(V(1))}static{this.\u0275fac=function(o){return new(o||d)}}static{this.\u0275cmp=D({type:d,selectors:[["app-cancelled"]],features:[z([E])],decls:34,vars:11,consts:[["headerTitle","Cancelled","searchBoxPlaceHolder","Order Number...",3,"onSubmit","textChange","text"],["href","https://ods.dealpos.app","target","_blank","matTooltip","Monitor your Order & Fulfillment in real-time from TV!",1,"btn","btn-outline-secondary","shadow","rounded","ms-2"],[1,"fa-regular","fa-tv","me-3"],[1,"fw-bold","mb-2"],[3,"ngModelChange","multiple","ngModel"],[1,"mt-5"],[1,"mb-4"],["name","From",3,"dateChange","date"],["name","To",3,"dateChange","date"],[1,"fw-bold"],["type","number","name","PageNumber",1,"w-100","mt-2","form-control",3,"ngModelChange","ngModel"],["type","number","name","PageSize",1,"w-100","mt-2","form-control",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[2,"width","120px"],[2,"width","220px"],[2,"width","100px"],["mat-sort-header","created",2,"width","130px"],[2,"width","130px"],[3,"next","previous","filter","totaldata","paginationTotal","hasClicked","nextButtonAlwaysVisible"],[3,"order"],[3,"typeId"]],template:function(o,i){if(o&1){let m=b();I(0),w(1,"async"),e(2,"mainpanel",0),v("onSubmit",function(){return p(m),s(i.initCancelledOrders())}),C("textChange",function(n){return p(m),u(i.filter().Number,n)||(i.filter().Number=n),s(n)}),e(3,"actions")(4,"a",1),_(5,"i",2),e(6,"span"),l(7,"Order Fulfillment Display"),t()()(),e(8,"filters")(9,"div")(10,"label",3),l(11,"Channel"),t(),e(12,"app-channel-options-v2",4),C("ngModelChange",function(n){return p(m),u(i.filter().ListChannelID,n)||(i.filter().ListChannelID=n),s(n)}),t()(),e(13,"div",5)(14,"label",3),l(15,"From/To"),t(),e(16,"div",6)(17,"datepicker",7),C("dateChange",function(n){return p(m),u(i.filter().From,n)||(i.filter().From=n),s(n)}),t()(),e(18,"div")(19,"datepicker",8),C("dateChange",function(n){return p(m),u(i.filter().To,n)||(i.filter().To=n),s(n)}),t()()(),e(20,"div",5)(21,"label",9),l(22,"Page Number"),t(),e(23,"input",10),C("ngModelChange",function(n){return p(m),u(i.filter().PageNumber,n)||(i.filter().PageNumber=n),s(n)}),t()(),e(24,"div",5)(25,"label",9),l(26,"Page Size"),t(),e(27,"input",11),C("ngModelChange",function(n){return p(m),u(i.filter().PageSize,n)||(i.filter().PageSize=n),s(n)}),t()()(),e(28,"content")(29,"div",12)(30,"div",13)(31,"div",14),W(32,le,20,5,"div",15)(33,oe,2,0,"div",16),t()()()()()}if(o&2){let m=k(x(1,8,i.cancelledOrders$));a(2),c("text",i.filter().Number),a(10),g("multiple",!0),c("ngModel",i.filter().ListChannelID),a(5),c("date",i.filter().From),a(2),c("date",i.filter().To),a(4),c("ngModel",i.filter().PageNumber),a(4),c("ngModel",i.filter().PageSize),a(5),F((m==null?null:m.length)>0?32:33)}},dependencies:[Z,$,ee,U,G,Q,J,K,ne,Y,X,re,ie,te,R,j,q],encapsulation:2,changeDetection:0})}}return d})();export{Te as CancelledComponent};
1
+ import{a as re}from"./chunk-ZY3P6SKZ.js";import{a as E}from"./chunk-5XFVP3GT.js";import{a as ne}from"./chunk-RIX56SWS.js";import{a as ie}from"./chunk-4IMPHM2L.js";import{a as te}from"./chunk-QKYLEIXT.js";import"./chunk-OQVWI5RR.js";import"./chunk-6EZURWCE.js";import"./chunk-IUP257JK.js";import"./chunk-G7EFF2OH.js";import{a as ee}from"./chunk-WFQ6MTNV.js";import{a as $}from"./chunk-FBZA4TL3.js";import"./chunk-GRBY6A25.js";import"./chunk-XJ647P3Z.js";import"./chunk-NVFPEIBK.js";import"./chunk-2WNLMFBJ.js";import"./chunk-HHIYV6SY.js";import"./chunk-KOBEFS2S.js";import"./chunk-3E64KI3Y.js";import"./chunk-6IBSQ4O6.js";import"./chunk-BGFEVOPZ.js";import"./chunk-Q3STYUEA.js";import"./chunk-DIWXDN75.js";import"./chunk-MZNVUECO.js";import{b as Z}from"./chunk-ZOV7OQE6.js";import"./chunk-HDNULDU2.js";import"./chunk-VSXPCIHS.js";import{a as Y}from"./chunk-6GXJ4SD6.js";import"./chunk-FI7KHIPS.js";import"./chunk-2767EOG5.js";import"./chunk-6UFKTBFI.js";import"./chunk-EYRMOG2V.js";import"./chunk-H5YNAWK2.js";import"./chunk-F7U7V7F4.js";import"./chunk-QUDI2RQN.js";import"./chunk-Y3LPTD5V.js";import"./chunk-G6DXF6MT.js";import"./chunk-XU7ZLD5O.js";import"./chunk-GMRSDMCF.js";import"./chunk-TFHB3OE5.js";import"./chunk-XE7FN7WV.js";import"./chunk-FQLH72J4.js";import"./chunk-HD5RAZOS.js";import"./chunk-KOOWEFV6.js";import"./chunk-J7VARP7L.js";import"./chunk-U5LGPDSJ.js";import{b as X}from"./chunk-NCHJULNE.js";import"./chunk-KZWEUXCA.js";import"./chunk-4UTSQBQJ.js";import"./chunk-O2GBNE2A.js";import"./chunk-QXRG5XYP.js";import"./chunk-HZRIS4FA.js";import"./chunk-Q5PH4VIQ.js";import"./chunk-NNVT5X6O.js";import{c as G,h as J,m as K,o as Q,z as U}from"./chunk-NZPISKQV.js";import"./chunk-UC7FUQNJ.js";import"./chunk-67URAZUP.js";import"./chunk-MXZNUKSS.js";import{B as j,D as q,z as R}from"./chunk-OOGQ5PSL.js";import"./chunk-ASFPLYOZ.js";import{$b as B,Gc as l,Hc as h,Kc as c,Lc as u,Mc as C,Nc as I,Oc as k,Pc as A,R as V,Tc as z,Vb as W,Xb as F,Yb as N,_b as L,ac as g,bc as e,cc as t,cd as w,dc as _,dd as x,eb as a,ed as H,ga as P,kc as b,na as p,oa as s,pc as v,rc as y,wb as D,za as O}from"./chunk-YU6N3IVV.js";import{a as M,b as T}from"./chunk-QWWW7GFA.js";function ae(d,S){if(d&1&&(e(0,"tr")(1,"td"),l(2),t(),e(3,"td"),_(4,"order-link",26),t(),e(5,"td"),l(6),t(),e(7,"td"),l(8),w(9,"number"),t(),e(10,"td"),l(11),w(12,"date"),t(),e(13,"td"),_(14,"app-channel-logo",27),t()()),d&2){let r=S.$implicit;a(2),h(r.Outlet),a(2),g("order",r),a(2),h(r.Customer),a(2),h(x(9,6,r.Amount)),a(3),h(H(12,8,r.Created,"dd MMM yyyy HH:mm")),a(3),g("typeId",r==null?null:r.TypeID)}}function le(d,S){if(d&1){let r=b();e(0,"div",15)(1,"table",17)(2,"thead",18)(3,"tr",19)(4,"th",20),l(5,"Outlet"),t(),e(6,"th",21),l(7,"Order number"),t(),e(8,"th"),l(9,"Customer"),t(),e(10,"th",22),l(11,"Amount"),t(),e(12,"th",23),l(13," Created On "),t(),e(14,"th",24),l(15,"Channel"),t()()(),e(16,"tbody"),L(17,ae,15,11,"tr",null,N),t()(),e(19,"app-custom-paginator",25),v("next",function(){p(r);let i=y();return s(i.initCancelledOrders())})("previous",function(){p(r);let i=y();return s(i.initCancelledOrders())}),t()()}if(d&2){let r=y(),o=A(0);a(17),B(o),a(2),g("filter",r.filter())("totaldata",o==null?null:o.length)("paginationTotal",o==null?null:o.length)("hasClicked",!0)("nextButtonAlwaysVisible",!0)}}function oe(d,S){d&1&&(e(0,"div",16),_(1,"app-empty-state"),t())}var Te=(()=>{class d{constructor(){this.orderService=P(E),this.filter=O({PageNumber:1,PageSize:20,ListChannelID:[],From:null,To:null,Number:null})}ngOnInit(){this.orderService.getOrderDefaultValue().subscribe({next:r=>{this.initFromDate(r)},error:r=>{console.error("Error fetching default date:",r),this.initFromDate(null)}})}initFromDate(r){this.filter.update(o=>T(M({},o),{From:r})),this.initCancelledOrders()}initCancelledOrders(){this.cancelledOrders$=this.orderService.getCancelledOrders(this.filter()).pipe(V(1))}static{this.\u0275fac=function(o){return new(o||d)}}static{this.\u0275cmp=D({type:d,selectors:[["app-cancelled"]],features:[z([E])],decls:34,vars:11,consts:[["headerTitle","Cancelled","searchBoxPlaceHolder","Order Number...",3,"onSubmit","textChange","text"],["href","https://ods.dealpos.app","target","_blank","matTooltip","Monitor your Order & Fulfillment in real-time from TV!",1,"btn","btn-outline-secondary","shadow","rounded","ms-2"],[1,"fa-regular","fa-tv","me-3"],[1,"fw-bold","mb-2"],[3,"ngModelChange","multiple","ngModel"],[1,"mt-5"],[1,"mb-4"],["name","From",3,"dateChange","date"],["name","To",3,"dateChange","date"],[1,"fw-bold"],["type","number","name","PageNumber",1,"w-100","mt-2","form-control",3,"ngModelChange","ngModel"],["type","number","name","PageSize",1,"w-100","mt-2","form-control",3,"ngModelChange","ngModel"],[1,"container-fluid","mt-3"],[1,"row"],[1,"col-md-12"],[1,"table-responsive"],[1,"d-flex","flex-column","justify-content-center","align-items-center",2,"margin-top","26vh"],[1,"table","table-hover"],[1,"sticky-top-thead"],[1,"table-light"],[2,"width","120px"],[2,"width","220px"],[2,"width","100px"],["mat-sort-header","created",2,"width","130px"],[2,"width","130px"],[3,"next","previous","filter","totaldata","paginationTotal","hasClicked","nextButtonAlwaysVisible"],[3,"order"],[3,"typeId"]],template:function(o,i){if(o&1){let m=b();I(0),w(1,"async"),e(2,"mainpanel",0),v("onSubmit",function(){return p(m),s(i.initCancelledOrders())}),C("textChange",function(n){return p(m),u(i.filter().Number,n)||(i.filter().Number=n),s(n)}),e(3,"actions")(4,"a",1),_(5,"i",2),e(6,"span"),l(7,"Order Fulfillment Display"),t()()(),e(8,"filters")(9,"div")(10,"label",3),l(11,"Channel"),t(),e(12,"app-channel-options-v2",4),C("ngModelChange",function(n){return p(m),u(i.filter().ListChannelID,n)||(i.filter().ListChannelID=n),s(n)}),t()(),e(13,"div",5)(14,"label",3),l(15,"From/To"),t(),e(16,"div",6)(17,"datepicker",7),C("dateChange",function(n){return p(m),u(i.filter().From,n)||(i.filter().From=n),s(n)}),t()(),e(18,"div")(19,"datepicker",8),C("dateChange",function(n){return p(m),u(i.filter().To,n)||(i.filter().To=n),s(n)}),t()()(),e(20,"div",5)(21,"label",9),l(22,"Page Number"),t(),e(23,"input",10),C("ngModelChange",function(n){return p(m),u(i.filter().PageNumber,n)||(i.filter().PageNumber=n),s(n)}),t()(),e(24,"div",5)(25,"label",9),l(26,"Page Size"),t(),e(27,"input",11),C("ngModelChange",function(n){return p(m),u(i.filter().PageSize,n)||(i.filter().PageSize=n),s(n)}),t()()(),e(28,"content")(29,"div",12)(30,"div",13)(31,"div",14),W(32,le,20,5,"div",15)(33,oe,2,0,"div",16),t()()()()()}if(o&2){let m=k(x(1,8,i.cancelledOrders$));a(2),c("text",i.filter().Number),a(10),g("multiple",!0),c("ngModel",i.filter().ListChannelID),a(5),c("date",i.filter().From),a(2),c("date",i.filter().To),a(4),c("ngModel",i.filter().PageNumber),a(4),c("ngModel",i.filter().PageSize),a(5),F((m==null?null:m.length)>0?32:33)}},dependencies:[Z,$,ee,U,G,Q,J,K,ne,Y,X,re,ie,te,R,j,q],encapsulation:2,changeDetection:0})}}return d})();export{Te as CancelledComponent};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-XZKAZQ76.js";import{a as m}from"./chunk-YGUGXTPW.js";import"./chunk-6GXJ4SD6.js";import"./chunk-NCHJULNE.js";import"./chunk-KZWEUXCA.js";import"./chunk-EHFG3EIP.js";import"./chunk-O2GBNE2A.js";import"./chunk-QXRG5XYP.js";import"./chunk-HZRIS4FA.js";import"./chunk-Q5PH4VIQ.js";import"./chunk-NNVT5X6O.js";import"./chunk-UC7FUQNJ.js";import{c as p}from"./chunk-67URAZUP.js";import"./chunk-MXZNUKSS.js";import"./chunk-OOGQ5PSL.js";import"./chunk-ASFPLYOZ.js";import{ac as a,bc as c,cc as l,dc as o,eb as r,wb as i}from"./chunk-YU6N3IVV.js";import"./chunk-QWWW7GFA.js";var d=(()=>{class t{constructor(){this.reportTabs=[{Title:"1.Create Order",Url:"/menu/sync-log/sync-order"},{Title:"2.Convert Order To Invoice",Url:"/menu/sync-log/convert-to-invoice"},{Title:"3.Create Invoice",Url:"/menu/sync-log/invoice"},{Title:"4.Create Outbound Logistic",Url:"/menu/sync-log/delivery"},{Title:"5.Add Payment",Url:"/menu/sync-log/payment"},{Title:"6.Void Invoice",Url:"/menu/sync-log/void-invoice"},{Title:"All",Url:"/menu/sync-log/all"}]}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=i({type:t,selectors:[["app-order"]],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(n,s){n&1&&(c(0,"nav",0)(1,"div",1)(2,"div"),o(3,"nav-tab",2),l()()(),o(4,"router-outlet")),n&2&&(r(3),a("Tabs",s.reportTabs))},dependencies:[m,p],styles:[".dropdown[_ngcontent-%COMP%] .dropdown-menu.report.show[_ngcontent-%COMP%]{top:100%!important;transform:none!important;z-index:10000;cursor:pointer;right:-50%}"]})}}return t})();var T=[{path:"",component:d,children:[{path:"",redirectTo:"all",pathMatch:"full"},{path:"sync-order",loadComponent(){return import("./chunk-VRGH76J2.js").then(t=>t.SalesOrderComponent)},canActivate:[e],data:{title:"Sync Order"}},{path:"convert-to-invoice",loadComponent(){return import("./chunk-OO3CU22V.js").then(t=>t.ConvertInvoiceComponent)},canActivate:[e],data:{title:"Sync Convert to Invoice"}},{path:"invoice",loadComponent(){return import("./chunk-EEYIFY5R.js").then(t=>t.InvoiceComponent)},canActivate:[e],data:{title:"Sync Invoice"}},{path:"delivery",loadComponent(){return import("./chunk-ITXC7XVV.js").then(t=>t.DeliveryComponent)},canActivate:[e],data:{title:"Sync Delivery"}},{path:"payment",loadComponent(){return import("./chunk-TWZGEC6C.js").then(t=>t.PaymentComponent)},canActivate:[e],data:{title:"Sync Payment"}},{path:"void-invoice",loadComponent(){return import("./chunk-MVODFPIM.js").then(t=>t.VoidInvoiceComponent)},canActivate:[e],data:{title:"Sync void invoice"}},{path:"all",loadComponent(){return import("./chunk-FGHJUGQM.js").then(t=>t.AllComponent)},canActivate:[e],data:{title:"All Report"}}]}];export{T as routes};
1
+ import{a as e}from"./chunk-6TAES6UG.js";import{a as m}from"./chunk-YGUGXTPW.js";import"./chunk-6GXJ4SD6.js";import"./chunk-NCHJULNE.js";import"./chunk-KZWEUXCA.js";import"./chunk-4UTSQBQJ.js";import"./chunk-O2GBNE2A.js";import"./chunk-QXRG5XYP.js";import"./chunk-HZRIS4FA.js";import"./chunk-Q5PH4VIQ.js";import"./chunk-NNVT5X6O.js";import"./chunk-UC7FUQNJ.js";import{c as p}from"./chunk-67URAZUP.js";import"./chunk-MXZNUKSS.js";import"./chunk-OOGQ5PSL.js";import"./chunk-ASFPLYOZ.js";import{ac as a,bc as c,cc as l,dc as o,eb as r,wb as i}from"./chunk-YU6N3IVV.js";import"./chunk-QWWW7GFA.js";var d=(()=>{class t{constructor(){this.reportTabs=[{Title:"1.Create Order",Url:"/menu/sync-log/sync-order"},{Title:"2.Convert Order To Invoice",Url:"/menu/sync-log/convert-to-invoice"},{Title:"3.Create Invoice",Url:"/menu/sync-log/invoice"},{Title:"4.Create Outbound Logistic",Url:"/menu/sync-log/delivery"},{Title:"5.Add Payment",Url:"/menu/sync-log/payment"},{Title:"6.Void Invoice",Url:"/menu/sync-log/void-invoice"},{Title:"All",Url:"/menu/sync-log/all"}]}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275cmp=i({type:t,selectors:[["app-order"]],decls:5,vars:1,consts:[[1,"navbar","page-nav","navbar-default","py-0","navbar-expand-lg"],[1,"container-fluid"],[3,"Tabs"]],template:function(n,s){n&1&&(c(0,"nav",0)(1,"div",1)(2,"div"),o(3,"nav-tab",2),l()()(),o(4,"router-outlet")),n&2&&(r(3),a("Tabs",s.reportTabs))},dependencies:[m,p],styles:[".dropdown[_ngcontent-%COMP%] .dropdown-menu.report.show[_ngcontent-%COMP%]{top:100%!important;transform:none!important;z-index:10000;cursor:pointer;right:-50%}"]})}}return t})();var T=[{path:"",component:d,children:[{path:"",redirectTo:"all",pathMatch:"full"},{path:"sync-order",loadComponent(){return import("./chunk-VRGH76J2.js").then(t=>t.SalesOrderComponent)},canActivate:[e],data:{title:"Sync Order"}},{path:"convert-to-invoice",loadComponent(){return import("./chunk-OO3CU22V.js").then(t=>t.ConvertInvoiceComponent)},canActivate:[e],data:{title:"Sync Convert to Invoice"}},{path:"invoice",loadComponent(){return import("./chunk-EEYIFY5R.js").then(t=>t.InvoiceComponent)},canActivate:[e],data:{title:"Sync Invoice"}},{path:"delivery",loadComponent(){return import("./chunk-ITXC7XVV.js").then(t=>t.DeliveryComponent)},canActivate:[e],data:{title:"Sync Delivery"}},{path:"payment",loadComponent(){return import("./chunk-TWZGEC6C.js").then(t=>t.PaymentComponent)},canActivate:[e],data:{title:"Sync Payment"}},{path:"void-invoice",loadComponent(){return import("./chunk-MVODFPIM.js").then(t=>t.VoidInvoiceComponent)},canActivate:[e],data:{title:"Sync void invoice"}},{path:"all",loadComponent(){return import("./chunk-FGHJUGQM.js").then(t=>t.AllComponent)},canActivate:[e],data:{title:"All Report"}}]}];export{T as routes};
@@ -1,4 +1,4 @@
1
- import{a as pn}from"./chunk-O2GBNE2A.js";import{a as be}from"./chunk-QXRG5XYP.js";import{a as fn}from"./chunk-Q5PH4VIQ.js";import{b as tt,c as Se}from"./chunk-NNVT5X6O.js";import{e as dn}from"./chunk-UC7FUQNJ.js";import{d as hn}from"./chunk-67URAZUP.js";import{H as un}from"./chunk-OOGQ5PSL.js";import{I as Ze,L as tn,Ma as an,U as nn,X as et,ba as O,c as _,ca as rn,ea as ve,fa as P,ga as Te,j as E,k as le,ma as sn,q as ue,r as en,sa as on,vd as ln,xb as cn}from"./chunk-YU6N3IVV.js";import{a as y,b as F,d as we,g as K,h as l}from"./chunk-QWWW7GFA.js";var mn={production:!0,version:"6.36.2",firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:omni&sort=sortOrder:asc"};var gn=(()=>{class n{constructor(){}getParseToken(){let t=JSON.parse(window.localStorage.getItem("user"));return this.ParseToken(t.Token.access_token)}GetRoles(){let r=this.getParseToken()["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];return typeof r=="string"&&(r=[r]),r||[]}ParseToken(t){try{let i=t.split(".")[0].replace("-","+").replace("_","/"),s=JSON.parse(window.atob(i)),a=t.split(".")[1].replace("-","+").replace("_","/"),c=JSON.parse(window.atob(a));return c.header=s,c}catch{return!1}}static{this.\u0275fac=function(r){return new(r||n)}}static{this.\u0275prov=O({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var In=()=>{};var En=function(n){let e=[],t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},Kr=function(n){let e=[],t=0,r=0;for(;t<n.length;){let i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=n[t++],o=n[t++],a=n[t++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{let s=n[t++],o=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},yn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<n.length;i+=3){let s=n[i],o=i+1<n.length,a=o?n[i+1]:0,c=i+2<n.length,u=c?n[i+2]:0,h=s>>2,d=(s&3)<<4|a>>4,f=(a&15)<<2|u>>6,p=u&63;c||(p=64,o||(f=64)),r.push(t[h],t[d],t[f],t[p])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(En(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Kr(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){let s=t[n.charAt(i++)],a=i<n.length?t[n.charAt(i)]:0;++i;let u=i<n.length?t[n.charAt(i)]:64;++i;let d=i<n.length?t[n.charAt(i)]:64;if(++i,s==null||a==null||u==null||d==null)throw new rt;let f=s<<2|a>>4;if(r.push(f),u!==64){let p=a<<4&240|u>>2;if(r.push(p),d!==64){let g=u<<6&192|d;r.push(g)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},rt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},Jr=function(n){let e=En(n);return yn.encodeByteArray(e,!0)},st=function(n){return Jr(n).replace(/\./g,"")},Ce=function(n){try{return yn.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Yr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Xr=()=>Yr().__FIREBASE_DEFAULTS__,Qr=()=>{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Zr=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=n&&Ce(n[1]);return e&&JSON.parse(e)},ot=()=>{try{return In()||Xr()||Qr()||Zr()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},wn=n=>ot()?.emulatorHosts?.[n];var at=()=>ot()?.config,ct=n=>ot()?.[`_${n}`];var de=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}};function A(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(A())}function Tn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function bn(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Sn(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function An(){let n=A();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Cn(){try{return typeof indexedDB=="object"}catch{return!1}}function Pn(){return new Promise((n,e)=>{try{let t=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(t){e(t)}})}var ei="FirebaseError",k=class n extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=ei,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,V.prototype.create)}},V=class{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){let r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?ti(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new k(i,a,r)}};function ti(n,e){try{let t=0,r="";for(;t<n.length;){let i=n.indexOf("{$",t);if(i===-1){r+=n.substring(t);break}let s=n.indexOf("}",i+2);if(s===-1){r+=n.substring(t);break}let o=n.substring(i+2,s),a=e[o];r+=n.substring(t,i)+(a!=null?String(a):`<${o}?>`),t=s+1}return r}catch{return n}}function kn(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function z(n,e){if(n===e)return!0;let t=Object.keys(n),r=Object.keys(e);for(let i of t){if(!r.includes(i))return!1;let s=n[i],o=e[i];if(_n(s)&&_n(o)){if(!z(s,o))return!1}else if(s!==o)return!1}for(let i of r)if(!t.includes(i))return!1;return!0}function _n(n){return n!==null&&typeof n=="object"}function ee(n){let e=[];for(let[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Rn(n,e){let t=new it(n,e);return t.subscribe.bind(t)}var it=class{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");ni(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=nt),i.error===void 0&&(i.error=nt),i.complete===void 0&&(i.complete=nt);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function ni(n,e){if(typeof n!="object"||n===null)return!1;for(let t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function nt(){}var Qo=14400*1e3;function J(n){return n&&n._delegate?n._delegate:n}function Pe(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}function Dn(n){return l(this,null,function*(){return(yield fetch(n,{credentials:"include"})).ok})}var N=class{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var Y="[DEFAULT]";var lt=class{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let r=new de;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(ii(e))try{this.getOrInitializeService({instanceIdentifier:Y})}catch{}for(let[t,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(t);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Y){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}delete(){return l(this,null,function*(){let e=Array.from(this.instances.values());yield Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])})}isComponentSet(){return this.component!=null}isInitialized(e=Y){return this.instances.has(e)}getOptions(e=Y){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,t){let r=this.normalizeInstanceIdentifier(t),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){let r=this.onInitCallbacks.get(t);if(r)for(let i of r)try{i(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:ri(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Y){return this.component?this.component.multipleInstances?e:Y:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function ri(n){return n===Y?void 0:n}function ii(n){return n.instantiationMode==="EAGER"}var ke=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new lt(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}};var si=[],I=(function(n){return n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT",n})(I||{}),oi={debug:I.DEBUG,verbose:I.VERBOSE,info:I.INFO,warn:I.WARN,error:I.ERROR,silent:I.SILENT},ai=I.INFO,ci={[I.DEBUG]:"log",[I.VERBOSE]:"log",[I.INFO]:"info",[I.WARN]:"warn",[I.ERROR]:"error"},li=(n,e,...t)=>{if(e<n.logLevel)return;let r=new Date().toISOString(),i=ci[e];if(i)console[i](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},te=class{constructor(e){this.name=e,this._logLevel=ai,this._logHandler=li,this._userLogHandler=null,si.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in I))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?oi[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,I.DEBUG,...e),this._logHandler(this,I.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,I.VERBOSE,...e),this._logHandler(this,I.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,I.INFO,...e),this._logHandler(this,I.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,I.WARN,...e),this._logHandler(this,I.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,I.ERROR,...e),this._logHandler(this,I.ERROR,...e)}};var ui=(n,e)=>e.some(t=>n instanceof t),On,Nn;function di(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function hi(){return Nn||(Nn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Ln=new WeakMap,dt=new WeakMap,Mn=new WeakMap,ut=new WeakMap,ft=new WeakMap;function fi(n){let e=new Promise((t,r)=>{let i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(L(n.result)),i()},o=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ln.set(t,n)}).catch(()=>{}),ft.set(e,n),e}function pi(n){if(dt.has(n))return;let e=new Promise((t,r)=>{let i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),i()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});dt.set(n,e)}var ht={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return dt.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Mn.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return L(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function xn(n){ht=n(ht)}function mi(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let r=n.call(Re(this),e,...t);return Mn.set(r,e.sort?e.sort():[e]),L(r)}:hi().includes(n)?function(...e){return n.apply(Re(this),e),L(Ln.get(this))}:function(...e){return L(n.apply(Re(this),e))}}function gi(n){return typeof n=="function"?mi(n):(n instanceof IDBTransaction&&pi(n),ui(n,di())?new Proxy(n,ht):n)}function L(n){if(n instanceof IDBRequest)return fi(n);if(ut.has(n))return ut.get(n);let e=gi(n);return e!==n&&(ut.set(n,e),ft.set(e,n)),e}var Re=n=>ft.get(n);function Fn(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){let o=indexedDB.open(n,e),a=L(o);return r&&o.addEventListener("upgradeneeded",c=>{r(L(o.result),c.oldVersion,c.newVersion,L(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}var Ii=["get","getKey","getAll","getAllKeys","count"],_i=["put","add","delete","clear"],pt=new Map;function Un(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(pt.get(e))return pt.get(e);let t=e.replace(/FromIndex$/,""),r=e!==t,i=_i.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Ii.includes(t)))return;let s=function(o,...a){return l(this,null,function*(){let c=this.transaction(o,i?"readwrite":"readonly"),u=c.store;return r&&(u=u.index(a.shift())),(yield Promise.all([u[t](...a),i&&c.done]))[0]})};return pt.set(e,s),s}xn(n=>F(y({},n),{get:(e,t,r)=>Un(e,t)||n.get(e,t,r),has:(e,t)=>!!Un(e,t)||n.has(e,t)}));var gt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Ei(t)){let r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}};function Ei(n){return n.getComponent()?.type==="VERSION"}var It="@firebase/app",Vn="0.16.0";var H=new te("@firebase/app"),yi="@firebase/app-compat",wi="@firebase/analytics-compat",vi="@firebase/analytics",Ti="@firebase/app-check-compat",bi="@firebase/app-check",Si="@firebase/auth",Ai="@firebase/auth-compat",Ci="@firebase/database",Pi="@firebase/data-connect",ki="@firebase/database-compat",Ri="@firebase/functions",Di="@firebase/functions-compat",Oi="@firebase/installations",Ni="@firebase/installations-compat",Li="@firebase/messaging",Mi="@firebase/messaging-compat",xi="@firebase/performance",Ui="@firebase/performance-compat",Fi="@firebase/remote-config",Vi="@firebase/remote-config-compat",Bi="@firebase/storage",Hi="@firebase/storage-compat",ji="@firebase/firestore",Wi="@firebase/ai",$i="@firebase/firestore-compat",zi="firebase",qi="12.17.0";var _t="[DEFAULT]",Gi={[It]:"fire-core",[yi]:"fire-core-compat",[vi]:"fire-analytics",[wi]:"fire-analytics-compat",[bi]:"fire-app-check",[Ti]:"fire-app-check-compat",[Si]:"fire-auth",[Ai]:"fire-auth-compat",[Ci]:"fire-rtdb",[Pi]:"fire-data-connect",[ki]:"fire-rtdb-compat",[Ri]:"fire-fn",[Di]:"fire-fn-compat",[Oi]:"fire-iid",[Ni]:"fire-iid-compat",[Li]:"fire-fcm",[Mi]:"fire-fcm-compat",[xi]:"fire-perf",[Ui]:"fire-perf-compat",[Fi]:"fire-rc",[Vi]:"fire-rc-compat",[Bi]:"fire-gcs",[Hi]:"fire-gcs-compat",[ji]:"fire-fst",[$i]:"fire-fst-compat",[Wi]:"fire-vertex","fire-js":"fire-js",[zi]:"fire-js-all"};var De=new Map,Ki=new Map,Et=new Map;function Bn(n,e){try{n.container.addComponent(e)}catch(t){H.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function re(n){let e=n.name;if(Et.has(e))return H.debug(`There were multiple attempts to register component ${e}.`),!1;Et.set(e,n);for(let t of De.values())Bn(t,n);for(let t of Ki.values())Bn(t,n);return!0}function Tt(n,e){let t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function R(n){return n==null?!1:n.settings!==void 0}var Ji={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},B=new V("app","Firebase",Ji);var yt=class{constructor(e,t,r){this._isDeleted=!1,this._options=y({},e),this._config=y({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new N("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw B.create("app-deleted",{appName:this._name})}};var ie=qi;function Yi(n,e={}){let t=n;typeof e!="object"&&(e={name:e});let r=y({name:_t,automaticDataCollectionEnabled:!0},e),i=r.name;if(typeof i!="string"||!i)throw B.create("bad-app-name",{appName:String(i)});if(t||(t=at()),!t)throw B.create("no-options");let s=De.get(i);if(s)if(z(t,s.options)){if(z(r,s.config))return s;throw B.create("duplicate-app",{appName:i,mismatchedParam:"config",oldValue:JSON.stringify(s.config),newValue:JSON.stringify(r)})}else throw B.create("duplicate-app",{appName:i,mismatchedParam:"options",oldValue:JSON.stringify(s.options),newValue:JSON.stringify(t)});let o=new ke(i);for(let c of Et.values())o.addComponent(c);let a=new yt(t,r,o);return De.set(i,a),a}function $n(n=_t){let e=De.get(n);if(!e&&n===_t&&at())return Yi();if(!e)throw B.create("no-app",{appName:n});return e}function ne(n,e,t){let r=Gi[n]??n;t&&(r+=`-${t}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),H.warn(o.join(" "));return}re(new N(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}var Xi="firebase-heartbeat-database",Qi=1,he="firebase-heartbeat-store",mt=null;function zn(){return mt||(mt=Fn(Xi,Qi,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(he)}catch(t){console.warn(t)}}}}).catch(n=>{throw B.create("idb-open",{originalErrorMessage:n.message})})),mt}function Zi(n){return l(this,null,function*(){try{let t=(yield zn()).transaction(he),r=yield t.objectStore(he).get(qn(n));return yield t.done,r}catch(e){if(e instanceof k)H.warn(e.message);else{let t=B.create("idb-get",{originalErrorMessage:e?.message});H.warn(t.message)}}})}function Hn(n,e){return l(this,null,function*(){try{let r=(yield zn()).transaction(he,"readwrite");yield r.objectStore(he).put(e,qn(n)),yield r.done}catch(t){if(t instanceof k)H.warn(t.message);else{let r=B.create("idb-set",{originalErrorMessage:t?.message});H.warn(r.message)}}})}function qn(n){return`${n.name}!${n.options.appId}`}var es=1024,ts=30,wt=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new vt(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}triggerHeartbeat(){return l(this,null,function*(){try{let t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=jn();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=yield this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats.length>ts){let i=rs(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){H.warn(e)}})}getHeartbeatsHeader(){return l(this,null,function*(){try{if(this._heartbeatsCache===null&&(yield this._heartbeatsCachePromise),this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=jn(),{heartbeatsToSend:t,unsentEntries:r}=ns(this._heartbeatsCache.heartbeats),i=st(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,yield this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return H.warn(e),""}})}};function jn(){return new Date().toISOString().substring(0,10)}function ns(n,e=es){let t=[],r=n.slice();for(let i of n){let s=t.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Wn(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),Wn(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}var vt=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}runIndexedDBEnvironmentCheck(){return l(this,null,function*(){return Cn()?Pn().then(()=>!0).catch(()=>!1):!1})}read(){return l(this,null,function*(){if(yield this._canUseIndexedDBPromise){let t=yield Zi(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}})}overwrite(e){return l(this,null,function*(){if(yield this._canUseIndexedDBPromise){let r=yield this.read();return Hn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return})}add(e){return l(this,null,function*(){if(yield this._canUseIndexedDBPromise){let r=yield this.read();return Hn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return})}};function Wn(n){return st(JSON.stringify({version:2,heartbeats:n})).length}function rs(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}function is(n){re(new N("platform-logger",e=>new gt(e),"PRIVATE")),re(new N("heartbeat",e=>new wt(e),"PRIVATE")),ne(It,Vn,n),ne(It,Vn,"esm2020"),ne("fire-js","")}is("");var T=(function(n){return n.readonly="readonly",n.readwrite="readwrite",n})(T||{}),Gn=new ve(null),Kn=new ve("Indexed DB"),ss=new ve("Server Indexed DB");function os(n,e){return n.objectStoreNames.contains(e)}function C(n,e,t){if(!n){t("You need to use the openDatabase function to create a database before you query it!");return}os(n,e)||t(`objectStore does not exists: ${e}`)}function b(n,e){let t=n.transaction(e.storeName,e.dbMode);return t.onerror=e.error,t.onabort=e.abort,t}function S(n,e,t,r){return{storeName:e,dbMode:n,error:i=>{t(i)},abort:i=>{t(i)}}}var St=[];function w(n,e,t,r){return new Promise((i,s)=>{n||s("IndexedDB not available");let o=n.open(e,t),a;o.onsuccess=()=>{a=o.result,St.push(a),i(a)},o.onerror=()=>{s(`IndexedDB error: ${o.error}`)},typeof r=="function"&&(o.onupgradeneeded=c=>{r(c,a)})})}function bt(n,e,t,r,i){return l(this,null,function*(){return new Promise((s,o)=>{if(!n)return;let a=n.open(e,t);a.onupgradeneeded=c=>l(null,null,function*(){let u=c.target.result,h=r.map(f=>l(null,null,function*(){if(!u.objectStoreNames.contains(f.store)){let p=u.createObjectStore(f.store,f.storeConfig);for(let g of f.storeSchema)p.createIndex(g.name,g.keypath,g.options)}}));yield Promise.all(h);let d=i&&i();if(d){let f=Object.keys(d).map(p=>parseInt(p,10)).filter(p=>p>c.oldVersion).sort((p,g)=>p-g);for(let p of f)d[p](u,a.transaction)}u.close(),s()}),a.onsuccess=c=>{c.target.result.close(),s()},a.onerror=c=>{o(c)}})})}function as(n,e,t){if(!n||!e||!t)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new _(r=>{try{let i=e+1,s=indexedDB.open(n,i);s.onupgradeneeded=o=>{let a=o.target.result;a.deleteObjectStore(t),a.close(),console.log("onupgradeneeded"),r.next(),r.complete()},s.onerror=o=>r.error(o)}catch(i){r.error(i)}})}function cs(n){return new Promise((e,t)=>{if(!n){t(new Error("No database to close"));return}try{n.close(),e()}catch(r){t(`Error closing database: ${r}`)}})}function v(){return function(n,e,t){let r=t.value;return t.value=function(...i){let s=r.apply(this,i);return s instanceof _?s.pipe(tn(()=>l(this,null,function*(){let o=St.map(a=>l(this,null,function*(){yield cs(a)}));yield Promise.all(o),St.length=0}))):s},t}}var Ct=(()=>{class n{constructor(t,r){this.dbConfigs=t,this.indexedDB=r,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((i,s,o)=>this.instanciateConfig(i,o.length===1))}instanciateConfig(t,r){return l(this,null,function*(){if(!t.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if((t.isDefault??!1)&&this.defaultDatabaseName)throw new Error("NgxIndexedDB: Only one database can be set as default");((t.isDefault??!1)&&!this.defaultDatabaseName||r)&&(this.defaultDatabaseName=t.name,this.selectedDb=t.name),yield bt(this.indexedDB,t.name,t.version,t.objectStoresMeta,t.migrationFactory),w(this.indexedDB,t.name).then(i=>{i.version!==t.version&&(ln()&&(console.warn(`
1
+ import{a as pn}from"./chunk-O2GBNE2A.js";import{a as be}from"./chunk-QXRG5XYP.js";import{a as fn}from"./chunk-Q5PH4VIQ.js";import{b as tt,c as Se}from"./chunk-NNVT5X6O.js";import{e as dn}from"./chunk-UC7FUQNJ.js";import{d as hn}from"./chunk-67URAZUP.js";import{H as un}from"./chunk-OOGQ5PSL.js";import{I as Ze,L as tn,Ma as an,U as nn,X as et,ba as O,c as _,ca as rn,ea as ve,fa as P,ga as Te,j as E,k as le,ma as sn,q as ue,r as en,sa as on,vd as ln,xb as cn}from"./chunk-YU6N3IVV.js";import{a as y,b as F,d as we,g as K,h as l}from"./chunk-QWWW7GFA.js";var mn={production:!0,version:"6.36.5",firebaseConfig:{apiKey:"AIzaSyDnnitFXpM8TglWKNpzu4ChgF98n25Rgvw",authDomain:"auth.dealpos.com",projectId:"devops-signin",storageBucket:"devops-signin.appspot.com",messagingSenderId:"412465165194",appId:"1:412465165194:web:03d806f6b6ab6f8b460e73",measurementId:"G-MNDBRJ5XZD"},news:"https://changelog.dealpos.app/umbraco/delivery/api/v2/content?fetch=children:omni&sort=sortOrder:asc"};var gn=(()=>{class n{constructor(){}getParseToken(){let t=JSON.parse(window.localStorage.getItem("user"));return this.ParseToken(t.Token.access_token)}GetRoles(){let r=this.getParseToken()["http://schemas.microsoft.com/ws/2008/06/identity/claims/role"];return typeof r=="string"&&(r=[r]),r||[]}ParseToken(t){try{let i=t.split(".")[0].replace("-","+").replace("_","/"),s=JSON.parse(window.atob(i)),a=t.split(".")[1].replace("-","+").replace("_","/"),c=JSON.parse(window.atob(a));return c.header=s,c}catch{return!1}}static{this.\u0275fac=function(r){return new(r||n)}}static{this.\u0275prov=O({token:n,factory:n.\u0275fac,providedIn:"root"})}}return n})();var In=()=>{};var En=function(n){let e=[],t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},Kr=function(n){let e=[],t=0,r=0;for(;t<n.length;){let i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=n[t++],o=n[t++],a=n[t++],c=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{let s=n[t++],o=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},yn={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<n.length;i+=3){let s=n[i],o=i+1<n.length,a=o?n[i+1]:0,c=i+2<n.length,u=c?n[i+2]:0,h=s>>2,d=(s&3)<<4|a>>4,f=(a&15)<<2|u>>6,p=u&63;c||(p=64,o||(f=64)),r.push(t[h],t[d],t[f],t[p])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(En(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Kr(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){let s=t[n.charAt(i++)],a=i<n.length?t[n.charAt(i)]:0;++i;let u=i<n.length?t[n.charAt(i)]:64;++i;let d=i<n.length?t[n.charAt(i)]:64;if(++i,s==null||a==null||u==null||d==null)throw new rt;let f=s<<2|a>>4;if(r.push(f),u!==64){let p=a<<4&240|u>>2;if(r.push(p),d!==64){let g=u<<6&192|d;r.push(g)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},rt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},Jr=function(n){let e=En(n);return yn.encodeByteArray(e,!0)},st=function(n){return Jr(n).replace(/\./g,"")},Ce=function(n){try{return yn.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function Yr(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}var Xr=()=>Yr().__FIREBASE_DEFAULTS__,Qr=()=>{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Zr=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=n&&Ce(n[1]);return e&&JSON.parse(e)},ot=()=>{try{return In()||Xr()||Qr()||Zr()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},wn=n=>ot()?.emulatorHosts?.[n];var at=()=>ot()?.config,ct=n=>ot()?.[`_${n}`];var de=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}};function A(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function vn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(A())}function Tn(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function bn(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Sn(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function An(){let n=A();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Cn(){try{return typeof indexedDB=="object"}catch{return!1}}function Pn(){return new Promise((n,e)=>{try{let t=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(t){e(t)}})}var ei="FirebaseError",k=class n extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=ei,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,V.prototype.create)}},V=class{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){let r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?ti(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new k(i,a,r)}};function ti(n,e){try{let t=0,r="";for(;t<n.length;){let i=n.indexOf("{$",t);if(i===-1){r+=n.substring(t);break}let s=n.indexOf("}",i+2);if(s===-1){r+=n.substring(t);break}let o=n.substring(i+2,s),a=e[o];r+=n.substring(t,i)+(a!=null?String(a):`<${o}?>`),t=s+1}return r}catch{return n}}function kn(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function z(n,e){if(n===e)return!0;let t=Object.keys(n),r=Object.keys(e);for(let i of t){if(!r.includes(i))return!1;let s=n[i],o=e[i];if(_n(s)&&_n(o)){if(!z(s,o))return!1}else if(s!==o)return!1}for(let i of r)if(!t.includes(i))return!1;return!0}function _n(n){return n!==null&&typeof n=="object"}function ee(n){let e=[];for(let[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Rn(n,e){let t=new it(n,e);return t.subscribe.bind(t)}var it=class{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");ni(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=nt),i.error===void 0&&(i.error=nt),i.complete===void 0&&(i.complete=nt);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function ni(n,e){if(typeof n!="object"||n===null)return!1;for(let t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function nt(){}var Qo=14400*1e3;function J(n){return n&&n._delegate?n._delegate:n}function Pe(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}function Dn(n){return l(this,null,function*(){return(yield fetch(n,{credentials:"include"})).ok})}var N=class{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}};var Y="[DEFAULT]";var lt=class{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let r=new de;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(ii(e))try{this.getOrInitializeService({instanceIdentifier:Y})}catch{}for(let[t,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(t);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Y){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}delete(){return l(this,null,function*(){let e=Array.from(this.instances.values());yield Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])})}isComponentSet(){return this.component!=null}isInitialized(e=Y){return this.instances.has(e)}getOptions(e=Y){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(let[s,o]of this.instancesDeferred.entries()){let a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,t){let r=this.normalizeInstanceIdentifier(t),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){let r=this.onInitCallbacks.get(t);if(r)for(let i of r)try{i(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:ri(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Y){return this.component?this.component.multipleInstances?e:Y:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};function ri(n){return n===Y?void 0:n}function ii(n){return n.instantiationMode==="EAGER"}var ke=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new lt(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}};var si=[],I=(function(n){return n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT",n})(I||{}),oi={debug:I.DEBUG,verbose:I.VERBOSE,info:I.INFO,warn:I.WARN,error:I.ERROR,silent:I.SILENT},ai=I.INFO,ci={[I.DEBUG]:"log",[I.VERBOSE]:"log",[I.INFO]:"info",[I.WARN]:"warn",[I.ERROR]:"error"},li=(n,e,...t)=>{if(e<n.logLevel)return;let r=new Date().toISOString(),i=ci[e];if(i)console[i](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},te=class{constructor(e){this.name=e,this._logLevel=ai,this._logHandler=li,this._userLogHandler=null,si.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in I))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?oi[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,I.DEBUG,...e),this._logHandler(this,I.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,I.VERBOSE,...e),this._logHandler(this,I.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,I.INFO,...e),this._logHandler(this,I.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,I.WARN,...e),this._logHandler(this,I.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,I.ERROR,...e),this._logHandler(this,I.ERROR,...e)}};var ui=(n,e)=>e.some(t=>n instanceof t),On,Nn;function di(){return On||(On=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function hi(){return Nn||(Nn=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Ln=new WeakMap,dt=new WeakMap,Mn=new WeakMap,ut=new WeakMap,ft=new WeakMap;function fi(n){let e=new Promise((t,r)=>{let i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(L(n.result)),i()},o=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ln.set(t,n)}).catch(()=>{}),ft.set(e,n),e}function pi(n){if(dt.has(n))return;let e=new Promise((t,r)=>{let i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),i()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});dt.set(n,e)}var ht={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return dt.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Mn.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return L(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function xn(n){ht=n(ht)}function mi(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let r=n.call(Re(this),e,...t);return Mn.set(r,e.sort?e.sort():[e]),L(r)}:hi().includes(n)?function(...e){return n.apply(Re(this),e),L(Ln.get(this))}:function(...e){return L(n.apply(Re(this),e))}}function gi(n){return typeof n=="function"?mi(n):(n instanceof IDBTransaction&&pi(n),ui(n,di())?new Proxy(n,ht):n)}function L(n){if(n instanceof IDBRequest)return fi(n);if(ut.has(n))return ut.get(n);let e=gi(n);return e!==n&&(ut.set(n,e),ft.set(e,n)),e}var Re=n=>ft.get(n);function Fn(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){let o=indexedDB.open(n,e),a=L(o);return r&&o.addEventListener("upgradeneeded",c=>{r(L(o.result),c.oldVersion,c.newVersion,L(o.transaction),c)}),t&&o.addEventListener("blocked",c=>t(c.oldVersion,c.newVersion,c)),a.then(c=>{s&&c.addEventListener("close",()=>s()),i&&c.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}var Ii=["get","getKey","getAll","getAllKeys","count"],_i=["put","add","delete","clear"],pt=new Map;function Un(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(pt.get(e))return pt.get(e);let t=e.replace(/FromIndex$/,""),r=e!==t,i=_i.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Ii.includes(t)))return;let s=function(o,...a){return l(this,null,function*(){let c=this.transaction(o,i?"readwrite":"readonly"),u=c.store;return r&&(u=u.index(a.shift())),(yield Promise.all([u[t](...a),i&&c.done]))[0]})};return pt.set(e,s),s}xn(n=>F(y({},n),{get:(e,t,r)=>Un(e,t)||n.get(e,t,r),has:(e,t)=>!!Un(e,t)||n.has(e,t)}));var gt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Ei(t)){let r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}};function Ei(n){return n.getComponent()?.type==="VERSION"}var It="@firebase/app",Vn="0.16.0";var H=new te("@firebase/app"),yi="@firebase/app-compat",wi="@firebase/analytics-compat",vi="@firebase/analytics",Ti="@firebase/app-check-compat",bi="@firebase/app-check",Si="@firebase/auth",Ai="@firebase/auth-compat",Ci="@firebase/database",Pi="@firebase/data-connect",ki="@firebase/database-compat",Ri="@firebase/functions",Di="@firebase/functions-compat",Oi="@firebase/installations",Ni="@firebase/installations-compat",Li="@firebase/messaging",Mi="@firebase/messaging-compat",xi="@firebase/performance",Ui="@firebase/performance-compat",Fi="@firebase/remote-config",Vi="@firebase/remote-config-compat",Bi="@firebase/storage",Hi="@firebase/storage-compat",ji="@firebase/firestore",Wi="@firebase/ai",$i="@firebase/firestore-compat",zi="firebase",qi="12.17.0";var _t="[DEFAULT]",Gi={[It]:"fire-core",[yi]:"fire-core-compat",[vi]:"fire-analytics",[wi]:"fire-analytics-compat",[bi]:"fire-app-check",[Ti]:"fire-app-check-compat",[Si]:"fire-auth",[Ai]:"fire-auth-compat",[Ci]:"fire-rtdb",[Pi]:"fire-data-connect",[ki]:"fire-rtdb-compat",[Ri]:"fire-fn",[Di]:"fire-fn-compat",[Oi]:"fire-iid",[Ni]:"fire-iid-compat",[Li]:"fire-fcm",[Mi]:"fire-fcm-compat",[xi]:"fire-perf",[Ui]:"fire-perf-compat",[Fi]:"fire-rc",[Vi]:"fire-rc-compat",[Bi]:"fire-gcs",[Hi]:"fire-gcs-compat",[ji]:"fire-fst",[$i]:"fire-fst-compat",[Wi]:"fire-vertex","fire-js":"fire-js",[zi]:"fire-js-all"};var De=new Map,Ki=new Map,Et=new Map;function Bn(n,e){try{n.container.addComponent(e)}catch(t){H.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function re(n){let e=n.name;if(Et.has(e))return H.debug(`There were multiple attempts to register component ${e}.`),!1;Et.set(e,n);for(let t of De.values())Bn(t,n);for(let t of Ki.values())Bn(t,n);return!0}function Tt(n,e){let t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function R(n){return n==null?!1:n.settings!==void 0}var Ji={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},B=new V("app","Firebase",Ji);var yt=class{constructor(e,t,r){this._isDeleted=!1,this._options=y({},e),this._config=y({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new N("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw B.create("app-deleted",{appName:this._name})}};var ie=qi;function Yi(n,e={}){let t=n;typeof e!="object"&&(e={name:e});let r=y({name:_t,automaticDataCollectionEnabled:!0},e),i=r.name;if(typeof i!="string"||!i)throw B.create("bad-app-name",{appName:String(i)});if(t||(t=at()),!t)throw B.create("no-options");let s=De.get(i);if(s)if(z(t,s.options)){if(z(r,s.config))return s;throw B.create("duplicate-app",{appName:i,mismatchedParam:"config",oldValue:JSON.stringify(s.config),newValue:JSON.stringify(r)})}else throw B.create("duplicate-app",{appName:i,mismatchedParam:"options",oldValue:JSON.stringify(s.options),newValue:JSON.stringify(t)});let o=new ke(i);for(let c of Et.values())o.addComponent(c);let a=new yt(t,r,o);return De.set(i,a),a}function $n(n=_t){let e=De.get(n);if(!e&&n===_t&&at())return Yi();if(!e)throw B.create("no-app",{appName:n});return e}function ne(n,e,t){let r=Gi[n]??n;t&&(r+=`-${t}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),H.warn(o.join(" "));return}re(new N(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}var Xi="firebase-heartbeat-database",Qi=1,he="firebase-heartbeat-store",mt=null;function zn(){return mt||(mt=Fn(Xi,Qi,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(he)}catch(t){console.warn(t)}}}}).catch(n=>{throw B.create("idb-open",{originalErrorMessage:n.message})})),mt}function Zi(n){return l(this,null,function*(){try{let t=(yield zn()).transaction(he),r=yield t.objectStore(he).get(qn(n));return yield t.done,r}catch(e){if(e instanceof k)H.warn(e.message);else{let t=B.create("idb-get",{originalErrorMessage:e?.message});H.warn(t.message)}}})}function Hn(n,e){return l(this,null,function*(){try{let r=(yield zn()).transaction(he,"readwrite");yield r.objectStore(he).put(e,qn(n)),yield r.done}catch(t){if(t instanceof k)H.warn(t.message);else{let r=B.create("idb-set",{originalErrorMessage:t?.message});H.warn(r.message)}}})}function qn(n){return`${n.name}!${n.options.appId}`}var es=1024,ts=30,wt=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new vt(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}triggerHeartbeat(){return l(this,null,function*(){try{let t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=jn();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=yield this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats.length>ts){let i=rs(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){H.warn(e)}})}getHeartbeatsHeader(){return l(this,null,function*(){try{if(this._heartbeatsCache===null&&(yield this._heartbeatsCachePromise),this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=jn(),{heartbeatsToSend:t,unsentEntries:r}=ns(this._heartbeatsCache.heartbeats),i=st(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,yield this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return H.warn(e),""}})}};function jn(){return new Date().toISOString().substring(0,10)}function ns(n,e=es){let t=[],r=n.slice();for(let i of n){let s=t.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Wn(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),Wn(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}var vt=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}runIndexedDBEnvironmentCheck(){return l(this,null,function*(){return Cn()?Pn().then(()=>!0).catch(()=>!1):!1})}read(){return l(this,null,function*(){if(yield this._canUseIndexedDBPromise){let t=yield Zi(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}})}overwrite(e){return l(this,null,function*(){if(yield this._canUseIndexedDBPromise){let r=yield this.read();return Hn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return})}add(e){return l(this,null,function*(){if(yield this._canUseIndexedDBPromise){let r=yield this.read();return Hn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return})}};function Wn(n){return st(JSON.stringify({version:2,heartbeats:n})).length}function rs(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}function is(n){re(new N("platform-logger",e=>new gt(e),"PRIVATE")),re(new N("heartbeat",e=>new wt(e),"PRIVATE")),ne(It,Vn,n),ne(It,Vn,"esm2020"),ne("fire-js","")}is("");var T=(function(n){return n.readonly="readonly",n.readwrite="readwrite",n})(T||{}),Gn=new ve(null),Kn=new ve("Indexed DB"),ss=new ve("Server Indexed DB");function os(n,e){return n.objectStoreNames.contains(e)}function C(n,e,t){if(!n){t("You need to use the openDatabase function to create a database before you query it!");return}os(n,e)||t(`objectStore does not exists: ${e}`)}function b(n,e){let t=n.transaction(e.storeName,e.dbMode);return t.onerror=e.error,t.onabort=e.abort,t}function S(n,e,t,r){return{storeName:e,dbMode:n,error:i=>{t(i)},abort:i=>{t(i)}}}var St=[];function w(n,e,t,r){return new Promise((i,s)=>{n||s("IndexedDB not available");let o=n.open(e,t),a;o.onsuccess=()=>{a=o.result,St.push(a),i(a)},o.onerror=()=>{s(`IndexedDB error: ${o.error}`)},typeof r=="function"&&(o.onupgradeneeded=c=>{r(c,a)})})}function bt(n,e,t,r,i){return l(this,null,function*(){return new Promise((s,o)=>{if(!n)return;let a=n.open(e,t);a.onupgradeneeded=c=>l(null,null,function*(){let u=c.target.result,h=r.map(f=>l(null,null,function*(){if(!u.objectStoreNames.contains(f.store)){let p=u.createObjectStore(f.store,f.storeConfig);for(let g of f.storeSchema)p.createIndex(g.name,g.keypath,g.options)}}));yield Promise.all(h);let d=i&&i();if(d){let f=Object.keys(d).map(p=>parseInt(p,10)).filter(p=>p>c.oldVersion).sort((p,g)=>p-g);for(let p of f)d[p](u,a.transaction)}u.close(),s()}),a.onsuccess=c=>{c.target.result.close(),s()},a.onerror=c=>{o(c)}})})}function as(n,e,t){if(!n||!e||!t)throw Error('Params: "dbName", "version", "storeName" are mandatory.');return new _(r=>{try{let i=e+1,s=indexedDB.open(n,i);s.onupgradeneeded=o=>{let a=o.target.result;a.deleteObjectStore(t),a.close(),console.log("onupgradeneeded"),r.next(),r.complete()},s.onerror=o=>r.error(o)}catch(i){r.error(i)}})}function cs(n){return new Promise((e,t)=>{if(!n){t(new Error("No database to close"));return}try{n.close(),e()}catch(r){t(`Error closing database: ${r}`)}})}function v(){return function(n,e,t){let r=t.value;return t.value=function(...i){let s=r.apply(this,i);return s instanceof _?s.pipe(tn(()=>l(this,null,function*(){let o=St.map(a=>l(this,null,function*(){yield cs(a)}));yield Promise.all(o),St.length=0}))):s},t}}var Ct=(()=>{class n{constructor(t,r){this.dbConfigs=t,this.indexedDB=r,this.defaultDatabaseName=null,Object.values(this.dbConfigs).forEach((i,s,o)=>this.instanciateConfig(i,o.length===1))}instanciateConfig(t,r){return l(this,null,function*(){if(!t.name)throw new Error("NgxIndexedDB: Please, provide the dbName in the configuration");if((t.isDefault??!1)&&this.defaultDatabaseName)throw new Error("NgxIndexedDB: Only one database can be set as default");((t.isDefault??!1)&&!this.defaultDatabaseName||r)&&(this.defaultDatabaseName=t.name,this.selectedDb=t.name),yield bt(this.indexedDB,t.name,t.version,t.objectStoresMeta,t.migrationFactory),w(this.indexedDB,t.name).then(i=>{i.version!==t.version&&(ln()&&(console.warn(`
2
2
  Your DB Config doesn't match the most recent version of the DB with name ${t.name}, please update it
3
3
  DB current version: ${i.version};
4
4
  Your configuration: ${t.version};
@@ -1 +1 @@
1
- import{a as E}from"./chunk-DOO32EL7.js";import{a as F}from"./chunk-ABRPVDVO.js";import{h as T}from"./chunk-EHFG3EIP.js";import{a as w}from"./chunk-HZRIS4FA.js";import{b as i,c as m}from"./chunk-NNVT5X6O.js";import{b as j,e as s}from"./chunk-UC7FUQNJ.js";import{d as D}from"./chunk-67URAZUP.js";import{B as I,E as u,ba as c,e as b,ga as a,l as d,q as A,w as U,za as C}from"./chunk-YU6N3IVV.js";var x=(()=>{class r{constructor(){this.httpService=a(s)}getAttributes(t,e){return this.httpService.get("api/product/shopee/GetAttributesTree",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/shopee/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/shopee/AddProduct",t).pipe(u(o=>d(null)))}generateAttribute(t){return t.map(e=>({attribute_id:e.attribute_id,attribute_value_list:e.attribute_value_list.map(o=>({value_id:o.value_id,name:o.name}))})),t}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var H=(()=>{class r{constructor(){this.httpService=a(s)}getCategories(t){return this.httpService.get("api/product/tiktok/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tiktok/AddProduct",t).pipe(u(o=>d(null)))}generateAttribute(t){let e;return t.map(o=>(o.type=="PRODUCT_PROPERTY"?e={id:o.id,name:o.name,type:o.type,values:o.values}:e={id:o.id,name:o.values[0].id,type:o.type},e))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var z=(()=>{class r{constructor(){this.httpService=a(s)}getAttributes(t,e){return this.httpService.get("api/product/lazada/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/lazada/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/lazada/AddProduct",t).pipe(u(o=>d(null)))}generateAttribute(t){return t.map(e=>({name:e.name,options:e.options}))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var R=(()=>{class r{constructor(){this.httpService=a(s)}getAttributes(t,e){return this.httpService.get("api/product/woo/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/woo/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/woo/AddProduct",t).pipe(u(o=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var g=class{};var S=class{};var V=(()=>{class r{constructor(){this.httpService=a(s)}getCategories(t){return this.httpService.get("api/product/tokopedia/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tokopedia/AddProduct",t).pipe(u(o=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var G=(()=>{class r{constructor(){this.httpService=a(s)}uploadProduct(t){return this.httpService.post("api/product/ShopifyV2/AddProduct",t).pipe(u(o=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var N=(()=>{class r{constructor(){this.httpService=a(s)}uploadProduct(t){return this.httpService.post(w.UploadPlugoProduct,t).pipe(u(e=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var Mt=(()=>{class r{constructor(){this.authService=a(T),this.productService=a(F),this.shoppeUploadService=a(x),this.tiktokUploadService=a(H),this.lazadaUploadService=a(z),this.tokopediaUploadService=a(V),this.wooUploadService=a(R),this.shopifyUploadService=a(G),this.plugoUploadService=a(N),this.toastrHandlingService=a(E),this.toastr=a(j),this.router=a(D),this.httpService=a(s),this._selectedProduct=new b(this.getStoredProducts()),this.selectedProduct$=this._selectedProduct.asObservable().pipe(I(t=>t&&t.length>0))}getStoredProducts(){let t=localStorage.getItem("productsUpload");if(t){let e=JSON.parse(t);return e&&e.length>0?e:[]}else return[]}setSelectedProduct(t){localStorage.setItem("productsUpload",JSON.stringify(t)),this._selectedProduct.next(t)}clearSelectedProduct(){localStorage.removeItem("productsUpload"),this._selectedProduct.next([])}getUnselectedChannels(){let t=this.authService.getChannels(),e=this._selectedProduct.getValue();return this.productService.filterUnselectedChannel(e,t)}getDefaultCategory(){return this.httpService.get("api/v1/Channel/ProductCategory/Default")}get channelProductUpload(){let t=this.getUnselectedChannels();return C(t.map(o=>{let p=new g;return p.id=o.ID,p.name=o.Name,p.type=o.TypeID,p.categoryId=null,p.attributes=[],p.selected=!1,p}))}onUploadProduct(t){let e=t.filter(o=>o.selected&&m.IsNotEmpty(o.categoryId)||o.selected&&(o.type==i.Shopify||o.type==i.ShopifyV2||o.type==i.Plugo));if(e.length>0){let o=this.generateDataForUpload(e);this.uploadProduct(o)}else this.toastr.warning("Please select a channel and category to upload the product.","Warning!")}uploadProduct(t){let e=this.generateObservableForUpload(t);U(e).pipe(A(o=>{let p=[];return o.filter(h=>m.IsNotEmpty(h)).forEach(h=>{p=[...p,...h]}),p})).subscribe({next:(o=[])=>{m.IsNotEmpty(o)&&this.toastrHandlingService.showToastrUploadMultiple(o),this.hasSuccessRes(o)&&this.onSuccessUpload()}})}hasSuccessRes(t){let e=!1;return t.forEach(o=>{o?.Response.Success_list?.length>0&&m.IsNotEmpty(o)&&(e=!0)}),e}onSuccessUpload(){this.router.navigate(["/menu/products/status/sold-in-channel"]),this.clearSelectedProduct()}generateObservableForUpload(t){let e=[],o=[],p=[],h=[],v=[],y=[],P=[],k=[];t.forEach(l=>{switch(l.ChannelType){case i.Shopee:o.push(l);break;case i.Tiktok:e.push(l);break;case i.Lazada:p.push(l);break;case i.Tokopedia:h.push(l);break;case i.WooCommerce:v.push(l);break;case i.Shopify:y.push(l);break;case i.ShopifyV2:P.push(l);break;case i.Plugo:k.push(l);break}});let n=[];return[{type:i.Shopee,data:o},{type:i.Tiktok,data:e},{type:i.Lazada,data:p},{type:i.Tokopedia,data:h},{type:i.WooCommerce,data:v},{type:i.Shopify,data:y},{type:i.ShopifyV2,data:P},{type:i.Plugo,data:k}].filter(l=>l.data.length>0).forEach(l=>{switch(l.type){case i.Shopee:n.push(this.shoppeUploadService.uploadProduct(o));break;case i.Tiktok:n.push(this.tiktokUploadService.uploadProduct(e));break;case i.Lazada:n.push(this.lazadaUploadService.uploadProduct(p));break;case i.Tokopedia:n.push(this.tokopediaUploadService.uploadProduct(h));break;case i.WooCommerce:n.push(this.wooUploadService.uploadProduct(v));break;case i.Shopify:n.push(this.shopifyUploadService.uploadProduct(y));break;case i.ShopifyV2:n.push(this.shopifyUploadService.uploadProduct(P));break;case i.Plugo:n.push(this.plugoUploadService.uploadProduct(k));break}}),n}generateDataForUpload(t){let e=[];return t.forEach(o=>{let p=new S;p.ChannelID=o.id,p.ChannelType=o.type,p.Products=this._selectedProduct.getValue(),o.type==i.Shopify||o.type==i.ShopifyV2?delete p.CategoryID:p.CategoryID=o.categoryId,p=this.generateAttributeHttpRequest(o,p),e.push(p)}),e}generateAttributeHttpRequest(t,e){return t.type==i.WooCommerce||t.type==i.Shopify||t.type==i.ShopifyV2?e.Attribute=t.attributes[0]:t.type==i.Tiktok?(e.Attributes=this.formatAttributes(t.type,t.attributes),e.listing_platforms=t.listing_platforms):e.Attributes=this.formatAttributes(t.type,t.attributes),e}formatAttributes(t,e){let o;switch(t){case i.Shopee:o=this.shoppeUploadService.generateAttribute(e);break;case i.Tiktok:o=this.tiktokUploadService.generateAttribute(e);break;case i.WooCommerce:o=this.tiktokUploadService.generateAttribute(e);break;case i.Lazada:o=this.lazadaUploadService.generateAttribute(e);break;case i.Tokopedia:o=e;break;case i.Shopify:o=e;break;case i.ShopifyV2:o=e;break;default:o=[];break}return o}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{x as a,H as b,z as c,R as d,Mt as e};
1
+ import{a as E}from"./chunk-DOO32EL7.js";import{a as F}from"./chunk-DA7HEIQY.js";import{h as T}from"./chunk-4UTSQBQJ.js";import{a as w}from"./chunk-HZRIS4FA.js";import{b as i,c as m}from"./chunk-NNVT5X6O.js";import{b as j,e as s}from"./chunk-UC7FUQNJ.js";import{d as D}from"./chunk-67URAZUP.js";import{B as I,E as u,ba as c,e as b,ga as a,l as d,q as A,w as U,za as C}from"./chunk-YU6N3IVV.js";var x=(()=>{class r{constructor(){this.httpService=a(s)}getAttributes(t,e){return this.httpService.get("api/product/shopee/GetAttributesTree",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/shopee/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/shopee/AddProduct",t).pipe(u(o=>d(null)))}generateAttribute(t){return t.map(e=>({attribute_id:e.attribute_id,attribute_value_list:e.attribute_value_list.map(o=>({value_id:o.value_id,name:o.name}))})),t}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var H=(()=>{class r{constructor(){this.httpService=a(s)}getCategories(t){return this.httpService.get("api/product/tiktok/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tiktok/AddProduct",t).pipe(u(o=>d(null)))}generateAttribute(t){let e;return t.map(o=>(o.type=="PRODUCT_PROPERTY"?e={id:o.id,name:o.name,type:o.type,values:o.values}:e={id:o.id,name:o.values[0].id,type:o.type},e))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var z=(()=>{class r{constructor(){this.httpService=a(s)}getAttributes(t,e){return this.httpService.get("api/product/lazada/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/lazada/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/lazada/AddProduct",t).pipe(u(o=>d(null)))}generateAttribute(t){return t.map(e=>({name:e.name,options:e.options}))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var R=(()=>{class r{constructor(){this.httpService=a(s)}getAttributes(t,e){return this.httpService.get("api/product/woo/GetAttributes",[{key:"ID",value:t},{key:"CategoryID",value:e}])}getCategories(t){return this.httpService.get("api/product/woo/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/woo/AddProduct",t).pipe(u(o=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var g=class{};var S=class{};var V=(()=>{class r{constructor(){this.httpService=a(s)}getCategories(t){return this.httpService.get("api/product/tokopedia/GetCategories",[{key:"ID",value:t}])}uploadProduct(t){return this.httpService.post("api/product/tokopedia/AddProduct",t).pipe(u(o=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var G=(()=>{class r{constructor(){this.httpService=a(s)}uploadProduct(t){return this.httpService.post("api/product/ShopifyV2/AddProduct",t).pipe(u(o=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var N=(()=>{class r{constructor(){this.httpService=a(s)}uploadProduct(t){return this.httpService.post(w.UploadPlugoProduct,t).pipe(u(e=>d(null)))}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();var Mt=(()=>{class r{constructor(){this.authService=a(T),this.productService=a(F),this.shoppeUploadService=a(x),this.tiktokUploadService=a(H),this.lazadaUploadService=a(z),this.tokopediaUploadService=a(V),this.wooUploadService=a(R),this.shopifyUploadService=a(G),this.plugoUploadService=a(N),this.toastrHandlingService=a(E),this.toastr=a(j),this.router=a(D),this.httpService=a(s),this._selectedProduct=new b(this.getStoredProducts()),this.selectedProduct$=this._selectedProduct.asObservable().pipe(I(t=>t&&t.length>0))}getStoredProducts(){let t=localStorage.getItem("productsUpload");if(t){let e=JSON.parse(t);return e&&e.length>0?e:[]}else return[]}setSelectedProduct(t){localStorage.setItem("productsUpload",JSON.stringify(t)),this._selectedProduct.next(t)}clearSelectedProduct(){localStorage.removeItem("productsUpload"),this._selectedProduct.next([])}getUnselectedChannels(){let t=this.authService.getChannels(),e=this._selectedProduct.getValue();return this.productService.filterUnselectedChannel(e,t)}getDefaultCategory(){return this.httpService.get("api/v1/Channel/ProductCategory/Default")}get channelProductUpload(){let t=this.getUnselectedChannels();return C(t.map(o=>{let p=new g;return p.id=o.ID,p.name=o.Name,p.type=o.TypeID,p.categoryId=null,p.attributes=[],p.selected=!1,p}))}onUploadProduct(t){let e=t.filter(o=>o.selected&&m.IsNotEmpty(o.categoryId)||o.selected&&(o.type==i.Shopify||o.type==i.ShopifyV2||o.type==i.Plugo));if(e.length>0){let o=this.generateDataForUpload(e);this.uploadProduct(o)}else this.toastr.warning("Please select a channel and category to upload the product.","Warning!")}uploadProduct(t){let e=this.generateObservableForUpload(t);U(e).pipe(A(o=>{let p=[];return o.filter(h=>m.IsNotEmpty(h)).forEach(h=>{p=[...p,...h]}),p})).subscribe({next:(o=[])=>{m.IsNotEmpty(o)&&this.toastrHandlingService.showToastrUploadMultiple(o),this.hasSuccessRes(o)&&this.onSuccessUpload()}})}hasSuccessRes(t){let e=!1;return t.forEach(o=>{o?.Response.Success_list?.length>0&&m.IsNotEmpty(o)&&(e=!0)}),e}onSuccessUpload(){this.router.navigate(["/menu/products/status/sold-in-channel"]),this.clearSelectedProduct()}generateObservableForUpload(t){let e=[],o=[],p=[],h=[],v=[],y=[],P=[],k=[];t.forEach(l=>{switch(l.ChannelType){case i.Shopee:o.push(l);break;case i.Tiktok:e.push(l);break;case i.Lazada:p.push(l);break;case i.Tokopedia:h.push(l);break;case i.WooCommerce:v.push(l);break;case i.Shopify:y.push(l);break;case i.ShopifyV2:P.push(l);break;case i.Plugo:k.push(l);break}});let n=[];return[{type:i.Shopee,data:o},{type:i.Tiktok,data:e},{type:i.Lazada,data:p},{type:i.Tokopedia,data:h},{type:i.WooCommerce,data:v},{type:i.Shopify,data:y},{type:i.ShopifyV2,data:P},{type:i.Plugo,data:k}].filter(l=>l.data.length>0).forEach(l=>{switch(l.type){case i.Shopee:n.push(this.shoppeUploadService.uploadProduct(o));break;case i.Tiktok:n.push(this.tiktokUploadService.uploadProduct(e));break;case i.Lazada:n.push(this.lazadaUploadService.uploadProduct(p));break;case i.Tokopedia:n.push(this.tokopediaUploadService.uploadProduct(h));break;case i.WooCommerce:n.push(this.wooUploadService.uploadProduct(v));break;case i.Shopify:n.push(this.shopifyUploadService.uploadProduct(y));break;case i.ShopifyV2:n.push(this.shopifyUploadService.uploadProduct(P));break;case i.Plugo:n.push(this.plugoUploadService.uploadProduct(k));break}}),n}generateDataForUpload(t){let e=[];return t.forEach(o=>{let p=new S;p.ChannelID=o.id,p.ChannelType=o.type,p.Products=this._selectedProduct.getValue(),o.type==i.Shopify||o.type==i.ShopifyV2?delete p.CategoryID:p.CategoryID=o.categoryId,p=this.generateAttributeHttpRequest(o,p),e.push(p)}),e}generateAttributeHttpRequest(t,e){return t.type==i.WooCommerce||t.type==i.Shopify||t.type==i.ShopifyV2?e.Attribute=t.attributes[0]:t.type==i.Tiktok?(e.Attributes=this.formatAttributes(t.type,t.attributes),e.listing_platforms=t.listing_platforms):e.Attributes=this.formatAttributes(t.type,t.attributes),e}formatAttributes(t,e){let o;switch(t){case i.Shopee:o=this.shoppeUploadService.generateAttribute(e);break;case i.Tiktok:o=this.tiktokUploadService.generateAttribute(e);break;case i.WooCommerce:o=this.tiktokUploadService.generateAttribute(e);break;case i.Lazada:o=this.lazadaUploadService.generateAttribute(e);break;case i.Tokopedia:o=e;break;case i.Shopify:o=e;break;case i.ShopifyV2:o=e;break;default:o=[];break}return o}static{this.\u0275fac=function(e){return new(e||r)}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{x as a,H as b,z as c,R as d,Mt as e};