var f = Object.defineProperty;
var i = (e, n) => f(e, "name", { value: n, configurable: !0 });
import { headerContentType as a, headerUnaryEncoding as p, headerProtocolVersion as h, headerUnaryContentLength as m, headerUnaryAcceptEncoding as y } from "./headers.js";
import { protocolVersion as U } from "./version.js";
import { protoBase64 as C } from "../../../../../../../@bufbuild_protobuf@1.10.0/node_modules/@bufbuild/protobuf/dist/esm/proto-base64.js";
const s = "application/";
function T(e, n) {
  return n ? C.enc(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "") : encodeURIComponent(new TextDecoder().decode(e));
}
i(T, "encodeMessageForUrl");
function x(e, n, r) {
  let o = `?connect=v${U}`;
  const t = e.header.get(a);
  t?.indexOf(s) === 0 && (o += "&encoding=" + encodeURIComponent(t.slice(s.length)));
  const c = e.header.get(p);
  c !== null && c !== "identity" && (o += "&compression=" + encodeURIComponent(c), r = !0), r && (o += "&base64=1"), o += "&message=" + T(n, r);
  const l = e.url + o, d = new Headers(e.header);
  return [
    h,
    a,
    m,
    p,
    y
  ].forEach((g) => d.delete(g)), Object.assign(Object.assign({}, e), {
    init: Object.assign(Object.assign({}, e.init), { method: "GET" }),
    url: l,
    header: d
  });
}
i(x, "transformConnectPostToGetRequest");
export {
  x as transformConnectPostToGetRequest
};
