Files
pictureFrame-webApp/public/build/assets/HomeView-BDJhYpJV.js
T
football2801 00121aaec9
CI / test (push) Has been cancelled
feat(pwa): installable app — manifest + SW + Settings install button
The captive-portal Step-2 QR opens pictureframe.edholm.me in Safari,
which is the perfect moment to also offer "pin this to your home
screen" so the recipient gets one-tap access without typing the URL
again. Two pieces:

* Service worker at /sw.js (document root, scope "/"). Minimal —
  install/activate calls skipWaiting + clients.claim, fetch is
  passthrough. Real offline caching is intentionally out of scope;
  we only need the SW to exist so Chrome's PWA-install heuristic
  fires.

* Settings → Install app section, hidden when display-mode standalone.
  Android Chrome path: native beforeinstallprompt button.
  iOS Safari (and any other non-prompt browser): button opens a
  modal with step-by-step Share → Add to Home Screen instructions.

usePwaInstall composable handles the singleton lifecycle —
beforeinstallprompt fires once per page load and may fire before the
user navigates to Settings, so we register on module import and stash
the event for later.

Tests cover: install button rendered when not standalone, modal opens
on click without a native prompt, modal close button works.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 13:49:12 -04:00

1 line
22 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{A as e,B as t,E as n,G as r,H as i,J as a,K as o,M as s,P as c,R as l,S as u,_ as ee,a as te,b as ne,c as re,f as ie,g as d,h as f,i as p,k as ae,l as m,m as oe,p as h,q as g,t as _,u as se,v,x as y,y as b,z as x}from"./_plugin-vue_export-helper-eepT72yB.js";import{o as ce,s as le}from"./index-BO5caB_f.js";import{i as S,n as C,r as ue,t as de}from"./BaseBottomSheet-BMI-Oljh.js";import{t as fe}from"./PullToRefresh-BEXU4J3A.js";var w=`https://pictureframe.edholm.me/devices/`;function pe(){let{devices:t}=p(S()),n=new Map,r=new Map,i=window.__PF_MERCURE_URL__;if(!i)return{connectedCount:()=>0};function a(e){if(!n.has(e))try{let s=new URL(i);s.searchParams.append(`topic`,w+e);let c=new EventSource(s.toString(),{withCredentials:!0});c.onmessage=e=>{try{let n=JSON.parse(e.data);if(`deleted`in n&&n.deleted===!0){t.value=t.value.filter(e=>e.id!==n.id),o(n.id);return}let r=n,i=t.value.findIndex(e=>e.id===r.id);i!==-1&&(t.value[i]=r)}catch(e){console.warn(`[mercure] parse error`,e)}},c.onerror=()=>{if(c.readyState===EventSource.CLOSED){o(e);let t=window.setTimeout(()=>{r.delete(e),a(e)},5e3);r.set(e,t)}},n.set(e,c)}catch(t){console.warn(`[mercure] open failed for device `+e,t)}}function o(e){let t=n.get(e);t&&(t.close(),n.delete(e));let i=r.get(e);i!==void 0&&(clearTimeout(i),r.delete(e))}return l(t,e=>{let t=new Set(e.map(e=>e.id));for(let e of t)n.has(e)||a(e);for(let e of[...n.keys()])t.has(e)||o(e)},{immediate:!0,deep:!1}),e(()=>{for(let e of[...n.keys()])o(e)}),{connectedCount:()=>n.size}}var T=[`src`,`alt`],E={class:`frame-card__body`},D={class:`frame-card__info`},O={class:`frame-card__name`},me={class:`frame-card__status-line`,"aria-live":`polite`},k={class:`frame-card__status-text`},A={key:0,class:`frame-card__sync-line`},j={key:0},he={key:1,class:`frame-card__sync-sep`,"aria-hidden":`true`},M={key:2},N={key:1,class:`frame-card__count`},P={key:0},F={key:1,"aria-hidden":`true`},I=_(u({__name:`FrameCard`,props:{deviceId:{},name:{},size:{},status:{},orientation:{},thumbnailUrl:{},photoCount:{},lastSync:{},nextSync:{}},emits:[`add-photo`,`edit`],setup(e){let t=e,n=f(()=>({})),r=f(()=>t.size===`large`?{aspectRatio:t.orientation===`portrait`?`3 / 5`:`5 / 3`}:{}),i=f(()=>{switch(t.status){case`ok`:return`Online`;case`sync-fail`:return`Sync issue`;case`offline`:return`Offline`}});return(t,c)=>(s(),b(`div`,{class:o([`frame-card`,`frame-card--${e.size}`,`frame-card--${e.status}`])},[e.size===`large`?(s(),b(`button`,{key:0,class:`frame-card__settings-btn`,type:`button`,"aria-label":`Frame settings`,onClick:c[0]||=n=>t.$emit(`edit`,e.deviceId)},[...c[2]||=[d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"aria-hidden":`true`},[d(`circle`,{cx:`12`,cy:`12`,r:`3`}),d(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})],-1)]])):v(``,!0),d(`div`,{class:`frame-card__preview`,style:g(n.value)},[e.thumbnailUrl?(s(),b(`img`,{key:0,src:e.thumbnailUrl,alt:`Current photo on ${e.name}`,class:`frame-card__img`},null,8,T)):(s(),b(`div`,{key:1,class:`frame-card__empty-preview`,style:g(r.value),"aria-hidden":`true`},[...c[3]||=[d(`svg`,{width:`32`,height:`32`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`},[d(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),d(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),d(`polyline`,{points:`21,15 16,10 5,21`})],-1)]],4))],4),d(`div`,E,[d(`div`,D,[d(`p`,O,a(e.name),1),d(`p`,me,[c[4]||=d(`span`,{class:`frame-card__status-dot`,"aria-hidden":`true`},null,-1),d(`span`,k,a(i.value),1)]),e.size===`large`&&(e.lastSync||e.nextSync)?(s(),b(`p`,A,[e.lastSync?(s(),b(`span`,j,`synced `+a(e.lastSync),1)):v(``,!0),e.lastSync&&e.nextSync?(s(),b(`span`,he,`·`)):v(``,!0),e.nextSync?(s(),b(`span`,M,a(e.nextSync),1)):v(``,!0)])):e.size===`compact`&&e.photoCount!==void 0?(s(),b(`p`,N,a(e.photoCount)+` `+a(e.photoCount===1?`photo`:`photos`),1)):v(``,!0)]),y(C,{variant:e.size===`large`?`primary`:`icon-pill`,"aria-label":`Add photo to ${e.name}`,class:`frame-card__add-btn`,onClick:c[1]||=n=>t.$emit(`add-photo`,e.deviceId)},{default:x(()=>[e.size===`large`?(s(),b(`span`,P,`+ Add Photo`)):(s(),b(`span`,F,`+`))]),_:1},8,[`variant`,`aria-label`])])],2))}}),[[`__scopeId`,`data-v-608d39a4`]]),L=[`id`,`value`,`type`],R=[`for`],z=[`id`],ge=_(u({__name:`BaseInput`,props:{modelValue:{default:``},label:{},type:{default:`text`},error:{},id:{}},emits:[`update:modelValue`,`blur`],setup(e,{emit:t}){let r=e,i=t,c=f(()=>r.id??`input-${Math.random().toString(36).slice(2)}`);return(t,r)=>(s(),b(`div`,{class:o([`input-wrap`,{"input-wrap--error":!!e.error,"input-wrap--filled":!!e.modelValue}])},[d(`input`,n({id:c.value},t.$attrs,{value:e.modelValue,type:e.type,class:`input-wrap__field`,placeholder:` `,onInput:r[0]||=e=>i(`update:modelValue`,e.target.value),onBlur:r[1]||=e=>i(`blur`,e)}),null,16,L),d(`label`,{for:c.value,class:`input-wrap__label`},a(e.label),9,R),e.error?(s(),b(`p`,{key:0,id:`${c.value}-error`,class:`input-wrap__error`,role:`alert`},a(e.error),9,z)):v(``,!0)],2))}}),[[`__scopeId`,`data-v-c8235ab2`]]),B={class:`orientation-picker`,role:`radiogroup`,"aria-label":`Display orientation`},V=[`aria-checked`,`aria-label`,`onClick`],H=[`viewBox`],U=[`stroke`,`fill`],W=[`fill`],G={class:`orientation-opt__label`},K={class:`orientation-opt__sub`},_e=_(u({__name:`OrientationPicker`,props:{modelValue:{}},emits:[`update:modelValue`],setup(e){let t=[{value:`landscape`,label:`Landscape`,sub:`Ribbon at bottom`,viewBox:`0 0 48 48`,rect:{x:4,y:12,width:40,height:24},ribbon:{x:20,y:36,width:8,height:5}},{value:`portrait`,label:`Portrait`,sub:`Ribbon on left`,viewBox:`0 0 48 48`,rect:{x:12,y:4,width:24,height:40},ribbon:{x:7,y:20,width:5,height:8}}];return(r,i)=>(s(),b(`div`,B,[(s(),b(h,null,c(t,t=>d(`button`,{key:t.value,type:`button`,role:`radio`,"aria-checked":e.modelValue===t.value,"aria-label":t.label,class:o([`orientation-opt`,{"orientation-opt--active":e.modelValue===t.value}]),onClick:e=>r.$emit(`update:modelValue`,t.value)},[(s(),b(`svg`,{class:`orientation-opt__diagram`,viewBox:t.viewBox,fill:`none`,"aria-hidden":`true`},[d(`rect`,n({ref_for:!0},t.rect,{rx:`2`,stroke:e.modelValue===t.value?`var(--color-primary)`:`currentColor`,"stroke-width":`1.5`,fill:e.modelValue===t.value?`color-mix(in srgb, var(--color-primary) 12%, transparent)`:`var(--color-surface-2)`}),null,16,U),d(`rect`,n({ref_for:!0},t.ribbon,{fill:e.modelValue===t.value?`var(--color-primary)`:`var(--color-text-muted)`,rx:`1`}),null,16,W)],8,H)),d(`span`,G,a(t.label),1),d(`span`,K,a(t.sub),1)],10,V)),64))]))}}),[[`__scopeId`,`data-v-679dae08`]]),ve={class:`home-view`},ye={key:0,class:`home-view__loading`,"aria-live":`polite`},be={key:1,class:`home-view__empty`},xe={key:2,class:`home-view__single`},Se=[`aria-label`],Ce={class:`home-view__sheet-field`},we={class:`home-view__sheet-field`},Te={class:`home-view__sheet-field`},Ee={key:0,class:`home-view__times-mode`},De={class:`home-view__times-list`},Oe=[`value`,`onChange`],ke=[`value`],Ae=[`value`,`onChange`],je=[`value`],Me=[`value`,`onChange`],Ne=[`aria-label`,`onClick`],Pe={key:0,class:`home-view__times-empty`},Fe=[`label`],Ie=[`value`],Le={key:1,class:`home-view__interval-mode`},Re={class:`home-view__interval-input-row`},ze={class:`home-view__next-update`,"aria-live":`polite`},Be={class:`home-view__sheet-field`},Ve={class:`home-view__rotation-checkbox`},He={class:`home-view__remove-modal-card`},Ue={class:`home-view__remove-confirm-actions`},We=[`disabled`],Ge=[`disabled`],q=_(u({__name:`HomeView`,setup(n){function o(e){return e.wakeTimes.length>0?1440*60*1e3:e.rotationIntervalMinutes*6e4}function l(e){if(!e.lastSeenAt)return`offline`;let t=Date.now()-new Date(e.lastSeenAt).getTime(),n=o(e);return t<=n?`ok`:t<=2*n?`sync-fail`:`offline`}function u(e){if(!e.lastSeenAt)return null;let t=Date.now()-new Date(e.lastSeenAt).getTime();if(t<6e4)return`just now`;if(t<36e5)return`${Math.round(t/6e4)}m ago`;if(t<864e5)return`${Math.round(t/36e5)}h ago`;let n=Math.round(t/864e5);return n===1?`yesterday`:`${n} days ago`}function p(e){let t=Math.floor(e/60),n=e%60,r=t>=12?`PM`:`AM`,i=t%12;i===0&&(i=12);let a=n===0?``:`:${String(n).padStart(2,`0`)}`;return`${i}${a} ${r}`}function g(e,t){let n=new Intl.DateTimeFormat(`en-GB`,{timeZone:t,hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(e),r=parseInt(n.find(e=>e.type===`hour`)?.value??`0`,10),i=parseInt(n.find(e=>e.type===`minute`)?.value??`0`,10);return r*60+i}function _(e,t){if(e.length===0)return null;let n=g(new Date,t),r=null,i=1/0;for(let t of e){let e=t>n?t-n:1440+(t-n);e<i&&(i=e,r={minutes:t,today:t>n})}return r}function w(e){let t=null;if(e.nextPollExpectedAt)t=new Date(e.nextPollExpectedAt).getTime();else if(e.wakeTimes.length>0){let t=_(e.wakeTimes,e.timezone||`UTC`);return t?`next sync ~${p(t.minutes)} ${t.today?`today`:`tomorrow`}`:null}else if(e.lastSeenAt)t=new Date(e.lastSeenAt).getTime()+e.rotationIntervalMinutes*6e4;else return null;let n=t-Date.now();if(n<=0)return null;if(n<6e4)return`next sync in <1m`;if(n<36e5)return`next sync in ${Math.round(n/6e4)}m`;if(n<864e5){let n=e.timezone||`UTC`,r=g(new Date(t),n),i=Ze(new Date(t),n),a=i===0?`today`:i===1?`tomorrow`:`in ${i}d`;return`next sync ~${p(r)} ${a}`}return`next sync in ${Math.round(n/864e5)}d`}function T(e){return e.currentImageId?`/api/devices/${e.id}/preview?v=${e.currentImageId}`:void 0}let E=le(),D=ce(),O=S(),me=ue();pe(),ae(async()=>{await O.fetchDevices(),document.addEventListener(`visibilitychange`,k);let e=Number(D.query.setup);e&&($(e),E.replace({query:{...D.query,setup:void 0}}))}),e(()=>{document.removeEventListener(`visibilitychange`,k)});function k(){document.visibilityState===`visible`&&O.fetchDevices({silent:!0})}let A=i(null);function j(){return window.scrollY>0?!1:(A.value?.scrollTop??0)===0}async function he(){await O.fetchDevices({silent:!0})}function M(e){let t=document.createElement(`input`);t.type=`file`,t.accept=`image/jpeg,image/png,image/webp,image/gif`,t.onchange=()=>{let n=t.files?.[0];n&&(me.init(n,e),E.push(`/upload`))},t.click()}let N=[1,2,3,4,5,6,7,8,9,10,11,12],P=[0,5,10,15,20,25,30,35,40,45,50,55];function F(e){let t=Math.floor(e/60),n=e%60,r=t>=12?`PM`:`AM`,i=t%12;return i===0&&(i=12),{h:i,mm:n,p:r}}function L(e,t,n){let r=e%12;return n===`PM`&&(r+=12),r*60+t}let R=[{label:`Americas`,zones:[{value:`America/New_York`,label:`Eastern — New York, Toronto`},{value:`America/Chicago`,label:`Central — Chicago, Mexico City`},{value:`America/Denver`,label:`Mountain — Denver, Calgary`},{value:`America/Phoenix`,label:`Mountain (no DST) — Phoenix`},{value:`America/Los_Angeles`,label:`Pacific — Los Angeles, Vancouver`},{value:`America/Anchorage`,label:`Alaska — Anchorage`},{value:`Pacific/Honolulu`,label:`Hawaii — Honolulu`},{value:`America/Sao_Paulo`,label:`Brasília — São Paulo`},{value:`America/Argentina/Buenos_Aires`,label:`Argentina — Buenos Aires`},{value:`America/Bogota`,label:`Colombia — Bogotá`}]},{label:`Europe`,zones:[{value:`Europe/London`,label:`GMT/BST — London, Dublin`},{value:`Europe/Lisbon`,label:`WET/WEST — Lisbon`},{value:`Europe/Paris`,label:`CET/CEST — Paris, Brussels, Amsterdam`},{value:`Europe/Berlin`,label:`CET/CEST — Berlin, Vienna, Zurich`},{value:`Europe/Stockholm`,label:`CET/CEST — Stockholm, Oslo, Copenhagen`},{value:`Europe/Helsinki`,label:`EET/EEST — Helsinki, Tallinn, Riga`},{value:`Europe/Warsaw`,label:`CET/CEST — Warsaw, Prague, Budapest`},{value:`Europe/Rome`,label:`CET/CEST — Rome, Madrid`},{value:`Europe/Athens`,label:`EET/EEST — Athens, Bucharest`},{value:`Europe/Istanbul`,label:`TRT — Istanbul`},{value:`Europe/Moscow`,label:`MSK — Moscow`}]},{label:`Asia & Pacific`,zones:[{value:`Asia/Dubai`,label:`GST — Dubai, Abu Dhabi`},{value:`Asia/Karachi`,label:`PKT — Karachi, Islamabad`},{value:`Asia/Kolkata`,label:`IST — India`},{value:`Asia/Dhaka`,label:`BST — Dhaka, Bangladesh`},{value:`Asia/Bangkok`,label:`ICT — Bangkok, Jakarta, Hanoi`},{value:`Asia/Singapore`,label:`SGT — Singapore, Kuala Lumpur`},{value:`Asia/Shanghai`,label:`CST — Beijing, Shanghai, Taipei`},{value:`Asia/Seoul`,label:`KST — Seoul`},{value:`Asia/Tokyo`,label:`JST — Tokyo`},{value:`Australia/Sydney`,label:`AEDT/AEST — Sydney, Melbourne`},{value:`Australia/Brisbane`,label:`AEST (no DST) — Brisbane`},{value:`Australia/Perth`,label:`AWST — Perth`},{value:`Pacific/Auckland`,label:`NZDT/NZST — Auckland`}]},{label:`Africa & Middle East`,zones:[{value:`Africa/Cairo`,label:`EET — Cairo`},{value:`Africa/Nairobi`,label:`EAT — Nairobi, East Africa`},{value:`Africa/Johannesburg`,label:`SAST — Johannesburg`},{value:`Africa/Lagos`,label:`WAT — Lagos, West Africa`}]},{label:`UTC`,zones:[{value:`UTC`,label:`UTC — Coordinated Universal Time`}]}],z=i(!1),B=i(!1),V=i(!1),H=i(!1),U=i(null),W=i(``),G=i(`landscape`),K=i(`interval`),q=i([]),J=i(60),Y=i(`UTC`),X=i(`oldest_upload`),Z=i(!1),Ke=[540,1080,720,1260,360,900,450,1170,0];function qe(){for(let e of Ke)if(!q.value.includes(e)){q.value=[...q.value,e];return}for(let e=0;e<1440;e+=5)if(!q.value.includes(e)){q.value=[...q.value,e];return}}function Je(e){q.value=q.value.filter((t,n)=>n!==e)}function Q(e,t,n){let r=F(q.value[e]),i=t===`h`?parseInt(n,10):r.h,a=t===`mm`?parseInt(n,10):r.mm,o=t===`p`?n:r.p,s=[...q.value];s[e]=L(i,a,o),q.value=s}let Ye=f(()=>{let e=U.value;if(!e)return``;let t=e.timezone||`UTC`,n;if(e.nextPollExpectedAt)n=new Date(e.nextPollExpectedAt).getTime();else if(e.lastSeenAt){let r=new Date(e.lastSeenAt).getTime();n=e.wakeTimes.length>0?Xe(r,e.wakeTimes,t):r+e.rotationIntervalMinutes*6e4}else return`Next update: when the frame next connects`;return n<Date.now()&&(n=Date.now()),Qe(n,t)});function Xe(e,t,n){let r=g(new Date(e),n),i=1/0;for(let e of t){let t=e-r;t<=0&&(t+=1440),t<i&&(i=t)}return e+i*6e4}function Ze(e,t){let n=new Intl.DateTimeFormat(`en-CA`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`}),r=Date.parse(n.format(new Date)+`T00:00:00Z`),i=Date.parse(n.format(e)+`T00:00:00Z`);return Math.round((i-r)/864e5)}function Qe(e,t){let n=e-Date.now();if(n<=0)return`Next update: any moment`;if(n<9e4)return`Next update: in <1 min`;if(n<36e5)return`Next update: in ~${Math.round(n/6e4)} min`;let r=g(new Date(e),t),i=Ze(new Date(e),t),a=i===0?`today`:i===1?`tomorrow`:`in ${i} days`;return`Next update: ~${p(r)} ${a}`}function $(e){let t=O.devices.find(t=>t.id===e);t&&(U.value=t,W.value=t.name,G.value=t.orientation,Y.value=t.timezone??`UTC`,J.value=t.rotationIntervalMinutes,q.value=[...t.wakeTimes],K.value=t.wakeTimes.length>0?`times`:`interval`,X.value=t.rotationMode,Z.value=t.prioritizeNeverShown,H.value=!1,z.value=!0)}async function $e(){if(U.value){V.value=!0;try{await O.removeDevice(U.value.id),z.value=!1,H.value=!1}finally{V.value=!1}}}async function et(){if(U.value){B.value=!0;try{let e={name:W.value.trim()||U.value.name,orientation:G.value,timezone:Y.value,rotationMode:X.value,prioritizeNeverShown:Z.value};K.value===`times`?e.wakeTimes=[...q.value]:(e.wakeTimes=[],e.rotationIntervalMinutes=Math.max(1,Math.min(1440,J.value||1))),await O.updateDevice(U.value.id,e),z.value=!1}finally{B.value=!1}}}return(e,n)=>(s(),b(h,null,[d(`main`,ve,[y(fe,{"is-at-top":j,"on-refresh":he},{default:x(()=>[r(O).loading?(s(),b(`div`,ye,` Loading… `)):r(O).devices.length===0?(s(),b(`div`,be,[...n[11]||=[d(`div`,{class:`home-view__empty-card`},[d(`svg`,{class:`home-view__empty-icon`,width:`48`,height:`48`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"aria-hidden":`true`},[d(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),d(`circle`,{cx:`8.5`,cy:`8.5`,r:`1.5`}),d(`polyline`,{points:`21,15 16,10 5,21`})]),d(`p`,{class:`home-view__empty-title`},`Set up your first frame`),d(`p`,{class:`home-view__empty-sub`},` Power on your pictureFrame device and scan the QR code it displays to get started. `)],-1)]])):r(O).devices.length===1?(s(),b(`div`,xe,[y(I,{deviceId:r(O).devices[0].id,name:r(O).devices[0].name,size:`large`,status:l(r(O).devices[0]),orientation:r(O).devices[0].orientation,thumbnailUrl:T(r(O).devices[0]),lastSync:u(r(O).devices[0]),nextSync:w(r(O).devices[0]),onAddPhoto:M,onEdit:$},null,8,[`deviceId`,`name`,`status`,`orientation`,`thumbnailUrl`,`lastSync`,`nextSync`])])):(s(),b(`div`,{key:3,ref_key:`stackEl`,ref:A,class:`home-view__stack`,role:`list`,"aria-label":`Frames`},[(s(!0),b(h,null,c(r(O).devices,e=>(s(),b(`div`,{key:e.id,class:`home-view__slide`,role:`listitem`,"aria-label":e.name},[y(I,{deviceId:e.id,name:e.name,size:`large`,status:l(e),orientation:e.orientation,thumbnailUrl:T(e),lastSync:u(e),nextSync:w(e),onAddPhoto:M,onEdit:$},null,8,[`deviceId`,`name`,`status`,`orientation`,`thumbnailUrl`,`lastSync`,`nextSync`])],8,Se))),128))],512))]),_:1})]),y(de,{modelValue:z.value,"onUpdate:modelValue":n[8]||=e=>z.value=e,label:`Frame settings`},{default:x(()=>[n[24]||=d(`h2`,{class:`home-view__sheet-title`},`Frame settings`,-1),d(`div`,Ce,[y(ge,{modelValue:W.value,"onUpdate:modelValue":n[0]||=e=>W.value=e,label:`Frame name`,maxlength:`100`},null,8,[`modelValue`])]),d(`div`,we,[n[12]||=d(`p`,{class:`home-view__sheet-label`},`Orientation`,-1),y(_e,{modelValue:G.value,"onUpdate:modelValue":n[1]||=e=>G.value=e},null,8,[`modelValue`])]),d(`div`,Te,[n[19]||=d(`p`,{class:`home-view__sheet-label`},`Update frequency`,-1),t(d(`select`,{class:`home-view__mode-select`,"onUpdate:modelValue":n[2]||=e=>K.value=e,"aria-label":`Update frequency mode`},[...n[13]||=[d(`option`,{value:`times`},`At specific time(s)`,-1),d(`option`,{value:`interval`},`Every X minutes`,-1)]],512),[[m,K.value]]),K.value===`times`?(s(),b(`div`,Ee,[d(`div`,De,[(s(!0),b(h,null,c(q.value,(e,t)=>(s(),b(`div`,{key:t,class:`home-view__time-row`},[d(`select`,{class:`home-view__time-part`,value:F(e).h,"aria-label":`Hour`,onChange:e=>Q(t,`h`,e.target.value)},[(s(),b(h,null,c(N,e=>d(`option`,{key:e,value:e},a(e),9,ke)),64))],40,Oe),n[16]||=d(`span`,{class:`home-view__time-sep`},`:`,-1),d(`select`,{class:`home-view__time-part`,value:F(e).mm,"aria-label":`Minutes`,onChange:e=>Q(t,`mm`,e.target.value)},[(s(),b(h,null,c(P,e=>d(`option`,{key:e,value:e},a(String(e).padStart(2,`0`)),9,je)),64))],40,Ae),d(`select`,{class:`home-view__time-part home-view__time-part--ampm`,value:F(e).p,"aria-label":`AM or PM`,onChange:e=>Q(t,`p`,e.target.value)},[...n[14]||=[d(`option`,{value:`AM`},`AM`,-1),d(`option`,{value:`PM`},`PM`,-1)]],40,Me),d(`button`,{type:`button`,class:`home-view__time-remove`,"aria-label":`Remove ${p(e)}`,onClick:e=>Je(t)},[...n[15]||=[d(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[d(`polyline`,{points:`3 6 5 6 21 6`}),d(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),d(`path`,{d:`M10 11v6`}),d(`path`,{d:`M14 11v6`})],-1)]],8,Ne)]))),128)),q.value.length===0?(s(),b(`p`,Pe,`No update times yet — add one below.`)):v(``,!0)]),d(`button`,{type:`button`,class:`home-view__time-add`,onClick:qe},`+ Add time`),t(d(`select`,{class:`home-view__tz-select`,"onUpdate:modelValue":n[3]||=e=>Y.value=e},[(s(),b(h,null,c(R,e=>d(`optgroup`,{key:e.label,label:e.label},[(s(!0),b(h,null,c(e.zones,e=>(s(),b(`option`,{key:e.value,value:e.value},a(e.label),9,Ie))),128))],8,Fe)),64))],512),[[m,Y.value]])])):(s(),b(`div`,Le,[d(`div`,Re,[n[17]||=d(`span`,null,`Every`,-1),t(d(`input`,{type:`number`,inputmode:`numeric`,pattern:`[0-9]*`,min:`1`,max:`1440`,class:`home-view__interval-input`,"onUpdate:modelValue":n[4]||=e=>J.value=e,"aria-label":`Update interval in minutes`},null,512),[[se,J.value,void 0,{number:!0}]]),n[18]||=d(`span`,null,`minutes`,-1)])])),d(`p`,ze,a(Ye.value),1),n[20]||=d(`p`,{class:`home-view__propagation-note`},` Changes will only take effect at the next device update. To force an immediate refresh, briefly disconnect and reconnect the frames power. `,-1)]),d(`div`,Be,[n[23]||=d(`p`,{class:`home-view__sheet-label`},`Image selection`,-1),t(d(`select`,{class:`home-view__mode-select`,"onUpdate:modelValue":n[5]||=e=>X.value=e,"aria-label":`Image selection mode`},[...n[21]||=[d(`option`,{value:`oldest_upload`},`Oldest upload first`,-1),d(`option`,{value:`newest_upload`},`Newest upload first`,-1),d(`option`,{value:`least_recently_shown`},`Least recently shown`,-1),d(`option`,{value:`random`},`Random`,-1)]],512),[[m,X.value]]),d(`label`,Ve,[t(d(`input`,{type:`checkbox`,"onUpdate:modelValue":n[6]||=e=>Z.value=e},null,512),[[re,Z.value]]),n[22]||=d(`span`,null,`Show never-shown images first`,-1)])]),y(C,{variant:`primary`,class:`home-view__sheet-save`,disabled:B.value,onClick:et},{default:x(()=>[ne(a(B.value?`Saving…`:`Save`),1)]),_:1},8,[`disabled`]),d(`button`,{type:`button`,class:`home-view__remove`,onClick:n[7]||=e=>H.value=!0},`Remove this frame`)]),_:1},8,[`modelValue`]),(s(),ee(oe,{to:`body`},[y(te,{name:`home-view__remove-modal`},{default:x(()=>[H.value?(s(),b(`div`,{key:0,class:`home-view__remove-modal`,role:`alertdialog`,"aria-labelledby":`remove-confirm-title`,onClick:n[10]||=ie(e=>H.value=!1,[`self`])},[d(`div`,He,[n[25]||=d(`p`,{class:`home-view__remove-confirm-title`,id:`remove-confirm-title`},` Remove this frame? `,-1),n[26]||=d(`p`,{class:`home-view__remove-confirm-body`},` Use this if youre selling or giving away the frame. It deletes this frame from your account and unlinks it from your photos so the next owner can claim it fresh. This cant be undone. `,-1),n[27]||=d(`p`,{class:`home-view__remove-confirm-aside`},` On the frame itself, the new owner can also do a factory reset by holding the small button on the back until the screen starts to flash. (If they only tap it briefly, the frame just refreshes its current image — keep holding until it flashes.) `,-1),d(`div`,Ue,[d(`button`,{type:`button`,class:`home-view__remove-cancel`,disabled:V.value,onClick:n[9]||=e=>H.value=!1},`Cancel`,8,We),d(`button`,{type:`button`,class:`home-view__remove-confirm-btn`,disabled:V.value,onClick:$e},a(V.value?`Removing…`:`Yes, remove`),9,Ge)])])])):v(``,!0)]),_:1})]))],64))}}),[[`__scopeId`,`data-v-31f99454`]]);export{q as default};