framer-api 0.0.1-alpha.6 → 0.0.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.ts +221 -112
- package/dist/index.js +12 -13
- package/package.json +10 -11
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ interface Breakpoint {
|
|
|
43
43
|
|
|
44
44
|
type LintRuleNameValue = "forbid-browser-apis";
|
|
45
45
|
type LintIssueSeverityValue = "error" | "warning";
|
|
46
|
+
/** @deprecated The lintCode API was removed. This type will be removed in the near future. */
|
|
46
47
|
type LintConfig = Record<LintRuleNameValue, LintIssueSeverityValue>;
|
|
47
48
|
interface DiagnosticBase {
|
|
48
49
|
message: string;
|
|
@@ -57,10 +58,12 @@ interface DiagnosticSpan {
|
|
|
57
58
|
/** The last character, 0-based. */
|
|
58
59
|
end: ts.LineAndCharacter;
|
|
59
60
|
}
|
|
61
|
+
/** @deprecated The lintCode API was removed. This type will be removed in the near future. */
|
|
60
62
|
interface LintLink {
|
|
61
63
|
url: string;
|
|
62
64
|
text: string;
|
|
63
65
|
}
|
|
66
|
+
/** @deprecated The lintCode API was removed. This type will be removed in the near future. */
|
|
64
67
|
interface LintDiagnostic extends DiagnosticBase {
|
|
65
68
|
/** The span of the invalid code in the file. */
|
|
66
69
|
span: DiagnosticSpan;
|
|
@@ -82,6 +85,7 @@ interface TypecheckDiagnostic extends DiagnosticBase {
|
|
|
82
85
|
declare const getAiServiceInfo: unique symbol;
|
|
83
86
|
declare const sendTrackingEvent: unique symbol;
|
|
84
87
|
declare const environmentInfo: unique symbol;
|
|
88
|
+
declare const initialState: unique symbol;
|
|
85
89
|
declare const showUncheckedPermissionToasts: unique symbol;
|
|
86
90
|
declare const marshal: unique symbol;
|
|
87
91
|
declare const unmarshal: unique symbol;
|
|
@@ -91,6 +95,7 @@ declare const $framerInternal: {
|
|
|
91
95
|
readonly getAiServiceInfo: typeof getAiServiceInfo;
|
|
92
96
|
readonly sendTrackingEvent: typeof sendTrackingEvent;
|
|
93
97
|
readonly environmentInfo: typeof environmentInfo;
|
|
98
|
+
readonly initialState: typeof initialState;
|
|
94
99
|
readonly showUncheckedPermissionToasts: typeof showUncheckedPermissionToasts;
|
|
95
100
|
readonly marshal: typeof marshal;
|
|
96
101
|
readonly unmarshal: typeof unmarshal;
|
|
@@ -1476,15 +1481,19 @@ interface WithDateVariableClass {
|
|
|
1476
1481
|
interface WithDateVariableType {
|
|
1477
1482
|
type: typeof dateVariableType;
|
|
1478
1483
|
}
|
|
1479
|
-
interface
|
|
1484
|
+
interface WithDisplayTime {
|
|
1485
|
+
displayTime?: boolean;
|
|
1480
1486
|
}
|
|
1481
|
-
interface
|
|
1487
|
+
interface DateVariableData extends WithDateVariableClass, BaseVariableData, ExplicitPartial<WithStringDefaultValue>, WithDisplayTime {
|
|
1482
1488
|
}
|
|
1483
|
-
interface
|
|
1489
|
+
interface CreateDateVariable extends WithDateVariableType, CreateVariableBase, Partial<WithStringDefaultValue>, Partial<WithDisplayTime> {
|
|
1490
|
+
}
|
|
1491
|
+
interface UpdateDateVariable extends WithDateVariableType, UpdateVariableBase, Partial<WithStringDefaultValue>, Partial<WithDisplayTime> {
|
|
1484
1492
|
}
|
|
1485
1493
|
declare class DateVariable extends VariableBase {
|
|
1486
1494
|
#private;
|
|
1487
1495
|
readonly type: "date";
|
|
1496
|
+
get displayTime(): boolean | undefined;
|
|
1488
1497
|
constructor(engine: PluginEngine, data: DateVariableData);
|
|
1489
1498
|
static [$framerInternal.unmarshal](engine: PluginEngine, data: DateVariableData): DateVariable;
|
|
1490
1499
|
[$framerInternal.marshal](): DateVariableData;
|
|
@@ -1628,7 +1637,10 @@ declare class LinkField extends FieldBaseWithRequired {
|
|
|
1628
1637
|
readonly type = "link";
|
|
1629
1638
|
}
|
|
1630
1639
|
declare class DateField extends FieldBaseWithRequired {
|
|
1640
|
+
#private;
|
|
1631
1641
|
readonly type = "date";
|
|
1642
|
+
get displayTime(): boolean | undefined;
|
|
1643
|
+
constructor(engine: PluginEngine, collectionId: string, data: DateFieldDefinitionData);
|
|
1632
1644
|
}
|
|
1633
1645
|
declare class FieldDivider extends FieldBase {
|
|
1634
1646
|
readonly type = "divider";
|
|
@@ -2110,6 +2122,7 @@ declare const dateFieldType = "date";
|
|
|
2110
2122
|
type DateFieldType = typeof dateFieldType;
|
|
2111
2123
|
interface DateFieldBase {
|
|
2112
2124
|
type: DateFieldType;
|
|
2125
|
+
displayTime?: boolean;
|
|
2113
2126
|
}
|
|
2114
2127
|
interface DateFieldDefinitionData extends DateFieldBase, WithFieldRequired, FieldDefinitionBase {
|
|
2115
2128
|
}
|
|
@@ -3057,7 +3070,10 @@ declare class CodeFile implements Navigable {
|
|
|
3057
3070
|
showProgressOnInstances(attributes?: ShowProgressOnInstancesAttributes): Promise<void>;
|
|
3058
3071
|
/** @alpha */
|
|
3059
3072
|
removeProgressFromInstances(): Promise<void>;
|
|
3060
|
-
|
|
3073
|
+
/**
|
|
3074
|
+
* @deprecated The implementation of this method was removed. The method will always return an empty array. The method will be removed in the near future.
|
|
3075
|
+
*/
|
|
3076
|
+
lint(_rules: LintConfig): Promise<LintDiagnostic[]>;
|
|
3061
3077
|
typecheck(compilerOptions?: ts.server.protocol.CompilerOptions): Promise<TypecheckDiagnostic[]>;
|
|
3062
3078
|
/**
|
|
3063
3079
|
* Navigate to this code file. May switch modes to reveal the relevant view.
|
|
@@ -3142,45 +3158,22 @@ interface DragCompleteError {
|
|
|
3142
3158
|
type DragCompleteResult = DragCompleteSuccess | DragCompleteError;
|
|
3143
3159
|
type DragCompleteCallback = (result: DragCompleteResult) => void;
|
|
3144
3160
|
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
actionId?: number;
|
|
3161
|
-
submenu?: MenuItemSerializable[];
|
|
3161
|
+
declare const publish: unique symbol;
|
|
3162
|
+
declare const getDeployments: unique symbol;
|
|
3163
|
+
declare const deploy: unique symbol;
|
|
3164
|
+
declare const getChangedPaths: unique symbol;
|
|
3165
|
+
declare const getChangeContributors: unique symbol;
|
|
3166
|
+
declare const createManagedCollection: unique symbol;
|
|
3167
|
+
declare const rejectAllPending: unique symbol;
|
|
3168
|
+
declare const $framerApiOnly: {
|
|
3169
|
+
readonly publish: typeof publish;
|
|
3170
|
+
readonly getDeployments: typeof getDeployments;
|
|
3171
|
+
readonly deploy: typeof deploy;
|
|
3172
|
+
readonly getChangedPaths: typeof getChangedPaths;
|
|
3173
|
+
readonly getChangeContributors: typeof getChangeContributors;
|
|
3174
|
+
readonly createManagedCollection: typeof createManagedCollection;
|
|
3175
|
+
readonly rejectAllPending: typeof rejectAllPending;
|
|
3162
3176
|
};
|
|
3163
|
-
type MenuItemSerializable = NormalMenuItemSerializable | SeparatorMenuItem;
|
|
3164
|
-
type MenuPlacementVertical = "top" | "bottom";
|
|
3165
|
-
type MenuPlacementHorizontal = "left" | "right";
|
|
3166
|
-
type MenuPlacement = MenuPlacementVertical | MenuPlacementHorizontal | `${MenuPlacementVertical}-${MenuPlacementHorizontal}`;
|
|
3167
|
-
interface ContextMenuConfig {
|
|
3168
|
-
/**
|
|
3169
|
-
* Coordinates of the anchor point.
|
|
3170
|
-
*/
|
|
3171
|
-
location: {
|
|
3172
|
-
x: number;
|
|
3173
|
-
y: number;
|
|
3174
|
-
};
|
|
3175
|
-
/**
|
|
3176
|
-
* Placement of the menu relative to the anchor point.
|
|
3177
|
-
*/
|
|
3178
|
-
placement?: MenuPlacement;
|
|
3179
|
-
/**
|
|
3180
|
-
* Sets fixed width for the menu. If not set, the menu width is based on the content.
|
|
3181
|
-
*/
|
|
3182
|
-
width?: number;
|
|
3183
|
-
}
|
|
3184
3177
|
|
|
3185
3178
|
type Ownership = {
|
|
3186
3179
|
type: "project";
|
|
@@ -3230,7 +3223,7 @@ type NamespaceMembers<Class, Namespace extends string, Parent = undefined> = {
|
|
|
3230
3223
|
[Member in Exclude<keyof Class, keyof Parent> as Member extends string ? `${Namespace}.${Member}` : never]: Class[Member];
|
|
3231
3224
|
};
|
|
3232
3225
|
type AllMembers = Omit<FramerPluginAPIAlpha, "isAllowedTo" | "subscribeToIsAllowedTo"> & NamespaceMembers<ImageAsset, "ImageAsset"> & NamespaceMembers<CodeFile, "CodeFile"> & NamespaceMembers<CodeFileVersion, "CodeFileVersion"> & NamespaceMembers<ComponentInstancePlaceholder, "ComponentInstancePlaceholder"> & NamespaceMembers<Field, "Field"> & NamespaceMembers<BooleanField, "BooleanField", Field> & NamespaceMembers<ColorField, "ColorField", Field> & NamespaceMembers<NumberField, "NumberField", Field> & NamespaceMembers<StringField, "StringField", Field> & NamespaceMembers<FormattedTextField, "FormattedTextField", Field> & NamespaceMembers<ImageField, "ImageField", Field> & NamespaceMembers<LinkField, "LinkField", Field> & NamespaceMembers<DateField, "DateField", Field> & NamespaceMembers<FieldDivider, "FieldDivider", Field> & NamespaceMembers<UnsupportedField, "UnsupportedField", Field> & NamespaceMembers<FileField, "FileField", Field> & NamespaceMembers<EnumField, "EnumField", Field> & NamespaceMembers<CollectionReferenceField, "CollectionReferenceField", Field> & NamespaceMembers<MultiCollectionReferenceField, "MultiCollectionReferenceField", Field> & NamespaceMembers<ManagedCollection, "ManagedCollection"> & NamespaceMembers<Collection, "Collection"> & NamespaceMembers<CollectionItem, "CollectionItem"> & NamespaceMembers<NodeMethods, "Node"> & NamespaceMembers<FrameNode, "FrameNode", NodeMethods> & NamespaceMembers<TextNode, "TextNode", NodeMethods> & NamespaceMembers<SVGNode, "SVGNode", NodeMethods> & NamespaceMembers<ComponentInstanceNode, "ComponentInstanceNode", NodeMethods> & NamespaceMembers<WebPageNode, "WebPageNode", NodeMethods> & NamespaceMembers<ComponentNode, "ComponentNode", NodeMethods> & NamespaceMembers<UnknownNode, "UnknownNode", NodeMethods> & NamespaceMembers<ColorStyle, "ColorStyle"> & NamespaceMembers<TextStyle, "TextStyle"> & NamespaceMembers<Variable, "Variable"> & NamespaceMembers<BooleanVariable, "BooleanVariable", Variable> & NamespaceMembers<NumberVariable, "NumberVariable", Variable> & NamespaceMembers<StringVariable, "StringVariable", Variable> & NamespaceMembers<FormattedTextVariable, "FormattedTextVariable", Variable> & NamespaceMembers<EnumCase, "EnumCase"> & NamespaceMembers<EnumVariable, "EnumVariable", Variable> & NamespaceMembers<ColorVariable, "ColorVariable", Variable> & NamespaceMembers<ImageVariable, "ImageVariable", Variable> & NamespaceMembers<FileVariable, "FileVariable", Variable> & NamespaceMembers<LinkVariable, "LinkVariable", Variable> & NamespaceMembers<DateVariable, "DateVariable", Variable> & NamespaceMembers<BorderVariable, "BorderVariable", Variable> & NamespaceMembers<UnsupportedVariable, "UnsupportedVariable", Variable> & NamespaceMembers<VectorSet, "VectorSet"> & NamespaceMembers<VectorSetItem, "VectorSetItem">;
|
|
3233
|
-
declare const unprotectedMessageTypesSource: ["closeNotification", "closePlugin", "getActiveCollection", "getActiveLocale", "getActiveManagedCollection", "getCanvasRoot", "getChildren", "getCollection", "getCollectionFields", "getCollectionFields2", "getCollectionItems", "getCollectionItems2", "getCollections", "getColorStyle", "getColorStyles", "getCurrentUser", "getCurrentUser2", "getCustomCode", "getDefaultLocale", "getFont", "getFonts", "getImage", "getImageData", "getLocales", "getLocalizationGroups", "getManagedCollection", "getManagedCollectionFields", "getManagedCollectionFields2", "getManagedCollectionItemIds", "getManagedCollections", "getNode", "getNodesWithAttribute", "getNodesWithAttributeSet", "getNodesWithType", "getParent", "getPluginData", "getPluginDataForNode", "getPluginDataKeys", "getPluginDataKeysForNode", "getProjectInfo", "getProjectInfo2", "getPublishInfo", "getRect", "getSelection", "getSVGForNode", "getText", "getTextForNode", "getTextStyle", "getTextStyles", "hideUI", "setBackgroundMessage", "notify", "onPointerDown", "setActiveCollection", "setSelection", "showUI", "getCodeFileVersionContent", "
|
|
3226
|
+
declare const unprotectedMessageTypesSource: ["closeNotification", "closePlugin", "setCloseWarning", "getActiveCollection", "getActiveLocale", "getActiveManagedCollection", "getCanvasRoot", "getChildren", "getCollection", "getCollectionFields", "getCollectionFields2", "getCollectionItems", "getCollectionItems2", "getCollections", "getColorStyle", "getColorStyles", "getCurrentUser", "getCurrentUser2", "getCustomCode", "getDefaultLocale", "getFont", "getFonts", "getImage", "getImageData", "getLocales", "getLocalizationGroups", "getManagedCollection", "getManagedCollectionFields", "getManagedCollectionFields2", "getManagedCollectionItemIds", "getManagedCollections", "getNode", "getNodesWithAttribute", "getNodesWithAttributeSet", "getNodesWithType", "getParent", "getPluginData", "getPluginDataForNode", "getPluginDataKeys", "getPluginDataKeysForNode", "getProjectInfo", "getProjectInfo2", "getPublishInfo", "getRect", "getSelection", "getSVGForNode", "getText", "getTextForNode", "getTextStyle", "getTextStyles", "hideUI", "setBackgroundMessage", "notify", "onPointerDown", "setActiveCollection", "setSelection", "showUI", "getCodeFileVersionContent", "typecheckCode", "getCodeFileVersions", "getCodeFiles", "getCodeFile", "getRedirects", "uploadFile", "uploadFiles", "uploadImage", "uploadImages", "zoomIntoView", "navigateTo", "getRuntimeErrorForModule", "getRuntimeErrorForCodeComponentNode", "showProgressOnInstances", "removeProgressFromInstances", "addComponentInstancePlaceholder", "updateComponentInstancePlaceholder", "removeComponentInstancePlaceholder", "setMenu", "showContextMenu", "getBreakpointSuggestionsForWebPage", "getActiveCollectionItemForWebPage", "getVariables", "getVectorSets", "getVectorSetItems", "getVectorSetItemVariables", "getChangedPaths", "getChangeContributors", "getDeployments", "INTERNAL_getAiServiceInfo", "INTERNAL_sendTrackingEvent", "INTERNAL_getHTMLForNode", "getAiServiceInfo", "sendTrackingEvent", "unstable_getCodeFile", "unstable_getCodeFiles", "unstable_getCodeFileVersionContent", "unstable_getCodeFileLint2", "unstable_getCodeFileTypecheck2", "unstable_getCodeFileVersions", "lintCode"];
|
|
3234
3227
|
type UnprotectedMessageType = (typeof unprotectedMessageTypesSource)[number];
|
|
3235
3228
|
type ProtectedMessageType = Exclude<keyof PluginMessageAPI, UnprotectedMessageType>;
|
|
3236
3229
|
type Method = keyof {
|
|
@@ -3295,7 +3288,8 @@ declare const methodToMessageTypes: {
|
|
|
3295
3288
|
readonly hideUI: [];
|
|
3296
3289
|
/** @beta */
|
|
3297
3290
|
readonly setBackgroundMessage: [];
|
|
3298
|
-
|
|
3291
|
+
readonly setCloseWarning: [];
|
|
3292
|
+
/** @deprecated The lintCode API was removed. */
|
|
3299
3293
|
readonly lintCode: [];
|
|
3300
3294
|
readonly makeDraggable: ["onDragEnd", "onDragStart", "onDrag", "setDragData", "preloadDetachedComponentLayers", "preloadImageUrlForInsertion", "preloadDragPreviewImage"];
|
|
3301
3295
|
readonly notify: [];
|
|
@@ -3369,10 +3363,10 @@ declare const methodToMessageTypes: {
|
|
|
3369
3363
|
/** @alpha */
|
|
3370
3364
|
readonly "ComponentInstancePlaceholder.replaceWithComponentInstance": ["replaceComponentInstancePlaceholderWithComponentInstance"];
|
|
3371
3365
|
readonly "Field.remove": ["removeCollectionFields"];
|
|
3372
|
-
readonly "Field.setAttributes": ["
|
|
3366
|
+
readonly "Field.setAttributes": ["addCollectionFields2"];
|
|
3373
3367
|
readonly "EnumField.addCase": ["addEnumCase"];
|
|
3374
3368
|
readonly "EnumField.setCaseOrder": ["setEnumCaseOrder"];
|
|
3375
|
-
readonly "Collection.addFields": ["
|
|
3369
|
+
readonly "Collection.addFields": ["addCollectionFields2"];
|
|
3376
3370
|
readonly "Collection.addItems": ["addCollectionItems2"];
|
|
3377
3371
|
readonly "Collection.getFields": [];
|
|
3378
3372
|
readonly "Collection.getItems": [];
|
|
@@ -3454,27 +3448,24 @@ declare const methodToMessageTypes: {
|
|
|
3454
3448
|
readonly "EnumVariable.addCase": ["addEnumCase"];
|
|
3455
3449
|
/** @alpha */
|
|
3456
3450
|
readonly "EnumVariable.setCaseOrder": ["setEnumCaseOrder"];
|
|
3457
|
-
/** @alpha */
|
|
3458
|
-
readonly publish: ["publish"];
|
|
3459
|
-
/** @alpha */
|
|
3460
|
-
readonly getDeployments: [];
|
|
3461
|
-
/** @alpha */
|
|
3462
|
-
readonly deploy: ["deploy"];
|
|
3463
|
-
/** @alpha */
|
|
3464
|
-
readonly getChangedPagePaths: [];
|
|
3465
|
-
/** @alpha */
|
|
3466
|
-
readonly getChangeAuthors: [];
|
|
3467
3451
|
readonly createCollection: ["createCollection"];
|
|
3468
|
-
/** @alpha */
|
|
3469
3452
|
readonly createManagedCollection: ["createManagedCollection"];
|
|
3470
3453
|
readonly [getAiServiceInfo]: [];
|
|
3471
3454
|
readonly [sendTrackingEvent]: [];
|
|
3472
3455
|
readonly [getHTMLForNode]: [];
|
|
3473
3456
|
readonly [setHTMLForNode]: [];
|
|
3457
|
+
readonly [publish]: ["publish"];
|
|
3458
|
+
readonly [getDeployments]: [];
|
|
3459
|
+
readonly [deploy]: ["deploy"];
|
|
3460
|
+
readonly [getChangedPaths]: [];
|
|
3461
|
+
readonly [getChangeContributors]: [];
|
|
3462
|
+
readonly [createManagedCollection]: ["createManagedCollection"];
|
|
3463
|
+
readonly [rejectAllPending]: [];
|
|
3474
3464
|
};
|
|
3475
|
-
type
|
|
3465
|
+
type AllMethods = keyof {
|
|
3476
3466
|
[K in Method as (typeof methodToMessageTypes)[K] extends [] ? never : K]: (typeof methodToMessageTypes)[K];
|
|
3477
3467
|
};
|
|
3468
|
+
type ProtectedMethod = AllMethods & string;
|
|
3478
3469
|
type PerMethodPermissionMap = {
|
|
3479
3470
|
[K in ProtectedMethod]: boolean;
|
|
3480
3471
|
};
|
|
@@ -3679,6 +3670,55 @@ type PluginSubscriptionEvent = PluginSubscriptionPublishInfo | PluginSubscriptio
|
|
|
3679
3670
|
type PluginSubscriptionTopic = PluginSubscriptionEvent["topic"];
|
|
3680
3671
|
type PluginToVekterMessage = PluginMethodInvocation | PluginSubscription | PluginReadySignal;
|
|
3681
3672
|
|
|
3673
|
+
type PickModes<T extends Mode> = Extract<Mode, T>;
|
|
3674
|
+
type InitialState = {
|
|
3675
|
+
mode: Mode;
|
|
3676
|
+
intent: "plugin/open";
|
|
3677
|
+
} | {
|
|
3678
|
+
mode: PickModes<"collection" | "syncManagedCollection" | "configureManagedCollection">;
|
|
3679
|
+
intent: "collection/add";
|
|
3680
|
+
};
|
|
3681
|
+
|
|
3682
|
+
interface SeparatorMenuItem {
|
|
3683
|
+
type: "separator";
|
|
3684
|
+
}
|
|
3685
|
+
interface NormalMenuItem {
|
|
3686
|
+
type?: never;
|
|
3687
|
+
label: string;
|
|
3688
|
+
secondaryLabel?: string;
|
|
3689
|
+
enabled?: boolean;
|
|
3690
|
+
visible?: boolean;
|
|
3691
|
+
checked?: boolean;
|
|
3692
|
+
submenu?: MenuItem[];
|
|
3693
|
+
onAction?: () => void;
|
|
3694
|
+
}
|
|
3695
|
+
type MenuItem = NormalMenuItem | SeparatorMenuItem;
|
|
3696
|
+
type NormalMenuItemSerializable = Omit<NormalMenuItem, "onAction" | "submenu"> & {
|
|
3697
|
+
actionId?: number;
|
|
3698
|
+
submenu?: MenuItemSerializable[];
|
|
3699
|
+
};
|
|
3700
|
+
type MenuItemSerializable = NormalMenuItemSerializable | SeparatorMenuItem;
|
|
3701
|
+
type MenuPlacementVertical = "top" | "bottom";
|
|
3702
|
+
type MenuPlacementHorizontal = "left" | "right";
|
|
3703
|
+
type MenuPlacement = MenuPlacementVertical | MenuPlacementHorizontal | `${MenuPlacementVertical}-${MenuPlacementHorizontal}`;
|
|
3704
|
+
interface ContextMenuConfig {
|
|
3705
|
+
/**
|
|
3706
|
+
* Coordinates of the anchor point.
|
|
3707
|
+
*/
|
|
3708
|
+
location: {
|
|
3709
|
+
x: number;
|
|
3710
|
+
y: number;
|
|
3711
|
+
};
|
|
3712
|
+
/**
|
|
3713
|
+
* Placement of the menu relative to the anchor point.
|
|
3714
|
+
*/
|
|
3715
|
+
placement?: MenuPlacement;
|
|
3716
|
+
/**
|
|
3717
|
+
* Sets fixed width for the menu. If not set, the menu width is based on the content.
|
|
3718
|
+
*/
|
|
3719
|
+
width?: number;
|
|
3720
|
+
}
|
|
3721
|
+
|
|
3682
3722
|
type NotificationVariant = "info" | "success" | "error" | "warning";
|
|
3683
3723
|
interface NotifyOptionsBase {
|
|
3684
3724
|
/** The Notification variant for styling of the notification. Defaults to "info" */
|
|
@@ -3874,7 +3914,7 @@ declare class FramerPluginAPI {
|
|
|
3874
3914
|
/** Add a component instance by module URL. */
|
|
3875
3915
|
addComponentInstance({ url, attributes, parentId, }: AddComponentInstanceOptions): Promise<ComponentInstanceNode>;
|
|
3876
3916
|
/** Adds the layers of a component by module URL. */
|
|
3877
|
-
addDetachedComponentLayers({ url, layout, attributes
|
|
3917
|
+
addDetachedComponentLayers({ url, layout, attributes }: AddDetachedComponentLayersOptions): Promise<FrameNode>;
|
|
3878
3918
|
/** Preload the component layers for detached insertion. */
|
|
3879
3919
|
preloadDetachedComponentLayers(url: string): Promise<void>;
|
|
3880
3920
|
preloadImageUrlForInsertion(url: string): Promise<void>;
|
|
@@ -3987,15 +4027,19 @@ declare class FramerPluginAPI {
|
|
|
3987
4027
|
* @param fileName - The name of the code file, must include the extension. Use `*.tsx` for TSX files, otherwise the React JSX syntax will be rejected.
|
|
3988
4028
|
* @param content - The content of the code file.
|
|
3989
4029
|
* @param rules - The rules to use for linting.
|
|
4030
|
+
*
|
|
4031
|
+
* @deprecated The implementation of this method was removed. The method will always return an empty array. The method will be removed in the near future.
|
|
3990
4032
|
*/
|
|
3991
|
-
lintCode(
|
|
4033
|
+
lintCode(_fileName: string, _content: string, _rules: LintConfig): Promise<LintDiagnostic[]>;
|
|
3992
4034
|
/**
|
|
3993
4035
|
* Type check a code file and return the diagnostics.
|
|
3994
4036
|
*
|
|
3995
4037
|
* @param fileName - The name of the code file, must include the extension. Use `*.tsx` for TSX files, otherwise the React JSX syntax will be rejected.
|
|
3996
4038
|
* @param content - The content of the code file.
|
|
4039
|
+
* @param compilerOptions - Optional compiler options to override the default compiler options for type checking.
|
|
4040
|
+
* @param sessionId - Optional session ID. Pass it when repeatedly type checking the same file. If not provided, a new session will be created for each type check, which is slow.
|
|
3997
4041
|
*/
|
|
3998
|
-
typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions): Promise<TypecheckDiagnostic[]>;
|
|
4042
|
+
typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions, sessionId?: string): Promise<TypecheckDiagnostic[]>;
|
|
3999
4043
|
/**
|
|
4000
4044
|
* Subscribe to changes in code files.
|
|
4001
4045
|
* This will be called when code files are added, removed, or updated and will return an array of
|
|
@@ -4060,6 +4104,20 @@ declare class FramerPluginAPI {
|
|
|
4060
4104
|
* Create a new collection.
|
|
4061
4105
|
*/
|
|
4062
4106
|
createCollection(name: string): Promise<Collection>;
|
|
4107
|
+
/**
|
|
4108
|
+
* Create a new managed collection.
|
|
4109
|
+
*/
|
|
4110
|
+
createManagedCollection(name: string): Promise<ManagedCollection>;
|
|
4111
|
+
/**
|
|
4112
|
+
* Set a warning message to show when the user attempts to close the plugin. Set to false to disable.
|
|
4113
|
+
* - `string` to enable with a custom message.
|
|
4114
|
+
* - `false` to disable.
|
|
4115
|
+
* */
|
|
4116
|
+
setCloseWarning(message: string | false): Promise<void>;
|
|
4117
|
+
/**
|
|
4118
|
+
* Initial state data passed from Vekter during handshake.
|
|
4119
|
+
*/
|
|
4120
|
+
get [$framerInternal.initialState](): InitialState;
|
|
4063
4121
|
}
|
|
4064
4122
|
/** @beta */
|
|
4065
4123
|
declare class FramerPluginAPIBeta extends FramerPluginAPI {
|
|
@@ -4114,48 +4172,35 @@ declare class FramerPluginAPIAlpha extends FramerPluginAPIBeta {
|
|
|
4114
4172
|
* @alpha
|
|
4115
4173
|
*/
|
|
4116
4174
|
getVectorSets(): Promise<VectorSet[]>;
|
|
4117
|
-
/**
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
/**
|
|
4124
|
-
|
|
4125
|
-
* currently only intended to be used by framer-api
|
|
4126
|
-
* @alpha
|
|
4127
|
-
*/
|
|
4128
|
-
getDeployments(): Promise<Deployment[]>;
|
|
4129
|
-
/**
|
|
4130
|
-
* Deploy a specific version to one or more domains.
|
|
4131
|
-
* If no domains specified, deploys to all custom domains with auto-deploy enabled.
|
|
4132
|
-
* currently only intended to be used by framer-api
|
|
4133
|
-
* @alpha
|
|
4134
|
-
*/
|
|
4135
|
-
deploy(deploymentId: string, domains?: string[]): Promise<Hostname[]>;
|
|
4136
|
-
/**
|
|
4137
|
-
* Get paths of pages changed between versions.
|
|
4138
|
-
* currently only intended to be used by framer-api
|
|
4139
|
-
* @alpha
|
|
4140
|
-
*/
|
|
4141
|
-
getChangedPagePaths(fromVersion?: number, toVersion?: number): Promise<{
|
|
4175
|
+
/** @internal - Available only through framer-api */
|
|
4176
|
+
[$framerApiOnly.publish](): Promise<PublishResult>;
|
|
4177
|
+
/** @internal - Available only through framer-api */
|
|
4178
|
+
[$framerApiOnly.getDeployments](): Promise<Deployment[]>;
|
|
4179
|
+
/** @internal - Available only through framer-api */
|
|
4180
|
+
[$framerApiOnly.deploy](deploymentId: string, domains?: string[]): Promise<Hostname[]>;
|
|
4181
|
+
/** @internal - Available only through framer-api */
|
|
4182
|
+
[$framerApiOnly.getChangedPaths](): Promise<{
|
|
4142
4183
|
added: string[];
|
|
4143
4184
|
removed: string[];
|
|
4144
4185
|
modified: string[];
|
|
4145
4186
|
}>;
|
|
4187
|
+
/** @internal - Available only through framer-api */
|
|
4188
|
+
[$framerApiOnly.getChangeContributors](fromVersion?: number, toVersion?: number): Promise<string[]>;
|
|
4146
4189
|
/**
|
|
4147
|
-
*
|
|
4148
|
-
*
|
|
4149
|
-
*
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
* Create a new managed collection.
|
|
4154
|
-
* currently only intended to be used by framer-api
|
|
4155
|
-
* @alpha
|
|
4156
|
-
*/
|
|
4157
|
-
createManagedCollection(name: string): Promise<ManagedCollection>;
|
|
4190
|
+
* @deprecated Use `createManagedCollection` instead.
|
|
4191
|
+
* @internal - Available only through framer-api
|
|
4192
|
+
* */
|
|
4193
|
+
[$framerApiOnly.createManagedCollection](name: string): Promise<ManagedCollection>;
|
|
4194
|
+
/** @internal - Rejects all pending method calls with the given error */
|
|
4195
|
+
[$framerApiOnly.rejectAllPending](error: FramerPluginError): void;
|
|
4158
4196
|
}
|
|
4197
|
+
/**
|
|
4198
|
+
* Methods that are only available through framer-api (server API),
|
|
4199
|
+
* not through the plugin API.
|
|
4200
|
+
*/
|
|
4201
|
+
type FramerApiOnlyMethods = {
|
|
4202
|
+
[K in keyof typeof $framerApiOnly]: FramerPluginAPIAlpha[(typeof $framerApiOnly)[K]];
|
|
4203
|
+
};
|
|
4159
4204
|
interface UIOptions {
|
|
4160
4205
|
/** The preferred UI width. */
|
|
4161
4206
|
width?: number;
|
|
@@ -4223,6 +4268,7 @@ type MessageApiDragData = ComponentDragData | OtherDragData;
|
|
|
4223
4268
|
interface PluginMessageAPI {
|
|
4224
4269
|
hideUI: FramerPluginAPI["hideUI"];
|
|
4225
4270
|
setBackgroundMessage: FramerPluginAPI["setBackgroundMessage"];
|
|
4271
|
+
setCloseWarning: (message: string | false) => Promise<void>;
|
|
4226
4272
|
closePlugin: (...parameters: Parameters<FramerPluginAPI["closePlugin"]>) => Promise<void>;
|
|
4227
4273
|
removeNode: FramerPluginAPI["removeNode"];
|
|
4228
4274
|
removeNodes: FramerPluginAPI["removeNodes"];
|
|
@@ -4308,7 +4354,6 @@ interface PluginMessageAPI {
|
|
|
4308
4354
|
addManagedCollectionItems: (id: NodeId, items: ApiV2ManagedCollectionItemInput[]) => Promise<void>;
|
|
4309
4355
|
addManagedCollectionItems2: (id: NodeId, items: ManagedCollectionItemInput[]) => Promise<void>;
|
|
4310
4356
|
removeManagedCollectionItems: (id: NodeId, itemIds: string[]) => Promise<void>;
|
|
4311
|
-
/** @beta */
|
|
4312
4357
|
createCollection: (name: string) => Promise<CollectionData>;
|
|
4313
4358
|
getCollection: (id: NodeId) => Promise<CollectionData | null>;
|
|
4314
4359
|
getActiveCollection: () => Promise<CollectionData | null>;
|
|
@@ -4379,8 +4424,9 @@ interface PluginMessageAPI {
|
|
|
4379
4424
|
setCodeFileContent: (id: string, code: string) => Promise<CodeFileData>;
|
|
4380
4425
|
getCodeFileVersions: (id: string) => Promise<readonly CodeFileVersionData[]>;
|
|
4381
4426
|
getCodeFileVersionContent: (fileId: string, versionId: string) => Promise<string>;
|
|
4427
|
+
/** @deprecated The lintCode API was removed. */
|
|
4382
4428
|
lintCode(fileName: string, content: string, rules: LintConfig): Promise<LintDiagnostic[]>;
|
|
4383
|
-
typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions): Promise<TypecheckDiagnostic[]>;
|
|
4429
|
+
typecheckCode(fileName: string, content: string, compilerOptions?: ts.server.protocol.CompilerOptions, sessionId?: string): Promise<TypecheckDiagnostic[]>;
|
|
4384
4430
|
addRedirects: (redirects: RedirectInput[]) => Promise<RedirectData[]>;
|
|
4385
4431
|
getRedirects: () => Promise<readonly RedirectData[]>;
|
|
4386
4432
|
setRedirectOrder: (redirectIds: string[]) => Promise<void>;
|
|
@@ -4403,13 +4449,13 @@ interface PluginMessageAPI {
|
|
|
4403
4449
|
/** @alpha */
|
|
4404
4450
|
deploy: (deploymentId: string, domains?: string[]) => Promise<Hostname[]>;
|
|
4405
4451
|
/** @alpha */
|
|
4406
|
-
|
|
4452
|
+
getChangedPaths: () => Promise<{
|
|
4407
4453
|
added: string[];
|
|
4408
4454
|
removed: string[];
|
|
4409
4455
|
modified: string[];
|
|
4410
4456
|
}>;
|
|
4411
4457
|
/** @alpha */
|
|
4412
|
-
|
|
4458
|
+
getChangeContributors: (fromVersion?: number, toVersion?: number) => Promise<string[]>;
|
|
4413
4459
|
/** @alpha */
|
|
4414
4460
|
createManagedCollection: (name: string) => Promise<CollectionData>;
|
|
4415
4461
|
[getAiServiceInfoMessageType]: () => Promise<AiServiceInfo>;
|
|
@@ -4461,6 +4507,7 @@ interface PluginApiContext {
|
|
|
4461
4507
|
environmentInfo: EnvironmentInfo | null;
|
|
4462
4508
|
origin: string | null;
|
|
4463
4509
|
theme: Theme | null;
|
|
4510
|
+
initialState: InitialState | null;
|
|
4464
4511
|
}
|
|
4465
4512
|
declare class PluginEngine {
|
|
4466
4513
|
methodInvocationId: number;
|
|
@@ -4477,8 +4524,11 @@ declare class PluginEngine {
|
|
|
4477
4524
|
readonly messageTypesCheckedInIsAllowedTo: Set<ProtectedMessageType>;
|
|
4478
4525
|
showUncheckedPermissionToasts: boolean;
|
|
4479
4526
|
readonly environmentInfo: EnvironmentInfo | null;
|
|
4527
|
+
/** @internal - Initial state passed from Vekter during handshake. */
|
|
4528
|
+
readonly initialState: InitialState;
|
|
4480
4529
|
menuItemOnActionCallbackMap: Map<number, () => void>;
|
|
4481
4530
|
contextMenuItemOnActionCallbackMap: Map<number, () => void>;
|
|
4531
|
+
rejectAllPending(error: Error): void;
|
|
4482
4532
|
constructor(context?: PluginApiContext);
|
|
4483
4533
|
invoke<MessageType extends keyof PluginMessageAPI>(messageType: MessageType, ...args: Parameters<PluginMessageAPI[MessageType]>): Promise<Awaited<ReturnType<PluginMessageAPI[MessageType]>>>;
|
|
4484
4534
|
invokeTransferable<MessageType extends keyof PluginMessageAPI>(messageType: MessageType, transfer: Transferable[] | undefined, ...args: Parameters<PluginMessageAPI[MessageType]>): Promise<Awaited<ReturnType<PluginMessageAPI[MessageType]>>>;
|
|
@@ -4635,10 +4685,59 @@ declare const framer: FramerPluginAPIAlpha;
|
|
|
4635
4685
|
|
|
4636
4686
|
declare function configure(environment: Record<string, string | undefined>): void;
|
|
4637
4687
|
|
|
4688
|
+
declare enum ErrorCode {
|
|
4689
|
+
PROJECT_CLOSED = "PROJECT_CLOSED",
|
|
4690
|
+
POOL_EXHAUSTED = "POOL_EXHAUSTED",
|
|
4691
|
+
TIMEOUT = "TIMEOUT",
|
|
4692
|
+
INTERNAL = "INTERNAL",
|
|
4693
|
+
NODE_NOT_FOUND = "NODE_NOT_FOUND",
|
|
4694
|
+
SCREENSHOT_TOO_LARGE = "SCREENSHOT_TOO_LARGE",
|
|
4695
|
+
INVALID_REQUEST = "INVALID_REQUEST",
|
|
4696
|
+
UNAUTHORIZED = "UNAUTHORIZED"
|
|
4697
|
+
}
|
|
4698
|
+
declare class FramerAPIError extends Error {
|
|
4699
|
+
readonly code: ErrorCode;
|
|
4700
|
+
constructor(message: string, code: ErrorCode);
|
|
4701
|
+
}
|
|
4702
|
+
declare function isRetryableError(error: unknown): boolean;
|
|
4703
|
+
|
|
4704
|
+
interface ScreenshotOptions {
|
|
4705
|
+
/**
|
|
4706
|
+
* Image format.
|
|
4707
|
+
* @default "png"
|
|
4708
|
+
*/
|
|
4709
|
+
format?: "png" | "jpeg";
|
|
4710
|
+
/**
|
|
4711
|
+
* JPEG quality (0-100).
|
|
4712
|
+
* Only applies when format is "jpeg".
|
|
4713
|
+
* @default 100
|
|
4714
|
+
*/
|
|
4715
|
+
quality?: number;
|
|
4716
|
+
/**
|
|
4717
|
+
* Pixel density multiplier for retina/HiDPI screenshots.
|
|
4718
|
+
* @default 1
|
|
4719
|
+
*/
|
|
4720
|
+
scale?: 0.5 | 1 | 1.5 | 2 | 3 | 4;
|
|
4721
|
+
/**
|
|
4722
|
+
* Clip region in CSS pixels (before scale).
|
|
4723
|
+
* Captures only this portion of the node.
|
|
4724
|
+
*/
|
|
4725
|
+
clip?: {
|
|
4726
|
+
x: number;
|
|
4727
|
+
y: number;
|
|
4728
|
+
width: number;
|
|
4729
|
+
height: number;
|
|
4730
|
+
};
|
|
4731
|
+
}
|
|
4732
|
+
interface ScreenshotResult {
|
|
4733
|
+
data: Buffer;
|
|
4734
|
+
mimeType: string;
|
|
4735
|
+
}
|
|
4638
4736
|
declare const enabledMethods: {
|
|
4639
4737
|
showUI: false;
|
|
4640
4738
|
hideUI: false;
|
|
4641
4739
|
closePlugin: false;
|
|
4740
|
+
setCloseWarning: true;
|
|
4642
4741
|
notify: false;
|
|
4643
4742
|
setMenu: false;
|
|
4644
4743
|
showContextMenu: false;
|
|
@@ -4721,6 +4820,7 @@ declare const enabledMethods: {
|
|
|
4721
4820
|
createCodeFile: true;
|
|
4722
4821
|
getCodeFiles: true;
|
|
4723
4822
|
getCodeFile: true;
|
|
4823
|
+
/** @deprecated The lintCode API was removed. */
|
|
4724
4824
|
lintCode: true;
|
|
4725
4825
|
typecheckCode: true;
|
|
4726
4826
|
addRedirects: true;
|
|
@@ -4728,12 +4828,6 @@ declare const enabledMethods: {
|
|
|
4728
4828
|
setRedirectOrder: true;
|
|
4729
4829
|
removeRedirects: true;
|
|
4730
4830
|
addComponentInstancePlaceholder: true;
|
|
4731
|
-
publish: true;
|
|
4732
|
-
getDeployments: true;
|
|
4733
|
-
deploy: true;
|
|
4734
|
-
getChangedPagePaths: true;
|
|
4735
|
-
getChangeAuthors: true;
|
|
4736
|
-
createManagedCollection: true;
|
|
4737
4831
|
createCollection: true;
|
|
4738
4832
|
getVectorSets: true;
|
|
4739
4833
|
createDesignPage: true;
|
|
@@ -4741,8 +4835,9 @@ declare const enabledMethods: {
|
|
|
4741
4835
|
createTextNode: true;
|
|
4742
4836
|
createComponentNode: true;
|
|
4743
4837
|
mode: true;
|
|
4744
|
-
isAllowedTo:
|
|
4838
|
+
isAllowedTo: false;
|
|
4745
4839
|
createFrameNode: true;
|
|
4840
|
+
createManagedCollection: true;
|
|
4746
4841
|
};
|
|
4747
4842
|
type EnabledMethodsConfig = typeof enabledMethods;
|
|
4748
4843
|
type BlockedMethods = {
|
|
@@ -4756,7 +4851,11 @@ interface FramerConnectionMethods {
|
|
|
4756
4851
|
[Symbol.dispose](): void;
|
|
4757
4852
|
[Symbol.asyncDispose](): Promise<void>;
|
|
4758
4853
|
}
|
|
4759
|
-
|
|
4854
|
+
interface FramerScreenshotMethods {
|
|
4855
|
+
screenshot(nodeId: string, options?: ScreenshotOptions): Promise<ScreenshotResult>;
|
|
4856
|
+
exportSVG(nodeId: string): Promise<string>;
|
|
4857
|
+
}
|
|
4858
|
+
type Framer = AvailablePluginMethods & FramerConnectionMethods & FramerScreenshotMethods & FramerApiOnlyMethods;
|
|
4760
4859
|
|
|
4761
4860
|
/**
|
|
4762
4861
|
* Connect to a Framer project and start using the Framer API.
|
|
@@ -4787,7 +4886,17 @@ type Framer = AvailablePluginMethods & FramerConnectionMethods;
|
|
|
4787
4886
|
* const framer = await connect(projectUrl, apiKey)
|
|
4788
4887
|
* ```
|
|
4789
4888
|
*/
|
|
4790
|
-
|
|
4889
|
+
/**
|
|
4890
|
+
* @internal
|
|
4891
|
+
*/
|
|
4892
|
+
interface ConnectOptions {
|
|
4893
|
+
/**
|
|
4894
|
+
* Override the api server URL (e.g., for local development)
|
|
4895
|
+
* @internal
|
|
4896
|
+
*/
|
|
4897
|
+
serverUrl?: string;
|
|
4898
|
+
}
|
|
4899
|
+
declare function connect(projectUrlOrId: string, token?: string, options?: ConnectOptions): Promise<Framer>;
|
|
4791
4900
|
/**
|
|
4792
4901
|
* Connect to a Framer project and execute a callback with the Framer instance.
|
|
4793
4902
|
* The connection will be closed automatically when the resolves.
|
|
@@ -4803,6 +4912,6 @@ declare function connect(projectUrlOrId: string, token?: string): Promise<Framer
|
|
|
4803
4912
|
* })
|
|
4804
4913
|
* ```
|
|
4805
4914
|
*/
|
|
4806
|
-
declare function withConnection<T>(projectUrlOrId: string, callback: (framer: Framer) => Promise<T>, token?: string): Promise<T>;
|
|
4915
|
+
declare function withConnection<T>(projectUrlOrId: string, callback: (framer: Framer) => Promise<T>, token?: string, options?: ConnectOptions): Promise<T>;
|
|
4807
4916
|
|
|
4808
|
-
export { type AllTraits, type AnyNode, type ApiVersion1ProjectInfo, type ApiVersion1User, type ArrayControl, type ArrayFieldDataEntry, type ArrayFieldDataEntryInput, type ArrayItem, type ArrayItemData, type ArrayItemInput, type AxisOverflow, type BooleanControl, BooleanField, BooleanVariable, type Border, type BorderControl, type BorderRadius, type BorderRadiusControl, type BorderStyle, BorderVariable, type BorderWidth, type Breakpoint, type CanvasNode, type CanvasRootNode, CodeFile, type CodeFileComponentExport, type CodeFileExport, type CodeFileOverrideExport, CodeFileVersion, Collection, CollectionItem, type CollectionItemData, type CollectionItemInput, type CollectionReferenceControl, CollectionReferenceField, type ColorControl, ColorField, type ColorStop, ColorStyle, ColorVariable, ComponentInstanceNode, ComponentInstancePlaceholder, type ComponentInstancePlaceholderAttributes, type ComponentInstancePlaceholderData, ComponentNode, type ComponentVariable, type ComputedValue, ConicGradient, type Control, type ControlAttributes, type CreateField, type CreateVariable, type CursorControl, type CustomCode, type CustomCodeLocation, type CustomCursorControl, type DateControl, DateField, DateVariable, type Deployment, DesignPageNode, type DiagnosticSpan, type EditableManagedCollectionField, EnumCase, type EnumCaseData, type EnumControl, EnumField, EnumVariable, type Field, type FieldData, type FieldDataEntry, type FieldDataEntryInput, type FieldDataInput, FieldDivider, type FileControl, FileField, FileVariable, type FitContent, type FitImage, Font, type FontControl, type FormattedTextControl, FormattedTextField, FormattedTextVariable, FrameNode, type Framer, FramerPluginClosedError, FramerPluginError, type FusedNumberControl, type GapControl, type Gesture, type Gradient, type GridContentAlignment, type GridItemAlignment, type GridItemColumnSpan, type GridLayout, type HeightConstraint, type HeightLength, type Hostname, type HostnameType, ImageAsset, type ImageControl, ImageField, type ImageRendering, ImageVariable, type InlineLocalizationValueByLocale, type IsBreakpoint, type IsComponentGestureVariant, type IsComponentVariant, type LayoutType, type Length, LinearGradient, type LinkControl, LinkField, type LinkRelControl, LinkVariable, type LintConfig, type LintDiagnostic, type LintLink, type Locale, type LocaleId, type LocalizationData, type LocalizationGroup, type LocalizationGroupStatus, type LocalizationGroupStatusByLocale, type LocalizationSource, type LocalizationSourceId, type LocalizationSourceUpdate, type LocalizationValueByLocale, type LocalizedValueStatus, type LocalizedValueUpdate, ManagedCollection, type ManagedCollectionField, type ManagedCollectionFieldInput, type ManagedCollectionItemInput, type Mode, type MultiCollectionReferenceControl, MultiCollectionReferenceField, type NodeAttributeKey, type NodeId, type NodeRuntimeErrorResult, type NumberControl, NumberField, NumberVariable, type ObjectControl, type Overflow, type Ownership, type PaddingControl, type PageScopeControl, type Position, type ProjectInfo, type ProtectedMethod, type Publish, type PublishInfo, type PublishResult, RadialGradient, type Rect$1 as Rect, Redirect, type RedirectInput, SVGNode, type ScrollSectionControl, type SetLocalizationDataResult, type ShadowControl, type ShowProgressOnInstancesAttributes, type StackAlignment, type StackDirection, type StackDistribution, type StackLayout, type StringControl, StringField, StringVariable, type TextAlignment, type TextDecoration, TextNode, TextStyle, type TextStyleBreakpoint, type TextStyleTag, type TextTransform, type TrackingIdControl, type TraitVariant, type TraitVariantData, type TraitVariantNode, type TransitionControl, type TypecheckDiagnostic, UnsupportedComputedValue, UnsupportedField, UnsupportedVariable, type UpdateFieldAttributes, type User, type Variable, VectorSet, type VectorSetData, VectorSetItem, type VectorSetItemControl, type VectorSetItemData, VectorSetItemNode, type VectorSetItemVariable, VectorSetNode, WebPageNode, type WidthConstraint, type WidthLength, type WithAspectRatioTrait, type WithBackgroundColorTrait, type WithBackgroundGradientTrait, type WithBackgroundImageTrait, type WithBorderRadiusTrait, type WithBorderTrait, type WithBreakpointTrait, type WithComponentInfoTrait, type WithComponentVariantTrait, type WithControlAttributesTrait, type WithFontTrait, type WithGridItemTrait, type WithIdTrait, type WithImageRenderingTrait, type WithInlineTextStyleTrait, type WithLayoutTrait, type WithLinkTrait, type WithLockedTrait, type WithNameTrait, type WithNullableComponentInfoTrait, type WithOpacityTrait, type WithOverflowTrait, type WithPinsTrait, type WithPositionTrait, type WithReplicaInfoTrait, type WithRequiredComponentInfoTrait, type WithRotationTrait, type WithSVGTrait, type WithSizeConstraintsTrait, type WithSizeTrait, type WithTextTruncationTrait, type WithVisibleTrait, type WithWebPageInfoTrait, type WithZIndexTrait, configure, connect, framer, hasGridLayout, hasStackLayout, isBreakpoint, isCodeFileComponentExport, isCodeFileOverrideExport, isColorStyle, isComponentGestureVariant, isComponentInstanceNode, isComponentNode, isComponentVariable, isComponentVariant, isComputedValue, isDesignPageNode, isField, isFileAsset, isFrameNode, isImageAsset, isSVGNode, isTextNode, isTextStyle, isVariable, isVectorSetItemNode, isVectorSetNode, isWebPageNode, supportsAspectRatio, supportsBackgroundColor, supportsBackgroundColorData, supportsBackgroundGradient, supportsBackgroundGradientData, supportsBackgroundImage, supportsBackgroundImageData, supportsBorder, supportsBorderRadius, supportsBreakpoint, supportsComponentInfo, supportsComponentVariant, supportsFont, supportsFontData, supportsImageRendering, supportsInlineTextStyle, supportsInlineTextStyleData, supportsLayout, supportsLink, supportsLocked, supportsName, supportsOpacity, supportsOverflow, supportsPins, supportsPosition, supportsRotation, supportsSVG, supportsSize, supportsSizeConstraints, supportsTextTruncation, supportsVisible, supportsZIndex, withConnection };
|
|
4917
|
+
export { type AllTraits, type AnyNode, type ApiVersion1ProjectInfo, type ApiVersion1User, type ArrayControl, type ArrayFieldDataEntry, type ArrayFieldDataEntryInput, type ArrayItem, type ArrayItemData, type ArrayItemInput, type AxisOverflow, type BooleanControl, BooleanField, BooleanVariable, type Border, type BorderControl, type BorderRadius, type BorderRadiusControl, type BorderStyle, BorderVariable, type BorderWidth, type Breakpoint, type CanvasNode, type CanvasRootNode, CodeFile, type CodeFileComponentExport, type CodeFileExport, type CodeFileOverrideExport, CodeFileVersion, Collection, CollectionItem, type CollectionItemData, type CollectionItemInput, type CollectionReferenceControl, CollectionReferenceField, type ColorControl, ColorField, type ColorStop, ColorStyle, ColorVariable, ComponentInstanceNode, ComponentInstancePlaceholder, type ComponentInstancePlaceholderAttributes, type ComponentInstancePlaceholderData, ComponentNode, type ComponentVariable, type ComputedValue, ConicGradient, type ConnectOptions, type Control, type ControlAttributes, type CreateField, type CreateVariable, type CursorControl, type CustomCode, type CustomCodeLocation, type CustomCursorControl, type DateControl, DateField, DateVariable, type Deployment, DesignPageNode, type DiagnosticSpan, type EditableManagedCollectionField, EnumCase, type EnumCaseData, type EnumControl, EnumField, EnumVariable, ErrorCode, type Field, type FieldData, type FieldDataEntry, type FieldDataEntryInput, type FieldDataInput, FieldDivider, type FileControl, FileField, FileVariable, type FitContent, type FitImage, Font, type FontControl, type FormattedTextControl, FormattedTextField, FormattedTextVariable, FrameNode, type Framer, FramerAPIError, FramerPluginClosedError, FramerPluginError, type FusedNumberControl, type GapControl, type Gesture, type Gradient, type GridContentAlignment, type GridItemAlignment, type GridItemColumnSpan, type GridLayout, type HeightConstraint, type HeightLength, type Hostname, type HostnameType, ImageAsset, type ImageControl, ImageField, type ImageRendering, ImageVariable, type InlineLocalizationValueByLocale, type IsBreakpoint, type IsComponentGestureVariant, type IsComponentVariant, type LayoutType, type Length, LinearGradient, type LinkControl, LinkField, type LinkRelControl, LinkVariable, type LintConfig, type LintDiagnostic, type LintLink, type Locale, type LocaleId, type LocalizationData, type LocalizationGroup, type LocalizationGroupStatus, type LocalizationGroupStatusByLocale, type LocalizationSource, type LocalizationSourceId, type LocalizationSourceUpdate, type LocalizationValueByLocale, type LocalizedValueStatus, type LocalizedValueUpdate, ManagedCollection, type ManagedCollectionField, type ManagedCollectionFieldInput, type ManagedCollectionItemInput, type Mode, type MultiCollectionReferenceControl, MultiCollectionReferenceField, type NodeAttributeKey, type NodeId, type NodeRuntimeErrorResult, type NumberControl, NumberField, NumberVariable, type ObjectControl, type Overflow, type Ownership, type PaddingControl, type PageScopeControl, type Position, type ProjectInfo, type ProtectedMethod, type Publish, type PublishInfo, type PublishResult, RadialGradient, type Rect$1 as Rect, Redirect, type RedirectInput, SVGNode, type ScreenshotOptions, type ScreenshotResult, type ScrollSectionControl, type SetLocalizationDataResult, type ShadowControl, type ShowProgressOnInstancesAttributes, type StackAlignment, type StackDirection, type StackDistribution, type StackLayout, type StringControl, StringField, StringVariable, type TextAlignment, type TextDecoration, TextNode, TextStyle, type TextStyleBreakpoint, type TextStyleTag, type TextTransform, type TrackingIdControl, type TraitVariant, type TraitVariantData, type TraitVariantNode, type TransitionControl, type TypecheckDiagnostic, UnsupportedComputedValue, UnsupportedField, UnsupportedVariable, type UpdateFieldAttributes, type User, type Variable, VectorSet, type VectorSetData, VectorSetItem, type VectorSetItemControl, type VectorSetItemData, VectorSetItemNode, type VectorSetItemVariable, VectorSetNode, WebPageNode, type WidthConstraint, type WidthLength, type WithAspectRatioTrait, type WithBackgroundColorTrait, type WithBackgroundGradientTrait, type WithBackgroundImageTrait, type WithBorderRadiusTrait, type WithBorderTrait, type WithBreakpointTrait, type WithComponentInfoTrait, type WithComponentVariantTrait, type WithControlAttributesTrait, type WithFontTrait, type WithGridItemTrait, type WithIdTrait, type WithImageRenderingTrait, type WithInlineTextStyleTrait, type WithLayoutTrait, type WithLinkTrait, type WithLockedTrait, type WithNameTrait, type WithNullableComponentInfoTrait, type WithOpacityTrait, type WithOverflowTrait, type WithPinsTrait, type WithPositionTrait, type WithReplicaInfoTrait, type WithRequiredComponentInfoTrait, type WithRotationTrait, type WithSVGTrait, type WithSizeConstraintsTrait, type WithSizeTrait, type WithTextTruncationTrait, type WithVisibleTrait, type WithWebPageInfoTrait, type WithZIndexTrait, configure, connect, framer, hasGridLayout, hasStackLayout, isBreakpoint, isCodeFileComponentExport, isCodeFileOverrideExport, isColorStyle, isComponentGestureVariant, isComponentInstanceNode, isComponentNode, isComponentVariable, isComponentVariant, isComputedValue, isDesignPageNode, isField, isFileAsset, isFrameNode, isImageAsset, isRetryableError, isSVGNode, isTextNode, isTextStyle, isVariable, isVectorSetItemNode, isVectorSetNode, isWebPageNode, supportsAspectRatio, supportsBackgroundColor, supportsBackgroundColorData, supportsBackgroundGradient, supportsBackgroundGradientData, supportsBackgroundImage, supportsBackgroundImageData, supportsBorder, supportsBorderRadius, supportsBreakpoint, supportsComponentInfo, supportsComponentVariant, supportsFont, supportsFontData, supportsImageRendering, supportsInlineTextStyle, supportsInlineTextStyleData, supportsLayout, supportsLink, supportsLocked, supportsName, supportsOpacity, supportsOverflow, supportsPins, supportsPosition, supportsRotation, supportsSVG, supportsSize, supportsSizeConstraints, supportsTextTruncation, supportsVisible, supportsZIndex, withConnection };
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import * as it from 'devalue';
|
|
1
|
+
import { process as process$1, isWorkerd } from 'std-env';
|
|
2
|
+
import * as rt from 'devalue';
|
|
4
3
|
|
|
5
|
-
/* Framer API SDK v0.0.1-alpha.
|
|
6
|
-
var
|
|
7
|
-
`);
|
|
8
|
-
`)):
|
|
9
|
-
`));}catch{}throw t}r(m,"assert");function S(i){for(let e of Reflect.ownKeys(i)){let t=i[e];!t||typeof t!="object"&&!xr(t)||S(t);}return Object.freeze(i)}r(S,"deepFreeze");function Ai(i){return [i.slice(0,-1),i.at(-1)]}r(Ai,"splitRestAndLast");var c="__class";var Bt=Symbol(),Ut=Symbol(),Cr=Symbol(),Ir=Symbol(),Tr=Symbol(),Pr=Symbol(),Ot=Symbol(),zt=Symbol(),l={getAiServiceInfo:Bt,sendTrackingEvent:Ut,environmentInfo:Cr,showUncheckedPermissionToasts:Ir,marshal:Tr,unmarshal:Pr,getHTMLForNode:Ot,setHTMLForNode:zt},lt="INTERNAL_",dt=`${lt}getAiServiceInfo`,ut=`${lt}sendTrackingEvent`,ae=`${lt}getHTMLForNode`,se=`${lt}setHTMLForNode`;var N=class{static{r(this,"VariableBase");}#e;#t;get nodeId(){return this.#t.nodeId}get nodeType(){return this.#t.nodeType}get id(){return this.#t.id}get name(){return this.#t.name}get description(){return this.#t.description??null}constructor(e,t){this.#e=e,this.#t=t;}async setAttributes(e){let t=await this.#e.invoke("updateVariable",this.nodeId,this.id,{...e,type:this.type});if(b(t))return null;let n=this.constructor;return new n(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},M="Variable";function E(i){let e=i.at(0);return m(!Ei(e)),`${e.toLowerCase()}${i.slice(1,-M.length)}`}r(E,"classToType");var Sr=`Boolean${M}`,Fr=E(Sr),be=class i extends N{static{r(this,"BooleanVariable");}type=Fr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Dr=`Number${M}`,vr=E(Dr),xe=class i extends N{static{r(this,"NumberVariable");}type=vr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Nr=`String${M}`,kr=E(Nr),Ce=class i extends N{static{r(this,"StringVariable");}type=kr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Mr=`FormattedText${M}`,Er=E(Mr),Ie=class i extends N{static{r(this,"FormattedTextVariable");}type=Er;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Vr=`Enum${M}`,Ar=E(Vr),K=class i{static{r(this,"EnumCase");}#e;#t;#i;#n;get id(){return this.#n.id}get name(){return this.#n.name}get nameByLocale(){return this.#n.nameByLocale}constructor(e,t,n,o){this.#e=e,this.#t=t,this.#i=n,this.#n=o;}async setAttributes(e){let t=await this.#e.invoke("updateEnumCase",this.#t,this.#i,this.id,e);return t?new i(this.#e,this.#t,this.#i,t):null}async remove(){await this.#e.invoke("removeEnumCase",this.#t,this.#i,this.id);}},Te=class i extends N{static{r(this,"EnumVariable");}type=Ar;#e;#t;#i;get cases(){return this.#i||(this.#i=S(this.#t.cases.map(e=>new K(this.#e,this.nodeId,this.id,e)))),this.#i}constructor(e,t){super(e,t),this.#e=e,this.#t=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#t}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.nodeId,this.id,e);return t?new K(this.#e,this.nodeId,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.nodeId,this.id,e);}},wr=`Color${M}`,Wr=E(wr),Pe=class i extends N{static{r(this,"ColorVariable");}type=Wr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Lr=`Image${M}`,Rr=E(Lr),Se=class i extends N{static{r(this,"ImageVariable");}type=Rr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Br=`File${M}`,Ur=E(Br),Fe=class i extends N{static{r(this,"FileVariable");}type=Ur;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Or=`Link${M}`,zr=E(Or),De=class i extends N{static{r(this,"LinkVariable");}type=zr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},Gr=`Date${M}`,Kr=E(Gr),ve=class i extends N{static{r(this,"DateVariable");}type=Kr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},$r=`Border${M}`,Hr=E($r),Ne=class i extends N{static{r(this,"BorderVariable");}type=Hr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}},jr=`Unsupported${M}`,_r=E(jr),ke=class i extends N{static{r(this,"UnsupportedVariable");}type=_r;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return this.#e}};function wi(i){return i instanceof N}r(wi,"isVariable");function qr(i){return wi(i)&&i.nodeType==="component"}r(qr,"isComponentVariable");var W=class{static{r(this,"FieldBase");}#e;#t;#i;get id(){return this.#i.id}get name(){return this.#i.name}constructor(e,t,n){this.#e=e,this.#t=t,this.#i=n;}async setAttributes(e){let t={...e,type:this.type,id:this.id},[n]=await this.#e.invoke("addCollectionFields2",this.#t,[t]);if(m(ot(n)),b(n))return null;m(n.type===this.type);let o=this.constructor;return new o(this.#e,this.#t,n)}async remove(){await this.#e.invoke("removeCollectionFields",this.#t,[this.id]);}},A=class extends W{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,n){super(e,t,n),this.#e=n;}},ct=class extends W{static{r(this,"BooleanField");}type=$t},pt=class extends W{static{r(this,"ColorField");}type=Ht},mt=class extends W{static{r(this,"NumberField");}type=jt},gt=class extends A{static{r(this,"StringField");}type=_t;#e;constructor(e,t,n){super(e,t,n),this.#e=n;}get basedOn(){return this.#e.basedOn}},ft=class extends A{static{r(this,"FormattedTextField");}type=qt},Me=class extends A{static{r(this,"ImageField");}type=Yt},yt=class extends A{static{r(this,"LinkField");}type=Zt},ht=class extends A{static{r(this,"DateField");}type=Jt},bt=class extends W{static{r(this,"FieldDivider");}type=ni},Ee=class extends W{static{r(this,"UnsupportedField");}type=ri},xt=class extends A{static{r(this,"FileField");}type=Qt;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,n){super(e,t,n),this.#e=n;}},Ct=class extends W{static{r(this,"EnumField");}type=ei;#e;#t;#i;#n;get cases(){return this.#n||(this.#n=this.#i.cases.map(e=>new K(this.#e,this.#t,this.id,e)),S(this.#n)),this.#n}constructor(e,t,n){super(e,t,n),this.#e=e,this.#t=t,this.#i=n;}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.#t,this.id,e);return t?new K(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},It=class extends A{static{r(this,"CollectionReferenceField");}type=ti;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,n){super(e,t,n),this.#e=n;}},Tt=class extends A{static{r(this,"MultiCollectionReferenceField");}type=ii;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,n){super(e,t,n),this.#e=n;}},Gt=class extends A{static{r(this,"ArrayField");}type=Xt;fields;constructor(e,t,n){super(e,t,n);let o=n.fields[0];this.fields=[new Me(e,t,o)];}};function Kt(i,e,t){return i.map(n=>{switch(n.type){case $t:return new ct(e,t,n);case Ht:return new pt(e,t,n);case jt:return new mt(e,t,n);case _t:return new gt(e,t,n);case qt:return new ft(e,t,n);case Yt:return new Me(e,t,n);case Zt:return new yt(e,t,n);case Jt:return new ht(e,t,n);case ni:return new bt(e,t,n);case ri:return new Ee(e,t,n);case Qt:return new xt(e,t,n);case ei:return new Ct(e,t,n);case ti:return new It(e,t,n);case ii:return new Tt(e,t,n);case Xt:return new Gt(e,t,n);default:return new Ee(e,t,n)}})}r(Kt,"fieldDefinitionDataArrayToFieldClassInstances");function Yr(i){return i instanceof W}r(Yr,"isField");var Wi="action";function Xr(i){return !!i&&Wi in i&&g(i[Wi])}r(Xr,"isLocalizedValueUpdate");function Li(i){return Object.keys(i).reduce((e,t)=>{let n=i[t];return Xr(n)&&(e[t]=n),e},{})}r(Li,"filterInlineLocalizationValues");var Ve=class i{static{r(this,"FileAsset");}id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension;}static[l.unmarshal](e,t){return new i(t)}[l.marshal](){return {[c]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function Zr(i){return i instanceof Ve}r(Zr,"isFileAsset");var Jr="ImageAsset";function Ri(i){return v(i)?i[c]===Jr:false}r(Ri,"isImageAssetData");var $=class i{static{r(this,"ImageAsset");}id;url;thumbnailUrl;altText;resolution;#e;#t;constructor(e,t){this.#t=e,this.url=t.url,this.id=t.id,this.thumbnailUrl=t.thumbnailUrl,this.altText=t.altText,this.resolution=t.resolution;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return {[c]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:this.altText,resolution:this.resolution}}cloneWithAttributes({altText:e,resolution:t}){return new i(this.#t,{[c]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return to(this.url)}async getData(){if(this.#e&&this.#e.bytes.length>0)return this.#e;let e=await this.#t.invoke("getImageData",{id:this.id,resolution:this.resolution});if(!e)throw new Error("Failed to load image data");return this.#e=e,e}async loadBitmap(){let{mimeType:e,bytes:t}=await this.getData(),n=new Blob([t],{type:e});return createImageBitmap(n)}async loadImage(){let e=await this.getData(),t=URL.createObjectURL(new Blob([e.bytes]));return new Promise((n,o)=>{let a=new Image;a.onload=()=>n(a),a.onerror=()=>o(),a.src=t;})}};function Qr(i){return i instanceof $}r(Qr,"isImageAsset");function H(i){return i.type==="bytes"?[i.bytes.buffer]:[]}r(H,"getTransferable");function eo(i){if(!v(i))return false;let e="bytes",t="mimeType";return !(!(e in i)||!(t in i)||!(i[e]instanceof Uint8Array)||!g(i[t]))}r(eo,"isBytesData");async function Ae(i){if(i instanceof File)return si(i);let e=await Bi(i.image);return {name:i.name,altText:i.altText,resolution:i.resolution,preferredImageRendering:i.preferredImageRendering,...e}}r(Ae,"createImageTransferFromInput");async function oi(i){if(i instanceof File)return si(i);let e=await Bi(i.file);return {name:i.name,...e}}r(oi,"createFileTransferFromInput");async function Bi(i){return i instanceof File?si(i):eo(i)?{type:"bytes",mimeType:i.mimeType,bytes:i.bytes}:{type:"url",url:i}}r(Bi,"createAssetTransferFromAssetInput");function ai(i){return Promise.all(i.map(Ae))}r(ai,"createNamedAssetDataTransferFromInput");async function si(i){return new Promise((e,t)=>{let n=new FileReader;n.onload=o=>{let a=i.type,s=o.target?.result;if(!s||!(s instanceof ArrayBuffer)){t(new Error("Failed to read file, arrayBuffer is null"));return}let d=new Uint8Array(s);e({bytes:d,mimeType:a,type:"bytes",name:i.name});},n.onerror=o=>{t(o);},n.readAsArrayBuffer(i);})}r(si,"getAssetDataFromFile");async function to(i){let e=i instanceof File,t=e?URL.createObjectURL(i):i,n=new Image;return n.crossOrigin="anonymous",new Promise((o,a)=>{n.onload=()=>{o({width:n.naturalWidth,height:n.naturalHeight});},n.onerror=s=>{a(s);},n.src=t;}).finally(()=>{e&&URL.revokeObjectURL(t);})}r(to,"measureImage");var Pt=class{static{r(this,"ComputedValueBase");}};var io="unsupported",we=class i extends Pt{static{r(this,"UnsupportedComputedValue");}type=io;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new i(t)}[l.marshal](){return this.#e}};function no(i){return i instanceof Pt}r(no,"isComputedValue");var ro="Font";function Oi(i){return v(i)&&i[c]===ro}r(Oi,"isFontData");function oo(i){if(!G(i))return false;switch(i){case 100:case 200:case 300:case 400:case 500:case 600:case 700:case 800:case 900:return true;default:return false}}r(oo,"isFontWeight");function ao(i){if(!g(i))return false;switch(i){case "normal":case "italic":return true;default:return false}}r(ao,"isFontStyle");function zi(i){return v(i)?g(i.family)&&g(i.selector)&&oo(i.weight)&&ao(i.style):false}r(zi,"isFont");var B=class i{static{r(this,"Font");}selector;family;weight;style;constructor(e){this.selector=e.selector,this.family=e.family,this.weight=e.weight,this.style=e.style;}static[l.unmarshal](e,t){let n=Ui.get(t.selector);if(n)return n;let o=new i(t);return Ui.set(t.selector,o),o}[l.marshal](){return {[c]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},Ui=new Map;var so="LinearGradient",lo="RadialGradient",uo="ConicGradient",le=class{static{r(this,"GradientBase");}#e;get stops(){return this.#e.stops}constructor(e){this.#e=e;}cloneWithAttributes(e){let t=this.constructor;return new t({...this.#e,...e})}},We=class i extends le{static{r(this,"LinearGradient");}[c]=so;#e;get angle(){return this.#e.angle}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new i({...t,stops:h(e,t.stops)})}[l.marshal](){return L({...this.#e,[c]:this[c]})}toCSS(){let e=this.#e.stops.map(t=>(m(g(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},Le=class i extends le{static{r(this,"RadialGradient");}[c]=lo;#e;get width(){return this.#e.width}get height(){return this.#e.height}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new i({...t,stops:h(e,t.stops)})}[l.marshal](){return L({...this.#e,[c]:this[c]})}toCSS(){let e=this.stops.map((t,n)=>{m(g(t.color),"ColorStyle not supported yet");let o=this.stops[n+1],a=t.position===1&&o?.position===1?t.position-1e-4:t.position;return `${t.color} ${a*100}%`}).join(", ");return `radial-gradient(${this.width} ${this.height} at ${this.x} ${this.y}, ${e})`}},Re=class i extends le{static{r(this,"ConicGradient");}[c]=uo;#e;get angle(){return this.#e.angle}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new i({...t,stops:h(e,t.stops)})}[l.marshal](){return L({...this.#e,[c]:this[c]})}toCSS(){let e=this.stops.map(t=>(m(g(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*360}deg`)).join(", ");return `conic-gradient(from ${this.angle}deg at ${this.x} ${this.y}, ${e})`}};function Gi(i){return i instanceof le}r(Gi,"isGradient");var co="ColorStyle";function St(i){return v(i)?i[c]===co:false}r(St,"isColorStyleData");var X=class i{static{r(this,"ColorStyle");}id;name;path;light;dark;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.light=t.light,this.dark=t.dark,this.path=t.path,this.#e=e;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return {[c]:"ColorStyle",id:this.id,name:this.name,light:this.light,dark:this.dark,path:this.path}}async setAttributes(e){let t=await this.#e.invoke("setColorStyleAttributes",this.id,e);return t?new i(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeColorStyle",this.id)}};function de(i){return i instanceof X}r(de,"isColorStyle");var po="TextStyle";function Ki(i){return v(i)?i[c]===po:false}r(Ki,"isTextStyleData");var Be=class i{static{r(this,"TextStyle");}id;name;path;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;decorationColor;decorationThickness;decorationStyle;decorationSkipInk;decorationOffset;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.path=t.path,this.tag=t.tag,this.font=B[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&B[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&B[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&B[l.unmarshal](e,t.boldItalicFont),this.color=St(t.color)?X[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=St(t.decorationColor)?X[l.unmarshal](e,t.decorationColor):t.decorationColor,this.decorationThickness=t.decorationThickness,this.decorationStyle=t.decorationStyle,this.decorationSkipInk=t.decorationSkipInk,this.decorationOffset=t.decorationOffset,this.balance=t.balance,this.breakpoints=t.breakpoints,this.minWidth=t.minWidth,this.fontSize=t.fontSize,this.letterSpacing=t.letterSpacing,this.lineHeight=t.lineHeight,this.paragraphSpacing=t.paragraphSpacing,this.#e=e;}static[l.unmarshal](e,t){return new i(e,t)}[l.marshal](){return {[c]:"TextStyle",id:this.id,name:this.name,path:this.path,tag:this.tag,font:this.font[l.marshal](),boldFont:this.boldFont?.[l.marshal]()??null,italicFont:this.italicFont?.[l.marshal]()??null,boldItalicFont:this.boldItalicFont?.[l.marshal]()??null,color:de(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:de(this.decorationColor)?this.decorationColor[l.marshal]():this.decorationColor,decorationThickness:this.decorationThickness,decorationStyle:this.decorationStyle,decorationSkipInk:this.decorationSkipInk,decorationOffset:this.decorationOffset,balance:this.balance,breakpoints:this.breakpoints,minWidth:this.minWidth,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,paragraphSpacing:this.paragraphSpacing}}async setAttributes(e){let t=await this.#e.invoke("setTextStyleAttributes",this.id,e);return t?new i(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function li(i){return i instanceof Be}r(li,"isTextStyle");function mo(i){return v(i)&&l.marshal in i}r(mo,"isSelfMarshalable");function L(i){if(mo(i))return i[l.marshal]();if(Rt(i))return i.map(L);if(at(i)){let e={};for(let t of Object.keys(i))e[t]=L(i[t]);return e}return i}r(L,"marshal");var $i={ColorStyle:X,ConicGradient:Re,FileAsset:Ve,Font:B,ImageAsset:$,LinearGradient:We,RadialGradient:Le,TextStyle:Be,BooleanVariable:be,BorderVariable:Ne,ColorVariable:Pe,DateVariable:ve,EnumVariable:Te,FileVariable:Fe,FormattedTextVariable:Ie,ImageVariable:Se,LinkVariable:De,NumberVariable:xe,StringVariable:Ce,UnsupportedVariable:ke,UnsupportedComputedValue:we};function go(i){return at(i)&&g(i[c])&&i[c]in $i}r(go,"isSelfUnmarshalable");function h(i,e){if(go(e))return $i[e[c]][l.unmarshal](i,e);if(Rt(e))return e.map(t=>h(i,t));if(at(e)){let t={};for(let n of Object.keys(e))t[n]=h(i,e[n]);return t}return e}r(h,"unmarshal");var fo={array:false,boolean:false,collectionReference:false,color:false,date:false,enum:false,file:false,formattedText:false,image:true,link:false,multiCollectionReference:false,number:false,string:false,unsupported:false};function yo(i){return fo[i]}r(yo,"isSupportedArrayItemFieldType");function ho(i){return yo(i.type)}r(ho,"isSupportedArrayItemFieldDataEntry");var $t="boolean",Ht="color",jt="number",_t="string",qt="formattedText",Yt="image",Xt="array",Zt="link",Jt="date",Qt="file",ei="enum",ti="collectionReference",ii="multiCollectionReference",ni="divider",ri="unsupported";function bo(i){return i.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(n=>{let o=n.nameByLocale?Li(n.nameByLocale):undefined;return {...n,nameByLocale:o}});return {...e,cases:t}})}r(bo,"sanitizeEnumFieldForMessage");function Hi(i,e){let t={};for(let n in i){let o=i[n];if(!o)continue;if(o.type!=="array"){t[n]=h(e,o);continue}let a=o.value.map(s=>{let d=Hi(s.fieldData,e),T={};for(let C in d){let D=d[C];m(D&&ho(D),"Unsupported array item field data entry"),T[C]=D;}return {...s,fieldData:T}});t[n]={...o,value:a};}return t}r(Hi,"deserializeFieldData");var ue=class{static{r(this,"ManagedCollection");}id;name;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.readonly=e.readonly,m(e.managedBy!=="user","Managed Collection can only be managed by a plugin"),this.managedBy=e.managedBy,this.#e=t,S(this);}async getItemIds(){return this.#e.invoke("getManagedCollectionItemIds",this.id)}async setItemOrder(e){return this.#e.invoke("setManagedCollectionItemOrder",this.id,e)}async getFields(){return this.#e.invoke("getManagedCollectionFields2",this.id)}async setFields(e){let t=bo(e);return this.#e.invoke("setManagedCollectionFields",this.id,t)}async addItems(e){return this.#e.invoke("addManagedCollectionItems2",this.id,e)}async removeItems(e){return this.#e.invoke("removeManagedCollectionItems",this.id,e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},Z=class{static{r(this,"Collection");}id;name;slugFieldName;slugFieldBasedOn;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.slugFieldName=e.slugFieldName,this.slugFieldBasedOn=e.slugFieldBasedOn,this.readonly=e.readonly,this.managedBy=e.managedBy,this.#e=t,S(this);}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){let e=await this.#e.invoke("getCollectionFields2",this.id,true);return Kt(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return m(t.every(Vi)),Kt(t,this.#e,this.id)}async removeFields(e){return this.#e.invoke("removeCollectionFields",this.id,e)}async setFieldOrder(e){return this.#e.invoke("setCollectionFieldOrder",this.id,e)}async getItems(){return (await this.#e.invoke("getCollectionItems2",this.id)).map(t=>new Ue(t,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems2",this.id,e);}async removeItems(e){return this.#e.invoke("removeCollectionItems",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},Ue=class i{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let n=Hi(e.fieldData,t);this.id=e.externalId??e.nodeId,this.nodeId=e.nodeId,this.slug=e.slug,this.slugByLocale=e.slugByLocale,this.draft=e.draft??false,this.fieldData=n,this.#e=t,S(this);}async remove(){return this.#e.invoke("removeCollectionItems",[this.id])}async setAttributes(e){let t=await this.#e.invoke("setCollectionItemAttributes2",this.id,e);return t?new i(t,this.#e):null}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.nodeId,e)}};var xo={fixed:true,sticky:true,absolute:true,relative:true},ji="position";function Is(i){if(!(ji in i))return false;let e=i[ji];return g(e)&&xo[e]===true}r(Is,"supportsPosition");var _i="top";function Ts(i){if(!(_i in i))return false;let e=i[_i];return g(e)||b(e)}r(Ts,"supportsPins");var qi="width";function Ps(i){if(!(qi in i))return false;let e=i[qi];return g(e)||b(e)}r(Ps,"supportsSize");var Yi="maxWidth";function Ss(i){if(!(Yi in i))return false;let e=i[Yi];return g(e)||b(e)}r(Ss,"supportsSizeConstraints");var Xi="aspectRatio";function Fs(i){if(!(Xi in i))return false;let e=i[Xi];return G(e)||b(e)}r(Fs,"supportsAspectRatio");var Zi="name";function Ds(i){if(!(Zi in i))return false;let e=i[Zi];return g(e)||b(e)}r(Ds,"supportsName");var Ji="visible";function vs(i){if(!(Ji in i))return false;let e=i[Ji];return he(e)}r(vs,"supportsVisible");var Qi="locked";function Ns(i){if(!(Qi in i))return false;let e=i[Qi];return he(e)}r(Ns,"supportsLocked");var en="backgroundColor";function ks(i){if(!(en in i))return false;let e=i[en];return g(e)||de(e)||b(e)}r(ks,"supportsBackgroundColor");var tn="backgroundColor";function Ms(i){if(!(tn in i))return false;let e=i[tn];return g(e)||St(e)||b(e)}r(Ms,"supportsBackgroundColorData");var nn="backgroundImage";function Es(i){if(!(nn in i))return false;let e=i[nn];return e instanceof $||b(e)}r(Es,"supportsBackgroundImage");var rn="backgroundImage";function Vs(i){if(!(rn in i))return false;let e=i[rn];return e instanceof $?false:Ri(e)||b(e)}r(Vs,"supportsBackgroundImageData");var on="backgroundGradient";function As(i){if(!(on in i))return false;let e=i[on];return Gi(e)||b(e)}r(As,"supportsBackgroundGradient");var an="backgroundGradient";function ws(i){if(!(an in i))return false;let e=i[an];return v(e)||b(e)}r(ws,"supportsBackgroundGradientData");var sn="rotation";function Ws(i){if(!(sn in i))return false;let e=i[sn];return G(e)}r(Ws,"supportsRotation");var ln="opacity";function Ls(i){if(!(ln in i))return false;let e=i[ln];return G(e)}r(Ls,"supportsOpacity");var dn="borderRadius";function Rs(i){if(!(dn in i))return false;let e=i[dn];return g(e)||b(e)}r(Rs,"supportsBorderRadius");var un="border";function Bs(i){if(!(un in i))return false;let e=i[un];return b(e)||de(e.color)}r(Bs,"supportsBorder");var cn="svg";function Us(i){if(!(cn in i))return false;let e=i[cn];return g(e)}r(Us,"supportsSVG");var pn="textTruncation";function Os(i){if(!(pn in i))return false;let e=i[pn];return G(e)||b(e)}r(Os,"supportsTextTruncation");var mn="zIndex";function zs(i){if(!(mn in i))return false;let e=i[mn];return G(e)||b(e)}r(zs,"supportsZIndex");var gn="overflow";function Gs(i){if(!(gn in i))return false;let e=i[gn];return g(e)||b(e)}r(Gs,"supportsOverflow");var fn="componentIdentifier";function Ks(i){if(!(fn in i))return false;let e=i[fn];return g(e)}r(Ks,"supportsComponentInfo");var yn="font";function $s(i){if(!(yn in i))return false;let e=i[yn];return zi(e)}r($s,"supportsFont");var hn="font";function Hs(i){if(!(hn in i))return false;let e=i[hn];return Oi(e)||b(e)}r(Hs,"supportsFontData");var bn="inlineTextStyle";function js(i){if(!(bn in i))return false;let e=i[bn];return li(e)||b(e)}r(js,"supportsInlineTextStyle");var xn="inlineTextStyle";function _s(i){if(!(xn in i))return false;let e=i[xn];return Ki(e)||b(e)}r(_s,"supportsInlineTextStyleData");var Cn="link";function qs(i){if(!(Cn in i))return false;let e=i[Cn];return g(e)||b(e)}r(qs,"supportsLink");var In="imageRendering";function Ys(i){if(!(In in i))return false;let e=i[In];return g(e)||b(e)}r(Ys,"supportsImageRendering");var Tn="layout";function Fn(i){if(!(Tn in i))return false;let e=i[Tn];return g(e)||b(e)}r(Fn,"supportsLayout");function Xs(i){return Fn(i)?i.layout==="stack":false}r(Xs,"hasStackLayout");function Zs(i){return Fn(i)?i.layout==="grid":false}r(Zs,"hasGridLayout");var Pn="isVariant";function Dn(i){if(!(Pn in i))return false;let e=i[Pn];return he(e)}r(Dn,"supportsComponentVariant");function di(i){return Dn(i)?i.isVariant:false}r(di,"isComponentVariant");function vn(i){return !Dn(i)||!di(i)?false:!b(i.gesture)}r(vn,"isComponentGestureVariant");var Sn="isBreakpoint";function Co(i){if(!(Sn in i))return false;let e=i[Sn];return he(e)}r(Co,"supportsBreakpoint");function Nn(i){return Co(i)?i.isBreakpoint:false}r(Nn,"isBreakpoint");var V=class{static{r(this,"NodeMethods");}id;originalId;#e;constructor(e,t){this.id=e.id,this.originalId=e.originalId??null,this.#e=t;}get isReplica(){return this.originalId!==null}async remove(){return this.#e.invoke("removeNodes2",[this.id])}async select(){return this.#e.invoke("setSelection",[this.id])}async clone(){if(this[c]==="UnknownNode")throw Error("Can not clone unknown node");return this.#e.cloneNode(this.id)}async setAttributes(e){if(this[c]==="UnknownNode")throw Error("Can not set attributes on unknown node");return this.#e.setAttributes(this.id,e)}async getRect(){return this.#e.invoke("getRect",this.id)}async zoomIntoView(e){return this.#e.invoke("zoomIntoView",[this.id],e)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}async getParent(){return this.#e.getParent(this.id)}async getChildren(){return J(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return J(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(n=>x(n,this.#e))}async getNodesWithAttribute(e){return J(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(n=>x(n,this.#e))}async getNodesWithAttributeSet(e){return J(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(n=>x(n,this.#e))}async*walk(){if(yield this,!J(this))for(let e of await this.getChildren())yield*e.walk();}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},R=class extends V{static{r(this,"FrameNode");}[c]="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;border;imageRendering;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;zIndex;link;linkOpenInNewTab;overflow;overflowX;overflowY;layout;gap;padding;stackDirection;stackDistribution;stackAlignment;stackWrapEnabled;gridColumnCount;gridRowCount;gridAlignment;gridColumnWidthType;gridColumnWidth;gridColumnMinWidth;gridRowHeightType;gridRowHeight;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;isVariant;isPrimaryVariant;isBreakpoint;isPrimaryBreakpoint;inheritsFromId;gesture;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.backgroundColor=h(t,e.backgroundColor)??null,this.backgroundImage=h(t,e.backgroundImage)??null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.border=h(t,e.border)??null,this.backgroundGradient=h(t,e.backgroundGradient)??null,this.imageRendering=e.imageRendering??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,this.zIndex=e.zIndex??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.layout=e.layout??null,this.gap=e.gap??null,this.padding=e.padding??null,this.stackDirection=e.stackDirection??null,this.stackDistribution=e.stackDistribution??null,this.stackAlignment=e.stackAlignment??null,this.stackWrapEnabled=e.stackWrapEnabled??null,this.gridColumnCount=e.gridColumnCount??null,this.gridRowCount=e.gridRowCount??null,this.gridAlignment=e.gridAlignment??null,this.gridColumnWidthType=e.gridColumnWidthType??null,this.gridColumnWidth=e.gridColumnWidth??null,this.gridColumnMinWidth=e.gridColumnMinWidth??null,this.gridRowHeightType=e.gridRowHeightType??null,this.gridRowHeight=e.gridRowHeight??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,this.inheritsFromId=e.inheritsFromId??null,this.gesture=e.gesture??null,this.isVariant=e.isVariant??false,this.isPrimaryVariant=e.isPrimaryVariant??false,this.isBreakpoint=e.isBreakpoint??false,this.isPrimaryBreakpoint=e.isPrimaryBreakpoint??false,S(this);}},Q=class extends V{static{r(this,"TextNode");}[c]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;overflow;overflowX;overflowY;textTruncation;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.zIndex=e.zIndex??null,this.font=h(t,e.font)??null,this.inlineTextStyle=h(t,e.inlineTextStyle)??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.textTruncation=e.textTruncation??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,S(this);}async setText(e){await this.#e.invoke("setTextForNode",this.id,e);}async getText(){return this.#e.invoke("getTextForNode",this.id)}async setHTML(e){await this.#e.invoke(se,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(ae,this.id)}},Oe=class extends V{static{r(this,"SVGNode");}[c]="SVGNode";name;visible;locked;svg;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.svg=e.svg,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,S(this);}},ze=class extends V{static{r(this,"VectorSetItemNode");}[c]="VectorSetItemNode";name;visible;locked;top;right;bottom;left;centerX;centerY;width;height;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.top=e.top??null,this.right=e.right??null,this.bottom=e.bottom??null,this.left=e.left??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,S(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},Ge=class extends V{static{r(this,"ComponentInstanceNode");}[c]="ComponentInstanceNode";name;visible;locked;componentIdentifier;insertURL;componentName;controls;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;#e;#t;#i;get typedControls(){return this.#i||(this.#i=h(this.#e,this.#t.typedControls)??{}),this.#i}constructor(e,t){super(e,t),this.#e=t,this.#t=e,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.componentIdentifier=e.componentIdentifier,this.componentName=e.componentName??null,this.insertURL=e.insertURL??null,this.controls=h(t,e.controls)??{},this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,S(this);}async getRuntimeError(){return this.#e.invoke("getRuntimeErrorForCodeComponentNode",this.id)}},ee=class extends V{static{r(this,"WebPageNode");}[c]="WebPageNode";#e;path;collectionId;constructor(e,t){super(e,t),this.path=e.path??null,this.collectionId=e.collectionId??null,this.#e=t,S(this);}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let n=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=x(n,this.#e);return m(o instanceof R),m(Nn(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new Ue(e,this.#e):null}},te=class extends V{static{r(this,"ComponentNode");}[c]="ComponentNode";name;componentIdentifier;insertURL;componentName;#e;constructor(e,t){super(e,t),this.#e=t,this.componentIdentifier=e.componentIdentifier,this.insertURL=e.insertURL??null,this.componentName=e.componentName??null,this.name=e.name??null,S(this);}async addVariant(e,t){let n=await this.#e.invoke("addVariantToComponent",this.id,e,t);if(!n)throw new Error("Failed to add variant to component");let o=x(n,this.#e);return m(o instanceof R),m(di(o),"Node is not a component variant"),o}async addGestureVariant(e,t,n){let o=await this.#e.invoke("addGestureVariantToComponent",this.id,e,t,n);if(!o)throw new Error("Failed to add state to component");let a=x(o,this.#e);return m(a instanceof R),m(vn(a),"Node is not a gesture variant"),a}async getVariables(){let e=await this.#e.invoke("getVariables",this.id);return h(this.#e,e)}async addVariables(e){let t=await this.#e.invoke("addVariables",this.id,L(e));return h(this.#e,t)}async removeVariables(e){await this.#e.invoke("removeVariables",this.id,e);}async setVariableOrder(e){await this.#e.invoke("setVariableOrder",this.id,e);}},Ke=class extends V{static{r(this,"VectorSetNode");}[c]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,S(this);}},ie=class extends V{static{r(this,"DesignPageNode");}[c]="DesignPageNode";name;constructor(e,t){super(e,t),this.name=e.name??null,S(this);}},$e=class extends V{static{r(this,"UnknownNode");}[c]="UnknownNode";constructor(e,t){super(e,t),S(this);}};function x(i,e){switch(i[c]){case "DesignPageNode":return new ie(i,e);case "WebPageNode":return new ee(i,e);case "ComponentNode":return new te(i,e);case "VectorSetNode":return new Ke(i,e);case "VectorSetItemNode":return new ze(i,e);case "ComponentInstanceNode":return new Ge(i,e);case "FrameNode":return new R(i,e);case "SVGNode":return new Oe(i,e);case "TextNode":return new Q(i,e);case "UnknownNode":return new $e(i,e);default:return new $e(i,e)}}r(x,"convertRawNodeDataToNode");function Ft(i){return i instanceof R}r(Ft,"isFrameNode");function kn(i){return i instanceof Q}r(kn,"isTextNode");function Mn(i){return i instanceof Oe}r(Mn,"isSVGNode");function ce(i){return i instanceof Ge}r(ce,"isComponentInstanceNode");function En(i){return i instanceof ee}r(En,"isWebPageNode");function Vn(i){return i instanceof te}r(Vn,"isComponentNode");function An(i){return i instanceof ie}r(An,"isDesignPageNode");function wn(i){return i instanceof Ke}r(wn,"isVectorSetNode");function Wn(i){return i instanceof ze}r(Wn,"isVectorSetItemNode");function J(i){return i instanceof $e}r(J,"isUnknownNode");function He(i){return !!(Ft(i)||kn(i)||ce(i)||Mn(i)||Wn(i)||J(i))}r(He,"isCanvasNode");function ui(i){return !!(En(i)||An(i)||Vn(i)||wn(i)||J(i))}r(ui,"isCanvasRootNode");var je=class{static{r(this,"VectorSet");}id;name;owner;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.owner=e.owner,this.#e=t;}async getItems(){return (await this.#e.invoke("getVectorSetItems",this.id)).map(t=>new Dt(t,this.#e))}},Dt=class{static{r(this,"VectorSetItem");}id;name;insertUrl;iconUrl;#e;#t;constructor(e,t){this.id=e.id,this.name=e.name,this.insertUrl=e.insertUrl,this.iconUrl=e.iconUrl,this.#e=e.moduleId,this.#t=t;}async getVariables(){return this.#t.invoke("getVectorSetItemVariables",this.id,this.#e)}};var _e=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},j=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Io(i){return i.type==="separator"}r(Io,"isSeparatorMenuItem");function vt(i,e){let t=[];for(let n of i){if(Io(n)){t.push(n);continue}let{onAction:o,...a}=n,s=a;if(n.onAction){let d=Math.random();e.set(d,n.onAction),s.actionId=d;}n.submenu&&(s.submenu=vt(n.submenu,e)),t.push(s);}return t}r(vt,"addMenuItemsToOnActionCallbackMap");var Nt="type",Ln={[Nt]:"pluginReadySignal"},Po="pluginReadyResponse";var So={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function Rn(i){return v(i)&&g(i[Nt])&&i[Nt]in So}r(Rn,"isVekterToPluginNonHandshakeMessage");function Bn(i){return v(i)&&i[Nt]===Po}r(Bn,"isPluginReadyResponse");var Fo=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions"],Do=["closeNotification","closePlugin","getActiveCollection","getActiveLocale","getActiveManagedCollection","getCanvasRoot","getChildren","getCollection","getCollectionFields","getCollectionFields2","getCollectionItems","getCollectionItems2","getCollections","getColorStyle","getColorStyles","getCurrentUser","getCurrentUser2","getCustomCode","getDefaultLocale","getFont","getFonts","getImage","getImageData","getLocales","getLocalizationGroups","getManagedCollection","getManagedCollectionFields","getManagedCollectionFields2","getManagedCollectionItemIds","getManagedCollections","getNode","getNodesWithAttribute","getNodesWithAttributeSet","getNodesWithType","getParent","getPluginData","getPluginDataForNode","getPluginDataKeys","getPluginDataKeysForNode","getProjectInfo","getProjectInfo2","getPublishInfo","getRect","getSelection","getSVGForNode","getText","getTextForNode","getTextStyle","getTextStyles","hideUI","setBackgroundMessage","notify","onPointerDown","setActiveCollection","setSelection","showUI","getCodeFileVersionContent","lintCode","typecheckCode","getCodeFileVersions","getCodeFiles","getCodeFile","getRedirects","uploadFile","uploadFiles","uploadImage","uploadImages","zoomIntoView","navigateTo","getRuntimeErrorForModule","getRuntimeErrorForCodeComponentNode","showProgressOnInstances","removeProgressFromInstances","addComponentInstancePlaceholder","updateComponentInstancePlaceholder","removeComponentInstancePlaceholder","setMenu","showContextMenu","getBreakpointSuggestionsForWebPage","getActiveCollectionItemForWebPage","getVariables","getVectorSets","getVectorSetItems","getVectorSetItemVariables","getChangedPagePaths","getChangeAuthors","getDeployments",dt,ut,ae,"getAiServiceInfo","sendTrackingEvent",...Fo];new Set(Do);var ci={addComponentInstance:["addComponentInstance"],addComponentInstancePlaceholder:[],addDetachedComponentLayers:["addDetachedComponentLayers"],addImage:["addImage"],addImages:["addImages"],addSVG:["addSVG"],addText:["addText"],addRedirects:["addRedirects"],getRedirects:[],removeRedirects:["removeRedirects"],setRedirectOrder:["setRedirectOrder"],subscribeToRedirects:[],cloneNode:["cloneNode"],closePlugin:[],createColorStyle:["createColorStyle"],createFrameNode:["createNode"],createTextNode:["createNode"],createComponentNode:["createNode"],createTextStyle:["createTextStyle"],createDesignPage:["createDesignPage"],createWebPage:["createWebPage"],getActiveCollection:[],getActiveLocale:[],getActiveManagedCollection:[],getCanvasRoot:[],getChildren:[],getCollection:[],getCollections:[],getColorStyle:[],getColorStyles:[],getCurrentUser:[],getCustomCode:[],getDefaultLocale:[],getFont:[],getFonts:[],getImage:[],getLocales:[],getLocalizationGroups:[],getManagedCollection:[],getManagedCollections:[],getNode:[],getNodesWithAttribute:[],getNodesWithAttributeSet:[],getNodesWithType:[],getParent:[],getPluginData:[],getPluginDataKeys:[],getProjectInfo:[],getPublishInfo:[],getRect:[],getSelection:[],getText:[],getTextStyle:[],getTextStyles:[],hideUI:[],setBackgroundMessage:[],lintCode:[],makeDraggable:["onDragEnd","onDragStart","onDrag","setDragData","preloadDetachedComponentLayers","preloadImageUrlForInsertion","preloadDragPreviewImage"],notify:[],preloadDetachedComponentLayers:["preloadDetachedComponentLayers"],preloadDragPreviewImage:["preloadDragPreviewImage"],preloadImageUrlForInsertion:["preloadImageUrlForInsertion"],removeNode:["removeNodes2"],removeNodes:["removeNodes2"],setAttributes:["setAttributes"],setCustomCode:["setCustomCode"],setImage:["setImage"],setLocalizationData:["setLocalizationData"],setMenu:[],showContextMenu:[],setParent:["setParent"],setPluginData:["setPluginData"],setSelection:[],setText:["setText"],typecheckCode:[],showUI:[],subscribeToCanvasRoot:[],subscribeToColorStyles:[],subscribeToCustomCode:[],subscribeToImage:[],subscribeToPublishInfo:[],subscribeToSelection:[],subscribeToText:[],subscribeToTextStyles:[],createCodeFile:["createCodeFile"],unstable_ensureMinimumDependencyVersion:["unstable_ensureMinimumDependencyVersion"],getCodeFiles:[],getCodeFile:[],subscribeToCodeFiles:[],subscribeToOpenCodeFile:[],uploadFile:[],uploadFiles:[],uploadImage:[],uploadImages:[],zoomIntoView:[],navigateTo:[],getVectorSets:[],"VectorSet.getItems":[],"VectorSetItem.getVariables":[],"Node.navigateTo":[],"CodeFile.navigateTo":[],"Collection.navigateTo":[],"ManagedCollection.navigateTo":[],"CollectionItem.navigateTo":[],"ComponentInstanceNode.getRuntimeError":[],"ImageAsset.cloneWithAttributes":[],"ImageAsset.getData":[],"ImageAsset.loadBitmap":[],"ImageAsset.loadImage":[],"ImageAsset.measure":[],"CodeFile.remove":["removeCodeFile"],"CodeFile.rename":["renameCodeFile"],"CodeFile.setFileContent":["setCodeFileContent"],"CodeFile.getVersions":[],"CodeFile.showProgressOnInstances":[],"CodeFile.removeProgressFromInstances":[],"CodeFile.lint":[],"CodeFile.typecheck":[],"CodeFileVersion.getContent":[],"ComponentInstancePlaceholder.setAttributes":[],"ComponentInstancePlaceholder.remove":[],"ComponentInstancePlaceholder.replaceWithComponentInstance":["replaceComponentInstancePlaceholderWithComponentInstance"],"Field.remove":["removeCollectionFields"],"Field.setAttributes":["addCollectionFields"],"EnumField.addCase":["addEnumCase"],"EnumField.setCaseOrder":["setEnumCaseOrder"],"Collection.addFields":["addCollectionFields"],"Collection.addItems":["addCollectionItems2"],"Collection.getFields":[],"Collection.getItems":[],"Collection.getPluginData":[],"Collection.getPluginDataKeys":[],"Collection.removeFields":["removeCollectionFields"],"Collection.removeItems":["removeCollectionItems"],"Collection.setAsActive":[],"Collection.setFieldOrder":["setCollectionFieldOrder"],"Collection.setItemOrder":["setCollectionItemOrder"],"Collection.setPluginData":["setPluginDataForNode"],"CollectionItem.getPluginData":[],"CollectionItem.getPluginDataKeys":[],"CollectionItem.remove":["removeCollectionItems"],"CollectionItem.setAttributes":["setCollectionItemAttributes2"],"CollectionItem.setPluginData":["setPluginDataForNode"],"ManagedCollection.addItems":["addManagedCollectionItems2"],"ManagedCollection.getFields":[],"ManagedCollection.getItemIds":[],"ManagedCollection.getPluginData":[],"ManagedCollection.getPluginDataKeys":[],"ManagedCollection.removeItems":["removeManagedCollectionItems"],"ManagedCollection.setAsActive":[],"ManagedCollection.setFields":["setManagedCollectionFields"],"ManagedCollection.setItemOrder":["setManagedCollectionItemOrder"],"ManagedCollection.setPluginData":["setPluginDataForNode"],"Node.clone":["cloneNode"],"Node.getChildren":[],"Node.getNodesWithAttribute":[],"Node.getNodesWithAttributeSet":[],"Node.getNodesWithType":[],"Node.getParent":[],"Node.getPluginData":[],"Node.getPluginDataKeys":[],"Node.getRect":[],"Node.remove":["removeNodes2"],"Node.select":[],"Node.setAttributes":["setAttributes"],"Node.setPluginData":["setPluginDataForNode"],"Node.walk":[],"Node.zoomIntoView":[],"TextNode.getText":[],"TextNode.setText":["setTextForNode"],"TextNode.setHTML":[se],"TextNode.getHTML":[],"ComponentNode.addVariant":["addVariantToComponent"],"ComponentNode.addGestureVariant":["addGestureVariantToComponent"],"ComponentNode.getVariables":[],"ComponentNode.addVariables":["addVariables"],"ComponentNode.removeVariables":["removeVariables"],"WebPageNode.getBreakpointSuggestions":[],"WebPageNode.addBreakpoint":["addBreakpointToWebPage"],"WebPageNode.getActiveCollectionItem":[],"ColorStyle.getPluginData":[],"ColorStyle.getPluginDataKeys":[],"ColorStyle.remove":["removeColorStyle"],"ColorStyle.setAttributes":["setColorStyleAttributes"],"ColorStyle.setPluginData":["setPluginDataForNode"],"TextStyle.getPluginData":[],"TextStyle.getPluginDataKeys":[],"TextStyle.remove":["removeTextStyle"],"TextStyle.setAttributes":["setTextStyleAttributes"],"TextStyle.setPluginData":["setPluginDataForNode"],"Variable.setAttributes":["updateVariable"],"Variable.remove":["removeVariables"],"ComponentNode.setVariableOrder":["setVariableOrder"],"EnumCase.remove":["removeEnumCase"],"EnumCase.setAttributes":["updateEnumCase"],"EnumVariable.addCase":["addEnumCase"],"EnumVariable.setCaseOrder":["setEnumCaseOrder"],publish:["publish"],getDeployments:[],deploy:["deploy"],getChangedPagePaths:[],getChangeAuthors:[],createCollection:["createCollection"],createManagedCollection:["createManagedCollection"],[Bt]:[],[Ut]:[],[Ot]:[],[zt]:[]},kt=[];for(let i of Object.keys(ci))ci[i].length!==0&&kt.push(i);S(kt);function pi(i){let e={};for(let t of kt){let n=ci[t];e[t]=n.every(o=>i[o]);}return e}r(pi,"createPerMethodPermissionMap");function Un(){let i={};for(let e of kt)i[e]=true;return i}r(Un,"createPerMethodPermissionMapForTesting");var pe=null;function On(i){if(typeof window>"u")return;if(!pe){let t=document.createElement("style");document.head.appendChild(t),pe=t.sheet;}if(!pe){i();return}let e=pe.insertRule("* { transition: none !important; animation: none !important; }");i(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{pe&&pe.deleteRule(e);});});}r(On,"withDisabledCssTransitions");var qe=class{static{r(this,"PluginEngine");}methodInvocationId=0;notificationId=0;postMessage;methodResponseHandlers=new Map;mode;subscriptions=new Map;perMethodPermissionMap;permissionSubscriptions=new Set;messageTypesCheckedInIsAllowedTo=new Set;showUncheckedPermissionToasts=true;environmentInfo=null;menuItemOnActionCallbackMap=new Map;contextMenuItemOnActionCallbackMap=new Map;constructor(e){if(!e){this.postMessage=()=>{},this.mode="canvas",this.perMethodPermissionMap=Un();return}switch(e.transport.onMessage(this.onMessage),typeof window<"u"&&(window.addEventListener("error",t=>{t.error instanceof j&&(t.preventDefault(),t.stopImmediatePropagation());}),window.addEventListener("unhandledrejection",t=>{t.reason instanceof j&&(t.preventDefault(),t.stopImmediatePropagation());})),this.mode=e.mode,this.environmentInfo=e.environmentInfo,this.perMethodPermissionMap=pi(e.permissionMap),this.postMessage=(t,n)=>e.transport.send(t,n),this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":typeof window<"u"&&window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown");}),e.theme&&this.applyPluginTheme(e.theme),this.subscribe("theme",this.applyPluginTheme);break;case "api":break;default:st(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,undefined,...t)}async invokeTransferable(e,t,...n){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:n.map(L)};this.methodInvocationId+=1,this.methodResponseHandlers.set(d.id,{resolve:a,reject:s}),this.postMessage(d,t);})}subscribe(e,t){this.postMessage({type:"subscribe",topic:e});let n=this.subscriptions.get(e)??new Set;return n.add(t),this.subscriptions.set(e,n),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(t),o.size===0&&this.postMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o);}}onMessage=e=>{let t=e?.data??e;if(Rn(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=pi(t.permissionMap);for(let n of this.permissionSubscriptions)n();break}case "methodResponse":{let n=this.methodResponseHandlers.get(t.id);if(!n)throw new Error(`No handler for response with id ${t.id}`);this.methodResponseHandlers.delete(t.id),g(t.error)?n.reject(new _e(t.error)):n.resolve(t.result);break}case "subscriptionMessage":{let{topic:n,payload:o}=t,a=this.subscriptions.get(n);if(!a)throw new Error("Received a subscription message but no handler present");for(let s of a)s(o);break}case "menuAction":{let n=this.getOnActionFromCallbackMap(t.actionId,t.actionType);if(!n)throw new Error("Menu action received for an unknown menu item");n();break}default:st(t);}};getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:st(t);}}applyPluginTheme=e=>{On(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});};async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?x(t,this):null}async setAttributes(e,t){let n=await this.invoke("setAttributes",e,t);return n?x(n,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?x(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(n=>{let o=x(n,this);return m(He(o)),o})}notify=(e,t)=>{let n=`notification-${this.notificationId}`;return this.notificationId+=1,this.invoke("notify",e,{notificationId:n,variant:t?.variant??"info",buttonText:t?.button?.text,durationMs:t?.durationMs}).then(o=>{o==="actionButtonClicked"&&t?.button?.onClick&&t.button.onClick(),t?.onDisappear&&t.onDisappear();}),{close:()=>this.invoke("closeNotification",n)}};async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=vt(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let n=vt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",n,t);}};function vo(i){return i.type==="component"}r(vo,"isCodeFileComponentExport");function No(i){return i.type==="override"}r(No,"isCodeFileOverrideExport");var mi=class{static{r(this,"CodeFileVersion");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get createdAt(){return this.#e.createdAt}get createdBy(){return this.#e.createdBy}constructor(e,t){this.#t=t,this.#e=e;}async getContent(){return await this.#t.invoke("getCodeFileVersionContent",this.#e.fileId,this.#e.id)}},_=class i{static{r(this,"CodeFile");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get path(){return this.#e.path}get content(){return this.#e.content}get exports(){return this.#e.exports}get versionId(){return this.#e.versionId}constructor(e,t){this.#t=t,this.#e=e;}async setFileContent(e){let t=await this.#t.invoke("setCodeFileContent",this.id,e);return new i(t,this.#t)}async rename(e){let t=await this.#t.invoke("renameCodeFile",this.id,e);return new i(t,this.#t)}async remove(){return this.#t.invoke("removeCodeFile",this.id)}async getVersions(){return (await this.#t.invoke("getCodeFileVersions",this.id)).map(t=>new mi(t,this.#t))}async showProgressOnInstances(e){return this.#t.invoke("showProgressOnInstances",this.id,e)}async removeProgressFromInstances(){return this.#t.invoke("removeProgressFromInstances",this.id)}async lint(e){return await this.#t.invoke("lintCode",this.name,this.content,e)}async typecheck(e){return await this.#t.invoke("typecheckCode",this.name,this.content,e)}async navigateTo(){return this.#t.invoke("navigateTo",this.id)}};var Mt=class i{static{r(this,"ComponentInstancePlaceholder");}#e;#t;constructor(e,t){this.#e=e,this.#t=t;}get id(){return this.#e.id}get width(){return this.#e.width}get height(){return this.#e.height}get title(){return this.#e.title}get codePreview(){return this.#e.codePreview}async setAttributes(e){let t=await this.#t.invoke("updateComponentInstancePlaceholder",this.id,e);return t?new i(t,this.#t):null}async remove(){await this.#t.invoke("removeComponentInstancePlaceholder",this.id);}async replaceWithComponentInstance(e,t){let n=await this.#t.invoke("replaceComponentInstancePlaceholderWithComponentInstance",this.id,e,t);if(!n)return null;let o=x(n,this.#t);return m(ce(o)),o}};var ko=(()=>{let i=null;return {disableUntilMouseUp:()=>{if(i)return;i=document.createElement("style"),i.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(i);let e=r(()=>{i&&(document.head.removeChild(i),i=null,o());},"enablePointerEvents"),t=r(a=>{a.buttons>0&&a.buttons&1||e();},"handlePointerChange"),n=r(()=>{e();},"handleBlur");window.addEventListener("pointerup",t,true),window.addEventListener("pointermove",t,true),window.addEventListener("blur",n);function o(){window.removeEventListener("pointerup",t,true),window.removeEventListener("pointermove",t,true),window.removeEventListener("blur",n);}r(o,"cleanup");}}})(),zn=5,Mo=(()=>{let i=1;return {next:()=>`drag-${i++}`}})();function Eo(){}r(Eo,"noop");function Gn(i,e,t,n){if(i.mode!=="canvas")return Eo;let o=Mo.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,T=ne.subscribeToIsAllowedTo("makeDraggable",p=>{p||I();}),C=r(p=>{ne.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&i.invoke("onDragEnd",{...p,dragSessionId:o}).then(y=>{try{n?.(y);}catch{}}).catch(y=>{if(y instanceof Error){n?.({status:"error",reason:y.message});return}if(typeof y=="string"){n?.({status:"error",reason:y});return}n?.({status:"error"});}),I());},"endDrag"),D=r(p=>{if(!ne.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(p.buttons>0&&!!(p.buttons&1))){C({cancelled:false});return}let{clientX:F,clientY:Y}=p;if(s.type==="pointerDown"){let ye=F-s.dragStart.mouse.x,Mi=Y-s.dragStart.mouse.y;if(Math.abs(ye)<zn&&Math.abs(Mi)<zn)return;s={type:"dragging",dragStart:s.dragStart},i.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),ko.disableUntilMouseUp();}d.setPointerCapture(p.pointerId);let P={x:F,y:Y};i.invoke("onDrag",{dragSessionId:o,mouse:P}).then(ye=>{s.type==="dragging"&&(document.body.style.cursor=ye??"");});},"handlePointerChange"),O=r(p=>{p.key==="Escape"&&C({cancelled:true});},"handleKeyDown"),z=r(()=>{C({cancelled:true});},"handleBlur"),f=r(p=>{if(!ne.isAllowedTo("makeDraggable"))return;C({cancelled:true});let y=e.getBoundingClientRect(),F={x:y.x,y:y.y,width:y.width,height:y.height},Y,P=e.querySelectorAll("svg");if(P.length===1){let rt=P.item(0).getBoundingClientRect();Y={x:rt.x,y:rt.y,width:rt.width,height:rt.height};}let ye={x:p.clientX,y:p.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:F,svgRect:Y,mouse:ye}},i.invoke("setDragData",o,t()),d.addEventListener("pointermove",D,true),d.addEventListener("pointerup",D,true),window.addEventListener("keydown",O,true),window.addEventListener("blur",z);},"handlePointerDown"),u=r(()=>{if(!ne.isAllowedTo("makeDraggable"))return;let p=t();p.type==="detachedComponentLayers"&&i.invoke("preloadDetachedComponentLayers",p.url),p.type==="image"&&i.invoke("preloadImageUrlForInsertion",p.image),p.previewImage&&i.invoke("preloadDragPreviewImage",p.previewImage);},"preload");e.addEventListener("pointerdown",f),e.addEventListener("mouseenter",u);function I(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",D,true),d.removeEventListener("pointerup",D,true),window.removeEventListener("keydown",O,true),window.removeEventListener("blur",z);}return r(I,"dragCleanup"),()=>{e.removeEventListener("pointerdown",f),e.removeEventListener("mouseenter",u),C({cancelled:true}),T();}}r(Gn,"makeDraggable");var me=class i{static{r(this,"Redirect");}#e;#t;get id(){return this.#e.id}get from(){return this.#e.from}get to(){return this.#e.to}get expandToAllLocales(){return this.#e.expandToAllLocales}constructor(e,t){this.#t=t,this.#e=e;}remove(){return this.#t.invoke("removeRedirects",[this.id])}async setAttributes(e){let t={...e,id:this.id},[n]=await this.#t.invoke("addRedirects",[t]);return m(ot(n)),b(n)?null:new i(n,this.#t)}};var gi=class{static{r(this,"FramerPluginAPI");}#e;constructor(e){this.#e=e;}get mode(){return this.#e.mode}isAllowedTo(...e){return e.every(t=>this.#e.perMethodPermissionMap[t])}subscribeToIsAllowedTo(...e){let[t,n]=Ai(e),o=this.isAllowedTo(...t),a=r(()=>{let s=this.isAllowedTo(...t);s!==o&&(o=s,n(o));},"update");return this.#e.permissionSubscriptions.add(a),()=>{this.#e.permissionSubscriptions.delete(a);}}async showUI(e){return this.#e.invoke("showUI",e)}async hideUI(){return this.#e.invoke("hideUI")}async setBackgroundMessage(e){return this.#e.invoke("setBackgroundMessage",e)}closePlugin(e,t){throw this.#e.invoke("closePlugin",e,t),new j}async getCurrentUser(){return this.#e.invoke("getCurrentUser2")}async getProjectInfo(){return this.#e.invoke("getProjectInfo2")}async getSelection(){return (await this.#e.invoke("getSelection")).map(t=>{let n=x(t,this.#e);return m(He(n)),n})}async setSelection(e){let t=g(e)?[e]:Array.from(e);return this.#e.invoke("setSelection",t)}subscribeToSelection(e){return this.#e.subscribe("selection",t=>{let n=t.map(o=>{let a=x(o,this.#e);return m(He(a)),a});e(n);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=x(e,this.#e);return m(ui(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let n=x(t,this.#e);m(ui(n)),e(n);})}async getPublishInfo(){return this.#e.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.#e.subscribe("publishInfo",e)}async createFrameNode(e,t){let n=await this.#e.invoke("createNode","FrameNode",t??null,e);if(!n)return null;let o=x(n,this.#e);return m(o instanceof R),o}async removeNodes(e){return this.#e.invoke("removeNodes2",e)}async removeNode(e){return this.removeNodes([e])}async cloneNode(e){return this.#e.cloneNode(e)}async getNode(e){let t=await this.#e.invoke("getNode",e);return t?x(t,this.#e):null}async getParent(e){return this.#e.getParent(e)}async getChildren(e){return this.#e.getChildren(e)}async getRect(e){return this.#e.invoke("getRect",e)}async zoomIntoView(e,t){let n=g(e)?[e]:Array.from(e);return this.#e.invoke("zoomIntoView",n,t)}async setAttributes(e,t){return this.#e.setAttributes(e,t)}async setParent(e,t,n){return this.#e.invoke("setParent",e,t,n)}async getNodesWithType(e){return (await this.#e.invoke("getNodesWithType",null,e)).map(n=>x(n,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(n=>x(n,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(n=>x(n,this.#e))}async getImage(){let e=await this.#e.invoke("getImage");return e?h(this.#e,e):null}subscribeToImage(e){return this.#e.subscribe("image",t=>{if(!t){e(null);return}e(h(this.#e,t));})}async addImage(e){let t=await Ae(e),n=H(t);return this.#e.invokeTransferable("addImage",n,t)}async setImage(e){let t=await Ae(e),n=H(t);return this.#e.invokeTransferable("setImage",n,t)}async uploadImage(e){let t=await Ae(e),n=H(t),o=await this.#e.invokeTransferable("uploadImage",n,t);return h(this.#e,o)}async addImages(e){let t=await ai(e),n=t.flatMap(H);await this.#e.invokeTransferable("addImages",n,t);}async uploadImages(e){let t=await ai(e),n=t.flatMap(H),o=await this.#e.invokeTransferable("uploadImages",n,t);return h(this.#e,o)}async uploadFile(e){let t=await oi(e),n=await this.#e.invokeTransferable("uploadFile",H(t),t);return h(this.#e,n)}async uploadFiles(e){let t=await Promise.all(e.map(oi)),n=t.flatMap(H),o=await this.#e.invokeTransferable("uploadFiles",n,t);return h(this.#e,o)}async addSVG(e){return this.#e.invoke("addSVG",e)}async addComponentInstance({url:e,attributes:t,parentId:n}){let o=await this.#e.invoke("addComponentInstance",{url:e,attributes:t,parentId:n}),a=x(o,this.#e);return m(ce(a)),a}async addDetachedComponentLayers({url:e,layout:t,attributes:n}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:n}),a=x(o,this.#e);return m(Ft(a)),a}async preloadDetachedComponentLayers(e){await this.#e.invoke("preloadDetachedComponentLayers",e);}async preloadImageUrlForInsertion(e){await this.#e.invoke("preloadImageUrlForInsertion",e);}async preloadDragPreviewImage(e){await this.#e.invoke("preloadDragPreviewImage",e);}async getText(){return this.#e.invoke("getText")}async setText(e){return this.#e.invoke("setText",e)}async addText(e,t){return this.#e.invoke("addText",e,t)}async setCustomCode(e){return this.#e.invoke("setCustomCode",e)}async getCustomCode(){return this.#e.invoke("getCustomCode")}subscribeToCustomCode(e){return this.#e.subscribe("customCode",e)}subscribeToText(e){return this.#e.subscribe("text",e)}makeDraggable(e,t,n){return Gn(this.#e,e,t,n)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return m(e,"Collection data must be defined"),new ue(e,this.#e)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.#e.invoke("getManagedCollections");return m(e,"Collections data must be defined"),e.map(t=>new ue(t,this.#e))}async getCollection(e){let t=await this.#e.invoke("getCollection",e);return t?new Z(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new Z(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new Z(t,this.#e))}notify=(e,t)=>this.#e.notify(e,t);async getPluginData(e){return this.#e.invoke("getPluginData",e)}async setPluginData(e,t){return this.#e.invoke("setPluginData",e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeys")}async getColorStyles(){let e=await this.#e.invoke("getColorStyles");return h(this.#e,e)}async getColorStyle(e){let t=await this.#e.invoke("getColorStyle",e);return t?h(this.#e,t):null}async createColorStyle(e){let t=await this.#e.invoke("createColorStyle",e);return h(this.#e,t)}subscribeToColorStyles(e){return this.#e.subscribe("colorStyles",t=>{let n=h(this.#e,t);return e(n)})}async getTextStyles(){let e=await this.#e.invoke("getTextStyles");return h(this.#e,e)}async getTextStyle(e){let t=await this.#e.invoke("getTextStyle",e);return t?h(this.#e,t):null}async createTextStyle(e){let t=await this.#e.invoke("createTextStyle",e);return h(this.#e,t)}subscribeToTextStyles(e){return this.#e.subscribe("textStyles",t=>{let n=h(this.#e,t);return e(n)})}async getFont(e,t){let n=await this.#e.invoke("getFont",e,t);return n?h(this.#e,n):null}async getFonts(){let e=await this.#e.invoke("getFonts");return h(this.#e,e)}getLocales(){return this.#e.invoke("getLocales")}getDefaultLocale(){return this.#e.invoke("getDefaultLocale")}getActiveLocale(){return this.#e.invoke("getActiveLocale")}async getLocalizationGroups(){return this.#e.invoke("getLocalizationGroups")}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new me(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let n=t.map(o=>new me(o,this.#e));return e(n)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(n=>new me(n,this.#e))}async removeRedirects(e){return this.#e.invoke("removeRedirects",e)}async setRedirectOrder(e){return this.#e.invoke("setRedirectOrder",e)}async createCodeFile(e,t,n){let o=await this.#e.invoke("createCodeFile",e,t,n);return new _(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let n of e)t.push(new _(n,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new _(t,this.#e):null}lintCode(e,t,n){return this.#e.invoke("lintCode",e,t,n)}typecheckCode(e,t,n){return this.#e.invoke("typecheckCode",e,t,n)}subscribeToCodeFiles(e){return this.#e.subscribe("codeFiles",t=>{let n=t?.map(o=>new _(o,this.#e));return e(n)})}setMenu(e){return this.#e.setMenu(e)}showContextMenu(e,t){return this.#e.showContextMenu(e,t)}async unstable_ensureMinimumDependencyVersion(e,t){return this.#e.invoke("unstable_ensureMinimumDependencyVersion",e,t)}async navigateTo(e,t){return this.#e.invoke("navigateTo",e,t)}subscribeToOpenCodeFile(e){return this.#e.subscribe("openCodeFile",t=>{let n=t?new _(t,this.#e):null;return e(n)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),n=x(t,this.#e);return m(n instanceof ie,"Expected node to be a DesignPageNode"),n}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),n=x(t,this.#e);return m(n instanceof ee,"Expected node to be a WebPageNode"),n}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new Z(t,this.#e)}},fi=class extends gi{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},Ye=class extends fi{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new Mt(t,this.#e)}async[l.getAiServiceInfo](){return this.#e.invoke(dt)}async[l.sendTrackingEvent](e,t,n){return this.#e.invoke(ut,e,t,n)}async[l.getHTMLForNode](e){return this.#e.invoke(ae,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(se,e,t)}get[l.environmentInfo](){return this.#e.environmentInfo}get[l.showUncheckedPermissionToasts](){return this.#e.showUncheckedPermissionToasts}set[l.showUncheckedPermissionToasts](e){this.#e.showUncheckedPermissionToasts=e;}async createTextNode(e,t){let n=await this.#e.invoke("createNode","TextNode",t??null,e);if(!n)return null;let o=x(n,this.#e);return m(o instanceof Q),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let n=x(t,this.#e);return m(n instanceof te),n}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new je(t,this.#e))}async publish(){return this.#e.invoke("publish")}async getDeployments(){return this.#e.invoke("getDeployments")}async deploy(e,t){return this.#e.invoke("deploy",e,t)}async getChangedPagePaths(e,t){return this.#e.invoke("getChangedPagePaths",e,t)}async getChangeAuthors(e,t){return this.#e.invoke("getChangeAuthors",e,t)}async createManagedCollection(e){let t=await this.#e.invoke("createManagedCollection",e);return new ue(t,this.#e)}};var yi=class{constructor(e){this.origin=e;}static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function Vo(){return new Promise(i=>{function e({data:t,origin:n}){if(!Bn(t))return;window.removeEventListener("message",e);let a={transport:new yi(n),mode:t.mode,permissionMap:t.permissionMap,environmentInfo:t.environmentInfo,origin:n,theme:t.theme??null};i(a);}r(e,"handshakeListener"),window.addEventListener("message",e),window.parent.postMessage(Ln,"*");})}r(Vo,"createBrowserContext");async function Ao(){return typeof window<"u"?Vo():null}r(Ao,"bootstrap");var Kn=await Ao(),ne=Kn?new Ye(new qe(Kn)):new Proxy({},{get(i,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});function $n(i){return new Ye(new qe(i))}r($n,"createFramerInstance");var Lo=Wo,Hn=Lo.env;function Ro(i){Object.assign(Hn,i);}r(Ro,"configure");function ge(i,e){return Hn[i]??e}r(ge,"getEnv");var jn=typeof globalThis.WebSocket<"u"?globalThis.WebSocket:WebSocket,_n,qn;try{_n=await import('node:fs'),qn=await import('node:path');}catch{}var hi=_n,bi=qn;function w(i,...e){if(i)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let n=t.stack.split(`
|
|
10
|
-
`);
|
|
11
|
-
`)):
|
|
12
|
-
`));}catch{}throw t}r(w,"assert");var Yn={showUI:false,hideUI:false,closePlugin:false,notify:false,setMenu:false,showContextMenu:false,preloadDetachedComponentLayers:false,preloadDragPreviewImage:false,preloadImageUrlForInsertion:false,setBackgroundMessage:false,getSelection:false,getActiveCollection:false,getActiveManagedCollection:false,getActiveLocale:false,zoomIntoView:false,navigateTo:false,getPluginData:false,setPluginData:false,getPluginDataKeys:false,makeDraggable:false,subscribeToSelection:false,subscribeToImage:false,subscribeToText:false,subscribeToCustomCode:false,subscribeToColorStyles:false,subscribeToTextStyles:false,subscribeToRedirects:false,subscribeToCodeFiles:false,subscribeToOpenCodeFile:false,subscribeToIsAllowedTo:false,subscribeToCanvasRoot:false,subscribeToPublishInfo:false,unstable_ensureMinimumDependencyVersion:false,removeNode:true,removeNodes:true,addSVG:true,getRect:true,setText:true,getText:true,addText:true,setCustomCode:true,getCustomCode:true,getLocales:true,getDefaultLocale:true,getLocalizationGroups:true,setLocalizationData:true,getCurrentUser:true,getProjectInfo:true,setSelection:true,getCanvasRoot:true,getPublishInfo:true,cloneNode:true,getNode:true,getParent:true,getChildren:true,setAttributes:true,getNodesWithType:true,getNodesWithAttribute:true,getNodesWithAttributeSet:true,addImages:true,getImage:true,addImage:true,setImage:true,uploadImage:true,uploadImages:true,uploadFile:true,uploadFiles:true,setParent:true,addComponentInstance:true,addDetachedComponentLayers:true,getManagedCollection:true,getManagedCollections:true,getCollection:true,getCollections:true,getColorStyle:true,getColorStyles:true,createColorStyle:true,getTextStyle:true,getTextStyles:true,createTextStyle:true,getFont:true,getFonts:true,createCodeFile:true,getCodeFiles:true,getCodeFile:true,lintCode:true,typecheckCode:true,addRedirects:true,getRedirects:true,setRedirectOrder:true,removeRedirects:true,addComponentInstancePlaceholder:true,publish:true,getDeployments:true,deploy:true,getChangedPagePaths:true,getChangeAuthors:true,createManagedCollection:true,createCollection:true,getVectorSets:true,createDesignPage:true,createWebPage:true,createTextNode:true,createComponentNode:true,mode:true,isAllowedTo:true,createFrameNode:true};function xi(i){return i in Yn?Yn[i]===true:false}r(xi,"isAllowedMethod");var Et=class i{static{r(this,"FramerAPI");}requestId;#e;#t;constructor(e,t,n){this.#t=e,this.#e=t,this.requestId=n;}static create(e,t,n){let o=new i(e,t,n);return new Proxy(o,{get(a,s){if(s in a)return Reflect.get(a,s);if(!xi(s))return;let d=Reflect.get(a.#t,s);return typeof d=="function"?d.bind(a.#t):d},has(a,s){return s in a?true:xi(s)?s in a.#t:false}})}async disconnect(){await this.#e();}[Symbol.dispose]=()=>{this.#e();};[Symbol.asyncDispose]=()=>this.#e()};var Bo=/^.+--([A-Za-z0-9]+)/u,Xn=/^[A-Za-z0-9]{20}$/u;function Zn(i){if(Xn.test(i))return i;try{let t=new URL(i,"https://framer.com").pathname.split("/").filter(Boolean),n=t.findIndex(o=>o.toLowerCase()==="projects");if(n>=0){let o=t[n+1];if(o!==void 0){let a=decodeURIComponent(o),d=a.match(Bo)?.[1]??a;if(Xn.test(d))return d}}return null}catch{return null}}r(Zn,"parseProjectId");var re=class extends Error{static{r(this,"FramerAPIError");}constructor(e){super(e),this.name="FramerAPIError",this.stack=undefined;}};var Ci={silent:0,error:1,warn:2,info:3,debug:4};function Uo(){let i=ge("FRAMER_API_LOG_LEVEL")?.toLowerCase();return i&&i in Ci?i:"warn"}r(Uo,"getLogLevel");var Ii=Uo();function Xe(i){return Ci[i]<=Ci[Ii]}r(Xe,"shouldLog");var Ze=globalThis.console,Oo="\x1B[90m",zo="\x1B[0m";function Go(i){return i?`[FramerAPI:${i}]`:"[FramerAPI]"}r(Go,"formatPrefix");function Ko(i,...e){return [Oo+i,...e,zo]}r(Ko,"formatDebug");function Jn(i){let e=Go(i);return {warn:(...t)=>{Xe("warn")&&Ze.warn(e,...t);},error:(...t)=>{Xe("error")&&Ze.error(e,...t);},log:(...t)=>{Xe("info")&&Ze.log(e,...t);},info:(...t)=>{Xe("info")&&Ze.info(e,...t);},debug:(...t)=>{Xe("debug")&&Ze.debug(...Ko(e,...t));},setLevel:t=>{Ii=t;},getLevel:()=>Ii,withRequestId:t=>Jn(t)}}r(Jn,"createLogger");var k=Jn();k.warn;k.error;k.log;k.info;k.debug;k.setLevel;k.getLevel;var Qn;function er({error:i,tags:e,extras:t,critical:n,caller:o}){w(Qn,"Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment");let a=Pi(i,o);return Qn({error:a,tags:{...a.tags,...e},extras:{...a.extras,...t},critical:!!n}),a}r(er,"reportError");function Pi(i,e=Pi){return i instanceof Error?i:new Ti(i,e)}r(Pi,"reportableError");var Ti=class extends Error{static{r(this,"UnhandledError");}constructor(e,t){let n=e?JSON.stringify(e):"No error message provided";if(super(n),this.message=n,t&&Error.captureStackTrace)Error.captureStackTrace(this,t);else try{throw new Error}catch(o){this.stack=o.stack;}}};var Je=typeof window<"u"?window.location.hostname:undefined,tr=!!(Je&&["web.framerlocal.com","localhost","127.0.0.1","[::1]"].includes(Je)),Si=(()=>{if(!Je)return;if(tr)return {main:Je,previewLink:undefined};let i=/^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u,e=Je.match(i);if(!(!e||!e[3]))return {previewLink:e[2]&&e[0],main:e[3]}})();({hosts:Si,isDevelopment:Si?.main==="development.framer.com",isProduction:Si?.main==="framer.com",isLocal:tr});var Vt;function At(){return typeof window>"u"?{}:Vt||(Vt=jo(),Vt)}r(At,"getServiceMap");function jo(){let i=window.location,e=window?.bootstrap?.services;if(e)return e;let t;try{if(t=window.top.location.origin,e=window.top?.bootstrap?.services,e)return e}catch{}if(t&&t!==i.origin)throw Error(`Unexpectedly embedded by ${t} (expected ${i.origin})`);if(i.origin.endsWith("framer.com")||i.origin.endsWith("framer.dev"))throw Error("ServiceMap data was not provided in document");try{let n=new URLSearchParams(i.search).get("services")||new URLSearchParams(i.hash.substring(1)).get("services");n&&(e=JSON.parse(n));}catch{}if(e&&typeof e=="object"&&e.api)return e;throw Error("ServiceMap requested but not available")}r(jo,"extractServiceMap");function Qe(i,e=0,t=new Set){if(i===null)return i;if(typeof i=="function")return `[Function: ${i.name??"unknown"}]`;if(typeof i!="object")return i;if(i instanceof Error)return `[${i.toString()}]`;if(t.has(i))return "[Circular]";if(e>2)return "...";t.add(i);try{if("toJSON"in i&&typeof i.toJSON=="function")return Qe(i.toJSON(),e+1,t);if(Array.isArray(i))return i.map(n=>Qe(n,e+1,t));if(Object.getPrototypeOf(i)!==Object.prototype)return `[Object: ${"__class"in i&&i.__class||i.constructor?.name}]`;{let n={};for(let[o,a]of Object.entries(i))n[o]=Qe(a,e+1,t);return n}}catch(n){return `[Throws: ${n instanceof Error?n.message:n}]`}finally{t.delete(i);}}r(Qe,"jsonSafeCopy");var _o=["trace","debug","info","warn","error"],qo=[":trace",":debug",":info",":warn",":error"];function rr(i,e){let t=[];for(let n of i.split(/[ ,]/u)){let o=n.trim();if(o.length===0)continue;let a=1,s=false;o.startsWith("-")&&(o=o.slice(1),a=3,s=true);for(let C=0;C<=4;C++){let D=qo[C];if(D&&o.endsWith(D)){a=C,s&&(a+=1),o=o.slice(0,o.length-D.length),o.length===0&&(o="*");break}}let d=new RegExp("^"+ea(o).replace(/\\\*/gu,".*")+"$"),T=0;for(let C of e)C.id.match(d)&&(C.level=a,++T);T===0&&t.push(n);}return t}r(rr,"applyLogLevelSpec");var et=class i{constructor(e,t,n){this.logger=e;this.level=t;this.parts=n;this.id=i.nextId++,this.time=Date.now();}static{r(this,"LogEntry");}static nextId=0;id;time;stringPrefix;toMessage(){if(this.stringPrefix)return this.parts;let e=[new Date(this.time).toISOString().substr(-14,14),_o[this.level]+": ["+this.logger.id+"]"],t=0;for(;t<this.parts.length;t++){let n=this.parts[t];if(typeof n=="string"){e.push(n);continue}break}return this.stringPrefix=e.join(" "),this.parts.splice(0,t,this.stringPrefix),this.parts}toString(){return this.toMessage().map(e=>{let t=typeof e;if(t==="string")return e;if(t==="function")return `[Function: ${e.name??"unknown"}]`;if(e instanceof Error)return e.stack??e.toString();let n=JSON.stringify(Qe(e));return n?.length>253?n.slice(0,250)+"...":n}).join(" ")}},U="*:app:info,app:info",or=typeof process<"u"&&!!process.kill,Yo=or&&!!process.env.CI;Yo?U="-:warn":or&&(U="");try{typeof window<"u"&&window.localStorage&&(U=window.localStorage.logLevel||U);}catch{}try{typeof process<"u"&&(U=process.env.DEBUG||U);}catch{}try{typeof window<"u"&&Object.assign(window,{setLogLevel:lr});}catch{}try{typeof window<"u"&&window.postMessage&&window.top===window&&window.addEventListener("message",i=>{if(!i.data||typeof i.data!="object")return;let{loggerId:e,level:t,parts:n,printed:o}=i.data;if(typeof e!="string"||!Array.isArray(n)||n.length<1||typeof t!="number")return;let a=tt(e);if(t<0||t>5)return;n[0]=n[0].replace("[","*[");let s=new et(a,t,n);s.stringPrefix=n[0],q.push(s),!o&&(a.level>t||console?.log(...s.toMessage()));});}catch{}var Di;try{typeof window<"u"&&window.postMessage&&window.parent!==window&&!window.location.pathname.startsWith("/edit")&&(Di=r(i=>{try{let e=i.toMessage().map(s=>Qe(s)),t=i.logger,n=i.level,o=t.level<=i.level,a={loggerId:t.id,level:n,parts:e,printed:o};window.parent?.postMessage(a,At().app);}catch{}},"postLogEntry"));}catch{}var Fi={},q=[],ar=1e3;function oe(i,e,t){let n=new et(i,e,t);for(q.push(n),Di?.(n);q.length>ar;)q.shift();return n}r(oe,"createLogEntry");function sr(i){return typeof i=="number"&&(ar=i),q}r(sr,"getLogReplayBuffer");var Xo=/\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u,nr;function Zo(){if(!(typeof window>"u"||!window.location))return nr??=Xo.exec(window.location.pathname)?.groups?.filename,nr}r(Zo,"getFilenameFromWindowPathname");function tt(i){let e=Zo();i=(e?e+":":"")+i;let t=Fi[i];if(t)return t;let n=new wt(i);return Fi[i]=n,rr(U,[n]),Di?.(new et(n,-1,[])),n}r(tt,"getLogger");function lr(i,e=true){try{typeof window<"u"&&window.localStorage&&(window.localStorage.logLevel=i);}catch{}let t=U;U=i;let n=Object.values(Fi);for(let a of n)a.level=3;let o=rr(i,n);if(o.length>0&&console?.warn("Some log level specs matched no loggers:",o),e&&q.length>0){console?.log("--- LOG REPLAY ---");for(let a of q)a.logger.level>a.level||(a.level>=3?console?.warn(...a.toMessage()):console?.log(...a.toMessage()));console?.log("--- END OF LOG REPLAY ---");}return t}r(lr,"setLogLevel");var Jo=r(i=>{let e={...i,logs:sr().slice(-50).map(t=>t.toString().slice(0,600)).join(`
|
|
13
|
-
`)};return i.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),wt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return tt(t)}getBufferedMessages(){return q.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=(...e)=>{if(this.level>0)return;let t=oe(this,0,e);console?.log(...t.toMessage());};debug=(...e)=>{let t=oe(this,1,e);this.level>1||console?.log(...t.toMessage());};info=(...e)=>{let t=oe(this,2,e);this.level>2||console?.info(...t.toMessage());};warn=(...e)=>{let t=oe(this,3,e);this.level>3||console?.warn(...t.toMessage());};warnOncePerMinute=(e,...t)=>{let n=this.didLog[e];if(n&&n>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=oe(this,3,t);this.level>3||console?.warn(...o.toMessage());};error=(...e)=>{let t=oe(this,4,e);this.level>4||console?.error(...t.toMessage());};errorOncePerMinute=(e,...t)=>{let n=this.didLog[e];if(n&&n>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=oe(this,4,t);this.level>4||console?.error(...o.toMessage());};reportWithoutLogging=(e,t,n,o)=>{let a=Jo(t??{}),s=er({caller:this.reportWithoutLogging,error:e,tags:{...n,handler:"logger",where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]};reportError=(e,t,n,o)=>{let[a,s]=this.reportWithoutLogging(e,t,n,o);a?this.error(s,a):this.error(s);};reportErrorOncePerMinute=(e,t)=>{if(!Qo(e))return;let n=this.didLog[e.message];n&&n>Date.now()||(this.didLog[e.message]=Date.now()+1e3*60,this.reportError(e,t));};reportCriticalError=(e,t,n)=>this.reportError(e,t,n,true)};function Qo(i){return Object.prototype.hasOwnProperty.call(i,"message")}r(Qo,"isErrorWithMessage");function ea(i){return i.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(ea,"escapeRegExp");var cr;(z=>{function i(f,...u){return f.concat(u)}z.push=i,r(i,"push");function e(f){return f.slice(0,-1)}z.pop=e,r(e,"pop");function t(f,...u){return u.concat(f)}z.unshift=t,r(t,"unshift");function n(f,u,...I){let p=f.length;if(u<0||u>p)throw Error("index out of range: "+u);let y=f.slice();return y.splice(u,0,...I),y}z.insert=n,r(n,"insert");function o(f,u,I){let p=f.length;if(u<0||u>=p)throw Error("index out of range: "+u);let y=Array.isArray(I)?I:[I],F=f.slice();return F.splice(u,1,...y),F}z.replace=o,r(o,"replace");function a(f,u){let I=f.length;if(u<0||u>=I)throw Error("index out of range: "+u);let p=f.slice();return p.splice(u,1),p}z.remove=a,r(a,"remove");function s(f,u,I){let p=f.length;if(u<0||u>=p)throw Error("from index out of range: "+u);if(I<0||I>=p)throw Error("to index out of range: "+I);let y=f.slice();if(I===u)return y;let F=y[u];return u<I?(y.splice(I+1,0,F),y.splice(u,1)):(y.splice(u,1),y.splice(I,0,F)),y}z.move=s,r(s,"move");function d(f,u){let I=[],p=Math.min(f.length,u.length);for(let y=0;y<p;y++)I.push([f[y],u[y]]);return I}z.zip=d,r(d,"zip");function T(f,u,I){let p=f.slice(),y=p[u];return y===undefined||(p[u]=I(y)),p}z.update=T,r(T,"update");function C(f){return Array.from(new Set(f))}z.unique=C,r(C,"unique");function D(f,...u){return Array.from(new Set([...f,...u.flat()]))}z.union=D,r(D,"union");function O(f,u){return f.filter(u)}z.filter=O,r(O,"filter");})(cr||={});var sa=Object.prototype.hasOwnProperty;function la(i,e){return sa.call(i,e)}r(la,"hasOwnProperty");var pr;(n=>{function i(o,a){for(let s of Object.keys(o))la(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===undefined&&(o[s]=a[s]);return Object.setPrototypeOf(o,Object.getPrototypeOf(a)),o}n.morphUsingTemplate=i,r(i,"morphUsingTemplate");function e(o,a){a&&Object.assign(o,a);}n.writeOnce=e,r(e,"writeOnce");function t(o,a){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,a)}n.update=t,r(t,"update");})(pr||={});var mr;(o=>{function i(a,...s){return new Set([...a,...s])}o.add=i,r(i,"add");function e(a,...s){let d=new Set(a);for(let T of s)d.delete(T);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let T of d)s.add(T);return s}o.union=t,r(t,"union");function n(a,s){return a.has(s)?o.remove(a,s):o.add(a,s)}o.toggle=n,r(n,"toggle");})(mr||={});var gr;(n=>{function i(o,...a){let s=new Map;o.forEach((T,C)=>s.set(C,T));let d=false;for(let T of a)T&&(T.forEach((C,D)=>s.set(D,C)),d=true);return d?s:o}n.merge=i,r(i,"merge");function e(o,a,s){let d=new Map(o);return d.set(a,s),d}n.set=e,r(e,"set");function t(o,a){let s=new Map(o);return s.delete(a),s}n.remove=t,r(t,"remove");})(gr||={});(class extends Promise{static{r(this,"ResolvablePromise");}_state="initial";resolve;reject;get state(){return this._state}pending(){return this._state="pending",this}isResolved(){return this._state==="fulfilled"||this._state==="rejected"}constructor(){let e,t;super((n,o)=>{e=n,t=o;}),this.resolve=n=>{this._state="fulfilled",e(n);},this.reject=n=>{this._state="rejected",t(n);};}});tt("task-queue");function Ni(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}r(Ni,"isObject");var fe=class{constructor(e){this.ws=e;}static{r(this,"WebSocketTransport");}send(e){this.ws.send(it.stringify(e));}waitForDisconnectAck(e){return new Promise(t=>{let n=setTimeout(()=>{this.ws.removeEventListener("message",o),t();},e),o=r(a=>{if(!(typeof a.data!="string"&&!(a.data instanceof String)))try{let s=it.parse(a.data);Ni(s)&&s.type==="disconnect-ack"&&(clearTimeout(n),this.ws.removeEventListener("message",o),t());}catch{}},"handler");this.ws.addEventListener("message",o);})}onMessage(e){this.ws.addEventListener("message",t=>{let n=typeof t.data=="string"?t.data:t.data.toString(),o=it.parse(n);if(Ni(o)&&o.type==="error"){k.error(`Server error: ${o.message||JSON.stringify(o)}`);return}if(Ni(o)&&o.type==="debug-archive"){ki(o.data);return}e(o);});}};function ki(i){w(hi,"File system module is not available."),w(bi,"Path module is not available.");let t=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,n=process.cwd(),o=bi.resolve(n,t);hi.writeFileSync(o,Buffer.from(i)),k.info(`Debug archive saved to ${o}`);}r(ki,"handleDebugArchive");function Lt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}r(Lt,"isObject");var pa={type:"pluginReadySignal"};function ma(i){return Lt(i)&&i.type==="pluginReadyResponse"}r(ma,"isPluginReadyResponse");var fr=45e3,ga=2e4;async function yr(i,e){let t=new URL(ge("FRAMER_HEADLESS_SERVER_URL","wss://api.framer.com/channel/headless-plugin"));t.protocol=t.protocol==="https:"?"wss:":t.protocol==="http"?"ws:":t.protocol,t.searchParams.set("projectId",i),k.debug(`Connecting to ${t.href}`);let n=new jn(t.href,{headers:{Authorization:`Token ${e}`}});k.debug(`WebSocket created, readyState: ${n.readyState}`);let o,a=k,s=false,d=setInterval(()=>{n.readyState===n.OPEN&&(n.send(it.stringify({type:"ping"})),a.debug("Sent ping"));},ga),T=r(()=>{clearInterval(d),n.readyState!==n.CLOSED&&n.readyState!==n.CLOSING&&n.close(1e3,"Client disconnect");},"forceClose"),C=r(async()=>{if(clearInterval(d),!(n.readyState===n.CLOSED||n.readyState===n.CLOSING)){if(s){a.debug("Initiating graceful disconnect");let O=new fe(n);O.send({type:"client-disconnect"}),await O.waitForDisconnectAck(5e3);}n.readyState!==n.CLOSED&&n.readyState!==n.CLOSING&&n.close(1e3,"Client disconnect");}},"cleanup"),D=await new Promise((O,z)=>{let f=setTimeout(()=>{T(),z(new re(`Connection timeout after ${fr}ms`));},fr),u=r(()=>{a.debug("WebSocket opened, waiting for ready");},"onOpen"),I=r(F=>{a.debug("WebSocket error:",F),clearTimeout(f),T(),z(new re("WebSocket connection failed"));},"onError"),p=r(F=>{a.debug(`WebSocket closed: code=${F.code}, reason=${F.reason||"(no reason)"}, wasClean=${F.wasClean}`),clearTimeout(f),clearInterval(d),z(new re(`WebSocket closed before handshake completed (code: ${F.code})`));},"onClose");function y(F){a.debug("Received message");let Y=typeof F.data=="string"?F.data:F.data.toString(),P=it.parse(Y);a.debug(`Message type: ${P.type}`),P.type==="error"?(clearTimeout(f),T(),z(new re(`Server error: ${P.message||JSON.stringify(P)}`))):P.type==="ready"?(Lt(P)&&"requestId"in P&&(o=String(P.requestId),a=k.withRequestId(o),a.debug(`Server request ID: ${o}`)),Lt(P)&&"version"in P&&a.debug(`Server version: ${P.version}`),Lt(P)&&P.gracefulDisconnect===true&&(s=true),a.debug("Sending pluginReadySignal"),n.send(it.stringify(pa))):P.type==="debug-archive"?ki(P.data):ma(P)&&(clearTimeout(f),n.removeEventListener("message",y),n.removeEventListener("error",I),n.removeEventListener("close",p),O(P));}r(y,"handshakeMessageHandler"),n.addEventListener("open",u),n.addEventListener("message",y),n.addEventListener("error",I),n.addEventListener("close",p);});return {ws:n,pluginReadyData:D,requestId:o,logger:a,gracefulDisconnect:s,cleanup:C}}r(yr,"connectAndHandshake");async function hr(i,e){let t=Zn(i);w(t,`Invalid project URL or ID: ${i}`);let n=e??ge("FRAMER_API_KEY");w(n,"FRAMER_API_KEY environment variable is required");let o=await yr(t,n),s={transport:new fe(o.ws),mode:o.pluginReadyData.mode,permissionMap:o.pluginReadyData.permissionMap,environmentInfo:o.pluginReadyData.environmentInfo,origin:null,theme:null},d=$n(s);o.ws.addEventListener("close",C=>{C.code!==1e3&&(o.logger.debug(`Connection closed unexpectedly: ${C.code}`),typeof process<"u"&&process.exit&&process.exit(1));});let T=r(async()=>{await o.cleanup();},"cleanup");return Et.create(d,T,o.requestId)}r(hr,"connect");async function fa(i,e,t){let n=await hr(i,t);try{return await e(n)}finally{await n.disconnect();}}r(fa,"withConnection");
|
|
4
|
+
/* Framer API SDK v0.0.1-alpha.7 */
|
|
5
|
+
var Ar=Object.defineProperty;var r=(n,e)=>Ar(n,"name",{value:e,configurable:true});function lt(n){return n!==undefined}r(lt,"isDefined");function Kn(n){return n===undefined}r(Kn,"isUndefined");function C(n){return n===null}r(C,"isNull");function $n(n){return n!==null}r($n,"isNotNull");function xe(n){return n===true||n===false}r(xe,"isBoolean");function y(n){return typeof n=="string"}r(y,"isString");function $(n){return typeof n=="number"&&Number.isFinite(n)}r($,"isNumber");function wr(n){return typeof n=="function"}r(wr,"isFunction");function v(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(v,"isObject");function dt(n){if(typeof n!="object"||n===null)return false;let e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}r(dt,"isPlainObject");function Ot(n){return Array.isArray(n)}r(Ot,"isArray");function ut(n,e){throw e||new Error(n?`Unexpected value: ${n}`:"Application entered invalid state")}r(ut,"assertNever");function g(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
6
|
+
`);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
|
|
7
|
+
`)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
|
|
8
|
+
`));}catch{}throw t}r(g,"assert");function F(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!wr(t)||F(t);}return Object.freeze(n)}r(F,"deepFreeze");function Hn(n){return [n.slice(0,-1),n.at(-1)]}r(Hn,"splitRestAndLast");var p="__class";var zt=Symbol(),Gt=Symbol(),Vr=Symbol(),Wr=Symbol(),Lr=Symbol(),Rr=Symbol(),Br=Symbol(),Kt=Symbol(),$t=Symbol(),l={getAiServiceInfo:zt,sendTrackingEvent:Gt,environmentInfo:Vr,initialState:Wr,showUncheckedPermissionToasts:Lr,marshal:Rr,unmarshal:Br,getHTMLForNode:Kt,setHTMLForNode:$t},ct="INTERNAL_",pt=`${ct}getAiServiceInfo`,mt=`${ct}sendTrackingEvent`,de=`${ct}getHTMLForNode`,ue=`${ct}setHTMLForNode`;var k=class{static{r(this,"VariableBase");}#e;#t;get nodeId(){return this.#t.nodeId}get nodeType(){return this.#t.nodeType}get id(){return this.#t.id}get name(){return this.#t.name}get description(){return this.#t.description??null}constructor(e,t){this.#e=e,this.#t=t;}async setAttributes(e){let t=await this.#e.invoke("updateVariable",this.nodeId,this.id,{...e,type:this.type});if(C(t))return null;let i=this.constructor;return new i(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},A="Variable";function V(n){let e=n.at(0);return g(!Kn(e)),`${e.toLowerCase()}${n.slice(1,-A.length)}`}r(V,"classToType");var Ur=`Boolean${A}`,Or=V(Ur),Ce=class n extends k{static{r(this,"BooleanVariable");}type=Or;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},zr=`Number${A}`,Gr=V(zr),Ie=class n extends k{static{r(this,"NumberVariable");}type=Gr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Kr=`String${A}`,$r=V(Kr),Te=class n extends k{static{r(this,"StringVariable");}type=$r;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Hr=`FormattedText${A}`,jr=V(Hr),Pe=class n extends k{static{r(this,"FormattedTextVariable");}type=jr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},_r=`Enum${A}`,qr=V(_r),H=class n{static{r(this,"EnumCase");}#e;#t;#n;#i;get id(){return this.#i.id}get name(){return this.#i.name}get nameByLocale(){return this.#i.nameByLocale}constructor(e,t,i,o){this.#e=e,this.#t=t,this.#n=i,this.#i=o;}async setAttributes(e){let t=await this.#e.invoke("updateEnumCase",this.#t,this.#n,this.id,e);return t?new n(this.#e,this.#t,this.#n,t):null}async remove(){await this.#e.invoke("removeEnumCase",this.#t,this.#n,this.id);}},Se=class n extends k{static{r(this,"EnumVariable");}type=qr;#e;#t;#n;get cases(){return this.#n||(this.#n=F(this.#t.cases.map(e=>new H(this.#e,this.nodeId,this.id,e)))),this.#n}constructor(e,t){super(e,t),this.#e=e,this.#t=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#t}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.nodeId,this.id,e);return t?new H(this.#e,this.nodeId,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.nodeId,this.id,e);}},Yr=`Color${A}`,Xr=V(Yr),Fe=class n extends k{static{r(this,"ColorVariable");}type=Xr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Zr=`Image${A}`,Jr=V(Zr),De=class n extends k{static{r(this,"ImageVariable");}type=Jr;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},Qr=`File${A}`,eo=V(Qr),ve=class n extends k{static{r(this,"FileVariable");}type=eo;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},to=`Link${A}`,no=V(to),Ne=class n extends k{static{r(this,"LinkVariable");}type=no;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},io=`Date${A}`,ro=V(io),Ee=class n extends k{static{r(this,"DateVariable");}type=ro;#e;get displayTime(){return this.#e.displayTime}constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},oo=`Border${A}`,ao=V(oo),ke=class n extends k{static{r(this,"BorderVariable");}type=ao;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}},so=`Unsupported${A}`,lo=V(so),Me=class n extends k{static{r(this,"UnsupportedVariable");}type=lo;#e;constructor(e,t){super(e,t),this.#e=t;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return this.#e}};function jn(n){return n instanceof k}r(jn,"isVariable");function uo(n){return jn(n)&&n.nodeType==="component"}r(uo,"isComponentVariable");var R=class{static{r(this,"FieldBase");}#e;#t;#n;get id(){return this.#n.id}get name(){return this.#n.name}constructor(e,t,i){this.#e=e,this.#t=t,this.#n=i;}async setAttributes(e){let t={...e,type:this.type,id:this.id},[i]=await this.#e.invoke("addCollectionFields2",this.#t,[t]);if(g(lt(i)),C(i))return null;g(i.type===this.type);let o=this.constructor;return new o(this.#e,this.#t,i)}async remove(){await this.#e.invoke("removeCollectionFields",this.#t,[this.id]);}},L=class extends R{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},gt=class extends R{static{r(this,"BooleanField");}type=_t},ft=class extends R{static{r(this,"ColorField");}type=qt},yt=class extends R{static{r(this,"NumberField");}type=Yt},ht=class extends L{static{r(this,"StringField");}type=Xt;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},bt=class extends L{static{r(this,"FormattedTextField");}type=Zt},Ae=class extends L{static{r(this,"ImageField");}type=Jt},xt=class extends L{static{r(this,"LinkField");}type=en},Ct=class extends L{static{r(this,"DateField");}type=tn;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},It=class extends R{static{r(this,"FieldDivider");}type=sn},we=class extends R{static{r(this,"UnsupportedField");}type=ln},Tt=class extends L{static{r(this,"FileField");}type=nn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},Pt=class extends R{static{r(this,"EnumField");}type=rn;#e;#t;#n;#i;get cases(){return this.#i||(this.#i=this.#n.cases.map(e=>new H(this.#e,this.#t,this.id,e)),F(this.#i)),this.#i}constructor(e,t,i){super(e,t,i),this.#e=e,this.#t=t,this.#n=i;}async addCase(e){let t=await this.#e.invoke("addEnumCase",this.#t,this.id,e);return t?new H(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},St=class extends L{static{r(this,"CollectionReferenceField");}type=on;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ft=class extends L{static{r(this,"MultiCollectionReferenceField");}type=an;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ht=class extends L{static{r(this,"ArrayField");}type=Qt;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Ae(e,t,o)];}};function jt(n,e,t){return n.map(i=>{switch(i.type){case _t:return new gt(e,t,i);case qt:return new ft(e,t,i);case Yt:return new yt(e,t,i);case Xt:return new ht(e,t,i);case Zt:return new bt(e,t,i);case Jt:return new Ae(e,t,i);case en:return new xt(e,t,i);case tn:return new Ct(e,t,i);case sn:return new It(e,t,i);case ln:return new we(e,t,i);case nn:return new Tt(e,t,i);case rn:return new Pt(e,t,i);case on:return new St(e,t,i);case an:return new Ft(e,t,i);case Qt:return new Ht(e,t,i);default:return new we(e,t,i)}})}r(jt,"fieldDefinitionDataArrayToFieldClassInstances");function co(n){return n instanceof R}r(co,"isField");var _n="action";function po(n){return !!n&&_n in n&&y(n[_n])}r(po,"isLocalizedValueUpdate");function qn(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return po(i)&&(e[t]=i),e},{})}r(qn,"filterInlineLocalizationValues");var Ve=class n{static{r(this,"FileAsset");}id;url;extension;constructor(e){this.url=e.url,this.id=e.id,this.extension=e.extension;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return {[p]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function mo(n){return n instanceof Ve}r(mo,"isFileAsset");var go="ImageAsset";function Yn(n){return v(n)?n[p]===go:false}r(Yn,"isImageAssetData");var j=class n{static{r(this,"ImageAsset");}id;url;thumbnailUrl;altText;resolution;#e;#t;constructor(e,t){this.#t=e,this.url=t.url,this.id=t.id,this.thumbnailUrl=t.thumbnailUrl,this.altText=t.altText,this.resolution=t.resolution;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[p]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:this.altText,resolution:this.resolution}}cloneWithAttributes({altText:e,resolution:t}){return new n(this.#t,{[p]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return ho(this.url)}async getData(){if(this.#e&&this.#e.bytes.length>0)return this.#e;let e=await this.#t.invoke("getImageData",{id:this.id,resolution:this.resolution});if(!e)throw new Error("Failed to load image data");return this.#e=e,e}async loadBitmap(){let{mimeType:e,bytes:t}=await this.getData(),i=new Blob([t],{type:e});return createImageBitmap(i)}async loadImage(){let e=await this.getData(),t=URL.createObjectURL(new Blob([e.bytes]));return new Promise((i,o)=>{let s=new Image;s.onload=()=>i(s),s.onerror=()=>o(),s.src=t;})}};function fo(n){return n instanceof j}r(fo,"isImageAsset");function _(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(_,"getTransferable");function yo(n){if(!v(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!y(n[t]))}r(yo,"isBytesData");async function We(n){if(n instanceof File)return cn(n);let e=await Xn(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(We,"createImageTransferFromInput");async function dn(n){if(n instanceof File)return cn(n);let e=await Xn(n.file);return {name:n.name,...e}}r(dn,"createFileTransferFromInput");async function Xn(n){return n instanceof File?cn(n):yo(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(Xn,"createAssetTransferFromAssetInput");function un(n){return Promise.all(n.map(We))}r(un,"createNamedAssetDataTransferFromInput");async function cn(n){return new Promise((e,t)=>{let i=new FileReader;i.onload=o=>{let s=n.type,a=o.target?.result;if(!a||!(a instanceof ArrayBuffer)){t(new Error("Failed to read file, arrayBuffer is null"));return}let d=new Uint8Array(a);e({bytes:d,mimeType:s,type:"bytes",name:n.name});},i.onerror=o=>{t(o);},i.readAsArrayBuffer(n);})}r(cn,"getAssetDataFromFile");async function ho(n){let e=n instanceof File,t=e?URL.createObjectURL(n):n,i=new Image;return i.crossOrigin="anonymous",new Promise((o,s)=>{i.onload=()=>{o({width:i.naturalWidth,height:i.naturalHeight});},i.onerror=a=>{s(a);},i.src=t;}).finally(()=>{e&&URL.revokeObjectURL(t);})}r(ho,"measureImage");var Dt=class{static{r(this,"ComputedValueBase");}};var bo="unsupported",Le=class n extends Dt{static{r(this,"UnsupportedComputedValue");}type=bo;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function xo(n){return n instanceof Dt}r(xo,"isComputedValue");var Co="Font";function Jn(n){return v(n)&&n[p]===Co}r(Jn,"isFontData");function Io(n){if(!$(n))return false;switch(n){case 100:case 200:case 300:case 400:case 500:case 600:case 700:case 800:case 900:return true;default:return false}}r(Io,"isFontWeight");function To(n){if(!y(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(To,"isFontStyle");function Qn(n){return v(n)?y(n.family)&&y(n.selector)&&Io(n.weight)&&To(n.style):false}r(Qn,"isFont");var z=class n{static{r(this,"Font");}selector;family;weight;style;constructor(e){this.selector=e.selector,this.family=e.family,this.weight=e.weight,this.style=e.style;}static[l.unmarshal](e,t){let i=Zn.get(t.selector);if(i)return i;let o=new n(t);return Zn.set(t.selector,o),o}[l.marshal](){return {[p]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},Zn=new Map;var Po="LinearGradient",So="RadialGradient",Fo="ConicGradient",ce=class{static{r(this,"GradientBase");}#e;get stops(){return this.#e.stops}constructor(e){this.#e=e;}cloneWithAttributes(e){let t=this.constructor;return new t({...this.#e,...e})}},Re=class n extends ce{static{r(this,"LinearGradient");}[p]=Po;#e;get angle(){return this.#e.angle}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:b(e,t.stops)})}[l.marshal](){return B({...this.#e,[p]:this[p]})}toCSS(){let e=this.#e.stops.map(t=>(g(y(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},Be=class n extends ce{static{r(this,"RadialGradient");}[p]=So;#e;get width(){return this.#e.width}get height(){return this.#e.height}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:b(e,t.stops)})}[l.marshal](){return B({...this.#e,[p]:this[p]})}toCSS(){let e=this.stops.map((t,i)=>{g(y(t.color),"ColorStyle not supported yet");let o=this.stops[i+1],s=t.position===1&&o?.position===1?t.position-1e-4:t.position;return `${t.color} ${s*100}%`}).join(", ");return `radial-gradient(${this.width} ${this.height} at ${this.x} ${this.y}, ${e})`}},Ue=class n extends ce{static{r(this,"ConicGradient");}[p]=Fo;#e;get angle(){return this.#e.angle}get x(){return this.#e.x}get y(){return this.#e.y}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:b(e,t.stops)})}[l.marshal](){return B({...this.#e,[p]:this[p]})}toCSS(){let e=this.stops.map(t=>(g(y(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*360}deg`)).join(", ");return `conic-gradient(from ${this.angle}deg at ${this.x} ${this.y}, ${e})`}};function ei(n){return n instanceof ce}r(ei,"isGradient");var Do="ColorStyle";function vt(n){return v(n)?n[p]===Do:false}r(vt,"isColorStyleData");var J=class n{static{r(this,"ColorStyle");}id;name;path;light;dark;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.light=t.light,this.dark=t.dark,this.path=t.path,this.#e=e;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[p]:"ColorStyle",id:this.id,name:this.name,light:this.light,dark:this.dark,path:this.path}}async setAttributes(e){let t=await this.#e.invoke("setColorStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeColorStyle",this.id)}};function pe(n){return n instanceof J}r(pe,"isColorStyle");var vo="TextStyle";function ti(n){return v(n)?n[p]===vo:false}r(ti,"isTextStyleData");var Oe=class n{static{r(this,"TextStyle");}id;name;path;tag;font;boldFont;italicFont;boldItalicFont;color;transform;alignment;decoration;decorationColor;decorationThickness;decorationStyle;decorationSkipInk;decorationOffset;balance;breakpoints;minWidth;fontSize;letterSpacing;lineHeight;paragraphSpacing;#e;constructor(e,t){this.id=t.id,this.name=t.name,this.path=t.path,this.tag=t.tag,this.font=z[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&z[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&z[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&z[l.unmarshal](e,t.boldItalicFont),this.color=vt(t.color)?J[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=vt(t.decorationColor)?J[l.unmarshal](e,t.decorationColor):t.decorationColor,this.decorationThickness=t.decorationThickness,this.decorationStyle=t.decorationStyle,this.decorationSkipInk=t.decorationSkipInk,this.decorationOffset=t.decorationOffset,this.balance=t.balance,this.breakpoints=t.breakpoints,this.minWidth=t.minWidth,this.fontSize=t.fontSize,this.letterSpacing=t.letterSpacing,this.lineHeight=t.lineHeight,this.paragraphSpacing=t.paragraphSpacing,this.#e=e;}static[l.unmarshal](e,t){return new n(e,t)}[l.marshal](){return {[p]:"TextStyle",id:this.id,name:this.name,path:this.path,tag:this.tag,font:this.font[l.marshal](),boldFont:this.boldFont?.[l.marshal]()??null,italicFont:this.italicFont?.[l.marshal]()??null,boldItalicFont:this.boldItalicFont?.[l.marshal]()??null,color:pe(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:pe(this.decorationColor)?this.decorationColor[l.marshal]():this.decorationColor,decorationThickness:this.decorationThickness,decorationStyle:this.decorationStyle,decorationSkipInk:this.decorationSkipInk,decorationOffset:this.decorationOffset,balance:this.balance,breakpoints:this.breakpoints,minWidth:this.minWidth,fontSize:this.fontSize,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,paragraphSpacing:this.paragraphSpacing}}async setAttributes(e){let t=await this.#e.invoke("setTextStyleAttributes",this.id,e);return t?new n(this.#e,t):null}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async remove(){return this.#e.invoke("removeTextStyle",this.id)}};function pn(n){return n instanceof Oe}r(pn,"isTextStyle");function No(n){return v(n)&&l.marshal in n}r(No,"isSelfMarshalable");function B(n){if(No(n))return n[l.marshal]();if(Ot(n))return n.map(B);if(dt(n)){let e={};for(let t of Object.keys(n))e[t]=B(n[t]);return e}return n}r(B,"marshal");var ni={ColorStyle:J,ConicGradient:Ue,FileAsset:Ve,Font:z,ImageAsset:j,LinearGradient:Re,RadialGradient:Be,TextStyle:Oe,BooleanVariable:Ce,BorderVariable:ke,ColorVariable:Fe,DateVariable:Ee,EnumVariable:Se,FileVariable:ve,FormattedTextVariable:Pe,ImageVariable:De,LinkVariable:Ne,NumberVariable:Ie,StringVariable:Te,UnsupportedVariable:Me,UnsupportedComputedValue:Le};function Eo(n){return dt(n)&&y(n[p])&&n[p]in ni}r(Eo,"isSelfUnmarshalable");function b(n,e){if(Eo(e))return ni[e[p]][l.unmarshal](n,e);if(Ot(e))return e.map(t=>b(n,t));if(dt(e)){let t={};for(let i of Object.keys(e))t[i]=b(n,e[i]);return t}return e}r(b,"unmarshal");var ko={array:false,boolean:false,collectionReference:false,color:false,date:false,enum:false,file:false,formattedText:false,image:true,link:false,multiCollectionReference:false,number:false,string:false,unsupported:false};function Mo(n){return ko[n]}r(Mo,"isSupportedArrayItemFieldType");function Ao(n){return Mo(n.type)}r(Ao,"isSupportedArrayItemFieldDataEntry");var _t="boolean",qt="color",Yt="number",Xt="string",Zt="formattedText",Jt="image",Qt="array",en="link",tn="date",nn="file",rn="enum",on="collectionReference",an="multiCollectionReference",sn="divider",ln="unsupported";function wo(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?qn(i.nameByLocale):undefined;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(wo,"sanitizeEnumFieldForMessage");function ii(n,e){let t={};for(let i in n){let o=n[i];if(!o)continue;if(o.type!=="array"){t[i]=b(e,o);continue}let s=o.value.map(a=>{let d=ii(a.fieldData,e),m={};for(let x in d){let P=d[x];g(P&&Ao(P),"Unsupported array item field data entry"),m[x]=P;}return {...a,fieldData:m}});t[i]={...o,value:s};}return t}r(ii,"deserializeFieldData");var me=class{static{r(this,"ManagedCollection");}id;name;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.readonly=e.readonly,g(e.managedBy!=="user","Managed Collection can only be managed by a plugin"),this.managedBy=e.managedBy,this.#e=t,F(this);}async getItemIds(){return this.#e.invoke("getManagedCollectionItemIds",this.id)}async setItemOrder(e){return this.#e.invoke("setManagedCollectionItemOrder",this.id,e)}async getFields(){return this.#e.invoke("getManagedCollectionFields2",this.id)}async setFields(e){let t=wo(e);return this.#e.invoke("setManagedCollectionFields",this.id,t)}async addItems(e){return this.#e.invoke("addManagedCollectionItems2",this.id,e)}async removeItems(e){return this.#e.invoke("removeManagedCollectionItems",this.id,e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},Q=class{static{r(this,"Collection");}id;name;slugFieldName;slugFieldBasedOn;readonly;managedBy;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.slugFieldName=e.slugFieldName,this.slugFieldBasedOn=e.slugFieldBasedOn,this.readonly=e.readonly,this.managedBy=e.managedBy,this.#e=t,F(this);}async setItemOrder(e){return this.#e.invoke("setCollectionItemOrder",this.id,e)}async getFields(){let e=await this.#e.invoke("getCollectionFields2",this.id,true);return jt(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return g(t.every($n)),jt(t,this.#e,this.id)}async removeFields(e){return this.#e.invoke("removeCollectionFields",this.id,e)}async setFieldOrder(e){return this.#e.invoke("setCollectionFieldOrder",this.id,e)}async getItems(){return (await this.#e.invoke("getCollectionItems2",this.id)).map(t=>new ze(t,this.#e))}async addItems(e){await this.#e.invoke("addCollectionItems2",this.id,e);}async removeItems(e){return this.#e.invoke("removeCollectionItems",e)}async setAsActive(){return this.#e.invoke("setActiveCollection",this.id)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}},ze=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=ii(e.fieldData,t);this.id=e.externalId??e.nodeId,this.nodeId=e.nodeId,this.slug=e.slug,this.slugByLocale=e.slugByLocale,this.draft=e.draft??false,this.fieldData=i,this.#e=t,F(this);}async remove(){return this.#e.invoke("removeCollectionItems",[this.id])}async setAttributes(e){let t=await this.#e.invoke("setCollectionItemAttributes2",this.id,e);return t?new n(t,this.#e):null}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}async navigateTo(e){return this.#e.invoke("navigateTo",this.nodeId,e)}};var Vo={fixed:true,sticky:true,absolute:true,relative:true},ri="position";function Us(n){if(!(ri in n))return false;let e=n[ri];return y(e)&&Vo[e]===true}r(Us,"supportsPosition");var oi="top";function Os(n){if(!(oi in n))return false;let e=n[oi];return y(e)||C(e)}r(Os,"supportsPins");var ai="width";function zs(n){if(!(ai in n))return false;let e=n[ai];return y(e)||C(e)}r(zs,"supportsSize");var si="maxWidth";function Gs(n){if(!(si in n))return false;let e=n[si];return y(e)||C(e)}r(Gs,"supportsSizeConstraints");var li="aspectRatio";function Ks(n){if(!(li in n))return false;let e=n[li];return $(e)||C(e)}r(Ks,"supportsAspectRatio");var di="name";function $s(n){if(!(di in n))return false;let e=n[di];return y(e)||C(e)}r($s,"supportsName");var ui="visible";function Hs(n){if(!(ui in n))return false;let e=n[ui];return xe(e)}r(Hs,"supportsVisible");var ci="locked";function js(n){if(!(ci in n))return false;let e=n[ci];return xe(e)}r(js,"supportsLocked");var pi="backgroundColor";function _s(n){if(!(pi in n))return false;let e=n[pi];return y(e)||pe(e)||C(e)}r(_s,"supportsBackgroundColor");var mi="backgroundColor";function qs(n){if(!(mi in n))return false;let e=n[mi];return y(e)||vt(e)||C(e)}r(qs,"supportsBackgroundColorData");var gi="backgroundImage";function Ys(n){if(!(gi in n))return false;let e=n[gi];return e instanceof j||C(e)}r(Ys,"supportsBackgroundImage");var fi="backgroundImage";function Xs(n){if(!(fi in n))return false;let e=n[fi];return e instanceof j?false:Yn(e)||C(e)}r(Xs,"supportsBackgroundImageData");var yi="backgroundGradient";function Zs(n){if(!(yi in n))return false;let e=n[yi];return ei(e)||C(e)}r(Zs,"supportsBackgroundGradient");var hi="backgroundGradient";function Js(n){if(!(hi in n))return false;let e=n[hi];return v(e)||C(e)}r(Js,"supportsBackgroundGradientData");var bi="rotation";function Qs(n){if(!(bi in n))return false;let e=n[bi];return $(e)}r(Qs,"supportsRotation");var xi="opacity";function el(n){if(!(xi in n))return false;let e=n[xi];return $(e)}r(el,"supportsOpacity");var Ci="borderRadius";function tl(n){if(!(Ci in n))return false;let e=n[Ci];return y(e)||C(e)}r(tl,"supportsBorderRadius");var Ii="border";function nl(n){if(!(Ii in n))return false;let e=n[Ii];return C(e)||pe(e.color)}r(nl,"supportsBorder");var Ti="svg";function il(n){if(!(Ti in n))return false;let e=n[Ti];return y(e)}r(il,"supportsSVG");var Pi="textTruncation";function rl(n){if(!(Pi in n))return false;let e=n[Pi];return $(e)||C(e)}r(rl,"supportsTextTruncation");var Si="zIndex";function ol(n){if(!(Si in n))return false;let e=n[Si];return $(e)||C(e)}r(ol,"supportsZIndex");var Fi="overflow";function al(n){if(!(Fi in n))return false;let e=n[Fi];return y(e)||C(e)}r(al,"supportsOverflow");var Di="componentIdentifier";function sl(n){if(!(Di in n))return false;let e=n[Di];return y(e)}r(sl,"supportsComponentInfo");var vi="font";function ll(n){if(!(vi in n))return false;let e=n[vi];return Qn(e)}r(ll,"supportsFont");var Ni="font";function dl(n){if(!(Ni in n))return false;let e=n[Ni];return Jn(e)||C(e)}r(dl,"supportsFontData");var Ei="inlineTextStyle";function ul(n){if(!(Ei in n))return false;let e=n[Ei];return pn(e)||C(e)}r(ul,"supportsInlineTextStyle");var ki="inlineTextStyle";function cl(n){if(!(ki in n))return false;let e=n[ki];return ti(e)||C(e)}r(cl,"supportsInlineTextStyleData");var Mi="link";function pl(n){if(!(Mi in n))return false;let e=n[Mi];return y(e)||C(e)}r(pl,"supportsLink");var Ai="imageRendering";function ml(n){if(!(Ai in n))return false;let e=n[Ai];return y(e)||C(e)}r(ml,"supportsImageRendering");var wi="layout";function Li(n){if(!(wi in n))return false;let e=n[wi];return y(e)||C(e)}r(Li,"supportsLayout");function gl(n){return Li(n)?n.layout==="stack":false}r(gl,"hasStackLayout");function fl(n){return Li(n)?n.layout==="grid":false}r(fl,"hasGridLayout");var Vi="isVariant";function Ri(n){if(!(Vi in n))return false;let e=n[Vi];return xe(e)}r(Ri,"supportsComponentVariant");function mn(n){return Ri(n)?n.isVariant:false}r(mn,"isComponentVariant");function Bi(n){return !Ri(n)||!mn(n)?false:!C(n.gesture)}r(Bi,"isComponentGestureVariant");var Wi="isBreakpoint";function Wo(n){if(!(Wi in n))return false;let e=n[Wi];return xe(e)}r(Wo,"supportsBreakpoint");function Ui(n){return Wo(n)?n.isBreakpoint:false}r(Ui,"isBreakpoint");var W=class{static{r(this,"NodeMethods");}id;originalId;#e;constructor(e,t){this.id=e.id,this.originalId=e.originalId??null,this.#e=t;}get isReplica(){return this.originalId!==null}async remove(){return this.#e.invoke("removeNodes2",[this.id])}async select(){return this.#e.invoke("setSelection",[this.id])}async clone(){if(this[p]==="UnknownNode")throw Error("Can not clone unknown node");return this.#e.cloneNode(this.id)}async setAttributes(e){if(this[p]==="UnknownNode")throw Error("Can not set attributes on unknown node");return this.#e.setAttributes(this.id,e)}async getRect(){return this.#e.invoke("getRect",this.id)}async zoomIntoView(e){return this.#e.invoke("zoomIntoView",[this.id],e)}async navigateTo(e){return this.#e.invoke("navigateTo",this.id,e)}async getParent(){return this.#e.getParent(this.id)}async getChildren(){return ee(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return ee(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>I(i,this.#e))}async getNodesWithAttribute(e){return ee(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>I(i,this.#e))}async getNodesWithAttributeSet(e){return ee(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>I(i,this.#e))}async*walk(){if(yield this,!ee(this))for(let e of await this.getChildren())yield*e.walk();}async getPluginData(e){return this.#e.invoke("getPluginDataForNode",this.id,e)}async setPluginData(e,t){return this.#e.invoke("setPluginDataForNode",this.id,e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeysForNode",this.id)}},U=class extends W{static{r(this,"FrameNode");}[p]="FrameNode";name;visible;locked;backgroundColor;backgroundImage;backgroundGradient;rotation;opacity;borderRadius;border;imageRendering;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;zIndex;link;linkOpenInNewTab;overflow;overflowX;overflowY;layout;gap;padding;stackDirection;stackDistribution;stackAlignment;stackWrapEnabled;gridColumnCount;gridRowCount;gridAlignment;gridColumnWidthType;gridColumnWidth;gridColumnMinWidth;gridRowHeightType;gridRowHeight;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;isVariant;isPrimaryVariant;isBreakpoint;isPrimaryBreakpoint;inheritsFromId;gesture;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.backgroundColor=b(t,e.backgroundColor)??null,this.backgroundImage=b(t,e.backgroundImage)??null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.border=b(t,e.border)??null,this.backgroundGradient=b(t,e.backgroundGradient)??null,this.imageRendering=e.imageRendering??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,this.zIndex=e.zIndex??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.layout=e.layout??null,this.gap=e.gap??null,this.padding=e.padding??null,this.stackDirection=e.stackDirection??null,this.stackDistribution=e.stackDistribution??null,this.stackAlignment=e.stackAlignment??null,this.stackWrapEnabled=e.stackWrapEnabled??null,this.gridColumnCount=e.gridColumnCount??null,this.gridRowCount=e.gridRowCount??null,this.gridAlignment=e.gridAlignment??null,this.gridColumnWidthType=e.gridColumnWidthType??null,this.gridColumnWidth=e.gridColumnWidth??null,this.gridColumnMinWidth=e.gridColumnMinWidth??null,this.gridRowHeightType=e.gridRowHeightType??null,this.gridRowHeight=e.gridRowHeight??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,this.inheritsFromId=e.inheritsFromId??null,this.gesture=e.gesture??null,this.isVariant=e.isVariant??false,this.isPrimaryVariant=e.isPrimaryVariant??false,this.isBreakpoint=e.isBreakpoint??false,this.isPrimaryBreakpoint=e.isPrimaryBreakpoint??false,F(this);}},te=class extends W{static{r(this,"TextNode");}[p]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;gridItemFillCellWidth;gridItemFillCellHeight;gridItemHorizontalAlignment;gridItemVerticalAlignment;gridItemColumnSpan;gridItemRowSpan;overflow;overflowX;overflowY;textTruncation;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.zIndex=e.zIndex??null,this.font=b(t,e.font)??null,this.inlineTextStyle=b(t,e.inlineTextStyle)??null,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.link=e.link??null,this.linkOpenInNewTab=e.linkOpenInNewTab??null,this.overflow=e.overflow??null,this.overflowX=e.overflowX??null,this.overflowY=e.overflowY??null,this.textTruncation=e.textTruncation??null,this.gridItemFillCellWidth=e.gridItemFillCellWidth??null,this.gridItemFillCellHeight=e.gridItemFillCellHeight??null,this.gridItemHorizontalAlignment=e.gridItemHorizontalAlignment??null,this.gridItemVerticalAlignment=e.gridItemVerticalAlignment??null,this.gridItemColumnSpan=e.gridItemColumnSpan??null,this.gridItemRowSpan=e.gridItemRowSpan??null,F(this);}async setText(e){await this.#e.invoke("setTextForNode",this.id,e);}async getText(){return this.#e.invoke("getTextForNode",this.id)}async setHTML(e){await this.#e.invoke(ue,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(de,this.id)}},Ge=class extends W{static{r(this,"SVGNode");}[p]="SVGNode";name;visible;locked;svg;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;constructor(e,t){super(e,t),this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.svg=e.svg,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,F(this);}},Ke=class extends W{static{r(this,"VectorSetItemNode");}[p]="VectorSetItemNode";name;visible;locked;top;right;bottom;left;centerX;centerY;width;height;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.top=e.top??null,this.right=e.right??null,this.bottom=e.bottom??null,this.left=e.left??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,F(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},$e=class extends W{static{r(this,"ComponentInstanceNode");}[p]="ComponentInstanceNode";name;visible;locked;componentIdentifier;insertURL;componentName;controls;rotation;opacity;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;aspectRatio;#e;#t;#n;get typedControls(){return this.#n||(this.#n=b(this.#e,this.#t.typedControls)??{}),this.#n}constructor(e,t){super(e,t),this.#e=t,this.#t=e,this.name=e.name??null,this.visible=e.visible??true,this.locked=e.locked??false,this.componentIdentifier=e.componentIdentifier,this.componentName=e.componentName??null,this.insertURL=e.insertURL??null,this.controls=b(t,e.controls)??{},this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.position=e.position,this.left=e.left??null,this.right=e.right??null,this.top=e.top??null,this.bottom=e.bottom??null,this.centerX=e.centerX??null,this.centerY=e.centerY??null,this.width=e.width??null,this.height=e.height??null,this.maxWidth=e.maxWidth??null,this.minWidth=e.minWidth??null,this.maxHeight=e.maxHeight??null,this.minHeight=e.minHeight??null,this.aspectRatio=e.aspectRatio??null,F(this);}async getRuntimeError(){return this.#e.invoke("getRuntimeErrorForCodeComponentNode",this.id)}},ne=class extends W{static{r(this,"WebPageNode");}[p]="WebPageNode";#e;path;collectionId;constructor(e,t){super(e,t),this.path=e.path??null,this.collectionId=e.collectionId??null,this.#e=t,F(this);}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let i=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=I(i,this.#e);return g(o instanceof U),g(Ui(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new ze(e,this.#e):null}},ie=class extends W{static{r(this,"ComponentNode");}[p]="ComponentNode";name;componentIdentifier;insertURL;componentName;#e;constructor(e,t){super(e,t),this.#e=t,this.componentIdentifier=e.componentIdentifier,this.insertURL=e.insertURL??null,this.componentName=e.componentName??null,this.name=e.name??null,F(this);}async addVariant(e,t){let i=await this.#e.invoke("addVariantToComponent",this.id,e,t);if(!i)throw new Error("Failed to add variant to component");let o=I(i,this.#e);return g(o instanceof U),g(mn(o),"Node is not a component variant"),o}async addGestureVariant(e,t,i){let o=await this.#e.invoke("addGestureVariantToComponent",this.id,e,t,i);if(!o)throw new Error("Failed to add state to component");let s=I(o,this.#e);return g(s instanceof U),g(Bi(s),"Node is not a gesture variant"),s}async getVariables(){let e=await this.#e.invoke("getVariables",this.id);return b(this.#e,e)}async addVariables(e){let t=await this.#e.invoke("addVariables",this.id,B(e));return b(this.#e,t)}async removeVariables(e){await this.#e.invoke("removeVariables",this.id,e);}async setVariableOrder(e){await this.#e.invoke("setVariableOrder",this.id,e);}},He=class extends W{static{r(this,"VectorSetNode");}[p]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,F(this);}},re=class extends W{static{r(this,"DesignPageNode");}[p]="DesignPageNode";name;constructor(e,t){super(e,t),this.name=e.name??null,F(this);}},je=class extends W{static{r(this,"UnknownNode");}[p]="UnknownNode";constructor(e,t){super(e,t),F(this);}};function I(n,e){switch(n[p]){case "DesignPageNode":return new re(n,e);case "WebPageNode":return new ne(n,e);case "ComponentNode":return new ie(n,e);case "VectorSetNode":return new He(n,e);case "VectorSetItemNode":return new Ke(n,e);case "ComponentInstanceNode":return new $e(n,e);case "FrameNode":return new U(n,e);case "SVGNode":return new Ge(n,e);case "TextNode":return new te(n,e);case "UnknownNode":return new je(n,e);default:return new je(n,e)}}r(I,"convertRawNodeDataToNode");function Nt(n){return n instanceof U}r(Nt,"isFrameNode");function Oi(n){return n instanceof te}r(Oi,"isTextNode");function zi(n){return n instanceof Ge}r(zi,"isSVGNode");function ge(n){return n instanceof $e}r(ge,"isComponentInstanceNode");function Gi(n){return n instanceof ne}r(Gi,"isWebPageNode");function Ki(n){return n instanceof ie}r(Ki,"isComponentNode");function $i(n){return n instanceof re}r($i,"isDesignPageNode");function Hi(n){return n instanceof He}r(Hi,"isVectorSetNode");function ji(n){return n instanceof Ke}r(ji,"isVectorSetItemNode");function ee(n){return n instanceof je}r(ee,"isUnknownNode");function _e(n){return !!(Nt(n)||Oi(n)||ge(n)||zi(n)||ji(n)||ee(n))}r(_e,"isCanvasNode");function gn(n){return !!(Gi(n)||$i(n)||Ki(n)||Hi(n)||ee(n))}r(gn,"isCanvasRootNode");var qe=class{static{r(this,"VectorSet");}id;name;owner;#e;constructor(e,t){this.id=e.id,this.name=e.name,this.owner=e.owner,this.#e=t;}async getItems(){return (await this.#e.invoke("getVectorSetItems",this.id)).map(t=>new Et(t,this.#e))}},Et=class{static{r(this,"VectorSetItem");}id;name;insertUrl;iconUrl;#e;#t;constructor(e,t){this.id=e.id,this.name=e.name,this.insertUrl=e.insertUrl,this.iconUrl=e.iconUrl,this.#e=e.moduleId,this.#t=t;}async getVariables(){return this.#t.invoke("getVectorSetItemVariables",this.id,this.#e)}};var Ye=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},q=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Lo(n){return n.type==="separator"}r(Lo,"isSeparatorMenuItem");function kt(n,e){let t=[];for(let i of n){if(Lo(i)){t.push(i);continue}let{onAction:o,...s}=i,a=s;if(i.onAction){let d=Math.random();e.set(d,i.onAction),a.actionId=d;}i.submenu&&(a.submenu=kt(i.submenu,e)),t.push(a);}return t}r(kt,"addMenuItemsToOnActionCallbackMap");var Mt="type",_i={[Mt]:"pluginReadySignal"},Bo="pluginReadyResponse";var Uo={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function qi(n){return v(n)&&y(n[Mt])&&n[Mt]in Uo}r(qi,"isVekterToPluginNonHandshakeMessage");function Yi(n){return v(n)&&n[Mt]===Bo}r(Yi,"isPluginReadyResponse");var fn=Symbol(),yn=Symbol(),hn=Symbol(),bn=Symbol(),xn=Symbol(),Cn=Symbol(),In=Symbol(),w={publish:fn,getDeployments:yn,deploy:hn,getChangedPaths:bn,getChangeContributors:xn,createManagedCollection:Cn,rejectAllPending:In};function Tn(n){return typeof n=="string"&&n in w}r(Tn,"isFramerApiOnlyMethod");var Oo=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],zo=["closeNotification","closePlugin","setCloseWarning","getActiveCollection","getActiveLocale","getActiveManagedCollection","getCanvasRoot","getChildren","getCollection","getCollectionFields","getCollectionFields2","getCollectionItems","getCollectionItems2","getCollections","getColorStyle","getColorStyles","getCurrentUser","getCurrentUser2","getCustomCode","getDefaultLocale","getFont","getFonts","getImage","getImageData","getLocales","getLocalizationGroups","getManagedCollection","getManagedCollectionFields","getManagedCollectionFields2","getManagedCollectionItemIds","getManagedCollections","getNode","getNodesWithAttribute","getNodesWithAttributeSet","getNodesWithType","getParent","getPluginData","getPluginDataForNode","getPluginDataKeys","getPluginDataKeysForNode","getProjectInfo","getProjectInfo2","getPublishInfo","getRect","getSelection","getSVGForNode","getText","getTextForNode","getTextStyle","getTextStyles","hideUI","setBackgroundMessage","notify","onPointerDown","setActiveCollection","setSelection","showUI","getCodeFileVersionContent","typecheckCode","getCodeFileVersions","getCodeFiles","getCodeFile","getRedirects","uploadFile","uploadFiles","uploadImage","uploadImages","zoomIntoView","navigateTo","getRuntimeErrorForModule","getRuntimeErrorForCodeComponentNode","showProgressOnInstances","removeProgressFromInstances","addComponentInstancePlaceholder","updateComponentInstancePlaceholder","removeComponentInstancePlaceholder","setMenu","showContextMenu","getBreakpointSuggestionsForWebPage","getActiveCollectionItemForWebPage","getVariables","getVectorSets","getVectorSetItems","getVectorSetItemVariables","getChangedPaths","getChangeContributors","getDeployments",pt,mt,de,"getAiServiceInfo","sendTrackingEvent",...Oo];new Set(zo);var Pn={addComponentInstance:["addComponentInstance"],addComponentInstancePlaceholder:[],addDetachedComponentLayers:["addDetachedComponentLayers"],addImage:["addImage"],addImages:["addImages"],addSVG:["addSVG"],addText:["addText"],addRedirects:["addRedirects"],getRedirects:[],removeRedirects:["removeRedirects"],setRedirectOrder:["setRedirectOrder"],subscribeToRedirects:[],cloneNode:["cloneNode"],closePlugin:[],createColorStyle:["createColorStyle"],createFrameNode:["createNode"],createTextNode:["createNode"],createComponentNode:["createNode"],createTextStyle:["createTextStyle"],createDesignPage:["createDesignPage"],createWebPage:["createWebPage"],getActiveCollection:[],getActiveLocale:[],getActiveManagedCollection:[],getCanvasRoot:[],getChildren:[],getCollection:[],getCollections:[],getColorStyle:[],getColorStyles:[],getCurrentUser:[],getCustomCode:[],getDefaultLocale:[],getFont:[],getFonts:[],getImage:[],getLocales:[],getLocalizationGroups:[],getManagedCollection:[],getManagedCollections:[],getNode:[],getNodesWithAttribute:[],getNodesWithAttributeSet:[],getNodesWithType:[],getParent:[],getPluginData:[],getPluginDataKeys:[],getProjectInfo:[],getPublishInfo:[],getRect:[],getSelection:[],getText:[],getTextStyle:[],getTextStyles:[],hideUI:[],setBackgroundMessage:[],setCloseWarning:[],lintCode:[],makeDraggable:["onDragEnd","onDragStart","onDrag","setDragData","preloadDetachedComponentLayers","preloadImageUrlForInsertion","preloadDragPreviewImage"],notify:[],preloadDetachedComponentLayers:["preloadDetachedComponentLayers"],preloadDragPreviewImage:["preloadDragPreviewImage"],preloadImageUrlForInsertion:["preloadImageUrlForInsertion"],removeNode:["removeNodes2"],removeNodes:["removeNodes2"],setAttributes:["setAttributes"],setCustomCode:["setCustomCode"],setImage:["setImage"],setLocalizationData:["setLocalizationData"],setMenu:[],showContextMenu:[],setParent:["setParent"],setPluginData:["setPluginData"],setSelection:[],setText:["setText"],typecheckCode:[],showUI:[],subscribeToCanvasRoot:[],subscribeToColorStyles:[],subscribeToCustomCode:[],subscribeToImage:[],subscribeToPublishInfo:[],subscribeToSelection:[],subscribeToText:[],subscribeToTextStyles:[],createCodeFile:["createCodeFile"],unstable_ensureMinimumDependencyVersion:["unstable_ensureMinimumDependencyVersion"],getCodeFiles:[],getCodeFile:[],subscribeToCodeFiles:[],subscribeToOpenCodeFile:[],uploadFile:[],uploadFiles:[],uploadImage:[],uploadImages:[],zoomIntoView:[],navigateTo:[],getVectorSets:[],"VectorSet.getItems":[],"VectorSetItem.getVariables":[],"Node.navigateTo":[],"CodeFile.navigateTo":[],"Collection.navigateTo":[],"ManagedCollection.navigateTo":[],"CollectionItem.navigateTo":[],"ComponentInstanceNode.getRuntimeError":[],"ImageAsset.cloneWithAttributes":[],"ImageAsset.getData":[],"ImageAsset.loadBitmap":[],"ImageAsset.loadImage":[],"ImageAsset.measure":[],"CodeFile.remove":["removeCodeFile"],"CodeFile.rename":["renameCodeFile"],"CodeFile.setFileContent":["setCodeFileContent"],"CodeFile.getVersions":[],"CodeFile.showProgressOnInstances":[],"CodeFile.removeProgressFromInstances":[],"CodeFile.lint":[],"CodeFile.typecheck":[],"CodeFileVersion.getContent":[],"ComponentInstancePlaceholder.setAttributes":[],"ComponentInstancePlaceholder.remove":[],"ComponentInstancePlaceholder.replaceWithComponentInstance":["replaceComponentInstancePlaceholderWithComponentInstance"],"Field.remove":["removeCollectionFields"],"Field.setAttributes":["addCollectionFields2"],"EnumField.addCase":["addEnumCase"],"EnumField.setCaseOrder":["setEnumCaseOrder"],"Collection.addFields":["addCollectionFields2"],"Collection.addItems":["addCollectionItems2"],"Collection.getFields":[],"Collection.getItems":[],"Collection.getPluginData":[],"Collection.getPluginDataKeys":[],"Collection.removeFields":["removeCollectionFields"],"Collection.removeItems":["removeCollectionItems"],"Collection.setAsActive":[],"Collection.setFieldOrder":["setCollectionFieldOrder"],"Collection.setItemOrder":["setCollectionItemOrder"],"Collection.setPluginData":["setPluginDataForNode"],"CollectionItem.getPluginData":[],"CollectionItem.getPluginDataKeys":[],"CollectionItem.remove":["removeCollectionItems"],"CollectionItem.setAttributes":["setCollectionItemAttributes2"],"CollectionItem.setPluginData":["setPluginDataForNode"],"ManagedCollection.addItems":["addManagedCollectionItems2"],"ManagedCollection.getFields":[],"ManagedCollection.getItemIds":[],"ManagedCollection.getPluginData":[],"ManagedCollection.getPluginDataKeys":[],"ManagedCollection.removeItems":["removeManagedCollectionItems"],"ManagedCollection.setAsActive":[],"ManagedCollection.setFields":["setManagedCollectionFields"],"ManagedCollection.setItemOrder":["setManagedCollectionItemOrder"],"ManagedCollection.setPluginData":["setPluginDataForNode"],"Node.clone":["cloneNode"],"Node.getChildren":[],"Node.getNodesWithAttribute":[],"Node.getNodesWithAttributeSet":[],"Node.getNodesWithType":[],"Node.getParent":[],"Node.getPluginData":[],"Node.getPluginDataKeys":[],"Node.getRect":[],"Node.remove":["removeNodes2"],"Node.select":[],"Node.setAttributes":["setAttributes"],"Node.setPluginData":["setPluginDataForNode"],"Node.walk":[],"Node.zoomIntoView":[],"TextNode.getText":[],"TextNode.setText":["setTextForNode"],"TextNode.setHTML":[ue],"TextNode.getHTML":[],"ComponentNode.addVariant":["addVariantToComponent"],"ComponentNode.addGestureVariant":["addGestureVariantToComponent"],"ComponentNode.getVariables":[],"ComponentNode.addVariables":["addVariables"],"ComponentNode.removeVariables":["removeVariables"],"WebPageNode.getBreakpointSuggestions":[],"WebPageNode.addBreakpoint":["addBreakpointToWebPage"],"WebPageNode.getActiveCollectionItem":[],"ColorStyle.getPluginData":[],"ColorStyle.getPluginDataKeys":[],"ColorStyle.remove":["removeColorStyle"],"ColorStyle.setAttributes":["setColorStyleAttributes"],"ColorStyle.setPluginData":["setPluginDataForNode"],"TextStyle.getPluginData":[],"TextStyle.getPluginDataKeys":[],"TextStyle.remove":["removeTextStyle"],"TextStyle.setAttributes":["setTextStyleAttributes"],"TextStyle.setPluginData":["setPluginDataForNode"],"Variable.setAttributes":["updateVariable"],"Variable.remove":["removeVariables"],"ComponentNode.setVariableOrder":["setVariableOrder"],"EnumCase.remove":["removeEnumCase"],"EnumCase.setAttributes":["updateEnumCase"],"EnumVariable.addCase":["addEnumCase"],"EnumVariable.setCaseOrder":["setEnumCaseOrder"],createCollection:["createCollection"],createManagedCollection:["createManagedCollection"],[zt]:[],[Gt]:[],[Kt]:[],[$t]:[],[fn]:["publish"],[yn]:[],[hn]:["deploy"],[bn]:[],[xn]:[],[Cn]:["createManagedCollection"],[In]:[]},At=[];for(let n of Object.keys(Pn))Pn[n].length!==0&&At.push(n);F(At);function Sn(n){let e={};for(let t of At){let i=Pn[t];e[t]=i.every(o=>n[o]);}return e}r(Sn,"createPerMethodPermissionMap");function Xi(){let n={};for(let e of At)n[e]=true;return n}r(Xi,"createPerMethodPermissionMapForTesting");var fe=null;function Zi(n){if(typeof window>"u")return;if(!fe){let t=document.createElement("style");document.head.appendChild(t),fe=t.sheet;}if(!fe){n();return}let e=fe.insertRule("* { transition: none !important; animation: none !important; }");n(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{fe&&fe.deleteRule(e);});});}r(Zi,"withDisabledCssTransitions");var Xe=class{static{r(this,"PluginEngine");}methodInvocationId=0;notificationId=0;postMessage;methodResponseHandlers=new Map;mode;subscriptions=new Map;perMethodPermissionMap;permissionSubscriptions=new Set;messageTypesCheckedInIsAllowedTo=new Set;showUncheckedPermissionToasts=true;environmentInfo=null;initialState;menuItemOnActionCallbackMap=new Map;contextMenuItemOnActionCallbackMap=new Map;rejectAllPending(e){for(let[t,i]of this.methodResponseHandlers)i.reject(e),this.methodResponseHandlers.delete(t);}constructor(e){if(!e){this.postMessage=()=>{},this.mode="canvas",this.perMethodPermissionMap=Xi(),this.initialState={mode:"canvas",intent:"plugin/open"};return}switch(e.transport.onMessage(this.onMessage),typeof window<"u"&&(window.addEventListener("error",t=>{t.error instanceof q&&(t.preventDefault(),t.stopImmediatePropagation());}),window.addEventListener("unhandledrejection",t=>{t.reason instanceof q&&(t.preventDefault(),t.stopImmediatePropagation());})),this.mode=e.mode,this.initialState=e.initialState??{mode:e.mode,intent:"plugin/open"},this.environmentInfo=e.environmentInfo,this.perMethodPermissionMap=Sn(e.permissionMap),this.postMessage=(t,i)=>e.transport.send(t,i),this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":typeof window<"u"&&window.addEventListener("pointerdown",()=>{this.invoke("onPointerDown");}),e.theme&&this.applyPluginTheme(e.theme),this.subscribe("theme",this.applyPluginTheme);break;case "api":break;default:ut(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,undefined,...t)}async invokeTransferable(e,t,...i){return new Promise((s,a)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(B)};this.methodInvocationId+=1,this.methodResponseHandlers.set(d.id,{resolve:s,reject:a}),this.postMessage(d,t);})}subscribe(e,t){this.postMessage({type:"subscribe",topic:e});let i=this.subscriptions.get(e)??new Set;return i.add(t),this.subscriptions.set(e,i),()=>{let o=this.subscriptions.get(e)??new Set;o.delete(t),o.size===0&&this.postMessage({type:"unsubscribe",topic:e}),this.subscriptions.set(e,o);}}onMessage=e=>{let t=e?.data??e;if(qi(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=Sn(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i)throw new Error(`No handler for response with id ${t.id}`);this.methodResponseHandlers.delete(t.id),y(t.error)?i.reject(new Ye(t.error)):i.resolve(t.result);break}case "subscriptionMessage":{let{topic:i,payload:o}=t,s=this.subscriptions.get(i);if(!s)throw new Error("Received a subscription message but no handler present");for(let a of s)a(o);break}case "menuAction":{let i=this.getOnActionFromCallbackMap(t.actionId,t.actionType);if(!i)throw new Error("Menu action received for an unknown menu item");i();break}default:ut(t);}};getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:ut(t);}}applyPluginTheme=e=>{Zi(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});};async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?I(t,this):null}async setAttributes(e,t){let i=await this.invoke("setAttributes",e,t);return i?I(i,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?I(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(i=>{let o=I(i,this);return g(_e(o)),o})}notify=(e,t)=>{let i=`notification-${this.notificationId}`;return this.notificationId+=1,this.invoke("notify",e,{notificationId:i,variant:t?.variant??"info",buttonText:t?.button?.text,durationMs:t?.durationMs}).then(o=>{o==="actionButtonClicked"&&t?.button?.onClick&&t.button.onClick(),t?.onDisappear&&t.onDisappear();}),{close:()=>this.invoke("closeNotification",i)}};async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=kt(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let i=kt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function Go(n){return n.type==="component"}r(Go,"isCodeFileComponentExport");function Ko(n){return n.type==="override"}r(Ko,"isCodeFileOverrideExport");var Fn=class{static{r(this,"CodeFileVersion");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get createdAt(){return this.#e.createdAt}get createdBy(){return this.#e.createdBy}constructor(e,t){this.#t=t,this.#e=e;}async getContent(){return await this.#t.invoke("getCodeFileVersionContent",this.#e.fileId,this.#e.id)}},Y=class n{static{r(this,"CodeFile");}#e;#t;get id(){return this.#e.id}get name(){return this.#e.name}get path(){return this.#e.path}get content(){return this.#e.content}get exports(){return this.#e.exports}get versionId(){return this.#e.versionId}constructor(e,t){this.#t=t,this.#e=e;}async setFileContent(e){let t=await this.#t.invoke("setCodeFileContent",this.id,e);return new n(t,this.#t)}async rename(e){let t=await this.#t.invoke("renameCodeFile",this.id,e);return new n(t,this.#t)}async remove(){return this.#t.invoke("removeCodeFile",this.id)}async getVersions(){return (await this.#t.invoke("getCodeFileVersions",this.id)).map(t=>new Fn(t,this.#t))}async showProgressOnInstances(e){return this.#t.invoke("showProgressOnInstances",this.id,e)}async removeProgressFromInstances(){return this.#t.invoke("removeProgressFromInstances",this.id)}async lint(e){return Promise.resolve([])}async typecheck(e){return await this.#t.invoke("typecheckCode",this.name,this.content,e,this.id)}async navigateTo(){return this.#t.invoke("navigateTo",this.id)}};var wt=class n{static{r(this,"ComponentInstancePlaceholder");}#e;#t;constructor(e,t){this.#e=e,this.#t=t;}get id(){return this.#e.id}get width(){return this.#e.width}get height(){return this.#e.height}get title(){return this.#e.title}get codePreview(){return this.#e.codePreview}async setAttributes(e){let t=await this.#t.invoke("updateComponentInstancePlaceholder",this.id,e);return t?new n(t,this.#t):null}async remove(){await this.#t.invoke("removeComponentInstancePlaceholder",this.id);}async replaceWithComponentInstance(e,t){let i=await this.#t.invoke("replaceComponentInstancePlaceholderWithComponentInstance",this.id,e,t);if(!i)return null;let o=I(i,this.#t);return g(ge(o)),o}};var $o=(()=>{let n=null;return {disableUntilMouseUp:()=>{if(n)return;n=document.createElement("style"),n.textContent="* { pointer-events: none !important; user-select: none !important; -webkit-user-select: none !important; }",document.head.appendChild(n);let e=r(()=>{n&&(document.head.removeChild(n),n=null,o());},"enablePointerEvents"),t=r(s=>{s.buttons>0&&s.buttons&1||e();},"handlePointerChange"),i=r(()=>{e();},"handleBlur");window.addEventListener("pointerup",t,true),window.addEventListener("pointermove",t,true),window.addEventListener("blur",i);function o(){window.removeEventListener("pointerup",t,true),window.removeEventListener("pointermove",t,true),window.removeEventListener("blur",i);}r(o,"cleanup");}}})(),Ji=5,Ho=(()=>{let n=1;return {next:()=>`drag-${n++}`}})();function jo(){}r(jo,"noop");function Qi(n,e,t,i){if(n.mode!=="canvas")return jo;let o=Ho.next(),s=document.body.style.cursor,a={type:"idle"},d=document.body,m=oe.subscribeToIsAllowedTo("makeDraggable",c=>{c||T();}),x=r(c=>{oe.isAllowedTo("makeDraggable")&&a.type!=="idle"&&(a.type==="dragging"&&n.invoke("onDragEnd",{...c,dragSessionId:o}).then(f=>{try{i?.(f);}catch{}}).catch(f=>{if(f instanceof Error){i?.({status:"error",reason:f.message});return}if(typeof f=="string"){i?.({status:"error",reason:f});return}i?.({status:"error"});}),T());},"endDrag"),P=r(c=>{if(!oe.isAllowedTo("makeDraggable")||a.type==="idle")return;if(!(c.buttons>0&&!!(c.buttons&1))){x({cancelled:false});return}let{clientX:M,clientY:E}=c;if(a.type==="pointerDown"){let S=M-a.dragStart.mouse.x,at=E-a.dragStart.mouse.y;if(Math.abs(S)<Ji&&Math.abs(at)<Ji)return;a={type:"dragging",dragStart:a.dragStart},n.invoke("onDragStart",a.dragStart),document.getSelection()?.empty(),$o.disableUntilMouseUp();}d.setPointerCapture(c.pointerId);let le={x:M,y:E};n.invoke("onDrag",{dragSessionId:o,mouse:le}).then(S=>{a.type==="dragging"&&(document.body.style.cursor=S??"");});},"handlePointerChange"),O=r(c=>{c.key==="Escape"&&x({cancelled:true});},"handleKeyDown"),K=r(()=>{x({cancelled:true});},"handleBlur"),h=r(c=>{if(!oe.isAllowedTo("makeDraggable"))return;x({cancelled:true});let f=e.getBoundingClientRect(),M={x:f.x,y:f.y,width:f.width,height:f.height},E,le=e.querySelectorAll("svg");if(le.length===1){let st=le.item(0).getBoundingClientRect();E={x:st.x,y:st.y,width:st.width,height:st.height};}let S={x:c.clientX,y:c.clientY};a={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:M,svgRect:E,mouse:S}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",P,true),d.addEventListener("pointerup",P,true),window.addEventListener("keydown",O,true),window.addEventListener("blur",K);},"handlePointerDown"),u=r(()=>{if(!oe.isAllowedTo("makeDraggable"))return;let c=t();c.type==="detachedComponentLayers"&&n.invoke("preloadDetachedComponentLayers",c.url),c.type==="image"&&n.invoke("preloadImageUrlForInsertion",c.image),c.previewImage&&n.invoke("preloadDragPreviewImage",c.previewImage);},"preload");e.addEventListener("pointerdown",h),e.addEventListener("mouseenter",u);function T(){a={type:"idle"},document.body.style.cursor=s,d.removeEventListener("pointermove",P,true),d.removeEventListener("pointerup",P,true),window.removeEventListener("keydown",O,true),window.removeEventListener("blur",K);}return r(T,"dragCleanup"),()=>{e.removeEventListener("pointerdown",h),e.removeEventListener("mouseenter",u),x({cancelled:true}),m();}}r(Qi,"makeDraggable");var ye=class n{static{r(this,"Redirect");}#e;#t;get id(){return this.#e.id}get from(){return this.#e.from}get to(){return this.#e.to}get expandToAllLocales(){return this.#e.expandToAllLocales}constructor(e,t){this.#t=t,this.#e=e;}remove(){return this.#t.invoke("removeRedirects",[this.id])}async setAttributes(e){let t={...e,id:this.id},[i]=await this.#t.invoke("addRedirects",[t]);return g(lt(i)),C(i)?null:new n(i,this.#t)}};var Dn=class{static{r(this,"FramerPluginAPI");}#e;constructor(e){this.#e=e;}get mode(){return this.#e.mode}isAllowedTo(...e){return e.every(t=>this.#e.perMethodPermissionMap[t])}subscribeToIsAllowedTo(...e){let[t,i]=Hn(e),o=this.isAllowedTo(...t),s=r(()=>{let a=this.isAllowedTo(...t);a!==o&&(o=a,i(o));},"update");return this.#e.permissionSubscriptions.add(s),()=>{this.#e.permissionSubscriptions.delete(s);}}async showUI(e){return this.#e.invoke("showUI",e)}async hideUI(){return this.#e.invoke("hideUI")}async setBackgroundMessage(e){return this.#e.invoke("setBackgroundMessage",e)}closePlugin(e,t){throw this.#e.invoke("closePlugin",e,t),new q}async getCurrentUser(){return this.#e.invoke("getCurrentUser2")}async getProjectInfo(){return this.#e.invoke("getProjectInfo2")}async getSelection(){return (await this.#e.invoke("getSelection")).map(t=>{let i=I(t,this.#e);return g(_e(i)),i})}async setSelection(e){let t=y(e)?[e]:Array.from(e);return this.#e.invoke("setSelection",t)}subscribeToSelection(e){return this.#e.subscribe("selection",t=>{let i=t.map(o=>{let s=I(o,this.#e);return g(_e(s)),s});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=I(e,this.#e);return g(gn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=I(t,this.#e);g(gn(i)),e(i);})}async getPublishInfo(){return this.#e.invoke("getPublishInfo")}subscribeToPublishInfo(e){return this.#e.subscribe("publishInfo",e)}async createFrameNode(e,t){let i=await this.#e.invoke("createNode","FrameNode",t??null,e);if(!i)return null;let o=I(i,this.#e);return g(o instanceof U),o}async removeNodes(e){return this.#e.invoke("removeNodes2",e)}async removeNode(e){return this.removeNodes([e])}async cloneNode(e){return this.#e.cloneNode(e)}async getNode(e){let t=await this.#e.invoke("getNode",e);return t?I(t,this.#e):null}async getParent(e){return this.#e.getParent(e)}async getChildren(e){return this.#e.getChildren(e)}async getRect(e){return this.#e.invoke("getRect",e)}async zoomIntoView(e,t){let i=y(e)?[e]:Array.from(e);return this.#e.invoke("zoomIntoView",i,t)}async setAttributes(e,t){return this.#e.setAttributes(e,t)}async setParent(e,t,i){return this.#e.invoke("setParent",e,t,i)}async getNodesWithType(e){return (await this.#e.invoke("getNodesWithType",null,e)).map(i=>I(i,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(i=>I(i,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(i=>I(i,this.#e))}async getImage(){let e=await this.#e.invoke("getImage");return e?b(this.#e,e):null}subscribeToImage(e){return this.#e.subscribe("image",t=>{if(!t){e(null);return}e(b(this.#e,t));})}async addImage(e){let t=await We(e),i=_(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await We(e),i=_(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await We(e),i=_(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return b(this.#e,o)}async addImages(e){let t=await un(e),i=t.flatMap(_);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await un(e),i=t.flatMap(_),o=await this.#e.invokeTransferable("uploadImages",i,t);return b(this.#e,o)}async uploadFile(e){let t=await dn(e),i=await this.#e.invokeTransferable("uploadFile",_(t),t);return b(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(dn)),i=t.flatMap(_),o=await this.#e.invokeTransferable("uploadFiles",i,t);return b(this.#e,o)}async addSVG(e){return this.#e.invoke("addSVG",e)}async addComponentInstance({url:e,attributes:t,parentId:i}){let o=await this.#e.invoke("addComponentInstance",{url:e,attributes:t,parentId:i}),s=I(o,this.#e);return g(ge(s)),s}async addDetachedComponentLayers({url:e,layout:t,attributes:i}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:i}),s=I(o,this.#e);return g(Nt(s)),s}async preloadDetachedComponentLayers(e){await this.#e.invoke("preloadDetachedComponentLayers",e);}async preloadImageUrlForInsertion(e){await this.#e.invoke("preloadImageUrlForInsertion",e);}async preloadDragPreviewImage(e){await this.#e.invoke("preloadDragPreviewImage",e);}async getText(){return this.#e.invoke("getText")}async setText(e){return this.#e.invoke("setText",e)}async addText(e,t){return this.#e.invoke("addText",e,t)}async setCustomCode(e){return this.#e.invoke("setCustomCode",e)}async getCustomCode(){return this.#e.invoke("getCustomCode")}subscribeToCustomCode(e){return this.#e.subscribe("customCode",e)}subscribeToText(e){return this.#e.subscribe("text",e)}makeDraggable(e,t,i){return Qi(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return g(e,"Collection data must be defined"),new me(e,this.#e)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.#e.invoke("getManagedCollections");return g(e,"Collections data must be defined"),e.map(t=>new me(t,this.#e))}async getCollection(e){let t=await this.#e.invoke("getCollection",e);return t?new Q(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new Q(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new Q(t,this.#e))}notify=(e,t)=>this.#e.notify(e,t);async getPluginData(e){return this.#e.invoke("getPluginData",e)}async setPluginData(e,t){return this.#e.invoke("setPluginData",e,t)}async getPluginDataKeys(){return this.#e.invoke("getPluginDataKeys")}async getColorStyles(){let e=await this.#e.invoke("getColorStyles");return b(this.#e,e)}async getColorStyle(e){let t=await this.#e.invoke("getColorStyle",e);return t?b(this.#e,t):null}async createColorStyle(e){let t=await this.#e.invoke("createColorStyle",e);return b(this.#e,t)}subscribeToColorStyles(e){return this.#e.subscribe("colorStyles",t=>{let i=b(this.#e,t);return e(i)})}async getTextStyles(){let e=await this.#e.invoke("getTextStyles");return b(this.#e,e)}async getTextStyle(e){let t=await this.#e.invoke("getTextStyle",e);return t?b(this.#e,t):null}async createTextStyle(e){let t=await this.#e.invoke("createTextStyle",e);return b(this.#e,t)}subscribeToTextStyles(e){return this.#e.subscribe("textStyles",t=>{let i=b(this.#e,t);return e(i)})}async getFont(e,t){let i=await this.#e.invoke("getFont",e,t);return i?b(this.#e,i):null}async getFonts(){let e=await this.#e.invoke("getFonts");return b(this.#e,e)}getLocales(){return this.#e.invoke("getLocales")}getDefaultLocale(){return this.#e.invoke("getDefaultLocale")}getActiveLocale(){return this.#e.invoke("getActiveLocale")}async getLocalizationGroups(){return this.#e.invoke("getLocalizationGroups")}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new ye(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new ye(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new ye(i,this.#e))}async removeRedirects(e){return this.#e.invoke("removeRedirects",e)}async setRedirectOrder(e){return this.#e.invoke("setRedirectOrder",e)}async createCodeFile(e,t,i){let o=await this.#e.invoke("createCodeFile",e,t,i);return new Y(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new Y(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new Y(t,this.#e):null}lintCode(e,t,i){return Promise.resolve([])}typecheckCode(e,t,i,o){return this.#e.invoke("typecheckCode",e,t,i,o)}subscribeToCodeFiles(e){return this.#e.subscribe("codeFiles",t=>{let i=t?.map(o=>new Y(o,this.#e));return e(i)})}setMenu(e){return this.#e.setMenu(e)}showContextMenu(e,t){return this.#e.showContextMenu(e,t)}async unstable_ensureMinimumDependencyVersion(e,t){return this.#e.invoke("unstable_ensureMinimumDependencyVersion",e,t)}async navigateTo(e,t){return this.#e.invoke("navigateTo",e,t)}subscribeToOpenCodeFile(e){return this.#e.subscribe("openCodeFile",t=>{let i=t?new Y(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=I(t,this.#e);return g(i instanceof re,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=I(t,this.#e);return g(i instanceof ne,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new Q(t,this.#e)}async createManagedCollection(e){let t=await this.#e.invoke("createManagedCollection",e);return new me(t,this.#e)}async setCloseWarning(e){return this.#e.invoke("setCloseWarning",e)}get[l.initialState](){return this.#e.initialState}},vn=class extends Dn{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},Ze=class extends vn{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new wt(t,this.#e)}async[l.getAiServiceInfo](){return this.#e.invoke(pt)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(mt,e,t,i)}async[l.getHTMLForNode](e){return this.#e.invoke(de,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(ue,e,t)}get[l.environmentInfo](){return this.#e.environmentInfo}get[l.showUncheckedPermissionToasts](){return this.#e.showUncheckedPermissionToasts}set[l.showUncheckedPermissionToasts](e){this.#e.showUncheckedPermissionToasts=e;}async createTextNode(e,t){let i=await this.#e.invoke("createNode","TextNode",t??null,e);if(!i)return null;let o=I(i,this.#e);return g(o instanceof te),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let i=I(t,this.#e);return g(i instanceof ie),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new qe(t,this.#e))}async[w.publish](){return this.#e.invoke("publish")}async[w.getDeployments](){return this.#e.invoke("getDeployments")}async[w.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[w.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[w.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[w.createManagedCollection](e){return this.createManagedCollection(e)}[w.rejectAllPending](e){this.#e.rejectAllPending(e);}};var Nn=class{constructor(e){this.origin=e;}static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function _o(){return new Promise(n=>{function e({data:t,origin:i}){if(!Yi(t))return;window.removeEventListener("message",e);let s={transport:new Nn(i),mode:t.mode,permissionMap:t.permissionMap,environmentInfo:t.environmentInfo,origin:i,theme:t.theme??null,initialState:t.initialState};n(s);}r(e,"handshakeListener"),window.addEventListener("message",e),window.parent.postMessage(_i,"*");})}r(_o,"createBrowserContext");async function qo(){return typeof window<"u"?_o():null}r(qo,"bootstrap");var er=await qo(),oe=er?new Ze(new Xe(er)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});function tr(n){return new Ze(new Xe(n))}r(tr,"createFramerInstance");var nr=process$1.env;function Zo(n){Object.assign(nr,n);}r(Zo,"configure");function he(n,e){let t=nr[n];return t&&t.length>0?t:e}r(he,"getEnv");var ir=isWorkerd,rr=globalThis.WebSocket;async function or(n,e){let t=new URL(n.href);t.protocol=t.protocol==="wss:"?"https:":t.protocol==="ws:"?"http:":t.protocol;let o=(await fetch(t.href,{headers:{Upgrade:"websocket",...e}})).webSocket;if(!o)throw new Error("WebSocket upgrade failed - server did not accept");return o.accept(),o}r(or,"connectWebSocketCF");var ar,sr;try{ar=await import('node:fs'),sr=await import('node:path');}catch{}var En=ar,kn=sr;var ae=(m=>(m.PROJECT_CLOSED="PROJECT_CLOSED",m.POOL_EXHAUSTED="POOL_EXHAUSTED",m.TIMEOUT="TIMEOUT",m.INTERNAL="INTERNAL",m.NODE_NOT_FOUND="NODE_NOT_FOUND",m.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",m.INVALID_REQUEST="INVALID_REQUEST",m.UNAUTHORIZED="UNAUTHORIZED",m))(ae||{}),D=class extends Error{static{r(this,"FramerAPIError");}code;constructor(e,t){super(e),this.name="FramerAPIError",this.code=t,this.stack=undefined;}};function Jo(n){return n instanceof D?n.code==="POOL_EXHAUSTED":false}r(Jo,"isRetryableError");var Qo=new Map(Object.values(ae).map(n=>[n,n]));function lr(n){return typeof n=="string"?Qo.get(n)??"INTERNAL":"INTERNAL"}r(lr,"parseErrorCode");function ea(n,e,t){return n.throwIfAborted(),new Promise((i,o)=>{let s=r(()=>o(t()),"handleAbort");n.addEventListener("abort",s,{once:true}),e.then(a=>{n.removeEventListener("abort",s),i(a);},a=>{n.removeEventListener("abort",s),o(a);});})}r(ea,"raceWithAbortSignal");function Mn(n,e,t){return ea(n,new Promise(e),t)}r(Mn,"withAbortSignal");var dr={showUI:false,hideUI:false,closePlugin:false,setCloseWarning:true,notify:false,setMenu:false,showContextMenu:false,preloadDetachedComponentLayers:false,preloadDragPreviewImage:false,preloadImageUrlForInsertion:false,setBackgroundMessage:false,getSelection:false,getActiveCollection:false,getActiveManagedCollection:false,getActiveLocale:false,zoomIntoView:false,navigateTo:false,getPluginData:false,setPluginData:false,getPluginDataKeys:false,makeDraggable:false,subscribeToSelection:false,subscribeToImage:false,subscribeToText:false,subscribeToCustomCode:false,subscribeToColorStyles:false,subscribeToTextStyles:false,subscribeToRedirects:false,subscribeToCodeFiles:false,subscribeToOpenCodeFile:false,subscribeToIsAllowedTo:false,subscribeToCanvasRoot:false,subscribeToPublishInfo:false,unstable_ensureMinimumDependencyVersion:false,removeNode:true,removeNodes:true,addSVG:true,getRect:true,setText:true,getText:true,addText:true,setCustomCode:true,getCustomCode:true,getLocales:true,getDefaultLocale:true,getLocalizationGroups:true,setLocalizationData:true,getCurrentUser:true,getProjectInfo:true,setSelection:true,getCanvasRoot:true,getPublishInfo:true,cloneNode:true,getNode:true,getParent:true,getChildren:true,setAttributes:true,getNodesWithType:true,getNodesWithAttribute:true,getNodesWithAttributeSet:true,addImages:true,getImage:true,addImage:true,setImage:true,uploadImage:true,uploadImages:true,uploadFile:true,uploadFiles:true,setParent:true,addComponentInstance:true,addDetachedComponentLayers:true,getManagedCollection:true,getManagedCollections:true,getCollection:true,getCollections:true,getColorStyle:true,getColorStyles:true,createColorStyle:true,getTextStyle:true,getTextStyles:true,createTextStyle:true,getFont:true,getFonts:true,createCodeFile:true,getCodeFiles:true,getCodeFile:true,lintCode:true,typecheckCode:true,addRedirects:true,getRedirects:true,setRedirectOrder:true,removeRedirects:true,addComponentInstancePlaceholder:true,createCollection:true,getVectorSets:true,createDesignPage:true,createWebPage:true,createTextNode:true,createComponentNode:true,mode:true,isAllowedTo:false,createFrameNode:true,createManagedCollection:true};function An(n){return n in dr?dr[n]===true:false}r(An,"isAllowedMethod");var Vt=class n{static{r(this,"FramerAPI");}requestId;#e;#t;#n;#i=new AbortController;#r=new Map;#o=new Map;#l=0;constructor(e,t,i,o){this.#t=e,this.#n=t,this.#e=i,this.requestId=o,this.#u();}#a(){return `req-${++this.#l}-${Date.now()}`}#d=e=>{switch(e.type){case "screenshotResult":{let t=this.#r.get(e.id);if(t){this.#r.delete(e.id);let i=Buffer.from(e.data,"base64");t.resolve({data:i,mimeType:e.mimeType});}return true}case "screenshotError":{let t=this.#r.get(e.id);if(t){this.#r.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i));}return true}case "exportSVGResult":{let t=this.#o.get(e.id);return t&&(this.#o.delete(e.id),t.resolve(e.data)),true}case "exportSVGError":{let t=this.#o.get(e.id);if(t){this.#o.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i));}return true}default:return false}};static create(e,t,i,o){let s=new n(e,t,i,o);return new Proxy(s,{get(a,d){if(d in a)return Reflect.get(a,d);if(Tn(d)){let x=w[d],P=Reflect.get(a.#t,x);return typeof P=="function"?P.bind(a.#t):P}if(!An(d))return;let m=Reflect.get(a.#t,d);return typeof m=="function"?m.bind(a.#t):m},has(a,d){return d in a||Tn(d)?true:An(d)?d in a.#t:false}})}#u(){this.#n.onMessage(e=>{this.#d(e);},this.#i.signal);}disconnect=async()=>{this.#i.abort(),await this.#e();};#s=()=>(this.#r.clear(),this.#o.clear(),new D("Connection closed","PROJECT_CLOSED"));screenshot=(e,t)=>{let i=this.#a(),{format:o,quality:s,scale:a,clip:d}=t??{};return Mn(this.#i.signal,(m,x)=>{this.#r.set(i,{resolve:m,reject:x}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:s,scale:a,clip:d});},this.#s)};exportSVG=e=>{let t=this.#a();return Mn(this.#i.signal,(i,o)=>{this.#o.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});},this.#s)};[Symbol.dispose]=()=>{this.#i.abort(),this.#e();};[Symbol.asyncDispose]=()=>(this.#i.abort(),this.#e())};var ta=/^.+--([A-Za-z0-9]+)/u,ur=/^[A-Za-z0-9]{20}$/u;function cr(n){if(ur.test(n))return n;try{let t=new URL(n,"https://framer.com").pathname.split("/").filter(Boolean),i=t.findIndex(o=>o.toLowerCase()==="projects");if(i>=0){let o=t[i+1];if(o!==void 0){let s=decodeURIComponent(o),d=s.match(ta)?.[1]??s;if(ur.test(d))return d}}return null}catch{return null}}r(cr,"parseProjectId");var wn={silent:0,error:1,warn:2,info:3,debug:4};function na(){let n=he("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in wn?n:"warn"}r(na,"getLogLevel");var Vn=na();function Je(n){return wn[n]<=wn[Vn]}r(Je,"shouldLog");var Qe=globalThis.console,ia="\x1B[90m",ra="\x1B[0m";function oa(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(oa,"formatPrefix");function aa(n,...e){return [ia+n,...e,ra]}r(aa,"formatDebug");function pr(n){let e=oa(n);return {warn:(...t)=>{Je("warn")&&Qe.warn(e,...t);},error:(...t)=>{Je("error")&&Qe.error(e,...t);},log:(...t)=>{Je("info")&&Qe.log(e,...t);},info:(...t)=>{Je("info")&&Qe.info(e,...t);},debug:(...t)=>{Je("debug")&&Qe.debug(...aa(e,...t));},setLevel:t=>{Vn=t;},getLevel:()=>Vn,withRequestId:t=>pr(t)}}r(pr,"createLogger");var N=pr();N.warn;N.error;N.log;N.info;N.debug;N.setLevel;N.getLevel;function X(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
9
|
+
`);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
|
|
10
|
+
`)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
|
|
11
|
+
`));}catch{}throw t}r(X,"assert");var mr;function gr({error:n,tags:e,extras:t,critical:i,caller:o}){X(mr,"Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment");let s=Ln(n,o);return mr({error:s,tags:{...s.tags,...e},extras:{...s.extras,...t},critical:!!i}),s}r(gr,"reportError");function Ln(n,e=Ln){return n instanceof Error?n:new Wn(n,e)}r(Ln,"reportableError");var Wn=class extends Error{static{r(this,"UnhandledError");}constructor(e,t){let i=e?JSON.stringify(e):"No error message provided";if(super(i),this.message=i,t&&Error.captureStackTrace)Error.captureStackTrace(this,t);else try{throw new Error}catch(o){this.stack=o.stack;}}};var et=typeof window<"u"?window.location.hostname:undefined,fr=!!(et&&["web.framerlocal.com","localhost","127.0.0.1","[::1]"].includes(et)),Rn=(()=>{if(!et)return;if(fr)return {main:et,previewLink:undefined};let n=/^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u,e=et.match(n);if(!(!e||!e[3]))return {previewLink:e[2]&&e[0],main:e[3]}})();({hosts:Rn,isDevelopment:Rn?.main==="development.framer.com",isProduction:Rn?.main==="framer.com",isLocal:fr});var Wt;function Lt(){return typeof window>"u"?{}:Wt||(Wt=da(),Wt)}r(Lt,"getServiceMap");function da(){let n=window.location,e=window?.bootstrap?.services;if(e)return e;let t;try{if(t=window.top.location.origin,e=window.top?.bootstrap?.services,e)return e}catch{}if(t&&t!==n.origin)throw Error(`Unexpectedly embedded by ${t} (expected ${n.origin})`);if(n.origin.endsWith("framer.com")||n.origin.endsWith("framer.dev"))throw Error("ServiceMap data was not provided in document");try{let i=new URLSearchParams(n.search).get("services")||new URLSearchParams(n.hash.substring(1)).get("services");i&&(e=JSON.parse(i));}catch{}if(e&&typeof e=="object"&&e.api)return e;throw Error("ServiceMap requested but not available")}r(da,"extractServiceMap");function tt(n,e=0,t=new Set){if(n===null)return n;if(typeof n=="function")return `[Function: ${n.name??"unknown"}]`;if(typeof n!="object")return n;if(n instanceof Error)return `[${n.toString()}]`;if(t.has(n))return "[Circular]";if(e>2)return "...";t.add(n);try{if("toJSON"in n&&typeof n.toJSON=="function")return tt(n.toJSON(),e+1,t);if(Array.isArray(n))return n.map(i=>tt(i,e+1,t));if(Object.getPrototypeOf(n)!==Object.prototype)return `[Object: ${"__class"in n&&n.__class||n.constructor?.name}]`;{let i={};for(let[o,s]of Object.entries(n))i[o]=tt(s,e+1,t);return i}}catch(i){return `[Throws: ${i instanceof Error?i.message:i}]`}finally{t.delete(n);}}r(tt,"jsonSafeCopy");var ua=["trace","debug","info","warn","error"],ca=[":trace",":debug",":info",":warn",":error"];function br(n,e){let t=[];for(let i of n.split(/[ ,]/u)){let o=i.trim();if(o.length===0)continue;let s=1,a=false;o.startsWith("-")&&(o=o.slice(1),s=3,a=true);for(let x=0;x<=4;x++){let P=ca[x];if(P&&o.endsWith(P)){s=x,a&&(s+=1),o=o.slice(0,o.length-P.length),o.length===0&&(o="*");break}}let d=new RegExp("^"+ha(o).replace(/\\\*/gu,".*")+"$"),m=0;for(let x of e)x.id.match(d)&&(x.level=s,++m);m===0&&t.push(i);}return t}r(br,"applyLogLevelSpec");var nt=class n{constructor(e,t,i){this.logger=e;this.level=t;this.parts=i;this.id=n.nextId++,this.time=Date.now();}static{r(this,"LogEntry");}static nextId=0;id;time;stringPrefix;toMessage(){if(this.stringPrefix)return this.parts;let e=[new Date(this.time).toISOString().substr(-14,14),ua[this.level]+": ["+this.logger.id+"]"],t=0;for(;t<this.parts.length;t++){let i=this.parts[t];if(typeof i=="string"){e.push(i);continue}break}return this.stringPrefix=e.join(" "),this.parts.splice(0,t,this.stringPrefix),this.parts}toString(){return this.toMessage().map(e=>{let t=typeof e;if(t==="string")return e;if(t==="function")return `[Function: ${e.name??"unknown"}]`;if(e instanceof Error)return e.stack??e.toString();let i=JSON.stringify(tt(e));return i?.length>253?i.slice(0,250)+"...":i}).join(" ")}},G="*:app:info,app:info",xr=typeof process<"u"&&!!process.kill,pa=xr&&!!process.env.CI;pa?G="-:warn":xr&&(G="");try{typeof window<"u"&&window.localStorage&&(G=window.localStorage.logLevel||G);}catch{}try{typeof process<"u"&&(G=process.env.DEBUG||G);}catch{}try{typeof window<"u"&&Object.assign(window,{setLogLevel:Tr});}catch{}try{typeof window<"u"&&window.postMessage&&window.top===window&&window.addEventListener("message",n=>{if(!n.data||typeof n.data!="object")return;let{loggerId:e,level:t,parts:i,printed:o}=n.data;if(typeof e!="string"||!Array.isArray(i)||i.length<1||typeof t!="number")return;let s=it(e);if(t<0||t>5)return;i[0]=i[0].replace("[","*[");let a=new nt(s,t,i);a.stringPrefix=i[0],Z.push(a),!o&&(s.level>t||console?.log(...a.toMessage()));});}catch{}var Un;try{typeof window<"u"&&window.postMessage&&window.parent!==window&&!window.location.pathname.startsWith("/edit")&&(Un=r(n=>{try{let e=n.toMessage().map(a=>tt(a)),t=n.logger,i=n.level,o=t.level<=n.level,s={loggerId:t.id,level:i,parts:e,printed:o};window.parent?.postMessage(s,Lt().app);}catch{}},"postLogEntry"));}catch{}var Bn={},Z=[],Cr=1e3;function se(n,e,t){let i=new nt(n,e,t);for(Z.push(i),Un?.(i);Z.length>Cr;)Z.shift();return i}r(se,"createLogEntry");function Ir(n){return typeof n=="number"&&(Cr=n),Z}r(Ir,"getLogReplayBuffer");var ma=/\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u,hr;function ga(){if(!(typeof window>"u"||!window.location))return hr??=ma.exec(window.location.pathname)?.groups?.filename,hr}r(ga,"getFilenameFromWindowPathname");function it(n){let e=ga();n=(e?e+":":"")+n;let t=Bn[n];if(t)return t;let i=new Rt(n);return Bn[n]=i,br(G,[i]),Un?.(new nt(i,-1,[])),i}r(it,"getLogger");function Tr(n,e=true){try{typeof window<"u"&&window.localStorage&&(window.localStorage.logLevel=n);}catch{}let t=G;G=n;let i=Object.values(Bn);for(let s of i)s.level=3;let o=br(n,i);if(o.length>0&&console?.warn("Some log level specs matched no loggers:",o),e&&Z.length>0){console?.log("--- LOG REPLAY ---");for(let s of Z)s.logger.level>s.level||(s.level>=3?console?.warn(...s.toMessage()):console?.log(...s.toMessage()));console?.log("--- END OF LOG REPLAY ---");}return t}r(Tr,"setLogLevel");var fa=r(n=>{let e={...n,logs:Ir().slice(-50).map(t=>t.toString().slice(0,600)).join(`
|
|
12
|
+
`)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),Rt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return it(t)}getBufferedMessages(){return Z.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=(...e)=>{if(this.level>0)return;let t=se(this,0,e);console?.log(...t.toMessage());};debug=(...e)=>{let t=se(this,1,e);this.level>1||console?.log(...t.toMessage());};info=(...e)=>{let t=se(this,2,e);this.level>2||console?.info(...t.toMessage());};warn=(...e)=>{let t=se(this,3,e);this.level>3||console?.warn(...t.toMessage());};warnOncePerMinute=(e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=se(this,3,t);this.level>3||console?.warn(...o.toMessage());};error=(...e)=>{let t=se(this,4,e);this.level>4||console?.error(...t.toMessage());};errorOncePerMinute=(e,...t)=>{let i=this.didLog[e];if(i&&i>Date.now())return;this.didLog[e]=Date.now()+1e3*60,t.unshift(e);let o=se(this,4,t);this.level>4||console?.error(...o.toMessage());};reportWithoutLogging=(e,t,i,o)=>{let s=fa(t??{}),a=gr({caller:this.reportWithoutLogging,error:e,tags:{...i,handler:"logger",where:this.id},extras:t,critical:o??this.errorIsCritical});return [s,a]};reportError=(e,t,i,o)=>{let[s,a]=this.reportWithoutLogging(e,t,i,o);s?this.error(a,s):this.error(a);};reportErrorOncePerMinute=(e,t)=>{if(!ya(e))return;let i=this.didLog[e.message];i&&i>Date.now()||(this.didLog[e.message]=Date.now()+1e3*60,this.reportError(e,t));};reportCriticalError=(e,t,i)=>this.reportError(e,t,i,true)};function ya(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(ya,"isErrorWithMessage");function ha(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(ha,"escapeRegExp");var Fr;(K=>{function n(h,...u){return h.concat(u)}K.push=n,r(n,"push");function e(h){return h.slice(0,-1)}K.pop=e,r(e,"pop");function t(h,...u){return u.concat(h)}K.unshift=t,r(t,"unshift");function i(h,u,...T){let c=h.length;if(u<0||u>c)throw Error("index out of range: "+u);let f=h.slice();return f.splice(u,0,...T),f}K.insert=i,r(i,"insert");function o(h,u,T){let c=h.length;if(u<0||u>=c)throw Error("index out of range: "+u);let f=Array.isArray(T)?T:[T],M=h.slice();return M.splice(u,1,...f),M}K.replace=o,r(o,"replace");function s(h,u){let T=h.length;if(u<0||u>=T)throw Error("index out of range: "+u);let c=h.slice();return c.splice(u,1),c}K.remove=s,r(s,"remove");function a(h,u,T){let c=h.length;if(u<0||u>=c)throw Error("from index out of range: "+u);if(T<0||T>=c)throw Error("to index out of range: "+T);let f=h.slice();if(T===u)return f;let M=f[u];return u<T?(f.splice(T+1,0,M),f.splice(u,1)):(f.splice(u,1),f.splice(T,0,M)),f}K.move=a,r(a,"move");function d(h,u){let T=[],c=Math.min(h.length,u.length);for(let f=0;f<c;f++)T.push([h[f],u[f]]);return T}K.zip=d,r(d,"zip");function m(h,u,T){let c=h.slice(),f=c[u];return f===undefined||(c[u]=T(f)),c}K.update=m,r(m,"update");function x(h){return Array.from(new Set(h))}K.unique=x,r(x,"unique");function P(h,...u){return Array.from(new Set([...h,...u.flat()]))}K.union=P,r(P,"union");function O(h,u){return h.filter(u)}K.filter=O,r(O,"filter");})(Fr||={});var Sa=Object.prototype.hasOwnProperty;function Fa(n,e){return Sa.call(n,e)}r(Fa,"hasOwnProperty");var Dr;(i=>{function n(o,s){for(let a of Object.keys(o))Fa(s,a)||delete o[a];for(let a of Object.keys(s))o[a]===undefined&&(o[a]=s[a]);return Object.setPrototypeOf(o,Object.getPrototypeOf(s)),o}i.morphUsingTemplate=n,r(n,"morphUsingTemplate");function e(o,s){s&&Object.assign(o,s);}i.writeOnce=e,r(e,"writeOnce");function t(o,s){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,s)}i.update=t,r(t,"update");})(Dr||={});var vr;(o=>{function n(s,...a){return new Set([...s,...a])}o.add=n,r(n,"add");function e(s,...a){let d=new Set(s);for(let m of a)d.delete(m);return d}o.remove=e,r(e,"remove");function t(...s){let a=new Set;for(let d of s)for(let m of d)a.add(m);return a}o.union=t,r(t,"union");function i(s,a){return s.has(a)?o.remove(s,a):o.add(s,a)}o.toggle=i,r(i,"toggle");})(vr||={});var Nr;(i=>{function n(o,...s){let a=new Map;o.forEach((m,x)=>a.set(x,m));let d=false;for(let m of s)m&&(m.forEach((x,P)=>a.set(P,x)),d=true);return d?a:o}i.merge=n,r(n,"merge");function e(o,s,a){let d=new Map(o);return d.set(s,a),d}i.set=e,r(e,"set");function t(o,s){let a=new Map(o);return a.delete(s),a}i.remove=t,r(t,"remove");})(Nr||={});(class extends Promise{static{r(this,"ResolvablePromise");}_state="initial";resolve;reject;get state(){return this._state}pending(){return this._state="pending",this}isResolved(){return this._state==="fulfilled"||this._state==="rejected"}constructor(){let e,t;super((i,o)=>{e=i,t=o;}),this.resolve=i=>{this._state="fulfilled",e(i);},this.reject=i=>{this._state="rejected",t(i);};}});it("task-queue");function zn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(zn,"isObject");var be=class{constructor(e){this.ws=e;this.ws.addEventListener("close",()=>{this.closed=true,this.onError?.(new D("Connection closed","PROJECT_CLOSED"));});}static{r(this,"WebSocketTransport");}onError;closed=false;setOnError(e){this.onError=e;}send(e){if(this.closed)throw new D("Connection closed","PROJECT_CLOSED");this.ws.send(rt.stringify(e));}waitForDisconnectAck(e){return new Promise(t=>{let i=setTimeout(()=>{this.ws.removeEventListener("message",o),t();},e),o=r(s=>{if(!(typeof s.data!="string"&&!(s.data instanceof String)))try{let a=rt.parse(s.data);zn(a)&&a.type==="disconnect-ack"&&(clearTimeout(i),this.ws.removeEventListener("message",o),t());}catch{}},"handler");this.ws.addEventListener("message",o);})}onMessage(e,t){let i=r(o=>{let s=typeof o.data=="string"?o.data:o.data.toString(),a=rt.parse(s);if(zn(a)&&a.type==="error"){let d=a.message||JSON.stringify(a),m=a.code??"INTERNAL";N.error(`Server error: ${d}`),this.onError?.(new D(`Server error: ${d}`,m));return}if(zn(a)&&a.type==="debug-archive"){Gn(a.data);return}e(a);},"listener");this.ws.addEventListener("message",i),t?.addEventListener("abort",()=>this.ws.removeEventListener("message",i));}};function Gn(n){X(En,"File system module is not available."),X(kn,"Path module is not available.");let t=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,i=process.cwd(),o=kn.resolve(i,t);En.writeFileSync(o,Buffer.from(n)),N.info(`Debug archive saved to ${o}`);}r(Gn,"handleDebugArchive");function Ut(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Ut,"isObject");var Ea={type:"pluginReadySignal"};function ka(n){return Ut(n)&&n.type==="pluginReadyResponse"}r(ka,"isPluginReadyResponse");var Er=45e3,Ma=2e4;async function Aa(n,e){let t={Authorization:`Token ${e}`};if(ir)return N.debug("Using Cloudflare Workers WebSocket connection"),or(n,t);let i=n.hostname==="api.framerlocal.com",o=process.env.NODE_TLS_REJECT_UNAUTHORIZED;i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0"),N.debug("Using standard WebSocket connection");let s=new rr(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),s}r(Aa,"createWebSocket");async function kr(n,e,t){let i=new URL(t??he("FRAMER_HEADLESS_SERVER_URL","wss://api.framer.com/channel/headless-plugin"));i.protocol=i.protocol==="https:"?"wss:":i.protocol==="http:"?"ws:":i.protocol,i.searchParams.set("projectId",n),N.debug(`Connecting to ${i.href}`);let o=await Aa(i,e);N.debug(`WebSocket created, readyState: ${o.readyState}`);let s,a=N,d=false,m=setInterval(()=>{o.readyState===o.OPEN&&(o.send(rt.stringify({type:"ping"})),a.debug("Sent ping"));},Ma),x=r(()=>{clearInterval(m),o.readyState!==o.CLOSED&&o.readyState!==o.CLOSING&&o.close(1e3,"Client disconnect");},"forceClose"),P=r(async()=>{if(clearInterval(m),!(o.readyState===o.CLOSED||o.readyState===o.CLOSING)){if(d){a.debug("Initiating graceful disconnect");let K=new be(o);K.send({type:"client-disconnect"}),await K.waitForDisconnectAck(15e3);}o.readyState!==o.CLOSED&&o.readyState!==o.CLOSING&&o.close(1e3,"Client disconnect");}},"cleanup"),O=await new Promise((K,h)=>{let u=setTimeout(()=>{x(),h(new D(`Connection timeout after ${Er}ms`,"TIMEOUT"));},Er),T=r(()=>{a.debug("WebSocket opened, waiting for ready");},"onOpen"),c=r(E=>{a.debug("WebSocket error:",E),clearTimeout(u),x(),h(new D("No connection to the server","INTERNAL"));},"onError"),f=r(E=>{a.debug(`WebSocket closed: code=${E.code}, reason=${E.reason||"(no reason)"}, wasClean=${E.wasClean}`),clearTimeout(u),clearInterval(m),h(new D(`Connection to the server was closed (code: ${E.code})`,"PROJECT_CLOSED"));},"onClose");function M(E){a.debug("Received message");let le=typeof E.data=="string"?E.data:E.data.toString(),S=rt.parse(le);if(a.debug(`Message type: ${S.type}`),S.type==="error"){clearTimeout(u),o.removeEventListener("close",f),o.removeEventListener("error",c);let at=lr(S.code);h(new D(S.message||"Server error",at)),x();}else S.type==="ready"?(Ut(S)&&"requestId"in S&&(s=String(S.requestId),a=N.withRequestId(s),a.debug(`Server request ID: ${s}`)),Ut(S)&&"version"in S&&a.debug(`Server version: ${S.version}`),Ut(S)&&S.gracefulDisconnect===true&&(d=true),a.debug("Sending pluginReadySignal"),o.send(rt.stringify(Ea))):S.type==="debug-archive"?Gn(S.data):ka(S)&&(clearTimeout(u),o.removeEventListener("message",M),o.removeEventListener("error",c),o.removeEventListener("close",f),K(S));}r(M,"handshakeMessageHandler"),o.addEventListener("open",T),o.addEventListener("message",M),o.addEventListener("error",c),o.addEventListener("close",f);});return o.addEventListener("close",()=>{P();}),{ws:o,pluginReadyData:O,requestId:s,logger:a,gracefulDisconnect:d,cleanup:P}}r(kr,"connectAndHandshake");async function Mr(n,e,t){let i=performance.now();if(!n)throw new D("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=cr(n);if(!o)throw new D(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let s=e??he("FRAMER_API_KEY");if(!s)throw new D("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let a=await kr(o,s,t?.serverUrl);try{let d=new be(a.ws),m={transport:d,mode:a.pluginReadyData.mode,permissionMap:a.pluginReadyData.permissionMap,environmentInfo:a.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:a.pluginReadyData.initialState},x=tr(m);d.setOnError(O=>{x[w.rejectAllPending](O);});let P=r(async()=>{let O=((performance.now()-i)/1e3).toFixed(2);a.logger.debug(`Connection ended after ${O}s`),await a.cleanup();},"cleanup");return Vt.create(x,d,P,a.requestId)}catch(d){throw await a.cleanup(),d}}r(Mr,"connect");async function wa(n,e,t,i){let o=await Mr(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(wa,"withConnection");
|
|
14
13
|
|
|
15
|
-
export {
|
|
14
|
+
export { gt as BooleanField, Ce as BooleanVariable, ke as BorderVariable, St as CollectionReferenceField, ft as ColorField, Fe as ColorVariable, $e as ComponentInstanceNode, ie as ComponentNode, Ue as ConicGradient, Ct as DateField, Ee as DateVariable, re as DesignPageNode, H as EnumCase, Pt as EnumField, Se as EnumVariable, ae as ErrorCode, It as FieldDivider, Tt as FileField, ve as FileVariable, bt as FormattedTextField, Pe as FormattedTextVariable, U as FrameNode, D as FramerAPIError, q as FramerPluginClosedError, Ye as FramerPluginError, Ae as ImageField, De as ImageVariable, Re as LinearGradient, xt as LinkField, Ne as LinkVariable, Ft as MultiCollectionReferenceField, yt as NumberField, Ie as NumberVariable, Be as RadialGradient, Ge as SVGNode, ht as StringField, Te as StringVariable, te as TextNode, Le as UnsupportedComputedValue, we as UnsupportedField, Me as UnsupportedVariable, qe as VectorSet, Et as VectorSetItem, Ke as VectorSetItemNode, He as VectorSetNode, ne as WebPageNode, Zo as configure, Mr as connect, oe as framer, fl as hasGridLayout, gl as hasStackLayout, Ui as isBreakpoint, Go as isCodeFileComponentExport, Ko as isCodeFileOverrideExport, pe as isColorStyle, Bi as isComponentGestureVariant, ge as isComponentInstanceNode, Ki as isComponentNode, uo as isComponentVariable, mn as isComponentVariant, xo as isComputedValue, $i as isDesignPageNode, co as isField, mo as isFileAsset, Nt as isFrameNode, fo as isImageAsset, Jo as isRetryableError, zi as isSVGNode, Oi as isTextNode, pn as isTextStyle, jn as isVariable, ji as isVectorSetItemNode, Hi as isVectorSetNode, Gi as isWebPageNode, Ks as supportsAspectRatio, _s as supportsBackgroundColor, qs as supportsBackgroundColorData, Zs as supportsBackgroundGradient, Js as supportsBackgroundGradientData, Ys as supportsBackgroundImage, Xs as supportsBackgroundImageData, nl as supportsBorder, tl as supportsBorderRadius, Wo as supportsBreakpoint, sl as supportsComponentInfo, Ri as supportsComponentVariant, ll as supportsFont, dl as supportsFontData, ml as supportsImageRendering, ul as supportsInlineTextStyle, cl as supportsInlineTextStyleData, Li as supportsLayout, pl as supportsLink, js as supportsLocked, $s as supportsName, el as supportsOpacity, al as supportsOverflow, Os as supportsPins, Us as supportsPosition, Qs as supportsRotation, il as supportsSVG, zs as supportsSize, Gs as supportsSizeConstraints, rl as supportsTextTruncation, Hs as supportsVisible, ol as supportsZIndex, wa as withConnection };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-api",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -29,32 +29,31 @@
|
|
|
29
29
|
"prepublishOnly": "echo 'Please use make for publishing' && exit 1"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"devalue": "^5.
|
|
33
|
-
"
|
|
34
|
-
"ws": "^8.18.0"
|
|
32
|
+
"devalue": "^5.6.2",
|
|
33
|
+
"std-env": "^3.10.0"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
36
|
"@biomejs/biome": "1.9.4",
|
|
38
37
|
"@framerjs/framer-api-devkit": "0.0.0",
|
|
39
38
|
"@framerjs/shared": "1.0.0",
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
39
|
+
"@swc/core": "1.15.3",
|
|
40
|
+
"@swc/jest": "^0.2.37",
|
|
41
|
+
"@types/node": "24.10.9",
|
|
42
42
|
"@typescript-eslint/eslint-plugin": "^8.40.0",
|
|
43
43
|
"@typescript-eslint/parser": "^8.40.0",
|
|
44
44
|
"eslint": "^8.57.1",
|
|
45
45
|
"eslint-plugin-framer-studio": "1.0.0",
|
|
46
|
-
"framer-plugin": "3.
|
|
46
|
+
"framer-plugin": "3.10.3",
|
|
47
47
|
"jest": "29.4.1",
|
|
48
48
|
"tsup": "^8.0.2",
|
|
49
49
|
"tsx": "^4.19.2",
|
|
50
50
|
"typescript": "^5.9.2",
|
|
51
51
|
"vekter": "0.0.1"
|
|
52
52
|
},
|
|
53
|
-
"peerDependencies": {
|
|
54
|
-
"react": "^18.2.0",
|
|
55
|
-
"typescript": "^5.9.3"
|
|
56
|
-
},
|
|
57
53
|
"imports": {
|
|
58
54
|
"#framer-plugin/*": "../plugin-api/src/*"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"registry": "https://registry.npmjs.org"
|
|
59
58
|
}
|
|
60
59
|
}
|