@wix/cli 1.1.51 → 1.1.52

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 (125) hide show
  1. package/build/DevCommand-74RYZYIJ.js +4 -0
  2. package/build/DevCommand-74RYZYIJ.js.map +1 -0
  3. package/build/DevCommand-LKSQSU4D.js +4 -0
  4. package/build/DevCommand-LKSQSU4D.js.map +1 -0
  5. package/build/LoginCommand-NYVD43UK.js +4 -0
  6. package/build/LoginCommand-NYVD43UK.js.map +1 -0
  7. package/build/{LogoutCommand-BDH3FYZO.js → LogoutCommand-S6XVACQ6.js} +2 -2
  8. package/build/{WhoamiCommand-5DMVQUBJ.js → WhoamiCommand-HOEXUJGJ.js} +2 -2
  9. package/build/{chunk-SEHFPYSE.js → chunk-4BTCJXQC.js} +3 -3
  10. package/build/chunk-4BTCJXQC.js.map +1 -0
  11. package/build/{chunk-TAWNBTSO.js → chunk-4NRHFR7Y.js} +2 -2
  12. package/build/chunk-6MEM22XR.js +15 -0
  13. package/build/chunk-6MEM22XR.js.map +1 -0
  14. package/build/chunk-7WD47GXQ.js +14 -0
  15. package/build/chunk-7WD47GXQ.js.map +1 -0
  16. package/build/chunk-A47ABA7B.js +4 -0
  17. package/build/chunk-A47ABA7B.js.map +1 -0
  18. package/build/chunk-B7EXWRCM.js +4 -0
  19. package/build/chunk-B7EXWRCM.js.map +1 -0
  20. package/build/{chunk-65R7SBZ5.js → chunk-E7Z3EVGI.js} +2 -2
  21. package/build/{chunk-62WSEYFO.js → chunk-EE5EBGQ7.js} +2 -2
  22. package/build/{chunk-5LAMPYWD.js → chunk-EFB2I2BN.js} +2 -2
  23. package/build/{chunk-67FBXKWP.js → chunk-FPM2JVPR.js} +2 -2
  24. package/build/{chunk-CLX2F62J.js → chunk-J4J4RXMY.js} +2 -2
  25. package/build/{chunk-KPKBCH3A.js → chunk-JGPN7XZF.js} +2 -2
  26. package/build/chunk-JYYNYTCQ.js +6 -0
  27. package/build/chunk-JYYNYTCQ.js.map +1 -0
  28. package/build/chunk-K3QK4XYS.js +4 -0
  29. package/build/chunk-K3QK4XYS.js.map +1 -0
  30. package/build/chunk-KOIVBNZR.js +4 -0
  31. package/build/chunk-KOIVBNZR.js.map +1 -0
  32. package/build/{chunk-ZUYRVEIZ.js → chunk-L2PG7C3H.js} +3 -3
  33. package/build/{chunk-ZUYRVEIZ.js.map → chunk-L2PG7C3H.js.map} +1 -1
  34. package/build/chunk-L434E44T.js +138 -0
  35. package/build/chunk-L434E44T.js.map +1 -0
  36. package/build/chunk-R5TGEMJ4.js +4 -0
  37. package/build/chunk-R5TGEMJ4.js.map +1 -0
  38. package/build/{chunk-SSWCDL27.js → chunk-SZ35DFLD.js} +2 -2
  39. package/build/{chunk-XALHWW5N.js → chunk-TCTTRAWM.js} +4 -4
  40. package/build/{chunk-XALHWW5N.js.map → chunk-TCTTRAWM.js.map} +1 -1
  41. package/build/chunk-TLPEI3DE.js +14 -0
  42. package/build/chunk-TLPEI3DE.js.map +1 -0
  43. package/build/chunk-WICGWF4N.js +4 -0
  44. package/build/chunk-WICGWF4N.js.map +1 -0
  45. package/build/{chunk-QF6TSJYM.js → chunk-X3AOPEF4.js} +10 -10
  46. package/build/{chunk-QF6TSJYM.js.map → chunk-X3AOPEF4.js.map} +1 -1
  47. package/build/{chunk-HUW5AFF4.js → chunk-ZNF7GN55.js} +55 -64
  48. package/build/chunk-ZNF7GN55.js.map +1 -0
  49. package/build/chunk-ZQFCZASC.js +4 -0
  50. package/build/chunk-ZQFCZASC.js.map +1 -0
  51. package/build/dev-D6J7EO7H.js +47 -0
  52. package/build/dev-D6J7EO7H.js.map +1 -0
  53. package/build/index.js +4 -4
  54. package/build/index.js.map +1 -1
  55. package/build/install-WHE5Y4BG.js +4 -0
  56. package/build/{install-NJBNFBOD.js.map → install-WHE5Y4BG.js.map} +1 -1
  57. package/build/preview-ODRKZ7BQ.js +4 -0
  58. package/build/{preview-VSGRFUDT.js.map → preview-ODRKZ7BQ.js.map} +1 -1
  59. package/build/publish-C25WIDKP.js +4 -0
  60. package/build/{publish-EFDBBZIG.js.map → publish-C25WIDKP.js.map} +1 -1
  61. package/build/render-command-7OROM33D.js +4 -0
  62. package/build/render-command-7OROM33D.js.map +1 -0
  63. package/build/render-command-UM6STUPA.js +4 -0
  64. package/build/render-command-UM6STUPA.js.map +1 -0
  65. package/build/render-command-YKD46BVP.js +4 -0
  66. package/build/{render-command-QET4UNDW.js.map → render-command-YKD46BVP.js.map} +1 -1
  67. package/build/run-command-YXYU45I7.js +4 -0
  68. package/build/{run-command-MUXW6NCE.js.map → run-command-YXYU45I7.js.map} +1 -1
  69. package/build/{src-CIS5W66F.js → src-7KKODZIY.js} +2 -2
  70. package/build/src-7O5FMLWB.js +4 -0
  71. package/build/{src-BDIASQJX.js → src-CJFU3UWU.js} +2 -2
  72. package/build/{src-XHN4LXC2.js → src-IFWA4LD7.js} +2 -2
  73. package/build/src-IFWA4LD7.js.map +1 -0
  74. package/build/{src-7P3E3KRD.js → src-QPWACH3J.js} +2 -2
  75. package/build/src-TBIN5XRV.js +4 -0
  76. package/build/sync-types-2XUVNMLY.js +4 -0
  77. package/build/uninstall-ZHKKF5EM.js +4 -0
  78. package/build/{uninstall-J6U52MG2.js.map → uninstall-ZHKKF5EM.js.map} +1 -1
  79. package/package.json +3 -2
  80. package/build/DevCommand-KZX52XHC.js +0 -4
  81. package/build/DevCommand-KZX52XHC.js.map +0 -1
  82. package/build/LoginCommand-3HPXSPXY.js +0 -4
  83. package/build/LoginCommand-3HPXSPXY.js.map +0 -1
  84. package/build/chunk-7INB74CI.js +0 -4
  85. package/build/chunk-7INB74CI.js.map +0 -1
  86. package/build/chunk-BQHRJORL.js +0 -14
  87. package/build/chunk-BQHRJORL.js.map +0 -1
  88. package/build/chunk-DGA2THYK.js +0 -4
  89. package/build/chunk-DGA2THYK.js.map +0 -1
  90. package/build/chunk-GP3K4JBG.js +0 -4
  91. package/build/chunk-GP3K4JBG.js.map +0 -1
  92. package/build/chunk-HUW5AFF4.js.map +0 -1
  93. package/build/chunk-JQMLRPCS.js +0 -6
  94. package/build/chunk-JQMLRPCS.js.map +0 -1
  95. package/build/chunk-JTNRSVEB.js +0 -14
  96. package/build/chunk-JTNRSVEB.js.map +0 -1
  97. package/build/chunk-SEHFPYSE.js.map +0 -1
  98. package/build/dev-WESRS2HF.js +0 -179
  99. package/build/dev-WESRS2HF.js.map +0 -1
  100. package/build/install-NJBNFBOD.js +0 -4
  101. package/build/preview-VSGRFUDT.js +0 -4
  102. package/build/publish-EFDBBZIG.js +0 -4
  103. package/build/render-command-QET4UNDW.js +0 -4
  104. package/build/render-command-RSY3LUDV.js +0 -4
  105. package/build/render-command-RSY3LUDV.js.map +0 -1
  106. package/build/run-command-MUXW6NCE.js +0 -4
  107. package/build/src-AFQDLVDX.js +0 -4
  108. package/build/sync-types-EKGKI3NN.js +0 -4
  109. package/build/uninstall-J6U52MG2.js +0 -4
  110. /package/build/{LogoutCommand-BDH3FYZO.js.map → LogoutCommand-S6XVACQ6.js.map} +0 -0
  111. /package/build/{WhoamiCommand-5DMVQUBJ.js.map → WhoamiCommand-HOEXUJGJ.js.map} +0 -0
  112. /package/build/{chunk-TAWNBTSO.js.map → chunk-4NRHFR7Y.js.map} +0 -0
  113. /package/build/{chunk-65R7SBZ5.js.map → chunk-E7Z3EVGI.js.map} +0 -0
  114. /package/build/{chunk-62WSEYFO.js.map → chunk-EE5EBGQ7.js.map} +0 -0
  115. /package/build/{chunk-5LAMPYWD.js.map → chunk-EFB2I2BN.js.map} +0 -0
  116. /package/build/{chunk-67FBXKWP.js.map → chunk-FPM2JVPR.js.map} +0 -0
  117. /package/build/{chunk-CLX2F62J.js.map → chunk-J4J4RXMY.js.map} +0 -0
  118. /package/build/{chunk-KPKBCH3A.js.map → chunk-JGPN7XZF.js.map} +0 -0
  119. /package/build/{chunk-SSWCDL27.js.map → chunk-SZ35DFLD.js.map} +0 -0
  120. /package/build/{src-7P3E3KRD.js.map → src-7KKODZIY.js.map} +0 -0
  121. /package/build/{src-AFQDLVDX.js.map → src-7O5FMLWB.js.map} +0 -0
  122. /package/build/{src-BDIASQJX.js.map → src-CJFU3UWU.js.map} +0 -0
  123. /package/build/{src-CIS5W66F.js.map → src-QPWACH3J.js.map} +0 -0
  124. /package/build/{src-XHN4LXC2.js.map → src-TBIN5XRV.js.map} +0 -0
  125. /package/build/{sync-types-EKGKI3NN.js.map → sync-types-2XUVNMLY.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as p,d as D,e as N}from"./chunk-SSWCDL27.js";import{a as m}from"./chunk-5LAMPYWD.js";import{a as P,d as y,e as _,f as d,j as h}from"./chunk-JQMLRPCS.js";import{f as w}from"./chunk-GP3K4JBG.js";import{a as k,b as v,c as R,d as x}from"./chunk-62WSEYFO.js";import{c as o,e as i}from"./chunk-XALHWW5N.js";import{i as s}from"./chunk-UO4ZAUJK.js";s();import j from"node:path";var U=async e=>R(j.join(e,"yarn.lock")),X=async e=>await U(e)?"yarn":"npm";s();s();var W={},I={};var Y={},$={};function q(e){var n={"api._api_base_domain_":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}],"editor._base_domain_":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}],"blocks._base_domain_":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}],"create.editorx":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}]};return y(Object.assign(e,{domainToMappings:n}))}function F(e){var n=d(Y,{}),t=n.toJSON,a=n.fromJSON,r=d($,{}).fromJSON;function c(g){var u=g.host,l=t(e),f={entityFqdn:"wix.velo.npm.v1.npm_package_info",method:"POST",methodFqn:"wix.velo.npm.v1.UserCodeNpmPackages.ResolveNpmDependencies",url:q({protoPath:"/v1/npm/resolve-dependencies",data:l,host:u}),data:l,transformResponse:r};return f}return c.fromReq=a,c.__isAmbassador=!0,c}function O(e){var n=d(W,{}),t=n.toJSON,a=n.fromJSON,r=d(I,{}).fromJSON;function c(g){var u=g.host,l=t(e),f={entityFqdn:"wix.velo.npm.v1.npm_package_info",method:"GET",methodFqn:"wix.velo.npm.v1.UserCodeNpmPackages.GetResolveNpmDependenciesResult",url:q({protoPath:"/v1/npm/resolve-dependencies/{jobId}",data:l,host:u}),params:_(l),transformResponse:r};return f}return c.fromReq=a,c.__isAmbassador=!0,c}s();import{join as J}from"node:path";async function C(e){let n=J(e,"package.json"),t=await v(n);return Object.entries(t.dependencies??{}).map(([a,r])=>({name:a,version:r}))}async function ie(e,n){let t=J(e,"package.json"),a=await v(t);if(a.dependencies&&Object.keys(a.dependencies).length>0)throw new o({code:i.FailedMigrationToAnyNpm()});a.dependencies={},Object.keys(n.dependencies).forEach(r=>{a.devDependencies?.[r]&&delete a.devDependencies[r],a.dependencies[r]=n.dependencies[r]}),await k(t,a)}s();import{join as z}from"node:path";async function S(e,n){let t=z(e,w);try{await x(t,n)}catch(a){throw new o({code:i.FailedToWriteWixLock(),cause:a})}}var V=async(e,{authState:n})=>h(async()=>{try{let{data:t}=await m({type:"editor",authState:n},O({jobId:e})),a=N.parse(t);return h.resolveWith({wixLockFileUrl:a.result.npmDependenciesLockFile})}catch(t){if(P(t)&&t.response?.status===428)return!1;throw new o({code:i.FailedToGetResolveNpmDependenciesResult(),cause:t})}},{interval:3*1e3,timeout:2*60*1e3}),G=async(e,n)=>{let t=await m({type:"standalone"},{url:e});return S(n,t.data)},_e=async(e,{authState:n})=>{try{let t=await C(e),{data:a}=await m({type:"editor",authState:n},F({npmPackageInfos:t})),{jobId:r}=D.parse(a),{wixLockFileUrl:c}=await V(r,{authState:n});await G(c,e)}catch(t){throw new o({code:i.FailedToResolveNpmDependencies(),cause:t})}};s();s();var A=async(e,n,t)=>{let a=["add",`${e}${n?`@${n}`:""}`];return p("yarn",a,{cwd:t})},T=(e,n)=>p("yarn",["remove",e],{cwd:n}),b=e=>p("yarn",["install"],{cwd:e});s();var E=async(e,n,t)=>{let a=["install",`${e}${n?`@${n}`:""}`];return p("npm",a,{cwd:t})},L=(e,n)=>p("npm",["uninstall",e],{cwd:n}),M=e=>p("npm",["install"],{cwd:e});var Ee=async(e,n,t,a)=>{try{a==="yarn"?await A(e,n,t):await E(e,n,t)}catch(r){throw new o({code:i.FailedToInstallPackage({packageName:e,cause:r}),cause:r})}},Le=async(e,n,t)=>{try{t==="yarn"?await T(e,n):await L(e,n)}catch(a){throw new o({code:i.FailedToUninstallPackage({packageName:e,cause:a}),cause:a})}},Me=async(e,n)=>{try{n==="yarn"?await b(e):await M(e)}catch(t){throw new o({code:i.FailedToInstallPackages({cause:t}),cause:t})}};export{X as a,ie as b,_e as c,Ee as d,Le as e,Me as f};
4
- //# sourceMappingURL=chunk-TAWNBTSO.js.map
3
+ import{a as p,d as D,e as N}from"./chunk-SZ35DFLD.js";import{a as m}from"./chunk-EFB2I2BN.js";import{a as P,d as y,e as _,f as d,j as h}from"./chunk-JYYNYTCQ.js";import{f as w}from"./chunk-WICGWF4N.js";import{a as k,b as v,c as R,d as x}from"./chunk-EE5EBGQ7.js";import{c as o,e as i}from"./chunk-TCTTRAWM.js";import{i as s}from"./chunk-UO4ZAUJK.js";s();import j from"node:path";var U=async e=>R(j.join(e,"yarn.lock")),X=async e=>await U(e)?"yarn":"npm";s();s();var W={},I={};var Y={},$={};function q(e){var n={"api._api_base_domain_":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}],"editor._base_domain_":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}],"blocks._base_domain_":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}],"create.editorx":[{srcPath:"/wix-code-user-code-dependencies",destPath:""}]};return y(Object.assign(e,{domainToMappings:n}))}function F(e){var n=d(Y,{}),t=n.toJSON,a=n.fromJSON,r=d($,{}).fromJSON;function c(g){var u=g.host,l=t(e),f={entityFqdn:"wix.velo.npm.v1.npm_package_info",method:"POST",methodFqn:"wix.velo.npm.v1.UserCodeNpmPackages.ResolveNpmDependencies",url:q({protoPath:"/v1/npm/resolve-dependencies",data:l,host:u}),data:l,transformResponse:r};return f}return c.fromReq=a,c.__isAmbassador=!0,c}function O(e){var n=d(W,{}),t=n.toJSON,a=n.fromJSON,r=d(I,{}).fromJSON;function c(g){var u=g.host,l=t(e),f={entityFqdn:"wix.velo.npm.v1.npm_package_info",method:"GET",methodFqn:"wix.velo.npm.v1.UserCodeNpmPackages.GetResolveNpmDependenciesResult",url:q({protoPath:"/v1/npm/resolve-dependencies/{jobId}",data:l,host:u}),params:_(l),transformResponse:r};return f}return c.fromReq=a,c.__isAmbassador=!0,c}s();import{join as J}from"node:path";async function C(e){let n=J(e,"package.json"),t=await v(n);return Object.entries(t.dependencies??{}).map(([a,r])=>({name:a,version:r}))}async function ie(e,n){let t=J(e,"package.json"),a=await v(t);if(a.dependencies&&Object.keys(a.dependencies).length>0)throw new o({code:i.FailedMigrationToAnyNpm()});a.dependencies={},Object.keys(n.dependencies).forEach(r=>{a.devDependencies?.[r]&&delete a.devDependencies[r],a.dependencies[r]=n.dependencies[r]}),await k(t,a)}s();import{join as z}from"node:path";async function S(e,n){let t=z(e,w);try{await x(t,n)}catch(a){throw new o({code:i.FailedToWriteWixLock(),cause:a})}}var V=async(e,{authState:n})=>h(async()=>{try{let{data:t}=await m({type:"editor",authState:n},O({jobId:e})),a=N.parse(t);return h.resolveWith({wixLockFileUrl:a.result.npmDependenciesLockFile})}catch(t){if(P(t)&&t.response?.status===428)return!1;throw new o({code:i.FailedToGetResolveNpmDependenciesResult(),cause:t})}},{interval:3*1e3,timeout:2*60*1e3}),G=async(e,n)=>{let t=await m({type:"standalone"},{url:e});return S(n,t.data)},_e=async(e,{authState:n})=>{try{let t=await C(e),{data:a}=await m({type:"editor",authState:n},F({npmPackageInfos:t})),{jobId:r}=D.parse(a),{wixLockFileUrl:c}=await V(r,{authState:n});await G(c,e)}catch(t){throw new o({code:i.FailedToResolveNpmDependencies(),cause:t})}};s();s();var A=async(e,n,t)=>{let a=["add",`${e}${n?`@${n}`:""}`];return p("yarn",a,{cwd:t})},T=(e,n)=>p("yarn",["remove",e],{cwd:n}),b=e=>p("yarn",["install"],{cwd:e});s();var E=async(e,n,t)=>{let a=["install",`${e}${n?`@${n}`:""}`];return p("npm",a,{cwd:t})},L=(e,n)=>p("npm",["uninstall",e],{cwd:n}),M=e=>p("npm",["install"],{cwd:e});var Ee=async(e,n,t,a)=>{try{a==="yarn"?await A(e,n,t):await E(e,n,t)}catch(r){throw new o({code:i.FailedToInstallPackage({packageName:e,cause:r}),cause:r})}},Le=async(e,n,t)=>{try{t==="yarn"?await T(e,n):await L(e,n)}catch(a){throw new o({code:i.FailedToUninstallPackage({packageName:e,cause:a}),cause:a})}},Me=async(e,n)=>{try{n==="yarn"?await b(e):await M(e)}catch(t){throw new o({code:i.FailedToInstallPackages({cause:t}),cause:t})}};export{X as a,ie as b,_e as c,Ee as d,Le as e,Me as f};
4
+ //# sourceMappingURL=chunk-4NRHFR7Y.js.map
@@ -0,0 +1,15 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{c,i as f}from"./chunk-UO4ZAUJK.js";var T=c((hr,y)=>{"use strict";f();y.exports=w;y.exports.preferredCharsets=w;var z=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function B(t){for(var r=t.split(","),e=0,n=0;e<r.length;e++){var i=D(r[e].trim(),e);i&&(r[n++]=i)}return r.length=n,r}function D(t,r){var e=z.exec(t);if(!e)return null;var n=e[1],i=1;if(e[2])for(var a=e[2].split(";"),o=0;o<a.length;o++){var u=a[o].trim().split("=");if(u[0]==="q"){i=parseFloat(u[1]);break}}return{charset:n,q:i,i:r}}function G(t,r,e){for(var n={o:-1,q:0,s:0},i=0;i<r.length;i++){var a=H(t,r[i],e);a&&(n.s-a.s||n.q-a.q||n.o-a.o)<0&&(n=a)}return n}function H(t,r,e){var n=0;if(r.charset.toLowerCase()===t.toLowerCase())n|=1;else if(r.charset!=="*")return null;return{i:e,o:r.i,q:r.q,s:n}}function w(t,r){var e=B(t===void 0?"*":t||"");if(!r)return e.filter(L).sort(C).map(J);var n=r.map(function(a,o){return G(a,e,o)});return n.filter(L).sort(C).map(function(a){return r[n.indexOf(a)]})}function C(t,r){return r.q-t.q||r.s-t.s||t.o-r.o||t.i-r.i||0}function J(t){return t.charset}function L(t){return t.q>0}});var O=c((qr,v)=>{"use strict";f();v.exports=F;v.exports.preferredEncodings=F;var U=/^\s*([^\s;]+)\s*(?:;(.*))?$/;function W(t){for(var r=t.split(","),e=!1,n=1,i=0,a=0;i<r.length;i++){var o=X(r[i].trim(),i);o&&(r[a++]=o,e=e||P("identity",o),n=Math.min(n,o.q||1))}return e||(r[a++]={encoding:"identity",q:n,i}),r.length=a,r}function X(t,r){var e=U.exec(t);if(!e)return null;var n=e[1],i=1;if(e[2])for(var a=e[2].split(";"),o=0;o<a.length;o++){var u=a[o].trim().split("=");if(u[0]==="q"){i=parseFloat(u[1]);break}}return{encoding:n,q:i,i:r}}function Y(t,r,e){for(var n={o:-1,q:0,s:0},i=0;i<r.length;i++){var a=P(t,r[i],e);a&&(n.s-a.s||n.q-a.q||n.o-a.o)<0&&(n=a)}return n}function P(t,r,e){var n=0;if(r.encoding.toLowerCase()===t.toLowerCase())n|=1;else if(r.encoding!=="*")return null;return{i:e,o:r.i,q:r.q,s:n}}function F(t,r){var e=W(t||"");if(!r)return e.filter(M).sort(E).map(Z);var n=r.map(function(a,o){return Y(a,e,o)});return n.filter(M).sort(E).map(function(a){return r[n.indexOf(a)]})}function E(t,r){return r.q-t.q||r.s-t.s||t.o-r.o||t.i-r.i||0}function Z(t){return t.encoding}function M(t){return t.q>0}});var $=c((xr,h)=>{"use strict";f();h.exports=S;h.exports.preferredLanguages=S;var _=/^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;function j(t){for(var r=t.split(","),e=0,n=0;e<r.length;e++){var i=R(r[e].trim(),e);i&&(r[n++]=i)}return r.length=n,r}function R(t,r){var e=_.exec(t);if(!e)return null;var n=e[1],i=e[2],a=n;i&&(a+="-"+i);var o=1;if(e[3])for(var u=e[3].split(";"),p=0;p<u.length;p++){var g=u[p].split("=");g[0]==="q"&&(o=parseFloat(g[1]))}return{prefix:n,suffix:i,q:o,i:r,full:a}}function rr(t,r,e){for(var n={o:-1,q:0,s:0},i=0;i<r.length;i++){var a=er(t,r[i],e);a&&(n.s-a.s||n.q-a.q||n.o-a.o)<0&&(n=a)}return n}function er(t,r,e){var n=R(t);if(!n)return null;var i=0;if(r.full.toLowerCase()===n.full.toLowerCase())i|=4;else if(r.prefix.toLowerCase()===n.full.toLowerCase())i|=2;else if(r.full.toLowerCase()===n.prefix.toLowerCase())i|=1;else if(r.full!=="*")return null;return{i:e,o:r.i,q:r.q,s:i}}function S(t,r){var e=j(t===void 0?"*":t||"");if(!r)return e.filter(A).sort(Q).map(tr);var n=r.map(function(a,o){return rr(a,e,o)});return n.filter(A).sort(Q).map(function(a){return r[n.indexOf(a)]})}function Q(t,r){return r.q-t.q||r.s-t.s||t.o-r.o||t.i-r.i||0}function tr(t){return t.full}function A(t){return t.q>0}});var V=c((Lr,d)=>{"use strict";f();d.exports=I;d.exports.preferredMediaTypes=I;var nr=/^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;function ir(t){for(var r=fr(t),e=0,n=0;e<r.length;e++){var i=N(r[e].trim(),e);i&&(r[n++]=i)}return r.length=n,r}function N(t,r){var e=nr.exec(t);if(!e)return null;var n=Object.create(null),i=1,a=e[2],o=e[1];if(e[3])for(var u=pr(e[3]).map(ur),p=0;p<u.length;p++){var g=u[p],m=g[0].toLowerCase(),l=g[1],x=l&&l[0]==='"'&&l[l.length-1]==='"'?l.substr(1,l.length-2):l;if(m==="q"){i=parseFloat(x);break}n[m]=x}return{type:o,subtype:a,params:n,q:i,i:r}}function ar(t,r,e){for(var n={o:-1,q:0,s:0},i=0;i<r.length;i++){var a=or(t,r[i],e);a&&(n.s-a.s||n.q-a.q||n.o-a.o)<0&&(n=a)}return n}function or(t,r,e){var n=N(t),i=0;if(!n)return null;if(r.type.toLowerCase()==n.type.toLowerCase())i|=4;else if(r.type!="*")return null;if(r.subtype.toLowerCase()==n.subtype.toLowerCase())i|=2;else if(r.subtype!="*")return null;var a=Object.keys(r.params);if(a.length>0)if(a.every(function(o){return r.params[o]=="*"||(r.params[o]||"").toLowerCase()==(n.params[o]||"").toLowerCase()}))i|=1;else return null;return{i:e,o:r.i,q:r.q,s:i}}function I(t,r){var e=ir(t===void 0?"*/*":t||"");if(!r)return e.filter(k).sort(b).map(sr);var n=r.map(function(a,o){return ar(a,e,o)});return n.filter(k).sort(b).map(function(a){return r[n.indexOf(a)]})}function b(t,r){return r.q-t.q||r.s-t.s||t.o-r.o||t.i-r.i||0}function sr(t){return t.type+"/"+t.subtype}function k(t){return t.q>0}function K(t){for(var r=0,e=0;(e=t.indexOf('"',e))!==-1;)r++,e++;return r}function ur(t){var r=t.indexOf("="),e,n;return r===-1?e=t:(e=t.substr(0,r),n=t.substr(r+1)),[e,n]}function fr(t){for(var r=t.split(","),e=1,n=0;e<r.length;e++)K(r[n])%2==0?r[++n]=r[e]:r[n]+=","+r[e];return r.length=n+1,r}function pr(t){for(var r=t.split(";"),e=1,n=0;e<r.length;e++)K(r[n])%2==0?r[++n]=r[e]:r[n]+=";"+r[e];r.length=n+1;for(var e=0;e<r.length;e++)r[e]=r[e].trim();return r}});var vr=c((Tr,q)=>{"use strict";f();var lr=T(),gr=O(),cr=$(),yr=V();q.exports=s;q.exports.Negotiator=s;function s(t){if(!(this instanceof s))return new s(t);this.request=t}s.prototype.charset=function(r){var e=this.charsets(r);return e&&e[0]};s.prototype.charsets=function(r){return lr(this.request.headers["accept-charset"],r)};s.prototype.encoding=function(r){var e=this.encodings(r);return e&&e[0]};s.prototype.encodings=function(r){return gr(this.request.headers["accept-encoding"],r)};s.prototype.language=function(r){var e=this.languages(r);return e&&e[0]};s.prototype.languages=function(r){return cr(this.request.headers["accept-language"],r)};s.prototype.mediaType=function(r){var e=this.mediaTypes(r);return e&&e[0]};s.prototype.mediaTypes=function(r){return yr(this.request.headers.accept,r)};s.prototype.preferredCharset=s.prototype.charset;s.prototype.preferredCharsets=s.prototype.charsets;s.prototype.preferredEncoding=s.prototype.encoding;s.prototype.preferredEncodings=s.prototype.encodings;s.prototype.preferredLanguage=s.prototype.language;s.prototype.preferredLanguages=s.prototype.languages;s.prototype.preferredMediaType=s.prototype.mediaType;s.prototype.preferredMediaTypes=s.prototype.mediaTypes});export{vr as a};
4
+ /*! Bundled license information:
5
+
6
+ negotiator/index.js:
7
+ (*!
8
+ * negotiator
9
+ * Copyright(c) 2012 Federico Romero
10
+ * Copyright(c) 2012-2014 Isaac Z. Schlueter
11
+ * Copyright(c) 2015 Douglas Christopher Wilson
12
+ * MIT Licensed
13
+ *)
14
+ */
15
+ //# sourceMappingURL=chunk-6MEM22XR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/negotiator/lib/charset.js","../../../node_modules/negotiator/lib/encoding.js","../../../node_modules/negotiator/lib/language.js","../../../node_modules/negotiator/lib/mediaType.js","../../../node_modules/negotiator/index.js"],"sourcesContent":["/**\n * negotiator\n * Copyright(c) 2012 Isaac Z. Schlueter\n * Copyright(c) 2014 Federico Romero\n * Copyright(c) 2014-2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = preferredCharsets;\nmodule.exports.preferredCharsets = preferredCharsets;\n\n/**\n * Module variables.\n * @private\n */\n\nvar simpleCharsetRegExp = /^\\s*([^\\s;]+)\\s*(?:;(.*))?$/;\n\n/**\n * Parse the Accept-Charset header.\n * @private\n */\n\nfunction parseAcceptCharset(accept) {\n var accepts = accept.split(',');\n\n for (var i = 0, j = 0; i < accepts.length; i++) {\n var charset = parseCharset(accepts[i].trim(), i);\n\n if (charset) {\n accepts[j++] = charset;\n }\n }\n\n // trim accepts\n accepts.length = j;\n\n return accepts;\n}\n\n/**\n * Parse a charset from the Accept-Charset header.\n * @private\n */\n\nfunction parseCharset(str, i) {\n var match = simpleCharsetRegExp.exec(str);\n if (!match) return null;\n\n var charset = match[1];\n var q = 1;\n if (match[2]) {\n var params = match[2].split(';')\n for (var j = 0; j < params.length; j++) {\n var p = params[j].trim().split('=');\n if (p[0] === 'q') {\n q = parseFloat(p[1]);\n break;\n }\n }\n }\n\n return {\n charset: charset,\n q: q,\n i: i\n };\n}\n\n/**\n * Get the priority of a charset.\n * @private\n */\n\nfunction getCharsetPriority(charset, accepted, index) {\n var priority = {o: -1, q: 0, s: 0};\n\n for (var i = 0; i < accepted.length; i++) {\n var spec = specify(charset, accepted[i], index);\n\n if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {\n priority = spec;\n }\n }\n\n return priority;\n}\n\n/**\n * Get the specificity of the charset.\n * @private\n */\n\nfunction specify(charset, spec, index) {\n var s = 0;\n if(spec.charset.toLowerCase() === charset.toLowerCase()){\n s |= 1;\n } else if (spec.charset !== '*' ) {\n return null\n }\n\n return {\n i: index,\n o: spec.i,\n q: spec.q,\n s: s\n }\n}\n\n/**\n * Get the preferred charsets from an Accept-Charset header.\n * @public\n */\n\nfunction preferredCharsets(accept, provided) {\n // RFC 2616 sec 14.2: no header = *\n var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || '');\n\n if (!provided) {\n // sorted list of all charsets\n return accepts\n .filter(isQuality)\n .sort(compareSpecs)\n .map(getFullCharset);\n }\n\n var priorities = provided.map(function getPriority(type, index) {\n return getCharsetPriority(type, accepts, index);\n });\n\n // sorted list of accepted charsets\n return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) {\n return provided[priorities.indexOf(priority)];\n });\n}\n\n/**\n * Compare two specs.\n * @private\n */\n\nfunction compareSpecs(a, b) {\n return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;\n}\n\n/**\n * Get full charset string.\n * @private\n */\n\nfunction getFullCharset(spec) {\n return spec.charset;\n}\n\n/**\n * Check if a spec has any quality.\n * @private\n */\n\nfunction isQuality(spec) {\n return spec.q > 0;\n}\n","/**\n * negotiator\n * Copyright(c) 2012 Isaac Z. Schlueter\n * Copyright(c) 2014 Federico Romero\n * Copyright(c) 2014-2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = preferredEncodings;\nmodule.exports.preferredEncodings = preferredEncodings;\n\n/**\n * Module variables.\n * @private\n */\n\nvar simpleEncodingRegExp = /^\\s*([^\\s;]+)\\s*(?:;(.*))?$/;\n\n/**\n * Parse the Accept-Encoding header.\n * @private\n */\n\nfunction parseAcceptEncoding(accept) {\n var accepts = accept.split(',');\n var hasIdentity = false;\n var minQuality = 1;\n\n for (var i = 0, j = 0; i < accepts.length; i++) {\n var encoding = parseEncoding(accepts[i].trim(), i);\n\n if (encoding) {\n accepts[j++] = encoding;\n hasIdentity = hasIdentity || specify('identity', encoding);\n minQuality = Math.min(minQuality, encoding.q || 1);\n }\n }\n\n if (!hasIdentity) {\n /*\n * If identity doesn't explicitly appear in the accept-encoding header,\n * it's added to the list of acceptable encoding with the lowest q\n */\n accepts[j++] = {\n encoding: 'identity',\n q: minQuality,\n i: i\n };\n }\n\n // trim accepts\n accepts.length = j;\n\n return accepts;\n}\n\n/**\n * Parse an encoding from the Accept-Encoding header.\n * @private\n */\n\nfunction parseEncoding(str, i) {\n var match = simpleEncodingRegExp.exec(str);\n if (!match) return null;\n\n var encoding = match[1];\n var q = 1;\n if (match[2]) {\n var params = match[2].split(';');\n for (var j = 0; j < params.length; j++) {\n var p = params[j].trim().split('=');\n if (p[0] === 'q') {\n q = parseFloat(p[1]);\n break;\n }\n }\n }\n\n return {\n encoding: encoding,\n q: q,\n i: i\n };\n}\n\n/**\n * Get the priority of an encoding.\n * @private\n */\n\nfunction getEncodingPriority(encoding, accepted, index) {\n var priority = {o: -1, q: 0, s: 0};\n\n for (var i = 0; i < accepted.length; i++) {\n var spec = specify(encoding, accepted[i], index);\n\n if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {\n priority = spec;\n }\n }\n\n return priority;\n}\n\n/**\n * Get the specificity of the encoding.\n * @private\n */\n\nfunction specify(encoding, spec, index) {\n var s = 0;\n if(spec.encoding.toLowerCase() === encoding.toLowerCase()){\n s |= 1;\n } else if (spec.encoding !== '*' ) {\n return null\n }\n\n return {\n i: index,\n o: spec.i,\n q: spec.q,\n s: s\n }\n};\n\n/**\n * Get the preferred encodings from an Accept-Encoding header.\n * @public\n */\n\nfunction preferredEncodings(accept, provided) {\n var accepts = parseAcceptEncoding(accept || '');\n\n if (!provided) {\n // sorted list of all encodings\n return accepts\n .filter(isQuality)\n .sort(compareSpecs)\n .map(getFullEncoding);\n }\n\n var priorities = provided.map(function getPriority(type, index) {\n return getEncodingPriority(type, accepts, index);\n });\n\n // sorted list of accepted encodings\n return priorities.filter(isQuality).sort(compareSpecs).map(function getEncoding(priority) {\n return provided[priorities.indexOf(priority)];\n });\n}\n\n/**\n * Compare two specs.\n * @private\n */\n\nfunction compareSpecs(a, b) {\n return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;\n}\n\n/**\n * Get full encoding string.\n * @private\n */\n\nfunction getFullEncoding(spec) {\n return spec.encoding;\n}\n\n/**\n * Check if a spec has any quality.\n * @private\n */\n\nfunction isQuality(spec) {\n return spec.q > 0;\n}\n","/**\n * negotiator\n * Copyright(c) 2012 Isaac Z. Schlueter\n * Copyright(c) 2014 Federico Romero\n * Copyright(c) 2014-2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = preferredLanguages;\nmodule.exports.preferredLanguages = preferredLanguages;\n\n/**\n * Module variables.\n * @private\n */\n\nvar simpleLanguageRegExp = /^\\s*([^\\s\\-;]+)(?:-([^\\s;]+))?\\s*(?:;(.*))?$/;\n\n/**\n * Parse the Accept-Language header.\n * @private\n */\n\nfunction parseAcceptLanguage(accept) {\n var accepts = accept.split(',');\n\n for (var i = 0, j = 0; i < accepts.length; i++) {\n var language = parseLanguage(accepts[i].trim(), i);\n\n if (language) {\n accepts[j++] = language;\n }\n }\n\n // trim accepts\n accepts.length = j;\n\n return accepts;\n}\n\n/**\n * Parse a language from the Accept-Language header.\n * @private\n */\n\nfunction parseLanguage(str, i) {\n var match = simpleLanguageRegExp.exec(str);\n if (!match) return null;\n\n var prefix = match[1]\n var suffix = match[2]\n var full = prefix\n\n if (suffix) full += \"-\" + suffix;\n\n var q = 1;\n if (match[3]) {\n var params = match[3].split(';')\n for (var j = 0; j < params.length; j++) {\n var p = params[j].split('=');\n if (p[0] === 'q') q = parseFloat(p[1]);\n }\n }\n\n return {\n prefix: prefix,\n suffix: suffix,\n q: q,\n i: i,\n full: full\n };\n}\n\n/**\n * Get the priority of a language.\n * @private\n */\n\nfunction getLanguagePriority(language, accepted, index) {\n var priority = {o: -1, q: 0, s: 0};\n\n for (var i = 0; i < accepted.length; i++) {\n var spec = specify(language, accepted[i], index);\n\n if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {\n priority = spec;\n }\n }\n\n return priority;\n}\n\n/**\n * Get the specificity of the language.\n * @private\n */\n\nfunction specify(language, spec, index) {\n var p = parseLanguage(language)\n if (!p) return null;\n var s = 0;\n if(spec.full.toLowerCase() === p.full.toLowerCase()){\n s |= 4;\n } else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) {\n s |= 2;\n } else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) {\n s |= 1;\n } else if (spec.full !== '*' ) {\n return null\n }\n\n return {\n i: index,\n o: spec.i,\n q: spec.q,\n s: s\n }\n};\n\n/**\n * Get the preferred languages from an Accept-Language header.\n * @public\n */\n\nfunction preferredLanguages(accept, provided) {\n // RFC 2616 sec 14.4: no header = *\n var accepts = parseAcceptLanguage(accept === undefined ? '*' : accept || '');\n\n if (!provided) {\n // sorted list of all languages\n return accepts\n .filter(isQuality)\n .sort(compareSpecs)\n .map(getFullLanguage);\n }\n\n var priorities = provided.map(function getPriority(type, index) {\n return getLanguagePriority(type, accepts, index);\n });\n\n // sorted list of accepted languages\n return priorities.filter(isQuality).sort(compareSpecs).map(function getLanguage(priority) {\n return provided[priorities.indexOf(priority)];\n });\n}\n\n/**\n * Compare two specs.\n * @private\n */\n\nfunction compareSpecs(a, b) {\n return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;\n}\n\n/**\n * Get full language string.\n * @private\n */\n\nfunction getFullLanguage(spec) {\n return spec.full;\n}\n\n/**\n * Check if a spec has any quality.\n * @private\n */\n\nfunction isQuality(spec) {\n return spec.q > 0;\n}\n","/**\n * negotiator\n * Copyright(c) 2012 Isaac Z. Schlueter\n * Copyright(c) 2014 Federico Romero\n * Copyright(c) 2014-2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = preferredMediaTypes;\nmodule.exports.preferredMediaTypes = preferredMediaTypes;\n\n/**\n * Module variables.\n * @private\n */\n\nvar simpleMediaTypeRegExp = /^\\s*([^\\s\\/;]+)\\/([^;\\s]+)\\s*(?:;(.*))?$/;\n\n/**\n * Parse the Accept header.\n * @private\n */\n\nfunction parseAccept(accept) {\n var accepts = splitMediaTypes(accept);\n\n for (var i = 0, j = 0; i < accepts.length; i++) {\n var mediaType = parseMediaType(accepts[i].trim(), i);\n\n if (mediaType) {\n accepts[j++] = mediaType;\n }\n }\n\n // trim accepts\n accepts.length = j;\n\n return accepts;\n}\n\n/**\n * Parse a media type from the Accept header.\n * @private\n */\n\nfunction parseMediaType(str, i) {\n var match = simpleMediaTypeRegExp.exec(str);\n if (!match) return null;\n\n var params = Object.create(null);\n var q = 1;\n var subtype = match[2];\n var type = match[1];\n\n if (match[3]) {\n var kvps = splitParameters(match[3]).map(splitKeyValuePair);\n\n for (var j = 0; j < kvps.length; j++) {\n var pair = kvps[j];\n var key = pair[0].toLowerCase();\n var val = pair[1];\n\n // get the value, unwrapping quotes\n var value = val && val[0] === '\"' && val[val.length - 1] === '\"'\n ? val.substr(1, val.length - 2)\n : val;\n\n if (key === 'q') {\n q = parseFloat(value);\n break;\n }\n\n // store parameter\n params[key] = value;\n }\n }\n\n return {\n type: type,\n subtype: subtype,\n params: params,\n q: q,\n i: i\n };\n}\n\n/**\n * Get the priority of a media type.\n * @private\n */\n\nfunction getMediaTypePriority(type, accepted, index) {\n var priority = {o: -1, q: 0, s: 0};\n\n for (var i = 0; i < accepted.length; i++) {\n var spec = specify(type, accepted[i], index);\n\n if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {\n priority = spec;\n }\n }\n\n return priority;\n}\n\n/**\n * Get the specificity of the media type.\n * @private\n */\n\nfunction specify(type, spec, index) {\n var p = parseMediaType(type);\n var s = 0;\n\n if (!p) {\n return null;\n }\n\n if(spec.type.toLowerCase() == p.type.toLowerCase()) {\n s |= 4\n } else if(spec.type != '*') {\n return null;\n }\n\n if(spec.subtype.toLowerCase() == p.subtype.toLowerCase()) {\n s |= 2\n } else if(spec.subtype != '*') {\n return null;\n }\n\n var keys = Object.keys(spec.params);\n if (keys.length > 0) {\n if (keys.every(function (k) {\n return spec.params[k] == '*' || (spec.params[k] || '').toLowerCase() == (p.params[k] || '').toLowerCase();\n })) {\n s |= 1\n } else {\n return null\n }\n }\n\n return {\n i: index,\n o: spec.i,\n q: spec.q,\n s: s,\n }\n}\n\n/**\n * Get the preferred media types from an Accept header.\n * @public\n */\n\nfunction preferredMediaTypes(accept, provided) {\n // RFC 2616 sec 14.2: no header = */*\n var accepts = parseAccept(accept === undefined ? '*/*' : accept || '');\n\n if (!provided) {\n // sorted list of all types\n return accepts\n .filter(isQuality)\n .sort(compareSpecs)\n .map(getFullType);\n }\n\n var priorities = provided.map(function getPriority(type, index) {\n return getMediaTypePriority(type, accepts, index);\n });\n\n // sorted list of accepted types\n return priorities.filter(isQuality).sort(compareSpecs).map(function getType(priority) {\n return provided[priorities.indexOf(priority)];\n });\n}\n\n/**\n * Compare two specs.\n * @private\n */\n\nfunction compareSpecs(a, b) {\n return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;\n}\n\n/**\n * Get full type string.\n * @private\n */\n\nfunction getFullType(spec) {\n return spec.type + '/' + spec.subtype;\n}\n\n/**\n * Check if a spec has any quality.\n * @private\n */\n\nfunction isQuality(spec) {\n return spec.q > 0;\n}\n\n/**\n * Count the number of quotes in a string.\n * @private\n */\n\nfunction quoteCount(string) {\n var count = 0;\n var index = 0;\n\n while ((index = string.indexOf('\"', index)) !== -1) {\n count++;\n index++;\n }\n\n return count;\n}\n\n/**\n * Split a key value pair.\n * @private\n */\n\nfunction splitKeyValuePair(str) {\n var index = str.indexOf('=');\n var key;\n var val;\n\n if (index === -1) {\n key = str;\n } else {\n key = str.substr(0, index);\n val = str.substr(index + 1);\n }\n\n return [key, val];\n}\n\n/**\n * Split an Accept header into media types.\n * @private\n */\n\nfunction splitMediaTypes(accept) {\n var accepts = accept.split(',');\n\n for (var i = 1, j = 0; i < accepts.length; i++) {\n if (quoteCount(accepts[j]) % 2 == 0) {\n accepts[++j] = accepts[i];\n } else {\n accepts[j] += ',' + accepts[i];\n }\n }\n\n // trim accepts\n accepts.length = j + 1;\n\n return accepts;\n}\n\n/**\n * Split a string of parameters.\n * @private\n */\n\nfunction splitParameters(str) {\n var parameters = str.split(';');\n\n for (var i = 1, j = 0; i < parameters.length; i++) {\n if (quoteCount(parameters[j]) % 2 == 0) {\n parameters[++j] = parameters[i];\n } else {\n parameters[j] += ';' + parameters[i];\n }\n }\n\n // trim parameters\n parameters.length = j + 1;\n\n for (var i = 0; i < parameters.length; i++) {\n parameters[i] = parameters[i].trim();\n }\n\n return parameters;\n}\n","/*!\n * negotiator\n * Copyright(c) 2012 Federico Romero\n * Copyright(c) 2012-2014 Isaac Z. Schlueter\n * Copyright(c) 2015 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict';\n\nvar preferredCharsets = require('./lib/charset')\nvar preferredEncodings = require('./lib/encoding')\nvar preferredLanguages = require('./lib/language')\nvar preferredMediaTypes = require('./lib/mediaType')\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = Negotiator;\nmodule.exports.Negotiator = Negotiator;\n\n/**\n * Create a Negotiator instance from a request.\n * @param {object} request\n * @public\n */\n\nfunction Negotiator(request) {\n if (!(this instanceof Negotiator)) {\n return new Negotiator(request);\n }\n\n this.request = request;\n}\n\nNegotiator.prototype.charset = function charset(available) {\n var set = this.charsets(available);\n return set && set[0];\n};\n\nNegotiator.prototype.charsets = function charsets(available) {\n return preferredCharsets(this.request.headers['accept-charset'], available);\n};\n\nNegotiator.prototype.encoding = function encoding(available) {\n var set = this.encodings(available);\n return set && set[0];\n};\n\nNegotiator.prototype.encodings = function encodings(available) {\n return preferredEncodings(this.request.headers['accept-encoding'], available);\n};\n\nNegotiator.prototype.language = function language(available) {\n var set = this.languages(available);\n return set && set[0];\n};\n\nNegotiator.prototype.languages = function languages(available) {\n return preferredLanguages(this.request.headers['accept-language'], available);\n};\n\nNegotiator.prototype.mediaType = function mediaType(available) {\n var set = this.mediaTypes(available);\n return set && set[0];\n};\n\nNegotiator.prototype.mediaTypes = function mediaTypes(available) {\n return preferredMediaTypes(this.request.headers.accept, available);\n};\n\n// Backwards compatibility\nNegotiator.prototype.preferredCharset = Negotiator.prototype.charset;\nNegotiator.prototype.preferredCharsets = Negotiator.prototype.charsets;\nNegotiator.prototype.preferredEncoding = Negotiator.prototype.encoding;\nNegotiator.prototype.preferredEncodings = Negotiator.prototype.encodings;\nNegotiator.prototype.preferredLanguage = Negotiator.prototype.language;\nNegotiator.prototype.preferredLanguages = Negotiator.prototype.languages;\nNegotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType;\nNegotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes;\n"],"mappings":";;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EAAW,UAAU,UAC/DA,EAAW,UAAU,kBAAoBA,EAAW,UAAU,SAC9DA,EAAW,UAAU,mBAAqBA,EAAW,UAAU,UAC/DA,EAAW,UAAU,mBAAqBA,EAAW,UAAU,UAC/DA,EAAW,UAAU,oBAAsBA,EAAW,UAAU","names":["require_charset","__commonJSMin","exports","module","init_esm_shims","preferredCharsets","simpleCharsetRegExp","parseAcceptCharset","accept","accepts","i","j","charset","parseCharset","str","match","q","params","p","getCharsetPriority","accepted","index","priority","spec","specify","s","provided","isQuality","compareSpecs","getFullCharset","priorities","type","a","b","require_encoding","__commonJSMin","exports","module","init_esm_shims","preferredEncodings","simpleEncodingRegExp","parseAcceptEncoding","accept","accepts","hasIdentity","minQuality","j","encoding","parseEncoding","specify","str","i","match","q","params","p","getEncodingPriority","accepted","index","priority","spec","s","provided","isQuality","compareSpecs","getFullEncoding","priorities","type","a","b","require_language","__commonJSMin","exports","module","init_esm_shims","preferredLanguages","simpleLanguageRegExp","parseAcceptLanguage","accept","accepts","i","j","language","parseLanguage","str","match","prefix","suffix","full","q","params","p","getLanguagePriority","accepted","index","priority","spec","specify","s","provided","isQuality","compareSpecs","getFullLanguage","priorities","type","a","b","require_mediaType","__commonJSMin","exports","module","init_esm_shims","preferredMediaTypes","simpleMediaTypeRegExp","parseAccept","accept","accepts","splitMediaTypes","i","j","mediaType","parseMediaType","str","match","params","q","subtype","type","kvps","splitParameters","splitKeyValuePair","pair","key","val","value","getMediaTypePriority","accepted","index","priority","spec","specify","p","s","keys","k","provided","isQuality","compareSpecs","getFullType","priorities","a","b","quoteCount","string","count","parameters","require_negotiator","__commonJSMin","exports","module","init_esm_shims","preferredCharsets","preferredEncodings","preferredLanguages","preferredMediaTypes","Negotiator","request","available","set"]}
@@ -0,0 +1,14 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{b as g}from"./chunk-A47ABA7B.js";import{a as d}from"./chunk-X3AOPEF4.js";import{b as s,f as c}from"./chunk-WICGWF4N.js";import{c as w}from"./chunk-EE5EBGQ7.js";import{c as f,e as l}from"./chunk-TCTTRAWM.js";import{c as P,e as h,i}from"./chunk-UO4ZAUJK.js";var y=P((N,F)=>{"use strict";i();F.exports=function(r,t){if(typeof r!="string")throw new TypeError("expected path to be a string");if(r==="\\"||r==="/")return"/";var o=r.length;if(o<=1)return r;var e="";if(o>4&&r[3]==="\\"){var p=r[2];(p==="?"||p===".")&&r.slice(0,2)==="\\\\"&&(r=r.slice(2),e="//")}var n=r.split(/[/\\]+/);return t!==!1&&n[n.length-1]===""&&n.pop(),e+n.join("/")}});i();import{readdir as x,readFile as T,stat as C}from"node:fs/promises";import{join as a}from"node:path";async function u(r,t=""){return(await Promise.all((await x(a(r,t))).map(async o=>{let e=a(t,o);return(await C(a(r,e))).isDirectory()?u(r,e):{path:e,content:await T(a(r,e),"utf-8")}}))).flat()}function _(r){return r instanceof Error&&d(r)?.response?.data?.details?.applicationError?.code==="SITE_NOT_PUBLISHED"}i();import{join as m}from"node:path";import{readFile as j}from"node:fs/promises";var E=h(y(),1);async function I(r){try{return await j(r,"utf-8")}catch(t){throw new f({code:l.FailedToReadProjectFiles({cause:t}),cause:t})}}async function v(r){try{return await u(r)}catch(t){throw new f({code:l.FailedToReadProjectFiles({cause:t}),cause:t})}}async function A(r){return await w(m(r,c))?Promise.all(["package.json",c].map(async t=>{let o=await I(m(r,t));return{path:t,content:o}})):[]}async function W(r){let t=(await v(s(r))).map(e=>({content:e.content,path:(0,E.default)(m(s(""),e.path))})),o=await A(r);return{ignoreForbiddenPaths:!0,layout:g.GITHUB,files:t.concat(o)}}export{y as a,_ as b,W as c};
4
+ /*! Bundled license information:
5
+
6
+ normalize-path/index.js:
7
+ (*!
8
+ * normalize-path <https://github.com/jonschlinkert/normalize-path>
9
+ *
10
+ * Copyright (c) 2014-2018, Jon Schlinkert.
11
+ * Released under the MIT License.
12
+ *)
13
+ */
14
+ //# sourceMappingURL=chunk-7WD47GXQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/normalize-path/index.js","../../cli-site-old/src/utils.ts","../../cli-site-old/src/gridapp/loadProjectGridAppContent.ts"],"sourcesContent":["/*!\n * normalize-path <https://github.com/jonschlinkert/normalize-path>\n *\n * Copyright (c) 2014-2018, Jon Schlinkert.\n * Released under the MIT License.\n */\n\nmodule.exports = function(path, stripTrailing) {\n if (typeof path !== 'string') {\n throw new TypeError('expected path to be a string');\n }\n\n if (path === '\\\\' || path === '/') return '/';\n\n var len = path.length;\n if (len <= 1) return path;\n\n // ensure that win32 namespaces has two leading slashes, so that the path is\n // handled properly by the win32 version of path.parse() after being normalized\n // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces\n var prefix = '';\n if (len > 4 && path[3] === '\\\\') {\n var ch = path[2];\n if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\\\\\') {\n path = path.slice(2);\n prefix = '//';\n }\n }\n\n var segs = path.split(/[/\\\\]+/);\n if (stripTrailing !== false && segs[segs.length - 1] === '') {\n segs.pop();\n }\n return prefix + segs.join('/');\n};\n","import { readdir, readFile, stat } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { extractHttpError } from '@wix/cli-http-client';\n\n/**\n * reads a file contents recursively and returns an array of all files\n */\nexport async function readFiles(\n dir: string,\n subPath = ''\n): Promise<Array<{ path: string; content: string }>> {\n return (\n await Promise.all(\n (await readdir(join(dir, subPath))).map(async (file) => {\n const path = join(subPath, file);\n if ((await stat(join(dir, path))).isDirectory()) {\n return readFiles(dir, path);\n }\n return {\n path,\n content: await readFile(join(dir, path), 'utf-8'),\n };\n })\n )\n ).flat();\n}\n\nexport function isSiteNotPublishedError(err: unknown) {\n if (err instanceof Error) {\n const httpError = extractHttpError(err);\n const errorCode =\n httpError?.response?.data?.details?.applicationError?.code;\n\n if (errorCode === 'SITE_NOT_PUBLISHED') {\n return true;\n }\n }\n return false;\n}\n","import { join } from 'node:path';\nimport { readFile } from 'node:fs/promises';\nimport { GridAppLayout } from '@wix/ambassador-velo-apps-v1-app/types';\nimport { getSourceFolder } from '@wix/velo-github-layout-definitions';\nimport normalizePath from 'normalize-path';\nimport { pathExists } from '@wix/cli-fs';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { WIX_LOCK_FILENAME } from '@wix/cli-core-definitions';\nimport { readFiles } from '../utils.js';\n\ninterface File {\n path: string;\n content: string;\n}\n\nasync function readFileOrThrow(path: string): Promise<string> {\n try {\n return await readFile(path, 'utf-8');\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToReadProjectFiles({ cause: e }),\n cause: e,\n });\n }\n}\n\nasync function readFilesOrThrow(root: string): Promise<File[]> {\n try {\n return await readFiles(root);\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToReadProjectFiles({ cause: e }),\n cause: e,\n });\n }\n}\n\nasync function loadProjectRootFiles(projectFolder: string) {\n if (await pathExists(join(projectFolder, WIX_LOCK_FILENAME))) {\n return Promise.all(\n ['package.json', WIX_LOCK_FILENAME].map(async (path) => {\n const content = await readFileOrThrow(join(projectFolder, path));\n\n return { path, content };\n })\n );\n }\n\n return [];\n}\n\nexport async function loadProjectGridAppContent(projectFolder: string) {\n const sourceFiles = (\n await readFilesOrThrow(getSourceFolder(projectFolder))\n ).map((file) => ({\n content: file.content,\n path: normalizePath(join(getSourceFolder(''), file.path)),\n }));\n\n const rootFiles = await loadProjectRootFiles(projectFolder);\n\n return {\n ignoreForbiddenPaths: true,\n layout: GridAppLayout.GITHUB,\n files: sourceFiles.concat(rootFiles),\n };\n}\n"],"mappings":";;uQAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,cAAAC,IAOAD,EAAO,QAAU,SAASE,EAAMC,EAAe,CAC7C,GAAI,OAAOD,GAAS,SAClB,MAAM,IAAI,UAAU,8BAA8B,EAGpD,GAAIA,IAAS,MAAQA,IAAS,IAAK,MAAO,IAE1C,IAAIE,EAAMF,EAAK,OACf,GAAIE,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EACxD,MAAOA,CACT,CAAC,CACH,CACF,CAEA,eAAeG,EAAiBC,EAA+B,CAC7D,GAAI,CACF,OAAO,MAAMC,EAAUD,CAAI,CAC7B,OAASJ,EAAG,CACV,MAAM,IAAIC,EAAS,CACjB,KAAMC,EAAa,yBAAyB,CAAE,MAAOF,CAAE,CAAC,EACxD,MAAOA,CACT,CAAC,CACH,CACF,CAEA,eAAeM,EAAqBC,EAAuB,CACzD,OAAI,MAAMC,EAAWC,EAAKF,EAAeG,CAAiB,CAAC,EAClD,QAAQ,IACb,CAAC,eAAgBA,CAAiB,EAAE,IAAI,MAAOZ,GAAS,CACtD,IAAMa,EAAU,MAAMd,EAAgBY,EAAKF,EAAeT,CAAI,CAAC,EAE/D,MAAO,CAAE,KAAAA,EAAM,QAAAa,CAAQ,CACzB,CAAC,CACH,EAGK,CAAC,CACV,CAEA,eAAsBC,EAA0BL,EAAuB,CACrE,IAAMM,GACJ,MAAMV,EAAiBW,EAAgBP,CAAa,CAAC,GACrD,IAAKQ,IAAU,CACf,QAASA,EAAK,QACd,QAAM,EAAAC,SAAcP,EAAKK,EAAgB,EAAE,EAAGC,EAAK,IAAI,CAAC,CAC1D,EAAE,EAEIE,EAAY,MAAMX,EAAqBC,CAAa,EAE1D,MAAO,CACL,qBAAsB,GACtB,OAAQW,EAAc,OACtB,MAAOL,EAAY,OAAOI,CAAS,CACrC,CACF","names":["require_normalize_path","__commonJSMin","exports","module","init_esm_shims","path","stripTrailing","len","prefix","ch","segs","init_esm_shims","readdir","readFile","stat","join","readFiles","dir","subPath","readdir","join","file","path","stat","readFile","isSiteNotPublishedError","err","extractHttpError","init_esm_shims","join","readFile","import_normalize_path","readFileOrThrow","path","readFile","e","CliError","CliErrorCode","readFilesOrThrow","root","readFiles","loadProjectRootFiles","projectFolder","pathExists","join","WIX_LOCK_FILENAME","content","loadProjectGridAppContent","sourceFiles","getSourceFolder","file","normalizePath","rootFiles","GridAppLayout"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{d as m,f as t}from"./chunk-JYYNYTCQ.js";import{i as f}from"./chunk-UO4ZAUJK.js";f();var _;(function(e){e.VELO="VELO",e.VELO_ISOLATED="VELO_ISOLATED"})(_||(_={}));var l;(function(e){e.UNKNOWN_GRID_APP_LAYOUT="UNKNOWN_GRID_APP_LAYOUT",e.ONLINE="ONLINE",e.GITHUB="GITHUB",e.GITHUB_BLOCKS="GITHUB_BLOCKS",e.WIX_IDE="WIX_IDE"})(l||(l={}));var u;(function(e){e.UNKNOWN="UNKNOWN",e.GA="GA",e.RC="RC"})(u||(u={}));var R;(function(e){e.UNKNOWN="UNKNOWN",e.WIX_CLI="WIX_CLI"})(R||(R={}));var h;(function(e){e.UNKNOWN="UNKNOWN",e.ANONYMOUS_VISITOR="ANONYMOUS_VISITOR",e.MEMBER="MEMBER",e.WIX_USER="WIX_USER",e.APP="APP"})(h||(h={}));f();var N={},O={},S={},q={};var A={},P={};function c(e){var r={"code._base_domain_":[{srcPath:"/_api/wix-code-lifecycle-service",destPath:""}],"editor._base_domain_":[{srcPath:"/_api/wix-code-lifecycle-service",destPath:""}],"blocks._base_domain_":[{srcPath:"/_api/wix-code-lifecycle-service",destPath:""}],"create.editorx":[{srcPath:"/_api/wix-code-lifecycle-service",destPath:""}],"manage._base_domain_":[{srcPath:"/_api/wix-code-lifecycle-service",destPath:""}]};return m(Object.assign(e,{domainToMappings:r}))}function w(e){var r=t(A,{}),p=r.toJSON,i=r.fromJSON,n=t(P,{}).fromJSON;function a(v){var s=v.host,o=p(e),d={entityFqdn:"wix.velo.apps.v1.app",method:"POST",methodFqn:"wix.velo.apps.v1.LifecycleService.PagesDiff",url:c({protoPath:"/v1/pages-diff",data:o,host:s}),data:o,transformResponse:n,fallback:[{method:"POST",url:c({protoPath:"/v1/pages-diff",data:o,host:s}),data:o}]};return d}return a.fromReq=i,a.__isAmbassador=!0,a}function L(e){var r=t(N,{}),p=r.toJSON,i=r.fromJSON,n=t(O,{}).fromJSON;function a(v){var s=v.host,o=p(e),d={entityFqdn:"wix.velo.apps.v1.app",method:"POST",methodFqn:"wix.velo.apps.v1.LifecycleService.CreateApp",url:c({protoPath:"/v1/apps",data:o,host:s}),data:o,transformResponse:n};return d}return a.fromReq=i,a.__isAmbassador=!0,a}function D(e){var r=t(S,{}),p=r.toJSON,i=r.fromJSON,n=t(q,{}).fromJSON;function a(v){var s=v.host,o=p(e),d={entityFqdn:"wix.velo.apps.v1.app",method:"POST",methodFqn:"wix.velo.apps.v1.LifecycleService.DeployApp",url:c({protoPath:"/v1/apps/deploy",data:o,host:s}),data:o,transformResponse:n};return d}return a.fromReq=i,a.__isAmbassador=!0,a}export{_ as a,l as b,u as c,R as d,w as e,L as f,D as g};
4
+ //# sourceMappingURL=chunk-A47ABA7B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/@wix/ambassador-velo-apps-v1-app/types.impl.ts","../../../node_modules/@wix/ambassador-velo-apps-v1-app/http.impl.ts"],"sourcesContent":[null,null],"mappings":";;uFAeAA,IACA,IAAYC,GAAZ,SAAYA,EAAO,CAEjBA,EAAA,KAAA,OAKAA,EAAA,cAAA,eACF,GARYA,IAAAA,EAAO,CAAA,EAAA,EAmCnB,IAAYC,GAAZ,SAAYA,EAAa,CAEvBA,EAAA,wBAAA,0BAEAA,EAAA,OAAA,SAEAA,EAAA,OAAA,SAEAA,EAAA,cAAA,gBAEAA,EAAA,QAAA,SACF,GAXYA,IAAAA,EAAa,CAAA,EAAA,EA0PzB,IAAYC,GAAZ,SAAYA,EAAmB,CAE7BA,EAAA,QAAA,UAEAA,EAAA,GAAA,KAEAA,EAAA,GAAA,IACF,GAPYA,IAAAA,EAAmB,CAAA,EAAA,EAc/B,IAAYC,GAAZ,SAAYA,EAAO,CAEjBA,EAAA,QAAA,UAEAA,EAAA,QAAA,SACF,GALYA,IAAAA,EAAO,CAAA,EAAA,EA+HnB,IAAYC,GAAZ,SA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B,IAAAC,EAAuCC,EAC3CW,EACA,CAAA,CAAE,EAFYT,EAAKH,EAAA,OAAYI,EAAOJ,EAAA,SAItBK,EAAYJ,EAAWY,EAAoB,CAAA,CAAE,EAAC,SAEhE,SAASC,EAAYd,EAAa,KAAXQ,EAAIR,EAAA,KACnBS,EAAiBN,EAAMJ,CAAO,EAC9BW,EAAW,CACf,WAAY,uBACZ,OAAQ,OACR,UAAW,8CACX,IAAKhB,EAAwC,CAC3C,UAAW,WACX,KAAMe,EACN,KAAID,EACL,EACD,KAAMC,EACN,kBAAmBJ,GAGrB,OAAOK,CACT,CAEA,OAAAI,EAAY,QAAUV,EACtBU,EAAY,eAAiB,GACtBA,CACT,CA0EM,SAAUC,EACdC,EAAyB,CAEnB,IAAAC,EAAuCC,EAC3CC,EACA,CAAA,CAAE,EAFYC,EAAKH,EAAA,OAAYI,EAAOJ,EAAA,SAItBK,EAAYJ,EAAWK,EAAoB,CAAA,CAAE,EAAC,SAEhE,SAASC,EAAYP,EAAa,KAAXQ,EAAIR,EAAA,KACnBS,EAAiBN,EAAMJ,CAAO,EAC9BW,EAAW,CACf,WAAY,uBACZ,OAAQ,OACR,UAAW,8CACX,IAAKC,EAAwC,CAC3C,UAAW,kBACX,KAAMF,EACN,KAAID,EACL,EACD,KAAMC,EACN,kBAAmBJ,GAGrB,OAAOK,CACT,CAEA,OAAAH,EAAY,QAAUH,EACtBG,EAAY,eAAiB,GACtBA,CACT","names":["init_esm_shims","AppType","GridAppLayout","DeploymentOperation","RcLabel","WebhookIdentityType","init_esm_shims","_createAppRequest","_createAppResponse","_deployAppRequest","_deployAppResponse","_pagesDiffRequest","_pagesDiffResponse","resolveWixVeloAppsV1LifecycleServiceUrl","opts","domainToMappings","resolveUrl","pagesDiff","payload","_a","serializer","_pagesDiffRequest","toReq","fromReq","fromRes","_pagesDiffResponse","__pagesDiff","host","serializedData","metadata","createApp","_createAppRequest","_createAppResponse","__createApp","deployApp","payload","_a","serializer","_deployAppRequest","toReq","fromReq","fromRes","_deployAppResponse","__deployApp","host","serializedData","metadata","resolveWixVeloAppsV1LifecycleServiceUrl"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{a as p}from"./chunk-4BTCJXQC.js";import{e as c,j as a}from"./chunk-WICGWF4N.js";import{b as l}from"./chunk-EE5EBGQ7.js";import{a as n}from"./chunk-CUZEHDNU.js";import{c as d,e as f}from"./chunk-TCTTRAWM.js";import{e as u,i as e}from"./chunk-UO4ZAUJK.js";e();var r=u(p(),1);e();e();var s=n.object({siteId:n.string().uuid()});async function m(o){let t=await l(a(o)),i=s.safeParse(t);if(i.success)return i.data;throw new d({code:f.InvalidConfigSchemaError({configPath:c,zodError:i.error})})}async function E(o){let t=await m(o);return{projectFolder:o,metaSiteId:t.siteId}}var P=(0,r.createContext)(null),F=({value:o,children:t})=>r.default.createElement(P.Provider,{value:{model:o}},t);function y(){let o=(0,r.useContext)(P);if(o===null)throw new Error("useProjectModel() cannot be used without an <ProjectModelProvider>");return o}export{E as a,F as b,y as c};
4
+ //# sourceMappingURL=chunk-B7EXWRCM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../cli-site/src/model.tsx","../../cli-site/src/files/wix.config.ts","../../cli-site-definitions/src/index.ts"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport type { FC, ReactNode } from 'react';\nimport { readWixConfig } from './files/wix.config.js';\n\ninterface ProjectModel {\n projectFolder: string;\n metaSiteId: string;\n}\n\nexport async function loadProjectModel(\n projectFolder: string\n): Promise<ProjectModel> {\n const config = await readWixConfig(projectFolder);\n return {\n projectFolder,\n metaSiteId: config.siteId,\n };\n}\n\ninterface ProjectModelState {\n model: ProjectModel;\n}\n\nconst ProjectModelContext = createContext<ProjectModelState | null>(null);\n\ninterface Props {\n value: ProjectModel;\n children: ReactNode;\n}\n\nexport const ProjectModelProvider: FC<Props> = ({ value: model, children }) => {\n return (\n <ProjectModelContext.Provider value={{ model }}>\n {children}\n </ProjectModelContext.Provider>\n );\n};\n\nexport function useProjectModel(): ProjectModelState {\n const context = useContext(ProjectModelContext);\n if (context === null) {\n throw new Error(\n 'useProjectModel() cannot be used without an <ProjectModelProvider>'\n );\n }\n return context;\n}\n","import {\n WIX_CONFIG_FILENAME,\n getWixConfigFilePath,\n} from '@wix/cli-core-definitions';\nimport { wixConfigSchema } from '@wix/cli-site-definitions';\nimport { readJson } from '@wix/cli-fs';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\n\nexport async function readWixConfig(projectFolder: string) {\n const configFile = await readJson(getWixConfigFilePath(projectFolder));\n const config = wixConfigSchema.safeParse(configFile);\n\n if (config.success) {\n return config.data;\n }\n\n throw new CliError({\n code: CliErrorCode.InvalidConfigSchemaError({\n configPath: WIX_CONFIG_FILENAME,\n zodError: config.error,\n }),\n });\n}\n","import { z } from 'zod';\n\nexport const wixConfigSchema = z.object({\n siteId: z.string().uuid(),\n});\nexport type WixConfig = z.infer<typeof wixConfigSchema>;\n"],"mappings":";;qQAAAA,IAAA,IAAAC,EAAiD,SCAjDC,ICAAC,IAEO,IAAMC,EAAkBC,EAAE,OAAO,CACtC,OAAQA,EAAE,OAAO,EAAE,KAAK,CAC1B,CAAC,EDID,eAAsBC,EAAcC,EAAuB,CACzD,IAAMC,EAAa,MAAMC,EAASC,EAAqBH,CAAa,CAAC,EAC/DI,EAASC,EAAgB,UAAUJ,CAAU,EAEnD,GAAIG,EAAO,QACT,OAAOA,EAAO,KAGhB,MAAM,IAAIE,EAAS,CACjB,KAAMC,EAAa,yBAAyB,CAC1C,WAAYC,EACZ,SAAUJ,EAAO,KACnB,CAAC,CACH,CAAC,CACH,CDbA,eAAsBK,EACpBC,EACuB,CACvB,IAAMC,EAAS,MAAMC,EAAcF,CAAa,EAChD,MAAO,CACL,cAAAA,EACA,WAAYC,EAAO,MACrB,CACF,CAMA,IAAME,KAAsB,iBAAwC,IAAI,EAO3DC,EAAkC,CAAC,CAAE,MAAOC,EAAO,SAAAC,CAAS,IAErE,EAAAC,QAAA,cAACJ,EAAoB,SAApB,CAA6B,MAAO,CAAE,MAAAE,CAAM,GAC1CC,CACH,EAIG,SAASE,GAAqC,CACnD,IAAMC,KAAU,cAAWN,CAAmB,EAC9C,GAAIM,IAAY,KACd,MAAM,IAAI,MACR,oEACF,EAEF,OAAOA,CACT","names":["init_esm_shims","import_react","init_esm_shims","init_esm_shims","wixConfigSchema","z","readWixConfig","projectFolder","configFile","readJson","getWixConfigFilePath","config","wixConfigSchema","CliError","CliErrorCode","WIX_CONFIG_FILENAME","loadProjectModel","projectFolder","config","readWixConfig","ProjectModelContext","ProjectModelProvider","model","children","React","useProjectModel","context"]}
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{e as r,h as t}from"./chunk-GP3K4JBG.js";import{a as f,b as a}from"./chunk-62WSEYFO.js";import{a as i}from"./chunk-CUZEHDNU.js";import{c as s,e as c}from"./chunk-XALHWW5N.js";import{i as n}from"./chunk-UO4ZAUJK.js";n();n();n();import{join as g}from"node:path";var C=g("src","dependencies.config.json"),p=i.object({siteId:i.string().uuid(),uiVersion:i.string()}),x=i.object({dependencies:i.record(i.string())});function v(e){return g(e,C)}async function l(e,o){await f(t(e),o,{spaces:2})}async function d(e){let o=await a(t(e));try{return p.parse(o)}catch(m){throw new s({code:c.InvalidVeloConfigJson({configFilename:r,cause:m})})}}async function D(e){let o=await d(e);return{projectFolder:e,metaSiteId:o.siteId,revision:o.uiVersion}}async function M(e){let o={siteId:e.metaSiteId,uiVersion:e.revision};await l(e.projectFolder,o)}export{C as a,x as b,v as c,D as d,M as e};
4
- //# sourceMappingURL=chunk-65R7SBZ5.js.map
3
+ import{e as r,j as t}from"./chunk-WICGWF4N.js";import{a as f,b as a}from"./chunk-EE5EBGQ7.js";import{a as i}from"./chunk-CUZEHDNU.js";import{c as s,e as c}from"./chunk-TCTTRAWM.js";import{i as n}from"./chunk-UO4ZAUJK.js";n();n();n();import{join as g}from"node:path";var C=g("src","dependencies.config.json"),p=i.object({siteId:i.string().uuid(),uiVersion:i.string()}),x=i.object({dependencies:i.record(i.string())});function v(e){return g(e,C)}async function l(e,o){await f(t(e),o,{spaces:2})}async function d(e){let o=await a(t(e));try{return p.parse(o)}catch(m){throw new s({code:c.InvalidVeloConfigJson({configFilename:r,cause:m})})}}async function D(e){let o=await d(e);return{projectFolder:e,metaSiteId:o.siteId,revision:o.uiVersion}}async function M(e){let o={siteId:e.metaSiteId,uiVersion:e.revision};await l(e.projectFolder,o)}export{C as a,x as b,v as c,D as d,M as e};
4
+ //# sourceMappingURL=chunk-E7Z3EVGI.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{b as i}from"./chunk-CUZEHDNU.js";import{c as a,e as s}from"./chunk-XALHWW5N.js";import{i as o}from"./chunk-UO4ZAUJK.js";o();import{access as m,readFile as f,writeFile as c,mkdir as u}from"node:fs/promises";import{dirname as p,join as k,relative as x}from"node:path";import{EOL as g}from"node:os";function d(r,e){return JSON.stringify(r,null,e?.spaces).concat(g)}async function v(r,e,t){try{let n=d(e,t);await u(p(r),{recursive:!0}),await c(r,n,"utf-8")}catch(n){throw new a({code:s.FailedToWriteJson({filePath:r,cause:n}),cause:n})}}async function b(r){let e=null;try{e=await f(r,"utf-8")}catch(t){throw new a({code:s.FailedToReadJson({filePath:r,cause:t})})}try{return JSON.parse(e)}catch(t){throw new a({code:s.InvalidJsonFile({filePath:r,cause:t})})}}function E(r){return m(r).then(()=>!0).catch(()=>!1)}async function F(r,e){await u(p(r),{recursive:!0}),await c(r,e,"utf-8")}o();import{resolve as w}from"node:path";import{homedir as h}from"node:os";function O(){return i().dataDir??w(h(),".wix")}export{v as a,b,E as c,F as d,O as e};
4
- //# sourceMappingURL=chunk-62WSEYFO.js.map
3
+ import{b as i}from"./chunk-CUZEHDNU.js";import{c as a,e as s}from"./chunk-TCTTRAWM.js";import{i as o}from"./chunk-UO4ZAUJK.js";o();import{access as m,readFile as f,writeFile as c,mkdir as u}from"node:fs/promises";import{dirname as p,join as k,relative as x}from"node:path";import{EOL as g}from"node:os";function d(r,e){return JSON.stringify(r,null,e?.spaces).concat(g)}async function v(r,e,t){try{let n=d(e,t);await u(p(r),{recursive:!0}),await c(r,n,"utf-8")}catch(n){throw new a({code:s.FailedToWriteJson({filePath:r,cause:n}),cause:n})}}async function b(r){let e=null;try{e=await f(r,"utf-8")}catch(t){throw new a({code:s.FailedToReadJson({filePath:r,cause:t})})}try{return JSON.parse(e)}catch(t){throw new a({code:s.InvalidJsonFile({filePath:r,cause:t})})}}function E(r){return m(r).then(()=>!0).catch(()=>!1)}async function F(r,e){await u(p(r),{recursive:!0}),await c(r,e,"utf-8")}o();import{resolve as w}from"node:path";import{homedir as h}from"node:os";function O(){return i().dataDir??w(h(),".wix")}export{v as a,b,E as c,F as d,O as e};
4
+ //# sourceMappingURL=chunk-EE5EBGQ7.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as D}from"./chunk-TMNJT4K2.js";import{a as L,b as v,c as k}from"./chunk-JQMLRPCS.js";import{k as $}from"./chunk-SEHFPYSE.js";import{c as t}from"./chunk-ZBJRW65P.js";import{e as w}from"./chunk-GP3K4JBG.js";import{b as T}from"./chunk-CUZEHDNU.js";import{c as R,e as P}from"./chunk-XALHWW5N.js";import{i as y}from"./chunk-UO4ZAUJK.js";y();async function te({type:e,authState:i},_,g){let{minRetryTimeout:b}=T(),m={type:e,getAppToken:i?.getAccessToken,createHeaders:i?.getRequestHeaders};try{return await(g?k(()=>v(m).request(_),{...g,minTimeout:b}):v(m).request(_))}catch(l){throw L(l)&&l.response?.status===403?new R({code:P.PermissionDenied(),cause:l}):l}}y();function pe({t:e}){let i=D(),_=()=>i.log(t.dim(e("general.aborting"))),g=()=>{let n=i.logWithLoader({text:e("dev_command.syncing_local_code_start"),discardStdin:!1});return{success:()=>{let o=e("dev_command.syncing_local_code_end");return n.succeed(o),o},fail:()=>n.stop()}},b=({revision:n})=>{let o=e("dev_command.revision_created",{revision:n,configFileName:w});return i.log(o),o},m=n=>{let o=x(n);i.logWithLoader(e("dev_command.failed_to_delete_types_dir",{cause:o})).fail(),u()},l=n=>{let o=i.logWithLoader({text:e("dev_command.syncing_types_to_revision_start",{revision:n})});return{success:()=>{o.succeed(e("dev_command.syncing_types_to_revision_end",{revision:n}))},fail:()=>{o.fail(e("dev_command.syncing_types_to_revision_fail_line1")),i.log(` ${e("dev_command.syncing_types_to_revision_fail_line2")}`),u(),i.log(` ${e("dev_command.syncing_types_to_revision_fail_line3")}`),u()}}},C=n=>{let o=i.logWithLoader({text:e("dev_command.syncing_pages_to_revision_start",{revision:n}),discardStdin:!1});return{success:()=>{o.succeed(e("dev_command.syncing_pages_to_revision_end",{revision:n}))},fail:()=>o.fail()}},u=()=>i.log(""),O=({dependencyName:n,dependencyVersion:o})=>i.log(t.green(e("dependencies.dependency_installed",{dependency:t.bold.green(`${n}${o?`@${o}`:""}`)}))),S=(n,o)=>{let r=i.logWithLoader({text:t.yellow(e("dependencies.installing_dependency",{dependency:t.bold.yellow(`${n}${o?`@${o}`:""}`)}))});return()=>{r.stop(),O({dependencyName:n,dependencyVersion:o})}},A=()=>i.log(t.green(e("dependencies.all_dependencies_installed"))),N=()=>{let n=i.logWithLoader({text:t.yellow(e("dependencies.installing_all_dependencies"))});return()=>{n.stop(),A()}},F=({dependencyName:n})=>i.log(t.green(e("dependencies.dependency_uninstalled",{dependency:t.bold.green(n)})));return{t:e,logAborting:_,logSyncingLocalCode:g,logRecoverableFailureToRemoveTypesDir:m,logUpdatedLocalCodeToRevision:b,logSyncingPagesToRevision:C,logSyncingTypesToRevision:l,logDependencyInstalling:S,logDependencyUninstalling:n=>{let o=i.logWithLoader({text:t.yellow(e("dependencies.uninstalling_dependency",{dependency:t.bold.yellow(n)}))});return()=>{o.stop(),F({dependencyName:n})}},logAllDependenciesInstalling:N,logOpeningBrowser:n=>{i.log(e("dev_command.opening_browser")),n&&i.log(e("dev_command.dev_server_url.approve_cert"))},logNoOpenedTab:n=>{let o=e("dev_command.no_open_editor",{key:t.bold.italic("e"),link:n});return i.log(o),o},logPublishRevision:({branchName:n,isLocalDeployment:o,currentRevision:r,latestRevision:p,preview:a})=>i.log(`
3
+ import{a as D}from"./chunk-TMNJT4K2.js";import{a as L,b as v,c as k}from"./chunk-JYYNYTCQ.js";import{k as $}from"./chunk-4BTCJXQC.js";import{c as t}from"./chunk-ZBJRW65P.js";import{e as w}from"./chunk-WICGWF4N.js";import{b as T}from"./chunk-CUZEHDNU.js";import{c as R,e as P}from"./chunk-TCTTRAWM.js";import{i as y}from"./chunk-UO4ZAUJK.js";y();async function te({type:e,authState:i},_,g){let{minRetryTimeout:b}=T(),m={type:e,getAppToken:i?.getAccessToken,createHeaders:i?.getRequestHeaders};try{return await(g?k(()=>v(m).request(_),{...g,minTimeout:b}):v(m).request(_))}catch(l){throw L(l)&&l.response?.status===403?new R({code:P.PermissionDenied(),cause:l}):l}}y();function pe({t:e}){let i=D(),_=()=>i.log(t.dim(e("general.aborting"))),g=()=>{let n=i.logWithLoader({text:e("dev_command.syncing_local_code_start"),discardStdin:!1});return{success:()=>{let o=e("dev_command.syncing_local_code_end");return n.succeed(o),o},fail:()=>n.stop()}},b=({revision:n})=>{let o=e("dev_command.revision_created",{revision:n,configFileName:w});return i.log(o),o},m=n=>{let o=x(n);i.logWithLoader(e("dev_command.failed_to_delete_types_dir",{cause:o})).fail(),u()},l=n=>{let o=i.logWithLoader({text:e("dev_command.syncing_types_to_revision_start",{revision:n})});return{success:()=>{o.succeed(e("dev_command.syncing_types_to_revision_end",{revision:n}))},fail:()=>{o.fail(e("dev_command.syncing_types_to_revision_fail_line1")),i.log(` ${e("dev_command.syncing_types_to_revision_fail_line2")}`),u(),i.log(` ${e("dev_command.syncing_types_to_revision_fail_line3")}`),u()}}},C=n=>{let o=i.logWithLoader({text:e("dev_command.syncing_pages_to_revision_start",{revision:n}),discardStdin:!1});return{success:()=>{o.succeed(e("dev_command.syncing_pages_to_revision_end",{revision:n}))},fail:()=>o.fail()}},u=()=>i.log(""),O=({dependencyName:n,dependencyVersion:o})=>i.log(t.green(e("dependencies.dependency_installed",{dependency:t.bold.green(`${n}${o?`@${o}`:""}`)}))),S=(n,o)=>{let r=i.logWithLoader({text:t.yellow(e("dependencies.installing_dependency",{dependency:t.bold.yellow(`${n}${o?`@${o}`:""}`)}))});return()=>{r.stop(),O({dependencyName:n,dependencyVersion:o})}},A=()=>i.log(t.green(e("dependencies.all_dependencies_installed"))),N=()=>{let n=i.logWithLoader({text:t.yellow(e("dependencies.installing_all_dependencies"))});return()=>{n.stop(),A()}},F=({dependencyName:n})=>i.log(t.green(e("dependencies.dependency_uninstalled",{dependency:t.bold.green(n)})));return{t:e,logAborting:_,logSyncingLocalCode:g,logRecoverableFailureToRemoveTypesDir:m,logUpdatedLocalCodeToRevision:b,logSyncingPagesToRevision:C,logSyncingTypesToRevision:l,logDependencyInstalling:S,logDependencyUninstalling:n=>{let o=i.logWithLoader({text:t.yellow(e("dependencies.uninstalling_dependency",{dependency:t.bold.yellow(n)}))});return()=>{o.stop(),F({dependencyName:n})}},logAllDependenciesInstalling:N,logOpeningBrowser:n=>{i.log(e("dev_command.opening_browser")),n&&i.log(e("dev_command.dev_server_url.approve_cert"))},logNoOpenedTab:n=>{let o=e("dev_command.no_open_editor",{key:t.bold.italic("e"),link:n});return i.log(o),o},logPublishRevision:({branchName:n,isLocalDeployment:o,currentRevision:r,latestRevision:p,preview:a})=>i.log(`
4
4
  ${a?`${e("publish_command.publish_details_preview")}
5
5
  ${t.underline(t.blue(a.deploymentShortUrl??a.deploymentUrl))}`:""}
6
6
 
@@ -29,4 +29,4 @@ ${a}
29
29
  `,d.description){let c=JSON.parse(d.description);for(let h in c)s+=`
30
30
  ${f}${o} ${h} | `,s+=W(c[h].toString())}}),s+=`
31
31
  ${a}`,i.log(s)},logPreviewing:()=>{let n=i.logWithLoader({text:e("publish_command.creating_preview"),discardStdin:!1});return{success:()=>n.succeed(e("publish_command.creating_preview_success")),fail:()=>n.fail(e("publish_command.creating_preview_failed")),stop:()=>n.stop()}}}}function x(e){return e instanceof Error?e.message:JSON.stringify(e)}export{te as a,pe as b};
32
- //# sourceMappingURL=chunk-5LAMPYWD.js.map
32
+ //# sourceMappingURL=chunk-EFB2I2BN.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as v}from"./chunk-KPKBCH3A.js";import{r as y}from"./chunk-JQMLRPCS.js";import{a as s,c as a,i as u}from"./chunk-UO4ZAUJK.js";var E=a((H,x)=>{"use strict";u();x.exports=p;p.sync=F;var m=s("fs");function A(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var n=0;n<t.length;n++){var i=t[n].toLowerCase();if(i&&r.substr(-i.length).toLowerCase()===i)return!0}return!1}function h(r,e,t){return!r.isSymbolicLink()&&!r.isFile()?!1:A(e,t)}function p(r,e,t){m.stat(r,function(n,i){t(n,n?!1:h(i,r,e))})}function F(r,e){return h(m.statSync(r),r,e)}});var C=a((X,k)=>{"use strict";u();k.exports=I;I.sync=U;var S=s("fs");function I(r,e,t){S.stat(r,function(n,i){t(n,n?!1:w(i,e))})}function U(r,e){return w(S.statSync(r),e)}function w(r,e){return r.isFile()&&W(r,e)}function W(r,e){var t=r.mode,n=r.uid,i=r.gid,c=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),l=parseInt("100",8),g=parseInt("010",8),L=parseInt("001",8),T=l|g,P=t&L||t&g&&i===o||t&l&&n===c||t&T&&c===0;return P}});var B=a((z,q)=>{"use strict";u();var j=s("fs"),f;process.platform==="win32"||global.TESTING_WINDOWS?f=E():f=C();q.exports=d;d.sync=b;function d(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){d(r,e||{},function(c,o){c?i(c):n(o)})})}f(r,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),t(n,i)})}function b(r,e){try{return f.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});u();async function O({metaSiteId:r,biLogger:e,errorReporter:t}){let n=await y(r,e,t);return t.setUser({id:n.userInfo.userId}),v(e,n.userInfo.userId),n}export{O as a,B as b};
4
- //# sourceMappingURL=chunk-67FBXKWP.js.map
3
+ import{a as v}from"./chunk-JGPN7XZF.js";import{r as y}from"./chunk-JYYNYTCQ.js";import{a as s,c as a,i as u}from"./chunk-UO4ZAUJK.js";var E=a((H,x)=>{"use strict";u();x.exports=p;p.sync=F;var m=s("fs");function A(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var n=0;n<t.length;n++){var i=t[n].toLowerCase();if(i&&r.substr(-i.length).toLowerCase()===i)return!0}return!1}function h(r,e,t){return!r.isSymbolicLink()&&!r.isFile()?!1:A(e,t)}function p(r,e,t){m.stat(r,function(n,i){t(n,n?!1:h(i,r,e))})}function F(r,e){return h(m.statSync(r),r,e)}});var C=a((X,k)=>{"use strict";u();k.exports=I;I.sync=U;var S=s("fs");function I(r,e,t){S.stat(r,function(n,i){t(n,n?!1:w(i,e))})}function U(r,e){return w(S.statSync(r),e)}function w(r,e){return r.isFile()&&W(r,e)}function W(r,e){var t=r.mode,n=r.uid,i=r.gid,c=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),l=parseInt("100",8),g=parseInt("010",8),L=parseInt("001",8),T=l|g,P=t&L||t&g&&i===o||t&l&&n===c||t&T&&c===0;return P}});var B=a((z,q)=>{"use strict";u();var j=s("fs"),f;process.platform==="win32"||global.TESTING_WINDOWS?f=E():f=C();q.exports=d;d.sync=b;function d(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){d(r,e||{},function(c,o){c?i(c):n(o)})})}f(r,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),t(n,i)})}function b(r,e){try{return f.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});u();async function O({metaSiteId:r,biLogger:e,errorReporter:t}){let n=await y(r,e,t);return t.setUser({id:n.userInfo.userId}),v(e,n.userInfo.userId),n}export{O as a,B as b};
4
+ //# sourceMappingURL=chunk-FPM2JVPR.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{v as o}from"./chunk-SEHFPYSE.js";import{i}from"./chunk-UO4ZAUJK.js";i();var n={"site_dev_command_def.option.https":"Start local dev server on https","site_dev_command_def.description":"Open the Local Editor that runs your local code","site_install_command_def.description":"Install a supported NPM package","site_install_command_def.argument.package":"npm package name","site_install_command_def.option.yarn":"yarn","site_install_command_def.option.npm":"npm","site_preview_command_def.description":"Create a shareable version of your site before going live","site_preview_command_def.option.source":"The location of the source files to use for the preview version","site_publish_command_def.description":"Publish your site to production","site_publish_command_def.option.source":"The location of the source files to use for the published version","site_publish_command_def.option.force":"Skip build errors and proceed with the operation","site_publish_command_def.option.approve_preview":"Approve preview automatically","site_uninstall_command_def.description":"Uninstall an NPM package","site_uninstall_command_def.argument.package":"npm package name","site_uninstall_command_def.option.yarn":"yarn","site_uninstall_command_def.option.npm":"npm","general.aborting":"Aborting...","dev_command.syncing_local_code_start":"Syncing local code files with the Local Editor...","dev_command.syncing_local_code_end":"Local code files were synced with the Local Editor","dev_command.failed_to_delete_types_dir":"Failed to delete types data: {cause}","dev_command.revision_created":"Revision {revision} with the latest Editor changes has been created and saved to {configFileName}.","dev_command.syncing_types_to_revision_start":"Syncing types for your local UI version {revision} to local code files\u2026","dev_command.syncing_types_to_revision_end":"Synced types for your local UI version {revision} to local code files","dev_command.syncing_types_to_revision_fail_line1":"An error occurred while loading extension IDs and types.","dev_command.syncing_types_to_revision_fail_line2":"You can continue developing your site but some error checking and auto-completion will be disabled.","dev_command.syncing_types_to_revision_fail_line3":"We are aware of this problem and are working to correct it. Thanks for your patience.","dev_command.syncing_pages_to_revision_start":"Syncing pages for your local UI version {revision} to local code files\u2026","dev_command.syncing_pages_to_revision_end":"Synced pages for your local UI version {revision} to local code files","dev_command.opening_browser":"Opening the Local Editor","dev_command.dev_server_url.approve_cert":"Please approve the local dev server certificate if it is required.","dev_command.no_open_editor":"There is no Local Editor tab open. Press {key} to reopen the Local Editor or open the following link: {link}","dependencies.dependency_installed":"{dependency} was successfully installed.","dependencies.dependency_uninstalled":"{dependency} successfully uninstalled.","dependencies.installing_dependency":"Installing {dependency}...","dependencies.uninstalling_dependency":"Uninstalling {dependency}...","dependencies.all_dependencies_installed":"Dependencies were successfully installed.","dependencies.installing_all_dependencies":"Installing dependencies...","publish_command.prompt_what_to_publish":"What would you like to publish?","publish_command.prompt_what_to_publish_choice_remote":"Remote - {branchName}","publish_command.prompt_what_to_publish_choice_remote_fallback":"Remote - default branch","publish_command.prompt_what_to_publish_choice_local":"Local code","publish_command.prompt_continue_with_publish":"Continue with publish?","publish_command.prompt_publish_with_error":"Are you sure you want to continue with publish?","publish_command.publishing":"Publishing...","publish_command.published":"Your site has been published successfully: {url}","publish_command.publish_aborted":"Publishing aborted","publish_command.publish_details_preview":"Preview your site before publishing:","publish_command.publish_details_about_to_publish":"You are about to publish:","publish_command.publish_details_ui_version":"UI version: {revision}","publish_command.publish_details_newer_editor_version_caution_title":"Caution","publish_command.publish_details_newer_editor_version_caution_details":"The Editor contains newer design changes. To publish the latest UI changes, cancel this operation, click 'Save' in the local Editor, then run `wix publish` again.","publish_command.publish_details_local_caution_title":"Caution","publish_command.publish_details_local_caution_details":"Publishing from the local working copy might publish code that is uncommitted and not synced with the online editor.","publish_command.publish_details_newer_editor_version_link_text":"Learn more about UI versions","publish_command.publish_details_newer_editor_version_link_url":"https://support.wix.com/en/article/velo-working-with-the-local-editor-early-access#about-ui-versions","publish_command.publish_with_errors_caution_title":"Caution","publish_command.publish_with_errors_caution_details":"Build failed with code errors that will impact your published version.","publish_command.publish_pipeline_error_badge":"[ERROR]","publish_command.publish_pipeline_error_title":"Errors in your site\u2019s code were found while trying to build your custom code. See output below:","publish_command.failed_getting_latest_revision":"Failed to get the latest UI revision, continuing without it. Cause: {cause}","publish_command.deploying":"Deploying your code...","publish_command.generic_task_done":"Done","publish_command.generic_task_failed":"Failed","publish_command.creating_preview":"Creating a preview...","publish_command.creating_preview_success":"Preview created successfully","publish_command.creating_preview_failed":"Creating a preview failed","preview_command.prompt_what_to_preview":"What would you like to preview?","preview_command.prompt_what_to_preview_choice_latest":"Latest commit from {branchName}","preview_command.prompt_what_to_preview_choice_latest_fallback":"Latest commit from the default branch","preview_command.prompt_what_to_preview_choice_local":"Local code","preview_command.creating_preview":"Creating preview deployment...","preview_command.preview_created":"Your preview deployment is now available at {url}","preview_command.preview_unsupported":"Preview for unpublished sites is currently unsupported. Please publish your site first.","preview_command.preview_branch_local_code":"Local code","preview_command.preview_branch_remote":"Remote branch: {branchName}","install_command.migrating_to_any_npm":"We\u2019ve noticed you are using an older package installation flow, we\u2019ll be migrating your project to use the updated one. This change includes moving installed packages from dev dependencies to dependencies and replacing the velo.dependencies.json file with a new wix.lock file","install_command.starting_migrating_to_any_npm":"Stating the migration\u2026",migration_to_any_npm_failed:"Migration failed\nCause: ${cause}","install_command.migration_to_any_npm_success":"Migration completed successfully!"};function r(){let e=o(n);return e.t.bind(e)}export{r as a};
4
- //# sourceMappingURL=chunk-CLX2F62J.js.map
3
+ import{v as o}from"./chunk-4BTCJXQC.js";import{i}from"./chunk-UO4ZAUJK.js";i();var n={"site_dev_command_def.option.https":"Start local dev server on https","site_dev_command_def.description":"Open the Local Editor that runs your local code","site_install_command_def.description":"Install a supported NPM package","site_install_command_def.argument.package":"npm package name","site_install_command_def.option.yarn":"yarn","site_install_command_def.option.npm":"npm","site_preview_command_def.description":"Create a shareable version of your site before going live","site_preview_command_def.option.source":"The location of the source files to use for the preview version","site_publish_command_def.description":"Publish your site to production","site_publish_command_def.option.source":"The location of the source files to use for the published version","site_publish_command_def.option.force":"Skip build errors and proceed with the operation","site_publish_command_def.option.approve_preview":"Approve preview automatically","site_uninstall_command_def.description":"Uninstall an NPM package","site_uninstall_command_def.argument.package":"npm package name","site_uninstall_command_def.option.yarn":"yarn","site_uninstall_command_def.option.npm":"npm","general.aborting":"Aborting...","dev_command.syncing_local_code_start":"Syncing local code files with the Local Editor...","dev_command.syncing_local_code_end":"Local code files were synced with the Local Editor","dev_command.failed_to_delete_types_dir":"Failed to delete types data: {cause}","dev_command.revision_created":"Revision {revision} with the latest Editor changes has been created and saved to {configFileName}.","dev_command.syncing_types_to_revision_start":"Syncing types for your local UI version {revision} to local code files\u2026","dev_command.syncing_types_to_revision_end":"Synced types for your local UI version {revision} to local code files","dev_command.syncing_types_to_revision_fail_line1":"An error occurred while loading extension IDs and types.","dev_command.syncing_types_to_revision_fail_line2":"You can continue developing your site but some error checking and auto-completion will be disabled.","dev_command.syncing_types_to_revision_fail_line3":"We are aware of this problem and are working to correct it. Thanks for your patience.","dev_command.syncing_pages_to_revision_start":"Syncing pages for your local UI version {revision} to local code files\u2026","dev_command.syncing_pages_to_revision_end":"Synced pages for your local UI version {revision} to local code files","dev_command.opening_browser":"Opening the Local Editor","dev_command.dev_server_url.approve_cert":"Please approve the local dev server certificate if it is required.","dev_command.no_open_editor":"There is no Local Editor tab open. Press {key} to reopen the Local Editor or open the following link: {link}","dependencies.dependency_installed":"{dependency} was successfully installed.","dependencies.dependency_uninstalled":"{dependency} successfully uninstalled.","dependencies.installing_dependency":"Installing {dependency}...","dependencies.uninstalling_dependency":"Uninstalling {dependency}...","dependencies.all_dependencies_installed":"Dependencies were successfully installed.","dependencies.installing_all_dependencies":"Installing dependencies...","publish_command.prompt_what_to_publish":"What would you like to publish?","publish_command.prompt_what_to_publish_choice_remote":"Remote - {branchName}","publish_command.prompt_what_to_publish_choice_remote_fallback":"Remote - default branch","publish_command.prompt_what_to_publish_choice_local":"Local code","publish_command.prompt_continue_with_publish":"Continue with publish?","publish_command.prompt_publish_with_error":"Are you sure you want to continue with publish?","publish_command.publishing":"Publishing...","publish_command.published":"Your site has been published successfully: {url}","publish_command.publish_aborted":"Publishing aborted","publish_command.publish_details_preview":"Preview your site before publishing:","publish_command.publish_details_about_to_publish":"You are about to publish:","publish_command.publish_details_ui_version":"UI version: {revision}","publish_command.publish_details_newer_editor_version_caution_title":"Caution","publish_command.publish_details_newer_editor_version_caution_details":"The Editor contains newer design changes. To publish the latest UI changes, cancel this operation, click 'Save' in the local Editor, then run `wix publish` again.","publish_command.publish_details_local_caution_title":"Caution","publish_command.publish_details_local_caution_details":"Publishing from the local working copy might publish code that is uncommitted and not synced with the online editor.","publish_command.publish_details_newer_editor_version_link_text":"Learn more about UI versions","publish_command.publish_details_newer_editor_version_link_url":"https://support.wix.com/en/article/velo-working-with-the-local-editor-early-access#about-ui-versions","publish_command.publish_with_errors_caution_title":"Caution","publish_command.publish_with_errors_caution_details":"Build failed with code errors that will impact your published version.","publish_command.publish_pipeline_error_badge":"[ERROR]","publish_command.publish_pipeline_error_title":"Errors in your site\u2019s code were found while trying to build your custom code. See output below:","publish_command.failed_getting_latest_revision":"Failed to get the latest UI revision, continuing without it. Cause: {cause}","publish_command.deploying":"Deploying your code...","publish_command.generic_task_done":"Done","publish_command.generic_task_failed":"Failed","publish_command.creating_preview":"Creating a preview...","publish_command.creating_preview_success":"Preview created successfully","publish_command.creating_preview_failed":"Creating a preview failed","preview_command.prompt_what_to_preview":"What would you like to preview?","preview_command.prompt_what_to_preview_choice_latest":"Latest commit from {branchName}","preview_command.prompt_what_to_preview_choice_latest_fallback":"Latest commit from the default branch","preview_command.prompt_what_to_preview_choice_local":"Local code","preview_command.creating_preview":"Creating preview deployment...","preview_command.preview_created":"Your preview deployment is now available at {url}","preview_command.preview_unsupported":"Preview for unpublished sites is currently unsupported. Please publish your site first.","preview_command.preview_branch_local_code":"Local code","preview_command.preview_branch_remote":"Remote branch: {branchName}","install_command.migrating_to_any_npm":"We\u2019ve noticed you are using an older package installation flow, we\u2019ll be migrating your project to use the updated one. This change includes moving installed packages from dev dependencies to dependencies and replacing the velo.dependencies.json file with a new wix.lock file","install_command.starting_migrating_to_any_npm":"Stating the migration\u2026",migration_to_any_npm_failed:"Migration failed\nCause: ${cause}","install_command.migration_to_any_npm_success":"Migration completed successfully!"};function r(){let e=o(n);return e.t.bind(e)}export{r as a};
4
+ //# sourceMappingURL=chunk-J4J4RXMY.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{c as Pe,d as R,e as S}from"./chunk-BQHRJORL.js";import{a as Ee,e as O,g as U,h as G,k as Be}from"./chunk-GZENQUN7.js";import{k as I}from"./chunk-GP3K4JBG.js";import{b as z}from"./chunk-CUZEHDNU.js";import{f as Q,g as H}from"./chunk-XALHWW5N.js";import{c as m,e as T,i as u}from"./chunk-UO4ZAUJK.js";var E=m((zt,p)=>{"use strict";u();var Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r};function Ne(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function qe(r,t){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:r}function Ve(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(r,t):r.__proto__=t)}var y=function(r){Ve(t,r);function t(e){Ne(this,t);var n=qe(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.name=n.constructor.name,n}return t}(Error);function Ae(r,t){if(r===void 0)throw new y(t)}function ze(r,t){if(r!==void 0&&((typeof r>"u"?"undefined":Me(r))!=="object"||Array.isArray(r)||r===null))throw new y(t)}function Qe(r,t){if(!r)throw new y(t)}function He(r,t){if(r!==void 0&&typeof r!="function")throw new y(t)}function Ue(r,t){if(r!==void 0&&typeof r!="boolean")throw new y(t)}function Ge(r,t){if(r!==void 0&&typeof r!="number")throw new y(t)}function Re(r,t){if(typeof Array.isArray=="function"){if(!Array.isArray(r))throw new y(t)}else if(Object.prototype.toString.call(r)!=="[object Array]")throw new y(t)}p.exports.defined=Ae;p.exports.object=ze;p.exports.ok=Qe;p.exports.func=He;p.exports.boolean=Ue;p.exports.number=Ge;p.exports.array=Re;p.exports.AssertionError=y});var Y=m((Ht,C)=>{"use strict";u();C.exports.mapValues=function(r,t){return r?Object.keys(r).reduce(function(e,n){return e[n]=t(r[n],n,r),e},{}):{}};C.exports.filterValues=function(r,t){return r?Object.keys(r).reduce(function(e,n){var i=t(r[n],n,r);return i&&(e[n]=r[n]),e},{}):{}}});var Z=m((Gt,F)=>{"use strict";u();F.exports.timedPromise=function(r,t){var e=t.message,n=t.timeout,i=new Promise(function(a,o){setTimeout(o,n,e?"Timeout: "+e:"Timeout")});return Promise.race([r,i])};F.exports.allAsObject=function(r){var t=Object.keys(r);return Promise.all(t.map(function(e){return r[e]})).then(function(e){return e.reduce(function(n,i,a){return n[t[a]]=i,n},{})})}});var K=m((It,$)=>{"use strict";u();$.exports={error:function(){if(console&&console.error){var t;(t=console).error.apply(t,arguments)}}}});var te=m((Wt,ee)=>{"use strict";u();function Ie(r,t,e){var n=void 0;return function(){var i=this,a=arguments,o=function(){n=null,e||r.apply(i,a)},s=e&&!n;clearTimeout(n),n=setTimeout(o,t),s&&r.apply(i,a)}}ee.exports=Ie});var ne=m((Yt,re)=>{"use strict";u();function Je(r,t){var e=void 0;return function(){for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];e||(e=setTimeout(function(){r.apply(void 0,i),e=null},t))}}re.exports=Je});var B=m(($t,ie)=>{"use strict";u();var We=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),Xe=function(){function r(t,e){var n=[],i=!0,a=!1,o=void 0;try{for(var s=t[Symbol.iterator](),h;!(i=(h=s.next()).done)&&(n.push(h.value),!(e&&n.length===e));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&s.return&&s.return()}finally{if(a)throw o}}return n}return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return r(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),L=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r};function Ye(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var Ze=te(),$e=ne(),Ke=function(t,e,n){return{dt:Date.now()-n,f:t,context:e}},et=function(t,e){return{dt:Date.now()-e,e:t,g:{}}},tt=function(t){var e={},n=t.e.length,i=t.e.map(function(o){var s=Object.keys(o.f).map(function(h){var c=o.f[h],f=h+"|"+c;return e[f]=e[f]||0,e[f]++,[h,c,f]});return L({},o,{f:s})}),a={};return i=i.map(function(o){var s=o.f.reduce(function(h,c){var f=Xe(c,3),v=f[0],d=f[1],g=f[2];return e[g]===n?a[v]=d:h[v]=d,h},{});return L({},o,{f:s})}),L({},t,{e:i,g:a})},rt=function(){function r(){Ye(this,r),this._initilized=!1}return We(r,[{key:"_reset",value:function(){var e=this;this._startTime=Date.now(),this._resolve=null,this._promise=new Promise(function(n){return e._resolve=n})}},{key:"init",value:function(e,n){var i=this,a=e.delayMs,o=e.maxBatchSize,s=e.useThrottle,h=e.optimizeBatch;this._initilized||(this._maxBatchSize=o,this._optimizeBatch=h,this._queue=[],this._flushHandler=n,this._flushDebounced=s?$e(function(){return i.flush()},a):Ze(function(){return i.flush()},a),this._initilized=!0,this._reset())}},{key:"flush",value:function(){if(!this._queue.length)return Promise.resolve();var e=this._queue.splice(0,this._queue.length),n=this._resolve,i=this._startTime;this._reset();var a=et(e,i);return this._optimizeBatch&&(a=tt(a)),this._flushHandler(a).then(n)}},{key:"feed",value:function(e,n){return this._queue.push(Ke(e,n,this._startTime)),this._queue.length===this._maxBatchSize?this.flush():(this._flushDebounced(),this._promise)}}]),r}();ie.exports=rt});var ue=m((er,oe)=>{"use strict";u();var nt={functional:!0,analytics:!0,__default:!0},it=function(t){return typeof t=="function"&&t()||nt},ae=function(t){return t.functional===!1||t.analytics===!1},at=function(t,e){return e==="essential"?!1:e==="functional"||e==="analytics"?t[e]===!1:ae(t)};oe.exports={shouldMuteNonEssentials:ae,shouldMuteByCategory:at,getPolicy:it}});var N=m((rr,de)=>{"use strict";u();var x=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},ot=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}();function ut(r,t){var e={};for(var n in r)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}function st(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var D=E(),he=Y(),se=he.mapValues,le=he.filterValues,fe=Z(),lt=K(),ft=B(),M=ue(),ct=M.shouldMuteByCategory,ce=M.shouldMuteNonEssentials,ht=M.getPolicy,dt=function(){function r(t,e){st(this,r),this._publishers=t.publishers,this._validators=t.validators||[],this._defaults=t.defaults,this._ownDefaults={},this._events=t.events||{},this._context=e||{},this._defaultValueTimeout=t.defaultValueTimeout||5e3,this._defaultContinueOnFail=t.defaultContinueOnFail||!1,this._onPublisherFailHandler=t.onPublisherFailHandler||r._defaultPublisherFailHandler,this._isMuted=t.isMuted||function(){return!1},this._eventTransformer=t.eventTransformer||function(n){return n},this._payloadTransformer=t.payloadTransformer||function(n){return n},this._consentPolicyGetter=t.consentPolicyGetter||function(){return null},this._nonEssentialDefaults=t.nonEssentialDefaults||{},this._maxBatchSize=t.maxBatchSize||100,this._globalBatchQueue=t.globalBatchQueue}return ot(r,[{key:"report",value:function(e){D.defined(e,"Data must be provided"),D.object(e,"Data must be an object");var n=e.src,i=e.evid,a=e.params,o=ut(e,["src","evid","params"]);return this.log(x({src:n,evid:i},a),o)}},{key:"log",value:function(e,n,i){var a=this;D.defined(e,"Event object or event key must be provided.");var o=this._extractEventAndContext(e,n,i),s=o.event,h=o.context,c=ht(this._consentPolicyGetter),f=x({},this._context,h);if(this._isMuted()||ct(c,f.category))return Promise.resolve();if(f.useBatch){var v=this._initQueue(f,c),d=function(_){var P=a._eventTransformer(_,f);return v.feed(P,f)};if(this._globalBatchQueue)return this._getDefaults(this._defaults).then(function(w){var _=x({},w,a._getDynamicNonEssentialDefaults(c),a._getStaticNonEssentialDefaults(c),s,a._getPolicyFields(c,f.category));return d(_)});var g=x({},this._getDynamicDefaults(this._defaults),this._getDynamicNonEssentialDefaults(c),s,this._getPolicyFields(c,f.category));return d(g)}return this._getDefaults(this._defaults).then(function(w){var _=Object.assign(w,a._getDynamicNonEssentialDefaults(c),a._getStaticNonEssentialDefaults(c),s,a._getPolicyFields(c,f.category)),P=a._validators.length===0?!0:a._validators.some(function(A){return A.match(_)&&(A.execute(_)||!0)});if(!P)throw new Error("No validator accepted the event. Source: "+_.src+" Evid: "+(_.evid||_.evtId));var k=a._eventTransformer(_,f);return k=a._payloadTransformer(k,f),a._send(k,f)})}},{key:"flush",value:function(){return this._queue?this._queue.flush():Promise.resolve()}},{key:"updateDefaults",value:function(e){return D.defined(e,"Defaults must be provided"),D.object(e,"Defaults must be an object"),Object.assign(this._ownDefaults,e),this}},{key:"_send",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Promise.all(this._publishers.map(function(a){var o=x({},e);return Promise.resolve().then(function(){return a(o,i)}).catch(function(s){return n._onPublisherFailHandler(s,{publisherName:a.name,payload:e})})})).then(function(){})}},{key:"_extractEventAndContext",value:function(e,n,i){var a=void 0,o={};if(typeof e!="string")a=e,o=n||o;else{if(a=this._events[e],!a)throw new D.AssertionError("Event with key '"+e+"' not found in event map.");n&&(a=x({},a,n),o=i||o)}return{event:a,context:o}}},{key:"_initQueue",value:function(e,n){var i=this;if(this._queue)return this._queue;this._queue=this._globalBatchQueue||new ft;var a=function(s){i._globalBatchQueue||(s.g=Object.assign(i._getStaticDefaults(i._defaults),i._getStaticNonEssentialDefaults(n)));var h=i._payloadTransformer(s,e);return i._send(h,e)};return this._queue.init({delayMs:e.useBatch===!0?300:e.useBatch,maxBatchSize:this._maxBatchSize,useThrottle:!!this._globalBatchQueue,optimizeBatch:!!this._globalBatchQueue},a),this._queue}},{key:"_handleDefaultsError",value:function(e){return this._defaultContinueOnFail?(lt.error(e),null):Promise.reject(e)}},{key:"_getDynamicNonEssentialDefaults",value:function(e){if(!ce(e))return this._getDynamicDefaults(this._nonEssentialDefaults)}},{key:"_getStaticNonEssentialDefaults",value:function(e){if(!ce(e))return this._getStaticDefaults(this._nonEssentialDefaults)}},{key:"_withOwnDefaults",value:function(e){return Object.assign({},e,this._ownDefaults)}},{key:"_getDynamicDefaults",value:function(e){e=this._withOwnDefaults(e);var n=le(e,function(i){return typeof i=="function"});return se(n,function(i){return i()})}},{key:"_getStaticDefaults",value:function(e){e=this._withOwnDefaults(e);var n=le(e,function(i){return typeof i!="function"});return n}},{key:"_getDefaults",value:function(e){var n=this;if(e=this._withOwnDefaults(e),!e)return Promise.resolve({});var i=se(e,function(a,o){if(typeof a=="function")try{a=a()}catch(s){return n._handleDefaultsError(s)}return a&&typeof a.then=="function"?fe.timedPromise(a,{message:"Cannot get default value '"+o+" for BI Event'",timeout:n._defaultValueTimeout}).catch(function(s){return n._handleDefaultsError(s)}):a});return fe.allAsObject(i)}},{key:"_encodePolicyValue",value:function(e,n){return e?typeof e[n]=="boolean"?e[n]?1:0:e[n]:1}},{key:"_getPolicyFields",value:function(e,n){return{_isca:this._encodePolicyValue(e,"analytics"),_iscf:this._encodePolicyValue(e,"functional"),_ispd:e.__default?1:0,_ise:n==="essential"?1:0}}}],[{key:"_defaultPublisherFailHandler",value:function(e,n){var i=n.publisherName;return i}}]),r}();de.exports=dt});var q=m((ir,ge)=>{"use strict";u();var mt=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}();function vt(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var me=E(),ve=function(){function r(){vt(this,r),this.reset()}return mt(r,[{key:"reset",value:function(){this._handlers=[]}},{key:"onLoggerCreated",value:function(e){var n=this;return me.defined(e,"Handler must be provided."),me.func(e,"Handler must be a function."),this._handlers.push(e),function(){var i=n._handlers.indexOf(e);i!==-1&&n._handlers.splice(i,1)}}},{key:"notifyLoggerCreated",value:function(e){this._handlers.forEach(function(n){return n(e)})}}]),r}();ge.exports={manager:new ve,BiLoggerManager:ve}});var ye=m((or,_e)=>{"use strict";u();var gt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_t=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}();function yt(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var l=E(),pt=N(),bt=q(),wt=B(),xt=function(){function r(){yt(this,r),this._publishers=[],this._validators=[],this._defaults={},this._nonEssentialDefaults={},this._events={},this._isMuted=!1,this._eventTransformer=null,this._payloadTransformer=null,this._consentPolicyGetter=null,this._maxBatchSize=null,this._batchQueue=null}return _t(r,[{key:"addPublisher",value:function(e){return l.defined(e,"Publisher must be provided"),l.ok(typeof e=="function","Expected a publisher function"),this._publishers.push(e),this}},{key:"addValidator",value:function(e){return l.defined(e,"Validator must be provided"),l.ok((typeof e>"u"?"undefined":gt(e))==="object"&&e,"Expected a validator object"),l.ok(e.execute&&e.match,"Provided validator does not match the interface"),this._validators.push(e),this}},{key:"setDefaults",value:function(e){return l.defined(e,"Defaults must be provided"),l.object(e,"Defaults must be an object"),this._defaults=e,this}},{key:"updateDefaults",value:function(e){return l.defined(e,"Defaults must be provided"),l.object(e,"Defaults must be an object"),Object.assign(this._defaults,e),this}},{key:"updateNonEssentialDefaults",value:function(e){return l.defined(e,"Non-essential Defaults must be provided"),l.object(e,"Non-essential Defaults must be an object"),Object.assign(this._nonEssentialDefaults,e),this}},{key:"setEvents",value:function(e){return l.defined(e,"Events must be provided"),l.object(e,"Events must be an object"),this._events=e,this}},{key:"setDefaultValueTimeout",value:function(e){return l.defined(e,"Default Value Timeout must be provided"),this._defaultValueTimeout=e,this}},{key:"setDefaultContinueOnFail",value:function(e){return l.defined(e,"Default Continue On Fail must be provided"),this._defaultContinueOnFail=e,this}},{key:"setPublisherFailHandler",value:function(e){return l.defined(e,"Publisher Fail Handler must be provided"),this._onPublisherFailHandler=e,this}},{key:"setMuted",value:function(e){return l.defined(e,"Is Muted must be provided"),l.boolean(e,"Is Muted must be a boolean"),this._isMuted=e,this}},{key:"setMaxBatchSize",value:function(e){return l.defined(e,"Max Batch Size must be provided"),l.number(e,"Max Batch Size must be a number"),l.ok(e>0,"Max Batch Size must be higher than 0"),this._maxBatchSize=e,this}},{key:"setGlobalBatchQueue",value:function(e){return l.defined(e,"Global Batch Queue must be provided"),l.ok(e instanceof wt,"Global Batch Queue must be an instance of BatchQueue"),this._globalBatchQueue=e,this}},{key:"withEventTransformer",value:function(e){return l.defined(e,"Event Transformer must be provided"),l.func(e,"Event Transformer must be a function"),this._eventTransformer=e,this}},{key:"withPayloadTransformer",value:function(e){return l.defined(e,"Payload Transformer must be provided"),l.func(e,"Payload Transformer must be a function"),this._payloadTransformer=e,this}},{key:"withConsentPolicyGetter",value:function(e){return l.defined(e,"Consent Policy Getter must be provided"),l.func(e,"Consent Policy Getter must be a function"),this._consentPolicyGetter=e,this}},{key:"logger",value:function(e){var n=this,i=new pt({publishers:this._publishers,validators:this._validators,defaults:this._defaults,events:this._events,defaultValueTimeout:this._defaultValueTimeout,defaultContinueOnFail:this._defaultContinueOnFail,onPublisherFailHandler:this._onPublisherFailHandler,isMuted:function(){return n._isMuted},eventTransformer:this._eventTransformer,payloadTransformer:this._payloadTransformer,consentPolicyGetter:this._consentPolicyGetter,nonEssentialDefaults:this._nonEssentialDefaults,maxBatchSize:this._maxBatchSize,globalBatchQueue:this._globalBatchQueue},e);return bt.manager.notifyLoggerCreated(i),i}}]),r}();_e.exports=xt});var we=m((sr,b)=>{"use strict";u();var pe=ye(),Dt=N(),be=q(),Et=B();b.exports.BiLoggerFactory=pe;b.exports.BiLogger=Dt;b.exports.BiLoggerManager=be.BiLoggerManager;b.exports.factory=function(){return new pe};b.exports.manager=be.manager;b.exports.createBatchQueue=function(){return new Et}});u();import{randomUUID as ke}from"node:crypto";function Te(r,t){r.updateDefaults(j(t))}function j(r){return r?{_client_id:r,_uuid:r,logged_user_id:r,logged_account_id:r,target_account_id:r}:{_client_id:ke()}}u();import{uptime as Fe}from"node:process";u();var J=T(Ee(),1);import Oe from"node:os";import{platform as Se,version as je}from"node:process";function W({cliVersion:r,flow:t}){return{...t?{flow:t}:{},cliVersion:r,isCI:J.default,nodeVersion:je,osName:Ce(),osVersion:Oe.release()}}function Ce(){switch(Se){case"darwin":return"mac";case"win32":return"windows";default:return"linux"}}var X=()=>Math.round(Fe()*1e3);function Le({biLogger:r,command:t,flow:e,cliVersion:n,projectId:i,extensions:a,extraFields:o}){let s=t.opts(),h=t.args,c=new Set(["apiKey"]),f=Object.fromEntries(Object.entries(s).map(([d,g])=>{let w=c.has(d)?"<censored>":g;return[d,w]})),v={command:t.name(),arguments:h.join(","),flags:Object.keys(f).length?JSON.stringify(f):""};return r.report(R({...W({cliVersion:n,flow:e}),...v,...i?{projectId:i}:{},...o?{extraFields:JSON.stringify(o)}:{},isValid:!0})),{succeed(){r.report(S({...v,...a?{extensions:JSON.stringify(a)}:{},duration:X(),isSuccess:!0,isValid:!0}))},failed(d){let g=Q(d)?{errorType:H(d)?"SystemError":"UserError",errorName:d.name,errorMessage:d.message}:d instanceof Error?{errorType:"UnknownError",errorName:d.name,errorMessage:d.message}:{errorType:"UnknownError",errorMessage:JSON.stringify(d)};r.report(S({...v,...g,...a?{extensions:JSON.stringify(a)}:{},duration:X(),isSuccess:!1,isValid:!0}))}}}u();u();u();Be();var xe=T(we()),De=T(Pe()),Bt={baseUrl:process.env.BI_BASE_URL||"https://frog.wix.com",endpoint:"",logError:!1},V=function(){function r(){}return r.prototype.factory=function(t){var e=this;t===void 0&&(t={});var n=O(O({},Bt),t),i=xe.default.factory();return n.onError&&i.setPublisherFailHandler(n.onError),i.addPublisher(function(a,o){return U(e,void 0,void 0,function(){var s,h,c,f,v;return G(this,function(d){switch(d.label){case 0:return s=o.endpoint||n.endpoint,h=n.baseUrl,c=n.userAgent,f=n.logError,v=c?{headers:{"User-Agent":c}}:{},[4,new De.HttpClient({baseURL:h}).get(s,{headers:v,params:a,timeout:30*1e3}).catch(function(g){return f?console.error(g.toJSON()):Promise.reject(g)})];case 1:return d.sent(),[2]}})})}),i},r}();var cr=new V;async function Pt(r,t){let e=z().biLoggerBaseUrl,n=e?{baseUrl:e}:{},i=j(t),{telemetry:a}=await I();return new V().factory(n).updateDefaults({localTime:()=>Date.now(),...r,...i}).setMuted(!a).logger()}export{Te as a,Pt as b,Le as c};
4
- //# sourceMappingURL=chunk-KPKBCH3A.js.map
3
+ import{c as Pe,d as R,e as S}from"./chunk-TLPEI3DE.js";import{a as Ee,e as O,g as U,h as G,k as Be}from"./chunk-GZENQUN7.js";import{a as I}from"./chunk-K3QK4XYS.js";import{b as z}from"./chunk-CUZEHDNU.js";import{f as Q,g as H}from"./chunk-TCTTRAWM.js";import{c as m,e as T,i as u}from"./chunk-UO4ZAUJK.js";var E=m((zt,p)=>{"use strict";u();var Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r};function Ne(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function qe(r,t){if(!r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:r}function Ve(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(r,t):r.__proto__=t)}var y=function(r){Ve(t,r);function t(e){Ne(this,t);var n=qe(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.name=n.constructor.name,n}return t}(Error);function Ae(r,t){if(r===void 0)throw new y(t)}function ze(r,t){if(r!==void 0&&((typeof r>"u"?"undefined":Me(r))!=="object"||Array.isArray(r)||r===null))throw new y(t)}function Qe(r,t){if(!r)throw new y(t)}function He(r,t){if(r!==void 0&&typeof r!="function")throw new y(t)}function Ue(r,t){if(r!==void 0&&typeof r!="boolean")throw new y(t)}function Ge(r,t){if(r!==void 0&&typeof r!="number")throw new y(t)}function Re(r,t){if(typeof Array.isArray=="function"){if(!Array.isArray(r))throw new y(t)}else if(Object.prototype.toString.call(r)!=="[object Array]")throw new y(t)}p.exports.defined=Ae;p.exports.object=ze;p.exports.ok=Qe;p.exports.func=He;p.exports.boolean=Ue;p.exports.number=Ge;p.exports.array=Re;p.exports.AssertionError=y});var Y=m((Ht,C)=>{"use strict";u();C.exports.mapValues=function(r,t){return r?Object.keys(r).reduce(function(e,n){return e[n]=t(r[n],n,r),e},{}):{}};C.exports.filterValues=function(r,t){return r?Object.keys(r).reduce(function(e,n){var i=t(r[n],n,r);return i&&(e[n]=r[n]),e},{}):{}}});var Z=m((Gt,F)=>{"use strict";u();F.exports.timedPromise=function(r,t){var e=t.message,n=t.timeout,i=new Promise(function(a,o){setTimeout(o,n,e?"Timeout: "+e:"Timeout")});return Promise.race([r,i])};F.exports.allAsObject=function(r){var t=Object.keys(r);return Promise.all(t.map(function(e){return r[e]})).then(function(e){return e.reduce(function(n,i,a){return n[t[a]]=i,n},{})})}});var K=m((It,$)=>{"use strict";u();$.exports={error:function(){if(console&&console.error){var t;(t=console).error.apply(t,arguments)}}}});var te=m((Wt,ee)=>{"use strict";u();function Ie(r,t,e){var n=void 0;return function(){var i=this,a=arguments,o=function(){n=null,e||r.apply(i,a)},s=e&&!n;clearTimeout(n),n=setTimeout(o,t),s&&r.apply(i,a)}}ee.exports=Ie});var ne=m((Yt,re)=>{"use strict";u();function Je(r,t){var e=void 0;return function(){for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];e||(e=setTimeout(function(){r.apply(void 0,i),e=null},t))}}re.exports=Je});var B=m(($t,ie)=>{"use strict";u();var We=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}(),Xe=function(){function r(t,e){var n=[],i=!0,a=!1,o=void 0;try{for(var s=t[Symbol.iterator](),h;!(i=(h=s.next()).done)&&(n.push(h.value),!(e&&n.length===e));i=!0);}catch(c){a=!0,o=c}finally{try{!i&&s.return&&s.return()}finally{if(a)throw o}}return n}return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return r(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),L=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r};function Ye(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var Ze=te(),$e=ne(),Ke=function(t,e,n){return{dt:Date.now()-n,f:t,context:e}},et=function(t,e){return{dt:Date.now()-e,e:t,g:{}}},tt=function(t){var e={},n=t.e.length,i=t.e.map(function(o){var s=Object.keys(o.f).map(function(h){var c=o.f[h],f=h+"|"+c;return e[f]=e[f]||0,e[f]++,[h,c,f]});return L({},o,{f:s})}),a={};return i=i.map(function(o){var s=o.f.reduce(function(h,c){var f=Xe(c,3),v=f[0],d=f[1],g=f[2];return e[g]===n?a[v]=d:h[v]=d,h},{});return L({},o,{f:s})}),L({},t,{e:i,g:a})},rt=function(){function r(){Ye(this,r),this._initilized=!1}return We(r,[{key:"_reset",value:function(){var e=this;this._startTime=Date.now(),this._resolve=null,this._promise=new Promise(function(n){return e._resolve=n})}},{key:"init",value:function(e,n){var i=this,a=e.delayMs,o=e.maxBatchSize,s=e.useThrottle,h=e.optimizeBatch;this._initilized||(this._maxBatchSize=o,this._optimizeBatch=h,this._queue=[],this._flushHandler=n,this._flushDebounced=s?$e(function(){return i.flush()},a):Ze(function(){return i.flush()},a),this._initilized=!0,this._reset())}},{key:"flush",value:function(){if(!this._queue.length)return Promise.resolve();var e=this._queue.splice(0,this._queue.length),n=this._resolve,i=this._startTime;this._reset();var a=et(e,i);return this._optimizeBatch&&(a=tt(a)),this._flushHandler(a).then(n)}},{key:"feed",value:function(e,n){return this._queue.push(Ke(e,n,this._startTime)),this._queue.length===this._maxBatchSize?this.flush():(this._flushDebounced(),this._promise)}}]),r}();ie.exports=rt});var ue=m((er,oe)=>{"use strict";u();var nt={functional:!0,analytics:!0,__default:!0},it=function(t){return typeof t=="function"&&t()||nt},ae=function(t){return t.functional===!1||t.analytics===!1},at=function(t,e){return e==="essential"?!1:e==="functional"||e==="analytics"?t[e]===!1:ae(t)};oe.exports={shouldMuteNonEssentials:ae,shouldMuteByCategory:at,getPolicy:it}});var N=m((rr,de)=>{"use strict";u();var x=Object.assign||function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n])}return r},ot=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}();function ut(r,t){var e={};for(var n in r)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}function st(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var D=E(),he=Y(),se=he.mapValues,le=he.filterValues,fe=Z(),lt=K(),ft=B(),M=ue(),ct=M.shouldMuteByCategory,ce=M.shouldMuteNonEssentials,ht=M.getPolicy,dt=function(){function r(t,e){st(this,r),this._publishers=t.publishers,this._validators=t.validators||[],this._defaults=t.defaults,this._ownDefaults={},this._events=t.events||{},this._context=e||{},this._defaultValueTimeout=t.defaultValueTimeout||5e3,this._defaultContinueOnFail=t.defaultContinueOnFail||!1,this._onPublisherFailHandler=t.onPublisherFailHandler||r._defaultPublisherFailHandler,this._isMuted=t.isMuted||function(){return!1},this._eventTransformer=t.eventTransformer||function(n){return n},this._payloadTransformer=t.payloadTransformer||function(n){return n},this._consentPolicyGetter=t.consentPolicyGetter||function(){return null},this._nonEssentialDefaults=t.nonEssentialDefaults||{},this._maxBatchSize=t.maxBatchSize||100,this._globalBatchQueue=t.globalBatchQueue}return ot(r,[{key:"report",value:function(e){D.defined(e,"Data must be provided"),D.object(e,"Data must be an object");var n=e.src,i=e.evid,a=e.params,o=ut(e,["src","evid","params"]);return this.log(x({src:n,evid:i},a),o)}},{key:"log",value:function(e,n,i){var a=this;D.defined(e,"Event object or event key must be provided.");var o=this._extractEventAndContext(e,n,i),s=o.event,h=o.context,c=ht(this._consentPolicyGetter),f=x({},this._context,h);if(this._isMuted()||ct(c,f.category))return Promise.resolve();if(f.useBatch){var v=this._initQueue(f,c),d=function(_){var P=a._eventTransformer(_,f);return v.feed(P,f)};if(this._globalBatchQueue)return this._getDefaults(this._defaults).then(function(w){var _=x({},w,a._getDynamicNonEssentialDefaults(c),a._getStaticNonEssentialDefaults(c),s,a._getPolicyFields(c,f.category));return d(_)});var g=x({},this._getDynamicDefaults(this._defaults),this._getDynamicNonEssentialDefaults(c),s,this._getPolicyFields(c,f.category));return d(g)}return this._getDefaults(this._defaults).then(function(w){var _=Object.assign(w,a._getDynamicNonEssentialDefaults(c),a._getStaticNonEssentialDefaults(c),s,a._getPolicyFields(c,f.category)),P=a._validators.length===0?!0:a._validators.some(function(A){return A.match(_)&&(A.execute(_)||!0)});if(!P)throw new Error("No validator accepted the event. Source: "+_.src+" Evid: "+(_.evid||_.evtId));var k=a._eventTransformer(_,f);return k=a._payloadTransformer(k,f),a._send(k,f)})}},{key:"flush",value:function(){return this._queue?this._queue.flush():Promise.resolve()}},{key:"updateDefaults",value:function(e){return D.defined(e,"Defaults must be provided"),D.object(e,"Defaults must be an object"),Object.assign(this._ownDefaults,e),this}},{key:"_send",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Promise.all(this._publishers.map(function(a){var o=x({},e);return Promise.resolve().then(function(){return a(o,i)}).catch(function(s){return n._onPublisherFailHandler(s,{publisherName:a.name,payload:e})})})).then(function(){})}},{key:"_extractEventAndContext",value:function(e,n,i){var a=void 0,o={};if(typeof e!="string")a=e,o=n||o;else{if(a=this._events[e],!a)throw new D.AssertionError("Event with key '"+e+"' not found in event map.");n&&(a=x({},a,n),o=i||o)}return{event:a,context:o}}},{key:"_initQueue",value:function(e,n){var i=this;if(this._queue)return this._queue;this._queue=this._globalBatchQueue||new ft;var a=function(s){i._globalBatchQueue||(s.g=Object.assign(i._getStaticDefaults(i._defaults),i._getStaticNonEssentialDefaults(n)));var h=i._payloadTransformer(s,e);return i._send(h,e)};return this._queue.init({delayMs:e.useBatch===!0?300:e.useBatch,maxBatchSize:this._maxBatchSize,useThrottle:!!this._globalBatchQueue,optimizeBatch:!!this._globalBatchQueue},a),this._queue}},{key:"_handleDefaultsError",value:function(e){return this._defaultContinueOnFail?(lt.error(e),null):Promise.reject(e)}},{key:"_getDynamicNonEssentialDefaults",value:function(e){if(!ce(e))return this._getDynamicDefaults(this._nonEssentialDefaults)}},{key:"_getStaticNonEssentialDefaults",value:function(e){if(!ce(e))return this._getStaticDefaults(this._nonEssentialDefaults)}},{key:"_withOwnDefaults",value:function(e){return Object.assign({},e,this._ownDefaults)}},{key:"_getDynamicDefaults",value:function(e){e=this._withOwnDefaults(e);var n=le(e,function(i){return typeof i=="function"});return se(n,function(i){return i()})}},{key:"_getStaticDefaults",value:function(e){e=this._withOwnDefaults(e);var n=le(e,function(i){return typeof i!="function"});return n}},{key:"_getDefaults",value:function(e){var n=this;if(e=this._withOwnDefaults(e),!e)return Promise.resolve({});var i=se(e,function(a,o){if(typeof a=="function")try{a=a()}catch(s){return n._handleDefaultsError(s)}return a&&typeof a.then=="function"?fe.timedPromise(a,{message:"Cannot get default value '"+o+" for BI Event'",timeout:n._defaultValueTimeout}).catch(function(s){return n._handleDefaultsError(s)}):a});return fe.allAsObject(i)}},{key:"_encodePolicyValue",value:function(e,n){return e?typeof e[n]=="boolean"?e[n]?1:0:e[n]:1}},{key:"_getPolicyFields",value:function(e,n){return{_isca:this._encodePolicyValue(e,"analytics"),_iscf:this._encodePolicyValue(e,"functional"),_ispd:e.__default?1:0,_ise:n==="essential"?1:0}}}],[{key:"_defaultPublisherFailHandler",value:function(e,n){var i=n.publisherName;return i}}]),r}();de.exports=dt});var q=m((ir,ge)=>{"use strict";u();var mt=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}();function vt(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var me=E(),ve=function(){function r(){vt(this,r),this.reset()}return mt(r,[{key:"reset",value:function(){this._handlers=[]}},{key:"onLoggerCreated",value:function(e){var n=this;return me.defined(e,"Handler must be provided."),me.func(e,"Handler must be a function."),this._handlers.push(e),function(){var i=n._handlers.indexOf(e);i!==-1&&n._handlers.splice(i,1)}}},{key:"notifyLoggerCreated",value:function(e){this._handlers.forEach(function(n){return n(e)})}}]),r}();ge.exports={manager:new ve,BiLoggerManager:ve}});var ye=m((or,_e)=>{"use strict";u();var gt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_t=function(){function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}}();function yt(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}var l=E(),pt=N(),bt=q(),wt=B(),xt=function(){function r(){yt(this,r),this._publishers=[],this._validators=[],this._defaults={},this._nonEssentialDefaults={},this._events={},this._isMuted=!1,this._eventTransformer=null,this._payloadTransformer=null,this._consentPolicyGetter=null,this._maxBatchSize=null,this._batchQueue=null}return _t(r,[{key:"addPublisher",value:function(e){return l.defined(e,"Publisher must be provided"),l.ok(typeof e=="function","Expected a publisher function"),this._publishers.push(e),this}},{key:"addValidator",value:function(e){return l.defined(e,"Validator must be provided"),l.ok((typeof e>"u"?"undefined":gt(e))==="object"&&e,"Expected a validator object"),l.ok(e.execute&&e.match,"Provided validator does not match the interface"),this._validators.push(e),this}},{key:"setDefaults",value:function(e){return l.defined(e,"Defaults must be provided"),l.object(e,"Defaults must be an object"),this._defaults=e,this}},{key:"updateDefaults",value:function(e){return l.defined(e,"Defaults must be provided"),l.object(e,"Defaults must be an object"),Object.assign(this._defaults,e),this}},{key:"updateNonEssentialDefaults",value:function(e){return l.defined(e,"Non-essential Defaults must be provided"),l.object(e,"Non-essential Defaults must be an object"),Object.assign(this._nonEssentialDefaults,e),this}},{key:"setEvents",value:function(e){return l.defined(e,"Events must be provided"),l.object(e,"Events must be an object"),this._events=e,this}},{key:"setDefaultValueTimeout",value:function(e){return l.defined(e,"Default Value Timeout must be provided"),this._defaultValueTimeout=e,this}},{key:"setDefaultContinueOnFail",value:function(e){return l.defined(e,"Default Continue On Fail must be provided"),this._defaultContinueOnFail=e,this}},{key:"setPublisherFailHandler",value:function(e){return l.defined(e,"Publisher Fail Handler must be provided"),this._onPublisherFailHandler=e,this}},{key:"setMuted",value:function(e){return l.defined(e,"Is Muted must be provided"),l.boolean(e,"Is Muted must be a boolean"),this._isMuted=e,this}},{key:"setMaxBatchSize",value:function(e){return l.defined(e,"Max Batch Size must be provided"),l.number(e,"Max Batch Size must be a number"),l.ok(e>0,"Max Batch Size must be higher than 0"),this._maxBatchSize=e,this}},{key:"setGlobalBatchQueue",value:function(e){return l.defined(e,"Global Batch Queue must be provided"),l.ok(e instanceof wt,"Global Batch Queue must be an instance of BatchQueue"),this._globalBatchQueue=e,this}},{key:"withEventTransformer",value:function(e){return l.defined(e,"Event Transformer must be provided"),l.func(e,"Event Transformer must be a function"),this._eventTransformer=e,this}},{key:"withPayloadTransformer",value:function(e){return l.defined(e,"Payload Transformer must be provided"),l.func(e,"Payload Transformer must be a function"),this._payloadTransformer=e,this}},{key:"withConsentPolicyGetter",value:function(e){return l.defined(e,"Consent Policy Getter must be provided"),l.func(e,"Consent Policy Getter must be a function"),this._consentPolicyGetter=e,this}},{key:"logger",value:function(e){var n=this,i=new pt({publishers:this._publishers,validators:this._validators,defaults:this._defaults,events:this._events,defaultValueTimeout:this._defaultValueTimeout,defaultContinueOnFail:this._defaultContinueOnFail,onPublisherFailHandler:this._onPublisherFailHandler,isMuted:function(){return n._isMuted},eventTransformer:this._eventTransformer,payloadTransformer:this._payloadTransformer,consentPolicyGetter:this._consentPolicyGetter,nonEssentialDefaults:this._nonEssentialDefaults,maxBatchSize:this._maxBatchSize,globalBatchQueue:this._globalBatchQueue},e);return bt.manager.notifyLoggerCreated(i),i}}]),r}();_e.exports=xt});var we=m((sr,b)=>{"use strict";u();var pe=ye(),Dt=N(),be=q(),Et=B();b.exports.BiLoggerFactory=pe;b.exports.BiLogger=Dt;b.exports.BiLoggerManager=be.BiLoggerManager;b.exports.factory=function(){return new pe};b.exports.manager=be.manager;b.exports.createBatchQueue=function(){return new Et}});u();import{randomUUID as ke}from"node:crypto";function Te(r,t){r.updateDefaults(j(t))}function j(r){return r?{_client_id:r,_uuid:r,logged_user_id:r,logged_account_id:r,target_account_id:r}:{_client_id:ke()}}u();import{uptime as Fe}from"node:process";u();var J=T(Ee(),1);import Oe from"node:os";import{platform as Se,version as je}from"node:process";function W({cliVersion:r,flow:t}){return{...t?{flow:t}:{},cliVersion:r,isCI:J.default,nodeVersion:je,osName:Ce(),osVersion:Oe.release()}}function Ce(){switch(Se){case"darwin":return"mac";case"win32":return"windows";default:return"linux"}}var X=()=>Math.round(Fe()*1e3);function Le({biLogger:r,command:t,flow:e,cliVersion:n,projectId:i,extensions:a,extraFields:o}){let s=t.opts(),h=t.args,c=new Set(["apiKey"]),f=Object.fromEntries(Object.entries(s).map(([d,g])=>{let w=c.has(d)?"<censored>":g;return[d,w]})),v={command:t.name(),arguments:h.join(","),flags:Object.keys(f).length?JSON.stringify(f):""};return r.report(R({...W({cliVersion:n,flow:e}),...v,...i?{projectId:i}:{},...o?{extraFields:JSON.stringify(o)}:{},isValid:!0})),{succeed(){r.report(S({...v,...a?{extensions:JSON.stringify(a)}:{},duration:X(),isSuccess:!0,isValid:!0}))},failed(d){let g=Q(d)?{errorType:H(d)?"SystemError":"UserError",errorName:d.name,errorMessage:d.message}:d instanceof Error?{errorType:"UnknownError",errorName:d.name,errorMessage:d.message}:{errorType:"UnknownError",errorMessage:JSON.stringify(d)};r.report(S({...v,...g,...a?{extensions:JSON.stringify(a)}:{},duration:X(),isSuccess:!1,isValid:!0}))}}}u();u();u();Be();var xe=T(we()),De=T(Pe()),Bt={baseUrl:process.env.BI_BASE_URL||"https://frog.wix.com",endpoint:"",logError:!1},V=function(){function r(){}return r.prototype.factory=function(t){var e=this;t===void 0&&(t={});var n=O(O({},Bt),t),i=xe.default.factory();return n.onError&&i.setPublisherFailHandler(n.onError),i.addPublisher(function(a,o){return U(e,void 0,void 0,function(){var s,h,c,f,v;return G(this,function(d){switch(d.label){case 0:return s=o.endpoint||n.endpoint,h=n.baseUrl,c=n.userAgent,f=n.logError,v=c?{headers:{"User-Agent":c}}:{},[4,new De.HttpClient({baseURL:h}).get(s,{headers:v,params:a,timeout:30*1e3}).catch(function(g){return f?console.error(g.toJSON()):Promise.reject(g)})];case 1:return d.sent(),[2]}})})}),i},r}();var cr=new V;async function Pt(r,t){let e=z().biLoggerBaseUrl,n=e?{baseUrl:e}:{},i=j(t),{telemetry:a}=await I();return new V().factory(n).updateDefaults({localTime:()=>Date.now(),...r,...i}).setMuted(!a).logger()}export{Te as a,Pt as b,Le as c};
4
+ //# sourceMappingURL=chunk-JGPN7XZF.js.map
@@ -0,0 +1,6 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{c as we,h as _e,i as Se,j as Re,k as xt}from"./chunk-X3AOPEF4.js";import{c as It,k as wt,l as M}from"./chunk-TLPEI3DE.js";import{a as R,b as Q,d as ye,e as ge,j as ve,l as Ft,m as U,n as J,o as k,p as Ae,q as xe,t as B,w as At}from"./chunk-4BTCJXQC.js";import{a as Nt,b as vt,c as tt,e as Dt}from"./chunk-EE5EBGQ7.js";import{a as p,b as L}from"./chunk-CUZEHDNU.js";import{a as T,c as l,e as v}from"./chunk-TCTTRAWM.js";import{c as qt,e as d,i as a}from"./chunk-UO4ZAUJK.js";var Pe=qt((Fn,Te)=>{"use strict";a();function _(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Te.exports=_;_.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};_.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};_.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(t),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1);else return!1;var o=this;return this._timer=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},r),this._options.unref&&this._timer.unref(),!0};_.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};_.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};_.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};_.prototype.start=_.prototype.try;_.prototype.errors=function(){return this._errors};_.prototype.attempts=function(){return this._attempts};_.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,o=0;o<this._errors.length;o++){var n=this._errors[o],i=n.message,s=(t[i]||0)+1;t[i]=s,s>=r&&(e=n,r=s)}return e}});var be=qt(F=>{"use strict";a();var Xr=Pe();F.operation=function(t){var e=F.timeouts(t);return new Xr(e,{forever:t&&(t.forever||t.retries===1/0),unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};F.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],n=0;n<e.retries;n++)o.push(this.createTimeout(n,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(n,e)),o.sort(function(i,s){return i-s}),o};F.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,o=Math.round(r*Math.max(e.minTimeout,1)*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout),o};F.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var o in t)typeof t[o]=="function"&&r.push(o)}for(var n=0;n<r.length;n++){var i=r[n],s=t[i];t[i]=function(u){var m=F.operation(e),f=Array.prototype.slice.call(arguments,1),h=f.pop();f.push(function(y){m.retry(y)||(y&&(arguments[0]=m.mainError()),h.apply(this,arguments))}),m.attempt(function(){u.apply(t,f)})}.bind(t,s),t[i].options=e}}});var ke=qt((Un,Oe)=>{"use strict";a();Oe.exports=be()});a();a();a();var mr=d(T(),1);a();a();var Ce=d(ke(),1),Yr=new Set(["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed"]),Ut=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}},Zr=(t,e,r)=>{let o=r.retries-(e-1);return t.attemptNumber=e,t.retriesLeft=o,t},Qr=t=>Yr.has(t),Ee=t=>globalThis.DOMException===void 0?new Error(t):new DOMException(t);async function et(t,e){return new Promise((r,o)=>{e={onFailedAttempt(){},retries:10,...e};let n=Ce.default.operation(e);n.attempt(async i=>{try{r(await t(i))}catch(s){if(!(s instanceof Error)){o(new TypeError(`Non-error was thrown: "${s}". You should only throw errors.`));return}if(s instanceof Ut)n.stop(),o(s.originalError);else if(s instanceof TypeError&&!Qr(s.message))n.stop(),o(s);else{Zr(s,i,e);try{await e.onFailedAttempt(s)}catch(c){o(c);return}n.retry(s)||o(n.mainError())}}}),e.signal&&!e.signal.aborted&&e.signal.addEventListener("abort",()=>{n.stop();let i=e.signal.reason===void 0?Ee("The operation was aborted."):e.signal.reason;o(i instanceof Error?i:Ee(i))},{once:!0})})}a();a();a();a();function qe(t=""){let[e,r]=to(t);return r?{schemaName:r,schemaType:e}:{schemaName:e}}var to=t=>t.split("#");a();a();function Fe(t,e,r,o){let n=t;for(let i of e.split(".")){if(!n)return r;n=n[i]}return`${n}${o}`}var eo="_",ro=["wix.com","editorx.com"],oo=["42.wixprod.net","uw2-edt-1.wixprod.net"],no="dev.wix-code.com",ao=/{(.*)}/,io=new RegExp(`\\.(${ro.join("|")})$`),so=new RegExp(`\\.(${oo.join("|")})$`),co=new RegExp(`.*\\.${no}$`);function _t(t){let e=fo(t.host),r=ho(e,t.domainToMappings),o=uo(t.protoPath,t.data||{});return lo(o,r)}function uo(t,e){return t.split("/").map(r=>mo(r,e)).join("/")}function mo(t,e){let r=t.match(ao)||[],o=r[1];if(o){let n=t.replace(r[0],"");return Fe(e,o,t,n)}return t}function fo(t){return po(t).replace(io,"._base_domain_").replace(so,"._api_base_domain_").replace(co,"*.dev.wix-code.com")}function po(t){return t.replace("create.editorx.com","editor.editorx.com")}function ho(t,e){let r=e[t]||e[eo];return!r&&yo(t)?e[go]:r}function lo(t,e){let r=e?.find(o=>t.startsWith(o.destPath));return r?r.srcPath+t.slice(r.destPath.length):t}function yo(t){return!!t.match(/\._base_domain_$/)}var go="www._base_domain_";a();a();var Jt=typeof Buffer=="function",Yn=typeof TextDecoder=="function"?new TextDecoder:void 0,Ie=typeof TextEncoder=="function"?new TextEncoder:void 0,vo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",rt=Array.prototype.slice.call(vo),Zn=(t=>{let e={};return t.forEach((r,o)=>e[r]=o),e})(rt);var P=String.fromCharCode.bind(String),Qn=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),Ao=t=>t.replace(/=/g,"").replace(/[+\/]/g,e=>e=="+"?"-":"_");var xo=t=>{let e,r,o,n,i="",s=t.length%3;for(let c=0;c<t.length;){if((r=t.charCodeAt(c++))>255||(o=t.charCodeAt(c++))>255||(n=t.charCodeAt(c++))>255)throw new TypeError("invalid character found");e=r<<16|o<<8|n,i+=rt[e>>18&63]+rt[e>>12&63]+rt[e>>6&63]+rt[e&63]}return s?i.slice(0,s-3)+"===".substring(s):i},De=typeof btoa=="function"?t=>btoa(t):Jt?t=>Buffer.from(t,"binary").toString("base64"):xo,wo=Jt?t=>Buffer.from(t).toString("base64"):t=>{let r=[];for(let o=0,n=t.length;o<n;o+=4096)r.push(P.apply(null,t.subarray(o,o+4096)));return De(r.join(""))};var _o=t=>{if(t.length<2){var e=t.charCodeAt(0);return e<128?t:e<2048?P(192|e>>>6)+P(128|e&63):P(224|e>>>12&15)+P(128|e>>>6&63)+P(128|e&63)}else{var e=65536+(t.charCodeAt(0)-55296)*1024+(t.charCodeAt(1)-56320);return P(240|e>>>18&7)+P(128|e>>>12&63)+P(128|e>>>6&63)+P(128|e&63)}},So=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Ro=t=>t.replace(So,_o),Ne=Jt?t=>Buffer.from(t,"utf8").toString("base64"):Ie?t=>wo(Ie.encode(t)):t=>De(Ro(t)),Ue=(t,e=!1)=>e?Ao(Ne(t)):Ne(t);function Je(t,e=""){let r={};return Object.entries(t).forEach(([o,n])=>{let i=n!==null&&typeof n=="object"&&!Array.isArray(n),s=To(e,o);if(i){let c=Je(n,s);Object.assign(r,c)}else r[s]=n}),r}function To(t,e){return`${t}${t?".":""}${e}`}function St(t,e){let r=Je(t),o=Object.entries(r).reduce((n,[i,s])=>((Array.isArray(s)?s:[s]).forEach(u=>{u!=null&&n.append(i,u)}),n),new URLSearchParams);return e&&o.append(".r",Ue(JSON.stringify(t),!0)),o}a();a();var g;(function(t){t[t.TO_JSON=0]="TO_JSON",t[t.FROM_JSON=1]="FROM_JSON"})(g||(g={}));a();function Le(t,e={},r){return function(n={},i){return typeof n=="string"?n:s(t,n);function s(f,h){let y={};return[null,void 0].includes(h)?h:(Object.entries(h).forEach(([Z,q])=>{let Vr=f[Z],{schemaName:yt,schemaType:jr}=qe(Vr),Wr=jr==="Map",$r=u(yt)?.checkRepetable?.(q)??Array.isArray(q),gt;$r?gt=q.map(Gr=>c(Gr,yt)):Wr?gt=m(q,yt):gt=c(q,yt),y[Z]=gt}),y)}function c(f,h){if(!h)return f;let y=e[h];if(u(h))return u(h).transform(f);if(y)return s(y,f);throw new Error(`${h} is neither schema nor serializable type`)}function u(f){return r[f]?.[i]}function m(f,h){return Object.entries(f).reduce((y,[Z,q])=>(y[Z]=c(q,h),y),{})}}}a();a();var Be={types:["google.protobuf.Timestamp"],[g.TO_JSON]:{transform:t=>t?.toISOString()},[g.FROM_JSON]:{transform:t=>t?new Date(t):void 0}};a();var Me={types:["google.protobuf.FieldMask"],[g.TO_JSON]:{transform:t=>t.join(","),checkRepetable:t=>t.some(e=>Array.isArray(e))},[g.FROM_JSON]:{transform:t=>typeof t=="object"?t.paths:t.split(",")}};a();var ze={types:["google.protobuf.BytesValue","BYTES"],[g.TO_JSON]:{transform:t=>{let e=t.reduce((r,o)=>r+String.fromCharCode(o),"");return btoa(e)}},[g.FROM_JSON]:{transform:t=>Uint8Array.from(atob(t),e=>e.charCodeAt(0))}};a();var He={types:["google.protobuf.Duration"],[g.TO_JSON]:{transform:({seconds:t="0",nanos:e=0})=>{let r="";return e!==0&&(r=`.${e.toString().padStart(9,"0")}`),`${t}${r}s`}},[g.FROM_JSON]:{transform:t=>{let[e,r]=t.substring(0,t.length-1).split(".");return{seconds:e,nanos:Po(r)}}}};function Po(t){let e=0;if(t!==void 0){let r=3-t.length/3;e=parseInt(t,10)*Math.pow(1e3,r)}return e}a();var Ke={types:["FLOAT","DOUBLE","google.protobuf.FloatValue","google.protobuf.DoubleValue"],[g.TO_JSON]:{transform:t=>isFinite(t)?t:t.toString()},[g.FROM_JSON]:{transform:t=>t==="NaN"?NaN:t==="Infinity"?1/0:t==="-Infinity"?-1/0:t}};var Ve=[Be,Me,ze,He,Ke];a();function je(t){return t.reduce((e,r)=>{let o=r.types.reduce((n,i)=>({...n,[i]:r}),{});return{...e,...o}},{})}var bo=je([...Ve]);function b(t,e={}){let r=Le(t,e,bo);return{fromJSON(o){let n=Oo(o)||o;return r(n,g.FROM_JSON)},toJSON(o){return r(o,g.TO_JSON)}}}function Oo(t){try{return JSON.parse(t)}catch{}}var ko={dateCreated:"google.protobuf.Timestamp",dateUpdated:"google.protobuf.Timestamp"},Eo={account:"_account"};var Co={};function qo(t){var e={"api._api_base_domain_":[{srcPath:"/account-server",destPath:""}],"www._base_domain_":[{srcPath:"/_api/account-server",destPath:""}],"manage._base_domain_":[{srcPath:"/_api/account-server",destPath:""},{srcPath:"/account-server",destPath:""}],"premium._base_domain_":[{srcPath:"/_api/account-server",destPath:""}],"editor._base_domain_":[{srcPath:"/_api/account-server",destPath:""}],"blocks._base_domain_":[{srcPath:"/_api/account-server",destPath:""}],"create.editorx":[{srcPath:"/_api/account-server",destPath:""}],"bo._base_domain_":[{srcPath:"/account-server",destPath:""}],"wixbo.ai":[{srcPath:"/account-server",destPath:""}],"wix-bo.com":[{srcPath:"/account-server",destPath:""}],"www.wixapis.com":[{srcPath:"/accounts",destPath:""},{srcPath:"/accounts/v1/accounts",destPath:"/v1/accounts"},{srcPath:"/accounts/v1/account",destPath:"/v1/account"}],"users._base_domain_":[{srcPath:"/_api/account-server",destPath:""}],"*.dev.wix-code.com":[{srcPath:"/_api/account-server",destPath:""}]};return _t(Object.assign(t,{domainToMappings:e}))}function We(t){var e=b(Co,{}),r=e.toJSON,o=e.fromJSON,n=b(Eo,{_account:ko}).fromJSON;function i(s){var c=s.host,u=r(t),m={entityFqdn:"wix.identity.account.v2.account",method:"GET",methodFqn:"com.wixpress.account.api.AccountService.getMyAccount",url:qo({protoPath:"/v1/accounts/my_account",data:u,host:c}),params:St(u),transformResponse:n};return m}return i.fromReq=o,i.__isAmbassador=!0,i}a();var Fo={},Io={};var No={body:"BYTES"},Do={body:"BYTES"},Uo={},Jo={};function Lt(t){var e={"manage._base_domain_":[{srcPath:"/oauth2",destPath:"/v1/oauth"}],"www.wixapis.com":[{srcPath:"/oauth2",destPath:"/v1/oauth"},{srcPath:"/oauth2/token_info",destPath:"/v1/token_info"}],"users._base_domain_":[{srcPath:"/v1/oauth/device/verify",destPath:"/v1/oauth/device/verify"},{srcPath:"/v1/oauth/manage/user-code",destPath:"/v1/oauth/manage/user-code"},{srcPath:"/v2/oauth/device/verify",destPath:"/v2/oauth/device/verify"}],_:[{srcPath:"/_api/oauth2",destPath:"/v1/oauth"}],"platform.rise.ai":[{srcPath:"/oauth2",destPath:"/v1/oauth"}]};return _t(Object.assign(t,{domainToMappings:e}))}function Bt(t){var e=b(No,{}),r=e.toJSON,o=e.fromJSON,n=b(Do,{}).fromJSON;function i(s){var c=s.host,u=r(t),m={entityFqdn:"wix.identity.oauth.v1.refresh_token",method:"POST",methodFqn:"wix.identity.oauth2.v1.Oauth2Ng.Token",url:Lt({protoPath:"/v1/oauth/token",data:u,host:c}),data:u,transformResponse:n};return m}return i.fromReq=o,i.__isAmbassador=!0,i}function $e(t){var e=b(Fo,{}),r=e.toJSON,o=e.fromJSON,n=b(Io,{}).fromJSON;function i(s){var c=s.host,u=r(t),m={entityFqdn:"wix.identity.oauth.v1.refresh_token",method:"GET",methodFqn:"wix.identity.oauth2.v1.Oauth2Ng.DeviceCode",url:Lt({protoPath:"/v1/oauth/device/code",data:u,host:c}),params:St(u),transformResponse:n};return m}return i.fromReq=o,i.__isAmbassador=!0,i}function Ge(t){var e=b(Uo,{}),r=e.toJSON,o=e.fromJSON,n=b(Jo,{}).fromJSON;function i(s){var c=s.host,u=r(t),m={entityFqdn:"wix.identity.oauth.v1.refresh_token",method:"POST",methodFqn:"wix.identity.oauth2.v1.Oauth2Ng.RevokeRefreshToken",url:Lt({protoPath:"/v1/oauth/revoke",data:u,host:c}),data:u,transformResponse:n};return m}return i.fromReq=o,i.__isAmbassador=!0,i}a();var Ye=d(It(),1);a();var Xe=d(It(),1);function z(t){return Xe.HttpClient.isHttpError(t)}var Lo={backoffice:"https://manage.wix.com",editor:"https://editor.wix.com",code:"https://code.wix.com",general:"https://www.wix.com",standalone:void 0};function E(t,e){return(...r)=>e.apply(t,r).catch(o=>{throw z(o)&&!t.isCancel(o)&&!o.response?new l({code:v.NetworkError({cause:o}),cause:o,info:{code:o.code}}):o})}function Rt({getAppToken:t,createHeaders:e,type:r}){let o=(0,Ye.createHttpClient)({baseURL:Lo[r],...r!=="standalone"?{getAppToken:t}:{},createHeaders:()=>({...e?.(),"X-XSRF-TOKEN":"nocheck",Cookie:"XSRF-TOKEN=nocheck","User-Agent":"wix-cli"})});return{...o,request:E(o,o.request),get:E(o,o.get),delete:E(o,o.delete),head:E(o,o.head),options:E(o,o.options),post:E(o,o.post),put:E(o,o.put),patch:E(o,o.patch)}}var K=d(T(),1);a();var Ze=p.object({deviceCode:p.string(),verificationUri:p.string().url(),userCode:p.string(),expiresIn:p.number()}),Mt=p.object({access_token:p.string(),refresh_token:p.string(),expires_in:p.number()}).transform(t=>({accessToken:t.access_token,refreshToken:t.refresh_token,expiresIn:t.expires_in})),zt=p.object({userId:p.string().uuid(),email:p.string().email()}),Qe=p.object({account:p.object({slug:p.string(),accountId:p.string().uuid(),accountOwner:p.string().uuid()})}),Ht=p.object({accessToken:p.string(),refreshToken:p.string(),expiresIn:p.number(),issuedAt:p.number()}),tr=Ht.extend({userInfo:zt}),er=p.object({token:p.string(),accountId:p.string().uuid(),userInfo:p.object({userId:p.string().uuid(),email:p.string()})});var{InvalidResponseData:Bo,FailedToGetAuthToken:Mo,FailedToGetDeviceCode:zo,FailedToRenewAuthToken:Ho,FailedToRenewAuthTokenSiteNotFound:Ko,FailedToRevokeRefreshToken:Vo}=v,Kt="6f95cec8-3e98-48b9-b4e5-1fb92fcd9973",rr=()=>Math.floor(Date.now()/1e3),ot=class extends Error{},H=(0,K.variant)({TokenRenewed:(0,K.payload)(),RefreshTokenRevoked:(0,K.fields)()}),Vt=class{constructor(e){this.httpClient=e;let{minRetryTimeout:r}=L();this.retryOptions={retries:3,minTimeout:r,maxTimeout:3*1e3}}retryOptions;async requestDeviceCode(e={}){try{let{data:r}=await et(()=>this.httpClient.request($e({...e,clientId:Kt})),this.retryOptions);return Ze.parse(r)}catch(r){throw new l({code:zo(),cause:r})}}async createToken(e){try{let r={clientId:Kt,grantType:"urn:ietf:params:oauth:grant-type:device_code",scope:"offline_access",...e};return{...await et(async()=>{let{data:n,requestId:i}=await this.httpClient.request(Bt(r)),s=Mt.safeParse(n);if(s.success)return s.data;throw new l({code:Bo(),cause:s.error,info:{requestId:i,data:n}})},this.retryOptions),issuedAt:rr()}}catch(r){throw z(r)&&(r.response?.data?.message==="Device code is not yet verified"||r.response?.data?.error==="authorization_pending")?new ot("Device code is not yet verified."):new l({code:Mo(),cause:r})}}async renewToken(e){try{let r={clientId:Kt,grantType:"refresh_token",...e},{data:o}=await et(()=>this.httpClient.request(Bt(r)),this.retryOptions),n=Mt.parse(o);return H.TokenRenewed({...n,issuedAt:rr()})}catch(r){if(z(r)){if(r.response?.status===400&&r.response.data?.error==="invalid_grant")return H.RefreshTokenRevoked({cause:r});if(e.siteId&&r.response?.status===404&&r.response.data?.details?.applicationError?.code==="SITE_NOT_FOUND")throw new l({code:Ko({siteId:e.siteId}),cause:r})}throw new l({code:Ho(),cause:r})}}async revokeRefreshToken(e,{email:r}){try{let{data:o}=await this.httpClient.request(Ge(e));return o}catch(o){throw new l({code:Vo({email:r}),info:{email:r},cause:o})}}async userInfo({accessToken:e}){try{let r=Rt({type:"backoffice",getAppToken:async()=>e}),{data:o}=await r.get("/_serverless/wix-cli-userinfo/userinfo");return zt.parse(o)}catch(r){throw new l({code:v.FailedToGetUserInfo(),cause:r})}}async getMyAccount({token:e}){try{let r=Rt({type:"backoffice",getAppToken:async()=>e}),{data:o}=await r.request(We({}));return Qe.parse(o).account}catch(r){throw z(r)&&r.response?.status===428&&r.response.data?.details?.applicationError?.code===48876?new l({code:v.InvalidApiKey(),cause:r}):new l({code:v.FailedToGetMyAccount(),cause:r})}}},S=new Vt(Rt({type:"backoffice"}));a();import{unlink as jo,rm as Wo}from"node:fs/promises";import{resolve as at}from"node:path";var x=d(T(),1);function or(){return at(Dt(),"auth.json")}function Tt(){return at(Dt(),"auth")}function nr(){return at(Tt(),"api-key.json")}function ar(){return at(Tt(),"account.json")}function ir(t){return at(Tt(),`${t}.json`)}var Wt=(0,x.variant)({Authenticated:(0,x.payload)(),Unauthenticated:{}});async function $t(){let t=nr();if(!await tt(t))return Wt.Unauthenticated();let e=await vt(t),r=er.parse(e);return Wt.Authenticated(r)}async function sr(t){try{let e=nr();await Nt(e,t)}catch(e){throw new l({code:v.FailedToSaveApiKeyAuthData({cause:e}),cause:e})}}var nt=(0,x.variant)({Authenticated:(0,x.fields)(),Unauthenticated:{},Expired:(0,x.fields)()});async function it(){let t=ar();if(!await tt(t))return nt.Unauthenticated();let e=await vt(t),r=tr.parse(e);return j(r)?nt.Authenticated(r):nt.Expired(r)}var jt=(0,x.variant)({Authenticated:(0,x.fields)(),Unauthenticated:{},Expired:(0,x.fields)()});async function cr(t){let e=ir(t);if(!await tt(e))return jt.Unauthenticated();let r=await vt(e),o=Ht.parse(r);return j(o)?jt.Authenticated(o):jt.Expired(o)}async function st(t,e){try{let r=e?ir(e):ar();await Nt(r,t)}catch(r){throw new l({code:v.FailedToSaveAuthData({cause:r}),cause:r})}}async function V(){try{await Wo(Tt(),{recursive:!0,force:!0})}catch(t){throw new l({code:v.FailedToDeleteAuthData({cause:t}),cause:t})}await Gt()&&await $o()}async function $o(){try{await jo(or())}catch(t){throw new l({code:v.FailedToDeleteLegacyAuthData({cause:t}),cause:t})}}async function Gt(){return tt(or())}function j(t){let e=Math.floor(Date.now()/1e3),r=10*60,o=t.expiresIn-r;return t.issuedAt+o>e}async function Go(){let t=await $t();if((0,x.isType)(t,Wt.Authenticated))return t.payload.userInfo;let e=await it();return(0,x.match)(e,{Authenticated:({userInfo:r})=>r,Expired:({userInfo:r})=>r,Unauthenticated:()=>null})}function ur({authData:{token:t,accountId:e,userInfo:r},siteId:o}){return{getAccessToken:async()=>t,getRefreshToken:()=>{throw new Error("API key auth does not support refresh tokens")},getRequestHeaders:()=>({"wix-account-id":e,...o&&{"wix-site-id":o}}),userInfo:r}}var I={async isLoggedIn({siteId:t}={}){let e=await $t();return(0,mr.match)(e,{Authenticated:({payload:r})=>ur({authData:r,siteId:t}),Unauthenticated:()=>null})},async login({token:t}){let{accountId:e,accountOwner:r,slug:o}=await S.getMyAccount({token:t}),n={token:t,accountId:e,userInfo:{userId:r,email:o}};return await V(),await sr(n),ur({authData:n})}};a();a();a();var Xt=class{value;next;constructor(e){this.value=e}},ct=class{#t;#e;#r;constructor(){this.clear()}enqueue(e){let r=new Xt(e);this.#t?(this.#e.next=r,this.#e=r):(this.#t=r,this.#e=r),this.#r++}dequeue(){let e=this.#t;if(e)return this.#t=this.#t.next,this.#r--,e.value}clear(){this.#t=void 0,this.#e=void 0,this.#r=0}get size(){return this.#r}*[Symbol.iterator](){let e=this.#t;for(;e;)yield e.value,e=e.next}};function ut(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new ct,r=0,o=()=>{r--,e.size>0&&e.dequeue()()},n=async(c,u,m)=>{r++;let f=(async()=>c(...m))();u(f);try{await f}catch{}o()},i=(c,u,m)=>{e.enqueue(n.bind(void 0,c,u,m)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},s=(c,...u)=>new Promise(m=>{i(c,m,u)});return Object.defineProperties(s,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),s}var C=d(T(),1);a();a();var W=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},Yt=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},fr=t=>globalThis.DOMException===void 0?new Yt(t):new DOMException(t),pr=t=>{let e=t.reason===void 0?fr("This operation was aborted."):t.reason;return e instanceof Error?e:fr(e)};function Zt(t,e){let{milliseconds:r,fallback:o,message:n,customTimers:i={setTimeout,clearTimeout}}=e,s,u=new Promise((m,f)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(e.signal){let{signal:y}=e;y.aborted&&f(pr(y)),y.addEventListener("abort",()=>{f(pr(y))})}if(r===Number.POSITIVE_INFINITY){t.then(m,f);return}let h=new W;s=i.setTimeout.call(void 0,()=>{if(o){try{m(o())}catch(y){f(y)}return}typeof t.cancel=="function"&&t.cancel(),n===!1?m():n instanceof Error?f(n):(h.message=n??`Promise timed out after ${r} milliseconds`,f(h))},r),(async()=>{try{m(await t)}catch(y){f(y)}})()}).finally(()=>{u.clear()});return u.clear=()=>{i.clearTimeout.call(void 0,s),s=void 0},u}var Qt=Symbol("resolveValue");async function mt(t,e={}){let{interval:r=20,timeout:o=Number.POSITIVE_INFINITY,before:n=!0}=e,i,s=!1,c=new Promise((u,m)=>{let f=async()=>{try{let h=await t();if(typeof h=="object"&&h[Qt])u(h[Qt]);else{if(typeof h!="boolean")throw new TypeError("Expected condition to return a boolean");h===!0?u():s||(i=setTimeout(f,r))}}catch(h){m(h)}};n?f():i=setTimeout(f,r)});if(o===Number.POSITIVE_INFINITY)return c;try{return await Zt(c,typeof o=="number"?{milliseconds:o}:o)}finally{s=!0,clearTimeout(i)}}mt.resolveWith=t=>({[Qt]:t});var dr=t=>1e3*t;async function Xo({deviceCode:t,expiresIn:e},{signal:r}){try{let o=await mt(async()=>{try{let s=await S.createToken({deviceCode:t});return mt.resolveWith(s)}catch(s){if(s instanceof ot)return!1;throw s}},{interval:L().waitForLoginInterval??dr(3),timeout:{milliseconds:dr(e),signal:r}}),n=await S.userInfo({accessToken:o.accessToken}),i={...o,userInfo:n};return await V(),await st(i),i}catch(o){throw o instanceof W?new l({code:v.DeviceCodeTimedOut()}):o}}async function lr({refreshToken:t,userInfo:e}){let r=await S.renewToken({refreshToken:t});return(0,C.isType)(r,H.TokenRenewed)&&await st({...r.payload,userInfo:e}),r}async function Yo(){let t=await it();return(0,C.match)(t,{Authenticated:e=>e,Unauthenticated:()=>null,Expired:async e=>{let r=await lr(e);return(0,C.match)(r,{TokenRenewed:({payload:o})=>({...o,userInfo:e.userInfo}),RefreshTokenRevoked:(0,C.constant)(null)})}})}function hr({userInfo:t,...e}){let r=ut(1),o={...e};return{getAccessToken:()=>r(async()=>{if(j(o))return o.accessToken;let n=await lr({...o,userInfo:t});return(0,C.match)(n,{TokenRenewed:({payload:i})=>(o=i,o.accessToken),RefreshTokenRevoked:({cause:i})=>{throw new l({code:v.FailedToRenewAuthTokenRefreshTokenRevoked(),cause:i})}})}),getRefreshToken:()=>o.refreshToken,userInfo:t}}var O={async isLoggedIn(){let t=await I.isLoggedIn();if(t)return t;let e=await Yo();return e?hr(e):null},async login({deviceCode:t,signal:e}){let r=await Xo(t,{signal:e});return hr(r)}};a();var w=d(T(),1);async function vr({accountRefreshToken:t,siteId:e}){let r=await S.renewToken({refreshToken:t,siteId:e});return(0,w.isType)(r,H.TokenRenewed)&&await st(r.payload,e),r}var Pt=(0,w.variant)({Ok:(0,w.payload)(),RefreshTokenRevoked:(0,w.fields)()});async function yr({siteId:t,accountRefreshToken:e}){let r=await cr(t);return(0,w.matcher)(r).with({Authenticated:o=>Pt.Ok(o)}).when(["Unauthenticated","Expired"],async()=>{let o=await vr({accountRefreshToken:e,siteId:t});return(0,w.match)(o,{TokenRenewed:({payload:n})=>Pt.Ok(n),RefreshTokenRevoked:({cause:n})=>Pt.RefreshTokenRevoked({cause:n})})}).complete()}function gr({siteAuth:t,accountRefreshToken:e,siteId:r,userInfo:o}){let n=ut(1),i={...t};return{getAccessToken:()=>n(async()=>{if(j(i))return i.accessToken;let s=await vr({accountRefreshToken:e,siteId:r});return(0,w.match)(s,{TokenRenewed:({payload:c})=>(i=c,i.accessToken),RefreshTokenRevoked:({cause:c})=>{throw new l({code:v.FailedToRenewAuthTokenRefreshTokenRevoked(),cause:c})}})}),getRefreshToken:()=>i.refreshToken,userInfo:o}}var te=t=>({async isLoggedIn(){let e=await I.isLoggedIn({siteId:t});if(e)return e;let r=await O.isLoggedIn();if(r){let o=r.getRefreshToken(),n=await yr({siteId:t,accountRefreshToken:o});if((0,w.isType)(n,Pt.Ok))return gr({siteId:t,siteAuth:n.payload,accountRefreshToken:o,userInfo:r.userInfo})}return null},async login({deviceCode:e,signal:r}){let o=await O.login({deviceCode:e,signal:r}),n=o.getRefreshToken(),i=await yr({siteId:t,accountRefreshToken:n});return(0,w.match)(i,{Ok:({payload:s})=>gr({siteId:t,siteAuth:s,accountRefreshToken:n,userInfo:o.userInfo}),RefreshTokenRevoked:({cause:s})=>{throw new l({code:v.FailedToRenewAuthTokenRefreshTokenRevoked(),cause:s})}})}});a();var Ar=d(T(),1);async function Zo(){let t=await it();return(0,Ar.isType)(t,nt.Unauthenticated)||await S.revokeRefreshToken({token:t.refreshToken},t.userInfo),await V(),null}a();var wr=d(R(),1);a();var xr=d(R(),1),$=(0,xr.createContext)(null);function ee(){let t=(0,wr.useContext)($);if(!t)throw new Error("useAuth() cannot be used without an <AuthProvider>");return t}a();var _r=d(R(),1);var Sr=d(T(),1);var Qo=({token:t,onLogin:e,onError:r})=>{let o=xt(),{status:n}=k(async()=>(o.report(wt({})),I.login({token:t})),[],{onSuccess:i=>{o.report(M({isSuccess:!0})),e(i)},onError:i=>{o.report(M({isSuccess:!1,...i instanceof Error?{errorType:i.name}:{errorType:"unknown",errorMessage:JSON.stringify(i)}})),r(i)}});return(0,Sr.match)(n,{Error:()=>null,Loading:()=>_r.default.createElement(U,null),Success:()=>null})};a();var pt=d(R(),1);var Mr=d(T(),1);var bt={"login.instructions_title":"Authorize the CLI to access your Wix account:","login.instructions_details":`1. Copy this code to the clipboard: <0>{code}</0>
4
+ 2. Press <1/> to <2>log in</2> and then paste the code`,"login.legacy_auth_notice":"We implemented a new and more secure login method. You'll need to re-login to continue using the CLI.","login.error_opening_browser":"Failed to open browser, please try opening <0/> manually."};a();var A=d(R(),1);a();a();import kt from"node:process";import{Buffer as Rn}from"node:buffer";import qr from"node:path";import{fileURLToPath as Tn}from"node:url";import Pn from"node:child_process";import me,{constants as Fr}from"node:fs/promises";a();import Pr from"node:process";import an from"node:os";import sn from"node:fs";a();import on from"node:fs";a();import Rr from"node:fs";var re;function en(){try{return Rr.statSync("/.dockerenv"),!0}catch{return!1}}function rn(){try{return Rr.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function oe(){return re===void 0&&(re=en()||rn()),re}var ne,nn=()=>{try{return on.statSync("/run/.containerenv"),!0}catch{return!1}};function G(){return ne===void 0&&(ne=nn()||oe()),ne}var Tr=()=>{if(Pr.platform!=="linux")return!1;if(an.release().toLowerCase().includes("microsoft"))return!G();try{return sn.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!G():!1}catch{return!1}},ft=Pr.env.__IS_WSL_TEST__?Tr:Tr();a();function N(t,e,r){let o=n=>Object.defineProperty(t,e,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let n=r();return o(n),n},set(n){o(n)}}),t}a();import{promisify as xn}from"node:util";import ce from"node:process";import{execFile as wn}from"node:child_process";a();import{promisify as cn}from"node:util";import un from"node:process";import{execFile as mn}from"node:child_process";var fn=cn(mn);async function ae(){if(un.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await fn("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}a();a();import pn from"node:process";import{promisify as dn}from"node:util";import{execFile as hn,execFileSync as Gs}from"node:child_process";var ln=dn(hn);async function br(t,{humanReadableOutput:e=!0}={}){if(pn.platform!=="darwin")throw new Error("macOS only");let r=e?[]:["-ss"],{stdout:o}=await ln("osascript",["-e",t,r]);return o.trim()}async function ie(t){return br(`tell application "Finder" to set app_path to application file id "${t}" as string
5
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}a();import{promisify as yn}from"node:util";import{execFile as gn}from"node:child_process";var vn=yn(gn),An={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},Ot=class extends Error{};async function se(t=vn){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new Ot(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:o}=r.groups,n=An[o];if(!n)throw new Ot(`Unknown browser ID: ${o}`);return n}var _n=xn(wn),Sn=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase());async function ue(){if(ce.platform==="darwin"){let t=await ae();return{name:await ie(t),id:t}}if(ce.platform==="linux"){let{stdout:t}=await _n("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:Sn(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(ce.platform==="win32")return se();throw new Error("Only macOS, Linux, and Windows are supported")}var fe=qr.dirname(Tn(import.meta.url)),Or=qr.join(fe,"xdg-open"),{platform:X,arch:kr}=kt,bn=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",o=!1;try{await me.access(r,Fr.F_OK),o=!0}catch{}if(!o)return t;let n=await me.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),Er=async(t,e)=>{let r;for(let o of t)try{return await e(o)}catch(n){r=n}throw r},Et=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return Er(t.app,c=>Et({...t,app:c}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return Er(e,c=>Et({...t,app:{name:c,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},m=await ue();if(m.id in c){let f=c[m.id];return e==="browserPrivate"&&r.push(u[f]),Et({...t,app:{name:Y[f],arguments:r}})}throw new Error(`${m.name} is not supported as a default browser`)}let o,n=[],i={};if(X==="darwin")o="open",t.wait&&n.push("--wait-apps"),t.background&&n.push("--background"),t.newInstance&&n.push("--new"),e&&n.push("-a",e);else if(X==="win32"||ft&&!G()&&!e){let c=await bn();o=ft?`${c}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${kt.env.SYSTEMROOT||kt.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),ft||(i.windowsVerbatimArguments=!0);let u=["Start"];t.wait&&u.push("-Wait"),e?(u.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&u.push(`"${t.target}"`),r.length>0&&(r=r.map(m=>`"\`"${m}\`""`),u.push("-ArgumentList",r.join(","))),t.target=Rn.from(u.join(" "),"utf16le").toString("base64")}else{if(e)o=e;else{let c=!fe||fe==="/",u=!1;try{await me.access(Or,Fr.X_OK),u=!0}catch{}o=kt.versions.electron??(X==="android"||c||!u)?"xdg-open":Or}r.length>0&&n.push(...r),t.wait||(i.stdio="ignore",i.detached=!0)}X==="darwin"&&r.length>0&&n.push("--args",...r),t.target&&n.push(t.target);let s=Pn.spawn(o,n,i);return t.wait?new Promise((c,u)=>{s.once("error",u),s.once("close",m=>{if(!t.allowNonzeroExitCode&&m>0){u(new Error(`Exited with code ${m}`));return}c(s)})}):(s.unref(),s)},On=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Et({...e,target:t})};function Cr(t){if(typeof t=="string"||Array.isArray(t))return t;let{[kr]:e}=t;if(!e)throw new Error(`${kr} is not supported`);return e}function pe({[X]:t},{wsl:e}){if(e&&ft)return Cr(e);if(!t)throw new Error(`${X} is not supported`);return Cr(t)}var Y={};N(Y,"chrome",()=>pe({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));N(Y,"firefox",()=>pe({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));N(Y,"edge",()=>pe({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));N(Y,"browser",()=>"browser");N(Y,"browserPrivate",()=>"browserPrivate");var Ir=On;a();var Nr=d(It(),1);async function Dr(t,e){await(0,Nr.createHttpClient)().post(t,void 0,{params:{url:e}})}async function Ur(t){let{userBrowserTestEndpoint:e}=L();e?await Dr(e,t):await Ir(t,{background:!0})}a();var Jr=d(R(),1);function Lr(t){return(0,Jr.useMemo)(()=>{let e=new URL(t);return e.searchParams.set("color","developer"),e.searchParams.set("studio","true"),e.toString()},[t])}var Br=({userCode:t,verificationUri:e})=>{let r=Lr(e),{reportError:o}=Se(),[n,i]=(0,A.useState)(null);return ye((s,c)=>{c.return&&Ur(r).catch(u=>{o(u),i(u)})}),A.default.createElement(A.default.Fragment,null,A.default.createElement(B,{i18nKey:"login.instructions_title"}),A.default.createElement(Q,{flexDirection:"column",marginTop:1,marginBottom:1,marginLeft:2},A.default.createElement(B,{i18nKey:"login.instructions_details",components:[A.default.createElement(ge,{skin:"info"}),A.default.createElement(ve,{value:"enter"}),A.default.createElement(Ft,{url:r})],values:{code:t}})),n&&A.default.createElement(A.default.Fragment,null,A.default.createElement(Q,{flexDirection:"column",marginBottom:1},A.default.createElement(we,{error:n})),A.default.createElement(B,{i18nKey:"login.error_opening_browser",components:[A.default.createElement(Ft,{url:r})]})))};var de=({loginFn:t,onLogin:e,onError:r})=>{let o=xt();function n(c){o.report(M({isSuccess:!1,...c instanceof Error?{errorType:c.name}:{errorType:"unknown",errorMessage:JSON.stringify(c)}})),r(c)}let i=Ae(async({signal:c},u)=>{try{let m=await t({deviceCode:u,signal:c});o.report(M({isSuccess:!0})),e(m)}catch(m){n(m)}}),{status:s}=k(async()=>(o.report(wt({})),S.requestDeviceCode()),[],{onSuccess:c=>{i.execute(c)},onError:n});return(0,Mr.match)(s,{Error:()=>null,Loading:()=>pt.default.createElement(U,null),Success:({result:{userCode:c,verificationUri:u}})=>pt.default.createElement(Br,{userCode:c,verificationUri:u})})};function kn(t){return pt.default.createElement(At,{messages:bt},pt.default.createElement(de,{loginFn:O.login,...t}))}a();var he=d(R(),1);a();var ht=d(R(),1),Kr=d(T(),1);a();var dt=d(R(),1),zr=d(T(),1);var Hr=({children:t})=>{let{status:e}=k(Gt,[],{onError:()=>{}});return(0,zr.match)(e,{Error:()=>null,Loading:()=>null,Success:({result:r})=>dt.default.createElement(dt.default.Fragment,null,r&&dt.default.createElement(Q,{marginBottom:1},dt.default.createElement(B,{i18nKey:"login.legacy_auth_notice"})),t)})};var Ct=({authStrategy:{login:t,isLoggedIn:e},onLogin:r,onError:o,children:n})=>{let{status:i,merge:s}=k(e,[],{onSuccess:c=>{c&&r(c)},onError:o});return(0,Kr.match)(i,{Loading:()=>ht.default.createElement(U,null),Error:()=>null,Success:({result:c})=>c===null?ht.default.createElement(At,{messages:bt},ht.default.createElement(Hr,null,ht.default.createElement(de,{loginFn:t,onLogin:u=>{s({result:u}),r(u)},onError:o}))):n(c)})};var En=({children:t,onError:e,onLogin:r})=>{let o=J();return he.default.createElement(Ct,{authStrategy:O,onLogin:({userInfo:n})=>r?.(n),onError:e??o},({getAccessToken:n,getRequestHeaders:i,userInfo:s})=>he.default.createElement($.Provider,{value:{getAccessToken:n,getRequestHeaders:i,userInfo:s}},t))};a();var lt=d(R(),1);var le=({children:t,siteId:e,onError:r,onLogin:o})=>{let n=J(),i=(0,lt.useMemo)(()=>te(e),[e]);return lt.default.createElement(Ct,{authStrategy:i,onLogin:({userInfo:s})=>o?.(s),onError:r??n},({getAccessToken:s,getRequestHeaders:c,userInfo:u})=>lt.default.createElement($.Provider,{value:{getAccessToken:s,getRequestHeaders:c,userInfo:u}},t))};a();var D=d(R(),1);var Cn=({onReady:t})=>{let e=J(),r=ee();return(0,D.useEffect)(()=>{t(r),e()},[e,r,t]),null};function qn(t,e,r){return new Promise((o,n)=>{xe(D.default.createElement(_e,{value:r},D.default.createElement(Re,{value:e},D.default.createElement(le,{siteId:t},D.default.createElement(Cn,{onReady:o}))))).catch(i=>n(i))})}var{isLoggedIn:ku}=O;export{z as a,Rt as b,et as c,_t as d,St as e,b as f,Go as g,ut as h,Zt as i,mt as j,Zo as k,ee as l,Qo as m,Ur as n,kn as o,En as p,le as q,qn as r,ku as s};
6
+ //# sourceMappingURL=chunk-JYYNYTCQ.js.map