{ "version": 3, "sources": ["../../../../src/lib/ui/hooks/useEditorEvents.ts"], "sourcesContent": ["import { useEditor } from '@tldraw/editor'\nimport { useEffect } from 'react'\nimport { useToasts } from './useToastsProvider'\n\n/** @internal */\nexport function useEditorEvents() {\n\tconst editor = useEditor()\n\tconst { addToast } = useToasts()\n\n\tuseEffect(() => {\n\t\tfunction handleMaxShapes({ name, count }: { name: string; pageId: string; count: number }) {\n\t\t\taddToast({\n\t\t\t\ttitle: 'Maximum Shapes Reached',\n\t\t\t\tdescription: `You've reached the maximum number of shapes allowed on ${name} (${count}). Please delete some shapes or move to a different page to continue.`,\n\t\t\t})\n\t\t}\n\n\t\teditor.addListener('max-shapes', handleMaxShapes)\n\t\treturn () => {\n\t\t\teditor.removeListener('max-shapes', handleMaxShapes)\n\t\t}\n\t}, [editor, addToast])\n}\n"], "mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAGnB,SAAS,kBAAkB;AACjC,QAAM,SAAS,UAAU;AACzB,QAAM,EAAE,SAAS,IAAI,UAAU;AAE/B,YAAU,MAAM;AACf,aAAS,gBAAgB,EAAE,MAAM,MAAM,GAAoD;AAC1F,eAAS;AAAA,QACR,OAAO;AAAA,QACP,aAAa,0DAA0D,IAAI,KAAK,KAAK;AAAA,MACtF,CAAC;AAAA,IACF;AAEA,WAAO,YAAY,cAAc,eAAe;AAChD,WAAO,MAAM;AACZ,aAAO,eAAe,cAAc,eAAe;AAAA,IACpD;AAAA,EACD,GAAG,CAAC,QAAQ,QAAQ,CAAC;AACtB;", "names": [] }