@effect/platform-browser 4.0.0-beta.70 → 4.0.0-beta.72

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 (91) hide show
  1. package/dist/BrowserCrypto.d.ts +67 -4
  2. package/dist/BrowserCrypto.d.ts.map +1 -1
  3. package/dist/BrowserCrypto.js +67 -4
  4. package/dist/BrowserCrypto.js.map +1 -1
  5. package/dist/BrowserHttpClient.d.ts +16 -3
  6. package/dist/BrowserHttpClient.d.ts.map +1 -1
  7. package/dist/BrowserHttpClient.js +16 -3
  8. package/dist/BrowserHttpClient.js.map +1 -1
  9. package/dist/BrowserKeyValueStore.d.ts +20 -0
  10. package/dist/BrowserKeyValueStore.d.ts.map +1 -1
  11. package/dist/BrowserKeyValueStore.js +70 -15
  12. package/dist/BrowserKeyValueStore.js.map +1 -1
  13. package/dist/BrowserPersistence.d.ts +19 -0
  14. package/dist/BrowserPersistence.d.ts.map +1 -1
  15. package/dist/BrowserPersistence.js +19 -0
  16. package/dist/BrowserPersistence.js.map +1 -1
  17. package/dist/BrowserRuntime.d.ts +48 -0
  18. package/dist/BrowserRuntime.d.ts.map +1 -1
  19. package/dist/BrowserRuntime.js +16 -0
  20. package/dist/BrowserRuntime.js.map +1 -1
  21. package/dist/BrowserSocket.d.ts +55 -22
  22. package/dist/BrowserSocket.d.ts.map +1 -1
  23. package/dist/BrowserSocket.js +55 -22
  24. package/dist/BrowserSocket.js.map +1 -1
  25. package/dist/BrowserStream.d.ts +36 -21
  26. package/dist/BrowserStream.d.ts.map +1 -1
  27. package/dist/BrowserStream.js +36 -21
  28. package/dist/BrowserStream.js.map +1 -1
  29. package/dist/BrowserWorker.d.ts +17 -0
  30. package/dist/BrowserWorker.d.ts.map +1 -1
  31. package/dist/BrowserWorker.js +50 -18
  32. package/dist/BrowserWorker.js.map +1 -1
  33. package/dist/BrowserWorkerRunner.d.ts +19 -0
  34. package/dist/BrowserWorkerRunner.d.ts.map +1 -1
  35. package/dist/BrowserWorkerRunner.js +45 -14
  36. package/dist/BrowserWorkerRunner.js.map +1 -1
  37. package/dist/Clipboard.d.ts +55 -18
  38. package/dist/Clipboard.d.ts.map +1 -1
  39. package/dist/Clipboard.js +39 -15
  40. package/dist/Clipboard.js.map +1 -1
  41. package/dist/Geolocation.d.ts +63 -19
  42. package/dist/Geolocation.d.ts.map +1 -1
  43. package/dist/Geolocation.js +42 -18
  44. package/dist/Geolocation.js.map +1 -1
  45. package/dist/IndexedDb.d.ts +12 -0
  46. package/dist/IndexedDb.d.ts.map +1 -1
  47. package/dist/IndexedDb.js +12 -0
  48. package/dist/IndexedDb.js.map +1 -1
  49. package/dist/IndexedDbDatabase.d.ts +19 -0
  50. package/dist/IndexedDbDatabase.d.ts.map +1 -1
  51. package/dist/IndexedDbDatabase.js +19 -0
  52. package/dist/IndexedDbDatabase.js.map +1 -1
  53. package/dist/IndexedDbQueryBuilder.d.ts +8 -0
  54. package/dist/IndexedDbQueryBuilder.d.ts.map +1 -1
  55. package/dist/IndexedDbQueryBuilder.js +8 -0
  56. package/dist/IndexedDbQueryBuilder.js.map +1 -1
  57. package/dist/IndexedDbTable.d.ts +55 -17
  58. package/dist/IndexedDbTable.d.ts.map +1 -1
  59. package/dist/IndexedDbTable.js +55 -17
  60. package/dist/IndexedDbTable.js.map +1 -1
  61. package/dist/IndexedDbVersion.d.ts +14 -0
  62. package/dist/IndexedDbVersion.d.ts.map +1 -1
  63. package/dist/IndexedDbVersion.js +14 -0
  64. package/dist/IndexedDbVersion.js.map +1 -1
  65. package/dist/Permissions.d.ts +48 -18
  66. package/dist/Permissions.d.ts.map +1 -1
  67. package/dist/Permissions.js +48 -18
  68. package/dist/Permissions.js.map +1 -1
  69. package/dist/index.d.ts +0 -319
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +0 -319
  72. package/dist/index.js.map +1 -1
  73. package/package.json +3 -3
  74. package/src/BrowserCrypto.ts +67 -4
  75. package/src/BrowserHttpClient.ts +16 -3
  76. package/src/BrowserKeyValueStore.ts +70 -15
  77. package/src/BrowserPersistence.ts +66 -9
  78. package/src/BrowserRuntime.ts +48 -0
  79. package/src/BrowserSocket.ts +55 -22
  80. package/src/BrowserStream.ts +33 -18
  81. package/src/BrowserWorker.ts +50 -18
  82. package/src/BrowserWorkerRunner.ts +45 -14
  83. package/src/Clipboard.ts +55 -18
  84. package/src/Geolocation.ts +63 -19
  85. package/src/IndexedDb.ts +12 -0
  86. package/src/IndexedDbDatabase.ts +19 -0
  87. package/src/IndexedDbQueryBuilder.ts +8 -0
  88. package/src/IndexedDbTable.ts +55 -17
  89. package/src/IndexedDbVersion.ts +14 -0
  90. package/src/Permissions.ts +48 -18
  91. package/src/index.ts +0 -319
@@ -72,6 +72,20 @@ export type SchemaWithName<Db extends Any, TableName extends string> = IndexedDb
72
72
  /**
73
73
  * Creates an `IndexedDbVersion` from one or more table definitions.
74
74
  *
75
+ * **Details**
76
+ *
77
+ * The returned version exposes a `tables` map keyed by each table's
78
+ * `tableName`, and its type is the union of the supplied table definitions.
79
+ *
80
+ * **Gotchas**
81
+ *
82
+ * This constructor only describes the target schema; object stores and indexes
83
+ * still need to be created in the corresponding `IndexedDbDatabase` migration.
84
+ * Duplicate table names are not rejected, and the runtime map keeps the later
85
+ * table for a repeated key.
86
+ *
87
+ * @see {@link IndexedDbTable.make} for creating table definitions consumed by this constructor
88
+ *
75
89
  * @category constructors
76
90
  * @since 4.0.0
77
91
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedDbVersion.d.ts","sourceRoot":"","sources":["../src/IndexedDbVersion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,KAAK,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAE1D,QAAA,MAAM,MAAM,+CAA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AAc,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;AAmB9E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,IAAI,GACf,KAAK,CAAC,MAAM,SAAS,qBAAqB,CAAC,cAAc,CAAC,YAAY,CAAC,EAEvE,GAAG,QAAQ,MAAM,KAChB,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,CAG9B,CAAA"}
@@ -16,6 +16,20 @@ const makeProto = options => {
16
16
  /**
17
17
  * Creates an `IndexedDbVersion` from one or more table definitions.
18
18
  *
19
+ * **Details**
20
+ *
21
+ * The returned version exposes a `tables` map keyed by each table's
22
+ * `tableName`, and its type is the union of the supplied table definitions.
23
+ *
24
+ * **Gotchas**
25
+ *
26
+ * This constructor only describes the target schema; object stores and indexes
27
+ * still need to be created in the corresponding `IndexedDbDatabase` migration.
28
+ * Duplicate table names are not rejected, and the runtime map keeps the later
29
+ * table for a repeated key.
30
+ *
31
+ * @see {@link IndexedDbTable.make} for creating table definitions consumed by this constructor
32
+ *
19
33
  * @category constructors
20
34
  * @since 4.0.0
21
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"IndexedDbVersion.js","names":["pipeArguments","TypeId","Proto","pipe","arguments","makeProto","options","Version","Object","assign","tables","make","Map","map","table","tableName"],"sources":["../src/IndexedDbVersion.ts"],"sourcesContent":[null],"mappings":"AAqBA,SAASA,aAAa,QAAQ,iBAAiB;AAG/C,MAAMC,MAAM,GAAG,4CAA4C;AAgE3D,MAAMC,KAAK,GAAG;EACZ,CAACD,MAAM,GAAGA,MAAM;EAChBE,IAAIA,CAAA;IACF,OAAOH,aAAa,CAAC,IAAI,EAAEI,SAAS,CAAC;EACvC;CACD;AAED,MAAMC,SAAS,GAAgDC,OAE9D,IAA8B;EAC7B;EACA,MAAMC,OAAO;EACbC,MAAM,CAACC,MAAM,CAACF,OAAO,EAAEL,KAAK,CAAC;EAC3BK,OAAe,CAACG,MAAM,GAAGJ,OAAO,CAACI,MAAM;EACzC,OAAOH,OAAc;AACvB,CAAC;AAED;;;;;;AAMA,OAAO,MAAMI,IAAI,GAAGA,CAGlB,GAAGD,MAAc,KAEjBL,SAAS,CAAC;EACRK,MAAM,EAAE,IAAIE,GAAG,CAACF,MAAM,CAACG,GAAG,CAAEC,KAAK,IAAK,CAACA,KAAK,CAACC,SAAS,EAAED,KAAK,CAAC,CAAC;CAChE,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"IndexedDbVersion.js","names":["pipeArguments","TypeId","Proto","pipe","arguments","makeProto","options","Version","Object","assign","tables","make","Map","map","table","tableName"],"sources":["../src/IndexedDbVersion.ts"],"sourcesContent":[null],"mappings":"AAqBA,SAASA,aAAa,QAAQ,iBAAiB;AAG/C,MAAMC,MAAM,GAAG,4CAA4C;AAgE3D,MAAMC,KAAK,GAAG;EACZ,CAACD,MAAM,GAAGA,MAAM;EAChBE,IAAIA,CAAA;IACF,OAAOH,aAAa,CAAC,IAAI,EAAEI,SAAS,CAAC;EACvC;CACD;AAED,MAAMC,SAAS,GAAgDC,OAE9D,IAA8B;EAC7B;EACA,MAAMC,OAAO;EACbC,MAAM,CAACC,MAAM,CAACF,OAAO,EAAEL,KAAK,CAAC;EAC3BK,OAAe,CAACG,MAAM,GAAGJ,OAAO,CAACI,MAAM;EACzC,OAAOH,OAAc;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,MAAMI,IAAI,GAAGA,CAGlB,GAAGD,MAAc,KAEjBL,SAAS,CAAC;EACRK,MAAM,EAAE,IAAIE,GAAG,CAACF,MAAM,CAACG,GAAG,CAAEC,KAAK,IAAK,CAACA,KAAK,CAACC,SAAS,EAAED,KAAK,CAAC,CAAC;CAChE,CAAC","ignoreList":[]}
@@ -1,20 +1,35 @@
1
1
  /**
2
- * Browser Permissions API support for Effect programs.
3
- *
4
- * This module provides a `Permissions` service and browser-backed layer for
5
- * querying `navigator.permissions` from Effect code. Use it to check whether a
6
- * browser capability is currently `granted`, `prompt`, or `denied` before
7
- * showing UI for flows such as geolocation, notifications, clipboard access,
8
- * camera, microphone, or persistent storage.
9
- *
10
- * Permission queries do not request access by themselves and should not replace
11
- * the feature API that actually performs the operation. Browser support for
12
- * permission names and states is uneven, queries may reject for unsupported or
13
- * invalid descriptors, and some permissions are only meaningful in secure
14
- * contexts or after user activation. Returned `PermissionStatus` objects can
15
- * change when the user updates browser settings or responds to prompts; when
16
- * watching `change` or `onchange`, account for browser differences and clean up
17
- * listeners when the surrounding Effect scope ends.
2
+ * Effect service for the browser Permissions API.
3
+ *
4
+ * This module wraps `navigator.permissions` in a `Permissions` service and a
5
+ * browser-backed layer. It lets browser programs query whether a capability is
6
+ * currently `granted`, `prompt`, or `denied` before deciding which UI or
7
+ * feature flow to show for geolocation, notifications, clipboard access,
8
+ * camera, microphone, persistent storage, and other browser-gated features.
9
+ *
10
+ * **Mental model**
11
+ *
12
+ * A permission query is a status read, not an access request. The service
13
+ * delegates to `navigator.permissions.query({ name })` and returns the browser's
14
+ * `PermissionStatus`, while browser rejections are represented as
15
+ * `PermissionsError` values.
16
+ *
17
+ * **Common tasks**
18
+ *
19
+ * - Check whether a feature is already available before rendering a prompt or
20
+ * settings path.
21
+ * - Require permission querying through Effect context instead of reaching for
22
+ * the ambient `navigator` in application code.
23
+ * - Provide the live browser implementation with `layer`.
24
+ *
25
+ * **Gotchas**
26
+ *
27
+ * Browser support for permission names and states is uneven, and unsupported or
28
+ * invalid descriptors may reject. Some permissions are only meaningful in
29
+ * secure contexts or after user activation. Returned `PermissionStatus` objects
30
+ * can change when the user updates browser settings or responds to prompts; if
31
+ * you subscribe to `change` or `onchange`, clean up listeners with the
32
+ * surrounding Effect scope.
18
33
  *
19
34
  * @since 4.0.0
20
35
  */
@@ -93,14 +108,29 @@ export declare class PermissionsError extends PermissionsError_base<{
93
108
  get message(): string;
94
109
  }
95
110
  /**
96
- * Service tag for the browser `Permissions` service.
111
+ * Service tag for browser permission querying.
112
+ *
113
+ * **When to use**
114
+ *
115
+ * Use when an Effect needs to require or provide browser permission querying
116
+ * through the context.
97
117
  *
98
118
  * @category services
99
119
  * @since 4.0.0
100
120
  */
101
121
  export declare const Permissions: Context.Service<Permissions, Permissions>;
102
122
  /**
103
- * A layer that directly interfaces with the `navigator.permissions` api
123
+ * Provides the `Permissions` service using the browser `navigator.permissions` API.
124
+ *
125
+ * **When to use**
126
+ *
127
+ * Use when browser programs need a live `Permissions` service backed by the
128
+ * ambient `navigator.permissions` implementation.
129
+ *
130
+ * **Details**
131
+ *
132
+ * `query` delegates to `navigator.permissions.query({ name })` and wraps
133
+ * rejected browser operations in `PermissionsError`.
104
134
  *
105
135
  * @category layers
106
136
  * @since 4.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"Permissions.d.ts","sourceRoot":"","sources":["../src/Permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,QAAA,MAAM,MAAM,0CAA0C,CAAA;AACtD,QAAA,MAAM,WAAW,2DAA2D,CAAA;AAE5E;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,MAAM,CAAA;IAEhC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,SAAS,cAAc,EAC1C,IAAI,EAAE,IAAI,KACP,MAAM,CAAC,MAAM,CAGhB,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,EAC/C,gBAAgB,CACjB,CAAA;CACF;;;;AAED;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,kCAAsC;IACtF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB,CAA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S,cAAc,EAC1C,IAAI,EAAE,IAAI,KACP,MAAM,CAAC,MAAM,CAGhB,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,EAC/C,gBAAgB,CACjB,CAAA;CACF;;;;AAED;;;;;GAKG;AACH,qBAAa,4BAA6B,SAAQ,kCAAsC;IACtF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;;;;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,0BAA8B;IACtE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAAG,oBAAoB,CAAA;;;;AAExF;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,sBAAqC;IACzE,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAA;CACxC,CAAC;gBACY,KAAK,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAA;KAAE;IAO9D,QAAQ,CAAC,CAAC,WAAW,CAAC,4DAAc;IAEpC,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,CAAwC,CAAA;AAE1G;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAe1C,CAAA"}
@@ -1,20 +1,35 @@
1
1
  /**
2
- * Browser Permissions API support for Effect programs.
3
- *
4
- * This module provides a `Permissions` service and browser-backed layer for
5
- * querying `navigator.permissions` from Effect code. Use it to check whether a
6
- * browser capability is currently `granted`, `prompt`, or `denied` before
7
- * showing UI for flows such as geolocation, notifications, clipboard access,
8
- * camera, microphone, or persistent storage.
9
- *
10
- * Permission queries do not request access by themselves and should not replace
11
- * the feature API that actually performs the operation. Browser support for
12
- * permission names and states is uneven, queries may reject for unsupported or
13
- * invalid descriptors, and some permissions are only meaningful in secure
14
- * contexts or after user activation. Returned `PermissionStatus` objects can
15
- * change when the user updates browser settings or responds to prompts; when
16
- * watching `change` or `onchange`, account for browser differences and clean up
17
- * listeners when the surrounding Effect scope ends.
2
+ * Effect service for the browser Permissions API.
3
+ *
4
+ * This module wraps `navigator.permissions` in a `Permissions` service and a
5
+ * browser-backed layer. It lets browser programs query whether a capability is
6
+ * currently `granted`, `prompt`, or `denied` before deciding which UI or
7
+ * feature flow to show for geolocation, notifications, clipboard access,
8
+ * camera, microphone, persistent storage, and other browser-gated features.
9
+ *
10
+ * **Mental model**
11
+ *
12
+ * A permission query is a status read, not an access request. The service
13
+ * delegates to `navigator.permissions.query({ name })` and returns the browser's
14
+ * `PermissionStatus`, while browser rejections are represented as
15
+ * `PermissionsError` values.
16
+ *
17
+ * **Common tasks**
18
+ *
19
+ * - Check whether a feature is already available before rendering a prompt or
20
+ * settings path.
21
+ * - Require permission querying through Effect context instead of reaching for
22
+ * the ambient `navigator` in application code.
23
+ * - Provide the live browser implementation with `layer`.
24
+ *
25
+ * **Gotchas**
26
+ *
27
+ * Browser support for permission names and states is uneven, and unsupported or
28
+ * invalid descriptors may reject. Some permissions are only meaningful in
29
+ * secure contexts or after user activation. Returned `PermissionStatus` objects
30
+ * can change when the user updates browser settings or responds to prompts; if
31
+ * you subscribe to `change` or `onchange`, clean up listeners with the
32
+ * surrounding Effect scope.
18
33
  *
19
34
  * @since 4.0.0
20
35
  */
@@ -65,14 +80,29 @@ export class PermissionsError extends /*#__PURE__*/Data.TaggedError("Permissions
65
80
  }
66
81
  }
67
82
  /**
68
- * Service tag for the browser `Permissions` service.
83
+ * Service tag for browser permission querying.
84
+ *
85
+ * **When to use**
86
+ *
87
+ * Use when an Effect needs to require or provide browser permission querying
88
+ * through the context.
69
89
  *
70
90
  * @category services
71
91
  * @since 4.0.0
72
92
  */
73
93
  export const Permissions = /*#__PURE__*/Context.Service(TypeId);
74
94
  /**
75
- * A layer that directly interfaces with the `navigator.permissions` api
95
+ * Provides the `Permissions` service using the browser `navigator.permissions` API.
96
+ *
97
+ * **When to use**
98
+ *
99
+ * Use when browser programs need a live `Permissions` service backed by the
100
+ * ambient `navigator.permissions` implementation.
101
+ *
102
+ * **Details**
103
+ *
104
+ * `query` delegates to `navigator.permissions.query({ name })` and wraps
105
+ * rejected browser operations in `PermissionsError`.
76
106
  *
77
107
  * @category layers
78
108
  * @since 4.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"Permissions.js","names":["Context","Data","Effect","Layer","TypeId","ErrorTypeId","PermissionsInvalidStateError","TaggedError","message","_tag","PermissionsTypeError","PermissionsError","constructor","props","cause","reason","Permissions","Service","layer","succeed","of","query","name","tryPromise","try","navigator","permissions","catch","DOMException"],"sources":["../src/Permissions.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAErC,MAAMC,MAAM,GAAG,uCAAuC;AACtD,MAAMC,WAAW,GAAG,wDAAwD;AAyB5E;;;;;;AAMA,OAAM,MAAOC,4BAA6B,sBAAQL,IAAI,CAACM,WAAW,CAAC,mBAAmB,CAEpF;EACA,IAAaC,OAAOA,CAAA;IAClB,OAAO,IAAI,CAACC,IAAI;EAClB;;AAGF;;;;;;AAMA,OAAM,MAAOC,oBAAqB,sBAAQT,IAAI,CAACM,WAAW,CAAC,WAAW,CAEpE;EACA,IAAaC,OAAOA,CAAA;IAClB,OAAO,IAAI,CAACC,IAAI;EAClB;;AAWF;;;;;;AAMA,OAAM,MAAOE,gBAAiB,sBAAQV,IAAI,CAACM,WAAW,CAAC,kBAAkB,CAEvE;EACAK,YAAYC,KAAkD;IAC5D,KAAK,CAAC;MACJ,GAAGA,KAAK;MACRC,KAAK,EAAED,KAAK,CAACE,MAAM,CAACD;KACd,CAAC;EACX;EAES,CAACT,WAAW,IAAIA,WAAW;EAEpC,IAAaG,OAAOA,CAAA;IAClB,OAAO,IAAI,CAACO,MAAM,CAACP,OAAO;EAC5B;;AAGF;;;;;;AAMA,OAAO,MAAMQ,WAAW,gBAA8ChB,OAAO,CAACiB,OAAO,CAAcb,MAAM,CAAC;AAE1G;;;;;;AAMA,OAAO,MAAMc,KAAK,gBAA6Bf,KAAK,CAACgB,OAAO,CAC1DH,WAAW,eACXA,WAAW,CAACI,EAAE,CAAC;EACb,CAAChB,MAAM,GAAGA,MAAM;EAChBiB,KAAK,EAAGC,IAAI,IACVpB,MAAM,CAACqB,UAAU,CAAC;IAChBC,GAAG,EAAEA,CAAA,KAAMC,SAAS,CAACC,WAAW,CAACL,KAAK,CAAC;MAAEC;IAAI,CAAE,CAAiB;IAChEK,KAAK,EAAGb,KAAK,IACX,IAAIH,gBAAgB,CAAC;MACnBI,MAAM,EAAED,KAAK,YAAYc,YAAY,GACjC,IAAItB,4BAA4B,CAAC;QAAEQ;MAAK,CAAE,CAAC,GAC3C,IAAIJ,oBAAoB,CAAC;QAAEI;MAAK,CAAE;KACvC;GACJ;CACJ,CAAC,CACH","ignoreList":[]}
1
+ {"version":3,"file":"Permissions.js","names":["Context","Data","Effect","Layer","TypeId","ErrorTypeId","PermissionsInvalidStateError","TaggedError","message","_tag","PermissionsTypeError","PermissionsError","constructor","props","cause","reason","Permissions","Service","layer","succeed","of","query","name","tryPromise","try","navigator","permissions","catch","DOMException"],"sources":["../src/Permissions.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,IAAI,MAAM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AAM,EAAED,KAAK,YAAYc,YAAY,GACjC,IAAItB,4BAA4B,CAAC;QAAEQ;MAAK,CAAE,CAAC,GAC3C,IAAIJ,oBAAoB,CAAC;QAAEI;MAAK,CAAE;KACvC;GACJ;CACJ,CAAC,CACH","ignoreList":[]}
package/dist/index.d.ts CHANGED
@@ -2,389 +2,70 @@
2
2
  * @since 4.0.0
3
3
  */
4
4
  /**
5
- * Browser platform implementation of the Crypto service.
6
- *
7
5
  * @since 1.0.0
8
6
  */
9
7
  export * as BrowserCrypto from "./BrowserCrypto.ts";
10
8
  /**
11
- * Browser implementations of the Effect `HttpClient`.
12
- *
13
- * This module exposes HTTP client layers for code that runs in a browser. It
14
- * re-exports the fetch-based client for the common case, where requests should
15
- * use the platform `fetch` implementation and optional `RequestInit` defaults,
16
- * and it provides an `XMLHttpRequest`-backed layer for integrations that need
17
- * XHR semantics such as response type control or environments where XHR is the
18
- * required transport.
19
- *
20
- * Use these layers for single-page applications, browser tests, generated
21
- * `HttpApiClient`s, and other client-side Effect programs that need HTTP
22
- * requests to participate in interruption, typed transport / decode errors, and
23
- * Effect's response body readers.
24
- *
25
- * Browser networking rules still apply. Cross-origin requests are subject to
26
- * CORS preflights and server allowlists, especially when using custom headers,
27
- * non-simple methods, or non-simple content types. Only CORS-exposed response
28
- * headers are readable, and cookies / authentication are controlled by the
29
- * browser and the configured fetch `RequestInit.credentials` policy. The XHR
30
- * layer uses the browser's `XMLHttpRequest` defaults for credentials.
31
- *
32
- * Body handling differs between the transports. Fetch delegates body framing to
33
- * the Web Fetch implementation. The XHR client sends empty, raw, `Uint8Array`,
34
- * and `FormData` bodies directly, buffers `Stream` request bodies before
35
- * sending, defaults responses to text, and can be switched to `ArrayBuffer`
36
- * responses with `withXHRArrayBuffer`. When sending `FormData`, avoid setting
37
- * an incompatible `Content-Type` header so the browser can generate the
38
- * multipart boundary.
39
- *
40
9
  * @since 4.0.0
41
10
  */
42
11
  export * as BrowserHttpClient from "./BrowserHttpClient.ts";
43
12
  /**
44
- * Browser-backed `KeyValueStore` layers for Effect programs.
45
- *
46
- * This module provides `KeyValueStore` implementations backed by the browser's
47
- * synchronous Web Storage APIs: `localStorage` for origin-scoped data that
48
- * persists across page reloads and browser sessions, and `sessionStorage` for
49
- * page-session data that is cleared when that tab or window's page session
50
- * ends. They are useful for small client-side values such as user preferences,
51
- * feature flags, lightweight caches, persisted drafts, or session-only workflow
52
- * state.
53
- *
54
- * Web Storage is only available in browser environments and is scoped by origin.
55
- * Browsers may deny access in private modes or restricted contexts, and writes
56
- * can fail when storage quotas are exceeded. The API stores strings and runs
57
- * synchronously on the main thread, so prefer it for small payloads and avoid
58
- * treating it as a database or a secure place for sensitive data.
59
- *
60
13
  * @since 4.0.0
61
14
  */
62
15
  export * as BrowserKeyValueStore from "./BrowserKeyValueStore.ts";
63
16
  /**
64
- * Browser-backed persistence layers for Effect's persistence service.
65
- *
66
- * This module provides IndexedDB implementations of the Effect persistence services for applications that need a
67
- * durable client-side cache, such as remembered query results, offline-capable workflows, or values that should survive
68
- * page reloads. Entries are stored by persistence store id and key in a shared IndexedDB object store, with optional
69
- * expiration timestamps for TTL-based invalidation.
70
- *
71
- * Because this storage depends on browser IndexedDB, operations can fail when storage is unavailable, quota is exceeded,
72
- * data is cleared by the user or browser, or the payload cannot be structured-cloned by IndexedDB. Expired entries are
73
- * removed lazily when they are read, so this module is best suited for application-managed cached objects rather than
74
- * security-sensitive or authoritative data.
75
- *
76
17
  * @since 4.0.0
77
18
  */
78
19
  export * as BrowserPersistence from "./BrowserPersistence.ts";
79
20
  /**
80
- * Browser entry-point helpers for running Effect programs.
81
- *
82
- * This module exposes `runMain`, a browser-oriented main runner for launching
83
- * an Effect as the root program of a page, single-page application, demo, or
84
- * browser test harness. It delegates execution to the core Effect runtime while
85
- * adding the browser lifecycle hook needed to interrupt the main fiber when the
86
- * page receives `beforeunload`.
87
- *
88
- * `BrowserRuntime` does not provide application services by itself. Provide
89
- * any required layers, such as browser HTTP, storage, worker, geolocation, or
90
- * permission services, before passing the effect to `runMain`. Keep long-lived
91
- * browser resources scoped so interruption can run their finalizers while the
92
- * page is still active.
93
- *
94
- * Browser unload is more constrained than a process signal. Finalizers that
95
- * need the network, timers, prompts, or long asynchronous work may not complete
96
- * once navigation or tab close has started, and browsers do not expose a
97
- * process exit status. Use `runMain` to connect the page lifecycle to Effect
98
- * interruption, and use browser-specific persistence or delivery APIs for work
99
- * that must survive page teardown.
100
- *
101
21
  * @since 4.0.0
102
22
  */
103
23
  export * as BrowserRuntime from "./BrowserRuntime.ts";
104
24
  /**
105
- * Browser WebSocket layers for Effect sockets.
106
- *
107
- * This module provides the browser entry point for `Socket.Socket` values
108
- * backed by the platform `WebSocket` implementation. Use `layerWebSocket` when
109
- * client-side Effect programs, browser tests, RPC transports, or realtime UI
110
- * features need a bidirectional socket connected to a WebSocket URL, and use
111
- * `layerWebSocketConstructor` when lower-level socket APIs need access to the
112
- * browser constructor service.
113
- *
114
- * Browser WebSocket rules still apply. Connections are created through
115
- * `globalThis.WebSocket`, so URL schemes, subprotocol negotiation, mixed-content
116
- * blocking, cookies, authentication, CORS-like origin checks, and extension
117
- * negotiation are controlled by the browser and server rather than by Effect.
118
- * Close events are translated into socket errors unless the provided
119
- * `closeCodeIsError` predicate classifies the close code as clean, which is
120
- * useful for protocols that use application-specific close codes.
121
- *
122
- * Messages are delivered as strings or binary `Uint8Array` values; browser
123
- * `Blob` messages are read into bytes before they reach the socket handler.
124
- * Outgoing data should already be serialized to a string or bytes, and protocol
125
- * frames that represent an intentional close should be sent as `CloseEvent`
126
- * values so the underlying `WebSocket.close` code and reason are preserved.
127
- *
128
25
  * @since 4.0.0
129
26
  */
130
27
  export * as BrowserSocket from "./BrowserSocket.ts";
131
28
  /**
132
- * Browser `Stream` constructors for DOM event targets.
133
- *
134
- * This module provides typed helpers for turning `window.addEventListener` and
135
- * `document.addEventListener` callbacks into Effect `Stream`s. They are useful
136
- * for UI and runtime signals such as resize, visibility, keyboard, pointer,
137
- * focus, online / offline, and other browser events that should be composed
138
- * with Effect stream operators and finalized with the consuming fiber.
139
- *
140
- * Browser events are push-based `EventTarget` notifications, so they do not
141
- * apply Web Streams backpressure to the browser event source. Events are
142
- * buffered until downstream pulls them; the default buffer is unbounded, so
143
- * high-frequency sources like scroll, pointermove, or mousemove should usually
144
- * set `bufferSize` and use stream operators that sample, debounce, throttle, or
145
- * drop work as appropriate.
146
- *
147
- * These helpers are for DOM events, not for adapting `ReadableStream` request
148
- * or response bodies. Fetch bodies follow the Web Streams body rules, including
149
- * single-consumer locking and disturbed bodies after reads, and should be
150
- * handled with body-specific HTTP or Web Streams APIs instead. When using the
151
- * browser `once` option, pair the stream with `Stream.take(1)` if a finite
152
- * stream is required.
153
- *
154
29
  * @since 4.0.0
155
30
  */
156
31
  export * as BrowserStream from "./BrowserStream.ts";
157
32
  /**
158
- * Parent-side browser support for Effect workers.
159
- *
160
- * This module provides the `WorkerPlatform` used by browser applications that
161
- * spawn or connect to `Worker`, `SharedWorker`, and `MessagePort` endpoints
162
- * through Effect's worker protocol. Pair it with `BrowserWorkerRunner` in the
163
- * worker entrypoint when building worker-backed RPC clients, moving CPU-bound
164
- * work off the main thread, isolating browser-only services, or adapting an
165
- * existing `MessageChannel` in tests and custom transports.
166
- *
167
- * Dedicated workers communicate through the worker object itself, while shared
168
- * workers communicate through `worker.port`; raw `MessagePort` values are also
169
- * accepted and are started when supported. Messages are posted with the browser
170
- * structured-clone algorithm, so payloads must be cloneable by the target
171
- * runtime. Transfer lists can avoid copying values such as `ArrayBuffer` or
172
- * `MessagePort`, but transferring moves ownership away from the sender and
173
- * invalid or mismatched transferables can fail the send. Scope finalization
174
- * sends the worker close signal over the port; the application that created a
175
- * dedicated `Worker` remains responsible for any broader lifecycle such as
176
- * terminating it.
177
- *
178
33
  * @since 4.0.0
179
34
  */
180
35
  export * as BrowserWorker from "./BrowserWorker.ts";
181
36
  /**
182
- * Browser runtime support for Effect worker runners.
183
- *
184
- * This module is intended for code that is already executing in a browser
185
- * worker context, or for tests and adapters that supply a `MessagePort` or
186
- * `Window` endpoint directly. It provides the `WorkerRunnerPlatform` used by
187
- * `WorkerRunner` and `RpcServer.layerProtocolWorkerRunner` to receive parent
188
- * or client requests, run Effect handlers, and send responses through the
189
- * browser `postMessage` channel.
190
- *
191
- * Use it with `BrowserWorker` when a browser application needs to move RPC
192
- * handlers, CPU-bound computations, or browser-only services into a dedicated
193
- * worker or shared worker. Dedicated workers communicate through the current
194
- * `self` endpoint; shared workers accept multiple `onconnect` ports and cache
195
- * ports that connect before the runner layer starts. Messages still use the
196
- * browser structured-clone algorithm, so payload schemas, transfer lists,
197
- * `messageerror` events, and the lifetime of each `MessagePort` must be
198
- * considered when crossing worker boundaries.
199
- *
200
37
  * @since 4.0.0
201
38
  */
202
39
  export * as BrowserWorkerRunner from "./BrowserWorkerRunner.ts";
203
40
  /**
204
- * Browser clipboard service for Effect programs.
205
- *
206
- * This module wraps the browser `navigator.clipboard` API in a `Clipboard`
207
- * service so client-side applications can read, write, and clear clipboard
208
- * contents as typed Effects. It is useful for common UI workflows such as copy
209
- * buttons, paste/import actions, sharing generated text, and moving rich
210
- * clipboard payloads like `Blob`-backed `ClipboardItem`s through an Effect
211
- * environment.
212
- *
213
- * Browser clipboard rules still apply. Clipboard access generally requires a
214
- * secure context, and browsers may require a user gesture, permission prompt, or
215
- * active focused document before reads or writes are allowed. Support also
216
- * varies by operation and payload type: text helpers are the most portable,
217
- * while `ClipboardItem` and non-text MIME types may be unavailable or restricted
218
- * in some browsers. Failed browser operations are surfaced as `ClipboardError`.
219
- *
220
41
  * @since 4.0.0
221
42
  */
222
43
  export * as Clipboard from "./Clipboard.ts";
223
44
  /**
224
- * Browser geolocation support for Effect programs.
225
- *
226
- * This module provides a `Geolocation` service and browser-backed layer for
227
- * reading device location through `navigator.geolocation`. Use
228
- * `getCurrentPosition` when an application needs one location fix, such as a
229
- * nearby-search, check-in, or delivery estimate, and `watchPosition` when it
230
- * needs a stream of updates for navigation, tracking, or location-aware UI.
231
- *
232
- * The implementation is browser-only and relies on the browser permission and
233
- * policy model for geolocation. Calls may prompt the user, fail when permission
234
- * is denied, time out, or report that position data is unavailable because of
235
- * device, browser, privacy, origin, or secure-context restrictions. Watched
236
- * positions are scoped so the underlying browser watch is cleared when the
237
- * stream is finalized, and slow consumers should account for the sliding
238
- * buffer used by `watchPosition`.
239
- *
240
45
  * @since 4.0.0
241
46
  */
242
47
  export * as Geolocation from "./Geolocation.ts";
243
48
  /**
244
- * Browser IndexedDB primitives and key schemas for Effect applications.
245
- *
246
- * This module is the low-level bridge used by the platform-browser IndexedDB
247
- * integration. It provides an `IndexedDb` service around the browser
248
- * `indexedDB` factory and `IDBKeyRange` constructor, a `layerWindow` layer for
249
- * wiring those primitives from `window`, and schemas for the key shapes accepted
250
- * by IndexedDB object stores and indexes.
251
- *
252
- * Use it when building typed local persistence for browser caches,
253
- * offline-first state, background queues, drafts, or other client-side data
254
- * that should be validated before it reaches IndexedDB. Higher-level database,
255
- * version, table, and query modules build on these primitives for migrations
256
- * and typed transactions.
257
- *
258
- * IndexedDB still follows the browser rules: schema changes happen only during
259
- * version upgrades, upgrades may be blocked by other open tabs or connections,
260
- * and reads or writes must run in transactions scoped to the object stores they
261
- * touch. The `layerWindow` constructor should be used only where browser
262
- * globals are available, and code that also runs during SSR or in restricted
263
- * browser contexts should account for `indexedDB` or `IDBKeyRange` being
264
- * missing.
265
- *
266
49
  * @since 4.0.0
267
50
  */
268
51
  export * as IndexedDb from "./IndexedDb.ts";
269
52
  /**
270
- * Builds and opens typed IndexedDB databases from versioned schema migrations.
271
- *
272
- * This module turns an `IndexedDbVersion` migration chain into an
273
- * `IndexedDbDatabase` layer. The layer opens the browser database, runs any
274
- * pending upgrade migrations, provides a query builder for the current schema,
275
- * and exposes a `rebuild` effect that deletes and reopens the database. It is
276
- * the database-level companion to the table, version, and query builder
277
- * modules.
278
- *
279
- * Use it for browser-local persistence such as offline-first application
280
- * state, cached server data, background queues, drafts, and other client-side
281
- * stores that need typed reads and writes backed by IndexedDB transactions.
282
- *
283
- * IndexedDB schema changes can only happen inside upgrade transactions, so
284
- * every call to `make` or `.add` represents the next browser database version
285
- * and only migrations after the existing browser version are run. Table and
286
- * index definitions type the migration and query APIs, but object stores and
287
- * indexes still need to be created or removed explicitly with the migration
288
- * transaction helpers. Include the complete target table set in each version,
289
- * create indexes before querying them, and treat key path or auto-increment
290
- * changes as store migrations that copy data into a replacement object store.
291
- * Upgrades can be blocked by other open connections, and all migration reads,
292
- * writes, store changes, and index changes share the single upgrade
293
- * transaction supplied by the browser.
294
- *
295
53
  * @since 4.0.0
296
54
  */
297
55
  export * as IndexedDbDatabase from "./IndexedDbDatabase.ts";
298
56
  /**
299
- * Builds effectful, schema-aware queries for typed browser IndexedDB versions.
300
- *
301
- * An `IndexedDbQueryBuilder` is created from an open database and a version's
302
- * table descriptors, then exposes `from(tableName)` as the entry point for
303
- * table operations. The resulting query objects can select, count, delete,
304
- * insert, upsert, clear tables, stream paged reads, react to invalidations, and
305
- * run multiple effects in a shared `IDBTransaction` with `withTransaction`.
306
- *
307
- * Use this module for local browser persistence such as caches, offline-first
308
- * state, background queues, drafts, and other client-side data where writes
309
- * should be encoded through `Schema` and reads should be decoded before they
310
- * reach application code.
311
- *
312
- * Index and range helpers are thinly typed wrappers around IndexedDB object
313
- * stores, indexes, `IDBKeyRange`, and cursors. Index names must be declared on
314
- * the table and created during migrations; without an index, queries use the
315
- * object store key path. Range values are encoded IndexedDB key values, and
316
- * compound key paths must follow the declared key order. Filters, offsets,
317
- * reverse reads, out-of-line keys, and limited deletes require cursor-based
318
- * scans, while simpler selects can use `getAll`.
319
- *
320
- * Table schema details affect runtime behavior: auto-increment writes may omit
321
- * the generated numeric key, stores without a key path require an out-of-line
322
- * `key` for writes and add that `key` back to selected rows, and schema
323
- * mismatches surface as `EncodeError` or `DecodeError` query failures.
324
- *
325
57
  * @since 4.0.0
326
58
  */
327
59
  export * as IndexedDbQueryBuilder from "./IndexedDbQueryBuilder.ts";
328
60
  /**
329
- * Defines typed table descriptors for the browser IndexedDB integration.
330
- *
331
- * An `IndexedDbTable` records the object store name, row schema, primary key
332
- * path, indexes, auto-increment behavior, and transaction durability used by
333
- * database versions, migrations, and typed queries. These descriptors are
334
- * useful for local caches, offline-first application state, background queues,
335
- * drafts, and other browser-persisted data that should be validated through
336
- * `Schema`.
337
- *
338
- * Key paths and index paths must reference encoded schema fields whose values
339
- * are valid IndexedDB keys, and compound paths are represented as readonly
340
- * arrays. Tables without a key path use an out-of-line `key` that is added to
341
- * reads and required for writes, so the row schema itself cannot define a
342
- * `key` field. Auto-increment tables require a numeric key path; when that key
343
- * is omitted on write, the module uses a derived schema without the generated
344
- * key. Declaring indexes here types query builder index selection, but the
345
- * indexes still need to be created during database migrations.
346
- *
347
61
  * @since 4.0.0
348
62
  */
349
63
  export * as IndexedDbTable from "./IndexedDbTable.ts";
350
64
  /**
351
- * Typed IndexedDB schema version definitions.
352
- *
353
- * This module represents one logical IndexedDB database version as a non-empty set of `IndexedDbTable` definitions.
354
- * Versions are consumed by `IndexedDbDatabase.make` and `.add` to type query builders and migration transactions, so
355
- * applications can describe the tables available after initialization or after each schema upgrade.
356
- *
357
- * Use an `IndexedDbVersion` when defining the initial stores for a browser database, adding or removing object stores,
358
- * changing indexes, or moving data between differently shaped table schemas. The version value is a typed description of
359
- * the target schema; creating and deleting object stores or indexes still happens explicitly inside the corresponding
360
- * `IndexedDbDatabase` migration callback.
361
- *
362
- * IndexedDB versioning is ordered by the migration chain rather than by a number stored here. Each `.add` step becomes
363
- * the next browser database version, and only migrations after the browser's current version are run. Include every table
364
- * that should be queryable in each target version, avoid duplicate table names, and remember that key-path or
365
- * auto-increment changes usually require creating a new object store and copying data during the upgrade transaction.
366
- *
367
65
  * @since 4.0.0
368
66
  */
369
67
  export * as IndexedDbVersion from "./IndexedDbVersion.ts";
370
68
  /**
371
- * Browser Permissions API support for Effect programs.
372
- *
373
- * This module provides a `Permissions` service and browser-backed layer for
374
- * querying `navigator.permissions` from Effect code. Use it to check whether a
375
- * browser capability is currently `granted`, `prompt`, or `denied` before
376
- * showing UI for flows such as geolocation, notifications, clipboard access,
377
- * camera, microphone, or persistent storage.
378
- *
379
- * Permission queries do not request access by themselves and should not replace
380
- * the feature API that actually performs the operation. Browser support for
381
- * permission names and states is uneven, queries may reject for unsupported or
382
- * invalid descriptors, and some permissions are only meaningful in secure
383
- * contexts or after user activation. Returned `PermissionStatus` objects can
384
- * change when the user updates browser settings or responds to prompts; when
385
- * watching `change` or `onchange`, account for browser differences and clean up
386
- * listeners when the surrounding Effect scope ends.
387
- *
388
69
  * @since 4.0.0
389
70
  */
390
71
  export * as Permissions from "./Permissions.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;GAIG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAA;AAEjE;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,m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