unleash-server 4.22.0-beta.2 → 4.22.0-beta.21

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 (173) hide show
  1. package/dist/lib/addons/feature-event-formatter-md.d.ts +12 -3
  2. package/dist/lib/addons/feature-event-formatter-md.js +135 -31
  3. package/dist/lib/addons/feature-event-formatter-md.js.map +1 -1
  4. package/dist/lib/addons/feature-event-formatter-md.test.d.ts +1 -0
  5. package/dist/lib/addons/feature-event-formatter-md.test.js +483 -0
  6. package/dist/lib/addons/feature-event-formatter-md.test.js.map +1 -0
  7. package/dist/lib/app.js +1 -1
  8. package/dist/lib/app.js.map +1 -1
  9. package/dist/lib/features/export-import-toggles/export-import-permissions.e2e.test.js +1 -1
  10. package/dist/lib/features/export-import-toggles/export-import-permissions.e2e.test.js.map +1 -1
  11. package/dist/lib/openapi/index.d.ts +46 -6
  12. package/dist/lib/openapi/spec/bulk-metrics-schema.d.ts +23 -3
  13. package/dist/lib/openapi/spec/bulk-registration-schema.d.ts +23 -3
  14. package/dist/lib/openapi/spec/bulk-registration-schema.js +15 -3
  15. package/dist/lib/openapi/spec/bulk-registration-schema.js.map +1 -1
  16. package/dist/lib/routes/admin-api/maintenance.d.ts +0 -1
  17. package/dist/lib/routes/admin-api/maintenance.js +0 -8
  18. package/dist/lib/routes/admin-api/maintenance.js.map +1 -1
  19. package/dist/lib/routes/admin-api/project/variants.js +29 -0
  20. package/dist/lib/routes/admin-api/project/variants.js.map +1 -1
  21. package/dist/lib/services/access-service.d.ts +2 -2
  22. package/dist/lib/services/access-service.js.map +1 -1
  23. package/dist/lib/types/experimental.d.ts +1 -2
  24. package/dist/lib/types/experimental.js +1 -2
  25. package/dist/lib/types/experimental.js.map +1 -1
  26. package/dist/migrations/20201216140726-add-last-seen-to-features.js +1 -0
  27. package/dist/migrations/20201216140726-add-last-seen-to-features.js.map +1 -1
  28. package/dist/migrations/20210105083014-add-tag-and-tag-types.js +1 -0
  29. package/dist/migrations/20210105083014-add-tag-and-tag-types.js.map +1 -1
  30. package/dist/migrations/20210119084617-add-addon-table.js +1 -0
  31. package/dist/migrations/20210119084617-add-addon-table.js.map +1 -1
  32. package/dist/migrations/20210212114759-add-session-table.js +1 -0
  33. package/dist/migrations/20210212114759-add-session-table.js.map +1 -1
  34. package/dist/migrations/20210217195834-rbac-tables.js +1 -0
  35. package/dist/migrations/20210217195834-rbac-tables.js.map +1 -1
  36. package/dist/migrations/20210409120136-create-reset-token-table.js +1 -0
  37. package/dist/migrations/20210409120136-create-reset-token-table.js.map +1 -1
  38. package/dist/migrations/20210414141220-fix-misspellings-in-role-descriptions.js +1 -0
  39. package/dist/migrations/20210414141220-fix-misspellings-in-role-descriptions.js.map +1 -1
  40. package/dist/migrations/20210423103647-lowercase-all-emails.js +1 -0
  41. package/dist/migrations/20210423103647-lowercase-all-emails.js.map +1 -1
  42. package/dist/migrations/20210428103923-onboard-projects-to-rbac.js +1 -0
  43. package/dist/migrations/20210428103923-onboard-projects-to-rbac.js.map +1 -1
  44. package/dist/migrations/20210504101429-deprecate-strategies.js +1 -0
  45. package/dist/migrations/20210504101429-deprecate-strategies.js.map +1 -1
  46. package/dist/migrations/20210615115226-migrate-strategies-to-feature-strategies.js +1 -0
  47. package/dist/migrations/20210615115226-migrate-strategies-to-feature-strategies.js.map +1 -1
  48. package/dist/migrations/20210618091331-project-environments-table.js +1 -0
  49. package/dist/migrations/20210618091331-project-environments-table.js.map +1 -1
  50. package/dist/migrations/20210618100913-add-cascade-for-user-feedback.js +1 -0
  51. package/dist/migrations/20210618100913-add-cascade-for-user-feedback.js.map +1 -1
  52. package/dist/migrations/20210624114855-drop-strategies-column-from-features.js +1 -0
  53. package/dist/migrations/20210624114855-drop-strategies-column-from-features.js.map +1 -1
  54. package/dist/migrations/20210624115109-drop-enabled-column-from-features.js +1 -0
  55. package/dist/migrations/20210624115109-drop-enabled-column-from-features.js.map +1 -1
  56. package/dist/migrations/20210625102126-connect-default-project-to-global-environment.js +1 -0
  57. package/dist/migrations/20210625102126-connect-default-project-to-global-environment.js.map +1 -1
  58. package/dist/migrations/20210629130734-add-health-rating-to-project.js +1 -0
  59. package/dist/migrations/20210629130734-add-health-rating-to-project.js.map +1 -1
  60. package/dist/migrations/20210830113948-connect-projects-to-global-envrionments.js +1 -0
  61. package/dist/migrations/20210830113948-connect-projects-to-global-envrionments.js.map +1 -1
  62. package/dist/migrations/20210831072631-add-sort-order-and-type-to-env.js +1 -0
  63. package/dist/migrations/20210831072631-add-sort-order-and-type-to-env.js.map +1 -1
  64. package/dist/migrations/20210907124058-add-dbcritic-indices.js +1 -0
  65. package/dist/migrations/20210907124058-add-dbcritic-indices.js.map +1 -1
  66. package/dist/migrations/20210907124850-add-dbcritic-primary-keys.js +1 -0
  67. package/dist/migrations/20210907124850-add-dbcritic-primary-keys.js.map +1 -1
  68. package/dist/migrations/20210908100701-add-enabled-to-environments.js +1 -0
  69. package/dist/migrations/20210908100701-add-enabled-to-environments.js.map +1 -1
  70. package/dist/migrations/20210909085651-add-protected-field-to-environments.js +1 -0
  71. package/dist/migrations/20210909085651-add-protected-field-to-environments.js.map +1 -1
  72. package/dist/migrations/20210913103159-api-keys-scoping.js +1 -0
  73. package/dist/migrations/20210913103159-api-keys-scoping.js.map +1 -1
  74. package/dist/migrations/20210928082228-connect-default-environment-to-all-existing-projects.js +1 -0
  75. package/dist/migrations/20210928082228-connect-default-environment-to-all-existing-projects.js.map +1 -1
  76. package/dist/migrations/20211004104917-client-metrics-env.js +1 -0
  77. package/dist/migrations/20211004104917-client-metrics-env.js.map +1 -1
  78. package/dist/migrations/20211109103930-add-splash-entry-for-users.js +1 -0
  79. package/dist/migrations/20211109103930-add-splash-entry-for-users.js.map +1 -1
  80. package/dist/migrations/20211126112551-disable-default-environment.js +1 -0
  81. package/dist/migrations/20211126112551-disable-default-environment.js.map +1 -1
  82. package/dist/migrations/20211202120808-add-custom-roles.js +1 -0
  83. package/dist/migrations/20211202120808-add-custom-roles.js.map +1 -1
  84. package/dist/migrations/20220103134659-add-permissions-to-project-roles.js +1 -0
  85. package/dist/migrations/20220103134659-add-permissions-to-project-roles.js.map +1 -1
  86. package/dist/migrations/20220103143843-add-permissions-to-editor-role.js +1 -0
  87. package/dist/migrations/20220103143843-add-permissions-to-editor-role.js.map +1 -1
  88. package/dist/migrations/20220111112804-update-permission-descriptions.js +1 -0
  89. package/dist/migrations/20220111112804-update-permission-descriptions.js.map +1 -1
  90. package/dist/migrations/20220111115613-move-feature-toggle-permission.js +1 -0
  91. package/dist/migrations/20220111115613-move-feature-toggle-permission.js.map +1 -1
  92. package/dist/migrations/20220111120346-roles-unique-name.js +1 -0
  93. package/dist/migrations/20220111120346-roles-unique-name.js.map +1 -1
  94. package/dist/migrations/20220111121010-update-project-for-editor-role.js +1 -0
  95. package/dist/migrations/20220111121010-update-project-for-editor-role.js.map +1 -1
  96. package/dist/migrations/20220111125620-role-permission-empty-string-for-non-environment-type.js +1 -0
  97. package/dist/migrations/20220111125620-role-permission-empty-string-for-non-environment-type.js.map +1 -1
  98. package/dist/migrations/20220224081422-remove-project-column-from-roles.js +1 -0
  99. package/dist/migrations/20220224081422-remove-project-column-from-roles.js.map +1 -1
  100. package/dist/migrations/20220408081222-clean-up-duplicate-foreign-key-role-permission.js +1 -0
  101. package/dist/migrations/20220408081222-clean-up-duplicate-foreign-key-role-permission.js.map +1 -1
  102. package/dist/migrations/20220711084613-add-projects-and-environments-for-addons.js +1 -0
  103. package/dist/migrations/20220711084613-add-projects-and-environments-for-addons.js.map +1 -1
  104. package/dist/migrations/20220808110415-add-projects-foreign-key.js +1 -0
  105. package/dist/migrations/20220808110415-add-projects-foreign-key.js.map +1 -1
  106. package/dist/migrations/20221108114358-add-change-request-permissions.js +1 -0
  107. package/dist/migrations/20221108114358-add-change-request-permissions.js.map +1 -1
  108. package/dist/migrations/20221125185244-change-request-unique-approvals.js +1 -0
  109. package/dist/migrations/20221125185244-change-request-unique-approvals.js.map +1 -1
  110. package/dist/migrations/20221128165141-change-request-min-approvals.js +1 -0
  111. package/dist/migrations/20221128165141-change-request-min-approvals.js.map +1 -1
  112. package/dist/migrations/20221205122253-skip-change-request.js +1 -0
  113. package/dist/migrations/20221205122253-skip-change-request.js.map +1 -1
  114. package/dist/migrations/20221220160345-user-pat-permissions.js +1 -0
  115. package/dist/migrations/20221220160345-user-pat-permissions.js.map +1 -1
  116. package/dist/migrations/20221221144132-service-account-users.js +1 -0
  117. package/dist/migrations/20221221144132-service-account-users.js.map +1 -1
  118. package/dist/migrations/20230125065315-project-stats-table.js +1 -0
  119. package/dist/migrations/20230125065315-project-stats-table.js.map +1 -1
  120. package/dist/migrations/20230127111638-new-project-stats-field.js +1 -0
  121. package/dist/migrations/20230127111638-new-project-stats-field.js.map +1 -1
  122. package/dist/migrations/20230130113337-revert-user-pat-permissions.js +1 -0
  123. package/dist/migrations/20230130113337-revert-user-pat-permissions.js.map +1 -1
  124. package/dist/migrations/20230208084046-project-api-token-permissions.js +1 -0
  125. package/dist/migrations/20230208084046-project-api-token-permissions.js.map +1 -1
  126. package/dist/migrations/20230208093627-assign-project-api-token-permissions-editor.js +1 -0
  127. package/dist/migrations/20230208093627-assign-project-api-token-permissions-editor.js.map +1 -1
  128. package/dist/migrations/20230208093750-assign-project-api-token-permissions-owner.js +1 -0
  129. package/dist/migrations/20230208093750-assign-project-api-token-permissions-owner.js.map +1 -1
  130. package/dist/migrations/20230208093942-assign-project-api-token-permissions-member.js +1 -0
  131. package/dist/migrations/20230208093942-assign-project-api-token-permissions-member.js.map +1 -1
  132. package/dist/migrations/20230222084211-add-login-events-table.js +1 -0
  133. package/dist/migrations/20230222084211-add-login-events-table.js.map +1 -1
  134. package/dist/migrations/20230222154915-create-notiications-table.js +4 -4
  135. package/dist/migrations/20230224093446-drop-createdBy-from-notifications-table.d.ts +2 -0
  136. package/dist/migrations/20230224093446-drop-createdBy-from-notifications-table.js +14 -0
  137. package/dist/migrations/20230224093446-drop-createdBy-from-notifications-table.js.map +1 -0
  138. package/dist/migrations/20230227115320-rename-login-events-table-to-sign-on-log.d.ts +2 -0
  139. package/dist/migrations/20230227115320-rename-login-events-table-to-sign-on-log.js +8 -0
  140. package/dist/migrations/20230227115320-rename-login-events-table-to-sign-on-log.js.map +1 -0
  141. package/dist/migrations/20230227120500-change-display-name-for-variants-per-env-permission.d.ts +2 -0
  142. package/dist/migrations/20230227120500-change-display-name-for-variants-per-env-permission.js +15 -0
  143. package/dist/migrations/20230227120500-change-display-name-for-variants-per-env-permission.js.map +1 -0
  144. package/dist/migrations/20230227123106-add-setting-for-sign-on-log-retention.d.ts +2 -0
  145. package/dist/migrations/20230227123106-add-setting-for-sign-on-log-retention.js +8 -0
  146. package/dist/migrations/20230227123106-add-setting-for-sign-on-log-retention.js.map +1 -0
  147. package/dist/server-dev.js +0 -1
  148. package/dist/server-dev.js.map +1 -1
  149. package/dist/test/e2e/api/admin/maintenance.e2e.test.js +2 -49
  150. package/dist/test/e2e/api/admin/maintenance.e2e.test.js.map +1 -1
  151. package/dist/test/e2e/stores/setting-store.e2e.test.js +1 -1
  152. package/frontend/build/index.html +1 -1
  153. package/frontend/build/static/{CreateProject-b852657c.js → CreateProject-f7ca75e0.js} +1 -1
  154. package/frontend/build/static/{Error-29ef2974.js → Error-2a87926a.js} +1 -1
  155. package/frontend/build/static/{ExpandMore-4b3cbf87.js → ExpandMore-e298a9a3.js} +1 -1
  156. package/frontend/build/static/{FeatureArchiveDialog-f9d8c71d.js → FeatureArchiveDialog-31430c0e.js} +1 -1
  157. package/frontend/build/static/{FeatureMetricsChart-86cc2280.js → FeatureMetricsChart-bcb36dbc.js} +1 -1
  158. package/frontend/build/static/{FeatureViewLazyExport-1366d6bf.js → FeatureViewLazyExport-fe2a9be7.js} +2 -2
  159. package/frontend/build/static/{LazyAdminExport-d9800386.js → LazyAdminExport-9ff8d442.js} +13 -13
  160. package/frontend/build/static/{LazyProjectExport-ef4471a8.js → LazyProjectExport-644ec52e.js} +8 -8
  161. package/frontend/build/static/{NetworkOverview-4b90dc34.js → NetworkOverview-cecb7bdc.js} +1 -1
  162. package/frontend/build/static/{NetworkTraffic-c9de9d5f.js → NetworkTraffic-953679ab.js} +1 -1
  163. package/frontend/build/static/{Playground-ee072216.js → Playground-f8d65d33.js} +1 -1
  164. package/frontend/build/static/{StrategyItemContainer-b65caaa6.js → StrategyItemContainer-b3595995.js} +1 -1
  165. package/frontend/build/static/{chartjs-adapter-date-fns.esm-5c47f5e0.js → chartjs-adapter-date-fns.esm-ad422152.js} +7 -7
  166. package/frontend/build/static/{index-bbbae9a8.js → index-19ee2080.js} +1 -1
  167. package/frontend/build/static/index-1d8518d6.js +392 -0
  168. package/frontend/build/static/{index-031b8ec3.js → index-c5afb04d.js} +1 -1
  169. package/frontend/build/static/{unknownify-88f06eea.js → unknownify-21e26f46.js} +1 -1
  170. package/frontend/build/static/{useProjectRole-d8edb83e.js → useProjectRole-9a28ceaf.js} +1 -1
  171. package/frontend/package.json +3 -3
  172. package/package.json +2 -2
  173. package/frontend/build/static/index-193ec8c2.js +0 -392
@@ -1,4 +1,4 @@
1
- import{c as Vi,j as m,r as I,u as ke,C as j,B as Ss,s as $,a as K,T as se,b as Gf,d as Bt,e as Fa,f as B,g as Qf,S as Jf,h as Yf,i as _f,k as Xf,F as je,I as Zf,l as Lo,m as Ai,n as Wa,P as Va,o as eu,A as Mn,p as Hi,q as tu,t as Ha,v as iu,w as _r,x as er,y as mn,z as tr,D as nu,E as su,G as ru,H as ou,J as lu,K as au,L as za,M as hu,N as ir,O as Eo,Q as cu,R as fu,U as uu,V as du,W as Cs,X as pu,Y as mu,Z as gu,_ as yu,$ as Xr,a0 as bu,a1 as xu,a2 as $a,a3 as wu,a4 as On,a5 as vu,a6 as ku,a7 as Su,a8 as Cu,a9 as qa,aa as Io,ab as No,ac as wi,ad as nr,ae as Au,af as sr,ag as Mu,ah as ja,ai as Ou,aj as Du,ak as Tu,al as Pu,am as Ru}from"./index-193ec8c2.js";import{S as Bu}from"./StrategyItemContainer-b65caaa6.js";import{E as Lu}from"./Error-29ef2974.js";const os=Vi(m("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined"),Eu=Vi(m("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"CheckCircleOutline"),Iu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),Nu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"Help"),Fu=Vi(m("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"WarningOutlined"),Wu=n=>I.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84818 0.184159C8.56367 -0.0789547 8.1234 -0.0575747 7.86482 0.231912C7.60623 0.521399 7.62724 0.96937 7.91175 1.23248C9.48292 2.68551 10.6076 4.74934 10.6076 7C10.6076 9.25066 9.48292 11.3145 7.91175 12.7675C7.62724 13.0306 7.60623 13.4786 7.86482 13.7681C8.1234 14.0576 8.56367 14.079 8.84818 13.8158C10.6396 12.1592 11.9998 9.73702 11.9998 7C11.9998 4.26298 10.6396 1.84083 8.84818 0.184159ZM6.04105 2.23302C6.29109 1.93586 6.73054 1.90121 7.02259 2.15563C8.33146 3.29586 9.35426 5.02309 9.35426 6.99995C9.35426 8.97682 8.33145 10.7039 7.02259 11.8441C6.73054 12.0986 6.29109 12.0639 6.04105 11.7668C5.79101 11.4696 5.82506 11.0225 6.11711 10.768C7.19425 9.82969 7.96199 8.46967 7.96199 6.99995C7.96199 5.53021 7.19423 4.17007 6.11711 3.23173C5.82506 2.97731 5.79101 2.53017 6.04105 2.23302ZM6.56908 7.00015C6.56908 8.56492 5.3224 9.83342 3.78454 9.83342C2.24668 9.83342 1 8.56492 1 7.00015C1 5.43539 2.24668 4.16689 3.78454 4.16689C5.3224 4.16689 6.56908 5.43539 6.56908 7.00015Z",fill:"currentColor"})),Vu=n=>I.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84835 0.184159C8.56384 -0.0789547 8.12358 -0.0575747 7.86499 0.231912C7.6064 0.521399 7.62741 0.96937 7.91192 1.23248C9.4831 2.68551 10.6078 4.74934 10.6078 7C10.6078 7.40738 10.5709 7.80863 10.5012 8.20125L11.6597 9.35972C11.8783 8.60937 12 7.81877 12 7C12 4.26298 10.6397 1.84083 8.84835 0.184159ZM9.35443 6.99995L9.35418 7.0542L7.63252 5.33255C7.30901 4.52372 6.76993 3.80029 6.11728 3.23173C5.82523 2.97731 5.79118 2.53017 6.04122 2.23302C6.29127 1.93586 6.73072 1.90121 7.02276 2.15563C8.33164 3.29586 9.35443 5.02309 9.35443 6.99995ZM7.57827 8.79752L6.48307 7.70233C6.17606 8.92745 5.08437 9.83342 3.78471 9.83342C2.24685 9.83342 1.00017 8.56492 1.00017 7.00015C1.00017 5.69492 1.8676 4.59583 3.04789 4.26714L0.458225 1.67748C0.172794 1.39205 0.178843 0.923223 0.471736 0.63033C0.764629 0.337437 1.23345 0.331388 1.51889 0.616819L13.2132 12.3111C13.4986 12.5965 13.4926 13.0654 13.1997 13.3583C12.9068 13.6511 12.4379 13.6572 12.1525 13.3718L10.556 11.7753C10.0694 12.539 9.48623 13.2259 8.84835 13.8158C8.56384 14.079 8.12358 14.0576 7.86499 13.7681C7.6064 13.4786 7.62741 13.0306 7.91192 12.7675C8.54021 12.1865 9.0971 11.5078 9.53922 10.7585L8.62356 9.84281C8.20906 10.6195 7.64861 11.2989 7.02276 11.8441C6.73072 12.0986 6.29127 12.0639 6.04122 11.7668C5.79118 11.4696 5.82523 11.0225 6.11728 10.768C6.73471 10.2302 7.25048 9.55374 7.57827 8.79752Z",fill:"currentColor"})),Dn=({enabled:n,label:e,showIcon:t=!0})=>{const i=ke(),s=m(j,{condition:n==="unknown"||n==="unevaluated",show:m(Fu,{color:"warning",fontSize:"inherit"}),elseShow:m(j,{condition:typeof n=="boolean"&&Boolean(n),show:m(Wu,{color:i.palette.success.main,strokeWidth:"0.25"}),elseShow:m(Vu,{color:i.palette.error.main,strokeWidth:"0.25"})})});return m(j,{condition:n==="unknown"||n==="unevaluated",show:m(Ss,{icon:t?s:void 0,color:"warning",children:e}),elseShow:m(j,{condition:typeof n=="boolean"&&Boolean(n),show:m(Ss,{color:"success",icon:t?s:void 0,children:e}),elseShow:m(Ss,{color:"error",icon:t?s:void 0,children:e})})})},Hu=$(K)(({theme:n})=>({display:"flex",alignItems:"center",padding:n.spacing(1,2)})),zu=$(K)(()=>({marginRight:"auto"})),$u=({feature:n})=>{const[e,t]=(()=>{var i;return n!=null&&n.isEnabled?[!0,"True"]:((i=n==null?void 0:n.strategies)==null?void 0:i.result)==="unknown"?["unknown","Unknown"]:[!1,"False"]})();return m(Hu,{children:m(zu,{"data-loading":!0,children:m(Dn,{enabled:e,label:t,showIcon:e!=="unknown"})})})},qu=$("div")(({theme:n})=>({padding:n.spacing(4),maxWidth:"400px"})),As=$(se)(({theme:n})=>({marginBottom:n.spacing(2)})),ju=$(Iu)(({theme:n})=>({color:n.palette.success.main})),Uu=({variants:n,selectedVariant:e})=>{const t=ke(),i=I.useMemo(()=>n.map(c=>({name:c.name,weight:`${Gf(c.weight)}%`,selected:c.name===e})),[n,e]),s=I.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{getTableProps:r,getTableBodyProps:o,headerGroups:l,rows:a,prepareRow:h}=Bt.useTable({initialState:s,columns:Ku,data:i,sortTypes:Fa,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},Bt.useGlobalFilter,Bt.useSortBy);return B(qu,{children:[m(As,{variant:"subtitle2",children:"Variant Information"}),m(As,{variant:"body2",children:"The following table shows the variants defined on this feature toggle and the variant result based on your context configuration."}),m(As,{variant:"body2",children:'If you include "userId" or "sessionId" in your context, the variant will be the same every time because unleash uses these properties to ensure that the user receives the same experience.'}),B(Qf,{...r(),rowHeight:"dense",children:[m(Jf,{headerGroups:l}),m(Yf,{...o(),children:a.map(c=>{let f={};return c.original.selected||(f.color=t.palette.text.secondary),h(c),m(_f,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>m(Xf,{...u.getCellProps(),style:f,children:u.render("Cell")}))})})})]})]})},Ku=[{id:"Icon",Cell:({row:{original:{selected:n}}})=>m(je,{children:m(j,{condition:n,show:m(Zf,{icon:m(ju,{})})})}),maxWidth:25,disableGlobalFilter:!0},{Header:"Name",accessor:"name",searchable:!0,Cell:({row:{original:{name:n}}})=>m(Lo,{children:n}),maxWidth:175,width:175},{Header:"Weight",accessor:"weight",sortType:"alphanumeric",searchable:!0,maxWidth:75,Cell:({row:{original:{weight:n}}})=>m(Lo,{children:n})}],Gu=$("div")(()=>({maxWidth:"100%",display:"flex",alignItems:"center",wordBreak:"break-all"})),Qu=({variant:n,variants:e,feature:t,isEnabled:i})=>{const s=ke(),[r,o]=I.useState(null),l=c=>o(c.currentTarget),a=()=>o(null),h=Boolean(r);return B(Gu,{children:[n,m(j,{condition:Boolean(e)&&e.length>0&&i,show:B(je,{children:[m(Ai,{onClick:l,children:m(Wa,{})}),m(Va,{open:h,id:`${t}-result-variants`,PaperProps:{sx:{borderRadius:`${s.shape.borderRadiusLarge}px`}},onClose:a,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:-320},children:m(Uu,{variants:e,selectedVariant:n})})]})})]})},Ua=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress","userWithId"];function Ka(n){return n===void 0?!0:Object.values(n).every(e=>e&&typeof e=="object"?Ka(e):e===null)}const Fo=n=>{var e,t;return(t=(e=n.strategies)==null?void 0:e.data)==null?void 0:t.find(i=>!Ua.includes(i.name))},Ju=n=>{var e,t;return!((t=(e=n.strategies)==null?void 0:e.data)!=null&&t.find(i=>Ua.includes(i.name)))},Yu=$("div")({display:"flex",justifyContent:"space-between",width:"100%"}),_u=$("div")(({theme:n})=>({display:"inline-flex",alignItems:"center",gap:n.spacing(1.5),marginTop:n.spacing(1.5)})),Wo=$("div")(({theme:n})=>({margin:n.spacing(1,0)})),Xu=$("div")(({theme:n})=>({margin:n.spacing(1,.5)})),Zu=$(se)(({theme:n})=>({fontWeight:600,padding:n.spacing(.5)})),ed=$(Ai)({textAlign:"right"}),td=({feature:n,input:e,onClose:t})=>{var c;const i=ke(),[s,r,o]=(()=>n.isEnabled?[`This feature toggle is True in ${e==null?void 0:e.environment} because `,"at least one strategy is True",i.palette.success.main]:n.isEnabledInCurrentEnvironment?Ju(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"no strategies could be fully evaluated",i.palette.warning.main]:Fo(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"not all strategies could be fully evaluated",i.palette.warning.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"all strategies are either False or could not be fully evaluated",i.palette.error.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"the environment is disabled",i.palette.error.main])(),l=Ka(e==null?void 0:e.context)?"You did not provide a value for your context field in step 2 of the configuration":void 0,a=Fo(n)?"This feature uses custom strategies. Custom strategies can't be evaluated, so they will be marked accordingly.":void 0,h=t&&(f=>{f.stopPropagation(),t()});return B(je,{children:[B(Yu,{children:[B(_u,{children:[m(Zu,{variant:"subtitle1",children:n.name}),m(j,{condition:((c=n==null?void 0:n.strategies)==null?void 0:c.result)!=="unknown",show:()=>m(Dn,{enabled:n.isEnabled,label:n.isEnabled?"True":"False"}),elseShow:()=>m(Dn,{enabled:"unknown",label:"Unknown",showIcon:!1})})]}),m(ed,{onClick:h,children:m(eu,{})})]}),B(Xu,{children:[m(se,{variant:"body1",component:"span",children:s}),m(se,{variant:"subtitle1",color:o,component:"span",children:r}),m(se,{variant:"body1",component:"span",children:"."})]}),m(j,{condition:Boolean(l),show:m(Wo,{children:m(Mn,{color:"info",children:l})})}),m(j,{condition:Boolean(a),show:m(Wo,{children:m(Mn,{severity:"warning",color:"info",children:a})})})]})},id=$("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.error.main})),nd=({constraint:n,input:e})=>B(id,{children:[m(os,{style:{marginRight:"0.25rem"}}),m(se,{variant:"body2",children:(()=>{const i=e==null?void 0:e.context[n.contextName];return i?`Constraint not met – the value in the context: { ${i} } is not ${n.operator} ${n.contextName}`:`Constraint not met – no value was specified for ${n.contextName}`})()})]}),sd=$(Eu)(({theme:n})=>({color:n.palette.success.main})),rd=$("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.success.main})),od=()=>B(rd,{children:[m(sd,{style:{marginRight:"0.25rem"}}),m(se,{variant:"body2",children:"Constraint met by value in context"})]}),ld=$("div")(()=>({width:"100%",display:"flex",flexDirection:"column"})),Ga=({constraints:n,input:e})=>n?m(ld,{children:n==null?void 0:n.map((t,i)=>B(I.Fragment,{children:[m(j,{condition:i>0,show:m(Hi,{text:"AND"})}),m(tu,{constraint:t,compact:!0,renderAfter:m(j,{condition:t.result,show:m(od,{}),elseShow:m(nd,{input:e,constraint:t})})})]},Ha(t)))}):null,ad=$("div")(({theme:n})=>({color:n.palette.error.main,display:"inline-flex",justifyContent:"center",marginLeft:"auto",gap:n.spacing(1)})),hd=({segments:n,input:e})=>n?m(je,{children:n.map((t,i)=>B(I.Fragment,{children:[m(iu,{segment:t,constraintList:m(Ga,{constraints:t.constraints,input:e}),headerContent:m(j,{condition:!Boolean(t.result),show:B(ad,{children:[m(se,{variant:"subtitle2",sx:{pt:.25},children:"segment is false"}),m("span",{children:m(os,{})})]})}),isExpanded:!0}),m(j,{condition:i>=0&&n.length>1&&i!==n.length-1,show:m(Hi,{text:"AND"})})]},t.id))}):null,cd=$("div",{shouldForwardProp:n=>n!=="showReason"})(({theme:n,showReason:e})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.dividerAlternative}`,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.spacing(2),opacity:e?.9:1,backgroundColor:e?n.palette.background.paper:"inherit"})),fd=$("div")(({theme:n})=>({flexDirection:"column"})),ud=$(_r)(({theme:n})=>({margin:n.spacing(.5)})),dd=$("p")(({theme:n})=>({display:"inline",margin:n.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),Ms=({value:n,text:e,input:t,showReason:i=!1})=>{const s=ke(),r=t==="no value"?"error":"neutral",o=`value does not match any ${e}`;return B(cd,{showReason:i,children:[m(se,{variant:"subtitle1",color:s.palette[r].main,children:`${t}`}),B(fd,{children:[m(j,{condition:Boolean(i),show:m(se,{variant:"subtitle1",color:s.palette.error.main,children:o})}),m(j,{condition:n.length===0,show:B("p",{children:["No ",e,"s added yet."]}),elseShow:B("div",{children:[B(dd,{children:[n.length," ",n.length>1?`${e}s`:e," will get access."]}),n.map(l=>m(ud,{label:m(er,{maxWidth:"300",text:l.toString(),maxLength:50})},l))]})})]}),m(j,{condition:Boolean(i),show:m(os,{color:"error"}),elseShow:m("div",{})})]})},Qa=$(K)(({theme:n})=>({width:"auto",height:"auto",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.dividerAlternative}`})),ct=n=>{switch(n.toUpperCase()){case"USERIDS":return"userId";case"IPS":return"remoteAddress";default:return n}},pd=({parameters:n,constraints:e,input:t})=>m(je,{children:Object.keys(n).map(i=>{var s,r,o,l,a,h,c,f;switch(i){case"rollout":case"Rollout":const u=tr(n[i]);return B(Qa,{sx:{display:"flex",alignItems:"center"},children:[m(K,{sx:{mr:"1rem"},children:m(nu,{percentage:u,size:"2rem"})}),B("div",{children:[m(_r,{color:"success",variant:"outlined",size:"small",label:`${u}%`})," ","of your base"," ",e.length>0?"who match constraints":""," ","is included."]})]},i);case"userIds":case"UserIds":const d=mn(n[i]);return m(Ms,{value:d,text:"user",input:Boolean((s=t==null?void 0:t.context)==null?void 0:s[ct(i)])?(r=t==null?void 0:t.context)==null?void 0:r[ct(i)]:"no value",showReason:Boolean((o=t==null?void 0:t.context)==null?void 0:o[ct(i)])?!d.includes((l=t==null?void 0:t.context)==null?void 0:l[ct(i)]):void 0},i);case"hostNames":case"HostNames":const p=mn(n[i]);return m(Ms,{value:p,text:"host",input:"no value",showReason:void 0},i);case"IPs":const y=mn(n[i]);return m(Ms,{value:y,text:"IP",input:Boolean((a=t==null?void 0:t.context)==null?void 0:a[ct(i)])?(h=t==null?void 0:t.context)==null?void 0:h[ct(i)]:"no value",showReason:Boolean((c=t==null?void 0:t.context)==null?void 0:c[ct(i)])?!y.includes((f=t==null?void 0:t.context)==null?void 0:f[ct(i)]):void 0},i);case"stickiness":case"groupId":return null;default:return null}})}),md=$(K)(({theme:n})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.dividerAlternative}`,display:"flex",flexDirection:"row",alignItems:"center",gap:2})),ci=({text:n,input:e=null,isRequired:t=!1})=>{const i=ke(),s=e===null?"error":"neutral",r=t&&e===null;return B(md,{children:[m(se,{variant:"subtitle1",color:i.palette[s].main,sx:{minWidth:118},children:`${e===null?"no value":e}`}),m(K,{sx:{flexGrow:1,flexDirection:"column"},children:m(K,{sx:{flexGrow:1},children:m(j,{condition:Boolean(r),show:B(je,{children:[m(se,{component:"span",color:i.palette.error.main,children:" required parameter "}),m(er,{maxWidth:"300",text:n,maxLength:50}),m(se,{component:"span",color:i.palette.error.main,children:" is not set "})]}),elseShow:B(je,{children:[m(se,{component:"span",color:"text.disabled",children:" set on parameter "}),m(er,{maxWidth:"300",text:n,maxLength:50})]})})})}),m(j,{condition:Boolean(r),show:m(os,{color:"error"}),elseShow:m("div",{})})]})},gd=({strategyName:n,parameters:e})=>{const{strategies:t}=su(),i=t.find(r=>r.name===n);if(!(i!=null&&i.editable))return null;const s=i==null?void 0:i.parameters.map(r=>{const o=e[r.name],l=r.required;switch(r==null?void 0:r.type){case"list":const a=mn(o);return m(ci,{isRequired:l,text:r.name,input:(a==null?void 0:a.length)>0?a.join(", "):null});case"percentage":const h=tr(o),c=!(o===void 0||o===""||h<0||h>100);return m(ci,{text:r.name,isRequired:l,input:c?`${h}%`:void 0});case"boolean":const f=["true","false"].includes(o)?o:void 0;return m(ci,{isRequired:l,text:r.name,input:o!==void 0?f:void 0});case"string":const u=ru(o);return m(ci,{text:r.name,isRequired:l,input:u!==void 0?u:void 0});case"number":const d=!(o===void 0||o===""),p=tr(o);return m(ci,{text:r.name,isRequired:l,input:d?`${p}`:void 0});case"default":return null}return null});return m(je,{children:s.map((r,o)=>B(I.Fragment,{children:[m(j,{condition:o>0,show:m(Hi,{text:"AND"})}),r]},o))})},yd=$("div")(({theme:n})=>({padding:n.spacing(0)})),bd=({strategyResult:n,input:e})=>{const{name:t,constraints:i,segments:s,parameters:r}=n,{uiConfig:o}=ou(),l=Boolean(o.flags.SE)&&Boolean(s&&s.length>0),a=Boolean(i&&(i==null?void 0:i.length)>0),h=t!=="default"&&Object.keys(lu).includes(t),c=Object.keys(r).length>0&&n.result.evaluationStatus==="incomplete";if(!r)return null;const f=[l&&m(hd,{segments:s,input:e}),a&&m(Ga,{constraints:i,input:e}),h&&m(pd,{parameters:r,constraints:i,input:e}),c&&m(gd,{strategyName:t,parameters:r}),t==="default"&&B(Qa,{sx:{width:"100%"},children:["The standard strategy is"," ",m(_r,{variant:"outlined",size:"small",color:"success",label:"ON"})," ","for all users."]})].filter(Boolean);return m(yd,{children:f.map((u,d)=>B(I.Fragment,{children:[m(j,{condition:d>0,show:m(Hi,{text:"AND"})}),u]},d))})},xd=({strategy:n,input:e,index:t})=>{const{result:i}=n,s=ke(),r=i.evaluationStatus==="incomplete"?"Unevaluated":i.enabled?"True":"False";return m(Bu,{style:{borderColor:i.enabled?s.palette.success.main:"none"},strategy:{...n,id:`${Ha(n)}`},orderNumber:t+1,actions:m(Dn,{showIcon:!1,enabled:i.enabled,label:r}),children:m(bd,{strategyResult:n,input:e,percentageFill:s.palette.tertiary.light})})},wd=$("div")(({theme:n})=>({display:"flex",padding:"0, 4px",flexDirection:"column",borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.warning.border}`})),vd=$("div")(({theme:n})=>({padding:n.spacing(1,.5)})),kd=$(Mn)(({theme:n})=>({border:"0!important",borderBottomLeftRadius:0,borderBottomRightRadius:0,borderBottom:`1px solid ${n.palette.warning.border}!important`})),Ja=({strategies:n,input:e})=>m(j,{condition:n.length>0,show:B(je,{children:[m(se,{variant:"subtitle1",sx:{mt:2,ml:1,mb:2,color:"text.secondary"},children:`Strategies (${n==null?void 0:n.length})`}),m(K,{sx:{width:"100%"},children:n==null?void 0:n.map((t,i)=>B(I.Fragment,{children:[m(j,{condition:i>0,show:m(Hi,{text:"OR"})}),m(xd,{strategy:t,index:i,input:e},t.id)]},t.id))})]})}),Sd=({strategies:n,input:e})=>B(wd,{sx:{pb:1,mt:2},children:[B(kd,{severity:"info",color:"warning",children:["If environment was enabled, then this feature toggle would be"," ",n!=null&&n.result?"TRUE":"FALSE"," with strategies evaluated like so:"," "]}),m(vd,{sx:{p:2.5},children:m(Ja,{strategies:(n==null?void 0:n.data)||[],input:e})})]}),Cd=({feature:n,input:e})=>{var t,i,s,r;return B(je,{children:[m(j,{condition:((i=(t=n==null?void 0:n.strategies)==null?void 0:t.data)==null?void 0:i.length)===0,show:m(Mn,{severity:"warning",sx:{mt:2},children:"There are no strategies added to this feature toggle in selected environment."})}),m(j,{condition:!n.isEnabledInCurrentEnvironment&&Boolean((s=n==null?void 0:n.strategies)==null?void 0:s.data),show:m(Sd,{strategies:n==null?void 0:n.strategies,input:e}),elseShow:m(Ja,{strategies:((r=n==null?void 0:n.strategies)==null?void 0:r.data)||[],input:e})})]})},Ad=$("div")(({theme:n})=>({alignItems:"flex-end",color:n.palette.tertiary.main})),Md=({feature:n,input:e})=>{const[t,i]=I.useState(!1),s=I.useRef(null),r=()=>{i(!t)};return n?B(Ad,{children:[m(Ai,{onClick:r,children:m(Wa,{ref:s})}),B(Va,{open:t,onClose:()=>i(!1),anchorEl:s.current,PaperProps:{sx:o=>({display:"flex",flexDirection:"column",padding:o.spacing(6),width:728,maxWidth:"100%",height:"auto",overflowY:"auto",backgroundColor:o.palette.tertiary.light,borderRadius:o.shape.borderRadius})},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:[m(td,{feature:n,input:e,onClose:()=>i(!1)}),m(Cd,{feature:n,input:e})]})]}):null},Od={id:"name"},{value:Vo,setValue:Dd}=au("PlaygroundResultsTable:v1",Od),Td=({features:n,input:e,loading:t})=>{const[i,s]=za(),r=hu(t),[o,l]=I.useState(i.get("search")||""),a=ke(),h=ir(a.breakpoints.down("sm")),c=ir(a.breakpoints.down("md")),f=I.useMemo(()=>[{Header:"Name",accessor:"name",searchable:!0,minWidth:160,Cell:({value:v,row:{original:O}})=>m(Eo,{title:v,to:`/projects/${O==null?void 0:O.projectId}/features/${v}`})},{Header:"Project ID",accessor:"projectId",sortType:"alphanumeric",filterName:"projectId",searchable:!0,maxWidth:170,Cell:({value:v})=>m(Eo,{title:v,to:`/projects/${v}`})},{Header:"Variant",id:"variant",accessor:"variant.name",sortType:"alphanumeric",filterName:"variant",searchable:!0,maxWidth:200,Cell:({value:v,row:{original:{variant:O,feature:N,variants:P,isEnabled:E}}})=>m(Qu,{variant:O!=null&&O.enabled?v:"",variants:P,feature:N,isEnabled:E})},{id:"isEnabled",Header:"isEnabled",filterName:"isEnabled",accessor:v=>{var O;return v!=null&&v.isEnabled?"true":((O=v==null?void 0:v.strategies)==null?void 0:O.result)==="unknown"?"unknown":"false"},Cell:({row:v})=>m($u,{feature:v.original}),sortType:"playgroundResultState",maxWidth:120,sortInverted:!0},{Header:"",maxWidth:70,id:"info",Cell:({row:v})=>m(Md,{feature:v.original,input:e})}],[e]),{data:u,getSearchText:d,getSearchContext:p}=cu(f,o,n||[]),y=I.useMemo(()=>t?Array(5).fill({name:"Feature name",projectId:"FeatureProject",variant:{name:"FeatureVariant",variants:[]},enabled:!0}):u,[u,t]),[b]=I.useState(()=>({sortBy:[{id:i.get("sort")||Vo.id,desc:i.has("order")?i.get("order")==="desc":Vo.desc}]})),{headerGroups:x,rows:k,state:{sortBy:M},prepareRow:C,setHiddenColumns:S}=Bt.useTable({initialState:b,columns:f,data:y,sortTypes:Fa,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:fu}},Bt.useGlobalFilter,Bt.useFlexLayout,Bt.useSortBy);return uu([{condition:h,columns:["variant"]},{condition:c,columns:["projectId"]}],S,f),I.useEffect(()=>{if(t)return;const v=Object.fromEntries(i);v.sort=M[0].id,M[0].desc?v.order="desc":v.order&&delete v.order,o?v.search=o:delete v.search,s(v,{replace:!0}),Dd({id:M[0].id,desc:M[0].desc||!1})},[t,M,o]),B(je,{children:[B(K,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[m(se,{variant:"subtitle1",sx:{ml:1},children:n!==void 0&&!t?`Results (${k.length<y.length?`${k.length} of ${y.length}`:y.length})`:"Results"}),m(du,{initialValue:o,onChange:l,hasFilters:!0,getSearchContext:p,disabled:t,containerStyles:{marginLeft:"1rem",maxWidth:"400px"}})]}),m(j,{condition:!t&&!y,show:()=>m(Cs,{children:y===void 0?"None of the feature toggles were evaluated yet.":"No results found."}),elseShow:()=>B(K,{ref:r,children:[m(pu,{value:d(o),children:m(mu,{rows:k,headerGroups:x,prepareRow:C})}),m(j,{condition:y.length===0&&(o==null?void 0:o.length)>0,show:B(Cs,{children:["No feature toggles found matching “",o,"”"]})}),m(j,{condition:y&&y.length===0&&!o,show:m(Cs,{children:"No features toggles to display"})})]})})]})},Pd=()=>{const{makeRequest:n,createRequest:e,errors:t,loading:i}=gu({propagateErrors:!0}),s="api/admin/playground";return{evaluatePlayground:async o=>{const a=e(s,{method:"POST",body:JSON.stringify(o)});try{return(await n(a.caller,a.id)).json()}catch(h){throw h}},errors:t,loading:i}},Rd=$("div")(({style:n,theme:e})=>({width:"25px",height:"25px",borderRadius:"50%",color:e.palette.text.tertiaryContrast,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",...n})),ls=({style:n,children:e,type:t})=>{const i=ke(),s={backgroundColor:i.palette.primary.main};return t==="secondary"&&(s.backgroundColor=i.palette.tertiary.dark),m(Rd,{style:{...s,...n},children:e})},Bd=n=>!n||n.length===0||n.length===1&&n[0]==="*"?"*":Array.isArray(n)?n:[n],Ld=n=>{const e=Ya(n);return e.length>0?e[0]:""},Ya=n=>n.filter(({enabled:e})=>Boolean(e)).sort((e,t)=>e.sortOrder-t.sortOrder).map(({name:e})=>e),Ed=(n,e)=>n?"100%":e&&!n?"65%":"50%";function rr(n,e,t){var i,s,r,o,l;e==null&&(e=100);function a(){var c=Date.now()-o;c<e&&c>=0?i=setTimeout(a,e-c):(i=null,t||(l=n.apply(r,s),r=s=null))}var h=function(){r=this,s=arguments,o=Date.now();var c=t&&!i;return i||(i=setTimeout(a,e)),c&&(l=n.apply(r,s),r=s=null),l};return h.clear=function(){i&&(clearTimeout(i),i=null)},h.flush=function(){i&&(l=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},h}rr.debounce=rr;var Id=rr;class q{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),_e.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),_e.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new vi(this),r=new vi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new vi(this,e)}iterRange(e,t=this.length){return new _a(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Xa(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?q.empty:e.length<=32?new re(e):_e.from(re.split(e,[]))}}class re extends q{constructor(e,t=Nd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Fd(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new re(Ho(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=gn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new re(l,o.length+r.length));else{let a=l.length>>1;i.push(new re(l.slice(0,a)),new re(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);let s=gn(this.text,gn(i.text,Ho(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new re(s,r):_e.from(re.split(s,[]),r)}sliceString(e,t=this.length,i=`
1
+ import{c as Vi,j as m,r as I,u as ke,C as j,B as Ss,s as $,a as K,T as se,b as Gf,d as Bt,e as Fa,f as B,g as Qf,S as Jf,h as Yf,i as _f,k as Xf,F as je,I as Zf,l as Lo,m as Ai,n as Wa,P as Va,o as eu,A as Mn,p as Hi,q as tu,t as Ha,v as iu,w as _r,x as er,y as mn,z as tr,D as nu,E as su,G as ru,H as ou,J as lu,K as au,L as za,M as hu,N as ir,O as Eo,Q as cu,R as fu,U as uu,V as du,W as Cs,X as pu,Y as mu,Z as gu,_ as yu,$ as Xr,a0 as bu,a1 as xu,a2 as $a,a3 as wu,a4 as On,a5 as vu,a6 as ku,a7 as Su,a8 as Cu,a9 as qa,aa as Io,ab as No,ac as wi,ad as nr,ae as Au,af as sr,ag as Mu,ah as ja,ai as Ou,aj as Du,ak as Tu,al as Pu,am as Ru}from"./index-1d8518d6.js";import{S as Bu}from"./StrategyItemContainer-b3595995.js";import{E as Lu}from"./Error-2a87926a.js";const os=Vi(m("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}),"CancelOutlined"),Eu=Vi(m("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"CheckCircleOutline"),Iu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),Nu=Vi(m("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"}),"Help"),Fu=Vi(m("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"WarningOutlined"),Wu=n=>I.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84818 0.184159C8.56367 -0.0789547 8.1234 -0.0575747 7.86482 0.231912C7.60623 0.521399 7.62724 0.96937 7.91175 1.23248C9.48292 2.68551 10.6076 4.74934 10.6076 7C10.6076 9.25066 9.48292 11.3145 7.91175 12.7675C7.62724 13.0306 7.60623 13.4786 7.86482 13.7681C8.1234 14.0576 8.56367 14.079 8.84818 13.8158C10.6396 12.1592 11.9998 9.73702 11.9998 7C11.9998 4.26298 10.6396 1.84083 8.84818 0.184159ZM6.04105 2.23302C6.29109 1.93586 6.73054 1.90121 7.02259 2.15563C8.33146 3.29586 9.35426 5.02309 9.35426 6.99995C9.35426 8.97682 8.33145 10.7039 7.02259 11.8441C6.73054 12.0986 6.29109 12.0639 6.04105 11.7668C5.79101 11.4696 5.82506 11.0225 6.11711 10.768C7.19425 9.82969 7.96199 8.46967 7.96199 6.99995C7.96199 5.53021 7.19423 4.17007 6.11711 3.23173C5.82506 2.97731 5.79101 2.53017 6.04105 2.23302ZM6.56908 7.00015C6.56908 8.56492 5.3224 9.83342 3.78454 9.83342C2.24668 9.83342 1 8.56492 1 7.00015C1 5.43539 2.24668 4.16689 3.78454 4.16689C5.3224 4.16689 6.56908 5.43539 6.56908 7.00015Z",fill:"currentColor"})),Vu=n=>I.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},I.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.84835 0.184159C8.56384 -0.0789547 8.12358 -0.0575747 7.86499 0.231912C7.6064 0.521399 7.62741 0.96937 7.91192 1.23248C9.4831 2.68551 10.6078 4.74934 10.6078 7C10.6078 7.40738 10.5709 7.80863 10.5012 8.20125L11.6597 9.35972C11.8783 8.60937 12 7.81877 12 7C12 4.26298 10.6397 1.84083 8.84835 0.184159ZM9.35443 6.99995L9.35418 7.0542L7.63252 5.33255C7.30901 4.52372 6.76993 3.80029 6.11728 3.23173C5.82523 2.97731 5.79118 2.53017 6.04122 2.23302C6.29127 1.93586 6.73072 1.90121 7.02276 2.15563C8.33164 3.29586 9.35443 5.02309 9.35443 6.99995ZM7.57827 8.79752L6.48307 7.70233C6.17606 8.92745 5.08437 9.83342 3.78471 9.83342C2.24685 9.83342 1.00017 8.56492 1.00017 7.00015C1.00017 5.69492 1.8676 4.59583 3.04789 4.26714L0.458225 1.67748C0.172794 1.39205 0.178843 0.923223 0.471736 0.63033C0.764629 0.337437 1.23345 0.331388 1.51889 0.616819L13.2132 12.3111C13.4986 12.5965 13.4926 13.0654 13.1997 13.3583C12.9068 13.6511 12.4379 13.6572 12.1525 13.3718L10.556 11.7753C10.0694 12.539 9.48623 13.2259 8.84835 13.8158C8.56384 14.079 8.12358 14.0576 7.86499 13.7681C7.6064 13.4786 7.62741 13.0306 7.91192 12.7675C8.54021 12.1865 9.0971 11.5078 9.53922 10.7585L8.62356 9.84281C8.20906 10.6195 7.64861 11.2989 7.02276 11.8441C6.73072 12.0986 6.29127 12.0639 6.04122 11.7668C5.79118 11.4696 5.82523 11.0225 6.11728 10.768C6.73471 10.2302 7.25048 9.55374 7.57827 8.79752Z",fill:"currentColor"})),Dn=({enabled:n,label:e,showIcon:t=!0})=>{const i=ke(),s=m(j,{condition:n==="unknown"||n==="unevaluated",show:m(Fu,{color:"warning",fontSize:"inherit"}),elseShow:m(j,{condition:typeof n=="boolean"&&Boolean(n),show:m(Wu,{color:i.palette.success.main,strokeWidth:"0.25"}),elseShow:m(Vu,{color:i.palette.error.main,strokeWidth:"0.25"})})});return m(j,{condition:n==="unknown"||n==="unevaluated",show:m(Ss,{icon:t?s:void 0,color:"warning",children:e}),elseShow:m(j,{condition:typeof n=="boolean"&&Boolean(n),show:m(Ss,{color:"success",icon:t?s:void 0,children:e}),elseShow:m(Ss,{color:"error",icon:t?s:void 0,children:e})})})},Hu=$(K)(({theme:n})=>({display:"flex",alignItems:"center",padding:n.spacing(1,2)})),zu=$(K)(()=>({marginRight:"auto"})),$u=({feature:n})=>{const[e,t]=(()=>{var i;return n!=null&&n.isEnabled?[!0,"True"]:((i=n==null?void 0:n.strategies)==null?void 0:i.result)==="unknown"?["unknown","Unknown"]:[!1,"False"]})();return m(Hu,{children:m(zu,{"data-loading":!0,children:m(Dn,{enabled:e,label:t,showIcon:e!=="unknown"})})})},qu=$("div")(({theme:n})=>({padding:n.spacing(4),maxWidth:"400px"})),As=$(se)(({theme:n})=>({marginBottom:n.spacing(2)})),ju=$(Iu)(({theme:n})=>({color:n.palette.success.main})),Uu=({variants:n,selectedVariant:e})=>{const t=ke(),i=I.useMemo(()=>n.map(c=>({name:c.name,weight:`${Gf(c.weight)}%`,selected:c.name===e})),[n,e]),s=I.useMemo(()=>({sortBy:[{id:"name",desc:!1}]}),[]),{getTableProps:r,getTableBodyProps:o,headerGroups:l,rows:a,prepareRow:h}=Bt.useTable({initialState:s,columns:Ku,data:i,sortTypes:Fa,autoResetGlobalFilter:!1,autoResetSortBy:!1,disableSortRemove:!0},Bt.useGlobalFilter,Bt.useSortBy);return B(qu,{children:[m(As,{variant:"subtitle2",children:"Variant Information"}),m(As,{variant:"body2",children:"The following table shows the variants defined on this feature toggle and the variant result based on your context configuration."}),m(As,{variant:"body2",children:'If you include "userId" or "sessionId" in your context, the variant will be the same every time because unleash uses these properties to ensure that the user receives the same experience.'}),B(Qf,{...r(),rowHeight:"dense",children:[m(Jf,{headerGroups:l}),m(Yf,{...o(),children:a.map(c=>{let f={};return c.original.selected||(f.color=t.palette.text.secondary),h(c),m(_f,{hover:!0,...c.getRowProps(),children:c.cells.map(u=>m(Xf,{...u.getCellProps(),style:f,children:u.render("Cell")}))})})})]})]})},Ku=[{id:"Icon",Cell:({row:{original:{selected:n}}})=>m(je,{children:m(j,{condition:n,show:m(Zf,{icon:m(ju,{})})})}),maxWidth:25,disableGlobalFilter:!0},{Header:"Name",accessor:"name",searchable:!0,Cell:({row:{original:{name:n}}})=>m(Lo,{children:n}),maxWidth:175,width:175},{Header:"Weight",accessor:"weight",sortType:"alphanumeric",searchable:!0,maxWidth:75,Cell:({row:{original:{weight:n}}})=>m(Lo,{children:n})}],Gu=$("div")(()=>({maxWidth:"100%",display:"flex",alignItems:"center",wordBreak:"break-all"})),Qu=({variant:n,variants:e,feature:t,isEnabled:i})=>{const s=ke(),[r,o]=I.useState(null),l=c=>o(c.currentTarget),a=()=>o(null),h=Boolean(r);return B(Gu,{children:[n,m(j,{condition:Boolean(e)&&e.length>0&&i,show:B(je,{children:[m(Ai,{onClick:l,children:m(Wa,{})}),m(Va,{open:h,id:`${t}-result-variants`,PaperProps:{sx:{borderRadius:`${s.shape.borderRadiusLarge}px`}},onClose:a,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:-320},children:m(Uu,{variants:e,selectedVariant:n})})]})})]})},Ua=["default","applicationHostname","flexibleRollout","gradualRolloutRandom","gradualRolloutSessionId","gradualRolloutUserId","remoteAddress","userWithId"];function Ka(n){return n===void 0?!0:Object.values(n).every(e=>e&&typeof e=="object"?Ka(e):e===null)}const Fo=n=>{var e,t;return(t=(e=n.strategies)==null?void 0:e.data)==null?void 0:t.find(i=>!Ua.includes(i.name))},Ju=n=>{var e,t;return!((t=(e=n.strategies)==null?void 0:e.data)!=null&&t.find(i=>Ua.includes(i.name)))},Yu=$("div")({display:"flex",justifyContent:"space-between",width:"100%"}),_u=$("div")(({theme:n})=>({display:"inline-flex",alignItems:"center",gap:n.spacing(1.5),marginTop:n.spacing(1.5)})),Wo=$("div")(({theme:n})=>({margin:n.spacing(1,0)})),Xu=$("div")(({theme:n})=>({margin:n.spacing(1,.5)})),Zu=$(se)(({theme:n})=>({fontWeight:600,padding:n.spacing(.5)})),ed=$(Ai)({textAlign:"right"}),td=({feature:n,input:e,onClose:t})=>{var c;const i=ke(),[s,r,o]=(()=>n.isEnabled?[`This feature toggle is True in ${e==null?void 0:e.environment} because `,"at least one strategy is True",i.palette.success.main]:n.isEnabledInCurrentEnvironment?Ju(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"no strategies could be fully evaluated",i.palette.warning.main]:Fo(n)?[`This feature toggle is Unknown in ${e==null?void 0:e.environment} because `,"not all strategies could be fully evaluated",i.palette.warning.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"all strategies are either False or could not be fully evaluated",i.palette.error.main]:[`This feature toggle is False in ${e==null?void 0:e.environment} because `,"the environment is disabled",i.palette.error.main])(),l=Ka(e==null?void 0:e.context)?"You did not provide a value for your context field in step 2 of the configuration":void 0,a=Fo(n)?"This feature uses custom strategies. Custom strategies can't be evaluated, so they will be marked accordingly.":void 0,h=t&&(f=>{f.stopPropagation(),t()});return B(je,{children:[B(Yu,{children:[B(_u,{children:[m(Zu,{variant:"subtitle1",children:n.name}),m(j,{condition:((c=n==null?void 0:n.strategies)==null?void 0:c.result)!=="unknown",show:()=>m(Dn,{enabled:n.isEnabled,label:n.isEnabled?"True":"False"}),elseShow:()=>m(Dn,{enabled:"unknown",label:"Unknown",showIcon:!1})})]}),m(ed,{onClick:h,children:m(eu,{})})]}),B(Xu,{children:[m(se,{variant:"body1",component:"span",children:s}),m(se,{variant:"subtitle1",color:o,component:"span",children:r}),m(se,{variant:"body1",component:"span",children:"."})]}),m(j,{condition:Boolean(l),show:m(Wo,{children:m(Mn,{color:"info",children:l})})}),m(j,{condition:Boolean(a),show:m(Wo,{children:m(Mn,{severity:"warning",color:"info",children:a})})})]})},id=$("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.error.main})),nd=({constraint:n,input:e})=>B(id,{children:[m(os,{style:{marginRight:"0.25rem"}}),m(se,{variant:"body2",children:(()=>{const i=e==null?void 0:e.context[n.contextName];return i?`Constraint not met – the value in the context: { ${i} } is not ${n.operator} ${n.contextName}`:`Constraint not met – no value was specified for ${n.contextName}`})()})]}),sd=$(Eu)(({theme:n})=>({color:n.palette.success.main})),rd=$("div")(({theme:n})=>({display:"flex",alignItems:"center",marginTop:n.spacing(1),color:n.palette.success.main})),od=()=>B(rd,{children:[m(sd,{style:{marginRight:"0.25rem"}}),m(se,{variant:"body2",children:"Constraint met by value in context"})]}),ld=$("div")(()=>({width:"100%",display:"flex",flexDirection:"column"})),Ga=({constraints:n,input:e})=>n?m(ld,{children:n==null?void 0:n.map((t,i)=>B(I.Fragment,{children:[m(j,{condition:i>0,show:m(Hi,{text:"AND"})}),m(tu,{constraint:t,compact:!0,renderAfter:m(j,{condition:t.result,show:m(od,{}),elseShow:m(nd,{input:e,constraint:t})})})]},Ha(t)))}):null,ad=$("div")(({theme:n})=>({color:n.palette.error.main,display:"inline-flex",justifyContent:"center",marginLeft:"auto",gap:n.spacing(1)})),hd=({segments:n,input:e})=>n?m(je,{children:n.map((t,i)=>B(I.Fragment,{children:[m(iu,{segment:t,constraintList:m(Ga,{constraints:t.constraints,input:e}),headerContent:m(j,{condition:!Boolean(t.result),show:B(ad,{children:[m(se,{variant:"subtitle2",sx:{pt:.25},children:"segment is false"}),m("span",{children:m(os,{})})]})}),isExpanded:!0}),m(j,{condition:i>=0&&n.length>1&&i!==n.length-1,show:m(Hi,{text:"AND"})})]},t.id))}):null,cd=$("div",{shouldForwardProp:n=>n!=="showReason"})(({theme:n,showReason:e})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.dividerAlternative}`,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:n.spacing(2),opacity:e?.9:1,backgroundColor:e?n.palette.background.paper:"inherit"})),fd=$("div")(({theme:n})=>({flexDirection:"column"})),ud=$(_r)(({theme:n})=>({margin:n.spacing(.5)})),dd=$("p")(({theme:n})=>({display:"inline",margin:n.spacing(.5,0),maxWidth:"95%",textAlign:"center",wordBreak:"break-word"})),Ms=({value:n,text:e,input:t,showReason:i=!1})=>{const s=ke(),r=t==="no value"?"error":"neutral",o=`value does not match any ${e}`;return B(cd,{showReason:i,children:[m(se,{variant:"subtitle1",color:s.palette[r].main,children:`${t}`}),B(fd,{children:[m(j,{condition:Boolean(i),show:m(se,{variant:"subtitle1",color:s.palette.error.main,children:o})}),m(j,{condition:n.length===0,show:B("p",{children:["No ",e,"s added yet."]}),elseShow:B("div",{children:[B(dd,{children:[n.length," ",n.length>1?`${e}s`:e," will get access."]}),n.map(l=>m(ud,{label:m(er,{maxWidth:"300",text:l.toString(),maxLength:50})},l))]})})]}),m(j,{condition:Boolean(i),show:m(os,{color:"error"}),elseShow:m("div",{})})]})},Qa=$(K)(({theme:n})=>({width:"auto",height:"auto",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.dividerAlternative}`})),ct=n=>{switch(n.toUpperCase()){case"USERIDS":return"userId";case"IPS":return"remoteAddress";default:return n}},pd=({parameters:n,constraints:e,input:t})=>m(je,{children:Object.keys(n).map(i=>{var s,r,o,l,a,h,c,f;switch(i){case"rollout":case"Rollout":const u=tr(n[i]);return B(Qa,{sx:{display:"flex",alignItems:"center"},children:[m(K,{sx:{mr:"1rem"},children:m(nu,{percentage:u,size:"2rem"})}),B("div",{children:[m(_r,{color:"success",variant:"outlined",size:"small",label:`${u}%`})," ","of your base"," ",e.length>0?"who match constraints":""," ","is included."]})]},i);case"userIds":case"UserIds":const d=mn(n[i]);return m(Ms,{value:d,text:"user",input:Boolean((s=t==null?void 0:t.context)==null?void 0:s[ct(i)])?(r=t==null?void 0:t.context)==null?void 0:r[ct(i)]:"no value",showReason:Boolean((o=t==null?void 0:t.context)==null?void 0:o[ct(i)])?!d.includes((l=t==null?void 0:t.context)==null?void 0:l[ct(i)]):void 0},i);case"hostNames":case"HostNames":const p=mn(n[i]);return m(Ms,{value:p,text:"host",input:"no value",showReason:void 0},i);case"IPs":const y=mn(n[i]);return m(Ms,{value:y,text:"IP",input:Boolean((a=t==null?void 0:t.context)==null?void 0:a[ct(i)])?(h=t==null?void 0:t.context)==null?void 0:h[ct(i)]:"no value",showReason:Boolean((c=t==null?void 0:t.context)==null?void 0:c[ct(i)])?!y.includes((f=t==null?void 0:t.context)==null?void 0:f[ct(i)]):void 0},i);case"stickiness":case"groupId":return null;default:return null}})}),md=$(K)(({theme:n})=>({width:"100%",padding:n.spacing(2,3),borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.dividerAlternative}`,display:"flex",flexDirection:"row",alignItems:"center",gap:2})),ci=({text:n,input:e=null,isRequired:t=!1})=>{const i=ke(),s=e===null?"error":"neutral",r=t&&e===null;return B(md,{children:[m(se,{variant:"subtitle1",color:i.palette[s].main,sx:{minWidth:118},children:`${e===null?"no value":e}`}),m(K,{sx:{flexGrow:1,flexDirection:"column"},children:m(K,{sx:{flexGrow:1},children:m(j,{condition:Boolean(r),show:B(je,{children:[m(se,{component:"span",color:i.palette.error.main,children:" required parameter "}),m(er,{maxWidth:"300",text:n,maxLength:50}),m(se,{component:"span",color:i.palette.error.main,children:" is not set "})]}),elseShow:B(je,{children:[m(se,{component:"span",color:"text.disabled",children:" set on parameter "}),m(er,{maxWidth:"300",text:n,maxLength:50})]})})})}),m(j,{condition:Boolean(r),show:m(os,{color:"error"}),elseShow:m("div",{})})]})},gd=({strategyName:n,parameters:e})=>{const{strategies:t}=su(),i=t.find(r=>r.name===n);if(!(i!=null&&i.editable))return null;const s=i==null?void 0:i.parameters.map(r=>{const o=e[r.name],l=r.required;switch(r==null?void 0:r.type){case"list":const a=mn(o);return m(ci,{isRequired:l,text:r.name,input:(a==null?void 0:a.length)>0?a.join(", "):null});case"percentage":const h=tr(o),c=!(o===void 0||o===""||h<0||h>100);return m(ci,{text:r.name,isRequired:l,input:c?`${h}%`:void 0});case"boolean":const f=["true","false"].includes(o)?o:void 0;return m(ci,{isRequired:l,text:r.name,input:o!==void 0?f:void 0});case"string":const u=ru(o);return m(ci,{text:r.name,isRequired:l,input:u!==void 0?u:void 0});case"number":const d=!(o===void 0||o===""),p=tr(o);return m(ci,{text:r.name,isRequired:l,input:d?`${p}`:void 0});case"default":return null}return null});return m(je,{children:s.map((r,o)=>B(I.Fragment,{children:[m(j,{condition:o>0,show:m(Hi,{text:"AND"})}),r]},o))})},yd=$("div")(({theme:n})=>({padding:n.spacing(0)})),bd=({strategyResult:n,input:e})=>{const{name:t,constraints:i,segments:s,parameters:r}=n,{uiConfig:o}=ou(),l=Boolean(o.flags.SE)&&Boolean(s&&s.length>0),a=Boolean(i&&(i==null?void 0:i.length)>0),h=t!=="default"&&Object.keys(lu).includes(t),c=Object.keys(r).length>0&&n.result.evaluationStatus==="incomplete";if(!r)return null;const f=[l&&m(hd,{segments:s,input:e}),a&&m(Ga,{constraints:i,input:e}),h&&m(pd,{parameters:r,constraints:i,input:e}),c&&m(gd,{strategyName:t,parameters:r}),t==="default"&&B(Qa,{sx:{width:"100%"},children:["The standard strategy is"," ",m(_r,{variant:"outlined",size:"small",color:"success",label:"ON"})," ","for all users."]})].filter(Boolean);return m(yd,{children:f.map((u,d)=>B(I.Fragment,{children:[m(j,{condition:d>0,show:m(Hi,{text:"AND"})}),u]},d))})},xd=({strategy:n,input:e,index:t})=>{const{result:i}=n,s=ke(),r=i.evaluationStatus==="incomplete"?"Unevaluated":i.enabled?"True":"False";return m(Bu,{style:{borderColor:i.enabled?s.palette.success.main:"none"},strategy:{...n,id:`${Ha(n)}`},orderNumber:t+1,actions:m(Dn,{showIcon:!1,enabled:i.enabled,label:r}),children:m(bd,{strategyResult:n,input:e,percentageFill:s.palette.tertiary.light})})},wd=$("div")(({theme:n})=>({display:"flex",padding:"0, 4px",flexDirection:"column",borderRadius:n.shape.borderRadiusMedium,border:`1px solid ${n.palette.warning.border}`})),vd=$("div")(({theme:n})=>({padding:n.spacing(1,.5)})),kd=$(Mn)(({theme:n})=>({border:"0!important",borderBottomLeftRadius:0,borderBottomRightRadius:0,borderBottom:`1px solid ${n.palette.warning.border}!important`})),Ja=({strategies:n,input:e})=>m(j,{condition:n.length>0,show:B(je,{children:[m(se,{variant:"subtitle1",sx:{mt:2,ml:1,mb:2,color:"text.secondary"},children:`Strategies (${n==null?void 0:n.length})`}),m(K,{sx:{width:"100%"},children:n==null?void 0:n.map((t,i)=>B(I.Fragment,{children:[m(j,{condition:i>0,show:m(Hi,{text:"OR"})}),m(xd,{strategy:t,index:i,input:e},t.id)]},t.id))})]})}),Sd=({strategies:n,input:e})=>B(wd,{sx:{pb:1,mt:2},children:[B(kd,{severity:"info",color:"warning",children:["If environment was enabled, then this feature toggle would be"," ",n!=null&&n.result?"TRUE":"FALSE"," with strategies evaluated like so:"," "]}),m(vd,{sx:{p:2.5},children:m(Ja,{strategies:(n==null?void 0:n.data)||[],input:e})})]}),Cd=({feature:n,input:e})=>{var t,i,s,r;return B(je,{children:[m(j,{condition:((i=(t=n==null?void 0:n.strategies)==null?void 0:t.data)==null?void 0:i.length)===0,show:m(Mn,{severity:"warning",sx:{mt:2},children:"There are no strategies added to this feature toggle in selected environment."})}),m(j,{condition:!n.isEnabledInCurrentEnvironment&&Boolean((s=n==null?void 0:n.strategies)==null?void 0:s.data),show:m(Sd,{strategies:n==null?void 0:n.strategies,input:e}),elseShow:m(Ja,{strategies:((r=n==null?void 0:n.strategies)==null?void 0:r.data)||[],input:e})})]})},Ad=$("div")(({theme:n})=>({alignItems:"flex-end",color:n.palette.tertiary.main})),Md=({feature:n,input:e})=>{const[t,i]=I.useState(!1),s=I.useRef(null),r=()=>{i(!t)};return n?B(Ad,{children:[m(Ai,{onClick:r,children:m(Wa,{ref:s})}),B(Va,{open:t,onClose:()=>i(!1),anchorEl:s.current,PaperProps:{sx:o=>({display:"flex",flexDirection:"column",padding:o.spacing(6),width:728,maxWidth:"100%",height:"auto",overflowY:"auto",backgroundColor:o.palette.tertiary.light,borderRadius:o.shape.borderRadius})},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:[m(td,{feature:n,input:e,onClose:()=>i(!1)}),m(Cd,{feature:n,input:e})]})]}):null},Od={id:"name"},{value:Vo,setValue:Dd}=au("PlaygroundResultsTable:v1",Od),Td=({features:n,input:e,loading:t})=>{const[i,s]=za(),r=hu(t),[o,l]=I.useState(i.get("search")||""),a=ke(),h=ir(a.breakpoints.down("sm")),c=ir(a.breakpoints.down("md")),f=I.useMemo(()=>[{Header:"Name",accessor:"name",searchable:!0,minWidth:160,Cell:({value:v,row:{original:O}})=>m(Eo,{title:v,to:`/projects/${O==null?void 0:O.projectId}/features/${v}`})},{Header:"Project ID",accessor:"projectId",sortType:"alphanumeric",filterName:"projectId",searchable:!0,maxWidth:170,Cell:({value:v})=>m(Eo,{title:v,to:`/projects/${v}`})},{Header:"Variant",id:"variant",accessor:"variant.name",sortType:"alphanumeric",filterName:"variant",searchable:!0,maxWidth:200,Cell:({value:v,row:{original:{variant:O,feature:N,variants:P,isEnabled:E}}})=>m(Qu,{variant:O!=null&&O.enabled?v:"",variants:P,feature:N,isEnabled:E})},{id:"isEnabled",Header:"isEnabled",filterName:"isEnabled",accessor:v=>{var O;return v!=null&&v.isEnabled?"true":((O=v==null?void 0:v.strategies)==null?void 0:O.result)==="unknown"?"unknown":"false"},Cell:({row:v})=>m($u,{feature:v.original}),sortType:"playgroundResultState",maxWidth:120,sortInverted:!0},{Header:"",maxWidth:70,id:"info",Cell:({row:v})=>m(Md,{feature:v.original,input:e})}],[e]),{data:u,getSearchText:d,getSearchContext:p}=cu(f,o,n||[]),y=I.useMemo(()=>t?Array(5).fill({name:"Feature name",projectId:"FeatureProject",variant:{name:"FeatureVariant",variants:[]},enabled:!0}):u,[u,t]),[b]=I.useState(()=>({sortBy:[{id:i.get("sort")||Vo.id,desc:i.has("order")?i.get("order")==="desc":Vo.desc}]})),{headerGroups:x,rows:k,state:{sortBy:M},prepareRow:C,setHiddenColumns:S}=Bt.useTable({initialState:b,columns:f,data:y,sortTypes:Fa,autoResetGlobalFilter:!1,autoResetHiddenColumns:!1,autoResetSortBy:!1,disableSortRemove:!0,disableMultiSort:!0,defaultColumn:{Cell:fu}},Bt.useGlobalFilter,Bt.useFlexLayout,Bt.useSortBy);return uu([{condition:h,columns:["variant"]},{condition:c,columns:["projectId"]}],S,f),I.useEffect(()=>{if(t)return;const v=Object.fromEntries(i);v.sort=M[0].id,M[0].desc?v.order="desc":v.order&&delete v.order,o?v.search=o:delete v.search,s(v,{replace:!0}),Dd({id:M[0].id,desc:M[0].desc||!1})},[t,M,o]),B(je,{children:[B(K,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:[m(se,{variant:"subtitle1",sx:{ml:1},children:n!==void 0&&!t?`Results (${k.length<y.length?`${k.length} of ${y.length}`:y.length})`:"Results"}),m(du,{initialValue:o,onChange:l,hasFilters:!0,getSearchContext:p,disabled:t,containerStyles:{marginLeft:"1rem",maxWidth:"400px"}})]}),m(j,{condition:!t&&!y,show:()=>m(Cs,{children:y===void 0?"None of the feature toggles were evaluated yet.":"No results found."}),elseShow:()=>B(K,{ref:r,children:[m(pu,{value:d(o),children:m(mu,{rows:k,headerGroups:x,prepareRow:C})}),m(j,{condition:y.length===0&&(o==null?void 0:o.length)>0,show:B(Cs,{children:["No feature toggles found matching “",o,"”"]})}),m(j,{condition:y&&y.length===0&&!o,show:m(Cs,{children:"No features toggles to display"})})]})})]})},Pd=()=>{const{makeRequest:n,createRequest:e,errors:t,loading:i}=gu({propagateErrors:!0}),s="api/admin/playground";return{evaluatePlayground:async o=>{const a=e(s,{method:"POST",body:JSON.stringify(o)});try{return(await n(a.caller,a.id)).json()}catch(h){throw h}},errors:t,loading:i}},Rd=$("div")(({style:n,theme:e})=>({width:"25px",height:"25px",borderRadius:"50%",color:e.palette.text.tertiaryContrast,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",...n})),ls=({style:n,children:e,type:t})=>{const i=ke(),s={backgroundColor:i.palette.primary.main};return t==="secondary"&&(s.backgroundColor=i.palette.tertiary.dark),m(Rd,{style:{...s,...n},children:e})},Bd=n=>!n||n.length===0||n.length===1&&n[0]==="*"?"*":Array.isArray(n)?n:[n],Ld=n=>{const e=Ya(n);return e.length>0?e[0]:""},Ya=n=>n.filter(({enabled:e})=>Boolean(e)).sort((e,t)=>e.sortOrder-t.sortOrder).map(({name:e})=>e),Ed=(n,e)=>n?"100%":e&&!n?"65%":"50%";function rr(n,e,t){var i,s,r,o,l;e==null&&(e=100);function a(){var c=Date.now()-o;c<e&&c>=0?i=setTimeout(a,e-c):(i=null,t||(l=n.apply(r,s),r=s=null))}var h=function(){r=this,s=arguments,o=Date.now();var c=t&&!i;return i||(i=setTimeout(a,e)),c&&(l=n.apply(r,s),r=s=null),l};return h.clear=function(){i&&(clearTimeout(i),i=null)},h.flush=function(){i&&(l=n.apply(r,s),r=s=null,clearTimeout(i),i=null)},h}rr.debounce=rr;var Id=rr;class q{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),_e.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let i=[];return this.decompose(e,t,i,0),_e.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new vi(this),r=new vi(e);for(let o=t,l=t;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(e=1){return new vi(this,e)}iterRange(e,t=this.length){return new _a(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Xa(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?q.empty:e.length<=32?new re(e):_e.from(re.split(e,[]))}}class re extends q{constructor(e,t=Nd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Fd(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new re(Ho(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=gn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new re(l,o.length+r.length));else{let a=l.length>>1;i.push(new re(l.slice(0,a)),new re(l.slice(a)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof re))return super.replace(e,t,i);let s=gn(this.text,gn(i.text,Ho(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new re(s,r):_e.from(re.split(s,[]),r)}sliceString(e,t=this.length,i=`
2
2
  `){let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(s+=i),e<a&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new re(i,s)),i=[],s=-1);return s>-1&&t.push(new re(i,s)),t}}class _e extends q{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if(i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],l=r+o.length;if(e>=r&&t<=l){let a=o.replace(e-r,t-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>5-1&&a.lines>h>>5+1){let c=this.children.slice();return c[s]=a,new _e(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
3
3
  `){let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(s+=i),e<a&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof _e))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new re(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof _e)for(let y of d.children)f(y);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof re&&a&&(p=c[c.length-1])instanceof re&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new re(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:_e.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new _e(l,t)}}q.empty=new re([""],0);function Nd(n){let e=-1;for(let t of n)e+=t.length+1;return e}function gn(n,e,t=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=t&&(a>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=a+1}return e}function Ho(n,e,t){return gn(n,[""],e,t)}class vi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof re?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof re?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
4
4
  `,this;e--}else if(s instanceof re){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof re?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class _a{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new vi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Xa{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(q.prototype[Symbol.iterator]=function(){return this.iter()},vi.prototype[Symbol.iterator]=_a.prototype[Symbol.iterator]=Xa.prototype[Symbol.iterator]=function(){return this});class Fd{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}let Qt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;n<Qt.length;n++)Qt[n]+=Qt[n-1];function Wd(n){for(let e=1;e<Qt.length;e+=2)if(Qt[e]>n)return Qt[e-1]<=n;return!1}function zo(n){return n>=127462&&n<=127487}const $o=8205;function Ae(n,e,t=!0,i=!0){return(t?Za:Vd)(n,e,i)}function Za(n,e,t){if(e==n.length)return e;e&&eh(n.charCodeAt(e))&&th(n.charCodeAt(e-1))&&e--;let i=me(n,e);for(e+=Le(i);e<n.length;){let s=me(n,e);if(i==$o||s==$o||t&&Wd(s))e+=Le(s),i=s;else if(zo(s)){let r=0,o=e-2;for(;o>=0&&zo(me(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Vd(n,e,t){for(;e>0;){let i=Za(n,e-2,t);if(i<e)return i;e--}return 0}function eh(n){return n>=56320&&n<57344}function th(n){return n>=55296&&n<56320}function me(n,e){let t=n.charCodeAt(e);if(!th(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return eh(i)?(t-55296<<10)+(i-56320)+65536:t}function Zr(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Le(n){return n<65536?1:2}const or=/\r\n?|\n/;var Ce=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(Ce||(Ce={}));class et{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){lr(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new et(e)}composeDesc(e){return this.empty?e:e.empty?this:ih(this,e)}mapDesc(e,t=!1){return e.empty?this:ar(this,e,t)}mapPos(e,t=-1,i=Ce.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=s+l;if(a<0){if(h>e)return r+(e-s);r+=l}else{if(i!=Ce.Simple&&h>=e&&(i==Ce.TrackDel&&s<e&&h>e||i==Ce.TrackBefore&&s<e||i==Ce.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=t&&l>=e)return s<e&&l>t?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new et(e)}static create(e){return new et(e)}}class ce extends et{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return lr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return ar(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],l=t[s+1];if(l>=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length<a;)i.push(q.empty);i.push(o?e.slice(r,r+o):q.empty)}r+=o}return new ce(t,i)}compose(e){return this.empty?e:e.empty?this:ih(this,e,!0)}map(e,t=!1){return e.empty?this:ar(this,e,t,!0)}iterChanges(e,t=!1){lr(this,e,t)}get desc(){return et.create(this.sections)}filter(e){let t=[],i=[],s=[],r=new Mi(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break e;let c=Math.min(r.len,a-l);xe(s,c,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;xe(t,c,f),f>0&&mt(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l<h;){if(r.done)break e;let c=Math.min(r.len,h-l);xe(t,c,-1),xe(s,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),l+=c}}return{changes:new ce(t,i),filtered:et.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;o<t&&xe(s,t-o,-1);let f=new ce(s,r);l=l?l.compose(f.map(l)):f,s=[],r=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ce){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?q.of(d.split(i||or)):d:q.empty,y=p.length;if(f==u&&y==0)return;f<o&&a(),f>o&&xe(s,f-o,-1),xe(s,u-f,y),mt(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)t.push(r[0],0);else{for(;i.length<s;)i.push(q.empty);i[s]=q.of(r.slice(1)),t.push(r[0],i[s].length)}}}return new ce(t,i)}static createSet(e,t){return new ce(e,t)}}function xe(n,e,t,i=!1){if(e==0&&t<=0)return;let s=n.length-2;s>=0&&t<=0&&t==n[s+1]?n[s]+=e:e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function mt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(q.empty);n.push(t)}}function lr(n,e,t){let i=n.inserted;for(let s=0,r=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)s+=l,r+=l;else{let h=s,c=r,f=q.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function ar(n,e,t,i=!1){let s=[],r=i?[]:null,o=new Mi(n),l=new Mi(e);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);xe(s,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(xe(s,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(xe(s,0,o.ins),r&&mt(r,s,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;xe(s,h,a<o.i?o.ins:0),r&&a<o.i&&mt(r,s,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return r?ce.createSet(s,r):et.create(s);throw new Error("Mismatched change set lengths")}}function ih(n,e,t=!1){let i=[],s=t?[]:null,r=new Mi(n),o=new Mi(e);for(let l=!1;;){if(r.done&&o.done)return s?ce.createSet(i,s):et.create(i);if(r.ins==0)xe(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)xe(i,0,o.ins,l),s&&mt(s,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;xe(i,a,c,l),s&&c&&mt(s,i,o.text)}else o.ins==-1?(xe(i,r.off?0:r.len,a,l),s&&mt(s,i,r.textBit(a))):(xe(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&mt(s,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Mi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?q.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?q.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Lt(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return w.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return w.range(this.anchor,i)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return w.range(e.anchor,e.head)}static create(e,t,i){return new Lt(e,t,i)}}class w{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:w.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new w([this.main],0)}addRange(e,t=!0){return w.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,w.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new w(e.ranges.map(t=>Lt.fromJSON(t)),e.main)}static single(e,t=e){return new w([w.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=i:r.from<i)return w.normalized(e.slice(),t);i=r.to}return new w(e,t)}static cursor(e,t=0,i,s){return Lt.create(e,e,(t==0?0:t<0?4:8)|(i==null?3:Math.min(2,i))|(s??33554431)<<5)}static range(e,t,i,s){let r=(i??33554431)<<5|(s==null?3:Math.min(2,s));return t<e?Lt.create(t,e,24|r):Lt.create(e,t,(t>e?4:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let r=e[s],o=e[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);s<=t&&t--,e.splice(--s,2,r.anchor>r.head?w.range(a,l):w.range(l,a))}}return new w(e,t)}}function nh(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let eo=0;class R{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=eo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}static define(e={}){return new R(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:to),!!e.static,e.enables)}of(e){return new yn([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new yn(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new yn(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function to(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class yn{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=eo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((t=e[f.id])!==null&&t!==void 0?t:1)&1||c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||hr(f,c)){let d=i(f);if(l?!qo(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let y=Pn(u,p);if(this.dependencies.every(b=>b instanceof R?u.facet(b)===f.facet(b):b instanceof be?u.field(b,!1)==f.field(b,!1):!0)||(l?qo(d=i(f),y,s):s(d=i(f),y)))return f.values[o]=y,0}else d=i(f);return f.values[o]=d,1}}}}function qo(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function hr(n,e){let t=!1;for(let i of e)ki(n,i)&1&&(t=!0);return t}function Hd(n,e,t){let i=t.map(a=>n[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=Pn(a,i[c]);if(s[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)ki(a,h);return a.values[o]=l(a),1},update(a,h){if(!hr(a,r))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=hr(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&to(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const jo=R.define({static:!0});class be{constructor(e,t,i,s,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new be(eo++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(jo).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}init(e){return[this,jo.of({field:this,create:e})]}get extension(){return this}}const Pt={lowest:4,low:3,default:2,high:1,highest:0};function fi(n){return e=>new sh(e,n)}const li={highest:fi(Pt.highest),high:fi(Pt.high),default:fi(Pt.default),low:fi(Pt.low),lowest:fi(Pt.lowest)};class sh{constructor(e,t){this.inner=e,this.prec=t}}class as{of(e){return new cr(this,e)}reconfigure(e){return as.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class cr{constructor(e,t){this.compartment=e,this.inner=t}}class Tn{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of zd(e,t,o))u instanceof be?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in r){let d=r[u],p=d[0].facet,y=c&&c[u]||[];if(d.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,to(y,d))a.push(i.facet(p));else{let b=p.combine(d.map(x=>x.value));a.push(i&&p.compare(b,i.facet(p))?i.facet(p):b)}else{for(let b of d)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=h.length<<1,h.push(x=>b.dynamicSlot(x)));l[p.id]=h.length<<1,h.push(b=>Hd(b,p,d))}}let f=h.map(u=>u(l));return new Tn(e,o,f,l,a,r)}}function zd(n,e,t){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof cr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof cr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof sh)r(o.inner,o.prec);else if(o instanceof be)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof yn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,Pt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}return r(n,Pt.default),i.reduce((o,l)=>o.concat(l))}function ki(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function Pn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const rh=R.define(),oh=R.define({combine:n=>n.some(e=>e),static:!0}),lh=R.define({combine:n=>n.length?n[0]:void 0,static:!0}),ah=R.define(),hh=R.define(),ch=R.define(),fh=R.define({combine:n=>n.length?n[0]:!1});class at{constructor(e,t){this.type=e,this.value=t}static define(){return new $d}}class $d{of(e){return new at(this,e)}}class qd{constructor(e){this.map=e}of(e){return new F(this,e)}}class F{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new F(this.type,t)}is(e){return this.type==e}static define(e={}){return new qd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}F.reconfigure=F.define();F.appendConfig=F.define();class fe{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&nh(i,t.newLength),r.some(l=>l.type==fe.time)||(this.annotations=r.concat(fe.time.of(Date.now())))}static create(e,t,i,s,r,o){return new fe(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(fe.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}fe.time=at.define();fe.userEvent=at.define();fe.addToHistory=at.define();fe.remote=at.define();function jd(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==e.length||e[s]>=n[i]))r=n[i++],o=n[i++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function uh(n,e,t){var i;let s,r,o;return t?(s=e.changes,r=ce.empty(e.changes.length),o=n.changes.compose(e.changes)):(s=e.changes.map(n.changes),r=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:F.mapEffects(n.effects,s).concat(F.mapEffects(e.effects,r)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function fr(n,e,t){let i=e.selection,s=Jt(e.annotations);return e.userEvent&&(s=s.concat(fe.userEvent.of(e.userEvent))),{changes:e.changes instanceof ce?e.changes:ce.of(e.changes||[],t,n.facet(lh)),selection:i&&(i instanceof w?i:w.single(i.anchor,i.head)),effects:Jt(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function dh(n,e,t){let i=fr(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;i=uh(i,fr(n,e[r],o?i.changes.newLength:n.doc.length),o)}let s=fe.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Kd(t?Ud(s):s)}function Ud(n){let e=n.startState,t=!0;for(let s of e.facet(ah)){let r=s(n);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:jd(t,r))}if(t!==!0){let s,r;if(t===!1)r=n.changes.invertedDesc,s=ce.empty(e.doc.length);else{let o=n.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}n=fe.create(e,s,n.selection&&n.selection.map(r),F.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=e.facet(hh);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof fe?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof fe?n=r[0]:n=dh(e,Jt(r),!1)}return n}function Kd(n){let e=n.startState,t=e.facet(ch),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=uh(i,fr(e,r,n.changes.newLength),!0))}return i==n?n:fe.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Gd=[];function Jt(n){return n==null?Gd:Array.isArray(n)?n:[n]}var Z=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Z||(Z={}));const Qd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ur;try{ur=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Jd(n){if(ur)return ur.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Qd.test(t)))return!0}return!1}function Yd(n){return e=>{if(!/\S/.test(e))return Z.Space;if(Jd(e))return Z.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Z.Word;return Z.Other}}class V{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)ki(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return ki(this,i),Pn(this,i)}update(...e){return dh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let o of e.effects)o.is(as.reconfigure)?(t&&(s=new Map,t.compartments.forEach((l,a)=>s.set(a,l)),t=null),s.set(o.value.compartment,o.value.extension)):o.is(F.reconfigure)?(t=null,i=o.value):o.is(F.appendConfig)&&(t=null,i=Jt(i).concat(o.value));let r;t?r=e.startState.values.slice():(t=Tn.resolve(i,s,this),r=new V(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values),new V(t,e.newDoc,e.newSelection,r,(o,l)=>l.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:w.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Jt(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(s);for(let u=0;u<l;u++)r[u]=r[u].map(c);let f=s.mapDesc(h,!0);r.push(a.range.map(f)),s=s.compose(c),o=F.mapEffects(o,c).concat(F.mapEffects(Jt(a.effects),f))}return{changes:s,selection:w.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ce?e:ce.of(e,this.doc.length,this.facet(V.lineSeparator))}toText(e){return q.of(e.split(this.facet(V.lineSeparator)||or))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(ki(this,t),Pn(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof be&&this.config.address[s.id]!=null&&(t[i]=s.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let o=i[r],l=e[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}}return V.create({doc:e.doc,selection:w.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=Tn.resolve(e.extensions||[],new Map),i=e.doc instanceof q?e.doc:q.of((e.doc||"").split(t.staticFacet(V.lineSeparator)||or)),s=e.selection?e.selection instanceof w?e.selection:w.single(e.selection.anchor,e.selection.head):w.single(0);return nh(s,i.length),t.staticFacet(oh)||(s=s.asSingle()),new V(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(V.tabSize)}get lineBreak(){return this.facet(V.lineSeparator)||`
@@ -1 +1 @@
1
- import{s as e,m as x,a as n,an as y,f as r,j as o,C as d,ao as b,x as f,ap as m}from"./index-193ec8c2.js";const I=e(x)(({theme:a})=>({padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"})),h=e("div")(({theme:a})=>({fontSize:a.typography.fontSize,color:a.palette.text.secondary,position:"absolute",display:"none",right:"calc(100% + 6px)",top:a.spacing(2.5),[a.breakpoints.up("md")]:{display:"block"}})),v=e(n)(({theme:a})=>({borderRadius:a.shape.borderRadiusMedium,border:`1px solid ${a.palette.divider}`,"& + &":{marginTop:a.spacing(2)},background:a.palette.background.paper})),S=e("div",{shouldForwardProp:a=>a!=="draggable"})(({theme:a,draggable:i})=>({padding:a.spacing(.5,2),display:"flex",gap:a.spacing(1),alignItems:"center",borderBottom:`1px solid ${a.palette.divider}`,fontWeight:a.typography.fontWeightMedium,paddingLeft:i?a.spacing(1):a.spacing(2)})),j=({strategy:a,onDragStart:i,onDragEnd:l,actions:c,children:p,orderNumber:s,style:g={}})=>{const u=y(a.name);return r(n,{sx:{position:"relative"},children:[o(d,{condition:s!==void 0,show:o(h,{children:s})}),r(v,{style:g,children:[r(S,{draggable:Boolean(i),children:[o(d,{condition:Boolean(i),show:()=>o(I,{draggable:!0,disableRipple:!0,size:"small",onDragStart:i,onDragEnd:l,sx:{cursor:"move"},children:o(b,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"neutral.main"}})})}),o(u,{sx:{fill:t=>t.palette.inactiveIcon}}),o(f,{maxWidth:"150",maxLength:15,text:m(a.name)}),o(n,{sx:{marginLeft:"auto",display:"flex",minHeight:t=>t.spacing(6),alignItems:"center"},children:c})]}),o(n,{sx:{p:2,justifyItems:"center"},children:p})]})]})};export{j as S};
1
+ import{s as e,m as x,a as n,an as y,f as r,j as o,C as d,ao as b,x as f,ap as m}from"./index-1d8518d6.js";const I=e(x)(({theme:a})=>({padding:0,cursor:"inherit",transition:"color 0.2s ease-in-out"})),h=e("div")(({theme:a})=>({fontSize:a.typography.fontSize,color:a.palette.text.secondary,position:"absolute",display:"none",right:"calc(100% + 6px)",top:a.spacing(2.5),[a.breakpoints.up("md")]:{display:"block"}})),v=e(n)(({theme:a})=>({borderRadius:a.shape.borderRadiusMedium,border:`1px solid ${a.palette.divider}`,"& + &":{marginTop:a.spacing(2)},background:a.palette.background.paper})),S=e("div",{shouldForwardProp:a=>a!=="draggable"})(({theme:a,draggable:i})=>({padding:a.spacing(.5,2),display:"flex",gap:a.spacing(1),alignItems:"center",borderBottom:`1px solid ${a.palette.divider}`,fontWeight:a.typography.fontWeightMedium,paddingLeft:i?a.spacing(1):a.spacing(2)})),j=({strategy:a,onDragStart:i,onDragEnd:l,actions:c,children:p,orderNumber:s,style:g={}})=>{const u=y(a.name);return r(n,{sx:{position:"relative"},children:[o(d,{condition:s!==void 0,show:o(h,{children:s})}),r(v,{style:g,children:[r(S,{draggable:Boolean(i),children:[o(d,{condition:Boolean(i),show:()=>o(I,{draggable:!0,disableRipple:!0,size:"small",onDragStart:i,onDragEnd:l,sx:{cursor:"move"},children:o(b,{titleAccess:"Drag to reorder",cursor:"grab",sx:{color:"neutral.main"}})})}),o(u,{sx:{fill:t=>t.palette.inactiveIcon}}),o(f,{maxWidth:"150",maxLength:15,text:m(a.name)}),o(n,{sx:{marginLeft:"auto",display:"flex",minHeight:t=>t.spacing(6),alignItems:"center"},children:c})]}),o(n,{sx:{p:2,justifyItems:"center"},children:p})]})]})};export{j as S};