@athenaintel/react 0.10.34 → 0.10.36
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/README.md +27 -0
- package/dist/assets/AssetPanel.d.ts +6 -0
- package/dist/assets/AthenaAssetEmbed.d.ts +17 -0
- package/dist/assets/AthenaLayout.d.ts +13 -0
- package/dist/assets/asset-embed-messages.d.ts +31 -0
- package/dist/assets/asset-panel-store.d.ts +65 -0
- package/dist/assets/asset-panel-url.d.ts +17 -0
- package/dist/assets/use-asset-embed.d.ts +50 -0
- package/dist/auth/AthenaAuthContext.d.ts +26 -0
- package/dist/auth/AthenaAuthProvider.d.ts +43 -0
- package/dist/auth/AthenaSSOProvider.d.ts +91 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/types.d.ts +66 -0
- package/dist/chat/AthenaChat.d.ts +64 -0
- package/dist/chat/ComposerEditorContext.d.ts +30 -0
- package/dist/chat/athena-citation-links.d.ts +18 -0
- package/dist/chat/super-grouping/CollapsibleGroup.d.ts +15 -0
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +35 -0
- package/dist/chat/super-grouping/grouping-function.d.ts +19 -0
- package/dist/chat/super-grouping/tool-status-labels.d.ts +1 -0
- package/dist/chat/super-grouping/toolkit-map.d.ts +9 -0
- package/dist/chat/tiptap-composer.d.ts +7 -0
- package/dist/chat/tiptap-text.d.ts +4 -0
- package/dist/chat/tooltip-icon-button.d.ts +7 -0
- package/dist/composer/AttachmentContext.d.ts +27 -0
- package/dist/composer/ComposerAttachmentPreview.d.ts +9 -0
- package/dist/composer/ComposerDropZone.d.ts +13 -0
- package/dist/composer/ComposerQuotePreview.d.ts +12 -0
- package/dist/composer/FileUploadButton.d.ts +15 -0
- package/dist/composer/QuoteContext.d.ts +33 -0
- package/dist/composer/build-composed-message.d.ts +15 -0
- package/dist/composer/clipboard.d.ts +6 -0
- package/dist/composer/index.d.ts +18 -0
- package/dist/composer/useAppendToComposer.d.ts +14 -0
- package/dist/composer/useComposerAttachment.d.ts +14 -0
- package/dist/composer/useFileUpload.d.ts +35 -0
- package/dist/composer/useSendMessage.d.ts +21 -0
- package/dist/index.cjs +1595 -1432
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +81 -1545
- package/dist/index.js +1596 -1433
- package/dist/index.js.map +1 -1
- package/dist/lib/athena-urls.d.ts +32 -0
- package/dist/lib/posthog/capture-gate.d.ts +72 -0
- package/dist/lib/posthog/wrap-posthog-client.d.ts +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/mentions/composer-keybinds.d.ts +5 -0
- package/dist/mentions/mention-extension.d.ts +6 -0
- package/dist/mentions/mention-icons.d.ts +4 -0
- package/dist/mentions/mention-node-view.d.ts +2 -0
- package/dist/mentions/mention-suggestion-list.d.ts +14 -0
- package/dist/mentions/mention-suggestion-popup.d.ts +15 -0
- package/dist/mentions/mention-suggestions-extension.d.ts +11 -0
- package/dist/mentions/mention-types.d.ts +21 -0
- package/dist/mentions/mention-utils.d.ts +23 -0
- package/dist/mentions/scope-registry.d.ts +21 -0
- package/dist/mentions/types.d.ts +39 -0
- package/dist/mentions/use-mention-suggestions.d.ts +28 -0
- package/dist/provider/AthenaContext.d.ts +11 -0
- package/dist/provider/AthenaProvider.d.ts +86 -0
- package/dist/provider/PostHogProvider.d.ts +14 -0
- package/dist/provider/citation-links.d.ts +61 -0
- package/dist/provider/config.d.ts +20 -0
- package/dist/provider/types.d.ts +4 -0
- package/dist/runtime/auth.d.ts +45 -0
- package/dist/runtime/converter.d.ts +5 -0
- package/dist/runtime/external-message-converter.d.ts +21 -0
- package/dist/runtime/schemas.d.ts +24 -0
- package/dist/runtime/useAthenaRuntime.d.ts +47 -0
- package/dist/theme/index.d.ts +215 -0
- package/dist/threads/ThreadList.d.ts +4 -0
- package/dist/threads/adapter.d.ts +42 -0
- package/dist/threads/api.d.ts +49 -0
- package/dist/threads/index.d.ts +5 -0
- package/dist/threads/title.d.ts +4 -0
- package/dist/threads/useActiveThreadStateHydration.d.ts +14 -0
- package/dist/threads/useAthenaThreadManager.d.ts +25 -0
- package/dist/threads/useThreadTitlePolling.d.ts +14 -0
- package/dist/toolkits/index.d.ts +89 -0
- package/dist/tools/NestedPtcMessages.d.ts +14 -0
- package/dist/tools/append-document-tool-ui.d.ts +2 -0
- package/dist/tools/asset-utils.d.ts +6 -0
- package/dist/tools/auto-open-tools.d.ts +8 -0
- package/dist/tools/read-asset-tool-ui.d.ts +2 -0
- package/dist/tools/tool-fallback.d.ts +34 -0
- package/dist/tools/tool-uis.d.ts +62 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/tooltip.d.ts +7 -0
- package/package.json +9 -10
- package/dist/auth.d.ts +0 -240
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { jsx, Fragment as Fragment$1
|
|
5
|
-
import { bindExternalStoreMessage, getExternalStoreMessages, INTERNAL, useAssistantTransportRuntime, useAuiState, useAssistantRuntime, useThread, useThreadList, useRemoteThreadListRuntime, Tools, useAui, AssistantRuntimeProvider, useComposerRuntime, MessagePartPrimitive, MessagePrimitive, useScrollLock, ActionBarPrimitive, AuiIf, ActionBarMorePrimitive, ThreadPrimitive, ComposerPrimitive, ErrorPrimitive, ThreadListPrimitive, ThreadListItemPrimitive } from "@assistant-ui/react";
|
|
4
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
5
|
+
import { fromThreadMessageLike, bindExternalStoreMessage, getExternalStoreMessages, INTERNAL, useAssistantTransportRuntime, useAuiState, useAssistantRuntime, useThread, useThreadList, useRemoteThreadListRuntime, Tools, useAui, AssistantRuntimeProvider, useComposerRuntime, MessagePartPrimitive, MessagePrimitive, useScrollLock, ActionBarPrimitive, AuiIf, ActionBarMorePrimitive, ThreadPrimitive, ComposerPrimitive, ErrorPrimitive, ThreadListPrimitive, ThreadListItemPrimitive } from "@assistant-ui/react";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import React__default, { useMemo, useState, useRef, useEffect, useLayoutEffect, useContext, createContext, useCallback, useDebugValue, forwardRef, createRef, memo, createElement, version as version$1, useImperativeHandle } from "react";
|
|
8
8
|
import { A as AthenaAuthContext } from "./AthenaAuthContext-DQsdayH2.js";
|
|
@@ -60,11 +60,52 @@ const deriveWorkspaceAppUrl = ({
|
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
+
const deriveWorkspaceApiUrl = (backendUrl) => {
|
|
64
|
+
var _a2;
|
|
65
|
+
try {
|
|
66
|
+
const parsedUrl = new URL(backendUrl);
|
|
67
|
+
const match2 = parsedUrl.hostname.match(
|
|
68
|
+
/^(?<prefix>.+)--8000\.(?<domain>app\.athenaintel\.com|staging-app\.athenaintel\.com)$/
|
|
69
|
+
);
|
|
70
|
+
if (!((_a2 = match2 == null ? void 0 : match2.groups) == null ? void 0 : _a2.prefix) || !match2.groups.domain) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return `${parsedUrl.protocol}//${match2.groups.prefix}--8787.${match2.groups.domain}/api/chat`;
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
63
78
|
function getAthenaEnvironmentUrls({
|
|
64
79
|
environment = DEFAULT_ATHENA_ENVIRONMENT
|
|
65
80
|
} = {}) {
|
|
66
81
|
return ATHENA_ENVIRONMENT_URLS[environment];
|
|
67
82
|
}
|
|
83
|
+
function deriveAthenaApiUrl({
|
|
84
|
+
backendUrl
|
|
85
|
+
}) {
|
|
86
|
+
if (!backendUrl) return null;
|
|
87
|
+
const workspaceApiUrl = deriveWorkspaceApiUrl(backendUrl);
|
|
88
|
+
if (workspaceApiUrl) return workspaceApiUrl;
|
|
89
|
+
try {
|
|
90
|
+
const parsedUrl = new URL(backendUrl);
|
|
91
|
+
if (parsedUrl.hostname === "api.athenaintel.com") {
|
|
92
|
+
return ATHENA_ENVIRONMENT_URLS.production.apiUrl;
|
|
93
|
+
}
|
|
94
|
+
if (parsedUrl.hostname === "staging-api.athenaintel.com") {
|
|
95
|
+
return ATHENA_ENVIRONMENT_URLS.staging.apiUrl;
|
|
96
|
+
}
|
|
97
|
+
if (parsedUrl.hostname === "localhost" || parsedUrl.hostname === "127.0.0.1") {
|
|
98
|
+
parsedUrl.port = "8787";
|
|
99
|
+
parsedUrl.pathname = "/api/chat";
|
|
100
|
+
parsedUrl.search = "";
|
|
101
|
+
parsedUrl.hash = "";
|
|
102
|
+
return parsedUrl.toString();
|
|
103
|
+
}
|
|
104
|
+
} catch {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
68
109
|
function deriveAthenaAppUrl({
|
|
69
110
|
apiUrl,
|
|
70
111
|
backendUrl
|
|
@@ -328,501 +369,6 @@ function useParentBridge({
|
|
|
328
369
|
function useParentAuth() {
|
|
329
370
|
return useParentBridge().token;
|
|
330
371
|
}
|
|
331
|
-
function getDefaultExportFromCjs$1(x) {
|
|
332
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
333
|
-
}
|
|
334
|
-
var secureJsonParse = { exports: {} };
|
|
335
|
-
var hasRequiredSecureJsonParse;
|
|
336
|
-
function requireSecureJsonParse() {
|
|
337
|
-
if (hasRequiredSecureJsonParse) return secureJsonParse.exports;
|
|
338
|
-
hasRequiredSecureJsonParse = 1;
|
|
339
|
-
const hasBuffer = typeof Buffer !== "undefined";
|
|
340
|
-
const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
341
|
-
const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
342
|
-
function _parse2(text2, reviver, options) {
|
|
343
|
-
if (options == null) {
|
|
344
|
-
if (reviver !== null && typeof reviver === "object") {
|
|
345
|
-
options = reviver;
|
|
346
|
-
reviver = void 0;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
if (hasBuffer && Buffer.isBuffer(text2)) {
|
|
350
|
-
text2 = text2.toString();
|
|
351
|
-
}
|
|
352
|
-
if (text2 && text2.charCodeAt(0) === 65279) {
|
|
353
|
-
text2 = text2.slice(1);
|
|
354
|
-
}
|
|
355
|
-
const obj = JSON.parse(text2, reviver);
|
|
356
|
-
if (obj === null || typeof obj !== "object") {
|
|
357
|
-
return obj;
|
|
358
|
-
}
|
|
359
|
-
const protoAction = options && options.protoAction || "error";
|
|
360
|
-
const constructorAction = options && options.constructorAction || "error";
|
|
361
|
-
if (protoAction === "ignore" && constructorAction === "ignore") {
|
|
362
|
-
return obj;
|
|
363
|
-
}
|
|
364
|
-
if (protoAction !== "ignore" && constructorAction !== "ignore") {
|
|
365
|
-
if (suspectProtoRx.test(text2) === false && suspectConstructorRx.test(text2) === false) {
|
|
366
|
-
return obj;
|
|
367
|
-
}
|
|
368
|
-
} else if (protoAction !== "ignore" && constructorAction === "ignore") {
|
|
369
|
-
if (suspectProtoRx.test(text2) === false) {
|
|
370
|
-
return obj;
|
|
371
|
-
}
|
|
372
|
-
} else {
|
|
373
|
-
if (suspectConstructorRx.test(text2) === false) {
|
|
374
|
-
return obj;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return filter(obj, { protoAction, constructorAction, safe: options && options.safe });
|
|
378
|
-
}
|
|
379
|
-
function filter(obj, { protoAction = "error", constructorAction = "error", safe } = {}) {
|
|
380
|
-
let next = [obj];
|
|
381
|
-
while (next.length) {
|
|
382
|
-
const nodes = next;
|
|
383
|
-
next = [];
|
|
384
|
-
for (const node of nodes) {
|
|
385
|
-
if (protoAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
386
|
-
if (safe === true) {
|
|
387
|
-
return null;
|
|
388
|
-
} else if (protoAction === "error") {
|
|
389
|
-
throw new SyntaxError("Object contains forbidden prototype property");
|
|
390
|
-
}
|
|
391
|
-
delete node.__proto__;
|
|
392
|
-
}
|
|
393
|
-
if (constructorAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
394
|
-
if (safe === true) {
|
|
395
|
-
return null;
|
|
396
|
-
} else if (constructorAction === "error") {
|
|
397
|
-
throw new SyntaxError("Object contains forbidden prototype property");
|
|
398
|
-
}
|
|
399
|
-
delete node.constructor;
|
|
400
|
-
}
|
|
401
|
-
for (const key in node) {
|
|
402
|
-
const value = node[key];
|
|
403
|
-
if (value && typeof value === "object") {
|
|
404
|
-
next.push(value);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
return obj;
|
|
410
|
-
}
|
|
411
|
-
function parse2(text2, reviver, options) {
|
|
412
|
-
const { stackTraceLimit } = Error;
|
|
413
|
-
Error.stackTraceLimit = 0;
|
|
414
|
-
try {
|
|
415
|
-
return _parse2(text2, reviver, options);
|
|
416
|
-
} finally {
|
|
417
|
-
Error.stackTraceLimit = stackTraceLimit;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
function safeParse2(text2, reviver) {
|
|
421
|
-
const { stackTraceLimit } = Error;
|
|
422
|
-
Error.stackTraceLimit = 0;
|
|
423
|
-
try {
|
|
424
|
-
return _parse2(text2, reviver, { safe: true });
|
|
425
|
-
} catch {
|
|
426
|
-
return void 0;
|
|
427
|
-
} finally {
|
|
428
|
-
Error.stackTraceLimit = stackTraceLimit;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
secureJsonParse.exports = parse2;
|
|
432
|
-
secureJsonParse.exports.default = parse2;
|
|
433
|
-
secureJsonParse.exports.parse = parse2;
|
|
434
|
-
secureJsonParse.exports.safeParse = safeParse2;
|
|
435
|
-
secureJsonParse.exports.scan = filter;
|
|
436
|
-
return secureJsonParse.exports;
|
|
437
|
-
}
|
|
438
|
-
var secureJsonParseExports = requireSecureJsonParse();
|
|
439
|
-
const sjson = /* @__PURE__ */ getDefaultExportFromCjs$1(secureJsonParseExports);
|
|
440
|
-
function fixJson(input) {
|
|
441
|
-
const stack = ["ROOT"];
|
|
442
|
-
let lastValidIndex = -1;
|
|
443
|
-
let literalStart = null;
|
|
444
|
-
const path = [];
|
|
445
|
-
let currentKey;
|
|
446
|
-
function pushCurrentKeyToPath() {
|
|
447
|
-
if (currentKey !== void 0) {
|
|
448
|
-
path.push(JSON.parse(`"${currentKey}"`));
|
|
449
|
-
currentKey = void 0;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
function processValueStart(char, i, swapState) {
|
|
453
|
-
switch (char) {
|
|
454
|
-
case '"': {
|
|
455
|
-
lastValidIndex = i;
|
|
456
|
-
stack.pop();
|
|
457
|
-
stack.push(swapState);
|
|
458
|
-
stack.push("INSIDE_STRING");
|
|
459
|
-
pushCurrentKeyToPath();
|
|
460
|
-
break;
|
|
461
|
-
}
|
|
462
|
-
case "f":
|
|
463
|
-
case "t":
|
|
464
|
-
case "n": {
|
|
465
|
-
lastValidIndex = i;
|
|
466
|
-
literalStart = i;
|
|
467
|
-
stack.pop();
|
|
468
|
-
stack.push(swapState);
|
|
469
|
-
stack.push("INSIDE_LITERAL");
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
case "-": {
|
|
473
|
-
stack.pop();
|
|
474
|
-
stack.push(swapState);
|
|
475
|
-
stack.push("INSIDE_NUMBER");
|
|
476
|
-
pushCurrentKeyToPath();
|
|
477
|
-
break;
|
|
478
|
-
}
|
|
479
|
-
case "0":
|
|
480
|
-
case "1":
|
|
481
|
-
case "2":
|
|
482
|
-
case "3":
|
|
483
|
-
case "4":
|
|
484
|
-
case "5":
|
|
485
|
-
case "6":
|
|
486
|
-
case "7":
|
|
487
|
-
case "8":
|
|
488
|
-
case "9": {
|
|
489
|
-
lastValidIndex = i;
|
|
490
|
-
stack.pop();
|
|
491
|
-
stack.push(swapState);
|
|
492
|
-
stack.push("INSIDE_NUMBER");
|
|
493
|
-
pushCurrentKeyToPath();
|
|
494
|
-
break;
|
|
495
|
-
}
|
|
496
|
-
case "{": {
|
|
497
|
-
lastValidIndex = i;
|
|
498
|
-
stack.pop();
|
|
499
|
-
stack.push(swapState);
|
|
500
|
-
stack.push("INSIDE_OBJECT_START");
|
|
501
|
-
pushCurrentKeyToPath();
|
|
502
|
-
break;
|
|
503
|
-
}
|
|
504
|
-
case "[": {
|
|
505
|
-
lastValidIndex = i;
|
|
506
|
-
stack.pop();
|
|
507
|
-
stack.push(swapState);
|
|
508
|
-
stack.push("INSIDE_ARRAY_START");
|
|
509
|
-
pushCurrentKeyToPath();
|
|
510
|
-
break;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
function processAfterObjectValue(char, i) {
|
|
515
|
-
switch (char) {
|
|
516
|
-
case ",": {
|
|
517
|
-
stack.pop();
|
|
518
|
-
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
519
|
-
break;
|
|
520
|
-
}
|
|
521
|
-
case "}": {
|
|
522
|
-
lastValidIndex = i;
|
|
523
|
-
stack.pop();
|
|
524
|
-
currentKey = path.pop();
|
|
525
|
-
break;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
function processAfterArrayValue(char, i) {
|
|
530
|
-
switch (char) {
|
|
531
|
-
case ",": {
|
|
532
|
-
stack.pop();
|
|
533
|
-
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
534
|
-
currentKey = (Number(currentKey) + 1).toString();
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
case "]": {
|
|
538
|
-
lastValidIndex = i;
|
|
539
|
-
stack.pop();
|
|
540
|
-
currentKey = path.pop();
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
for (let i = 0; i < input.length; i++) {
|
|
546
|
-
const char = input[i];
|
|
547
|
-
const currentState = stack[stack.length - 1];
|
|
548
|
-
switch (currentState) {
|
|
549
|
-
case "ROOT":
|
|
550
|
-
processValueStart(char, i, "FINISH");
|
|
551
|
-
break;
|
|
552
|
-
case "INSIDE_OBJECT_START": {
|
|
553
|
-
switch (char) {
|
|
554
|
-
case '"': {
|
|
555
|
-
stack.pop();
|
|
556
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
557
|
-
currentKey = "";
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
case "}": {
|
|
561
|
-
lastValidIndex = i;
|
|
562
|
-
stack.pop();
|
|
563
|
-
currentKey = path.pop();
|
|
564
|
-
break;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
case "INSIDE_OBJECT_AFTER_COMMA": {
|
|
570
|
-
switch (char) {
|
|
571
|
-
case '"': {
|
|
572
|
-
stack.pop();
|
|
573
|
-
stack.push("INSIDE_OBJECT_KEY");
|
|
574
|
-
currentKey = "";
|
|
575
|
-
break;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
case "INSIDE_OBJECT_KEY": {
|
|
581
|
-
switch (char) {
|
|
582
|
-
case '"': {
|
|
583
|
-
stack.pop();
|
|
584
|
-
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
case "\\": {
|
|
588
|
-
stack.push("INSIDE_STRING_ESCAPE");
|
|
589
|
-
currentKey += char;
|
|
590
|
-
break;
|
|
591
|
-
}
|
|
592
|
-
default: {
|
|
593
|
-
currentKey += char;
|
|
594
|
-
break;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
break;
|
|
598
|
-
}
|
|
599
|
-
case "INSIDE_OBJECT_AFTER_KEY": {
|
|
600
|
-
switch (char) {
|
|
601
|
-
case ":": {
|
|
602
|
-
stack.pop();
|
|
603
|
-
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
604
|
-
break;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
break;
|
|
608
|
-
}
|
|
609
|
-
case "INSIDE_OBJECT_BEFORE_VALUE": {
|
|
610
|
-
processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
|
|
611
|
-
break;
|
|
612
|
-
}
|
|
613
|
-
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
614
|
-
processAfterObjectValue(char, i);
|
|
615
|
-
break;
|
|
616
|
-
}
|
|
617
|
-
case "INSIDE_STRING": {
|
|
618
|
-
switch (char) {
|
|
619
|
-
case '"': {
|
|
620
|
-
stack.pop();
|
|
621
|
-
lastValidIndex = i;
|
|
622
|
-
currentKey = path.pop();
|
|
623
|
-
break;
|
|
624
|
-
}
|
|
625
|
-
case "\\": {
|
|
626
|
-
stack.push("INSIDE_STRING_ESCAPE");
|
|
627
|
-
break;
|
|
628
|
-
}
|
|
629
|
-
default: {
|
|
630
|
-
lastValidIndex = i;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
break;
|
|
634
|
-
}
|
|
635
|
-
case "INSIDE_ARRAY_START": {
|
|
636
|
-
switch (char) {
|
|
637
|
-
case "]": {
|
|
638
|
-
lastValidIndex = i;
|
|
639
|
-
stack.pop();
|
|
640
|
-
currentKey = path.pop();
|
|
641
|
-
break;
|
|
642
|
-
}
|
|
643
|
-
default: {
|
|
644
|
-
lastValidIndex = i;
|
|
645
|
-
currentKey = "0";
|
|
646
|
-
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
647
|
-
break;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
break;
|
|
651
|
-
}
|
|
652
|
-
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
653
|
-
switch (char) {
|
|
654
|
-
case ",": {
|
|
655
|
-
stack.pop();
|
|
656
|
-
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
657
|
-
currentKey = (Number(currentKey) + 1).toString();
|
|
658
|
-
break;
|
|
659
|
-
}
|
|
660
|
-
case "]": {
|
|
661
|
-
lastValidIndex = i;
|
|
662
|
-
stack.pop();
|
|
663
|
-
currentKey = path.pop();
|
|
664
|
-
break;
|
|
665
|
-
}
|
|
666
|
-
default: {
|
|
667
|
-
lastValidIndex = i;
|
|
668
|
-
break;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
break;
|
|
672
|
-
}
|
|
673
|
-
case "INSIDE_ARRAY_AFTER_COMMA": {
|
|
674
|
-
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
case "INSIDE_STRING_ESCAPE": {
|
|
678
|
-
stack.pop();
|
|
679
|
-
if (stack[stack.length - 1] === "INSIDE_STRING") {
|
|
680
|
-
lastValidIndex = i;
|
|
681
|
-
} else if (stack[stack.length - 1] === "INSIDE_OBJECT_KEY") {
|
|
682
|
-
currentKey += char;
|
|
683
|
-
}
|
|
684
|
-
break;
|
|
685
|
-
}
|
|
686
|
-
case "INSIDE_NUMBER": {
|
|
687
|
-
switch (char) {
|
|
688
|
-
case "0":
|
|
689
|
-
case "1":
|
|
690
|
-
case "2":
|
|
691
|
-
case "3":
|
|
692
|
-
case "4":
|
|
693
|
-
case "5":
|
|
694
|
-
case "6":
|
|
695
|
-
case "7":
|
|
696
|
-
case "8":
|
|
697
|
-
case "9": {
|
|
698
|
-
lastValidIndex = i;
|
|
699
|
-
break;
|
|
700
|
-
}
|
|
701
|
-
case "e":
|
|
702
|
-
case "E":
|
|
703
|
-
case "-":
|
|
704
|
-
case ".": {
|
|
705
|
-
break;
|
|
706
|
-
}
|
|
707
|
-
case ",": {
|
|
708
|
-
stack.pop();
|
|
709
|
-
currentKey = path.pop();
|
|
710
|
-
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
711
|
-
processAfterArrayValue(char, i);
|
|
712
|
-
}
|
|
713
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
714
|
-
processAfterObjectValue(char, i);
|
|
715
|
-
}
|
|
716
|
-
break;
|
|
717
|
-
}
|
|
718
|
-
case "}": {
|
|
719
|
-
stack.pop();
|
|
720
|
-
currentKey = path.pop();
|
|
721
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
722
|
-
processAfterObjectValue(char, i);
|
|
723
|
-
}
|
|
724
|
-
break;
|
|
725
|
-
}
|
|
726
|
-
case "]": {
|
|
727
|
-
stack.pop();
|
|
728
|
-
currentKey = path.pop();
|
|
729
|
-
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
730
|
-
processAfterArrayValue(char, i);
|
|
731
|
-
}
|
|
732
|
-
break;
|
|
733
|
-
}
|
|
734
|
-
default: {
|
|
735
|
-
stack.pop();
|
|
736
|
-
currentKey = path.pop();
|
|
737
|
-
break;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
break;
|
|
741
|
-
}
|
|
742
|
-
case "INSIDE_LITERAL": {
|
|
743
|
-
const partialLiteral = input.substring(literalStart, i + 1);
|
|
744
|
-
if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
|
|
745
|
-
stack.pop();
|
|
746
|
-
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
747
|
-
processAfterObjectValue(char, i);
|
|
748
|
-
} else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
749
|
-
processAfterArrayValue(char, i);
|
|
750
|
-
}
|
|
751
|
-
} else {
|
|
752
|
-
lastValidIndex = i;
|
|
753
|
-
}
|
|
754
|
-
break;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
let result = input.slice(0, lastValidIndex + 1);
|
|
759
|
-
for (let i = stack.length - 1; i >= 0; i--) {
|
|
760
|
-
const state = stack[i];
|
|
761
|
-
switch (state) {
|
|
762
|
-
case "INSIDE_STRING": {
|
|
763
|
-
result += '"';
|
|
764
|
-
break;
|
|
765
|
-
}
|
|
766
|
-
case "INSIDE_OBJECT_KEY":
|
|
767
|
-
case "INSIDE_OBJECT_AFTER_KEY":
|
|
768
|
-
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
769
|
-
case "INSIDE_OBJECT_START":
|
|
770
|
-
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
771
|
-
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
772
|
-
result += "}";
|
|
773
|
-
break;
|
|
774
|
-
}
|
|
775
|
-
case "INSIDE_ARRAY_START":
|
|
776
|
-
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
777
|
-
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
778
|
-
result += "]";
|
|
779
|
-
break;
|
|
780
|
-
}
|
|
781
|
-
case "INSIDE_LITERAL": {
|
|
782
|
-
const partialLiteral = input.substring(literalStart, input.length);
|
|
783
|
-
if ("true".startsWith(partialLiteral)) {
|
|
784
|
-
result += "true".slice(partialLiteral.length);
|
|
785
|
-
} else if ("false".startsWith(partialLiteral)) {
|
|
786
|
-
result += "false".slice(partialLiteral.length);
|
|
787
|
-
} else if ("null".startsWith(partialLiteral)) {
|
|
788
|
-
result += "null".slice(partialLiteral.length);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
return [result, path];
|
|
794
|
-
}
|
|
795
|
-
const PARTIAL_JSON_OBJECT_META_SYMBOL = Symbol("aui.parse-partial-json-object.meta");
|
|
796
|
-
const parsePartialJsonObject = (json) => {
|
|
797
|
-
if (json.length === 0)
|
|
798
|
-
return {
|
|
799
|
-
[PARTIAL_JSON_OBJECT_META_SYMBOL]: { state: "partial", partialPath: [] }
|
|
800
|
-
};
|
|
801
|
-
try {
|
|
802
|
-
const res = sjson.parse(json);
|
|
803
|
-
if (typeof res !== "object" || res === null)
|
|
804
|
-
throw new Error("argsText is expected to be an object");
|
|
805
|
-
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
806
|
-
state: "complete",
|
|
807
|
-
partialPath: []
|
|
808
|
-
};
|
|
809
|
-
return res;
|
|
810
|
-
} catch {
|
|
811
|
-
try {
|
|
812
|
-
const [fixedJson, partialPath] = fixJson(json);
|
|
813
|
-
const res = sjson.parse(fixedJson);
|
|
814
|
-
if (typeof res !== "object" || res === null)
|
|
815
|
-
throw new Error("argsText is expected to be an object");
|
|
816
|
-
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
817
|
-
state: "partial",
|
|
818
|
-
partialPath
|
|
819
|
-
};
|
|
820
|
-
return res;
|
|
821
|
-
} catch {
|
|
822
|
-
return void 0;
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
372
|
const promiseWithResolvers = () => {
|
|
827
373
|
let resolve;
|
|
828
374
|
let reject;
|
|
@@ -830,9 +376,12 @@ const promiseWithResolvers = () => {
|
|
|
830
376
|
resolve = res;
|
|
831
377
|
reject = rej;
|
|
832
378
|
});
|
|
833
|
-
if (!resolve || !reject)
|
|
834
|
-
|
|
835
|
-
|
|
379
|
+
if (!resolve || !reject) throw new Error("Failed to create promise");
|
|
380
|
+
return {
|
|
381
|
+
promise,
|
|
382
|
+
resolve,
|
|
383
|
+
reject
|
|
384
|
+
};
|
|
836
385
|
};
|
|
837
386
|
const createMergeStream = () => {
|
|
838
387
|
const list2 = [];
|
|
@@ -840,77 +389,66 @@ const createMergeStream = () => {
|
|
|
840
389
|
let controller;
|
|
841
390
|
let currentPull;
|
|
842
391
|
const handlePull = (item) => {
|
|
843
|
-
if (!item.promise) {
|
|
844
|
-
item.promise =
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
currentPull = void 0;
|
|
856
|
-
}).catch((e) => {
|
|
857
|
-
console.error(e);
|
|
858
|
-
list2.forEach((item2) => {
|
|
859
|
-
item2.reader.cancel();
|
|
860
|
-
});
|
|
861
|
-
list2.length = 0;
|
|
862
|
-
controller.error(e);
|
|
863
|
-
currentPull == null ? void 0 : currentPull.reject(e);
|
|
864
|
-
currentPull = void 0;
|
|
865
|
-
});
|
|
866
|
-
}
|
|
867
|
-
};
|
|
868
|
-
const readable = new ReadableStream({
|
|
869
|
-
start(c) {
|
|
870
|
-
controller = c;
|
|
871
|
-
},
|
|
872
|
-
pull() {
|
|
873
|
-
currentPull = promiseWithResolvers();
|
|
874
|
-
list2.forEach((item) => {
|
|
875
|
-
handlePull(item);
|
|
876
|
-
});
|
|
877
|
-
return currentPull.promise;
|
|
878
|
-
},
|
|
879
|
-
cancel() {
|
|
880
|
-
list2.forEach((item) => {
|
|
881
|
-
item.reader.cancel();
|
|
392
|
+
if (!item.promise) item.promise = item.reader.read().then(({ done, value }) => {
|
|
393
|
+
item.promise = void 0;
|
|
394
|
+
if (done) {
|
|
395
|
+
list2.splice(list2.indexOf(item), 1);
|
|
396
|
+
if (sealed && list2.length === 0) controller.close();
|
|
397
|
+
} else controller.enqueue(value);
|
|
398
|
+
currentPull == null ? void 0 : currentPull.resolve();
|
|
399
|
+
currentPull = void 0;
|
|
400
|
+
}).catch((e) => {
|
|
401
|
+
console.error(e);
|
|
402
|
+
list2.forEach((item2) => {
|
|
403
|
+
item2.reader.cancel();
|
|
882
404
|
});
|
|
883
405
|
list2.length = 0;
|
|
884
|
-
|
|
885
|
-
|
|
406
|
+
controller.error(e);
|
|
407
|
+
currentPull == null ? void 0 : currentPull.reject(e);
|
|
408
|
+
currentPull = void 0;
|
|
409
|
+
});
|
|
410
|
+
};
|
|
886
411
|
return {
|
|
887
|
-
readable
|
|
412
|
+
readable: new ReadableStream({
|
|
413
|
+
start(c) {
|
|
414
|
+
controller = c;
|
|
415
|
+
},
|
|
416
|
+
pull() {
|
|
417
|
+
currentPull = promiseWithResolvers();
|
|
418
|
+
list2.forEach((item) => {
|
|
419
|
+
handlePull(item);
|
|
420
|
+
});
|
|
421
|
+
return currentPull.promise;
|
|
422
|
+
},
|
|
423
|
+
cancel() {
|
|
424
|
+
list2.forEach((item) => {
|
|
425
|
+
item.reader.cancel();
|
|
426
|
+
});
|
|
427
|
+
list2.length = 0;
|
|
428
|
+
}
|
|
429
|
+
}),
|
|
888
430
|
isSealed() {
|
|
889
431
|
return sealed;
|
|
890
432
|
},
|
|
891
433
|
seal() {
|
|
892
434
|
sealed = true;
|
|
893
|
-
if (list2.length === 0)
|
|
894
|
-
controller.close();
|
|
435
|
+
if (list2.length === 0) controller.close();
|
|
895
436
|
},
|
|
896
437
|
addStream(stream) {
|
|
897
|
-
if (sealed)
|
|
898
|
-
throw new Error("Cannot add streams after the run callback has settled.");
|
|
438
|
+
if (sealed) throw new Error("Cannot add streams after the run callback has settled.");
|
|
899
439
|
const item = { reader: stream.getReader() };
|
|
900
440
|
list2.push(item);
|
|
901
441
|
handlePull(item);
|
|
902
442
|
},
|
|
903
443
|
enqueue(chunk) {
|
|
904
|
-
this.addStream(new ReadableStream({
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
}
|
|
909
|
-
}));
|
|
444
|
+
this.addStream(new ReadableStream({ start(c) {
|
|
445
|
+
c.enqueue(chunk);
|
|
446
|
+
c.close();
|
|
447
|
+
} }));
|
|
910
448
|
}
|
|
911
449
|
};
|
|
912
450
|
};
|
|
913
|
-
|
|
451
|
+
var TextStreamControllerImpl = class {
|
|
914
452
|
constructor(controller) {
|
|
915
453
|
__publicField(this, "_controller");
|
|
916
454
|
__publicField(this, "_isClosed", false);
|
|
@@ -929,8 +467,7 @@ class TextStreamControllerImpl {
|
|
|
929
467
|
return this;
|
|
930
468
|
}
|
|
931
469
|
close() {
|
|
932
|
-
if (this._isClosed)
|
|
933
|
-
return;
|
|
470
|
+
if (this._isClosed) return;
|
|
934
471
|
this._isClosed = true;
|
|
935
472
|
this._controller.enqueue({
|
|
936
473
|
type: "part-finish",
|
|
@@ -938,7 +475,7 @@ class TextStreamControllerImpl {
|
|
|
938
475
|
});
|
|
939
476
|
this._controller.close();
|
|
940
477
|
}
|
|
941
|
-
}
|
|
478
|
+
};
|
|
942
479
|
const createTextStream = (readable) => {
|
|
943
480
|
return new ReadableStream({
|
|
944
481
|
start(c) {
|
|
@@ -957,51 +494,42 @@ const createTextStream = (readable) => {
|
|
|
957
494
|
};
|
|
958
495
|
const createTextStreamController = () => {
|
|
959
496
|
let controller;
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
}
|
|
964
|
-
});
|
|
965
|
-
return [stream, controller];
|
|
497
|
+
return [createTextStream({ start(c) {
|
|
498
|
+
controller = c;
|
|
499
|
+
} }), controller];
|
|
966
500
|
};
|
|
967
|
-
|
|
501
|
+
var ToolCallStreamControllerImpl = class {
|
|
968
502
|
constructor(_controller) {
|
|
969
503
|
__publicField(this, "_controller");
|
|
970
504
|
__publicField(this, "_isClosed", false);
|
|
971
505
|
__publicField(this, "_mergeTask");
|
|
972
506
|
__publicField(this, "_argsTextController");
|
|
973
507
|
this._controller = _controller;
|
|
974
|
-
const stream = createTextStream({
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
}
|
|
978
|
-
});
|
|
508
|
+
const stream = createTextStream({ start: (c) => {
|
|
509
|
+
this._argsTextController = c;
|
|
510
|
+
} });
|
|
979
511
|
let hasArgsText = false;
|
|
980
|
-
this._mergeTask = stream.pipeTo(new WritableStream({
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
break;
|
|
1000
|
-
default:
|
|
1001
|
-
throw new Error(`Unexpected chunk type: ${chunk.type}`);
|
|
1002
|
-
}
|
|
512
|
+
this._mergeTask = stream.pipeTo(new WritableStream({ write: (chunk) => {
|
|
513
|
+
switch (chunk.type) {
|
|
514
|
+
case "text-delta":
|
|
515
|
+
hasArgsText = true;
|
|
516
|
+
this._controller.enqueue(chunk);
|
|
517
|
+
break;
|
|
518
|
+
case "part-finish":
|
|
519
|
+
if (!hasArgsText) this._controller.enqueue({
|
|
520
|
+
type: "text-delta",
|
|
521
|
+
textDelta: "{}",
|
|
522
|
+
path: []
|
|
523
|
+
});
|
|
524
|
+
this._controller.enqueue({
|
|
525
|
+
type: "tool-call-args-text-finish",
|
|
526
|
+
path: []
|
|
527
|
+
});
|
|
528
|
+
break;
|
|
529
|
+
default:
|
|
530
|
+
throw new Error(`Unexpected chunk type: ${chunk.type}`);
|
|
1003
531
|
}
|
|
1004
|
-
}));
|
|
532
|
+
} }));
|
|
1005
533
|
}
|
|
1006
534
|
get argsText() {
|
|
1007
535
|
return this._argsTextController;
|
|
@@ -1020,8 +548,7 @@ class ToolCallStreamControllerImpl {
|
|
|
1020
548
|
});
|
|
1021
549
|
}
|
|
1022
550
|
async close() {
|
|
1023
|
-
if (this._isClosed)
|
|
1024
|
-
return;
|
|
551
|
+
if (this._isClosed) return;
|
|
1025
552
|
this._isClosed = true;
|
|
1026
553
|
this._argsTextController.close();
|
|
1027
554
|
await this._mergeTask;
|
|
@@ -1031,7 +558,7 @@ class ToolCallStreamControllerImpl {
|
|
|
1031
558
|
});
|
|
1032
559
|
this._controller.close();
|
|
1033
560
|
}
|
|
1034
|
-
}
|
|
561
|
+
};
|
|
1035
562
|
const createToolCallStream = (readable) => {
|
|
1036
563
|
return new ReadableStream({
|
|
1037
564
|
start(c) {
|
|
@@ -1050,85 +577,72 @@ const createToolCallStream = (readable) => {
|
|
|
1050
577
|
};
|
|
1051
578
|
const createToolCallStreamController = () => {
|
|
1052
579
|
let controller;
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
}
|
|
1057
|
-
});
|
|
1058
|
-
return [stream, controller];
|
|
580
|
+
return [createToolCallStream({ start(c) {
|
|
581
|
+
controller = c;
|
|
582
|
+
} }), controller];
|
|
1059
583
|
};
|
|
1060
|
-
|
|
584
|
+
var Counter = class {
|
|
1061
585
|
constructor() {
|
|
1062
586
|
__publicField(this, "value", -1);
|
|
1063
587
|
}
|
|
1064
588
|
up() {
|
|
1065
589
|
return ++this.value;
|
|
1066
590
|
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
591
|
+
};
|
|
592
|
+
var PathAppendEncoder = class extends TransformStream {
|
|
1069
593
|
constructor(idx) {
|
|
1070
|
-
super({
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
}
|
|
1077
|
-
});
|
|
594
|
+
super({ transform(chunk, controller) {
|
|
595
|
+
controller.enqueue({
|
|
596
|
+
...chunk,
|
|
597
|
+
path: [idx, ...chunk.path]
|
|
598
|
+
});
|
|
599
|
+
} });
|
|
1078
600
|
}
|
|
1079
|
-
}
|
|
1080
|
-
class
|
|
601
|
+
};
|
|
602
|
+
(class extends TransformStream {
|
|
1081
603
|
constructor(idx) {
|
|
1082
|
-
super({
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
});
|
|
1091
|
-
}
|
|
1092
|
-
});
|
|
604
|
+
super({ transform(chunk, controller) {
|
|
605
|
+
const { path: [idx2, ...path] } = chunk;
|
|
606
|
+
if (idx !== idx2) throw new Error(`Path mismatch: expected ${idx}, got ${idx2}`);
|
|
607
|
+
controller.enqueue({
|
|
608
|
+
...chunk,
|
|
609
|
+
path
|
|
610
|
+
});
|
|
611
|
+
} });
|
|
1093
612
|
}
|
|
1094
|
-
}
|
|
1095
|
-
|
|
613
|
+
});
|
|
614
|
+
var PathMergeEncoder = class extends TransformStream {
|
|
1096
615
|
constructor(counter) {
|
|
1097
616
|
const innerCounter = new Counter();
|
|
1098
617
|
const mapping = /* @__PURE__ */ new Map();
|
|
1099
|
-
super({
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
if (idx === void 0) {
|
|
1106
|
-
controller.enqueue(chunk);
|
|
1107
|
-
return;
|
|
1108
|
-
}
|
|
1109
|
-
const mappedIdx = mapping.get(idx);
|
|
1110
|
-
if (mappedIdx === void 0)
|
|
1111
|
-
throw new Error("Path not found");
|
|
1112
|
-
controller.enqueue({
|
|
1113
|
-
...chunk,
|
|
1114
|
-
path: [mappedIdx, ...path]
|
|
1115
|
-
});
|
|
618
|
+
super({ transform(chunk, controller) {
|
|
619
|
+
if (chunk.type === "part-start" && chunk.path.length === 0) mapping.set(innerCounter.up(), counter.up());
|
|
620
|
+
const [idx, ...path] = chunk.path;
|
|
621
|
+
if (idx === void 0) {
|
|
622
|
+
controller.enqueue(chunk);
|
|
623
|
+
return;
|
|
1116
624
|
}
|
|
1117
|
-
|
|
625
|
+
const mappedIdx = mapping.get(idx);
|
|
626
|
+
if (mappedIdx === void 0) throw new Error("Path not found");
|
|
627
|
+
controller.enqueue({
|
|
628
|
+
...chunk,
|
|
629
|
+
path: [mappedIdx, ...path]
|
|
630
|
+
});
|
|
631
|
+
} });
|
|
1118
632
|
}
|
|
1119
|
-
}
|
|
633
|
+
};
|
|
1120
634
|
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
1121
635
|
return (size2 = defaultSize) => {
|
|
1122
636
|
let id = "";
|
|
1123
637
|
let i = size2 | 0;
|
|
1124
|
-
while (i--) {
|
|
638
|
+
while (i-- > 0) {
|
|
1125
639
|
id += alphabet[Math.random() * alphabet.length | 0];
|
|
1126
640
|
}
|
|
1127
641
|
return id;
|
|
1128
642
|
};
|
|
1129
643
|
};
|
|
1130
644
|
const generateId = customAlphabet("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 7);
|
|
1131
|
-
|
|
645
|
+
var AssistantStreamControllerImpl = class AssistantStreamControllerImpl2 {
|
|
1132
646
|
constructor(state) {
|
|
1133
647
|
__publicField(this, "_state");
|
|
1134
648
|
__publicField(this, "_parentId");
|
|
@@ -1163,32 +677,30 @@ class AssistantStreamControllerImpl {
|
|
|
1163
677
|
}
|
|
1164
678
|
appendText(textDelta) {
|
|
1165
679
|
var _a2;
|
|
1166
|
-
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "text") {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}
|
|
680
|
+
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "text" || this._state.append.parentId !== this._parentId) this._state.append = {
|
|
681
|
+
kind: "text",
|
|
682
|
+
parentId: this._parentId,
|
|
683
|
+
controller: this.addTextPart()
|
|
684
|
+
};
|
|
1172
685
|
this._state.append.controller.append(textDelta);
|
|
1173
686
|
}
|
|
1174
687
|
appendReasoning(textDelta) {
|
|
1175
688
|
var _a2;
|
|
1176
|
-
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "reasoning") {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
}
|
|
689
|
+
if (((_a2 = this._state.append) == null ? void 0 : _a2.kind) !== "reasoning" || this._state.append.parentId !== this._parentId) this._state.append = {
|
|
690
|
+
kind: "reasoning",
|
|
691
|
+
parentId: this._parentId,
|
|
692
|
+
controller: this.addReasoningPart()
|
|
693
|
+
};
|
|
1182
694
|
this._state.append.controller.append(textDelta);
|
|
1183
695
|
}
|
|
1184
696
|
addTextPart() {
|
|
1185
697
|
const [stream, controller] = createTextStreamController();
|
|
1186
|
-
this._addPart({ type: "text" }, stream);
|
|
698
|
+
this._addPart(this._withParentIdOption({ type: "text" }), stream);
|
|
1187
699
|
return controller;
|
|
1188
700
|
}
|
|
1189
701
|
addReasoningPart() {
|
|
1190
702
|
const [stream, controller] = createTextStreamController();
|
|
1191
|
-
this._addPart({ type: "reasoning" }, stream);
|
|
703
|
+
this._addPart(this._withParentIdOption({ type: "reasoning" }), stream);
|
|
1192
704
|
return controller;
|
|
1193
705
|
}
|
|
1194
706
|
addToolCallPart(options) {
|
|
@@ -1210,23 +722,24 @@ class AssistantStreamControllerImpl {
|
|
|
1210
722
|
controller.argsText.append(JSON.stringify(opt.args));
|
|
1211
723
|
controller.argsText.close();
|
|
1212
724
|
}
|
|
1213
|
-
if (opt.response !== void 0)
|
|
1214
|
-
controller.setResponse(opt.response);
|
|
1215
|
-
}
|
|
725
|
+
if (opt.response !== void 0) controller.setResponse(opt.response);
|
|
1216
726
|
return controller;
|
|
1217
727
|
}
|
|
1218
728
|
_finishedPartStream() {
|
|
1219
|
-
return new ReadableStream({
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
}
|
|
1224
|
-
|
|
729
|
+
return new ReadableStream({ start(controller) {
|
|
730
|
+
controller.enqueue({
|
|
731
|
+
type: "part-finish",
|
|
732
|
+
path: []
|
|
733
|
+
});
|
|
734
|
+
controller.close();
|
|
735
|
+
} });
|
|
1225
736
|
}
|
|
1226
737
|
_withParentIdOption(options) {
|
|
1227
|
-
if (!this._parentId)
|
|
1228
|
-
|
|
1229
|
-
|
|
738
|
+
if (!this._parentId) return options;
|
|
739
|
+
return {
|
|
740
|
+
...options,
|
|
741
|
+
parentId: this._parentId
|
|
742
|
+
};
|
|
1230
743
|
}
|
|
1231
744
|
appendSource(options) {
|
|
1232
745
|
this._addPart(this._withParentIdOption(options), this._finishedPartStream());
|
|
@@ -1239,12 +752,10 @@ class AssistantStreamControllerImpl {
|
|
|
1239
752
|
}
|
|
1240
753
|
enqueue(chunk) {
|
|
1241
754
|
this._state.merger.enqueue(chunk);
|
|
1242
|
-
if (chunk.type === "part-start" && chunk.path.length === 0)
|
|
1243
|
-
this._state.contentCounter.up();
|
|
1244
|
-
}
|
|
755
|
+
if (chunk.type === "part-start" && chunk.path.length === 0) this._state.contentCounter.up();
|
|
1245
756
|
}
|
|
1246
757
|
withParentId(parentId) {
|
|
1247
|
-
const controller = new
|
|
758
|
+
const controller = new AssistantStreamControllerImpl2(this._state);
|
|
1248
759
|
controller._parentId = parentId;
|
|
1249
760
|
return controller;
|
|
1250
761
|
}
|
|
@@ -1254,30 +765,449 @@ class AssistantStreamControllerImpl {
|
|
|
1254
765
|
this._state.merger.seal();
|
|
1255
766
|
(_d = (_c = this._state).closeSubscriber) == null ? void 0 : _d.call(_c);
|
|
1256
767
|
}
|
|
1257
|
-
}
|
|
768
|
+
};
|
|
1258
769
|
function createAssistantStream(callback) {
|
|
1259
770
|
const controller = new AssistantStreamControllerImpl();
|
|
1260
771
|
const runTask = async () => {
|
|
1261
772
|
try {
|
|
1262
773
|
await callback(controller);
|
|
1263
774
|
} catch (e) {
|
|
1264
|
-
if (!controller.__internal_isClosed) {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
});
|
|
1270
|
-
}
|
|
775
|
+
if (!controller.__internal_isClosed) controller.enqueue({
|
|
776
|
+
type: "error",
|
|
777
|
+
path: [],
|
|
778
|
+
error: String(e)
|
|
779
|
+
});
|
|
1271
780
|
throw e;
|
|
1272
781
|
} finally {
|
|
1273
|
-
if (!controller.__internal_isClosed)
|
|
1274
|
-
controller.close();
|
|
1275
|
-
}
|
|
782
|
+
if (!controller.__internal_isClosed) controller.close();
|
|
1276
783
|
}
|
|
1277
784
|
};
|
|
1278
785
|
runTask();
|
|
1279
786
|
return controller.__internal_getReadable();
|
|
1280
787
|
}
|
|
788
|
+
function fixJson(input) {
|
|
789
|
+
const stack = ["ROOT"];
|
|
790
|
+
let lastValidIndex = -1;
|
|
791
|
+
let literalStart = null;
|
|
792
|
+
const path = [];
|
|
793
|
+
let currentKey;
|
|
794
|
+
function pushCurrentKeyToPath() {
|
|
795
|
+
if (currentKey !== void 0) {
|
|
796
|
+
path.push(JSON.parse(`"${currentKey}"`));
|
|
797
|
+
currentKey = void 0;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function processValueStart(char, i, swapState) {
|
|
801
|
+
switch (char) {
|
|
802
|
+
case '"':
|
|
803
|
+
lastValidIndex = i;
|
|
804
|
+
stack.pop();
|
|
805
|
+
stack.push(swapState);
|
|
806
|
+
stack.push("INSIDE_STRING");
|
|
807
|
+
pushCurrentKeyToPath();
|
|
808
|
+
break;
|
|
809
|
+
case "f":
|
|
810
|
+
case "t":
|
|
811
|
+
case "n":
|
|
812
|
+
lastValidIndex = i;
|
|
813
|
+
literalStart = i;
|
|
814
|
+
stack.pop();
|
|
815
|
+
stack.push(swapState);
|
|
816
|
+
stack.push("INSIDE_LITERAL");
|
|
817
|
+
break;
|
|
818
|
+
case "-":
|
|
819
|
+
stack.pop();
|
|
820
|
+
stack.push(swapState);
|
|
821
|
+
stack.push("INSIDE_NUMBER");
|
|
822
|
+
pushCurrentKeyToPath();
|
|
823
|
+
break;
|
|
824
|
+
case "0":
|
|
825
|
+
case "1":
|
|
826
|
+
case "2":
|
|
827
|
+
case "3":
|
|
828
|
+
case "4":
|
|
829
|
+
case "5":
|
|
830
|
+
case "6":
|
|
831
|
+
case "7":
|
|
832
|
+
case "8":
|
|
833
|
+
case "9":
|
|
834
|
+
lastValidIndex = i;
|
|
835
|
+
stack.pop();
|
|
836
|
+
stack.push(swapState);
|
|
837
|
+
stack.push("INSIDE_NUMBER");
|
|
838
|
+
pushCurrentKeyToPath();
|
|
839
|
+
break;
|
|
840
|
+
case "{":
|
|
841
|
+
lastValidIndex = i;
|
|
842
|
+
stack.pop();
|
|
843
|
+
stack.push(swapState);
|
|
844
|
+
stack.push("INSIDE_OBJECT_START");
|
|
845
|
+
pushCurrentKeyToPath();
|
|
846
|
+
break;
|
|
847
|
+
case "[":
|
|
848
|
+
lastValidIndex = i;
|
|
849
|
+
stack.pop();
|
|
850
|
+
stack.push(swapState);
|
|
851
|
+
stack.push("INSIDE_ARRAY_START");
|
|
852
|
+
pushCurrentKeyToPath();
|
|
853
|
+
break;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
function processAfterObjectValue(char, i) {
|
|
857
|
+
switch (char) {
|
|
858
|
+
case ",":
|
|
859
|
+
stack.pop();
|
|
860
|
+
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
861
|
+
break;
|
|
862
|
+
case "}":
|
|
863
|
+
lastValidIndex = i;
|
|
864
|
+
stack.pop();
|
|
865
|
+
currentKey = path.pop();
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
function processAfterArrayValue(char, i) {
|
|
870
|
+
switch (char) {
|
|
871
|
+
case ",":
|
|
872
|
+
stack.pop();
|
|
873
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
874
|
+
currentKey = (Number(currentKey) + 1).toString();
|
|
875
|
+
break;
|
|
876
|
+
case "]":
|
|
877
|
+
lastValidIndex = i;
|
|
878
|
+
stack.pop();
|
|
879
|
+
currentKey = path.pop();
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
for (let i = 0; i < input.length; i++) {
|
|
884
|
+
const char = input[i];
|
|
885
|
+
switch (stack[stack.length - 1]) {
|
|
886
|
+
case "ROOT":
|
|
887
|
+
processValueStart(char, i, "FINISH");
|
|
888
|
+
break;
|
|
889
|
+
case "INSIDE_OBJECT_START":
|
|
890
|
+
switch (char) {
|
|
891
|
+
case '"':
|
|
892
|
+
stack.pop();
|
|
893
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
894
|
+
currentKey = "";
|
|
895
|
+
break;
|
|
896
|
+
case "}":
|
|
897
|
+
lastValidIndex = i;
|
|
898
|
+
stack.pop();
|
|
899
|
+
currentKey = path.pop();
|
|
900
|
+
break;
|
|
901
|
+
}
|
|
902
|
+
break;
|
|
903
|
+
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
904
|
+
switch (char) {
|
|
905
|
+
case '"':
|
|
906
|
+
stack.pop();
|
|
907
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
908
|
+
currentKey = "";
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
break;
|
|
912
|
+
case "INSIDE_OBJECT_KEY":
|
|
913
|
+
switch (char) {
|
|
914
|
+
case '"':
|
|
915
|
+
stack.pop();
|
|
916
|
+
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
917
|
+
break;
|
|
918
|
+
case "\\":
|
|
919
|
+
stack.push("INSIDE_STRING_ESCAPE");
|
|
920
|
+
currentKey += char;
|
|
921
|
+
break;
|
|
922
|
+
default:
|
|
923
|
+
currentKey += char;
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
break;
|
|
927
|
+
case "INSIDE_OBJECT_AFTER_KEY":
|
|
928
|
+
switch (char) {
|
|
929
|
+
case ":":
|
|
930
|
+
stack.pop();
|
|
931
|
+
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
break;
|
|
935
|
+
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
936
|
+
processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
|
|
937
|
+
break;
|
|
938
|
+
case "INSIDE_OBJECT_AFTER_VALUE":
|
|
939
|
+
processAfterObjectValue(char, i);
|
|
940
|
+
break;
|
|
941
|
+
case "INSIDE_STRING":
|
|
942
|
+
switch (char) {
|
|
943
|
+
case '"':
|
|
944
|
+
stack.pop();
|
|
945
|
+
lastValidIndex = i;
|
|
946
|
+
currentKey = path.pop();
|
|
947
|
+
break;
|
|
948
|
+
case "\\":
|
|
949
|
+
stack.push("INSIDE_STRING_ESCAPE");
|
|
950
|
+
break;
|
|
951
|
+
default:
|
|
952
|
+
lastValidIndex = i;
|
|
953
|
+
}
|
|
954
|
+
break;
|
|
955
|
+
case "INSIDE_ARRAY_START":
|
|
956
|
+
switch (char) {
|
|
957
|
+
case "]":
|
|
958
|
+
lastValidIndex = i;
|
|
959
|
+
stack.pop();
|
|
960
|
+
currentKey = path.pop();
|
|
961
|
+
break;
|
|
962
|
+
default:
|
|
963
|
+
lastValidIndex = i;
|
|
964
|
+
currentKey = "0";
|
|
965
|
+
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
966
|
+
break;
|
|
967
|
+
}
|
|
968
|
+
break;
|
|
969
|
+
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
970
|
+
switch (char) {
|
|
971
|
+
case ",":
|
|
972
|
+
stack.pop();
|
|
973
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
974
|
+
currentKey = (Number(currentKey) + 1).toString();
|
|
975
|
+
break;
|
|
976
|
+
case "]":
|
|
977
|
+
lastValidIndex = i;
|
|
978
|
+
stack.pop();
|
|
979
|
+
currentKey = path.pop();
|
|
980
|
+
break;
|
|
981
|
+
default:
|
|
982
|
+
lastValidIndex = i;
|
|
983
|
+
break;
|
|
984
|
+
}
|
|
985
|
+
break;
|
|
986
|
+
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
987
|
+
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
988
|
+
break;
|
|
989
|
+
case "INSIDE_STRING_ESCAPE":
|
|
990
|
+
stack.pop();
|
|
991
|
+
if (stack[stack.length - 1] === "INSIDE_STRING") lastValidIndex = i;
|
|
992
|
+
else if (stack[stack.length - 1] === "INSIDE_OBJECT_KEY") currentKey += char;
|
|
993
|
+
break;
|
|
994
|
+
case "INSIDE_NUMBER":
|
|
995
|
+
switch (char) {
|
|
996
|
+
case "0":
|
|
997
|
+
case "1":
|
|
998
|
+
case "2":
|
|
999
|
+
case "3":
|
|
1000
|
+
case "4":
|
|
1001
|
+
case "5":
|
|
1002
|
+
case "6":
|
|
1003
|
+
case "7":
|
|
1004
|
+
case "8":
|
|
1005
|
+
case "9":
|
|
1006
|
+
lastValidIndex = i;
|
|
1007
|
+
break;
|
|
1008
|
+
case "e":
|
|
1009
|
+
case "E":
|
|
1010
|
+
case "-":
|
|
1011
|
+
case ".":
|
|
1012
|
+
break;
|
|
1013
|
+
case ",":
|
|
1014
|
+
stack.pop();
|
|
1015
|
+
currentKey = path.pop();
|
|
1016
|
+
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
1017
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
|
|
1018
|
+
break;
|
|
1019
|
+
case "}":
|
|
1020
|
+
stack.pop();
|
|
1021
|
+
currentKey = path.pop();
|
|
1022
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
|
|
1023
|
+
break;
|
|
1024
|
+
case "]":
|
|
1025
|
+
stack.pop();
|
|
1026
|
+
currentKey = path.pop();
|
|
1027
|
+
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
1028
|
+
break;
|
|
1029
|
+
default:
|
|
1030
|
+
stack.pop();
|
|
1031
|
+
currentKey = path.pop();
|
|
1032
|
+
break;
|
|
1033
|
+
}
|
|
1034
|
+
break;
|
|
1035
|
+
case "INSIDE_LITERAL": {
|
|
1036
|
+
const partialLiteral = input.substring(literalStart, i + 1);
|
|
1037
|
+
if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
|
|
1038
|
+
stack.pop();
|
|
1039
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") processAfterObjectValue(char, i);
|
|
1040
|
+
else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") processAfterArrayValue(char, i);
|
|
1041
|
+
} else lastValidIndex = i;
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
let result = input.slice(0, lastValidIndex + 1);
|
|
1047
|
+
for (let i = stack.length - 1; i >= 0; i--) switch (stack[i]) {
|
|
1048
|
+
case "INSIDE_STRING":
|
|
1049
|
+
result += '"';
|
|
1050
|
+
break;
|
|
1051
|
+
case "INSIDE_OBJECT_KEY":
|
|
1052
|
+
case "INSIDE_OBJECT_AFTER_KEY":
|
|
1053
|
+
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
1054
|
+
case "INSIDE_OBJECT_START":
|
|
1055
|
+
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
1056
|
+
case "INSIDE_OBJECT_AFTER_VALUE":
|
|
1057
|
+
result += "}";
|
|
1058
|
+
break;
|
|
1059
|
+
case "INSIDE_ARRAY_START":
|
|
1060
|
+
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
1061
|
+
case "INSIDE_ARRAY_AFTER_VALUE":
|
|
1062
|
+
result += "]";
|
|
1063
|
+
break;
|
|
1064
|
+
case "INSIDE_LITERAL": {
|
|
1065
|
+
const partialLiteral = input.substring(literalStart, input.length);
|
|
1066
|
+
if ("true".startsWith(partialLiteral)) result += "true".slice(partialLiteral.length);
|
|
1067
|
+
else if ("false".startsWith(partialLiteral)) result += "false".slice(partialLiteral.length);
|
|
1068
|
+
else if ("null".startsWith(partialLiteral)) result += "null".slice(partialLiteral.length);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
return [result, path];
|
|
1072
|
+
}
|
|
1073
|
+
function getDefaultExportFromCjs$1(x) {
|
|
1074
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1075
|
+
}
|
|
1076
|
+
var secureJsonParse = { exports: {} };
|
|
1077
|
+
var hasRequiredSecureJsonParse;
|
|
1078
|
+
function requireSecureJsonParse() {
|
|
1079
|
+
if (hasRequiredSecureJsonParse) return secureJsonParse.exports;
|
|
1080
|
+
hasRequiredSecureJsonParse = 1;
|
|
1081
|
+
const hasBuffer = typeof Buffer !== "undefined";
|
|
1082
|
+
const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
1083
|
+
const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
1084
|
+
function _parse2(text2, reviver, options) {
|
|
1085
|
+
if (options == null) {
|
|
1086
|
+
if (reviver !== null && typeof reviver === "object") {
|
|
1087
|
+
options = reviver;
|
|
1088
|
+
reviver = void 0;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
if (hasBuffer && Buffer.isBuffer(text2)) {
|
|
1092
|
+
text2 = text2.toString();
|
|
1093
|
+
}
|
|
1094
|
+
if (text2 && text2.charCodeAt(0) === 65279) {
|
|
1095
|
+
text2 = text2.slice(1);
|
|
1096
|
+
}
|
|
1097
|
+
const obj = JSON.parse(text2, reviver);
|
|
1098
|
+
if (obj === null || typeof obj !== "object") {
|
|
1099
|
+
return obj;
|
|
1100
|
+
}
|
|
1101
|
+
const protoAction = options && options.protoAction || "error";
|
|
1102
|
+
const constructorAction = options && options.constructorAction || "error";
|
|
1103
|
+
if (protoAction === "ignore" && constructorAction === "ignore") {
|
|
1104
|
+
return obj;
|
|
1105
|
+
}
|
|
1106
|
+
if (protoAction !== "ignore" && constructorAction !== "ignore") {
|
|
1107
|
+
if (suspectProtoRx.test(text2) === false && suspectConstructorRx.test(text2) === false) {
|
|
1108
|
+
return obj;
|
|
1109
|
+
}
|
|
1110
|
+
} else if (protoAction !== "ignore" && constructorAction === "ignore") {
|
|
1111
|
+
if (suspectProtoRx.test(text2) === false) {
|
|
1112
|
+
return obj;
|
|
1113
|
+
}
|
|
1114
|
+
} else {
|
|
1115
|
+
if (suspectConstructorRx.test(text2) === false) {
|
|
1116
|
+
return obj;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
return filter(obj, { protoAction, constructorAction, safe: options && options.safe });
|
|
1120
|
+
}
|
|
1121
|
+
function filter(obj, { protoAction = "error", constructorAction = "error", safe } = {}) {
|
|
1122
|
+
let next = [obj];
|
|
1123
|
+
while (next.length) {
|
|
1124
|
+
const nodes = next;
|
|
1125
|
+
next = [];
|
|
1126
|
+
for (const node of nodes) {
|
|
1127
|
+
if (protoAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
1128
|
+
if (safe === true) {
|
|
1129
|
+
return null;
|
|
1130
|
+
} else if (protoAction === "error") {
|
|
1131
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1132
|
+
}
|
|
1133
|
+
delete node.__proto__;
|
|
1134
|
+
}
|
|
1135
|
+
if (constructorAction !== "ignore" && Object.prototype.hasOwnProperty.call(node, "constructor") && node.constructor !== null && typeof node.constructor === "object" && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
1136
|
+
if (safe === true) {
|
|
1137
|
+
return null;
|
|
1138
|
+
} else if (constructorAction === "error") {
|
|
1139
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1140
|
+
}
|
|
1141
|
+
delete node.constructor;
|
|
1142
|
+
}
|
|
1143
|
+
for (const key in node) {
|
|
1144
|
+
const value = node[key];
|
|
1145
|
+
if (value && typeof value === "object") {
|
|
1146
|
+
next.push(value);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return obj;
|
|
1152
|
+
}
|
|
1153
|
+
function parse2(text2, reviver, options) {
|
|
1154
|
+
const { stackTraceLimit } = Error;
|
|
1155
|
+
Error.stackTraceLimit = 0;
|
|
1156
|
+
try {
|
|
1157
|
+
return _parse2(text2, reviver, options);
|
|
1158
|
+
} finally {
|
|
1159
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function safeParse2(text2, reviver) {
|
|
1163
|
+
const { stackTraceLimit } = Error;
|
|
1164
|
+
Error.stackTraceLimit = 0;
|
|
1165
|
+
try {
|
|
1166
|
+
return _parse2(text2, reviver, { safe: true });
|
|
1167
|
+
} catch {
|
|
1168
|
+
return void 0;
|
|
1169
|
+
} finally {
|
|
1170
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
secureJsonParse.exports = parse2;
|
|
1174
|
+
secureJsonParse.exports.default = parse2;
|
|
1175
|
+
secureJsonParse.exports.parse = parse2;
|
|
1176
|
+
secureJsonParse.exports.safeParse = safeParse2;
|
|
1177
|
+
secureJsonParse.exports.scan = filter;
|
|
1178
|
+
return secureJsonParse.exports;
|
|
1179
|
+
}
|
|
1180
|
+
var secureJsonParseExports = requireSecureJsonParse();
|
|
1181
|
+
const sjson = /* @__PURE__ */ getDefaultExportFromCjs$1(secureJsonParseExports);
|
|
1182
|
+
const PARTIAL_JSON_OBJECT_META_SYMBOL = Symbol("aui.parse-partial-json-object.meta");
|
|
1183
|
+
const parsePartialJsonObject = (json) => {
|
|
1184
|
+
if (json.length === 0) return { [PARTIAL_JSON_OBJECT_META_SYMBOL]: {
|
|
1185
|
+
state: "partial",
|
|
1186
|
+
partialPath: []
|
|
1187
|
+
} };
|
|
1188
|
+
try {
|
|
1189
|
+
const res = sjson.parse(json);
|
|
1190
|
+
if (typeof res !== "object" || res === null) throw new Error("argsText is expected to be an object");
|
|
1191
|
+
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
1192
|
+
state: "complete",
|
|
1193
|
+
partialPath: []
|
|
1194
|
+
};
|
|
1195
|
+
return res;
|
|
1196
|
+
} catch {
|
|
1197
|
+
try {
|
|
1198
|
+
const [fixedJson, partialPath] = fixJson(json);
|
|
1199
|
+
const res = sjson.parse(fixedJson);
|
|
1200
|
+
if (typeof res !== "object" || res === null) throw new Error("argsText is expected to be an object");
|
|
1201
|
+
res[PARTIAL_JSON_OBJECT_META_SYMBOL] = {
|
|
1202
|
+
state: "partial",
|
|
1203
|
+
partialPath
|
|
1204
|
+
};
|
|
1205
|
+
return res;
|
|
1206
|
+
} catch {
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1281
1211
|
const isArray = Array.isArray;
|
|
1282
1212
|
const resolveClassValue = (value) => {
|
|
1283
1213
|
if (!value) return "";
|
|
@@ -9026,7 +8956,7 @@ const parseLangGraphState = (state) => {
|
|
|
9026
8956
|
}
|
|
9027
8957
|
return result;
|
|
9028
8958
|
};
|
|
9029
|
-
const {
|
|
8959
|
+
const { getAutoStatus } = INTERNAL;
|
|
9030
8960
|
const joinExternalMessages = (messages) => {
|
|
9031
8961
|
var _a2;
|
|
9032
8962
|
const assistantMessage = {
|
|
@@ -9281,20 +9211,16 @@ const contentToParts = (content) => {
|
|
|
9281
9211
|
return [{ type: "text", text: part.text }];
|
|
9282
9212
|
case "text_delta":
|
|
9283
9213
|
return [{ type: "text", text: part.text }];
|
|
9284
|
-
case "image_url":
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
return [{
|
|
9289
|
-
type: "image",
|
|
9290
|
-
image: part.image_url.url
|
|
9291
|
-
}];
|
|
9214
|
+
case "image_url": {
|
|
9215
|
+
const imageUrl = typeof part.image_url === "string" ? part.image_url : part.image_url.url;
|
|
9216
|
+
return imageUrl ? [{ type: "image", image: imageUrl }] : [];
|
|
9217
|
+
}
|
|
9292
9218
|
case "thinking":
|
|
9293
9219
|
return [{ type: "reasoning", text: part.thinking }];
|
|
9294
9220
|
case "reasoning":
|
|
9295
9221
|
return [{
|
|
9296
9222
|
type: "reasoning",
|
|
9297
|
-
text: part.summary.map((s) => s.text).join("\n\n\n")
|
|
9223
|
+
text: (part.summary ?? []).map((s) => s.text ?? "").join("\n\n\n")
|
|
9298
9224
|
}];
|
|
9299
9225
|
case "tool_use":
|
|
9300
9226
|
return [];
|
|
@@ -9771,6 +9697,8 @@ const useAthenaRuntime = (config2) => {
|
|
|
9771
9697
|
backendUrl = DEFAULT_BACKEND_URL,
|
|
9772
9698
|
apiKey,
|
|
9773
9699
|
token,
|
|
9700
|
+
getToken,
|
|
9701
|
+
onUnauthorized,
|
|
9774
9702
|
model = DEFAULT_MODEL,
|
|
9775
9703
|
agent: agent2 = DEFAULT_AGENT,
|
|
9776
9704
|
tools = [],
|
|
@@ -9802,6 +9730,10 @@ const useAthenaRuntime = (config2) => {
|
|
|
9802
9730
|
const converter = useMemo(() => createConverter(optimisticMessageCache), [optimisticMessageCache]);
|
|
9803
9731
|
const tokenRef = useRef(token);
|
|
9804
9732
|
tokenRef.current = token;
|
|
9733
|
+
const getTokenRef = useRef(getToken);
|
|
9734
|
+
getTokenRef.current = getToken;
|
|
9735
|
+
const onUnauthorizedRef = useRef(onUnauthorized);
|
|
9736
|
+
onUnauthorizedRef.current = onUnauthorized;
|
|
9805
9737
|
const apiKeyRef = useRef(apiKey);
|
|
9806
9738
|
apiKeyRef.current = apiKey;
|
|
9807
9739
|
const channelRef = useRef(channel);
|
|
@@ -9840,9 +9772,10 @@ const useAthenaRuntime = (config2) => {
|
|
|
9840
9772
|
resumeApi: resolvedResumeApiUrl,
|
|
9841
9773
|
headers: async () => {
|
|
9842
9774
|
const currentThreadId = threadIdRef.current;
|
|
9775
|
+
const currentToken = getTokenRef.current ? await getTokenRef.current() ?? tokenRef.current : tokenRef.current;
|
|
9843
9776
|
return {
|
|
9844
9777
|
// Prefer parent-injected PropelAuth token over hardcoded API key
|
|
9845
|
-
...
|
|
9778
|
+
...currentToken ? { Authorization: `Bearer ${currentToken}` } : apiKeyRef.current ? { "X-API-KEY": apiKeyRef.current } : {},
|
|
9846
9779
|
"Accept-Encoding": "identity",
|
|
9847
9780
|
Accept: "text/event-stream",
|
|
9848
9781
|
...currentThreadId ? { "X-Thread-Id": currentThreadId } : {}
|
|
@@ -9859,9 +9792,17 @@ const useAthenaRuntime = (config2) => {
|
|
|
9859
9792
|
}
|
|
9860
9793
|
},
|
|
9861
9794
|
onError: (error2, { commands: commands2, updateState }) => {
|
|
9795
|
+
var _a2;
|
|
9862
9796
|
const pendingCommands = commandsToMessages(commands2);
|
|
9863
9797
|
const isInvalidStringLength = error2 instanceof RangeError && /Invalid string length/i.test(error2.message);
|
|
9864
9798
|
const userErrorMessage = isInvalidStringLength ? "The response was too large to process. Try reducing the amount of content in a single request or starting a new chat." : error2.message;
|
|
9799
|
+
if (/\b401\b|unauthori[sz]ed/i.test(error2.message)) {
|
|
9800
|
+
try {
|
|
9801
|
+
void Promise.resolve((_a2 = onUnauthorizedRef.current) == null ? void 0 : _a2.call(onUnauthorizedRef)).catch(() => {
|
|
9802
|
+
});
|
|
9803
|
+
} catch {
|
|
9804
|
+
}
|
|
9805
|
+
}
|
|
9865
9806
|
updateState((state) => {
|
|
9866
9807
|
const messages = [...state.messages, ...pendingCommands];
|
|
9867
9808
|
const lastAiIdx = messages.findLastIndex((m) => m.type === "ai");
|
|
@@ -9974,7 +9915,8 @@ const useAthenaRuntime = (config2) => {
|
|
|
9974
9915
|
hasResumedRef.current = true;
|
|
9975
9916
|
(async () => {
|
|
9976
9917
|
var _a2, _b;
|
|
9977
|
-
const
|
|
9918
|
+
const currentToken = getTokenRef.current ? await getTokenRef.current() ?? tokenRef.current : tokenRef.current;
|
|
9919
|
+
const auth = { apiKey: apiKeyRef.current, token: currentToken };
|
|
9978
9920
|
console.log("[AthenaSDK] Loading existing thread state:", {
|
|
9979
9921
|
threadId,
|
|
9980
9922
|
backendUrl
|
|
@@ -10029,7 +9971,7 @@ const useAthenaRuntime = (config2) => {
|
|
|
10029
9971
|
}, [isExistingThread, runtime, threadId, backendUrl, resolvedStatusApiUrl]);
|
|
10030
9972
|
return runtime;
|
|
10031
9973
|
};
|
|
10032
|
-
function setRef(ref, value) {
|
|
9974
|
+
function setRef$1(ref, value) {
|
|
10033
9975
|
if (typeof ref === "function") {
|
|
10034
9976
|
return ref(value);
|
|
10035
9977
|
} else if (ref !== null && ref !== void 0) {
|
|
@@ -10040,7 +9982,7 @@ function composeRefs(...refs) {
|
|
|
10040
9982
|
return (node) => {
|
|
10041
9983
|
let hasCleanup = false;
|
|
10042
9984
|
const cleanups = refs.map((ref) => {
|
|
10043
|
-
const cleanup = setRef(ref, node);
|
|
9985
|
+
const cleanup = setRef$1(ref, node);
|
|
10044
9986
|
if (!hasCleanup && typeof cleanup == "function") {
|
|
10045
9987
|
hasCleanup = true;
|
|
10046
9988
|
}
|
|
@@ -10053,7 +9995,7 @@ function composeRefs(...refs) {
|
|
|
10053
9995
|
if (typeof cleanup == "function") {
|
|
10054
9996
|
cleanup();
|
|
10055
9997
|
} else {
|
|
10056
|
-
setRef(refs[i], null);
|
|
9998
|
+
setRef$1(refs[i], null);
|
|
10057
9999
|
}
|
|
10058
10000
|
}
|
|
10059
10001
|
};
|
|
@@ -10065,60 +10007,77 @@ function useComposedRefs(...refs) {
|
|
|
10065
10007
|
}
|
|
10066
10008
|
// @__NO_SIDE_EFFECTS__
|
|
10067
10009
|
function createSlot(ownerName) {
|
|
10068
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
10069
10010
|
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10011
|
+
let { children, ...slotProps } = props;
|
|
10012
|
+
let slottableElement = null;
|
|
10013
|
+
let hasSlottable = false;
|
|
10014
|
+
const newChildren = [];
|
|
10015
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
10016
|
+
children = use(children._payload);
|
|
10017
|
+
}
|
|
10018
|
+
React.Children.forEach(children, (maybeSlottable) => {
|
|
10019
|
+
var _a2;
|
|
10020
|
+
if (isSlottable(maybeSlottable)) {
|
|
10021
|
+
hasSlottable = true;
|
|
10022
|
+
const slottable = maybeSlottable;
|
|
10023
|
+
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
10024
|
+
if (isLazyComponent(child) && typeof use === "function") {
|
|
10025
|
+
child = use(child._payload);
|
|
10026
|
+
}
|
|
10027
|
+
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
10028
|
+
newChildren.push((_a2 = slottableElement == null ? void 0 : slottableElement.props) == null ? void 0 : _a2.children);
|
|
10029
|
+
} else {
|
|
10030
|
+
newChildren.push(maybeSlottable);
|
|
10031
|
+
}
|
|
10032
|
+
});
|
|
10033
|
+
if (slottableElement) {
|
|
10034
|
+
slottableElement = React.cloneElement(slottableElement, void 0, newChildren);
|
|
10035
|
+
} else if (
|
|
10036
|
+
// A `Slottable` was found but it didn't resolve to a single element (e.g.
|
|
10037
|
+
// it wrapped multiple elements, text, or a render-prop `child` that
|
|
10038
|
+
// wasn't an element). Don't fall back to treating the `Slottable` wrapper
|
|
10039
|
+
// itself as the slot target — throw a descriptive error below instead.
|
|
10040
|
+
!hasSlottable && React.Children.count(children) === 1 && React.isValidElement(children)
|
|
10041
|
+
) {
|
|
10042
|
+
slottableElement = children;
|
|
10043
|
+
}
|
|
10044
|
+
const slottableElementRef = slottableElement ? getElementRef$1(slottableElement) : void 0;
|
|
10045
|
+
const composedRef = useComposedRefs(forwardedRef, slottableElementRef);
|
|
10046
|
+
if (!slottableElement) {
|
|
10047
|
+
if (children || children === 0) {
|
|
10048
|
+
throw new Error(
|
|
10049
|
+
hasSlottable ? createSlottableError(ownerName) : createSlotError(ownerName)
|
|
10050
|
+
);
|
|
10051
|
+
}
|
|
10052
|
+
return children;
|
|
10053
|
+
}
|
|
10054
|
+
const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
|
|
10055
|
+
if (slottableElement.type !== React.Fragment) {
|
|
10056
|
+
mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
|
|
10084
10057
|
}
|
|
10085
|
-
return
|
|
10058
|
+
return React.cloneElement(slottableElement, mergedProps);
|
|
10086
10059
|
});
|
|
10087
10060
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
10088
10061
|
return Slot2;
|
|
10089
10062
|
}
|
|
10090
10063
|
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
10091
|
-
|
|
10092
|
-
function createSlotClone(ownerName) {
|
|
10093
|
-
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
10094
|
-
const { children, ...slotProps } = props;
|
|
10095
|
-
if (React.isValidElement(children)) {
|
|
10096
|
-
const childrenRef = getElementRef$1(children);
|
|
10097
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
10098
|
-
if (children.type !== React.Fragment) {
|
|
10099
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
10100
|
-
}
|
|
10101
|
-
return React.cloneElement(children, props2);
|
|
10102
|
-
}
|
|
10103
|
-
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
10104
|
-
});
|
|
10105
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
10106
|
-
return SlotClone;
|
|
10107
|
-
}
|
|
10108
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
10064
|
+
var SLOTTABLE_IDENTIFIER = Symbol.for("radix.slottable");
|
|
10109
10065
|
// @__NO_SIDE_EFFECTS__
|
|
10110
10066
|
function createSlottable(ownerName) {
|
|
10111
|
-
const Slottable2 = (
|
|
10112
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
10113
|
-
};
|
|
10067
|
+
const Slottable2 = (props) => "child" in props ? props.children(props.child) : props.children;
|
|
10114
10068
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
10115
10069
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
10116
10070
|
return Slottable2;
|
|
10117
10071
|
}
|
|
10118
10072
|
var Slottable$1 = /* @__PURE__ */ createSlottable("Slottable");
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10073
|
+
var getSlottableElementFromSlottable = (slottable, child) => {
|
|
10074
|
+
if ("child" in slottable.props) {
|
|
10075
|
+
const child2 = slottable.props.child;
|
|
10076
|
+
if (!React.isValidElement(child2)) return null;
|
|
10077
|
+
return React.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
10078
|
+
}
|
|
10079
|
+
return React.isValidElement(child) ? child : null;
|
|
10080
|
+
};
|
|
10122
10081
|
function mergeProps(slotProps, childProps) {
|
|
10123
10082
|
const overrideProps = { ...childProps };
|
|
10124
10083
|
for (const propName in childProps) {
|
|
@@ -10157,7 +10116,24 @@ function getElementRef$1(element) {
|
|
|
10157
10116
|
}
|
|
10158
10117
|
return element.props.ref || element.ref;
|
|
10159
10118
|
}
|
|
10160
|
-
|
|
10119
|
+
function isSlottable(child) {
|
|
10120
|
+
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
10121
|
+
}
|
|
10122
|
+
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
10123
|
+
function isLazyComponent(element) {
|
|
10124
|
+
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
10125
|
+
}
|
|
10126
|
+
function isPromiseLike(value) {
|
|
10127
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
10128
|
+
}
|
|
10129
|
+
var createSlotError = (ownerName) => {
|
|
10130
|
+
return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
|
|
10131
|
+
};
|
|
10132
|
+
var createSlottableError = (ownerName) => {
|
|
10133
|
+
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
10134
|
+
};
|
|
10135
|
+
var use = React[" use ".trim().toString()];
|
|
10136
|
+
var NODES = [
|
|
10161
10137
|
"a",
|
|
10162
10138
|
"button",
|
|
10163
10139
|
"div",
|
|
@@ -10176,7 +10152,7 @@ var NODES$6 = [
|
|
|
10176
10152
|
"svg",
|
|
10177
10153
|
"ul"
|
|
10178
10154
|
];
|
|
10179
|
-
var Primitive
|
|
10155
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
10180
10156
|
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10181
10157
|
const Node4 = React.forwardRef((props, forwardedRef) => {
|
|
10182
10158
|
const { asChild, ...primitiveProps } = props;
|
|
@@ -10189,6 +10165,9 @@ var Primitive$6 = NODES$6.reduce((primitive, node) => {
|
|
|
10189
10165
|
Node4.displayName = `Primitive.${node}`;
|
|
10190
10166
|
return { ...primitive, [node]: Node4 };
|
|
10191
10167
|
}, {});
|
|
10168
|
+
function dispatchDiscreteCustomEvent(target, event) {
|
|
10169
|
+
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
10170
|
+
}
|
|
10192
10171
|
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
10193
10172
|
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
10194
10173
|
position: "absolute",
|
|
@@ -10206,7 +10185,7 @@ var NAME$1 = "VisuallyHidden";
|
|
|
10206
10185
|
var VisuallyHidden = React.forwardRef(
|
|
10207
10186
|
(props, forwardedRef) => {
|
|
10208
10187
|
return /* @__PURE__ */ jsx(
|
|
10209
|
-
Primitive
|
|
10188
|
+
Primitive.span,
|
|
10210
10189
|
{
|
|
10211
10190
|
...props,
|
|
10212
10191
|
ref: forwardedRef,
|
|
@@ -10217,6 +10196,66 @@ var VisuallyHidden = React.forwardRef(
|
|
|
10217
10196
|
);
|
|
10218
10197
|
VisuallyHidden.displayName = NAME$1;
|
|
10219
10198
|
var Root$2 = VisuallyHidden;
|
|
10199
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
10200
|
+
let defaultContexts = [];
|
|
10201
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
10202
|
+
const BaseContext = React.createContext(defaultContext);
|
|
10203
|
+
BaseContext.displayName = rootComponentName + "Context";
|
|
10204
|
+
const index2 = defaultContexts.length;
|
|
10205
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
10206
|
+
const Provider2 = (props) => {
|
|
10207
|
+
var _a2;
|
|
10208
|
+
const { scope, children, ...context } = props;
|
|
10209
|
+
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10210
|
+
const value = React.useMemo(() => context, Object.values(context));
|
|
10211
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
10212
|
+
};
|
|
10213
|
+
Provider2.displayName = rootComponentName + "Provider";
|
|
10214
|
+
function useContext2(consumerName, scope) {
|
|
10215
|
+
var _a2;
|
|
10216
|
+
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10217
|
+
const context = React.useContext(Context);
|
|
10218
|
+
if (context) return context;
|
|
10219
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
10220
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10221
|
+
}
|
|
10222
|
+
return [Provider2, useContext2];
|
|
10223
|
+
}
|
|
10224
|
+
const createScope = () => {
|
|
10225
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10226
|
+
return React.createContext(defaultContext);
|
|
10227
|
+
});
|
|
10228
|
+
return function useScope(scope) {
|
|
10229
|
+
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
10230
|
+
return React.useMemo(
|
|
10231
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10232
|
+
[scope, contexts]
|
|
10233
|
+
);
|
|
10234
|
+
};
|
|
10235
|
+
};
|
|
10236
|
+
createScope.scopeName = scopeName;
|
|
10237
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
10238
|
+
}
|
|
10239
|
+
function composeContextScopes(...scopes) {
|
|
10240
|
+
const baseScope = scopes[0];
|
|
10241
|
+
if (scopes.length === 1) return baseScope;
|
|
10242
|
+
const createScope = () => {
|
|
10243
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
10244
|
+
useScope: createScope2(),
|
|
10245
|
+
scopeName: createScope2.scopeName
|
|
10246
|
+
}));
|
|
10247
|
+
return function useComposedScopes(overrideScopes) {
|
|
10248
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10249
|
+
const scopeProps = useScope(overrideScopes);
|
|
10250
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10251
|
+
return { ...nextScopes2, ...currentScope };
|
|
10252
|
+
}, {});
|
|
10253
|
+
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10254
|
+
};
|
|
10255
|
+
};
|
|
10256
|
+
createScope.scopeName = baseScope.scopeName;
|
|
10257
|
+
return createScope;
|
|
10258
|
+
}
|
|
10220
10259
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
10221
10260
|
return function handleEvent(event) {
|
|
10222
10261
|
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
@@ -10293,97 +10332,6 @@ function useUncontrolledState({
|
|
|
10293
10332
|
function isFunction$2(value) {
|
|
10294
10333
|
return typeof value === "function";
|
|
10295
10334
|
}
|
|
10296
|
-
function createContextScope$2(scopeName, createContextScopeDeps = []) {
|
|
10297
|
-
let defaultContexts = [];
|
|
10298
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
10299
|
-
const BaseContext = React.createContext(defaultContext);
|
|
10300
|
-
const index2 = defaultContexts.length;
|
|
10301
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
10302
|
-
const Provider2 = (props) => {
|
|
10303
|
-
var _a2;
|
|
10304
|
-
const { scope, children, ...context } = props;
|
|
10305
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10306
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
10307
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
10308
|
-
};
|
|
10309
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
10310
|
-
function useContext2(consumerName, scope) {
|
|
10311
|
-
var _a2;
|
|
10312
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
10313
|
-
const context = React.useContext(Context);
|
|
10314
|
-
if (context) return context;
|
|
10315
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
10316
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
10317
|
-
}
|
|
10318
|
-
return [Provider2, useContext2];
|
|
10319
|
-
}
|
|
10320
|
-
const createScope = () => {
|
|
10321
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
10322
|
-
return React.createContext(defaultContext);
|
|
10323
|
-
});
|
|
10324
|
-
return function useScope(scope) {
|
|
10325
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
10326
|
-
return React.useMemo(
|
|
10327
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
10328
|
-
[scope, contexts]
|
|
10329
|
-
);
|
|
10330
|
-
};
|
|
10331
|
-
};
|
|
10332
|
-
createScope.scopeName = scopeName;
|
|
10333
|
-
return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
|
|
10334
|
-
}
|
|
10335
|
-
function composeContextScopes$2(...scopes) {
|
|
10336
|
-
const baseScope = scopes[0];
|
|
10337
|
-
if (scopes.length === 1) return baseScope;
|
|
10338
|
-
const createScope = () => {
|
|
10339
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
10340
|
-
useScope: createScope2(),
|
|
10341
|
-
scopeName: createScope2.scopeName
|
|
10342
|
-
}));
|
|
10343
|
-
return function useComposedScopes(overrideScopes) {
|
|
10344
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
10345
|
-
const scopeProps = useScope(overrideScopes);
|
|
10346
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
10347
|
-
return { ...nextScopes2, ...currentScope };
|
|
10348
|
-
}, {});
|
|
10349
|
-
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
10350
|
-
};
|
|
10351
|
-
};
|
|
10352
|
-
createScope.scopeName = baseScope.scopeName;
|
|
10353
|
-
return createScope;
|
|
10354
|
-
}
|
|
10355
|
-
var NODES$5 = [
|
|
10356
|
-
"a",
|
|
10357
|
-
"button",
|
|
10358
|
-
"div",
|
|
10359
|
-
"form",
|
|
10360
|
-
"h2",
|
|
10361
|
-
"h3",
|
|
10362
|
-
"img",
|
|
10363
|
-
"input",
|
|
10364
|
-
"label",
|
|
10365
|
-
"li",
|
|
10366
|
-
"nav",
|
|
10367
|
-
"ol",
|
|
10368
|
-
"p",
|
|
10369
|
-
"select",
|
|
10370
|
-
"span",
|
|
10371
|
-
"svg",
|
|
10372
|
-
"ul"
|
|
10373
|
-
];
|
|
10374
|
-
var Primitive$5 = NODES$5.reduce((primitive, node) => {
|
|
10375
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10376
|
-
const Node4 = React.forwardRef((props, forwardedRef) => {
|
|
10377
|
-
const { asChild, ...primitiveProps } = props;
|
|
10378
|
-
const Comp = asChild ? Slot2 : node;
|
|
10379
|
-
if (typeof window !== "undefined") {
|
|
10380
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10381
|
-
}
|
|
10382
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10383
|
-
});
|
|
10384
|
-
Node4.displayName = `Primitive.${node}`;
|
|
10385
|
-
return { ...primitive, [node]: Node4 };
|
|
10386
|
-
}, {});
|
|
10387
10335
|
function useStateMachine(initialState, machine) {
|
|
10388
10336
|
return React.useReducer((state, event) => {
|
|
10389
10337
|
const nextState = machine[state][event];
|
|
@@ -10394,7 +10342,7 @@ var Presence = (props) => {
|
|
|
10394
10342
|
const { present, children } = props;
|
|
10395
10343
|
const presence = usePresence(present);
|
|
10396
10344
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
10397
|
-
const ref =
|
|
10345
|
+
const ref = useStableComposedRefs(presence.ref, getElementRef(child));
|
|
10398
10346
|
const forceMount = typeof children === "function";
|
|
10399
10347
|
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
10400
10348
|
};
|
|
@@ -10490,6 +10438,40 @@ function usePresence(present) {
|
|
|
10490
10438
|
}, [])
|
|
10491
10439
|
};
|
|
10492
10440
|
}
|
|
10441
|
+
function setRef(ref, value) {
|
|
10442
|
+
if (typeof ref === "function") {
|
|
10443
|
+
return ref(value);
|
|
10444
|
+
} else if (ref !== null && ref !== void 0) {
|
|
10445
|
+
ref.current = value;
|
|
10446
|
+
}
|
|
10447
|
+
}
|
|
10448
|
+
function useStableComposedRefs(...refs) {
|
|
10449
|
+
const refsRef = React.useRef(refs);
|
|
10450
|
+
refsRef.current = refs;
|
|
10451
|
+
return React.useCallback((node) => {
|
|
10452
|
+
const currentRefs = refsRef.current;
|
|
10453
|
+
let hasCleanup = false;
|
|
10454
|
+
const cleanups = currentRefs.map((ref) => {
|
|
10455
|
+
const cleanup = setRef(ref, node);
|
|
10456
|
+
if (!hasCleanup && typeof cleanup === "function") {
|
|
10457
|
+
hasCleanup = true;
|
|
10458
|
+
}
|
|
10459
|
+
return cleanup;
|
|
10460
|
+
});
|
|
10461
|
+
if (hasCleanup) {
|
|
10462
|
+
return () => {
|
|
10463
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
10464
|
+
const cleanup = cleanups[i];
|
|
10465
|
+
if (typeof cleanup === "function") {
|
|
10466
|
+
cleanup();
|
|
10467
|
+
} else {
|
|
10468
|
+
setRef(currentRefs[i], null);
|
|
10469
|
+
}
|
|
10470
|
+
}
|
|
10471
|
+
};
|
|
10472
|
+
}
|
|
10473
|
+
}, []);
|
|
10474
|
+
}
|
|
10493
10475
|
function getAnimationName(styles) {
|
|
10494
10476
|
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
10495
10477
|
}
|
|
@@ -10517,7 +10499,7 @@ function useId$1(deterministicId) {
|
|
|
10517
10499
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10518
10500
|
}
|
|
10519
10501
|
var COLLAPSIBLE_NAME = "Collapsible";
|
|
10520
|
-
var [createCollapsibleContext] = createContextScope
|
|
10502
|
+
var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
|
|
10521
10503
|
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
|
|
10522
10504
|
var Collapsible$1 = React.forwardRef(
|
|
10523
10505
|
(props, forwardedRef) => {
|
|
@@ -10544,7 +10526,7 @@ var Collapsible$1 = React.forwardRef(
|
|
|
10544
10526
|
open,
|
|
10545
10527
|
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
10546
10528
|
children: /* @__PURE__ */ jsx(
|
|
10547
|
-
Primitive
|
|
10529
|
+
Primitive.div,
|
|
10548
10530
|
{
|
|
10549
10531
|
"data-state": getState(open),
|
|
10550
10532
|
"data-disabled": disabled ? "" : void 0,
|
|
@@ -10563,10 +10545,10 @@ var CollapsibleTrigger$1 = React.forwardRef(
|
|
|
10563
10545
|
const { __scopeCollapsible, ...triggerProps } = props;
|
|
10564
10546
|
const context = useCollapsibleContext(TRIGGER_NAME$1, __scopeCollapsible);
|
|
10565
10547
|
return /* @__PURE__ */ jsx(
|
|
10566
|
-
Primitive
|
|
10548
|
+
Primitive.button,
|
|
10567
10549
|
{
|
|
10568
10550
|
type: "button",
|
|
10569
|
-
"aria-controls": context.contentId,
|
|
10551
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
10570
10552
|
"aria-expanded": context.open || false,
|
|
10571
10553
|
"data-state": getState(context.open),
|
|
10572
10554
|
"data-disabled": context.disabled ? "" : void 0,
|
|
@@ -10625,7 +10607,7 @@ var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
|
10625
10607
|
}
|
|
10626
10608
|
}, [context.open, present]);
|
|
10627
10609
|
return /* @__PURE__ */ jsx(
|
|
10628
|
-
Primitive
|
|
10610
|
+
Primitive.div,
|
|
10629
10611
|
{
|
|
10630
10612
|
"data-state": getState(context.open),
|
|
10631
10613
|
"data-disabled": context.disabled ? "" : void 0,
|
|
@@ -10646,50 +10628,15 @@ function getState(open) {
|
|
|
10646
10628
|
return open ? "open" : "closed";
|
|
10647
10629
|
}
|
|
10648
10630
|
var Root$1 = Collapsible$1;
|
|
10649
|
-
var NODES$4 = [
|
|
10650
|
-
"a",
|
|
10651
|
-
"button",
|
|
10652
|
-
"div",
|
|
10653
|
-
"form",
|
|
10654
|
-
"h2",
|
|
10655
|
-
"h3",
|
|
10656
|
-
"img",
|
|
10657
|
-
"input",
|
|
10658
|
-
"label",
|
|
10659
|
-
"li",
|
|
10660
|
-
"nav",
|
|
10661
|
-
"ol",
|
|
10662
|
-
"p",
|
|
10663
|
-
"select",
|
|
10664
|
-
"span",
|
|
10665
|
-
"svg",
|
|
10666
|
-
"ul"
|
|
10667
|
-
];
|
|
10668
|
-
var Primitive$4 = NODES$4.reduce((primitive, node) => {
|
|
10669
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10670
|
-
const Node4 = React.forwardRef((props, forwardedRef) => {
|
|
10671
|
-
const { asChild, ...primitiveProps } = props;
|
|
10672
|
-
const Comp = asChild ? Slot2 : node;
|
|
10673
|
-
if (typeof window !== "undefined") {
|
|
10674
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10675
|
-
}
|
|
10676
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10677
|
-
});
|
|
10678
|
-
Node4.displayName = `Primitive.${node}`;
|
|
10679
|
-
return { ...primitive, [node]: Node4 };
|
|
10680
|
-
}, {});
|
|
10681
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
10682
|
-
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
10683
|
-
}
|
|
10684
10631
|
function useCallbackRef(callback) {
|
|
10685
10632
|
const callbackRef = React.useRef(callback);
|
|
10686
10633
|
React.useEffect(() => {
|
|
10687
10634
|
callbackRef.current = callback;
|
|
10688
10635
|
});
|
|
10689
|
-
return React.useMemo(() => (...args) => {
|
|
10636
|
+
return React.useMemo(() => ((...args) => {
|
|
10690
10637
|
var _a2;
|
|
10691
10638
|
return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
|
|
10692
|
-
}, []);
|
|
10639
|
+
}), []);
|
|
10693
10640
|
}
|
|
10694
10641
|
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
10695
10642
|
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
@@ -10711,12 +10658,19 @@ var originalBodyPointerEvents;
|
|
|
10711
10658
|
var DismissableLayerContext = React.createContext({
|
|
10712
10659
|
layers: /* @__PURE__ */ new Set(),
|
|
10713
10660
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
10714
|
-
branches: /* @__PURE__ */ new Set()
|
|
10661
|
+
branches: /* @__PURE__ */ new Set(),
|
|
10662
|
+
// Outside elements that belong to a layer's own dismiss affordance (eg, a
|
|
10663
|
+
// dialog overlay). Pressing them should dismiss the layer regardless of
|
|
10664
|
+
// whether or not they stop propagation.
|
|
10665
|
+
//
|
|
10666
|
+
// See https://github.com/radix-ui/primitives/issues/3346
|
|
10667
|
+
dismissableSurfaces: /* @__PURE__ */ new Set()
|
|
10715
10668
|
});
|
|
10716
10669
|
var DismissableLayer = React.forwardRef(
|
|
10717
10670
|
(props, forwardedRef) => {
|
|
10718
10671
|
const {
|
|
10719
10672
|
disableOutsidePointerEvents = false,
|
|
10673
|
+
deferPointerDownOutside = false,
|
|
10720
10674
|
onEscapeKeyDown,
|
|
10721
10675
|
onPointerDownOutside,
|
|
10722
10676
|
onFocusOutside,
|
|
@@ -10735,15 +10689,32 @@ var DismissableLayer = React.forwardRef(
|
|
|
10735
10689
|
const index2 = node ? layers.indexOf(node) : -1;
|
|
10736
10690
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
10737
10691
|
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
10738
|
-
const
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10692
|
+
const isDeferredPointerDownOutsideRef = React.useRef(false);
|
|
10693
|
+
const pointerDownOutside = usePointerDownOutside(
|
|
10694
|
+
(event) => {
|
|
10695
|
+
const target = event.target;
|
|
10696
|
+
if (!(target instanceof Node)) {
|
|
10697
|
+
return;
|
|
10698
|
+
}
|
|
10699
|
+
const isPointerDownOnBranch = [...context.branches].some(
|
|
10700
|
+
(branch) => branch.contains(target)
|
|
10701
|
+
);
|
|
10702
|
+
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
10703
|
+
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
10704
|
+
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
10705
|
+
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
10706
|
+
},
|
|
10707
|
+
{
|
|
10708
|
+
ownerDocument,
|
|
10709
|
+
deferPointerDownOutside,
|
|
10710
|
+
isDeferredPointerDownOutsideRef,
|
|
10711
|
+
dismissableSurfaces: context.dismissableSurfaces
|
|
10712
|
+
}
|
|
10713
|
+
);
|
|
10746
10714
|
const focusOutside = useFocusOutside((event) => {
|
|
10715
|
+
if (deferPointerDownOutside && isDeferredPointerDownOutsideRef.current) {
|
|
10716
|
+
return;
|
|
10717
|
+
}
|
|
10747
10718
|
const target = event.target;
|
|
10748
10719
|
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
10749
10720
|
if (isFocusInBranch) return;
|
|
@@ -10772,8 +10743,11 @@ var DismissableLayer = React.forwardRef(
|
|
|
10772
10743
|
context.layers.add(node);
|
|
10773
10744
|
dispatchUpdate();
|
|
10774
10745
|
return () => {
|
|
10775
|
-
if (disableOutsidePointerEvents
|
|
10776
|
-
|
|
10746
|
+
if (disableOutsidePointerEvents) {
|
|
10747
|
+
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
10748
|
+
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
10749
|
+
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
10750
|
+
}
|
|
10777
10751
|
}
|
|
10778
10752
|
};
|
|
10779
10753
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
@@ -10791,7 +10765,7 @@ var DismissableLayer = React.forwardRef(
|
|
|
10791
10765
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
10792
10766
|
}, []);
|
|
10793
10767
|
return /* @__PURE__ */ jsx(
|
|
10794
|
-
Primitive
|
|
10768
|
+
Primitive.div,
|
|
10795
10769
|
{
|
|
10796
10770
|
...layerProps,
|
|
10797
10771
|
ref: composedRefs,
|
|
@@ -10824,38 +10798,97 @@ var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
|
10824
10798
|
};
|
|
10825
10799
|
}
|
|
10826
10800
|
}, [context.branches]);
|
|
10827
|
-
return /* @__PURE__ */ jsx(Primitive
|
|
10801
|
+
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
10828
10802
|
});
|
|
10829
10803
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
10830
|
-
function usePointerDownOutside(onPointerDownOutside,
|
|
10804
|
+
function usePointerDownOutside(onPointerDownOutside, args) {
|
|
10805
|
+
const {
|
|
10806
|
+
ownerDocument = globalThis == null ? void 0 : globalThis.document,
|
|
10807
|
+
deferPointerDownOutside = false,
|
|
10808
|
+
isDeferredPointerDownOutsideRef,
|
|
10809
|
+
dismissableSurfaces
|
|
10810
|
+
} = args;
|
|
10831
10811
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
10832
10812
|
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
10813
|
+
const isPointerDownOutsideRef = React.useRef(false);
|
|
10814
|
+
const interceptedOutsideInteractionEventsRef = React.useRef(/* @__PURE__ */ new Map());
|
|
10833
10815
|
const handleClickRef = React.useRef(() => {
|
|
10834
10816
|
});
|
|
10835
10817
|
React.useEffect(() => {
|
|
10818
|
+
function resetOutsideInteraction() {
|
|
10819
|
+
isPointerDownOutsideRef.current = false;
|
|
10820
|
+
isDeferredPointerDownOutsideRef.current = false;
|
|
10821
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
10822
|
+
}
|
|
10823
|
+
function isOutsideInteractionIntercepted() {
|
|
10824
|
+
return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);
|
|
10825
|
+
}
|
|
10826
|
+
function handleInteractionCapture(event) {
|
|
10827
|
+
if (!isPointerDownOutsideRef.current) {
|
|
10828
|
+
return;
|
|
10829
|
+
}
|
|
10830
|
+
const target = event.target;
|
|
10831
|
+
const isDismissableSurface = target instanceof Node && [...dismissableSurfaces].some((surface) => surface.contains(target));
|
|
10832
|
+
if (!isDismissableSurface) {
|
|
10833
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, true);
|
|
10834
|
+
}
|
|
10835
|
+
if (event.type === "click") {
|
|
10836
|
+
window.setTimeout(() => {
|
|
10837
|
+
if (isPointerDownOutsideRef.current) {
|
|
10838
|
+
handleClickRef.current();
|
|
10839
|
+
}
|
|
10840
|
+
}, 0);
|
|
10841
|
+
}
|
|
10842
|
+
}
|
|
10843
|
+
function handleInteractionBubble(event) {
|
|
10844
|
+
if (isPointerDownOutsideRef.current) {
|
|
10845
|
+
interceptedOutsideInteractionEventsRef.current.set(event.type, false);
|
|
10846
|
+
}
|
|
10847
|
+
}
|
|
10836
10848
|
const handlePointerDown = (event) => {
|
|
10837
10849
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
10838
10850
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10851
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10852
|
+
const wasOutsideInteractionIntercepted = isOutsideInteractionIntercepted();
|
|
10853
|
+
resetOutsideInteraction();
|
|
10854
|
+
if (!wasOutsideInteractionIntercepted) {
|
|
10855
|
+
handleAndDispatchCustomEvent(
|
|
10856
|
+
POINTER_DOWN_OUTSIDE,
|
|
10857
|
+
handlePointerDownOutside,
|
|
10858
|
+
eventDetail,
|
|
10859
|
+
{ discrete: true }
|
|
10860
|
+
);
|
|
10861
|
+
}
|
|
10845
10862
|
};
|
|
10846
10863
|
const eventDetail = { originalEvent: event };
|
|
10847
|
-
|
|
10864
|
+
isPointerDownOutsideRef.current = true;
|
|
10865
|
+
isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;
|
|
10866
|
+
interceptedOutsideInteractionEventsRef.current.clear();
|
|
10867
|
+
if (!deferPointerDownOutside || event.button !== 0) {
|
|
10868
|
+
handleAndDispatchPointerDownOutsideEvent2();
|
|
10869
|
+
} else {
|
|
10848
10870
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10849
10871
|
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
10850
10872
|
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
10851
|
-
} else {
|
|
10852
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
10853
10873
|
}
|
|
10854
10874
|
} else {
|
|
10855
10875
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10876
|
+
resetOutsideInteraction();
|
|
10856
10877
|
}
|
|
10857
10878
|
isPointerInsideReactTreeRef.current = false;
|
|
10858
10879
|
};
|
|
10880
|
+
const outsideInteractionEvents = [
|
|
10881
|
+
"pointerup",
|
|
10882
|
+
"mousedown",
|
|
10883
|
+
"mouseup",
|
|
10884
|
+
"touchstart",
|
|
10885
|
+
"touchend",
|
|
10886
|
+
"click"
|
|
10887
|
+
];
|
|
10888
|
+
for (const eventName of outsideInteractionEvents) {
|
|
10889
|
+
ownerDocument.addEventListener(eventName, handleInteractionCapture, true);
|
|
10890
|
+
ownerDocument.addEventListener(eventName, handleInteractionBubble);
|
|
10891
|
+
}
|
|
10859
10892
|
const timerId = window.setTimeout(() => {
|
|
10860
10893
|
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
10861
10894
|
}, 0);
|
|
@@ -10863,8 +10896,18 @@ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis
|
|
|
10863
10896
|
window.clearTimeout(timerId);
|
|
10864
10897
|
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
10865
10898
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
10899
|
+
for (const eventName of outsideInteractionEvents) {
|
|
10900
|
+
ownerDocument.removeEventListener(eventName, handleInteractionCapture, true);
|
|
10901
|
+
ownerDocument.removeEventListener(eventName, handleInteractionBubble);
|
|
10902
|
+
}
|
|
10866
10903
|
};
|
|
10867
|
-
}, [
|
|
10904
|
+
}, [
|
|
10905
|
+
ownerDocument,
|
|
10906
|
+
handlePointerDownOutside,
|
|
10907
|
+
deferPointerDownOutside,
|
|
10908
|
+
isDeferredPointerDownOutsideRef,
|
|
10909
|
+
dismissableSurfaces
|
|
10910
|
+
]);
|
|
10868
10911
|
return {
|
|
10869
10912
|
// ensures we check React component tree (not just DOM tree)
|
|
10870
10913
|
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
@@ -10904,38 +10947,6 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
10904
10947
|
target.dispatchEvent(event);
|
|
10905
10948
|
}
|
|
10906
10949
|
}
|
|
10907
|
-
var NODES$3 = [
|
|
10908
|
-
"a",
|
|
10909
|
-
"button",
|
|
10910
|
-
"div",
|
|
10911
|
-
"form",
|
|
10912
|
-
"h2",
|
|
10913
|
-
"h3",
|
|
10914
|
-
"img",
|
|
10915
|
-
"input",
|
|
10916
|
-
"label",
|
|
10917
|
-
"li",
|
|
10918
|
-
"nav",
|
|
10919
|
-
"ol",
|
|
10920
|
-
"p",
|
|
10921
|
-
"select",
|
|
10922
|
-
"span",
|
|
10923
|
-
"svg",
|
|
10924
|
-
"ul"
|
|
10925
|
-
];
|
|
10926
|
-
var Primitive$3 = NODES$3.reduce((primitive, node) => {
|
|
10927
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
10928
|
-
const Node4 = React.forwardRef((props, forwardedRef) => {
|
|
10929
|
-
const { asChild, ...primitiveProps } = props;
|
|
10930
|
-
const Comp = asChild ? Slot2 : node;
|
|
10931
|
-
if (typeof window !== "undefined") {
|
|
10932
|
-
window[Symbol.for("radix-ui")] = true;
|
|
10933
|
-
}
|
|
10934
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
10935
|
-
});
|
|
10936
|
-
Node4.displayName = `Primitive.${node}`;
|
|
10937
|
-
return { ...primitive, [node]: Node4 };
|
|
10938
|
-
}, {});
|
|
10939
10950
|
var PORTAL_NAME$1 = "Portal";
|
|
10940
10951
|
var Portal$1 = React.forwardRef((props, forwardedRef) => {
|
|
10941
10952
|
var _a2;
|
|
@@ -10943,152 +10954,9 @@ var Portal$1 = React.forwardRef((props, forwardedRef) => {
|
|
|
10943
10954
|
const [mounted, setMounted] = React.useState(false);
|
|
10944
10955
|
useLayoutEffect2(() => setMounted(true), []);
|
|
10945
10956
|
const container = containerProp || mounted && ((_a2 = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : _a2.body);
|
|
10946
|
-
return container ?
|
|
10957
|
+
return container ? ReactDOM.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
10947
10958
|
});
|
|
10948
10959
|
Portal$1.displayName = PORTAL_NAME$1;
|
|
10949
|
-
var shim$1 = { exports: {} };
|
|
10950
|
-
var useSyncExternalStoreShim_production = {};
|
|
10951
|
-
/**
|
|
10952
|
-
* @license React
|
|
10953
|
-
* use-sync-external-store-shim.production.js
|
|
10954
|
-
*
|
|
10955
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10956
|
-
*
|
|
10957
|
-
* This source code is licensed under the MIT license found in the
|
|
10958
|
-
* LICENSE file in the root directory of this source tree.
|
|
10959
|
-
*/
|
|
10960
|
-
var hasRequiredUseSyncExternalStoreShim_production;
|
|
10961
|
-
function requireUseSyncExternalStoreShim_production() {
|
|
10962
|
-
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
10963
|
-
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
10964
|
-
var React2 = React__default;
|
|
10965
|
-
function is(x, y) {
|
|
10966
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
10967
|
-
}
|
|
10968
|
-
var objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React2.useState, useEffect2 = React2.useEffect, useLayoutEffect3 = React2.useLayoutEffect, useDebugValue2 = React2.useDebugValue;
|
|
10969
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
10970
|
-
var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
10971
|
-
useLayoutEffect3(
|
|
10972
|
-
function() {
|
|
10973
|
-
inst.value = value;
|
|
10974
|
-
inst.getSnapshot = getSnapshot;
|
|
10975
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
10976
|
-
},
|
|
10977
|
-
[subscribe, value, getSnapshot]
|
|
10978
|
-
);
|
|
10979
|
-
useEffect2(
|
|
10980
|
-
function() {
|
|
10981
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
10982
|
-
return subscribe(function() {
|
|
10983
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
10984
|
-
});
|
|
10985
|
-
},
|
|
10986
|
-
[subscribe]
|
|
10987
|
-
);
|
|
10988
|
-
useDebugValue2(value);
|
|
10989
|
-
return value;
|
|
10990
|
-
}
|
|
10991
|
-
function checkIfSnapshotChanged(inst) {
|
|
10992
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
10993
|
-
inst = inst.value;
|
|
10994
|
-
try {
|
|
10995
|
-
var nextValue = latestGetSnapshot();
|
|
10996
|
-
return !objectIs(inst, nextValue);
|
|
10997
|
-
} catch (error2) {
|
|
10998
|
-
return true;
|
|
10999
|
-
}
|
|
11000
|
-
}
|
|
11001
|
-
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
11002
|
-
return getSnapshot();
|
|
11003
|
-
}
|
|
11004
|
-
var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
11005
|
-
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
|
|
11006
|
-
return useSyncExternalStoreShim_production;
|
|
11007
|
-
}
|
|
11008
|
-
var useSyncExternalStoreShim_development$1 = {};
|
|
11009
|
-
/**
|
|
11010
|
-
* @license React
|
|
11011
|
-
* use-sync-external-store-shim.development.js
|
|
11012
|
-
*
|
|
11013
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
11014
|
-
*
|
|
11015
|
-
* This source code is licensed under the MIT license found in the
|
|
11016
|
-
* LICENSE file in the root directory of this source tree.
|
|
11017
|
-
*/
|
|
11018
|
-
var hasRequiredUseSyncExternalStoreShim_development$1;
|
|
11019
|
-
function requireUseSyncExternalStoreShim_development$1() {
|
|
11020
|
-
if (hasRequiredUseSyncExternalStoreShim_development$1) return useSyncExternalStoreShim_development$1;
|
|
11021
|
-
hasRequiredUseSyncExternalStoreShim_development$1 = 1;
|
|
11022
|
-
"production" !== process.env.NODE_ENV && (function() {
|
|
11023
|
-
function is(x, y) {
|
|
11024
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
11025
|
-
}
|
|
11026
|
-
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
11027
|
-
didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
11028
|
-
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
11029
|
-
));
|
|
11030
|
-
var value = getSnapshot();
|
|
11031
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
11032
|
-
var cachedValue = getSnapshot();
|
|
11033
|
-
objectIs(value, cachedValue) || (console.error(
|
|
11034
|
-
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
11035
|
-
), didWarnUncachedGetSnapshot = true);
|
|
11036
|
-
}
|
|
11037
|
-
cachedValue = useState2({
|
|
11038
|
-
inst: { value, getSnapshot }
|
|
11039
|
-
});
|
|
11040
|
-
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
11041
|
-
useLayoutEffect3(
|
|
11042
|
-
function() {
|
|
11043
|
-
inst.value = value;
|
|
11044
|
-
inst.getSnapshot = getSnapshot;
|
|
11045
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11046
|
-
},
|
|
11047
|
-
[subscribe, value, getSnapshot]
|
|
11048
|
-
);
|
|
11049
|
-
useEffect2(
|
|
11050
|
-
function() {
|
|
11051
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11052
|
-
return subscribe(function() {
|
|
11053
|
-
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
11054
|
-
});
|
|
11055
|
-
},
|
|
11056
|
-
[subscribe]
|
|
11057
|
-
);
|
|
11058
|
-
useDebugValue2(value);
|
|
11059
|
-
return value;
|
|
11060
|
-
}
|
|
11061
|
-
function checkIfSnapshotChanged(inst) {
|
|
11062
|
-
var latestGetSnapshot = inst.getSnapshot;
|
|
11063
|
-
inst = inst.value;
|
|
11064
|
-
try {
|
|
11065
|
-
var nextValue = latestGetSnapshot();
|
|
11066
|
-
return !objectIs(inst, nextValue);
|
|
11067
|
-
} catch (error2) {
|
|
11068
|
-
return true;
|
|
11069
|
-
}
|
|
11070
|
-
}
|
|
11071
|
-
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
11072
|
-
return getSnapshot();
|
|
11073
|
-
}
|
|
11074
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
11075
|
-
var React2 = React__default, objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React2.useState, useEffect2 = React2.useEffect, useLayoutEffect3 = React2.useLayoutEffect, useDebugValue2 = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
11076
|
-
useSyncExternalStoreShim_development$1.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
|
|
11077
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
11078
|
-
})();
|
|
11079
|
-
return useSyncExternalStoreShim_development$1;
|
|
11080
|
-
}
|
|
11081
|
-
var hasRequiredShim;
|
|
11082
|
-
function requireShim() {
|
|
11083
|
-
if (hasRequiredShim) return shim$1.exports;
|
|
11084
|
-
hasRequiredShim = 1;
|
|
11085
|
-
if (process.env.NODE_ENV === "production") {
|
|
11086
|
-
shim$1.exports = requireUseSyncExternalStoreShim_production();
|
|
11087
|
-
} else {
|
|
11088
|
-
shim$1.exports = requireUseSyncExternalStoreShim_development$1();
|
|
11089
|
-
}
|
|
11090
|
-
return shim$1.exports;
|
|
11091
|
-
}
|
|
11092
10960
|
function useSize(element) {
|
|
11093
10961
|
const [size2, setSize] = React.useState(void 0);
|
|
11094
10962
|
useLayoutEffect2(() => {
|
|
@@ -13038,43 +12906,11 @@ const arrow$2 = (options, deps) => {
|
|
|
13038
12906
|
options: [options, deps]
|
|
13039
12907
|
};
|
|
13040
12908
|
};
|
|
13041
|
-
var NODES$2 = [
|
|
13042
|
-
"a",
|
|
13043
|
-
"button",
|
|
13044
|
-
"div",
|
|
13045
|
-
"form",
|
|
13046
|
-
"h2",
|
|
13047
|
-
"h3",
|
|
13048
|
-
"img",
|
|
13049
|
-
"input",
|
|
13050
|
-
"label",
|
|
13051
|
-
"li",
|
|
13052
|
-
"nav",
|
|
13053
|
-
"ol",
|
|
13054
|
-
"p",
|
|
13055
|
-
"select",
|
|
13056
|
-
"span",
|
|
13057
|
-
"svg",
|
|
13058
|
-
"ul"
|
|
13059
|
-
];
|
|
13060
|
-
var Primitive$2 = NODES$2.reduce((primitive, node) => {
|
|
13061
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
13062
|
-
const Node4 = React.forwardRef((props, forwardedRef) => {
|
|
13063
|
-
const { asChild, ...primitiveProps } = props;
|
|
13064
|
-
const Comp = asChild ? Slot2 : node;
|
|
13065
|
-
if (typeof window !== "undefined") {
|
|
13066
|
-
window[Symbol.for("radix-ui")] = true;
|
|
13067
|
-
}
|
|
13068
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
13069
|
-
});
|
|
13070
|
-
Node4.displayName = `Primitive.${node}`;
|
|
13071
|
-
return { ...primitive, [node]: Node4 };
|
|
13072
|
-
}, {});
|
|
13073
12909
|
var NAME = "Arrow";
|
|
13074
12910
|
var Arrow$1 = React.forwardRef((props, forwardedRef) => {
|
|
13075
12911
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
13076
12912
|
return /* @__PURE__ */ jsx(
|
|
13077
|
-
Primitive
|
|
12913
|
+
Primitive.svg,
|
|
13078
12914
|
{
|
|
13079
12915
|
...arrowProps,
|
|
13080
12916
|
ref: forwardedRef,
|
|
@@ -13088,104 +12924,24 @@ var Arrow$1 = React.forwardRef((props, forwardedRef) => {
|
|
|
13088
12924
|
});
|
|
13089
12925
|
Arrow$1.displayName = NAME;
|
|
13090
12926
|
var Root = Arrow$1;
|
|
13091
|
-
function createContextScope$1(scopeName, createContextScopeDeps = []) {
|
|
13092
|
-
let defaultContexts = [];
|
|
13093
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
13094
|
-
const BaseContext = React.createContext(defaultContext);
|
|
13095
|
-
const index2 = defaultContexts.length;
|
|
13096
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
13097
|
-
const Provider2 = (props) => {
|
|
13098
|
-
var _a2;
|
|
13099
|
-
const { scope, children, ...context } = props;
|
|
13100
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13101
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
13102
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
13103
|
-
};
|
|
13104
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
13105
|
-
function useContext2(consumerName, scope) {
|
|
13106
|
-
var _a2;
|
|
13107
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13108
|
-
const context = React.useContext(Context);
|
|
13109
|
-
if (context) return context;
|
|
13110
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
13111
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
13112
|
-
}
|
|
13113
|
-
return [Provider2, useContext2];
|
|
13114
|
-
}
|
|
13115
|
-
const createScope = () => {
|
|
13116
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
13117
|
-
return React.createContext(defaultContext);
|
|
13118
|
-
});
|
|
13119
|
-
return function useScope(scope) {
|
|
13120
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
13121
|
-
return React.useMemo(
|
|
13122
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
13123
|
-
[scope, contexts]
|
|
13124
|
-
);
|
|
13125
|
-
};
|
|
13126
|
-
};
|
|
13127
|
-
createScope.scopeName = scopeName;
|
|
13128
|
-
return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
|
|
13129
|
-
}
|
|
13130
|
-
function composeContextScopes$1(...scopes) {
|
|
13131
|
-
const baseScope = scopes[0];
|
|
13132
|
-
if (scopes.length === 1) return baseScope;
|
|
13133
|
-
const createScope = () => {
|
|
13134
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
13135
|
-
useScope: createScope2(),
|
|
13136
|
-
scopeName: createScope2.scopeName
|
|
13137
|
-
}));
|
|
13138
|
-
return function useComposedScopes(overrideScopes) {
|
|
13139
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
13140
|
-
const scopeProps = useScope(overrideScopes);
|
|
13141
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
13142
|
-
return { ...nextScopes2, ...currentScope };
|
|
13143
|
-
}, {});
|
|
13144
|
-
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
13145
|
-
};
|
|
13146
|
-
};
|
|
13147
|
-
createScope.scopeName = baseScope.scopeName;
|
|
13148
|
-
return createScope;
|
|
13149
|
-
}
|
|
13150
|
-
var NODES$1 = [
|
|
13151
|
-
"a",
|
|
13152
|
-
"button",
|
|
13153
|
-
"div",
|
|
13154
|
-
"form",
|
|
13155
|
-
"h2",
|
|
13156
|
-
"h3",
|
|
13157
|
-
"img",
|
|
13158
|
-
"input",
|
|
13159
|
-
"label",
|
|
13160
|
-
"li",
|
|
13161
|
-
"nav",
|
|
13162
|
-
"ol",
|
|
13163
|
-
"p",
|
|
13164
|
-
"select",
|
|
13165
|
-
"span",
|
|
13166
|
-
"svg",
|
|
13167
|
-
"ul"
|
|
13168
|
-
];
|
|
13169
|
-
var Primitive$1 = NODES$1.reduce((primitive, node) => {
|
|
13170
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
13171
|
-
const Node4 = React.forwardRef((props, forwardedRef) => {
|
|
13172
|
-
const { asChild, ...primitiveProps } = props;
|
|
13173
|
-
const Comp = asChild ? Slot2 : node;
|
|
13174
|
-
if (typeof window !== "undefined") {
|
|
13175
|
-
window[Symbol.for("radix-ui")] = true;
|
|
13176
|
-
}
|
|
13177
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
13178
|
-
});
|
|
13179
|
-
Node4.displayName = `Primitive.${node}`;
|
|
13180
|
-
return { ...primitive, [node]: Node4 };
|
|
13181
|
-
}, {});
|
|
13182
12927
|
var POPPER_NAME = "Popper";
|
|
13183
|
-
var [createPopperContext, createPopperScope] = createContextScope
|
|
12928
|
+
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
13184
12929
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
13185
12930
|
var Popper = (props) => {
|
|
13186
12931
|
const { __scopePopper, children } = props;
|
|
13187
12932
|
const [anchor, setAnchor] = React.useState(null);
|
|
13188
|
-
|
|
12933
|
+
const [placementState, setPlacementState] = React.useState(void 0);
|
|
12934
|
+
return /* @__PURE__ */ jsx(
|
|
12935
|
+
PopperProvider,
|
|
12936
|
+
{
|
|
12937
|
+
scope: __scopePopper,
|
|
12938
|
+
anchor,
|
|
12939
|
+
onAnchorChange: setAnchor,
|
|
12940
|
+
placementState,
|
|
12941
|
+
setPlacementState,
|
|
12942
|
+
children
|
|
12943
|
+
}
|
|
12944
|
+
);
|
|
13189
12945
|
};
|
|
13190
12946
|
Popper.displayName = POPPER_NAME;
|
|
13191
12947
|
var ANCHOR_NAME = "PopperAnchor";
|
|
@@ -13194,16 +12950,40 @@ var PopperAnchor = React.forwardRef(
|
|
|
13194
12950
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
13195
12951
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
13196
12952
|
const ref = React.useRef(null);
|
|
13197
|
-
const
|
|
12953
|
+
const onAnchorChange = context.onAnchorChange;
|
|
12954
|
+
const callbackRef = React.useCallback(
|
|
12955
|
+
(node) => {
|
|
12956
|
+
ref.current = node;
|
|
12957
|
+
if (node) {
|
|
12958
|
+
onAnchorChange(node);
|
|
12959
|
+
}
|
|
12960
|
+
},
|
|
12961
|
+
[onAnchorChange]
|
|
12962
|
+
);
|
|
12963
|
+
const composedRefs = useComposedRefs(forwardedRef, callbackRef);
|
|
13198
12964
|
const anchorRef = React.useRef(null);
|
|
13199
12965
|
React.useEffect(() => {
|
|
12966
|
+
if (!virtualRef) {
|
|
12967
|
+
return;
|
|
12968
|
+
}
|
|
13200
12969
|
const previousAnchor = anchorRef.current;
|
|
13201
|
-
anchorRef.current =
|
|
12970
|
+
anchorRef.current = virtualRef.current;
|
|
13202
12971
|
if (previousAnchor !== anchorRef.current) {
|
|
13203
|
-
|
|
12972
|
+
onAnchorChange(anchorRef.current);
|
|
13204
12973
|
}
|
|
13205
12974
|
});
|
|
13206
|
-
|
|
12975
|
+
const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
|
|
12976
|
+
const placedSide = sideAndAlign == null ? void 0 : sideAndAlign[0];
|
|
12977
|
+
const placedAlign = sideAndAlign == null ? void 0 : sideAndAlign[1];
|
|
12978
|
+
return virtualRef ? null : /* @__PURE__ */ jsx(
|
|
12979
|
+
Primitive.div,
|
|
12980
|
+
{
|
|
12981
|
+
"data-radix-popper-side": placedSide,
|
|
12982
|
+
"data-radix-popper-align": placedAlign,
|
|
12983
|
+
...anchorProps,
|
|
12984
|
+
ref: composedRefs
|
|
12985
|
+
}
|
|
12986
|
+
);
|
|
13207
12987
|
}
|
|
13208
12988
|
);
|
|
13209
12989
|
PopperAnchor.displayName = ANCHOR_NAME;
|
|
@@ -13280,9 +13060,27 @@ var PopperContent = React.forwardRef(
|
|
|
13280
13060
|
}),
|
|
13281
13061
|
arrow2 && arrow$2({ element: arrow2, padding: arrowPadding }),
|
|
13282
13062
|
transformOrigin({ arrowWidth, arrowHeight }),
|
|
13283
|
-
hideWhenDetached && hide({
|
|
13063
|
+
hideWhenDetached && hide({
|
|
13064
|
+
strategy: "referenceHidden",
|
|
13065
|
+
...detectOverflowOptions,
|
|
13066
|
+
// `hide` detects whether the anchor (reference) is clipped, so when
|
|
13067
|
+
// no explicit `collisionBoundary` is set we fall back to Floating
|
|
13068
|
+
// UI's default clipping ancestors (e.g. a scrollable menu). This
|
|
13069
|
+
// lets an occluded submenu hide once its anchor scrolls out of view
|
|
13070
|
+
// (#3237). The collision/size middlewares deliberately keep the
|
|
13071
|
+
// viewport-based default to avoid clamping content rendered inside
|
|
13072
|
+
// transformed or overflow-clipping portal containers.
|
|
13073
|
+
boundary: hasExplicitBoundaries ? detectOverflowOptions.boundary : void 0
|
|
13074
|
+
})
|
|
13284
13075
|
]
|
|
13285
13076
|
});
|
|
13077
|
+
const setPlacementState = context.setPlacementState;
|
|
13078
|
+
useLayoutEffect2(() => {
|
|
13079
|
+
setPlacementState(placement);
|
|
13080
|
+
return () => {
|
|
13081
|
+
setPlacementState(void 0);
|
|
13082
|
+
};
|
|
13083
|
+
}, [placement, setPlacementState]);
|
|
13286
13084
|
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
13287
13085
|
const handlePlaced = useCallbackRef(onPlaced);
|
|
13288
13086
|
useLayoutEffect2(() => {
|
|
@@ -13308,7 +13106,7 @@ var PopperContent = React.forwardRef(
|
|
|
13308
13106
|
// keep off the page when measuring
|
|
13309
13107
|
minWidth: "max-content",
|
|
13310
13108
|
zIndex: contentZIndex,
|
|
13311
|
-
|
|
13109
|
+
"--radix-popper-transform-origin": [
|
|
13312
13110
|
(_d = middlewareData.transformOrigin) == null ? void 0 : _d.x,
|
|
13313
13111
|
(_e = middlewareData.transformOrigin) == null ? void 0 : _e.y
|
|
13314
13112
|
].join(" "),
|
|
@@ -13326,12 +13124,13 @@ var PopperContent = React.forwardRef(
|
|
|
13326
13124
|
{
|
|
13327
13125
|
scope: __scopePopper,
|
|
13328
13126
|
placedSide,
|
|
13127
|
+
placedAlign,
|
|
13329
13128
|
onArrowChange: setArrow,
|
|
13330
13129
|
arrowX,
|
|
13331
13130
|
arrowY,
|
|
13332
13131
|
shouldHideArrow: cannotCenterArrow,
|
|
13333
13132
|
children: /* @__PURE__ */ jsx(
|
|
13334
|
-
Primitive
|
|
13133
|
+
Primitive.div,
|
|
13335
13134
|
{
|
|
13336
13135
|
"data-side": placedSide,
|
|
13337
13136
|
"data-align": placedAlign,
|
|
@@ -13450,97 +13249,6 @@ var Root2 = Popper;
|
|
|
13450
13249
|
var Anchor = PopperAnchor;
|
|
13451
13250
|
var Content = PopperContent;
|
|
13452
13251
|
var Arrow = PopperArrow;
|
|
13453
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
13454
|
-
let defaultContexts = [];
|
|
13455
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
13456
|
-
const BaseContext = React.createContext(defaultContext);
|
|
13457
|
-
const index2 = defaultContexts.length;
|
|
13458
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
13459
|
-
const Provider2 = (props) => {
|
|
13460
|
-
var _a2;
|
|
13461
|
-
const { scope, children, ...context } = props;
|
|
13462
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13463
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
13464
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
13465
|
-
};
|
|
13466
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
13467
|
-
function useContext2(consumerName, scope) {
|
|
13468
|
-
var _a2;
|
|
13469
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index2]) || BaseContext;
|
|
13470
|
-
const context = React.useContext(Context);
|
|
13471
|
-
if (context) return context;
|
|
13472
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
13473
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
13474
|
-
}
|
|
13475
|
-
return [Provider2, useContext2];
|
|
13476
|
-
}
|
|
13477
|
-
const createScope = () => {
|
|
13478
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
13479
|
-
return React.createContext(defaultContext);
|
|
13480
|
-
});
|
|
13481
|
-
return function useScope(scope) {
|
|
13482
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
13483
|
-
return React.useMemo(
|
|
13484
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
13485
|
-
[scope, contexts]
|
|
13486
|
-
);
|
|
13487
|
-
};
|
|
13488
|
-
};
|
|
13489
|
-
createScope.scopeName = scopeName;
|
|
13490
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
13491
|
-
}
|
|
13492
|
-
function composeContextScopes(...scopes) {
|
|
13493
|
-
const baseScope = scopes[0];
|
|
13494
|
-
if (scopes.length === 1) return baseScope;
|
|
13495
|
-
const createScope = () => {
|
|
13496
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
13497
|
-
useScope: createScope2(),
|
|
13498
|
-
scopeName: createScope2.scopeName
|
|
13499
|
-
}));
|
|
13500
|
-
return function useComposedScopes(overrideScopes) {
|
|
13501
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
13502
|
-
const scopeProps = useScope(overrideScopes);
|
|
13503
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
13504
|
-
return { ...nextScopes2, ...currentScope };
|
|
13505
|
-
}, {});
|
|
13506
|
-
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
13507
|
-
};
|
|
13508
|
-
};
|
|
13509
|
-
createScope.scopeName = baseScope.scopeName;
|
|
13510
|
-
return createScope;
|
|
13511
|
-
}
|
|
13512
|
-
var NODES = [
|
|
13513
|
-
"a",
|
|
13514
|
-
"button",
|
|
13515
|
-
"div",
|
|
13516
|
-
"form",
|
|
13517
|
-
"h2",
|
|
13518
|
-
"h3",
|
|
13519
|
-
"img",
|
|
13520
|
-
"input",
|
|
13521
|
-
"label",
|
|
13522
|
-
"li",
|
|
13523
|
-
"nav",
|
|
13524
|
-
"ol",
|
|
13525
|
-
"p",
|
|
13526
|
-
"select",
|
|
13527
|
-
"span",
|
|
13528
|
-
"svg",
|
|
13529
|
-
"ul"
|
|
13530
|
-
];
|
|
13531
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
13532
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
13533
|
-
const Node4 = React.forwardRef((props, forwardedRef) => {
|
|
13534
|
-
const { asChild, ...primitiveProps } = props;
|
|
13535
|
-
const Comp = asChild ? Slot2 : node;
|
|
13536
|
-
if (typeof window !== "undefined") {
|
|
13537
|
-
window[Symbol.for("radix-ui")] = true;
|
|
13538
|
-
}
|
|
13539
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
13540
|
-
});
|
|
13541
|
-
Node4.displayName = `Primitive.${node}`;
|
|
13542
|
-
return { ...primitive, [node]: Node4 };
|
|
13543
|
-
}, {});
|
|
13544
13252
|
var [createTooltipContext] = createContextScope("Tooltip", [
|
|
13545
13253
|
createPopperScope
|
|
13546
13254
|
]);
|
|
@@ -13571,10 +13279,12 @@ var TooltipProvider$1 = (props) => {
|
|
|
13571
13279
|
isOpenDelayedRef,
|
|
13572
13280
|
delayDuration,
|
|
13573
13281
|
onOpen: React.useCallback(() => {
|
|
13282
|
+
if (skipDelayDuration <= 0) return;
|
|
13574
13283
|
window.clearTimeout(skipDelayTimerRef.current);
|
|
13575
13284
|
isOpenDelayedRef.current = false;
|
|
13576
|
-
}, []),
|
|
13285
|
+
}, [skipDelayDuration]),
|
|
13577
13286
|
onClose: React.useCallback(() => {
|
|
13287
|
+
if (skipDelayDuration <= 0) return;
|
|
13578
13288
|
window.clearTimeout(skipDelayTimerRef.current);
|
|
13579
13289
|
skipDelayTimerRef.current = window.setTimeout(
|
|
13580
13290
|
() => isOpenDelayedRef.current = true,
|
|
@@ -13836,8 +13546,9 @@ var TooltipContentImpl = React.forwardRef(
|
|
|
13836
13546
|
React.useEffect(() => {
|
|
13837
13547
|
if (context.trigger) {
|
|
13838
13548
|
const handleScroll = (event) => {
|
|
13839
|
-
|
|
13840
|
-
|
|
13549
|
+
if (event.target instanceof Node && event.target.contains(context.trigger)) {
|
|
13550
|
+
onClose();
|
|
13551
|
+
}
|
|
13841
13552
|
};
|
|
13842
13553
|
window.addEventListener("scroll", handleScroll, { capture: true });
|
|
13843
13554
|
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
@@ -32348,7 +32059,7 @@ function nodePasteRule(config2) {
|
|
|
32348
32059
|
function getDefaultExportFromCjs(x) {
|
|
32349
32060
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
32350
32061
|
}
|
|
32351
|
-
var shim = { exports: {} };
|
|
32062
|
+
var shim$1 = { exports: {} };
|
|
32352
32063
|
var useSyncExternalStoreShim_production_min = {};
|
|
32353
32064
|
/**
|
|
32354
32065
|
* @license React
|
|
@@ -32401,7 +32112,7 @@ function requireUseSyncExternalStoreShim_production_min() {
|
|
|
32401
32112
|
useSyncExternalStoreShim_production_min.useSyncExternalStore = void 0 !== e.useSyncExternalStore ? e.useSyncExternalStore : u;
|
|
32402
32113
|
return useSyncExternalStoreShim_production_min;
|
|
32403
32114
|
}
|
|
32404
|
-
var useSyncExternalStoreShim_development = {};
|
|
32115
|
+
var useSyncExternalStoreShim_development$1 = {};
|
|
32405
32116
|
/**
|
|
32406
32117
|
* @license React
|
|
32407
32118
|
* use-sync-external-store-shim.development.js
|
|
@@ -32411,10 +32122,10 @@ var useSyncExternalStoreShim_development = {};
|
|
|
32411
32122
|
* This source code is licensed under the MIT license found in the
|
|
32412
32123
|
* LICENSE file in the root directory of this source tree.
|
|
32413
32124
|
*/
|
|
32414
|
-
var hasRequiredUseSyncExternalStoreShim_development;
|
|
32415
|
-
function requireUseSyncExternalStoreShim_development() {
|
|
32416
|
-
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
32417
|
-
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
32125
|
+
var hasRequiredUseSyncExternalStoreShim_development$1;
|
|
32126
|
+
function requireUseSyncExternalStoreShim_development$1() {
|
|
32127
|
+
if (hasRequiredUseSyncExternalStoreShim_development$1) return useSyncExternalStoreShim_development$1;
|
|
32128
|
+
hasRequiredUseSyncExternalStoreShim_development$1 = 1;
|
|
32418
32129
|
if (process.env.NODE_ENV !== "production") {
|
|
32419
32130
|
(function() {
|
|
32420
32131
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
@@ -32523,20 +32234,20 @@ function requireUseSyncExternalStoreShim_development() {
|
|
|
32523
32234
|
var isServerEnvironment = !canUseDOM;
|
|
32524
32235
|
var shim2 = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
32525
32236
|
var useSyncExternalStore$2 = React$1.useSyncExternalStore !== void 0 ? React$1.useSyncExternalStore : shim2;
|
|
32526
|
-
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
32237
|
+
useSyncExternalStoreShim_development$1.useSyncExternalStore = useSyncExternalStore$2;
|
|
32527
32238
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
32528
32239
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
32529
32240
|
}
|
|
32530
32241
|
})();
|
|
32531
32242
|
}
|
|
32532
|
-
return useSyncExternalStoreShim_development;
|
|
32243
|
+
return useSyncExternalStoreShim_development$1;
|
|
32533
32244
|
}
|
|
32534
32245
|
if (process.env.NODE_ENV === "production") {
|
|
32535
|
-
shim.exports = requireUseSyncExternalStoreShim_production_min();
|
|
32246
|
+
shim$1.exports = requireUseSyncExternalStoreShim_production_min();
|
|
32536
32247
|
} else {
|
|
32537
|
-
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
32248
|
+
shim$1.exports = requireUseSyncExternalStoreShim_development$1();
|
|
32538
32249
|
}
|
|
32539
|
-
var shimExports = shim.exports;
|
|
32250
|
+
var shimExports = shim$1.exports;
|
|
32540
32251
|
const mergeRefs = (...refs) => {
|
|
32541
32252
|
return (node) => {
|
|
32542
32253
|
refs.forEach((ref) => {
|
|
@@ -39873,6 +39584,9 @@ getDecoder(xmlDecodeTree);
|
|
|
39873
39584
|
function decodeHTML(str, mode = DecodingMode.Legacy) {
|
|
39874
39585
|
return htmlDecoder(str, mode);
|
|
39875
39586
|
}
|
|
39587
|
+
function decodeHTMLStrict(str) {
|
|
39588
|
+
return htmlDecoder(str, DecodingMode.Strict);
|
|
39589
|
+
}
|
|
39876
39590
|
function _class$1(obj) {
|
|
39877
39591
|
return Object.prototype.toString.call(obj);
|
|
39878
39592
|
}
|
|
@@ -40029,6 +39743,9 @@ function isWhiteSpace(code2) {
|
|
|
40029
39743
|
function isPunctChar(ch) {
|
|
40030
39744
|
return P.test(ch) || regex.test(ch);
|
|
40031
39745
|
}
|
|
39746
|
+
function isPunctCharCode(code2) {
|
|
39747
|
+
return isPunctChar(fromCodePoint(code2));
|
|
39748
|
+
}
|
|
40032
39749
|
function isMdAsciiPunct(ch) {
|
|
40033
39750
|
switch (ch) {
|
|
40034
39751
|
case 33:
|
|
@@ -40075,10 +39792,29 @@ function normalizeReference(str) {
|
|
|
40075
39792
|
}
|
|
40076
39793
|
return str.toLowerCase().toUpperCase();
|
|
40077
39794
|
}
|
|
39795
|
+
function isAsciiTrimmable(c) {
|
|
39796
|
+
return c === 32 || c === 9 || c === 10 || c === 13;
|
|
39797
|
+
}
|
|
39798
|
+
function asciiTrim(str) {
|
|
39799
|
+
let start = 0;
|
|
39800
|
+
for (; start < str.length; start++) {
|
|
39801
|
+
if (!isAsciiTrimmable(str.charCodeAt(start))) {
|
|
39802
|
+
break;
|
|
39803
|
+
}
|
|
39804
|
+
}
|
|
39805
|
+
let end = str.length - 1;
|
|
39806
|
+
for (; end >= start; end--) {
|
|
39807
|
+
if (!isAsciiTrimmable(str.charCodeAt(end))) {
|
|
39808
|
+
break;
|
|
39809
|
+
}
|
|
39810
|
+
}
|
|
39811
|
+
return str.slice(start, end + 1);
|
|
39812
|
+
}
|
|
40078
39813
|
const lib = { mdurl, ucmicro };
|
|
40079
39814
|
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
40080
39815
|
__proto__: null,
|
|
40081
39816
|
arrayReplaceAt,
|
|
39817
|
+
asciiTrim,
|
|
40082
39818
|
assign: assign$1,
|
|
40083
39819
|
escapeHtml: escapeHtml$1,
|
|
40084
39820
|
escapeRE: escapeRE$1,
|
|
@@ -40086,6 +39822,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
40086
39822
|
has,
|
|
40087
39823
|
isMdAsciiPunct,
|
|
40088
39824
|
isPunctChar,
|
|
39825
|
+
isPunctCharCode,
|
|
40089
39826
|
isSpace,
|
|
40090
39827
|
isString: isString$1,
|
|
40091
39828
|
isValidEntityCode,
|
|
@@ -40813,12 +40550,27 @@ function replace(state) {
|
|
|
40813
40550
|
const QUOTE_TEST_RE = /['"]/;
|
|
40814
40551
|
const QUOTE_RE = /['"]/g;
|
|
40815
40552
|
const APOSTROPHE = "’";
|
|
40816
|
-
function
|
|
40817
|
-
|
|
40553
|
+
function addReplacement(replacements, tokenIdx, pos, ch) {
|
|
40554
|
+
if (!replacements[tokenIdx]) {
|
|
40555
|
+
replacements[tokenIdx] = [];
|
|
40556
|
+
}
|
|
40557
|
+
replacements[tokenIdx].push({ pos, ch });
|
|
40558
|
+
}
|
|
40559
|
+
function applyReplacements(str, replacements) {
|
|
40560
|
+
let result = "";
|
|
40561
|
+
let lastPos = 0;
|
|
40562
|
+
replacements.sort((a, b) => a.pos - b.pos);
|
|
40563
|
+
for (let i = 0; i < replacements.length; i++) {
|
|
40564
|
+
const replacement = replacements[i];
|
|
40565
|
+
result += str.slice(lastPos, replacement.pos) + replacement.ch;
|
|
40566
|
+
lastPos = replacement.pos + 1;
|
|
40567
|
+
}
|
|
40568
|
+
return result + str.slice(lastPos);
|
|
40818
40569
|
}
|
|
40819
40570
|
function process_inlines(tokens, state) {
|
|
40820
40571
|
let j;
|
|
40821
40572
|
const stack = [];
|
|
40573
|
+
const replacements = {};
|
|
40822
40574
|
for (let i = 0; i < tokens.length; i++) {
|
|
40823
40575
|
const token = tokens[i];
|
|
40824
40576
|
const thisLevel = tokens[i].level;
|
|
@@ -40831,9 +40583,9 @@ function process_inlines(tokens, state) {
|
|
|
40831
40583
|
if (token.type !== "text") {
|
|
40832
40584
|
continue;
|
|
40833
40585
|
}
|
|
40834
|
-
|
|
40586
|
+
const text2 = token.content;
|
|
40835
40587
|
let pos = 0;
|
|
40836
|
-
|
|
40588
|
+
const max2 = text2.length;
|
|
40837
40589
|
OUTER:
|
|
40838
40590
|
while (pos < max2) {
|
|
40839
40591
|
QUOTE_RE.lastIndex = pos;
|
|
@@ -40867,8 +40619,8 @@ function process_inlines(tokens, state) {
|
|
|
40867
40619
|
break;
|
|
40868
40620
|
}
|
|
40869
40621
|
}
|
|
40870
|
-
const isLastPunctChar = isMdAsciiPunct(lastChar) ||
|
|
40871
|
-
const isNextPunctChar = isMdAsciiPunct(nextChar) ||
|
|
40622
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
40623
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
40872
40624
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
40873
40625
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
40874
40626
|
if (isNextWhiteSpace) {
|
|
@@ -40896,7 +40648,7 @@ function process_inlines(tokens, state) {
|
|
|
40896
40648
|
}
|
|
40897
40649
|
if (!canOpen && !canClose) {
|
|
40898
40650
|
if (isSingle) {
|
|
40899
|
-
|
|
40651
|
+
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
40900
40652
|
}
|
|
40901
40653
|
continue;
|
|
40902
40654
|
}
|
|
@@ -40917,18 +40669,8 @@ function process_inlines(tokens, state) {
|
|
|
40917
40669
|
openQuote = state.md.options.quotes[0];
|
|
40918
40670
|
closeQuote = state.md.options.quotes[1];
|
|
40919
40671
|
}
|
|
40920
|
-
|
|
40921
|
-
|
|
40922
|
-
tokens[item.token].content,
|
|
40923
|
-
item.pos,
|
|
40924
|
-
openQuote
|
|
40925
|
-
);
|
|
40926
|
-
pos += closeQuote.length - 1;
|
|
40927
|
-
if (item.token === i) {
|
|
40928
|
-
pos += openQuote.length - 1;
|
|
40929
|
-
}
|
|
40930
|
-
text2 = token.content;
|
|
40931
|
-
max2 = text2.length;
|
|
40672
|
+
addReplacement(replacements, i, t.index, closeQuote);
|
|
40673
|
+
addReplacement(replacements, item.token, item.pos, openQuote);
|
|
40932
40674
|
stack.length = j;
|
|
40933
40675
|
continue OUTER;
|
|
40934
40676
|
}
|
|
@@ -40942,10 +40684,13 @@ function process_inlines(tokens, state) {
|
|
|
40942
40684
|
level: thisLevel
|
|
40943
40685
|
});
|
|
40944
40686
|
} else if (canClose && isSingle) {
|
|
40945
|
-
|
|
40687
|
+
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
40946
40688
|
}
|
|
40947
40689
|
}
|
|
40948
40690
|
}
|
|
40691
|
+
Object.keys(replacements).forEach(function(tokenIdx) {
|
|
40692
|
+
tokens[tokenIdx].content = applyReplacements(tokens[tokenIdx].content, replacements[tokenIdx]);
|
|
40693
|
+
});
|
|
40949
40694
|
}
|
|
40950
40695
|
function smartquotes(state) {
|
|
40951
40696
|
if (!state.md.options.typographer) {
|
|
@@ -42106,10 +41851,13 @@ function html_block(state, startLine, endLine, silent) {
|
|
|
42106
41851
|
return HTML_SEQUENCES[i][2];
|
|
42107
41852
|
}
|
|
42108
41853
|
let nextLine = startLine + 1;
|
|
41854
|
+
const endsOnBlankLine = HTML_SEQUENCES[i][1].test("");
|
|
42109
41855
|
if (!HTML_SEQUENCES[i][1].test(lineText)) {
|
|
42110
41856
|
for (; nextLine < endLine; nextLine++) {
|
|
42111
41857
|
if (state.sCount[nextLine] < state.blkIndent) {
|
|
42112
|
-
|
|
41858
|
+
if (endsOnBlankLine || !state.isEmpty(nextLine)) {
|
|
41859
|
+
break;
|
|
41860
|
+
}
|
|
42113
41861
|
}
|
|
42114
41862
|
pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
42115
41863
|
max2 = state.eMarks[nextLine];
|
|
@@ -42160,7 +41908,7 @@ function heading(state, startLine, endLine, silent) {
|
|
|
42160
41908
|
token_o.markup = "########".slice(0, level);
|
|
42161
41909
|
token_o.map = [startLine, state.line];
|
|
42162
41910
|
const token_i = state.push("inline", "", 0);
|
|
42163
|
-
token_i.content = state.src.slice(pos, max2)
|
|
41911
|
+
token_i.content = asciiTrim(state.src.slice(pos, max2));
|
|
42164
41912
|
token_i.map = [startLine, state.line];
|
|
42165
41913
|
token_i.children = [];
|
|
42166
41914
|
const token_c = state.push("heading_close", "h" + String(level), -1);
|
|
@@ -42211,9 +41959,10 @@ function lheading(state, startLine, endLine) {
|
|
|
42211
41959
|
}
|
|
42212
41960
|
}
|
|
42213
41961
|
if (!level) {
|
|
41962
|
+
state.parentType = oldParentType;
|
|
42214
41963
|
return false;
|
|
42215
41964
|
}
|
|
42216
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
41965
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
42217
41966
|
state.line = nextLine + 1;
|
|
42218
41967
|
const token_o = state.push("heading_open", "h" + String(level), 1);
|
|
42219
41968
|
token_o.markup = String.fromCharCode(marker);
|
|
@@ -42250,7 +41999,7 @@ function paragraph(state, startLine, endLine) {
|
|
|
42250
41999
|
break;
|
|
42251
42000
|
}
|
|
42252
42001
|
}
|
|
42253
|
-
const content = state.getLines(startLine, nextLine, state.blkIndent, false)
|
|
42002
|
+
const content = asciiTrim(state.getLines(startLine, nextLine, state.blkIndent, false));
|
|
42254
42003
|
state.line = nextLine;
|
|
42255
42004
|
const token_o = state.push("paragraph_open", "p", 1);
|
|
42256
42005
|
token_o.map = [startLine, state.line];
|
|
@@ -42384,15 +42133,37 @@ StateInline.prototype.push = function(type, tag, nesting) {
|
|
|
42384
42133
|
StateInline.prototype.scanDelims = function(start, canSplitWord) {
|
|
42385
42134
|
const max2 = this.posMax;
|
|
42386
42135
|
const marker = this.src.charCodeAt(start);
|
|
42387
|
-
|
|
42136
|
+
let lastChar;
|
|
42137
|
+
if (start === 0) {
|
|
42138
|
+
lastChar = 32;
|
|
42139
|
+
} else if (start === 1) {
|
|
42140
|
+
lastChar = this.src.charCodeAt(0);
|
|
42141
|
+
if ((lastChar & 63488) === 55296) {
|
|
42142
|
+
lastChar = 65533;
|
|
42143
|
+
}
|
|
42144
|
+
} else {
|
|
42145
|
+
lastChar = this.src.charCodeAt(start - 1);
|
|
42146
|
+
if ((lastChar & 64512) === 56320) {
|
|
42147
|
+
const highSurr = this.src.charCodeAt(start - 2);
|
|
42148
|
+
lastChar = (highSurr & 64512) === 55296 ? 65536 + (highSurr - 55296 << 10) + (lastChar - 56320) : 65533;
|
|
42149
|
+
} else if ((lastChar & 64512) === 55296) {
|
|
42150
|
+
lastChar = 65533;
|
|
42151
|
+
}
|
|
42152
|
+
}
|
|
42388
42153
|
let pos = start;
|
|
42389
42154
|
while (pos < max2 && this.src.charCodeAt(pos) === marker) {
|
|
42390
42155
|
pos++;
|
|
42391
42156
|
}
|
|
42392
42157
|
const count2 = pos - start;
|
|
42393
|
-
|
|
42394
|
-
|
|
42395
|
-
|
|
42158
|
+
let nextChar = pos < max2 ? this.src.charCodeAt(pos) : 32;
|
|
42159
|
+
if ((nextChar & 64512) === 55296) {
|
|
42160
|
+
const lowSurr = this.src.charCodeAt(pos + 1);
|
|
42161
|
+
nextChar = (lowSurr & 64512) === 56320 ? 65536 + (nextChar - 55296 << 10) + (lowSurr - 56320) : 65533;
|
|
42162
|
+
} else if ((nextChar & 64512) === 56320) {
|
|
42163
|
+
nextChar = 65533;
|
|
42164
|
+
}
|
|
42165
|
+
const isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctCharCode(lastChar);
|
|
42166
|
+
const isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctCharCode(nextChar);
|
|
42396
42167
|
const isLastWhiteSpace = isWhiteSpace(lastChar);
|
|
42397
42168
|
const isNextWhiteSpace = isWhiteSpace(nextChar);
|
|
42398
42169
|
const left_flanking = !isNextWhiteSpace && (!isNextPunctChar || isLastWhiteSpace || isLastPunctChar);
|
|
@@ -42543,6 +42314,16 @@ function escape(state, silent) {
|
|
|
42543
42314
|
state.pos = pos;
|
|
42544
42315
|
return true;
|
|
42545
42316
|
}
|
|
42317
|
+
if (ch1 === 32) {
|
|
42318
|
+
if (!silent) {
|
|
42319
|
+
const token = state.push("text_special", "", 0);
|
|
42320
|
+
token.content = "\\";
|
|
42321
|
+
token.markup = "\\";
|
|
42322
|
+
token.info = "escape";
|
|
42323
|
+
}
|
|
42324
|
+
state.pos = pos;
|
|
42325
|
+
return true;
|
|
42326
|
+
}
|
|
42546
42327
|
let escapedStr = state.src[pos];
|
|
42547
42328
|
if (ch1 >= 55296 && ch1 <= 56319 && pos + 1 < max2) {
|
|
42548
42329
|
const ch2 = state.src.charCodeAt(pos + 1);
|
|
@@ -43120,7 +42901,7 @@ function entity(state, silent) {
|
|
|
43120
42901
|
} else {
|
|
43121
42902
|
const match2 = state.src.slice(pos).match(NAMED_RE);
|
|
43122
42903
|
if (match2) {
|
|
43123
|
-
const decoded =
|
|
42904
|
+
const decoded = decodeHTMLStrict(match2[0]);
|
|
43124
42905
|
if (decoded !== match2[0]) {
|
|
43125
42906
|
if (!silent) {
|
|
43126
42907
|
const token = state.push("text_special", "", 0);
|
|
@@ -43462,10 +43243,6 @@ const defaultSchemas = {
|
|
|
43462
43243
|
};
|
|
43463
43244
|
const tlds_2ch_src_re = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]";
|
|
43464
43245
|
const tlds_default = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");
|
|
43465
|
-
function resetScanCache(self) {
|
|
43466
|
-
self.__index__ = -1;
|
|
43467
|
-
self.__text_cache__ = "";
|
|
43468
|
-
}
|
|
43469
43246
|
function createValidator(re) {
|
|
43470
43247
|
return function(text2, pos) {
|
|
43471
43248
|
const tail = text2.slice(pos);
|
|
@@ -43493,8 +43270,11 @@ function compile(self) {
|
|
|
43493
43270
|
return tpl.replace("%TLDS%", re.src_tlds);
|
|
43494
43271
|
}
|
|
43495
43272
|
re.email_fuzzy = RegExp(untpl(re.tpl_email_fuzzy), "i");
|
|
43273
|
+
re.email_fuzzy_global = RegExp(untpl(re.tpl_email_fuzzy), "ig");
|
|
43496
43274
|
re.link_fuzzy = RegExp(untpl(re.tpl_link_fuzzy), "i");
|
|
43275
|
+
re.link_fuzzy_global = RegExp(untpl(re.tpl_link_fuzzy), "ig");
|
|
43497
43276
|
re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "i");
|
|
43277
|
+
re.link_no_ip_fuzzy_global = RegExp(untpl(re.tpl_link_no_ip_fuzzy), "ig");
|
|
43498
43278
|
re.host_fuzzy_test = RegExp(untpl(re.tpl_host_fuzzy_test), "i");
|
|
43499
43279
|
const aliases = [];
|
|
43500
43280
|
self.__compiled__ = {};
|
|
@@ -43549,23 +43329,15 @@ function compile(self) {
|
|
|
43549
43329
|
"(" + self.re.schema_test.source + ")|(" + self.re.host_fuzzy_test.source + ")|@",
|
|
43550
43330
|
"i"
|
|
43551
43331
|
);
|
|
43552
|
-
|
|
43553
|
-
|
|
43554
|
-
|
|
43555
|
-
|
|
43556
|
-
|
|
43557
|
-
|
|
43558
|
-
this.
|
|
43559
|
-
this.
|
|
43560
|
-
this.
|
|
43561
|
-
this.raw = text2;
|
|
43562
|
-
this.text = text2;
|
|
43563
|
-
this.url = text2;
|
|
43564
|
-
}
|
|
43565
|
-
function createMatch(self, shift2) {
|
|
43566
|
-
const match2 = new Match(self, shift2);
|
|
43567
|
-
self.__compiled__[match2.schema].normalize(match2, self);
|
|
43568
|
-
return match2;
|
|
43332
|
+
}
|
|
43333
|
+
function Match(text2, schema2, index2, lastIndex) {
|
|
43334
|
+
const raw = text2.slice(index2, lastIndex);
|
|
43335
|
+
this.schema = schema2.toLowerCase();
|
|
43336
|
+
this.index = index2;
|
|
43337
|
+
this.lastIndex = lastIndex;
|
|
43338
|
+
this.raw = raw;
|
|
43339
|
+
this.text = raw;
|
|
43340
|
+
this.url = raw;
|
|
43569
43341
|
}
|
|
43570
43342
|
function LinkifyIt(schemas, options) {
|
|
43571
43343
|
if (!(this instanceof LinkifyIt)) {
|
|
@@ -43578,10 +43350,6 @@ function LinkifyIt(schemas, options) {
|
|
|
43578
43350
|
}
|
|
43579
43351
|
}
|
|
43580
43352
|
this.__opts__ = assign({}, defaultOptions, options);
|
|
43581
|
-
this.__index__ = -1;
|
|
43582
|
-
this.__last_index__ = -1;
|
|
43583
|
-
this.__schema__ = "";
|
|
43584
|
-
this.__text_cache__ = "";
|
|
43585
43353
|
this.__schemas__ = assign({}, defaultSchemas, schemas);
|
|
43586
43354
|
this.__compiled__ = {};
|
|
43587
43355
|
this.__tlds__ = tlds_default;
|
|
@@ -43599,55 +43367,34 @@ LinkifyIt.prototype.set = function set(options) {
|
|
|
43599
43367
|
return this;
|
|
43600
43368
|
};
|
|
43601
43369
|
LinkifyIt.prototype.test = function test(text2) {
|
|
43602
|
-
this.__text_cache__ = text2;
|
|
43603
|
-
this.__index__ = -1;
|
|
43604
43370
|
if (!text2.length) {
|
|
43605
43371
|
return false;
|
|
43606
43372
|
}
|
|
43607
|
-
let m,
|
|
43373
|
+
let m, re;
|
|
43608
43374
|
if (this.re.schema_test.test(text2)) {
|
|
43609
43375
|
re = this.re.schema_search;
|
|
43610
43376
|
re.lastIndex = 0;
|
|
43611
43377
|
while ((m = re.exec(text2)) !== null) {
|
|
43612
|
-
|
|
43613
|
-
|
|
43614
|
-
this.__schema__ = m[2];
|
|
43615
|
-
this.__index__ = m.index + m[1].length;
|
|
43616
|
-
this.__last_index__ = m.index + m[0].length + len;
|
|
43617
|
-
break;
|
|
43378
|
+
if (this.testSchemaAt(text2, m[2], re.lastIndex)) {
|
|
43379
|
+
return true;
|
|
43618
43380
|
}
|
|
43619
43381
|
}
|
|
43620
43382
|
}
|
|
43621
43383
|
if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
|
|
43622
|
-
|
|
43623
|
-
|
|
43624
|
-
|
|
43625
|
-
if ((ml = text2.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
|
|
43626
|
-
shift2 = ml.index + ml[1].length;
|
|
43627
|
-
if (this.__index__ < 0 || shift2 < this.__index__) {
|
|
43628
|
-
this.__schema__ = "";
|
|
43629
|
-
this.__index__ = shift2;
|
|
43630
|
-
this.__last_index__ = ml.index + ml[0].length;
|
|
43631
|
-
}
|
|
43632
|
-
}
|
|
43384
|
+
if (text2.search(this.re.host_fuzzy_test) >= 0) {
|
|
43385
|
+
if (text2.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy) !== null) {
|
|
43386
|
+
return true;
|
|
43633
43387
|
}
|
|
43634
43388
|
}
|
|
43635
43389
|
}
|
|
43636
43390
|
if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
|
|
43637
|
-
|
|
43638
|
-
|
|
43639
|
-
|
|
43640
|
-
shift2 = me.index + me[1].length;
|
|
43641
|
-
next = me.index + me[0].length;
|
|
43642
|
-
if (this.__index__ < 0 || shift2 < this.__index__ || shift2 === this.__index__ && next > this.__last_index__) {
|
|
43643
|
-
this.__schema__ = "mailto:";
|
|
43644
|
-
this.__index__ = shift2;
|
|
43645
|
-
this.__last_index__ = next;
|
|
43646
|
-
}
|
|
43391
|
+
if (text2.indexOf("@") >= 0) {
|
|
43392
|
+
if (text2.match(this.re.email_fuzzy) !== null) {
|
|
43393
|
+
return true;
|
|
43647
43394
|
}
|
|
43648
43395
|
}
|
|
43649
43396
|
}
|
|
43650
|
-
return
|
|
43397
|
+
return false;
|
|
43651
43398
|
};
|
|
43652
43399
|
LinkifyIt.prototype.pretest = function pretest(text2) {
|
|
43653
43400
|
return this.re.pretest.test(text2);
|
|
@@ -43660,16 +43407,87 @@ LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text2, schema2, pos) {
|
|
|
43660
43407
|
};
|
|
43661
43408
|
LinkifyIt.prototype.match = function match(text2) {
|
|
43662
43409
|
const result = [];
|
|
43663
|
-
|
|
43664
|
-
|
|
43665
|
-
|
|
43666
|
-
|
|
43410
|
+
const type_schemed = [];
|
|
43411
|
+
const type_fuzzy_link = [];
|
|
43412
|
+
const type_fuzzy_email = [];
|
|
43413
|
+
let m, len, re;
|
|
43414
|
+
function choose(a, b) {
|
|
43415
|
+
if (!a) {
|
|
43416
|
+
return b;
|
|
43417
|
+
}
|
|
43418
|
+
if (!b) {
|
|
43419
|
+
return a;
|
|
43420
|
+
}
|
|
43421
|
+
if (a.index !== b.index) {
|
|
43422
|
+
return a.index < b.index ? a : b;
|
|
43423
|
+
}
|
|
43424
|
+
return a.lastIndex >= b.lastIndex ? a : b;
|
|
43667
43425
|
}
|
|
43668
|
-
|
|
43669
|
-
|
|
43670
|
-
|
|
43671
|
-
|
|
43672
|
-
|
|
43426
|
+
if (!text2.length) {
|
|
43427
|
+
return null;
|
|
43428
|
+
}
|
|
43429
|
+
if (this.re.schema_test.test(text2)) {
|
|
43430
|
+
re = this.re.schema_search;
|
|
43431
|
+
re.lastIndex = 0;
|
|
43432
|
+
while ((m = re.exec(text2)) !== null) {
|
|
43433
|
+
len = this.testSchemaAt(text2, m[2], re.lastIndex);
|
|
43434
|
+
if (len) {
|
|
43435
|
+
type_schemed.push({
|
|
43436
|
+
schema: m[2],
|
|
43437
|
+
index: m.index + m[1].length,
|
|
43438
|
+
lastIndex: m.index + m[0].length + len
|
|
43439
|
+
});
|
|
43440
|
+
}
|
|
43441
|
+
}
|
|
43442
|
+
}
|
|
43443
|
+
if (this.__opts__.fuzzyLink && this.__compiled__["http:"]) {
|
|
43444
|
+
re = this.__opts__.fuzzyIP ? this.re.link_fuzzy_global : this.re.link_no_ip_fuzzy_global;
|
|
43445
|
+
re.lastIndex = 0;
|
|
43446
|
+
while ((m = re.exec(text2)) !== null) {
|
|
43447
|
+
type_fuzzy_link.push({
|
|
43448
|
+
schema: "",
|
|
43449
|
+
index: m.index + m[1].length,
|
|
43450
|
+
lastIndex: m.index + m[0].length
|
|
43451
|
+
});
|
|
43452
|
+
}
|
|
43453
|
+
}
|
|
43454
|
+
if (this.__opts__.fuzzyEmail && this.__compiled__["mailto:"]) {
|
|
43455
|
+
re = this.re.email_fuzzy_global;
|
|
43456
|
+
re.lastIndex = 0;
|
|
43457
|
+
while ((m = re.exec(text2)) !== null) {
|
|
43458
|
+
type_fuzzy_email.push({
|
|
43459
|
+
schema: "mailto:",
|
|
43460
|
+
index: m.index + m[1].length,
|
|
43461
|
+
lastIndex: m.index + m[0].length
|
|
43462
|
+
});
|
|
43463
|
+
}
|
|
43464
|
+
}
|
|
43465
|
+
const indexes = [0, 0, 0];
|
|
43466
|
+
let lastIndex = 0;
|
|
43467
|
+
for (; ; ) {
|
|
43468
|
+
const candidates = [
|
|
43469
|
+
type_schemed[indexes[0]],
|
|
43470
|
+
type_fuzzy_email[indexes[1]],
|
|
43471
|
+
type_fuzzy_link[indexes[2]]
|
|
43472
|
+
];
|
|
43473
|
+
const candidate = choose(choose(candidates[0], candidates[1]), candidates[2]);
|
|
43474
|
+
if (!candidate) {
|
|
43475
|
+
break;
|
|
43476
|
+
}
|
|
43477
|
+
if (candidate === candidates[0]) {
|
|
43478
|
+
indexes[0]++;
|
|
43479
|
+
} else if (candidate === candidates[1]) {
|
|
43480
|
+
indexes[1]++;
|
|
43481
|
+
} else {
|
|
43482
|
+
indexes[2]++;
|
|
43483
|
+
}
|
|
43484
|
+
if (candidate.index < lastIndex) {
|
|
43485
|
+
continue;
|
|
43486
|
+
}
|
|
43487
|
+
const match2 = new Match(text2, candidate.schema, candidate.index, candidate.lastIndex);
|
|
43488
|
+
this.__compiled__[match2.schema].normalize(match2, this);
|
|
43489
|
+
result.push(match2);
|
|
43490
|
+
lastIndex = candidate.lastIndex;
|
|
43673
43491
|
}
|
|
43674
43492
|
if (result.length) {
|
|
43675
43493
|
return result;
|
|
@@ -43677,17 +43495,14 @@ LinkifyIt.prototype.match = function match(text2) {
|
|
|
43677
43495
|
return null;
|
|
43678
43496
|
};
|
|
43679
43497
|
LinkifyIt.prototype.matchAtStart = function matchAtStart(text2) {
|
|
43680
|
-
this.__text_cache__ = text2;
|
|
43681
|
-
this.__index__ = -1;
|
|
43682
43498
|
if (!text2.length) return null;
|
|
43683
43499
|
const m = this.re.schema_at_start.exec(text2);
|
|
43684
43500
|
if (!m) return null;
|
|
43685
43501
|
const len = this.testSchemaAt(text2, m[2], m[0].length);
|
|
43686
43502
|
if (!len) return null;
|
|
43687
|
-
|
|
43688
|
-
this.
|
|
43689
|
-
|
|
43690
|
-
return createMatch(this, 0);
|
|
43503
|
+
const match2 = new Match(text2, m[2], m.index + m[1].length, m.index + m[0].length + len);
|
|
43504
|
+
this.__compiled__[match2.schema].normalize(match2, this);
|
|
43505
|
+
return match2;
|
|
43691
43506
|
};
|
|
43692
43507
|
LinkifyIt.prototype.tlds = function tlds2(list2, keepOld) {
|
|
43693
43508
|
list2 = Array.isArray(list2) ? list2 : [list2];
|
|
@@ -47664,7 +47479,7 @@ const ASSET_TYPE_ALIASES = {
|
|
|
47664
47479
|
presentation: "presentation",
|
|
47665
47480
|
sheet: "spreadsheet",
|
|
47666
47481
|
spreadsheet: "spreadsheet",
|
|
47667
|
-
|
|
47482
|
+
word_document: "document"
|
|
47668
47483
|
};
|
|
47669
47484
|
const isAthenaSpacesPath = (url) => url.pathname.replace(/\/+$/, "") === "/dashboard/spaces";
|
|
47670
47485
|
const normalizeAssetType = (value) => {
|
|
@@ -49560,6 +49375,149 @@ class Store {
|
|
|
49560
49375
|
}
|
|
49561
49376
|
var withSelector = { exports: {} };
|
|
49562
49377
|
var withSelector_production = {};
|
|
49378
|
+
var shim = { exports: {} };
|
|
49379
|
+
var useSyncExternalStoreShim_production = {};
|
|
49380
|
+
/**
|
|
49381
|
+
* @license React
|
|
49382
|
+
* use-sync-external-store-shim.production.js
|
|
49383
|
+
*
|
|
49384
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49385
|
+
*
|
|
49386
|
+
* This source code is licensed under the MIT license found in the
|
|
49387
|
+
* LICENSE file in the root directory of this source tree.
|
|
49388
|
+
*/
|
|
49389
|
+
var hasRequiredUseSyncExternalStoreShim_production;
|
|
49390
|
+
function requireUseSyncExternalStoreShim_production() {
|
|
49391
|
+
if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
|
|
49392
|
+
hasRequiredUseSyncExternalStoreShim_production = 1;
|
|
49393
|
+
var React2 = React__default;
|
|
49394
|
+
function is(x, y) {
|
|
49395
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
49396
|
+
}
|
|
49397
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React2.useState, useEffect2 = React2.useEffect, useLayoutEffect3 = React2.useLayoutEffect, useDebugValue2 = React2.useDebugValue;
|
|
49398
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
49399
|
+
var value = getSnapshot(), _useState = useState2({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
49400
|
+
useLayoutEffect3(
|
|
49401
|
+
function() {
|
|
49402
|
+
inst.value = value;
|
|
49403
|
+
inst.getSnapshot = getSnapshot;
|
|
49404
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49405
|
+
},
|
|
49406
|
+
[subscribe, value, getSnapshot]
|
|
49407
|
+
);
|
|
49408
|
+
useEffect2(
|
|
49409
|
+
function() {
|
|
49410
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49411
|
+
return subscribe(function() {
|
|
49412
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49413
|
+
});
|
|
49414
|
+
},
|
|
49415
|
+
[subscribe]
|
|
49416
|
+
);
|
|
49417
|
+
useDebugValue2(value);
|
|
49418
|
+
return value;
|
|
49419
|
+
}
|
|
49420
|
+
function checkIfSnapshotChanged(inst) {
|
|
49421
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
49422
|
+
inst = inst.value;
|
|
49423
|
+
try {
|
|
49424
|
+
var nextValue = latestGetSnapshot();
|
|
49425
|
+
return !objectIs(inst, nextValue);
|
|
49426
|
+
} catch (error2) {
|
|
49427
|
+
return true;
|
|
49428
|
+
}
|
|
49429
|
+
}
|
|
49430
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
49431
|
+
return getSnapshot();
|
|
49432
|
+
}
|
|
49433
|
+
var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
49434
|
+
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
|
|
49435
|
+
return useSyncExternalStoreShim_production;
|
|
49436
|
+
}
|
|
49437
|
+
var useSyncExternalStoreShim_development = {};
|
|
49438
|
+
/**
|
|
49439
|
+
* @license React
|
|
49440
|
+
* use-sync-external-store-shim.development.js
|
|
49441
|
+
*
|
|
49442
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
49443
|
+
*
|
|
49444
|
+
* This source code is licensed under the MIT license found in the
|
|
49445
|
+
* LICENSE file in the root directory of this source tree.
|
|
49446
|
+
*/
|
|
49447
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
49448
|
+
function requireUseSyncExternalStoreShim_development() {
|
|
49449
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
49450
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
49451
|
+
"production" !== process.env.NODE_ENV && (function() {
|
|
49452
|
+
function is(x, y) {
|
|
49453
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
49454
|
+
}
|
|
49455
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
49456
|
+
didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, console.error(
|
|
49457
|
+
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
49458
|
+
));
|
|
49459
|
+
var value = getSnapshot();
|
|
49460
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
49461
|
+
var cachedValue = getSnapshot();
|
|
49462
|
+
objectIs(value, cachedValue) || (console.error(
|
|
49463
|
+
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
49464
|
+
), didWarnUncachedGetSnapshot = true);
|
|
49465
|
+
}
|
|
49466
|
+
cachedValue = useState2({
|
|
49467
|
+
inst: { value, getSnapshot }
|
|
49468
|
+
});
|
|
49469
|
+
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
49470
|
+
useLayoutEffect3(
|
|
49471
|
+
function() {
|
|
49472
|
+
inst.value = value;
|
|
49473
|
+
inst.getSnapshot = getSnapshot;
|
|
49474
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49475
|
+
},
|
|
49476
|
+
[subscribe, value, getSnapshot]
|
|
49477
|
+
);
|
|
49478
|
+
useEffect2(
|
|
49479
|
+
function() {
|
|
49480
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49481
|
+
return subscribe(function() {
|
|
49482
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
49483
|
+
});
|
|
49484
|
+
},
|
|
49485
|
+
[subscribe]
|
|
49486
|
+
);
|
|
49487
|
+
useDebugValue2(value);
|
|
49488
|
+
return value;
|
|
49489
|
+
}
|
|
49490
|
+
function checkIfSnapshotChanged(inst) {
|
|
49491
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
49492
|
+
inst = inst.value;
|
|
49493
|
+
try {
|
|
49494
|
+
var nextValue = latestGetSnapshot();
|
|
49495
|
+
return !objectIs(inst, nextValue);
|
|
49496
|
+
} catch (error2) {
|
|
49497
|
+
return true;
|
|
49498
|
+
}
|
|
49499
|
+
}
|
|
49500
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
49501
|
+
return getSnapshot();
|
|
49502
|
+
}
|
|
49503
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
49504
|
+
var React2 = React__default, objectIs = "function" === typeof Object.is ? Object.is : is, useState2 = React2.useState, useEffect2 = React2.useEffect, useLayoutEffect3 = React2.useLayoutEffect, useDebugValue2 = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
49505
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
|
|
49506
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
49507
|
+
})();
|
|
49508
|
+
return useSyncExternalStoreShim_development;
|
|
49509
|
+
}
|
|
49510
|
+
var hasRequiredShim;
|
|
49511
|
+
function requireShim() {
|
|
49512
|
+
if (hasRequiredShim) return shim.exports;
|
|
49513
|
+
hasRequiredShim = 1;
|
|
49514
|
+
if (process.env.NODE_ENV === "production") {
|
|
49515
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
49516
|
+
} else {
|
|
49517
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
49518
|
+
}
|
|
49519
|
+
return shim.exports;
|
|
49520
|
+
}
|
|
49563
49521
|
/**
|
|
49564
49522
|
* @license React
|
|
49565
49523
|
* use-sync-external-store-shim/with-selector.production.js
|
|
@@ -56254,6 +56212,35 @@ const AthenaUserMessage = ({
|
|
|
56254
56212
|
children: /* @__PURE__ */ jsx("div", { className: "aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground", children: /* @__PURE__ */ jsx(MessagePrimitive.Parts, { components: { Text: TextComponent } }) })
|
|
56255
56213
|
}
|
|
56256
56214
|
);
|
|
56215
|
+
const ATHENA_ASSET_EMBED_READY_MESSAGE = "athena:asset-embed-ready";
|
|
56216
|
+
const ATHENA_ASSET_EMBED_CONFIG_MESSAGE = "athena:asset-embed-config";
|
|
56217
|
+
const ATHENA_ASSET_CITATION_CLICK_MESSAGE = "athena:asset-citation-click";
|
|
56218
|
+
function resolveAthenaAssetCitationBehavior({
|
|
56219
|
+
citationBehavior,
|
|
56220
|
+
hasCitationClickHandler
|
|
56221
|
+
}) {
|
|
56222
|
+
if (citationBehavior === "host" && !hasCitationClickHandler) return "browser";
|
|
56223
|
+
return citationBehavior ?? (hasCitationClickHandler ? "host" : "browser");
|
|
56224
|
+
}
|
|
56225
|
+
function isAthenaAssetEmbedReadyEvent(value) {
|
|
56226
|
+
return typeof value === "object" && value !== null && "type" in value && value.type === ATHENA_ASSET_EMBED_READY_MESSAGE && "version" in value && value.version === 1;
|
|
56227
|
+
}
|
|
56228
|
+
function isAthenaAssetCitationClickEvent(value) {
|
|
56229
|
+
return typeof value === "object" && value !== null && "type" in value && value.type === ATHENA_ASSET_CITATION_CLICK_MESSAGE && "version" in value && value.version === 1 && "reference" in value && typeof value.reference === "object" && value.reference !== null && "id" in value.reference && typeof value.reference.id === "string";
|
|
56230
|
+
}
|
|
56231
|
+
function buildAssetEmbedRequestBody({
|
|
56232
|
+
assetId,
|
|
56233
|
+
readOnly,
|
|
56234
|
+
expiresInSeconds,
|
|
56235
|
+
displayMode
|
|
56236
|
+
}) {
|
|
56237
|
+
return {
|
|
56238
|
+
asset_id: assetId,
|
|
56239
|
+
read_only: readOnly,
|
|
56240
|
+
expires_in_seconds: expiresInSeconds,
|
|
56241
|
+
display_mode: displayMode
|
|
56242
|
+
};
|
|
56243
|
+
}
|
|
56257
56244
|
const embedCache = /* @__PURE__ */ new Map();
|
|
56258
56245
|
const ATHENA_APP_HOSTNAMES = /* @__PURE__ */ new Set(["app.athenaintel.com", "staging-app.athenaintel.com"]);
|
|
56259
56246
|
const ATHENA_PREVIEW_HOSTNAME_SUFFIX = ".previews.athenaintel.com";
|
|
@@ -56337,7 +56324,11 @@ function resolveAssetEmbedUrl({
|
|
|
56337
56324
|
if (!resolvedEmbedUrl.pathname.startsWith("/embed/")) {
|
|
56338
56325
|
return embedUrl;
|
|
56339
56326
|
}
|
|
56340
|
-
const embedAppUrl = resolveEmbedAppUrl({
|
|
56327
|
+
const embedAppUrl = resolveEmbedAppUrl({
|
|
56328
|
+
appUrl,
|
|
56329
|
+
backendUrl,
|
|
56330
|
+
currentOrigin
|
|
56331
|
+
});
|
|
56341
56332
|
if (!embedAppUrl) {
|
|
56342
56333
|
return embedUrl;
|
|
56343
56334
|
}
|
|
@@ -56349,12 +56340,48 @@ function resolveAssetEmbedUrl({
|
|
|
56349
56340
|
return embedUrl;
|
|
56350
56341
|
}
|
|
56351
56342
|
}
|
|
56343
|
+
function buildSdkAssetEmbedUrl(embedUrl) {
|
|
56344
|
+
try {
|
|
56345
|
+
const url = new URL(embedUrl);
|
|
56346
|
+
url.searchParams.set("athena_sdk_bridge", "1");
|
|
56347
|
+
return url.toString();
|
|
56348
|
+
} catch {
|
|
56349
|
+
return embedUrl;
|
|
56350
|
+
}
|
|
56351
|
+
}
|
|
56352
|
+
const getJwtPayload = (token) => {
|
|
56353
|
+
try {
|
|
56354
|
+
const payloadSegment = token.split(".")[1];
|
|
56355
|
+
if (!payloadSegment || typeof atob !== "function") return null;
|
|
56356
|
+
const normalized = payloadSegment.replace(/-/g, "+").replace(/_/g, "/");
|
|
56357
|
+
const payload = JSON.parse(
|
|
56358
|
+
atob(normalized.padEnd(normalized.length + (4 - normalized.length % 4) % 4, "="))
|
|
56359
|
+
);
|
|
56360
|
+
return payload && typeof payload === "object" ? payload : null;
|
|
56361
|
+
} catch {
|
|
56362
|
+
return null;
|
|
56363
|
+
}
|
|
56364
|
+
};
|
|
56365
|
+
function getAssetEmbedAuthContext({ token, apiKey }) {
|
|
56366
|
+
if (!token) return apiKey ? `api-key:${apiKey}` : "anonymous";
|
|
56367
|
+
const payload = getJwtPayload(token);
|
|
56368
|
+
const userId = (payload == null ? void 0 : payload.user_id) ?? (payload == null ? void 0 : payload.sub);
|
|
56369
|
+
if (typeof userId !== "string" || !userId) return `opaque-token:${token}`;
|
|
56370
|
+
return `jwt:${JSON.stringify({
|
|
56371
|
+
issuer: (payload == null ? void 0 : payload.iss) ?? null,
|
|
56372
|
+
userId,
|
|
56373
|
+
activeOrgId: (payload == null ? void 0 : payload.active_org_id) ?? (payload == null ? void 0 : payload.org_id) ?? null,
|
|
56374
|
+
workspaceId: (payload == null ? void 0 : payload.workspace_id) ?? null,
|
|
56375
|
+
orgMemberships: (payload == null ? void 0 : payload.org_id_to_org_member_info) ?? null
|
|
56376
|
+
})}`;
|
|
56377
|
+
}
|
|
56352
56378
|
function useAssetEmbed(assetId, options = {
|
|
56353
56379
|
backendUrl: ""
|
|
56354
56380
|
}) {
|
|
56355
56381
|
const {
|
|
56356
56382
|
readOnly = false,
|
|
56357
56383
|
expiresInSeconds = 60 * 60 * 24 * 30,
|
|
56384
|
+
displayMode = "minimal",
|
|
56358
56385
|
backendUrl,
|
|
56359
56386
|
appUrl,
|
|
56360
56387
|
apiKey,
|
|
@@ -56366,7 +56393,7 @@ function useAssetEmbed(assetId, options = {
|
|
|
56366
56393
|
const abortRef = useRef(null);
|
|
56367
56394
|
const tokenRef = useRef(token);
|
|
56368
56395
|
tokenRef.current = token;
|
|
56369
|
-
const
|
|
56396
|
+
const authContext = getAssetEmbedAuthContext({ token, apiKey });
|
|
56370
56397
|
useEffect(() => {
|
|
56371
56398
|
var _a2;
|
|
56372
56399
|
if (!assetId || !backendUrl) {
|
|
@@ -56375,8 +56402,7 @@ function useAssetEmbed(assetId, options = {
|
|
|
56375
56402
|
setError(null);
|
|
56376
56403
|
return;
|
|
56377
56404
|
}
|
|
56378
|
-
const
|
|
56379
|
-
const cacheKey = `${assetId}:${readOnly}:${authContext}:${backendUrl}:${appUrl ?? ""}`;
|
|
56405
|
+
const cacheKey = `${assetId}:${readOnly}:${displayMode}:${authContext}:${backendUrl}:${appUrl ?? ""}`;
|
|
56380
56406
|
const cached2 = embedCache.get(cacheKey);
|
|
56381
56407
|
if (cached2 && cached2.expiresAt > Date.now() / 1e3) {
|
|
56382
56408
|
setEmbedUrl(cached2.url);
|
|
@@ -56391,21 +56417,26 @@ function useAssetEmbed(assetId, options = {
|
|
|
56391
56417
|
abortRef.current = controller;
|
|
56392
56418
|
setIsLoading(true);
|
|
56393
56419
|
setError(null);
|
|
56394
|
-
const headers = {
|
|
56420
|
+
const headers = {
|
|
56421
|
+
"Content-Type": "application/json"
|
|
56422
|
+
};
|
|
56395
56423
|
const currentToken = tokenRef.current;
|
|
56396
56424
|
if (currentToken) {
|
|
56397
|
-
headers
|
|
56425
|
+
headers.Authorization = `Bearer ${currentToken}`;
|
|
56398
56426
|
} else if (apiKey) {
|
|
56399
56427
|
headers["X-API-KEY"] = apiKey;
|
|
56400
56428
|
}
|
|
56401
56429
|
fetch(endpoint, {
|
|
56402
56430
|
method: "POST",
|
|
56403
56431
|
headers,
|
|
56404
|
-
body: JSON.stringify(
|
|
56405
|
-
|
|
56406
|
-
|
|
56407
|
-
|
|
56408
|
-
|
|
56432
|
+
body: JSON.stringify(
|
|
56433
|
+
buildAssetEmbedRequestBody({
|
|
56434
|
+
assetId,
|
|
56435
|
+
readOnly,
|
|
56436
|
+
expiresInSeconds,
|
|
56437
|
+
displayMode
|
|
56438
|
+
})
|
|
56439
|
+
),
|
|
56409
56440
|
signal: controller.signal
|
|
56410
56441
|
}).then(async (res) => {
|
|
56411
56442
|
if (!res.ok) {
|
|
@@ -56419,7 +56450,10 @@ function useAssetEmbed(assetId, options = {
|
|
|
56419
56450
|
appUrl,
|
|
56420
56451
|
backendUrl
|
|
56421
56452
|
});
|
|
56422
|
-
embedCache.set(cacheKey, {
|
|
56453
|
+
embedCache.set(cacheKey, {
|
|
56454
|
+
url: resolvedEmbedUrl,
|
|
56455
|
+
expiresAt: data.expires_at
|
|
56456
|
+
});
|
|
56423
56457
|
setEmbedUrl(resolvedEmbedUrl);
|
|
56424
56458
|
setIsLoading(false);
|
|
56425
56459
|
}).catch((err) => {
|
|
@@ -56428,9 +56462,134 @@ function useAssetEmbed(assetId, options = {
|
|
|
56428
56462
|
setIsLoading(false);
|
|
56429
56463
|
});
|
|
56430
56464
|
return () => controller.abort();
|
|
56431
|
-
}, [assetId, readOnly, expiresInSeconds, backendUrl, appUrl,
|
|
56465
|
+
}, [assetId, readOnly, expiresInSeconds, displayMode, backendUrl, appUrl, authContext, apiKey]);
|
|
56432
56466
|
return { embedUrl, isLoading, error: error2 };
|
|
56433
56467
|
}
|
|
56468
|
+
const DEFAULT_STYLE = {
|
|
56469
|
+
width: "100%",
|
|
56470
|
+
height: "100%",
|
|
56471
|
+
border: 0
|
|
56472
|
+
};
|
|
56473
|
+
const AUTH_SYNC_INTERVAL_MS = 6e4;
|
|
56474
|
+
const AthenaAssetEmbed = ({
|
|
56475
|
+
assetId,
|
|
56476
|
+
displayMode = "full",
|
|
56477
|
+
readOnly = true,
|
|
56478
|
+
expiresInSeconds,
|
|
56479
|
+
citationBehavior,
|
|
56480
|
+
onCitationClick,
|
|
56481
|
+
onLoad,
|
|
56482
|
+
onError,
|
|
56483
|
+
loadingFallback,
|
|
56484
|
+
errorFallback,
|
|
56485
|
+
className,
|
|
56486
|
+
style: style2,
|
|
56487
|
+
title,
|
|
56488
|
+
allow = "fullscreen",
|
|
56489
|
+
...iframeProps
|
|
56490
|
+
}) => {
|
|
56491
|
+
const iframeRef = useRef(null);
|
|
56492
|
+
const athenaConfig = useAthenaConfig();
|
|
56493
|
+
const { backendUrl, appUrl, apiKey } = athenaConfig;
|
|
56494
|
+
const { embedUrl, isLoading, error: error2 } = useAssetEmbed(assetId, {
|
|
56495
|
+
backendUrl,
|
|
56496
|
+
appUrl,
|
|
56497
|
+
apiKey,
|
|
56498
|
+
token: athenaConfig.token,
|
|
56499
|
+
readOnly,
|
|
56500
|
+
expiresInSeconds,
|
|
56501
|
+
displayMode
|
|
56502
|
+
});
|
|
56503
|
+
const targetOrigin = useMemo(() => {
|
|
56504
|
+
if (!embedUrl) return null;
|
|
56505
|
+
try {
|
|
56506
|
+
return new URL(embedUrl, window.location.href).origin;
|
|
56507
|
+
} catch {
|
|
56508
|
+
return null;
|
|
56509
|
+
}
|
|
56510
|
+
}, [embedUrl]);
|
|
56511
|
+
const iframeSrc = useMemo(() => embedUrl ? buildSdkAssetEmbedUrl(embedUrl) : null, [embedUrl]);
|
|
56512
|
+
const effectiveCitationBehavior = resolveAthenaAssetCitationBehavior({
|
|
56513
|
+
citationBehavior,
|
|
56514
|
+
hasCitationClickHandler: !!onCitationClick
|
|
56515
|
+
});
|
|
56516
|
+
const sendConfig = useCallback(() => {
|
|
56517
|
+
var _a2, _b;
|
|
56518
|
+
if (!targetOrigin) return;
|
|
56519
|
+
(_b = (_a2 = iframeRef.current) == null ? void 0 : _a2.contentWindow) == null ? void 0 : _b.postMessage(
|
|
56520
|
+
{
|
|
56521
|
+
type: ATHENA_ASSET_EMBED_CONFIG_MESSAGE,
|
|
56522
|
+
version: 1,
|
|
56523
|
+
...athenaConfig.token ? { token: athenaConfig.token } : {},
|
|
56524
|
+
citationBehavior: effectiveCitationBehavior
|
|
56525
|
+
},
|
|
56526
|
+
targetOrigin
|
|
56527
|
+
);
|
|
56528
|
+
}, [athenaConfig, effectiveCitationBehavior, targetOrigin]);
|
|
56529
|
+
useEffect(() => {
|
|
56530
|
+
if (!embedUrl || !targetOrigin) return;
|
|
56531
|
+
const handleMessage = (event) => {
|
|
56532
|
+
var _a2;
|
|
56533
|
+
if (event.origin !== targetOrigin || event.source !== ((_a2 = iframeRef.current) == null ? void 0 : _a2.contentWindow)) return;
|
|
56534
|
+
if (isAthenaAssetEmbedReadyEvent(event.data)) {
|
|
56535
|
+
sendConfig();
|
|
56536
|
+
return;
|
|
56537
|
+
}
|
|
56538
|
+
if (isAthenaAssetCitationClickEvent(event.data)) {
|
|
56539
|
+
onCitationClick == null ? void 0 : onCitationClick(event.data);
|
|
56540
|
+
}
|
|
56541
|
+
};
|
|
56542
|
+
window.addEventListener("message", handleMessage);
|
|
56543
|
+
return () => window.removeEventListener("message", handleMessage);
|
|
56544
|
+
}, [embedUrl, onCitationClick, sendConfig, targetOrigin]);
|
|
56545
|
+
useEffect(() => {
|
|
56546
|
+
if (!embedUrl) return;
|
|
56547
|
+
sendConfig();
|
|
56548
|
+
const interval = window.setInterval(sendConfig, AUTH_SYNC_INTERVAL_MS);
|
|
56549
|
+
return () => window.clearInterval(interval);
|
|
56550
|
+
}, [embedUrl, sendConfig]);
|
|
56551
|
+
useEffect(() => {
|
|
56552
|
+
if (error2) onError == null ? void 0 : onError(new Error(error2));
|
|
56553
|
+
}, [error2, onError]);
|
|
56554
|
+
if (isLoading) {
|
|
56555
|
+
return loadingFallback ?? /* @__PURE__ */ jsxs("output", { className: "flex h-full w-full items-center justify-center", children: [
|
|
56556
|
+
/* @__PURE__ */ jsx(LoaderCircle, { className: "size-6 animate-spin text-muted-foreground" }),
|
|
56557
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading asset" })
|
|
56558
|
+
] });
|
|
56559
|
+
}
|
|
56560
|
+
if (error2) {
|
|
56561
|
+
const embedError = new Error(error2);
|
|
56562
|
+
if (typeof errorFallback === "function") return errorFallback(embedError);
|
|
56563
|
+
return errorFallback ?? /* @__PURE__ */ jsxs(
|
|
56564
|
+
"div",
|
|
56565
|
+
{
|
|
56566
|
+
className: "flex h-full w-full items-center justify-center gap-2 p-4 text-sm text-muted-foreground",
|
|
56567
|
+
role: "alert",
|
|
56568
|
+
children: [
|
|
56569
|
+
/* @__PURE__ */ jsx(CircleAlert, { className: "size-4 text-destructive" }),
|
|
56570
|
+
/* @__PURE__ */ jsx("span", { children: error2 })
|
|
56571
|
+
]
|
|
56572
|
+
}
|
|
56573
|
+
);
|
|
56574
|
+
}
|
|
56575
|
+
if (!embedUrl) return null;
|
|
56576
|
+
return /* @__PURE__ */ jsx(
|
|
56577
|
+
"iframe",
|
|
56578
|
+
{
|
|
56579
|
+
...iframeProps,
|
|
56580
|
+
ref: iframeRef,
|
|
56581
|
+
src: iframeSrc ?? void 0,
|
|
56582
|
+
title: title ?? `Athena asset ${assetId}`,
|
|
56583
|
+
allow,
|
|
56584
|
+
className: cn("block h-full w-full", className),
|
|
56585
|
+
style: { ...DEFAULT_STYLE, ...style2 },
|
|
56586
|
+
onLoad: () => {
|
|
56587
|
+
sendConfig();
|
|
56588
|
+
onLoad == null ? void 0 : onLoad();
|
|
56589
|
+
}
|
|
56590
|
+
}
|
|
56591
|
+
);
|
|
56592
|
+
};
|
|
56434
56593
|
const ABSOLUTE_URL_PATTERN = /^[a-zA-Z][a-zA-Z\d+\-.]*:/;
|
|
56435
56594
|
function buildAssetIframeSrc({
|
|
56436
56595
|
embedUrl,
|
|
@@ -56859,6 +57018,7 @@ function useComposerAttachment() {
|
|
|
56859
57018
|
export {
|
|
56860
57019
|
AppendDocumentToolUI,
|
|
56861
57020
|
AssetPanel,
|
|
57021
|
+
AthenaAssetEmbed,
|
|
56862
57022
|
AthenaAssistantActionBar,
|
|
56863
57023
|
AthenaAssistantMessage,
|
|
56864
57024
|
AthenaChat,
|
|
@@ -56926,7 +57086,10 @@ export {
|
|
|
56926
57086
|
cn,
|
|
56927
57087
|
convertLangChainToThreadMessages,
|
|
56928
57088
|
createAssetToolUI,
|
|
57089
|
+
createAthenaSpacesUrl,
|
|
56929
57090
|
createThread,
|
|
57091
|
+
deriveAthenaApiUrl,
|
|
57092
|
+
deriveAthenaAppUrl,
|
|
56930
57093
|
formatToolName,
|
|
56931
57094
|
getAssetInfo,
|
|
56932
57095
|
getPostHogInstance,
|