@outcode/bug-reporter-native 0.1.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/dist/index.mjs ADDED
@@ -0,0 +1,786 @@
1
+ import React2, { createContext, useRef, useState, useEffect, useCallback, useContext, useMemo } from 'react';
2
+ import { StyleSheet, View, ScrollView, TouchableOpacity, Image, Dimensions, PanResponder, Modal, Text, TextInput, ActivityIndicator, Animated, Easing, Platform, InteractionManager, PixelRatio, Appearance } from 'react-native';
3
+ import Svg3, { Path, Polyline, Rect, G, Line, Circle } from 'react-native-svg';
4
+ import { ANNOTATION_TOOLS, ANNOTATION_COLORS, SEVERITIES, REPORT_TYPES, resolveTheme, getReportQueue, normalizeContext, submitReport } from '@outcode/bug-reporter-core';
5
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
+ import { captureRef, captureScreen } from 'react-native-view-shot';
7
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
+
9
+ // src/BugReporterButton.tsx
10
+ function AnnotateToolbar({ t, tool, color, onTool, onColor, onUndo }) {
11
+ return /* @__PURE__ */ jsx(
12
+ View,
13
+ {
14
+ style: [
15
+ styles.bar,
16
+ { backgroundColor: t.panel, borderColor: t.border, shadowColor: "#000" }
17
+ ],
18
+ children: /* @__PURE__ */ jsxs(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.row, children: [
19
+ ANNOTATION_TOOLS.map((tl) => {
20
+ const active = tool === tl.id;
21
+ return /* @__PURE__ */ jsx(
22
+ TouchableOpacity,
23
+ {
24
+ onPress: () => onTool(tl.id),
25
+ style: [styles.iconBtn, { backgroundColor: active ? t.ring : "transparent" }],
26
+ children: /* @__PURE__ */ jsx(Svg3, { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: tl.iconPath, stroke: active ? t.accent : t.muted, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }) })
27
+ },
28
+ tl.id
29
+ );
30
+ }),
31
+ /* @__PURE__ */ jsx(View, { style: [styles.divider, { backgroundColor: t.border }] }),
32
+ ANNOTATION_COLORS.map((c) => {
33
+ const active = color === c;
34
+ return /* @__PURE__ */ jsx(
35
+ TouchableOpacity,
36
+ {
37
+ onPress: () => onColor(c),
38
+ style: {
39
+ width: active ? 22 : 20,
40
+ height: active ? 22 : 20,
41
+ borderRadius: 11,
42
+ marginHorizontal: 3,
43
+ backgroundColor: c,
44
+ borderWidth: 2,
45
+ borderColor: active ? t.accent : t.border
46
+ }
47
+ },
48
+ c
49
+ );
50
+ }),
51
+ /* @__PURE__ */ jsx(View, { style: [styles.divider, { backgroundColor: t.border }] }),
52
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: onUndo, style: styles.iconBtn, children: /* @__PURE__ */ jsx(Svg3, { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: "M9 14L4 9l5-5M4 9h11a5 5 0 010 10h-3", stroke: t.muted, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }) }) })
53
+ ] })
54
+ }
55
+ );
56
+ }
57
+ var styles = StyleSheet.create({
58
+ bar: {
59
+ borderWidth: 1,
60
+ borderRadius: 14,
61
+ paddingVertical: 7,
62
+ paddingHorizontal: 7,
63
+ shadowOffset: { width: 0, height: 12 },
64
+ shadowOpacity: 0.28,
65
+ shadowRadius: 24,
66
+ elevation: 10
67
+ },
68
+ row: { flexDirection: "row", alignItems: "center", gap: 2 },
69
+ iconBtn: { width: 36, height: 36, borderRadius: 10, alignItems: "center", justifyContent: "center" },
70
+ divider: { width: 1, height: 24, marginHorizontal: 6 }
71
+ });
72
+ var HEADER_H = 50;
73
+ function pointsStr(points) {
74
+ return points.map((p) => `${p.x},${p.y}`).join(" ");
75
+ }
76
+ function hitTestText(shapes, p) {
77
+ for (let i = shapes.length - 1; i >= 0; i--) {
78
+ const sh = shapes[i];
79
+ if (sh.type !== "text") continue;
80
+ const w = Math.max(48, sh.text.length * 8 + 24);
81
+ if (p.x >= sh.x - 8 && p.x <= sh.x + w && p.y >= sh.y - 20 && p.y <= sh.y + 10) return sh.id;
82
+ }
83
+ return null;
84
+ }
85
+ function AnnotateOverlay({ t, visible, src, onCancel, onContinue }) {
86
+ const insets = useSafeAreaInsets();
87
+ const stageContainerRef = useRef(null);
88
+ const idRef = useRef(0);
89
+ const [shapes, setShapes] = useState([]);
90
+ const [draft, setDraft] = useState(null);
91
+ const [tool, setTool] = useState("arrow");
92
+ const [color, setColor] = useState(ANNOTATION_COLORS[0]);
93
+ const [editingId, setEditingId] = useState(null);
94
+ const [dims, setDims] = useState({ width: 320, height: 480 });
95
+ const toolRef = useRef(tool);
96
+ const colorRef = useRef(color);
97
+ const shapesRef = useRef(shapes);
98
+ const startRef = useRef(null);
99
+ toolRef.current = tool;
100
+ colorRef.current = color;
101
+ shapesRef.current = shapes;
102
+ useEffect(() => {
103
+ if (!visible || !src) return;
104
+ Image.getSize(
105
+ src,
106
+ (w, h) => {
107
+ const win = Dimensions.get("window");
108
+ const maxW = win.width - 32;
109
+ const maxH = win.height - 230;
110
+ const aspect = w / h || 0.6;
111
+ let dw = maxW;
112
+ let dh = Math.round(maxW / aspect);
113
+ if (dh > maxH) {
114
+ dh = maxH;
115
+ dw = Math.round(maxH * aspect);
116
+ }
117
+ setDims({ width: dw, height: dh });
118
+ },
119
+ () => setDims({ width: Dimensions.get("window").width - 32, height: 480 })
120
+ );
121
+ }, [visible, src]);
122
+ const startDraw = useCallback((x, y) => {
123
+ const tl = toolRef.current;
124
+ const c = colorRef.current;
125
+ if (tl === "text") {
126
+ const hit = hitTestText(shapesRef.current, { x, y });
127
+ if (hit) {
128
+ setEditingId(hit);
129
+ return;
130
+ }
131
+ const id = `s${++idRef.current}`;
132
+ setShapes((s) => [...s, { id, type: "text", x, y, color: c, text: "" }]);
133
+ setEditingId(id);
134
+ return;
135
+ }
136
+ setEditingId(null);
137
+ startRef.current = { x, y };
138
+ setDraft(
139
+ tl === "pen" ? { id: `s${++idRef.current}`, type: "pen", color: c, points: [{ x, y }] } : { id: `s${++idRef.current}`, type: tl, color: c, x0: x, y0: y, x1: x, y1: y }
140
+ );
141
+ }, []);
142
+ const moveDraw = useCallback((x, y) => {
143
+ setDraft((prev) => {
144
+ if (!prev) return prev;
145
+ if (prev.type === "pen") return { ...prev, points: [...prev.points, { x, y }] };
146
+ if (prev.type === "text") return prev;
147
+ return { ...prev, x1: x, y1: y };
148
+ });
149
+ }, []);
150
+ const endDraw = useCallback(() => {
151
+ setDraft((d) => {
152
+ if (!d) return null;
153
+ const keep = d.type === "pen" ? d.points.length > 1 : d.type === "text" ? false : Math.abs(d.x1 - d.x0) > 5 || Math.abs(d.y1 - d.y0) > 5;
154
+ if (keep) setShapes((s) => [...s, d]);
155
+ return null;
156
+ });
157
+ startRef.current = null;
158
+ }, []);
159
+ const pan = useRef(
160
+ PanResponder.create({
161
+ onStartShouldSetPanResponder: () => true,
162
+ onMoveShouldSetPanResponder: () => true,
163
+ onPanResponderGrant: (e) => startDraw(e.nativeEvent.locationX, e.nativeEvent.locationY),
164
+ onPanResponderMove: (e) => moveDraw(e.nativeEvent.locationX, e.nativeEvent.locationY),
165
+ onPanResponderRelease: endDraw,
166
+ onPanResponderTerminate: endDraw
167
+ })
168
+ ).current;
169
+ const undo = () => {
170
+ setShapes((s) => s.slice(0, -1));
171
+ setDraft(null);
172
+ };
173
+ const clearAll = () => {
174
+ setShapes([]);
175
+ setDraft(null);
176
+ setEditingId(null);
177
+ };
178
+ const updateText = (id, val) => setShapes((s) => s.map((sh) => sh.id === id && sh.type === "text" ? { ...sh, text: val } : sh));
179
+ const commitText = () => setShapes((s) => {
180
+ setEditingId(null);
181
+ return s.filter((sh) => !(sh.type === "text" && !sh.text.trim()));
182
+ });
183
+ const handleContinue = async () => {
184
+ commitText();
185
+ const count = shapes.filter((sh) => !(sh.type === "text" && !sh.text.trim())).length;
186
+ try {
187
+ const uri = await captureRef(stageContainerRef, { format: "png", result: "data-uri", quality: 1 });
188
+ onContinue(typeof uri === "string" ? uri : src, count);
189
+ } catch {
190
+ onContinue(src, count);
191
+ }
192
+ };
193
+ const all = draft ? [...shapes, draft] : shapes;
194
+ const editingShape = editingId != null ? shapes.find((s) => s.id === editingId) : void 0;
195
+ return /* @__PURE__ */ jsx(Modal, { visible, animationType: "fade", transparent: true, statusBarTranslucent: true, onRequestClose: onCancel, children: /* @__PURE__ */ jsxs(View, { style: styles2.screen, children: [
196
+ /* @__PURE__ */ jsxs(View, { style: [styles2.header, { paddingTop: insets.top + 8, height: HEADER_H + insets.top }], children: [
197
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: onCancel, style: styles2.hdrGhost, children: /* @__PURE__ */ jsx(Text, { style: styles2.hdrGhostText, children: "Back" }) }),
198
+ /* @__PURE__ */ jsx(Text, { style: styles2.hdrTitle, children: "Annotate" }),
199
+ /* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", gap: 8 }, children: [
200
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: clearAll, style: styles2.hdrGhost, children: /* @__PURE__ */ jsx(Text, { style: [styles2.hdrGhostText, { color: "#FF6B6B" }], children: "Delete" }) }),
201
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: handleContinue, style: [styles2.hdrPrimary, { backgroundColor: t.accent }], children: /* @__PURE__ */ jsx(Text, { style: { color: t.onAccent, fontWeight: "600", fontSize: 13.5 }, children: "Continue" }) })
202
+ ] })
203
+ ] }),
204
+ editingShape && /* @__PURE__ */ jsxs(View, { style: [styles2.editBar, { top: HEADER_H + insets.top + 6, backgroundColor: t.panel, borderColor: t.border }], children: [
205
+ /* @__PURE__ */ jsx(
206
+ TextInput,
207
+ {
208
+ autoFocus: true,
209
+ value: editingShape.text,
210
+ placeholder: "Type a label, then Done",
211
+ placeholderTextColor: t.faint,
212
+ onChangeText: (v) => updateText(editingShape.id, v),
213
+ onSubmitEditing: commitText,
214
+ style: { flex: 1, color: t.text, fontSize: 15, paddingVertical: 6 }
215
+ },
216
+ editingShape.id
217
+ ),
218
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: commitText, style: [styles2.editDone, { backgroundColor: t.accent }], children: /* @__PURE__ */ jsx(Text, { style: { color: t.onAccent, fontWeight: "600", fontSize: 13 }, children: "Done" }) })
219
+ ] }),
220
+ /* @__PURE__ */ jsx(View, { style: styles2.stageWrap, children: /* @__PURE__ */ jsxs(View, { ref: stageContainerRef, collapsable: false, style: [styles2.stage, { width: dims.width, height: dims.height }], children: [
221
+ /* @__PURE__ */ jsx(Image, { source: { uri: src }, style: { width: dims.width, height: dims.height }, resizeMode: "contain" }),
222
+ all.map((sh) => {
223
+ if (sh.type !== "blur") return null;
224
+ return /* @__PURE__ */ jsx(
225
+ View,
226
+ {
227
+ pointerEvents: "none",
228
+ style: {
229
+ position: "absolute",
230
+ left: Math.min(sh.x0, sh.x1),
231
+ top: Math.min(sh.y0, sh.y1),
232
+ width: Math.abs(sh.x1 - sh.x0),
233
+ height: Math.abs(sh.y1 - sh.y0),
234
+ backgroundColor: "#7A7D88",
235
+ borderWidth: 1.5,
236
+ borderColor: sh.color,
237
+ borderRadius: 5
238
+ }
239
+ },
240
+ sh.id
241
+ );
242
+ }),
243
+ /* @__PURE__ */ jsx(Svg3, { width: dims.width, height: dims.height, style: StyleSheet.absoluteFill, pointerEvents: "none", children: all.map((sh) => {
244
+ if (sh.type === "pen") {
245
+ return /* @__PURE__ */ jsx(Polyline, { points: pointsStr(sh.points), fill: "none", stroke: sh.color, strokeWidth: 3.5, strokeLinecap: "round", strokeLinejoin: "round" }, sh.id);
246
+ }
247
+ if (sh.type === "rect") {
248
+ return /* @__PURE__ */ jsx(Rect, { x: Math.min(sh.x0, sh.x1), y: Math.min(sh.y0, sh.y1), width: Math.abs(sh.x1 - sh.x0), height: Math.abs(sh.y1 - sh.y0), rx: 4, fill: "none", stroke: sh.color, strokeWidth: 3 }, sh.id);
249
+ }
250
+ if (sh.type === "arrow") {
251
+ const { x0, y0, x1, y1 } = sh;
252
+ const ang = Math.atan2(y1 - y0, x1 - x0);
253
+ const hl = 15;
254
+ return /* @__PURE__ */ jsxs(G, { children: [
255
+ /* @__PURE__ */ jsx(Line, { x1: x0, y1: y0, x2: x1, y2: y1, stroke: sh.color, strokeWidth: 3.5, strokeLinecap: "round" }),
256
+ /* @__PURE__ */ jsx(Polyline, { points: `${x1 - hl * Math.cos(ang - Math.PI / 7)},${y1 - hl * Math.sin(ang - Math.PI / 7)} ${x1},${y1} ${x1 - hl * Math.cos(ang + Math.PI / 7)},${y1 - hl * Math.sin(ang + Math.PI / 7)}`, fill: "none", stroke: sh.color, strokeWidth: 3.5, strokeLinecap: "round", strokeLinejoin: "round" })
257
+ ] }, sh.id);
258
+ }
259
+ return null;
260
+ }) }),
261
+ all.map((sh) => {
262
+ if (sh.type !== "text" || !sh.text.trim()) return null;
263
+ return /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: { position: "absolute", left: sh.x, top: sh.y - 13, backgroundColor: sh.color, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 6 }, children: /* @__PURE__ */ jsx(Text, { style: { color: "#fff", fontSize: 13, fontWeight: "600" }, children: sh.text }) }, sh.id);
264
+ }),
265
+ /* @__PURE__ */ jsx(View, { style: StyleSheet.absoluteFill, ...pan.panHandlers })
266
+ ] }) }),
267
+ /* @__PURE__ */ jsx(View, { style: [styles2.toolbarWrap, { bottom: insets.bottom + 18 }], children: /* @__PURE__ */ jsx(AnnotateToolbar, { t, tool, color, onTool: setTool, onColor: setColor, onUndo: undo }) })
268
+ ] }) });
269
+ }
270
+ var styles2 = StyleSheet.create({
271
+ screen: { flex: 1, backgroundColor: "rgba(8,10,18,0.94)" },
272
+ header: { position: "absolute", top: 0, left: 0, right: 0, flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingHorizontal: 14, zIndex: 6 },
273
+ hdrTitle: { color: "#fff", fontSize: 15, fontWeight: "600" },
274
+ hdrGhost: { paddingHorizontal: 10, paddingVertical: 8 },
275
+ hdrGhostText: { color: "#fff", fontSize: 14, fontWeight: "500" },
276
+ hdrPrimary: { paddingHorizontal: 16, paddingVertical: 8, borderRadius: 10 },
277
+ editBar: { position: "absolute", left: 16, right: 16, flexDirection: "row", alignItems: "center", gap: 8, paddingLeft: 12, paddingRight: 6, paddingVertical: 4, borderRadius: 12, borderWidth: 1, zIndex: 7 },
278
+ editDone: { paddingHorizontal: 14, paddingVertical: 7, borderRadius: 9 },
279
+ stageWrap: { flex: 1, alignItems: "center", justifyContent: "center" },
280
+ stage: { borderRadius: 10, overflow: "hidden", backgroundColor: "#000" },
281
+ toolbarWrap: { position: "absolute", left: 16, right: 16, alignItems: "center" }
282
+ });
283
+ var BugReporterCaptureRefContext = createContext(null);
284
+ var CurrentRefContext = createContext(null);
285
+ function BugReporterCaptureRefProvider({ children }) {
286
+ const [currentRef, setCurrentRef] = useState(null);
287
+ const setRef = useCallback((ref) => {
288
+ setCurrentRef(() => ref);
289
+ }, []);
290
+ return /* @__PURE__ */ jsx(BugReporterCaptureRefContext.Provider, { value: setRef, children: /* @__PURE__ */ jsx(CurrentRefContext.Provider, { value: currentRef, children }) });
291
+ }
292
+ function useSetBugReporterCaptureRef(ref) {
293
+ const setRef = useContext(BugReporterCaptureRefContext);
294
+ React2.useEffect(() => {
295
+ setRef?.(ref);
296
+ return () => setRef?.(null);
297
+ }, [setRef, ref]);
298
+ }
299
+ function useBugReporterCaptureRef() {
300
+ return useContext(CurrentRefContext);
301
+ }
302
+ function BugReporterScreenCaptureView({
303
+ children,
304
+ style
305
+ }) {
306
+ const ref = useRef(null);
307
+ useSetBugReporterCaptureRef(ref);
308
+ return /* @__PURE__ */ jsx(View, { ref, collapsable: false, style: [{ flex: 1 }, style], children });
309
+ }
310
+ function BugReportForm(props) {
311
+ const { t } = props;
312
+ const [metaOpen, setMetaOpen] = useState(true);
313
+ const canSubmit = props.title.trim().length > 0 && !props.submitting;
314
+ return /* @__PURE__ */ jsxs(View, { style: [styles3.root, { backgroundColor: t.panel }], children: [
315
+ /* @__PURE__ */ jsxs(View, { style: [styles3.header, { borderBottomColor: t.border }], children: [
316
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: props.onBack, style: [styles3.hdrBtn, { borderColor: t.border, backgroundColor: t.surface }], children: /* @__PURE__ */ jsx(Svg3, { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: "M15 5l-7 7 7 7", stroke: t.muted, strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
317
+ /* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
318
+ /* @__PURE__ */ jsx(Text, { style: [styles3.title, { color: t.text }], children: "New bug report" }),
319
+ /* @__PURE__ */ jsx(Text, { style: [styles3.subtitle, { color: t.muted }], children: "Review & describe the issue" })
320
+ ] }),
321
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: props.onClose, style: [styles3.hdrBtn, { borderColor: t.border, backgroundColor: t.surface }], children: /* @__PURE__ */ jsx(Svg3, { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: "M6 6l12 12M18 6L6 18", stroke: t.muted, strokeWidth: 2.2, strokeLinecap: "round" }) }) })
322
+ ] }),
323
+ /* @__PURE__ */ jsxs(ScrollView, { style: { flex: 1 }, contentContainerStyle: { padding: 16, gap: 18 }, keyboardShouldPersistTaps: "handled", children: [
324
+ /* @__PURE__ */ jsxs(View, { style: [styles3.shotRow, { borderColor: t.border, backgroundColor: t.surface }], children: [
325
+ /* @__PURE__ */ jsx(View, { style: { width: 54, height: 38, borderRadius: 6, overflow: "hidden", backgroundColor: t.canvas, borderWidth: 1, borderColor: t.border }, children: props.screenshotUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: props.screenshotUrl }, style: { width: "100%", height: "100%" }, resizeMode: "cover" }) : null }),
326
+ /* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
327
+ /* @__PURE__ */ jsx(Text, { style: { fontSize: 13, fontWeight: "500", color: t.text }, children: "Screenshot attached" }),
328
+ /* @__PURE__ */ jsxs(Text, { style: { fontSize: 12, color: t.muted, marginTop: 1 }, children: [
329
+ props.annotationCount,
330
+ " annotation",
331
+ props.annotationCount === 1 ? "" : "s"
332
+ ] })
333
+ ] }),
334
+ /* @__PURE__ */ jsx(TouchableOpacity, { onPress: props.onEditAnnotations, children: /* @__PURE__ */ jsx(Text, { style: { fontSize: 12, fontWeight: "500", color: t.accent }, children: "Edit" }) })
335
+ ] }),
336
+ /* @__PURE__ */ jsxs(View, { style: { gap: 7 }, children: [
337
+ /* @__PURE__ */ jsx(Text, { style: [styles3.label, { color: t.muted }], children: "Summary" }),
338
+ /* @__PURE__ */ jsx(
339
+ TextInput,
340
+ {
341
+ value: props.title,
342
+ onChangeText: props.onTitle,
343
+ placeholder: "Chart tooltip overflows on hover",
344
+ placeholderTextColor: t.faint,
345
+ style: [styles3.input, { color: t.text, backgroundColor: t.surface, borderColor: t.border }]
346
+ }
347
+ )
348
+ ] }),
349
+ /* @__PURE__ */ jsxs(View, { style: { gap: 7 }, children: [
350
+ /* @__PURE__ */ jsx(Text, { style: [styles3.label, { color: t.muted }], children: "What happened?" }),
351
+ /* @__PURE__ */ jsx(
352
+ TextInput,
353
+ {
354
+ value: props.description,
355
+ onChangeText: props.onDescription,
356
+ placeholder: "Steps to reproduce, expected vs actual\u2026",
357
+ placeholderTextColor: t.faint,
358
+ multiline: true,
359
+ style: [styles3.input, styles3.textArea, { color: t.text, backgroundColor: t.surface, borderColor: t.border }]
360
+ }
361
+ )
362
+ ] }),
363
+ /* @__PURE__ */ jsxs(View, { style: { gap: 8 }, children: [
364
+ /* @__PURE__ */ jsx(Text, { style: [styles3.label, { color: t.muted }], children: "Severity" }),
365
+ /* @__PURE__ */ jsx(View, { style: { flexDirection: "row", gap: 6 }, children: SEVERITIES.map((s) => {
366
+ const active = props.severity === s.id;
367
+ return /* @__PURE__ */ jsxs(
368
+ TouchableOpacity,
369
+ {
370
+ onPress: () => props.onSeverity(s.id),
371
+ style: [styles3.sev, { borderColor: active ? t.accent : t.border, backgroundColor: active ? t.ring : t.surface }],
372
+ children: [
373
+ /* @__PURE__ */ jsx(View, { style: { width: 9, height: 9, borderRadius: 5, backgroundColor: s.color, opacity: active ? 1 : 0.55 } }),
374
+ /* @__PURE__ */ jsx(Text, { style: { fontSize: 12, fontWeight: active ? "600" : "500", color: active ? t.text : t.muted }, children: s.label })
375
+ ]
376
+ },
377
+ s.id
378
+ );
379
+ }) })
380
+ ] }),
381
+ /* @__PURE__ */ jsxs(View, { style: { gap: 8 }, children: [
382
+ /* @__PURE__ */ jsx(Text, { style: [styles3.label, { color: t.muted }], children: "Type" }),
383
+ /* @__PURE__ */ jsx(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: 6 }, children: REPORT_TYPES.map((rt) => {
384
+ const active = props.type === rt.id;
385
+ return /* @__PURE__ */ jsx(
386
+ TouchableOpacity,
387
+ {
388
+ onPress: () => props.onType(rt.id),
389
+ style: { paddingVertical: 7, paddingHorizontal: 13, borderRadius: 999, borderWidth: 1, borderColor: active ? t.accent : t.border, backgroundColor: active ? t.accent : t.surface },
390
+ children: /* @__PURE__ */ jsx(Text, { style: { fontSize: 12.5, fontWeight: active ? "600" : "500", color: active ? t.onAccent : t.muted }, children: rt.label })
391
+ },
392
+ rt.id
393
+ );
394
+ }) })
395
+ ] }),
396
+ props.meta.length > 0 && /* @__PURE__ */ jsxs(View, { style: { borderWidth: 1, borderColor: t.border, borderRadius: 10, overflow: "hidden", backgroundColor: t.surface }, children: [
397
+ /* @__PURE__ */ jsxs(TouchableOpacity, { onPress: () => setMetaOpen((o) => !o), style: { flexDirection: "row", alignItems: "center", gap: 8, padding: 11 }, children: [
398
+ /* @__PURE__ */ jsx(Svg3, { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: "M4 7h16M4 12h16M4 17h10", stroke: t.muted, strokeWidth: 2, strokeLinecap: "round" }) }),
399
+ /* @__PURE__ */ jsx(Text, { style: { flex: 1, fontSize: 12.5, fontWeight: "600", color: t.text }, children: "Auto-captured context" }),
400
+ /* @__PURE__ */ jsxs(Text, { style: { fontSize: 11, color: t.muted }, children: [
401
+ props.meta.length,
402
+ " fields"
403
+ ] }),
404
+ /* @__PURE__ */ jsx(Text, { style: { color: t.muted, fontSize: 11 }, children: metaOpen ? "\u25B2" : "\u25BC" })
405
+ ] }),
406
+ metaOpen && /* @__PURE__ */ jsx(View, { style: { borderTopWidth: 1, borderTopColor: t.border, paddingHorizontal: 12, paddingBottom: 8 }, children: props.meta.map((m, i) => /* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "center", gap: 10, paddingVertical: 6, borderBottomWidth: 1, borderBottomColor: t.border }, children: [
407
+ /* @__PURE__ */ jsx(Text, { style: { color: t.muted, width: 64, fontSize: 11.5 }, children: m.label }),
408
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: { flex: 1, textAlign: "right", fontSize: 11.5, color: m.flag === "err" ? "#E5484D" : m.flag === "warn" ? "#F5A524" : t.text }, children: m.value })
409
+ ] }, i)) })
410
+ ] })
411
+ ] }),
412
+ /* @__PURE__ */ jsxs(View, { style: [styles3.footer, { borderTopColor: t.border, backgroundColor: t.panel }], children: [
413
+ /* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "center", gap: 8 }, children: [
414
+ /* @__PURE__ */ jsx(Svg3, { width: 14, height: 14, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: "M4 13l4 4L20 5", stroke: t.ok, strokeWidth: 2.4, strokeLinecap: "round", strokeLinejoin: "round" }) }),
415
+ /* @__PURE__ */ jsxs(Text, { style: { flex: 1, fontSize: 12, color: t.muted }, children: [
416
+ "Filing to ",
417
+ /* @__PURE__ */ jsx(Text, { style: { color: t.text, fontWeight: "600" }, children: props.backendName })
418
+ ] }),
419
+ /* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "center", gap: 5, backgroundColor: t.okBg, paddingHorizontal: 8, paddingVertical: 3, borderRadius: 999 }, children: [
420
+ /* @__PURE__ */ jsx(View, { style: { width: 6, height: 6, borderRadius: 3, backgroundColor: t.ok } }),
421
+ /* @__PURE__ */ jsx(Text, { style: { fontSize: 11, color: t.ok }, children: "connected" })
422
+ ] })
423
+ ] }),
424
+ props.error ? /* @__PURE__ */ jsx(Text, { style: { fontSize: 12.5, color: "#E5484D", fontWeight: "500" }, children: props.error }) : null,
425
+ /* @__PURE__ */ jsx(TouchableOpacity, { disabled: !canSubmit, onPress: props.onSubmit, style: [styles3.submit, { backgroundColor: t.accent, opacity: canSubmit ? 1 : 0.85 }], children: props.submitting ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: t.onAccent }) : /* @__PURE__ */ jsx(Text, { style: { color: t.onAccent, fontSize: 14, fontWeight: "600" }, children: "Submit report" }) })
426
+ ] })
427
+ ] });
428
+ }
429
+ var styles3 = StyleSheet.create({
430
+ root: { flex: 1, overflow: "hidden" },
431
+ header: { flexDirection: "row", alignItems: "center", gap: 10, paddingHorizontal: 16, paddingTop: 16, paddingBottom: 14, borderBottomWidth: 1 },
432
+ hdrBtn: { width: 30, height: 30, borderRadius: 8, borderWidth: 1, alignItems: "center", justifyContent: "center" },
433
+ title: { fontSize: 15, fontWeight: "600" },
434
+ subtitle: { fontSize: 12, marginTop: 1 },
435
+ shotRow: { flexDirection: "row", alignItems: "center", gap: 12, padding: 10, borderWidth: 1, borderRadius: 10 },
436
+ label: { fontSize: 12, fontWeight: "600" },
437
+ input: { borderWidth: 1, borderRadius: 9, paddingHorizontal: 12, paddingVertical: 10, fontSize: 14 },
438
+ textArea: { minHeight: 78, textAlignVertical: "top" },
439
+ sev: { flex: 1, alignItems: "center", gap: 5, paddingVertical: 9, paddingHorizontal: 4, borderRadius: 9, borderWidth: 1 },
440
+ footer: { borderTopWidth: 1, paddingHorizontal: 16, paddingTop: 12, paddingBottom: 14, gap: 11 },
441
+ submit: { paddingVertical: 12, borderRadius: 10, alignItems: "center", justifyContent: "center" }
442
+ });
443
+ var CAPTURE_DELAY_MS = 400;
444
+ var CAPTURE_TIMEOUT_MS = 8e3;
445
+ function viewShotOptions(result, options) {
446
+ const format = options?.format === "jpeg" ? "jpg" : "png";
447
+ const quality = options?.quality ?? (format === "jpg" ? 0.92 : 1);
448
+ return { format, quality, result };
449
+ }
450
+ function waitForLayout() {
451
+ return new Promise((resolve) => {
452
+ InteractionManager.runAfterInteractions(() => {
453
+ setTimeout(resolve, CAPTURE_DELAY_MS);
454
+ });
455
+ });
456
+ }
457
+ function doCapture(viewRef, options) {
458
+ const view = viewRef?.current;
459
+ if (!view) return Promise.resolve(void 0);
460
+ return captureRef(viewRef, viewShotOptions("data-uri", options)).then((uri) => typeof uri === "string" ? uri : void 0).catch(() => void 0);
461
+ }
462
+ async function captureViewBase64(viewRef, options) {
463
+ await waitForLayout();
464
+ if (!viewRef) return void 0;
465
+ try {
466
+ const base64 = await captureRef(viewRef, viewShotOptions("base64", options));
467
+ return typeof base64 === "string" ? base64 : void 0;
468
+ } catch {
469
+ return void 0;
470
+ }
471
+ }
472
+ function withTimeout(p, ms) {
473
+ return Promise.race([
474
+ p,
475
+ new Promise((_, reject) => setTimeout(() => reject(new Error("Capture timeout")), ms))
476
+ ]);
477
+ }
478
+ function imageUriFromCapture(uri) {
479
+ if (uri.startsWith("data:")) return uri;
480
+ if (uri.startsWith("file://")) return uri;
481
+ if (uri.startsWith("/")) {
482
+ return Platform.OS === "android" ? "file://" + uri : uri;
483
+ }
484
+ return uri;
485
+ }
486
+ async function captureScreenDataUri(options) {
487
+ await waitForLayout();
488
+ for (const resultType of ["data-uri", "tmpfile"]) {
489
+ try {
490
+ const uri = await withTimeout(
491
+ captureScreen(viewShotOptions(resultType, options)),
492
+ CAPTURE_TIMEOUT_MS
493
+ );
494
+ if (typeof uri === "string" && uri.length > 0) {
495
+ return imageUriFromCapture(uri);
496
+ }
497
+ } catch {
498
+ }
499
+ }
500
+ return void 0;
501
+ }
502
+ async function captureViewDataUri(viewRef, options) {
503
+ try {
504
+ let dataUri = await captureScreenDataUri(options);
505
+ if (!dataUri && viewRef?.current) {
506
+ dataUri = await doCapture(viewRef, options);
507
+ if (!dataUri) {
508
+ await new Promise((r) => setTimeout(r, 150));
509
+ dataUri = await doCapture(viewRef, options);
510
+ }
511
+ }
512
+ return dataUri;
513
+ } catch {
514
+ return void 0;
515
+ }
516
+ }
517
+ function dataUrlToBase64(dataUrl) {
518
+ return dataUrl.replace(/^data:image\/\w+;base64,/, "");
519
+ }
520
+ function SuccessCard({ t, ticket, ticketTitle, backendName, onDone }) {
521
+ return /* @__PURE__ */ jsx(View, { style: styles4.backdrop, children: /* @__PURE__ */ jsxs(View, { style: [styles4.card, { backgroundColor: t.panel, borderColor: t.border }], children: [
522
+ /* @__PURE__ */ jsx(View, { style: [styles4.check, { backgroundColor: t.okBg }], children: /* @__PURE__ */ jsx(Svg3, { width: 27, height: 27, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: "M4 13l5 5L20 6", stroke: t.ok, strokeWidth: 2.6, strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
523
+ /* @__PURE__ */ jsx(Text, { style: [styles4.title, { color: t.text }], children: "Report filed" }),
524
+ /* @__PURE__ */ jsxs(Text, { style: [styles4.sub, { color: t.muted }], children: [
525
+ "Tracked in ",
526
+ backendName,
527
+ " automatically."
528
+ ] }),
529
+ ticket ? /* @__PURE__ */ jsxs(View, { style: [styles4.ticket, { backgroundColor: t.surface, borderColor: t.border }], children: [
530
+ /* @__PURE__ */ jsx(Text, { style: { color: t.accent, fontWeight: "600", fontSize: 13 }, children: ticket }),
531
+ /* @__PURE__ */ jsx(Text, { style: { color: t.faint }, children: "\xB7" }),
532
+ /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: { color: t.muted, fontSize: 13, flexShrink: 1 }, children: ticketTitle })
533
+ ] }) : null,
534
+ /* @__PURE__ */ jsx(View, { style: { flexDirection: "row", gap: 8, marginTop: ticket ? 0 : 16 }, children: /* @__PURE__ */ jsx(TouchableOpacity, { onPress: onDone, style: [styles4.btn, { borderWidth: 1, borderColor: t.border, backgroundColor: t.surface }], children: /* @__PURE__ */ jsx(Text, { style: { color: t.text, fontSize: 13.5, fontWeight: "600" }, children: "Done" }) }) })
535
+ ] }) });
536
+ }
537
+ var styles4 = StyleSheet.create({
538
+ backdrop: { flex: 1, alignItems: "center", justifyContent: "center", backgroundColor: "rgba(8,10,18,0.55)", padding: 24 },
539
+ card: { width: 312, maxWidth: "100%", borderWidth: 1, borderRadius: 18, padding: 26, alignItems: "center" },
540
+ check: { width: 54, height: 54, borderRadius: 27, alignItems: "center", justifyContent: "center", marginBottom: 15 },
541
+ title: { fontSize: 17, fontWeight: "600" },
542
+ sub: { fontSize: 13, marginTop: 5, textAlign: "center", lineHeight: 19 },
543
+ ticket: { flexDirection: "row", alignItems: "center", gap: 9, marginVertical: 16, paddingVertical: 11, paddingHorizontal: 11, borderWidth: 1, borderRadius: 10, alignSelf: "stretch", justifyContent: "center" },
544
+ btn: { flex: 1, paddingVertical: 11, borderRadius: 10, alignItems: "center" }
545
+ });
546
+ function buildMeta(config) {
547
+ const rows = [];
548
+ rows.push({ label: "Platform", value: `${Platform.OS} ${String(Platform.Version)}` });
549
+ rows.push({ label: "Release", value: config.appVersion ? `${config.appName}@${config.appVersion}` : config.appName });
550
+ const di = config.deviceInfo ?? {};
551
+ if (di.model) rows.push({ label: "Device", value: String(di.model) });
552
+ const win = Dimensions.get("window");
553
+ const scr = Dimensions.get("screen");
554
+ rows.push({ label: "Viewport", value: `${Math.round(win.width)} \xD7 ${Math.round(win.height)}` });
555
+ rows.push({ label: "Screen", value: `${Math.round(scr.width)} \xD7 ${Math.round(scr.height)} @${PixelRatio.get()}x` });
556
+ rows.push({ label: "Font scale", value: String(PixelRatio.getFontScale()) });
557
+ rows.push({ label: "Orientation", value: win.width > win.height ? "landscape" : "portrait" });
558
+ const scheme = Appearance.getColorScheme();
559
+ if (scheme) rows.push({ label: "Scheme", value: scheme });
560
+ try {
561
+ const opts = Intl.DateTimeFormat().resolvedOptions();
562
+ if (opts.locale) rows.push({ label: "Language", value: opts.locale });
563
+ if (opts.timeZone) rows.push({ label: "Timezone", value: opts.timeZone });
564
+ } catch {
565
+ }
566
+ const diag = config.collectDiagnostics?.();
567
+ const crumbs = diag?.breadcrumbs ?? [];
568
+ const errs = crumbs.filter((b) => b.level === "error").length;
569
+ const warns = crumbs.filter((b) => b.level === "warn").length;
570
+ if (errs || warns) rows.push({ label: "Console", value: `${errs} error${errs === 1 ? "" : "s"} \xB7 ${warns} warning${warns === 1 ? "" : "s"}`, flag: errs ? "err" : "warn" });
571
+ if (diag?.lastFailedApiCall) rows.push({ label: "Network", value: "1 failed request", flag: "warn" });
572
+ return rows;
573
+ }
574
+ function BugReporterButton({ config, captureRef: captureRef3, label = "Report a bug" }) {
575
+ const theme = useMemo(() => resolveTheme(config.theme), [config.theme]);
576
+ const backendName = config.backendName ?? "ClickUp";
577
+ const contextRef = useBugReporterCaptureRef();
578
+ const effectiveRef = captureRef3 ?? contextRef;
579
+ const [step, setStep] = useState("idle");
580
+ const [flash, setFlash] = useState(false);
581
+ const [screenshot, setScreenshot] = useState();
582
+ const [edited, setEdited] = useState();
583
+ const [annCount, setAnnCount] = useState(0);
584
+ const [title, setTitle] = useState("");
585
+ const [desc, setDesc] = useState("");
586
+ const [severity, setSeverity] = useState("medium");
587
+ const [type, setType] = useState("bug");
588
+ const [ticket, setTicket] = useState();
589
+ const [error, setError] = useState();
590
+ const [meta, setMeta] = useState([]);
591
+ const ping = useRef(new Animated.Value(0)).current;
592
+ useEffect(() => {
593
+ const loop = Animated.loop(
594
+ Animated.timing(ping, { toValue: 1, duration: 1900, easing: Easing.out(Easing.ease), useNativeDriver: true })
595
+ );
596
+ loop.start();
597
+ return () => loop.stop();
598
+ }, [ping]);
599
+ const initial = Dimensions.get("window");
600
+ const pan = useRef(new Animated.ValueXY({ x: initial.width - FAB_SIZE - 22, y: initial.height - FAB_SIZE - 120 })).current;
601
+ const dragging = useRef(false);
602
+ const openRef = useRef(() => {
603
+ });
604
+ const fabPan = useRef(
605
+ PanResponder.create({
606
+ onStartShouldSetPanResponder: () => true,
607
+ onMoveShouldSetPanResponder: (_e, g) => Math.abs(g.dx) > 5 || Math.abs(g.dy) > 5,
608
+ onPanResponderGrant: () => {
609
+ dragging.current = false;
610
+ pan.extractOffset();
611
+ },
612
+ onPanResponderMove: (_e, g) => {
613
+ if (Math.abs(g.dx) > 5 || Math.abs(g.dy) > 5) dragging.current = true;
614
+ pan.setValue({ x: g.dx, y: g.dy });
615
+ },
616
+ onPanResponderRelease: () => {
617
+ pan.flattenOffset();
618
+ if (!dragging.current) {
619
+ openRef.current();
620
+ return;
621
+ }
622
+ const win = Dimensions.get("window");
623
+ const cx = pan.x._value;
624
+ const cy = pan.y._value;
625
+ const targetX = cx + FAB_SIZE / 2 < win.width / 2 ? 22 : win.width - FAB_SIZE - 22;
626
+ const targetY = Math.max(60, Math.min(cy, win.height - FAB_SIZE - 90));
627
+ Animated.spring(pan, { toValue: { x: targetX, y: targetY }, useNativeDriver: false, friction: 7, tension: 40 }).start();
628
+ }
629
+ })
630
+ ).current;
631
+ useEffect(() => {
632
+ void getReportQueue(config)?.flush(config);
633
+ }, []);
634
+ const queue = getReportQueue(config);
635
+ const reset = () => {
636
+ setStep("idle");
637
+ setFlash(false);
638
+ setScreenshot(void 0);
639
+ setEdited(void 0);
640
+ setAnnCount(0);
641
+ setTitle("");
642
+ setDesc("");
643
+ setSeverity("medium");
644
+ setType("bug");
645
+ setTicket(void 0);
646
+ setError(void 0);
647
+ };
648
+ const open = async () => {
649
+ if (step !== "idle") return;
650
+ setStep("capturing");
651
+ const shot = await captureViewDataUri(effectiveRef ?? void 0, config.screenshot);
652
+ setScreenshot(shot);
653
+ setFlash(true);
654
+ setTimeout(() => {
655
+ setFlash(false);
656
+ setStep("annotate");
657
+ }, 220);
658
+ };
659
+ openRef.current = open;
660
+ const onContinue = (flattened, count) => {
661
+ setEdited(flattened);
662
+ setAnnCount(count);
663
+ setMeta(buildMeta(config));
664
+ setStep("form");
665
+ if (config.collectContext) {
666
+ void (async () => {
667
+ try {
668
+ const extra = normalizeContext(await config.collectContext());
669
+ if (extra.length) setMeta((m) => [...m, ...extra]);
670
+ } catch {
671
+ }
672
+ })();
673
+ }
674
+ };
675
+ const submit = async () => {
676
+ if (!title.trim()) return;
677
+ setStep("submitting");
678
+ setError(void 0);
679
+ const shot = edited ?? screenshot;
680
+ const options = {
681
+ title: title.trim(),
682
+ description: desc.trim(),
683
+ screenshotBase64: shot?.startsWith("data:") ? dataUrlToBase64(shot) : void 0,
684
+ isReportingProblem: true,
685
+ severity,
686
+ type,
687
+ context: meta.map((m) => ({ label: m.label, value: m.value })),
688
+ metadata: { platform: Platform.OS, osVersion: Platform.Version?.toString() }
689
+ };
690
+ try {
691
+ const res = await submitReport(config, options);
692
+ if (res.success) {
693
+ setTicket(res.id);
694
+ setStep("done");
695
+ } else if (queue) {
696
+ await queue.enqueue(options);
697
+ setStep("done");
698
+ } else {
699
+ setError(res.message || "Submission failed.");
700
+ setStep("form");
701
+ }
702
+ } catch (e) {
703
+ if (queue) {
704
+ await queue.enqueue(options);
705
+ setStep("done");
706
+ } else {
707
+ setError(e instanceof Error ? e.message : "Submission failed.");
708
+ setStep("form");
709
+ }
710
+ }
711
+ };
712
+ const pingStyle = {
713
+ transform: [{ scale: ping.interpolate({ inputRange: [0, 1], outputRange: [1, 1.9] }) }],
714
+ opacity: ping.interpolate({ inputRange: [0, 0.8, 1], outputRange: [0.55, 0, 0] })
715
+ };
716
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
717
+ step === "idle" && /* @__PURE__ */ jsxs(
718
+ Animated.View,
719
+ {
720
+ accessibilityRole: "button",
721
+ accessibilityLabel: label,
722
+ ...fabPan.panHandlers,
723
+ style: [styles5.fab, { backgroundColor: theme.accent, transform: pan.getTranslateTransform() }],
724
+ children: [
725
+ /* @__PURE__ */ jsx(Animated.View, { style: [styles5.ping, { borderColor: theme.accent }, pingStyle], pointerEvents: "none" }),
726
+ /* @__PURE__ */ jsxs(Svg3, { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", children: [
727
+ /* @__PURE__ */ jsx(Path, { d: "M8 11a4 4 0 018 0v3a4 4 0 01-8 0z", stroke: "#fff", strokeWidth: 1.7 }),
728
+ /* @__PURE__ */ jsx(Circle, { cx: 12, cy: 7.2, r: 2, stroke: "#fff", strokeWidth: 1.6 }),
729
+ /* @__PURE__ */ jsx(Path, { d: "M10.4 5.6L9 4.2M13.6 5.6L15 4.2M8 12H5.4M8 15H5.6M16 12h2.6M16 15h2.4M8.4 17.6l-1.8 1.8M15.6 17.6l1.8 1.8", stroke: "#fff", strokeWidth: 1.5, strokeLinecap: "round" })
730
+ ] })
731
+ ]
732
+ }
733
+ ),
734
+ flash && /* @__PURE__ */ jsx(Modal, { transparent: true, animationType: "none", children: /* @__PURE__ */ jsx(View, { style: styles5.flash, pointerEvents: "none" }) }),
735
+ step === "annotate" && screenshot && /* @__PURE__ */ jsx(AnnotateOverlay, { t: theme, visible: true, src: screenshot, onCancel: reset, onContinue }),
736
+ /* @__PURE__ */ jsx(Modal, { visible: step === "form" || step === "submitting", transparent: true, animationType: "slide", onRequestClose: reset, children: /* @__PURE__ */ jsxs(View, { style: styles5.sheetBackdrop, children: [
737
+ /* @__PURE__ */ jsx(TouchableOpacity, { style: StyleSheet.absoluteFill, activeOpacity: 1, onPress: reset }),
738
+ /* @__PURE__ */ jsx(View, { style: styles5.sheet, children: /* @__PURE__ */ jsx(
739
+ BugReportForm,
740
+ {
741
+ t: theme,
742
+ screenshotUrl: edited ?? screenshot,
743
+ annotationCount: annCount,
744
+ title,
745
+ description: desc,
746
+ severity,
747
+ type,
748
+ meta,
749
+ backendName,
750
+ submitting: step === "submitting",
751
+ error,
752
+ onTitle: setTitle,
753
+ onDescription: setDesc,
754
+ onSeverity: setSeverity,
755
+ onType: setType,
756
+ onBack: () => setStep("annotate"),
757
+ onClose: reset,
758
+ onEditAnnotations: () => setStep("annotate"),
759
+ onSubmit: submit
760
+ }
761
+ ) })
762
+ ] }) }),
763
+ /* @__PURE__ */ jsx(Modal, { visible: step === "done", transparent: true, animationType: "fade", onRequestClose: reset, children: /* @__PURE__ */ jsx(
764
+ SuccessCard,
765
+ {
766
+ t: theme,
767
+ ticket,
768
+ ticketTitle: title.trim() || "Untitled report",
769
+ backendName,
770
+ onDone: reset
771
+ }
772
+ ) })
773
+ ] });
774
+ }
775
+ var FAB_SIZE = 56;
776
+ var styles5 = StyleSheet.create({
777
+ fab: { position: "absolute", top: 0, left: 0, width: FAB_SIZE, height: FAB_SIZE, borderRadius: FAB_SIZE / 2, alignItems: "center", justifyContent: "center", shadowColor: "#000", shadowOffset: { width: 0, height: 10 }, shadowOpacity: 0.34, shadowRadius: 18, elevation: 8, zIndex: 9999 },
778
+ ping: { position: "absolute", width: FAB_SIZE, height: FAB_SIZE, borderRadius: FAB_SIZE / 2, borderWidth: 2 },
779
+ flash: { flex: 1, backgroundColor: "#fff" },
780
+ sheetBackdrop: { flex: 1, justifyContent: "flex-end", backgroundColor: "rgba(8,10,18,0.5)" },
781
+ sheet: { height: "92%", borderTopLeftRadius: 26, borderTopRightRadius: 26, overflow: "hidden" }
782
+ });
783
+
784
+ export { AnnotateOverlay, AnnotateToolbar, BugReportForm, BugReporterButton, BugReporterCaptureRefProvider, BugReporterScreenCaptureView, SuccessCard, captureScreenDataUri, captureViewBase64, captureViewDataUri, dataUrlToBase64, useBugReporterCaptureRef, useSetBugReporterCaptureRef };
785
+ //# sourceMappingURL=index.mjs.map
786
+ //# sourceMappingURL=index.mjs.map