"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _chunkZYCIF2P6js = require("./chunk-ZYCIF2P6.js");
var _chunkMPYVIZZQjs = require("./chunk-MPYVIZZQ.js");
require("./chunk-FCGNWPJI.js");
// src/react.ts
function usePartySocket(options) {
const { host, ...otherOptions } = options;
const socket = _chunkMPYVIZZQjs.useStableSocket.call(void 0, {
options: {
host:
host ||
(typeof window !== "undefined"
? window.location.host
: "dummy-domain.com"),
...otherOptions
},
createSocket: (options2) => new (0, _chunkZYCIF2P6js.PartySocket)(options2),
createSocketMemoKey: (options2) =>
JSON.stringify([
// NOTE: if query is defined as a function, the socket
// won't reconnect when you change the function identity
options2.query,
options2.id,
options2.host,
options2.room,
options2.party,
options2.path,
options2.protocol,
options2.protocols,
options2.basePath,
options2.prefix,
..._chunkMPYVIZZQjs.getOptionsThatShouldCauseRestartWhenChanged.call(
void 0,
options2
)
])
});
_chunkMPYVIZZQjs.useAttachWebSocketEventHandlers.call(
void 0,
socket,
options
);
return socket;
}
exports.default = usePartySocket;
exports.usePartySocket = usePartySocket;
exports.useWebSocket = _chunkMPYVIZZQjs.useWebSocket;
//# sourceMappingURL=react.js.map