1(function() { 2 try { 3 var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}; 4 e.SENTRY_RELEASE = { id: "b96dc26" }; 5 var n = new e.Error().stack; 6 n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "864d4357-f35a-4800-89b5-0fc5d21dd94f", e._sentryDebugIdIdentifier = "sentry-dbid-864d4357-f35a-4800-89b5-0fc5d21dd94f"); 7 } catch (e) {} 8})(); 9import { n as __esmMin } from "./rolldown-runtime-sLwMD6dS.js"; 10import { As as Input, Mi as init_routes, Mn as api_key_path, Nn as api_keys_path, Xt as init_label, Yt as Label, js as init_input } from "./controllers-jdPQjaCB.js"; 11import { i as require_compiler_runtime, o as copyToClipboard, t as require_jsx_runtime, u as init_utils } from "./jsx-runtime-CHSMGLHp.js"; 12import { t as require_react } from "./react-CrLPhuc5.js"; 13import { n as init_icon, t as Icon } from "./icon-BNzYbsdJ.js"; 14import { r as init_button, t as Button } from "./button-DOiPZHfy.js"; 15import { a as init_tooltip, i as TooltipTrigger, n as TooltipContent, r as TooltipProvider, t as Tooltip } from "./tooltip-HHfiWInP.js"; 16import { cn as PageHeaderActions, hn as init_page_header, mn as PageHeaderTitle, sn as PageHeader } from "./turbo-mount-DM0tFk1M.js"; 17import { a as DialogFooter, i as DialogContent, n as DialogBody, o as DialogHeader, r as DialogCloseButton, s as DialogTitle, t as Dialog, u as init_dialog } from "./dialog-XgiZyeRA.js"; 18import { n as useDialog, t as init_useDialog } from "./useDialog-CwjC07YA.js"; 19import { a as init_dist$1, l as router, s as usePage, t as Head_default } from "./dist-ZlUHm0R7.js"; 20import { n as init_fetchApiKeyToken, t as fetchApiKeyToken } from "./fetchApiKeyToken-CbuOEayI.js"; 21//#region app/frontend/pages/ApiKeys/CreateApiKeyModal.tsx 22function CreateApiKeyModal({ isOpen, onClose }) { 23 const [name, setName] = (0, import_react$5.useState)(""); 24 const [processing, setProcessing] = (0, import_react$5.useState)(false); 25 const dialog = useDialog({ 26 isOpen, 27 onClose 28 }); 29 (0, import_react$5.useEffect)(() => { 30 if (isOpen) setName(""); 31 }, [isOpen]); 32 function handleSubmit(e) { 33 e.preventDefault(); 34 if (processing) return; 35 setProcessing(true); 36 router.post(api_keys_path(), { api_key: { name } }, { 37 preserveScroll: true, 38 onFinish: () => { 39 setProcessing(false); 40 onClose(); 41 } 42 }); 43 } 44 return /* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(Dialog, { 45 ref: dialog.dialogRef, 46 onClick: dialog.handleBackdropClick, 47 children: /* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime$5.jsxs)("form", { 48 onSubmit: handleSubmit, 49 children: [
50 /* @__PURE__ */ (0, import_jsx_runtime$5.jsxs)(DialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(DialogTitle, { children: "New API key" }), /* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(DialogCloseButton, { 51 type: "button", 52 onClick: onClose 53 })] }), 54 /* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(DialogBody, { children: /* @__PURE__ */ (0, import_jsx_runtime$5.jsxs)("div", { 55 className: "form-group", 56 children: [/* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(Label, { 57 htmlFor: "new-api-key-name", 58 className: "mb-2", 59 children: "Name" 60 }), /* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(Input, { 61 id: "new-api-key-name", 62 value: name, 63 onChange: (e_0) => setName(e_0.target.value), 64 maxLength: 255, 65 placeholder: "e.g. Production", 66 autoFocus: true, 67 fullWidth: true 68 })] 69 }) }), 70 /* @__PURE__ */ (0, import_jsx_runtime$5.jsxs)(DialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(Button, { 71 type: "button", 72 onClick: onClose, 73 children: "Cancel" 74 }), /* @__PURE__ */ (0, import_jsx_runtime$5.jsx)(Button, { 75 type: "submit", 76 variant: "primary", 77 disabled: processing, 78 children: "Create" 79 })] }) 80 ] 81 }) }) 82 }); 83} 84var import_react$5, import_jsx_runtime$5; 85function init_CreateApiKeyModal() { 86 return (init_CreateApiKeyModal = __esmMin((() => { 87 import_react$5 = require_react(); 88 init_dist$1(); 89 init_dialog(); 90 init_useDialog(); 91 init_button(); 92 init_input(); 93 init_label(); 94 init_routes(); 95 import_jsx_runtime$5 = require_jsx_runtime(); 96 })))(); 97} 98//#endregion 99//#region app/frontend/pages/ApiKeys/RenameApiKeyModal.tsx 100function RenameApiKeyModal({ apiKey, isOpen, onClose }) { 101 const [name, setName] = (0, import_react$4.useState)(""); 102 const [processing, setProcessing] = (0, import_react$4.useState)(false); 103 const dialog = useDialog({ 104 isOpen, 105 onClose 106 }); 107 (0, import_react$4.useEffect)(() => { 108 if (isOpen && apiKey) setName(apiKey.name ?? ""); 109 }, [isOpen, apiKey]); 110 function handleSubmit(e) { 111 e.preventDefault(); 112 if (!apiKey || processing) return; 113 setProcessing(true); 114 router.patch(api_key_path(apiKey.id), { api_key: { name } }, { 115 preserveScroll: true, 116 onFinish: () => { 117 setProcessing(false); 118 onClose(); 119 } 120 }); 121 } 122 return /* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(Dialog, { 123 ref: dialog.dialogRef, 124 onClick: dialog.handleBackdropClick, 125 children: /* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(DialogContent, { children: /* @__PURE__ */ (0, import_jsx_runtime$4.jsxs)("form", { 126 onSubmit: handleSubmit, 127 children: [
128 /* @__PURE__ */ (0, import_jsx_runtime$4.jsxs)(DialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(DialogTitle, { children: "Rename API key" }), /* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(DialogCloseButton, { 129 type: "button", 130 onClick: onClose 131 })] }), 132 /* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(DialogBody, { children: /* @__PURE__ */ (0, import_jsx_runtime$4.jsxs)("div", { 133 className: "form-group", 134 children: [/* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(Label, { 135 htmlFor: "rename-api-key-name", 136 className: "mb-2", 137 children: "Name" 138 }), /* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(Input, { 139 id: "rename-api-key-name", 140 value: name, 141 onChange: (e_0) => setName(e_0.target.value), 142 maxLength: 255, 143 placeholder: "e.g. Production", 144 autoFocus: true, 145 fullWidth: true 146 })] 147 }) }), 148 /* @__PURE__ */ (0, import_jsx_runtime$4.jsxs)(DialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(Button, { 149 type: "button", 150 onClick: onClose, 151 children: "Cancel" 152 }), /* @__PURE__ */ (0, import_jsx_runtime$4.jsx)(Button, { 153 type: "submit", 154 variant: "primary", 155 disabled: processing, 156 children: "Save" 157 })] }) 158 ] 159 }) }) 160 }); 161} 162var import_react$4, import_jsx_runtime$4; 163function init_RenameApiKeyModal() { 164 return (init_RenameApiKeyModal = __esmMin((() => { 165 import_react$4 = require_react(); 166 init_dist$1(); 167 init_dialog(); 168 init_useDialog(); 169 init_button(); 170 init_input(); 171 init_label(); 172 init_routes(); 173 import_jsx_runtime$4 = require_jsx_runtime(); 174 })))(); 175} 176//#endregion 177//#region app/frontend/pages/ApiKeys/DeleteApiKeyModal.tsx 178function DeleteApiKeyModal({ apiKey, isOpen, onClose }) { 179 const [processing, setProcessing] = (0, import_react$3.useState)(false); 180 const dialog = useDialog({ 181 isOpen, 182 onClose 183 }); 184 function handleDelete() { 185 if (!apiKey || processing) return; 186 setProcessing(true); 187 router.delete(api_key_path(apiKey.id), { 188 preserveScroll: true, 189 onFinish: () => { 190 setProcessing(false); 191 onClose(); 192 } 193 }); 194 } 195 return /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(Dialog, { 196 ref: dialog.dialogRef, 197 onClick: dialog.handleBackdropClick, 198 children: /* @__PURE__ */ (0, import_jsx_runtime$3.jsxs)(DialogContent, { children: [ 199 /* @__PURE__ */ (0, import_jsx_runtime$3.jsxs)(DialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(DialogTitle, { children: "Delete API key" }), /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(DialogCloseButton, { 200 type: "button", 201 onClick: onClose 202 })] }), 203 /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(DialogBody, { children: /* @__PURE__ */ (0, import_jsx_runtime$3.jsxs)("p", { children: [ 204 "This action cannot be undone.",
205 /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)("br", {}), 206 /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)("strong", { children: "Do you really want to delete this API key?" }) 207 ] }) }), 208 /* @__PURE__ */ (0, import_jsx_runtime$3.jsxs)(DialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(Button, { 209 type: "button", 210 onClick: onClose, 211 children: "Cancel" 212 }), /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(Button, { 213 type: "button", 214 variant: "danger", 215 onClick: handleDelete, 216 disabled: processing, 217 children: "Delete API key" 218 })] }) 219 ] }) 220 }); 221} 222var import_react$3, import_jsx_runtime$3; 223function init_DeleteApiKeyModal() { 224 return (init_DeleteApiKeyModal = __esmMin((() => { 225 import_react$3 = require_react(); 226 init_dist$1(); 227 init_dialog(); 228 init_useDialog(); 229 init_button(); 230 init_routes(); 231 import_jsx_runtime$3 = require_jsx_runtime(); 232 })))(); 233} 234//#endregion 235//#region app/frontend/pages/ApiKeys/ApiOverview.tsx 236function ApiOverview(t0) { 237 const $ = (0, import_compiler_runtime$2.c)(17); 238 const { examples, fullDocumentationUrl, onCopy, onOpen, onPrefetch, busy } = t0; 239 let t1; 240 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 241 t1 = /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("h2", { 242 className: "page-header__title", 243 children: "API overview" 244 }); 245 $[0] = t1; 246 } else t1 = $[0]; 247 let t2; 248 if ($[1] !== fullDocumentationUrl) { 249 t2 = /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)(PageHeader, { 250 notFull: true, 251 className: "mb-0", 252 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(PageHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(Button, { 253 size: "sm", 254 asChild: true, 255 children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("a", { 256 target: "_blank", 257 rel: "noreferrer", 258 href: fullDocumentationUrl, 259 children: "Full documentation" 260 }) 261 }) })] 262 }); 263 $[1] = fullDocumentationUrl; 264 $[2] = t2; 265 } else t2 = $[2]; 266 let t3; 267 if ($[3] !== busy || $[4] !== examples || $[5] !== onCopy || $[6] !== onOpen || $[7] !== onPrefetch) { 268 let t4; 269 if ($[9] !== busy || $[10] !== onCopy || $[11] !== onOpen || $[12] !== onPrefetch) { 270 t4 = (example) => /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)("div", { 271 className: "api-keys-page__example", 272 children: [ 273 /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("h3", { children: example.title }), 274 /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)("code", { children: [ 275 example.method, 276 " ", 277 example.endpoint, 278 example.params.map(_temp$1) 279 ] }) }) }), 280 /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)("div", { 281 className: "api-keys-page__example-actions", 282 children: [/* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)(Button, { 283 size: "sm", 284 onPointerDown: onPrefetch, 285 onFocus: onPrefetch, 286 onClick: () => onCopy(example), 287 disabled: busy, 288 children: [/* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(Icon, { icon: "copy" }), "Copy"] 289 }), example.openUrl && /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)(Button, { 290 size: "sm", 291 onPointerDown: onPrefetch, 292 onClick: () => onOpen(example), 293 disabled: busy, 294 children: [/* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(Icon, { icon: "external-link" }), "Open"] 295 })] 296 }) 297 ] 298 }, example.title); 299 $[9] = busy; 300 $[10] = onCopy; 301 $[11] = onOpen; 302 $[12] = onPrefetch; 303 $[13] = t4; 304 } else t4 = $[13]; 305 t3 = examples.map(t4); 306 $[3] = busy; 307 $[4] = examples; 308 $[5] = onCopy; 309 $[6] = onOpen; 310 $[7] = onPrefetch; 311 $[8] = t3; 312 } else t3 = $[8]; 313 let t4; 314 if ($[14] !== t2 || $[15] !== t3) { 315 t4 = /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)("div", { 316 className: "board-box board-box--unboxed api-keys-page", 317 children: [t2, t3] 318 }); 319 $[14] = t2; 320 $[15] = t3; 321 $[16] = t4; 322 } else t4 = $[16]; 323 return t4; 324} 325function _temp$1(param, index) { 326 return /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)(import_react$2.Fragment, { children: [ 327 index === 0 ? "?" : "&", 328 param.name, 329 "=",
330 /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("span", { 331 className: "param", 332 children: param.value 333 }) 334 ] }, param.name); 335} 336var import_compiler_runtime$2, import_react$2, import_jsx_runtime$2; 337function init_ApiOverview() { 338 return (init_ApiOverview = __esmMin((() => { 339 import_compiler_runtime$2 = require_compiler_runtime(); 340 import_react$2 = require_react(); 341 init_button(); 342 init_icon(); 343 init_page_header(); 344 import_jsx_runtime$2 = require_jsx_runtime(); 345 })))(); 346} 347//#endregion 348//#region app/frontend/pages/ApiKeys/UptimeStatus.tsx 349function UptimeStatus() { 350 const $ = (0, import_compiler_runtime$1.c)(11); 351 const [operational, setOperational] = (0, import_react$1.useState)(true); 352 let t0; 353 let t1; 354 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 355 t0 = () => { 356 let cancelled = false; 357 fetch("/status.json").then(_temp).then((data) => { 358 if (cancelled || !data || !("status" in data)) return; 359 setOperational(data.status === "operational"); 360 }).catch(_temp2); 361 return () => { 362 cancelled = true; 363 }; 364 }; 365 t1 = []; 366 $[0] = t0; 367 $[1] = t1; 368 } else { 369 t0 = $[0]; 370 t1 = $[1]; 371 } 372 (0, import_react$1.useEffect)(t0, t1); 373 const t2 = `status-color-dot ${operational ? "up" : "down"}`; 374 let t3; 375 if ($[2] !== t2) { 376 t3 = /* @__PURE__ */ (0, import_jsx_runtime$1.jsx)("span", { 377 className: t2, 378 "aria-hidden": "true" 379 }); 380 $[2] = t2; 381 $[3] = t3; 382 } else t3 = $[3]; 383 let t4; 384 if ($[4] !== operational) { 385 t4 = operational ? i18n.t("js.uptime_status.all_systems_operational") : i18n.t("js.uptime_status.incident_in_progress"); 386 $[4] = operational; 387 $[5] = t4; 388 } else t4 = $[5]; 389 let t5; 390 if ($[6] !== t4) { 391 t5 = /* @__PURE__ */ (0, import_jsx_runtime$1.jsx)("span", { 392 className: "status-color-description", 393 children: t4 394 }); 395 $[6] = t4; 396 $[7] = t5; 397 } else t5 = $[7]; 398 let t6; 399 if ($[8] !== t3 || $[9] !== t5) { 400 t6 = /* @__PURE__ */ (0, import_jsx_runtime$1.jsxs)("p", { children: [t3, t5] }); 401 $[8] = t3; 402 $[9] = t5; 403 $[10] = t6; 404 } else t6 = $[10]; 405 return t6; 406} 407function _temp2() {} 408function _temp(response) { 409 return response.json(); 410} 411var import_compiler_runtime$1, import_react$1, import_jsx_runtime$1; 412function init_UptimeStatus() { 413 return (init_UptimeStatus = __esmMin((() => { 414 import_compiler_runtime$1 = require_compiler_runtime(); 415 import_react$1 = require_react(); 416 import_jsx_runtime$1 = require_jsx_runtime(); 417 })))(); 418} 419//#endregion 420//#region app/frontend/pages/ApiKeys/Index.tsx 421function useFlashMessages(flash) { 422 const $ = (0, import_compiler_runtime.c)(3); 423 const lastFlash = (0, import_react.useRef)(null); 424 let t0; 425 let t1; 426 if ($[0] !== flash) { 427 t0 = () => { 428 if (lastFlash.current === flash) return; 429 const isInitialFlash = lastFlash.current === null; 430 lastFlash.current = flash; 431 if (isInitialFlash) return; 432 if (flash.success) App.displayFlash("success", flash.success); 433 if (flash.notice) App.displayFlash("success", flash.notice); 434 if (flash.error) App.displayFlash("danger", flash.error); 435 if (flash.alert) App.displayFlash("danger", flash.alert); 436 if (flash.warning) App.displayFlash("warning", flash.warning); 437 }; 438 t1 = [flash]; 439 $[0] = flash; 440 $[1] = t0; 441 $[2] = t1; 442 } else { 443 t0 = $[1]; 444 t1 = $[2]; 445 } 446 (0, import_react.useEffect)(t0, t1); 447} 448function substituteApiKey(url, maskedToken, token) { 449 return maskedToken.length === 0 ? url : url.split(maskedToken).join(token); 450} 451async function requestToken(id) { 452 try { 453 return await fetchApiKeyToken(id); 454 } catch { 455 App.displayFlash("danger", LOAD_ERROR); 456 return null; 457 } 458} 459function copyFromPromise(textPromise) { 460 const clipboard = navigator.clipboard; 461 if (globalThis.ClipboardItem && clipboard?.write) { 462 const blobPromise = textPromise.then((text) => { 463 if (!text) throw new Error(LOAD_ERROR); 464 return new Blob([text], { type: "text/plain" }); 465 }); 466 clipboard.write([new ClipboardItem({ "text/plain": blobPromise })]).then(() => { 467 App.displayFlash("success", i18n.t("js.copied")); 468 }, () => { 469 textPromise.then((text) => { 470 if (text) copyToClipboard(text); 471 }); 472 }); 473 return; 474 } 475 textPromise.then((text) => { 476 if (text) copyToClipboard(text); 477 }); 478} 479function Index() { 480 const $ = (0, import_compiler_runtime.c)(60); 481 const { props } = usePage(); 482 const { apiKeys, defaultApiKeyId, canDelete, apiExamples, fullDocumentationUrl, statusPageUrl, flash } = props; 483 useFlashMessages(flash); 484 let t0; 485 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 486 t0 = {}; 487 $[0] = t0; 488 } else t0 = $[0]; 489 const [revealedTokens, setRevealedTokens] = (0, import_react.useState)(t0); 490 let t1; 491 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 492 t1 = /* @__PURE__ */ new Set(); 493 $[1] = t1; 494 } else t1 = $[1]; 495 const [pendingIds, setPendingIds] = (0, import_react.useState)(t1); 496 const [examplesBusy, setExamplesBusy] = (0, import_react.useState)(false); 497 const [createOpen, setCreateOpen] = (0, import_react.useState)(false); 498 const [renamingKey, setRenamingKey] = (0, import_react.useState)(null); 499 const [renameOpen, setRenameOpen] = (0, import_react.useState)(false); 500 const [deletingKey, setDeletingKey] = (0, import_react.useState)(null); 501 const [deleteOpen, setDeleteOpen] = (0, import_react.useState)(false); 502 const tokenCache = (0, import_react.useRef)({}); 503 const defaultMaskedToken = apiKeys.find((key) => key.id === defaultApiKeyId)?.token ?? ""; 504 let t2; 505 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 506 t2 = function markPending(id, pending) { 507 setPendingIds((prev) => { 508 const next = new Set(prev); 509 if (pending) next.add(id); 510 else next.delete(id); 511 return next; 512 }); 513 }; 514 $[2] = t2; 515 } else t2 = $[2]; 516 const markPending = t2; 517 const loadToken = async function loadToken(id_0) { 518 const cached = tokenCache.current[id_0]; 519 if (cached) return cached; 520 markPending(id_0, true); 521 return requestToken(id_0).then((token) => { 522 if (token) tokenCache.current[id_0] = token; 523 return token; 524 }).finally(() => { 525 markPending(id_0, false); 526 }); 527 }; 528 const prefetchToken = function prefetchToken(id_1) { 529 if (tokenCache.current[id_1]) return; 530 requestToken(id_1).then((token_0) => { 531 if (token_0) tokenCache.current[id_1] = token_0; 532 }); 533 }; 534 const toggleReveal = async function toggleReveal(id_2) { 535 if (revealedTokens[id_2]) { 536 setRevealedTokens((prev_0) => { 537 const next_0 = { ...prev_0 }; 538 delete next_0[id_2]; 539 return next_0; 540 }); 541 return; 542 } 543 const token_1 = await loadToken(id_2); 544 if (!token_1) return; 545 setRevealedTokens((prev_1) => ({ 546 ...prev_1, 547 [id_2]: token_1 548 })); 549 }; 550 const copyKey = function copyKey(id_3) { 551 const cached_0 = tokenCache.current[id_3]; 552 if (cached_0) { 553 copyToClipboard(cached_0); 554 return; 555 } 556 copyFromPromise(requestToken(id_3).then((token_2) => { 557 if (token_2) tokenCache.current[id_3] = token_2; 558 return token_2; 559 })); 560 }; 561 const copyExample = function copyExample(example) { 562 const cached_1 = tokenCache.current[defaultApiKeyId]; 563 if (cached_1) { 564 copyToClipboard(substituteApiKey(example.copyUrl, defaultMaskedToken, cached_1)); 565 return; 566 } 567 copyFromPromise(requestToken(defaultApiKeyId).then((token_3) => { 568 if (!token_3) return null; 569 tokenCache.current[defaultApiKeyId] = token_3; 570 return substituteApiKey(example.copyUrl, defaultMaskedToken, token_3); 571 })); 572 }; 573 const openExample = function openExample(example_0) { 574 if (!example_0.openUrl) return; 575 const tab = window.open("about:blank", "_blank"); 576 if (tab) tab.opener = null; 577 setExamplesBusy(true); 578 loadToken(defaultApiKeyId).then((token_4) => { 579 if (!token_4) { 580 tab?.close(); 581 return; 582 } 583 const url = substituteApiKey(example_0.openUrl, defaultMaskedToken, token_4); 584 if (tab) { 585 tab.location.replace(url); 586 return; 587 } 588 window.open(url, "_blank", "noopener,noreferrer"); 589 }).finally(() => { 590 setExamplesBusy(false); 591 }); 592 }; 593 let t3; 594 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 595 t3 = function openRename(key_0) { 596 setRenamingKey(key_0); 597 setRenameOpen(true); 598 }; 599 $[3] = t3; 600 } else t3 = $[3]; 601 const openRename = t3; 602 let t4; 603 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 604 t4 = function openDelete(key_1) { 605 setDeletingKey(key_1); 606 setDeleteOpen(true); 607 }; 608 $[4] = t4; 609 } else t4 = $[4]; 610 const openDelete = t4; 611 const title = apiKeys.length === 1 ? "API key" : "API keys"; 612 const T0 = TooltipProvider; 613 let t5; 614 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 615 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Head_default, { title: "API" }); 616 $[5] = t5; 617 } else t5 = $[5]; 618 const t6 = "board-box board-box--unboxed api-keys-page"; 619 let t7; 620 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 621 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { 622 delayDuration: 100, 623 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 624 asChild: true, 625 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { 626 type: "button", 627 className: "question-circle ml-1", 628 "aria-label": "About API keys", 629 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { icon: "question-circle" }) 630 }) 631 }
631), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 632 side: "right", 633 children: KEY_POPOVER 634 })] 635 }); 636 $[6] = t7; 637 } else t7 = $[6]; 638 let t8; 639 if ($[7] !== title) { 640 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageHeaderTitle, { children: [title, t7] }); 641 $[7] = title; 642 $[8] = t8; 643 } else t8 = $[8]; 644 let t9; 645 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 646 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 647 variant: "primary", 648 size: "sm", 649 onClick: () => setCreateOpen(true), 650 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { icon: "plus" }), "New key"] 651 }) }); 652 $[9] = t9; 653 } else t9 = $[9]; 654 let t10; 655 if ($[10] !== t8) { 656 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageHeader, { 657 notFull: true, 658 className: "mb-0", 659 children: [t8, t9] 660 }); 661 $[10] = t8; 662 $[11] = t10; 663 } else t10 = $[11]; 664 const t11 = "h-table api-keys-table"; 665 let t12; 666 if ($[12] === Symbol.for("react.memo_cache_sentinel")) { 667 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [ 668 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "API key" }), 669 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {}), 670 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { 671 className: "hidden-xs", 672 children: "Name" 673 }), 674 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { 675 className: "hidden-xs", 676 children: "Created" 677 }), 678 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {}) 679 ] }) }); 680 $[12] = t12; 681 } else t12 = $[12]; 682 const t13 = apiKeys.map((key_2) => { 683 const revealedToken = revealedTokens[key_2.id]; 684 const isPending = pendingIds.has(key_2.id); 685 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [ 686 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { 687 className: "ph-no-capture", 688 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { 689 className: "ph-no-capture", 690 children: revealedToken ? revealedToken : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 691 className: "hidden-xs", 692 children: MASKED_TOKEN 693 }), key_2.token.slice(-4)] }) 694 }) 695 }), 696 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { 697 className: "grey", 698 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 699 iconOnly: true, 700 size: "xs", 701 onPointerDown: () => prefetchToken(key_2.id), 702 onFocus: () => prefetchToken(key_2.id), 703 onClick: () => copyKey(key_2.id), 704 disabled: isPending, 705 "aria-label": "Copy API key", 706 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { icon: "copy" }) 707 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 708 iconOnly: true, 709 size: "xs", 710 onClick: () => void toggleReveal(key_2.id), 711 disabled: isPending, 712 "aria-label": revealedToken ? "Hide API key" : "Show API key", 713 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { icon: revealedToken ? "eye-slash" : "eye" }) 714 })] 715 }), 716 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { 717 className: "light-grey hidden-xs", 718 children: key_2.name || "â" 719 }), 720 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { 721 className: "light-grey hidden-xs", 722 children: key_2.createdAtLabel 723 }), 724 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { 725 className: "text-end", 726 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 727 className: "h-table__actions", 728 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 729 size: "xs", 730 onClick: () => openRename(key_2), 731 children: "Rename" 732 }), canDelete ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 733 size: "xs", 734 variant: "dangerLight", 735 onClick: () => openDelete(key_2), 736 children: "Delete" 737 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { 738 delayDuration: 100, 739 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 740 asChild: true, 741 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 742 className: "d-inline-block", 743 tabIndex: 0, 744 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 745 size: "xs", 746 variant: "dangerLight", 747 disabled: true, 748 style: { pointerEvents: "none" }, 749 children: "Delete" 750 }) 751 }) 752 }
752), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: DELETE_TOOLTIP })] 753 })] 754 }) 755 }) 756 ] }, key_2.id); 757 }); 758 let t14; 759 if ($[13] !== t13) { 760 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: t13 }); 761 $[13] = t13; 762 $[14] = t14; 763 } else t14 = $[14]; 764 let t15; 765 if ($[15] !== t12 || $[16] !== t14) { 766 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { children: [t12, t14] }); 767 $[15] = t12; 768 $[16] = t14; 769 $[17] = t15; 770 } else t15 = $[17]; 771 let t16; 772 if ($[18] === Symbol.for("react.memo_cache_sentinel")) { 773 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 774 className: "h-table__footer", 775 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 776 className: "h-hint", 777 children: API_KEY_DESCRIPTION 778 }) 779 }); 780 $[18] = t16; 781 } else t16 = $[18]; 782 let t17; 783 if ($[19] !== t15) { 784 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 785 className: t11, 786 children: [t15, t16] 787 }); 788 $[19] = t15; 789 $[20] = t17; 790 } else t17 = $[20]; 791 let t18; 792 if ($[21] !== t10 || $[22] !== t17) { 793 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 794 className: t6, 795 children: [t10, t17] 796 }); 797 $[21] = t10; 798 $[22] = t17; 799 $[23] = t18; 800 } else t18 = $[23]; 801 let t19; 802 if ($[24] !== defaultApiKeyId || $[25] !== prefetchToken) { 803 t19 = () => prefetchToken(defaultApiKeyId); 804 $[24] = defaultApiKeyId; 805 $[25] = prefetchToken; 806 $[26] = t19; 807 } else t19 = $[26]; 808 let t20; 809 if ($[27] !== apiExamples || $[28] !== copyExample || $[29] !== examplesBusy || $[30] !== fullDocumentationUrl || $[31] !== openExample || $[32] !== t19) { 810 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApiOverview, { 811 examples: apiExamples, 812 fullDocumentationUrl, 813 onCopy: copyExample, 814 onOpen: openExample, 815 onPrefetch: t19, 816 busy: examplesBusy 817 }); 818 $[27] = apiExamples; 819 $[28] = copyExample; 820 $[29] = examplesBusy; 821 $[30] = fullDocumentationUrl; 822 $[31] = openExample; 823 $[32] = t19; 824 $[33] = t20; 825 } else t20 = $[33]; 826 let t21; 827 if ($[34] === Symbol.for("react.memo_cache_sentinel")) { 828 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 829 className: "page-header__title", 830 children: "Status" 831 }); 832 $[34] = t21; 833 } else t21 = $[34]; 834 let t22; 835 if ($[35] !== statusPageUrl) { 836 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageHeader, { 837 notFull: true, 838 className: "mb-0", 839 children: [t21, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 840 size: "sm", 841 asChild: true, 842 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { 843 href: statusPageUrl, 844 target: "_blank", 845 rel: "noreferrer", 846 children: "Status page" 847 }) 848 }) })] 849 }); 850 $[35] = statusPageUrl; 851 $[36] = t22; 852 } else t22 = $[36]; 853 let t23; 854 if ($[37] === Symbol.for("react.memo_cache_sentinel")) { 855 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UptimeStatus, {}); 856 $[37] = t23; 857 } else t23 = $[37]; 858 let t24; 859 if ($[38] !== t22) { 860 t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 861 className: "board-box board-box--unboxed api-keys-page", 862 children: [t22, t23] 863 }); 864 $[38] = t22; 865 $[39] = t24; 866 } else t24 = $[39]; 867 let t25; 868 if ($[40] === Symbol.for("react.memo_cache_sentinel")) { 869 t25 = () => setCreateOpen(false); 870 $[40] = t25; 871 } else t25 = $[40]; 872 let t26; 873 if ($[41] !== createOpen) { 874 t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CreateApiKeyModal, { 875 isOpen: createOpen, 876 onClose: t25 877 }); 878 $[41] = createOpen; 879 $[42] = t26; 880 } else t26 = $[42]; 881 let t27; 882 if ($[43] === Symbol.for("react.memo_cache_sentinel")) { 883 t27 = () => setRenameOpen(false); 884 $[43] = t27; 885 } else t27 = $[43]; 886 let t28; 887 if ($[44] !== renameOpen || $[45] !== renamingKey) { 888 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RenameApiKeyModal, { 889 apiKey: renamingKey, 890 isOpen: renameOpen, 891 onClose: t27 892 }); 893 $[44] = renameOpen; 894 $[45] = renamingKey; 895 $[46] = t28; 896 } else t28 = $[46]; 897 let t29; 898 if ($[47] === Symbol.for("react.memo_cache_sentinel")) { 899 t29 = () => setDeleteOpen(false); 900 $[47] = t29; 901 } else t29 = $[47]; 902 let t30; 903 if ($[48] !== deleteOpen || $[49] !== deletingKey) { 904 t30 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeleteApiKeyModal, { 905 apiKey: deletingKey, 906 isOpen: deleteOpen, 907 onClose: t29 908 }); 909 $[48] = deleteOpen; 910 $[49] = deletingKey; 911 $[50] = t30; 912 } else t30 = $[50]; 913 let t31; 914 if ($[51] !== T0 || $[52] !== t18 || $[53] !== t20 || $[54] !== t24 || $[55] !== t26 || $[56] !== t28 || $[57] !== t30 || $[58] !== t5) { 915 t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T0, { children: [ 916 t5, 917 t18, 918 t20, 919 t24, 920 t26, 921 t28, 922 t30 923 ] }); 924 $[51] = T0; 925 $[52] = t18; 926 $[53] = t20; 927 $[54] = t24; 928 $[55] = t26; 929 $[56] = t28; 930 $[57] = t30; 931 $[58] = t5; 932 $[59] = t31; 933 } else t31 = $[59]; 934 return t31; 935} 936var import_compiler_runtime, import_react, import_jsx_runtime, MASKED_TOKEN, KEY_POPOVER, DELETE_TOOLTIP, API_KEY_DESCRIPTION, LOAD_
936ERROR; 937function init_Index() { 938 return (init_Index = __esmMin((() => { 939 import_compiler_runtime = require_compiler_runtime(); 940 init_dist$1(); 941 import_react = require_react(); 942 init_button(); 943 init_icon(); 944 init_page_header(); 945 init_tooltip(); 946 init_utils(); 947 init_CreateApiKeyModal(); 948 init_RenameApiKeyModal(); 949 init_DeleteApiKeyModal(); 950 init_ApiOverview(); 951 init_UptimeStatus(); 952 init_fetchApiKeyToken(); 953 import_jsx_runtime = require_jsx_runtime(); 954 MASKED_TOKEN = "â¢".repeat(32); 955 KEY_POPOVER = "Your API keys identify your account. You may be asked to provide one to connect to some of our services like the Google Sheets add-on. Never share it with services you donât trust."; 956 DELETE_TOOLTIP = "Your account always needs at least one API key. Please create a new one before deleting"; 957 API_KEY_DESCRIPTION = "Your API keys are like your passwords: make sure to always keep them hidden! Share them only with services you trust."; 958 LOAD_ERROR = "Couldn't load the API key. Please try again."; 959 })))(); 960} 961//#endregion 962init_Index(); 963export { Index as default };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.