marketplacepos 3.7.2 → 3.7.4
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-QOBUHJEC.js → chunk-2SA7SVYH.js} +1 -1
- package/Marketplace/{chunk-H65R6LYY.js → chunk-2UI4YTN6.js} +1 -1
- package/Marketplace/chunk-2V7GCWY7.js +1 -0
- package/Marketplace/{chunk-EJ4H3OFV.js → chunk-2YI2WW5U.js} +1 -1
- package/Marketplace/{chunk-ULZ3J3BD.js → chunk-4AQ3EZML.js} +1 -1
- package/Marketplace/{chunk-GSZSRSYG.js → chunk-5XRAHMC6.js} +1 -1
- package/Marketplace/{chunk-MQUFUG4I.js → chunk-644NU43G.js} +1 -1
- package/Marketplace/{chunk-4SAZAICQ.js → chunk-7I7KV673.js} +1 -1
- package/Marketplace/{chunk-IANWTXDM.js → chunk-7QIOC7BK.js} +1 -1
- package/Marketplace/{chunk-MG7FPXZX.js → chunk-7XITKPS5.js} +1 -1
- package/Marketplace/{chunk-H65V337R.js → chunk-BGCBCSHC.js} +1 -1
- package/Marketplace/{chunk-AE6IHJSI.js → chunk-BTKXSJ5K.js} +1 -1
- package/Marketplace/{chunk-LQUPRVED.js → chunk-CHDEJCV7.js} +1 -1
- package/Marketplace/{chunk-KOEWWMXB.js → chunk-COKR3NPC.js} +1 -1
- package/Marketplace/{chunk-6GVQC3OR.js → chunk-COLVGV5B.js} +1 -1
- package/Marketplace/{chunk-NY3NDLUY.js → chunk-CS62TIAP.js} +1 -1
- package/Marketplace/{chunk-QWKP6LGP.js → chunk-CSUJ7V36.js} +1 -1
- package/Marketplace/{chunk-3KV2JLZD.js → chunk-CUYZKVZ3.js} +1 -1
- package/Marketplace/{chunk-CQJJCQOZ.js → chunk-DJCANNYC.js} +1 -1
- package/Marketplace/{chunk-JHT6TPR2.js → chunk-ELFNCSQS.js} +1 -1
- package/Marketplace/{chunk-ZA6GABVQ.js → chunk-ENOOLWKX.js} +1 -1
- package/Marketplace/{chunk-LU4CQUNV.js → chunk-FGEVVKEH.js} +1 -1
- package/Marketplace/{chunk-T4IQWUBV.js → chunk-FZ3LLUFV.js} +1 -1
- package/Marketplace/{chunk-VM5LF2AQ.js → chunk-GQU66EJO.js} +1 -1
- package/Marketplace/{chunk-7QK5UPRO.js → chunk-H4UMXVLS.js} +1 -1
- package/Marketplace/{chunk-2SYJDDTX.js → chunk-HAU6K6GW.js} +1 -1
- package/Marketplace/{chunk-ONRH4TTU.js → chunk-HX36ACUF.js} +1 -1
- package/Marketplace/{chunk-4Z75AP5X.js → chunk-IL2DK2XK.js} +1 -1
- package/Marketplace/{chunk-WIPT5BVZ.js → chunk-IMUZFXPJ.js} +2 -2
- package/Marketplace/{chunk-NE4U3Z2F.js → chunk-IPVDR333.js} +1 -1
- package/Marketplace/{chunk-LV7NKX2V.js → chunk-IZ3HV6DV.js} +1 -1
- package/Marketplace/{chunk-GSZGHECR.js → chunk-JB6W2UTC.js} +1 -1
- package/Marketplace/{chunk-F2WJC5YO.js → chunk-K5HNYUX4.js} +2 -2
- package/Marketplace/{chunk-HD4CTBL2.js → chunk-KQRK4CTQ.js} +1 -1
- package/Marketplace/{chunk-RNMZG2RU.js → chunk-KSDM566S.js} +1 -1
- package/Marketplace/{chunk-QHJPUEQJ.js → chunk-LSBFWGC6.js} +1 -1
- package/Marketplace/{chunk-MCTEEYBG.js → chunk-MPHWSDOT.js} +1 -1
- package/Marketplace/{chunk-PSAPUCAJ.js → chunk-N5YIZS6Z.js} +1 -1
- package/Marketplace/{chunk-JOI2R7DA.js → chunk-O7MAOFLA.js} +1 -1
- package/Marketplace/chunk-OGL675J6.js +1 -0
- package/Marketplace/{chunk-37MHCWTD.js → chunk-OKATPNAY.js} +1 -1
- package/Marketplace/{chunk-B2H2LMDP.js → chunk-Q4LQRXK4.js} +1 -1
- package/Marketplace/{chunk-W5LP6HWA.js → chunk-R4XC3TIR.js} +1 -1
- package/Marketplace/{chunk-JEIL7GTU.js → chunk-S5TAVCV2.js} +1 -1
- package/Marketplace/{chunk-P7MI7GDE.js → chunk-SCSHD4KU.js} +1 -1
- package/Marketplace/{chunk-JGSLR6Q7.js → chunk-SKMUHTVE.js} +1 -1
- package/Marketplace/{chunk-LPD77TVJ.js → chunk-SMV45LT2.js} +1 -1
- package/Marketplace/{chunk-UUY6BTJU.js → chunk-TNBAGDLT.js} +1 -1
- package/Marketplace/{chunk-VZO27DX6.js → chunk-TO2VHTUR.js} +3 -3
- package/Marketplace/{chunk-HIX2BUDB.js → chunk-U7MYN4C4.js} +1 -1
- package/Marketplace/{chunk-CBW7JGFJ.js → chunk-UGTOBS2B.js} +1 -1
- package/Marketplace/{chunk-RQWHADXY.js → chunk-VAE6Y2B3.js} +1 -1
- package/Marketplace/{chunk-T5BNV4KL.js → chunk-WGXKB6XB.js} +1 -1
- package/Marketplace/{chunk-N6VKSGEM.js → chunk-WOOLZ22H.js} +1 -1
- package/Marketplace/{chunk-ZSK75YJW.js → chunk-WP6G47JB.js} +1 -1
- package/Marketplace/{chunk-F7PVCSNW.js → chunk-X5NF5S2H.js} +1 -1
- package/Marketplace/{chunk-27IVVEQ5.js → chunk-X6UUIC3F.js} +1 -1
- package/Marketplace/{chunk-ZMMTX4YX.js → chunk-Y3GV3L67.js} +1 -1
- package/Marketplace/{chunk-I66FBNYV.js → chunk-YBPTSF4K.js} +1 -1
- package/Marketplace/{chunk-PL4TRYLK.js → chunk-ZAKCXPP7.js} +1 -1
- package/Marketplace/index.html +2 -2
- package/Marketplace/{main-AUAZAZGD.js → main-FSM7S3E4.js} +1 -1
- package/Marketplace/{styles-DC4DACOA.css → styles-VY4XPEM3.css} +1 -1
- package/package.json +1 -1
- package/Marketplace/chunk-5CBOZ77Z.js +0 -1
- package/Marketplace/chunk-FX4KZMXX.js +0 -1
- /package/Marketplace/{chunk-5DL35YCG.js → chunk-322JBPYB.js} +0 -0
- /package/Marketplace/{chunk-VS4FYYKI.js → chunk-EF3W3UUA.js} +0 -0
- /package/Marketplace/{chunk-QYP6WXYL.js → chunk-MKDJJ5L7.js} +0 -0
- /package/Marketplace/{chunk-FG5W5K4B.js → chunk-R7J6AS67.js} +0 -0
- /package/Marketplace/{polyfills-FXABYPWM.js → polyfills-5ZPLRT7K.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ba as F,Da as w,Ga as a,Ia as de,Ja as V,La as d,Na as J,Qa as Q,Sb as T,Ub as ee,Z as c,_ as G,aa as M,ba as _,fa as E,ga as u,gb as ce,hb as m,ia as j,m as ae,na as p,q as le,tb as h,w as ue}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-CQJJCQOZ.js";import{a as g,b as C}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-FG5W5K4B.js";var Ve=(()=>{let e=class e{constructor(t,n){this._renderer=t,this._elementRef=n,this.onChange=s=>{},this.onTouched=()=>{}}setProperty(t,n){this._renderer.setProperty(this._elementRef.nativeElement,t,n)}registerOnTouched(t){this.onTouched=t}registerOnChange(t){this.onChange=t}setDisabledState(t){this.setProperty("disabled",t)}};e.\u0275fac=function(n){return new(n||e)(a(w),a(F))},e.\u0275dir=u({type:e});let i=e;return i})(),P=(()=>{let e=class e extends Ve{};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,features:[d]});let i=e;return i})(),b=new _("NgValueAccessor"),qe={provide:b,useExisting:c(()=>ze),multi:!0},ze=(()=>{let e=class e extends P{writeValue(t){this.setProperty("checked",t)}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["input","type","checkbox","formControlName",""],["input","type","checkbox","formControl",""],["input","type","checkbox","ngModel",""]],hostBindings:function(n,s){n&1&&m("change",function(l){return s.onChange(l.target.checked)})("blur",function(){return s.onTouched()})},features:[h([qe]),d]});let i=e;return i})(),Ze={provide:b,useExisting:c(()=>De),multi:!0};function Xe(){let i=ee()?ee().getUserAgent():"";return/android (\d+)/.test(i.toLowerCase())}var Ye=new _("CompositionEventMode"),De=(()=>{let e=class e extends Ve{constructor(t,n,s){super(t,n),this._compositionMode=s,this._composing=!1,this._compositionMode==null&&(this._compositionMode=!Xe())}writeValue(t){let n=t??"";this.setProperty("value",n)}_handleInput(t){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(t)}_compositionStart(){this._composing=!0}_compositionEnd(t){this._composing=!1,this._compositionMode&&this.onChange(t)}};e.\u0275fac=function(n){return new(n||e)(a(w),a(F),a(Ye,8))},e.\u0275dir=u({type:e,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(n,s){n&1&&m("input",function(l){return s._handleInput(l.target.value)})("blur",function(){return s.onTouched()})("compositionstart",function(){return s._compositionStart()})("compositionend",function(l){return s._compositionEnd(l.target.value)})},features:[h([Ze]),d]});let i=e;return i})();function y(i){return i==null||(typeof i=="string"||Array.isArray(i))&&i.length===0}function be(i){return i!=null&&typeof i.length=="number"}var A=new _("NgValidators"),ie=new _("NgAsyncValidators"),Ke=/^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,he=class{static min(e){return Je(e)}static max(e){return Qe(e)}static required(e){return Ae(e)}static requiredTrue(e){return et(e)}static email(e){return Me(e)}static minLength(e){return tt(e)}static maxLength(e){return it(e)}static pattern(e){return Ee(e)}static nullValidator(e){return U(e)}static compose(e){return Ne(e)}static composeAsync(e){return Pe(e)}};function Je(i){return e=>{if(y(e.value)||y(i))return null;let r=parseFloat(e.value);return!isNaN(r)&&r<i?{min:{min:i,actual:e.value}}:null}}function Qe(i){return e=>{if(y(e.value)||y(i))return null;let r=parseFloat(e.value);return!isNaN(r)&&r>i?{max:{max:i,actual:e.value}}:null}}function Ae(i){return y(i.value)?{required:!0}:null}function et(i){return i.value===!0?null:{required:!0}}function Me(i){return y(i.value)||Ke.test(i.value)?null:{email:!0}}function tt(i){return e=>y(e.value)||!be(e.value)?null:e.value.length<i?{minlength:{requiredLength:i,actualLength:e.value.length}}:null}function it(i){return e=>be(e.value)&&e.value.length>i?{maxlength:{requiredLength:i,actualLength:e.value.length}}:null}function Ee(i){if(!i)return U;let e,r;return typeof i=="string"?(r="",i.charAt(0)!=="^"&&(r+="^"),r+=i,i.charAt(i.length-1)!=="$"&&(r+="$"),e=new RegExp(r)):(r=i.toString(),e=i),t=>{if(y(t.value))return null;let n=t.value;return e.test(n)?null:{pattern:{requiredPattern:r,actualValue:n}}}}function U(i){return null}function Fe(i){return i!=null}function we(i){return ce(i)?ae(i):i}function Ie(i){let e={};return i.forEach(r=>{e=r!=null?g(g({},e),r):e}),Object.keys(e).length===0?null:e}function Se(i,e){return e.map(r=>r(i))}function nt(i){return!i.validate}function Oe(i){return i.map(e=>nt(e)?e:r=>e.validate(r))}function Ne(i){if(!i)return null;let e=i.filter(Fe);return e.length==0?null:function(r){return Ie(Se(r,e))}}function ne(i){return i!=null?Ne(Oe(i)):null}function Pe(i){if(!i)return null;let e=i.filter(Fe);return e.length==0?null:function(r){let t=Se(r,e).map(we);return ue(t).pipe(le(Ie))}}function re(i){return i!=null?Pe(Oe(i)):null}function fe(i,e){return i===null?[e]:Array.isArray(i)?[...i,e]:[i,e]}function xe(i){return i._rawValidators}function ke(i){return i._rawAsyncValidators}function te(i){return i?Array.isArray(i)?i:[i]:[]}function R(i,e){return Array.isArray(i)?i.includes(e):i===e}function pe(i,e){let r=te(e);return te(i).forEach(n=>{R(r,n)||r.push(n)}),r}function ge(i,e){return te(e).filter(r=>!R(i,r))}var H=class{constructor(){this._rawValidators=[],this._rawAsyncValidators=[],this._onDestroyCallbacks=[]}get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_setValidators(e){this._rawValidators=e||[],this._composedValidatorFn=ne(this._rawValidators)}_setAsyncValidators(e){this._rawAsyncValidators=e||[],this._composedAsyncValidatorFn=re(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_registerOnDestroy(e){this._onDestroyCallbacks.push(e)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(e=>e()),this._onDestroyCallbacks=[]}reset(e=void 0){this.control&&this.control.reset(e)}hasError(e,r){return this.control?this.control.hasError(e,r):!1}getError(e,r){return this.control?this.control.getError(e,r):null}},v=class extends H{get formDirective(){return null}get path(){return null}},N=class extends H{constructor(){super(...arguments),this._parent=null,this.name=null,this.valueAccessor=null}},L=class{constructor(e){this._cd=e}get isTouched(){return!!this._cd?.control?.touched}get isUntouched(){return!!this._cd?.control?.untouched}get isPristine(){return!!this._cd?.control?.pristine}get isDirty(){return!!this._cd?.control?.dirty}get isValid(){return!!this._cd?.control?.valid}get isInvalid(){return!!this._cd?.control?.invalid}get isPending(){return!!this._cd?.control?.pending}get isSubmitted(){return!!this._cd?.submitted}},rt={"[class.ng-untouched]":"isUntouched","[class.ng-touched]":"isTouched","[class.ng-pristine]":"isPristine","[class.ng-dirty]":"isDirty","[class.ng-valid]":"isValid","[class.ng-invalid]":"isInvalid","[class.ng-pending]":"isPending"},oi=C(g({},rt),{"[class.ng-submitted]":"isSubmitted"}),ai=(()=>{let e=class e extends L{constructor(t){super(t)}};e.\u0275fac=function(n){return new(n||e)(a(N,2))},e.\u0275dir=u({type:e,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(n,s){n&2&&Q("ng-untouched",s.isUntouched)("ng-touched",s.isTouched)("ng-pristine",s.isPristine)("ng-dirty",s.isDirty)("ng-valid",s.isValid)("ng-invalid",s.isInvalid)("ng-pending",s.isPending)},features:[d]});let i=e;return i})(),li=(()=>{let e=class e extends L{constructor(t){super(t)}};e.\u0275fac=function(n){return new(n||e)(a(v,10))},e.\u0275dir=u({type:e,selectors:[["","formGroupName",""],["","formArrayName",""],["","ngModelGroup",""],["","formGroup",""],["form",3,"ngNoForm",""],["","ngForm",""]],hostVars:16,hostBindings:function(n,s){n&2&&Q("ng-untouched",s.isUntouched)("ng-touched",s.isTouched)("ng-pristine",s.isPristine)("ng-dirty",s.isDirty)("ng-valid",s.isValid)("ng-invalid",s.isInvalid)("ng-pending",s.isPending)("ng-submitted",s.isSubmitted)},features:[d]});let i=e;return i})();var I="VALID",B="INVALID",D="PENDING",S="DISABLED";function Ge(i){return(X(i)?i.validators:i)||null}function st(i){return Array.isArray(i)?ne(i):i||null}function je(i,e){return(X(e)?e.asyncValidators:i)||null}function ot(i){return Array.isArray(i)?re(i):i||null}function X(i){return i!=null&&!Array.isArray(i)&&typeof i=="object"}function at(i,e,r){let t=i.controls;if(!(e?Object.keys(t):t).length)throw new G(1e3,"");if(!t[r])throw new G(1001,"")}function lt(i,e,r){i._forEachChild((t,n)=>{if(r[n]===void 0)throw new G(1002,"")})}var $=class{constructor(e,r){this._pendingDirty=!1,this._hasOwnPendingAsyncValidator=!1,this._pendingTouched=!1,this._onCollectionChange=()=>{},this._parent=null,this.pristine=!0,this.touched=!1,this._onDisabledChange=[],this._assignValidators(e),this._assignAsyncValidators(r)}get validator(){return this._composedValidatorFn}set validator(e){this._rawValidators=this._composedValidatorFn=e}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(e){this._rawAsyncValidators=this._composedAsyncValidatorFn=e}get parent(){return this._parent}get valid(){return this.status===I}get invalid(){return this.status===B}get pending(){return this.status==D}get disabled(){return this.status===S}get enabled(){return this.status!==S}get dirty(){return!this.pristine}get untouched(){return!this.touched}get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(e){this._assignValidators(e)}setAsyncValidators(e){this._assignAsyncValidators(e)}addValidators(e){this.setValidators(pe(e,this._rawValidators))}addAsyncValidators(e){this.setAsyncValidators(pe(e,this._rawAsyncValidators))}removeValidators(e){this.setValidators(ge(e,this._rawValidators))}removeAsyncValidators(e){this.setAsyncValidators(ge(e,this._rawAsyncValidators))}hasValidator(e){return R(this._rawValidators,e)}hasAsyncValidator(e){return R(this._rawAsyncValidators,e)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(e={}){this.touched=!0,this._parent&&!e.onlySelf&&this._parent.markAsTouched(e)}markAllAsTouched(){this.markAsTouched({onlySelf:!0}),this._forEachChild(e=>e.markAllAsTouched())}markAsUntouched(e={}){this.touched=!1,this._pendingTouched=!1,this._forEachChild(r=>{r.markAsUntouched({onlySelf:!0})}),this._parent&&!e.onlySelf&&this._parent._updateTouched(e)}markAsDirty(e={}){this.pristine=!1,this._parent&&!e.onlySelf&&this._parent.markAsDirty(e)}markAsPristine(e={}){this.pristine=!0,this._pendingDirty=!1,this._forEachChild(r=>{r.markAsPristine({onlySelf:!0})}),this._parent&&!e.onlySelf&&this._parent._updatePristine(e)}markAsPending(e={}){this.status=D,e.emitEvent!==!1&&this.statusChanges.emit(this.status),this._parent&&!e.onlySelf&&this._parent.markAsPending(e)}disable(e={}){let r=this._parentMarkedDirty(e.onlySelf);this.status=S,this.errors=null,this._forEachChild(t=>{t.disable(C(g({},e),{onlySelf:!0}))}),this._updateValue(),e.emitEvent!==!1&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(C(g({},e),{skipPristineCheck:r})),this._onDisabledChange.forEach(t=>t(!0))}enable(e={}){let r=this._parentMarkedDirty(e.onlySelf);this.status=I,this._forEachChild(t=>{t.enable(C(g({},e),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent}),this._updateAncestors(C(g({},e),{skipPristineCheck:r})),this._onDisabledChange.forEach(t=>t(!1))}_updateAncestors(e){this._parent&&!e.onlySelf&&(this._parent.updateValueAndValidity(e),e.skipPristineCheck||this._parent._updatePristine(),this._parent._updateTouched())}setParent(e){this._parent=e}getRawValue(){return this.value}updateValueAndValidity(e={}){this._setInitialStatus(),this._updateValue(),this.enabled&&(this._cancelExistingSubscription(),this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===I||this.status===D)&&this._runAsyncValidator(e.emitEvent)),e.emitEvent!==!1&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!e.onlySelf&&this._parent.updateValueAndValidity(e)}_updateTreeValidity(e={emitEvent:!0}){this._forEachChild(r=>r._updateTreeValidity(e)),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?S:I}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(e){if(this.asyncValidator){this.status=D,this._hasOwnPendingAsyncValidator=!0;let r=we(this.asyncValidator(this));this._asyncValidationSubscription=r.subscribe(t=>{this._hasOwnPendingAsyncValidator=!1,this.setErrors(t,{emitEvent:e})})}}_cancelExistingSubscription(){this._asyncValidationSubscription&&(this._asyncValidationSubscription.unsubscribe(),this._hasOwnPendingAsyncValidator=!1)}setErrors(e,r={}){this.errors=e,this._updateControlsErrors(r.emitEvent!==!1)}get(e){let r=e;return r==null||(Array.isArray(r)||(r=r.split(".")),r.length===0)?null:r.reduce((t,n)=>t&&t._find(n),this)}getError(e,r){let t=r?this.get(r):this;return t&&t.errors?t.errors[e]:null}hasError(e,r){return!!this.getError(e,r)}get root(){let e=this;for(;e._parent;)e=e._parent;return e}_updateControlsErrors(e){this.status=this._calculateStatus(),e&&this.statusChanges.emit(this.status),this._parent&&this._parent._updateControlsErrors(e)}_initObservables(){this.valueChanges=new V,this.statusChanges=new V}_calculateStatus(){return this._allControlsDisabled()?S:this.errors?B:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(D)?D:this._anyControlsHaveStatus(B)?B:I}_anyControlsHaveStatus(e){return this._anyControls(r=>r.status===e)}_anyControlsDirty(){return this._anyControls(e=>e.dirty)}_anyControlsTouched(){return this._anyControls(e=>e.touched)}_updatePristine(e={}){this.pristine=!this._anyControlsDirty(),this._parent&&!e.onlySelf&&this._parent._updatePristine(e)}_updateTouched(e={}){this.touched=this._anyControlsTouched(),this._parent&&!e.onlySelf&&this._parent._updateTouched(e)}_registerOnCollectionChange(e){this._onCollectionChange=e}_setUpdateStrategy(e){X(e)&&e.updateOn!=null&&(this._updateOn=e.updateOn)}_parentMarkedDirty(e){let r=this._parent&&this._parent.dirty;return!e&&!!r&&!this._parent._anyControlsDirty()}_find(e){return null}_assignValidators(e){this._rawValidators=Array.isArray(e)?e.slice():e,this._composedValidatorFn=st(this._rawValidators)}_assignAsyncValidators(e){this._rawAsyncValidators=Array.isArray(e)?e.slice():e,this._composedAsyncValidatorFn=ot(this._rawAsyncValidators)}},W=class extends ${constructor(e,r,t){super(Ge(r),je(t,r)),this.controls=e,this._initObservables(),this._setUpdateStrategy(r),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}registerControl(e,r){return this.controls[e]?this.controls[e]:(this.controls[e]=r,r.setParent(this),r._registerOnCollectionChange(this._onCollectionChange),r)}addControl(e,r,t={}){this.registerControl(e,r),this.updateValueAndValidity({emitEvent:t.emitEvent}),this._onCollectionChange()}removeControl(e,r={}){this.controls[e]&&this.controls[e]._registerOnCollectionChange(()=>{}),delete this.controls[e],this.updateValueAndValidity({emitEvent:r.emitEvent}),this._onCollectionChange()}setControl(e,r,t={}){this.controls[e]&&this.controls[e]._registerOnCollectionChange(()=>{}),delete this.controls[e],r&&this.registerControl(e,r),this.updateValueAndValidity({emitEvent:t.emitEvent}),this._onCollectionChange()}contains(e){return this.controls.hasOwnProperty(e)&&this.controls[e].enabled}setValue(e,r={}){lt(this,!0,e),Object.keys(e).forEach(t=>{at(this,!0,t),this.controls[t].setValue(e[t],{onlySelf:!0,emitEvent:r.emitEvent})}),this.updateValueAndValidity(r)}patchValue(e,r={}){e!=null&&(Object.keys(e).forEach(t=>{let n=this.controls[t];n&&n.patchValue(e[t],{onlySelf:!0,emitEvent:r.emitEvent})}),this.updateValueAndValidity(r))}reset(e={},r={}){this._forEachChild((t,n)=>{t.reset(e?e[n]:null,{onlySelf:!0,emitEvent:r.emitEvent})}),this._updatePristine(r),this._updateTouched(r),this.updateValueAndValidity(r)}getRawValue(){return this._reduceChildren({},(e,r,t)=>(e[t]=r.getRawValue(),e))}_syncPendingControls(){let e=this._reduceChildren(!1,(r,t)=>t._syncPendingControls()?!0:r);return e&&this.updateValueAndValidity({onlySelf:!0}),e}_forEachChild(e){Object.keys(this.controls).forEach(r=>{let t=this.controls[r];t&&e(t,r)})}_setUpControls(){this._forEachChild(e=>{e.setParent(this),e._registerOnCollectionChange(this._onCollectionChange)})}_updateValue(){this.value=this._reduceValue()}_anyControls(e){for(let[r,t]of Object.entries(this.controls))if(this.contains(r)&&e(t))return!0;return!1}_reduceValue(){let e={};return this._reduceChildren(e,(r,t,n)=>((t.enabled||this.disabled)&&(r[n]=t.value),r))}_reduceChildren(e,r){let t=e;return this._forEachChild((n,s)=>{t=r(t,n,s)}),t}_allControlsDisabled(){for(let e of Object.keys(this.controls))if(this.controls[e].enabled)return!1;return Object.keys(this.controls).length>0||this.disabled}_find(e){return this.controls.hasOwnProperty(e)?this.controls[e]:null}};var x=new _("CallSetDisabledState",{providedIn:"root",factory:()=>Y}),Y="always";function ut(i,e){return[...e.path,i]}function q(i,e,r=Y){se(i,e),e.valueAccessor.writeValue(i.value),(i.disabled||r==="always")&&e.valueAccessor.setDisabledState?.(i.disabled),ct(i,e),ft(i,e),ht(i,e),dt(i,e)}function me(i,e,r=!0){let t=()=>{};e.valueAccessor&&(e.valueAccessor.registerOnChange(t),e.valueAccessor.registerOnTouched(t)),Z(i,e),i&&(e._invokeOnDestroyCallbacks(),i._registerOnCollectionChange(()=>{}))}function z(i,e){i.forEach(r=>{r.registerOnValidatorChange&&r.registerOnValidatorChange(e)})}function dt(i,e){if(e.valueAccessor.setDisabledState){let r=t=>{e.valueAccessor.setDisabledState(t)};i.registerOnDisabledChange(r),e._registerOnDestroy(()=>{i._unregisterOnDisabledChange(r)})}}function se(i,e){let r=xe(i);e.validator!==null?i.setValidators(fe(r,e.validator)):typeof r=="function"&&i.setValidators([r]);let t=ke(i);e.asyncValidator!==null?i.setAsyncValidators(fe(t,e.asyncValidator)):typeof t=="function"&&i.setAsyncValidators([t]);let n=()=>i.updateValueAndValidity();z(e._rawValidators,n),z(e._rawAsyncValidators,n)}function Z(i,e){let r=!1;if(i!==null){if(e.validator!==null){let n=xe(i);if(Array.isArray(n)&&n.length>0){let s=n.filter(o=>o!==e.validator);s.length!==n.length&&(r=!0,i.setValidators(s))}}if(e.asyncValidator!==null){let n=ke(i);if(Array.isArray(n)&&n.length>0){let s=n.filter(o=>o!==e.asyncValidator);s.length!==n.length&&(r=!0,i.setAsyncValidators(s))}}}let t=()=>{};return z(e._rawValidators,t),z(e._rawAsyncValidators,t),r}function ct(i,e){e.valueAccessor.registerOnChange(r=>{i._pendingValue=r,i._pendingChange=!0,i._pendingDirty=!0,i.updateOn==="change"&&Te(i,e)})}function ht(i,e){e.valueAccessor.registerOnTouched(()=>{i._pendingTouched=!0,i.updateOn==="blur"&&i._pendingChange&&Te(i,e),i.updateOn!=="submit"&&i.markAsTouched()})}function Te(i,e){i._pendingDirty&&i.markAsDirty(),i.setValue(i._pendingValue,{emitModelToViewChange:!1}),e.viewToModelUpdate(i._pendingValue),i._pendingChange=!1}function ft(i,e){let r=(t,n)=>{e.valueAccessor.writeValue(t),n&&e.viewToModelUpdate(t)};i.registerOnChange(r),e._registerOnDestroy(()=>{i._unregisterOnChange(r)})}function Be(i,e){i==null,se(i,e)}function pt(i,e){return Z(i,e)}function gt(i,e){if(!i.hasOwnProperty("model"))return!1;let r=i.model;return r.isFirstChange()?!0:!Object.is(e,r.currentValue)}function mt(i){return Object.getPrototypeOf(i.constructor)===P}function Ue(i,e){i._syncPendingControls(),e.forEach(r=>{let t=r.control;t.updateOn==="submit"&&t._pendingChange&&(r.viewToModelUpdate(t._pendingValue),t._pendingChange=!1)})}function yt(i,e){if(!e)return null;Array.isArray(e);let r,t,n;return e.forEach(s=>{s.constructor===De?r=s:mt(s)?t=s:n=s}),n||t||r||null}function vt(i,e){let r=i.indexOf(e);r>-1&&i.splice(r,1)}var _t={provide:v,useExisting:c(()=>Ct)},O=(()=>Promise.resolve())(),Ct=(()=>{let e=class e extends v{constructor(t,n,s){super(),this.callSetDisabledState=s,this.submitted=!1,this._directives=new Set,this.ngSubmit=new V,this.form=new W({},ne(t),re(n))}ngAfterViewInit(){this._setUpdateStrategy()}get formDirective(){return this}get control(){return this.form}get path(){return[]}get controls(){return this.form.controls}addControl(t){O.then(()=>{let n=this._findContainer(t.path);t.control=n.registerControl(t.name,t.control),q(t.control,t,this.callSetDisabledState),t.control.updateValueAndValidity({emitEvent:!1}),this._directives.add(t)})}getControl(t){return this.form.get(t.path)}removeControl(t){O.then(()=>{let n=this._findContainer(t.path);n&&n.removeControl(t.name),this._directives.delete(t)})}addFormGroup(t){O.then(()=>{let n=this._findContainer(t.path),s=new W({});Be(s,t),n.registerControl(t.name,s),s.updateValueAndValidity({emitEvent:!1})})}removeFormGroup(t){O.then(()=>{let n=this._findContainer(t.path);n&&n.removeControl(t.name)})}getFormGroup(t){return this.form.get(t.path)}updateModel(t,n){O.then(()=>{this.form.get(t.path).setValue(n)})}setValue(t){this.control.setValue(t)}onSubmit(t){return this.submitted=!0,Ue(this.form,this._directives),this.ngSubmit.emit(t),t?.target?.method==="dialog"}onReset(){this.resetForm()}resetForm(t=void 0){this.form.reset(t),this.submitted=!1}_setUpdateStrategy(){this.options&&this.options.updateOn!=null&&(this.form._updateOn=this.options.updateOn)}_findContainer(t){return t.pop(),t.length?this.form.get(t):this.form}};e.\u0275fac=function(n){return new(n||e)(a(A,10),a(ie,10),a(x,8))},e.\u0275dir=u({type:e,selectors:[["form",3,"ngNoForm","",3,"formGroup",""],["ng-form"],["","ngForm",""]],hostBindings:function(n,s){n&1&&m("submit",function(l){return s.onSubmit(l)})("reset",function(){return s.onReset()})},inputs:{options:["ngFormOptions","options"]},outputs:{ngSubmit:"ngSubmit"},exportAs:["ngForm"],features:[h([_t]),d]});let i=e;return i})();function ye(i,e){let r=i.indexOf(e);r>-1&&i.splice(r,1)}function ve(i){return typeof i=="object"&&i!==null&&Object.keys(i).length===2&&"value"in i&&"disabled"in i}var Re=class extends ${constructor(e=null,r,t){super(Ge(r),je(t,r)),this.defaultValue=null,this._onChange=[],this._pendingChange=!1,this._applyFormState(e),this._setUpdateStrategy(r),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator}),X(r)&&(r.nonNullable||r.initialValueIsDefault)&&(ve(e)?this.defaultValue=e.value:this.defaultValue=e)}setValue(e,r={}){this.value=this._pendingValue=e,this._onChange.length&&r.emitModelToViewChange!==!1&&this._onChange.forEach(t=>t(this.value,r.emitViewToModelChange!==!1)),this.updateValueAndValidity(r)}patchValue(e,r={}){this.setValue(e,r)}reset(e=this.defaultValue,r={}){this._applyFormState(e),this.markAsPristine(r),this.markAsUntouched(r),this.setValue(this.value,r),this._pendingChange=!1}_updateValue(){}_anyControls(e){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(e){this._onChange.push(e)}_unregisterOnChange(e){ye(this._onChange,e)}registerOnDisabledChange(e){this._onDisabledChange.push(e)}_unregisterOnDisabledChange(e){ye(this._onDisabledChange,e)}_forEachChild(e){}_syncPendingControls(){return this.updateOn==="submit"&&(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),this._pendingChange)?(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),!0):!1}_applyFormState(e){ve(e)?(this.value=this._pendingValue=e.value,e.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=e}};var Vt=i=>i instanceof Re;var Dt={provide:N,useExisting:c(()=>bt)},_e=(()=>Promise.resolve())(),bt=(()=>{let e=class e extends N{constructor(t,n,s,o,l,f){super(),this._changeDetectorRef=l,this.callSetDisabledState=f,this.control=new Re,this._registered=!1,this.name="",this.update=new V,this._parent=t,this._setValidators(n),this._setAsyncValidators(s),this.valueAccessor=yt(this,o)}ngOnChanges(t){if(this._checkForErrors(),!this._registered||"name"in t){if(this._registered&&(this._checkName(),this.formDirective)){let n=t.name.previousValue;this.formDirective.removeControl({name:n,path:this._getPath(n)})}this._setUpControl()}"isDisabled"in t&&this._updateDisabled(t),gt(t,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._getPath(this.name)}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(t){this.viewModel=t,this.update.emit(t)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&this.options.updateOn!=null&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!!(this.options&&this.options.standalone)}_setUpStandalone(){q(this.control,this,this.callSetDisabledState),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._isStandalone()||this._checkParentType(),this._checkName()}_checkParentType(){}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),!this._isStandalone()&&this.name}_updateValue(t){_e.then(()=>{this.control.setValue(t,{emitViewToModelChange:!1}),this._changeDetectorRef?.markForCheck()})}_updateDisabled(t){let n=t.isDisabled.currentValue,s=n!==0&&T(n);_e.then(()=>{s&&!this.control.disabled?this.control.disable():!s&&this.control.disabled&&this.control.enable(),this._changeDetectorRef?.markForCheck()})}_getPath(t){return this._parent?ut(t,this._parent):[t]}};e.\u0275fac=function(n){return new(n||e)(a(v,9),a(A,10),a(ie,10),a(b,10),a(de,8),a(x,8))},e.\u0275dir=u({type:e,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:["disabled","isDisabled"],model:["ngModel","model"],options:["ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],features:[h([Dt]),d,j]});let i=e;return i})(),di=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=u({type:e,selectors:[["form",3,"ngNoForm","",3,"ngNativeValidate",""]],hostAttrs:["novalidate",""]});let i=e;return i})(),At={provide:b,useExisting:c(()=>Mt),multi:!0},Mt=(()=>{let e=class e extends P{writeValue(t){let n=t??"";this.setProperty("value",n)}registerOnChange(t){this.onChange=n=>{t(n==""?null:parseFloat(n))}}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["input","type","number","formControlName",""],["input","type","number","formControl",""],["input","type","number","ngModel",""]],hostBindings:function(n,s){n&1&&m("input",function(l){return s.onChange(l.target.value)})("blur",function(){return s.onTouched()})},features:[h([At]),d]});let i=e;return i})();var Et=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({});let i=e;return i})();var Ft=new _("NgModelWithFormControlWarning");var wt={provide:v,useExisting:c(()=>It)},It=(()=>{let e=class e extends v{constructor(t,n,s){super(),this.callSetDisabledState=s,this.submitted=!1,this._onCollectionChange=()=>this._updateDomValue(),this.directives=[],this.form=null,this.ngSubmit=new V,this._setValidators(t),this._setAsyncValidators(n)}ngOnChanges(t){this._checkFormPresent(),t.hasOwnProperty("form")&&(this._updateValidators(),this._updateDomValue(),this._updateRegistrations(),this._oldForm=this.form)}ngOnDestroy(){this.form&&(Z(this.form,this),this.form._onCollectionChange===this._onCollectionChange&&this.form._registerOnCollectionChange(()=>{}))}get formDirective(){return this}get control(){return this.form}get path(){return[]}addControl(t){let n=this.form.get(t.path);return q(n,t,this.callSetDisabledState),n.updateValueAndValidity({emitEvent:!1}),this.directives.push(t),n}getControl(t){return this.form.get(t.path)}removeControl(t){me(t.control||null,t,!1),vt(this.directives,t)}addFormGroup(t){this._setUpFormContainer(t)}removeFormGroup(t){this._cleanUpFormContainer(t)}getFormGroup(t){return this.form.get(t.path)}addFormArray(t){this._setUpFormContainer(t)}removeFormArray(t){this._cleanUpFormContainer(t)}getFormArray(t){return this.form.get(t.path)}updateModel(t,n){this.form.get(t.path).setValue(n)}onSubmit(t){return this.submitted=!0,Ue(this.form,this.directives),this.ngSubmit.emit(t),t?.target?.method==="dialog"}onReset(){this.resetForm()}resetForm(t=void 0){this.form.reset(t),this.submitted=!1}_updateDomValue(){this.directives.forEach(t=>{let n=t.control,s=this.form.get(t.path);n!==s&&(me(n||null,t),Vt(s)&&(q(s,t,this.callSetDisabledState),t.control=s))}),this.form._updateTreeValidity({emitEvent:!1})}_setUpFormContainer(t){let n=this.form.get(t.path);Be(n,t),n.updateValueAndValidity({emitEvent:!1})}_cleanUpFormContainer(t){if(this.form){let n=this.form.get(t.path);n&&pt(n,t)&&n.updateValueAndValidity({emitEvent:!1})}}_updateRegistrations(){this.form._registerOnCollectionChange(this._onCollectionChange),this._oldForm&&this._oldForm._registerOnCollectionChange(()=>{})}_updateValidators(){se(this.form,this),this._oldForm&&Z(this._oldForm,this)}_checkFormPresent(){this.form}};e.\u0275fac=function(n){return new(n||e)(a(A,10),a(ie,10),a(x,8))},e.\u0275dir=u({type:e,selectors:[["","formGroup",""]],hostBindings:function(n,s){n&1&&m("submit",function(l){return s.onSubmit(l)})("reset",function(){return s.onReset()})},inputs:{form:["formGroup","form"]},outputs:{ngSubmit:"ngSubmit"},exportAs:["ngForm"],features:[h([wt]),d,j]});let i=e;return i})();var St={provide:b,useExisting:c(()=>Le),multi:!0};function He(i,e){return i==null?`${e}`:(e&&typeof e=="object"&&(e="Object"),`${i}: ${e}`.slice(0,50))}function Ot(i){return i.split(":")[0]}var Le=(()=>{let e=class e extends P{constructor(){super(...arguments),this._optionMap=new Map,this._idCounter=0,this._compareWith=Object.is}set compareWith(t){this._compareWith=t}writeValue(t){this.value=t;let n=this._getOptionId(t),s=He(n,t);this.setProperty("value",s)}registerOnChange(t){this.onChange=n=>{this.value=this._getOptionValue(n),t(this.value)}}_registerOption(){return(this._idCounter++).toString()}_getOptionId(t){for(let n of this._optionMap.keys())if(this._compareWith(this._optionMap.get(n),t))return n;return null}_getOptionValue(t){let n=Ot(t);return this._optionMap.has(n)?this._optionMap.get(n):t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["select","formControlName","",3,"multiple",""],["select","formControl","",3,"multiple",""],["select","ngModel","",3,"multiple",""]],hostBindings:function(n,s){n&1&&m("change",function(l){return s.onChange(l.target.value)})("blur",function(){return s.onTouched()})},inputs:{compareWith:"compareWith"},features:[h([St]),d]});let i=e;return i})(),ci=(()=>{let e=class e{constructor(t,n,s){this._element=t,this._renderer=n,this._select=s,this._select&&(this.id=this._select._registerOption())}set ngValue(t){this._select!=null&&(this._select._optionMap.set(this.id,t),this._setElementValue(He(this.id,t)),this._select.writeValue(this._select.value))}set value(t){this._setElementValue(t),this._select&&this._select.writeValue(this._select.value)}_setElementValue(t){this._renderer.setProperty(this._element.nativeElement,"value",t)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id),this._select.writeValue(this._select.value))}};e.\u0275fac=function(n){return new(n||e)(a(F),a(w),a(Le,9))},e.\u0275dir=u({type:e,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"}});let i=e;return i})(),Nt={provide:b,useExisting:c(()=>$e),multi:!0};function Ce(i,e){return i==null?`${e}`:(typeof e=="string"&&(e=`'${e}'`),e&&typeof e=="object"&&(e="Object"),`${i}: ${e}`.slice(0,50))}function Pt(i){return i.split(":")[0]}var $e=(()=>{let e=class e extends P{constructor(){super(...arguments),this._optionMap=new Map,this._idCounter=0,this._compareWith=Object.is}set compareWith(t){this._compareWith=t}writeValue(t){this.value=t;let n;if(Array.isArray(t)){let s=t.map(o=>this._getOptionId(o));n=(o,l)=>{o._setSelected(s.indexOf(l.toString())>-1)}}else n=(s,o)=>{s._setSelected(!1)};this._optionMap.forEach(n)}registerOnChange(t){this.onChange=n=>{let s=[],o=n.selectedOptions;if(o!==void 0){let l=o;for(let f=0;f<l.length;f++){let k=l[f],K=this._getOptionValue(k.value);s.push(K)}}else{let l=n.options;for(let f=0;f<l.length;f++){let k=l[f];if(k.selected){let K=this._getOptionValue(k.value);s.push(K)}}}this.value=s,t(s)}}_registerOption(t){let n=(this._idCounter++).toString();return this._optionMap.set(n,t),n}_getOptionId(t){for(let n of this._optionMap.keys())if(this._compareWith(this._optionMap.get(n)._value,t))return n;return null}_getOptionValue(t){let n=Pt(t);return this._optionMap.has(n)?this._optionMap.get(n)._value:t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["select","multiple","","formControlName",""],["select","multiple","","formControl",""],["select","multiple","","ngModel",""]],hostBindings:function(n,s){n&1&&m("change",function(l){return s.onChange(l.target)})("blur",function(){return s.onTouched()})},inputs:{compareWith:"compareWith"},features:[h([Nt]),d]});let i=e;return i})(),hi=(()=>{let e=class e{constructor(t,n,s){this._element=t,this._renderer=n,this._select=s,this._select&&(this.id=this._select._registerOption(this))}set ngValue(t){this._select!=null&&(this._value=t,this._setElementValue(Ce(this.id,t)),this._select.writeValue(this._select.value))}set value(t){this._select?(this._value=t,this._setElementValue(Ce(this.id,t)),this._select.writeValue(this._select.value)):this._setElementValue(t)}_setElementValue(t){this._renderer.setProperty(this._element.nativeElement,"value",t)}_setSelected(t){this._renderer.setProperty(this._element.nativeElement,"selected",t)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id),this._select.writeValue(this._select.value))}};e.\u0275fac=function(n){return new(n||e)(a(F),a(w),a($e,9))},e.\u0275dir=u({type:e,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"}});let i=e;return i})();var oe=(()=>{let e=class e{constructor(){this._validator=U}ngOnChanges(t){if(this.inputName in t){let n=this.normalizeInput(t[this.inputName].currentValue);this._enabled=this.enabled(n),this._validator=this._enabled?this.createValidator(n):U,this._onChange&&this._onChange()}}validate(t){return this._validator(t)}registerOnValidatorChange(t){this._onChange=t}enabled(t){return t!=null}};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=u({type:e,features:[j]});let i=e;return i})();var xt={provide:A,useExisting:c(()=>kt),multi:!0};var kt=(()=>{let e=class e extends oe{constructor(){super(...arguments),this.inputName="required",this.normalizeInput=T,this.createValidator=t=>Ae}enabled(t){return t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["","required","","formControlName","",3,"type","checkbox"],["","required","","formControl","",3,"type","checkbox"],["","required","","ngModel","",3,"type","checkbox"]],hostVars:1,hostBindings:function(n,s){n&2&&J("required",s._enabled?"":null)},inputs:{required:"required"},features:[h([xt]),d]});let i=e;return i})();var Gt={provide:A,useExisting:c(()=>jt),multi:!0},jt=(()=>{let e=class e extends oe{constructor(){super(...arguments),this.inputName="email",this.normalizeInput=T,this.createValidator=t=>Me}enabled(t){return t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["","email","","formControlName",""],["","email","","formControl",""],["","email","","ngModel",""]],inputs:{email:"email"},features:[h([Gt]),d]});let i=e;return i})();var Tt={provide:A,useExisting:c(()=>Bt),multi:!0},Bt=(()=>{let e=class e extends oe{constructor(){super(...arguments),this.inputName="pattern",this.normalizeInput=t=>t,this.createValidator=t=>Ee(t)}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["","pattern","","formControlName",""],["","pattern","","formControl",""],["","pattern","","ngModel",""]],hostVars:1,hostBindings:function(n,s){n&2&&J("pattern",s._enabled?s.pattern:null)},inputs:{pattern:"pattern"},features:[h([Tt]),d]});let i=e;return i})();var We=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({imports:[Et]});let i=e;return i})();var fi=(()=>{let e=class e{static withConfig(t){return{ngModule:e,providers:[{provide:x,useValue:t.callSetDisabledState??Y}]}}};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({imports:[We]});let i=e;return i})(),pi=(()=>{let e=class e{static withConfig(t){return{ngModule:e,providers:[{provide:Ft,useValue:t.warnOnNgModelWithFormControl??"always"},{provide:x,useValue:t.callSetDisabledState??Y}]}}};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({imports:[We]});let i=e;return i})();export{b as a,ze as b,De as c,A as d,he as e,v as f,N as g,ai as h,li as i,Ct as j,bt as k,di as l,Mt as m,It as n,Le as o,ci as p,hi as q,kt as r,jt as s,Bt as t,fi as u,pi as v};
|
|
1
|
+
import{Ba as F,Da as w,Ga as a,Ia as de,Ja as V,La as d,Na as J,Qa as Q,Sb as T,Ub as ee,Z as c,_ as G,aa as M,ba as _,fa as E,ga as u,gb as ce,hb as m,ia as j,m as ae,na as p,q as le,tb as h,w as ue}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-DJCANNYC.js";import{a as g,b as C}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-R7J6AS67.js";var Ve=(()=>{let e=class e{constructor(t,n){this._renderer=t,this._elementRef=n,this.onChange=s=>{},this.onTouched=()=>{}}setProperty(t,n){this._renderer.setProperty(this._elementRef.nativeElement,t,n)}registerOnTouched(t){this.onTouched=t}registerOnChange(t){this.onChange=t}setDisabledState(t){this.setProperty("disabled",t)}};e.\u0275fac=function(n){return new(n||e)(a(w),a(F))},e.\u0275dir=u({type:e});let i=e;return i})(),P=(()=>{let e=class e extends Ve{};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,features:[d]});let i=e;return i})(),b=new _("NgValueAccessor"),qe={provide:b,useExisting:c(()=>ze),multi:!0},ze=(()=>{let e=class e extends P{writeValue(t){this.setProperty("checked",t)}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["input","type","checkbox","formControlName",""],["input","type","checkbox","formControl",""],["input","type","checkbox","ngModel",""]],hostBindings:function(n,s){n&1&&m("change",function(l){return s.onChange(l.target.checked)})("blur",function(){return s.onTouched()})},features:[h([qe]),d]});let i=e;return i})(),Ze={provide:b,useExisting:c(()=>De),multi:!0};function Xe(){let i=ee()?ee().getUserAgent():"";return/android (\d+)/.test(i.toLowerCase())}var Ye=new _("CompositionEventMode"),De=(()=>{let e=class e extends Ve{constructor(t,n,s){super(t,n),this._compositionMode=s,this._composing=!1,this._compositionMode==null&&(this._compositionMode=!Xe())}writeValue(t){let n=t??"";this.setProperty("value",n)}_handleInput(t){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(t)}_compositionStart(){this._composing=!0}_compositionEnd(t){this._composing=!1,this._compositionMode&&this.onChange(t)}};e.\u0275fac=function(n){return new(n||e)(a(w),a(F),a(Ye,8))},e.\u0275dir=u({type:e,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(n,s){n&1&&m("input",function(l){return s._handleInput(l.target.value)})("blur",function(){return s.onTouched()})("compositionstart",function(){return s._compositionStart()})("compositionend",function(l){return s._compositionEnd(l.target.value)})},features:[h([Ze]),d]});let i=e;return i})();function y(i){return i==null||(typeof i=="string"||Array.isArray(i))&&i.length===0}function be(i){return i!=null&&typeof i.length=="number"}var A=new _("NgValidators"),ie=new _("NgAsyncValidators"),Ke=/^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,he=class{static min(e){return Je(e)}static max(e){return Qe(e)}static required(e){return Ae(e)}static requiredTrue(e){return et(e)}static email(e){return Me(e)}static minLength(e){return tt(e)}static maxLength(e){return it(e)}static pattern(e){return Ee(e)}static nullValidator(e){return U(e)}static compose(e){return Ne(e)}static composeAsync(e){return Pe(e)}};function Je(i){return e=>{if(y(e.value)||y(i))return null;let r=parseFloat(e.value);return!isNaN(r)&&r<i?{min:{min:i,actual:e.value}}:null}}function Qe(i){return e=>{if(y(e.value)||y(i))return null;let r=parseFloat(e.value);return!isNaN(r)&&r>i?{max:{max:i,actual:e.value}}:null}}function Ae(i){return y(i.value)?{required:!0}:null}function et(i){return i.value===!0?null:{required:!0}}function Me(i){return y(i.value)||Ke.test(i.value)?null:{email:!0}}function tt(i){return e=>y(e.value)||!be(e.value)?null:e.value.length<i?{minlength:{requiredLength:i,actualLength:e.value.length}}:null}function it(i){return e=>be(e.value)&&e.value.length>i?{maxlength:{requiredLength:i,actualLength:e.value.length}}:null}function Ee(i){if(!i)return U;let e,r;return typeof i=="string"?(r="",i.charAt(0)!=="^"&&(r+="^"),r+=i,i.charAt(i.length-1)!=="$"&&(r+="$"),e=new RegExp(r)):(r=i.toString(),e=i),t=>{if(y(t.value))return null;let n=t.value;return e.test(n)?null:{pattern:{requiredPattern:r,actualValue:n}}}}function U(i){return null}function Fe(i){return i!=null}function we(i){return ce(i)?ae(i):i}function Ie(i){let e={};return i.forEach(r=>{e=r!=null?g(g({},e),r):e}),Object.keys(e).length===0?null:e}function Se(i,e){return e.map(r=>r(i))}function nt(i){return!i.validate}function Oe(i){return i.map(e=>nt(e)?e:r=>e.validate(r))}function Ne(i){if(!i)return null;let e=i.filter(Fe);return e.length==0?null:function(r){return Ie(Se(r,e))}}function ne(i){return i!=null?Ne(Oe(i)):null}function Pe(i){if(!i)return null;let e=i.filter(Fe);return e.length==0?null:function(r){let t=Se(r,e).map(we);return ue(t).pipe(le(Ie))}}function re(i){return i!=null?Pe(Oe(i)):null}function fe(i,e){return i===null?[e]:Array.isArray(i)?[...i,e]:[i,e]}function xe(i){return i._rawValidators}function ke(i){return i._rawAsyncValidators}function te(i){return i?Array.isArray(i)?i:[i]:[]}function R(i,e){return Array.isArray(i)?i.includes(e):i===e}function pe(i,e){let r=te(e);return te(i).forEach(n=>{R(r,n)||r.push(n)}),r}function ge(i,e){return te(e).filter(r=>!R(i,r))}var H=class{constructor(){this._rawValidators=[],this._rawAsyncValidators=[],this._onDestroyCallbacks=[]}get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_setValidators(e){this._rawValidators=e||[],this._composedValidatorFn=ne(this._rawValidators)}_setAsyncValidators(e){this._rawAsyncValidators=e||[],this._composedAsyncValidatorFn=re(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_registerOnDestroy(e){this._onDestroyCallbacks.push(e)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(e=>e()),this._onDestroyCallbacks=[]}reset(e=void 0){this.control&&this.control.reset(e)}hasError(e,r){return this.control?this.control.hasError(e,r):!1}getError(e,r){return this.control?this.control.getError(e,r):null}},v=class extends H{get formDirective(){return null}get path(){return null}},N=class extends H{constructor(){super(...arguments),this._parent=null,this.name=null,this.valueAccessor=null}},L=class{constructor(e){this._cd=e}get isTouched(){return!!this._cd?.control?.touched}get isUntouched(){return!!this._cd?.control?.untouched}get isPristine(){return!!this._cd?.control?.pristine}get isDirty(){return!!this._cd?.control?.dirty}get isValid(){return!!this._cd?.control?.valid}get isInvalid(){return!!this._cd?.control?.invalid}get isPending(){return!!this._cd?.control?.pending}get isSubmitted(){return!!this._cd?.submitted}},rt={"[class.ng-untouched]":"isUntouched","[class.ng-touched]":"isTouched","[class.ng-pristine]":"isPristine","[class.ng-dirty]":"isDirty","[class.ng-valid]":"isValid","[class.ng-invalid]":"isInvalid","[class.ng-pending]":"isPending"},oi=C(g({},rt),{"[class.ng-submitted]":"isSubmitted"}),ai=(()=>{let e=class e extends L{constructor(t){super(t)}};e.\u0275fac=function(n){return new(n||e)(a(N,2))},e.\u0275dir=u({type:e,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(n,s){n&2&&Q("ng-untouched",s.isUntouched)("ng-touched",s.isTouched)("ng-pristine",s.isPristine)("ng-dirty",s.isDirty)("ng-valid",s.isValid)("ng-invalid",s.isInvalid)("ng-pending",s.isPending)},features:[d]});let i=e;return i})(),li=(()=>{let e=class e extends L{constructor(t){super(t)}};e.\u0275fac=function(n){return new(n||e)(a(v,10))},e.\u0275dir=u({type:e,selectors:[["","formGroupName",""],["","formArrayName",""],["","ngModelGroup",""],["","formGroup",""],["form",3,"ngNoForm",""],["","ngForm",""]],hostVars:16,hostBindings:function(n,s){n&2&&Q("ng-untouched",s.isUntouched)("ng-touched",s.isTouched)("ng-pristine",s.isPristine)("ng-dirty",s.isDirty)("ng-valid",s.isValid)("ng-invalid",s.isInvalid)("ng-pending",s.isPending)("ng-submitted",s.isSubmitted)},features:[d]});let i=e;return i})();var I="VALID",B="INVALID",D="PENDING",S="DISABLED";function Ge(i){return(X(i)?i.validators:i)||null}function st(i){return Array.isArray(i)?ne(i):i||null}function je(i,e){return(X(e)?e.asyncValidators:i)||null}function ot(i){return Array.isArray(i)?re(i):i||null}function X(i){return i!=null&&!Array.isArray(i)&&typeof i=="object"}function at(i,e,r){let t=i.controls;if(!(e?Object.keys(t):t).length)throw new G(1e3,"");if(!t[r])throw new G(1001,"")}function lt(i,e,r){i._forEachChild((t,n)=>{if(r[n]===void 0)throw new G(1002,"")})}var $=class{constructor(e,r){this._pendingDirty=!1,this._hasOwnPendingAsyncValidator=!1,this._pendingTouched=!1,this._onCollectionChange=()=>{},this._parent=null,this.pristine=!0,this.touched=!1,this._onDisabledChange=[],this._assignValidators(e),this._assignAsyncValidators(r)}get validator(){return this._composedValidatorFn}set validator(e){this._rawValidators=this._composedValidatorFn=e}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(e){this._rawAsyncValidators=this._composedAsyncValidatorFn=e}get parent(){return this._parent}get valid(){return this.status===I}get invalid(){return this.status===B}get pending(){return this.status==D}get disabled(){return this.status===S}get enabled(){return this.status!==S}get dirty(){return!this.pristine}get untouched(){return!this.touched}get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(e){this._assignValidators(e)}setAsyncValidators(e){this._assignAsyncValidators(e)}addValidators(e){this.setValidators(pe(e,this._rawValidators))}addAsyncValidators(e){this.setAsyncValidators(pe(e,this._rawAsyncValidators))}removeValidators(e){this.setValidators(ge(e,this._rawValidators))}removeAsyncValidators(e){this.setAsyncValidators(ge(e,this._rawAsyncValidators))}hasValidator(e){return R(this._rawValidators,e)}hasAsyncValidator(e){return R(this._rawAsyncValidators,e)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(e={}){this.touched=!0,this._parent&&!e.onlySelf&&this._parent.markAsTouched(e)}markAllAsTouched(){this.markAsTouched({onlySelf:!0}),this._forEachChild(e=>e.markAllAsTouched())}markAsUntouched(e={}){this.touched=!1,this._pendingTouched=!1,this._forEachChild(r=>{r.markAsUntouched({onlySelf:!0})}),this._parent&&!e.onlySelf&&this._parent._updateTouched(e)}markAsDirty(e={}){this.pristine=!1,this._parent&&!e.onlySelf&&this._parent.markAsDirty(e)}markAsPristine(e={}){this.pristine=!0,this._pendingDirty=!1,this._forEachChild(r=>{r.markAsPristine({onlySelf:!0})}),this._parent&&!e.onlySelf&&this._parent._updatePristine(e)}markAsPending(e={}){this.status=D,e.emitEvent!==!1&&this.statusChanges.emit(this.status),this._parent&&!e.onlySelf&&this._parent.markAsPending(e)}disable(e={}){let r=this._parentMarkedDirty(e.onlySelf);this.status=S,this.errors=null,this._forEachChild(t=>{t.disable(C(g({},e),{onlySelf:!0}))}),this._updateValue(),e.emitEvent!==!1&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(C(g({},e),{skipPristineCheck:r})),this._onDisabledChange.forEach(t=>t(!0))}enable(e={}){let r=this._parentMarkedDirty(e.onlySelf);this.status=I,this._forEachChild(t=>{t.enable(C(g({},e),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent}),this._updateAncestors(C(g({},e),{skipPristineCheck:r})),this._onDisabledChange.forEach(t=>t(!1))}_updateAncestors(e){this._parent&&!e.onlySelf&&(this._parent.updateValueAndValidity(e),e.skipPristineCheck||this._parent._updatePristine(),this._parent._updateTouched())}setParent(e){this._parent=e}getRawValue(){return this.value}updateValueAndValidity(e={}){this._setInitialStatus(),this._updateValue(),this.enabled&&(this._cancelExistingSubscription(),this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===I||this.status===D)&&this._runAsyncValidator(e.emitEvent)),e.emitEvent!==!1&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!e.onlySelf&&this._parent.updateValueAndValidity(e)}_updateTreeValidity(e={emitEvent:!0}){this._forEachChild(r=>r._updateTreeValidity(e)),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?S:I}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(e){if(this.asyncValidator){this.status=D,this._hasOwnPendingAsyncValidator=!0;let r=we(this.asyncValidator(this));this._asyncValidationSubscription=r.subscribe(t=>{this._hasOwnPendingAsyncValidator=!1,this.setErrors(t,{emitEvent:e})})}}_cancelExistingSubscription(){this._asyncValidationSubscription&&(this._asyncValidationSubscription.unsubscribe(),this._hasOwnPendingAsyncValidator=!1)}setErrors(e,r={}){this.errors=e,this._updateControlsErrors(r.emitEvent!==!1)}get(e){let r=e;return r==null||(Array.isArray(r)||(r=r.split(".")),r.length===0)?null:r.reduce((t,n)=>t&&t._find(n),this)}getError(e,r){let t=r?this.get(r):this;return t&&t.errors?t.errors[e]:null}hasError(e,r){return!!this.getError(e,r)}get root(){let e=this;for(;e._parent;)e=e._parent;return e}_updateControlsErrors(e){this.status=this._calculateStatus(),e&&this.statusChanges.emit(this.status),this._parent&&this._parent._updateControlsErrors(e)}_initObservables(){this.valueChanges=new V,this.statusChanges=new V}_calculateStatus(){return this._allControlsDisabled()?S:this.errors?B:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(D)?D:this._anyControlsHaveStatus(B)?B:I}_anyControlsHaveStatus(e){return this._anyControls(r=>r.status===e)}_anyControlsDirty(){return this._anyControls(e=>e.dirty)}_anyControlsTouched(){return this._anyControls(e=>e.touched)}_updatePristine(e={}){this.pristine=!this._anyControlsDirty(),this._parent&&!e.onlySelf&&this._parent._updatePristine(e)}_updateTouched(e={}){this.touched=this._anyControlsTouched(),this._parent&&!e.onlySelf&&this._parent._updateTouched(e)}_registerOnCollectionChange(e){this._onCollectionChange=e}_setUpdateStrategy(e){X(e)&&e.updateOn!=null&&(this._updateOn=e.updateOn)}_parentMarkedDirty(e){let r=this._parent&&this._parent.dirty;return!e&&!!r&&!this._parent._anyControlsDirty()}_find(e){return null}_assignValidators(e){this._rawValidators=Array.isArray(e)?e.slice():e,this._composedValidatorFn=st(this._rawValidators)}_assignAsyncValidators(e){this._rawAsyncValidators=Array.isArray(e)?e.slice():e,this._composedAsyncValidatorFn=ot(this._rawAsyncValidators)}},W=class extends ${constructor(e,r,t){super(Ge(r),je(t,r)),this.controls=e,this._initObservables(),this._setUpdateStrategy(r),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator})}registerControl(e,r){return this.controls[e]?this.controls[e]:(this.controls[e]=r,r.setParent(this),r._registerOnCollectionChange(this._onCollectionChange),r)}addControl(e,r,t={}){this.registerControl(e,r),this.updateValueAndValidity({emitEvent:t.emitEvent}),this._onCollectionChange()}removeControl(e,r={}){this.controls[e]&&this.controls[e]._registerOnCollectionChange(()=>{}),delete this.controls[e],this.updateValueAndValidity({emitEvent:r.emitEvent}),this._onCollectionChange()}setControl(e,r,t={}){this.controls[e]&&this.controls[e]._registerOnCollectionChange(()=>{}),delete this.controls[e],r&&this.registerControl(e,r),this.updateValueAndValidity({emitEvent:t.emitEvent}),this._onCollectionChange()}contains(e){return this.controls.hasOwnProperty(e)&&this.controls[e].enabled}setValue(e,r={}){lt(this,!0,e),Object.keys(e).forEach(t=>{at(this,!0,t),this.controls[t].setValue(e[t],{onlySelf:!0,emitEvent:r.emitEvent})}),this.updateValueAndValidity(r)}patchValue(e,r={}){e!=null&&(Object.keys(e).forEach(t=>{let n=this.controls[t];n&&n.patchValue(e[t],{onlySelf:!0,emitEvent:r.emitEvent})}),this.updateValueAndValidity(r))}reset(e={},r={}){this._forEachChild((t,n)=>{t.reset(e?e[n]:null,{onlySelf:!0,emitEvent:r.emitEvent})}),this._updatePristine(r),this._updateTouched(r),this.updateValueAndValidity(r)}getRawValue(){return this._reduceChildren({},(e,r,t)=>(e[t]=r.getRawValue(),e))}_syncPendingControls(){let e=this._reduceChildren(!1,(r,t)=>t._syncPendingControls()?!0:r);return e&&this.updateValueAndValidity({onlySelf:!0}),e}_forEachChild(e){Object.keys(this.controls).forEach(r=>{let t=this.controls[r];t&&e(t,r)})}_setUpControls(){this._forEachChild(e=>{e.setParent(this),e._registerOnCollectionChange(this._onCollectionChange)})}_updateValue(){this.value=this._reduceValue()}_anyControls(e){for(let[r,t]of Object.entries(this.controls))if(this.contains(r)&&e(t))return!0;return!1}_reduceValue(){let e={};return this._reduceChildren(e,(r,t,n)=>((t.enabled||this.disabled)&&(r[n]=t.value),r))}_reduceChildren(e,r){let t=e;return this._forEachChild((n,s)=>{t=r(t,n,s)}),t}_allControlsDisabled(){for(let e of Object.keys(this.controls))if(this.controls[e].enabled)return!1;return Object.keys(this.controls).length>0||this.disabled}_find(e){return this.controls.hasOwnProperty(e)?this.controls[e]:null}};var x=new _("CallSetDisabledState",{providedIn:"root",factory:()=>Y}),Y="always";function ut(i,e){return[...e.path,i]}function q(i,e,r=Y){se(i,e),e.valueAccessor.writeValue(i.value),(i.disabled||r==="always")&&e.valueAccessor.setDisabledState?.(i.disabled),ct(i,e),ft(i,e),ht(i,e),dt(i,e)}function me(i,e,r=!0){let t=()=>{};e.valueAccessor&&(e.valueAccessor.registerOnChange(t),e.valueAccessor.registerOnTouched(t)),Z(i,e),i&&(e._invokeOnDestroyCallbacks(),i._registerOnCollectionChange(()=>{}))}function z(i,e){i.forEach(r=>{r.registerOnValidatorChange&&r.registerOnValidatorChange(e)})}function dt(i,e){if(e.valueAccessor.setDisabledState){let r=t=>{e.valueAccessor.setDisabledState(t)};i.registerOnDisabledChange(r),e._registerOnDestroy(()=>{i._unregisterOnDisabledChange(r)})}}function se(i,e){let r=xe(i);e.validator!==null?i.setValidators(fe(r,e.validator)):typeof r=="function"&&i.setValidators([r]);let t=ke(i);e.asyncValidator!==null?i.setAsyncValidators(fe(t,e.asyncValidator)):typeof t=="function"&&i.setAsyncValidators([t]);let n=()=>i.updateValueAndValidity();z(e._rawValidators,n),z(e._rawAsyncValidators,n)}function Z(i,e){let r=!1;if(i!==null){if(e.validator!==null){let n=xe(i);if(Array.isArray(n)&&n.length>0){let s=n.filter(o=>o!==e.validator);s.length!==n.length&&(r=!0,i.setValidators(s))}}if(e.asyncValidator!==null){let n=ke(i);if(Array.isArray(n)&&n.length>0){let s=n.filter(o=>o!==e.asyncValidator);s.length!==n.length&&(r=!0,i.setAsyncValidators(s))}}}let t=()=>{};return z(e._rawValidators,t),z(e._rawAsyncValidators,t),r}function ct(i,e){e.valueAccessor.registerOnChange(r=>{i._pendingValue=r,i._pendingChange=!0,i._pendingDirty=!0,i.updateOn==="change"&&Te(i,e)})}function ht(i,e){e.valueAccessor.registerOnTouched(()=>{i._pendingTouched=!0,i.updateOn==="blur"&&i._pendingChange&&Te(i,e),i.updateOn!=="submit"&&i.markAsTouched()})}function Te(i,e){i._pendingDirty&&i.markAsDirty(),i.setValue(i._pendingValue,{emitModelToViewChange:!1}),e.viewToModelUpdate(i._pendingValue),i._pendingChange=!1}function ft(i,e){let r=(t,n)=>{e.valueAccessor.writeValue(t),n&&e.viewToModelUpdate(t)};i.registerOnChange(r),e._registerOnDestroy(()=>{i._unregisterOnChange(r)})}function Be(i,e){i==null,se(i,e)}function pt(i,e){return Z(i,e)}function gt(i,e){if(!i.hasOwnProperty("model"))return!1;let r=i.model;return r.isFirstChange()?!0:!Object.is(e,r.currentValue)}function mt(i){return Object.getPrototypeOf(i.constructor)===P}function Ue(i,e){i._syncPendingControls(),e.forEach(r=>{let t=r.control;t.updateOn==="submit"&&t._pendingChange&&(r.viewToModelUpdate(t._pendingValue),t._pendingChange=!1)})}function yt(i,e){if(!e)return null;Array.isArray(e);let r,t,n;return e.forEach(s=>{s.constructor===De?r=s:mt(s)?t=s:n=s}),n||t||r||null}function vt(i,e){let r=i.indexOf(e);r>-1&&i.splice(r,1)}var _t={provide:v,useExisting:c(()=>Ct)},O=(()=>Promise.resolve())(),Ct=(()=>{let e=class e extends v{constructor(t,n,s){super(),this.callSetDisabledState=s,this.submitted=!1,this._directives=new Set,this.ngSubmit=new V,this.form=new W({},ne(t),re(n))}ngAfterViewInit(){this._setUpdateStrategy()}get formDirective(){return this}get control(){return this.form}get path(){return[]}get controls(){return this.form.controls}addControl(t){O.then(()=>{let n=this._findContainer(t.path);t.control=n.registerControl(t.name,t.control),q(t.control,t,this.callSetDisabledState),t.control.updateValueAndValidity({emitEvent:!1}),this._directives.add(t)})}getControl(t){return this.form.get(t.path)}removeControl(t){O.then(()=>{let n=this._findContainer(t.path);n&&n.removeControl(t.name),this._directives.delete(t)})}addFormGroup(t){O.then(()=>{let n=this._findContainer(t.path),s=new W({});Be(s,t),n.registerControl(t.name,s),s.updateValueAndValidity({emitEvent:!1})})}removeFormGroup(t){O.then(()=>{let n=this._findContainer(t.path);n&&n.removeControl(t.name)})}getFormGroup(t){return this.form.get(t.path)}updateModel(t,n){O.then(()=>{this.form.get(t.path).setValue(n)})}setValue(t){this.control.setValue(t)}onSubmit(t){return this.submitted=!0,Ue(this.form,this._directives),this.ngSubmit.emit(t),t?.target?.method==="dialog"}onReset(){this.resetForm()}resetForm(t=void 0){this.form.reset(t),this.submitted=!1}_setUpdateStrategy(){this.options&&this.options.updateOn!=null&&(this.form._updateOn=this.options.updateOn)}_findContainer(t){return t.pop(),t.length?this.form.get(t):this.form}};e.\u0275fac=function(n){return new(n||e)(a(A,10),a(ie,10),a(x,8))},e.\u0275dir=u({type:e,selectors:[["form",3,"ngNoForm","",3,"formGroup",""],["ng-form"],["","ngForm",""]],hostBindings:function(n,s){n&1&&m("submit",function(l){return s.onSubmit(l)})("reset",function(){return s.onReset()})},inputs:{options:["ngFormOptions","options"]},outputs:{ngSubmit:"ngSubmit"},exportAs:["ngForm"],features:[h([_t]),d]});let i=e;return i})();function ye(i,e){let r=i.indexOf(e);r>-1&&i.splice(r,1)}function ve(i){return typeof i=="object"&&i!==null&&Object.keys(i).length===2&&"value"in i&&"disabled"in i}var Re=class extends ${constructor(e=null,r,t){super(Ge(r),je(t,r)),this.defaultValue=null,this._onChange=[],this._pendingChange=!1,this._applyFormState(e),this._setUpdateStrategy(r),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator}),X(r)&&(r.nonNullable||r.initialValueIsDefault)&&(ve(e)?this.defaultValue=e.value:this.defaultValue=e)}setValue(e,r={}){this.value=this._pendingValue=e,this._onChange.length&&r.emitModelToViewChange!==!1&&this._onChange.forEach(t=>t(this.value,r.emitViewToModelChange!==!1)),this.updateValueAndValidity(r)}patchValue(e,r={}){this.setValue(e,r)}reset(e=this.defaultValue,r={}){this._applyFormState(e),this.markAsPristine(r),this.markAsUntouched(r),this.setValue(this.value,r),this._pendingChange=!1}_updateValue(){}_anyControls(e){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(e){this._onChange.push(e)}_unregisterOnChange(e){ye(this._onChange,e)}registerOnDisabledChange(e){this._onDisabledChange.push(e)}_unregisterOnDisabledChange(e){ye(this._onDisabledChange,e)}_forEachChild(e){}_syncPendingControls(){return this.updateOn==="submit"&&(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),this._pendingChange)?(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),!0):!1}_applyFormState(e){ve(e)?(this.value=this._pendingValue=e.value,e.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=e}};var Vt=i=>i instanceof Re;var Dt={provide:N,useExisting:c(()=>bt)},_e=(()=>Promise.resolve())(),bt=(()=>{let e=class e extends N{constructor(t,n,s,o,l,f){super(),this._changeDetectorRef=l,this.callSetDisabledState=f,this.control=new Re,this._registered=!1,this.name="",this.update=new V,this._parent=t,this._setValidators(n),this._setAsyncValidators(s),this.valueAccessor=yt(this,o)}ngOnChanges(t){if(this._checkForErrors(),!this._registered||"name"in t){if(this._registered&&(this._checkName(),this.formDirective)){let n=t.name.previousValue;this.formDirective.removeControl({name:n,path:this._getPath(n)})}this._setUpControl()}"isDisabled"in t&&this._updateDisabled(t),gt(t,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._getPath(this.name)}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(t){this.viewModel=t,this.update.emit(t)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&this.options.updateOn!=null&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!!(this.options&&this.options.standalone)}_setUpStandalone(){q(this.control,this,this.callSetDisabledState),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._isStandalone()||this._checkParentType(),this._checkName()}_checkParentType(){}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),!this._isStandalone()&&this.name}_updateValue(t){_e.then(()=>{this.control.setValue(t,{emitViewToModelChange:!1}),this._changeDetectorRef?.markForCheck()})}_updateDisabled(t){let n=t.isDisabled.currentValue,s=n!==0&&T(n);_e.then(()=>{s&&!this.control.disabled?this.control.disable():!s&&this.control.disabled&&this.control.enable(),this._changeDetectorRef?.markForCheck()})}_getPath(t){return this._parent?ut(t,this._parent):[t]}};e.\u0275fac=function(n){return new(n||e)(a(v,9),a(A,10),a(ie,10),a(b,10),a(de,8),a(x,8))},e.\u0275dir=u({type:e,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:["disabled","isDisabled"],model:["ngModel","model"],options:["ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],features:[h([Dt]),d,j]});let i=e;return i})(),di=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=u({type:e,selectors:[["form",3,"ngNoForm","",3,"ngNativeValidate",""]],hostAttrs:["novalidate",""]});let i=e;return i})(),At={provide:b,useExisting:c(()=>Mt),multi:!0},Mt=(()=>{let e=class e extends P{writeValue(t){let n=t??"";this.setProperty("value",n)}registerOnChange(t){this.onChange=n=>{t(n==""?null:parseFloat(n))}}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["input","type","number","formControlName",""],["input","type","number","formControl",""],["input","type","number","ngModel",""]],hostBindings:function(n,s){n&1&&m("input",function(l){return s.onChange(l.target.value)})("blur",function(){return s.onTouched()})},features:[h([At]),d]});let i=e;return i})();var Et=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({});let i=e;return i})();var Ft=new _("NgModelWithFormControlWarning");var wt={provide:v,useExisting:c(()=>It)},It=(()=>{let e=class e extends v{constructor(t,n,s){super(),this.callSetDisabledState=s,this.submitted=!1,this._onCollectionChange=()=>this._updateDomValue(),this.directives=[],this.form=null,this.ngSubmit=new V,this._setValidators(t),this._setAsyncValidators(n)}ngOnChanges(t){this._checkFormPresent(),t.hasOwnProperty("form")&&(this._updateValidators(),this._updateDomValue(),this._updateRegistrations(),this._oldForm=this.form)}ngOnDestroy(){this.form&&(Z(this.form,this),this.form._onCollectionChange===this._onCollectionChange&&this.form._registerOnCollectionChange(()=>{}))}get formDirective(){return this}get control(){return this.form}get path(){return[]}addControl(t){let n=this.form.get(t.path);return q(n,t,this.callSetDisabledState),n.updateValueAndValidity({emitEvent:!1}),this.directives.push(t),n}getControl(t){return this.form.get(t.path)}removeControl(t){me(t.control||null,t,!1),vt(this.directives,t)}addFormGroup(t){this._setUpFormContainer(t)}removeFormGroup(t){this._cleanUpFormContainer(t)}getFormGroup(t){return this.form.get(t.path)}addFormArray(t){this._setUpFormContainer(t)}removeFormArray(t){this._cleanUpFormContainer(t)}getFormArray(t){return this.form.get(t.path)}updateModel(t,n){this.form.get(t.path).setValue(n)}onSubmit(t){return this.submitted=!0,Ue(this.form,this.directives),this.ngSubmit.emit(t),t?.target?.method==="dialog"}onReset(){this.resetForm()}resetForm(t=void 0){this.form.reset(t),this.submitted=!1}_updateDomValue(){this.directives.forEach(t=>{let n=t.control,s=this.form.get(t.path);n!==s&&(me(n||null,t),Vt(s)&&(q(s,t,this.callSetDisabledState),t.control=s))}),this.form._updateTreeValidity({emitEvent:!1})}_setUpFormContainer(t){let n=this.form.get(t.path);Be(n,t),n.updateValueAndValidity({emitEvent:!1})}_cleanUpFormContainer(t){if(this.form){let n=this.form.get(t.path);n&&pt(n,t)&&n.updateValueAndValidity({emitEvent:!1})}}_updateRegistrations(){this.form._registerOnCollectionChange(this._onCollectionChange),this._oldForm&&this._oldForm._registerOnCollectionChange(()=>{})}_updateValidators(){se(this.form,this),this._oldForm&&Z(this._oldForm,this)}_checkFormPresent(){this.form}};e.\u0275fac=function(n){return new(n||e)(a(A,10),a(ie,10),a(x,8))},e.\u0275dir=u({type:e,selectors:[["","formGroup",""]],hostBindings:function(n,s){n&1&&m("submit",function(l){return s.onSubmit(l)})("reset",function(){return s.onReset()})},inputs:{form:["formGroup","form"]},outputs:{ngSubmit:"ngSubmit"},exportAs:["ngForm"],features:[h([wt]),d,j]});let i=e;return i})();var St={provide:b,useExisting:c(()=>Le),multi:!0};function He(i,e){return i==null?`${e}`:(e&&typeof e=="object"&&(e="Object"),`${i}: ${e}`.slice(0,50))}function Ot(i){return i.split(":")[0]}var Le=(()=>{let e=class e extends P{constructor(){super(...arguments),this._optionMap=new Map,this._idCounter=0,this._compareWith=Object.is}set compareWith(t){this._compareWith=t}writeValue(t){this.value=t;let n=this._getOptionId(t),s=He(n,t);this.setProperty("value",s)}registerOnChange(t){this.onChange=n=>{this.value=this._getOptionValue(n),t(this.value)}}_registerOption(){return(this._idCounter++).toString()}_getOptionId(t){for(let n of this._optionMap.keys())if(this._compareWith(this._optionMap.get(n),t))return n;return null}_getOptionValue(t){let n=Ot(t);return this._optionMap.has(n)?this._optionMap.get(n):t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["select","formControlName","",3,"multiple",""],["select","formControl","",3,"multiple",""],["select","ngModel","",3,"multiple",""]],hostBindings:function(n,s){n&1&&m("change",function(l){return s.onChange(l.target.value)})("blur",function(){return s.onTouched()})},inputs:{compareWith:"compareWith"},features:[h([St]),d]});let i=e;return i})(),ci=(()=>{let e=class e{constructor(t,n,s){this._element=t,this._renderer=n,this._select=s,this._select&&(this.id=this._select._registerOption())}set ngValue(t){this._select!=null&&(this._select._optionMap.set(this.id,t),this._setElementValue(He(this.id,t)),this._select.writeValue(this._select.value))}set value(t){this._setElementValue(t),this._select&&this._select.writeValue(this._select.value)}_setElementValue(t){this._renderer.setProperty(this._element.nativeElement,"value",t)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id),this._select.writeValue(this._select.value))}};e.\u0275fac=function(n){return new(n||e)(a(F),a(w),a(Le,9))},e.\u0275dir=u({type:e,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"}});let i=e;return i})(),Nt={provide:b,useExisting:c(()=>$e),multi:!0};function Ce(i,e){return i==null?`${e}`:(typeof e=="string"&&(e=`'${e}'`),e&&typeof e=="object"&&(e="Object"),`${i}: ${e}`.slice(0,50))}function Pt(i){return i.split(":")[0]}var $e=(()=>{let e=class e extends P{constructor(){super(...arguments),this._optionMap=new Map,this._idCounter=0,this._compareWith=Object.is}set compareWith(t){this._compareWith=t}writeValue(t){this.value=t;let n;if(Array.isArray(t)){let s=t.map(o=>this._getOptionId(o));n=(o,l)=>{o._setSelected(s.indexOf(l.toString())>-1)}}else n=(s,o)=>{s._setSelected(!1)};this._optionMap.forEach(n)}registerOnChange(t){this.onChange=n=>{let s=[],o=n.selectedOptions;if(o!==void 0){let l=o;for(let f=0;f<l.length;f++){let k=l[f],K=this._getOptionValue(k.value);s.push(K)}}else{let l=n.options;for(let f=0;f<l.length;f++){let k=l[f];if(k.selected){let K=this._getOptionValue(k.value);s.push(K)}}}this.value=s,t(s)}}_registerOption(t){let n=(this._idCounter++).toString();return this._optionMap.set(n,t),n}_getOptionId(t){for(let n of this._optionMap.keys())if(this._compareWith(this._optionMap.get(n)._value,t))return n;return null}_getOptionValue(t){let n=Pt(t);return this._optionMap.has(n)?this._optionMap.get(n)._value:t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["select","multiple","","formControlName",""],["select","multiple","","formControl",""],["select","multiple","","ngModel",""]],hostBindings:function(n,s){n&1&&m("change",function(l){return s.onChange(l.target)})("blur",function(){return s.onTouched()})},inputs:{compareWith:"compareWith"},features:[h([Nt]),d]});let i=e;return i})(),hi=(()=>{let e=class e{constructor(t,n,s){this._element=t,this._renderer=n,this._select=s,this._select&&(this.id=this._select._registerOption(this))}set ngValue(t){this._select!=null&&(this._value=t,this._setElementValue(Ce(this.id,t)),this._select.writeValue(this._select.value))}set value(t){this._select?(this._value=t,this._setElementValue(Ce(this.id,t)),this._select.writeValue(this._select.value)):this._setElementValue(t)}_setElementValue(t){this._renderer.setProperty(this._element.nativeElement,"value",t)}_setSelected(t){this._renderer.setProperty(this._element.nativeElement,"selected",t)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id),this._select.writeValue(this._select.value))}};e.\u0275fac=function(n){return new(n||e)(a(F),a(w),a($e,9))},e.\u0275dir=u({type:e,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"}});let i=e;return i})();var oe=(()=>{let e=class e{constructor(){this._validator=U}ngOnChanges(t){if(this.inputName in t){let n=this.normalizeInput(t[this.inputName].currentValue);this._enabled=this.enabled(n),this._validator=this._enabled?this.createValidator(n):U,this._onChange&&this._onChange()}}validate(t){return this._validator(t)}registerOnValidatorChange(t){this._onChange=t}enabled(t){return t!=null}};e.\u0275fac=function(n){return new(n||e)},e.\u0275dir=u({type:e,features:[j]});let i=e;return i})();var xt={provide:A,useExisting:c(()=>kt),multi:!0};var kt=(()=>{let e=class e extends oe{constructor(){super(...arguments),this.inputName="required",this.normalizeInput=T,this.createValidator=t=>Ae}enabled(t){return t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["","required","","formControlName","",3,"type","checkbox"],["","required","","formControl","",3,"type","checkbox"],["","required","","ngModel","",3,"type","checkbox"]],hostVars:1,hostBindings:function(n,s){n&2&&J("required",s._enabled?"":null)},inputs:{required:"required"},features:[h([xt]),d]});let i=e;return i})();var Gt={provide:A,useExisting:c(()=>jt),multi:!0},jt=(()=>{let e=class e extends oe{constructor(){super(...arguments),this.inputName="email",this.normalizeInput=T,this.createValidator=t=>Me}enabled(t){return t}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["","email","","formControlName",""],["","email","","formControl",""],["","email","","ngModel",""]],inputs:{email:"email"},features:[h([Gt]),d]});let i=e;return i})();var Tt={provide:A,useExisting:c(()=>Bt),multi:!0},Bt=(()=>{let e=class e extends oe{constructor(){super(...arguments),this.inputName="pattern",this.normalizeInput=t=>t,this.createValidator=t=>Ee(t)}};e.\u0275fac=(()=>{let t;return function(s){return(t||(t=p(e)))(s||e)}})(),e.\u0275dir=u({type:e,selectors:[["","pattern","","formControlName",""],["","pattern","","formControl",""],["","pattern","","ngModel",""]],hostVars:1,hostBindings:function(n,s){n&2&&J("pattern",s._enabled?s.pattern:null)},inputs:{pattern:"pattern"},features:[h([Tt]),d]});let i=e;return i})();var We=(()=>{let e=class e{};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({imports:[Et]});let i=e;return i})();var fi=(()=>{let e=class e{static withConfig(t){return{ngModule:e,providers:[{provide:x,useValue:t.callSetDisabledState??Y}]}}};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({imports:[We]});let i=e;return i})(),pi=(()=>{let e=class e{static withConfig(t){return{ngModule:e,providers:[{provide:Ft,useValue:t.warnOnNgModelWithFormControl??"always"},{provide:x,useValue:t.callSetDisabledState??Y}]}}};e.\u0275fac=function(n){return new(n||e)},e.\u0275mod=E({type:e}),e.\u0275inj=M({imports:[We]});let i=e;return i})();export{b as a,ze as b,De as c,A as d,he as e,v as f,N as g,ai as h,li as i,Ct as j,bt as k,di as l,Mt as m,It as n,Le as o,ci as p,hi as q,kt as r,jt as s,Bt as t,fi as u,pi as v};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as I,$a as M,Aa as pt,E as rt,Fa as a,Ga as C,Ka as L,Na as O,Oa as r,Pa as D,Pb as R,Ra as v,Ua as A,Vb as J,Za as p,_a as g,_b as Y,aa as lt,ab as G,b as nt,ba as ct,bb as $,c as _,ca as f,da as w,db as U,ea as P,fa as ut,fb as mt,hb as H,j as ot,ja as V,jb as u,jc as ft,ka as z,p as at,pb as T,qc as vt,ra as ht,rb as b,sa as E,sc as gt,tc as K,ub as q,wc as N,xa as dt,xc as j,ya as Z,zc as Q}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-CQJJCQOZ.js";import{a as d,b as y}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-FG5W5K4B.js";var Tt=["toast-component",""];function xt(s,n){if(s&1){let e=U();p(0,"button",5),H("click",function(){V(e);let i=u();return z(i.remove())}),p(1,"span",6),T(2,"\xD7"),g()()}}function Ot(s,n){if(s&1&&(G(0),T(1),$()),s&2){let e=u(2);a(1),b("[",e.duplicatesCount+1,"]")}}function Dt(s,n){if(s&1&&(p(0,"div"),T(1),A(2,Ot,2,1,"ng-container",4),g()),s&2){let e=u();v(e.options.titleClass),O("aria-label",e.title),a(1),b(" ",e.title," "),a(1),r("ngIf",e.duplicatesCount)}}function At(s,n){if(s&1&&M(0,"div",7),s&2){let e=u();v(e.options.messageClass),r("innerHTML",e.message,Z)}}function Mt(s,n){if(s&1&&(p(0,"div",8),T(1),g()),s&2){let e=u();v(e.options.messageClass),O("aria-label",e.message),a(1),b(" ",e.message," ")}}function Ht(s,n){if(s&1&&(p(0,"div"),M(1,"div",9),g()),s&2){let e=u();a(1),D("width",e.width+"%")}}function Et(s,n){if(s&1){let e=U();p(0,"button",5),H("click",function(){V(e);let i=u();return z(i.remove())}),p(1,"span",6),T(2,"\xD7"),g()()}}function Rt(s,n){if(s&1&&(G(0),T(1),$()),s&2){let e=u(2);a(1),b("[",e.duplicatesCount+1,"]")}}function Nt(s,n){if(s&1&&(p(0,"div"),T(1),A(2,Rt,2,1,"ng-container",4),g()),s&2){let e=u();v(e.options.titleClass),O("aria-label",e.title),a(1),b(" ",e.title," "),a(1),r("ngIf",e.duplicatesCount)}}function jt(s,n){if(s&1&&M(0,"div",7),s&2){let e=u();v(e.options.messageClass),r("innerHTML",e.message,Z)}}function St(s,n){if(s&1&&(p(0,"div",8),T(1),g()),s&2){let e=u();v(e.options.messageClass),O("aria-label",e.message),a(1),b(" ",e.message," ")}}function Bt(s,n){if(s&1&&(p(0,"div"),M(1,"div",9),g()),s&2){let e=u();a(1),D("width",e.width+"%")}}var W=class{_attachedHost;component;viewContainerRef;injector;constructor(n,e){this.component=n,this.injector=e}attach(n,e){return this._attachedHost=n,n.attach(this,e)}detach(){let n=this._attachedHost;if(n)return this._attachedHost=void 0,n.detach()}get isAttached(){return this._attachedHost!=null}setAttachedHost(n){this._attachedHost=n}},X=class{_attachedPortal;_disposeFn;attach(n,e){return this._attachedPortal=n,this.attachComponentPortal(n,e)}detach(){this._attachedPortal&&this._attachedPortal.setAttachedHost(),this._attachedPortal=void 0,this._disposeFn&&(this._disposeFn(),this._disposeFn=void 0)}setDisposeFn(n){this._disposeFn=n}},tt=class{_overlayRef;componentInstance;duplicatesCount=0;_afterClosed=new _;_activate=new _;_manualClose=new _;_resetTimeout=new _;_countDuplicate=new _;constructor(n){this._overlayRef=n}manualClose(){this._manualClose.next(),this._manualClose.complete()}manualClosed(){return this._manualClose.asObservable()}timeoutReset(){return this._resetTimeout.asObservable()}countDuplicate(){return this._countDuplicate.asObservable()}close(){this._overlayRef.detach(),this._afterClosed.next(),this._manualClose.next(),this._afterClosed.complete(),this._manualClose.complete(),this._activate.complete(),this._resetTimeout.complete(),this._countDuplicate.complete()}afterClosed(){return this._afterClosed.asObservable()}isInactive(){return this._activate.isStopped}activate(){this._activate.next(),this._activate.complete()}afterActivate(){return this._activate.asObservable()}onDuplicate(n,e){n&&this._resetTimeout.next(),e&&this._countDuplicate.next(++this.duplicatesCount)}},x=class{toastId;config;message;title;toastType;toastRef;_onTap=new _;_onAction=new _;constructor(n,e,t,i,o,h){this.toastId=n,this.config=e,this.message=t,this.title=i,this.toastType=o,this.toastRef=h,this.toastRef.afterClosed().subscribe(()=>{this._onAction.complete(),this._onTap.complete()})}triggerTap(){this._onTap.next(),this.config.tapToDismiss&&this._onTap.complete()}onTap(){return this._onTap.asObservable()}triggerAction(n){this._onAction.next(n)}onAction(){return this._onAction.asObservable()}},_t={maxOpened:0,autoDismiss:!1,newestOnTop:!0,preventDuplicates:!1,countDuplicates:!1,resetTimeoutOnDuplicate:!1,includeTitleDuplicates:!1,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},closeButton:!1,disableTimeOut:!1,timeOut:5e3,extendedTimeOut:1e3,enableHtml:!1,progressBar:!1,toastClass:"ngx-toastr",positionClass:"toast-top-right",titleClass:"toast-title",messageClass:"toast-message",easing:"ease-in",easeTime:300,tapToDismiss:!0,onActivateTick:!1,progressAnimation:"decreasing"},Ct=new ct("ToastConfig"),et=class extends X{_hostDomElement;_componentFactoryResolver;_appRef;constructor(n,e,t){super(),this._hostDomElement=n,this._componentFactoryResolver=e,this._appRef=t}attachComponentPortal(n,e){let t=this._componentFactoryResolver.resolveComponentFactory(n.component),i;return i=t.create(n.injector),this._appRef.attachView(i.hostView),this.setDisposeFn(()=>{this._appRef.detachView(i.hostView),i.destroy()}),e?this._hostDomElement.insertBefore(this._getComponentRootNode(i),this._hostDomElement.firstChild):this._hostDomElement.appendChild(this._getComponentRootNode(i)),i}_getComponentRootNode(n){return n.hostView.rootNodes[0]}},Ft=(()=>{class s{_document=w(J);_containerElement;ngOnDestroy(){this._containerElement&&this._containerElement.parentNode&&this._containerElement.parentNode.removeChild(this._containerElement)}getContainerElement(){return this._containerElement||this._createContainer(),this._containerElement}_createContainer(){let e=this._document.createElement("div");e.classList.add("overlay-container"),e.setAttribute("aria-live","polite"),this._document.body.appendChild(e),this._containerElement=e}static \u0275fac=function(t){return new(t||s)};static \u0275prov=I({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),it=class{_portalHost;constructor(n){this._portalHost=n}attach(n,e=!0){return this._portalHost.attach(n,e)}detach(){return this._portalHost.detach()}},kt=(()=>{class s{_overlayContainer=w(Ft);_componentFactoryResolver=w(pt);_appRef=w(R);_document=w(J);_paneElements=new Map;create(e,t){return this._createOverlayRef(this.getPaneElement(e,t))}getPaneElement(e="",t){return this._paneElements.get(t)||this._paneElements.set(t,{}),this._paneElements.get(t)[e]||(this._paneElements.get(t)[e]=this._createPaneElement(e,t)),this._paneElements.get(t)[e]}_createPaneElement(e,t){let i=this._document.createElement("div");return i.id="toast-container",i.classList.add(e),i.classList.add("toast-container"),t?t.getContainerElement().appendChild(i):this._overlayContainer.getContainerElement().appendChild(i),i}_createPortalHost(e){return new et(e,this._componentFactoryResolver,this._appRef)}_createOverlayRef(e){return new it(this._createPortalHost(e))}static \u0275fac=function(t){return new(t||s)};static \u0275prov=I({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),S=(()=>{class s{overlay;_injector;sanitizer;ngZone;toastrConfig;currentlyActive=0;toasts=[];overlayContainer;previousToastMessage;index=0;constructor(e,t,i,o,h){this.overlay=t,this._injector=i,this.sanitizer=o,this.ngZone=h,this.toastrConfig=d(d({},e.default),e.config),e.config.iconClasses&&(this.toastrConfig.iconClasses=d(d({},e.default.iconClasses),e.config.iconClasses))}show(e,t,i={},o=""){return this._preBuildNotification(o,e,t,this.applyConfig(i))}success(e,t,i={}){let o=this.toastrConfig.iconClasses.success||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}error(e,t,i={}){let o=this.toastrConfig.iconClasses.error||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}info(e,t,i={}){let o=this.toastrConfig.iconClasses.info||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}warning(e,t,i={}){let o=this.toastrConfig.iconClasses.warning||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}clear(e){for(let t of this.toasts)if(e!==void 0){if(t.toastId===e){t.toastRef.manualClose();return}}else t.toastRef.manualClose()}remove(e){let t=this._findToast(e);if(!t||(t.activeToast.toastRef.close(),this.toasts.splice(t.index,1),this.currentlyActive=this.currentlyActive-1,!this.toastrConfig.maxOpened||!this.toasts.length))return!1;if(this.currentlyActive<this.toastrConfig.maxOpened&&this.toasts[this.currentlyActive]){let i=this.toasts[this.currentlyActive].toastRef;i.isInactive()||(this.currentlyActive=this.currentlyActive+1,i.activate())}return!0}findDuplicate(e="",t="",i,o){let{includeTitleDuplicates:h}=this.toastrConfig;for(let l of this.toasts){let c=h&&l.title===e;if((!h||c)&&l.message===t)return l.toastRef.onDuplicate(i,o),l}return null}applyConfig(e={}){return d(d({},this.toastrConfig),e)}_findToast(e){for(let t=0;t<this.toasts.length;t++)if(this.toasts[t].toastId===e)return{index:t,activeToast:this.toasts[t]};return null}_preBuildNotification(e,t,i,o){return o.onActivateTick?this.ngZone.run(()=>this._buildNotification(e,t,i,o)):this._buildNotification(e,t,i,o)}_buildNotification(e,t,i,o){if(!o.toastComponent)throw new Error("toastComponent required");let h=this.findDuplicate(i,t,this.toastrConfig.resetTimeoutOnDuplicate&&o.timeOut>0,this.toastrConfig.countDuplicates);if((this.toastrConfig.includeTitleDuplicates&&i||t)&&this.toastrConfig.preventDuplicates&&h!==null)return h;this.previousToastMessage=t;let l=!1;this.toastrConfig.maxOpened&&this.currentlyActive>=this.toastrConfig.maxOpened&&(l=!0,this.toastrConfig.autoDismiss&&this.clear(this.toasts[0].toastId));let c=this.overlay.create(o.positionClass,this.overlayContainer);this.index=this.index+1;let B=t;t&&o.enableHtml&&(B=this.sanitizer.sanitize(dt.HTML,t));let m=new tt(c),F=new x(this.index,o,B,i,e,m),bt=[{provide:x,useValue:F}],yt=E.create({providers:bt,parent:this._injector}),It=new W(o.toastComponent,yt),st=c.attach(It,o.newestOnTop);m.componentInstance=st.instance;let k={toastId:this.index,title:i||"",message:t||"",toastRef:m,onShown:m.afterActivate(),onHidden:m.afterClosed(),onTap:F.onTap(),onAction:F.onAction(),portal:st};return l||(this.currentlyActive=this.currentlyActive+1,setTimeout(()=>{k.toastRef.activate()})),this.toasts.push(k),k}static \u0275fac=function(t){return new(t||s)(f(Ct),f(kt),f(E),f(vt),f(L))};static \u0275prov=I({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),Pt=(()=>{class s{toastrService;toastPackage;ngZone;message;title;options;duplicatesCount;originalTimeout;width=-1;toastClasses="";state;get displayStyle(){if(this.state.value==="inactive")return"none"}timeout;intervalId;hideTime;sub;sub1;sub2;sub3;constructor(e,t,i){this.toastrService=e,this.toastPackage=t,this.ngZone=i,this.message=t.message,this.title=t.title,this.options=t.config,this.originalTimeout=t.config.timeOut,this.toastClasses=`${t.toastType} ${t.config.toastClass}`,this.sub=t.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=t.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=t.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=t.toastRef.countDuplicate().subscribe(o=>{this.duplicatesCount=o}),this.state={value:"inactive",params:{easeTime:this.toastPackage.config.easeTime,easing:"ease-in"}}}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state=y(d({},this.state),{value:"active"}),!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.outsideTimeout(()=>this.remove(),this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}updateProgress(){if(this.width===0||this.width===100||!this.options.timeOut)return;let e=new Date().getTime(),t=this.hideTime-e;this.width=t/this.options.timeOut*100,this.options.progressAnimation==="increasing"&&(this.width=100-this.width),this.width<=0&&(this.width=0),this.width>=100&&(this.width=100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state=y(d({},this.state),{value:"active"}),this.outsideTimeout(()=>this.remove(),this.originalTimeout),this.options.timeOut=this.originalTimeout,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width=-1,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10)}remove(){this.state.value!=="removed"&&(clearTimeout(this.timeout),this.state=y(d({},this.state),{value:"removed"}),this.outsideTimeout(()=>this.toastrService.remove(this.toastPackage.toastId),+this.toastPackage.config.easeTime))}tapToast(){this.state.value!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state.value!=="removed"&&this.options.disableTimeOut!=="extendedTimeOut"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width=0)}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state.value==="removed"||(this.outsideTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width=-1,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}outsideTimeout(e,t){this.ngZone?this.ngZone.runOutsideAngular(()=>this.timeout=setTimeout(()=>this.runInsideAngular(e),t)):this.timeout=setTimeout(()=>e(),t)}outsideInterval(e,t){this.ngZone?this.ngZone.runOutsideAngular(()=>this.intervalId=setInterval(()=>this.runInsideAngular(e),t)):this.intervalId=setInterval(()=>e(),t)}runInsideAngular(e){this.ngZone?this.ngZone.run(()=>e()):e()}static \u0275fac=function(t){return new(t||s)(C(S),C(x),C(L))};static \u0275cmp=P({type:s,selectors:[["","toast-component",""]],hostVars:5,hostBindings:function(t,i){t&1&&H("click",function(){return i.tapToast()})("mouseenter",function(){return i.stickAround()})("mouseleave",function(){return i.delayedHideToast()}),t&2&&(mt("@flyInOut",i.state),v(i.toastClasses),D("display",i.displayStyle))},standalone:!0,features:[q],attrs:Tt,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(t,i){t&1&&A(0,xt,3,0,"button",0)(1,Dt,3,5,"div",1)(2,At,1,3,"div",2)(3,Mt,2,4,"div",3)(4,Ht,2,2,"div",4),t&2&&(r("ngIf",i.options.closeButton),a(1),r("ngIf",i.title),a(1),r("ngIf",i.message&&i.options.enableHtml),a(1),r("ngIf",i.message&&!i.options.enableHtml),a(1),r("ngIf",i.options.progressBar))},dependencies:[Y],encapsulation:2,data:{animation:[gt("flyInOut",[j("inactive",N({opacity:0})),j("active",N({opacity:1})),j("removed",N({opacity:0})),Q("inactive => active",K("{{ easeTime }}ms {{ easing }}")),Q("active => removed",K("{{ easeTime }}ms {{ easing }}"))])]}})}return s})(),Vt=y(d({},_t),{toastComponent:Pt}),zt=(s={})=>ht([{provide:Ct,useValue:{default:Vt,config:s}}]),ne=(()=>{class s{static forRoot(e={}){return{ngModule:s,providers:[zt(e)]}}static \u0275fac=function(t){return new(t||s)};static \u0275mod=ut({type:s});static \u0275inj=lt({})}return s})();var Zt=(()=>{class s{toastrService;toastPackage;appRef;message;title;options;duplicatesCount;originalTimeout;width=-1;toastClasses="";get displayStyle(){return this.state==="inactive"?"none":null}state="inactive";timeout;intervalId;hideTime;sub;sub1;sub2;sub3;constructor(e,t,i){this.toastrService=e,this.toastPackage=t,this.appRef=i,this.message=t.message,this.title=t.title,this.options=t.config,this.originalTimeout=t.config.timeOut,this.toastClasses=`${t.toastType} ${t.config.toastClass}`,this.sub=t.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=t.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=t.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=t.toastRef.countDuplicate().subscribe(o=>{this.duplicatesCount=o})}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state="active",!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.timeout=setTimeout(()=>{this.remove()},this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))),this.options.onActivateTick&&this.appRef.tick()}updateProgress(){if(this.width===0||this.width===100||!this.options.timeOut)return;let e=new Date().getTime(),t=this.hideTime-e;this.width=t/this.options.timeOut*100,this.options.progressAnimation==="increasing"&&(this.width=100-this.width),this.width<=0&&(this.width=0),this.width>=100&&(this.width=100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state="active",this.options.timeOut=this.originalTimeout,this.timeout=setTimeout(()=>this.remove(),this.originalTimeout),this.hideTime=new Date().getTime()+(this.originalTimeout||0),this.width=-1,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))}remove(){this.state!=="removed"&&(clearTimeout(this.timeout),this.state="removed",this.timeout=setTimeout(()=>this.toastrService.remove(this.toastPackage.toastId)))}tapToast(){this.state!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state!=="removed"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width=0)}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state==="removed"||(this.timeout=setTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width=-1,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10)))}static \u0275fac=function(t){return new(t||s)(C(S),C(x),C(R))};static \u0275cmp=P({type:s,selectors:[["","toast-component",""]],hostVars:4,hostBindings:function(t,i){t&1&&H("click",function(){return i.tapToast()})("mouseenter",function(){return i.stickAround()})("mouseleave",function(){return i.delayedHideToast()}),t&2&&(v(i.toastClasses),D("display",i.displayStyle))},standalone:!0,features:[q],attrs:Tt,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(t,i){t&1&&A(0,Et,3,0,"button",0)(1,Nt,3,5,"div",1)(2,jt,1,3,"div",2)(3,St,2,4,"div",3)(4,Bt,2,2,"div",4),t&2&&(r("ngIf",i.options.closeButton),a(1),r("ngIf",i.title),a(1),r("ngIf",i.message&&i.options.enableHtml),a(1),r("ngIf",i.message&&!i.options.enableHtml),a(1),r("ngIf",i.options.progressBar))},dependencies:[Y],encapsulation:2})}return s})(),oe=y(d({},_t),{toastComponent:Zt});var ue=(()=>{let n=class n{constructor(t,i){this.http=t,this.toastr=i}get(t){return this.http.get(t).pipe(rt(i=>{let o=this.errorMessageHandling(i);return this.toastr.error(o.message!=""?o.message:"An unknown error has occured!",o.header),ot}))}post(t,i,o={},h=1e5){return new nt(l=>{this.http.post(t,i,o).pipe(at(h)).subscribe({next:c=>{l.next(c),l.complete()},error:c=>{if(c.status==200)l.next(c.error.text),l.complete();else{if(!this.unauthorizedErrorHandling(c)&&!Array.isArray(c?.error?.Message)){let m=this.errorMessageHandling(c);this.toastr.error(m.message!=""?m.message:"An unknown error has occured!",m.header,{enableHtml:!0})}l.error(c)}}})})}unauthorizedErrorHandling(t){let i=!1;return t.status==401&&(localStorage.getItem("Token")?window.location.href="/A/Unauthorized/Main/Unauthorized":window.location.href="/",i=!0),i}errorMessageHandling(t){let i="API Error",o="Exception Message";return t.error?(i="API Error - "+t.status,t.error.Message&&(t.error.Message.indexOf("Message")!=-1?o=JSON.parse(t.error.Message).Message:o=t.error.Message)):t.message&&(i="API Error - "+t.name,o=t.message),{header:i,message:o}}};n.\u0275fac=function(i){return new(i||n)(f(ft),f(S))},n.\u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();export{x as a,S as b,Pt as c,ne as d,ue as e};
|
|
1
|
+
import{$ as I,$a as M,Aa as pt,E as rt,Fa as a,Ga as C,Ka as L,Na as O,Oa as r,Pa as D,Pb as R,Ra as v,Ua as A,Vb as J,Za as p,_a as g,_b as Y,aa as lt,ab as G,b as nt,ba as ct,bb as $,c as _,ca as f,da as w,db as U,ea as P,fa as ut,fb as mt,hb as H,j as ot,ja as V,jb as u,jc as ft,ka as z,p as at,pb as T,qc as vt,ra as ht,rb as b,sa as E,sc as gt,tc as K,ub as q,wc as N,xa as dt,xc as j,ya as Z,zc as Q}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-DJCANNYC.js";import{a as d,b as y}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-R7J6AS67.js";var Tt=["toast-component",""];function xt(s,n){if(s&1){let e=U();p(0,"button",5),H("click",function(){V(e);let i=u();return z(i.remove())}),p(1,"span",6),T(2,"\xD7"),g()()}}function Ot(s,n){if(s&1&&(G(0),T(1),$()),s&2){let e=u(2);a(1),b("[",e.duplicatesCount+1,"]")}}function Dt(s,n){if(s&1&&(p(0,"div"),T(1),A(2,Ot,2,1,"ng-container",4),g()),s&2){let e=u();v(e.options.titleClass),O("aria-label",e.title),a(1),b(" ",e.title," "),a(1),r("ngIf",e.duplicatesCount)}}function At(s,n){if(s&1&&M(0,"div",7),s&2){let e=u();v(e.options.messageClass),r("innerHTML",e.message,Z)}}function Mt(s,n){if(s&1&&(p(0,"div",8),T(1),g()),s&2){let e=u();v(e.options.messageClass),O("aria-label",e.message),a(1),b(" ",e.message," ")}}function Ht(s,n){if(s&1&&(p(0,"div"),M(1,"div",9),g()),s&2){let e=u();a(1),D("width",e.width+"%")}}function Et(s,n){if(s&1){let e=U();p(0,"button",5),H("click",function(){V(e);let i=u();return z(i.remove())}),p(1,"span",6),T(2,"\xD7"),g()()}}function Rt(s,n){if(s&1&&(G(0),T(1),$()),s&2){let e=u(2);a(1),b("[",e.duplicatesCount+1,"]")}}function Nt(s,n){if(s&1&&(p(0,"div"),T(1),A(2,Rt,2,1,"ng-container",4),g()),s&2){let e=u();v(e.options.titleClass),O("aria-label",e.title),a(1),b(" ",e.title," "),a(1),r("ngIf",e.duplicatesCount)}}function jt(s,n){if(s&1&&M(0,"div",7),s&2){let e=u();v(e.options.messageClass),r("innerHTML",e.message,Z)}}function St(s,n){if(s&1&&(p(0,"div",8),T(1),g()),s&2){let e=u();v(e.options.messageClass),O("aria-label",e.message),a(1),b(" ",e.message," ")}}function Bt(s,n){if(s&1&&(p(0,"div"),M(1,"div",9),g()),s&2){let e=u();a(1),D("width",e.width+"%")}}var W=class{_attachedHost;component;viewContainerRef;injector;constructor(n,e){this.component=n,this.injector=e}attach(n,e){return this._attachedHost=n,n.attach(this,e)}detach(){let n=this._attachedHost;if(n)return this._attachedHost=void 0,n.detach()}get isAttached(){return this._attachedHost!=null}setAttachedHost(n){this._attachedHost=n}},X=class{_attachedPortal;_disposeFn;attach(n,e){return this._attachedPortal=n,this.attachComponentPortal(n,e)}detach(){this._attachedPortal&&this._attachedPortal.setAttachedHost(),this._attachedPortal=void 0,this._disposeFn&&(this._disposeFn(),this._disposeFn=void 0)}setDisposeFn(n){this._disposeFn=n}},tt=class{_overlayRef;componentInstance;duplicatesCount=0;_afterClosed=new _;_activate=new _;_manualClose=new _;_resetTimeout=new _;_countDuplicate=new _;constructor(n){this._overlayRef=n}manualClose(){this._manualClose.next(),this._manualClose.complete()}manualClosed(){return this._manualClose.asObservable()}timeoutReset(){return this._resetTimeout.asObservable()}countDuplicate(){return this._countDuplicate.asObservable()}close(){this._overlayRef.detach(),this._afterClosed.next(),this._manualClose.next(),this._afterClosed.complete(),this._manualClose.complete(),this._activate.complete(),this._resetTimeout.complete(),this._countDuplicate.complete()}afterClosed(){return this._afterClosed.asObservable()}isInactive(){return this._activate.isStopped}activate(){this._activate.next(),this._activate.complete()}afterActivate(){return this._activate.asObservable()}onDuplicate(n,e){n&&this._resetTimeout.next(),e&&this._countDuplicate.next(++this.duplicatesCount)}},x=class{toastId;config;message;title;toastType;toastRef;_onTap=new _;_onAction=new _;constructor(n,e,t,i,o,h){this.toastId=n,this.config=e,this.message=t,this.title=i,this.toastType=o,this.toastRef=h,this.toastRef.afterClosed().subscribe(()=>{this._onAction.complete(),this._onTap.complete()})}triggerTap(){this._onTap.next(),this.config.tapToDismiss&&this._onTap.complete()}onTap(){return this._onTap.asObservable()}triggerAction(n){this._onAction.next(n)}onAction(){return this._onAction.asObservable()}},_t={maxOpened:0,autoDismiss:!1,newestOnTop:!0,preventDuplicates:!1,countDuplicates:!1,resetTimeoutOnDuplicate:!1,includeTitleDuplicates:!1,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},closeButton:!1,disableTimeOut:!1,timeOut:5e3,extendedTimeOut:1e3,enableHtml:!1,progressBar:!1,toastClass:"ngx-toastr",positionClass:"toast-top-right",titleClass:"toast-title",messageClass:"toast-message",easing:"ease-in",easeTime:300,tapToDismiss:!0,onActivateTick:!1,progressAnimation:"decreasing"},Ct=new ct("ToastConfig"),et=class extends X{_hostDomElement;_componentFactoryResolver;_appRef;constructor(n,e,t){super(),this._hostDomElement=n,this._componentFactoryResolver=e,this._appRef=t}attachComponentPortal(n,e){let t=this._componentFactoryResolver.resolveComponentFactory(n.component),i;return i=t.create(n.injector),this._appRef.attachView(i.hostView),this.setDisposeFn(()=>{this._appRef.detachView(i.hostView),i.destroy()}),e?this._hostDomElement.insertBefore(this._getComponentRootNode(i),this._hostDomElement.firstChild):this._hostDomElement.appendChild(this._getComponentRootNode(i)),i}_getComponentRootNode(n){return n.hostView.rootNodes[0]}},Ft=(()=>{class s{_document=w(J);_containerElement;ngOnDestroy(){this._containerElement&&this._containerElement.parentNode&&this._containerElement.parentNode.removeChild(this._containerElement)}getContainerElement(){return this._containerElement||this._createContainer(),this._containerElement}_createContainer(){let e=this._document.createElement("div");e.classList.add("overlay-container"),e.setAttribute("aria-live","polite"),this._document.body.appendChild(e),this._containerElement=e}static \u0275fac=function(t){return new(t||s)};static \u0275prov=I({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),it=class{_portalHost;constructor(n){this._portalHost=n}attach(n,e=!0){return this._portalHost.attach(n,e)}detach(){return this._portalHost.detach()}},kt=(()=>{class s{_overlayContainer=w(Ft);_componentFactoryResolver=w(pt);_appRef=w(R);_document=w(J);_paneElements=new Map;create(e,t){return this._createOverlayRef(this.getPaneElement(e,t))}getPaneElement(e="",t){return this._paneElements.get(t)||this._paneElements.set(t,{}),this._paneElements.get(t)[e]||(this._paneElements.get(t)[e]=this._createPaneElement(e,t)),this._paneElements.get(t)[e]}_createPaneElement(e,t){let i=this._document.createElement("div");return i.id="toast-container",i.classList.add(e),i.classList.add("toast-container"),t?t.getContainerElement().appendChild(i):this._overlayContainer.getContainerElement().appendChild(i),i}_createPortalHost(e){return new et(e,this._componentFactoryResolver,this._appRef)}_createOverlayRef(e){return new it(this._createPortalHost(e))}static \u0275fac=function(t){return new(t||s)};static \u0275prov=I({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),S=(()=>{class s{overlay;_injector;sanitizer;ngZone;toastrConfig;currentlyActive=0;toasts=[];overlayContainer;previousToastMessage;index=0;constructor(e,t,i,o,h){this.overlay=t,this._injector=i,this.sanitizer=o,this.ngZone=h,this.toastrConfig=d(d({},e.default),e.config),e.config.iconClasses&&(this.toastrConfig.iconClasses=d(d({},e.default.iconClasses),e.config.iconClasses))}show(e,t,i={},o=""){return this._preBuildNotification(o,e,t,this.applyConfig(i))}success(e,t,i={}){let o=this.toastrConfig.iconClasses.success||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}error(e,t,i={}){let o=this.toastrConfig.iconClasses.error||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}info(e,t,i={}){let o=this.toastrConfig.iconClasses.info||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}warning(e,t,i={}){let o=this.toastrConfig.iconClasses.warning||"";return this._preBuildNotification(o,e,t,this.applyConfig(i))}clear(e){for(let t of this.toasts)if(e!==void 0){if(t.toastId===e){t.toastRef.manualClose();return}}else t.toastRef.manualClose()}remove(e){let t=this._findToast(e);if(!t||(t.activeToast.toastRef.close(),this.toasts.splice(t.index,1),this.currentlyActive=this.currentlyActive-1,!this.toastrConfig.maxOpened||!this.toasts.length))return!1;if(this.currentlyActive<this.toastrConfig.maxOpened&&this.toasts[this.currentlyActive]){let i=this.toasts[this.currentlyActive].toastRef;i.isInactive()||(this.currentlyActive=this.currentlyActive+1,i.activate())}return!0}findDuplicate(e="",t="",i,o){let{includeTitleDuplicates:h}=this.toastrConfig;for(let l of this.toasts){let c=h&&l.title===e;if((!h||c)&&l.message===t)return l.toastRef.onDuplicate(i,o),l}return null}applyConfig(e={}){return d(d({},this.toastrConfig),e)}_findToast(e){for(let t=0;t<this.toasts.length;t++)if(this.toasts[t].toastId===e)return{index:t,activeToast:this.toasts[t]};return null}_preBuildNotification(e,t,i,o){return o.onActivateTick?this.ngZone.run(()=>this._buildNotification(e,t,i,o)):this._buildNotification(e,t,i,o)}_buildNotification(e,t,i,o){if(!o.toastComponent)throw new Error("toastComponent required");let h=this.findDuplicate(i,t,this.toastrConfig.resetTimeoutOnDuplicate&&o.timeOut>0,this.toastrConfig.countDuplicates);if((this.toastrConfig.includeTitleDuplicates&&i||t)&&this.toastrConfig.preventDuplicates&&h!==null)return h;this.previousToastMessage=t;let l=!1;this.toastrConfig.maxOpened&&this.currentlyActive>=this.toastrConfig.maxOpened&&(l=!0,this.toastrConfig.autoDismiss&&this.clear(this.toasts[0].toastId));let c=this.overlay.create(o.positionClass,this.overlayContainer);this.index=this.index+1;let B=t;t&&o.enableHtml&&(B=this.sanitizer.sanitize(dt.HTML,t));let m=new tt(c),F=new x(this.index,o,B,i,e,m),bt=[{provide:x,useValue:F}],yt=E.create({providers:bt,parent:this._injector}),It=new W(o.toastComponent,yt),st=c.attach(It,o.newestOnTop);m.componentInstance=st.instance;let k={toastId:this.index,title:i||"",message:t||"",toastRef:m,onShown:m.afterActivate(),onHidden:m.afterClosed(),onTap:F.onTap(),onAction:F.onAction(),portal:st};return l||(this.currentlyActive=this.currentlyActive+1,setTimeout(()=>{k.toastRef.activate()})),this.toasts.push(k),k}static \u0275fac=function(t){return new(t||s)(f(Ct),f(kt),f(E),f(vt),f(L))};static \u0275prov=I({token:s,factory:s.\u0275fac,providedIn:"root"})}return s})(),Pt=(()=>{class s{toastrService;toastPackage;ngZone;message;title;options;duplicatesCount;originalTimeout;width=-1;toastClasses="";state;get displayStyle(){if(this.state.value==="inactive")return"none"}timeout;intervalId;hideTime;sub;sub1;sub2;sub3;constructor(e,t,i){this.toastrService=e,this.toastPackage=t,this.ngZone=i,this.message=t.message,this.title=t.title,this.options=t.config,this.originalTimeout=t.config.timeOut,this.toastClasses=`${t.toastType} ${t.config.toastClass}`,this.sub=t.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=t.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=t.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=t.toastRef.countDuplicate().subscribe(o=>{this.duplicatesCount=o}),this.state={value:"inactive",params:{easeTime:this.toastPackage.config.easeTime,easing:"ease-in"}}}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state=y(d({},this.state),{value:"active"}),!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.outsideTimeout(()=>this.remove(),this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}updateProgress(){if(this.width===0||this.width===100||!this.options.timeOut)return;let e=new Date().getTime(),t=this.hideTime-e;this.width=t/this.options.timeOut*100,this.options.progressAnimation==="increasing"&&(this.width=100-this.width),this.width<=0&&(this.width=0),this.width>=100&&(this.width=100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state=y(d({},this.state),{value:"active"}),this.outsideTimeout(()=>this.remove(),this.originalTimeout),this.options.timeOut=this.originalTimeout,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width=-1,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10)}remove(){this.state.value!=="removed"&&(clearTimeout(this.timeout),this.state=y(d({},this.state),{value:"removed"}),this.outsideTimeout(()=>this.toastrService.remove(this.toastPackage.toastId),+this.toastPackage.config.easeTime))}tapToast(){this.state.value!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state.value!=="removed"&&this.options.disableTimeOut!=="extendedTimeOut"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width=0)}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state.value==="removed"||(this.outsideTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width=-1,this.options.progressBar&&this.outsideInterval(()=>this.updateProgress(),10))}outsideTimeout(e,t){this.ngZone?this.ngZone.runOutsideAngular(()=>this.timeout=setTimeout(()=>this.runInsideAngular(e),t)):this.timeout=setTimeout(()=>e(),t)}outsideInterval(e,t){this.ngZone?this.ngZone.runOutsideAngular(()=>this.intervalId=setInterval(()=>this.runInsideAngular(e),t)):this.intervalId=setInterval(()=>e(),t)}runInsideAngular(e){this.ngZone?this.ngZone.run(()=>e()):e()}static \u0275fac=function(t){return new(t||s)(C(S),C(x),C(L))};static \u0275cmp=P({type:s,selectors:[["","toast-component",""]],hostVars:5,hostBindings:function(t,i){t&1&&H("click",function(){return i.tapToast()})("mouseenter",function(){return i.stickAround()})("mouseleave",function(){return i.delayedHideToast()}),t&2&&(mt("@flyInOut",i.state),v(i.toastClasses),D("display",i.displayStyle))},standalone:!0,features:[q],attrs:Tt,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(t,i){t&1&&A(0,xt,3,0,"button",0)(1,Dt,3,5,"div",1)(2,At,1,3,"div",2)(3,Mt,2,4,"div",3)(4,Ht,2,2,"div",4),t&2&&(r("ngIf",i.options.closeButton),a(1),r("ngIf",i.title),a(1),r("ngIf",i.message&&i.options.enableHtml),a(1),r("ngIf",i.message&&!i.options.enableHtml),a(1),r("ngIf",i.options.progressBar))},dependencies:[Y],encapsulation:2,data:{animation:[gt("flyInOut",[j("inactive",N({opacity:0})),j("active",N({opacity:1})),j("removed",N({opacity:0})),Q("inactive => active",K("{{ easeTime }}ms {{ easing }}")),Q("active => removed",K("{{ easeTime }}ms {{ easing }}"))])]}})}return s})(),Vt=y(d({},_t),{toastComponent:Pt}),zt=(s={})=>ht([{provide:Ct,useValue:{default:Vt,config:s}}]),ne=(()=>{class s{static forRoot(e={}){return{ngModule:s,providers:[zt(e)]}}static \u0275fac=function(t){return new(t||s)};static \u0275mod=ut({type:s});static \u0275inj=lt({})}return s})();var Zt=(()=>{class s{toastrService;toastPackage;appRef;message;title;options;duplicatesCount;originalTimeout;width=-1;toastClasses="";get displayStyle(){return this.state==="inactive"?"none":null}state="inactive";timeout;intervalId;hideTime;sub;sub1;sub2;sub3;constructor(e,t,i){this.toastrService=e,this.toastPackage=t,this.appRef=i,this.message=t.message,this.title=t.title,this.options=t.config,this.originalTimeout=t.config.timeOut,this.toastClasses=`${t.toastType} ${t.config.toastClass}`,this.sub=t.toastRef.afterActivate().subscribe(()=>{this.activateToast()}),this.sub1=t.toastRef.manualClosed().subscribe(()=>{this.remove()}),this.sub2=t.toastRef.timeoutReset().subscribe(()=>{this.resetTimeout()}),this.sub3=t.toastRef.countDuplicate().subscribe(o=>{this.duplicatesCount=o})}ngOnDestroy(){this.sub.unsubscribe(),this.sub1.unsubscribe(),this.sub2.unsubscribe(),this.sub3.unsubscribe(),clearInterval(this.intervalId),clearTimeout(this.timeout)}activateToast(){this.state="active",!(this.options.disableTimeOut===!0||this.options.disableTimeOut==="timeOut")&&this.options.timeOut&&(this.timeout=setTimeout(()=>{this.remove()},this.options.timeOut),this.hideTime=new Date().getTime()+this.options.timeOut,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))),this.options.onActivateTick&&this.appRef.tick()}updateProgress(){if(this.width===0||this.width===100||!this.options.timeOut)return;let e=new Date().getTime(),t=this.hideTime-e;this.width=t/this.options.timeOut*100,this.options.progressAnimation==="increasing"&&(this.width=100-this.width),this.width<=0&&(this.width=0),this.width>=100&&(this.width=100)}resetTimeout(){clearTimeout(this.timeout),clearInterval(this.intervalId),this.state="active",this.options.timeOut=this.originalTimeout,this.timeout=setTimeout(()=>this.remove(),this.originalTimeout),this.hideTime=new Date().getTime()+(this.originalTimeout||0),this.width=-1,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10))}remove(){this.state!=="removed"&&(clearTimeout(this.timeout),this.state="removed",this.timeout=setTimeout(()=>this.toastrService.remove(this.toastPackage.toastId)))}tapToast(){this.state!=="removed"&&(this.toastPackage.triggerTap(),this.options.tapToDismiss&&this.remove())}stickAround(){this.state!=="removed"&&(clearTimeout(this.timeout),this.options.timeOut=0,this.hideTime=0,clearInterval(this.intervalId),this.width=0)}delayedHideToast(){this.options.disableTimeOut===!0||this.options.disableTimeOut==="extendedTimeOut"||this.options.extendedTimeOut===0||this.state==="removed"||(this.timeout=setTimeout(()=>this.remove(),this.options.extendedTimeOut),this.options.timeOut=this.options.extendedTimeOut,this.hideTime=new Date().getTime()+(this.options.timeOut||0),this.width=-1,this.options.progressBar&&(this.intervalId=setInterval(()=>this.updateProgress(),10)))}static \u0275fac=function(t){return new(t||s)(C(S),C(x),C(R))};static \u0275cmp=P({type:s,selectors:[["","toast-component",""]],hostVars:4,hostBindings:function(t,i){t&1&&H("click",function(){return i.tapToast()})("mouseenter",function(){return i.stickAround()})("mouseleave",function(){return i.delayedHideToast()}),t&2&&(v(i.toastClasses),D("display",i.displayStyle))},standalone:!0,features:[q],attrs:Tt,decls:5,vars:5,consts:[["type","button","class","toast-close-button","aria-label","Close",3,"click",4,"ngIf"],[3,"class",4,"ngIf"],["role","alert",3,"class","innerHTML",4,"ngIf"],["role","alert",3,"class",4,"ngIf"],[4,"ngIf"],["type","button","aria-label","Close",1,"toast-close-button",3,"click"],["aria-hidden","true"],["role","alert",3,"innerHTML"],["role","alert"],[1,"toast-progress"]],template:function(t,i){t&1&&A(0,Et,3,0,"button",0)(1,Nt,3,5,"div",1)(2,jt,1,3,"div",2)(3,St,2,4,"div",3)(4,Bt,2,2,"div",4),t&2&&(r("ngIf",i.options.closeButton),a(1),r("ngIf",i.title),a(1),r("ngIf",i.message&&i.options.enableHtml),a(1),r("ngIf",i.message&&!i.options.enableHtml),a(1),r("ngIf",i.options.progressBar))},dependencies:[Y],encapsulation:2})}return s})(),oe=y(d({},_t),{toastComponent:Zt});var ue=(()=>{let n=class n{constructor(t,i){this.http=t,this.toastr=i}get(t){return this.http.get(t).pipe(rt(i=>{let o=this.errorMessageHandling(i);return this.toastr.error(o.message!=""?o.message:"An unknown error has occured!",o.header),ot}))}post(t,i,o={},h=1e5){return new nt(l=>{this.http.post(t,i,o).pipe(at(h)).subscribe({next:c=>{l.next(c),l.complete()},error:c=>{if(c.status==200)l.next(c.error.text),l.complete();else{if(!this.unauthorizedErrorHandling(c)&&!Array.isArray(c?.error?.Message)){let m=this.errorMessageHandling(c);this.toastr.error(m.message!=""?m.message:"An unknown error has occured!",m.header,{enableHtml:!0})}l.error(c)}}})})}unauthorizedErrorHandling(t){let i=!1;return t.status==401&&(localStorage.getItem("Token")?window.location.href="/A/Unauthorized/Main/Unauthorized":window.location.href="/",i=!0),i}errorMessageHandling(t){let i="API Error",o="Exception Message";return t.error?(i="API Error - "+t.status,t.error.Message&&(t.error.Message.indexOf("Message")!=-1?o=JSON.parse(t.error.Message).Message:o=t.error.Message)):t.message&&(i="API Error - "+t.name,o=t.message),{header:i,message:o}}};n.\u0275fac=function(i){return new(i||n)(f(ft),f(S))},n.\u0275prov=I({token:n,factory:n.\u0275fac,providedIn:"root"});let s=n;return s})();export{x as a,S as b,Pt as c,ne as d,ue as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ue}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-JGSLR6Q7.js";import{b as he,e as ge}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-MG7FPXZX.js";import{$ as le,ca as U,d as ae}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-CQJJCQOZ.js";import{a as d,b as R,c as H,h as u}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.2/Marketplace/chunk-FG5W5K4B.js";var y=class extends Error{constructor(e,t){let o=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=o}},T=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},b=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},j=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=o}},O=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=o}},B=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=o}},F=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},z=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=o}};var A=class{constructor(e,t,o){this.statusCode=e,this.statusText=t,this.content=o}},v=class{get(e,t){return this.send(R(d({},t),{method:"GET",url:e}))}post(e,t){return this.send(R(d({},t),{method:"POST",url:e}))}delete(e,t){return this.send(R(d({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var i=function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r}(i||{});var k=class{constructor(){}log(e,t){}};k.instance=new k;var me="7.0.11",f=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,o){if(!(e in t))throw new Error(`Unknown ${o} value: ${e}.`)}},_=class{static get isBrowser(){return typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return typeof self=="object"&&"importScripts"in self}static get isReactNative(){return typeof window=="object"&&typeof window.document>"u"}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}};function x(r,e){let t="";return P(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${we(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function we(r){let e=new Uint8Array(r),t="";return e.forEach(o=>{let n=o<16?"0":"";t+=`0x${n}${o.toString(16)} `}),t.substr(0,t.length-1)}function P(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function V(r,e,t,o,n,s){return u(this,null,function*(){let c={},[l,a]=E();c[l]=a,r.log(i.Trace,`(${e} transport) sending data. ${x(n,s.logMessageContent)}.`);let h=P(n)?"arraybuffer":"text",g=yield t.post(o,{content:n,headers:d(d({},c),s.headers),responseType:h,timeout:s.timeout,withCredentials:s.withCredentials});r.log(i.Trace,`(${e} transport) request complete. Response status: ${g.statusCode}.`)})}function pe(r){return r===void 0?new D(i.Information):r===null?k.instance:r.log!==void 0?r:new D(r)}var J=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},D=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let o=`[${new Date().toISOString()}] ${i[e]}: ${t}`;switch(e){case i.Critical:case i.Error:this.out.error(o);break;case i.Warning:this.out.warn(o);break;case i.Information:this.out.info(o);break;default:this.out.log(o);break}}}};function E(){let r="X-SignalR-User-Agent";return _.isNode&&(r="User-Agent"),[r,be(me,Ce(),ye(),Se())]}function be(r,e,t,o){let n="Microsoft SignalR/",s=r.split(".");return n+=`${s[0]}.${s[1]}`,n+=` (${r}; `,e&&e!==""?n+=`${e}; `:n+="Unknown OS; ",n+=`${t}`,o?n+=`; ${o}`:n+="; Unknown Runtime Version",n+=")",n}function Ce(){if(_.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Se(){if(_.isNode)return process.versions.node}function ye(){return _.isNode?"NodeJS":"Browser"}function ie(r){return r.stack?r.stack:r.message?r.message:`${r}`}function de(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var X=class extends v{constructor(e){if(super(),this._logger=e,typeof fetch>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:H;this._jar=new(t("tough-cookie")).CookieJar,this._fetchType=t("node-fetch"),this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(de());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:H;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return u(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new b;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,o;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),o=new b});let n=null;if(e.timeout){let a=e.timeout;n=setTimeout(()=>{t.abort(),this._logger.log(i.Warning,"Timeout from HTTP request."),o=new T},a)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},P(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:d({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(a){throw o||(this._logger.log(i.Warning,`Error from HTTP request. ${a}.`),a)}finally{n&&clearTimeout(n),e.abortSignal&&(e.abortSignal.onabort=null)}if(!s.ok){let a=yield fe(s,"text");throw new y(a||s.statusText,s.status)}let l=yield fe(s,e.responseType);return new A(s.status,s.statusText,l)})}getCookieString(e){let t="";return _.isNode&&this._jar&&this._jar.getCookies(e,(o,n)=>t=n.join("; ")),t}};function fe(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var K=class extends v{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new b):e.method?e.url?new Promise((t,o)=>{let n=new XMLHttpRequest;n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(P(e.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let s=e.headers;s&&Object.keys(s).forEach(c=>{n.setRequestHeader(c,s[c])}),e.responseType&&(n.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),o(new b)}),e.timeout&&(n.timeout=e.timeout),n.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),n.status>=200&&n.status<300?t(new A(n.status,n.statusText,n.response||n.responseText)):o(new y(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(i.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new y(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(i.Warning,"Timeout from HTTP request."),o(new T)},n.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var G=class extends v{constructor(e){if(super(),typeof fetch<"u"||_.isNode)this._httpClient=new X(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new K(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new b):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 S=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};S.RecordSeparatorCode=30;S.RecordSeparator=String.fromCharCode(S.RecordSeparatorCode);var Y=class{writeHandshakeRequest(e){return S.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,o;if(P(e)){let l=new Uint8Array(e),a=l.indexOf(S.RecordSeparatorCode);if(a===-1)throw new Error("Message is incomplete.");let h=a+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(l.slice(0,h))),o=l.byteLength>h?l.slice(h).buffer:null}else{let l=e,a=l.indexOf(S.RecordSeparator);if(a===-1)throw new Error("Message is incomplete.");let h=a+1;t=l.substring(0,h),o=l.length>h?l.substring(h):null}let n=S.parse(t),s=JSON.parse(n[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[o,s]}};var p=function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r}(p||{});var Q=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new J(this,e)}};var ve=30*1e3,ke=15*1e3,m=function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r}(m||{}),Z=class r{constructor(e,t,o,n){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},f.isRequired(e,"connection"),f.isRequired(t,"logger"),f.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=ve,this.keepAliveIntervalInMilliseconds=ke,this._logger=t,this._protocol=o,this.connection=e,this._reconnectPolicy=n,this._handshakeProtocol=new Y,this.connection.onreceive=s=>this._processIncomingData(s),this.connection.onclose=s=>this._connectionClosed(s),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:p.Ping})}static create(e,t,o,n){return new r(e,t,o,n)}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 u(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(i.Debug,"Starting HubConnection.");try{yield this._startInternal(),_.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(i.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(i.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return u(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,o)=>{this._handshakeResolver=t,this._handshakeRejecter=o});yield this.connection.start(this._protocol.transferFormat);try{let t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(i.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return u(this,null,function*(){let e=this._startPromise;this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){return this._connectionState===m.Disconnected?(this._logger.log(i.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===m.Disconnecting?(this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=m.Disconnecting,this._logger.log(i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new b("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createStreamInvocation(e,t,n),c,l=new Q;return l.cancelCallback=()=>{let a=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],c.then(()=>this._sendWithProtocol(a))},this._callbacks[s.invocationId]=(a,h)=>{if(h){l.error(h);return}else a&&(a.type===p.Completion?a.error?l.error(new Error(a.error)):l.complete():l.next(a.item))},c=this._sendWithProtocol(s).catch(a=>{l.error(a),delete this._callbacks[s.invocationId]}),this._launchStreams(o,c),l}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._sendWithProtocol(this._createInvocation(e,t,!0,n));return this._launchStreams(o,s),s}invoke(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createInvocation(e,t,!1,n);return new Promise((l,a)=>{this._callbacks[s.invocationId]=(g,I)=>{if(I){a(I);return}else g&&(g.type===p.Completion?g.error?a(new Error(g.error)):l(g.result):a(new Error(`Unexpected message type: ${g.type}`)))};let h=this._sendWithProtocol(s).catch(g=>{a(g),delete this._callbacks[s.invocationId]});this._launchStreams(o,h)})}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 o=this._methods[e];if(o)if(t){let n=o.indexOf(t);n!==-1&&(o.splice(n,1),o.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 o of t)switch(o.type){case p.Invocation:this._invokeClientMethod(o);break;case p.StreamItem:case p.Completion:{let n=this._callbacks[o.invocationId];if(n){o.type===p.Completion&&delete this._callbacks[o.invocationId];try{n(o)}catch(s){this._logger.log(i.Error,`Stream callback threw error: ${ie(s)}`)}}break}case p.Ping:break;case p.Close:{this._logger.log(i.Information,"Close message received from server.");let n=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(n):this._stopPromise=this._stopInternal(n);break}default:this._logger.log(i.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,o;try{[o,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(n){let s="Error parsing handshake response: "+n;this._logger.log(i.Error,s);let c=new Error(s);throw this._handshakeRejecter(c),c}if(t.error){let n="Server returned handshake error: "+t.error;this._logger.log(i.Error,n);let s=new Error(n);throw this._handshakeRejecter(s),s}else this._logger.log(i.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_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(()=>u(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 u(this,null,function*(){let t=e.target.toLowerCase(),o=this._methods[t];if(!o){this._logger.log(i.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let n=o.slice(),s=!!e.invocationId,c,l,a;for(let h of n)try{let g=c;c=yield h.apply(this,e.arguments),s&&c&&g&&(this._logger.log(i.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),l=void 0}catch(g){l=g,this._logger.log(i.Error,`A callback for the method '${t}' threw error '${g}'.`)}a?yield this._sendWithProtocol(a):s?(l?a=this._createCompletionMessage(e.invocationId,`${l}`,null):c!==void 0?a=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(a)):c&&this._logger.log(i.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(i.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new b("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,_.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(i.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return u(this,null,function*(){let t=Date.now(),o=0,n=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(o++,0,n);if(s===null){this._logger.log(i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(i.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(i.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(i.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(i.Information,`Reconnect attempt number ${o} will start in ${s} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(i.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(i.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n=c instanceof Error?c:new Error(c.toString()),s=this._getNextRetryDelay(o++,Date.now()-t,n)}}this._logger.log(i.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:o})}catch(n){return this._logger.log(i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(o=>{let n=t[o];try{n(null,e)}catch(s){this._logger.log(i.Error,`Stream 'error' callback called with '${e}' threw error: ${ie(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,o,n){if(o)return n.length!==0?{arguments:t,streamIds:n,target:e,type:p.Invocation}:{arguments:t,target:e,type:p.Invocation};{let s=this._invocationId;return this._invocationId++,n.length!==0?{arguments:t,invocationId:s.toString(),streamIds:n,target:e,type:p.Invocation}:{arguments:t,invocationId:s.toString(),target:e,type:p.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let o in e)e[o].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:n=>{let s;n instanceof Error?s=n.message:n&&n.toString?s=n.toString():s="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,s)))},next:n=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,n)))}})}}_replaceStreamingParams(e){let t=[],o=[];for(let n=0;n<e.length;n++){let s=e[n];if(this._isObservable(s)){let c=this._invocationId;this._invocationId++,t[c]=s,o.push(c.toString()),e.splice(n,1)}}return[t,o]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,o){let n=this._invocationId;return this._invocationId++,o.length!==0?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:p.StreamInvocation}:{arguments:t,invocationId:n.toString(),target:e,type:p.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:p.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:p.StreamItem}}_createCompletionMessage(e,t,o){return t?{error:t,invocationId:e,type:p.Completion}:{invocationId:e,result:o,type:p.Completion}}};var Ee=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ee}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var $=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var q=class extends v{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return u(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 o=yield this._innerClient.send(e);return t&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):o})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[$.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[$.Authorization]&&delete e.headers[$.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var C=function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r}(C||{}),w=function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r}(w||{});var ee=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{constructor(e,t,o){this._httpClient=e,this._logger=t,this._pollAbort=new ee,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}connect(e,t){return u(this,null,function*(){if(f.isRequired(e,"url"),f.isRequired(t,"transferFormat"),f.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(i.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=E(),s=d({[o]:n},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let l=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${l}.`);let a=yield this._httpClient.get(l,c);a.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new y(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return u(this,null,function*(){try{for(;this._running;)try{let o=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${o}.`);let n=yield this._httpClient.get(o,t);n.statusCode===204?(this._logger.log(i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):n.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new y(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(i.Trace,`(LongPolling transport) data received. ${x(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof T?this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(i.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return u(this,null,function*(){return this._running?V(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return u(this,null,function*(){this._logger.log(i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,o]=E();e[t]=o;let n={headers:d(d({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials};yield this._httpClient.delete(this._url,n),this._logger.log(i.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(i.Trace,e),this.onclose(this._closeError)}}};var te=class{constructor(e,t,o,n){this._httpClient=e,this._accessToken=t,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}connect(e,t){return u(this,null,function*(){return f.isRequired(e,"url"),f.isRequired(t,"transferFormat"),f.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,n)=>{let s=!1;if(t!==w.Text){n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(_.isBrowser||_.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let l=this._httpClient.getCookieString(e),a={};a.Cookie=l;let[h,g]=E();a[h]=g,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:d(d({},a),this._options.headers)})}try{c.onmessage=l=>{if(this.onreceive)try{this._logger.log(i.Trace,`(SSE transport) data received. ${x(l.data,this._options.logMessageContent)}.`),this.onreceive(l.data)}catch(a){this._close(a);return}},c.onerror=l=>{s?this._close():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(i.Information,`SSE connected to ${this._url}`),this._eventSource=c,s=!0,o()}}catch(l){n(l);return}})})}send(e){return u(this,null,function*(){return this._eventSource?V(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var oe=class{constructor(e,t,o,n,s,c){this._logger=o,this._accessTokenFactory=t,this._logMessageContent=n,this._webSocketConstructor=s,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return u(this,null,function*(){f.isRequired(e,"url"),f.isRequired(t,"transferFormat"),f.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=yield this._accessTokenFactory()),new Promise((n,s)=>{e=e.replace(/^http/,"ws");let c,l=this._httpClient.getCookieString(e),a=!1;if(_.isNode||_.isReactNative){let h={},[g,I]=E();h[g]=I,o&&(h[$.Authorization]=`Bearer ${o}`),l&&(h[$.Cookie]=l),c=new this._webSocketConstructor(e,void 0,{headers:d(d({},h),this._headers)})}else o&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=h=>{this._logger.log(i.Information,`WebSocket connected to ${e}.`),this._webSocket=c,a=!0,n()},c.onerror=h=>{let g=null;typeof ErrorEvent<"u"&&h instanceof ErrorEvent?g=h.error:g="There was an error with the transport",this._logger.log(i.Information,`(WebSockets transport) ${g}.`)},c.onmessage=h=>{if(this._logger.log(i.Trace,`(WebSockets transport) data received. ${x(h.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(h.data)}catch(g){this._close(g);return}},c.onclose=h=>{if(a)this._close(h);else{let g=null;typeof ErrorEvent<"u"&&h instanceof ErrorEvent?g=h.error:g="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(g))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(i.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var _e=100,ne=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,f.isRequired(e,"url"),this._logger=pe(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 o=null,n=null;if(_.isNode&&typeof H<"u"){let s=typeof __webpack_require__=="function"?__non_webpack_require__:H;o=s("ws"),n=s("eventsource")}!_.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:_.isNode&&!t.WebSocket&&o&&(t.WebSocket=o),!_.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:_.isNode&&!t.EventSource&&typeof n<"u"&&(t.EventSource=n),this._httpClient=new q(t.httpClient||new G(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return u(this,null,function*(){if(e=e||w.Binary,f.isIn(e,w,"transferFormat"),this._logger.log(i.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(i.Error,t),yield this._stopPromise,Promise.reject(new b(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(i.Error,t),Promise.reject(new b(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 se(this.transport)),this._sendQueue.send(e))}stop(e){return u(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return u(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return u(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===C.WebSockets)this.transport=this._constructTransport(C.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,n=0;do{if(o=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new b("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.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(o.url&&(t=o.url),o.accessToken){let s=o.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}n++}while(o.url&&n<_e);if(n===_e&&o.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,o,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(i.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}})}_getNegotiationResponse(e){return u(this,null,function*(){let t={},[o,n]=E();t[o]=n;let s=this._resolveNegotiateUrl(e);this._logger.log(i.Debug,`Sending negotiation request: ${s}.`);try{let c=yield this._httpClient.post(s,{content:"",headers:d(d({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let l=JSON.parse(c.content);return(!l.negotiateVersion||l.negotiateVersion<1)&&(l.connectionToken=l.connectionId),l}catch(c){let l="Failed to complete negotiation with the server: "+c;return c instanceof y&&c.statusCode===404&&(l=l+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(i.Error,l),Promise.reject(new F(l))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,o,n){return u(this,null,function*(){let s=this._createConnectUrl(e,o.connectionToken);if(this._isITransport(t)){this._logger.log(i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(s,n),this.connectionId=o.connectionId;return}let c=[],l=o.availableTransports||[],a=o;for(let h of l){let g=this._resolveTransportOrError(h,t,n);if(g instanceof Error)c.push(`${h.transport} failed:`),c.push(g);else if(this._isITransport(g)){if(this.transport=g,!a){try{a=yield this._getNegotiationResponse(e)}catch(I){return Promise.reject(I)}s=this._createConnectUrl(e,a.connectionToken)}try{yield this._startTransport(s,n),this.connectionId=a.connectionId;return}catch(I){if(this._logger.log(i.Error,`Failed to start the transport '${h.transport}': ${I}`),a=void 0,c.push(new B(`${h.transport} failed: ${I}`,C[h.transport])),this._connectionState!=="Connecting"){let ce="Failed to select transport before stop() was called.";return this._logger.log(i.Debug,ce),Promise.reject(new b(ce))}}}}return c.length>0?Promise.reject(new z(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case C.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new oe(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case C.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new te(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case C.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(e,t)}_resolveTransportOrError(e,t,o){let n=C[e.transport];if(n==null)return this._logger.log(i.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(Ie(t,n))if(e.transferFormats.map(c=>w[c]).indexOf(o)>=0){if(n===C.WebSockets&&!this._options.WebSocket||n===C.ServerSentEvents&&!this._options.EventSource)return this._logger.log(i.Debug,`Skipping transport '${C[n]}' because it is not supported in your environment.'`),new j(`'${C[n]}' is not supported in your environment.`,n);this._logger.log(i.Debug,`Selecting transport '${C[n]}'.`);try{return this._constructTransport(n)}catch(c){return c}}else return this._logger.log(i.Debug,`Skipping transport '${C[n]}' because it does not support the requested transfer format '${w[o]}'.`),new Error(`'${C[n]}' does not support ${w[o]}.`);else return this._logger.log(i.Debug,`Skipping transport '${C[n]}' because it was disabled by the client.`),new O(`'${C[n]}' is disabled by the client.`,n)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(i.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(i.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(i.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(i.Error,`Connection disconnected with error '${e}'.`):this._logger.log(i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(i.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!_.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(i.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=e.indexOf("?"),o=e.substring(0,t===-1?e.length:t);return o[o.length-1]!=="/"&&(o+="/"),o+="negotiate",o+=t===-1?"":e.substring(t),o.indexOf("negotiateVersion")===-1&&(o+=t===-1?"?":"&",o+="negotiateVersion="+this._negotiateVersion),o}};function Ie(r,e){return!r||(e&r)!==0}var se=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new N,this._transportResult=new N,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new N),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 u(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new N;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(o){e.reject(o)}}})}static _concatBuffers(e){let t=e.map(s=>s.byteLength).reduce((s,c)=>s+c),o=new Uint8Array(t),n=0;for(let s of e)o.set(new Uint8Array(s),n),n+=s.byteLength;return o.buffer}},N=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Te="json",re=class{constructor(){this.name=Te,this.version=1,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=k.instance);let o=S.parse(e),n=[];for(let s of o){let c=JSON.parse(s);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case p.Invocation:this._isInvocationMessage(c);break;case p.StreamItem:this._isStreamItemMessage(c);break;case p.Completion:this._isCompletionMessage(c);break;case p.Ping:break;case p.Close:break;default:t.log(i.Information,"Unknown message type '"+c.type+"' ignored.");continue}n.push(c)}return n}writeMessage(e){return S.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.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var xe={trace:i.Trace,debug:i.Debug,info:i.Information,information:i.Information,warn:i.Warning,warning:i.Warning,error:i.Error,critical:i.Critical,none:i.None};function Pe(r){let e=xe[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var M=class{configureLogging(e){if(f.isRequired(e,"logging"),De(e))this.logger=e;else if(typeof e=="string"){let t=Pe(e);this.logger=new D(t)}else this.logger=new D(e);return this}withUrl(e,t){return f.isRequired(e,"url"),f.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=d(d({},this.httpConnectionOptions),t):this.httpConnectionOptions=R(d({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return f.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}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 ne(this.url,e);return Z.create(t,this.logger||k.instance,this.protocol||new re,this.reconnectPolicy)}};function De(r){return r.log!==void 0}var Eo=(()=>{let e=class e{constructor(o,n,s){this.decodeTokenService=o,this.toastr=n,this.httpService=s,this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let o=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new ae(o||[])}setNotification(o){let s=[...this._notifications.value,o];this.saveNotificationTotal(s),this._notifications.next(s)}saveNotificationTotal(o=[]){localStorage.setItem("Notifications",JSON.stringify(o))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(o){return this.httpService.post("/api/notification/GetByID",{ID:o})}buildConnection(){this.hubConnection=new M().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(i.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(o=>console.log("Error while starting connection: "+o))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",o=>{let n=JSON.parse(o);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}))})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}};e.\u0275fac=function(n){return new(n||e)(U(ue),U(he),U(ge))},e.\u0275prov=le({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{Eo as a};
|
|
1
|
+
import{a as ue}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-SKMUHTVE.js";import{b as he,e as ge}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-7XITKPS5.js";import{$ as le,ca as U,d as ae}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-DJCANNYC.js";import{a as d,b as R,c as H,h as u}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.7.4/Marketplace/chunk-R7J6AS67.js";var y=class extends Error{constructor(e,t){let o=new.target.prototype;super(`${e}: Status code '${t}'`),this.statusCode=t,this.__proto__=o}},T=class extends Error{constructor(e="A timeout occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},b=class extends Error{constructor(e="An abort occurred."){let t=new.target.prototype;super(e),this.__proto__=t}},j=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="UnsupportedTransportError",this.__proto__=o}},O=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="DisabledTransportError",this.__proto__=o}},B=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.transport=t,this.errorType="FailedToStartTransportError",this.__proto__=o}},F=class extends Error{constructor(e){let t=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=t}},z=class extends Error{constructor(e,t){let o=new.target.prototype;super(e),this.innerErrors=t,this.__proto__=o}};var A=class{constructor(e,t,o){this.statusCode=e,this.statusText=t,this.content=o}},v=class{get(e,t){return this.send(R(d({},t),{method:"GET",url:e}))}post(e,t){return this.send(R(d({},t),{method:"POST",url:e}))}delete(e,t){return this.send(R(d({},t),{method:"DELETE",url:e}))}getCookieString(e){return""}};var i=function(r){return r[r.Trace=0]="Trace",r[r.Debug=1]="Debug",r[r.Information=2]="Information",r[r.Warning=3]="Warning",r[r.Error=4]="Error",r[r.Critical=5]="Critical",r[r.None=6]="None",r}(i||{});var k=class{constructor(){}log(e,t){}};k.instance=new k;var me="7.0.11",f=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,o){if(!(e in t))throw new Error(`Unknown ${o} value: ${e}.`)}},_=class{static get isBrowser(){return typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return typeof self=="object"&&"importScripts"in self}static get isReactNative(){return typeof window=="object"&&typeof window.document>"u"}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}};function x(r,e){let t="";return P(r)?(t=`Binary data of length ${r.byteLength}`,e&&(t+=`. Content: '${we(r)}'`)):typeof r=="string"&&(t=`String data of length ${r.length}`,e&&(t+=`. Content: '${r}'`)),t}function we(r){let e=new Uint8Array(r),t="";return e.forEach(o=>{let n=o<16?"0":"";t+=`0x${n}${o.toString(16)} `}),t.substr(0,t.length-1)}function P(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function V(r,e,t,o,n,s){return u(this,null,function*(){let c={},[l,a]=E();c[l]=a,r.log(i.Trace,`(${e} transport) sending data. ${x(n,s.logMessageContent)}.`);let h=P(n)?"arraybuffer":"text",g=yield t.post(o,{content:n,headers:d(d({},c),s.headers),responseType:h,timeout:s.timeout,withCredentials:s.withCredentials});r.log(i.Trace,`(${e} transport) request complete. Response status: ${g.statusCode}.`)})}function pe(r){return r===void 0?new D(i.Information):r===null?k.instance:r.log!==void 0?r:new D(r)}var J=class{constructor(e,t){this._subject=e,this._observer=t}dispose(){let e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}},D=class{constructor(e){this._minLevel=e,this.out=console}log(e,t){if(e>=this._minLevel){let o=`[${new Date().toISOString()}] ${i[e]}: ${t}`;switch(e){case i.Critical:case i.Error:this.out.error(o);break;case i.Warning:this.out.warn(o);break;case i.Information:this.out.info(o);break;default:this.out.log(o);break}}}};function E(){let r="X-SignalR-User-Agent";return _.isNode&&(r="User-Agent"),[r,be(me,Ce(),ye(),Se())]}function be(r,e,t,o){let n="Microsoft SignalR/",s=r.split(".");return n+=`${s[0]}.${s[1]}`,n+=` (${r}; `,e&&e!==""?n+=`${e}; `:n+="Unknown OS; ",n+=`${t}`,o?n+=`; ${o}`:n+="; Unknown Runtime Version",n+=")",n}function Ce(){if(_.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Se(){if(_.isNode)return process.versions.node}function ye(){return _.isNode?"NodeJS":"Browser"}function ie(r){return r.stack?r.stack:r.message?r.message:`${r}`}function de(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var X=class extends v{constructor(e){if(super(),this._logger=e,typeof fetch>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:H;this._jar=new(t("tough-cookie")).CookieJar,this._fetchType=t("node-fetch"),this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(de());if(typeof AbortController>"u"){let t=typeof __webpack_require__=="function"?__non_webpack_require__:H;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}send(e){return u(this,null,function*(){if(e.abortSignal&&e.abortSignal.aborted)throw new b;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");let t=new this._abortControllerType,o;e.abortSignal&&(e.abortSignal.onabort=()=>{t.abort(),o=new b});let n=null;if(e.timeout){let a=e.timeout;n=setTimeout(()=>{t.abort(),this._logger.log(i.Warning,"Timeout from HTTP request."),o=new T},a)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},P(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let s;try{s=yield this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:d({"X-Requested-With":"XMLHttpRequest"},e.headers),method:e.method,mode:"cors",redirect:"follow",signal:t.signal})}catch(a){throw o||(this._logger.log(i.Warning,`Error from HTTP request. ${a}.`),a)}finally{n&&clearTimeout(n),e.abortSignal&&(e.abortSignal.onabort=null)}if(!s.ok){let a=yield fe(s,"text");throw new y(a||s.statusText,s.status)}let l=yield fe(s,e.responseType);return new A(s.status,s.statusText,l)})}getCookieString(e){let t="";return _.isNode&&this._jar&&this._jar.getCookies(e,(o,n)=>t=n.join("; ")),t}};function fe(r,e){let t;switch(e){case"arraybuffer":t=r.arrayBuffer();break;case"text":t=r.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:t=r.text();break}return t}var K=class extends v{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new b):e.method?e.url?new Promise((t,o)=>{let n=new XMLHttpRequest;n.open(e.method,e.url,!0),n.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(P(e.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let s=e.headers;s&&Object.keys(s).forEach(c=>{n.setRequestHeader(c,s[c])}),e.responseType&&(n.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),o(new b)}),e.timeout&&(n.timeout=e.timeout),n.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),n.status>=200&&n.status<300?t(new A(n.status,n.statusText,n.response||n.responseText)):o(new y(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(i.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new y(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(i.Warning,"Timeout from HTTP request."),o(new T)},n.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var G=class extends v{constructor(e){if(super(),typeof fetch<"u"||_.isNode)this._httpClient=new X(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new K(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new b):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 S=class r{static write(e){return`${e}${r.RecordSeparator}`}static parse(e){if(e[e.length-1]!==r.RecordSeparator)throw new Error("Message is incomplete.");let t=e.split(r.RecordSeparator);return t.pop(),t}};S.RecordSeparatorCode=30;S.RecordSeparator=String.fromCharCode(S.RecordSeparatorCode);var Y=class{writeHandshakeRequest(e){return S.write(JSON.stringify(e))}parseHandshakeResponse(e){let t,o;if(P(e)){let l=new Uint8Array(e),a=l.indexOf(S.RecordSeparatorCode);if(a===-1)throw new Error("Message is incomplete.");let h=a+1;t=String.fromCharCode.apply(null,Array.prototype.slice.call(l.slice(0,h))),o=l.byteLength>h?l.slice(h).buffer:null}else{let l=e,a=l.indexOf(S.RecordSeparator);if(a===-1)throw new Error("Message is incomplete.");let h=a+1;t=l.substring(0,h),o=l.length>h?l.substring(h):null}let n=S.parse(t),s=JSON.parse(n[0]);if(s.type)throw new Error("Expected a handshake response from the server.");return[o,s]}};var p=function(r){return r[r.Invocation=1]="Invocation",r[r.StreamItem=2]="StreamItem",r[r.Completion=3]="Completion",r[r.StreamInvocation=4]="StreamInvocation",r[r.CancelInvocation=5]="CancelInvocation",r[r.Ping=6]="Ping",r[r.Close=7]="Close",r}(p||{});var Q=class{constructor(){this.observers=[]}next(e){for(let t of this.observers)t.next(e)}error(e){for(let t of this.observers)t.error&&t.error(e)}complete(){for(let e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new J(this,e)}};var ve=30*1e3,ke=15*1e3,m=function(r){return r.Disconnected="Disconnected",r.Connecting="Connecting",r.Connected="Connected",r.Disconnecting="Disconnecting",r.Reconnecting="Reconnecting",r}(m||{}),Z=class r{constructor(e,t,o,n){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},f.isRequired(e,"connection"),f.isRequired(t,"logger"),f.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=ve,this.keepAliveIntervalInMilliseconds=ke,this._logger=t,this._protocol=o,this.connection=e,this._reconnectPolicy=n,this._handshakeProtocol=new Y,this.connection.onreceive=s=>this._processIncomingData(s),this.connection.onclose=s=>this._connectionClosed(s),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:p.Ping})}static create(e,t,o,n){return new r(e,t,o,n)}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 u(this,null,function*(){if(this._connectionState!==m.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=m.Connecting,this._logger.log(i.Debug,"Starting HubConnection.");try{yield this._startInternal(),_.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=m.Connected,this._connectionStarted=!0,this._logger.log(i.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=m.Disconnected,this._logger.log(i.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}})}_startInternal(){return u(this,null,function*(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let e=new Promise((t,o)=>{this._handshakeResolver=t,this._handshakeRejecter=o});yield this.connection.start(this._protocol.transferFormat);try{let t={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(i.Debug,"Sending handshake request."),yield this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(t)),this._logger.log(i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),yield e,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||(yield this._sendMessage(this._cachedPingMessage))}catch(t){throw this._logger.log(i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),yield this.connection.stop(t),t}})}stop(){return u(this,null,function*(){let e=this._startPromise;this._stopPromise=this._stopInternal(),yield this._stopPromise;try{yield e}catch{}})}_stopInternal(e){return this._connectionState===m.Disconnected?(this._logger.log(i.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===m.Disconnecting?(this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=m.Disconnecting,this._logger.log(i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new b("The connection was stopped before the hub handshake could complete."),this.connection.stop(e)))}stream(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createStreamInvocation(e,t,n),c,l=new Q;return l.cancelCallback=()=>{let a=this._createCancelInvocation(s.invocationId);return delete this._callbacks[s.invocationId],c.then(()=>this._sendWithProtocol(a))},this._callbacks[s.invocationId]=(a,h)=>{if(h){l.error(h);return}else a&&(a.type===p.Completion?a.error?l.error(new Error(a.error)):l.complete():l.next(a.item))},c=this._sendWithProtocol(s).catch(a=>{l.error(a),delete this._callbacks[s.invocationId]}),this._launchStreams(o,c),l}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._sendMessage(this._protocol.writeMessage(e))}send(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._sendWithProtocol(this._createInvocation(e,t,!0,n));return this._launchStreams(o,s),s}invoke(e,...t){let[o,n]=this._replaceStreamingParams(t),s=this._createInvocation(e,t,!1,n);return new Promise((l,a)=>{this._callbacks[s.invocationId]=(g,I)=>{if(I){a(I);return}else g&&(g.type===p.Completion?g.error?a(new Error(g.error)):l(g.result):a(new Error(`Unexpected message type: ${g.type}`)))};let h=this._sendWithProtocol(s).catch(g=>{a(g),delete this._callbacks[s.invocationId]});this._launchStreams(o,h)})}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 o=this._methods[e];if(o)if(t){let n=o.indexOf(t);n!==-1&&(o.splice(n,1),o.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 o of t)switch(o.type){case p.Invocation:this._invokeClientMethod(o);break;case p.StreamItem:case p.Completion:{let n=this._callbacks[o.invocationId];if(n){o.type===p.Completion&&delete this._callbacks[o.invocationId];try{n(o)}catch(s){this._logger.log(i.Error,`Stream callback threw error: ${ie(s)}`)}}break}case p.Ping:break;case p.Close:{this._logger.log(i.Information,"Close message received from server.");let n=o.error?new Error("Server returned an error on close: "+o.error):void 0;o.allowReconnect===!0?this.connection.stop(n):this._stopPromise=this._stopInternal(n);break}default:this._logger.log(i.Warning,`Invalid message type: ${o.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let t,o;try{[o,t]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(n){let s="Error parsing handshake response: "+n;this._logger.log(i.Error,s);let c=new Error(s);throw this._handshakeRejecter(c),c}if(t.error){let n="Server returned handshake error: "+t.error;this._logger.log(i.Error,n);let s=new Error(n);throw this._handshakeRejecter(s),s}else this._logger.log(i.Debug,"Server handshake complete.");return this._handshakeResolver(),o}_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(()=>u(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 u(this,null,function*(){let t=e.target.toLowerCase(),o=this._methods[t];if(!o){this._logger.log(i.Warning,`No client method with the name '${t}' found.`),e.invocationId&&(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),yield this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}let n=o.slice(),s=!!e.invocationId,c,l,a;for(let h of n)try{let g=c;c=yield h.apply(this,e.arguments),s&&c&&g&&(this._logger.log(i.Error,`Multiple results provided for '${t}'. Sending error to server.`),a=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),l=void 0}catch(g){l=g,this._logger.log(i.Error,`A callback for the method '${t}' threw error '${g}'.`)}a?yield this._sendWithProtocol(a):s?(l?a=this._createCompletionMessage(e.invocationId,`${l}`,null):c!==void 0?a=this._createCompletionMessage(e.invocationId,null,c):(this._logger.log(i.Warning,`No result given for '${t}' method and invocation ID '${e.invocationId}'.`),a=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),yield this._sendWithProtocol(a)):c&&this._logger.log(i.Error,`Result given for '${t}' method but server is not expecting a result.`)})}_connectionClosed(e){this._logger.log(i.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new b("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,_.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(t=>t.apply(this,[e]))}catch(t){this._logger.log(i.Error,`An onclose callback called with error '${e}' threw error '${t}'.`)}}}_reconnect(e){return u(this,null,function*(){let t=Date.now(),o=0,n=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),s=this._getNextRetryDelay(o++,0,n);if(s===null){this._logger.log(i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=m.Reconnecting,e?this._logger.log(i.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(i.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(c=>c.apply(this,[e]))}catch(c){this._logger.log(i.Error,`An onreconnecting callback called with error '${e}' threw error '${c}'.`)}if(this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;s!==null;){if(this._logger.log(i.Information,`Reconnect attempt number ${o} will start in ${s} ms.`),yield new Promise(c=>{this._reconnectDelayHandle=setTimeout(c,s)}),this._reconnectDelayHandle=void 0,this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(yield this._startInternal(),this._connectionState=m.Connected,this._logger.log(i.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(c=>c.apply(this,[this.connection.connectionId]))}catch(c){this._logger.log(i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${c}'.`)}return}catch(c){if(this._logger.log(i.Information,`Reconnect attempt failed because of error '${c}'.`),this._connectionState!==m.Reconnecting){this._logger.log(i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===m.Disconnecting&&this._completeClose();return}n=c instanceof Error?c:new Error(c.toString()),s=this._getNextRetryDelay(o++,Date.now()-t,n)}}this._logger.log(i.Information,`Reconnect retries have been exhausted after ${Date.now()-t} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()})}_getNextRetryDelay(e,t,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:e,retryReason:o})}catch(n){return this._logger.log(i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${t}) threw error '${n}'.`),null}}_cancelCallbacksWithError(e){let t=this._callbacks;this._callbacks={},Object.keys(t).forEach(o=>{let n=t[o];try{n(null,e)}catch(s){this._logger.log(i.Error,`Stream 'error' callback called with '${e}' threw error: ${ie(s)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,t,o,n){if(o)return n.length!==0?{arguments:t,streamIds:n,target:e,type:p.Invocation}:{arguments:t,target:e,type:p.Invocation};{let s=this._invocationId;return this._invocationId++,n.length!==0?{arguments:t,invocationId:s.toString(),streamIds:n,target:e,type:p.Invocation}:{arguments:t,invocationId:s.toString(),target:e,type:p.Invocation}}}_launchStreams(e,t){if(e.length!==0){t||(t=Promise.resolve());for(let o in e)e[o].subscribe({complete:()=>{t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:n=>{let s;n instanceof Error?s=n.message:n&&n.toString?s=n.toString():s="Unknown error",t=t.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,s)))},next:n=>{t=t.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,n)))}})}}_replaceStreamingParams(e){let t=[],o=[];for(let n=0;n<e.length;n++){let s=e[n];if(this._isObservable(s)){let c=this._invocationId;this._invocationId++,t[c]=s,o.push(c.toString()),e.splice(n,1)}}return[t,o]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,t,o){let n=this._invocationId;return this._invocationId++,o.length!==0?{arguments:t,invocationId:n.toString(),streamIds:o,target:e,type:p.StreamInvocation}:{arguments:t,invocationId:n.toString(),target:e,type:p.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:p.CancelInvocation}}_createStreamItemMessage(e,t){return{invocationId:e,item:t,type:p.StreamItem}}_createCompletionMessage(e,t,o){return t?{error:t,invocationId:e,type:p.Completion}:{invocationId:e,result:o,type:p.Completion}}};var Ee=[0,2e3,1e4,3e4,null],L=class{constructor(e){this._retryDelays=e!==void 0?[...e,null]:Ee}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}};var $=(()=>{class r{}return r.Authorization="Authorization",r.Cookie="Cookie",r})();var q=class extends v{constructor(e,t){super(),this._innerClient=e,this._accessTokenFactory=t}send(e){return u(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 o=yield this._innerClient.send(e);return t&&o.statusCode===401&&this._accessTokenFactory?(this._accessToken=yield this._accessTokenFactory(),this._setAuthorizationHeader(e),yield this._innerClient.send(e)):o})}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[$.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[$.Authorization]&&delete e.headers[$.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}};var C=function(r){return r[r.None=0]="None",r[r.WebSockets=1]="WebSockets",r[r.ServerSentEvents=2]="ServerSentEvents",r[r.LongPolling=4]="LongPolling",r}(C||{}),w=function(r){return r[r.Text=1]="Text",r[r.Binary=2]="Binary",r}(w||{});var ee=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var W=class{constructor(e,t,o){this._httpClient=e,this._logger=t,this._pollAbort=new ee,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}connect(e,t){return u(this,null,function*(){if(f.isRequired(e,"url"),f.isRequired(t,"transferFormat"),f.isIn(t,w,"transferFormat"),this._url=e,this._logger.log(i.Trace,"(LongPolling transport) Connecting."),t===w.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=E(),s=d({[o]:n},this._options.headers),c={abortSignal:this._pollAbort.signal,headers:s,timeout:1e5,withCredentials:this._options.withCredentials};t===w.Binary&&(c.responseType="arraybuffer");let l=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${l}.`);let a=yield this._httpClient.get(l,c);a.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new y(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,c)})}_poll(e,t){return u(this,null,function*(){try{for(;this._running;)try{let o=`${e}&_=${Date.now()}`;this._logger.log(i.Trace,`(LongPolling transport) polling: ${o}.`);let n=yield this._httpClient.get(o,t);n.statusCode===204?(this._logger.log(i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):n.statusCode!==200?(this._logger.log(i.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new y(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(i.Trace,`(LongPolling transport) data received. ${x(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(o){this._running?o instanceof T?this._logger.log(i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=o,this._running=!1):this._logger.log(i.Trace,`(LongPolling transport) Poll errored after shutdown: ${o.message}`)}}finally{this._logger.log(i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}})}send(e){return u(this,null,function*(){return this._running?V(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return u(this,null,function*(){this._logger.log(i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{yield this._receiving,this._logger.log(i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let e={},[t,o]=E();e[t]=o;let n={headers:d(d({},e),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials};yield this._httpClient.delete(this._url,n),this._logger.log(i.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}})}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(i.Trace,e),this.onclose(this._closeError)}}};var te=class{constructor(e,t,o,n){this._httpClient=e,this._accessToken=t,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}connect(e,t){return u(this,null,function*(){return f.isRequired(e,"url"),f.isRequired(t,"transferFormat"),f.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,n)=>{let s=!1;if(t!==w.Text){n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let c;if(_.isBrowser||_.isWebWorker)c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{let l=this._httpClient.getCookieString(e),a={};a.Cookie=l;let[h,g]=E();a[h]=g,c=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:d(d({},a),this._options.headers)})}try{c.onmessage=l=>{if(this.onreceive)try{this._logger.log(i.Trace,`(SSE transport) data received. ${x(l.data,this._options.logMessageContent)}.`),this.onreceive(l.data)}catch(a){this._close(a);return}},c.onerror=l=>{s?this._close():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},c.onopen=()=>{this._logger.log(i.Information,`SSE connected to ${this._url}`),this._eventSource=c,s=!0,o()}}catch(l){n(l);return}})})}send(e){return u(this,null,function*(){return this._eventSource?V(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))})}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}};var oe=class{constructor(e,t,o,n,s,c){this._logger=o,this._accessTokenFactory=t,this._logMessageContent=n,this._webSocketConstructor=s,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=c}connect(e,t){return u(this,null,function*(){f.isRequired(e,"url"),f.isRequired(t,"transferFormat"),f.isIn(t,w,"transferFormat"),this._logger.log(i.Trace,"(WebSockets transport) Connecting.");let o;return this._accessTokenFactory&&(o=yield this._accessTokenFactory()),new Promise((n,s)=>{e=e.replace(/^http/,"ws");let c,l=this._httpClient.getCookieString(e),a=!1;if(_.isNode||_.isReactNative){let h={},[g,I]=E();h[g]=I,o&&(h[$.Authorization]=`Bearer ${o}`),l&&(h[$.Cookie]=l),c=new this._webSocketConstructor(e,void 0,{headers:d(d({},h),this._headers)})}else o&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(o)}`);c||(c=new this._webSocketConstructor(e)),t===w.Binary&&(c.binaryType="arraybuffer"),c.onopen=h=>{this._logger.log(i.Information,`WebSocket connected to ${e}.`),this._webSocket=c,a=!0,n()},c.onerror=h=>{let g=null;typeof ErrorEvent<"u"&&h instanceof ErrorEvent?g=h.error:g="There was an error with the transport",this._logger.log(i.Information,`(WebSockets transport) ${g}.`)},c.onmessage=h=>{if(this._logger.log(i.Trace,`(WebSockets transport) data received. ${x(h.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(h.data)}catch(g){this._close(g);return}},c.onclose=h=>{if(a)this._close(h);else{let g=null;typeof ErrorEvent<"u"&&h instanceof ErrorEvent?g=h.error:g="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",s(new Error(g))}}})})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(i.Trace,`(WebSockets transport) sending data. ${x(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}};var _e=100,ne=class{constructor(e,t={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,f.isRequired(e,"url"),this._logger=pe(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 o=null,n=null;if(_.isNode&&typeof H<"u"){let s=typeof __webpack_require__=="function"?__non_webpack_require__:H;o=s("ws"),n=s("eventsource")}!_.isNode&&typeof WebSocket<"u"&&!t.WebSocket?t.WebSocket=WebSocket:_.isNode&&!t.WebSocket&&o&&(t.WebSocket=o),!_.isNode&&typeof EventSource<"u"&&!t.EventSource?t.EventSource=EventSource:_.isNode&&!t.EventSource&&typeof n<"u"&&(t.EventSource=n),this._httpClient=new q(t.httpClient||new G(this._logger),t.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=t,this.onreceive=null,this.onclose=null}start(e){return u(this,null,function*(){if(e=e||w.Binary,f.isIn(e,w,"transferFormat"),this._logger.log(i.Debug,`Starting connection with transfer format '${w[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),yield this._startInternalPromise,this._connectionState==="Disconnecting"){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(i.Error,t),yield this._stopPromise,Promise.reject(new b(t))}else if(this._connectionState!=="Connected"){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(i.Error,t),Promise.reject(new b(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 se(this.transport)),this._sendQueue.send(e))}stop(e){return u(this,null,function*(){if(this._connectionState==="Disconnected")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(i.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),yield this._stopInternal(e),yield this._stopPromise})}_stopInternal(e){return u(this,null,function*(){this._stopError=e;try{yield this._startInternalPromise}catch{}if(this.transport){try{yield this.transport.stop()}catch(t){this._logger.log(i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")})}_startInternal(e){return u(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===C.WebSockets)this.transport=this._constructTransport(C.WebSockets),yield this._startTransport(t,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let o=null,n=0;do{if(o=yield this._getNegotiationResponse(t),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new b("The connection was stopped during negotiation.");if(o.error)throw new Error(o.error);if(o.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(o.url&&(t=o.url),o.accessToken){let s=o.accessToken;this._accessTokenFactory=()=>s,this._httpClient._accessToken=s,this._httpClient._accessTokenFactory=void 0}n++}while(o.url&&n<_e);if(n===_e&&o.url)throw new Error("Negotiate redirection limit exceeded.");yield this._createTransport(t,this._options.transport,o,e)}this.transport instanceof W&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(o){return this._logger.log(i.Error,"Failed to start the connection: "+o),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(o)}})}_getNegotiationResponse(e){return u(this,null,function*(){let t={},[o,n]=E();t[o]=n;let s=this._resolveNegotiateUrl(e);this._logger.log(i.Debug,`Sending negotiation request: ${s}.`);try{let c=yield this._httpClient.post(s,{content:"",headers:d(d({},t),this._options.headers),timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(c.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${c.statusCode}'`));let l=JSON.parse(c.content);return(!l.negotiateVersion||l.negotiateVersion<1)&&(l.connectionToken=l.connectionId),l}catch(c){let l="Failed to complete negotiation with the server: "+c;return c instanceof y&&c.statusCode===404&&(l=l+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(i.Error,l),Promise.reject(new F(l))}})}_createConnectUrl(e,t){return t?e+(e.indexOf("?")===-1?"?":"&")+`id=${t}`:e}_createTransport(e,t,o,n){return u(this,null,function*(){let s=this._createConnectUrl(e,o.connectionToken);if(this._isITransport(t)){this._logger.log(i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,yield this._startTransport(s,n),this.connectionId=o.connectionId;return}let c=[],l=o.availableTransports||[],a=o;for(let h of l){let g=this._resolveTransportOrError(h,t,n);if(g instanceof Error)c.push(`${h.transport} failed:`),c.push(g);else if(this._isITransport(g)){if(this.transport=g,!a){try{a=yield this._getNegotiationResponse(e)}catch(I){return Promise.reject(I)}s=this._createConnectUrl(e,a.connectionToken)}try{yield this._startTransport(s,n),this.connectionId=a.connectionId;return}catch(I){if(this._logger.log(i.Error,`Failed to start the transport '${h.transport}': ${I}`),a=void 0,c.push(new B(`${h.transport} failed: ${I}`,C[h.transport])),this._connectionState!=="Connecting"){let ce="Failed to select transport before stop() was called.";return this._logger.log(i.Debug,ce),Promise.reject(new b(ce))}}}}return c.length>0?Promise.reject(new z(`Unable to connect to the server with any of the available transports. ${c.join(" ")}`,c)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))})}_constructTransport(e){switch(e){case C.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new oe(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case C.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new te(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case C.LongPolling:return new W(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,t){return this.transport.onreceive=this.onreceive,this.transport.onclose=o=>this._stopConnection(o),this.transport.connect(e,t)}_resolveTransportOrError(e,t,o){let n=C[e.transport];if(n==null)return this._logger.log(i.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(Ie(t,n))if(e.transferFormats.map(c=>w[c]).indexOf(o)>=0){if(n===C.WebSockets&&!this._options.WebSocket||n===C.ServerSentEvents&&!this._options.EventSource)return this._logger.log(i.Debug,`Skipping transport '${C[n]}' because it is not supported in your environment.'`),new j(`'${C[n]}' is not supported in your environment.`,n);this._logger.log(i.Debug,`Selecting transport '${C[n]}'.`);try{return this._constructTransport(n)}catch(c){return c}}else return this._logger.log(i.Debug,`Skipping transport '${C[n]}' because it does not support the requested transfer format '${w[o]}'.`),new Error(`'${C[n]}' does not support ${w[o]}.`);else return this._logger.log(i.Debug,`Skipping transport '${C[n]}' because it was disabled by the client.`),new O(`'${C[n]}' is disabled by the client.`,n)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(i.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(i.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(i.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(i.Error,`Connection disconnected with error '${e}'.`):this._logger.log(i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(t){this._logger.log(i.Error,`HttpConnection.onclose(${e}) threw error '${t}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!_.isBrowser)throw new Error(`Cannot resolve '${e}'.`);let t=window.document.createElement("a");return t.href=e,this._logger.log(i.Information,`Normalizing '${e}' to '${t.href}'.`),t.href}_resolveNegotiateUrl(e){let t=e.indexOf("?"),o=e.substring(0,t===-1?e.length:t);return o[o.length-1]!=="/"&&(o+="/"),o+="negotiate",o+=t===-1?"":e.substring(t),o.indexOf("negotiateVersion")===-1&&(o+=t===-1?"?":"&",o+="negotiateVersion="+this._negotiateVersion),o}};function Ie(r,e){return!r||(e&r)!==0}var se=class r{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new N,this._transportResult=new N,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new N),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 u(this,null,function*(){for(;;){if(yield this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new N;let e=this._transportResult;this._transportResult=void 0;let t=typeof this._buffer[0]=="string"?this._buffer.join(""):r._concatBuffers(this._buffer);this._buffer.length=0;try{yield this._transport.send(t),e.resolve()}catch(o){e.reject(o)}}})}static _concatBuffers(e){let t=e.map(s=>s.byteLength).reduce((s,c)=>s+c),o=new Uint8Array(t),n=0;for(let s of e)o.set(new Uint8Array(s),n),n+=s.byteLength;return o.buffer}},N=class{constructor(){this.promise=new Promise((e,t)=>[this._resolver,this._rejecter]=[e,t])}resolve(){this._resolver()}reject(e){this._rejecter(e)}};var Te="json",re=class{constructor(){this.name=Te,this.version=1,this.transferFormat=w.Text}parseMessages(e,t){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];t===null&&(t=k.instance);let o=S.parse(e),n=[];for(let s of o){let c=JSON.parse(s);if(typeof c.type!="number")throw new Error("Invalid payload.");switch(c.type){case p.Invocation:this._isInvocationMessage(c);break;case p.StreamItem:this._isStreamItemMessage(c);break;case p.Completion:this._isCompletionMessage(c);break;case p.Ping:break;case p.Close:break;default:t.log(i.Information,"Unknown message type '"+c.type+"' ignored.");continue}n.push(c)}return n}writeMessage(e){return S.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.")}_assertNotEmptyString(e,t){if(typeof e!="string"||e==="")throw new Error(t)}};var xe={trace:i.Trace,debug:i.Debug,info:i.Information,information:i.Information,warn:i.Warning,warning:i.Warning,error:i.Error,critical:i.Critical,none:i.None};function Pe(r){let e=xe[r.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${r}`)}var M=class{configureLogging(e){if(f.isRequired(e,"logging"),De(e))this.logger=e;else if(typeof e=="string"){let t=Pe(e);this.logger=new D(t)}else this.logger=new D(e);return this}withUrl(e,t){return f.isRequired(e,"url"),f.isNotEmpty(e,"url"),this.url=e,typeof t=="object"?this.httpConnectionOptions=d(d({},this.httpConnectionOptions),t):this.httpConnectionOptions=R(d({},this.httpConnectionOptions),{transport:t}),this}withHubProtocol(e){return f.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new L(e):this.reconnectPolicy=e:this.reconnectPolicy=new L,this}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 ne(this.url,e);return Z.create(t,this.logger||k.instance,this.protocol||new re,this.reconnectPolicy)}};function De(r){return r.log!==void 0}var Eo=(()=>{let e=class e{constructor(o,n,s){this.decodeTokenService=o,this.toastr=n,this.httpService=s,this.initNotifications(),this.parseToken=this.decodeTokenService.getParseToken(),this.buildConnection()}initNotifications(){let o=JSON.parse(localStorage.getItem("Notifications"));this._notifications=new ae(o||[])}setNotification(o){let s=[...this._notifications.value,o];this.saveNotificationTotal(s),this._notifications.next(s)}saveNotificationTotal(o=[]){localStorage.setItem("Notifications",JSON.stringify(o))}getNotification(){return this._notifications.asObservable()}getNotificationDetail(o){return this.httpService.post("/api/notification/GetByID",{ID:o})}buildConnection(){this.hubConnection=new M().withUrl("/MarketplaceHub").withAutomaticReconnect().configureLogging(i.Information).build(),this.startConnection(),this.onConnectionClose(),this.subscribeNotification()}connectToRegister(){this.hubConnection.invoke("SubscribeGroup",this.parseToken.PID)}startConnection(){this.hubConnection.start().then(()=>{this.connectToRegister()}).catch(o=>console.log("Error while starting connection: "+o))}onConnectionClose(){this.hubConnection.onclose(()=>{this.buildConnection()})}subscribeNotification(){this.hubConnection.on("Notification",o=>{let n=JSON.parse(o);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}))})}clearNotification(){localStorage.removeItem("Notifications"),this._notifications.next([])}};e.\u0275fac=function(n){return new(n||e)(U(ue),U(he),U(ge))},e.\u0275prov=le({token:e,factory:e.\u0275fac,providedIn:"root"});let r=e;return r})();export{Eo as a};
|