import {slug} from "../utils"; // Page paths — where a reference's page lives beyond the converter's default // (`operationId` / `objects/`): the explicit `x-docs.path` a page may // carry, and the canonical the `operationPaths: "title"` option derives from a // page's group and its verb-first summary. The x-docs pass applies both // (pluginSidebar.ts); the Rust twin is crates/apitoolchain_openapi/src/page_paths.rs. // // The grammar of a derived operation path: // // summary := Verb Rest // Verb := a word of PAGE_PATH_VERBS, case-insensitive; a third-person // "s" / "es" is dropped ("Lists" → list, "Searches" → search) // Rest := the remaining words, minus PAGE_PATH_FUNCTION_WORDS and the // group's noun (every word of the group, singular and plural // alike); what is left, lowercased and hyphenated, is the // sub-resource // canonical := /[/] (the group slugged) // // "Create widget" in `widgets` → `widgets/create`; "List widget parts" → // `widgets/parts/list`; "Retrieve part snapshot" → `widgets/part-snapshot/retrieve`. // A summary that does not start with a verb, or an operation without a group, // keeps the converter's canonical. // // A component page derives `/