{"version":3,"sources":["../src/search-params.ts"],"sourcesContent":["/**\n * Convert URLSearchParams into the object handed to routes as `search` /\n * `searchParams`: single keys stay strings and repeated keys collect into\n * arrays, in order. The dev renderer, the production SSR entry, the SPA\n * page-data endpoint, and the generated client hydration runtime all share\n * this helper so every environment agrees on one representation.\n */\nexport function searchParamsToObject(\n  searchParams: URLSearchParams,\n): Record<string, string | string[] | undefined> {\n  const output: Record<string, string | string[] | undefined> = {};\n\n  searchParams.forEach((value, key) => {\n    // Keys come from the request URL. Writing \"__proto__\" onto a plain object\n    // replaces its prototype instead of adding an entry, so a crafted query\n    // string could reshape the object handed to pages and workflow handlers.\n    // The API route helper (entriesToObject in api/runtime.ts) already skips\n    // these names; keep both representations consistent.\n    if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\") return;\n    const existing = Object.prototype.hasOwnProperty.call(output, key) ? output[key] : undefined;\n    if (existing !== undefined) {\n      if (Array.isArray(existing)) {\n        existing.push(value);\n      } else {\n        output[key] = [existing, value];\n      }\n    } else {\n      output[key] = value;\n    }\n  });\n\n  return output;\n}\n"],"mappings":";;;;;AAOO,SAAS,qBACd,cAC+C;AAC/C,QAAM,SAAwD,CAAC;AAE/D,eAAa,QAAQ,CAAC,OAAO,QAAQ;AAMnC,QAAI,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ,YAAa;AACzE,UAAM,WAAW,OAAO,UAAU,eAAe,KAAK,QAAQ,GAAG,IAAI,OAAO,GAAG,IAAI;AACnF,QAAI,aAAa,QAAW;AAC1B,UAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,iBAAS,KAAK,KAAK;AAAA,MACrB,OAAO;AACL,eAAO,GAAG,IAAI,CAAC,UAAU,KAAK;AAAA,MAChC;AAAA,IACF,OAAO;AACL,aAAO,GAAG,IAAI;AAAA,IAChB;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAzBgB;","names":[]}