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, pattern, UI } from "commonfabric";
const define = undefined;
const runtimeDeps = undefined;
const __cfAmdHooks = undefined;
interface Spot {
active: boolean;
spotNumber: string;
label?: string;
}
interface Person {
name: string;
email: string;
commuteMode: string;
priorityRank: number;
defaultSpot?: string;
spotPreferences: string[];
isFirst: boolean;
isLast: boolean;
}
interface State {
people: Person[];
editingPersonName: string | null;
removePersonConfirmTarget: string | null;
spots: Spot[];
}
const __cfLift_1 = __cfHelpers.lift<{
state: {
editingPersonName: string | null;
};
personName: string;
}, boolean>(({ state, personName }) => state.editingPersonName === personName, {
type: "object",
properties: {
state: {
type: "object",
properties: {
editingPersonName: {
anyOf: [{
type: "string"
}, {
type: "null"
}]
}
},
required: ["editingPersonName"]
},
personName: {
type: "string"
}
},
required: ["state", "personName"]
} as const satisfies __cfHelpers.JSONSchema, {
type: "boolean"
} as const satisfies __cfHelpers.JSONSchema);
const __cfLift_2 = __cfHelpers.lift<{
state: {
removePersonConfirmTarget: string | null;
};
personName: string;
}, boolean>(({ state, personName }) => state.removePersonConfirmTarget === personName, {
type: "object",
properties: {
state: {
type: "object",
properties: {
removePersonConfirmTarget: {
anyOf: [{
type: "string"
}, {
type: "null"
}]
}
},
required: ["removePersonConfirmTarget"]
},
personName: {
type: "string"
}
},
required: ["state", "personName"]
} as const satisfies __cfHelpers.JSONSchema, {
type: "boolean"
} as const satisfies __cfHelpers.JSONSchema);
const __cfLift_3 = __cfHelpers.lift<{
state: {
spots: {
spotNumber: string;
label?: string | undefined;
active: boolean;
}[];
};
}, { label: string; value: string; }[]>(({ state }) => state.spots
.filter((s) => s.active)
.map((s) => ({
label: "#" + s.spotNumber + (s.label ? " - " + s.label : ""),
value: s.spotNumber,
})), {
type: "object",
properties: {
state: {
type: "object",
properties: {
spots: {
type: "array",
items: {
type: "object",
properties: {
spotNumber: {
type: "string"
},
label: {
type: "string"
},
active: {
type: "boolean"
}
},
required: ["spotNumber", "active"]
}
}
},
required: ["spots"]
}
},
required: ["state"]
} as const satisfies __cfHelpers.JSONSchema, {
type: "array",
items: {
type: "object",
properties: {
label: {
type: "string"
},
value: {
type: "string"
}
},
required: ["label", "value"]
}
} as const satisfies __cfHelpers.JSONSchema);
const __cfLift_4 = __cfHelpers.lift<{
activeSpotOpts: {
length: number;
};
}, boolean>(({ activeSpotOpts }) => activeSpotOpts.length > 0, {
type: "object",
properties: {
activeSpotOpts: {
type: "object",
properties: {
length: {
type: "number"
}
},
required: ["length"]
}
},
required: ["activeSpotOpts"]
} as const satisfies __cfHelpers.JSONSchema, {
type: "boolean"
} as const satisfies __cfHelpers.JSONSchema);
const __cfLift_5 = __cfHelpers.lift<{
spotPreferences: string[];
}, boolean>(({ spotPreferences }) => spotPreferences.length > 0, {
type: "object",
properties: {
spotPreferences: {
type: "array",
items: {
type: "unknown"
}
}
},
required: ["spotPreferences"]
} as const satisfies __cfHelpers.JSONSchema, {
type: "boolean"
} as const satisfies __cfHelpers.JSONSchema);
const __cfLift_6 = __cfHelpers.lift<{
spotPreferences: string[];
}, string>(({ spotPreferences }) => spotPreferences.map((n) => "#" + n).join(", "), {
type: "object",
properties: {
spotPreferences: {
type: "array",
items: {
type: "string"
}
}
},
required: ["spotPreferences"]
} as const satisfies __cfHelpers.JSONSchema, {
type: "string"
} as const satisfies __cfHelpers.JSONSchema);
const __cfPattern_1 = __cfHelpers.pattern(__cf_pattern_input => {
const person = __cf_pattern_input.key("element");
const state = __cf_pattern_input.key("params", "state");
const personName = person.key("name"), email = person.key("email"), commuteMode = person.key("commuteMode"), priorityRank = person.key("priorityRank"), defaultSpot = person.key("defaultSpot"), spotPreferences = person.key("spotPreferences"), isFirst = person.key("isFirst"), isLast = person.key("isLast");
const isEditing = __cfLift_1({
state: {
editingPersonName: state.key("editingPersonName")
},
personName: personName
}).for("isEditing", true);
const isRemoveConfirm = __cfLift_2({
state: {
removePersonConfirmTarget: state.key("removePersonConfirmTarget")
},
personName: personName
}).for("isRemoveConfirm", true);
const activeSpotOpts = __cfLift_3({ state: {
spots: state.key("spots")
} }).for("activeSpotOpts", true);
return (