UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

105 lines 10.1 kB
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{R as t,wr as n,z as r}from"./control-ui-foundation-Cydpkyqa.js";import{Bn as i,Sc as a,bc as o,zn as s}from"./control-ui-core-Rwzhj6nO.js";import{$ as c,K as l,X as u,at as d,c as f,q as p,u as m}from"./lit-runtime-CV_MH99K.js";import{_ as h,g}from"./control-ui-core-YphAl4aM.js";import{Yt as _,en as v}from"./control-ui-core-vvcQQV2m.js";import{J as y,K as b,L as x,Q as S,V as C,X as w,et as T,q as E,tt as D,z as O}from"./control-ui-boot-chat-_QSl8fbH.js";import{n as k,t as A}from"./en-settings-D_ebb5Hk.js";import{n as j,t as M}from"./settings-workspace-Bseic8Tf.js";function N(e){let t=P.get(e);if(t)return t;let n={domains:null,targetProfile:null};P.set(e,n);let r=e.subscribe(({browser:{cookieSync:t}})=>{n.domains?.length===t.domains.length&&n.domains.every((e,n)=>e===t.domains[n])&&(n.domains=null),n.targetProfile?.sent&&n.targetProfile.value===t.targetProfile&&(n.targetProfile=null),n.domains===null&&n.targetProfile===null&&(r(),P.delete(e))});return n}var P,F;function I(){return(I=e((()=>{r(),l(),c(),f(),h(),x(),M(),_(),A(),a(),i(),k(),P=new WeakMap,F=class extends o{constructor(...e){super(...e),this.newDomain=``,this.targetProfileTimer=null,this.subscriptions=new s(this).watch(()=>this.context?.nativeDeviceSettings,(e,t)=>e.subscribe(t),e=>{this.targetProfileTimer&&this.targetProfileTimer.capability!==e&&this.flushTargetProfile()})}disconnectedCallback(){this.flushTargetProfile(),this.subscriptions.clear(),super.disconnectedCallback()}toggle(e,t,n,r,i=!1){return T({title:v(`configPage.deviceSettings.${n}`),description:r,checked:t,disabled:i,onChange:t=>this.context.nativeDeviceSettings?.set(e,t)})}editTargetProfile(e){let t=this.context.nativeDeviceSettings;t&&(this.targetProfileTimer!==null&&clearTimeout(this.targetProfileTimer.timer),N(t).targetProfile={value:e,sent:!1},this.targetProfileTimer={capability:t,timer:setTimeout(()=>this.flushTargetProfile(),400)},this.requestUpdate())}flushTargetProfile(){let e=this.targetProfileTimer;if(!e)return;clearTimeout(e.timer),this.targetProfileTimer=null;let t=P.get(e.capability)?.targetProfile;t&&!t.sent&&(t.sent=!0,e.capability.set(`browser.cookieSync.targetProfile`,t.value))}updateDomains(e){let t=this.context.nativeDeviceSettings;if(!t)return;let n=P.get(t)?.domains??t.snapshot?.browser.cookieSync.domains;if(!n)return;let r=[...new Set(e(n).map(e=>e.trim().toLowerCase()).filter(Boolean))];N(t).domains=r,this.requestUpdate(),t.set(`browser.cookieSync.domains`,r)}renderBrowser(e){let t=this.context.nativeDeviceSettings,n=e.browser.cookieSync,r=t?P.get(t):void 0,i=r?.domains??n.domains,a=()=>{this.updateDomains(e=>[...e,this.newDomain]),this.newDomain=``};return u` ${e.browser.importAvailable||!n.available?w({title:v(`configPage.deviceSettings.browser`)},u` ${e.browser.importAvailable?y({title:v(`configPage.deviceSettings.browserImport`),description:v(`configPage.deviceSettings.browserImportHint`),control:u`<button type="button" class="btn" @click=${()=>t?.openPanel(`browser-import`)} > ${v(`configPage.deviceSettings.importBrowserLogins`)} </button>`}):p} ${n.available?p:y({title:v(`configPage.deviceSettings.cookieSync`),description:v(`configPage.deviceSettings.cookieSyncUnavailable`)})} `):p} ${n.available?w({title:v(e.browser.importAvailable?`configPage.deviceSettings.cookieSync`:`configPage.deviceSettings.browser`),description:e.browser.importAvailable?void 0:v(`configPage.deviceSettings.cookieSync`)},u` ${this.toggle(`browser.cookieSync.enabled`,n.enabled,`cookieSyncEnabled`,v(`configPage.deviceSettings.cookieSyncHint`))} ${y({title:v(`configPage.deviceSettings.domains`),description:v(`configPage.deviceSettings.domainsHint`),stacked:!0,control:u`<div class="device-domains"> ${i.map(e=>u`<div class="device-domain-entry"> ${D(e)} <button type="button" class="btn small" aria-label=${v(`configPage.deviceSettings.removeDomain`,{domain:e})} @click=${()=>this.updateDomains(t=>t.filter(t=>t!==e))} > ${v(`common.remove`)} </button> </div>`)} <form class="device-domain-entry" @submit=${e=>{e.preventDefault(),a()}} > <input type="text" class="settings-input" aria-label=${v(`configPage.deviceSettings.addDomain`)} .value=${m(this.newDomain)} @input=${e=>{this.newDomain=e.currentTarget.value}} /> <button type="submit" class="btn" ?disabled=${!this.newDomain.trim()}> ${v(`configPage.deviceSettings.addDomain`)} </button> </form> </div>`})} ${y({title:v(`configPage.deviceSettings.targetProfile`),description:v(`configPage.deviceSettings.targetProfileHint`),control:u`<input type="text" class="settings-input" aria-label=${v(`configPage.deviceSettings.targetProfile`)} .value=${m(r?.targetProfile?.value??n.targetProfile)} @input=${e=>{this.editTargetProfile(e.currentTarget.value)}} @change=${()=>this.flushTargetProfile()} />`})} ${y({title:v(`configPage.deviceSettings.syncStatus`),description:n.detail??void 0,control:S({kind:n.state===`error`?`danger`:n.state===`running`?`accent`:`muted`,label:v(`configPage.deviceSettings.syncStates.${n.state}`)})})} `):p} `}renderSettings(e){let{app:t,capabilities:n}=e,r=this.context.nativeDeviceSettings;return u` ${w({title:v(`configPage.deviceSettings.app`)},u` ${this.toggle(`app.showDockIcon`,t.showDockIcon,`showDockIcon`,v(`configPage.deviceSettings.showDockIconHint`))} ${this.toggle(`app.iconAnimationsEnabled`,t.iconAnimationsEnabled,`iconAnimations`,v(`configPage.deviceSettings.iconAnimationsHint`))} ${this.toggle(`app.launchAtLogin`,t.launchAtLogin,`launchAtLogin`,t.launchAtLoginAvailable?void 0:v(`configPage.deviceSettings.launchAtLoginUnavailable`),!t.launchAtLoginAvailable)} ${this.toggle(`app.quickChatEnabled`,t.quickChatEnabled,`quickChat`,v(`configPage.deviceSettings.quickChatHint`))} ${y({title:v(`configPage.deviceSettings.quickChatShortcut`),control:u` ${D(t.quickChatShortcut??v(`configPage.deviceSettings.notSet`))} <button type="button" class="btn" @click=${()=>r?.openPanel(`quick-chat-shortcut`)} > ${v(`configPage.deviceSettings.changeShortcut`)} </button> `})} `)} ${w({title:v(`configPage.deviceSettings.capabilities`)},u` ${this.toggle(`capabilities.canvasEnabled`,n.canvasEnabled,`canvas`,v(`configPage.deviceSettings.canvasHint`))} ${this.toggle(`capabilities.cameraEnabled`,n.cameraEnabled,`camera`,v(`configPage.deviceSettings.cameraHint`))} ${this.toggle(`capabilities.computerControlEnabled`,n.computerControlEnabled,`computerControl`,v(`configPage.deviceSettings.computerControlHint`))} ${n.computerControlEnabled?y({title:v(`configPage.deviceSettings.computerControlProvider`),control:u`<select class="settings-select" aria-label=${v(`configPage.deviceSettings.computerControlProvider`)} .value=${n.computerControlProvider} @change=${e=>{let t=e.currentTarget.value;r?.set(`capabilities.computerControlProvider`,t)}} > <option value="peekaboo" ?selected=${n.computerControlProvider===`peekaboo`} > ${v(`configPage.deviceSettings.peekaboo`)} </option> <option value="cua" ?selected=${n.computerControlProvider===`cua`} ?disabled=${!n.cuaDriverBundled} > ${v(n.cuaDriverBundled?`configPage.deviceSettings.cua`:`configPage.deviceSettings.cuaUnavailable`)} </option> </select>`}):p} ${this.toggle(`capabilities.peekabooBridgeEnabled`,n.peekabooBridgeEnabled,`peekabooBridge`,v(`configPage.deviceSettings.peekabooBridgeHint`),!n.computerControlEnabled)} `)} ${this.renderBrowser(e)} ${w({title:v(`configPage.deviceSettings.developer`)},u` ${this.toggle(`app.debugPaneEnabled`,t.debugPaneEnabled,`debugTools`)} ${t.debugPaneEnabled?y({title:v(`configPage.deviceSettings.debugWindow`),control:u`<button type="button" class="btn" @click=${()=>r?.openPanel(`debug`)}>${v(`configPage.deviceSettings.openDebug`)}</button>`}):p} `)} `}render(){let e=this.context?.nativeDeviceSettings,t=e?.snapshot,n=e?t?this.renderSettings(t):C(v(`configPage.deviceSettings.loading`)):C(v(`configPage.deviceSettings.appOnly`));return u` ${E({title:v(t?.device.platform===`macos`?`nav.settingsGroupDevice`:`nav.settingsGroupThisDevice`),subtitle:u`${v(`configPage.deviceSettings.intro`)} ${O(`https://docs.openclaw.ai/platforms/macos`)}`})} ${j(b(n))} `}},n([t({context:g,subscribe:!0})],F.prototype,`context`,void 0),n([d()],F.prototype,`newDomain`,void 0),customElements.get(`openclaw-device-page`)||customElements.define(`openclaw-device-page`,F)})))()}I(); //# sourceMappingURL=device-page-5LNFuNyk.js.map