{
  "version": 3,
  "sources": ["../../src/records/TLPageState.ts"],
  "sourcesContent": ["import { BaseRecord, createRecordType, defineMigrations, RecordId } from '@bigbluebutton/store'\nimport { JsonObject } from '@bigbluebutton/utils'\nimport { T } from '@bigbluebutton/validate'\nimport { idValidator } from '../misc/id-validator'\nimport { shapeIdValidator } from '../shapes/TLBaseShape'\nimport { CameraRecordType } from './TLCamera'\nimport { TLINSTANCE_ID } from './TLInstance'\nimport { pageIdValidator, TLPage } from './TLPage'\nimport { TLShapeId } from './TLShape'\n\n/**\n * TLInstancePageState\n *\n * State that is unique to a particular page of the document in a particular browser tab\n *\n * @public\n */\nexport interface TLInstancePageState\n\textends BaseRecord<'instance_page_state', TLInstancePageStateId> {\n\tpageId: RecordId<TLPage>\n\tselectedShapeIds: TLShapeId[]\n\thintingShapeIds: TLShapeId[]\n\terasingShapeIds: TLShapeId[]\n\thoveredShapeId: TLShapeId | null\n\teditingShapeId: TLShapeId | null\n\tcroppingShapeId: TLShapeId | null\n\tfocusedGroupId: TLShapeId | null\n\tmeta: JsonObject\n}\n\n/** @internal */\nexport const instancePageStateValidator: T.Validator<TLInstancePageState> = T.model(\n\t'instance_page_state',\n\tT.object({\n\t\ttypeName: T.literal('instance_page_state'),\n\t\tid: idValidator<TLInstancePageStateId>('instance_page_state'),\n\t\tpageId: pageIdValidator,\n\t\tselectedShapeIds: T.arrayOf(shapeIdValidator),\n\t\thintingShapeIds: T.arrayOf(shapeIdValidator),\n\t\terasingShapeIds: T.arrayOf(shapeIdValidator),\n\t\thoveredShapeId: shapeIdValidator.nullable(),\n\t\teditingShapeId: shapeIdValidator.nullable(),\n\t\tcroppingShapeId: shapeIdValidator.nullable(),\n\t\tfocusedGroupId: shapeIdValidator.nullable(),\n\t\tmeta: T.jsonValue as T.ObjectValidator<JsonObject>,\n\t})\n)\n\n/** @internal */\nexport const instancePageStateVersions = {\n\tAddCroppingId: 1,\n\tRemoveInstanceIdAndCameraId: 2,\n\tAddMeta: 3,\n\tRenameProperties: 4,\n\tRenamePropertiesAgain: 5,\n} as const\n\n/** @public */\nexport const instancePageStateMigrations = defineMigrations({\n\tcurrentVersion: instancePageStateVersions.RenamePropertiesAgain,\n\tmigrators: {\n\t\t[instancePageStateVersions.AddCroppingId]: {\n\t\t\tup(instance) {\n\t\t\t\treturn { ...instance, croppingShapeId: null }\n\t\t\t},\n\t\t\tdown({ croppingShapeId: _croppingShapeId, ...instance }) {\n\t\t\t\treturn instance\n\t\t\t},\n\t\t},\n\t\t[instancePageStateVersions.RemoveInstanceIdAndCameraId]: {\n\t\t\tup({ instanceId: _, cameraId: __, ...instance }) {\n\t\t\t\treturn instance\n\t\t\t},\n\t\t\tdown(instance) {\n\t\t\t\t// this should never be called since we bump the schema version\n\t\t\t\treturn {\n\t\t\t\t\t...instance,\n\t\t\t\t\tinstanceId: TLINSTANCE_ID,\n\t\t\t\t\tcameraId: CameraRecordType.createId('void'),\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t[instancePageStateVersions.AddMeta]: {\n\t\t\tup: (record) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t\tmeta: {},\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: ({ meta: _, ...record }) => {\n\t\t\t\treturn {\n\t\t\t\t\t...record,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t[instancePageStateVersions.RenameProperties]: {\n\t\t\t// this migration is cursed: it was written wrong and doesn't do anything.\n\t\t\t// rather than replace it, I've added another migration below that fixes it.\n\t\t\tup: (record) => {\n\t\t\t\tconst {\n\t\t\t\t\tselectedShapeIds,\n\t\t\t\t\thintingShapeIds,\n\t\t\t\t\terasingShapeIds,\n\t\t\t\t\thoveredShapeId,\n\t\t\t\t\teditingShapeId,\n\t\t\t\t\tcroppingShapeId,\n\t\t\t\t\tfocusedGroupId,\n\t\t\t\t\t...rest\n\t\t\t\t} = record\n\t\t\t\treturn {\n\t\t\t\t\tselectedShapeIds: selectedShapeIds,\n\t\t\t\t\thintingShapeIds: hintingShapeIds,\n\t\t\t\t\terasingShapeIds: erasingShapeIds,\n\t\t\t\t\thoveredShapeId: hoveredShapeId,\n\t\t\t\t\teditingShapeId: editingShapeId,\n\t\t\t\t\tcroppingShapeId: croppingShapeId,\n\t\t\t\t\tfocusedGroupId: focusedGroupId,\n\t\t\t\t\t...rest,\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (record) => {\n\t\t\t\tconst {\n\t\t\t\t\tselectedShapeIds,\n\t\t\t\t\thintingShapeIds,\n\t\t\t\t\terasingShapeIds,\n\t\t\t\t\thoveredShapeId,\n\t\t\t\t\teditingShapeId,\n\t\t\t\t\tcroppingShapeId,\n\t\t\t\t\tfocusedGroupId,\n\t\t\t\t\t...rest\n\t\t\t\t} = record\n\t\t\t\treturn {\n\t\t\t\t\tselectedShapeIds: selectedShapeIds,\n\t\t\t\t\thintingShapeIds: hintingShapeIds,\n\t\t\t\t\terasingShapeIds: erasingShapeIds,\n\t\t\t\t\thoveredShapeId: hoveredShapeId,\n\t\t\t\t\teditingShapeId: editingShapeId,\n\t\t\t\t\tcroppingShapeId: croppingShapeId,\n\t\t\t\t\tfocusedGroupId: focusedGroupId,\n\t\t\t\t\t...rest,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t[instancePageStateVersions.RenamePropertiesAgain]: {\n\t\t\tup: (record) => {\n\t\t\t\tconst {\n\t\t\t\t\tselectedIds,\n\t\t\t\t\thintingIds,\n\t\t\t\t\terasingIds,\n\t\t\t\t\thoveredId,\n\t\t\t\t\teditingId,\n\t\t\t\t\tcroppingShapeId,\n\t\t\t\t\tcroppingId,\n\t\t\t\t\tfocusLayerId,\n\t\t\t\t\t...rest\n\t\t\t\t} = record\n\t\t\t\treturn {\n\t\t\t\t\t...rest,\n\t\t\t\t\tselectedShapeIds: selectedIds,\n\t\t\t\t\thintingShapeIds: hintingIds,\n\t\t\t\t\terasingShapeIds: erasingIds,\n\t\t\t\t\thoveredShapeId: hoveredId,\n\t\t\t\t\teditingShapeId: editingId,\n\t\t\t\t\tcroppingShapeId: croppingShapeId ?? croppingId ?? null,\n\t\t\t\t\tfocusedGroupId: focusLayerId,\n\t\t\t\t}\n\t\t\t},\n\t\t\tdown: (record) => {\n\t\t\t\tconst {\n\t\t\t\t\tselectedShapeIds,\n\t\t\t\t\thintingShapeIds,\n\t\t\t\t\terasingShapeIds,\n\t\t\t\t\thoveredShapeId,\n\t\t\t\t\teditingShapeId,\n\t\t\t\t\tcroppingShapeId,\n\t\t\t\t\tfocusedGroupId,\n\t\t\t\t\t...rest\n\t\t\t\t} = record\n\t\t\t\treturn {\n\t\t\t\t\t...rest,\n\t\t\t\t\tselectedIds: selectedShapeIds,\n\t\t\t\t\thintingIds: hintingShapeIds,\n\t\t\t\t\terasingIds: erasingShapeIds,\n\t\t\t\t\thoveredId: hoveredShapeId,\n\t\t\t\t\teditingId: editingShapeId,\n\t\t\t\t\tcroppingId: croppingShapeId,\n\t\t\t\t\tfocusLayerId: focusedGroupId,\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n})\n\n/** @public */\nexport const InstancePageStateRecordType = createRecordType<TLInstancePageState>(\n\t'instance_page_state',\n\t{\n\t\tmigrations: instancePageStateMigrations,\n\t\tvalidator: instancePageStateValidator,\n\t\tscope: 'session',\n\t}\n).withDefaultProperties(\n\t(): Omit<TLInstancePageState, 'id' | 'typeName' | 'pageId'> => ({\n\t\teditingShapeId: null,\n\t\tcroppingShapeId: null,\n\t\tselectedShapeIds: [],\n\t\thoveredShapeId: null,\n\t\terasingShapeIds: [],\n\t\thintingShapeIds: [],\n\t\tfocusedGroupId: null,\n\t\tmeta: {},\n\t})\n)\n\n/** @public */\nexport type TLInstancePageStateId = RecordId<TLInstancePageState>\n"],
  "mappings": "AAAA,SAAqB,kBAAkB,wBAAkC;AAEzE,SAAS,SAAS;AAClB,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SA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