@tonyclaw/llm-inspector 1.10.0 → 1.11.0
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/.output/nitro.json +1 -1
- package/.output/public/assets/index-BIZeMR5N.js +105 -0
- package/.output/public/assets/index-SmtLx1lM.css +1 -0
- package/.output/public/assets/main-QfbQ5oBP.js +17 -0
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +1 -1
- package/.output/server/_libs/ajv-formats.mjs +18 -18
- package/.output/server/_libs/ajv.mjs +6306 -942
- package/.output/server/_libs/cookie-es.mjs +21 -7
- package/.output/server/_libs/diff.mjs +320 -0
- package/.output/server/_libs/floating-ui__core.mjs +17 -18
- package/.output/server/_libs/floating-ui__dom.mjs +20 -24
- package/.output/server/_libs/floating-ui__react-dom.mjs +28 -55
- package/.output/server/_libs/floating-ui__utils.mjs +36 -36
- package/.output/server/_libs/h3-v2.mjs +9 -20
- package/.output/server/_libs/isbot.mjs +2 -3
- package/.output/server/_libs/json-schema-traverse.mjs +90 -1
- package/.output/server/_libs/jszip.mjs +28 -28
- package/.output/server/_libs/lucide-react.mjs +103 -80
- package/.output/server/_libs/mdast-util-from-markdown.mjs +1 -1
- package/.output/server/_libs/pako.mjs +13 -13
- package/.output/server/_libs/property-information.mjs +1 -13
- package/.output/server/_libs/radix-ui__react-collection.mjs +1 -1
- package/.output/server/_libs/radix-ui__react-id.mjs +1 -1
- package/.output/server/_libs/react-dom.mjs +10 -10
- package/.output/server/_libs/react.mjs +44 -44
- package/.output/server/_libs/readable-stream.mjs +15 -15
- package/.output/server/_libs/rou3.mjs +7 -1
- package/.output/server/_libs/safe-buffer.mjs +3 -3
- package/.output/server/_libs/semver.mjs +10 -10
- package/.output/server/_libs/seroval-plugins.mjs +5 -5
- package/.output/server/_libs/seroval.mjs +596 -606
- package/.output/server/_libs/srvx.mjs +245 -10
- package/.output/server/_libs/swr.mjs +1 -1
- package/.output/server/_libs/tailwind-merge.mjs +41 -286
- package/.output/server/_libs/tanstack__history.mjs +44 -31
- package/.output/server/_libs/tanstack__react-router.mjs +1089 -780
- package/.output/server/_libs/tanstack__react-store.mjs +1 -1
- package/.output/server/_libs/tanstack__react-virtual.mjs +7 -82
- package/.output/server/_libs/tanstack__router-core.mjs +2331 -2226
- package/.output/server/_libs/tanstack__virtual-core.mjs +17 -58
- package/.output/server/_libs/tiny-invariant.mjs +12 -0
- package/.output/server/_libs/tiny-warning.mjs +5 -0
- package/.output/server/_libs/ungap__structured-clone.mjs +2 -14
- package/.output/server/_libs/use-sync-external-store.mjs +1 -1
- package/.output/server/_libs/zod.mjs +207 -505
- package/.output/server/_ssr/{index-XyU4WVWt.mjs → index-I_Nx8QEB.mjs} +532 -79
- package/.output/server/_ssr/index.mjs +776 -1098
- package/.output/server/_ssr/{router-BR4XO8XJ.mjs → router-BVxfVFsb.mjs} +98 -53
- package/.output/server/_tanstack-start-manifest_v-Cm2Owszu.mjs +4 -0
- package/.output/server/index.mjs +28 -28
- package/README.md +1 -1
- package/package.json +2 -1
- package/src/components/ProxyViewer.tsx +10 -3
- package/src/components/ProxyViewerContainer.tsx +6 -0
- package/src/components/proxy-viewer/ConversationGroup.tsx +10 -1
- package/src/components/proxy-viewer/LogEntry.tsx +114 -5
- package/src/components/proxy-viewer/diff/DiffView.tsx +319 -0
- package/src/components/proxy-viewer/diff/computeDiff.ts +178 -0
- package/src/components/proxy-viewer/diff/index.ts +3 -0
- package/src/components/ui/crab-logo.tsx +45 -0
- package/src/proxy/config.ts +3 -17
- package/src/proxy/dataDir.ts +56 -0
- package/src/proxy/formats/anthropic/stream.ts +5 -2
- package/src/proxy/formats/jsonSchema.ts +12 -0
- package/src/proxy/formats/openai/stream.ts +21 -16
- package/src/proxy/handler.ts +15 -5
- package/src/proxy/providers.ts +61 -1
- package/src/proxy/schemas.ts +42 -0
- package/src/proxy/store.ts +6 -23
- package/.output/public/assets/index-BFuUQkWu.js +0 -11
- package/.output/public/assets/index-F2ojFPJp.css +0 -1
- package/.output/public/assets/index-nKnhyW4Y.js +0 -122
- package/.output/server/_ssr/empty-plugin-adapters-BFgPZ6_d.mjs +0 -6
- package/.output/server/_tanstack-start-manifest_v-DFoSjBkb.mjs +0 -4
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
function splitSetCookieString(cookiesString) {
|
|
2
|
-
if (Array.isArray(cookiesString))
|
|
3
|
-
|
|
2
|
+
if (Array.isArray(cookiesString)) {
|
|
3
|
+
return cookiesString.flatMap((c) => splitSetCookieString(c));
|
|
4
|
+
}
|
|
5
|
+
if (typeof cookiesString !== "string") {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
4
8
|
const cookiesStrings = [];
|
|
5
9
|
let pos = 0;
|
|
6
10
|
let start;
|
|
@@ -9,7 +13,9 @@ function splitSetCookieString(cookiesString) {
|
|
|
9
13
|
let nextStart;
|
|
10
14
|
let cookiesSeparatorFound;
|
|
11
15
|
const skipWhitespace = () => {
|
|
12
|
-
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos)))
|
|
16
|
+
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
17
|
+
pos += 1;
|
|
18
|
+
}
|
|
13
19
|
return pos < cookiesString.length;
|
|
14
20
|
};
|
|
15
21
|
const notSpecialChar = () => {
|
|
@@ -26,16 +32,24 @@ function splitSetCookieString(cookiesString) {
|
|
|
26
32
|
pos += 1;
|
|
27
33
|
skipWhitespace();
|
|
28
34
|
nextStart = pos;
|
|
29
|
-
while (pos < cookiesString.length && notSpecialChar())
|
|
35
|
+
while (pos < cookiesString.length && notSpecialChar()) {
|
|
36
|
+
pos += 1;
|
|
37
|
+
}
|
|
30
38
|
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
31
39
|
cookiesSeparatorFound = true;
|
|
32
40
|
pos = nextStart;
|
|
33
41
|
cookiesStrings.push(cookiesString.slice(start, lastComma));
|
|
34
42
|
start = pos;
|
|
35
|
-
} else
|
|
36
|
-
|
|
43
|
+
} else {
|
|
44
|
+
pos = lastComma + 1;
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
pos += 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
51
|
+
cookiesStrings.push(cookiesString.slice(start));
|
|
37
52
|
}
|
|
38
|
-
if (!cookiesSeparatorFound || pos >= cookiesString.length) cookiesStrings.push(cookiesString.slice(start));
|
|
39
53
|
}
|
|
40
54
|
return cookiesStrings;
|
|
41
55
|
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
class Diff {
|
|
2
|
+
diff(oldStr, newStr, options = {}) {
|
|
3
|
+
let callback;
|
|
4
|
+
if (typeof options === "function") {
|
|
5
|
+
callback = options;
|
|
6
|
+
options = {};
|
|
7
|
+
} else if ("callback" in options) {
|
|
8
|
+
callback = options.callback;
|
|
9
|
+
}
|
|
10
|
+
const oldString = this.castInput(oldStr, options);
|
|
11
|
+
const newString = this.castInput(newStr, options);
|
|
12
|
+
const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
|
|
13
|
+
const newTokens = this.removeEmpty(this.tokenize(newString, options));
|
|
14
|
+
return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
|
|
15
|
+
}
|
|
16
|
+
diffWithOptionsObj(oldTokens, newTokens, options, callback) {
|
|
17
|
+
var _a;
|
|
18
|
+
const done = (value) => {
|
|
19
|
+
value = this.postProcess(value, options);
|
|
20
|
+
if (callback) {
|
|
21
|
+
setTimeout(function() {
|
|
22
|
+
callback(value);
|
|
23
|
+
}, 0);
|
|
24
|
+
return void 0;
|
|
25
|
+
} else {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
30
|
+
let editLength = 1;
|
|
31
|
+
let maxEditLength = newLen + oldLen;
|
|
32
|
+
if (options.maxEditLength != null) {
|
|
33
|
+
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
34
|
+
}
|
|
35
|
+
const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
|
|
36
|
+
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
37
|
+
const bestPath = [{ oldPos: -1, lastComponent: void 0 }];
|
|
38
|
+
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
|
|
39
|
+
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
40
|
+
return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
|
|
41
|
+
}
|
|
42
|
+
let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
43
|
+
const execEditLength = () => {
|
|
44
|
+
for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
45
|
+
let basePath;
|
|
46
|
+
const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
47
|
+
if (removePath) {
|
|
48
|
+
bestPath[diagonalPath - 1] = void 0;
|
|
49
|
+
}
|
|
50
|
+
let canAdd = false;
|
|
51
|
+
if (addPath) {
|
|
52
|
+
const addPathNewPos = addPath.oldPos - diagonalPath;
|
|
53
|
+
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
54
|
+
}
|
|
55
|
+
const canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
56
|
+
if (!canAdd && !canRemove) {
|
|
57
|
+
bestPath[diagonalPath] = void 0;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
61
|
+
basePath = this.addToPath(addPath, true, false, 0, options);
|
|
62
|
+
} else {
|
|
63
|
+
basePath = this.addToPath(removePath, false, true, 1, options);
|
|
64
|
+
}
|
|
65
|
+
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
|
|
66
|
+
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
67
|
+
return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
|
|
68
|
+
} else {
|
|
69
|
+
bestPath[diagonalPath] = basePath;
|
|
70
|
+
if (basePath.oldPos + 1 >= oldLen) {
|
|
71
|
+
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
72
|
+
}
|
|
73
|
+
if (newPos + 1 >= newLen) {
|
|
74
|
+
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
editLength++;
|
|
79
|
+
};
|
|
80
|
+
if (callback) {
|
|
81
|
+
(function exec() {
|
|
82
|
+
setTimeout(function() {
|
|
83
|
+
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
84
|
+
return callback(void 0);
|
|
85
|
+
}
|
|
86
|
+
if (!execEditLength()) {
|
|
87
|
+
exec();
|
|
88
|
+
}
|
|
89
|
+
}, 0);
|
|
90
|
+
})();
|
|
91
|
+
} else {
|
|
92
|
+
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
93
|
+
const ret = execEditLength();
|
|
94
|
+
if (ret) {
|
|
95
|
+
return ret;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
addToPath(path, added, removed, oldPosInc, options) {
|
|
101
|
+
const last = path.lastComponent;
|
|
102
|
+
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
103
|
+
return {
|
|
104
|
+
oldPos: path.oldPos + oldPosInc,
|
|
105
|
+
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
106
|
+
};
|
|
107
|
+
} else {
|
|
108
|
+
return {
|
|
109
|
+
oldPos: path.oldPos + oldPosInc,
|
|
110
|
+
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
|
|
115
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
116
|
+
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
117
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
|
|
118
|
+
newPos++;
|
|
119
|
+
oldPos++;
|
|
120
|
+
commonCount++;
|
|
121
|
+
if (options.oneChangePerToken) {
|
|
122
|
+
basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (commonCount && !options.oneChangePerToken) {
|
|
126
|
+
basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
127
|
+
}
|
|
128
|
+
basePath.oldPos = oldPos;
|
|
129
|
+
return newPos;
|
|
130
|
+
}
|
|
131
|
+
equals(left, right, options) {
|
|
132
|
+
if (options.comparator) {
|
|
133
|
+
return options.comparator(left, right);
|
|
134
|
+
} else {
|
|
135
|
+
return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
removeEmpty(array) {
|
|
139
|
+
const ret = [];
|
|
140
|
+
for (let i = 0; i < array.length; i++) {
|
|
141
|
+
if (array[i]) {
|
|
142
|
+
ret.push(array[i]);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return ret;
|
|
146
|
+
}
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
148
|
+
castInput(value, options) {
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
152
|
+
tokenize(value, options) {
|
|
153
|
+
return Array.from(value);
|
|
154
|
+
}
|
|
155
|
+
join(chars) {
|
|
156
|
+
return chars.join("");
|
|
157
|
+
}
|
|
158
|
+
postProcess(changeObjects, options) {
|
|
159
|
+
return changeObjects;
|
|
160
|
+
}
|
|
161
|
+
get useLongestToken() {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
buildValues(lastComponent, newTokens, oldTokens) {
|
|
165
|
+
const components = [];
|
|
166
|
+
let nextComponent;
|
|
167
|
+
while (lastComponent) {
|
|
168
|
+
components.push(lastComponent);
|
|
169
|
+
nextComponent = lastComponent.previousComponent;
|
|
170
|
+
delete lastComponent.previousComponent;
|
|
171
|
+
lastComponent = nextComponent;
|
|
172
|
+
}
|
|
173
|
+
components.reverse();
|
|
174
|
+
const componentLen = components.length;
|
|
175
|
+
let componentPos = 0, newPos = 0, oldPos = 0;
|
|
176
|
+
for (; componentPos < componentLen; componentPos++) {
|
|
177
|
+
const component = components[componentPos];
|
|
178
|
+
if (!component.removed) {
|
|
179
|
+
if (!component.added && this.useLongestToken) {
|
|
180
|
+
let value = newTokens.slice(newPos, newPos + component.count);
|
|
181
|
+
value = value.map(function(value2, i) {
|
|
182
|
+
const oldValue = oldTokens[oldPos + i];
|
|
183
|
+
return oldValue.length > value2.length ? oldValue : value2;
|
|
184
|
+
});
|
|
185
|
+
component.value = this.join(value);
|
|
186
|
+
} else {
|
|
187
|
+
component.value = this.join(newTokens.slice(newPos, newPos + component.count));
|
|
188
|
+
}
|
|
189
|
+
newPos += component.count;
|
|
190
|
+
if (!component.added) {
|
|
191
|
+
oldPos += component.count;
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
|
|
195
|
+
oldPos += component.count;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return components;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
class LineDiff extends Diff {
|
|
202
|
+
constructor() {
|
|
203
|
+
super(...arguments);
|
|
204
|
+
this.tokenize = tokenize;
|
|
205
|
+
}
|
|
206
|
+
equals(left, right, options) {
|
|
207
|
+
if (options.ignoreWhitespace) {
|
|
208
|
+
if (!options.newlineIsToken || !left.includes("\n")) {
|
|
209
|
+
left = left.trim();
|
|
210
|
+
}
|
|
211
|
+
if (!options.newlineIsToken || !right.includes("\n")) {
|
|
212
|
+
right = right.trim();
|
|
213
|
+
}
|
|
214
|
+
} else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
215
|
+
if (left.endsWith("\n")) {
|
|
216
|
+
left = left.slice(0, -1);
|
|
217
|
+
}
|
|
218
|
+
if (right.endsWith("\n")) {
|
|
219
|
+
right = right.slice(0, -1);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return super.equals(left, right, options);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const lineDiff = new LineDiff();
|
|
226
|
+
function diffLines(oldStr, newStr, options) {
|
|
227
|
+
return lineDiff.diff(oldStr, newStr, options);
|
|
228
|
+
}
|
|
229
|
+
function tokenize(value, options) {
|
|
230
|
+
if (options.stripTrailingCr) {
|
|
231
|
+
value = value.replace(/\r\n/g, "\n");
|
|
232
|
+
}
|
|
233
|
+
const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
234
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
235
|
+
linesAndNewlines.pop();
|
|
236
|
+
}
|
|
237
|
+
for (let i = 0; i < linesAndNewlines.length; i++) {
|
|
238
|
+
const line = linesAndNewlines[i];
|
|
239
|
+
if (i % 2 && !options.newlineIsToken) {
|
|
240
|
+
retLines[retLines.length - 1] += line;
|
|
241
|
+
} else {
|
|
242
|
+
retLines.push(line);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return retLines;
|
|
246
|
+
}
|
|
247
|
+
class JsonDiff extends Diff {
|
|
248
|
+
constructor() {
|
|
249
|
+
super(...arguments);
|
|
250
|
+
this.tokenize = tokenize;
|
|
251
|
+
}
|
|
252
|
+
get useLongestToken() {
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
castInput(value, options) {
|
|
256
|
+
const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options;
|
|
257
|
+
return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, " ");
|
|
258
|
+
}
|
|
259
|
+
equals(left, right, options) {
|
|
260
|
+
return super.equals(left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"), options);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const jsonDiff = new JsonDiff();
|
|
264
|
+
function diffJson(oldStr, newStr, options) {
|
|
265
|
+
return jsonDiff.diff(oldStr, newStr, options);
|
|
266
|
+
}
|
|
267
|
+
function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
268
|
+
stack = stack || [];
|
|
269
|
+
replacementStack = replacementStack || [];
|
|
270
|
+
if (replacer) {
|
|
271
|
+
obj = replacer(key === void 0 ? "" : key, obj);
|
|
272
|
+
}
|
|
273
|
+
let i;
|
|
274
|
+
for (i = 0; i < stack.length; i += 1) {
|
|
275
|
+
if (stack[i] === obj) {
|
|
276
|
+
return replacementStack[i];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
let canonicalizedObj;
|
|
280
|
+
if ("[object Array]" === Object.prototype.toString.call(obj)) {
|
|
281
|
+
stack.push(obj);
|
|
282
|
+
canonicalizedObj = new Array(obj.length);
|
|
283
|
+
replacementStack.push(canonicalizedObj);
|
|
284
|
+
for (i = 0; i < obj.length; i += 1) {
|
|
285
|
+
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
|
|
286
|
+
}
|
|
287
|
+
stack.pop();
|
|
288
|
+
replacementStack.pop();
|
|
289
|
+
return canonicalizedObj;
|
|
290
|
+
}
|
|
291
|
+
if (obj && obj.toJSON) {
|
|
292
|
+
obj = obj.toJSON();
|
|
293
|
+
}
|
|
294
|
+
if (typeof obj === "object" && obj !== null) {
|
|
295
|
+
stack.push(obj);
|
|
296
|
+
canonicalizedObj = {};
|
|
297
|
+
replacementStack.push(canonicalizedObj);
|
|
298
|
+
const sortedKeys = [];
|
|
299
|
+
let key2;
|
|
300
|
+
for (key2 in obj) {
|
|
301
|
+
if (Object.prototype.hasOwnProperty.call(obj, key2)) {
|
|
302
|
+
sortedKeys.push(key2);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
sortedKeys.sort();
|
|
306
|
+
for (i = 0; i < sortedKeys.length; i += 1) {
|
|
307
|
+
key2 = sortedKeys[i];
|
|
308
|
+
canonicalizedObj[key2] = canonicalize(obj[key2], stack, replacementStack, replacer, key2);
|
|
309
|
+
}
|
|
310
|
+
stack.pop();
|
|
311
|
+
replacementStack.pop();
|
|
312
|
+
} else {
|
|
313
|
+
canonicalizedObj = obj;
|
|
314
|
+
}
|
|
315
|
+
return canonicalizedObj;
|
|
316
|
+
}
|
|
317
|
+
export {
|
|
318
|
+
diffJson as a,
|
|
319
|
+
diffLines as d
|
|
320
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getSideAxis, a as getAlignmentAxis, b as getSide, c as getAlignment, e as evaluate, d as getPaddingObject, r as rectToClientRect, f as
|
|
1
|
+
import { g as getSideAxis, a as getAlignmentAxis, b as getSide, c as getAlignment, e as evaluate, d as getPaddingObject, r as rectToClientRect, f as clamp, h as getOppositePlacement, i as getExpandedPlacements, j as getOppositeAxisPlacements, k as getAlignmentSides, m as min, l as max, n as getAxisLength, o as getOppositeAxis, s as sides } from "./floating-ui__utils.mjs";
|
|
2
2
|
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
3
3
|
let {
|
|
4
4
|
reference,
|
|
@@ -110,7 +110,6 @@ async function detectOverflow(state, options) {
|
|
|
110
110
|
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
const MAX_RESET_COUNT = 50;
|
|
114
113
|
const computePosition = async (reference, floating, config) => {
|
|
115
114
|
const {
|
|
116
115
|
placement = "bottom",
|
|
@@ -118,10 +117,7 @@ const computePosition = async (reference, floating, config) => {
|
|
|
118
117
|
middleware = [],
|
|
119
118
|
platform
|
|
120
119
|
} = config;
|
|
121
|
-
const
|
|
122
|
-
...platform,
|
|
123
|
-
detectOverflow
|
|
124
|
-
};
|
|
120
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
125
121
|
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
126
122
|
let rects = await platform.getElementRects({
|
|
127
123
|
reference,
|
|
@@ -133,17 +129,14 @@ const computePosition = async (reference, floating, config) => {
|
|
|
133
129
|
y
|
|
134
130
|
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
135
131
|
let statefulPlacement = placement;
|
|
132
|
+
let middlewareData = {};
|
|
136
133
|
let resetCount = 0;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const currentMiddleware = middleware[i];
|
|
140
|
-
if (!currentMiddleware) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
134
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
135
|
+
var _platform$detectOverf;
|
|
143
136
|
const {
|
|
144
137
|
name,
|
|
145
138
|
fn
|
|
146
|
-
} =
|
|
139
|
+
} = validMiddleware[i];
|
|
147
140
|
const {
|
|
148
141
|
x: nextX,
|
|
149
142
|
y: nextY,
|
|
@@ -157,7 +150,10 @@ const computePosition = async (reference, floating, config) => {
|
|
|
157
150
|
strategy,
|
|
158
151
|
middlewareData,
|
|
159
152
|
rects,
|
|
160
|
-
platform:
|
|
153
|
+
platform: {
|
|
154
|
+
...platform,
|
|
155
|
+
detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
|
|
156
|
+
},
|
|
161
157
|
elements: {
|
|
162
158
|
reference,
|
|
163
159
|
floating
|
|
@@ -165,11 +161,14 @@ const computePosition = async (reference, floating, config) => {
|
|
|
165
161
|
});
|
|
166
162
|
x = nextX != null ? nextX : x;
|
|
167
163
|
y = nextY != null ? nextY : y;
|
|
168
|
-
middlewareData
|
|
169
|
-
...middlewareData
|
|
170
|
-
|
|
164
|
+
middlewareData = {
|
|
165
|
+
...middlewareData,
|
|
166
|
+
[name]: {
|
|
167
|
+
...middlewareData[name],
|
|
168
|
+
...data
|
|
169
|
+
}
|
|
171
170
|
};
|
|
172
|
-
if (reset && resetCount
|
|
171
|
+
if (reset && resetCount <= 50) {
|
|
173
172
|
resetCount++;
|
|
174
173
|
if (typeof reset === "object") {
|
|
175
174
|
if (reset.placement) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as computePosition$1, o as offset$1, s as shift$1, f as flip$1, a as size$1, h as hide$1, b as arrow$1, l as limitShift$1 } from "./floating-ui__core.mjs";
|
|
2
|
-
import { p as isElement, q as getDocumentElement, t as getOverflowAncestors, u as getComputedStyle$1, v as isHTMLElement, w as createCoords, x as round, y as getWindow, z as isTopLayer, A as getParentNode, B as isLastTraversableNode, C as isTableElement, D as isContainingBlock, E as getContainingBlock,
|
|
2
|
+
import { p as isElement, q as getDocumentElement, t as getOverflowAncestors, u as getComputedStyle$1, v as isHTMLElement, w as createCoords, x as round, y as getWindow, z as isTopLayer, A as getParentNode, B as isLastTraversableNode, C as isTableElement, D as isContainingBlock, E as getContainingBlock, l as max, m as min, F as getNodeName, G as isOverflowElement, H as getNodeScroll, I as getFrameElement, r as rectToClientRect, J as floor, K as isWebKit } from "./floating-ui__utils.mjs";
|
|
3
3
|
function getCssDimensions(element) {
|
|
4
4
|
const css = getComputedStyle$1(element);
|
|
5
5
|
let width = parseFloat(css.width) || 0;
|
|
@@ -157,7 +157,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
|
157
157
|
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
158
158
|
scroll = getNodeScroll(offsetParent);
|
|
159
159
|
}
|
|
160
|
-
if (
|
|
160
|
+
if (isHTMLElement(offsetParent)) {
|
|
161
161
|
const offsetRect = getBoundingClientRect(offsetParent);
|
|
162
162
|
scale = getScale(offsetParent);
|
|
163
163
|
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
@@ -231,6 +231,7 @@ function getViewportRect(element, strategy) {
|
|
|
231
231
|
y
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
+
const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
234
235
|
function getInnerBoundingClientRect(element, strategy) {
|
|
235
236
|
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
236
237
|
const top = clientRect.top + element.clientTop;
|
|
@@ -288,7 +289,7 @@ function getClippingElementAncestors(element, cache) {
|
|
|
288
289
|
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
289
290
|
currentContainingBlockComputedStyle = null;
|
|
290
291
|
}
|
|
291
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position
|
|
292
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
292
293
|
if (shouldDropCurrentNode) {
|
|
293
294
|
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
294
295
|
} else {
|
|
@@ -308,23 +309,20 @@ function getClippingRect(_ref) {
|
|
|
308
309
|
} = _ref;
|
|
309
310
|
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
310
311
|
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
bottom = min(rect.bottom, bottom);
|
|
321
|
-
left = max(rect.left, left);
|
|
322
|
-
}
|
|
312
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
313
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
314
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
315
|
+
accRect.top = max(rect.top, accRect.top);
|
|
316
|
+
accRect.right = min(rect.right, accRect.right);
|
|
317
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
318
|
+
accRect.left = max(rect.left, accRect.left);
|
|
319
|
+
return accRect;
|
|
320
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
323
321
|
return {
|
|
324
|
-
width: right - left,
|
|
325
|
-
height: bottom - top,
|
|
326
|
-
x: left,
|
|
327
|
-
y: top
|
|
322
|
+
width: clippingRect.right - clippingRect.left,
|
|
323
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
324
|
+
x: clippingRect.left,
|
|
325
|
+
y: clippingRect.top
|
|
328
326
|
};
|
|
329
327
|
}
|
|
330
328
|
function getDimensions(element) {
|
|
@@ -533,7 +531,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
533
531
|
animationFrame = false
|
|
534
532
|
} = options;
|
|
535
533
|
const referenceEl = unwrapElement(reference);
|
|
536
|
-
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...
|
|
534
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
537
535
|
ancestors.forEach((ancestor) => {
|
|
538
536
|
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
539
537
|
passive: true
|
|
@@ -546,7 +544,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
546
544
|
if (elementResize) {
|
|
547
545
|
resizeObserver = new ResizeObserver((_ref) => {
|
|
548
546
|
let [firstEntry] = _ref;
|
|
549
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver
|
|
547
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
550
548
|
resizeObserver.unobserve(floating);
|
|
551
549
|
cancelAnimationFrame(reobserveFrame);
|
|
552
550
|
reobserveFrame = requestAnimationFrame(() => {
|
|
@@ -559,9 +557,7 @@ function autoUpdate(reference, floating, update, options) {
|
|
|
559
557
|
if (referenceEl && !animationFrame) {
|
|
560
558
|
resizeObserver.observe(referenceEl);
|
|
561
559
|
}
|
|
562
|
-
|
|
563
|
-
resizeObserver.observe(floating);
|
|
564
|
-
}
|
|
560
|
+
resizeObserver.observe(floating);
|
|
565
561
|
}
|
|
566
562
|
let frameId;
|
|
567
563
|
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
@@ -252,61 +252,34 @@ const arrow$1 = (options) => {
|
|
|
252
252
|
}
|
|
253
253
|
};
|
|
254
254
|
};
|
|
255
|
-
const offset = (options, deps) => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
};
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
};
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
options: [options, deps]
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
const size = (options, deps) => {
|
|
287
|
-
const result = size$1(options);
|
|
288
|
-
return {
|
|
289
|
-
name: result.name,
|
|
290
|
-
fn: result.fn,
|
|
291
|
-
options: [options, deps]
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
const hide = (options, deps) => {
|
|
295
|
-
const result = hide$1(options);
|
|
296
|
-
return {
|
|
297
|
-
name: result.name,
|
|
298
|
-
fn: result.fn,
|
|
299
|
-
options: [options, deps]
|
|
300
|
-
};
|
|
301
|
-
};
|
|
302
|
-
const arrow = (options, deps) => {
|
|
303
|
-
const result = arrow$1(options);
|
|
304
|
-
return {
|
|
305
|
-
name: result.name,
|
|
306
|
-
fn: result.fn,
|
|
307
|
-
options: [options, deps]
|
|
308
|
-
};
|
|
309
|
-
};
|
|
255
|
+
const offset = (options, deps) => ({
|
|
256
|
+
...offset$1(options),
|
|
257
|
+
options: [options, deps]
|
|
258
|
+
});
|
|
259
|
+
const shift = (options, deps) => ({
|
|
260
|
+
...shift$1(options),
|
|
261
|
+
options: [options, deps]
|
|
262
|
+
});
|
|
263
|
+
const limitShift = (options, deps) => ({
|
|
264
|
+
...limitShift$1(options),
|
|
265
|
+
options: [options, deps]
|
|
266
|
+
});
|
|
267
|
+
const flip = (options, deps) => ({
|
|
268
|
+
...flip$1(options),
|
|
269
|
+
options: [options, deps]
|
|
270
|
+
});
|
|
271
|
+
const size = (options, deps) => ({
|
|
272
|
+
...size$1(options),
|
|
273
|
+
options: [options, deps]
|
|
274
|
+
});
|
|
275
|
+
const hide = (options, deps) => ({
|
|
276
|
+
...hide$1(options),
|
|
277
|
+
options: [options, deps]
|
|
278
|
+
});
|
|
279
|
+
const arrow = (options, deps) => ({
|
|
280
|
+
...arrow$1(options),
|
|
281
|
+
options: [options, deps]
|
|
282
|
+
});
|
|
310
283
|
export {
|
|
311
284
|
size as a,
|
|
312
285
|
arrow as b,
|