@wix/cli-app 1.1.23 → 1.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/build/{CreateVersionCommand-4Y3LSQFU.js → CreateVersionCommand-AIHKPL4U.js} +2 -2
  2. package/build/{DevCommand-QU4ZN62E.js → DevCommand-JBYDBIHJ.js} +6 -6
  3. package/build/DevCommand-JBYDBIHJ.js.map +1 -0
  4. package/build/{GenerateCommand-IJJCCXFS.js → GenerateCommand-LVKRUIPR.js} +2 -2
  5. package/build/PreviewCommand-AJAW4S7U.js +4 -0
  6. package/build/{ServeCommand-6JXLNL5K.js → ServeCommand-JVBQYJCP.js} +2 -2
  7. package/build/{build-6PSKPDXG.js → build-EE6LGUY4.js} +2 -2
  8. package/build/{chunk-25SKF6FV.js → chunk-2EMNPHS4.js} +2 -2
  9. package/build/{chunk-25SKF6FV.js.map → chunk-2EMNPHS4.js.map} +1 -1
  10. package/build/chunk-5DKSEIPQ.js +4 -0
  11. package/build/chunk-5DKSEIPQ.js.map +1 -0
  12. package/build/{chunk-VUNOKF7Z.js → chunk-5DONBW64.js} +2 -2
  13. package/build/{chunk-BPJGNBMO.js → chunk-5Y6INJLR.js} +2 -2
  14. package/build/{chunk-BPJGNBMO.js.map → chunk-5Y6INJLR.js.map} +1 -1
  15. package/build/{chunk-DLKUAPZH.js → chunk-BXV4CRED.js} +2 -2
  16. package/build/{chunk-HDYAE3XT.js → chunk-CVDYHY4Z.js} +2 -2
  17. package/build/{chunk-QQZQIJFZ.js → chunk-DHSOX7Q3.js} +2 -2
  18. package/build/{chunk-OK6AW6ZM.js → chunk-DSZA37YO.js} +2 -2
  19. package/build/{chunk-EXJ5FROA.js → chunk-ENEPC5FX.js} +3 -3
  20. package/build/{chunk-YPPMUY6M.js → chunk-IMEXFRQF.js} +2 -2
  21. package/build/{chunk-ADKWZ4EI.js → chunk-KIPWMZ5B.js} +2 -2
  22. package/build/{chunk-ZEGL5G7A.js → chunk-KTOYAW3Z.js} +2 -2
  23. package/build/{chunk-ZW7WK7M6.js → chunk-NNRXODGG.js} +2 -2
  24. package/build/{chunk-LZXJDSN6.js → chunk-PWK5QRCL.js} +2 -2
  25. package/build/{chunk-4QWJJMEM.js → chunk-R6AW3SG2.js} +2 -2
  26. package/build/{chunk-LQZY2KM3.js → chunk-SOO7TNTX.js} +2 -2
  27. package/build/{chunk-LQZY2KM3.js.map → chunk-SOO7TNTX.js.map} +1 -1
  28. package/build/{chunk-EJFNJ7PW.js → chunk-TKTLLIGH.js} +10 -10
  29. package/build/{chunk-EJFNJ7PW.js.map → chunk-TKTLLIGH.js.map} +1 -1
  30. package/build/{chunk-GV4TSXMP.js → chunk-U3GMUQMZ.js} +2 -2
  31. package/build/{chunk-IC4CACFZ.js → chunk-VA2XSYDC.js} +2 -2
  32. package/build/devtools-LGJXFI3T.js +10 -0
  33. package/build/devtools-LGJXFI3T.js.map +1 -0
  34. package/build/{esm-IHGGGJ6T.js → esm-Z5T56VLV.js} +2 -2
  35. package/build/{esm-IHGGGJ6T.js.map → esm-Z5T56VLV.js.map} +1 -1
  36. package/build/index.js +2 -2
  37. package/build/{preview-IISIQHI4.js → preview-MJR23HYD.js} +2 -2
  38. package/build/render-command-GNXNFDOC.js +4 -0
  39. package/build/{render-command-Y6VGWYZF.js.map → render-command-GNXNFDOC.js.map} +1 -1
  40. package/package.json +4 -4
  41. package/build/DevCommand-QU4ZN62E.js.map +0 -1
  42. package/build/PreviewCommand-BFDJD574.js +0 -4
  43. package/build/chunk-6XYAO7TZ.js +0 -4
  44. package/build/chunk-6XYAO7TZ.js.map +0 -1
  45. package/build/devtools-FITZMLEV.js +0 -10
  46. package/build/devtools-FITZMLEV.js.map +0 -1
  47. package/build/render-command-Y6VGWYZF.js +0 -4
  48. /package/build/{CreateVersionCommand-4Y3LSQFU.js.map → CreateVersionCommand-AIHKPL4U.js.map} +0 -0
  49. /package/build/{GenerateCommand-IJJCCXFS.js.map → GenerateCommand-LVKRUIPR.js.map} +0 -0
  50. /package/build/{PreviewCommand-BFDJD574.js.map → PreviewCommand-AJAW4S7U.js.map} +0 -0
  51. /package/build/{ServeCommand-6JXLNL5K.js.map → ServeCommand-JVBQYJCP.js.map} +0 -0
  52. /package/build/{build-6PSKPDXG.js.map → build-EE6LGUY4.js.map} +0 -0
  53. /package/build/{chunk-VUNOKF7Z.js.map → chunk-5DONBW64.js.map} +0 -0
  54. /package/build/{chunk-DLKUAPZH.js.map → chunk-BXV4CRED.js.map} +0 -0
  55. /package/build/{chunk-HDYAE3XT.js.map → chunk-CVDYHY4Z.js.map} +0 -0
  56. /package/build/{chunk-QQZQIJFZ.js.map → chunk-DHSOX7Q3.js.map} +0 -0
  57. /package/build/{chunk-OK6AW6ZM.js.map → chunk-DSZA37YO.js.map} +0 -0
  58. /package/build/{chunk-EXJ5FROA.js.map → chunk-ENEPC5FX.js.map} +0 -0
  59. /package/build/{chunk-YPPMUY6M.js.map → chunk-IMEXFRQF.js.map} +0 -0
  60. /package/build/{chunk-ADKWZ4EI.js.map → chunk-KIPWMZ5B.js.map} +0 -0
  61. /package/build/{chunk-ZEGL5G7A.js.map → chunk-KTOYAW3Z.js.map} +0 -0
  62. /package/build/{chunk-ZW7WK7M6.js.map → chunk-NNRXODGG.js.map} +0 -0
  63. /package/build/{chunk-LZXJDSN6.js.map → chunk-PWK5QRCL.js.map} +0 -0
  64. /package/build/{chunk-4QWJJMEM.js.map → chunk-R6AW3SG2.js.map} +0 -0
  65. /package/build/{chunk-GV4TSXMP.js.map → chunk-U3GMUQMZ.js.map} +0 -0
  66. /package/build/{chunk-IC4CACFZ.js.map → chunk-VA2XSYDC.js.map} +0 -0
  67. /package/build/{preview-IISIQHI4.js.map → preview-MJR23HYD.js.map} +0 -0
@@ -1,4 +0,0 @@
1
- import { createRequire as _createRequire } from 'node:module';
2
- const require = _createRequire(import.meta.url);
3
- import{a}from"./chunk-OK6AW6ZM.js";import"./chunk-ZEGL5G7A.js";import"./chunk-QZS4ARDD.js";import"./chunk-4QWJJMEM.js";import"./chunk-QQZQIJFZ.js";import"./chunk-ZW7WK7M6.js";import"./chunk-ADKWZ4EI.js";import"./chunk-LZXJDSN6.js";import"./chunk-IC4CACFZ.js";import"./chunk-HDYAE3XT.js";import"./chunk-YPPMUY6M.js";import"./chunk-EXJ5FROA.js";import"./chunk-25SKF6FV.js";import"./chunk-EJFNJ7PW.js";import"./chunk-LQZY2KM3.js";import"./chunk-V4TR6DCM.js";export{a as PreviewCommand};
4
- //# sourceMappingURL=PreviewCommand-BFDJD574.js.map
@@ -1,4 +0,0 @@
1
- import { createRequire as _createRequire } from 'node:module';
2
- const require = _createRequire(import.meta.url);
3
- import{A as B,B as y,C as E,Y as h,_ as v,aa as T,p as I,t as n,u as C,v as M,wa as A,ya as N,z as u}from"./chunk-EJFNJ7PW.js";import{a as g,c as l,d as c}from"./chunk-LQZY2KM3.js";import{e as f,h as p}from"./chunk-V4TR6DCM.js";p();var w=f(g(),1);import{randomUUID as F}from"node:crypto";var x=t=>{let r=new Map;[...t].sort((a,e)=>a.id.localeCompare(e.id)).forEach(a=>{let e=r.get(a.id)??[];e.push(a),r.set(a.id,e)});let i=new Map;if(r.forEach((a,e)=>{a.length>1&&i.set(e,a)}),i.size)throw new l({code:c.DuplicateComponentIdsError({issues:Array.from(i.entries()).map(([a,e])=>({id:a,components:e.map(m=>(0,w.match)(m,{DashboardPage:({title:o,relativePath:d})=>({name:o,type:"page",path:h(d,"json")}),DashboardPlugin:({title:o,relativePath:d})=>({name:o,type:"plugin",path:h(d,"json")}),DashboardMenuPlugin:({title:o,relativePath:d})=>({name:o,type:"menu-plugin",path:d}),DashboardModal:({title:o,relativePath:d})=>({name:o,type:"modal",path:h(d,"json")}),DashboardSidebarCategory:({label:o})=>({name:o,type:"sidebar-category",path:I}),EmbeddedScript:({relativePath:o})=>({name:o,type:"embedded-script",path:h(o,"json")}),CustomElement:({name:o,relativePath:d})=>({name:o,type:"custom-element",path:h(d,"json")}),Topology:({name:o})=>({name:o,type:"topology",path:""})})).sort((m,o)=>m.name.localeCompare(o.name)),suggestedId:F()}))})})};p();var O=f(g(),1);import{randomUUID as R}from"node:crypto";var W=(t,r)=>{if(t.experiments)return{appId:r,componentId:t.id,spec:t.experiments.enabledBy,variantValue:"true"}};async function L(t){return t?.map(r=>({compId:R(),compData:{webhook:{webhookSlug:r,callbackUrl:"__WEBHOOKS_URL_PLACEHOLDER__"}},compType:n.WEBHOOK,compName:r}))||[]}var Z=t=>({compId:t.id,compType:n.CUSTOM_ELEMENT_WIDGET,compName:t.name,compData:{customElementWidget:{base:{name:t.name},widgetData:{tagName:t.tagName,scriptType:y.ES_MODULE,scriptUrl:"https://dummy.web.com"},size:{width:{defaultWidth:t.width.defaultWidth,allowStretch:t.width.allowStretch,stretchByDefault:t.width.stretchByDefault},height:{defaultHeight:t.height.defaultHeight,heightMode:E.FIXED}},installation:{base:{autoAdd:t.installation?.autoAddToSite,essential:t.installation?.essential,maxInstances:t.installation?.maxInstances},widget:{region:C.BODY}},behaviors:{}}}});async function ee({appId:t,components:r,sentryDSN:s,componentSourceBuilder:i,registeredEvents:a}){return x(r),{appId:t,components:[...await L(a),...await Promise.all(r.map((0,O.match)({DashboardPage:async e=>{let m=e.sentryDSN??s;return{compId:e.id,compType:n.BACK_OFFICE_PAGE,compData:{backOfficePage:{hostingPlatform:u.BUSINESS_MANAGER,fullPage:e.sidebar?.whenActive?.hideSidebar,hideInSidebar:e.sidebar?.disabled,priority:e.sidebar?.priority,routePath:e.route.slice(1),title:e.title,pageCategoryId:e.sidebar?.categoryId,activeSidebarPageId:e.sidebar?.whenActive?.selectedPageId,requiredPermission:e.requiredPermission,previousRoutePaths:e.additionalRoutes,...m?{errorReporting:{url:m}}:void 0,...await i(e)}},compName:e.title,experiment:W(e,t)}},DashboardPlugin:async e=>({compId:e.id,compType:n.BACK_OFFICE_EXTENSION_WIDGET,compData:{backOfficeExtensionWidget:{hostingPlatform:u.BUSINESS_MANAGER,extends:e.extends,title:e.title,requiredPermission:e.requiredPermission,width:e.width,height:e.height,...await i(e),...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardMenuPlugin:async e=>({compId:e.id,compType:n.BACK_OFFICE_EXTENSION_MENU_ITEM,compData:{backOfficeExtensionMenuItem:{hostingPlatform:u.BUSINESS_MANAGER,id:e.id,title:e.title,subtitle:e.subtitle,iconKey:e.iconKey,extends:e.extends,action:e.action,requiredPermission:e.requiredPermission,...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardModal:async e=>({compId:e.id,compType:n.BACK_OFFICE_MODAL,compData:{backOfficeModal:{hostingPlatform:u.BUSINESS_MANAGER,title:e.title,requiredPermission:e.requiredPermission,width:e.width,height:e.height,...await i(e),...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardSidebarCategory:async e=>({compId:e.id,compType:n.BACK_OFFICE_SIDEBAR_CATEGORY,compData:{backOfficeSidebarCategory:{hostingPlatform:u.BUSINESS_MANAGER,title:e.label,priority:e.priority}},compName:e.label}),EmbeddedScript:async e=>({compId:e.id,compType:n.EMBEDDED_SCRIPT,compName:e.name,compData:{embeddedScriptComponentData:{name:e.name,pages:M.NONE_PAGES,placement:e.placement,connectArticleUrl:"",embedCategory:e.scriptType,dependencies:e.dependencies,loadOnce:!0,allowedForFreeSite:!0,...await i(e)}}}),CustomElement:async e=>{let{scriptUrl:m,settingsUrl:o}=await i(e);return{compId:e.id,compType:n.CUSTOM_ELEMENT_WIDGET,compName:e.name,compData:{customElementWidget:{base:{name:e.name},widgetData:{tagName:e.tagName,scriptType:y.ES_MODULE,scriptUrl:m},size:{width:{defaultWidth:e.width.defaultWidth,allowStretch:e.width.allowStretch,stretchByDefault:e.width.stretchByDefault},height:{defaultHeight:e.height.defaultHeight,heightMode:E.FIXED}},installation:{base:{autoAdd:e.installation?.autoAddToSite,essential:e.installation?.essential,maxInstances:e.installation?.maxInstances},widget:{region:C.BODY}},behaviors:{...e.relativePanelPath?{settings:{settingsUrl:o}}:{}}}}}},Topology:async e=>({compId:e.id,compType:n.TOPOLOGY,compName:e.name,compData:{topology:{topology:{backendApiUrl:e.backendApiUrl}}}})})))]}}p();var k=f(g(),1);p();function U(t){if(!("output"in t||Array.isArray(t)))throw new l({code:c.InvalidViteBuildOutput()});return Array.isArray(t)?t.flatMap(i=>i.output):t.output}function b(t,r){let i=U(t).find(a=>a.type==="chunk"&&a.facadeModuleId===r);if(!i)throw new l({code:c.ViteModuleBundleNotFound()});return i.fileName}function _(t,r){let i=U(t).find(a=>a.fileName===r);if(!i||!("source"in i))throw new l({code:c.ViteFileNotFoundInOutput({fileName:r})});return i.source.toString()}async function V(t,r){let s=new URL(t.relativePath,r).href;return await fetch(s).then(a=>a.text())}var P=(t,r,s)=>{if(!r.config.trusted)return{iframeUrl:v(t.id)};let i=T(t.id),a=s?b(s,i):`/@id/${i}?import`;return{scriptAsset:{exportedName:t.id,containerId:r.config.appId,url:a,scriptType:B.MODULE}}},j=async(t,r,s)=>({template:r?_(r,t.relativePath):await V(t,s)}),G=(t,r)=>{let s=N(t.id);return{scriptUrl:r?b(r,s):`/@id/${s}?import`,settingsUrl:A(t.id)}};function pe({model:t,buildOutput:r,devServerUrl:s}){return async i=>(0,k.match)(i,{EmbeddedScript:e=>j(e,r,s),DashboardSidebarCategory:()=>{},CustomElement:e=>G(e,r),DashboardPage:e=>P(e,t,r),DashboardPlugin:e=>P(e,t,r),DashboardModal:e=>P(e,t,r),DashboardMenuPlugin:()=>{},Topology:()=>{}})}export{x as a,Z as b,ee as c,pe as d};
4
- //# sourceMappingURL=chunk-6XYAO7TZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/app-manifest/validate.ts","../src/app-manifest/create.ts","../src/app-manifest/component-source.ts","../src/app-manifest/build-output-data-extractor.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { match } from 'variant';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { CONFIG_FILENAME } from '@wix/cli-core-definitions';\nimport { replaceExtension } from '../dev-center/components/path.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\nexport const validateComponents = (components: DevCenterComponent[]) => {\n const devCenterComponentsToIdMap: Map<string, DevCenterComponent[]> =\n new Map();\n const sortedComponentsById = [...components].sort((a, b) =>\n a.id.localeCompare(b.id)\n );\n sortedComponentsById.forEach((component) => {\n const componentList = devCenterComponentsToIdMap.get(component.id) ?? [];\n componentList.push(component);\n devCenterComponentsToIdMap.set(component.id, componentList);\n });\n\n const devCenterComponentsWithSameIDMap: Map<string, DevCenterComponent[]> =\n new Map();\n\n devCenterComponentsToIdMap.forEach((devCenterComponents, key) => {\n if (devCenterComponents.length > 1) {\n devCenterComponentsWithSameIDMap.set(key, devCenterComponents);\n }\n });\n\n if (devCenterComponentsWithSameIDMap.size) {\n throw new CliError({\n code: CliErrorCode.DuplicateComponentIdsError({\n issues: Array.from(devCenterComponentsWithSameIDMap.entries()).map(\n ([id, devCenterComponents]) => {\n return {\n id,\n components: devCenterComponents\n .map((component) =>\n match(component, {\n DashboardPage: ({ title, relativePath }) => ({\n name: title,\n type: 'page' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardPlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'plugin' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardMenuPlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'menu-plugin' as const,\n // We can use the relative path since the path already points to the menu config json\n path: relativePath,\n }),\n DashboardModal: ({ title, relativePath }) => ({\n name: title,\n type: 'modal' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardSidebarCategory: ({ label }) => ({\n name: label,\n type: 'sidebar-category' as const,\n path: CONFIG_FILENAME,\n }),\n EmbeddedScript: ({ relativePath }) => ({\n name: relativePath,\n type: 'embedded-script' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n CustomElement: ({ name, relativePath }) => ({\n name,\n type: 'custom-element' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n Topology: ({ name }) => ({\n name,\n type: 'topology' as const,\n // Topology component doesn't have a config file\n path: '',\n }),\n })\n )\n .sort((a, b) => a.name.localeCompare(b.name)),\n suggestedId: randomUUID(),\n };\n }\n ),\n }),\n });\n }\n};\n","import {\n ComponentType,\n BackOfficeHostingPlatforms,\n EmbeddedScriptPages,\n HeightMode,\n RegionType,\n CustomElementScriptType,\n} from '@wix/ambassador-devcenter-components-v1-component/types';\nimport { match } from 'variant';\nimport { randomUUID } from 'node:crypto';\nimport type {\n AppManifest,\n ComponentExperiment,\n BackofficePage,\n BackofficeExtensionWidget,\n BackofficeExtensionMenuItem,\n BackofficeSideCategory,\n BackofficeModal,\n EmbeddedScript,\n CustomElement,\n Webhook,\n Topology,\n} from '@wix/cli-app-manifest';\nimport { validateComponents } from './validate.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\nimport type { ComponentSourceBuilder } from './component-source.js';\n\ntype CreateAppManifestParams = {\n appId: string;\n backendServerUrl?: string;\n registeredEvents: string[];\n components: DevCenterComponent[];\n sentryDSN?: string;\n componentSourceBuilder: ComponentSourceBuilder;\n};\n\nconst getExperiment = (\n component: DevCenterComponent<'DashboardPage'>,\n appId: string\n): ComponentExperiment => {\n if (component.experiments) {\n return {\n appId,\n componentId: component.id,\n spec: component.experiments.enabledBy,\n variantValue: 'true',\n };\n }\n return undefined;\n};\n\nasync function getManifestWebhooks(registeredEvents: string[]) {\n return (\n registeredEvents?.map<Webhook>((eventSlug) => ({\n compId: randomUUID(),\n compData: {\n webhook: {\n webhookSlug: eventSlug,\n callbackUrl: '__WEBHOOKS_URL_PLACEHOLDER__',\n },\n },\n compType: ComponentType.WEBHOOK as const,\n compName: eventSlug,\n })) || []\n );\n}\n\nexport const createCustomElementConfig = (\n component: DevCenterComponent<'CustomElement'>\n): CustomElement => {\n return {\n compId: component.id,\n compType: ComponentType.CUSTOM_ELEMENT_WIDGET as const,\n compName: component.name,\n compData: {\n customElementWidget: {\n base: {\n name: component.name,\n },\n widgetData: {\n tagName: component.tagName,\n scriptType: CustomElementScriptType.ES_MODULE,\n scriptUrl: 'https://dummy.web.com',\n },\n size: {\n width: {\n defaultWidth: component.width.defaultWidth,\n allowStretch: component.width.allowStretch,\n stretchByDefault: component.width.stretchByDefault,\n },\n height: {\n defaultHeight: component.height.defaultHeight,\n heightMode: HeightMode.FIXED,\n },\n },\n installation: {\n base: {\n autoAdd: component.installation?.autoAddToSite,\n essential: component.installation?.essential,\n maxInstances: component.installation?.maxInstances,\n },\n widget: { region: RegionType.BODY },\n },\n behaviors: {},\n },\n },\n };\n};\n\nexport async function createAppManifest({\n appId,\n components,\n sentryDSN,\n componentSourceBuilder,\n registeredEvents,\n}: CreateAppManifestParams): Promise<AppManifest> {\n validateComponents(components);\n\n return {\n appId,\n components: [\n ...(await getManifestWebhooks(registeredEvents)),\n ...(await Promise.all(\n components.map(\n match({\n DashboardPage: async (component): Promise<BackofficePage> => {\n const componentSentryDSN = component.sentryDSN ?? sentryDSN;\n return {\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_PAGE as const,\n compData: {\n backOfficePage: {\n hostingPlatform:\n BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n fullPage: component.sidebar?.whenActive?.hideSidebar,\n hideInSidebar: component.sidebar?.disabled,\n priority: component.sidebar?.priority,\n routePath: component.route.slice(1),\n title: component.title,\n pageCategoryId: component.sidebar?.categoryId,\n activeSidebarPageId:\n component.sidebar?.whenActive?.selectedPageId,\n requiredPermission: component.requiredPermission,\n previousRoutePaths: component.additionalRoutes,\n ...(componentSentryDSN\n ? { errorReporting: { url: componentSentryDSN } }\n : undefined),\n ...(await componentSourceBuilder(component)),\n },\n },\n compName: component.title,\n experiment: getExperiment(component, appId),\n };\n },\n DashboardPlugin: async (\n component\n ): Promise<BackofficeExtensionWidget> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_WIDGET as const,\n compData: {\n backOfficeExtensionWidget: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n extends: component.extends,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardMenuPlugin: async (\n component\n ): Promise<BackofficeExtensionMenuItem> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_MENU_ITEM as const,\n compData: {\n backOfficeExtensionMenuItem: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n id: component.id,\n title: component.title,\n subtitle: component.subtitle,\n iconKey: component.iconKey,\n extends: component.extends,\n action: component.action,\n requiredPermission: component.requiredPermission,\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardModal: async (component): Promise<BackofficeModal> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_MODAL as const,\n compData: {\n backOfficeModal: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardSidebarCategory: async (\n component\n ): Promise<BackofficeSideCategory> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_SIDEBAR_CATEGORY as const,\n compData: {\n backOfficeSidebarCategory: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.label,\n priority: component.priority,\n },\n },\n compName: component.label,\n }),\n EmbeddedScript: async (component): Promise<EmbeddedScript> => ({\n compId: component.id,\n compType: ComponentType.EMBEDDED_SCRIPT as const,\n compName: component.name,\n compData: {\n embeddedScriptComponentData: {\n name: component.name,\n pages: EmbeddedScriptPages.NONE_PAGES,\n placement: component.placement,\n connectArticleUrl: '',\n embedCategory: component.scriptType,\n dependencies: component.dependencies,\n loadOnce: true,\n allowedForFreeSite: true,\n ...(await componentSourceBuilder(component)),\n },\n },\n }),\n CustomElement: async (component): Promise<CustomElement> => {\n const { scriptUrl, settingsUrl } = await componentSourceBuilder(\n component\n );\n\n return {\n compId: component.id,\n compType: ComponentType.CUSTOM_ELEMENT_WIDGET as const,\n compName: component.name,\n compData: {\n customElementWidget: {\n base: {\n name: component.name,\n },\n widgetData: {\n tagName: component.tagName,\n scriptType: CustomElementScriptType.ES_MODULE,\n scriptUrl,\n },\n size: {\n width: {\n defaultWidth: component.width.defaultWidth,\n allowStretch: component.width.allowStretch,\n stretchByDefault: component.width.stretchByDefault,\n },\n height: {\n defaultHeight: component.height.defaultHeight,\n heightMode: HeightMode.FIXED,\n },\n },\n installation: {\n base: {\n autoAdd: component.installation?.autoAddToSite,\n essential: component.installation?.essential,\n maxInstances: component.installation?.maxInstances,\n },\n widget: { region: RegionType.BODY },\n },\n behaviors: {\n ...(component.relativePanelPath\n ? { settings: { settingsUrl } }\n : {}),\n },\n },\n },\n };\n },\n Topology: async (component): Promise<Topology> => {\n return {\n compId: component.id,\n compType: ComponentType.TOPOLOGY as const,\n compName: component.name,\n compData: {\n topology: {\n topology: {\n backendApiUrl: component.backendApiUrl,\n },\n },\n },\n };\n },\n })\n )\n )),\n ],\n };\n}\n","import { BackOfficeScriptAssetType } from '@wix/ambassador-devcenter-components-v1-component/types';\nimport type { ComponentSource } from '@wix/cli-app-manifest';\nimport { match } from 'variant';\nimport {\n virtualModuleIdForScriptAsset,\n virtualPathForHTMLAsset,\n} from '../dev-center/components/dashboard/config.js';\nimport {\n virtualModuleIdForCustomElementScriptAsset,\n virtualPathForCustomElementPanelHTMLAsset,\n} from '../dev-center/components/site/config.js';\nimport type { ProjectModel } from '../model.js';\nimport type { ViteBuildOutput } from './build-output-data-extractor.js';\nimport {\n extractModuleBundleContent,\n extractModuleBundleName,\n} from './build-output-data-extractor.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\ntype DashboardSource =\n | {\n iframeUrl: string;\n scriptAsset?: never;\n }\n | {\n scriptAsset: ComponentSource['scriptAsset'];\n iframeUrl?: never;\n };\ntype EmbeddedScriptSource = {\n template: string;\n};\ntype CustomElementSource = { scriptUrl: string; settingsUrl: string };\n\nexport type ComponentSourceBuilder = <T extends DevCenterComponent>(\n component: T\n) => Promise<\n T extends DevCenterComponent<'EmbeddedScript'>\n ? EmbeddedScriptSource\n : T extends DevCenterComponent<'CustomElement'>\n ? CustomElementSource\n : T extends DevCenterComponent<'DashboardPage'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardPlugin'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardModal'>\n ? DashboardSource\n : undefined\n>;\n\nasync function getEmbeddedScriptDevTemplate(\n component: DevCenterComponent<'EmbeddedScript'>,\n devServerUrl?: string\n) {\n const url = new URL(component.relativePath, devServerUrl).href;\n const devTemplate = await fetch(url).then((res) => res.text());\n\n return devTemplate;\n}\n\nconst dashboardSourceBuilder = (\n component:\n | DevCenterComponent<'DashboardPage'>\n | DevCenterComponent<'DashboardPlugin'>\n | DevCenterComponent<'DashboardModal'>,\n model: ProjectModel,\n buildOutput?: ViteBuildOutput\n): DashboardSource => {\n if (!model.config.trusted) {\n return {\n iframeUrl: virtualPathForHTMLAsset(component.id),\n };\n }\n const moduleId = virtualModuleIdForScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptAsset: {\n exportedName: component.id,\n containerId: model.config.appId,\n url: componentUrl,\n scriptType: BackOfficeScriptAssetType.MODULE,\n },\n };\n};\n\nconst embeddedScriptBuilder = async (\n component: DevCenterComponent<'EmbeddedScript'>,\n buildOutput?: ViteBuildOutput,\n devServerUrl?: string\n): Promise<EmbeddedScriptSource> => {\n return {\n template: buildOutput\n ? extractModuleBundleContent(buildOutput, component.relativePath)\n : await getEmbeddedScriptDevTemplate(component, devServerUrl),\n };\n};\n\nconst customElementBuilder = (\n component: DevCenterComponent<'CustomElement'>,\n buildOutput?: ViteBuildOutput\n): CustomElementSource => {\n const moduleId = virtualModuleIdForCustomElementScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptUrl: componentUrl,\n settingsUrl: virtualPathForCustomElementPanelHTMLAsset(component.id),\n };\n};\n\nexport function getComponentSourceBuilder({\n model,\n buildOutput,\n devServerUrl,\n}: {\n model: ProjectModel;\n buildOutput?: ViteBuildOutput;\n devServerUrl?: string;\n}) {\n return (async (component: DevCenterComponent) => {\n const source = match(component, {\n EmbeddedScript: (embeddedScriptComponent) =>\n embeddedScriptBuilder(\n embeddedScriptComponent,\n buildOutput,\n devServerUrl\n ),\n DashboardSidebarCategory: () => {},\n CustomElement: (customElementComponent) =>\n customElementBuilder(customElementComponent, buildOutput),\n DashboardPage: (dashboardPageComponent) =>\n dashboardSourceBuilder(dashboardPageComponent, model, buildOutput),\n DashboardPlugin: (dashboardPluginComponent) =>\n dashboardSourceBuilder(dashboardPluginComponent, model, buildOutput),\n DashboardModal: (dashboardModalComponent) =>\n dashboardSourceBuilder(dashboardModalComponent, model, buildOutput),\n DashboardMenuPlugin: () => {},\n Topology: () => {},\n });\n\n return source;\n }) as ComponentSourceBuilder;\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { build } from 'vite';\n\nexport type ViteBuildOutput = Awaited<ReturnType<typeof build>>;\n\nfunction extractBuildOutputs(buildOutput: ViteBuildOutput) {\n const isValidRollupOutput =\n 'output' in buildOutput || Array.isArray(buildOutput);\n\n if (!isValidRollupOutput) {\n throw new CliError({ code: CliErrorCode.InvalidViteBuildOutput() });\n }\n\n const outputs = Array.isArray(buildOutput)\n ? buildOutput.flatMap((output) => output.output)\n : buildOutput.output;\n\n return outputs;\n}\n\nexport function extractModuleBundleName(\n buildOutput: ViteBuildOutput,\n moduleId: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find(\n (output) => output.type === 'chunk' && output.facadeModuleId === moduleId\n );\n\n if (!output) {\n throw new CliError({ code: CliErrorCode.ViteModuleBundleNotFound() });\n }\n\n return output.fileName;\n}\n\nexport function extractModuleBundleContent(\n buildOutput: ViteBuildOutput,\n fileName: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find((output) => output.fileName === fileName);\n\n if (!output || !('source' in output)) {\n throw new CliError({\n code: CliErrorCode.ViteFileNotFoundInOutput({ fileName }),\n });\n }\n\n return output.source.toString();\n}\n"],"mappings":";;oOAAAA,IACA,IAAAC,EAAsB,SADtB,OAAS,cAAAC,MAAkB,cAOpB,IAAMC,EAAsBC,GAAqC,CACtE,IAAMC,EACJ,IAAI,IACuB,CAAC,GAAGD,CAAU,EAAE,KAAK,CAAC,EAAGE,IACpD,EAAE,GAAG,cAAcA,EAAE,EAAE,CACzB,EACqB,QAASC,GAAc,CAC1C,IAAMC,EAAgBH,EAA2B,IAAIE,EAAU,EAAE,GAAK,CAAC,EACvEC,EAAc,KAAKD,CAAS,EAC5BF,EAA2B,IAAIE,EAAU,GAAIC,CAAa,CAC5D,CAAC,EAED,IAAMC,EACJ,IAAI,IAQN,GANAJ,EAA2B,QAAQ,CAACK,EAAqBC,IAAQ,CAC3DD,EAAoB,OAAS,GAC/BD,EAAiC,IAAIE,EAAKD,CAAmB,CAEjE,CAAC,EAEGD,EAAiC,KACnC,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,2BAA2B,CAC5C,OAAQ,MAAM,KAAKJ,EAAiC,QAAQ,CAAC,EAAE,IAC7D,CAAC,CAACK,EAAIJ,CAAmB,KAChB,CACL,GAAAI,EACA,WAAYJ,EACT,IAAKH,MACJ,SAAMA,EAAW,CACf,cAAe,CAAC,CAAE,MAA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shims","import_variant","randomUUID","validateComponents","components","devCenterComponentsToIdMap","b","component","componentList","devCenterComponentsWithSameIDMap","devCenterComponents","key","CliError","CliErrorCode","id","title","relativePath","replaceExtension","label","CONFIG_FILENAME","name","a","randomUUID","init_esm_shims","import_variant","randomUUID","getExperiment","component","appId","getManifestWebhooks","registeredEvents","eventSlug","randomUUID","ComponentType","createCustomElementConfig","CustomElementScriptType","HeightMode","RegionType","createAppManifest","components","sentryDSN","componentSourceBuilder","validateComponents","componentSentryDSN","BackOfficeHostingPlatforms","EmbeddedScriptPages","scriptUrl","settingsUrl","init_esm_shims","import_variant","init_esm_shims","extractBuildOutputs","buildOutput","CliError","CliErrorCode","output","extractModuleBundleName","moduleId","extractModuleBundleContent","fileName","getEmbeddedScriptDevTemplate","component","devServerUrl","url","res","dashboardSourceBuilder","model","buildOutput","virtualPathForHTMLAsset","moduleId","virtualModuleIdForScriptAsset","componentUrl","extractModuleBundleName","BackOfficeScriptAssetType","embeddedScriptBuilder","extractModuleBundleContent","customElementBuilder","virtualModuleIdForCustomElementScriptAsset","virtualPathForCustomElementPanelHTMLAsset","getComponentSourceBuilder","embeddedScriptComponent","customElementComponent","dashboardPageComponent","dashboardPluginComponent","dashboardModalComponent"]}
@@ -1,10 +0,0 @@
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-V4TR6DCM.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){w(this,this._req,"WebSocket was closed before the connection was established");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){w(this,this._req,"WebSocket was closed before the connection was established");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-FITZMLEV.js.map