import{transformToCamelCase as d}from"./transform-to-camel-case.js";function c(r,t){return t?.[r]??d(r)}function S(r,t,u){if(!t.length){const n={value:String(r.id),id:String(r.id)};return Buffer.from(JSON.stringify(n)).toString("base64")}const i=t.map(n=>{const o=c(n.field,u),s=r[o];if(s===void 0&&n.field!=="id")throw new Error(`Cursor field '${n.field}' (key: ${String(o)}) not found in entity`);return String(s??r.id)}),e=r.id;if(e==null)return Buffer.from(JSON.stringify({values:i})).toString("base64");const f=String(e);if(i.length===1){const n={value:i[0],id:f};return Buffer.from(JSON.stringify(n)).toString("base64")}const g={values:i,id:f};return Buffer.from(JSON.stringify(g)).toString("base64")}export{S as createCursor};
