@junobuild/admin 0.0.47-next-2024-04-28 → 0.0.47-next-2024-05-06
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.
- package/declarations/orbiter/orbiter.did.d.ts +7 -2
- package/declarations/orbiter/orbiter.factory.did.js +8 -3
- package/declarations/orbiter/orbiter.factory.did.mjs +8 -3
- package/declarations/satellite/satellite.did.d.ts +7 -3
- package/declarations/satellite/satellite.factory.did.js +10 -6
- package/declarations/satellite/satellite.factory.did.mjs +10 -6
- package/dist/browser/index.js +4 -4
- package/dist/browser/index.js.map +3 -3
- package/dist/declarations/orbiter/orbiter.did.d.ts +7 -2
- package/dist/declarations/orbiter/orbiter.factory.did.js +8 -3
- package/dist/declarations/orbiter/orbiter.factory.did.mjs +8 -3
- package/dist/declarations/satellite/satellite.did.d.ts +7 -3
- package/dist/declarations/satellite/satellite.factory.did.js +10 -6
- package/dist/declarations/satellite/satellite.factory.did.mjs +10 -6
- package/dist/node/index.mjs +3 -3
- package/dist/node/index.mjs.map +3 -3
- package/dist/types/utils/rule.utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var Xr=Object.defineProperty;var Zr=(e,t)=>{for(var r in t)Xr(e,r,{get:t[r],enumerable:!0})};import{Principal as hn}from"@dfinity/principal";import{CanisterStatus as tn}from"@dfinity/agent";import{Principal as rn}from"@dfinity/principal";import{assertNonNullish as nn}from"@junobuild/utils";import{Actor as Ir,HttpAgent as Dr}from"@dfinity/agent";import{nonNullish as Lr}from"@junobuild/utils";var $e=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await qe(n);return Ir.createActor(t,{agent:o,canisterId:e,...r!==void 0?r:{}})},qe=async({identity:e,fetch:t,container:r})=>{let n=Lr(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io",i=new Dr({identity:e,host:o,...t&&{fetch:t}});return n&&await i.fetchRootKey(),i};import{Principal as at}from"@dfinity/principal";import{isNullish as en}from"@junobuild/utils";var et=({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)}),l=o,u=e.Record({network:t}),c=e.Nat64,p=e.Vec(c),h=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),v=e.Vec(e.Nat8),a=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),d=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:v,utxos:e.Vec(d)}),x=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),g=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:v,utxos:e.Vec(d)}),y=e.Record({transaction:e.Vec(e.Nat8),network:t}),m=e.Principal,T=e.Record({canister_id:m,num_requested_changes:e.Opt(e.Nat64)}),F=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),P=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}),R=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:F,details:P}),V=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(R),total_num_changes:e.Nat64}),k=e.Record({canister_id:m}),C=e.Variant({controllers:e.Null,public:e.Null}),U=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:C,memory_allocation:e.Nat,compute_allocation:e.Nat}),G=e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:U,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),Y=e.Record({canister_id:m}),M=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(C),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),Q=e.Record({settings:e.Opt(M),sender_canister_version:e.Opt(e.Nat64)}),X=e.Record({canister_id:m}),Z=e.Record({canister_id:m}),D=e.Record({canister_id:m}),de=e.Variant({secp256k1:e.Null}),Oe=e.Record({key_id:e.Record({name:e.Text,curve:de}),canister_id:e.Opt(m),derivation_path:e.Vec(e.Vec(e.Nat8))}),Ee=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),ke=e.Record({canister_id:m}),pe=e.Record({idx:e.Nat64,timestamp_nanos:e.Nat64,content:e.Vec(e.Nat8)}),Be=e.Record({canister_log_records:e.Vec(pe)}),me=e.Record({value:e.Text,name:e.Text}),ne=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(me)}),Cr=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:ne})],[ne],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(me)}),Me=e.Vec(e.Nat8),Sr=e.Record({arg:e.Vec(e.Nat8),wasm_module_hash:e.Vec(e.Nat8),mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),chunk_hashes_list:e.Vec(Me),target_canister:m,sender_canister_version:e.Opt(e.Nat64),storage_canister:e.Opt(m)}),Ar=e.Vec(e.Nat8),Fr=e.Record({arg:e.Vec(e.Nat8),wasm_module:Ar,mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),canister_id:m,sender_canister_version:e.Opt(e.Nat64)}),Or=e.Record({start_at_timestamp_nanos:e.Nat64,subnet_id:e.Principal}),Er=e.Record({num_block_failures_total:e.Nat64,node_id:e.Principal,num_blocks_total:e.Nat64}),kr=e.Vec(e.Record({timestamp_nanos:e.Nat64,node_metrics:e.Vec(Er)})),Br=e.Record({settings:e.Opt(M),specified_id:e.Opt(m),amount:e.Opt(e.Nat),sender_canister_version:e.Opt(e.Nat64)}),Mr=e.Record({canister_id:m}),$r=e.Record({canister_id:m,amount:e.Nat}),qr=e.Vec(e.Nat8),Ur=e.Record({key_id:e.Record({name:e.Text,curve:de}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)}),jr=e.Record({signature:e.Vec(e.Nat8)}),zr=e.Record({canister_id:m}),Hr=e.Record({canister_id:m}),Kr=e.Record({canister_id:m}),Wr=e.Vec(Me),Jr=e.Record({canister_id:m,sender_canister_version:e.Opt(e.Nat64)}),Gr=e.Record({canister_id:e.Principal,settings:M,sender_canister_version:e.Opt(e.Nat64)}),Yr=e.Record({chunk:e.Vec(e.Nat8),canister_id:e.Principal}),Qr=Me;return e.Service({bitcoin_get_balance:e.Func([n],[i],[]),bitcoin_get_balance_query:e.Func([s],[l],["query"]),bitcoin_get_current_fee_percentiles:e.Func([u],[p],[]),bitcoin_get_utxos:e.Func([h],[f],[]),bitcoin_get_utxos_query:e.Func([x],[g],["query"]),bitcoin_send_transaction:e.Func([y],[],[]),canister_info:e.Func([T],[V],[]),canister_status:e.Func([k],[G],[]),clear_chunk_store:e.Func([Y],[],[]),create_canister:e.Func([Q],[X],[]),delete_canister:e.Func([Z],[],[]),deposit_cycles:e.Func([D],[],[]),ecdsa_public_key:e.Func([Oe],[Ee],[]),fetch_canister_logs:e.Func([ke],[Be],["query"]),http_request:e.Func([Cr],[ne],[]),install_chunked_code:e.Func([Sr],[],[]),install_code:e.Func([Fr],[],[]),node_metrics_history:e.Func([Or],[kr],[]),provisional_create_canister_with_cycles:e.Func([Br],[Mr],[]),provisional_top_up_canister:e.Func([$r],[],[]),raw_rand:e.Func([],[qr],[]),sign_with_ecdsa:e.Func([Ur],[jr],[]),start_canister:e.Func([zr],[],[]),stop_canister:e.Func([Hr],[],[]),stored_chunks:e.Func([Kr],[Wr],[]),uninstall_code:e.Func([Jr],[],[]),update_settings:e.Func([Gr],[],[]),upload_chunk:e.Func([Yr],[Qr],[])})};var tt=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),s=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),l=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:s,memory_size:e.Nat,cycles:e.Nat,settings:l,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),c=e.Record({id:e.Principal,status:u,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),p=e.Variant({Ok:c,Err:e.Text}),h=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),v=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,v)),satellites:e.Vec(e.Tuple(e.Principal,v)),cycles_threshold:e.Opt(e.Nat64)}),d=e.Record({orbiters:e.Opt(e.Vec(p)),satellites:e.Opt(e.Vec(p)),mission_control:p}),f=e.Record({e8s:e.Nat64});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_satellite:e.Func([e.Text],[r],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,p))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,p)))],["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,p)))],["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_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],[d],[]),top_up:e.Func([e.Principal,f],[],[]),version:e.Func([],[e.Text],["query"])})};var rt=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:r,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({cycles:e.Nat,destination_id:e.Principal}),s=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),u=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),c=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),p=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}),v=e.Record({browsers:p,devices:h}),a=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),d=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))}),x=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}),g=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),y=e.Record({updated_at:e.Nat64,created_at:e.Nat64,enabled:e.Bool}),m=e.Record({stable:e.Nat64,heap:e.Nat64}),T=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),F=e.Record({controller:T,controllers:e.Vec(e.Principal)}),P=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),R=e.Variant({Ok:c,Err:e.Text}),V=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),k=e.Record({updated_at:e.Opt(e.Nat64),enabled:e.Bool}),C=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,user_agent:e.Opt(e.Text)}),U=e.Variant({Ok:x,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(l,c))],["query"]),get_page_views_analytics_clients:e.Func([s],[v],["query"]),get_page_views_analytics_metrics:e.Func([s],[d],["query"]),get_page_views_analytics_top_10:e.Func([s],[f],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(l,x))],["query"]),get_track_events_analytics:e.Func([s],[g],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,y))],["query"]),memory_size:e.Func([],[m],["query"]),set_controllers:e.Func([F],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,P],[R],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,P))],[V],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,k))],[e.Vec(e.Tuple(e.Principal,y))],[]),set_track_event:e.Func([l,C],[U],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,C))],[V],[]),version:e.Func([],[e.Text],["query"])})};var nt=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),p=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(p),status_code:e.Nat16}),v=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),d=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),y=e.Record({order:e.Opt(x),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),m=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),F=e.Record({key:m,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}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,F))}),R=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,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),C=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),U=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:C,created_at:e.Nat64,write:C}),G=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Y=e.Record({controller:G,controllers:e.Vec(e.Principal)}),M=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),Q=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:C,write:C}),X=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(l)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([c],[v],["query"]),init_asset_upload:e.Func([a],[d],[]),list_assets:e.Func([e.Opt(e.Text),y],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,R))],["query"]),list_docs:e.Func([e.Text,y],[V],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,U))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([Y],[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,M],[l],[]),set_rule:e.Func([k,e.Text,Q],[],[]),upload_asset_chunk:e.Func([X],[Z],[]),version:e.Func([],[e.Text],["query"])})};var ot=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),p=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(p),status_code:e.Nat16}),v=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),d=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),y=e.Record({order:e.Opt(x),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),m=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),F=e.Record({key:m,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}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,F))}),R=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,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),C=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),U=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:C,created_at:e.Nat64,write:C}),G=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Y=e.Record({controller:G,controllers:e.Vec(e.Principal)}),M=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),Q=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:C,write:C}),X=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(l)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([c],[v],["query"]),init_asset_upload:e.Func([a],[d],[]),list_assets:e.Func([e.Opt(e.Text),y],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,R))],["query"]),list_docs:e.Func([e.Text,y],[V],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,U))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([Y],[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,M],[l],[]),set_rule:e.Func([k,e.Text,Q],[],[]),upload_asset_chunk:e.Func([X],[Z],[]),version:e.Func([],[e.Text],["query"])})};var it=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Variant({Db:e.Null,Storage:e.Null}),l=e.Record({cycles:e.Nat,destination_id:e.Principal}),u=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),c=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),p=e.Record({key:u,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,c)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),h=e.Record({derivation_origin:e.Opt(e.Text)}),v=e.Record({internet_identity:e.Opt(h)}),a=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),d=e.Record({status_code:e.Nat16,location:e.Text}),f=e.Record({iframe:e.Opt(a),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),redirects:e.Opt(e.Vec(e.Tuple(e.Text,d)))}),x=e.Record({storage:f}),g=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),y=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)}),m=e.Variant({Heap:e.Null,Stable:e.Null}),T=e.Record({memory:m,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}),F=e.Variant({Callback:e.Record({token:T,callback:e.Func([],[],["query"])})}),P=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(F),status_code:e.Nat16}),R=e.Record({token:e.Opt(T),body:e.Vec(e.Nat8)}),V=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}),k=e.Record({batch_id:e.Nat}),C=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),U=e.Record({field:C,desc:e.Bool}),G=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),Y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),M=e.Record({order:e.Opt(U),owner:e.Opt(e.Principal),matcher:e.Opt(G),paginate:e.Opt(Y)}),Q=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,p)),items_length:e.Nat64}),X=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),Z=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,g)),items_length:e.Nat64}),D=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),de=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(m),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:D,created_at:e.Nat64,mutable_permissions:e.Opt(e.Bool),write:D}),Oe=e.Record({stable:e.Nat64,heap:e.Nat64}),Ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),ke=e.Record({controller:Ee,controllers:e.Vec(e.Principal)}),pe=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),Be=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(m),updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:D,mutable_permissions:e.Opt(e.Bool),write:D}),me=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),ne=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],[e.Nat64],["query"]),count_docs:e.Func([e.Text],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,i))],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),deposit_cycles:e.Func([l],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(p)],["query"]),get_auth_config:e.Func([],[e.Opt(v)],["query"]),get_config:e.Func([],[x],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(g)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(p)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(g)))],["query"]),http_request:e.Func([y],[P],["query"]),http_request_streaming_callback:e.Func([T],[R],["query"]),init_asset_upload:e.Func([V],[k],[]),list_assets:e.Func([e.Text,M],[Q],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,X))],["query"]),list_docs:e.Func([e.Text,M],[Z],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,de))],["query"]),memory_size:e.Func([],[Oe],["query"]),set_auth_config:e.Func([v],[],[]),set_config:e.Func([x],[],[]),set_controllers:e.Func([ke],[e.Vec(e.Tuple(e.Principal,o))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,pe],[g],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,pe))],[e.Vec(e.Tuple(e.Text,g))],[]),set_rule:e.Func([s,e.Text,Be],[],[]),upload_asset_chunk:e.Func([me],[ne],[]),version:e.Func([],[e.Text],["query"])})};var ct=async({satelliteId:e,...t})=>oe({canisterId:e,...t,idlFactory:ot}),A=async({satelliteId:e,...t})=>oe({canisterId:e,...t,idlFactory:it}),lt=async({satelliteId:e,...t})=>oe({canisterId:e,...t,idlFactory:nt}),L=async({missionControlId:e,...t})=>oe({canisterId:e,...t,idlFactory:tt}),_e=async({orbiterId:e,...t})=>oe({canisterId:e,...t,idlFactory:rt}),oe=async({canisterId:e,idlFactory:t,...r})=>{if(en(e))throw new Error("No canister ID provided.");return $e({canisterId:e,idlFactory:t,...r})},ut=at.fromText("aaaaa-aa"),st=(e,t,r)=>{let n=t[0],o=ut;return n&&typeof n=="object"&&n.canister_id&&(o=at.from(n.canister_id)),{effectiveCanisterId:o}},dt=e=>$e({canisterId:ut.toText(),config:{callTransform:st,queryTransform:st},idlFactory:et,...e});var I=async({actor:e,code:t})=>{let{install_code:r}=await dt(e);return r({...t,sender_canister_version:[]})},pt=async({canisterId:e,path:t,...r})=>{nn(e,"A canister ID must be provided to request its status.");let n=await qe(r);return(await tn.request({canisterId:rn.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var mt=async({missionControl:e})=>(await L(e)).version(),_t=async({missionControl:e})=>(await L(e)).get_user(),ht=async({missionControl:e})=>(await L(e)).list_mission_control_controllers(),ft=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await L(e)).set_satellites_controllers(t,r,n),yt=async({missionControl:e,controllerIds:t,controller:r})=>(await L(e)).set_mission_control_controllers(t,r);import{Principal as on}from"@dfinity/principal";import{nonNullish as sn,toNullable as an}from"@junobuild/utils";var Ue=({controllerId:e,profile:t})=>({controllerIds:[on.fromText(e)],controller:cn(t)}),cn=e=>({metadata:sn(e)&&e!==""?[["profile",e]]:[],expires_at:an(void 0),scope:{Admin:null}});var O={};Zr(O,{Bool:()=>vt,BoolClass:()=>Te,ConstructType:()=>q,Empty:()=>bt,EmptyClass:()=>ge,FixedIntClass:()=>H,FixedNatClass:()=>$,Float32:()=>St,Float64:()=>At,FloatClass:()=>se,Func:()=>Gt,FuncClass:()=>ce,Int:()=>Rt,Int16:()=>Ot,Int32:()=>Et,Int64:()=>kt,Int8:()=>Ft,IntClass:()=>Ne,Nat:()=>Ct,Nat16:()=>Mt,Nat32:()=>$t,Nat64:()=>qt,Nat8:()=>Bt,NatClass:()=>ve,Null:()=>Pt,NullClass:()=>we,Opt:()=>Ht,OptClass:()=>re,PrimitiveType:()=>E,Principal:()=>Ut,PrincipalClass:()=>Ce,Rec:()=>Jt,RecClass:()=>J,Record:()=>Kt,RecordClass:()=>ae,Reserved:()=>Nt,ReservedClass:()=>te,Service:()=>Yt,ServiceClass:()=>Se,Text:()=>Vt,TextClass:()=>be,Tuple:()=>jt,TupleClass:()=>Ve,Type:()=>ee,Unknown:()=>mn,UnknownClass:()=>xe,Variant:()=>Wt,VariantClass:()=>Re,Vec:()=>zt,VecClass:()=>Pe,Visitor:()=>ye,decode:()=>pn,encode:()=>dn});import{Principal as un}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 j=class{constructor(t,r=t?.byteLength||0){this._buffer=ze(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return ze(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 ze(e){return e instanceof Uint8Array?je(e):e instanceof ArrayBuffer?e:Array.isArray(e)?je(new Uint8Array(e)):"buffer"in e?ze(e.buffer):je(new Uint8Array(e))}function ln(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function B(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 ln(e)}function gt(){throw new Error("unexpected end of buffer")}function W(e,t){return e.byteLength<t&>(),e.read(t)}function K(e){let t=e.readUint8();return t===void 0&>(),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 j(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 S(e){let t=BigInt(1),r=BigInt(0),n;do n=K(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function N(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 j(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 z(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return S(e);break}let n=new Uint8Array(W(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 xt(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return He(e,t)}function He(e,t){e=BigInt(e);let r=new j(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 Ke(e,t){let r=BigInt(K(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(K(e));r=r+n*i}return r}function Tt(e,t){let r=Ke(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function he(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var fe="DIDL",wt=400;function ie(e,t,r){return e.map((n,o)=>r(n,t[o]))}var We=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 N(this._idx.get(t)||0)}},ye=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)}},ee=class{display(){return this.name}valueToString(t){return w(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},E=class extends ee{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){}},q=class extends ee{checkType(t){if(t instanceof J){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)}},ge=class extends E{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return N(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},xe=class extends ee{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: ${w(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 J?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"}},Te=class extends E{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return N(-2)}decodeValue(t,r){switch(this.checkType(r),K(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},we=class extends E{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return N(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},te=class extends E{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return N(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},be=class extends E{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=b(r.byteLength);return _(n,r)}encodeType(){return N(-15)}decodeValue(t,r){this.checkType(r);let n=S(t),o=W(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},Ne=class extends E{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: ${w(t)}`)}encodeValue(t){return N(t)}encodeType(){return N(-4)}decodeValue(t,r){return this.checkType(r),z(t)}get name(){return"int"}valueToString(t){return t.toString()}},ve=class extends E{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: ${w(t)}`)}encodeValue(t){return b(t)}encodeType(){return N(-3)}decodeValue(t,r){return this.checkType(r),S(t)}get name(){return"nat"}valueToString(t){return t.toString()}},se=class extends E{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: ${w(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 N(t)}decodeValue(t,r){this.checkType(r);let n=W(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()}},H=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=he(this._bits-1)*BigInt(-1),n=he(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: ${w(t)}`)}encodeValue(t){return He(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return N(-9-t)}decodeValue(t,r){this.checkType(r);let n=Tt(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},$=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=he(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: ${w(t)}`)}encodeValue(t){return xt(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return N(-5-t)}decodeValue(t,r){this.checkType(r);let n=Ke(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Pe=class e extends q{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof $&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof $?this._type._bits:this._type instanceof H?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 Zr=Object.defineProperty;var Ir=(e,t)=>{for(var r in t)Zr(e,r,{get:t[r],enumerable:!0})};import{Principal as hn}from"@dfinity/principal";import{CanisterStatus as tn}from"@dfinity/agent";import{Principal as rn}from"@dfinity/principal";import{assertNonNullish as nn}from"@junobuild/utils";import{Actor as Dr,HttpAgent as Lr}from"@dfinity/agent";import{nonNullish as et}from"@junobuild/utils";var qe=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await Ue(n);return Dr.createActor(t,{agent:o,canisterId:e,...r!==void 0?r:{}})},Ue=async({identity:e,fetch:t,container:r})=>{let n=et(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io",i=new Lr({identity:e,host:o,retryTimes:10,...et(t)&&{fetch:t}});return n&&await i.fetchRootKey(),i};import{Principal as ct}from"@dfinity/principal";import{isNullish as en}from"@junobuild/utils";var tt=({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)}),l=o,u=e.Record({network:t}),c=e.Nat64,d=e.Vec(c),h=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),v=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}),f=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:v,utxos:e.Vec(p)}),x=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),g=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:v,utxos:e.Vec(p)}),y=e.Record({transaction:e.Vec(e.Nat8),network:t}),m=e.Principal,T=e.Record({canister_id:m,num_requested_changes:e.Opt(e.Nat64)}),O=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),P=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}),R=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:O,details:P}),V=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(R),total_num_changes:e.Nat64}),k=e.Record({canister_id:m}),C=e.Variant({controllers:e.Null,public:e.Null}),U=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:C,memory_allocation:e.Nat,compute_allocation:e.Nat}),G=e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:U,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),Y=e.Record({canister_id:m}),M=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(C),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),Q=e.Record({settings:e.Opt(M),sender_canister_version:e.Opt(e.Nat64)}),X=e.Record({canister_id:m}),Z=e.Record({canister_id:m}),D=e.Record({canister_id:m}),pe=e.Variant({secp256k1:e.Null}),Ee=e.Record({key_id:e.Record({name:e.Text,curve:pe}),canister_id:e.Opt(m),derivation_path:e.Vec(e.Vec(e.Nat8))}),ke=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),Be=e.Record({canister_id:m}),de=e.Record({idx:e.Nat64,timestamp_nanos:e.Nat64,content:e.Vec(e.Nat8)}),Me=e.Record({canister_log_records:e.Vec(de)}),me=e.Record({value:e.Text,name:e.Text}),ne=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(me)}),Sr=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:ne})],[ne],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(me)}),$e=e.Vec(e.Nat8),Ar=e.Record({arg:e.Vec(e.Nat8),wasm_module_hash:e.Vec(e.Nat8),mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),chunk_hashes_list:e.Vec($e),target_canister:m,sender_canister_version:e.Opt(e.Nat64),storage_canister:e.Opt(m)}),Or=e.Vec(e.Nat8),Fr=e.Record({arg:e.Vec(e.Nat8),wasm_module:Or,mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),canister_id:m,sender_canister_version:e.Opt(e.Nat64)}),Er=e.Record({start_at_timestamp_nanos:e.Nat64,subnet_id:e.Principal}),kr=e.Record({num_block_failures_total:e.Nat64,node_id:e.Principal,num_blocks_total:e.Nat64}),Br=e.Vec(e.Record({timestamp_nanos:e.Nat64,node_metrics:e.Vec(kr)})),Mr=e.Record({settings:e.Opt(M),specified_id:e.Opt(m),amount:e.Opt(e.Nat),sender_canister_version:e.Opt(e.Nat64)}),$r=e.Record({canister_id:m}),qr=e.Record({canister_id:m,amount:e.Nat}),Ur=e.Vec(e.Nat8),jr=e.Record({key_id:e.Record({name:e.Text,curve:pe}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)}),zr=e.Record({signature:e.Vec(e.Nat8)}),Hr=e.Record({canister_id:m}),Kr=e.Record({canister_id:m}),Wr=e.Record({canister_id:m}),Jr=e.Vec($e),Gr=e.Record({canister_id:m,sender_canister_version:e.Opt(e.Nat64)}),Yr=e.Record({canister_id:e.Principal,settings:M,sender_canister_version:e.Opt(e.Nat64)}),Qr=e.Record({chunk:e.Vec(e.Nat8),canister_id:e.Principal}),Xr=$e;return e.Service({bitcoin_get_balance:e.Func([n],[i],[]),bitcoin_get_balance_query:e.Func([s],[l],["query"]),bitcoin_get_current_fee_percentiles:e.Func([u],[d],[]),bitcoin_get_utxos:e.Func([h],[f],[]),bitcoin_get_utxos_query:e.Func([x],[g],["query"]),bitcoin_send_transaction:e.Func([y],[],[]),canister_info:e.Func([T],[V],[]),canister_status:e.Func([k],[G],[]),clear_chunk_store:e.Func([Y],[],[]),create_canister:e.Func([Q],[X],[]),delete_canister:e.Func([Z],[],[]),deposit_cycles:e.Func([D],[],[]),ecdsa_public_key:e.Func([Ee],[ke],[]),fetch_canister_logs:e.Func([Be],[Me],["query"]),http_request:e.Func([Sr],[ne],[]),install_chunked_code:e.Func([Ar],[],[]),install_code:e.Func([Fr],[],[]),node_metrics_history:e.Func([Er],[Br],[]),provisional_create_canister_with_cycles:e.Func([Mr],[$r],[]),provisional_top_up_canister:e.Func([qr],[],[]),raw_rand:e.Func([],[Ur],[]),sign_with_ecdsa:e.Func([jr],[zr],[]),start_canister:e.Func([Hr],[],[]),stop_canister:e.Func([Kr],[],[]),stored_chunks:e.Func([Wr],[Jr],[]),uninstall_code:e.Func([Gr],[],[]),update_settings:e.Func([Yr],[],[]),upload_chunk:e.Func([Qr],[Xr],[])})};var rt=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),s=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),l=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:s,memory_size:e.Nat,cycles:e.Nat,settings:l,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),c=e.Record({id:e.Principal,status:u,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),d=e.Variant({Ok:c,Err:e.Text}),h=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),v=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,v)),satellites:e.Vec(e.Tuple(e.Principal,v)),cycles_threshold:e.Opt(e.Nat64)}),p=e.Record({orbiters:e.Opt(e.Vec(d)),satellites:e.Opt(e.Vec(d)),mission_control:d}),f=e.Record({e8s:e.Nat64});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_satellite:e.Func([e.Text],[r],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,d))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),h],[],[]),set_orbiter: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_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),status:e.Func([a],[p],[]),top_up:e.Func([e.Principal,f],[],[]),version:e.Func([],[e.Text],["query"])})};var nt=({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)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),u=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),c=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:u,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),d=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}),v=e.Record({browsers:d,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}),f=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),x=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)}),g=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),y=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),enabled:e.Bool}),m=e.Record({stable:e.Nat64,heap:e.Nat64}),T=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),O=e.Record({controller:T,controllers:e.Vec(e.Principal)}),P=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:u,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),R=e.Variant({Ok:c,Err:e.Text}),V=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),k=e.Record({version:e.Opt(e.Nat64),enabled:e.Bool}),C=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)}),U=e.Variant({Ok:x,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(l,c))],["query"]),get_page_views_analytics_clients:e.Func([s],[v],["query"]),get_page_views_analytics_metrics:e.Func([s],[p],["query"]),get_page_views_analytics_top_10:e.Func([s],[f],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(l,x))],["query"]),get_track_events_analytics:e.Func([s],[g],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,y))],["query"]),memory_size:e.Func([],[m],["query"]),set_controllers:e.Func([O],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,P],[R],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,P))],[V],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,k))],[e.Vec(e.Tuple(e.Principal,y))],[]),set_track_event:e.Func([l,C],[U],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,C))],[V],[]),version:e.Func([],[e.Text],["query"])})};var ot=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),v=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),p=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),y=e.Record({order:e.Opt(x),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),m=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),O=e.Record({key:m,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}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,O))}),R=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,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),C=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),U=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:C,created_at:e.Nat64,write:C}),G=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Y=e.Record({controller:G,controllers:e.Vec(e.Principal)}),M=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),Q=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:C,write:C}),X=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(l)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([c],[v],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),y],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,R))],["query"]),list_docs:e.Func([e.Text,y],[V],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,U))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([Y],[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,M],[l],[]),set_rule:e.Func([k,e.Text,Q],[],[]),upload_asset_chunk:e.Func([X],[Z],[]),version:e.Func([],[e.Text],["query"])})};var it=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),v=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),p=e.Record({batch_id:e.Nat}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),y=e.Record({order:e.Opt(x),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),m=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),O=e.Record({key:m,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}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,O))}),R=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,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),C=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),U=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:C,created_at:e.Nat64,write:C}),G=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Y=e.Record({controller:G,controllers:e.Vec(e.Principal)}),M=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),Q=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:C,write:C}),X=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(l)],["query"]),http_request:e.Func([u],[h],["query"]),http_request_streaming_callback:e.Func([c],[v],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),y],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,R))],["query"]),list_docs:e.Func([e.Text,y],[V],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,U))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([Y],[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,M],[l],[]),set_rule:e.Func([k,e.Text,Q],[],[]),upload_asset_chunk:e.Func([X],[Z],[]),version:e.Func([],[e.Text],["query"])})};var st=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({version:e.Opt(e.Nat64)}),s=e.Variant({Db:e.Null,Storage:e.Null}),l=e.Record({cycles:e.Nat,destination_id:e.Principal}),u=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),c=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),d=e.Record({key:u,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,c)),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)}),v=e.Record({internet_identity:e.Opt(h)}),a=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),p=e.Record({status_code:e.Nat16,location:e.Text}),f=e.Record({iframe:e.Opt(a),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),redirects:e.Opt(e.Vec(e.Tuple(e.Text,p)))}),x=e.Record({storage:f}),g=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)}),y=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)}),m=e.Variant({Heap:e.Null,Stable:e.Null}),T=e.Record({memory:m,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}),O=e.Variant({Callback:e.Record({token:T,callback:e.Func([],[],["query"])})}),P=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(O),status_code:e.Nat16}),R=e.Record({token:e.Opt(T),body:e.Vec(e.Nat8)}),V=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}),k=e.Record({batch_id:e.Nat}),C=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),U=e.Record({field:C,desc:e.Bool}),G=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),Y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),M=e.Record({order:e.Opt(U),owner:e.Opt(e.Principal),matcher:e.Opt(G),paginate:e.Opt(Y)}),Q=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,d)),items_length:e.Nat64}),X=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),Z=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,g)),items_length:e.Nat64}),D=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),pe=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(m),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:D,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:D}),Ee=e.Record({stable:e.Nat64,heap:e.Nat64}),ke=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),Be=e.Record({controller:ke,controllers:e.Vec(e.Principal)}),de=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Me=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(m),max_size:e.Opt(e.Nat),read:D,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:D}),me=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),ne=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],[e.Nat64],["query"]),count_docs:e.Func([e.Text],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,i))],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),deposit_cycles:e.Func([l],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(d)],["query"]),get_auth_config:e.Func([],[e.Opt(v)],["query"]),get_config:e.Func([],[x],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(g)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(d)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(g)))],["query"]),http_request:e.Func([y],[P],["query"]),http_request_streaming_callback:e.Func([T],[R],["query"]),init_asset_upload:e.Func([V],[k],[]),list_assets:e.Func([e.Text,M],[Q],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,X))],["query"]),list_docs:e.Func([e.Text,M],[Z],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,pe))],["query"]),memory_size:e.Func([],[Ee],["query"]),set_auth_config:e.Func([v],[],[]),set_config:e.Func([x],[],[]),set_controllers:e.Func([Be],[e.Vec(e.Tuple(e.Principal,o))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,de],[g],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,de))],[e.Vec(e.Tuple(e.Text,g))],[]),set_rule:e.Func([s,e.Text,Me],[],[]),upload_asset_chunk:e.Func([me],[ne],[]),version:e.Func([],[e.Text],["query"])})};var lt=async({satelliteId:e,...t})=>oe({canisterId:e,...t,idlFactory:it}),A=async({satelliteId:e,...t})=>oe({canisterId:e,...t,idlFactory:st}),ut=async({satelliteId:e,...t})=>oe({canisterId:e,...t,idlFactory:ot}),L=async({missionControlId:e,...t})=>oe({canisterId:e,...t,idlFactory:rt}),_e=async({orbiterId:e,...t})=>oe({canisterId:e,...t,idlFactory:nt}),oe=async({canisterId:e,idlFactory:t,...r})=>{if(en(e))throw new Error("No canister ID provided.");return qe({canisterId:e,idlFactory:t,...r})},pt=ct.fromText("aaaaa-aa"),at=(e,t,r)=>{let n=t[0],o=pt;return n&&typeof n=="object"&&n.canister_id&&(o=ct.from(n.canister_id)),{effectiveCanisterId:o}},dt=e=>qe({canisterId:pt.toText(),config:{callTransform:at,queryTransform:at},idlFactory:tt,...e});var I=async({actor:e,code:t})=>{let{install_code:r}=await dt(e);return r({...t,sender_canister_version:[]})},mt=async({canisterId:e,path:t,...r})=>{nn(e,"A canister ID must be provided to request its status.");let n=await Ue(r);return(await tn.request({canisterId:rn.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var _t=async({missionControl:e})=>(await L(e)).version(),ht=async({missionControl:e})=>(await L(e)).get_user(),ft=async({missionControl:e})=>(await L(e)).list_mission_control_controllers(),yt=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await L(e)).set_satellites_controllers(t,r,n),gt=async({missionControl:e,controllerIds:t,controller:r})=>(await L(e)).set_mission_control_controllers(t,r);import{Principal as on}from"@dfinity/principal";import{nonNullish as sn,toNullable as an}from"@junobuild/utils";var je=({controllerId:e,profile:t})=>({controllerIds:[on.fromText(e)],controller:cn(t)}),cn=e=>({metadata:sn(e)&&e!==""?[["profile",e]]:[],expires_at:an(void 0),scope:{Admin:null}});var F={};Ir(F,{Bool:()=>Pt,BoolClass:()=>Te,ConstructType:()=>q,Empty:()=>Nt,EmptyClass:()=>ge,FixedIntClass:()=>H,FixedNatClass:()=>$,Float32:()=>At,Float64:()=>Ot,FloatClass:()=>se,Func:()=>Yt,FuncClass:()=>ce,Int:()=>Ct,Int16:()=>Et,Int32:()=>kt,Int64:()=>Bt,Int8:()=>Ft,IntClass:()=>Ne,Nat:()=>St,Nat16:()=>$t,Nat32:()=>qt,Nat64:()=>Ut,Nat8:()=>Mt,NatClass:()=>ve,Null:()=>Vt,NullClass:()=>we,Opt:()=>Kt,OptClass:()=>re,PrimitiveType:()=>E,Principal:()=>jt,PrincipalClass:()=>Ce,Rec:()=>Gt,RecClass:()=>J,Record:()=>Wt,RecordClass:()=>ae,Reserved:()=>vt,ReservedClass:()=>te,Service:()=>Qt,ServiceClass:()=>Se,Text:()=>Rt,TextClass:()=>be,Tuple:()=>zt,TupleClass:()=>Ve,Type:()=>ee,Unknown:()=>mn,UnknownClass:()=>xe,Variant:()=>Jt,VariantClass:()=>Re,Vec:()=>Ht,VecClass:()=>Pe,Visitor:()=>ye,decode:()=>dn,encode:()=>pn});import{Principal as un}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 j=class{constructor(t,r=t?.byteLength||0){this._buffer=He(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return He(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 ze(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}function He(e){return e instanceof Uint8Array?ze(e):e instanceof ArrayBuffer?e:Array.isArray(e)?ze(new Uint8Array(e)):"buffer"in e?He(e.buffer):ze(new Uint8Array(e))}function ln(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function B(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 ln(e)}function xt(){throw new Error("unexpected end of buffer")}function W(e,t){return e.byteLength<t&&xt(),e.read(t)}function K(e){let t=e.readUint8();return t===void 0&&xt(),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 j(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 S(e){let t=BigInt(1),r=BigInt(0),n;do n=K(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function N(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 j(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 z(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return S(e);break}let n=new Uint8Array(W(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 Tt(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Ke(e,t)}function Ke(e,t){e=BigInt(e);let r=new j(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 We(e,t){let r=BigInt(K(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(K(e));r=r+n*i}return r}function wt(e,t){let r=We(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function he(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var fe="DIDL",bt=400;function ie(e,t,r){return e.map((n,o)=>r(n,t[o]))}var Je=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 N(this._idx.get(t)||0)}},ye=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)}},ee=class{display(){return this.name}valueToString(t){return w(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},E=class extends ee{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){}},q=class extends ee{checkType(t){if(t instanceof J){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)}},ge=class extends E{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return N(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},xe=class extends ee{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: ${w(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 J?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"}},Te=class extends E{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return N(-2)}decodeValue(t,r){switch(this.checkType(r),K(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},we=class extends E{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return N(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},te=class extends E{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return N(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},be=class extends E{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=b(r.byteLength);return _(n,r)}encodeType(){return N(-15)}decodeValue(t,r){this.checkType(r);let n=S(t),o=W(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},Ne=class extends E{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: ${w(t)}`)}encodeValue(t){return N(t)}encodeType(){return N(-4)}decodeValue(t,r){return this.checkType(r),z(t)}get name(){return"int"}valueToString(t){return t.toString()}},ve=class extends E{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: ${w(t)}`)}encodeValue(t){return b(t)}encodeType(){return N(-3)}decodeValue(t,r){return this.checkType(r),S(t)}get name(){return"nat"}valueToString(t){return t.toString()}},se=class extends E{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: ${w(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 N(t)}decodeValue(t,r){this.checkType(r);let n=W(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()}},H=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=he(this._bits-1)*BigInt(-1),n=he(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: ${w(t)}`)}encodeValue(t){return Ke(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return N(-9-t)}decodeValue(t,r){this.checkType(r);let n=wt(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},$=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=he(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: ${w(t)}`)}encodeValue(t){return Tt(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return N(-5-t)}decodeValue(t,r){this.checkType(r);let n=We(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Pe=class e extends q{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof $&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof $?this._type._bits:this._type instanceof H?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
3
|
index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${w(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 j(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=N(-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(S(t));if(this._type instanceof $){if(this._type._bits==8)return new Uint8Array(t.read(o));if(this._type._bits==16)return new Uint16Array(t.read(o*2));if(this._type._bits==32)return new Uint32Array(t.read(o*4));if(this._type._bits==64)return new BigUint64Array(t.read(o*8))}if(this._type instanceof H){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("; ")+"}"}},re=class e extends q{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: ${w(t)}
|
|
4
4
|
|
|
5
5
|
-> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${w(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=N(-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(K(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])}`}},ae=class e extends q{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>B(r[0])-B(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: ${w(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=ie(this._fields,r,([,o],i)=>o.encodeValue(i));return _(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=N(-20),n=b(this._fields.length),o=this._fields.map(([i,s])=>_(b(B(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[l,u]=n._fields[s];if(i>=this._fields.length){u.decodeValue(t,u),s++;continue}let[c,
|
|
7
|
+
field ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=ie(this._fields,r,([,o],i)=>o.encodeValue(i));return _(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=N(-20),n=b(this._fields.length),o=this._fields.map(([i,s])=>_(b(B(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[l,u]=n._fields[s];if(i>=this._fields.length){u.decodeValue(t,u),s++;continue}let[c,d]=this._fields[i],h=B(this._fields[i][0]),v=B(l);if(h===v)o[c]=d.decodeValue(t,u),i++,s++;else if(v>h)if(d instanceof re||d instanceof te)o[c]=[],i++;else throw new Error("Cannot find required field "+c);else u.decodeValue(t,u),s++}for(let[l,u]of this._fields.slice(i))if(u instanceof re||u instanceof te)o[l]=[];else throw new Error("Cannot find required field "+l);return o}get name(){return`record {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`record {${this._fields.map(([r,n])=>r+":"+n.display()).join("; ")}}`}valueToString(t){let r=this._fields.map(([o])=>t[o]);return`record {${ie(this._fields,r,([o,i],s)=>o+"="+i.valueToString(s)).join("; ")}}`}},Ve=class e extends ae{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
9
|
index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(t){let r=ie(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 {${ie(this._components,t,(n,o)=>n.valueToString(o)).join("; ")}}`}},Re=class e extends q{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>B(r[0])-B(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: ${w(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=N(-21),n=b(this._fields.length),o=this._fields.map(([i,s])=>_(b(B(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(S(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[l,u]of this._fields)if(B(i)===B(l)){let c=u.decodeValue(t,s);return{[l]:c}}throw new Error("Cannot find field hash "+i)}get name(){return`variant {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([r,n])=>r+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(t){for(let[r,n]of this._fields)if(t.hasOwnProperty(r)){let o=n.valueToString(t[r]);return o==="null"?`variant {${r}}`:`variant {${r}=${o}}`}throw new Error("Variant has no data: "+t)}},J=class e extends q{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: ${w(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)}};J._counter=0;function
|
|
11
|
+
variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${w(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=N(-21),n=b(this._fields.length),o=this._fields.map(([i,s])=>_(b(B(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(S(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[l,u]of this._fields)if(B(i)===B(l)){let c=u.decodeValue(t,s);return{[l]:c}}throw new Error("Cannot find field hash "+i)}get name(){return`variant {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([r,n])=>r+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(t){for(let[r,n]of this._fields)if(t.hasOwnProperty(r)){let o=n.valueToString(t[r]);return o==="null"?`variant {${r}}`:`variant {${r}=${o}}`}throw new Error("Variant has no data: "+t)}},J=class e extends q{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: ${w(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)}};J._counter=0;function Ge(e){if(K(e)!==1)throw new Error("Cannot decode principal");let r=Number(S(e));return un.fromUint8Array(new Uint8Array(W(e,r)))}var Ce=class extends E{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${w(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=b(r.byteLength);return _(new Uint8Array([1]),n,r)}encodeType(){return N(-24)}decodeValue(t,r){return this.checkType(r),Ge(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}},ce=class extends q{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: ${w(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=b(n.byteLength),i=_(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),l=b(s.byteLength);return _(new Uint8Array([1]),i,l,s)}_buildTypeTableImpl(t){this.argTypes.forEach(c=>c.buildTypeTable(t)),this.retTypes.forEach(c=>c.buildTypeTable(t));let r=N(-22),n=b(this.argTypes.length),o=_(...this.argTypes.map(c=>c.encodeType(t))),i=b(this.retTypes.length),s=_(...this.retTypes.map(c=>c.encodeType(t))),l=b(this.annotations.length),u=_(...this.annotations.map(c=>this.encodeAnnotation(c)));t.add(this,_(r,n,o,i,s,l,u))}decodeValue(t){if(K(t)!==1)throw new Error("Cannot decode function reference");let n=Ge(t),o=Number(S(t)),i=W(t,o),l=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,l]}get name(){let t=this.argTypes.map(o=>o.name).join(", "),r=this.retTypes.map(o=>o.name).join(", "),n=" "+this.annotations.join(" ");return`(${t}) -> (${r})${n}`}valueToString([t,r]){return`func "${t.toText()}".${r}`}display(){let t=this.argTypes.map(o=>o.display()).join(", "),r=this.retTypes.map(o=>o.display()).join(", "),n=" "+this.annotations.join(" ");return`(${t}) \u2192 (${r})${n}`}encodeAnnotation(t){if(t==="query")return new Uint8Array([1]);if(t==="oneway")return new Uint8Array([2]);if(t==="composite_query")return new Uint8Array([3]);throw new Error("Illegal function annotation")}},Se=class extends q{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: ${w(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=N(-23),n=b(this._fields.length),o=this._fields.map(([i,s])=>{let l=new TextEncoder().encode(i),u=b(l.length);return _(u,l,s.encodeType(t))});t.add(this,_(r,n,...o))}decodeValue(t){return Ge(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};function w(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>bt?t.substring(0,bt-3)+"...":t}function pn(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new Je;e.forEach(u=>u.buildTypeTable(r));let n=new TextEncoder().encode(fe),o=r.encode(),i=b(t.length),s=_(...e.map(u=>u.encodeType(r))),l=_(...ie(e,t,(u,c)=>{try{u.covariant(c)}catch(d){throw new Error(d.message+`
|
|
12
12
|
|
|
13
|
-
`)}return u.encodeValue(c)}));return _(n,o,i,s,l)}function pn(e,t){let r=new j(t);if(t.byteLength<fe.length)throw new Error("Message length smaller than magic number");let n=W(r,fe.length),o=new TextDecoder().decode(n);if(o!==fe)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let d=[],f=Number(S(a));for(let y=0;y<f;y++){let m=Number(z(a));switch(m){case-18:case-19:{let T=Number(z(a));d.push([m,T]);break}case-20:case-21:{let T=[],F=Number(S(a)),P;for(;F--;){let R=Number(S(a));if(R>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof P=="number"&&P>=R)throw new Error("field id collision or not sorted");P=R;let V=Number(z(a));T.push([R,V])}d.push([m,T]);break}case-22:{let T=[],F=Number(S(a));for(;F--;)T.push(Number(z(a)));let P=[],R=Number(S(a));for(;R--;)P.push(Number(z(a)));let V=[],k=Number(S(a));for(;k--;)switch(Number(S(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")}d.push([m,[T,P,V]]);break}case-23:{let T=Number(S(a)),F=[];for(;T--;){let P=Number(S(a)),R=new TextDecoder().decode(W(a,P)),V=z(a);F.push([R,V])}d.push([m,F]);break}default:throw new Error("Illegal op_code: "+m)}}let x=[],g=Number(S(a));for(let y=0;y<g;y++)x.push(Number(z(a)));return[d,x]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>Jt());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return Pt;case-2:return vt;case-3:return Ct;case-4:return Rt;case-5:return Bt;case-6:return Mt;case-7:return $t;case-8:return qt;case-9:return Ft;case-10:return Ot;case-11:return Et;case-12:return kt;case-13:return St;case-14:return At;case-15:return Vt;case-16:return Nt;case-17:return bt;case-24:return Ut;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function p(a){switch(a[0]){case-19:{let d=c(a[1]);return zt(d)}case-18:{let d=c(a[1]);return Ht(d)}case-20:{let d={};for(let[g,y]of a[1]){let m=`_${g}_`;d[m]=c(y)}let f=Kt(d),x=f.tryAsTuple();return Array.isArray(x)?jt(...x):f}case-21:{let d={};for(let[f,x]of a[1]){let g=`_${f}_`;d[g]=c(x)}return Wt(d)}case-22:{let[d,f,x]=a[1];return Gt(d.map(g=>c(g)),f.map(g=>c(g)),x)}case-23:{let d={},f=a[1];for(let[x,g]of f){let y=c(g);if(y instanceof J&&(y=y.getType()),!(y instanceof ce))throw new Error("Illegal service definition: services can only contain functions");d[x]=y}return Yt(d)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,d)=>{if(a[0]===-22){let f=p(a);u[d].fill(f)}}),s.forEach((a,d)=>{if(a[0]!==-22){let f=p(a);u[d].fill(f)}});let h=l.map(a=>c(a)),v=e.map((a,d)=>a.decodeValue(r,h[d]));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 v}var bt=new ge,Nt=new te,mn=new xe,vt=new Te,Pt=new we,Vt=new be,Rt=new Ne,Ct=new ve,St=new se(32),At=new se(64),Ft=new H(8),Ot=new H(16),Et=new H(32),kt=new H(64),Bt=new $(8),Mt=new $(16),$t=new $(32),qt=new $(64),Ut=new Ce;function jt(...e){return new Ve(e)}function zt(e){return new Pe(e)}function Ht(e){return new re(e)}function Kt(e){return new ae(e)}function Wt(e){return new Re(e)}function Jt(){return new J}function Gt(e,t,r=[]){return new ce(e,t,r)}function Yt(e){return new Se(e)}import{Principal as fo}from"@dfinity/principal";var Qt=e=>O.encode([O.Record({user:O.Principal})],[{user:e}]),Ae=e=>O.encode([O.Record({controllers:O.Vec(O.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Oo=async e=>mt(e),Eo=async({missionControl:e,wasm_module:t})=>{let r=await _t({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=Qt(r);await I({actor:o,code:{canister_id:hn.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},ko=async({controllerId:e,profile:t,...r})=>ft({...r,...Ue({controllerId:e,profile:t})}),Bo=async({controllerId:e,profile:t,...r})=>yt({...r,...Ue({controllerId:e,profile:t})}),Mo=e=>ht(e);import{Principal as fn}from"@dfinity/principal";var Xt=async({orbiter:e})=>(await _e(e)).version(),Ge=async({orbiter:e})=>(await _e(e)).list_controllers(),Zt=async({orbiter:e})=>{let{memory_size:t}=await _e(e);return t()};var Wo=async e=>Xt(e),Jo=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 Ge({orbiter:e}),s=Ae(i);await I({actor:o,code:{canister_id:fn.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},Go=e=>Zt(e),Yo=e=>Ge(e);import{major as It,minor as Dt,patch as Lt}from"semver";var Zo=({currentVersion:e,selectedVersion:t})=>{let r=It(e),n=It(t),o=Dt(e),i=Dt(t),s=Lt(e),l=Lt(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as Rr}from"@dfinity/principal";import{fromNullable as ue,isNullish as Le,nonNullish as De}from"@junobuild/utils";import{toNullable as yn}from"@junobuild/utils";var er=async({config:e,satellite:t})=>{let{set_config:r}=await A(t);return r(e)},tr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await A(t);return r(e)},rr=async({satellite:e})=>{let{get_auth_config:t}=await A(e);return t()},nr=async({satellite:e,type:t})=>(await A(e)).list_rules(t),or=async({type:e,collection:t,rule:r,satellite:n})=>(await A(n)).set_rule(e,t,r),ir=async({satellite:e})=>{let{version:t}=await A(e);return t()},sr=async({satellite:e})=>{let{build_version:t}=await A(e);return t()},ar=async({satellite:e})=>(await ct(e)).list_controllers(),Ye=async({satellite:e})=>(await lt(e)).list_controllers(),Qe=async({satellite:e})=>(await A(e)).list_controllers(),cr=async({satellite:e})=>{let{list_custom_domains:t}=await A(e);return t()},lr=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await A(e);await n(t,yn(r))},ur=async({satellite:e})=>{let{memory_size:t}=await A(e);return t()},dr=async({collection:e,satellite:t})=>{let{count_docs:r}=await A(t);return r(e)},pr=async({collection:e,satellite:t})=>{let{count_assets:r}=await A(t);return r(e)},mr=async({collection:e,satellite:t})=>{let{del_docs:r}=await A(t);return r(e)},_r=async({collection:e,satellite:t})=>{let{del_assets:r}=await A(t);return r(e)},hr=async({args:e,satellite:t})=>{let{set_controllers:r}=await A(t);return r(e)};import{fromNullable as Fe,isNullish as gn,nonNullish as le,toNullable as Ze}from"@junobuild/utils";var fr={Db:null},yr={Storage:null},gr={Public:null},xr={Private:null},Tr={Managed:null},wr={Controllers:null},Xe={Heap:null},br={Stable:null};var Ie=e=>e==="storage"?yr:fr,Pr=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,updatedAt:i,mutablePermissions:s})=>({read:vr(e),write:vr(t),memory:le(r)?[xn(r)]:[],updated_at:gn(i)?[]:[i],max_size:Ze(le(n)&&n>0?BigInt(n):void 0),max_capacity:Ze(le(o)&&o>0?o:void 0),mutable_permissions:Ze(s)}),Vr=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s,max_capacity:l,memory:u,mutable_permissions:c}=t,p=s?.[0]??0n>0n?Number(Fe(s)):void 0,h=l?.[0]??!1?Fe(l):void 0;return{collection:e,read:Nr(r),write:Nr(n),memory:Tn(Fe(u)??Xe),updatedAt:o,createdAt:i,...le(p)&&{maxSize:p},...le(h)&&{maxCapacity:h},mutablePermissions:Fe(c)??!0}},Nr=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",vr=e=>{switch(e){case"public":return gr;case"private":return xr;case"managed":return Tr;default:return wr}},xn=e=>{switch(e.toLowerCase()){case"heap":return Xe;default:return br}},Tn=e=>"Heap"in e?"heap":"stable";var pi=async({config:{storage:{headers:e,rewrites:t,redirects:r,iframe:n}},satellite:o})=>{let i=(e??[]).map(({source:c,headers:p})=>[c,p]),s=(t??[]).map(({source:c,destination:p})=>[c,p]),l=(r??[]).map(({source:c,location:p,code:h})=>[c,{status_code:h,location:p}]);return er({satellite:o,config:{storage:{headers:i,rewrites:s,redirects:[l],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}]}}})},mi=async({config:{authentication:{internetIdentity:e}},...t})=>{await tr({config:{internet_identity:Le(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},_i=async({satellite:e})=>{let t=ue(await rr({satellite:e}));if(Le(t))return;let r=ue(t.internet_identity??[]);return{...De(r)&&{internetIdentity:{...De(ue(r.derivation_origin))&&{derivationOrigin:ue(r.derivation_origin)}}}}},hi=async({type:e,satellite:t})=>(await nr({satellite:t,type:Ie(e)})).map(n=>Vr(n)),fi=async({rule:{collection:e,...t},type:r,satellite:n})=>or({type:Ie(r),rule:Pr(t),satellite:n,collection:e}),yi=e=>ir(e),gi=e=>sr(e),xi=async({satellite:{satelliteId:e,...t}})=>{let r=await pt({...t,canisterId:e,path:"juno:build"});return De(r)&&["stock","extended"].includes(r)?r:void 0},Ti=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...s}=e;if(Le(i))throw new Error("No satellite principal defined.");if(r){let p=await ar({satellite:e}),h=O.encode([O.Record({controllers:O.Vec(O.Principal)})],[{controllers:p}]);await I({actor:s,code:{canister_id:Rr.fromText(i),arg:new Uint8Array(h),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}});return}let u=await(n?Ye:Qe)({satellite:e}),c=Ae(u);await I({actor:s,code:{canister_id:Rr.fromText(i),arg:new Uint8Array(c),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},wi=async({satellite:e})=>(await cr({satellite:e})).map(([r,n])=>({domain:r,bn_id:ue(n.bn_id),created_at:n.created_at,updated_at:n.updated_at})),bi=async({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>lr({satellite:e,domainName:r,boundaryNodesId:n}))),Ni=e=>ur(e),vi=async e=>dr(e),Pi=async e=>mr(e),Vi=async e=>pr(e),Ri=async e=>_r(e),Ci=({deprecatedNoScope:e,...t})=>(e===!0?Ye:Qe)(t),Si=e=>hr(e);export{Zo as checkUpgradeVersion,Vi as countAssets,vi as countDocs,Ri as deleteAssets,Pi as deleteDocs,_i as getAuthConfig,wi as listCustomDomains,Mo as listMissionControlControllers,Yo as listOrbiterControllers,hi as listRules,Ci as listSatelliteControllers,Oo as missionControlVersion,Go as orbiterMemorySize,Wo as orbiterVersion,xi as satelliteBuildType,gi as satelliteBuildVersion,Ni as satelliteMemorySize,yi as satelliteVersion,mi as setAuthConfig,pi as setConfig,bi as setCustomDomains,Bo as setMissionControlController,fi as setRule,Si as setSatelliteControllers,ko as setSatellitesController,Eo as upgradeMissionControl,Jo as upgradeOrbiter,Ti as upgradeSatellite};
|
|
13
|
+
`)}return u.encodeValue(c)}));return _(n,o,i,s,l)}function dn(e,t){let r=new j(t);if(t.byteLength<fe.length)throw new Error("Message length smaller than magic number");let n=W(r,fe.length),o=new TextDecoder().decode(n);if(o!==fe)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],f=Number(S(a));for(let y=0;y<f;y++){let m=Number(z(a));switch(m){case-18:case-19:{let T=Number(z(a));p.push([m,T]);break}case-20:case-21:{let T=[],O=Number(S(a)),P;for(;O--;){let R=Number(S(a));if(R>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof P=="number"&&P>=R)throw new Error("field id collision or not sorted");P=R;let V=Number(z(a));T.push([R,V])}p.push([m,T]);break}case-22:{let T=[],O=Number(S(a));for(;O--;)T.push(Number(z(a)));let P=[],R=Number(S(a));for(;R--;)P.push(Number(z(a)));let V=[],k=Number(S(a));for(;k--;)switch(Number(S(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")}p.push([m,[T,P,V]]);break}case-23:{let T=Number(S(a)),O=[];for(;T--;){let P=Number(S(a)),R=new TextDecoder().decode(W(a,P)),V=z(a);O.push([R,V])}p.push([m,O]);break}default:throw new Error("Illegal op_code: "+m)}}let x=[],g=Number(S(a));for(let y=0;y<g;y++)x.push(Number(z(a)));return[p,x]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>Gt());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return Vt;case-2:return Pt;case-3:return St;case-4:return Ct;case-5:return Mt;case-6:return $t;case-7:return qt;case-8:return Ut;case-9:return Ft;case-10:return Et;case-11:return kt;case-12:return Bt;case-13:return At;case-14:return Ot;case-15:return Rt;case-16:return vt;case-17:return Nt;case-24:return jt;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function d(a){switch(a[0]){case-19:{let p=c(a[1]);return Ht(p)}case-18:{let p=c(a[1]);return Kt(p)}case-20:{let p={};for(let[g,y]of a[1]){let m=`_${g}_`;p[m]=c(y)}let f=Wt(p),x=f.tryAsTuple();return Array.isArray(x)?zt(...x):f}case-21:{let p={};for(let[f,x]of a[1]){let g=`_${f}_`;p[g]=c(x)}return Jt(p)}case-22:{let[p,f,x]=a[1];return Yt(p.map(g=>c(g)),f.map(g=>c(g)),x)}case-23:{let p={},f=a[1];for(let[x,g]of f){let y=c(g);if(y instanceof J&&(y=y.getType()),!(y instanceof ce))throw new Error("Illegal service definition: services can only contain functions");p[x]=y}return Qt(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let f=d(a);u[p].fill(f)}}),s.forEach((a,p)=>{if(a[0]!==-22){let f=d(a);u[p].fill(f)}});let h=l.map(a=>c(a)),v=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 v}var Nt=new ge,vt=new te,mn=new xe,Pt=new Te,Vt=new we,Rt=new be,Ct=new Ne,St=new ve,At=new se(32),Ot=new se(64),Ft=new H(8),Et=new H(16),kt=new H(32),Bt=new H(64),Mt=new $(8),$t=new $(16),qt=new $(32),Ut=new $(64),jt=new Ce;function zt(...e){return new Ve(e)}function Ht(e){return new Pe(e)}function Kt(e){return new re(e)}function Wt(e){return new ae(e)}function Jt(e){return new Re(e)}function Gt(){return new J}function Yt(e,t,r=[]){return new ce(e,t,r)}function Qt(e){return new Se(e)}import{Principal as ho}from"@dfinity/principal";var Xt=e=>F.encode([F.Record({user:F.Principal})],[{user:e}]),Ae=e=>F.encode([F.Record({controllers:F.Vec(F.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Oo=async e=>_t(e),Fo=async({missionControl:e,wasm_module:t})=>{let r=await ht({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=Xt(r);await I({actor:o,code:{canister_id:hn.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},Eo=async({controllerId:e,profile:t,...r})=>yt({...r,...je({controllerId:e,profile:t})}),ko=async({controllerId:e,profile:t,...r})=>gt({...r,...je({controllerId:e,profile:t})}),Bo=e=>ft(e);import{Principal as fn}from"@dfinity/principal";var Zt=async({orbiter:e})=>(await _e(e)).version(),Ye=async({orbiter:e})=>(await _e(e)).list_controllers(),It=async({orbiter:e})=>{let{memory_size:t}=await _e(e);return t()};var Ko=async e=>Zt(e),Wo=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 Ye({orbiter:e}),s=Ae(i);await I({actor:o,code:{canister_id:fn.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},Jo=e=>It(e),Go=e=>Ye(e);import{major as Dt,minor as Lt,patch as er}from"semver";var Xo=({currentVersion:e,selectedVersion:t})=>{let r=Dt(e),n=Dt(t),o=Lt(e),i=Lt(t),s=er(e),l=er(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as Cr}from"@dfinity/principal";import{fromNullable as ue,isNullish as Le,nonNullish as De}from"@junobuild/utils";import{toNullable as yn}from"@junobuild/utils";var tr=async({config:e,satellite:t})=>{let{set_config:r}=await A(t);return r(e)},rr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await A(t);return r(e)},nr=async({satellite:e})=>{let{get_auth_config:t}=await A(e);return t()},or=async({satellite:e,type:t})=>(await A(e)).list_rules(t),ir=async({type:e,collection:t,rule:r,satellite:n})=>(await A(n)).set_rule(e,t,r),sr=async({satellite:e})=>{let{version:t}=await A(e);return t()},ar=async({satellite:e})=>{let{build_version:t}=await A(e);return t()},cr=async({satellite:e})=>(await lt(e)).list_controllers(),Qe=async({satellite:e})=>(await ut(e)).list_controllers(),Xe=async({satellite:e})=>(await A(e)).list_controllers(),lr=async({satellite:e})=>{let{list_custom_domains:t}=await A(e);return t()},ur=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await A(e);await n(t,yn(r))},pr=async({satellite:e})=>{let{memory_size:t}=await A(e);return t()},dr=async({collection:e,satellite:t})=>{let{count_docs:r}=await A(t);return r(e)},mr=async({collection:e,satellite:t})=>{let{count_assets:r}=await A(t);return r(e)},_r=async({collection:e,satellite:t})=>{let{del_docs:r}=await A(t);return r(e)},hr=async({collection:e,satellite:t})=>{let{del_assets:r}=await A(t);return r(e)},fr=async({args:e,satellite:t})=>{let{set_controllers:r}=await A(t);return r(e)};import{fromNullable as Oe,nonNullish as le,toNullable as Fe}from"@junobuild/utils";var yr={Db:null},gr={Storage:null},xr={Public:null},Tr={Private:null},wr={Managed:null},br={Controllers:null},Ze={Heap:null},Nr={Stable:null};var Ie=e=>e==="storage"?gr:yr,Vr=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,version:i,mutablePermissions:s})=>({read:Pr(e),write:Pr(t),memory:le(r)?[gn(r)]:[],version:Fe(i),max_size:Fe(le(n)&&n>0?BigInt(n):void 0),max_capacity:Fe(le(o)&&o>0?o:void 0),mutable_permissions:Fe(s)}),Rr=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s,max_capacity:l,memory:u,mutable_permissions:c}=t,d=s?.[0]??0n>0n?Number(Oe(s)):void 0,h=l?.[0]??!1?Oe(l):void 0;return{collection:e,read:vr(r),write:vr(n),memory:xn(Oe(u)??Ze),updatedAt:o,createdAt:i,...le(d)&&{maxSize:d},...le(h)&&{maxCapacity:h},mutablePermissions:Oe(c)??!0}},vr=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Pr=e=>{switch(e){case"public":return xr;case"private":return Tr;case"managed":return wr;default:return br}},gn=e=>{switch(e.toLowerCase()){case"heap":return Ze;default:return Nr}},xn=e=>"Heap"in e?"heap":"stable";var pi=async({config:{storage:{headers:e,rewrites:t,redirects:r,iframe:n}},satellite:o})=>{let i=(e??[]).map(({source:c,headers:d})=>[c,d]),s=(t??[]).map(({source:c,destination:d})=>[c,d]),l=(r??[]).map(({source:c,location:d,code:h})=>[c,{status_code:h,location:d}]);return tr({satellite:o,config:{storage:{headers:i,rewrites:s,redirects:[l],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}]}}})},di=async({config:{authentication:{internetIdentity:e}},...t})=>{await rr({config:{internet_identity:Le(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},mi=async({satellite:e})=>{let t=ue(await nr({satellite:e}));if(Le(t))return;let r=ue(t.internet_identity??[]);return{...De(r)&&{internetIdentity:{...De(ue(r.derivation_origin))&&{derivationOrigin:ue(r.derivation_origin)}}}}},_i=async({type:e,satellite:t})=>(await or({satellite:t,type:Ie(e)})).map(n=>Rr(n)),hi=async({rule:{collection:e,...t},type:r,satellite:n})=>ir({type:Ie(r),rule:Vr(t),satellite:n,collection:e}),fi=e=>sr(e),yi=e=>ar(e),gi=async({satellite:{satelliteId:e,...t}})=>{let r=await mt({...t,canisterId:e,path:"juno:build"});return De(r)&&["stock","extended"].includes(r)?r:void 0},xi=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...s}=e;if(Le(i))throw new Error("No satellite principal defined.");if(r){let d=await cr({satellite:e}),h=F.encode([F.Record({controllers:F.Vec(F.Principal)})],[{controllers:d}]);await I({actor:s,code:{canister_id:Cr.fromText(i),arg:new Uint8Array(h),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}});return}let u=await(n?Qe:Xe)({satellite:e}),c=Ae(u);await I({actor:s,code:{canister_id:Cr.fromText(i),arg:new Uint8Array(c),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},Ti=async({satellite:e})=>(await lr({satellite:e})).map(([r,n])=>({domain:r,bn_id:ue(n.bn_id),created_at:n.created_at,updated_at:n.updated_at})),wi=async({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>ur({satellite:e,domainName:r,boundaryNodesId:n}))),bi=e=>pr(e),Ni=async e=>dr(e),vi=async e=>_r(e),Pi=async e=>mr(e),Vi=async e=>hr(e),Ri=({deprecatedNoScope:e,...t})=>(e===!0?Qe:Xe)(t),Ci=e=>fr(e);export{Xo as checkUpgradeVersion,Pi as countAssets,Ni as countDocs,Vi as deleteAssets,vi as deleteDocs,mi as getAuthConfig,Ti as listCustomDomains,Bo as listMissionControlControllers,Go as listOrbiterControllers,_i as listRules,Ri as listSatelliteControllers,Oo as missionControlVersion,Jo as orbiterMemorySize,Ko as orbiterVersion,gi as satelliteBuildType,yi as satelliteBuildVersion,bi as satelliteMemorySize,fi as satelliteVersion,di as setAuthConfig,pi as setConfig,wi as setCustomDomains,ko as setMissionControlController,hi as setRule,Ci as setSatelliteControllers,Eo as setSatellitesController,Fo as upgradeMissionControl,Wo as upgradeOrbiter,xi as upgradeSatellite};
|
|
14
14
|
//# sourceMappingURL=index.js.map
|