marketplacepos 3.10.2 → 3.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/Marketplace/{chunk-6C4L2S7S.js → chunk-2CCOAUJC.js} +1 -1
  2. package/Marketplace/{chunk-6ORTAB6O.js → chunk-2E7TANNT.js} +1 -1
  3. package/Marketplace/{chunk-RS4FBR2B.js → chunk-2ILB3NSK.js} +1 -1
  4. package/Marketplace/{chunk-TZRTEOJA.js → chunk-4276ECDR.js} +1 -1
  5. package/Marketplace/{chunk-GRHKW2KQ.js → chunk-4BX3EUMQ.js} +1 -1
  6. package/Marketplace/{chunk-DG6KCZ24.js → chunk-4L6TZC4Q.js} +1 -1
  7. package/Marketplace/{chunk-PHYOU4H6.js → chunk-4RHNT4DZ.js} +1 -1
  8. package/Marketplace/{chunk-VA2Y75VY.js → chunk-52XKBWBC.js} +1 -1
  9. package/Marketplace/{chunk-VGBWD4JQ.js → chunk-5ADQ3O2A.js} +1 -1
  10. package/Marketplace/{chunk-B6BTNEL5.js → chunk-6F5PLBQH.js} +1 -1
  11. package/Marketplace/{chunk-MQ5YF2EQ.js → chunk-6FRKO4S2.js} +1 -1
  12. package/Marketplace/{chunk-UZO2VDKA.js → chunk-A6KWQYQ4.js} +1 -1
  13. package/Marketplace/{chunk-NNZ2QIAF.js → chunk-BCUSOEWI.js} +1 -1
  14. package/Marketplace/{chunk-WKWDPKZH.js → chunk-C7NKOWMY.js} +1 -1
  15. package/Marketplace/{chunk-XT3VATZ2.js → chunk-CHXSDB2F.js} +1 -1
  16. package/Marketplace/{chunk-DITYFI3U.js → chunk-CMVC2NTG.js} +1 -1
  17. package/Marketplace/{chunk-2OVWEFCG.js → chunk-E3GZ25PR.js} +1 -1
  18. package/Marketplace/chunk-F4WFV5C7.js +1 -0
  19. package/Marketplace/{chunk-V6IO53G5.js → chunk-FP2EY4DY.js} +1 -1
  20. package/Marketplace/{chunk-4R2X6SN5.js → chunk-FQV6GA74.js} +1 -1
  21. package/Marketplace/{chunk-MFWCFDSI.js → chunk-FUC2SF5Q.js} +1 -1
  22. package/Marketplace/{chunk-EJMJP3AQ.js → chunk-FWBPK3JW.js} +2 -2
  23. package/Marketplace/{chunk-MB5EFAFQ.js → chunk-FYQZXWZE.js} +1 -1
  24. package/Marketplace/{chunk-WTRYN5E5.js → chunk-HCE3NYED.js} +1 -1
  25. package/Marketplace/{chunk-C6SMFVRJ.js → chunk-HG3XRZ32.js} +1 -1
  26. package/Marketplace/chunk-HNWEYQEO.js +1 -0
  27. package/Marketplace/{chunk-3ZPC3DOZ.js → chunk-I2E3VYHO.js} +1 -1
  28. package/Marketplace/{chunk-RTSSYFK3.js → chunk-IHY6NGKX.js} +1 -1
  29. package/Marketplace/{chunk-NZ5PGMTU.js → chunk-ITCAVZN5.js} +1 -1
  30. package/Marketplace/{chunk-VWCDA6IC.js → chunk-JAGECSCV.js} +1 -1
  31. package/Marketplace/{chunk-DDXVCGNF.js → chunk-LMYBWQKO.js} +1 -1
  32. package/Marketplace/{chunk-L3QJXWW4.js → chunk-MCVGOQW3.js} +1 -1
  33. package/Marketplace/{chunk-NX7MGO3M.js → chunk-MHZTEGOR.js} +1 -1
  34. package/Marketplace/{chunk-7RZLTDIS.js → chunk-MLG7CYPK.js} +1 -1
  35. package/Marketplace/{chunk-Z24AOV6E.js → chunk-MPPVCPW6.js} +1 -1
  36. package/Marketplace/{chunk-2HHCA3NK.js → chunk-MXRTBC2I.js} +1 -1
  37. package/Marketplace/{chunk-LPSC67EP.js → chunk-N76NUVI2.js} +1 -1
  38. package/Marketplace/{chunk-5VJQDJRJ.js → chunk-NLIQ2J6A.js} +1 -1
  39. package/Marketplace/{chunk-7C4NOK37.js → chunk-NWBY55LE.js} +1 -1
  40. package/Marketplace/{chunk-CD5AKGA4.js → chunk-OI2AB7KN.js} +1 -1
  41. package/Marketplace/{chunk-6NGKE364.js → chunk-OQPXY7Z5.js} +1 -1
  42. package/Marketplace/{chunk-MIITW5F3.js → chunk-PAHXMFHZ.js} +1 -1
  43. package/Marketplace/chunk-QXR35VSU.js +5 -0
  44. package/Marketplace/{chunk-G7RXTLDR.js → chunk-SX547BDR.js} +1 -1
  45. package/Marketplace/{chunk-I2G5J34U.js → chunk-TKMWRB4W.js} +1 -1
  46. package/Marketplace/{chunk-223SSA62.js → chunk-TYL25LTY.js} +1 -1
  47. package/Marketplace/{chunk-JN7U2QOU.js → chunk-U22NLR2G.js} +1 -1
  48. package/Marketplace/{chunk-Y3MMZORK.js → chunk-V7GAS2H2.js} +1 -1
  49. package/Marketplace/{chunk-CCMD33HH.js → chunk-WAEUYRER.js} +1 -1
  50. package/Marketplace/{chunk-FGIAQ42H.js → chunk-WPB7FUQN.js} +12 -12
  51. package/Marketplace/{chunk-H6M6M4LW.js → chunk-XDA6LS5Q.js} +1 -1
  52. package/Marketplace/{chunk-GK4USVUZ.js → chunk-XM2IT53M.js} +1 -1
  53. package/Marketplace/{chunk-PIKZDDIU.js → chunk-YJTBGAYK.js} +1 -1
  54. package/Marketplace/{chunk-2TS2HEE6.js → chunk-YNZUWVLD.js} +1 -1
  55. package/Marketplace/{chunk-UYBYAC3J.js → chunk-YRDQ5HY2.js} +1 -1
  56. package/Marketplace/{chunk-YBOYS5WI.js → chunk-YUII6AII.js} +1 -1
  57. package/Marketplace/{chunk-M4MZ4PBS.js → chunk-ZJQVUUVL.js} +1 -1
  58. package/Marketplace/index.html +2 -2
  59. package/Marketplace/{main-2KHAM5PJ.js → main-YQ364KRP.js} +1 -1
  60. package/Marketplace/{styles-U2EKFDJI.css → styles-Y32ZXHRJ.css} +1 -1
  61. package/package.json +1 -1
  62. package/Marketplace/chunk-OZAOB2RM.js +0 -1
  63. package/Marketplace/chunk-POHGR6GW.js +0 -5
  64. package/Marketplace/chunk-V3BUL62F.js +0 -1
  65. /package/Marketplace/{chunk-SDNS6DZW.js → chunk-K6D5ADDS.js} +0 -0
  66. /package/Marketplace/{chunk-NNG6BZAM.js → chunk-QMX3UB7H.js} +0 -0
  67. /package/Marketplace/{chunk-ODLFLX6Z.js → chunk-WTVDIONN.js} +0 -0
  68. /package/Marketplace/{polyfills-OPLU3AGL.js → polyfills-MG5POISX.js} +0 -0
@@ -1 +1 @@
1
- import{$ as y,A as z,E as F,I as H,Ja as Q,Jb as _,L as G,La as W,N as S,R as C,T as j,Va as X,X as V,aa as Y,ba as A,ca as d,d as g,da as P,fa as Z,ga as J,ia as q,m as f,n as c,q as v,s as p,t as I,w as M,xc as ee}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-2TS2HEE6.js";import{a as m,b as O}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-NNG6BZAM.js";var D={REMOVE:"remove",SHOW:"show"},ie=(()=>{let r=class r{constructor(){this.strategiesSource=new g({}),this.strategies$=this.strategiesSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),L=new A("USE_CONFIGURATION_STORE"),B=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.configurationStore=t,this.strategiesSource=this.isolate?new g({}):this.configurationStore.strategiesSource,this.strategies$=this.strategiesSource.asObservable(),this.onAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onAuthorisedDefaultStrategy,this.onUnAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onUnAuthorisedDefaultStrategy}setDefaultOnAuthorizedStrategy(e){this.isolate?this.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onAuthorisedDefaultStrategy=this.configurationStore.onAuthorisedDefaultStrategy)}setDefaultOnUnauthorizedStrategy(e){this.isolate?this.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onUnAuthorisedDefaultStrategy=this.configurationStore.onUnAuthorisedDefaultStrategy)}addPermissionStrategy(e,t){this.strategiesSource.value[e]=t}getStrategy(e){return this.strategiesSource.value[e]}getAllStrategies(){return this.strategiesSource.value}getDefinedStrategy(e){if(this.strategiesSource.value[e]||this.isPredefinedStrategy(e))return e;throw new Error(`No ' ${e} ' strategy is found please define one`)}isPredefinedStrategy(e){return e===D.SHOW||e===D.REMOVE}};r.\u0275fac=function(t){return new(t||r)(d(L),d(ie))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();function l(s){return typeof s=="function"}function K(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;{let r=Object.getPrototypeOf(s);return r===null||r===Object.prototype}}function se(s){return!!s&&typeof s=="string"}function R(s){return typeof s=="boolean"}function ne(s){return Object.prototype.toString.call(s)==="[object Promise]"}function T(s){return Array.isArray(s)?s.length>0:!!s}function w(s){return se(s)?[s]:s}var re=(()=>{let r=class r{constructor(){this.permissionsSource=new g({}),this.permissions$=this.permissionsSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),$=new A("USE_PERMISSIONS_STORE"),E=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.permissionsStore=t,this.permissionsSource=this.isolate?new g({}):this.permissionsStore.permissionsSource,this.permissions$=this.permissionsSource.asObservable()}flushPermissions(){this.permissionsSource.next({})}hasPermission(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),this.hasArrayPermission(e))}loadPermissions(e,t){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),{});this.permissionsSource.next(i)}addPermission(e,t){if(Array.isArray(e)){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),this.permissionsSource.value);this.permissionsSource.next(i)}else{let i=this.reducePermission(this.permissionsSource.value,e,t);this.permissionsSource.next(i)}}removePermission(e){let t=m({},this.permissionsSource.value);delete t[e],this.permissionsSource.next(t)}getPermission(e){return this.permissionsSource.value[e]}getPermissions(){return this.permissionsSource.value}reducePermission(e,t,i){return i&&l(i)?O(m({},e),{[t]:{name:t,validationFunction:i}}):O(m({},e),{[t]:{name:t}})}hasArrayPermission(e){let t=e.map(i=>{if(this.hasPermissionValidationFunction(i)){let n=this.permissionsSource.value[i].validationFunction,o=m({},this.permissionsSource.value);return c(null).pipe(v(()=>n(i,o)),j(h=>R(h)?c(h):h),F(()=>c(!1)))}return c(!!this.permissionsSource.value[i])});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasPermissionValidationFunction(e){return!!this.permissionsSource.value[e]&&!!this.permissionsSource.value[e].validationFunction&&l(this.permissionsSource.value[e].validationFunction)}};r.\u0275fac=function(t){return new(t||r)(d($),d(re))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),k=class{constructor(){this.rolesSource=new g({}),this.roles$=this.rolesSource.asObservable()}},N=new A("USE_ROLES_STORE"),b=(()=>{let r=class r{constructor(e=!1,t,i){this.isolate=e,this.rolesStore=t,this.permissionsService=i,this.rolesSource=this.isolate?new g({}):this.rolesStore.rolesSource,this.roles$=this.rolesSource.asObservable()}addRole(e,t){let i=O(m({},this.rolesSource.value),{[e]:{name:e,validationFunction:t}});this.rolesSource.next(i)}addRoleWithPermissions(e,t){this.permissionsService.addPermission(t),this.addRole(e,t)}addRoles(e){Object.keys(e).forEach((t,i)=>{this.addRole(t,e[t])})}addRolesWithPermissions(e){Object.keys(e).forEach((t,i)=>{this.addRoleWithPermissions(t,e[t])})}flushRoles(){this.rolesSource.next({})}flushRolesAndPermissions(){this.flushRoles(),this.permissionsService.flushPermissions()}removeRole(e){let t=m({},this.rolesSource.value);delete t[e],this.rolesSource.next(t)}getRoles(){return this.rolesSource.value}getRole(e){return this.rolesSource.value[e]}hasOnlyRoles(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),Promise.all([this.hasRoleKey(e),this.hasRolePermission(this.rolesSource.value,e)]).then(([i,n])=>i||n))}hasRoleKey(e){let t=e.map(i=>{if(!!this.rolesSource.value[i]&&!!this.rolesSource.value[i].validationFunction&&l(this.rolesSource.value[i].validationFunction)&&!ne(this.rolesSource.value[i].validationFunction)){let o=this.rolesSource.value[i].validationFunction,h=m({},this.rolesSource.value);return c(null).pipe(v(()=>o(i,h)),j(x=>R(x)?c(x):x),F(()=>c(!1)))}return c(!1)});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasRolePermission(e,t){return f(t).pipe(p(i=>e[i]&&Array.isArray(e[i].validationFunction)?f(e[i].validationFunction).pipe(p(n=>this.permissionsService.hasPermission(n)),G(n=>n===!0)):c(!1)),S(i=>i===!0,!1)).toPromise()}};r.\u0275fac=function(t){return new(t||r)(d(N),d(k),d(E))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),Pe=(()=>{let r=class r{constructor(){this.permissionsAuthorized=new W,this.permissionsUnauthorized=new W,this.firstMergeUnusedRun=1,this.permissionsService=P(E),this.configurationService=P(B),this.rolesService=P(b),this.viewContainer=P(X),this.changeDetector=P(Q),this.templateRef=P(_)}ngOnInit(){this.viewContainer.clear(),this.initPermissionSubscription=this.validateExceptOnlyPermissions()}ngOnChanges(e){let t=e.ngxPermissionsOnly,i=e.ngxPermissionsExcept;if(t||i){if(t&&t.firstChange||i&&i.firstChange)return;z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun),H(1)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}}ngOnDestroy(){this.initPermissionSubscription&&this.initPermissionSubscription.unsubscribe()}validateExceptOnlyPermissions(){return z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}validateExceptAndOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsExcept),this.rolesService.hasOnlyRoles(this.ngxPermissionsExcept)]).then(([e,t])=>{if(e||t){this.handleUnauthorisedPermission(this.ngxPermissionsExceptElse||this.ngxPermissionsElse);return}if(this.ngxPermissionsOnly)throw!1;this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)}).catch(()=>{this.ngxPermissionsOnly?this.validateOnlyPermissions():this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)})}validateOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsOnly),this.rolesService.hasOnlyRoles(this.ngxPermissionsOnly)]).then(([e,t])=>{e||t?this.handleAuthorisedPermission(this.ngxPermissionsOnlyThen||this.ngxPermissionsThen||this.templateRef):this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)}).catch(()=>{this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)})}handleUnauthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&!this.currentAuthorizedState)){if(this.currentAuthorizedState=!1,this.permissionsUnauthorized.emit(),this.getUnAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getUnAuthorizedStrategyInput());return}this.configurationService.onUnAuthorisedDefaultStrategy&&!this.elseBlockDefined()?this.applyStrategy(this.configurationService.onUnAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}handleAuthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&this.currentAuthorizedState)){if(this.currentAuthorizedState=!0,this.permissionsAuthorized.emit(),this.getAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getAuthorizedStrategyInput());return}this.configurationService.onAuthorisedDefaultStrategy&&!this.thenBlockDefined()?this.applyStrategy(this.configurationService.onAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}applyStrategyAccordingToStrategyType(e){if(se(e)){this.applyStrategy(e);return}if(l(e)){this.showTemplateBlockInView(this.templateRef),e(this.templateRef);return}}showTemplateBlockInView(e){this.viewContainer.clear(),e&&(this.viewContainer.createEmbeddedView(e),this.changeDetector.markForCheck())}getAuthorisedTemplates(){return this.ngxPermissionsOnlyThen||this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef}elseBlockDefined(){return!!this.ngxPermissionsExceptElse||!!this.ngxPermissionsElse}thenBlockDefined(){return!!this.ngxPermissionsExceptThen||!!this.ngxPermissionsThen}getAuthorizedStrategyInput(){return this.ngxPermissionsOnlyAuthorisedStrategy||this.ngxPermissionsExceptAuthorisedStrategy||this.ngxPermissionsAuthorisedStrategy}getUnAuthorizedStrategyInput(){return this.ngxPermissionsOnlyUnauthorisedStrategy||this.ngxPermissionsExceptUnauthorisedStrategy||this.ngxPermissionsUnauthorisedStrategy}applyStrategy(e){if(e===D.SHOW){this.showTemplateBlockInView(this.templateRef);return}if(e===D.REMOVE){this.viewContainer.clear();return}let t=this.configurationService.getStrategy(e);this.showTemplateBlockInView(this.templateRef),t(this.templateRef)}};r.\u0275fac=function(t){return new(t||r)},r.\u0275dir=J({type:r,selectors:[["","ngxPermissionsOnly",""],["","ngxPermissionsExcept",""]],inputs:{ngxPermissionsOnly:"ngxPermissionsOnly",ngxPermissionsOnlyThen:"ngxPermissionsOnlyThen",ngxPermissionsOnlyElse:"ngxPermissionsOnlyElse",ngxPermissionsExcept:"ngxPermissionsExcept",ngxPermissionsExceptElse:"ngxPermissionsExceptElse",ngxPermissionsExceptThen:"ngxPermissionsExceptThen",ngxPermissionsThen:"ngxPermissionsThen",ngxPermissionsElse:"ngxPermissionsElse",ngxPermissionsOnlyAuthorisedStrategy:"ngxPermissionsOnlyAuthorisedStrategy",ngxPermissionsOnlyUnauthorisedStrategy:"ngxPermissionsOnlyUnauthorisedStrategy",ngxPermissionsExceptUnauthorisedStrategy:"ngxPermissionsExceptUnauthorisedStrategy",ngxPermissionsExceptAuthorisedStrategy:"ngxPermissionsExceptAuthorisedStrategy",ngxPermissionsUnauthorisedStrategy:"ngxPermissionsUnauthorisedStrategy",ngxPermissionsAuthorisedStrategy:"ngxPermissionsAuthorisedStrategy"},outputs:{permissionsAuthorized:"permissionsAuthorized",permissionsUnauthorized:"permissionsUnauthorized"},features:[q]});let s=r;return s})(),oe="default";var te=(()=>{let r=class r{constructor(e,t,i){this.permissionsService=e,this.rolesService=t,this.router=i}canActivate(e,t){return this.hasPermissions(e,t)}canActivateChild(e,t){return this.hasPermissions(e,t)}canLoad(e){return this.hasPermissions(e)}canMatch(e){return this.hasPermissions(e)}hasPermissions(e,t){let i=e&&e.data?e.data.permissions:{},n=this.transformPermission(i,e,t);return this.isParameterAvailable(n.except)?this.passingExceptPermissionsValidation(n,e,t):this.isParameterAvailable(n.only)?this.passingOnlyPermissionsValidation(n,e,t):!0}transformPermission(e,t,i){let n=l(e.only)?e.only(t,i):w(e.only),o=l(e.except)?e.except(t,i):w(e.except),h=e.redirectTo;return{only:n,except:o,redirectTo:h}}isParameterAvailable(e){return!!e&&e.length>0}passingExceptPermissionsValidation(e,t,i){if(e.redirectTo&&(l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo))){let n="";return f(e.except).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)||(n=o)}))),S(o=>o.some(h=>h===!0),!1),p(o=>n?(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):!o&&e.only?this.onlyRedirectCheck(e,t,i):c(!o))).toPromise()}return Promise.all([this.permissionsService.hasPermission(e.except),this.rolesService.hasOnlyRoles(e.except)]).then(([n,o])=>n||o?(e.redirectTo&&this.redirectToAnotherRoute(e.redirectTo,t,i),!1):e.only?this.checkOnlyPermissions(e,t,i):!0)}redirectToAnotherRoute(e,t,i,n){let o=l(e)?e(n,t,i):e;if(this.isRedirectionWithParameters(o)){o.navigationCommands=this.transformNavigationCommands(o.navigationCommands,t,i),o.navigationExtras=this.transformNavigationExtras(o.navigationExtras,t,i),this.router.navigate(o.navigationCommands,o.navigationExtras);return}Array.isArray(o)?this.router.navigate(o):this.router.navigate([o])}isRedirectionWithParameters(e){return K(e)&&(!!e.navigationCommands||!!e.navigationExtras)}transformNavigationCommands(e,t,i){return l(e)?e(t,i):e}transformNavigationExtras(e,t,i){return l(e)?e(t,i):e}onlyRedirectCheck(e,t,i){let n="";return f(e.only).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)&&(n=o)}))),S(o=>l(e.redirectTo)?o.some(h=>h===!0):o.every(h=>h===!1),!1),p(o=>l(e.redirectTo)?o?c(!0):(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):(n&&this.handleRedirectOfFailedPermission(e,n,t,i),c(!o)))).toPromise()}handleRedirectOfFailedPermission(e,t,i,n){this.isFailedPermissionPropertyOfRedirectTo(e,t)?this.redirectToAnotherRoute(e.redirectTo[t],i,n,t):l(e.redirectTo)?this.redirectToAnotherRoute(e.redirectTo,i,n,t):this.redirectToAnotherRoute(e.redirectTo[oe],i,n,t)}isFailedPermissionPropertyOfRedirectTo(e,t){return!!e.redirectTo&&e.redirectTo[t]}checkOnlyPermissions(e,t,i){let n=m({},e);return Promise.all([this.permissionsService.hasPermission(n.only),this.rolesService.hasOnlyRoles(n.only)]).then(([o,h])=>o||h?!0:(n.redirectTo&&this.redirectToAnotherRoute(n.redirectTo,t,i),!1))}passingOnlyPermissionsValidation(e,t,i){return l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo)?this.onlyRedirectCheck(e,t,i):this.checkOnlyPermissions(e,t,i)}};r.\u0275fac=function(t){return new(t||r)(d(E),d(b),d(ee))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();var Se=(()=>{let r=class r{static forRoot(e={}){return{ngModule:r,providers:[re,k,ie,E,te,b,B,{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate}]}}static forChild(e={}){return{ngModule:r,providers:[{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate},B,E,b,te]}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=Z({type:r}),r.\u0275inj=Y({});let s=r;return s})();var u=function(s){return s.SHOOPE="https://res.cloudinary.com/pos/image/upload/v1598262220/icons/marketplace_icons/shopee.png",s.WOOCOMMERCE="https://res.cloudinary.com/pos/image/upload/w_50/v1632447439/icons/WooCommerce/woocommerce-icon.webp",s.TOKOPEDIA="https://res.cloudinary.com/pos/image/upload/v1598262221/icons/marketplace_icons/tokopedia.png",s.TIKTOK="https://res.cloudinary.com/pos/image/upload/w_30/v1645761611/icons/Marketplace%20logo/tiktok.png",s.LAZADA="https://res.cloudinary.com/pos/image/upload/v1680681836/icons/marketplace_icons/Lazadanew.png",s.KALCARE="https://res.cloudinary.com/pos/image/upload/v1654230268/icons/marketplace_icons/kalcare.png",s.SHOPIFY="https://res.cloudinary.com/pos/image/upload/v1707987435/icons/marketplace_icons/shopify.png",s}(u||{});var a=function(s){return s[s.Tokopedia=1]="Tokopedia",s[s.WooCommerce=2]="WooCommerce",s[s.None=3]="None",s[s.KalCare=4]="KalCare",s[s.Shopee=5]="Shopee",s[s.Tiktok=6]="Tiktok",s[s.Lazada=7]="Lazada",s[s.Shopify=8]="Shopify",s}(a||{});var De=(()=>{let r=class r{static IsNotEmpty(e){return e!=""&&e!=r.GuidEMpty&&e!=null&&e!=null}static IsEmpty(e){return e==""||e==null||e==null||e==r.GuidEMpty}static getChannelLogoByTypeId(e){let t;switch(e){case a.Tokopedia:t=u.TOKOPEDIA;break;case a.Shopee:t=u.SHOOPE;break;case a.WooCommerce:t=u.WOOCOMMERCE;break;case a.Lazada:t=u.LAZADA;break;case a.Tiktok:t=u.TIKTOK;break;case a.KalCare:t=u.KALCARE;break;case a.Shopify:t=u.SHOPIFY;break}return t}static getChannelLogoByName(e=""){e=e.toLowerCase();let t;switch(e){case"tokopedia":t=u.TOKOPEDIA;break;case"shoppe":t=u.SHOOPE;break;case"woocommerce":t=u.WOOCOMMERCE;break;case"tiktok":t=u.TIKTOK;break;case"lazada":t=u.LAZADA;break;case"kalCare":t=u.KALCARE;break}return t}static getChannelName(e){let t;switch(e){case a.Shopee:t="Shopee";break;case a.Tokopedia:t="Tokopedia";break;case a.Lazada:t="Lazada";break;case a.Tiktok:t="Tiktok";break;case a.WooCommerce:t="WooCommerce";break;case a.KalCare:t="WooCommerce";break}return t}static assignChannelLogo(e){return e=e.map(t=>(t.logo=this.getChannelLogoByTypeId(t.TypeID),t)),e}static getCssChannelColor(e){let t;switch(e){case a.Shopee:t="#ee4d2d";break;case a.Tokopedia:t="var(--G500,#03AC0E)";break;case a.Lazada:t="#FF00B2";break;case a.Tiktok:t="black";break;case a.WooCommerce:t="#674399";break;case a.KalCare:t="rgb(128, 188, 0)";break}return t}static getDaysDiff(e,t){var i=t.getTime()-e.getTime(),n=i/(1e3*60*60*24);return n}static addDays(e,t){let i=new Date(Number(e));return i.setDate(e.getDate()-t),i}static isValidDate(e){return e instanceof Date&&!isNaN(e)}static getImageInfo(e){return new Promise((t,i)=>{let n=new Image;n.src=e,n.decode().then(()=>{t({img:e,height:n.height,width:n.width})}).catch(()=>{i(new Error(`Image load error for ${e}`))})})}static formatTitleFromDate(e,t){let i=null,n=new Date(e),o=new Date(t);return n.getDate()!=o.getDate()&&(i="dd"),n.getMonth()!=o.getMonth()&&(i="dd MMM"),n.getFullYear()!=o.getFullYear()&&(i="dd MMM yyyy"),i}static openDownloadFile(e,t){var i=window.URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,n.click()}static compare(e,t,i){return(e<t?-1:1)*(i?1:-1)}static isDateExpired(e){let t=new Date,i=!1;return e.getTime()<t.getTime()&&(i=!0),i}};r.GuidEMpty="00000000-0000-0000-0000-000000000000",r.MinDate="0001-01-01T00:00:00";let s=r;return s})();export{u as a,a as b,De as c,E as d,Pe as e,Se as f};
1
+ import{$ as y,A as z,E as F,I as H,Ja as Q,Jb as _,L as G,La as W,N as S,R as C,T as j,Va as X,X as V,aa as Y,ba as A,ca as d,d as g,da as P,fa as Z,ga as J,ia as q,m as f,n as c,q as v,s as p,t as I,w as M,xc as ee}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.3/Marketplace/chunk-YNZUWVLD.js";import{a as m,b as O}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.3/Marketplace/chunk-QMX3UB7H.js";var D={REMOVE:"remove",SHOW:"show"},ie=(()=>{let r=class r{constructor(){this.strategiesSource=new g({}),this.strategies$=this.strategiesSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),L=new A("USE_CONFIGURATION_STORE"),B=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.configurationStore=t,this.strategiesSource=this.isolate?new g({}):this.configurationStore.strategiesSource,this.strategies$=this.strategiesSource.asObservable(),this.onAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onAuthorisedDefaultStrategy,this.onUnAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onUnAuthorisedDefaultStrategy}setDefaultOnAuthorizedStrategy(e){this.isolate?this.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onAuthorisedDefaultStrategy=this.configurationStore.onAuthorisedDefaultStrategy)}setDefaultOnUnauthorizedStrategy(e){this.isolate?this.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onUnAuthorisedDefaultStrategy=this.configurationStore.onUnAuthorisedDefaultStrategy)}addPermissionStrategy(e,t){this.strategiesSource.value[e]=t}getStrategy(e){return this.strategiesSource.value[e]}getAllStrategies(){return this.strategiesSource.value}getDefinedStrategy(e){if(this.strategiesSource.value[e]||this.isPredefinedStrategy(e))return e;throw new Error(`No ' ${e} ' strategy is found please define one`)}isPredefinedStrategy(e){return e===D.SHOW||e===D.REMOVE}};r.\u0275fac=function(t){return new(t||r)(d(L),d(ie))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();function l(s){return typeof s=="function"}function K(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;{let r=Object.getPrototypeOf(s);return r===null||r===Object.prototype}}function se(s){return!!s&&typeof s=="string"}function R(s){return typeof s=="boolean"}function ne(s){return Object.prototype.toString.call(s)==="[object Promise]"}function T(s){return Array.isArray(s)?s.length>0:!!s}function w(s){return se(s)?[s]:s}var re=(()=>{let r=class r{constructor(){this.permissionsSource=new g({}),this.permissions$=this.permissionsSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),$=new A("USE_PERMISSIONS_STORE"),E=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.permissionsStore=t,this.permissionsSource=this.isolate?new g({}):this.permissionsStore.permissionsSource,this.permissions$=this.permissionsSource.asObservable()}flushPermissions(){this.permissionsSource.next({})}hasPermission(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),this.hasArrayPermission(e))}loadPermissions(e,t){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),{});this.permissionsSource.next(i)}addPermission(e,t){if(Array.isArray(e)){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),this.permissionsSource.value);this.permissionsSource.next(i)}else{let i=this.reducePermission(this.permissionsSource.value,e,t);this.permissionsSource.next(i)}}removePermission(e){let t=m({},this.permissionsSource.value);delete t[e],this.permissionsSource.next(t)}getPermission(e){return this.permissionsSource.value[e]}getPermissions(){return this.permissionsSource.value}reducePermission(e,t,i){return i&&l(i)?O(m({},e),{[t]:{name:t,validationFunction:i}}):O(m({},e),{[t]:{name:t}})}hasArrayPermission(e){let t=e.map(i=>{if(this.hasPermissionValidationFunction(i)){let n=this.permissionsSource.value[i].validationFunction,o=m({},this.permissionsSource.value);return c(null).pipe(v(()=>n(i,o)),j(h=>R(h)?c(h):h),F(()=>c(!1)))}return c(!!this.permissionsSource.value[i])});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasPermissionValidationFunction(e){return!!this.permissionsSource.value[e]&&!!this.permissionsSource.value[e].validationFunction&&l(this.permissionsSource.value[e].validationFunction)}};r.\u0275fac=function(t){return new(t||r)(d($),d(re))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),k=class{constructor(){this.rolesSource=new g({}),this.roles$=this.rolesSource.asObservable()}},N=new A("USE_ROLES_STORE"),b=(()=>{let r=class r{constructor(e=!1,t,i){this.isolate=e,this.rolesStore=t,this.permissionsService=i,this.rolesSource=this.isolate?new g({}):this.rolesStore.rolesSource,this.roles$=this.rolesSource.asObservable()}addRole(e,t){let i=O(m({},this.rolesSource.value),{[e]:{name:e,validationFunction:t}});this.rolesSource.next(i)}addRoleWithPermissions(e,t){this.permissionsService.addPermission(t),this.addRole(e,t)}addRoles(e){Object.keys(e).forEach((t,i)=>{this.addRole(t,e[t])})}addRolesWithPermissions(e){Object.keys(e).forEach((t,i)=>{this.addRoleWithPermissions(t,e[t])})}flushRoles(){this.rolesSource.next({})}flushRolesAndPermissions(){this.flushRoles(),this.permissionsService.flushPermissions()}removeRole(e){let t=m({},this.rolesSource.value);delete t[e],this.rolesSource.next(t)}getRoles(){return this.rolesSource.value}getRole(e){return this.rolesSource.value[e]}hasOnlyRoles(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),Promise.all([this.hasRoleKey(e),this.hasRolePermission(this.rolesSource.value,e)]).then(([i,n])=>i||n))}hasRoleKey(e){let t=e.map(i=>{if(!!this.rolesSource.value[i]&&!!this.rolesSource.value[i].validationFunction&&l(this.rolesSource.value[i].validationFunction)&&!ne(this.rolesSource.value[i].validationFunction)){let o=this.rolesSource.value[i].validationFunction,h=m({},this.rolesSource.value);return c(null).pipe(v(()=>o(i,h)),j(x=>R(x)?c(x):x),F(()=>c(!1)))}return c(!1)});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasRolePermission(e,t){return f(t).pipe(p(i=>e[i]&&Array.isArray(e[i].validationFunction)?f(e[i].validationFunction).pipe(p(n=>this.permissionsService.hasPermission(n)),G(n=>n===!0)):c(!1)),S(i=>i===!0,!1)).toPromise()}};r.\u0275fac=function(t){return new(t||r)(d(N),d(k),d(E))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),Pe=(()=>{let r=class r{constructor(){this.permissionsAuthorized=new W,this.permissionsUnauthorized=new W,this.firstMergeUnusedRun=1,this.permissionsService=P(E),this.configurationService=P(B),this.rolesService=P(b),this.viewContainer=P(X),this.changeDetector=P(Q),this.templateRef=P(_)}ngOnInit(){this.viewContainer.clear(),this.initPermissionSubscription=this.validateExceptOnlyPermissions()}ngOnChanges(e){let t=e.ngxPermissionsOnly,i=e.ngxPermissionsExcept;if(t||i){if(t&&t.firstChange||i&&i.firstChange)return;z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun),H(1)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}}ngOnDestroy(){this.initPermissionSubscription&&this.initPermissionSubscription.unsubscribe()}validateExceptOnlyPermissions(){return z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}validateExceptAndOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsExcept),this.rolesService.hasOnlyRoles(this.ngxPermissionsExcept)]).then(([e,t])=>{if(e||t){this.handleUnauthorisedPermission(this.ngxPermissionsExceptElse||this.ngxPermissionsElse);return}if(this.ngxPermissionsOnly)throw!1;this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)}).catch(()=>{this.ngxPermissionsOnly?this.validateOnlyPermissions():this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)})}validateOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsOnly),this.rolesService.hasOnlyRoles(this.ngxPermissionsOnly)]).then(([e,t])=>{e||t?this.handleAuthorisedPermission(this.ngxPermissionsOnlyThen||this.ngxPermissionsThen||this.templateRef):this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)}).catch(()=>{this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)})}handleUnauthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&!this.currentAuthorizedState)){if(this.currentAuthorizedState=!1,this.permissionsUnauthorized.emit(),this.getUnAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getUnAuthorizedStrategyInput());return}this.configurationService.onUnAuthorisedDefaultStrategy&&!this.elseBlockDefined()?this.applyStrategy(this.configurationService.onUnAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}handleAuthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&this.currentAuthorizedState)){if(this.currentAuthorizedState=!0,this.permissionsAuthorized.emit(),this.getAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getAuthorizedStrategyInput());return}this.configurationService.onAuthorisedDefaultStrategy&&!this.thenBlockDefined()?this.applyStrategy(this.configurationService.onAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}applyStrategyAccordingToStrategyType(e){if(se(e)){this.applyStrategy(e);return}if(l(e)){this.showTemplateBlockInView(this.templateRef),e(this.templateRef);return}}showTemplateBlockInView(e){this.viewContainer.clear(),e&&(this.viewContainer.createEmbeddedView(e),this.changeDetector.markForCheck())}getAuthorisedTemplates(){return this.ngxPermissionsOnlyThen||this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef}elseBlockDefined(){return!!this.ngxPermissionsExceptElse||!!this.ngxPermissionsElse}thenBlockDefined(){return!!this.ngxPermissionsExceptThen||!!this.ngxPermissionsThen}getAuthorizedStrategyInput(){return this.ngxPermissionsOnlyAuthorisedStrategy||this.ngxPermissionsExceptAuthorisedStrategy||this.ngxPermissionsAuthorisedStrategy}getUnAuthorizedStrategyInput(){return this.ngxPermissionsOnlyUnauthorisedStrategy||this.ngxPermissionsExceptUnauthorisedStrategy||this.ngxPermissionsUnauthorisedStrategy}applyStrategy(e){if(e===D.SHOW){this.showTemplateBlockInView(this.templateRef);return}if(e===D.REMOVE){this.viewContainer.clear();return}let t=this.configurationService.getStrategy(e);this.showTemplateBlockInView(this.templateRef),t(this.templateRef)}};r.\u0275fac=function(t){return new(t||r)},r.\u0275dir=J({type:r,selectors:[["","ngxPermissionsOnly",""],["","ngxPermissionsExcept",""]],inputs:{ngxPermissionsOnly:"ngxPermissionsOnly",ngxPermissionsOnlyThen:"ngxPermissionsOnlyThen",ngxPermissionsOnlyElse:"ngxPermissionsOnlyElse",ngxPermissionsExcept:"ngxPermissionsExcept",ngxPermissionsExceptElse:"ngxPermissionsExceptElse",ngxPermissionsExceptThen:"ngxPermissionsExceptThen",ngxPermissionsThen:"ngxPermissionsThen",ngxPermissionsElse:"ngxPermissionsElse",ngxPermissionsOnlyAuthorisedStrategy:"ngxPermissionsOnlyAuthorisedStrategy",ngxPermissionsOnlyUnauthorisedStrategy:"ngxPermissionsOnlyUnauthorisedStrategy",ngxPermissionsExceptUnauthorisedStrategy:"ngxPermissionsExceptUnauthorisedStrategy",ngxPermissionsExceptAuthorisedStrategy:"ngxPermissionsExceptAuthorisedStrategy",ngxPermissionsUnauthorisedStrategy:"ngxPermissionsUnauthorisedStrategy",ngxPermissionsAuthorisedStrategy:"ngxPermissionsAuthorisedStrategy"},outputs:{permissionsAuthorized:"permissionsAuthorized",permissionsUnauthorized:"permissionsUnauthorized"},features:[q]});let s=r;return s})(),oe="default";var te=(()=>{let r=class r{constructor(e,t,i){this.permissionsService=e,this.rolesService=t,this.router=i}canActivate(e,t){return this.hasPermissions(e,t)}canActivateChild(e,t){return this.hasPermissions(e,t)}canLoad(e){return this.hasPermissions(e)}canMatch(e){return this.hasPermissions(e)}hasPermissions(e,t){let i=e&&e.data?e.data.permissions:{},n=this.transformPermission(i,e,t);return this.isParameterAvailable(n.except)?this.passingExceptPermissionsValidation(n,e,t):this.isParameterAvailable(n.only)?this.passingOnlyPermissionsValidation(n,e,t):!0}transformPermission(e,t,i){let n=l(e.only)?e.only(t,i):w(e.only),o=l(e.except)?e.except(t,i):w(e.except),h=e.redirectTo;return{only:n,except:o,redirectTo:h}}isParameterAvailable(e){return!!e&&e.length>0}passingExceptPermissionsValidation(e,t,i){if(e.redirectTo&&(l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo))){let n="";return f(e.except).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)||(n=o)}))),S(o=>o.some(h=>h===!0),!1),p(o=>n?(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):!o&&e.only?this.onlyRedirectCheck(e,t,i):c(!o))).toPromise()}return Promise.all([this.permissionsService.hasPermission(e.except),this.rolesService.hasOnlyRoles(e.except)]).then(([n,o])=>n||o?(e.redirectTo&&this.redirectToAnotherRoute(e.redirectTo,t,i),!1):e.only?this.checkOnlyPermissions(e,t,i):!0)}redirectToAnotherRoute(e,t,i,n){let o=l(e)?e(n,t,i):e;if(this.isRedirectionWithParameters(o)){o.navigationCommands=this.transformNavigationCommands(o.navigationCommands,t,i),o.navigationExtras=this.transformNavigationExtras(o.navigationExtras,t,i),this.router.navigate(o.navigationCommands,o.navigationExtras);return}Array.isArray(o)?this.router.navigate(o):this.router.navigate([o])}isRedirectionWithParameters(e){return K(e)&&(!!e.navigationCommands||!!e.navigationExtras)}transformNavigationCommands(e,t,i){return l(e)?e(t,i):e}transformNavigationExtras(e,t,i){return l(e)?e(t,i):e}onlyRedirectCheck(e,t,i){let n="";return f(e.only).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)&&(n=o)}))),S(o=>l(e.redirectTo)?o.some(h=>h===!0):o.every(h=>h===!1),!1),p(o=>l(e.redirectTo)?o?c(!0):(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):(n&&this.handleRedirectOfFailedPermission(e,n,t,i),c(!o)))).toPromise()}handleRedirectOfFailedPermission(e,t,i,n){this.isFailedPermissionPropertyOfRedirectTo(e,t)?this.redirectToAnotherRoute(e.redirectTo[t],i,n,t):l(e.redirectTo)?this.redirectToAnotherRoute(e.redirectTo,i,n,t):this.redirectToAnotherRoute(e.redirectTo[oe],i,n,t)}isFailedPermissionPropertyOfRedirectTo(e,t){return!!e.redirectTo&&e.redirectTo[t]}checkOnlyPermissions(e,t,i){let n=m({},e);return Promise.all([this.permissionsService.hasPermission(n.only),this.rolesService.hasOnlyRoles(n.only)]).then(([o,h])=>o||h?!0:(n.redirectTo&&this.redirectToAnotherRoute(n.redirectTo,t,i),!1))}passingOnlyPermissionsValidation(e,t,i){return l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo)?this.onlyRedirectCheck(e,t,i):this.checkOnlyPermissions(e,t,i)}};r.\u0275fac=function(t){return new(t||r)(d(E),d(b),d(ee))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();var Se=(()=>{let r=class r{static forRoot(e={}){return{ngModule:r,providers:[re,k,ie,E,te,b,B,{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate}]}}static forChild(e={}){return{ngModule:r,providers:[{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate},B,E,b,te]}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=Z({type:r}),r.\u0275inj=Y({});let s=r;return s})();var u=function(s){return s.SHOOPE="https://res.cloudinary.com/pos/image/upload/v1598262220/icons/marketplace_icons/shopee.png",s.WOOCOMMERCE="https://res.cloudinary.com/pos/image/upload/w_50/v1632447439/icons/WooCommerce/woocommerce-icon.webp",s.TOKOPEDIA="https://res.cloudinary.com/pos/image/upload/v1598262221/icons/marketplace_icons/tokopedia.png",s.TIKTOK="https://res.cloudinary.com/pos/image/upload/w_30/v1645761611/icons/Marketplace%20logo/tiktok.png",s.LAZADA="https://res.cloudinary.com/pos/image/upload/v1680681836/icons/marketplace_icons/Lazadanew.png",s.KALCARE="https://res.cloudinary.com/pos/image/upload/v1654230268/icons/marketplace_icons/kalcare.png",s.SHOPIFY="https://res.cloudinary.com/pos/image/upload/v1707987435/icons/marketplace_icons/shopify.png",s}(u||{});var a=function(s){return s[s.Tokopedia=1]="Tokopedia",s[s.WooCommerce=2]="WooCommerce",s[s.None=3]="None",s[s.KalCare=4]="KalCare",s[s.Shopee=5]="Shopee",s[s.Tiktok=6]="Tiktok",s[s.Lazada=7]="Lazada",s[s.Shopify=8]="Shopify",s}(a||{});var De=(()=>{let r=class r{static IsNotEmpty(e){return e!=""&&e!=r.GuidEMpty&&e!=null&&e!=null}static IsEmpty(e){return e==""||e==null||e==null||e==r.GuidEMpty}static getChannelLogoByTypeId(e){let t;switch(e){case a.Tokopedia:t=u.TOKOPEDIA;break;case a.Shopee:t=u.SHOOPE;break;case a.WooCommerce:t=u.WOOCOMMERCE;break;case a.Lazada:t=u.LAZADA;break;case a.Tiktok:t=u.TIKTOK;break;case a.KalCare:t=u.KALCARE;break;case a.Shopify:t=u.SHOPIFY;break}return t}static getChannelLogoByName(e=""){e=e.toLowerCase();let t;switch(e){case"tokopedia":t=u.TOKOPEDIA;break;case"shoppe":t=u.SHOOPE;break;case"woocommerce":t=u.WOOCOMMERCE;break;case"tiktok":t=u.TIKTOK;break;case"lazada":t=u.LAZADA;break;case"kalCare":t=u.KALCARE;break}return t}static getChannelName(e){let t;switch(e){case a.Shopee:t="Shopee";break;case a.Tokopedia:t="Tokopedia";break;case a.Lazada:t="Lazada";break;case a.Tiktok:t="Tiktok";break;case a.WooCommerce:t="WooCommerce";break;case a.KalCare:t="WooCommerce";break}return t}static assignChannelLogo(e){return e=e.map(t=>(t.logo=this.getChannelLogoByTypeId(t.TypeID),t)),e}static getCssChannelColor(e){let t;switch(e){case a.Shopee:t="#ee4d2d";break;case a.Tokopedia:t="var(--G500,#03AC0E)";break;case a.Lazada:t="#FF00B2";break;case a.Tiktok:t="black";break;case a.WooCommerce:t="#674399";break;case a.KalCare:t="rgb(128, 188, 0)";break}return t}static getDaysDiff(e,t){var i=t.getTime()-e.getTime(),n=i/(1e3*60*60*24);return n}static addDays(e,t){let i=new Date(Number(e));return i.setDate(e.getDate()-t),i}static isValidDate(e){return e instanceof Date&&!isNaN(e)}static getImageInfo(e){return new Promise((t,i)=>{let n=new Image;n.src=e,n.decode().then(()=>{t({img:e,height:n.height,width:n.width})}).catch(()=>{i(new Error(`Image load error for ${e}`))})})}static formatTitleFromDate(e,t){let i=null,n=new Date(e),o=new Date(t);return n.getDate()!=o.getDate()&&(i="dd"),n.getMonth()!=o.getMonth()&&(i="dd MMM"),n.getFullYear()!=o.getFullYear()&&(i="dd MMM yyyy"),i}static openDownloadFile(e,t){var i=window.URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,n.click()}static compare(e,t,i){return(e<t?-1:1)*(i?1:-1)}static isDateExpired(e){let t=new Date,i=!1;return e.getTime()<t.getTime()&&(i=!0),i}};r.GuidEMpty="00000000-0000-0000-0000-000000000000",r.MinDate="0001-01-01T00:00:00";let s=r;return s})();export{u as a,a as b,De as c,E as d,Pe as e,Se as f};