@modelcontextprotocol/inspector 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/client/bin/start.js +10 -1
- package/client/dist/assets/{OAuthCallback-at8T3Iwi.js → OAuthCallback-jbB02Bt3.js} +6 -2
- package/client/dist/assets/{OAuthDebugCallback-ZJ9hxfpr.js → OAuthDebugCallback-VeJ8bP3s.js} +1 -1
- package/client/dist/assets/{index-DdyO6kfY.js → index-C2CDzlVy.js} +1505 -745
- package/client/dist/index.html +1 -1
- package/package.json +4 -4
- package/server/build/env-flags.js +21 -0
- package/server/build/fetch-metadata.js +47 -0
- package/server/build/index.js +49 -36
- package/server/build/log-format.js +48 -0
- package/server/build/proxy-redirect.js +123 -0
- package/server/build/proxy-response.js +81 -0
- package/server/build/request-guards.js +83 -0
|
@@ -7161,32 +7161,32 @@ function useToast() {
|
|
|
7161
7161
|
};
|
|
7162
7162
|
}
|
|
7163
7163
|
var reactDomExports = requireReactDom();
|
|
7164
|
-
var __defProp$
|
|
7165
|
-
var __name$
|
|
7164
|
+
var __defProp$u = Object.defineProperty;
|
|
7165
|
+
var __name$u = (target, value) => __defProp$u(target, "name", { value, configurable: true });
|
|
7166
7166
|
var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
7167
7167
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
7168
|
-
return /* @__PURE__ */ __name$
|
|
7168
|
+
return /* @__PURE__ */ __name$u(function handleEvent(event) {
|
|
7169
7169
|
originalEventHandler?.(event);
|
|
7170
7170
|
if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {
|
|
7171
7171
|
return ourEventHandler?.(event);
|
|
7172
7172
|
}
|
|
7173
7173
|
}, "handleEvent");
|
|
7174
7174
|
}
|
|
7175
|
-
__name$
|
|
7175
|
+
__name$u(composeEventHandlers, "composeEventHandlers");
|
|
7176
7176
|
function getOwnerWindow(element) {
|
|
7177
7177
|
if (!canUseDOM) {
|
|
7178
7178
|
throw new Error("Cannot access window outside of the DOM");
|
|
7179
7179
|
}
|
|
7180
7180
|
return element?.ownerDocument?.defaultView ?? window;
|
|
7181
7181
|
}
|
|
7182
|
-
__name$
|
|
7182
|
+
__name$u(getOwnerWindow, "getOwnerWindow");
|
|
7183
7183
|
function getOwnerDocument(element) {
|
|
7184
7184
|
if (!canUseDOM) {
|
|
7185
7185
|
throw new Error("Cannot access document outside of the DOM");
|
|
7186
7186
|
}
|
|
7187
7187
|
return element?.ownerDocument ?? document;
|
|
7188
7188
|
}
|
|
7189
|
-
__name$
|
|
7189
|
+
__name$u(getOwnerDocument, "getOwnerDocument");
|
|
7190
7190
|
function getActiveElement(node, activeDescendant = false) {
|
|
7191
7191
|
const { activeElement } = getOwnerDocument(node);
|
|
7192
7192
|
if (!activeElement?.nodeName) {
|
|
@@ -7206,13 +7206,13 @@ function getActiveElement(node, activeDescendant = false) {
|
|
|
7206
7206
|
}
|
|
7207
7207
|
return activeElement;
|
|
7208
7208
|
}
|
|
7209
|
-
__name$
|
|
7209
|
+
__name$u(getActiveElement, "getActiveElement");
|
|
7210
7210
|
function isFrame(element) {
|
|
7211
7211
|
return element.tagName === "IFRAME";
|
|
7212
7212
|
}
|
|
7213
|
-
__name$
|
|
7214
|
-
var __defProp$
|
|
7215
|
-
var __name$
|
|
7213
|
+
__name$u(isFrame, "isFrame");
|
|
7214
|
+
var __defProp$t = Object.defineProperty;
|
|
7215
|
+
var __name$t = (target, value) => __defProp$t(target, "name", { value, configurable: true });
|
|
7216
7216
|
function setRef$1(ref2, value) {
|
|
7217
7217
|
if (typeof ref2 === "function") {
|
|
7218
7218
|
return ref2(value);
|
|
@@ -7220,7 +7220,7 @@ function setRef$1(ref2, value) {
|
|
|
7220
7220
|
ref2.current = value;
|
|
7221
7221
|
}
|
|
7222
7222
|
}
|
|
7223
|
-
__name$
|
|
7223
|
+
__name$t(setRef$1, "setRef");
|
|
7224
7224
|
function composeRefs(...refs) {
|
|
7225
7225
|
return (node) => {
|
|
7226
7226
|
let hasCleanup = false;
|
|
@@ -7245,23 +7245,23 @@ function composeRefs(...refs) {
|
|
|
7245
7245
|
}
|
|
7246
7246
|
};
|
|
7247
7247
|
}
|
|
7248
|
-
__name$
|
|
7248
|
+
__name$t(composeRefs, "composeRefs");
|
|
7249
7249
|
function useComposedRefs(...refs) {
|
|
7250
7250
|
return reactExports.useCallback(composeRefs(...refs), refs);
|
|
7251
7251
|
}
|
|
7252
|
-
__name$
|
|
7253
|
-
var __defProp$
|
|
7254
|
-
var __name$
|
|
7252
|
+
__name$t(useComposedRefs, "useComposedRefs");
|
|
7253
|
+
var __defProp$s = Object.defineProperty;
|
|
7254
|
+
var __name$s = (target, value) => __defProp$s(target, "name", { value, configurable: true });
|
|
7255
7255
|
// @__NO_SIDE_EFFECTS__
|
|
7256
7256
|
function createContext2(rootComponentName, defaultContext) {
|
|
7257
7257
|
const Context = reactExports.createContext(defaultContext);
|
|
7258
7258
|
Context.displayName = rootComponentName + "Context";
|
|
7259
|
-
const
|
|
7259
|
+
const Provider = /* @__PURE__ */ __name$s((props) => {
|
|
7260
7260
|
const { children, ...context } = props;
|
|
7261
7261
|
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
7262
7262
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
7263
7263
|
}, "Provider");
|
|
7264
|
-
|
|
7264
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
7265
7265
|
function useContext2(consumerName, options2 = {}) {
|
|
7266
7266
|
const { optional: optional2 = false } = options2;
|
|
7267
7267
|
const context = reactExports.useContext(Context);
|
|
@@ -7270,10 +7270,10 @@ function createContext2(rootComponentName, defaultContext) {
|
|
|
7270
7270
|
if (optional2) return void 0;
|
|
7271
7271
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
7272
7272
|
}
|
|
7273
|
-
__name$
|
|
7274
|
-
return [
|
|
7273
|
+
__name$s(useContext2, "useContext");
|
|
7274
|
+
return [Provider, useContext2];
|
|
7275
7275
|
}
|
|
7276
|
-
__name$
|
|
7276
|
+
__name$s(createContext2, "createContext");
|
|
7277
7277
|
// @__NO_SIDE_EFFECTS__
|
|
7278
7278
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
7279
7279
|
let defaultContexts = [];
|
|
@@ -7282,13 +7282,13 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
7282
7282
|
BaseContext.displayName = rootComponentName + "Context";
|
|
7283
7283
|
const index2 = defaultContexts.length;
|
|
7284
7284
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
7285
|
-
const
|
|
7285
|
+
const Provider = /* @__PURE__ */ __name$s((props) => {
|
|
7286
7286
|
const { scope: scope2, children, ...context } = props;
|
|
7287
7287
|
const Context = scope2?.[scopeName]?.[index2] || BaseContext;
|
|
7288
7288
|
const value = reactExports.useMemo(() => context, Object.values(context));
|
|
7289
7289
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
7290
7290
|
}, "Provider");
|
|
7291
|
-
|
|
7291
|
+
Provider.displayName = rootComponentName + "Provider";
|
|
7292
7292
|
function useContext2(consumerName, scope2, options2 = {}) {
|
|
7293
7293
|
const { optional: optional2 = false } = options2;
|
|
7294
7294
|
const Context = scope2?.[scopeName]?.[index2] || BaseContext;
|
|
@@ -7298,15 +7298,15 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
7298
7298
|
if (optional2) return void 0;
|
|
7299
7299
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
7300
7300
|
}
|
|
7301
|
-
__name$
|
|
7302
|
-
return [
|
|
7301
|
+
__name$s(useContext2, "useContext");
|
|
7302
|
+
return [Provider, useContext2];
|
|
7303
7303
|
}
|
|
7304
|
-
__name$
|
|
7305
|
-
const createScope = /* @__PURE__ */ __name$
|
|
7304
|
+
__name$s(createContext3, "createContext");
|
|
7305
|
+
const createScope = /* @__PURE__ */ __name$s(() => {
|
|
7306
7306
|
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
7307
7307
|
return reactExports.createContext(defaultContext);
|
|
7308
7308
|
});
|
|
7309
|
-
return /* @__PURE__ */ __name$
|
|
7309
|
+
return /* @__PURE__ */ __name$s(function useScope(scope2) {
|
|
7310
7310
|
const contexts = scope2?.[scopeName] || scopeContexts;
|
|
7311
7311
|
return reactExports.useMemo(
|
|
7312
7312
|
() => ({ [`__scope${scopeName}`]: { ...scope2, [scopeName]: contexts } }),
|
|
@@ -7317,16 +7317,16 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
7317
7317
|
createScope.scopeName = scopeName;
|
|
7318
7318
|
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
7319
7319
|
}
|
|
7320
|
-
__name$
|
|
7320
|
+
__name$s(createContextScope, "createContextScope");
|
|
7321
7321
|
function composeContextScopes(...scopes) {
|
|
7322
7322
|
const baseScope = scopes[0];
|
|
7323
7323
|
if (scopes.length === 1) return baseScope;
|
|
7324
|
-
const createScope = /* @__PURE__ */ __name$
|
|
7324
|
+
const createScope = /* @__PURE__ */ __name$s(() => {
|
|
7325
7325
|
const scopeHooks = scopes.map((createScope2) => ({
|
|
7326
7326
|
useScope: createScope2(),
|
|
7327
7327
|
scopeName: createScope2.scopeName
|
|
7328
7328
|
}));
|
|
7329
|
-
return /* @__PURE__ */ __name$
|
|
7329
|
+
return /* @__PURE__ */ __name$s(function useComposedScopes(overrideScopes) {
|
|
7330
7330
|
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
7331
7331
|
const scopeProps = useScope(overrideScopes);
|
|
7332
7332
|
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
@@ -7338,9 +7338,9 @@ function composeContextScopes(...scopes) {
|
|
|
7338
7338
|
createScope.scopeName = baseScope.scopeName;
|
|
7339
7339
|
return createScope;
|
|
7340
7340
|
}
|
|
7341
|
-
__name$
|
|
7342
|
-
var __defProp$
|
|
7343
|
-
var __name$
|
|
7341
|
+
__name$s(composeContextScopes, "composeContextScopes");
|
|
7342
|
+
var __defProp$r = Object.defineProperty;
|
|
7343
|
+
var __name$r = (target, value) => __defProp$r(target, "name", { value, configurable: true });
|
|
7344
7344
|
// @__NO_SIDE_EFFECTS__
|
|
7345
7345
|
function createSlot(ownerName) {
|
|
7346
7346
|
const Slot2 = reactExports.forwardRef((props, forwardedRef) => {
|
|
@@ -7348,15 +7348,13 @@ function createSlot(ownerName) {
|
|
|
7348
7348
|
let slottableElement = null;
|
|
7349
7349
|
let hasSlottable = false;
|
|
7350
7350
|
const newChildren = [];
|
|
7351
|
-
|
|
7352
|
-
children = use(children._payload);
|
|
7353
|
-
}
|
|
7351
|
+
children = useUnwrappedLazy(children);
|
|
7354
7352
|
reactExports.Children.forEach(children, (maybeSlottable) => {
|
|
7355
7353
|
if (isSlottable(maybeSlottable)) {
|
|
7356
7354
|
hasSlottable = true;
|
|
7357
7355
|
const slottable = maybeSlottable;
|
|
7358
7356
|
let child = "child" in slottable.props ? slottable.props.child : slottable.props.children;
|
|
7359
|
-
|
|
7357
|
+
while (isLazyComponent(child) && typeof use === "function") {
|
|
7360
7358
|
child = use(child._payload);
|
|
7361
7359
|
}
|
|
7362
7360
|
slottableElement = getSlottableElementFromSlottable(slottable, child);
|
|
@@ -7395,22 +7393,21 @@ function createSlot(ownerName) {
|
|
|
7395
7393
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
7396
7394
|
return Slot2;
|
|
7397
7395
|
}
|
|
7398
|
-
__name$
|
|
7396
|
+
__name$r(createSlot, "createSlot");
|
|
7399
7397
|
var Slot$3 = /* @__PURE__ */ createSlot("Slot");
|
|
7400
7398
|
var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol.for("radix.slottable");
|
|
7401
7399
|
// @__NO_SIDE_EFFECTS__
|
|
7402
7400
|
function createSlottable(ownerName) {
|
|
7403
|
-
const Slottable2 = /* @__PURE__ */ __name$
|
|
7401
|
+
const Slottable2 = /* @__PURE__ */ __name$r((props) => "child" in props ? props.children(props.child) : props.children, "Slottable");
|
|
7404
7402
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
7405
7403
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
7406
7404
|
return Slottable2;
|
|
7407
7405
|
}
|
|
7408
|
-
__name$
|
|
7409
|
-
var getSlottableElementFromSlottable = /* @__PURE__ */ __name$
|
|
7406
|
+
__name$r(createSlottable, "createSlottable");
|
|
7407
|
+
var getSlottableElementFromSlottable = /* @__PURE__ */ __name$r((slottable, child) => {
|
|
7410
7408
|
if ("child" in slottable.props) {
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
return reactExports.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
7409
|
+
if (!reactExports.isValidElement(child)) return null;
|
|
7410
|
+
return reactExports.cloneElement(child, void 0, slottable.props.children(child.props.children));
|
|
7414
7411
|
}
|
|
7415
7412
|
return reactExports.isValidElement(child) ? child : null;
|
|
7416
7413
|
}, "getSlottableElementFromSlottable");
|
|
@@ -7434,11 +7431,13 @@ function mergeProps(slotProps, childProps) {
|
|
|
7434
7431
|
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
7435
7432
|
} else if (propName === "className") {
|
|
7436
7433
|
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
7434
|
+
} else if (propName === "aria-describedby") {
|
|
7435
|
+
overrideProps[propName] = concatAriaDescribedby$3(childPropValue, slotPropValue);
|
|
7437
7436
|
}
|
|
7438
7437
|
}
|
|
7439
7438
|
return { ...slotProps, ...overrideProps };
|
|
7440
7439
|
}
|
|
7441
|
-
__name$
|
|
7440
|
+
__name$r(mergeProps, "mergeProps");
|
|
7442
7441
|
function getElementRef$1(element) {
|
|
7443
7442
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
7444
7443
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -7452,29 +7451,50 @@ function getElementRef$1(element) {
|
|
|
7452
7451
|
}
|
|
7453
7452
|
return element.props.ref || element.ref;
|
|
7454
7453
|
}
|
|
7455
|
-
__name$
|
|
7454
|
+
__name$r(getElementRef$1, "getElementRef");
|
|
7456
7455
|
function isSlottable(child) {
|
|
7457
7456
|
return reactExports.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
7458
7457
|
}
|
|
7459
|
-
__name$
|
|
7458
|
+
__name$r(isSlottable, "isSlottable");
|
|
7460
7459
|
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
7461
7460
|
function isLazyComponent(element) {
|
|
7462
7461
|
return element != null && typeof element === "object" && "$$typeof" in element && element.$$typeof === REACT_LAZY_TYPE && "_payload" in element && isPromiseLike(element._payload);
|
|
7463
7462
|
}
|
|
7464
|
-
__name$
|
|
7463
|
+
__name$r(isLazyComponent, "isLazyComponent");
|
|
7465
7464
|
function isPromiseLike(value) {
|
|
7466
7465
|
return typeof value === "object" && value !== null && "then" in value;
|
|
7467
7466
|
}
|
|
7468
|
-
__name$
|
|
7469
|
-
|
|
7467
|
+
__name$r(isPromiseLike, "isPromiseLike");
|
|
7468
|
+
function useUnwrappedLazy(value) {
|
|
7469
|
+
let unwrapped = value;
|
|
7470
|
+
while (isLazyComponent(unwrapped) && typeof use === "function") {
|
|
7471
|
+
unwrapped = use(unwrapped._payload);
|
|
7472
|
+
}
|
|
7473
|
+
return unwrapped;
|
|
7474
|
+
}
|
|
7475
|
+
__name$r(useUnwrappedLazy, "useUnwrappedLazy");
|
|
7476
|
+
function concatAriaDescribedby$3(...values) {
|
|
7477
|
+
const ids = /* @__PURE__ */ new Set();
|
|
7478
|
+
for (const value of values) {
|
|
7479
|
+
if (typeof value !== "string") continue;
|
|
7480
|
+
for (const id2 of String(value).trim().split(/\s+/)) {
|
|
7481
|
+
if (id2) ids.add(id2);
|
|
7482
|
+
}
|
|
7483
|
+
}
|
|
7484
|
+
return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
|
|
7485
|
+
}
|
|
7486
|
+
__name$r(concatAriaDescribedby$3, "concatAriaDescribedby");
|
|
7487
|
+
var createSlotError = /* @__PURE__ */ __name$r((ownerName) => {
|
|
7470
7488
|
return `${ownerName} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`;
|
|
7471
7489
|
}, "createSlotError");
|
|
7472
|
-
var createSlottableError = /* @__PURE__ */ __name$
|
|
7490
|
+
var createSlottableError = /* @__PURE__ */ __name$r((ownerName) => {
|
|
7473
7491
|
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
7474
7492
|
}, "createSlottableError");
|
|
7475
7493
|
var use = React2[" use ".trim().toString()];
|
|
7476
|
-
var
|
|
7477
|
-
|
|
7494
|
+
var useLayoutEffect2 = globalThis?.document ? reactExports.useLayoutEffect : () => {
|
|
7495
|
+
};
|
|
7496
|
+
var __defProp$q = Object.defineProperty;
|
|
7497
|
+
var __name$q = (target, value) => __defProp$q(target, "name", { value, configurable: true });
|
|
7478
7498
|
// @__NO_SIDE_EFFECTS__
|
|
7479
7499
|
function createCollection(name2) {
|
|
7480
7500
|
const PROVIDER_NAME2 = name2 + "CollectionProvider";
|
|
@@ -7483,7 +7503,7 @@ function createCollection(name2) {
|
|
|
7483
7503
|
PROVIDER_NAME2,
|
|
7484
7504
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
7485
7505
|
);
|
|
7486
|
-
const CollectionProvider = /* @__PURE__ */ __name$
|
|
7506
|
+
const CollectionProvider = /* @__PURE__ */ __name$q((props) => {
|
|
7487
7507
|
const { scope: scope2, children } = props;
|
|
7488
7508
|
const ref2 = reactExports.useRef(null);
|
|
7489
7509
|
const itemMap = reactExports.useRef(/* @__PURE__ */ new Map()).current;
|
|
@@ -7532,14 +7552,14 @@ function createCollection(name2) {
|
|
|
7532
7552
|
}, [context.collectionRef, context.itemMap]);
|
|
7533
7553
|
return getItems;
|
|
7534
7554
|
}
|
|
7535
|
-
__name$
|
|
7555
|
+
__name$q(useCollection2, "useCollection");
|
|
7536
7556
|
return [
|
|
7537
7557
|
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
7538
7558
|
useCollection2,
|
|
7539
7559
|
createCollectionScope2
|
|
7540
7560
|
];
|
|
7541
7561
|
}
|
|
7542
|
-
__name$
|
|
7562
|
+
__name$q(createCollection, "createCollection");
|
|
7543
7563
|
var __instanciated = /* @__PURE__ */ new WeakMap();
|
|
7544
7564
|
var OrderedDict = (_a = class extends Map {
|
|
7545
7565
|
constructor(entries) {
|
|
@@ -7549,54 +7569,37 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7549
7569
|
__instanciated.set(this, true);
|
|
7550
7570
|
}
|
|
7551
7571
|
set(key, value) {
|
|
7552
|
-
if (__instanciated.get(this)) {
|
|
7553
|
-
|
|
7554
|
-
__privateGet(this, _keys)[__privateGet(this, _keys).indexOf(key)] = key;
|
|
7555
|
-
} else {
|
|
7556
|
-
__privateGet(this, _keys).push(key);
|
|
7557
|
-
}
|
|
7572
|
+
if (__instanciated.get(this) && !this.has(key)) {
|
|
7573
|
+
__privateGet(this, _keys).push(key);
|
|
7558
7574
|
}
|
|
7559
7575
|
super.set(key, value);
|
|
7560
7576
|
return this;
|
|
7561
7577
|
}
|
|
7578
|
+
/**
|
|
7579
|
+
* Sets a key-value pair so that it ends up at the given index.
|
|
7580
|
+
* - Existing keys are moved
|
|
7581
|
+
* - Negative indices count from the end of the resulting dictionary, so
|
|
7582
|
+
* inserting at -1 makes the item the last one, -2 the second to last, etc.
|
|
7583
|
+
* - Out-of-range indices are clamped
|
|
7584
|
+
*/
|
|
7562
7585
|
insert(index2, key, value) {
|
|
7563
7586
|
const has = this.has(key);
|
|
7564
|
-
const
|
|
7587
|
+
const finalSize = has ? this.size : this.size + 1;
|
|
7565
7588
|
const relativeIndex = toSafeInteger(index2);
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {
|
|
7589
|
+
const targetIndex = relativeIndex >= 0 ? Math.min(relativeIndex, finalSize - 1) : Math.max(finalSize + relativeIndex, 0);
|
|
7590
|
+
if (has ? __privateGet(this, _keys).indexOf(key) === targetIndex : targetIndex === this.size) {
|
|
7569
7591
|
this.set(key, value);
|
|
7570
7592
|
return this;
|
|
7571
7593
|
}
|
|
7572
|
-
const
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
for (
|
|
7580
|
-
|
|
7581
|
-
let nextKey = keys[i2];
|
|
7582
|
-
if (keys[i2] === key) {
|
|
7583
|
-
nextKey = keys[i2 + 1];
|
|
7584
|
-
}
|
|
7585
|
-
if (has) {
|
|
7586
|
-
this.delete(key);
|
|
7587
|
-
}
|
|
7588
|
-
nextValue = this.get(nextKey);
|
|
7589
|
-
this.set(key, value);
|
|
7590
|
-
} else {
|
|
7591
|
-
if (!shouldSkip && keys[i2 - 1] === key) {
|
|
7592
|
-
shouldSkip = true;
|
|
7593
|
-
}
|
|
7594
|
-
const currentKey = keys[shouldSkip ? i2 : i2 - 1];
|
|
7595
|
-
const currentValue = nextValue;
|
|
7596
|
-
nextValue = this.get(currentKey);
|
|
7597
|
-
this.delete(currentKey);
|
|
7598
|
-
this.set(currentKey, currentValue);
|
|
7599
|
-
}
|
|
7594
|
+
const keys = __privateGet(this, _keys).filter((existingKey) => existingKey !== key);
|
|
7595
|
+
keys.splice(targetIndex, 0, key);
|
|
7596
|
+
const entries = keys.map((entryKey) => [
|
|
7597
|
+
entryKey,
|
|
7598
|
+
entryKey === key ? value : this.get(entryKey)
|
|
7599
|
+
]);
|
|
7600
|
+
this.clear();
|
|
7601
|
+
for (const [entryKey, entryValue] of entries) {
|
|
7602
|
+
this.set(entryKey, entryValue);
|
|
7600
7603
|
}
|
|
7601
7604
|
return this;
|
|
7602
7605
|
}
|
|
@@ -7620,7 +7623,9 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7620
7623
|
if (index2 === -1) {
|
|
7621
7624
|
return this;
|
|
7622
7625
|
}
|
|
7623
|
-
|
|
7626
|
+
const currentIndex = __privateGet(this, _keys).indexOf(newKey);
|
|
7627
|
+
const targetIndex = currentIndex !== -1 && currentIndex < index2 ? index2 - 1 : index2;
|
|
7628
|
+
return this.insert(targetIndex, newKey, value);
|
|
7624
7629
|
}
|
|
7625
7630
|
after(key) {
|
|
7626
7631
|
let index2 = __privateGet(this, _keys).indexOf(key);
|
|
@@ -7638,7 +7643,9 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7638
7643
|
if (index2 === -1) {
|
|
7639
7644
|
return this;
|
|
7640
7645
|
}
|
|
7641
|
-
|
|
7646
|
+
const currentIndex = __privateGet(this, _keys).indexOf(newKey);
|
|
7647
|
+
const targetIndex = currentIndex !== -1 && currentIndex <= index2 ? index2 : index2 + 1;
|
|
7648
|
+
return this.insert(targetIndex, newKey, value);
|
|
7642
7649
|
}
|
|
7643
7650
|
first() {
|
|
7644
7651
|
return this.entryAt(0);
|
|
@@ -7744,10 +7751,14 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7744
7751
|
}
|
|
7745
7752
|
reduce(...args) {
|
|
7746
7753
|
const [callbackfn, initialValue] = args;
|
|
7754
|
+
const hasInitialValue = args.length > 1;
|
|
7755
|
+
if (!hasInitialValue && this.size === 0) {
|
|
7756
|
+
throw new TypeError("Reduce of empty OrderedDict with no initial value");
|
|
7757
|
+
}
|
|
7747
7758
|
let index2 = 0;
|
|
7748
|
-
let accumulator = initialValue
|
|
7759
|
+
let accumulator = initialValue;
|
|
7749
7760
|
for (const entry of this) {
|
|
7750
|
-
if (index2 === 0 &&
|
|
7761
|
+
if (index2 === 0 && !hasInitialValue) {
|
|
7751
7762
|
accumulator = entry;
|
|
7752
7763
|
} else {
|
|
7753
7764
|
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index2, this]);
|
|
@@ -7758,10 +7769,14 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7758
7769
|
}
|
|
7759
7770
|
reduceRight(...args) {
|
|
7760
7771
|
const [callbackfn, initialValue] = args;
|
|
7761
|
-
|
|
7772
|
+
const hasInitialValue = args.length > 1;
|
|
7773
|
+
if (!hasInitialValue && this.size === 0) {
|
|
7774
|
+
throw new TypeError("Reduce of empty OrderedDict with no initial value");
|
|
7775
|
+
}
|
|
7776
|
+
let accumulator = initialValue;
|
|
7762
7777
|
for (let index2 = this.size - 1; index2 >= 0; index2--) {
|
|
7763
|
-
const entry = this.
|
|
7764
|
-
if (index2 === this.size - 1 &&
|
|
7778
|
+
const entry = this.entryAt(index2);
|
|
7779
|
+
if (index2 === this.size - 1 && !hasInitialValue) {
|
|
7765
7780
|
accumulator = entry;
|
|
7766
7781
|
} else {
|
|
7767
7782
|
accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index2, this]);
|
|
@@ -7769,7 +7784,36 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7769
7784
|
}
|
|
7770
7785
|
return accumulator;
|
|
7771
7786
|
}
|
|
7787
|
+
/**
|
|
7788
|
+
* Sorts the dictionary in place. This method mutates the dictionary and
|
|
7789
|
+
* returns a reference to the same object
|
|
7790
|
+
*
|
|
7791
|
+
* @param compareFn Function used to determine the order of the elements. It
|
|
7792
|
+
* is expected to return a negative value if the first argument is less than
|
|
7793
|
+
* the second argument, zero if they're equal, and a positive value otherwise.
|
|
7794
|
+
*/
|
|
7795
|
+
sort(compareFn) {
|
|
7796
|
+
if (typeof compareFn !== "function") {
|
|
7797
|
+
throw new TypeError(`OrderedDict.sort requires a compare function`);
|
|
7798
|
+
}
|
|
7799
|
+
const entries = [...this.entries()].sort(compareFn);
|
|
7800
|
+
this.clear();
|
|
7801
|
+
for (const [key, value] of entries) {
|
|
7802
|
+
this.set(key, value);
|
|
7803
|
+
}
|
|
7804
|
+
return this;
|
|
7805
|
+
}
|
|
7806
|
+
/**
|
|
7807
|
+
* Returns a copy of the dictionary with its elements sorted.
|
|
7808
|
+
*
|
|
7809
|
+
* @param compareFn Function used to determine the order of the elements. It
|
|
7810
|
+
* is expected to return a negative value if the first argument is less than
|
|
7811
|
+
* the second argument, zero if they're equal, and a positive value otherwise.
|
|
7812
|
+
*/
|
|
7772
7813
|
toSorted(compareFn) {
|
|
7814
|
+
if (typeof compareFn !== "function") {
|
|
7815
|
+
throw new TypeError(`OrderedDict.toSorted requires a compare function`);
|
|
7816
|
+
}
|
|
7773
7817
|
const entries = [...this.entries()].sort(compareFn);
|
|
7774
7818
|
return new _a(entries);
|
|
7775
7819
|
}
|
|
@@ -7789,20 +7833,8 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7789
7833
|
}
|
|
7790
7834
|
slice(start, end) {
|
|
7791
7835
|
const result = new _a();
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
return result;
|
|
7795
|
-
}
|
|
7796
|
-
if (start < 0) {
|
|
7797
|
-
start = start + this.size;
|
|
7798
|
-
}
|
|
7799
|
-
if (end !== void 0 && end > 0) {
|
|
7800
|
-
stop = end - 1;
|
|
7801
|
-
}
|
|
7802
|
-
for (let index2 = start; index2 <= stop; index2++) {
|
|
7803
|
-
const key = this.keyAt(index2);
|
|
7804
|
-
const element = this.get(key);
|
|
7805
|
-
result.set(key, element);
|
|
7836
|
+
for (const key of __privateGet(this, _keys).slice(start, end)) {
|
|
7837
|
+
result.set(key, this.get(key));
|
|
7806
7838
|
}
|
|
7807
7839
|
return result;
|
|
7808
7840
|
}
|
|
@@ -7826,7 +7858,7 @@ var OrderedDict = (_a = class extends Map {
|
|
|
7826
7858
|
}
|
|
7827
7859
|
return false;
|
|
7828
7860
|
}
|
|
7829
|
-
}, _keys = new WeakMap(), __name$
|
|
7861
|
+
}, _keys = new WeakMap(), __name$q(_a, "OrderedDict"), _a);
|
|
7830
7862
|
function at$1(array2, index2) {
|
|
7831
7863
|
if ("at" in Array.prototype) {
|
|
7832
7864
|
return Array.prototype.at.call(array2, index2);
|
|
@@ -7834,52 +7866,63 @@ function at$1(array2, index2) {
|
|
|
7834
7866
|
const actualIndex = toSafeIndex(array2, index2);
|
|
7835
7867
|
return actualIndex === -1 ? void 0 : array2[actualIndex];
|
|
7836
7868
|
}
|
|
7837
|
-
__name$
|
|
7869
|
+
__name$q(at$1, "at");
|
|
7838
7870
|
function toSafeIndex(array2, index2) {
|
|
7839
7871
|
const length = array2.length;
|
|
7840
7872
|
const relativeIndex = toSafeInteger(index2);
|
|
7841
7873
|
const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
|
7842
7874
|
return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;
|
|
7843
7875
|
}
|
|
7844
|
-
__name$
|
|
7876
|
+
__name$q(toSafeIndex, "toSafeIndex");
|
|
7845
7877
|
function toSafeInteger(number2) {
|
|
7846
7878
|
return number2 !== number2 || number2 === 0 ? 0 : Math.trunc(number2);
|
|
7847
7879
|
}
|
|
7848
|
-
__name$
|
|
7880
|
+
__name$q(toSafeInteger, "toSafeInteger");
|
|
7849
7881
|
// @__NO_SIDE_EFFECTS__
|
|
7850
7882
|
function createCollection2(name2) {
|
|
7851
7883
|
const PROVIDER_NAME2 = name2 + "CollectionProvider";
|
|
7852
7884
|
const [createCollectionContext, createCollectionScope2] = /* @__PURE__ */ createContextScope(PROVIDER_NAME2);
|
|
7853
|
-
const [
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
collectionRefObject: { current: null },
|
|
7859
|
-
itemMap: new OrderedDict(),
|
|
7860
|
-
setItemMap: /* @__PURE__ */ __name$r(() => void 0, "setItemMap")
|
|
7861
|
-
}
|
|
7862
|
-
);
|
|
7863
|
-
const CollectionProvider = /* @__PURE__ */ __name$r(({ state, ...props }) => {
|
|
7885
|
+
const [CollectionStableContextProvider, useStableCollectionContext] = createCollectionContext(PROVIDER_NAME2);
|
|
7886
|
+
CollectionStableContextProvider.displayName = name2 + "CollectionStableContextProvider";
|
|
7887
|
+
const [CollectionStatefulContextProvider, useStatefulCollectionContext] = createCollectionContext(PROVIDER_NAME2);
|
|
7888
|
+
CollectionStatefulContextProvider.displayName = name2 + "CollectionStatefulContextProvider";
|
|
7889
|
+
const CollectionProvider = /* @__PURE__ */ __name$q(({ state, ...props }) => {
|
|
7864
7890
|
return state ? /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionInit, { ...props });
|
|
7865
7891
|
}, "CollectionProvider");
|
|
7866
7892
|
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
7867
|
-
const CollectionInit = /* @__PURE__ */ __name$
|
|
7893
|
+
const CollectionInit = /* @__PURE__ */ __name$q((props) => {
|
|
7868
7894
|
const state = useInitCollection();
|
|
7869
7895
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionProviderImpl, { ...props, state });
|
|
7870
7896
|
}, "CollectionInit");
|
|
7871
|
-
CollectionInit.displayName =
|
|
7872
|
-
const CollectionProviderImpl = /* @__PURE__ */ __name$
|
|
7897
|
+
CollectionInit.displayName = name2 + "CollectionInit";
|
|
7898
|
+
const CollectionProviderImpl = /* @__PURE__ */ __name$q((props) => {
|
|
7873
7899
|
const { scope: scope2, children, state } = props;
|
|
7874
7900
|
const ref2 = reactExports.useRef(null);
|
|
7875
7901
|
const [collectionElement, setCollectionElement] = reactExports.useState(
|
|
7876
7902
|
null
|
|
7877
7903
|
);
|
|
7878
7904
|
const composeRefs2 = useComposedRefs(ref2, setCollectionElement);
|
|
7879
|
-
const [
|
|
7905
|
+
const [collection, setCollection] = state;
|
|
7906
|
+
const registryRef = reactExports.useRef(
|
|
7907
|
+
new OrderedDict()
|
|
7908
|
+
);
|
|
7909
|
+
const getCollection = reactExports.useCallback(() => {
|
|
7910
|
+
const registry2 = registryRef.current;
|
|
7911
|
+
if (!isInDocumentOrder(registry2)) {
|
|
7912
|
+
registry2.sort(sortByDocumentPosition);
|
|
7913
|
+
}
|
|
7914
|
+
return registry2;
|
|
7915
|
+
}, []);
|
|
7880
7916
|
reactExports.useEffect(() => {
|
|
7881
|
-
if (!collectionElement)
|
|
7917
|
+
if (!collectionElement) {
|
|
7918
|
+
return;
|
|
7919
|
+
}
|
|
7882
7920
|
const observer = getChildListObserver(() => {
|
|
7921
|
+
setCollection((map) => {
|
|
7922
|
+
const sorted = map.toSorted(sortByDocumentPosition);
|
|
7923
|
+
const orderChanged = sorted.some(([key], index2) => map.keyAt(index2) !== key);
|
|
7924
|
+
return orderChanged ? sorted : map;
|
|
7925
|
+
});
|
|
7883
7926
|
});
|
|
7884
7927
|
observer.observe(collectionElement, {
|
|
7885
7928
|
childList: true,
|
|
@@ -7888,28 +7931,36 @@ function createCollection2(name2) {
|
|
|
7888
7931
|
return () => {
|
|
7889
7932
|
observer.disconnect();
|
|
7890
7933
|
};
|
|
7891
|
-
}, [collectionElement]);
|
|
7934
|
+
}, [collectionElement, setCollection]);
|
|
7892
7935
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7893
|
-
|
|
7936
|
+
CollectionStableContextProvider,
|
|
7894
7937
|
{
|
|
7895
7938
|
scope: scope2,
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
children
|
|
7939
|
+
collectionElementRef: composeRefs2,
|
|
7940
|
+
collectionElementRefObject: ref2,
|
|
7941
|
+
getCollection,
|
|
7942
|
+
setCollection,
|
|
7943
|
+
registryRef,
|
|
7944
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
7945
|
+
CollectionStatefulContextProvider,
|
|
7946
|
+
{
|
|
7947
|
+
scope: scope2,
|
|
7948
|
+
collectionElement,
|
|
7949
|
+
collection,
|
|
7950
|
+
children
|
|
7951
|
+
}
|
|
7952
|
+
)
|
|
7902
7953
|
}
|
|
7903
7954
|
);
|
|
7904
7955
|
}, "CollectionProviderImpl");
|
|
7905
|
-
CollectionProviderImpl.displayName =
|
|
7956
|
+
CollectionProviderImpl.displayName = name2 + "CollectionProviderImpl";
|
|
7906
7957
|
const COLLECTION_SLOT_NAME = name2 + "CollectionSlot";
|
|
7907
7958
|
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
7908
7959
|
const CollectionSlot = reactExports.forwardRef(
|
|
7909
7960
|
(props, forwardedRef) => {
|
|
7910
7961
|
const { scope: scope2, children } = props;
|
|
7911
|
-
const context =
|
|
7912
|
-
const composedRefs = useComposedRefs(forwardedRef, context.
|
|
7962
|
+
const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope2);
|
|
7963
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionElementRef);
|
|
7913
7964
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionSlotImpl, { ref: composedRefs, children });
|
|
7914
7965
|
}
|
|
7915
7966
|
);
|
|
@@ -7921,37 +7972,71 @@ function createCollection2(name2) {
|
|
|
7921
7972
|
(props, forwardedRef) => {
|
|
7922
7973
|
const { scope: scope2, children, ...itemData } = props;
|
|
7923
7974
|
const ref2 = reactExports.useRef(null);
|
|
7924
|
-
const
|
|
7925
|
-
const
|
|
7926
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope2);
|
|
7927
|
-
const { setItemMap } = context;
|
|
7975
|
+
const context = useStableCollectionContext(ITEM_SLOT_NAME, scope2);
|
|
7976
|
+
const { setCollection, registryRef } = context;
|
|
7928
7977
|
const itemDataRef = reactExports.useRef(itemData);
|
|
7929
7978
|
if (!shallowEqual(itemDataRef.current, itemData)) {
|
|
7930
7979
|
itemDataRef.current = itemData;
|
|
7931
7980
|
}
|
|
7932
7981
|
const memoizedItemData = itemDataRef.current;
|
|
7982
|
+
const registerElement = reactExports.useCallback(
|
|
7983
|
+
(node) => {
|
|
7984
|
+
const registry2 = registryRef.current;
|
|
7985
|
+
if (node) {
|
|
7986
|
+
registry2.set(node, {
|
|
7987
|
+
...itemDataRef.current,
|
|
7988
|
+
element: node
|
|
7989
|
+
});
|
|
7990
|
+
} else if (ref2.current) {
|
|
7991
|
+
registry2.delete(ref2.current);
|
|
7992
|
+
}
|
|
7993
|
+
},
|
|
7994
|
+
[registryRef]
|
|
7995
|
+
);
|
|
7996
|
+
const composedRefs = useComposedRefs(forwardedRef, registerElement, ref2);
|
|
7997
|
+
useLayoutEffect2(() => {
|
|
7998
|
+
const node = ref2.current;
|
|
7999
|
+
const registry2 = registryRef.current;
|
|
8000
|
+
if (node && registry2.has(node)) {
|
|
8001
|
+
registry2.set(node, { ...memoizedItemData, element: node });
|
|
8002
|
+
}
|
|
8003
|
+
}, [memoizedItemData, registryRef]);
|
|
8004
|
+
const registeredRef = reactExports.useRef(null);
|
|
7933
8005
|
reactExports.useEffect(() => {
|
|
7934
|
-
const
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
8006
|
+
const element = ref2.current;
|
|
8007
|
+
const registered = registeredRef.current;
|
|
8008
|
+
if ((registered?.element ?? null) === element && (!element || registered?.itemData === memoizedItemData)) {
|
|
8009
|
+
return;
|
|
8010
|
+
}
|
|
8011
|
+
registeredRef.current = element ? { element, itemData: memoizedItemData } : null;
|
|
8012
|
+
setCollection((map) => {
|
|
8013
|
+
const next = new OrderedDict(map);
|
|
8014
|
+
if (registered && registered.element !== element) {
|
|
8015
|
+
next.delete(registered.element);
|
|
7938
8016
|
}
|
|
7939
|
-
if (
|
|
7940
|
-
|
|
7941
|
-
return map.toSorted(sortByDocumentPosition);
|
|
8017
|
+
if (element) {
|
|
8018
|
+
next.set(element, { ...memoizedItemData, element });
|
|
7942
8019
|
}
|
|
7943
|
-
return
|
|
8020
|
+
return next.sort(sortByDocumentPosition);
|
|
7944
8021
|
});
|
|
8022
|
+
});
|
|
8023
|
+
reactExports.useEffect(() => {
|
|
7945
8024
|
return () => {
|
|
7946
|
-
|
|
7947
|
-
|
|
8025
|
+
const registered = registeredRef.current;
|
|
8026
|
+
registeredRef.current = null;
|
|
8027
|
+
if (!registered) {
|
|
8028
|
+
return;
|
|
8029
|
+
}
|
|
8030
|
+
setCollection((map) => {
|
|
8031
|
+
if (!map.has(registered.element)) {
|
|
7948
8032
|
return map;
|
|
7949
8033
|
}
|
|
7950
|
-
map
|
|
7951
|
-
|
|
8034
|
+
const next = new OrderedDict(map);
|
|
8035
|
+
next.delete(registered.element);
|
|
8036
|
+
return next;
|
|
7952
8037
|
});
|
|
7953
8038
|
};
|
|
7954
|
-
}, [
|
|
8039
|
+
}, [setCollection]);
|
|
7955
8040
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
7956
8041
|
}
|
|
7957
8042
|
);
|
|
@@ -7959,15 +8044,21 @@ function createCollection2(name2) {
|
|
|
7959
8044
|
function useInitCollection() {
|
|
7960
8045
|
return reactExports.useState(new OrderedDict());
|
|
7961
8046
|
}
|
|
7962
|
-
__name$
|
|
8047
|
+
__name$q(useInitCollection, "useInitCollection");
|
|
7963
8048
|
function useCollection2(scope2) {
|
|
7964
|
-
const {
|
|
7965
|
-
return
|
|
8049
|
+
const { collection } = useStatefulCollectionContext(name2 + "CollectionConsumer", scope2);
|
|
8050
|
+
return collection;
|
|
8051
|
+
}
|
|
8052
|
+
__name$q(useCollection2, "useCollection");
|
|
8053
|
+
function useGetCollection(scope2) {
|
|
8054
|
+
const { getCollection } = useStableCollectionContext(name2 + "CollectionConsumer", scope2);
|
|
8055
|
+
return getCollection;
|
|
7966
8056
|
}
|
|
7967
|
-
__name$
|
|
8057
|
+
__name$q(useGetCollection, "useGetCollection");
|
|
7968
8058
|
const functions = {
|
|
7969
8059
|
createCollectionScope: createCollectionScope2,
|
|
7970
8060
|
useCollection: useCollection2,
|
|
8061
|
+
useGetCollection,
|
|
7971
8062
|
useInitCollection
|
|
7972
8063
|
};
|
|
7973
8064
|
return [
|
|
@@ -7975,7 +8066,7 @@ function createCollection2(name2) {
|
|
|
7975
8066
|
functions
|
|
7976
8067
|
];
|
|
7977
8068
|
}
|
|
7978
|
-
__name$
|
|
8069
|
+
__name$q(createCollection2, "createCollection");
|
|
7979
8070
|
function shallowEqual(a2, b2) {
|
|
7980
8071
|
if (a2 === b2) return true;
|
|
7981
8072
|
if (typeof a2 !== "object" || typeof b2 !== "object") return false;
|
|
@@ -7989,15 +8080,29 @@ function shallowEqual(a2, b2) {
|
|
|
7989
8080
|
}
|
|
7990
8081
|
return true;
|
|
7991
8082
|
}
|
|
7992
|
-
__name$
|
|
8083
|
+
__name$q(shallowEqual, "shallowEqual");
|
|
7993
8084
|
function isElementPreceding(a2, b2) {
|
|
7994
8085
|
return !!(b2.compareDocumentPosition(a2) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
7995
8086
|
}
|
|
7996
|
-
__name$
|
|
8087
|
+
__name$q(isElementPreceding, "isElementPreceding");
|
|
8088
|
+
function isInDocumentOrder(dict) {
|
|
8089
|
+
let previous;
|
|
8090
|
+
for (const element of dict.keys()) {
|
|
8091
|
+
if (previous) {
|
|
8092
|
+
const position = previous.compareDocumentPosition(element);
|
|
8093
|
+
if (!(position & Node.DOCUMENT_POSITION_DISCONNECTED) && position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
8094
|
+
return false;
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
previous = element;
|
|
8098
|
+
}
|
|
8099
|
+
return true;
|
|
8100
|
+
}
|
|
8101
|
+
__name$q(isInDocumentOrder, "isInDocumentOrder");
|
|
7997
8102
|
function sortByDocumentPosition(a2, b2) {
|
|
7998
8103
|
return !a2[1].element || !b2[1].element ? 0 : isElementPreceding(a2[1].element, b2[1].element) ? -1 : 1;
|
|
7999
8104
|
}
|
|
8000
|
-
__name$
|
|
8105
|
+
__name$q(sortByDocumentPosition, "sortByDocumentPosition");
|
|
8001
8106
|
function getChildListObserver(callback) {
|
|
8002
8107
|
const observer = new MutationObserver((mutationsList) => {
|
|
8003
8108
|
for (const mutation of mutationsList) {
|
|
@@ -8009,9 +8114,9 @@ function getChildListObserver(callback) {
|
|
|
8009
8114
|
});
|
|
8010
8115
|
return observer;
|
|
8011
8116
|
}
|
|
8012
|
-
__name$
|
|
8013
|
-
var __defProp$
|
|
8014
|
-
var __name$
|
|
8117
|
+
__name$q(getChildListObserver, "getChildListObserver");
|
|
8118
|
+
var __defProp$p = Object.defineProperty;
|
|
8119
|
+
var __name$p = (target, value) => __defProp$p(target, "name", { value, configurable: true });
|
|
8015
8120
|
var NODES = [
|
|
8016
8121
|
"a",
|
|
8017
8122
|
"button",
|
|
@@ -8047,19 +8152,26 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
8047
8152
|
function dispatchDiscreteCustomEvent(target, event) {
|
|
8048
8153
|
if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
|
|
8049
8154
|
}
|
|
8050
|
-
__name$
|
|
8051
|
-
var __defProp$
|
|
8052
|
-
var __name$
|
|
8155
|
+
__name$p(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
|
|
8156
|
+
var __defProp$o = Object.defineProperty;
|
|
8157
|
+
var __name$o = (target, value) => __defProp$o(target, "name", { value, configurable: true });
|
|
8158
|
+
var useReactInsertionEffect$1 = React2[" useInsertionEffect ".trim().toString()];
|
|
8053
8159
|
function useCallbackRef$1(callback) {
|
|
8054
8160
|
const callbackRef = reactExports.useRef(callback);
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8161
|
+
if (typeof useReactInsertionEffect$1 === "function") {
|
|
8162
|
+
useReactInsertionEffect$1(() => {
|
|
8163
|
+
callbackRef.current = callback;
|
|
8164
|
+
});
|
|
8165
|
+
} else {
|
|
8166
|
+
useLayoutEffect2(() => {
|
|
8167
|
+
callbackRef.current = callback;
|
|
8168
|
+
});
|
|
8169
|
+
}
|
|
8058
8170
|
return reactExports.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
|
|
8059
8171
|
}
|
|
8060
|
-
__name$
|
|
8061
|
-
var __defProp$
|
|
8062
|
-
var __name$
|
|
8172
|
+
__name$o(useCallbackRef$1, "useCallbackRef");
|
|
8173
|
+
var __defProp$n = Object.defineProperty;
|
|
8174
|
+
var __name$n = (target, value) => __defProp$n(target, "name", { value, configurable: true });
|
|
8063
8175
|
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
8064
8176
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
8065
8177
|
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
@@ -8077,7 +8189,7 @@ var DismissableLayerContext = reactExports.createContext({
|
|
|
8077
8189
|
});
|
|
8078
8190
|
var DismissableLayer = /* @__PURE__ */ reactExports.forwardRef(
|
|
8079
8191
|
// blank line to reduce diff noise
|
|
8080
|
-
/* @__PURE__ */ __name$
|
|
8192
|
+
/* @__PURE__ */ __name$n(function DismissableLayer2(props, forwardedRef) {
|
|
8081
8193
|
const {
|
|
8082
8194
|
disableOutsidePointerEvents = false,
|
|
8083
8195
|
deferPointerDownOutside = false,
|
|
@@ -8185,7 +8297,7 @@ var DismissableLayer = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8185
8297
|
};
|
|
8186
8298
|
}, [node, context]);
|
|
8187
8299
|
reactExports.useEffect(() => {
|
|
8188
|
-
const handleUpdate = /* @__PURE__ */ __name$
|
|
8300
|
+
const handleUpdate = /* @__PURE__ */ __name$n(() => force({}), "handleUpdate");
|
|
8189
8301
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
8190
8302
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
8191
8303
|
}, []);
|
|
@@ -8208,7 +8320,7 @@ var DismissableLayer = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8208
8320
|
);
|
|
8209
8321
|
}, "DismissableLayer")
|
|
8210
8322
|
);
|
|
8211
|
-
var DismissableLayerBranch = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__ */ __name$
|
|
8323
|
+
var DismissableLayerBranch = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__ */ __name$n(function DismissableLayerBranch2(props, forwardedRef) {
|
|
8212
8324
|
const context = reactExports.useContext(DismissableLayerContext);
|
|
8213
8325
|
const ref2 = reactExports.useRef(null);
|
|
8214
8326
|
const composedRefs = useComposedRefs(forwardedRef, ref2);
|
|
@@ -8237,8 +8349,8 @@ function useDismissableLayerSurface() {
|
|
|
8237
8349
|
}, [node, context.dismissableSurfaces]);
|
|
8238
8350
|
return setNode;
|
|
8239
8351
|
}
|
|
8240
|
-
__name$
|
|
8241
|
-
var IS_TRUE = /* @__PURE__ */ __name$
|
|
8352
|
+
__name$n(useDismissableLayerSurface, "useDismissableLayerSurface");
|
|
8353
|
+
var IS_TRUE = /* @__PURE__ */ __name$n(() => true, "IS_TRUE");
|
|
8242
8354
|
function usePointerDownOutside(onPointerDownOutside, args) {
|
|
8243
8355
|
const {
|
|
8244
8356
|
ownerDocument = globalThis?.document,
|
|
@@ -8259,11 +8371,11 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
8259
8371
|
isDeferredPointerDownOutsideRef.current = false;
|
|
8260
8372
|
interceptedOutsideInteractionEventsRef.current.clear();
|
|
8261
8373
|
}
|
|
8262
|
-
__name$
|
|
8374
|
+
__name$n(resetOutsideInteraction, "resetOutsideInteraction");
|
|
8263
8375
|
function isOutsideInteractionIntercepted() {
|
|
8264
8376
|
return Array.from(interceptedOutsideInteractionEventsRef.current.values()).some(Boolean);
|
|
8265
8377
|
}
|
|
8266
|
-
__name$
|
|
8378
|
+
__name$n(isOutsideInteractionIntercepted, "isOutsideInteractionIntercepted");
|
|
8267
8379
|
function handleInteractionCapture(event) {
|
|
8268
8380
|
if (!isPointerDownOutsideRef.current) {
|
|
8269
8381
|
return;
|
|
@@ -8281,14 +8393,14 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
8281
8393
|
}, 0);
|
|
8282
8394
|
}
|
|
8283
8395
|
}
|
|
8284
|
-
__name$
|
|
8396
|
+
__name$n(handleInteractionCapture, "handleInteractionCapture");
|
|
8285
8397
|
function handleInteractionBubble(event) {
|
|
8286
8398
|
if (isPointerDownOutsideRef.current) {
|
|
8287
8399
|
interceptedOutsideInteractionEventsRef.current.set(event.type, false);
|
|
8288
8400
|
}
|
|
8289
8401
|
}
|
|
8290
|
-
__name$
|
|
8291
|
-
const handlePointerDown = /* @__PURE__ */ __name$
|
|
8402
|
+
__name$n(handleInteractionBubble, "handleInteractionBubble");
|
|
8403
|
+
const handlePointerDown = /* @__PURE__ */ __name$n((event) => {
|
|
8292
8404
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
8293
8405
|
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
8294
8406
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
@@ -8303,7 +8415,7 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
8303
8415
|
);
|
|
8304
8416
|
}
|
|
8305
8417
|
};
|
|
8306
|
-
__name$
|
|
8418
|
+
__name$n(handleAndDispatchPointerDownOutsideEvent2, "handleAndDispatchPointerDownOutsideEvent");
|
|
8307
8419
|
if (!shouldHandlePointerDownOutside(event.target)) {
|
|
8308
8420
|
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
8309
8421
|
resetOutsideInteraction();
|
|
@@ -8361,15 +8473,15 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
8361
8473
|
]);
|
|
8362
8474
|
return {
|
|
8363
8475
|
// ensures we check React component tree (not just DOM tree)
|
|
8364
|
-
onPointerDownCapture: /* @__PURE__ */ __name$
|
|
8476
|
+
onPointerDownCapture: /* @__PURE__ */ __name$n(() => isPointerInsideReactTreeRef.current = true, "onPointerDownCapture")
|
|
8365
8477
|
};
|
|
8366
8478
|
}
|
|
8367
|
-
__name$
|
|
8479
|
+
__name$n(usePointerDownOutside, "usePointerDownOutside");
|
|
8368
8480
|
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
8369
8481
|
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
8370
8482
|
const isFocusInsideReactTreeRef = reactExports.useRef(false);
|
|
8371
8483
|
reactExports.useEffect(() => {
|
|
8372
|
-
const handleFocus = /* @__PURE__ */ __name$
|
|
8484
|
+
const handleFocus = /* @__PURE__ */ __name$n((event) => {
|
|
8373
8485
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
8374
8486
|
const eventDetail = { originalEvent: event };
|
|
8375
8487
|
handleAndDispatchCustomEvent$1(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
@@ -8381,16 +8493,16 @@ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
|
8381
8493
|
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
8382
8494
|
}, [ownerDocument, handleFocusOutside]);
|
|
8383
8495
|
return {
|
|
8384
|
-
onFocusCapture: /* @__PURE__ */ __name$
|
|
8385
|
-
onBlurCapture: /* @__PURE__ */ __name$
|
|
8496
|
+
onFocusCapture: /* @__PURE__ */ __name$n(() => isFocusInsideReactTreeRef.current = true, "onFocusCapture"),
|
|
8497
|
+
onBlurCapture: /* @__PURE__ */ __name$n(() => isFocusInsideReactTreeRef.current = false, "onBlurCapture")
|
|
8386
8498
|
};
|
|
8387
8499
|
}
|
|
8388
|
-
__name$
|
|
8500
|
+
__name$n(useFocusOutside, "useFocusOutside");
|
|
8389
8501
|
function dispatchUpdate() {
|
|
8390
8502
|
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
8391
8503
|
document.dispatchEvent(event);
|
|
8392
8504
|
}
|
|
8393
|
-
__name$
|
|
8505
|
+
__name$n(dispatchUpdate, "dispatchUpdate");
|
|
8394
8506
|
function handleAndDispatchCustomEvent$1(name2, handler, detail, { discrete }) {
|
|
8395
8507
|
const target = detail.originalEvent.target;
|
|
8396
8508
|
const event = new CustomEvent(name2, { bubbles: false, cancelable: true, detail });
|
|
@@ -8401,15 +8513,11 @@ function handleAndDispatchCustomEvent$1(name2, handler, detail, { discrete }) {
|
|
|
8401
8513
|
target.dispatchEvent(event);
|
|
8402
8514
|
}
|
|
8403
8515
|
}
|
|
8404
|
-
__name$
|
|
8405
|
-
var
|
|
8406
|
-
var
|
|
8407
|
-
var
|
|
8408
|
-
|
|
8409
|
-
var __defProp$n = Object.defineProperty;
|
|
8410
|
-
var __name$n = (target, value) => __defProp$n(target, "name", { value, configurable: true });
|
|
8411
|
-
var Portal$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
8412
|
-
/* @__PURE__ */ __name$n(function Portal2(props, forwardedRef) {
|
|
8516
|
+
__name$n(handleAndDispatchCustomEvent$1, "handleAndDispatchCustomEvent");
|
|
8517
|
+
var __defProp$m = Object.defineProperty;
|
|
8518
|
+
var __name$m = (target, value) => __defProp$m(target, "name", { value, configurable: true });
|
|
8519
|
+
var Portal = /* @__PURE__ */ reactExports.forwardRef(
|
|
8520
|
+
/* @__PURE__ */ __name$m(function Portal2(props, forwardedRef) {
|
|
8413
8521
|
const { container: containerProp, ...portalProps } = props;
|
|
8414
8522
|
const [mounted, setMounted] = reactExports.useState(false);
|
|
8415
8523
|
useLayoutEffect2(() => setMounted(true), []);
|
|
@@ -8417,16 +8525,16 @@ var Portal$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8417
8525
|
return container ? reactDomExports.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
8418
8526
|
}, "Portal")
|
|
8419
8527
|
);
|
|
8420
|
-
var __defProp$
|
|
8421
|
-
var __name$
|
|
8528
|
+
var __defProp$l = Object.defineProperty;
|
|
8529
|
+
var __name$l = (target, value) => __defProp$l(target, "name", { value, configurable: true });
|
|
8422
8530
|
function useStateMachine(initialState, machine) {
|
|
8423
8531
|
return reactExports.useReducer((state, event) => {
|
|
8424
8532
|
const nextState = machine[state][event];
|
|
8425
8533
|
return nextState ?? state;
|
|
8426
8534
|
}, initialState);
|
|
8427
8535
|
}
|
|
8428
|
-
__name$
|
|
8429
|
-
var Presence = /* @__PURE__ */ __name$
|
|
8536
|
+
__name$l(useStateMachine, "useStateMachine");
|
|
8537
|
+
var Presence = /* @__PURE__ */ __name$l((props) => {
|
|
8430
8538
|
const { present, children } = props;
|
|
8431
8539
|
const presence = usePresence(present);
|
|
8432
8540
|
const child = typeof children === "function" ? children({ present: presence.isPresent }) : reactExports.Children.only(children);
|
|
@@ -8489,7 +8597,7 @@ function usePresence(present) {
|
|
|
8489
8597
|
if (node) {
|
|
8490
8598
|
let timeoutId;
|
|
8491
8599
|
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
8492
|
-
const handleAnimationEnd = /* @__PURE__ */ __name$
|
|
8600
|
+
const handleAnimationEnd = /* @__PURE__ */ __name$l((event) => {
|
|
8493
8601
|
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
8494
8602
|
const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
|
|
8495
8603
|
if (event.target === node && isCurrentAnimation) {
|
|
@@ -8505,7 +8613,7 @@ function usePresence(present) {
|
|
|
8505
8613
|
}
|
|
8506
8614
|
}
|
|
8507
8615
|
}, "handleAnimationEnd");
|
|
8508
|
-
const handleAnimationStart = /* @__PURE__ */ __name$
|
|
8616
|
+
const handleAnimationStart = /* @__PURE__ */ __name$l((event) => {
|
|
8509
8617
|
if (event.target === node) {
|
|
8510
8618
|
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
8511
8619
|
}
|
|
@@ -8537,7 +8645,7 @@ function usePresence(present) {
|
|
|
8537
8645
|
}, [])
|
|
8538
8646
|
};
|
|
8539
8647
|
}
|
|
8540
|
-
__name$
|
|
8648
|
+
__name$l(usePresence, "usePresence");
|
|
8541
8649
|
function setRef(ref2, value) {
|
|
8542
8650
|
if (typeof ref2 === "function") {
|
|
8543
8651
|
return ref2(value);
|
|
@@ -8545,7 +8653,7 @@ function setRef(ref2, value) {
|
|
|
8545
8653
|
ref2.current = value;
|
|
8546
8654
|
}
|
|
8547
8655
|
}
|
|
8548
|
-
__name$
|
|
8656
|
+
__name$l(setRef, "setRef");
|
|
8549
8657
|
function useStableComposedRefs(...refs) {
|
|
8550
8658
|
const refsRef = reactExports.useRef(refs);
|
|
8551
8659
|
refsRef.current = refs;
|
|
@@ -8573,11 +8681,11 @@ function useStableComposedRefs(...refs) {
|
|
|
8573
8681
|
}
|
|
8574
8682
|
}, []);
|
|
8575
8683
|
}
|
|
8576
|
-
__name$
|
|
8684
|
+
__name$l(useStableComposedRefs, "useStableComposedRefs");
|
|
8577
8685
|
function getAnimationName(styles) {
|
|
8578
8686
|
return styles?.animationName || "none";
|
|
8579
8687
|
}
|
|
8580
|
-
__name$
|
|
8688
|
+
__name$l(getAnimationName, "getAnimationName");
|
|
8581
8689
|
function getElementRef(element) {
|
|
8582
8690
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
8583
8691
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
@@ -8591,9 +8699,9 @@ function getElementRef(element) {
|
|
|
8591
8699
|
}
|
|
8592
8700
|
return element.props.ref || element.ref;
|
|
8593
8701
|
}
|
|
8594
|
-
__name$
|
|
8595
|
-
var __defProp$
|
|
8596
|
-
var __name$
|
|
8702
|
+
__name$l(getElementRef, "getElementRef");
|
|
8703
|
+
var __defProp$k = Object.defineProperty;
|
|
8704
|
+
var __name$k = (target, value) => __defProp$k(target, "name", { value, configurable: true });
|
|
8597
8705
|
var useReactEffectEvent = React2[" useEffectEvent ".trim().toString()];
|
|
8598
8706
|
var useReactInsertionEffect = React2[" useInsertionEffect ".trim().toString()];
|
|
8599
8707
|
function useEffectEvent(callback) {
|
|
@@ -8614,14 +8722,14 @@ function useEffectEvent(callback) {
|
|
|
8614
8722
|
}
|
|
8615
8723
|
return reactExports.useMemo(() => ((...args) => ref2.current?.(...args)), []);
|
|
8616
8724
|
}
|
|
8617
|
-
__name$
|
|
8618
|
-
var __defProp$
|
|
8619
|
-
var __name$
|
|
8725
|
+
__name$k(useEffectEvent, "useEffectEvent");
|
|
8726
|
+
var __defProp$j = Object.defineProperty;
|
|
8727
|
+
var __name$j = (target, value) => __defProp$j(target, "name", { value, configurable: true });
|
|
8620
8728
|
var useInsertionEffect = React2[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
8621
8729
|
function useControllableState({
|
|
8622
8730
|
prop,
|
|
8623
8731
|
defaultProp,
|
|
8624
|
-
onChange = /* @__PURE__ */ __name$
|
|
8732
|
+
onChange = /* @__PURE__ */ __name$j(() => {
|
|
8625
8733
|
}, "onChange"),
|
|
8626
8734
|
caller
|
|
8627
8735
|
}) {
|
|
@@ -8646,7 +8754,7 @@ function useControllableState({
|
|
|
8646
8754
|
);
|
|
8647
8755
|
return [value, setValue];
|
|
8648
8756
|
}
|
|
8649
|
-
__name$
|
|
8757
|
+
__name$j(useControllableState, "useControllableState");
|
|
8650
8758
|
function useUncontrolledState({
|
|
8651
8759
|
defaultProp,
|
|
8652
8760
|
onChange
|
|
@@ -8665,11 +8773,11 @@ function useUncontrolledState({
|
|
|
8665
8773
|
}, [value, prevValueRef]);
|
|
8666
8774
|
return [value, setValue, onChangeRef];
|
|
8667
8775
|
}
|
|
8668
|
-
__name$
|
|
8776
|
+
__name$j(useUncontrolledState, "useUncontrolledState");
|
|
8669
8777
|
function isFunction$3(value) {
|
|
8670
8778
|
return typeof value === "function";
|
|
8671
8779
|
}
|
|
8672
|
-
__name$
|
|
8780
|
+
__name$j(isFunction$3, "isFunction");
|
|
8673
8781
|
var SYNC_STATE = /* @__PURE__ */ Symbol("RADIX:SYNC_STATE");
|
|
8674
8782
|
function useControllableStateReducer(reducer2, userArgs, initialArg, init) {
|
|
8675
8783
|
const { prop: controlledState, defaultProp, onChange: onChangeProp, caller } = userArgs;
|
|
@@ -8716,9 +8824,9 @@ function useControllableStateReducer(reducer2, userArgs, initialArg, init) {
|
|
|
8716
8824
|
}, [controlledState, internalState.state, isControlled]);
|
|
8717
8825
|
return [state, dispatch2];
|
|
8718
8826
|
}
|
|
8719
|
-
__name$
|
|
8720
|
-
var __defProp$
|
|
8721
|
-
var __name$
|
|
8827
|
+
__name$j(useControllableStateReducer, "useControllableStateReducer");
|
|
8828
|
+
var __defProp$i = Object.defineProperty;
|
|
8829
|
+
var __name$i = (target, value) => __defProp$i(target, "name", { value, configurable: true });
|
|
8722
8830
|
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
8723
8831
|
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
8724
8832
|
position: "absolute",
|
|
@@ -8733,7 +8841,7 @@ var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
|
8733
8841
|
wordWrap: "normal"
|
|
8734
8842
|
});
|
|
8735
8843
|
var VisuallyHidden = /* @__PURE__ */ reactExports.forwardRef(
|
|
8736
|
-
/* @__PURE__ */ __name$
|
|
8844
|
+
/* @__PURE__ */ __name$i(function VisuallyHidden2(props, forwardedRef) {
|
|
8737
8845
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8738
8846
|
Primitive.span,
|
|
8739
8847
|
{
|
|
@@ -8744,19 +8852,34 @@ var VisuallyHidden = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8744
8852
|
);
|
|
8745
8853
|
}, "VisuallyHidden")
|
|
8746
8854
|
);
|
|
8747
|
-
var
|
|
8748
|
-
var
|
|
8749
|
-
var
|
|
8855
|
+
var __defProp$h = Object.defineProperty;
|
|
8856
|
+
var __name$h = (target, value) => __defProp$h(target, "name", { value, configurable: true });
|
|
8857
|
+
var startTransition = React2[" startTransition ".trim().toString()] || (() => void 0);
|
|
8750
8858
|
var PROVIDER_NAME$1 = "ToastProvider";
|
|
8751
8859
|
var [Collection$2, useCollection$2, createCollectionScope$2] = /* @__PURE__ */ createCollection("Toast");
|
|
8860
|
+
var SwipeDirection = {
|
|
8861
|
+
Left: "left",
|
|
8862
|
+
Right: "right"
|
|
8863
|
+
};
|
|
8864
|
+
var ToastType = {
|
|
8865
|
+
Foreground: "foreground"
|
|
8866
|
+
};
|
|
8752
8867
|
var [createToastContext, createToastScope] = /* @__PURE__ */ createContextScope("Toast", [createCollectionScope$2]);
|
|
8753
8868
|
var [ToastProviderProvider, useToastProviderContext] = createToastContext(PROVIDER_NAME$1);
|
|
8754
|
-
|
|
8869
|
+
function scheduleUpdate(update) {
|
|
8870
|
+
if (typeof startTransition === "function") {
|
|
8871
|
+
startTransition(update);
|
|
8872
|
+
} else {
|
|
8873
|
+
update();
|
|
8874
|
+
}
|
|
8875
|
+
}
|
|
8876
|
+
__name$h(scheduleUpdate, "scheduleUpdate");
|
|
8877
|
+
var ToastProvider$1 = /* @__PURE__ */ __name$h((props) => {
|
|
8755
8878
|
const {
|
|
8756
8879
|
__scopeToast,
|
|
8757
8880
|
label = "Notification",
|
|
8758
8881
|
duration: duration2 = 5e3,
|
|
8759
|
-
swipeDirection =
|
|
8882
|
+
swipeDirection = SwipeDirection.Right,
|
|
8760
8883
|
swipeThreshold = 50,
|
|
8761
8884
|
announcerContainer,
|
|
8762
8885
|
children
|
|
@@ -8764,6 +8887,15 @@ var ToastProvider$1 = /* @__PURE__ */ __name$i((props) => {
|
|
|
8764
8887
|
const [viewport, setViewport] = reactExports.useState(null);
|
|
8765
8888
|
const [toastCount, setToastCount] = reactExports.useState(0);
|
|
8766
8889
|
const isClosePausedRef = reactExports.useRef(false);
|
|
8890
|
+
const onViewportChange = reactExports.useCallback((node) => {
|
|
8891
|
+
scheduleUpdate(() => setViewport(node));
|
|
8892
|
+
}, []);
|
|
8893
|
+
const onToastAdd = reactExports.useCallback(() => {
|
|
8894
|
+
scheduleUpdate(() => setToastCount((prevCount) => prevCount + 1));
|
|
8895
|
+
}, []);
|
|
8896
|
+
const onToastRemove = reactExports.useCallback(() => {
|
|
8897
|
+
scheduleUpdate(() => setToastCount((prevCount) => prevCount - 1));
|
|
8898
|
+
}, []);
|
|
8767
8899
|
if (!label.trim()) {
|
|
8768
8900
|
console.error(
|
|
8769
8901
|
`Invalid prop \`label\` supplied to \`${PROVIDER_NAME$1}\`. Expected non-empty \`string\`.`
|
|
@@ -8779,9 +8911,9 @@ var ToastProvider$1 = /* @__PURE__ */ __name$i((props) => {
|
|
|
8779
8911
|
swipeThreshold,
|
|
8780
8912
|
toastCount,
|
|
8781
8913
|
viewport,
|
|
8782
|
-
onViewportChange
|
|
8783
|
-
onToastAdd
|
|
8784
|
-
onToastRemove
|
|
8914
|
+
onViewportChange,
|
|
8915
|
+
onToastAdd,
|
|
8916
|
+
onToastRemove,
|
|
8785
8917
|
isClosePausedRef,
|
|
8786
8918
|
announcerContainer,
|
|
8787
8919
|
children
|
|
@@ -8793,7 +8925,7 @@ var VIEWPORT_DEFAULT_HOTKEY = ["F8"];
|
|
|
8793
8925
|
var VIEWPORT_PAUSE = "toast.viewportPause";
|
|
8794
8926
|
var VIEWPORT_RESUME = "toast.viewportResume";
|
|
8795
8927
|
var ToastViewport$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
8796
|
-
/* @__PURE__ */ __name$
|
|
8928
|
+
/* @__PURE__ */ __name$h(function ToastViewport2(props, forwardedRef) {
|
|
8797
8929
|
const {
|
|
8798
8930
|
__scopeToast,
|
|
8799
8931
|
hotkey = VIEWPORT_DEFAULT_HOTKEY,
|
|
@@ -8810,7 +8942,7 @@ var ToastViewport$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8810
8942
|
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
8811
8943
|
const hasToasts = context.toastCount > 0;
|
|
8812
8944
|
reactExports.useEffect(() => {
|
|
8813
|
-
const handleKeyDown = /* @__PURE__ */ __name$
|
|
8945
|
+
const handleKeyDown = /* @__PURE__ */ __name$h((event) => {
|
|
8814
8946
|
const isHotkeyPressed = hotkey.length !== 0 && hotkey.every((key) => event[key] || event.code === key);
|
|
8815
8947
|
if (isHotkeyPressed) ref2.current?.focus();
|
|
8816
8948
|
}, "handleKeyDown");
|
|
@@ -8821,25 +8953,25 @@ var ToastViewport$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8821
8953
|
const wrapper = wrapperRef.current;
|
|
8822
8954
|
const viewport = ref2.current;
|
|
8823
8955
|
if (hasToasts && wrapper && viewport) {
|
|
8824
|
-
const handlePause = /* @__PURE__ */ __name$
|
|
8956
|
+
const handlePause = /* @__PURE__ */ __name$h(() => {
|
|
8825
8957
|
if (!context.isClosePausedRef.current) {
|
|
8826
8958
|
const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);
|
|
8827
8959
|
viewport.dispatchEvent(pauseEvent);
|
|
8828
8960
|
context.isClosePausedRef.current = true;
|
|
8829
8961
|
}
|
|
8830
8962
|
}, "handlePause");
|
|
8831
|
-
const handleResume = /* @__PURE__ */ __name$
|
|
8963
|
+
const handleResume = /* @__PURE__ */ __name$h(() => {
|
|
8832
8964
|
if (context.isClosePausedRef.current) {
|
|
8833
8965
|
const resumeEvent = new CustomEvent(VIEWPORT_RESUME);
|
|
8834
8966
|
viewport.dispatchEvent(resumeEvent);
|
|
8835
8967
|
context.isClosePausedRef.current = false;
|
|
8836
8968
|
}
|
|
8837
8969
|
}, "handleResume");
|
|
8838
|
-
const handleFocusOutResume = /* @__PURE__ */ __name$
|
|
8970
|
+
const handleFocusOutResume = /* @__PURE__ */ __name$h((event) => {
|
|
8839
8971
|
const isFocusMovingOutside = !wrapper.contains(event.relatedTarget);
|
|
8840
8972
|
if (isFocusMovingOutside) handleResume();
|
|
8841
8973
|
}, "handleFocusOutResume");
|
|
8842
|
-
const handlePointerLeaveResume = /* @__PURE__ */ __name$
|
|
8974
|
+
const handlePointerLeaveResume = /* @__PURE__ */ __name$h(() => {
|
|
8843
8975
|
const isFocusInside = wrapper.contains(document.activeElement);
|
|
8844
8976
|
if (!isFocusInside) handleResume();
|
|
8845
8977
|
}, "handlePointerLeaveResume");
|
|
@@ -8874,7 +9006,7 @@ var ToastViewport$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8874
9006
|
reactExports.useEffect(() => {
|
|
8875
9007
|
const viewport = ref2.current;
|
|
8876
9008
|
if (viewport) {
|
|
8877
|
-
const handleKeyDown = /* @__PURE__ */ __name$
|
|
9009
|
+
const handleKeyDown = /* @__PURE__ */ __name$h((event) => {
|
|
8878
9010
|
const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
|
|
8879
9011
|
const isTabKey = event.key === "Tab" && !isMetaKey;
|
|
8880
9012
|
if (isTabKey) {
|
|
@@ -8900,7 +9032,7 @@ var ToastViewport$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8900
9032
|
}
|
|
8901
9033
|
}, [getItems, getSortedTabbableCandidates]);
|
|
8902
9034
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
8903
|
-
|
|
9035
|
+
DismissableLayerBranch,
|
|
8904
9036
|
{
|
|
8905
9037
|
ref: wrapperRef,
|
|
8906
9038
|
role: "region",
|
|
@@ -8941,7 +9073,7 @@ var ToastViewport$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
8941
9073
|
var FOCUS_PROXY_NAME = "ToastFocusProxy";
|
|
8942
9074
|
var FocusProxy = /* @__PURE__ */ reactExports.forwardRef(
|
|
8943
9075
|
// blank line to reduce diff noise
|
|
8944
|
-
/* @__PURE__ */ __name$
|
|
9076
|
+
/* @__PURE__ */ __name$h(function ToastFocusProxy(props, forwardedRef) {
|
|
8945
9077
|
const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;
|
|
8946
9078
|
const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);
|
|
8947
9079
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -8967,7 +9099,7 @@ var TOAST_SWIPE_CANCEL = "toast.swipeCancel";
|
|
|
8967
9099
|
var TOAST_SWIPE_END = "toast.swipeEnd";
|
|
8968
9100
|
var Toast$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
8969
9101
|
// blank line to reduce diff noise
|
|
8970
|
-
/* @__PURE__ */ __name$
|
|
9102
|
+
/* @__PURE__ */ __name$h(function Toast2(props, forwardedRef) {
|
|
8971
9103
|
const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;
|
|
8972
9104
|
const [open, setOpen] = useControllableState({
|
|
8973
9105
|
prop: openProp,
|
|
@@ -9018,10 +9150,10 @@ var [ToastInteractiveProvider, useToastInteractiveContext] = createToastContext(
|
|
|
9018
9150
|
}
|
|
9019
9151
|
});
|
|
9020
9152
|
var ToastImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
9021
|
-
/* @__PURE__ */ __name$
|
|
9153
|
+
/* @__PURE__ */ __name$h(function ToastImpl2(props, forwardedRef) {
|
|
9022
9154
|
const {
|
|
9023
9155
|
__scopeToast,
|
|
9024
|
-
type: type2 =
|
|
9156
|
+
type: type2 = ToastType.Foreground,
|
|
9025
9157
|
duration: durationProp,
|
|
9026
9158
|
open,
|
|
9027
9159
|
onClose,
|
|
@@ -9062,11 +9194,11 @@ var ToastImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
9062
9194
|
reactExports.useEffect(() => {
|
|
9063
9195
|
const viewport = context.viewport;
|
|
9064
9196
|
if (viewport) {
|
|
9065
|
-
const handleResume = /* @__PURE__ */ __name$
|
|
9197
|
+
const handleResume = /* @__PURE__ */ __name$h(() => {
|
|
9066
9198
|
startTimer(closeTimerRemainingTimeRef.current);
|
|
9067
9199
|
onResume?.();
|
|
9068
9200
|
}, "handleResume");
|
|
9069
|
-
const handlePause = /* @__PURE__ */ __name$
|
|
9201
|
+
const handlePause = /* @__PURE__ */ __name$h(() => {
|
|
9070
9202
|
const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
|
|
9071
9203
|
closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;
|
|
9072
9204
|
window.clearTimeout(closeTimerRef.current);
|
|
@@ -9081,7 +9213,10 @@ var ToastImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
9081
9213
|
}
|
|
9082
9214
|
}, [context.viewport, duration2, onPause, onResume, startTimer]);
|
|
9083
9215
|
reactExports.useEffect(() => {
|
|
9084
|
-
|
|
9216
|
+
closeTimerRemainingTimeRef.current = duration2;
|
|
9217
|
+
if (open && !context.isClosePausedRef.current) {
|
|
9218
|
+
startTimer(duration2);
|
|
9219
|
+
}
|
|
9085
9220
|
}, [open, duration2, context.isClosePausedRef, startTimer]);
|
|
9086
9221
|
reactExports.useEffect(() => {
|
|
9087
9222
|
return () => {
|
|
@@ -9102,13 +9237,13 @@ var ToastImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
9102
9237
|
{
|
|
9103
9238
|
__scopeToast,
|
|
9104
9239
|
role: "status",
|
|
9105
|
-
"aria-live": type2 ===
|
|
9240
|
+
"aria-live": type2 === ToastType.Foreground ? "assertive" : "polite",
|
|
9106
9241
|
children: announceTextContent
|
|
9107
9242
|
}
|
|
9108
9243
|
),
|
|
9109
9244
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ToastInteractiveProvider, { scope: __scopeToast, onClose: handleClose, children: reactDomExports.createPortal(
|
|
9110
9245
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Collection$2.ItemSlot, { scope: __scopeToast, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9111
|
-
|
|
9246
|
+
DismissableLayer,
|
|
9112
9247
|
{
|
|
9113
9248
|
asChild: true,
|
|
9114
9249
|
onEscapeKeyDown: composeEventHandlers(onEscapeKeyDown, (event) => {
|
|
@@ -9205,7 +9340,7 @@ var ToastImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
9205
9340
|
] });
|
|
9206
9341
|
}, "ToastImpl")
|
|
9207
9342
|
);
|
|
9208
|
-
var ToastAnnounce = /* @__PURE__ */ __name$
|
|
9343
|
+
var ToastAnnounce = /* @__PURE__ */ __name$h((props) => {
|
|
9209
9344
|
const { __scopeToast, children, ...announceProps } = props;
|
|
9210
9345
|
const context = useToastProviderContext(TOAST_NAME, __scopeToast);
|
|
9211
9346
|
const [renderAnnounceText, setRenderAnnounceText] = reactExports.useState(false);
|
|
@@ -9215,28 +9350,28 @@ var ToastAnnounce = /* @__PURE__ */ __name$i((props) => {
|
|
|
9215
9350
|
const timer = window.setTimeout(() => setIsAnnounced(true), 1e3);
|
|
9216
9351
|
return () => window.clearTimeout(timer);
|
|
9217
9352
|
}, []);
|
|
9218
|
-
return isAnnounced ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Portal
|
|
9353
|
+
return isAnnounced ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { asChild: true, container: context.announcerContainer || void 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHidden, { ...announceProps, children: renderAnnounceText && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
9219
9354
|
context.label,
|
|
9220
9355
|
" ",
|
|
9221
9356
|
children
|
|
9222
9357
|
] }) }) });
|
|
9223
9358
|
}, "ToastAnnounce");
|
|
9224
9359
|
var ToastTitle$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
9225
|
-
/* @__PURE__ */ __name$
|
|
9360
|
+
/* @__PURE__ */ __name$h(function ToastTitle2(props, forwardedRef) {
|
|
9226
9361
|
const { __scopeToast, ...titleProps } = props;
|
|
9227
9362
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...titleProps, ref: forwardedRef });
|
|
9228
9363
|
}, "ToastTitle")
|
|
9229
9364
|
);
|
|
9230
9365
|
var ToastDescription$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
9231
9366
|
// blank line to reduce diff noise
|
|
9232
|
-
/* @__PURE__ */ __name$
|
|
9367
|
+
/* @__PURE__ */ __name$h(function ToastDescription2(props, forwardedRef) {
|
|
9233
9368
|
const { __scopeToast, ...descriptionProps } = props;
|
|
9234
9369
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...descriptionProps, ref: forwardedRef });
|
|
9235
9370
|
}, "ToastDescription")
|
|
9236
9371
|
);
|
|
9237
9372
|
var ACTION_NAME = "ToastAction";
|
|
9238
9373
|
var ToastAction$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
9239
|
-
/* @__PURE__ */ __name$
|
|
9374
|
+
/* @__PURE__ */ __name$h(function ToastAction2(props, forwardedRef) {
|
|
9240
9375
|
const { altText, ...actionProps } = props;
|
|
9241
9376
|
if (!altText.trim()) {
|
|
9242
9377
|
console.error(
|
|
@@ -9249,7 +9384,7 @@ var ToastAction$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
9249
9384
|
);
|
|
9250
9385
|
var CLOSE_NAME$1 = "ToastClose";
|
|
9251
9386
|
var ToastClose$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
9252
|
-
/* @__PURE__ */ __name$
|
|
9387
|
+
/* @__PURE__ */ __name$h(function ToastClose2(props, forwardedRef) {
|
|
9253
9388
|
const { __scopeToast, ...closeProps } = props;
|
|
9254
9389
|
const interactiveContext = useToastInteractiveContext(CLOSE_NAME$1, __scopeToast);
|
|
9255
9390
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ToastAnnounceExclude, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -9263,7 +9398,7 @@ var ToastClose$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
9263
9398
|
) });
|
|
9264
9399
|
}, "ToastClose")
|
|
9265
9400
|
);
|
|
9266
|
-
var ToastAnnounceExclude = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__ */ __name$
|
|
9401
|
+
var ToastAnnounceExclude = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__ */ __name$h(function ToastAnnounceExclude2(props, forwardedRef) {
|
|
9267
9402
|
const { __scopeToast, altText, ...announceExcludeProps } = props;
|
|
9268
9403
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9269
9404
|
Primitive.div,
|
|
@@ -9295,7 +9430,7 @@ function getAnnounceTextContent(container) {
|
|
|
9295
9430
|
});
|
|
9296
9431
|
return textContent;
|
|
9297
9432
|
}
|
|
9298
|
-
__name$
|
|
9433
|
+
__name$h(getAnnounceTextContent, "getAnnounceTextContent");
|
|
9299
9434
|
function handleAndDispatchCustomEvent(name2, handler, detail, { discrete }) {
|
|
9300
9435
|
const currentTarget = detail.originalEvent.currentTarget;
|
|
9301
9436
|
const event = new CustomEvent(name2, { bubbles: true, cancelable: true, detail });
|
|
@@ -9306,12 +9441,12 @@ function handleAndDispatchCustomEvent(name2, handler, detail, { discrete }) {
|
|
|
9306
9441
|
currentTarget.dispatchEvent(event);
|
|
9307
9442
|
}
|
|
9308
9443
|
}
|
|
9309
|
-
__name$
|
|
9310
|
-
var isDeltaInDirection = /* @__PURE__ */ __name$
|
|
9444
|
+
__name$h(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
|
|
9445
|
+
var isDeltaInDirection = /* @__PURE__ */ __name$h((delta, direction, threshold = 0) => {
|
|
9311
9446
|
const deltaX = Math.abs(delta.x);
|
|
9312
9447
|
const deltaY = Math.abs(delta.y);
|
|
9313
9448
|
const isDeltaX = deltaX > deltaY;
|
|
9314
|
-
if (direction ===
|
|
9449
|
+
if (direction === SwipeDirection.Left || direction === SwipeDirection.Right) {
|
|
9315
9450
|
return isDeltaX && deltaX > threshold;
|
|
9316
9451
|
} else {
|
|
9317
9452
|
return !isDeltaX && deltaY > threshold;
|
|
@@ -9330,15 +9465,15 @@ function useNextFrame(callback = () => {
|
|
|
9330
9465
|
};
|
|
9331
9466
|
}, [fn2]);
|
|
9332
9467
|
}
|
|
9333
|
-
__name$
|
|
9468
|
+
__name$h(useNextFrame, "useNextFrame");
|
|
9334
9469
|
function isHTMLElement$1(node) {
|
|
9335
9470
|
return node.nodeType === node.ELEMENT_NODE;
|
|
9336
9471
|
}
|
|
9337
|
-
__name$
|
|
9472
|
+
__name$h(isHTMLElement$1, "isHTMLElement");
|
|
9338
9473
|
function getTabbableCandidates$1(container) {
|
|
9339
9474
|
const nodes = [];
|
|
9340
9475
|
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
9341
|
-
acceptNode: /* @__PURE__ */ __name$
|
|
9476
|
+
acceptNode: /* @__PURE__ */ __name$h((node) => {
|
|
9342
9477
|
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
9343
9478
|
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
9344
9479
|
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
@@ -9347,7 +9482,7 @@ function getTabbableCandidates$1(container) {
|
|
|
9347
9482
|
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
9348
9483
|
return nodes;
|
|
9349
9484
|
}
|
|
9350
|
-
__name$
|
|
9485
|
+
__name$h(getTabbableCandidates$1, "getTabbableCandidates");
|
|
9351
9486
|
function focusFirst$2(candidates) {
|
|
9352
9487
|
const previouslyFocusedElement = document.activeElement;
|
|
9353
9488
|
return candidates.some((candidate) => {
|
|
@@ -9356,14 +9491,7 @@ function focusFirst$2(candidates) {
|
|
|
9356
9491
|
return document.activeElement !== previouslyFocusedElement;
|
|
9357
9492
|
});
|
|
9358
9493
|
}
|
|
9359
|
-
__name$
|
|
9360
|
-
var Provider$1 = ToastProvider$1;
|
|
9361
|
-
var Viewport = ToastViewport$1;
|
|
9362
|
-
var Root2$3 = Toast$1;
|
|
9363
|
-
var Title = ToastTitle$1;
|
|
9364
|
-
var Description = ToastDescription$1;
|
|
9365
|
-
var Action = ToastAction$1;
|
|
9366
|
-
var Close = ToastClose$1;
|
|
9494
|
+
__name$h(focusFirst$2, "focusFirst");
|
|
9367
9495
|
function r$1(e2) {
|
|
9368
9496
|
var t2, f2, n = "";
|
|
9369
9497
|
if ("string" == typeof e2 || "number" == typeof e2) n += e2;
|
|
@@ -11998,9 +12126,9 @@ var MagnifyingGlassIcon = /* @__PURE__ */ reactExports.forwardRef(function(_ref,
|
|
|
11998
12126
|
clipRule: "evenodd"
|
|
11999
12127
|
}));
|
|
12000
12128
|
});
|
|
12001
|
-
const ToastProvider =
|
|
12129
|
+
const ToastProvider = ToastProvider$1;
|
|
12002
12130
|
const ToastViewport = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12003
|
-
|
|
12131
|
+
ToastViewport$1,
|
|
12004
12132
|
{
|
|
12005
12133
|
ref: ref2,
|
|
12006
12134
|
className: cn$1(
|
|
@@ -12010,7 +12138,7 @@ const ToastViewport = reactExports.forwardRef(({ className, ...props }, ref2) =>
|
|
|
12010
12138
|
...props
|
|
12011
12139
|
}
|
|
12012
12140
|
));
|
|
12013
|
-
ToastViewport.displayName =
|
|
12141
|
+
ToastViewport.displayName = ToastViewport$1.displayName;
|
|
12014
12142
|
const toastVariants = cva(
|
|
12015
12143
|
"group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
|
|
12016
12144
|
{
|
|
@@ -12027,7 +12155,7 @@ const toastVariants = cva(
|
|
|
12027
12155
|
);
|
|
12028
12156
|
const Toast = reactExports.forwardRef(({ className, variant, ...props }, ref2) => {
|
|
12029
12157
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12030
|
-
|
|
12158
|
+
Toast$1,
|
|
12031
12159
|
{
|
|
12032
12160
|
ref: ref2,
|
|
12033
12161
|
className: cn$1(toastVariants({ variant }), className),
|
|
@@ -12035,9 +12163,9 @@ const Toast = reactExports.forwardRef(({ className, variant, ...props }, ref2) =
|
|
|
12035
12163
|
}
|
|
12036
12164
|
);
|
|
12037
12165
|
});
|
|
12038
|
-
Toast.displayName =
|
|
12166
|
+
Toast.displayName = Toast$1.displayName;
|
|
12039
12167
|
const ToastAction = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12040
|
-
|
|
12168
|
+
ToastAction$1,
|
|
12041
12169
|
{
|
|
12042
12170
|
ref: ref2,
|
|
12043
12171
|
className: cn$1(
|
|
@@ -12047,9 +12175,9 @@ const ToastAction = reactExports.forwardRef(({ className, ...props }, ref2) => /
|
|
|
12047
12175
|
...props
|
|
12048
12176
|
}
|
|
12049
12177
|
));
|
|
12050
|
-
ToastAction.displayName =
|
|
12178
|
+
ToastAction.displayName = ToastAction$1.displayName;
|
|
12051
12179
|
const ToastClose = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12052
|
-
|
|
12180
|
+
ToastClose$1,
|
|
12053
12181
|
{
|
|
12054
12182
|
ref: ref2,
|
|
12055
12183
|
className: cn$1(
|
|
@@ -12061,25 +12189,25 @@ const ToastClose = reactExports.forwardRef(({ className, ...props }, ref2) => /*
|
|
|
12061
12189
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Cross2Icon, { className: "h-4 w-4" })
|
|
12062
12190
|
}
|
|
12063
12191
|
));
|
|
12064
|
-
ToastClose.displayName =
|
|
12192
|
+
ToastClose.displayName = ToastClose$1.displayName;
|
|
12065
12193
|
const ToastTitle = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12066
|
-
|
|
12194
|
+
ToastTitle$1,
|
|
12067
12195
|
{
|
|
12068
12196
|
ref: ref2,
|
|
12069
12197
|
className: cn$1("text-sm font-semibold [&+div]:text-xs", className),
|
|
12070
12198
|
...props
|
|
12071
12199
|
}
|
|
12072
12200
|
));
|
|
12073
|
-
ToastTitle.displayName =
|
|
12201
|
+
ToastTitle.displayName = ToastTitle$1.displayName;
|
|
12074
12202
|
const ToastDescription = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
12075
|
-
|
|
12203
|
+
ToastDescription$1,
|
|
12076
12204
|
{
|
|
12077
12205
|
ref: ref2,
|
|
12078
12206
|
className: cn$1("text-sm opacity-90", className),
|
|
12079
12207
|
...props
|
|
12080
12208
|
}
|
|
12081
12209
|
));
|
|
12082
|
-
ToastDescription.displayName =
|
|
12210
|
+
ToastDescription.displayName = ToastDescription$1.displayName;
|
|
12083
12211
|
function Toaster() {
|
|
12084
12212
|
const { toasts } = useToast();
|
|
12085
12213
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(ToastProvider, { children: [
|
|
@@ -17186,7 +17314,12 @@ const OAuthTokensSchema = object({
|
|
|
17186
17314
|
token_type: string(),
|
|
17187
17315
|
expires_in: number().optional(),
|
|
17188
17316
|
scope: string().optional(),
|
|
17189
|
-
refresh_token: string().optional()
|
|
17317
|
+
refresh_token: string().optional(),
|
|
17318
|
+
/**
|
|
17319
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
17320
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
17321
|
+
*/
|
|
17322
|
+
issuer: string().optional().catch(void 0)
|
|
17190
17323
|
}).strip();
|
|
17191
17324
|
const OAuthErrorResponseSchema = object({
|
|
17192
17325
|
error: string(),
|
|
@@ -17216,7 +17349,12 @@ const OAuthClientInformationSchema = object({
|
|
|
17216
17349
|
client_id: string(),
|
|
17217
17350
|
client_secret: string().optional(),
|
|
17218
17351
|
client_id_issued_at: number$1().optional(),
|
|
17219
|
-
client_secret_expires_at: number$1().optional()
|
|
17352
|
+
client_secret_expires_at: number$1().optional(),
|
|
17353
|
+
/**
|
|
17354
|
+
* Not part of the wire format: the authorization server this value was obtained from, added by
|
|
17355
|
+
* the client's `auth()` before it is stored and compared when it is read back.
|
|
17356
|
+
*/
|
|
17357
|
+
issuer: string().optional().catch(void 0)
|
|
17220
17358
|
}).strip();
|
|
17221
17359
|
const OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
17222
17360
|
object({
|
|
@@ -17228,7 +17366,7 @@ object({
|
|
|
17228
17366
|
token_type_hint: string().optional()
|
|
17229
17367
|
}).strip();
|
|
17230
17368
|
const name = "@modelcontextprotocol/inspector-client";
|
|
17231
|
-
const version$1 = "1.0.
|
|
17369
|
+
const version$1 = "1.0.3";
|
|
17232
17370
|
const packageJson = {
|
|
17233
17371
|
name,
|
|
17234
17372
|
version: version$1
|
|
@@ -17293,6 +17431,47 @@ const DEFAULT_INSPECTOR_CONFIG = {
|
|
|
17293
17431
|
is_session_item: false
|
|
17294
17432
|
}
|
|
17295
17433
|
};
|
|
17434
|
+
const OAUTH_CALLBACK_PATH = "/oauth/callback";
|
|
17435
|
+
const OAUTH_DEBUG_CALLBACK_PATH = "/oauth/callback/debug";
|
|
17436
|
+
const isOAuthCallbackPath = (pathname = window.location.pathname) => pathname === OAUTH_CALLBACK_PATH || pathname === OAUTH_DEBUG_CALLBACK_PATH;
|
|
17437
|
+
const STORAGE_KEY = "mcp_oauth_connection_snapshot";
|
|
17438
|
+
const TRANSPORT_TYPES = ["stdio", "sse", "streamable-http"];
|
|
17439
|
+
const CONNECTION_TYPES = ["direct", "proxy"];
|
|
17440
|
+
const isSnapshot = (value) => {
|
|
17441
|
+
if (typeof value !== "object" || value === null) return false;
|
|
17442
|
+
const v2 = value;
|
|
17443
|
+
return typeof v2.serverUrl === "string" && typeof v2.transportType === "string" && TRANSPORT_TYPES.includes(v2.transportType) && typeof v2.connectionType === "string" && CONNECTION_TYPES.includes(v2.connectionType) && typeof v2.command === "string" && typeof v2.args === "string" && typeof v2.proxyAddress === "string";
|
|
17444
|
+
};
|
|
17445
|
+
const saveOAuthConnectionSnapshot = (snapshot) => {
|
|
17446
|
+
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(snapshot));
|
|
17447
|
+
};
|
|
17448
|
+
const readOAuthConnectionSnapshot = () => {
|
|
17449
|
+
const raw = sessionStorage.getItem(STORAGE_KEY);
|
|
17450
|
+
if (!raw) return null;
|
|
17451
|
+
try {
|
|
17452
|
+
const parsed = JSON.parse(raw);
|
|
17453
|
+
return isSnapshot(parsed) ? parsed : null;
|
|
17454
|
+
} catch {
|
|
17455
|
+
return null;
|
|
17456
|
+
}
|
|
17457
|
+
};
|
|
17458
|
+
const clearOAuthConnectionSnapshot = () => {
|
|
17459
|
+
sessionStorage.removeItem(STORAGE_KEY);
|
|
17460
|
+
};
|
|
17461
|
+
const getOAuthCallbackSnapshot = () => isOAuthCallbackPath() ? readOAuthConnectionSnapshot() : null;
|
|
17462
|
+
const getOAuthReconnectRefusal = (snapshot, live) => {
|
|
17463
|
+
if (!snapshot) {
|
|
17464
|
+
return "No saved connection for this authorization. Connect again from the sidebar.";
|
|
17465
|
+
}
|
|
17466
|
+
if (snapshot.transportType === "stdio" || live.transportType === "stdio") {
|
|
17467
|
+
return "OAuth applies only to SSE and Streamable HTTP connections. Not reconnecting.";
|
|
17468
|
+
}
|
|
17469
|
+
const matches = live.authorizedServerUrl === snapshot.serverUrl && live.sseUrl === snapshot.serverUrl && live.transportType === snapshot.transportType && live.connectionType === snapshot.connectionType && live.proxyAddress === snapshot.proxyAddress;
|
|
17470
|
+
if (!matches) {
|
|
17471
|
+
return "Connection settings changed during authorization. Connect again from the sidebar.";
|
|
17472
|
+
}
|
|
17473
|
+
return void 0;
|
|
17474
|
+
};
|
|
17296
17475
|
const META_PREFIX_LABEL_REGEX = /^[a-z](?:[a-z\d-]*[a-z\d])?$/i;
|
|
17297
17476
|
const META_NAME_REGEX = /^[a-z\d](?:[a-z\d._-]*[a-z\d])?$/i;
|
|
17298
17477
|
const RESERVED_NAMESPACE_LABELS = ["modelcontextprotocol", "mcp"];
|
|
@@ -21067,6 +21246,9 @@ class Protocol {
|
|
|
21067
21246
|
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
21068
21247
|
const handleTaskResult = async () => {
|
|
21069
21248
|
const taskId = request.params.taskId;
|
|
21249
|
+
if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
|
|
21250
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
21251
|
+
}
|
|
21070
21252
|
if (this._taskMessageQueue) {
|
|
21071
21253
|
let queuedMessage;
|
|
21072
21254
|
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
@@ -21097,12 +21279,12 @@ class Protocol {
|
|
|
21097
21279
|
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
21098
21280
|
}
|
|
21099
21281
|
if (!isTerminal(task.status)) {
|
|
21100
|
-
await this._waitForTaskUpdate(taskId, extra.signal);
|
|
21282
|
+
await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
|
|
21101
21283
|
return await handleTaskResult();
|
|
21102
21284
|
}
|
|
21103
21285
|
if (isTerminal(task.status)) {
|
|
21104
21286
|
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
|
21105
|
-
this._clearTaskQueue(taskId);
|
|
21287
|
+
this._clearTaskQueue(taskId, extra.sessionId);
|
|
21106
21288
|
return {
|
|
21107
21289
|
...result,
|
|
21108
21290
|
_meta: {
|
|
@@ -21139,7 +21321,7 @@ class Protocol {
|
|
|
21139
21321
|
throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
|
21140
21322
|
}
|
|
21141
21323
|
await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
|
|
21142
|
-
this._clearTaskQueue(request.params.taskId);
|
|
21324
|
+
this._clearTaskQueue(request.params.taskId, extra.sessionId);
|
|
21143
21325
|
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
21144
21326
|
if (!cancelledTask) {
|
|
21145
21327
|
throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
|
@@ -21267,6 +21449,19 @@ class Protocol {
|
|
|
21267
21449
|
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
21268
21450
|
const capturedTransport = this._transport;
|
|
21269
21451
|
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
21452
|
+
const sessionId = capturedTransport?.sessionId;
|
|
21453
|
+
const store = this._taskStore;
|
|
21454
|
+
let relatedTaskFound = true;
|
|
21455
|
+
let relatedTaskLookup;
|
|
21456
|
+
if (relatedTaskId && store && this._taskMessageQueue && sessionId !== void 0) {
|
|
21457
|
+
relatedTaskFound = false;
|
|
21458
|
+
relatedTaskLookup = (async () => {
|
|
21459
|
+
if (!await store.getTask(relatedTaskId, sessionId)) {
|
|
21460
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
|
|
21461
|
+
}
|
|
21462
|
+
relatedTaskFound = true;
|
|
21463
|
+
})();
|
|
21464
|
+
}
|
|
21270
21465
|
if (handler === void 0) {
|
|
21271
21466
|
const errorResponse = {
|
|
21272
21467
|
jsonrpc: "2.0",
|
|
@@ -21276,7 +21471,10 @@ class Protocol {
|
|
|
21276
21471
|
message: "Method not found"
|
|
21277
21472
|
}
|
|
21278
21473
|
};
|
|
21279
|
-
if (relatedTaskId &&
|
|
21474
|
+
if (relatedTaskId && relatedTaskLookup) {
|
|
21475
|
+
const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
|
|
21476
|
+
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
|
21477
|
+
} else if (relatedTaskId && this._taskMessageQueue) {
|
|
21280
21478
|
this._enqueueTaskMessage(relatedTaskId, {
|
|
21281
21479
|
type: "error",
|
|
21282
21480
|
message: errorResponse,
|
|
@@ -21327,7 +21525,10 @@ class Protocol {
|
|
|
21327
21525
|
closeSSEStream: extra?.closeSSEStream,
|
|
21328
21526
|
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
21329
21527
|
};
|
|
21330
|
-
Promise.resolve().then(() => {
|
|
21528
|
+
(relatedTaskLookup ?? Promise.resolve()).then(() => {
|
|
21529
|
+
if (relatedTaskLookup && abortController.signal.aborted) {
|
|
21530
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
21531
|
+
}
|
|
21331
21532
|
if (taskCreationParams) {
|
|
21332
21533
|
this.assertTaskHandlerCapability(request.method);
|
|
21333
21534
|
}
|
|
@@ -21362,7 +21563,7 @@ class Protocol {
|
|
|
21362
21563
|
...error["data"] !== void 0 && { data: error["data"] }
|
|
21363
21564
|
}
|
|
21364
21565
|
};
|
|
21365
|
-
if (relatedTaskId && this._taskMessageQueue) {
|
|
21566
|
+
if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
|
|
21366
21567
|
await this._enqueueTaskMessage(relatedTaskId, {
|
|
21367
21568
|
type: "error",
|
|
21368
21569
|
message: errorResponse,
|
|
@@ -21842,7 +22043,7 @@ class Protocol {
|
|
|
21842
22043
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
21843
22044
|
}
|
|
21844
22045
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
21845
|
-
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
22046
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
|
|
21846
22047
|
}
|
|
21847
22048
|
/**
|
|
21848
22049
|
* Clears the message queue for a task and rejects any pending request resolvers.
|
|
@@ -21871,12 +22072,13 @@ class Protocol {
|
|
|
21871
22072
|
* Uses polling to check for updates at the task's configured poll interval.
|
|
21872
22073
|
* @param taskId The task ID to wait for
|
|
21873
22074
|
* @param signal Abort signal to cancel the wait
|
|
22075
|
+
* @param sessionId Session of the request that waits, passed to the task store
|
|
21874
22076
|
* @returns Promise that resolves when an update occurs or rejects if aborted
|
|
21875
22077
|
*/
|
|
21876
|
-
async _waitForTaskUpdate(taskId, signal) {
|
|
22078
|
+
async _waitForTaskUpdate(taskId, signal, sessionId) {
|
|
21877
22079
|
let interval = this._options?.defaultTaskPollInterval ?? 1e3;
|
|
21878
22080
|
try {
|
|
21879
|
-
const task = await this._taskStore?.getTask(taskId);
|
|
22081
|
+
const task = await this._taskStore?.getTask(taskId, sessionId);
|
|
21880
22082
|
if (task?.pollInterval) {
|
|
21881
22083
|
interval = task.pollInterval;
|
|
21882
22084
|
}
|
|
@@ -22228,6 +22430,93 @@ const OAUTH_ERRORS = {
|
|
|
22228
22430
|
[InsufficientScopeError.errorCode]: InsufficientScopeError,
|
|
22229
22431
|
[InvalidTargetError.errorCode]: InvalidTargetError
|
|
22230
22432
|
};
|
|
22433
|
+
function normalizeHeaders(headers) {
|
|
22434
|
+
if (!headers)
|
|
22435
|
+
return {};
|
|
22436
|
+
if (headers instanceof Headers) {
|
|
22437
|
+
return Object.fromEntries(headers.entries());
|
|
22438
|
+
}
|
|
22439
|
+
if (Array.isArray(headers)) {
|
|
22440
|
+
return Object.fromEntries(headers);
|
|
22441
|
+
}
|
|
22442
|
+
return { ...headers };
|
|
22443
|
+
}
|
|
22444
|
+
function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
22445
|
+
if (!baseInit) {
|
|
22446
|
+
return baseFetch;
|
|
22447
|
+
}
|
|
22448
|
+
return async (url2, init) => {
|
|
22449
|
+
const mergedInit = {
|
|
22450
|
+
...baseInit,
|
|
22451
|
+
...init,
|
|
22452
|
+
// Headers need special handling - merge instead of replace
|
|
22453
|
+
headers: init?.headers ? { ...normalizeHeaders(baseInit.headers), ...normalizeHeaders(init.headers) } : baseInit.headers
|
|
22454
|
+
};
|
|
22455
|
+
return baseFetch(url2, mergedInit);
|
|
22456
|
+
};
|
|
22457
|
+
}
|
|
22458
|
+
const MAX_REDIRECTS = 5;
|
|
22459
|
+
const REDIRECT_STATUSES = [301, 302, 303, 307, 308];
|
|
22460
|
+
function isWithinOrigin(from, to2) {
|
|
22461
|
+
if (from.protocol === to2.protocol && from.hostname === to2.hostname && from.port === to2.port) {
|
|
22462
|
+
return true;
|
|
22463
|
+
}
|
|
22464
|
+
return from.hostname === to2.hostname && from.protocol === "http:" && from.port === "" && to2.protocol === "https:" && to2.port === "";
|
|
22465
|
+
}
|
|
22466
|
+
function redirectTarget(response, requestUrl) {
|
|
22467
|
+
const location = REDIRECT_STATUSES.includes(response.status) ? response.headers.get("location") : null;
|
|
22468
|
+
try {
|
|
22469
|
+
return location ? new URL(location, requestUrl) : void 0;
|
|
22470
|
+
} catch {
|
|
22471
|
+
return void 0;
|
|
22472
|
+
}
|
|
22473
|
+
}
|
|
22474
|
+
function followWithinOrigin(baseFetch, url2, init, response, followed = 0) {
|
|
22475
|
+
const target = redirectTarget(response, url2);
|
|
22476
|
+
const keepsMethod = response.status === 307 || response.status === 308 || (init?.method ?? "GET").toUpperCase() === "GET";
|
|
22477
|
+
if (!target || followed === MAX_REDIRECTS || !keepsMethod) {
|
|
22478
|
+
return void 0;
|
|
22479
|
+
}
|
|
22480
|
+
const from = new URL(url2);
|
|
22481
|
+
const addsUserinfo = (target.username || target.password) && (target.username !== from.username || target.password !== from.password);
|
|
22482
|
+
if (addsUserinfo || !isWithinOrigin(from, target)) {
|
|
22483
|
+
return void 0;
|
|
22484
|
+
}
|
|
22485
|
+
return Promise.resolve(response.body?.cancel()).then(() => baseFetch(target, { ...init, redirect: "manual" })).then((next) => followWithinOrigin(baseFetch, target, init, next, followed + 1) ?? next);
|
|
22486
|
+
}
|
|
22487
|
+
const followingFetches = /* @__PURE__ */ new WeakSet();
|
|
22488
|
+
function fetchLeavingRedirects(baseFetch) {
|
|
22489
|
+
const following = (url2, init) => (baseFetch ?? fetch)(url2, init);
|
|
22490
|
+
followingFetches.add(following);
|
|
22491
|
+
return following;
|
|
22492
|
+
}
|
|
22493
|
+
function fetchWithinOrigin(baseFetch = fetch) {
|
|
22494
|
+
if (followingFetches.has(baseFetch)) {
|
|
22495
|
+
return baseFetch;
|
|
22496
|
+
}
|
|
22497
|
+
return (url2, init) => {
|
|
22498
|
+
if (init?.redirect === "error" || init?.redirect === "manual") {
|
|
22499
|
+
return baseFetch(url2, init);
|
|
22500
|
+
}
|
|
22501
|
+
return Promise.resolve(baseFetch(url2, { ...init, redirect: "manual" })).then((response) => followWithinOrigin(baseFetch, url2, init, response) ?? response);
|
|
22502
|
+
};
|
|
22503
|
+
}
|
|
22504
|
+
function unfollowedRedirect(response, requestUrl) {
|
|
22505
|
+
if (response.type === "opaqueredirect") {
|
|
22506
|
+
return "Redirect not followed: this runtime does not expose the redirect target";
|
|
22507
|
+
}
|
|
22508
|
+
const from = response.url || requestUrl;
|
|
22509
|
+
const target = redirectTarget(response, from);
|
|
22510
|
+
if (!target) {
|
|
22511
|
+
return void 0;
|
|
22512
|
+
}
|
|
22513
|
+
target.username = target.password = target.search = target.hash = "";
|
|
22514
|
+
if (target.protocol === "http:" && new URL(from).protocol === "https:") {
|
|
22515
|
+
target.protocol = "https:";
|
|
22516
|
+
return `Redirect to plain http not followed; try ${target.href} instead`;
|
|
22517
|
+
}
|
|
22518
|
+
return `Redirect to ${target.href} not followed`;
|
|
22519
|
+
}
|
|
22231
22520
|
class UnauthorizedError extends Error {
|
|
22232
22521
|
constructor(message) {
|
|
22233
22522
|
super(message ?? "Unauthorized");
|
|
@@ -22298,10 +22587,31 @@ async function parseErrorResponse(input) {
|
|
|
22298
22587
|
const errorClass = OAUTH_ERRORS[error] || ServerError;
|
|
22299
22588
|
return new errorClass(error_description || "", error_uri);
|
|
22300
22589
|
} catch (error) {
|
|
22301
|
-
const
|
|
22590
|
+
const redirect = input instanceof Response ? unfollowedRedirect(input, input.url) : void 0;
|
|
22591
|
+
const errorMessage = `${statusCode ? `HTTP ${statusCode}: ` : ""}${redirect ?? `Invalid OAuth error response: ${error}. Raw body: ${body}`}`;
|
|
22302
22592
|
return new ServerError(errorMessage);
|
|
22303
22593
|
}
|
|
22304
22594
|
}
|
|
22595
|
+
function issuersMatch(a2, b2) {
|
|
22596
|
+
let [x2, y] = [a2, b2];
|
|
22597
|
+
try {
|
|
22598
|
+
[x2, y] = [new URL(a2).href, new URL(b2).href];
|
|
22599
|
+
} catch {
|
|
22600
|
+
}
|
|
22601
|
+
return x2 === y || x2.endsWith("/") && x2.slice(0, -1) === y || y.endsWith("/") && y.slice(0, -1) === x2;
|
|
22602
|
+
}
|
|
22603
|
+
function discardIfIssuerMismatch(stored, issuer) {
|
|
22604
|
+
if (!stored)
|
|
22605
|
+
return void 0;
|
|
22606
|
+
if (typeof stored.issuer !== "string")
|
|
22607
|
+
return stored.issuer == null ? stored : { ...stored, issuer: void 0 };
|
|
22608
|
+
return issuersMatch(stored.issuer, issuer) ? stored : void 0;
|
|
22609
|
+
}
|
|
22610
|
+
const TokenResponseSchema = OAuthTokensSchema.omit({ issuer: true });
|
|
22611
|
+
const RegistrationResponseSchema = OAuthClientInformationFullSchema.omit({ issuer: true });
|
|
22612
|
+
function boundElsewhereError(stored, issuer) {
|
|
22613
|
+
return new Error(`OAuth client information is bound to authorization server ${stored.issuer} and is not presented to ${issuer}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`);
|
|
22614
|
+
}
|
|
22305
22615
|
async function auth(provider, options2) {
|
|
22306
22616
|
try {
|
|
22307
22617
|
return await authInternal(provider, options2);
|
|
@@ -22355,9 +22665,24 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope: sco
|
|
|
22355
22665
|
authorizationServerMetadata: metadata2
|
|
22356
22666
|
});
|
|
22357
22667
|
}
|
|
22358
|
-
const
|
|
22668
|
+
const issuer = String(authorizationServerUrl);
|
|
22669
|
+
const selectedResource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
22670
|
+
const resource = selectedResource && resourceMetadata && !provider.validateResourceURL ? resourceMetadata.resource : selectedResource;
|
|
22359
22671
|
const resolvedScope = scope2 || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
|
|
22360
|
-
|
|
22672
|
+
const storedClientInformation = await Promise.resolve(provider.clientInformation());
|
|
22673
|
+
let clientInformation = discardIfIssuerMismatch(storedClientInformation, issuer);
|
|
22674
|
+
const canRegisterAgain = provider.saveClientInformation !== void 0 && !!provider.redirectUrl;
|
|
22675
|
+
if (storedClientInformation && !clientInformation && !canRegisterAgain) {
|
|
22676
|
+
throw boundElsewhereError(storedClientInformation, issuer);
|
|
22677
|
+
}
|
|
22678
|
+
const unstampedClientInformation = clientInformation?.issuer == null ? clientInformation : void 0;
|
|
22679
|
+
const bindClientInformation = async () => {
|
|
22680
|
+
try {
|
|
22681
|
+
if (unstampedClientInformation)
|
|
22682
|
+
await provider.saveClientInformation?.({ ...unstampedClientInformation, issuer });
|
|
22683
|
+
} catch {
|
|
22684
|
+
}
|
|
22685
|
+
};
|
|
22361
22686
|
if (!clientInformation) {
|
|
22362
22687
|
if (authorizationCode !== void 0) {
|
|
22363
22688
|
throw new Error("Existing OAuth client information is required when exchanging an authorization code");
|
|
@@ -22369,9 +22694,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope: sco
|
|
|
22369
22694
|
}
|
|
22370
22695
|
const shouldUseUrlBasedClientId = supportsUrlBasedClientId && clientMetadataUrl;
|
|
22371
22696
|
if (shouldUseUrlBasedClientId) {
|
|
22372
|
-
clientInformation = {
|
|
22373
|
-
client_id: clientMetadataUrl
|
|
22374
|
-
};
|
|
22697
|
+
clientInformation = { client_id: clientMetadataUrl, issuer };
|
|
22375
22698
|
await provider.saveClientInformation?.(clientInformation);
|
|
22376
22699
|
} else {
|
|
22377
22700
|
if (!provider.saveClientInformation) {
|
|
@@ -22383,8 +22706,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope: sco
|
|
|
22383
22706
|
scope: resolvedScope,
|
|
22384
22707
|
fetchFn
|
|
22385
22708
|
});
|
|
22386
|
-
|
|
22387
|
-
clientInformation
|
|
22709
|
+
clientInformation = { ...fullInformation, issuer };
|
|
22710
|
+
await provider.saveClientInformation(clientInformation);
|
|
22388
22711
|
}
|
|
22389
22712
|
}
|
|
22390
22713
|
const nonInteractiveFlow = !provider.redirectUrl;
|
|
@@ -22395,10 +22718,14 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope: sco
|
|
|
22395
22718
|
authorizationCode,
|
|
22396
22719
|
fetchFn
|
|
22397
22720
|
});
|
|
22398
|
-
await
|
|
22721
|
+
await bindClientInformation();
|
|
22722
|
+
await provider.saveTokens({ ...tokens2, issuer });
|
|
22399
22723
|
return "AUTHORIZED";
|
|
22400
22724
|
}
|
|
22401
|
-
const tokens = await provider.tokens();
|
|
22725
|
+
const tokens = discardIfIssuerMismatch(await provider.tokens(), issuer);
|
|
22726
|
+
if (tokens?.refresh_token && tokens.issuer == null) {
|
|
22727
|
+
console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged.");
|
|
22728
|
+
}
|
|
22402
22729
|
if (tokens?.refresh_token) {
|
|
22403
22730
|
try {
|
|
22404
22731
|
const newTokens = await refreshAuthorization(authorizationServerUrl, {
|
|
@@ -22409,7 +22736,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope: sco
|
|
|
22409
22736
|
addClientAuthentication: provider.addClientAuthentication,
|
|
22410
22737
|
fetchFn
|
|
22411
22738
|
});
|
|
22412
|
-
await
|
|
22739
|
+
await bindClientInformation();
|
|
22740
|
+
await provider.saveTokens({ ...newTokens, issuer });
|
|
22413
22741
|
return "AUTHORIZED";
|
|
22414
22742
|
} catch (error) {
|
|
22415
22743
|
if (!(error instanceof OAuthError) || error instanceof ServerError) ;
|
|
@@ -22508,7 +22836,7 @@ async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn =
|
|
|
22508
22836
|
}
|
|
22509
22837
|
async function fetchWithCorsRetry(url2, headers, fetchFn = fetch) {
|
|
22510
22838
|
try {
|
|
22511
|
-
return await fetchFn(url2, { headers });
|
|
22839
|
+
return await fetchWithinOrigin(fetchFn)(url2, { headers });
|
|
22512
22840
|
} catch (error) {
|
|
22513
22841
|
if (error instanceof TypeError) {
|
|
22514
22842
|
if (headers) {
|
|
@@ -22533,7 +22861,7 @@ async function tryMetadataDiscovery(url2, protocolVersion, fetchFn = fetch) {
|
|
|
22533
22861
|
return await fetchWithCorsRetry(url2, headers, fetchFn);
|
|
22534
22862
|
}
|
|
22535
22863
|
function shouldAttemptFallback(response, pathname) {
|
|
22536
|
-
return !response || response.
|
|
22864
|
+
return !response || !response.ok && response.status < 500 && pathname !== "/";
|
|
22537
22865
|
}
|
|
22538
22866
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
22539
22867
|
const issuer = new URL(serverUrl);
|
|
@@ -22599,7 +22927,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
22599
22927
|
}
|
|
22600
22928
|
if (!response.ok) {
|
|
22601
22929
|
await response.body?.cancel();
|
|
22602
|
-
if (response.status
|
|
22930
|
+
if (response.status < 500) {
|
|
22603
22931
|
continue;
|
|
22604
22932
|
}
|
|
22605
22933
|
throw new Error(`HTTP ${response.status} trying to load ${type2 === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
@@ -22632,6 +22960,9 @@ async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
|
22632
22960
|
resourceMetadata
|
|
22633
22961
|
};
|
|
22634
22962
|
}
|
|
22963
|
+
function resourceIndicatorToString(resource) {
|
|
22964
|
+
return typeof resource === "string" ? resource : resource.href;
|
|
22965
|
+
}
|
|
22635
22966
|
async function startAuthorization(authorizationServerUrl, { metadata: metadata2, clientInformation, redirectUrl, scope: scope2, state, resource }) {
|
|
22636
22967
|
let authorizationUrl;
|
|
22637
22968
|
if (metadata2) {
|
|
@@ -22663,7 +22994,7 @@ async function startAuthorization(authorizationServerUrl, { metadata: metadata2,
|
|
|
22663
22994
|
authorizationUrl.searchParams.append("prompt", "consent");
|
|
22664
22995
|
}
|
|
22665
22996
|
if (resource) {
|
|
22666
|
-
authorizationUrl.searchParams.set("resource", resource
|
|
22997
|
+
authorizationUrl.searchParams.set("resource", resourceIndicatorToString(resource));
|
|
22667
22998
|
}
|
|
22668
22999
|
return { authorizationUrl, codeVerifier };
|
|
22669
23000
|
}
|
|
@@ -22682,7 +23013,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata: metadata2
|
|
|
22682
23013
|
Accept: "application/json"
|
|
22683
23014
|
});
|
|
22684
23015
|
if (resource) {
|
|
22685
|
-
tokenRequestParams.set("resource", resource
|
|
23016
|
+
tokenRequestParams.set("resource", resourceIndicatorToString(resource));
|
|
22686
23017
|
}
|
|
22687
23018
|
if (addClientAuthentication) {
|
|
22688
23019
|
await addClientAuthentication(headers, tokenRequestParams, tokenUrl, metadata2);
|
|
@@ -22691,7 +23022,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata: metadata2
|
|
|
22691
23022
|
const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
|
|
22692
23023
|
applyClientAuthentication(authMethod, clientInformation, headers, tokenRequestParams);
|
|
22693
23024
|
}
|
|
22694
|
-
const response = await (fetchFn ?? fetch)(tokenUrl, {
|
|
23025
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(tokenUrl, {
|
|
22695
23026
|
method: "POST",
|
|
22696
23027
|
headers,
|
|
22697
23028
|
body: tokenRequestParams
|
|
@@ -22699,7 +23030,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata: metadata2
|
|
|
22699
23030
|
if (!response.ok) {
|
|
22700
23031
|
throw await parseErrorResponse(response);
|
|
22701
23032
|
}
|
|
22702
|
-
return
|
|
23033
|
+
return TokenResponseSchema.parse(await response.json());
|
|
22703
23034
|
}
|
|
22704
23035
|
async function exchangeAuthorization(authorizationServerUrl, { metadata: metadata2, clientInformation, authorizationCode, codeVerifier, redirectUri, resource, addClientAuthentication, fetchFn }) {
|
|
22705
23036
|
const tokenRequestParams = prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, redirectUri);
|
|
@@ -22728,6 +23059,15 @@ async function refreshAuthorization(authorizationServerUrl, { metadata: metadata
|
|
|
22728
23059
|
return { refresh_token: refreshToken, ...tokens };
|
|
22729
23060
|
}
|
|
22730
23061
|
async function fetchToken(provider, authorizationServerUrl, { metadata: metadata2, resource, authorizationCode, fetchFn } = {}) {
|
|
23062
|
+
const readClientInformation = async () => {
|
|
23063
|
+
const storedClientInformation = await provider.clientInformation();
|
|
23064
|
+
const checked = discardIfIssuerMismatch(storedClientInformation, String(authorizationServerUrl));
|
|
23065
|
+
if (storedClientInformation && !checked) {
|
|
23066
|
+
throw boundElsewhereError(storedClientInformation, String(authorizationServerUrl));
|
|
23067
|
+
}
|
|
23068
|
+
return checked;
|
|
23069
|
+
};
|
|
23070
|
+
let clientInformation = await readClientInformation();
|
|
22731
23071
|
const scope2 = provider.clientMetadata.scope;
|
|
22732
23072
|
let tokenRequestParams;
|
|
22733
23073
|
if (provider.prepareTokenRequest) {
|
|
@@ -22743,11 +23083,11 @@ async function fetchToken(provider, authorizationServerUrl, { metadata: metadata
|
|
|
22743
23083
|
const codeVerifier = await provider.codeVerifier();
|
|
22744
23084
|
tokenRequestParams = prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, provider.redirectUrl);
|
|
22745
23085
|
}
|
|
22746
|
-
|
|
23086
|
+
clientInformation ?? (clientInformation = await readClientInformation());
|
|
22747
23087
|
return executeTokenRequest(authorizationServerUrl, {
|
|
22748
23088
|
metadata: metadata2,
|
|
22749
23089
|
tokenRequestParams,
|
|
22750
|
-
clientInformation
|
|
23090
|
+
clientInformation,
|
|
22751
23091
|
addClientAuthentication: provider.addClientAuthentication,
|
|
22752
23092
|
resource,
|
|
22753
23093
|
fetchFn
|
|
@@ -22763,7 +23103,7 @@ async function registerClient(authorizationServerUrl, { metadata: metadata2, cli
|
|
|
22763
23103
|
} else {
|
|
22764
23104
|
registrationUrl = new URL("/register", authorizationServerUrl);
|
|
22765
23105
|
}
|
|
22766
|
-
const response = await (fetchFn ?? fetch)(registrationUrl, {
|
|
23106
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(registrationUrl, {
|
|
22767
23107
|
method: "POST",
|
|
22768
23108
|
headers: {
|
|
22769
23109
|
"Content-Type": "application/json"
|
|
@@ -22776,7 +23116,7 @@ async function registerClient(authorizationServerUrl, { metadata: metadata2, cli
|
|
|
22776
23116
|
if (!response.ok) {
|
|
22777
23117
|
throw await parseErrorResponse(response);
|
|
22778
23118
|
}
|
|
22779
|
-
return
|
|
23119
|
+
return RegistrationResponseSchema.parse(await response.json());
|
|
22780
23120
|
}
|
|
22781
23121
|
const parseOAuthCallbackParams = (location) => {
|
|
22782
23122
|
const params = new URLSearchParams(location);
|
|
@@ -22839,6 +23179,18 @@ function validateRedirectUrl(url2) {
|
|
|
22839
23179
|
throw new Error(`Invalid URL: ${url2}`);
|
|
22840
23180
|
}
|
|
22841
23181
|
}
|
|
23182
|
+
function parseHttpUrl(url2) {
|
|
23183
|
+
let parsedUrl;
|
|
23184
|
+
try {
|
|
23185
|
+
parsedUrl = new URL(url2);
|
|
23186
|
+
} catch {
|
|
23187
|
+
return null;
|
|
23188
|
+
}
|
|
23189
|
+
if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
|
|
23190
|
+
return null;
|
|
23191
|
+
}
|
|
23192
|
+
return parsedUrl.href;
|
|
23193
|
+
}
|
|
22842
23194
|
const discoverScopes = async (serverUrl, resourceMetadata, fetchFn) => {
|
|
22843
23195
|
try {
|
|
22844
23196
|
const metadata2 = await discoverAuthorizationServerMetadata(
|
|
@@ -22907,11 +23259,18 @@ const clearScopeFromSessionStorage = (serverUrl) => {
|
|
|
22907
23259
|
sessionStorage.removeItem(key);
|
|
22908
23260
|
};
|
|
22909
23261
|
class InspectorOAuthClientProvider {
|
|
22910
|
-
|
|
23262
|
+
/**
|
|
23263
|
+
* @param connection The connection this authorization is for. It is saved
|
|
23264
|
+
* per tab just before redirecting, and is the only thing the callback will
|
|
23265
|
+
* reconnect with; omit it and the callback will not reconnect.
|
|
23266
|
+
*/
|
|
23267
|
+
constructor(serverUrl, connection) {
|
|
22911
23268
|
this.serverUrl = serverUrl;
|
|
23269
|
+
this.connection = connection;
|
|
22912
23270
|
sessionStorage.setItem(SESSION_KEYS.SERVER_URL, serverUrl);
|
|
22913
23271
|
}
|
|
22914
23272
|
serverUrl;
|
|
23273
|
+
connection;
|
|
22915
23274
|
get scope() {
|
|
22916
23275
|
return getScopeFromSessionStorage(this.serverUrl);
|
|
22917
23276
|
}
|
|
@@ -22974,6 +23333,14 @@ class InspectorOAuthClientProvider {
|
|
|
22974
23333
|
}
|
|
22975
23334
|
redirectToAuthorization(authorizationUrl) {
|
|
22976
23335
|
validateRedirectUrl(authorizationUrl.href);
|
|
23336
|
+
if (this.connection) {
|
|
23337
|
+
saveOAuthConnectionSnapshot({
|
|
23338
|
+
...this.connection,
|
|
23339
|
+
serverUrl: this.serverUrl
|
|
23340
|
+
});
|
|
23341
|
+
} else {
|
|
23342
|
+
clearOAuthConnectionSnapshot();
|
|
23343
|
+
}
|
|
22977
23344
|
window.location.href = authorizationUrl.href;
|
|
22978
23345
|
}
|
|
22979
23346
|
saveCodeVerifier(codeVerifier) {
|
|
@@ -23212,6 +23579,7 @@ class OAuthStateMachine {
|
|
|
23212
23579
|
}
|
|
23213
23580
|
}
|
|
23214
23581
|
const getSearchParam = (key) => {
|
|
23582
|
+
if (isOAuthCallbackPath()) return null;
|
|
23215
23583
|
try {
|
|
23216
23584
|
const url2 = new URL(window.location.href);
|
|
23217
23585
|
return url2.searchParams.get(key);
|
|
@@ -23225,7 +23593,8 @@ const getMCPProxyAddress = (config2) => {
|
|
|
23225
23593
|
proxyFullAddress = proxyFullAddress.replace(/\/+$/, "");
|
|
23226
23594
|
return proxyFullAddress;
|
|
23227
23595
|
}
|
|
23228
|
-
const
|
|
23596
|
+
const portParam = getSearchParam("MCP_PROXY_PORT");
|
|
23597
|
+
const proxyPort = portParam && /^\d{1,5}$/.test(portParam) ? portParam : DEFAULT_MCP_PROXY_LISTEN_PORT;
|
|
23229
23598
|
return `${window.location.protocol}//${window.location.hostname}:${proxyPort}`;
|
|
23230
23599
|
};
|
|
23231
23600
|
const getMCPServerRequestTimeout = (config2) => {
|
|
@@ -23269,8 +23638,9 @@ const getInitialArgs = () => {
|
|
|
23269
23638
|
return localStorage.getItem("lastArgs") || "";
|
|
23270
23639
|
};
|
|
23271
23640
|
const getConfigOverridesFromQueryParams = (defaultConfig) => {
|
|
23272
|
-
const url2 = new URL(window.location.href);
|
|
23273
23641
|
const overrides = {};
|
|
23642
|
+
if (isOAuthCallbackPath()) return overrides;
|
|
23643
|
+
const url2 = new URL(window.location.href);
|
|
23274
23644
|
for (const key of Object.keys(defaultConfig)) {
|
|
23275
23645
|
const param = url2.searchParams.get(key);
|
|
23276
23646
|
if (param !== null) {
|
|
@@ -23289,7 +23659,11 @@ const getConfigOverridesFromQueryParams = (defaultConfig) => {
|
|
|
23289
23659
|
}
|
|
23290
23660
|
return overrides;
|
|
23291
23661
|
};
|
|
23662
|
+
const normalizeProxyAddress = (address) => typeof address === "string" ? address.trim().replace(/\/+$/, "") : "";
|
|
23663
|
+
let queryOnlyProxyAddress = null;
|
|
23664
|
+
const sessionProxyAddressKey = (localStorageKey) => `${localStorageKey}_session_proxy_address`;
|
|
23292
23665
|
const initializeInspectorConfig = (localStorageKey) => {
|
|
23666
|
+
queryOnlyProxyAddress = null;
|
|
23293
23667
|
const savedPersistentConfig = localStorage.getItem(localStorageKey);
|
|
23294
23668
|
const savedEphemeralConfig = sessionStorage.getItem(
|
|
23295
23669
|
`${localStorageKey}_ephemeral`
|
|
@@ -23312,7 +23686,32 @@ const initializeInspectorConfig = (localStorageKey) => {
|
|
|
23312
23686
|
};
|
|
23313
23687
|
}
|
|
23314
23688
|
const overrides = getConfigOverridesFromQueryParams(DEFAULT_INSPECTOR_CONFIG);
|
|
23315
|
-
|
|
23689
|
+
const config2 = { ...baseConfig, ...overrides };
|
|
23690
|
+
const queryAddressItem = overrides.MCP_PROXY_FULL_ADDRESS;
|
|
23691
|
+
const queryAddress = normalizeProxyAddress(queryAddressItem?.value);
|
|
23692
|
+
const savedAddress = normalizeProxyAddress(
|
|
23693
|
+
baseConfig.MCP_PROXY_FULL_ADDRESS.value
|
|
23694
|
+
);
|
|
23695
|
+
if (queryAddressItem && queryAddress && queryAddress !== savedAddress) {
|
|
23696
|
+
queryOnlyProxyAddress = queryAddressItem.value;
|
|
23697
|
+
if (!overrides.MCP_PROXY_AUTH_TOKEN) {
|
|
23698
|
+
config2.MCP_PROXY_AUTH_TOKEN = {
|
|
23699
|
+
...DEFAULT_INSPECTOR_CONFIG.MCP_PROXY_AUTH_TOKEN
|
|
23700
|
+
};
|
|
23701
|
+
}
|
|
23702
|
+
} else if (!queryAddressItem && !overrides.MCP_PROXY_AUTH_TOKEN) {
|
|
23703
|
+
const sessionAddress = sessionStorage.getItem(
|
|
23704
|
+
sessionProxyAddressKey(localStorageKey)
|
|
23705
|
+
);
|
|
23706
|
+
if (sessionAddress && normalizeProxyAddress(sessionAddress) !== savedAddress) {
|
|
23707
|
+
queryOnlyProxyAddress = sessionAddress;
|
|
23708
|
+
config2.MCP_PROXY_FULL_ADDRESS = {
|
|
23709
|
+
...config2.MCP_PROXY_FULL_ADDRESS,
|
|
23710
|
+
value: sessionAddress
|
|
23711
|
+
};
|
|
23712
|
+
}
|
|
23713
|
+
}
|
|
23714
|
+
return config2;
|
|
23316
23715
|
};
|
|
23317
23716
|
const saveInspectorConfig = (localStorageKey, config2) => {
|
|
23318
23717
|
const persistentConfig = {};
|
|
@@ -23324,6 +23723,26 @@ const saveInspectorConfig = (localStorageKey, config2) => {
|
|
|
23324
23723
|
persistentConfig[key] = value;
|
|
23325
23724
|
}
|
|
23326
23725
|
}
|
|
23726
|
+
if (queryOnlyProxyAddress !== null && config2.MCP_PROXY_FULL_ADDRESS?.value === queryOnlyProxyAddress) {
|
|
23727
|
+
sessionStorage.setItem(
|
|
23728
|
+
sessionProxyAddressKey(localStorageKey),
|
|
23729
|
+
queryOnlyProxyAddress
|
|
23730
|
+
);
|
|
23731
|
+
const saved = localStorage.getItem(localStorageKey);
|
|
23732
|
+
let savedAddress;
|
|
23733
|
+
try {
|
|
23734
|
+
savedAddress = saved ? JSON.parse(saved).MCP_PROXY_FULL_ADDRESS : void 0;
|
|
23735
|
+
} catch {
|
|
23736
|
+
savedAddress = void 0;
|
|
23737
|
+
}
|
|
23738
|
+
if (savedAddress) {
|
|
23739
|
+
persistentConfig.MCP_PROXY_FULL_ADDRESS = savedAddress;
|
|
23740
|
+
} else {
|
|
23741
|
+
delete persistentConfig.MCP_PROXY_FULL_ADDRESS;
|
|
23742
|
+
}
|
|
23743
|
+
} else {
|
|
23744
|
+
sessionStorage.removeItem(sessionProxyAddressKey(localStorageKey));
|
|
23745
|
+
}
|
|
23327
23746
|
localStorage.setItem(localStorageKey, JSON.stringify(persistentConfig));
|
|
23328
23747
|
sessionStorage.setItem(
|
|
23329
23748
|
`${localStorageKey}_ephemeral`,
|
|
@@ -30216,7 +30635,7 @@ function requireCodegen$1() {
|
|
|
30216
30635
|
return "{" + opts._n + super.render(opts) + "}" + opts._n;
|
|
30217
30636
|
}
|
|
30218
30637
|
}
|
|
30219
|
-
class
|
|
30638
|
+
class Root extends ParentNode {
|
|
30220
30639
|
}
|
|
30221
30640
|
class Else extends BlockNode {
|
|
30222
30641
|
}
|
|
@@ -30405,7 +30824,7 @@ function requireCodegen$1() {
|
|
|
30405
30824
|
this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
|
|
30406
30825
|
this._extScope = extScope;
|
|
30407
30826
|
this._scope = new scope_1.Scope({ parent: extScope });
|
|
30408
|
-
this._nodes = [new
|
|
30827
|
+
this._nodes = [new Root()];
|
|
30409
30828
|
}
|
|
30410
30829
|
toString() {
|
|
30411
30830
|
return this._root.render(this.opts);
|
|
@@ -32740,6 +33159,7 @@ function requireUtils() {
|
|
|
32740
33159
|
hasRequiredUtils = 1;
|
|
32741
33160
|
const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
32742
33161
|
const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
33162
|
+
const isPort = RegExp.prototype.test.bind(/^\d*$/u);
|
|
32743
33163
|
const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
32744
33164
|
const isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
32745
33165
|
const isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
|
|
@@ -32967,6 +33387,37 @@ function requireUtils() {
|
|
|
32967
33387
|
}
|
|
32968
33388
|
return output.join("");
|
|
32969
33389
|
}
|
|
33390
|
+
function removeDotSegmentsRelative(path) {
|
|
33391
|
+
if (path === "" || path[0] === "/") {
|
|
33392
|
+
return removeDotSegments(path);
|
|
33393
|
+
}
|
|
33394
|
+
const segments = path.split("/");
|
|
33395
|
+
const last = segments.length - 1;
|
|
33396
|
+
const output = [];
|
|
33397
|
+
let trailingDirectory = false;
|
|
33398
|
+
for (let i2 = 0; i2 <= last; i2++) {
|
|
33399
|
+
const segment = segments[i2];
|
|
33400
|
+
if (segment === "." || segment === "..") {
|
|
33401
|
+
if (segment === "..") {
|
|
33402
|
+
if (output.length !== 0 && output[output.length - 1] !== "..") {
|
|
33403
|
+
output.pop();
|
|
33404
|
+
} else {
|
|
33405
|
+
output.push("..");
|
|
33406
|
+
}
|
|
33407
|
+
}
|
|
33408
|
+
trailingDirectory = i2 === last;
|
|
33409
|
+
} else {
|
|
33410
|
+
output.push(segment);
|
|
33411
|
+
}
|
|
33412
|
+
}
|
|
33413
|
+
if (trailingDirectory && output[output.length - 1] !== "..") {
|
|
33414
|
+
output.push("");
|
|
33415
|
+
}
|
|
33416
|
+
if (output.length === 0 || output[0] === "" || output[0].includes(":")) {
|
|
33417
|
+
output.unshift(".");
|
|
33418
|
+
}
|
|
33419
|
+
return output.join("/");
|
|
33420
|
+
}
|
|
32970
33421
|
const HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
|
|
32971
33422
|
const HOST_DELIM_RE = /[@/?#:]/g;
|
|
32972
33423
|
const HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
|
|
@@ -33205,8 +33656,12 @@ function requireUtils() {
|
|
|
33205
33656
|
uriTokens.push(host);
|
|
33206
33657
|
}
|
|
33207
33658
|
if (typeof component.port === "number" || typeof component.port === "string") {
|
|
33659
|
+
const port = String(component.port);
|
|
33660
|
+
if (!isPort(port)) {
|
|
33661
|
+
throw new TypeError("URI port is malformed.");
|
|
33662
|
+
}
|
|
33208
33663
|
uriTokens.push(":");
|
|
33209
|
-
uriTokens.push(
|
|
33664
|
+
uriTokens.push(port);
|
|
33210
33665
|
}
|
|
33211
33666
|
return uriTokens.length ? uriTokens.join("") : void 0;
|
|
33212
33667
|
}
|
|
@@ -33223,6 +33678,7 @@ function requireUtils() {
|
|
|
33223
33678
|
encodeFragment,
|
|
33224
33679
|
escapePreservingEscapes,
|
|
33225
33680
|
removeDotSegments,
|
|
33681
|
+
removeDotSegmentsRelative,
|
|
33226
33682
|
isIPv4,
|
|
33227
33683
|
isUUID,
|
|
33228
33684
|
normalizeIPv6,
|
|
@@ -33445,16 +33901,18 @@ var hasRequiredFastUri;
|
|
|
33445
33901
|
function requireFastUri() {
|
|
33446
33902
|
if (hasRequiredFastUri) return fastUri.exports;
|
|
33447
33903
|
hasRequiredFastUri = 1;
|
|
33448
|
-
const { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
|
|
33904
|
+
const { normalizeIPv6, removeDotSegments, removeDotSegmentsRelative, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = requireUtils();
|
|
33449
33905
|
const { SCHEMES, getSchemeHandler } = requireSchemes();
|
|
33450
33906
|
const VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
|
|
33451
33907
|
const MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
|
|
33452
|
-
|
|
33453
|
-
|
|
33454
|
-
|
|
33908
|
+
const MALFORMED_HOST_ERROR = "URI host is malformed.";
|
|
33909
|
+
const FORBIDDEN_DOMAIN_HOST_CHARACTER = /[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;
|
|
33910
|
+
function validateScheme(scheme) {
|
|
33911
|
+
const stringScheme = String(scheme);
|
|
33912
|
+
if (!VALID_SCHEME.test(stringScheme)) {
|
|
33455
33913
|
throw new TypeError(MALFORMED_SCHEME_ERROR);
|
|
33456
33914
|
}
|
|
33457
|
-
return
|
|
33915
|
+
return stringScheme;
|
|
33458
33916
|
}
|
|
33459
33917
|
function normalize(uri2, options2) {
|
|
33460
33918
|
if (typeof uri2 === "string") {
|
|
@@ -33491,6 +33949,9 @@ function requireFastUri() {
|
|
|
33491
33949
|
const resolvedSchemeHandler = getSchemeHandler(options2 && options2.scheme || resolved.scheme);
|
|
33492
33950
|
const resolvedHost = resolved.host;
|
|
33493
33951
|
const resolvedHostIsIP = resolvedHost !== void 0 && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
|
|
33952
|
+
if (hasForbiddenDomainHost(resolved, options2 || {}, resolvedSchemeHandler, resolvedHostIsIP)) {
|
|
33953
|
+
throw new Error(MALFORMED_HOST_ERROR);
|
|
33954
|
+
}
|
|
33494
33955
|
canonicalizeHost(resolved, options2 || {}, resolvedSchemeHandler, resolvedHostIsIP);
|
|
33495
33956
|
const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !new RegExp("\\P{ASCII}", "u").test(resolvedHost);
|
|
33496
33957
|
if (resolved.error && !encodedASCIIHost) {
|
|
@@ -33532,14 +33993,15 @@ function requireFastUri() {
|
|
|
33532
33993
|
if (relative.path[0] === "/") {
|
|
33533
33994
|
target.path = removeDotSegments(relative.path);
|
|
33534
33995
|
} else {
|
|
33535
|
-
|
|
33996
|
+
const baseHasAuthority = base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0;
|
|
33997
|
+
if (baseHasAuthority && !base.path) {
|
|
33536
33998
|
target.path = "/" + relative.path;
|
|
33537
33999
|
} else if (!base.path) {
|
|
33538
34000
|
target.path = relative.path;
|
|
33539
34001
|
} else {
|
|
33540
34002
|
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
|
|
33541
34003
|
}
|
|
33542
|
-
target.path = removeDotSegments(target.path);
|
|
34004
|
+
target.path = base.scheme === void 0 && !baseHasAuthority && target.path[0] !== "/" ? removeDotSegmentsRelative(target.path) : removeDotSegments(target.path);
|
|
33543
34005
|
}
|
|
33544
34006
|
target.query = relative.query;
|
|
33545
34007
|
}
|
|
@@ -33577,12 +34039,13 @@ function requireFastUri() {
|
|
|
33577
34039
|
const options2 = Object.assign({}, opts);
|
|
33578
34040
|
const uriTokens = [];
|
|
33579
34041
|
if (component.scheme) {
|
|
33580
|
-
component.scheme =
|
|
34042
|
+
component.scheme = validateScheme(component.scheme);
|
|
33581
34043
|
}
|
|
33582
34044
|
const schemeHandler = getSchemeHandler(options2.scheme || component.scheme);
|
|
33583
34045
|
if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options2);
|
|
33584
34046
|
const hasAuthority = component.userinfo !== void 0 || component.host !== void 0 || component.port !== void 0;
|
|
33585
|
-
const
|
|
34047
|
+
const schemelessReference = (component.scheme === void 0 || options2.reference === "suffix") && !hasAuthority;
|
|
34048
|
+
const pathNoScheme = !options2.skipEscape && schemelessReference;
|
|
33586
34049
|
if (component.path !== void 0) {
|
|
33587
34050
|
if (!options2.skipEscape) {
|
|
33588
34051
|
component.path = serializePathEncoding(component.path, pathNoScheme);
|
|
@@ -33591,7 +34054,7 @@ function requireFastUri() {
|
|
|
33591
34054
|
}
|
|
33592
34055
|
}
|
|
33593
34056
|
if (options2.reference !== "suffix" && component.scheme) {
|
|
33594
|
-
component.scheme =
|
|
34057
|
+
component.scheme = validateScheme(component.scheme);
|
|
33595
34058
|
uriTokens.push(component.scheme, ":");
|
|
33596
34059
|
}
|
|
33597
34060
|
const authority = recomposeAuthority(component);
|
|
@@ -33607,9 +34070,9 @@ function requireFastUri() {
|
|
|
33607
34070
|
if (component.path !== void 0) {
|
|
33608
34071
|
let s2 = component.path;
|
|
33609
34072
|
if (!options2.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
|
|
33610
|
-
s2 = removeDotSegments(s2);
|
|
34073
|
+
s2 = schemelessReference && s2[0] !== "/" ? removeDotSegmentsRelative(s2) : removeDotSegments(s2);
|
|
33611
34074
|
}
|
|
33612
|
-
if (
|
|
34075
|
+
if (schemelessReference) {
|
|
33613
34076
|
s2 = serializePathEncoding(s2, true);
|
|
33614
34077
|
}
|
|
33615
34078
|
if (authority === void 0 && s2[0] === "/" && s2[1] === "/") {
|
|
@@ -33648,21 +34111,42 @@ function requireFastUri() {
|
|
|
33648
34111
|
}
|
|
33649
34112
|
return false;
|
|
33650
34113
|
}
|
|
34114
|
+
function isIPLiteral(host) {
|
|
34115
|
+
return host[0] === "[" && host[host.length - 1] === "]";
|
|
34116
|
+
}
|
|
33651
34117
|
function hasMalformedComponentPercentEncoding(matches) {
|
|
33652
34118
|
const host = matches[4];
|
|
33653
|
-
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !(host
|
|
34119
|
+
return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
|
|
33654
34120
|
}
|
|
33655
34121
|
function canonicalizeHost(parsed, options2, schemeHandler, isIP) {
|
|
33656
|
-
if (
|
|
34122
|
+
if (hasForbiddenDomainHost(parsed, options2, schemeHandler, isIP)) {
|
|
34123
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
34124
|
+
return true;
|
|
34125
|
+
}
|
|
34126
|
+
if (!options2.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options2.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
|
|
34127
|
+
let url2;
|
|
33657
34128
|
try {
|
|
33658
|
-
|
|
34129
|
+
url2 = new URL("http://" + parsed.host);
|
|
33659
34130
|
} catch (e2) {
|
|
33660
34131
|
parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e2;
|
|
33661
34132
|
return true;
|
|
33662
34133
|
}
|
|
34134
|
+
if (!isHostOnlyURL(url2)) {
|
|
34135
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
34136
|
+
return true;
|
|
34137
|
+
}
|
|
34138
|
+
parsed.host = url2.hostname;
|
|
33663
34139
|
}
|
|
33664
34140
|
return false;
|
|
33665
34141
|
}
|
|
34142
|
+
function hasForbiddenDomainHost(parsed, options2, schemeHandler, isIP) {
|
|
34143
|
+
return Boolean(
|
|
34144
|
+
parsed.host && isIP === false && !isIPLiteral(parsed.host) && (options2.domainHost || schemeHandler && schemeHandler.domainHost) && FORBIDDEN_DOMAIN_HOST_CHARACTER.test(parsed.host)
|
|
34145
|
+
);
|
|
34146
|
+
}
|
|
34147
|
+
function isHostOnlyURL(url2) {
|
|
34148
|
+
return url2.username === "" && url2.password === "" && url2.port === "" && url2.pathname === "/" && url2.search === "" && url2.hash === "" && url2.hostname !== "";
|
|
34149
|
+
}
|
|
33666
34150
|
function parseWithStatus(uri2, opts) {
|
|
33667
34151
|
const options2 = Object.assign({}, opts);
|
|
33668
34152
|
const parsed = {
|
|
@@ -33717,9 +34201,8 @@ function requireFastUri() {
|
|
|
33717
34201
|
parsed.query = matches[7];
|
|
33718
34202
|
parsed.fragment = matches[8];
|
|
33719
34203
|
if (parsed.scheme !== void 0) {
|
|
33720
|
-
|
|
33721
|
-
|
|
33722
|
-
parsed.scheme = decodedScheme.toLowerCase();
|
|
34204
|
+
if (VALID_SCHEME.test(parsed.scheme)) {
|
|
34205
|
+
parsed.scheme = parsed.scheme.toLowerCase();
|
|
33723
34206
|
} else {
|
|
33724
34207
|
parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
|
|
33725
34208
|
malformedScheme = true;
|
|
@@ -33740,13 +34223,14 @@ function requireFastUri() {
|
|
|
33740
34223
|
if (parsed.host) {
|
|
33741
34224
|
const ipv4result = isIPv4(parsed.host);
|
|
33742
34225
|
if (ipv4result === false) {
|
|
33743
|
-
const bracketedIPLiteral = parsed.host
|
|
34226
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host);
|
|
34227
|
+
const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
|
|
33744
34228
|
const ipv6result = normalizeIPv6(parsed.host);
|
|
33745
34229
|
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
|
|
33746
|
-
malformedIPLiteral =
|
|
34230
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
|
|
33747
34231
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
|
|
33748
34232
|
if (malformedIPLiteral) {
|
|
33749
|
-
parsed.error = parsed.error ||
|
|
34233
|
+
parsed.error = parsed.error || MALFORMED_HOST_ERROR;
|
|
33750
34234
|
malformedAuthorityOrPort = true;
|
|
33751
34235
|
}
|
|
33752
34236
|
} else {
|
|
@@ -33766,14 +34250,17 @@ function requireFastUri() {
|
|
|
33766
34250
|
parsed.error = parsed.error || "URI is not a " + options2.reference + " reference.";
|
|
33767
34251
|
}
|
|
33768
34252
|
const schemeHandler = getSchemeHandler(options2.scheme || parsed.scheme);
|
|
33769
|
-
|
|
33770
|
-
|
|
33771
|
-
|
|
33772
|
-
|
|
33773
|
-
|
|
33774
|
-
|
|
33775
|
-
|
|
34253
|
+
if (!malformedIPLiteral) {
|
|
34254
|
+
malformedHost = canonicalizeHost(parsed, options2, schemeHandler, isIP);
|
|
34255
|
+
}
|
|
34256
|
+
if (uri2.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
|
|
34257
|
+
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
|
|
34258
|
+
if (!isIP) {
|
|
34259
|
+
host = normalizePercentEncoding(host.toLowerCase());
|
|
33776
34260
|
}
|
|
34261
|
+
parsed.host = isIP || options2.scheme !== "null" ? reescapeHostDelimiters(host, isIP) : host;
|
|
34262
|
+
}
|
|
34263
|
+
if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
|
|
33777
34264
|
if (parsed.path) {
|
|
33778
34265
|
parsed.path = normalizePathEncoding(parsed.path);
|
|
33779
34266
|
}
|
|
@@ -37093,7 +37580,7 @@ function requireCodegen() {
|
|
|
37093
37580
|
return "{" + opts._n + super.render(opts) + "}" + opts._n;
|
|
37094
37581
|
}
|
|
37095
37582
|
}
|
|
37096
|
-
class
|
|
37583
|
+
class Root extends ParentNode {
|
|
37097
37584
|
}
|
|
37098
37585
|
class Else extends BlockNode {
|
|
37099
37586
|
}
|
|
@@ -37282,7 +37769,7 @@ function requireCodegen() {
|
|
|
37282
37769
|
this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
|
|
37283
37770
|
this._extScope = extScope;
|
|
37284
37771
|
this._scope = new scope_1.Scope({ parent: extScope });
|
|
37285
|
-
this._nodes = [new
|
|
37772
|
+
this._nodes = [new Root()];
|
|
37286
37773
|
}
|
|
37287
37774
|
toString() {
|
|
37288
37775
|
return this._root.render(this.opts);
|
|
@@ -43429,31 +43916,6 @@ function getBaseURL() {
|
|
|
43429
43916
|
const doc = "document" in globalThis ? globalThis.document : void 0;
|
|
43430
43917
|
return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
|
|
43431
43918
|
}
|
|
43432
|
-
function normalizeHeaders(headers) {
|
|
43433
|
-
if (!headers)
|
|
43434
|
-
return {};
|
|
43435
|
-
if (headers instanceof Headers) {
|
|
43436
|
-
return Object.fromEntries(headers.entries());
|
|
43437
|
-
}
|
|
43438
|
-
if (Array.isArray(headers)) {
|
|
43439
|
-
return Object.fromEntries(headers);
|
|
43440
|
-
}
|
|
43441
|
-
return { ...headers };
|
|
43442
|
-
}
|
|
43443
|
-
function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
43444
|
-
if (!baseInit) {
|
|
43445
|
-
return baseFetch;
|
|
43446
|
-
}
|
|
43447
|
-
return async (url2, init) => {
|
|
43448
|
-
const mergedInit = {
|
|
43449
|
-
...baseInit,
|
|
43450
|
-
...init,
|
|
43451
|
-
// Headers need special handling - merge instead of replace
|
|
43452
|
-
headers: init?.headers ? { ...normalizeHeaders(baseInit.headers), ...normalizeHeaders(init.headers) } : baseInit.headers
|
|
43453
|
-
};
|
|
43454
|
-
return baseFetch(url2, mergedInit);
|
|
43455
|
-
};
|
|
43456
|
-
}
|
|
43457
43919
|
class SseError extends Error {
|
|
43458
43920
|
constructor(code2, message, event) {
|
|
43459
43921
|
super(`SSE error: ${message}`);
|
|
@@ -43471,6 +43933,16 @@ class SSEClientTransport {
|
|
|
43471
43933
|
this._authProvider = opts?.authProvider;
|
|
43472
43934
|
this._fetch = opts?.fetch;
|
|
43473
43935
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
43936
|
+
this._followRedirects = opts?.redirectPolicy === "follow";
|
|
43937
|
+
if (this._followRedirects) {
|
|
43938
|
+
this._fetch = fetchLeavingRedirects(this._fetch);
|
|
43939
|
+
this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
43940
|
+
}
|
|
43941
|
+
}
|
|
43942
|
+
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
43943
|
+
_unfollowedRedirect(response, url2) {
|
|
43944
|
+
const text = unfollowedRedirect(response, url2);
|
|
43945
|
+
return text && !this._followRedirects ? `${text} (redirectPolicy: 'same-origin')` : text;
|
|
43474
43946
|
}
|
|
43475
43947
|
async _authThenStart() {
|
|
43476
43948
|
if (!this._authProvider) {
|
|
@@ -43511,7 +43983,9 @@ class SSEClientTransport {
|
|
|
43511
43983
|
});
|
|
43512
43984
|
}
|
|
43513
43985
|
_startOrAuth() {
|
|
43514
|
-
const
|
|
43986
|
+
const baseFetch = this?._eventSourceInit?.fetch ?? this._fetch ?? fetch;
|
|
43987
|
+
const fetchImpl = this._followRedirects ? baseFetch : fetchWithinOrigin(baseFetch);
|
|
43988
|
+
let redirect;
|
|
43515
43989
|
return new Promise((resolve2, reject) => {
|
|
43516
43990
|
this._eventSource = new EventSource(this._url.href, {
|
|
43517
43991
|
...this._eventSourceInit,
|
|
@@ -43522,6 +43996,7 @@ class SSEClientTransport {
|
|
|
43522
43996
|
...init,
|
|
43523
43997
|
headers
|
|
43524
43998
|
});
|
|
43999
|
+
redirect = this._unfollowedRedirect(response, url2);
|
|
43525
44000
|
if (response.status === 401 && response.headers.has("www-authenticate")) {
|
|
43526
44001
|
const { resourceMetadataUrl, scope: scope2 } = extractWWWAuthenticateParams(response);
|
|
43527
44002
|
this._resourceMetadataUrl = resourceMetadataUrl;
|
|
@@ -43536,7 +44011,7 @@ class SSEClientTransport {
|
|
|
43536
44011
|
this._authThenStart().then(resolve2, reject);
|
|
43537
44012
|
return;
|
|
43538
44013
|
}
|
|
43539
|
-
const error = new SseError(event.code, event.message, event);
|
|
44014
|
+
const error = new SseError(event.code, redirect ?? event.message, event);
|
|
43540
44015
|
reject(error);
|
|
43541
44016
|
this.onerror?.(error);
|
|
43542
44017
|
};
|
|
@@ -43613,7 +44088,7 @@ class SSEClientTransport {
|
|
|
43613
44088
|
body: JSON.stringify(message),
|
|
43614
44089
|
signal: this._abortController?.signal
|
|
43615
44090
|
};
|
|
43616
|
-
const response = await (this._fetch ?? fetch)(this._endpoint, init);
|
|
44091
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._endpoint, init);
|
|
43617
44092
|
if (!response.ok) {
|
|
43618
44093
|
const text = await response.text().catch(() => null);
|
|
43619
44094
|
if (response.status === 401 && this._authProvider) {
|
|
@@ -43631,7 +44106,7 @@ class SSEClientTransport {
|
|
|
43631
44106
|
}
|
|
43632
44107
|
return this.send(message);
|
|
43633
44108
|
}
|
|
43634
|
-
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text}`);
|
|
44109
|
+
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${this._unfollowedRedirect(response, this._endpoint) ?? text}`);
|
|
43635
44110
|
}
|
|
43636
44111
|
await response.body?.cancel();
|
|
43637
44112
|
} catch (error) {
|
|
@@ -43808,9 +44283,19 @@ class StreamableHTTPClientTransport {
|
|
|
43808
44283
|
this._authProvider = opts?.authProvider;
|
|
43809
44284
|
this._fetch = opts?.fetch;
|
|
43810
44285
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
44286
|
+
this._followRedirects = opts?.redirectPolicy === "follow";
|
|
44287
|
+
if (this._followRedirects) {
|
|
44288
|
+
this._fetch = fetchLeavingRedirects(this._fetch);
|
|
44289
|
+
this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
44290
|
+
}
|
|
43811
44291
|
this._sessionId = opts?.sessionId;
|
|
43812
44292
|
this._reconnectionOptions = opts?.reconnectionOptions ?? DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
|
|
43813
44293
|
}
|
|
44294
|
+
/** Error text for a redirect `response` that was not followed, or `undefined` for any other response. */
|
|
44295
|
+
_unfollowedRedirect(response, url2) {
|
|
44296
|
+
const text = unfollowedRedirect(response, url2);
|
|
44297
|
+
return text && !this._followRedirects ? `${text} (redirectPolicy: 'same-origin')` : text;
|
|
44298
|
+
}
|
|
43814
44299
|
async _authThenStart() {
|
|
43815
44300
|
if (!this._authProvider) {
|
|
43816
44301
|
throw new UnauthorizedError("No auth provider");
|
|
@@ -43860,11 +44345,13 @@ class StreamableHTTPClientTransport {
|
|
|
43860
44345
|
if (resumptionToken) {
|
|
43861
44346
|
headers.set("last-event-id", resumptionToken);
|
|
43862
44347
|
}
|
|
43863
|
-
const
|
|
43864
|
-
|
|
43865
|
-
|
|
43866
|
-
|
|
43867
|
-
|
|
44348
|
+
const fetchFn = this._fetch ?? fetch;
|
|
44349
|
+
const init = { method: "GET", headers, signal: this._abortController?.signal };
|
|
44350
|
+
let response = await fetchFn(this._url, this._followRedirects ? init : { ...init, redirect: "manual" });
|
|
44351
|
+
const followed = this._followRedirects ? void 0 : followWithinOrigin(fetchFn, this._url, init, response);
|
|
44352
|
+
if (followed) {
|
|
44353
|
+
response = await followed;
|
|
44354
|
+
}
|
|
43868
44355
|
if (!response.ok) {
|
|
43869
44356
|
await response.body?.cancel();
|
|
43870
44357
|
if (response.status === 401 && this._authProvider) {
|
|
@@ -43873,7 +44360,7 @@ class StreamableHTTPClientTransport {
|
|
|
43873
44360
|
if (response.status === 405) {
|
|
43874
44361
|
return;
|
|
43875
44362
|
}
|
|
43876
|
-
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${response.statusText}`);
|
|
44363
|
+
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
43877
44364
|
}
|
|
43878
44365
|
this._handleSseStream(response.body, options2, true);
|
|
43879
44366
|
} catch (error) {
|
|
@@ -44036,7 +44523,7 @@ class StreamableHTTPClientTransport {
|
|
|
44036
44523
|
body: JSON.stringify(message),
|
|
44037
44524
|
signal: this._abortController?.signal
|
|
44038
44525
|
};
|
|
44039
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
44526
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
44040
44527
|
const sessionId = response.headers.get("mcp-session-id");
|
|
44041
44528
|
if (sessionId) {
|
|
44042
44529
|
this._sessionId = sessionId;
|
|
@@ -44088,7 +44575,7 @@ class StreamableHTTPClientTransport {
|
|
|
44088
44575
|
return this.send(message);
|
|
44089
44576
|
}
|
|
44090
44577
|
}
|
|
44091
|
-
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text}`);
|
|
44578
|
+
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${this._unfollowedRedirect(response, this._url) ?? text}`);
|
|
44092
44579
|
}
|
|
44093
44580
|
this._hasCompletedAuthFlow = false;
|
|
44094
44581
|
this._lastUpscopingHeader = void 0;
|
|
@@ -44150,10 +44637,10 @@ class StreamableHTTPClientTransport {
|
|
|
44150
44637
|
headers,
|
|
44151
44638
|
signal: this._abortController?.signal
|
|
44152
44639
|
};
|
|
44153
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
44640
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
44154
44641
|
await response.body?.cancel();
|
|
44155
44642
|
if (!response.ok && response.status !== 405) {
|
|
44156
|
-
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${response.statusText}`);
|
|
44643
|
+
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
44157
44644
|
}
|
|
44158
44645
|
this._sessionId = void 0;
|
|
44159
44646
|
} catch (error) {
|
|
@@ -44411,6 +44898,13 @@ function useConnection({
|
|
|
44411
44898
|
const isProxyAuthError = (error) => {
|
|
44412
44899
|
return error instanceof Error && error.message.includes("Authentication required. Use the session token");
|
|
44413
44900
|
};
|
|
44901
|
+
const getOAuthConnection = () => ({
|
|
44902
|
+
transportType,
|
|
44903
|
+
connectionType,
|
|
44904
|
+
command,
|
|
44905
|
+
args,
|
|
44906
|
+
proxyAddress: getMCPProxyAddress(config2)
|
|
44907
|
+
});
|
|
44414
44908
|
const handleAuthError = async (error) => {
|
|
44415
44909
|
if (isConnectionAuthError(error)) {
|
|
44416
44910
|
let scope2 = oauthScope?.trim();
|
|
@@ -44428,7 +44922,10 @@ function useConnection({
|
|
|
44428
44922
|
scope2 = await discoverScopes(sseUrl, resourceMetadata, fetchFn);
|
|
44429
44923
|
}
|
|
44430
44924
|
saveScopeToSessionStorage(sseUrl, scope2);
|
|
44431
|
-
const serverAuthProvider = new InspectorOAuthClientProvider(
|
|
44925
|
+
const serverAuthProvider = new InspectorOAuthClientProvider(
|
|
44926
|
+
sseUrl,
|
|
44927
|
+
getOAuthConnection()
|
|
44928
|
+
);
|
|
44432
44929
|
try {
|
|
44433
44930
|
const result = await auth(serverAuthProvider, {
|
|
44434
44931
|
serverUrl: sseUrl,
|
|
@@ -44495,7 +44992,10 @@ function useConnection({
|
|
|
44495
44992
|
let lastRequest = "";
|
|
44496
44993
|
try {
|
|
44497
44994
|
const headers = {};
|
|
44498
|
-
const serverAuthProvider = new InspectorOAuthClientProvider(
|
|
44995
|
+
const serverAuthProvider = new InspectorOAuthClientProvider(
|
|
44996
|
+
sseUrl,
|
|
44997
|
+
getOAuthConnection()
|
|
44998
|
+
);
|
|
44499
44999
|
let finalHeaders = customHeaders || [];
|
|
44500
45000
|
const isEmptyAuthHeader = (header) => header.name.trim().toLowerCase() === "authorization" && header.value.trim().toLowerCase() === "bearer";
|
|
44501
45001
|
const hasEmptyAuthHeader = finalHeaders.some(
|
|
@@ -45157,8 +45657,8 @@ function useDraggableSidebar(initialWidth) {
|
|
|
45157
45657
|
handleDragStart
|
|
45158
45658
|
};
|
|
45159
45659
|
}
|
|
45160
|
-
var __defProp$
|
|
45161
|
-
var __name$
|
|
45660
|
+
var __defProp$g = Object.defineProperty;
|
|
45661
|
+
var __name$g = (target, value) => __defProp$g(target, "name", { value, configurable: true });
|
|
45162
45662
|
var useReactId = React2[" useId ".trim().toString()] || (() => void 0);
|
|
45163
45663
|
var count$1 = 0;
|
|
45164
45664
|
function useId(deterministicId) {
|
|
@@ -45168,17 +45668,20 @@ function useId(deterministicId) {
|
|
|
45168
45668
|
}, [deterministicId]);
|
|
45169
45669
|
return deterministicId || (id2 ? `radix-${id2}` : "");
|
|
45170
45670
|
}
|
|
45171
|
-
__name$
|
|
45172
|
-
var __defProp$
|
|
45173
|
-
var __name$
|
|
45671
|
+
__name$g(useId, "useId");
|
|
45672
|
+
var __defProp$f = Object.defineProperty;
|
|
45673
|
+
var __name$f = (target, value) => __defProp$f(target, "name", { value, configurable: true });
|
|
45674
|
+
var Direction$2 = {
|
|
45675
|
+
LTR: "ltr"
|
|
45676
|
+
};
|
|
45174
45677
|
var DirectionContext = reactExports.createContext(void 0);
|
|
45175
45678
|
function useDirection(localDir) {
|
|
45176
45679
|
const globalDir = reactExports.useContext(DirectionContext);
|
|
45177
|
-
return localDir || globalDir ||
|
|
45680
|
+
return localDir || globalDir || Direction$2.LTR;
|
|
45178
45681
|
}
|
|
45179
|
-
__name$
|
|
45180
|
-
var __defProp$
|
|
45181
|
-
var __name$
|
|
45682
|
+
__name$f(useDirection, "useDirection");
|
|
45683
|
+
var __defProp$e = Object.defineProperty;
|
|
45684
|
+
var __name$e = (target, value) => __defProp$e(target, "name", { value, configurable: true });
|
|
45182
45685
|
var _isHydrated = false;
|
|
45183
45686
|
function useIsHydrated() {
|
|
45184
45687
|
const [isHydrated, setIsHydrated] = reactExports.useState(_isHydrated);
|
|
@@ -45190,13 +45693,13 @@ function useIsHydrated() {
|
|
|
45190
45693
|
}, []);
|
|
45191
45694
|
return isHydrated;
|
|
45192
45695
|
}
|
|
45193
|
-
__name$
|
|
45696
|
+
__name$e(useIsHydrated, "useIsHydrated");
|
|
45194
45697
|
var useReactSyncExternalStore = React2[" useSyncExternalStore ".trim().toString()];
|
|
45195
45698
|
function subscribe() {
|
|
45196
45699
|
return () => {
|
|
45197
45700
|
};
|
|
45198
45701
|
}
|
|
45199
|
-
__name$
|
|
45702
|
+
__name$e(subscribe, "subscribe");
|
|
45200
45703
|
function useIsHydratedModern() {
|
|
45201
45704
|
return useReactSyncExternalStore(
|
|
45202
45705
|
subscribe,
|
|
@@ -45204,10 +45707,10 @@ function useIsHydratedModern() {
|
|
|
45204
45707
|
() => false
|
|
45205
45708
|
);
|
|
45206
45709
|
}
|
|
45207
|
-
__name$
|
|
45710
|
+
__name$e(useIsHydratedModern, "useIsHydratedModern");
|
|
45208
45711
|
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
|
|
45209
|
-
var __defProp$
|
|
45210
|
-
var __name$
|
|
45712
|
+
var __defProp$d = Object.defineProperty;
|
|
45713
|
+
var __name$d = (target, value) => __defProp$d(target, "name", { value, configurable: true });
|
|
45211
45714
|
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
45212
45715
|
var EVENT_OPTIONS$1 = { bubbles: false, cancelable: true };
|
|
45213
45716
|
var GROUP_NAME$1 = "RovingFocusGroup";
|
|
@@ -45216,14 +45719,21 @@ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = /* @__PURE__
|
|
|
45216
45719
|
GROUP_NAME$1,
|
|
45217
45720
|
[createCollectionScope$1]
|
|
45218
45721
|
);
|
|
45722
|
+
var Orientation = {
|
|
45723
|
+
Vertical: "vertical",
|
|
45724
|
+
Horizontal: "horizontal"
|
|
45725
|
+
};
|
|
45726
|
+
var Direction$1 = {
|
|
45727
|
+
RTL: "rtl"
|
|
45728
|
+
};
|
|
45219
45729
|
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME$1);
|
|
45220
45730
|
var RovingFocusGroup = /* @__PURE__ */ reactExports.forwardRef(
|
|
45221
45731
|
// blank line to reduce diff noise
|
|
45222
|
-
/* @__PURE__ */ __name$
|
|
45732
|
+
/* @__PURE__ */ __name$d(function RovingFocusGroup2(props, forwardedRef) {
|
|
45223
45733
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Collection$1.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection$1.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
45224
45734
|
}, "RovingFocusGroup")
|
|
45225
45735
|
);
|
|
45226
|
-
var RovingFocusGroupImpl = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__ */ __name$
|
|
45736
|
+
var RovingFocusGroupImpl = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__ */ __name$d(function RovingFocusGroupImpl2(props, forwardedRef) {
|
|
45227
45737
|
const {
|
|
45228
45738
|
__scopeRovingFocusGroup,
|
|
45229
45739
|
orientation,
|
|
@@ -45316,7 +45826,7 @@ var RovingFocusGroupImpl = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__
|
|
|
45316
45826
|
var ITEM_NAME$1 = "RovingFocusGroupItem";
|
|
45317
45827
|
var RovingFocusGroupItem = /* @__PURE__ */ reactExports.forwardRef(
|
|
45318
45828
|
// blank line to reduce diff noise
|
|
45319
|
-
/* @__PURE__ */ __name$
|
|
45829
|
+
/* @__PURE__ */ __name$d(function RovingFocusGroupItem2(props, forwardedRef) {
|
|
45320
45830
|
const {
|
|
45321
45831
|
__scopeRovingFocusGroup,
|
|
45322
45832
|
focusable = true,
|
|
@@ -45404,17 +45914,21 @@ var MAP_KEY_TO_FOCUS_INTENT = {
|
|
|
45404
45914
|
End: "last"
|
|
45405
45915
|
};
|
|
45406
45916
|
function getDirectionAwareKey(key, dir) {
|
|
45407
|
-
if (dir !==
|
|
45917
|
+
if (dir !== Direction$1.RTL) return key;
|
|
45408
45918
|
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
45409
45919
|
}
|
|
45410
|
-
__name$
|
|
45920
|
+
__name$d(getDirectionAwareKey, "getDirectionAwareKey");
|
|
45411
45921
|
function getFocusIntent(event, orientation, dir) {
|
|
45412
45922
|
const key = getDirectionAwareKey(event.key, dir);
|
|
45413
|
-
if (orientation ===
|
|
45414
|
-
|
|
45923
|
+
if (orientation === Orientation.Vertical && ["ArrowLeft", "ArrowRight"].includes(key)) {
|
|
45924
|
+
return void 0;
|
|
45925
|
+
}
|
|
45926
|
+
if (orientation === Orientation.Horizontal && ["ArrowUp", "ArrowDown"].includes(key)) {
|
|
45927
|
+
return void 0;
|
|
45928
|
+
}
|
|
45415
45929
|
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
45416
45930
|
}
|
|
45417
|
-
__name$
|
|
45931
|
+
__name$d(getFocusIntent, "getFocusIntent");
|
|
45418
45932
|
function focusFirst$1(candidates, preventScroll = false) {
|
|
45419
45933
|
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
45420
45934
|
for (const candidate of candidates) {
|
|
@@ -45423,15 +45937,17 @@ function focusFirst$1(candidates, preventScroll = false) {
|
|
|
45423
45937
|
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
45424
45938
|
}
|
|
45425
45939
|
}
|
|
45426
|
-
__name$
|
|
45940
|
+
__name$d(focusFirst$1, "focusFirst");
|
|
45427
45941
|
function wrapArray$1(array2, startIndex) {
|
|
45428
45942
|
return array2.map((_2, index2) => array2[(startIndex + index2) % array2.length]);
|
|
45429
45943
|
}
|
|
45430
|
-
__name$
|
|
45431
|
-
var
|
|
45432
|
-
var
|
|
45433
|
-
var
|
|
45434
|
-
|
|
45944
|
+
__name$d(wrapArray$1, "wrapArray");
|
|
45945
|
+
var __defProp$c = Object.defineProperty;
|
|
45946
|
+
var __name$c = (target, value) => __defProp$c(target, "name", { value, configurable: true });
|
|
45947
|
+
var ActivationMode = {
|
|
45948
|
+
Automatic: "automatic",
|
|
45949
|
+
Manual: "manual"
|
|
45950
|
+
};
|
|
45435
45951
|
var TABS_NAME = "Tabs";
|
|
45436
45952
|
var [createTabsContext, createTabsScope] = /* @__PURE__ */ createContextScope(TABS_NAME, [
|
|
45437
45953
|
createRovingFocusGroupScope
|
|
@@ -45440,7 +45956,7 @@ var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
|
45440
45956
|
var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
|
|
45441
45957
|
var Tabs$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
45442
45958
|
// blank line to reduce diff noise
|
|
45443
|
-
/* @__PURE__ */ __name$
|
|
45959
|
+
/* @__PURE__ */ __name$c(function Tabs2(props, forwardedRef) {
|
|
45444
45960
|
const {
|
|
45445
45961
|
__scopeTabs,
|
|
45446
45962
|
value: valueProp,
|
|
@@ -45448,7 +45964,7 @@ var Tabs$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45448
45964
|
defaultValue,
|
|
45449
45965
|
orientation = "horizontal",
|
|
45450
45966
|
dir,
|
|
45451
|
-
activationMode =
|
|
45967
|
+
activationMode = ActivationMode.Automatic,
|
|
45452
45968
|
...tabsProps
|
|
45453
45969
|
} = props;
|
|
45454
45970
|
const direction = useDirection(dir);
|
|
@@ -45484,12 +46000,12 @@ var Tabs$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45484
46000
|
var TAB_LIST_NAME = "TabsList";
|
|
45485
46001
|
var TabsList$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
45486
46002
|
// blank line to reduce diff noise
|
|
45487
|
-
/* @__PURE__ */ __name$
|
|
46003
|
+
/* @__PURE__ */ __name$c(function TabsList2(props, forwardedRef) {
|
|
45488
46004
|
const { __scopeTabs, loop = true, ...listProps } = props;
|
|
45489
46005
|
const context = useTabsContext(TAB_LIST_NAME, __scopeTabs);
|
|
45490
46006
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
45491
46007
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45492
|
-
|
|
46008
|
+
RovingFocusGroup,
|
|
45493
46009
|
{
|
|
45494
46010
|
asChild: true,
|
|
45495
46011
|
...rovingFocusGroupScope,
|
|
@@ -45511,7 +46027,7 @@ var TabsList$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45511
46027
|
);
|
|
45512
46028
|
var TRIGGER_NAME$5 = "TabsTrigger";
|
|
45513
46029
|
var TabsTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
45514
|
-
/* @__PURE__ */ __name$
|
|
46030
|
+
/* @__PURE__ */ __name$c(function TabsTrigger2(props, forwardedRef) {
|
|
45515
46031
|
const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
|
|
45516
46032
|
const context = useTabsContext(TRIGGER_NAME$5, __scopeTabs);
|
|
45517
46033
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
@@ -45519,7 +46035,7 @@ var TabsTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45519
46035
|
const contentId = makeContentId(context.baseId, value);
|
|
45520
46036
|
const isSelected = value === context.value;
|
|
45521
46037
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45522
|
-
|
|
46038
|
+
RovingFocusGroupItem,
|
|
45523
46039
|
{
|
|
45524
46040
|
asChild: true,
|
|
45525
46041
|
...rovingFocusGroupScope,
|
|
@@ -45540,6 +46056,7 @@ var TabsTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45540
46056
|
ref: forwardedRef,
|
|
45541
46057
|
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
45542
46058
|
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
46059
|
+
event.currentTarget.focus();
|
|
45543
46060
|
context.onValueChange(value);
|
|
45544
46061
|
} else {
|
|
45545
46062
|
event.preventDefault();
|
|
@@ -45554,7 +46071,7 @@ var TabsTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45554
46071
|
}
|
|
45555
46072
|
}),
|
|
45556
46073
|
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
45557
|
-
const isAutomaticActivation = context.activationMode !==
|
|
46074
|
+
const isAutomaticActivation = context.activationMode !== ActivationMode.Manual;
|
|
45558
46075
|
if (!isSelected && !disabled && isAutomaticActivation) {
|
|
45559
46076
|
context.onValueChange(value);
|
|
45560
46077
|
}
|
|
@@ -45567,7 +46084,7 @@ var TabsTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45567
46084
|
);
|
|
45568
46085
|
var CONTENT_NAME$5 = "TabsContent";
|
|
45569
46086
|
var TabsContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
45570
|
-
/* @__PURE__ */ __name$
|
|
46087
|
+
/* @__PURE__ */ __name$c(function TabsContent2(props, forwardedRef) {
|
|
45571
46088
|
const { __scopeTabs, value, forceMount, children, ...contentProps } = props;
|
|
45572
46089
|
const context = useTabsContext(CONTENT_NAME$5, __scopeTabs);
|
|
45573
46090
|
const triggerId = makeTriggerId(context.baseId, value);
|
|
@@ -45602,18 +46119,14 @@ var TabsContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
45602
46119
|
function makeTriggerId(baseId, value) {
|
|
45603
46120
|
return `${baseId}-trigger-${value}`;
|
|
45604
46121
|
}
|
|
45605
|
-
__name$
|
|
46122
|
+
__name$c(makeTriggerId, "makeTriggerId");
|
|
45606
46123
|
function makeContentId(baseId, value) {
|
|
45607
46124
|
return `${baseId}-content-${value}`;
|
|
45608
46125
|
}
|
|
45609
|
-
__name$
|
|
45610
|
-
|
|
45611
|
-
var List = TabsList$1;
|
|
45612
|
-
var Trigger$2 = TabsTrigger$1;
|
|
45613
|
-
var Content$1 = TabsContent$1;
|
|
45614
|
-
const Tabs = Root2$2;
|
|
46126
|
+
__name$c(makeContentId, "makeContentId");
|
|
46127
|
+
const Tabs = Tabs$1;
|
|
45615
46128
|
const TabsList = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45616
|
-
|
|
46129
|
+
TabsList$1,
|
|
45617
46130
|
{
|
|
45618
46131
|
ref: ref2,
|
|
45619
46132
|
className: cn$1(
|
|
@@ -45623,9 +46136,9 @@ const TabsList = reactExports.forwardRef(({ className, ...props }, ref2) => /* @
|
|
|
45623
46136
|
...props
|
|
45624
46137
|
}
|
|
45625
46138
|
));
|
|
45626
|
-
TabsList.displayName =
|
|
46139
|
+
TabsList.displayName = TabsList$1.displayName;
|
|
45627
46140
|
const TabsTrigger = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45628
|
-
|
|
46141
|
+
TabsTrigger$1,
|
|
45629
46142
|
{
|
|
45630
46143
|
ref: ref2,
|
|
45631
46144
|
className: cn$1(
|
|
@@ -45635,9 +46148,9 @@ const TabsTrigger = reactExports.forwardRef(({ className, ...props }, ref2) => /
|
|
|
45635
46148
|
...props
|
|
45636
46149
|
}
|
|
45637
46150
|
));
|
|
45638
|
-
TabsTrigger.displayName =
|
|
46151
|
+
TabsTrigger.displayName = TabsTrigger$1.displayName;
|
|
45639
46152
|
const TabsContent = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45640
|
-
|
|
46153
|
+
TabsContent$1,
|
|
45641
46154
|
{
|
|
45642
46155
|
ref: ref2,
|
|
45643
46156
|
className: cn$1(
|
|
@@ -45647,7 +46160,7 @@ const TabsContent = reactExports.forwardRef(({ className, ...props }, ref2) => /
|
|
|
45647
46160
|
...props
|
|
45648
46161
|
}
|
|
45649
46162
|
));
|
|
45650
|
-
TabsContent.displayName =
|
|
46163
|
+
TabsContent.displayName = TabsContent$1.displayName;
|
|
45651
46164
|
const buttonVariants = cva(
|
|
45652
46165
|
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
45653
46166
|
{
|
|
@@ -47269,16 +47782,17 @@ function D(_2) {
|
|
|
47269
47782
|
function W(_2, C, h2) {
|
|
47270
47783
|
return _2 = h2 && h2.length > 0 ? `${_2 + " " + h2.join(" ")}` : _2, G(_2, C, D(_2), D(C), 0, 0, {});
|
|
47271
47784
|
}
|
|
47272
|
-
var __defProp$
|
|
47273
|
-
var __name$
|
|
47785
|
+
var __defProp$b = Object.defineProperty;
|
|
47786
|
+
var __name$b = (target, value) => __defProp$b(target, "name", { value, configurable: true });
|
|
47274
47787
|
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
47275
47788
|
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
47276
47789
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
47277
47790
|
var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
47278
|
-
/* @__PURE__ */ __name$
|
|
47791
|
+
/* @__PURE__ */ __name$b(function FocusScope2(props, forwardedRef) {
|
|
47279
47792
|
const {
|
|
47280
47793
|
loop = false,
|
|
47281
47794
|
trapped = false,
|
|
47795
|
+
branches,
|
|
47282
47796
|
onMountAutoFocus: onMountAutoFocusProp,
|
|
47283
47797
|
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
47284
47798
|
...scopeProps
|
|
@@ -47288,6 +47802,18 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
47288
47802
|
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
47289
47803
|
const lastFocusedElementRef = reactExports.useRef(null);
|
|
47290
47804
|
const composedRefs = useComposedRefs(forwardedRef, setContainer);
|
|
47805
|
+
const branchesRef = reactExports.useRef(branches);
|
|
47806
|
+
reactExports.useEffect(() => {
|
|
47807
|
+
branchesRef.current = branches;
|
|
47808
|
+
});
|
|
47809
|
+
const isTargetInScope = reactExports.useCallback(
|
|
47810
|
+
(target) => {
|
|
47811
|
+
if (!target) return false;
|
|
47812
|
+
if (container?.contains(target)) return true;
|
|
47813
|
+
return Boolean(branchesRef.current?.some((branch) => branch.contains(target)));
|
|
47814
|
+
},
|
|
47815
|
+
[container]
|
|
47816
|
+
);
|
|
47291
47817
|
const focusScope = reactExports.useRef({
|
|
47292
47818
|
paused: false,
|
|
47293
47819
|
pause() {
|
|
@@ -47302,7 +47828,7 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
47302
47828
|
let handleFocusIn2 = function(event) {
|
|
47303
47829
|
if (focusScope.paused || !container) return;
|
|
47304
47830
|
const target = event.target;
|
|
47305
|
-
if (
|
|
47831
|
+
if (isTargetInScope(target)) {
|
|
47306
47832
|
lastFocusedElementRef.current = target;
|
|
47307
47833
|
} else {
|
|
47308
47834
|
focus(lastFocusedElementRef.current, { select: true });
|
|
@@ -47311,7 +47837,7 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
47311
47837
|
if (focusScope.paused || !container) return;
|
|
47312
47838
|
const relatedTarget = event.relatedTarget;
|
|
47313
47839
|
if (relatedTarget === null) return;
|
|
47314
|
-
if (!
|
|
47840
|
+
if (!isTargetInScope(relatedTarget)) {
|
|
47315
47841
|
focus(lastFocusedElementRef.current, { select: true });
|
|
47316
47842
|
}
|
|
47317
47843
|
}, handleMutations2 = function(mutations) {
|
|
@@ -47321,9 +47847,9 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
47321
47847
|
if (mutation.removedNodes.length > 0) focus(container);
|
|
47322
47848
|
}
|
|
47323
47849
|
};
|
|
47324
|
-
__name$
|
|
47325
|
-
__name$
|
|
47326
|
-
__name$
|
|
47850
|
+
__name$b(handleFocusIn2, "handleFocusIn");
|
|
47851
|
+
__name$b(handleFocusOut2, "handleFocusOut");
|
|
47852
|
+
__name$b(handleMutations2, "handleMutations");
|
|
47327
47853
|
document.addEventListener("focusin", handleFocusIn2);
|
|
47328
47854
|
document.addEventListener("focusout", handleFocusOut2);
|
|
47329
47855
|
const mutationObserver = new MutationObserver(handleMutations2);
|
|
@@ -47334,7 +47860,7 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
47334
47860
|
mutationObserver.disconnect();
|
|
47335
47861
|
};
|
|
47336
47862
|
}
|
|
47337
|
-
}, [trapped, container, focusScope.paused]);
|
|
47863
|
+
}, [trapped, container, focusScope.paused, isTargetInScope]);
|
|
47338
47864
|
reactExports.useEffect(() => {
|
|
47339
47865
|
if (container) {
|
|
47340
47866
|
focusScopesStack.add(focusScope);
|
|
@@ -47353,12 +47879,14 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
47353
47879
|
}
|
|
47354
47880
|
return () => {
|
|
47355
47881
|
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
47882
|
+
const ownerDocument = container.ownerDocument;
|
|
47883
|
+
const UnmountEvent = CustomEvent;
|
|
47356
47884
|
setTimeout(() => {
|
|
47357
|
-
const unmountEvent = new
|
|
47885
|
+
const unmountEvent = new UnmountEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
47358
47886
|
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
47359
47887
|
container.dispatchEvent(unmountEvent);
|
|
47360
47888
|
if (!unmountEvent.defaultPrevented) {
|
|
47361
|
-
focus(previouslyFocusedElement ??
|
|
47889
|
+
focus(previouslyFocusedElement ?? ownerDocument.body, { select: true });
|
|
47362
47890
|
}
|
|
47363
47891
|
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
47364
47892
|
focusScopesStack.remove(focusScope);
|
|
@@ -47394,6 +47922,35 @@ var FocusScope = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
47394
47922
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
47395
47923
|
}, "FocusScope")
|
|
47396
47924
|
);
|
|
47925
|
+
var FocusScopeBranchContext = reactExports.createContext(null);
|
|
47926
|
+
function FocusScopeBranchProvider({ registry: registry2, children }) {
|
|
47927
|
+
if (!registry2) {
|
|
47928
|
+
return children;
|
|
47929
|
+
}
|
|
47930
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FocusScopeBranchContext.Provider, { value: registry2, children });
|
|
47931
|
+
}
|
|
47932
|
+
__name$b(FocusScopeBranchProvider, "FocusScopeBranchProvider");
|
|
47933
|
+
function useFocusScopeBranchRegistry() {
|
|
47934
|
+
const [nodes, setNodes] = reactExports.useState([]);
|
|
47935
|
+
const registry2 = reactExports.useMemo(
|
|
47936
|
+
() => ({
|
|
47937
|
+
add: /* @__PURE__ */ __name$b((node) => setNodes((prev) => prev.includes(node) ? prev : [...prev, node]), "add"),
|
|
47938
|
+
remove: /* @__PURE__ */ __name$b((node) => setNodes((prev) => prev.filter((current) => current !== node)), "remove")
|
|
47939
|
+
}),
|
|
47940
|
+
[]
|
|
47941
|
+
);
|
|
47942
|
+
return { nodes, registry: registry2 };
|
|
47943
|
+
}
|
|
47944
|
+
__name$b(useFocusScopeBranchRegistry, "useFocusScopeBranchRegistry");
|
|
47945
|
+
function useFocusScopeBranch(node) {
|
|
47946
|
+
const registry2 = reactExports.useContext(FocusScopeBranchContext);
|
|
47947
|
+
reactExports.useEffect(() => {
|
|
47948
|
+
if (!node || !registry2) return;
|
|
47949
|
+
registry2.add(node);
|
|
47950
|
+
return () => registry2.remove(node);
|
|
47951
|
+
}, [node, registry2]);
|
|
47952
|
+
}
|
|
47953
|
+
__name$b(useFocusScopeBranch, "useFocusScopeBranch");
|
|
47397
47954
|
function focusFirst(candidates, { select = false } = {}) {
|
|
47398
47955
|
const previouslyFocusedElement = document.activeElement;
|
|
47399
47956
|
for (const candidate of candidates) {
|
|
@@ -47401,27 +47958,32 @@ function focusFirst(candidates, { select = false } = {}) {
|
|
|
47401
47958
|
if (document.activeElement !== previouslyFocusedElement) return;
|
|
47402
47959
|
}
|
|
47403
47960
|
}
|
|
47404
|
-
__name$
|
|
47961
|
+
__name$b(focusFirst, "focusFirst");
|
|
47405
47962
|
function getTabbableEdges(container) {
|
|
47406
47963
|
const candidates = getTabbableCandidates(container);
|
|
47407
47964
|
const first = findVisible(candidates, container);
|
|
47408
47965
|
const last = findVisible(candidates.reverse(), container);
|
|
47409
47966
|
return [first, last];
|
|
47410
47967
|
}
|
|
47411
|
-
__name$
|
|
47968
|
+
__name$b(getTabbableEdges, "getTabbableEdges");
|
|
47412
47969
|
function getTabbableCandidates(container) {
|
|
47413
47970
|
const nodes = [];
|
|
47414
|
-
const
|
|
47415
|
-
|
|
47971
|
+
const document2 = container.ownerDocument;
|
|
47972
|
+
const walker = document2.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
47973
|
+
acceptNode: /* @__PURE__ */ __name$b((node) => {
|
|
47416
47974
|
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
47417
|
-
if (node.disabled || node.hidden || isHiddenInput)
|
|
47975
|
+
if (node.disabled || node.hidden || isHiddenInput) {
|
|
47976
|
+
return NodeFilter.FILTER_SKIP;
|
|
47977
|
+
}
|
|
47418
47978
|
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
47419
47979
|
}, "acceptNode")
|
|
47420
47980
|
});
|
|
47421
|
-
while (walker.nextNode())
|
|
47981
|
+
while (walker.nextNode()) {
|
|
47982
|
+
nodes.push(walker.currentNode);
|
|
47983
|
+
}
|
|
47422
47984
|
return nodes;
|
|
47423
47985
|
}
|
|
47424
|
-
__name$
|
|
47986
|
+
__name$b(getTabbableCandidates, "getTabbableCandidates");
|
|
47425
47987
|
function findVisible(elements, container) {
|
|
47426
47988
|
const canUseCheckVisibility = typeof container.checkVisibility === "function" && container.checkVisibility({ checkVisibilityCSS: true });
|
|
47427
47989
|
for (const element of elements) {
|
|
@@ -47431,7 +47993,7 @@ function findVisible(elements, container) {
|
|
|
47431
47993
|
}
|
|
47432
47994
|
}
|
|
47433
47995
|
}
|
|
47434
|
-
__name$
|
|
47996
|
+
__name$b(findVisible, "findVisible");
|
|
47435
47997
|
function isHidden(node, { upTo }) {
|
|
47436
47998
|
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
47437
47999
|
while (node) {
|
|
@@ -47441,20 +48003,21 @@ function isHidden(node, { upTo }) {
|
|
|
47441
48003
|
}
|
|
47442
48004
|
return false;
|
|
47443
48005
|
}
|
|
47444
|
-
__name$
|
|
48006
|
+
__name$b(isHidden, "isHidden");
|
|
47445
48007
|
function isSelectableInput(element) {
|
|
47446
|
-
return element
|
|
48008
|
+
return element.tagName === "INPUT" && typeof element.select === "function";
|
|
47447
48009
|
}
|
|
47448
|
-
__name$
|
|
48010
|
+
__name$b(isSelectableInput, "isSelectableInput");
|
|
47449
48011
|
function focus(element, { select = false } = {}) {
|
|
47450
48012
|
if (element && element.focus) {
|
|
47451
|
-
const
|
|
48013
|
+
const ownerDocument = element.ownerDocument ?? document;
|
|
48014
|
+
const previouslyFocusedElement = ownerDocument.activeElement;
|
|
47452
48015
|
element.focus({ preventScroll: true });
|
|
47453
48016
|
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
47454
48017
|
element.select();
|
|
47455
48018
|
}
|
|
47456
48019
|
}
|
|
47457
|
-
__name$
|
|
48020
|
+
__name$b(focus, "focus");
|
|
47458
48021
|
var focusScopesStack = createFocusScopesStack();
|
|
47459
48022
|
function createFocusScopesStack() {
|
|
47460
48023
|
let stack = [];
|
|
@@ -47473,7 +48036,7 @@ function createFocusScopesStack() {
|
|
|
47473
48036
|
}
|
|
47474
48037
|
};
|
|
47475
48038
|
}
|
|
47476
|
-
__name$
|
|
48039
|
+
__name$b(createFocusScopesStack, "createFocusScopesStack");
|
|
47477
48040
|
function arrayRemove(array2, item) {
|
|
47478
48041
|
const updatedArray = [...array2];
|
|
47479
48042
|
const index2 = updatedArray.indexOf(item);
|
|
@@ -47482,20 +48045,20 @@ function arrayRemove(array2, item) {
|
|
|
47482
48045
|
}
|
|
47483
48046
|
return updatedArray;
|
|
47484
48047
|
}
|
|
47485
|
-
__name$
|
|
48048
|
+
__name$b(arrayRemove, "arrayRemove");
|
|
47486
48049
|
function removeLinks(items2) {
|
|
47487
48050
|
return items2.filter((item) => item.tagName !== "A");
|
|
47488
48051
|
}
|
|
47489
|
-
__name$
|
|
47490
|
-
var __defProp$
|
|
47491
|
-
var __name$
|
|
48052
|
+
__name$b(removeLinks, "removeLinks");
|
|
48053
|
+
var __defProp$a = Object.defineProperty;
|
|
48054
|
+
var __name$a = (target, value) => __defProp$a(target, "name", { value, configurable: true });
|
|
47492
48055
|
var count = 0;
|
|
47493
48056
|
var guards = null;
|
|
47494
48057
|
function FocusGuards(props) {
|
|
47495
48058
|
useFocusGuards();
|
|
47496
48059
|
return props.children;
|
|
47497
48060
|
}
|
|
47498
|
-
__name$
|
|
48061
|
+
__name$a(FocusGuards, "FocusGuards");
|
|
47499
48062
|
function useFocusGuards() {
|
|
47500
48063
|
reactExports.useEffect(() => {
|
|
47501
48064
|
if (!guards) {
|
|
@@ -47519,7 +48082,7 @@ function useFocusGuards() {
|
|
|
47519
48082
|
};
|
|
47520
48083
|
}, []);
|
|
47521
48084
|
}
|
|
47522
|
-
__name$
|
|
48085
|
+
__name$a(useFocusGuards, "useFocusGuards");
|
|
47523
48086
|
function createFocusGuard() {
|
|
47524
48087
|
const element = document.createElement("span");
|
|
47525
48088
|
element.setAttribute("data-radix-focus-guard", "");
|
|
@@ -47530,7 +48093,7 @@ function createFocusGuard() {
|
|
|
47530
48093
|
element.style.pointerEvents = "none";
|
|
47531
48094
|
return element;
|
|
47532
48095
|
}
|
|
47533
|
-
__name$
|
|
48096
|
+
__name$a(createFocusGuard, "createFocusGuard");
|
|
47534
48097
|
var __assign = function() {
|
|
47535
48098
|
__assign = Object.assign || function __assign2(t2) {
|
|
47536
48099
|
for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
@@ -48310,12 +48873,12 @@ var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
|
48310
48873
|
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
48311
48874
|
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
48312
48875
|
};
|
|
48313
|
-
var __defProp$
|
|
48314
|
-
var __name$
|
|
48876
|
+
var __defProp$9 = Object.defineProperty;
|
|
48877
|
+
var __name$9 = (target, value) => __defProp$9(target, "name", { value, configurable: true });
|
|
48315
48878
|
var DIALOG_NAME = "Dialog";
|
|
48316
48879
|
var [createDialogContext, createDialogScope] = /* @__PURE__ */ createContextScope(DIALOG_NAME);
|
|
48317
48880
|
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
48318
|
-
var Dialog$1 = /* @__PURE__ */ __name$
|
|
48881
|
+
var Dialog$1 = /* @__PURE__ */ __name$9((props) => {
|
|
48319
48882
|
const {
|
|
48320
48883
|
__scopeDialog,
|
|
48321
48884
|
children,
|
|
@@ -48326,6 +48889,7 @@ var Dialog$1 = /* @__PURE__ */ __name$a((props) => {
|
|
|
48326
48889
|
} = props;
|
|
48327
48890
|
const triggerRef = reactExports.useRef(null);
|
|
48328
48891
|
const contentRef = reactExports.useRef(null);
|
|
48892
|
+
const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();
|
|
48329
48893
|
const [open, setOpen] = useControllableState({
|
|
48330
48894
|
prop: openProp,
|
|
48331
48895
|
defaultProp: defaultOpen ?? false,
|
|
@@ -48351,6 +48915,8 @@ var Dialog$1 = /* @__PURE__ */ __name$a((props) => {
|
|
|
48351
48915
|
onOpenChange: setOpen,
|
|
48352
48916
|
onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
48353
48917
|
modal,
|
|
48918
|
+
branchNodes,
|
|
48919
|
+
branchRegistry,
|
|
48354
48920
|
children
|
|
48355
48921
|
}
|
|
48356
48922
|
);
|
|
@@ -48359,14 +48925,14 @@ var PORTAL_NAME$3 = "DialogPortal";
|
|
|
48359
48925
|
var [PortalProvider$3, usePortalContext$3] = createDialogContext(PORTAL_NAME$3, {
|
|
48360
48926
|
forceMount: void 0
|
|
48361
48927
|
});
|
|
48362
|
-
var DialogPortal$1 = /* @__PURE__ */ __name$
|
|
48928
|
+
var DialogPortal$1 = /* @__PURE__ */ __name$9((props) => {
|
|
48363
48929
|
const { __scopeDialog, forceMount, children, container } = props;
|
|
48364
48930
|
const context = useDialogContext(PORTAL_NAME$3, __scopeDialog);
|
|
48365
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$3, { scope: __scopeDialog, forceMount, children: reactExports.Children.map(children, (child) => /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal
|
|
48931
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$3, { scope: __scopeDialog, forceMount, children: reactExports.Children.map(children, (child) => /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { asChild: true, container, children: child }) })) });
|
|
48366
48932
|
}, "DialogPortal");
|
|
48367
48933
|
var OVERLAY_NAME = "DialogOverlay";
|
|
48368
48934
|
var DialogOverlay$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
48369
|
-
/* @__PURE__ */ __name$
|
|
48935
|
+
/* @__PURE__ */ __name$9(function DialogOverlay2(props, forwardedRef) {
|
|
48370
48936
|
const portalContext = usePortalContext$3(OVERLAY_NAME, props.__scopeDialog);
|
|
48371
48937
|
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
48372
48938
|
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
@@ -48376,29 +48942,42 @@ var DialogOverlay$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48376
48942
|
var Slot$2 = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
48377
48943
|
var DialogOverlayImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
48378
48944
|
// blank line to reduce diff noise
|
|
48379
|
-
/* @__PURE__ */ __name$
|
|
48945
|
+
/* @__PURE__ */ __name$9(function DialogOverlayImpl2(props, forwardedRef) {
|
|
48380
48946
|
const { __scopeDialog, ...overlayProps } = props;
|
|
48381
48947
|
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
48382
48948
|
const registerDismissableSurface = useDismissableLayerSurface();
|
|
48383
48949
|
const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface);
|
|
48384
48950
|
return (
|
|
48385
|
-
// Make sure `Content` is scrollable even when it doesn't live inside
|
|
48386
|
-
//
|
|
48387
|
-
|
|
48388
|
-
|
|
48951
|
+
// Make sure `Content` is scrollable even when it doesn't live inside
|
|
48952
|
+
// `RemoveScroll` (eg. when `Overlay` and `Content` are siblings). Nested
|
|
48953
|
+
// layers are registered as branches and added as shards so they remain
|
|
48954
|
+
// scrollable too. See https://github.com/radix-ui/primitives/issues/3423
|
|
48955
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48956
|
+
ReactRemoveScroll,
|
|
48389
48957
|
{
|
|
48390
|
-
|
|
48391
|
-
|
|
48392
|
-
|
|
48393
|
-
|
|
48958
|
+
as: Slot$2,
|
|
48959
|
+
allowPinchZoom: true,
|
|
48960
|
+
shards: reactExports.useMemo(
|
|
48961
|
+
() => [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))],
|
|
48962
|
+
[context.contentRef, context.branchNodes]
|
|
48963
|
+
),
|
|
48964
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48965
|
+
Primitive.div,
|
|
48966
|
+
{
|
|
48967
|
+
"data-state": getState$3(context.open),
|
|
48968
|
+
...overlayProps,
|
|
48969
|
+
ref: composedRefs,
|
|
48970
|
+
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
48971
|
+
}
|
|
48972
|
+
)
|
|
48394
48973
|
}
|
|
48395
|
-
)
|
|
48974
|
+
)
|
|
48396
48975
|
);
|
|
48397
48976
|
}, "DialogOverlayImpl")
|
|
48398
48977
|
);
|
|
48399
48978
|
var CONTENT_NAME$4 = "DialogContent";
|
|
48400
48979
|
var DialogContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
48401
|
-
/* @__PURE__ */ __name$
|
|
48980
|
+
/* @__PURE__ */ __name$9(function DialogContent2(props, forwardedRef) {
|
|
48402
48981
|
const portalContext = usePortalContext$3(CONTENT_NAME$4, props.__scopeDialog);
|
|
48403
48982
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
48404
48983
|
const context = useDialogContext(CONTENT_NAME$4, props.__scopeDialog);
|
|
@@ -48407,7 +48986,7 @@ var DialogContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48407
48986
|
);
|
|
48408
48987
|
var DialogContentModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
48409
48988
|
// blank line to reduce diff noise
|
|
48410
|
-
/* @__PURE__ */ __name$
|
|
48989
|
+
/* @__PURE__ */ __name$9(function DialogContentModal2(props, forwardedRef) {
|
|
48411
48990
|
const context = useDialogContext(CONTENT_NAME$4, props.__scopeDialog);
|
|
48412
48991
|
const contentRef = reactExports.useRef(null);
|
|
48413
48992
|
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
@@ -48442,7 +49021,7 @@ var DialogContentModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48442
49021
|
);
|
|
48443
49022
|
var DialogContentNonModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
48444
49023
|
// blank line to reduce diff noise
|
|
48445
|
-
/* @__PURE__ */ __name$
|
|
49024
|
+
/* @__PURE__ */ __name$9(function DialogContentNonModal2(props, forwardedRef) {
|
|
48446
49025
|
const context = useDialogContext(CONTENT_NAME$4, props.__scopeDialog);
|
|
48447
49026
|
const hasInteractedOutsideRef = reactExports.useRef(false);
|
|
48448
49027
|
const hasPointerDownOutsideRef = reactExports.useRef(false);
|
|
@@ -48483,16 +49062,25 @@ var DialogContentNonModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48483
49062
|
);
|
|
48484
49063
|
var DialogContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
48485
49064
|
// blank line to reduce diff noise
|
|
48486
|
-
/* @__PURE__ */ __name$
|
|
48487
|
-
const {
|
|
49065
|
+
/* @__PURE__ */ __name$9(function DialogContentImpl2(props, forwardedRef) {
|
|
49066
|
+
const {
|
|
49067
|
+
__scopeDialog,
|
|
49068
|
+
trapFocus,
|
|
49069
|
+
onOpenAutoFocus,
|
|
49070
|
+
onCloseAutoFocus,
|
|
49071
|
+
"aria-describedby": ariaDescribedby,
|
|
49072
|
+
children,
|
|
49073
|
+
...contentProps
|
|
49074
|
+
} = props;
|
|
48488
49075
|
const context = useDialogContext(CONTENT_NAME$4, __scopeDialog);
|
|
48489
49076
|
useFocusGuards();
|
|
48490
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49077
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FocusScopeBranchProvider, { registry: context.branchRegistry, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48491
49078
|
FocusScope,
|
|
48492
49079
|
{
|
|
48493
49080
|
asChild: true,
|
|
48494
49081
|
loop: true,
|
|
48495
49082
|
trapped: trapFocus,
|
|
49083
|
+
branches: context.branchNodes,
|
|
48496
49084
|
onMountAutoFocus: onOpenAutoFocus,
|
|
48497
49085
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
48498
49086
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -48500,24 +49088,24 @@ var DialogContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48500
49088
|
{
|
|
48501
49089
|
role: "dialog",
|
|
48502
49090
|
id: context.contentId,
|
|
48503
|
-
"aria-describedby": context.descriptionPresent ? context.descriptionId : void 0,
|
|
48504
49091
|
"aria-labelledby": context.titlePresent ? context.titleId : void 0,
|
|
49092
|
+
"aria-describedby": context.descriptionPresent ? concatAriaDescribedby$2(ariaDescribedby, context.descriptionId) : ariaDescribedby,
|
|
48505
49093
|
"data-state": getState$3(context.open),
|
|
48506
49094
|
...contentProps,
|
|
48507
49095
|
ref: forwardedRef,
|
|
48508
49096
|
deferPointerDownOutside: true,
|
|
48509
|
-
onDismiss: () => context.onOpenChange(false)
|
|
49097
|
+
onDismiss: () => context.onOpenChange(false),
|
|
49098
|
+
children
|
|
48510
49099
|
}
|
|
48511
49100
|
)
|
|
48512
49101
|
}
|
|
48513
49102
|
) });
|
|
48514
49103
|
}, "DialogContentImpl")
|
|
48515
49104
|
);
|
|
48516
|
-
var TITLE_NAME = "DialogTitle";
|
|
48517
49105
|
var DialogTitle$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
48518
|
-
/* @__PURE__ */ __name$
|
|
49106
|
+
/* @__PURE__ */ __name$9(function DialogTitle2(props, forwardedRef) {
|
|
48519
49107
|
const { __scopeDialog, ...titleProps } = props;
|
|
48520
|
-
const context = useDialogContext(
|
|
49108
|
+
const context = useDialogContext("DialogTitle", __scopeDialog);
|
|
48521
49109
|
const { setTitleCount } = context;
|
|
48522
49110
|
useLayoutEffect2(() => {
|
|
48523
49111
|
setTitleCount((count2) => count2 + 1);
|
|
@@ -48526,12 +49114,11 @@ var DialogTitle$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48526
49114
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
48527
49115
|
}, "DialogTitle")
|
|
48528
49116
|
);
|
|
48529
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
48530
49117
|
var DialogDescription$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
48531
49118
|
// blank line to reduce diff noise
|
|
48532
|
-
/* @__PURE__ */ __name$
|
|
49119
|
+
/* @__PURE__ */ __name$9(function DialogDescription2(props, forwardedRef) {
|
|
48533
49120
|
const { __scopeDialog, ...descriptionProps } = props;
|
|
48534
|
-
const context = useDialogContext(
|
|
49121
|
+
const context = useDialogContext("DialogDescription", __scopeDialog);
|
|
48535
49122
|
const { setDescriptionCount } = context;
|
|
48536
49123
|
useLayoutEffect2(() => {
|
|
48537
49124
|
setDescriptionCount((count2) => count2 + 1);
|
|
@@ -48542,7 +49129,7 @@ var DialogDescription$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48542
49129
|
);
|
|
48543
49130
|
var CLOSE_NAME = "DialogClose";
|
|
48544
49131
|
var DialogClose = /* @__PURE__ */ reactExports.forwardRef(
|
|
48545
|
-
/* @__PURE__ */ __name$
|
|
49132
|
+
/* @__PURE__ */ __name$9(function DialogClose2(props, forwardedRef) {
|
|
48546
49133
|
const { __scopeDialog, ...closeProps } = props;
|
|
48547
49134
|
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
48548
49135
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -48556,10 +49143,21 @@ var DialogClose = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
48556
49143
|
);
|
|
48557
49144
|
}, "DialogClose")
|
|
48558
49145
|
);
|
|
49146
|
+
function concatAriaDescribedby$2(...values) {
|
|
49147
|
+
const ids = /* @__PURE__ */ new Set();
|
|
49148
|
+
for (const value of values) {
|
|
49149
|
+
if (typeof value !== "string") continue;
|
|
49150
|
+
for (const id2 of String(value).trim().split(/\s+/)) {
|
|
49151
|
+
if (id2) ids.add(id2);
|
|
49152
|
+
}
|
|
49153
|
+
}
|
|
49154
|
+
return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
|
|
49155
|
+
}
|
|
49156
|
+
__name$9(concatAriaDescribedby$2, "concatAriaDescribedby");
|
|
48559
49157
|
function getState$3(open) {
|
|
48560
49158
|
return open ? "open" : "closed";
|
|
48561
49159
|
}
|
|
48562
|
-
__name$
|
|
49160
|
+
__name$9(getState$3, "getState");
|
|
48563
49161
|
var N$1 = '[cmdk-group=""]', Y = '[cmdk-group-items=""]', be = '[cmdk-group-heading=""]', le$1 = '[cmdk-item=""]', ce$1 = `${le$1}:not([aria-disabled="true"])`, Z$1 = "cmdk-item-select", T = "data-value", Re$1 = (r2, o2, n) => W(r2, o2, n), ue = reactExports.createContext(void 0), K$1 = () => reactExports.useContext(ue), de$1 = reactExports.createContext(void 0), ee$1 = () => reactExports.useContext(de$1), fe$1 = reactExports.createContext(void 0), me = reactExports.forwardRef((r2, o2) => {
|
|
48564
49162
|
let n = L$1(() => {
|
|
48565
49163
|
var e2, a2;
|
|
@@ -50905,13 +51503,14 @@ const arrow = (options2, deps) => {
|
|
|
50905
51503
|
options: [options2, deps]
|
|
50906
51504
|
};
|
|
50907
51505
|
};
|
|
50908
|
-
var __defProp$
|
|
50909
|
-
var __name$
|
|
51506
|
+
var __defProp$8 = Object.defineProperty;
|
|
51507
|
+
var __name$8 = (target, value) => __defProp$8(target, "name", { value, configurable: true });
|
|
50910
51508
|
function useSize(element) {
|
|
50911
51509
|
const [size2, setSize] = reactExports.useState(void 0);
|
|
50912
51510
|
useLayoutEffect2(() => {
|
|
50913
51511
|
if (element) {
|
|
50914
51512
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
51513
|
+
let rAF = 0;
|
|
50915
51514
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
50916
51515
|
if (!Array.isArray(entries)) {
|
|
50917
51516
|
return;
|
|
@@ -50920,34 +51519,47 @@ function useSize(element) {
|
|
|
50920
51519
|
return;
|
|
50921
51520
|
}
|
|
50922
51521
|
const entry = entries[0];
|
|
50923
|
-
|
|
50924
|
-
|
|
50925
|
-
|
|
50926
|
-
|
|
50927
|
-
|
|
50928
|
-
|
|
50929
|
-
|
|
50930
|
-
|
|
50931
|
-
|
|
50932
|
-
|
|
50933
|
-
|
|
50934
|
-
|
|
51522
|
+
window.cancelAnimationFrame(rAF);
|
|
51523
|
+
rAF = window.requestAnimationFrame(() => {
|
|
51524
|
+
let width;
|
|
51525
|
+
let height;
|
|
51526
|
+
if ("borderBoxSize" in entry) {
|
|
51527
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
51528
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
51529
|
+
width = borderSize["inlineSize"];
|
|
51530
|
+
height = borderSize["blockSize"];
|
|
51531
|
+
} else {
|
|
51532
|
+
width = element.offsetWidth;
|
|
51533
|
+
height = element.offsetHeight;
|
|
51534
|
+
}
|
|
51535
|
+
setSize({ width, height });
|
|
51536
|
+
});
|
|
50935
51537
|
});
|
|
50936
51538
|
resizeObserver.observe(element, { box: "border-box" });
|
|
50937
|
-
return () =>
|
|
51539
|
+
return () => {
|
|
51540
|
+
window.cancelAnimationFrame(rAF);
|
|
51541
|
+
resizeObserver.unobserve(element);
|
|
51542
|
+
};
|
|
50938
51543
|
} else {
|
|
50939
51544
|
setSize(void 0);
|
|
50940
51545
|
}
|
|
50941
51546
|
}, [element]);
|
|
50942
51547
|
return size2;
|
|
50943
51548
|
}
|
|
50944
|
-
__name$
|
|
50945
|
-
var __defProp$
|
|
50946
|
-
var __name$
|
|
51549
|
+
__name$8(useSize, "useSize");
|
|
51550
|
+
var __defProp$7 = Object.defineProperty;
|
|
51551
|
+
var __name$7 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
|
|
51552
|
+
var Sticky = {
|
|
51553
|
+
Partial: "partial"
|
|
51554
|
+
};
|
|
51555
|
+
var UpdatePositionStrategy = {
|
|
51556
|
+
Optimized: "optimized",
|
|
51557
|
+
Always: "always"
|
|
51558
|
+
};
|
|
50947
51559
|
var POPPER_NAME = "Popper";
|
|
50948
51560
|
var [createPopperContext, createPopperScope] = /* @__PURE__ */ createContextScope(POPPER_NAME);
|
|
50949
51561
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
50950
|
-
var Popper = /* @__PURE__ */ __name$
|
|
51562
|
+
var Popper = /* @__PURE__ */ __name$7((props) => {
|
|
50951
51563
|
const { __scopePopper, children } = props;
|
|
50952
51564
|
const [anchor, setAnchor] = reactExports.useState(null);
|
|
50953
51565
|
const [placementState, setPlacementState] = reactExports.useState(void 0);
|
|
@@ -50965,7 +51577,7 @@ var Popper = /* @__PURE__ */ __name$8((props) => {
|
|
|
50965
51577
|
}, "Popper");
|
|
50966
51578
|
var ANCHOR_NAME = "PopperAnchor";
|
|
50967
51579
|
var PopperAnchor = /* @__PURE__ */ reactExports.forwardRef(
|
|
50968
|
-
/* @__PURE__ */ __name$
|
|
51580
|
+
/* @__PURE__ */ __name$7(function PopperAnchor2(props, forwardedRef) {
|
|
50969
51581
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
50970
51582
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
50971
51583
|
const ref2 = reactExports.useRef(null);
|
|
@@ -51008,7 +51620,7 @@ var PopperAnchor = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51008
51620
|
var CONTENT_NAME$3 = "PopperContent";
|
|
51009
51621
|
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$3);
|
|
51010
51622
|
var PopperContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
51011
|
-
/* @__PURE__ */ __name$
|
|
51623
|
+
/* @__PURE__ */ __name$7(function PopperContent2(props, forwardedRef) {
|
|
51012
51624
|
const {
|
|
51013
51625
|
__scopePopper,
|
|
51014
51626
|
side = "bottom",
|
|
@@ -51019,9 +51631,9 @@ var PopperContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51019
51631
|
avoidCollisions = true,
|
|
51020
51632
|
collisionBoundary = [],
|
|
51021
51633
|
collisionPadding: collisionPaddingProp = 0,
|
|
51022
|
-
sticky =
|
|
51634
|
+
sticky = Sticky.Partial,
|
|
51023
51635
|
hideWhenDetached = false,
|
|
51024
|
-
updatePositionStrategy =
|
|
51636
|
+
updatePositionStrategy = UpdatePositionStrategy.Optimized,
|
|
51025
51637
|
onPlaced,
|
|
51026
51638
|
...contentProps
|
|
51027
51639
|
} = props;
|
|
@@ -51046,9 +51658,9 @@ var PopperContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51046
51658
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
51047
51659
|
strategy: "fixed",
|
|
51048
51660
|
placement: desiredPlacement,
|
|
51049
|
-
whileElementsMounted: /* @__PURE__ */ __name$
|
|
51661
|
+
whileElementsMounted: /* @__PURE__ */ __name$7((...args) => {
|
|
51050
51662
|
const cleanup = autoUpdate(...args, {
|
|
51051
|
-
animationFrame: updatePositionStrategy ===
|
|
51663
|
+
animationFrame: updatePositionStrategy === UpdatePositionStrategy.Always
|
|
51052
51664
|
});
|
|
51053
51665
|
return cleanup;
|
|
51054
51666
|
}, "whileElementsMounted"),
|
|
@@ -51060,13 +51672,15 @@ var PopperContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51060
51672
|
avoidCollisions && shift({
|
|
51061
51673
|
mainAxis: true,
|
|
51062
51674
|
crossAxis: false,
|
|
51063
|
-
|
|
51675
|
+
// Spread rather than passing `limiter: undefined`, which
|
|
51676
|
+
// `exactOptionalPropertyTypes` rejects for Floating UI's optional option.
|
|
51677
|
+
...sticky === Sticky.Partial ? { limiter: limitShift() } : {},
|
|
51064
51678
|
...detectOverflowOptions
|
|
51065
51679
|
}),
|
|
51066
51680
|
avoidCollisions && flip({ ...detectOverflowOptions }),
|
|
51067
51681
|
size({
|
|
51068
51682
|
...detectOverflowOptions,
|
|
51069
|
-
apply: /* @__PURE__ */ __name$
|
|
51683
|
+
apply: /* @__PURE__ */ __name$7(({ elements, rects, availableWidth, availableHeight }) => {
|
|
51070
51684
|
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
51071
51685
|
const contentStyle = elements.floating.style;
|
|
51072
51686
|
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
@@ -51077,18 +51691,22 @@ var PopperContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51077
51691
|
}),
|
|
51078
51692
|
arrow$12 && arrow({ element: arrow$12, padding: arrowPadding }),
|
|
51079
51693
|
transformOrigin({ arrowWidth, arrowHeight }),
|
|
51080
|
-
hideWhenDetached && hide(
|
|
51081
|
-
|
|
51082
|
-
|
|
51083
|
-
|
|
51084
|
-
|
|
51085
|
-
|
|
51086
|
-
|
|
51087
|
-
|
|
51088
|
-
|
|
51089
|
-
|
|
51090
|
-
|
|
51091
|
-
|
|
51694
|
+
hideWhenDetached && // `hide` detects whether the anchor (reference) is clipped, so when
|
|
51695
|
+
// no explicit `collisionBoundary` is set we omit `boundary` entirely
|
|
51696
|
+
// and fall back to Floating UI's default clipping ancestors (e.g. a
|
|
51697
|
+
// scrollable menu). This lets an occluded submenu hide once its anchor
|
|
51698
|
+
// scrolls out of view (#3237). The collision/size middlewares
|
|
51699
|
+
// deliberately keep the viewport-based default to avoid clamping
|
|
51700
|
+
// content rendered inside transformed or overflow-clipping portal
|
|
51701
|
+
// containers. The key is omitted rather than set to `undefined`
|
|
51702
|
+
// because `exactOptionalPropertyTypes` rejects the explicit value.
|
|
51703
|
+
hide(
|
|
51704
|
+
hasExplicitBoundaries ? { strategy: "referenceHidden", ...detectOverflowOptions } : {
|
|
51705
|
+
strategy: "referenceHidden",
|
|
51706
|
+
padding: detectOverflowOptions.padding,
|
|
51707
|
+
altBoundary: detectOverflowOptions.altBoundary
|
|
51708
|
+
}
|
|
51709
|
+
)
|
|
51092
51710
|
]
|
|
51093
51711
|
});
|
|
51094
51712
|
const setPlacementState = context.setPlacementState;
|
|
@@ -51171,8 +51789,8 @@ var PopperContent = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51171
51789
|
function isNotNull(value) {
|
|
51172
51790
|
return value !== null;
|
|
51173
51791
|
}
|
|
51174
|
-
__name$
|
|
51175
|
-
var transformOrigin = /* @__PURE__ */ __name$
|
|
51792
|
+
__name$7(isNotNull, "isNotNull");
|
|
51793
|
+
var transformOrigin = /* @__PURE__ */ __name$7((options2) => ({
|
|
51176
51794
|
name: "transformOrigin",
|
|
51177
51795
|
options: options2,
|
|
51178
51796
|
fn(data2) {
|
|
@@ -51207,19 +51825,16 @@ function getSideAndAlignFromPlacement(placement) {
|
|
|
51207
51825
|
const [side, align = "center"] = placement.split("-");
|
|
51208
51826
|
return [side, align];
|
|
51209
51827
|
}
|
|
51210
|
-
__name$
|
|
51211
|
-
var
|
|
51212
|
-
var
|
|
51213
|
-
var Content = PopperContent;
|
|
51214
|
-
var __defProp$7 = Object.defineProperty;
|
|
51215
|
-
var __name$7 = (target, value) => __defProp$7(target, "name", { value, configurable: true });
|
|
51828
|
+
__name$7(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
|
|
51829
|
+
var __defProp$6 = Object.defineProperty;
|
|
51830
|
+
var __name$6 = (target, value) => __defProp$6(target, "name", { value, configurable: true });
|
|
51216
51831
|
var POPOVER_NAME = "Popover";
|
|
51217
51832
|
var [createPopoverContext, createPopoverScope] = /* @__PURE__ */ createContextScope(POPOVER_NAME, [
|
|
51218
51833
|
createPopperScope
|
|
51219
51834
|
]);
|
|
51220
51835
|
var usePopperScope$2 = createPopperScope();
|
|
51221
51836
|
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
|
|
51222
|
-
var Popover$1 = /* @__PURE__ */ __name$
|
|
51837
|
+
var Popover$1 = /* @__PURE__ */ __name$6((props) => {
|
|
51223
51838
|
const {
|
|
51224
51839
|
__scopePopover,
|
|
51225
51840
|
children,
|
|
@@ -51231,17 +51846,25 @@ var Popover$1 = /* @__PURE__ */ __name$7((props) => {
|
|
|
51231
51846
|
const popperScope = usePopperScope$2(__scopePopover);
|
|
51232
51847
|
const triggerRef = reactExports.useRef(null);
|
|
51233
51848
|
const [hasCustomAnchor, setHasCustomAnchor] = reactExports.useState(false);
|
|
51849
|
+
const [titleCount, setTitleCount] = reactExports.useState(0);
|
|
51850
|
+
const [descriptionCount, setDescriptionCount] = reactExports.useState(0);
|
|
51234
51851
|
const [open, setOpen] = useControllableState({
|
|
51235
51852
|
prop: openProp,
|
|
51236
51853
|
defaultProp: defaultOpen ?? false,
|
|
51237
51854
|
onChange: onOpenChange,
|
|
51238
51855
|
caller: POPOVER_NAME
|
|
51239
51856
|
});
|
|
51240
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51857
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Popper, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51241
51858
|
PopoverProvider,
|
|
51242
51859
|
{
|
|
51243
51860
|
scope: __scopePopover,
|
|
51244
51861
|
contentId: useId(),
|
|
51862
|
+
titleId: useId(),
|
|
51863
|
+
descriptionId: useId(),
|
|
51864
|
+
titlePresent: titleCount > 0,
|
|
51865
|
+
descriptionPresent: descriptionCount > 0,
|
|
51866
|
+
setTitleCount,
|
|
51867
|
+
setDescriptionCount,
|
|
51245
51868
|
triggerRef,
|
|
51246
51869
|
open,
|
|
51247
51870
|
onOpenChange: setOpen,
|
|
@@ -51256,7 +51879,7 @@ var Popover$1 = /* @__PURE__ */ __name$7((props) => {
|
|
|
51256
51879
|
}, "Popover");
|
|
51257
51880
|
var TRIGGER_NAME$4 = "PopoverTrigger";
|
|
51258
51881
|
var PopoverTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
51259
|
-
/* @__PURE__ */ __name$
|
|
51882
|
+
/* @__PURE__ */ __name$6(function PopoverTrigger2(props, forwardedRef) {
|
|
51260
51883
|
const { __scopePopover, ...triggerProps } = props;
|
|
51261
51884
|
const context = usePopoverContext(TRIGGER_NAME$4, __scopePopover);
|
|
51262
51885
|
const popperScope = usePopperScope$2(__scopePopover);
|
|
@@ -51274,22 +51897,22 @@ var PopoverTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51274
51897
|
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
51275
51898
|
}
|
|
51276
51899
|
);
|
|
51277
|
-
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51900
|
+
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsxRuntimeExports.jsx(PopperAnchor, { asChild: true, ...popperScope, children: trigger });
|
|
51278
51901
|
}, "PopoverTrigger")
|
|
51279
51902
|
);
|
|
51280
51903
|
var PORTAL_NAME$2 = "PopoverPortal";
|
|
51281
51904
|
var [PortalProvider$2, usePortalContext$2] = createPopoverContext(PORTAL_NAME$2, {
|
|
51282
51905
|
forceMount: void 0
|
|
51283
51906
|
});
|
|
51284
|
-
var PopoverPortal = /* @__PURE__ */ __name$
|
|
51907
|
+
var PopoverPortal = /* @__PURE__ */ __name$6((props) => {
|
|
51285
51908
|
const { __scopePopover, forceMount, children, container } = props;
|
|
51286
51909
|
const context = usePopoverContext(PORTAL_NAME$2, __scopePopover);
|
|
51287
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$2, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal
|
|
51910
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$2, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { asChild: true, container, children }) }) });
|
|
51288
51911
|
}, "PopoverPortal");
|
|
51289
51912
|
var CONTENT_NAME$2 = "PopoverContent";
|
|
51290
51913
|
var PopoverContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
51291
51914
|
// blank line to reduce diff noise
|
|
51292
|
-
/* @__PURE__ */ __name$
|
|
51915
|
+
/* @__PURE__ */ __name$6(function PopoverContent2(props, forwardedRef) {
|
|
51293
51916
|
const portalContext = usePortalContext$2(CONTENT_NAME$2, props.__scopePopover);
|
|
51294
51917
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
51295
51918
|
const context = usePopoverContext(CONTENT_NAME$2, props.__scopePopover);
|
|
@@ -51299,48 +51922,62 @@ var PopoverContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51299
51922
|
var Slot$1 = /* @__PURE__ */ createSlot("PopoverContent.RemoveScroll");
|
|
51300
51923
|
var PopoverContentModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
51301
51924
|
// blank line to reduce diff noise
|
|
51302
|
-
/* @__PURE__ */ __name$
|
|
51925
|
+
/* @__PURE__ */ __name$6(function PopoverContentModal2(props, forwardedRef) {
|
|
51303
51926
|
const context = usePopoverContext(CONTENT_NAME$2, props.__scopePopover);
|
|
51304
51927
|
const contentRef = reactExports.useRef(null);
|
|
51305
51928
|
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
51306
51929
|
const isRightClickOutsideRef = reactExports.useRef(false);
|
|
51930
|
+
const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();
|
|
51307
51931
|
reactExports.useEffect(() => {
|
|
51308
51932
|
const content = contentRef.current;
|
|
51309
51933
|
if (content) return hideOthers(content);
|
|
51310
51934
|
}, []);
|
|
51311
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51312
|
-
|
|
51935
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51936
|
+
ReactRemoveScroll,
|
|
51313
51937
|
{
|
|
51314
|
-
|
|
51315
|
-
|
|
51316
|
-
|
|
51317
|
-
|
|
51318
|
-
|
|
51319
|
-
event.preventDefault();
|
|
51320
|
-
if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
|
|
51321
|
-
}),
|
|
51322
|
-
onPointerDownOutside: composeEventHandlers(
|
|
51323
|
-
props.onPointerDownOutside,
|
|
51324
|
-
(event) => {
|
|
51325
|
-
const originalEvent = event.detail.originalEvent;
|
|
51326
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
51327
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
51328
|
-
isRightClickOutsideRef.current = isRightClick;
|
|
51329
|
-
},
|
|
51330
|
-
{ checkForDefaultPrevented: false }
|
|
51938
|
+
as: Slot$1,
|
|
51939
|
+
allowPinchZoom: true,
|
|
51940
|
+
shards: reactExports.useMemo(
|
|
51941
|
+
() => [contentRef, ...branchNodes.map((node) => ({ current: node }))],
|
|
51942
|
+
[contentRef, branchNodes]
|
|
51331
51943
|
),
|
|
51332
|
-
|
|
51333
|
-
|
|
51334
|
-
|
|
51335
|
-
|
|
51944
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51945
|
+
PopoverContentImpl,
|
|
51946
|
+
{
|
|
51947
|
+
...props,
|
|
51948
|
+
ref: composedRefs,
|
|
51949
|
+
branchNodes,
|
|
51950
|
+
branchRegistry,
|
|
51951
|
+
trapFocus: context.open,
|
|
51952
|
+
disableOutsidePointerEvents: true,
|
|
51953
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
51954
|
+
event.preventDefault();
|
|
51955
|
+
if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
|
|
51956
|
+
}),
|
|
51957
|
+
onPointerDownOutside: composeEventHandlers(
|
|
51958
|
+
props.onPointerDownOutside,
|
|
51959
|
+
(event) => {
|
|
51960
|
+
const originalEvent = event.detail.originalEvent;
|
|
51961
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
51962
|
+
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
51963
|
+
isRightClickOutsideRef.current = isRightClick;
|
|
51964
|
+
},
|
|
51965
|
+
{ checkForDefaultPrevented: false }
|
|
51966
|
+
),
|
|
51967
|
+
onFocusOutside: composeEventHandlers(
|
|
51968
|
+
props.onFocusOutside,
|
|
51969
|
+
(event) => event.preventDefault(),
|
|
51970
|
+
{ checkForDefaultPrevented: false }
|
|
51971
|
+
)
|
|
51972
|
+
}
|
|
51336
51973
|
)
|
|
51337
51974
|
}
|
|
51338
|
-
)
|
|
51975
|
+
);
|
|
51339
51976
|
}, "PopoverContentModal")
|
|
51340
51977
|
);
|
|
51341
51978
|
var PopoverContentNonModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
51342
51979
|
// blank line to reduce diff noise
|
|
51343
|
-
/* @__PURE__ */ __name$
|
|
51980
|
+
/* @__PURE__ */ __name$6(function PopoverContentNonModal2(props, forwardedRef) {
|
|
51344
51981
|
const context = usePopoverContext(CONTENT_NAME$2, props.__scopePopover);
|
|
51345
51982
|
const hasInteractedOutsideRef = reactExports.useRef(false);
|
|
51346
51983
|
const hasPointerDownOutsideRef = reactExports.useRef(false);
|
|
@@ -51381,7 +52018,7 @@ var PopoverContentNonModal = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51381
52018
|
);
|
|
51382
52019
|
var PopoverContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
51383
52020
|
// blank line to reduce diff noise
|
|
51384
|
-
/* @__PURE__ */ __name$
|
|
52021
|
+
/* @__PURE__ */ __name$6(function PopoverContentImpl2(props, forwardedRef) {
|
|
51385
52022
|
const {
|
|
51386
52023
|
__scopePopover,
|
|
51387
52024
|
trapFocus,
|
|
@@ -51392,17 +52029,24 @@ var PopoverContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51392
52029
|
onPointerDownOutside,
|
|
51393
52030
|
onFocusOutside,
|
|
51394
52031
|
onInteractOutside,
|
|
52032
|
+
"aria-describedby": ariaDescribedby,
|
|
52033
|
+
branchNodes,
|
|
52034
|
+
branchRegistry,
|
|
51395
52035
|
...contentProps
|
|
51396
52036
|
} = props;
|
|
51397
52037
|
const context = usePopoverContext(CONTENT_NAME$2, __scopePopover);
|
|
51398
52038
|
const popperScope = usePopperScope$2(__scopePopover);
|
|
52039
|
+
const [contentNode, setContentNode] = reactExports.useState(null);
|
|
52040
|
+
const composedRefs = useComposedRefs(forwardedRef, setContentNode);
|
|
52041
|
+
useFocusScopeBranch(contentNode);
|
|
51399
52042
|
useFocusGuards();
|
|
51400
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
52043
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(FocusScopeBranchProvider, { registry: branchRegistry, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51401
52044
|
FocusScope,
|
|
51402
52045
|
{
|
|
51403
52046
|
asChild: true,
|
|
51404
52047
|
loop: true,
|
|
51405
52048
|
trapped: trapFocus,
|
|
52049
|
+
branches: branchNodes,
|
|
51406
52050
|
onMountAutoFocus: onOpenAutoFocus,
|
|
51407
52051
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
51408
52052
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -51417,14 +52061,16 @@ var PopoverContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51417
52061
|
onDismiss: () => context.onOpenChange(false),
|
|
51418
52062
|
deferPointerDownOutside: true,
|
|
51419
52063
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51420
|
-
|
|
52064
|
+
PopperContent,
|
|
51421
52065
|
{
|
|
51422
52066
|
"data-state": getState$2(context.open),
|
|
51423
52067
|
role: "dialog",
|
|
51424
52068
|
id: context.contentId,
|
|
52069
|
+
"aria-labelledby": context.titlePresent ? context.titleId : void 0,
|
|
52070
|
+
"aria-describedby": context.descriptionPresent ? concatAriaDescribedby$1(ariaDescribedby, context.descriptionId) : ariaDescribedby,
|
|
51425
52071
|
...popperScope,
|
|
51426
52072
|
...contentProps,
|
|
51427
|
-
ref:
|
|
52073
|
+
ref: composedRefs,
|
|
51428
52074
|
style: {
|
|
51429
52075
|
...contentProps.style,
|
|
51430
52076
|
// re-namespace exposed content custom properties
|
|
@@ -51441,21 +52087,28 @@ var PopoverContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51441
52087
|
}
|
|
51442
52088
|
)
|
|
51443
52089
|
}
|
|
51444
|
-
);
|
|
52090
|
+
) });
|
|
51445
52091
|
}, "PopoverContentImpl")
|
|
51446
52092
|
);
|
|
51447
52093
|
function getState$2(open) {
|
|
51448
52094
|
return open ? "open" : "closed";
|
|
51449
52095
|
}
|
|
51450
|
-
__name$
|
|
51451
|
-
|
|
51452
|
-
|
|
51453
|
-
|
|
51454
|
-
|
|
51455
|
-
const
|
|
51456
|
-
|
|
51457
|
-
|
|
51458
|
-
|
|
52096
|
+
__name$6(getState$2, "getState");
|
|
52097
|
+
function concatAriaDescribedby$1(...values) {
|
|
52098
|
+
const ids = /* @__PURE__ */ new Set();
|
|
52099
|
+
for (const value of values) {
|
|
52100
|
+
if (typeof value !== "string") continue;
|
|
52101
|
+
for (const id2 of String(value).trim().split(/\s+/)) {
|
|
52102
|
+
if (id2) ids.add(id2);
|
|
52103
|
+
}
|
|
52104
|
+
}
|
|
52105
|
+
return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
|
|
52106
|
+
}
|
|
52107
|
+
__name$6(concatAriaDescribedby$1, "concatAriaDescribedby");
|
|
52108
|
+
const Popover = Popover$1;
|
|
52109
|
+
const PopoverTrigger = PopoverTrigger$1;
|
|
52110
|
+
const PopoverContent = reactExports.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
52111
|
+
PopoverContent$1,
|
|
51459
52112
|
{
|
|
51460
52113
|
ref: ref2,
|
|
51461
52114
|
align,
|
|
@@ -51467,7 +52120,7 @@ const PopoverContent = reactExports.forwardRef(({ className, align = "center", s
|
|
|
51467
52120
|
...props
|
|
51468
52121
|
}
|
|
51469
52122
|
) }));
|
|
51470
|
-
PopoverContent.displayName =
|
|
52123
|
+
PopoverContent.displayName = PopoverContent$1.displayName;
|
|
51471
52124
|
function Combobox({
|
|
51472
52125
|
value,
|
|
51473
52126
|
onChange,
|
|
@@ -51549,10 +52202,10 @@ function Combobox({
|
|
|
51549
52202
|
] }) })
|
|
51550
52203
|
] });
|
|
51551
52204
|
}
|
|
51552
|
-
var __defProp$
|
|
51553
|
-
var __name$
|
|
52205
|
+
var __defProp$5 = Object.defineProperty;
|
|
52206
|
+
var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
|
|
51554
52207
|
var Label$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
51555
|
-
/* @__PURE__ */ __name$
|
|
52208
|
+
/* @__PURE__ */ __name$5(function Label2(props, forwardedRef) {
|
|
51556
52209
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51557
52210
|
Primitive.label,
|
|
51558
52211
|
{
|
|
@@ -51568,19 +52221,18 @@ var Label$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
51568
52221
|
);
|
|
51569
52222
|
}, "Label")
|
|
51570
52223
|
);
|
|
51571
|
-
var Root = Label$1;
|
|
51572
52224
|
const labelVariants = cva(
|
|
51573
52225
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
51574
52226
|
);
|
|
51575
52227
|
const Label = reactExports.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
51576
|
-
|
|
52228
|
+
Label$1,
|
|
51577
52229
|
{
|
|
51578
52230
|
ref: ref2,
|
|
51579
52231
|
className: cn$1(labelVariants(), className),
|
|
51580
52232
|
...props
|
|
51581
52233
|
}
|
|
51582
52234
|
));
|
|
51583
|
-
Label.displayName =
|
|
52235
|
+
Label.displayName = Label$1.displayName;
|
|
51584
52236
|
const Input = reactExports.forwardRef(
|
|
51585
52237
|
({ className, type: type2, ...props }, ref2) => {
|
|
51586
52238
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -55133,27 +55785,21 @@ const SamplingTab = ({ pendingRequests, onApprove, onReject }) => {
|
|
|
55133
55785
|
] })
|
|
55134
55786
|
] }) });
|
|
55135
55787
|
};
|
|
55136
|
-
var __defProp$5 = Object.defineProperty;
|
|
55137
|
-
var __name$5 = (target, value) => __defProp$5(target, "name", { value, configurable: true });
|
|
55138
|
-
function clamp(value, [min2, max2]) {
|
|
55139
|
-
return Math.min(max2, Math.max(min2, value));
|
|
55140
|
-
}
|
|
55141
|
-
__name$5(clamp, "clamp");
|
|
55142
55788
|
var __defProp$4 = Object.defineProperty;
|
|
55143
55789
|
var __name$4 = (target, value) => __defProp$4(target, "name", { value, configurable: true });
|
|
55144
|
-
function
|
|
55145
|
-
|
|
55146
|
-
return reactExports.useMemo(() => {
|
|
55147
|
-
if (ref2.current.value !== value) {
|
|
55148
|
-
ref2.current.previous = ref2.current.value;
|
|
55149
|
-
ref2.current.value = value;
|
|
55150
|
-
}
|
|
55151
|
-
return ref2.current.previous;
|
|
55152
|
-
}, [value]);
|
|
55790
|
+
function clamp(value, [min2, max2]) {
|
|
55791
|
+
return Math.min(max2, Math.max(min2, value));
|
|
55153
55792
|
}
|
|
55154
|
-
__name$4(
|
|
55793
|
+
__name$4(clamp, "clamp");
|
|
55155
55794
|
var __defProp$3 = Object.defineProperty;
|
|
55156
55795
|
var __name$3 = (target, value) => __defProp$3(target, "name", { value, configurable: true });
|
|
55796
|
+
var Position = {
|
|
55797
|
+
ItemAligned: "item-aligned",
|
|
55798
|
+
Popper: "popper"
|
|
55799
|
+
};
|
|
55800
|
+
var Direction = {
|
|
55801
|
+
RTL: "rtl"
|
|
55802
|
+
};
|
|
55157
55803
|
var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
55158
55804
|
var SELECTION_KEYS = [" ", "Enter"];
|
|
55159
55805
|
var SELECT_NAME = "Select";
|
|
@@ -55202,6 +55848,15 @@ function SelectProvider(props) {
|
|
|
55202
55848
|
caller: SELECT_NAME
|
|
55203
55849
|
});
|
|
55204
55850
|
const triggerPointerDownPosRef = reactExports.useRef(null);
|
|
55851
|
+
const hasConsumerStoppedPropagationRef = reactExports.useRef(false);
|
|
55852
|
+
const [userSelection, setUserSelection] = reactExports.useState(null);
|
|
55853
|
+
const handleUserSelect = /* @__PURE__ */ __name$3((nextValue) => {
|
|
55854
|
+
setUserSelection({
|
|
55855
|
+
value: nextValue,
|
|
55856
|
+
hasConsumerStoppedPropagation: hasConsumerStoppedPropagationRef.current
|
|
55857
|
+
});
|
|
55858
|
+
setValue(nextValue);
|
|
55859
|
+
}, "handleUserSelect");
|
|
55205
55860
|
const initialValueRef = reactExports.useRef(value);
|
|
55206
55861
|
reactExports.useEffect(() => {
|
|
55207
55862
|
const associatedForm = form ? trigger?.ownerDocument.getElementById(form) : trigger?.form;
|
|
@@ -55236,6 +55891,9 @@ function SelectProvider(props) {
|
|
|
55236
55891
|
contentId,
|
|
55237
55892
|
value,
|
|
55238
55893
|
onValueChange: setValue,
|
|
55894
|
+
hasConsumerStoppedPropagationRef,
|
|
55895
|
+
userSelection,
|
|
55896
|
+
onUserSelect: handleUserSelect,
|
|
55239
55897
|
open,
|
|
55240
55898
|
onOpenChange: setOpen,
|
|
55241
55899
|
dir: direction,
|
|
@@ -55248,7 +55906,7 @@ function SelectProvider(props) {
|
|
|
55248
55906
|
nativeSelectKey,
|
|
55249
55907
|
isFormControl
|
|
55250
55908
|
};
|
|
55251
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55909
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Popper, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectProviderImpl, { scope: __scopeSelect, ...context, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.Provider, { scope: __scopeSelect, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55252
55910
|
SelectNativeOptionsProvider,
|
|
55253
55911
|
{
|
|
55254
55912
|
scope: __scopeSelect,
|
|
@@ -55293,7 +55951,7 @@ var SelectTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55293
55951
|
const currentItem = enabledItems.find((item) => item.value === context.value);
|
|
55294
55952
|
const nextItem = findNextItem(enabledItems, search, currentItem);
|
|
55295
55953
|
if (nextItem !== void 0) {
|
|
55296
|
-
context.
|
|
55954
|
+
context.onUserSelect(nextItem.value);
|
|
55297
55955
|
}
|
|
55298
55956
|
});
|
|
55299
55957
|
const handleOpen = /* @__PURE__ */ __name$3((pointerEvent) => {
|
|
@@ -55308,7 +55966,7 @@ var SelectTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55308
55966
|
};
|
|
55309
55967
|
}
|
|
55310
55968
|
}, "handleOpen");
|
|
55311
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55969
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PopperAnchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55312
55970
|
Primitive.button,
|
|
55313
55971
|
{
|
|
55314
55972
|
type: "button",
|
|
@@ -55344,7 +56002,10 @@ var SelectTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55344
56002
|
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
55345
56003
|
const isTypingAhead = searchRef.current !== "";
|
|
55346
56004
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
55347
|
-
if (!isModifierKey && event.key.length === 1)
|
|
56005
|
+
if (!isModifierKey && event.key.length === 1) {
|
|
56006
|
+
context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
56007
|
+
handleTypeaheadSearch(event.key);
|
|
56008
|
+
}
|
|
55348
56009
|
if (isTypingAhead && event.key === " ") return;
|
|
55349
56010
|
if (OPEN_KEYS.includes(event.key)) {
|
|
55350
56011
|
handleOpen();
|
|
@@ -55391,7 +56052,7 @@ var [PortalProvider$1, usePortalContext$1] = createSelectContext(PORTAL_NAME$1,
|
|
|
55391
56052
|
});
|
|
55392
56053
|
var SelectPortal = /* @__PURE__ */ __name$3((props) => {
|
|
55393
56054
|
const { __scopeSelect, forceMount, ...portalProps } = props;
|
|
55394
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$1, { scope: props.__scopeSelect, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal
|
|
56055
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$1, { scope: props.__scopeSelect, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { asChild: true, ...portalProps }) });
|
|
55395
56056
|
}, "SelectPortal");
|
|
55396
56057
|
var CONTENT_NAME$1 = "SelectContent";
|
|
55397
56058
|
var SelectContent$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
@@ -55422,7 +56083,7 @@ var SelectContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55422
56083
|
/* @__PURE__ */ __name$3(function SelectContentImpl2(props, forwardedRef) {
|
|
55423
56084
|
const { __scopeSelect } = props;
|
|
55424
56085
|
const {
|
|
55425
|
-
position =
|
|
56086
|
+
position = Position.ItemAligned,
|
|
55426
56087
|
onCloseAutoFocus,
|
|
55427
56088
|
onEscapeKeyDown,
|
|
55428
56089
|
onPointerDownOutside,
|
|
@@ -55452,6 +56113,8 @@ var SelectContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55452
56113
|
const getItems = useCollection(__scopeSelect);
|
|
55453
56114
|
const [isPositioned, setIsPositioned] = reactExports.useState(false);
|
|
55454
56115
|
const firstValidItemFoundRef = reactExports.useRef(false);
|
|
56116
|
+
const firstItemFoundRef = reactExports.useRef(false);
|
|
56117
|
+
const firstItemTextFoundRef = reactExports.useRef(false);
|
|
55455
56118
|
reactExports.useEffect(() => {
|
|
55456
56119
|
if (content) return hideOthers(content);
|
|
55457
56120
|
}, [content]);
|
|
@@ -55531,11 +56194,15 @@ var SelectContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55531
56194
|
});
|
|
55532
56195
|
const itemRefCallback = reactExports.useCallback(
|
|
55533
56196
|
(node, value, disabled) => {
|
|
56197
|
+
const isFirstItem = !firstItemFoundRef.current;
|
|
56198
|
+
if (isFirstItem) firstItemFoundRef.current = true;
|
|
55534
56199
|
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
55535
56200
|
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
55536
56201
|
if (isSelectedItem || isFirstValidItem) {
|
|
55537
56202
|
setSelectedItem(node);
|
|
55538
56203
|
if (isFirstValidItem) firstValidItemFoundRef.current = true;
|
|
56204
|
+
} else if (isFirstItem) {
|
|
56205
|
+
setSelectedItem(node);
|
|
55539
56206
|
}
|
|
55540
56207
|
},
|
|
55541
56208
|
[context.value]
|
|
@@ -55543,15 +56210,20 @@ var SelectContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55543
56210
|
const handleItemLeave = reactExports.useCallback(() => content?.focus(), [content]);
|
|
55544
56211
|
const itemTextRefCallback = reactExports.useCallback(
|
|
55545
56212
|
(node, value, disabled) => {
|
|
56213
|
+
if (!node) return;
|
|
56214
|
+
const isFirstItem = !firstItemTextFoundRef.current;
|
|
56215
|
+
if (isFirstItem) firstItemTextFoundRef.current = true;
|
|
55546
56216
|
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
55547
56217
|
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
55548
56218
|
if (isSelectedItem || isFirstValidItem) {
|
|
55549
56219
|
setSelectedItemText(node);
|
|
56220
|
+
} else if (isFirstItem) {
|
|
56221
|
+
setSelectedItemText(node);
|
|
55550
56222
|
}
|
|
55551
56223
|
},
|
|
55552
56224
|
[context.value]
|
|
55553
56225
|
);
|
|
55554
|
-
const SelectPosition = position ===
|
|
56226
|
+
const SelectPosition = position === Position.Popper ? SelectPopperPosition : SelectItemAlignedPosition;
|
|
55555
56227
|
const popperContentProps = SelectPosition === SelectPopperPosition ? {
|
|
55556
56228
|
side,
|
|
55557
56229
|
sideOffset,
|
|
@@ -55667,7 +56339,7 @@ var SelectItemAlignedPosition = /* @__PURE__ */ reactExports.forwardRef(/* @__PU
|
|
|
55667
56339
|
const contentRect = content.getBoundingClientRect();
|
|
55668
56340
|
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
55669
56341
|
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
55670
|
-
if (context.dir !==
|
|
56342
|
+
if (context.dir !== Direction.RTL) {
|
|
55671
56343
|
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
55672
56344
|
const left = valueNodeRect.left - itemTextOffset;
|
|
55673
56345
|
const leftDelta = triggerRect.left - left;
|
|
@@ -55821,7 +56493,7 @@ var SelectPopperPosition = /* @__PURE__ */ reactExports.forwardRef(/* @__PURE__
|
|
|
55821
56493
|
} = props;
|
|
55822
56494
|
const popperScope = usePopperScope$1(__scopeSelect);
|
|
55823
56495
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55824
|
-
|
|
56496
|
+
PopperContent,
|
|
55825
56497
|
{
|
|
55826
56498
|
...popperScope,
|
|
55827
56499
|
...popperProps,
|
|
@@ -55944,12 +56616,12 @@ var SelectItem$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55944
56616
|
const composedRefs = useComposedRefs(forwardedRef, handleItemRefCallback);
|
|
55945
56617
|
const textId = useId();
|
|
55946
56618
|
const pointerTypeRef = reactExports.useRef("touch");
|
|
55947
|
-
|
|
55948
|
-
|
|
55949
|
-
|
|
55950
|
-
|
|
55951
|
-
|
|
55952
|
-
|
|
56619
|
+
function handleSelect(event) {
|
|
56620
|
+
context.hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
56621
|
+
context.onUserSelect(value);
|
|
56622
|
+
context.onOpenChange(false);
|
|
56623
|
+
}
|
|
56624
|
+
__name$3(handleSelect, "handleSelect");
|
|
55953
56625
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
55954
56626
|
SelectItemContextProvider,
|
|
55955
56627
|
{
|
|
@@ -55983,11 +56655,21 @@ var SelectItem$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
55983
56655
|
ref: composedRefs,
|
|
55984
56656
|
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
55985
56657
|
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
55986
|
-
onClick: composeEventHandlers(itemProps.onClick, () => {
|
|
55987
|
-
if (
|
|
56658
|
+
onClick: composeEventHandlers(itemProps.onClick, (event) => {
|
|
56659
|
+
if (disabled) {
|
|
56660
|
+
return;
|
|
56661
|
+
}
|
|
56662
|
+
if (pointerTypeRef.current !== "mouse") {
|
|
56663
|
+
handleSelect(event);
|
|
56664
|
+
}
|
|
55988
56665
|
}),
|
|
55989
|
-
onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {
|
|
55990
|
-
if (
|
|
56666
|
+
onPointerUp: composeEventHandlers(itemProps.onPointerUp, (event) => {
|
|
56667
|
+
if (disabled) {
|
|
56668
|
+
return;
|
|
56669
|
+
}
|
|
56670
|
+
if (pointerTypeRef.current === "mouse") {
|
|
56671
|
+
handleSelect(event);
|
|
56672
|
+
}
|
|
55991
56673
|
}),
|
|
55992
56674
|
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
55993
56675
|
pointerTypeRef.current = event.pointerType;
|
|
@@ -56014,7 +56696,7 @@ var SelectItem$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56014
56696
|
return;
|
|
56015
56697
|
}
|
|
56016
56698
|
if (SELECTION_KEYS.includes(event.key)) {
|
|
56017
|
-
handleSelect();
|
|
56699
|
+
handleSelect(event);
|
|
56018
56700
|
}
|
|
56019
56701
|
if (event.key === " ") {
|
|
56020
56702
|
event.preventDefault();
|
|
@@ -56192,12 +56874,14 @@ var SelectBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56192
56874
|
// blank line to reduce diff noise
|
|
56193
56875
|
/* @__PURE__ */ __name$3(function SelectBubbleInput2({ __scopeSelect, ...props }, forwardedRef) {
|
|
56194
56876
|
const context = useSelectContext(BUBBLE_INPUT_NAME$2, __scopeSelect);
|
|
56195
|
-
const { value, onValueChange, required: required2, disabled, name: name2, autoComplete, form } = context;
|
|
56877
|
+
const { value, onValueChange, required: required2, disabled, name: name2, autoComplete, form, userSelection } = context;
|
|
56196
56878
|
const { nativeOptions, nativeSelectKey } = context;
|
|
56197
56879
|
const ref2 = reactExports.useRef(null);
|
|
56198
56880
|
const composedRefs = useComposedRefs(forwardedRef, ref2);
|
|
56199
56881
|
const selectValue = value ?? "";
|
|
56200
|
-
const
|
|
56882
|
+
const prevValueRef = reactExports.useRef(selectValue);
|
|
56883
|
+
const handledUserSelectionRef = reactExports.useRef(userSelection);
|
|
56884
|
+
const isDispatchingUserSelectionRef = reactExports.useRef(false);
|
|
56201
56885
|
const hasEmptyValueOption = Array.from(nativeOptions).some(
|
|
56202
56886
|
(option) => (option.props.value ?? "") === ""
|
|
56203
56887
|
);
|
|
@@ -56210,12 +56894,29 @@ var SelectBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56210
56894
|
"value"
|
|
56211
56895
|
);
|
|
56212
56896
|
const setValue = descriptor.set;
|
|
56213
|
-
|
|
56214
|
-
|
|
56897
|
+
const isNewUserSelection = userSelection !== null && userSelection !== handledUserSelectionRef.current;
|
|
56898
|
+
handledUserSelectionRef.current = userSelection;
|
|
56899
|
+
const valueChanged = prevValueRef.current !== selectValue;
|
|
56900
|
+
prevValueRef.current = selectValue;
|
|
56901
|
+
const isUserInteraction = isNewUserSelection && valueChanged;
|
|
56902
|
+
if (isNewUserSelection && !valueChanged && userSelection.value !== selectValue && !userSelection.hasConsumerStoppedPropagation && setValue) {
|
|
56903
|
+
isDispatchingUserSelectionRef.current = true;
|
|
56904
|
+
try {
|
|
56905
|
+
setValue.call(select, userSelection.value);
|
|
56906
|
+
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
56907
|
+
} finally {
|
|
56908
|
+
isDispatchingUserSelectionRef.current = false;
|
|
56909
|
+
setValue.call(select, selectValue);
|
|
56910
|
+
}
|
|
56911
|
+
return;
|
|
56912
|
+
}
|
|
56913
|
+
const bubbles = isUserInteraction && !userSelection.hasConsumerStoppedPropagation;
|
|
56914
|
+
if (valueChanged && setValue) {
|
|
56915
|
+
const event = new Event("change", { bubbles });
|
|
56215
56916
|
setValue.call(select, selectValue);
|
|
56216
56917
|
select.dispatchEvent(event);
|
|
56217
56918
|
}
|
|
56218
|
-
}, [
|
|
56919
|
+
}, [selectValue, userSelection]);
|
|
56219
56920
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
56220
56921
|
Primitive.select,
|
|
56221
56922
|
{
|
|
@@ -56226,7 +56927,11 @@ var SelectBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56226
56927
|
autoComplete,
|
|
56227
56928
|
disabled,
|
|
56228
56929
|
form,
|
|
56229
|
-
onChange: (event) =>
|
|
56930
|
+
onChange: (event) => {
|
|
56931
|
+
if (!isDispatchingUserSelectionRef.current) {
|
|
56932
|
+
onValueChange(event.target.value);
|
|
56933
|
+
}
|
|
56934
|
+
},
|
|
56230
56935
|
...props,
|
|
56231
56936
|
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style },
|
|
56232
56937
|
ref: composedRefs,
|
|
@@ -56256,11 +56961,13 @@ function useTypeaheadSearch(onSearchChange) {
|
|
|
56256
56961
|
(key) => {
|
|
56257
56962
|
const search = searchRef.current + key;
|
|
56258
56963
|
handleSearchChange(search);
|
|
56259
|
-
|
|
56964
|
+
function updateSearch(value) {
|
|
56260
56965
|
searchRef.current = value;
|
|
56261
56966
|
window.clearTimeout(timerRef.current);
|
|
56262
56967
|
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
56263
|
-
}
|
|
56968
|
+
}
|
|
56969
|
+
__name$3(updateSearch, "updateSearch");
|
|
56970
|
+
updateSearch(search);
|
|
56264
56971
|
},
|
|
56265
56972
|
[handleSearchChange]
|
|
56266
56973
|
);
|
|
@@ -56436,7 +57143,7 @@ const useTheme = () => {
|
|
|
56436
57143
|
[theme, setThemeWithSideEffect]
|
|
56437
57144
|
);
|
|
56438
57145
|
};
|
|
56439
|
-
const version = "1.0.
|
|
57146
|
+
const version = "1.0.3";
|
|
56440
57147
|
var __defProp$2 = Object.defineProperty;
|
|
56441
57148
|
var __name$2 = (target, value) => __defProp$2(target, "name", { value, configurable: true });
|
|
56442
57149
|
var [createTooltipContext, createTooltipScope] = /* @__PURE__ */ createContextScope("Tooltip", [
|
|
@@ -56556,7 +57263,7 @@ var Tooltip$1 = /* @__PURE__ */ __name$2((props) => {
|
|
|
56556
57263
|
};
|
|
56557
57264
|
}, []);
|
|
56558
57265
|
const contentId = contentIdState ?? generatedContentId;
|
|
56559
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
57266
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Popper, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
56560
57267
|
TooltipContextProvider,
|
|
56561
57268
|
{
|
|
56562
57269
|
scope: __scopeTooltip,
|
|
@@ -56588,7 +57295,7 @@ var Tooltip$1 = /* @__PURE__ */ __name$2((props) => {
|
|
|
56588
57295
|
var TRIGGER_NAME$2 = "TooltipTrigger";
|
|
56589
57296
|
var TooltipTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
56590
57297
|
/* @__PURE__ */ __name$2(function TooltipTrigger2(props, forwardedRef) {
|
|
56591
|
-
const { __scopeTooltip, ...triggerProps } = props;
|
|
57298
|
+
const { __scopeTooltip, "aria-describedby": ariaDescribedby, ...triggerProps } = props;
|
|
56592
57299
|
const context = useTooltipContext(TRIGGER_NAME$2, __scopeTooltip);
|
|
56593
57300
|
const providerContext = useTooltipProviderContext(TRIGGER_NAME$2, __scopeTooltip);
|
|
56594
57301
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
@@ -56600,10 +57307,10 @@ var TooltipTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56600
57307
|
reactExports.useEffect(() => {
|
|
56601
57308
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
56602
57309
|
}, [handlePointerUp]);
|
|
56603
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
57310
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(PopperAnchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
56604
57311
|
Primitive.button,
|
|
56605
57312
|
{
|
|
56606
|
-
"aria-describedby": context.open ? context.contentId :
|
|
57313
|
+
"aria-describedby": context.open ? concatAriaDescribedby(ariaDescribedby, context.contentId) : ariaDescribedby,
|
|
56607
57314
|
"data-state": context.stateAttribute,
|
|
56608
57315
|
...triggerProps,
|
|
56609
57316
|
ref: composedRefs,
|
|
@@ -56724,6 +57431,9 @@ var TooltipContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56724
57431
|
const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
|
|
56725
57432
|
const popperScope = usePopperScope(__scopeTooltip);
|
|
56726
57433
|
const { onClose } = context;
|
|
57434
|
+
const [contentNode, setContentNode] = reactExports.useState(null);
|
|
57435
|
+
const composedRefs = useComposedRefs(forwardedRef, setContentNode);
|
|
57436
|
+
useFocusScopeBranch(contentNode);
|
|
56727
57437
|
reactExports.useEffect(() => {
|
|
56728
57438
|
document.addEventListener(TOOLTIP_OPEN, onClose);
|
|
56729
57439
|
return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
|
|
@@ -56756,14 +57466,14 @@ var TooltipContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56756
57466
|
onFocusOutside: (event) => event.preventDefault(),
|
|
56757
57467
|
onDismiss: onClose,
|
|
56758
57468
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
56759
|
-
|
|
57469
|
+
PopperContent,
|
|
56760
57470
|
{
|
|
56761
57471
|
"data-state": context.stateAttribute,
|
|
56762
57472
|
role: ariaLabel ? void 0 : "tooltip",
|
|
56763
57473
|
id: ariaLabel ? void 0 : context.contentId,
|
|
56764
57474
|
...popperScope,
|
|
56765
57475
|
...contentProps,
|
|
56766
|
-
ref:
|
|
57476
|
+
ref: composedRefs,
|
|
56767
57477
|
style: {
|
|
56768
57478
|
...contentProps.style,
|
|
56769
57479
|
// re-namespace exposed content custom properties
|
|
@@ -56777,7 +57487,7 @@ var TooltipContentImpl = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
56777
57487
|
},
|
|
56778
57488
|
children: [
|
|
56779
57489
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Slottable, { children }),
|
|
56780
|
-
ariaLabel ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
57490
|
+
ariaLabel ? /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHidden, { id: context.contentId, role: "tooltip", children: ariaLabel }) : null
|
|
56781
57491
|
]
|
|
56782
57492
|
}
|
|
56783
57493
|
)
|
|
@@ -56906,15 +57616,22 @@ function getHullPresorted(points) {
|
|
|
56906
57616
|
}
|
|
56907
57617
|
}
|
|
56908
57618
|
__name$2(getHullPresorted, "getHullPresorted");
|
|
56909
|
-
|
|
56910
|
-
|
|
56911
|
-
|
|
56912
|
-
|
|
56913
|
-
const
|
|
56914
|
-
|
|
56915
|
-
|
|
57619
|
+
function concatAriaDescribedby(...values) {
|
|
57620
|
+
const ids = /* @__PURE__ */ new Set();
|
|
57621
|
+
for (const value of values) {
|
|
57622
|
+
if (typeof value !== "string") continue;
|
|
57623
|
+
for (const id2 of String(value).trim().split(/\s+/)) {
|
|
57624
|
+
if (id2) ids.add(id2);
|
|
57625
|
+
}
|
|
57626
|
+
}
|
|
57627
|
+
return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
|
|
57628
|
+
}
|
|
57629
|
+
__name$2(concatAriaDescribedby, "concatAriaDescribedby");
|
|
57630
|
+
const TooltipProvider = TooltipProvider$1;
|
|
57631
|
+
const Tooltip = Tooltip$1;
|
|
57632
|
+
const TooltipTrigger = TooltipTrigger$1;
|
|
56916
57633
|
const TooltipContent = reactExports.forwardRef(({ className, sideOffset = 4, ...props }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
56917
|
-
|
|
57634
|
+
TooltipContent$1,
|
|
56918
57635
|
{
|
|
56919
57636
|
ref: ref2,
|
|
56920
57637
|
sideOffset,
|
|
@@ -56925,7 +57642,7 @@ const TooltipContent = reactExports.forwardRef(({ className, sideOffset = 4, ...
|
|
|
56925
57642
|
...props
|
|
56926
57643
|
}
|
|
56927
57644
|
));
|
|
56928
|
-
TooltipContent.displayName =
|
|
57645
|
+
TooltipContent.displayName = TooltipContent$1.displayName;
|
|
56929
57646
|
const Textarea = reactExports.forwardRef(
|
|
56930
57647
|
({ className, ...props }, ref2) => {
|
|
56931
57648
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -56970,11 +57687,7 @@ function SwitchProvider(props) {
|
|
|
56970
57687
|
});
|
|
56971
57688
|
const [control, setControl] = reactExports.useState(null);
|
|
56972
57689
|
const [bubbleInput, setBubbleInput] = reactExports.useState(null);
|
|
56973
|
-
const
|
|
56974
|
-
const [userInteractionCount, onUserInteraction] = reactExports.useReducer(
|
|
56975
|
-
(count2) => count2 + 1,
|
|
56976
|
-
0
|
|
56977
|
-
);
|
|
57690
|
+
const [userClick, setUserClick] = reactExports.useState(null);
|
|
56978
57691
|
const isFormControl = control ? !!form || !!control.closest("form") : (
|
|
56979
57692
|
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
56980
57693
|
true
|
|
@@ -56988,9 +57701,8 @@ function SwitchProvider(props) {
|
|
|
56988
57701
|
name: name2,
|
|
56989
57702
|
form,
|
|
56990
57703
|
value,
|
|
56991
|
-
|
|
56992
|
-
|
|
56993
|
-
onUserInteraction,
|
|
57704
|
+
userClick,
|
|
57705
|
+
onUserClick: setUserClick,
|
|
56994
57706
|
required: required2,
|
|
56995
57707
|
defaultChecked,
|
|
56996
57708
|
isFormControl,
|
|
@@ -57012,8 +57724,7 @@ var SwitchTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
57012
57724
|
required: required2,
|
|
57013
57725
|
setControl,
|
|
57014
57726
|
setChecked,
|
|
57015
|
-
|
|
57016
|
-
onUserInteraction,
|
|
57727
|
+
onUserClick,
|
|
57017
57728
|
isFormControl,
|
|
57018
57729
|
bubbleInput
|
|
57019
57730
|
} = useSwitchContext(TRIGGER_NAME$1, __scopeSwitch);
|
|
@@ -57041,11 +57752,13 @@ var SwitchTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
57041
57752
|
...switchProps,
|
|
57042
57753
|
ref: composedRefs,
|
|
57043
57754
|
onClick: composeEventHandlers(onClick, (event) => {
|
|
57044
|
-
|
|
57755
|
+
const hasConsumerStoppedPropagation = event.isPropagationStopped();
|
|
57756
|
+
onUserClick({ requestedChecked: !checked, hasConsumerStoppedPropagation });
|
|
57045
57757
|
setChecked((prevChecked) => !prevChecked);
|
|
57046
57758
|
if (bubbleInput && isFormControl) {
|
|
57047
|
-
|
|
57048
|
-
|
|
57759
|
+
if (!hasConsumerStoppedPropagation) {
|
|
57760
|
+
event.stopPropagation();
|
|
57761
|
+
}
|
|
57049
57762
|
}
|
|
57050
57763
|
})
|
|
57051
57764
|
}
|
|
@@ -57121,8 +57834,7 @@ var SwitchBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
57121
57834
|
/* @__PURE__ */ __name$1(function SwitchBubbleInput2({ __scopeSwitch, onClick, ...props }, forwardedRef) {
|
|
57122
57835
|
const {
|
|
57123
57836
|
control,
|
|
57124
|
-
|
|
57125
|
-
userInteractionCount,
|
|
57837
|
+
userClick,
|
|
57126
57838
|
checked,
|
|
57127
57839
|
defaultChecked,
|
|
57128
57840
|
required: required2,
|
|
@@ -57137,7 +57849,8 @@ var SwitchBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
57137
57849
|
const controlSize = useSize(control);
|
|
57138
57850
|
const shouldStopClickPropagationRef = reactExports.useRef(false);
|
|
57139
57851
|
const prevCheckedRef = reactExports.useRef(checked);
|
|
57140
|
-
const
|
|
57852
|
+
const handledUserClickRef = reactExports.useRef(userClick);
|
|
57853
|
+
const pendingUserClickRef = reactExports.useRef(null);
|
|
57141
57854
|
reactExports.useEffect(() => {
|
|
57142
57855
|
const input = bubbleInput;
|
|
57143
57856
|
if (!input) return;
|
|
@@ -57147,19 +57860,35 @@ var SwitchBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
57147
57860
|
"checked"
|
|
57148
57861
|
);
|
|
57149
57862
|
const setChecked = descriptor.set;
|
|
57150
|
-
|
|
57151
|
-
|
|
57863
|
+
if (!setChecked) {
|
|
57864
|
+
return;
|
|
57865
|
+
}
|
|
57152
57866
|
const checkedChanged = prevCheckedRef.current !== checked;
|
|
57153
57867
|
prevCheckedRef.current = checked;
|
|
57154
|
-
const
|
|
57155
|
-
|
|
57156
|
-
|
|
57157
|
-
|
|
57868
|
+
const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;
|
|
57869
|
+
handledUserClickRef.current = userClick;
|
|
57870
|
+
if (isNewUserClick) {
|
|
57871
|
+
pendingUserClickRef.current = checkedChanged ? null : userClick;
|
|
57872
|
+
if (checkedChanged) {
|
|
57873
|
+
setChecked.call(input, checked);
|
|
57874
|
+
}
|
|
57875
|
+
input.dispatchEvent(
|
|
57876
|
+
new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation })
|
|
57877
|
+
);
|
|
57878
|
+
} else if (checkedChanged) {
|
|
57879
|
+
const pendingUserClick = pendingUserClickRef.current;
|
|
57880
|
+
pendingUserClickRef.current = null;
|
|
57881
|
+
const isPendingUserChange = pendingUserClick?.requestedChecked === checked;
|
|
57882
|
+
shouldStopClickPropagationRef.current = true;
|
|
57158
57883
|
setChecked.call(input, checked);
|
|
57159
|
-
input.dispatchEvent(
|
|
57884
|
+
input.dispatchEvent(
|
|
57885
|
+
new Event("click", {
|
|
57886
|
+
bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation)
|
|
57887
|
+
})
|
|
57888
|
+
);
|
|
57160
57889
|
shouldStopClickPropagationRef.current = false;
|
|
57161
57890
|
}
|
|
57162
|
-
}, [bubbleInput, checked,
|
|
57891
|
+
}, [bubbleInput, checked, userClick]);
|
|
57163
57892
|
const defaultCheckedRef = reactExports.useRef(checked);
|
|
57164
57893
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
57165
57894
|
Primitive.input,
|
|
@@ -58232,11 +58961,7 @@ function CheckboxProvider(props) {
|
|
|
58232
58961
|
});
|
|
58233
58962
|
const [control, setControl] = reactExports.useState(null);
|
|
58234
58963
|
const [bubbleInput, setBubbleInput] = reactExports.useState(null);
|
|
58235
|
-
const
|
|
58236
|
-
const [userInteractionCount, onUserInteraction] = reactExports.useReducer(
|
|
58237
|
-
(count2) => count2 + 1,
|
|
58238
|
-
0
|
|
58239
|
-
);
|
|
58964
|
+
const [userClick, setUserClick] = reactExports.useState(null);
|
|
58240
58965
|
const isFormControl = control ? !!form || !!control.closest("form") : (
|
|
58241
58966
|
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
58242
58967
|
true
|
|
@@ -58250,9 +58975,8 @@ function CheckboxProvider(props) {
|
|
|
58250
58975
|
name: name2,
|
|
58251
58976
|
form,
|
|
58252
58977
|
value,
|
|
58253
|
-
|
|
58254
|
-
|
|
58255
|
-
onUserInteraction,
|
|
58978
|
+
userClick,
|
|
58979
|
+
onUserClick: setUserClick,
|
|
58256
58980
|
required: required2,
|
|
58257
58981
|
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
|
|
58258
58982
|
isFormControl,
|
|
@@ -58280,8 +59004,7 @@ var CheckboxTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
58280
59004
|
required: required2,
|
|
58281
59005
|
setControl,
|
|
58282
59006
|
setChecked,
|
|
58283
|
-
|
|
58284
|
-
onUserInteraction,
|
|
59007
|
+
onUserClick,
|
|
58285
59008
|
isFormControl,
|
|
58286
59009
|
bubbleInput
|
|
58287
59010
|
} = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
|
|
@@ -58312,11 +59035,14 @@ var CheckboxTrigger = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
58312
59035
|
if (event.key === "Enter") event.preventDefault();
|
|
58313
59036
|
}),
|
|
58314
59037
|
onClick: composeEventHandlers(onClick, (event) => {
|
|
58315
|
-
|
|
59038
|
+
const hasConsumerStoppedPropagation = event.isPropagationStopped();
|
|
59039
|
+
onUserClick({
|
|
59040
|
+
requestedChecked: isIndeterminate(checked) ? true : !checked,
|
|
59041
|
+
hasConsumerStoppedPropagation
|
|
59042
|
+
});
|
|
58316
59043
|
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
|
|
58317
59044
|
if (bubbleInput && isFormControl) {
|
|
58318
|
-
|
|
58319
|
-
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
59045
|
+
if (!hasConsumerStoppedPropagation) event.stopPropagation();
|
|
58320
59046
|
}
|
|
58321
59047
|
})
|
|
58322
59048
|
}
|
|
@@ -58400,8 +59126,7 @@ var CheckboxBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
58400
59126
|
/* @__PURE__ */ __name(function CheckboxBubbleInput2({ __scopeCheckbox, onClick, ...props }, forwardedRef) {
|
|
58401
59127
|
const {
|
|
58402
59128
|
control,
|
|
58403
|
-
|
|
58404
|
-
userInteractionCount,
|
|
59129
|
+
userClick,
|
|
58405
59130
|
checked,
|
|
58406
59131
|
defaultChecked,
|
|
58407
59132
|
required: required2,
|
|
@@ -58416,7 +59141,8 @@ var CheckboxBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
58416
59141
|
const controlSize = useSize(control);
|
|
58417
59142
|
const shouldStopClickPropagationRef = reactExports.useRef(false);
|
|
58418
59143
|
const prevCheckedRef = reactExports.useRef(checked);
|
|
58419
|
-
const
|
|
59144
|
+
const handledUserClickRef = reactExports.useRef(userClick);
|
|
59145
|
+
const pendingUserClickRef = reactExports.useRef(null);
|
|
58420
59146
|
reactExports.useEffect(() => {
|
|
58421
59147
|
const input = bubbleInput;
|
|
58422
59148
|
if (!input) return;
|
|
@@ -58426,20 +59152,35 @@ var CheckboxBubbleInput = /* @__PURE__ */ reactExports.forwardRef(
|
|
|
58426
59152
|
"checked"
|
|
58427
59153
|
);
|
|
58428
59154
|
const setChecked = descriptor.set;
|
|
58429
|
-
|
|
58430
|
-
prevUserInteractionCountRef.current = userInteractionCount;
|
|
59155
|
+
if (!setChecked) return;
|
|
58431
59156
|
const checkedChanged = prevCheckedRef.current !== checked;
|
|
58432
59157
|
prevCheckedRef.current = checked;
|
|
58433
|
-
const
|
|
58434
|
-
|
|
58435
|
-
|
|
58436
|
-
|
|
59158
|
+
const isNewUserClick = userClick !== null && userClick !== handledUserClickRef.current;
|
|
59159
|
+
handledUserClickRef.current = userClick;
|
|
59160
|
+
if (isNewUserClick) {
|
|
59161
|
+
pendingUserClickRef.current = checkedChanged ? null : userClick;
|
|
59162
|
+
if (checkedChanged) {
|
|
59163
|
+
input.indeterminate = isIndeterminate(checked);
|
|
59164
|
+
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
|
59165
|
+
}
|
|
59166
|
+
input.dispatchEvent(
|
|
59167
|
+
new Event("click", { bubbles: !userClick.hasConsumerStoppedPropagation })
|
|
59168
|
+
);
|
|
59169
|
+
} else if (checkedChanged) {
|
|
59170
|
+
const pendingUserClick = pendingUserClickRef.current;
|
|
59171
|
+
pendingUserClickRef.current = null;
|
|
59172
|
+
const isPendingUserChange = pendingUserClick?.requestedChecked === checked;
|
|
59173
|
+
shouldStopClickPropagationRef.current = true;
|
|
58437
59174
|
input.indeterminate = isIndeterminate(checked);
|
|
58438
59175
|
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
|
58439
|
-
input.dispatchEvent(
|
|
59176
|
+
input.dispatchEvent(
|
|
59177
|
+
new Event("click", {
|
|
59178
|
+
bubbles: !(isPendingUserChange && pendingUserClick.hasConsumerStoppedPropagation)
|
|
59179
|
+
})
|
|
59180
|
+
);
|
|
58440
59181
|
shouldStopClickPropagationRef.current = false;
|
|
58441
59182
|
}
|
|
58442
|
-
}, [bubbleInput, checked,
|
|
59183
|
+
}, [bubbleInput, checked, userClick]);
|
|
58443
59184
|
const defaultCheckedRef = reactExports.useRef(isIndeterminate(checked) ? false : checked);
|
|
58444
59185
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
58445
59186
|
Primitive.input,
|
|
@@ -65423,12 +66164,12 @@ const AppRenderer = ({
|
|
|
65423
66164
|
[]
|
|
65424
66165
|
);
|
|
65425
66166
|
const handleOpenLink = async ({ url: url2 }) => {
|
|
65426
|
-
|
|
65427
|
-
if (
|
|
65428
|
-
|
|
65429
|
-
isError = false;
|
|
66167
|
+
const target = parseHttpUrl(url2);
|
|
66168
|
+
if (!target) {
|
|
66169
|
+
return { isError: true };
|
|
65430
66170
|
}
|
|
65431
|
-
|
|
66171
|
+
window.open(target, "_blank", "noopener,noreferrer");
|
|
66172
|
+
return { isError: false };
|
|
65432
66173
|
};
|
|
65433
66174
|
const handleMessage = async (params, _extra) => {
|
|
65434
66175
|
const message = params.content.filter(
|
|
@@ -66375,13 +67116,21 @@ const App = () => {
|
|
|
66375
67116
|
tools: null,
|
|
66376
67117
|
tasks: null
|
|
66377
67118
|
});
|
|
66378
|
-
const [command, setCommand] = reactExports.useState(
|
|
66379
|
-
|
|
66380
|
-
|
|
66381
|
-
const [
|
|
67119
|
+
const [command, setCommand] = reactExports.useState(
|
|
67120
|
+
() => getOAuthCallbackSnapshot()?.command ?? getInitialCommand()
|
|
67121
|
+
);
|
|
67122
|
+
const [args, setArgs] = reactExports.useState(
|
|
67123
|
+
() => getOAuthCallbackSnapshot()?.args ?? getInitialArgs()
|
|
67124
|
+
);
|
|
67125
|
+
const [sseUrl, setSseUrl] = reactExports.useState(
|
|
67126
|
+
() => getOAuthCallbackSnapshot()?.serverUrl ?? getInitialSseUrl()
|
|
67127
|
+
);
|
|
67128
|
+
const [transportType, setTransportType] = reactExports.useState(
|
|
67129
|
+
() => getOAuthCallbackSnapshot()?.transportType ?? getInitialTransportType()
|
|
67130
|
+
);
|
|
66382
67131
|
const [connectionType, setConnectionType] = reactExports.useState(
|
|
66383
67132
|
() => {
|
|
66384
|
-
return localStorage.getItem("lastConnectionType") || "proxy";
|
|
67133
|
+
return getOAuthCallbackSnapshot()?.connectionType ?? (localStorage.getItem("lastConnectionType") || "proxy");
|
|
66385
67134
|
}
|
|
66386
67135
|
);
|
|
66387
67136
|
const [logLevel, setLogLevel] = reactExports.useState("debug");
|
|
@@ -66702,11 +67451,21 @@ const App = () => {
|
|
|
66702
67451
|
}, [config2]);
|
|
66703
67452
|
const onOAuthConnect = reactExports.useCallback(
|
|
66704
67453
|
(serverUrl) => {
|
|
67454
|
+
const refusal = getOAuthReconnectRefusal(readOAuthConnectionSnapshot(), {
|
|
67455
|
+
authorizedServerUrl: serverUrl,
|
|
67456
|
+
sseUrl,
|
|
67457
|
+
transportType,
|
|
67458
|
+
connectionType,
|
|
67459
|
+
proxyAddress: getMCPProxyAddress(config2)
|
|
67460
|
+
});
|
|
67461
|
+
clearOAuthConnectionSnapshot();
|
|
67462
|
+
if (refusal) return refusal;
|
|
66705
67463
|
setSseUrl(serverUrl);
|
|
66706
67464
|
setIsAuthDebuggerVisible(false);
|
|
66707
67465
|
void connectMcpServer();
|
|
67466
|
+
return void 0;
|
|
66708
67467
|
},
|
|
66709
|
-
[connectMcpServer]
|
|
67468
|
+
[connectMcpServer, sseUrl, transportType, connectionType, config2]
|
|
66710
67469
|
);
|
|
66711
67470
|
const onOAuthDebugConnect = reactExports.useCallback(
|
|
66712
67471
|
async ({
|
|
@@ -67292,15 +68051,15 @@ const App = () => {
|
|
|
67292
68051
|
connectionType
|
|
67293
68052
|
}
|
|
67294
68053
|
) });
|
|
67295
|
-
if (window.location.pathname ===
|
|
68054
|
+
if (window.location.pathname === OAUTH_CALLBACK_PATH) {
|
|
67296
68055
|
const OAuthCallback = React.lazy(
|
|
67297
|
-
() => __vitePreload(() => import("./OAuthCallback-
|
|
68056
|
+
() => __vitePreload(() => import("./OAuthCallback-jbB02Bt3.js"), true ? [] : void 0)
|
|
67298
68057
|
);
|
|
67299
68058
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(OAuthCallback, { onConnect: onOAuthConnect }) });
|
|
67300
68059
|
}
|
|
67301
|
-
if (window.location.pathname ===
|
|
68060
|
+
if (window.location.pathname === OAUTH_DEBUG_CALLBACK_PATH) {
|
|
67302
68061
|
const OAuthDebugCallback = React.lazy(
|
|
67303
|
-
() => __vitePreload(() => import("./OAuthDebugCallback-
|
|
68062
|
+
() => __vitePreload(() => import("./OAuthDebugCallback-VeJ8bP3s.js"), true ? [] : void 0)
|
|
67304
68063
|
);
|
|
67305
68064
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(OAuthDebugCallback, { onConnect: onOAuthDebugConnect }) });
|
|
67306
68065
|
}
|
|
@@ -67771,6 +68530,7 @@ export {
|
|
|
67771
68530
|
InspectorOAuthClientProvider as I,
|
|
67772
68531
|
SESSION_KEYS as S,
|
|
67773
68532
|
auth as a,
|
|
68533
|
+
clearOAuthConnectionSnapshot as c,
|
|
67774
68534
|
generateOAuthErrorDescription as g,
|
|
67775
68535
|
jsxRuntimeExports as j,
|
|
67776
68536
|
parseOAuthCallbackParams as p,
|