one
Version:
One is a React framework for web, iOS, and Android apps.
1,789 lines • 82.8 kB
JavaScript
import { jsx } from "react/jsx-runtime";
import { Platform } from "react-native";
import { assertTextInputOptions } from "../textTypes.native.js";
import { useControlled } from "../controlled.native.js";
import { assertSwiftUIValue } from "./swiftui.native.js";
import { dispatchSDKEvent, swiftStyleNative } from "./swiftStyleNative.native.js";
import { iconColorRoles } from "../ui/iconRoles.native.js";
import { chartPointsNative, chartStyleNative } from "../chartNative.native.js";
import { getSyncStateId, isSyncState, publishNativeSyncState } from "../syncStore.native.js";
import { syncHandleOf, useSyncValue } from "../syncNativeState.native.js";
import NativePicker from "../specs/OneNativePickerNativeComponent.native.js";
import NativeDatePicker from "../specs/OneNativeDatePickerNativeComponent.native.js";
import NativeColorPicker from "../specs/OneNativeColorPickerNativeComponent.native.js";
import NativeMultiDatePicker from "../specs/OneNativeMultiDatePickerNativeComponent.native.js";
import NativeToggle from "../specs/OneNativeToggleNativeComponent.native.js";
import NativeSlider from "../specs/OneNativeSliderNativeComponent.native.js";
import NativeStepper from "../specs/OneNativeStepperNativeComponent.native.js";
import NativePasteButton from "../specs/OneNativePasteButtonNativeComponent.native.js";
import NativeText from "../specs/OneNativeTextNativeComponent.native.js";
import NativeLabel from "../specs/OneNativeLabelNativeComponent.native.js";
import NativeProgressView from "../specs/OneNativeProgressViewNativeComponent.native.js";
import NativeGauge from "../specs/OneNativeGaugeNativeComponent.native.js";
import NativeImage from "../specs/OneNativeImageNativeComponent.native.js";
import NativeShareLink from "../specs/OneNativeShareLinkNativeComponent.native.js";
import NativeContentUnavailableView from "../specs/OneNativeContentUnavailableViewNativeComponent.native.js";
import NativeCircle from "../specs/OneNativeCircleNativeComponent.native.js";
import NativeCapsule from "../specs/OneNativeCapsuleNativeComponent.native.js";
import NativeRectangle from "../specs/OneNativeRectangleNativeComponent.native.js";
import NativeRoundedRectangle from "../specs/OneNativeRoundedRectangleNativeComponent.native.js";
import NativeEllipse from "../specs/OneNativeEllipseNativeComponent.native.js";
import NativeUnevenRoundedRectangle from "../specs/OneNativeUnevenRoundedRectangleNativeComponent.native.js";
import NativeConcentricRectangle from "../specs/OneNativeConcentricRectangleNativeComponent.native.js";
import NativeLinearGradient from "../specs/OneNativeLinearGradientNativeComponent.native.js";
import NativeRadialGradient from "../specs/OneNativeRadialGradientNativeComponent.native.js";
import NativeEllipticalGradient from "../specs/OneNativeEllipticalGradientNativeComponent.native.js";
import NativeAngularGradient from "../specs/OneNativeAngularGradientNativeComponent.native.js";
import NativeMeshGradient from "../specs/OneNativeMeshGradientNativeComponent.native.js";
import NativeVideoPlayer from "../specs/OneNativeVideoPlayerNativeComponent.native.js";
import NativeLivePhotoView from "../specs/OneNativeLivePhotoViewNativeComponent.native.js";
import NativePhotosPicker from "../specs/OneNativePhotosPickerNativeComponent.native.js";
import NativeWebView from "../specs/OneNativeWebViewNativeComponent.native.js";
import NativeSignInWithAppleButton from "../specs/OneNativeSignInWithAppleButtonNativeComponent.native.js";
import NativePayWithApplePayButton from "../specs/OneNativePayWithApplePayButtonNativeComponent.native.js";
import NativeAddPassToWalletButton from "../specs/OneNativeAddPassToWalletButtonNativeComponent.native.js";
import NativeMap from "../specs/OneNativeMapNativeComponent.native.js";
import NativeMapCompass from "../specs/OneNativeMapCompassNativeComponent.native.js";
import NativeMapPitchToggle from "../specs/OneNativeMapPitchToggleNativeComponent.native.js";
import NativeMapUserLocationButton from "../specs/OneNativeMapUserLocationButtonNativeComponent.native.js";
import NativeTextField from "../specs/OneNativeTextFieldNativeComponent.native.js";
import NativeSecureField from "../specs/OneNativeSecureFieldNativeComponent.native.js";
import NativeTextEditor from "../specs/OneNativeTextEditorNativeComponent.native.js";
import NativeAlert from "../specs/OneNativeAlertNativeComponent.native.js";
import NativeConfirmationDialog from "../specs/OneNativeConfirmationDialogNativeComponent.native.js";
import NativeQuickLook from "../specs/OneNativeQuickLookNativeComponent.native.js";
import NativeFileImporter from "../specs/OneNativeFileImporterNativeComponent.native.js";
import NativeChart from "../specs/OneNativeChartNativeComponent.native.js";
import NativeAsyncImage from "../specs/OneNativeAsyncImageNativeComponent.native.js";
import NativeEditButton from "../specs/OneNativeEditButtonNativeComponent.native.js";
import NativeEmptyView from "../specs/OneNativeEmptyViewNativeComponent.native.js";
import NativeLocationButton from "../specs/OneNativeLocationButtonNativeComponent.native.js";
import NativeProductView from "../specs/OneNativeProductViewNativeComponent.native.js";
import NativeRenameButton from "../specs/OneNativeRenameButtonNativeComponent.native.js";
import NativeShortcutsLink from "../specs/OneNativeShortcutsLinkNativeComponent.native.js";
import NativeStoreView from "../specs/OneNativeStoreViewNativeComponent.native.js";
import NativeSubscriptionStoreView from "../specs/OneNativeSubscriptionStoreViewNativeComponent.native.js";
function Picker(param) {
var { selection, onSelectionChange, revision = 0, label = "", disabled = false, options, pickerStyle = "automatic", swiftStyle, style, ...props } = param;
if (!Array.isArray(options) || options.some(function(option) {
return typeof (option === null || option === void 0 ? void 0 : option.value) !== "string" || typeof (option === null || option === void 0 ? void 0 : option.label) !== "string";
})) throw new Error("Picker options must contain string value and label fields");
if (!options.length) throw new Error("Picker options must not be empty");
if (new Set(options.map(function(option) {
return option.value;
})).size !== options.length) throw new Error("Picker option values must be unique");
if (!options.some(function(option) {
return option.value === selection;
})) throw new Error("Picker selection must match an option value");
if (pickerStyle === "navigationLink") throw new Error("PickerStyle.navigationLink requires a native navigation context that One Native does not provide yet");
assertSwiftUIValue("PickerStyle", pickerStyle, Number.parseFloat(String(Platform.Version)));
var controlled = useControlled(function(event) {
return onSelectionChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativePicker, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: selection,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
label,
disabled,
options,
pickerStyle,
onNativePickerValueChange: function onNativePickerValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function DatePicker(param) {
var { selection, onSelectionChange, revision = 0, label = "", disabled = false, minimumDate = /* @__PURE__ */ new Date(-621357696e5), maximumDate = /* @__PURE__ */ new Date(640922112e5), displayedComponents = "dateAndTime", datePickerStyle = "automatic", swiftStyle, style, ...props } = param;
var selectionTime = selection instanceof Date ? selection.getTime() : NaN;
var minimumTime = minimumDate instanceof Date ? minimumDate.getTime() : NaN;
var maximumTime = maximumDate instanceof Date ? maximumDate.getTime() : NaN;
if (![
selectionTime,
minimumTime,
maximumTime
].every(Number.isFinite)) throw new Error("DatePicker selection, minimumDate, and maximumDate must be valid Date values");
if (minimumTime > maximumTime) throw new Error("DatePicker minimumDate must not be after maximumDate");
if (selectionTime < minimumTime || selectionTime > maximumTime) throw new Error("DatePicker selection must be within minimumDate and maximumDate");
if (![
"date",
"hourAndMinute",
"dateAndTime"
].includes(displayedComponents)) throw new Error("DatePicker displayedComponents must be date, hourAndMinute, or dateAndTime");
assertSwiftUIValue("DatePickerStyle", datePickerStyle, Number.parseFloat(String(Platform.Version)));
var controlled = useControlled(function(event) {
return onSelectionChange(new Date(event.value));
}, revision);
return /* @__PURE__ */ jsx(NativeDatePicker, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: selection.getTime(),
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
label,
disabled,
minimumDate: minimumDate.getTime(),
maximumDate: maximumDate.getTime(),
displayedComponents,
datePickerStyle,
onNativeDatePickerValueChange: function onNativeDatePickerValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function ColorPicker(param) {
var { selection, onSelectionChange, revision = 0, label = "", disabled = false, supportsOpacity = true, swiftStyle, style, ...props } = param;
if (typeof selection !== "string" || !/^#[0-9A-Fa-f]{6}(?:[0-9A-Fa-f]{2})?$/.test(selection)) throw new Error("ColorPicker selection must be #RRGGBB or #RRGGBBAA");
var controlled = useControlled(function(event) {
return onSelectionChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeColorPicker, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: selection,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
label,
disabled,
supportsOpacity,
onNativeColorPickerValueChange: function onNativeColorPickerValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function MultiDatePicker(param) {
var { selection, onSelectionChange, revision = 0, label = "", disabled = false, minimumDate = /* @__PURE__ */ new Date(-621357696e5), maximumDate = /* @__PURE__ */ new Date(640922112e5), swiftStyle, style, ...props } = param;
if (!Array.isArray(selection) || selection.some(function(date) {
return !(date instanceof Date) || Number.isNaN(date.getTime());
})) throw new Error("MultiDatePicker selection must be an array of valid Dates");
var minimumTime = minimumDate instanceof Date ? minimumDate.getTime() : NaN;
var maximumTime = maximumDate instanceof Date ? maximumDate.getTime() : NaN;
if (![minimumTime, maximumTime].every(Number.isFinite)) throw new Error("MultiDatePicker minimumDate and maximumDate must be valid Date values");
if (minimumTime > maximumTime) throw new Error("MultiDatePicker minimumDate must not be after maximumDate");
if (selection.some(function(date) {
return date.getTime() < minimumTime || date.getTime() > maximumTime;
})) throw new Error("MultiDatePicker selection must be within minimumDate and maximumDate");
var controlled = useControlled(function(event) {
return onSelectionChange(JSON.parse(event.value).map(function(time) {
return new Date(time);
}));
}, revision);
return /* @__PURE__ */ jsx(NativeMultiDatePicker, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: JSON.stringify(selection.map(function(date) {
return date.getTime();
}).sort(function(a, b) {
return a - b;
})),
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
label,
disabled,
minimumDate: minimumDate.getTime(),
maximumDate: maximumDate.getTime(),
onNativeMultiDatePickerValueChange: function onNativeMultiDatePickerValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function Toggle(param) {
var { isOn, onIsOnChange, revision = 0, label = "", disabled = false, systemImage = "", toggleStyle = "automatic", swiftStyle, style, ...props } = param;
var _getSyncStateId;
var syncHandle = syncHandleOf(isOn);
var syncedIsOn = useSyncValue(isOn);
{
var isOn1 = syncedIsOn;
if (typeof isOn1 !== "boolean" && !isSyncState(isOn1)) throw new Error("Toggle isOn must be a boolean or NativeState handle");
if (typeof systemImage !== "string") throw new Error("Toggle systemImage must be a string");
}
assertSwiftUIValue("ToggleStyle", toggleStyle, Number.parseFloat(String(Platform.Version)));
var controlled = useControlled(function(event) {
publishNativeSyncState(syncHandle);
onIsOnChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeToggle, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: syncedIsOn,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
syncStateId: syncHandle ? (_getSyncStateId = getSyncStateId(syncHandle)) !== null && _getSyncStateId !== void 0 ? _getSyncStateId : 0 : 0,
label,
disabled,
systemImage,
toggleStyle,
onNativeToggleValueChange: function onNativeToggleValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function Slider(param) {
var { value, onValueChange, revision = 0, label = "", disabled = false, minimumValue = 0, maximumValue = 100, step = 1, minimumValueLabel = "", maximumValueLabel = "", minimumValueImage = "", maximumValueImage = "", swiftStyle, style, ...props } = param;
var _getSyncStateId;
var syncHandle = syncHandleOf(value);
var syncedValue = useSyncValue(value);
{
var value1 = syncedValue;
if (![
value1,
minimumValue,
maximumValue,
step
].every(Number.isFinite)) throw new Error("Slider value, minimumValue, maximumValue, and step must be finite numbers");
if (minimumValue >= maximumValue) throw new Error("Slider minimumValue must be less than maximumValue");
if (step <= 0) throw new Error("Slider step must be greater than 0");
if (value1 < minimumValue || value1 > maximumValue) throw new Error("Slider value must be within minimumValue and maximumValue");
}
var controlled = useControlled(function(event) {
publishNativeSyncState(syncHandle);
onValueChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeSlider, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: syncedValue,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
syncStateId: syncHandle ? (_getSyncStateId = getSyncStateId(syncHandle)) !== null && _getSyncStateId !== void 0 ? _getSyncStateId : 0 : 0,
label,
disabled,
minimumValue,
maximumValue,
step,
minimumValueLabel,
maximumValueLabel,
minimumValueImage,
maximumValueImage,
onNativeSliderValueChange: function onNativeSliderValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function Stepper(param) {
var { value, onValueChange, revision = 0, label = "", disabled = false, minimumValue = 0, maximumValue = 100, step = 1, swiftStyle, style, ...props } = param;
var _getSyncStateId;
var syncHandle = syncHandleOf(value);
var syncedValue = useSyncValue(value);
{
var value1 = syncedValue;
if (![
value1,
minimumValue,
maximumValue,
step
].every(Number.isFinite)) throw new Error("Stepper value, minimumValue, maximumValue, and step must be finite numbers");
if (minimumValue >= maximumValue) throw new Error("Stepper minimumValue must be less than maximumValue");
if (step <= 0) throw new Error("Stepper step must be greater than 0");
if (value1 < minimumValue || value1 > maximumValue) throw new Error("Stepper value must be within minimumValue and maximumValue");
}
var controlled = useControlled(function(event) {
publishNativeSyncState(syncHandle);
onValueChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeStepper, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: syncedValue,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
syncStateId: syncHandle ? (_getSyncStateId = getSyncStateId(syncHandle)) !== null && _getSyncStateId !== void 0 ? _getSyncStateId : 0 : 0,
label,
disabled,
minimumValue,
maximumValue,
step,
onNativeStepperValueChange: function onNativeStepperValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function PasteButton(param) {
var { onPaste, disabled = false, swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativePasteButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
disabled,
onNativePasteButtonPaste: function onNativePasteButtonPaste(param2) {
var { nativeEvent } = param2;
return onPaste === null || onPaste === void 0 ? void 0 : onPaste(JSON.parse(nativeEvent.values));
}
});
}
function Text(param) {
var { text = "", swiftStyle, style, ...props } = param;
if (typeof text !== "string") throw new Error("Text text must be a string");
return /* @__PURE__ */ jsx(NativeText, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
text
});
}
function Label(param) {
var { label = "", disabled = false, systemImage = "", swiftStyle, style, ...props } = param;
if (typeof label !== "string" || !label) throw new Error("Label label must be a non-empty string");
if (typeof systemImage !== "string" || !systemImage) throw new Error("Label systemImage must be a non-empty SF Symbol name");
return /* @__PURE__ */ jsx(NativeLabel, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
label,
disabled,
systemImage
});
}
function ProgressView(param) {
var { label = "", disabled = false, value = void 0, total = 1, progressViewStyle = "automatic", swiftStyle, style, ...props } = param;
if (value !== void 0 && !Number.isFinite(value)) throw new Error("ProgressView value must be a finite number or undefined");
if (!Number.isFinite(total) || total <= 0) throw new Error("ProgressView total must be a finite number greater than 0");
if (value !== void 0 && (value < 0 || value > total)) throw new Error("ProgressView value must be between 0 and total");
assertSwiftUIValue("ProgressViewStyle", progressViewStyle, Number.parseFloat(String(Platform.Version)));
return /* @__PURE__ */ jsx(NativeProgressView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
label,
disabled,
value: value !== null && value !== void 0 ? value : 0,
total,
indeterminate: value === void 0,
progressViewStyle
});
}
function Gauge(param) {
var { label = "", disabled = false, value = 0, minimumValue = 0, maximumValue = 1, currentValueLabel = "", minimumValueLabel = "", maximumValueLabel = "", gaugeStyle = "automatic", swiftStyle, style, ...props } = param;
if (![
value,
minimumValue,
maximumValue
].every(Number.isFinite)) throw new Error("Gauge value, minimumValue, and maximumValue must be finite numbers");
if (minimumValue >= maximumValue) throw new Error("Gauge minimumValue must be less than maximumValue");
if (value < minimumValue || value > maximumValue) throw new Error("Gauge value must be within minimumValue and maximumValue");
assertSwiftUIValue("GaugeStyle", gaugeStyle, Number.parseFloat(String(Platform.Version)));
return /* @__PURE__ */ jsx(NativeGauge, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
label,
disabled,
value,
minimumValue,
maximumValue,
currentValueLabel,
minimumValueLabel,
maximumValueLabel,
gaugeStyle
});
}
function Image(param) {
var { systemName = "", uri = "", renderingMode = "original", symbolRenderingMode = "", symbolVariant = "", imageScale = "", variableValue = void 0, colorRole = "", resizable = false, swiftStyle, style, ...props } = param;
if (!systemName === !uri) throw new Error("Image takes exactly one of systemName (an SF Symbol name) or uri (a remote image)");
if (renderingMode !== "original" && renderingMode !== "template") throw new Error("Image renderingMode must be 'original' or 'template'");
if (renderingMode === "template" && !uri) throw new Error("Image renderingMode applies to a uri image; an SF Symbol is already a template");
if (variableValue !== void 0 && !Number.isFinite(variableValue)) throw new Error("Image variableValue must be a finite number or undefined");
if (variableValue !== void 0 && (variableValue < 0 || variableValue > 1)) throw new Error("Image variableValue must be between 0 and 1");
if (colorRole && !iconColorRoles.includes(colorRole)) throw new Error("Image colorRole must be a One.UI icon color role");
if (resizable && uri) throw new Error("Image resizable applies to an SF Symbol; a uri image is always resizable");
if (symbolRenderingMode) assertSwiftUIValue("SymbolRenderingMode", symbolRenderingMode, Number.parseFloat(String(Platform.Version)));
if (symbolVariant) assertSwiftUIValue("SymbolVariants", symbolVariant, Number.parseFloat(String(Platform.Version)));
if (imageScale) assertSwiftUIValue("ImageScale", imageScale, Number.parseFloat(String(Platform.Version)));
return /* @__PURE__ */ jsx(NativeImage, {
...props,
style,
accessible: false,
accessibilityElementsHidden: !props.accessibilityLabel,
accessibilityRole: "image",
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
systemName,
uri,
renderingMode,
symbolRenderingMode,
symbolVariant,
imageScale,
variableValue: variableValue !== null && variableValue !== void 0 ? variableValue : 0,
hasVariableValue: variableValue !== void 0,
colorRole,
resizable
});
}
function ShareLink(param) {
var { label = "", disabled = false, systemImage = "", item = "", itemType = "text", subject = "", message = "", swiftStyle, style, ...props } = param;
if (typeof label !== "string" || !label) throw new Error("ShareLink label must be a non-empty string");
if (typeof item !== "string" || !item) throw new Error("ShareLink item must be a non-empty string");
if (itemType !== "text" && itemType !== "url") throw new Error("ShareLink itemType must be 'text' or 'url'");
return /* @__PURE__ */ jsx(NativeShareLink, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
label,
disabled,
systemImage,
item,
itemType,
subject,
message
});
}
function ContentUnavailableView(param) {
var { onAction, title = "", systemImage = "", description = "", actions, swiftStyle, style, ...props } = param;
if (typeof title !== "string" || !title) throw new Error("ContentUnavailableView title must be a non-empty string");
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
try {
for (var _iterator = actions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var action = _step.value;
if (typeof (action === null || action === void 0 ? void 0 : action.id) !== "string" || typeof (action === null || action === void 0 ? void 0 : action.label) !== "string") throw new Error("ContentUnavailableView actions must contain string id and label fields");
if (action.role) assertSwiftUIValue("ButtonRole", action.role, Number.parseFloat(String(Platform.Version)));
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
if (new Set(actions.map(function(action2) {
return action2.id;
})).size !== actions.length) throw new Error("ContentUnavailableView action ids must be unique");
return /* @__PURE__ */ jsx(NativeContentUnavailableView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
title,
systemImage,
description,
actions,
onNativeContentUnavailableViewAction: function onNativeContentUnavailableViewAction(param2) {
var { nativeEvent } = param2;
return onAction === null || onAction === void 0 ? void 0 : onAction(nativeEvent.id);
}
});
}
function Circle(param) {
var { fill = void 0, strokeBorder = void 0, lineWidth = 1, swiftStyle, style, ...props } = param;
if (!Number.isFinite(lineWidth) || lineWidth < 0) throw new Error("Circle lineWidth must be a non-negative number");
return /* @__PURE__ */ jsx(NativeCircle, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
fill,
strokeBorder,
lineWidth
});
}
function Capsule(param) {
var { fill = void 0, strokeBorder = void 0, lineWidth = 1, swiftStyle, style, ...props } = param;
if (!Number.isFinite(lineWidth) || lineWidth < 0) throw new Error("Capsule lineWidth must be a non-negative number");
return /* @__PURE__ */ jsx(NativeCapsule, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
fill,
strokeBorder,
lineWidth
});
}
function Rectangle(param) {
var { fill = void 0, strokeBorder = void 0, lineWidth = 1, swiftStyle, style, ...props } = param;
if (!Number.isFinite(lineWidth) || lineWidth < 0) throw new Error("Rectangle lineWidth must be a non-negative number");
return /* @__PURE__ */ jsx(NativeRectangle, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
fill,
strokeBorder,
lineWidth
});
}
function RoundedRectangle(param) {
var { fill = void 0, strokeBorder = void 0, lineWidth = 1, cornerRadius = 0, swiftStyle, style, ...props } = param;
if (!Number.isFinite(cornerRadius) || cornerRadius < 0) throw new Error("RoundedRectangle cornerRadius must be a non-negative number");
if (!Number.isFinite(lineWidth) || lineWidth < 0) throw new Error("RoundedRectangle lineWidth must be a non-negative number");
return /* @__PURE__ */ jsx(NativeRoundedRectangle, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
fill,
strokeBorder,
lineWidth,
cornerRadius
});
}
function Ellipse(param) {
var { fill = void 0, strokeBorder = void 0, lineWidth = 1, swiftStyle, style, ...props } = param;
if (!Number.isFinite(lineWidth) || lineWidth < 0) throw new Error("Ellipse lineWidth must be a non-negative number");
return /* @__PURE__ */ jsx(NativeEllipse, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
fill,
strokeBorder,
lineWidth
});
}
function UnevenRoundedRectangle(param) {
var { fill = void 0, strokeBorder = void 0, lineWidth = 1, topLeadingRadius = 0, bottomLeadingRadius = 0, bottomTrailingRadius = 0, topTrailingRadius = 0, swiftStyle, style, ...props } = param;
for (var _i = 0, _iter = [
topLeadingRadius,
bottomLeadingRadius,
bottomTrailingRadius,
topTrailingRadius
]; _i < _iter.length; _i++) {
var radius = _iter[_i];
if (!Number.isFinite(radius) || radius < 0) throw new Error("UnevenRoundedRectangle radii must be non-negative numbers");
}
if (!Number.isFinite(lineWidth) || lineWidth < 0) throw new Error("UnevenRoundedRectangle lineWidth must be a non-negative number");
return /* @__PURE__ */ jsx(NativeUnevenRoundedRectangle, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
fill,
strokeBorder,
lineWidth,
topLeadingRadius,
bottomLeadingRadius,
bottomTrailingRadius,
topTrailingRadius
});
}
function ConcentricRectangle(param) {
var { fill = void 0, swiftStyle, style, ...props } = param;
if (Number.parseFloat(String(Platform.Version)) < 26) throw new Error("ConcentricRectangle requires iOS 26 or newer");
return /* @__PURE__ */ jsx(NativeConcentricRectangle, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
fill
});
}
function LinearGradient(param) {
var { colors, startPoint = {
x: .5,
y: 0
}, endPoint = {
x: .5,
y: 1
}, swiftStyle, style, ...props } = param;
if (!Array.isArray(colors) || !colors.every(function(color) {
return typeof color === "string" && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color);
})) throw new Error("LinearGradient colors must be an array of #RRGGBB or #RRGGBBAA colors");
for (var _i = 0, _iter = [startPoint, endPoint]; _i < _iter.length; _i++) {
var point = _iter[_i];
if (!point || !Number.isFinite(point.x) || !Number.isFinite(point.y)) throw new Error("LinearGradient points must have finite x and y coordinates");
}
return /* @__PURE__ */ jsx(NativeLinearGradient, {
...props,
style,
accessible: false,
accessibilityElementsHidden: !props.accessibilityLabel,
accessibilityRole: "image",
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
colors,
startPoint: JSON.stringify(startPoint),
endPoint: JSON.stringify(endPoint)
});
}
function RadialGradient(param) {
var { colors, center = {
x: .5,
y: .5
}, startRadius = 0, endRadius, swiftStyle, style, ...props } = param;
if (!Array.isArray(colors) || !colors.every(function(color) {
return typeof color === "string" && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color);
})) throw new Error("RadialGradient colors must be an array of #RRGGBB or #RRGGBBAA colors");
if (!center || !Number.isFinite(center.x) || !Number.isFinite(center.y)) throw new Error("RadialGradient center must have finite x and y coordinates");
if (!Number.isFinite(startRadius) || !Number.isFinite(endRadius)) throw new Error("RadialGradient radii must be finite numbers");
return /* @__PURE__ */ jsx(NativeRadialGradient, {
...props,
style,
accessible: false,
accessibilityElementsHidden: !props.accessibilityLabel,
accessibilityRole: "image",
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
colors,
center: JSON.stringify(center),
startRadius,
endRadius
});
}
function EllipticalGradient(param) {
var { colors, center = {
x: .5,
y: .5
}, startRadiusFraction = 0, endRadiusFraction = .5, swiftStyle, style, ...props } = param;
if (!Array.isArray(colors) || !colors.every(function(color) {
return typeof color === "string" && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color);
})) throw new Error("EllipticalGradient colors must be an array of #RRGGBB or #RRGGBBAA colors");
if (!center || !Number.isFinite(center.x) || !Number.isFinite(center.y)) throw new Error("EllipticalGradient center must have finite x and y coordinates");
if (!Number.isFinite(startRadiusFraction) || !Number.isFinite(endRadiusFraction)) throw new Error("EllipticalGradient radius fractions must be finite numbers");
return /* @__PURE__ */ jsx(NativeEllipticalGradient, {
...props,
style,
accessible: false,
accessibilityElementsHidden: !props.accessibilityLabel,
accessibilityRole: "image",
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
colors,
center: JSON.stringify(center),
startRadiusFraction,
endRadiusFraction
});
}
function AngularGradient(param) {
var { colors, center = {
x: .5,
y: .5
}, angle = { radians: 0 }, swiftStyle, style, ...props } = param;
if (!Array.isArray(colors) || !colors.every(function(color) {
return typeof color === "string" && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color);
})) throw new Error("AngularGradient colors must be an array of #RRGGBB or #RRGGBBAA colors");
if (!center || !Number.isFinite(center.x) || !Number.isFinite(center.y)) throw new Error("AngularGradient center must have finite x and y coordinates");
if (!angle || !Number.isFinite(angle.radians)) throw new Error("AngularGradient angle must have finite radians");
return /* @__PURE__ */ jsx(NativeAngularGradient, {
...props,
style,
accessible: false,
accessibilityElementsHidden: !props.accessibilityLabel,
accessibilityRole: "image",
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
colors,
center: JSON.stringify(center),
angle: JSON.stringify(angle)
});
}
function MeshGradient(param) {
var { meshWidth, meshHeight, points, colors, background = "#00000000", smoothsColors = true, colorSpace = "device", swiftStyle, style, ...props } = param;
if (Number.parseFloat(String(Platform.Version)) < 18) throw new Error("MeshGradient requires iOS 18 or newer");
if (!Number.isSafeInteger(meshWidth) || meshWidth < 2 || !Number.isSafeInteger(meshHeight) || meshHeight < 2) throw new Error("MeshGradient meshWidth and meshHeight must be integers of at least 2");
if (!Array.isArray(points) || points.length !== meshWidth * meshHeight || !points.every(function(point) {
return point && Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(Math.fround(point.x)) && Number.isFinite(Math.fround(point.y));
})) throw new Error("MeshGradient points must contain meshWidth × meshHeight finite Float32 coordinates");
if (!Array.isArray(colors) || colors.length !== meshWidth * meshHeight || !colors.every(function(color) {
return typeof color === "string" && /^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(color);
})) throw new Error("MeshGradient colors must contain meshWidth × meshHeight #RRGGBB or #RRGGBBAA colors");
if (typeof background !== "string" || !/^#[0-9a-fA-F]{6}(?:[0-9a-fA-F]{2})?$/.test(background)) throw new Error("MeshGradient background must be #RRGGBB or #RRGGBBAA");
if (colorSpace !== "device" && colorSpace !== "perceptual") throw new Error("MeshGradient colorSpace must be device or perceptual");
return /* @__PURE__ */ jsx(NativeMeshGradient, {
...props,
style,
accessible: false,
accessibilityElementsHidden: !props.accessibilityLabel,
accessibilityRole: "image",
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
meshWidth,
meshHeight,
points: JSON.stringify(points),
colors,
background,
smoothsColors,
colorSpace
});
}
function VideoPlayer(param) {
var { onPlaybackStatus, url = "", autoplay = false, command = "", commandRevision = 0, seekToMs = 0, swiftStyle, style, ...props } = param;
if (typeof url !== "string" || !url) throw new Error("VideoPlayer url must be a non-empty string");
if (![
"",
"play",
"pause",
"seek"
].includes(command)) throw new Error("Unknown VideoPlayer command: " + command);
if (!Number.isSafeInteger(commandRevision) || commandRevision < 0) throw new Error("VideoPlayer commandRevision must be a nonnegative safe integer");
if (command && commandRevision === 0) throw new Error("VideoPlayer command requires a positive commandRevision");
if (!command && commandRevision > 0) throw new Error("VideoPlayer commandRevision requires a command");
if (!Number.isFinite(seekToMs) || seekToMs < 0) throw new Error("VideoPlayer seekToMs must be a nonnegative finite number");
return /* @__PURE__ */ jsx(NativeVideoPlayer, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
url,
autoplay,
command,
commandRevision,
seekToMs,
onNativeVideoPlayerPlaybackStatus: function onNativeVideoPlayerPlaybackStatus(param2) {
var { nativeEvent } = param2;
return onPlaybackStatus === null || onPlaybackStatus === void 0 ? void 0 : onPlaybackStatus(nativeEvent.state, nativeEvent.positionMs, nativeEvent.durationMs);
}
});
}
function LivePhotoView(param) {
var { onPlaybackState, assetIdentifier, autoplay = false, command = "", commandRevision = 0, swiftStyle, style, ...props } = param;
if (typeof assetIdentifier !== "string" || !assetIdentifier.trim()) throw new Error("LivePhotoView assetIdentifier must be a non-empty string");
if (![
"",
"play",
"stop"
].includes(command)) throw new Error("Unknown LivePhotoView command: " + command);
if (!Number.isSafeInteger(commandRevision) || commandRevision < 0) throw new Error("LivePhotoView commandRevision must be a nonnegative safe integer");
if (command && commandRevision === 0) throw new Error("LivePhotoView command requires a positive commandRevision");
if (!command && commandRevision > 0) throw new Error("LivePhotoView commandRevision requires a command");
return /* @__PURE__ */ jsx(NativeLivePhotoView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
assetIdentifier,
autoplay,
command,
commandRevision,
onNativeLivePhotoViewPlaybackState: function onNativeLivePhotoViewPlaybackState(param2) {
var { nativeEvent } = param2;
return onPlaybackState === null || onPlaybackState === void 0 ? void 0 : onPlaybackState(nativeEvent.state, nativeEvent.errorCode);
}
});
}
function PhotosPicker(param) {
var { onPick, onPickItemIdentifier, onPickError, label = "", disabled = false, systemImage = "", maxSelectionCount = 1, selectionBehavior = "default", filter = "any", preferredItemEncoding = "automatic", swiftStyle, style, ...props } = param;
if (typeof label !== "string" || !label) throw new Error("PhotosPicker label must be a non-empty string");
if (!Number.isInteger(maxSelectionCount) || maxSelectionCount < 0) throw new Error("PhotosPicker maxSelectionCount must be a nonnegative integer; 0 is unlimited");
if (![
"any",
"images",
"videos",
"livePhotos",
"screenshots",
"screenRecordings",
"slomoVideos",
"timelapseVideos",
"cinematicVideos",
"depthEffectPhotos",
"bursts",
"panoramas"
].includes(filter)) throw new Error("Unknown PhotosPicker filter: " + filter);
assertSwiftUIValue("PhotosPickerSelectionBehavior", selectionBehavior, Number.parseFloat(String(Platform.Version)));
assertSwiftUIValue("EncodingDisambiguationPolicy", preferredItemEncoding, Number.parseFloat(String(Platform.Version)));
return /* @__PURE__ */ jsx(NativePhotosPicker, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
label,
disabled,
systemImage,
maxSelectionCount,
selectionBehavior,
filter,
preferredItemEncoding,
onNativePhotosPickerPick: function onNativePhotosPickerPick(param2) {
var { nativeEvent } = param2;
return onPick === null || onPick === void 0 ? void 0 : onPick(nativeEvent.url, nativeEvent.index, nativeEvent.count);
},
onNativePhotosPickerPickItemIdentifier: function onNativePhotosPickerPickItemIdentifier(param2) {
var { nativeEvent } = param2;
return onPickItemIdentifier === null || onPickItemIdentifier === void 0 ? void 0 : onPickItemIdentifier(nativeEvent.itemIdentifier, nativeEvent.index, nativeEvent.count);
},
onNativePhotosPickerPickError: function onNativePhotosPickerPickError(param2) {
var { nativeEvent } = param2;
return onPickError === null || onPickError === void 0 ? void 0 : onPickError(nativeEvent.message);
}
});
}
function WebView(param) {
var { onNavigate, onTitleChange, onLoadingChange, onLoadStart, onLoadEnd, onError, onHttpError, onMessage, onHistoryChange, onProcessTerminate, url = "", html = "", script = "", command = "", commandRevision = 0, commandValue = "", limitsNavigationsToAppBoundDomains = false, inlineMedia = false, inspectable = false, bounces = true, backForwardNavigationGestures = "", magnificationGestures = "", linkPreviews = "", elementFullscreen = "", contentBackground = "", swiftStyle, style, ...props } = param;
if (!url === !html) throw new Error("WebView takes exactly one of url and html");
if (![
"",
"reload",
"goBack",
"goForward",
"evaluate",
"postMessage"
].includes(command)) throw new Error("Unknown WebView command: " + command);
if (!Number.isSafeInteger(commandRevision) || commandRevision < 0) throw new Error("WebView commandRevision must be a nonnegative safe integer");
if (command && commandRevision === 0) throw new Error("WebView command requires a positive commandRevision");
if (!command && commandRevision > 0) throw new Error("WebView commandRevision requires a command");
if (typeof commandValue !== "string") throw new Error("WebView commandValue must be a string");
if ((command === "evaluate" || command === "postMessage") && !commandValue) throw new Error("WebView " + command + " requires commandValue");
if (typeof script !== "string") throw new Error("WebView script must be a string");
if (backForwardNavigationGestures) assertSwiftUIValue("BackForwardNavigationGesturesBehavior", backForwardNavigationGestures, Number.parseFloat(String(Platform.Version)));
if (magnificationGestures) assertSwiftUIValue("MagnificationGesturesBehavior", magnificationGestures, Number.parseFloat(String(Platform.Version)));
if (linkPreviews) assertSwiftUIValue("LinkPreviewBehavior", linkPreviews, Number.parseFloat(String(Platform.Version)));
if (elementFullscreen) assertSwiftUIValue("ElementFullscreenBehavior", elementFullscreen, Number.parseFloat(String(Platform.Version)));
if (contentBackground) assertSwiftUIValue("Visibility", contentBackground, Number.parseFloat(String(Platform.Version)));
return /* @__PURE__ */ jsx(NativeWebView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
url,
html,
script,
command,
commandRevision,
commandValue,
limitsNavigationsToAppBoundDomains,
inlineMedia,
inspectable,
bounces,
backForwardNavigationGestures,
magnificationGestures,
linkPreviews,
elementFullscreen,
contentBackground,
onNativeWebViewNavigate: function onNativeWebViewNavigate(param2) {
var { nativeEvent } = param2;
return onNavigate === null || onNavigate === void 0 ? void 0 : onNavigate(nativeEvent.url);
},
onNativeWebViewTitleChange: function onNativeWebViewTitleChange(param2) {
var { nativeEvent } = param2;
return onTitleChange === null || onTitleChange === void 0 ? void 0 : onTitleChange(nativeEvent.title);
},
onNativeWebViewLoadingChange: function onNativeWebViewLoadingChange(param2) {
var { nativeEvent } = param2;
return onLoadingChange === null || onLoadingChange === void 0 ? void 0 : onLoadingChange(nativeEvent.loading, nativeEvent.progress);
},
onNativeWebViewLoadStart: function onNativeWebViewLoadStart(param2) {
var { nativeEvent } = param2;
return onLoadStart === null || onLoadStart === void 0 ? void 0 : onLoadStart();
},
onNativeWebViewLoadEnd: function onNativeWebViewLoadEnd(param2) {
var { nativeEvent } = param2;
return onLoadEnd === null || onLoadEnd === void 0 ? void 0 : onLoadEnd();
},
onNativeWebViewError: function onNativeWebViewError(param2) {
var { nativeEvent } = param2;
return onError === null || onError === void 0 ? void 0 : onError(nativeEvent.message);
},
onNativeWebViewHttpError: function onNativeWebViewHttpError(param2) {
var { nativeEvent } = param2;
return onHttpError === null || onHttpError === void 0 ? void 0 : onHttpError(nativeEvent.statusCode);
},
onNativeWebViewMessage: function onNativeWebViewMessage(param2) {
var { nativeEvent } = param2;
return onMessage === null || onMessage === void 0 ? void 0 : onMessage(nativeEvent.data);
},
onNativeWebViewHistoryChange: function onNativeWebViewHistoryChange(param2) {
var { nativeEvent } = param2;
return onHistoryChange === null || onHistoryChange === void 0 ? void 0 : onHistoryChange(nativeEvent.canGoBack, nativeEvent.canGoForward);
},
onNativeWebViewProcessTerminate: function onNativeWebViewProcessTerminate(param2) {
var { nativeEvent } = param2;
return onProcessTerminate === null || onProcessTerminate === void 0 ? void 0 : onProcessTerminate();
}
});
}
function SignInWithAppleButton(param) {
var { onCompletion, requestedScopes = [], nonce = "", label = "signIn", swiftStyle, style, ...props } = param;
if (!Array.isArray(requestedScopes)) throw new Error("SignInWithAppleButton requestedScopes must be an array");
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
try {
for (var _iterator = requestedScopes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var scope = _step.value;
if (scope !== "fullName" && scope !== "email") throw new Error("SignInWithAppleButton scope must be 'fullName' or 'email'");
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
if (typeof nonce !== "string") throw new Error("SignInWithAppleButton nonce must be a string");
if (label !== "signIn" && label !== "continue" && label !== "signUp") throw new Error("SignInWithAppleButton label must be 'signIn', 'continue' or 'signUp'");
return /* @__PURE__ */ jsx(NativeSignInWithAppleButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
requestedScopes,
nonce,
label,
onNativeSignInWithAppleButtonCompletion: function onNativeSignInWithAppleButtonCompletion(param2) {
var { nativeEvent } = param2;
return onCompletion === null || onCompletion === void 0 ? void 0 : onCompletion(nativeEvent.type === "success" ? {
type: "success",
user: nativeEvent.user,
email: nativeEvent.email,
givenName: nativeEvent.givenName,
familyName: nativeEvent.familyName,
identityToken: nativeEvent.identityToken,
authorizationCode: nativeEvent.authorizationCode
} : nativeEvent.type === "failed" ? {
type: "failed",
message: nativeEvent.message
} : { type: "cancelled" });
}
});
}
function PayWithApplePayButton(param) {
var { onPress, label = "plain", payWithApplePayButtonStyle = "black", disabled = false, swiftStyle, style, ...props } = param;
if (typeof label !== "string") throw new Error("PayWithApplePayButton label must be a string");
assertSwiftUIValue("PayWithApplePayButtonLabel", label, Number.parseFloat(String(Platform.Version)));
assertSwiftUIValue("PayWithApplePayButtonStyle", payWithApplePayButtonStyle, Number.parseFloat(String(Platform.Version)));
return /* @__PURE__ */ jsx(NativePayWithApplePayButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
label,
payWithApplePayButtonStyle,
disabled,
onNativePayWithApplePayButtonPress: function onNativePayWithApplePayButtonPress(param2) {
var { nativeEvent } = param2;
return onPress === null || onPress === void 0 ? void 0 : onPress();
}
});
}
function AddPassToWalletButton(param) {
var { onPress, addPassToWalletButtonStyle = "black", disabled = false, swiftStyle, style, ...props } = param;
if (typeof disabled !== "boolean") throw new Error("AddPassToWalletButton disabled must be a boolean");
assertSwiftUIValue("AddPassToWalletButtonStyle", addPassToWalletButtonStyle, Number.parseFloat(String(Platform.Version)));
return /* @__PURE__ */ jsx(NativeAddPassToWalletButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
addPassToWalletButtonStyle,
disabled,
onNativeAddPassToWalletButtonPress: function onNativeAddPassToWalletButtonPress(param2) {
var { nativeEvent } = param2;
return onPress === null || onPress === void 0 ? void 0 : onPress();
}
});
}
function Map(param) {
var { onRegionChange, latitude = 37.7749, longitude = -122.4194, distance = 5e3, markers, swiftStyle, style, ...props } = param;
if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90) throw new Error("Map latitude must be between -90 and 90");
if (!Number.isFinite(longitude) || longitude < -180 || longitude > 180) throw new Error("Map longitude must be between -180 and 180");
if (!Number.isFinite(distance) || distance <= 0) throw new Error("Map distance must be a positive number of metres");
if (!Array.isArray(markers) || markers.some(function(marker) {
return typeof (marker === null || marker === void 0 ? void 0 : marker.id) !== "string" || typeof (marker === null || marker === void 0 ? void 0 : marker.label) !== "string" || !Number.isFinite(marker === null || marker === void 0 ? void 0 : marker.latitude) || !Number.isFinite(marker === null || marker === void 0 ? void 0 : marker.longitude);
})) throw new Error("Map markers must contain string id and label fields and finite latitude and longitude");
if (new Set(markers.map(function(marker) {
return marker.id;
})).size !== markers.length) throw new Error("Map marker ids must be unique");
return /* @__PURE__ */ jsx(NativeMap, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
latitude,
longitude,
distance,
markers,
onNativeMapRegionChange: function onNativeMapRegionChange(param2) {
var { nativeEvent } = param2;
return onRegionChange === null || onRegionChange === void 0 ? void 0 : onRegionChange(nativeEvent.latitude, nativeEvent.longitude, nativeEvent.distance);
}
});
}
function MapCompass(param) {
var { swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativeMapCompass, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
}
});
}
function MapPitchToggle(param) {
var { swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativeMapPitchToggle, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
}
});
}
function MapUserLocationButton(param) {
var { swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativeMapUserLocationButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
}
});
}
function TextField(param) {
var { text, onTextChange, revision = 0, focused, onFocusChange, focusRevision = 0, onSubmit, label = "", disabled = false, prompt = "", textFieldStyle = "automatic", submitLabel = "", textInputAutocapitalization = "", autocorrectionDisabled = false, keyboardType = "", textContentType = "", axis = "horizontal", swiftStyle, style, ...props } = param;
var _getSyncStateId, _ref;
var syncHandle = syncHandleOf(text);
var syncedText = useSyncValue(text);
{
var text1 = syncedText;
if (typeof text1 !== "string" && !isSyncState(text1)) throw new Error("TextField text must be a string or NativeState handle");
assertTextInputOptions("TextField", keyboardType, textContentType);
}
assertSwiftUIValue("TextFieldStyle", textFieldStyle, Number.parseFloat(String(Platform.Version)));
if (submitLabel) assertSwiftUIValue("SubmitLabel", submitLabel, Number.parseFloat(String(Platform.Version)));
if (textInputAutocapitalization) assertSwiftUIValue("TextInputAutocapitalization", textInputAutocapitalization, Number.parseFloat(String(Platform.Version)));
assertSwiftUIValue("Axis", axis, Number.parseFloat(String(Platform.Version)));
var controlled = useControlled(function(event) {
publishNativeSyncState(syncHandle);
onTextChange(event.value);
}, revision);
if (focused !== void 0 && (swiftStyle === null || swiftStyle === void 0 ? void 0 : swiftStyle.focused) !== void 0) throw new Error("TextField focus is controlled by both focused and swiftStyle.focused");
var sdkFocused = swiftStyle === null || swiftStyle === void 0 ? void 0 : swiftStyle.focused;
var nativeSwiftStyle = sdkFocused ? {
...swiftStyle,
focused: void 0
} : swiftStyle;
var controlledFocus = useControlled(function(event) {
onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(event.value);
sdkFocused === null || sdkFocused === void 0 ? void 0 : sdkFocused.onChange(event.value);
}, focusRevision);
return /* @__PURE__ */ jsx(NativeTextField, {
...props,
style,
swiftStyle: swiftStyleNative(nativeSwiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: syncedText,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
syncStateId: syncHandle ? (_getSyncStateId = getSyncStateId(syncHandle)) !== null && _getSyncStateId !== void 0 ? _getSyncStateId : 0 : 0,
focused: (_ref = focused !== null && focused !== void 0 ? focused : sdkFocused === null || sdkFocused === void 0 ? void 0 : sdkFocused.value) !== null && _ref !== void 0 ? _ref : false,
acknowledgedFocusEvent: focused !== void 0 || sdkFocused !== void 0 ? controlledFocus.acknowledgedEvent : 0,
focusRevision,
label,
disabled,
prompt,
textFieldStyle,
submitLabel,
textInputAutocapitalization,
autocorrectionDisabled,
keyboardType,
textContentType,
axis,
onNativeTextFieldValueChange: function onNativeTextFieldValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
},
onNativeTextFieldFocusChange: function onNativeTextFieldFocusChange(param2) {
var { nativeEvent } = param2;
return controlledFocus.onNativeChange(nativeEvent);
},
onNativeTextFieldSubmit: function onNativeTextFieldSubmit(param2) {
var { nativeEvent } = param2;
return onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
}
});
}
function SecureField(param) {
var { text, onTextChange, revision = 0, focused, onFocusChange, focusRevision = 0, onSubmit, label = "", disabled = false, prompt = "", textFieldStyle = "automatic", submitLabel = "", textInputAutocapitalization = "", autocorrectionDisabled = false, keyboardType = "", textContentType = "", swiftStyle, style, ...props } = param;
var _getSyncStateId, _ref;
var syncHandle = syncHandleOf(text);
var syncedText = useSyncValue(text);
{
var text1 = syncedText;
if (typeof text1 !== "string" && !isSyncState(text1)) throw new Error("SecureField text must be a string or NativeState handle");
assertTextInputOptions("SecureField", keyboardType, textContentType);
}
assertSwiftUIValue("TextFieldStyle", textFieldStyle, Number.parseFloat(String(Platform.Version)));
if (submitLabel) assertSwiftUIValue("SubmitLabel", submitLabel, Number.parseFloat(String(Platform.Version)));
if (textInputAutocapitalization) assertSwiftUIValue("TextInputAutocapitalization", textInputAutocapitalization, Number.parseFloat(String(Platform.Version)));
var controlled = useControlled(function(event) {
publishNativeSyncState(syncHandle);
onTextChange(event.value);
}, revision);
if (focused !== void 0 && (swiftStyle === null || swiftStyle === void 0 ? void 0 : swiftStyle.focused) !== void 0) throw new Error("SecureField focus is controlled by both focused and swiftStyle.focused");
var sdkFocused = swiftStyle === null || swiftStyle === void 0 ? void 0 : swiftStyle.focused;
var nativeSwiftStyle = sdkFocused ? {
...swiftStyle,
focused: void 0
} : swiftStyle;
var controlledFocus = useControlled(function(event) {
onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(event.value);
sdkFocused === null || sdkFocused === void 0 ? void 0 : sdkFocused.onChange(event.value);
}, focusRevision);
return /* @__PURE__ */ jsx(NativeSecureField, {
...props,
style,
swiftStyle: swiftStyleNative(nativeSwiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: syncedText,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
syncStateId: syncHandle ? (_getSyncStateId = getSyncStateId(syncHandle)) !== null && _getSyncStateId !== void 0 ? _getSyncStateId : 0 : 0,
focused: (_ref = focused !== null && focused !== void 0 ? focused : sdkFocused === null || sdkFocused === void 0 ? void 0 : sdkFocused.value) !== null && _ref !== void 0 ? _ref : false,
acknowledgedFocusEvent: focused !== void 0 || sdkFocused !== void 0 ? controlledFocus.acknowledgedEvent : 0,
focusRevision,
label,
disabled,
prompt,
textFieldStyle,
submitLabel,
textInputAutocapitalization,
autocorrectionDisabled,
keyboardType,
textContentType,
onNativeSecureFieldValueChange: function onNativeSecureFieldValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
},
onNativeSecureFieldFocusChange: function onNativeSecureFieldFocusChange(param2) {
var { nativeEvent } = param2;
return controlledFocus.onNativeChange(nativeEvent);
},
onNativeSecureFieldSubmit: function onNativeSecureFieldSubmit(param2) {
var { nativeEvent } = param2;
return onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
}
});
}
function TextEditor(param) {
var { text, onTextChange, revision = 0, focused, onFocusChange, focusRevision = 0, disabled = false, textInputAutocapitalization = "", autocorrectionDisabled = false, keyboardType = "", textContentType = "", swiftStyle, style, ...props } = param;
var _getSyncStateId, _ref;
var syncHandle = syncHandleOf(text);
var syncedText = useSyncValue(text);
{
var text1 = syncedText;
if (typeof text1 !== "string" && !isSyncState(text1)) throw new Error("TextEditor text must be a string or NativeState handle");
assertTextInputOptions("TextEditor", keyboardType, textContentType);
}
if (textInputAutocapitalization) assertSwiftUIValue("TextInputAutocapitalization", textInputAutocapitalization, Number.parseFloat(String(Platform.Version)));
var controlled = useControlled(function(event) {
publishNativeSyncState(syncHandle);
onTextChange(event.value);
}, revision);
if (focused !== void 0 && (swiftStyle === null || swiftStyle === void 0 ? void 0 : swiftStyle.focused) !== void 0) throw new Error("TextEditor focus is controlled by both focused and swiftStyle.focused");
var sdkFocused = swiftStyle === null || swiftStyle === void 0 ? void 0 : swiftStyle.focused;
var nativeSwiftStyle = sdkFocused ? {
...swiftStyle,
focused: void 0
} : swiftStyle;
var controlledFocus = useControlled(function(event) {
onFocusChange === null || onFocusChange === void 0 ? void 0 : onFocusChange(event.value);
sdkFocused === null || sdkFocused === void 0 ? void 0 : sdkFocused.onChange(event.value);
}, focusRevision);
return /* @__PURE__ */ jsx(NativeTextEditor, {
...props,
style,
swiftStyle: swiftStyleNative(nativeSwiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: syncedText,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
syncStateId: syncHandle ? (_getSyncStateId = getSyncStateId(syncHandle)) !== null && _getSyncStateId !== void 0 ? _getSyncStateId : 0 : 0,
focused: (_ref = focused !== null && focused !== void 0 ? focused : sdkFocused === null || sdkFocused === void 0 ? void 0 : sdkFocused.value) !== null && _ref !== void 0 ? _ref : false,
acknowledgedFocusEvent: focused !== void 0 || sdkFocused !== void 0 ? controlledFocus.acknowledgedEvent : 0,
focusRevision,
disabled,
textInputAutocapitalization,
autocorrectionDisabled,
keyboardType,
textContentType,
onNativeTextEditorValueChange: function onNativeTextEditorValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
},
onNativeTextEditorFocusChange: function onNativeTextEditorFocusChange(param2) {
var { nativeEvent } = param2;
return controlledFocus.onNativeChange(nativeEvent);
}
});
}
function Alert(param) {
var { isPresented, onIsPresentedChange, revision = 0, onAction, title = "", message = "", presenting = void 0, actions, swiftStyle, style, ...props } = param;
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
try {
for (var _iterator = actions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var action = _step.value;
if (typeof (action === null || action === void 0 ? void 0 : action.id) !== "string" || typeof (action === null || action === void 0 ? void 0 : action.label) !== "string") throw new Error("Alert actions must contain string id and label fields");
if (action.role) assertSwiftUIValue("ButtonRole", action.role, Number.parseFloat(String(Platform.Version)));
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
if (new Set(actions.map(function(action2) {
return action2.id;
})).size !== actions.length) throw new Error("Alert action ids must be unique");
if (presenting !== void 0 && typeof presenting !== "string") throw new Error("Alert presenting must be a string");
if (!actions.length) throw new Error("Alert must have at least one action");
var controlled = useControlled(function(event) {
return onIsPresentedChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeAlert, {
...props,
style: [{
position: "absolute",
width: 0,
height: 0
}, style],
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: isPresented,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
title,
message,
presenting: presenting !== null && presenting !== void 0 ? presenting : "",
hasPresenting: presenting !== void 0,
actions,
onNativeAlertValueChange: function onNativeAlertValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
},
onNativeAlertAction: function onNativeAlertAction(param2) {
var { nativeEvent } = param2;
return onAction === null || onAction === void 0 ? void 0 : onAction(nativeEvent.id, nativeEvent.presenting);
}
});
}
function ConfirmationDialog(param) {
var { isPresented, onIsPresentedChange, revision = 0, onAction, title = "", message = "", presenting = void 0, actions, titleVisibility = "automatic", swiftStyle, style, ...props } = param;
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
try {
for (var _iterator = actions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var action = _step.value;
if (typeof (action === null || action === void 0 ? void 0 : action.id) !== "string" || typeof (action === null || action === void 0 ? void 0 : action.label) !== "string") throw new Error("ConfirmationDialog actions must contain string id and label fields");
if (action.role) assertSwiftUIValue("ButtonRole", action.role, Number.parseFloat(String(Platform.Version)));
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
if (new Set(actions.map(function(action2) {
return action2.id;
})).size !== actions.length) throw new Error("ConfirmationDialog action ids must be unique");
if (presenting !== void 0 && typeof presenting !== "string") throw new Error("ConfirmationDialog presenting must be a string");
if (!actions.length) throw new Error("ConfirmationDialog must have at least one action");
assertSwiftUIValue("Visibility", titleVisibility, Number.parseFloat(String(Platform.Version)));
var controlled = useControlled(function(event) {
return onIsPresentedChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeConfirmationDialog, {
...props,
style: [{
position: "absolute",
width: 0,
height: 0
}, style],
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: isPresented,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
title,
message,
presenting: presenting !== null && presenting !== void 0 ? presenting : "",
hasPresenting: presenting !== void 0,
actions,
titleVisibility,
onNativeConfirmationDialogValueChange: function onNativeConfirmationDialogValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
},
onNativeConfirmationDialogAction: function onNativeConfirmationDialogAction(param2) {
var { nativeEvent } = param2;
return onAction === null || onAction === void 0 ? void 0 : onAction(nativeEvent.id, nativeEvent.presenting);
}
});
}
function QuickLook(param) {
var { isPresented, onIsPresentedChange, revision = 0, url = "", swiftStyle, style, ...props } = param;
if (typeof url !== "string" || !url) throw new Error("QuickLook url must be a non-empty string");
if (!url.startsWith("file://") && !url.startsWith("http://") && !url.startsWith("https://")) throw new Error("QuickLook url must use file, http, or https");
var controlled = useControlled(function(event) {
return onIsPresentedChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeQuickLook, {
...props,
style: [{
position: "absolute",
width: 0,
height: 0
}, style],
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: isPresented,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
url,
onNativeQuickLookValueChange: function onNativeQuickLookValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
}
});
}
function FileImporter(param) {
var { isPresented, onIsPresentedChange, revision = 0, onCompletion, allowedContentTypes = [], allowsMultipleSelection = false, swiftStyle, style, ...props } = param;
if (!Array.isArray(allowedContentTypes)) throw new Error("FileImporter allowedContentTypes must be an array");
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
try {
for (var _iterator = allowedContentTypes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var identifier = _step.value;
if (typeof identifier !== "string" || !identifier) throw new Error("FileImporter content types must be non-empty UTType identifier strings");
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
if (typeof allowsMultipleSelection !== "boolean") throw new Error("FileImporter allowsMultipleSelection must be a boolean");
var controlled = useControlled(function(event) {
return onIsPresentedChange(event.value);
}, revision);
return /* @__PURE__ */ jsx(NativeFileImporter, {
...props,
style: [{
position: "absolute",
width: 0,
height: 0
}, style],
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
value: isPresented,
acknowledgedEvent: controlled.acknowledgedEvent,
revision,
allowedContentTypes,
allowsMultipleSelection,
onNativeFileImporterValueChange: function onNativeFileImporterValueChange(param2) {
var { nativeEvent } = param2;
return controlled.onNativeChange(nativeEvent);
},
onNativeFileImporterCompletion: function onNativeFileImporterCompletion(param2) {
var { nativeEvent } = param2;
return onCompletion === null || onCompletion === void 0 ? void 0 : onCompletion(nativeEvent.type === "success" ? {
type: "success",
url: nativeEvent.url,
index: nativeEvent.index,
count: nativeEvent.count
} : nativeEvent.type === "failed" ? {
type: "failed",
message: nativeEvent.message
} : { type: "cancelled" });
}
});
}
function Chart(param) {
var { data, type = "line", showGrid = true, animate = true, showLegend = false, referenceLines = [], lineStyle = void 0, pointStyle = void 0, areaStyle = void 0, barStyle = void 0, pieStyle = void 0, rectangleStyle = void 0, ruleStyle = void 0, swiftStyle, style, ...props } = param;
var chartTypes = [
"line",
"point",
"bar",
"area",
"pie",
"rectangle"
];
if (!chartTypes.includes(type)) throw new Error("Swift.Chart type must be one of " + chartTypes.join(", "));
for (var _i = 0, _iter = [
["showGrid", showGrid],
["animate", animate],
["showLegend", showLegend]
]; _i < _iter.length; _i++) {
var [key, flag] = _iter[_i];
if (typeof flag !== "boolean") throw new Error("Swift.Chart " + key + " must be a boolean");
}
return /* @__PURE__ */ jsx(NativeChart, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
data: chartPointsNative("data", data),
type,
showGrid,
animate,
showLegend,
referenceLines: chartPointsNative("referenceLines", referenceLines),
lineStyle: chartStyleNative("lineStyle", lineStyle, [
"dashArray",
"width",
"pointStyle",
"pointSize",
"color"
]),
pointStyle: chartStyleNative("pointStyle", pointStyle, ["pointStyle", "pointSize"]),
areaStyle: chartStyleNative("areaStyle", areaStyle, ["color"]),
barStyle: chartStyleNative("barStyle", barStyle, ["cornerRadius", "width"]),
pieStyle: chartStyleNative("pieStyle", pieStyle, ["innerRadius", "angularInset"]),
rectangleStyle: chartStyleNative("rectangleStyle", rectangleStyle, ["color", "cornerRadius"]),
ruleStyle: chartStyleNative("ruleStyle", ruleStyle, [
"color",
"lineWidth",
"dashArray"
])
});
}
function AsyncImage(param) {
var { url, scale = 1, swiftStyle, style, ...props } = param;
if (typeof url !== "string") throw new Error("AsyncImage url must be a string");
if (typeof scale !== "number") throw new Error("AsyncImage scale must be a number");
return /* @__PURE__ */ jsx(NativeAsyncImage, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
url,
scale
});
}
function EditButton(param) {
var { swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativeEditButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
}
});
}
function EmptyView(param) {
var { swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativeEmptyView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
}
});
}
function LocationButton(param) {
var { onAction, title = "currentLocation", swiftStyle, style, ...props } = param;
if (typeof title !== "string") throw new Error("LocationButton title must be a string");
if (title !== void 0 && title !== "" && ![
"currentLocation",
"sendCurrentLocation",
"sendMyCurrentLocation",
"shareCurrentLocation",
"shareMyCurrentLocation"
].includes(title)) throw new Error("LocationButton title must be one of currentLocation, sendCurrentLocation, sendMyCurrentLocation, shareCurrentLocation, shareMyCurrentLocation");
return /* @__PURE__ */ jsx(NativeLocationButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
title,
onNativeLocationButtonAction: function onNativeLocationButtonAction(param2) {
var { nativeEvent } = param2;
return onAction === null || onAction === void 0 ? void 0 : onAction();
}
});
}
function ProductView(param) {
var { id, prefersPromotionalIcon = false, swiftStyle, style, ...props } = param;
if (typeof id !== "string") throw new Error("ProductView id must be a string");
if (!id) throw new Error("ProductView id is required");
if (typeof prefersPromotionalIcon !== "boolean") throw new Error("ProductView prefersPromotionalIcon must be a boolean");
return /* @__PURE__ */ jsx(NativeProductView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
id,
prefersPromotionalIcon
});
}
function RenameButton(param) {
var { swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativeRenameButton, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
}
});
}
function ShortcutsLink(param) {
var { onAction, swiftStyle, style, ...props } = param;
return /* @__PURE__ */ jsx(NativeShortcutsLink, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
onNativeShortcutsLinkAction: function onNativeShortcutsLinkAction(param2) {
var { nativeEvent } = param2;
return onAction === null || onAction === void 0 ? void 0 : onAction();
}
});
}
function StoreView(param) {
var { ids, prefersPromotionalIcon = false, swiftStyle, style, ...props } = param;
if (!Array.isArray(ids) || ids.some(function(item) {
return typeof item !== "string";
})) throw new Error("StoreView ids must be an array of strings");
if (typeof prefersPromotionalIcon !== "boolean") throw new Error("StoreView prefersPromotionalIcon must be a boolean");
return /* @__PURE__ */ jsx(NativeStoreView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
ids,
prefersPromotionalIcon
});
}
function SubscriptionStoreView(param) {
var { groupID = void 0, visibleRelationships = void 0, productIDs = void 0, swiftStyle, style, ...props } = param;
if ([groupID, productIDs].filter(function(value) {
return value !== void 0;
}).length !== 1) throw new Error("SubscriptionStoreView takes exactly one of groupID, productIDs");
if (groupID !== void 0 && typeof groupID !== "string") throw new Error("SubscriptionStoreView groupID must be a string");
if (visibleRelationships !== void 0 && typeof visibleRelationships !== "string") throw new Error("SubscriptionStoreView visibleRelationships must be a string");
if (visibleRelationships !== void 0 && ![
"current",
"downgrade",
"crossgrade",
"upgrade",
"all"
].includes(visibleRelationships)) throw new Error("SubscriptionStoreView visibleRelationships must be one of current, downgrade, crossgrade, upgrade, all");
if (productIDs !== void 0 && (!Array.isArray(productIDs) || productIDs.some(function(item) {
return typeof item !== "string";
}))) throw new Error("SubscriptionStoreView productIDs must be an array of strings");
if (productIDs !== void 0 && visibleRelationships !== void 0) throw new Error("SubscriptionStoreView visibleRelationships does not apply with productIDs");
return /* @__PURE__ */ jsx(NativeSubscriptionStoreView, {
...props,
style,
swiftStyle: swiftStyleNative(swiftStyle),
onNativeSDKEvent: function onNativeSDKEvent(param2) {
var { nativeEvent } = param2;
return dispatchSDKEvent(swiftStyle, nativeEvent.name, nativeEvent.value);
},
groupID: groupID !== null && groupID !== void 0 ? groupID : "",
visibleRelationships: visibleRelationships !== null && visibleRelationships !== void 0 ? visibleRelationships : "all",
productIDs: productIDs !== null && productIDs !== void 0 ? productIDs : [],
initializer: groupID !== void 0 ? 0 : productIDs !== void 0 ? 1 : -1
});
}
export { AddPassToWalletButton, Alert, AngularGradient, AsyncImage, Capsule, Chart, Circle, ColorPicker, ConcentricRectangle, ConfirmationDialog, ContentUnavailableView, DatePicker, EditButton, Ellipse, EllipticalGradient, EmptyView, FileImporter, Gauge, Image, Label, LinearGradient, LivePhotoView, LocationButton, Map, MapCompass, MapPitchToggle, MapUserLocationButton, MeshGradient, MultiDatePicker, PasteButton, PayWithApplePayButton, PhotosPicker, Picker, ProductView, ProgressView, QuickLook, RadialGradient, Rectangle, RenameButton, RoundedRectangle, SecureField, ShareLink, ShortcutsLink, SignInWithAppleButton, Slider, Stepper, StoreView, SubscriptionStoreView, Text, TextEditor, TextField, Toggle, UnevenRoundedRectangle, VideoPlayer, WebView };
//# sourceMappingURL=Controls.native.js.map