{"version":3,"file":"index.mjs","names":[],"sources":["../../src/visual-editing/index.ts"],"sourcesContent":["/**\n * The visual-editing toolbar for hosts that serve the public site from\n * somewhere EmDash's middleware never runs (a static build behind a proxy).\n * Such a host decides who is an editor and splices the toolbar into the HTML\n * itself; the pieces are the same ones the middleware uses.\n */\n\nexport { EDIT_PARAM, renderToolbarBootstrap } from \"./toolbar-bootstrap.js\";\nexport { renderToolbar, type ToolbarConfig } from \"./toolbar.js\";\n\n/** Cookie the toolbar's own toggle sets to request an edit-mode render. */\nexport const EDIT_MODE_COOKIE = \"emdash-edit-mode\";\n\n/** Users at or above this role see the toolbar (author). */\nexport const TOOLBAR_MIN_ROLE = 30;\n\n/**\n * Splice `toolbarHtml` in front of `</body>`. Returns the input unchanged when\n * the document has no body end tag (fragments, non-HTML bodies).\n */\nexport function injectToolbarHtml(html: string, toolbarHtml: string): string {\n\tconst at = html.lastIndexOf(\"</body>\");\n\treturn at === -1 ? html : `${html.slice(0, at)}${toolbarHtml}${html.slice(at)}`;\n}\n\n/** Whether a Cookie header carries `name` with the given value. */\nexport function cookieHas(cookieHeader: string | null, name: string, value: string): boolean {\n\tif (!cookieHeader) return false;\n\treturn cookieHeader.split(\";\").some((part) => part.trim() === `${name}=${value}`);\n}\n"],"mappings":";;;;AAWA,MAAa,mBAAmB;;AAGhC,MAAa,mBAAmB;;;;;AAMhC,SAAgB,kBAAkB,MAAc,aAA6B;CAC5E,MAAM,KAAK,KAAK,YAAY,UAAU;AACtC,QAAO,OAAO,KAAK,OAAO,GAAG,KAAK,MAAM,GAAG,GAAG,GAAG,cAAc,KAAK,MAAM,GAAG;;;AAI9E,SAAgB,UAAU,cAA6B,MAAc,OAAwB;AAC5F,KAAI,CAAC,aAAc,QAAO;AAC1B,QAAO,aAAa,MAAM,IAAI,CAAC,MAAM,SAAS,KAAK,MAAM,KAAK,GAAG,KAAK,GAAG,QAAQ"}