function __cfHardenFn(fn: Function) { Object.freeze(fn); const prototype = fn.prototype; if (prototype && typeof prototype === "object") { Object.freeze(prototype); } return fn; } import { __cfHelpers } from "commonfabric"; import { computed, handler, ifElse, pattern, UI, Writable } from "commonfabric"; const define = undefined; const runtimeDeps = undefined; const __cfAmdHooks = undefined; const openNoteEditor = handler({ type: "unknown" } as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { subPieces: { type: "array", items: { type: "string" } }, editingNoteIndex: { type: ["number", "undefined"] }, editingNoteText: { type: "string" }, index: { type: "number" } }, required: ["subPieces", "editingNoteIndex", "editingNoteText", "index"] } as const satisfies __cfHelpers.JSONSchema, (_event, state) => state); const openSettings = handler({ type: "unknown" } as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { settingsModuleIndex: { type: ["number", "undefined"] }, index: { type: "number" } }, required: ["settingsModuleIndex", "index"] } as const satisfies __cfHelpers.JSONSchema, (_event, state) => state); const toggleExpanded = handler({ type: "unknown" } as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { expandedIndex: { type: ["number", "undefined"] }, index: { type: "number" } }, required: ["expandedIndex", "index"] } as const satisfies __cfHelpers.JSONSchema, (_event, state) => state); const trashSubPiece = handler({ type: "unknown" } as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { subPieces: { type: "array", items: { type: "string" } }, trashedSubPieces: { type: "array", items: { type: "string" } }, expandedIndex: { type: ["number", "undefined"] }, settingsModuleIndex: { type: ["number", "undefined"] }, index: { type: "number" } }, required: ["subPieces", "trashedSubPieces", "expandedIndex", "settingsModuleIndex", "index"] } as const satisfies __cfHelpers.JSONSchema, (_event, state) => state); interface Item { note?: string; collapsed?: boolean; pinned?: boolean; allowMultiple: boolean; } const __cfLift_1 = __cfHelpers.lift<{ items: Item[]; }, { entry: Item; index: number; isExpanded: boolean; isPinned: boolean; allowMultiple: boolean; }[]>(({ items }) => items.map((entry, index) => ({ entry, index, isExpanded: index === 0, isPinned: entry.pinned || false, allowMultiple: entry.allowMultiple, })), { type: "object", properties: { items: { type: "array", items: { $ref: "#/$defs/Item" } } }, required: ["items"], $defs: { Item: { type: "object", properties: { note: { type: "string" }, collapsed: { type: "boolean" }, pinned: { type: "boolean" }, allowMultiple: { type: "boolean" } }, required: ["allowMultiple"] } } } as const satisfies __cfHelpers.JSONSchema, { type: "array", items: { type: "object", properties: { entry: { $ref: "#/$defs/Item" }, index: { type: "number" }, isExpanded: { type: "boolean" }, isPinned: { type: "boolean" }, allowMultiple: { type: "boolean" } }, required: ["entry", "index", "isExpanded", "isPinned", "allowMultiple"] }, $defs: { Item: { type: "object", properties: { note: { type: "string" }, collapsed: { type: "boolean" }, pinned: { type: "boolean" }, allowMultiple: { type: "boolean" } }, required: ["allowMultiple"] } } } as const satisfies __cfHelpers.JSONSchema); const __cfLift_2 = __cfHelpers.lift<{ entry: { collapsed?: boolean | undefined; }; }, boolean>(({ entry }) => !entry.collapsed, { type: "object", properties: { entry: { type: "object", properties: { collapsed: { anyOf: [{ type: "undefined" }, { type: "boolean" }] } } } }, required: ["entry"] } as const satisfies __cfHelpers.JSONSchema, { type: "boolean" } as const satisfies __cfHelpers.JSONSchema); const __cfLift_3 = __cfHelpers.lift<{ entry: { note?: string | undefined; }; }, { fontWeight: string; }>(({ entry }) => ({ fontWeight: entry?.note ? "700" : "400", }), { type: "object", properties: { entry: { type: "object", properties: { note: { type: "string" } } } }, required: ["entry"] } as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { fontWeight: { type: "string" } }, required: ["fontWeight"] } as const satisfies __cfHelpers.JSONSchema); const __cfLift_4 = __cfHelpers.lift<{ entry: { note?: string | undefined; }; }, string>(({ entry }) => entry?.note || "Add note...", { type: "object", properties: { entry: { type: "object", properties: { note: { type: "string" } } } }, required: ["entry"] } as const satisfies __cfHelpers.JSONSchema, { type: "string" } as const satisfies __cfHelpers.JSONSchema); const __cfLift_5 = __cfHelpers.lift<{ isExpanded: boolean; }, boolean>(({ isExpanded }) => !isExpanded, { type: "object", properties: { isExpanded: { type: "boolean" } }, required: ["isExpanded"] } as const satisfies __cfHelpers.JSONSchema, { type: "boolean" } as const satisfies __cfHelpers.JSONSchema); const __cfLift_6 = __cfHelpers.lift<{ isExpanded: boolean; }, boolean>(({ isExpanded }) => !isExpanded, { type: "object", properties: { isExpanded: { type: "boolean" } }, required: ["isExpanded"] } as const satisfies __cfHelpers.JSONSchema, { type: "boolean" } as const satisfies __cfHelpers.JSONSchema); const __cfPattern_1 = __cfHelpers.pattern(__cf_pattern_input => { const entry = __cf_pattern_input.key("element", "entry"); const index = __cf_pattern_input.key("element", "index"); const isExpanded = __cf_pattern_input.key("element", "isExpanded"); const isPinned = __cf_pattern_input.key("element", "isPinned"); const allowMultiple = __cf_pattern_input.key("element", "allowMultiple"); const subPieces = __cf_pattern_input.key("params", "subPieces"); const editingNoteIndex = __cf_pattern_input.key("params", "editingNoteIndex"); const editingNoteText = __cf_pattern_input.key("params", "editingNoteText"); const settingsModuleIndex = __cf_pattern_input.key("params", "settingsModuleIndex"); const expandedIndex = __cf_pattern_input.key("params", "expandedIndex"); const trashedSubPieces = __cf_pattern_input.key("params", "trashedSubPieces"); return ifElse({ type: "boolean" } as const satisfies __cfHelpers.JSONSchema, { anyOf: [{}, { type: "object", properties: {} }] } as const satisfies __cfHelpers.JSONSchema, { type: "null" } as const satisfies __cfHelpers.JSONSchema, { anyOf: [{ type: "null" }, {}] } as const satisfies __cfHelpers.JSONSchema, __cfLift_2({ entry: { collapsed: entry.key("collapsed") } }),