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
+ (function(){"use strict";function ce(Q){if(Q.__esModule)return Q;var y=Q.default;if(typeof y=="function"){var z=function E(){return this instanceof E?Reflect.construct(y,arguments,this.constructor):y.apply(this,arguments)};z.prototype=y.prototype}else z={};return Object.defineProperty(z,"__esModule",{value:!0}),Object.keys(Q).forEach(function(E){var q=Object.getOwnPropertyDescriptor(Q,E);Object.defineProperty(z,E,q.get?q:{enumerable:!0,get:function(){return Q[E]}})}),z}var ue={},ae=Object.freeze({__proto__:null,default:ue}),ge=ce(ae);(function(Q){var y;function z(t,i,e){const s=typeof e,n=typeof t;if(s!=="undefined"){if(n!=="undefined"){if(e){if(n==="function"&&s===n)return function(o){return t(e(o))};if(i=t.constructor,i===e.constructor){if(i===Array)return e.concat(t);if(i===Map){var r=new Map(e);for(var h of t)r.set(h[0],h[1]);return r}if(i===Set){h=new Set(e);for(r of t.values())h.add(r);return h}}}return t}return e}return n==="undefined"?i:t}function E(t,i){return typeof t>"u"?i:t}function q(){return Object.create(null)}function F(t){return typeof t=="string"}function rt(t){return typeof t=="object"}function ht(t,i){if(F(i))t=t[i];else for(let e=0;t&&e<i.length;e++)t=t[i[e]];return t}const pe=/[^\p{L}\p{N}]+/u,de=/(\d{3})/g,me=/(\D)(\d{3})/g,we=/(\d{3})(\D)/g,Ft=/[\u0300-\u036f]/g;function lt(t={}){if(!this||this.constructor!==lt)return new lt(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}y=lt.prototype,y.assign=function(t){this.normalize=z(t.normalize,!0,this.normalize);let i=t.include,e=i||t.exclude||t.split,s;if(e||e===""){if(typeof e=="object"&&e.constructor!==RegExp){let n="";s=!i,i||(n+="\\p{Z}"),e.letter&&(n+="\\p{L}"),e.number&&(n+="\\p{N}",s=!!i),e.symbol&&(n+="\\p{S}"),e.punctuation&&(n+="\\p{P}"),e.control&&(n+="\\p{C}"),(e=e.char)&&(n+=typeof e=="object"?e.join(""):e);try{this.split=new RegExp("["+(i?"^":"")+n+"]+","u")}catch{this.split=/\s+/}}else this.split=e,s=e===!1||"a1a".split(e).length<2;this.numeric=z(t.numeric,s)}else{try{this.split=z(this.split,pe)}catch{this.split=/\s+/}this.numeric=z(t.numeric,z(this.numeric,!0))}if(this.prepare=z(t.prepare,null,this.prepare),this.finalize=z(t.finalize,null,this.finalize),e=t.filter,this.filter=typeof e=="function"?e:z(e&&new Set(e),null,this.filter),this.dedupe=z(t.dedupe,!0,this.dedupe),this.matcher=z((e=t.matcher)&&new Map(e),null,this.matcher),this.mapper=z((e=t.mapper)&&new Map(e),null,this.mapper),this.stemmer=z((e=t.stemmer)&&new Map(e),null,this.stemmer),this.replacer=z(t.replacer,null,this.replacer),this.minlength=z(t.minlength,1,this.minlength),this.maxlength=z(t.maxlength,1024,this.maxlength),this.rtl=z(t.rtl,!1,this.rtl),(this.cache=e=z(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof e=="number"?e:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const n of this.matcher.keys())this.h+=(this.h?"|":"")+n;if(this.stemmer)for(const n of this.stemmer.keys())this.A+=(this.A?"|":"")+n;return this},y.addStemmer=function(t,i){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,i),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&V(this),this},y.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&V(this),this},y.addMapper=function(t,i){return typeof t=="object"?this.addReplacer(t,i):t.length>1?this.addMatcher(t,i):(this.mapper||(this.mapper=new Map),this.mapper.set(t,i),this.cache&&V(this),this)},y.addMatcher=function(t,i){return typeof t=="object"?this.addReplacer(t,i):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,i):(this.matcher||(this.matcher=new Map),this.matcher.set(t,i),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&V(this),this)},y.addReplacer=function(t,i){return typeof t=="string"?this.addMatcher(t,i):(this.replacer||(this.replacer=[]),this.replacer.push(t,i),this.cache&&V(this),this)},y.encode=function(t,i){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(V,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=Ft?t.normalize("NFKD").replace(Ft,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(me,"$1 $2").replace(we,"$1 $2").replace(de,"$1 "));const e=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let s=[],n=q(),r,h,o=this.split||this.split===""?t.split(this.split):[t];for(let f=0,c,a;f<o.length;f++)if((c=a=o[f])&&!(c.length<this.minlength||c.length>this.maxlength)){if(i){if(n[c])continue;n[c]=1}else{if(r===c)continue;r=c}if(e)s.push(c);else if(!this.filter||(typeof this.filter=="function"?this.filter(c):!this.filter.has(c))){if(this.cache&&c.length<=this.I)if(this.F){var l=this.D.get(c);if(l||l===""){l&&s.push(l);continue}}else this.F=setTimeout(V,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let m;for(;m!==c&&c.length>2;)m=c,c=c.replace(this.K,p=>this.stemmer.get(p))}if(c&&(this.mapper||this.dedupe&&c.length>1)){l="";for(let m=0,p="",d,u;m<c.length;m++)d=c.charAt(m),d===p&&this.dedupe||((u=this.mapper&&this.mapper.get(d))||u===""?u===p&&this.dedupe||!(p=u)||(l+=u):l+=p=d);c=l}if(this.matcher&&c.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),c=c.replace(this.J,m=>this.matcher.get(m))),c&&this.replacer)for(l=0;c&&l<this.replacer.length;l+=2)c=c.replace(this.replacer[l],this.replacer[l+1]);if(this.cache&&a.length<=this.I&&(this.D.set(a,c),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),c){if(c!==a)if(i){if(n[c])continue;n[c]=1}else{if(h===c)continue;h=c}s.push(c)}}}return this.finalize&&(s=this.finalize(s)||s),this.cache&&t.length<=this.H&&(this.B.set(t,s),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),s};function V(t){t.F=null,t.B.clear(),t.D.clear()}function _t(t,i,e){e||(i||typeof t!="object"?typeof i=="object"&&(e=i,i=0):e=t),e&&(t=e.query||t,i=e.limit||i);let s=""+(i||0);e&&(s+=(e.offset||0)+!!e.context+!!e.suggest+(e.resolve!==!1)+(e.resolution||this.resolution)+(e.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new X);let n=this.cache.get(t+s);if(!n){const r=e&&e.cache;r&&(e.cache=!1),n=this.search(t,i,e),r&&(e.cache=r),this.cache.set(t+s,n)}return n}function X(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}X.prototype.set=function(t,i){this.cache.set(this.h=t,i),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)},X.prototype.get=function(t){const i=this.cache.get(t);return i&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,i)),i},X.prototype.remove=function(t){for(const i of this.cache){const e=i[0];i[1].includes(t)&&this.cache.delete(e)}},X.prototype.clear=function(){this.cache.clear(),this.h=""};const Tt={normalize:!1,numeric:!1,dedupe:!1},at={},jt=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),Kt=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Gt=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],Jt={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var Wt={Exact:Tt,Default:at,Normalize:at,LatinBalance:{mapper:jt},LatinAdvanced:{mapper:jt,matcher:Kt,replacer:Gt},LatinExtra:{mapper:jt,replacer:Gt.concat([/(?!^)[aeo]/g,""]),matcher:Kt},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let e=0;e<t.length;e++){var i=t[e];let s=i.charAt(0),n=Jt[s];for(let r=1,h;r<i.length&&(h=i.charAt(r),h==="h"||h==="w"||!(h=Jt[h])||h===n||(s+=h,n=h,s.length!==4));r++);t[e]=s}}},CJK:{split:""},LatinExact:Tt,LatinDefault:at,LatinSimple:at};function Ut(t,i,e,s){let n=[];for(let r=0,h;r<t.index.length;r++)if(h=t.index[r],i>=h.length)i-=h.length;else{i=h[s?"splice":"slice"](i,e);const o=i.length;if(o&&(n=n.length?n.concat(i):i,e-=o,s&&(t.length-=o),!e))break;i=0}return n}function H(t){if(!this||this.constructor!==H)return new H(t);this.index=t?[t]:[],this.length=t?t.length:0;const i=this;return new Proxy([],{get(e,s){if(s==="length")return i.length;if(s==="push")return function(n){i.index[i.index.length-1].push(n),i.length++};if(s==="pop")return function(){if(i.length)return i.length--,i.index[i.index.length-1].pop()};if(s==="indexOf")return function(n){let r=0;for(let h=0,o,l;h<i.index.length;h++){if(o=i.index[h],l=o.indexOf(n),l>=0)return r+l;r+=o.length}return-1};if(s==="includes")return function(n){for(let r=0;r<i.index.length;r++)if(i.index[r].includes(n))return!0;return!1};if(s==="slice")return function(n,r){return Ut(i,n||0,r||i.length,!1)};if(s==="splice")return function(n,r){return Ut(i,n||0,r||i.length,!0)};if(s==="constructor")return Array;if(typeof s!="symbol")return(e=i.index[s/2**31|0])&&e[s]},set(e,s,n){return e=s/2**31|0,(i.index[e]||(i.index[e]=[]))[s]=n,i.length++,!0}})}H.prototype.clear=function(){this.index.length=0},H.prototype.push=function(){};function T(t=8){if(!this||this.constructor!==T)return new T(t);this.index=q(),this.h=[],this.size=0,t>32?(this.B=Zt,this.A=BigInt(t)):(this.B=Rt,this.A=t)}T.prototype.get=function(t){const i=this.index[this.B(t)];return i&&i.get(t)},T.prototype.set=function(t,i){var e=this.B(t);let s=this.index[e];s?(e=s.size,s.set(t,i),(e-=s.size)&&this.size++):(this.index[e]=s=new Map([[t,i]]),this.h.push(s),this.size++)};function K(t=8){if(!this||this.constructor!==K)return new K(t);this.index=q(),this.h=[],this.size=0,t>32?(this.B=Zt,this.A=BigInt(t)):(this.B=Rt,this.A=t)}K.prototype.add=function(t){var i=this.B(t);let e=this.index[i];e?(i=e.size,e.add(t),(i-=e.size)&&this.size++):(this.index[i]=e=new Set([t]),this.h.push(e),this.size++)},y=T.prototype,y.has=K.prototype.has=function(t){const i=this.index[this.B(t)];return i&&i.has(t)},y.delete=K.prototype.delete=function(t){const i=this.index[this.B(t)];i&&i.delete(t)&&this.size--},y.clear=K.prototype.clear=function(){this.index=q(),this.h=[],this.size=0},y.values=K.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let i of this.h[t].values())yield i},y.keys=K.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let i of this.h[t].keys())yield i},y.entries=K.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let i of this.h[t].entries())yield i};function Rt(t){let i=2**this.A-1;if(typeof t=="number")return t&i;let e=0,s=this.A+1;for(let n=0;n<t.length;n++)e=(e*s^t.charCodeAt(n))&i;return this.A===32?e+2**31:e}function Zt(t){let i=BigInt(2)**this.A-BigInt(1);var e=typeof t;if(e==="bigint")return t&i;if(e==="number")return BigInt(t)&i;e=BigInt(0);let s=this.A+BigInt(1);for(let n=0;n<t.length;n++)e=(e*s^BigInt(t.charCodeAt(n)))&i;return e}let tt,ot;async function ye(t){t=t.data;var i=t.task;const e=t.id;let s=t.args;switch(i){case"init":ot=t.options||{},(i=t.factory)?(Function("return "+i)()(self),tt=new self.FlexSearch.Index(ot),delete self.FlexSearch):tt=new G(ot),postMessage({id:e});break;default:let n;i==="export"&&(s[1]?(s[0]=ot.export,s[2]=0,s[3]=1):s=null),i==="import"?s[0]&&(t=await ot.import.call(tt,s[0]),tt.import(s[0],t)):((n=s&&tt[i].apply(tt,s))&&n.then&&(n=await n),n&&n.await&&(n=await n.await),i==="search"&&n.result&&(n=n.result)),postMessage(i==="search"?{id:e,msg:n}:{id:e})}}function Bt(t){et.call(t,"add"),et.call(t,"append"),et.call(t,"search"),et.call(t,"update"),et.call(t,"remove"),et.call(t,"searchCache")}let St,Qt,gt;function be(){St=gt=0}function et(t){this[t+"Async"]=function(){const i=arguments;var e=i[i.length-1];let s;if(typeof e=="function"&&(s=e,delete i[i.length-1]),St?gt||(gt=Date.now()-Qt>=this.priority*this.priority*3):(St=setTimeout(be,0),Qt=Date.now()),gt){const r=this;return new Promise(h=>{setTimeout(function(){h(r[t+"Async"].apply(r,i))},0)})}const n=this[t].apply(this,i);return e=n.then?n:new Promise(r=>r(n)),s&&e.then(s),e}}let U=0;function it(t={},i){function e(o){function l(f){f=f.data||f;const c=f.id,a=c&&r.h[c];a&&(a(f.msg),delete r.h[c])}if(this.worker=o,this.h=q(),this.worker)return n?this.worker.on("message",l):this.worker.onmessage=l,t.config?new Promise(function(f){U>1e9&&(U=0),r.h[++U]=function(){f(r)},r.worker.postMessage({id:U,task:"init",factory:s,options:t})}):(this.priority=t.priority||4,this.encoder=i||null,this.worker.postMessage({task:"init",factory:s,options:t}),this)}if(!this||this.constructor!==it)return new it(t);let s=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;s&&(s=s.toString());const n=typeof window>"u",r=this,h=xe(s,n,t.worker);return h.then?h.then(function(o){return e.call(r,o)}):e.call(this,h)}R("add"),R("append"),R("search"),R("update"),R("remove"),R("clear"),R("export"),R("import"),it.prototype.searchCache=_t,Bt(it.prototype);function R(t){it.prototype[t]=function(){const i=this,e=[].slice.call(arguments);var s=e[e.length-1];let n;return typeof s=="function"&&(n=s,e.pop()),s=new Promise(function(r){t==="export"&&typeof e[0]=="function"&&(e[0]=null),U>1e9&&(U=0),i.h[++U]=r,i.worker.postMessage({task:t,id:U,args:e})}),n?(s.then(n),this):s}}function xe(t,i,e){return i?new ge.Worker(__dirname+"/worker/node.js"):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ye.toString()],{type:"text/javascript"}))):new window.Worker(typeof e=="string"?e:self.location.href.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}st.prototype.add=function(t,i,e){if(rt(t)&&(i=t,t=ht(i,this.key)),i&&(t||t===0)){if(!e&&this.reg.has(t))return this.update(t,i);for(let o=0,l;o<this.field.length;o++){l=this.B[o];var s=this.index.get(this.field[o]);if(typeof l=="function"){var n=l(i);n&&s.add(t,n,e,!0)}else n=l.G,(!n||n(i))&&(l.constructor===String?l=[""+l]:F(l)&&(l=[l]),Pt(i,l,this.D,0,s,t,l[0],e))}if(this.tag)for(s=0;s<this.A.length;s++){var r=this.A[s];n=this.tag.get(this.F[s]);let o=q();if(typeof r=="function"){if(r=r(i),!r)continue}else{var h=r.G;if(h&&!h(i))continue;r.constructor===String&&(r=""+r),r=ht(i,r)}if(n&&r){F(r)&&(r=[r]);for(let l=0,f,c;l<r.length;l++)if(f=r[l],!o[f]&&(o[f]=1,(h=n.get(f))?c=h:n.set(f,c=[]),!e||!c.includes(t))){if(c.length===2**31-1){if(h=new H(c),this.fastupdate)for(let a of this.reg.values())a.includes(c)&&(a[a.indexOf(c)]=h);n.set(f,c=h)}c.push(t),this.fastupdate&&((h=this.reg.get(t))?h.push(c):this.reg.set(t,[c]))}}}if(this.store&&(!e||!this.store.has(t))){let o;if(this.h){o=q();for(let l=0,f;l<this.h.length;l++){if(f=this.h[l],(e=f.G)&&!e(i))continue;let c;if(typeof f=="function"){if(c=f(i),!c)continue;f=[f.O]}else if(F(f)||f.constructor===String){o[f]=i[f];continue}Ct(i,o,f,0,f[0],c)}}this.store.set(t,o||i)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};function Ct(t,i,e,s,n,r){if(t=t[n],s===e.length-1)i[n]=r||t;else if(t)if(t.constructor===Array)for(i=i[n]=Array(t.length),n=0;n<t.length;n++)Ct(t,i,e,s,n);else i=i[n]||(i[n]=q()),n=e[++s],Ct(t,i,e,s,n)}function Pt(t,i,e,s,n,r,h,o){if(t=t[h])if(s===i.length-1){if(t.constructor===Array){if(e[s]){for(i=0;i<t.length;i++)n.add(r,t[i],!0,!0);return}t=t.join(" ")}n.add(r,t,o,!0)}else if(t.constructor===Array)for(h=0;h<t.length;h++)Pt(t,i,e,s,n,r,h,o);else h=i[++s],Pt(t,i,e,s,n,r,h,o)}function qt(t,i,e,s){if(!t.length)return t;if(t.length===1)return t=t[0],t=e||t.length>i?t.slice(e,e+i):t,s?nt.call(this,t):t;let n=[];for(let r=0,h,o;r<t.length;r++)if((h=t[r])&&(o=h.length)){if(e){if(e>=o){e-=o;continue}h=h.slice(e,e+i),o=h.length,e=0}if(o>i&&(h=h.slice(0,i),o=i),!n.length&&o>=i)return s?nt.call(this,h):h;if(n.push(h),i-=o,!i)break}return n=n.length>1?[].concat.apply([],n):n[0],s?nt.call(this,n):n}function pt(t,i,e,s){var n=s[0];if(n[0]&&n[0].query)return t[i].apply(t,n);if(!(i!=="and"&&i!=="not"||t.result.length||t.await||n.suggest))return s.length>1&&(n=s[s.length-1]),(s=n.resolve)?t.await||t.result:t;let r=[],h=0,o=0,l,f,c,a,m;for(i=0;i<s.length;i++)if(n=s[i]){var p=void 0;if(n.constructor===P)p=n.await||n.result;else if(n.then||n.constructor===Array)p=n;else{h=n.limit||0,o=n.offset||0,c=n.suggest,f=n.resolve,l=((a=n.highlight||t.highlight)||n.enrich)&&f,p=n.queue;let d=n.async||p,u=n.index,g=n.query;if(u?t.index||(t.index=u):u=t.index,g||n.tag){const b=n.field||n.pluck;if(b&&(!g||t.query&&!a||(t.query=g,t.field=b,t.highlight=a),u=u.index.get(b)),p&&(m||t.await)){m=1;let w;const k=t.C.length,B=new Promise(function(S){w=S});(function(S,j){B.h=function(){j.index=null,j.resolve=!1;let A=d?S.searchAsync(j):S.search(j);return A.then?A.then(function(x){return t.C[k]=x=x.result||x,w(x),x}):(A=A.result||A,w(A),A)}})(u,Object.assign({},n)),t.C.push(B),r[i]=B;continue}else n.resolve=!1,n.index=null,p=d?u.searchAsync(n):u.search(n),n.resolve=f,n.index=u}else if(n.and)p=dt(n,"and",u);else if(n.or)p=dt(n,"or",u);else if(n.not)p=dt(n,"not",u);else if(n.xor)p=dt(n,"xor",u);else continue}p.await?(m=1,p=p.await):p.then?(m=1,p=p.then(function(d){return d.result||d})):p=p.result||p,r[i]=p}if(m&&!t.await&&(t.await=new Promise(function(d){t.return=d})),m){const d=Promise.all(r).then(function(u){for(let g=0;g<t.C.length;g++)if(t.C[g]===d){t.C[g]=function(){return e.call(t,u,h,o,l,f,c,a)};break}zt(t)});t.C.push(d)}else if(t.await)t.C.push(function(){return e.call(t,r,h,o,l,f,c,a)});else return e.call(t,r,h,o,l,f,c,a);return f?t.await||t.result:t}function dt(t,i,e){t=t[i];const s=t[0]||t;return s.index||(s.index=e),e=new P(s),t.length>1&&(e=e[i].apply(e,t.slice(1))),e}P.prototype.or=function(){return pt(this,"or",ve,arguments)};function ve(t,i,e,s,n,r,h){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=Vt(t,i,e,!1,this.h),e=0)),n&&(this.await=null),n?this.resolve(i,e,s,h):this}P.prototype.and=function(){return pt(this,"and",ke,arguments)};function ke(t,i,e,s,n,r,h){if(!r&&!this.result.length)return n?this.result:this;let o;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let l=0;for(let f=0,c,a;f<t.length;f++)if((c=t[f])&&(a=c.length))l<a&&(l=a);else if(!r){l=0;break}l?(this.result=wt(t,l,i,e,r,this.h,n),o=!0):this.result=[]}else r||(this.result=t);return n&&(this.await=null),n?this.resolve(i,e,s,h,o):this}P.prototype.xor=function(){return pt(this,"xor",Ae,arguments)};function Ae(t,i,e,s,n,r,h){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{t:{r=e;var o=this.h;const l=[],f=q();let c=0;for(let a=0,m;a<t.length;a++)if(m=t[a]){c<m.length&&(c=m.length);for(let p=0,d;p<m.length;p++)if(d=m[p])for(let u=0,g;u<d.length;u++)g=d[u],f[g]=f[g]?2:1}for(let a=0,m,p=0;a<c;a++)for(let d=0,u;d<t.length;d++)if((u=t[d])&&(m=u[a])){for(let g=0,b;g<m.length;g++)if(b=m[g],f[b]===1)if(r)r--;else if(n){if(l.push(b),l.length===i){t=l;break t}}else{const w=a+(d?o:0);if(l[w]||(l[w]=[]),l[w].push(b),++p===i){t=l;break t}}}t=l}this.result=t,o=!0}else r||(this.result=t);return n&&(this.await=null),n?this.resolve(i,e,s,h,o):this}P.prototype.not=function(){return pt(this,"not",_e,arguments)};function _e(t,i,e,s,n,r,h){if(!r&&!this.result.length)return n?this.result:this;if(t.length&&this.result.length){t:{r=e;var o=[];t=new Set(t.flat().flat());for(let l=0,f,c=0;l<this.result.length;l++)if(f=this.result[l]){for(let a=0,m;a<f.length;a++)if(m=f[a],!t.has(m)){if(r)r--;else if(n){if(o.push(m),o.length===i){t=o;break t}}else if(o[l]||(o[l]=[]),o[l].push(m),++c===i){t=o;break t}}}t=o}this.result=t,o=!0}return n&&(this.await=null),n?this.resolve(i,e,s,h,o):this}function mt(t,i,e,s,n){let r,h,o;typeof n=="string"?(r=n,n=""):r=n.template,h=r.indexOf("$1"),o=r.substring(h+2),h=r.substring(0,h);let l=n&&n.boundary,f=!n||n.clip!==!1,c=n&&n.merge&&o&&h&&new RegExp(o+" "+h,"g");n=n&&n.ellipsis;var a=0;if(typeof n=="object"){var m=n.template;a=m.length-2,n=n.pattern}typeof n!="string"&&(n=n===!1?"":"..."),a&&(n=m.replace("$1",n)),m=n.length-a;let p,d;typeof l=="object"&&(p=l.before,p===0&&(p=-1),d=l.after,d===0&&(d=-1),l=l.total||9e5),a=new Map;for(let Et=0,I,oe,ct;Et<i.length;Et++){let ut;if(s)ut=i,ct=s;else{var u=i[Et];if(ct=u.field,!ct)continue;ut=u.result}oe=e.get(ct),I=oe.encoder,u=a.get(I),typeof u!="string"&&(u=I.encode(t),a.set(I,u));for(let kt=0;kt<ut.length;kt++){var g=ut[kt].doc;if(!g||(g=ht(g,ct),!g))continue;var b=g.trim().split(/\s+/);if(!b.length)continue;g="";var w=[];let At=[];for(var k=-1,B=-1,S=0,j=0;j<b.length;j++){var A=b[j],x=I.encode(A);x=x.length>1?x.join(" "):x[0];let v;if(x&&A){for(var _=A.length,L=(I.split?A.replace(I.split,""):A).length-x.length,C="",$=0,O=0;O<u.length;O++){var N=u[O];if(N){var M=N.length;M+=L<0?0:L,$&&M<=$||(N=x.indexOf(N),N>-1&&(C=(N?A.substring(0,N):"")+h+A.substring(N,N+M)+o+(N+M<_?A.substring(N+M):""),$=M,v=!0))}}C&&(l&&(k<0&&(k=g.length+(g?1:0)),B=g.length+(g?1:0)+C.length,S+=_,At.push(w.length),w.push({match:C})),g+=(g?" ":"")+C)}if(!v)A=b[j],g+=(g?" ":"")+A,l&&w.push({text:A});else if(l&&S>=l)break}if(S=At.length*(r.length-2),p||d||l&&g.length-S>l)if(S=l+S-m*2,j=B-k,p>0&&(j+=p),d>0&&(j+=d),j<=S)b=p?k-(p>0?p:0):k-((S-j)/2|0),w=d?B+(d>0?d:0):b+S,f||(b>0&&g.charAt(b)!==" "&&g.charAt(b-1)!==" "&&(b=g.indexOf(" ",b),b<0&&(b=0)),w<g.length&&g.charAt(w-1)!==" "&&g.charAt(w)!==" "&&(w=g.lastIndexOf(" ",w),w<B?w=B:++w)),g=(b?n:"")+g.substring(b,w)+(w<g.length?n:"");else{for(B=[],k={},S={},j={},A={},x={},C=L=_=0,O=$=1;;){var J=void 0;for(let v=0,D;v<At.length;v++){if(D=At[v],C)if(L!==C){if(j[v+1])continue;if(D+=C,k[D]){_-=m,S[v+1]=1,j[v+1]=1;continue}if(D>=w.length-1){if(D>=w.length){j[v+1]=1,D>=b.length&&(S[v+1]=1);continue}_-=m}if(g=w[D].text,M=d&&x[v])if(M>0){if(g.length>M)if(j[v+1]=1,f)g=g.substring(0,M);else continue;(M-=g.length)||(M=-1),x[v]=M}else{j[v+1]=1;continue}if(_+g.length+1<=l)g=" "+g,B[v]+=g;else if(f)J=l-_-1,J>0&&(g=" "+g.substring(0,J),B[v]+=g),j[v+1]=1;else{j[v+1]=1;continue}}else{if(j[v])continue;if(D-=L,k[D]){_-=m,j[v]=1,S[v]=1;continue}if(D<=0){if(D<0){j[v]=1,S[v]=1;continue}_-=m}if(g=w[D].text,M=p&&A[v])if(M>0){if(g.length>M)if(j[v]=1,f)g=g.substring(g.length-M);else continue;(M-=g.length)||(M=-1),A[v]=M}else{j[v]=1;continue}if(_+g.length+1<=l)g+=" ",B[v]=g+B[v];else if(f)J=g.length+1-(l-_),J>=0&&J<g.length&&(g=g.substring(J)+" ",B[v]=g+B[v]),j[v]=1;else{j[v]=1;continue}}else{g=w[D].match,p&&(A[v]=p),d&&(x[v]=d),v&&_++;let fe;if(D?!v&&m&&(_+=m):(S[v]=1,j[v]=1),D>=b.length-1||D<w.length-1&&w[D+1].match?fe=1:m&&(_+=m),_-=r.length-2,!v||_+g.length<=l)B[v]=g;else{J=$=O=S[v]=0;break}fe&&(S[v+1]=1,j[v+1]=1)}_+=g.length,J=k[D]=1}if(J)L===C?C++:L++;else{if(L===C?$=0:O=0,!$&&!O)break;$?(L++,C=L):C++}}g="";for(let v=0,D;v<B.length;v++)D=(S[v]?v?" ":"":(v&&!n?" ":"")+n)+B[v],g+=D;n&&!S[B.length]&&(g+=n)}c&&(g=g.replace(c," ")),ut[kt].highlight=g}if(s)break}return i}function P(t,i){if(!this||this.constructor!==P)return new P(t,i);let e=0,s,n,r,h,o,l;if(t&&t.index){const f=t;if(i=f.index,e=f.boost||0,n=f.query){r=f.field||f.pluck,h=f.highlight;const c=f.resolve;t=f.async||f.queue,f.resolve=!1,f.index=null,t=t?i.searchAsync(f):i.search(f),f.resolve=c,f.index=i,t=t.result||t}else t=[]}if(t&&t.then){const f=this;t=t.then(function(c){f.C[0]=f.result=c.result||c,zt(f)}),s=[t],t=[],o=new Promise(function(c){l=c})}this.index=i||null,this.result=t||[],this.h=e,this.C=s||[],this.await=o||null,this.return=l||null,this.highlight=h||null,this.query=n||"",this.field=r||""}y=P.prototype,y.limit=function(t){if(this.await){const i=this;this.C.push(function(){return i.limit(t).result})}else if(this.result.length){const i=[];for(let e=0,s;e<this.result.length;e++)if(s=this.result[e])if(s.length<=t){if(i[e]=s,t-=s.length,!t)break}else{i[e]=s.slice(0,t);break}this.result=i}return this},y.offset=function(t){if(this.await){const i=this;this.C.push(function(){return i.offset(t).result})}else if(this.result.length){const i=[];for(let e=0,s;e<this.result.length;e++)(s=this.result[e])&&(s.length<=t?t-=s.length:(i[e]=s.slice(t),t=0));this.result=i}return this},y.boost=function(t){if(this.await){const i=this;this.C.push(function(){return i.boost(t).result})}else this.h+=t;return this};function zt(t,i){let e=t.result;var s=t.await;t.await=null;for(let n=0,r;n<t.C.length;n++)if(r=t.C[n]){if(typeof r=="function")e=r(),t.C[n]=e=e.result||e,n--;else if(r.h)e=r.h(),t.C[n]=e=e.result||e,n--;else if(r.then)return t.await=s}return s=t.return,t.C=[],t.return=null,i||s(e),e}y.resolve=function(t,i,e,s,n){let r=this.await?zt(this,!0):this.result;if(r.then){const h=this;return r.then(function(){return h.resolve(t,i,e,s,n)})}return r.length&&(typeof t=="object"?(s=t.highlight||this.highlight,e=!!s||t.enrich,i=t.offset,t=t.limit):(s=s||this.highlight,e=!!s||e),r=n?e?nt.call(this.index,r):r:qt.call(this.index,r,t||100,i,e)),this.finalize(r,s)},y.finalize=function(t,i){if(t.then){const s=this;return t.then(function(n){return s.finalize(n,i)})}i&&t.length&&this.query&&(t=mt(this.query,t,this.index.index,this.field,i));const e=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",e&&e(t),t};function wt(t,i,e,s,n,r,h){const o=t.length;let l=[],f,c;f=q();for(let a=0,m,p,d,u;a<i;a++)for(let g=0;g<o;g++)if(d=t[g],a<d.length&&(m=d[a]))for(let b=0;b<m.length;b++){if(p=m[b],(c=f[p])?f[p]++:(c=0,f[p]=1),u=l[c]||(l[c]=[]),!h){let w=a+(g||!n?0:r||0);u=u[w]||(u[w]=[])}if(u.push(p),h&&e&&c===o-1&&u.length-s===e)return s?u.slice(s):u}if(t=l.length)if(n)l=l.length>1?Vt(l,e,s,h,r):(l=l[0])&&e&&l.length>e||s?l.slice(s,e+s):l;else{if(t<o)return[];if(l=l[t-1],e||s)if(h)(l.length>e||s)&&(l=l.slice(s,e+s));else{n=[];for(let a=0,m;a<l.length;a++)if(m=l[a]){if(s&&m.length>s)s-=m.length;else if((e&&m.length>e||s)&&(m=m.slice(s,e+s),e-=m.length,s&&(s-=m.length)),n.push(m),!e)break}l=n}}return l}function Vt(t,i,e,s,n){const r=[],h=q();let o;var l=t.length;let f;if(s){for(n=l-1;n>=0;n--)if(f=(s=t[n])&&s.length){for(l=0;l<f;l++)if(o=s[l],!h[o]){if(h[o]=1,e)e--;else if(r.push(o),r.length===i)return r}}}else for(let c=l-1,a,m=0;c>=0;c--){a=t[c];for(let p=0;p<a.length;p++)if(f=(s=a[p])&&s.length){for(let d=0;d<f;d++)if(o=s[d],!h[o])if(h[o]=1,e)e--;else{let u=(p+(c<l-1&&n||0))/(c+1)|0;if((r[u]||(r[u]=[])).push(o),++m===i)return r}}}return r}function je(t,i,e,s,n){const r=q(),h=[];for(let o=0,l;o<i.length;o++){l=i[o];for(let f=0;f<l.length;f++)r[l[f]]=1}if(n){for(let o=0,l;o<t.length;o++)if(l=t[o],r[l]){if(s)s--;else if(h.push(l),r[l]=0,e&&--e===0)break}}else for(let o=0,l,f;o<t.result.length;o++)for(l=t.result[o],i=0;i<l.length;i++)f=l[i],r[f]&&((h[o]||(h[o]=[])).push(f),r[f]=0);return h}st.prototype.search=function(t,i,e,s){e||(!i&&rt(t)?(e=t,t=""):rt(i)&&(e=i,i=0));let n=[];var r=[];let h,o,l,f,c,a,m=0,p=!0,d;if(e){e.constructor===Array&&(e={index:e}),t=e.query||t,h=e.pluck,o=e.merge,f=e.boost,a=h||e.field||(a=e.index)&&(a.index?null:a);var u=this.tag&&e.tag;l=e.suggest,p=e.resolve!==!1,c=e.cache,d=p&&this.store&&e.highlight;var g=!!d||p&&this.store&&e.enrich;i=e.limit||i;var b=e.offset||0;if(i||(i=p?100:0),u&&(!this.db||!s)){u.constructor!==Array&&(u=[u]);var w=[];for(let A=0,x;A<u.length;A++)if(x=u[A],x.field&&x.tag){var k=x.tag;if(k.constructor===Array)for(var B=0;B<k.length;B++)w.push(x.field,k[B]);else w.push(x.field,k)}else{k=Object.keys(x);for(let _=0,L,C;_<k.length;_++)if(L=k[_],C=x[L],C.constructor===Array)for(B=0;B<C.length;B++)w.push(L,C[B]);else w.push(L,C)}if(u=w,!t){if(r=[],w.length)for(u=0;u<w.length;u+=2){if(this.db){if(s=this.index.get(w[u]),!s)continue;r.push(s=s.db.tag(w[u+1],i,b,g))}else s=Be.call(this,w[u],w[u+1],i,b,g);n.push(p?{field:w[u],tag:w[u+1],result:s}:[s])}if(r.length){const A=this;return Promise.all(r).then(function(x){for(let _=0;_<x.length;_++)p?n[_].result=x[_]:n[_]=x[_];return p?n:new P(n.length>1?wt(n,1,0,0,l,f):n[0],A)})}return p?n:new P(n.length>1?wt(n,1,0,0,l,f):n[0],this)}}p||h||!(a=a||this.field)||(F(a)?h=a:(a.constructor===Array&&a.length===1&&(a=a[0]),h=a.field||a.index)),a&&a.constructor!==Array&&(a=[a])}a||(a=this.field);let S;w=(this.worker||this.db)&&!s&&[];for(let A=0,x,_,L;A<a.length;A++){if(_=a[A],this.db&&this.tag&&!this.B[A])continue;let C;if(F(_)||(C=_,_=C.field,t=C.query||t,i=E(C.limit,i),b=E(C.offset,b),l=E(C.suggest,l),d=p&&this.store&&E(C.highlight,d),g=!!d||p&&this.store&&E(C.enrich,g),c=E(C.cache,c)),s)x=s[A];else{k=C||e||{},B=k.enrich;var j=this.index.get(_);if(u&&(this.db&&(k.tag=u,k.field=a,S=j.db.support_tag_search),!S&&B&&(k.enrich=!1),S||(k.limit=0,k.offset=0)),x=c?j.searchCache(t,u&&!S?0:i,k):j.search(t,u&&!S?0:i,k),u&&!S&&(k.limit=i,k.offset=b),B&&(k.enrich=B),w){w[A]=x;continue}}if(L=(x=x.result||x)&&x.length,u&&L){if(k=[],B=0,this.db&&s){if(!S)for(j=a.length;j<s.length;j++){let $=s[j];if($&&$.length)B++,k.push($);else if(!l)return p?n:new P(n,this)}}else for(let $=0,O,N;$<u.length;$+=2){if(O=this.tag.get(u[$]),!O){if(l)continue;return p?n:new P(n,this)}if(N=(O=O&&O.get(u[$+1]))&&O.length)B++,k.push(O);else if(!l)return p?n:new P(n,this)}if(B){if(x=je(x,k,i,b,p),L=x.length,!L&&!l)return p?x:new P(x,this);B--}}if(L)r[m]=_,n.push(x),m++;else if(a.length===1)return p?n:new P(n,this)}if(w){if(this.db&&u&&u.length&&!S)for(g=0;g<u.length;g+=2){if(r=this.index.get(u[g]),!r){if(l)continue;return p?n:new P(n,this)}w.push(r.db.tag(u[g+1],i,b,!1))}const A=this;return Promise.all(w).then(function(x){return e&&(e.resolve=p),x.length&&(x=A.search(t,i,e,x)),x})}if(!m)return p?n:new P(n,this);if(h&&(!g||!this.store))return n=n[0],p?n:new P(n,this);for(w=[],b=0;b<r.length;b++){if(u=n[b],g&&u.length&&typeof u[0].doc>"u"&&(this.db?w.push(u=this.index.get(this.field[0]).db.enrich(u)):u=nt.call(this,u)),h)return p?d?mt(t,u,this.index,h,d):u:new P(u,this);n[b]={field:r[b],result:u}}if(g&&this.db&&w.length){const A=this;return Promise.all(w).then(function(x){for(let _=0;_<x.length;_++)n[_].result=x[_];return d&&(n=mt(t,n,A.index,h,d)),o?Xt(n):n})}return d&&(n=mt(t,n,this.index,h,d)),o?Xt(n):n};function Xt(t){const i=[],e=q(),s=q();for(let n=0,r,h,o,l,f,c,a;n<t.length;n++){r=t[n],h=r.field,o=r.result;for(let m=0;m<o.length;m++)f=o[m],typeof f!="object"?f={id:l=f}:l=f.id,(c=e[l])?c.push(h):(f.field=e[l]=[h],i.push(f)),(a=f.highlight)&&(c=s[l],c||(s[l]=c={},f.highlight=c),c[h]=a)}return i}function Be(t,i,e,s,n){return t=this.tag.get(t),t?(t=t.get(i),t?(i=t.length-s,i>0&&((e&&i>e||s)&&(t=t.slice(s,s+e)),n&&(t=nt.call(this,t))),t):[]):[]}function nt(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);const i=Array(t.length);for(let e=0,s;e<t.length;e++)s=t[e],i[e]={id:s,doc:this.store.get(s)};return i}function st(t){if(!this||this.constructor!==st)return new st(t);const i=t.document||t.doc||t;let e,s;if(this.B=[],this.field=[],this.D=[],this.key=(e=i.key||i.id)&&yt(e,this.D)||"id",(s=t.keystore||0)&&(this.keystore=s),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?s?new K(s):new Set:s?new T(s):new Map,this.h=(e=i.store||null)&&e&&e!==!0&&[],this.store=e?s?new T(s):new Map:null,this.cache=(e=t.cache||null)&&new X(e),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=Se.call(this,t,i),this.tag=null,(e=i.tag)&&(typeof e=="string"&&(e=[e]),e.length)){this.tag=new Map,this.A=[],this.F=[];for(let n=0,r,h;n<e.length;n++){if(r=e[n],h=r.field||r,!h)throw Error("The tag field from the document descriptor is undefined.");r.custom?this.A[n]=r.custom:(this.A[n]=yt(h,this.D),r.filter&&(typeof this.A[n]=="string"&&(this.A[n]=new String(this.A[n])),this.A[n].G=r.filter)),this.F[n]=h,this.tag.set(h,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(const n of this.index.values())n.then&&t.push(n);if(t.length){const n=this;return Promise.all(t).then(function(r){let h=0;for(const o of n.index.entries()){const l=o[0];let f=o[1];f.then&&(f=r[h],n.index.set(l,f),h++)}return n})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}y=st.prototype,y.mount=function(t){let i=this.field;if(this.tag)for(let r=0,h;r<this.F.length;r++){h=this.F[r];var e=void 0;this.index.set(h,e=new G({},this.reg)),i===this.field&&(i=i.slice(0)),i.push(h),e.tag=this.tag.get(h)}e=[];const s={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let r=0,h,o;r<i.length;r++){s.field=o=i[r],h=this.index.get(o);const l=new t.constructor(t.id,s);l.id=t.id,e[r]=l.mount(h),h.document=!0,r?h.bypass=!0:h.store=this.store}const n=this;return this.db=Promise.all(e).then(function(){n.db=!0})},y.commit=async function(){const t=[];for(const i of this.index.values())t.push(i.commit());await Promise.all(t),this.reg.clear()},y.destroy=function(){const t=[];for(const i of this.index.values())t.push(i.destroy());return Promise.all(t)};function Se(t,i){const e=new Map;let s=i.index||i.field||i;F(s)&&(s=[s]);for(let r=0,h,o;r<s.length;r++){if(h=s[r],F(h)||(o=h,h=h.field),o=rt(o)?Object.assign({},t,o):t,this.worker){var n=void 0;n=(n=o.encoder)&&n.encode?n:new lt(typeof n=="string"?Wt[n]:n||{}),n=new it(o,n),e.set(h,n)}this.worker||e.set(h,new G(o,this.reg)),o.custom?this.B[r]=o.custom:(this.B[r]=yt(h,this.D),o.filter&&(typeof this.B[r]=="string"&&(this.B[r]=new String(this.B[r])),this.B[r].G=o.filter)),this.field[r]=h}if(this.h){t=i.store,F(t)&&(t=[t]);for(let r=0,h,o;r<t.length;r++)h=t[r],o=h.field||h,h.custom?(this.h[r]=h.custom,h.custom.O=o):(this.h[r]=yt(o,this.D),h.filter&&(typeof this.h[r]=="string"&&(this.h[r]=new String(this.h[r])),this.h[r].G=h.filter))}return e}function yt(t,i){const e=t.split(":");let s=0;for(let n=0;n<e.length;n++)t=e[n],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(i[s]=!0),t&&(e[s++]=t);return s<e.length&&(e.length=s),s>1?e:e[0]}y.append=function(t,i){return this.add(t,i,!0)},y.update=function(t,i){return this.remove(t).add(t,i)},y.remove=function(t){rt(t)&&(t=ht(t,this.key));for(var i of this.index.values())i.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let e of this.tag.values())for(let s of e){i=s[0];const n=s[1],r=n.indexOf(t);r>-1&&(n.length>1?n.splice(r,1):e.delete(i))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this},y.clear=function(){const t=[];for(const i of this.index.values()){const e=i.clear();e.then&&t.push(e)}if(this.tag)for(const i of this.tag.values())i.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this},y.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)},y.cleanup=function(){for(const t of this.index.values())t.cleanup();return this},y.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(i){return i[0]&&i[0].doc||null}):this.store.get(t)||null},y.set=function(t,i){return typeof t=="object"&&(i=t,t=ht(i,this.key)),this.store.set(t,i),this},y.searchCache=_t,y.export=Ce,y.import=Pe,Bt(st.prototype);function Lt(t,i=0){let e=[],s=[];i&&(i=25e4/i*5e3|0);for(const n of t.entries())s.push(n),s.length===i&&(e.push(s),s=[]);return s.length&&e.push(s),e}function Dt(t,i){i||(i=new Map);for(let e=0,s;e<t.length;e++)s=t[e],i.set(s[0],s[1]);return i}function Yt(t,i=0){let e=[],s=[];i&&(i=25e4/i*1e3|0);for(const n of t.entries())s.push([n[0],Lt(n[1])[0]||[]]),s.length===i&&(e.push(s),s=[]);return s.length&&e.push(s),e}function It(t,i){i||(i=new Map);for(let e=0,s,n;e<t.length;e++)s=t[e],n=i.get(s[0]),i.set(s[0],Dt(s[1],n));return i}function Ht(t){let i=[],e=[];for(const s of t.keys())e.push(s),e.length===25e4&&(i.push(e),e=[]);return e.length&&i.push(e),i}function te(t,i){i||(i=new Set);for(let e=0;e<t.length;e++)i.add(t[e]);return i}function bt(t,i,e,s,n,r,h=0){const o=s&&s.constructor===Array;var l=o?s.shift():s;if(!l)return this.export(t,i,n,r+1);if((l=t((i?i+".":"")+(h+1)+"."+e,JSON.stringify(l)))&&l.then){const f=this;return l.then(function(){return bt.call(f,t,i,e,o?s:null,n,r,h+1)})}return bt.call(this,t,i,e,o?s:null,n,r,h+1)}function Ce(t,i,e=0,s=0){if(e<this.field.length){const h=this.field[e];if((i=this.index.get(h).export(t,h,e,s=1))&&i.then){const o=this;return i.then(function(){return o.export(t,h,e+1)})}return this.export(t,h,e+1)}let n,r;switch(s){case 0:n="reg",r=Ht(this.reg),i=null;break;case 1:n="tag",r=this.tag&&Yt(this.tag,this.reg.size),i=null;break;case 2:n="doc",r=this.store&&Lt(this.store),i=null;break;default:return}return bt.call(this,t,i,n,r||null,e,s)}function Pe(t,i){var e=t.split(".");e[e.length-1]==="json"&&e.pop();const s=e.length>2?e[0]:"";if(e=e.length>2?e[2]:e[1],this.worker&&s)return this.index.get(s).import(t);if(i){if(typeof i=="string"&&(i=JSON.parse(i)),s)return this.index.get(s).import(e,i);switch(e){case"reg":this.fastupdate=!1,this.reg=te(i,this.reg);for(let n=0,r;n<this.field.length;n++)r=this.index.get(this.field[n]),r.fastupdate=!1,r.reg=this.reg;if(this.worker){i=[];for(const n of this.index.values())i.push(n.import(t));return Promise.all(i)}break;case"tag":this.tag=It(i,this.tag);break;case"doc":this.store=Dt(i,this.store)}}}function ee(t,i){let e="";for(const s of t.entries()){t=s[0];const n=s[1];let r="";for(let h=0,o;h<n.length;h++){o=n[h]||[""];let l="";for(let f=0;f<o.length;f++)l+=(l?",":"")+(i==="string"?'"'+o[f]+'"':o[f]);l="["+l+"]",r+=(r?",":"")+l}r='["'+t+'",['+r+"]]",e+=(e?",":"")+r}return e}G.prototype.remove=function(t,i){const e=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(e){if(this.fastupdate){for(let s=0,n,r;s<e.length;s++)if((n=e[s])&&(r=n.length))if(n[r-1]===t)n.pop();else{const h=n.indexOf(t);h>=0&&n.splice(h,1)}}else ft(this.map,t),this.depth&&ft(this.ctx,t);i||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&re(this)),this.cache&&this.cache.remove(t),this};function ft(t,i){let e=0;var s=typeof i>"u";if(t.constructor===Array){for(let n=0,r,h,o;n<t.length;n++)if((r=t[n])&&r.length){if(s)return 1;if(h=r.indexOf(i),h>=0){if(r.length>1)return r.splice(h,1),1;if(delete t[n],e)return 1;o=1}else{if(o)return 1;e++}}}else for(let n of t.entries())s=n[0],ft(n[1],i)?e++:t.delete(s);return e}const qe={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};G.prototype.add=function(t,i,e,s){if(i&&(t||t===0)){if(!s&&!e&&this.reg.has(t))return this.update(t,i);s=this.depth,i=this.encoder.encode(i,!s);const f=i.length;if(f){const c=q(),a=q(),m=this.resolution;for(let p=0;p<f;p++){let d=i[this.rtl?f-1-p:p];var n=d.length;if(n&&(s||!a[d])){var r=this.score?this.score(i,d,p,null,0):xt(m,f,p),h="";switch(this.tokenize){case"tolerant":if(W(this,a,d,r,t,e),n>2){for(let u=1,g,b,w,k;u<n-1;u++)g=d.charAt(u),b=d.charAt(u+1),w=d.substring(0,u)+b,k=d.substring(u+2),h=w+g+k,W(this,a,h,r,t,e),h=w+k,W(this,a,h,r,t,e);W(this,a,d.substring(0,d.length-1),r,t,e)}break;case"full":if(n>2){for(let u=0,g;u<n;u++)for(r=n;r>u;r--){h=d.substring(u,r),g=this.rtl?n-1-u:u;var o=this.score?this.score(i,d,p,h,g):xt(m,f,p,n,g);W(this,a,h,o,t,e)}break}case"bidirectional":case"reverse":if(n>1){for(o=n-1;o>0;o--){h=d[this.rtl?n-1-o:o]+h;var l=this.score?this.score(i,d,p,h,o):xt(m,f,p,n,o);W(this,a,h,l,t,e)}h=""}case"forward":if(n>1){for(o=0;o<n;o++)h+=d[this.rtl?n-1-o:o],W(this,a,h,r,t,e);break}default:if(W(this,a,d,r,t,e),s&&f>1&&p<f-1)for(n=this.N,h=d,r=Math.min(s+1,this.rtl?p+1:f-p),o=1;o<r;o++){d=i[this.rtl?f-1-p-o:p+o],l=this.bidirectional&&d>h;const u=this.score?this.score(i,h,p,d,o-1):xt(n+(f/2>n?0:1),f,p,r-1,o-1);W(this,c,l?h:d,u,t,e,l?d:h)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(e?{ins:t}:{del:t}),this.M&&re(this)),this};function W(t,i,e,s,n,r,h){let o,l;if(!(o=i[e])||h&&!o[h]){if(h?(i=o||(i[e]=q()),i[h]=1,l=t.ctx,(o=l.get(h))?l=o:l.set(h,l=t.keystore?new T(t.keystore):new Map)):(l=t.map,i[e]=1),(o=l.get(e))?l=o:l.set(e,l=o=[]),r){for(let f=0,c;f<o.length;f++)if((c=o[f])&&c.includes(n)){if(f<=s)return;c.splice(c.indexOf(n),1),t.fastupdate&&(i=t.reg.get(n))&&i.splice(i.indexOf(c),1);break}}if(l=l[s]||(l[s]=[]),l.push(n),l.length===2**31-1){if(i=new H(l),t.fastupdate)for(let f of t.reg.values())f.includes(l)&&(f[f.indexOf(l)]=i);o[s]=l=i}t.fastupdate&&((s=t.reg.get(n))?s.push(l):t.reg.set(n,[l]))}}function xt(t,i,e,s,n){return e&&t>1?i+(s||0)<=t?e+(n||0):(t-1)/(i+(s||0))*(e+(n||0))+1|0:0}G.prototype.search=function(t,i,e){if(e||(i||typeof t!="object"?typeof i=="object"&&(e=i,i=0):(e=t,t="")),e&&e.cache)return e.cache=!1,t=this.searchCache(t,i,e),e.cache=!0,t;let s=[],n,r,h,o=0,l,f,c,a,m;e&&(t=e.query||t,i=e.limit||i,o=e.offset||0,r=e.context,h=e.suggest,m=(l=e.resolve)&&e.enrich,c=e.boost,a=e.resolution,f=this.db&&e.tag),typeof l>"u"&&(l=this.resolve),r=this.depth&&r!==!1;let p=this.encoder.encode(t,!r);if(n=p.length,i=i||(l?100:0),n===1)return ne.call(this,p[0],"",i,o,l,m,f);if(n===2&&r&&!h)return ne.call(this,p[1],p[0],i,o,l,m,f);let d=q(),u=0,g;if(r&&(g=p[0],u=1),a||a===0||(a=g?this.N:this.resolution),this.db){if(this.db.search&&(e=this.db.search(this,p,i,o,h,l,m,f),e!==!1))return e;const b=this;return async function(){for(let w,k;u<n;u++){if((k=p[u])&&!d[k]){if(d[k]=1,w=await Mt(b,k,g,0,0,!1,!1),w=se(w,s,h,a)){s=w;break}g&&(h&&w&&s.length||(g=k))}h&&g&&u===n-1&&!s.length&&(a=b.resolution,g="",u=-1,d=q())}return ie(s,a,i,o,h,c,l)}()}for(let b,w;u<n;u++){if((w=p[u])&&!d[w]){if(d[w]=1,b=Mt(this,w,g,0,0,!1,!1),b=se(b,s,h,a)){s=b;break}g&&(h&&b&&s.length||(g=w))}h&&g&&u===n-1&&!s.length&&(a=this.resolution,g="",u=-1,d=q())}return ie(s,a,i,o,h,c,l)};function ie(t,i,e,s,n,r,h){let o=t.length,l=t;if(o>1)l=wt(t,i,e,s,n,r,h);else if(o===1)return h?qt.call(null,t[0],e,s):new P(t[0],this);return h?l:new P(l,this)}function ne(t,i,e,s,n,r,h){return t=Mt(this,t,i,e,s,n,r,h),this.db?t.then(function(o){return n?o||[]:new P(o,this)}):t&&t.length?n?qt.call(this,t,e,s):new P(t,this):n?[]:new P([],this)}function se(t,i,e,s){let n=[];if(t&&t.length){if(t.length<=s){i.push(t);return}for(let r=0,h;r<s;r++)(h=t[r])&&(n[r]=h);if(n.length){i.push(n);return}}if(!e)return n}function Mt(t,i,e,s,n,r,h,o){let l;return e&&(l=t.bidirectional&&i>e)&&(l=e,e=i,i=l),t.db?t.db.get(i,e,s,n,r,h,o):(t=e?(t=t.ctx.get(e))&&t.get(i):t.map.get(i),t)}function G(t,i){if(!this||this.constructor!==G)return new G(t);if(t){var e=F(t)?t:t.preset;e&&(t=Object.assign({},qe[e],t))}else t={};e=t.context;const s=e===!0?{depth:1}:e||{},n=F(t.encoder)?Wt[t.encoder]:t.encode||t.encoder||{};this.encoder=n.encode?n:typeof n=="object"?new lt(n):{encode:n},this.resolution=t.resolution||9,this.tokenize=e=(e=t.tokenize)&&e!=="default"&&e!=="exact"&&e||"strict",this.depth=e==="strict"&&s.depth||0,this.bidirectional=s.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(e=t.keystore||0)&&(this.keystore=e),this.map=e?new T(e):new Map,this.ctx=e?new T(e):new Map,this.reg=i||(this.fastupdate?e?new T(e):new Map:e?new K(e):new Set),this.N=s.resolution||3,this.rtl=n.rtl||t.rtl||!1,this.cache=(e=t.cache||null)&&new X(e),this.resolve=t.resolve!==!1,(e=t.db)&&(this.db=this.mount(e)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}y=G.prototype,y.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)},y.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)},y.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};function re(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}y.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this},y.append=function(t,i){return this.add(t,i,!0)},y.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)},y.update=function(t,i){const e=this,s=this.remove(t);return s&&s.then?s.then(()=>e.add(t,i)):this.add(t,i)},y.cleanup=function(){return this.fastupdate?(ft(this.map),this.depth&&ft(this.ctx),this):this},y.searchCache=_t,y.export=function(t,i,e=0,s=0){let n,r;switch(s){case 0:n="reg",r=Ht(this.reg);break;case 1:n="cfg",r=null;break;case 2:n="map",r=Lt(this.map,this.reg.size);break;case 3:n="ctx",r=Yt(this.ctx,this.reg.size);break;default:return}return bt.call(this,t,i,n,r,e,s)},y.import=function(t,i){if(i)switch(typeof i=="string"&&(i=JSON.parse(i)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=te(i,this.reg);break;case"map":this.map=Dt(i,this.map);break;case"ctx":this.ctx=It(i,this.ctx)}},y.serialize=function(t=!0){let i="",e="",s="";if(this.reg.size){let r;for(var n of this.reg.keys())r||(r=typeof n),i+=(i?",":"")+(r==="string"?'"'+n+'"':n);i="index.reg=new Set(["+i+"]);",e=ee(this.map,r),e="index.map=new Map(["+e+"]);";for(const h of this.ctx.entries()){n=h[0];let o=ee(h[1],r);o="new Map(["+o+"])",o='["'+n+'",'+o+"]",s+=(s?",":"")+o}s="index.ctx=new Map(["+s+"]);"}return t?"function inject(index){"+i+e+s+"}":i+e+s},Bt(G.prototype);const he=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),vt=["map","ctx","tag","reg","cfg"],Y=q();function $t(t,i={}){if(!this||this.constructor!==$t)return new $t(t,i);typeof t=="object"&&(i=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=i.field?i.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=i.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}y=$t.prototype,y.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())},y.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),Y[t.id]||(Y[t.id]=[]),Y[t.id].push(t.field);const i=he.open(t.id,1);return i.onupgradeneeded=function(){const e=t.db=this.result;for(let s=0,n;s<vt.length;s++){n=vt[s];for(let r=0,h;r<Y[t.id].length;r++)h=Y[t.id][r],e.objectStoreNames.contains(n+(n!=="reg"&&h?":"+h:""))||e.createObjectStore(n+(n!=="reg"&&h?":"+h:""))}},t.db=Z(i,function(e){t.db=e,t.db.onversionchange=function(){t.close()}})},y.close=function(){this.db&&this.db.close(),this.db=null},y.destroy=function(){const t=he.deleteDatabase(this.id);return Z(t)},y.clear=function(){const t=[];for(let e=0,s;e<vt.length;e++){s=vt[e];for(let n=0,r;n<Y[this.id].length;n++)r=Y[this.id][n],t.push(s+(s!=="reg"&&r?":"+r:""))}const i=this.db.transaction(t,"readwrite");for(let e=0;e<t.length;e++)i.objectStore(t[e]).clear();return Z(i)},y.get=function(t,i,e=0,s=0,n=!0,r=!1){t=this.db.transaction((i?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((i?"ctx":"map")+(this.field?":"+this.field:"")).get(i?i+":"+t:t);const h=this;return Z(t).then(function(o){let l=[];if(!o||!o.length)return l;if(n){if(!e&&!s&&o.length===1)return o[0];for(let f=0,c;f<o.length;f++)if((c=o[f])&&c.length){if(s>=c.length){s-=c.length;continue}const a=e?s+Math.min(c.length-s,e):c.length;for(let m=s;m<a;m++)l.push(c[m]);if(s=0,l.length===e)break}return r?h.enrich(l):l}return o})},y.tag=function(t,i=0,e=0,s=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);const n=this;return Z(t).then(function(r){return!r||!r.length||e>=r.length?[]:!i&&!e?r:(r=r.slice(e,e+i),s?n.enrich(r):r)})},y.enrich=function(t){typeof t!="object"&&(t=[t]);const i=this.db.transaction("reg","readonly").objectStore("reg"),e=[];for(let s=0;s<t.length;s++)e[s]=Z(i.get(t[s]));return Promise.all(e).then(function(s){for(let n=0;n<s.length;n++)s[n]={id:t[n],doc:s[n]?JSON.parse(s[n]):null};return s})},y.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),Z(t).then(function(i){return!!i})},y.search=null,y.info=function(){},y.transaction=function(t,i,e){t+=t!=="reg"&&this.field?":"+this.field:"";let s=this.h[t+":"+i];if(s)return e.call(this,s);let n=this.db.transaction(t,i);this.h[t+":"+i]=s=n.objectStore(t);const r=e.call(this,s);return this.h[t+":"+i]=null,Z(n).finally(function(){return r})},y.commit=async function(t){let i=t.commit_task,e=[];t.commit_task=[];for(let s=0,n;s<i.length;s++)n=i[s],n.del&&e.push(n.del);e.length&&await this.remove(e),t.reg.size&&(await this.transaction("map","readwrite",function(s){for(const n of t.map){const r=n[0],h=n[1];h.length&&(s.get(r).onsuccess=function(){let o=this.result;var l;if(o&&o.length){const f=Math.max(o.length,h.length);for(let c=0,a,m;c<f;c++)if((m=h[c])&&m.length){if((a=o[c])&&a.length)for(l=0;l<m.length;l++)a.push(m[l]);else o[c]=m;l=1}}else o=h,l=1;l&&s.put(o,r)})}}),await this.transaction("ctx","readwrite",function(s){for(const n of t.ctx){const r=n[0],h=n[1];for(const o of h){const l=o[0],f=o[1];f.length&&(s.get(r+":"+l).onsuccess=function(){let c=this.result;var a;if(c&&c.length){const m=Math.max(c.length,f.length);for(let p=0,d,u;p<m;p++)if((u=f[p])&&u.length){if((d=c[p])&&d.length)for(a=0;a<u.length;a++)d.push(u[a]);else c[p]=u;a=1}}else c=f,a=1;a&&s.put(c,r+":"+l)})}}}),t.store?await this.transaction("reg","readwrite",function(s){for(const n of t.store){const r=n[0],h=n[1];s.put(typeof h=="object"?JSON.stringify(h):1,r)}}):t.bypass||await this.transaction("reg","readwrite",function(s){for(const n of t.reg.keys())s.put(1,n)}),t.tag&&await this.transaction("tag","readwrite",function(s){for(const n of t.tag){const r=n[0],h=n[1];h.length&&(s.get(r).onsuccess=function(){let o=this.result;o=o&&o.length?o.concat(h):h,s.put(o,r)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())};function Ot(t,i,e){const s=t.value;let n,r=0;for(let h=0,o;h<s.length;h++){if(o=e?s:s[h]){for(let l=0,f,c;l<i.length;l++)if(c=i[l],f=o.indexOf(c),f>=0)if(n=1,o.length>1)o.splice(f,1);else{s[h]=[];break}r+=o.length}if(e)break}r?n&&t.update(s):t.delete(),t.continue()}y.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(i){i.openCursor().onsuccess=function(){const e=this.result;e&&Ot(e,t)}}),this.transaction("ctx","readwrite",function(i){i.openCursor().onsuccess=function(){const e=this.result;e&&Ot(e,t)}}),this.transaction("tag","readwrite",function(i){i.openCursor().onsuccess=function(){const e=this.result;e&&Ot(e,t,!0)}}),this.transaction("reg","readwrite",function(i){for(let e=0;e<t.length;e++)i.delete(t[e])})])};function Z(t,i){return new Promise((e,s)=>{t.onsuccess=t.oncomplete=function(){i&&i(this.result),i=null,e(this.result)},t.onerror=t.onblocked=s,t=null})}const le=G;let Nt=new le;self.onmessage=t=>{switch(t.data.type){case"clear":Nt=new le,postMessage({identifier:t.data.identifier});break;case"points":for(let e of t.data.points)Nt.add(e.id,e.text);postMessage({identifier:t.data.identifier});break;case"query":let i=Nt.search(t.data.query,{limit:t.data.limit});postMessage({identifier:t.data.identifier,result:i});break}}})()})();
@@ -0,0 +1 @@
1
+ {"version":"1765904918457"}
@@ -0,0 +1,45 @@
1
+ <!doctype html>
2
+ <html lang="en" dir="ltr" class="dark">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="/favicon.png" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+
8
+ <link rel="modulepreload" href="/_app/immutable/entry/start.BK5EOJl2.js">
9
+ <link rel="modulepreload" href="/_app/immutable/chunks/xGHZQ1pe.js">
10
+ <link rel="modulepreload" href="/_app/immutable/chunks/DkbXUtyG.js">
11
+ <link rel="modulepreload" href="/_app/immutable/chunks/DIeogL5L.js">
12
+ <link rel="modulepreload" href="/_app/immutable/chunks/CYgJF_JY.js">
13
+ <link rel="modulepreload" href="/_app/immutable/entry/app.DrTRUgT3.js">
14
+ <link rel="modulepreload" href="/_app/immutable/chunks/C1FmrZbK.js">
15
+ <link rel="modulepreload" href="/_app/immutable/chunks/DqnHaLTj.js">
16
+ <link rel="modulepreload" href="/_app/immutable/chunks/CWj6FrbW.js">
17
+ <link rel="modulepreload" href="/_app/immutable/chunks/69_IOA4Y.js">
18
+ <link rel="modulepreload" href="/_app/immutable/chunks/DwIonDAZ.js">
19
+ <link rel="modulepreload" href="/_app/immutable/chunks/eAy8rZzC.js">
20
+ <link rel="modulepreload" href="/_app/immutable/chunks/D9SC3jBb.js">
21
+ <link rel="modulepreload" href="/_app/immutable/chunks/CmLg0ys7.js">
22
+ <link rel="modulepreload" href="/_app/immutable/chunks/B_1cpokE.js">
23
+ <link rel="modulepreload" href="/_app/immutable/chunks/DuUalyFS.js">
24
+ </head>
25
+ <body data-sveltekit-preload-data="hover" class="flex h-screen w-screen flex-col dark:bg-black">
26
+ <div style="display: contents">
27
+ <script>
28
+ {
29
+ __sveltekit_ukxkij = {
30
+ base: ""
31
+ };
32
+
33
+ const element = document.currentScript.parentElement;
34
+
35
+ Promise.all([
36
+ import("/_app/immutable/entry/start.BK5EOJl2.js"),
37
+ import("/_app/immutable/entry/app.DrTRUgT3.js")
38
+ ]).then(([kit, app]) => {
39
+ kit.start(app, element);
40
+ });
41
+ }
42
+ </script>
43
+ </div>
44
+ </body>
45
+ </html>
@@ -0,0 +1,5 @@
1
+ """Lightly Studio Exceptions types."""
2
+
3
+
4
+ class TagNotFoundError(Exception):
5
+ """Exception signaling that a tag has not been found."""
@@ -0,0 +1,25 @@
1
+ """Example of how to load samples from path with the dataset class."""
2
+
3
+ from environs import Env
4
+
5
+ import lightly_studio as ls
6
+ from lightly_studio import db_manager
7
+
8
+ # Read environment variables
9
+ env = Env()
10
+ env.read_env()
11
+
12
+ # Cleanup an existing database
13
+ db_manager.connect(cleanup_existing=True)
14
+
15
+ # Define the path to the dataset directory
16
+ dataset_path = env.path("EXAMPLES_DATASET_PATH", "/path/to/your/dataset")
17
+
18
+ # Create a Dataset from a path
19
+ dataset = ls.Dataset.create()
20
+ dataset.add_images_from_path(path=dataset_path)
21
+
22
+ for sample in dataset:
23
+ print(sample)
24
+
25
+ ls.start_gui()
@@ -0,0 +1,27 @@
1
+ """Example of how to add samples in coco format to a dataset."""
2
+
3
+ from environs import Env
4
+
5
+ import lightly_studio as ls
6
+ from lightly_studio import db_manager
7
+
8
+ # Read environment variables
9
+ env = Env()
10
+ env.read_env()
11
+
12
+ # Cleanup an existing database
13
+ db_manager.connect(cleanup_existing=True)
14
+
15
+ # Define data paths
16
+ annotations_json = env.path("EXAMPLES_COCO_JSON_PATH", "/path/to/your/dataset/annotations.json")
17
+ images_path = env.path("EXAMPLES_COCO_IMAGES_PATH", "/path/to/your/dataset")
18
+
19
+ # Create a DatasetLoader from a path
20
+ dataset = ls.Dataset.create()
21
+ dataset.add_samples_from_coco(
22
+ annotations_json=annotations_json,
23
+ images_path=images_path,
24
+ annotation_type=ls.AnnotationType.INSTANCE_SEGMENTATION,
25
+ )
26
+
27
+ ls.start_gui()
@@ -0,0 +1,29 @@
1
+ """Example of how to add samples in coco caption format to a dataset."""
2
+
3
+ from environs import Env
4
+
5
+ import lightly_studio as ls
6
+ from lightly_studio import db_manager
7
+
8
+ # Read environment variables
9
+ env = Env()
10
+ env.read_env()
11
+
12
+ # Cleanup an existing database
13
+ db_manager.connect(cleanup_existing=True)
14
+
15
+ # Define data paths
16
+ annotations_json = env.path(
17
+ "EXAMPLES_COCO_CAPTION_JSON_PATH", "/path/to/your/dataset/annotations.json"
18
+ )
19
+ images_path = env.path("EXAMPLES_COCO_CAPTION_IMAGES_PATH", "/path/to/your/dataset")
20
+
21
+
22
+ # Create a DatasetLoader from a path
23
+ dataset = ls.Dataset.create()
24
+ dataset.add_samples_from_coco_caption(
25
+ annotations_json=annotations_json,
26
+ images_path=images_path,
27
+ )
28
+
29
+ ls.start_gui()
@@ -0,0 +1,369 @@
1
+ """Example script demonstrating metadata capabilities.
2
+
3
+ This script shows how to:
4
+ 1. Load an existing dataset using DatasetLoader
5
+ 2. Add metadata to all samples using bulk operations
6
+ 3. Add metadata to individual samples
7
+ 4. Filter samples using various metadata types
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import random
13
+ import time
14
+ from uuid import UUID
15
+
16
+ from environs import Env
17
+ from sqlmodel import Session
18
+
19
+ import lightly_studio as ls
20
+ from lightly_studio import db_manager
21
+ from lightly_studio.core.image_sample import ImageSample
22
+ from lightly_studio.metadata.gps_coordinate import GPSCoordinate
23
+ from lightly_studio.resolvers import image_resolver, metadata_resolver
24
+ from lightly_studio.resolvers.image_filter import ImageFilter
25
+ from lightly_studio.resolvers.metadata_resolver.metadata_filter import Metadata
26
+ from lightly_studio.resolvers.sample_resolver.sample_filter import SampleFilter
27
+
28
+ # Environment variables
29
+ env = Env()
30
+ env.read_env()
31
+ dataset_path = env.path("EXAMPLES_DATASET_PATH", "/path/to/your/dataset")
32
+
33
+
34
+ def load_existing_dataset() -> tuple[ls.Dataset, list[ImageSample]]:
35
+ """Load an existing dataset using DatasetLoader.
36
+
37
+ Returns:
38
+ Tuple of (dataset, samples).
39
+ """
40
+ print(" Loading existing dataset...")
41
+
42
+ dataset = ls.Dataset.create()
43
+ dataset.add_images_from_path(path=dataset_path)
44
+
45
+ # Get all samples from the dataset
46
+ samples = dataset.query().to_list()
47
+
48
+ print(f"✅ Loaded dataset with {len(samples)} samples")
49
+ return dataset, samples
50
+
51
+
52
+ def add_bulk_metadata(session: Session, sample_ids: list[UUID]) -> None:
53
+ """Add metadata to all samples using bulk operations."""
54
+ print("\n Adding bulk metadata to all samples...")
55
+
56
+ # Prepare bulk metadata with random values
57
+ sample_metadata = []
58
+ for sample_id in sample_ids:
59
+ # Generate random metadata
60
+ temp = random.randint(10, 40)
61
+ loc = random.choice(["city", "rural", "mountain", "coastal", "desert"])
62
+ lat = random.uniform(-90.0, 90.0)
63
+ lon = random.uniform(-180.0, 180.0)
64
+ gps_coord = GPSCoordinate(lat=lat, lon=lon)
65
+ confidence = random.uniform(0.5, 1.0)
66
+ is_processed = random.choice([True, False])
67
+
68
+ sample_metadata.append(
69
+ (
70
+ sample_id,
71
+ {
72
+ "temperature": temp,
73
+ "location": loc,
74
+ "gps_coordinates": gps_coord,
75
+ "confidence": confidence,
76
+ "is_processed": is_processed,
77
+ "batch_id": "bulk_001", # Mark as bulk-added
78
+ },
79
+ )
80
+ )
81
+
82
+ # Bulk insert metadata
83
+ start_time = time.time()
84
+ metadata_resolver.bulk_update_metadata(session, sample_metadata)
85
+ elapsed_time = time.time() - start_time
86
+
87
+ print(f"✅ Added metadata to {len(sample_ids)} samples in {elapsed_time:.2f}s")
88
+
89
+
90
+ def add_individual_metadata(samples: list[ImageSample]) -> None:
91
+ """Add metadata to individual samples."""
92
+ print("\n Adding individual metadata to specific samples...")
93
+
94
+ # Add metadata to first 5 samples individually
95
+ for i, sample in enumerate(samples[:5]):
96
+ print(f" Adding metadata to sample {sample.file_name} {sample.sample_id}...")
97
+ # Add some specific metadata
98
+ sample.metadata["special_metadata"] = f"sample_{i + 1}_special"
99
+ sample.metadata["priority"] = random.randint(1, 10)
100
+ sample.metadata["list"] = [1, 2, 3]
101
+ sample.metadata["custom_gps"] = GPSCoordinate(
102
+ lat=40.7128 + i * 0.1, # Slightly different coordinates
103
+ lon=-74.0060 + i * 0.1,
104
+ )
105
+
106
+ print(f"✅ Added individual metadata to {min(5, len(samples))} samples")
107
+
108
+
109
+ def demonstrate_bulk_metadata_filters(dataset: ls.Dataset) -> None:
110
+ """Demonstrate filtering with bulk-added metadata."""
111
+ # TODO(Michal, 09/2025): Update with native metadata filtering instead of accessing
112
+ print("\n Bulk Metadata Filters:")
113
+ print("=" * 50)
114
+
115
+ # Filter by temperature
116
+ print("\n1. Filter by temperature > 25:")
117
+ filter_temp = ImageFilter(
118
+ sample_filter=SampleFilter(metadata_filters=[Metadata("temperature") > 25]) # noqa PLR2004
119
+ )
120
+ images = image_resolver.get_all_by_dataset_id(
121
+ session=dataset.session,
122
+ dataset_id=dataset.dataset_id,
123
+ filters=filter_temp,
124
+ ).samples
125
+ print(f" Found {len(images)} samples with temperature > 25")
126
+ for image in images[:3]: # Show first 3
127
+ print(f" {image.file_name}: {image.sample['temperature']}")
128
+
129
+ # Filter by location
130
+ print("\n2. Filter by location == 'city':")
131
+ filter_location = ImageFilter(
132
+ sample_filter=SampleFilter(metadata_filters=[Metadata("location") == "city"])
133
+ )
134
+ images = image_resolver.get_all_by_dataset_id(
135
+ session=dataset.session,
136
+ dataset_id=dataset.dataset_id,
137
+ filters=filter_location,
138
+ ).samples
139
+ print(f" Found {len(images)} samples from cities")
140
+ for image in images[:3]: # Show first 3
141
+ print(f" {image.file_name}: {image.sample['location']}")
142
+
143
+ # Filter by GPS coordinates
144
+ print("\n3. Filter by latitude > 0° (Northern hemisphere):")
145
+ filter_lat = ImageFilter(
146
+ sample_filter=SampleFilter(metadata_filters=[Metadata("gps_coordinates.lat") > 0])
147
+ )
148
+ images = image_resolver.get_all_by_dataset_id(
149
+ session=dataset.session,
150
+ dataset_id=dataset.dataset_id,
151
+ filters=filter_lat,
152
+ ).samples
153
+ print(f" Found {len(images)} samples in Northern hemisphere")
154
+ for image in images[:3]: # Show first 3
155
+ gps = image.sample["gps_coordinates"]
156
+ print(f" {image.file_name}: lat={gps.lat:.4f}, lon={gps.lon:.4f}")
157
+
158
+ # Filter by confidence
159
+ print("\n4. Filter by high confidence (> 0.9):")
160
+ filter_confidence = ImageFilter(
161
+ sample_filter=SampleFilter(
162
+ metadata_filters=[Metadata("confidence") > 0.9] # noqa PLR2004
163
+ )
164
+ )
165
+ images = image_resolver.get_all_by_dataset_id(
166
+ session=dataset.session,
167
+ dataset_id=dataset.dataset_id,
168
+ filters=filter_confidence,
169
+ ).samples
170
+ print(f" Found {len(images)} samples with confidence > 0.9")
171
+ for image in images[:3]: # Show first 3
172
+ print(f" 📸 {image.file_name}: confidence={image.sample['confidence']:.3f}")
173
+
174
+
175
+ def demonstrate_individual_metadata_filters(dataset: ls.Dataset) -> None:
176
+ """Demonstrate filtering with individually-added metadata."""
177
+ # TODO(Michal, 09/2025): Update with native metadata filtering instead of accessing
178
+ print("\n Individual Metadata Filters:")
179
+ print("=" * 50)
180
+
181
+ # Filter by special metadata
182
+ print("\n1. Filter by special metadata (individually added):")
183
+ filter_special = ImageFilter(
184
+ sample_filter=SampleFilter(
185
+ metadata_filters=[Metadata("special_metadata") == "sample_1_special"]
186
+ )
187
+ )
188
+ images = image_resolver.get_all_by_dataset_id(
189
+ session=dataset.session,
190
+ dataset_id=dataset.dataset_id,
191
+ filters=filter_special,
192
+ ).samples
193
+ print(f" Found {len(images)} samples with special metadata")
194
+ for image in images:
195
+ print(f" {image.file_name}: {image.sample['special_metadata']}")
196
+
197
+ # Filter by priority
198
+ print("\n2. Filter by high priority (> 7):")
199
+ filter_priority = ImageFilter(
200
+ sample_filter=SampleFilter(metadata_filters=[Metadata("priority") > 7]) # noqa PLR2004
201
+ )
202
+ images = image_resolver.get_all_by_dataset_id(
203
+ session=dataset.session,
204
+ dataset_id=dataset.dataset_id,
205
+ filters=filter_priority,
206
+ ).samples
207
+ print(f" Found {len(images)} samples with priority > 7")
208
+ for image in images:
209
+ print(f" {image.file_name}: priority={image.sample['priority']}")
210
+
211
+ # Filter by custom GPS
212
+ print("\n3. Filter by custom GPS coordinates:")
213
+ filter_custom_gps = ImageFilter(
214
+ sample_filter=SampleFilter(
215
+ metadata_filters=[Metadata("custom_gps.lat") > 40.8] # noqa PLR2004
216
+ )
217
+ )
218
+ images = image_resolver.get_all_by_dataset_id(
219
+ session=dataset.session,
220
+ dataset_id=dataset.dataset_id,
221
+ filters=filter_custom_gps,
222
+ ).samples
223
+ print(f" Found {len(images)} samples with custom GPS lat > 40.8")
224
+ for image in images:
225
+ gps = image.sample["custom_gps"]
226
+ print(f" {image.file_name}: lat={gps.lat:.4f}, lon={gps.lon:.4f}")
227
+
228
+
229
+ def demonstrate_combined_filters(dataset: ls.Dataset) -> None:
230
+ """Demonstrate combining multiple filters."""
231
+ # TODO(Michal, 09/2025): Update with native metadata filtering instead of accessing
232
+ print("\n Combined Filters:")
233
+ print("=" * 50)
234
+
235
+ # Multiple conditions
236
+ print("\n1. Find high-confidence, processed, warm images:")
237
+ filter_combined = ImageFilter(
238
+ sample_filter=SampleFilter(
239
+ metadata_filters=[
240
+ Metadata("confidence") > 0.8, # noqa PLR2004
241
+ Metadata("is_processed") == True, # noqa E712
242
+ Metadata("temperature") > 25, # noqa PLR2004
243
+ ]
244
+ )
245
+ )
246
+ images = image_resolver.get_all_by_dataset_id(
247
+ session=dataset.session,
248
+ dataset_id=dataset.dataset_id,
249
+ filters=filter_combined,
250
+ ).samples
251
+ print(f" Found {len(images)} samples matching all criteria")
252
+ for image in images[:3]:
253
+ print(
254
+ f" {image.file_name}: conf={image.sample['confidence']:.2f}, "
255
+ f"temp={image.sample['temperature']}, processed={image.sample['is_processed']}"
256
+ )
257
+
258
+ # Complex GPS + other filters
259
+ print("\n2. Find northern hemisphere, high-confidence images:")
260
+ filter_gps_combined = ImageFilter(
261
+ sample_filter=SampleFilter(
262
+ metadata_filters=[
263
+ Metadata("gps_coordinates.lat") > 0, # Northern hemisphere
264
+ Metadata("confidence") > 0.85, # noqa PLR2004
265
+ Metadata("location") == "city",
266
+ ]
267
+ )
268
+ )
269
+ images = image_resolver.get_all_by_dataset_id(
270
+ session=dataset.session,
271
+ dataset_id=dataset.dataset_id,
272
+ filters=filter_gps_combined,
273
+ ).samples
274
+ print(f" Found {len(images)} samples in northern hemisphere cities with high confidence")
275
+ for image in images[:3]:
276
+ gps = image.sample["gps_coordinates"]
277
+ print(f" {image.file_name}: lat={gps.lat:.4f}, conf={image.sample['confidence']:.2f}")
278
+
279
+
280
+ def demonstrate_dictionary_like_access(samples: list[ImageSample]) -> None:
281
+ """Demonstrate adding metadata using dictionary-like access."""
282
+ print("\n Dictionary-like Metadata Access:")
283
+ print("=" * 50)
284
+
285
+ # Get the first few samples to demonstrate
286
+ samples = samples[:2]
287
+
288
+ print("\n1. Adding metadata using sample.metadata['key'] = value syntax:")
289
+
290
+ # Add different types of metadata to different samples
291
+ samples[0].metadata["temperature"] = 25
292
+ samples[0].metadata["location"] = "city"
293
+ samples[0].metadata["is_processed"] = True
294
+ samples[0].metadata["confidence"] = 0.95
295
+ print(
296
+ f" {samples[0].file_name}: "
297
+ f"temp={samples[0].metadata['temperature']}°C, "
298
+ f"location={samples[0].metadata['location']}, "
299
+ f"processed={samples[0].metadata['is_processed']}"
300
+ )
301
+
302
+ samples[1].metadata["temperature"] = 15
303
+ samples[1].metadata["location"] = "mountain"
304
+ samples[1].metadata["gps_coordinates"] = GPSCoordinate(lat=40.7128, lon=-74.0060)
305
+ samples[1].metadata["tags"] = ["outdoor", "nature", "landscape"]
306
+ print(
307
+ f" {samples[1].file_name}: temp={samples[1].metadata['temperature']}°C, "
308
+ f"location={samples[1].metadata['location']}, tags={samples[1].metadata['tags']}"
309
+ )
310
+
311
+ # Demonstrate reading metadata
312
+ print("\n2. Reading metadata using sample.metadata['key'] syntax:")
313
+ for sample in samples:
314
+ print(f" {sample.file_name}:")
315
+ print(f" Temperature: {sample.metadata['temperature']}°C")
316
+ print(f" Location: {sample.metadata['location']}")
317
+ gps = sample.metadata["gps_coordinates"]
318
+ print(f" GPS: lat={gps.lat:.4f}, lon={gps.lon:.4f}")
319
+ print(f" Tags: {sample.metadata['tags']}")
320
+
321
+ # Demonstrate None return for missing keys
322
+ print(" Note: sample.metadata['key'] returns None for missing keys")
323
+ missing_value = samples[0].metadata["nonexistent_key"]
324
+ if missing_value is None:
325
+ print(f" sample.metadata['nonexistent_key']: {missing_value}")
326
+
327
+ print(f"✅ Added metadata to {len(samples)} samples using dictionary-like access")
328
+
329
+ # Demonstrate schema presentation
330
+ try:
331
+ samples[0].metadata["temperature"] = "string_value" # Invalid type for demonstration
332
+ print(f" ❌ This should not print: {missing_value}")
333
+ except ValueError:
334
+ print(" ✅ Correctly raised ValueError for invalid type")
335
+
336
+
337
+ def main() -> None:
338
+ """Main function to demonstrate metadata functionality."""
339
+ try:
340
+ # Cleanup an existing database
341
+ db_manager.connect(cleanup_existing=True)
342
+
343
+ # Load existing dataset
344
+ dataset, samples = load_existing_dataset()
345
+
346
+ # Add bulk metadata
347
+ add_bulk_metadata(db_manager.persistent_session(), [s.sample_id for s in samples])
348
+
349
+ # Add individual metadata
350
+ add_individual_metadata(samples)
351
+
352
+ # Demonstrate different types of filtering
353
+ demonstrate_bulk_metadata_filters(dataset)
354
+ demonstrate_individual_metadata_filters(dataset)
355
+ demonstrate_combined_filters(dataset)
356
+ demonstrate_dictionary_like_access(samples)
357
+
358
+ ls.start_gui()
359
+
360
+ except ValueError as e:
361
+ print(f"❌ Error: {e}")
362
+ print("\n💡 Make sure to set the environment variables:")
363
+ print(" export EXAMPLES_DATASET_PATH=/path/to/your/dataset")
364
+ except Exception as e:
365
+ print(f"❌ Unexpected error: {e}")
366
+
367
+
368
+ if __name__ == "__main__":
369
+ main()