{"version":3,"file":"useTimelineViewportBounds.mjs","names":[],"sources":["../../../src/hooks/viewport/useTimelineViewportBounds.ts"],"sourcesContent":["import { useTimelineExternalStore } from '#react/hooks/core/useTimelineExternalStore';\nimport type { TimelineEngine } from '@techsquidtv/canvas-timeline-core';\n\nconst boundsEvents = ['content:change', 'viewport:resize', 'zoom:change', 'state:settled'] as const;\n\nfunction getBounds(engine: TimelineEngine) {\n  return {\n    maxContentTime: engine.maxContentTime,\n    maxScrollLeft: engine.maxScrollLeft,\n    maxScrollTop: engine.maxScrollTop,\n    minZoomScale: engine.minZoomScale,\n    maxZoomScale: engine.maxZoomScale,\n  };\n}\n\n/** Observes limits even when content, dimensions, or policy changes leave live values unchanged. */\nexport function useTimelineViewportBounds() {\n  return useTimelineExternalStore(\n    boundsEvents,\n    getBounds,\n    (previous, next) =>\n      previous.maxContentTime.v === next.maxContentTime.v &&\n      previous.maxContentTime.r === next.maxContentTime.r &&\n      previous.maxScrollLeft === next.maxScrollLeft &&\n      previous.maxScrollTop === next.maxScrollTop &&\n      previous.minZoomScale === next.minZoomScale &&\n      previous.maxZoomScale === next.maxZoomScale\n  );\n}\n"],"mappings":";;AAGA,MAAM,eAAe;CAAC;CAAkB;CAAmB;CAAe;AAAe;AAEzF,SAAS,UAAU,QAAwB;CACzC,OAAO;EACL,gBAAgB,OAAO;EACvB,eAAe,OAAO;EACtB,cAAc,OAAO;EACrB,cAAc,OAAO;EACrB,cAAc,OAAO;CACvB;AACF;;AAGA,SAAgB,4BAA4B;CAC1C,OAAO,yBACL,cACA,YACC,UAAU,SACT,SAAS,eAAe,MAAM,KAAK,eAAe,KAClD,SAAS,eAAe,MAAM,KAAK,eAAe,KAClD,SAAS,kBAAkB,KAAK,iBAChC,SAAS,iBAAiB,KAAK,gBAC/B,SAAS,iBAAiB,KAAK,gBAC/B,SAAS,iBAAiB,KAAK,YACnC;AACF"}