sqlmesh 0.213.1.dev1__py3-none-any.whl → 0.227.2.dev4__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 (252) hide show
  1. sqlmesh/__init__.py +12 -2
  2. sqlmesh/_version.py +2 -2
  3. sqlmesh/cli/main.py +0 -44
  4. sqlmesh/cli/project_init.py +11 -2
  5. sqlmesh/core/_typing.py +1 -0
  6. sqlmesh/core/audit/definition.py +8 -2
  7. sqlmesh/core/config/__init__.py +1 -1
  8. sqlmesh/core/config/connection.py +17 -5
  9. sqlmesh/core/config/dbt.py +13 -0
  10. sqlmesh/core/config/janitor.py +12 -0
  11. sqlmesh/core/config/loader.py +7 -0
  12. sqlmesh/core/config/model.py +2 -0
  13. sqlmesh/core/config/root.py +3 -0
  14. sqlmesh/core/console.py +81 -3
  15. sqlmesh/core/constants.py +1 -1
  16. sqlmesh/core/context.py +69 -26
  17. sqlmesh/core/dialect.py +3 -0
  18. sqlmesh/core/engine_adapter/_typing.py +2 -0
  19. sqlmesh/core/engine_adapter/base.py +322 -22
  20. sqlmesh/core/engine_adapter/base_postgres.py +17 -1
  21. sqlmesh/core/engine_adapter/bigquery.py +146 -7
  22. sqlmesh/core/engine_adapter/clickhouse.py +17 -13
  23. sqlmesh/core/engine_adapter/databricks.py +33 -2
  24. sqlmesh/core/engine_adapter/fabric.py +10 -29
  25. sqlmesh/core/engine_adapter/mixins.py +142 -48
  26. sqlmesh/core/engine_adapter/mssql.py +15 -4
  27. sqlmesh/core/engine_adapter/mysql.py +2 -2
  28. sqlmesh/core/engine_adapter/postgres.py +9 -3
  29. sqlmesh/core/engine_adapter/redshift.py +4 -0
  30. sqlmesh/core/engine_adapter/risingwave.py +1 -0
  31. sqlmesh/core/engine_adapter/shared.py +6 -0
  32. sqlmesh/core/engine_adapter/snowflake.py +82 -11
  33. sqlmesh/core/engine_adapter/spark.py +14 -10
  34. sqlmesh/core/engine_adapter/trino.py +4 -2
  35. sqlmesh/core/environment.py +2 -0
  36. sqlmesh/core/janitor.py +181 -0
  37. sqlmesh/core/lineage.py +1 -0
  38. sqlmesh/core/linter/definition.py +13 -13
  39. sqlmesh/core/linter/rules/builtin.py +29 -0
  40. sqlmesh/core/macros.py +35 -13
  41. sqlmesh/core/model/common.py +2 -0
  42. sqlmesh/core/model/definition.py +82 -28
  43. sqlmesh/core/model/kind.py +66 -2
  44. sqlmesh/core/model/meta.py +108 -4
  45. sqlmesh/core/node.py +101 -1
  46. sqlmesh/core/plan/builder.py +18 -10
  47. sqlmesh/core/plan/common.py +199 -2
  48. sqlmesh/core/plan/definition.py +25 -6
  49. sqlmesh/core/plan/evaluator.py +75 -113
  50. sqlmesh/core/plan/explainer.py +90 -8
  51. sqlmesh/core/plan/stages.py +42 -21
  52. sqlmesh/core/renderer.py +78 -32
  53. sqlmesh/core/scheduler.py +102 -22
  54. sqlmesh/core/selector.py +137 -9
  55. sqlmesh/core/signal.py +64 -1
  56. sqlmesh/core/snapshot/__init__.py +2 -0
  57. sqlmesh/core/snapshot/definition.py +146 -34
  58. sqlmesh/core/snapshot/evaluator.py +689 -124
  59. sqlmesh/core/state_sync/__init__.py +0 -1
  60. sqlmesh/core/state_sync/base.py +55 -33
  61. sqlmesh/core/state_sync/cache.py +12 -7
  62. sqlmesh/core/state_sync/common.py +216 -111
  63. sqlmesh/core/state_sync/db/environment.py +6 -4
  64. sqlmesh/core/state_sync/db/facade.py +42 -24
  65. sqlmesh/core/state_sync/db/interval.py +27 -7
  66. sqlmesh/core/state_sync/db/migrator.py +34 -16
  67. sqlmesh/core/state_sync/db/snapshot.py +177 -169
  68. sqlmesh/core/table_diff.py +2 -2
  69. sqlmesh/core/test/context.py +2 -0
  70. sqlmesh/core/test/definition.py +14 -9
  71. sqlmesh/dbt/adapter.py +22 -16
  72. sqlmesh/dbt/basemodel.py +75 -56
  73. sqlmesh/dbt/builtin.py +116 -12
  74. sqlmesh/dbt/column.py +17 -5
  75. sqlmesh/dbt/common.py +19 -5
  76. sqlmesh/dbt/context.py +14 -1
  77. sqlmesh/dbt/loader.py +61 -9
  78. sqlmesh/dbt/manifest.py +174 -16
  79. sqlmesh/dbt/model.py +183 -85
  80. sqlmesh/dbt/package.py +16 -1
  81. sqlmesh/dbt/profile.py +3 -3
  82. sqlmesh/dbt/project.py +12 -7
  83. sqlmesh/dbt/seed.py +6 -1
  84. sqlmesh/dbt/source.py +13 -1
  85. sqlmesh/dbt/target.py +25 -6
  86. sqlmesh/dbt/test.py +36 -5
  87. sqlmesh/migrations/v0000_baseline.py +95 -0
  88. sqlmesh/migrations/v0061_mysql_fix_blob_text_type.py +5 -7
  89. sqlmesh/migrations/v0062_add_model_gateway.py +5 -1
  90. sqlmesh/migrations/v0063_change_signals.py +5 -3
  91. sqlmesh/migrations/v0064_join_when_matched_strings.py +5 -3
  92. sqlmesh/migrations/v0065_add_model_optimize.py +5 -1
  93. sqlmesh/migrations/v0066_add_auto_restatements.py +8 -3
  94. sqlmesh/migrations/v0067_add_tsql_date_full_precision.py +5 -1
  95. sqlmesh/migrations/v0068_include_unrendered_query_in_metadata_hash.py +5 -1
  96. sqlmesh/migrations/v0069_update_dev_table_suffix.py +5 -3
  97. sqlmesh/migrations/v0070_include_grains_in_metadata_hash.py +5 -1
  98. sqlmesh/migrations/v0071_add_dev_version_to_intervals.py +9 -5
  99. sqlmesh/migrations/v0072_add_environment_statements.py +5 -3
  100. sqlmesh/migrations/v0073_remove_symbolic_disable_restatement.py +5 -3
  101. sqlmesh/migrations/v0074_add_partition_by_time_column_property.py +5 -1
  102. sqlmesh/migrations/v0075_remove_validate_query.py +5 -3
  103. sqlmesh/migrations/v0076_add_cron_tz.py +5 -1
  104. sqlmesh/migrations/v0077_fix_column_type_hash_calculation.py +5 -1
  105. sqlmesh/migrations/v0078_warn_if_non_migratable_python_env.py +5 -3
  106. sqlmesh/migrations/v0079_add_gateway_managed_property.py +10 -5
  107. sqlmesh/migrations/v0080_add_batch_size_to_scd_type_2_models.py +5 -1
  108. sqlmesh/migrations/v0081_update_partitioned_by.py +5 -3
  109. sqlmesh/migrations/v0082_warn_if_incorrectly_duplicated_statements.py +5 -3
  110. sqlmesh/migrations/v0083_use_sql_for_scd_time_data_type_data_hash.py +5 -1
  111. sqlmesh/migrations/v0084_normalize_quote_when_matched_and_merge_filter.py +5 -1
  112. sqlmesh/migrations/v0085_deterministic_repr.py +5 -3
  113. sqlmesh/migrations/v0086_check_deterministic_bug.py +5 -3
  114. sqlmesh/migrations/v0087_normalize_blueprint_variables.py +5 -3
  115. sqlmesh/migrations/v0088_warn_about_variable_python_env_diffs.py +5 -3
  116. sqlmesh/migrations/v0089_add_virtual_environment_mode.py +5 -1
  117. sqlmesh/migrations/v0090_add_forward_only_column.py +9 -5
  118. sqlmesh/migrations/v0091_on_additive_change.py +5 -1
  119. sqlmesh/migrations/v0092_warn_about_dbt_data_type_diff.py +5 -3
  120. sqlmesh/migrations/v0093_use_raw_sql_in_fingerprint.py +5 -1
  121. sqlmesh/migrations/v0094_add_dev_version_and_fingerprint_columns.py +123 -0
  122. sqlmesh/migrations/v0095_warn_about_dbt_raw_sql_diff.py +49 -0
  123. sqlmesh/migrations/v0096_remove_plan_dags_table.py +13 -0
  124. sqlmesh/migrations/v0097_add_dbt_name_in_node.py +9 -0
  125. sqlmesh/migrations/{v0060_move_audits_to_model.py → v0098_add_dbt_node_info_in_node.py} +33 -16
  126. sqlmesh/migrations/v0099_add_last_altered_to_intervals.py +25 -0
  127. sqlmesh/migrations/v0100_add_grants_and_grants_target_layer.py +9 -0
  128. sqlmesh/utils/__init__.py +8 -1
  129. sqlmesh/utils/cache.py +5 -1
  130. sqlmesh/utils/connection_pool.py +2 -1
  131. sqlmesh/utils/dag.py +65 -10
  132. sqlmesh/utils/date.py +8 -1
  133. sqlmesh/utils/errors.py +8 -0
  134. sqlmesh/utils/jinja.py +54 -4
  135. sqlmesh/utils/pydantic.py +6 -6
  136. sqlmesh/utils/windows.py +13 -3
  137. {sqlmesh-0.213.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/METADATA +7 -10
  138. sqlmesh-0.227.2.dev4.dist-info/RECORD +370 -0
  139. sqlmesh_dbt/cli.py +70 -7
  140. sqlmesh_dbt/console.py +14 -6
  141. sqlmesh_dbt/operations.py +103 -24
  142. sqlmesh_dbt/selectors.py +39 -1
  143. web/client/dist/assets/{Audits-Ucsx1GzF.js → Audits-CBiYyyx-.js} +1 -1
  144. web/client/dist/assets/{Banner-BWDzvavM.js → Banner-DSRbUlO5.js} +1 -1
  145. web/client/dist/assets/{ChevronDownIcon-D2VL13Ah.js → ChevronDownIcon-MK_nrjD_.js} +1 -1
  146. web/client/dist/assets/{ChevronRightIcon-DWGYbf1l.js → ChevronRightIcon-CLWtT22Q.js} +1 -1
  147. web/client/dist/assets/{Content-DdHDZM3I.js → Content-BNuGZN5l.js} +1 -1
  148. web/client/dist/assets/{Content-Bikfy8fh.js → Content-CSHJyW0n.js} +1 -1
  149. web/client/dist/assets/{Data-CzAJH7rW.js → Data-C1oRDbLx.js} +1 -1
  150. web/client/dist/assets/{DataCatalog-BJF11g8f.js → DataCatalog-HXyX2-_j.js} +1 -1
  151. web/client/dist/assets/{Editor-s0SBpV2y.js → Editor-BDyfpUuw.js} +1 -1
  152. web/client/dist/assets/{Editor-DgLhgKnm.js → Editor-D0jNItwC.js} +1 -1
  153. web/client/dist/assets/{Errors-D0m0O1d3.js → Errors-BfuFLcPi.js} +1 -1
  154. web/client/dist/assets/{FileExplorer-CEv0vXkt.js → FileExplorer-BR9IE3he.js} +1 -1
  155. web/client/dist/assets/{Footer-BwzXn8Ew.js → Footer-CgBEtiAh.js} +1 -1
  156. web/client/dist/assets/{Header-6heDkEqG.js → Header-DSqR6nSO.js} +1 -1
  157. web/client/dist/assets/{Input-obuJsD6k.js → Input-B-oZ6fGO.js} +1 -1
  158. web/client/dist/assets/Lineage-DYQVwDbD.js +1 -0
  159. web/client/dist/assets/{ListboxShow-HM9_qyrt.js → ListboxShow-BE5-xevs.js} +1 -1
  160. web/client/dist/assets/{ModelLineage-zWdKo0U2.js → ModelLineage-DkIFAYo4.js} +1 -1
  161. web/client/dist/assets/{Models-Bcu66SRz.js → Models-D5dWr8RB.js} +1 -1
  162. web/client/dist/assets/{Page-BWEEQfIt.js → Page-C-XfU5BR.js} +1 -1
  163. web/client/dist/assets/{Plan-C4gXCqlf.js → Plan-ZEuTINBq.js} +1 -1
  164. web/client/dist/assets/{PlusCircleIcon-CVDO651q.js → PlusCircleIcon-DVXAHG8_.js} +1 -1
  165. web/client/dist/assets/{ReportErrors-BT6xFwAr.js → ReportErrors-B7FEPzMB.js} +1 -1
  166. web/client/dist/assets/{Root-ryJoBK4h.js → Root-8aZyhPxF.js} +1 -1
  167. web/client/dist/assets/{SearchList-DB04sPb9.js → SearchList-W_iT2G82.js} +1 -1
  168. web/client/dist/assets/{SelectEnvironment-CUYcXUu6.js → SelectEnvironment-C65jALmO.js} +1 -1
  169. web/client/dist/assets/{SourceList-Doo_9ZGp.js → SourceList-DSLO6nVJ.js} +1 -1
  170. web/client/dist/assets/{SourceListItem-D5Mj7Dly.js → SourceListItem-BHt8d9-I.js} +1 -1
  171. web/client/dist/assets/{SplitPane-qHmkD1qy.js → SplitPane-CViaZmw6.js} +1 -1
  172. web/client/dist/assets/{Tests-DH1Z74ML.js → Tests-DhaVt5t1.js} +1 -1
  173. web/client/dist/assets/{Welcome-DqUJUNMF.js → Welcome-DvpjH-_4.js} +1 -1
  174. web/client/dist/assets/context-BctCsyGb.js +71 -0
  175. web/client/dist/assets/{context-Dr54UHLi.js → context-DFNeGsFF.js} +1 -1
  176. web/client/dist/assets/{editor-DYIP1yQ4.js → editor-CcO28cqd.js} +1 -1
  177. web/client/dist/assets/{file-DarlIDVi.js → file-CvJN3aZO.js} +1 -1
  178. web/client/dist/assets/{floating-ui.react-dom-BH3TFvkM.js → floating-ui.react-dom-CjE-JNW1.js} +1 -1
  179. web/client/dist/assets/{help-Bl8wqaQc.js → help-DuPhjipa.js} +1 -1
  180. web/client/dist/assets/{index-D1sR7wpN.js → index-C-dJH7yZ.js} +1 -1
  181. web/client/dist/assets/{index-O3mjYpnE.js → index-Dj0i1-CA.js} +2 -2
  182. web/client/dist/assets/{plan-CehRrJUG.js → plan-BTRSbjKn.js} +1 -1
  183. web/client/dist/assets/{popover-CqgMRE0G.js → popover-_Sf0yvOI.js} +1 -1
  184. web/client/dist/assets/{project-6gxepOhm.js → project-BvSOI8MY.js} +1 -1
  185. web/client/dist/index.html +1 -1
  186. sqlmesh/integrations/llm.py +0 -56
  187. sqlmesh/migrations/v0001_init.py +0 -60
  188. sqlmesh/migrations/v0002_remove_identify.py +0 -5
  189. sqlmesh/migrations/v0003_move_batch_size.py +0 -34
  190. sqlmesh/migrations/v0004_environmnent_add_finalized_at.py +0 -23
  191. sqlmesh/migrations/v0005_create_seed_table.py +0 -24
  192. sqlmesh/migrations/v0006_change_seed_hash.py +0 -5
  193. sqlmesh/migrations/v0007_env_table_info_to_kind.py +0 -99
  194. sqlmesh/migrations/v0008_create_intervals_table.py +0 -38
  195. sqlmesh/migrations/v0009_remove_pre_post_hooks.py +0 -62
  196. sqlmesh/migrations/v0010_seed_hash_batch_size.py +0 -5
  197. sqlmesh/migrations/v0011_add_model_kind_name.py +0 -63
  198. sqlmesh/migrations/v0012_update_jinja_expressions.py +0 -86
  199. sqlmesh/migrations/v0013_serde_using_model_dialects.py +0 -87
  200. sqlmesh/migrations/v0014_fix_dev_intervals.py +0 -14
  201. sqlmesh/migrations/v0015_environment_add_promoted_snapshot_ids.py +0 -26
  202. sqlmesh/migrations/v0016_fix_windows_path.py +0 -59
  203. sqlmesh/migrations/v0017_fix_windows_seed_path.py +0 -55
  204. sqlmesh/migrations/v0018_rename_snapshot_model_to_node.py +0 -53
  205. sqlmesh/migrations/v0019_add_env_suffix_target.py +0 -28
  206. sqlmesh/migrations/v0020_remove_redundant_attributes_from_dbt_models.py +0 -80
  207. sqlmesh/migrations/v0021_fix_table_properties.py +0 -62
  208. sqlmesh/migrations/v0022_move_project_to_model.py +0 -54
  209. sqlmesh/migrations/v0023_fix_added_models_with_forward_only_parents.py +0 -65
  210. sqlmesh/migrations/v0024_replace_model_kind_name_enum_with_value.py +0 -55
  211. sqlmesh/migrations/v0025_fix_intervals_and_missing_change_category.py +0 -117
  212. sqlmesh/migrations/v0026_remove_dialect_from_seed.py +0 -55
  213. sqlmesh/migrations/v0027_minute_interval_to_five.py +0 -57
  214. sqlmesh/migrations/v0028_add_plan_dags_table.py +0 -29
  215. sqlmesh/migrations/v0029_generate_schema_types_using_dialect.py +0 -69
  216. sqlmesh/migrations/v0030_update_unrestorable_snapshots.py +0 -65
  217. sqlmesh/migrations/v0031_remove_dbt_target_fields.py +0 -65
  218. sqlmesh/migrations/v0032_add_sqlmesh_version.py +0 -25
  219. sqlmesh/migrations/v0033_mysql_fix_blob_text_type.py +0 -45
  220. sqlmesh/migrations/v0034_add_default_catalog.py +0 -367
  221. sqlmesh/migrations/v0035_add_catalog_name_override.py +0 -22
  222. sqlmesh/migrations/v0036_delete_plan_dags_bug_fix.py +0 -14
  223. sqlmesh/migrations/v0037_remove_dbt_is_incremental_macro.py +0 -61
  224. sqlmesh/migrations/v0038_add_expiration_ts_to_snapshot.py +0 -73
  225. sqlmesh/migrations/v0039_include_environment_in_plan_dag_spec.py +0 -68
  226. sqlmesh/migrations/v0040_add_previous_finalized_snapshots.py +0 -26
  227. sqlmesh/migrations/v0041_remove_hash_raw_query_attribute.py +0 -59
  228. sqlmesh/migrations/v0042_trim_indirect_versions.py +0 -66
  229. sqlmesh/migrations/v0043_fix_remove_obsolete_attributes_in_plan_dags.py +0 -61
  230. sqlmesh/migrations/v0044_quote_identifiers_in_model_attributes.py +0 -5
  231. sqlmesh/migrations/v0045_move_gateway_variable.py +0 -70
  232. sqlmesh/migrations/v0046_add_batch_concurrency.py +0 -8
  233. sqlmesh/migrations/v0047_change_scd_string_to_column.py +0 -5
  234. sqlmesh/migrations/v0048_drop_indirect_versions.py +0 -59
  235. sqlmesh/migrations/v0049_replace_identifier_with_version_in_seeds_table.py +0 -57
  236. sqlmesh/migrations/v0050_drop_seeds_table.py +0 -11
  237. sqlmesh/migrations/v0051_rename_column_descriptions.py +0 -65
  238. sqlmesh/migrations/v0052_add_normalize_name_in_environment_naming_info.py +0 -28
  239. sqlmesh/migrations/v0053_custom_model_kind_extra_attributes.py +0 -5
  240. sqlmesh/migrations/v0054_fix_trailing_comments.py +0 -5
  241. sqlmesh/migrations/v0055_add_updated_ts_unpaused_ts_ttl_ms_unrestorable_to_snapshot.py +0 -132
  242. sqlmesh/migrations/v0056_restore_table_indexes.py +0 -118
  243. sqlmesh/migrations/v0057_add_table_format.py +0 -5
  244. sqlmesh/migrations/v0058_add_requirements.py +0 -26
  245. sqlmesh/migrations/v0059_add_physical_version.py +0 -5
  246. sqlmesh-0.213.1.dev1.dist-info/RECORD +0 -421
  247. web/client/dist/assets/Lineage-D0Hgdz2v.js +0 -1
  248. web/client/dist/assets/context-DgX0fp2E.js +0 -68
  249. {sqlmesh-0.213.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/WHEEL +0 -0
  250. {sqlmesh-0.213.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/entry_points.txt +0 -0
  251. {sqlmesh-0.213.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/licenses/LICENSE +0 -0
  252. {sqlmesh-0.213.1.dev1.dist-info → sqlmesh-0.227.2.dev4.dist-info}/top_level.txt +0 -0
@@ -1 +1 @@
1
- import{r as E,d as z,a as H,j as J,a8 as O,ab as P,v as y,F as R,ac as C,I as Q,i as x,ad as Z,ae as k,b,g as ee}from"./index-O3mjYpnE.js";import{u as h,M as g}from"./project-6gxepOhm.js";import{M as V}from"./file-DarlIDVi.js";import{u as te}from"./editor-DYIP1yQ4.js";const le={Added:1,Modified:2,Deleted:3},G=E.createContext({artifactRename:void 0,setArtifactRename:()=>{},selectArtifactsInRange:()=>new Set,createDirectory:()=>{},createFile:()=>{},renameArtifact:()=>{},removeArtifacts:()=>{},removeArtifactWithConfirmation:()=>{},moveArtifacts:()=>{},isTopGroupInActiveRange:()=>!1,isBottomGroupInActiveRange:()=>!1,isMiddleGroupInActiveRange:()=>!1});function re({children:$}){const{addError:v}=z(),A=h(e=>e.activeRange),l=h(e=>e.project),_=h(e=>e.files),D=h(e=>e.setActiveRange),M=h(e=>e.setSelectedFile),I=h(e=>e.setFiles),c=h(e=>e.inActiveRange),S=H(e=>e.addConfirmation),p=te(e=>e.tab),[F,r]=E.useState(!1),[N,w]=E.useState();E.useEffect(()=>{M(p==null?void 0:p.file)},[p==null?void 0:p.id]);function L(e){const n=A.length-1,s=l.allVisibleArtifacts,u=A[0],a=A[n],i=s.indexOf(e),o=u==null?0:s.indexOf(u),m=a==null?n:s.indexOf(a),f=i>o?o:i,d=i>m||i>o&&i<m?i:m;D(s.slice(f,d+1))}function X(e){if(F)return;r(!0);const t=O("new_directory");P([e.path,t].join("/"),{}).then(n=>{y(n)||e.open()}).catch(n=>v(R.FileExplorer,n)).finally(()=>{r(!1)})}function W(e,t){if(F)return;y(t)&&(e.isModels?t=".sql":e.isTests?t=".yaml":t=".py"),r(!0);const n=O("new_file",t);C(`${e.path}/${n}`,{content:""}).then(s=>{y(s)||e.open()}).catch(s=>v(R.FileExplorer,s)).finally(()=>{r(!1)})}function Y(e,t){var i;t=t==null?void 0:t.replaceAll("/","").trim();const s=(((i=e.parent)==null?void 0:i.artifacts)??[]).some(o=>o.name===t);if(F||Q(t)||s)return;r(!0);const u=e.name,a=e.path;e.rename(t),e instanceof g&&P(a,{new_path:e.path}).catch(o=>{v(R.FileExplorer,o),e.rename(u)}).finally(()=>{r(!1),x(p)&&e.hasFile(p.file)&&M(p.file),I(l.allFiles)}),e instanceof V&&C(a,{new_path:e.path}).then(o=>{e.update(o),_.set(e.path,e),_.delete(a)}).catch(o=>{v(R.FileExplorer,o),e.rename(u)}).finally(()=>{r(!1),I(l.allFiles)})}function T(e){if(F)return;r(!0);const t=e.map(n=>n instanceof V?Z(n.path):k(n.path));Promise.all(t).then(()=>{D([])}).catch(n=>v(R.FileExplorer,n)).finally(()=>{r(!1)})}function q(e){c(e)?S({headline:"Removing Selected Files/Directories",description:`Are you sure you want to remove ${A.length} items?`,yesText:"Yes, Remove",noText:"No, Cancel",details:A.map(t=>t.path),action:()=>{T(A)}}):S({headline:`Removing ${e instanceof g?"Directory":"File"}`,description:`Are you sure you want to remove the ${e instanceof g?"directory":"file"} "${e.name}"?`,yesText:"Yes, Remove",noText:"No, Cancel",action:()=>{x(e.parent)&&T([e])}})}function j(e,t,n=!1){if(F)return;r(!0);const s=[],u=[],a=[];if(e.forEach(i=>{const o=t.containsName(i.name),m=i.path;if(o&&b(n))return a.push(i);n&&i.rename(i.copyName());let f=[t.path,i.name].join("/");for(;f.startsWith("/");)f=f.slice(1).trim();i instanceof g&&(s.push(()=>{var d;(d=i.parent)==null||d.removeDirectory(i),t.addDirectory(i)}),u.push(P(m,{new_path:f})),i.allVisibleArtifacts.forEach(d=>e.splice(e.indexOf(d),1))),i instanceof V&&(s.push(()=>{var d;(d=i.parent)==null||d.removeFile(i),t.addFile(i)}),u.push(C(m,{new_path:f})))}),ee(a)){S({headline:"Moving Duplicates",description:"All duplicated names will be renamed!",yesText:"Yes, Rename",noText:"No, Cancel",details:a.map(i=>i.path),action:()=>{j(e,t,!0)}});return}Promise.all(u).then(i=>{i.forEach((o,m)=>{var f;return(f=s[m])==null?void 0:f.call(s)})}).catch(i=>{console.log(i)}).finally(()=>{r(!1),D([]),I(l.allFiles)})}function B(e){const t=l.allVisibleArtifacts.indexOf(e),n=l.allVisibleArtifacts[t-1],s=l.allVisibleArtifacts[t+1];return c(e)&&(y(n)||b(c(n)))&&x(s)&&c(s)}function K(e){const t=l.allVisibleArtifacts.indexOf(e),n=l.allVisibleArtifacts[t-1],s=l.allVisibleArtifacts[t+1];return c(e)&&(y(s)||b(c(s)))&&x(n)&&c(n)}function U(e){const t=l.allVisibleArtifacts.indexOf(e),n=l.allVisibleArtifacts[t-1],s=l.allVisibleArtifacts[t+1];return c(e)&&x(s)&&c(s)&&x(n)&&c(n)}return J.jsx(G.Provider,{value:{artifactRename:N,setArtifactRename:w,createDirectory:X,createFile:W,renameArtifact:Y,removeArtifacts:T,removeArtifactWithConfirmation:q,moveArtifacts:j,selectArtifactsInRange:L,isTopGroupInActiveRange:B,isBottomGroupInActiveRange:K,isMiddleGroupInActiveRange:U},children:$})}function ce(){return E.useContext(G)}export{le as EnumFileExplorerChange,G as FileExplorerContext,re as default,ce as useFileExplorer};
1
+ import{r as E,d as z,a as H,j as J,a8 as O,ab as P,v as y,F as R,ac as C,I as Q,i as x,ad as Z,ae as k,b,g as ee}from"./index-Dj0i1-CA.js";import{u as h,M as g}from"./project-BvSOI8MY.js";import{M as V}from"./file-CvJN3aZO.js";import{u as te}from"./editor-CcO28cqd.js";const le={Added:1,Modified:2,Deleted:3},G=E.createContext({artifactRename:void 0,setArtifactRename:()=>{},selectArtifactsInRange:()=>new Set,createDirectory:()=>{},createFile:()=>{},renameArtifact:()=>{},removeArtifacts:()=>{},removeArtifactWithConfirmation:()=>{},moveArtifacts:()=>{},isTopGroupInActiveRange:()=>!1,isBottomGroupInActiveRange:()=>!1,isMiddleGroupInActiveRange:()=>!1});function re({children:$}){const{addError:v}=z(),A=h(e=>e.activeRange),l=h(e=>e.project),_=h(e=>e.files),D=h(e=>e.setActiveRange),M=h(e=>e.setSelectedFile),I=h(e=>e.setFiles),c=h(e=>e.inActiveRange),S=H(e=>e.addConfirmation),p=te(e=>e.tab),[F,r]=E.useState(!1),[N,w]=E.useState();E.useEffect(()=>{M(p==null?void 0:p.file)},[p==null?void 0:p.id]);function L(e){const n=A.length-1,s=l.allVisibleArtifacts,u=A[0],a=A[n],i=s.indexOf(e),o=u==null?0:s.indexOf(u),m=a==null?n:s.indexOf(a),f=i>o?o:i,d=i>m||i>o&&i<m?i:m;D(s.slice(f,d+1))}function X(e){if(F)return;r(!0);const t=O("new_directory");P([e.path,t].join("/"),{}).then(n=>{y(n)||e.open()}).catch(n=>v(R.FileExplorer,n)).finally(()=>{r(!1)})}function W(e,t){if(F)return;y(t)&&(e.isModels?t=".sql":e.isTests?t=".yaml":t=".py"),r(!0);const n=O("new_file",t);C(`${e.path}/${n}`,{content:""}).then(s=>{y(s)||e.open()}).catch(s=>v(R.FileExplorer,s)).finally(()=>{r(!1)})}function Y(e,t){var i;t=t==null?void 0:t.replaceAll("/","").trim();const s=(((i=e.parent)==null?void 0:i.artifacts)??[]).some(o=>o.name===t);if(F||Q(t)||s)return;r(!0);const u=e.name,a=e.path;e.rename(t),e instanceof g&&P(a,{new_path:e.path}).catch(o=>{v(R.FileExplorer,o),e.rename(u)}).finally(()=>{r(!1),x(p)&&e.hasFile(p.file)&&M(p.file),I(l.allFiles)}),e instanceof V&&C(a,{new_path:e.path}).then(o=>{e.update(o),_.set(e.path,e),_.delete(a)}).catch(o=>{v(R.FileExplorer,o),e.rename(u)}).finally(()=>{r(!1),I(l.allFiles)})}function T(e){if(F)return;r(!0);const t=e.map(n=>n instanceof V?Z(n.path):k(n.path));Promise.all(t).then(()=>{D([])}).catch(n=>v(R.FileExplorer,n)).finally(()=>{r(!1)})}function q(e){c(e)?S({headline:"Removing Selected Files/Directories",description:`Are you sure you want to remove ${A.length} items?`,yesText:"Yes, Remove",noText:"No, Cancel",details:A.map(t=>t.path),action:()=>{T(A)}}):S({headline:`Removing ${e instanceof g?"Directory":"File"}`,description:`Are you sure you want to remove the ${e instanceof g?"directory":"file"} "${e.name}"?`,yesText:"Yes, Remove",noText:"No, Cancel",action:()=>{x(e.parent)&&T([e])}})}function j(e,t,n=!1){if(F)return;r(!0);const s=[],u=[],a=[];if(e.forEach(i=>{const o=t.containsName(i.name),m=i.path;if(o&&b(n))return a.push(i);n&&i.rename(i.copyName());let f=[t.path,i.name].join("/");for(;f.startsWith("/");)f=f.slice(1).trim();i instanceof g&&(s.push(()=>{var d;(d=i.parent)==null||d.removeDirectory(i),t.addDirectory(i)}),u.push(P(m,{new_path:f})),i.allVisibleArtifacts.forEach(d=>e.splice(e.indexOf(d),1))),i instanceof V&&(s.push(()=>{var d;(d=i.parent)==null||d.removeFile(i),t.addFile(i)}),u.push(C(m,{new_path:f})))}),ee(a)){S({headline:"Moving Duplicates",description:"All duplicated names will be renamed!",yesText:"Yes, Rename",noText:"No, Cancel",details:a.map(i=>i.path),action:()=>{j(e,t,!0)}});return}Promise.all(u).then(i=>{i.forEach((o,m)=>{var f;return(f=s[m])==null?void 0:f.call(s)})}).catch(i=>{console.log(i)}).finally(()=>{r(!1),D([]),I(l.allFiles)})}function B(e){const t=l.allVisibleArtifacts.indexOf(e),n=l.allVisibleArtifacts[t-1],s=l.allVisibleArtifacts[t+1];return c(e)&&(y(n)||b(c(n)))&&x(s)&&c(s)}function K(e){const t=l.allVisibleArtifacts.indexOf(e),n=l.allVisibleArtifacts[t-1],s=l.allVisibleArtifacts[t+1];return c(e)&&(y(s)||b(c(s)))&&x(n)&&c(n)}function U(e){const t=l.allVisibleArtifacts.indexOf(e),n=l.allVisibleArtifacts[t-1],s=l.allVisibleArtifacts[t+1];return c(e)&&x(s)&&c(s)&&x(n)&&c(n)}return J.jsx(G.Provider,{value:{artifactRename:N,setArtifactRename:w,createDirectory:X,createFile:W,renameArtifact:Y,removeArtifacts:T,removeArtifactWithConfirmation:q,moveArtifacts:j,selectArtifactsInRange:L,isTopGroupInActiveRange:B,isBottomGroupInActiveRange:K,isMiddleGroupInActiveRange:U},children:$})}function ce(){return E.useContext(G)}export{le as EnumFileExplorerChange,G as FileExplorerContext,re as default,ce as useFileExplorer};
@@ -1,4 +1,4 @@
1
- import{a0 as W,ay as y,v as l,b as m,az as A}from"./index-O3mjYpnE.js";import{M as Z}from"./file-DarlIDVi.js";const I=`(function(){"use strict";function l(n){return n===!1}function w(n){return n===""}function y(n){return a(n)||w(n)}function a(n){return n==null}function D(...n){return n.filter(Boolean).join("__")}const r={Upstream:"upstream",Downstream:"downstream"},m=self;m.onmessage=async n=>{if(n.data.topic==="lineage")try{const{currentLineage:t,newLineage:s,mainNode:o}=n.data.payload,e=await g(t,s),c=await N(o,e);m.postMessage({topic:"lineage",payload:{lineage:e,nodesConnections:c}})}catch(t){m.postMessage({topic:"error",error:t})}};async function g(n={},t={}){return Object.entries(t).reduce((s,[o,e=[]])=>{var c;return o=encodeURI(o),s[o]={models:e.map(encodeURI),columns:((c=n==null?void 0:n[o])==null?void 0:c.columns)??void 0},s},{})}async function N(n,t={}){return new Promise((s,o)=>{if(a(t)||a(n))return{};const e={};try{f(r.Upstream,n,t,e),f(r.Downstream,n,t,e)}catch(c){o(c)}s(e)})}function f(n=r.Downstream,t,s={},o={}){var u;const e=n===r.Downstream;let c=[];e?c=Object.keys(s).filter(i=>s[i].models.includes(t)):c=((u=s[t])==null?void 0:u.models)??[],l(t in o)&&(o[t]=d());for(const i of c){const p=e?d(t,i,[o[t]]):d(i,t,[o[t]]);i in o?o[i].edges.push(p):(o[i]=p,f(n,i,s,o))}}function d(n,t,s=[]){const o=D(n,t);return{id:y(o)?void 0:o,edges:s}}})();
1
+ import{a0 as W,ay as y,v as l,b as m,az as A}from"./index-Dj0i1-CA.js";import{M as Z}from"./file-CvJN3aZO.js";const I=`(function(){"use strict";function l(n){return n===!1}function w(n){return n===""}function y(n){return a(n)||w(n)}function a(n){return n==null}function D(...n){return n.filter(Boolean).join("__")}const r={Upstream:"upstream",Downstream:"downstream"},m=self;m.onmessage=async n=>{if(n.data.topic==="lineage")try{const{currentLineage:t,newLineage:s,mainNode:o}=n.data.payload,e=await g(t,s),c=await N(o,e);m.postMessage({topic:"lineage",payload:{lineage:e,nodesConnections:c}})}catch(t){m.postMessage({topic:"error",error:t})}};async function g(n={},t={}){return Object.entries(t).reduce((s,[o,e=[]])=>{var c;return o=encodeURI(o),s[o]={models:e.map(encodeURI),columns:((c=n==null?void 0:n[o])==null?void 0:c.columns)??void 0},s},{})}async function N(n,t={}){return new Promise((s,o)=>{if(a(t)||a(n))return{};const e={};try{f(r.Upstream,n,t,e),f(r.Downstream,n,t,e)}catch(c){o(c)}s(e)})}function f(n=r.Downstream,t,s={},o={}){var u;const e=n===r.Downstream;let c=[];e?c=Object.keys(s).filter(i=>s[i].models.includes(t)):c=((u=s[t])==null?void 0:u.models)??[],l(t in o)&&(o[t]=d());for(const i of c){const p=e?d(t,i,[o[t]]):d(i,t,[o[t]]);i in o?o[i].edges.push(p):(o[i]=p,f(n,i,s,o))}}function d(n,t,s=[]){const o=D(n,t);return{id:y(o)?void 0:o,edges:s}}})();
2
2
  `,r=typeof self<"u"&&self.Blob&&new Blob([I],{type:"text/javascript;charset=utf-8"});function F(t){let s;try{if(s=r&&(self.URL||self.webkitURL).createObjectURL(r),!s)throw"";const e=new Worker(s,{name:t==null?void 0:t.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(s)}),e}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(I),{name:t==null?void 0:t.name})}finally{s&&(self.URL||self.webkitURL).revokeObjectURL(s)}}const b=`(function(){"use strict";const g=self;import("https://cdn.jsdelivr.net/pyodide/v0.23.2/full/pyodide.js").then(()=>{const c=s();g.onmessage=async a=>{var i,l,t;const{sqlglot:C}=await c;if(a.data.topic==="validate"){let I;try{I=JSON.parse((i=C.get("validate"))==null?void 0:i(a.data.payload))}catch{I=!1}g.postMessage({topic:"validate",payload:I})}if(a.data.topic==="dialect"){let I;try{I=JSON.parse((l=C.get("get_dialect"))==null?void 0:l(a.data.payload))}catch{I={keywords:"",types:""}}g.postMessage({topic:"dialect",payload:I})}if(a.data.topic==="dialects"){let I;try{I=JSON.parse(C.get("dialects"))}catch{I=[]}g.postMessage({topic:"dialects",payload:I})}a.data.topic==="format"&&g.postMessage({topic:"format",payload:((t=C.get("format"))==null?void 0:t(a.data.payload.sql,a.data.payload.dialect))??""}),a.data.topic==="init"&&g.postMessage({topic:"init"})}}).catch(console.error);async function s(){g.pyodide=await g.loadPyodide(),await g.pyodide.loadPackage("micropip");const c=g.pyodide.pyimport("micropip");await c.install("sqlglot"),await c.install("typing-extensions");const a=await(await fetch(new URL("data:application/octet-stream;base64,aW1wb3J0IGpzb24KCmltcG9ydCBzcWxnbG90CmZyb20gc3FsZ2xvdCBpbXBvcnQgZXhwCmZyb20gc3FsZ2xvdC5kaWFsZWN0cy5kaWFsZWN0IGltcG9ydCBEaWFsZWN0LCBEaWFsZWN0VHlwZQoKZGlhbGVjdHMgPSBqc29uLmR1bXBzKAogICAgWwogICAgICAgIHsKICAgICAgICAgICAgImRpYWxlY3RfdGl0bGUiOiAiU1FMR2xvdCIgaWYgZGlhbGVjdCA9PSAiIiBlbHNlIGRpYWxlY3RfY2xhc3MuX19uYW1lX18sCiAgICAgICAgICAgICJkaWFsZWN0X25hbWUiOiBkaWFsZWN0LAogICAgICAgIH0KICAgICAgICBmb3IgZGlhbGVjdCwgZGlhbGVjdF9jbGFzcyBpbiBEaWFsZWN0LmNsYXNzZXMuaXRlbXMoKQogICAgXQopCgoKZGVmIHBhcnNlX3RvX2pzb24oc3FsOiBzdHIsIHJlYWQ6IERpYWxlY3RUeXBlID0gTm9uZSkgLT4gc3RyOgogICAgcmV0dXJuIGpzb24uZHVtcHMoCiAgICAgICAgW2V4cC5kdW1wKCkgaWYgZXhwIGVsc2Uge30gZm9yIGV4cCBpbiBzcWxnbG90LnBhcnNlKHNxbCwgcmVhZD1yZWFkLCBlcnJvcl9sZXZlbD0iaWdub3JlIildCiAgICApCgoKZGVmIGdldF9kaWFsZWN0KG5hbWU6IHN0ciA9ICIiKSAtPiBzdHI6CiAgICBkaWFsZWN0ID0gRGlhbGVjdC5jbGFzc2VzLmdldChuYW1lLCBEaWFsZWN0KQogICAga2V5d29yZHMgPSBkaWFsZWN0LnRva2VuaXplcl9jbGFzcy5LRVlXT1JEUwogICAgdHlwZV9tYXBwaW5nID0gZGlhbGVjdC5nZW5lcmF0b3JfY2xhc3MuVFlQRV9NQVBQSU5HCgogICAgcmV0dXJuIGpzb24uZHVtcHMoCiAgICAgICAgewogICAgICAgICAgICAia2V5d29yZHMiOiAiICIuam9pbihrZXl3b3JkcyksCiAgICAgICAgICAgICJ0eXBlcyI6ICIgIi5qb2luKHR5cGVfbWFwcGluZy5nZXQodCwgdC52YWx1ZSkgZm9yIHQgaW4gZXhwLkRhdGFUeXBlLlR5cGUpLAogICAgICAgIH0KICAgICkKCgpkZWYgZm9ybWF0KHNxbDogc3RyID0gIiIsIHJlYWQ6IERpYWxlY3RUeXBlID0gTm9uZSkgLT4gc3RyOgogICAgcmV0dXJuICJcbiIuam9pbigKICAgICAgICBzcWxnbG90LnRyYW5zcGlsZShzcWwsIHJlYWQ9cmVhZCwgZXJyb3JfbGV2ZWw9c3FsZ2xvdC5lcnJvcnMuRXJyb3JMZXZlbC5JR05PUkUsIHByZXR0eT1UcnVlKQogICAgKQoKCmRlZiB2YWxpZGF0ZShzcWw6IHN0ciA9ICIiLCByZWFkOiBEaWFsZWN0VHlwZSA9IE5vbmUpIC0+IHN0cjoKICAgIHRyeToKICAgICAgICBzcWxnbG90LnRyYW5zcGlsZSgKICAgICAgICAgICAgc3FsLCByZWFkPXJlYWQsIHByZXR0eT1GYWxzZSwgdW5zdXBwb3J0ZWRfbGV2ZWw9c3FsZ2xvdC5lcnJvcnMuRXJyb3JMZXZlbC5JTU1FRElBVEUKICAgICAgICApCiAgICBleGNlcHQgc3FsZ2xvdC5lcnJvcnMuUGFyc2VFcnJvcjoKICAgICAgICByZXR1cm4ganNvbi5kdW1wcyhGYWxzZSkKCiAgICByZXR1cm4ganNvbi5kdW1wcyhUcnVlKQoKCnsKICAgICJkaWFsZWN0cyI6IGRpYWxlY3RzLAogICAgImdldF9kaWFsZWN0IjogZ2V0X2RpYWxlY3QsCiAgICAicGFyc2VfdG9fanNvbiI6IHBhcnNlX3RvX2pzb24sCiAgICAidmFsaWRhdGUiOiB2YWxpZGF0ZSwKICAgICJmb3JtYXQiOiBmb3JtYXQsCn0K",self.location.href))).text();return g.postMessage({topic:"init"}),{sqlglot:g.pyodide.runPython(a)}}})();
3
3
  `,d=typeof self<"u"&&self.Blob&&new Blob([b],{type:"text/javascript;charset=utf-8"});function w(t){let s;try{if(s=d&&(self.URL||self.webkitURL).createObjectURL(d),!s)throw"";const e=new Worker(s,{name:t==null?void 0:t.name});return e.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(s)}),e}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(b),{name:t==null?void 0:t.name})}finally{s&&(self.URL||self.webkitURL).revokeObjectURL(s)}}const R=w(),[v,g]=y("tabs"),{tabs:h=[],id:G}=v()??{},C=p(),f=u(C),B=new Map([[C,f]]),U=W((t,s)=>({storedTabs:h,storedTabId:G,tab:f,tabs:B,engine:R,dialects:[],previewQuery:void 0,previewTable:void 0,previewDiff:void 0,direction:"vertical",inTabs(e){return s().tabs.has(e)},replaceTab(e,a){const n=s(),i=Array.from(n.tabs.entries()),o=i.findIndex(([c])=>c===e.file);i[o]=[a.file,a],t(()=>({tabs:new Map(i)})),n.updateStoredTabsIds()},updateStoredTabsIds(){const e=s();if(l(e.tab)){g({id:void 0,tabs:[]}),t(()=>({storedTabId:void 0,storedTabs:[]}));return}const a=[];for(const i of e.tabs.values())m(i.file.isChanged)&&i.file.isLocal||a.push({id:i.file.id,content:i.file.content});const n=e.tab.file.isChanged||e.tab.file.isRemote?e.tab.file.id:void 0;g({id:n,tabs:a}),t(()=>({storedTabId:n,storedTabs:a}))},refreshTab(e){l(e)||s().selectTab({...e})},setDialects(e){t(()=>({dialects:e}))},selectTab(e){const a=s();t(()=>({tab:e})),a.updateStoredTabsIds()},addTabs(e){const a=s();for(const n of e)a.tabs.set(n.file,n);t(()=>({tabs:new Map(a.tabs)}))},addTab(e){const a=s();if(a.tabs.has(e.file))a.tabs.set(e.file,e),t(()=>({tabs:new Map(a.tabs)}));else{const n=Array.from(a.tabs.entries()),i=n.findIndex(([o])=>{var c;return o===((c=a.tab)==null?void 0:c.file)});n.splice(i<0?n.length:i+1,0,[e.file,e]),t(()=>({tabs:new Map(n)}))}a.updateStoredTabsIds()},closeTab(e){var n;const a=s();if(e.removeChanges(),a.tabs.delete(e),a.tabs.size===0)a.selectTab(void 0);else if(a.tabs.size===1){const i=Array.from(a.tabs.values());a.selectTab(i.at(0))}else if(e.id===((n=a.tab)==null?void 0:n.file.id)){const i=Array.from(a.tabs.values()),o=i.findIndex(c=>c.file===e);a.selectTab(i.at(o-1))}t(()=>({tabs:new Map(a.tabs)})),a.updateStoredTabsIds()},createTab:u,setPreviewQuery(e){t(()=>({previewQuery:e}))},setPreviewTable(e){t(()=>({previewTable:e}))},setPreviewDiff(e){t(()=>({previewDiff:e}))},setDirection(e){t(()=>({direction:e}))}}));function u(t=p()){return{id:A(),file:t,isValid:!0}}function p(t){return new Z({id:t,name:"",path:"",content:`-- Create arbitrary SQL queries
4
4
  -- and execute them against different environments
@@ -1 +1 @@
1
- var u=Object.defineProperty;var g=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var h=(r,e,t)=>g(r,typeof e!="symbol"?e+"":e,t);import{$ as _,I as x,a8 as m,a9 as n,aa as c,W as d,b as f}from"./index-O3mjYpnE.js";class y extends _{constructor(t,s){super(t!=null&&t.isModel?t.initial:{...t,name:(t==null?void 0:t.name)??"",path:(t==null?void 0:t.path)??""});h(this,"_path");h(this,"_name");h(this,"parent");h(this,"remove",!1);this._path=(t==null?void 0:t.path)??this.initial.path,this._name=(t==null?void 0:t.name)??this.initial.name,this.parent=s}get id(){return x(this.path)?this.initial.id:this.path}get name(){return this._name}get path(){return this._path}get isUntitled(){return this.name===""}get isLocal(){return this.path===""}get isRemote(){return this.path!==""}get withParent(){var t;return!!((t=this.parent)!=null&&t.isModel)}copyName(){return`Copy of ${this.name}__${m()}`}rename(t){this.isRemote&&(this._path=this._path.replace(this.name,t)),this._name=t}static findArtifactByPath(t,s){return t.path===s?t:t.allArtifacts.find(a=>a.path===s)}}const p={SQL:".sql",PY:".py",YAML:".yaml",YML:".yml"};class o extends y{constructor(t,s){super(o.getInitialArtifact(t),s);h(this,"_content","");h(this,"content");h(this,"extension");h(this,"isFormatted");this.content=this._content=n((t==null?void 0:t.content)??this.initial.content),this.extension=n((t==null?void 0:t.extension)??this.initial.extension),this.isFormatted=t==null?void 0:t.isFormatted}get basename(){return this.name.replace(this.extension,"")}get isEmpty(){return c(this.content)}get isChanged(){return d(this._content)&&this.content!==this._content}get isSQL(){return this.extension===p.SQL}get fingerprint(){return`${this._content}${this.name}${this.path}`}removeChanges(){this.content=this._content}copyName(){return`Copy of ${n(this.name.split(this.extension)[0])}__${m()}${this.extension}`}update(t){const s=n(t==null?void 0:t.content);(c(this._content)||f(this.isChanged))&&(this.content=s),this._content=s,this.extension=n(t==null?void 0:t.extension)}static getInitialArtifact(t){return o.isModelFile(t)?t.initial:{name:n(t==null?void 0:t.name),path:n(t==null?void 0:t.path),extension:(t==null?void 0:t.extension)??p.SQL,content:n(t==null?void 0:t.content)}}static isModelFile(t){return t instanceof o}}export{p as E,o as M,y as a};
1
+ var u=Object.defineProperty;var g=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var h=(r,e,t)=>g(r,typeof e!="symbol"?e+"":e,t);import{$ as _,I as x,a8 as m,a9 as n,aa as c,W as d,b as f}from"./index-Dj0i1-CA.js";class y extends _{constructor(t,s){super(t!=null&&t.isModel?t.initial:{...t,name:(t==null?void 0:t.name)??"",path:(t==null?void 0:t.path)??""});h(this,"_path");h(this,"_name");h(this,"parent");h(this,"remove",!1);this._path=(t==null?void 0:t.path)??this.initial.path,this._name=(t==null?void 0:t.name)??this.initial.name,this.parent=s}get id(){return x(this.path)?this.initial.id:this.path}get name(){return this._name}get path(){return this._path}get isUntitled(){return this.name===""}get isLocal(){return this.path===""}get isRemote(){return this.path!==""}get withParent(){var t;return!!((t=this.parent)!=null&&t.isModel)}copyName(){return`Copy of ${this.name}__${m()}`}rename(t){this.isRemote&&(this._path=this._path.replace(this.name,t)),this._name=t}static findArtifactByPath(t,s){return t.path===s?t:t.allArtifacts.find(a=>a.path===s)}}const p={SQL:".sql",PY:".py",YAML:".yaml",YML:".yml"};class o extends y{constructor(t,s){super(o.getInitialArtifact(t),s);h(this,"_content","");h(this,"content");h(this,"extension");h(this,"isFormatted");this.content=this._content=n((t==null?void 0:t.content)??this.initial.content),this.extension=n((t==null?void 0:t.extension)??this.initial.extension),this.isFormatted=t==null?void 0:t.isFormatted}get basename(){return this.name.replace(this.extension,"")}get isEmpty(){return c(this.content)}get isChanged(){return d(this._content)&&this.content!==this._content}get isSQL(){return this.extension===p.SQL}get fingerprint(){return`${this._content}${this.name}${this.path}`}removeChanges(){this.content=this._content}copyName(){return`Copy of ${n(this.name.split(this.extension)[0])}__${m()}${this.extension}`}update(t){const s=n(t==null?void 0:t.content);(c(this._content)||f(this.isChanged))&&(this.content=s),this._content=s,this.extension=n(t==null?void 0:t.extension)}static getInitialArtifact(t){return o.isModelFile(t)?t.initial:{name:n(t==null?void 0:t.name),path:n(t==null?void 0:t.path),extension:(t==null?void 0:t.extension)??p.SQL,content:n(t==null?void 0:t.content)}}static isModelFile(t){return t instanceof o}}export{p as E,o as M,y as a};
@@ -1 +1 @@
1
- import{ax as Xt,a1 as Ut,r as E}from"./index-O3mjYpnE.js";var $t=Xt();const Je=Ut($t);function at(){return typeof window<"u"}function tt(t){return Wt(t)?(t.nodeName||"").toLowerCase():"#document"}function $(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function I(t){var e;return(e=(Wt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Wt(t){return at()?t instanceof Node||t instanceof $(t).Node:!1}function V(t){return at()?t instanceof Element||t instanceof $(t).Element:!1}function j(t){return at()?t instanceof HTMLElement||t instanceof $(t).HTMLElement:!1}function Ct(t){return!at()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof $(t).ShadowRoot}const Kt=new Set(["inline","contents"]);function ot(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!Kt.has(i)}const Gt=new Set(["table","td","th"]);function Jt(t){return Gt.has(tt(t))}const Qt=[":popover-open",":modal"];function ut(t){return Qt.some(e=>{try{return t.matches(e)}catch{return!1}})}const Zt=["transform","translate","scale","rotate","perspective"],te=["transform","translate","scale","rotate","perspective","filter"],ee=["paint","layout","strict","content"];function xt(t){const e=yt(),n=V(t)?H(t):t;return Zt.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||te.some(o=>(n.willChange||"").includes(o))||ee.some(o=>(n.contain||"").includes(o))}function ne(t){let e=U(t);for(;j(e)&&!Q(e);){if(xt(e))return e;if(ut(e))return null;e=U(e)}return null}function yt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const oe=new Set(["html","body","#document"]);function Q(t){return oe.has(tt(t))}function H(t){return $(t).getComputedStyle(t)}function dt(t){return V(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function U(t){if(tt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ct(t)&&t.host||I(t);return Ct(e)?e.host:e}function Bt(t){const e=U(t);return Q(e)?t.ownerDocument?t.ownerDocument.body:t.body:j(e)&&ot(e)?e:Bt(e)}function nt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Bt(t),r=i===((o=t.ownerDocument)==null?void 0:o.body),s=$(i);if(r){const c=gt(s);return e.concat(s,s.visualViewport||[],ot(i)?i:[],c&&n?nt(c):[])}return e.concat(i,nt(i,[],n))}function gt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const ie=["top","right","bottom","left"],K=Math.min,F=Math.max,st=Math.round,it=Math.floor,z=t=>({x:t,y:t}),re={left:"right",right:"left",bottom:"top",top:"bottom"},se={start:"end",end:"start"};function pt(t,e,n){return F(t,K(e,n))}function Y(t,e){return typeof t=="function"?t(e):t}function q(t){return t.split("-")[0]}function et(t){return t.split("-")[1]}function vt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}const ce=new Set(["top","bottom"]);function _(t){return ce.has(q(t))?"y":"x"}function At(t){return vt(_(t))}function le(t,e,n){n===void 0&&(n=!1);const o=et(t),i=At(t),r=bt(i);let s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=ct(s)),[s,ct(s)]}function fe(t){const e=ct(t);return[wt(t),e,wt(e)]}function wt(t){return t.replace(/start|end/g,e=>se[e])}const St=["left","right"],Et=["right","left"],ae=["top","bottom"],ue=["bottom","top"];function de(t,e,n){switch(t){case"top":case"bottom":return n?e?Et:St:e?St:Et;case"left":case"right":return e?ae:ue;default:return[]}}function me(t,e,n,o){const i=et(t);let r=de(q(t),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(wt)))),r}function ct(t){return t.replace(/left|right|bottom|top/g,e=>re[e])}function he(t){return{top:0,right:0,bottom:0,left:0,...t}}function Vt(t){return typeof t!="number"?he(t):{top:t,right:t,bottom:t,left:t}}function lt(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function Dt(t,e,n){let{reference:o,floating:i}=t;const r=_(e),s=At(e),c=bt(s),f=q(e),l=r==="y",a=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2;let u;switch(f){case"top":u={x:a,y:o.y-i.height};break;case"bottom":u={x:a,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:d};break;case"left":u={x:o.x-i.width,y:d};break;default:u={x:o.x,y:o.y}}switch(et(e)){case"start":u[s]-=m*(n&&l?-1:1);break;case"end":u[s]+=m*(n&&l?-1:1);break}return u}const ge=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,c=r.filter(Boolean),f=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:a,y:d}=Dt(l,o,f),m=o,u={},h=0;for(let g=0;g<c.length;g++){const{name:p,fn:w}=c[g],{x,y:v,data:b,reset:y}=await w({x:a,y:d,initialPlacement:o,placement:m,strategy:i,middlewareData:u,rects:l,platform:s,elements:{reference:t,floating:e}});a=x??a,d=v??d,u={...u,[p]:{...u[p],...b}},y&&h<=50&&(h++,typeof y=="object"&&(y.placement&&(m=y.placement),y.rects&&(l=y.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):y.rects),{x:a,y:d}=Dt(l,m,f)),g=-1)}return{x:a,y:d,placement:m,strategy:i,middlewareData:u}};async function Z(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:s,elements:c,strategy:f}=t,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:d="floating",altBoundary:m=!1,padding:u=0}=Y(e,t),h=Vt(u),p=c[m?d==="floating"?"reference":"floating":d],w=lt(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(p)))==null||n?p:p.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:l,rootBoundary:a,strategy:f})),x=d==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),b=await(r.isElement==null?void 0:r.isElement(v))?await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1}:{x:1,y:1},y=lt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:f}):x);return{top:(w.top-y.top+h.top)/b.y,bottom:(y.bottom-w.bottom+h.bottom)/b.y,left:(w.left-y.left+h.left)/b.x,right:(y.right-w.right+h.right)/b.x}}const pe=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:s,elements:c,middlewareData:f}=e,{element:l,padding:a=0}=Y(t,e)||{};if(l==null)return{};const d=Vt(a),m={x:n,y:o},u=At(i),h=bt(u),g=await s.getDimensions(l),p=u==="y",w=p?"top":"left",x=p?"bottom":"right",v=p?"clientHeight":"clientWidth",b=r.reference[h]+r.reference[u]-m[u]-r.floating[h],y=m[u]-r.reference[u],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let R=O?O[v]:0;(!R||!await(s.isElement==null?void 0:s.isElement(O)))&&(R=c.floating[v]||r.floating[h]);const P=b/2-y/2,W=R/2-g[h]/2-1,D=K(d[w],W),B=K(d[x],W),M=D,L=R-g[h]-B,C=R/2-g[h]/2+P,N=pt(M,C,L),S=!f.arrow&&et(i)!=null&&C!==N&&r.reference[h]/2-(C<M?D:B)-g[h]/2<0,T=S?C<M?C-M:C-L:0;return{[u]:m[u]+T,data:{[u]:N,centerOffset:C-N-T,...S&&{alignmentOffset:T}},reset:S}}}),we=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:f,elements:l}=e,{mainAxis:a=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...p}=Y(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const w=q(i),x=_(c),v=q(c)===c,b=await(f.isRTL==null?void 0:f.isRTL(l.floating)),y=m||(v||!g?[ct(c)]:fe(c)),O=h!=="none";!m&&O&&y.push(...me(c,g,h,b));const R=[c,...y],P=await Z(e,p),W=[];let D=((o=r.flip)==null?void 0:o.overflows)||[];if(a&&W.push(P[w]),d){const C=le(i,s,b);W.push(P[C[0]],P[C[1]])}if(D=[...D,{placement:i,overflows:W}],!W.every(C=>C<=0)){var B,M;const C=(((B=r.flip)==null?void 0:B.index)||0)+1,N=R[C];if(N&&(!(d==="alignment"?x!==_(N):!1)||D.every(A=>A.overflows[0]>0&&_(A.placement)===x)))return{data:{index:C,overflows:D},reset:{placement:N}};let S=(M=D.filter(T=>T.overflows[0]<=0).sort((T,A)=>T.overflows[1]-A.overflows[1])[0])==null?void 0:M.placement;if(!S)switch(u){case"bestFit":{var L;const T=(L=D.filter(A=>{if(O){const k=_(A.placement);return k===x||k==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(k=>k>0).reduce((k,X)=>k+X,0)]).sort((A,k)=>A[1]-k[1])[0])==null?void 0:L[0];T&&(S=T);break}case"initialPlacement":S=c;break}if(i!==S)return{reset:{placement:S}}}return{}}}};function Pt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Lt(t){return ie.some(e=>t[e]>=0)}const xe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...i}=Y(t,e);switch(o){case"referenceHidden":{const r=await Z(e,{...i,elementContext:"reference"}),s=Pt(r,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Lt(s)}}}case"escaped":{const r=await Z(e,{...i,altBoundary:!0}),s=Pt(r,n.floating);return{data:{escapedOffsets:s,escaped:Lt(s)}}}default:return{}}}}},Ht=new Set(["left","top"]);async function ye(t,e){const{placement:n,platform:o,elements:i}=t,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=q(n),c=et(n),f=_(n)==="y",l=Ht.has(s)?-1:1,a=r&&f?-1:1,d=Y(e,t);let{mainAxis:m,crossAxis:u,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof h=="number"&&(u=c==="end"?h*-1:h),f?{x:u*a,y:m*l}:{x:m*l,y:u*a}}const ve=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:s,middlewareData:c}=e,f=await ye(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+f.x,y:r+f.y,data:{...f,placement:s}}}}},be=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:c={fn:p=>{let{x:w,y:x}=p;return{x:w,y:x}}},...f}=Y(t,e),l={x:n,y:o},a=await Z(e,f),d=_(q(i)),m=vt(d);let u=l[m],h=l[d];if(r){const p=m==="y"?"top":"left",w=m==="y"?"bottom":"right",x=u+a[p],v=u-a[w];u=pt(x,u,v)}if(s){const p=d==="y"?"top":"left",w=d==="y"?"bottom":"right",x=h+a[p],v=h-a[w];h=pt(x,h,v)}const g=c.fn({...e,[m]:u,[d]:h});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[m]:r,[d]:s}}}}}},Ae=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:i,rects:r,middlewareData:s}=e,{offset:c=0,mainAxis:f=!0,crossAxis:l=!0}=Y(t,e),a={x:n,y:o},d=_(i),m=vt(d);let u=a[m],h=a[d];const g=Y(c,e),p=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(f){const v=m==="y"?"height":"width",b=r.reference[m]-r.floating[v]+p.mainAxis,y=r.reference[m]+r.reference[v]-p.mainAxis;u<b?u=b:u>y&&(u=y)}if(l){var w,x;const v=m==="y"?"width":"height",b=Ht.has(q(i)),y=r.reference[d]-r.floating[v]+(b&&((w=s.offset)==null?void 0:w[d])||0)+(b?0:p.crossAxis),O=r.reference[d]+r.reference[v]+(b?0:((x=s.offset)==null?void 0:x[d])||0)-(b?p.crossAxis:0);h<y?h=y:h>O&&(h=O)}return{[m]:u,[d]:h}}}},Re=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:i,rects:r,platform:s,elements:c}=e,{apply:f=()=>{},...l}=Y(t,e),a=await Z(e,l),d=q(i),m=et(i),u=_(i)==="y",{width:h,height:g}=r.floating;let p,w;d==="top"||d==="bottom"?(p=d,w=m===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(w=d,p=m==="end"?"top":"bottom");const x=g-a.top-a.bottom,v=h-a.left-a.right,b=K(g-a[p],x),y=K(h-a[w],v),O=!e.middlewareData.shift;let R=b,P=y;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=v),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(R=x),O&&!m){const D=F(a.left,0),B=F(a.right,0),M=F(a.top,0),L=F(a.bottom,0);u?P=h-2*(D!==0||B!==0?D+B:F(a.left,a.right)):R=g-2*(M!==0||L!==0?M+L:F(a.top,a.bottom))}await f({...e,availableWidth:P,availableHeight:R});const W=await s.getDimensions(c.floating);return h!==W.width||g!==W.height?{reset:{rects:!0}}:{}}}};function Nt(t){const e=H(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=j(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,c=st(n)!==r||st(o)!==s;return c&&(n=r,o=s),{width:n,height:o,$:c}}function Rt(t){return V(t)?t:t.contextElement}function J(t){const e=Rt(t);if(!j(e))return z(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=Nt(e);let s=(r?st(n.width):n.width)/o,c=(r?st(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Oe=z(0);function _t(t){const e=$(t);return!yt()||!e.visualViewport?Oe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ce(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==$(t)?!1:e}function G(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=Rt(t);let s=z(1);e&&(o?V(o)&&(s=J(o)):s=J(t));const c=Ce(r,n,o)?_t(r):z(0);let f=(i.left+c.x)/s.x,l=(i.top+c.y)/s.y,a=i.width/s.x,d=i.height/s.y;if(r){const m=$(r),u=o&&V(o)?$(o):o;let h=m,g=gt(h);for(;g&&o&&u!==h;){const p=J(g),w=g.getBoundingClientRect(),x=H(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*p.x,b=w.top+(g.clientTop+parseFloat(x.paddingTop))*p.y;f*=p.x,l*=p.y,a*=p.x,d*=p.y,f+=v,l+=b,h=$(g),g=gt(h)}}return lt({width:a,height:d,x:f,y:l})}function Ot(t,e){const n=dt(t).scrollLeft;return e?e.left+n:G(I(t)).left+n}function zt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=o.left+e.scrollLeft-(n?0:Ot(t,o)),r=o.top+e.scrollTop;return{x:i,y:r}}function Se(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r=i==="fixed",s=I(o),c=e?ut(e.floating):!1;if(o===s||c&&r)return n;let f={scrollLeft:0,scrollTop:0},l=z(1);const a=z(0),d=j(o);if((d||!d&&!r)&&((tt(o)!=="body"||ot(s))&&(f=dt(o)),j(o))){const u=G(o);l=J(o),a.x=u.x+o.clientLeft,a.y=u.y+o.clientTop}const m=s&&!d&&!r?zt(s,f,!0):z(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-f.scrollLeft*l.x+a.x+m.x,y:n.y*l.y-f.scrollTop*l.y+a.y+m.y}}function Ee(t){return Array.from(t.getClientRects())}function De(t){const e=I(t),n=dt(t),o=t.ownerDocument.body,i=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Ot(t);const c=-n.scrollTop;return H(o).direction==="rtl"&&(s+=F(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:c}}function Pe(t,e){const n=$(t),o=I(t),i=n.visualViewport;let r=o.clientWidth,s=o.clientHeight,c=0,f=0;if(i){r=i.width,s=i.height;const l=yt();(!l||l&&e==="fixed")&&(c=i.offsetLeft,f=i.offsetTop)}return{width:r,height:s,x:c,y:f}}const Le=new Set(["absolute","fixed"]);function Te(t,e){const n=G(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=j(t)?J(t):z(1),s=t.clientWidth*r.x,c=t.clientHeight*r.y,f=i*r.x,l=o*r.y;return{width:s,height:c,x:f,y:l}}function Tt(t,e,n){let o;if(e==="viewport")o=Pe(t,n);else if(e==="document")o=De(I(t));else if(V(e))o=Te(e,n);else{const i=_t(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return lt(o)}function jt(t,e){const n=U(t);return n===e||!V(n)||Q(n)?!1:H(n).position==="fixed"||jt(n,e)}function Me(t,e){const n=e.get(t);if(n)return n;let o=nt(t,[],!1).filter(c=>V(c)&&tt(c)!=="body"),i=null;const r=H(t).position==="fixed";let s=r?U(t):t;for(;V(s)&&!Q(s);){const c=H(s),f=xt(s);!f&&c.position==="fixed"&&(i=null),(r?!f&&!i:!f&&c.position==="static"&&!!i&&Le.has(i.position)||ot(s)&&!f&&jt(t,s))?o=o.filter(a=>a!==s):i=c,s=U(s)}return e.set(t,o),o}function ke(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const s=[...n==="clippingAncestors"?ut(e)?[]:Me(e,this._c):[].concat(n),o],c=s[0],f=s.reduce((l,a)=>{const d=Tt(e,a,i);return l.top=F(d.top,l.top),l.right=K(d.right,l.right),l.bottom=K(d.bottom,l.bottom),l.left=F(d.left,l.left),l},Tt(e,c,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Fe(t){const{width:e,height:n}=Nt(t);return{width:e,height:n}}function $e(t,e,n){const o=j(e),i=I(e),r=n==="fixed",s=G(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const f=z(0);function l(){f.x=Ot(i)}if(o||!o&&!r)if((tt(e)!=="body"||ot(i))&&(c=dt(e)),o){const u=G(e,!0,r,e);f.x=u.x+e.clientLeft,f.y=u.y+e.clientTop}else i&&l();r&&!o&&i&&l();const a=i&&!o&&!r?zt(i,c):z(0),d=s.left+c.scrollLeft-f.x-a.x,m=s.top+c.scrollTop-f.y-a.y;return{x:d,y:m,width:s.width,height:s.height}}function mt(t){return H(t).position==="static"}function Mt(t,e){if(!j(t)||H(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return I(t)===n&&(n=n.ownerDocument.body),n}function It(t,e){const n=$(t);if(ut(t))return n;if(!j(t)){let i=U(t);for(;i&&!Q(i);){if(V(i)&&!mt(i))return i;i=U(i)}return n}let o=Mt(t,e);for(;o&&Jt(o)&&mt(o);)o=Mt(o,e);return o&&Q(o)&&mt(o)&&!xt(o)?n:o||ne(t)||n}const We=async function(t){const e=this.getOffsetParent||It,n=this.getDimensions,o=await n(t.floating);return{reference:$e(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Be(t){return H(t).direction==="rtl"}const Ve={convertOffsetParentRelativeRectToViewportRelativeRect:Se,getDocumentElement:I,getClippingRect:ke,getOffsetParent:It,getElementRects:We,getClientRects:Ee,getDimensions:Fe,getScale:J,isElement:V,isRTL:Be};function Yt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function He(t,e){let n=null,o;const i=I(t);function r(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,f){c===void 0&&(c=!1),f===void 0&&(f=1),r();const l=t.getBoundingClientRect(),{left:a,top:d,width:m,height:u}=l;if(c||e(),!m||!u)return;const h=it(d),g=it(i.clientWidth-(a+m)),p=it(i.clientHeight-(d+u)),w=it(a),v={rootMargin:-h+"px "+-g+"px "+-p+"px "+-w+"px",threshold:F(0,K(1,f))||1};let b=!0;function y(O){const R=O[0].intersectionRatio;if(R!==f){if(!b)return s();R?s(!1,R):o=setTimeout(()=>{s(!1,1e-7)},1e3)}R===1&&!Yt(l,t.getBoundingClientRect())&&s(),b=!1}try{n=new IntersectionObserver(y,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(y,v)}n.observe(t)}return s(!0),r}function Qe(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:f=!1}=o,l=Rt(t),a=i||r?[...l?nt(l):[],...nt(e)]:[];a.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),r&&w.addEventListener("resize",n)});const d=l&&c?He(l,n):null;let m=-1,u=null;s&&(u=new ResizeObserver(w=>{let[x]=w;x&&x.target===l&&u&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=u)==null||v.observe(e)})),n()}),l&&!f&&u.observe(l),u.observe(e));let h,g=f?G(t):null;f&&p();function p(){const w=G(t);g&&!Yt(g,w)&&n(),g=w,h=requestAnimationFrame(p)}return n(),()=>{var w;a.forEach(x=>{i&&x.removeEventListener("scroll",n),r&&x.removeEventListener("resize",n)}),d==null||d(),(w=u)==null||w.disconnect(),u=null,f&&cancelAnimationFrame(h)}}const Ze=Z,Ne=ve,_e=be,ze=we,je=Re,Ie=xe,kt=pe,Ye=Ae,qe=(t,e,n)=>{const o=new Map,i={platform:Ve,...n},r={...i.platform,_c:o};return ge(t,e,{...i,platform:r})};var Xe=typeof document<"u",Ue=function(){},rt=Xe?E.useLayoutEffect:Ue;function ft(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!ft(t[o],e[o]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,i[o]))return!1;for(o=n;o--!==0;){const r=i[o];if(!(r==="_owner"&&t.$$typeof)&&!ft(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function qt(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ft(t,e){const n=qt(t);return Math.round(e*n)/n}function ht(t){const e=E.useRef(t);return rt(()=>{e.current=t}),e}function tn(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:r,floating:s}={},transform:c=!0,whileElementsMounted:f,open:l}=t,[a,d]=E.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,u]=E.useState(o);ft(m,o)||u(o);const[h,g]=E.useState(null),[p,w]=E.useState(null),x=E.useCallback(A=>{A!==O.current&&(O.current=A,g(A))},[]),v=E.useCallback(A=>{A!==R.current&&(R.current=A,w(A))},[]),b=r||h,y=s||p,O=E.useRef(null),R=E.useRef(null),P=E.useRef(a),W=f!=null,D=ht(f),B=ht(i),M=ht(l),L=E.useCallback(()=>{if(!O.current||!R.current)return;const A={placement:e,strategy:n,middleware:m};B.current&&(A.platform=B.current),qe(O.current,R.current,A).then(k=>{const X={...k,isPositioned:M.current!==!1};C.current&&!ft(P.current,X)&&(P.current=X,$t.flushSync(()=>{d(X)}))})},[m,e,n,B,M]);rt(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[l]);const C=E.useRef(!1);rt(()=>(C.current=!0,()=>{C.current=!1}),[]),rt(()=>{if(b&&(O.current=b),y&&(R.current=y),b&&y){if(D.current)return D.current(b,y,L);L()}},[b,y,L,D,W]);const N=E.useMemo(()=>({reference:O,floating:R,setReference:x,setFloating:v}),[x,v]),S=E.useMemo(()=>({reference:b,floating:y}),[b,y]),T=E.useMemo(()=>{const A={position:n,left:0,top:0};if(!S.floating)return A;const k=Ft(S.floating,a.x),X=Ft(S.floating,a.y);return c?{...A,transform:"translate("+k+"px, "+X+"px)",...qt(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:X}},[n,c,S.floating,a.x,a.y]);return E.useMemo(()=>({...a,update:L,refs:N,elements:S,floatingStyles:T}),[a,L,N,S,T])}const Ke=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:i}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?kt({element:o.current,padding:i}).fn(n):{}:o?kt({element:o,padding:i}).fn(n):{}}}},en=(t,e)=>({...Ne(t),options:[t,e]}),nn=(t,e)=>({..._e(t),options:[t,e]}),on=(t,e)=>({...Ye(t),options:[t,e]}),rn=(t,e)=>({...ze(t),options:[t,e]}),sn=(t,e)=>({...je(t),options:[t,e]}),cn=(t,e)=>({...Ie(t),options:[t,e]}),ln=(t,e)=>({...Ke(t),options:[t,e]});export{Je as R,sn as a,ln as b,Qe as c,Ze as d,Y as e,rn as f,st as g,cn as h,V as i,K as j,on as l,F as m,en as o,$t as r,nn as s,tn as u};
1
+ import{ax as Xt,a1 as Ut,r as E}from"./index-Dj0i1-CA.js";var $t=Xt();const Je=Ut($t);function at(){return typeof window<"u"}function tt(t){return Wt(t)?(t.nodeName||"").toLowerCase():"#document"}function $(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function I(t){var e;return(e=(Wt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Wt(t){return at()?t instanceof Node||t instanceof $(t).Node:!1}function V(t){return at()?t instanceof Element||t instanceof $(t).Element:!1}function j(t){return at()?t instanceof HTMLElement||t instanceof $(t).HTMLElement:!1}function Ct(t){return!at()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof $(t).ShadowRoot}const Kt=new Set(["inline","contents"]);function ot(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!Kt.has(i)}const Gt=new Set(["table","td","th"]);function Jt(t){return Gt.has(tt(t))}const Qt=[":popover-open",":modal"];function ut(t){return Qt.some(e=>{try{return t.matches(e)}catch{return!1}})}const Zt=["transform","translate","scale","rotate","perspective"],te=["transform","translate","scale","rotate","perspective","filter"],ee=["paint","layout","strict","content"];function xt(t){const e=yt(),n=V(t)?H(t):t;return Zt.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||te.some(o=>(n.willChange||"").includes(o))||ee.some(o=>(n.contain||"").includes(o))}function ne(t){let e=U(t);for(;j(e)&&!Q(e);){if(xt(e))return e;if(ut(e))return null;e=U(e)}return null}function yt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const oe=new Set(["html","body","#document"]);function Q(t){return oe.has(tt(t))}function H(t){return $(t).getComputedStyle(t)}function dt(t){return V(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function U(t){if(tt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Ct(t)&&t.host||I(t);return Ct(e)?e.host:e}function Bt(t){const e=U(t);return Q(e)?t.ownerDocument?t.ownerDocument.body:t.body:j(e)&&ot(e)?e:Bt(e)}function nt(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Bt(t),r=i===((o=t.ownerDocument)==null?void 0:o.body),s=$(i);if(r){const c=gt(s);return e.concat(s,s.visualViewport||[],ot(i)?i:[],c&&n?nt(c):[])}return e.concat(i,nt(i,[],n))}function gt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const ie=["top","right","bottom","left"],K=Math.min,F=Math.max,st=Math.round,it=Math.floor,z=t=>({x:t,y:t}),re={left:"right",right:"left",bottom:"top",top:"bottom"},se={start:"end",end:"start"};function pt(t,e,n){return F(t,K(e,n))}function Y(t,e){return typeof t=="function"?t(e):t}function q(t){return t.split("-")[0]}function et(t){return t.split("-")[1]}function vt(t){return t==="x"?"y":"x"}function bt(t){return t==="y"?"height":"width"}const ce=new Set(["top","bottom"]);function _(t){return ce.has(q(t))?"y":"x"}function At(t){return vt(_(t))}function le(t,e,n){n===void 0&&(n=!1);const o=et(t),i=At(t),r=bt(i);let s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=ct(s)),[s,ct(s)]}function fe(t){const e=ct(t);return[wt(t),e,wt(e)]}function wt(t){return t.replace(/start|end/g,e=>se[e])}const St=["left","right"],Et=["right","left"],ae=["top","bottom"],ue=["bottom","top"];function de(t,e,n){switch(t){case"top":case"bottom":return n?e?Et:St:e?St:Et;case"left":case"right":return e?ae:ue;default:return[]}}function me(t,e,n,o){const i=et(t);let r=de(q(t),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(wt)))),r}function ct(t){return t.replace(/left|right|bottom|top/g,e=>re[e])}function he(t){return{top:0,right:0,bottom:0,left:0,...t}}function Vt(t){return typeof t!="number"?he(t):{top:t,right:t,bottom:t,left:t}}function lt(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function Dt(t,e,n){let{reference:o,floating:i}=t;const r=_(e),s=At(e),c=bt(s),f=q(e),l=r==="y",a=o.x+o.width/2-i.width/2,d=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2;let u;switch(f){case"top":u={x:a,y:o.y-i.height};break;case"bottom":u={x:a,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:d};break;case"left":u={x:o.x-i.width,y:d};break;default:u={x:o.x,y:o.y}}switch(et(e)){case"start":u[s]-=m*(n&&l?-1:1);break;case"end":u[s]+=m*(n&&l?-1:1);break}return u}const ge=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,c=r.filter(Boolean),f=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:a,y:d}=Dt(l,o,f),m=o,u={},h=0;for(let g=0;g<c.length;g++){const{name:p,fn:w}=c[g],{x,y:v,data:b,reset:y}=await w({x:a,y:d,initialPlacement:o,placement:m,strategy:i,middlewareData:u,rects:l,platform:s,elements:{reference:t,floating:e}});a=x??a,d=v??d,u={...u,[p]:{...u[p],...b}},y&&h<=50&&(h++,typeof y=="object"&&(y.placement&&(m=y.placement),y.rects&&(l=y.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):y.rects),{x:a,y:d}=Dt(l,m,f)),g=-1)}return{x:a,y:d,placement:m,strategy:i,middlewareData:u}};async function Z(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:s,elements:c,strategy:f}=t,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:d="floating",altBoundary:m=!1,padding:u=0}=Y(e,t),h=Vt(u),p=c[m?d==="floating"?"reference":"floating":d],w=lt(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(p)))==null||n?p:p.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:l,rootBoundary:a,strategy:f})),x=d==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,v=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),b=await(r.isElement==null?void 0:r.isElement(v))?await(r.getScale==null?void 0:r.getScale(v))||{x:1,y:1}:{x:1,y:1},y=lt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:f}):x);return{top:(w.top-y.top+h.top)/b.y,bottom:(y.bottom-w.bottom+h.bottom)/b.y,left:(w.left-y.left+h.left)/b.x,right:(y.right-w.right+h.right)/b.x}}const pe=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:s,elements:c,middlewareData:f}=e,{element:l,padding:a=0}=Y(t,e)||{};if(l==null)return{};const d=Vt(a),m={x:n,y:o},u=At(i),h=bt(u),g=await s.getDimensions(l),p=u==="y",w=p?"top":"left",x=p?"bottom":"right",v=p?"clientHeight":"clientWidth",b=r.reference[h]+r.reference[u]-m[u]-r.floating[h],y=m[u]-r.reference[u],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let R=O?O[v]:0;(!R||!await(s.isElement==null?void 0:s.isElement(O)))&&(R=c.floating[v]||r.floating[h]);const P=b/2-y/2,W=R/2-g[h]/2-1,D=K(d[w],W),B=K(d[x],W),M=D,L=R-g[h]-B,C=R/2-g[h]/2+P,N=pt(M,C,L),S=!f.arrow&&et(i)!=null&&C!==N&&r.reference[h]/2-(C<M?D:B)-g[h]/2<0,T=S?C<M?C-M:C-L:0;return{[u]:m[u]+T,data:{[u]:N,centerOffset:C-N-T,...S&&{alignmentOffset:T}},reset:S}}}),we=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:f,elements:l}=e,{mainAxis:a=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...p}=Y(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const w=q(i),x=_(c),v=q(c)===c,b=await(f.isRTL==null?void 0:f.isRTL(l.floating)),y=m||(v||!g?[ct(c)]:fe(c)),O=h!=="none";!m&&O&&y.push(...me(c,g,h,b));const R=[c,...y],P=await Z(e,p),W=[];let D=((o=r.flip)==null?void 0:o.overflows)||[];if(a&&W.push(P[w]),d){const C=le(i,s,b);W.push(P[C[0]],P[C[1]])}if(D=[...D,{placement:i,overflows:W}],!W.every(C=>C<=0)){var B,M;const C=(((B=r.flip)==null?void 0:B.index)||0)+1,N=R[C];if(N&&(!(d==="alignment"?x!==_(N):!1)||D.every(A=>A.overflows[0]>0&&_(A.placement)===x)))return{data:{index:C,overflows:D},reset:{placement:N}};let S=(M=D.filter(T=>T.overflows[0]<=0).sort((T,A)=>T.overflows[1]-A.overflows[1])[0])==null?void 0:M.placement;if(!S)switch(u){case"bestFit":{var L;const T=(L=D.filter(A=>{if(O){const k=_(A.placement);return k===x||k==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(k=>k>0).reduce((k,X)=>k+X,0)]).sort((A,k)=>A[1]-k[1])[0])==null?void 0:L[0];T&&(S=T);break}case"initialPlacement":S=c;break}if(i!==S)return{reset:{placement:S}}}return{}}}};function Pt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Lt(t){return ie.some(e=>t[e]>=0)}const xe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...i}=Y(t,e);switch(o){case"referenceHidden":{const r=await Z(e,{...i,elementContext:"reference"}),s=Pt(r,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Lt(s)}}}case"escaped":{const r=await Z(e,{...i,altBoundary:!0}),s=Pt(r,n.floating);return{data:{escapedOffsets:s,escaped:Lt(s)}}}default:return{}}}}},Ht=new Set(["left","top"]);async function ye(t,e){const{placement:n,platform:o,elements:i}=t,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=q(n),c=et(n),f=_(n)==="y",l=Ht.has(s)?-1:1,a=r&&f?-1:1,d=Y(e,t);let{mainAxis:m,crossAxis:u,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof h=="number"&&(u=c==="end"?h*-1:h),f?{x:u*a,y:m*l}:{x:m*l,y:u*a}}const ve=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:s,middlewareData:c}=e,f=await ye(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+f.x,y:r+f.y,data:{...f,placement:s}}}}},be=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:c={fn:p=>{let{x:w,y:x}=p;return{x:w,y:x}}},...f}=Y(t,e),l={x:n,y:o},a=await Z(e,f),d=_(q(i)),m=vt(d);let u=l[m],h=l[d];if(r){const p=m==="y"?"top":"left",w=m==="y"?"bottom":"right",x=u+a[p],v=u-a[w];u=pt(x,u,v)}if(s){const p=d==="y"?"top":"left",w=d==="y"?"bottom":"right",x=h+a[p],v=h-a[w];h=pt(x,h,v)}const g=c.fn({...e,[m]:u,[d]:h});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[m]:r,[d]:s}}}}}},Ae=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:i,rects:r,middlewareData:s}=e,{offset:c=0,mainAxis:f=!0,crossAxis:l=!0}=Y(t,e),a={x:n,y:o},d=_(i),m=vt(d);let u=a[m],h=a[d];const g=Y(c,e),p=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(f){const v=m==="y"?"height":"width",b=r.reference[m]-r.floating[v]+p.mainAxis,y=r.reference[m]+r.reference[v]-p.mainAxis;u<b?u=b:u>y&&(u=y)}if(l){var w,x;const v=m==="y"?"width":"height",b=Ht.has(q(i)),y=r.reference[d]-r.floating[v]+(b&&((w=s.offset)==null?void 0:w[d])||0)+(b?0:p.crossAxis),O=r.reference[d]+r.reference[v]+(b?0:((x=s.offset)==null?void 0:x[d])||0)-(b?p.crossAxis:0);h<y?h=y:h>O&&(h=O)}return{[m]:u,[d]:h}}}},Re=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:i,rects:r,platform:s,elements:c}=e,{apply:f=()=>{},...l}=Y(t,e),a=await Z(e,l),d=q(i),m=et(i),u=_(i)==="y",{width:h,height:g}=r.floating;let p,w;d==="top"||d==="bottom"?(p=d,w=m===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(w=d,p=m==="end"?"top":"bottom");const x=g-a.top-a.bottom,v=h-a.left-a.right,b=K(g-a[p],x),y=K(h-a[w],v),O=!e.middlewareData.shift;let R=b,P=y;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=v),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(R=x),O&&!m){const D=F(a.left,0),B=F(a.right,0),M=F(a.top,0),L=F(a.bottom,0);u?P=h-2*(D!==0||B!==0?D+B:F(a.left,a.right)):R=g-2*(M!==0||L!==0?M+L:F(a.top,a.bottom))}await f({...e,availableWidth:P,availableHeight:R});const W=await s.getDimensions(c.floating);return h!==W.width||g!==W.height?{reset:{rects:!0}}:{}}}};function Nt(t){const e=H(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=j(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,c=st(n)!==r||st(o)!==s;return c&&(n=r,o=s),{width:n,height:o,$:c}}function Rt(t){return V(t)?t:t.contextElement}function J(t){const e=Rt(t);if(!j(e))return z(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=Nt(e);let s=(r?st(n.width):n.width)/o,c=(r?st(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Oe=z(0);function _t(t){const e=$(t);return!yt()||!e.visualViewport?Oe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ce(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==$(t)?!1:e}function G(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=Rt(t);let s=z(1);e&&(o?V(o)&&(s=J(o)):s=J(t));const c=Ce(r,n,o)?_t(r):z(0);let f=(i.left+c.x)/s.x,l=(i.top+c.y)/s.y,a=i.width/s.x,d=i.height/s.y;if(r){const m=$(r),u=o&&V(o)?$(o):o;let h=m,g=gt(h);for(;g&&o&&u!==h;){const p=J(g),w=g.getBoundingClientRect(),x=H(g),v=w.left+(g.clientLeft+parseFloat(x.paddingLeft))*p.x,b=w.top+(g.clientTop+parseFloat(x.paddingTop))*p.y;f*=p.x,l*=p.y,a*=p.x,d*=p.y,f+=v,l+=b,h=$(g),g=gt(h)}}return lt({width:a,height:d,x:f,y:l})}function Ot(t,e){const n=dt(t).scrollLeft;return e?e.left+n:G(I(t)).left+n}function zt(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=o.left+e.scrollLeft-(n?0:Ot(t,o)),r=o.top+e.scrollTop;return{x:i,y:r}}function Se(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r=i==="fixed",s=I(o),c=e?ut(e.floating):!1;if(o===s||c&&r)return n;let f={scrollLeft:0,scrollTop:0},l=z(1);const a=z(0),d=j(o);if((d||!d&&!r)&&((tt(o)!=="body"||ot(s))&&(f=dt(o)),j(o))){const u=G(o);l=J(o),a.x=u.x+o.clientLeft,a.y=u.y+o.clientTop}const m=s&&!d&&!r?zt(s,f,!0):z(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-f.scrollLeft*l.x+a.x+m.x,y:n.y*l.y-f.scrollTop*l.y+a.y+m.y}}function Ee(t){return Array.from(t.getClientRects())}function De(t){const e=I(t),n=dt(t),o=t.ownerDocument.body,i=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Ot(t);const c=-n.scrollTop;return H(o).direction==="rtl"&&(s+=F(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:c}}function Pe(t,e){const n=$(t),o=I(t),i=n.visualViewport;let r=o.clientWidth,s=o.clientHeight,c=0,f=0;if(i){r=i.width,s=i.height;const l=yt();(!l||l&&e==="fixed")&&(c=i.offsetLeft,f=i.offsetTop)}return{width:r,height:s,x:c,y:f}}const Le=new Set(["absolute","fixed"]);function Te(t,e){const n=G(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=j(t)?J(t):z(1),s=t.clientWidth*r.x,c=t.clientHeight*r.y,f=i*r.x,l=o*r.y;return{width:s,height:c,x:f,y:l}}function Tt(t,e,n){let o;if(e==="viewport")o=Pe(t,n);else if(e==="document")o=De(I(t));else if(V(e))o=Te(e,n);else{const i=_t(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return lt(o)}function jt(t,e){const n=U(t);return n===e||!V(n)||Q(n)?!1:H(n).position==="fixed"||jt(n,e)}function Me(t,e){const n=e.get(t);if(n)return n;let o=nt(t,[],!1).filter(c=>V(c)&&tt(c)!=="body"),i=null;const r=H(t).position==="fixed";let s=r?U(t):t;for(;V(s)&&!Q(s);){const c=H(s),f=xt(s);!f&&c.position==="fixed"&&(i=null),(r?!f&&!i:!f&&c.position==="static"&&!!i&&Le.has(i.position)||ot(s)&&!f&&jt(t,s))?o=o.filter(a=>a!==s):i=c,s=U(s)}return e.set(t,o),o}function ke(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const s=[...n==="clippingAncestors"?ut(e)?[]:Me(e,this._c):[].concat(n),o],c=s[0],f=s.reduce((l,a)=>{const d=Tt(e,a,i);return l.top=F(d.top,l.top),l.right=K(d.right,l.right),l.bottom=K(d.bottom,l.bottom),l.left=F(d.left,l.left),l},Tt(e,c,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function Fe(t){const{width:e,height:n}=Nt(t);return{width:e,height:n}}function $e(t,e,n){const o=j(e),i=I(e),r=n==="fixed",s=G(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const f=z(0);function l(){f.x=Ot(i)}if(o||!o&&!r)if((tt(e)!=="body"||ot(i))&&(c=dt(e)),o){const u=G(e,!0,r,e);f.x=u.x+e.clientLeft,f.y=u.y+e.clientTop}else i&&l();r&&!o&&i&&l();const a=i&&!o&&!r?zt(i,c):z(0),d=s.left+c.scrollLeft-f.x-a.x,m=s.top+c.scrollTop-f.y-a.y;return{x:d,y:m,width:s.width,height:s.height}}function mt(t){return H(t).position==="static"}function Mt(t,e){if(!j(t)||H(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return I(t)===n&&(n=n.ownerDocument.body),n}function It(t,e){const n=$(t);if(ut(t))return n;if(!j(t)){let i=U(t);for(;i&&!Q(i);){if(V(i)&&!mt(i))return i;i=U(i)}return n}let o=Mt(t,e);for(;o&&Jt(o)&&mt(o);)o=Mt(o,e);return o&&Q(o)&&mt(o)&&!xt(o)?n:o||ne(t)||n}const We=async function(t){const e=this.getOffsetParent||It,n=this.getDimensions,o=await n(t.floating);return{reference:$e(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Be(t){return H(t).direction==="rtl"}const Ve={convertOffsetParentRelativeRectToViewportRelativeRect:Se,getDocumentElement:I,getClippingRect:ke,getOffsetParent:It,getElementRects:We,getClientRects:Ee,getDimensions:Fe,getScale:J,isElement:V,isRTL:Be};function Yt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function He(t,e){let n=null,o;const i=I(t);function r(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,f){c===void 0&&(c=!1),f===void 0&&(f=1),r();const l=t.getBoundingClientRect(),{left:a,top:d,width:m,height:u}=l;if(c||e(),!m||!u)return;const h=it(d),g=it(i.clientWidth-(a+m)),p=it(i.clientHeight-(d+u)),w=it(a),v={rootMargin:-h+"px "+-g+"px "+-p+"px "+-w+"px",threshold:F(0,K(1,f))||1};let b=!0;function y(O){const R=O[0].intersectionRatio;if(R!==f){if(!b)return s();R?s(!1,R):o=setTimeout(()=>{s(!1,1e-7)},1e3)}R===1&&!Yt(l,t.getBoundingClientRect())&&s(),b=!1}try{n=new IntersectionObserver(y,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(y,v)}n.observe(t)}return s(!0),r}function Qe(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:f=!1}=o,l=Rt(t),a=i||r?[...l?nt(l):[],...nt(e)]:[];a.forEach(w=>{i&&w.addEventListener("scroll",n,{passive:!0}),r&&w.addEventListener("resize",n)});const d=l&&c?He(l,n):null;let m=-1,u=null;s&&(u=new ResizeObserver(w=>{let[x]=w;x&&x.target===l&&u&&(u.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=u)==null||v.observe(e)})),n()}),l&&!f&&u.observe(l),u.observe(e));let h,g=f?G(t):null;f&&p();function p(){const w=G(t);g&&!Yt(g,w)&&n(),g=w,h=requestAnimationFrame(p)}return n(),()=>{var w;a.forEach(x=>{i&&x.removeEventListener("scroll",n),r&&x.removeEventListener("resize",n)}),d==null||d(),(w=u)==null||w.disconnect(),u=null,f&&cancelAnimationFrame(h)}}const Ze=Z,Ne=ve,_e=be,ze=we,je=Re,Ie=xe,kt=pe,Ye=Ae,qe=(t,e,n)=>{const o=new Map,i={platform:Ve,...n},r={...i.platform,_c:o};return ge(t,e,{...i,platform:r})};var Xe=typeof document<"u",Ue=function(){},rt=Xe?E.useLayoutEffect:Ue;function ft(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!ft(t[o],e[o]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,i[o]))return!1;for(o=n;o--!==0;){const r=i[o];if(!(r==="_owner"&&t.$$typeof)&&!ft(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function qt(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ft(t,e){const n=qt(t);return Math.round(e*n)/n}function ht(t){const e=E.useRef(t);return rt(()=>{e.current=t}),e}function tn(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:r,floating:s}={},transform:c=!0,whileElementsMounted:f,open:l}=t,[a,d]=E.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,u]=E.useState(o);ft(m,o)||u(o);const[h,g]=E.useState(null),[p,w]=E.useState(null),x=E.useCallback(A=>{A!==O.current&&(O.current=A,g(A))},[]),v=E.useCallback(A=>{A!==R.current&&(R.current=A,w(A))},[]),b=r||h,y=s||p,O=E.useRef(null),R=E.useRef(null),P=E.useRef(a),W=f!=null,D=ht(f),B=ht(i),M=ht(l),L=E.useCallback(()=>{if(!O.current||!R.current)return;const A={placement:e,strategy:n,middleware:m};B.current&&(A.platform=B.current),qe(O.current,R.current,A).then(k=>{const X={...k,isPositioned:M.current!==!1};C.current&&!ft(P.current,X)&&(P.current=X,$t.flushSync(()=>{d(X)}))})},[m,e,n,B,M]);rt(()=>{l===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[l]);const C=E.useRef(!1);rt(()=>(C.current=!0,()=>{C.current=!1}),[]),rt(()=>{if(b&&(O.current=b),y&&(R.current=y),b&&y){if(D.current)return D.current(b,y,L);L()}},[b,y,L,D,W]);const N=E.useMemo(()=>({reference:O,floating:R,setReference:x,setFloating:v}),[x,v]),S=E.useMemo(()=>({reference:b,floating:y}),[b,y]),T=E.useMemo(()=>{const A={position:n,left:0,top:0};if(!S.floating)return A;const k=Ft(S.floating,a.x),X=Ft(S.floating,a.y);return c?{...A,transform:"translate("+k+"px, "+X+"px)",...qt(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:X}},[n,c,S.floating,a.x,a.y]);return E.useMemo(()=>({...a,update:L,refs:N,elements:S,floatingStyles:T}),[a,L,N,S,T])}const Ke=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:i}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?kt({element:o.current,padding:i}).fn(n):{}:o?kt({element:o,padding:i}).fn(n):{}}}},en=(t,e)=>({...Ne(t),options:[t,e]}),nn=(t,e)=>({..._e(t),options:[t,e]}),on=(t,e)=>({...Ye(t),options:[t,e]}),rn=(t,e)=>({...ze(t),options:[t,e]}),sn=(t,e)=>({...je(t),options:[t,e]}),cn=(t,e)=>({...Ie(t),options:[t,e]}),ln=(t,e)=>({...Ke(t),options:[t,e]});export{Je as R,sn as a,ln as b,Qe as c,Ze as d,Y as e,rn as f,st as g,cn as h,V as i,K as j,on as l,F as m,en as o,$t as r,nn as s,tn as u};
@@ -1,4 +1,4 @@
1
- import{r as I,j as w,g as le,c as X,i as Fe,l as xe,v as de}from"./index-O3mjYpnE.js";import{u as $e}from"./index-D1sR7wpN.js";import{r as Ve,s as Me,t as Pe,I as se}from"./Input-obuJsD6k.js";/**
1
+ import{r as I,j as w,g as le,c as X,i as Fe,l as xe,v as de}from"./index-Dj0i1-CA.js";import{u as $e}from"./index-C-dJH7yZ.js";import{r as Ve,s as Me,t as Pe,I as se}from"./Input-B-oZ6fGO.js";/**
2
2
  * table-core
3
3
  *
4
4
  * Copyright (c) TanStack
@@ -1,4 +1,4 @@
1
- import{r as w}from"./index-O3mjYpnE.js";import{r as I}from"./floating-ui.react-dom-BH3TFvkM.js";function v(r,l,e){let s=e.initialDeps??[],t;function n(){var i,o,h,c;let a;e.key&&((i=e.debug)!=null&&i.call(e))&&(a=Date.now());const u=r();if(!(u.length!==s.length||u.some((f,g)=>s[g]!==f)))return t;s=u;let m;if(e.key&&((o=e.debug)!=null&&o.call(e))&&(m=Date.now()),t=l(...u),e.key&&((h=e.debug)!=null&&h.call(e))){const f=Math.round((Date.now()-a)*100)/100,g=Math.round((Date.now()-m)*100)/100,x=g/16,b=(p,C)=>{for(p=String(p);p.length<C;)p=" "+p;return p};console.info(`%c⏱ ${b(g,5)} /${b(f,5)} ms`,`
1
+ import{r as w}from"./index-Dj0i1-CA.js";import{r as I}from"./floating-ui.react-dom-CjE-JNW1.js";function v(r,l,e){let s=e.initialDeps??[],t;function n(){var i,o,h,c;let a;e.key&&((i=e.debug)!=null&&i.call(e))&&(a=Date.now());const u=r();if(!(u.length!==s.length||u.some((f,g)=>s[g]!==f)))return t;s=u;let m;if(e.key&&((o=e.debug)!=null&&o.call(e))&&(m=Date.now()),t=l(...u),e.key&&((h=e.debug)!=null&&h.call(e))){const f=Math.round((Date.now()-a)*100)/100,g=Math.round((Date.now()-m)*100)/100,x=g/16,b=(p,C)=>{for(p=String(p);p.length<C;)p=" "+p;return p};console.info(`%c⏱ ${b(g,5)} /${b(f,5)} ms`,`
2
2
  font-size: .6rem;
3
3
  font-weight: bold;
4
4
  color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,e==null?void 0:e.key)}return(c=e==null?void 0:e.onChange)==null||c.call(e,t),t}return n.updateDeps=i=>{s=i},n}function S(r,l){if(r===void 0)throw new Error("Unexpected undefined");return r}const R=(r,l)=>Math.abs(r-l)<1.01,_=(r,l,e)=>{let s;return function(...t){r.clearTimeout(s),s=r.setTimeout(()=>l.apply(this,t),e)}},y=r=>{const{offsetWidth:l,offsetHeight:e}=r;return{width:l,height:e}},F=r=>r,A=r=>{const l=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1),s=[];for(let t=l;t<=e;t++)s.push(t);return s},T=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;const t=i=>{const{width:o,height:h}=i;l({width:Math.round(o),height:Math.round(h)})};if(t(y(e)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(i=>{const o=()=>{const h=i[0];if(h!=null&&h.borderBoxSize){const c=h.borderBoxSize[0];if(c){t({width:c.inlineSize,height:c.blockSize});return}}t(y(e))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return n.observe(e,{box:"border-box"}),()=>{n.unobserve(e)}},M={passive:!0},E=typeof window>"u"?!0:"onscrollend"in window,k=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;let t=0;const n=r.options.useScrollendEvent&&E?()=>{}:_(s,()=>{l(t,!1)},r.options.isScrollingResetDelay),i=a=>()=>{const{horizontal:u,isRtl:d}=r.options;t=u?e.scrollLeft*(d&&-1||1):e.scrollTop,n(),l(t,a)},o=i(!0),h=i(!1);h(),e.addEventListener("scroll",o,M);const c=r.options.useScrollendEvent&&E;return c&&e.addEventListener("scrollend",h,M),()=>{e.removeEventListener("scroll",o),c&&e.removeEventListener("scrollend",h)}},D=(r,l,e)=>{if(l!=null&&l.borderBoxSize){const s=l.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return r[e.options.horizontal?"offsetWidth":"offsetHeight"]},W=(r,{adjustments:l=0,behavior:e},s)=>{var t,n;const i=r+l;(n=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||n.call(t,{[s.options.horizontal?"left":"top"]:i,behavior:e})};class j{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(t=>{t.forEach(n=>{const i=()=>{this._measureElement(n.target,n)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var n;return(n=s())==null?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return(n=s())==null?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,t])=>{typeof t>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:F,rangeExtractor:A,onChange:()=>{},measureElement:D,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,t;(t=(s=this.options).onChange)==null||t.call(s,this,e)},this.maybeNotify=v(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()<t?"forward":"backward":null,this.scrollOffset=t,this.isScrolling=n,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const t=new Map,n=new Map;for(let i=s-1;i>=0;i--){const o=e[i];if(t.has(o.lane))continue;const h=n.get(o.lane);if(h==null||o.end>h.end?n.set(o.lane,o):o.end<h.end&&t.set(o.lane,!0),t.size===this.options.lanes)break}return n.size===this.options.lanes?Array.from(n.values()).sort((i,o)=>i.end===o.end?i.index-o.index:i.end-o.end)[0]:void 0},this.getMeasurementOptions=v(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(e,s,t,n,i)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:i}),{key:!1}),this.getMeasurements=v(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:i},o)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));const h=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,h);for(let a=h;a<e;a++){const u=n(a),d=this.options.lanes===1?c[a-1]:this.getFurthestMeasurement(c,a),m=d?d.end+this.options.gap:s+t,f=o.get(u),g=typeof f=="number"?f:this.options.estimateSize(a),x=m+g,b=d?d.lane:a%this.options.lanes;c[a]={index:a,start:m,size:g,end:x,key:u,lane:b}}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=v(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,n)=>this.range=e.length>0&&s>0?L({measurements:e,outerSize:s,scrollOffset:t,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=v(()=>{let e=null,s=null;const t=this.calculateRange();return t&&(e=t.startIndex,s=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,t,n,i)=>n===null||i===null?[]:e({startIndex:n,endIndex:i,overscan:s,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,t=e.getAttribute(s);return t?parseInt(t,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const t=this.indexFromElement(e),n=this.measurementsCache[t];if(!n)return;const i=n.key,o=this.elementsCache.get(i);o!==e&&(o&&this.observer.unobserve(o),this.observer.observe(e),this.elementsCache.set(i,e)),e.isConnected&&this.resizeItem(t,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const t=this.measurementsCache[e];if(!t)return;const n=this.itemSizeCache.get(t.key)??t.size,i=s-n;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(t,i,this):t.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(t.index),this.itemSizeCache=new Map(this.itemSizeCache.set(t.key,s)),this.notify(!1))},this.measureElement=e=>{if(!e){this.elementsCache.forEach((s,t)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(t))});return}this._measureElement(e,void 0)},this.getVirtualItems=v(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let n=0,i=e.length;n<i;n++){const o=e[n],h=s[o];t.push(h)}return t},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return S(s[O(0,s.length-1,t=>S(s[t]).start,e)])},this.getOffsetForAlignment=(e,s,t=0)=>{const n=this.getSize(),i=this.getScrollOffset();s==="auto"&&(s=e>=i+n?"end":"start"),s==="center"?e+=(t-n)/2:s==="end"&&(e-=n);const o=this.getTotalSize()+this.options.scrollMargin-n;return Math.max(Math.min(o,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=this.measurementsCache[e];if(!t)return;const n=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(t.end>=i+n-this.options.scrollPaddingEnd)s="end";else if(t.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const o=s==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,s,t.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:t})},this.scrollToIndex=(e,{align:s="auto",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1));let n=0;const i=10,o=c=>{if(!this.targetWindow)return;const a=this.getOffsetForIndex(e,c);if(!a){console.warn("Failed to get offset for index:",e);return}const[u,d]=a;this._scrollToOffset(u,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),f=this.getOffsetForIndex(e,d);if(!f){console.warn("Failed to get offset for index:",e);return}R(f[0],m)||h(d)})},h=c=>{this.targetWindow&&(n++,n<i?this.targetWindow.requestAnimationFrame(()=>o(c)):console.warn(`Failed to scroll to index ${e} after ${i} attempts.`))};o(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let t;if(s.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((e=s[s.length-1])==null?void 0:e.end)??0;else{const n=Array(this.options.lanes).fill(null);let i=s.length-1;for(;i>=0&&n.some(o=>o===null);){const o=s[i];n[o.lane]===null&&(n[o.lane]=o.end),i--}t=Math.max(...n.filter(o=>o!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(l)}}const O=(r,l,e,s)=>{for(;r<=l;){const t=(r+l)/2|0,n=e(t);if(n<s)r=t+1;else if(n>s)l=t-1;else return t}return r>0?r-1:0};function L({measurements:r,outerSize:l,scrollOffset:e,lanes:s}){const t=r.length-1,n=h=>r[h].start;if(r.length<=s)return{startIndex:0,endIndex:t};let i=O(0,t,n,e),o=i;if(s===1)for(;o<t&&r[o].end<e+l;)o++;else if(s>1){const h=Array(s).fill(0);for(;o<t&&h.some(a=>a<e+l);){const a=r[o];h[a.lane]=a.end,o++}const c=Array(s).fill(e+l);for(;i>=0&&c.some(a=>a>=e);){const a=r[i];c[a.lane]=a.start,i--}i=Math.max(0,i-i%s),o=Math.min(t,o+(s-1-o%s))}return{startIndex:i,endIndex:o}}const z=typeof document<"u"?w.useLayoutEffect:w.useEffect;function P(r){const l=w.useReducer(()=>({}),{})[1],e={...r,onChange:(t,n)=>{var i;n?I.flushSync(l):l(),(i=r.onChange)==null||i.call(r,t,n)}},[s]=w.useState(()=>new j(e));return s.setOptions(e),z(()=>s._didMount(),[]),z(()=>s._willUpdate()),s}function N(r){return P({observeElementRect:T,observeElementOffset:k,scrollToFn:W,...r})}export{N as u};