@junobuild/admin 0.0.38 → 0.0.40

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.
@@ -1,14 +1,6 @@
1
1
  import type {ActorMethod} from '@dfinity/agent';
2
2
  import type {Principal} from '@dfinity/principal';
3
3
 
4
- export interface CanisterStatusResponse {
5
- status: CanisterStatusType;
6
- memory_size: bigint;
7
- cycles: bigint;
8
- settings: DefiniteCanisterSettings;
9
- idle_cycles_burned_per_day: bigint;
10
- module_hash: [] | [Uint8Array | number[]];
11
- }
12
4
  export type CanisterStatusType = {stopped: null} | {stopping: null} | {running: null};
13
5
  export interface Controller {
14
6
  updated_at: bigint;
@@ -45,9 +37,17 @@ export interface Satellite {
45
37
  created_at: bigint;
46
38
  satellite_id: Principal;
47
39
  }
40
+ export interface SegmentCanisterStatus {
41
+ status: CanisterStatusType;
42
+ memory_size: bigint;
43
+ cycles: bigint;
44
+ settings: DefiniteCanisterSettings;
45
+ idle_cycles_burned_per_day: bigint;
46
+ module_hash: [] | [Uint8Array | number[]];
47
+ }
48
48
  export interface SegmentStatus {
49
49
  id: Principal;
50
- status: CanisterStatusResponse;
50
+ status: SegmentCanisterStatus;
51
51
  metadata: [] | [Array<[string, string]>];
52
52
  status_at: bigint;
53
53
  }
@@ -92,6 +92,7 @@ export interface _SERVICE {
92
92
  remove_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
93
93
  set_metadata: ActorMethod<[Array<[string, string]>], undefined>;
94
94
  set_mission_control_controllers: ActorMethod<[Array<Principal>, SetController], undefined>;
95
+ set_orbiter: ActorMethod<[Principal, [] | [string]], Orbiter>;
95
96
  set_orbiter_metadata: ActorMethod<[Principal, Array<[string, string]>], Orbiter>;
96
97
  set_orbiters_controllers: ActorMethod<
97
98
  [Array<Principal>, Array<Principal>, SetController],
@@ -38,7 +38,7 @@ export const idlFactory = ({IDL}) => {
38
38
  memory_allocation: IDL.Nat,
39
39
  compute_allocation: IDL.Nat
40
40
  });
41
- const CanisterStatusResponse = IDL.Record({
41
+ const SegmentCanisterStatus = IDL.Record({
42
42
  status: CanisterStatusType,
43
43
  memory_size: IDL.Nat,
44
44
  cycles: IDL.Nat,
@@ -48,7 +48,7 @@ export const idlFactory = ({IDL}) => {
48
48
  });
49
49
  const SegmentStatus = IDL.Record({
50
50
  id: IDL.Principal,
51
- status: CanisterStatusResponse,
51
+ status: SegmentCanisterStatus,
52
52
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
53
53
  status_at: IDL.Nat64
54
54
  });
@@ -112,6 +112,7 @@ export const idlFactory = ({IDL}) => {
112
112
  ),
113
113
  set_metadata: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], [], []),
114
114
  set_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal), SetController], [], []),
115
+ set_orbiter: IDL.Func([IDL.Principal, IDL.Opt(IDL.Text)], [Orbiter], []),
115
116
  set_orbiter_metadata: IDL.Func(
116
117
  [IDL.Principal, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
117
118
  [Orbiter],
@@ -28,6 +28,15 @@ export interface GetAnalytics {
28
28
  from: [] | [bigint];
29
29
  satellite_id: [] | [Principal];
30
30
  }
31
+ export interface MemorySize {
32
+ stable: bigint;
33
+ heap: bigint;
34
+ }
35
+ export interface OrbiterSatelliteConfig {
36
+ updated_at: bigint;
37
+ created_at: bigint;
38
+ enabled: boolean;
39
+ }
31
40
  export interface PageView {
32
41
  title: string;
33
42
  updated_at: bigint;
@@ -47,11 +56,6 @@ export interface PageViewDevice {
47
56
  export type Result = {Ok: PageView} | {Err: string};
48
57
  export type Result_1 = {Ok: null} | {Err: Array<[AnalyticKey, string]>};
49
58
  export type Result_2 = {Ok: TrackEvent} | {Err: string};
50
- export interface SatelliteConfig {
51
- updated_at: bigint;
52
- created_at: bigint;
53
- enabled: boolean;
54
- }
55
59
  export interface SetController {
56
60
  metadata: Array<[string, string]>;
57
61
  scope: ControllerScope;
@@ -99,13 +103,14 @@ export interface _SERVICE {
99
103
  get_page_views: ActorMethod<[GetAnalytics], Array<[AnalyticKey, PageView]>>;
100
104
  get_track_events: ActorMethod<[GetAnalytics], Array<[AnalyticKey, TrackEvent]>>;
101
105
  list_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
102
- list_satellite_configs: ActorMethod<[], Array<[Principal, SatelliteConfig]>>;
106
+ list_satellite_configs: ActorMethod<[], Array<[Principal, OrbiterSatelliteConfig]>>;
107
+ memory_size: ActorMethod<[], MemorySize>;
103
108
  set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>;
104
109
  set_page_view: ActorMethod<[AnalyticKey, SetPageView], Result>;
105
110
  set_page_views: ActorMethod<[Array<[AnalyticKey, SetPageView]>], Result_1>;
106
111
  set_satellite_configs: ActorMethod<
107
112
  [Array<[Principal, SetSatelliteConfig]>],
108
- Array<[Principal, SatelliteConfig]>
113
+ Array<[Principal, OrbiterSatelliteConfig]>
109
114
  >;
110
115
  set_track_event: ActorMethod<[AnalyticKey, SetTrackEvent], Result_2>;
111
116
  set_track_events: ActorMethod<[Array<[AnalyticKey, SetTrackEvent]>], Result_1>;
@@ -52,11 +52,12 @@ export const idlFactory = ({IDL}) => {
52
52
  created_at: IDL.Nat64,
53
53
  satellite_id: IDL.Principal
54
54
  });
55
- const SatelliteConfig = IDL.Record({
55
+ const OrbiterSatelliteConfig = IDL.Record({
56
56
  updated_at: IDL.Nat64,
57
57
  created_at: IDL.Nat64,
58
58
  enabled: IDL.Bool
59
59
  });
60
+ const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
60
61
  const SetController = IDL.Record({
61
62
  metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
62
63
  scope: ControllerScope,
@@ -116,9 +117,10 @@ export const idlFactory = ({IDL}) => {
116
117
  list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']),
117
118
  list_satellite_configs: IDL.Func(
118
119
  [],
119
- [IDL.Vec(IDL.Tuple(IDL.Principal, SatelliteConfig))],
120
+ [IDL.Vec(IDL.Tuple(IDL.Principal, OrbiterSatelliteConfig))],
120
121
  ['query']
121
122
  ),
123
+ memory_size: IDL.Func([], [MemorySize], ['query']),
122
124
  set_controllers: IDL.Func(
123
125
  [SetControllersArgs],
124
126
  [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
@@ -128,7 +130,7 @@ export const idlFactory = ({IDL}) => {
128
130
  set_page_views: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetPageView))], [Result_1], []),
129
131
  set_satellite_configs: IDL.Func(
130
132
  [IDL.Vec(IDL.Tuple(IDL.Principal, SetSatelliteConfig))],
131
- [IDL.Vec(IDL.Tuple(IDL.Principal, SatelliteConfig))],
133
+ [IDL.Vec(IDL.Tuple(IDL.Principal, OrbiterSatelliteConfig))],
132
134
  []
133
135
  ),
134
136
  set_track_event: IDL.Func([AnalyticKey, SetTrackEvent], [Result_2], []),
@@ -117,6 +117,10 @@ export interface ListResults_1 {
117
117
  items_length: bigint;
118
118
  }
119
119
  export type Memory = {Heap: null} | {Stable: null};
120
+ export interface MemorySize {
121
+ stable: bigint;
122
+ heap: bigint;
123
+ }
120
124
  export type Permission = {Controllers: null} | {Private: null} | {Public: null} | {Managed: null};
121
125
  export interface Rule {
122
126
  memory: [] | [Memory];
@@ -190,6 +194,8 @@ export interface UploadChunkResult {
190
194
  }
191
195
  export interface _SERVICE {
192
196
  commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
197
+ count_assets: ActorMethod<[string], bigint>;
198
+ count_docs: ActorMethod<[string], bigint>;
193
199
  del_asset: ActorMethod<[string, string], undefined>;
194
200
  del_assets: ActorMethod<[string], undefined>;
195
201
  del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>;
@@ -202,6 +208,7 @@ export interface _SERVICE {
202
208
  deposit_cycles: ActorMethod<[DepositCyclesArgs], undefined>;
203
209
  get_config: ActorMethod<[], Config>;
204
210
  get_doc: ActorMethod<[string, string], [] | [Doc]>;
211
+ get_many_docs: ActorMethod<[Array<[string, string]>], Array<[string, [] | [Doc]]>>;
205
212
  http_request: ActorMethod<[HttpRequest], HttpResponse>;
206
213
  http_request_streaming_callback: ActorMethod<
207
214
  [StreamingCallbackToken],
@@ -213,6 +220,7 @@ export interface _SERVICE {
213
220
  list_custom_domains: ActorMethod<[], Array<[string, CustomDomain]>>;
214
221
  list_docs: ActorMethod<[string, ListParams], ListResults_1>;
215
222
  list_rules: ActorMethod<[RulesType], Array<[string, Rule]>>;
223
+ memory_size: ActorMethod<[], MemorySize>;
216
224
  set_config: ActorMethod<[Config], undefined>;
217
225
  set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>;
218
226
  set_custom_domain: ActorMethod<[string, [] | [string]], undefined>;
@@ -164,6 +164,7 @@ export const idlFactory = ({IDL}) => {
164
164
  mutable_permissions: IDL.Opt(IDL.Bool),
165
165
  write: Permission
166
166
  });
167
+ const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
167
168
  const SetController = IDL.Record({
168
169
  metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
169
170
  scope: ControllerScope,
@@ -194,6 +195,8 @@ export const idlFactory = ({IDL}) => {
194
195
  const UploadChunkResult = IDL.Record({chunk_id: IDL.Nat});
195
196
  return IDL.Service({
196
197
  commit_asset_upload: IDL.Func([CommitBatch], [], []),
198
+ count_assets: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
199
+ count_docs: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
197
200
  del_asset: IDL.Func([IDL.Text, IDL.Text], [], []),
198
201
  del_assets: IDL.Func([IDL.Text], [], []),
199
202
  del_controllers: IDL.Func(
@@ -210,6 +213,11 @@ export const idlFactory = ({IDL}) => {
210
213
  deposit_cycles: IDL.Func([DepositCyclesArgs], [], []),
211
214
  get_config: IDL.Func([], [Config], []),
212
215
  get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
216
+ get_many_docs: IDL.Func(
217
+ [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
218
+ [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(Doc)))],
219
+ ['query']
220
+ ),
213
221
  http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
214
222
  http_request_streaming_callback: IDL.Func(
215
223
  [StreamingCallbackToken],
@@ -222,6 +230,7 @@ export const idlFactory = ({IDL}) => {
222
230
  list_custom_domains: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, CustomDomain))], ['query']),
223
231
  list_docs: IDL.Func([IDL.Text, ListParams], [ListResults_1], ['query']),
224
232
  list_rules: IDL.Func([RulesType], [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], ['query']),
233
+ memory_size: IDL.Func([], [MemorySize], ['query']),
225
234
  set_config: IDL.Func([Config], [], []),
226
235
  set_controllers: IDL.Func(
227
236
  [SetControllersArgs],
@@ -164,6 +164,7 @@ export const idlFactory = ({IDL}) => {
164
164
  mutable_permissions: IDL.Opt(IDL.Bool),
165
165
  write: Permission
166
166
  });
167
+ const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
167
168
  const SetController = IDL.Record({
168
169
  metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
169
170
  scope: ControllerScope,
@@ -194,6 +195,8 @@ export const idlFactory = ({IDL}) => {
194
195
  const UploadChunkResult = IDL.Record({chunk_id: IDL.Nat});
195
196
  return IDL.Service({
196
197
  commit_asset_upload: IDL.Func([CommitBatch], [], []),
198
+ count_assets: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
199
+ count_docs: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
197
200
  del_asset: IDL.Func([IDL.Text, IDL.Text], [], []),
198
201
  del_assets: IDL.Func([IDL.Text], [], []),
199
202
  del_controllers: IDL.Func(
@@ -210,6 +213,11 @@ export const idlFactory = ({IDL}) => {
210
213
  deposit_cycles: IDL.Func([DepositCyclesArgs], [], []),
211
214
  get_config: IDL.Func([], [Config], []),
212
215
  get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
216
+ get_many_docs: IDL.Func(
217
+ [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
218
+ [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(Doc)))],
219
+ ['query']
220
+ ),
213
221
  http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
214
222
  http_request_streaming_callback: IDL.Func(
215
223
  [StreamingCallbackToken],
@@ -222,6 +230,7 @@ export const idlFactory = ({IDL}) => {
222
230
  list_custom_domains: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, CustomDomain))], ['query']),
223
231
  list_docs: IDL.Func([IDL.Text, ListParams], [ListResults_1], ['query']),
224
232
  list_rules: IDL.Func([RulesType], [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], ['query']),
233
+ memory_size: IDL.Func([], [MemorySize], ['query']),
225
234
  set_config: IDL.Func([Config], [], []),
226
235
  set_controllers: IDL.Func(
227
236
  [SetControllersArgs],
@@ -1,14 +1,14 @@
1
- var ir=Object.defineProperty;var sr=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})};import{Principal as Tr}from"@dfinity/principal";import{Principal as He}from"@dfinity/principal";var $e=({IDL:e})=>{let t=e.Variant({mainnet:e.Null,testnet:e.Null}),r=e.Text,n=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),o=e.Nat64,i=e.Record({network:t}),s=e.Nat64,l=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),u=e.Vec(e.Nat8),c=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),d=e.Record({height:e.Nat32,value:o,outpoint:c}),h=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:u,utxos:e.Vec(d)}),x=e.Record({transaction:e.Vec(e.Nat8),network:t}),a=e.Principal,p=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),f=e.Variant({creation:e.Record({controllers:e.Vec(e.Principal)}),code_deployment:e.Record({mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),module_hash:e.Vec(e.Nat8)}),controllers_change:e.Record({controllers:e.Vec(e.Principal)}),code_uninstall:e.Null}),y=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:p,details:f}),g=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),_=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),N=e.Variant({secp256k1:e.Null}),v=e.Record({value:e.Text,name:e.Text}),R=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(v)}),P=e.Vec(e.Nat8);return e.Service({bitcoin_get_balance:e.Func([n],[o],[]),bitcoin_get_current_fee_percentiles:e.Func([i],[e.Vec(s)],[]),bitcoin_get_utxos:e.Func([l],[h],[]),bitcoin_send_transaction:e.Func([x],[],[]),canister_info:e.Func([e.Record({canister_id:a,num_requested_changes:e.Opt(e.Nat64)})],[e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(y),total_num_changes:e.Nat64})],[]),canister_status:e.Func([e.Record({canister_id:a})],[e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:g,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))})],[]),create_canister:e.Func([e.Record({settings:e.Opt(_),sender_canister_version:e.Opt(e.Nat64)})],[e.Record({canister_id:a})],[]),delete_canister:e.Func([e.Record({canister_id:a})],[],[]),deposit_cycles:e.Func([e.Record({canister_id:a})],[],[]),ecdsa_public_key:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:N}),canister_id:e.Opt(a),derivation_path:e.Vec(e.Vec(e.Nat8))})],[e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)})],[]),http_request:e.Func([e.Record({url:e.Text,method:e.Variant({get:e.Null,head:e.Null,post:e.Null}),max_response_bytes:e.Opt(e.Nat64),body:e.Opt(e.Vec(e.Nat8)),transform:e.Opt(e.Record({function:e.Func([e.Record({context:e.Vec(e.Nat8),response:R})],[R],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(v)})],[R],[]),install_code:e.Func([e.Record({arg:e.Vec(e.Nat8),wasm_module:P,mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),provisional_create_canister_with_cycles:e.Func([e.Record({settings:e.Opt(_),specified_id:e.Opt(a),amount:e.Opt(e.Nat)})],[e.Record({canister_id:a})],[]),provisional_top_up_canister:e.Func([e.Record({canister_id:a,amount:e.Nat})],[],[]),raw_rand:e.Func([],[e.Vec(e.Nat8)],[]),sign_with_ecdsa:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:N}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)})],[e.Record({signature:e.Vec(e.Nat8)})],[]),start_canister:e.Func([e.Record({canister_id:a})],[],[]),stop_canister:e.Func([e.Record({canister_id:a})],[],[]),uninstall_code:e.Func([e.Record({canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),update_settings:e.Func([e.Record({canister_id:e.Principal,settings:_,sender_canister_version:e.Opt(e.Nat64)})],[],[])})};var Be=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),s=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),l=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:s,memory_size:e.Nat,cycles:e.Nat,settings:l,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),c=e.Record({id:e.Principal,status:u,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),d=e.Variant({Ok:c,Err:e.Text}),h=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),x=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),a=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,x)),satellites:e.Vec(e.Tuple(e.Principal,x)),cycles_threshold:e.Opt(e.Nat64)}),p=e.Record({orbiters:e.Opt(e.Vec(d)),satellites:e.Opt(e.Vec(d)),mission_control:d}),f=e.Record({e8s:e.Nat64});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_satellite:e.Func([e.Text],[r],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,d))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),h],[],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),status:e.Func([a],[p],[]),top_up:e.Func([e.Principal,f],[],[]),version:e.Func([],[e.Text],["query"])})};var Me=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:r,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({cycles:e.Nat,destination_id:e.Principal}),s=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),u=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),c=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),d=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal}),h=e.Record({updated_at:e.Nat64,created_at:e.Nat64,enabled:e.Bool}),x=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),a=e.Record({controller:x,controllers:e.Vec(e.Principal)}),p=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),f=e.Variant({Ok:c,Err:e.Text}),y=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),g=e.Record({updated_at:e.Opt(e.Nat64),enabled:e.Bool}),_=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,user_agent:e.Opt(e.Text)}),N=e.Variant({Ok:d,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(l,c))],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(l,d))],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,h))],["query"]),set_controllers:e.Func([a],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,p],[f],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,p))],[y],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,g))],[e.Vec(e.Tuple(e.Principal,h))],[]),set_track_event:e.Func([l,_],[N],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,_))],[y],[]),version:e.Func([],[e.Text],["query"])})};var Ue=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),x=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),p=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),_=e.Record({order:e.Opt(y),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),S=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),X=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),Z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),I=e.Record({controller:Z,controllers:e.Vec(e.Principal)}),L=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),D=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),j=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),ee=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([c],[x],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),_],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,S))],["query"]),list_docs:e.Func([e.Text,_],[F],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,X))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([I],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,L],[l],[]),set_rule:e.Func([k,e.Text,D],[],[]),upload_asset_chunk:e.Func([j],[ee],[]),version:e.Func([],[e.Text],["query"])})};var qe=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),x=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),p=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),_=e.Record({order:e.Opt(y),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),S=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),X=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),Z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),I=e.Record({controller:Z,controllers:e.Vec(e.Principal)}),L=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),D=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),j=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),ee=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([c],[x],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),_],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,S))],["query"]),list_docs:e.Func([e.Text,_],[F],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,X))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([I],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,L],[l],[]),set_rule:e.Func([k,e.Text,D],[],[]),upload_asset_chunk:e.Func([j],[ee],[]),version:e.Func([],[e.Text],["query"])})};var je=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Variant({Db:e.Null,Storage:e.Null}),l=e.Record({cycles:e.Nat,destination_id:e.Principal}),u=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),c=e.Record({status_code:e.Nat16,location:e.Text}),d=e.Record({iframe:e.Opt(u),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),redirects:e.Opt(e.Vec(e.Tuple(e.Text,c)))}),h=e.Record({storage:d}),x=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),a=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),p=e.Variant({Heap:e.Null,Stable:e.Null}),f=e.Record({memory:p,token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),y=e.Variant({Callback:e.Record({token:f,callback:e.Func([],[],["query"])})}),g=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(y),status_code:e.Nat16}),_=e.Record({token:e.Opt(f),body:e.Vec(e.Nat8)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,description:e.Opt(e.Text),encoding_type:e.Opt(e.Text),full_path:e.Text}),v=e.Record({batch_id:e.Nat}),R=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),P=e.Record({field:R,desc:e.Bool}),S=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),F=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),k=e.Record({order:e.Opt(P),owner:e.Opt(e.Principal),matcher:e.Opt(S),paginate:e.Opt(F)}),E=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),X=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),Z=e.Record({key:E,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,X)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),I=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,Z)),items_length:e.Nat64}),L=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),D=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,x)),items_length:e.Nat64}),j=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ee=e.Record({memory:e.Opt(p),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:j,created_at:e.Nat64,mutable_permissions:e.Opt(e.Bool),write:j}),er=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),tr=e.Record({controller:er,controllers:e.Vec(e.Principal)}),ke=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),rr=e.Record({memory:e.Opt(p),updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:j,mutable_permissions:e.Opt(e.Bool),write:j}),nr=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),or=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,i))],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),deposit_cycles:e.Func([l],[],[]),get_config:e.Func([],[h],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(x)],["query"]),http_request:e.Func([a],[g],["query"]),http_request_streaming_callback:e.Func([f],[_],["query"]),init_asset_upload:e.Func([N],[v],[]),list_assets:e.Func([e.Text,k],[I],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,L))],["query"]),list_docs:e.Func([e.Text,k],[D],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,ee))],["query"]),set_config:e.Func([h],[],[]),set_controllers:e.Func([tr],[e.Vec(e.Tuple(e.Principal,o))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,ke],[x],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,ke))],[e.Vec(e.Tuple(e.Text,x))],[]),set_rule:e.Func([s,e.Text,rr],[],[]),upload_asset_chunk:e.Func([nr],[or],[]),version:e.Func([],[e.Text],["query"])})};import{Actor as ar,HttpAgent as cr}from"@dfinity/agent";var Ne=async({canisterId:e,idlFactory:t,identity:r,fetch:n,env:o="prod",config:i})=>{let s=o==="dev"?"http://127.0.0.1:8000/":"https://icp-api.io",l=new cr({identity:r,...s&&{host:s},...n&&{fetch:n}});return o==="dev"&&await l.fetchRootKey(),ar.createActor(t,{agent:l,canisterId:e,...i!==void 0?i:{}})};var Ke=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:qe}),W=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:je}),We=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:Ue}),te=async({missionControlId:e,...t})=>re({canisterId:e,...t,idlFactory:Be}),ve=async({orbiterId:e,...t})=>re({canisterId:e,...t,idlFactory:Me}),re=async({canisterId:e,idlFactory:t,...r})=>{if(!e)throw new Error("No canister ID provided.");return Ne({canisterId:e,idlFactory:t,...r})},Je=He.fromText("aaaaa-aa"),ze=(e,t,r)=>{let n=t[0],o=Je;return n&&typeof n=="object"&&n.canister_id&&(o=He.from(n.canister_id)),{effectiveCanisterId:o}},Ge=e=>Ne({canisterId:Je.toText(),config:{callTransform:ze,queryTransform:ze},idlFactory:$e,...e});var J=async({actor:e,code:t})=>{let{install_code:r}=await Ge(e);return r({...t,sender_canister_version:[]})};var Ye=async({missionControl:e})=>(await te(e)).version(),Qe=async({missionControl:e})=>(await te(e)).get_user();var Xe=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await te(e)).set_satellites_controllers(t,r,n),Ze=async({missionControl:e,controllerIds:t,controller:r})=>(await te(e)).set_mission_control_controllers(t,r);import{Principal as lr}from"@dfinity/principal";import{nonNullish as ur,toNullable as pr}from"@junobuild/utils";var Ve=({controllerId:e,profile:t})=>({controllerIds:[lr.fromText(e)],controller:dr(t)}),dr=e=>({metadata:ur(e)&&e!==""?[["profile",e]]:[],expires_at:pr(void 0),scope:{Admin:null}});var C={};sr(C,{Bool:()=>nt,BoolClass:()=>de,ConstructType:()=>B,Empty:()=>tt,EmptyClass:()=>ue,FixedIntClass:()=>q,FixedNatClass:()=>$,Float32:()=>ct,Float64:()=>lt,FloatClass:()=>oe,Func:()=>Vt,FuncClass:()=>se,Int:()=>st,Int16:()=>pt,Int32:()=>dt,Int64:()=>mt,Int8:()=>ut,IntClass:()=>fe,Nat:()=>at,Nat16:()=>ft,Nat32:()=>_t,Nat64:()=>yt,Nat8:()=>ht,NatClass:()=>_e,Null:()=>ot,NullClass:()=>me,Opt:()=>wt,OptClass:()=>Q,PrimitiveType:()=>O,Principal:()=>gt,PrincipalClass:()=>xe,Rec:()=>vt,RecClass:()=>K,Record:()=>bt,RecordClass:()=>ie,Reserved:()=>rt,ReservedClass:()=>Y,Service:()=>Rt,ServiceClass:()=>we,Text:()=>it,TextClass:()=>he,Tuple:()=>Tt,TupleClass:()=>ge,Type:()=>G,Unknown:()=>yr,UnknownClass:()=>pe,Variant:()=>Nt,VariantClass:()=>Te,Vec:()=>xt,VecClass:()=>ye,Visitor:()=>le,decode:()=>_r,encode:()=>fr});import{Principal as hr}from"@dfinity/principal";function m(...e){let t=new Uint8Array(e.reduce((n,o)=>n+o.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t}var M=class{constructor(t,r=t?.byteLength||0){this._buffer=t||new ArrayBuffer(0),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return this._view.slice()}get byteLength(){return this._view.byteLength}read(t){let r=this._view.subarray(0,t);return this._view=this._view.subarray(t),r.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let r=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+r.byteLength>=this._buffer.byteLength?this.alloc(r.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+r.byteLength),this._view.set(r,n)}get end(){return this._view.byteLength===0}alloc(t){let r=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(r,0,this._view.byteLength+t);n.set(this._view),this._buffer=r,this._view=n}};function mr(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function A(e){if(/^_\d+_$/.test(e)||/^_0x[0-9a-fA-F]+_$/.test(e)){let t=+e.slice(1,-1);if(Number.isSafeInteger(t)&&t>=0&&t<2**32)return t}return mr(e)}function Ie(){throw new Error("unexpected end of buffer")}function H(e,t){return e.byteLength<t&&Ie(),e.read(t)}function z(e){let t=e.readUint8();return t===void 0&&Ie(),t}function w(e){if(typeof e=="number"&&(e=BigInt(e)),e<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,r=new M(new ArrayBuffer(t),0);for(;;){let n=Number(e&BigInt(127));if(e/=BigInt(128),e===BigInt(0)){r.write(new Uint8Array([n]));break}else r.write(new Uint8Array([n|128]))}return r.buffer}function V(e){let t=BigInt(1),r=BigInt(0),n;do n=z(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function b(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,n=new M(new ArrayBuffer(r),0);for(;;){let i=o(e);if(e/=BigInt(128),t&&e===BigInt(0)&&i&64||!t&&e===BigInt(0)&&!(i&64)){n.write(new Uint8Array([i]));break}else n.write(new Uint8Array([i|128]))}function o(i){let s=i%BigInt(128);return Number(t?BigInt(128)-s-BigInt(1):s)}return n.buffer}function U(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return V(e);break}let n=new Uint8Array(H(e,r+1)),o=BigInt(0);for(let i=n.byteLength-1;i>=0;i--)o=o*BigInt(128)+BigInt(128-(n[i]&127)-1);return-o-BigInt(1)}function Le(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Re(e,t)}function Re(e,t){e=BigInt(e);let r=new M(new ArrayBuffer(Math.min(1,t)),0),n=0,o=BigInt(256),i=BigInt(0),s=Number(e%o);for(r.write(new Uint8Array([s]));++n<t;)e<0&&i===BigInt(0)&&s!==0&&(i=BigInt(1)),s=Number((e/o-i)%BigInt(256)),r.write(new Uint8Array([s])),o*=BigInt(256);return r.buffer}function Pe(e,t){let r=BigInt(z(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(z(e));r=r+n*i}return r}function De(e,t){let r=Pe(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function ae(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var ce="DIDL",et=400;function ne(e,t,r){return e.map((n,o)=>r(n,t[o]))}var Ce=class{constructor(){this._typs=[],this._idx=new Map}has(t){return this._idx.has(t.name)}add(t,r){let n=this._typs.length;this._idx.set(t.name,n),this._typs.push(r)}merge(t,r){let n=this._idx.get(t.name),o=this._idx.get(r);if(n===void 0)throw new Error("Missing type index for "+t);if(o===void 0)throw new Error("Missing type index for "+r);this._typs[n]=this._typs[o],this._typs.splice(o,1),this._idx.delete(r)}encode(){let t=w(this._typs.length),r=m(...this._typs);return m(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return b(this._idx.get(t)||0)}},le=class{visitType(t,r){throw new Error("Not implemented")}visitPrimitive(t,r){return this.visitType(t,r)}visitEmpty(t,r){return this.visitPrimitive(t,r)}visitBool(t,r){return this.visitPrimitive(t,r)}visitNull(t,r){return this.visitPrimitive(t,r)}visitReserved(t,r){return this.visitPrimitive(t,r)}visitText(t,r){return this.visitPrimitive(t,r)}visitNumber(t,r){return this.visitPrimitive(t,r)}visitInt(t,r){return this.visitNumber(t,r)}visitNat(t,r){return this.visitNumber(t,r)}visitFloat(t,r){return this.visitPrimitive(t,r)}visitFixedInt(t,r){return this.visitNumber(t,r)}visitFixedNat(t,r){return this.visitNumber(t,r)}visitPrincipal(t,r){return this.visitPrimitive(t,r)}visitConstruct(t,r){return this.visitType(t,r)}visitVec(t,r,n){return this.visitConstruct(t,n)}visitOpt(t,r,n){return this.visitConstruct(t,n)}visitRecord(t,r,n){return this.visitConstruct(t,n)}visitTuple(t,r,n){let o=r.map((i,s)=>[`_${s}_`,i]);return this.visitRecord(t,o,n)}visitVariant(t,r,n){return this.visitConstruct(t,n)}visitRec(t,r,n){return this.visitConstruct(r,n)}visitFunc(t,r){return this.visitConstruct(t,r)}visitService(t,r){return this.visitConstruct(t,r)}},G=class{display(){return this.name}valueToString(t){return T(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},O=class extends G{checkType(t){if(this.name!==t.name)throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`);return t}_buildTypeTableImpl(t){}},B=class extends G{checkType(t){if(t instanceof K){let r=t.getType();if(typeof r>"u")throw new Error("type mismatch with uninitialized type");return r}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}},ue=class extends O{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return b(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},pe=class extends G{checkType(t){throw new Error("Method not implemented for unknown.")}accept(t,r){throw t.visitType(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(){throw new Error("Unknown cannot appear as a function argument")}valueToString(){throw new Error("Unknown cannot appear as a value")}encodeType(){throw new Error("Unknown cannot be serialized")}decodeValue(t,r){let n=r.decodeValue(t,r);Object(n)!==n&&(n=Object(n));let o;return r instanceof K?o=()=>r.getType():o=()=>r,Object.defineProperty(n,"type",{value:o,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},de=class extends O{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return b(-2)}decodeValue(t,r){switch(this.checkType(r),z(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},me=class extends O{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return b(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},Y=class extends O{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return b(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},he=class extends O{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=w(r.byteLength);return m(n,r)}encodeType(){return b(-15)}decodeValue(t,r){this.checkType(r);let n=V(t),o=H(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},fe=class extends O{accept(t,r){return t.visitInt(this,r)}covariant(t){if(typeof t=="bigint"||Number.isInteger(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return b(t)}encodeType(){return b(-4)}decodeValue(t,r){return this.checkType(r),U(t)}get name(){return"int"}valueToString(t){return t.toString()}},_e=class extends O{accept(t,r){return t.visitNat(this,r)}covariant(t){if(typeof t=="bigint"&&t>=BigInt(0)||Number.isInteger(t)&&t>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return w(t)}encodeType(){return b(-3)}decodeValue(t,r){return this.checkType(r),V(t)}get name(){return"nat"}valueToString(t){return t.toString()}},oe=class extends O{constructor(t){if(super(),this._bits=t,t!==32&&t!==64)throw new Error("not a valid float type")}accept(t,r){return t.visitFloat(this,r)}covariant(t){if(typeof t=="number"||t instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=new ArrayBuffer(this._bits/8),n=new DataView(r);return this._bits===32?n.setFloat32(0,t,!0):n.setFloat64(0,t,!0),r}encodeType(){let t=this._bits===32?-13:-14;return b(t)}decodeValue(t,r){this.checkType(r);let n=H(t,this._bits/8),o=new DataView(n);return this._bits===32?o.getFloat32(0,!0):o.getFloat64(0,!0)}get name(){return"float"+this._bits}valueToString(t){return t.toString()}},q=class extends O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=ae(this._bits-1)*BigInt(-1),n=ae(this._bits-1)-BigInt(1),o=!1;if(typeof t=="bigint")o=t>=r&&t<=n;else if(Number.isInteger(t)){let i=BigInt(t);o=i>=r&&i<=n}else o=!1;if(o)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return Re(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return b(-9-t)}decodeValue(t,r){this.checkType(r);let n=De(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},$=class extends O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=ae(this._bits),n=!1;if(typeof t=="bigint"&&t>=BigInt(0)?n=t<r:Number.isInteger(t)&&t>=0?n=BigInt(t)<r:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return Le(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return b(-5-t)}decodeValue(t,r){this.checkType(r);let n=Pe(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},ye=class e extends B{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof $&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof $?this._type._bits:this._type instanceof q?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,o)=>{try{return this._type.covariant(n)}catch(i){throw new Error(`Invalid ${this.display()} argument:
1
+ var mr=Object.defineProperty;var hr=(e,t)=>{for(var r in t)mr(e,r,{get:t[r],enumerable:!0})};import{Principal as Rr}from"@dfinity/principal";import{Principal as He}from"@dfinity/principal";var $e=({IDL:e})=>{let t=e.Variant({mainnet:e.Null,testnet:e.Null}),r=e.Text,n=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),o=e.Nat64,i=e.Record({network:t}),s=e.Nat64,l=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),u=e.Vec(e.Nat8),c=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),d=e.Record({height:e.Nat32,value:o,outpoint:c}),f=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:u,utxos:e.Vec(d)}),g=e.Record({transaction:e.Vec(e.Nat8),network:t}),a=e.Principal,p=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),h=e.Variant({creation:e.Record({controllers:e.Vec(e.Principal)}),code_deployment:e.Record({mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),module_hash:e.Vec(e.Nat8)}),controllers_change:e.Record({controllers:e.Vec(e.Principal)}),code_uninstall:e.Null}),x=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:p,details:h}),y=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),_=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),w=e.Variant({secp256k1:e.Null}),b=e.Record({value:e.Text,name:e.Text}),P=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(b)}),R=e.Vec(e.Nat8);return e.Service({bitcoin_get_balance:e.Func([n],[o],[]),bitcoin_get_current_fee_percentiles:e.Func([i],[e.Vec(s)],[]),bitcoin_get_utxos:e.Func([l],[f],[]),bitcoin_send_transaction:e.Func([g],[],[]),canister_info:e.Func([e.Record({canister_id:a,num_requested_changes:e.Opt(e.Nat64)})],[e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(x),total_num_changes:e.Nat64})],[]),canister_status:e.Func([e.Record({canister_id:a})],[e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:y,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))})],[]),create_canister:e.Func([e.Record({settings:e.Opt(_),sender_canister_version:e.Opt(e.Nat64)})],[e.Record({canister_id:a})],[]),delete_canister:e.Func([e.Record({canister_id:a})],[],[]),deposit_cycles:e.Func([e.Record({canister_id:a})],[],[]),ecdsa_public_key:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:w}),canister_id:e.Opt(a),derivation_path:e.Vec(e.Vec(e.Nat8))})],[e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)})],[]),http_request:e.Func([e.Record({url:e.Text,method:e.Variant({get:e.Null,head:e.Null,post:e.Null}),max_response_bytes:e.Opt(e.Nat64),body:e.Opt(e.Vec(e.Nat8)),transform:e.Opt(e.Record({function:e.Func([e.Record({context:e.Vec(e.Nat8),response:P})],[P],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(b)})],[P],[]),install_code:e.Func([e.Record({arg:e.Vec(e.Nat8),wasm_module:R,mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),provisional_create_canister_with_cycles:e.Func([e.Record({settings:e.Opt(_),specified_id:e.Opt(a),amount:e.Opt(e.Nat)})],[e.Record({canister_id:a})],[]),provisional_top_up_canister:e.Func([e.Record({canister_id:a,amount:e.Nat})],[],[]),raw_rand:e.Func([],[e.Vec(e.Nat8)],[]),sign_with_ecdsa:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:w}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)})],[e.Record({signature:e.Vec(e.Nat8)})],[]),start_canister:e.Func([e.Record({canister_id:a})],[],[]),stop_canister:e.Func([e.Record({canister_id:a})],[],[]),uninstall_code:e.Func([e.Record({canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),update_settings:e.Func([e.Record({canister_id:e.Principal,settings:_,sender_canister_version:e.Opt(e.Nat64)})],[],[])})};var Be=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),s=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),l=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:s,memory_size:e.Nat,cycles:e.Nat,settings:l,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),c=e.Record({id:e.Principal,status:u,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),d=e.Variant({Ok:c,Err:e.Text}),f=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),g=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),a=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,g)),satellites:e.Vec(e.Tuple(e.Principal,g)),cycles_threshold:e.Opt(e.Nat64)}),p=e.Record({orbiters:e.Opt(e.Vec(d)),satellites:e.Opt(e.Vec(d)),mission_control:d}),h=e.Record({e8s:e.Nat64});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_satellite:e.Func([e.Text],[r],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,d))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),f],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[t],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),f],[],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),f],[],[]),status:e.Func([a],[p],[]),top_up:e.Func([e.Principal,h],[],[]),version:e.Func([],[e.Text],["query"])})};var Me=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:r,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({cycles:e.Nat,destination_id:e.Principal}),s=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),u=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),c=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),d=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal}),f=e.Record({updated_at:e.Nat64,created_at:e.Nat64,enabled:e.Bool}),g=e.Record({stable:e.Nat64,heap:e.Nat64}),a=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),p=e.Record({controller:a,controllers:e.Vec(e.Principal)}),h=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),x=e.Variant({Ok:c,Err:e.Text}),y=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),_=e.Record({updated_at:e.Opt(e.Nat64),enabled:e.Bool}),w=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,user_agent:e.Opt(e.Text)}),b=e.Variant({Ok:d,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(l,c))],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(l,d))],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,f))],["query"]),memory_size:e.Func([],[g],["query"]),set_controllers:e.Func([p],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,h],[x],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,h))],[y],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,_))],[e.Vec(e.Tuple(e.Principal,f))],[]),set_track_event:e.Func([l,w],[b],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,w))],[y],[]),version:e.Func([],[e.Text],["query"])})};var Ue=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),f=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),g=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),p=e.Record({batch_id:e.Nat}),h=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:h,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),_=e.Record({order:e.Opt(x),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),w=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),b=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:w,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,b)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),$=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),X=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),Z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),I=e.Record({controller:Z,controllers:e.Vec(e.Principal)}),D=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),L=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),j=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),ee=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([u],[f],["query"]),http_request_streaming_callback:e.Func([c],[g],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),_],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,_],[F],["query"]),list_rules:e.Func([$],[e.Vec(e.Tuple(e.Text,X))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([I],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,D],[l],[]),set_rule:e.Func([$,e.Text,L],[],[]),upload_asset_chunk:e.Func([j],[ee],[]),version:e.Func([],[e.Text],["query"])})};var qe=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),f=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),g=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),p=e.Record({batch_id:e.Nat}),h=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:h,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),_=e.Record({order:e.Opt(x),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),w=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),b=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:w,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,b)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),$=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),X=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),Z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),I=e.Record({controller:Z,controllers:e.Vec(e.Principal)}),D=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),L=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),j=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),ee=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([u],[f],["query"]),http_request_streaming_callback:e.Func([c],[g],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),_],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,_],[F],["query"]),list_rules:e.Func([$],[e.Vec(e.Tuple(e.Text,X))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([I],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,D],[l],[]),set_rule:e.Func([$,e.Text,L],[],[]),upload_asset_chunk:e.Func([j],[ee],[]),version:e.Func([],[e.Text],["query"])})};var ze=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Variant({Db:e.Null,Storage:e.Null}),l=e.Record({cycles:e.Nat,destination_id:e.Principal}),u=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),c=e.Record({status_code:e.Nat16,location:e.Text}),d=e.Record({iframe:e.Opt(u),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),redirects:e.Opt(e.Vec(e.Tuple(e.Text,c)))}),f=e.Record({storage:d}),g=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),a=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),p=e.Variant({Heap:e.Null,Stable:e.Null}),h=e.Record({memory:p,token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),x=e.Variant({Callback:e.Record({token:h,callback:e.Func([],[],["query"])})}),y=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(x),status_code:e.Nat16}),_=e.Record({token:e.Opt(h),body:e.Vec(e.Nat8)}),w=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,description:e.Opt(e.Text),encoding_type:e.Opt(e.Text),full_path:e.Text}),b=e.Record({batch_id:e.Nat}),P=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),R=e.Record({field:P,desc:e.Bool}),C=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),F=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),$=e.Record({order:e.Opt(R),owner:e.Opt(e.Principal),matcher:e.Opt(C),paginate:e.Opt(F)}),E=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),X=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),Z=e.Record({key:E,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,X)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),I=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,Z)),items_length:e.Nat64}),D=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),L=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,g)),items_length:e.Nat64}),j=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ee=e.Record({memory:e.Opt(p),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:j,created_at:e.Nat64,mutable_permissions:e.Opt(e.Bool),write:j}),ar=e.Record({stable:e.Nat64,heap:e.Nat64}),cr=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),lr=e.Record({controller:cr,controllers:e.Vec(e.Principal)}),ke=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),ur=e.Record({memory:e.Opt(p),updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:j,mutable_permissions:e.Opt(e.Bool),write:j}),pr=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),dr=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,i))],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),deposit_cycles:e.Func([l],[],[]),get_config:e.Func([],[f],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(g)],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(g)))],["query"]),http_request:e.Func([a],[y],["query"]),http_request_streaming_callback:e.Func([h],[_],["query"]),init_asset_upload:e.Func([w],[b],[]),list_assets:e.Func([e.Text,$],[I],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,D))],["query"]),list_docs:e.Func([e.Text,$],[L],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,ee))],["query"]),memory_size:e.Func([],[ar],["query"]),set_config:e.Func([f],[],[]),set_controllers:e.Func([lr],[e.Vec(e.Tuple(e.Principal,o))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,ke],[g],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,ke))],[e.Vec(e.Tuple(e.Text,g))],[]),set_rule:e.Func([s,e.Text,ur],[],[]),upload_asset_chunk:e.Func([pr],[dr],[]),version:e.Func([],[e.Text],["query"])})};import{Actor as fr,HttpAgent as _r}from"@dfinity/agent";var ve=async({canisterId:e,idlFactory:t,identity:r,fetch:n,env:o="prod",config:i})=>{let s=o==="dev"?"http://127.0.0.1:8000/":"https://icp-api.io",l=new _r({identity:r,...s&&{host:s},...n&&{fetch:n}});return o==="dev"&&await l.fetchRootKey(),fr.createActor(t,{agent:l,canisterId:e,...i!==void 0?i:{}})};var Ke=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:qe}),A=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:ze}),We=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:Ue}),te=async({missionControlId:e,...t})=>re({canisterId:e,...t,idlFactory:Be}),ae=async({orbiterId:e,...t})=>re({canisterId:e,...t,idlFactory:Me}),re=async({canisterId:e,idlFactory:t,...r})=>{if(!e)throw new Error("No canister ID provided.");return ve({canisterId:e,idlFactory:t,...r})},Je=He.fromText("aaaaa-aa"),je=(e,t,r)=>{let n=t[0],o=Je;return n&&typeof n=="object"&&n.canister_id&&(o=He.from(n.canister_id)),{effectiveCanisterId:o}},Ge=e=>ve({canisterId:Je.toText(),config:{callTransform:je,queryTransform:je},idlFactory:$e,...e});var J=async({actor:e,code:t})=>{let{install_code:r}=await Ge(e);return r({...t,sender_canister_version:[]})};var Ye=async({missionControl:e})=>(await te(e)).version(),Qe=async({missionControl:e})=>(await te(e)).get_user();var Xe=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await te(e)).set_satellites_controllers(t,r,n),Ze=async({missionControl:e,controllerIds:t,controller:r})=>(await te(e)).set_mission_control_controllers(t,r);import{Principal as yr}from"@dfinity/principal";import{nonNullish as gr,toNullable as xr}from"@junobuild/utils";var Ve=({controllerId:e,profile:t})=>({controllerIds:[yr.fromText(e)],controller:Tr(t)}),Tr=e=>({metadata:gr(e)&&e!==""?[["profile",e]]:[],expires_at:xr(void 0),scope:{Admin:null}});var S={};hr(S,{Bool:()=>nt,BoolClass:()=>me,ConstructType:()=>M,Empty:()=>tt,EmptyClass:()=>pe,FixedIntClass:()=>z,FixedNatClass:()=>B,Float32:()=>ct,Float64:()=>lt,FloatClass:()=>oe,Func:()=>Vt,FuncClass:()=>se,Int:()=>st,Int16:()=>pt,Int32:()=>dt,Int64:()=>mt,Int8:()=>ut,IntClass:()=>_e,Nat:()=>at,Nat16:()=>ft,Nat32:()=>_t,Nat64:()=>yt,Nat8:()=>ht,NatClass:()=>ye,Null:()=>ot,NullClass:()=>he,Opt:()=>wt,OptClass:()=>Q,PrimitiveType:()=>O,Principal:()=>gt,PrincipalClass:()=>we,Rec:()=>vt,RecClass:()=>W,Record:()=>bt,RecordClass:()=>ie,Reserved:()=>rt,ReservedClass:()=>Y,Service:()=>Pt,ServiceClass:()=>be,Text:()=>it,TextClass:()=>fe,Tuple:()=>xt,TupleClass:()=>xe,Type:()=>G,Unknown:()=>Vr,UnknownClass:()=>de,Variant:()=>Nt,VariantClass:()=>Te,Vec:()=>Tt,VecClass:()=>ge,Visitor:()=>ue,decode:()=>vr,encode:()=>Nr});import{Principal as br}from"@dfinity/principal";function m(...e){let t=new Uint8Array(e.reduce((n,o)=>n+o.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t}var U=class{constructor(t,r=t?.byteLength||0){this._buffer=t||new ArrayBuffer(0),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return this._view.slice()}get byteLength(){return this._view.byteLength}read(t){let r=this._view.subarray(0,t);return this._view=this._view.subarray(t),r.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let r=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+r.byteLength>=this._buffer.byteLength?this.alloc(r.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+r.byteLength),this._view.set(r,n)}get end(){return this._view.byteLength===0}alloc(t){let r=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(r,0,this._view.byteLength+t);n.set(this._view),this._buffer=r,this._view=n}};function wr(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function k(e){if(/^_\d+_$/.test(e)||/^_0x[0-9a-fA-F]+_$/.test(e)){let t=+e.slice(1,-1);if(Number.isSafeInteger(t)&&t>=0&&t<2**32)return t}return wr(e)}function Ie(){throw new Error("unexpected end of buffer")}function K(e,t){return e.byteLength<t&&Ie(),e.read(t)}function H(e){let t=e.readUint8();return t===void 0&&Ie(),t}function N(e){if(typeof e=="number"&&(e=BigInt(e)),e<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,r=new U(new ArrayBuffer(t),0);for(;;){let n=Number(e&BigInt(127));if(e/=BigInt(128),e===BigInt(0)){r.write(new Uint8Array([n]));break}else r.write(new Uint8Array([n|128]))}return r.buffer}function V(e){let t=BigInt(1),r=BigInt(0),n;do n=H(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function v(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,n=new U(new ArrayBuffer(r),0);for(;;){let i=o(e);if(e/=BigInt(128),t&&e===BigInt(0)&&i&64||!t&&e===BigInt(0)&&!(i&64)){n.write(new Uint8Array([i]));break}else n.write(new Uint8Array([i|128]))}function o(i){let s=i%BigInt(128);return Number(t?BigInt(128)-s-BigInt(1):s)}return n.buffer}function q(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return V(e);break}let n=new Uint8Array(K(e,r+1)),o=BigInt(0);for(let i=n.byteLength-1;i>=0;i--)o=o*BigInt(128)+BigInt(128-(n[i]&127)-1);return-o-BigInt(1)}function De(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Pe(e,t)}function Pe(e,t){e=BigInt(e);let r=new U(new ArrayBuffer(Math.min(1,t)),0),n=0,o=BigInt(256),i=BigInt(0),s=Number(e%o);for(r.write(new Uint8Array([s]));++n<t;)e<0&&i===BigInt(0)&&s!==0&&(i=BigInt(1)),s=Number((e/o-i)%BigInt(256)),r.write(new Uint8Array([s])),o*=BigInt(256);return r.buffer}function Re(e,t){let r=BigInt(H(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(H(e));r=r+n*i}return r}function Le(e,t){let r=Re(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function ce(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var le="DIDL",et=400;function ne(e,t,r){return e.map((n,o)=>r(n,t[o]))}var Se=class{constructor(){this._typs=[],this._idx=new Map}has(t){return this._idx.has(t.name)}add(t,r){let n=this._typs.length;this._idx.set(t.name,n),this._typs.push(r)}merge(t,r){let n=this._idx.get(t.name),o=this._idx.get(r);if(n===void 0)throw new Error("Missing type index for "+t);if(o===void 0)throw new Error("Missing type index for "+r);this._typs[n]=this._typs[o],this._typs.splice(o,1),this._idx.delete(r)}encode(){let t=N(this._typs.length),r=m(...this._typs);return m(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return v(this._idx.get(t)||0)}},ue=class{visitType(t,r){throw new Error("Not implemented")}visitPrimitive(t,r){return this.visitType(t,r)}visitEmpty(t,r){return this.visitPrimitive(t,r)}visitBool(t,r){return this.visitPrimitive(t,r)}visitNull(t,r){return this.visitPrimitive(t,r)}visitReserved(t,r){return this.visitPrimitive(t,r)}visitText(t,r){return this.visitPrimitive(t,r)}visitNumber(t,r){return this.visitPrimitive(t,r)}visitInt(t,r){return this.visitNumber(t,r)}visitNat(t,r){return this.visitNumber(t,r)}visitFloat(t,r){return this.visitPrimitive(t,r)}visitFixedInt(t,r){return this.visitNumber(t,r)}visitFixedNat(t,r){return this.visitNumber(t,r)}visitPrincipal(t,r){return this.visitPrimitive(t,r)}visitConstruct(t,r){return this.visitType(t,r)}visitVec(t,r,n){return this.visitConstruct(t,n)}visitOpt(t,r,n){return this.visitConstruct(t,n)}visitRecord(t,r,n){return this.visitConstruct(t,n)}visitTuple(t,r,n){let o=r.map((i,s)=>[`_${s}_`,i]);return this.visitRecord(t,o,n)}visitVariant(t,r,n){return this.visitConstruct(t,n)}visitRec(t,r,n){return this.visitConstruct(r,n)}visitFunc(t,r){return this.visitConstruct(t,r)}visitService(t,r){return this.visitConstruct(t,r)}},G=class{display(){return this.name}valueToString(t){return T(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},O=class extends G{checkType(t){if(this.name!==t.name)throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`);return t}_buildTypeTableImpl(t){}},M=class extends G{checkType(t){if(t instanceof W){let r=t.getType();if(typeof r>"u")throw new Error("type mismatch with uninitialized type");return r}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}},pe=class extends O{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return v(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},de=class extends G{checkType(t){throw new Error("Method not implemented for unknown.")}accept(t,r){throw t.visitType(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(){throw new Error("Unknown cannot appear as a function argument")}valueToString(){throw new Error("Unknown cannot appear as a value")}encodeType(){throw new Error("Unknown cannot be serialized")}decodeValue(t,r){let n=r.decodeValue(t,r);Object(n)!==n&&(n=Object(n));let o;return r instanceof W?o=()=>r.getType():o=()=>r,Object.defineProperty(n,"type",{value:o,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},me=class extends O{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return v(-2)}decodeValue(t,r){switch(this.checkType(r),H(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},he=class extends O{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return v(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},Y=class extends O{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return v(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},fe=class extends O{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=N(r.byteLength);return m(n,r)}encodeType(){return v(-15)}decodeValue(t,r){this.checkType(r);let n=V(t),o=K(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},_e=class extends O{accept(t,r){return t.visitInt(this,r)}covariant(t){if(typeof t=="bigint"||Number.isInteger(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return v(t)}encodeType(){return v(-4)}decodeValue(t,r){return this.checkType(r),q(t)}get name(){return"int"}valueToString(t){return t.toString()}},ye=class extends O{accept(t,r){return t.visitNat(this,r)}covariant(t){if(typeof t=="bigint"&&t>=BigInt(0)||Number.isInteger(t)&&t>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return N(t)}encodeType(){return v(-3)}decodeValue(t,r){return this.checkType(r),V(t)}get name(){return"nat"}valueToString(t){return t.toString()}},oe=class extends O{constructor(t){if(super(),this._bits=t,t!==32&&t!==64)throw new Error("not a valid float type")}accept(t,r){return t.visitFloat(this,r)}covariant(t){if(typeof t=="number"||t instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=new ArrayBuffer(this._bits/8),n=new DataView(r);return this._bits===32?n.setFloat32(0,t,!0):n.setFloat64(0,t,!0),r}encodeType(){let t=this._bits===32?-13:-14;return v(t)}decodeValue(t,r){this.checkType(r);let n=K(t,this._bits/8),o=new DataView(n);return this._bits===32?o.getFloat32(0,!0):o.getFloat64(0,!0)}get name(){return"float"+this._bits}valueToString(t){return t.toString()}},z=class extends O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=ce(this._bits-1)*BigInt(-1),n=ce(this._bits-1)-BigInt(1),o=!1;if(typeof t=="bigint")o=t>=r&&t<=n;else if(Number.isInteger(t)){let i=BigInt(t);o=i>=r&&i<=n}else o=!1;if(o)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return Pe(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return v(-9-t)}decodeValue(t,r){this.checkType(r);let n=Le(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},B=class extends O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=ce(this._bits),n=!1;if(typeof t=="bigint"&&t>=BigInt(0)?n=t<r:Number.isInteger(t)&&t>=0?n=BigInt(t)<r:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return De(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return v(-5-t)}decodeValue(t,r){this.checkType(r);let n=Re(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},ge=class e extends M{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof B&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof B?this._type._bits:this._type instanceof z?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,o)=>{try{return this._type.covariant(n)}catch(i){throw new Error(`Invalid ${this.display()} argument:
2
2
 
3
- index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=w(t.length);if(this._blobOptimization)return m(r,new Uint8Array(t));if(ArrayBuffer.isView(t))return m(r,new Uint8Array(t.buffer));let n=new M(new ArrayBuffer(r.byteLength+t.length),0);n.write(r);for(let o of t){let i=this._type.encodeValue(o);n.write(new Uint8Array(i))}return n.buffer}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=b(-19),n=this._type.encodeType(t);t.add(this,m(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a vector type");let o=Number(V(t));if(this._type instanceof $){if(this._type._bits==8)return new Uint8Array(t.read(o));if(this._type._bits==16)return new Uint16Array(t.read(o*2));if(this._type._bits==32)return new Uint32Array(t.read(o*4));if(this._type._bits==64)return new BigUint64Array(t.read(o*8))}if(this._type instanceof q){if(this._type._bits==8)return new Int8Array(t.read(o));if(this._type._bits==16)return new Int16Array(t.read(o*2));if(this._type._bits==32)return new Int32Array(t.read(o*4));if(this._type._bits==64)return new BigInt64Array(t.read(o*8))}let i=[];for(let s=0;s<o;s++)i.push(this._type.decodeValue(t,n._type));return i}get name(){return`vec ${this._type.name}`}display(){return`vec ${this._type.display()}`}valueToString(t){return"vec {"+t.map(n=>this._type.valueToString(n)).join("; ")+"}"}},Q=class e extends B{constructor(t){super(),this._type=t}accept(t,r){return t.visitOpt(this,this._type,r)}covariant(t){try{if(Array.isArray(t)&&(t.length===0||t.length===1&&this._type.covariant(t[0])))return!0}catch(r){throw new Error(`Invalid ${this.display()} argument: ${T(t)}
3
+ index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=N(t.length);if(this._blobOptimization)return m(r,new Uint8Array(t));if(ArrayBuffer.isView(t))return m(r,new Uint8Array(t.buffer));let n=new U(new ArrayBuffer(r.byteLength+t.length),0);n.write(r);for(let o of t){let i=this._type.encodeValue(o);n.write(new Uint8Array(i))}return n.buffer}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=v(-19),n=this._type.encodeType(t);t.add(this,m(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a vector type");let o=Number(V(t));if(this._type instanceof B){if(this._type._bits==8)return new Uint8Array(t.read(o));if(this._type._bits==16)return new Uint16Array(t.read(o*2));if(this._type._bits==32)return new Uint32Array(t.read(o*4));if(this._type._bits==64)return new BigUint64Array(t.read(o*8))}if(this._type instanceof z){if(this._type._bits==8)return new Int8Array(t.read(o));if(this._type._bits==16)return new Int16Array(t.read(o*2));if(this._type._bits==32)return new Int32Array(t.read(o*4));if(this._type._bits==64)return new BigInt64Array(t.read(o*8))}let i=[];for(let s=0;s<o;s++)i.push(this._type.decodeValue(t,n._type));return i}get name(){return`vec ${this._type.name}`}display(){return`vec ${this._type.display()}`}valueToString(t){return"vec {"+t.map(n=>this._type.valueToString(n)).join("; ")+"}"}},Q=class e extends M{constructor(t){super(),this._type=t}accept(t,r){return t.visitOpt(this,this._type,r)}covariant(t){try{if(Array.isArray(t)&&(t.length===0||t.length===1&&this._type.covariant(t[0])))return!0}catch(r){throw new Error(`Invalid ${this.display()} argument: ${T(t)}
4
4
 
5
- -> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return t.length===0?new Uint8Array([0]):m(new Uint8Array([1]),this._type.encodeValue(t[0]))}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=b(-18),n=this._type.encodeType(t);t.add(this,m(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not an option type");switch(z(t)){case 0:return[];case 1:return[this._type.decodeValue(t,n._type)];default:throw new Error("Not an option value")}}get name(){return`opt ${this._type.name}`}display(){return`opt ${this._type.display()}`}valueToString(t){return t.length===0?"null":`opt ${this._type.valueToString(t[0])}`}},ie=class e extends B{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>A(r[0])-A(n[0]))}accept(t,r){return t.visitRecord(this,this._fields,r)}tryAsTuple(){let t=[];for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(n!==`_${r}_`)return null;t.push(o)}return t}covariant(t){if(typeof t=="object"&&this._fields.every(([r,n])=>{if(!t.hasOwnProperty(r))throw new Error(`Record is missing key "${r}".`);try{return n.covariant(t[r])}catch(o){throw new Error(`Invalid ${this.display()} argument:
5
+ -> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){return t.length===0?new Uint8Array([0]):m(new Uint8Array([1]),this._type.encodeValue(t[0]))}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=v(-18),n=this._type.encodeType(t);t.add(this,m(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not an option type");switch(H(t)){case 0:return[];case 1:return[this._type.decodeValue(t,n._type)];default:throw new Error("Not an option value")}}get name(){return`opt ${this._type.name}`}display(){return`opt ${this._type.display()}`}valueToString(t){return t.length===0?"null":`opt ${this._type.valueToString(t[0])}`}},ie=class e extends M{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>k(r[0])-k(n[0]))}accept(t,r){return t.visitRecord(this,this._fields,r)}tryAsTuple(){let t=[];for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(n!==`_${r}_`)return null;t.push(o)}return t}covariant(t){if(typeof t=="object"&&this._fields.every(([r,n])=>{if(!t.hasOwnProperty(r))throw new Error(`Record is missing key "${r}".`);try{return n.covariant(t[r])}catch(o){throw new Error(`Invalid ${this.display()} argument:
6
6
 
7
- field ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=ne(this._fields,r,([,o],i)=>o.encodeValue(i));return m(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=b(-20),n=w(this._fields.length),o=this._fields.map(([i,s])=>m(w(A(i)),s.encodeType(t)));t.add(this,m(r,n,m(...o)))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a record type");let o={},i=0,s=0;for(;s<n._fields.length;){let[l,u]=n._fields[s];if(i>=this._fields.length){u.decodeValue(t,u),s++;continue}let[c,d]=this._fields[i],h=A(this._fields[i][0]),x=A(l);if(h===x)o[c]=d.decodeValue(t,u),i++,s++;else if(x>h)if(d instanceof Q||d instanceof Y)o[c]=[],i++;else throw new Error("Cannot find required field "+c);else u.decodeValue(t,u),s++}for(let[l,u]of this._fields.slice(i))if(u instanceof Q||u instanceof Y)o[l]=[];else throw new Error("Cannot find required field "+l);return o}get name(){return`record {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`record {${this._fields.map(([r,n])=>r+":"+n.display()).join("; ")}}`}valueToString(t){let r=this._fields.map(([o])=>t[o]);return`record {${ne(this._fields,r,([o,i],s)=>o+"="+i.valueToString(s)).join("; ")}}`}},ge=class e extends ie{constructor(t){let r={};t.forEach((n,o)=>r["_"+o+"_"]=n),super(r),this._components=t}accept(t,r){return t.visitTuple(this,this._components,r)}covariant(t){if(Array.isArray(t)&&t.length>=this._fields.length&&this._components.every((r,n)=>{try{return r.covariant(t[n])}catch(o){throw new Error(`Invalid ${this.display()} argument:
7
+ field ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=ne(this._fields,r,([,o],i)=>o.encodeValue(i));return m(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=v(-20),n=N(this._fields.length),o=this._fields.map(([i,s])=>m(N(k(i)),s.encodeType(t)));t.add(this,m(r,n,m(...o)))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a record type");let o={},i=0,s=0;for(;s<n._fields.length;){let[l,u]=n._fields[s];if(i>=this._fields.length){u.decodeValue(t,u),s++;continue}let[c,d]=this._fields[i],f=k(this._fields[i][0]),g=k(l);if(f===g)o[c]=d.decodeValue(t,u),i++,s++;else if(g>f)if(d instanceof Q||d instanceof Y)o[c]=[],i++;else throw new Error("Cannot find required field "+c);else u.decodeValue(t,u),s++}for(let[l,u]of this._fields.slice(i))if(u instanceof Q||u instanceof Y)o[l]=[];else throw new Error("Cannot find required field "+l);return o}get name(){return`record {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`record {${this._fields.map(([r,n])=>r+":"+n.display()).join("; ")}}`}valueToString(t){let r=this._fields.map(([o])=>t[o]);return`record {${ne(this._fields,r,([o,i],s)=>o+"="+i.valueToString(s)).join("; ")}}`}},xe=class e extends ie{constructor(t){let r={};t.forEach((n,o)=>r["_"+o+"_"]=n),super(r),this._components=t}accept(t,r){return t.visitTuple(this,this._components,r)}covariant(t){if(Array.isArray(t)&&t.length>=this._fields.length&&this._components.every((r,n)=>{try{return r.covariant(t[n])}catch(o){throw new Error(`Invalid ${this.display()} argument:
8
8
 
9
- index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=ne(this._components,t,(n,o)=>n.encodeValue(o));return m(...r)}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("not a tuple type");if(n._components.length<this._components.length)throw new Error("tuple mismatch");let o=[];for(let[i,s]of n._components.entries())i>=this._components.length?s.decodeValue(t,s):o.push(this._components[i].decodeValue(t,s));return o}display(){return`record {${this._components.map(r=>r.display()).join("; ")}}`}valueToString(t){return`record {${ne(this._components,t,(n,o)=>n.valueToString(o)).join("; ")}}`}},Te=class e extends B{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>A(r[0])-A(n[0]))}accept(t,r){return t.visitVariant(this,this._fields,r)}covariant(t){if(typeof t=="object"&&Object.entries(t).length===1&&this._fields.every(([r,n])=>{try{return!t.hasOwnProperty(r)||n.covariant(t[r])}catch(o){throw new Error(`Invalid ${this.display()} argument:
9
+ index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=ne(this._components,t,(n,o)=>n.encodeValue(o));return m(...r)}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("not a tuple type");if(n._components.length<this._components.length)throw new Error("tuple mismatch");let o=[];for(let[i,s]of n._components.entries())i>=this._components.length?s.decodeValue(t,s):o.push(this._components[i].decodeValue(t,s));return o}display(){return`record {${this._components.map(r=>r.display()).join("; ")}}`}valueToString(t){return`record {${ne(this._components,t,(n,o)=>n.valueToString(o)).join("; ")}}`}},Te=class e extends M{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>k(r[0])-k(n[0]))}accept(t,r){return t.visitVariant(this,this._fields,r)}covariant(t){if(typeof t=="object"&&Object.entries(t).length===1&&this._fields.every(([r,n])=>{try{return!t.hasOwnProperty(r)||n.covariant(t[r])}catch(o){throw new Error(`Invalid ${this.display()} argument:
10
10
 
11
- variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=w(r),s=o.encodeValue(t[n]);return m(i,s)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=b(-21),n=w(this._fields.length),o=this._fields.map(([i,s])=>m(w(A(i)),s.encodeType(t)));t.add(this,m(r,n,...o))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a variant type");let o=Number(V(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[l,u]of this._fields)if(A(i)===A(l)){let c=u.decodeValue(t,s);return{[l]:c}}throw new Error("Cannot find field hash "+i)}get name(){return`variant {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([r,n])=>r+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(t){for(let[r,n]of this._fields)if(t.hasOwnProperty(r)){let o=n.valueToString(t[r]);return o==="null"?`variant {${r}}`:`variant {${r}=${o}}`}throw new Error("Variant has no data: "+t)}},K=class e extends B{constructor(){super(...arguments),this._id=e._counter++,this._type=void 0}accept(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,r)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(t)}_buildTypeTableImpl(t){if(!this._type)throw Error("Recursive type uninitialized.");t.add(this,new Uint8Array([])),this._type.buildTypeTable(t),t.merge(this,this._type.name)}decodeValue(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(t,r)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(t)}};K._counter=0;function Se(e){if(z(e)!==1)throw new Error("Cannot decode principal");let r=Number(V(e));return hr.fromUint8Array(new Uint8Array(H(e,r)))}var xe=class extends O{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=w(r.byteLength);return m(new Uint8Array([1]),n,r)}encodeType(){return b(-24)}decodeValue(t,r){return this.checkType(r),Se(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}},se=class extends B{constructor(t,r,n=[]){super(),this.argTypes=t,this.retTypes=r,this.annotations=n}static argsToString(t,r){if(t.length!==r.length)throw new Error("arity mismatch");return"("+t.map((n,o)=>n.valueToString(r[o])).join(", ")+")"}accept(t,r){return t.visitFunc(this,r)}covariant(t){if(Array.isArray(t)&&t.length===2&&t[0]&&t[0]._isPrincipal&&typeof t[1]=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=w(n.byteLength),i=m(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),l=w(s.byteLength);return m(new Uint8Array([1]),i,l,s)}_buildTypeTableImpl(t){this.argTypes.forEach(c=>c.buildTypeTable(t)),this.retTypes.forEach(c=>c.buildTypeTable(t));let r=b(-22),n=w(this.argTypes.length),o=m(...this.argTypes.map(c=>c.encodeType(t))),i=w(this.retTypes.length),s=m(...this.retTypes.map(c=>c.encodeType(t))),l=w(this.annotations.length),u=m(...this.annotations.map(c=>this.encodeAnnotation(c)));t.add(this,m(r,n,o,i,s,l,u))}decodeValue(t){if(z(t)!==1)throw new Error("Cannot decode function reference");let n=Se(t),o=Number(V(t)),i=H(t,o),l=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,l]}get name(){let t=this.argTypes.map(o=>o.name).join(", "),r=this.retTypes.map(o=>o.name).join(", "),n=" "+this.annotations.join(" ");return`(${t}) -> (${r})${n}`}valueToString([t,r]){return`func "${t.toText()}".${r}`}display(){let t=this.argTypes.map(o=>o.display()).join(", "),r=this.retTypes.map(o=>o.display()).join(", "),n=" "+this.annotations.join(" ");return`(${t}) \u2192 (${r})${n}`}encodeAnnotation(t){if(t==="query")return new Uint8Array([1]);if(t==="oneway")return new Uint8Array([2]);if(t==="composite_query")return new Uint8Array([3]);throw new Error("Illegal function annotation")}},we=class extends B{constructor(t){super(),this._fields=Object.entries(t).sort((r,n)=>A(r[0])-A(n[0]))}accept(t,r){return t.visitService(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=w(r.length);return m(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=b(-23),n=w(this._fields.length),o=this._fields.map(([i,s])=>{let l=new TextEncoder().encode(i),u=w(l.length);return m(u,l,s.encodeType(t))});t.add(this,m(r,n,...o))}decodeValue(t){return Se(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};function T(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>et?t.substring(0,et-3)+"...":t}function fr(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new Ce;e.forEach(u=>u.buildTypeTable(r));let n=new TextEncoder().encode(ce),o=r.encode(),i=w(t.length),s=m(...e.map(u=>u.encodeType(r))),l=m(...ne(e,t,(u,c)=>{try{u.covariant(c)}catch(d){throw new Error(d.message+`
11
+ variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=N(r),s=o.encodeValue(t[n]);return m(i,s)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=v(-21),n=N(this._fields.length),o=this._fields.map(([i,s])=>m(N(k(i)),s.encodeType(t)));t.add(this,m(r,n,...o))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a variant type");let o=Number(V(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[l,u]of this._fields)if(k(i)===k(l)){let c=u.decodeValue(t,s);return{[l]:c}}throw new Error("Cannot find field hash "+i)}get name(){return`variant {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([r,n])=>r+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(t){for(let[r,n]of this._fields)if(t.hasOwnProperty(r)){let o=n.valueToString(t[r]);return o==="null"?`variant {${r}}`:`variant {${r}=${o}}`}throw new Error("Variant has no data: "+t)}},W=class e extends M{constructor(){super(...arguments),this._id=e._counter++,this._type=void 0}accept(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,r)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(t)}_buildTypeTableImpl(t){if(!this._type)throw Error("Recursive type uninitialized.");t.add(this,new Uint8Array([])),this._type.buildTypeTable(t),t.merge(this,this._type.name)}decodeValue(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(t,r)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(t)}};W._counter=0;function Ce(e){if(H(e)!==1)throw new Error("Cannot decode principal");let r=Number(V(e));return br.fromUint8Array(new Uint8Array(K(e,r)))}var we=class extends O{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=N(r.byteLength);return m(new Uint8Array([1]),n,r)}encodeType(){return v(-24)}decodeValue(t,r){return this.checkType(r),Ce(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}},se=class extends M{constructor(t,r,n=[]){super(),this.argTypes=t,this.retTypes=r,this.annotations=n}static argsToString(t,r){if(t.length!==r.length)throw new Error("arity mismatch");return"("+t.map((n,o)=>n.valueToString(r[o])).join(", ")+")"}accept(t,r){return t.visitFunc(this,r)}covariant(t){if(Array.isArray(t)&&t.length===2&&t[0]&&t[0]._isPrincipal&&typeof t[1]=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=N(n.byteLength),i=m(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),l=N(s.byteLength);return m(new Uint8Array([1]),i,l,s)}_buildTypeTableImpl(t){this.argTypes.forEach(c=>c.buildTypeTable(t)),this.retTypes.forEach(c=>c.buildTypeTable(t));let r=v(-22),n=N(this.argTypes.length),o=m(...this.argTypes.map(c=>c.encodeType(t))),i=N(this.retTypes.length),s=m(...this.retTypes.map(c=>c.encodeType(t))),l=N(this.annotations.length),u=m(...this.annotations.map(c=>this.encodeAnnotation(c)));t.add(this,m(r,n,o,i,s,l,u))}decodeValue(t){if(H(t)!==1)throw new Error("Cannot decode function reference");let n=Ce(t),o=Number(V(t)),i=K(t,o),l=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,l]}get name(){let t=this.argTypes.map(o=>o.name).join(", "),r=this.retTypes.map(o=>o.name).join(", "),n=" "+this.annotations.join(" ");return`(${t}) -> (${r})${n}`}valueToString([t,r]){return`func "${t.toText()}".${r}`}display(){let t=this.argTypes.map(o=>o.display()).join(", "),r=this.retTypes.map(o=>o.display()).join(", "),n=" "+this.annotations.join(" ");return`(${t}) \u2192 (${r})${n}`}encodeAnnotation(t){if(t==="query")return new Uint8Array([1]);if(t==="oneway")return new Uint8Array([2]);if(t==="composite_query")return new Uint8Array([3]);throw new Error("Illegal function annotation")}},be=class extends M{constructor(t){super(),this._fields=Object.entries(t).sort((r,n)=>r[0]<n[0]?-1:r[0]>n[0]?1:0)}accept(t,r){return t.visitService(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${T(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=N(r.length);return m(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=v(-23),n=N(this._fields.length),o=this._fields.map(([i,s])=>{let l=new TextEncoder().encode(i),u=N(l.length);return m(u,l,s.encodeType(t))});t.add(this,m(r,n,...o))}decodeValue(t){return Ce(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};function T(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>et?t.substring(0,et-3)+"...":t}function Nr(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new Se;e.forEach(u=>u.buildTypeTable(r));let n=new TextEncoder().encode(le),o=r.encode(),i=N(t.length),s=m(...e.map(u=>u.encodeType(r))),l=m(...ne(e,t,(u,c)=>{try{u.covariant(c)}catch(d){throw new Error(d.message+`
12
12
 
13
- `)}return u.encodeValue(c)}));return m(n,o,i,s,l)}function _r(e,t){let r=new M(t);if(t.byteLength<ce.length)throw new Error("Message length smaller than magic number");let n=H(r,ce.length),o=new TextDecoder().decode(n);if(o!==ce)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],f=Number(V(a));for(let _=0;_<f;_++){let N=Number(U(a));switch(N){case-18:case-19:{let v=Number(U(a));p.push([N,v]);break}case-20:case-21:{let v=[],R=Number(V(a)),P;for(;R--;){let S=Number(V(a));if(S>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof P=="number"&&P>=S)throw new Error("field id collision or not sorted");P=S;let F=Number(U(a));v.push([S,F])}p.push([N,v]);break}case-22:{let v=[],R=Number(V(a));for(;R--;)v.push(Number(U(a)));let P=[],S=Number(V(a));for(;S--;)P.push(Number(U(a)));let F=[],k=Number(V(a));for(;k--;)switch(Number(V(a))){case 1:{F.push("query");break}case 2:{F.push("oneway");break}case 3:{F.push("composite_query");break}default:throw new Error("unknown annotation")}p.push([N,[v,P,F]]);break}case-23:{let v=Number(V(a)),R=[];for(;v--;){let P=Number(V(a)),S=new TextDecoder().decode(H(a,P)),F=U(a);R.push([S,F])}p.push([N,R]);break}default:throw new Error("Illegal op_code: "+N)}}let y=[],g=Number(V(a));for(let _=0;_<g;_++)y.push(Number(U(a)));return[p,y]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>vt());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return ot;case-2:return nt;case-3:return at;case-4:return st;case-5:return ht;case-6:return ft;case-7:return _t;case-8:return yt;case-9:return ut;case-10:return pt;case-11:return dt;case-12:return mt;case-13:return ct;case-14:return lt;case-15:return it;case-16:return rt;case-17:return tt;case-24:return gt;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function d(a){switch(a[0]){case-19:{let p=c(a[1]);return xt(p)}case-18:{let p=c(a[1]);return wt(p)}case-20:{let p={};for(let[g,_]of a[1]){let N=`_${g}_`;p[N]=c(_)}let f=bt(p),y=f.tryAsTuple();return Array.isArray(y)?Tt(...y):f}case-21:{let p={};for(let[f,y]of a[1]){let g=`_${f}_`;p[g]=c(y)}return Nt(p)}case-22:{let[p,f,y]=a[1];return Vt(p.map(g=>c(g)),f.map(g=>c(g)),y)}case-23:{let p={},f=a[1];for(let[y,g]of f){let _=c(g);if(_ instanceof K&&(_=_.getType()),!(_ instanceof se))throw new Error("Illegal service definition: services can only contain functions");p[y]=_}return Rt(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let f=d(a);u[p].fill(f)}}),s.forEach((a,p)=>{if(a[0]!==-22){let f=d(a);u[p].fill(f)}});let h=l.map(a=>c(a)),x=e.map((a,p)=>a.decodeValue(r,h[p]));for(let a=e.length;a<h.length;a++)h[a].decodeValue(r,h[a]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return x}var tt=new ue,rt=new Y,yr=new pe,nt=new de,ot=new me,it=new he,st=new fe,at=new _e,ct=new oe(32),lt=new oe(64),ut=new q(8),pt=new q(16),dt=new q(32),mt=new q(64),ht=new $(8),ft=new $(16),_t=new $(32),yt=new $(64),gt=new xe;function Tt(...e){return new ge(e)}function xt(e){return new ye(e)}function wt(e){return new Q(e)}function bt(e){return new ie(e)}function Nt(e){return new Te(e)}function vt(){return new K}function Vt(e,t,r=[]){return new se(e,t,r)}function Rt(e){return new we(e)}import{Principal as hn}from"@dfinity/principal";var Pt=e=>C.encode([C.Record({user:C.Principal})],[{user:e}]),be=e=>C.encode([C.Record({controllers:C.Vec(C.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Fn=async e=>Ye(e),On=async({missionControl:e,wasm_module:t})=>{let r=await Qe({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=Pt(r);await J({actor:o,code:{canister_id:Tr.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:null}}})},An=async({controllerId:e,profile:t,...r})=>Xe({...r,...Ve({controllerId:e,profile:t})}),En=async({controllerId:e,profile:t,...r})=>Ze({...r,...Ve({controllerId:e,profile:t})});import{Principal as xr}from"@dfinity/principal";var Ct=async({orbiter:e})=>(await ve(e)).version(),St=async({orbiter:e})=>(await ve(e)).list_controllers();var zn=async e=>Ct(e),Hn=async({orbiter:e,wasm_module:t,reset:r=!1})=>{let{orbiterId:n,...o}=e;if(!n)throw new Error("No orbiter principal defined.");let i=await St({orbiter:e}),s=be(i);await J({actor:o,code:{canister_id:xr.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:null}}})};import{major as Ft,minor as Ot,patch as At}from"semver";var Jn=({currentVersion:e,selectedVersion:t})=>{let r=Ft(e),n=Ft(t),o=Ot(e),i=Ot(t),s=At(e),l=At(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as Dt}from"@dfinity/principal";import{fromNullable as vr}from"@junobuild/utils";var Et=async({config:e,satellite:t})=>(await W(t)).set_config(e),kt=async({satellite:e,type:t})=>(await W(e)).list_rules(t),$t=async({type:e,collection:t,rule:r,satellite:n})=>(await W(n)).set_rule(e,t,r),Bt=async({satellite:e})=>(await W(e)).version(),Mt=async({satellite:e})=>(await Ke(e)).list_controllers(),Ut=async({satellite:e})=>(await We(e)).list_controllers(),qt=async({satellite:e})=>(await W(e)).list_controllers(),jt=async({satellite:e})=>(await W(e)).list_custom_domains();import{fromNullable as Oe,isNullish as wr,nonNullish as Ae,toNullable as Qt}from"@junobuild/utils";var zt={Db:null},Ht={Storage:null},Kt={Public:null},Wt={Private:null},Jt={Managed:null},Gt={Controllers:null},Fe={Heap:null},Yt={Stable:null};var Ee=e=>e==="storage"?Ht:zt,It=({read:e,write:t,memory:r,max_size:n,updated_at:o,mutablePermissions:i})=>({read:Zt(e),write:Zt(t),memory:Ae(r)?[br(r)]:[],updated_at:wr(o)?[]:[o],max_size:Qt(Ae(n)&&n>0?BigInt(n):void 0),mutable_permissions:Qt(i)}),Lt=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s,memory:l,mutable_permissions:u}=t,c=s?.[0]??0n>0n?Number(Oe(s)):void 0;return{collection:e,read:Xt(r),write:Xt(n),memory:Nr(Oe(l)??Fe),updated_at:o,created_at:i,...Ae(c)&&{max_size:c},mutablePermissions:Oe(u)??!0}},Xt=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Zt=e=>{switch(e){case"public":return Kt;case"private":return Wt;case"managed":return Jt;default:return Gt}},br=e=>{switch(e){case"Stable":return Yt;default:return Fe}},Nr=e=>"Stable"in e?"Stable":"Heap";var so=async({config:{storage:{headers:e,rewrites:t,redirects:r,iframe:n}},satellite:o})=>{let i=(e??[]).map(({source:c,headers:d})=>[c,d]),s=(t??[]).map(({source:c,destination:d})=>[c,d]),l=(r??[]).map(({source:c,location:d,code:h})=>[c,{status_code:h,location:d}]);return Et({satellite:o,config:{storage:{headers:i,rewrites:s,redirects:[l],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}]}}})},ao=async({type:e,satellite:t})=>(await kt({satellite:t,type:Ee(e)})).map(n=>Lt(n)),co=async({rule:{collection:e,...t},type:r,satellite:n})=>$t({type:Ee(r),rule:It(t),satellite:n,collection:e}),lo=async e=>Bt(e),uo=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...s}=e;if(!i)throw new Error("No satellite principal defined.");if(r){let d=await Mt({satellite:e}),h=C.encode([C.Record({controllers:C.Vec(C.Principal)})],[{controllers:d}]);await J({actor:s,code:{canister_id:Dt.fromText(i),arg:new Uint8Array(h),wasm_module:t,mode:o?{reinstall:null}:{upgrade:null}}});return}let u=await(n?Ut:qt)({satellite:e}),c=be(u);await J({actor:s,code:{canister_id:Dt.fromText(i),arg:new Uint8Array(c),wasm_module:t,mode:o?{reinstall:null}:{upgrade:null}}})},po=async({satellite:e})=>(await jt({satellite:e})).map(([r,n])=>({domain:r,bn_id:vr(n.bn_id),created_at:n.created_at,updated_at:n.updated_at}));export{Jn as checkUpgradeVersion,po as listCustomDomains,ao as listRules,Fn as missionControlVersion,zn as orbiterVersion,lo as satelliteVersion,so as setConfig,En as setMissionControlController,co as setRule,An as setSatellitesController,On as upgradeMissionControl,Hn as upgradeOrbiter,uo as upgradeSatellite};
13
+ `)}return u.encodeValue(c)}));return m(n,o,i,s,l)}function vr(e,t){let r=new U(t);if(t.byteLength<le.length)throw new Error("Message length smaller than magic number");let n=K(r,le.length),o=new TextDecoder().decode(n);if(o!==le)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],h=Number(V(a));for(let _=0;_<h;_++){let w=Number(q(a));switch(w){case-18:case-19:{let b=Number(q(a));p.push([w,b]);break}case-20:case-21:{let b=[],P=Number(V(a)),R;for(;P--;){let C=Number(V(a));if(C>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof R=="number"&&R>=C)throw new Error("field id collision or not sorted");R=C;let F=Number(q(a));b.push([C,F])}p.push([w,b]);break}case-22:{let b=[],P=Number(V(a));for(;P--;)b.push(Number(q(a)));let R=[],C=Number(V(a));for(;C--;)R.push(Number(q(a)));let F=[],$=Number(V(a));for(;$--;)switch(Number(V(a))){case 1:{F.push("query");break}case 2:{F.push("oneway");break}case 3:{F.push("composite_query");break}default:throw new Error("unknown annotation")}p.push([w,[b,R,F]]);break}case-23:{let b=Number(V(a)),P=[];for(;b--;){let R=Number(V(a)),C=new TextDecoder().decode(K(a,R)),F=q(a);P.push([C,F])}p.push([w,P]);break}default:throw new Error("Illegal op_code: "+w)}}let x=[],y=Number(V(a));for(let _=0;_<y;_++)x.push(Number(q(a)));return[p,x]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>vt());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return ot;case-2:return nt;case-3:return at;case-4:return st;case-5:return ht;case-6:return ft;case-7:return _t;case-8:return yt;case-9:return ut;case-10:return pt;case-11:return dt;case-12:return mt;case-13:return ct;case-14:return lt;case-15:return it;case-16:return rt;case-17:return tt;case-24:return gt;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function d(a){switch(a[0]){case-19:{let p=c(a[1]);return Tt(p)}case-18:{let p=c(a[1]);return wt(p)}case-20:{let p={};for(let[y,_]of a[1]){let w=`_${y}_`;p[w]=c(_)}let h=bt(p),x=h.tryAsTuple();return Array.isArray(x)?xt(...x):h}case-21:{let p={};for(let[h,x]of a[1]){let y=`_${h}_`;p[y]=c(x)}return Nt(p)}case-22:{let[p,h,x]=a[1];return Vt(p.map(y=>c(y)),h.map(y=>c(y)),x)}case-23:{let p={},h=a[1];for(let[x,y]of h){let _=c(y);if(_ instanceof W&&(_=_.getType()),!(_ instanceof se))throw new Error("Illegal service definition: services can only contain functions");p[x]=_}return Pt(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let h=d(a);u[p].fill(h)}}),s.forEach((a,p)=>{if(a[0]!==-22){let h=d(a);u[p].fill(h)}});let f=l.map(a=>c(a)),g=e.map((a,p)=>a.decodeValue(r,f[p]));for(let a=e.length;a<f.length;a++)f[a].decodeValue(r,f[a]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return g}var tt=new pe,rt=new Y,Vr=new de,nt=new me,ot=new he,it=new fe,st=new _e,at=new ye,ct=new oe(32),lt=new oe(64),ut=new z(8),pt=new z(16),dt=new z(32),mt=new z(64),ht=new B(8),ft=new B(16),_t=new B(32),yt=new B(64),gt=new we;function xt(...e){return new xe(e)}function Tt(e){return new ge(e)}function wt(e){return new Q(e)}function bt(e){return new ie(e)}function Nt(e){return new Te(e)}function vt(){return new W}function Vt(e,t,r=[]){return new se(e,t,r)}function Pt(e){return new be(e)}import{Principal as vn}from"@dfinity/principal";var Rt=e=>S.encode([S.Record({user:S.Principal})],[{user:e}]),Ne=e=>S.encode([S.Record({controllers:S.Vec(S.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var zn=async e=>Ye(e),jn=async({missionControl:e,wasm_module:t})=>{let r=await Qe({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=Rt(r);await J({actor:o,code:{canister_id:Rr.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:null}}})},Hn=async({controllerId:e,profile:t,...r})=>Xe({...r,...Ve({controllerId:e,profile:t})}),Kn=async({controllerId:e,profile:t,...r})=>Ze({...r,...Ve({controllerId:e,profile:t})});import{Principal as Sr}from"@dfinity/principal";var St=async({orbiter:e})=>(await ae(e)).version(),Ct=async({orbiter:e})=>(await ae(e)).list_controllers(),Ft=async({orbiter:e})=>{let{memory_size:t}=await ae(e);return t()};var In=async e=>St(e),Dn=async({orbiter:e,wasm_module:t,reset:r=!1})=>{let{orbiterId:n,...o}=e;if(!n)throw new Error("No orbiter principal defined.");let i=await Ct({orbiter:e}),s=Ne(i);await J({actor:o,code:{canister_id:Sr.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:null}}})},Ln=e=>Ft(e);import{major as Ot,minor as At,patch as Et}from"semver";var ro=({currentVersion:e,selectedVersion:t})=>{let r=Ot(e),n=Ot(t),o=At(e),i=At(t),s=Et(e),l=Et(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as sr}from"@dfinity/principal";import{fromNullable as Er,isNullish as kr}from"@junobuild/utils";import{toNullable as Cr}from"@junobuild/utils";var kt=async({config:e,satellite:t})=>(await A(t)).set_config(e),$t=async({satellite:e,type:t})=>(await A(e)).list_rules(t),Bt=async({type:e,collection:t,rule:r,satellite:n})=>(await A(n)).set_rule(e,t,r),Mt=async({satellite:e})=>(await A(e)).version(),Ut=async({satellite:e})=>(await Ke(e)).list_controllers(),qt=async({satellite:e})=>(await We(e)).list_controllers(),zt=async({satellite:e})=>(await A(e)).list_controllers(),jt=async({satellite:e})=>{let{list_custom_domains:t}=await A(e);return t()},Ht=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await A(e);await n(t,Cr(r))},Kt=async({satellite:e})=>{let{memory_size:t}=await A(e);return t()},Wt=async({collection:e,satellite:t})=>{let{count_docs:r}=await A(t);return r(e)},Jt=async({collection:e,satellite:t})=>{let{count_assets:r}=await A(t);return r(e)},Gt=async({collection:e,satellite:t})=>{let{del_docs:r}=await A(t);return r(e)},Yt=async({collection:e,satellite:t})=>{let{del_assets:r}=await A(t);return r(e)};import{fromNullable as Oe,isNullish as Fr,nonNullish as Ae,toNullable as tr}from"@junobuild/utils";var Qt={Db:null},Xt={Storage:null},Zt={Public:null},It={Private:null},Dt={Managed:null},Lt={Controllers:null},Fe={Heap:null},er={Stable:null};var Ee=e=>e==="storage"?Xt:Qt,or=({read:e,write:t,memory:r,max_size:n,updated_at:o,mutablePermissions:i})=>({read:nr(e),write:nr(t),memory:Ae(r)?[Or(r)]:[],updated_at:Fr(o)?[]:[o],max_size:tr(Ae(n)&&n>0?BigInt(n):void 0),mutable_permissions:tr(i)}),ir=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s,memory:l,mutable_permissions:u}=t,c=s?.[0]??0n>0n?Number(Oe(s)):void 0;return{collection:e,read:rr(r),write:rr(n),memory:Ar(Oe(l)??Fe),updated_at:o,created_at:i,...Ae(c)&&{max_size:c},mutablePermissions:Oe(u)??!0}},rr=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",nr=e=>{switch(e){case"public":return Zt;case"private":return It;case"managed":return Dt;default:return Lt}},Or=e=>{switch(e){case"Stable":return er;default:return Fe}},Ar=e=>"Stable"in e?"Stable":"Heap";var xo=async({config:{storage:{headers:e,rewrites:t,redirects:r,iframe:n}},satellite:o})=>{let i=(e??[]).map(({source:c,headers:d})=>[c,d]),s=(t??[]).map(({source:c,destination:d})=>[c,d]),l=(r??[]).map(({source:c,location:d,code:f})=>[c,{status_code:f,location:d}]);return kt({satellite:o,config:{storage:{headers:i,rewrites:s,redirects:[l],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}]}}})},To=async({type:e,satellite:t})=>(await $t({satellite:t,type:Ee(e)})).map(n=>ir(n)),wo=async({rule:{collection:e,...t},type:r,satellite:n})=>Bt({type:Ee(r),rule:or(t),satellite:n,collection:e}),bo=async e=>Mt(e),No=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...s}=e;if(kr(i))throw new Error("No satellite principal defined.");if(r){let d=await Ut({satellite:e}),f=S.encode([S.Record({controllers:S.Vec(S.Principal)})],[{controllers:d}]);await J({actor:s,code:{canister_id:sr.fromText(i),arg:new Uint8Array(f),wasm_module:t,mode:o?{reinstall:null}:{upgrade:null}}});return}let u=await(n?qt:zt)({satellite:e}),c=Ne(u);await J({actor:s,code:{canister_id:sr.fromText(i),arg:new Uint8Array(c),wasm_module:t,mode:o?{reinstall:null}:{upgrade:null}}})},vo=async({satellite:e})=>(await jt({satellite:e})).map(([r,n])=>({domain:r,bn_id:Er(n.bn_id),created_at:n.created_at,updated_at:n.updated_at})),Vo=async({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>Ht({satellite:e,domainName:r,boundaryNodesId:n}))),Po=e=>Kt(e),Ro=async e=>Wt(e),So=async e=>Gt(e),Co=async e=>Jt(e),Fo=async e=>Yt(e);export{ro as checkUpgradeVersion,Co as countAssets,Ro as countDocs,Fo as deleteAssets,So as deleteDocs,vo as listCustomDomains,To as listRules,zn as missionControlVersion,Ln as orbiterMemorySize,In as orbiterVersion,Po as satelliteMemorySize,bo as satelliteVersion,xo as setConfig,Vo as setCustomDomains,Kn as setMissionControlController,wo as setRule,Hn as setSatellitesController,jn as upgradeMissionControl,Dn as upgradeOrbiter,No as upgradeSatellite};
14
14
  //# sourceMappingURL=index.js.map