@flamingo-stack/openframe-frontend-core 0.0.285 → 0.0.286-snapshot.20260618154650
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.
- package/dist/chunk-3MCHAFHB.js +89 -0
- package/dist/chunk-3MCHAFHB.js.map +1 -0
- package/dist/chunk-3SDBXXDP.cjs +1594 -0
- package/dist/chunk-3SDBXXDP.cjs.map +1 -0
- package/dist/{chunk-IMNGGLKL.js → chunk-3ZXUQQL4.js} +2 -2
- package/dist/chunk-5KD3S25X.cjs +312 -0
- package/dist/chunk-5KD3S25X.cjs.map +1 -0
- package/dist/{chunk-44ZFLMYC.cjs → chunk-6AW25OS6.cjs} +30 -30
- package/dist/{chunk-44ZFLMYC.cjs.map → chunk-6AW25OS6.cjs.map} +1 -1
- package/dist/{chunk-XDI5JSWB.cjs → chunk-6CSW5TMS.cjs} +45 -41
- package/dist/chunk-6CSW5TMS.cjs.map +1 -0
- package/dist/chunk-7EYWERFT.js +1594 -0
- package/dist/chunk-7EYWERFT.js.map +1 -0
- package/dist/{chunk-XX7P4IL2.js → chunk-7NM7DEUK.js} +4 -143
- package/dist/chunk-7NM7DEUK.js.map +1 -0
- package/dist/{chunk-GVSTRN36.cjs → chunk-D3LEFMOA.cjs} +3 -3
- package/dist/{chunk-GVSTRN36.cjs.map → chunk-D3LEFMOA.cjs.map} +1 -1
- package/dist/chunk-D6RK5YXX.cjs +2439 -0
- package/dist/chunk-D6RK5YXX.cjs.map +1 -0
- package/dist/{chunk-VQW7CEGS.js → chunk-EFYXPR43.js} +1831 -3672
- package/dist/chunk-EFYXPR43.js.map +1 -0
- package/dist/{chunk-PVXCVPJD.cjs → chunk-EI4WALN2.cjs} +67 -1626
- package/dist/chunk-EI4WALN2.cjs.map +1 -0
- package/dist/{chunk-ZIODAAFY.cjs → chunk-EL5GCMPU.cjs} +20 -159
- package/dist/chunk-EL5GCMPU.cjs.map +1 -0
- package/dist/{chunk-53CFL7PH.js → chunk-GJDXIVEQ.js} +11 -7
- package/dist/{chunk-53CFL7PH.js.map → chunk-GJDXIVEQ.js.map} +1 -1
- package/dist/chunk-I6ZPGKZ2.cjs +151 -0
- package/dist/chunk-I6ZPGKZ2.cjs.map +1 -0
- package/dist/{chunk-P45Q4QCU.cjs → chunk-JQ4I743L.cjs} +19 -15
- package/dist/chunk-JQ4I743L.cjs.map +1 -0
- package/dist/{chunk-J66U3LPZ.cjs → chunk-KBKZYJRI.cjs} +33 -332
- package/dist/chunk-KBKZYJRI.cjs.map +1 -0
- package/dist/chunk-MV67MBV3.js +290 -0
- package/dist/chunk-MV67MBV3.js.map +1 -0
- package/dist/chunk-MWS25U4U.cjs +290 -0
- package/dist/chunk-MWS25U4U.cjs.map +1 -0
- package/dist/{chunk-USPATRSC.js → chunk-N6ZM5PYZ.js} +45 -344
- package/dist/chunk-N6ZM5PYZ.js.map +1 -0
- package/dist/chunk-ODR6A6FC.js +2439 -0
- package/dist/chunk-ODR6A6FC.js.map +1 -0
- package/dist/{chunk-DPKUSBQH.cjs → chunk-OXC72UIP.cjs} +1073 -2914
- package/dist/chunk-OXC72UIP.cjs.map +1 -0
- package/dist/{chunk-RGALV4UX.js → chunk-POKKCWKF.js} +3 -82
- package/dist/chunk-POKKCWKF.js.map +1 -0
- package/dist/{chunk-Z3V2SGQZ.js → chunk-R2KT5GDD.js} +324 -1883
- package/dist/chunk-R2KT5GDD.js.map +1 -0
- package/dist/{chunk-RJUGNL2A.cjs → chunk-RG6FNZUA.cjs} +73 -31
- package/dist/chunk-RG6FNZUA.cjs.map +1 -0
- package/dist/{chunk-23UOJUDF.js → chunk-RWCA2ZQK.js} +4 -4
- package/dist/chunk-TFSYSWPS.cjs +89 -0
- package/dist/chunk-TFSYSWPS.cjs.map +1 -0
- package/dist/{chunk-KNCDUWY2.js → chunk-TY2EB7VK.js} +65 -23
- package/dist/chunk-TY2EB7VK.js.map +1 -0
- package/dist/chunk-TYZEMPPH.js +312 -0
- package/dist/chunk-TYZEMPPH.js.map +1 -0
- package/dist/chunk-VRSXJ5QJ.js +1599 -0
- package/dist/chunk-VRSXJ5QJ.js.map +1 -0
- package/dist/chunk-Y4JNA4W6.cjs +1599 -0
- package/dist/chunk-Y4JNA4W6.cjs.map +1 -0
- package/dist/{chunk-ZSUNQJRO.cjs → chunk-YETA25JW.cjs} +2 -81
- package/dist/chunk-YETA25JW.cjs.map +1 -0
- package/dist/chunk-ZLN6SM2U.js +151 -0
- package/dist/chunk-ZLN6SM2U.js.map +1 -0
- package/dist/{chunk-O5N57CRV.js → chunk-ZYLQMCHW.js} +12 -8
- package/dist/{chunk-O5N57CRV.js.map → chunk-ZYLQMCHW.js.map} +1 -1
- package/dist/components/chat/chat-attachment-bar.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +12 -6
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +45 -39
- package/dist/components/contact/index.cjs +11 -7
- package/dist/components/contact/index.cjs.map +1 -1
- package/dist/components/contact/index.js +10 -6
- package/dist/components/docs/doc-navigation-context.d.ts +39 -0
- package/dist/components/docs/doc-navigation-context.d.ts.map +1 -0
- package/dist/components/docs/doc-viewer.d.ts +66 -0
- package/dist/components/docs/doc-viewer.d.ts.map +1 -0
- package/dist/components/docs/index.cjs +34 -0
- package/dist/components/docs/index.cjs.map +1 -0
- package/dist/components/docs/index.d.ts +8 -0
- package/dist/components/docs/index.d.ts.map +1 -0
- package/dist/components/docs/index.js +34 -0
- package/dist/components/docs/index.js.map +1 -0
- package/dist/components/docs/use-document-tree.d.ts +41 -0
- package/dist/components/docs/use-document-tree.d.ts.map +1 -0
- package/dist/components/docs/use-scroll-spy.d.ts +16 -0
- package/dist/components/docs/use-scroll-spy.d.ts.map +1 -0
- package/dist/components/embeds/embed-iframe.d.ts +29 -0
- package/dist/components/embeds/embed-iframe.d.ts.map +1 -0
- package/dist/components/embeds/figma-embed.d.ts +27 -0
- package/dist/components/embeds/figma-embed.d.ts.map +1 -0
- package/dist/components/embeds/google-sheets-viewer.d.ts +8 -0
- package/dist/components/embeds/google-sheets-viewer.d.ts.map +1 -0
- package/dist/components/embeds/index.cjs +37 -0
- package/dist/components/embeds/index.cjs.map +1 -0
- package/dist/components/embeds/index.d.ts +9 -0
- package/dist/components/embeds/index.d.ts.map +1 -0
- package/dist/components/embeds/index.js +37 -0
- package/dist/components/embeds/index.js.map +1 -0
- package/dist/components/embeds/pdf-viewer.d.ts +10 -0
- package/dist/components/embeds/pdf-viewer.d.ts.map +1 -0
- package/dist/components/faq/faq-section.d.ts.map +1 -1
- package/dist/components/faq/index.cjs +12 -8
- package/dist/components/faq/index.cjs.map +1 -1
- package/dist/components/faq/index.js +11 -7
- package/dist/components/faq-accordion.d.ts.map +1 -1
- package/dist/components/features/index.cjs +10 -6
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.js +9 -5
- package/dist/components/index.cjs +247 -1120
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +645 -1518
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +15 -6
- package/dist/components/navigation/index.cjs.map +1 -1
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/navigation/index.js +15 -6
- package/dist/components/navigation/multi-level-navigation.d.ts +28 -0
- package/dist/components/navigation/multi-level-navigation.d.ts.map +1 -0
- package/dist/components/onboarding-guides/index.cjs +34 -29
- package/dist/components/onboarding-guides/index.cjs.map +1 -1
- package/dist/components/onboarding-guides/index.js +13 -8
- package/dist/components/onboarding-guides/index.js.map +1 -1
- package/dist/components/related-content/index.cjs +12 -8
- package/dist/components/related-content/index.cjs.map +1 -1
- package/dist/components/related-content/index.js +11 -7
- package/dist/components/tickets/index.cjs +75 -70
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.js +16 -11
- package/dist/components/tickets/index.js.map +1 -1
- package/dist/components/ui/index.cjs +12 -6
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +65 -59
- package/dist/embed-shims/index.cjs +3 -3
- package/dist/embed-shims/index.cjs.map +1 -1
- package/dist/embed-shims/index.js +8 -8
- package/dist/hooks/index.cjs +6 -3
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +7 -4
- package/dist/index.cjs +68 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +263 -201
- package/dist/types/doc-source.cjs +4 -0
- package/dist/types/doc-source.cjs.map +1 -0
- package/dist/types/doc-source.d.ts +86 -0
- package/dist/types/doc-source.d.ts.map +1 -0
- package/dist/types/doc-source.js +3 -0
- package/dist/types/doc-source.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/marketing.d.ts +1 -1
- package/dist/types/marketing.d.ts.map +1 -1
- package/dist/utils/doc-path-utils.d.ts +24 -0
- package/dist/utils/doc-path-utils.d.ts.map +1 -0
- package/dist/utils/doc-tree-nav.d.ts +35 -0
- package/dist/utils/doc-tree-nav.d.ts.map +1 -0
- package/dist/utils/embed-url-converters.d.ts +16 -0
- package/dist/utils/embed-url-converters.d.ts.map +1 -0
- package/dist/utils/faq-anchor.d.ts +51 -0
- package/dist/utils/faq-anchor.d.ts.map +1 -0
- package/dist/utils/format.d.ts +9 -0
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/index.cjs +320 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +9 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +296 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/list-url.d.ts.map +1 -1
- package/dist/utils/markdown-section-extractor.d.ts +23 -0
- package/dist/utils/markdown-section-extractor.d.ts.map +1 -0
- package/dist/utils/markdown-to-plain.d.ts +32 -0
- package/dist/utils/markdown-to-plain.d.ts.map +1 -0
- package/dist/utils/tree-builder.d.ts +30 -0
- package/dist/utils/tree-builder.d.ts.map +1 -0
- package/package.json +19 -1
- package/src/components/chat/chat-attachment-bar.tsx +6 -11
- package/src/components/docs/doc-navigation-context.tsx +123 -0
- package/src/components/docs/doc-viewer.tsx +345 -0
- package/src/components/docs/index.ts +12 -0
- package/src/components/docs/use-document-tree.ts +427 -0
- package/src/components/docs/use-scroll-spy.ts +93 -0
- package/src/components/embeds/embed-iframe.tsx +103 -0
- package/src/components/embeds/figma-embed.tsx +147 -0
- package/src/components/embeds/google-sheets-viewer.tsx +54 -0
- package/src/components/embeds/index.ts +11 -0
- package/src/components/embeds/pdf-viewer.tsx +64 -0
- package/src/components/faq/faq-section.tsx +78 -26
- package/src/components/faq-accordion.tsx +8 -1
- package/src/components/index.ts +2 -0
- package/src/components/navigation/index.ts +5 -0
- package/src/components/navigation/multi-level-navigation.tsx +358 -0
- package/src/types/doc-source.ts +88 -0
- package/src/types/index.ts +4 -0
- package/src/types/marketing.ts +1 -0
- package/src/utils/doc-path-utils.ts +47 -0
- package/src/utils/doc-tree-nav.ts +111 -0
- package/src/utils/embed-url-converters.ts +77 -0
- package/src/utils/faq-anchor.ts +70 -0
- package/src/utils/format.ts +16 -0
- package/src/utils/index.ts +18 -0
- package/src/utils/list-url.ts +1 -0
- package/src/utils/markdown-section-extractor.ts +106 -0
- package/src/utils/markdown-to-plain.ts +69 -0
- package/src/utils/tree-builder.ts +114 -0
- package/dist/chunk-DPKUSBQH.cjs.map +0 -1
- package/dist/chunk-J66U3LPZ.cjs.map +0 -1
- package/dist/chunk-KNCDUWY2.js.map +0 -1
- package/dist/chunk-P45Q4QCU.cjs.map +0 -1
- package/dist/chunk-PVXCVPJD.cjs.map +0 -1
- package/dist/chunk-RGALV4UX.js.map +0 -1
- package/dist/chunk-RJUGNL2A.cjs.map +0 -1
- package/dist/chunk-USPATRSC.js.map +0 -1
- package/dist/chunk-VQW7CEGS.js.map +0 -1
- package/dist/chunk-XDI5JSWB.cjs.map +0 -1
- package/dist/chunk-XX7P4IL2.js.map +0 -1
- package/dist/chunk-Z3V2SGQZ.js.map +0 -1
- package/dist/chunk-ZIODAAFY.cjs.map +0 -1
- package/dist/chunk-ZSUNQJRO.cjs.map +0 -1
- /package/dist/{chunk-IMNGGLKL.js.map → chunk-3ZXUQQL4.js.map} +0 -0
- /package/dist/{chunk-23UOJUDF.js.map → chunk-RWCA2ZQK.js.map} +0 -0
package/dist/utils/index.cjs
CHANGED
|
@@ -190,6 +190,13 @@ function formatBytesShort(bytes) {
|
|
|
190
190
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
191
191
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
|
192
192
|
}
|
|
193
|
+
function formatFileSize(bytes) {
|
|
194
|
+
if (bytes === 0) return "0 B";
|
|
195
|
+
const k = 1024;
|
|
196
|
+
const sizes = ["B", "KB", "MB", "GB"];
|
|
197
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
198
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`;
|
|
199
|
+
}
|
|
193
200
|
function formatLargeNumber(num) {
|
|
194
201
|
if (num === 0) return "0";
|
|
195
202
|
const isNegative = num < 0;
|
|
@@ -3368,7 +3375,8 @@ var BUILDERS = {
|
|
|
3368
3375
|
case_study: (ids, b) => `${b}/api/case-studies?ids=${ids.join(",")}&limit=${ids.length}`,
|
|
3369
3376
|
product_release: (ids, b) => `${b}/api/releases?ids=${ids.join(",")}&limit=${ids.length}`,
|
|
3370
3377
|
customer_interview: (ids, b) => `${b}/api/customer-interviews?ids=${ids.join(",")}&limit=${ids.length}`,
|
|
3371
|
-
investor_update: (ids, b) => `${b}/api/investor-updates?ids=${ids.join(",")}&limit=${ids.length}
|
|
3378
|
+
investor_update: (ids, b) => `${b}/api/investor-updates?ids=${ids.join(",")}&limit=${ids.length}`,
|
|
3379
|
+
faq: (ids, b) => `${b}/api/faqs?ids=${ids.join(",")}&limit=${ids.length}`
|
|
3372
3380
|
};
|
|
3373
3381
|
function buildListUrl(contentRefType, ids, base = "") {
|
|
3374
3382
|
if (ids.length === 0) return null;
|
|
@@ -3380,6 +3388,24 @@ function buildListUrl(contentRefType, ids, base = "") {
|
|
|
3380
3388
|
return fn ? fn(ids, base) : null;
|
|
3381
3389
|
}
|
|
3382
3390
|
|
|
3391
|
+
// src/utils/faq-anchor.ts
|
|
3392
|
+
function faqSectionSlug(section) {
|
|
3393
|
+
return "faq-" + section.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3394
|
+
}
|
|
3395
|
+
function faqItemAnchor(id) {
|
|
3396
|
+
return `faq-item-${id}`;
|
|
3397
|
+
}
|
|
3398
|
+
var FAQ_ITEM_HASH_RE = /^faq-item-(\d+)$/;
|
|
3399
|
+
function parseFaqHash(hash) {
|
|
3400
|
+
if (!hash) return null;
|
|
3401
|
+
const trimmed = hash.replace(/^#/, "");
|
|
3402
|
+
if (!trimmed) return null;
|
|
3403
|
+
const itemMatch = FAQ_ITEM_HASH_RE.exec(trimmed);
|
|
3404
|
+
if (itemMatch) return { kind: "item", rawId: itemMatch[1] };
|
|
3405
|
+
if (trimmed.startsWith("faq-")) return { kind: "section", slug: trimmed };
|
|
3406
|
+
return null;
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3383
3409
|
// src/utils/content-ref-groups.ts
|
|
3384
3410
|
var CONTENT_REF_GROUPS = {
|
|
3385
3411
|
investor_update: { label: "Investor Updates", order: 1, layout: "grid", gridSize: "default" },
|
|
@@ -3515,6 +3541,274 @@ function evaluateHumanitySignals(body, opts) {
|
|
|
3515
3541
|
}
|
|
3516
3542
|
var splitCsvEnv = (s) => s?.split(",").map((t) => t.trim()).filter(Boolean) ?? [];
|
|
3517
3543
|
|
|
3544
|
+
// src/utils/doc-tree-nav.ts
|
|
3545
|
+
var DEFAULT_FOLDER_INDEX_FILE = "README.md";
|
|
3546
|
+
var DEFAULT_FOLDER_INDEX = DEFAULT_FOLDER_INDEX_FILE;
|
|
3547
|
+
function stripFolderIndexFromPath(path, folderIndexFile = DEFAULT_FOLDER_INDEX) {
|
|
3548
|
+
const suffix = `/${folderIndexFile}`;
|
|
3549
|
+
if (path.endsWith(suffix)) return path.slice(0, -suffix.length);
|
|
3550
|
+
if (path === folderIndexFile) return "";
|
|
3551
|
+
return path;
|
|
3552
|
+
}
|
|
3553
|
+
function findDocNodeByPath(path, nodes) {
|
|
3554
|
+
for (const node of nodes) {
|
|
3555
|
+
if (node.path === path) return node;
|
|
3556
|
+
if (node.children) {
|
|
3557
|
+
const found = findDocNodeByPath(path, node.children);
|
|
3558
|
+
if (found) return found;
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
return null;
|
|
3562
|
+
}
|
|
3563
|
+
function getDocAncestorNodeIds(nodePath) {
|
|
3564
|
+
const parts = nodePath.split("/");
|
|
3565
|
+
const ids = [];
|
|
3566
|
+
let current = "";
|
|
3567
|
+
for (const part of parts) {
|
|
3568
|
+
current = current ? `${current}-${part}` : part;
|
|
3569
|
+
ids.push(current.toLowerCase());
|
|
3570
|
+
}
|
|
3571
|
+
return ids;
|
|
3572
|
+
}
|
|
3573
|
+
function resolveContentFetchPath(selectedPath, structure, folderIndexFile = DEFAULT_FOLDER_INDEX) {
|
|
3574
|
+
if (selectedPath === "") {
|
|
3575
|
+
return folderIndexFile;
|
|
3576
|
+
}
|
|
3577
|
+
const node = findDocNodeByPath(selectedPath, structure);
|
|
3578
|
+
if (node && node.type === "folder" && !node.hasReadme) {
|
|
3579
|
+
return null;
|
|
3580
|
+
}
|
|
3581
|
+
let pathToFetch = selectedPath;
|
|
3582
|
+
if (node && node.type === "folder" && node.hasReadme) {
|
|
3583
|
+
pathToFetch = `${selectedPath}/${folderIndexFile}`;
|
|
3584
|
+
}
|
|
3585
|
+
return pathToFetch;
|
|
3586
|
+
}
|
|
3587
|
+
function getInitialExpandedNodeIds(cleanInitialPath) {
|
|
3588
|
+
if (!cleanInitialPath) return [];
|
|
3589
|
+
const pathForExpansion = cleanInitialPath.includes(".") ? cleanInitialPath.substring(0, cleanInitialPath.lastIndexOf("/")) : cleanInitialPath;
|
|
3590
|
+
if (!pathForExpansion) return [];
|
|
3591
|
+
return getDocAncestorNodeIds(pathForExpansion);
|
|
3592
|
+
}
|
|
3593
|
+
function getDocSourceDefaultPath(structure, folderIndexFile = DEFAULT_FOLDER_INDEX) {
|
|
3594
|
+
if (!structure.length) return null;
|
|
3595
|
+
const hasRootIndex = structure.some(
|
|
3596
|
+
(node) => node.type === "file" && node.path === folderIndexFile
|
|
3597
|
+
);
|
|
3598
|
+
if (hasRootIndex) return null;
|
|
3599
|
+
const firstFolderWithReadme = structure.find(
|
|
3600
|
+
(node) => node.type === "folder" && node.hasReadme && !!node.path
|
|
3601
|
+
);
|
|
3602
|
+
return firstFolderWithReadme?.path ?? null;
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
// src/utils/doc-path-utils.ts
|
|
3606
|
+
function toDocSlug(name) {
|
|
3607
|
+
return name.trim().toLowerCase().replace(/\s+/g, "-");
|
|
3608
|
+
}
|
|
3609
|
+
function pathToNodeId(path) {
|
|
3610
|
+
return path.replace(/[\/\s]/g, "-").toLowerCase();
|
|
3611
|
+
}
|
|
3612
|
+
function normalizeDocPath(segments, folderIndexFile = DEFAULT_FOLDER_INDEX_FILE) {
|
|
3613
|
+
const lowerPath = (segments?.join("/") || "").toLowerCase();
|
|
3614
|
+
const lowerIndex = folderIndexFile.toLowerCase();
|
|
3615
|
+
const suffix = `/${lowerIndex}`;
|
|
3616
|
+
if (lowerPath.endsWith(suffix)) return lowerPath.slice(0, -suffix.length);
|
|
3617
|
+
if (lowerPath === lowerIndex) return "";
|
|
3618
|
+
return lowerPath;
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
// src/utils/tree-builder.ts
|
|
3622
|
+
function formatDocName(name) {
|
|
3623
|
+
let displayName = name;
|
|
3624
|
+
if (displayName.endsWith(".md")) {
|
|
3625
|
+
displayName = displayName.slice(0, -3);
|
|
3626
|
+
}
|
|
3627
|
+
if (displayName.toLowerCase() === "readme") {
|
|
3628
|
+
return "README";
|
|
3629
|
+
}
|
|
3630
|
+
return displayName.charAt(0).toUpperCase() + displayName.slice(1).replace(/-/g, " ");
|
|
3631
|
+
}
|
|
3632
|
+
function sortTreeChildren(nodes) {
|
|
3633
|
+
nodes.sort((a, b) => {
|
|
3634
|
+
const aIsReadme = a.name.toLowerCase() === "readme" || a.name.toLowerCase() === "readme.md";
|
|
3635
|
+
const bIsReadme = b.name.toLowerCase() === "readme" || b.name.toLowerCase() === "readme.md";
|
|
3636
|
+
if (aIsReadme && !bIsReadme) return -1;
|
|
3637
|
+
if (!aIsReadme && bIsReadme) return 1;
|
|
3638
|
+
if (a.type === "folder" && b.type !== "folder") return -1;
|
|
3639
|
+
if (a.type !== "folder" && b.type === "folder") return 1;
|
|
3640
|
+
const aOrder = a.sortOrder ?? Infinity;
|
|
3641
|
+
const bOrder = b.sortOrder ?? Infinity;
|
|
3642
|
+
if (aOrder !== bOrder) return aOrder - bOrder;
|
|
3643
|
+
return a.name.localeCompare(b.name, void 0, { sensitivity: "base" });
|
|
3644
|
+
});
|
|
3645
|
+
for (const node of nodes) {
|
|
3646
|
+
if (node.type === "folder" && node.children) {
|
|
3647
|
+
node.children = sortTreeChildren(node.children);
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
return nodes;
|
|
3651
|
+
}
|
|
3652
|
+
function buildDocumentTree(docs, mapFn, getParentPath, getPath) {
|
|
3653
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
3654
|
+
const rootNodes = [];
|
|
3655
|
+
for (const doc of docs) {
|
|
3656
|
+
const node = mapFn(doc);
|
|
3657
|
+
nodeMap.set(getPath(doc), node);
|
|
3658
|
+
}
|
|
3659
|
+
for (const doc of docs) {
|
|
3660
|
+
const node = nodeMap.get(getPath(doc));
|
|
3661
|
+
let resolvedParentPath = getParentPath(doc);
|
|
3662
|
+
if (!resolvedParentPath) {
|
|
3663
|
+
const nodePath = getPath(doc);
|
|
3664
|
+
const lastSlash = nodePath.lastIndexOf("/");
|
|
3665
|
+
if (lastSlash > 0) {
|
|
3666
|
+
resolvedParentPath = nodePath.substring(0, lastSlash);
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
if (resolvedParentPath) {
|
|
3670
|
+
const parent = nodeMap.get(resolvedParentPath);
|
|
3671
|
+
if (parent) {
|
|
3672
|
+
if (!parent.children) parent.children = [];
|
|
3673
|
+
parent.children.push(node);
|
|
3674
|
+
} else {
|
|
3675
|
+
rootNodes.push(node);
|
|
3676
|
+
}
|
|
3677
|
+
} else {
|
|
3678
|
+
rootNodes.push(node);
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
return sortTreeChildren(rootNodes);
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3684
|
+
// src/utils/markdown-to-plain.ts
|
|
3685
|
+
function stripInlineMarkdown(s) {
|
|
3686
|
+
return s.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/`([^`]+)`/g, "$1");
|
|
3687
|
+
}
|
|
3688
|
+
function markdownToPlainText(markdown, options = {}) {
|
|
3689
|
+
const { mode = "article", maxChars } = options;
|
|
3690
|
+
let out = markdown.replace(/```[\s\S]*?```/g, "").replace(/!\[[^\]]*\]\([^)]+\)/g, "");
|
|
3691
|
+
out = stripInlineMarkdown(out).replace(/^#+\s*/gm, "").replace(/^\s*[-*+]\s+/gm, "");
|
|
3692
|
+
if (mode === "preview") {
|
|
3693
|
+
out = out.replace(/\s+/g, " ").trim();
|
|
3694
|
+
} else {
|
|
3695
|
+
out = out.replace(/\n{3,}/g, "\n\n").trim();
|
|
3696
|
+
}
|
|
3697
|
+
if (maxChars != null && out.length > maxChars) {
|
|
3698
|
+
out = out.slice(0, maxChars);
|
|
3699
|
+
}
|
|
3700
|
+
return out;
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
// src/utils/markdown-section-extractor.ts
|
|
3704
|
+
var DEFAULT_OPTIONS = {
|
|
3705
|
+
maxLevel: 2,
|
|
3706
|
+
removeEmojis: true,
|
|
3707
|
+
handleDuplicateIds: true,
|
|
3708
|
+
stripFormattingMarkers: true,
|
|
3709
|
+
skipCodeAndYamlBlocks: true
|
|
3710
|
+
};
|
|
3711
|
+
function extractSections(markdown, options = {}) {
|
|
3712
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
3713
|
+
const sections = [];
|
|
3714
|
+
const lines = markdown.split("\n");
|
|
3715
|
+
const idCounts = {};
|
|
3716
|
+
let inCodeBlock = false;
|
|
3717
|
+
let inYamlBlock = false;
|
|
3718
|
+
for (const line of lines) {
|
|
3719
|
+
if (opts.skipCodeAndYamlBlocks) {
|
|
3720
|
+
if (line.startsWith("```")) {
|
|
3721
|
+
inCodeBlock = !inCodeBlock;
|
|
3722
|
+
continue;
|
|
3723
|
+
}
|
|
3724
|
+
if (line === "---") {
|
|
3725
|
+
inYamlBlock = !inYamlBlock;
|
|
3726
|
+
continue;
|
|
3727
|
+
}
|
|
3728
|
+
if (inCodeBlock || inYamlBlock) continue;
|
|
3729
|
+
}
|
|
3730
|
+
const pattern = new RegExp(`^(#{1,${opts.maxLevel}})\\s+(.+)`);
|
|
3731
|
+
const match = line.match(pattern);
|
|
3732
|
+
if (!match) continue;
|
|
3733
|
+
const level = match[1].length;
|
|
3734
|
+
if (level > opts.maxLevel) continue;
|
|
3735
|
+
let title = match[2].trim();
|
|
3736
|
+
if (opts.stripFormattingMarkers) {
|
|
3737
|
+
title = stripInlineMarkdown(title).trim();
|
|
3738
|
+
}
|
|
3739
|
+
let baseId = title;
|
|
3740
|
+
if (opts.removeEmojis) {
|
|
3741
|
+
baseId = baseId.replace(
|
|
3742
|
+
/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/gu,
|
|
3743
|
+
""
|
|
3744
|
+
).trim();
|
|
3745
|
+
}
|
|
3746
|
+
baseId = baseId.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/^-+|-+$/g, "");
|
|
3747
|
+
const cleanId = baseId || `section-${sections.length + 1}`;
|
|
3748
|
+
let id = cleanId;
|
|
3749
|
+
if (opts.handleDuplicateIds) {
|
|
3750
|
+
if (idCounts[cleanId]) {
|
|
3751
|
+
idCounts[cleanId]++;
|
|
3752
|
+
id = `${cleanId}-${idCounts[cleanId]}`;
|
|
3753
|
+
} else {
|
|
3754
|
+
idCounts[cleanId] = 1;
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
sections.push({ id, title, level });
|
|
3758
|
+
}
|
|
3759
|
+
return sections;
|
|
3760
|
+
}
|
|
3761
|
+
|
|
3762
|
+
// src/utils/embed-url-converters.ts
|
|
3763
|
+
function toGoogleSheetsEmbedUrl(url) {
|
|
3764
|
+
if (url.includes("/htmlembed")) return url;
|
|
3765
|
+
const match = url.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);
|
|
3766
|
+
if (!match) return url;
|
|
3767
|
+
const gidMatch = url.match(/[#?&]gid=(\d+)/);
|
|
3768
|
+
const gid = gidMatch ? gidMatch[1] : "0";
|
|
3769
|
+
return `https://docs.google.com/spreadsheets/d/${match[1]}/htmlembed?widget=true&chrome=false&headers=false&gid=${gid}`;
|
|
3770
|
+
}
|
|
3771
|
+
function toGoogleSheetsOriginalUrl(url) {
|
|
3772
|
+
const match = url.match(/\/spreadsheets\/d\/([a-zA-Z0-9-_]+)/);
|
|
3773
|
+
if (!match) return url;
|
|
3774
|
+
const gidMatch = url.match(/[#?&]gid=(\d+)/);
|
|
3775
|
+
const gid = gidMatch ? gidMatch[1] : "0";
|
|
3776
|
+
return `https://docs.google.com/spreadsheets/d/${match[1]}/edit#gid=${gid}`;
|
|
3777
|
+
}
|
|
3778
|
+
function toFigmaEmbedUrl(url, opts) {
|
|
3779
|
+
if (url.includes("embed.figma.com")) return url;
|
|
3780
|
+
if (url.includes("figma.com/embed")) return url;
|
|
3781
|
+
const match = url.match(
|
|
3782
|
+
/figma\.com\/(design|file|proto|board|slides|deck)\/([a-zA-Z0-9]+)(?:\/([^?]*))?(\?.*)?$/
|
|
3783
|
+
);
|
|
3784
|
+
if (match) {
|
|
3785
|
+
const [, urlType, fileKey, titleSlug, queryString] = match;
|
|
3786
|
+
const isSlides = urlType === "slides" || urlType === "deck";
|
|
3787
|
+
const embedType = urlType === "proto" ? "proto" : isSlides ? opts?.slidesView === "browse" ? "slides" : "deck" : "design";
|
|
3788
|
+
const pathSuffix = titleSlug ? `/${titleSlug}` : "";
|
|
3789
|
+
const params = new URLSearchParams(queryString?.replace(/^\?/, "") || "");
|
|
3790
|
+
if (!params.has("embed-host")) {
|
|
3791
|
+
params.set("embed-host", "flamingo");
|
|
3792
|
+
}
|
|
3793
|
+
const clientId = process.env.NEXT_PUBLIC_FIGMA_CLIENT_ID;
|
|
3794
|
+
if (clientId && !params.has("client-id")) {
|
|
3795
|
+
params.set("client-id", clientId);
|
|
3796
|
+
}
|
|
3797
|
+
return `https://embed.figma.com/${embedType}/${fileKey}${pathSuffix}?${params.toString()}`;
|
|
3798
|
+
}
|
|
3799
|
+
return `https://www.figma.com/embed?embed-host=flamingo&url=${encodeURIComponent(url)}`;
|
|
3800
|
+
}
|
|
3801
|
+
function isFigmaSlidesUrl(url) {
|
|
3802
|
+
if (!url) return false;
|
|
3803
|
+
return /(?:www\.|embed\.)?figma\.com\/(?:slides|deck)\/[a-zA-Z0-9]+/.test(url);
|
|
3804
|
+
}
|
|
3805
|
+
function toFigmaOriginalUrl(url) {
|
|
3806
|
+
if (url.includes("embed.figma.com")) {
|
|
3807
|
+
return url.replace("embed.figma.com", "www.figma.com").replace(/\?.*$/, "");
|
|
3808
|
+
}
|
|
3809
|
+
return url.replace(/\?.*$/, "");
|
|
3810
|
+
}
|
|
3811
|
+
|
|
3518
3812
|
exports.ANTHROPIC_SUPPORTED_IMAGE_MIME = ANTHROPIC_SUPPORTED_IMAGE_MIME;
|
|
3519
3813
|
exports.AUTO_CONTINUATION_DIRECTIVE_PREFIX = AUTO_CONTINUATION_DIRECTIVE_PREFIX;
|
|
3520
3814
|
exports.CHAT_ATTACHMENT_MARKDOWN_PATTERN = CHAT_ATTACHMENT_MARKDOWN_PATTERN;
|
|
@@ -3524,6 +3818,7 @@ exports.CHAT_ATTACHMENT_VIEW_URL_PREFIX_REGEX_ESCAPED = CHAT_ATTACHMENT_VIEW_URL
|
|
|
3524
3818
|
exports.CONTENT_REF_GROUPS = CONTENT_REF_GROUPS;
|
|
3525
3819
|
exports.CUSTOM_ITEM_ID = CUSTOM_ITEM_ID;
|
|
3526
3820
|
exports.DEFAULT_CONTENT_SUFFIXES = DEFAULT_CONTENT_SUFFIXES;
|
|
3821
|
+
exports.DEFAULT_FOLDER_INDEX_FILE = DEFAULT_FOLDER_INDEX_FILE;
|
|
3527
3822
|
exports.DEFAULT_MIN_FILL_MS = DEFAULT_MIN_FILL_MS;
|
|
3528
3823
|
exports.DEFAULT_OS_PLATFORM = DEFAULT_OS_PLATFORM;
|
|
3529
3824
|
exports.DELIVERY_TASK_TYPE_OPTIONS = DELIVERY_TASK_TYPE_OPTIONS;
|
|
@@ -3549,6 +3844,7 @@ exports.buildAutoContinuationDirective = buildAutoContinuationDirective;
|
|
|
3549
3844
|
exports.buildChatAttachmentViewUrl = buildChatAttachmentViewUrl;
|
|
3550
3845
|
exports.buildDefaultHref = buildDefaultHref;
|
|
3551
3846
|
exports.buildDiscussAddendum = buildDiscussAddendum;
|
|
3847
|
+
exports.buildDocumentTree = buildDocumentTree;
|
|
3552
3848
|
exports.buildListUrl = buildListUrl;
|
|
3553
3849
|
exports.buildSuggestionUrl = buildSuggestionUrl;
|
|
3554
3850
|
exports.canonicalContentRefType = canonicalContentRefType;
|
|
@@ -3572,7 +3868,11 @@ exports.extractHumanitySignals = extractHumanitySignals;
|
|
|
3572
3868
|
exports.extractImageEdgeColorAsync = extractImageEdgeColorAsync;
|
|
3573
3869
|
exports.extractItemId = extractItemId;
|
|
3574
3870
|
exports.extractItems = extractItems;
|
|
3871
|
+
exports.extractSections = extractSections;
|
|
3872
|
+
exports.faqItemAnchor = faqItemAnchor;
|
|
3873
|
+
exports.faqSectionSlug = faqSectionSlug;
|
|
3575
3874
|
exports.fetchPriorityProp = fetchPriorityProp;
|
|
3875
|
+
exports.findDocNodeByPath = findDocNodeByPath;
|
|
3576
3876
|
exports.flattenAssistantContent = flattenAssistantContent;
|
|
3577
3877
|
exports.formatAbbreviatedNumber = formatAbbreviatedNumber;
|
|
3578
3878
|
exports.formatAbsoluteDate = formatAbsoluteDate;
|
|
@@ -3590,12 +3890,14 @@ exports.formatDateSlashUTC = formatDateSlashUTC;
|
|
|
3590
3890
|
exports.formatDateTime = formatDateTime;
|
|
3591
3891
|
exports.formatDateTimeAt = formatDateTimeAt;
|
|
3592
3892
|
exports.formatDateUTC = formatDateUTC;
|
|
3893
|
+
exports.formatDocName = formatDocName;
|
|
3593
3894
|
exports.formatDuration = formatDuration;
|
|
3594
3895
|
exports.formatDurationCompact = formatDurationCompact;
|
|
3595
3896
|
exports.formatDurationFromMs = formatDurationFromMs;
|
|
3596
3897
|
exports.formatDurationFromRange = formatDurationFromRange;
|
|
3597
3898
|
exports.formatDurationMMSS = formatDurationMMSS;
|
|
3598
3899
|
exports.formatEntryMonthUTC = formatEntryMonthUTC;
|
|
3900
|
+
exports.formatFileSize = formatFileSize;
|
|
3599
3901
|
exports.formatLargeNumber = formatLargeNumber;
|
|
3600
3902
|
exports.formatLegalDate = formatLegalDate;
|
|
3601
3903
|
exports.formatNumber = formatNumber;
|
|
@@ -3631,10 +3933,13 @@ exports.getCurrentPlatform = getCurrentPlatform;
|
|
|
3631
3933
|
exports.getDefaultColorForPlatform = getDefaultColorForPlatform;
|
|
3632
3934
|
exports.getDefaultIconForPlatform = getDefaultIconForPlatform;
|
|
3633
3935
|
exports.getDetailedTimeDifference = getDetailedTimeDifference;
|
|
3936
|
+
exports.getDocAncestorNodeIds = getDocAncestorNodeIds;
|
|
3937
|
+
exports.getDocSourceDefaultPath = getDocSourceDefaultPath;
|
|
3634
3938
|
exports.getDynamicIcon = getDynamicIcon;
|
|
3635
3939
|
exports.getEmbedProxyAuth = getEmbedProxyAuth;
|
|
3636
3940
|
exports.getFirstLastInitials = getFirstLastInitials;
|
|
3637
3941
|
exports.getIconComponent = getIconComponent;
|
|
3942
|
+
exports.getInitialExpandedNodeIds = getInitialExpandedNodeIds;
|
|
3638
3943
|
exports.getOSIcon = getOSIcon;
|
|
3639
3944
|
exports.getOSLabel = getOSLabel;
|
|
3640
3945
|
exports.getOSPlatformId = getOSPlatformId;
|
|
@@ -3665,6 +3970,7 @@ exports.getTrendColors = getTrendColors;
|
|
|
3665
3970
|
exports.hasGenericEmailDomain = hasGenericEmailDomain;
|
|
3666
3971
|
exports.hexToRgb = hexToRgb;
|
|
3667
3972
|
exports.isCrossOriginUrl = isCrossOriginUrl;
|
|
3973
|
+
exports.isFigmaSlidesUrl = isFigmaSlidesUrl;
|
|
3668
3974
|
exports.isGenericDomain = isGenericDomain;
|
|
3669
3975
|
exports.isGenericWebsiteDomain = isGenericWebsiteDomain;
|
|
3670
3976
|
exports.isOSPlatform = isOSPlatform;
|
|
@@ -3673,15 +3979,19 @@ exports.isValidEmailDomain = isValidEmailDomain;
|
|
|
3673
3979
|
exports.isValidToolType = isValidToolType;
|
|
3674
3980
|
exports.isWithinMinutes = isWithinMinutes;
|
|
3675
3981
|
exports.makeComposeContentUrl = makeComposeContentUrl;
|
|
3982
|
+
exports.markdownToPlainText = markdownToPlainText;
|
|
3676
3983
|
exports.nameInitials = nameInitials;
|
|
3984
|
+
exports.normalizeDocPath = normalizeDocPath;
|
|
3677
3985
|
exports.normalizeDomain = normalizeDomain;
|
|
3678
3986
|
exports.normalizeIconKey = normalizeIconKey;
|
|
3679
3987
|
exports.normalizeOSType = normalizeOSType;
|
|
3680
3988
|
exports.normalizeToolType = normalizeToolType;
|
|
3681
3989
|
exports.normalizeToolTypeWithFallback = normalizeToolTypeWithFallback;
|
|
3682
3990
|
exports.orderContentRefTypes = orderContentRefTypes;
|
|
3991
|
+
exports.parseFaqHash = parseFaqHash;
|
|
3683
3992
|
exports.parseScrollAnchor = parseScrollAnchor;
|
|
3684
3993
|
exports.parseWireCommandOverride = parseWireCommandOverride;
|
|
3994
|
+
exports.pathToNodeId = pathToNodeId;
|
|
3685
3995
|
exports.platformColors = platformColors;
|
|
3686
3996
|
exports.platformDescriptions = platformDescriptions;
|
|
3687
3997
|
exports.platformDisplayNames = platformDisplayNames;
|
|
@@ -3691,6 +4001,7 @@ exports.platformIcons = platformIcons;
|
|
|
3691
4001
|
exports.platformSlogans = platformSlogans;
|
|
3692
4002
|
exports.readLeadingDecisionFrame = readLeadingDecisionFrame;
|
|
3693
4003
|
exports.releaseTypeToBadgeColor = releaseTypeToBadgeColor;
|
|
4004
|
+
exports.resolveContentFetchPath = resolveContentFetchPath;
|
|
3694
4005
|
exports.resolveReleaseCover = resolveReleaseCover;
|
|
3695
4006
|
exports.rgbToHex = rgbToHex;
|
|
3696
4007
|
exports.sanitizeTitleForChat = sanitizeTitleForChat;
|
|
@@ -3699,9 +4010,17 @@ exports.serializeJsonLd = serializeJsonLd;
|
|
|
3699
4010
|
exports.setEmbedAuthAdapter = setEmbedAuthAdapter;
|
|
3700
4011
|
exports.setEmbedProxyAuth = setEmbedProxyAuth;
|
|
3701
4012
|
exports.shouldProxyImage = shouldProxyImage;
|
|
4013
|
+
exports.sortTreeChildren = sortTreeChildren;
|
|
3702
4014
|
exports.splitCsvEnv = splitCsvEnv;
|
|
3703
4015
|
exports.stripChatAttachmentMarkdown = stripChatAttachmentMarkdown;
|
|
4016
|
+
exports.stripFolderIndexFromPath = stripFolderIndexFromPath;
|
|
3704
4017
|
exports.stripHtml = stripHtml;
|
|
4018
|
+
exports.stripInlineMarkdown = stripInlineMarkdown;
|
|
4019
|
+
exports.toDocSlug = toDocSlug;
|
|
4020
|
+
exports.toFigmaEmbedUrl = toFigmaEmbedUrl;
|
|
4021
|
+
exports.toFigmaOriginalUrl = toFigmaOriginalUrl;
|
|
4022
|
+
exports.toGoogleSheetsEmbedUrl = toGoogleSheetsEmbedUrl;
|
|
4023
|
+
exports.toGoogleSheetsOriginalUrl = toGoogleSheetsOriginalUrl;
|
|
3705
4024
|
exports.toToolLabel = toToolLabel;
|
|
3706
4025
|
exports.transformPlatformConfigsToOptions = transformPlatformConfigsToOptions;
|
|
3707
4026
|
exports.truncateString = truncateString;
|