marketplacepos 5.45.0 → 5.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Marketplace/{chunk-XNVULGQ3.js → chunk-2KDM4NDG.js} +1 -1
- package/Marketplace/{chunk-EVQLTXB7.js → chunk-3NFS6ZDY.js} +1 -1
- package/Marketplace/{chunk-LK2PMDRL.js → chunk-3NHZEKEI.js} +1 -1
- package/Marketplace/{chunk-BERZDE6Y.js → chunk-43E7L4CY.js} +1 -1
- package/Marketplace/{chunk-6ZOHSFR5.js → chunk-4UWGWYKJ.js} +1 -1
- package/Marketplace/{chunk-37L3YDKT.js → chunk-5QLKBL54.js} +1 -1
- package/Marketplace/{chunk-3LN6RMRN.js → chunk-5X2WQKXH.js} +1 -1
- package/Marketplace/{chunk-YNJPF4PB.js → chunk-753FTTID.js} +1 -1
- package/Marketplace/{chunk-L7KCZLIM.js → chunk-76XHGJE7.js} +1 -1
- package/Marketplace/{chunk-H46SHHXR.js → chunk-7WG7VRYR.js} +1 -1
- package/Marketplace/{chunk-6VDV7CA2.js → chunk-A6G2H7IF.js} +2 -2
- package/Marketplace/{chunk-LQ2NLQKV.js → chunk-A6PK5NP6.js} +1 -1
- package/Marketplace/{chunk-ELSSXU6Y.js → chunk-AHLYED4C.js} +1 -1
- package/Marketplace/{chunk-FAMP5PPX.js → chunk-AKVBFSUI.js} +1 -1
- package/Marketplace/{chunk-LCRPUAWG.js → chunk-AP24AK5A.js} +1 -1
- package/Marketplace/{chunk-TZEINVZY.js → chunk-DFFRRMPT.js} +1 -1
- package/Marketplace/{chunk-GLVYOZA4.js → chunk-DLURPTQ3.js} +1 -1
- package/Marketplace/{chunk-3FPEQHTI.js → chunk-DQ3XZQ7W.js} +1 -1
- package/Marketplace/{chunk-PQGPOOCK.js → chunk-DUF425GC.js} +1 -1
- package/Marketplace/{chunk-6WCXK7FR.js → chunk-EBCTTFHD.js} +1 -1
- package/Marketplace/{chunk-LHX4ZOLA.js → chunk-EOLVRL5H.js} +1 -1
- package/Marketplace/chunk-EWTJL2KE.js +1 -0
- package/Marketplace/chunk-F6HNCBQX.js +5 -0
- package/Marketplace/{chunk-DDVDUCPY.js → chunk-FHH5BTG7.js} +1 -1
- package/Marketplace/{chunk-DSQSL5VX.js → chunk-FHPIPQMB.js} +1 -1
- package/Marketplace/{chunk-HPFBJL3A.js → chunk-FXVFO74P.js} +1 -1
- package/Marketplace/{chunk-RHF7TPRF.js → chunk-GVLJDP5K.js} +1 -1
- package/Marketplace/chunk-I2Y5WJEO.js +5 -0
- package/Marketplace/chunk-I4WCZRNL.js +1 -0
- package/Marketplace/{chunk-4Q5ZSKVO.js → chunk-IL2CPGYS.js} +1 -1
- package/Marketplace/{chunk-R7INAZCD.js → chunk-JL5DYPDV.js} +1 -1
- package/Marketplace/{chunk-IML3KYQE.js → chunk-KVZ7LQSK.js} +1 -1
- package/Marketplace/{chunk-MWTFYMKY.js → chunk-LFMEBDL2.js} +1 -1
- package/Marketplace/chunk-LSCMIKJ2.js +1 -0
- package/Marketplace/{chunk-JBNND5FL.js → chunk-MVBY6S4R.js} +1 -1
- package/Marketplace/chunk-MW6Q6DZF.js +1 -0
- package/Marketplace/{chunk-ZKXPDUO4.js → chunk-N6HMVYWS.js} +1 -1
- package/Marketplace/{chunk-JJKMVDXR.js → chunk-NERXQ5KH.js} +1 -1
- package/Marketplace/{chunk-6VHVQEVM.js → chunk-NFN7BQB3.js} +1 -1
- package/Marketplace/{chunk-TC4JRJQL.js → chunk-OIEZ4JUJ.js} +1 -1
- package/Marketplace/{chunk-L7EQZACZ.js → chunk-OPKLFRVD.js} +1 -1
- package/Marketplace/{chunk-QE3IIBDW.js → chunk-OXOTD33C.js} +1 -1
- package/Marketplace/{chunk-YWSUS64O.js → chunk-PFZOP2J7.js} +1 -1
- package/Marketplace/{chunk-B7JSVIVV.js → chunk-PONMPAT5.js} +1 -1
- package/Marketplace/{chunk-BZBQHO76.js → chunk-QGK4LEFP.js} +1 -1
- package/Marketplace/{chunk-FESS3PG3.js → chunk-QNM4JQ46.js} +1 -1
- package/Marketplace/{chunk-KUUDZPGN.js → chunk-RDJPSZRF.js} +1 -1
- package/Marketplace/{chunk-RLBTXXCD.js → chunk-SMRDRDSH.js} +1 -1
- package/Marketplace/{chunk-CNJDARBM.js → chunk-UBAADH47.js} +1 -1
- package/Marketplace/{chunk-UML74HNB.js → chunk-UUJWRGO4.js} +1 -1
- package/Marketplace/{chunk-RQEQPIMI.js → chunk-V3CLQBGH.js} +1 -1
- package/Marketplace/{chunk-FOFXARTB.js → chunk-V4UHOZJ4.js} +1 -1
- package/Marketplace/{chunk-FJ455ZYZ.js → chunk-VCTMSNVC.js} +1 -1
- package/Marketplace/{chunk-BFPMFJI7.js → chunk-VKFFHT27.js} +1 -1
- package/Marketplace/{chunk-XP6R2ZYJ.js → chunk-VPFSU3X4.js} +1 -1
- package/Marketplace/{chunk-LF6HWNC2.js → chunk-W3JKSCRF.js} +1 -1
- package/Marketplace/{chunk-BYSLV4DQ.js → chunk-WCVSETLP.js} +1 -1
- package/Marketplace/{chunk-4ZQCJGTZ.js → chunk-WHNSPPOH.js} +1 -1
- package/Marketplace/{chunk-2I7ZZ3F2.js → chunk-WKSCLDT7.js} +1 -1
- package/Marketplace/{chunk-D5YID4W4.js → chunk-WVHSR3DQ.js} +1 -1
- package/Marketplace/{chunk-MMUSTFHH.js → chunk-X5KQU53P.js} +1 -1
- package/Marketplace/{chunk-6NUQGKRV.js → chunk-XB3CW7KH.js} +1 -1
- package/Marketplace/{chunk-SHRLQGK3.js → chunk-XEBKP2KL.js} +1 -1
- package/Marketplace/{chunk-6V4LFY52.js → chunk-ZDXNJIJA.js} +1 -1
- package/Marketplace/{chunk-JFS634DA.js → chunk-ZHDGR4XE.js} +1 -1
- package/Marketplace/{chunk-2TN45S53.js → chunk-ZWEHKGL5.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-ZZ76NVAH.js → main-3TBM4ISM.js} +1 -1
- package/package.json +1 -1
- package/Marketplace/chunk-2LK24YA5.js +0 -1
- package/Marketplace/chunk-3E7JHNVC.js +0 -5
- package/Marketplace/chunk-42MFOGHP.js +0 -5
- package/Marketplace/chunk-MBBQZFI4.js +0 -1
- package/Marketplace/chunk-QUKRHI5J.js +0 -1
- package/Marketplace/chunk-RDRNWLJI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ne}from"./chunk-J53BPEDH.js";import{a as Ae}from"./chunk-RDRNWLJI.js";import{b as Re,e as $e}from"./chunk-W5L6FMO3.js";import{b as He,c as Me,d as Le,i as we,j as We,k as je}from"./chunk-FO7G4GMY.js";import{m as Pe,n as De}from"./chunk-FXQKRJWU.js";import{$c as V,Gb as Ee,Gc as I,Hc as W,Ic as xe,Mb as _e,Yb as Ie,ad as K,dc as me,g as ve,ic as C,ja as ke,jc as y,kc as be,oa as U,pa as pe,rb as R,tc as Te,uc as J}from"./chunk-OJMQBH6T.js";import{a as _,b as M,c as L,i as d}from"./chunk-66YHNWRR.js";var v=class extends Error{constructor(e,t){let n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}},$=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}},X=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}},G=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}},Y=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}},O=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},Q=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}};var j=class{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}},T=class{get(e,t){return this.send(M(_({},t),{method:"GET",url:e}))}post(e,t){return this.send(M(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send(M(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var s=function(i){return i[i.Trace=0]="Trace",i[i.Debug=1]="Debug",i[i.Information=2]="Information",i[i.Warning=3]="Warning",i[i.Error=4]="Error",i[i.Critical=5]="Critical",i[i.None=6]="None",i}(s||{});var x=class{constructor(){}log(e,t){}};x.instance=new x;var ze="8.0.17",g=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 i{static get isBrowser(){return!i.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!i.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!i.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function N(i,e){let t="";return E(i)?(t=`Binary data of length ${i.byteLength}`,e&&(t+=`. Content: '${Je(i)}'`)):typeof i=="string"&&(t=`String data of length ${i.length}`,e&&(t+=`. Content: '${i}'`)),t}function Je(i){let e=new Uint8Array(i),t="";return e.forEach(n=>{let o=n<16?"0":"";t+=`0x${o}${n.toString(16)} `}),t.substr(0,t.length-1)}function E(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function ee(i,e,t,n,o,r){return d(this,null,function*(){let a={},[c,l]=P();a[c]=l,i.log(s.Trace,`(${e} transport) sending data. ${N(o,r.logMessageContent)}.`);let u=E(o)?"arraybuffer":"text",f=yield t.post(n,{content:o,headers:_(_({},a),r.headers),responseType:u,timeout:r.timeout,withCredentials:r.withCredentials});i.log(s.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function Be(i){return i===void 0?new A(s.Information):i===null?x.instance:i.log!==void 0?i:new A(i)}var Z=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=>{})}},A=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let n=`[${new Date().toISOString()}] ${s[e]}: ${t}`;switch(e){case s.Critical:case s.Error:this.out.error(n);break;case s.Warning:this.out.warn(n);break;case s.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function P(){let i="X-SignalR-User-Agent";return p.isNode&&(i="User-Agent"),[i,Ve(ze,Ke(),Ge(),Xe())]}function Ve(i,e,t,n){let o="Microsoft SignalR/",r=i.split(".");return o+=`${r[0]}.${r[1]}`,o+=` (${i}; `,e&&e!==""?o+=`${e}; `:o+="Unknown OS; ",o+=`${t}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function Ke(){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 Ge(){return p.isNode?"NodeJS":"Browser"}function te(i){return i.stack?i.stack:i.message?i.message:`${i}`}function Ue(){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 ne=class extends T{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:L;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(Ue());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:L;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return d(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(s.Warning,"Timeout from HTTP request."),n=new $},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},E(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let r;try{r=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(s.Warning,`Error from HTTP request. ${l}.`),l)}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){let l=yield Oe(r,"text");throw new v(l||r.statusText,r.status)}let c=yield Oe(r,e.responseType);return new j(r.status,r.statusText,c)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(n,o)=>t=o.join("; ")),t}};function Oe(i,e){let t;switch(e){case"arraybuffer":t=i.arrayBuffer();break;case"text":t=i.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=i.text();break}return t}var oe=class extends T{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&&(E(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let r=e.headers;r&&Object.keys(r).forEach(a=>{o.setRequestHeader(a,r[a])}),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 j(o.status,o.statusText,o.response||o.responseText)):n(new v(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(s.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new v(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(s.Warning,"Timeout from HTTP request."),n(new $)},o.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var ie=class extends T{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new ne(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new oe(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 k=class i{static write(e){return`${e}${i.RecordSeparator}`}static parse(e){if(e[e.length-1]!==i.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(i.RecordSeparator);return t.pop(),t}};k.RecordSeparatorCode=30;k.RecordSeparator=String.fromCharCode(k.RecordSeparatorCode);var re=class{writeHandshakeRequest(e){return k.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(E(e)){let c=new Uint8Array(e),l=c.indexOf(k.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(c.slice(0,u))),n=c.byteLength>u?c.slice(u).buffer:null}else{let c=e,l=c.indexOf(k.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=c.substring(0,u),n=c.length>u?c.substring(u):null}let o=k.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}};var h=function(i){return i[i.Invocation=1]="Invocation",i[i.StreamItem=2]="StreamItem",i[i.Completion=3]="Completion",i[i.StreamInvocation=4]="StreamInvocation",i[i.CancelInvocation=5]="CancelInvocation",i[i.Ping=6]="Ping",i[i.Close=7]="Close",i[i.Ack=8]="Ack",i[i.Sequence=9]="Sequence",i}(h||{});var se=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 Z(this,e)}};var ae=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 d(this,null,function*(){let t=this._protocol.writeMessage(e),n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let o=()=>{},r=()=>{};E(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((a,c)=>{o=a,r=c})),this._messages.push(new Se(t,this._totalMessageCount,o,r))}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,E(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 d(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(()=>d(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))}},Se=class{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}};var Ye=30*1e3,Qe=15*1e3,Ze=1e5,m=function(i){return i.Disconnected="Disconnected",i.Connecting="Connecting",i.Connected="Connected",i.Disconnecting="Disconnecting",i.Reconnecting="Reconnecting",i}(m||{}),ce=class i{static create(e,t,n,o,r,a,c){return new i(e,t,n,o,r,a,c)}constructor(e,t,n,o,r,a,c){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(s.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")},g.isRequired(e,"connection"),g.isRequired(t,"logger"),g.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=r??Ye,this.keepAliveIntervalInMilliseconds=a??Qe,this._statefulReconnectBufferSize=c??Ze,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new re,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 d(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(s.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(s.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(s.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return d(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(s.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(s.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 ae(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(s.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return d(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(s.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(s.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(s.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(s.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 d(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o),a,c=new se;return c.cancelCallback=()=>{let l=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],a.then(()=>this._sendWithProtocol(l))},this._callbacks[r.invocationId]=(l,u)=>{if(u){c.error(u);return}else l&&(l.type===h.Completion?l.error?c.error(new Error(l.error)):c.complete():c.next(l.item))},a=this._sendWithProtocol(r).catch(l=>{c.error(l),delete this._callbacks[r.invocationId]}),this._launchStreams(n,a),c}_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),r=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,r),r}invoke(e,...t){let[n,o]=this._replaceStreamingParams(t),r=this._createInvocation(e,t,!1,o);return new Promise((c,l)=>{this._callbacks[r.invocationId]=(f,D)=>{if(D){l(D);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):c(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(r).catch(f=>{l(f),delete this._callbacks[r.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(s.Error,`Invoke client method threw error: ${te(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(r){this._logger.log(s.Error,`Stream callback threw error: ${te(r)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(s.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(s.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(o){let r="Error parsing handshake response: "+o;this._logger.log(s.Error,r);let a=new Error(r);throw this._handshakeRejecter(a),a}if(t.error){let o="Server returned handshake error: "+t.error;this._logger.log(s.Error,o);let r=new Error(o);throw this._handshakeRejecter(r),r}else this._logger.log(s.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),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>d(this,null,function*(){if(this._connectionState===m.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return d(this,null,function*(){let t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(s.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(s.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(),r=!!e.invocationId,a,c,l;for(let u of o)try{let f=a;a=yield u.apply(this,e.arguments),r&&a&&f&&(this._logger.log(s.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),c=void 0}catch(f){c=f,this._logger.log(s.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):r?(c?l=this._createCompletionMessage(e.invocationId,`${c}`,null):a!==void 0?l=this._createCompletionMessage(e.invocationId,null,a):(this._logger.log(s.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)):a&&this._logger.log(s.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(s.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(s.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return d(this,null,function*(){let t=Date.now(),n=0,o=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(r===null){this._logger.log(s.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(s.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(s.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(a=>a.apply(this,[e]))}catch(a){this._logger.log(s.Error,`An onreconnecting callback called with error '${e}' threw error '${a}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;r!==null;){if(this._logger.log(s.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),yield new Promise(a=>{this._reconnectDelayHandle=setTimeout(a,r)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(s.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(a=>a.apply(this,[this.connection.connectionId]))}catch(a){this._logger.log(s.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${a}'.`)}return}catch(a){if(this._logger.log(s.Information,`Reconnect attempt failed because of error '${a}'.`),this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}o=a instanceof Error?a:new Error(a.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(s.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(s.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(r){this._logger.log(s.Error,`Stream 'error' callback called with '${e}' threw error: ${te(r)}`)}})}_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?{arguments:t,streamIds:o,target:e,type:h.Invocation}:{arguments:t,target:e,type:h.Invocation};{let r=this._invocationId;return this._invocationId++,o.length!==0?{arguments:t,invocationId:r.toString(),streamIds:o,target:e,type:h.Invocation}:{arguments:t,invocationId:r.toString(),target:e,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 r;o instanceof Error?r=o.message:o&&o.toString?r=o.toString():r="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,r)))},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 r=e[o];if(this._isObservable(r)){let a=this._invocationId;this._invocationId++,t[a]=r,n.push(a.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?{arguments:t,invocationId:o.toString(),streamIds:n,target:e,type:h.StreamInvocation}:{arguments:t,invocationId:o.toString(),target:e,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}}};var et=[0,2e3,1e4,3e4,null],F=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:et}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var H=(()=>{class i{}return i.Authorization="Authorization",i.Cookie="Cookie",i})();var le=class extends T{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return d(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[H.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[H.Authorization]&&delete e.headers[H.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var w=function(i){return i[i.None=0]="None",i[i.WebSockets=1]="WebSockets",i[i.ServerSentEvents=2]="ServerSentEvents",i[i.LongPolling=4]="LongPolling",i}(w||{}),b=function(i){return i[i.Text=1]="Text",i[i.Binary=2]="Binary",i}(b||{});var he=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 q=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new he,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return d(this,null,function*(){if(g.isRequired(e,"url"),g.isRequired(t,"transferFormat"),g.isIn(t,b,"transferFormat"),this._url=e,this._logger.log(s.Trace,"(LongPolling transport) Connecting."),t===b.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]=P(),r=_({[n]:o},this._options.headers),a={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===b.Binary&&(a.responseType="arraybuffer");let c=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${c}.`);let l=yield this._httpClient.get(c,a);l.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new v(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,a)})}_poll(e,t){return d(this,null,function*(){try{for(;this._running;)try{let n=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${n}.`);let o=yield this._httpClient.get(n,t);o.statusCode===204?(this._logger.log(s.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new v(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(s.Trace,`(LongPolling transport) data received. ${N(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof $?this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(s.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(s.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return d(this,null,function*(){return this._running?ee(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return d(this,null,function*(){this._logger.log(s.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(s.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,n]=P();e[t]=n;let o={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},r;try{yield this._httpClient.delete(this._url,o)}catch(a){r=a}r?r instanceof v&&(r.statusCode===404?this._logger.log(s.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(s.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(s.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(s.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(s.Trace,e),this.onclose(this._closeError)}}};var ue=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 d(this,null,function*(){return g.isRequired(e,"url"),g.isRequired(t,"transferFormat"),g.isIn(t,b,"transferFormat"),this._logger.log(s.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let r=!1;if(t!==b.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let a;if(p.isBrowser||p.isWebWorker)a=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let c=this._httpClient.getCookieString(e),l={};l.Cookie=c;let[u,f]=P();l[u]=f,a=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{a.onmessage=c=>{if(this.onreceive)try{this._logger.log(s.Trace,`(SSE transport) data received. ${N(c.data,this._options.logMessageContent)}.`),this.onreceive(c.data)}catch(l){this._close(l);return}},a.onerror=c=>{r?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."))},a.onopen=()=>{this._logger.log(s.Information,`SSE connected to ${this._url}`),this._eventSource=a,r=!0,n()}}catch(c){o(c);return}})})}send(e){return d(this,null,function*(){return this._eventSource?ee(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 de=class{constructor(e,t,n,o,r,a){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=a}connect(e,t){return d(this,null,function*(){g.isRequired(e,"url"),g.isRequired(t,"transferFormat"),g.isIn(t,b,"transferFormat"),this._logger.log(s.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=yield this._accessTokenFactory()),new Promise((o,r)=>{e=e.replace(/^http/,"ws");let a,c=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,D]=P();u[f]=D,n&&(u[H.Authorization]=`Bearer ${n}`),c&&(u[H.Cookie]=c),a=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);a||(a=new this._webSocketConstructor(e)),t===b.Binary&&(a.binaryType="arraybuffer"),a.onopen=u=>{this._logger.log(s.Information,`WebSocket connected to ${e}.`),this._webSocket=a,l=!0,o()},a.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(s.Information,`(WebSockets transport) ${f}.`)},a.onmessage=u=>{if(this._logger.log(s.Trace,`(WebSockets transport) data received. ${N(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},a.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.",r(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(s.Trace,`(WebSockets transport) sending data. ${N(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(s.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 Fe=100,fe=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,g.isRequired(e,"url"),this._logger=Be(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 L<"u"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:L;n=r("ws"),o=r("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 le(t.httpClient||new ie(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return d(this,null,function*(){if(e=e||b.Binary,g.isIn(e,b,"transferFormat"),this._logger.log(s.Debug,`Starting connection with transfer format '${b[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(s.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(s.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 Ce(this.transport)),this._sendQueue.send(e))}stop(e){return d(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(s.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(s.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 d(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(s.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(s.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return d(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===w.WebSockets)this.transport=this._constructTransport(w.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 r=n.accessToken;this._accessTokenFactory=()=>r,this._httpClient._accessToken=r,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<Fe);if(o===Fe&&n.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,n,e)}this.transport instanceof q&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(s.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(s.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}})}_getNegotiationResponse(e){return d(this,null,function*(){let t={},[n,o]=P();t[n]=o;let r=this._resolveNegotiateUrl(e);this._logger.log(s.Debug,`Sending negotiation request: ${r}.`);try{let a=yield this._httpClient.post(r,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(a.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${a.statusCode}'`));let c=JSON.parse(a.content);return(!c.negotiateVersion||c.negotiateVersion<1)&&(c.connectionToken=c.connectionId),c.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new O("Client didn't negotiate Stateful Reconnect but the server did.")):c}catch(a){let c="Failed to complete negotiation with the server: "+a;return a instanceof v&&a.statusCode===404&&(c=c+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(s.Error,c),Promise.reject(new O(c))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,n,o){return d(this,null,function*(){let r=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(s.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(r,o),this.connectionId=n.connectionId;return}let a=[],c=n.availableTransports||[],l=n;for(let u of c){let f=this._resolveTransportOrError(u,t,o,l?.useStatefulReconnect===!0);if(f instanceof Error)a.push(`${u.transport} failed:`),a.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(D){return Promise.reject(D)}r=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(r,o),this.connectionId=l.connectionId;return}catch(D){if(this._logger.log(s.Error,`Failed to start the transport '${u.transport}': ${D}`),l=void 0,a.push(new Y(`${u.transport} failed: ${D}`,w[u.transport])),this._connectionState!=="Connecting"){let ye="Failed to select transport before stop() was called.";return this._logger.log(s.Debug,ye),Promise.reject(new S(ye))}}}}return a.length>0?Promise.reject(new Q(`Unable to connect to the server with any of the available transports. ${a.join(" ")}`,a)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case w.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new de(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case w.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ue(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case w.LongPolling:return new q(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=>d(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 r=w[e.transport];if(r==null)return this._logger.log(s.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(tt(t,r))if(e.transferFormats.map(c=>b[c]).indexOf(n)>=0){if(r===w.WebSockets&&!this._options.WebSocket||r===w.ServerSentEvents&&!this._options.EventSource)return this._logger.log(s.Debug,`Skipping transport '${w[r]}' because it is not supported in your environment.'`),new X(`'${w[r]}' is not supported in your environment.`,r);this._logger.log(s.Debug,`Selecting transport '${w[r]}'.`);try{return this.features.reconnect=r===w.WebSockets?o:void 0,this._constructTransport(r)}catch(c){return c}}else return this._logger.log(s.Debug,`Skipping transport '${w[r]}' because it does not support the requested transfer format '${b[n]}'.`),new Error(`'${w[r]}' does not support ${b[n]}.`);else return this._logger.log(s.Debug,`Skipping transport '${w[r]}' because it was disabled by the client.`),new G(`'${w[r]}' is disabled by the client.`,r)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(s.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(s.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(s.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(s.Error,`Connection disconnected with error '${e}'.`):this._logger.log(s.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(s.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(s.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(s.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 tt(i,e){return!i||(e&i)!==0}var Ce=class i{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new B,this._transportResult=new B,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new B),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 d(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new B;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):i._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(r=>r.byteLength).reduce((r,a)=>r+a),n=new Uint8Array(t),o=0;for(let r of e)n.set(new Uint8Array(r),o),o+=r.byteLength;return n.buffer}},B=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var nt="json",ge=class{constructor(){this.name=nt,this.version=2,this.transferFormat=b.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=x.instance);let n=k.parse(e),o=[];for(let r of n){let a=JSON.parse(r);if(typeof a.type!="number")throw new Error("Invalid payload.");switch(a.type){case h.Invocation:this._isInvocationMessage(a);break;case h.StreamItem:this._isStreamItemMessage(a);break;case h.Completion:this._isCompletionMessage(a);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(a);break;case h.Sequence:this._isSequenceMessage(a);break;default:t.log(s.Information,"Unknown message type '"+a.type+"' ignored.");continue}o.push(a)}return o}writeMessage(e){return k.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 ot={trace:s.Trace,debug:s.Debug,info:s.Information,information:s.Information,warn:s.Warning,warning:s.Warning,error:s.Error,critical:s.Critical,none:s.None};function it(i){let e=ot[i.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${i}`)}var z=class{configureLogging(e){if(g.isRequired(e,"logging"),rt(e))this.logger=e;else if(typeof e=="string"){let t=it(e);this.logger=new A(t)}else this.logger=new A(e);return this}withUrl(e,t){return g.isRequired(e,"url"),g.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=M(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return g.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 F(e):this.reconnectPolicy=e:this.reconnectPolicy=new F,this}withServerTimeout(e){return g.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return g.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 fe(this.url,e);return ce.create(t,this.logger||x.instance,this.protocol||new ge,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function rt(i){return i.log!==void 0}function ct(i,e){if(i&1&&(C(0,"span",11),be(1,"i",12),y(),C(2,"h4",13),I(3),y()),i&2){let t=J();R(3),W(t.data==null?null:t.data.Title)}}function lt(i,e){if(i&1&&(C(0,"span",14),be(1,"i",15),y(),C(2,"h4",16),I(3),y()),i&2){let t=J();R(3),W(t.data==null?null:t.data.Title)}}function ht(i,e){if(i&1&&(C(0,"div",4),I(1),y()),i&2){let t=J();R(),xe(" ",(t.data==null?null:t.data.Message)||"An error occurred during scan."," ")}}var qe=(()=>{class i{constructor(){this.data=pe(Me),this.dialogRef=pe(He),this.modalConfig=new We,this.modalConfig.title="Scan Product Notification",this.modalConfig.customWidth="500px",this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close",this.modalConfig.headerType=this.data?.StatusCode==200?we.Success:we.Error}onOk(){this.dialogRef.close()}onCancel(){this.dialogRef.close()}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=Ee({type:i,selectors:[["app-dialog-scan-notification"]],decls:26,vars:12,consts:[[3,"onClose","onCancel","onOk","config"],["content",""],[1,"card","shadow","rounded-4","border-0","p-4",2,"background","#f8fafc","margin-bottom","0px"],[1,"d-flex","align-items-center","mb-4"],[1,"alert","alert-danger","fw-bold","mb-4","p-2","rounded-3"],[1,"lh-base","list-group","list-group-flush","mb-3","rounded-3","overflow-hidden"],[1,"list-group-item","bg-transparent","d-flex","justify-content-between","align-items-center","border-0"],[1,"fw-semibold","fs-5"],[1,"fw-bold","text-dark","fs-5"],[1,"fw-bold","text-success","fs-5"],[1,"fw-bold","text-danger","fs-5"],[1,"bg-success","bg-opacity-10","rounded-circle","d-flex","align-items-center","justify-content-center","me-3",2,"width","48px","height","48px"],[1,"fas","fa-check-circle","text-success","fs-2"],[1,"mb-0","text-success","fw-bold"],[1,"bg-danger","bg-opacity-10","rounded-circle","d-flex","align-items-center","justify-content-center","me-3",2,"width","48px","height","48px"],[1,"fas","fa-exclamation-triangle","text-danger","fs-2"],[1,"mb-0","text-danger","fw-bold"]],template:function(n,o){n&1&&(C(0,"modal-material",0),Te("onClose",function(){return o.onCancel()})("onCancel",function(){return o.onCancel()})("onOk",function(){return o.onOk()}),C(1,"div",1)(2,"div",2)(3,"div",3),_e(4,ct,4,1)(5,lt,4,1),y(),_e(6,ht,2,1,"div",4),C(7,"ul",5)(8,"li",6)(9,"span",7),I(10,"Total Products Scanned"),y(),C(11,"span",8),I(12),V(13,"number"),y()(),C(14,"li",6)(15,"span",7),I(16,"Products Found"),y(),C(17,"span",9),I(18),V(19,"number"),y()(),C(20,"li",6)(21,"span",7),I(22,"Products Not Found"),y(),C(23,"span",10),I(24),V(25,"number"),y()()()()()()),n&2&&(Ie("config",o.modalConfig),R(4),me(o.data.StatusCode==200?4:5),R(2),me(o.data.StatusCode!=200?6:-1),R(6),W(K(13,6,o.data==null?null:o.data.Total)),R(6),W(K(19,8,o.data==null?null:o.data.Found)),R(6),W(K(25,10,o.data==null?null:o.data.NotFound)))},dependencies:[De,Pe,je],encapsulation:2})}}return i})();var Co=(()=>{class i{constructor(t,n,o,r){this.decodeTokenService=t,this.toastr=n,this.httpService=o,this.dialog=r,this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let t=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new ve(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(Ae.GetJobScanDetail,{ID:t})}buildConnection(){this.hubConnection=new z().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(s.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){if(typeof t=="string"){let n=JSON.parse(t);this.setNotification(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}))}else{let n=t.message?JSON.parse(t.message):null;this.dialog.open(qe,{data:n,id:"DialogScanNotificationComponent"})}}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}static{this.\u0275fac=function(n){return new(n||i)(U(Ne),U(Re),U($e),U(Le))}}static{this.\u0275prov=ke({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{Co as a};
|
|
1
|
+
import{a as Ne}from"./chunk-J53BPEDH.js";import{a as Ae}from"./chunk-MW6Q6DZF.js";import{b as Re,e as $e}from"./chunk-W5L6FMO3.js";import{b as He,c as Me,d as Le,i as we,j as We,k as je}from"./chunk-FO7G4GMY.js";import{m as Pe,n as De}from"./chunk-FXQKRJWU.js";import{$c as V,Gb as Ee,Gc as I,Hc as W,Ic as xe,Mb as _e,Yb as Ie,ad as K,dc as me,g as ve,ic as C,ja as ke,jc as y,kc as be,oa as U,pa as pe,rb as R,tc as Te,uc as J}from"./chunk-OJMQBH6T.js";import{a as _,b as M,c as L,i as d}from"./chunk-66YHNWRR.js";var v=class extends Error{constructor(e,t){let n=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=n}},$=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}},X=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=n}},G=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=n}},Y=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=n}},O=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},Q=class extends Error{constructor(e,t){let n=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=n}};var j=class{constructor(e,t,n){this.statusCode=e,this.statusText=t,this.content=n}},T=class{get(e,t){return this.send(M(_({},t),{method:"GET",url:e}))}post(e,t){return this.send(M(_({},t),{method:"POST",url:e}))}delete(e,t){return this.send(M(_({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var s=function(i){return i[i.Trace=0]="Trace",i[i.Debug=1]="Debug",i[i.Information=2]="Information",i[i.Warning=3]="Warning",i[i.Error=4]="Error",i[i.Critical=5]="Critical",i[i.None=6]="None",i}(s||{});var x=class{constructor(){}log(e,t){}};x.instance=new x;var ze="8.0.17",g=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 i{static get isBrowser(){return!i.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!i.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!i.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function N(i,e){let t="";return E(i)?(t=`Binary data of length ${i.byteLength}`,e&&(t+=`. Content: '${Je(i)}'`)):typeof i=="string"&&(t=`String data of length ${i.length}`,e&&(t+=`. Content: '${i}'`)),t}function Je(i){let e=new Uint8Array(i),t="";return e.forEach(n=>{let o=n<16?"0":"";t+=`0x${o}${n.toString(16)} `}),t.substr(0,t.length-1)}function E(i){return i&&typeof ArrayBuffer<"u"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function ee(i,e,t,n,o,r){return d(this,null,function*(){let a={},[c,l]=P();a[c]=l,i.log(s.Trace,`(${e} transport) sending data. ${N(o,r.logMessageContent)}.`);let u=E(o)?"arraybuffer":"text",f=yield t.post(n,{content:o,headers:_(_({},a),r.headers),responseType:u,timeout:r.timeout,withCredentials:r.withCredentials});i.log(s.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)})}function Be(i){return i===void 0?new A(s.Information):i===null?x.instance:i.log!==void 0?i:new A(i)}var Z=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=>{})}},A=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let n=`[${new Date().toISOString()}] ${s[e]}: ${t}`;switch(e){case s.Critical:case s.Error:this.out.error(n);break;case s.Warning:this.out.warn(n);break;case s.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function P(){let i="X-SignalR-User-Agent";return p.isNode&&(i="User-Agent"),[i,Ve(ze,Ke(),Ge(),Xe())]}function Ve(i,e,t,n){let o="Microsoft SignalR/",r=i.split(".");return o+=`${r[0]}.${r[1]}`,o+=` (${i}; `,e&&e!==""?o+=`${e}; `:o+="Unknown OS; ",o+=`${t}`,n?o+=`; ${n}`:o+="; Unknown Runtime Version",o+=")",o}function Ke(){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 Ge(){return p.isNode?"NodeJS":"Browser"}function te(i){return i.stack?i.stack:i.message?i.message:`${i}`}function Ue(){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 ne=class extends T{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||p.isNode){let t=typeof __webpack_require__=="function"?__non_webpack_require__:L;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(Ue());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:L;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return d(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(s.Warning,"Timeout from HTTP request."),n=new $},l)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},E(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let r;try{r=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(s.Warning,`Error from HTTP request. ${l}.`),l)}finally{o&&clearTimeout(o),e.abortSignal&&(e.abortSignal.onabort=null)}if(!r.ok){let l=yield Oe(r,"text");throw new v(l||r.statusText,r.status)}let c=yield Oe(r,e.responseType);return new j(r.status,r.statusText,c)})}getCookieString(e){let t="";return p.isNode&&this._jar&&this._jar.getCookies(e,(n,o)=>t=o.join("; ")),t}};function Oe(i,e){let t;switch(e){case"arraybuffer":t=i.arrayBuffer();break;case"text":t=i.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=i.text();break}return t}var oe=class extends T{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&&(E(e.content)?o.setRequestHeader("Content-Type","application/octet-stream"):o.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let r=e.headers;r&&Object.keys(r).forEach(a=>{o.setRequestHeader(a,r[a])}),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 j(o.status,o.statusText,o.response||o.responseText)):n(new v(o.response||o.responseText||o.statusText,o.status))},o.onerror=()=>{this._logger.log(s.Warning,`Error from HTTP request. ${o.status}: ${o.statusText}.`),n(new v(o.statusText,o.status))},o.ontimeout=()=>{this._logger.log(s.Warning,"Timeout from HTTP request."),n(new $)},o.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var ie=class extends T{constructor(e){if(super(),typeof fetch<"u"||p.isNode)this._httpClient=new ne(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new oe(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 k=class i{static write(e){return`${e}${i.RecordSeparator}`}static parse(e){if(e[e.length-1]!==i.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(i.RecordSeparator);return t.pop(),t}};k.RecordSeparatorCode=30;k.RecordSeparator=String.fromCharCode(k.RecordSeparatorCode);var re=class{writeHandshakeRequest(e){return k.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,n;if(E(e)){let c=new Uint8Array(e),l=c.indexOf(k.RecordSeparatorCode);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(c.slice(0,u))),n=c.byteLength>u?c.slice(u).buffer:null}else{let c=e,l=c.indexOf(k.RecordSeparator);if(l===-1)throw new Error("Message is incomplete.");let u=l+1;t=c.substring(0,u),n=c.length>u?c.substring(u):null}let o=k.parse(t),r=JSON.parse(o[0]);if(r.type)throw new Error("Expected a handshake response from the server.");return[n,r]}};var h=function(i){return i[i.Invocation=1]="Invocation",i[i.StreamItem=2]="StreamItem",i[i.Completion=3]="Completion",i[i.StreamInvocation=4]="StreamInvocation",i[i.CancelInvocation=5]="CancelInvocation",i[i.Ping=6]="Ping",i[i.Close=7]="Close",i[i.Ack=8]="Ack",i[i.Sequence=9]="Sequence",i}(h||{});var se=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 Z(this,e)}};var ae=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 d(this,null,function*(){let t=this._protocol.writeMessage(e),n=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let o=()=>{},r=()=>{};E(t)?this._bufferedByteCount+=t.byteLength:this._bufferedByteCount+=t.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((a,c)=>{o=a,r=c})),this._messages.push(new Se(t,this._totalMessageCount,o,r))}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,E(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 d(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(()=>d(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))}},Se=class{constructor(e,t,n,o){this._message=e,this._id=t,this._resolver=n,this._rejector=o}};var Ye=30*1e3,Qe=15*1e3,Ze=1e5,m=function(i){return i.Disconnected="Disconnected",i.Connecting="Connecting",i.Connected="Connected",i.Disconnecting="Disconnecting",i.Reconnecting="Reconnecting",i}(m||{}),ce=class i{static create(e,t,n,o,r,a,c){return new i(e,t,n,o,r,a,c)}constructor(e,t,n,o,r,a,c){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(s.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")},g.isRequired(e,"connection"),g.isRequired(t,"logger"),g.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=r??Ye,this.keepAliveIntervalInMilliseconds=a??Qe,this._statefulReconnectBufferSize=c??Ze,this._logger=t,this._protocol=n,this.connection=e,this._reconnectPolicy=o,this._handshakeProtocol=new re,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 d(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(s.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(s.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(s.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return d(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(s.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(s.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 ae(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(s.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return d(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(s.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(s.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(s.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(s.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 d(this,null,function*(){try{yield this._sendWithProtocol(this._createCloseMessage())}catch{}})}stream(e,...t){let[n,o]=this._replaceStreamingParams(t),r=this._createStreamInvocation(e,t,o),a,c=new se;return c.cancelCallback=()=>{let l=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],a.then(()=>this._sendWithProtocol(l))},this._callbacks[r.invocationId]=(l,u)=>{if(u){c.error(u);return}else l&&(l.type===h.Completion?l.error?c.error(new Error(l.error)):c.complete():c.next(l.item))},a=this._sendWithProtocol(r).catch(l=>{c.error(l),delete this._callbacks[r.invocationId]}),this._launchStreams(n,a),c}_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),r=this._sendWithProtocol(this._createInvocation(e,t,!0,o));return this._launchStreams(n,r),r}invoke(e,...t){let[n,o]=this._replaceStreamingParams(t),r=this._createInvocation(e,t,!1,o);return new Promise((c,l)=>{this._callbacks[r.invocationId]=(f,D)=>{if(D){l(D);return}else f&&(f.type===h.Completion?f.error?l(new Error(f.error)):c(f.result):l(new Error(`Unexpected message type: ${f.type}`)))};let u=this._sendWithProtocol(r).catch(f=>{l(f),delete this._callbacks[r.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(s.Error,`Invoke client method threw error: ${te(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(r){this._logger.log(s.Error,`Stream callback threw error: ${te(r)}`)}}break}case h.Ping:break;case h.Close:{this._logger.log(s.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(s.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,n;try{[n,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(o){let r="Error parsing handshake response: "+o;this._logger.log(s.Error,r);let a=new Error(r);throw this._handshakeRejecter(a),a}if(t.error){let o="Server returned handshake error: "+t.error;this._logger.log(s.Error,o);let r=new Error(o);throw this._handshakeRejecter(r),r}else this._logger.log(s.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),this._pingServerHandle===void 0)){let e=this._nextKeepAlive-new Date().getTime();e<0&&(e=0),this._pingServerHandle=setTimeout(()=>d(this,null,function*(){if(this._connectionState===m.Connected)try{yield this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}),e)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(e){return d(this,null,function*(){let t=e.target.toLowerCase(),n=this._methods[t];if(!n){this._logger.log(s.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(s.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(),r=!!e.invocationId,a,c,l;for(let u of o)try{let f=a;a=yield u.apply(this,e.arguments),r&&a&&f&&(this._logger.log(s.Error,`Multiple results provided for '${t}'. Sending error to server.`),l=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),c=void 0}catch(f){c=f,this._logger.log(s.Error,`A callback for the method '${t}' threw error '${f}'.`)}l?yield this._sendWithProtocol(l):r?(c?l=this._createCompletionMessage(e.invocationId,`${c}`,null):a!==void 0?l=this._createCompletionMessage(e.invocationId,null,a):(this._logger.log(s.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)):a&&this._logger.log(s.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(s.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(s.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return d(this,null,function*(){let t=Date.now(),n=0,o=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(n++,0,o);if(r===null){this._logger.log(s.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(s.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(s.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(a=>a.apply(this,[e]))}catch(a){this._logger.log(s.Error,`An onreconnecting callback called with error '${e}' threw error '${a}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;r!==null;){if(this._logger.log(s.Information,`Reconnect attempt number ${n} will start in ${r} ms.`),yield new Promise(a=>{this._reconnectDelayHandle=setTimeout(a,r)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(s.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(a=>a.apply(this,[this.connection.connectionId]))}catch(a){this._logger.log(s.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${a}'.`)}return}catch(a){if(this._logger.log(s.Information,`Reconnect attempt failed because of error '${a}'.`),this._connectionState!==m.Reconnecting){this._logger.log(s.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}o=a instanceof Error?a:new Error(a.toString()),r=this._getNextRetryDelay(n++,Date.now()-t,o)}}this._logger.log(s.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(s.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(r){this._logger.log(s.Error,`Stream 'error' callback called with '${e}' threw error: ${te(r)}`)}})}_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?{arguments:t,streamIds:o,target:e,type:h.Invocation}:{arguments:t,target:e,type:h.Invocation};{let r=this._invocationId;return this._invocationId++,o.length!==0?{arguments:t,invocationId:r.toString(),streamIds:o,target:e,type:h.Invocation}:{arguments:t,invocationId:r.toString(),target:e,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 r;o instanceof Error?r=o.message:o&&o.toString?r=o.toString():r="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,r)))},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 r=e[o];if(this._isObservable(r)){let a=this._invocationId;this._invocationId++,t[a]=r,n.push(a.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?{arguments:t,invocationId:o.toString(),streamIds:n,target:e,type:h.StreamInvocation}:{arguments:t,invocationId:o.toString(),target:e,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}}};var et=[0,2e3,1e4,3e4,null],F=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:et}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var H=(()=>{class i{}return i.Authorization="Authorization",i.Cookie="Cookie",i})();var le=class extends T{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return d(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[H.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[H.Authorization]&&delete e.headers[H.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var w=function(i){return i[i.None=0]="None",i[i.WebSockets=1]="WebSockets",i[i.ServerSentEvents=2]="ServerSentEvents",i[i.LongPolling=4]="LongPolling",i}(w||{}),b=function(i){return i[i.Text=1]="Text",i[i.Binary=2]="Binary",i}(b||{});var he=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 q=class{get pollAborted(){return this._pollAbort.aborted}constructor(e,t,n){this._httpClient=e,this._logger=t,this._pollAbort=new he,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}connect(e,t){return d(this,null,function*(){if(g.isRequired(e,"url"),g.isRequired(t,"transferFormat"),g.isIn(t,b,"transferFormat"),this._url=e,this._logger.log(s.Trace,"(LongPolling transport) Connecting."),t===b.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]=P(),r=_({[n]:o},this._options.headers),a={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};t===b.Binary&&(a.responseType="arraybuffer");let c=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${c}.`);let l=yield this._httpClient.get(c,a);l.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new v(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,a)})}_poll(e,t){return d(this,null,function*(){try{for(;this._running;)try{let n=`${e}&_=${Date.now()}`;this._logger.log(s.Trace,`(LongPolling transport) polling: ${n}.`);let o=yield this._httpClient.get(n,t);o.statusCode===204?(this._logger.log(s.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):o.statusCode!==200?(this._logger.log(s.Error,`(LongPolling transport) Unexpected response code: ${o.statusCode}.`),this._closeError=new v(o.statusText||"",o.statusCode),this._running=!1):o.content?(this._logger.log(s.Trace,`(LongPolling transport) data received. ${N(o.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(o.content)):this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof $?this._logger.log(s.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(s.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(s.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return d(this,null,function*(){return this._running?ee(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return d(this,null,function*(){this._logger.log(s.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(s.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,n]=P();e[t]=n;let o={headers:_(_({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials},r;try{yield this._httpClient.delete(this._url,o)}catch(a){r=a}r?r instanceof v&&(r.statusCode===404?this._logger.log(s.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(s.Trace,`(LongPolling transport) Error sending a DELETE request: ${r}`)):this._logger.log(s.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(s.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(s.Trace,e),this.onclose(this._closeError)}}};var ue=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 d(this,null,function*(){return g.isRequired(e,"url"),g.isRequired(t,"transferFormat"),g.isIn(t,b,"transferFormat"),this._logger.log(s.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,o)=>{let r=!1;if(t!==b.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let a;if(p.isBrowser||p.isWebWorker)a=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let c=this._httpClient.getCookieString(e),l={};l.Cookie=c;let[u,f]=P();l[u]=f,a=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:_(_({},l),this._options.headers)})}try{a.onmessage=c=>{if(this.onreceive)try{this._logger.log(s.Trace,`(SSE transport) data received. ${N(c.data,this._options.logMessageContent)}.`),this.onreceive(c.data)}catch(l){this._close(l);return}},a.onerror=c=>{r?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."))},a.onopen=()=>{this._logger.log(s.Information,`SSE connected to ${this._url}`),this._eventSource=a,r=!0,n()}}catch(c){o(c);return}})})}send(e){return d(this,null,function*(){return this._eventSource?ee(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 de=class{constructor(e,t,n,o,r,a){this._logger=n,this._accessTokenFactory=t,this._logMessageContent=o,this._webSocketConstructor=r,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=a}connect(e,t){return d(this,null,function*(){g.isRequired(e,"url"),g.isRequired(t,"transferFormat"),g.isIn(t,b,"transferFormat"),this._logger.log(s.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=yield this._accessTokenFactory()),new Promise((o,r)=>{e=e.replace(/^http/,"ws");let a,c=this._httpClient.getCookieString(e),l=!1;if(p.isNode||p.isReactNative){let u={},[f,D]=P();u[f]=D,n&&(u[H.Authorization]=`Bearer ${n}`),c&&(u[H.Cookie]=c),a=new this._webSocketConstructor(e,void 0,{headers:_(_({},u),this._headers)})}else n&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);a||(a=new this._webSocketConstructor(e)),t===b.Binary&&(a.binaryType="arraybuffer"),a.onopen=u=>{this._logger.log(s.Information,`WebSocket connected to ${e}.`),this._webSocket=a,l=!0,o()},a.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(s.Information,`(WebSockets transport) ${f}.`)},a.onmessage=u=>{if(this._logger.log(s.Trace,`(WebSockets transport) data received. ${N(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(f){this._close(f);return}},a.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.",r(new Error(f))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(s.Trace,`(WebSockets transport) sending data. ${N(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(s.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 Fe=100,fe=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,g.isRequired(e,"url"),this._logger=Be(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 L<"u"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:L;n=r("ws"),o=r("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 le(t.httpClient||new ie(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return d(this,null,function*(){if(e=e||b.Binary,g.isIn(e,b,"transferFormat"),this._logger.log(s.Debug,`Starting connection with transfer format '${b[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(s.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(s.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 Ce(this.transport)),this._sendQueue.send(e))}stop(e){return d(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(s.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(s.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 d(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(s.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(s.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return d(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===w.WebSockets)this.transport=this._constructTransport(w.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 r=n.accessToken;this._accessTokenFactory=()=>r,this._httpClient._accessToken=r,this._httpClient._accessTokenFactory=void 0}o++}while(n.url&&o<Fe);if(o===Fe&&n.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,n,e)}this.transport instanceof q&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(s.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(s.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}})}_getNegotiationResponse(e){return d(this,null,function*(){let t={},[n,o]=P();t[n]=o;let r=this._resolveNegotiateUrl(e);this._logger.log(s.Debug,`Sending negotiation request: ${r}.`);try{let a=yield this._httpClient.post(r,{content:"",headers:_(_({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(a.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${a.statusCode}'`));let c=JSON.parse(a.content);return(!c.negotiateVersion||c.negotiateVersion<1)&&(c.connectionToken=c.connectionId),c.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new O("Client didn't negotiate Stateful Reconnect but the server did.")):c}catch(a){let c="Failed to complete negotiation with the server: "+a;return a instanceof v&&a.statusCode===404&&(c=c+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(s.Error,c),Promise.reject(new O(c))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,n,o){return d(this,null,function*(){let r=this._createConnectUrl(e,n.connectionToken);if(this._isITransport(t)){this._logger.log(s.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(r,o),this.connectionId=n.connectionId;return}let a=[],c=n.availableTransports||[],l=n;for(let u of c){let f=this._resolveTransportOrError(u,t,o,l?.useStatefulReconnect===!0);if(f instanceof Error)a.push(`${u.transport} failed:`),a.push(f);else if(this._isITransport(f)){if(this.transport=f,!l){try{l=yield this._getNegotiationResponse(e)}catch(D){return Promise.reject(D)}r=this._createConnectUrl(e,l.connectionToken)}try{yield this._startTransport(r,o),this.connectionId=l.connectionId;return}catch(D){if(this._logger.log(s.Error,`Failed to start the transport '${u.transport}': ${D}`),l=void 0,a.push(new Y(`${u.transport} failed: ${D}`,w[u.transport])),this._connectionState!=="Connecting"){let ye="Failed to select transport before stop() was called.";return this._logger.log(s.Debug,ye),Promise.reject(new S(ye))}}}}return a.length>0?Promise.reject(new Q(`Unable to connect to the server with any of the available transports. ${a.join(" ")}`,a)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case w.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new de(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case w.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new ue(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case w.LongPolling:return new q(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=>d(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 r=w[e.transport];if(r==null)return this._logger.log(s.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(tt(t,r))if(e.transferFormats.map(c=>b[c]).indexOf(n)>=0){if(r===w.WebSockets&&!this._options.WebSocket||r===w.ServerSentEvents&&!this._options.EventSource)return this._logger.log(s.Debug,`Skipping transport '${w[r]}' because it is not supported in your environment.'`),new X(`'${w[r]}' is not supported in your environment.`,r);this._logger.log(s.Debug,`Selecting transport '${w[r]}'.`);try{return this.features.reconnect=r===w.WebSockets?o:void 0,this._constructTransport(r)}catch(c){return c}}else return this._logger.log(s.Debug,`Skipping transport '${w[r]}' because it does not support the requested transfer format '${b[n]}'.`),new Error(`'${w[r]}' does not support ${b[n]}.`);else return this._logger.log(s.Debug,`Skipping transport '${w[r]}' because it was disabled by the client.`),new G(`'${w[r]}' is disabled by the client.`,r)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(s.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(s.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(s.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(s.Error,`Connection disconnected with error '${e}'.`):this._logger.log(s.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(s.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(s.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(s.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 tt(i,e){return!i||(e&i)!==0}var Ce=class i{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new B,this._transportResult=new B,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new B),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 d(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new B;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):i._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(r=>r.byteLength).reduce((r,a)=>r+a),n=new Uint8Array(t),o=0;for(let r of e)n.set(new Uint8Array(r),o),o+=r.byteLength;return n.buffer}},B=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var nt="json",ge=class{constructor(){this.name=nt,this.version=2,this.transferFormat=b.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=x.instance);let n=k.parse(e),o=[];for(let r of n){let a=JSON.parse(r);if(typeof a.type!="number")throw new Error("Invalid payload.");switch(a.type){case h.Invocation:this._isInvocationMessage(a);break;case h.StreamItem:this._isStreamItemMessage(a);break;case h.Completion:this._isCompletionMessage(a);break;case h.Ping:break;case h.Close:break;case h.Ack:this._isAckMessage(a);break;case h.Sequence:this._isSequenceMessage(a);break;default:t.log(s.Information,"Unknown message type '"+a.type+"' ignored.");continue}o.push(a)}return o}writeMessage(e){return k.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 ot={trace:s.Trace,debug:s.Debug,info:s.Information,information:s.Information,warn:s.Warning,warning:s.Warning,error:s.Error,critical:s.Critical,none:s.None};function it(i){let e=ot[i.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${i}`)}var z=class{configureLogging(e){if(g.isRequired(e,"logging"),rt(e))this.logger=e;else if(typeof e=="string"){let t=it(e);this.logger=new A(t)}else this.logger=new A(e);return this}withUrl(e,t){return g.isRequired(e,"url"),g.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=_(_({},this.httpConnectionOptions),t):this.httpConnectionOptions=M(_({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return g.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 F(e):this.reconnectPolicy=e:this.reconnectPolicy=new F,this}withServerTimeout(e){return g.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return g.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 fe(this.url,e);return ce.create(t,this.logger||x.instance,this.protocol||new ge,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function rt(i){return i.log!==void 0}function ct(i,e){if(i&1&&(C(0,"span",11),be(1,"i",12),y(),C(2,"h4",13),I(3),y()),i&2){let t=J();R(3),W(t.data==null?null:t.data.Title)}}function lt(i,e){if(i&1&&(C(0,"span",14),be(1,"i",15),y(),C(2,"h4",16),I(3),y()),i&2){let t=J();R(3),W(t.data==null?null:t.data.Title)}}function ht(i,e){if(i&1&&(C(0,"div",4),I(1),y()),i&2){let t=J();R(),xe(" ",(t.data==null?null:t.data.Message)||"An error occurred during scan."," ")}}var qe=(()=>{class i{constructor(){this.data=pe(Me),this.dialogRef=pe(He),this.modalConfig=new We,this.modalConfig.title="Scan Product Notification",this.modalConfig.customWidth="500px",this.modalConfig.hideOk=!0,this.modalConfig.cancelText="Close",this.modalConfig.headerType=this.data?.StatusCode==200?we.Success:we.Error}onOk(){this.dialogRef.close()}onCancel(){this.dialogRef.close()}static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275cmp=Ee({type:i,selectors:[["app-dialog-scan-notification"]],decls:26,vars:12,consts:[[3,"onClose","onCancel","onOk","config"],["content",""],[1,"card","shadow","rounded-4","border-0","p-4",2,"background","#f8fafc","margin-bottom","0px"],[1,"d-flex","align-items-center","mb-4"],[1,"alert","alert-danger","fw-bold","mb-4","p-2","rounded-3"],[1,"lh-base","list-group","list-group-flush","mb-3","rounded-3","overflow-hidden"],[1,"list-group-item","bg-transparent","d-flex","justify-content-between","align-items-center","border-0"],[1,"fw-semibold","fs-5"],[1,"fw-bold","text-dark","fs-5"],[1,"fw-bold","text-success","fs-5"],[1,"fw-bold","text-danger","fs-5"],[1,"bg-success","bg-opacity-10","rounded-circle","d-flex","align-items-center","justify-content-center","me-3",2,"width","48px","height","48px"],[1,"fas","fa-check-circle","text-success","fs-2"],[1,"mb-0","text-success","fw-bold"],[1,"bg-danger","bg-opacity-10","rounded-circle","d-flex","align-items-center","justify-content-center","me-3",2,"width","48px","height","48px"],[1,"fas","fa-exclamation-triangle","text-danger","fs-2"],[1,"mb-0","text-danger","fw-bold"]],template:function(n,o){n&1&&(C(0,"modal-material",0),Te("onClose",function(){return o.onCancel()})("onCancel",function(){return o.onCancel()})("onOk",function(){return o.onOk()}),C(1,"div",1)(2,"div",2)(3,"div",3),_e(4,ct,4,1)(5,lt,4,1),y(),_e(6,ht,2,1,"div",4),C(7,"ul",5)(8,"li",6)(9,"span",7),I(10,"Total Products Scanned"),y(),C(11,"span",8),I(12),V(13,"number"),y()(),C(14,"li",6)(15,"span",7),I(16,"Products Found"),y(),C(17,"span",9),I(18),V(19,"number"),y()(),C(20,"li",6)(21,"span",7),I(22,"Products Not Found"),y(),C(23,"span",10),I(24),V(25,"number"),y()()()()()()),n&2&&(Ie("config",o.modalConfig),R(4),me(o.data.StatusCode==200?4:5),R(2),me(o.data.StatusCode!=200?6:-1),R(6),W(K(13,6,o.data==null?null:o.data.Total)),R(6),W(K(19,8,o.data==null?null:o.data.Found)),R(6),W(K(25,10,o.data==null?null:o.data.NotFound)))},dependencies:[De,Pe,je],encapsulation:2})}}return i})();var Co=(()=>{class i{constructor(t,n,o,r){this.decodeTokenService=t,this.toastr=n,this.httpService=o,this.dialog=r,this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let t=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new ve(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(Ae.GetJobScanDetail,{ID:t})}buildConnection(){this.hubConnection=new z().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(s.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){if(typeof t=="string"){let n=JSON.parse(t);this.setNotification(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}))}else{let n=t.message?JSON.parse(t.message):null;this.dialog.open(qe,{data:n,id:"DialogScanNotificationComponent"})}}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}static{this.\u0275fac=function(n){return new(n||i)(U(Ne),U(Re),U($e),U(Le))}}static{this.\u0275prov=ke({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{Co as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-MW6Q6DZF.js";import{e as c}from"./chunk-W5L6FMO3.js";import{ja as i,pa as o}from"./chunk-OJMQBH6T.js";var h=(()=>{class t{constructor(){this.httpService=o(c)}getConfig(){return this.httpService.post(r.PosAccountGetConfig,{})}saveConfig(e){return this.httpService.post(r.SubmitConfig,e)}static{this.\u0275fac=function(n){return new(n||t)}}static{this.\u0275prov=i({token:t,factory:t.\u0275fac})}}return t})();export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-YERZ6W22.js";import{a as c}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-YERZ6W22.js";import{a as c}from"./chunk-MW6Q6DZF.js";import{e as u}from"./chunk-W5L6FMO3.js";import{c as p}from"./chunk-PW42BQIY.js";import{ja as s,pa as l,v as i}from"./chunk-OJMQBH6T.js";var m=(()=>{class a{constructor(){this.httpService=l(u)}getNotificationDetail(e){return this.httpService.post(c.GetJobScanDetail,{ID:e}).pipe(i(r=>{let t=r.Data;return t.DurationInSecond=t.Duration?t.Duration/1e3:0,t.ProcessLabel=this.generateLabel(t),t.ProcessDescription=this.generateDescription(t),t}))}getNotificationList(e){return this.httpService.post(c.GetJobScanList,e).pipe(i(r=>{let t=r.Data;return t=t.map(n=>(n.Img=p.getChannelLogoByTypeId(n.TypeID),n.DurationInSecond=n.Duration?n.Duration/1e3:0,n.ProcessLabel=this.generateLabel(n),n.ProcessDescription=this.generateDescription(n),n)),{Data:t,Count:r.Count}}))}generateLabel(e){let r=null;switch(e.ScanTypeID){case o.Active:r="Active";break;case o.Sellable:r="Sellable";break;case o.All:r="All";break}return`Asynchronous Scan - ${r}`}generateDescription(e){return`${e.OriginGetCount} found in ${e.ChannelName} ( ${e.SkuFoundCount} Sold In Channel + ${e.SkuNotFoundCount} Not In POS)`}static{this.\u0275fac=function(r){return new(r||a)}}static{this.\u0275prov=s({token:a,factory:a.\u0275fac})}}return a})();export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c}from"./chunk-
|
|
1
|
+
import{a as c}from"./chunk-VKFFHT27.js";import{a as B}from"./chunk-UMP6ZMEJ.js";import"./chunk-MW6Q6DZF.js";import"./chunk-W5L6FMO3.js";import"./chunk-K5XRGNWG.js";import{m as j,n as H}from"./chunk-FO7G4GMY.js";import"./chunk-5PS6ZS3N.js";import"./chunk-V3USB3ZU.js";import{b as $,c as k}from"./chunk-ERXVXBTU.js";import{r as z,s as N}from"./chunk-NNRBGHXB.js";import"./chunk-BJUPMCEP.js";import{H as A,J as L,j as O,n as w}from"./chunk-FXQKRJWU.js";import{$c as F,Gb as S,Gc as a,Hc as E,Mb as l,Nc as P,Oc as T,Pc as R,Qc as b,Sc as D,Yb as s,Z as f,ad as I,dc as h,ec as _,gc as x,hc as C,ic as i,jc as o,kc as y,lc as M,mc as g,pa as v,rb as r,uc as d}from"./chunk-OJMQBH6T.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";var K=e=>[e];function U(e,p){e&1&&(M(0),i(1,"a",10),y(2,"i",11),a(3," Edit "),o(),g())}function V(e,p){if(e&1&&(i(0,"span",12),a(1),o()),e&2){let n=d().$implicit;r(),E(n.Value)}}function q(e,p){if(e&1&&l(0,V,2,1,"span",12),e&2){let n=p.$implicit;d();let t=R(0);h(n.Key==(t.Form==null?null:t.Form.AuthorizationMode)?0:-1)}}var se=(()=>{class e{constructor(){this.setupService=v(c),this.setupData$=this.setupService.getConfig().pipe(f(1)),this.userEditRole=B.UserEdit}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275cmp=S({type:e,selectors:[["app-setup-info"]],features:[b([c])],decls:19,vars:8,consts:[["headerTitle","Setup",3,"hideSearchBox","hideSearchDropdown"],[4,"ngxPermissionsOnly"],[1,"container-fluid","py-5"],[1,"row","mt-4"],[1,"col-12"],[1,"card"],[1,"card-body","mt-8"],[1,"row"],[1,"col-6"],["matTooltipPosition","above","matTooltip","Select where Authentication and Roles are managed, Legacy (from POS) or Modern (from omni.dealpos.app)",1,"info-label-group"],["role","button","routerLink","/menu/users/setup/form",1,"btn","btn-outline-secondary"],[1,"fa","fa-edit","me-1"],["matTooltipPosition","above"]],template:function(t,u){if(t&1&&(P(0),F(1,"async"),i(2,"mainpanel",0)(3,"actions"),l(4,U,4,0,"ng-container",1),o(),i(5,"content")(6,"div",2)(7,"div",3)(8,"div",4)(9,"div",5)(10,"div",6)(11,"div",7)(12,"div",8)(13,"div",9)(14,"label"),a(15,"Authorization Mode"),o(),i(16,"div"),x(17,q,1,1,null,null,_),o()()()()()()()()()()()),t&2){let m=T(I(1,3,u.setupData$));r(2),s("hideSearchBox",!0)("hideSearchDropdown",!0),r(2),s("ngxPermissionsOnly",D(6,K,u.userEditRole)),r(13),C(m==null||m.Options==null?null:m.Options.AuthorizationMode)}},dependencies:[w,O,H,j,N,z,L,A,k,$],encapsulation:2})}}return e})();export{se as SetupInfoComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as Pt}from"./chunk-Z3ZYINRX.js";import"./chunk-UIFPDTMW.js";import{a as Et}from"./chunk-BQIB3N6V.js";import{a as Te,b as gt,c as Ct,d as xe,e as Ie}from"./chunk-2TN45S53.js";import"./chunk-6KBMGQMI.js";import{a as ft,b as be,c as _t,d as ye,f as vt,g as Tt,h as Fe,i as xt,o as ae}from"./chunk-B67DSLBY.js";import{b as St}from"./chunk-74ELVGDK.js";import{a as bt}from"./chunk-QHE3PKRD.js";import"./chunk-6RLISMEX.js";import{b as yt,d as Se}from"./chunk-TH6VZX34.js";import"./chunk-QS22J2SC.js";import"./chunk-QP4C4R4W.js";import{b as Ft}from"./chunk-FPYZBABH.js";import"./chunk-WJAE4LW2.js";import"./chunk-WFT47MCY.js";import"./chunk-LRUVI2Z3.js";import{a as At,b as kt}from"./chunk-DZYBXWL2.js";import"./chunk-LDD4NVMB.js";import"./chunk-2HNZ6XV3.js";import"./chunk-WWISWZF5.js";import"./chunk-UYLSZYOD.js";import"./chunk-M7V7A7Z6.js";import"./chunk-QBL6V7QF.js";import"./chunk-DFGZ4L65.js";import{a as It}from"./chunk-RHHHL4OR.js";import"./chunk-3FPEQHTI.js";import{a as ht,b as ve}from"./chunk-5LQRO4AI.js";import"./chunk-MO53T3IK.js";import"./chunk-W3JTS22H.js";import"./chunk-SDUUFQUI.js";import"./chunk-6L7TD5DW.js";import"./chunk-WLRPCY65.js";import"./chunk-3RK6DDJD.js";import{a as Ce}from"./chunk-3UN6FPMN.js";import{a as mt,b as dt,f as ut}from"./chunk-LDPDLCRL.js";import"./chunk-UMP6ZMEJ.js";import"./chunk-OZ7LWNOK.js";import"./chunk-UHTMVOX6.js";import"./chunk-7AE3725T.js";import"./chunk-JVNHFIYT.js";import"./chunk-3YP6ORBR.js";import{a as st,b as pt}from"./chunk-RTT3JVJM.js";import"./chunk-FJ455ZYZ.js";import"./chunk-6VHVQEVM.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-J53BPEDH.js";import"./chunk-TGMCGROM.js";import"./chunk-RDRNWLJI.js";import{b as ot,e as re}from"./chunk-W5L6FMO3.js";import"./chunk-K5XRGNWG.js";import{d as H,e as Y}from"./chunk-PYXL7UF7.js";import{b as De,c as h}from"./chunk-PW42BQIY.js";import{m as lt,n as ct}from"./chunk-FO7G4GMY.js";import{A as oe,B as G,a as Qe,c as ne,e as me,h as $,i as W,l as ge,m as Ze,n as X,q as K,r as et,s as J,t as tt,u as it,v as nt,z as q}from"./chunk-5PS6ZS3N.js";import"./chunk-V3USB3ZU.js";import"./chunk-ERXVXBTU.js";import{r as rt,s as at}from"./chunk-NNRBGHXB.js";import"./chunk-BJUPMCEP.js";import{g as A,j as k,n as T}from"./chunk-FXQKRJWU.js";import{$ as Ye,$c as x,Fc as _e,Gb as v,Gc as f,Hb as fe,Hc as ie,Ic as Q,K as Ge,Ka as D,Kc as Ke,Lc as Je,M as He,Mb as _,Mc as qe,Na as je,Oa as Me,Qc as F,Rc as he,Xb as We,Yb as s,Z as te,Zb as Oe,ad as I,ca as pe,dc as S,ea as U,ec as L,f as de,g as $e,gc as B,hc as R,ic as p,ja as M,jc as a,jd as ze,ka as ue,kc as d,lc as N,mc as w,oc as E,pa as u,rb as c,tc as y,uc as l,v as V,xa as O,xb as j,xc as Xe,ya as C,za as b}from"./chunk-OJMQBH6T.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";var z=function(t){return t[t.SINGLE_DROP_DOWN=1]="SINGLE_DROP_DOWN",t[t.SINGLE_COMBO_BOX=2]="SINGLE_COMBO_BOX",t[t.FREE_TEXT_FILED=3]="FREE_TEXT_FILED",t[t.MULTI_DROP_DOWN=4]="MULTI_DROP_DOWN",t[t.MULTI_COMBO_BOX=5]="MULTI_COMBO_BOX",t}(z||{});var le=function(t){return t[t.FORMAT_NORMAL=1]="FORMAT_NORMAL",t[t.FORMAT_QUANTITATIVE_WITH_UNIT=2]="FORMAT_QUANTITATIVE_WITH_UNIT",t}(le||{});var ce=function(t){return t[t.VALIDATOR_NO_VALIDATE_TYPE=0]="VALIDATOR_NO_VALIDATE_TYPE",t[t.VALIDATOR_INT_TYPE=1]="VALIDATOR_INT_TYPE",t[t.VALIDATOR_STRING_TYPE=2]="VALIDATOR_STRING_TYPE",t[t.VALIDATOR_FLOAT_TYPE=3]="VALIDATOR_FLOAT_TYPE",t[t.VALIDATOR_DATE_TYPE=4]="VALIDATOR_DATE_TYPE",t}(ce||{});var Ne=class extends ge{setValue(m,e){if(m instanceof Date){let i=Math.floor(m.getTime()/1e3);super.setValue(i,e)}else super.setValue(m,e)}},we=(()=>{class t{constructor(){this.shopeeUploadService=u(Te),this.formBuilder=u(q)}getAttributes(e){return this.shopeeUploadService.getAttributes(e.channelId,e.categoryId).pipe(V(i=>this.setLabelToIndonesian(i)))}setLabelToIndonesian(e=[]){let i,n;return e=e.map(o=>(i=o?.multi_lang?.find(r=>r.language=="id"),o.attribute_value_list=o?.attribute_value_list?.map(r=>(n=r?.multi_lang?.find(g=>g.language=="id"),r.name=n?.value,r)),o.name=i?.value?i?.value:o.name,o)),e}createFormGroup(e){let i=this.formBuilder.group({}),n=[];return e.forEach(o=>{if(n=[],o.mandatory&&n.push(me.required),o?.attribute_info?.format_type==le.FORMAT_QUANTITATIVE_WITH_UNIT&&o?.attribute_info?.input_type==z.FREE_TEXT_FILED){let r=this.formBuilder.group({unit:new ge(null),value:new ge(null,n)});i.addControl(JSON.stringify(o.attribute_id),r)}else o?.attribute_info?.input_type==z.FREE_TEXT_FILED&&o?.attribute_info?.input_validation_type==ce.VALIDATOR_DATE_TYPE?i.addControl(JSON.stringify(o.attribute_id),new Ne(null,n)):i.addControl(JSON.stringify(o.attribute_id),this.formBuilder.control(null,n))}),i}getFilteredAttributes(e,i){let n=JSON.parse(JSON.stringify(e)),o=Object.keys(i),r=n.filter(g=>o.findIndex(Pe=>parseInt(Pe)==g.attribute_id||g.mandatory)!=-1);return r=this.filterSelectedAttributes(r,i),r}filterSelectedAttributes(e,i){return e.map(o=>{switch(o.attribute_info.input_type){case z.MULTI_COMBO_BOX:h.IsNotEmpty(i[o.attribute_id])?o.attribute_value_list=o.attribute_value_list.filter(r=>i[o.attribute_id]?.findIndex(g=>g==r.value_id)!=-1):o.attribute_value_list=[];break;case z.FREE_TEXT_FILED:o.attribute_info.format_type==le.FORMAT_QUANTITATIVE_WITH_UNIT?o.attribute_value_list=this.setSelectedQuantitativeAttr(i[o.attribute_id]?.value,i[o.attribute_id]?.unit):o.attribute_info.input_validation_type==ce.VALIDATOR_DATE_TYPE?o.attribute_value_list=this.setSelectedDateAttr(i[o.attribute_id]):o.attribute_value_list=this.setSelectedQuantitativeAttr(i[o.attribute_id]);break;default:o.attribute_value_list=o.attribute_value_list.filter(r=>r.value_id==i[o.attribute_id])}return o}).filter(o=>o?.attribute_value_list?.length>0)}setSelectedQuantitativeAttr(e,i){let n=[];if(h.IsNotEmpty(e)){let o={value_id:0,original_value_name:JSON.stringify(e)};h.IsNotEmpty(i)&&(o.value_unit=i),n=[o]}return n}setSelectedDateAttr(e){let i=[];return h.IsNotEmpty(e)&&(i=[{value_id:0,original_value_name:JSON.stringify(e)}]),i}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac})}}return t})();var Ae=(()=>{class t{constructor(){this._calendarHeaderConfig=new $e({hideBtnClear:!1,hideBtnToday:!1}),this.calendarConfig=this._calendarHeaderConfig.value}setHeaderConfig(e){this._calendarHeaderConfig.next(e)}getHeaderConfig$(){return this._calendarHeaderConfig.asObservable()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Gt=["class","component ts"];function Ht(t,m){if(t&1){let e=E();p(0,"button",3),y("click",function(){C(e);let n=l(2);return b(n.todayClicked())}),d(1,"i",4),a()}}function Yt(t,m){if(t&1){let e=E();p(0,"button",5),y("click",function(){C(e);let n=l(2);return b(n.clearClicked())}),d(1,"i",6),a()}}function jt(t,m){if(t&1&&(N(0),_(1,Ht,2,0,"button",1)(2,Yt,2,0,"button",2),w()),t&2){let e=m.ngIf;c(),s("ngIf",!e.hideBtnToday),c(),s("ngIf",!e.hideBtnClear)}}var Ot=(()=>{class t{constructor(e,i,n,o,r){this._datePicker=e,this._calendar=i,this._dateAdapter=n,this.calendarService=o,this._destroyed=new de,i.stateChanges.pipe(pe(this._destroyed)).subscribe(g=>r.markForCheck()),this.calendarConfig$=this.calendarService.getHeaderConfig$()}todayClicked(){this._calendar.activeDate=this._dateAdapter.today(),this._datePicker.select(this._dateAdapter.today()),this._datePicker.close()}clearClicked(){this._datePicker.select(null),this._datePicker.close()}ngOnChanges(e){this._calendar.ngOnChanges(e)}ngOnDestroy(){this._destroyed.next(),this._destroyed.complete()}static{this.\u0275fac=function(i){return new(i||t)(j(Fe),j(Tt),j(be),j(Ae),j(ze))}}static{this.\u0275cmp=v({type:t,selectors:[["POS-DatepickerHeader",8,"component","ts"]],standalone:!1,features:[O],attrs:Gt,decls:3,vars:3,consts:[[4,"ngIf"],["mat-icon-button","","title","Today",3,"click",4,"ngIf"],["mat-icon-button","","title","Clear",3,"click",4,"ngIf"],["mat-icon-button","","title","Today",3,"click"],[1,"far","fa-clock",2,"font-size","18px"],["mat-icon-button","","title","Clear",3,"click"],[1,"far","fa-xmark-circle",2,"font-size","18px"]],template:function(i,n){i&1&&(p(0,"mat-calendar-header"),_(1,jt,3,2,"ng-container",0),x(2,"async"),a()),i&2&&(c(),s("ngIf",I(2,1,n.calendarConfig$)))},dependencies:[A,yt,vt,k],encapsulation:2})}}return t})(),Dt=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=fe({type:t})}static{this.\u0275inj=ue({providers:[ae],imports:[T,Se,ye,ae,Ce,ve]})}}return t})();function Wt(t,m){if(t&1&&(p(0,"mat-label",7)(1,"span"),f(2),a()()),t&2){let e=l();s("show",e.placeholder),c(2),ie(e.placeholder)}}var Xt={parse:{dateInput:"DD MMM YYYY"},display:{dateInput:"dddd, D MMMM YYYY",monthYearLabel:"MMM YYYY",dateA11yLabel:"dddd, D MMMM YYYY",monthYearA11yLabel:"MMMM YYYY"}},Nt=(()=>{class t{set hidelClearBtn(e){this.calendarService.setHeaderConfig({hideBtnClear:e,hideBtnToday:this.calendarService.calendarConfig.hideBtnToday})}change(e){let i=null;e&&(i=e.toDate(),i.setHours(0,0,0,0)),this.onChange(i),this.dateChange.emit(i)}constructor(e){this.calendarService=e,this.headerComponent=Ot,this.appearance="outline",this.isFloatingLabel=!0,this.disabled=!1,this.readOnly=!1,this.dateChange=new D,this.minDate=h.MinDate,this.onChange=i=>{},this.displayToggle=!0}writeValue(e){this.date=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){this.disabled=e}onOpenDatepicker(){let e=document.getElementById("dropdown-filter");if(e){var i=new bootstrap.Dropdown(e);i&&(i._config.autoClose="inside")}}onCloseDatepicker(){let e=document.getElementById("dropdown-filter");if(e){var i=new bootstrap.Dropdown(e);i&&(i._config.autoClose="outside")}}ngOnDestroy(){this.calendarService.setHeaderConfig({hideBtnClear:!1,hideBtnToday:!1})}static{this.\u0275fac=function(i){return new(i||t)(j(Ae))}}static{this.\u0275cmp=v({type:t,selectors:[["datepicker"]],inputs:{data_cy:"data_cy",placeholder:"placeholder",displayToggle:"displayToggle",appearance:"appearance",width:"width",isFloatingLabel:"isFloatingLabel",date:"date",disabled:"disabled",readOnly:"readOnly",minDateValidation:"minDateValidation",maxDateValidation:"maxDateValidation",hidelClearBtn:"hidelClearBtn"},outputs:{dateChange:"dateChange"},standalone:!1,features:[F([{provide:be,useClass:Et,deps:[ft]},{provide:_t,useValue:Xt},{provide:Qe,multi:!0,useExisting:t}])],decls:7,vars:16,consts:[["picker1",""],[1,"datepicker",3,"disabled","appearance"],[3,"show",4,"ngIf"],["matInput","",3,"dateChange","click","matDatepicker","min","max","placeholder","value","disabled","readonly"],["matSuffix","","aria-hidden","true",1,"datepicker-toggle-icon",3,"click"],[1,"fa-regular","fa-angle-down"],[3,"opened","closed","calendarHeaderComponent"],[3,"show"]],template:function(i,n){if(i&1){let o=E();p(0,"mat-form-field",1),_(1,Wt,3,2,"mat-label",2),p(2,"input",3),y("dateChange",function(g){return C(o),b(n.change(g.value))})("click",function(){C(o);let g=_e(6);return b(g.open())}),a(),p(3,"span",4),y("click",function(){C(o);let g=_e(6);return b(g.open())}),d(4,"i",5),a(),p(5,"mat-datepicker",6,0),y("opened",function(){return C(o),b(n.onOpenDatepicker())})("closed",function(){return C(o),b(n.onCloseDatepicker())}),a()()}if(i&2){let o=_e(6);Oe("width",n.width||100,"%"),s("disabled",n.disabled)("appearance",n.appearance),c(),s("ngIf",n.isFloatingLabel&&n.placeholder),c(),Xe("placeholder",n.placeholder||""),s("matDatepicker",o)("min",n.minDateValidation)("max",n.maxDateValidation)("value",n.date==n.minDate?null:n.date)("disabled",n.disabled)("readonly",n.readOnly),We("data-cy",n.data_cy),c(),Oe("display",n.displayToggle?"unset":"none"),c(2),s("calendarHeaderComponent",n.headerComponent)}},dependencies:[A,Fe,xt,ut,mt,dt,ht],styles:[`.mat-mdc-form-field-disabled ::ng-deep .mat-form-field-appearance-outline{background-color:#e9ecef!important;opacity:1!important}.mat-mdc-form-field-disabled ::ng-deep .mat-form-field-appearance-outline input{color:#00000061!important}.datepicker .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{min-height:3px;padding-top:18px;padding-bottom:13px}.datepicker .mat-mdc-icon-button.mat-mdc-button-base{padding:0}.datepicker .mat-mdc-form-field-subscript-wrapper{display:none}.mat-calendar-controls .mat-mdc-icon-button.mat-mdc-button-base{padding:0!important}.mat-mdc-form-field .mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{top:28px!important;font-size:16px;color:#9da2a6}.mat-mdc-text-field-wrapper .mat-mdc-form-field-flex .mat-mdc-floating-label{top:23px!important;font-size:.875rem;color:#ccc}.mdc-text-field--filled:not(.mdc-text-field--disabled){background-color:#fff}.datepicker .datepicker-toggle-icon{width:28px;height:36px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;margin-right:6px}.datepicker .datepicker-toggle-icon i{font-family:"Font Awesome 6 Pro","Font Awesome 6 Free","Font Awesome 5 Pro","Font Awesome 5 Free";font-weight:400;font-size:16px;line-height:1;color:#6b7280}
|
|
1
|
+
import{b as Pt}from"./chunk-Z3ZYINRX.js";import"./chunk-UIFPDTMW.js";import{a as Et}from"./chunk-BQIB3N6V.js";import{a as Te,b as gt,c as Ct,d as xe,e as Ie}from"./chunk-ZWEHKGL5.js";import"./chunk-6KBMGQMI.js";import{a as ft,b as be,c as _t,d as ye,f as vt,g as Tt,h as Fe,i as xt,o as ae}from"./chunk-B67DSLBY.js";import{b as St}from"./chunk-74ELVGDK.js";import{a as bt}from"./chunk-QHE3PKRD.js";import"./chunk-6RLISMEX.js";import{b as yt,d as Se}from"./chunk-TH6VZX34.js";import"./chunk-QS22J2SC.js";import"./chunk-QP4C4R4W.js";import{b as Ft}from"./chunk-FPYZBABH.js";import"./chunk-WJAE4LW2.js";import"./chunk-WFT47MCY.js";import"./chunk-LRUVI2Z3.js";import{a as At,b as kt}from"./chunk-DZYBXWL2.js";import"./chunk-LDD4NVMB.js";import"./chunk-2HNZ6XV3.js";import"./chunk-WWISWZF5.js";import"./chunk-UYLSZYOD.js";import"./chunk-M7V7A7Z6.js";import"./chunk-QBL6V7QF.js";import"./chunk-DFGZ4L65.js";import{a as It}from"./chunk-RHHHL4OR.js";import"./chunk-DQ3XZQ7W.js";import{a as ht,b as ve}from"./chunk-5LQRO4AI.js";import"./chunk-MO53T3IK.js";import"./chunk-W3JTS22H.js";import"./chunk-SDUUFQUI.js";import"./chunk-6L7TD5DW.js";import"./chunk-WLRPCY65.js";import"./chunk-3RK6DDJD.js";import{a as Ce}from"./chunk-3UN6FPMN.js";import{a as mt,b as dt,f as ut}from"./chunk-LDPDLCRL.js";import"./chunk-UMP6ZMEJ.js";import"./chunk-OZ7LWNOK.js";import"./chunk-UHTMVOX6.js";import"./chunk-7AE3725T.js";import"./chunk-JVNHFIYT.js";import"./chunk-3YP6ORBR.js";import{a as st,b as pt}from"./chunk-RTT3JVJM.js";import"./chunk-VCTMSNVC.js";import"./chunk-NFN7BQB3.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-J53BPEDH.js";import"./chunk-TGMCGROM.js";import"./chunk-MW6Q6DZF.js";import{b as ot,e as re}from"./chunk-W5L6FMO3.js";import"./chunk-K5XRGNWG.js";import{d as H,e as Y}from"./chunk-PYXL7UF7.js";import{b as De,c as h}from"./chunk-PW42BQIY.js";import{m as lt,n as ct}from"./chunk-FO7G4GMY.js";import{A as oe,B as G,a as Qe,c as ne,e as me,h as $,i as W,l as ge,m as Ze,n as X,q as K,r as et,s as J,t as tt,u as it,v as nt,z as q}from"./chunk-5PS6ZS3N.js";import"./chunk-V3USB3ZU.js";import"./chunk-ERXVXBTU.js";import{r as rt,s as at}from"./chunk-NNRBGHXB.js";import"./chunk-BJUPMCEP.js";import{g as A,j as k,n as T}from"./chunk-FXQKRJWU.js";import{$ as Ye,$c as x,Fc as _e,Gb as v,Gc as f,Hb as fe,Hc as ie,Ic as Q,K as Ge,Ka as D,Kc as Ke,Lc as Je,M as He,Mb as _,Mc as qe,Na as je,Oa as Me,Qc as F,Rc as he,Xb as We,Yb as s,Z as te,Zb as Oe,ad as I,ca as pe,dc as S,ea as U,ec as L,f as de,g as $e,gc as B,hc as R,ic as p,ja as M,jc as a,jd as ze,ka as ue,kc as d,lc as N,mc as w,oc as E,pa as u,rb as c,tc as y,uc as l,v as V,xa as O,xb as j,xc as Xe,ya as C,za as b}from"./chunk-OJMQBH6T.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";var z=function(t){return t[t.SINGLE_DROP_DOWN=1]="SINGLE_DROP_DOWN",t[t.SINGLE_COMBO_BOX=2]="SINGLE_COMBO_BOX",t[t.FREE_TEXT_FILED=3]="FREE_TEXT_FILED",t[t.MULTI_DROP_DOWN=4]="MULTI_DROP_DOWN",t[t.MULTI_COMBO_BOX=5]="MULTI_COMBO_BOX",t}(z||{});var le=function(t){return t[t.FORMAT_NORMAL=1]="FORMAT_NORMAL",t[t.FORMAT_QUANTITATIVE_WITH_UNIT=2]="FORMAT_QUANTITATIVE_WITH_UNIT",t}(le||{});var ce=function(t){return t[t.VALIDATOR_NO_VALIDATE_TYPE=0]="VALIDATOR_NO_VALIDATE_TYPE",t[t.VALIDATOR_INT_TYPE=1]="VALIDATOR_INT_TYPE",t[t.VALIDATOR_STRING_TYPE=2]="VALIDATOR_STRING_TYPE",t[t.VALIDATOR_FLOAT_TYPE=3]="VALIDATOR_FLOAT_TYPE",t[t.VALIDATOR_DATE_TYPE=4]="VALIDATOR_DATE_TYPE",t}(ce||{});var Ne=class extends ge{setValue(m,e){if(m instanceof Date){let i=Math.floor(m.getTime()/1e3);super.setValue(i,e)}else super.setValue(m,e)}},we=(()=>{class t{constructor(){this.shopeeUploadService=u(Te),this.formBuilder=u(q)}getAttributes(e){return this.shopeeUploadService.getAttributes(e.channelId,e.categoryId).pipe(V(i=>this.setLabelToIndonesian(i)))}setLabelToIndonesian(e=[]){let i,n;return e=e.map(o=>(i=o?.multi_lang?.find(r=>r.language=="id"),o.attribute_value_list=o?.attribute_value_list?.map(r=>(n=r?.multi_lang?.find(g=>g.language=="id"),r.name=n?.value,r)),o.name=i?.value?i?.value:o.name,o)),e}createFormGroup(e){let i=this.formBuilder.group({}),n=[];return e.forEach(o=>{if(n=[],o.mandatory&&n.push(me.required),o?.attribute_info?.format_type==le.FORMAT_QUANTITATIVE_WITH_UNIT&&o?.attribute_info?.input_type==z.FREE_TEXT_FILED){let r=this.formBuilder.group({unit:new ge(null),value:new ge(null,n)});i.addControl(JSON.stringify(o.attribute_id),r)}else o?.attribute_info?.input_type==z.FREE_TEXT_FILED&&o?.attribute_info?.input_validation_type==ce.VALIDATOR_DATE_TYPE?i.addControl(JSON.stringify(o.attribute_id),new Ne(null,n)):i.addControl(JSON.stringify(o.attribute_id),this.formBuilder.control(null,n))}),i}getFilteredAttributes(e,i){let n=JSON.parse(JSON.stringify(e)),o=Object.keys(i),r=n.filter(g=>o.findIndex(Pe=>parseInt(Pe)==g.attribute_id||g.mandatory)!=-1);return r=this.filterSelectedAttributes(r,i),r}filterSelectedAttributes(e,i){return e.map(o=>{switch(o.attribute_info.input_type){case z.MULTI_COMBO_BOX:h.IsNotEmpty(i[o.attribute_id])?o.attribute_value_list=o.attribute_value_list.filter(r=>i[o.attribute_id]?.findIndex(g=>g==r.value_id)!=-1):o.attribute_value_list=[];break;case z.FREE_TEXT_FILED:o.attribute_info.format_type==le.FORMAT_QUANTITATIVE_WITH_UNIT?o.attribute_value_list=this.setSelectedQuantitativeAttr(i[o.attribute_id]?.value,i[o.attribute_id]?.unit):o.attribute_info.input_validation_type==ce.VALIDATOR_DATE_TYPE?o.attribute_value_list=this.setSelectedDateAttr(i[o.attribute_id]):o.attribute_value_list=this.setSelectedQuantitativeAttr(i[o.attribute_id]);break;default:o.attribute_value_list=o.attribute_value_list.filter(r=>r.value_id==i[o.attribute_id])}return o}).filter(o=>o?.attribute_value_list?.length>0)}setSelectedQuantitativeAttr(e,i){let n=[];if(h.IsNotEmpty(e)){let o={value_id:0,original_value_name:JSON.stringify(e)};h.IsNotEmpty(i)&&(o.value_unit=i),n=[o]}return n}setSelectedDateAttr(e){let i=[];return h.IsNotEmpty(e)&&(i=[{value_id:0,original_value_name:JSON.stringify(e)}]),i}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac})}}return t})();var Ae=(()=>{class t{constructor(){this._calendarHeaderConfig=new $e({hideBtnClear:!1,hideBtnToday:!1}),this.calendarConfig=this._calendarHeaderConfig.value}setHeaderConfig(e){this._calendarHeaderConfig.next(e)}getHeaderConfig$(){return this._calendarHeaderConfig.asObservable()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Gt=["class","component ts"];function Ht(t,m){if(t&1){let e=E();p(0,"button",3),y("click",function(){C(e);let n=l(2);return b(n.todayClicked())}),d(1,"i",4),a()}}function Yt(t,m){if(t&1){let e=E();p(0,"button",5),y("click",function(){C(e);let n=l(2);return b(n.clearClicked())}),d(1,"i",6),a()}}function jt(t,m){if(t&1&&(N(0),_(1,Ht,2,0,"button",1)(2,Yt,2,0,"button",2),w()),t&2){let e=m.ngIf;c(),s("ngIf",!e.hideBtnToday),c(),s("ngIf",!e.hideBtnClear)}}var Ot=(()=>{class t{constructor(e,i,n,o,r){this._datePicker=e,this._calendar=i,this._dateAdapter=n,this.calendarService=o,this._destroyed=new de,i.stateChanges.pipe(pe(this._destroyed)).subscribe(g=>r.markForCheck()),this.calendarConfig$=this.calendarService.getHeaderConfig$()}todayClicked(){this._calendar.activeDate=this._dateAdapter.today(),this._datePicker.select(this._dateAdapter.today()),this._datePicker.close()}clearClicked(){this._datePicker.select(null),this._datePicker.close()}ngOnChanges(e){this._calendar.ngOnChanges(e)}ngOnDestroy(){this._destroyed.next(),this._destroyed.complete()}static{this.\u0275fac=function(i){return new(i||t)(j(Fe),j(Tt),j(be),j(Ae),j(ze))}}static{this.\u0275cmp=v({type:t,selectors:[["POS-DatepickerHeader",8,"component","ts"]],standalone:!1,features:[O],attrs:Gt,decls:3,vars:3,consts:[[4,"ngIf"],["mat-icon-button","","title","Today",3,"click",4,"ngIf"],["mat-icon-button","","title","Clear",3,"click",4,"ngIf"],["mat-icon-button","","title","Today",3,"click"],[1,"far","fa-clock",2,"font-size","18px"],["mat-icon-button","","title","Clear",3,"click"],[1,"far","fa-xmark-circle",2,"font-size","18px"]],template:function(i,n){i&1&&(p(0,"mat-calendar-header"),_(1,jt,3,2,"ng-container",0),x(2,"async"),a()),i&2&&(c(),s("ngIf",I(2,1,n.calendarConfig$)))},dependencies:[A,yt,vt,k],encapsulation:2})}}return t})(),Dt=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=fe({type:t})}static{this.\u0275inj=ue({providers:[ae],imports:[T,Se,ye,ae,Ce,ve]})}}return t})();function Wt(t,m){if(t&1&&(p(0,"mat-label",7)(1,"span"),f(2),a()()),t&2){let e=l();s("show",e.placeholder),c(2),ie(e.placeholder)}}var Xt={parse:{dateInput:"DD MMM YYYY"},display:{dateInput:"dddd, D MMMM YYYY",monthYearLabel:"MMM YYYY",dateA11yLabel:"dddd, D MMMM YYYY",monthYearA11yLabel:"MMMM YYYY"}},Nt=(()=>{class t{set hidelClearBtn(e){this.calendarService.setHeaderConfig({hideBtnClear:e,hideBtnToday:this.calendarService.calendarConfig.hideBtnToday})}change(e){let i=null;e&&(i=e.toDate(),i.setHours(0,0,0,0)),this.onChange(i),this.dateChange.emit(i)}constructor(e){this.calendarService=e,this.headerComponent=Ot,this.appearance="outline",this.isFloatingLabel=!0,this.disabled=!1,this.readOnly=!1,this.dateChange=new D,this.minDate=h.MinDate,this.onChange=i=>{},this.displayToggle=!0}writeValue(e){this.date=e}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){this.disabled=e}onOpenDatepicker(){let e=document.getElementById("dropdown-filter");if(e){var i=new bootstrap.Dropdown(e);i&&(i._config.autoClose="inside")}}onCloseDatepicker(){let e=document.getElementById("dropdown-filter");if(e){var i=new bootstrap.Dropdown(e);i&&(i._config.autoClose="outside")}}ngOnDestroy(){this.calendarService.setHeaderConfig({hideBtnClear:!1,hideBtnToday:!1})}static{this.\u0275fac=function(i){return new(i||t)(j(Ae))}}static{this.\u0275cmp=v({type:t,selectors:[["datepicker"]],inputs:{data_cy:"data_cy",placeholder:"placeholder",displayToggle:"displayToggle",appearance:"appearance",width:"width",isFloatingLabel:"isFloatingLabel",date:"date",disabled:"disabled",readOnly:"readOnly",minDateValidation:"minDateValidation",maxDateValidation:"maxDateValidation",hidelClearBtn:"hidelClearBtn"},outputs:{dateChange:"dateChange"},standalone:!1,features:[F([{provide:be,useClass:Et,deps:[ft]},{provide:_t,useValue:Xt},{provide:Qe,multi:!0,useExisting:t}])],decls:7,vars:16,consts:[["picker1",""],[1,"datepicker",3,"disabled","appearance"],[3,"show",4,"ngIf"],["matInput","",3,"dateChange","click","matDatepicker","min","max","placeholder","value","disabled","readonly"],["matSuffix","","aria-hidden","true",1,"datepicker-toggle-icon",3,"click"],[1,"fa-regular","fa-angle-down"],[3,"opened","closed","calendarHeaderComponent"],[3,"show"]],template:function(i,n){if(i&1){let o=E();p(0,"mat-form-field",1),_(1,Wt,3,2,"mat-label",2),p(2,"input",3),y("dateChange",function(g){return C(o),b(n.change(g.value))})("click",function(){C(o);let g=_e(6);return b(g.open())}),a(),p(3,"span",4),y("click",function(){C(o);let g=_e(6);return b(g.open())}),d(4,"i",5),a(),p(5,"mat-datepicker",6,0),y("opened",function(){return C(o),b(n.onOpenDatepicker())})("closed",function(){return C(o),b(n.onCloseDatepicker())}),a()()}if(i&2){let o=_e(6);Oe("width",n.width||100,"%"),s("disabled",n.disabled)("appearance",n.appearance),c(),s("ngIf",n.isFloatingLabel&&n.placeholder),c(),Xe("placeholder",n.placeholder||""),s("matDatepicker",o)("min",n.minDateValidation)("max",n.maxDateValidation)("value",n.date==n.minDate?null:n.date)("disabled",n.disabled)("readonly",n.readOnly),We("data-cy",n.data_cy),c(),Oe("display",n.displayToggle?"unset":"none"),c(2),s("calendarHeaderComponent",n.headerComponent)}},dependencies:[A,Fe,xt,ut,mt,dt,ht],styles:[`.mat-mdc-form-field-disabled ::ng-deep .mat-form-field-appearance-outline{background-color:#e9ecef!important;opacity:1!important}.mat-mdc-form-field-disabled ::ng-deep .mat-form-field-appearance-outline input{color:#00000061!important}.datepicker .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{min-height:3px;padding-top:18px;padding-bottom:13px}.datepicker .mat-mdc-icon-button.mat-mdc-button-base{padding:0}.datepicker .mat-mdc-form-field-subscript-wrapper{display:none}.mat-calendar-controls .mat-mdc-icon-button.mat-mdc-button-base{padding:0!important}.mat-mdc-form-field .mdc-text-field--outlined .mdc-notched-outline--upgraded .mdc-floating-label--float-above{top:28px!important;font-size:16px;color:#9da2a6}.mat-mdc-text-field-wrapper .mat-mdc-form-field-flex .mat-mdc-floating-label{top:23px!important;font-size:.875rem;color:#ccc}.mdc-text-field--filled:not(.mdc-text-field--disabled){background-color:#fff}.datepicker .datepicker-toggle-icon{width:28px;height:36px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;margin-right:6px}.datepicker .datepicker-toggle-icon i{font-family:"Font Awesome 6 Pro","Font Awesome 6 Free","Font Awesome 5 Pro","Font Awesome 5 Free";font-weight:400;font-size:16px;line-height:1;color:#6b7280}
|
|
2
2
|
`],encapsulation:2})}}return t})(),wt=(()=>{class t{static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275mod=fe({type:t})}static{this.\u0275inj=ue({providers:[ae],imports:[T,Se,ye,ae,Ce,ve,Dt,St]})}}return t})();var Ve=()=>[];function Jt(t,m){t&1&&(p(0,"span",5),f(1,"*"),a())}function qt(t,m){if(t&1&&d(0,"ng-select",6),t&2){let e=l().$implicit;s("multiple",!0)("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:he(4,Ve))("placeholder","Pilih "+(e==null?null:e.name))}}function zt(t,m){if(t&1&&d(0,"input",8),t&2){let e=l(2).$implicit;s("formControlName",e.attribute_id)("placeholder","Isi "+(e==null?null:e.name))}}function Qt(t,m){if(t&1&&(p(0,"option",15),f(1),a()),t&2){let e=m.$implicit;s("value",e),c(),ie(e)}}function Zt(t,m){if(t&1&&(p(0,"div",10),d(1,"input",12),p(2,"select",13)(3,"option",14),f(4,"Unit"),a(),B(5,Qt,2,2,"option",15,L),a()()),t&2){let e=l(3).$implicit;s("formGroupName",e.attribute_id),c(),s("placeholder","Isi "+(e==null?null:e.name)),c(2),s("value",null),c(2),R(e==null||e.attribute_info==null?null:e.attribute_info.attribute_unit_list)}}function ei(t,m){if(t&1&&d(0,"input",11),t&2){let e=l(3).$implicit;s("formControlName",e.attribute_id)("placeholder","Isi "+(e==null?null:e.name))}}function ti(t,m){if(t&1&&_(0,Zt,7,3,"div",10)(1,ei,1,2,"input",11),t&2){let e=l(2).$implicit,i=l(2);S((e==null||e.attribute_info==null?null:e.attribute_info.format_type)==i.formatType.FORMAT_QUANTITATIVE_WITH_UNIT?0:1)}}function ii(t,m){if(t&1&&d(0,"datepicker",9),t&2){let e=l(2).$implicit;s("formControlName",e.attribute_id)}}function ni(t,m){if(t&1&&_(0,zt,1,2,"input",8)(1,ti,2,1)(2,ii,1,1,"datepicker",9),t&2){let e,i=l().$implicit,n=l(2);S((e=i==null||i.attribute_info==null?null:i.attribute_info.input_validation_type)===n.validationType.VALIDATOR_STRING_TYPE?0:e===n.validationType.VALIDATOR_FLOAT_TYPE?1:e===n.validationType.VALIDATOR_DATE_TYPE?2:-1)}}function oi(t,m){if(t&1&&d(0,"ng-select",7),t&2){let e=l().$implicit;s("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:he(3,Ve))("placeholder","Pilih "+(e==null?null:e.name))}}function ri(t,m){if(t&1&&d(0,"ng-select",7),t&2){let e=l().$implicit;s("formControlName",e.attribute_id)("items",e.attribute_value_list?e.attribute_value_list:he(3,Ve))("placeholder","Pilih "+(e==null?null:e.name))}}function ai(t,m){if(t&1&&(p(0,"div",3)(1,"div",4),_(2,Jt,2,0,"span",5),p(3,"span"),f(4),a()(),_(5,qt,1,5,"ng-select",6)(6,ni,3,1)(7,oi,1,4,"ng-select",7)(8,ri,1,4,"ng-select",7),a()),t&2){let e,i=m.$implicit,n=l(2);c(2),S(i.mandatory?2:-1),c(2),Q(" ",i==null?null:i.name," "),c(),S((e=i==null||i.attribute_info==null?null:i.attribute_info.input_type)===n.inputType.MULTI_COMBO_BOX?5:e===n.inputType.FREE_TEXT_FILED?6:e===n.inputType.SINGLE_COMBO_BOX?7:8)}}function li(t,m){if(t&1&&(N(0),p(1,"form",1)(2,"div",2),B(3,ai,9,3,"div",3,L),a()(),w()),t&2){let e=m.ngIf,i=l();c(),s("formGroup",i.form),c(2),R(e)}}var Vt=(()=>{class t{constructor(){this.formCategoryService=u(we),this.attributesChanges=new D,this.inputType=z,this.formatType=le,this.validationType=ce}ngOnChanges(){h.IsNotEmpty(this.categoryId)&&h.IsNotEmpty(this.channelId)&&(this.attributes$=this.formCategoryService.getAttributes({categoryId:this.categoryId,channelId:this.channelId,channelType:this.channelType}).pipe(U(e=>{this.form=this.formCategoryService.createFormGroup(e),this.listenToFormChange(e)}),te(1)))}listenToFormChange(e){let i=[];this.formSubscription=this.form.valueChanges.subscribe(n=>{i=this.formCategoryService.getFilteredAttributes(e,n),this.attributesChanges.emit(i)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=v({type:t,selectors:[["shopee-attribute-form"]],inputs:{channelType:"channelType",categoryId:"categoryId",channelId:"channelId",channelProductUpload:"channelProductUpload"},outputs:{attributesChanges:"attributesChanges"},features:[F([we]),O],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],[1,"text-danger"],["bindLabel","name","bindValue","value_id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","value_id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"],[1,"attribute-datepicker",3,"formControlName"],[1,"d-flex","align-items-center",3,"formGroupName"],["type","text","autoNum","",1,"form-control",3,"formControlName","placeholder"],["formControlName","value","type","text","autoNum","",1,"form-control","me-1",2,"width","200px",3,"placeholder"],["name","unit","id","unit","formControlName","unit",1,"form-control"],["disabled","","selected","",3,"value"],[3,"value"]],template:function(i,n){i&1&&(_(0,li,5,1,"ng-container",0),x(1,"async")),i&2&&s("ngIf",I(1,1,n.attributes$))},dependencies:[T,A,k,Y,H,G,X,it,nt,ne,tt,$,W,K,J,et,It,wt,Nt],styles:["input[_ngcontent-%COMP%], select[_ngcontent-%COMP%]{height:36px;border-radius:4px} datepicker.attribute-datepicker>mat-form-field.mat-mdc-form-field>.mat-mdc-text-field-wrapper{height:36px} datepicker.attribute-datepicker .mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix{padding-top:11px!important;padding-bottom:11px!important;height:36px;min-height:36px!important} datepicker.attribute-datepicker mat-datepicker-toggle>button.mat-mdc-icon-button.mat-mdc-button-base{--mdc-icon-button-state-layer-size: 36px}"]})}}return t})();var ee=function(t){return t.TIKTOK_SHOP="TIKTOK_SHOP",t.TOKOPEDIA="TOKOPEDIA",t}(ee||{});var Ue=(()=>{class t{constructor(){this.httpService=u(re),this.formBuilder=u(q),this.uploadProductService=u(Ie)}getAttributes(e,i){return this.httpService.get("api/product/tiktok/GetAttributes",[{key:"ID",value:e},{key:"CategoryID",value:i}]).pipe(Ge(o=>this.uploadProductService.selectedProduct$.pipe(V(r=>(o=this.mappingAttributeSalesProperty(o,r),o)))))}mappingAttributeSalesProperty(e,i){let n=0;return e.filter(o=>(o.type=="SALES_PROPERTY"&&(n+=1),n>1?(n=0,!1):!0)).map(o=>(o.type=="SALES_PROPERTY"&&(o.name="Jenis Variant",o.is_multiple_selection=!1,o.is_required=this.isProductHasMoreVariant(i),o.values=[{id:"Warna",name:"Warna"},{id:"Ukuran",name:"Ukuran"}]),o))}isProductHasMoreVariant(e){let i=!1,n=[];return e.forEach(o=>{o.Variants&&n.push(o.Variants.length)}),i=n.some(o=>o>1),i}createFormGroup(e){let i=this.formBuilder.group({}),n=[];return e.forEach(o=>{n=[],o.is_required&&n.push(me.required),i.addControl(o.id,this.formBuilder.control(null,n))}),i.addControl("listingPlatform",this.formBuilder.control([ee.TIKTOK_SHOP,ee.TOKOPEDIA],[me.required])),i}getFilteredAttributes(e,i){let n=JSON.parse(JSON.stringify(e)),o=Object.keys(i),r=n.filter(g=>o.findIndex(Pe=>parseInt(Pe)==g.id)!=-1);return r=this.filterSelectedAttributes(r,i),r}filterSelectedAttributes(e,i){return e.map(o=>(h.IsNotEmpty(o.values)?o.is_multiple_selection?o.values=o.values.filter(r=>i[o.id]?.includes(r.id)):o.values=o.values.filter(r=>r.id==i[o.id]):i[o.id]&&(o.values=[{id:null,name:i[o.id]}]),o)).filter(o=>o?.values?.length>0)}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac})}}return t})();function ci(t,m){t&1&&(p(0,"small",6),f(1," Platform is required "),a())}function si(t,m){t&1&&(p(0,"span",6),f(1,"*"),a())}function pi(t,m){if(t&1&&d(0,"ng-select",7),t&2){let e=l().$implicit;s("multiple",!0)("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function mi(t,m){if(t&1&&d(0,"ng-select",8),t&2){let e=l().$implicit;s("formControlName",e.id)("items",e.values)("placeholder","Pilih "+(e==null?null:e.name))}}function di(t,m){if(t&1&&d(0,"input",9),t&2){let e=l().$implicit;s("formControlName",e.id)("placeholder",e==null?null:e.name)}}function ui(t,m){if(t&1&&(p(0,"small",6),f(1),a()),t&2){let e=l().$implicit;c(),Q(" ",e==null?null:e.name," is mandatory ")}}function fi(t,m){if(t&1&&(p(0,"div",3)(1,"div",4),_(2,si,2,0,"span",6),p(3,"span"),f(4),a()(),_(5,pi,1,4,"ng-select",7)(6,mi,1,3,"ng-select",8)(7,di,1,2,"input",9)(8,ui,2,1,"small",6),a()),t&2){let e=m.$implicit;c(2),S(e.is_required?2:-1),c(2),Q(" ",e==null?null:e.name," "),c(),S(e.is_multiple_selection?5:e.values!==null&&e.values.length>0?6:7),c(3),S(e.is_required?8:-1)}}function _i(t,m){if(t&1&&(N(0),p(1,"form",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"span"),f(6," Platform Options"),a()(),d(7,"ng-select",5),_(8,ci,2,0,"small",6),a(),B(9,fi,9,4,"div",3,L),a()(),w()),t&2){let e,i=m.ngIf,n=l();c(),s("formGroup",n.form),c(6),s("multiple",!0)("items",n.platformOptions)("clearable",!1),c(),S(!(n.form==null||(e=n.form.get("listingPlatform").errors)==null)&&e.required?8:-1),c(),R(i)}}var Ut=(()=>{class t{constructor(){this.tiktokAttributeFormService=u(Ue),this.platformChange=je({alias:"onPlatformChanges"}),this.formSubscription=new de,this.attributesChanges=new D,this.platformOptions=[{label:"TikTok Shop",value:ee.TIKTOK_SHOP},{label:"Tokopedia",value:ee.TOKOPEDIA}]}ngOnChanges(){h.IsNotEmpty(this.categoryId)&&h.IsNotEmpty(this.channelId)&&(this.attributes$=this.tiktokAttributeFormService.getAttributes(this.channelId,this.categoryId).pipe(V(e=>e.filter(i=>!(i.type=="PRODUCT_PROPERTY"&&(h.IsEmpty(i.values)||i.values?.length==0)&&i.is_customizable==!1))),U(e=>{this.form=this.tiktokAttributeFormService.createFormGroup(e),this.listenToFormChange(e)}),te(1)))}listenToFormChange(e){let i=[];this.form.valueChanges.pipe(pe(this.formSubscription)).subscribe(n=>{delete n.listingPlatform,i=this.tiktokAttributeFormService.getFilteredAttributes(e,n),this.attributesChanges.emit(i)}),this.form.get("listingPlatform").valueChanges.pipe(Ye(this.form.get("listingPlatform").value),pe(this.formSubscription)).subscribe(n=>{this.platformChange.emit(n)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=v({type:t,selectors:[["tiktok-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{platformChange:"onPlatformChanges",attributesChanges:"attributesChanges"},features:[F([Ue]),O],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","listingPlatform","bindLabel","label","bindValue","value","placeholder","Platform Options",3,"multiple","items","clearable"],[1,"text-danger"],["bindLabel","name","bindValue","id",3,"multiple","formControlName","items","placeholder"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"],["type","text",1,"form-control",3,"formControlName","placeholder"]],template:function(i,n){i&1&&(_(0,_i,11,5,"ng-container",0),x(1,"async")),i&2&&s("ngIf",I(1,1,n.attributes$))},dependencies:[T,A,k,Y,H,G,X,ne,$,W,K,J,oe],encapsulation:2})}}return t})();var Le=(()=>{class t{constructor(){this.woocommerceUploadService=u(xe)}getAttributes(e,i){return this.woocommerceUploadService.getAttributes(e,i).pipe(V(n=>n.map(o=>({key:o.name,label:o.name}))))}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac})}}return t})();var Lt=(()=>{class t{constructor(){this.wooAttributeFormService=u(Le),this.channelId=Me(),this.categoryId=Me(),this.attributesChanges=new D}ngOnChanges(){h.IsNotEmpty(this.categoryId())&&h.IsNotEmpty(this.channelId())&&(this.attributes$=this.wooAttributeFormService.getAttributes(this.channelId(),this.categoryId()))}onSelectAttribute(e){this.attributesChanges.emit([e.key])}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=v({type:t,selectors:[["wooocommerce-attribute-form"]],inputs:{channelId:[1,"channelId"],categoryId:[1,"categoryId"]},outputs:{attributesChanges:"attributesChanges"},features:[F([Le]),O],decls:6,vars:3,consts:[[1,"row"],[1,"col-6"],[1,"mb-1"],["bindLabel","label","bindValue","id","placeholder","Pilih Atribut",3,"change","items"]],template:function(i,n){i&1&&(p(0,"div",0)(1,"div",1)(2,"div",2),f(3,"Atribut"),a(),p(4,"ng-select",3),x(5,"async"),y("change",function(r){return n.onSelectAttribute(r)}),a()()()),i&2&&(c(4),s("items",I(5,1,n.attributes$)))},dependencies:[T,k,oe,Y,H,G],encapsulation:2})}}return t})();var Be=(()=>{class t{constructor(){this.httpService=u(re),this.formBuilder=u(q)}getAttributes(e,i){return this.httpService.get("api/product/tokopedia/GetAttributes",[{key:"ID",value:e},{key:"CategoryID",value:i}]).pipe(V(o=>o))}createFormGroup(e){let i=this.formBuilder.group({});return e.forEach(n=>{i.addControl(n.variant,this.formBuilder.control(null))}),i}convertAttributes(e={}){return Object.values(e).filter(n=>n!==null).map(n=>JSON.stringify(n))}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac})}}return t})();function hi(t,m){if(t&1&&(p(0,"div",3)(1,"div",4),f(2),a(),d(3,"ng-select",5),a()),t&2){let e=m.$implicit;c(2),Q(" ",e==null?null:e.variant," "),c(),s("formControlName",e.variant)("items",e.values)("placeholder","Pilih "+(e==null?null:e.variant))}}function gi(t,m){if(t&1&&(N(0),p(1,"form",1)(2,"div",2),B(3,hi,4,4,"div",3,L),a()(),w()),t&2){let e=m.ngIf,i=l();c(),s("formGroup",i.form),c(2),R(e)}}var Bt=(()=>{class t{constructor(){this.tokpedAttrFormService=u(Be),this.attributesChanges=new D}ngOnInit(){}ngOnChanges(e){h.IsNotEmpty(this.categoryId)&&h.IsNotEmpty(this.channelId)&&(this.attributes$=this.tokpedAttrFormService.getAttributes(this.channelId,this.categoryId).pipe(U(i=>{this.form=this.tokpedAttrFormService.createFormGroup(i),this.listenToFormChange()})))}listenToFormChange(){let e=[];this.formSubscription=this.form.valueChanges.subscribe(i=>{e=this.tokpedAttrFormService.convertAttributes(i),this.attributesChanges.emit(e)})}ngOnDestroy(){this.formSubscription&&this.formSubscription.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=v({type:t,selectors:[["tokopedia-attribute-form"]],inputs:{channelId:"channelId",categoryId:"categoryId"},outputs:{attributesChanges:"attributesChanges"},features:[F([Be]),O],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["bindLabel","name","bindValue","id",3,"formControlName","items","placeholder"]],template:function(i,n){i&1&&(_(0,gi,5,1,"ng-container",0),x(1,"async")),i&2&&s("ngIf",I(1,1,n.attributes$))},dependencies:[T,A,k,Y,H,G,X,$,W,K,J],encapsulation:2})}}return t})();var Re=(()=>{class t{constructor(){this.httpService=u(re),this.formBuilder=u(q)}getAttributes(e){return this.httpService.get("api/product/shopify/GetAttributes",[{key:"ID",value:e}]).pipe(U(n=>(n.Options.StatusOptions=n.Options.Status.map(o=>({id:o,name:o})),n)))}createFormGroup(e){let i=this.formBuilder.group({});return Object.keys(e.Attribute).forEach(o=>{i.addControl(o,this.formBuilder.control(null))}),i}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275prov=M({token:t,factory:t.\u0275fac})}}return t})();function Ci(t,m){if(t&1&&(N(0),p(1,"form",1)(2,"div",2)(3,"div",3)(4,"div",4),f(5," Brand "),a(),d(6,"input",5),a(),p(7,"div",6)(8,"div",4),f(9," Product Type "),a(),d(10,"input",7),a(),p(11,"div",6)(12,"div",4),f(13," Status "),a(),d(14,"ng-select",8),a()()(),w()),t&2){let e=m.ngIf,i=l();c(),s("formGroup",i.form),c(13),s("items",e.Options.StatusOptions)}}var Rt=(()=>{class t{constructor(){this.attributesChanges=new D,this.shopifyFormService=u(Re)}ngOnChanges(e){e.channelId&&(this.attributes$=this.shopifyFormService.getAttributes(this.channelId).pipe(U(i=>{this.form=this.shopifyFormService.createFormGroup(i),this.listenToFormChange()})))}listenToFormChange(){this.formSubscription=this.form.valueChanges.pipe(He(500)).subscribe(e=>{this.attributesChanges.emit([e])})}ngOnDestroy(){this.formSubscription.unsubscribe()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=v({type:t,selectors:[["shopify-attribute-form"]],inputs:{channelId:"channelId"},outputs:{attributesChanges:"attributesChanges"},features:[F([Re]),O],decls:2,vars:3,consts:[[4,"ngIf"],[3,"formGroup"],[1,"row"],[1,"col-6","mb-3"],[1,"mb-1"],["formControlName","Brand","type","text","placeholder","brand",1,"form-control"],[1,"col-6"],["formControlName","ProductType","type","text","placeholder","Product Type",1,"form-control"],["formControlName","Status","bindLabel","name","bindValue","id","placeholder","Status",3,"items"]],template:function(i,n){i&1&&(_(0,Ci,15,2,"ng-container",0),x(1,"async")),i&2&&s("ngIf",I(1,1,n.attributes$))},dependencies:[T,A,k,G,X,ne,$,W,K,J,Y,H],encapsulation:2})}}return t})();function bi(t,m){if(t&1&&(p(0,"div",6),d(1,"app-product-card",9),a()),t&2){let e=m.$implicit;c(),s("productId",e==null?null:e.ID)("title",e==null?null:e.Name)("image",e==null?null:e.ThumbnailUrl)("description",(e==null||e.Variants==null?null:e.Variants.length)>1?(e==null||e.Variants==null?null:e.Variants.length)+" Variants":null)("imageForZoom",e==null?null:e.ImageUrl)("code",e==null||e.Variants[0]==null?null:e.Variants[0].Code)("showFooter",!1)}}function yi(t,m){if(t&1){let e=E();N(0),p(1,"mat-checkbox",21),qe("ngModelChange",function(n){C(e);let o=l().$implicit;return Je(o.selected,n)||(o.selected=n),b(n)}),y("ngModelChange",function(){let n=C(e).ngIf,o=l(),r=o.$implicit,g=o.$index,se=l();return b(se.onSelectChannel(r,g,n))}),a(),w()}if(t&2){let e=l().$implicit;c(),Ke("ngModel",e.selected)}}function vi(t,m){if(t&1&&(p(0,"div",18),d(1,"input",22),a()),t&2){let e=l().$implicit,i=l();s("matTooltip",e.type==i.channelType.Shopify?"Cannot change category, please change category in admin.shopify.com":e.type==i.channelType.Plugo?"You can change the category after the product has been uploaded to the Plugo Dashboard.":"")}}function Ti(t,m){if(t&1){let e=E();p(0,"app-channel-category-select",23),y("selectedCategory",function(n){C(e);let o=l().$index,r=l();return b(r.onCategoryChange(o,n))}),a()}if(t&2){let e=l().$implicit,i=l();s("disabled",!e.selected||e.selected&&e.type==i.channelType.Lazada)("channelId",e.id)("channelType",e.type)("categoryId",e.categoryId)}}function xi(t,m){if(t&1){let e=E();p(0,"shopee-attribute-form",27),y("attributesChanges",function(n){C(e);let o=l(2).$index,r=l();return b(r.onAttributesChange(o,n))}),a()}if(t&2){let e=l(2).$implicit;s("categoryId",e.categoryId)("channelId",e.id)("channelType",e.type)}}function Ii(t,m){if(t&1){let e=E();p(0,"tiktok-attribute-form",28),y("attributesChanges",function(n){C(e);let o=l(2).$index,r=l();return b(r.onAttributesChange(o,n))})("onPlatformChanges",function(n){C(e);let o=l(2).$index,r=l();return b(r.onPlatformChange(o,n))}),a()}if(t&2){let e=l(2).$implicit;s("categoryId",e.categoryId)("channelId",e.id)}}function Si(t,m){if(t&1){let e=E();p(0,"wooocommerce-attribute-form",29),y("attributesChanges",function(n){C(e);let o=l(2).$index,r=l();return b(r.onAttributesChange(o,n))}),a()}if(t&2){let e=l(2).$implicit;s("categoryId",e.categoryId)("channelId",e.id)}}function Fi(t,m){if(t&1){let e=E();p(0,"tokopedia-attribute-form",29),y("attributesChanges",function(n){C(e);let o=l(2).$index,r=l();return b(r.onAttributesChange(o,n))}),a()}if(t&2){let e=l(2).$implicit;s("categoryId",e.categoryId)("channelId",e.id)}}function Ai(t,m){if(t&1&&(p(0,"div",20)(1,"div",24),_(2,xi,1,3,"shopee-attribute-form",25)(3,Ii,1,2,"tiktok-attribute-form",26)(4,Si,1,2,"wooocommerce-attribute-form",26)(5,Fi,1,2,"tokopedia-attribute-form",26),a()()),t&2){let e,i=l().$implicit,n=l();c(2),S((e=i.type)===n.channelType.Shopee?2:e===n.channelType.Tiktok?3:e===n.channelType.WooCommerce?4:e===n.channelType.Tokopedia?5:-1)}}function ki(t,m){if(t&1){let e=E();p(0,"div",20)(1,"div",24)(2,"shopify-attribute-form",30),y("attributesChanges",function(n){C(e);let o=l().$index,r=l();return b(r.onAttributesChange(o,n))}),a()()()}if(t&2){let e=l().$implicit;c(2),s("channelId",e.id)}}function Ei(t,m){if(t&1&&(p(0,"div",8)(1,"div",10)(2,"div",11)(3,"div",12)(4,"div",13)(5,"div"),_(6,yi,2,1,"ng-container",14),x(7,"async"),a(),p(8,"div"),d(9,"app-channel-logo",15),a(),p(10,"div",16)(11,"span"),f(12),a()()()(),p(13,"div",12)(14,"div",17),_(15,vi,2,1,"div",18)(16,Ti,1,4,"app-channel-category-select",19),a()()(),_(17,Ai,6,1,"div",20)(18,ki,3,1,"div",20),a()()),t&2){let e=m.$implicit,i=l();c(6),s("ngIf",I(7,8,i.defaultCategories$)),c(3),s("typeId",e.type)("showChannelName",!1),c(),s("matTooltip",e.name)("matTooltipShowDelay",2500),c(2),ie(e.name),c(3),S(e.type==i.channelType.Shopify||e.type==i.channelType.Plugo?15:16),c(2),S(e.categoryId&&i.channelType.Lazada!=e.type&&e.selected?17:i.channelType.Shopify==e.type&&e.selected?18:-1)}}var Er=(()=>{class t{constructor(){this.toastr=u(ot),this.uploadProductService=u(Ie),this.selectedProducts$=this.uploadProductService.selectedProduct$,this.channelProductUploads=this.uploadProductService.channelProductUpload,this.channelType=De,this.defaultCategories$=this.uploadProductService.getDefaultCategory().pipe(te(1))}onCategoryChange(e,i){this.channelProductUploads.update(n=>n.map((o,r)=>(r==e&&(o.categoryId=i,o.attributes=[]),o)))}onPlatformChange(e,i){this.channelProductUploads.update(n=>n.map((o,r)=>(r==e&&(o.listing_platforms=i),o)))}onAttributesChange(e,i){this.channelProductUploads.update(n=>n.map((o,r)=>(r==e&&(o.attributes=i),o)))}tiktokPlatformChanges(e,i){this.channelProductUploads.update(n=>n.map((o,r)=>(r==e&&(o.listing_platforms=i),o)))}onSelectChannel(e,i,n){this.channelProductUploads.update(o=>o.map((r,g)=>{if(g==i&&e.selected){let se=this.findCategoryByChannelId(e.id,n);r.categoryId=se?.DefaultCategoryID}return g==i&&!e.selected&&(r.categoryId=null),r}))}findCategoryByChannelId(e,i){return i.find(n=>n.ID===e)}onUploadProduct(){if(this.checkTiktokPlatform()==!1){this.toastr.error("Please select at least one platform for TikTok channel","Platform is Required");return}this.uploadProductService.onUploadProduct(this.channelProductUploads())}checkTiktokPlatform(){return this.channelProductUploads().every(i=>i.type==De.Tiktok&&h.IsNotEmpty(i?.categoryId)?i.listing_platforms.length>0:!0)}ngOnDestroy(){this.uploadProductService.clearSelectedProduct()}static{this.\u0275fac=function(i){return new(i||t)}}static{this.\u0275cmp=v({type:t,selectors:[["app-product-upload"]],features:[F([Te,gt,Ct,xe])],decls:17,vars:5,consts:[["headerTitle","Upload Product To Channel",3,"hideSearchBox","hideSearchDropdown"],[1,"btn","btn-light","shadow","rounded","ms-2",3,"click","disabled"],["aria-hidden","true",1,"fa","fa-upload"],[1,"container-fluid","mt-6"],[1,"ps-3","mt-8","pb-5","fw-medium"],[1,"row","mb-10","ps-3"],[1,"col-12","col-md-6","col-xl-4","px-3","my-3"],[1,"ps-3","mb-8","border-bottom","pb-5","fw-medium"],[1,"row","mb-6"],[3,"productId","title","image","description","imageForZoom","code","showFooter"],[1,"col-12"],[1,"row"],[1,"col-3"],[1,"d-flex","align-items-center"],[4,"ngIf"],[3,"typeId","showChannelName"],[2,"overflow","hidden","text-overflow","ellipsis","white-space","nowrap",3,"matTooltip","matTooltipShowDelay"],[1,"w-100"],["matTooltipPosition","above",3,"matTooltip"],[3,"disabled","channelId","channelType","categoryId"],[1,"row","my-3"],["color","primary",1,"example-margin",3,"ngModelChange","ngModel"],["disabled","","type","text","placeholder","Category Unavailable",1,"form-control","rounded-1",2,"height","35px"],[3,"selectedCategory","disabled","channelId","channelType","categoryId"],[1,"col-12","ps-11"],[3,"categoryId","channelId","channelType"],[3,"categoryId","channelId"],[3,"attributesChanges","categoryId","channelId","channelType"],[3,"attributesChanges","onPlatformChanges","categoryId","channelId"],[3,"attributesChanges","categoryId","channelId"],[3,"attributesChanges","channelId"]],template:function(i,n){if(i&1&&(p(0,"mainpanel",0)(1,"actions")(2,"button",1),y("click",function(){return n.onUploadProduct()}),d(3,"i",2),f(4," Upload "),a()(),p(5,"content")(6,"div",3)(7,"h3",4),f(8,"Product To Upload"),a(),p(9,"div",5),B(10,bi,2,7,"div",6,L),x(12,"async"),a(),p(13,"h3",7),f(14,"Channel To Upload"),a(),B(15,Ei,19,10,"div",8,L),a()()()),i&2){let o;s("hideSearchBox",!0)("hideSearchDropdown",!0),c(2),s("disabled",((o=n.channelProductUploads())==null?null:o.length)==0),c(8),R(I(12,3,n.selectedProducts$)),c(5),R(n.channelProductUploads())}},dependencies:[T,A,k,Ft,ct,lt,kt,At,pt,st,oe,$,Ze,at,rt,Ut,Lt,Bt,Rt,bt,Pt,Vt],encapsulation:2})}}return t})();export{Er as ProductUploadComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-QNM4JQ46.js";import"./chunk-NFN7BQB3.js";import"./chunk-Z3ITXK3D.js";import"./chunk-ACIMXBIC.js";import"./chunk-J53BPEDH.js";import"./chunk-TGMCGROM.js";import{a as F}from"./chunk-MW6Q6DZF.js";import{e as j}from"./chunk-W5L6FMO3.js";import"./chunk-K5XRGNWG.js";import"./chunk-PYXL7UF7.js";import"./chunk-PW42BQIY.js";import{m as H,n as J}from"./chunk-FO7G4GMY.js";import{A as R,c as k,h as B,m as W}from"./chunk-5PS6ZS3N.js";import"./chunk-V3USB3ZU.js";import"./chunk-ERXVXBTU.js";import"./chunk-NNRBGHXB.js";import"./chunk-BJUPMCEP.js";import{j as D,l as I,n as P}from"./chunk-FXQKRJWU.js";import{$c as b,Gb as S,Gc as i,Hc as N,Kc as g,Lc as f,Mb as x,Mc as C,Nc as O,Oc as V,Pc as _,Ra as w,Yb as m,Z as v,ad as y,dc as M,ic as e,jc as t,kc as L,oc as T,pa as E,rb as p,tc as h,uc as A,ya as d,za as s}from"./chunk-OJMQBH6T.js";import"./chunk-EU2KAMEK.js";import"./chunk-66YHNWRR.js";function Y(n,U){if(n&1&&(e(0,"pre",21),i(1),b(2,"json"),t()),n&2){A();let l=_(25);p(),N(y(2,1,l))}}function q(n,U){n&1&&(e(0,"p",22),i(1," Your data will be shown here once it's available "),t())}var pe=(()=>{class n{constructor(){this.httpService=E(j),this.selectedChannel=w(null),this.orderNumber=w(null)}initEscrowLog(){this.escrowLog$=this.httpService.post(F.GetEscrowDetail,{ChannelID:this.selectedChannel(),OrderNumber:this.orderNumber()}).pipe(v(1))}copyToClipboard(l){if(!l)return;let c=typeof l=="string"?l:JSON.stringify(l,null,2);navigator.clipboard.writeText(c),alert("Copied to clipboard!")}static{this.\u0275fac=function(c){return new(c||n)}}static{this.\u0275cmp=S({type:n,selectors:[["app-escrow-api"]],decls:40,vars:10,consts:[["headerTitle","Origin Escrow Api",3,"hideSearchBox","hideSearchDropdown"],[1,"btn","btn-success","btn-fill","me-3",3,"click"],[1,"fa","fa-search"],[1,"container-fluid","mt-8","px-10"],[1,"row"],[1,"col-7"],[1,"d-flex","align-items-center"],[1,"w-75"],[1,"mb-0","text-muted","fst-italic"],[1,"w-100"],[3,"ngModelChange","ngModel","onlyInputTypeID"],[1,"d-flex","align-items-center","mt-3"],["type","text","placeholder","Order Number or Invoice Number",1,"form-control",3,"ngModelChange","ngModel"],[1,"row","mt-6"],[1,"col-12"],[1,"card"],[1,"card-header","d-flex","justify-content-between","align-items-center"],["type","button",1,"btn","btn-sm","btn-outline-primary",3,"click","disabled"],[1,"card-body"],[1,"col-sm-12"],[1,"form-group","position-relative"],["id","escrowLogText"],[1,"text-center","my-12","text-muted"]],template:function(c,o){if(c&1){let a=T();e(0,"mainpanel",0)(1,"actions")(2,"button",1),h("click",function(){return d(a),s(o.initEscrowLog())}),L(3,"i",2),i(4," Search "),t()(),e(5,"content")(6,"div",3)(7,"div",4)(8,"div",5)(9,"div",6)(10,"div",7)(11,"h6"),i(12,"Channel"),t(),e(13,"p",8),i(14," View logs related to Escrow API "),t()(),e(15,"div",9)(16,"channel-select-options",10),C("ngModelChange",function(r){return d(a),f(o.selectedChannel,r)||(o.selectedChannel=r),s(r)}),t()()(),e(17,"div",11)(18,"div",7)(19,"h6"),i(20,"Order Number"),t(),e(21,"p",8),i(22," Order or Invoice number from Channel. "),t()(),e(23,"div",9)(24,"input",12),C("ngModelChange",function(r){return d(a),f(o.orderNumber,r)||(o.orderNumber=r),s(r)}),t()()()()(),O(25),b(26,"async"),e(27,"div",13)(28,"div",14)(29,"div",15)(30,"div",16)(31,"h5"),i(32,"Response"),t(),e(33,"button",17),h("click",function(){d(a);let r=_(25);return s(o.copyToClipboard(r))}),i(34," Copy "),t()(),e(35,"div",18)(36,"div",19)(37,"div",20),x(38,Y,3,3,"pre",21)(39,q,2,0,"p",22),t()()()()()()()()()}if(c&2){m("hideSearchBox",!0)("hideSearchDropdown",!0),p(16),g("ngModel",o.selectedChannel),m("onlyInputTypeID",5),p(8),g("ngModel",o.orderNumber),p();let a=V(y(26,7,o.escrowLog$));p(8),m("disabled",!a),p(5),M(a?38:39)}},dependencies:[P,D,I,R,k,B,W,J,H,G],styles:[".container-fluid[_ngcontent-%COMP%]{padding-bottom:1rem}#escrowLogText[_ngcontent-%COMP%]{white-space:pre-wrap;word-break:break-word}"]})}}return n})();export{pe as EscrowApiComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-MW6Q6DZF.js";import{b as h,e as p}from"./chunk-W5L6FMO3.js";import{ja as I,oa as o}from"./chunk-OJMQBH6T.js";var D=(()=>{class r{constructor(n,e){this.toastrService=n,this.http=e}getLastInfoDownloadInventory(n){return this.http.post(a.GetLastInfoDownloadInventory,{ChannelID:n})}refreshInventory(n){let e=n.map(t=>t.Channel.map(s=>(s.VariantID=t.ID,s))).reduce((t,i)=>(t=t.concat(i),t),[]).map(t=>({ChannelItemID:t.ChannelItemID,ChannelID:t.ChannelID,VariantID:t.VariantID,ChannelVariationID:t.ChannelVariationID}));return this.http.post(a.RefreshInventory,e)}static{this.\u0275fac=function(e){return new(e||r)(o(h),o(p))}}static{this.\u0275prov=I({token:r,factory:r.\u0275fac})}}return r})();export{D as a};
|