lightly-studio 0.4.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. lightly_studio/__init__.py +12 -0
  2. lightly_studio/api/__init__.py +0 -0
  3. lightly_studio/api/app.py +131 -0
  4. lightly_studio/api/cache.py +77 -0
  5. lightly_studio/api/db_tables.py +35 -0
  6. lightly_studio/api/features.py +5 -0
  7. lightly_studio/api/routes/api/annotation.py +305 -0
  8. lightly_studio/api/routes/api/annotation_label.py +87 -0
  9. lightly_studio/api/routes/api/annotations/__init__.py +7 -0
  10. lightly_studio/api/routes/api/annotations/create_annotation.py +52 -0
  11. lightly_studio/api/routes/api/caption.py +100 -0
  12. lightly_studio/api/routes/api/classifier.py +384 -0
  13. lightly_studio/api/routes/api/dataset.py +191 -0
  14. lightly_studio/api/routes/api/dataset_tag.py +266 -0
  15. lightly_studio/api/routes/api/embeddings2d.py +90 -0
  16. lightly_studio/api/routes/api/exceptions.py +114 -0
  17. lightly_studio/api/routes/api/export.py +114 -0
  18. lightly_studio/api/routes/api/features.py +17 -0
  19. lightly_studio/api/routes/api/frame.py +241 -0
  20. lightly_studio/api/routes/api/image.py +155 -0
  21. lightly_studio/api/routes/api/metadata.py +161 -0
  22. lightly_studio/api/routes/api/operator.py +75 -0
  23. lightly_studio/api/routes/api/sample.py +103 -0
  24. lightly_studio/api/routes/api/selection.py +87 -0
  25. lightly_studio/api/routes/api/settings.py +41 -0
  26. lightly_studio/api/routes/api/status.py +19 -0
  27. lightly_studio/api/routes/api/text_embedding.py +50 -0
  28. lightly_studio/api/routes/api/validators.py +17 -0
  29. lightly_studio/api/routes/api/video.py +133 -0
  30. lightly_studio/api/routes/healthz.py +13 -0
  31. lightly_studio/api/routes/images.py +104 -0
  32. lightly_studio/api/routes/video_frames_media.py +116 -0
  33. lightly_studio/api/routes/video_media.py +223 -0
  34. lightly_studio/api/routes/webapp.py +51 -0
  35. lightly_studio/api/server.py +94 -0
  36. lightly_studio/core/__init__.py +0 -0
  37. lightly_studio/core/add_samples.py +533 -0
  38. lightly_studio/core/add_videos.py +294 -0
  39. lightly_studio/core/dataset.py +780 -0
  40. lightly_studio/core/dataset_query/__init__.py +14 -0
  41. lightly_studio/core/dataset_query/boolean_expression.py +67 -0
  42. lightly_studio/core/dataset_query/dataset_query.py +317 -0
  43. lightly_studio/core/dataset_query/field.py +113 -0
  44. lightly_studio/core/dataset_query/field_expression.py +79 -0
  45. lightly_studio/core/dataset_query/match_expression.py +23 -0
  46. lightly_studio/core/dataset_query/order_by.py +79 -0
  47. lightly_studio/core/dataset_query/sample_field.py +37 -0
  48. lightly_studio/core/dataset_query/tags_expression.py +46 -0
  49. lightly_studio/core/image_sample.py +36 -0
  50. lightly_studio/core/loading_log.py +56 -0
  51. lightly_studio/core/sample.py +291 -0
  52. lightly_studio/core/start_gui.py +54 -0
  53. lightly_studio/core/video_sample.py +38 -0
  54. lightly_studio/dataset/__init__.py +0 -0
  55. lightly_studio/dataset/edge_embedding_generator.py +155 -0
  56. lightly_studio/dataset/embedding_generator.py +129 -0
  57. lightly_studio/dataset/embedding_manager.py +349 -0
  58. lightly_studio/dataset/env.py +20 -0
  59. lightly_studio/dataset/file_utils.py +49 -0
  60. lightly_studio/dataset/fsspec_lister.py +275 -0
  61. lightly_studio/dataset/mobileclip_embedding_generator.py +158 -0
  62. lightly_studio/dataset/perception_encoder_embedding_generator.py +260 -0
  63. lightly_studio/db_manager.py +166 -0
  64. lightly_studio/dist_lightly_studio_view_app/_app/env.js +1 -0
  65. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/0.GcXvs2l7.css +1 -0
  66. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/12.Dx6SXgAb.css +1 -0
  67. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/17.9X9_k6TP.css +1 -0
  68. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/18.BxiimdIO.css +1 -0
  69. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/2.CkOblLn7.css +1 -0
  70. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/ClassifierSamplesGrid.BJbCDlvs.css +1 -0
  71. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/LightlyLogo.BNjCIww-.png +0 -0
  72. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Bold.DGvYQtcs.ttf +0 -0
  73. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Italic-VariableFont_wdth_wght.B4AZ-wl6.ttf +0 -0
  74. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Medium.DVUZMR_6.ttf +0 -0
  75. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-Regular.DxJTClRG.ttf +0 -0
  76. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-SemiBold.D3TTYgdB.ttf +0 -0
  77. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/OpenSans-VariableFont_wdth_wght.BZBpG5Iz.ttf +0 -0
  78. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_layout.CefECEWA.css +1 -0
  79. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_layout.D5tDcjY-.css +1 -0
  80. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_page.9X9_k6TP.css +1 -0
  81. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_page.BxiimdIO.css +1 -0
  82. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_page.Dx6SXgAb.css +1 -0
  83. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/transform._-1mPSEI.css +1 -0
  84. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/0dDyq72A.js +20 -0
  85. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/69_IOA4Y.js +1 -0
  86. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BK4An2kI.js +1 -0
  87. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BRmB-kJ9.js +1 -0
  88. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/B_1cpokE.js +1 -0
  89. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BiqpDEr0.js +1 -0
  90. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BpLiSKgx.js +1 -0
  91. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BscxbINH.js +39 -0
  92. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/C1FmrZbK.js +1 -0
  93. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/C80h3dJx.js +1 -0
  94. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/C8mfFM-u.js +2 -0
  95. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CGY1p9L4.js +517 -0
  96. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/COfLknXM.js +1 -0
  97. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CWj6FrbW.js +1 -0
  98. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CYgJF_JY.js +1 -0
  99. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CmLg0ys7.js +1 -0
  100. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CvGjimpO.js +1 -0
  101. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D3RDXHoj.js +39 -0
  102. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D4y7iiT3.js +1 -0
  103. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D9SC3jBb.js +1 -0
  104. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DCuAdx1Q.js +20 -0
  105. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DDBy-_jD.js +1 -0
  106. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DIeogL5L.js +1 -0
  107. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DL9a7v5o.js +1 -0
  108. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DSKECuqX.js +39 -0
  109. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D_FFv0Oe.js +1 -0
  110. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DiZ5o5vz.js +1 -0
  111. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DkbXUtyG.js +1 -0
  112. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DmK2hulV.js +1 -0
  113. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DqnHaLTj.js +1 -0
  114. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DtWZc_tl.js +1 -0
  115. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DuUalyFS.js +1 -0
  116. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DwIonDAZ.js +1 -0
  117. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/Il-mSPmK.js +1 -0
  118. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/KNLP4aJU.js +1 -0
  119. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/KjYeVjkE.js +1 -0
  120. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/MErlcOXj.js +1 -0
  121. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/VRI4prUD.js +1 -0
  122. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/VYb2dkNs.js +1 -0
  123. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/VqWvU2yF.js +1 -0
  124. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/dHC3otuL.js +1 -0
  125. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/da7Oy_lO.js +1 -0
  126. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/eAy8rZzC.js +2 -0
  127. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/erjNR5MX.js +1 -0
  128. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/f1oG3eFE.js +1 -0
  129. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/rsLi1iKv.js +20 -0
  130. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/rwuuBP9f.js +1 -0
  131. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/xGHZQ1pe.js +3 -0
  132. lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/app.DrTRUgT3.js +2 -0
  133. lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/start.BK5EOJl2.js +1 -0
  134. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/0.CIvTuljF.js +4 -0
  135. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/1.UBvSzxdA.js +1 -0
  136. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/10.CQ_tiLJa.js +1 -0
  137. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/11.KqkAcaxW.js +1 -0
  138. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/12.DoYsmxQc.js +1 -0
  139. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/13.571n2LZA.js +1 -0
  140. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/14.DGs689M-.js +1 -0
  141. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/15.CWG1ehzT.js +1 -0
  142. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/16.Dpq6jbSh.js +1 -0
  143. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/17.B5AZbHUU.js +1 -0
  144. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/18.CBga8cnq.js +1 -0
  145. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/2.D2HXgz-8.js +1090 -0
  146. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/3.f4HAg-y3.js +1 -0
  147. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/4.BKF4xuKQ.js +1 -0
  148. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/5.BAE0Pm_f.js +39 -0
  149. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/6.CouWWpzA.js +1 -0
  150. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/7.UBHT0ktp.js +1 -0
  151. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/8.FiYNElcc.js +1 -0
  152. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/9.B3-UaT23.js +1 -0
  153. lightly_studio/dist_lightly_studio_view_app/_app/immutable/workers/clustering.worker-DKqeLtG0.js +2 -0
  154. lightly_studio/dist_lightly_studio_view_app/_app/immutable/workers/search.worker-vNSty3B0.js +1 -0
  155. lightly_studio/dist_lightly_studio_view_app/_app/version.json +1 -0
  156. lightly_studio/dist_lightly_studio_view_app/apple-touch-icon-precomposed.png +0 -0
  157. lightly_studio/dist_lightly_studio_view_app/apple-touch-icon.png +0 -0
  158. lightly_studio/dist_lightly_studio_view_app/favicon.png +0 -0
  159. lightly_studio/dist_lightly_studio_view_app/index.html +45 -0
  160. lightly_studio/errors.py +5 -0
  161. lightly_studio/examples/example.py +25 -0
  162. lightly_studio/examples/example_coco.py +27 -0
  163. lightly_studio/examples/example_coco_caption.py +29 -0
  164. lightly_studio/examples/example_metadata.py +369 -0
  165. lightly_studio/examples/example_operators.py +111 -0
  166. lightly_studio/examples/example_selection.py +28 -0
  167. lightly_studio/examples/example_split_work.py +48 -0
  168. lightly_studio/examples/example_video.py +22 -0
  169. lightly_studio/examples/example_video_annotations.py +157 -0
  170. lightly_studio/examples/example_yolo.py +22 -0
  171. lightly_studio/export/coco_captions.py +69 -0
  172. lightly_studio/export/export_dataset.py +104 -0
  173. lightly_studio/export/lightly_studio_label_input.py +120 -0
  174. lightly_studio/export_schema.py +18 -0
  175. lightly_studio/export_version.py +57 -0
  176. lightly_studio/few_shot_classifier/__init__.py +0 -0
  177. lightly_studio/few_shot_classifier/classifier.py +80 -0
  178. lightly_studio/few_shot_classifier/classifier_manager.py +644 -0
  179. lightly_studio/few_shot_classifier/random_forest_classifier.py +495 -0
  180. lightly_studio/metadata/complex_metadata.py +47 -0
  181. lightly_studio/metadata/compute_similarity.py +84 -0
  182. lightly_studio/metadata/compute_typicality.py +67 -0
  183. lightly_studio/metadata/gps_coordinate.py +41 -0
  184. lightly_studio/metadata/metadata_protocol.py +17 -0
  185. lightly_studio/models/__init__.py +1 -0
  186. lightly_studio/models/annotation/__init__.py +0 -0
  187. lightly_studio/models/annotation/annotation_base.py +303 -0
  188. lightly_studio/models/annotation/instance_segmentation.py +56 -0
  189. lightly_studio/models/annotation/links.py +17 -0
  190. lightly_studio/models/annotation/object_detection.py +47 -0
  191. lightly_studio/models/annotation/semantic_segmentation.py +44 -0
  192. lightly_studio/models/annotation_label.py +47 -0
  193. lightly_studio/models/caption.py +49 -0
  194. lightly_studio/models/classifier.py +20 -0
  195. lightly_studio/models/dataset.py +70 -0
  196. lightly_studio/models/embedding_model.py +30 -0
  197. lightly_studio/models/image.py +96 -0
  198. lightly_studio/models/metadata.py +208 -0
  199. lightly_studio/models/range.py +17 -0
  200. lightly_studio/models/sample.py +154 -0
  201. lightly_studio/models/sample_embedding.py +36 -0
  202. lightly_studio/models/settings.py +69 -0
  203. lightly_studio/models/tag.py +96 -0
  204. lightly_studio/models/two_dim_embedding.py +16 -0
  205. lightly_studio/models/video.py +161 -0
  206. lightly_studio/plugins/__init__.py +0 -0
  207. lightly_studio/plugins/base_operator.py +60 -0
  208. lightly_studio/plugins/operator_registry.py +47 -0
  209. lightly_studio/plugins/parameter.py +70 -0
  210. lightly_studio/py.typed +0 -0
  211. lightly_studio/resolvers/__init__.py +0 -0
  212. lightly_studio/resolvers/annotation_label_resolver/__init__.py +22 -0
  213. lightly_studio/resolvers/annotation_label_resolver/create.py +27 -0
  214. lightly_studio/resolvers/annotation_label_resolver/delete.py +28 -0
  215. lightly_studio/resolvers/annotation_label_resolver/get_all.py +37 -0
  216. lightly_studio/resolvers/annotation_label_resolver/get_by_id.py +24 -0
  217. lightly_studio/resolvers/annotation_label_resolver/get_by_ids.py +25 -0
  218. lightly_studio/resolvers/annotation_label_resolver/get_by_label_name.py +24 -0
  219. lightly_studio/resolvers/annotation_label_resolver/names_by_ids.py +25 -0
  220. lightly_studio/resolvers/annotation_label_resolver/update.py +38 -0
  221. lightly_studio/resolvers/annotation_resolver/__init__.py +40 -0
  222. lightly_studio/resolvers/annotation_resolver/count_annotations_by_dataset.py +129 -0
  223. lightly_studio/resolvers/annotation_resolver/create_many.py +124 -0
  224. lightly_studio/resolvers/annotation_resolver/delete_annotation.py +87 -0
  225. lightly_studio/resolvers/annotation_resolver/delete_annotations.py +60 -0
  226. lightly_studio/resolvers/annotation_resolver/get_all.py +85 -0
  227. lightly_studio/resolvers/annotation_resolver/get_all_with_payload.py +179 -0
  228. lightly_studio/resolvers/annotation_resolver/get_by_id.py +34 -0
  229. lightly_studio/resolvers/annotation_resolver/get_by_id_with_payload.py +130 -0
  230. lightly_studio/resolvers/annotation_resolver/update_annotation_label.py +142 -0
  231. lightly_studio/resolvers/annotation_resolver/update_bounding_box.py +68 -0
  232. lightly_studio/resolvers/annotations/__init__.py +1 -0
  233. lightly_studio/resolvers/annotations/annotations_filter.py +88 -0
  234. lightly_studio/resolvers/caption_resolver.py +129 -0
  235. lightly_studio/resolvers/dataset_resolver/__init__.py +55 -0
  236. lightly_studio/resolvers/dataset_resolver/check_dataset_type.py +29 -0
  237. lightly_studio/resolvers/dataset_resolver/create.py +20 -0
  238. lightly_studio/resolvers/dataset_resolver/delete.py +20 -0
  239. lightly_studio/resolvers/dataset_resolver/export.py +267 -0
  240. lightly_studio/resolvers/dataset_resolver/get_all.py +19 -0
  241. lightly_studio/resolvers/dataset_resolver/get_by_id.py +16 -0
  242. lightly_studio/resolvers/dataset_resolver/get_by_name.py +12 -0
  243. lightly_studio/resolvers/dataset_resolver/get_dataset_details.py +27 -0
  244. lightly_studio/resolvers/dataset_resolver/get_hierarchy.py +31 -0
  245. lightly_studio/resolvers/dataset_resolver/get_or_create_child_dataset.py +58 -0
  246. lightly_studio/resolvers/dataset_resolver/get_parent_dataset_by_sample_id.py +27 -0
  247. lightly_studio/resolvers/dataset_resolver/get_parent_dataset_id.py +22 -0
  248. lightly_studio/resolvers/dataset_resolver/get_root_dataset.py +61 -0
  249. lightly_studio/resolvers/dataset_resolver/get_root_datasets_overview.py +41 -0
  250. lightly_studio/resolvers/dataset_resolver/update.py +25 -0
  251. lightly_studio/resolvers/embedding_model_resolver.py +120 -0
  252. lightly_studio/resolvers/image_filter.py +50 -0
  253. lightly_studio/resolvers/image_resolver/__init__.py +21 -0
  254. lightly_studio/resolvers/image_resolver/create_many.py +52 -0
  255. lightly_studio/resolvers/image_resolver/delete.py +20 -0
  256. lightly_studio/resolvers/image_resolver/filter_new_paths.py +23 -0
  257. lightly_studio/resolvers/image_resolver/get_all_by_dataset_id.py +117 -0
  258. lightly_studio/resolvers/image_resolver/get_by_id.py +14 -0
  259. lightly_studio/resolvers/image_resolver/get_dimension_bounds.py +75 -0
  260. lightly_studio/resolvers/image_resolver/get_many_by_id.py +22 -0
  261. lightly_studio/resolvers/image_resolver/get_samples_excluding.py +43 -0
  262. lightly_studio/resolvers/metadata_resolver/__init__.py +15 -0
  263. lightly_studio/resolvers/metadata_resolver/metadata_filter.py +163 -0
  264. lightly_studio/resolvers/metadata_resolver/sample/__init__.py +21 -0
  265. lightly_studio/resolvers/metadata_resolver/sample/bulk_update_metadata.py +46 -0
  266. lightly_studio/resolvers/metadata_resolver/sample/get_by_sample_id.py +24 -0
  267. lightly_studio/resolvers/metadata_resolver/sample/get_metadata_info.py +104 -0
  268. lightly_studio/resolvers/metadata_resolver/sample/get_value_for_sample.py +27 -0
  269. lightly_studio/resolvers/metadata_resolver/sample/set_value_for_sample.py +53 -0
  270. lightly_studio/resolvers/sample_embedding_resolver.py +132 -0
  271. lightly_studio/resolvers/sample_resolver/__init__.py +17 -0
  272. lightly_studio/resolvers/sample_resolver/count_by_dataset_id.py +16 -0
  273. lightly_studio/resolvers/sample_resolver/create.py +16 -0
  274. lightly_studio/resolvers/sample_resolver/create_many.py +25 -0
  275. lightly_studio/resolvers/sample_resolver/get_by_id.py +14 -0
  276. lightly_studio/resolvers/sample_resolver/get_filtered_samples.py +56 -0
  277. lightly_studio/resolvers/sample_resolver/get_many_by_id.py +22 -0
  278. lightly_studio/resolvers/sample_resolver/sample_filter.py +74 -0
  279. lightly_studio/resolvers/settings_resolver.py +62 -0
  280. lightly_studio/resolvers/tag_resolver.py +299 -0
  281. lightly_studio/resolvers/twodim_embedding_resolver.py +119 -0
  282. lightly_studio/resolvers/video_frame_resolver/__init__.py +23 -0
  283. lightly_studio/resolvers/video_frame_resolver/count_video_frames_annotations.py +83 -0
  284. lightly_studio/resolvers/video_frame_resolver/create_many.py +57 -0
  285. lightly_studio/resolvers/video_frame_resolver/get_all_by_dataset_id.py +63 -0
  286. lightly_studio/resolvers/video_frame_resolver/get_by_id.py +13 -0
  287. lightly_studio/resolvers/video_frame_resolver/get_table_fields_bounds.py +44 -0
  288. lightly_studio/resolvers/video_frame_resolver/video_frame_annotations_counter_filter.py +47 -0
  289. lightly_studio/resolvers/video_frame_resolver/video_frame_filter.py +57 -0
  290. lightly_studio/resolvers/video_resolver/__init__.py +27 -0
  291. lightly_studio/resolvers/video_resolver/count_video_frame_annotations_by_video_dataset.py +86 -0
  292. lightly_studio/resolvers/video_resolver/create_many.py +58 -0
  293. lightly_studio/resolvers/video_resolver/filter_new_paths.py +33 -0
  294. lightly_studio/resolvers/video_resolver/get_all_by_dataset_id.py +181 -0
  295. lightly_studio/resolvers/video_resolver/get_by_id.py +22 -0
  296. lightly_studio/resolvers/video_resolver/get_table_fields_bounds.py +72 -0
  297. lightly_studio/resolvers/video_resolver/get_view_by_id.py +52 -0
  298. lightly_studio/resolvers/video_resolver/video_count_annotations_filter.py +50 -0
  299. lightly_studio/resolvers/video_resolver/video_filter.py +98 -0
  300. lightly_studio/selection/__init__.py +1 -0
  301. lightly_studio/selection/mundig.py +143 -0
  302. lightly_studio/selection/select.py +203 -0
  303. lightly_studio/selection/select_via_db.py +273 -0
  304. lightly_studio/selection/selection_config.py +49 -0
  305. lightly_studio/services/annotations_service/__init__.py +33 -0
  306. lightly_studio/services/annotations_service/create_annotation.py +64 -0
  307. lightly_studio/services/annotations_service/delete_annotation.py +22 -0
  308. lightly_studio/services/annotations_service/get_annotation_by_id.py +31 -0
  309. lightly_studio/services/annotations_service/update_annotation.py +54 -0
  310. lightly_studio/services/annotations_service/update_annotation_bounding_box.py +36 -0
  311. lightly_studio/services/annotations_service/update_annotation_label.py +48 -0
  312. lightly_studio/services/annotations_service/update_annotations.py +29 -0
  313. lightly_studio/setup_logging.py +59 -0
  314. lightly_studio/type_definitions.py +31 -0
  315. lightly_studio/utils/__init__.py +3 -0
  316. lightly_studio/utils/download.py +94 -0
  317. lightly_studio/vendor/__init__.py +1 -0
  318. lightly_studio/vendor/mobileclip/ACKNOWLEDGEMENTS +422 -0
  319. lightly_studio/vendor/mobileclip/LICENSE +31 -0
  320. lightly_studio/vendor/mobileclip/LICENSE_weights_data +50 -0
  321. lightly_studio/vendor/mobileclip/README.md +5 -0
  322. lightly_studio/vendor/mobileclip/__init__.py +96 -0
  323. lightly_studio/vendor/mobileclip/clip.py +77 -0
  324. lightly_studio/vendor/mobileclip/configs/mobileclip_b.json +18 -0
  325. lightly_studio/vendor/mobileclip/configs/mobileclip_s0.json +18 -0
  326. lightly_studio/vendor/mobileclip/configs/mobileclip_s1.json +18 -0
  327. lightly_studio/vendor/mobileclip/configs/mobileclip_s2.json +18 -0
  328. lightly_studio/vendor/mobileclip/image_encoder.py +67 -0
  329. lightly_studio/vendor/mobileclip/logger.py +154 -0
  330. lightly_studio/vendor/mobileclip/models/__init__.py +10 -0
  331. lightly_studio/vendor/mobileclip/models/mci.py +933 -0
  332. lightly_studio/vendor/mobileclip/models/vit.py +433 -0
  333. lightly_studio/vendor/mobileclip/modules/__init__.py +4 -0
  334. lightly_studio/vendor/mobileclip/modules/common/__init__.py +4 -0
  335. lightly_studio/vendor/mobileclip/modules/common/mobileone.py +341 -0
  336. lightly_studio/vendor/mobileclip/modules/common/transformer.py +451 -0
  337. lightly_studio/vendor/mobileclip/modules/image/__init__.py +4 -0
  338. lightly_studio/vendor/mobileclip/modules/image/image_projection.py +113 -0
  339. lightly_studio/vendor/mobileclip/modules/image/replknet.py +188 -0
  340. lightly_studio/vendor/mobileclip/modules/text/__init__.py +4 -0
  341. lightly_studio/vendor/mobileclip/modules/text/repmixer.py +281 -0
  342. lightly_studio/vendor/mobileclip/modules/text/tokenizer.py +38 -0
  343. lightly_studio/vendor/mobileclip/text_encoder.py +245 -0
  344. lightly_studio/vendor/perception_encoder/LICENSE.PE +201 -0
  345. lightly_studio/vendor/perception_encoder/README.md +11 -0
  346. lightly_studio/vendor/perception_encoder/vision_encoder/__init__.py +0 -0
  347. lightly_studio/vendor/perception_encoder/vision_encoder/bpe_simple_vocab_16e6.txt.gz +0 -0
  348. lightly_studio/vendor/perception_encoder/vision_encoder/config.py +205 -0
  349. lightly_studio/vendor/perception_encoder/vision_encoder/config_src.py +264 -0
  350. lightly_studio/vendor/perception_encoder/vision_encoder/pe.py +766 -0
  351. lightly_studio/vendor/perception_encoder/vision_encoder/rope.py +352 -0
  352. lightly_studio/vendor/perception_encoder/vision_encoder/tokenizer.py +347 -0
  353. lightly_studio/vendor/perception_encoder/vision_encoder/transforms.py +36 -0
  354. lightly_studio-0.4.6.dist-info/METADATA +88 -0
  355. lightly_studio-0.4.6.dist-info/RECORD +356 -0
  356. lightly_studio-0.4.6.dist-info/WHEEL +4 -0
@@ -0,0 +1 @@
1
+ import{u as a}from"../chunks/da7Oy_lO.js";import{L as d}from"../chunks/Il-mSPmK.js";const s=async({parent:t,params:{dataset_id:e}})=>{const{globalStorage:o}=await t(),{tagsSelected:n}=a({dataset_id:e,kind:["annotation"]});return{annotationsSelectedTagsIds:n,annotationsSelectedAnnotationLabelsIds:o.selectedAnnotationFilterIds}},r=Object.freeze(Object.defineProperty({__proto__:null,load:s},Symbol.toStringTag,{value:"Module"}));export{d as component,r as universal};
@@ -0,0 +1 @@
1
+ import{u as a}from"../chunks/D_FFv0Oe.js";import{u as l}from"../chunks/da7Oy_lO.js";import{u as m}from"../chunks/KNLP4aJU.js";import{L as b}from"../chunks/Il-mSPmK.js";const r=async({params:{dataset_id:e}})=>{const{selectedAnnotationFilterIds:s,textEmbedding:o}=m(),{tagsSelected:t}=l({dataset_id:e,kind:["sample"]}),{dimensionsValues:n}=a();return{samplesSelectedTagsIds:t,samplesDimensions:n,samplesTextEmbedding:o,samplesSelectedAnnotationLabelsIds:s}},c=Object.freeze(Object.defineProperty({__proto__:null,load:r},Symbol.toStringTag,{value:"Module"}));export{b as component,c as universal};
@@ -0,0 +1,39 @@
1
+ import"../chunks/CWj6FrbW.js";import{p as fe,f as p,j as gt,a as he,n as ot,g as e,b as r,s as c,c as S,r as I,t as ge,u as Jt,h as s,d as R,e as st,$ as rt,i as ea}from"../chunks/DkbXUtyG.js";import{c as se,a as i,f as W,t as it,b as De}from"../chunks/CmLg0ys7.js";import{s as Pe}from"../chunks/VqWvU2yF.js";import{i as L,s as T,a as Xe,b as lt,m as dt}from"../chunks/B_1cpokE.js";import{p as be}from"../chunks/C80h3dJx.js";import{I as ft,K as ta,N as aa,d as na,O as oa,u as sa,D as ra,_ as ia,P as la,Q as da,R as ca,C as ua,n as ma,z as ga,T as fa,x as ha,U as va,V as pa}from"../chunks/CGY1p9L4.js";import"../chunks/CvGjimpO.js";import{u as Ye}from"../chunks/KNLP4aJU.js";import{u as ht,k as _a,t as K,s as N,d as ba,e as ya,a as xa}from"../chunks/C8mfFM-u.js";import"../chunks/D_FFv0Oe.js";import"../chunks/69_IOA4Y.js";import{a as $a,g as wa}from"../chunks/xGHZQ1pe.js";import{b as Sa}from"../chunks/DtWZc_tl.js";import{e as ct}from"../chunks/D9SC3jBb.js";import{s as vt,r as pt,p as Ia,b as ut}from"../chunks/DuUalyFS.js";import{S as Aa}from"../chunks/D4y7iiT3.js";import{r as Ce}from"../chunks/BRmB-kJ9.js";import{u as Ca}from"../chunks/VRI4prUD.js";import{I as Da}from"../chunks/dHC3otuL.js";import{s as mt}from"../chunks/eAy8rZzC.js";import{B as Pa,a as Ra,b as Ae,c as Ue,H as ka,d as Ne,D as Ba,e as Ea}from"../chunks/DSKECuqX.js";import{n as Ma,u as La,c as Ta}from"../chunks/VYb2dkNs.js";import{a as Ha,Z as za}from"../chunks/BscxbINH.js";import{b as Fa,u as Ua,a as Na,c as Xa,d as Ya}from"../chunks/DDBy-_jD.js";import{u as Ka,a as Oa}from"../chunks/COfLknXM.js";import{u as ja}from"../chunks/DmK2hulV.js";function Za(_,a){fe(a,!0);/**
2
+ * @license @lucide/svelte v0.482.0 - ISC
3
+ *
4
+ * ISC License
5
+ *
6
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
7
+ *
8
+ * Permission to use, copy, modify, and/or distribute this software for any
9
+ * purpose with or without fee is hereby granted, provided that the above
10
+ * copyright notice and this permission notice appear in all copies.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ *
20
+ */let h=pt(a,["$$slots","$$events","$$legacy"]);const d=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["circle",{cx:"10",cy:"12",r:"2"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22"}]];ft(_,vt({name:"file-image"},()=>h,{get iconNode(){return d},children:(o,w)=>{var b=se(),H=p(b);Pe(H,()=>a.children??gt),i(o,b)},$$slots:{default:!0}})),he()}function Qa(_,a){fe(a,!0);/**
21
+ * @license @lucide/svelte v0.482.0 - ISC
22
+ *
23
+ * ISC License
24
+ *
25
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
26
+ *
27
+ * Permission to use, copy, modify, and/or distribute this software for any
28
+ * purpose with or without fee is hereby granted, provided that the above
29
+ * copyright notice and this permission notice appear in all copies.
30
+ *
31
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
32
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
33
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
34
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
35
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
36
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
37
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38
+ *
39
+ */let h=pt(a,["$$slots","$$events","$$legacy"]);const d=[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18"}],["circle",{cx:"12",cy:"8",r:"2"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2"}]];ft(_,vt({name:"images"},()=>h,{get iconNode(){return d},children:(o,w)=>{var b=se(),H=p(b);Pe(H,()=>a.children??gt),i(o,b)},$$slots:{default:!0}})),he()}var Va=W('<!> <span class="hidden sm:inline">Home</span>',1),qa=W('<!> <span class="max-w-[150px] truncate"> </span>',1),Ga=W('<!> <span class="hidden sm:inline">Samples</span>',1),Wa=W('<!> <span class="max-w-[200px] truncate"><!></span>',1),Ja=W("<!> <!> <!> <!> <!> <!> <!>",1);function en(_,a){fe(a,!0);const h=()=>T(w,"$filteredSampleCount",d),[d,o]=Xe(),{filteredSampleCount:w}=Ye();Pa(_,{class:"mb-2","data-testid":"sample-details-breadcrumb",children:(b,H)=>{Ra(b,{children:(re,ve)=>{var u=Ja(),J=p(u);Ae(J,{children:(k,te)=>{{let z=r(()=>Ce.toDatasetHome(a.rootDataset.dataset_id));Ue(k,{get href(){return e(z)},class:"flex items-center gap-2",children:(y,F)=>{var g=Va(),A=p(g);ka(A,{class:"h-4 w-4"}),ot(2),i(y,g)},$$slots:{default:!0}})}},$$slots:{default:!0}});var O=c(J,2);Ne(O,{});var m=c(O,2);Ae(m,{children:(k,te)=>{{let z=r(()=>Ce.toDatasetHome(a.rootDataset.dataset_id));Ue(k,{get href(){return e(z)},class:"flex items-center gap-2",children:(y,F)=>{var g=qa(),A=p(g);Ba(A,{class:"h-4 w-4"});var j=c(A,2),ie=S(j,!0);I(j),ge(()=>mt(ie,a.rootDataset.name)),i(y,g)},$$slots:{default:!0}})}},$$slots:{default:!0}});var X=c(m,2);Ne(X,{});var ee=c(X,2);Ae(ee,{children:(k,te)=>{{let z=r(()=>Ce.toSamples(be.params.dataset_id));Ue(k,{get href(){return e(z)},class:"flex items-center gap-2",children:(y,F)=>{var g=Ga(),A=p(g);Qa(A,{class:"h-4 w-4"}),ot(2),i(y,g)},$$slots:{default:!0}})}},$$slots:{default:!0}});var v=c(ee,2);Ne(v,{});var pe=c(v,2);Ae(pe,{children:(k,te)=>{Ea(k,{class:"flex items-center gap-2",children:(z,y)=>{var F=Wa(),g=p(F);Za(g,{class:"h-4 w-4"});var A=c(g,2),j=S(A);{var ie=Z=>{var de=it();ge(()=>mt(de,`Sample ${a.sampleIndex+1} of ${h()??""}`)),i(Z,de)},B=Z=>{var de=it("Sample");i(Z,de)};L(j,Z=>{a.sampleIndex!==void 0?Z(ie):Z(B,!1)})}I(A),i(z,F)},$$slots:{default:!0}})},$$slots:{default:!0}}),i(re,u)},$$slots:{default:!0}})},$$slots:{default:!0}}),he(),o()}const tn=_=>`${Sa}/sample/${_}`,_t=({sampleId:_})=>{const a=Ma({path:{sample_id:_}}),h=La(),d=Ta(a);return{refetch:()=>{h.invalidateQueries({queryKey:a.queryKey})},image:d}};function an(_,a){fe(a,!0);const h=()=>T(e(J),"$annotationResp",w),d=()=>T(e(ee),"$image",w),o=()=>T(ve,"$showAnnotationTextLabelsStore",w),[w,b]=Xe(),H=Ia(a,"isResizable",3,!1),{addReversibleAction:re}=Ye(),{showAnnotationTextLabelsStore:ve}=ht(),u=r(()=>oa({datasetId:a.datasetId,annotationId:a.annotationId})),J=r(()=>e(u).annotation),O=r(()=>e(u).updateAnnotation);let m=r(()=>h().data);const X=r(()=>_t({sampleId:a.sampleId})),ee=r(()=>e(X).image);let v=r(()=>e(m)?ta(e(m)):void 0);const pe=y=>{(async()=>{try{await e(O)({annotation_id:a.annotationId,dataset_id:a.datasetId,bounding_box:y}),e(m)&&Ha({annotation:e(m),dataset_id:a.datasetId,addReversibleAction:re,updateAnnotation:e(O)})}catch(g){console.error("Failed to update annotation:",g.message)}})()};var k=se(),te=p(k);{var z=y=>{var F=se(),g=p(F);_a(g,()=>e(v),A=>{aa(A,{get groupId(){return e(m).sample_id},get onSelect(){return a.toggleAnnotationSelection},get box(){return e(v)},get isSelected(){return a.isSelected},children:(j,ie)=>{{let B=r(()=>({x:0,y:0,width:d().data.width,height:d().data.height}));na(j,{get annotation(){return e(m)},get showLabel(){return o()},get imageWidth(){return d().data.width},get constraintBox(){return e(B)},get isResizable(){return H()},onBoundingBoxChanged:pe})}},$$slots:{default:!0}})}),i(y,F)};L(te,y=>{e(m)&&d().data&&e(v)&&y(z)})}i(_,k),he(),b()}var nn=De('<line x1="0" stroke-width="1" vector-effect="non-scaling-stroke" stroke-dasharray="5,5" opacity="0.6"></line><line y1="0" vector-effect="non-scaling-stroke" stroke-width="1" stroke-dasharray="5,5" opacity="0.6"></line>',1),on=De('<rect class="select-none" fill="transparent" role="button" style="outline: 0;cursor: crosshair;" tabindex="0"></rect>'),sn=De("<g><!><!><!></g><!>",1),rn=De("<image></image><!>",1),ln=W('<div class="h-full w-full overflow-hidden"><div class="sample relative h-full w-full"><div class="absolute right-4 top-2 z-30"><!></div> <!> <!></div></div>'),dn=W('<div class="flex h-full w-full flex-col space-y-4"><div class="flex w-full items-center justify-between"><!> <!></div> <!> <div class="flex min-h-0 flex-1 gap-4"><div class="flex-1"><!></div> <div class="relative w-[375px]"><!></div></div></div>'),cn=W('<div data-testid="sample-details-loading"><!></div>');function un(_,a){fe(a,!0);const h=()=>T(de,"$labels",u),d=()=>T(yt,"$isEditingMode",u),o=()=>T(e(ie),"$image",u),w=()=>T(Lt,"$rootDataset",u),b=()=>T(Ke,"$imageBrightness",u),H=()=>T(Oe,"$imageContrast",u),re=()=>T(pe,"$selectedSampleIds",u),ve=()=>T(k,"$isHidden",u),[u,J]=Xe(),{getSelectedSampleIds:O,toggleSampleSelection:m,addReversibleAction:X,clearReversibleActions:ee}=Ye(),v=a.dataset.dataset_id,pe=O(v),{isHidden:k,handleKeyEvent:te}=sa(),{settingsStore:z}=ht(),{deleteAnnotation:y}=Fa({datasetId:v}),{deleteCaption:F}=Ka(),{removeTagFromSample:g}=ja({datasetId:v}),A=()=>{wa(Ce.toSamples(v))},j=r(()=>_t({sampleId:a.sampleId})),ie=r(()=>e(j).image),B=r(()=>e(j).refetch),{createAnnotation:Z}=Ua({datasetId:v}),de=ra(),{createLabel:bt}=Na(),{isEditingMode:yt,imageBrightness:Ke,imageContrast:Oe}=be.data.globalStorage;let ce=R(!1);const xt=async({x:t,y:n,width:D,height:x,labelName:l})=>{if(!h().data)return;let U=h().data.find(P=>P.annotation_label_name===l);U||(U=await bt({annotation_label_name:l}));try{const P=await Z({parent_sample_id:a.sampleId,annotation_type:"object_detection",x:Math.round(t),y:Math.round(n),width:Math.round(D),height:Math.round(x),annotation_label_id:U.annotation_label_id});return e(ye).length==0&&qe(),Xa({annotation:P,addReversibleAction:X,deleteAnnotation:y,refetch:e(B)}),e(B)(),s(Q,P.sample_id,!0),K.success("Annotation created successfully"),P}catch(P){K.error("Failed to create annotation. Please try again."),console.error("Error creating annotation:",P);return}},$t=t=>{switch(t.key){case ea(z).key_go_back:d()?e(le)&&s(le,!1):A();break;case" ":t.preventDefault(),t.stopPropagation(),console.log("space pressed in sample details"),d()?s(ce,!0):m(a.sampleId,v);break}te(t)},wt=t=>{t.key===" "&&s(ce,!1),te(t)};let St=r(()=>tn(a.sampleId)),Q=R(void 0),je=R(void 0);$a(()=>{var t;s(Q,void 0),s(Qe,void 0),(t=e(je))==null||t(),s(le,!1),s(q,void 0),ee()});const Ze=t=>{e(ce)||(e(Q)===t?s(Q,void 0):s(Q,t,!0))};let Qe=R(void 0),ue=R(!1),C=R(null),ae=R(null),V=R(null);const It=()=>{s(ue,!1),s(C,null),s(V,null)};let le=R(!1);const Ve=4,At=()=>{if(!e(ae))return;const t=da(e(ae));let n=null;const D=ca().on("start",x=>{if(!e(le))return;s(ue,!0);const l=e(ae).getBoundingClientRect(),U=x.sourceEvent.clientX,P=x.sourceEvent.clientY,E=(U-l.left)/l.width*o().data.width,M=(P-l.top)/l.height*o().data.height;n={x:E,y:M},s(C,{x:E,y:M,width:0,height:0},!0),s(V,{x:E,y:M},!0)}).on("drag",x=>{if(!e(C)||!e(ue)||!n)return;const l=e(ae).getBoundingClientRect(),U=x.sourceEvent.clientX,P=x.sourceEvent.clientY;let E=(U-l.left)/l.width*o().data.width,M=(P-l.top)/l.height*o().data.height;const _e=o().data.width,Be=o().data.height;E=Math.max(0,Math.min(E,_e)),M=Math.max(0,Math.min(M,Be));const $e=Math.min(n.x,E),Ee=Math.min(n.y,M),Me=Math.abs(E-n.x),$=Math.abs(M-n.y);s(C,{x:$e,y:Ee,width:Me,height:$},!0),s(V,{x:E,y:M},!0)}).on("end",()=>{!e(C)||!e(ue)||(e(C).width>Ve&&e(C).height>Ve&&e(q)&&xt({x:e(C).x,y:e(C).y,width:e(C).width,height:e(C).height,labelName:e(q).label}),It(),n=null)});return t.call(D),t.on("mousemove",Dt),()=>{D.on("start",null).on("drag",null).on("end",null)}},Ct=t=>{if(!e(ae)||e(ue))return;const n=e(ae).getBoundingClientRect(),D=t.clientX,x=t.clientY,l=(D-n.left)/n.width*o().data.width,U=(x-n.top)/n.height*o().data.height;s(V,{x:l,y:U},!0),t.stopPropagation(),t.preventDefault()},Dt=ia.throttle(Ct,50);Jt(()=>{At(),e(ie).subscribe(t=>{if(t.isSuccess&&t.data){let n=la(t.data.annotations);s(ye,n,!0)}else s(ye,[],!0)})});let q=R(void 0),ye=R(st([])),xe=R(st(new Set));const Pt=t=>{const n=new Set(e(xe));n.has(t)?n.delete(t):n.add(t),s(xe,n,!0)},Rt=r(()=>e(ye).filter(t=>!e(xe).has(t.sample_id))),Re=r(()=>e(q)?va(e(q).label,1).color:"blue"),kt=async t=>{var x;if(!o().data||!h().data)return;const n=(x=o().data.annotations)==null?void 0:x.find(l=>l.sample_id===t);if(!n)return;(async()=>{try{Ya({annotation:n,labels:h().data,addReversibleAction:X,createAnnotation:Z,refetch:e(B)}),await y(t),K.success("Annotation deleted successfully"),e(B)(),e(Q)===t&&s(Q,void 0)}catch(l){K.error("Failed to delete annotation. Please try again."),console.error("Error deleting annotation:",l)}})()},Bt=async t=>{if(o().data)try{await F(t),K.success("Caption deleted successfully"),e(B)()}catch(n){K.error("Failed to delete caption. Please try again."),console.error("Error deleting caption:",n)}},Et=async t=>{try{await g(a.sampleId,t),K.success("Tag removed successfully"),e(B)()}catch(n){K.error("Failed to remove tag. Please try again."),console.error("Error removing tag from sample:",n)}},{createCaption:Mt}=Oa(),{rootDataset:Lt,refetch:qe}=Ca({datasetId:v}),Tt=async t=>{try{await Mt({parent_sample_id:t}),K.success("Caption created successfully"),e(B)(),o().captions||qe()}catch(n){K.error("Failed to create caption. Please try again."),console.error("Error creating caption:",n)}},Ht=r(()=>e(ce)?"grab":e(ke)?"crosshair":"auto"),zt=r(()=>d()&&!e(ce)),ke=r(()=>e(le)&&!e(ce)&&e(q)!==void 0);let Ge=R(null);var We=se();ct("keydown",rt,$t),ct("keyup",rt,wt);var Ft=p(We);{var Ut=t=>{var n=dn(),D=S(n),x=S(D);{var l=$=>{en($,{get rootDataset(){return w().data},get sampleIndex(){return a.sampleIndex}})};L(x,$=>{w().data&&$(l)})}var U=c(x,2);{var P=$=>{Da($,{get brightness(){return dt(),b()},set brightness(ne){lt(Ke,ne)},get contrast(){return dt(),H()},set contrast(ne){lt(Oe,ne)}})};L(U,$=>{d()&&$(P)})}I(D);var E=c(D,2);Aa(E,{class:"bg-border-hard"});var M=c(E,2),_e=S(M),Be=S(_e);ua(Be,{className:"h-full",children:($,ne)=>{ma($,{className:"h-full",children:(Xt,gn)=>{var Le=ln(),Te=S(Le),He=S(Te),Yt=S(He);{let oe=r(()=>re().has(a.sampleId));ga(Yt,{onSelect:()=>m(a.sampleId,v),get isSelected(){return e(oe)}})}I(He);var Je=c(He,2);{var Kt=oe=>{var me=se(),we=p(me);Pe(we,()=>a.children),i(oe,me)};L(Je,oe=>{a.children&&oe(Kt)})}var Ot=c(Je,2);za(Ot,{get width(){return o().data.width},get height(){return o().data.height},get cursor(){return e(Ht)},get boundingBox(){return e(Qe)},registerResetFn:me=>s(je,me,!0),zoomableContent:me=>{var we=rn(),ze=p(we),jt=c(ze);{var Zt=Fe=>{var et=sn(),Se=p(et);let tt;var at=S(Se);ya(at,17,()=>e(Rt),f=>f.sample_id,(f,Y)=>{{let G=r(()=>e(Q)===e(Y).sample_id);an(f,{get annotationId(){return e(Y).sample_id},get sampleId(){return a.sampleId},get datasetId(){return v},get isResizable(){return e(zt)},get isSelected(){return e(G)},toggleAnnotationSelection:Ze})}});var nt=c(at);{var Qt=f=>{fa(f,{get bbox(){return e(C)},get colorStroke(){return e(Re)},colorFill:"rgba(0, 123, 255, 0.1)",style:"outline: 0;",opacity:.8,scale:1})};L(nt,f=>{e(C)&&e(ue)&&e(q)&&f(Qt)})}var Vt=c(nt);{var qt=f=>{var Y=nn(),G=p(Y),Ie=c(G);ge(()=>{N(G,"y1",e(V).y),N(G,"x2",o().data.width),N(G,"y2",e(V).y),N(G,"stroke",e(Re)),N(Ie,"x1",e(V).x),N(Ie,"x2",e(V).x),N(Ie,"y2",o().data.height),N(Ie,"stroke",e(Re))}),i(f,Y)};L(Vt,f=>{e(V)&&e(ke)&&f(qt)})}I(Se);var Gt=c(Se);{var Wt=f=>{var Y=on();ut(Y,G=>s(ae,G),()=>e(ae)),ge(()=>{N(Y,"width",o().data.width),N(Y,"height",o().data.height)}),i(f,Y)};L(Gt,f=>{e(ke)&&f(Wt)})}ge(f=>tt=xa(Se,0,"",null,tt,f),[()=>({invisible:ve()})]),i(Fe,et)};L(jt,Fe=>{o().data&&Fe(Zt)})}ge(()=>{N(ze,"href",e(St)),ba(ze,`filter: brightness(${b()}) contrast(${H()})`)}),i(me,we)},$$slots:{zoomableContent:!0}}),I(Te),ut(Te,oe=>s(Ge,oe),()=>e(Ge)),I(Le),i(Xt,Le)},$$slots:{default:!0}})},$$slots:{default:!0}}),I(_e);var $e=c(_e,2),Ee=S($e);{var Me=$=>{pa($,{get sample(){return o().data},get annotationsIdsToHide(){return e(xe)},get selectedAnnotationId(){return e(Q)},onAnnotationClick:Ze,onToggleShowAnnotation:Pt,onDeleteAnnotation:kt,onDeleteCaption:Bt,onCreateCaption:Tt,onRemoveTag:Et,get onUpdate(){return e(B)},get addAnnotationEnabled(){return e(le)},set addAnnotationEnabled(ne){s(le,ne,!0)},get addAnnotationLabel(){return e(q)},set addAnnotationLabel(ne){s(q,ne,!0)}})};L(Ee,$=>{o().data&&$(Me)})}I($e),I(M),I(n),i(t,n)},Nt=t=>{var n=cn(),D=S(n);ha(D,{}),I(n),i(t,n)};L(Ft,t=>{o().data?t(Ut):t(Nt,!1)})}i(_,We),he(),J()}var mn=W('<div class="flex h-full w-full space-x-4 px-4 pb-4" data-testid="sample-details"><div class="h-full w-full space-y-6 rounded-[1vw] bg-card p-4"><!></div></div>');function Nn(_,a){fe(a,!0);const h=r(()=>be.params.sampleId),d=be.data.dataset,o=r(()=>Number(be.params.sampleIndex));var w=mn(),b=S(w),H=S(b);un(H,{get sampleId(){return e(h)},get dataset(){return d},get sampleIndex(){return e(o)},children:(re,ve)=>{var u=se(),J=p(u);{var O=m=>{var X=se(),ee=p(X);Pe(ee,()=>a.children),i(m,X)};L(J,m=>{a.children&&m(O)})}i(re,u)},$$slots:{default:!0}}),I(b),I(w),i(_,w),he()}export{Nn as component};
@@ -0,0 +1 @@
1
+ import{r as o}from"../chunks/BpLiSKgx.js";import{r as d}from"../chunks/KjYeVjkE.js";const n=async()=>{const{data:e}=await o();if(!e||e.length===0)throw new Error("No datasets found");const t=e.filter(a=>a.parent_dataset_id==null).toSorted((a,r)=>new Date(r.created_at||0).getTime()-new Date(a.created_at||0).getTime())[0];if(!(t!=null&&t.dataset_id))throw new Error("No valid root dataset found");d(307,`/datasets/${t.dataset_id}`)},l=Object.freeze(Object.defineProperty({__proto__:null,load:n},Symbol.toStringTag,{value:"Module"}));export{l as universal};
@@ -0,0 +1 @@
1
+ import{e as r,r as p}from"../chunks/KjYeVjkE.js";import{S as e}from"../chunks/DL9a7v5o.js";import"../chunks/CvGjimpO.js";import{r as t}from"../chunks/BRmB-kJ9.js";const n={[e.VIDEO]:t.toVideos,[e.VIDEO_FRAME]:t.toFrames,[e.IMAGE]:t.toSamples,[e.ANNOTATION]:t.toAnnotations,[e.CAPTION]:t.toCaptions},l=async({parent:s})=>{const{dataset:o}=await s();o||r(500,"Dataset not loaded by layout");const a=n[o.sample_type];a||r(404,`Unknown sample type: ${o.sample_type}`),p(307,a(o.dataset_id))},c=Object.freeze(Object.defineProperty({__proto__:null,load:l},Symbol.toStringTag,{value:"Module"}));export{c as universal};
@@ -0,0 +1 @@
1
+ import"../chunks/CWj6FrbW.js";import{p as _,u as I,g as o,a as S,b as r}from"../chunks/DkbXUtyG.js";import{s as i,a as T}from"../chunks/B_1cpokE.js";import{A as G}from"../chunks/CGY1p9L4.js";import"../chunks/CvGjimpO.js";import{u as A}from"../chunks/KNLP4aJU.js";import"../chunks/C8mfFM-u.js";import"../chunks/D_FFv0Oe.js";import"../chunks/69_IOA4Y.js";import"../chunks/C80h3dJx.js";import"../chunks/xGHZQ1pe.js";import{u as h}from"../chunks/da7Oy_lO.js";import"../chunks/DtWZc_tl.js";function C(n,t){_(t,!0);const p=()=>i(u,"$lastGridType",e),d=()=>i(c,"$sampleSize",e),[e,m]=T(),{datasetId:s,sampleSize:c,selectedAnnotationFilterIds:l,rootDatasetId:a}=t.data,{lastGridType:u}=A(),g=a??s,f=r(()=>h({dataset_id:g})),$=r(()=>o(f).clearTagsSelected);I(()=>{p()!=="annotations"&&o($)()}),G(n,{get itemWidth(){return d().width},get dataset_id(){return s},get rootDatasetId(){return a},get selectedAnnotationFilterIds(){return l}}),S(),m()}export{C as component};
@@ -0,0 +1 @@
1
+ import{x as Ut,i as st,p as j,$ as ht,f as M,a as O,g as a,b as d,c as I,r as A,s as S,t as G,n as pt,u as la,d as Ft,h as nt}from"../chunks/DkbXUtyG.js";import{F as da}from"../chunks/BpLiSKgx.js";import{u as Y}from"../chunks/KNLP4aJU.js";import"../chunks/CWj6FrbW.js";import{c as V,a as m,f as B,t as bt,b as ua}from"../chunks/CmLg0ys7.js";import{i as T,s as R,a as X,b as Rt,m as Tt}from"../chunks/B_1cpokE.js";import{S as jt}from"../chunks/DL9a7v5o.js";import{b as ca,a as ma}from"../chunks/DtWZc_tl.js";import{D as va,O as ga,a6 as Ht,F as fa,a7 as _a,H as ha,J as pa,a8 as ba,K as Kt,a9 as Ot,b as Aa,c as xa,C as qt,n as zt,o as Ia,u as Sa,z as ya,x as Da,d as wa,B as Pa,aa as Ca}from"../chunks/CGY1p9L4.js";import{r as K}from"../chunks/BRmB-kJ9.js";import{e as At}from"../chunks/D9SC3jBb.js";import{s as It}from"../chunks/VqWvU2yF.js";import{s as St,e as ka,u as Ma,k as Ba,d as Ea,a as Na,t as xt}from"../chunks/C8mfFM-u.js";import{g as it,c as La,a as Fa}from"../chunks/xGHZQ1pe.js";import"../chunks/CvGjimpO.js";import"../chunks/D_FFv0Oe.js";import"../chunks/69_IOA4Y.js";import{p as q}from"../chunks/C80h3dJx.js";import{S as Ra}from"../chunks/D4y7iiT3.js";import{u as Ta}from"../chunks/VRI4prUD.js";import{I as ja}from"../chunks/dHC3otuL.js";import{Z as Oa,a as Ua}from"../chunks/BscxbINH.js";import{S as Ha}from"../chunks/erjNR5MX.js";import{s as Z}from"../chunks/eAy8rZzC.js";import{o as Ka,p as qa,u as za,c as Va,q as Qa,s as Wa}from"../chunks/VYb2dkNs.js";import{B as Ga,a as Za,b as ot,c as ft,H as Ja,d as _t,D as Ya,e as Xa}from"../chunks/DSKECuqX.js";import{C as $a}from"../chunks/rsLi1iKv.js";import{S as te}from"../chunks/DCuAdx1Q.js";import{F as ae}from"../chunks/rwuuBP9f.js";const ee=({annotationIndex:s,...t})=>{const e=Ut({isLoading:!1});return(async()=>{e.update(n=>({...n,isLoading:!0}));try{const{data:n}=await da({path:{dataset_id:t.dataset_id},query:{cursor:s>0?s-1:0,limit:3,annotation_label_ids:t.annotation_label_ids,tag_ids:t.tag_ids}});if(!n){e.update(l=>({...l,isLoading:!1,error:"No annotations data received",data:void 0}));return}const{setfilteredAnnotationCount:o}=Y();o(n.total_count);let r;const u=s>0?n.data[0]:void 0;n.data.length>1&&(r=s===0?n.data[1]:n.data[2]),e.update(l=>({...l,isLoading:!1,error:void 0,data:{annotationNext:r,annotationPrevious:u}}))}catch(n){e.update(o=>({...o,isLoading:!1,error:String(n)}))}})(),e},ne=async({parent:s,params:{dataset_id:t,annotationId:e,annotationIndex:i}})=>{const{annotationsSelectedTagsIds:n,annotationsSelectedAnnotationLabelsIds:o,dataset:r}=await s(),u=parseInt(i,10),l=Ut();if(!r)throw new Error("Dataset data not found");return ee({annotationIndex:u,dataset_id:t,currentAnnotationId:e,annotation_label_ids:Array.from(st(o)),tag_ids:Array.from(st(n))}).subscribe(({data:v})=>{l.set(v)}),{annotationAdjacents:l,annotationIndex:u,annotationId:e,dataset:r}},ln=Object.freeze(Object.defineProperty({__proto__:null,load:ne},Symbol.toStringTag,{value:"Module"}));var oe=B('<div data-testid="annotation-navigation"><!></div>');function se(s,t){j(t,!0);const e=()=>R(a(r),"$annotationAdjacents",i),[i,n]=X(),o=d(()=>q.data.annotationIndex),r=d(()=>q.data.annotationAdjacents),u=q.data.datasetId,l=()=>{e().annotationNext&&it(K.toSampleWithAnnotation({datasetId:u,sampleId:e().annotationNext.parent_sample_id,annotationId:e().annotationNext.sample_id,annotationIndex:a(o)+1}),{invalidateAll:!0})},v=()=>{e().annotationPrevious&&it(K.toSampleWithAnnotation({datasetId:u,sampleId:e().annotationPrevious.parent_sample_id,annotationId:e().annotationPrevious.sample_id,annotationIndex:a(o)-1}),{invalidateAll:!0})},x=h=>{switch(h.key){case"ArrowRight":l();break;case"ArrowLeft":v();break}};var g=V();At("keydown",ht,x);var D=M(g);{var w=h=>{var P=oe(),L=I(P);{let N=d(()=>!!e().annotationPrevious),y=d(()=>!!e().annotationNext);Ha(L,{get hasPrevious(){return a(N)},get hasNext(){return a(y)},onPrevious:v,onNext:l})}A(P),m(h,P)};T(D,h=>{e()&&h(w)})}m(s,g),O(),n()}const ie={object_detection:"Object Detection",instance_segmentation:"Instance Segmentation",semantic_segmentation:"Semantic Segmentation",classification:"Classification"};var re=B('<span class="text-sm"> </span> <span class="break-all text-sm"> </span>',1);function le(s,t){var e=re(),i=M(e),n=I(i,!0);A(i);var o=S(i,2),r=I(o,!0);A(o),G(()=>{Z(n,t.label),St(o,"data-testid",`annotation-metadata-${t.id}`),Z(r,t.value)}),m(s,e)}var de=B('<span class="break-all text-sm"> </span>'),ue=B('<span class="text-sm"> </span> <!>',1);function ce(s,t){j(t,!0);const e=()=>R(r,"$result",n),i=()=>R(t.isEditingMode,"$isEditingMode",n),[n,o]=X(),r=va(),{addReversibleAction:u}=Y(),{updateAnnotation:l,refetch:v}=ga({datasetId:t.datasetId,annotationId:t.annotationId,onUpdate:t.onUpdate}),{updateAnnotations:x}=Ht({datasetId:t.datasetId}),g=d(()=>pa(e().data||[])),D=d(()=>{const p=a(g).find(b=>b.value===t.value);return p||{value:t.value,label:t.value}});var w=ue(),h=M(w),P=I(h,!0);A(h);var L=S(h,2);{var N=p=>{{const b=(c,f)=>{let E=()=>f==null?void 0:f().inputValue;ha(c,{get label(){return E()}})};let k=d(()=>a(g).find(c=>{var f;return c.value===((f=a(D))==null?void 0:f.value)}));fa(p,{get items(){return a(g)},get selectedItem(){return a(k)},name:"annotation-label",placeholder:"Select or create a label",onSelect:c=>{_a({annotations:[{sample_id:t.annotationId,annotation_label:{annotation_label_name:t.value}}],datasetId:t.datasetId,addReversibleAction:u,updateAnnotations:x,refresh:v}),l({annotation_id:t.annotationId,dataset_id:t.datasetId,label_name:c.value})},notFound:b,$$slots:{notFound:!0}})}},y=p=>{var b=de();St(b,"data-testid","annotation-metadata-label");var k=I(b,!0);A(b),G(()=>Z(k,t.value)),m(p,b)};T(L,p=>{i()?p(N):p(y,!1)})}G(()=>Z(P,t.label)),m(s,w),O(),o()}var me=B('<div class="flex flex-col gap-4"><div class="grid grid-cols-[6rem_1fr] gap-y-3 text-diffuse-foreground"></div></div>');function ve(s,t){j(t,!0);const{datasetId:e}=q.data,i=d(()=>{var v,x;if(!t.annotation)return[];let l=[{id:"label",label:"Label:",value:(x=(v=t.annotation)==null?void 0:v.annotation_label)==null?void 0:x.annotation_label_name},{id:"type",label:"Type:",value:ie[t.annotation.annotation_type]||"Unknown"}];if(t.annotation&&!ba(t.annotation)){const{height:g,width:D}=Kt(t.annotation);l=[{id:"height",label:"Height:",value:Ot(Math.round(g))+"px"},{id:"width",label:"Width:",value:Ot(Math.round(D))+"px"},...l]}return l}),{isEditingMode:n}=q.data.globalStorage;var o=V(),r=M(o);{var u=l=>{Aa(l,{title:"Annotation details",children:(v,x)=>{var g=me(),D=I(g);ka(D,21,()=>a(i),({label:w,value:h,id:P})=>w,(w,h)=>{let P=()=>a(h).label,L=()=>a(h).value,N=()=>a(h).id;var y=V(),p=M(y);{var b=c=>{ce(c,{get onUpdate(){return t.onUpdate},get annotationId(){return t.annotation.sample_id},get datasetId(){return e},get label(){return P()},get value(){return L()},get isEditingMode(){return n}})},k=c=>{le(c,{get label(){return P()},get id(){return N()},get value(){return L()}})};T(p,c=>{N()==="label"&&n?c(b):c(k,!1)})}m(w,y)}),A(D),A(g),m(v,g)}})};T(r,l=>{a(i).length>0&&l(u)})}m(s,o),O()}const ge=()=>{const s=xa(Ka());return s.subscribe(()=>{}),{removeTagFromAnnotation:(e,i)=>new Promise((n,o)=>{st(s).mutate({path:{annotation_id:e,tag_id:i}},{onSuccess:()=>n(),onError:r=>o(r)})})}};var fe=B('<div class="flex h-full min-h-0 flex-col space-y-4 overflow-hidden dark:[color-scheme:dark]"><!> <!> <!></div>');function _e(s,t){j(t,!0);const{removeTagFromAnnotation:e}=ge(),i=d(()=>{var o;return((o=t.annotation.tags)==null?void 0:o.map(r=>({tagId:r.tag_id,name:r.name})))??[]}),n=async o=>{await e(t.annotation.sample_id,o)};qt(s,{className:"h-full",children:(o,r)=>{zt(o,{className:"h-full flex flex-col",children:(u,l)=>{var v=fe(),x=I(v);Ia(x,{get tags(){return a(i)},onClick:n});var g=S(x,2);ve(g,{get annotation(){return t.annotation},get onUpdate(){return t.onUpdate}});var D=S(g,2);It(D,()=>t.sampleDetails),A(v),m(u,v)},$$slots:{default:!0}})},$$slots:{default:!0}}),O()}var he=B('<!> <span class="hidden sm:inline">Home</span>',1),pe=B('<!> <span class="max-w-[150px] truncate"> </span>',1),be=B('<!> <span class="hidden sm:inline">Annotations</span>',1),Ae=B('<!> <span class="max-w-[200px] truncate"><!></span>',1),xe=B("<!> <!> <!> <!> <!> <!> <!>",1);function Ie(s,t){j(t,!0);const e=()=>R(o,"$filteredAnnotationCount",i),[i,n]=X(),{filteredAnnotationCount:o}=Y();Ga(s,{class:"mb-2",children:(r,u)=>{Za(r,{children:(l,v)=>{var x=xe(),g=M(x);ot(g,{children:(y,p)=>{{let b=d(()=>K.toDatasetHome(t.rootDataset.dataset_id));ft(y,{get href(){return a(b)},class:"flex items-center gap-2",children:(k,c)=>{var f=he(),E=M(f);Ja(E,{class:"h-4 w-4"}),pt(2),m(k,f)},$$slots:{default:!0}})}},$$slots:{default:!0}});var D=S(g,2);_t(D,{});var w=S(D,2);ot(w,{children:(y,p)=>{{let b=d(()=>K.toDatasetHome(t.rootDataset.dataset_id));ft(y,{get href(){return a(b)},class:"flex items-center gap-2",children:(k,c)=>{var f=pe(),E=M(f);Ya(E,{class:"h-4 w-4"});var C=S(E,2),F=I(C,!0);A(C),G(()=>Z(F,t.rootDataset.name)),m(k,f)},$$slots:{default:!0}})}},$$slots:{default:!0}});var h=S(w,2);_t(h,{});var P=S(h,2);ot(P,{children:(y,p)=>{{let b=d(()=>K.toAnnotations(q.params.dataset_id));ft(y,{get href(){return a(b)},class:"flex items-center gap-2",children:(k,c)=>{var f=be(),E=M(f);$a(E,{class:"h-4 w-4"}),pt(2),m(k,f)},$$slots:{default:!0}})}},$$slots:{default:!0}});var L=S(P,2);_t(L,{});var N=S(L,2);ot(N,{children:(y,p)=>{Xa(y,{class:"flex items-center gap-2",children:(b,k)=>{var c=Ae(),f=M(c);te(f,{class:"h-4 w-4"});var E=S(f,2),C=I(E);{var F=U=>{var Q=bt();G(()=>Z(Q,`Annotation ${t.annotationIndex+1} of ${e()??""}`)),m(U,Q)},$=U=>{var Q=bt("Annotation");m(U,Q)};T(C,U=>{t.annotationIndex!==void 0?U(F):U($,!1)})}A(E),m(b,c)},$$slots:{default:!0}})},$$slots:{default:!0}}),m(l,x)},$$slots:{default:!0}})},$$slots:{default:!0}}),O(),n()}var Se=ua("<image></image><g><!></g>",1),ye=B('<div class="h-full w-full overflow-hidden"><div class="sample relative h-full w-full"><div class="absolute right-4 top-2 z-30"><!></div> <!> <!></div></div>'),De=B('<div class="flex h-full w-full items-center justify-center"><!></div>'),we=B('<div class="flex h-full w-full flex-col space-y-4"><div class="flex w-full items-center justify-between"><!> <!></div> <!> <div class="flex min-h-0 flex-1 gap-4"><div class="flex-1"><!></div> <div class="relative w-[375px]"><!></div></div></div>');function Vt(s,t){j(t,!0);const e=()=>R(U,"$isEditingMode",l),i=()=>R(f,"$rootDataset",l),n=()=>R(yt,"$imageBrightness",l),o=()=>R(Dt,"$imageContrast",l),r=()=>R(g,"$selectedSampleAnnotationCropIds",l),u=()=>R(h,"$isHidden",l),[l,v]=X(),{toggleSampleAnnotationCropSelection:x,selectedSampleAnnotationCropIds:g,clearReversibleActions:D,addReversibleAction:w}=Y(),{isHidden:h,handleKeyEvent:P}=Sa(),{settingsStore:L}=Ma(),N=" ",y=st(L).key_go_back;let p=Ft(!1);const b=()=>{var _;(_=t.annotationDetails.parent_sample_data)!=null&&_.sample.dataset_id?it(K.toAnnotations(t.annotationDetails.parent_sample_data.sample.dataset_id)):it("/")},k=_=>{switch(_.key){case y:b();break;case" ":_.preventDefault(),e()?nt(p,!0):x(a(F));break;case N:_.preventDefault(),x(a(F));break}P(_)},c=_=>{_.key===" "&&nt(p,!1),P(_)},{rootDataset:f}=Ta({datasetId:t.datasetId});La(()=>{D()});const E=_=>{if(a(C)){const H={annotation_id:a(C).sample_id,dataset_id:t.datasetId,bounding_box:_};(async()=>{try{await t.updateAnnotation(H),Ua({annotation:a(C),dataset_id:t.datasetId,addReversibleAction:w,updateAnnotation:t.updateAnnotation})}catch(at){xt.error("Failed to update annotations:"+at.message)}})()}};let C=d(()=>t.annotationDetails.annotation),F=d(()=>a(C).sample_id),$=d(()=>a(C)?Kt(a(C)):void 0);const{isEditingMode:U}=q.data.globalStorage,Q=d(()=>a(p)?"grab":"auto"),Wt=d(()=>e()&&!a(p));let tt=Ft(void 0);la(()=>{!a(tt)&&a($)&&nt(tt,a($),!0)}),Fa(()=>{nt(tt,void 0)});const{imageBrightness:yt,imageContrast:Dt}=Y();var rt=we();At("keydown",ht,k),At("keyup",ht,c);var lt=I(rt),wt=I(lt);{var Gt=_=>{Ie(_,{get rootDataset(){return i().data},get annotationIndex(){return t.annotationIndex}})};T(wt,_=>{i().data&&_(Gt)})}var Zt=S(wt,2);{var Jt=_=>{ja(_,{get brightness(){return Tt(),n()},set brightness(H){Rt(yt,H)},get contrast(){return Tt(),o()},set contrast(H){Rt(Dt,H)}})};T(Zt,_=>{e()&&_(Jt)})}A(lt);var Pt=S(lt,2);Ra(Pt,{class:"bg-border-hard"});var Ct=S(Pt,2),dt=I(Ct),Yt=I(dt);qt(Yt,{className:"h-full",children:(_,H)=>{zt(_,{className:"h-full",children:(J,at)=>{var Mt=V(),$t=M(Mt);{var ta=W=>{var z=ye(),et=I(z),ut=I(et),ea=I(ut);{let Et=d(()=>r().has(a(F)));ya(ea,{onSelect:()=>x(a(F)),get isSelected(){return a(Et)}})}A(ut);var Bt=S(ut,2);se(Bt,{});var na=S(Bt,2);Oa(na,{get width(){return t.parentSample.width},get height(){return t.parentSample.height},get cursor(){return a(Q)},get boundingBox(){return a(tt)},zoomableContent:(oa,ct)=>{let sa=()=>ct==null?void 0:ct().scale;var Nt=Se(),mt=M(Nt),vt=S(mt);let Lt;var ia=I(vt);Ba(ia,()=>a(C).sample_id,gt=>{{let ra=d(()=>({x:0,y:0,width:t.parentSample.width,height:t.parentSample.height}));wa(gt,{get annotation(){return a(C)},showLabel:!0,get scale(){return sa()},get imageWidth(){return t.parentSample.width},get isResizable(){return a(Wt)},onBoundingBoxChanged:E,get constraintBox(){return a(ra)}})}}),A(vt),G(gt=>{St(mt,"href",t.parentSample.url),Ea(mt,`filter: brightness(${n()}) contrast(${o()})`),Lt=Na(vt,0,"",null,Lt,gt)},[()=>({invisible:u()})]),m(oa,Nt)},$$slots:{zoomableContent:!0}}),A(et),A(z),m(W,z)},aa=W=>{var z=De(),et=I(z);Da(et,{size:"large",align:"center"}),A(z),m(W,z)};T($t,W=>{a(C)?W(ta):W(aa,!1)})}m(J,Mt)},$$slots:{default:!0}})},$$slots:{default:!0}}),A(dt);var kt=S(dt,2),Xt=I(kt);_e(Xt,{get annotation(){return a(C)},get onUpdate(){return t.refetch},sampleDetails:H=>{var J=V(),at=M(J);It(at,()=>t.parentSampleDetails),m(H,J)},$$slots:{sampleDetails:!0}}),A(kt),A(Ct),A(rt),m(s,rt),O(),v()}var Pe=B("<!> <!>",1);function Qt(s,t){var e=Pe(),i=M(e);It(i,()=>t.children);var n=S(i,2);Pa(n,{variant:"secondary",get href(){return t.href},children:(o,r)=>{pt();var u=bt("View sample");m(o,u)},$$slots:{default:!0}}),m(s,e)}function Ce(s,t){j(t,!0);const e=d(()=>t.annotationDetails.parent_sample_data);{const i=o=>{{let r=d(()=>K.toSample({sampleId:a(e).sample_id,datasetId:a(e).sample.dataset_id}));Qt(o,{get href(){return a(r)},children:(u,l)=>{Ca(u,{get sample(){return a(e)},showCustomMetadata:!1})}})}};let n=d(()=>({width:a(e).width,height:a(e).height,url:`${ca}/sample/${a(e).sample.sample_id}`}));Vt(s,{get annotationDetails(){return t.annotationDetails},get updateAnnotation(){return t.updateAnnotation},get refetch(){return t.refetch},get annotationIndex(){return t.annotationIndex},get dataset(){return t.dataset},get datasetId(){return t.dataset.dataset_id},get parentSample(){return a(n)},parentSampleDetails:i,$$slots:{parentSampleDetails:!0}})}O()}function ke(s,t){j(t,!0);const e=d(()=>t.annotationDetails.parent_sample_data);{const i=o=>{{let r=d(()=>K.toFramesDetails(a(e).sample.dataset_id,a(e).sample_id));Qt(o,{get href(){return a(r)},children:(u,l)=>{ae(u,{get sample(){return a(e)}})}})}};let n=d(()=>({width:a(e).video.width,height:a(e).video.height,url:`${ma}/${a(e).sample_id}`}));Vt(s,{get annotationDetails(){return t.annotationDetails},get updateAnnotation(){return t.updateAnnotation},get refetch(){return t.refetch},get annotationIndex(){return t.annotationIndex},get dataset(){return t.dataset},get datasetId(){return t.dataset.dataset_id},get parentSample(){return a(n)},parentSampleDetails:i,$$slots:{parentSampleDetails:!0}})}O()}const Me=({datasetId:s,annotationId:t,onUpdate:e})=>{const i=qa({path:{sample_id:t}}),n=za(),{updateAnnotations:o}=Ht({datasetId:s}),r=Va(i),u=()=>{n.invalidateQueries({queryKey:i.queryKey}),n.invalidateQueries({queryKey:Qa().queryKey}),n.invalidateQueries({queryKey:Wa({path:{dataset_id:s}}).queryKey})};return{updateAnnotation:async v=>{try{await o([v]),u(),xt.success("Annotation updated successfully"),e==null||e()}catch(x){xt.error("Failed to update annotation:"+x.message)}},annotation:r,refetch:u}};var Be=B('<div class="flex h-full w-full space-x-4 px-4 pb-4" data-testid="annotation-details"><div class="h-full w-full space-y-6 rounded-[1vw] bg-card p-4"><!></div></div>');function dn(s,t){j(t,!0);const e=()=>R(a(x),"$annotationDetailsResponse",i),[i,n]=X(),o=d(()=>t.data.annotationId),r=d(()=>t.data.dataset),u=d(()=>t.data.annotationIndex),l=q.params.dataset_id,v=d(()=>Me({datasetId:l,annotationId:a(o)})),x=d(()=>a(v).annotation),g=d(()=>a(v).updateAnnotation),D=d(()=>a(v).refetch);var w=Be(),h=I(w),P=I(h);{var L=N=>{var y=V(),p=M(y);{var b=c=>{ke(c,{get annotationDetails(){return e().data},get annotationIndex(){return a(u)},get updateAnnotation(){return a(g)},get refetch(){return a(D)},get dataset(){return a(r)}})},k=c=>{var f=V(),E=M(f);{var C=F=>{Ce(F,{get annotationDetails(){return e().data},get annotationIndex(){return a(u)},get updateAnnotation(){return a(g)},get refetch(){return a(D)},get dataset(){return a(r)}})};T(E,F=>{e().data.parent_sample_type==jt.IMAGE&&F(C)},!0)}m(c,f)};T(p,c=>{e().data.parent_sample_type==jt.VIDEO_FRAME?c(b):c(k,!1)})}m(N,y)};T(P,N=>{e().data&&a(o)&&a(r)&&N(L)})}A(h),A(w),m(s,w),O(),n()}export{dn as component,ln as universal};