"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createHMRChannel = exports.upwardChannelToDownwardChannel = exports.createInternalChannel = exports.createUpwardChannel = exports.createDownwardChannel = void 0;
/**
 * channel id 暂时未加 devtoolsId，所以当开启多个 chrome-devtools 时，下行消息是广播到所有
 * ws endpoint 的，体验上也不影响调试
 */
const downwardSpliter = '_down_';
const upwardSpliter = '_up_';
const internalSpliter = '_internal_';
const defaultExtensionName = 'default';
const createDownwardChannel = (clientId, extensionName) => createChannel(clientId, extensionName, downwardSpliter);
exports.createDownwardChannel = createDownwardChannel;
const createUpwardChannel = (clientId, extensionName) => createChannel(clientId, extensionName, upwardSpliter);
exports.createUpwardChannel = createUpwardChannel;
const createInternalChannel = (clientId, extensionName) => createChannel(clientId, extensionName, internalSpliter);
exports.createInternalChannel = createInternalChannel;
const upwardChannelToDownwardChannel = (upwardChannelId) => upwardChannelId.replace(upwardSpliter, downwardSpliter);
exports.upwardChannelToDownwardChannel = upwardChannelToDownwardChannel;
const createHMRChannel = (hash) => `HMR-${hash}`;
exports.createHMRChannel = createHMRChannel;
const createChannel = (clientId, extensionName, spliter) => `${clientId}${spliter}${extensionName || defaultExtensionName}`;
