@supersoniks/concorde 5.0.2 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/build-infos.json +1 -1
  2. package/concorde-core.bundle.js +1 -1
  3. package/concorde-core.es.js +1 -1
  4. package/dist/concorde-core.bundle.js +1 -1
  5. package/dist/concorde-core.es.js +1 -1
  6. package/docs/altcha-widget.js +2662 -0
  7. package/docs/assets/index--GpD7R7a.css +1 -0
  8. package/docs/assets/index-BnK6OS7w.js +12115 -0
  9. package/docs/crawl/core/components/functional/date/date.html +190 -0
  10. package/docs/crawl/core/components/functional/fetch/fetch.html +109 -0
  11. package/docs/crawl/core/components/functional/if/if.html +27 -0
  12. package/docs/crawl/core/components/functional/jsonata/jsonata.html +79 -0
  13. package/docs/crawl/core/components/functional/list/list.html +70 -0
  14. package/docs/crawl/core/components/functional/mix/mix.html +45 -0
  15. package/docs/crawl/core/components/functional/queue/queue.html +96 -0
  16. package/docs/crawl/core/components/functional/router/router.html +106 -0
  17. package/docs/crawl/core/components/functional/sdui/sdui.html +269 -0
  18. package/docs/crawl/core/components/functional/states/states.html +66 -0
  19. package/docs/crawl/core/components/functional/submit/submit.html +160 -0
  20. package/docs/crawl/core/components/functional/subscriber/subscriber.html +67 -0
  21. package/docs/crawl/core/components/functional/value/value.html +51 -0
  22. package/docs/crawl/core/components/ui/alert/alert.html +140 -0
  23. package/docs/crawl/core/components/ui/alert-messages/alert-messages.html +23 -0
  24. package/docs/crawl/core/components/ui/badge/badge.html +148 -0
  25. package/docs/crawl/core/components/ui/button/button.html +150 -0
  26. package/docs/crawl/core/components/ui/captcha/captcha.html +30 -0
  27. package/docs/crawl/core/components/ui/card/card.html +143 -0
  28. package/docs/crawl/core/components/ui/divider/divider.html +58 -0
  29. package/docs/crawl/core/components/ui/form/checkbox/checkbox.html +73 -0
  30. package/docs/crawl/core/components/ui/form/fieldset/fieldset.html +135 -0
  31. package/docs/crawl/core/components/ui/form/form-actions/form-actions.html +79 -0
  32. package/docs/crawl/core/components/ui/form/form-layout/form-layout.html +62 -0
  33. package/docs/crawl/core/components/ui/form/input/input.html +109 -0
  34. package/docs/crawl/core/components/ui/form/input-autocomplete/input-autocomplete.html +38 -0
  35. package/docs/crawl/core/components/ui/form/radio/radio.html +56 -0
  36. package/docs/crawl/core/components/ui/form/select/select.html +73 -0
  37. package/docs/crawl/core/components/ui/form/switch/switch.html +56 -0
  38. package/docs/crawl/core/components/ui/form/textarea/textarea.html +59 -0
  39. package/docs/crawl/core/components/ui/group/group.html +82 -0
  40. package/docs/crawl/core/components/ui/icon/icon.html +133 -0
  41. package/docs/crawl/core/components/ui/image/image.html +186 -0
  42. package/docs/crawl/core/components/ui/link/link.html +42 -0
  43. package/docs/crawl/core/components/ui/loader/loader.html +50 -0
  44. package/docs/crawl/core/components/ui/menu/menu.html +322 -0
  45. package/docs/crawl/core/components/ui/modal/modal.html +117 -0
  46. package/docs/crawl/core/components/ui/pop/pop.html +178 -0
  47. package/docs/crawl/core/components/ui/progress/progress.html +58 -0
  48. package/docs/crawl/core/components/ui/table/table.html +413 -0
  49. package/docs/crawl/core/components/ui/toast/toast.html +122 -0
  50. package/docs/crawl/core/components/ui/tooltip/tooltip.html +79 -0
  51. package/docs/crawl/docs/_core-concept/dataFlow.html +177 -0
  52. package/docs/crawl/docs/_core-concept/overview.html +66 -0
  53. package/docs/crawl/docs/_core-concept/subscriber.html +75 -0
  54. package/docs/crawl/docs/_decorators/ancestor-attribute.html +116 -0
  55. package/docs/crawl/docs/_decorators/auto-subscribe.html +202 -0
  56. package/docs/crawl/docs/_decorators/bind.html +141 -0
  57. package/docs/crawl/docs/_decorators/get.html +149 -0
  58. package/docs/crawl/docs/_decorators/handle.html +165 -0
  59. package/docs/crawl/docs/_decorators/on-assign.html +355 -0
  60. package/docs/crawl/docs/_decorators/patch.html +78 -0
  61. package/docs/crawl/docs/_decorators/post.html +139 -0
  62. package/docs/crawl/docs/_decorators/publish.html +61 -0
  63. package/docs/crawl/docs/_decorators/put.html +78 -0
  64. package/docs/crawl/docs/_decorators/subscribe.html +109 -0
  65. package/docs/crawl/docs/_decorators/wait-for-ancestors.html +137 -0
  66. package/docs/crawl/docs/_directives/sub.html +93 -0
  67. package/docs/crawl/docs/_getting-started/ai-agents.html +173 -0
  68. package/docs/crawl/docs/_getting-started/concorde-manual-install.html +100 -0
  69. package/docs/crawl/docs/_getting-started/concorde-outside.html +58 -0
  70. package/docs/crawl/docs/_getting-started/create-a-component.html +111 -0
  71. package/docs/crawl/docs/_getting-started/my-first-component.html +189 -0
  72. package/docs/crawl/docs/_getting-started/my-first-subscriber.html +110 -0
  73. package/docs/crawl/docs/_getting-started/pubsub.html +62 -0
  74. package/docs/crawl/docs/_getting-started/start.html +76 -0
  75. package/docs/crawl/docs/_getting-started/theming.html +85 -0
  76. package/docs/crawl/docs/_misc/api-configuration.html +149 -0
  77. package/docs/crawl/docs/_misc/dataProviderKey.html +135 -0
  78. package/docs/crawl/docs/_misc/docs-mock-api.html +158 -0
  79. package/docs/crawl/docs/_misc/dynamic-path.html +180 -0
  80. package/docs/crawl/docs/_misc/endpoint.html +50 -0
  81. package/docs/crawl/docs/_misc/formelement-subscriber-removal.html +138 -0
  82. package/docs/crawl/docs/_misc/html-integration.html +48 -0
  83. package/docs/crawl/hubs/decorators.html +547 -0
  84. package/docs/crawl/hubs/form-components.html +359 -0
  85. package/docs/crawl/hubs/remote-data.html +452 -0
  86. package/docs/crawl/index.html +101 -0
  87. package/docs/css/docs.css +0 -0
  88. package/docs/docs-mock-api-sw.js +724 -0
  89. package/docs/docs-mock-api-sw.js.map +7 -0
  90. package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
  91. package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
  92. package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
  93. package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
  94. package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
  95. package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
  96. package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
  97. package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
  98. package/docs/fonts/ClashGrotesk-Light.eot +0 -0
  99. package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
  100. package/docs/fonts/ClashGrotesk-Light.woff +0 -0
  101. package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
  102. package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
  103. package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
  104. package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
  105. package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
  106. package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
  107. package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
  108. package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
  109. package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
  110. package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
  111. package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
  112. package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
  113. package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
  114. package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
  115. package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
  116. package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
  117. package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
  118. package/docs/img/concorde-icon.svg +5 -0
  119. package/docs/img/concorde-logo.svg +1 -0
  120. package/docs/img/concorde.png +0 -0
  121. package/docs/img/concorde_def.png +0 -0
  122. package/docs/img/concorde_seuil.png.webp +0 -0
  123. package/docs/img/concorde_seuil_invert.png +0 -0
  124. package/docs/img/paul_metrand.jpg +0 -0
  125. package/docs/img/paul_metrand_xs.jpg +0 -0
  126. package/docs/index.html +93 -0
  127. package/docs/llms-full.txt +5945 -0
  128. package/docs/llms.txt +104 -0
  129. package/docs/robots.txt +16 -0
  130. package/docs/sitemap.xml +237 -0
  131. package/docs/src/core/components/functional/date/date.md +290 -0
  132. package/docs/src/core/components/functional/fetch/fetch.md +125 -0
  133. package/docs/src/core/components/functional/if/if.md +9 -0
  134. package/docs/src/core/components/functional/jsonata/jsonata.md +56 -0
  135. package/docs/src/core/components/functional/list/list.md +65 -0
  136. package/docs/src/core/components/functional/mix/mix.md +41 -0
  137. package/docs/src/core/components/functional/queue/queue.md +72 -0
  138. package/docs/src/core/components/functional/router/router.md +94 -0
  139. package/docs/src/core/components/functional/sdui/default-library.json +108 -0
  140. package/docs/src/core/components/functional/sdui/example.json +99 -0
  141. package/docs/src/core/components/functional/sdui/sdui.md +356 -0
  142. package/docs/src/core/components/functional/states/states.md +87 -0
  143. package/docs/src/core/components/functional/submit/submit.md +114 -0
  144. package/docs/src/core/components/functional/subscriber/subscriber.md +91 -0
  145. package/docs/src/core/components/functional/value/value.md +35 -0
  146. package/docs/src/core/components/ui/alert/alert.md +177 -0
  147. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  148. package/docs/src/core/components/ui/badge/badge.md +175 -0
  149. package/docs/src/core/components/ui/button/button.md +183 -0
  150. package/docs/src/core/components/ui/captcha/captcha.md +12 -0
  151. package/docs/src/core/components/ui/card/card.md +152 -0
  152. package/docs/src/core/components/ui/divider/divider.md +35 -0
  153. package/docs/src/core/components/ui/form/checkbox/checkbox.md +77 -0
  154. package/docs/src/core/components/ui/form/fieldset/fieldset.md +129 -0
  155. package/docs/src/core/components/ui/form/form-actions/form-actions.md +77 -0
  156. package/docs/src/core/components/ui/form/form-layout/form-layout.md +44 -0
  157. package/docs/src/core/components/ui/form/input/input.md +142 -0
  158. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +29 -0
  159. package/docs/src/core/components/ui/form/radio/radio.md +57 -0
  160. package/docs/src/core/components/ui/form/select/select.md +71 -0
  161. package/docs/src/core/components/ui/form/switch/switch.md +57 -0
  162. package/docs/src/core/components/ui/form/textarea/textarea.md +65 -0
  163. package/docs/src/core/components/ui/group/group.md +75 -0
  164. package/docs/src/core/components/ui/icon/icon.md +125 -0
  165. package/docs/src/core/components/ui/icon/icons.json +1 -0
  166. package/docs/src/core/components/ui/image/image.md +201 -0
  167. package/docs/src/core/components/ui/link/link.md +43 -0
  168. package/docs/src/core/components/ui/loader/loader.md +55 -0
  169. package/docs/src/core/components/ui/menu/menu.md +329 -0
  170. package/docs/src/core/components/ui/modal/modal.md +119 -0
  171. package/docs/src/core/components/ui/pop/pop.md +200 -0
  172. package/docs/src/core/components/ui/progress/progress.md +63 -0
  173. package/docs/src/core/components/ui/table/table.md +455 -0
  174. package/docs/src/core/components/ui/toast/toast.md +166 -0
  175. package/docs/src/core/components/ui/tooltip/tooltip.md +82 -0
  176. package/docs/src/docs/_core-concept/dataFlow.md +88 -0
  177. package/docs/src/docs/_core-concept/overview.md +57 -0
  178. package/docs/src/docs/_core-concept/subscriber.md +75 -0
  179. package/docs/src/docs/_decorators/ancestor-attribute.md +127 -0
  180. package/docs/src/docs/_decorators/auto-subscribe.md +202 -0
  181. package/docs/src/docs/_decorators/bind.md +167 -0
  182. package/docs/src/docs/_decorators/get.md +162 -0
  183. package/docs/src/docs/_decorators/handle.md +175 -0
  184. package/docs/src/docs/_decorators/on-assign.md +390 -0
  185. package/docs/src/docs/_decorators/patch.md +70 -0
  186. package/docs/src/docs/_decorators/post.md +146 -0
  187. package/docs/src/docs/_decorators/publish.md +55 -0
  188. package/docs/src/docs/_decorators/put.md +70 -0
  189. package/docs/src/docs/_decorators/subscribe.md +100 -0
  190. package/docs/src/docs/_decorators/wait-for-ancestors.md +163 -0
  191. package/docs/src/docs/_directives/sub.md +91 -0
  192. package/docs/src/docs/_getting-started/ai-agents.md +76 -0
  193. package/docs/src/docs/_getting-started/concorde-manual-install.md +133 -0
  194. package/docs/src/docs/_getting-started/concorde-outside.md +33 -0
  195. package/docs/src/docs/_getting-started/create-a-component.md +139 -0
  196. package/docs/src/docs/_getting-started/my-first-component.md +236 -0
  197. package/docs/src/docs/_getting-started/my-first-subscriber.md +120 -0
  198. package/docs/src/docs/_getting-started/pubsub.md +37 -0
  199. package/docs/src/docs/_getting-started/start.md +47 -0
  200. package/docs/src/docs/_getting-started/theming.md +91 -0
  201. package/docs/src/docs/_misc/api-configuration.md +81 -0
  202. package/docs/src/docs/_misc/dataProviderKey.md +168 -0
  203. package/docs/src/docs/_misc/docs-mock-api.md +63 -0
  204. package/docs/src/docs/_misc/dynamic-path.md +71 -0
  205. package/docs/src/docs/_misc/endpoint.md +45 -0
  206. package/docs/src/docs/_misc/formelement-subscriber-removal.md +115 -0
  207. package/docs/src/docs/_misc/html-integration.md +15 -0
  208. package/docs/src/docs/search/docs-search.json +10137 -0
  209. package/docs/src/tag-list.json +1 -0
  210. package/docs/src/tsconfig-model.json +23 -0
  211. package/docs/src/tsconfig.json +1224 -0
  212. package/docs/svg/regular/plane.svg +1 -0
  213. package/docs/svg/solid/plane.svg +1 -0
  214. package/package.json +1 -1
@@ -0,0 +1,724 @@
1
+ "use strict";
2
+ (() => {
3
+ // src/docs/mock-api/urls.ts
4
+ var DOCS_MOCK_API_BASE = "/docs-mock-api";
5
+ var DOCS_MOCK_GEO_SERVICE = `${DOCS_MOCK_API_BASE}/geo/`;
6
+ var DOCS_MOCK_JOKES_SERVICE = `${DOCS_MOCK_API_BASE}/jokes`;
7
+
8
+ // src/docs/mock-api/api-config-mock.ts
9
+ var DOCS_MOCK_TOKEN_VALID = "docs-mock-valid-token";
10
+ var DOCS_MOCK_TOKEN_STALE = "docs-mock-stale-token";
11
+ var DOCS_MOCK_TOKEN_FRESH = "docs-mock-fresh-token";
12
+ var DOCS_MOCK_BASIC_USER = "demo";
13
+ var DOCS_MOCK_BASIC_PASSWORD = "secret";
14
+ var DOCS_MOCK_EVENTS_API_TOKEN = "docs-mock-events-token";
15
+ var WORDING_CATALOG = {
16
+ "api-config.greeting": { fr: "Bonjour", en: "Hello" },
17
+ "api-config.farewell": { fr: "Au revoir", en: "Goodbye" },
18
+ "api-config.hint": {
19
+ fr: "Libell\xE9s servis par le mock /wording/labels",
20
+ en: "Labels served by mock /wording/labels"
21
+ }
22
+ };
23
+ function json(body, init = {}) {
24
+ const headers = new Headers(init.headers);
25
+ headers.set("Content-Type", "application/json; charset=utf-8");
26
+ headers.set("Access-Control-Allow-Origin", "*");
27
+ headers.set("X-Docs-Mock-Api", "concorde-api-config");
28
+ return new Response(JSON.stringify(body), { ...init, headers });
29
+ }
30
+ function parseAuthorization(request) {
31
+ const header = request.headers.get("authorization");
32
+ if (!header) return { kind: "none" };
33
+ const basic = header.match(/^Basic\s+(.+)$/i);
34
+ if (basic) {
35
+ try {
36
+ const decoded = atob(basic[1]);
37
+ const sep = decoded.indexOf(":");
38
+ if (sep < 0) return { kind: "none" };
39
+ return {
40
+ kind: "basic",
41
+ user: decoded.slice(0, sep),
42
+ password: decoded.slice(sep + 1)
43
+ };
44
+ } catch {
45
+ return { kind: "none" };
46
+ }
47
+ }
48
+ const bearer = header.match(/^Bearer\s+(.+)$/i);
49
+ if (bearer) return { kind: "bearer", token: bearer[1].trim() };
50
+ return { kind: "none" };
51
+ }
52
+ function isValidBasic(auth) {
53
+ return auth.kind === "basic" && auth.user === DOCS_MOCK_BASIC_USER && auth.password === DOCS_MOCK_BASIC_PASSWORD;
54
+ }
55
+ function wordingLabels(url) {
56
+ const lang = url.searchParams.get("lang") || "fr";
57
+ const labels = url.searchParams.getAll("labels[]").length ? url.searchParams.getAll("labels[]") : url.searchParams.getAll("labels");
58
+ const result = {};
59
+ for (const key of labels) {
60
+ const entry = WORDING_CATALOG[key];
61
+ result[key] = entry?.[lang] ?? entry?.en ?? `[missing:${key}]`;
62
+ }
63
+ return json({ lang, labels: result, ...result });
64
+ }
65
+ function handleApiConfigMockRequest(request, subPath, method) {
66
+ if (subPath === "/auth/token" && method === "GET") {
67
+ const auth = parseAuthorization(request);
68
+ if (isValidBasic(auth)) {
69
+ return json({
70
+ token: DOCS_MOCK_TOKEN_FRESH,
71
+ source: "basic",
72
+ serviceHost: new URL(request.url).searchParams.get("serviceHost")
73
+ });
74
+ }
75
+ if (auth.kind === "bearer" && auth.token === DOCS_MOCK_EVENTS_API_TOKEN) {
76
+ return json({
77
+ token: DOCS_MOCK_TOKEN_FRESH,
78
+ source: "eventsApiToken"
79
+ });
80
+ }
81
+ return json({ error: "Unauthorized" }, { status: 401 });
82
+ }
83
+ if (subPath === "/api/config/protected" && method === "GET") {
84
+ const auth = parseAuthorization(request);
85
+ if (auth.kind === "bearer") {
86
+ if (auth.token === DOCS_MOCK_TOKEN_STALE) {
87
+ return json({ error: "Token expired", code: "token_stale" }, { status: 498 });
88
+ }
89
+ if (auth.token === DOCS_MOCK_TOKEN_VALID || auth.token === DOCS_MOCK_TOKEN_FRESH) {
90
+ return json({
91
+ ok: true,
92
+ message: "Protected resource",
93
+ tokenUsed: auth.token
94
+ });
95
+ }
96
+ }
97
+ if (isValidBasic(auth)) {
98
+ return json({
99
+ ok: true,
100
+ message: "Protected resource (basic)",
101
+ tokenUsed: null
102
+ });
103
+ }
104
+ return json({ error: "Unauthorized" }, { status: 401 });
105
+ }
106
+ if ((subPath === "/wording/labels" || subPath.startsWith("/wording/labels")) && method === "GET") {
107
+ return wordingLabels(new URL(request.url));
108
+ }
109
+ return null;
110
+ }
111
+ var API_CONFIG_MOCK_PATHS = [
112
+ `${DOCS_MOCK_API_BASE}/auth/token`,
113
+ `${DOCS_MOCK_API_BASE}/api/config/protected`,
114
+ `${DOCS_MOCK_API_BASE}/wording/labels`
115
+ ];
116
+
117
+ // src/docs/mock-api/fixtures.ts
118
+ var reqresAvatar = (seed) => `https://i.pravatar.cc/150?u=${encodeURIComponent(seed)}`;
119
+ var REQRES_EXTRA_NAMES = [
120
+ ["Michael", "Lawson"],
121
+ ["Tobias", "Funke"],
122
+ ["Lindsay", "Funke"],
123
+ ["Maeby", "Funke"],
124
+ ["George", "Michael"],
125
+ ["Annye", "Vang"],
126
+ ["Rachel", "Howe"],
127
+ ["Terry", "Medhurst"],
128
+ ["Bette", "Haag"],
129
+ ["Lester", "Solomon"],
130
+ ["April", "Douglas"],
131
+ ["Marian", "Roberts"],
132
+ ["Kathryn", "Murphy"],
133
+ ["Gloria", "Armstrong"],
134
+ ["Adam", "Bradley"],
135
+ ["Angela", "Hicks"],
136
+ ["Rose", "Wheeler"],
137
+ ["Sara", "Berry"],
138
+ ["Glen", "Kuhn"],
139
+ ["Roger", "Cox"]
140
+ ];
141
+ function buildReqresUser(id, first_name, last_name) {
142
+ const slug = `${first_name}-${last_name}`.toLowerCase();
143
+ return {
144
+ id,
145
+ email: `${first_name.toLowerCase()}.${last_name.toLowerCase()}@example.com`,
146
+ first_name,
147
+ last_name,
148
+ avatar: reqresAvatar(slug)
149
+ };
150
+ }
151
+ var DOCS_REQRES_USERS = [
152
+ buildReqresUser(1, "George", "Bluth"),
153
+ buildReqresUser(2, "Janet", "Weaver"),
154
+ buildReqresUser(3, "Emma", "Wong"),
155
+ buildReqresUser(4, "Eve", "Holt"),
156
+ ...REQRES_EXTRA_NAMES.map(
157
+ ([first_name, last_name], index) => buildReqresUser(5 + index, first_name, last_name)
158
+ )
159
+ ];
160
+ function filterDocsUsers(users, query) {
161
+ const q = query?.trim().toLowerCase();
162
+ if (!q) return users;
163
+ return users.filter((user) => {
164
+ const haystack = `${user.first_name} ${user.last_name} ${user.email}`.toLowerCase();
165
+ return haystack.includes(q);
166
+ });
167
+ }
168
+ var DOCS_GEO_COMMUNES = [
169
+ { nom: "Paris", code: "75056" },
170
+ { nom: "Lyon", code: "69123" },
171
+ { nom: "Marseille", code: "13055" },
172
+ { nom: "Toulouse", code: "31555" },
173
+ { nom: "Lille", code: "59350" },
174
+ { nom: "Bordeaux", code: "33063" },
175
+ { nom: "Nantes", code: "44109" },
176
+ { nom: "Strasbourg", code: "67482" },
177
+ { nom: "Montpellier", code: "34172" },
178
+ { nom: "Rennes", code: "35238" }
179
+ ];
180
+ var jokeFlags = (partial = {}) => ({
181
+ nsfw: false,
182
+ religious: false,
183
+ political: false,
184
+ racist: false,
185
+ sexist: false,
186
+ explicit: false,
187
+ ...partial
188
+ });
189
+ var SAMPLE_JOKES = [
190
+ {
191
+ categories: ["Programming"],
192
+ createdAt: "2020-01-01 00:00:00",
193
+ id: 1,
194
+ lang: "en",
195
+ joke: "Why do programmers prefer dark mode? Because light attracts bugs.",
196
+ flags: jokeFlags(),
197
+ safe: true,
198
+ type: "single"
199
+ },
200
+ {
201
+ categories: ["Misc"],
202
+ createdAt: "2020-01-02 00:00:00",
203
+ id: 2,
204
+ lang: "en",
205
+ joke: "I told my computer I needed a break \u2014 it said: no problem, I'll go to sleep.",
206
+ flags: jokeFlags({ nsfw: true }),
207
+ safe: false,
208
+ type: "single"
209
+ },
210
+ {
211
+ categories: ["Pun"],
212
+ createdAt: "2020-01-03 00:00:00",
213
+ id: 3,
214
+ lang: "en",
215
+ joke: "Concorde docs run offline: even the API is a local joke.",
216
+ flags: jokeFlags(),
217
+ safe: true,
218
+ type: "single"
219
+ },
220
+ {
221
+ categories: ["Animals"],
222
+ createdAt: "2020-01-04 00:00:00",
223
+ id: 4,
224
+ lang: "en",
225
+ joke: "The dog ate my homework and my pull request.",
226
+ flags: jokeFlags({ political: true }),
227
+ safe: true,
228
+ type: "single"
229
+ },
230
+ {
231
+ categories: ["Animals", "Pun"],
232
+ createdAt: "2020-01-05 00:00:00",
233
+ id: 5,
234
+ lang: "fr",
235
+ joke: "Quel est le chien pr\xE9f\xE9r\xE9 des d\xE9veloppeurs ? Le labrador Retriever.",
236
+ flags: jokeFlags(),
237
+ safe: true,
238
+ type: "single"
239
+ },
240
+ {
241
+ categories: ["Animals"],
242
+ createdAt: "2020-01-06 00:00:00",
243
+ id: 6,
244
+ lang: "fr",
245
+ joke: "Un chat et un chien discutent de TypeScript : le chien dit \xAB woof \xBB, le chat compile.",
246
+ flags: jokeFlags({ racist: true }),
247
+ safe: false,
248
+ type: "single"
249
+ },
250
+ {
251
+ categories: ["Misc"],
252
+ createdAt: "2020-01-07 00:00:00",
253
+ id: 7,
254
+ lang: "fr",
255
+ joke: "Pourquoi les blagues offline sont-elles fiables ? Parce qu'elles passent par le Service Worker.",
256
+ flags: jokeFlags({ religious: true }),
257
+ safe: true,
258
+ type: "single"
259
+ },
260
+ {
261
+ categories: ["Programming"],
262
+ createdAt: "2020-01-08 00:00:00",
263
+ id: 8,
264
+ lang: "fr",
265
+ joke: "Mon compilateur et mon chien : tous deux ignorent mes commandes jusqu'au build.",
266
+ flags: jokeFlags({ sexist: true }),
267
+ safe: false,
268
+ type: "single"
269
+ },
270
+ {
271
+ categories: ["Misc"],
272
+ createdAt: "2020-01-09 00:00:00",
273
+ id: 9,
274
+ lang: "en",
275
+ joke: "A SQL query walks into a bar, walks up to two tables and asks: Can I join you?",
276
+ flags: jokeFlags({ explicit: true }),
277
+ safe: false,
278
+ type: "single"
279
+ },
280
+ {
281
+ categories: ["Pun"],
282
+ createdAt: "2020-01-10 00:00:00",
283
+ id: 10,
284
+ lang: "fr",
285
+ joke: "J'ai cherch\xE9 \xAB chien \xBB dans la doc : le mock API a r\xE9pondu.",
286
+ flags: jokeFlags(),
287
+ safe: true,
288
+ type: "single"
289
+ },
290
+ {
291
+ categories: ["Misc"],
292
+ createdAt: "2020-01-11 00:00:00",
293
+ id: 11,
294
+ lang: "en",
295
+ joke: "There are only two hard things in Computer Science: cache invalidation and naming things.",
296
+ flags: jokeFlags({ political: true, explicit: true }),
297
+ safe: false,
298
+ type: "single"
299
+ },
300
+ {
301
+ categories: ["Animals"],
302
+ createdAt: "2020-01-12 00:00:00",
303
+ id: 12,
304
+ lang: "fr",
305
+ joke: "Le golden retriever a r\xE9cup\xE9r\xE9 la donn\xE9e du publisher.",
306
+ flags: jokeFlags({ racist: true, sexist: true }),
307
+ safe: false,
308
+ type: "two-liner",
309
+ setup: "Pourquoi le chien aime Concorde ?",
310
+ delivery: "Parce qu'il sait fetch."
311
+ },
312
+ {
313
+ categories: ["Misc"],
314
+ createdAt: "2020-01-13 00:00:00",
315
+ id: 13,
316
+ lang: "en",
317
+ joke: "My code and my conscience: both have too many warnings.",
318
+ flags: jokeFlags(),
319
+ safe: true,
320
+ type: "single"
321
+ },
322
+ {
323
+ categories: ["Programming"],
324
+ createdAt: "2020-01-14 00:00:00",
325
+ id: 14,
326
+ lang: "en",
327
+ joke: "Git blame is just a mirror.",
328
+ flags: jokeFlags({ religious: true, political: true }),
329
+ safe: false,
330
+ type: "single"
331
+ }
332
+ ];
333
+ function parseBlacklistFlags(url) {
334
+ const keys = /* @__PURE__ */ new Set();
335
+ const valid = [
336
+ "nsfw",
337
+ "religious",
338
+ "political",
339
+ "racist",
340
+ "sexist",
341
+ "explicit"
342
+ ];
343
+ const add = (raw) => {
344
+ raw.split(",").map((s) => s.trim().toLowerCase()).forEach((part) => {
345
+ if (valid.includes(part)) keys.add(part);
346
+ });
347
+ };
348
+ url.searchParams.getAll("blacklistFlags").forEach(add);
349
+ const single = url.searchParams.get("blacklistFlags");
350
+ if (single) add(single);
351
+ return [...keys];
352
+ }
353
+ function applyJokeBlacklist(jokes, blacklist) {
354
+ if (!blacklist.length) return jokes;
355
+ return jokes.filter(
356
+ (j) => !blacklist.some((flag) => j.flags[flag] === true)
357
+ );
358
+ }
359
+ function filterDocsJokes(jokes, url) {
360
+ let pool = jokes;
361
+ const contains = url.searchParams.get("contains")?.trim().toLowerCase();
362
+ if (contains) {
363
+ pool = pool.filter((j) => {
364
+ const haystack = [j.joke, j.setup, j.delivery, ...j.categories].filter(Boolean).join(" ").toLowerCase();
365
+ return haystack.includes(contains);
366
+ });
367
+ }
368
+ const lang = url.searchParams.get("lang")?.trim().toLowerCase();
369
+ if (lang === "fr" || lang === "en") {
370
+ pool = pool.filter((j) => j.lang === lang);
371
+ }
372
+ pool = applyJokeBlacklist(pool, parseBlacklistFlags(url));
373
+ return pool;
374
+ }
375
+ function buildJokeApiResponse(url) {
376
+ const pool = filterDocsJokes(SAMPLE_JOKES, url);
377
+ const amount = Math.max(
378
+ 1,
379
+ parseInt(url.searchParams.get("amount") || "10", 10)
380
+ );
381
+ const hasOffset = url.searchParams.has("offset");
382
+ const limit = Math.max(
383
+ 1,
384
+ parseInt(
385
+ url.searchParams.get("limit") || url.searchParams.get("per_page") || String(amount),
386
+ 10
387
+ )
388
+ );
389
+ const offset = Math.max(0, parseInt(url.searchParams.get("offset") || "0", 10));
390
+ const start = hasOffset ? offset : 0;
391
+ const count = hasOffset ? limit : amount;
392
+ const jokes = pool.slice(start, start + count).map((j, i) => ({
393
+ ...j,
394
+ id: start + i + 1
395
+ }));
396
+ return { error: false, amount: jokes.length, jokes };
397
+ }
398
+
399
+ // src/docs/mock-api/fixtures-jsonata.ts
400
+ var avatar = (seed) => `https://i.pravatar.cc/150?u=${encodeURIComponent(seed)}`;
401
+ var DOCS_SPACE_CAT_MISSIONS = [
402
+ {
403
+ id: 1,
404
+ name: "Captain Whiskers",
405
+ planet: "Mars",
406
+ mission: "Laser hunt",
407
+ points: 40,
408
+ avatar: avatar("captain-whiskers")
409
+ },
410
+ {
411
+ id: 2,
412
+ name: "Captain Whiskers",
413
+ planet: "Mars",
414
+ mission: "Dust nap",
415
+ points: 25,
416
+ avatar: avatar("captain-whiskers")
417
+ },
418
+ {
419
+ id: 3,
420
+ name: "Nebula Paws",
421
+ planet: "Europa",
422
+ mission: "Ice fishing",
423
+ points: 55,
424
+ avatar: avatar("nebula-paws")
425
+ },
426
+ {
427
+ id: 4,
428
+ name: "Astro Mittens",
429
+ planet: "Titan",
430
+ mission: "Methane surf",
431
+ points: 33,
432
+ avatar: avatar("astro-mittens")
433
+ },
434
+ {
435
+ id: 5,
436
+ name: "Nebula Paws",
437
+ planet: "Europa",
438
+ mission: "Comet chase",
439
+ points: 20,
440
+ avatar: avatar("nebula-paws")
441
+ },
442
+ {
443
+ id: 6,
444
+ name: "Professor Meowington",
445
+ planet: "Venus",
446
+ mission: "Cloud tasting",
447
+ points: 48,
448
+ avatar: avatar("prof-meowington")
449
+ },
450
+ {
451
+ id: 7,
452
+ name: "Astro Mittens",
453
+ planet: "Titan",
454
+ mission: "Antenna polish",
455
+ points: 12,
456
+ avatar: avatar("astro-mittens")
457
+ },
458
+ {
459
+ id: 8,
460
+ name: "Zero-G Socks",
461
+ planet: "Moon",
462
+ mission: "Flag knitting",
463
+ points: 61,
464
+ avatar: avatar("zero-g-socks")
465
+ }
466
+ ];
467
+ var DOCS_COFFEE_BAGS = [
468
+ { id: 1, origin: "Ethiopia", roast: "light", kg: 12, farm: "Yirgacheffe Hills" },
469
+ { id: 2, origin: "Ethiopia", roast: "medium", kg: 8, farm: "Sidamo Ridge" },
470
+ { id: 3, origin: "Colombia", roast: "medium", kg: 15, farm: "Huila Valley" },
471
+ { id: 4, origin: "Colombia", roast: "dark", kg: 6, farm: "Cauca Peak" },
472
+ { id: 5, origin: "Brazil", roast: "dark", kg: 22, farm: "Minas Gerais" },
473
+ { id: 6, origin: "Brazil", roast: "medium", kg: 10, farm: "Cerrado" },
474
+ { id: 7, origin: "Guatemala", roast: "light", kg: 9, farm: "Antigua" },
475
+ { id: 8, origin: "Guatemala", roast: "dark", kg: 5, farm: "Huehuetenango" },
476
+ { id: 9, origin: "Ethiopia", roast: "light", kg: 4, farm: "Guji Forest" }
477
+ ];
478
+ function filterCoffeeBags(bags, roast) {
479
+ const r = roast?.trim().toLowerCase();
480
+ if (!r || r === "all") return bags;
481
+ return bags.filter((b) => b.roast === r);
482
+ }
483
+ var DOCS_MARKET_ORDER_LINES = [
484
+ { id: 1, name: "Heirloom tomatoes", qty: 4, unitPrice: 3.5, category: "veg" },
485
+ { id: 2, name: "Sourdough loaf", qty: 2, unitPrice: 6, category: "bakery" },
486
+ { id: 3, name: "Goat cheese", qty: 1, unitPrice: 8.5, category: "dairy" },
487
+ { id: 4, name: "Honey jar", qty: 3, unitPrice: 5.2, category: "pantry" },
488
+ { id: 5, name: "Sunflowers", qty: 5, unitPrice: 2, category: "flowers" },
489
+ { id: 6, name: "Free-range eggs", qty: 2, unitPrice: 4.8, category: "dairy" }
490
+ ];
491
+
492
+ // src/docs/mock-api/router.ts
493
+ var DOCS_MOCK_API_PREFIX = "/docs-mock-api";
494
+ function json2(body, init = {}) {
495
+ const { delayMs = 0, ...responseInit } = init;
496
+ const headers = new Headers(responseInit.headers);
497
+ headers.set("Content-Type", "application/json; charset=utf-8");
498
+ headers.set("Access-Control-Allow-Origin", "*");
499
+ headers.set("X-Docs-Mock-Api", "concorde");
500
+ const build = () => new Response(JSON.stringify(body), { ...responseInit, headers });
501
+ if (delayMs <= 0) return Promise.resolve(build());
502
+ return new Promise(
503
+ (resolve) => setTimeout(() => resolve(build()), delayMs)
504
+ );
505
+ }
506
+ function paginateUsers(url) {
507
+ const perPage = Math.max(
508
+ 1,
509
+ parseInt(
510
+ url.searchParams.get("per_page") || url.searchParams.get("limit") || "6",
511
+ 10
512
+ )
513
+ );
514
+ const pool = filterDocsUsers(DOCS_REQRES_USERS, url.searchParams.get("q"));
515
+ const total = pool.length;
516
+ let start;
517
+ let page;
518
+ if (url.searchParams.has("offset")) {
519
+ start = Math.max(0, parseInt(url.searchParams.get("offset") || "0", 10));
520
+ page = Math.floor(start / perPage) + 1;
521
+ } else {
522
+ page = Math.max(1, parseInt(url.searchParams.get("page") || "1", 10));
523
+ start = (page - 1) * perPage;
524
+ }
525
+ const data = pool.slice(start, start + perPage);
526
+ return {
527
+ page,
528
+ per_page: perPage,
529
+ total,
530
+ total_pages: Math.max(1, Math.ceil(total / perPage)),
531
+ data
532
+ };
533
+ }
534
+ async function parseRegisterFields(request) {
535
+ const contentType = (request.headers.get("content-type") || "").toLowerCase();
536
+ if (contentType.includes("multipart/form-data")) {
537
+ const fd = await request.formData();
538
+ return {
539
+ email: String(fd.get("email") ?? ""),
540
+ password: String(fd.get("password") ?? "")
541
+ };
542
+ }
543
+ if (contentType.includes("application/x-www-form-urlencoded")) {
544
+ const text2 = await request.text();
545
+ const params = new URLSearchParams(text2);
546
+ return {
547
+ email: params.get("email") ?? "",
548
+ password: params.get("password") ?? ""
549
+ };
550
+ }
551
+ const text = await request.text();
552
+ if (!text.trim()) return {};
553
+ try {
554
+ const parsed = JSON.parse(text);
555
+ return {
556
+ email: parsed.email != null ? String(parsed.email) : "",
557
+ password: parsed.password != null ? String(parsed.password) : ""
558
+ };
559
+ } catch {
560
+ const params = new URLSearchParams(text);
561
+ if (params.has("email") || params.has("password")) {
562
+ return {
563
+ email: params.get("email") ?? "",
564
+ password: params.get("password") ?? ""
565
+ };
566
+ }
567
+ return {};
568
+ }
569
+ }
570
+ function registerOkBody(fields, nested = false) {
571
+ const payload = {
572
+ id: 4,
573
+ token: "docs-mock-register-token",
574
+ email: fields.email
575
+ };
576
+ return nested ? { data: payload } : payload;
577
+ }
578
+ function geoCommunes(url) {
579
+ const limit = Math.max(
580
+ 1,
581
+ parseInt(url.searchParams.get("limit") || "5", 10)
582
+ );
583
+ const offset = Math.max(0, parseInt(url.searchParams.get("offset") || "0", 10));
584
+ const needle = (url.searchParams.get("nom") || url.searchParams.get("text") || url.searchParams.get("q") || url.searchParams.get("code") || "").trim().toLowerCase();
585
+ const rows = needle ? DOCS_GEO_COMMUNES.filter(
586
+ (row) => row.nom.toLowerCase().includes(needle) || row.code.toLowerCase().includes(needle)
587
+ ) : DOCS_GEO_COMMUNES;
588
+ return rows.slice(offset, offset + limit);
589
+ }
590
+ async function handleDocsMockApiRequest(request) {
591
+ const url = new URL(request.url);
592
+ if (!url.pathname.startsWith(DOCS_MOCK_API_PREFIX)) return null;
593
+ const subPath = url.pathname.slice(DOCS_MOCK_API_PREFIX.length) || "/";
594
+ const method = request.method.toUpperCase();
595
+ if (subPath === "/health") {
596
+ return json2({ ok: true, service: "concorde-docs-mock-api" });
597
+ }
598
+ const apiConfigResponse = handleApiConfigMockRequest(request, subPath, method);
599
+ if (apiConfigResponse) return apiConfigResponse;
600
+ if ((subPath === "/api/register" || subPath === "/api/register/nested") && method === "POST") {
601
+ const body = await parseRegisterFields(request);
602
+ if (!body.email?.trim() || !body.password?.trim()) {
603
+ return json2(
604
+ {
605
+ messages: [
606
+ {
607
+ content: "email and password are required",
608
+ status: "error"
609
+ }
610
+ ]
611
+ },
612
+ { status: 400 }
613
+ );
614
+ }
615
+ return json2(
616
+ registerOkBody(
617
+ { email: body.email.trim(), password: body.password.trim() },
618
+ subPath === "/api/register/nested"
619
+ )
620
+ );
621
+ }
622
+ const sessionSyncMatch = subPath.match(/^\/api\/sessions\/([^/]+)\/sync$/);
623
+ if (sessionSyncMatch && method === "POST") {
624
+ const sessionId = decodeURIComponent(sessionSyncMatch[1]);
625
+ let body = {};
626
+ try {
627
+ const text = await request.text();
628
+ if (text.trim()) {
629
+ body = JSON.parse(text);
630
+ }
631
+ } catch {
632
+ body = {};
633
+ }
634
+ return json2({
635
+ ok: true,
636
+ sessionId,
637
+ serverTime: Date.now(),
638
+ echo: body
639
+ });
640
+ }
641
+ if (subPath === "/api/register/echo" && method === "GET") {
642
+ const email = url.searchParams.get("email") ?? "";
643
+ const password = url.searchParams.get("password") ?? "";
644
+ if (!email.trim() || !password.trim()) {
645
+ return json2(
646
+ {
647
+ messages: [
648
+ {
649
+ content: "email and password query params are required",
650
+ status: "error"
651
+ }
652
+ ]
653
+ },
654
+ { status: 400 }
655
+ );
656
+ }
657
+ return json2({
658
+ method: "GET",
659
+ query: { email, password },
660
+ email,
661
+ note: 'sonic-submit method="get" appends form fields to the endpoint URL'
662
+ });
663
+ }
664
+ if (method !== "GET") {
665
+ return json2({ error: "Method not allowed" }, { status: 405 });
666
+ }
667
+ const userMatch = subPath.match(/^\/api\/users\/(\d+)$/);
668
+ if (userMatch) {
669
+ const id = parseInt(userMatch[1], 10);
670
+ const user = DOCS_REQRES_USERS.find((u) => u.id === id) ?? DOCS_REQRES_USERS[0];
671
+ const body = { data: { ...user, id } };
672
+ return json2(body);
673
+ }
674
+ if (subPath === "/api/users") {
675
+ return json2(paginateUsers(url));
676
+ }
677
+ if (subPath === "/api/space-cats") {
678
+ return json2({
679
+ data: DOCS_SPACE_CAT_MISSIONS,
680
+ total: DOCS_SPACE_CAT_MISSIONS.length
681
+ });
682
+ }
683
+ if (subPath === "/api/coffee-bags") {
684
+ const roast = url.searchParams.get("roast");
685
+ const data = filterCoffeeBags(DOCS_COFFEE_BAGS, roast);
686
+ return json2({ data, total: data.length });
687
+ }
688
+ if (subPath === "/api/market-order") {
689
+ return json2({
690
+ data: DOCS_MARKET_ORDER_LINES,
691
+ total: DOCS_MARKET_ORDER_LINES.length
692
+ });
693
+ }
694
+ if (subPath === "/geo/communes" || subPath.startsWith("/geo/communes")) {
695
+ return json2(geoCommunes(url), {
696
+ headers: { "X-Fetched-At": (/* @__PURE__ */ new Date()).toISOString() }
697
+ });
698
+ }
699
+ const jokeMatch = subPath.match(/^\/jokes\/joke\/([^/]+)$/);
700
+ if (jokeMatch) {
701
+ return json2(buildJokeApiResponse(url));
702
+ }
703
+ return json2({ error: "Not found", path: subPath }, { status: 404 });
704
+ }
705
+
706
+ // src/docs/mock-api/service-worker.ts
707
+ self.addEventListener("install", (event) => {
708
+ event.waitUntil(self.skipWaiting());
709
+ });
710
+ self.addEventListener("activate", (event) => {
711
+ event.waitUntil(self.clients.claim());
712
+ });
713
+ self.addEventListener("fetch", (event) => {
714
+ const { request } = event;
715
+ event.respondWith(
716
+ (async () => {
717
+ const mocked = await handleDocsMockApiRequest(request);
718
+ if (mocked) return mocked;
719
+ return fetch(request);
720
+ })()
721
+ );
722
+ });
723
+ })();
724
+ //# sourceMappingURL=docs-mock-api-sw.js.map