@junobuild/admin 0.1.10 → 0.2.0-next-2025-04-14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/browser/index.js +1 -1
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/declarations/mission_control/mission_control-deprecated-version.did.d.ts +231 -0
  4. package/dist/declarations/mission_control/mission_control-deprecated-version.factory.did.js +247 -0
  5. package/dist/declarations/mission_control/mission_control.did.d.ts +0 -1
  6. package/dist/declarations/mission_control/mission_control.factory.certified.did.js +1 -2
  7. package/dist/declarations/mission_control/mission_control.factory.did.js +1 -2
  8. package/dist/declarations/orbiter/orbiter-deprecated-version.did.d.ts +229 -0
  9. package/dist/declarations/orbiter/orbiter-deprecated-version.factory.did.js +271 -0
  10. package/dist/declarations/orbiter/orbiter.did.d.ts +0 -1
  11. package/dist/declarations/orbiter/orbiter.factory.certified.did.js +1 -2
  12. package/dist/declarations/orbiter/orbiter.factory.did.js +1 -2
  13. package/dist/declarations/orbiter/orbiter.factory.did.mjs +1 -2
  14. package/dist/declarations/satellite/satellite-deprecated-version.did.d.ts +291 -0
  15. package/dist/declarations/satellite/satellite-deprecated-version.factory.did.js +319 -0
  16. package/dist/declarations/satellite/satellite.did.d.ts +0 -2
  17. package/dist/declarations/satellite/satellite.factory.certified.did.js +1 -3
  18. package/dist/declarations/satellite/satellite.factory.did.js +1 -3
  19. package/dist/declarations/satellite/satellite.factory.did.mjs +1 -3
  20. package/dist/node/index.mjs +1 -1
  21. package/dist/node/index.mjs.map +4 -4
  22. package/dist/types/api/actor.api.d.ts +21 -0
  23. package/dist/types/api/ic.api.d.ts +1 -1
  24. package/dist/types/api/mission-control.api.d.ts +3 -0
  25. package/dist/types/api/orbiter.api.d.ts +3 -0
  26. package/dist/types/api/satellite.api.d.ts +9 -3
  27. package/dist/types/errors/version.errors.d.ts +9 -0
  28. package/dist/types/index.d.ts +1 -0
  29. package/dist/types/services/mission-control.version.services.d.ts +1 -1
  30. package/dist/types/services/orbiter.version.services.d.ts +1 -1
  31. package/dist/types/services/satellite.version.services.d.ts +1 -10
  32. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
1
  import { createRequire as topLevelCreateRequire } from 'module';
2
2
  const require = topLevelCreateRequire(import.meta.url);
3
- var I=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}};import{isNullish as Ze}from"@dfinity/utils";var xt=({IDL:t})=>{let e=t.Record({fund_cycles:t.Nat,min_cycles:t.Nat}),r=t.Variant({BelowThreshold:e}),o=t.Record({strategy:t.Opt(r),enabled:t.Bool}),s=t.Record({cycles:t.Opt(o)}),a=t.Record({monitoring:t.Opt(s)}),n=t.Record({updated_at:t.Nat64,orbiter_id:t.Principal,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,settings:t.Opt(a)}),i=t.Record({subnet_id:t.Opt(t.Principal),name:t.Opt(t.Text)}),c=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,satellite_id:t.Principal,settings:t.Opt(a)}),p=t.Record({cycles:t.Nat,destination_id:t.Principal}),m=t.Record({to:t.Opt(t.Text),enabled:t.Bool}),u=t.Record({notification:t.Opt(m),default_strategy:t.Opt(r)}),l=t.Record({cycles:t.Opt(u)}),d=t.Record({monitoring:t.Opt(l)}),g=t.Record({to:t.Opt(t.Nat64),from:t.Opt(t.Nat64),segment_id:t.Principal}),h=t.Record({segment_id:t.Principal,created_at:t.Nat64,nonce:t.Int32}),T=t.Record({timestamp:t.Nat64,amount:t.Nat}),f=t.Record({deposited_cycles:t.Opt(T),cycles:T}),S=t.Record({cycles:t.Opt(f)}),R=t.Record({monitored_ids:t.Vec(t.Principal),running:t.Bool}),b=t.Record({cycles:t.Opt(R)}),O=t.Record({updated_at:t.Nat64,created_at:t.Nat64,monitoring:t.Opt(s)}),q=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),user:t.Opt(t.Principal),created_at:t.Nat64,config:t.Opt(d)}),x=t.Record({e8s:t.Nat64}),E=t.Record({timestamp_nanos:t.Nat64}),P=t.Record({to:t.Vec(t.Nat8),fee:x,memo:t.Nat64,from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(E),amount:x}),y=t.Variant({TxTooOld:t.Record({allowed_window_nanos:t.Nat64}),BadFee:t.Record({expected_fee:x}),TxDuplicate:t.Record({duplicate_of:t.Nat64}),TxCreatedInFuture:t.Null,InsufficientFunds:t.Record({balance:x})}),C=t.Variant({Ok:t.Nat64,Err:y}),V=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),A=t.Record({to:V,fee:t.Opt(t.Nat),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),w=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,BadBurn:t.Record({min_burn_amount:t.Nat}),Duplicate:t.Record({duplicate_of:t.Nat}),BadFee:t.Record({expected_fee:t.Nat}),CreatedInFuture:t.Record({ledger_time:t.Nat64}),TooOld:t.Null,InsufficientFunds:t.Record({balance:t.Nat})}),M=t.Variant({Ok:t.Nat,Err:w}),k=t.Variant({Write:t.Null,Admin:t.Null}),F=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:k,expires_at:t.Opt(t.Nat64)}),B=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:k,expires_at:t.Opt(t.Nat64)}),G=t.Record({ids:t.Vec(t.Principal),strategy:r}),j=t.Record({orbiters_strategy:t.Opt(G),mission_control_strategy:t.Opt(r),satellites_strategy:t.Opt(G)}),X=t.Record({cycles_config:t.Opt(j)}),lt=t.Record({satellite_ids:t.Opt(t.Vec(t.Principal)),try_mission_control:t.Opt(t.Bool),orbiter_ids:t.Opt(t.Vec(t.Principal))}),pt=t.Record({cycles_config:t.Opt(lt)});return t.Service({add_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),add_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),create_orbiter:t.Func([t.Opt(t.Text)],[n],[]),create_orbiter_with_config:t.Func([i],[n],[]),create_satellite:t.Func([t.Text],[c],[]),create_satellite_with_config:t.Func([i],[c],[]),del_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),del_orbiter:t.Func([t.Principal,t.Nat],[],[]),del_orbiters_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),del_satellite:t.Func([t.Principal,t.Nat],[],[]),del_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),deposit_cycles:t.Func([p],[],[]),get_config:t.Func([],[t.Opt(d)],["query"]),get_metadata:t.Func([],[t.Vec(t.Tuple(t.Text,t.Text))],["query"]),get_monitoring_history:t.Func([g],[t.Vec(t.Tuple(h,S))],["query"]),get_monitoring_status:t.Func([],[b],["query"]),get_settings:t.Func([],[t.Opt(O)],["query"]),get_user:t.Func([],[t.Principal],["query"]),get_user_data:t.Func([],[q],["query"]),icp_transfer:t.Func([P],[C],[]),icrc_transfer:t.Func([t.Principal,A],[M],[]),list_mission_control_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,F))],["query"]),list_orbiters:t.Func([],[t.Vec(t.Tuple(t.Principal,n))],["query"]),list_satellites:t.Func([],[t.Vec(t.Tuple(t.Principal,c))],["query"]),remove_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),remove_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),set_config:t.Func([t.Opt(d)],[],[]),set_metadata:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),set_mission_control_controllers:t.Func([t.Vec(t.Principal),B],[],[]),set_orbiter:t.Func([t.Principal,t.Opt(t.Text)],[n],[]),set_orbiter_metadata:t.Func([t.Principal,t.Vec(t.Tuple(t.Text,t.Text))],[n],[]),set_orbiters_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),B],[],[]),set_satellite:t.Func([t.Principal,t.Opt(t.Text)],[c],[]),set_satellite_metadata:t.Func([t.Principal,t.Vec(t.Tuple(t.Text,t.Text))],[c],[]),set_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),B],[],[]),start_monitoring:t.Func([],[],[]),stop_monitoring:t.Func([],[],[]),top_up:t.Func([t.Principal,x],[],[]),unset_orbiter:t.Func([t.Principal],[],[]),unset_satellite:t.Func([t.Principal],[],[]),update_and_start_monitoring:t.Func([X],[],[]),update_and_stop_monitoring:t.Func([pt],[],[]),version:t.Func([],[t.Text],["query"])})};var Pt=({IDL:t})=>{let e=t.Record({controllers:t.Vec(t.Principal)}),r=t.Variant({Write:t.Null,Admin:t.Null}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:r,expires_at:t.Opt(t.Nat64)}),s=t.Record({version:t.Opt(t.Nat64)}),a=t.Record({cycles:t.Nat,destination_id:t.Principal}),n=t.Record({to:t.Opt(t.Nat64),from:t.Opt(t.Nat64),satellite_id:t.Opt(t.Principal)}),i=t.Record({key:t.Text,collected_at:t.Nat64}),c=t.Record({inner_height:t.Nat16,inner_width:t.Nat16}),p=t.Record({title:t.Text,updated_at:t.Nat64,referrer:t.Opt(t.Text),time_zone:t.Text,session_id:t.Text,href:t.Text,created_at:t.Nat64,satellite_id:t.Principal,device:c,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),m=t.Record({safari:t.Float64,opera:t.Float64,others:t.Float64,firefox:t.Float64,chrome:t.Float64}),u=t.Record({desktop:t.Float64,others:t.Float64,mobile:t.Float64}),l=t.Record({browsers:m,devices:u}),d=t.Record({day:t.Nat8,month:t.Nat8,year:t.Int32}),g=t.Record({bounce_rate:t.Float64,average_page_views_per_session:t.Float64,daily_total_page_views:t.Vec(t.Tuple(d,t.Nat32)),total_page_views:t.Nat32,unique_page_views:t.Nat64,unique_sessions:t.Nat64}),h=t.Record({referrers:t.Vec(t.Tuple(t.Text,t.Nat32)),pages:t.Vec(t.Tuple(t.Text,t.Nat32))}),T=t.Variant({Navigate:t.Null,Restore:t.Null,Reload:t.Null,BackForward:t.Null,BackForwardCache:t.Null,Prerender:t.Null}),f=t.Record({id:t.Text,value:t.Float64,navigation_type:t.Opt(T),delta:t.Float64}),S=t.Variant({WebVitalsMetric:f}),R=t.Variant({CLS:t.Null,FCP:t.Null,INP:t.Null,LCP:t.Null,TTFB:t.Null}),b=t.Record({updated_at:t.Nat64,session_id:t.Text,data:S,href:t.Text,metric_name:R,created_at:t.Nat64,satellite_id:t.Principal,version:t.Opt(t.Nat64)}),O=t.Record({cls:t.Opt(t.Float64),fcp:t.Opt(t.Float64),inp:t.Opt(t.Float64),lcp:t.Opt(t.Float64),ttfb:t.Opt(t.Float64)}),q=t.Record({overall:O,pages:t.Vec(t.Tuple(t.Text,O))}),x=t.Record({updated_at:t.Nat64,session_id:t.Text,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),name:t.Text,created_at:t.Nat64,satellite_id:t.Principal,version:t.Opt(t.Nat64)}),E=t.Record({total:t.Vec(t.Tuple(t.Text,t.Nat32))}),P=t.Record({performance_metrics:t.Bool,track_events:t.Bool,page_views:t.Bool}),y=t.Record({updated_at:t.Nat64,features:t.Opt(P),created_at:t.Nat64,version:t.Opt(t.Nat64)}),C=t.Record({stable:t.Nat64,heap:t.Nat64}),V=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:r,expires_at:t.Opt(t.Nat64)}),A=t.Record({controller:V,controllers:t.Vec(t.Principal)}),w=t.Record({title:t.Text,updated_at:t.Opt(t.Nat64),referrer:t.Opt(t.Text),time_zone:t.Text,session_id:t.Text,href:t.Text,satellite_id:t.Principal,device:c,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),M=t.Variant({Ok:p,Err:t.Text}),k=t.Variant({Ok:t.Null,Err:t.Vec(t.Tuple(i,t.Text))}),F=t.Record({session_id:t.Text,data:S,href:t.Text,metric_name:R,satellite_id:t.Principal,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),B=t.Variant({Ok:b,Err:t.Text}),G=t.Record({features:t.Opt(P),version:t.Opt(t.Nat64)}),j=t.Record({updated_at:t.Opt(t.Nat64),session_id:t.Text,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),name:t.Text,satellite_id:t.Principal,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),X=t.Variant({Ok:x,Err:t.Text});return t.Service({del_controllers:t.Func([e],[t.Vec(t.Tuple(t.Principal,o))],[]),del_satellite_config:t.Func([t.Principal,s],[],[]),deposit_cycles:t.Func([a],[],[]),get_page_views:t.Func([n],[t.Vec(t.Tuple(i,p))],["query"]),get_page_views_analytics_clients:t.Func([n],[l],["query"]),get_page_views_analytics_metrics:t.Func([n],[g],["query"]),get_page_views_analytics_top_10:t.Func([n],[h],["query"]),get_performance_metrics:t.Func([n],[t.Vec(t.Tuple(i,b))],["query"]),get_performance_metrics_analytics_web_vitals:t.Func([n],[q],["query"]),get_track_events:t.Func([n],[t.Vec(t.Tuple(i,x))],["query"]),get_track_events_analytics:t.Func([n],[E],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),list_satellite_configs:t.Func([],[t.Vec(t.Tuple(t.Principal,y))],["query"]),memory_size:t.Func([],[C],["query"]),set_controllers:t.Func([A],[t.Vec(t.Tuple(t.Principal,o))],[]),set_page_view:t.Func([i,w],[M],[]),set_page_views:t.Func([t.Vec(t.Tuple(i,w))],[k],[]),set_performance_metric:t.Func([i,F],[B],[]),set_performance_metrics:t.Func([t.Vec(t.Tuple(i,F))],[k],[]),set_satellite_configs:t.Func([t.Vec(t.Tuple(t.Principal,G))],[t.Vec(t.Tuple(t.Principal,y))],[]),set_track_event:t.Func([i,j],[X],[]),set_track_events:t.Func([t.Vec(t.Tuple(i,j))],[k],[]),version:t.Func([],[t.Text],["query"])})};var Tt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),s=t.Record({updated_at:t.Opt(t.Nat64)}),a=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),n=t.Record({storage:a}),i=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),c=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),p=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),m=t.Variant({Callback:t.Record({token:p,callback:t.Func([],[],[])})}),u=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(m),status_code:t.Nat16}),l=t.Record({token:t.Opt(p),body:t.Vec(t.Nat8)}),d=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),g=t.Record({batch_id:t.Nat}),h=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),T=t.Record({field:h,desc:t.Bool}),f=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),S=t.Record({order:t.Opt(T),owner:t.Opt(t.Principal),matcher:t.Opt(t.Text),paginate:t.Opt(f)}),R=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),b=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),O=t.Record({key:R,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,b)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),q=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,O))}),x=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),E=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,i))}),P=t.Variant({Db:t.Null,Storage:t.Null}),y=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),C=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:y,created_at:t.Nat64,write:y}),V=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),A=t.Record({controller:V,controllers:t.Vec(t.Principal)}),w=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),M=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:y,write:y}),k=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),F=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,o))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,s],[],[]),get_config:t.Func([],[n],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(i)],["query"]),http_request:t.Func([c],[u],["query"]),http_request_streaming_callback:t.Func([p],[l],["query"]),init_asset_upload:t.Func([d],[g],[]),list_assets:t.Func([t.Opt(t.Text),S],[q],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,x))],["query"]),list_docs:t.Func([t.Text,S],[E],["query"]),list_rules:t.Func([P],[t.Vec(t.Tuple(t.Text,C))],["query"]),set_config:t.Func([n],[],[]),set_controllers:t.Func([A],[t.Vec(t.Tuple(t.Principal,o))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,w],[i],[]),set_rule:t.Func([P,t.Text,M],[],[]),upload_asset_chunk:t.Func([k],[F],[]),version:t.Func([],[t.Text],["query"])})};var Ct=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),s=t.Record({updated_at:t.Opt(t.Nat64)}),a=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),n=t.Record({storage:a}),i=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),c=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),p=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),m=t.Variant({Callback:t.Record({token:p,callback:t.Func([],[],[])})}),u=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(m),status_code:t.Nat16}),l=t.Record({token:t.Opt(p),body:t.Vec(t.Nat8)}),d=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),g=t.Record({batch_id:t.Nat}),h=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),T=t.Record({field:h,desc:t.Bool}),f=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),S=t.Record({order:t.Opt(T),matcher:t.Opt(t.Text),paginate:t.Opt(f)}),R=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),b=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),O=t.Record({key:R,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,b)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),q=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,O))}),x=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),E=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,i))}),P=t.Variant({Db:t.Null,Storage:t.Null}),y=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),C=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:y,created_at:t.Nat64,write:y}),V=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),A=t.Record({controller:V,controllers:t.Vec(t.Principal)}),w=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),M=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:y,write:y}),k=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),F=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,o))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,s],[],[]),get_config:t.Func([],[n],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(i)],["query"]),http_request:t.Func([c],[u],["query"]),http_request_streaming_callback:t.Func([p],[l],["query"]),init_asset_upload:t.Func([d],[g],[]),list_assets:t.Func([t.Opt(t.Text),S],[q],["query"]),list_controllers:t.Func([],[t.Vec(t.Principal)],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,x))],["query"]),list_docs:t.Func([t.Text,S],[E],["query"]),list_rules:t.Func([P],[t.Vec(t.Tuple(t.Text,C))],["query"]),set_config:t.Func([n],[],[]),set_controllers:t.Func([A],[t.Vec(t.Tuple(t.Principal,o))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,w],[i],[]),set_rule:t.Func([P,t.Text,M],[],[]),upload_asset_chunk:t.Func([k],[F],[]),version:t.Func([],[t.Text],["query"])})};var Nt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),o=t.Record({field:r,desc:t.Bool}),s=t.Variant({Equal:t.Nat64,Between:t.Tuple(t.Nat64,t.Nat64),GreaterThan:t.Nat64,LessThan:t.Nat64}),a=t.Record({key:t.Opt(t.Text),updated_at:t.Opt(s),description:t.Opt(t.Text),created_at:t.Opt(s)}),n=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),i=t.Record({order:t.Opt(o),owner:t.Opt(t.Principal),matcher:t.Opt(a),paginate:t.Opt(n)}),c=t.Record({controllers:t.Vec(t.Principal)}),p=t.Variant({Write:t.Null,Admin:t.Null}),m=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:p,expires_at:t.Opt(t.Nat64)}),u=t.Record({version:t.Opt(t.Nat64)}),l=t.Variant({Db:t.Null,Storage:t.Null}),d=t.Record({version:t.Opt(t.Nat64)}),g=t.Record({cycles:t.Nat,destination_id:t.Principal}),h=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,description:t.Opt(t.Text),full_path:t.Text}),T=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),f=t.Record({key:h,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,T)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,version:t.Opt(t.Nat64)}),S=t.Record({derivation_origin:t.Opt(t.Text),external_alternative_origins:t.Opt(t.Vec(t.Text))}),R=t.Record({internet_identity:t.Opt(S)}),b=t.Record({stable:t.Opt(t.Nat64),heap:t.Opt(t.Nat64)}),O=t.Record({max_memory_size:t.Opt(b)}),q=t.Variant({Deny:t.Null,AllowAny:t.Null,SameOrigin:t.Null}),x=t.Variant({Deny:t.Null,Allow:t.Null}),E=t.Record({status_code:t.Nat16,location:t.Text}),P=t.Record({iframe:t.Opt(q),rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text)))),max_memory_size:t.Opt(b),raw_access:t.Opt(x),redirects:t.Opt(t.Vec(t.Tuple(t.Text,E)))}),y=t.Record({db:t.Opt(O),authentication:t.Opt(R),storage:P}),C=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),description:t.Opt(t.Text),created_at:t.Nat64,version:t.Opt(t.Nat64)}),V=t.Variant({Heap:t.Null,Stable:t.Null}),A=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),w=t.Record({max_tokens:t.Nat64,time_per_token_ns:t.Nat64}),M=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(V),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:A,created_at:t.Nat64,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),rate_config:t.Opt(w),write:A,max_changes_per_user:t.Opt(t.Nat32)}),k=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),certificate_version:t.Opt(t.Nat16)}),F=t.Record({memory:V,token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),B=t.Variant({Callback:t.Record({token:F,callback:t.Func([],[],["query"])})}),G=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(B),status_code:t.Nat16}),j=t.Record({token:t.Opt(F),body:t.Vec(t.Nat8)}),X=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,description:t.Opt(t.Text),encoding_type:t.Opt(t.Text),full_path:t.Text}),lt=t.Record({batch_id:t.Nat}),pt=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,f)),items_length:t.Nat64}),Ue=t.Record({updated_at:t.Nat64,created_at:t.Nat64,version:t.Opt(t.Nat64),bn_id:t.Opt(t.Text)}),qe=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,C)),items_length:t.Nat64}),Ee=t.Record({stable:t.Nat64,heap:t.Nat64}),ze=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:p,expires_at:t.Opt(t.Nat64)}),Be=t.Record({controller:ze,controllers:t.Vec(t.Principal)}),ft=t.Record({data:t.Vec(t.Nat8),description:t.Opt(t.Text),version:t.Opt(t.Nat64)}),He=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(V),max_size:t.Opt(t.Nat),read:A,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),rate_config:t.Opt(w),write:A,max_changes_per_user:t.Opt(t.Nat32)}),Je=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),Ke=t.Record({chunk_id:t.Nat});return t.Service({build_version:t.Func([],[t.Text],["query"]),commit_asset_upload:t.Func([e],[],[]),count_assets:t.Func([t.Text,i],[t.Nat64],["query"]),count_collection_assets:t.Func([t.Text],[t.Nat64],["query"]),count_collection_docs:t.Func([t.Text],[t.Nat64],["query"]),count_docs:t.Func([t.Text,i],[t.Nat64],["query"]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([c],[t.Vec(t.Tuple(t.Principal,m))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,u],[],[]),del_docs:t.Func([t.Text],[],[]),del_filtered_assets:t.Func([t.Text,i],[],[]),del_filtered_docs:t.Func([t.Text,i],[],[]),del_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),del_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,u))],[],[]),del_rule:t.Func([l,t.Text,d],[],[]),deposit_cycles:t.Func([g],[],[]),get_asset:t.Func([t.Text,t.Text],[t.Opt(f)],["query"]),get_auth_config:t.Func([],[t.Opt(R)],["query"]),get_config:t.Func([],[y],[]),get_db_config:t.Func([],[t.Opt(O)],["query"]),get_doc:t.Func([t.Text,t.Text],[t.Opt(C)],["query"]),get_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(f)))],["query"]),get_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(C)))],["query"]),get_rule:t.Func([l,t.Text],[t.Opt(M)],["query"]),get_storage_config:t.Func([],[P],["query"]),http_request:t.Func([k],[G],["query"]),http_request_streaming_callback:t.Func([F],[j],["query"]),init_asset_upload:t.Func([X],[lt],[]),list_assets:t.Func([t.Text,i],[pt],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,m))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Ue))],["query"]),list_docs:t.Func([t.Text,i],[qe],["query"]),list_rules:t.Func([l],[t.Vec(t.Tuple(t.Text,M))],["query"]),memory_size:t.Func([],[Ee],["query"]),set_auth_config:t.Func([R],[],[]),set_controllers:t.Func([Be],[t.Vec(t.Tuple(t.Principal,m))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_db_config:t.Func([O],[],[]),set_doc:t.Func([t.Text,t.Text,ft],[C],[]),set_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,ft))],[t.Vec(t.Tuple(t.Text,C))],[]),set_rule:t.Func([l,t.Text,He],[M],[]),set_storage_config:t.Func([P],[],[]),upload_asset_chunk:t.Func([Je],[Ke],[]),version:t.Func([],[t.Text],["query"])})};import{Actor as Ge,HttpAgent as je}from"@dfinity/agent";import{nonNullish as ht}from"@dfinity/utils";var St=async({canisterId:t,idlFactory:e,config:r,...o})=>{let s=await N(o);return Ge.createActor(e,{agent:s,canisterId:t,...r??{}})},N=async({agent:t,...e})=>t??await We(e),We=async({identity:t,fetch:e,container:r})=>{let o=ht(r)&&r!==!1,s=o?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await je.create({identity:t,host:s,retryTimes:10,...ht(e)&&{fetch:e},shouldFetchRootKey:o})};var Rt=({satelliteId:t,...e})=>Q({canisterId:t,...e,idlFactory:Ct}),_=({satelliteId:t,...e})=>Q({canisterId:t,...e,idlFactory:Nt}),Ot=({satelliteId:t,...e})=>Q({canisterId:t,...e,idlFactory:Tt}),W=({missionControlId:t,...e})=>Q({canisterId:t,...e,idlFactory:xt}),L=({orbiterId:t,...e})=>Q({canisterId:t,...e,idlFactory:Pt}),Q=({canisterId:t,idlFactory:e,...r})=>{if(Ze(t))throw new Error("No canister ID provided.");return St({canisterId:t,idlFactory:e,...r})};var At=async({missionControl:t})=>(await W(t)).version(),kt=async({missionControl:t})=>(await W(t)).get_user(),Ft=async({missionControl:t})=>(await W(t)).list_mission_control_controllers(),bt=async({missionControl:t,satelliteIds:e,controllerIds:r,controller:o})=>(await W(t)).set_satellites_controllers(e,r,o),Vt=async({missionControl:t,controllerIds:e,controller:r})=>(await W(t)).set_mission_control_controllers(e,r);import{Principal as Xe}from"@dfinity/principal";import{nonNullish as Qe,toNullable as Ye}from"@dfinity/utils";var dt=({controllerId:t,profile:e})=>({controllerIds:[Xe.fromText(t)],controller:$e(e)}),$e=t=>({metadata:Qe(t)&&t!==""?[["profile",t]]:[],expires_at:Ye(void 0),scope:{Admin:null}});var Qr=({controllerId:t,profile:e,...r})=>bt({...r,...dt({controllerId:t,profile:e})}),Yr=({controllerId:t,profile:e,...r})=>Vt({...r,...dt({controllerId:t,profile:e})}),$r=t=>Ft(t);import{Principal as mr}from"@dfinity/principal";var Y={reinstall:null},H={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]};import{fromNullable as ir,isNullish as cr,uint8ArrayToHexString as lr}from"@dfinity/utils";import{CanisterStatus as De}from"@dfinity/agent";import{ICManagementCanister as v}from"@dfinity/ic-management";import{Principal as wt}from"@dfinity/principal";import{assertNonNullish as Ie}from"@dfinity/utils";var Mt=async({canisterId:t,actor:e})=>{let r=await N(e),{stopCanister:o}=v.create({agent:r});await o(t)},vt=async({canisterId:t,actor:e})=>{let r=await N(e),{startCanister:o}=v.create({agent:r});await o(t)},Ut=async({actor:t,code:e})=>{let r=await N(t),{installCode:o}=v.create({agent:r});return o(e)},qt=async({actor:t,canisterId:e})=>{let r=await N(t),{storedChunks:o}=v.create({agent:r});return o({canisterId:e})},tt=async({actor:t,canisterId:e})=>{let r=await N(t),{clearChunkStore:o}=v.create({agent:r});return o({canisterId:e})},Et=async({actor:t,chunk:e})=>{let r=await N(t),{uploadChunk:o}=v.create({agent:r});return o(e)},zt=async({actor:t,code:e})=>{let r=await N(t),{installChunkedCode:o}=v.create({agent:r});return o(e)},Bt=async({actor:t,canisterId:e})=>{let r=await N(t),{canisterStatus:o}=v.create({agent:r});return o(e)},et=async({canisterId:t,path:e,...r})=>{Ie(t,"A canister ID must be provided to request its status.");let o=await N(r),s=globalThis.console.warn;globalThis.console.warn=()=>null;let a=await De.request({canisterId:t instanceof wt?t:wt.fromText(t),agent:o,paths:[{kind:"metadata",key:e,path:e,decodeStrategy:"utf-8"}]});return globalThis.console.warn=s,a.get(e)},Ht=async({actor:t,canisterId:e})=>{let r=await N(t),{listCanisterSnapshots:o}=v.create({agent:r});return o({canisterId:e})},Jt=async({actor:t,...e})=>{let r=await N(t),{takeCanisterSnapshot:o}=v.create({agent:r});return o(e)};var Kt=(a=>(a[a.AssertingExistingCode=0]="AssertingExistingCode",a[a.StoppingCanister=1]="StoppingCanister",a[a.TakingSnapshot=2]="TakingSnapshot",a[a.UpgradingCode=3]="UpgradingCode",a[a.RestartingCanister=4]="RestartingCanister",a))(Kt||{});var Gt=t=>crypto.subtle.digest("SHA-256",t),jt=t=>Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join(""),Wt=async t=>{let e=await Gt(await t.arrayBuffer());return jt(e)},rt=async t=>{let e=await Gt(t);return jt(e)};import{isNullish as tr,nonNullish as Zt,uint8ArrayToHexString as er}from"@dfinity/utils";var Xt=async({actor:t,canisterId:e,missionControlId:r,wasmModule:o,preClearChunks:s,...a})=>{s&&await tt({actor:t,canisterId:e});let n=await rr({wasmModule:o}),{uploadChunks:i,storedChunks:c,preClearChunks:p,postClearChunks:m}=await or({actor:t,wasmChunks:n,canisterId:e,missionControlId:r});p&&await tt({actor:t,canisterId:e});let u=[];for await(let l of ar({uploadChunks:i,actor:t,canisterId:e,missionControlId:r}))u=[...u,...l];await zt({actor:t,code:{...a,chunkHashesList:[...u,...c].sort(({orderId:l},{orderId:d})=>l-d).map(({chunkHash:l})=>l),targetCanisterId:e,storeCanisterId:r,wasmModuleHash:await rt(o)}}),m&&await tt({actor:t,canisterId:e})},rr=async({wasmModule:t})=>{let e=new Blob([t]),r=[],o=1e6,s=0;for(let a=0;a<e.size;a+=o){let n=e.slice(a,a+o);r.push({chunk:n,orderId:s,sha256:await Wt(n)}),s++}return r},or=async({canisterId:t,missionControlId:e,actor:r,wasmChunks:o})=>{let s=await qt({actor:r,canisterId:e??t}),a=s.map(({hash:c})=>({chunkHash:{hash:c},sha256:er(c)})),{storedChunks:n,uploadChunks:i}=o.reduce(({uploadChunks:c,storedChunks:p},{sha256:m,...u})=>{let l=a.find(({sha256:d})=>d===m);return{uploadChunks:[...c,...Zt(l)?[]:[{sha256:m,...u}]],storedChunks:[...p,...Zt(l)?[{...u,...l}]:[]]}},{uploadChunks:[],storedChunks:[]});return{uploadChunks:i,storedChunks:n,preClearChunks:s.length>0&&n.length===0,postClearChunks:tr(e)}};async function*ar({uploadChunks:t,limit:e=12,...r}){for(let o=0;o<t.length;o=o+e){let s=t.slice(o,o+e);yield await Promise.all(s.map(n=>sr({uploadChunk:n,...r})))}}var sr=async({actor:t,canisterId:e,missionControlId:r,uploadChunk:{chunk:o,...s}})=>({chunkHash:await Et({actor:t,chunk:{canisterId:r??e,chunk:new Uint8Array(await o.arrayBuffer())}}),...s});var Qt=async({actor:t,...e})=>{await Ut({actor:t,code:e})};var z=async({wasmModule:t,canisterId:e,actor:r,onProgress:o,takeSnapshot:s=!0,...a})=>{await $({fn:async()=>await pr({wasmModule:t,canisterId:e,actor:r,...a}),onProgress:o,step:0}),await $({fn:async()=>await Mt({canisterId:e,actor:r}),onProgress:o,step:1});try{await $({fn:async()=>s?await ur({canisterId:e,actor:r}):Promise.resolve(),onProgress:o,step:2}),await $({fn:async()=>await dr({wasmModule:t,canisterId:e,actor:r,...a}),onProgress:o,step:3})}finally{await $({fn:async()=>await vt({canisterId:e,actor:r}),onProgress:o,step:4})}},$=async({fn:t,step:e,onProgress:r})=>{r?.({step:e,state:"in_progress"});try{await t(),r?.({step:e,state:"success"})}catch(o){throw r?.({step:e,state:"error"}),o}},pr=async({actor:t,canisterId:e,wasmModule:r,reset:o})=>{if(o===!0)return;let{module_hash:s}=await Bt({actor:t,canisterId:e}),a=ir(s);if(cr(a))return;let n=await rt(r),i=lr(a);if(n===i)throw new I},dr=async({wasmModule:t,canisterId:e,actor:r,...o})=>{await((new Blob([t]).size>2e6?"chunked":"single")==="chunked"?Xt:Qt)({wasmModule:t,canisterId:e,actor:r,...o})},ur=async t=>{let e=await Ht(t);await Jt({...t,snapshotId:e?.[0]?.id})};import{IDL as J}from"@dfinity/candid";var Yt=t=>J.encode([J.Record({user:J.Principal})],[{user:t}]),ot=t=>J.encode([J.Record({controllers:J.Vec(J.Principal)})],[{controllers:t.map(([e,r])=>e)}]);var Vo=async({missionControl:t,...e})=>{let r=await kt({missionControl:t}),{missionControlId:o,...s}=t;if(!o)throw new Error("No mission control principal defined.");let a=Yt(r);await z({actor:s,canisterId:mr.fromText(o),arg:new Uint8Array(a),mode:H,...e})};var vo=t=>At(t);var Eo=async t=>{await z(t)};var $t=async({orbiter:t})=>(await L(t)).version(),at=async({orbiter:t})=>(await L(t)).list_controllers(),Dt=async({orbiter:t})=>{let{memory_size:e}=await L(t);return e()};var Ko=t=>at(t);var Wo=t=>Dt(t);import{Principal as _r}from"@dfinity/principal";var Io=async({orbiter:t,reset:e=!1,...r})=>{let{orbiterId:o,...s}=t;if(!o)throw new Error("No orbiter principal defined.");let a=await at({orbiter:t}),n=ot(a);await z({actor:s,canisterId:_r.fromText(o),arg:new Uint8Array(n),mode:e?Y:H,reset:e,...r})};var ea=t=>$t(t);import{isNullish as yr}from"@dfinity/utils";import{JunoPackageSchema as gr}from"@junobuild/config";import*as Z from"zod";var It=async({moduleId:t,...e})=>{let r=await et({...e,canisterId:t,path:"juno:package"});if(yr(r))return;if(typeof r!="string")throw new Error("Unexpected metadata type to parse public custom section juno:package");return(s=>Z.string().transform((a,n)=>{try{return JSON.parse(a)}catch{return n.addIssue({code:Z.ZodIssueCode.custom,message:"Invalid JSON"}),Z.never}}).pipe(gr).parse(s))(r)},na=async t=>(await It(t))?.version,ia=async t=>(await It(t))?.dependencies;import{major as Lt,minor as te,patch as ee}from"semver";var pa=({currentVersion:t,selectedVersion:e})=>{let r=Lt(t),o=Lt(e),s=te(t),a=te(e),n=ee(t),i=ee(e);return r<o-1||s<a-1||n<i-1?{canUpgrade:!1}:{canUpgrade:!0}};import{toNullable as fr}from"@dfinity/utils";var re=async({config:t,satellite:e})=>{let{set_storage_config:r}=await _(e);return r(t)},oe=async({config:t,satellite:e})=>{let{set_db_config:r}=await _(e);return r(t)},ae=async({config:t,satellite:e})=>{let{set_auth_config:r}=await _(e);return r(t)};var se=async({satellite:t})=>{let{get_auth_config:e}=await _(t);return e()},ne=async({satellite:t,type:e})=>(await _(t)).list_rules(e),ie=async({type:t,collection:e,rule:r,satellite:o})=>{let{set_rule:s}=await _(o);return s(t,e,r)},ce=async({satellite:t})=>{let{version:e}=await _(t);return e()},le=async({satellite:t})=>{let{build_version:e}=await _(t);return e()},pe=async({satellite:t})=>(await Rt(t)).list_controllers(),st=async({satellite:t})=>(await Ot(t)).list_controllers(),nt=async({satellite:t})=>(await _(t)).list_controllers(),de=async({satellite:t})=>{let{list_custom_domains:e}=await _(t);return e()},ut=async({satellite:t,domainName:e,boundaryNodesId:r})=>{let{set_custom_domain:o}=await _(t);await o(e,fr(r))},ue=async({satellite:t})=>{let{memory_size:e}=await _(t);return e()},me=async({collection:t,satellite:e})=>{let{count_collection_docs:r}=await _(e);return r(t)},_e=async({collection:t,satellite:e})=>{let{count_collection_assets:r}=await _(e);return r(t)},ye=async({collection:t,satellite:e})=>{let{del_docs:r}=await _(e);return r(t)},ge=async({collection:t,satellite:e})=>{let{del_assets:r}=await _(e);return r(t)},fe=async({args:t,satellite:e})=>{let{set_controllers:r}=await _(e);return r(t)};var ga=t=>_e(t),fa=t=>ge(t);import{fromNullable as it,isNullish as Te,nonNullish as xe,toNullable as Pe}from"@dfinity/utils";import{nonNullish as xr,toNullable as mt}from"@dfinity/utils";var _t=t=>mt(xr(t)?{heap:mt(t.heap),stable:mt(t.stable)}:void 0);var Sa=async({config:{headers:t,rewrites:e,redirects:r,iframe:o,rawAccess:s,maxMemorySize:a},satellite:n})=>{let i=(t??[]).map(({source:l,headers:d})=>[l,d]),c=(e??[]).map(({source:l,destination:d})=>[l,d]),p=(r??[]).map(({source:l,location:d,code:g})=>[l,{status_code:g,location:d}]);return await re({satellite:n,config:{headers:i,rewrites:c,redirects:[p],iframe:[o==="same-origin"?{SameOrigin:null}:o==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[s===!0?{Allow:null}:{Deny:null}],max_memory_size:_t(a)}})},Ra=async({config:{maxMemorySize:t},...e})=>{await oe({config:{max_memory_size:_t(t)},...e})},Oa=async({config:{internetIdentity:t},...e})=>{await ae({config:{internet_identity:Te(t)?[]:[{derivation_origin:Pe(t?.derivationOrigin),external_alternative_origins:Pe(t?.externalAlternativeOrigins)}]},...e})},Aa=async({satellite:t})=>{let e=it(await se({satellite:t}));if(Te(e))return;let r=it(e.internet_identity??[]);return{...xe(r)&&{internetIdentity:{...xe(it(r.derivation_origin))&&{derivationOrigin:it(r.derivation_origin)}}}}};var ba=({deprecatedNoScope:t,...e})=>(t===!0?st:nt)(e),Va=t=>fe(t);var va=t=>me(t),Ua=t=>ye(t);import{fromNullable as Ce,nonNullish as Pr}from"@dfinity/utils";var Ba=async({satellite:t})=>(await de({satellite:t})).map(([r,o])=>{let s=Ce(o.version);return{domain:r,bn_id:Ce(o.bn_id),created_at:o.created_at,updated_at:o.updated_at,...Pr(s)&&{version:s}}}),Ha=({satellite:t,domains:e})=>Promise.all(e.map(({domain:r,bn_id:o})=>ut({satellite:t,domainName:r,boundaryNodesId:o}))),Ja=({satellite:t,domain:e})=>ut({satellite:t,domainName:e.domain,boundaryNodesId:e.bn_id});var ja=t=>ue(t);import{fromNullable as K,nonNullish as U,toNullable as D}from"@dfinity/utils";var Ne={Db:null},he={Storage:null},Se={Public:null},Re={Private:null},Oe={Managed:null},Ae={Controllers:null},yt={Heap:null},ke={Stable:null},Fe=600000000n;var gt=t=>t==="storage"?he:Ne,we=({read:t,write:e,memory:r,maxSize:o,maxChangesPerUser:s,maxCapacity:a,version:n,mutablePermissions:i,maxTokens:c})=>({read:Ve(t),write:Ve(e),memory:U(r)?[Tr(r)]:[],version:D(n),max_size:D(U(o)&&o>0?BigInt(o):void 0),max_capacity:D(U(a)&&a>0?a:void 0),max_changes_per_user:D(U(s)&&s>0?s:void 0),mutable_permissions:D(i),rate_config:U(c)?[{max_tokens:BigInt(c),time_per_token_ns:Fe}]:[]}),Me=([t,e])=>{let{read:r,write:o,updated_at:s,created_at:a,max_size:n,max_changes_per_user:i,max_capacity:c,memory:p,mutable_permissions:m,version:u,rate_config:l}=e,d=n?.[0]??0n>0n?Number(K(n)):void 0,g=i?.[0]??!1?K(i):void 0,h=c?.[0]??!1?K(c):void 0,T=K(u),f=l?.[0]?.max_tokens??0n>0n?K(l)?.max_tokens:void 0;return{collection:t,read:be(r),write:be(o),memory:Cr(K(p)??yt),updatedAt:s,createdAt:a,...U(T)&&{version:T},...U(g)&&{maxChangesPerUser:g},...U(d)&&{maxSize:d},...U(h)&&{maxCapacity:h},mutablePermissions:K(m)??!0,...U(f)&&{maxTokens:Number(f)}}},be=t=>"Public"in t?"public":"Private"in t?"private":"Managed"in t?"managed":"controllers",Ve=t=>{switch(t){case"public":return Se;case"private":return Re;case"managed":return Oe;default:return Ae}},Tr=t=>{switch(t.toLowerCase()){case"heap":return yt;default:return ke}},Cr=t=>"Heap"in t?"heap":"stable";var Ia=async({type:t,satellite:e})=>(await ne({satellite:e,type:gt(t)})).map(o=>Me(o)),La=async({rule:{collection:t,...e},type:r,satellite:o})=>{await ie({type:gt(r),rule:we(e),satellite:o,collection:t})};import{IDL as ct}from"@dfinity/candid";import{Principal as ve}from"@dfinity/principal";import{isNullish as Nr}from"@dfinity/utils";var cs=async({satellite:t,deprecated:e,deprecatedNoScope:r,reset:o=!1,...s})=>{let{satelliteId:a,...n}=t;if(Nr(a))throw new Error("No satellite principal defined.");if(e){let m=await pe({satellite:t}),u=ct.encode([ct.Record({controllers:ct.Vec(ct.Principal)})],[{controllers:m}]);await z({actor:n,canisterId:ve.fromText(a),arg:new Uint8Array(u),mode:o?Y:H,reset:o,...s});return}let c=await(r?st:nt)({satellite:t}),p=ot(c);await z({actor:n,canisterId:ve.fromText(a),arg:new Uint8Array(p),mode:o?Y:H,reset:o,...s})};import{nonNullish as hr}from"@dfinity/utils";var ms=t=>ce(t),_s=t=>le(t),ys=async({satellite:{satelliteId:t,...e}})=>{let r=await et({...e,canisterId:t,path:"juno:build"});return hr(r)&&["stock","extended"].includes(r)?r:void 0};var fs=({dependencyId:t,dependencies:e})=>Object.entries(e??{}).find(([r,o])=>r===t);export{Kt as UpgradeCodeProgressStep,I as UpgradeCodeUnchangedError,Wt as blobSha256,pa as checkUpgradeVersion,ga as countAssets,va as countDocs,fa as deleteAssets,Ua as deleteDocs,fs as findJunoPackageDependency,Aa as getAuthConfig,It as getJunoPackage,ia as getJunoPackageDependencies,na as getJunoPackageVersion,Ba as listCustomDomains,$r as listMissionControlControllers,Ko as listOrbiterControllers,Ia as listRules,ba as listSatelliteControllers,vo as missionControlVersion,Wo as orbiterMemorySize,ea as orbiterVersion,ys as satelliteBuildType,_s as satelliteBuildVersion,ja as satelliteMemorySize,ms as satelliteVersion,Oa as setAuthConfig,Ja as setCustomDomain,Ha as setCustomDomains,Ra as setDatastoreConfig,Yr as setMissionControlController,La as setRule,Va as setSatelliteControllers,Qr as setSatellitesController,Sa as setStorageConfig,rt as uint8ArraySha256,Vo as upgradeMissionControl,Eo as upgradeModule,Io as upgradeOrbiter,cs as upgradeSatellite};
3
+ var oe=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}};import{JUNO_PACKAGE_MISSION_CONTROL_ID as rr,JUNO_PACKAGE_ORBITER_ID as or,JUNO_PACKAGE_SATELLITE_ID as ar}from"@junobuild/config";var I=class extends Error{constructor(){super(`Invalid dependency tree: required module ${ar} is missing.`)}},ae=class extends Error{constructor(){super(`Invalid package: the provided module name is not ${rr}.`)}},ne=class extends Error{constructor(){super(`Invalid package: the provided module name is not ${or}.`)}};import{isNullish as cr}from"@dfinity/utils";var ve=({IDL:e})=>{let t=e.Record({fund_cycles:e.Nat,min_cycles:e.Nat}),r=e.Variant({BelowThreshold:t}),o=e.Record({strategy:e.Opt(r),enabled:e.Bool}),a=e.Record({cycles:e.Opt(o)}),n=e.Record({monitoring:e.Opt(a)}),s=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,settings:e.Opt(n)}),i=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),c=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal,settings:e.Opt(n)}),p=e.Record({cycles:e.Nat,destination_id:e.Principal}),u=e.Record({to:e.Opt(e.Text),enabled:e.Bool}),m=e.Record({notification:e.Opt(u),default_strategy:e.Opt(r)}),l=e.Record({cycles:e.Opt(m)}),d=e.Record({monitoring:e.Opt(l)}),R=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),segment_id:e.Principal}),k=e.Record({segment_id:e.Principal,created_at:e.Nat64,nonce:e.Int32}),h=e.Record({timestamp:e.Nat64,amount:e.Nat}),x=e.Record({deposited_cycles:e.Opt(h),cycles:h}),S=e.Record({cycles:e.Opt(x)}),f=e.Record({monitored_ids:e.Vec(e.Principal),running:e.Bool}),F=e.Record({cycles:e.Opt(f)}),P=e.Record({updated_at:e.Nat64,created_at:e.Nat64,monitoring:e.Opt(a)}),v=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),user:e.Opt(e.Principal),created_at:e.Nat64,config:e.Opt(d)}),_=e.Record({e8s:e.Nat64}),M=e.Record({timestamp_nanos:e.Nat64}),g=e.Record({to:e.Vec(e.Nat8),fee:_,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(M),amount:_}),y=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:_}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:_})}),T=e.Variant({Ok:e.Nat64,Err:y}),V=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),N=e.Record({to:V,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),A=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),b=e.Variant({Ok:e.Nat,Err:A}),C=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:C,expires_at:e.Opt(e.Nat64)}),q=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:C,expires_at:e.Opt(e.Nat64)}),E=e.Record({ids:e.Vec(e.Principal),strategy:r}),U=e.Record({orbiters_strategy:e.Opt(E),mission_control_strategy:e.Opt(r),satellites_strategy:e.Opt(E)}),z=e.Record({cycles_config:e.Opt(U)}),j=e.Record({satellite_ids:e.Opt(e.Vec(e.Principal)),try_mission_control:e.Opt(e.Bool),orbiter_ids:e.Opt(e.Vec(e.Principal))}),Z=e.Record({cycles_config:e.Opt(j)});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)],[s],[]),create_orbiter_with_config:e.Func([i],[s],[]),create_satellite:e.Func([e.Text],[c],[]),create_satellite_with_config:e.Func([i],[c],[]),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([p],[],[]),get_config:e.Func([],[e.Opt(d)],["query"]),get_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_monitoring_history:e.Func([R],[e.Vec(e.Tuple(k,S))],["query"]),get_monitoring_status:e.Func([],[F],["query"]),get_settings:e.Func([],[e.Opt(P)],["query"]),get_user:e.Func([],[e.Principal],["query"]),get_user_data:e.Func([],[v],["query"]),icp_transfer:e.Func([g],[T],[]),icrc_transfer:e.Func([e.Principal,N],[b],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,O))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,s))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,c))],["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_config:e.Func([e.Opt(d)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),q],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[s],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[s],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),q],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[c],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[c],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),q],[],[]),start_monitoring:e.Func([],[],[]),stop_monitoring:e.Func([],[],[]),top_up:e.Func([e.Principal,_],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),update_and_start_monitoring:e.Func([z],[],[]),update_and_stop_monitoring:e.Func([Z],[],[])})};var Me=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=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:r,expires_at:e.Opt(e.Nat64)}),a=e.Record({version:e.Opt(e.Nat64)}),n=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)}),i=e.Record({key:e.Text,collected_at:e.Nat64}),c=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),p=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:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),u=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),m=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),l=e.Record({browsers:u,devices:m}),d=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),R=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(d,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),k=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),h=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),x=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(h),delta:e.Float64}),S=e.Variant({WebVitalsMetric:x}),f=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),F=e.Record({updated_at:e.Nat64,session_id:e.Text,data:S,href:e.Text,metric_name:f,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),P=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),v=e.Record({overall:P,pages:e.Vec(e.Tuple(e.Text,P))}),_=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)}),M=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),g=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),y=e.Record({updated_at:e.Nat64,features:e.Opt(g),created_at:e.Nat64,version:e.Opt(e.Nat64)}),T=e.Record({stable:e.Nat64,heap:e.Nat64}),V=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),N=e.Record({controller:V,controllers:e.Vec(e.Principal)}),A=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:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),b=e.Variant({Ok:p,Err:e.Text}),C=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(i,e.Text))}),O=e.Record({session_id:e.Text,data:S,href:e.Text,metric_name:f,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),q=e.Variant({Ok:F,Err:e.Text}),E=e.Record({features:e.Opt(g),version:e.Opt(e.Nat64)}),U=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)}),z=e.Variant({Ok:_,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,o))],[]),del_satellite_config:e.Func([e.Principal,a],[],[]),deposit_cycles:e.Func([n],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(i,p))],["query"]),get_page_views_analytics_clients:e.Func([s],[l],["query"]),get_page_views_analytics_metrics:e.Func([s],[R],["query"]),get_page_views_analytics_top_10:e.Func([s],[k],["query"]),get_performance_metrics:e.Func([s],[e.Vec(e.Tuple(i,F))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([s],[v],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(i,_))],["query"]),get_track_events_analytics:e.Func([s],[M],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,y))],["query"]),memory_size:e.Func([],[T],["query"]),set_controllers:e.Func([N],[e.Vec(e.Tuple(e.Principal,o))],[]),set_page_view:e.Func([i,A],[b],[]),set_page_views:e.Func([e.Vec(e.Tuple(i,A))],[C],[]),set_performance_metric:e.Func([i,O],[q],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(i,O))],[C],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,E))],[e.Vec(e.Tuple(e.Principal,y))],[]),set_track_event:e.Func([i,U],[z],[]),set_track_events:e.Func([e.Vec(e.Tuple(i,U))],[C],[])})};var qe=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),o=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)}),a=e.Record({updated_at:e.Opt(e.Nat64)}),n=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:n}),i=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),c=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),p=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}),u=e.Variant({Callback:e.Record({token:p,callback:e.Func([],[],[])})}),m=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(u),status_code:e.Nat16}),l=e.Record({token:e.Opt(p),body:e.Vec(e.Nat8)}),d=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),R=e.Record({batch_id:e.Nat}),k=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),h=e.Record({field:k,desc:e.Bool}),x=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),S=e.Record({order:e.Opt(h),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(x)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),F=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:f,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,F)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),v=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),_=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),M=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,i))}),g=e.Variant({Db:e.Null,Storage:e.Null}),y=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),T=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:y,created_at:e.Nat64,write:y}),V=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),N=e.Record({controller:V,controllers:e.Vec(e.Principal)}),A=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),b=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:y,write:y}),C=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),O=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,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,a],[],[]),get_config:e.Func([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(i)],["query"]),http_request:e.Func([c],[m],["query"]),http_request_streaming_callback:e.Func([p],[l],["query"]),init_asset_upload:e.Func([d],[R],[]),list_assets:e.Func([e.Opt(e.Text),S],[v],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,_))],["query"]),list_docs:e.Func([e.Text,S],[M],["query"]),list_rules:e.Func([g],[e.Vec(e.Tuple(e.Text,T))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([N],[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,A],[i],[]),set_rule:e.Func([g,e.Text,b],[],[]),upload_asset_chunk:e.Func([C],[O],[]),version:e.Func([],[e.Text],["query"])})};var Ee=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),o=e.Record({field:r,desc:e.Bool}),a=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),n=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(a),description:e.Opt(e.Text),created_at:e.Opt(a)}),s=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),i=e.Record({order:e.Opt(o),owner:e.Opt(e.Principal),matcher:e.Opt(n),paginate:e.Opt(s)}),c=e.Record({controllers:e.Vec(e.Principal)}),p=e.Variant({Write:e.Null,Admin:e.Null}),u=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:p,expires_at:e.Opt(e.Nat64)}),m=e.Record({version:e.Opt(e.Nat64)}),l=e.Variant({Db:e.Null,Storage:e.Null}),d=e.Record({version:e.Opt(e.Nat64)}),R=e.Record({cycles:e.Nat,destination_id:e.Principal}),k=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}),h=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),x=e.Record({key:k,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,h)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),S=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),f=e.Record({internet_identity:e.Opt(S)}),F=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),P=e.Record({max_memory_size:e.Opt(F)}),v=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),_=e.Variant({Deny:e.Null,Allow:e.Null}),M=e.Record({status_code:e.Nat16,location:e.Text}),g=e.Record({iframe:e.Opt(v),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(F),raw_access:e.Opt(_),redirects:e.Opt(e.Vec(e.Tuple(e.Text,M)))}),y=e.Record({db:e.Opt(P),authentication:e.Opt(f),storage:g}),T=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)}),V=e.Variant({Heap:e.Null,Stable:e.Null}),N=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),A=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),b=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(V),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:N,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(A),write:N,max_changes_per_user:e.Opt(e.Nat32)}),C=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)}),O=e.Record({memory:V,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}),q=e.Variant({Callback:e.Record({token:O,callback:e.Func([],[],["query"])})}),E=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(q),status_code:e.Nat16}),U=e.Record({token:e.Opt(O),body:e.Vec(e.Nat8)}),z=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}),j=e.Record({batch_id:e.Nat}),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,x)),items_length:e.Nat64}),ye=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),Te=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,T)),items_length:e.Nat64}),xe=e.Record({stable:e.Nat64,heap:e.Nat64}),fe=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:p,expires_at:e.Opt(e.Nat64)}),Pe=e.Record({controller:fe,controllers:e.Vec(e.Principal)}),D=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Ne=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(V),max_size:e.Opt(e.Nat),read:N,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(A),write:N,max_changes_per_user:e.Opt(e.Nat32)}),Ce=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Oe=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,i],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,i],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([c],[e.Vec(e.Tuple(e.Principal,u))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,m],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,i],[],[]),del_filtered_docs:e.Func([e.Text,i],[],[]),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,m))],[],[]),del_rule:e.Func([l,e.Text,d],[],[]),deposit_cycles:e.Func([R],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(x)],["query"]),get_auth_config:e.Func([],[e.Opt(f)],["query"]),get_config:e.Func([],[y],[]),get_db_config:e.Func([],[e.Opt(P)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(T)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(x)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(T)))],["query"]),get_rule:e.Func([l,e.Text],[e.Opt(b)],["query"]),get_storage_config:e.Func([],[g],["query"]),http_request:e.Func([C],[E],["query"]),http_request_streaming_callback:e.Func([O],[U],["query"]),init_asset_upload:e.Func([z],[j],[]),list_assets:e.Func([e.Text,i],[Z],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,u))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,ye))],["query"]),list_docs:e.Func([e.Text,i],[Te],["query"]),list_rules:e.Func([l],[e.Vec(e.Tuple(e.Text,b))],["query"]),memory_size:e.Func([],[xe],["query"]),set_auth_config:e.Func([f],[],[]),set_controllers:e.Func([Pe],[e.Vec(e.Tuple(e.Principal,u))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([P],[],[]),set_doc:e.Func([e.Text,e.Text,D],[T],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,D))],[e.Vec(e.Tuple(e.Text,T))],[]),set_rule:e.Func([l,e.Text,Ne],[b],[]),set_storage_config:e.Func([g],[],[]),upload_asset_chunk:e.Func([Ce],[Oe],[]),version:e.Func([],[e.Text],["query"])})};var Ue=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=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:r,expires_at:e.Opt(e.Nat64)}),a=e.Record({version:e.Opt(e.Nat64)}),n=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)}),i=e.Record({key:e.Text,collected_at:e.Nat64}),c=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),p=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:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),u=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),m=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),l=e.Record({browsers:u,devices:m}),d=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),R=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(d,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),k=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),h=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),x=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(h),delta:e.Float64}),S=e.Variant({WebVitalsMetric:x}),f=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),F=e.Record({updated_at:e.Nat64,session_id:e.Text,data:S,href:e.Text,metric_name:f,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),P=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),v=e.Record({overall:P,pages:e.Vec(e.Tuple(e.Text,P))}),_=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)}),M=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),g=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),y=e.Record({updated_at:e.Nat64,features:e.Opt(g),created_at:e.Nat64,version:e.Opt(e.Nat64)}),T=e.Record({stable:e.Nat64,heap:e.Nat64}),V=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),N=e.Record({controller:V,controllers:e.Vec(e.Principal)}),A=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:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),b=e.Variant({Ok:p,Err:e.Text}),C=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(i,e.Text))}),O=e.Record({session_id:e.Text,data:S,href:e.Text,metric_name:f,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),q=e.Variant({Ok:F,Err:e.Text}),E=e.Record({features:e.Opt(g),version:e.Opt(e.Nat64)}),U=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)}),z=e.Variant({Ok:_,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,o))],[]),del_satellite_config:e.Func([e.Principal,a],[],[]),deposit_cycles:e.Func([n],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(i,p))],["query"]),get_page_views_analytics_clients:e.Func([s],[l],["query"]),get_page_views_analytics_metrics:e.Func([s],[R],["query"]),get_page_views_analytics_top_10:e.Func([s],[k],["query"]),get_performance_metrics:e.Func([s],[e.Vec(e.Tuple(i,F))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([s],[v],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(i,_))],["query"]),get_track_events_analytics:e.Func([s],[M],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,y))],["query"]),memory_size:e.Func([],[T],["query"]),set_controllers:e.Func([N],[e.Vec(e.Tuple(e.Principal,o))],[]),set_page_view:e.Func([i,A],[b],[]),set_page_views:e.Func([e.Vec(e.Tuple(i,A))],[C],[]),set_performance_metric:e.Func([i,O],[q],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(i,O))],[C],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,E))],[e.Vec(e.Tuple(e.Principal,y))],[]),set_track_event:e.Func([i,U],[z],[]),set_track_events:e.Func([e.Vec(e.Tuple(i,U))],[C],[]),version:e.Func([],[e.Text],["query"])})};var Be=({IDL:e})=>{let t=e.Record({fund_cycles:e.Nat,min_cycles:e.Nat}),r=e.Variant({BelowThreshold:t}),o=e.Record({strategy:e.Opt(r),enabled:e.Bool}),a=e.Record({cycles:e.Opt(o)}),n=e.Record({monitoring:e.Opt(a)}),s=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,settings:e.Opt(n)}),i=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),c=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal,settings:e.Opt(n)}),p=e.Record({cycles:e.Nat,destination_id:e.Principal}),u=e.Record({to:e.Opt(e.Text),enabled:e.Bool}),m=e.Record({notification:e.Opt(u),default_strategy:e.Opt(r)}),l=e.Record({cycles:e.Opt(m)}),d=e.Record({monitoring:e.Opt(l)}),R=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),segment_id:e.Principal}),k=e.Record({segment_id:e.Principal,created_at:e.Nat64,nonce:e.Int32}),h=e.Record({timestamp:e.Nat64,amount:e.Nat}),x=e.Record({deposited_cycles:e.Opt(h),cycles:h}),S=e.Record({cycles:e.Opt(x)}),f=e.Record({monitored_ids:e.Vec(e.Principal),running:e.Bool}),F=e.Record({cycles:e.Opt(f)}),P=e.Record({updated_at:e.Nat64,created_at:e.Nat64,monitoring:e.Opt(a)}),v=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),user:e.Opt(e.Principal),created_at:e.Nat64,config:e.Opt(d)}),_=e.Record({e8s:e.Nat64}),M=e.Record({timestamp_nanos:e.Nat64}),g=e.Record({to:e.Vec(e.Nat8),fee:_,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(M),amount:_}),y=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:_}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:_})}),T=e.Variant({Ok:e.Nat64,Err:y}),V=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),N=e.Record({to:V,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),A=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),b=e.Variant({Ok:e.Nat,Err:A}),C=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:C,expires_at:e.Opt(e.Nat64)}),q=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:C,expires_at:e.Opt(e.Nat64)}),E=e.Record({ids:e.Vec(e.Principal),strategy:r}),U=e.Record({orbiters_strategy:e.Opt(E),mission_control_strategy:e.Opt(r),satellites_strategy:e.Opt(E)}),z=e.Record({cycles_config:e.Opt(U)}),j=e.Record({satellite_ids:e.Opt(e.Vec(e.Principal)),try_mission_control:e.Opt(e.Bool),orbiter_ids:e.Opt(e.Vec(e.Principal))}),Z=e.Record({cycles_config:e.Opt(j)});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)],[s],[]),create_orbiter_with_config:e.Func([i],[s],[]),create_satellite:e.Func([e.Text],[c],[]),create_satellite_with_config:e.Func([i],[c],[]),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([p],[],[]),get_config:e.Func([],[e.Opt(d)],["query"]),get_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_monitoring_history:e.Func([R],[e.Vec(e.Tuple(k,S))],["query"]),get_monitoring_status:e.Func([],[F],["query"]),get_settings:e.Func([],[e.Opt(P)],["query"]),get_user:e.Func([],[e.Principal],["query"]),get_user_data:e.Func([],[v],["query"]),icp_transfer:e.Func([g],[T],[]),icrc_transfer:e.Func([e.Principal,N],[b],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,O))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,s))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,c))],["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_config:e.Func([e.Opt(d)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),q],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[s],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[s],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),q],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[c],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[c],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),q],[],[]),start_monitoring:e.Func([],[],[]),stop_monitoring:e.Func([],[],[]),top_up:e.Func([e.Principal,_],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),update_and_start_monitoring:e.Func([z],[],[]),update_and_stop_monitoring:e.Func([Z],[],[]),version:e.Func([],[e.Text],["query"])})};var ze=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),o=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)}),a=e.Record({updated_at:e.Opt(e.Nat64)}),n=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),s=e.Record({storage:n}),i=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),c=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),p=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}),u=e.Variant({Callback:e.Record({token:p,callback:e.Func([],[],[])})}),m=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(u),status_code:e.Nat16}),l=e.Record({token:e.Opt(p),body:e.Vec(e.Nat8)}),d=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),R=e.Record({batch_id:e.Nat}),k=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),h=e.Record({field:k,desc:e.Bool}),x=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),S=e.Record({order:e.Opt(h),matcher:e.Opt(e.Text),paginate:e.Opt(x)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),F=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:f,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,F)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),v=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),_=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),M=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,i))}),g=e.Variant({Db:e.Null,Storage:e.Null}),y=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),T=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:y,created_at:e.Nat64,write:y}),V=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),N=e.Record({controller:V,controllers:e.Vec(e.Principal)}),A=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),b=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:y,write:y}),C=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),O=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,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,a],[],[]),get_config:e.Func([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(i)],["query"]),http_request:e.Func([c],[m],["query"]),http_request_streaming_callback:e.Func([p],[l],["query"]),init_asset_upload:e.Func([d],[R],[]),list_assets:e.Func([e.Opt(e.Text),S],[v],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,_))],["query"]),list_docs:e.Func([e.Text,S],[M],["query"]),list_rules:e.Func([g],[e.Vec(e.Tuple(e.Text,T))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([N],[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,A],[i],[]),set_rule:e.Func([g,e.Text,b],[],[]),upload_asset_chunk:e.Func([C],[O],[]),version:e.Func([],[e.Text],["query"])})};var He=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),o=e.Record({field:r,desc:e.Bool}),a=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),n=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(a),description:e.Opt(e.Text),created_at:e.Opt(a)}),s=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),i=e.Record({order:e.Opt(o),owner:e.Opt(e.Principal),matcher:e.Opt(n),paginate:e.Opt(s)}),c=e.Record({controllers:e.Vec(e.Principal)}),p=e.Variant({Write:e.Null,Admin:e.Null}),u=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:p,expires_at:e.Opt(e.Nat64)}),m=e.Record({version:e.Opt(e.Nat64)}),l=e.Variant({Db:e.Null,Storage:e.Null}),d=e.Record({version:e.Opt(e.Nat64)}),R=e.Record({cycles:e.Nat,destination_id:e.Principal}),k=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}),h=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),x=e.Record({key:k,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,h)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),S=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),f=e.Record({internet_identity:e.Opt(S)}),F=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),P=e.Record({max_memory_size:e.Opt(F)}),v=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),_=e.Variant({Deny:e.Null,Allow:e.Null}),M=e.Record({status_code:e.Nat16,location:e.Text}),g=e.Record({iframe:e.Opt(v),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(F),raw_access:e.Opt(_),redirects:e.Opt(e.Vec(e.Tuple(e.Text,M)))}),y=e.Record({db:e.Opt(P),authentication:e.Opt(f),storage:g}),T=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)}),V=e.Variant({Heap:e.Null,Stable:e.Null}),N=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),A=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),b=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(V),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:N,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(A),write:N,max_changes_per_user:e.Opt(e.Nat32)}),C=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)}),O=e.Record({memory:V,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}),q=e.Variant({Callback:e.Record({token:O,callback:e.Func([],[],["query"])})}),E=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(q),status_code:e.Nat16}),U=e.Record({token:e.Opt(O),body:e.Vec(e.Nat8)}),z=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}),j=e.Record({batch_id:e.Nat}),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,x)),items_length:e.Nat64}),ye=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),Te=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,T)),items_length:e.Nat64}),xe=e.Record({stable:e.Nat64,heap:e.Nat64}),fe=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:p,expires_at:e.Opt(e.Nat64)}),Pe=e.Record({controller:fe,controllers:e.Vec(e.Principal)}),D=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Ne=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(V),max_size:e.Opt(e.Nat),read:N,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(A),write:N,max_changes_per_user:e.Opt(e.Nat32)}),Ce=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Oe=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,i],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,i],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([c],[e.Vec(e.Tuple(e.Principal,u))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,m],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,i],[],[]),del_filtered_docs:e.Func([e.Text,i],[],[]),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,m))],[],[]),del_rule:e.Func([l,e.Text,d],[],[]),deposit_cycles:e.Func([R],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(x)],["query"]),get_auth_config:e.Func([],[e.Opt(f)],["query"]),get_config:e.Func([],[y],[]),get_db_config:e.Func([],[e.Opt(P)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(T)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(x)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(T)))],["query"]),get_rule:e.Func([l,e.Text],[e.Opt(b)],["query"]),get_storage_config:e.Func([],[g],["query"]),http_request:e.Func([C],[E],["query"]),http_request_streaming_callback:e.Func([O],[U],["query"]),init_asset_upload:e.Func([z],[j],[]),list_assets:e.Func([e.Text,i],[Z],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,u))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,ye))],["query"]),list_docs:e.Func([e.Text,i],[Te],["query"]),list_rules:e.Func([l],[e.Vec(e.Tuple(e.Text,b))],["query"]),memory_size:e.Func([],[xe],["query"]),set_auth_config:e.Func([f],[],[]),set_controllers:e.Func([Pe],[e.Vec(e.Tuple(e.Principal,u))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([P],[],[]),set_doc:e.Func([e.Text,e.Text,D],[T],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,D))],[e.Vec(e.Tuple(e.Text,T))],[]),set_rule:e.Func([l,e.Text,Ne],[b],[]),set_storage_config:e.Func([g],[],[]),upload_asset_chunk:e.Func([Ce],[Oe],[])})};import{Actor as nr,HttpAgent as sr}from"@dfinity/agent";import{nonNullish as Je}from"@dfinity/utils";var Ke=async({canisterId:e,idlFactory:t,config:r,...o})=>{let a=await B(o);return nr.createActor(t,{agent:a,canisterId:e,...r??{}})},B=async({agent:e,...t})=>e??await ir(t),ir=async({identity:e,fetch:t,container:r})=>{let o=Je(r)&&r!==!1,a=o?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await sr.create({identity:e,host:a,retryTimes:10,...Je(t)&&{fetch:t},shouldFetchRootKey:o})};var Ge=({satelliteId:e,...t})=>W({canisterId:e,...t,idlFactory:ze}),w=({satelliteId:e,...t})=>W({canisterId:e,...t,idlFactory:He}),We=({satelliteId:e,...t})=>W({canisterId:e,...t,idlFactory:qe}),je=({satelliteId:e,...t})=>W({canisterId:e,...t,idlFactory:Ee}),L=({missionControlId:e,...t})=>W({canisterId:e,...t,idlFactory:ve}),Ze=({missionControlId:e,...t})=>W({canisterId:e,...t,idlFactory:Be}),Re=({orbiterId:e,...t})=>W({canisterId:e,...t,idlFactory:Me}),Xe=({orbiterId:e,...t})=>W({canisterId:e,...t,idlFactory:Ue}),W=({canisterId:e,idlFactory:t,...r})=>{if(cr(e))throw new Error("No canister ID provided.");return Ke({canisterId:e,idlFactory:t,...r})};var $e=async({missionControl:e})=>{let{version:t}=await Ze(e);return t()},Qe=async({missionControl:e})=>(await L(e)).get_user(),Ye=async({missionControl:e})=>(await L(e)).list_mission_control_controllers(),De=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:o})=>(await L(e)).set_satellites_controllers(t,r,o),Ie=async({missionControl:e,controllerIds:t,controller:r})=>(await L(e)).set_mission_control_controllers(t,r);import{Principal as lr}from"@dfinity/principal";import{nonNullish as pr,toNullable as dr}from"@dfinity/utils";var he=({controllerId:e,profile:t})=>({controllerIds:[lr.fromText(e)],controller:ur(t)}),ur=e=>({metadata:pr(e)&&e!==""?[["profile",e]]:[],expires_at:dr(void 0),scope:{Admin:null}});var Ro=({controllerId:e,profile:t,...r})=>De({...r,...he({controllerId:e,profile:t})}),ho=({controllerId:e,profile:t,...r})=>Ie({...r,...he({controllerId:e,profile:t})}),So=e=>Ye(e);import{Principal as Vr}from"@dfinity/principal";var ee={reinstall:null},X={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]};import{fromNullable as Cr,isNullish as Or,uint8ArrayToHexString as Rr}from"@dfinity/utils";import{CanisterStatus as mr}from"@dfinity/agent";import{ICManagementCanister as H}from"@dfinity/ic-management";import{Principal as Le}from"@dfinity/principal";var et=async({canisterId:e,actor:t})=>{let r=await B(t),{stopCanister:o}=H.create({agent:r});await o(e)},tt=async({canisterId:e,actor:t})=>{let r=await B(t),{startCanister:o}=H.create({agent:r});await o(e)},rt=async({actor:e,code:t})=>{let r=await B(e),{installCode:o}=H.create({agent:r});return o(t)},ot=async({actor:e,canisterId:t})=>{let r=await B(e),{storedChunks:o}=H.create({agent:r});return o({canisterId:t})},se=async({actor:e,canisterId:t})=>{let r=await B(e),{clearChunkStore:o}=H.create({agent:r});return o({canisterId:t})},at=async({actor:e,chunk:t})=>{let r=await B(e),{uploadChunk:o}=H.create({agent:r});return o(t)},nt=async({actor:e,code:t})=>{let r=await B(e),{installChunkedCode:o}=H.create({agent:r});return o(t)},st=async({actor:e,canisterId:t})=>{let r=await B(e),{canisterStatus:o}=H.create({agent:r});return o(t)},ie=async({canisterId:e,path:t,...r})=>{let o=await B(r),a=globalThis.console.warn;globalThis.console.warn=()=>null;let n=await mr.request({canisterId:e instanceof Le?e:Le.fromText(e),agent:o,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]});return globalThis.console.warn=a,n.get(t)},it=async({actor:e,canisterId:t})=>{let r=await B(e),{listCanisterSnapshots:o}=H.create({agent:r});return o({canisterId:t})},ct=async({actor:e,...t})=>{let r=await B(e),{takeCanisterSnapshot:o}=H.create({agent:r});return o(t)};var lt=(n=>(n[n.AssertingExistingCode=0]="AssertingExistingCode",n[n.StoppingCanister=1]="StoppingCanister",n[n.TakingSnapshot=2]="TakingSnapshot",n[n.UpgradingCode=3]="UpgradingCode",n[n.RestartingCanister=4]="RestartingCanister",n))(lt||{});var pt=e=>crypto.subtle.digest("SHA-256",e),dt=e=>Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""),ut=async e=>{let t=await pt(await e.arrayBuffer());return dt(t)},ce=async e=>{let t=await pt(e);return dt(t)};import{isNullish as gr,nonNullish as mt,uint8ArrayToHexString as yr}from"@dfinity/utils";var _t=async({actor:e,canisterId:t,missionControlId:r,wasmModule:o,preClearChunks:a,...n})=>{a&&await se({actor:e,canisterId:t});let s=await Tr({wasmModule:o}),{uploadChunks:i,storedChunks:c,preClearChunks:p,postClearChunks:u}=await xr({actor:e,wasmChunks:s,canisterId:t,missionControlId:r});p&&await se({actor:e,canisterId:t});let m=[];for await(let l of fr({uploadChunks:i,actor:e,canisterId:t,missionControlId:r}))m=[...m,...l];await nt({actor:e,code:{...n,chunkHashesList:[...m,...c].sort(({orderId:l},{orderId:d})=>l-d).map(({chunkHash:l})=>l),targetCanisterId:t,storeCanisterId:r,wasmModuleHash:await ce(o)}}),u&&await se({actor:e,canisterId:t})},Tr=async({wasmModule:e})=>{let t=new Blob([e]),r=[],o=1e6,a=0;for(let n=0;n<t.size;n+=o){let s=t.slice(n,n+o);r.push({chunk:s,orderId:a,sha256:await ut(s)}),a++}return r},xr=async({canisterId:e,missionControlId:t,actor:r,wasmChunks:o})=>{let a=await ot({actor:r,canisterId:t??e}),n=a.map(({hash:c})=>({chunkHash:{hash:c},sha256:yr(c)})),{storedChunks:s,uploadChunks:i}=o.reduce(({uploadChunks:c,storedChunks:p},{sha256:u,...m})=>{let l=n.find(({sha256:d})=>d===u);return{uploadChunks:[...c,...mt(l)?[]:[{sha256:u,...m}]],storedChunks:[...p,...mt(l)?[{...m,...l}]:[]]}},{uploadChunks:[],storedChunks:[]});return{uploadChunks:i,storedChunks:s,preClearChunks:a.length>0&&s.length===0,postClearChunks:gr(t)}};async function*fr({uploadChunks:e,limit:t=12,...r}){for(let o=0;o<e.length;o=o+t){let a=e.slice(o,o+t);yield await Promise.all(a.map(s=>Pr({uploadChunk:s,...r})))}}var Pr=async({actor:e,canisterId:t,missionControlId:r,uploadChunk:{chunk:o,...a}})=>({chunkHash:await at({actor:e,chunk:{canisterId:r??t,chunk:new Uint8Array(await o.arrayBuffer())}}),...a});var gt=async({actor:e,...t})=>{await rt({actor:e,code:t})};var K=async({wasmModule:e,canisterId:t,actor:r,onProgress:o,takeSnapshot:a=!0,...n})=>{await te({fn:async()=>await hr({wasmModule:e,canisterId:t,actor:r,...n}),onProgress:o,step:0}),await te({fn:async()=>await et({canisterId:t,actor:r}),onProgress:o,step:1});try{await te({fn:async()=>a?await Fr({canisterId:t,actor:r}):Promise.resolve(),onProgress:o,step:2}),await te({fn:async()=>await Sr({wasmModule:e,canisterId:t,actor:r,...n}),onProgress:o,step:3})}finally{await te({fn:async()=>await tt({canisterId:t,actor:r}),onProgress:o,step:4})}},te=async({fn:e,step:t,onProgress:r})=>{r?.({step:t,state:"in_progress"});try{await e(),r?.({step:t,state:"success"})}catch(o){throw r?.({step:t,state:"error"}),o}},hr=async({actor:e,canisterId:t,wasmModule:r,reset:o})=>{if(o===!0)return;let{module_hash:a}=await st({actor:e,canisterId:t}),n=Cr(a);if(Or(n))return;let s=await ce(r),i=Rr(n);if(s===i)throw new oe},Sr=async({wasmModule:e,canisterId:t,actor:r,...o})=>{await((new Blob([e]).size>2e6?"chunked":"single")==="chunked"?_t:gt)({wasmModule:e,canisterId:t,actor:r,...o})},Fr=async e=>{let t=await it(e);await ct({...e,snapshotId:t?.[0]?.id})};import{IDL as $}from"@dfinity/candid";var yt=e=>$.encode([$.Record({user:$.Principal})],[{user:e}]),le=e=>$.encode([$.Record({controllers:$.Vec($.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var na=async({missionControl:e,...t})=>{let r=await Qe({missionControl:e}),{missionControlId:o,...a}=e;if(!o)throw new Error("No mission control principal defined.");let n=yt(r);await K({actor:a,canisterId:Vr.fromText(o),arg:new Uint8Array(n),mode:X,...t})};import{assertNonNullish as kr,isNullish as wr}from"@dfinity/utils";import{JUNO_PACKAGE_MISSION_CONTROL_ID as vr}from"@junobuild/config";import{isNullish as Ar}from"@dfinity/utils";import{JunoPackageSchema as br}from"@junobuild/config";import*as Y from"zod";var G=async({moduleId:e,...t})=>{let r=await ie({...t,canisterId:e,path:"juno:package"});if(Ar(r))return;if(typeof r!="string")throw new Error("Unexpected metadata type to parse public custom section juno:package");return(a=>Y.string().transform((n,s)=>{try{return JSON.parse(n)}catch{return s.addIssue({code:Y.ZodIssueCode.custom,message:"Invalid JSON"}),Y.never}}).pipe(br).parse(a))(r)},pa=async e=>(await G(e))?.version,da=async e=>(await G(e))?.dependencies;var xa=async({missionControl:{missionControlId:e,...t}})=>{kr(e,"A Mission Control ID must be provided to request its version.");let r=await G({moduleId:e,...t});if(wr(r))return await $e({missionControl:{missionControlId:e,...t}});let{name:o,version:a}=r;if(o===vr)return a;throw new ae};var Na=async e=>{await K(e)};var Tt=async({orbiter:e})=>{let{version:t}=await Xe(e);return t()},pe=async({orbiter:e})=>(await Re(e)).list_controllers(),xt=async({orbiter:e})=>{let{memory_size:t}=await Re(e);return t()};var Sa=e=>pe(e);var Aa=e=>xt(e);import{Principal as Mr}from"@dfinity/principal";var Ea=async({orbiter:e,reset:t=!1,...r})=>{let{orbiterId:o,...a}=e;if(!o)throw new Error("No orbiter principal defined.");let n=await pe({orbiter:e}),s=le(n);await K({actor:a,canisterId:Mr.fromText(o),arg:new Uint8Array(s),mode:t?ee:X,reset:t,...r})};import{assertNonNullish as qr,isNullish as Er}from"@dfinity/utils";import{JUNO_PACKAGE_ORBITER_ID as Ur}from"@junobuild/config";var Ga=async({orbiter:{orbiterId:e,...t}})=>{qr(e,"An Orbiter ID must be provided to request its version.");let r=await G({moduleId:e,...t});if(Er(r))return await Tt({orbiter:{orbiterId:e,...t}});let{name:o,version:a}=r;if(o===Ur)return a;throw new ne};import{major as ft,minor as Pt,patch as Nt}from"semver";var Za=({currentVersion:e,selectedVersion:t})=>{let r=ft(e),o=ft(t),a=Pt(e),n=Pt(t),s=Nt(e),i=Nt(t);return r<o-1||a<n-1||s<i-1?{canUpgrade:!1}:{canUpgrade:!0}};import{toNullable as Br}from"@dfinity/utils";var Ct=async({config:e,satellite:t})=>{let{set_storage_config:r}=await w(t);return r(e)},Ot=async({config:e,satellite:t})=>{let{set_db_config:r}=await w(t);return r(e)},Rt=async({config:e,satellite:t})=>{let{set_auth_config:r}=await w(t);return r(e)};var ht=async({satellite:e})=>{let{get_auth_config:t}=await w(e);return t()},St=async({satellite:e,type:t})=>(await w(e)).list_rules(t),Ft=async({type:e,collection:t,rule:r,satellite:o})=>{let{set_rule:a}=await w(o);return a(e,t,r)},Vt=async({satellite:e})=>{let{version:t}=await je(e);return t()},At=async({satellite:e})=>(await Ge(e)).list_controllers(),de=async({satellite:e})=>(await We(e)).list_controllers(),ue=async({satellite:e})=>(await w(e)).list_controllers(),bt=async({satellite:e})=>{let{list_custom_domains:t}=await w(e);return t()},Se=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:o}=await w(e);await o(t,Br(r))},kt=async({satellite:e})=>{let{memory_size:t}=await w(e);return t()},wt=async({collection:e,satellite:t})=>{let{count_collection_docs:r}=await w(t);return r(e)},vt=async({collection:e,satellite:t})=>{let{count_collection_assets:r}=await w(t);return r(e)},Mt=async({collection:e,satellite:t})=>{let{del_docs:r}=await w(t);return r(e)},qt=async({collection:e,satellite:t})=>{let{del_assets:r}=await w(t);return r(e)},Et=async({args:e,satellite:t})=>{let{set_controllers:r}=await w(t);return r(e)};var Ia=e=>vt(e),La=e=>qt(e);import{fromNullable as me,isNullish as zt,nonNullish as Ut,toNullable as Bt}from"@dfinity/utils";import{nonNullish as zr,toNullable as Fe}from"@dfinity/utils";var Ve=e=>Fe(zr(e)?{heap:Fe(e.heap),stable:Fe(e.stable)}:void 0);var sn=async({config:{headers:e,rewrites:t,redirects:r,iframe:o,rawAccess:a,maxMemorySize:n},satellite:s})=>{let i=(e??[]).map(({source:l,headers:d})=>[l,d]),c=(t??[]).map(({source:l,destination:d})=>[l,d]),p=(r??[]).map(({source:l,location:d,code:R})=>[l,{status_code:R,location:d}]);return await Ct({satellite:s,config:{headers:i,rewrites:c,redirects:[p],iframe:[o==="same-origin"?{SameOrigin:null}:o==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[a===!0?{Allow:null}:{Deny:null}],max_memory_size:Ve(n)}})},cn=async({config:{maxMemorySize:e},...t})=>{await Ot({config:{max_memory_size:Ve(e)},...t})},ln=async({config:{internetIdentity:e},...t})=>{await Rt({config:{internet_identity:zt(e)?[]:[{derivation_origin:Bt(e?.derivationOrigin),external_alternative_origins:Bt(e?.externalAlternativeOrigins)}]},...t})},pn=async({satellite:e})=>{let t=me(await ht({satellite:e}));if(zt(t))return;let r=me(t.internet_identity??[]);return{...Ut(r)&&{internetIdentity:{...Ut(me(r.derivation_origin))&&{derivationOrigin:me(r.derivation_origin)}}}}};var mn=({deprecatedNoScope:e,...t})=>(e===!0?de:ue)(t),_n=e=>Et(e);var Tn=e=>wt(e),xn=e=>Mt(e);import{fromNullable as Ht,nonNullish as Hr}from"@dfinity/utils";var Cn=async({satellite:e})=>(await bt({satellite:e})).map(([r,o])=>{let a=Ht(o.version);return{domain:r,bn_id:Ht(o.bn_id),created_at:o.created_at,updated_at:o.updated_at,...Hr(a)&&{version:a}}}),On=({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:o})=>Se({satellite:e,domainName:r,boundaryNodesId:o}))),Rn=({satellite:e,domain:t})=>Se({satellite:e,domainName:t.domain,boundaryNodesId:t.bn_id});var Fn=e=>kt(e);import{fromNullable as Q,nonNullish as J,toNullable as re}from"@dfinity/utils";var Jt={Db:null},Kt={Storage:null},Gt={Public:null},Wt={Private:null},jt={Managed:null},Zt={Controllers:null},Ae={Heap:null},Xt={Stable:null},$t=600000000n;var be=e=>e==="storage"?Kt:Jt,Dt=({read:e,write:t,memory:r,maxSize:o,maxChangesPerUser:a,maxCapacity:n,version:s,mutablePermissions:i,maxTokens:c})=>({read:Yt(e),write:Yt(t),memory:J(r)?[Jr(r)]:[],version:re(s),max_size:re(J(o)&&o>0?BigInt(o):void 0),max_capacity:re(J(n)&&n>0?n:void 0),max_changes_per_user:re(J(a)&&a>0?a:void 0),mutable_permissions:re(i),rate_config:J(c)?[{max_tokens:BigInt(c),time_per_token_ns:$t}]:[]}),It=([e,t])=>{let{read:r,write:o,updated_at:a,created_at:n,max_size:s,max_changes_per_user:i,max_capacity:c,memory:p,mutable_permissions:u,version:m,rate_config:l}=t,d=s?.[0]??0n>0n?Number(Q(s)):void 0,R=i?.[0]??!1?Q(i):void 0,k=c?.[0]??!1?Q(c):void 0,h=Q(m),x=l?.[0]?.max_tokens??0n>0n?Q(l)?.max_tokens:void 0;return{collection:e,read:Qt(r),write:Qt(o),memory:Kr(Q(p)??Ae),updatedAt:a,createdAt:n,...J(h)&&{version:h},...J(R)&&{maxChangesPerUser:R},...J(d)&&{maxSize:d},...J(k)&&{maxCapacity:k},mutablePermissions:Q(u)??!0,...J(x)&&{maxTokens:Number(x)}}},Qt=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Yt=e=>{switch(e){case"public":return Gt;case"private":return Wt;case"managed":return jt;default:return Zt}},Jr=e=>{switch(e.toLowerCase()){case"heap":return Ae;default:return Xt}},Kr=e=>"Heap"in e?"heap":"stable";var qn=async({type:e,satellite:t})=>(await St({satellite:t,type:be(e)})).map(o=>It(o)),En=async({rule:{collection:e,...t},type:r,satellite:o})=>{await Ft({type:be(r),rule:Dt(t),satellite:o,collection:e})};import{IDL as _e}from"@dfinity/candid";import{Principal as Lt}from"@dfinity/principal";import{isNullish as Gr}from"@dfinity/utils";var jn=async({satellite:e,deprecated:t,deprecatedNoScope:r,reset:o=!1,...a})=>{let{satelliteId:n,...s}=e;if(Gr(n))throw new Error("No satellite principal defined.");if(t){let u=await At({satellite:e}),m=_e.encode([_e.Record({controllers:_e.Vec(_e.Principal)})],[{controllers:u}]);await K({actor:s,canisterId:Lt.fromText(n),arg:new Uint8Array(m),mode:o?ee:X,reset:o,...a});return}let c=await(r?de:ue)({satellite:e}),p=le(c);await K({actor:s,canisterId:Lt.fromText(n),arg:new Uint8Array(p),mode:o?ee:X,reset:o,...a})};import{assertNonNullish as er,isNullish as tr,nonNullish as we}from"@dfinity/utils";import{JUNO_PACKAGE_SATELLITE_ID as ge}from"@junobuild/config";var ke=({dependencyId:e,dependencies:t})=>Object.entries(t??{}).find(([r,o])=>r===e);var ts=async({satellite:{satelliteId:e,...t}})=>{er(e,"A Satellite ID must be provided to request its version.");let r=await G({moduleId:e,...t});if(tr(r))return await Vt({satellite:{satelliteId:e,...t}});let{name:o,version:a,dependencies:n}=r;if(o===ge)return a;let s=ke({dependencies:n,dependencyId:ge});if(we(s)){let[i,c]=s;return c}throw new I},rs=async({satellite:{satelliteId:e,...t}})=>{er(e,"A Satellite ID must be provided to request its version.");let r=await G({moduleId:e,...t});if(tr(r))return await Wr({satellite:{satelliteId:e,...t}});let{name:o,dependencies:a}=r;if(o===ge)return"stock";let n=ke({dependencies:a,dependencyId:ge});if(we(n))return"extended";throw new I},Wr=async({satellite:{satelliteId:e,...t}})=>{let r=await ie({...t,canisterId:e,path:"juno:build"});return we(r)&&["stock","extended"].includes(r)?r:void 0};export{ae as MissionControlVersionError,ne as OrbiterVersionError,I as SatelliteMissingDependencyError,lt as UpgradeCodeProgressStep,oe as UpgradeCodeUnchangedError,ut as blobSha256,Za as checkUpgradeVersion,Ia as countAssets,Tn as countDocs,La as deleteAssets,xn as deleteDocs,ke as findJunoPackageDependency,pn as getAuthConfig,G as getJunoPackage,da as getJunoPackageDependencies,pa as getJunoPackageVersion,Cn as listCustomDomains,So as listMissionControlControllers,Sa as listOrbiterControllers,qn as listRules,mn as listSatelliteControllers,xa as missionControlVersion,Aa as orbiterMemorySize,Ga as orbiterVersion,rs as satelliteBuildType,Fn as satelliteMemorySize,ts as satelliteVersion,ln as setAuthConfig,Rn as setCustomDomain,On as setCustomDomains,cn as setDatastoreConfig,ho as setMissionControlController,En as setRule,_n as setSatelliteControllers,Ro as setSatellitesController,sn as setStorageConfig,ce as uint8ArraySha256,na as upgradeMissionControl,Na as upgradeModule,Ea as upgradeOrbiter,jn as upgradeSatellite};
4
4
  //# sourceMappingURL=index.mjs.map