{"version":3,"file":"typeAssertions.mjs","names":[],"sources":["../../../src/util/typeAssertions.ts"],"sourcesContent":["import type { FabricObject } from '../shapes/Object/Object';\nimport type { TFiller } from '../typedefs';\nimport type { FabricText } from '../shapes/Text/Text';\nimport type { Pattern } from '../Pattern';\nimport type { Path } from '../shapes/Path';\nimport type { ActiveSelection } from '../shapes/ActiveSelection';\n\nexport const isFiller = (\n  filler: TFiller | string | null,\n): filler is TFiller => {\n  return !!filler && (filler as TFiller).toLive !== undefined;\n};\n\nexport const isSerializableFiller = (\n  filler: TFiller | string | null,\n): filler is TFiller => {\n  return !!filler && typeof (filler as TFiller).toObject === 'function';\n};\n\nexport const isPattern = (filler: TFiller): filler is Pattern => {\n  return (\n    !!filler && (filler as Pattern).offsetX !== undefined && 'source' in filler\n  );\n};\n\nexport const isTextObject = (\n  fabricObject?: FabricObject,\n): fabricObject is FabricText => {\n  return (\n    !!fabricObject &&\n    typeof (fabricObject as FabricText)._renderText === 'function'\n  );\n};\n\nexport const isPath = (fabricObject?: FabricObject): fabricObject is Path => {\n  // we could use instanceof but that would mean pulling in Text code for a simple check\n  // @todo discuss what to do and how to do\n  return (\n    !!fabricObject &&\n    typeof (fabricObject as Path)._renderPathCommands === 'function'\n  );\n};\n\nexport const isActiveSelection = (\n  fabricObject?: FabricObject,\n): fabricObject is ActiveSelection =>\n  !!fabricObject && 'multiSelectionStacking' in fabricObject;\n"],"mappings":";AAOA,MAAa,YACX,WACsB;AACtB,QAAO,CAAC,CAAC,UAAW,OAAmB,WAAW,KAAA;;AAGpD,MAAa,wBACX,WACsB;AACtB,QAAO,CAAC,CAAC,UAAU,OAAQ,OAAmB,aAAa;;AAG7D,MAAa,aAAa,WAAuC;AAC/D,QACE,CAAC,CAAC,UAAW,OAAmB,YAAY,KAAA,KAAa,YAAY;;AAIzE,MAAa,gBACX,iBAC+B;AAC/B,QACE,CAAC,CAAC,gBACF,OAAQ,aAA4B,gBAAgB;;AAIxD,MAAa,UAAU,iBAAsD;AAG3E,QACE,CAAC,CAAC,gBACF,OAAQ,aAAsB,wBAAwB;;AAI1D,MAAa,qBACX,iBAEA,CAAC,CAAC,gBAAgB,4BAA4B"}