@junobuild/admin 0.0.57-next-2024-10-28.2 → 0.0.58

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,14 @@
1
- var sn=Object.defineProperty;var an=(e,t)=>{for(var r in t)sn(e,r,{get:t[r],enumerable:!0})};import{Principal as vn}from"@dfinity/principal";import{CanisterStatus as pn}from"@dfinity/agent";import{Principal as dn}from"@dfinity/principal";import{assertNonNullish as mn}from"@junobuild/utils";import{Actor as cn,HttpAgent as ln}from"@dfinity/agent";import{nonNullish as at}from"@junobuild/utils";var Ke=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await We(n);return cn.createActor(t,{agent:o,canisterId:e,...r!==void 0?r:{}})},We=async({identity:e,fetch:t,container:r})=>{let n=at(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await ln.create({identity:e,host:o,retryTimes:10,...at(t)&&{fetch:t},shouldFetchRootKey:n})};import{Principal as ht}from"@dfinity/principal";import{isNullish as un}from"@junobuild/utils";var ct=({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=o,s=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),c=o,u=e.Record({network:t}),l=e.Nat64,m=e.Vec(l),h=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),f=e.Vec(e.Nat8),a=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),p=e.Record({height:e.Nat32,value:o,outpoint:a}),y=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:f,utxos:e.Vec(p)}),T=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),x=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:f,utxos:e.Vec(p)}),g=e.Record({transaction:e.Vec(e.Nat8),network:t}),d=e.Principal,w=e.Record({canister_id:d,num_requested_changes:e.Opt(e.Nat64)}),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})}),R=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}),V=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:P,details:R}),C=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(V),total_num_changes:e.Nat64}),A=e.Record({canister_id:d}),S=e.Variant({controllers:e.Null,public:e.Null}),B=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:S,wasm_memory_limit:e.Nat,memory_allocation:e.Nat,compute_allocation:e.Nat}),K=e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:B,query_stats:e.Record({response_payload_bytes_total:e.Nat,num_instructions_total:e.Nat,num_calls_total:e.Nat,request_payload_bytes_total:e.Nat}),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),$=e.Record({canister_id:d}),k=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(S),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),W=e.Record({settings:e.Opt(k),sender_canister_version:e.Opt(e.Nat64)}),q=e.Record({canister_id:d}),z=e.Record({canister_id:d}),ae=e.Record({canister_id:d}),D=e.Variant({secp256k1:e.Null}),L=e.Record({key_id:e.Record({name:e.Text,curve:D}),canister_id:e.Opt(d),derivation_path:e.Vec(e.Vec(e.Nat8))}),ce=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),qe=e.Record({canister_id:d}),ee=e.Record({idx:e.Nat64,timestamp_nanos:e.Nat64,content:e.Vec(e.Nat8)}),Ue=e.Record({canister_log_records:e.Vec(ee)}),ge=e.Record({value:e.Text,name:e.Text}),le=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(ge)}),ze=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:le})],[le],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(ge)}),ue=e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({wasm_memory_persistence:e.Opt(e.Variant({keep:e.Null,replace:e.Null})),skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),pe=e.Record({hash:e.Vec(e.Nat8)}),je=e.Record({arg:e.Vec(e.Nat8),wasm_module_hash:e.Vec(e.Nat8),mode:ue,chunk_hashes_list:e.Vec(pe),target_canister:d,store_canister:e.Opt(d),sender_canister_version:e.Opt(e.Nat64)}),He=e.Vec(e.Nat8),$r=e.Record({arg:e.Vec(e.Nat8),wasm_module:He,mode:ue,canister_id:d,sender_canister_version:e.Opt(e.Nat64)}),qr=e.Record({start_at_timestamp_nanos:e.Nat64,subnet_id:e.Principal}),Ur=e.Record({num_block_failures_total:e.Nat64,node_id:e.Principal,num_blocks_proposed_total:e.Nat64}),zr=e.Vec(e.Record({timestamp_nanos:e.Nat64,node_metrics:e.Vec(Ur)})),jr=e.Record({settings:e.Opt(k),specified_id:e.Opt(d),amount:e.Opt(e.Nat),sender_canister_version:e.Opt(e.Nat64)}),Hr=e.Record({canister_id:d}),Kr=e.Record({canister_id:d,amount:e.Nat}),Wr=e.Vec(e.Nat8),st=e.Variant({ed25519:e.Null,bip340secp256k1:e.Null}),Gr=e.Record({key_id:e.Record({algorithm:st,name:e.Text}),canister_id:e.Opt(d),derivation_path:e.Vec(e.Vec(e.Nat8))}),Jr=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),Yr=e.Record({key_id:e.Record({name:e.Text,curve:D}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)}),Qr=e.Record({signature:e.Vec(e.Nat8)}),Xr=e.Record({key_id:e.Record({algorithm:st,name:e.Text}),derivation_path:e.Vec(e.Vec(e.Nat8)),message:e.Vec(e.Nat8)}),Zr=e.Record({signature:e.Vec(e.Nat8)}),Ir=e.Record({canister_id:d}),Dr=e.Record({canister_id:d}),Lr=e.Record({canister_id:d}),en=e.Vec(pe),tn=e.Record({canister_id:d,sender_canister_version:e.Opt(e.Nat64)}),rn=e.Record({canister_id:e.Principal,settings:k,sender_canister_version:e.Opt(e.Nat64)}),nn=e.Record({chunk:e.Vec(e.Nat8),canister_id:e.Principal}),on=pe;return e.Service({bitcoin_get_balance:e.Func([n],[i],[]),bitcoin_get_balance_query:e.Func([s],[c],["query"]),bitcoin_get_current_fee_percentiles:e.Func([u],[m],[]),bitcoin_get_utxos:e.Func([h],[y],[]),bitcoin_get_utxos_query:e.Func([T],[x],["query"]),bitcoin_send_transaction:e.Func([g],[],[]),canister_info:e.Func([w],[C],[]),canister_status:e.Func([A],[K],[]),clear_chunk_store:e.Func([$],[],[]),create_canister:e.Func([W],[q],[]),delete_canister:e.Func([z],[],[]),deposit_cycles:e.Func([ae],[],[]),ecdsa_public_key:e.Func([L],[ce],[]),fetch_canister_logs:e.Func([qe],[Ue],["query"]),http_request:e.Func([ze],[le],[]),install_chunked_code:e.Func([je],[],[]),install_code:e.Func([$r],[],[]),node_metrics_history:e.Func([qr],[zr],[]),provisional_create_canister_with_cycles:e.Func([jr],[Hr],[]),provisional_top_up_canister:e.Func([Kr],[],[]),raw_rand:e.Func([],[Wr],[]),schnorr_public_key:e.Func([Gr],[Jr],[]),sign_with_ecdsa:e.Func([Yr],[Qr],[]),sign_with_schnorr:e.Func([Xr],[Zr],[]),start_canister:e.Func([Ir],[],[]),stop_canister:e.Func([Dr],[],[]),stored_chunks:e.Func([Lr],[en],[]),uninstall_code:e.Func([tn],[],[]),update_settings:e.Func([rn],[],[]),upload_chunk:e.Func([nn],[on],[])})};var lt=({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}),c=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:c,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),l=e.Record({id:e.Principal,status:u,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),m=e.Variant({Ok:l,Err:e.Text}),h=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),f=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,f)),satellites:e.Vec(e.Tuple(e.Principal,f)),cycles_threshold:e.Opt(e.Nat64)}),p=e.Record({orbiters:e.Opt(e.Vec(m)),satellites:e.Opt(e.Vec(m)),mission_control:m}),y=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,m))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,m)))],["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,m)))],["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: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),h],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[r],[]),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,y],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),version:e.Func([],[e.Text],["query"])})};var ut=({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({version: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)}),c=e.Record({key:e.Text,collected_at:e.Nat64}),u=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),l=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,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),m=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),h=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),f=e.Record({browsers:m,devices:h}),a=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),p=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(a,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),y=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),T=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),x=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(T),delta:e.Float64}),g=e.Variant({WebVitalsMetric:x}),d=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),w=e.Record({updated_at:e.Nat64,session_id:e.Text,data:g,href:e.Text,metric_name:d,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),P=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),R=e.Record({overall:P,pages:e.Vec(e.Tuple(e.Text,P))}),V=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,version:e.Opt(e.Nat64)}),C=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),A=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),S=e.Record({updated_at:e.Nat64,features:e.Opt(A),created_at:e.Nat64,version:e.Opt(e.Nat64)}),B=e.Record({stable:e.Nat64,heap:e.Nat64}),K=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),$=e.Record({controller:K,controllers:e.Vec(e.Principal)}),k=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,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),W=e.Variant({Ok:l,Err:e.Text}),q=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(c,e.Text))}),z=e.Record({session_id:e.Text,data:g,href:e.Text,metric_name:d,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ae=e.Variant({Ok:w,Err:e.Text}),D=e.Record({features:e.Opt(A),version:e.Opt(e.Nat64)}),L=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,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ce=e.Variant({Ok:V,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(c,l))],["query"]),get_page_views_analytics_clients:e.Func([s],[f],["query"]),get_page_views_analytics_metrics:e.Func([s],[p],["query"]),get_page_views_analytics_top_10:e.Func([s],[y],["query"]),get_performance_metrics:e.Func([s],[e.Vec(e.Tuple(c,w))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([s],[R],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(c,V))],["query"]),get_track_events_analytics:e.Func([s],[C],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,S))],["query"]),memory_size:e.Func([],[B],["query"]),set_controllers:e.Func([$],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([c,k],[W],[]),set_page_views:e.Func([e.Vec(e.Tuple(c,k))],[q],[]),set_performance_metric:e.Func([c,z],[ae],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(c,z))],[q],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,D))],[e.Vec(e.Tuple(e.Principal,S))],[]),set_track_event:e.Func([c,L],[ce],[]),set_track_events:e.Func([e.Vec(e.Tuple(c,L))],[q],[]),version:e.Func([],[e.Text],["query"])})};var pt=({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}),c=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))}),l=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}),m=e.Variant({Callback:e.Record({token:l,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(m),status_code:e.Nat16}),f=e.Record({token:e.Opt(l),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}),y=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),T=e.Record({field:y,desc:e.Bool}),x=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),g=e.Record({order:e.Opt(T),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(x)}),d=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),w=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:d,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,w)),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))}),V=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),C=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,c))}),A=e.Variant({Db:e.Null,Storage:e.Null}),S=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),B=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:S,created_at:e.Nat64,write:S}),K=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),$=e.Record({controller:K,controllers:e.Vec(e.Principal)}),k=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),W=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:S,write:S}),q=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),z=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(c)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([l],[f],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),g],[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,V))],["query"]),list_docs:e.Func([e.Text,g],[C],["query"]),list_rules:e.Func([A],[e.Vec(e.Tuple(e.Text,B))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([$],[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,k],[c],[]),set_rule:e.Func([A,e.Text,W],[],[]),upload_asset_chunk:e.Func([q],[z],[]),version:e.Func([],[e.Text],["query"])})};var dt=({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}),c=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))}),l=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}),m=e.Variant({Callback:e.Record({token:l,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(m),status_code:e.Nat16}),f=e.Record({token:e.Opt(l),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}),y=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),T=e.Record({field:y,desc:e.Bool}),x=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),g=e.Record({order:e.Opt(T),matcher:e.Opt(e.Text),paginate:e.Opt(x)}),d=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),w=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:d,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,w)),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))}),V=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),C=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,c))}),A=e.Variant({Db:e.Null,Storage:e.Null}),S=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),B=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:S,created_at:e.Nat64,write:S}),K=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),$=e.Record({controller:K,controllers:e.Vec(e.Principal)}),k=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),W=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:S,write:S}),q=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),z=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(c)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([l],[f],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),g],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,V))],["query"]),list_docs:e.Func([e.Text,g],[C],["query"]),list_rules:e.Func([A],[e.Vec(e.Tuple(e.Text,B))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([$],[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,k],[c],[]),set_rule:e.Func([A,e.Text,W],[],[]),upload_asset_chunk:e.Func([q],[z],[]),version:e.Func([],[e.Text],["query"])})};var mt=({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.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),n=e.Record({field:r,desc:e.Bool}),o=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),i=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(o),description:e.Opt(e.Text),created_at:e.Opt(o)}),s=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(n),owner:e.Opt(e.Principal),matcher:e.Opt(i),paginate:e.Opt(s)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null}),m=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),h=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),a=e.Record({version:e.Opt(e.Nat64)}),p=e.Record({cycles:e.Nat,destination_id:e.Principal}),y=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}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),x=e.Record({key:y,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),g=e.Record({derivation_origin:e.Opt(e.Text)}),d=e.Record({internet_identity:e.Opt(g)}),w=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),P=e.Record({max_memory_size:e.Opt(w)}),R=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),V=e.Variant({Deny:e.Null,Allow:e.Null}),C=e.Record({status_code:e.Nat16,location:e.Text}),A=e.Record({iframe:e.Opt(R),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(w),raw_access:e.Opt(V),redirects:e.Opt(e.Vec(e.Tuple(e.Text,C)))}),S=e.Record({db:e.Opt(P),authentication:e.Opt(d),storage:A}),B=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),K=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)}),$=e.Variant({Heap:e.Null,Stable:e.Null}),k=e.Record({memory:$,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}),W=e.Variant({Callback:e.Record({token:k,callback:e.Func([],[],["query"])})}),q=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(W),status_code:e.Nat16}),z=e.Record({token:e.Opt(k),body:e.Vec(e.Nat8)}),ae=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}),D=e.Record({batch_id:e.Nat}),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,x)),items_length:e.Nat64}),ce=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),qe=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,B)),items_length:e.Nat64}),ee=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Ue=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt($),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ee,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:ee}),ge=e.Record({stable:e.Nat64,heap:e.Nat64}),le=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),ze=e.Record({controller:le,controllers:e.Vec(e.Principal)}),ue=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),pe=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt($),max_size:e.Opt(e.Nat),read:ee,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:ee}),je=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),He=e.Record({chunk_id:e.Nat});return e.Service({build_version:e.Func([],[e.Text],["query"]),commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,c],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,m))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,h],[],[]),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,h))],[],[]),del_rule:e.Func([f,e.Text,a],[],[]),deposit_cycles:e.Func([p],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(x)],["query"]),get_auth_config:e.Func([],[e.Opt(d)],["query"]),get_config:e.Func([],[S],[]),get_db_config:e.Func([],[e.Opt(P)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(B)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(x)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(B)))],["query"]),get_storage_config:e.Func([],[A],["query"]),http_request:e.Func([K],[q],["query"]),http_request_streaming_callback:e.Func([k],[z],["query"]),init_asset_upload:e.Func([ae],[D],[]),list_assets:e.Func([e.Text,c],[L],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,m))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,ce))],["query"]),list_docs:e.Func([e.Text,c],[qe],["query"]),list_rules:e.Func([f],[e.Vec(e.Tuple(e.Text,Ue))],["query"]),memory_size:e.Func([],[ge],["query"]),set_auth_config:e.Func([d],[],[]),set_controllers:e.Func([ze],[e.Vec(e.Tuple(e.Principal,m))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([P],[],[]),set_doc:e.Func([e.Text,e.Text,ue],[B],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,ue))],[e.Vec(e.Tuple(e.Text,B))],[]),set_rule:e.Func([f,e.Text,pe],[],[]),set_storage_config:e.Func([A],[],[]),upload_asset_chunk:e.Func([je],[He],[]),version:e.Func([],[e.Text],["query"])})};var ft=async({satelliteId:e,...t})=>de({canisterId:e,...t,idlFactory:dt}),O=async({satelliteId:e,...t})=>de({canisterId:e,...t,idlFactory:mt}),yt=async({satelliteId:e,...t})=>de({canisterId:e,...t,idlFactory:pt}),te=async({missionControlId:e,...t})=>de({canisterId:e,...t,idlFactory:lt}),xe=async({orbiterId:e,...t})=>de({canisterId:e,...t,idlFactory:ut}),de=async({canisterId:e,idlFactory:t,...r})=>{if(un(e))throw new Error("No canister ID provided.");return Ke({canisterId:e,idlFactory:t,...r})},gt=ht.fromText("aaaaa-aa"),_t=(e,t,r)=>{let n=t[0],o=gt;return n&&typeof n=="object"&&n.canister_id&&(o=ht.from(n.canister_id)),{effectiveCanisterId:o}},xt=e=>Ke({canisterId:gt.toText(),config:{callTransform:_t,queryTransform:_t},idlFactory:ct,...e});var I=async({actor:e,code:t})=>{let{install_code:r}=await xt(e);return r({...t,sender_canister_version:[]})},Tt=async({canisterId:e,path:t,...r})=>{mn(e,"A canister ID must be provided to request its status.");let n=await We(r);return(await pn.request({canisterId:dn.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var wt=async({missionControl:e})=>(await te(e)).version(),Nt=async({missionControl:e})=>(await te(e)).get_user(),bt=async({missionControl:e})=>(await te(e)).list_mission_control_controllers(),vt=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await te(e)).set_satellites_controllers(t,r,n),Pt=async({missionControl:e,controllerIds:t,controller:r})=>(await te(e)).set_mission_control_controllers(t,r);import{Principal as _n}from"@dfinity/principal";import{nonNullish as hn,toNullable as fn}from"@junobuild/utils";var Ge=({controllerId:e,profile:t})=>({controllerIds:[_n.fromText(e)],controller:yn(t)}),yn=e=>({metadata:hn(e)&&e!==""?[["profile",e]]:[],expires_at:fn(void 0),scope:{Admin:null}});var E={};an(E,{Bool:()=>At,BoolClass:()=>Pe,ConstructType:()=>H,Empty:()=>Ot,EmptyClass:()=>be,FixedIntClass:()=>Y,FixedNatClass:()=>j,Float32:()=>$t,Float64:()=>qt,FloatClass:()=>_e,Func:()=>er,FuncClass:()=>fe,Int:()=>Mt,Int16:()=>zt,Int32:()=>jt,Int64:()=>Ht,Int8:()=>Ut,IntClass:()=>Ce,Nat:()=>Bt,Nat16:()=>Wt,Nat32:()=>Gt,Nat64:()=>Jt,Nat8:()=>Kt,NatClass:()=>Se,Null:()=>Et,NullClass:()=>Ve,Opt:()=>Zt,OptClass:()=>oe,PrimitiveType:()=>M,Principal:()=>Yt,PrincipalClass:()=>Ee,Rec:()=>Lt,RecClass:()=>Z,Record:()=>It,RecordClass:()=>he,Reserved:()=>Ft,ReservedClass:()=>ne,Service:()=>tr,ServiceClass:()=>ke,Text:()=>kt,TextClass:()=>Re,Tuple:()=>Qt,TupleClass:()=>Fe,Type:()=>re,Unknown:()=>Nn,UnknownClass:()=>ve,Variant:()=>Dt,VariantClass:()=>Ae,Vec:()=>Xt,VecClass:()=>Oe,Visitor:()=>Ne,decode:()=>wn,encode:()=>Tn});import{Principal as xn}from"@dfinity/principal";function _(...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 G=class{constructor(t,r=t?.byteLength||0){this._buffer=Ye(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return Ye(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 Je(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}function Ye(e){return e instanceof Uint8Array?Je(e):e instanceof ArrayBuffer?e:Array.isArray(e)?Je(new Uint8Array(e)):"buffer"in e?Ye(e.buffer):Je(new Uint8Array(e))}function gn(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function U(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 gn(e)}function Vt(){throw new Error("unexpected end of buffer")}function X(e,t){return e.byteLength<t&&Vt(),e.read(t)}function Q(e){let t=e.readUint8();return t===void 0&&Vt(),t}function b(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 G(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 F(e){let t=BigInt(1),r=BigInt(0),n;do n=Q(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 G(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 J(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return F(e);break}let n=new Uint8Array(X(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 Rt(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Qe(e,t)}function Qe(e,t){e=BigInt(e);let r=new G(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 Xe(e,t){let r=BigInt(Q(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(Q(e));r=r+n*i}return r}function Ct(e,t){let r=Xe(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function Te(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var we="DIDL",St=400;function me(e,t,r){return e.map((n,o)=>r(n,t[o]))}var Ze=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=b(this._typs.length),r=_(...this._typs);return _(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return v(this._idx.get(t)||0)}},Ne=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)}},re=class{display(){return this.name}valueToString(t){return N(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},M=class extends re{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){}},H=class extends re{checkType(t){if(t instanceof Z){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)}},be=class extends M{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${N(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"}},ve=class extends re{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: ${N(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 Z?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"}},Pe=class extends M{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${N(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return v(-2)}decodeValue(t,r){switch(this.checkType(r),Q(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},Ve=class extends M{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${N(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return v(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},ne=class extends M{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"}},Re=class extends M{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${N(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=b(r.byteLength);return _(n,r)}encodeType(){return v(-15)}decodeValue(t,r){this.checkType(r);let n=F(t),o=X(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},Ce=class extends M{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: ${N(t)}`)}encodeValue(t){return v(t)}encodeType(){return v(-4)}decodeValue(t,r){return this.checkType(r),J(t)}get name(){return"int"}valueToString(t){return t.toString()}},Se=class extends M{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: ${N(t)}`)}encodeValue(t){return b(t)}encodeType(){return v(-3)}decodeValue(t,r){return this.checkType(r),F(t)}get name(){return"nat"}valueToString(t){return t.toString()}},_e=class extends M{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: ${N(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=X(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()}},Y=class extends M{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=Te(this._bits-1)*BigInt(-1),n=Te(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: ${N(t)}`)}encodeValue(t){return Qe(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return v(-9-t)}decodeValue(t,r){this.checkType(r);let n=Ct(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},j=class extends M{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=Te(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: ${N(t)}`)}encodeValue(t){return Rt(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return v(-5-t)}decodeValue(t,r){this.checkType(r);let n=Xe(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Oe=class e extends H{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof j&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof j?this._type._bits:this._type instanceof Y?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 an=Object.defineProperty;var cn=(e,t)=>{for(var r in t)an(e,r,{get:t[r],enumerable:!0})};import{Principal as Pn}from"@dfinity/principal";import{CanisterStatus as dn}from"@dfinity/agent";import{Principal as mn}from"@dfinity/principal";import{assertNonNullish as _n}from"@junobuild/utils";import{Actor as ln,HttpAgent as un}from"@dfinity/agent";import{nonNullish as ct}from"@junobuild/utils";var We=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await Ge(n);return ln.createActor(t,{agent:o,canisterId:e,...r??{}})},Ge=async({identity:e,fetch:t,container:r})=>{let n=ct(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await un.create({identity:e,host:o,retryTimes:10,...ct(t)&&{fetch:t},shouldFetchRootKey:n})};import{Principal as ht}from"@dfinity/principal";import{isNullish as pn}from"@junobuild/utils";var lt=({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=o,s=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),c=o,p=e.Record({network:t}),l=e.Nat64,y=e.Vec(l),x=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),_=e.Vec(e.Nat8),a=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),u=e.Record({height:e.Nat32,value:o,outpoint:a}),f=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:_,utxos:e.Vec(u)}),w=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),T=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:_,utxos:e.Vec(u)}),h=e.Record({transaction:e.Vec(e.Nat8),network:t}),d=e.Principal,g=e.Record({canister_id:d,num_requested_changes:e.Opt(e.Nat64)}),N=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),b=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}),v=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:N,details:b}),V=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(v),total_num_changes:e.Nat64}),A=e.Record({canister_id:d}),S=e.Variant({controllers:e.Null,public:e.Null}),M=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:S,wasm_memory_limit:e.Nat,memory_allocation:e.Nat,compute_allocation:e.Nat}),U=e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:M,query_stats:e.Record({response_payload_bytes_total:e.Nat,num_instructions_total:e.Nat,num_calls_total:e.Nat,request_payload_bytes_total:e.Nat}),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),$=e.Record({canister_id:d}),B=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(S),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),z=e.Record({settings:e.Opt(B),sender_canister_version:e.Opt(e.Nat64)}),j=e.Record({canister_id:d}),q=e.Record({canister_id:d}),ce=e.Record({canister_id:d}),L=e.Variant({secp256k1:e.Null}),ee=e.Record({key_id:e.Record({name:e.Text,curve:L}),canister_id:e.Opt(d),derivation_path:e.Vec(e.Vec(e.Nat8))}),le=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),$e=e.Record({canister_id:d}),qe=e.Record({idx:e.Nat64,timestamp_nanos:e.Nat64,content:e.Vec(e.Nat8)}),Ue=e.Record({canister_log_records:e.Vec(qe)}),he=e.Record({value:e.Text,name:e.Text}),ue=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(he)}),ze=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:ue})],[ue],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(he)}),ge=e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({wasm_memory_persistence:e.Opt(e.Variant({keep:e.Null,replace:e.Null})),skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),te=e.Record({hash:e.Vec(e.Nat8)}),je=e.Record({arg:e.Vec(e.Nat8),wasm_module_hash:e.Vec(e.Nat8),mode:ge,chunk_hashes_list:e.Vec(te),target_canister:d,store_canister:e.Opt(d),sender_canister_version:e.Opt(e.Nat64)}),He=e.Vec(e.Nat8),Ke=e.Record({arg:e.Vec(e.Nat8),wasm_module:He,mode:ge,canister_id:d,sender_canister_version:e.Opt(e.Nat64)}),Ur=e.Record({start_at_timestamp_nanos:e.Nat64,subnet_id:e.Principal}),zr=e.Record({num_block_failures_total:e.Nat64,node_id:e.Principal,num_blocks_proposed_total:e.Nat64}),jr=e.Vec(e.Record({timestamp_nanos:e.Nat64,node_metrics:e.Vec(zr)})),Hr=e.Record({settings:e.Opt(B),specified_id:e.Opt(d),amount:e.Opt(e.Nat),sender_canister_version:e.Opt(e.Nat64)}),Kr=e.Record({canister_id:d}),Wr=e.Record({canister_id:d,amount:e.Nat}),Gr=e.Vec(e.Nat8),at=e.Variant({ed25519:e.Null,bip340secp256k1:e.Null}),Jr=e.Record({key_id:e.Record({algorithm:at,name:e.Text}),canister_id:e.Opt(d),derivation_path:e.Vec(e.Vec(e.Nat8))}),Yr=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),Qr=e.Record({key_id:e.Record({name:e.Text,curve:L}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)}),Xr=e.Record({signature:e.Vec(e.Nat8)}),Zr=e.Record({key_id:e.Record({algorithm:at,name:e.Text}),derivation_path:e.Vec(e.Vec(e.Nat8)),message:e.Vec(e.Nat8)}),Ir=e.Record({signature:e.Vec(e.Nat8)}),Dr=e.Record({canister_id:d}),Lr=e.Record({canister_id:d}),en=e.Record({canister_id:d}),tn=e.Vec(te),rn=e.Record({canister_id:d,sender_canister_version:e.Opt(e.Nat64)}),nn=e.Record({canister_id:e.Principal,settings:B,sender_canister_version:e.Opt(e.Nat64)}),on=e.Record({chunk:e.Vec(e.Nat8),canister_id:e.Principal}),sn=te;return e.Service({bitcoin_get_balance:e.Func([n],[i],[]),bitcoin_get_balance_query:e.Func([s],[c],["query"]),bitcoin_get_current_fee_percentiles:e.Func([p],[y],[]),bitcoin_get_utxos:e.Func([x],[f],[]),bitcoin_get_utxos_query:e.Func([w],[T],["query"]),bitcoin_send_transaction:e.Func([h],[],[]),canister_info:e.Func([g],[V],[]),canister_status:e.Func([A],[U],[]),clear_chunk_store:e.Func([$],[],[]),create_canister:e.Func([z],[j],[]),delete_canister:e.Func([q],[],[]),deposit_cycles:e.Func([ce],[],[]),ecdsa_public_key:e.Func([ee],[le],[]),fetch_canister_logs:e.Func([$e],[Ue],["query"]),http_request:e.Func([ze],[ue],[]),install_chunked_code:e.Func([je],[],[]),install_code:e.Func([Ke],[],[]),node_metrics_history:e.Func([Ur],[jr],[]),provisional_create_canister_with_cycles:e.Func([Hr],[Kr],[]),provisional_top_up_canister:e.Func([Wr],[],[]),raw_rand:e.Func([],[Gr],[]),schnorr_public_key:e.Func([Jr],[Yr],[]),sign_with_ecdsa:e.Func([Qr],[Xr],[]),sign_with_schnorr:e.Func([Zr],[Ir],[]),start_canister:e.Func([Dr],[],[]),stop_canister:e.Func([Lr],[],[]),stored_chunks:e.Func([en],[tn],[]),uninstall_code:e.Func([rn],[],[]),update_settings:e.Func([nn],[],[]),upload_chunk:e.Func([on],[sn],[])})};var ut=({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({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),o=e.Record({cycles:e.Nat,destination_id:e.Principal}),i=e.Record({e8s:e.Nat64}),s=e.Record({timestamp_nanos:e.Nat64}),c=e.Record({to:e.Vec(e.Nat8),fee:i,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(s),amount:i}),p=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:i}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:i})}),l=e.Variant({Ok:e.Nat64,Err:p}),y=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),x=e.Record({to:y,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),_=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),a=e.Variant({Ok:e.Nat,Err:_}),u=e.Variant({Write:e.Null,Admin:e.Null}),f=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:u,expires_at:e.Opt(e.Nat64)}),w=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),T=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),h=e.Record({status:w,memory_size:e.Nat,cycles:e.Nat,settings:T,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),d=e.Record({id:e.Principal,status:h,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),g=e.Variant({Ok:d,Err:e.Text}),N=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:u,expires_at:e.Opt(e.Nat64)}),b=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),v=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,b)),satellites:e.Vec(e.Tuple(e.Principal,b)),cycles_threshold:e.Opt(e.Nat64)}),V=e.Record({orbiters:e.Opt(e.Vec(g)),satellites:e.Opt(e.Vec(g)),mission_control:g});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_orbiter_with_config:e.Func([r],[t],[]),create_satellite:e.Func([e.Text],[n],[]),create_satellite_with_config:e.Func([r],[n],[]),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([o],[],[]),get_user:e.Func([],[e.Principal],["query"]),icp_transfer:e.Func([c],[l],[]),icrc_transfer:e.Func([e.Principal,x],[a],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,f))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,g))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,g)))],["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,g)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["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),N],[],[]),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),N],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[n],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[n],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),N],[],[]),status:e.Func([v],[V],[]),top_up:e.Func([e.Principal,i],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),version:e.Func([],[e.Text],["query"])})};var pt=({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({version: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)}),c=e.Record({key:e.Text,collected_at:e.Nat64}),p=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),l=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:p,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),y=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),x=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),_=e.Record({browsers:y,devices:x}),a=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),u=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(a,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),f=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),w=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),T=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(w),delta:e.Float64}),h=e.Variant({WebVitalsMetric:T}),d=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),g=e.Record({updated_at:e.Nat64,session_id:e.Text,data:h,href:e.Text,metric_name:d,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),N=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),b=e.Record({overall:N,pages:e.Vec(e.Tuple(e.Text,N))}),v=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,version:e.Opt(e.Nat64)}),V=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),A=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),S=e.Record({updated_at:e.Nat64,features:e.Opt(A),created_at:e.Nat64,version:e.Opt(e.Nat64)}),M=e.Record({stable:e.Nat64,heap:e.Nat64}),U=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),$=e.Record({controller:U,controllers:e.Vec(e.Principal)}),B=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:p,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),z=e.Variant({Ok:l,Err:e.Text}),j=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(c,e.Text))}),q=e.Record({session_id:e.Text,data:h,href:e.Text,metric_name:d,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ce=e.Variant({Ok:g,Err:e.Text}),L=e.Record({features:e.Opt(A),version:e.Opt(e.Nat64)}),ee=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,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),le=e.Variant({Ok:v,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(c,l))],["query"]),get_page_views_analytics_clients:e.Func([s],[_],["query"]),get_page_views_analytics_metrics:e.Func([s],[u],["query"]),get_page_views_analytics_top_10:e.Func([s],[f],["query"]),get_performance_metrics:e.Func([s],[e.Vec(e.Tuple(c,g))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([s],[b],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(c,v))],["query"]),get_track_events_analytics:e.Func([s],[V],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,S))],["query"]),memory_size:e.Func([],[M],["query"]),set_controllers:e.Func([$],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([c,B],[z],[]),set_page_views:e.Func([e.Vec(e.Tuple(c,B))],[j],[]),set_performance_metric:e.Func([c,q],[ce],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(c,q))],[j],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,L))],[e.Vec(e.Tuple(e.Principal,S))],[]),set_track_event:e.Func([c,ee],[le],[]),set_track_events:e.Func([e.Vec(e.Tuple(c,ee))],[j],[]),version:e.Func([],[e.Text],["query"])})};var dt=({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}),c=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),p=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),l=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}),y=e.Variant({Callback:e.Record({token:l,callback:e.Func([],[],[])})}),x=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(l),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}),u=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),w=e.Record({field:f,desc:e.Bool}),T=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),h=e.Record({order:e.Opt(w),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(T)}),d=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),g=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),N=e.Record({key:d,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,g)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),b=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,N))}),v=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),V=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,c))}),A=e.Variant({Db:e.Null,Storage:e.Null}),S=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),M=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:S,created_at:e.Nat64,write:S}),U=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),$=e.Record({controller:U,controllers:e.Vec(e.Principal)}),B=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),z=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:S,write:S}),j=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),q=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(c)],["query"]),http_request:e.Func([p],[x],["query"]),http_request_streaming_callback:e.Func([l],[_],["query"]),init_asset_upload:e.Func([a],[u],[]),list_assets:e.Func([e.Opt(e.Text),h],[b],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,v))],["query"]),list_docs:e.Func([e.Text,h],[V],["query"]),list_rules:e.Func([A],[e.Vec(e.Tuple(e.Text,M))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([$],[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,B],[c],[]),set_rule:e.Func([A,e.Text,z],[],[]),upload_asset_chunk:e.Func([j],[q],[]),version:e.Func([],[e.Text],["query"])})};var mt=({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}),c=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),p=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),l=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}),y=e.Variant({Callback:e.Record({token:l,callback:e.Func([],[],[])})}),x=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(l),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}),u=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),w=e.Record({field:f,desc:e.Bool}),T=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),h=e.Record({order:e.Opt(w),matcher:e.Opt(e.Text),paginate:e.Opt(T)}),d=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),g=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),N=e.Record({key:d,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,g)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),b=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,N))}),v=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),V=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,c))}),A=e.Variant({Db:e.Null,Storage:e.Null}),S=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),M=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:S,created_at:e.Nat64,write:S}),U=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),$=e.Record({controller:U,controllers:e.Vec(e.Principal)}),B=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),z=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:S,write:S}),j=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),q=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(c)],["query"]),http_request:e.Func([p],[x],["query"]),http_request_streaming_callback:e.Func([l],[_],["query"]),init_asset_upload:e.Func([a],[u],[]),list_assets:e.Func([e.Opt(e.Text),h],[b],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,v))],["query"]),list_docs:e.Func([e.Text,h],[V],["query"]),list_rules:e.Func([A],[e.Vec(e.Tuple(e.Text,M))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([$],[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,B],[c],[]),set_rule:e.Func([A,e.Text,z],[],[]),upload_asset_chunk:e.Func([j],[q],[]),version:e.Func([],[e.Text],["query"])})};var _t=({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.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),n=e.Record({field:r,desc:e.Bool}),o=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),i=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(o),description:e.Opt(e.Text),created_at:e.Opt(o)}),s=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(n),owner:e.Opt(e.Principal),matcher:e.Opt(i),paginate:e.Opt(s)}),p=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null}),y=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),x=e.Record({version:e.Opt(e.Nat64)}),_=e.Variant({Db:e.Null,Storage:e.Null}),a=e.Record({version:e.Opt(e.Nat64)}),u=e.Record({cycles:e.Nat,destination_id:e.Principal}),f=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}),w=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),T=e.Record({key:f,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,w)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),h=e.Record({derivation_origin:e.Opt(e.Text)}),d=e.Record({internet_identity:e.Opt(h)}),g=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),N=e.Record({max_memory_size:e.Opt(g)}),b=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),v=e.Variant({Deny:e.Null,Allow:e.Null}),V=e.Record({status_code:e.Nat16,location:e.Text}),A=e.Record({iframe:e.Opt(b),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(g),raw_access:e.Opt(v),redirects:e.Opt(e.Vec(e.Tuple(e.Text,V)))}),S=e.Record({db:e.Opt(N),authentication:e.Opt(d),storage:A}),M=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),U=e.Variant({Heap:e.Null,Stable:e.Null}),$=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),B=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),z=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(U),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:$,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(B),write:$}),j=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)}),q=e.Record({memory:U,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}),ce=e.Variant({Callback:e.Record({token:q,callback:e.Func([],[],["query"])})}),L=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(ce),status_code:e.Nat16}),ee=e.Record({token:e.Opt(q),body:e.Vec(e.Nat8)}),le=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}),$e=e.Record({batch_id:e.Nat}),qe=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,T)),items_length:e.Nat64}),Ue=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),he=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,M)),items_length:e.Nat64}),ue=e.Record({stable:e.Nat64,heap:e.Nat64}),ze=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),ge=e.Record({controller:ze,controllers:e.Vec(e.Principal)}),te=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),je=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(U),max_size:e.Opt(e.Nat),read:$,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(B),write:$}),He=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Ke=e.Record({chunk_id:e.Nat});return e.Service({build_version:e.Func([],[e.Text],["query"]),commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,c],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([p],[e.Vec(e.Tuple(e.Principal,y))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,x],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),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,x))],[],[]),del_rule:e.Func([_,e.Text,a],[],[]),deposit_cycles:e.Func([u],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(T)],["query"]),get_auth_config:e.Func([],[e.Opt(d)],["query"]),get_config:e.Func([],[S],[]),get_db_config:e.Func([],[e.Opt(N)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(M)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(T)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(M)))],["query"]),get_rule:e.Func([_,e.Text],[e.Opt(z)],["query"]),get_storage_config:e.Func([],[A],["query"]),http_request:e.Func([j],[L],["query"]),http_request_streaming_callback:e.Func([q],[ee],["query"]),init_asset_upload:e.Func([le],[$e],[]),list_assets:e.Func([e.Text,c],[qe],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,y))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,Ue))],["query"]),list_docs:e.Func([e.Text,c],[he],["query"]),list_rules:e.Func([_],[e.Vec(e.Tuple(e.Text,z))],["query"]),memory_size:e.Func([],[ue],["query"]),set_auth_config:e.Func([d],[],[]),set_controllers:e.Func([ge],[e.Vec(e.Tuple(e.Principal,y))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([N],[],[]),set_doc:e.Func([e.Text,e.Text,te],[M],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,te))],[e.Vec(e.Tuple(e.Text,M))],[]),set_rule:e.Func([_,e.Text,je],[z],[]),set_storage_config:e.Func([A],[],[]),upload_asset_chunk:e.Func([He],[Ke],[]),version:e.Func([],[e.Text],["query"])})};var gt=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:mt}),O=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:_t}),yt=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:dt}),re=({missionControlId:e,...t})=>pe({canisterId:e,...t,idlFactory:ut}),ye=({orbiterId:e,...t})=>pe({canisterId:e,...t,idlFactory:pt}),pe=({canisterId:e,idlFactory:t,...r})=>{if(pn(e))throw new Error("No canister ID provided.");return We({canisterId:e,idlFactory:t,...r})},xt=ht.fromText("aaaaa-aa"),ft=(e,t,r)=>{let n=t[0],o=xt;return n&&typeof n=="object"&&n.canister_id&&(o=ht.from(n.canister_id)),{effectiveCanisterId:o}},Tt=e=>We({canisterId:xt.toText(),config:{callTransform:ft,queryTransform:ft},idlFactory:lt,...e});var D=async({actor:e,code:t})=>{let{install_code:r}=await Tt(e);return r({...t,sender_canister_version:[]})},wt=async({canisterId:e,path:t,...r})=>{_n(e,"A canister ID must be provided to request its status.");let n=await Ge(r);return(await dn.request({canisterId:mn.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var Nt=async({missionControl:e})=>(await re(e)).version(),bt=async({missionControl:e})=>(await re(e)).get_user(),vt=async({missionControl:e})=>(await re(e)).list_mission_control_controllers(),Pt=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await re(e)).set_satellites_controllers(t,r,n),Vt=async({missionControl:e,controllerIds:t,controller:r})=>(await re(e)).set_mission_control_controllers(t,r);import{Principal as fn}from"@dfinity/principal";import{nonNullish as hn,toNullable as gn}from"@junobuild/utils";var Je=({controllerId:e,profile:t})=>({controllerIds:[fn.fromText(e)],controller:yn(t)}),yn=e=>({metadata:hn(e)&&e!==""?[["profile",e]]:[],expires_at:gn(void 0),scope:{Admin:null}});var E={};cn(E,{Bool:()=>Et,BoolClass:()=>ve,ConstructType:()=>W,Empty:()=>Ft,EmptyClass:()=>Ne,FixedIntClass:()=>Y,FixedNatClass:()=>K,Float32:()=>qt,Float64:()=>Ut,FloatClass:()=>me,Func:()=>tr,FuncClass:()=>fe,Int:()=>Bt,Int16:()=>jt,Int32:()=>Ht,Int64:()=>Kt,Int8:()=>zt,IntClass:()=>Re,Nat:()=>$t,Nat16:()=>Gt,Nat32:()=>Jt,Nat64:()=>Yt,Nat8:()=>Wt,NatClass:()=>Ce,Null:()=>kt,NullClass:()=>Pe,Opt:()=>It,OptClass:()=>ie,PrimitiveType:()=>k,Principal:()=>Qt,PrincipalClass:()=>Ae,Rec:()=>er,RecClass:()=>Z,Record:()=>Dt,RecordClass:()=>_e,Reserved:()=>At,ReservedClass:()=>oe,Service:()=>rr,ServiceClass:()=>Ee,Text:()=>Mt,TextClass:()=>Ve,Tuple:()=>Xt,TupleClass:()=>Oe,Type:()=>ne,Unknown:()=>bn,UnknownClass:()=>be,Variant:()=>Lt,VariantClass:()=>Fe,Vec:()=>Zt,VecClass:()=>Se,Visitor:()=>we,decode:()=>Nn,encode:()=>wn});import{Principal as Tn}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 G=class{constructor(t,r=t?.byteLength||0){this._buffer=Qe(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return Qe(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 Ye(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}function Qe(e){return e instanceof Uint8Array?Ye(e):e instanceof ArrayBuffer?e:Array.isArray(e)?Ye(new Uint8Array(e)):"buffer"in e?Qe(e.buffer):Ye(new Uint8Array(e))}function xn(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function H(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 xn(e)}function Rt(){throw new Error("unexpected end of buffer")}function X(e,t){return e.byteLength<t&&Rt(),e.read(t)}function Q(e){let t=e.readUint8();return t===void 0&&Rt(),t}function R(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 G(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 F(e){let t=BigInt(1),r=BigInt(0),n;do n=Q(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function C(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 G(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 J(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return F(e);break}let n=new Uint8Array(X(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 Ct(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Xe(e,t)}function Xe(e,t){e=BigInt(e);let r=new G(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 Ze(e,t){let r=BigInt(Q(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(Q(e));r=r+n*i}return r}function St(e,t){let r=Ze(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function xe(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var Te="DIDL",Ot=400;function de(e,t,r){return e.map((n,o)=>r(n,t[o]))}var Ie=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=R(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 C(this._idx.get(t)||0)}},we=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)}},ne=class{display(){return this.name}valueToString(t){return P(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},k=class extends ne{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){}},W=class extends ne{checkType(t){if(t instanceof Z){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)}},Ne=class extends k{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${P(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return C(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},be=class extends ne{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: ${P(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 Z?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"}},ve=class extends k{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${P(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return C(-2)}decodeValue(t,r){switch(this.checkType(r),Q(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},Pe=class extends k{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${P(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return C(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},oe=class extends k{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return C(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},Ve=class extends k{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${P(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=R(r.byteLength);return m(n,r)}encodeType(){return C(-15)}decodeValue(t,r){this.checkType(r);let n=F(t),o=X(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},Re=class extends k{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: ${P(t)}`)}encodeValue(t){return C(t)}encodeType(){return C(-4)}decodeValue(t,r){return this.checkType(r),J(t)}get name(){return"int"}valueToString(t){return t.toString()}},Ce=class extends k{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: ${P(t)}`)}encodeValue(t){return R(t)}encodeType(){return C(-3)}decodeValue(t,r){return this.checkType(r),F(t)}get name(){return"nat"}valueToString(t){return t.toString()}},me=class extends k{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: ${P(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 C(t)}decodeValue(t,r){this.checkType(r);let n=X(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()}},Y=class extends k{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=xe(this._bits-1)*BigInt(-1),n=xe(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: ${P(t)}`)}encodeValue(t){return Xe(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return C(-9-t)}decodeValue(t,r){this.checkType(r);let n=St(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},K=class extends k{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=xe(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: ${P(t)}`)}encodeValue(t){return Ct(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return C(-5-t)}decodeValue(t,r){this.checkType(r);let n=Ze(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Se=class e extends W{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof K&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof K?this._type._bits:this._type instanceof Y?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: ${N(t)}`)}encodeValue(t){let r=b(t.length);if(this._blobOptimization)return _(r,new Uint8Array(t));if(ArrayBuffer.isView(t))return _(r,new Uint8Array(t.buffer));let n=new G(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,_(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a vector type");let o=Number(F(t));if(this._type instanceof j){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 Y){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("; ")+"}"}},oe=class e extends H{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: ${N(t)}
3
+ index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${P(t)}`)}encodeValue(t){let r=R(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 G(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=C(-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(F(t));if(this._type instanceof K){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 Y){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("; ")+"}"}},ie=class e extends W{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: ${P(t)}
4
4
 
5
- -> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${N(t)}`)}encodeValue(t){return t.length===0?new Uint8Array([0]):_(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,_(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not an option type");switch(Q(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])}`}},he=class e extends H{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>U(r[0])-U(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: ${P(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=C(-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(Q(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])}`}},_e=class e extends W{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>H(r[0])-H(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: ${N(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=me(this._fields,r,([,o],i)=>o.encodeValue(i));return _(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=v(-20),n=b(this._fields.length),o=this._fields.map(([i,s])=>_(b(U(i)),s.encodeType(t)));t.add(this,_(r,n,_(...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[c,u]=n._fields[s];if(i>=this._fields.length){u.decodeValue(t,u),s++;continue}let[l,m]=this._fields[i],h=U(this._fields[i][0]),f=U(c);if(h===f)o[l]=m.decodeValue(t,u),i++,s++;else if(f>h)if(m instanceof oe||m instanceof ne)o[l]=[],i++;else throw new Error("Cannot find required field "+l);else u.decodeValue(t,u),s++}for(let[c,u]of this._fields.slice(i))if(u instanceof oe||u instanceof ne)o[c]=[];else throw new Error("Cannot find required field "+c);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 {${me(this._fields,r,([o,i],s)=>o+"="+i.valueToString(s)).join("; ")}}`}},Fe=class e extends he{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: ${P(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=de(this._fields,r,([,o],i)=>o.encodeValue(i));return m(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=C(-20),n=R(this._fields.length),o=this._fields.map(([i,s])=>m(R(H(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[c,p]=n._fields[s];if(i>=this._fields.length){p.decodeValue(t,p),s++;continue}let[l,y]=this._fields[i],x=H(this._fields[i][0]),_=H(c);if(x===_)o[l]=y.decodeValue(t,p),i++,s++;else if(_>x)if(y instanceof ie||y instanceof oe)o[l]=[],i++;else throw new Error("Cannot find required field "+l);else p.decodeValue(t,p),s++}for(let[c,p]of this._fields.slice(i))if(p instanceof ie||p instanceof oe)o[c]=[];else throw new Error("Cannot find required field "+c);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 {${de(this._fields,r,([o,i],s)=>o+"="+i.valueToString(s)).join("; ")}}`}},Oe=class e extends _e{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: ${N(t)}`)}encodeValue(t){let r=me(this._components,t,(n,o)=>n.encodeValue(o));return _(...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 {${me(this._components,t,(n,o)=>n.valueToString(o)).join("; ")}}`}},Ae=class e extends H{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>U(r[0])-U(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: ${P(t)}`)}encodeValue(t){let r=de(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 {${de(this._components,t,(n,o)=>n.valueToString(o)).join("; ")}}`}},Fe=class e extends W{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>H(r[0])-H(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: ${N(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=b(r),s=o.encodeValue(t[n]);return _(i,s)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=v(-21),n=b(this._fields.length),o=this._fields.map(([i,s])=>_(b(U(i)),s.encodeType(t)));t.add(this,_(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(F(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[c,u]of this._fields)if(U(i)===U(c)){let l=u.decodeValue(t,s);return{[c]:l}}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)}},Z=class e extends H{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: ${N(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)}};Z._counter=0;function Ie(e){if(Q(e)!==1)throw new Error("Cannot decode principal");let r=Number(F(e));return xn.fromUint8Array(new Uint8Array(X(e,r)))}var Ee=class extends M{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${N(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=b(r.byteLength);return _(new Uint8Array([1]),n,r)}encodeType(){return v(-24)}decodeValue(t,r){return this.checkType(r),Ie(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}},fe=class extends H{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: ${N(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=b(n.byteLength),i=_(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),c=b(s.byteLength);return _(new Uint8Array([1]),i,c,s)}_buildTypeTableImpl(t){this.argTypes.forEach(l=>l.buildTypeTable(t)),this.retTypes.forEach(l=>l.buildTypeTable(t));let r=v(-22),n=b(this.argTypes.length),o=_(...this.argTypes.map(l=>l.encodeType(t))),i=b(this.retTypes.length),s=_(...this.retTypes.map(l=>l.encodeType(t))),c=b(this.annotations.length),u=_(...this.annotations.map(l=>this.encodeAnnotation(l)));t.add(this,_(r,n,o,i,s,c,u))}decodeValue(t){if(Q(t)!==1)throw new Error("Cannot decode function reference");let n=Ie(t),o=Number(F(t)),i=X(t,o),c=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,c]}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")}},ke=class extends H{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: ${N(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=b(r.length);return _(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=v(-23),n=b(this._fields.length),o=this._fields.map(([i,s])=>{let c=new TextEncoder().encode(i),u=b(c.length);return _(u,c,s.encodeType(t))});t.add(this,_(r,n,...o))}decodeValue(t){return Ie(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};function N(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>St?t.substring(0,St-3)+"...":t}function Tn(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new Ze;e.forEach(u=>u.buildTypeTable(r));let n=new TextEncoder().encode(we),o=r.encode(),i=b(t.length),s=_(...e.map(u=>u.encodeType(r))),c=_(...me(e,t,(u,l)=>{try{u.covariant(l)}catch(m){throw new Error(m.message+`
11
+ variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${P(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=R(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=C(-21),n=R(this._fields.length),o=this._fields.map(([i,s])=>m(R(H(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(F(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[c,p]of this._fields)if(H(i)===H(c)){let l=p.decodeValue(t,s);return{[c]:l}}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)}},Z=class e extends W{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: ${P(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)}};Z._counter=0;function De(e){if(Q(e)!==1)throw new Error("Cannot decode principal");let r=Number(F(e));return Tn.fromUint8Array(new Uint8Array(X(e,r)))}var Ae=class extends k{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${P(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=R(r.byteLength);return m(new Uint8Array([1]),n,r)}encodeType(){return C(-24)}decodeValue(t,r){return this.checkType(r),De(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}},fe=class extends W{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: ${P(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=R(n.byteLength),i=m(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),c=R(s.byteLength);return m(new Uint8Array([1]),i,c,s)}_buildTypeTableImpl(t){this.argTypes.forEach(l=>l.buildTypeTable(t)),this.retTypes.forEach(l=>l.buildTypeTable(t));let r=C(-22),n=R(this.argTypes.length),o=m(...this.argTypes.map(l=>l.encodeType(t))),i=R(this.retTypes.length),s=m(...this.retTypes.map(l=>l.encodeType(t))),c=R(this.annotations.length),p=m(...this.annotations.map(l=>this.encodeAnnotation(l)));t.add(this,m(r,n,o,i,s,c,p))}decodeValue(t){if(Q(t)!==1)throw new Error("Cannot decode function reference");let n=De(t),o=Number(F(t)),i=X(t,o),c=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,c]}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")}},Ee=class extends W{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: ${P(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=R(r.length);return m(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=C(-23),n=R(this._fields.length),o=this._fields.map(([i,s])=>{let c=new TextEncoder().encode(i),p=R(c.length);return m(p,c,s.encodeType(t))});t.add(this,m(r,n,...o))}decodeValue(t){return De(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};function P(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>Ot?t.substring(0,Ot-3)+"...":t}function wn(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new Ie;e.forEach(p=>p.buildTypeTable(r));let n=new TextEncoder().encode(Te),o=r.encode(),i=R(t.length),s=m(...e.map(p=>p.encodeType(r))),c=m(...de(e,t,(p,l)=>{try{p.covariant(l)}catch(y){throw new Error(y.message+`
12
12
 
13
- `)}return u.encodeValue(l)}));return _(n,o,i,s,c)}function wn(e,t){let r=new G(t);if(t.byteLength<we.length)throw new Error("Message length smaller than magic number");let n=X(r,we.length),o=new TextDecoder().decode(n);if(o!==we)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],y=Number(F(a));for(let g=0;g<y;g++){let d=Number(J(a));switch(d){case-18:case-19:{let w=Number(J(a));p.push([d,w]);break}case-20:case-21:{let w=[],P=Number(F(a)),R;for(;P--;){let V=Number(F(a));if(V>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof R=="number"&&R>=V)throw new Error("field id collision or not sorted");R=V;let C=Number(J(a));w.push([V,C])}p.push([d,w]);break}case-22:{let w=[],P=Number(F(a));for(;P--;)w.push(Number(J(a)));let R=[],V=Number(F(a));for(;V--;)R.push(Number(J(a)));let C=[],A=Number(F(a));for(;A--;)switch(Number(F(a))){case 1:{C.push("query");break}case 2:{C.push("oneway");break}case 3:{C.push("composite_query");break}default:throw new Error("unknown annotation")}p.push([d,[w,R,C]]);break}case-23:{let w=Number(F(a)),P=[];for(;w--;){let R=Number(F(a)),V=new TextDecoder().decode(X(a,R)),C=J(a);P.push([V,C])}p.push([d,P]);break}default:throw new Error("Illegal op_code: "+d)}}let T=[],x=Number(F(a));for(let g=0;g<x;g++)T.push(Number(J(a)));return[p,T]}let[s,c]=i(r);if(c.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>Lt());function l(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return Et;case-2:return At;case-3:return Bt;case-4:return Mt;case-5:return Kt;case-6:return Wt;case-7:return Gt;case-8:return Jt;case-9:return Ut;case-10:return zt;case-11:return jt;case-12:return Ht;case-13:return $t;case-14:return qt;case-15:return kt;case-16:return Ft;case-17:return Ot;case-24:return Yt;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function m(a){switch(a[0]){case-19:{let p=l(a[1]);return Xt(p)}case-18:{let p=l(a[1]);return Zt(p)}case-20:{let p={};for(let[x,g]of a[1]){let d=`_${x}_`;p[d]=l(g)}let y=It(p),T=y.tryAsTuple();return Array.isArray(T)?Qt(...T):y}case-21:{let p={};for(let[y,T]of a[1]){let x=`_${y}_`;p[x]=l(T)}return Dt(p)}case-22:{let[p,y,T]=a[1];return er(p.map(x=>l(x)),y.map(x=>l(x)),T)}case-23:{let p={},y=a[1];for(let[T,x]of y){let g=l(x);if(g instanceof Z&&(g=g.getType()),!(g instanceof fe))throw new Error("Illegal service definition: services can only contain functions");p[T]=g}return tr(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let y=m(a);u[p].fill(y)}}),s.forEach((a,p)=>{if(a[0]!==-22){let y=m(a);u[p].fill(y)}});let h=c.map(a=>l(a)),f=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 f}var Ot=new be,Ft=new ne,Nn=new ve,At=new Pe,Et=new Ve,kt=new Re,Mt=new Ce,Bt=new Se,$t=new _e(32),qt=new _e(64),Ut=new Y(8),zt=new Y(16),jt=new Y(32),Ht=new Y(64),Kt=new j(8),Wt=new j(16),Gt=new j(32),Jt=new j(64),Yt=new Ee;function Qt(...e){return new Fe(e)}function Xt(e){return new Oe(e)}function Zt(e){return new oe(e)}function It(e){return new he(e)}function Dt(e){return new Ae(e)}function Lt(){return new Z}function er(e,t,r=[]){return new fe(e,t,r)}function tr(e){return new ke(e)}import{Principal as Po}from"@dfinity/principal";var rr=e=>E.encode([E.Record({user:E.Principal})],[{user:e}]),Me=e=>E.encode([E.Record({controllers:E.Vec(E.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var jo=async e=>wt(e),Ho=async({missionControl:e,wasm_module:t})=>{let r=await Nt({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=rr(r);await I({actor:o,code:{canister_id:vn.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}})},Ko=async({controllerId:e,profile:t,...r})=>vt({...r,...Ge({controllerId:e,profile:t})}),Wo=async({controllerId:e,profile:t,...r})=>Pt({...r,...Ge({controllerId:e,profile:t})}),Go=e=>bt(e);import{Principal as Pn}from"@dfinity/principal";var nr=async({orbiter:e})=>(await xe(e)).version(),De=async({orbiter:e})=>(await xe(e)).list_controllers(),or=async({orbiter:e})=>{let{memory_size:t}=await xe(e);return t()};var Lo=async e=>nr(e),ei=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 De({orbiter:e}),s=Me(i);await I({actor:o,code:{canister_id:Pn.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}})},ti=e=>or(e),ri=e=>De(e);import{major as ir,minor as sr,patch as ar}from"semver";var ii=({currentVersion:e,selectedVersion:t})=>{let r=ir(e),n=ir(t),o=sr(e),i=sr(t),s=ar(e),c=ar(t);return r<n-1||o<i-1||s<c-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as Br}from"@dfinity/principal";import{fromNullable as se,isNullish as it,nonNullish as $e}from"@junobuild/utils";import{toNullable as Vn}from"@junobuild/utils";var cr=async({config:e,satellite:t})=>{let{set_storage_config:r}=await O(t);return r(e)},lr=async({config:e,satellite:t})=>{let{set_db_config:r}=await O(t);return r(e)},ur=async({config:e,satellite:t})=>{let{set_auth_config:r}=await O(t);return r(e)};var pr=async({satellite:e})=>{let{get_auth_config:t}=await O(e);return t()},dr=async({satellite:e,type:t})=>(await O(e)).list_rules(t),mr=async({type:e,collection:t,rule:r,satellite:n})=>(await O(n)).set_rule(e,t,r),_r=async({satellite:e})=>{let{version:t}=await O(e);return t()},hr=async({satellite:e})=>{let{build_version:t}=await O(e);return t()},fr=async({satellite:e})=>(await ft(e)).list_controllers(),Le=async({satellite:e})=>(await yt(e)).list_controllers(),et=async({satellite:e})=>(await O(e)).list_controllers(),yr=async({satellite:e})=>{let{list_custom_domains:t}=await O(e);return t()},gr=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await O(e);await n(t,Vn(r))},xr=async({satellite:e})=>{let{memory_size:t}=await O(e);return t()},Tr=async({collection:e,satellite:t})=>{let{count_collection_docs:r}=await O(t);return r(e)},wr=async({collection:e,satellite:t})=>{let{count_collection_assets:r}=await O(t);return r(e)},Nr=async({collection:e,satellite:t})=>{let{del_docs:r}=await O(t);return r(e)},br=async({collection:e,satellite:t})=>{let{del_assets:r}=await O(t);return r(e)},vr=async({args:e,satellite:t})=>{let{set_controllers:r}=await O(t);return r(e)};import{nonNullish as Rn,toNullable as tt}from"@junobuild/utils";var rt=e=>tt(Rn(e)?{heap:tt(e.heap),stable:tt(e.stable)}:void 0);import{fromNullable as ye,nonNullish as ie,toNullable as Be}from"@junobuild/utils";var Pr={Db:null},Vr={Storage:null},Rr={Public:null},Cr={Private:null},Sr={Managed:null},Or={Controllers:null},nt={Heap:null},Fr={Stable:null};var ot=e=>e==="storage"?Vr:Pr,kr=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,version:i,mutablePermissions:s})=>({read:Er(e),write:Er(t),memory:ie(r)?[Cn(r)]:[],version:Be(i),max_size:Be(ie(n)&&n>0?BigInt(n):void 0),max_capacity:Be(ie(o)&&o>0?o:void 0),mutable_permissions:Be(s)}),Mr=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s,max_capacity:c,memory:u,mutable_permissions:l,version:m}=t,h=s?.[0]??0n>0n?Number(ye(s)):void 0,f=c?.[0]??!1?ye(c):void 0,a=ye(m);return{collection:e,read:Ar(r),write:Ar(n),memory:Sn(ye(u)??nt),updatedAt:o,createdAt:i,...ie(a)&&{version:a},...ie(h)&&{maxSize:h},...ie(f)&&{maxCapacity:f},mutablePermissions:ye(l)??!0}},Ar=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Er=e=>{switch(e){case"public":return Rr;case"private":return Cr;case"managed":return Sr;default:return Or}},Cn=e=>{switch(e.toLowerCase()){case"heap":return nt;default:return Fr}},Sn=e=>"Heap"in e?"heap":"stable";var vi=async({config:{headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:o,maxMemorySize:i},satellite:s})=>{let c=(e??[]).map(({source:f,headers:a})=>[f,a]),u=(t??[]).map(({source:f,destination:a})=>[f,a]),l=(r??[]).map(({source:f,location:a,code:p})=>[f,{status_code:p,location:a}]);return cr({satellite:s,config:{headers:c,rewrites:u,redirects:[l],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[o===!0?{Allow:null}:{Deny:null}],max_memory_size:rt(i)}})},Pi=async({config:{maxMemorySize:e},...t})=>{await lr({config:{max_memory_size:rt(e)},...t})},Vi=async({config:{internetIdentity:e},...t})=>{await ur({config:{internet_identity:it(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},Ri=async({satellite:e})=>{let t=se(await pr({satellite:e}));if(it(t))return;let r=se(t.internet_identity??[]);return{...$e(r)&&{internetIdentity:{...$e(se(r.derivation_origin))&&{derivationOrigin:se(r.derivation_origin)}}}}},Ci=async({type:e,satellite:t})=>(await dr({satellite:t,type:ot(e)})).map(n=>Mr(n)),Si=async({rule:{collection:e,...t},type:r,satellite:n})=>mr({type:ot(r),rule:kr(t),satellite:n,collection:e}),Oi=e=>_r(e),Fi=e=>hr(e),Ai=async({satellite:{satelliteId:e,...t}})=>{let r=await Tt({...t,canisterId:e,path:"juno:build"});return $e(r)&&["stock","extended"].includes(r)?r:void 0},Ei=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...s}=e;if(it(i))throw new Error("No satellite principal defined.");if(r){let m=await fr({satellite:e}),h=E.encode([E.Record({controllers:E.Vec(E.Principal)})],[{controllers:m}]);await I({actor:s,code:{canister_id:Br.fromText(i),arg:new Uint8Array(h),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}});return}let u=await(n?Le:et)({satellite:e}),l=Me(u);await I({actor:s,code:{canister_id:Br.fromText(i),arg:new Uint8Array(l),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}})},ki=async({satellite:e})=>(await yr({satellite:e})).map(([r,n])=>{let o=se(n.version);return{domain:r,bn_id:se(n.bn_id),created_at:n.created_at,updated_at:n.updated_at,...$e(o)&&{version:o}}}),Mi=async({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>gr({satellite:e,domainName:r,boundaryNodesId:n}))),Bi=e=>xr(e),$i=async e=>Tr(e),qi=async e=>Nr(e),Ui=async e=>wr(e),zi=async e=>br(e),ji=({deprecatedNoScope:e,...t})=>(e===!0?Le:et)(t),Hi=e=>vr(e);export{ii as checkUpgradeVersion,Ui as countAssets,$i as countDocs,zi as deleteAssets,qi as deleteDocs,Ri as getAuthConfig,ki as listCustomDomains,Go as listMissionControlControllers,ri as listOrbiterControllers,Ci as listRules,ji as listSatelliteControllers,jo as missionControlVersion,ti as orbiterMemorySize,Lo as orbiterVersion,Ai as satelliteBuildType,Fi as satelliteBuildVersion,Bi as satelliteMemorySize,Oi as satelliteVersion,Vi as setAuthConfig,Mi as setCustomDomains,Pi as setDatastoreConfig,Wo as setMissionControlController,Si as setRule,Hi as setSatelliteControllers,Ko as setSatellitesController,vi as setStorageConfig,Ho as upgradeMissionControl,ei as upgradeOrbiter,Ei as upgradeSatellite};
13
+ `)}return p.encodeValue(l)}));return m(n,o,i,s,c)}function Nn(e,t){let r=new G(t);if(t.byteLength<Te.length)throw new Error("Message length smaller than magic number");let n=X(r,Te.length),o=new TextDecoder().decode(n);if(o!==Te)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let u=[],f=Number(F(a));for(let h=0;h<f;h++){let d=Number(J(a));switch(d){case-18:case-19:{let g=Number(J(a));u.push([d,g]);break}case-20:case-21:{let g=[],N=Number(F(a)),b;for(;N--;){let v=Number(F(a));if(v>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof b=="number"&&b>=v)throw new Error("field id collision or not sorted");b=v;let V=Number(J(a));g.push([v,V])}u.push([d,g]);break}case-22:{let g=[],N=Number(F(a));for(;N--;)g.push(Number(J(a)));let b=[],v=Number(F(a));for(;v--;)b.push(Number(J(a)));let V=[],A=Number(F(a));for(;A--;)switch(Number(F(a))){case 1:{V.push("query");break}case 2:{V.push("oneway");break}case 3:{V.push("composite_query");break}default:throw new Error("unknown annotation")}u.push([d,[g,b,V]]);break}case-23:{let g=Number(F(a)),N=[];for(;g--;){let b=Number(F(a)),v=new TextDecoder().decode(X(a,b)),V=J(a);N.push([v,V])}u.push([d,N]);break}default:throw new Error("Illegal op_code: "+d)}}let w=[],T=Number(F(a));for(let h=0;h<T;h++)w.push(Number(J(a)));return[u,w]}let[s,c]=i(r);if(c.length<e.length)throw new Error("Wrong number of return values");let p=s.map(a=>er());function l(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return kt;case-2:return Et;case-3:return $t;case-4:return Bt;case-5:return Wt;case-6:return Gt;case-7:return Jt;case-8:return Yt;case-9:return zt;case-10:return jt;case-11:return Ht;case-12:return Kt;case-13:return qt;case-14:return Ut;case-15:return Mt;case-16:return At;case-17:return Ft;case-24:return Qt;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return p[a]}function y(a){switch(a[0]){case-19:{let u=l(a[1]);return Zt(u)}case-18:{let u=l(a[1]);return It(u)}case-20:{let u={};for(let[T,h]of a[1]){let d=`_${T}_`;u[d]=l(h)}let f=Dt(u),w=f.tryAsTuple();return Array.isArray(w)?Xt(...w):f}case-21:{let u={};for(let[f,w]of a[1]){let T=`_${f}_`;u[T]=l(w)}return Lt(u)}case-22:{let[u,f,w]=a[1];return tr(u.map(T=>l(T)),f.map(T=>l(T)),w)}case-23:{let u={},f=a[1];for(let[w,T]of f){let h=l(T);if(h instanceof Z&&(h=h.getType()),!(h instanceof fe))throw new Error("Illegal service definition: services can only contain functions");u[w]=h}return rr(u)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,u)=>{if(a[0]===-22){let f=y(a);p[u].fill(f)}}),s.forEach((a,u)=>{if(a[0]!==-22){let f=y(a);p[u].fill(f)}});let x=c.map(a=>l(a)),_=e.map((a,u)=>a.decodeValue(r,x[u]));for(let a=e.length;a<x.length;a++)x[a].decodeValue(r,x[a]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return _}var Ft=new Ne,At=new oe,bn=new be,Et=new ve,kt=new Pe,Mt=new Ve,Bt=new Re,$t=new Ce,qt=new me(32),Ut=new me(64),zt=new Y(8),jt=new Y(16),Ht=new Y(32),Kt=new Y(64),Wt=new K(8),Gt=new K(16),Jt=new K(32),Yt=new K(64),Qt=new Ae;function Xt(...e){return new Oe(e)}function Zt(e){return new Se(e)}function It(e){return new ie(e)}function Dt(e){return new _e(e)}function Lt(e){return new Fe(e)}function er(){return new Z}function tr(e,t,r=[]){return new fe(e,t,r)}function rr(e){return new Ee(e)}import{Principal as Vo}from"@dfinity/principal";var nr=e=>E.encode([E.Record({user:E.Principal})],[{user:e}]),ke=e=>E.encode([E.Record({controllers:E.Vec(E.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Ho=e=>Nt(e),Ko=async({missionControl:e,wasm_module:t})=>{let r=await bt({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=nr(r);await D({actor:o,code:{canister_id:Pn.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}})},Wo=({controllerId:e,profile:t,...r})=>Pt({...r,...Je({controllerId:e,profile:t})}),Go=({controllerId:e,profile:t,...r})=>Vt({...r,...Je({controllerId:e,profile:t})}),Jo=e=>vt(e);import{Principal as Vn}from"@dfinity/principal";var or=async({orbiter:e})=>(await ye(e)).version(),Le=async({orbiter:e})=>(await ye(e)).list_controllers(),ir=async({orbiter:e})=>{let{memory_size:t}=await ye(e);return t()};var ei=e=>or(e),ti=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 Le({orbiter:e}),s=ke(i);await D({actor:o,code:{canister_id:Vn.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}})},ri=e=>ir(e),ni=e=>Le(e);import{major as sr,minor as ar,patch as cr}from"semver";var si=({currentVersion:e,selectedVersion:t})=>{let r=sr(e),n=sr(t),o=ar(e),i=ar(t),s=cr(e),c=cr(t);return r<n-1||o<i-1||s<c-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as qr}from"@dfinity/principal";import{fromNullable as ae,isNullish as st,nonNullish as Be}from"@junobuild/utils";import{toNullable as Rn}from"@junobuild/utils";var lr=async({config:e,satellite:t})=>{let{set_storage_config:r}=await O(t);return r(e)},ur=async({config:e,satellite:t})=>{let{set_db_config:r}=await O(t);return r(e)},pr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await O(t);return r(e)};var dr=async({satellite:e})=>{let{get_auth_config:t}=await O(e);return t()},mr=async({satellite:e,type:t})=>(await O(e)).list_rules(t),_r=async({type:e,collection:t,rule:r,satellite:n})=>{let{set_rule:o}=await O(n);return o(e,t,r)},fr=async({satellite:e})=>{let{version:t}=await O(e);return t()},hr=async({satellite:e})=>{let{build_version:t}=await O(e);return t()},gr=async({satellite:e})=>(await gt(e)).list_controllers(),et=async({satellite:e})=>(await yt(e)).list_controllers(),tt=async({satellite:e})=>(await O(e)).list_controllers(),yr=async({satellite:e})=>{let{list_custom_domains:t}=await O(e);return t()},xr=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await O(e);await n(t,Rn(r))},Tr=async({satellite:e})=>{let{memory_size:t}=await O(e);return t()},wr=async({collection:e,satellite:t})=>{let{count_collection_docs:r}=await O(t);return r(e)},Nr=async({collection:e,satellite:t})=>{let{count_collection_assets:r}=await O(t);return r(e)},br=async({collection:e,satellite:t})=>{let{del_docs:r}=await O(t);return r(e)},vr=async({collection:e,satellite:t})=>{let{del_assets:r}=await O(t);return r(e)},Pr=async({args:e,satellite:t})=>{let{set_controllers:r}=await O(t);return r(e)};import{nonNullish as Cn,toNullable as rt}from"@junobuild/utils";var nt=e=>rt(Cn(e)?{heap:rt(e.heap),stable:rt(e.stable)}:void 0);import{fromNullable as se,nonNullish as I,toNullable as Me}from"@junobuild/utils";var Vr={Db:null},Rr={Storage:null},Cr={Public:null},Sr={Private:null},Or={Managed:null},Fr={Controllers:null},ot={Heap:null},Ar={Stable:null},Er=600000000n;var it=e=>e==="storage"?Rr:Vr,Br=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,version:i,mutablePermissions:s,maxTokens:c})=>({read:Mr(e),write:Mr(t),memory:I(r)?[Sn(r)]:[],version:Me(i),max_size:Me(I(n)&&n>0?BigInt(n):void 0),max_capacity:Me(I(o)&&o>0?o:void 0),mutable_permissions:Me(s),rate_config:I(c)?[{max_tokens:BigInt(c),time_per_token_ns:Er}]:[]}),$r=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s,max_capacity:c,memory:p,mutable_permissions:l,version:y,rate_config:x}=t,_=s?.[0]??0n>0n?Number(se(s)):void 0,a=c?.[0]??!1?se(c):void 0,u=se(y),f=x?.[0]?.max_tokens??0n>0n?se(x)?.max_tokens:void 0;return{collection:e,read:kr(r),write:kr(n),memory:On(se(p)??ot),updatedAt:o,createdAt:i,...I(u)&&{version:u},...I(_)&&{maxSize:_},...I(a)&&{maxCapacity:a},mutablePermissions:se(l)??!0,...I(f)&&{maxTokens:Number(f)}}},kr=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Mr=e=>{switch(e){case"public":return Cr;case"private":return Sr;case"managed":return Or;default:return Fr}},Sn=e=>{switch(e.toLowerCase()){case"heap":return ot;default:return Ar}},On=e=>"Heap"in e?"heap":"stable";var Pi=async({config:{headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:o,maxMemorySize:i},satellite:s})=>{let c=(e??[]).map(({source:_,headers:a})=>[_,a]),p=(t??[]).map(({source:_,destination:a})=>[_,a]),l=(r??[]).map(({source:_,location:a,code:u})=>[_,{status_code:u,location:a}]);return await lr({satellite:s,config:{headers:c,rewrites:p,redirects:[l],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[o===!0?{Allow:null}:{Deny:null}],max_memory_size:nt(i)}})},Vi=async({config:{maxMemorySize:e},...t})=>{await ur({config:{max_memory_size:nt(e)},...t})},Ri=async({config:{internetIdentity:e},...t})=>{await pr({config:{internet_identity:st(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},Ci=async({satellite:e})=>{let t=ae(await dr({satellite:e}));if(st(t))return;let r=ae(t.internet_identity??[]);return{...Be(r)&&{internetIdentity:{...Be(ae(r.derivation_origin))&&{derivationOrigin:ae(r.derivation_origin)}}}}},Si=async({type:e,satellite:t})=>(await mr({satellite:t,type:it(e)})).map(n=>$r(n)),Oi=async({rule:{collection:e,...t},type:r,satellite:n})=>{await _r({type:it(r),rule:Br(t),satellite:n,collection:e})},Fi=e=>fr(e),Ai=e=>hr(e),Ei=async({satellite:{satelliteId:e,...t}})=>{let r=await wt({...t,canisterId:e,path:"juno:build"});return Be(r)&&["stock","extended"].includes(r)?r:void 0},ki=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...s}=e;if(st(i))throw new Error("No satellite principal defined.");if(r){let y=await gr({satellite:e}),x=E.encode([E.Record({controllers:E.Vec(E.Principal)})],[{controllers:y}]);await D({actor:s,code:{canister_id:qr.fromText(i),arg:new Uint8Array(x),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}});return}let p=await(n?et:tt)({satellite:e}),l=ke(p);await D({actor:s,code:{canister_id:qr.fromText(i),arg:new Uint8Array(l),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]}}})},Mi=async({satellite:e})=>(await yr({satellite:e})).map(([r,n])=>{let o=ae(n.version);return{domain:r,bn_id:ae(n.bn_id),created_at:n.created_at,updated_at:n.updated_at,...Be(o)&&{version:o}}}),Bi=({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>xr({satellite:e,domainName:r,boundaryNodesId:n}))),$i=e=>Tr(e),qi=e=>wr(e),Ui=e=>br(e),zi=e=>Nr(e),ji=e=>vr(e),Hi=({deprecatedNoScope:e,...t})=>(e===!0?et:tt)(t),Ki=e=>Pr(e);export{si as checkUpgradeVersion,zi as countAssets,qi as countDocs,ji as deleteAssets,Ui as deleteDocs,Ci as getAuthConfig,Mi as listCustomDomains,Jo as listMissionControlControllers,ni as listOrbiterControllers,Si as listRules,Hi as listSatelliteControllers,Ho as missionControlVersion,ri as orbiterMemorySize,ei as orbiterVersion,Ei as satelliteBuildType,Ai as satelliteBuildVersion,$i as satelliteMemorySize,Fi as satelliteVersion,Ri as setAuthConfig,Bi as setCustomDomains,Vi as setDatastoreConfig,Go as setMissionControlController,Oi as setRule,Ki as setSatelliteControllers,Wo as setSatellitesController,Pi as setStorageConfig,Ko as upgradeMissionControl,ti as upgradeOrbiter,ki as upgradeSatellite};
14
14
  //# sourceMappingURL=index.js.map