framer-api 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +122 -29
- package/dist/index.js +6 -6
- package/package.json +7 -4
package/dist/index.d.ts
CHANGED
|
@@ -64,8 +64,12 @@ interface RunSupervisorAgentCommandOptions {
|
|
|
64
64
|
goal: string;
|
|
65
65
|
/** Supervisor model id, optionally with eval-style reasoning effort suffix, e.g. `anthropic/claude-opus-4.6=low`. */
|
|
66
66
|
model: string;
|
|
67
|
-
/**
|
|
68
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Inner Framer Agent model override. Defaults to `model` when omitted.
|
|
69
|
+
*
|
|
70
|
+
* Supports the same `model=effort` syntax. Omitting effort is equivalent to `none`.
|
|
71
|
+
*/
|
|
72
|
+
framerAgentModel?: string;
|
|
69
73
|
pagePath?: string;
|
|
70
74
|
maxSteps?: number;
|
|
71
75
|
/** When true, capture per-step (system, tools, messages) → response training rows for SFT. */
|
|
@@ -78,6 +82,10 @@ interface RunSupervisorAgentCommandResult {
|
|
|
78
82
|
trainingDataFilename?: string;
|
|
79
83
|
/** JSONL string with one training row per inner-agent step, present when `captureTrainingData` was set. */
|
|
80
84
|
trainingDataJsonl?: string;
|
|
85
|
+
/** Replay trace filename, present when the inner agent produced at least one model step. */
|
|
86
|
+
traceFilename?: string;
|
|
87
|
+
/** Replay trace JSON with system, tools, and final ModelMessage conversation. */
|
|
88
|
+
traceJson?: string;
|
|
81
89
|
/** Document fixture filename, always present after a completed run. */
|
|
82
90
|
fixtureFilename: string;
|
|
83
91
|
/** Document fixture JSON content (tree + code files). */
|
|
@@ -112,6 +120,27 @@ interface ContinueAgentConversationOptions extends AgentTurnOptions {
|
|
|
112
120
|
conversationId: string;
|
|
113
121
|
}
|
|
114
122
|
|
|
123
|
+
interface AgentBranch {
|
|
124
|
+
id: string;
|
|
125
|
+
title: string;
|
|
126
|
+
url: string;
|
|
127
|
+
baseId?: string;
|
|
128
|
+
joined: boolean;
|
|
129
|
+
}
|
|
130
|
+
interface AgentBranchCollectionItemChange {
|
|
131
|
+
nodeId: string;
|
|
132
|
+
name: string;
|
|
133
|
+
isRemoved: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface AgentBranchChange {
|
|
136
|
+
type: "page" | "collection" | "designPage" | "siteSettings" | "component" | "layoutTemplate";
|
|
137
|
+
nodeId: string;
|
|
138
|
+
name: string;
|
|
139
|
+
isRemoved: boolean;
|
|
140
|
+
items?: AgentBranchCollectionItemChange[];
|
|
141
|
+
settingsTab?: "general" | "redirects";
|
|
142
|
+
}
|
|
143
|
+
|
|
115
144
|
/** @alpha */
|
|
116
145
|
interface Breakpoint {
|
|
117
146
|
/** Name of the breakpoint as displayed on the node */
|
|
@@ -4750,7 +4779,7 @@ type AllMembers = Omit<FramerPluginAPIAlpha, "isAllowedTo" | "subscribeToIsAllow
|
|
|
4750
4779
|
"WebPageNode.clone": WebPageNode["clone"];
|
|
4751
4780
|
"DesignPageNode.clone": DesignPageNode["clone"];
|
|
4752
4781
|
} & 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">;
|
|
4753
|
-
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", "getLocaleLanguages", "getLocaleRegions", "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", "unstable_getDependencyVersion", "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", "readProjectForAgent", "readComponentControlsForAgent", "readIconSetControlsForAgent", "readIconsForAgent", "readLayoutTemplateControlsForAgent", "readShaderControlsForAgent", "getAgentSystemPrompt", "getAgentContext", "ping", "queryImagesForAgent", "reviewChangesForAgent", "getNodeForAgent", "getNodesForAgent", "getNodesOfTypesForAgent", "getScopeNodeForAgent", "getGroundNodeForAgent", "getParentNodeForAgent", "getAncestorsForAgent", "paginateForAgent", "serializeForAgent", "serializeNodesForAgent", "INTERNAL_getAiServiceInfo", "INTERNAL_sendTrackingEvent", "INTERNAL_getCurrentUser", "INTERNAL_getProjectInfo", "INTERNAL_getHTMLForNode", "getAiServiceInfo", "sendTrackingEvent", "unstable_getCodeFile", "unstable_getCodeFiles", "unstable_getCodeFileVersionContent", "unstable_getCodeFileLint2", "unstable_getCodeFileTypecheck2", "unstable_getCodeFileVersions", "lintCode"];
|
|
4782
|
+
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", "getLocaleLanguages", "getLocaleRegions", "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", "unstable_getDependencyVersion", "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", "readProjectForAgent", "readComponentControlsForAgent", "readIconSetControlsForAgent", "readIconsForAgent", "readLayoutTemplateControlsForAgent", "readShaderControlsForAgent", "getAgentSystemPrompt", "getAgentContext", "getActiveBranchForAgent", "getBranchesForAgent", "getBranchChangesForAgent", "ping", "queryImagesForAgent", "reviewChangesForAgent", "getNodeForAgent", "getNodesForAgent", "getNodesOfTypesForAgent", "getScopeNodeForAgent", "getGroundNodeForAgent", "getParentNodeForAgent", "getAncestorsForAgent", "paginateForAgent", "serializeForAgent", "serializeNodesForAgent", "INTERNAL_getAiServiceInfo", "INTERNAL_sendTrackingEvent", "INTERNAL_getCurrentUser", "INTERNAL_getProjectInfo", "INTERNAL_getHTMLForNode", "getAiServiceInfo", "sendTrackingEvent", "unstable_getCodeFile", "unstable_getCodeFiles", "unstable_getCodeFileVersionContent", "unstable_getCodeFileLint2", "unstable_getCodeFileTypecheck2", "unstable_getCodeFileVersions", "lintCode"];
|
|
4754
4783
|
type UnprotectedMessageType = (typeof unprotectedMessageTypesSource)[number];
|
|
4755
4784
|
type ProtectedMessageType = Exclude<keyof PluginMessageAPI, UnprotectedMessageType>;
|
|
4756
4785
|
type Method = keyof {
|
|
@@ -6534,15 +6563,74 @@ declare class FramerAgentAPI {
|
|
|
6534
6563
|
* - **Style presets** — text style presets defined in the project.
|
|
6535
6564
|
* - **Icon sets** — available icon sets and their definitions.
|
|
6536
6565
|
*
|
|
6537
|
-
* This data changes per project
|
|
6566
|
+
* This data changes per project. Pair with the static prompt
|
|
6538
6567
|
* from {@link getSystemPrompt} for complete agent context.
|
|
6539
6568
|
*
|
|
6540
|
-
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6541
6569
|
* @returns A string containing the project context.
|
|
6542
6570
|
*/
|
|
6543
|
-
getContext(
|
|
6544
|
-
|
|
6545
|
-
|
|
6571
|
+
getContext(): Promise<string>;
|
|
6572
|
+
/**
|
|
6573
|
+
* Returns the active project branch.
|
|
6574
|
+
*
|
|
6575
|
+
* @returns Branch metadata for the active branch.
|
|
6576
|
+
*/
|
|
6577
|
+
getActiveBranch(): Promise<AgentBranch>;
|
|
6578
|
+
/**
|
|
6579
|
+
* Returns the project branches.
|
|
6580
|
+
*
|
|
6581
|
+
* @returns Branch metadata for each available branch.
|
|
6582
|
+
*/
|
|
6583
|
+
getBranches(): Promise<AgentBranch[]>;
|
|
6584
|
+
/**
|
|
6585
|
+
* Returns a summarized changelog for a branch.
|
|
6586
|
+
*
|
|
6587
|
+
* @param branchId - Branch id.
|
|
6588
|
+
*/
|
|
6589
|
+
getBranchChanges(branchId: string): Promise<AgentBranchChange[]>;
|
|
6590
|
+
/**
|
|
6591
|
+
* Switches the active project branch.
|
|
6592
|
+
*
|
|
6593
|
+
* @param branchId - Branch id. Use `"main"` for the main branch.
|
|
6594
|
+
*/
|
|
6595
|
+
switchBranch(branchId: string): Promise<void>;
|
|
6596
|
+
/**
|
|
6597
|
+
* Creates a branch and switches to it.
|
|
6598
|
+
*
|
|
6599
|
+
* @param title - Optional branch title. The new branch is created from the active branch.
|
|
6600
|
+
* @returns The created branch.
|
|
6601
|
+
*/
|
|
6602
|
+
createBranch(title?: string): Promise<AgentBranch>;
|
|
6603
|
+
/**
|
|
6604
|
+
* Merges the active branch into its base or a target branch and switches to the target.
|
|
6605
|
+
*
|
|
6606
|
+
* @param targetBranchId - Optional target branch id. Use `"main"` for the main branch.
|
|
6607
|
+
*/
|
|
6608
|
+
mergeBranch(targetBranchId?: string): Promise<void>;
|
|
6609
|
+
/**
|
|
6610
|
+
* Joins a branch as a contributor so the current user can edit it when permissions allow.
|
|
6611
|
+
*
|
|
6612
|
+
* @param branchId - Branch id to join.
|
|
6613
|
+
*/
|
|
6614
|
+
joinBranch(branchId: string): Promise<void>;
|
|
6615
|
+
/**
|
|
6616
|
+
* Leaves a branch as a contributor.
|
|
6617
|
+
*
|
|
6618
|
+
* @param branchId - Branch id to leave.
|
|
6619
|
+
*/
|
|
6620
|
+
leaveBranch(branchId: string): Promise<void>;
|
|
6621
|
+
/**
|
|
6622
|
+
* Renames a branch.
|
|
6623
|
+
*
|
|
6624
|
+
* @param branchId - Branch id to rename.
|
|
6625
|
+
* @param title - New branch title.
|
|
6626
|
+
*/
|
|
6627
|
+
renameBranch(branchId: string, title: string): Promise<void>;
|
|
6628
|
+
/**
|
|
6629
|
+
* Deletes a branch.
|
|
6630
|
+
*
|
|
6631
|
+
* @param branchId - Branch id to delete.
|
|
6632
|
+
*/
|
|
6633
|
+
deleteBranch(branchId: string): Promise<void>;
|
|
6546
6634
|
/**
|
|
6547
6635
|
* Reads project state by executing an array of queries against the project.
|
|
6548
6636
|
*
|
|
@@ -6562,61 +6650,46 @@ declare class FramerAgentAPI {
|
|
|
6562
6650
|
* Reads control definitions for project components.
|
|
6563
6651
|
*
|
|
6564
6652
|
* @param input - `{ componentIds }`: component ids from project context or previous reads.
|
|
6565
|
-
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6566
6653
|
* @returns The matching component control definitions.
|
|
6567
6654
|
*/
|
|
6568
6655
|
readComponentControls(input: {
|
|
6569
6656
|
componentIds: readonly string[];
|
|
6570
|
-
}, options?: {
|
|
6571
|
-
pagePath?: string;
|
|
6572
6657
|
}): Promise<unknown>;
|
|
6573
6658
|
/**
|
|
6574
6659
|
* Reads icon-set control definitions.
|
|
6575
6660
|
*
|
|
6576
6661
|
* @param input - `{ iconSetNames }`: icon set names from project context or previous reads.
|
|
6577
|
-
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6578
6662
|
* @returns The matching icon-set control definitions.
|
|
6579
6663
|
*/
|
|
6580
6664
|
readIconSetControls(input: {
|
|
6581
6665
|
iconSetNames: readonly string[];
|
|
6582
|
-
}, options?: {
|
|
6583
|
-
pagePath?: string;
|
|
6584
6666
|
}): Promise<unknown>;
|
|
6585
6667
|
/**
|
|
6586
6668
|
* Reads exact icon names for an icon set.
|
|
6587
6669
|
*
|
|
6588
6670
|
* @param input - `{ iconSetName }`: icon set name from project context or previous reads.
|
|
6589
|
-
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6590
6671
|
* @returns The available icon names in that set.
|
|
6591
6672
|
*/
|
|
6592
6673
|
readIcons(input: {
|
|
6593
6674
|
iconSetName: string;
|
|
6594
|
-
}, options?: {
|
|
6595
|
-
pagePath?: string;
|
|
6596
6675
|
}): Promise<string[]>;
|
|
6597
6676
|
/**
|
|
6598
6677
|
* Reads layout-template control definitions.
|
|
6599
6678
|
*
|
|
6600
6679
|
* @param input - `{ layoutTemplateIds }`: layout template ids from project context or previous reads.
|
|
6601
|
-
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6602
6680
|
* @returns The matching layout-template control definitions.
|
|
6603
6681
|
*/
|
|
6604
6682
|
readLayoutTemplateControls(input: {
|
|
6605
6683
|
layoutTemplateIds: readonly string[];
|
|
6606
|
-
}, options?: {
|
|
6607
|
-
pagePath?: string;
|
|
6608
6684
|
}): Promise<unknown>;
|
|
6609
6685
|
/**
|
|
6610
6686
|
* Reads shader control definitions.
|
|
6611
6687
|
*
|
|
6612
6688
|
* @param input - `{ shaderNames }`: shader names from project context or previous reads.
|
|
6613
|
-
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6614
6689
|
* @returns The matching shader control definitions.
|
|
6615
6690
|
*/
|
|
6616
6691
|
readShaderControls(input: {
|
|
6617
6692
|
shaderNames: readonly string[];
|
|
6618
|
-
}, options?: {
|
|
6619
|
-
pagePath?: string;
|
|
6620
6693
|
}): Promise<unknown>;
|
|
6621
6694
|
/**
|
|
6622
6695
|
* Applies commands to the canvas to create, update, remove, move, or duplicate nodes.
|
|
@@ -6657,12 +6730,9 @@ declare class FramerAgentAPI {
|
|
|
6657
6730
|
*
|
|
6658
6731
|
* Consumes accumulated diagnostics from the session's agent context.
|
|
6659
6732
|
*
|
|
6660
|
-
* @param options.pagePath - Target page path (e.g. `"/about"`). Defaults to the active page.
|
|
6661
6733
|
* @returns The session's accumulated changes, errors, warnings, and deferred trait reports.
|
|
6662
6734
|
*/
|
|
6663
|
-
reviewChanges(
|
|
6664
|
-
pagePath?: string;
|
|
6665
|
-
}): Promise<unknown>;
|
|
6735
|
+
reviewChanges(): Promise<unknown>;
|
|
6666
6736
|
/**
|
|
6667
6737
|
* Flattens a local component instance into raw editable layers.
|
|
6668
6738
|
*
|
|
@@ -7128,6 +7198,26 @@ interface PluginMessageAPI {
|
|
|
7128
7198
|
pagePath?: string;
|
|
7129
7199
|
}) => Promise<string>;
|
|
7130
7200
|
/** @alpha */
|
|
7201
|
+
getActiveBranchForAgent: () => Promise<AgentBranch>;
|
|
7202
|
+
/** @alpha */
|
|
7203
|
+
getBranchesForAgent: () => Promise<AgentBranch[]>;
|
|
7204
|
+
/** @alpha */
|
|
7205
|
+
getBranchChangesForAgent: (branchId: string) => Promise<AgentBranchChange[]>;
|
|
7206
|
+
/** @alpha */
|
|
7207
|
+
switchBranchForAgent: (branchId: string) => Promise<void>;
|
|
7208
|
+
/** @alpha */
|
|
7209
|
+
createBranchForAgent: (title?: string) => Promise<AgentBranch>;
|
|
7210
|
+
/** @alpha */
|
|
7211
|
+
mergeBranchForAgent: (targetBranchId?: string) => Promise<void>;
|
|
7212
|
+
/** @alpha */
|
|
7213
|
+
joinBranchForAgent: (branchId: string) => Promise<void>;
|
|
7214
|
+
/** @alpha */
|
|
7215
|
+
leaveBranchForAgent: (branchId: string) => Promise<void>;
|
|
7216
|
+
/** @alpha */
|
|
7217
|
+
renameBranchForAgent: (branchId: string, title: string) => Promise<void>;
|
|
7218
|
+
/** @alpha */
|
|
7219
|
+
deleteBranchForAgent: (branchId: string) => Promise<void>;
|
|
7220
|
+
/** @alpha */
|
|
7131
7221
|
readProjectForAgent: (queries: Record<string, unknown>[], options?: {
|
|
7132
7222
|
pagePath?: string;
|
|
7133
7223
|
}) => Promise<{
|
|
@@ -7332,7 +7422,7 @@ declare class PluginEngine {
|
|
|
7332
7422
|
reject: (error: FramerPluginError) => void;
|
|
7333
7423
|
}>;
|
|
7334
7424
|
readonly mode: Mode;
|
|
7335
|
-
readonly subscriptions: Map<"text" | "image" | "publishInfo" | "selection" | "canvasRoot" | "theme" | "customCode" | "colorStyles" | "textStyles" | "
|
|
7425
|
+
readonly subscriptions: Map<"redirects" | "text" | "image" | "publishInfo" | "selection" | "canvasRoot" | "theme" | "customCode" | "colorStyles" | "textStyles" | "codeFiles" | "openCodeFile", Set<(value: any) => void>>;
|
|
7336
7426
|
perMethodPermissionMap: PerMethodPermissionMap;
|
|
7337
7427
|
readonly permissionSubscriptions: Set<VoidFunction>;
|
|
7338
7428
|
readonly messageTypesCheckedInIsAllowedTo: Set<ProtectedMessageType>;
|
|
@@ -7701,10 +7791,13 @@ type BlockedMethods = {
|
|
|
7701
7791
|
}[keyof EnabledMethodsConfig];
|
|
7702
7792
|
/** Used by ActivePlugin.ts for vekter-side validation */
|
|
7703
7793
|
type AvailablePluginMethods = Omit<FramerPluginAPIAlpha, BlockedMethods>;
|
|
7794
|
+
interface FramerReconnectOptions {
|
|
7795
|
+
expectedInitialBranchId?: string;
|
|
7796
|
+
}
|
|
7704
7797
|
interface FramerConnectionMethods {
|
|
7705
7798
|
disconnect(): Promise<void>;
|
|
7706
7799
|
/** @internal */
|
|
7707
|
-
reconnect(): Promise<void>;
|
|
7800
|
+
reconnect(options?: FramerReconnectOptions): Promise<void>;
|
|
7708
7801
|
requestId?: string;
|
|
7709
7802
|
sessionId?: string;
|
|
7710
7803
|
[Symbol.dispose](): void;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {env,isDeno,isWorkerd}from'std-env';import*as ue from'devalue';/* Framer API SDK v0.1.
|
|
2
|
-
var
|
|
1
|
+
import {env,isDeno,isWorkerd}from'std-env';import*as ue from'devalue';/* Framer API SDK v0.1.16 */
|
|
2
|
+
var Yr=Object.defineProperty;var r=(n,e)=>Yr(n,"name",{value:e,configurable:true});function ut(n){return n!==void 0}r(ut,"isDefined");function ti(n){return n===void 0}r(ti,"isUndefined");function T(n){return n===null}r(T,"isNull");function ni(n){return n!==null}r(ni,"isNotNull");function Fe(n){return n===true||n===false}r(Fe,"isBoolean");function h(n){return typeof n=="string"}r(h,"isString");function X(n){return typeof n=="number"&&Number.isFinite(n)}r(X,"isNumber");function Xr(n){return typeof n=="function"}r(Xr,"isFunction");function k(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(k,"isObject");function ve(n){if(typeof n!="object"||n===null)return false;let e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}r(ve,"isPlainObject");function pt(n){return Array.isArray(n)}r(pt,"isArray");function De(n,e){throw e instanceof Error?e:e!==void 0?new Error(String(e)):new Error(n?`Unexpected value: ${n}`:"Application entered invalid state")}r(De,"assertNever");function p(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
3
3
|
`);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
|
|
4
4
|
`)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
|
|
5
|
-
`));}catch{}throw t}r(c,"assert");function F(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!Yr(t)||F(t);}return Object.freeze(n)}r(F,"deepFreeze");function ii(n){return [n.slice(0,-1),n.at(-1)]}r(ii,"splitRestAndLast");var m="__class";var Yt=Symbol(),Xt=Symbol(),Zt=Symbol(),Jt=Symbol(),Xr=Symbol(),Zr=Symbol(),Jr=Symbol(),Qr=Symbol(),eo=Symbol(),Qt=Symbol(),en=Symbol(),l={getAiServiceInfo:Yt,sendTrackingEvent:Xt,getCurrentUser:Zt,getProjectInfo:Jt,environmentInfo:Xr,initialState:Zr,showUncheckedPermissionToasts:Jr,marshal:Qr,unmarshal:eo,getHTMLForNode:Qt,setHTMLForNode:en},pe="INTERNAL_",mt=`${pe}getAiServiceInfo`,ft=`${pe}sendTrackingEvent`,yt=`${pe}getCurrentUser`,ht=`${pe}getProjectInfo`,ge=`${pe}getHTMLForNode`,me=`${pe}setHTMLForNode`;var A=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(I(t))return null;let i=this.constructor;return new i(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},w="Variable";function L(n){let e=n.at(0);return c(!ti(e)),`${e.toLowerCase()}${n.slice(1,-w.length)}`}r(L,"classToType");var to=`Boolean${w}`,no=L(to),ke=class n extends A{static{r(this,"BooleanVariable");}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=`Number${w}`,ro=L(io),Ne=class n extends A{static{r(this,"NumberVariable");}type=ro;#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}},oo=`String${w}`,ao=L(oo),Ee=class n extends A{static{r(this,"StringVariable");}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=`FormattedText${w}`,lo=L(so),Ae=class n extends A{static{r(this,"FormattedTextVariable");}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}},uo=`Enum${w}`,co=L(uo),Y=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);}},Me=class n extends A{static{r(this,"EnumVariable");}type=co;#e;#t;#n;get cases(){return this.#n||(this.#n=F(this.#t.cases.map(e=>new Y(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 Y(this.#e,this.nodeId,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.nodeId,this.id,e);}},po=`Color${w}`,go=L(po),we=class n extends A{static{r(this,"ColorVariable");}type=go;#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}},mo=`Image${w}`,fo=L(mo),Ve=class n extends A{static{r(this,"ImageVariable");}type=fo;#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}},yo=`File${w}`,ho=L(yo),Le=class n extends A{static{r(this,"FileVariable");}type=ho;#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}},bo=`Link${w}`,xo=L(bo),We=class n extends A{static{r(this,"LinkVariable");}type=xo;#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}},Co=`Date${w}`,Io=L(Co),Re=class n extends A{static{r(this,"DateVariable");}type=Io;#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}},To=`Border${w}`,Po=L(To),Be=class n extends A{static{r(this,"BorderVariable");}type=Po;#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${w}`,Fo=L(So),Ue=class n extends A{static{r(this,"UnsupportedVariable");}type=Fo;#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 ri(n){return n instanceof A}r(ri,"isVariable");function vo(n){return ri(n)&&n.nodeType==="component"}r(vo,"isComponentVariable");var U=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(c(pt(i)),I(i))return null;c(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]);}},B=class extends U{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},bt=class extends U{static{r(this,"BooleanField");}type=rn},xt=class extends U{static{r(this,"ColorField");}type=on},Ct=class extends U{static{r(this,"NumberField");}type=an},It=class extends B{static{r(this,"StringField");}type=sn;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},Tt=class extends B{static{r(this,"FormattedTextField");}type=ln},Oe=class extends B{static{r(this,"ImageField");}type=dn},Pt=class extends B{static{r(this,"LinkField");}type=cn},St=class extends B{static{r(this,"DateField");}type=pn;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},Ft=class extends U{static{r(this,"FieldDivider");}type=hn},ze=class extends U{static{r(this,"UnsupportedField");}type=bn},vt=class extends B{static{r(this,"FileField");}type=gn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},Dt=class extends U{static{r(this,"EnumField");}type=mn;#e;#t;#n;#i;get cases(){return this.#i||(this.#i=this.#n.cases.map(e=>new Y(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 Y(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},kt=class extends B{static{r(this,"CollectionReferenceField");}type=fn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},Nt=class extends B{static{r(this,"MultiCollectionReferenceField");}type=yn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},tn=class extends B{static{r(this,"ArrayField");}type=un;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Oe(e,t,o)];}};function nn(n,e,t){return n.map(i=>{switch(i.type){case rn:return new bt(e,t,i);case on:return new xt(e,t,i);case an:return new Ct(e,t,i);case sn:return new It(e,t,i);case ln:return new Tt(e,t,i);case dn:return new Oe(e,t,i);case cn:return new Pt(e,t,i);case pn:return new St(e,t,i);case hn:return new Ft(e,t,i);case bn:return new ze(e,t,i);case gn:return new vt(e,t,i);case mn:return new Dt(e,t,i);case fn:return new kt(e,t,i);case yn:return new Nt(e,t,i);case un:return new tn(e,t,i);default:return new ze(e,t,i)}})}r(nn,"fieldDefinitionDataArrayToFieldClassInstances");function Do(n){return n instanceof U}r(Do,"isField");var oi="action";function ko(n){return !!n&&oi in n&&f(n[oi])}r(ko,"isLocalizedValueUpdate");function ai(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return ko(i)&&(e[t]=i),e},{})}r(ai,"filterInlineLocalizationValues");var Ge=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 {[m]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function No(n){return n instanceof Ge}r(No,"isFileAsset");var Eo="ImageAsset";function si(n){return k(n)?n[m]===Eo:false}r(si,"isImageAssetData");var X=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 {[m]:"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,{[m]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return wo(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 a=new Image;a.onload=()=>i(a),a.onerror=()=>o(),a.src=t;})}};function Ao(n){return n instanceof X}r(Ao,"isImageAsset");function Z(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(Z,"getTransferable");function Mo(n){if(!k(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!f(n[t]))}r(Mo,"isBytesData");async function Ke(n){if(n instanceof File)return In(n);let e=await li(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(Ke,"createImageTransferFromInput");async function xn(n){if(n instanceof File)return In(n);let e=await li(n.file);return {name:n.name,...e}}r(xn,"createFileTransferFromInput");async function li(n){return n instanceof File?In(n):Mo(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(li,"createAssetTransferFromAssetInput");function Cn(n){return Promise.all(n.map(Ke))}r(Cn,"createNamedAssetDataTransferFromInput");async function In(n){return new Promise((e,t)=>{let i=new FileReader;i.onload=o=>{let a=n.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:n.name});},i.onerror=o=>{t(o);},i.readAsArrayBuffer(n);})}r(In,"getAssetDataFromFile");async function wo(n){let e=n instanceof File,t=e?URL.createObjectURL(n):n,i=new Image;return i.crossOrigin="anonymous",new Promise((o,a)=>{i.onload=()=>{o({width:i.naturalWidth,height:i.naturalHeight});},i.onerror=s=>{a(s);},i.src=t;}).finally(()=>{e&&URL.revokeObjectURL(t);})}r(wo,"measureImage");var Et=class{static{r(this,"ComputedValueBase");}};var Vo="unsupported",$e=class n extends Et{static{r(this,"UnsupportedComputedValue");}type=Vo;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function Lo(n){return n instanceof Et}r(Lo,"isComputedValue");var Wo="Font";function ui(n){return k(n)&&n[m]===Wo}r(ui,"isFontData");function Ro(n){if(!q(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(Ro,"isFontWeight");function Bo(n){if(!f(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(Bo,"isFontStyle");function ci(n){return k(n)?f(n.family)&&f(n.selector)&&Ro(n.weight)&&Bo(n.style):false}r(ci,"isFont");var G=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=di.get(t.selector);if(i)return i;let o=new n(t);return di.set(t.selector,o),o}[l.marshal](){return {[m]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},di=new Map;var At="plugin-marshal";function Tn(n){return k(n)&&l.marshal in n}r(Tn,"isSelfMarshalable");function W(n){if(Tn(n))return n[l.marshal]();if(gt(n))return n.map(W);if(ve(n)){let e={};for(let t of Object.keys(n))e[t]=W(n[t]);return e}return n}r(W,"marshal");var Uo="LinearGradient",Oo="RadialGradient",zo="ConicGradient",fe=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})}},He=class n extends fe{static{r(this,"LinearGradient");}[m]=Uo;#e;get angle(){return this.#e.angle}constructor(e){super(e),this.#e=e;}static[l.unmarshal](e,t){return new n({...t,stops:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[m]:this[m]})}toCSS(){let e=this.#e.stops.map(t=>(c(f(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},je=class n extends fe{static{r(this,"RadialGradient");}[m]=Oo;#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:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[m]:this[m]})}toCSS(){let e=this.stops.map((t,i)=>{c(f(t.color),"ColorStyle not supported yet");let o=this.stops[i+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})`}},_e=class n extends fe{static{r(this,"ConicGradient");}[m]=zo;#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:y(e,t.stops)})}[l.marshal](){return W({...this.#e,[m]:this[m]})}toCSS(){let e=this.stops.map(t=>(c(f(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 pi(n){return n instanceof fe}r(pi,"isGradient");var Go="ColorStyle";function Mt(n){return k(n)?n[m]===Go:false}r(Mt,"isColorStyleData");var te=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 {[m]:"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 ye(n){return n instanceof te}r(ye,"isColorStyle");var Ko="TextStyle";function gi(n){return k(n)?n[m]===Ko:false}r(gi,"isTextStyleData");var qe=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=G[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&G[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&G[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&G[l.unmarshal](e,t.boldItalicFont),this.color=Mt(t.color)?te[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=Mt(t.decorationColor)?te[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 {[m]:"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:ye(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:ye(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 qe}r(Pn,"isTextStyle");var mi={ColorStyle:te,ConicGradient:_e,FileAsset:Ge,Font:G,ImageAsset:X,LinearGradient:He,RadialGradient:je,TextStyle:qe,BooleanVariable:ke,BorderVariable:Be,ColorVariable:we,DateVariable:Re,EnumVariable:Me,FileVariable:Le,FormattedTextVariable:Ae,ImageVariable:Ve,LinkVariable:We,NumberVariable:Ne,StringVariable:Ee,UnsupportedVariable:Ue,UnsupportedComputedValue:$e};function $o(n){return ve(n)&&f(n[m])&&n[m]in mi}r($o,"isSelfUnmarshalable");function y(n,e){if($o(e))return mi[e[m]][l.unmarshal](n,e);if(gt(e))return e.map(t=>y(n,t));if(ve(e)){let t={};for(let i of Object.keys(e))t[i]=y(n,e[i]);return t}return e}r(y,"unmarshal");var Ho={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 jo(n){return Ho[n]}r(jo,"isSupportedArrayItemFieldType");function _o(n){return jo(n.type)}r(_o,"isSupportedArrayItemFieldDataEntry");var rn="boolean",on="color",an="number",sn="string",ln="formattedText",dn="image",un="array",cn="link",pn="date",gn="file",mn="enum",fn="collectionReference",yn="multiCollectionReference",hn="divider",bn="unsupported";function qo(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?ai(i.nameByLocale):void 0;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(qo,"sanitizeEnumFieldForMessage");function fi(n,e){let t={};for(let i in n){let o=n[i];if(!o)continue;if(o.type!=="array"){t[i]=y(e,o);continue}let a=o.value.map(s=>{let d=fi(s.fieldData,e),g={};for(let x in d){let S=d[x];c(S&&_o(S),"Unsupported array item field data entry"),g[x]=S;}return {...s,fieldData:g}});t[i]={...o,value:a};}return t}r(fi,"deserializeFieldData");var he=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,c(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=qo(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)}},ne=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 nn(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return c(t.every(ni)),nn(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 Ye(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)}},Ye=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=fi(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 Yo={fixed:true,sticky:true,absolute:true,relative:true},yi="position";function ol(n){if(!(yi in n))return false;let e=n[yi];return f(e)&&Yo[e]===true}r(ol,"supportsPosition");var hi="top";function al(n){if(!(hi in n))return false;let e=n[hi];return f(e)||I(e)}r(al,"supportsPins");var bi="width";function sl(n){if(!(bi in n))return false;let e=n[bi];return f(e)||I(e)}r(sl,"supportsSize");var xi="maxWidth";function ll(n){if(!(xi in n))return false;let e=n[xi];return f(e)||I(e)}r(ll,"supportsSizeConstraints");var Ci="aspectRatio";function dl(n){if(!(Ci in n))return false;let e=n[Ci];return q(e)||I(e)}r(dl,"supportsAspectRatio");var Ii="name";function ul(n){if(!(Ii in n))return false;let e=n[Ii];return f(e)||I(e)}r(ul,"supportsName");var Ti="visible";function cl(n){if(!(Ti in n))return false;let e=n[Ti];return Fe(e)}r(cl,"supportsVisible");var Pi="locked";function pl(n){if(!(Pi in n))return false;let e=n[Pi];return Fe(e)}r(pl,"supportsLocked");var Si="backgroundColor";function gl(n){if(!(Si in n))return false;let e=n[Si];return f(e)||ye(e)||I(e)}r(gl,"supportsBackgroundColor");var Fi="backgroundColor";function ml(n){if(!(Fi in n))return false;let e=n[Fi];return f(e)||Mt(e)||I(e)}r(ml,"supportsBackgroundColorData");var vi="backgroundImage";function fl(n){if(!(vi in n))return false;let e=n[vi];return e instanceof X||I(e)}r(fl,"supportsBackgroundImage");var Di="backgroundImage";function yl(n){if(!(Di in n))return false;let e=n[Di];return e instanceof X?false:si(e)||I(e)}r(yl,"supportsBackgroundImageData");var ki="backgroundGradient";function hl(n){if(!(ki in n))return false;let e=n[ki];return pi(e)||I(e)}r(hl,"supportsBackgroundGradient");var Ni="backgroundGradient";function bl(n){if(!(Ni in n))return false;let e=n[Ni];return k(e)||I(e)}r(bl,"supportsBackgroundGradientData");var Ei="rotation";function xl(n){if(!(Ei in n))return false;let e=n[Ei];return q(e)}r(xl,"supportsRotation");var Ai="opacity";function Cl(n){if(!(Ai in n))return false;let e=n[Ai];return q(e)}r(Cl,"supportsOpacity");var Mi="borderRadius";function Il(n){if(!(Mi in n))return false;let e=n[Mi];return f(e)||I(e)}r(Il,"supportsBorderRadius");var wi="border";function Tl(n){if(!(wi in n))return false;let e=n[wi];return I(e)||ye(e.color)}r(Tl,"supportsBorder");var Vi="svg";function Pl(n){if(!(Vi in n))return false;let e=n[Vi];return f(e)}r(Pl,"supportsSVG");var Li="textTruncation";function Sl(n){if(!(Li in n))return false;let e=n[Li];return q(e)||I(e)}r(Sl,"supportsTextTruncation");var Wi="zIndex";function Fl(n){if(!(Wi in n))return false;let e=n[Wi];return q(e)||I(e)}r(Fl,"supportsZIndex");var Ri="overflow";function vl(n){if(!(Ri in n))return false;let e=n[Ri];return f(e)||I(e)}r(vl,"supportsOverflow");var Bi="componentIdentifier";function Dl(n){if(!(Bi in n))return false;let e=n[Bi];return f(e)}r(Dl,"supportsComponentInfo");var Ui="font";function kl(n){if(!(Ui in n))return false;let e=n[Ui];return ci(e)}r(kl,"supportsFont");var Oi="font";function Nl(n){if(!(Oi in n))return false;let e=n[Oi];return ui(e)||I(e)}r(Nl,"supportsFontData");var zi="inlineTextStyle";function El(n){if(!(zi in n))return false;let e=n[zi];return Pn(e)||I(e)}r(El,"supportsInlineTextStyle");var Gi="inlineTextStyle";function Al(n){if(!(Gi in n))return false;let e=n[Gi];return gi(e)||I(e)}r(Al,"supportsInlineTextStyleData");var Ki="link";function Ml(n){if(!(Ki in n))return false;let e=n[Ki];return f(e)||I(e)}r(Ml,"supportsLink");var $i="imageRendering";function wl(n){if(!($i in n))return false;let e=n[$i];return f(e)||I(e)}r(wl,"supportsImageRendering");var Hi="layout";function qi(n){if(!(Hi in n))return false;let e=n[Hi];return f(e)||I(e)}r(qi,"supportsLayout");function Vl(n){return qi(n)?n.layout==="stack":false}r(Vl,"hasStackLayout");function Ll(n){return qi(n)?n.layout==="grid":false}r(Ll,"hasGridLayout");var ji="isVariant";function Yi(n){if(!(ji in n))return false;let e=n[ji];return Fe(e)}r(Yi,"supportsComponentVariant");function Sn(n){return Yi(n)?n.isVariant:false}r(Sn,"isComponentVariant");function Xi(n){return !Yi(n)||!Sn(n)?false:!I(n.gesture)}r(Xi,"isComponentGestureVariant");var _i="isBreakpoint";function Xo(n){if(!(_i in n))return false;let e=n[_i];return Fe(e)}r(Xo,"supportsBreakpoint");function Zi(n){return Xo(n)?n.isBreakpoint:false}r(Zi,"isBreakpoint");var R=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(){return this.#e.cloneNode(this.id)}async setAttributes(e){if(this[m]==="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 ie(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttribute(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return ie(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>C(i,this.#e))}async*walk(){if(yield this,!ie(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)}},O=class extends R{static{r(this,"FrameNode");}[m]="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;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;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=y(t,e.backgroundColor)??null,this.backgroundImage=y(t,e.backgroundImage)??null,this.rotation=e.rotation??0,this.opacity=e.opacity??1,this.borderRadius=e.borderRadius??null,this.border=y(t,e.border)??null,this.backgroundGradient=y(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.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??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);}},re=class extends R{static{r(this,"TextNode");}[m]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;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=y(t,e.font)??null,this.inlineTextStyle=y(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.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??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(me,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(ge,this.id)}},Xe=class extends R{static{r(this,"SVGNode");}[m]="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);}},Ze=class extends R{static{r(this,"VectorSetItemNode");}[m]="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)}},Je=class extends R{static{r(this,"ComponentInstanceNode");}[m]="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=y(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=y(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)}},K=class extends R{static{r(this,"WebPageNode");}[m]="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);}async clone(e){return this.#e.cloneWebPage(this.id,e)}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let i=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=C(i,this.#e);return c(o instanceof O),c(Zi(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new Ye(e,this.#e):null}},oe=class extends R{static{r(this,"ComponentNode");}[m]="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=C(i,this.#e);return c(o instanceof O),c(Sn(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 a=C(o,this.#e);return c(a instanceof O),c(Xi(a),"Node is not a gesture variant"),a}async getVariables(){let e=await this.#e.invoke("getVariables",this.id);return y(this.#e,e)}async addVariables(e){let t=await this.#e.invoke("addVariables",this.id,W(e));return y(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);}},Qe=class extends R{static{r(this,"VectorSetNode");}[m]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,F(this);}},$=class extends R{static{r(this,"DesignPageNode");}[m]="DesignPageNode";name;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,F(this);}async clone(e){return this.#e.cloneDesignPage(this.id,e)}},et=class extends R{static{r(this,"UnknownNode");}[m]="UnknownNode";constructor(e,t){super(e,t),F(this);}async clone(){throw new Error("Cannot clone an unknown node")}};function C(n,e){switch(n[m]){case "DesignPageNode":return new $(n,e);case "WebPageNode":return new K(n,e);case "ComponentNode":return new oe(n,e);case "VectorSetNode":return new Qe(n,e);case "VectorSetItemNode":return new Ze(n,e);case "ComponentInstanceNode":return new Je(n,e);case "FrameNode":return new O(n,e);case "SVGNode":return new Xe(n,e);case "TextNode":return new re(n,e);case "UnknownNode":return new et(n,e);default:return new et(n,e)}}r(C,"convertRawNodeDataToNode");function wt(n){return n instanceof O}r(wt,"isFrameNode");function Ji(n){return n instanceof re}r(Ji,"isTextNode");function Qi(n){return n instanceof Xe}r(Qi,"isSVGNode");function be(n){return n instanceof Je}r(be,"isComponentInstanceNode");function er(n){return n instanceof K}r(er,"isWebPageNode");function tr(n){return n instanceof oe}r(tr,"isComponentNode");function nr(n){return n instanceof $}r(nr,"isDesignPageNode");function ir(n){return n instanceof Qe}r(ir,"isVectorSetNode");function rr(n){return n instanceof Ze}r(rr,"isVectorSetItemNode");function ie(n){return n instanceof et}r(ie,"isUnknownNode");function tt(n){return !!(wt(n)||Ji(n)||be(n)||Qi(n)||rr(n)||ie(n))}r(tt,"isCanvasNode");function Fn(n){return !!(er(n)||nr(n)||tr(n)||ir(n)||ie(n))}r(Fn,"isCanvasRootNode");var nt=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 Vt(t,this.#e))}},Vt=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 it=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},J=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Zo(n){return n.type==="separator"}r(Zo,"isSeparatorMenuItem");function Lt(n,e){let t=[];for(let i of n){if(Zo(i)){t.push(i);continue}let{onAction:o,...a}=i,s=a;if(i.onAction){let d=Math.random();e.set(d,i.onAction),s.actionId=d;}i.submenu&&(s.submenu=Lt(i.submenu,e)),t.push(s);}return t}r(Lt,"addMenuItemsToOnActionCallbackMap");var Wt="type",or={[Wt]:"pluginReadySignal"},Qo="pluginReadyResponse";var ea={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function ar(n){return k(n)&&f(n[Wt])&&n[Wt]in ea}r(ar,"isVekterToPluginNonHandshakeMessage");function sr(n){return k(n)&&n[Wt]===Qo}r(sr,"isPluginReadyResponse");var vn=Symbol(),Dn=Symbol(),kn=Symbol(),Nn=Symbol(),En=Symbol(),An=Symbol(),Mn=Symbol(),wn=Symbol(),V={ping:wn,publish:vn,getDeployments:Dn,deploy:kn,getChangedPaths:Nn,getChangeContributors:En,createManagedCollection:An,rejectAllPending:Mn};function Vn(n){return typeof n=="string"&&n in V}r(Vn,"isFramerApiOnlyMethod");var ta=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],na=["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","getLocaleLanguages","getLocaleRegions","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","unstable_getDependencyVersion","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","readProjectForAgent","readComponentControlsForAgent","readIconSetControlsForAgent","readIconsForAgent","readLayoutTemplateControlsForAgent","readShaderControlsForAgent","getAgentSystemPrompt","getAgentContext","ping","queryImagesForAgent","reviewChangesForAgent","getNodeForAgent","getNodesForAgent","getNodesOfTypesForAgent","getScopeNodeForAgent","getGroundNodeForAgent","getParentNodeForAgent","getAncestorsForAgent","paginateForAgent","serializeForAgent","serializeNodesForAgent",mt,ft,yt,ht,ge,"getAiServiceInfo","sendTrackingEvent",...ta];new Set(na);var Ln={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"],createLocale:["createLocale"],getLocaleLanguages:[],getLocaleRegions:[],setMenu:[],showContextMenu:[],setParent:["setParent"],setPluginData:["setPluginData"],setSelection:[],setText:["setText"],typecheckCode:[],showUI:[],subscribeToCanvasRoot:[],subscribeToColorStyles:[],subscribeToCustomCode:[],subscribeToImage:[],subscribeToPublishInfo:[],subscribeToSelection:[],subscribeToText:[],subscribeToTextStyles:[],createCodeFile:["createCodeFile"],unstable_getDependencyVersion:[],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","cloneWebPage","cloneDesignPage"],"WebPageNode.clone":["cloneWebPage"],"DesignPageNode.clone":["cloneDesignPage"],"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":[me],"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"],[Yt]:[],[Xt]:[],[Zt]:[],[Jt]:[],[Qt]:[],[en]:[],[vn]:["publish"],[Dn]:[],[kn]:["deploy"],[Nn]:[],[En]:[],[An]:["createManagedCollection"],[Mn]:[],[wn]:[]},Rt=[];for(let n of Object.keys(Ln))Ln[n].length!==0&&Rt.push(n);F(Rt);function Wn(n){let e={};for(let t of Rt){let i=Ln[t];e[t]=i.every(o=>n[o]);}return e}r(Wn,"createPerMethodPermissionMap");function lr(){let n={};for(let e of Rt)n[e]=true;return n}r(lr,"createPerMethodPermissionMapForTesting");var xe=null;function dr(n){if(typeof window>"u")return;if(!xe){let t=document.createElement("style");document.head.appendChild(t),xe=t.sheet;}if(!xe){n();return}let e=xe.insertRule("* { transition: none !important; animation: none !important; }");n(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{xe&&xe.deleteRule(e);});});}r(dr,"withDisabledCssTransitions");var Ce=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=lr(),this.initialState={mode:"canvas",intent:"plugin/open"};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.initialState=e.initialState??{mode:e.mode,intent:"plugin/open"},this.environmentInfo=e.environmentInfo,this.perMethodPermissionMap=Wn(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),this.applyPrereleaseStyles();break;case "api":break;default:De(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,void 0,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(W)};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 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=r(e=>{let t=e?.data??e;if(ar(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=Wn(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i){switch(this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":throw new Error(`No handler for response with id ${t.id}`);case "api":{if(!(t.id<this.methodInvocationId))throw new Error(`No handler for unknown response id ${t.id}`);break}default:De(this.mode);}break}this.methodResponseHandlers.delete(t.id),f(t.error)?i.reject(new it(t.error)):i.resolve(t.result);break}case "subscriptionMessage":{let{topic:i,payload:o}=t,a=this.subscriptions.get(i);if(!a)throw new Error("Received a subscription message but no handler present");for(let s of a)s(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:De(t);}},"onMessage");getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:De(t);}}applyPluginTheme=r(e=>{dr(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});},"applyPluginTheme");applyPrereleaseStyles(){typeof window>"u"||new URLSearchParams(window.location.search).get("styles")==="prerelease"&&document.body.setAttribute("data-framer-styles","prerelease");}async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?C(t,this):null}async cloneWebPage(e,t){let i=await this.invoke("cloneWebPage",e,t);c(i,"Expected to receive data for cloned web page");let o=C(i,this);return c(o instanceof K,"Expected cloned node to be an instance of WebPageNode"),o}async cloneDesignPage(e,t){let i=await this.invoke("cloneDesignPage",e,t);c(i,"Expected to receive data for cloned design page");let o=C(i,this);return c(o instanceof $,"Expected cloned node to be an instance of DesignPageNode"),o}async setAttributes(e,t){let i=await this.invoke("setAttributes",e,t);return i?C(i,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?C(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(i=>{let o=C(i,this);return c(tt(o)),o})}notify=r((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:r(()=>this.invoke("closeNotification",i),"close")}},"notify");async setMenu(e){this.menuItemOnActionCallbackMap=new Map;let t=Lt(e,this.menuItemOnActionCallbackMap);await this.invoke("setMenu",t);}async showContextMenu(e,t){this.contextMenuItemOnActionCallbackMap=new Map;let i=Lt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function ia(n){return n.type==="component"}r(ia,"isCodeFileComponentExport");function ra(n){return n.type==="override"}r(ra,"isCodeFileOverrideExport");var Rn=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)}},Q=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 Rn(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 Bt=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=C(i,this.#t);return c(be(o)),o}};var oa=(()=>{let n=null;return {disableUntilMouseUp:r(()=>{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(a=>{a.buttons>0&&a.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");},"disableUntilMouseUp")}})(),ur=5,aa=(()=>{let n=1;return {next:r(()=>`drag-${n++}`,"next")}})();function sa(){}r(sa,"noop");function cr(n,e,t,i){if(n.mode!=="canvas")return sa;let o=aa.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,g=ae.subscribeToIsAllowedTo("makeDraggable",p=>{p||T();}),x=r(p=>{ae.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&n.invoke("onDragEnd",{...p,dragSessionId:o}).then(b=>{try{i?.(b);}catch{}}).catch(b=>{if(b instanceof Error){i?.({status:"error",reason:b.message});return}if(typeof b=="string"){i?.({status:"error",reason:b});return}i?.({status:"error"});}),T());},"endDrag"),S=r(p=>{if(!ae.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(p.buttons>0&&!!(p.buttons&1))){x({cancelled:false});return}let{clientX:M,clientY:z}=p;if(s.type==="pointerDown"){let E=M-s.dragStart.mouse.x,ct=z-s.dragStart.mouse.y;if(Math.abs(E)<ur&&Math.abs(ct)<ur)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),oa.disableUntilMouseUp();}d.setPointerCapture(p.pointerId);let ee={x:M,y:z};n.invoke("onDrag",{dragSessionId:o,mouse:ee}).then(E=>{s.type==="dragging"&&(document.body.style.cursor=E??"");});},"handlePointerChange"),v=r(p=>{p.key==="Escape"&&x({cancelled:true});},"handleKeyDown"),_=r(()=>{x({cancelled:true});},"handleBlur"),h=r(p=>{if(!ae.isAllowedTo("makeDraggable"))return;x({cancelled:true});let b=e.getBoundingClientRect(),M={x:b.x,y:b.y,width:b.width,height:b.height},z,ee=e.querySelectorAll("svg");if(ee.length===1){let ce=ee.item(0).getBoundingClientRect();z={x:ce.x,y:ce.y,width:ce.width,height:ce.height};}let E={x:p.clientX,y:p.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:M,svgRect:z,mouse:E}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",S,true),d.addEventListener("pointerup",S,true),window.addEventListener("keydown",v,true),window.addEventListener("blur",_);},"handlePointerDown"),u=r(()=>{if(!ae.isAllowedTo("makeDraggable"))return;let p=t();p.type==="detachedComponentLayers"&&n.invoke("preloadDetachedComponentLayers",p.url),p.type==="image"&&n.invoke("preloadImageUrlForInsertion",p.image),p.previewImage&&n.invoke("preloadDragPreviewImage",p.previewImage);},"preload");e.addEventListener("pointerdown",h),e.addEventListener("mouseenter",u);function T(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",S,true),d.removeEventListener("pointerup",S,true),window.removeEventListener("keydown",v,true),window.removeEventListener("blur",_);}return r(T,"dragCleanup"),()=>{e.removeEventListener("pointerdown",h),e.removeEventListener("mouseenter",u),x({cancelled:true}),g();}}r(cr,"makeDraggable");var Ie=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 c(pt(i)),I(i)?null:new n(i,this.#t)}};var Bn=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]=ii(e),o=this.isAllowedTo(...t),a=r(()=>{let s=this.isAllowedTo(...t);s!==o&&(o=s,i(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 i=C(t,this.#e);return c(tt(i)),i})}async setSelection(e){let t=f(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 a=C(o,this.#e);return c(tt(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=C(e,this.#e);return c(Fn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=C(t,this.#e);c(Fn(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=C(i,this.#e);return c(o instanceof O),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?C(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=f(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=>C(i,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(i=>C(i,this.#e))}async getImage(){let e=await this.#e.invoke("getImage");return e?y(this.#e,e):null}subscribeToImage(e){return this.#e.subscribe("image",t=>{if(!t){e(null);return}e(y(this.#e,t));})}async addImage(e){let t=await Ke(e),i=Z(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await Ke(e),i=Z(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await Ke(e),i=Z(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return y(this.#e,o)}async addImages(e){let t=await Cn(e),i=t.flatMap(Z);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await Cn(e),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadImages",i,t);return y(this.#e,o)}async uploadFile(e){let t=await xn(e),i=await this.#e.invokeTransferable("uploadFile",Z(t),t);return y(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(xn)),i=t.flatMap(Z),o=await this.#e.invokeTransferable("uploadFiles",i,t);return y(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}),a=C(o,this.#e);return c(be(a)),a}async addDetachedComponentLayers({url:e,layout:t,attributes:i}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:i}),a=C(o,this.#e);return c(wt(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,i){return cr(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return c(e,"Collection data must be defined"),new he(e,this.#e)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.#e.invoke("getManagedCollections");return c(e,"Collections data must be defined"),e.map(t=>new he(t,this.#e))}async getCollection(e){let t=await this.#e.invoke("getCollection",e);return t?new ne(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new ne(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new ne(t,this.#e))}notify=r((e,t)=>this.#e.notify(e,t),"notify");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 y(this.#e,e)}async getColorStyle(e){let t=await this.#e.invoke("getColorStyle",e);return t?y(this.#e,t):null}async createColorStyle(e){let t=await this.#e.invoke("createColorStyle",e);return y(this.#e,t)}subscribeToColorStyles(e){return this.#e.subscribe("colorStyles",t=>{let i=y(this.#e,t);return e(i)})}async getTextStyles(){let e=await this.#e.invoke("getTextStyles");return y(this.#e,e)}async getTextStyle(e){let t=await this.#e.invoke("getTextStyle",e);return t?y(this.#e,t):null}async createTextStyle(e){let t=await this.#e.invoke("createTextStyle",e);return y(this.#e,t)}subscribeToTextStyles(e){return this.#e.subscribe("textStyles",t=>{let i=y(this.#e,t);return e(i)})}async getFont(e,t){let i=await this.#e.invoke("getFont",e,t);return i?y(this.#e,i):null}async getFonts(){let e=await this.#e.invoke("getFonts");return y(this.#e,e)}getLocales(){return this.#e.invoke("getLocales")}getDefaultLocale(){return this.#e.invoke("getDefaultLocale")}getActiveLocale(){return this.#e.invoke("getActiveLocale")}async getLocalizationGroups(e){return this.#e.invoke("getLocalizationGroups",e)}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new Ie(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new Ie(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new Ie(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 Q(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new Q(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new Q(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 Q(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 Q(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=C(t,this.#e);return c(i instanceof $,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=C(t,this.#e);return c(i instanceof K,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new ne(t,this.#e)}async createManagedCollection(e){let t=await this.#e.invoke("createManagedCollection",e);return new he(t,this.#e)}async setCloseWarning(e){return this.#e.invoke("setCloseWarning",e)}get[l.initialState](){return this.#e.initialState}},Un=class extends Bn{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},Te=class extends Un{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async unstable_getDependencyVersion(e){return this.#e.invoke("unstable_getDependencyVersion",e)}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new Bt(t,this.#e)}async[l.getAiServiceInfo](e){return this.#e.invoke(mt,e)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(ft,e,t,i)}async[l.getCurrentUser](){return this.#e.invoke(yt)}async[l.getProjectInfo](){return this.#e.invoke(ht)}async[l.getHTMLForNode](e){return this.#e.invoke(ge,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(me,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=C(i,this.#e);return c(o instanceof re),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let i=C(t,this.#e);return c(i instanceof oe),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new nt(t,this.#e))}async createLocale(e){return this.#e.invoke("createLocale",e)}async getLocaleLanguages(){return this.#e.invoke("getLocaleLanguages")}async getLocaleRegions(e){return this.#e.invoke("getLocaleRegions",e)}async[V.publish](){return this.#e.invoke("publish")}async[V.getDeployments](){return this.#e.invoke("getDeployments")}async[V.deploy](e,t){return this.#e.invoke("deploy",e,t)}async[V.getChangedPaths](){return this.#e.invoke("getChangedPaths")}async[V.getChangeContributors](e,t){return this.#e.invoke("getChangeContributors",e,t)}async[V.createManagedCollection](e){return this.createManagedCollection(e)}[V.rejectAllPending](e){this.#e.rejectAllPending(e);}async[V.ping](){return this.#e.invoke("ping")}},Ut=class{static{r(this,"FramerAgentAPI");}#e;constructor(e){this.#e=e;}async getSystemPrompt(){return this.#e.invoke("getAgentSystemPrompt")}async getContext(e){return this.#e.invoke("getAgentContext",e)}async readProject(e,t){return this.#e.invoke("readProjectForAgent",e,t)}async readComponentControls(e,t){return this.#e.invoke("readComponentControlsForAgent",e,t)}async readIconSetControls(e,t){return this.#e.invoke("readIconSetControlsForAgent",e,t)}async readIcons(e,t){return this.#e.invoke("readIconsForAgent",e,t)}async readLayoutTemplateControls(e,t){return this.#e.invoke("readLayoutTemplateControlsForAgent",e,t)}async readShaderControls(e,t){return this.#e.invoke("readShaderControlsForAgent",e,t)}async applyChanges(e,t){return this.#e.invoke("applyAgentChanges",e,t)}async publish(e){return this.#e.invoke("publishForAgent",e)}async queryImages(e){return this.#e.invoke("queryImagesForAgent",e)}async reviewChanges(e){return this.#e.invoke("reviewChangesForAgent",e)}async flattenComponentInstance(e,t){return this.#e.invoke("flattenComponentInstanceForAgent",e,t)}async makeExternalComponentLocal(e,t){return this.#e.invoke("makeExternalComponentLocalForAgent",e,t)}async getNode(e,t){return this.#e.invoke("getNodeForAgent",e,t)}async getNodes(e,t){return this.#e.invoke("getNodesForAgent",e,t)}async getNodesOfTypes(e,t){return this.#e.invoke("getNodesOfTypesForAgent",e,t)}async getScopeNode(e,t){return this.#e.invoke("getScopeNodeForAgent",e,t)}async getGroundNode(e,t){return this.#e.invoke("getGroundNodeForAgent",e,t)}async getParentNode(e,t){return this.#e.invoke("getParentNodeForAgent",e,t)}async getAncestors(e,t){return this.#e.invoke("getAncestorsForAgent",e,t)}async serialize(e,t){return this.#e.invoke("serializeForAgent",e,t)}async serializeNodes(e,t){return this.#e.invoke("serializeNodesForAgent",e,t)}async paginate(e,t){return this.#e.invoke("paginateForAgent",e,t)}async startConversation(e,t){return this.#e.invoke("startAgentConversation",e,t)}async continueConversation(e,t){return this.#e.invoke("continueAgentConversation",e,t)}async submitClarification(e){return this.#e.invoke("submitAgentClarification",e)}async runSupervisorCommand(e){return this.#e.invoke("runSupervisorAgentCommand",e)}};var On=class{constructor(e){this.origin=e;}origin;static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function la(){return new Promise(n=>{function e({data:t,origin:i}){if(!sr(t))return;window.removeEventListener("message",e);let a={transport:new On(i),mode:t.mode,permissionMap:t.permissionMap,environmentInfo:t.environmentInfo,origin:i,theme:t.theme??null,initialState:t.initialState};n(a);}r(e,"handshakeListener"),window.addEventListener("message",e),window.parent.postMessage(or,"*");})}r(la,"createBrowserContext");async function da(){return typeof window>"u"||"Deno"in globalThis?null:la()}r(da,"bootstrap");var pr=await da(),ae=pr?new Te(new Ce(pr)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});var gr={};function ca(n){if(env)try{Object.assign(env,n);}catch{}Object.assign(gr,n);}r(ca,"configure");function Pe(n,e){let t=gr[n]??env[n];return t&&t.length>0?t:e}r(Pe,"getEnv");var mr=isWorkerd,Gn=globalThis.WebSocket;async function fr(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(fr,"connectWebSocketCF");async function yr(){try{return {fs:await import('fs'),path:await import('path')}}catch{return {}}}r(yr,"getNodeModules");var se=(v=>(v.PROJECT_CLOSED="PROJECT_CLOSED",v.POOL_EXHAUSTED="POOL_EXHAUSTED",v.TIMEOUT="TIMEOUT",v.INTERNAL="INTERNAL",v.NODE_NOT_FOUND="NODE_NOT_FOUND",v.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",v.SCREENSHOT_PREPARE_FAILED="SCREENSHOT_PREPARE_FAILED",v.EXPORT_SVG_FAILED="EXPORT_SVG_FAILED",v.INVALID_REQUEST="INVALID_REQUEST",v.INVALID_RELEASE_CHANNEL="INVALID_RELEASE_CHANNEL",v.UNAUTHORIZED="UNAUTHORIZED",v))(se||{}),D=class extends Error{static{r(this,"FramerAPIError");}code;ref;retryable;recentMethods;constructor(e,t,i){super(e),this.name="FramerAPIError",this.code=t,i?.ref!==void 0&&(this.ref=i.ref),this.retryable=i?.retryable??false,i?.recentMethods!==void 0&&(this.recentMethods=i.recentMethods),this.stack=void 0;}toString(){let e=super.toString();return this.ref?`${e} [ref: ${this.ref}]`:e}};function pa(n){return n instanceof D?n.code==="POOL_EXHAUSTED"||n.retryable:false}r(pa,"isRetryableError");var ga=new Map(Object.values(se).map(n=>[n,n]));function br(n){return typeof n=="string"?ga.get(n)??"INTERNAL":"INTERNAL"}r(br,"parseErrorCode");var ma={pluginMarshalTag:At};var Kn={silent:0,error:1,warn:2,info:3,debug:4};function fa(){let n=Pe("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in Kn?n:"warn"}r(fa,"getLogLevel");var $n=fa();function rt(n){return Kn[n]<=Kn[$n]}r(rt,"shouldLog");var ot=globalThis.console,ya="\x1B[90m",ha="\x1B[0m";function ba(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(ba,"formatPrefix");function xa(n,...e){return [ya+n,...e,ha]}r(xa,"formatDebug");function xr(n){let e=ba(n);return {warn:r((...t)=>{rt("warn")&&ot.warn(e,...t);},"warn"),error:r((...t)=>{rt("error")&&ot.error(e,...t);},"error"),log:r((...t)=>{rt("info")&&ot.log(e,...t);},"log"),info:r((...t)=>{rt("info")&&ot.info(e,...t);},"info"),debug:r((...t)=>{rt("debug")&&ot.debug(...xa(e,...t));},"debug"),setLevel:r(t=>{$n=t;},"setLevel"),getLevel:r(()=>$n,"getLevel"),withRequestId:r(t=>xr(t),"withRequestId")}}r(xr,"createLogger");var N=xr();N.warn;N.error;N.log;N.info;N.debug;N.setLevel;N.getLevel;var Ot="0.1.14";var Cr="wss://api.framer.com/channel/headless-plugin";function Se(n,...e){if(n)return;let t=Error("Assertion Error"+(e.length>0?": "+e.join(" "):""));if(t.stack)try{let i=t.stack.split(`
|
|
5
|
+
`));}catch{}throw t}r(p,"assert");function v(n){for(let e of Reflect.ownKeys(n)){let t=n[e];!t||typeof t!="object"&&!Xr(t)||v(t);}return Object.freeze(n)}r(v,"deepFreeze");function ii(n){return [n.slice(0,-1),n.at(-1)]}r(ii,"splitRestAndLast");var f="__class";var qt=Symbol(),Yt=Symbol(),Xt=Symbol(),Zt=Symbol(),Zr=Symbol(),Jr=Symbol(),Qr=Symbol(),eo=Symbol(),to=Symbol(),Jt=Symbol(),Qt=Symbol(),l={getAiServiceInfo:qt,sendTrackingEvent:Yt,getCurrentUser:Xt,getProjectInfo:Zt,environmentInfo:Zr,initialState:Jr,showUncheckedPermissionToasts:Qr,marshal:eo,unmarshal:to,getHTMLForNode:Jt,setHTMLForNode:Qt},pe="INTERNAL_",gt=`${pe}getAiServiceInfo`,mt=`${pe}sendTrackingEvent`,ft=`${pe}getCurrentUser`,yt=`${pe}getProjectInfo`,ge=`${pe}getHTMLForNode`,me=`${pe}setHTMLForNode`;var A=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(T(t))return null;let i=this.constructor;return new i(this.#e,t)}async remove(){await this.#e.invoke("removeVariables",this.nodeId,[this.id]);}},M="Variable";function L(n){let e=n.at(0);return p(!ti(e)),`${e.toLowerCase()}${n.slice(1,-M.length)}`}r(L,"classToType");var no=`Boolean${M}`,io=L(no),ke=class n extends A{static{r(this,"BooleanVariable");}type=io;#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}},ro=`Number${M}`,oo=L(ro),Ne=class n extends A{static{r(this,"NumberVariable");}type=oo;#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}},ao=`String${M}`,so=L(ao),Ae=class n extends A{static{r(this,"StringVariable");}type=so;#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}},lo=`FormattedText${M}`,co=L(lo),Ee=class n extends A{static{r(this,"FormattedTextVariable");}type=co;#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}},uo=`Enum${M}`,po=L(uo),Z=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);}},Me=class n extends A{static{r(this,"EnumVariable");}type=po;#e;#t;#n;get cases(){return this.#n||(this.#n=v(this.#t.cases.map(e=>new Z(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 Z(this.#e,this.nodeId,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.nodeId,this.id,e);}},go=`Color${M}`,mo=L(go),we=class n extends A{static{r(this,"ColorVariable");}type=mo;#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}},fo=`Image${M}`,yo=L(fo),Ve=class n extends A{static{r(this,"ImageVariable");}type=yo;#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}},ho=`File${M}`,bo=L(ho),Le=class n extends A{static{r(this,"FileVariable");}type=bo;#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}},Io=`Link${M}`,xo=L(Io),We=class n extends A{static{r(this,"LinkVariable");}type=xo;#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}},Co=`Date${M}`,To=L(Co),Re=class n extends A{static{r(this,"DateVariable");}type=To;#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}},Po=`Border${M}`,So=L(Po),Be=class n extends A{static{r(this,"BorderVariable");}type=So;#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}},Fo=`Unsupported${M}`,vo=L(Fo),Ue=class n extends A{static{r(this,"UnsupportedVariable");}type=vo;#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 ri(n){return n instanceof A}r(ri,"isVariable");function Do(n){return ri(n)&&n.nodeType==="component"}r(Do,"isComponentVariable");var U=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(p(ut(i)),T(i))return null;p(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]);}},B=class extends U{static{r(this,"FieldBaseWithRequired");}#e;get required(){return this.#e.required}constructor(e,t,i){super(e,t,i),this.#e=i;}},ht=class extends U{static{r(this,"BooleanField");}type=nn},bt=class extends U{static{r(this,"ColorField");}type=rn},It=class extends U{static{r(this,"NumberField");}type=on},xt=class extends B{static{r(this,"StringField");}type=an;#e;constructor(e,t,i){super(e,t,i),this.#e=i;}get basedOn(){return this.#e.basedOn}},Ct=class extends B{static{r(this,"FormattedTextField");}type=sn},Oe=class extends B{static{r(this,"ImageField");}type=ln},Tt=class extends B{static{r(this,"LinkField");}type=cn},Pt=class extends B{static{r(this,"DateField");}type=un;#e;get displayTime(){return this.#e.displayTime}constructor(e,t,i){super(e,t,i),this.#e=i;}},St=class extends U{static{r(this,"FieldDivider");}type=yn},ze=class extends U{static{r(this,"UnsupportedField");}type=hn},Ft=class extends B{static{r(this,"FileField");}type=pn;#e;get allowedFileTypes(){return this.#e.allowedFileTypes}constructor(e,t,i){super(e,t,i),this.#e=i;}},vt=class extends U{static{r(this,"EnumField");}type=gn;#e;#t;#n;#i;get cases(){return this.#i||(this.#i=this.#n.cases.map(e=>new Z(this.#e,this.#t,this.id,e)),v(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 Z(this.#e,this.#t,this.id,t):null}async setCaseOrder(e){await this.#e.invoke("setEnumCaseOrder",this.#t,this.id,e);}},Dt=class extends B{static{r(this,"CollectionReferenceField");}type=mn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},kt=class extends B{static{r(this,"MultiCollectionReferenceField");}type=fn;#e;get collectionId(){return this.#e.collectionId}constructor(e,t,i){super(e,t,i),this.#e=i;}},en=class extends B{static{r(this,"ArrayField");}type=dn;fields;constructor(e,t,i){super(e,t,i);let o=i.fields[0];this.fields=[new Oe(e,t,o)];}};function tn(n,e,t){return n.map(i=>{switch(i.type){case nn:return new ht(e,t,i);case rn:return new bt(e,t,i);case on:return new It(e,t,i);case an:return new xt(e,t,i);case sn:return new Ct(e,t,i);case ln:return new Oe(e,t,i);case cn:return new Tt(e,t,i);case un:return new Pt(e,t,i);case yn:return new St(e,t,i);case hn:return new ze(e,t,i);case pn:return new Ft(e,t,i);case gn:return new vt(e,t,i);case mn:return new Dt(e,t,i);case fn:return new kt(e,t,i);case dn:return new en(e,t,i);default:return new ze(e,t,i)}})}r(tn,"fieldDefinitionDataArrayToFieldClassInstances");function ko(n){return n instanceof U}r(ko,"isField");var oi="action";function No(n){return !!n&&oi in n&&h(n[oi])}r(No,"isLocalizedValueUpdate");function ai(n){return Object.keys(n).reduce((e,t)=>{let i=n[t];return No(i)&&(e[t]=i),e},{})}r(ai,"filterInlineLocalizationValues");var Ge=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 {[f]:"FileAsset",id:this.id,url:this.url,extension:this.extension}}};function Ao(n){return n instanceof Ge}r(Ao,"isFileAsset");var Eo="ImageAsset";function si(n){return k(n)?n[f]===Eo:false}r(si,"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 {[f]:"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,{[f]:"ImageAsset",id:this.id,url:this.url,thumbnailUrl:this.thumbnailUrl,altText:e??this.altText,resolution:t??this.resolution})}async measure(){return Vo(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 a=new Image;a.onload=()=>i(a),a.onerror=()=>o(),a.src=t;})}};function Mo(n){return n instanceof J}r(Mo,"isImageAsset");function Q(n){return n.type==="bytes"?[n.bytes.buffer]:[]}r(Q,"getTransferable");function wo(n){if(!k(n))return false;let e="bytes",t="mimeType";return !(!(e in n)||!(t in n)||!(n[e]instanceof Uint8Array)||!h(n[t]))}r(wo,"isBytesData");async function Ke(n){if(n instanceof File)return xn(n);let e=await li(n.image);return {name:n.name,altText:n.altText,resolution:n.resolution,preferredImageRendering:n.preferredImageRendering,...e}}r(Ke,"createImageTransferFromInput");async function bn(n){if(n instanceof File)return xn(n);let e=await li(n.file);return {name:n.name,...e}}r(bn,"createFileTransferFromInput");async function li(n){return n instanceof File?xn(n):wo(n)?{type:"bytes",mimeType:n.mimeType,bytes:n.bytes}:{type:"url",url:n}}r(li,"createAssetTransferFromAssetInput");function In(n){return Promise.all(n.map(Ke))}r(In,"createNamedAssetDataTransferFromInput");async function xn(n){return new Promise((e,t)=>{let i=new FileReader;i.onload=o=>{let a=n.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:n.name});},i.onerror=o=>{t(o);},i.readAsArrayBuffer(n);})}r(xn,"getAssetDataFromFile");async function Vo(n){let e=n instanceof File,t=e?URL.createObjectURL(n):n,i=new Image;return i.crossOrigin="anonymous",new Promise((o,a)=>{i.onload=()=>{o({width:i.naturalWidth,height:i.naturalHeight});},i.onerror=s=>{a(s);},i.src=t;}).finally(()=>{e&&URL.revokeObjectURL(t);})}r(Vo,"measureImage");var Nt=class{static{r(this,"ComputedValueBase");}};var Lo="unsupported",$e=class n extends Nt{static{r(this,"UnsupportedComputedValue");}type=Lo;#e;constructor(e){super(),this.#e=e;}static[l.unmarshal](e,t){return new n(t)}[l.marshal](){return this.#e}};function Wo(n){return n instanceof Nt}r(Wo,"isComputedValue");var Ro="Font";function ci(n){return k(n)&&n[f]===Ro}r(ci,"isFontData");function Bo(n){if(!X(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(Bo,"isFontWeight");function Uo(n){if(!h(n))return false;switch(n){case "normal":case "italic":return true;default:return false}}r(Uo,"isFontStyle");function ui(n){return k(n)?h(n.family)&&h(n.selector)&&Bo(n.weight)&&Uo(n.style):false}r(ui,"isFont");var K=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=di.get(t.selector);if(i)return i;let o=new n(t);return di.set(t.selector,o),o}[l.marshal](){return {[f]:"Font",selector:this.selector,family:this.family,weight:this.weight,style:this.style}}},di=new Map;var At="plugin-marshal";function Cn(n){return k(n)&&l.marshal in n}r(Cn,"isSelfMarshalable");function W(n){if(Cn(n))return n[l.marshal]();if(pt(n))return n.map(W);if(ve(n)){let e={};for(let t of Object.keys(n))e[t]=W(n[t]);return e}return n}r(W,"marshal");var Oo="LinearGradient",zo="RadialGradient",Go="ConicGradient",fe=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})}},je=class n extends fe{static{r(this,"LinearGradient");}[f]=Oo;#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 W({...this.#e,[f]:this[f]})}toCSS(){let e=this.#e.stops.map(t=>(p(h(t.color),"ColorStyle not supported yet"),`${t.color} ${t.position*100}%`)).join(", ");return `linear-gradient(${this.angle}deg, ${e})`}},He=class n extends fe{static{r(this,"RadialGradient");}[f]=zo;#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 W({...this.#e,[f]:this[f]})}toCSS(){let e=this.stops.map((t,i)=>{p(h(t.color),"ColorStyle not supported yet");let o=this.stops[i+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})`}},_e=class n extends fe{static{r(this,"ConicGradient");}[f]=Go;#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 W({...this.#e,[f]:this[f]})}toCSS(){let e=this.stops.map(t=>(p(h(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 pi(n){return n instanceof fe}r(pi,"isGradient");var Ko="ColorStyle";function Et(n){return k(n)?n[f]===Ko:false}r(Et,"isColorStyleData");var ie=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 {[f]:"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 ye(n){return n instanceof ie}r(ye,"isColorStyle");var $o="TextStyle";function gi(n){return k(n)?n[f]===$o:false}r(gi,"isTextStyleData");var qe=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=K[l.unmarshal](e,t.font),this.boldFont=t.boldFont&&K[l.unmarshal](e,t.boldFont),this.italicFont=t.italicFont&&K[l.unmarshal](e,t.italicFont),this.boldItalicFont=t.boldItalicFont&&K[l.unmarshal](e,t.boldItalicFont),this.color=Et(t.color)?ie[l.unmarshal](e,t.color):t.color,this.transform=t.transform,this.alignment=t.alignment,this.decoration=t.decoration,this.decorationColor=Et(t.decorationColor)?ie[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 {[f]:"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:ye(this.color)?this.color[l.marshal]():this.color,transform:this.transform,alignment:this.alignment,decoration:this.decoration,decorationColor:ye(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 Tn(n){return n instanceof qe}r(Tn,"isTextStyle");var mi={ColorStyle:ie,ConicGradient:_e,FileAsset:Ge,Font:K,ImageAsset:J,LinearGradient:je,RadialGradient:He,TextStyle:qe,BooleanVariable:ke,BorderVariable:Be,ColorVariable:we,DateVariable:Re,EnumVariable:Me,FileVariable:Le,FormattedTextVariable:Ee,ImageVariable:Ve,LinkVariable:We,NumberVariable:Ne,StringVariable:Ae,UnsupportedVariable:Ue,UnsupportedComputedValue:$e};function jo(n){return ve(n)&&h(n[f])&&n[f]in mi}r(jo,"isSelfUnmarshalable");function b(n,e){if(jo(e))return mi[e[f]][l.unmarshal](n,e);if(pt(e))return e.map(t=>b(n,t));if(ve(e)){let t={};for(let i of Object.keys(e))t[i]=b(n,e[i]);return t}return e}r(b,"unmarshal");var Ho={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 _o(n){return Ho[n]}r(_o,"isSupportedArrayItemFieldType");function qo(n){return _o(n.type)}r(qo,"isSupportedArrayItemFieldDataEntry");var nn="boolean",rn="color",on="number",an="string",sn="formattedText",ln="image",dn="array",cn="link",un="date",pn="file",gn="enum",mn="collectionReference",fn="multiCollectionReference",yn="divider",hn="unsupported";function Yo(n){return n.map(e=>{if(e.type!=="enum")return e;let t=e.cases.map(i=>{let o=i.nameByLocale?ai(i.nameByLocale):void 0;return {...i,nameByLocale:o}});return {...e,cases:t}})}r(Yo,"sanitizeEnumFieldForMessage");function fi(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 a=o.value.map(s=>{let d=fi(s.fieldData,e),P={};for(let g in d){let I=d[g];p(I&&qo(I),"Unsupported array item field data entry"),P[g]=I;}return {...s,fieldData:P}});t[i]={...o,value:a};}return t}r(fi,"deserializeFieldData");var he=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,p(e.managedBy!=="user","Managed Collection can only be managed by a plugin"),this.managedBy=e.managedBy,this.#e=t,v(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=Yo(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)}},re=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,v(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 tn(e,this.#e,this.id)}async addFields(e){let t=await this.#e.invoke("addCollectionFields2",this.id,e);return p(t.every(ni)),tn(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 Ye(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)}},Ye=class n{static{r(this,"CollectionItem");}id;nodeId;slug;slugByLocale;draft;fieldData;#e;constructor(e,t){let i=fi(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,v(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 Xo={fixed:true,sticky:true,absolute:true,relative:true},yi="position";function cl(n){if(!(yi in n))return false;let e=n[yi];return h(e)&&Xo[e]===true}r(cl,"supportsPosition");var hi="top";function ul(n){if(!(hi in n))return false;let e=n[hi];return h(e)||T(e)}r(ul,"supportsPins");var bi="width";function pl(n){if(!(bi in n))return false;let e=n[bi];return h(e)||T(e)}r(pl,"supportsSize");var Ii="maxWidth";function gl(n){if(!(Ii in n))return false;let e=n[Ii];return h(e)||T(e)}r(gl,"supportsSizeConstraints");var xi="aspectRatio";function ml(n){if(!(xi in n))return false;let e=n[xi];return X(e)||T(e)}r(ml,"supportsAspectRatio");var Ci="name";function fl(n){if(!(Ci in n))return false;let e=n[Ci];return h(e)||T(e)}r(fl,"supportsName");var Ti="visible";function yl(n){if(!(Ti in n))return false;let e=n[Ti];return Fe(e)}r(yl,"supportsVisible");var Pi="locked";function hl(n){if(!(Pi in n))return false;let e=n[Pi];return Fe(e)}r(hl,"supportsLocked");var Si="backgroundColor";function bl(n){if(!(Si in n))return false;let e=n[Si];return h(e)||ye(e)||T(e)}r(bl,"supportsBackgroundColor");var Fi="backgroundColor";function Il(n){if(!(Fi in n))return false;let e=n[Fi];return h(e)||Et(e)||T(e)}r(Il,"supportsBackgroundColorData");var vi="backgroundImage";function xl(n){if(!(vi in n))return false;let e=n[vi];return e instanceof J||T(e)}r(xl,"supportsBackgroundImage");var Di="backgroundImage";function Cl(n){if(!(Di in n))return false;let e=n[Di];return e instanceof J?false:si(e)||T(e)}r(Cl,"supportsBackgroundImageData");var ki="backgroundGradient";function Tl(n){if(!(ki in n))return false;let e=n[ki];return pi(e)||T(e)}r(Tl,"supportsBackgroundGradient");var Ni="backgroundGradient";function Pl(n){if(!(Ni in n))return false;let e=n[Ni];return k(e)||T(e)}r(Pl,"supportsBackgroundGradientData");var Ai="rotation";function Sl(n){if(!(Ai in n))return false;let e=n[Ai];return X(e)}r(Sl,"supportsRotation");var Ei="opacity";function Fl(n){if(!(Ei in n))return false;let e=n[Ei];return X(e)}r(Fl,"supportsOpacity");var Mi="borderRadius";function vl(n){if(!(Mi in n))return false;let e=n[Mi];return h(e)||T(e)}r(vl,"supportsBorderRadius");var wi="border";function Dl(n){if(!(wi in n))return false;let e=n[wi];return T(e)||ye(e.color)}r(Dl,"supportsBorder");var Vi="svg";function kl(n){if(!(Vi in n))return false;let e=n[Vi];return h(e)}r(kl,"supportsSVG");var Li="textTruncation";function Nl(n){if(!(Li in n))return false;let e=n[Li];return X(e)||T(e)}r(Nl,"supportsTextTruncation");var Wi="zIndex";function Al(n){if(!(Wi in n))return false;let e=n[Wi];return X(e)||T(e)}r(Al,"supportsZIndex");var Ri="overflow";function El(n){if(!(Ri in n))return false;let e=n[Ri];return h(e)||T(e)}r(El,"supportsOverflow");var Bi="componentIdentifier";function Ml(n){if(!(Bi in n))return false;let e=n[Bi];return h(e)}r(Ml,"supportsComponentInfo");var Ui="font";function wl(n){if(!(Ui in n))return false;let e=n[Ui];return ui(e)}r(wl,"supportsFont");var Oi="font";function Vl(n){if(!(Oi in n))return false;let e=n[Oi];return ci(e)||T(e)}r(Vl,"supportsFontData");var zi="inlineTextStyle";function Ll(n){if(!(zi in n))return false;let e=n[zi];return Tn(e)||T(e)}r(Ll,"supportsInlineTextStyle");var Gi="inlineTextStyle";function Wl(n){if(!(Gi in n))return false;let e=n[Gi];return gi(e)||T(e)}r(Wl,"supportsInlineTextStyleData");var Ki="link";function Rl(n){if(!(Ki in n))return false;let e=n[Ki];return h(e)||T(e)}r(Rl,"supportsLink");var $i="imageRendering";function Bl(n){if(!($i in n))return false;let e=n[$i];return h(e)||T(e)}r(Bl,"supportsImageRendering");var ji="layout";function qi(n){if(!(ji in n))return false;let e=n[ji];return h(e)||T(e)}r(qi,"supportsLayout");function Ul(n){return qi(n)?n.layout==="stack":false}r(Ul,"hasStackLayout");function Ol(n){return qi(n)?n.layout==="grid":false}r(Ol,"hasGridLayout");var Hi="isVariant";function Yi(n){if(!(Hi in n))return false;let e=n[Hi];return Fe(e)}r(Yi,"supportsComponentVariant");function Pn(n){return Yi(n)?n.isVariant:false}r(Pn,"isComponentVariant");function Xi(n){return !Yi(n)||!Pn(n)?false:!T(n.gesture)}r(Xi,"isComponentGestureVariant");var _i="isBreakpoint";function Zo(n){if(!(_i in n))return false;let e=n[_i];return Fe(e)}r(Zo,"supportsBreakpoint");function Zi(n){return Zo(n)?n.isBreakpoint:false}r(Zi,"isBreakpoint");var R=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(){return this.#e.cloneNode(this.id)}async setAttributes(e){if(this[f]==="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 oe(this)?Promise.resolve([]):this.#e.getChildren(this.id)}async getNodesWithType(e){return oe(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithType",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttribute(e){return oe(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttribute",this.id,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return oe(this)?Promise.resolve([]):(await this.#e.invoke("getNodesWithAttributeSet",this.id,e)).map(i=>C(i,this.#e))}async*walk(){if(yield this,!oe(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)}},O=class extends R{static{r(this,"FrameNode");}[f]="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;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;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.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??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,v(this);}},ae=class extends R{static{r(this,"TextNode");}[f]="TextNode";name;visible;locked;rotation;opacity;zIndex;font;inlineTextStyle;position;top;right;bottom;left;centerX;centerY;width;height;maxWidth;minWidth;maxHeight;minHeight;link;linkOpenInNewTab;linkSmoothScroll;linkClickTrackingId;linkRelValues;linkPreserveParams;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.linkSmoothScroll=e.linkSmoothScroll??null,this.linkClickTrackingId=e.linkClickTrackingId??null,this.linkRelValues=e.linkRelValues??null,this.linkPreserveParams=e.linkPreserveParams??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,v(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(me,this.id,e),await new Promise(t=>{setTimeout(t,30);});}async getHTML(){return this.#e.invoke(ge,this.id)}},Xe=class extends R{static{r(this,"SVGNode");}[f]="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,v(this);}},Ze=class extends R{static{r(this,"VectorSetItemNode");}[f]="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,v(this);}async getSVG(){return this.#e.invoke("getSVGForNode",this.id)}},Je=class extends R{static{r(this,"ComponentInstanceNode");}[f]="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,v(this);}async getRuntimeError(){return this.#e.invoke("getRuntimeErrorForCodeComponentNode",this.id)}},$=class extends R{static{r(this,"WebPageNode");}[f]="WebPageNode";#e;path;collectionId;constructor(e,t){super(e,t),this.path=e.path??null,this.collectionId=e.collectionId??null,this.#e=t,v(this);}async clone(e){return this.#e.cloneWebPage(this.id,e)}getBreakpointSuggestions(){return this.#e.invoke("getBreakpointSuggestionsForWebPage",this.id)}async addBreakpoint(e,t){let i=await this.#e.invoke("addBreakpointToWebPage",this.id,e,t),o=C(i,this.#e);return p(o instanceof O),p(Zi(o),"Expected node to be a FrameNode"),o}async getActiveCollectionItem(){let e=await this.#e.invoke("getActiveCollectionItemForWebPage",this.id);return e?new Ye(e,this.#e):null}},se=class extends R{static{r(this,"ComponentNode");}[f]="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,v(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=C(i,this.#e);return p(o instanceof O),p(Pn(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 a=C(o,this.#e);return p(a instanceof O),p(Xi(a),"Node is not a gesture variant"),a}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,W(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);}},Qe=class extends R{static{r(this,"VectorSetNode");}[f]="VectorSetNode";name;constructor(e,t){super(e,t),this.name=e.name??null,v(this);}},j=class extends R{static{r(this,"DesignPageNode");}[f]="DesignPageNode";name;#e;constructor(e,t){super(e,t),this.#e=t,this.name=e.name??null,v(this);}async clone(e){return this.#e.cloneDesignPage(this.id,e)}},et=class extends R{static{r(this,"UnknownNode");}[f]="UnknownNode";constructor(e,t){super(e,t),v(this);}async clone(){throw new Error("Cannot clone an unknown node")}};function C(n,e){switch(n[f]){case "DesignPageNode":return new j(n,e);case "WebPageNode":return new $(n,e);case "ComponentNode":return new se(n,e);case "VectorSetNode":return new Qe(n,e);case "VectorSetItemNode":return new Ze(n,e);case "ComponentInstanceNode":return new Je(n,e);case "FrameNode":return new O(n,e);case "SVGNode":return new Xe(n,e);case "TextNode":return new ae(n,e);case "UnknownNode":return new et(n,e);default:return new et(n,e)}}r(C,"convertRawNodeDataToNode");function Mt(n){return n instanceof O}r(Mt,"isFrameNode");function Ji(n){return n instanceof ae}r(Ji,"isTextNode");function Qi(n){return n instanceof Xe}r(Qi,"isSVGNode");function be(n){return n instanceof Je}r(be,"isComponentInstanceNode");function er(n){return n instanceof $}r(er,"isWebPageNode");function tr(n){return n instanceof se}r(tr,"isComponentNode");function nr(n){return n instanceof j}r(nr,"isDesignPageNode");function ir(n){return n instanceof Qe}r(ir,"isVectorSetNode");function rr(n){return n instanceof Ze}r(rr,"isVectorSetItemNode");function oe(n){return n instanceof et}r(oe,"isUnknownNode");function tt(n){return !!(Mt(n)||Ji(n)||be(n)||Qi(n)||rr(n)||oe(n))}r(tt,"isCanvasNode");function Sn(n){return !!(er(n)||nr(n)||tr(n)||ir(n)||oe(n))}r(Sn,"isCanvasRootNode");var nt=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 wt(t,this.#e))}},wt=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 it=class extends Error{static{r(this,"FramerPluginError");}name=this.constructor.name},ee=class extends Error{static{r(this,"FramerPluginClosedError");}name=this.constructor.name};function Jo(n){return n.type==="separator"}r(Jo,"isSeparatorMenuItem");function Vt(n,e){let t=[];for(let i of n){if(Jo(i)){t.push(i);continue}let{onAction:o,...a}=i,s=a;if(i.onAction){let d=Math.random();e.set(d,i.onAction),s.actionId=d;}i.submenu&&(s.submenu=Vt(i.submenu,e)),t.push(s);}return t}r(Vt,"addMenuItemsToOnActionCallbackMap");var Lt="type",or={[Lt]:"pluginReadySignal"},ea="pluginReadyResponse";var ta={methodResponse:true,subscriptionMessage:true,permissionUpdate:true,menuAction:true};function ar(n){return k(n)&&h(n[Lt])&&n[Lt]in ta}r(ar,"isVekterToPluginNonHandshakeMessage");function sr(n){return k(n)&&n[Lt]===ea}r(sr,"isPluginReadyResponse");var Fn=Symbol(),vn=Symbol(),Dn=Symbol(),kn=Symbol(),Nn=Symbol(),An=Symbol(),En=Symbol(),Mn=Symbol(),w={ping:Mn,publish:Fn,getDeployments:vn,deploy:Dn,getChangedPaths:kn,getChangeContributors:Nn,createManagedCollection:An,rejectAllPending:En};function wn(n){return typeof n=="string"&&n in w}r(wn,"isFramerApiOnlyMethod");var na=["unstable_getCodeFile","unstable_getCodeFiles","unstable_getCodeFileVersionContent","unstable_getCodeFileLint2","unstable_getCodeFileTypecheck2","unstable_getCodeFileVersions","lintCode"],ia=["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","getLocaleLanguages","getLocaleRegions","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","unstable_getDependencyVersion","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","readProjectForAgent","readComponentControlsForAgent","readIconSetControlsForAgent","readIconsForAgent","readLayoutTemplateControlsForAgent","readShaderControlsForAgent","getAgentSystemPrompt","getAgentContext","getActiveBranchForAgent","getBranchesForAgent","getBranchChangesForAgent","ping","queryImagesForAgent","reviewChangesForAgent","getNodeForAgent","getNodesForAgent","getNodesOfTypesForAgent","getScopeNodeForAgent","getGroundNodeForAgent","getParentNodeForAgent","getAncestorsForAgent","paginateForAgent","serializeForAgent","serializeNodesForAgent",gt,mt,ft,yt,ge,"getAiServiceInfo","sendTrackingEvent",...na];new Set(ia);var Vn={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"],createLocale:["createLocale"],getLocaleLanguages:[],getLocaleRegions:[],setMenu:[],showContextMenu:[],setParent:["setParent"],setPluginData:["setPluginData"],setSelection:[],setText:["setText"],typecheckCode:[],showUI:[],subscribeToCanvasRoot:[],subscribeToColorStyles:[],subscribeToCustomCode:[],subscribeToImage:[],subscribeToPublishInfo:[],subscribeToSelection:[],subscribeToText:[],subscribeToTextStyles:[],createCodeFile:["createCodeFile"],unstable_getDependencyVersion:[],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","cloneWebPage","cloneDesignPage"],"WebPageNode.clone":["cloneWebPage"],"DesignPageNode.clone":["cloneDesignPage"],"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":[me],"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"],[qt]:[],[Yt]:[],[Xt]:[],[Zt]:[],[Jt]:[],[Qt]:[],[Fn]:["publish"],[vn]:[],[Dn]:["deploy"],[kn]:[],[Nn]:[],[An]:["createManagedCollection"],[En]:[],[Mn]:[]},Wt=[];for(let n of Object.keys(Vn))Vn[n].length!==0&&Wt.push(n);v(Wt);function Ln(n){let e={};for(let t of Wt){let i=Vn[t];e[t]=i.every(o=>n[o]);}return e}r(Ln,"createPerMethodPermissionMap");function lr(){let n={};for(let e of Wt)n[e]=true;return n}r(lr,"createPerMethodPermissionMapForTesting");var Ie=null;function dr(n){if(typeof window>"u")return;if(!Ie){let t=document.createElement("style");document.head.appendChild(t),Ie=t.sheet;}if(!Ie){n();return}let e=Ie.insertRule("* { transition: none !important; animation: none !important; }");n(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ie&&Ie.deleteRule(e);});});}r(dr,"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=lr(),this.initialState={mode:"canvas",intent:"plugin/open"};return}switch(e.transport.onMessage(this.onMessage),typeof window<"u"&&(window.addEventListener("error",t=>{t.error instanceof ee&&(t.preventDefault(),t.stopImmediatePropagation());}),window.addEventListener("unhandledrejection",t=>{t.reason instanceof ee&&(t.preventDefault(),t.stopImmediatePropagation());})),this.mode=e.mode,this.initialState=e.initialState??{mode:e.mode,intent:"plugin/open"},this.environmentInfo=e.environmentInfo,this.perMethodPermissionMap=Ln(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),this.applyPrereleaseStyles();break;case "api":break;default:De(this.mode);}}async invoke(e,...t){return this.invokeTransferable(e,void 0,...t)}async invokeTransferable(e,t,...i){return new Promise((a,s)=>{let d={type:"methodInvocation",methodName:e,id:this.methodInvocationId,args:i.map(W)};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 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=r(e=>{let t=e?.data??e;if(ar(t))switch(t.type){case "permissionUpdate":{this.perMethodPermissionMap=Ln(t.permissionMap);for(let i of this.permissionSubscriptions)i();break}case "methodResponse":{let i=this.methodResponseHandlers.get(t.id);if(!i){switch(this.mode){case "canvas":case "image":case "editImage":case "configureManagedCollection":case "syncManagedCollection":case "collection":case "localization":case "code":throw new Error(`No handler for response with id ${t.id}`);case "api":{if(!(t.id<this.methodInvocationId))throw new Error(`No handler for unknown response id ${t.id}`);break}default:De(this.mode);}break}this.methodResponseHandlers.delete(t.id),h(t.error)?i.reject(new it(t.error)):i.resolve(t.result);break}case "subscriptionMessage":{let{topic:i,payload:o}=t,a=this.subscriptions.get(i);if(!a)throw new Error("Received a subscription message but no handler present");for(let s of a)s(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:De(t);}},"onMessage");getOnActionFromCallbackMap(e,t){switch(t){case "pluginMenu":return this.menuItemOnActionCallbackMap.get(e);case "contextMenu":return this.contextMenuItemOnActionCallbackMap.get(e);default:De(t);}}applyPluginTheme=r(e=>{dr(()=>{document.body.setAttribute("data-framer-theme",e.mode);for(let t in e.tokens)document.body.style.setProperty(t,e.tokens[t]);});},"applyPluginTheme");applyPrereleaseStyles(){typeof window>"u"||new URLSearchParams(window.location.search).get("styles")==="prerelease"&&document.body.setAttribute("data-framer-styles","prerelease");}async cloneNode(e){let t=await this.invoke("cloneNode",e);return t?C(t,this):null}async cloneWebPage(e,t){let i=await this.invoke("cloneWebPage",e,t);p(i,"Expected to receive data for cloned web page");let o=C(i,this);return p(o instanceof $,"Expected cloned node to be an instance of WebPageNode"),o}async cloneDesignPage(e,t){let i=await this.invoke("cloneDesignPage",e,t);p(i,"Expected to receive data for cloned design page");let o=C(i,this);return p(o instanceof j,"Expected cloned node to be an instance of DesignPageNode"),o}async setAttributes(e,t){let i=await this.invoke("setAttributes",e,t);return i?C(i,this):null}async getParent(e){let t=await this.invoke("getParent",e);return t?C(t,this):null}async getChildren(e){return (await this.invoke("getChildren",e)).map(i=>{let o=C(i,this);return p(tt(o)),o})}notify=r((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:r(()=>this.invoke("closeNotification",i),"close")}},"notify");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 i=Vt(e,this.contextMenuItemOnActionCallbackMap);await this.invoke("showContextMenu",i,t);}};function ra(n){return n.type==="component"}r(ra,"isCodeFileComponentExport");function oa(n){return n.type==="override"}r(oa,"isCodeFileOverrideExport");var Wn=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)}},te=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 Wn(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 Rt=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=C(i,this.#t);return p(be(o)),o}};var aa=(()=>{let n=null;return {disableUntilMouseUp:r(()=>{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(a=>{a.buttons>0&&a.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");},"disableUntilMouseUp")}})(),cr=5,sa=(()=>{let n=1;return {next:r(()=>`drag-${n++}`,"next")}})();function la(){}r(la,"noop");function ur(n,e,t,i){if(n.mode!=="canvas")return la;let o=sa.next(),a=document.body.style.cursor,s={type:"idle"},d=document.body,P=le.subscribeToIsAllowedTo("makeDraggable",u=>{u||S();}),g=r(u=>{le.isAllowedTo("makeDraggable")&&s.type!=="idle"&&(s.type==="dragging"&&n.invoke("onDragEnd",{...u,dragSessionId:o}).then(m=>{try{i?.(m);}catch{}}).catch(m=>{if(m instanceof Error){i?.({status:"error",reason:m.message});return}if(typeof m=="string"){i?.({status:"error",reason:m});return}i?.({status:"error"});}),S());},"endDrag"),I=r(u=>{if(!le.isAllowedTo("makeDraggable")||s.type==="idle")return;if(!(u.buttons>0&&!!(u.buttons&1))){g({cancelled:false});return}let{clientX:V,clientY:G}=u;if(s.type==="pointerDown"){let Y=V-s.dragStart.mouse.x,E=G-s.dragStart.mouse.y;if(Math.abs(Y)<cr&&Math.abs(E)<cr)return;s={type:"dragging",dragStart:s.dragStart},n.invoke("onDragStart",s.dragStart),document.getSelection()?.empty(),aa.disableUntilMouseUp();}d.setPointerCapture(u.pointerId);let q={x:V,y:G};n.invoke("onDrag",{dragSessionId:o,mouse:q}).then(Y=>{s.type==="dragging"&&(document.body.style.cursor=Y??"");});},"handlePointerChange"),F=r(u=>{u.key==="Escape"&&g({cancelled:true});},"handleKeyDown"),z=r(()=>{g({cancelled:true});},"handleBlur"),y=r(u=>{if(!le.isAllowedTo("makeDraggable"))return;g({cancelled:true});let m=e.getBoundingClientRect(),V={x:m.x,y:m.y,width:m.width,height:m.height},G,q=e.querySelectorAll("svg");if(q.length===1){let x=q.item(0).getBoundingClientRect();G={x:x.x,y:x.y,width:x.width,height:x.height};}let Y={x:u.clientX,y:u.clientY};s={type:"pointerDown",dragStart:{dragSessionId:o,elementRect:V,svgRect:G,mouse:Y}},n.invoke("setDragData",o,t()),d.addEventListener("pointermove",I,true),d.addEventListener("pointerup",I,true),window.addEventListener("keydown",F,true),window.addEventListener("blur",z);},"handlePointerDown"),c=r(()=>{if(!le.isAllowedTo("makeDraggable"))return;let u=t();u.type==="detachedComponentLayers"&&n.invoke("preloadDetachedComponentLayers",u.url),u.type==="image"&&n.invoke("preloadImageUrlForInsertion",u.image),u.previewImage&&n.invoke("preloadDragPreviewImage",u.previewImage);},"preload");e.addEventListener("pointerdown",y),e.addEventListener("mouseenter",c);function S(){s={type:"idle"},document.body.style.cursor=a,d.removeEventListener("pointermove",I,true),d.removeEventListener("pointerup",I,true),window.removeEventListener("keydown",F,true),window.removeEventListener("blur",z);}return r(S,"dragCleanup"),()=>{e.removeEventListener("pointerdown",y),e.removeEventListener("mouseenter",c),g({cancelled:true}),P();}}r(ur,"makeDraggable");var Ce=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 p(ut(i)),T(i)?null:new n(i,this.#t)}};var Rn=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]=ii(e),o=this.isAllowedTo(...t),a=r(()=>{let s=this.isAllowedTo(...t);s!==o&&(o=s,i(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 ee}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=C(t,this.#e);return p(tt(i)),i})}async setSelection(e){let t=h(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 a=C(o,this.#e);return p(tt(a)),a});e(i);})}async getCanvasRoot(){let e=await this.#e.invoke("getCanvasRoot"),t=C(e,this.#e);return p(Sn(t)),t}subscribeToCanvasRoot(e){return this.#e.subscribe("canvasRoot",t=>{let i=C(t,this.#e);p(Sn(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=C(i,this.#e);return p(o instanceof O),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?C(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=h(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=>C(i,this.#e))}async getNodesWithAttribute(e){return (await this.#e.invoke("getNodesWithAttribute",null,e)).map(i=>C(i,this.#e))}async getNodesWithAttributeSet(e){return (await this.#e.invoke("getNodesWithAttributeSet",null,e)).map(i=>C(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 Ke(e),i=Q(t);return this.#e.invokeTransferable("addImage",i,t)}async setImage(e){let t=await Ke(e),i=Q(t);return this.#e.invokeTransferable("setImage",i,t)}async uploadImage(e){let t=await Ke(e),i=Q(t),o=await this.#e.invokeTransferable("uploadImage",i,t);return b(this.#e,o)}async addImages(e){let t=await In(e),i=t.flatMap(Q);await this.#e.invokeTransferable("addImages",i,t);}async uploadImages(e){let t=await In(e),i=t.flatMap(Q),o=await this.#e.invokeTransferable("uploadImages",i,t);return b(this.#e,o)}async uploadFile(e){let t=await bn(e),i=await this.#e.invokeTransferable("uploadFile",Q(t),t);return b(this.#e,i)}async uploadFiles(e){let t=await Promise.all(e.map(bn)),i=t.flatMap(Q),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}),a=C(o,this.#e);return p(be(a)),a}async addDetachedComponentLayers({url:e,layout:t,attributes:i}){let o=await this.#e.invoke("addDetachedComponentLayers",{url:e,layout:t,attributes:i}),a=C(o,this.#e);return p(Mt(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,i){return ur(this.#e,e,t,i)}async getActiveManagedCollection(){let e=await this.#e.invoke("getActiveManagedCollection");return p(e,"Collection data must be defined"),new he(e,this.#e)}async getManagedCollection(){return this.getActiveManagedCollection()}async getManagedCollections(){let e=await this.#e.invoke("getManagedCollections");return p(e,"Collections data must be defined"),e.map(t=>new he(t,this.#e))}async getCollection(e){let t=await this.#e.invoke("getCollection",e);return t?new re(t,this.#e):null}async getActiveCollection(){let e=await this.#e.invoke("getActiveCollection");return e?new re(e,this.#e):null}async getCollections(){return (await this.#e.invoke("getCollections")).map(t=>new re(t,this.#e))}notify=r((e,t)=>this.#e.notify(e,t),"notify");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(e){return this.#e.invoke("getLocalizationGroups",e)}setLocalizationData(e){return this.#e.invoke("setLocalizationData",e)}async getRedirects(){return (await this.#e.invoke("getRedirects")).map(t=>new Ce(t,this.#e))}subscribeToRedirects(e){return this.#e.subscribe("redirects",t=>{let i=t.map(o=>new Ce(o,this.#e));return e(i)})}async addRedirects(e){return (await this.#e.invoke("addRedirects",e)).map(i=>new Ce(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 te(o,this.#e)}async getCodeFiles(){let e=await this.#e.invoke("getCodeFiles"),t=[];for(let i of e)t.push(new te(i,this.#e));return t}async getCodeFile(e){let t=await this.#e.invoke("getCodeFile",e);return t?new te(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 te(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 te(t,this.#e):null;return e(i)})}async createDesignPage(e){let t=await this.#e.invoke("createDesignPage",e),i=C(t,this.#e);return p(i instanceof j,"Expected node to be a DesignPageNode"),i}async createWebPage(e){let t=await this.#e.invoke("createWebPage",e),i=C(t,this.#e);return p(i instanceof $,"Expected node to be a WebPageNode"),i}async createCollection(e){let t=await this.#e.invoke("createCollection",e);return new re(t,this.#e)}async createManagedCollection(e){let t=await this.#e.invoke("createManagedCollection",e);return new he(t,this.#e)}async setCloseWarning(e){return this.#e.invoke("setCloseWarning",e)}get[l.initialState](){return this.#e.initialState}},Bn=class extends Rn{static{r(this,"FramerPluginAPIBeta");}#e;constructor(e){super(e),this.#e=e,this.#e;}},Te=class extends Bn{static{r(this,"FramerPluginAPIAlpha");}#e;constructor(e){super(e),this.#e=e,this.#e;}async unstable_getDependencyVersion(e){return this.#e.invoke("unstable_getDependencyVersion",e)}async addComponentInstancePlaceholder(e){let t=await this.#e.invoke("addComponentInstancePlaceholder",e);return new Rt(t,this.#e)}async[l.getAiServiceInfo](e){return this.#e.invoke(gt,e)}async[l.sendTrackingEvent](e,t,i){return this.#e.invoke(mt,e,t,i)}async[l.getCurrentUser](){return this.#e.invoke(ft)}async[l.getProjectInfo](){return this.#e.invoke(yt)}async[l.getHTMLForNode](e){return this.#e.invoke(ge,e)}async[l.setHTMLForNode](e,t){return this.#e.invoke(me,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=C(i,this.#e);return p(o instanceof ae),o}async createComponentNode(e){let t=await this.#e.invoke("createNode","ComponentNode",null,{name:e});if(!t)return null;let i=C(t,this.#e);return p(i instanceof se),i}async getVectorSets(){return (await this.#e.invoke("getVectorSets")).map(t=>new nt(t,this.#e))}async createLocale(e){return this.#e.invoke("createLocale",e)}async getLocaleLanguages(){return this.#e.invoke("getLocaleLanguages")}async getLocaleRegions(e){return this.#e.invoke("getLocaleRegions",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);}async[w.ping](){return this.#e.invoke("ping")}},Bt=class{static{r(this,"FramerAgentAPI");}#e;constructor(e){this.#e=e;}async getSystemPrompt(){return this.#e.invoke("getAgentSystemPrompt")}async getContext(){return this.#e.invoke("getAgentContext")}async getActiveBranch(){return this.#e.invoke("getActiveBranchForAgent")}async getBranches(){return this.#e.invoke("getBranchesForAgent")}async getBranchChanges(e){return this.#e.invoke("getBranchChangesForAgent",e)}async switchBranch(e){return this.#e.invoke("switchBranchForAgent",e)}async createBranch(e){return this.#e.invoke("createBranchForAgent",e)}async mergeBranch(e){return this.#e.invoke("mergeBranchForAgent",e)}async joinBranch(e){return this.#e.invoke("joinBranchForAgent",e)}async leaveBranch(e){return this.#e.invoke("leaveBranchForAgent",e)}async renameBranch(e,t){return this.#e.invoke("renameBranchForAgent",e,t)}async deleteBranch(e){return this.#e.invoke("deleteBranchForAgent",e)}async readProject(e,t){return this.#e.invoke("readProjectForAgent",e,t)}async readComponentControls(e){return this.#e.invoke("readComponentControlsForAgent",e)}async readIconSetControls(e){return this.#e.invoke("readIconSetControlsForAgent",e)}async readIcons(e){return this.#e.invoke("readIconsForAgent",e)}async readLayoutTemplateControls(e){return this.#e.invoke("readLayoutTemplateControlsForAgent",e)}async readShaderControls(e){return this.#e.invoke("readShaderControlsForAgent",e)}async applyChanges(e,t){return this.#e.invoke("applyAgentChanges",e,t)}async publish(e){return this.#e.invoke("publishForAgent",e)}async queryImages(e){return this.#e.invoke("queryImagesForAgent",e)}async reviewChanges(){return this.#e.invoke("reviewChangesForAgent")}async flattenComponentInstance(e,t){return this.#e.invoke("flattenComponentInstanceForAgent",e,t)}async makeExternalComponentLocal(e,t){return this.#e.invoke("makeExternalComponentLocalForAgent",e,t)}async getNode(e,t){return this.#e.invoke("getNodeForAgent",e,t)}async getNodes(e,t){return this.#e.invoke("getNodesForAgent",e,t)}async getNodesOfTypes(e,t){return this.#e.invoke("getNodesOfTypesForAgent",e,t)}async getScopeNode(e,t){return this.#e.invoke("getScopeNodeForAgent",e,t)}async getGroundNode(e,t){return this.#e.invoke("getGroundNodeForAgent",e,t)}async getParentNode(e,t){return this.#e.invoke("getParentNodeForAgent",e,t)}async getAncestors(e,t){return this.#e.invoke("getAncestorsForAgent",e,t)}async serialize(e,t){return this.#e.invoke("serializeForAgent",e,t)}async serializeNodes(e,t){return this.#e.invoke("serializeNodesForAgent",e,t)}async paginate(e,t){return this.#e.invoke("paginateForAgent",e,t)}async startConversation(e,t){return this.#e.invoke("startAgentConversation",e,t)}async continueConversation(e,t){return this.#e.invoke("continueAgentConversation",e,t)}async submitClarification(e){return this.#e.invoke("submitAgentClarification",e)}async runSupervisorCommand(e){return this.#e.invoke("runSupervisorAgentCommand",e)}};var Un=class{constructor(e){this.origin=e;}origin;static{r(this,"IframeTransport");}send(e,t){window.parent.postMessage(e,this.origin,t);}onMessage(e){window.addEventListener("message",e);}};async function da(){return new Promise(n=>{function e({data:t,origin:i}){if(!sr(t))return;window.removeEventListener("message",e);let a={transport:new Un(i),mode:t.mode,permissionMap:t.permissionMap,environmentInfo:t.environmentInfo,origin:i,theme:t.theme??null,initialState:t.initialState};n(a);}r(e,"handshakeListener"),window.addEventListener("message",e),window.parent.postMessage(or,"*");})}r(da,"createBrowserContext");async function ca(){return typeof window>"u"||"Deno"in globalThis?null:da()}r(ca,"bootstrap");var pr=await ca(),le=pr?new Te(new xe(pr)):new Proxy({},{get(n,e){throw new Error(`Cannot access framer.${String(e)} in server runtime. Use createFramerInstance() with a custom transport.`)}});var gr={};function pa(n){if(env)try{Object.assign(env,n);}catch{}Object.assign(gr,n);}r(pa,"configure");function Pe(n,e){let t=gr[n]??env[n];return t&&t.length>0?t:e}r(Pe,"getEnv");var mr=isWorkerd,zn=globalThis.WebSocket;async function fr(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(fr,"connectWebSocketCF");async function yr(){try{return {fs:await import('fs'),path:await import('path')}}catch{return {}}}r(yr,"getNodeModules");var de=(F=>(F.PROJECT_CLOSED="PROJECT_CLOSED",F.POOL_EXHAUSTED="POOL_EXHAUSTED",F.TIMEOUT="TIMEOUT",F.INTERNAL="INTERNAL",F.NODE_NOT_FOUND="NODE_NOT_FOUND",F.SCREENSHOT_TOO_LARGE="SCREENSHOT_TOO_LARGE",F.SCREENSHOT_PREPARE_FAILED="SCREENSHOT_PREPARE_FAILED",F.EXPORT_SVG_FAILED="EXPORT_SVG_FAILED",F.INVALID_REQUEST="INVALID_REQUEST",F.INVALID_RELEASE_CHANNEL="INVALID_RELEASE_CHANNEL",F.UNAUTHORIZED="UNAUTHORIZED",F))(de||{}),D=class extends Error{static{r(this,"FramerAPIError");}code;ref;retryable;recentMethods;constructor(e,t,i){super(e),this.name="FramerAPIError",this.code=t,i?.ref!==void 0&&(this.ref=i.ref),this.retryable=i?.retryable??false,i?.recentMethods!==void 0&&(this.recentMethods=i.recentMethods),this.stack=void 0;}toString(){let e=super.toString();return this.ref?`${e} [ref: ${this.ref}]`:e}};function ga(n){return n instanceof D?n.code==="POOL_EXHAUSTED"||n.retryable:false}r(ga,"isRetryableError");var ma=new Map(Object.values(de).map(n=>[n,n]));function br(n){return typeof n=="string"?ma.get(n)??"INTERNAL":"INTERNAL"}r(br,"parseErrorCode");var fa={pluginMarshalTag:At};var Gn={silent:0,error:1,warn:2,info:3,debug:4};function ya(){let n=Pe("FRAMER_API_LOG_LEVEL")?.toLowerCase();return n&&n in Gn?n:"warn"}r(ya,"getLogLevel");var Kn=ya();function rt(n){return Gn[n]<=Gn[Kn]}r(rt,"shouldLog");var ot=globalThis.console,ha="\x1B[90m",ba="\x1B[0m";function Ia(n){return n?`[FramerAPI:${n}]`:"[FramerAPI]"}r(Ia,"formatPrefix");function xa(n,...e){return [ha+n,...e,ba]}r(xa,"formatDebug");function Ir(n){let e=Ia(n);return {warn:r((...t)=>{rt("warn")&&ot.warn(e,...t);},"warn"),error:r((...t)=>{rt("error")&&ot.error(e,...t);},"error"),log:r((...t)=>{rt("info")&&ot.log(e,...t);},"log"),info:r((...t)=>{rt("info")&&ot.info(e,...t);},"info"),debug:r((...t)=>{rt("debug")&&ot.debug(...xa(e,...t));},"debug"),setLevel:r(t=>{Kn=t;},"setLevel"),getLevel:r(()=>Kn,"getLevel"),withRequestId:r(t=>Ir(t),"withRequestId")}}r(Ir,"createLogger");var N=Ir();N.warn;N.error;N.log;N.info;N.debug;N.setLevel;N.getLevel;var Ut="0.1.16";var xr="wss://api.framer.com/channel/headless-plugin";function Se(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
6
|
`);i[1]?.includes("assert")?(i.splice(1,1),t.stack=i.join(`
|
|
7
7
|
`)):i[0]?.includes("assert")&&(i.splice(0,1),t.stack=i.join(`
|
|
8
|
-
`));}catch{}throw t}r(Se,"assert");var Tr=false;function Pr({error:n,tags:e,extras:t,critical:i,caller:o}){let a=jn(n,o);return Tr||(Tr=true,console.error("Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment")),a}r(Pr,"reportError");function jn(n,e=jn){return n instanceof Error?n:new
|
|
9
|
-
`)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),$t=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}id;static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return dt(t)}getBufferedMessages(){return H.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=r((...e)=>{if(this.level>0)return;let t=le(this,0,e);console?.log(...t.toConsoleMessage());},"trace");debug=r((...e)=>{let t=le(this,1,e);this.level>1||console?.log(...t.toConsoleMessage());},"debug");info=r((...e)=>{let t=le(this,2,e);this.level>2||console?.info(...t.toConsoleMessage());},"info");warn=r((...e)=>{let t=le(this,3,e);this.level>3||console?.warn(...t.toConsoleMessage());},"warn");warnOncePerMinute=r((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=le(this,3,t);this.level>3||console?.warn(...o.toConsoleMessage());},"warnOncePerMinute");error=r((...e)=>{let t=le(this,4,e);this.level>4||console?.error(...t.toConsoleMessage());},"error");errorOncePerMinute=r((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=le(this,4,t);this.level>4||console?.error(...o.toConsoleMessage());},"errorOncePerMinute");reportWithoutLogging=r((e,t,i,o)=>{let a=ka(t??{}),s=Pr({caller:this.reportWithoutLogging,error:e,tags:{...i,where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]},"reportWithoutLogging");reportError=r((e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);},"reportError");reportErrorWithThrottle=r((e,t,i,o,a)=>{if(!Na(t))return;let s=this.didLog[t.message];s&&s>Date.now()||(this.didLog[t.message]=Date.now()+e,this.reportError(t,i,o,a));},"reportErrorWithThrottle");reportErrorOncePerMinute=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60,e,t,i,o),"reportErrorOncePerMinute");reportErrorOnceEveryTenMinutes=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60*10,e,t,i,o),"reportErrorOnceEveryTenMinutes");reportCriticalError=r((e,t,i)=>this.reportError(e,t,i,true),"reportCriticalError")};function Na(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(Na,"isErrorWithMessage");function Lr(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(Lr,"escapeRegExp");function Ea(n,e,t){let i=qn[t];if(!i)return n;let o=`${i}: [${e}]`,a=Lr(o).replace("\\[","\\*?\\["),s=new RegExp(`^(?:T?\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z\\s+)?${a}\\s*`);return n.replace(s,"")}r(Ea,"stripLogEntryPrefix");var Br;(_=>{function n(h,...u){return h.concat(u)}_.push=n,r(n,"push");function e(h){return h.slice(0,-1)}_.pop=e,r(e,"pop");function t(h,...u){return u.concat(h)}_.unshift=t,r(t,"unshift");function i(h,u,...T){let p=h.length;if(u<0||u>p)throw Error("index out of range: "+u);let b=h.slice();return b.splice(u,0,...T),b}_.insert=i,r(i,"insert");function o(h,u,T){let p=h.length;if(u<0||u>=p)throw Error("index out of range: "+u);let b=Array.isArray(T)?T:[T],M=h.slice();return M.splice(u,1,...b),M}_.replace=o,r(o,"replace");function a(h,u){let T=h.length;if(u<0||u>=T)throw Error("index out of range: "+u);let p=h.slice();return p.splice(u,1),p}_.remove=a,r(a,"remove");function s(h,u,T){let p=h.length;if(u<0||u>=p)throw Error("from index out of range: "+u);if(T<0||T>=p)throw Error("to index out of range: "+T);let b=h.slice();if(T===u)return b;let M=b[u];return u<T?(b.splice(T+1,0,M),b.splice(u,1)):(b.splice(u,1),b.splice(T,0,M)),b}_.move=s,r(s,"move");function d(h,u){let T=[],p=Math.min(h.length,u.length);for(let b=0;b<p;b++)T.push([h[b],u[b]]);return T}_.zip=d,r(d,"zip");function g(h,u,T){let p=h.slice(),b=p[u];return b===void 0||(p[u]=T(b)),p}_.update=g,r(g,"update");function x(h){return Array.from(new Set(h))}_.unique=x,r(x,"unique");function S(h,...u){return Array.from(new Set([...h,...u.flat()]))}_.union=S,r(S,"union");function v(h,u){return h.filter(u)}_.filter=v,r(v,"filter");})(Br||={});var Wa=Object.prototype.hasOwnProperty;function Ra(n,e){return Wa.call(n,e)}r(Ra,"hasOwnProperty");var Ur;(i=>{function n(o,a){for(let s of Object.keys(o))Ra(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===void 0&&(o[s]=a[s]);return Object.setPrototypeOf(o,Object.getPrototypeOf(a)),o}i.morphUsingTemplate=n,r(n,"morphUsingTemplate");function e(o,a){a&&Object.assign(o,a);}i.writeOnce=e,r(e,"writeOnce");function t(o,a){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,a)}i.update=t,r(t,"update");})(Ur||={});var Or;(o=>{function n(a,...s){return new Set([...a,...s])}o.add=n,r(n,"add");function e(a,...s){let d=new Set(a);for(let g of s)d.delete(g);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let g of d)s.add(g);return s}o.union=t,r(t,"union");function i(a,s){return a.has(s)?o.remove(a,s):o.add(a,s)}o.toggle=i,r(i,"toggle");})(Or||={});var zr;(i=>{function n(o,...a){let s=new Map;o.forEach((g,x)=>s.set(x,g));let d=false;for(let g of a)g&&(g.forEach((x,S)=>s.set(S,x)),d=true);return d?s:o}i.merge=n,r(n,"merge");function e(o,a,s){let d=new Map(o);return d.set(a,s),d}i.set=e,r(e,"set");function t(o,a){let s=new Map(o);return s.delete(a),s}i.remove=t,r(t,"remove");})(zr||={});var Ht=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);};}};Ht.prototype.constructor=Promise;dt("task-queue");function Gr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Gr,"isObject");var za=-1,Ga=1e3,jt=class{static{r(this,"WebSocketTransport");}onError;closed=false;ws;messageHandlers=new Set;chunkBuffers=new Map;#e;constructor(e){this.ws=e,this.setupListeners();}setupListeners(){this.ws.addEventListener("close",this.handleClose),this.ws.addEventListener("message",this.handleMessage);}removeListeners(){this.ws.removeEventListener("close",this.handleClose),this.ws.removeEventListener("message",this.handleMessage);}handleClose=r(e=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear();let t=this.#e;if(t&&Date.now()-t.at<=Ga){this.onError?.(t.error);return}let i=e?.code,o=i!==void 0?`Connection closed (code: ${i})`:"Connection closed";this.onError?.(new D(o,"PROJECT_CLOSED",{retryable:true}));},"handleClose");handleMessage=r(e=>{let t=typeof e.data=="string"?e.data:String(e.data),i=this.tryParseChunkEnvelope(t);if(i){let o=this.handleChunk(i);if(!o)return;let a=new MessageEvent("message",{data:o});if(this.tryHandleDebugArchive(o))return;for(let s of this.messageHandlers)s(a);return}if(!this.tryHandleDebugArchive(t))for(let o of this.messageHandlers)o(e);},"handleMessage");tryHandleDebugArchive(e){try{let t=ue.parse(e);if(Gr(t)&&t.type==="debug-archive")return t.data instanceof Uint8Array?(Jn(t.data),!0):!1}catch{}return false}replaceSocket(e){this.removeListeners(),this.chunkBuffers.clear(),this.#e=void 0,this.ws=e,this.closed=false,this.setupListeners();}setOnError(e){this.onError=e;}send(e){if(this.closed)throw new D("Connection closed","PROJECT_CLOSED");this.ws.send(ue.stringify(e,{[At]:t=>Tn(t)&&W(t)}));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===za?(this.chunkBuffers.delete(e.id),t.join("")):null}tryParseChunkEnvelope(e){if(!e.startsWith('{"$chunk":'))return null;try{let t=JSON.parse(e);if(t.$chunk===1&&typeof t.id=="string"&&typeof t.seq=="number")return t}catch{}return null}onMessage(e){let t=r(i=>{let o=typeof i.data=="string"?i.data:String(i.data);this.dispatchMessage(o,e);},"listener");this.messageHandlers.add(t);}dispatchMessage(e,t){let i=ue.parse(e);if(Gr(i)&&i.type==="error"){let o=i.message||JSON.stringify(i),a=i.code??"INTERNAL",s=typeof i.ref=="string"?i.ref:void 0,d=i.retryable===true,g=Array.isArray(i.recentMethods)?i.recentMethods.filter(S=>typeof S=="string"):void 0;N.error(s?`Server error: ${o} [ref: ${s}]`:`Server error: ${o}`);let x=new D(`Server error: ${o}`,a,{ref:s,retryable:d,recentMethods:g});this.#e={error:x,at:Date.now()},this.onError?.(x);return}t(i);}};async function Jn(n){let{fs:e,path:t}=await yr();Se(e,"File system module is not available."),Se(t,"Path module is not available.");let o=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,a=process.cwd(),s=t.resolve(a,o);e.writeFileSync(s,Buffer.from(n)),N.info(`Debug archive saved to ${s}`);}r(Jn,"handleDebugArchive");function de(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(de,"isObject");var Ka={type:"pluginReadySignal"};function $a(n){return de(n)&&n.type==="pluginReadyResponse"}r($a,"isPluginReadyResponse");var Kr=9e4,Ha=2e4;function ja(n,e){return new Promise(t=>{let i=setTimeout(()=>{n.removeEventListener("message",o),t();},e),o=r(a=>{if(!(typeof a.data!="string"&&!(a.data instanceof String)))try{let s=ue.parse(a.data);de(s)&&s.type==="disconnect-ack"&&(clearTimeout(i),n.removeEventListener("message",o),t());}catch{}},"handler");n.addEventListener("message",o);})}r(ja,"waitForDisconnectAck");async function _a(n,e){let t={Authorization:`Token ${e}`};if(mr)return N.debug("Using Cloudflare Workers WebSocket connection"),fr(n,t);if(isDeno)return new Gn(n.href,[`token.${e}`]);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 a=new Gn(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(_a,"createWebSocket");async function _t(n,e,t,i){let o=new URL(i??Pe("FRAMER_HEADLESS_SERVER_URL",Cr));o.protocol=o.protocol==="https:"?"wss:":o.protocol==="http:"?"ws:":o.protocol,o.searchParams.set("projectId",n),o.searchParams.set("sdkVersion",Ot),t&&o.searchParams.set("clientId",t),N.debug(`Connecting to ${o.href}`);let a=await _a(o,e);N.debug(`WebSocket created, readyState: ${a.readyState}`);let s,d,g=N,x=false,S=setInterval(()=>{a.readyState===a.OPEN&&(a.send(ue.stringify({type:"ping"})),g.debug("Sent ping"));},Ha),v=r(()=>{clearInterval(S),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect");},"forceClose"),_=r(async()=>{clearInterval(S),!(a.readyState===a.CLOSED||a.readyState===a.CLOSING)&&(x&&(g.debug("Initiating graceful disconnect"),a.send(ue.stringify({type:"client-disconnect"})),await ja(a,15e3)),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect"));},"cleanup"),h=await new Promise((u,T)=>{let p=setTimeout(()=>{v(),T(new D(`Connection timeout after ${Kr}ms`,"TIMEOUT"));},Kr),b=r(()=>{g.debug("WebSocket opened, waiting for ready");},"onOpen"),M=r(E=>{g.debug("WebSocket error:",E),clearTimeout(p),v(),T(new D("No connection to the server","INTERNAL"));},"onError"),z=r(E=>{g.debug(`WebSocket closed: code=${E.code}, reason=${E.reason||"(no reason)"}, wasClean=${E.wasClean}`),clearTimeout(p),clearInterval(S),T(new D(`Connection to the server was closed (code: ${E.code})`,"PROJECT_CLOSED"));},"onClose");function ee(E){g.debug("Received message");let ct=typeof E.data=="string"?E.data:E.data.toString(),P=ue.parse(ct);if(g.debug(`Message type: ${P.type}`),P.type==="error"){clearTimeout(p),a.removeEventListener("close",z),a.removeEventListener("error",M);let ce=br(P.code),ei=de(P)&&"ref"in P&&typeof P.ref=="string"?P.ref:void 0;T(new D(P.message||"Server error",ce,ei?{ref:ei}:void 0)),v();}else P.type==="ready"?(de(P)&&"requestId"in P&&(s=String(P.requestId),g=N.withRequestId(s),g.debug(`Server request ID: ${s}`)),de(P)&&"sessionId"in P&&(d=String(P.sessionId),g.debug(`Server session ID: ${d}`)),de(P)&&"version"in P&&g.debug(`Server version: ${P.version}`),de(P)&&P.gracefulDisconnect===true&&(x=true),g.debug("Sending pluginReadySignal"),a.send(ue.stringify(Ka))):P.type==="debug-archive"?P.data instanceof Uint8Array&&Jn(P.data):$a(P)&&(clearTimeout(p),a.removeEventListener("message",ee),a.removeEventListener("error",M),a.removeEventListener("close",z),u(P));}r(ee,"handshakeMessageHandler"),a.addEventListener("open",b),a.addEventListener("message",ee),a.addEventListener("error",M),a.addEventListener("close",z);});return a.addEventListener("close",()=>{_();}),{ws:a,pluginReadyData:h,requestId:s,sessionId:d,clientId:t,logger:g,gracefulDisconnect:x,cleanup:_}}r(_t,"connectAndHandshake");var $r={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_getDependencyVersion: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,createLocale:true,getLocaleLanguages:true,getLocaleRegions: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 Qn(n){return n in $r?$r[n]===true:false}r(Qn,"isAllowedMethod");var qt=class n{static{r(this,"FramerAPI");}requestId;sessionId;#e;agent;#t;#n;#i=new Map;#r=new Map;#p=0;#a;#s;#l;#d;constructor(e){this.agent=e.agentAPI,this.#t=e.pluginAPI,this.#n=e.transport,this.#e=e.cleanup,this.#a=e.projectId,this.#s=e.apiKey,this.#l=e.serverUrl,this.requestId=e.requestId,this.sessionId=e.sessionId,this.#d=e.clientId,this.#n.onMessage(t=>{this.#g(t);}),this.#n.setOnError(t=>{this.#u(t);});}#u(e){for(let t of this.#i.values())t.reject(e);this.#i.clear();for(let t of this.#r.values())t.reject(e);this.#r.clear(),this.#t[V.rejectAllPending](e);}#c(){return `req-${++this.#p}-${Date.now()}`}#g=r(e=>{switch(e.type){case "screenshotResult":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=Buffer.from(e.data,"base64");t.resolve({data:i,mimeType:e.mimeType});}return true}case "screenshotError":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i,e.ref?{ref:e.ref}:void 0));}return true}case "exportSVGResult":{let t=this.#r.get(e.id);return t&&(this.#r.delete(e.id),t.resolve(e.data)),true}case "exportSVGError":{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,e.ref?{ref:e.ref}:void 0));}return true}default:return false}},"#handleServerApiResponse");static create(e){let t=new n(e);return new Proxy(t,{get(i,o){if(o in i)return Reflect.get(i,o);if(Vn(o)){let s=V[o],d=Reflect.get(i.#t,s);return typeof d=="function"?d.bind(i.#t):d}if(!Qn(o))return;let a=Reflect.get(i.#t,o);return typeof a=="function"?a.bind(i.#t):a},has(i,o){return o in i||Vn(o)?true:Qn(o)?o in i.#t:false}})}async#o(){this.#u(new D("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=r(()=>this.#o(),"disconnect");reconnect=r(async()=>{await this.#o();let e=await _t(this.#a,this.#s,this.#d,this.#l);this.#n.replaceSocket(e.ws),this.#e=e.cleanup,this.requestId=e.requestId,this.sessionId=e.sessionId;},"reconnect");screenshot=r((e,t)=>{let i=this.#c(),{format:o,quality:a,scale:s,clip:d}=t??{};return new Promise((g,x)=>{this.#i.set(i,{resolve:g,reject:x}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:a,scale:s,clip:d});})},"screenshot");exportSVG=r(e=>{let t=this.#c();return new Promise((i,o)=>{this.#r.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});})},"exportSVG");[Symbol.dispose]=()=>{this.#o();};[Symbol.asyncDispose]=()=>this.#o()};var qa=/^.+--([A-Za-z0-9]+)/u,Hr=/^[A-Za-z0-9]{20}$/u;function jr(n){if(Hr.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 a=decodeURIComponent(o),d=a.match(qa)?.[1]??a;if(Hr.test(d))return d}}return null}catch{return null}}r(jr,"parseProjectId");async function _r(n,e,t){let i=performance.now();if(!n)throw new D("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=jr(n);if(!o)throw new D(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let a=e??Pe("FRAMER_API_KEY");if(!a)throw new D("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let s=t?.clientId?.trim()||`framer-api/${Ot}`,d=await _t(o,a,s,t?.serverUrl);try{let g=new jt(d.ws),x={transport:g,mode:d.pluginReadyData.mode,permissionMap:d.pluginReadyData.permissionMap,environmentInfo:d.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:d.pluginReadyData.initialState},S=new Ce(x),v=new Te(S),_=new Ut(S),h=r(async()=>{let u=((performance.now()-i)/1e3).toFixed(2);d.logger.debug(`Connection ended after ${u}s`),await d.cleanup();},"cleanup");return qt.create({pluginAPI:v,agentAPI:_,transport:g,cleanup:h,projectId:o,apiKey:a,serverUrl:t?.serverUrl,clientId:d.clientId,requestId:d.requestId,sessionId:d.sessionId})}catch(g){throw await d.cleanup(),g}}r(_r,"connect");async function Ya(n,e,t,i){let o=await _r(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(Ya,"withConnection");
|
|
10
|
-
export{
|
|
8
|
+
`));}catch{}throw t}r(Se,"assert");var Tr=false;function Pr({error:n,tags:e,extras:t,critical:i,caller:o}){let a=jn(n,o);return Tr||(Tr=true,console.error("Set up an error callback with setErrorReporter, or configure Sentry with initializeEnvironment")),a}r(Pr,"reportError");function jn(n,e=jn){return n instanceof Error?n:new $n(n,e)}r(jn,"reportableError");var $n=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 at=typeof window<"u"&&!("Deno"in globalThis)?window.location.hostname:void 0,Sr=!!(at&&["web.framerlocal.com","localhost","127.0.0.1","[::1]"].includes(at)),Hn=(()=>{if(!at)return;if(Sr)return {main:at,previewLink:void 0};let n=/^(([^.]+\.)?beta\.)?((?:development\.)?framer\.com)$/u,e=at.match(n);if(!(!e||!e[3]))return {previewLink:e[2]&&e[0],main:e[3]}})();({isDevelopment:Hn?.main==="development.framer.com",isProduction:Hn?.main==="framer.com"});var Ot;function zt(){return typeof window>"u"?{}:Ot||(Ot=Pa(),Ot)}r(zt,"getServiceMap");function Pa(){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(Pa,"extractServiceMap");function st(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 st(n.toJSON(),e+1,t);if(Array.isArray(n))return n.map(i=>st(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,a]of Object.entries(n))i[o]=st(a,e+1,t);return i}}catch(i){return `[Throws: ${i instanceof Error?i.message:i}]`}finally{t.delete(n);}}r(st,"jsonSafeCopy");var _n=["trace","debug","info","warn","error"],Sa=["\u{1F50D}","\u{1F9EA}","\u2139\uFE0F","\u26A0\uFE0F","\u274C"],Fa=[":trace",":debug",":info",":warn",":error"],Dr="logTimestamps";function kr(n){return new Date(n).toISOString().substring(10,24)}r(kr,"formatLogTimestamp");function Nr(n,e){let t=[];for(let i of n.split(/[ ,]/u)){let o=i.trim();if(o.length===0)continue;let a=1,s=false;o.startsWith("-")&&(o=o.slice(1),a=3,s=true);for(let g=0;g<=4;g++){let I=Fa[g];if(I&&o.endsWith(I)){a=g,s&&(a+=1),o=o.slice(0,o.length-I.length),o.length===0&&(o="*");break}}let d=new RegExp("^"+Lr(o).replace(/\\\*/gu,".*")+"$"),P=0;for(let g of e)g.id.match(d)&&(g.level=a,++P);P===0&&t.push(i);}return t}r(Nr,"applyLogLevelSpec");var lt=class n{constructor(e,t,i){this.logger=e;this.level=t;this.parts=i;this.id=n.nextId++,this.time=Date.now();}logger;level;parts;static{r(this,"LogEntry");}static nextId=0;id;time;stringPrefix;cachedMessage;toMessage(){if(this.stringPrefix)return this.cachedMessage??this.parts;let e=[_n[this.level]+": ["+this.logger.id+"]"];Gt&&e.unshift(kr(this.time)),this.stringPrefix=e.join(" ");let t=this.parts[0];if(typeof t=="string"){let i=Ea(t,this.logger.id,this.level);this.cachedMessage=[i.length>0?`${this.stringPrefix} ${i}`:this.stringPrefix,...this.parts.slice(1)];}else this.cachedMessage=[this.stringPrefix,...this.parts];return this.cachedMessage}resetMessagePrefix(){this.stringPrefix=void 0,this.cachedMessage=void 0;}toConsoleMessage(){let e=this.toMessage().slice(),t=e[0];if(typeof t!="string")return e;let i=_n[this.level],o=Sa[this.level];i&&o&&(e[0]=t.replace(`${i}:`,`${o}`));let a=`[${this.logger.id}]`,s=e[0];if(typeof s!="string")return e;let d=s.indexOf(a);return d<0||(e[0]=s.slice(0,d)+"%c"+a+"%c"+s.slice(d+a.length),e.splice(1,0,"color: #9ca3af","")),e}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(st(e));return i?.length>253?i.slice(0,250)+"...":i}).join(" ")}},_="*:app:info,app:info",Gt=true,Ar=typeof process<"u"&&!!process.kill,va=Ar&&!!process.env.CI;va?_="-:warn":Ar&&(_="");try{typeof window<"u"&&window.localStorage&&(_=window.localStorage.logLevel||_,Gt=window.localStorage[Dr]!=="false");}catch{}try{typeof process<"u"&&(_=process.env.DEBUG||_);}catch{}try{typeof window<"u"&&Object.assign(window,{setLogLevel:wr,setLogTimestamps:Vr});}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 a=dt(e);if(t<0||t>5)return;i[0]=i[0].replace("[","*[");let s=new lt(a,t,i);s.stringPrefix=i[0],H.push(s),!o&&(a.level>t||console?.log(...s.toConsoleMessage()));});}catch{}var Yn;try{typeof window<"u"&&window.postMessage&&window.parent!==window&&!window.location.pathname.startsWith("/edit")&&(Yn=r(n=>{try{let e=n.toMessage().map(s=>st(s)),t=n.logger,i=n.level,o=t.level<=n.level,a={loggerId:t.id,level:i,parts:e,printed:o};window.parent?.postMessage(a,zt().app);}catch{}},"postLogEntry"));}catch{}var qn={},H=[],Er=1e3;function ce(n,e,t){let i=new lt(n,e,t);for(H.push(i),Yn?.(i);H.length>Er;)H.shift();return i}r(ce,"createLogEntry");function Mr(n){return typeof n=="number"&&(Er=n),H}r(Mr,"getLogReplayBuffer");var Da=/\/(?<filename>[^/.]+)(?=\.(?:debug\.)?html$)/u,vr;function ka(){if(!(typeof window>"u"||!window.location))return vr??=Da.exec(window.location.pathname)?.groups?.filename,vr}r(ka,"getFilenameFromWindowPathname");function dt(n){let e=ka();n=(e?e+":":"")+n;let t=qn[n];if(t)return t;let i=new Kt(n);return qn[n]=i,Nr(_,[i]),Yn?.(new lt(i,-1,[])),i}r(dt,"getLogger");function wr(n,e=true){try{typeof window<"u"&&window.localStorage&&(window.localStorage.logLevel=n);}catch{}let t=_;_=n;let i=Object.values(qn);for(let a of i)a.level=3;let o=Nr(n,i);if(o.length>0&&console?.warn("Some log level specs matched no loggers:",o),e&&H.length>0){console?.log("--- LOG REPLAY ---");for(let a of H)a.logger.level>a.level||(a.level>=3?console?.warn(...a.toConsoleMessage()):console?.log(...a.toConsoleMessage()));console?.log("--- END OF LOG REPLAY ---");}return t}r(wr,"setLogLevel");function Vr(n){let e=Gt;Gt=n;for(let t of H)t.resetMessagePrefix();try{typeof window<"u"&&window.localStorage&&(window.localStorage[Dr]=String(n));}catch{}return e}r(Vr,"setLogTimestamps");var Na=r(n=>{let e={...n,logs:Mr().slice(-50).map(t=>t.toString().slice(0,600)).join(`
|
|
9
|
+
`)};return n.logs&&console?.warn("extras.logs is reserved for log replay buffer, use another key"),e},"enrichWithLogs"),Kt=class{constructor(e,t){this.id=e;this.errorIsCritical=t??(e==="fatal"||e.endsWith(":fatal"));}id;static{r(this,"Logger");}level=3;didLog={};errorIsCritical;extend(e){let t=this.id+":"+e;return dt(t)}getBufferedMessages(){return H.filter(e=>e.logger===this)}setLevel(e){let t=this.level;return this.level=e,t}isLoggingTraceMessages(){return this.level>=0}trace=r((...e)=>{if(this.level>0)return;let t=ce(this,0,e);console?.log(...t.toConsoleMessage());},"trace");debug=r((...e)=>{let t=ce(this,1,e);this.level>1||console?.log(...t.toConsoleMessage());},"debug");info=r((...e)=>{let t=ce(this,2,e);this.level>2||console?.info(...t.toConsoleMessage());},"info");warn=r((...e)=>{let t=ce(this,3,e);this.level>3||console?.warn(...t.toConsoleMessage());},"warn");warnOncePerMinute=r((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=ce(this,3,t);this.level>3||console?.warn(...o.toConsoleMessage());},"warnOncePerMinute");error=r((...e)=>{let t=ce(this,4,e);this.level>4||console?.error(...t.toConsoleMessage());},"error");errorOncePerMinute=r((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=ce(this,4,t);this.level>4||console?.error(...o.toConsoleMessage());},"errorOncePerMinute");reportWithoutLogging=r((e,t,i,o)=>{let a=Na(t??{}),s=Pr({caller:this.reportWithoutLogging,error:e,tags:{...i,where:this.id},extras:t,critical:o??this.errorIsCritical});return [a,s]},"reportWithoutLogging");reportError=r((e,t,i,o)=>{let[a,s]=this.reportWithoutLogging(e,t,i,o);a?this.error(s,a):this.error(s);},"reportError");reportErrorWithThrottle=r((e,t,i,o,a)=>{if(!Aa(t))return;let s=this.didLog[t.message];s&&s>Date.now()||(this.didLog[t.message]=Date.now()+e,this.reportError(t,i,o,a));},"reportErrorWithThrottle");reportErrorOncePerMinute=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60,e,t,i,o),"reportErrorOncePerMinute");reportErrorOnceEveryTenMinutes=r((e,t,i,o)=>this.reportErrorWithThrottle(1e3*60*10,e,t,i,o),"reportErrorOnceEveryTenMinutes");reportCriticalError=r((e,t,i)=>this.reportError(e,t,i,true),"reportCriticalError")};function Aa(n){return Object.prototype.hasOwnProperty.call(n,"message")}r(Aa,"isErrorWithMessage");function Lr(n){return n.replace(/[/\-\\^$*+?.()|[\]{}]/gu,"\\$&")}r(Lr,"escapeRegExp");function Ea(n,e,t){let i=_n[t];if(!i)return n;let o=`${i}: [${e}]`,a=Lr(o).replace("\\[","\\*?\\["),s=new RegExp(`^(?:T?\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z\\s+)?${a}\\s*`);return n.replace(s,"")}r(Ea,"stripLogEntryPrefix");var Br;(z=>{function n(y,...c){return y.concat(c)}z.push=n,r(n,"push");function e(y){return y.slice(0,-1)}z.pop=e,r(e,"pop");function t(y,...c){return c.concat(y)}z.unshift=t,r(t,"unshift");function i(y,c,...S){let u=y.length;if(c<0||c>u)throw Error("index out of range: "+c);let m=y.slice();return m.splice(c,0,...S),m}z.insert=i,r(i,"insert");function o(y,c,S){let u=y.length;if(c<0||c>=u)throw Error("index out of range: "+c);let m=Array.isArray(S)?S:[S],V=y.slice();return V.splice(c,1,...m),V}z.replace=o,r(o,"replace");function a(y,c){let S=y.length;if(c<0||c>=S)throw Error("index out of range: "+c);let u=y.slice();return u.splice(c,1),u}z.remove=a,r(a,"remove");function s(y,c,S){let u=y.length;if(c<0||c>=u)throw Error("from index out of range: "+c);if(S<0||S>=u)throw Error("to index out of range: "+S);let m=y.slice();if(S===c)return m;let V=m[c];return c<S?(m.splice(S+1,0,V),m.splice(c,1)):(m.splice(c,1),m.splice(S,0,V)),m}z.move=s,r(s,"move");function d(y,c){let S=[],u=Math.min(y.length,c.length);for(let m=0;m<u;m++)S.push([y[m],c[m]]);return S}z.zip=d,r(d,"zip");function P(y,c,S){let u=y.slice(),m=u[c];return m===void 0||(u[c]=S(m)),u}z.update=P,r(P,"update");function g(y){return Array.from(new Set(y))}z.unique=g,r(g,"unique");function I(y,...c){return Array.from(new Set([...y,...c.flat()]))}z.union=I,r(I,"union");function F(y,c){return y.filter(c)}z.filter=F,r(F,"filter");})(Br||={});var Ra=Object.prototype.hasOwnProperty;function Ba(n,e){return Ra.call(n,e)}r(Ba,"hasOwnProperty");var Ur;(i=>{function n(o,a){for(let s of Object.keys(o))Ba(a,s)||delete o[s];for(let s of Object.keys(a))o[s]===void 0&&(o[s]=a[s]);return Object.setPrototypeOf(o,Object.getPrototypeOf(a)),o}i.morphUsingTemplate=n,r(n,"morphUsingTemplate");function e(o,a){a&&Object.assign(o,a);}i.writeOnce=e,r(e,"writeOnce");function t(o,a){return Object.assign(Object.create(Object.getPrototypeOf(o)),o,a)}i.update=t,r(t,"update");})(Ur||={});var Or;(o=>{function n(a,...s){return new Set([...a,...s])}o.add=n,r(n,"add");function e(a,...s){let d=new Set(a);for(let P of s)d.delete(P);return d}o.remove=e,r(e,"remove");function t(...a){let s=new Set;for(let d of a)for(let P of d)s.add(P);return s}o.union=t,r(t,"union");function i(a,s){return a.has(s)?o.remove(a,s):o.add(a,s)}o.toggle=i,r(i,"toggle");})(Or||={});var zr;(i=>{function n(o,...a){let s=new Map;o.forEach((P,g)=>s.set(g,P));let d=false;for(let P of a)P&&(P.forEach((g,I)=>s.set(I,g)),d=true);return d?s:o}i.merge=n,r(n,"merge");function e(o,a,s){let d=new Map(o);return d.set(a,s),d}i.set=e,r(e,"set");function t(o,a){let s=new Map(o);return s.delete(a),s}i.remove=t,r(t,"remove");})(zr||={});var $t=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);};}};$t.prototype.constructor=Promise;dt("task-queue");function Gr(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(Gr,"isObject");var Ga=-1,Ka=1e3,jt=class{static{r(this,"WebSocketTransport");}onError;closed=false;ws;messageHandlers=new Set;chunkBuffers=new Map;#e;constructor(e){this.ws=e,this.setupListeners();}setupListeners(){this.ws.addEventListener("close",this.handleClose),this.ws.addEventListener("message",this.handleMessage);}removeListeners(){this.ws.removeEventListener("close",this.handleClose),this.ws.removeEventListener("message",this.handleMessage);}handleClose=r(e=>{this.removeListeners(),this.closed=true,this.chunkBuffers.clear();let t=this.#e;if(t&&Date.now()-t.at<=Ka){this.onError?.(t.error);return}let i=e?.code,o=i!==void 0?`Connection closed (code: ${i})`:"Connection closed";this.onError?.(new D(o,"PROJECT_CLOSED",{retryable:true}));},"handleClose");handleMessage=r(e=>{let t=typeof e.data=="string"?e.data:String(e.data),i=this.tryParseChunkEnvelope(t);if(i){let o=this.handleChunk(i);if(!o)return;let a=new MessageEvent("message",{data:o});if(this.tryHandleDebugArchive(o))return;for(let s of this.messageHandlers)s(a);return}if(!this.tryHandleDebugArchive(t))for(let o of this.messageHandlers)o(e);},"handleMessage");tryHandleDebugArchive(e){try{let t=ue.parse(e);if(Gr(t)&&t.type==="debug-archive")return t.data instanceof Uint8Array?(Zn(t.data),!0):!1}catch{}return false}replaceSocket(e){this.removeListeners(),this.chunkBuffers.clear(),this.#e=void 0,this.ws=e,this.closed=false,this.setupListeners();}setOnError(e){this.onError=e;}send(e){if(this.closed)throw new D("Connection closed","PROJECT_CLOSED");this.ws.send(ue.stringify(e,{[At]:t=>Cn(t)&&W(t)}));}handleChunk(e){let t=this.chunkBuffers.get(e.id);return t||(t=[],this.chunkBuffers.set(e.id,t)),t.push(e.data),e.seq===Ga?(this.chunkBuffers.delete(e.id),t.join("")):null}tryParseChunkEnvelope(e){if(!e.startsWith('{"$chunk":'))return null;try{let t=JSON.parse(e);if(t.$chunk===1&&typeof t.id=="string"&&typeof t.seq=="number")return t}catch{}return null}onMessage(e){let t=r(i=>{let o=typeof i.data=="string"?i.data:String(i.data);this.dispatchMessage(o,e);},"listener");this.messageHandlers.add(t);}dispatchMessage(e,t){let i=ue.parse(e);if(Gr(i)&&i.type==="error"){let o=i.message||JSON.stringify(i),a=i.code??"INTERNAL",s=typeof i.ref=="string"?i.ref:void 0,d=i.retryable===true,P=Array.isArray(i.recentMethods)?i.recentMethods.filter(I=>typeof I=="string"):void 0;N.error(s?`Server error: ${o} [ref: ${s}]`:`Server error: ${o}`);let g=new D(`Server error: ${o}`,a,{ref:s,retryable:d,recentMethods:P});this.#e={error:g,at:Date.now()},this.onError?.(g);return}t(i);}};async function Zn(n){let{fs:e,path:t}=await yr();Se(e,"File system module is not available."),Se(t,"Path module is not available.");let o=`debug-archive-${new Date().toISOString().replace(/[:.]/gu,"-")}.zip`,a=process.cwd(),s=t.resolve(a,o);e.writeFileSync(s,Buffer.from(n)),N.info(`Debug archive saved to ${s}`);}r(Zn,"handleDebugArchive");function ne(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}r(ne,"isObject");var $a={type:"pluginReadySignal"};function ja(n){return ne(n)&&n.type==="pluginReadyResponse"}r(ja,"isPluginReadyResponse");var Kr=9e4,Ha=2e4;function _a(n,e){return new Promise(t=>{let i=setTimeout(()=>{n.removeEventListener("message",o),t();},e),o=r(a=>{if(!(typeof a.data!="string"&&!(a.data instanceof String)))try{let s=ue.parse(a.data);ne(s)&&s.type==="disconnect-ack"&&(clearTimeout(i),n.removeEventListener("message",o),t());}catch{}},"handler");n.addEventListener("message",o);})}r(_a,"waitForDisconnectAck");function qa(n){let{projectId:e,clientId:t,expectedInitialBranchId:i,serverUrlOverride:o}=n,a=new URL(o??Pe("FRAMER_HEADLESS_SERVER_URL",xr));return a.protocol=a.protocol==="https:"?"wss:":a.protocol==="http:"?"ws:":a.protocol,a.searchParams.set("projectId",e),a.searchParams.set("sdkVersion",Ut),t&&a.searchParams.set("clientId",t),i&&a.searchParams.set("expectedInitialBranchId",i),a}r(qa,"createHeadlessServerUrl");async function Ya(n,e){let t={Authorization:`Token ${e}`};if(mr)return N.debug("Using Cloudflare Workers WebSocket connection"),fr(n,t);if(isDeno)return new zn(n.href,[`token.${e}`]);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 a=new zn(n.href,{headers:t});return i&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED=o),a}r(Ya,"createWebSocket");async function Ht(n,e,t,i={}){let o=qa({projectId:n,clientId:t,...i});N.debug(`Connecting to ${o.href}`);let a=await Ya(o,e);N.debug(`WebSocket created, readyState: ${a.readyState}`);let s,d,P,g=N,I=false,F=setInterval(()=>{a.readyState===a.OPEN&&(a.send(ue.stringify({type:"ping"})),g.debug("Sent ping"));},Ha),z=r(()=>{clearInterval(F),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect");},"forceClose"),y=r(async()=>{clearInterval(F),!(a.readyState===a.CLOSED||a.readyState===a.CLOSING)&&(I&&(g.debug("Initiating graceful disconnect"),a.send(ue.stringify({type:"client-disconnect"})),await _a(a,15e3)),a.readyState!==a.CLOSED&&a.readyState!==a.CLOSING&&a.close(1e3,"Client disconnect"));},"cleanup"),c=await new Promise((S,u)=>{let m=setTimeout(()=>{z(),u(new D(`Connection timeout after ${Kr}ms`,"TIMEOUT"));},Kr),V=r(()=>{g.debug("WebSocket opened, waiting for ready");},"onOpen"),G=r(E=>{g.debug("WebSocket error:",E),clearTimeout(m),z(),u(new D("No connection to the server","INTERNAL"));},"onError"),q=r(E=>{g.debug(`WebSocket closed: code=${E.code}, reason=${E.reason||"(no reason)"}, wasClean=${E.wasClean}`),clearTimeout(m),clearInterval(F),u(new D(`Connection to the server was closed (code: ${E.code})`,"PROJECT_CLOSED"));},"onClose");function Y(E){g.debug("Received message");let Qn=typeof E.data=="string"?E.data:E.data.toString(),x=ue.parse(Qn);if(g.debug(`Message type: ${x.type}`),x.type==="error"){clearTimeout(m),a.removeEventListener("close",q),a.removeEventListener("error",G);let qr=br(x.code),ei=ne(x)&&"ref"in x&&typeof x.ref=="string"?x.ref:void 0;u(new D(x.message||"Server error",qr,ei?{ref:ei}:void 0)),z();}else x.type==="ready"?(ne(x)&&"requestId"in x&&(s=String(x.requestId),g=N.withRequestId(s),g.debug(`Server request ID: ${s}`)),ne(x)&&"sessionId"in x&&(d=String(x.sessionId),g.debug(`Server session ID: ${d}`)),ne(x)&&typeof x.activeBranchId=="string"&&(P=x.activeBranchId,g.debug(`Server active branch ID: ${P}`)),ne(x)&&"version"in x&&g.debug(`Server version: ${x.version}`),ne(x)&&x.gracefulDisconnect===true&&(I=true),g.debug("Sending pluginReadySignal"),a.send(ue.stringify($a))):x.type==="debug-archive"?x.data instanceof Uint8Array&&Zn(x.data):ja(x)&&(clearTimeout(m),a.removeEventListener("message",Y),a.removeEventListener("error",G),a.removeEventListener("close",q),S(x));}r(Y,"handshakeMessageHandler"),a.addEventListener("open",V),a.addEventListener("message",Y),a.addEventListener("error",G),a.addEventListener("close",q);});return a.addEventListener("close",()=>{y();}),{ws:a,pluginReadyData:c,activeBranchId:P,requestId:s,sessionId:d,clientId:t,logger:g,gracefulDisconnect:I,cleanup:y}}r(Ht,"connectAndHandshake");var $r={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_getDependencyVersion: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,createLocale:true,getLocaleLanguages:true,getLocaleRegions: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 Jn(n){return n in $r?$r[n]===true:false}r(Jn,"isAllowedMethod");var _t=class n{static{r(this,"FramerAPI");}requestId;sessionId;#e;agent;#t;#n;#i=new Map;#r=new Map;#g=0;#s;#l;#d;#c;#a;constructor(e){this.agent=e.agentAPI,this.#t=e.pluginAPI,this.#n=e.transport,this.#e=e.cleanup,this.#s=e.projectId,this.#l=e.apiKey,this.#d=e.serverUrl,this.requestId=e.requestId,this.sessionId=e.sessionId,this.#c=e.clientId,this.#a=e.activeBranchId,this.#n.onMessage(t=>{this.#m(t);}),this.#n.setOnError(t=>{this.#u(t);});}#u(e){for(let t of this.#i.values())t.reject(e);this.#i.clear();for(let t of this.#r.values())t.reject(e);this.#r.clear(),this.#t[w.rejectAllPending](e);}#p(){return `req-${++this.#g}-${Date.now()}`}#m=r(e=>{switch(e.type){case "screenshotResult":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=Buffer.from(e.data,"base64");t.resolve({data:i,mimeType:e.mimeType});}return true}case "screenshotError":{let t=this.#i.get(e.id);if(t){this.#i.delete(e.id);let i=e.code??"INTERNAL";t.reject(new D(e.error,i,e.ref?{ref:e.ref}:void 0));}return true}case "exportSVGResult":{let t=this.#r.get(e.id);return t&&(this.#r.delete(e.id),t.resolve(e.data)),true}case "exportSVGError":{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,e.ref?{ref:e.ref}:void 0));}return true}default:return false}},"#handleServerApiResponse");static create(e){let t=new n(e);return new Proxy(t,{get(i,o){if(o in i)return Reflect.get(i,o);if(wn(o)){let s=w[o],d=Reflect.get(i.#t,s);return typeof d=="function"?d.bind(i.#t):d}if(!Jn(o))return;let a=Reflect.get(i.#t,o);return typeof a=="function"?a.bind(i.#t):a},has(i,o){return o in i||wn(o)?true:Jn(o)?o in i.#t:false}})}async#o(){this.#u(new D("Connection closed","PROJECT_CLOSED")),await this.#e();}disconnect=r(()=>this.#o(),"disconnect");reconnect=r(async e=>{let t=e?.expectedInitialBranchId??this.#a;await this.#o();let i=await Ht(this.#s,this.#l,this.#c,{serverUrlOverride:this.#d,expectedInitialBranchId:t});this.#n.replaceSocket(i.ws),this.#e=i.cleanup,this.requestId=i.requestId,this.sessionId=i.sessionId,this.#a=i.activeBranchId??t;},"reconnect");screenshot=r((e,t)=>{let i=this.#p(),{format:o,quality:a,scale:s,clip:d}=t??{};return new Promise((P,g)=>{this.#i.set(i,{resolve:P,reject:g}),this.#n.send({type:"screenshot",id:i,nodeId:e,format:o,quality:a,scale:s,clip:d});})},"screenshot");exportSVG=r(e=>{let t=this.#p();return new Promise((i,o)=>{this.#r.set(t,{resolve:i,reject:o}),this.#n.send({type:"exportSVG",id:t,nodeId:e});})},"exportSVG");[Symbol.dispose]=()=>{this.#o();};[Symbol.asyncDispose]=()=>this.#o()};var Xa=/^.+--([A-Za-z0-9]+)/u,jr=/^[A-Za-z0-9]{20}$/u,Za="main";function Ja(n){if(jr.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 a=decodeURIComponent(o),d=a.match(Xa)?.[1]??a;if(jr.test(d))return d}}return null}catch{return null}}r(Ja,"parseProjectId");function Hr(n){let e=Ja(n);if(!e)return null;let t=Qa(n);return {projectId:e,branchId:t??Za,...t===null?{}:{expectedInitialBranchId:t}}}r(Hr,"parseProjectConnectionTarget");function Qa(n){try{return new URL(n,"https://framer.com").searchParams.get("branch")?.trim()||null}catch{return null}}r(Qa,"parseBranchId");async function _r(n,e,t){let i=performance.now();if(!n)throw new D("FRAMER_PROJECT_URL environment variable is required","INVALID_REQUEST");let o=Hr(n);if(!o)throw new D(`Invalid project URL or ID: ${n}`,"INVALID_REQUEST");let{projectId:a,branchId:s,expectedInitialBranchId:d}=o,P=e??Pe("FRAMER_API_KEY");if(!P)throw new D("FRAMER_API_KEY environment variable is required","INVALID_REQUEST");let g=t?.clientId?.trim()||`framer-api/${Ut}`,I=await Ht(a,P,g,{serverUrlOverride:t?.serverUrl,expectedInitialBranchId:d});try{let F=new jt(I.ws),z={transport:F,mode:I.pluginReadyData.mode,permissionMap:I.pluginReadyData.permissionMap,environmentInfo:I.pluginReadyData.environmentInfo,origin:null,theme:null,initialState:I.pluginReadyData.initialState},y=new xe(z),c=new Te(y),S=new Bt(y),u=r(async()=>{let m=((performance.now()-i)/1e3).toFixed(2);I.logger.debug(`Connection ended after ${m}s`),await I.cleanup();},"cleanup");return _t.create({pluginAPI:c,agentAPI:S,transport:F,cleanup:u,projectId:a,apiKey:P,serverUrl:t?.serverUrl,clientId:I.clientId,activeBranchId:I.activeBranchId??s,requestId:I.requestId,sessionId:I.sessionId})}catch(F){throw await I.cleanup(),F}}r(_r,"connect");async function es(n,e,t,i){let o=await _r(n,t,i);try{return await e(o)}finally{await o.disconnect();}}r(es,"withConnection");
|
|
10
|
+
export{fa as $framerApiInternal,ht as BooleanField,ke as BooleanVariable,Be as BorderVariable,Dt as CollectionReferenceField,bt as ColorField,we as ColorVariable,Je as ComponentInstanceNode,se as ComponentNode,_e as ConicGradient,Pt as DateField,Re as DateVariable,j as DesignPageNode,Z as EnumCase,vt as EnumField,Me as EnumVariable,de as ErrorCode,St as FieldDivider,Ft as FileField,Le as FileVariable,Ct as FormattedTextField,Ee as FormattedTextVariable,O as FrameNode,D as FramerAPIError,ee as FramerPluginClosedError,it as FramerPluginError,Oe as ImageField,Ve as ImageVariable,je as LinearGradient,Tt as LinkField,We as LinkVariable,kt as MultiCollectionReferenceField,It as NumberField,Ne as NumberVariable,He as RadialGradient,Xe as SVGNode,xt as StringField,Ae as StringVariable,ae as TextNode,$e as UnsupportedComputedValue,ze as UnsupportedField,Ue as UnsupportedVariable,nt as VectorSet,wt as VectorSetItem,Ze as VectorSetItemNode,Qe as VectorSetNode,$ as WebPageNode,pa as configure,_r as connect,le as framer,Ol as hasGridLayout,Ul as hasStackLayout,Zi as isBreakpoint,ra as isCodeFileComponentExport,oa as isCodeFileOverrideExport,ye as isColorStyle,Xi as isComponentGestureVariant,be as isComponentInstanceNode,tr as isComponentNode,Do as isComponentVariable,Pn as isComponentVariant,Wo as isComputedValue,nr as isDesignPageNode,ko as isField,Ao as isFileAsset,Mt as isFrameNode,Mo as isImageAsset,ga as isRetryableError,Qi as isSVGNode,Ji as isTextNode,Tn as isTextStyle,ri as isVariable,rr as isVectorSetItemNode,ir as isVectorSetNode,er as isWebPageNode,ml as supportsAspectRatio,bl as supportsBackgroundColor,Il as supportsBackgroundColorData,Tl as supportsBackgroundGradient,Pl as supportsBackgroundGradientData,xl as supportsBackgroundImage,Cl as supportsBackgroundImageData,Dl as supportsBorder,vl as supportsBorderRadius,Zo as supportsBreakpoint,Ml as supportsComponentInfo,Yi as supportsComponentVariant,wl as supportsFont,Vl as supportsFontData,Bl as supportsImageRendering,Ll as supportsInlineTextStyle,Wl as supportsInlineTextStyleData,qi as supportsLayout,Rl as supportsLink,hl as supportsLocked,fl as supportsName,Fl as supportsOpacity,El as supportsOverflow,ul as supportsPins,cl as supportsPosition,Sl as supportsRotation,kl as supportsSVG,pl as supportsSize,gl as supportsSizeConstraints,Nl as supportsTextTruncation,yl as supportsVisible,Al as supportsZIndex,es as withConnection};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "framer-api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
"prepublishOnly": "echo 'Please use make for publishing' && exit 1"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"devalue": "^5.6.4",
|
|
34
|
+
"devalue": "^5.8.1",
|
|
36
35
|
"std-env": "^4.0.0"
|
|
37
36
|
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"csstype": "^3.1.1"
|
|
39
|
+
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@biomejs/biome": "1.9.4",
|
|
40
42
|
"@framerjs/framer-api-devkit": "0.0.0",
|
|
@@ -42,8 +44,9 @@
|
|
|
42
44
|
"@swc/core": "1.15.3",
|
|
43
45
|
"@swc/jest": "^0.2.37",
|
|
44
46
|
"@types/node": "24.10.15",
|
|
47
|
+
"csstype": "^3.1.1",
|
|
45
48
|
"eslint-plugin-framer-studio": "1.0.0",
|
|
46
|
-
"framer-plugin": "
|
|
49
|
+
"framer-plugin": "4.0.0-alpha.0",
|
|
47
50
|
"tsup": "^8.5.1",
|
|
48
51
|
"tsx": "^4.19.2",
|
|
49
52
|
"typescript": "^5.9.2",
|