import{fs as e}from"./app-server-manager-signals-Yn0WSnoY.js";import{A as t,_ as n,a as r,g as i,h as a,lt as o,n as s,r as c,u as l}from"./vscode-api-DjORcpSo.js";import{t as u}from"./invalidate-queries-and-broadcast-CivBKbpC.js";var d=o(),f=c(`browser-use-origin-state-read`),p=r(a,`browser-use-origin-state-read`,{staleTime:l.FIVE_SECONDS});function m(t){let r=(0,d.c)(8),{hostId:a}=t,o=u(),s;r[0]!==a||r[1]!==o?(s=async()=>{await Promise.all([o(f),e(`clear-prewarmed-threads-for-host`,{hostId:a})])},r[0]=a,r[1]=o,r[2]=s):s=r[2];let c;r[3]===o?c=r[4]:(c=e=>{i.error(`Failed to update Browser Use full CDP access`,{safe:{},sensitive:{error:String(e)}}),o(f)},r[3]=o,r[4]=c);let l;return r[5]!==s||r[6]!==c?(l={mutationFn:h,onSuccess:s,onError:c},r[5]=s,r[6]=c,r[7]=l):l=r[7],n(l)}function h(e){return s(`browser-use-full-cdp-access-enabled-write`,{params:{enabled:e}})}function g(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={mutationFn:_},e[0]=t):t=e[0],n(t)}async function _(e){try{return await s(`browser-browsing-data-clear`,{params:{dataTypes:e}})}catch(e){throw i.error(`Failed to clear browser browsing data`,{safe:{error:String(e)},sensitive:{}}),e}}function v(){let e=(0,d.c)(2),r=t(),a;return e[0]===r?a=e[1]:(a={mutationFn:y,onSuccess:async()=>{await r.invalidateQueries({queryKey:f})},onError:e=>{i.error(`Failed to update browser-use approval mode`,{safe:{error:String(e)},sensitive:{}}),r.invalidateQueries({queryKey:f})}},e[0]=r,e[1]=a),n(a)}function y(e){return s(`browser-use-approval-mode-write`,{params:{approvalMode:e}})}function b(){let e=(0,d.c)(2),r=t(),a;return e[0]===r?a=e[1]:(a={mutationFn:x,onSuccess:async()=>{await r.invalidateQueries({queryKey:f})},onError:e=>{i.error(`Failed to update browser-use history approval mode`,{safe:{error:String(e)},sensitive:{}}),r.invalidateQueries({queryKey:f})}},e[0]=r,e[1]=a),n(a)}function x(e){return s(`browser-use-history-approval-mode-write`,{params:{approvalMode:e}})}function S(){let e=(0,d.c)(2),r=t(),a;return e[0]===r?a=e[1]:(a={mutationFn:C,onSuccess:async()=>{await r.invalidateQueries({queryKey:f})},onError:e=>{i.error(`Failed to update browser-use file transfer approval mode`,{safe:{error:String(e)},sensitive:{}}),r.invalidateQueries({queryKey:f})}},e[0]=r,e[1]=a),n(a)}function C(e){let{approvalMode:t,kind:n}=e;return s(`browser-use-file-transfer-approval-mode-write`,{params:{approvalMode:t,kind:n}})}function w(){let e=(0,d.c)(2),r=t(),a;return e[0]===r?a=e[1]:(a={mutationFn:T,onSuccess:async()=>{await r.invalidateQueries({queryKey:f})},onError:e=>{i.error(`Failed to update browser-use origin state`,{safe:{error:String(e)},sensitive:{}}),r.invalidateQueries({queryKey:f})}},e[0]=r,e[1]=a),n(a)}function T(e){let{kind:t,origin:n}=e;return s(`browser-use-origin-add`,{params:{kind:t,targetOrigin:n}})}function E(){let e=(0,d.c)(2),r=t(),a;return e[0]===r?a=e[1]:(a={mutationFn:D,onSuccess:async()=>{await r.invalidateQueries({queryKey:f})},onError:e=>{i.error(`Failed to update browser-use file transfer origin state`,{safe:{error:String(e)},sensitive:{}}),r.invalidateQueries({queryKey:f})}},e[0]=r,e[1]=a),n(a)}function D(e){let{kind:t,origin:n,transferKind:r}=e;return s(`browser-use-file-transfer-origin-add`,{params:{kind:t,targetOrigin:n,transferKind:r}})}function O(){let e=(0,d.c)(2),r=t(),a;return e[0]===r?a=e[1]:(a={mutationFn:k,onSuccess:async()=>{await r.invalidateQueries({queryKey:f})},onError:e=>{i.error(`Failed to update browser-use origin state`,{safe:{error:String(e)},sensitive:{}}),r.invalidateQueries({queryKey:f})}},e[0]=r,e[1]=a),n(a)}function k(e){let{kind:t,origin:n}=e;return s(`browser-use-origin-remove`,{params:{kind:t,targetOrigin:n}})}function A(){let e=(0,d.c)(2),r=t(),a;return e[0]===r?a=e[1]:(a={mutationFn:j,onSuccess:async()=>{await r.invalidateQueries({queryKey:f})},onError:e=>{i.error(`Failed to update browser-use file transfer origin state`,{safe:{error:String(e)},sensitive:{}}),r.invalidateQueries({queryKey:f})}},e[0]=r,e[1]=a),n(a)}function j(e){let{kind:t,origin:n,transferKind:r}=e;return s(`browser-use-file-transfer-origin-remove`,{params:{kind:t,targetOrigin:n,transferKind:r}})}export{g as a,v as c,b as d,w as i,S as l,_ as n,A as o,E as r,O as s,p as t,m as u};
//# sourceMappingURL=browser-use-origin-state-queries-D37LBNEC.js.map