@wix/cli-app 1.1.16 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/CreateVersionCommand-F7A6HDJI.js +4 -0
- package/build/CreateVersionCommand-F7A6HDJI.js.map +1 -0
- package/build/{DevCommand-F4JNOQD3.js → DevCommand-KHV22E2S.js} +2 -2
- package/build/{GenerateCommand-UOXXMOFE.js → GenerateCommand-46EMTVWN.js} +23 -23
- package/build/GenerateCommand-46EMTVWN.js.map +1 -0
- package/build/PreviewCommand-XX7TWOJR.js +4 -0
- package/build/{ServeCommand-SCDZSOGW.js → ServeCommand-Z5NQEEE5.js} +2 -2
- package/build/{build-QKFFY6BT.js → build-WOV3ZNZF.js} +2 -2
- package/build/{chunk-ZHOPW26J.js → chunk-3EQ4ZYU2.js} +2 -2
- package/build/{chunk-V4D26EXO.js → chunk-4NIGEF2O.js} +30 -30
- package/build/chunk-4NIGEF2O.js.map +1 -0
- package/build/{chunk-KOTYDSCW.js → chunk-7IB3ZF3I.js} +2 -2
- package/build/{chunk-N6MHPAL7.js → chunk-7TOOBLT6.js} +2 -2
- package/build/{chunk-C6CRDQAM.js → chunk-CUWQRNQL.js} +2 -2
- package/build/{chunk-RZD2Z3NM.js → chunk-EH27FYQH.js} +2 -2
- package/build/{chunk-J7GQKX36.js → chunk-G7NSXRI7.js} +2 -2
- package/build/{chunk-YYYCYGWT.js → chunk-GHVN7KTY.js} +2 -2
- package/build/{chunk-YYYCYGWT.js.map → chunk-GHVN7KTY.js.map} +1 -1
- package/build/{chunk-OQ2EIA5Y.js → chunk-JIUANWPO.js} +2 -2
- package/build/chunk-KK4X6NH5.js +4 -0
- package/build/{chunk-F3L55KWK.js.map → chunk-KK4X6NH5.js.map} +1 -1
- package/build/{chunk-VPVMEECP.js → chunk-LT3WXWI5.js} +2 -2
- package/build/{chunk-TXD4M2YS.js → chunk-LW6PZKOJ.js} +2 -2
- package/build/chunk-LW6PZKOJ.js.map +1 -0
- package/build/{chunk-KDEP6ACN.js → chunk-PSXIV7FJ.js} +2 -2
- package/build/{chunk-JRUKA4BX.js → chunk-QW5H4VGJ.js} +2 -2
- package/build/{chunk-PBVA37S6.js → chunk-RWN7XXN6.js} +2 -2
- package/build/{chunk-6VY5XPWN.js → chunk-RYS7G2PY.js} +2 -2
- package/build/{chunk-HFEDL4QC.js → chunk-YWJFUO7I.js} +2 -2
- package/build/{chunk-NCLWI32Y.js → chunk-ZIVYB6TM.js} +2 -2
- package/build/devtools-WFBFD7GB.js +10 -0
- package/build/devtools-WFBFD7GB.js.map +1 -0
- package/build/esm-CECOC7V2.js +365 -0
- package/build/esm-CECOC7V2.js.map +1 -0
- package/build/index.js +2 -2
- package/build/{preview-WCMD3SX5.js → preview-FV7ZP3YC.js} +2 -2
- package/build/{render-command-S4HOHZ67.js → render-command-JEBHYUZV.js} +2 -2
- package/package.json +6 -6
- package/templates/dashboard-modal/modal.tsx.ejs +17 -9
- package/build/CreateVersionCommand-EKTXL4HX.js +0 -4
- package/build/CreateVersionCommand-EKTXL4HX.js.map +0 -1
- package/build/GenerateCommand-UOXXMOFE.js.map +0 -1
- package/build/PreviewCommand-5SJI24RE.js +0 -4
- package/build/chunk-F3L55KWK.js +0 -4
- package/build/chunk-TXD4M2YS.js.map +0 -1
- package/build/chunk-V4D26EXO.js.map +0 -1
- package/build/devtools-SH22YG5Z.js +0 -10
- package/build/devtools-SH22YG5Z.js.map +0 -1
- package/build/esm-GVPPSDDL.js +0 -352
- package/build/esm-GVPPSDDL.js.map +0 -1
- /package/build/{DevCommand-F4JNOQD3.js.map → DevCommand-KHV22E2S.js.map} +0 -0
- /package/build/{PreviewCommand-5SJI24RE.js.map → PreviewCommand-XX7TWOJR.js.map} +0 -0
- /package/build/{ServeCommand-SCDZSOGW.js.map → ServeCommand-Z5NQEEE5.js.map} +0 -0
- /package/build/{build-QKFFY6BT.js.map → build-WOV3ZNZF.js.map} +0 -0
- /package/build/{chunk-ZHOPW26J.js.map → chunk-3EQ4ZYU2.js.map} +0 -0
- /package/build/{chunk-KOTYDSCW.js.map → chunk-7IB3ZF3I.js.map} +0 -0
- /package/build/{chunk-N6MHPAL7.js.map → chunk-7TOOBLT6.js.map} +0 -0
- /package/build/{chunk-C6CRDQAM.js.map → chunk-CUWQRNQL.js.map} +0 -0
- /package/build/{chunk-RZD2Z3NM.js.map → chunk-EH27FYQH.js.map} +0 -0
- /package/build/{chunk-J7GQKX36.js.map → chunk-G7NSXRI7.js.map} +0 -0
- /package/build/{chunk-OQ2EIA5Y.js.map → chunk-JIUANWPO.js.map} +0 -0
- /package/build/{chunk-VPVMEECP.js.map → chunk-LT3WXWI5.js.map} +0 -0
- /package/build/{chunk-KDEP6ACN.js.map → chunk-PSXIV7FJ.js.map} +0 -0
- /package/build/{chunk-JRUKA4BX.js.map → chunk-QW5H4VGJ.js.map} +0 -0
- /package/build/{chunk-PBVA37S6.js.map → chunk-RWN7XXN6.js.map} +0 -0
- /package/build/{chunk-6VY5XPWN.js.map → chunk-RYS7G2PY.js.map} +0 -0
- /package/build/{chunk-HFEDL4QC.js.map → chunk-YWJFUO7I.js.map} +0 -0
- /package/build/{chunk-NCLWI32Y.js.map → chunk-ZIVYB6TM.js.map} +0 -0
- /package/build/{preview-WCMD3SX5.js.map → preview-FV7ZP3YC.js.map} +0 -0
- /package/build/{render-command-S4HOHZ67.js.map → render-command-JEBHYUZV.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{m as c,n as s}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{m as c,n as s}from"./chunk-LW6PZKOJ.js";import{c as E}from"./chunk-4NIGEF2O.js";import{e as p,f as l}from"./chunk-62RRZRN6.js";import{e as C,h as i}from"./chunk-HFDLXX7R.js";i();import{randomUUID as S}from"node:crypto";function _(r,e){r.updateDefaults(v(e))}function v(r){return r?{_client_id:r,_uuid:r,logged_user_id:r,logged_account_id:r,target_account_id:r}:{_client_id:S()}}i();import{uptime as V}from"node:process";i();var f=C(E(),1);import U from"node:os";import{platform as k,version as L}from"node:process";function d({cliVersion:r,flow:e}){return{...e?{flow:e}:{},cliVersion:r,isCI:f.default,nodeVersion:L,osName:N(),osVersion:U.release()}}function N(){switch(k){case"darwin":return"mac";case"win32":return"windows";default:return"linux"}}var u=()=>Math.round(V()*1e3);function B({biLogger:r,command:e,flow:w,cliVersion:x,projectId:g,extensions:t}){let n={command:e.name(),arguments:e.args.join(",")??"",flags:Object.keys(e.opts()).join(",")};return r.report(c({...d({cliVersion:x,flow:w}),...n,...g?{projectId:g}:{},isValid:!0})),{succeed(){r.report(s({...n,...t?{extensions:JSON.stringify(t)}:{},duration:u(),isSuccess:!0,isValid:!0}))},failed(o){let y=p(o)?{errorType:l(o)?"SystemError":"UserError",errorName:o.name,errorMessage:o.message}:o instanceof Error?{errorType:"UnknownError",errorName:o.name,errorMessage:o.message}:{errorType:"UnknownError",errorMessage:JSON.stringify(o)};r.report(s({...n,...y,...t?{extensions:JSON.stringify(t)}:{},duration:u(),isSuccess:!1,isValid:!0}))}}}i();export{_ as a,B as b};
|
|
4
|
+
//# sourceMappingURL=chunk-PSXIV7FJ.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 C}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as C}from"./chunk-RYS7G2PY.js";import{a as g,b as R,d as l,g as O,r as W}from"./chunk-LW6PZKOJ.js";import{A as V,e as U,g as j,q as z,s as H}from"./chunk-4NIGEF2O.js";import{G as D,J as $,d as E,e as M,f as J,pa as k}from"./chunk-YWJFUO7I.js";import{a as q,c as u,d as v,h as m,i as x}from"./chunk-62RRZRN6.js";import{e as T,h as a}from"./chunk-HFDLXX7R.js";a();a();var ae={},oe={};var ie={},pe={},ne={},me={};function I(t){var e={"api._api_base_domain_":[{srcPath:"/apps-release-manager-service-web",destPath:""}],"bo._base_domain_":[{srcPath:"/apps-release-manager-service-web",destPath:""}],"www._base_domain_":[{srcPath:"/apps-release-manager-service-web/artifacts-release-manager/app-releases",destPath:"/artifacts-release-manager/app-releases"},{srcPath:"/_api/apps-release-manager-service-web/artifacts-release-manager/app-releases",destPath:"/artifacts-release-manager/app-releases"},{srcPath:"/apps-release-manager-service-web/apps/create",destPath:"/apps/create"},{srcPath:"/apps-release-manager-service-web/apps/promote",destPath:"/apps/promote"},{srcPath:"/apps-release-manager-service-web/apps/tags",destPath:"/apps/tags"}],"manage._base_domain_":[{srcPath:"/apps-release-manager-service-web/apps/promote",destPath:"/apps/promote"},{srcPath:"/apps-release-manager-service-web/apps/create",destPath:"/apps/create"},{srcPath:"/apps-release-manager-service-web/apps/tags",destPath:"/apps/tags"}]};return R(Object.assign(t,{domainToMappings:e}))}function Q(t){var e=l(ae,{}),r=e.toJSON,s=e.fromJSON,i=l(oe,{}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.CreateAppRelease",url:I({protoPath:"/apps/create/{appId}",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}function G(t){var e=l(ne,{}),r=e.toJSON,s=e.fromJSON,i=l(me,{}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"PUT",methodFqn:"com.wix.ctp.AppsReleaseManagerService.UpdateAppRelease",url:I({protoPath:"/apps/tags/{tag}",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}function B(t){var e=l(ie,{}),r=e.toJSON,s=e.fromJSON,i=l(pe,{}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.PromoteAppReleaseToDevCenter",url:I({protoPath:"/apps/promote/{appId}/{tag}",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}var P=T(q(),1);a();var K=m.object({newVersion:m.string()}),X=m.object({tag:m.string()});var{AppPermissionDenied:Y}=v,Z=(0,P.variant)({TagUpdated:{},TagNotFound:(0,P.fields)()}),S=class{constructor(e){this.httpClient=e;let{minRetryTimeout:r}=x();this.retryOptions={retries:3,minTimeout:r,maxTimeout:3*1e3}}retryOptions;createAppRelease=async(e,r)=>{try{let{data:s}=await g(()=>this.httpClient.request(Q({appId:e.appId,componentConfigs:e.components,projectId:r})),this.retryOptions);return X.parse(s).tag}catch(s){throw O(s)&&s.response?.status===403?new u({code:Y({appId:e.appId}),cause:s}):new u({code:v.FailedToCreateAppRelease(),cause:s})}};updateAppRelease=async(e,r)=>{try{return await g(()=>this.httpClient.request(G({appId:e.appId,componentConfigs:e.components,tag:r})),this.retryOptions),Z.TagUpdated()}catch(s){if(O(s)){if(s.response?.status===404)return Z.TagNotFound({cause:s});if(s.response?.status===403)throw new u({code:Y({appId:e.appId}),cause:s})}throw new u({code:v.FailedToUpdateAppRelease(),cause:s})}};promoteToDevCenter=async(e,r,s)=>{let{data:i}=await g(()=>this.httpClient.request(B({appId:e,tag:r,versionType:s})),this.retryOptions);return K.parse(i)}};a();import{useMemo as ce}from"react";function de(){let t=C({type:"backoffice"});return ce(()=>new S(t),[t])}a();a();import le,{useContext as ue,createContext as fe}from"react";var ee=fe(null),Be=({children:t,armTag:e})=>le.createElement(ee.Provider,{value:{armTag:e}},t),te=()=>{let t=ue(ee);if(t===null)throw new Error("useArmTag() cannot be used without an <ArmTagProvider>");return t};a();a();var he={},ge={sites:"_site"},ve={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp",trashedDate:"google.protobuf.Timestamp"};function Se(t){var e={"www._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"},{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"feedback._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"}],"manage._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"},{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"},{srcPath:"/_api/sites-list-data",destPath:"/api/sites-list-data"}],"www.wixapis.com":[{srcPath:"/site-list/v2/sites",destPath:"/v2/sites"}],"api._api_base_domain_":[{srcPath:"/sites-list",destPath:""}],"bo._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"wixbo.ai":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"dev._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"editor._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"blocks._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"create.editorx":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}]};return R(Object.assign(t,{domainToMappings:e}))}function N(t){var e=l(he,{}),r=e.toJSON,s=e.fromJSON,i=l(ge,{_site:ve}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.site_list.v2.site",method:"POST",methodFqn:"com.wixpress.sitelist.api.SiteListServiceV2.QuerySites",url:Se({protoPath:"/v2/sites/query",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}a();var _e=m.object({id:m.string(),displayName:m.string(),viewUrl:m.union([m.string().url(),m.literal("")]).optional()}),F=m.object({sites:m.array(_e)});var _=class{constructor(e){this.httpClient=e;let{minRetryTimeout:r}=x();this.retryOptions={retries:3,minTimeout:r,maxTimeout:3*1e3}}retryOptions;querySites=async(e={})=>{try{let{data:r}=await g(()=>this.httpClient.request(N(e)),this.retryOptions);return F.parse(r).sites}catch(r){throw new u({code:v.FailedToQuerySites(),cause:r,info:{...e}})}};getSite=async e=>{try{let{data:r}=await g(()=>this.httpClient.request(N({query:{filter:{id:{$in:[e]}}}})),this.retryOptions),{sites:s}=F.parse(r);return s.at(0)??null}catch(r){throw new u({code:v.FailedToGetSite(),cause:r,info:{id:e}})}}};a();import{useMemo as ye}from"react";function we(){let t=C({type:"backoffice"});return ye(()=>new _(t),[t])}a();a();async function L(t,e){let r=D(t);if(!await J(r))return null;try{let i=await M(r),o=await $.safeParseAsync(i);return o.success?o.data:null}catch(i){return e?.(i),null}}async function xt(t,e){let s={...await L(t)??{},...e};await E(D(t),s)}a();import{createContext as Re}from"react";var re=Re(null);a();var y=T(q(),1),A=(0,y.variant)({NotConfigured:{},NotFound:(0,y.fields)(),Resolved:(0,y.fields)()});a();async function Nt({projectFolder:t,siteListClient:{getSite:e},siteId:r,writeDebugLog:s}){let i=r||(await L(t,s))?.siteId;if(!i)return A.NotConfigured();let o=await e(i);return o?A.Resolved({site:o}):A.NotFound({id:i})}a();import{useContext as xe}from"react";function se(){let t=xe(re);if(t===null)throw new Error("useSiteId() cannot be used without an <SiteIdProvider>");return t}a();import w from"react";var b=T(q(),1);function Qt(){let{model:t}=k(),{site:e}=se(),{armTag:r}=te();return{appId:t.config.appId,site:e,tag:r}}function Gt({envConfig:t,platformType:e,siteOverrideId:r}){let{site:s,tag:i}=t,o=(0,b.match)(e,{Dashboard:()=>new URL(`dashboard/${s.id}`,"https://manage.wix.com/"),Editor:()=>new URL(`https://wix.com/editor/${s.id}`),Site:()=>{let d=new URL(s.viewUrl);return r&&d.searchParams.append("site-override",r),d}});return o.searchParams.append("apps-override",i),o.toString()}function Bt({envConfig:t,extension:e}){let{appId:r,site:s,tag:i}=t,o=(0,b.matcher)(e).with({DashboardPage:()=>new URL(`dashboard/${s.id}/app/${r}${e.route}`,"https://manage.wix.com/")}).when(["DashboardMenuPlugin","DashboardPlugin","DashboardModal"],()=>new URL(`dashboard/${s.id}${e.route}`,"https://manage.wix.com/")).complete();return o.searchParams.append("apps-override",i),o.toString()}var Kt=async({url:t,title:e},r)=>{try{await W(t)}catch{r({type:"error",prefix:"app",msg:w.createElement(z,{type:"error"},w.createElement(V,{i18nKey:"general.open_page_error",components:[w.createElement(j,{bold:!0})],values:{title:e}}),w.createElement(U,null),w.createElement(H,{url:t}))})}};export{_ as a,we as b,L as c,xt as d,re as e,A as f,Nt as g,S as h,de as i,Be as j,se as k,Qt as l,Gt as m,Bt as n,Kt as o};
|
|
4
|
+
//# sourceMappingURL=chunk-QW5H4VGJ.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 y}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{b as y}from"./chunk-KK4X6NH5.js";import{l as C,m as L,n as d}from"./chunk-QW5H4VGJ.js";import{A as p,B,d as i,g as h,j as f,s as b}from"./chunk-4NIGEF2O.js";import{F as w,I as E,K as t,f as m}from"./chunk-YWJFUO7I.js";import{c as g,d as P}from"./chunk-62RRZRN6.js";import{h as s}from"./chunk-HFDLXX7R.js";s();async function S(o){let e=w(o),n=E(o);if(!await m(e)||!await m(n))throw new g({code:P.BuiltProjectNeeded()})}s();import r from"react";var a=({url:o,label:e,withPointer:n=!0})=>r.createElement(i,null,r.createElement(i,{marginRight:1},n&&r.createElement(f,null),r.createElement(i,{marginLeft:1},r.createElement(b,{url:o},e)))),j=()=>{let{t:o}=B(),{isPlatformExists:e,hasSinglePlatform:n,dashboardExtensions:u}=y(),l=C(),x=v=>L({envConfig:l,platformType:v});return r.createElement(r.Fragment,null,n(t.Dashboard())?r.createElement(i,{flexDirection:"row"},r.createElement(p,{i18nKey:"general.open_preview.title_single"}),r.createElement(a,{withPointer:!1,url:d({envConfig:l,extension:u[0]}),label:o("general.platform.dashboard")})):r.createElement(i,{flexDirection:"column"},r.createElement(p,{i18nKey:"general.open_preview.title_multiple"}),r.createElement(i,{paddingLeft:2,flexDirection:"column"},e(t.Site())&&(l.site.viewUrl?r.createElement(a,{url:x(t.Site()),label:o("general.platform.site")}):r.createElement(i,{marginRight:1},r.createElement(f,null),r.createElement(i,{marginLeft:1},r.createElement(h,{skin:"secondary",underline:!0},o("general.platform.unpublished_site"))))),e(t.Editor())&&r.createElement(a,{url:x(t.Editor()),label:o("general.platform.editor")}),e(t.Dashboard())&&r.createElement(a,{url:d({envConfig:l,extension:u[0]}),label:o("general.platform.dashboard")}))))};export{j as a,S as b};
|
|
4
|
+
//# sourceMappingURL=chunk-RWN7XXN6.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{f as i,j as o}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{f as i,j as o}from"./chunk-LW6PZKOJ.js";import{h as t}from"./chunk-HFDLXX7R.js";t();import{useMemo as m}from"react";function c({type:e}){let{getAccessToken:p,getRequestHeaders:r}=o();return m(()=>i({type:e,getAppToken:p,createHeaders:r}),[e,p,r])}t();export{c as a};
|
|
4
|
+
//# sourceMappingURL=chunk-RYS7G2PY.js.map
|
|
@@ -7,7 +7,7 @@ import{a as vi,b as lN,c as j,d as K,h as y,i as Hh,j as jo,k as hN,l as xt,m as
|
|
|
7
7
|
`&&(h(),u="",l=0,r=!1);if(!S.scan(f))break;if(o=!0,N=S.scan(_1)||"name",S.scan(d1),N==="="?(D=S.scanUntil(By),S.scan(By),S.scanUntil(d)):N==="{"?(D=S.scanUntil(g),S.scan(E1),S.scanUntil(d),N="&"):D=S.scanUntil(d),!S.scan(d))throw new Error("Unclosed tag at "+S.pos);if(N==">"?te=[N,D,I,S.pos,u,l,r]:te=[N,D,I,S.pos],l++,i.push(te),N==="#"||N==="^")s.push(te);else if(N==="/"){if(v=s.pop(),!v)throw new Error('Unopened section "'+D+'" at '+I);if(v[1]!==D)throw new Error('Unclosed section "'+v[1]+'" at '+I)}else N==="name"||N==="{"||N==="&"?c=!0:N==="="&&m(D)}if(h(),v=s.pop(),v)throw new Error('Unclosed section "'+v[1]+'" at '+S.pos);return S1(g1(i))}function g1(t){for(var e=[],r,s,i=0,n=t.length;i<n;++i)r=t[i],r&&(r[0]==="text"&&s&&s[0]==="text"?(s[1]+=r[1],s[3]=r[3]):(e.push(r),s=r));return e}function S1(t){for(var e=[],r=e,s=[],i,n,o=0,c=t.length;o<c;++o)switch(i=t[o],i[0]){case"#":case"^":r.push(i),s.push(i),r=i[4]=[];break;case"/":n=s.pop(),n[5]=i[2],r=s.length>0?s[s.length-1][4]:e;break;default:r.push(i)}return e}function _i(t){this.string=t,this.tail=t,this.pos=0}_i.prototype.eos=function(){return this.tail===""};_i.prototype.scan=function(e){var r=this.tail.match(e);if(!r||r.index!==0)return"";var s=r[0];return this.tail=this.tail.substring(s.length),this.pos+=s.length,s};_i.prototype.scanUntil=function(e){var r=this.tail.search(e),s;switch(r){case-1:s=this.tail,this.tail="";break;case 0:s="";break;default:s=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=s.length,s};function Rs(t,e){this.view=t,this.cache={".":this.view},this.parent=e}Rs.prototype.push=function(e){return new Rs(e,this)};Rs.prototype.lookup=function(e){var r=this.cache,s;if(r.hasOwnProperty(e))s=r[e];else{for(var i=this,n,o,c,u=!1;i;){if(e.indexOf(".")>0)for(n=i.view,o=e.split("."),c=0;n!=null&&c<o.length;)c===o.length-1&&(u=Fy(n,o[c])||o1(n,o[c])),n=n[o[c++]];else n=i.view[e],u=Fy(i.view,e);if(u){s=n;break}i=i.parent}r[e]=s}return oh(s)&&(s=s.call(this.view)),s};function ye(){this.templateCache={_cache:{},set:function(e,r){this._cache[e]=r},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}ye.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};ye.prototype.parse=function(e,r){var s=this.templateCache,i=e+":"+(r||Ke.tags).join(":"),n=typeof s<"u",o=n?s.get(i):void 0;return o==null&&(o=m1(e,r),n&&s.set(i,o)),o};ye.prototype.render=function(e,r,s,i){var n=this.getConfigTags(i),o=this.parse(e,n),c=r instanceof Rs?r:new Rs(r,void 0);return this.renderTokens(o,c,s,e,i)};ye.prototype.renderTokens=function(e,r,s,i,n){for(var o="",c,u,l,h=0,f=e.length;h<f;++h)l=void 0,c=e[h],u=c[0],u==="#"?l=this.renderSection(c,r,s,i,n):u==="^"?l=this.renderInverted(c,r,s,i,n):u===">"?l=this.renderPartial(c,r,s,n):u==="&"?l=this.unescapedValue(c,r):u==="name"?l=this.escapedValue(c,r,n):u==="text"&&(l=this.rawValue(c)),l!==void 0&&(o+=l);return o};ye.prototype.renderSection=function(e,r,s,i,n){var o=this,c="",u=r.lookup(e[1]);function l(d){return o.render(d,r,s,n)}if(u){if(Os(u))for(var h=0,f=u.length;h<f;++h)c+=this.renderTokens(e[4],r.push(u[h]),s,i,n);else if(typeof u=="object"||typeof u=="string"||typeof u=="number")c+=this.renderTokens(e[4],r.push(u),s,i,n);else if(oh(u)){if(typeof i!="string")throw new Error("Cannot use higher-order sections without the original template");u=u.call(r.view,i.slice(e[3],e[5]),l),u!=null&&(c+=u)}else c+=this.renderTokens(e[4],r,s,i,n);return c}};ye.prototype.renderInverted=function(e,r,s,i,n){var o=r.lookup(e[1]);if(!o||Os(o)&&o.length===0)return this.renderTokens(e[4],r,s,i,n)};ye.prototype.indentPartial=function(e,r,s){for(var i=r.replace(/[^ \t]/g,""),n=e.split(`
|
|
8
8
|
`),o=0;o<n.length;o++)n[o].length&&(o>0||!s)&&(n[o]=i+n[o]);return n.join(`
|
|
9
9
|
`)};ye.prototype.renderPartial=function(e,r,s,i){if(s){var n=this.getConfigTags(i),o=oh(s)?s(e[1]):s[e[1]];if(o!=null){var c=e[6],u=e[5],l=e[4],h=o;u==0&&l&&(h=this.indentPartial(o,l,c));var f=this.parse(h,n);return this.renderTokens(f,r,s,h,i)}}};ye.prototype.unescapedValue=function(e,r){var s=r.lookup(e[1]);if(s!=null)return s};ye.prototype.escapedValue=function(e,r,s){var i=this.getConfigEscape(s)||Ke.escape,n=r.lookup(e[1]);if(n!=null)return typeof n=="number"&&i===Ke.escape?String(n):i(n)};ye.prototype.rawValue=function(e){return e[1]};ye.prototype.getConfigTags=function(e){return Os(e)?e:e&&typeof e=="object"?e.tags:void 0};ye.prototype.getConfigEscape=function(e){if(e&&typeof e=="object"&&!Os(e))return e.escape};var Ke={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(t){Ei.templateCache=t},get templateCache(){return Ei.templateCache}},Ei=new ye;Ke.clearCache=function(){return Ei.clearCache()};Ke.parse=function(e,r){return Ei.parse(e,r)};Ke.render=function(e,r,s,i){if(typeof e!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+n1(e)+'" was given as the first argument for mustache#render(template, view, partials)');return Ei.render(e,r,s,i)};Ke.escape=f1;Ke.Scanner=_i;Ke.Context=Rs;Ke.Writer=ye;var Uy=Ke;import{readFile as R1}from"node:fs/promises";function qy(t){return t.replace(`${Lt}/`,"").replace("/embedded.html","")}function O1(t){return e=>t.every(r=>e!==qy(r.relativePath))}function A1(t){return pi(qy(t))}async function T1(t){let e=await R1(t,"utf-8");return Uy.parse(e).filter(([r])=>r==="name")}async function Gy(t){try{let s=(await T1(t)).filter(([i])=>i==="name").filter(([,i])=>!/^[a-zA-Z]+$/.test(i)).map(([,i])=>i);return s.length>0?{valid:!1,reason:`Dynamic parameters can only include letters, but some include invalid names: ${s.join(", ")}`}:{valid:!0}}catch(e){return{valid:!1,reason:e instanceof Error?e.message:"Invalid embedded script template"}}}function ky(t){return Cr([[O1(t),"The script folder must be unique, please choose a name that has not been used yet in your application."],[A1,"The script folder must be a valid path ([a-z0-9-/]+) and must not start with a dot."]])}a();var y1=/^[a-z](?:[.0-9_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-(?:[\x2D.0-9_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,I1=function(t){return y1.test(t)},N1=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]),Hy=Cr([[t=>!!t,"Missing custom element name."],[t=>!/[A-Z]/.test(t),"Custom element names must not contain uppercase ASCII characters."],[t=>t.includes("-"),"Custom element names must contain a hyphen. Example: unicorn-cake"],[t=>!/^\d/i.test(t),"Custom element names must not start with a digit."],[t=>!/^-/i.test(t),"Custom element names must not start with a hyphen."],[t=>I1(t),"Invalid element name."],[t=>!N1.has(t),`The supplied element name is reserved and can't be used.
|
|
10
|
-
See: https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name`]]);function c7(t){return e=>t.every(r=>e!==r.tagName)}var Wy=new br,P1=mi(bs,"**","page.{ts,tsx,js,jsx}"),b1=mi(ws,"**","plugin.{ts,tsx,js,jsx}"),w1=mi(Cs,"**","plugin.json"),C1=mi(vs,"**","modal.{ts,tsx,js,jsx}");async function v1(t,e){let r=await Cy(e),s=by(t,mi(t,e));return ae.DashboardPage({...r,route:s,relativePath:e,platforms:[pt.Dashboard()]})}async function Vy(t){let e=await tr(ir(P1),{cwd:t}),r=await Promise.all(e.map(i=>v1(t,i))),s=My(r);return r.forEach(({route:i})=>{let n=s(i);if(!n.valid)throw new j({code:K.InvalidDashboardPageRoute({route:i,errorMessage:n.reason})})}),r}async function D1(t,e){let r=await vy(t);return ae.DashboardPlugin({...r,relativePath:t,platforms:[pt.Dashboard()],route:e[r.extends]?.route||"/"})}async function jy(t){let e=await tr(ir(b1),{cwd:t}),r=await Wy.getBackofficeExtensionWidgets(),s=(0,ah.default)(r,"id");return await Promise.all(e.map(n=>D1(n,s)))}async function x1(t,e){let r=await Dy(t);return ae.DashboardMenuPlugin({...r,relativePath:t,platforms:[pt.Dashboard()],route:e[r.extends]?.route||"/"})}async function L1(t){let e=await xy(t);return ae.DashboardModal({...e,relativePath:t,platforms:[pt.Dashboard()],route:"/"})}async function Ky(t){let e=await tr(ir(w1),{cwd:t}),r=await Wy.getBackofficeMenuItems(),s=(0,ah.default)(r,"id");return await Promise.all(e.map(n=>x1(n,s)))}async function $y(t){let e=await tr(ir(C1),{cwd:t});return await Promise.all(e.map(s=>L1(s)))}function Yy(t){return t.dashboard?.sidebar?.categories?.map(e=>ae.DashboardSidebarCategory({...e,platforms:[]}))||[]}a();import{dirname as G1,join as As}from"node:path";a();import{join as M1,dirname as F1}from"node:path";var wo=Ie(vi(),1);async function zy(t){let e=sr(t,"json");if(!await He(e))throw new j({code:K.EmbeddedScriptConfigNotFound({configPath:e})});let s=await ze(e),i=Nd.safeParse(s);if(i.success)return i.data;throw new j({code:K.InvalidConfigSchemaError({configPath:e,zodError:i.error})})}async function Xy(t){let e=sr(t,"json");if(!await He(e))throw new j({code:K.CustomElementConfigNotFound({configPath:e})});let s=await ze(e),i=Pd.safeParse(s);if(i.success)return i.data;throw new j({code:K.InvalidConfigSchemaError({configPath:e,zodError:i.error})})}function B1(t){return`wix/html/custom-element-asset/${t}.html`}function U1(t){return`wix/scripts/custom-element-asset/panel-${t}.js`}function q1(t){return`wix/scripts/custom-element-asset/${t}.js`}function b7(t){return new Map(t.components.filter(e=>(0,wo.isType)(e,ae.CustomElement)).map(e=>[B1(e.id),e]))}function w7(t){return new Map(t.components.filter(e=>(0,wo.isType)(e,ae.CustomElement)).map(e=>[q1(e.id),e]))}function C7(t){return new Map(t.components.filter(e=>(0,wo.isType)(e,ae.CustomElement)&&!!e.relativePanelPath).map(e=>[U1(e.id),e]))}async function Zy(t){let e=M1(F1(t),"params.dev.json");if(!await He(e))return null;let s=await ze(e),i=bd.safeParse(s);if(i.success)return i.data||null;throw new j({code:K.InvalidParamsOverrideSchemaError({paramsOverridePath:e,zodError:i.error})})}var ch=As(Lt,"**","embedded.html"),k1=As(Lr,"**","element.{ts,tsx,js,jsx}"),V7=As(Lr,"**","panel.{ts,tsx,js,jsx}");async function H1(t,e){let r=await Xy(t),s=As(G1(t),"panel.tsx"),i=wy(t),n=await He(As(e,s));return ae.CustomElement({...r,tagName:i,relativePath:t,platforms:[pt.Site(),pt.Editor()],...n?{relativePanelPath:s}:{}})}async function Qy(t){let e=await tr(ir(k1),{cwd:t}),r=await Promise.all(e.map(s=>H1(s,t)));return r.forEach(({tagName:s})=>{let i=Hy(s);if(!i.valid)throw new j({code:K.InvalidCustomElementTagName({tagName:s,errorMessage:i.reason})})}),r}var Jy=As(Lt,"**","params.dev.json");async function W1(t){let e=await zy(t),r=await Zy(t);return ae.EmbeddedScript({...e,relativePath:t,platforms:[pt.Site()],paramsOverride:r})}async function eI(t){let e=await tr(ir(ch),{cwd:t}),r=await Promise.all(e.map(i=>W1(i))),s=ky(r);return await Promise.all(r.map(async({relativePath:i})=>{let n=s(i),o=await Gy(i);if(!n.valid)throw new j({code:K.InvalidEmbeddedScriptFolder({path:i,errorMessage:n.reason})});if(!o.valid)throw new j({code:K.InvalidEmbeddedScriptTemplate({templateFilename:i,errorMessage:o.reason})})})),r}async function tI({projectFolder:t,config:e}){let r=await Vy(t),s=await jy(t),i=await Ky(t),n=await $y(t),o=await eI(t),c=Yy(e),u=await Qy(t);return[...r,...s,...i,...n,...o,...c,...u]}a();import{join as Ps,basename as Jk}from"node:path";import{EventEmitter as eH}from"node:events";var sN=Ie(jI(),1),iN=Ie(fN(),1);a();var wk=Object.getOwnPropertyNames,Ck=Object.getOwnPropertySymbols,vk=Object.prototype.hasOwnProperty;function KI(t,e){return function(s,i,n){return t(s,i,n)&&e(s,i,n)}}function Ho(t){return function(r,s,i){if(!r||!s||typeof r!="object"||typeof s!="object")return t(r,s,i);var n=i.cache,o=n.get(r),c=n.get(s);if(o&&c)return o===s&&c===r;n.set(r,s),n.set(s,r);var u=t(r,s,i);return n.delete(r),n.delete(s),u}}function $I(t){return wk(t).concat(Ck(t))}var eN=Object.hasOwn||function(t,e){return vk.call(t,e)};function Ns(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var tN="_owner",YI=Object.getOwnPropertyDescriptor,zI=Object.keys;function Dk(t,e,r){var s=t.length;if(e.length!==s)return!1;for(;s-- >0;)if(!r.equals(t[s],e[s],s,s,t,e,r))return!1;return!0}function xk(t,e){return Ns(t.getTime(),e.getTime())}function XI(t,e,r){if(t.size!==e.size)return!1;for(var s={},i=t.entries(),n=0,o,c;(o=i.next())&&!o.done;){for(var u=e.entries(),l=!1,h=0;(c=u.next())&&!c.done;){var f=o.value,d=f[0],g=f[1],m=c.value,S=m[0],I=m[1];!l&&!s[h]&&(l=r.equals(d,S,n,h,t,e,r)&&r.equals(g,I,d,S,t,e,r))&&(s[h]=!0),h++}if(!l)return!1;n++}return!0}function Lk(t,e,r){var s=zI(t),i=s.length;if(zI(e).length!==i)return!1;for(var n;i-- >0;)if(n=s[i],n===tN&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!eN(e,n)||!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function Ni(t,e,r){var s=$I(t),i=s.length;if($I(e).length!==i)return!1;for(var n,o,c;i-- >0;)if(n=s[i],n===tN&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!eN(e,n)||!r.equals(t[n],e[n],n,n,t,e,r)||(o=YI(t,n),c=YI(e,n),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function Mk(t,e){return Ns(t.valueOf(),e.valueOf())}function Fk(t,e){return t.source===e.source&&t.flags===e.flags}function ZI(t,e,r){if(t.size!==e.size)return!1;for(var s={},i=t.values(),n,o;(n=i.next())&&!n.done;){for(var c=e.values(),u=!1,l=0;(o=c.next())&&!o.done;)!u&&!s[l]&&(u=r.equals(n.value,o.value,n.value,o.value,t,e,r))&&(s[l]=!0),l++;if(!u)return!1}return!0}function Bk(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}var Uk="[object Arguments]",qk="[object Boolean]",Gk="[object Date]",kk="[object Map]",Hk="[object Number]",Wk="[object Object]",Vk="[object RegExp]",jk="[object Set]",Kk="[object String]",$k=Array.isArray,QI=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,JI=Object.assign,Yk=Object.prototype.toString.call.bind(Object.prototype.toString);function zk(t){var e=t.areArraysEqual,r=t.areDatesEqual,s=t.areMapsEqual,i=t.areObjectsEqual,n=t.arePrimitiveWrappersEqual,o=t.areRegExpsEqual,c=t.areSetsEqual,u=t.areTypedArraysEqual;return function(h,f,d){if(h===f)return!0;if(h==null||f==null||typeof h!="object"||typeof f!="object")return h!==h&&f!==f;var g=h.constructor;if(g!==f.constructor)return!1;if(g===Object)return i(h,f,d);if($k(h))return e(h,f,d);if(QI!=null&&QI(h))return u(h,f,d);if(g===Date)return r(h,f,d);if(g===RegExp)return o(h,f,d);if(g===Map)return s(h,f,d);if(g===Set)return c(h,f,d);var m=Yk(h);return m===Gk?r(h,f,d):m===Vk?o(h,f,d):m===kk?s(h,f,d):m===jk?c(h,f,d):m===Wk?typeof h.then!="function"&&typeof f.then!="function"&&i(h,f,d):m===Uk?i(h,f,d):m===qk||m===Hk||m===Kk?n(h,f,d):!1}}function Xk(t){var e=t.circular,r=t.createCustomConfig,s=t.strict,i={areArraysEqual:s?Ni:Dk,areDatesEqual:xk,areMapsEqual:s?KI(XI,Ni):XI,areObjectsEqual:s?Ni:Lk,arePrimitiveWrappersEqual:Mk,areRegExpsEqual:Fk,areSetsEqual:s?KI(ZI,Ni):ZI,areTypedArraysEqual:s?Ni:Bk};if(r&&(i=JI({},i,r(i))),e){var n=Ho(i.areArraysEqual),o=Ho(i.areMapsEqual),c=Ho(i.areObjectsEqual),u=Ho(i.areSetsEqual);i=JI({},i,{areArraysEqual:n,areMapsEqual:o,areObjectsEqual:c,areSetsEqual:u})}return i}function Zk(t){return function(e,r,s,i,n,o,c){return t(e,r,c)}}function Qk(t){var e=t.circular,r=t.comparator,s=t.createState,i=t.equals,n=t.strict;if(s)return function(u,l){var h=s(),f=h.cache,d=f===void 0?e?new WeakMap:void 0:f,g=h.meta;return r(u,l,{cache:d,equals:i,meta:g,strict:n})};if(e)return function(u,l){return r(u,l,{cache:new WeakMap,equals:i,meta:void 0,strict:n})};var o={cache:void 0,equals:i,meta:void 0,strict:n};return function(u,l){return r(u,l,o)}}var rN=nr(),_4=nr({strict:!0}),m4=nr({circular:!0}),g4=nr({circular:!0,strict:!0}),S4=nr({createInternalComparator:function(){return Ns}}),R4=nr({strict:!0,createInternalComparator:function(){return Ns}}),O4=nr({circular:!0,createInternalComparator:function(){return Ns}}),A4=nr({circular:!0,createInternalComparator:function(){return Ns},strict:!0});function nr(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,s=t.createInternalComparator,i=t.createState,n=t.strict,o=n===void 0?!1:n,c=Xk(t),u=zk(c),l=s?s(u):Zk(u);return Qk({circular:r,comparator:u,createState:i,equals:l,strict:o})}var tH=Ps(bs,"**","page.json"),rH=Ps(ws,"**","plugin.json"),sH=Ps(Cs,"**","plugin.json"),iH=Ps(vs,"**","modal.json"),nH=Ps(Lt,"**","embedded.json"),oH=Ps(Lr,"**","element.json"),Wo=class{emitter=new eH;watchers=[];prevModel;constructor(e){this.prevModel=e}watch(){let e=sN.default.watch([tH,rH,iH,nH,ch,oH,sH,Jy,Dr],{useFsEvents:!1,ignoreInitial:!0}).on("add",this.emitConfigUpdate).on("unlink",this.emitConfigUpdate).on("change",this.emitConfigUpdate);return this.watchers.push(e),this}onChange(e){return this.emitter.on("all",e),this}onError(e){return this.emitter.on("error",e),this}async close(){await Promise.all(this.watchers.map(e=>e.close()))}emitConfigUpdate=(0,iN.default)(async e=>{try{let r=await nN(this.prevModel.projectFolder);this.emitter.emit("all",r,"change-received"),!rN(r,this.prevModel)||Jk(e)==="embedded.html"?(this.prevModel=r,this.emitter.emit("all",r,"model-updated")):this.emitter.emit("all",r,"model-did-not-change")}catch(r){this.emitter.emit("error",r)}},200)};async function nN(t){let e=await F_();return{projectFolder:t,config:e,components:await tI({projectFolder:t,config:e})}}var aN=cH(null),U4=t=>{let[e,r]=oN(t.value),[s]=oN(()=>{let i=new Wo(e);return t.watchForChanges===!0&&i.watch().onChange((n,o)=>{o==="model-updated"&&r(n)}),i});return lH(()=>()=>{s.close()},[s]),aH.createElement(aN.Provider,{value:{model:e,watcher:s}},t.children)};function q4(){let t=uH(aN);if(t===null)throw new Error("useProjectModel() cannot be used without an <ProjectModelProvider>");return t}a();import{mkdir as hH}from"node:fs/promises";import{resolve as fH}from"node:path";import{homedir as dH}from"node:os";function pH(){return Hh().dataDir??fH(dH(),".wix")}async function K4(){await hH(pH(),{recursive:!0})}export{pH as a,K4 as b,Va as c,aw as d,M_ as e,ze as f,He as g,PV as h,bV as i,Dr as j,RH as k,jh as l,rf as m,sf as n,xr as o,ar as p,Tf as q,yf as r,If as s,fd as t,dd as u,_N as v,mN as w,bs as x,ws as y,Cs as z,Sd as A,bH as B,wH as C,CH as D,vH as E,DH as F,xH as G,LH as H,MH as I,FH as J,BH as K,pt as L,MV as M,tr as N,Yq as O,ae as P,sr as Q,wy as R,Qq as S,k3 as T,Jq as U,H3 as V,pi as W,j3 as X,Cr as Y,K3 as Z,My as _,ky as $,Hy as aa,c7 as ba,P1 as ca,b1 as da,C1 as ea,B1 as fa,U1 as ga,q1 as ha,b7 as ia,w7 as ja,C7 as ka,k1 as la,V7 as ma,rN as na,nN as oa,U4 as pa,q4 as qa};
|
|
10
|
+
See: https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name`]]);function c7(t){return e=>t.every(r=>e!==r.tagName)}var Wy=new br,P1=mi(bs,"**","page.{ts,tsx,js,jsx}"),b1=mi(ws,"**","plugin.{ts,tsx,js,jsx}"),w1=mi(Cs,"**","plugin.json"),C1=mi(vs,"**","modal.{ts,tsx,js,jsx}");async function v1(t,e){let r=await Cy(e),s=by(t,mi(t,e));return ae.DashboardPage({...r,route:s,relativePath:e,platforms:[pt.Dashboard()]})}async function Vy(t){let e=await tr(ir(P1),{cwd:t}),r=await Promise.all(e.map(i=>v1(t,i))),s=My(r);return r.forEach(({route:i})=>{let n=s(i);if(!n.valid)throw new j({code:K.InvalidDashboardPageRoute({route:i,errorMessage:n.reason})})}),r}async function D1(t,e){let r=await vy(t);return ae.DashboardPlugin({...r,relativePath:t,platforms:[pt.Dashboard()],route:e[r.extends]?.route||"/"})}async function jy(t){let e=await tr(ir(b1),{cwd:t}),r=await Wy.getBackofficeExtensionWidgets(),s=(0,ah.default)(r,"id");return await Promise.all(e.map(n=>D1(n,s)))}async function x1(t,e){let r=await Dy(t);return ae.DashboardMenuPlugin({...r,relativePath:t,platforms:[pt.Dashboard()],route:e[r.extends]?.route||"/"})}async function L1(t){let e=await xy(t);return ae.DashboardModal({...e,relativePath:t,platforms:[pt.Dashboard()],route:"/"})}async function Ky(t){let e=await tr(ir(w1),{cwd:t}),r=await Wy.getBackofficeMenuItems(),s=(0,ah.default)(r,"id");return await Promise.all(e.map(n=>x1(n,s)))}async function $y(t){let e=await tr(ir(C1),{cwd:t});return await Promise.all(e.map(s=>L1(s)))}function Yy(t){return t.dashboard?.sidebar?.categories?.map(e=>ae.DashboardSidebarCategory({...e,platforms:[]}))||[]}a();import{dirname as G1,join as As}from"node:path";a();import{join as M1,dirname as F1}from"node:path";var wo=Ie(vi(),1);async function zy(t){let e=sr(t,"json");if(!await He(e))throw new j({code:K.EmbeddedScriptConfigNotFound({configPath:e})});let s=await ze(e),i=Nd.safeParse(s);if(i.success)return i.data;throw new j({code:K.InvalidConfigSchemaError({configPath:e,zodError:i.error})})}async function Xy(t){let e=sr(t,"json");if(!await He(e))throw new j({code:K.CustomElementConfigNotFound({configPath:e})});let s=await ze(e),i=Pd.safeParse(s);if(i.success)return i.data;throw new j({code:K.InvalidConfigSchemaError({configPath:e,zodError:i.error})})}function B1(t){return`wix/html/custom-element-asset/${t}.html`}function U1(t){return`wix/scripts/custom-element-asset/panel-${t}.js`}function q1(t){return`wix/scripts/custom-element-asset/${t}.js`}function b7(t){return new Map(t.components.filter(e=>(0,wo.isType)(e,ae.CustomElement)).map(e=>[B1(e.id),e]))}function w7(t){return new Map(t.components.filter(e=>(0,wo.isType)(e,ae.CustomElement)).map(e=>[q1(e.id),e]))}function C7(t){return new Map(t.components.filter(e=>(0,wo.isType)(e,ae.CustomElement)&&!!e.relativePanelPath).map(e=>[U1(e.id),e]))}async function Zy(t){let e=M1(F1(t),"params.dev.json");if(!await He(e))return null;let s=await ze(e),i=bd.safeParse(s);if(i.success)return i.data||null;throw new j({code:K.InvalidParamsOverrideSchemaError({paramsOverridePath:e,zodError:i.error})})}var ch=As(Lt,"**","embedded.html"),k1=As(Lr,"**","element.{ts,tsx,js,jsx}"),V7=As(Lr,"**","panel.{ts,tsx,js,jsx}");async function H1(t,e){let r=await Xy(t),s=As(G1(t),"panel.tsx"),i=wy(t),n=await He(As(e,s));return ae.CustomElement({...r,tagName:i,relativePath:t,platforms:[pt.Site(),pt.Editor()],...n?{relativePanelPath:s}:{}})}async function Qy(t){let e=await tr(ir(k1),{cwd:t}),r=await Promise.all(e.map(s=>H1(s,t)));return r.forEach(({tagName:s})=>{let i=Hy(s);if(!i.valid)throw new j({code:K.InvalidCustomElementTagName({tagName:s,errorMessage:i.reason})})}),r}var Jy=As(Lt,"**","params.dev.json");async function W1(t){let e=await zy(t),r=await Zy(t);return ae.EmbeddedScript({...e,relativePath:t,platforms:[pt.Site()],paramsOverride:r})}async function eI(t){let e=await tr(ir(ch),{cwd:t}),r=await Promise.all(e.map(i=>W1(i))),s=ky(r);return await Promise.all(r.map(async({relativePath:i})=>{let n=s(i),o=await Gy(i);if(!n.valid)throw new j({code:K.InvalidEmbeddedScriptFolder({path:i,errorMessage:n.reason})});if(!o.valid)throw new j({code:K.InvalidEmbeddedScriptTemplate({templateFilename:i,errorMessage:o.reason})})})),r}async function tI({projectFolder:t,config:e}){let r=await Vy(t),s=await jy(t),i=await Ky(t),n=await $y(t),o=await eI(t),c=Yy(e),u=await Qy(t);return[...r,...s,...i,...n,...o,...c,...u]}a();import{join as Ps,basename as Jk}from"node:path";import{EventEmitter as eH}from"node:events";var sN=Ie(jI(),1),iN=Ie(fN(),1);a();var wk=Object.getOwnPropertyNames,Ck=Object.getOwnPropertySymbols,vk=Object.prototype.hasOwnProperty;function KI(t,e){return function(s,i,n){return t(s,i,n)&&e(s,i,n)}}function Ho(t){return function(r,s,i){if(!r||!s||typeof r!="object"||typeof s!="object")return t(r,s,i);var n=i.cache,o=n.get(r),c=n.get(s);if(o&&c)return o===s&&c===r;n.set(r,s),n.set(s,r);var u=t(r,s,i);return n.delete(r),n.delete(s),u}}function $I(t){return wk(t).concat(Ck(t))}var eN=Object.hasOwn||function(t,e){return vk.call(t,e)};function Ns(t,e){return t||e?t===e:t===e||t!==t&&e!==e}var tN="_owner",YI=Object.getOwnPropertyDescriptor,zI=Object.keys;function Dk(t,e,r){var s=t.length;if(e.length!==s)return!1;for(;s-- >0;)if(!r.equals(t[s],e[s],s,s,t,e,r))return!1;return!0}function xk(t,e){return Ns(t.getTime(),e.getTime())}function XI(t,e,r){if(t.size!==e.size)return!1;for(var s={},i=t.entries(),n=0,o,c;(o=i.next())&&!o.done;){for(var u=e.entries(),l=!1,h=0;(c=u.next())&&!c.done;){var f=o.value,d=f[0],g=f[1],m=c.value,S=m[0],I=m[1];!l&&!s[h]&&(l=r.equals(d,S,n,h,t,e,r)&&r.equals(g,I,d,S,t,e,r))&&(s[h]=!0),h++}if(!l)return!1;n++}return!0}function Lk(t,e,r){var s=zI(t),i=s.length;if(zI(e).length!==i)return!1;for(var n;i-- >0;)if(n=s[i],n===tN&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!eN(e,n)||!r.equals(t[n],e[n],n,n,t,e,r))return!1;return!0}function Ni(t,e,r){var s=$I(t),i=s.length;if($I(e).length!==i)return!1;for(var n,o,c;i-- >0;)if(n=s[i],n===tN&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!eN(e,n)||!r.equals(t[n],e[n],n,n,t,e,r)||(o=YI(t,n),c=YI(e,n),(o||c)&&(!o||!c||o.configurable!==c.configurable||o.enumerable!==c.enumerable||o.writable!==c.writable)))return!1;return!0}function Mk(t,e){return Ns(t.valueOf(),e.valueOf())}function Fk(t,e){return t.source===e.source&&t.flags===e.flags}function ZI(t,e,r){if(t.size!==e.size)return!1;for(var s={},i=t.values(),n,o;(n=i.next())&&!n.done;){for(var c=e.values(),u=!1,l=0;(o=c.next())&&!o.done;)!u&&!s[l]&&(u=r.equals(n.value,o.value,n.value,o.value,t,e,r))&&(s[l]=!0),l++;if(!u)return!1}return!0}function Bk(t,e){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(t[r]!==e[r])return!1;return!0}var Uk="[object Arguments]",qk="[object Boolean]",Gk="[object Date]",kk="[object Map]",Hk="[object Number]",Wk="[object Object]",Vk="[object RegExp]",jk="[object Set]",Kk="[object String]",$k=Array.isArray,QI=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,JI=Object.assign,Yk=Object.prototype.toString.call.bind(Object.prototype.toString);function zk(t){var e=t.areArraysEqual,r=t.areDatesEqual,s=t.areMapsEqual,i=t.areObjectsEqual,n=t.arePrimitiveWrappersEqual,o=t.areRegExpsEqual,c=t.areSetsEqual,u=t.areTypedArraysEqual;return function(h,f,d){if(h===f)return!0;if(h==null||f==null||typeof h!="object"||typeof f!="object")return h!==h&&f!==f;var g=h.constructor;if(g!==f.constructor)return!1;if(g===Object)return i(h,f,d);if($k(h))return e(h,f,d);if(QI!=null&&QI(h))return u(h,f,d);if(g===Date)return r(h,f,d);if(g===RegExp)return o(h,f,d);if(g===Map)return s(h,f,d);if(g===Set)return c(h,f,d);var m=Yk(h);return m===Gk?r(h,f,d):m===Vk?o(h,f,d):m===kk?s(h,f,d):m===jk?c(h,f,d):m===Wk?typeof h.then!="function"&&typeof f.then!="function"&&i(h,f,d):m===Uk?i(h,f,d):m===qk||m===Hk||m===Kk?n(h,f,d):!1}}function Xk(t){var e=t.circular,r=t.createCustomConfig,s=t.strict,i={areArraysEqual:s?Ni:Dk,areDatesEqual:xk,areMapsEqual:s?KI(XI,Ni):XI,areObjectsEqual:s?Ni:Lk,arePrimitiveWrappersEqual:Mk,areRegExpsEqual:Fk,areSetsEqual:s?KI(ZI,Ni):ZI,areTypedArraysEqual:s?Ni:Bk};if(r&&(i=JI({},i,r(i))),e){var n=Ho(i.areArraysEqual),o=Ho(i.areMapsEqual),c=Ho(i.areObjectsEqual),u=Ho(i.areSetsEqual);i=JI({},i,{areArraysEqual:n,areMapsEqual:o,areObjectsEqual:c,areSetsEqual:u})}return i}function Zk(t){return function(e,r,s,i,n,o,c){return t(e,r,c)}}function Qk(t){var e=t.circular,r=t.comparator,s=t.createState,i=t.equals,n=t.strict;if(s)return function(u,l){var h=s(),f=h.cache,d=f===void 0?e?new WeakMap:void 0:f,g=h.meta;return r(u,l,{cache:d,equals:i,meta:g,strict:n})};if(e)return function(u,l){return r(u,l,{cache:new WeakMap,equals:i,meta:void 0,strict:n})};var o={cache:void 0,equals:i,meta:void 0,strict:n};return function(u,l){return r(u,l,o)}}var rN=nr(),_4=nr({strict:!0}),m4=nr({circular:!0}),g4=nr({circular:!0,strict:!0}),S4=nr({createInternalComparator:function(){return Ns}}),R4=nr({strict:!0,createInternalComparator:function(){return Ns}}),O4=nr({circular:!0,createInternalComparator:function(){return Ns}}),A4=nr({circular:!0,createInternalComparator:function(){return Ns},strict:!0});function nr(t){t===void 0&&(t={});var e=t.circular,r=e===void 0?!1:e,s=t.createInternalComparator,i=t.createState,n=t.strict,o=n===void 0?!1:n,c=Xk(t),u=zk(c),l=s?s(u):Zk(u);return Qk({circular:r,comparator:u,createState:i,equals:l,strict:o})}var tH=Ps(bs,"**","page.json"),rH=Ps(ws,"**","plugin.json"),sH=Ps(Cs,"**","plugin.json"),iH=Ps(vs,"**","modal.json"),nH=Ps(Lt,"**","embedded.json"),oH=Ps(Lr,"**","element.json"),Wo=class{emitter=new eH;watchers=[];prevModel;constructor(e){this.prevModel=e}watch(){let e=sN.default.watch([tH,rH,iH,nH,ch,oH,sH,Jy,Dr],{useFsEvents:!1,ignoreInitial:!0}).on("add",this.emitConfigUpdate).on("unlink",this.emitConfigUpdate).on("change",this.emitConfigUpdate);return this.watchers.push(e),this}onChange(e){return this.emitter.on("all",e),this}onError(e){return this.emitter.on("error",e),this}async close(){await Promise.all(this.watchers.map(e=>e.close()))}emitConfigUpdate=(0,iN.default)(async e=>{try{let r=await nN(this.prevModel.projectFolder);this.emitter.emit("all",r,"change-received"),!rN(r,this.prevModel)||Jk(e)==="embedded.html"?(this.prevModel=r,this.emitter.emit("all",r,"model-updated")):this.emitter.emit("all",r,"model-did-not-change")}catch(r){this.emitter.emit("error",r)}},200)};async function nN(t){let e=await F_();return{projectFolder:t,config:e,components:await tI({projectFolder:t,config:e})}}var aN=cH(null),U4=t=>{let[e,r]=oN(t.value),[s]=oN(()=>{let i=new Wo(e);return t.watchForChanges===!0&&i.watch().onChange((n,o)=>{o==="model-updated"&&r(n)}),i});return lH(()=>()=>{s.close()},[s]),aH.createElement(aN.Provider,{value:{model:e,watcher:s}},t.children)};function q4(){let t=uH(aN);if(t===null)throw new Error("useProjectModel() cannot be used without an <ProjectModelProvider>");return t}a();import{mkdir as hH}from"node:fs/promises";import{resolve as fH}from"node:path";import{homedir as dH}from"node:os";function pH(){return Hh().dataDir??fH(dH(),".wix")}async function K4(){await hH(pH(),{recursive:!0})}export{pH as a,K4 as b,aw as c,M_ as d,ze as e,He as f,PV as g,bV as h,Dr as i,RH as j,jh as k,rf as l,sf as m,xr as n,ar as o,Tf as p,yf as q,If as r,fd as s,dd as t,_N as u,mN as v,bs as w,ws as x,Cs as y,Sd as z,bH as A,wH as B,CH as C,vH as D,DH as E,xH as F,LH as G,MH as H,FH as I,BH as J,pt as K,MV as L,tr as M,Yq as N,ae as O,sr as P,wy as Q,Qq as R,k3 as S,Jq as T,H3 as U,pi as V,j3 as W,Cr as X,K3 as Y,My as Z,ky as _,Hy as $,c7 as aa,P1 as ba,b1 as ca,C1 as da,B1 as ea,U1 as fa,q1 as ga,b7 as ha,w7 as ia,C7 as ja,k1 as ka,V7 as la,rN as ma,nN as na,U4 as oa,q4 as pa};
|
|
11
11
|
/*! Bundled license information:
|
|
12
12
|
|
|
13
13
|
is-extglob/index.js:
|
|
@@ -70,4 +70,4 @@ mustache/mustache.mjs:
|
|
|
70
70
|
* http://github.com/janl/mustache.js
|
|
71
71
|
*)
|
|
72
72
|
*/
|
|
73
|
-
//# sourceMappingURL=chunk-
|
|
73
|
+
//# sourceMappingURL=chunk-YWJFUO7I.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{
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{k as o,l as d,m as u,n as p,o as c,p as I,s as b,t as h}from"./chunk-YWJFUO7I.js";import{h as e}from"./chunk-62RRZRN6.js";import{h as O}from"./chunk-HFDLXX7R.js";O();import C from"node:fs/promises";var l=e.object({errorReporting:e.object({url:e.string().optional(),artifact:e.object({fullArtifactId:e.string().max(255).min(1),version:e.string().max(255).min(1)}).optional()}).optional()}),m=e.object({iframeUrl:e.string().optional(),scriptAsset:e.object({exportedName:e.string(),containerId:e.string(),url:e.string(),scriptType:e.string().optional()}).optional()}),N=e.object({hostingPlatform:e.string(),fullPage:e.boolean().nullish(),hideInSidebar:e.boolean().nullish(),priority:e.number().nullish(),routePath:e.string().nullish(),title:e.string(),pageCategoryId:e.string().uuid().nullish(),activeSidebarPageId:e.string().nullish(),requiredPermission:e.string().nullish(),previousRoutePaths:e.array(e.string()).nullish()}).merge(l).merge(m).passthrough(),_=e.object({width:e.number().nullish(),height:e.number().nullish()}).merge(m).passthrough(),g=e.object({appId:e.string(),componentId:e.string().uuid(),spec:e.string().min(1),variantValue:e.string()}).passthrough().optional(),T=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_PAGE),compData:e.object({backOfficePage:N}),compName:e.string().optional(),experiment:g}).passthrough(),j=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION),compData:e.object({backOfficeExtension:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),extensionType:e.literal(I.BACK_OFFICE_EXTENSION_WIDGET),requiredPermission:e.string().nullish(),widget:_}).merge(l).passthrough()}),compName:e.string().optional(),experiment:g}).passthrough(),A=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION_WIDGET),compData:e.object({backOfficeExtensionWidget:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),description:e.string().optional(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(m).merge(l).passthrough()}),compName:e.string().optional(),experiment:g}).passthrough(),D=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION_MENU_ITEM),compData:e.object({backOfficeExtensionMenuItem:e.object({id:e.string().uuid(),title:e.string().min(1),subtitle:e.string().max(200).optional(),iconKey:e.string().min(3).max(50).optional(),extends:e.string().uuid(),action:e.object({navigateToPage:e.object({pageId:e.string().uuid(),relativeUrl:e.string().optional()}),openModal:e.object({componentId:e.string().uuid(),componentParams:e.record(e.string().min(1),e.string().min(1)).optional()})}).partial().superRefine((n,i)=>{!n.navigateToPage&&!n.openModal&&i.addIssue({code:e.ZodIssueCode.custom,message:"action must have either navigateToPage or openModal"})}),sentryDSN:e.string().optional(),requiredPermission:e.string().optional()}).merge(m).merge(l).passthrough()}),compName:e.string().optional(),experiment:g}).passthrough(),v=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_MODAL),compData:e.object({backOfficeModal:e.object({hostingPlatform:e.string(),title:e.string().nullish(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(m).merge(l).passthrough()}),compName:e.string().optional(),experiment:g}).passthrough(),y=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_SIDEBAR_CATEGORY),compData:e.object({backOfficeSidebarCategory:e.object({hostingPlatform:e.string(),title:e.string(),priority:e.number().nullish()})}),compName:e.string().optional()}).passthrough(),P=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_WIDGET),compName:e.string().optional()}).passthrough(),F=e.object({compId:e.string(),compType:e.literal(o.BACK_OFFICE_EXTENSION_CONTAINER),compName:e.string().optional()}).passthrough(),M=e.object({template:e.string(),name:e.string(),pages:e.enum([u.NONE_PAGES,u.ONCE,u.SPECIFIC_PAGES]),placement:e.enum([p.HEAD,p.BODY_START,p.BODY_END,p.NONE_PLACEMENT]),connectArticleUrl:e.string(),embedCategory:e.enum([c.UNKNOWN,c.FUNCTIONAL,c.ESSENTIAL,c.ANALYTICS,c.ADVERTISING]),loadOnce:e.boolean(),allowedForFreeSite:e.boolean()}),x=e.object({compId:e.string(),compType:e.literal(o.EMBEDDED_SCRIPT),compName:e.string().optional(),compData:e.object({embeddedScriptComponentData:M})}).passthrough(),k=e.object({base:e.object({id:e.string().optional(),name:e.string()}),installation:e.object({base:e.object({autoAdd:e.boolean().optional(),essential:e.boolean().optional(),maxInstances:e.number().optional()}).optional(),widget:e.object({default_preset:e.object({desktop_preset_id:e.string().optional(),tablet_preset_id:e.string().optional(),mobile_preset_id:e.string().optional()}).optional(),region:e.enum([d.BODY,d.FOOTER,d.HEADER])}).optional()}).optional(),widgetData:e.object({tagName:e.string(),scriptUrl:e.string(),scriptType:e.enum([b.NONE,b.COMMON_JS,b.ES_MODULE])}),behaviors:e.object({settings:e.object({settingsUrl:e.string()}).optional(),dashboard:e.object({dashboardPageComponentId:e.string()}).optional()}),size:e.object({width:e.object({allowStretch:e.boolean().optional(),defaultWidth:e.number().optional(),stretchByDefault:e.boolean().optional()}),height:e.object({defaultHeight:e.number(),heightMode:e.enum([h.AUTO,h.FIXED,h.UNKNOWN]).optional()})})}),W=e.object({compId:e.string(),compType:e.literal(o.CUSTOM_ELEMENT_WIDGET),compName:e.string().optional(),compData:e.object({customElementWidget:k})}).passthrough(),U=e.object({appId:e.string(),components:e.array(e.discriminatedUnion("compType",[T,j,A,D,v,y,P,F,x,W]))});async function X(n){try{let i=await C.readFile(n,"utf-8");return U.parse(JSON.parse(i))}catch(i){let a=i instanceof Error?i.toString():JSON.stringify(i);throw new Error(`Failed to read App Manifest at ${n}: ${a}`)}}var f=(n,i)=>new URL(n,i).href,E=(n,i)=>{let{scriptAsset:a,iframeUrl:r}=n;return a?{scriptAsset:{...a,url:f(a.url,i)}}:r?{iframeUrl:f(r,i)}:n},B=(n,i)=>({template:n.template.replaceAll("__STATICS_BASE_URL_PLACEHOLDER__",i)}),q=(n,i)=>{let a=JSON.parse(JSON.stringify(n)),r=i.endsWith("/")?i:`${i}/`;return a.components.forEach(S=>{let{compData:t,compType:s}=S;s===o.BACK_OFFICE_PAGE&&(t.backOfficePage={...t.backOfficePage,...E(t.backOfficePage,r)}),s===o.BACK_OFFICE_EXTENSION&&(t.backOfficeExtension.widget={...t.backOfficeExtension.widget,...E(t.backOfficeExtension.widget,r)}),s===o.BACK_OFFICE_EXTENSION_WIDGET&&(t.backOfficeExtensionWidget={...t.backOfficeExtensionWidget,...E(t.backOfficeExtensionWidget,r)}),s===o.BACK_OFFICE_MODAL&&(t.backOfficeModal={...t.backOfficeModal,...E(t.backOfficeModal,r)}),s===o.EMBEDDED_SCRIPT&&(t.embeddedScriptComponentData={...t.embeddedScriptComponentData,...B(t.embeddedScriptComponentData,r)}),s===o.CUSTOM_ELEMENT_WIDGET&&(t.customElementWidget={...t.customElementWidget,widgetData:{...t.customElementWidget.widgetData,scriptUrl:f(t.customElementWidget.widgetData.scriptUrl,r)},behaviors:{...t.customElementWidget.behaviors,...t.customElementWidget.behaviors.settings?{settings:{settingsUrl:f(t.customElementWidget.behaviors.settings.settingsUrl,r)}}:{}}})}),a};export{X as a,q as b};
|
|
4
|
+
//# sourceMappingURL=chunk-ZIVYB6TM.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a as m,c as b,e as V,h as d}from"./chunk-HFDLXX7R.js";var Ge=b((ss,qe)=>{"use strict";d();var{Duplex:Vt}=m("stream");function We(r){r.emit("close")}function $t(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Fe(r){this.removeListener("error",Fe),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function jt(r,e){let t=!0,i=new Vt({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(n,o){let l=!o&&i._readableState.objectMode?n.toString():n;i.push(l)||r.pause()}),r.once("error",function(n){i.destroyed||(t=!1,i.destroy(n))}),r.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(s,n){if(r.readyState===r.CLOSED){n(s),process.nextTick(We,i);return}let o=!1;r.once("error",function(f){o=!0,n(f)}),r.once("close",function(){o||n(s),process.nextTick(We,i)}),t&&r.terminate()},i._final=function(s){if(r.readyState===r.CONNECTING){r.once("open",function(){i._final(s)});return}r._socket!==null&&(r._socket._writableState.finished?(s(),i._readableState.endEmitted&&i.destroy()):(r._socket.once("finish",function(){s()}),r.close()))},i._read=function(){r.isPaused&&r.resume()},i._write=function(s,n,o){if(r.readyState===r.CONNECTING){r.once("open",function(){i._write(s,n,o)});return}r.send(s,o)},i.on("end",$t),i.on("error",Fe),i}qe.exports=jt});var P=b((ns,Ve)=>{"use strict";d();Ve.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var $=b((as,re)=>{"use strict";d();var{EMPTY_BUFFER:Ht}=P(),me=Buffer[Symbol.species];function zt(r,e){if(r.length===0)return Ht;if(r.length===1)return r[0];let t=Buffer.allocUnsafe(e),i=0;for(let s=0;s<r.length;s++){let n=r[s];t.set(n,i),i+=n.length}return i<e?new me(t.buffer,t.byteOffset,i):t}function $e(r,e,t,i,s){for(let n=0;n<s;n++)t[i+n]=r[n]^e[n&3]}function je(r,e){for(let t=0;t<r.length;t++)r[t]^=e[t&3]}function Yt(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function ge(r){if(ge.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new me(r):ArrayBuffer.isView(r)?e=new me(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),ge.readOnly=!1),e}re.exports={concat:zt,mask:$e,toArrayBuffer:Yt,toBuffer:ge,unmask:je};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=m("bufferutil");re.exports.mask=function(e,t,i,s,n){n<48?$e(e,t,i,s,n):r.mask(e,t,i,s,n)},re.exports.unmask=function(e,t){e.length<32?je(e,t):r.unmask(e,t)}}catch{}});var Ye=b((fs,ze)=>{"use strict";d();var He=Symbol("kDone"),ye=Symbol("kRun"),xe=class{constructor(e){this[He]=()=>{this.pending--,this[ye]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ye]()}[ye](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[He])}}};ze.exports=xe});var z=b((cs,Qe)=>{"use strict";d();var j=m("zlib"),Ke=$(),Kt=Ye(),{kStatusCode:Xe}=P(),Xt=Buffer[Symbol.species],Zt=Buffer.from([0,0,255,255]),ne=Symbol("permessage-deflate"),C=Symbol("total-length"),H=Symbol("callback"),R=Symbol("buffers"),ie=Symbol("error"),se,Se=class{constructor(e,t,i){if(this._maxPayload=i|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!se){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;se=new Kt(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[H];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,i=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(i.server_no_context_takeover=!0),t.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(i.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?i.client_max_window_bits=t.clientMaxWindowBits:(i.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(i=>{let s=t[i];if(s.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(s=s[0],i==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else if(i==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${i}": ${s}`);s=n}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${s}`)}else throw new Error(`Unknown parameter "${i}"`);t[i]=s})}),e}decompress(e,t,i){se.add(s=>{this._decompress(e,t,(n,o)=>{s(),i(n,o)})})}compress(e,t,i){se.add(s=>{this._compress(e,t,(n,o)=>{s(),i(n,o)})})}_decompress(e,t,i){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=j.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[ne]=this,this._inflate[C]=0,this._inflate[R]=[],this._inflate.on("error",Jt),this._inflate.on("data",Ze)}this._inflate[H]=i,this._inflate.write(e),t&&this._inflate.write(Zt),this._inflate.flush(()=>{let n=this._inflate[ie];if(n){this._inflate.close(),this._inflate=null,i(n);return}let o=Ke.concat(this._inflate[R],this._inflate[C]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[C]=0,this._inflate[R]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),i(null,o)})}_compress(e,t,i){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?j.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=j.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[C]=0,this._deflate[R]=[],this._deflate.on("data",Qt)}this._deflate[H]=i,this._deflate.write(e),this._deflate.flush(j.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Ke.concat(this._deflate[R],this._deflate[C]);t&&(n=new Xt(n.buffer,n.byteOffset,n.length-4)),this._deflate[H]=null,this._deflate[C]=0,this._deflate[R]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),i(null,n)})}};Qe.exports=Se;function Qt(r){this[R].push(r),this[C]+=r.length}function Ze(r){if(this[C]+=r.length,this[ne]._maxPayload<1||this[C]<=this[ne]._maxPayload){this[R].push(r);return}this[ie]=new RangeError("Max payload size exceeded"),this[ie].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ie][Xe]=1009,this.removeListener("data",Ze),this.reset()}function Jt(r){this[ne]._inflate=null,r[Xe]=1007,this[H](r)}});var Y=b((ds,oe)=>{"use strict";d();var{isUtf8:Je}=m("buffer"),er=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function tr(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Ee(r){let e=r.length,t=0;for(;t<e;)if(!(r[t]&128))t++;else if((r[t]&224)===192){if(t+1===e||(r[t+1]&192)!==128||(r[t]&254)===192)return!1;t+=2}else if((r[t]&240)===224){if(t+2>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||r[t]===224&&(r[t+1]&224)===128||r[t]===237&&(r[t+1]&224)===160)return!1;t+=3}else if((r[t]&248)===240){if(t+3>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||(r[t+3]&192)!==128||r[t]===240&&(r[t+1]&240)===128||r[t]===244&&r[t+1]>143||r[t]>244)return!1;t+=4}else return!1;return!0}oe.exports={isValidStatusCode:tr,isValidUTF8:Ee,tokenChars:er};if(Je)oe.exports.isValidUTF8=function(r){return r.length<24?Ee(r):Je(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=m("utf-8-validate");oe.exports.isValidUTF8=function(e){return e.length<32?Ee(e):r(e)}}catch{}});var ke=b((ps,ot)=>{"use strict";d();var{Writable:rr}=m("stream"),et=z(),{BINARY_TYPES:sr,EMPTY_BUFFER:tt,kStatusCode:ir,kWebSocket:nr}=P(),{concat:ve,toArrayBuffer:or,unmask:ar}=$(),{isValidStatusCode:lr,isValidUTF8:rt}=Y(),ae=Buffer[Symbol.species],O=0,st=1,it=2,nt=3,be=4,we=5,le=6,Oe=class extends rr{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||sr[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[nr]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=O}_write(e,t,i){if(this._opcode===8&&this._state==O)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new ae(i.buffer,i.byteOffset+e,i.length-e),new ae(i.buffer,i.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let i=this._buffers[0],s=t.length-e;e>=i.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(i.buffer,i.byteOffset,e),s),this._buffers[0]=new ae(i.buffer,i.byteOffset+e,i.length-e)),e-=i.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case O:this.getInfo(e);break;case st:this.getPayloadLength16(e);break;case it:this.getPayloadLength64(e);break;case nt:this.getMask();break;case be:this.getData(e);break;case we:case le:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){let s=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(s);return}let i=(t[0]&64)===64;if(i&&!this._extensions[et.extensionName]){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._fin=(t[0]&128)===128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(!this._fragmented){let s=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let s=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(s);return}if(i){let s=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(s);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let s=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(s);return}}else{let s=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(s);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)===128,this._isServer){if(!this._masked){let s=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(s);return}}else if(this._masked){let s=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(s);return}this._payloadLength===126?this._state=st:this._payloadLength===127?this._state=it:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),i=t.readUInt32BE(0);if(i>Math.pow(2,21)-1){let s=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(s);return}this._payloadLength=i*Math.pow(2,32)+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let t=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(t);return}this._masked?this._state=nt:this._state=be}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=be}getData(e){let t=tt;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&ar(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=we,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[et.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(o);return}this._fragments.push(n)}this.dataMessage(t),this._state===O&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=O;return}let t=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let s;this._binaryType==="nodebuffer"?s=ve(i,t):this._binaryType==="arraybuffer"?s=or(ve(i,t)):s=i,this._allowSynchronousEvents?(this.emit("message",s,!0),this._state=O):(this._state=le,setImmediate(()=>{this.emit("message",s,!0),this._state=O,this.startLoop(e)}))}else{let s=ve(i,t);if(!this._skipUTF8Validation&&!rt(s)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(n);return}this._state===we||this._allowSynchronousEvents?(this.emit("message",s,!1),this._state=O):(this._state=le,setImmediate(()=>{this.emit("message",s,!1),this._state=O,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,tt),this.end();else{let i=e.readUInt16BE(0);if(!lr(i)){let n=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");t(n);return}let s=new ae(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!rt(s)){let n=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(n);return}this._loop=!1,this.emit("conclude",i,s),this.end()}this._state=O;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=O):(this._state=le,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=O,this.startLoop(t)}))}createError(e,t,i,s,n){this._loop=!1,this._errored=!0;let o=new e(i?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=n,o[ir]=s,o}};ot.exports=Oe});var Ce=b((ys,ft)=>{"use strict";d();var{Duplex:gs}=m("stream"),{randomFillSync:fr}=m("crypto"),at=z(),{EMPTY_BUFFER:hr}=P(),{isValidStatusCode:cr}=Y(),{mask:lt,toBuffer:W}=$(),k=Symbol("kByteLength"),ur=Buffer.alloc(4),Te=class r{constructor(e,t,i){this._extensions=t||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let i,s=!1,n=2,o=!1;t.mask&&(i=t.maskBuffer||ur,t.generateMask?t.generateMask(i):fr(i,0,4),o=(i[0]|i[1]|i[2]|i[3])===0,n=6);let l;typeof e=="string"?(!t.mask||o)&&t[k]!==void 0?l=t[k]:(e=Buffer.from(e),l=e.length):(l=e.length,s=t.mask&&t.readOnly&&!o);let f=l;l>=65536?(n+=8,f=127):l>125&&(n+=2,f=126);let a=Buffer.allocUnsafe(s?l+n:n);return a[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(a[0]|=64),a[1]=f,f===126?a.writeUInt16BE(l,2):f===127&&(a[2]=a[3]=0,a.writeUIntBE(l,4,6)),t.mask?(a[1]|=128,a[n-4]=i[0],a[n-3]=i[1],a[n-2]=i[2],a[n-1]=i[3],o?[a,e]:s?(lt(e,i,a,n,l),[a]):(lt(e,i,e,0,l),[a,e])):[a,e]}close(e,t,i,s){let n;if(e===void 0)n=hr;else{if(typeof e!="number"||!cr(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let l=Buffer.byteLength(t);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+l),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[k]:n.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(r.frame(n,o),s)}ping(e,t,i){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=W(e),s=e.length,n=W.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(r.frame(e,o),i)}pong(e,t,i){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=W(e),s=e.length,n=W.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[k]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,i]):this.sendFrame(r.frame(e,o),i)}send(e,t,i){let s=this._extensions[at.extensionName],n=t.binary?2:1,o=t.compress,l,f;if(typeof e=="string"?(l=Buffer.byteLength(e),f=!1):(e=W(e),l=e.length,f=W.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=l>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let a={[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,a,i]):this.dispatch(e,this._compress,a,i)}else this.sendFrame(r.frame(e,{[k]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:!1}),i)}dispatch(e,t,i,s){if(!t){this.sendFrame(r.frame(e,i),s);return}let n=this._extensions[at.extensionName];this._bufferedBytes+=i[k],this._deflating=!0,n.compress(e,i.fin,(o,l)=>{if(this._socket.destroyed){let f=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(f);for(let a=0;a<this._queue.length;a++){let c=this._queue[a],h=c[c.length-1];typeof h=="function"&&h(f)}return}this._bufferedBytes-=i[k],this._deflating=!1,i.readOnly=!1,this.sendFrame(r.frame(l,i),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][k],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][k],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};ft.exports=Te});var yt=b((Ss,gt)=>{"use strict";d();var{kForOnEventAttribute:K,kListener:Ne}=P(),ht=Symbol("kCode"),ct=Symbol("kData"),ut=Symbol("kError"),dt=Symbol("kMessage"),_t=Symbol("kReason"),F=Symbol("kTarget"),pt=Symbol("kType"),mt=Symbol("kWasClean"),N=class{constructor(e){this[F]=null,this[pt]=e}get target(){return this[F]}get type(){return this[pt]}};Object.defineProperty(N.prototype,"target",{enumerable:!0});Object.defineProperty(N.prototype,"type",{enumerable:!0});var B=class extends N{constructor(e,t={}){super(e),this[ht]=t.code===void 0?0:t.code,this[_t]=t.reason===void 0?"":t.reason,this[mt]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[ht]}get reason(){return this[_t]}get wasClean(){return this[mt]}};Object.defineProperty(B.prototype,"code",{enumerable:!0});Object.defineProperty(B.prototype,"reason",{enumerable:!0});Object.defineProperty(B.prototype,"wasClean",{enumerable:!0});var q=class extends N{constructor(e,t={}){super(e),this[ut]=t.error===void 0?null:t.error,this[dt]=t.message===void 0?"":t.message}get error(){return this[ut]}get message(){return this[dt]}};Object.defineProperty(q.prototype,"error",{enumerable:!0});Object.defineProperty(q.prototype,"message",{enumerable:!0});var X=class extends N{constructor(e,t={}){super(e),this[ct]=t.data===void 0?null:t.data}get data(){return this[ct]}};Object.defineProperty(X.prototype,"data",{enumerable:!0});var dr={addEventListener(r,e,t={}){for(let s of this.listeners(r))if(!t[K]&&s[Ne]===e&&!s[K])return;let i;if(r==="message")i=function(n,o){let l=new X("message",{data:o?n:n.toString()});l[F]=this,fe(e,this,l)};else if(r==="close")i=function(n,o){let l=new B("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[F]=this,fe(e,this,l)};else if(r==="error")i=function(n){let o=new q("error",{error:n,message:n.message});o[F]=this,fe(e,this,o)};else if(r==="open")i=function(){let n=new N("open");n[F]=this,fe(e,this,n)};else return;i[K]=!!t[K],i[Ne]=e,t.once?this.once(r,i):this.on(r,i)},removeEventListener(r,e){for(let t of this.listeners(r))if(t[Ne]===e&&!t[K]){this.removeListener(r,t);break}}};gt.exports={CloseEvent:B,ErrorEvent:q,Event:N,EventTarget:dr,MessageEvent:X};function fe(r,e,t){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,t):r.call(e,t)}});var Le=b((vs,xt)=>{"use strict";d();var{tokenChars:Z}=Y();function T(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}function _r(r){let e=Object.create(null),t=Object.create(null),i=!1,s=!1,n=!1,o,l,f=-1,a=-1,c=-1,h=0;for(;h<r.length;h++)if(a=r.charCodeAt(h),o===void 0)if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(h!==0&&(a===32||a===9))c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let x=r.slice(f,c);a===44?(T(e,x,t),t=Object.create(null)):o=x,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(l===void 0)if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(a===32||a===9)c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h),T(t,r.slice(f,c),!0),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),f=c=-1}else if(a===61&&f!==-1&&c===-1)l=r.slice(f,h),f=c=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Z[a]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1?f=h:i||(i=!0),s=!1}else if(n)if(Z[a]===1)f===-1&&(f=h);else if(a===34&&f!==-1)n=!1,c=h;else if(a===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===34&&r.charCodeAt(h-1)===61)n=!0;else if(c===-1&&Z[a]===1)f===-1&&(f=h);else if(f!==-1&&(a===32||a===9))c===-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let x=r.slice(f,c);i&&(x=x.replace(/\\/g,""),i=!1),T(t,l,x),a===44&&(T(e,o,t),t=Object.create(null),o=void 0),l=void 0,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(f===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=h);let g=r.slice(f,c);return o===void 0?T(e,g,t):(l===void 0?T(t,g,!0):i?T(t,l,g.replace(/\\/g,"")):T(t,l,g),T(e,o,t)),e}function pr(r){return Object.keys(r).map(e=>{let t=r[e];return Array.isArray(t)||(t=[t]),t.map(i=>[e].concat(Object.keys(i).map(s=>{let n=i[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}xt.exports={format:pr,parse:_r}});var Be=b((ks,Lt)=>{"use strict";d();var mr=m("events"),gr=m("https"),yr=m("http"),vt=m("net"),xr=m("tls"),{randomBytes:Sr,createHash:Er}=m("crypto"),{Duplex:ws,Readable:Os}=m("stream"),{URL:Pe}=m("url"),I=z(),vr=ke(),br=Ce(),{BINARY_TYPES:St,EMPTY_BUFFER:he,GUID:wr,kForOnEventAttribute:Re,kListener:Or,kStatusCode:kr,kWebSocket:y,NOOP:bt}=P(),{EventTarget:{addEventListener:Tr,removeEventListener:Cr}}=yt(),{format:Nr,parse:Lr}=Le(),{toBuffer:Pr}=$(),Rr=30*1e3,wt=Symbol("kAborted"),Ie=[8,13],L=["CONNECTING","OPEN","CLOSING","CLOSED"],Ir=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,_=class r extends mr{constructor(e,t,i){super(),this._binaryType=St[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=he,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(i=t,t=[]):t=[t]),Ot(this,e,t,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){St.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,i){let s=new vr({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation});this._sender=new br(e,this._extensions,i.generateMask),this._receiver=s,this._socket=e,s[y]=this,e[y]=this,s.on("conclude",Dr),s.on("drain",Mr),s.on("error",Ar),s.on("message",Wr),s.on("ping",Fr),s.on("pong",qr),e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Tt),e.on("data",ue),e.on("end",Ct),e.on("error",Nt),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[I.extensionName]&&this._extensions[I.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){let i="WebSocket was closed before the connection was established";w(this,this._req,i);return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,t,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Rr)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=t=void 0):typeof t=="function"&&(i=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||he,t,i)}pong(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=t=void 0):typeof t=="function"&&(i=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||he,t,i)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,i){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(i=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ue(this,e,i);return}let s={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[I.extensionName]||(s.compress=!1),this._sender.send(e||he,s,i)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){let e="WebSocket was closed before the connection was established";w(this,this._req,e);return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(_,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(_.prototype,"CONNECTING",{enumerable:!0,value:L.indexOf("CONNECTING")});Object.defineProperty(_,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(_.prototype,"OPEN",{enumerable:!0,value:L.indexOf("OPEN")});Object.defineProperty(_,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(_.prototype,"CLOSING",{enumerable:!0,value:L.indexOf("CLOSING")});Object.defineProperty(_,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});Object.defineProperty(_.prototype,"CLOSED",{enumerable:!0,value:L.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(_.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(_.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Re])return e[Or];return null},set(e){for(let t of this.listeners(r))if(t[Re]){this.removeListener(r,t);break}typeof e=="function"&&this.addEventListener(r,e,{[Re]:!0})}})});_.prototype.addEventListener=Tr;_.prototype.removeEventListener=Cr;Lt.exports=_;function Ot(r,e,t,i){let s={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Ie[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...i,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=s.autoPong,!Ie.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${Ie.join(", ")})`);let n;if(e instanceof Pe)n=e;else try{n=new Pe(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),r._url=n.href;let o=n.protocol==="wss:",l=n.protocol==="ws+unix:",f;if(n.protocol!=="ws:"&&!o&&!l?f=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:l&&!n.pathname?f="The URL's pathname is empty":n.hash&&(f="The URL contains a fragment identifier"),f){let u=new SyntaxError(f);if(r._redirects===0)throw u;ce(r,u);return}let a=o?443:80,c=Sr(16).toString("base64"),h=o?gr.request:yr.request,g=new Set,x;if(s.createConnection=s.createConnection||(o?Br:Ur),s.defaultPort=s.defaultPort||a,s.port=n.port||a,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers={...s.headers,"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(x=new I(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Nr({[I.extensionName]:x.offer()})),t.length){for(let u of t){if(typeof u!="string"||!Ir.test(u)||g.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");g.add(u)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),l){let u=s.path.split(":");s.socketPath=u[0],s.path=u[1]}let p;if(s.followRedirects){if(r._redirects===0){r._originalIpc=l,r._originalSecure=o,r._originalHostOrSocketPath=l?s.socketPath:n.host;let u=i&&i.headers;if(i={...i,headers:{}},u)for(let[v,A]of Object.entries(u))i.headers[v.toLowerCase()]=A}else if(r.listenerCount("redirect")===0){let u=l?r._originalIpc?s.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:n.host===r._originalHostOrSocketPath;(!u||r._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,u||delete s.headers.host,s.auth=void 0)}s.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),p=r._req=h(s),r._redirects&&r.emit("redirect",r.url,p)}else p=r._req=h(s);s.timeout&&p.on("timeout",()=>{w(r,p,"Opening handshake has timed out")}),p.on("error",u=>{p===null||p[wt]||(p=r._req=null,ce(r,u))}),p.on("response",u=>{let v=u.headers.location,A=u.statusCode;if(v&&s.followRedirects&&A>=300&&A<400){if(++r._redirects>s.maxRedirects){w(r,p,"Maximum redirects exceeded");return}p.abort();let te;try{te=new Pe(v,e)}catch{let U=new SyntaxError(`Invalid URL: ${v}`);ce(r,U);return}Ot(r,te,t,i)}else r.emit("unexpected-response",p,u)||w(r,p,`Unexpected server response: ${u.statusCode}`)}),p.on("upgrade",(u,v,A)=>{if(r.emit("upgrade",u),r.readyState!==_.CONNECTING)return;if(p=r._req=null,u.headers.upgrade.toLowerCase()!=="websocket"){w(r,v,"Invalid Upgrade header");return}let te=Er("sha1").update(c+wr).digest("base64");if(u.headers["sec-websocket-accept"]!==te){w(r,v,"Invalid Sec-WebSocket-Accept header");return}let G=u.headers["sec-websocket-protocol"],U;if(G!==void 0?g.size?g.has(G)||(U="Server sent an invalid subprotocol"):U="Server sent a subprotocol but none was requested":g.size&&(U="Server sent no subprotocol"),U){w(r,v,U);return}G&&(r._protocol=G);let Me=u.headers["sec-websocket-extensions"];if(Me!==void 0){if(!x){w(r,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _e;try{_e=Lr(Me)}catch{w(r,v,"Invalid Sec-WebSocket-Extensions header");return}let Ae=Object.keys(_e);if(Ae.length!==1||Ae[0]!==I.extensionName){w(r,v,"Server indicated an extension that was not requested");return}try{x.accept(_e[I.extensionName])}catch{w(r,v,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[I.extensionName]=x}r.setSocket(v,A,{allowSynchronousEvents:s.allowSynchronousEvents,generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),s.finishRequest?s.finishRequest(p,r):p.end()}function ce(r,e){r._readyState=_.CLOSING,r.emit("error",e),r.emitClose()}function Ur(r){return r.path=r.socketPath,vt.connect(r)}function Br(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=vt.isIP(r.host)?"":r.host),xr.connect(r)}function w(r,e,t){r._readyState=_.CLOSING;let i=new Error(t);Error.captureStackTrace(i,w),e.setHeader?(e[wt]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(ce,r,i)):(e.destroy(i),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Ue(r,e,t){if(e){let i=Pr(e).length;r._socket?r._sender._bufferedBytes+=i:r._bufferedAmount+=i}if(t){let i=new Error(`WebSocket is not open: readyState ${r.readyState} (${L[r.readyState]})`);process.nextTick(t,i)}}function Dr(r,e){let t=this[y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=r,t._socket[y]!==void 0&&(t._socket.removeListener("data",ue),process.nextTick(kt,t._socket),r===1005?t.close():t.close(r,e))}function Mr(){let r=this[y];r.isPaused||r._socket.resume()}function Ar(r){let e=this[y];e._socket[y]!==void 0&&(e._socket.removeListener("data",ue),process.nextTick(kt,e._socket),e.close(r[kr])),e.emit("error",r)}function Et(){this[y].emitClose()}function Wr(r,e){this[y].emit("message",r,e)}function Fr(r){let e=this[y];e._autoPong&&e.pong(r,!this._isServer,bt),e.emit("ping",r)}function qr(r){this[y].emit("pong",r)}function kt(r){r.resume()}function Tt(){let r=this[y];this.removeListener("close",Tt),this.removeListener("data",ue),this.removeListener("end",Ct),r._readyState=_.CLOSING;let e;!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&(e=r._socket.read())!==null&&r._receiver.write(e),r._receiver.end(),this[y]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Et),r._receiver.on("finish",Et))}function ue(r){this[y]._receiver.write(r)||this.pause()}function Ct(){let r=this[y];r._readyState=_.CLOSING,r._receiver.end(),this.end()}function Nt(){let r=this[y];this.removeListener("error",Nt),this.on("error",bt),r&&(r._readyState=_.CLOSING,this.destroy())}});var Rt=b((Cs,Pt)=>{"use strict";d();var{tokenChars:Gr}=Y();function Vr(r){let e=new Set,t=-1,i=-1,s=0;for(s;s<r.length;s++){let o=r.charCodeAt(s);if(i===-1&&Gr[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))i===-1&&t!==-1&&(i=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);i===-1&&(i=s);let l=r.slice(t,i);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),t=i=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let n=r.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Pt.exports={parse:Vr}});var Wt=b((Ps,At)=>{"use strict";d();var $r=m("events"),de=m("http"),{Duplex:Ls}=m("stream"),{createHash:jr}=m("crypto"),It=Le(),D=z(),Hr=Rt(),zr=Be(),{GUID:Yr,kWebSocket:Kr}=P(),Xr=/^[+/0-9A-Za-z]{22}==$/,Ut=0,Bt=1,Mt=2,De=class extends $r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:zr,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=de.createServer((i,s)=>{let n=de.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=Zr(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,i)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Ut}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Mt){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Q,this);return}if(e&&this.once("close",e),this._state!==Bt)if(this._state=Bt,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Q,this):process.nextTick(Q,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Q(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,i,s){t.on("error",Dt);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){M(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){M(this,e,t,400,"Invalid Upgrade header");return}if(!n||!Xr.test(n)){M(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){M(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){J(t,400);return}let l=e.headers["sec-websocket-protocol"],f=new Set;if(l!==void 0)try{f=Hr.parse(l)}catch{M(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let a=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&a!==void 0){let h=new D(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let g=It.parse(a);g[D.extensionName]&&(h.accept(g[D.extensionName]),c[D.extensionName]=h)}catch{M(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(g,x,p,u)=>{if(!g)return J(t,x||401,p,u);this.completeUpgrade(c,n,f,e,t,i,s)});return}if(!this.options.verifyClient(h))return J(t,401)}this.completeUpgrade(c,n,f,e,t,i,s)}completeUpgrade(e,t,i,s,n,o,l){if(!n.readable||!n.writable)return n.destroy();if(n[Kr])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Ut)return J(n,503);let a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${jr("sha1").update(t+Yr).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(i.size){let h=this.options.handleProtocols?this.options.handleProtocols(i,s):i.values().next().value;h&&(a.push(`Sec-WebSocket-Protocol: ${h}`),c._protocol=h)}if(e[D.extensionName]){let h=e[D.extensionName].params,g=It.format({[D.extensionName]:[h]});a.push(`Sec-WebSocket-Extensions: ${g}`),c._extensions=e}this.emit("headers",a,s),n.write(a.concat(`\r
|
|
4
|
+
`).join(`\r
|
|
5
|
+
`)),n.removeListener("error",Dt),c.setSocket(n,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Q,this)})),l(c,s)}};At.exports=De;function Zr(r,e){for(let t of Object.keys(e))r.on(t,e[t]);return function(){for(let i of Object.keys(e))r.removeListener(i,e[i])}}function Q(r){r._state=Mt,r.emit("close")}function Dt(){this.destroy()}function J(r,e,t,i){t=t||de.STATUS_CODES[e],i={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t),...i},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${de.STATUS_CODES[e]}\r
|
|
6
|
+
`+Object.keys(i).map(s=>`${s}: ${i[s]}`).join(`\r
|
|
7
|
+
`)+`\r
|
|
8
|
+
\r
|
|
9
|
+
`+t)}function M(r,e,t,i,s){if(r.listenerCount("wsClientError")){let n=new Error(s);Error.captureStackTrace(n,M),r.emit("wsClientError",n,t,e)}else J(t,i,s)}});d();d();d();var Qr=V(Ge(),1),Jr=V(ke(),1),es=V(Ce(),1),Ft=V(Be(),1),ts=V(Wt(),1);var qt=Ft.default;var ee=global;ee.WebSocket||(ee.WebSocket=qt);ee.window||(ee.window=global);ee.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}];import rs from"react-devtools-core";rs.connectToDevTools();
|
|
10
|
+
//# sourceMappingURL=devtools-WFBFD7GB.js.map
|