@camstack/addon-admin-ui 1.2.83 → 1.2.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddLocationWizard-De7ns5QL.js → AddLocationWizard-CwreWITW.js} +1 -1
- package/dist/assets/{AddonCollectionPage-DXsxDYkh.js → AddonCollectionPage-B_yz8bA0.js} +1 -1
- package/dist/assets/Addons-ByS1wyLr.js +1 -0
- package/dist/assets/{AdminTabs-Ea5QF5Xy.js → AdminTabs-BNPrEU-u.js} +1 -1
- package/dist/assets/{AiProfiles-Cf11u16h.js → AiProfiles-BOhYahU1.js} +2 -2
- package/dist/assets/{BrokerForm-B-sL3dqC.js → BrokerForm-B45_C-11.js} +1 -1
- package/dist/assets/{Build-_kPogt2B.js → Build-DBt1hX43.js} +4 -4
- package/dist/assets/{Capabilities-D-_vyuUw.js → Capabilities-D3ydTf8a.js} +1 -1
- package/dist/assets/{CapabilityBadges-DVcflr6z.js → CapabilityBadges-BsNvOYxI.js} +1 -1
- package/dist/assets/{Cluster-CP-cfGdm.js → Cluster-Be75yEy8.js} +1 -1
- package/dist/assets/{Data-D3-pzcKz.js → Data-DjH9RwP1.js} +1 -1
- package/dist/assets/DetectionIntelligence-Bxil3Kqd.js +1 -0
- package/dist/assets/{DeviceAggregateSection-CZPFsC_N.js → DeviceAggregateSection-CmeOZSZb.js} +1 -1
- package/dist/assets/DeviceDetail-CLZxugdc.js +2 -0
- package/dist/assets/{Devices-CQEzT4CH.js → Devices-BiaI1wtk.js} +1 -1
- package/dist/assets/EmbedPlayerPage-BFMqluKF.js +1 -0
- package/dist/assets/Events-2Mew-AL7.js +1 -0
- package/dist/assets/FormBuilder-BDA9-uL2.js +1 -0
- package/dist/assets/Identity-DYj1lU6G.js +1 -0
- package/dist/assets/IntegrationDetail-DkP04o_o.js +1 -0
- package/dist/assets/{Integrations-Bs6_6m2A.js → Integrations-DypneOCC.js} +1 -1
- package/dist/assets/Integrations-Q2IXumNM.js +1 -0
- package/dist/assets/{Logs-CJEauzfn.js → Logs-DCGZ4xft.js} +1 -1
- package/dist/assets/{MotionZonesSettings-CrtWFnAG.js → MotionZonesSettings-D2OfXg-s.js} +1 -1
- package/dist/assets/{MyAccess-MG2HC7n3.js → MyAccess-DiZ_NQ8Q.js} +1 -1
- package/dist/assets/{Network-DaZHubTl.js → Network-D6Jjjglj.js} +1 -1
- package/dist/assets/{NodeAddonsSettingsPanel-Cm3hCWxL.js → NodeAddonsSettingsPanel-iynDrGDY.js} +1 -1
- package/dist/assets/NodeInferenceDevices-kA005bIs.js +1 -0
- package/dist/assets/Notifications-3VV4lesM.js +1 -0
- package/dist/assets/Pipeline-Cvq_ZK2N.js +1 -0
- package/dist/assets/{Plates-CdlwAHjB.js → Plates-Mq7_V44B.js} +1 -1
- package/dist/assets/{PrivacyMaskSettings-1sJg0nCf.js → PrivacyMaskSettings-DegFwke0.js} +1 -1
- package/dist/assets/{ProviderIcon-CIB9wAOh.js → ProviderIcon-BRIZHtNP.js} +1 -1
- package/dist/assets/Recordings-GWbTxHDj.js +1 -0
- package/dist/assets/{ScanNetworkModal-QJjU9tvg.js → ScanNetworkModal-h2wgb-9T.js} +1 -1
- package/dist/assets/{SceneMonitorEditor-B_qhxMl3.js → SceneMonitorEditor-DtUM6j78.js} +1 -1
- package/dist/assets/{Scenes-S26M2qHR.js → Scenes-CXbQ1BC3.js} +1 -1
- package/dist/assets/{Settings-BgvNkBP1.js → Settings-CezuMxyz.js} +1 -1
- package/dist/assets/{Showroom-GHOpXZqD.js → Showroom-HltZNDXE.js} +1 -1
- package/dist/assets/{Terminal-B0ibWMEy.js → Terminal-9BMEBt8x.js} +2 -2
- package/dist/assets/{_virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-BxzyL6ky.js → _virtual_mf-localSharedImportMap___mfe_internal__admin_ui_host-CLXUGt-W.js} +1 -1
- package/dist/assets/{bell-ring-C1CDDXf4.js → bell-ring-BOKJStq_.js} +1 -1
- package/dist/assets/{boxes-D1jLdgix.js → boxes-BvnEYalC.js} +1 -1
- package/dist/assets/{build-cluster-graph-C4jX8n1A.js → build-cluster-graph-BVmcPlKM.js} +2 -2
- package/dist/assets/circle-check-big-H_sRGszZ.js +1 -0
- package/dist/assets/{circle-x-CJJu15h-.js → circle-x-De9Atcex.js} +1 -1
- package/dist/assets/clock-DmdPTuLe.js +1 -0
- package/dist/assets/{copy-CCWWm0Zr.js → copy-DPSVazs5.js} +1 -1
- package/dist/assets/{debounced-invalidate-Bo_vaBxo.js → debounced-invalidate-CaNNRf1N.js} +1 -1
- package/dist/assets/{dist-B7jD-S4H.js → dist-DHHyyJUp.js} +1 -1
- package/dist/assets/dist-DtzZqioA.js +349 -0
- package/dist/assets/{download-BkhXjXOx.js → download-D0TL4kvK.js} +1 -1
- package/dist/assets/{face-bbox-BOyxoUe0.js → face-bbox-DHOml3XL.js} +1 -1
- package/dist/assets/{hard-drive-fVjmkYpz.js → hard-drive-E6KB7P74.js} +1 -1
- package/dist/assets/{hostInit-CFYQGKqd.js → hostInit-CJNRBgTm.js} +1 -1
- package/dist/assets/index-BVmc_EOb.js +4 -0
- package/dist/assets/{index-BppWvbJe.css → index-DR0aGe9s.css} +1 -1
- package/dist/assets/{key-round-BWUCyF0a.js → key-round-DCkVCgVU.js} +1 -1
- package/dist/assets/{mf-entry-bootstrap-0-8a7c339b.js → mf-entry-bootstrap-0-b0b43084.js} +2 -2
- package/dist/assets/{pencil-BOy-rDbD.js → pencil-CCigTGBs.js} +1 -1
- package/dist/assets/play-CAbyx0Ik.js +1 -0
- package/dist/assets/{player-overlays-UTlrOH4s.js → player-overlays-Cce7zLVf.js} +1 -1
- package/dist/assets/plus-CkMMGkZS.js +1 -0
- package/dist/assets/power-CFTIVgET.js +1 -0
- package/dist/assets/{radio-DKuDbOsT.js → radio-DH4YapvY.js} +1 -1
- package/dist/assets/{refresh-cw-BRs_7wGu.js → refresh-cw-7BWEDRql.js} +1 -1
- package/dist/assets/remoteEntry-ee3nHxW_.js +1 -0
- package/dist/assets/rotate-ccw-CvT7yFgt.js +1 -0
- package/dist/assets/rotate-cw-CHBtKezc.js +1 -0
- package/dist/assets/search-LiVSlZYd.js +1 -0
- package/dist/assets/{send-DSafmQi_.js → send-BxN-W44d.js} +1 -1
- package/dist/assets/{server-wq15CL48.js → server-MPW5E9Je.js} +1 -1
- package/dist/assets/square-BGhxv6lU.js +1 -0
- package/dist/assets/{square-check-big-DO81u3O2.js → square-check-big-KUDADp7C.js} +1 -1
- package/dist/assets/src-BQU93IBQ.js +349 -0
- package/dist/assets/src-CLcW_gk2.js +67 -0
- package/dist/assets/{star-Docf4EYZ.js → star-DgpioIxR.js} +1 -1
- package/dist/assets/{undo-2-LIqqVOPk.js → undo-2-Dx5lBXZW.js} +1 -1
- package/dist/assets/{upload-D4XiPM-V.js → upload-C_Z1HY8V.js} +1 -1
- package/dist/assets/{use-scenes-feed-BdUI8ZzS.js → use-scenes-feed-7qe4q2V7.js} +1 -1
- package/dist/assets/useEventInvalidation-B1u2ACO8.js +1 -0
- package/dist/assets/{video-DdJ2lmUL.js → video-CDs4hw5_.js} +1 -1
- package/dist/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-cD-zqb5y.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__admin_ui_host__remoteEntry-_hash_-BZfm1F7n.js} +2 -2
- package/dist/assets/{wifi-Dx0-akbW.js → wifi-C6eU8xw2.js} +1 -1
- package/dist/assets/{zap-BLI50LGc.js → zap-CosjZI2Q.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/server/addon.js +139 -57
- package/package.json +1 -1
- package/dist/assets/Addons-iB8Jj8Wa.js +0 -1
- package/dist/assets/DetectionIntelligence-B914KqGk.js +0 -1
- package/dist/assets/DeviceDetail-Cz70xnHl.js +0 -2
- package/dist/assets/EmbedPlayerPage-BQ1dgL2t.js +0 -1
- package/dist/assets/Events-B9-2qvUg.js +0 -1
- package/dist/assets/FormBuilder-ERsdhqXU.js +0 -1
- package/dist/assets/Identity-BNMnBiNq.js +0 -1
- package/dist/assets/IntegrationDetail-CY-7m0wv.js +0 -1
- package/dist/assets/Integrations-CbfIXyMv.js +0 -1
- package/dist/assets/NodeInferenceDevices-2-PPLG4L.js +0 -1
- package/dist/assets/Notifications-DMPhSkZ8.js +0 -1
- package/dist/assets/Pipeline-D4RLE8zf.js +0 -1
- package/dist/assets/Recordings-D4KRWthc.js +0 -1
- package/dist/assets/circle-check-big-Be_uVG-B.js +0 -1
- package/dist/assets/clock-9WRXwSMf.js +0 -1
- package/dist/assets/dist-Cpz6pXi5.js +0 -345
- package/dist/assets/index-DM4pp8Vx.js +0 -4
- package/dist/assets/play-tYEpmInf.js +0 -1
- package/dist/assets/plus-uTnAmy5n.js +0 -1
- package/dist/assets/power-DLJJxxZ5.js +0 -1
- package/dist/assets/remoteEntry-B-TTgn5K.js +0 -1
- package/dist/assets/rotate-ccw-CZY9UuXq.js +0 -1
- package/dist/assets/rotate-cw-rDbUnEsj.js +0 -1
- package/dist/assets/search-BGsNM6IN.js +0 -1
- package/dist/assets/square-BFMdi_Qm.js +0 -1
- package/dist/assets/src-C9CFJqET.js +0 -345
- package/dist/assets/src-DVZrqMsD.js +0 -67
- package/dist/assets/useEventInvalidation-DLMOtAJP.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,b as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Dr as l,Ur as u,_r as d,cr as f,kr as p,rr as m,sr as h,xi as g,zr as _}from"./src-DVZrqMsD.js";import{t as v}from"./download-BkhXjXOx.js";import{t as y}from"./FormBuilder-ERsdhqXU.js";import{t as b}from"./refresh-cw-BRs_7wGu.js";import{C as x,K as S,L as C,i as w,j as T,o as E,t as D,z as O}from"./index-DM4pp8Vx.js";import{t as k}from"./BrokerForm-B-sL3dqC.js";var A=S(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]);n();var j=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],M=`/addon/import-alexa`,N=2e3;function P(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function F(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function I(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function L(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function R(e,t,n){let r=await fetch(`${M}${e}`,{method:`POST`,headers:L(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function z(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${M}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!F(i))throw Error(`Unexpected status response from server`);return i}async function B(e){try{await fetch(`${M}/login/cancel`,{method:`POST`,headers:L(),body:JSON.stringify({sessionId:e})})}catch{}}function V({brokerId:n,onResolved:i,onCancel:a}){let[l,u]=o(`amazon.it`),[d,f]=o(`Alexa account`),[p,m]=o({kind:`idle`}),h=t(!0);c(()=>(h.current=!0,()=>{h.current=!1}),[]);let g=t(null),_=t(null),v=e(()=>{_.current!==null&&(clearInterval(_.current),_.current=null)},[]),y=e(async e=>{v(),h.current&&m({kind:`committing`,sessionId:e});try{let t=await R(`/login/commit`,{sessionId:e,name:d.trim().length>0?d.trim():`Alexa account`,...n===void 0?{}:{brokerId:n}},I);g.current=null,i(t.brokerId)}catch(t){let n=t instanceof Error?t.message:String(t);h.current&&m({kind:`error`,message:n,sessionId:e})}},[n,d,i,v]),S=e((e,t)=>{v();let n=async()=>{try{let n=await z(e);if(n.phase===`captured`){v(),y(e);return}if(n.phase===`error`){v(),h.current&&m({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){v(),h.current&&m({kind:`idle`});return}h.current&&m({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);h.current&&m(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};_.current=setInterval(()=>{n()},N)},[v,y]);c(()=>()=>{v(),g.current!==null&&B(g.current)},[v]);let C=async()=>{v(),g.current!==null&&(B(g.current),g.current=null),m({kind:`starting`});try{let e=await R(`/login/start`,{amazonDomain:l},P);g.current=e.sessionId,m({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),S(e.sessionId,e.loginUrl)}catch(e){m({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},w=()=>{v(),g.current!==null&&(B(g.current),g.current=null),m({kind:`idle`})},D=()=>{w()},O=p.kind===`idle`,k=p.kind===`starting`,A=p.kind===`polling`,M=p.kind===`committing`,F=p.kind===`error`,L=k||A||M,V=p.kind===`polling`?p.phase:null,H=p.kind===`polling`?p.loginUrl:null,U=A&&V===`awaiting-login`,W=A&&(V===`starting`||V===null);return r(`div`,{className:`space-y-4`,children:[(O||F)&&r(`div`,{className:`space-y-3`,children:[n===void 0&&r(`div`,{className:`space-y-1`,children:[s(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),s(`input`,{id:`alexa-account-name`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`Alexa account`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),r(`div`,{className:`space-y-1`,children:[s(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),s(`select`,{id:`alexa-amazon-region`,value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:j.map(e=>s(`option`,{value:e,children:e},e))})]})]}),F&&r(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[s(E,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),s(`span`,{children:p.message})]}),k&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),M&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&r(`div`,{className:`space-y-3`,children:[r(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[s(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),r(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[s(T,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),r(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[10px] text-amber-700 dark:text-amber-300`,children:[s(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,s(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),r(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[s(x,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),r(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[s(`button`,{type:`button`,onClick:L?w:a,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:L?`Cancel login`:`Back`}),r(`div`,{className:`flex items-center gap-2`,children:[F&&r(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[s(b,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&s(`button`,{type:`button`,onClick:()=>{C()},disabled:n===void 0&&d.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}n();var H=`alexa`;function U(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function W(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var G={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function K({kind:e,onResolved:t,onBack:n}){let[a,c]=o(e===H?`alexa-login`:`existing`),l=h({kind:e}),u=i(()=>U(l.data).filter(t=>t.kind===e),[l.data,e]),d=f(),p=i(()=>{for(let t of W(d.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[d.data,e]),[g,_]=o(null),[v,y]=o(``),b=m({}),S=()=>{g&&t(g)},w=async n=>{v.trim().length!==0&&t((await b.mutateAsync({kind:e,name:v.trim(),settings:n,...p===void 0?{}:{addonId:p}})).id)},T=e=>{e===`new`?_(null):b.reset(),c(e)};return r(`div`,{className:`space-y-4`,children:[r(`button`,{type:`button`,onClick:n,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[s(C,{className:`h-3.5 w-3.5`}),` Back`]}),r(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===H&&s(`button`,{type:`button`,onClick:()=>T(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),s(`button`,{type:`button`,onClick:()=>T(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),s(`button`,{type:`button`,onClick:()=>T(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===H?`Paste cookie`:`Create new`})]}),a===`alexa-login`&&s(V,{onResolved:t,onCancel:n}),a===`existing`&&r(`div`,{className:`space-y-3`,children:[l.isLoading&&r(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[s(x,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),l.isError&&r(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,l.error instanceof Error?l.error.message:`Unknown error`]}),!l.isLoading&&!l.isError&&u.length===0&&r(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,s(`span`,{className:`font-medium text-foreground`,children:e===H?`Login interactively`:`Create new`}),` `,`to register one.`]}),s(`div`,{className:`space-y-2`,children:u.map(e=>r(`button`,{type:`button`,onClick:()=>_(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${g===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[s(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),s(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${G[e.status]}`,children:e.status})]},e.id))}),u.length>0&&s(`div`,{className:`flex justify-end pt-1`,children:s(`button`,{type:`button`,onClick:S,disabled:!g,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),a===`new`&&r(`div`,{className:`space-y-3`,children:[r(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),s(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),s(k,{kind:e,...p===void 0?{}:{addonId:p},onSubmit:e=>{w(e).catch(()=>{})},onCancel:n,submitLabel:b.isPending?`Creating…`:`Create broker`,disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}n();function q(e){return{status:e.status===`validated`||e.status===`rejected`||e.status===`inconclusive`||e.status===`unsupported`?e.status:e.success?`validated`:`rejected`,...e.error===void 0?{}:{error:e.error},...e.detail===void 0?{}:{detail:e.detail}}}var J={validated:`border-success/30 bg-success/5 text-success`,rejected:`border-danger/30 bg-danger/5 text-danger`,inconclusive:`border-warning/30 bg-warning/5 text-warning`,unsupported:`border-border bg-surface text-foreground-subtle`};function Y({addonId:e,configSchema:t,canTest:n=!0,initialName:i,initialConfig:a,submitLabel:c,hideName:l=!1,onSave:u,onBack:d}){let{t:f}=D(),[p,m]=o(i??``),[h,_]=o(a??{}),[v,b]=o(null),x=g({onSuccess:e=>b(q(e)),onError:e=>b({status:`inconclusive`,error:String(e)})});return r(`div`,{className:`space-y-4`,children:[!l&&r(`div`,{children:[s(`label`,{className:`block text-[11px] font-medium text-foreground mb-1`,children:f(`integrations.integrationName`)}),s(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:f(`integrations.integrationNamePlaceholder`),className:`w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:border-primary/50`})]}),t&&s(y,{schema:t,values:h,onChange:_}),v&&s(`div`,{className:`rounded-lg border px-3 py-2 text-xs ${J[v.status]}`,children:(e=>{switch(e.status){case`validated`:return e.detail?`${f(`integrations.connectionSuccess`)} — ${e.detail}`:f(`integrations.connectionSuccess`);case`rejected`:return`${f(`integrations.errorPrefix`)} ${e.error??``}`;case`inconclusive`:return`${f(`integrations.connectionInconclusive`,{defaultValue:`Could not be checked:`})} ${e.error??``}`;case`unsupported`:return e.error??f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`})}})(v)}),r(`div`,{className:`flex items-center justify-between pt-2`,children:[s(`button`,{onClick:d,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:f(`integrations.back`)}),r(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>x.mutate({addonId:e,settings:h}),disabled:x.isPending||!n,title:n?void 0:f(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`}),className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:x.isPending?f(`integrations.testing`):f(`integrations.testConnection`)}),s(`button`,{onClick:()=>u({name:p,config:h}),disabled:l?!1:!p.trim(),className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:c??f(`integrations.forward`)})]})]})]})}n();function X({open:t,onClose:n,scope:a}){let c=d(),[l,u]=o(new Set),[f,p]=o(new Set),{data:m}=_({}),h=i(()=>new Set((m??[]).map(e=>e.stableId)),[m]),g=e(async(e,t)=>{p(e=>new Set(e).add(t.stableId));try{await c.mutateAsync({addonId:e,candidate:t}),u(e=>new Set(e).add(t.stableId))}catch{}finally{p(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[c]),y=e((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,i=h.has(t.stableId),a=l.has(t.stableId)||i,o=f.has(t.stableId);return r(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[r(`div`,{className:`min-w-0`,children:[s(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&s(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),a?r(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[s(O,{className:`h-3.5 w-3.5`}),` `,i?`Already added`:`Added`]}):r(`button`,{type:`button`,onClick:()=>void g(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?s(x,{className:`h-3.5 w-3.5 animate-spin`}):s(v,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[l,f,h,g]);if(!t)return null;let b=a?`Scan network — ${a.label}`:`Scan network for devices`;return r(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[s(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n}),r(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[calc(90dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl`,children:[r(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(A,{className:`h-4 w-4 text-primary`}),s(`h2`,{className:`text-sm font-semibold text-foreground`,children:b})]}),s(`button`,{onClick:n,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:s(w,{className:`h-4 w-4`})})]}),a?s(Q,{scope:a,onAdopt:y,onReset:()=>u(new Set)}):s(Z,{onAdopt:y,onReset:()=>u(new Set)})]})]})}function Z({onAdopt:t,onReset:n}){let o=l(),u=e(()=>{n(),o.mutate({})},[o,n]);c(()=>{!o.isPending&&!o.data&&u()},[]);let d=i(()=>(o.data?.groups??[]).filter(e=>e.candidates.length>0),[o.data]),f=i(()=>d.reduce((e,t)=>e+t.candidates.length,0),[d]);return r(a,{children:[s(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:r(`button`,{onClick:u,disabled:o.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[s(b,{className:`h-3.5 w-3.5 ${o.isPending?`animate-spin`:``}`}),`Re-scan`]})}),r(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[o.isPending&&s(ee,{label:`Scanning the local network…`}),!o.isPending&&o.isError&&s($,{}),!o.isPending&&o.data&&d.length===0&&s(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!o.isPending&&d.length>0&&r(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,f,` device`,f===1?``:`s`,` on the network.`]}),!o.isPending&&d.map(e=>r(`div`,{className:`space-y-1.5`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.label}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,e.candidates.length,`)`]})]}),e.candidates.map(n=>t(e.addonId,n))]},e.addonId))]})]})}function Q({scope:t,onAdopt:n,onReset:i}){let c=u({addonId:t.addonId}).data??null,[l,d]=o({}),f=p(),m=e(()=>{i(),f.mutate({addonId:t.addonId,params:l})},[f,t.addonId,l,i]),h=f.data?.candidates??[];return s(a,{children:r(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[c&&s(y,{schema:c,values:l,onChange:d}),r(`button`,{onClick:m,disabled:f.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[f.isPending?s(x,{className:`h-3.5 w-3.5 animate-spin`}):s(A,{className:`h-3.5 w-3.5`}),f.isPending?`Scanning…`:`Scan`]}),f.isError&&s($,{}),!f.isPending&&f.data&&h.length===0&&s(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!f.isPending&&h.length>0&&r(`div`,{className:`space-y-1.5`,children:[r(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,h.length,` device`,h.length===1?``:`s`,`.`]}),h.map(e=>n(t.addonId,e))]})]})})}function ee({label:e}){return r(`div`,{className:`flex flex-col items-center py-12`,children:[s(x,{className:`h-6 w-6 animate-spin text-primary`}),s(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function $(){return r(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[s(E,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),s(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{A as i,Y as n,K as r,X as t};
|
|
1
|
+
import{I as e,K as t,Q as n,S as r,W as i,b as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Ar as l,Br as u,Or as d,Si as f,Wr as p,cr as m,ir as h,lr as g,vr as _}from"./src-CLcW_gk2.js";import{t as v}from"./download-D0TL4kvK.js";import{t as y}from"./FormBuilder-BDA9-uL2.js";import{t as b}from"./refresh-cw-7BWEDRql.js";import{C as x,K as S,L as C,i as w,j as T,o as E,t as D,z as O}from"./index-BVmc_EOb.js";import{t as k}from"./BrokerForm-B45_C-11.js";var A=S(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]);n();var j=[`amazon.com`,`amazon.it`,`amazon.de`,`amazon.co.uk`,`amazon.fr`,`amazon.es`,`amazon.ca`,`amazon.com.au`,`amazon.co.jp`,`amazon.in`,`amazon.com.br`,`amazon.com.mx`],M=`/addon/import-alexa`,N=2e3;function P(e){return typeof e==`object`&&!!e&&typeof e.sessionId==`string`&&typeof e.loginUrl==`string`}function F(e){return typeof e==`object`&&!!e&&typeof e.phase==`string`&&typeof e.sessionId==`string`}function I(e){return typeof e==`object`&&!!e&&typeof e.brokerId==`string`}function L(e){return{"Content-Type":`application/json`,Authorization:`Bearer ${localStorage.getItem(`camstack_admin_token`)??``}`,...e}}async function R(e,t,n){let r=await fetch(`${M}${e}`,{method:`POST`,headers:L(),body:JSON.stringify(t)}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!n(i))throw Error(`Unexpected response from server`);return i}async function z(e){let t=new URLSearchParams({sessionId:e}),n=localStorage.getItem(`camstack_admin_token`)??``,r=await fetch(`${M}/login/status?${t.toString()}`,{headers:{Authorization:`Bearer ${n}`}}),i=await r.json();if(!r.ok){let e=typeof i==`object`&&i?i.error??`Unknown error`:`Unknown error`;throw Error(String(e))}if(!F(i))throw Error(`Unexpected status response from server`);return i}async function B(e){try{await fetch(`${M}/login/cancel`,{method:`POST`,headers:L(),body:JSON.stringify({sessionId:e})})}catch{}}function V({brokerId:n,onResolved:i,onCancel:a}){let[l,u]=o(`amazon.it`),[d,f]=o(`Alexa account`),[p,m]=o({kind:`idle`}),h=t(!0);c(()=>(h.current=!0,()=>{h.current=!1}),[]);let g=t(null),_=t(null),v=e(()=>{_.current!==null&&(clearInterval(_.current),_.current=null)},[]),y=e(async e=>{v(),h.current&&m({kind:`committing`,sessionId:e});try{let t=await R(`/login/commit`,{sessionId:e,name:d.trim().length>0?d.trim():`Alexa account`,...n===void 0?{}:{brokerId:n}},I);g.current=null,i(t.brokerId)}catch(t){let n=t instanceof Error?t.message:String(t);h.current&&m({kind:`error`,message:n,sessionId:e})}},[n,d,i,v]),S=e((e,t)=>{v();let n=async()=>{try{let n=await z(e);if(n.phase===`captured`){v(),y(e);return}if(n.phase===`error`){v(),h.current&&m({kind:`error`,message:n.error??`Login proxy returned an error`,sessionId:e});return}if(n.phase===`cancelled`){v(),h.current&&m({kind:`idle`});return}h.current&&m({kind:`polling`,sessionId:e,loginUrl:n.loginUrl||t,phase:n.phase})}catch(e){let t=e instanceof Error?e.message:String(e);h.current&&m(e=>e.kind===`polling`?{...e}:{kind:`error`,message:t,sessionId:null})}};_.current=setInterval(()=>{n()},N)},[v,y]);c(()=>()=>{v(),g.current!==null&&B(g.current)},[v]);let C=async()=>{v(),g.current!==null&&(B(g.current),g.current=null),m({kind:`starting`});try{let e=await R(`/login/start`,{amazonDomain:l},P);g.current=e.sessionId,m({kind:`polling`,sessionId:e.sessionId,loginUrl:e.loginUrl,phase:`starting`}),S(e.sessionId,e.loginUrl)}catch(e){m({kind:`error`,message:e instanceof Error?e.message:String(e),sessionId:null})}},w=()=>{v(),g.current!==null&&(B(g.current),g.current=null),m({kind:`idle`})},D=()=>{w()},O=p.kind===`idle`,k=p.kind===`starting`,A=p.kind===`polling`,M=p.kind===`committing`,F=p.kind===`error`,L=k||A||M,V=p.kind===`polling`?p.phase:null,H=p.kind===`polling`?p.loginUrl:null,U=A&&V===`awaiting-login`,W=A&&(V===`starting`||V===null);return r(`div`,{className:`space-y-4`,children:[(O||F)&&r(`div`,{className:`space-y-3`,children:[n===void 0&&r(`div`,{className:`space-y-1`,children:[s(`label`,{htmlFor:`alexa-account-name`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Account name`}),s(`input`,{id:`alexa-account-name`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`Alexa account`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),r(`div`,{className:`space-y-1`,children:[s(`label`,{htmlFor:`alexa-amazon-region`,className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Amazon region`}),s(`select`,{id:`alexa-amazon-region`,value:l,onChange:e=>u(e.target.value),className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`,children:j.map(e=>s(`option`,{value:e,children:e},e))})]})]}),F&&r(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px] flex items-start gap-2`,children:[s(E,{className:`h-3.5 w-3.5 mt-0.5 flex-shrink-0`}),s(`span`,{children:p.message})]}),k&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Starting login proxy…`]}),W&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Waiting for proxy to be ready…`]}),M&&r(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-surface px-3 py-3 text-xs text-foreground-subtle`,children:[s(x,{className:`h-4 w-4 animate-spin flex-shrink-0`}),`Saving credentials…`]}),U&&H!==null&&r(`div`,{className:`space-y-3`,children:[r(`div`,{className:`rounded-lg border border-border bg-surface p-3 space-y-2`,children:[s(`p`,{className:`text-xs font-semibold text-foreground`,children:`Open the link below to log in to your Amazon account`}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`After completing the login and any 2FA steps, this wizard will continue automatically.`}),r(`a`,{href:H,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90`,children:[s(T,{className:`h-3.5 w-3.5`}),`Login to Amazon`]})]}),r(`div`,{className:`rounded border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[10px] text-amber-700 dark:text-amber-300`,children:[s(`strong`,{children:`Note:`}),` The login proxy runs directly on the hub. If the link does not open or the page does not load, make sure the hub's proxy host and port are reachable from your browser. You can configure `,s(`code`,{className:`font-mono`,children:`proxyHost`}),` in the Alexa addon settings and ensure the proxy port is published (Docker port mapping).`]}),r(`div`,{className:`flex items-center gap-2 text-[10px] text-foreground-subtle`,children:[s(x,{className:`h-3 w-3 animate-spin`}),`Waiting for Amazon login to complete…`]})]}),r(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[s(`button`,{type:`button`,onClick:L?w:a,className:`rounded px-3 py-1.5 text-xs text-foreground-subtle border border-border hover:text-foreground`,children:L?`Cancel login`:`Back`}),r(`div`,{className:`flex items-center gap-2`,children:[F&&r(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1.5 rounded border border-border px-3 py-1.5 text-xs text-foreground hover:bg-primary/10`,children:[s(b,{className:`h-3.5 w-3.5`}),`Retry`]}),O&&s(`button`,{type:`button`,onClick:()=>{C()},disabled:n===void 0&&d.trim().length===0,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Start login`})]})]})]})}n();var H=`alexa`;function U(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`):[]}function W(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.addonId==`string`&&Array.isArray(e.kinds)):[]}var G={connected:`bg-emerald-500/15 text-emerald-700 dark:text-emerald-300`,connecting:`bg-amber-500/15 text-amber-700 dark:text-amber-300`,disconnected:`bg-foreground-subtle/15 text-foreground-subtle`,"auth-failed":`bg-danger/15 text-danger`,unreachable:`bg-danger/15 text-danger`,error:`bg-danger/15 text-danger`};function K({kind:e,onResolved:t,onBack:n}){let[a,c]=o(e===H?`alexa-login`:`existing`),l=m({kind:e}),u=i(()=>U(l.data).filter(t=>t.kind===e),[l.data,e]),d=g(),f=i(()=>{for(let t of W(d.data))if(t.kinds.some(t=>t.kind===e))return t.addonId},[d.data,e]),[p,_]=o(null),[v,y]=o(``),b=h({}),S=()=>{p&&t(p)},w=async n=>{v.trim().length!==0&&t((await b.mutateAsync({kind:e,name:v.trim(),settings:n,...f===void 0?{}:{addonId:f}})).id)},T=e=>{e===`new`?_(null):b.reset(),c(e)};return r(`div`,{className:`space-y-4`,children:[r(`button`,{type:`button`,onClick:n,className:`inline-flex items-center gap-1 text-[11px] text-foreground-subtle hover:text-foreground`,children:[s(C,{className:`h-3.5 w-3.5`}),` Back`]}),r(`div`,{className:`inline-flex rounded-lg border border-border p-0.5 flex-wrap gap-0.5`,children:[e===H&&s(`button`,{type:`button`,onClick:()=>T(`alexa-login`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`alexa-login`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Login interactively`}),s(`button`,{type:`button`,onClick:()=>T(`existing`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`existing`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:`Use existing`}),s(`button`,{type:`button`,onClick:()=>T(`new`),className:`rounded-md px-3 py-1 text-xs font-medium transition-colors ${a===`new`?`bg-primary text-primary-foreground`:`text-foreground-subtle hover:text-foreground`}`,children:e===H?`Paste cookie`:`Create new`})]}),a===`alexa-login`&&s(V,{onResolved:t,onCancel:n}),a===`existing`&&r(`div`,{className:`space-y-3`,children:[l.isLoading&&r(`div`,{className:`flex items-center gap-2 text-xs text-foreground-subtle`,children:[s(x,{className:`h-3.5 w-3.5 animate-spin`}),` Loading brokers…`]}),l.isError&&r(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:[`Failed to load brokers:`,` `,l.error instanceof Error?l.error.message:`Unknown error`]}),!l.isLoading&&!l.isError&&u.length===0&&r(`div`,{className:`rounded-lg border border-border bg-surface px-3 py-6 text-center text-xs text-foreground-subtle`,children:[`No brokers of this kind yet. Switch to`,` `,s(`span`,{className:`font-medium text-foreground`,children:e===H?`Login interactively`:`Create new`}),` `,`to register one.`]}),s(`div`,{className:`space-y-2`,children:u.map(e=>r(`button`,{type:`button`,onClick:()=>_(e.id),className:`flex w-full items-center justify-between gap-3 rounded-lg border bg-surface p-3 text-left transition-colors ${p===e.id?`border-primary ring-1 ring-primary`:`border-border hover:border-foreground-subtle/30`}`,children:[s(`span`,{className:`text-xs font-semibold text-foreground`,children:e.name}),s(`span`,{className:`text-[10px] rounded-full px-2 py-0.5 font-medium ${G[e.status]}`,children:e.status})]},e.id))}),u.length>0&&s(`div`,{className:`flex justify-end pt-1`,children:s(`button`,{type:`button`,onClick:S,disabled:!p,className:`inline-flex items-center gap-1.5 rounded bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50`,children:`Use this broker`})})]}),a===`new`&&r(`div`,{className:`space-y-3`,children:[r(`div`,{className:`space-y-1`,children:[s(`label`,{className:`text-[10px] uppercase tracking-wide text-foreground-subtle`,children:`Name`}),s(`input`,{type:`text`,value:v,onChange:e=>y(e.target.value),placeholder:`My Home Assistant`,className:`w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]}),b.isError&&s(`div`,{className:`rounded border border-danger/30 bg-danger/5 text-danger px-3 py-2 text-[11px]`,children:b.error instanceof Error?b.error.message:String(b.error)}),s(k,{kind:e,...f===void 0?{}:{addonId:f},onSubmit:e=>{w(e).catch(()=>{})},onCancel:n,submitLabel:b.isPending?`Creating…`:`Create broker`,disabled:b.isPending||v.trim().length===0}),v.trim().length===0&&s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`Enter a name before creating.`})]})]})}n();function q(e){return{status:e.status===`validated`||e.status===`rejected`||e.status===`inconclusive`||e.status===`unsupported`?e.status:e.success?`validated`:`rejected`,...e.error===void 0?{}:{error:e.error},...e.detail===void 0?{}:{detail:e.detail}}}var J={validated:`border-success/30 bg-success/5 text-success`,rejected:`border-danger/30 bg-danger/5 text-danger`,inconclusive:`border-warning/30 bg-warning/5 text-warning`,unsupported:`border-border bg-surface text-foreground-subtle`};function Y({addonId:e,configSchema:t,canTest:n=!0,initialName:i,initialConfig:a,submitLabel:c,hideName:l=!1,onSave:u,onBack:d}){let{t:p}=D(),[m,h]=o(i??``),[g,_]=o(a??{}),[v,b]=o(null),x=f({onSuccess:e=>b(q(e)),onError:e=>b({status:`inconclusive`,error:String(e)})});return r(`div`,{className:`space-y-4`,children:[!l&&r(`div`,{children:[s(`label`,{className:`block text-[11px] font-medium text-foreground mb-1`,children:p(`integrations.integrationName`)}),s(`input`,{type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:p(`integrations.integrationNamePlaceholder`),className:`w-full rounded-lg border border-border bg-surface px-3 py-2 text-xs text-foreground placeholder:text-foreground-subtle focus:outline-none focus:border-primary/50`})]}),t&&s(y,{schema:t,values:g,onChange:_}),v&&s(`div`,{className:`rounded-lg border px-3 py-2 text-xs ${J[v.status]}`,children:(e=>{switch(e.status){case`validated`:return e.detail?`${p(`integrations.connectionSuccess`)} — ${e.detail}`:p(`integrations.connectionSuccess`);case`rejected`:return`${p(`integrations.errorPrefix`)} ${e.error??``}`;case`inconclusive`:return`${p(`integrations.connectionInconclusive`,{defaultValue:`Could not be checked:`})} ${e.error??``}`;case`unsupported`:return e.error??p(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`})}})(v)}),r(`div`,{className:`flex items-center justify-between pt-2`,children:[s(`button`,{onClick:d,className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground-subtle hover:text-foreground transition-colors`,children:p(`integrations.back`)}),r(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{onClick:()=>x.mutate({addonId:e,settings:g}),disabled:x.isPending||!n,title:n?void 0:p(`integrations.connectionUntestable`,{defaultValue:`This integration cannot be tested before it is created.`}),className:`rounded-lg border border-border px-3 py-1.5 text-xs text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50 disabled:cursor-not-allowed`,children:x.isPending?p(`integrations.testing`):p(`integrations.testConnection`)}),s(`button`,{onClick:()=>u({name:m,config:g}),disabled:l?!1:!m.trim(),className:`rounded-lg bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground shadow-sm disabled:opacity-50`,children:c??p(`integrations.forward`)})]})]})]})}n();function X({open:t,onClose:n,scope:a}){let c=_(),[l,d]=o(new Set),[f,p]=o(new Set),{data:m}=u({}),h=i(()=>new Set((m??[]).map(e=>e.stableId)),[m]),g=e(async(e,t)=>{p(e=>new Set(e).add(t.stableId));try{await c.mutateAsync({addonId:e,candidate:t}),d(e=>new Set(e).add(t.stableId))}catch{}finally{p(e=>{let n=new Set(e);return n.delete(t.stableId),n})}},[c]),y=e((e,t)=>{let n=typeof t.prefilledConfig.host==`string`?t.prefilledConfig.host:null,i=h.has(t.stableId),a=l.has(t.stableId)||i,o=f.has(t.stableId);return r(`div`,{className:`flex items-center justify-between rounded-lg border border-border bg-surface px-3 py-2`,children:[r(`div`,{className:`min-w-0`,children:[s(`p`,{className:`truncate text-xs font-medium text-foreground`,children:t.suggestedName}),n&&s(`p`,{className:`truncate text-[10px] font-mono text-foreground-subtle`,children:n})]}),a?r(`span`,{className:`flex items-center gap-1 text-[11px] text-foreground-subtle`,children:[s(O,{className:`h-3.5 w-3.5`}),` `,i?`Already added`:`Added`]}):r(`button`,{type:`button`,onClick:()=>void g(e,t),disabled:o,className:`flex items-center gap-1 rounded-md bg-primary px-2.5 py-1 text-[11px] font-medium text-primary-foreground disabled:opacity-50`,children:[o?s(x,{className:`h-3.5 w-3.5 animate-spin`}):s(v,{className:`h-3.5 w-3.5`}),`Add`]})]},t.stableId)},[l,f,h,g]);if(!t)return null;let b=a?`Scan network — ${a.label}`:`Scan network for devices`;return r(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,children:[s(`div`,{className:`absolute inset-0 bg-black/60`,onClick:n}),r(`div`,{className:`relative z-10 flex w-full max-w-2xl flex-col max-h-[calc(90dvh-2*max(env(safe-area-inset-top),env(safe-area-inset-bottom)))] rounded-xl border border-border bg-background shadow-2xl`,children:[r(`div`,{className:`flex items-center justify-between border-b border-border px-5 py-4 shrink-0`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(A,{className:`h-4 w-4 text-primary`}),s(`h2`,{className:`text-sm font-semibold text-foreground`,children:b})]}),s(`button`,{onClick:n,className:`rounded-md p-1 text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors`,children:s(w,{className:`h-4 w-4`})})]}),a?s(Q,{scope:a,onAdopt:y,onReset:()=>d(new Set)}):s(Z,{onAdopt:y,onReset:()=>d(new Set)})]})]})}function Z({onAdopt:t,onReset:n}){let o=d(),l=e(()=>{n(),o.mutate({})},[o,n]);c(()=>{!o.isPending&&!o.data&&l()},[]);let u=i(()=>(o.data?.groups??[]).filter(e=>e.candidates.length>0),[o.data]),f=i(()=>u.reduce((e,t)=>e+t.candidates.length,0),[u]);return r(a,{children:[s(`div`,{className:`flex items-center justify-end gap-2 border-b border-border px-5 py-2 shrink-0`,children:r(`button`,{onClick:l,disabled:o.isPending,className:`flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors disabled:opacity-50`,children:[s(b,{className:`h-3.5 w-3.5 ${o.isPending?`animate-spin`:``}`}),`Re-scan`]})}),r(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[o.isPending&&s(ee,{label:`Scanning the local network…`}),!o.isPending&&o.isError&&s($,{}),!o.isPending&&o.data&&u.length===0&&s(`p`,{className:`py-8 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!o.isPending&&u.length>0&&r(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,f,` device`,f===1?``:`s`,` on the network.`]}),!o.isPending&&u.map(e=>r(`div`,{className:`space-y-1.5`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(`span`,{className:`text-[11px] font-semibold text-foreground`,children:e.label}),r(`span`,{className:`text-[10px] text-foreground-subtle`,children:[`(`,e.candidates.length,`)`]})]}),e.candidates.map(n=>t(e.addonId,n))]},e.addonId))]})]})}function Q({scope:t,onAdopt:n,onReset:i}){let c=p({addonId:t.addonId}).data??null,[u,d]=o({}),f=l(),m=e(()=>{i(),f.mutate({addonId:t.addonId,params:u})},[f,t.addonId,u,i]),h=f.data?.candidates??[];return s(a,{children:r(`div`,{className:`flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4`,children:[c&&s(y,{schema:c,values:u,onChange:d}),r(`button`,{onClick:m,disabled:f.isPending,className:`flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground disabled:opacity-50`,children:[f.isPending?s(x,{className:`h-3.5 w-3.5 animate-spin`}):s(A,{className:`h-3.5 w-3.5`}),f.isPending?`Scanning…`:`Scan`]}),f.isError&&s($,{}),!f.isPending&&f.data&&h.length===0&&s(`p`,{className:`py-6 text-center text-xs text-foreground-subtle`,children:`No devices responded to the scan.`}),!f.isPending&&h.length>0&&r(`div`,{className:`space-y-1.5`,children:[r(`p`,{className:`text-xs text-foreground-subtle`,children:[`Found `,h.length,` device`,h.length===1?``:`s`,`.`]}),h.map(e=>n(t.addonId,e))]})]})})}function ee({label:e}){return r(`div`,{className:`flex flex-col items-center py-12`,children:[s(x,{className:`h-6 w-6 animate-spin text-primary`}),s(`p`,{className:`mt-3 text-xs text-foreground-subtle`,children:e})]})}function $(){return r(`div`,{className:`flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3`,children:[s(E,{className:`h-4 w-4 text-destructive mt-0.5 shrink-0`}),s(`p`,{className:`text-xs text-destructive`,children:`The scan failed. Try again.`})]})}export{A as i,Y as n,K as r,X as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as e,K as t,Q as n,S as r,W as i,b as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{$ as l,B as u,H as d,I as f,K as p,L as m,R as h,U as g,V as _,W as v,Z as y,ct as b,j as x,o as S,rt as C,st as w,tt as ee}from"./player-overlays-UTlrOH4s.js";import{MaskShapeCanvas as te}from"./MaskShapeCanvas-Dcpby34M.js";var ne=b(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);n();var T=`/addon/pipeline-analytics/event-media`;function E(e){let t=new Map;for(let n of e.states)n.references.forEach((e,r)=>{let i=t.get(e.condition)??[];i.push({stateId:n.id,index:r,reference:e}),t.set(e.condition,i)});return[...t.entries()].map(([e,t])=>({condition:e,tiles:[...t].sort((e,t)=>t.reference.capturedAt-e.reference.capturedAt)})).sort((e,t)=>e.condition.localeCompare(t.condition))}function D(e){return e.states.reduce((e,t)=>e+t.references.length,0)}var O=`rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`;function k({monitor:e,disabled:t,onDelete:n}){let i=E(e),a=D(e),[c,u]=o(null);return i.length===0?s(`p`,{className:`${x} leading-relaxed`,children:`No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.`}):s(`div`,{className:`flex flex-col gap-2`,children:i.map(e=>r(`div`,{className:`flex flex-col gap-1`,children:[r(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:[d(e.condition),` · `,e.tiles.length]}),s(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.tiles.map(i=>{let o=`${i.stateId}:${String(i.index)}`,f=a===1,p=c===o;return r(`li`,{className:`flex w-24 flex-col gap-1 rounded-md border border-border p-1`,children:[s(A,{reference:i.reference}),s(`span`,{className:`${x} tabular-nums`,children:j(i.reference.capturedAt)}),r(`button`,{type:`button`,className:O,disabled:t,"aria-label":`Delete the ${d(e.condition).toLowerCase()} photograph from ${j(i.reference.capturedAt)}`,onClick:()=>{if(f&&!p){u(o);return}u(null),n({stateId:i.stateId,index:i.index})},children:[s(l,{className:`mr-1 inline h-3 w-3`}),p?`Confirm`:`Delete`]}),p&&s(`p`,{className:`text-[10px] leading-snug text-warning`,children:`This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again.`})]},o)})})]},e.condition))})}function A({reference:e}){let[t,n]=o(!1),i=e.thumbnailMediaId;return i===void 0||t?r(`div`,{className:`flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle`,title:`The picture for this reference is no longer stored. The reference itself is intact and still being scored against.`,children:[s(C,{className:`h-4 w-4`}),s(`span`,{className:`text-[9px]`,children:`no picture`})]}):s(`img`,{src:`${T}/${encodeURIComponent(i)}`,alt:``,loading:`lazy`,className:`h-16 w-full rounded object-cover`,onError:()=>n(!0)})}function j(e){let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`}n();var M=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,N=`text-[10px] font-medium text-foreground-subtle`,P=`flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2`,F=`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,I=5,L=3600,R={periodic:`Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.`,"on-motion":`Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.`,both:`Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.`},z={skip:`Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.`,"judge-anyway":`Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen.`};function B(e){return{label:e.label,checkIntervalSec:e.checkIntervalSec??60,threshold:e.check.mode===`similarity`?e.check.threshold:.8,hysteresisCount:e.check.hysteresisCount,quietSeconds:e.quietSeconds,minObservationSpacingSec:e.minObservationSpacingSec,confirmPrompt:e.confirm?.prompt??``}}function V({monitor:e,disabled:t,onPatch:n}){let[i,l]=o(()=>B(e)),[u,d]=o(!1);c(()=>{u||l(B(e))},[e,u]);let f=e=>{d(!1),n(e)},p=t=>e.check.mode===`similarity`?{mode:`similarity`,threshold:t.threshold??e.check.threshold,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount}:{...e.check,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount},m=e.confirm?.enabled===!0,h=e.check.mode===`similarity`?e.check.threshold:null;return r(`div`,{className:`flex flex-col gap-2`,children:[r(`div`,{className:P,children:[s(`p`,{className:F,children:`What it watches`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Name`}),s(`input`,{type:`text`,value:i.label,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,label:e.target.value})),onBlur:()=>{let t=i.label.trim();t.length>0&&t!==e.label?f({label:t}):d(!1)}})]}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.enabled,disabled:t,onChange:e=>f({enabled:e.target.checked})}),s(`span`,{className:N,children:`Watching`})]}),s(`p`,{className:x,children:`Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When to look`}),r(`select`,{value:e.triggerMode,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`periodic`||t===`on-motion`||t===`both`)&&f({triggerMode:t})},children:[s(`option`,{value:`both`,children:`On the clock and after motion settles`}),s(`option`,{value:`periodic`,children:`On the clock only`}),s(`option`,{value:`on-motion`,children:`After motion settles only`})]})]}),s(`p`,{className:x,children:R[e.triggerMode]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Check every (seconds)`}),s(`input`,{type:`number`,min:I,max:L,value:i.checkIntervalSec,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,checkIntervalSec:Number(e.target.value)||0})),onBlur:()=>{let t=H(i.checkIntervalSec,I,L);t===e.checkIntervalSec?d(!1):f({checkIntervalSec:t})}})]}),s(`p`,{className:x,children:`60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`How sure it has to be`}),e.check.mode===`similarity`&&r(a,{children:[r(`label`,{className:`flex flex-col gap-1`,children:[r(`span`,{className:N,children:[`Match threshold — `,s(`span`,{className:`tabular-nums`,children:i.threshold.toFixed(2)})]}),s(`input`,{type:`range`,min:.3,max:.99,step:.01,value:i.threshold,disabled:t,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,threshold:Number(e.target.value)})),onMouseUp:()=>{i.threshold===h?d(!1):f({check:p({threshold:i.threshold})})},onBlur:()=>{i.threshold===h?d(!1):f({check:p({threshold:i.threshold})})}})]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it.`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Agreeing checks before it changes its mind`}),s(`input`,{type:`number`,min:1,max:10,value:i.hysteresisCount,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,hysteresisCount:Number(e.target.value)||1})),onBlur:()=>{let t=H(i.hysteresisCount,1,10);t===e.check.hysteresisCount?d(!1):f({check:p({hysteresisCount:t})})}})]}),s(`p`,{className:x,children:`One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Quiet for (seconds) before a check counts`}),s(`input`,{type:`number`,min:0,max:3600,value:i.quietSeconds,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,quietSeconds:Number(e.target.value)||0})),onBlur:()=>{let t=H(i.quietSeconds,0,3600);t===e.quietSeconds?d(!1):f({quietSeconds:t})}})]}),s(`p`,{className:x,children:`A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Minimum gap between counted checks (seconds)`}),s(`input`,{type:`number`,min:0,max:3600,value:i.minObservationSpacingSec,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,minObservationSpacingSec:Number(e.target.value)||0})),onBlur:()=>{let t=H(i.minObservationSpacingSec,0,3600);t===e.minObservationSpacingSec?d(!1):f({minObservationSpacingSec:t})}})]}),s(`p`,{className:x,children:`Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`Lighting`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When a light has no reference of its own`}),r(`select`,{value:e.onUncoveredCondition,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`skip`||t===`judge-anyway`)&&f({onUncoveredCondition:t})},children:[s(`option`,{value:`skip`,children:`Skip the check (recommended)`}),s(`option`,{value:`judge-anyway`,children:`Judge against the other light anyway`})]})]}),s(`p`,{className:x,children:z[e.onUncoveredCondition]})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`What you get told`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Notifications follow`}),r(`select`,{value:e.emit,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`latched`||t===`live`)&&f({emit:t})},children:[s(`option`,{value:`latched`,children:`The flag — told once, still visible at breakfast`}),s(`option`,{value:`live`,children:`The live state — follows the region as it changes`})]})]}),s(`p`,{className:x,children:`“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state.`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.autoRestore,disabled:t,onChange:e=>f({autoRestore:e.target.checked})}),s(`span`,{className:N,children:`Clear the flag by itself when things look normal again`})]}),s(`p`,{className:x,children:`Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`AI double-check`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:m,disabled:t||i.confirmPrompt.trim().length===0,onChange:e=>f(e.target.checked?{confirm:{...U(i.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),s(`span`,{className:N,children:`Ask a vision model before changing the answer`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`The question to ask`}),s(`input`,{type:`text`,value:i.confirmPrompt,placeholder:`e.g. Is the wheelie bin still there?`,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,confirmPrompt:e.target.value})),onBlur:()=>{let t=i.confirmPrompt.trim();t.length>0&&t!==e.confirm?.prompt?f({confirm:{...U(t),enabled:m}}):d(!1)}})]}),r(`p`,{className:x,children:[`The model is asked `,s(`strong`,{children:`only`}),` when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced.`]})]})]})}function H(e,t,n){return Math.min(n,Math.max(t,e))}function U(e){return{enabled:!1,prompt:e,timeoutMs:8e3,maxImagePx:448,onTimeout:`hold`}}n();var W=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,G=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`,K=`rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`,q={alarm:`border-danger/50 bg-danger/15 text-danger`,ok:`border-success/50 bg-success/15 text-success`,unknown:`border-border bg-surface text-foreground-subtle`},re=.8,ie=3;function J({deviceId:n}){let b=v(y().trpcClient,n),C=p(b?.state.sceneMonitor),T=S(n,{width:640}),[E,D]=o(null),[O,A]=o(!1),[j,M]=o(null),[N,P]=o(null),[F,I]=o(null),[L,R]=o(null),[z,B]=o(!1),[H,U]=o(null),[J,Y]=o(``),X=t(!0);c(()=>(X.current=!0,()=>{X.current=!1}),[]);let Z=e(async()=>{if(b)try{let e=await b.sceneMonitor?.listScenes({});if(!X.current)return;e&&D(e)}catch(e){if(!X.current)return;g(e)?A(!0):P(e instanceof Error?e.message:String(e))}},[b]);c(()=>{D(null),A(!1),P(null),Z()},[Z]);let Q=C?.monitors??E?.monitors??[],ae=Date.now(),$=e(async(e,t)=>{M(e),P(null);try{await t(),await Z()}catch(e){X.current&&P(e instanceof Error?e.message:String(e))}finally{X.current&&M(null)}},[Z]),oe=i(()=>{let e=Q.map(e=>({id:e.id,shape:e.roi,label:e.label,enabled:e.enabled}));return H===null?e:[...e,{id:`__draft__`,shape:H,label:`New scene`}]},[Q,H]),se=e((e,t)=>{if(t.kind===`rect`){if(e===`__draft__`){U(t);return}$(`roi-${String(e)}`,async()=>b?.sceneMonitor?.updateScene({monitorId:String(e),patch:{roi:t}}))}},[b,$]),ce=e(e=>{e.kind===`rect`&&U(e)},[]),le=e(async()=>{H===null||J.trim().length===0||(await $(`create`,async()=>{await b?.sceneMonitor?.createScene({label:J.trim(),roi:H,check:{mode:`similarity`,threshold:re,hysteresisCount:ie}})}),U(null),Y(``),B(!1))},[b,H,J,$]);return b?s(`div`,{className:`flex flex-col gap-3`,children:O?s(`p`,{className:`${x} leading-relaxed`,children:`Scene monitoring is not available for this camera.`}):r(a,{children:[s(`p`,{className:`${x} leading-relaxed`,children:`A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem.`}),s(`div`,{className:`relative overflow-hidden rounded-md border border-border`,children:s(te,{items:oe,supportedShapes:[`rect`],selectedId:F??(H===null?null:`__draft__`),onSelect:e=>I(e===null?null:String(e)),onShapeChange:se,onDrawComplete:ce,drawingKind:z&&H===null?`rect`:null,backdrop:T.src===null?null:s(`img`,{src:T.src,alt:``,className:`h-full w-full object-contain`,draggable:!1})})}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s(`button`,{type:`button`,className:z?G:W,"aria-pressed":z,onClick:()=>{B(e=>!e),U(null)},disabled:j!==null,children:z?`Cancel`:`+ New scene`}),s(`button`,{type:`button`,className:W,onClick:T.refresh,disabled:j!==null,children:`Refresh frame`})]}),z&&r(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface p-2`,children:[s(`p`,{className:`text-[10px] text-foreground-subtle`,children:H===null?`Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.`:`Name it, then create. You capture what “normal” looks like next.`}),H!==null&&u(H)&&s(`p`,{className:`text-[11px] leading-relaxed text-warning`,children:`That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter.`}),r(`div`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`text`,value:J,onChange:e=>Y(e.target.value),placeholder:`e.g. Immondizia prelevata`,className:`flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground`}),s(`button`,{type:`button`,className:G,onClick:()=>void le(),disabled:H===null||J.trim().length===0||j!==null,children:`Create`})]})]}),N!==null&&s(`p`,{className:`text-[11px] leading-relaxed text-danger`,children:N}),Q.length===0?s(`p`,{className:`${x} leading-relaxed`,children:`No scenes on this camera yet.`}):s(`ul`,{className:`flex flex-col gap-2`,children:Q.map(e=>{let t=m(e);return r(`li`,{className:`flex flex-col gap-1.5 rounded-md border p-2 ${F===e.id?`border-primary/50`:`border-border`}`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{type:`button`,className:`flex-1 text-left text-[12px] font-medium text-foreground`,onClick:()=>I(e.id),children:e.label}),s(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${q[t.tone]}`,children:t.text})]}),s(`p`,{className:`${x} leading-relaxed`,children:_(e,ae)}),s(`p`,{className:`${x} tabular-nums`,children:h(e)}),s(k,{monitor:e,disabled:j!==null,onDelete:({stateId:t,index:n})=>void $(`refdel-${e.id}-${t}-${String(n)}`,async()=>b.sceneMonitor?.deleteReference({monitorId:e.id,stateId:t,index:n}))}),r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[f.map(t=>{let n=t===`ir`;return r(`button`,{type:`button`,className:W,disabled:j!==null,title:n?`Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.`:`Take a fresh photo now and store it as the ${d(t).toLowerCase()} reference`,onClick:()=>void $(`cap-${e.id}-${t}`,async()=>b.sceneMonitor?.captureReference({monitorId:e.id,condition:t})),children:[s(w,{className:`mr-1 inline h-3 w-3`}),`Capture `,d(t).toLowerCase(),n&&s(`span`,{className:`ml-1 text-foreground-subtle/70`,children:`(optional)`})]},t)}),r(`button`,{type:`button`,className:G,disabled:j!==null||e.states.length===0,title:`Clear the flag and re-photograph what normal looks like right now`,onClick:()=>void $(`reset-${e.id}`,async()=>b.sceneMonitor?.resetScene({monitorId:e.id})),children:[s(ee,{className:`mr-1 inline h-3 w-3`}),`Reset`]}),s(`button`,{type:`button`,className:W,disabled:j!==null,onClick:()=>void $(`check-${e.id}`,async()=>b.sceneMonitor?.recheckNow({monitorId:e.id})),children:`Check now`}),r(`button`,{type:`button`,className:L===e.id?G:W,"aria-pressed":L===e.id,"aria-label":`Settings for ${e.label}`,disabled:j!==null,onClick:()=>R(t=>t===e.id?null:e.id),children:[s(ne,{className:`mr-1 inline h-3 w-3`}),`Settings`]}),s(`button`,{type:`button`,className:K,disabled:j!==null,onClick:()=>void $(`del-${e.id}`,async()=>b.sceneMonitor?.deleteScene({monitorId:e.id})),children:s(l,{className:`h-3 w-3`})})]}),L===e.id&&s(V,{monitor:e,disabled:j!==null,onPatch:t=>void $(`tune-${e.id}`,async()=>b.sceneMonitor?.updateScene({monitorId:e.id,patch:t}))})]},e.id)})})]})}):null}export{J as SceneMonitorEditor};
|
|
1
|
+
import{I as e,K as t,Q as n,S as r,W as i,b as a,q as o,x as s,z as c}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{$ as l,B as u,H as d,I as f,K as p,L as m,R as h,U as g,V as _,W as v,Z as y,ct as b,j as x,o as S,rt as C,st as w,tt as ee}from"./player-overlays-Cce7zLVf.js";import{MaskShapeCanvas as te}from"./MaskShapeCanvas-Dcpby34M.js";var ne=b(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);n();var T=`/addon/pipeline-analytics/event-media`;function E(e){let t=new Map;for(let n of e.states)n.references.forEach((e,r)=>{let i=t.get(e.condition)??[];i.push({stateId:n.id,index:r,reference:e}),t.set(e.condition,i)});return[...t.entries()].map(([e,t])=>({condition:e,tiles:[...t].sort((e,t)=>t.reference.capturedAt-e.reference.capturedAt)})).sort((e,t)=>e.condition.localeCompare(t.condition))}function D(e){return e.states.reduce((e,t)=>e+t.references.length,0)}var O=`rounded border border-danger/50 bg-danger/10 px-1 py-0.5 text-[10px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`;function k({monitor:e,disabled:t,onDelete:n}){let i=E(e),a=D(e),[c,u]=o(null);return i.length===0?s(`p`,{className:`${x} leading-relaxed`,children:`No photographs captured yet. Press “Capture daylight” to take the one this scene will judge everything against.`}):s(`div`,{className:`flex flex-col gap-2`,children:i.map(e=>r(`div`,{className:`flex flex-col gap-1`,children:[r(`p`,{className:`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,children:[d(e.condition),` · `,e.tiles.length]}),s(`ul`,{className:`flex flex-wrap gap-1.5`,children:e.tiles.map(i=>{let o=`${i.stateId}:${String(i.index)}`,f=a===1,p=c===o;return r(`li`,{className:`flex w-24 flex-col gap-1 rounded-md border border-border p-1`,children:[s(A,{reference:i.reference}),s(`span`,{className:`${x} tabular-nums`,children:j(i.reference.capturedAt)}),r(`button`,{type:`button`,className:O,disabled:t,"aria-label":`Delete the ${d(e.condition).toLowerCase()} photograph from ${j(i.reference.capturedAt)}`,onClick:()=>{if(f&&!p){u(o);return}u(null),n({stateId:i.stateId,index:i.index})},children:[s(l,{className:`mr-1 inline h-3 w-3`}),p?`Confirm`:`Delete`]}),p&&s(`p`,{className:`text-[10px] leading-snug text-warning`,children:`This is the only photograph this scene has. Delete it and the scene no longer knows what normal looks like — it stops judging until you capture again.`})]},o)})})]},e.condition))})}function A({reference:e}){let[t,n]=o(!1),i=e.thumbnailMediaId;return i===void 0||t?r(`div`,{className:`flex h-16 w-full flex-col items-center justify-center gap-0.5 rounded bg-surface text-foreground-subtle`,title:`The picture for this reference is no longer stored. The reference itself is intact and still being scored against.`,children:[s(C,{className:`h-4 w-4`}),s(`span`,{className:`text-[9px]`,children:`no picture`})]}):s(`img`,{src:`${T}/${encodeURIComponent(i)}`,alt:``,loading:`lazy`,className:`h-16 w-full rounded object-cover`,onError:()=>n(!0)})}function j(e){let t=new Date(e);return`${t.toLocaleDateString()} ${t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}`}n();var M=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground focus:border-primary focus:outline-none disabled:opacity-50`,N=`text-[10px] font-medium text-foreground-subtle`,P=`flex flex-col gap-2 rounded-md border border-border bg-surface/40 p-2`,F=`text-[10px] font-semibold uppercase tracking-wide text-foreground-subtle`,I=5,L=3600,R={periodic:`Only on the clock. Predictable, and it notices a change even on a camera nothing ever moves in front of.`,"on-motion":`Only after the camera has been still again for the quiet window below. Cheapest, but a change nobody walks past is never seen.`,both:`Both — the clock is the safety net that lets the motion path miss. This is the right answer for almost every scene.`},z={skip:`Sit that light out. No verdict, no alarm, no flag touched — it picks itself back up when a light it knows returns. This is why the night capture is optional.`,"judge-anyway":`Compare against the references you do have. Only correct when the two lights genuinely look alike (a floodlit driveway, an indoor lamp) — against a real infrared frame it will report a change that did not happen.`};function B(e){return{label:e.label,checkIntervalSec:e.checkIntervalSec??60,threshold:e.check.mode===`similarity`?e.check.threshold:.8,hysteresisCount:e.check.hysteresisCount,quietSeconds:e.quietSeconds,minObservationSpacingSec:e.minObservationSpacingSec,confirmPrompt:e.confirm?.prompt??``}}function V({monitor:e,disabled:t,onPatch:n}){let[i,l]=o(()=>B(e)),[u,d]=o(!1);c(()=>{u||l(B(e))},[e,u]);let f=e=>{d(!1),n(e)},p=t=>e.check.mode===`similarity`?{mode:`similarity`,threshold:t.threshold??e.check.threshold,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount}:{...e.check,hysteresisCount:t.hysteresisCount??e.check.hysteresisCount},m=e.confirm?.enabled===!0,h=e.check.mode===`similarity`?e.check.threshold:null;return r(`div`,{className:`flex flex-col gap-2`,children:[r(`div`,{className:P,children:[s(`p`,{className:F,children:`What it watches`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Name`}),s(`input`,{type:`text`,value:i.label,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,label:e.target.value})),onBlur:()=>{let t=i.label.trim();t.length>0&&t!==e.label?f({label:t}):d(!1)}})]}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.enabled,disabled:t,onChange:e=>f({enabled:e.target.checked})}),s(`span`,{className:N,children:`Watching`})]}),s(`p`,{className:x,children:`Turned off, the scene keeps its region, its references and its flag — it simply stops checking. Nothing is lost by pausing one for a while.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When to look`}),r(`select`,{value:e.triggerMode,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`periodic`||t===`on-motion`||t===`both`)&&f({triggerMode:t})},children:[s(`option`,{value:`both`,children:`On the clock and after motion settles`}),s(`option`,{value:`periodic`,children:`On the clock only`}),s(`option`,{value:`on-motion`,children:`After motion settles only`})]})]}),s(`p`,{className:x,children:R[e.triggerMode]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Check every (seconds)`}),s(`input`,{type:`number`,min:I,max:L,value:i.checkIntervalSec,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,checkIntervalSec:Number(e.target.value)||0})),onBlur:()=>{let t=H(i.checkIntervalSec,I,L);t===e.checkIntervalSec?d(!1):f({checkIntervalSec:t})}})]}),s(`p`,{className:x,children:`60 s suits “is the bin still out”. Every check costs one photograph and one encode, so going below about 30 s buys latency you almost never need and multiplies the cost by the number of scenes you own.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`How sure it has to be`}),e.check.mode===`similarity`&&r(a,{children:[r(`label`,{className:`flex flex-col gap-1`,children:[r(`span`,{className:N,children:[`Match threshold — `,s(`span`,{className:`tabular-nums`,children:i.threshold.toFixed(2)})]}),s(`input`,{type:`range`,min:.3,max:.99,step:.01,value:i.threshold,disabled:t,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,threshold:Number(e.target.value)})),onMouseUp:()=>{i.threshold===h?d(!1):f({check:p({threshold:i.threshold})})},onBlur:()=>{i.threshold===h?d(!1):f({check:p({threshold:i.threshold})})}})]}),s(`p`,{className:`text-[10px] text-foreground-subtle`,children:`How closely the region still has to resemble the photograph to count as unchanged. Higher means fussier: at 0.95 a passing cloud can read as a change; at 0.60 the bin can be taken and the scene will shrug. 0.80 is a sensible start — if it cries wolf, lower it; if it misses the thing you care about, raise it.`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Agreeing checks before it changes its mind`}),s(`input`,{type:`number`,min:1,max:10,value:i.hysteresisCount,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,hysteresisCount:Number(e.target.value)||1})),onBlur:()=>{let t=H(i.hysteresisCount,1,10);t===e.check.hysteresisCount?d(!1):f({check:p({hysteresisCount:t})})}})]}),s(`p`,{className:x,children:`One bad photograph must never be able to flip a scene. 3 agreeing checks at 60 s is about four minutes of latency and is what makes the answer trustworthy — leaving a state costs exactly the same as entering one.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Quiet for (seconds) before a check counts`}),s(`input`,{type:`number`,min:0,max:3600,value:i.quietSeconds,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,quietSeconds:Number(e.target.value)||0})),onBlur:()=>{let t=H(i.quietSeconds,0,3600);t===e.quietSeconds?d(!1):f({quietSeconds:t})}})]}),s(`p`,{className:x,children:`A check taken while something is moving is a photograph of the van parked in front of the bin, so it is discarded rather than merely delayed. 0 disables the gate.`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Minimum gap between counted checks (seconds)`}),s(`input`,{type:`number`,min:0,max:3600,value:i.minObservationSpacingSec,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,minObservationSpacingSec:Number(e.target.value)||0})),onBlur:()=>{let t=H(i.minObservationSpacingSec,0,3600);t===e.minObservationSpacingSec?d(!1):f({minObservationSpacingSec:t})}})]}),s(`p`,{className:x,children:`Spreads the agreeing checks over real time instead of letting three adjacent polls inside one long occlusion be mistaken for three independent opinions.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`Lighting`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`When a light has no reference of its own`}),r(`select`,{value:e.onUncoveredCondition,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`skip`||t===`judge-anyway`)&&f({onUncoveredCondition:t})},children:[s(`option`,{value:`skip`,children:`Skip the check (recommended)`}),s(`option`,{value:`judge-anyway`,children:`Judge against the other light anyway`})]})]}),s(`p`,{className:x,children:z[e.onUncoveredCondition]})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`What you get told`}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`Notifications follow`}),r(`select`,{value:e.emit,disabled:t,className:M,onChange:e=>{let t=e.target.value;(t===`latched`||t===`live`)&&f({emit:t})},children:[s(`option`,{value:`latched`,children:`The flag — told once, still visible at breakfast`}),s(`option`,{value:`live`,children:`The live state — follows the region as it changes`})]})]}),s(`p`,{className:x,children:`“Is the bin gone” is a flag: you want to be told once and still see it later. “Is the gate open” is a live state.`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:e.autoRestore,disabled:t,onChange:e=>f({autoRestore:e.target.checked})}),s(`span`,{className:N,children:`Clear the flag by itself when things look normal again`})]}),s(`p`,{className:x,children:`Off by default, so an alarm never silently clears itself. The “back to normal” moment is recorded either way, so an automation can still react to it.`})]}),r(`div`,{className:P,children:[s(`p`,{className:F,children:`AI double-check`}),r(`label`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`checkbox`,checked:m,disabled:t||i.confirmPrompt.trim().length===0,onChange:e=>f(e.target.checked?{confirm:{...U(i.confirmPrompt.trim()),enabled:!0}}:{confirm:null})}),s(`span`,{className:N,children:`Ask a vision model before changing the answer`})]}),r(`label`,{className:`flex flex-col gap-1`,children:[s(`span`,{className:N,children:`The question to ask`}),s(`input`,{type:`text`,value:i.confirmPrompt,placeholder:`e.g. Is the wheelie bin still there?`,disabled:t,className:M,onFocus:()=>d(!0),onChange:e=>l(t=>({...t,confirmPrompt:e.target.value})),onBlur:()=>{let t=i.confirmPrompt.trim();t.length>0&&t!==e.confirm?.prompt?f({confirm:{...U(t),enabled:m}}):d(!1)}})]}),r(`p`,{className:x,children:[`The model is asked `,s(`strong`,{children:`only`}),` when the region has already changed enough to flip the answer — roughly twice a week for a bin, not once a minute. It reasons about the object rather than the pixels, so rain, shadows and a repositioned bin stop counting as the thing being taken. If it cannot be reached, the change is held rather than announced.`]})]})]})}function H(e,t,n){return Math.min(n,Math.max(t,e))}function U(e){return{enabled:!1,prompt:e,timeoutMs:8e3,maxImagePx:448,onTimeout:`hold`}}n();var W=`rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors`,G=`rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors`,K=`rounded-md border border-danger/50 bg-danger/10 px-2 py-1 text-[11px] font-medium text-danger hover:bg-danger/20 disabled:opacity-40 transition-colors`,q={alarm:`border-danger/50 bg-danger/15 text-danger`,ok:`border-success/50 bg-success/15 text-success`,unknown:`border-border bg-surface text-foreground-subtle`},re=.8,ie=3;function J({deviceId:n}){let b=v(y().trpcClient,n),C=p(b?.state.sceneMonitor),T=S(n,{width:640}),[E,D]=o(null),[O,A]=o(!1),[j,M]=o(null),[N,P]=o(null),[F,I]=o(null),[L,R]=o(null),[z,B]=o(!1),[H,U]=o(null),[J,Y]=o(``),X=t(!0);c(()=>(X.current=!0,()=>{X.current=!1}),[]);let Z=e(async()=>{if(b)try{let e=await b.sceneMonitor?.listScenes({});if(!X.current)return;e&&D(e)}catch(e){if(!X.current)return;g(e)?A(!0):P(e instanceof Error?e.message:String(e))}},[b]);c(()=>{D(null),A(!1),P(null),Z()},[Z]);let Q=C?.monitors??E?.monitors??[],ae=Date.now(),$=e(async(e,t)=>{M(e),P(null);try{await t(),await Z()}catch(e){X.current&&P(e instanceof Error?e.message:String(e))}finally{X.current&&M(null)}},[Z]),oe=i(()=>{let e=Q.map(e=>({id:e.id,shape:e.roi,label:e.label,enabled:e.enabled}));return H===null?e:[...e,{id:`__draft__`,shape:H,label:`New scene`}]},[Q,H]),se=e((e,t)=>{if(t.kind===`rect`){if(e===`__draft__`){U(t);return}$(`roi-${String(e)}`,async()=>b?.sceneMonitor?.updateScene({monitorId:String(e),patch:{roi:t}}))}},[b,$]),ce=e(e=>{e.kind===`rect`&&U(e)},[]),le=e(async()=>{H===null||J.trim().length===0||(await $(`create`,async()=>{await b?.sceneMonitor?.createScene({label:J.trim(),roi:H,check:{mode:`similarity`,threshold:re,hysteresisCount:ie}})}),U(null),Y(``),B(!1))},[b,H,J,$]);return b?s(`div`,{className:`flex flex-col gap-3`,children:O?s(`p`,{className:`${x} leading-relaxed`,children:`Scene monitoring is not available for this camera.`}):r(a,{children:[s(`p`,{className:`${x} leading-relaxed`,children:`A scene watches one region of this camera and tells you when it stops looking like the picture you captured. Draw a box around the thing you care about — a wheelie bin, a gate, a parking space — then capture what “normal” looks like. Daylight is enough to start: the night reference is optional, and without it the scene simply sits the infrared hours out instead of reporting a problem.`}),s(`div`,{className:`relative overflow-hidden rounded-md border border-border`,children:s(te,{items:oe,supportedShapes:[`rect`],selectedId:F??(H===null?null:`__draft__`),onSelect:e=>I(e===null?null:String(e)),onShapeChange:se,onDrawComplete:ce,drawingKind:z&&H===null?`rect`:null,backdrop:T.src===null?null:s(`img`,{src:T.src,alt:``,className:`h-full w-full object-contain`,draggable:!1})})}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[s(`button`,{type:`button`,className:z?G:W,"aria-pressed":z,onClick:()=>{B(e=>!e),U(null)},disabled:j!==null,children:z?`Cancel`:`+ New scene`}),s(`button`,{type:`button`,className:W,onClick:T.refresh,disabled:j!==null,children:`Refresh frame`})]}),z&&r(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-surface p-2`,children:[s(`p`,{className:`text-[10px] text-foreground-subtle`,children:H===null?`Click on the frame to drop a box, then drag its corner to fit it around the thing you want watched.`:`Name it, then create. You capture what “normal” looks like next.`}),H!==null&&u(H)&&s(`p`,{className:`text-[11px] leading-relaxed text-warning`,children:`That box covers most of the frame. A scene that big is dominated by the weather, the sky and passing cars — it will quietly stop noticing the thing you actually care about. Draw it tighter.`}),r(`div`,{className:`flex items-center gap-2`,children:[s(`input`,{type:`text`,value:J,onChange:e=>Y(e.target.value),placeholder:`e.g. Immondizia prelevata`,className:`flex-1 rounded-md border border-border bg-surface px-2 py-1 text-[12px] text-foreground`}),s(`button`,{type:`button`,className:G,onClick:()=>void le(),disabled:H===null||J.trim().length===0||j!==null,children:`Create`})]})]}),N!==null&&s(`p`,{className:`text-[11px] leading-relaxed text-danger`,children:N}),Q.length===0?s(`p`,{className:`${x} leading-relaxed`,children:`No scenes on this camera yet.`}):s(`ul`,{className:`flex flex-col gap-2`,children:Q.map(e=>{let t=m(e);return r(`li`,{className:`flex flex-col gap-1.5 rounded-md border p-2 ${F===e.id?`border-primary/50`:`border-border`}`,children:[r(`div`,{className:`flex items-center gap-2`,children:[s(`button`,{type:`button`,className:`flex-1 text-left text-[12px] font-medium text-foreground`,onClick:()=>I(e.id),children:e.label}),s(`span`,{className:`rounded border px-1.5 py-0.5 text-[10px] font-medium ${q[t.tone]}`,children:t.text})]}),s(`p`,{className:`${x} leading-relaxed`,children:_(e,ae)}),s(`p`,{className:`${x} tabular-nums`,children:h(e)}),s(k,{monitor:e,disabled:j!==null,onDelete:({stateId:t,index:n})=>void $(`refdel-${e.id}-${t}-${String(n)}`,async()=>b.sceneMonitor?.deleteReference({monitorId:e.id,stateId:t,index:n}))}),r(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[f.map(t=>{let n=t===`ir`;return r(`button`,{type:`button`,className:W,disabled:j!==null,title:n?`Optional. Without a night reference the checks in infrared are simply skipped — the scene keeps working in daylight and nothing is reported as broken.`:`Take a fresh photo now and store it as the ${d(t).toLowerCase()} reference`,onClick:()=>void $(`cap-${e.id}-${t}`,async()=>b.sceneMonitor?.captureReference({monitorId:e.id,condition:t})),children:[s(w,{className:`mr-1 inline h-3 w-3`}),`Capture `,d(t).toLowerCase(),n&&s(`span`,{className:`ml-1 text-foreground-subtle/70`,children:`(optional)`})]},t)}),r(`button`,{type:`button`,className:G,disabled:j!==null||e.states.length===0,title:`Clear the flag and re-photograph what normal looks like right now`,onClick:()=>void $(`reset-${e.id}`,async()=>b.sceneMonitor?.resetScene({monitorId:e.id})),children:[s(ee,{className:`mr-1 inline h-3 w-3`}),`Reset`]}),s(`button`,{type:`button`,className:W,disabled:j!==null,onClick:()=>void $(`check-${e.id}`,async()=>b.sceneMonitor?.recheckNow({monitorId:e.id})),children:`Check now`}),r(`button`,{type:`button`,className:L===e.id?G:W,"aria-pressed":L===e.id,"aria-label":`Settings for ${e.label}`,disabled:j!==null,onClick:()=>R(t=>t===e.id?null:e.id),children:[s(ne,{className:`mr-1 inline h-3 w-3`}),`Settings`]}),s(`button`,{type:`button`,className:K,disabled:j!==null,onClick:()=>void $(`del-${e.id}`,async()=>b.sceneMonitor?.deleteScene({monitorId:e.id})),children:s(l,{className:`h-3 w-3`})})]}),L===e.id&&s(V,{monitor:e,disabled:j!==null,onPatch:t=>void $(`tune-${e.id}`,async()=>b.sceneMonitor?.updateScene({monitorId:e.id,patch:t}))})]},e.id)})})]})}):null}export{J as SceneMonitorEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as e,S as t,W as n,X as r,q as i,x as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{L as o,R as s,V as c,z as l}from"./player-overlays-
|
|
1
|
+
import{Q as e,S as t,W as n,X as r,q as i,x as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{L as o,R as s,V as c,z as l}from"./player-overlays-Cce7zLVf.js";import{At as u,Br as d,Dt as f,Et as p,Ft as m,It as h,Lt as g,Nt as _,Tt as v,et as y,kt as b,t as x,tt as S,wt as C}from"./src-CLcW_gk2.js";import{t as w}from"./plus-CkMMGkZS.js";import{g as T}from"./index-BVmc_EOb.js";import{t as E}from"./AdminPage-CCD07UMs.js";import{t as D}from"./use-scenes-feed-7qe4q2V7.js";e();function O(e){return e.states.length===0?3:e.latched?0:e.verdict===`diverged`?1:e.verdict===`unknown`?2:4}function k(e){let t=[e.divergedAt,e.restoredAt].filter(e=>typeof e==`number`);return t.length===0?null:Math.max(...t)}function A(e,t){let n=new Map(e.map(e=>[e.deviceId,e.deviceName])),r=[];for(let e of t)for(let t of e.monitors)r.push({deviceId:e.deviceId,deviceName:n.get(e.deviceId)??`Camera ${e.deviceId}`,monitor:t});return r.toSorted((e,t)=>{let n=O(e.monitor)-O(t.monitor);if(n!==0)return n;let r=k(e.monitor)??-1,i=k(t.monitor)??-1;if(r!==i)return i-r;let a=e.deviceName.localeCompare(t.deviceName);return a===0?e.monitor.label.localeCompare(t.monitor.label):a})}var j={alarm:`danger`,ok:`success`,unknown:`default`};function M(e,t){let n=k(e);return n===null?`—`:`${l(Math.max(0,t-n))} ago`}function N(){let e=d({isCamera:!0,projection:`slim`}),l=n(()=>(e.data??[]).map(e=>({deviceId:e.id,deviceName:e.name})).sort((e,t)=>e.deviceName.localeCompare(t.deviceName)),[e.data]),O=n(()=>l.map(e=>e.deviceId),[l]),k=D(O),N=n(()=>A(l,k.results),[l,k.results]),[P,F]=i(null),[I,L]=i(null),R=Date.now(),z=l.find(e=>e.deviceId===P)?.deviceName??``;return t(E,{icon:T,title:`Scenes`,subtitle:`A scene watches one region of one camera and tells you when it stops looking like the picture you captured — a wheelie bin, a gate, a parking space.`,actions:t(g,{onClick:()=>L(O[0]??null),disabled:l.length===0,children:[a(w,{className:`mr-1 h-3.5 w-3.5`}),`New scene`]}),children:[k.unreachableCount>0?t(`p`,{className:`text-xs text-warning`,children:[k.unreachableCount,` camera`,k.unreachableCount===1?``:`s`,` could not be asked about scenes. Those cameras are missing from this list — this is not the same as having no scenes.`]}):null,a(m,{variant:`flat`,className:`p-0`,children:a(y,{columns:[{key:`label`,header:`Scene`,render:e=>a(`span`,{className:`font-medium`,children:e.monitor.label})},{key:`camera`,header:`Camera`,nowrap:!0,render:e=>e.deviceName},{key:`state`,header:`State`,nowrap:!0,render:e=>{let t=o(e.monitor);return a(h,{variant:j[t.tone],children:t.text})}},{key:`status`,header:`What it says`,render:e=>a(`span`,{className:`text-xs text-muted-foreground`,children:c(e.monitor,R)})},{key:`coverage`,header:`Variants`,render:e=>a(`span`,{className:`text-xs text-muted-foreground`,children:s(e.monitor)})},{key:`transition`,header:`Last change`,align:`right`,nowrap:!0,render:e=>a(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:M(e.monitor,R)})},{key:`actions`,header:``,align:`right`,nowrap:!0,render:e=>a(g,{variant:`ghost`,onClick:()=>F(e.deviceId),children:`Open`})}],rows:N,rowKey:e=>`${e.deviceId}:${e.monitor.id}`,minWidthPx:880,bordered:!1,mobileMode:`scroll`,maxBodyHeight:S,emptyMessage:k.isLoading?`Loading scenes…`:`No scenes yet. Press “New scene”, pick a camera, then draw a box around the thing you want watched.`})}),a(C,{open:I!==null,onOpenChange:e=>!e&&L(null),children:t(p,{width:`sm`,children:[t(b,{children:[a(u,{children:`Which camera?`}),a(f,{children:`A scene lives on one camera. Pick the one that can see the thing.`})]}),t(`div`,{className:`mt-3 flex items-center gap-2`,children:[a(_,{value:I===null?``:String(I),onChange:e=>L(Number(e.target.value)),"aria-label":`Camera`,options:l.map(e=>({value:String(e.deviceId),label:e.deviceName}))}),a(g,{onClick:()=>{F(I),L(null)},disabled:I===null,children:`Continue`})]})]})}),a(C,{open:P!==null,onOpenChange:e=>!e&&F(null),children:t(p,{width:`lg`,scroll:`body`,children:[t(b,{children:[t(u,{children:[`Scenes — `,z]}),a(f,{children:`Draw a box, name it, then capture what “normal” looks like. Daylight is enough — the night reference is optional, and “Settings” on each scene tunes how fussy and how often it checks.`})]}),a(v,{className:`mt-3`,children:P===null?null:a(r,{fallback:a(`p`,{className:`text-xs text-muted-foreground`,children:`Loading the editor…`}),children:a(x,{deviceId:P})})})]})})]})}export{N as ScenesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as e,S as t,o as n,q as r,x as i,z as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{
|
|
1
|
+
import{Q as e,S as t,o as n,q as r,x as i,z as a}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{Ft as o,It as s,Jo as c,Lt as l,Pt as u,Xo as d,Yo as f,Zi as p}from"./src-CLcW_gk2.js";import{n as m}from"./FormBuilder-BDA9-uL2.js";import{t as h}from"./refresh-cw-7BWEDRql.js";import{p as g}from"./index-BVmc_EOb.js";import{t as _}from"./AdminPage-CCD07UMs.js";import{t as v}from"./NodeAddonsSettingsPanel-iynDrGDY.js";e();var y=[[`system`]];function b(e){return e.toFixed(6).replace(/0+$/,``).replace(/\.$/,``)}function x(){let e=n(),p=f(),g=d(),_=c(),[v,x]=r(``),[S,C]=r(``),[w,T]=r(null),E=p.data?.location??null;a(()=>{x(E===null?``:b(E.latitude)),C(E===null?``:b(E.longitude))},[E]);let D=async()=>{await e.invalidateQueries({queryKey:y})},O=async e=>{e.preventDefault();let t=Number(v),n=Number(S);if(v.trim()===``||S.trim()===``){T(`Enter both a latitude and a longitude, or press Clear.`);return}if(!Number.isFinite(t)||t<-90||t>90){T(`Latitude must be between -90 and 90 decimal degrees.`);return}if(!Number.isFinite(n)||n<-180||n>180){T(`Longitude must be between -180 and 180 decimal degrees.`);return}T(null),await g.mutateAsync({latitude:t,longitude:n}),await D()},k=async()=>{T(null),await g.mutateAsync(null),await D()},A=async()=>{T(null),await _.mutateAsync(),await D()},j=g.isPending||_.isPending||p.isLoading;return t(o,{className:`space-y-3`,children:[t(`div`,{className:`flex items-start justify-between gap-3`,children:[t(`div`,{className:`flex items-start gap-2`,children:[i(m,{className:`h-4 w-4 mt-0.5 text-muted-foreground shrink-0`}),t(`div`,{children:[i(`h3`,{className:`text-sm font-medium`,children:`Site location`}),i(`p`,{className:`text-xs text-muted-foreground max-w-prose`,children:`Where this installation physically is. Used to compute real sunrise and sunset times — scene monitoring tells day, dusk, night and dawn apart with them, so a reference captured in daylight is never scored against a half-lit frame. Left unset, the fallback is a coarse UTC clock split.`})]})]}),E===null?i(s,{variant:`warning`,children:`Not configured`}):i(s,{variant:E.source===`operator-set`?`success`:`info`,children:E.source===`operator-set`?`Set by you`:`Derived from IP`})]}),E?.label!==void 0&&E.label!==``?t(`p`,{className:`text-xs text-muted-foreground`,children:[`Detected near `,E.label,`.`]}):null,E===null&&p.data?.derivationAttemptedAt!==null?t(`p`,{className:`text-xs text-warning`,children:[`Automatic detection from the public IP did not succeed`,p.data?.derivationError!==null&&p.data?.derivationError!==void 0?`: ${p.data.derivationError}`:`.`,` `,`It is not retried on its own — enter the coordinates, or press Detect.`]}):null,t(`form`,{className:`flex flex-wrap items-end gap-3`,onSubmit:O,children:[t(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:`Latitude`}),i(u,{className:`w-40`,value:v,inputMode:`decimal`,placeholder:`40.851800`,onChange:e=>x(e.target.value),"aria-label":`Latitude`})]}),t(`label`,{className:`flex flex-col gap-1 text-xs`,children:[i(`span`,{className:`text-muted-foreground`,children:`Longitude`}),i(u,{className:`w-40`,value:S,inputMode:`decimal`,placeholder:`14.268100`,onChange:e=>C(e.target.value),"aria-label":`Longitude`})]}),i(l,{type:`submit`,disabled:j,children:`Save`}),t(l,{type:`button`,variant:`ghost`,disabled:j,onClick:A,children:[i(h,{className:`h-3.5 w-3.5 mr-1`}),`Detect from IP`]}),E===null?null:i(l,{type:`button`,variant:`ghost`,disabled:j,onClick:k,children:`Clear`})]}),w===null?null:i(`p`,{className:`text-xs text-danger`,children:w}),i(`p`,{className:`text-xs text-muted-foreground`,children:`WGS84 decimal degrees. Detect asks a public geo-IP service once and will not overwrite a value you typed — clear it first.`})]})}function S(){let{data:e,isLoading:n}=p(void 0),r=(e??[]).find(e=>e.isHub&&e.isOnline),a=r?.addons.map(e=>e.id)??[];return t(_,{children:[i(x,{}),n?i(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`Loading hub topology…`}):r?a.length===0?i(`div`,{className:`text-muted-foreground text-sm py-12 text-center`,children:`No addons installed on the hub yet.`}):i(v,{nodeId:r.id,addonIds:a,level:`global`}):t(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground text-sm gap-2 py-12`,children:[i(g,{className:`h-8 w-8 opacity-30`}),i(`p`,{children:`No online hub node found.`}),i(`p`,{className:`text-xs`,children:`Settings will appear once the hub is reachable.`})]})]})}export{S as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{t as i}from"./CapabilityBadges-DVcflr6z.js";import{t as a}from"./ProviderIcon-CIB9wAOh.js";import{t as o}from"./FormBuilder-ERsdhqXU.js";import{t as s}from"./StatusBadge-CeptlsPG.js";e();function c({title:e,children:n}){return t(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:n})]})}function l({name:e,cssVar:n,hex:i}){return t(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:n?`var(${n})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[e,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return t(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[t(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:t(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`frigate`,hex:`#3b82f6`}),r(l,{name:`scrypted`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:t(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),r(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),r(c,{title:`Inputs`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),t(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),t(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),r(`div`,{children:t(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:t(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>r(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),r(c,{title:`Badges`,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(s,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),t(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),t(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),t(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(a,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(o,{schema:u,values:e,onChange:d}),t(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(e,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:e,label:n,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[e];return t(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:n}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:r(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
|
|
1
|
+
import{Q as e,S as t,q as n,x as r}from"./_virtual_mf___mfe_internal__admin_ui_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DhP-Lgiq.js";import{t as i}from"./CapabilityBadges-BsNvOYxI.js";import{t as a}from"./ProviderIcon-BRIZHtNP.js";import{t as o}from"./FormBuilder-BDA9-uL2.js";import{t as s}from"./StatusBadge-CeptlsPG.js";e();function c({title:e,children:n}){return t(`div`,{className:`rounded-lg border border-border bg-surface overflow-hidden`,children:[r(`div`,{className:`border-b border-border px-4 py-2.5`,children:r(`h2`,{className:`text-xs font-semibold text-foreground uppercase tracking-wider`,children:e})}),r(`div`,{className:`p-4`,children:n})]})}function l({name:e,cssVar:n,hex:i}){return t(`div`,{className:`flex flex-col items-center gap-1.5`,children:[r(`div`,{className:`h-10 w-10 rounded-lg border border-border shadow-inner`,style:{backgroundColor:n?`var(${n})`:i}}),r(`span`,{className:`text-[10px] text-foreground-subtle text-center leading-tight`,children:e})]})}var u={sections:[{id:`demo`,title:`Demo Fields`,columns:2,fields:[{key:`name`,type:`text`,label:`Name`,placeholder:`Enter name`},{key:`count`,type:`number`,label:`Count`,min:0,max:100,unit:`items`},{key:`enabled`,type:`boolean`,label:`Enabled`},{key:`mode`,type:`select`,label:`Mode`,options:[{value:`a`,label:`Alpha`},{value:`b`,label:`Beta`}]},{key:`tags`,type:`tags`,label:`Tags`,span:2,suggestions:[`camera`,`zone`,`alert`]},{key:`confidence`,type:`slider`,label:`Confidence`,min:0,max:100,step:5,unit:`%`,span:2},{key:`info`,type:`info`,label:`Note`,content:`This is an informational message for the user.`,variant:`info`}]}]};function d(){let[e,d]=n({name:`Example`,count:10,enabled:!0,mode:`a`,tags:[`camera`],confidence:60});return t(`div`,{className:`p-6 space-y-6 max-w-5xl mx-auto`,children:[t(`div`,{className:`mb-6`,children:[r(`h1`,{className:`text-xl font-bold text-foreground`,children:`Component Showroom`}),r(`p`,{className:`text-sm text-foreground-subtle mt-1`,children:`All UI components at a glance`})]}),r(c,{title:`Typography`,children:t(`div`,{className:`space-y-3`,children:[r(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Heading 1 — Display title`}),r(`h2`,{className:`text-xl font-semibold text-foreground`,children:`Heading 2 — Section title`}),r(`h3`,{className:`text-base font-semibold text-foreground`,children:`Heading 3 — Card title`}),r(`h4`,{className:`text-sm font-semibold text-foreground`,children:`Heading 4 — Sub-section`}),r(`p`,{className:`text-sm text-foreground`,children:`Body text — Regular paragraph content goes here. It uses the foreground color.`}),r(`p`,{className:`text-sm text-foreground-subtle`,children:`Subtle text — Secondary/descriptive text with reduced emphasis.`}),r(`p`,{className:`text-xs text-foreground-subtle uppercase tracking-wider font-semibold`,children:`Label / Caption`}),r(`p`,{className:`text-xs text-foreground-disabled`,children:`Disabled / placeholder text`})]})}),r(c,{title:`Colors`,children:t(`div`,{className:`flex flex-wrap gap-4`,children:[r(l,{name:`primary`,cssVar:`--color-primary`}),r(l,{name:`background`,cssVar:`--color-background`}),r(l,{name:`surface`,cssVar:`--color-surface`}),r(l,{name:`foreground`,cssVar:`--color-foreground`}),r(l,{name:`success`,cssVar:`--color-success`}),r(l,{name:`warning`,cssVar:`--color-warning`}),r(l,{name:`danger`,cssVar:`--color-danger`}),r(l,{name:`info`,cssVar:`--color-info`}),r(l,{name:`border`,cssVar:`--color-border`}),r(`div`,{className:`w-px`}),r(l,{name:`frigate`,hex:`#3b82f6`}),r(l,{name:`scrypted`,hex:`#a855f7`}),r(l,{name:`reolink`,hex:`#06b6d4`}),r(l,{name:`ha`,hex:`#22d3ee`}),r(l,{name:`rtsp`,hex:`#78716c`})]})}),r(c,{title:`Buttons`,children:t(`div`,{className:`flex flex-wrap gap-3`,children:[r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white hover:opacity-90 transition-opacity`,children:`Primary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-border bg-surface px-4 py-2 text-sm font-medium text-foreground hover:bg-surface-hover transition-colors`,children:`Secondary`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-danger/40 bg-danger/10 px-4 py-2 text-sm font-medium text-danger hover:bg-danger/20 transition-colors`,children:`Danger`}),r(`button`,{disabled:!0,className:`inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-white opacity-40 cursor-not-allowed`,children:`Disabled`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-4 py-2 text-sm font-medium text-warning hover:bg-warning/20 transition-colors`,children:`Warning`}),r(`button`,{className:`inline-flex items-center gap-1.5 rounded-md border border-success/40 bg-success/10 px-4 py-2 text-sm font-medium text-success hover:bg-success/20 transition-colors`,children:`Success`})]})}),r(c,{title:`Inputs`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Text input`}),r(`input`,{type:`text`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`Type something...`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Number input`}),r(`input`,{type:`number`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`0`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Password input`}),r(`input`,{type:`password`,className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,placeholder:`••••••••`})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Select`}),t(`select`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30`,children:[r(`option`,{children:`Option A`}),r(`option`,{children:`Option B`}),r(`option`,{children:`Option C`})]})]}),t(`div`,{className:`md:col-span-2`,children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Textarea`}),r(`textarea`,{className:`w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground outline-none focus:border-primary focus:ring-1 focus:ring-primary/30 resize-y min-h-[60px]`,placeholder:`Enter multi-line text...`,rows:3})]}),r(`div`,{children:t(`label`,{className:`flex items-center gap-2 cursor-pointer select-none`,children:[r(`input`,{type:`checkbox`,className:`h-3.5 w-3.5 rounded border-border accent-primary`,defaultChecked:!0}),r(`span`,{className:`text-xs font-medium text-foreground`,children:`Checkbox (checked)`})]})}),r(`div`,{children:t(`div`,{className:`flex items-center justify-between`,children:[r(`span`,{className:`text-xs font-medium text-foreground`,children:`Toggle switch`}),r(f,{})]})}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Slider`}),r(`input`,{type:`range`,className:`w-full h-1 accent-primary cursor-pointer`,min:0,max:100,defaultValue:60})]}),t(`div`,{children:[r(`label`,{className:`block text-xs font-medium text-foreground mb-1`,children:`Tags example`}),r(`div`,{className:`flex flex-wrap gap-1.5 rounded-md border border-border bg-background px-2 py-1.5 min-h-[38px]`,children:[`camera`,`zone`,`alert`].map(e=>r(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-xs text-primary`,children:e},e))})]})]})}),r(c,{title:`Badges`,children:t(`div`,{className:`space-y-3`,children:[t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`StatusBadge`}),r(`div`,{className:`flex flex-wrap gap-2`,children:[`running`,`stopped`,`error`,`online`,`offline`,`idle`].map(e=>r(s,{status:e},e))})]}),t(`div`,{children:[r(`p`,{className:`text-xs text-foreground-subtle mb-2`,children:`CapabilityBadges`}),r(i,{capabilities:[`streaming`,`detection`,`recording`,`audio`]})]})]})}),r(c,{title:`Cards`,children:t(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[t(`div`,{className:`rounded-lg bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Surface card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-surface`. Default card background."})]}),t(`div`,{className:`rounded-lg border border-border bg-surface p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Bordered card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `border border-border bg-surface`."})]}),t(`div`,{className:`rounded-lg border border-primary/30 bg-primary/5 p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-primary mb-1`,children:`Accent card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:`Highlighted with primary color.`})]}),t(`div`,{className:`rounded-lg bg-background p-4`,children:[r(`h3`,{className:`text-sm font-semibold text-foreground mb-1`,children:`Background card`}),r(`p`,{className:`text-xs text-foreground-subtle`,children:"Uses `bg-background`. Inset card."})]})]})}),r(c,{title:`Provider Icons`,children:r(`div`,{className:`flex flex-wrap gap-4`,children:[`frigate`,`scrypted`,`reolink`,`homeassistant`,`rtsp`,`onvif`].map(e=>r(a,{type:e,size:`lg`,showLabel:!0},e))})}),t(c,{title:`Form Builder Demo`,children:[r(o,{schema:u,values:e,onChange:d}),t(`details`,{className:`mt-3`,children:[r(`summary`,{className:`text-[10px] text-foreground-subtle cursor-pointer hover:text-foreground`,children:`View current values`}),r(`pre`,{className:`mt-2 rounded-md bg-background p-3 text-[10px] text-foreground-subtle overflow-auto`,children:JSON.stringify(e,null,2)})]})]}),r(c,{title:`Info Boxes`,children:r(`div`,{className:`space-y-2`,children:[{variant:`info`,label:`Info`,content:`This is an informational message. Use it for tips and hints.`},{variant:`warning`,label:`Warning`,content:`This action may have side effects. Proceed with caution.`},{variant:`success`,label:`Success`,content:`Operation completed successfully. All systems are green.`},{variant:`danger`,label:`Danger`,content:`This operation is irreversible. Data will be permanently deleted.`}].map(({variant:e,label:n,content:i})=>{let a={info:{border:`border-info`,bg:`bg-info/5`,text:`text-info`},warning:{border:`border-warning`,bg:`bg-warning/5`,text:`text-warning`},success:{border:`border-success`,bg:`bg-success/5`,text:`text-success`},danger:{border:`border-danger`,bg:`bg-danger/5`,text:`text-danger`}}[e];return t(`div`,{className:`rounded-md border-l-4 px-3 py-2.5 ${a.border} ${a.bg}`,children:[r(`p`,{className:`text-xs font-semibold mb-0.5 ${a.text}`,children:n}),r(`p`,{className:`text-xs text-foreground-subtle leading-relaxed`,children:i})]},e)})})})]})}function f(){let[e,t]=n(!0);return r(`button`,{type:`button`,role:`switch`,"aria-checked":e,onClick:()=>t(e=>!e),className:[`relative inline-flex h-4 w-8 shrink-0 items-center rounded-full transition-colors duration-150 cursor-pointer`,e?`bg-primary`:`bg-foreground-subtle/30`].join(` `),children:r(`span`,{className:[`inline-block h-3 w-3 rounded-full bg-white shadow transition-transform duration-150`,e?`translate-x-4`:`translate-x-0.5`].join(` `)})})}export{d as ShowroomPage};
|