@tinycloud/web-sdk 3.8.0-beta.9 → 3.8.0

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/panel.cjs CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{mountPanel:()=>Jt});const n=["overview","local","copy","delegations","nodes","storage","activity"],o=require("./panel-data.cjs"),a="tinycloud-ui-panel",i='\n.glance{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}\n.glance-row{display:flex;align-items:center;gap:14px;width:100%;min-height:56px;padding:6px 6px 6px 0;border:0;border-bottom:1px solid #e4e4e7;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}\n.glance-row:last-child{border-bottom:0}\n.glance-row .gl{flex:1;min-width:0}\n.glance-row .gl b{display:block;font-size:14.5px;font-weight:600}\n.glance-row .gl span{display:block;font-size:13px;color:#71717a}\n.glance-row .gr{display:flex;align-items:center;gap:10px;color:#71717a}\n.glance-row .gr .ui-ic{width:16px;height:16px}\n.glance-row .gi{display:inline-flex;flex:none;color:#71717a}\n.glance-row .gi .ui-ic{width:20px;height:20px}\n.ui-ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}\n.st{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;white-space:nowrap}\n.st .dot{top:auto;right:auto;width:9px;height:9px;border:0;border-radius:50%;background:transparent;flex:none;position:relative}\n.st-ok{color:#18181b}\n.st-ok .dot{background:currentColor}\n.st-warn{color:#92400e}\n/* Warning colour from the mockup (panel-mock index.html: --tc-color-warning #b35309 light line 34, #fbbd23 dark line 57; .st-warn .dot line 259). */\n.st-warn .dot{background:#b35309;box-shadow:0 0 0 1.5px #fff,0 0 0 2.5px #b35309}\n.st-off,.st-info{color:#71717a}\n.st-off .dot,.st-info .dot{box-shadow:inset 0 0 0 2px currentColor}\n.st-info .dot::after{content:"";position:absolute;left:-1px;right:-1px;top:3.5px;height:2px;background:currentColor;transform:rotate(-45deg)}\n.drawer{margin-top:12px;padding:14px 16px;border:1px solid #d4d4d8;border-radius:12px;background:#fafafa}\n.drawer>h3{margin:0 0 8px;font-size:15px;font-weight:600;overflow-wrap:anywhere}\n@media (prefers-color-scheme: dark){\n.glance-row{border-bottom-color:#3f3f46}\n.glance-row .gl span,.glance-row .gr{color:#a1a1aa}\n.drawer{border-color:#3f3f46;background:#151517}\n.st-ok{color:#fafafa}\n.st-warn{color:#fcd34d}\n.st-warn .dot{background:#fbbd23;box-shadow:0 0 0 1.5px #151517,0 0 0 2.5px #fbbd23}\n.st-off,.st-info{color:#a1a1aa}\n}\n';function s(e){const t=document.createElement("button");return t.type="button",t.className="action",t.textContent=e,t}let r=0;function c(e){const t=document.createElement("div");t.className="confirm",t.setAttribute("role","alertdialog");const n="tc-confirm-q-"+ ++r;t.setAttribute("aria-describedby",n),t.addEventListener("keydown",t=>{"Escape"===t.key&&(t.stopPropagation(),i.disabled||c.disabled||e.onCancel())});const o=document.createElement("p");o.className="busy",o.id=n,o.textContent=e.question;const a=document.createElement("div");a.className="actions";const i=s(e.cancelLabel);i.addEventListener("click",e.onCancel);const c=s(e.confirmLabel);return c.addEventListener("click",e.onConfirm),a.append(i,c),t.append(o,a),{el:t,cancel:i,confirm:c}}const l={monitor:'<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/>',sync:'<path d="M4 12a8 8 0 0 1 14-5l2 2M20 4v5h-5M20 12a8 8 0 0 1-14 5l-2-2M4 20v-5h5"/>',key:'<circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M17 6l3 3M14 9l2 2"/>',nodes:'<circle cx="6" cy="6" r="2.5"/><circle cx="18" cy="6" r="2.5"/><circle cx="12" cy="18" r="2.5"/><path d="M8.5 6h7M7.2 8.2l3.6 7.6M16.8 8.2l-3.6 7.6"/>',drive:'<rect x="3" y="13" width="18" height="7" rx="2"/><path d="M3 13l3-8h12l3 8M7 16.5h.01"/>',term:'<rect x="3" y="4" width="18" height="16" rx="3"/><path d="M7 10l3 2-3 2M13 15h4"/>',chev:'<path d="M9 5l7 7-7 7"/>',ext:'<path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>',sidebar:'<rect x="3" y="4" width="18" height="16" rx="3"/><path d="M15 4v16"/>',out:'<path d="M10 4H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h5M16 8l4 4-4 4M20 12H9"/>',copy:'<rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a1 1 0 0 1 1-1h10"/>',check:'<path d="M5 12l5 5 9-10"/>',warn:'<path d="M12 3l10 18H2zM12 10v5M12 18h.01"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>',close:'<path d="M6 6l12 12M18 6L6 18"/>',person:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-6 8-6s8 2 8 6"/>',eyeoff:'<path d="M3 12s3.5-6 9-6 9 6 9 6-3.5 6-9 6-9-6-9-6zM4 4l16 16"/>'};function d(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("class","ui-ic"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.innerHTML=l[e],t}function p(e){const t=document.createElement("span");t.className=`st st-${e.tone}`;const n=document.createElement("span");n.className="dot",n.setAttribute("aria-hidden","true");const o=document.createElement("span");return o.textContent=e.text,t.append(n,o),t}function u(e){const t=document.createElement("button");t.type="button",t.className="glance-row",t.addEventListener("click",e.onOpen);const n=document.createElement("span");n.className="gi",n.append(d(e.icon));const o=document.createElement("span");o.className="gl";const a=document.createElement("b");a.textContent=e.label;const i=document.createElement("span");i.textContent=e.sublabel,o.append(a,i);const s=document.createElement("span");return s.className="gr",void 0!==e.status&&s.append(p(e.status)),s.append(d("chev")),t.append(n,o,s),t}function g(e,t){const n=e.querySelector(".gr");null!==n&&(n.querySelector(".st")?.remove(),void 0!==t&&n.prepend(p(t)))}const f={"panel.title":"TinyCloud","panel.close":"Close","panel.hide":"Hide button","panel.sections":"Sections","panel.in":"in","panel.back":"Back to","section.placeholder":"Not available yet.","view.loading":"Loading…","view.error":"This didn't load.","view.retry":"Try again","view.permission":"This session can't show this yet.","nodes.kind.hosted":"Hosted","nodes.status.down":"Down","nodes.version":"Version","nodes.latency":"Latency","activity.empty":"No requests yet.","nav.account":"Overview","nav.local-tinycloud":"Local TinyCloud","nav.local-copy":"Local copy","nav.delegations":"Delegations","nav.nodes":"Nodes","nav.storage":"Storage","nav.activity":"Activity","button.aria":"TinyCloud settings","status.storage_full":"Storage is full","status.sync_pending":"Erase not confirmed","status.sync_attention":"Local copy needs attention","storage.state.full":"Storage is full","storage.declined":"You declined. Storage usage stays hidden.","storage.try_again":"Try again","storage.unavailable":"Storage usage isn't available here.","storage.manage":"Manage storage","storage.full":"Storage is full. Free up space or upgrade to keep saving.","sync.wipe.note":"Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","sync.error.declined":"You declined. The local copy stays off.","sync.error.unsupported":"This browser can't keep a local copy.","sync.error.failed":"That didn't work. Try again.","sync.reason.unsupported-browser":"This browser can't keep a local copy.","sync.reason.no-eligible-scope":"No space on this TinyCloud account can keep a local copy.","sync.reason.consent-declined":"You declined. The local copy stays off.","sync.reason.storage-blocked":"This browser blocks the storage the local copy needs.","sync.reason.erase-pending":"The last erase is not confirmed yet.","sync.reason.budget-reached":"This device's local copy has reached its size limit.","sync.reason.signed-out":"Sign in to use the local copy.","sync.reason.stale-tab":"Another tab changed this. Reload to continue.","sync.reason.wipe-failed":"Erase didn't finish. The local copy may still be on this device.","sync.reason.session-expired":"Your session expired. Sign in again.","sync.reason.unknown":"Something went wrong with the local copy.","toast.done":"Done","toast.signed_in":"Successfully signed in","toast.attention":"Something needs your attention. Details are in the console.","toast.error_generic":"Something went wrong.","toast.unexpected_error":"An unexpected error occurred. Try refreshing the page.","toast.space_created":"TinyCloud Space created successfully","toast.space_creation_timeout":"Setting up your TinyCloud Space timed out","toast.space_creation_failed":"Failed to create your TinyCloud Space","toast.error.auth.wallet_not_connected":"Please connect your wallet to continue","toast.error.auth.signature_rejected":"Signature was rejected. Please try again","toast.error.auth.chain_mismatch":"Please switch to the correct network","toast.error.storage.upload_failed":"Failed to upload file. Please check your connection","toast.error.storage.insufficient_space":"Insufficient storage space available","toast.error.storage.permission_denied":"Permission denied. Please check your access rights","toast.error.network.connection_failed":"Network connection failed. Please try again","toast.error.network.timeout":"Request timed out. Please try again","toast.error.wasm.initialization_failed":"Failed to initialize security module"};function m(e){return t=e,Object.prototype.hasOwnProperty.call(f,t)?f[e]:f["sync.reason.unknown"];var t}const h={"panel.full_page":"Open full page","panel.sidebar":"Show as sidebar","toast.dismiss":"Dismiss","toast.copy_receipt":"Copy receipt","toast.copied":"Copied","toast.copy_failed":"Couldn't copy. Select the text and copy it by hand.","section.status.checking":"Checking","section.status.needs_permission":"Needs permission","section.status.unavailable":"Unavailable"},y=new Map;function x(e){for(const[t,n]of Object.entries(e))y.set(t,n)}function b(e,t={}){return(Object.prototype.hasOwnProperty.call(h,e)?h[e]:y.get(e)??m(e)).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}const v="http://www.w3.org/2000/svg",w={page:"M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7",drawer:"M6 4h12a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3zM15 4v16"},k={page:"panel.full_page",drawer:"panel.sidebar"};function C(e){const t=document.createElement("div");t.id=a,t.className="panel",t.dataset.layout="drawer",t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.setAttribute("aria-label",b("button.aria")),t.hidden=!0;let n,o="drawer",i=!1,s="page",r=!1;const c=document.createElement("h2");c.className="title",c.textContent=b("panel.title");const l=document.createElement("span");l.className="ctx",l.hidden=!0;const p=document.createElement("div");p.className="brand",p.append(c,l);const u=document.createElement("span");u.className="status",u.hidden=!0;const g=document.createElementNS(v,"svg");g.setAttribute("viewBox","0 0 24 24"),g.setAttribute("aria-hidden","true");const f=document.createElementNS(v,"path");g.append(f);const m=document.createElement("span"),h=document.createElement("button");h.type="button",h.className="action layout-switch",h.append(g,m),h.addEventListener("click",()=>e.onLayout(s)),h.hidden=!0;const y=document.createElement("button");y.type="button",y.addEventListener("click",()=>e.onClose());const x=document.createElement("span"),C=document.createElementNS(v,"svg");C.setAttribute("viewBox","0 0 24 24"),C.setAttribute("aria-hidden","true");const E=document.createElementNS(v,"path");function N(){if("drawer"===o||i)return y.className="icon-btn ring",y.setAttribute("aria-label",b("panel.close")),void y.replaceChildren(C);y.className="action",x.textContent=void 0===n?b("panel.close"):`${b("panel.back")} ${n}`,y.setAttribute("aria-label",x.textContent),y.replaceChildren(x)}E.setAttribute("d","M6 6l12 12M18 6L6 18"),C.append(E),N();const _=`${a}-menu`,A=document.createElement("button");A.type="button",A.className="icon-btn ring menu-btn",A.setAttribute("aria-label",b("panel.sections")),A.setAttribute("aria-controls",_),A.setAttribute("aria-expanded","false");const S=document.createElementNS(v,"svg");S.setAttribute("viewBox","0 0 24 24"),S.setAttribute("aria-hidden","true");const T=document.createElementNS(v,"path");T.setAttribute("d","M4 7h16M4 12h16M4 17h16"),S.append(T),A.append(S);const L=document.createElement("div");L.id=_,L.className="menu",L.hidden=!0;const M=document.createElement("div");M.className="menu-wrap",M.append(A,L);const z=document.createElement("div");z.className="head-actions",z.append(M,h,y);const $=document.createElement("header");$.className="head",$.append(p,u,z);const O=document.createElement("nav");O.className="nav",O.setAttribute("aria-label",b("panel.sections"));const D=new Map,q=document.createElement("div");function B(e){r=e,L.hidden=!e,A.setAttribute("aria-expanded",String(e))}return q.className="main",t.append($,O,q),A.addEventListener("click",()=>{if(r)return void B(!1);B(!0);const e=L.querySelector('[aria-current="page"]')??L.querySelector("button");e?.focus()}),M.addEventListener("focusout",e=>{r&&(M.contains(e.relatedTarget)||B(!1))}),t.addEventListener("keydown",t=>{if("Escape"===t.key){if(t.stopPropagation(),r)return A.focus(),void B(!1);e.onEscape()}}),{el:t,main:q,setOpen(e){t.hidden=!e,t.setAttribute("aria-modal",String(e&&"drawer"===o&&!i)),e||B(!1)},setLayout(e,n){var a;o=e,i=n.phone,t.dataset.layout=e,t.setAttribute("aria-modal",String(!t.hidden&&"drawer"===e&&!i)),s="drawer"===e?"page":"drawer",a=s,f.setAttribute("d",w[a]),m.textContent=b(k[a]),h.hidden=!n.showLayoutToggle,i||B(!1),N()},setAppLabel(e){n=e,l.hidden=void 0===e,l.textContent=void 0===e?"":`${b("panel.in")} ${e}`,N()},setNav(t,n){const o=new Set(t.map(e=>e.id));for(const[e,t]of D)o.has(e)||(t.btn.remove(),t.pick.remove(),D.delete(e));t.forEach((t,o)=>{let a=D.get(t.id);a||(a=function(t){const n=document.createElement("button");n.type="button",n.className="nav-i",n.dataset.section=t.id;const o=document.createElement("span");o.className="nav-n",o.setAttribute("aria-hidden","true");const a=d(t.icon);a.classList.add("nav-ic");const i=document.createElement("span");i.className="nav-l",i.textContent=b(t.labelCode);const s=document.createElement("span");s.className="nav-m",s.setAttribute("aria-hidden","true"),n.append(a,o,i,s),n.addEventListener("click",()=>e.onNavigate(t.id));const r=document.createElement("button");return r.type="button",r.className="menu-i",r.dataset.section=t.id,r.textContent=b(t.labelCode),r.addEventListener("click",()=>{return n=t.id,B(!1),e.onNavigate(n),void function(){const e=q.querySelector(".sec-title")??q.firstElementChild;e instanceof HTMLElement&&(e.tabIndex=-1,e.focus())}();var n}),{btn:n,index:o,meta:s,pick:r}}(t),D.set(t.id,a)),a.index.textContent=String(o+1).padStart(2,"0"),a.meta.textContent=t.meta??"",void 0===t.meta?a.btn.removeAttribute("aria-description"):a.btn.setAttribute("aria-description",t.meta),O.children[o]!==a.btn&&O.insertBefore(a.btn,O.children[o]??null),L.children[o]!==a.pick&&L.insertBefore(a.pick,L.children[o]??null);const i=t.id===n;for(const e of[a.btn,a.pick])i?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")})},setStatus(e){u.hidden=null===e,u.textContent=null===e?"":b(`status.${e}`)},focusFirst(){i?A.focus():(O.querySelector('[aria-current="page"]')??y).focus()}}}function E(e,t,n){return 0===e?-1:n?t<=0?e-1:t-1:t<0||t>=e-1?0:t+1}var N;const _=Symbol.for("tinycloud.web-sdk.prompt-state"),A=(N=globalThis)[_]??(N[_]={open:new Set,layer:void 0}),S="tinycloud-prompt-settled";function T(){for(const e of A.open)if(e.element?.isConnected&&!e.element.hidden)return!0;return!1}const L='button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),a[href],[tabindex]:not([tabindex="-1"])';function M(e){return"function"==typeof e.checkVisibility?e.checkVisibility({visibilityProperty:!0}):null===e.closest("[hidden]")}const z={info:"info",success:"check",warning:"warn",error:"warn"},$=7e3,O=3,D='\n.tstack{position:fixed;bottom:calc(var(--b) + 56px);display:flex;flex-direction:column;gap:10px;width:min(400px,calc(100vw - 24px));pointer-events:none}\n.layer[data-position="bottom-right"] .tstack{right:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position="bottom-left"] .tstack{left:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position="bottom-center"] .tstack{left:50%;transform:translateX(-50%)}\n.layer[data-panel-open][data-layout="drawer"] .tstack{bottom:12px;width:min(396px,calc(100vw - 24px))}\n.layer[data-panel-open][data-layout="drawer"][data-position="bottom-right"] .tstack{right:12px}\n.layer[data-panel-open][data-layout="drawer"][data-position="bottom-left"] .tstack{left:12px}\n.layer[data-panel-open][data-layout="page"] .tstack{bottom:24px;right:24px;left:auto;transform:none;width:min(420px,calc(100vw - 32px))}\n.layer[data-phone][data-panel-open] .tstack{bottom:calc(var(--b));left:12px;right:12px;transform:none;width:auto}\n.tstack>div{display:contents}\n.tstack .toast{display:flex;align-items:flex-start;gap:12px;box-sizing:border-box;padding:14px 8px 14px 16px;border:0;border-radius:16px;background:#fff;color:#111827;box-shadow:0 12px 32px -8px rgba(0,0,0,.3),0 0 0 1px #a1a1aa;pointer-events:auto;animation:tc-toast-in .45s cubic-bezier(.22,1,.36,1)}\n.tstack .toast__icon{display:inline-flex;flex:none;margin-top:12px}\n.tstack .toast__icon .ui-ic{width:20px;height:20px}\n.tstack .toast__body{flex:1;min-width:0;padding-top:12px;overflow-wrap:anywhere}\n.tstack .toast__title{display:block;font-weight:700}\n.tstack .toast a,.tstack .toast__copy{display:inline-flex;align-items:center;min-height:44px;margin-top:2px;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;text-decoration:underline;text-underline-offset:3px;white-space:nowrap;cursor:pointer}\n.tstack .toast__close{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.tstack .toast__close .ui-ic{width:20px;height:20px}\n.tstack .slip{margin-top:8px;padding:8px 0;border-top:2px dashed #71717a;border-bottom:2px dashed #71717a;font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;overflow-wrap:anywhere}\n.tstack .slip>div{display:block}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n@keyframes tc-toast-in{from{opacity:0;transform:translateY(14px)}}\n@media (prefers-reduced-motion:reduce){\n.tstack .toast{animation:none}\n}\n@media (prefers-color-scheme: dark){\n.tstack .toast{background:#151517;color:#fafafa;box-shadow:0 12px 32px -8px rgba(0,0,0,.6),0 0 0 1px #69696b}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n}\n';function q(e){const t=document.createElement("button");return t.type="button",t.className="toast__close",t.setAttribute("aria-label",b("toast.dismiss")),t.append(d("close")),t.addEventListener("click",e),t}function B(e){const t=document.createElement("div");t.className=`toast toast--${e}`,t.setAttribute("role","error"===e?"alert":"status");const n=document.createElement("span");n.className="toast__icon",n.append(d(z[e]));const o=document.createElement("div");o.className="toast__body";const a=document.createElement("div");return a.className="toast__message",o.append(a),t.append(n,o),{el:t,body:o,message:a}}const I='\n.glance-row:focus-visible,.nav-i:focus-visible,.action:focus-visible,.switch:focus-visible,.icon-btn:focus-visible,.menu-i:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n.panel{position:fixed;top:0;bottom:0;right:0;box-sizing:border-box;width:min(420px,100%);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:"head" "nav" "main";overflow:hidden;border-left:1px solid #e4e4e7;background:#fff;color:#111827;box-shadow:-18px 0 48px -18px rgba(0,0,0,.35);pointer-events:auto;animation:tc-in .42s cubic-bezier(.22,1,.36,1)}\n.layer[data-position="bottom-left"] .panel{left:0;right:auto;border-left:0;border-right:1px solid #e4e4e7;box-shadow:18px 0 48px -18px rgba(0,0,0,.35);animation-name:tc-in-l}\n.layer .panel[data-layout="page"]{top:0;bottom:0;left:0;right:0;width:auto;border:0;box-shadow:none;grid-template-rows:auto minmax(0,1fr);grid-template-columns:288px minmax(0,1fr);grid-template-areas:"head head" "nav main"}\n.head{grid-area:head;display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;min-height:68px;padding:14px 12px 10px 20px}\n.brand{display:flex;flex-direction:column;min-width:0;flex:1 0 92px}\n.title{margin:0;font-size:15px;font-weight:600}\n.ctx{overflow:hidden;font-size:12.5px;color:#71717a;text-overflow:ellipsis;white-space:nowrap}\n.head-actions{display:flex;flex-wrap:nowrap;align-items:center;min-width:0;flex-shrink:1;gap:6px}\n.head-actions .layout-switch{flex-shrink:0}\n.head-actions > .action{min-width:44px;overflow:hidden}\n.head-actions > .action span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.icon-btn{display:inline-flex;flex:none;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.icon-btn.ring{box-shadow:inset 0 0 0 1px #71717a}\n.icon-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}\n.status{font-size:12px;color:#4b5563}\n.nav{grid-area:nav;display:flex;flex-wrap:wrap;gap:6px;padding:6px 20px 14px}\n.nav-i{display:inline-flex;align-items:center;min-height:44px;padding:0 13px;border:0;border-radius:999px;background:#f4f4f5;color:#09090b;font:inherit;font-size:13.5px;font-weight:500;white-space:nowrap;cursor:pointer}\n.nav-i[aria-current="page"]{background:#fff;font-weight:700;box-shadow:inset 0 0 0 2px #09090b}\n.nav-n,.nav-ic,.nav-m{display:none}\n.main{grid-area:main;min-width:0;min-height:0;overflow:auto;overflow-wrap:anywhere;box-sizing:border-box;padding:24px 20px 56px;border-top:2px solid #09090b}\n.sec-title{margin:0 0 28px;font-family:"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;font-size:1.5rem;font-weight:400;line-height:1.2;letter-spacing:-.005em}\n.section+.section{margin-top:12px;padding-top:12px;border-top:1px solid #e4e4e7}\n.action{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:44px;min-height:44px;padding:0 20px;border:1px solid;border-color:#71717a;border-radius:999px;background:#fff;color:#09090b;font:inherit;font-size:13.5px;font-weight:700;white-space:nowrap;cursor:pointer}\n.action:hover{background:#f4f4f5}\n.layout-switch{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}\n.layout-switch[hidden]{display:none}\n.layout-switch svg{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}\n.row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px}\n.label{font-weight:500}\n.switch{display:inline-flex;align-items:center;width:56px;min-width:44px;height:44px;padding:0;border:0;background:none;cursor:pointer}\n.switch:disabled{cursor:default;opacity:.6}\n/* The mockup switch: a 56x30 track with a 1px #71717a edge (the .knob background, so it clears 3:1 on the panel) around a muted fill (::before), and a 22px thumb that is black when off and white on a black track when on. */\n.knob{position:relative;display:block;width:56px;height:30px;border-radius:999px;background:#71717a}\n.knob::before{content:"";position:absolute;inset:1px;border-radius:999px;background:#f4f4f5}\n.knob::after{content:"";position:absolute;top:4px;left:4px;width:22px;height:22px;border-radius:50%;background:#09090b;transition:transform .3s cubic-bezier(.22,1,.36,1)}\n.switch[aria-checked="true"] .knob{background:#09090b}\n.switch[aria-checked="true"] .knob::before{background:#09090b}\n.switch[aria-checked="true"] .knob::after{transform:translateX(26px);background:#fff}\n.busy,.note,.error{margin:6px 0 0;font-size:12px;color:#4b5563}\n.note{text-wrap:pretty}\n.action+.note,.note:not([hidden])+.action,.row~.action{margin-top:8px}\n.error{color:#111827}\n.confirm{margin-top:8px}\n.confirm .actions{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}\n.layer .panel[data-layout="page"] .head{padding:12px 24px;border-bottom:1px solid #e4e4e7;background:#fff}\n.layer .panel[data-layout="page"] .nav{flex-direction:column;flex-wrap:nowrap;width:288px;box-sizing:border-box;padding:24px 16px;border-right:1px solid #e4e4e7;background:#fafafa}\n.layer .panel[data-layout="page"] .nav-i{width:100%;min-height:48px;padding:0 12px;border-radius:14px;background:transparent;font-size:14.5px}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"]{background:#fff}\n.layer .panel[data-layout="page"] .nav-i{gap:8px}\n.layer .panel[data-layout="page"] .nav-ic{display:inline-block;width:16px;height:16px}\n.layer .panel[data-layout="page"] .nav-m{display:inline;max-width:90px;margin-left:auto;overflow:hidden;color:#71717a;font-size:12.5px;font-weight:400;text-overflow:ellipsis;white-space:nowrap}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"] .nav-m{color:#09090b}\n.layer .panel[data-layout="page"] .nav-n{display:inline-block;width:18px;font:500 11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;color:#71717a}\n.layer .panel[data-layout="page"] .main{padding:40px 40px 80px;border-top:0;max-width:960px;width:100%;margin:0 auto}\n.layer .panel[data-layout="page"] .sec-title{font-size:1.75rem;line-height:2.125rem;font-weight:600}\n@keyframes tc-in{from{transform:translateX(104%)}to{transform:none}}\n@keyframes tc-in-l{from{transform:translateX(-104%)}to{transform:none}}\n.menu-wrap{display:none;position:relative}\n.menu{position:absolute;top:calc(100% + 6px);right:0;z-index:2;box-sizing:border-box;width:min(280px,calc(100vw - 24px));padding:6px;border-radius:16px;background:#fff;box-shadow:inset 0 0 0 1px #e4e4e7,0 12px 32px -8px rgba(0,0,0,.3)}\n.menu[hidden]{display:none}\n.menu-i{display:flex;align-items:center;width:100%;min-height:44px;padding:0 12px;border:0;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;white-space:nowrap;cursor:pointer}\n.menu-i[aria-current="page"]{font-weight:700;background:#f4f4f5}\n.layer[data-phone] .menu-wrap{display:block}\n.layer[data-phone] .nav{display:none}\n.layer[data-phone] .panel[data-layout="page"]{grid-template-columns:minmax(0,1fr);grid-template-areas:"head" "main"}\n.layer[data-phone] .panel[data-layout="page"] .head{padding:12px 12px 12px 16px}\n.layer[data-phone] .panel[data-layout="page"] .main{padding:24px 16px 56px}\n.layer{--tc-color-overlay:rgb(9 9 11 / .4)}\n.scrim{position:fixed;inset:0;background:var(--tc-color-overlay);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .35s cubic-bezier(.22,1,.36,1),visibility 0s .35s}\n.layer[data-panel-open][data-layout="drawer"] .scrim{opacity:1;visibility:visible;pointer-events:auto;transition:opacity .35s cubic-bezier(.22,1,.36,1)}\n@media (prefers-reduced-motion:reduce){\n.panel,.knob::after,.scrim,.layer[data-panel-open][data-layout="drawer"] .scrim{animation:none;transition:none}\n}\n@media (prefers-color-scheme: dark){\n.layer{--tc-color-overlay:rgb(0 0 0 / .6)}\n.glance-row:focus-visible,.nav-i:focus-visible,.action:focus-visible,.switch:focus-visible,.icon-btn:focus-visible,.menu-i:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n.panel{border-left-color:#69696b;background:#151517;color:#fafafa}\n.main{border-top-color:#fafafa}\n.ctx,.status,.busy,.note{color:#a1a1aa}\n.nav-i{background:#27272a;color:#fafafa}\n.nav-i[aria-current="page"]{background:#151517;box-shadow:inset 0 0 0 2px #fafafa}\n.icon-btn.ring{box-shadow:inset 0 0 0 1px #71717a}\n.section+.section{border-top-color:#69696b}\n.action{border-color:#71717a;background:#151517;color:#fafafa}\n.action:hover{background:#27272a}\n.error{color:#fafafa}\n.knob::before{background:#27272a}\n.knob::after{background:#fafafa}\n.switch[aria-checked="true"] .knob{background:#fafafa}\n.switch[aria-checked="true"] .knob::before{background:#fafafa}\n.switch[aria-checked="true"] .knob::after{background:#09090b}\n.layer .panel[data-layout="page"] .head{background:#151517;border-bottom-color:#69696b}\n.layer .panel[data-layout="page"] .nav{background:#151517;border-right-color:#69696b}\n.layer .panel[data-layout="page"] .nav-i{background:transparent}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"]{background:#27272a}\n.layer .panel[data-layout="page"] .nav-n,.layer .panel[data-layout="page"] .nav-m{color:#a1a1aa}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"] .nav-m{color:#fafafa}\n.menu{background:#151517;box-shadow:inset 0 0 0 1px #69696b,0 12px 32px -8px rgba(0,0,0,.6)}\n.menu-i[aria-current="page"]{background:#27272a}\n}\n',j=()=>!0;function R(e){const t=document.createElement("h3");t.className="sec-title",t.textContent=m(`nav.${e.dataset.section??""}`);const n=document.createElement("p");return n.className="note",n.textContent=m("section.placeholder"),e.append(t,n),()=>{}}x({"account.copied":"DID copied","account.copy_failed":"Could not copy the DID","account.signed_out":"TinyCloud is signed out in this app. Sign in to see your account.","account.signed_in_as":"Signed in as","account.copy_did":"Copy your DID","account.hint":"Need more room? Choose Open full page, at the top, for these same sections on a full screen.","account.button.title":"This button","account.button.body":"TinyCloud shows a round button at the bottom right of {app}. If you'd rather open TinyCloud from the app's own settings, hide it.","account.button.app":"this app","account.button.dev.lead":"For developers.","account.button.dev.body":"Once the button is hidden, your app needs its own way back in: add a place in your settings that calls","account.button.dev.tail":"TinyCloud doesn't bring the button back on its own.","account.loading":"Loading account…","account.unavailable":"Account details are unavailable.","account.session.label":"Session","account.session.expires":"Expires in {hours}h {minutes}m","account.app.label":"You're in","account.glance.title":"At a glance","account.signout.button":"Sign out","account.signout.question":"Sign out of TinyCloud on this device?","account.signout.cancel":"Stay signed in","account.signout.confirm":"Sign out","account.signout.busy":"Signing out…","account.signout.failed":"Sign-out failed. Try again.","account.status.signed_out":"Signed out"});const P='"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif',F='ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace',Y=`\n.account-hint{margin:-14px 0 28px;font-size:12.5px;line-height:1.4}\n.account-cols{display:grid;gap:28px 36px;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));align-items:start}\n.account-ident{display:flex;gap:16px;align-items:center;min-width:0}\n.account-avatar{flex:none;width:64px;height:64px;border-radius:50%;display:grid;place-items:center;font:500 30px/1 ${P};background:#09090b;color:#fff}\n.account-who{min-width:0}\n.account-ident .eyebrow{margin:0;font-size:13px;font-weight:600;line-height:1.3;color:#71717a}\n.account-ident .name{margin:0;font:500 1.375rem/1.2 ${P};overflow-wrap:anywhere}\n.account-idline{display:flex;flex-wrap:wrap;align-items:center;margin-top:2px;min-width:0}\n.account-did{min-width:0;font:.8125rem/1.5 ${F};color:#71717a;overflow-wrap:anywhere}\n.account-copy{flex:none}\n.account-copy .ui-ic{width:16px;height:16px;stroke-width:2}\n.account-kv{display:flex;flex-direction:column;margin:18px 0 0;padding:0}\n.account-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.account-kv>div:last-child{border-bottom:0}\n.account-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;white-space:nowrap}\n.account-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.account-kv dd{display:flex;flex:0 1 auto;align-items:center;justify-content:flex-end;gap:2px;max-width:78%;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.account-kv .account-host{margin-left:8px;font:400 .8125rem ${F};color:#71717a}\n.account-signout{margin-top:14px}\n.account-glance{display:flex;flex-direction:column;gap:0}\n.account-rule{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-size:13px;font-weight:600;line-height:1.3;letter-spacing:.02em}\n.account-rule::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.account-button{display:flex;flex-direction:column;align-items:flex-start;gap:12px;margin-top:28px}\n.account-button>*{margin:0}\n.account-button .account-rule{align-self:stretch;margin:0}\n.account-small{max-width:60ch;font-size:14px;line-height:1.45}\n.account-devnote{display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;width:100%;padding:14px 16px;border-radius:12px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:13.5px;line-height:1.5}\n.account-devnote .ui-ic{margin-top:2px;flex:none}\n.account-devnote code{padding:1px 6px;border-radius:6px;background:#f4f4f5;font:600 .8125rem ${F}}\n@media (prefers-color-scheme: dark){\n.account-avatar{background:#fafafa;color:#09090b}\n.account-ident .eyebrow,.account-did,.account-kv .account-host{color:#a1a1aa}\n.account-kv>div{border-bottom-color:#69696b}\n.account-kv dt::after{border-bottom-color:#71717a}\n.account-rule::after{background:#69696b}\n.account-devnote{box-shadow:inset 0 0 0 1px #69696b}\n.account-devnote code{background:#27272a}\n}\n`,W={id:"account",labelCode:"nav.account",icon:"person",isAvailable:j,status:e=>!0===e.client()?.signedIn()?void 0:{text:e.text("account.status.signed_out"),tone:"off"},mount:function(e,t){const n=t.client(),o=document.createElement("style");o.textContent=Y+i;const a=document.createElement("h3");a.className="sec-title",a.tabIndex=-1,a.textContent=t.text("nav.account"),e.append(o,a);let r,l,f=!1,m=0,h={state:"loading"},y=!1,x=!1;const b=document.createElement("p");b.className="note",b.textContent=t.text("account.signed_out");const v=document.createElement("p");v.className="account-hint",v.textContent=t.text("account.hint");const w=document.createElement("div");w.className="account-cols";const k=document.createElement("div"),C=document.createElement("div");C.className="account-ident";const E=document.createElement("div");E.className="account-avatar",E.setAttribute("aria-hidden","true");const N=document.createElement("div");N.className="account-who";const _=document.createElement("p");_.className="eyebrow",_.textContent=t.text("account.signed_in_as");const A=document.createElement("p");A.className="name";const S=document.createElement("div");S.className="account-idline";const T=document.createElement("span");T.className="account-did";const L=document.createElement("button");L.type="button",L.className="icon-btn account-copy",L.setAttribute("aria-label",t.text("account.copy_did")),L.append(d("copy")),S.append(T,L),N.append(_,A,S),C.append(E,N);const M=document.createElement("p");M.className="note";const z=document.createElement("dl");z.className="account-kv";const $=document.createElement("div"),O=document.createElement("dt");O.textContent=t.text("account.session.label");const D=document.createElement("dd");$.append(O,D);const q=document.createElement("div"),B=document.createElement("dt");B.textContent=t.text("account.app.label");const I=document.createElement("dd"),j=document.createTextNode(""),R=document.createElement("span");R.className="account-host",I.append(j,R),q.append(B,I),z.append($,q);const P=s(t.text("account.signout.button"));P.classList.add("account-signout"),P.prepend(d("out"));const F=document.createElement("p");F.className="note",F.textContent=t.text("account.signout.failed");const W=document.createElement("div");W.hidden=!0,k.append(C,M,z,P,F,W);const U=document.createElement("div"),H=document.createElement("h4");H.className="account-rule",H.textContent=t.text("account.glance.title");const V=document.createElement("div");V.className="glance account-glance";const G=[];for(const e of t.sections()){if("account"===e.id||void 0===e.summaryCode)continue;const n=u({icon:e.icon,label:t.text(e.labelCode),sublabel:t.text(e.summaryCode),onOpen:()=>t.openSection(e.id)});G.push({section:e,row:n}),V.append(n)}if(U.append(H,V),w.append(k,U),e.append(b,v,w),t.canHideButton()){const n=document.createElement("div");n.className="account-button";const o=document.createElement("h4");o.className="account-rule",o.textContent=t.text("account.button.title");const a=document.createElement("p");a.className="account-small",a.textContent=t.text("account.button.body").replace("{app}",t.appLabel()??t.text("account.button.app"));const i=s(t.text("panel.hide"));i.prepend(d("eyeoff")),i.addEventListener("click",()=>t.hideButton());const r=document.createElement("div");r.className="account-devnote";const c=document.createElement("b");c.textContent=t.text("account.button.dev.lead");const l=document.createElement("code");l.textContent="tc.ui.open()";const p=document.createElement("div");p.append(c,` ${t.text("account.button.dev.body")} `,l,`. ${t.text("account.button.dev.tail")}`),r.append(d("info"),p),n.append(o,a,i,r),e.append(n)}function K(){if(f)return;const e=!0===n?.signedIn();if(b.hidden=e,v.hidden=!e||"drawer"!==t.layout(),w.hidden=!e,!e)return;const o="ready"===h.state?h.data:void 0,a=void 0===o?n?.data?.knownDid?.():void 0,i=void 0===o?t.appLabel():void 0;if(M.hidden=void 0!==o,M.textContent="loading"===h.state?t.text("account.loading"):void 0===o?t.text("account.unavailable"):"",l=o?.did??a,C.hidden=void 0===l,z.hidden=void 0===o&&void 0===i,void 0!==l){const e=(s=l).length>26?`${s.slice(0,20)}…${s.slice(-4)}`:s,t=o?.displayName??e;A.textContent=t,A.title=void 0===o?.displayName?l:"",E.textContent=t.charAt(0).toUpperCase(),T.textContent=e,T.title=l,T.hidden=void 0===o?.displayName}var s;if($.hidden=void 0===o?.sessionExpiresAt,void 0!==o?.sessionExpiresAt){const{hours:e,minutes:n}=function(e,t){const n=Math.max(0,Math.ceil((e.getTime()-t)/6e4));return{hours:Math.floor(n/60),minutes:n%60}}(o.sessionExpiresAt,Date.now()),a=t.text("account.session.expires").replace("{hours}",String(e)).replace("{minutes}",String(n).padStart(2,"0"));D.replaceChildren(p({text:a,tone:"ok"}))}const r=o?.appName??i;q.hidden=void 0===r,void 0!==r&&(j.textContent=r),R.textContent=o?.appHost??"",R.hidden=void 0===o?.appHost,P.hidden=void 0===n?.signOut,P.disabled=y,F.hidden=!x}function X(){if(!f&&!0===n?.signedIn())for(const{section:e,row:n}of G)g(n,e.status(t))}function Z(){r=void 0,W.replaceChildren(),W.hidden=!0}async function J(){const e=++m,t=n?.data;if(!t)return h={state:"error",code:"unavailable"},void K();let o;h="ready"===h.state||"error"===h.state?h:{state:"loading"},K();try{o=await t.account()}catch{o={state:"error",code:"unknown"}}f||e!==m||(h=o,K())}P.addEventListener("click",()=>function(){if(r)return;const e=c({question:t.text("account.signout.question"),cancelLabel:t.text("account.signout.cancel"),confirmLabel:t.text("account.signout.confirm"),onCancel:()=>{Z(),P.focus()},onConfirm:()=>{!async function(){if(!n?.signOut||y)return;y=!0,x=!1,r&&(r.confirm.disabled=!0,r.cancel.disabled=!0,r.confirm.textContent=t.text("account.signout.busy")),K();let e=!0;try{await n.signOut()}catch{e=!1}if(y=!1,!f){if(Z(),e)return await J(),void a.focus();x=!0,K(),P.focus()}}()}});r=e,W.replaceChildren(e.el),W.hidden=!1,e.cancel.focus()}()),L.addEventListener("click",()=>{!async function(){if(void 0===l)return;const e=l,n=t.data.generation();let o=!0;try{await navigator.clipboard.writeText(e)}catch{o=!1}f||n!==t.data.generation()||t.toast(o?{kind:"success",textCode:"account.copied"}:{kind:"error",textCode:"account.copy_failed"})}()});const Q=n?.onReset(()=>{h={state:"loading"},J()}),ee=t.data.subscribe(X),te=n?.data?.subscribe(e=>{"overview"===e&&"error"===h.state&&J()}),ne=setInterval(K,6e4);return J(),X(),()=>{f=!0,clearInterval(ne),Q?.(),ee(),te?.(),e.replaceChildren()}}};x({"activity.summary":"Recent requests this session","activity.glance.no_errors":"No errors","activity.glance.errors":"{count} errors","activity.glance.clear":"Clear","activity.chip":"Developer mode","activity.lede":"Every request this app makes to TinyCloud, newest first. Only the first path segment is shown.","activity.devnote_title":"Developer mode is set by {app} in code,","activity.devnote":"in the SDK config. It isn't a user setting, and people using {app} never see this section.","activity.app_fallback":"this app","activity.count_of":" of {total} requests · ","activity.count_error_one":" error","activity.count_error_many":" errors","activity.cap":"Showing the newest {shown} requests.","activity.errors_only":"Errors only","activity.pause":"Pause live","activity.resume":"Resume live","activity.copy_all":"Copy all","activity.copy_one":"Copy request: {target} at {time}","activity.copied_one":"Request copied.","activity.copied_many":"Requests copied as text.","activity.copy_failed":"Could not copy. Select the text and copy it by hand.","activity.no_errors_table":"No errors. Everything this app asked for went through.","activity.table_label":"Request log","activity.col.time":"Time","activity.col.op":"Operation","activity.col.path":"Path","activity.col.space":"Space","activity.col.host":"Host","activity.col.bytes":"Bytes","activity.col.took":"Took","activity.col.result":"Result","activity.col.source":"Source","activity.col.copy":"Copy","activity.res_ok":"ok","activity.res_unknown":"unknown","activity.unavailable":"The request log can't be read right now.","activity.no_errors_unsure":"No failed requests in the log. Some requests have no recorded result.","activity.host_local":"this device","activity.node":"Node","activity.local_copy":"Local copy","activity.on":"On","activity.off":"Off"});const U="—",H='ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace',V=`\n.act-root{container:act/inline-size;min-width:0}\n.act-head{display:flex;flex-direction:column;gap:8px;margin:0 0 36px}\n.act-head-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 12px}\n.act-head .sec-title{margin:0}\n.act-chip{display:inline-flex;align-items:center;height:28px;padding:0 11px;border-radius:999px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:12.5px;font-weight:600;white-space:nowrap}\n.act-lede{margin:0;max-width:56ch;font-size:15px;line-height:1.5}\n.act-devnote{display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;margin:0 0 36px;padding:14px 16px;border-radius:12px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:13.5px;line-height:1.5}\n.act-devnote .ui-ic{margin-top:2px}\n.act-devnote p{margin:0}\n.act-tools{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin:0 0 36px}\n.act-count{margin:0;font-size:14px;line-height:1.45}\n.act-count b{font-weight:700}\n.act-chk{display:inline-flex;align-items:center;gap:10px;min-height:44px;font-size:14px;font-weight:600}\n.act-btns{display:flex;flex-wrap:wrap;align-items:center;gap:10px}\n.act-cap{margin:0 0 10px;font-size:12.5px;color:#71717a}\n.act-table{display:flex;flex-direction:column;border-radius:16px;box-shadow:inset 0 0 0 1px #e4e4e7;overflow:hidden;background:#ffffff}\n.act-ar{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:0 8px;padding:10px 4px 10px 12px;border-bottom:1px solid #e4e4e7;font-size:13px;font-variant-numeric:tabular-nums}\n.act-ar:last-child{border-bottom:0}\n.act-ar>*{min-width:0}\n.act-err{background:linear-gradient(90deg,#09090b 0 3px,transparent 3px)}\n.act-hd{display:none;background:#fafafa}\n.act-c-time{order:1;font-family:${H};font-size:12.5px;color:#71717a}\n.act-c-op{order:2;font-family:${H};font-weight:700;font-size:13px;overflow-wrap:anywhere}\n.act-c-path{order:3;font-family:${H};font-size:13px;overflow-wrap:anywhere}\n.act-c-res{order:4;display:inline-flex;align-items:center;gap:6px;font-weight:500;overflow-wrap:anywhere}\n.act-err .act-c-res{font-weight:700}\n.act-c-res .ui-ic{width:14px;height:14px}\n.act-err .act-c-res .ui-ic{color:#8a3f05}\n.act-c-source{order:4;font-size:12.5px;color:#71717a}\n.act-c-copy{order:5;display:flex;align-items:center;justify-content:center;width:44px;height:44px;margin:-9px -2px -9px auto}\n.act-br{order:6;flex-basis:100%;height:0}\n.act-c-space,.act-c-host,.act-c-bytes,.act-c-took{order:7;font-size:12.5px;color:#71717a;overflow-wrap:anywhere}\n.act-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.act-empty{padding:14px 16px;font-size:13.5px;color:#71717a}\n.act-facts{display:grid;gap:0 32px;grid-template-columns:minmax(0,1fr);margin:28px 0 0;padding:0}\n.act-facts>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.act-facts dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;white-space:nowrap}\n.act-facts dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.act-facts dd{margin:0;max-width:78%;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.act-facts .act-mono{font:600 .8125rem ${H}}\n@container act (min-width:720px){\n.act-tools{flex-direction:row;align-items:center;gap:20px}\n.act-count{margin-right:auto}\n.act-table{--act-cols:minmax(62px,70fr) minmax(64px,110fr) minmax(64px,100fr) minmax(64px,80fr) minmax(70px,150fr) minmax(58px,62fr) minmax(58px,64fr) minmax(84px,110fr) minmax(56px,56fr) 44px}\n.act-ar{display:grid;grid-template-columns:var(--act-cols);gap:0 8px;padding:0 6px 0 14px;min-height:48px}\n.act-ar>*{order:0!important}\n.act-c-copy{margin:0}\n.act-br{display:none}\n.act-c-bytes,.act-c-took{text-align:right}\n.act-hd{display:grid;min-height:40px}\n.act-hd>*{font:600 11px ${H}!important;letter-spacing:.08em;text-transform:uppercase;color:#71717a}\n.act-facts{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}\n}\n@media (prefers-reduced-motion:no-preference){\n.act-new{animation:act-in .5s cubic-bezier(.22,1,.36,1)}\n@keyframes act-in{from{opacity:0;transform:translateY(-8px);background-color:#f4f4f5}}\n}\n@media (prefers-color-scheme: dark){\n.act-chip,.act-devnote{box-shadow:inset 0 0 0 1px #69696b}\n.act-cap,.act-empty,.act-c-time,.act-c-source,.act-c-space,.act-c-host,.act-c-bytes,.act-c-took{color:#a1a1aa}\n.act-table{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.act-ar,.act-facts>div{border-bottom-color:#69696b}\n.act-err{background:linear-gradient(90deg,#fafafa 0 3px,transparent 3px)}\n.act-err .act-c-res .ui-ic{color:#fbbd23}\n.act-hd{background:#151517}\n.act-hd>*{color:#a1a1aa}\n.act-facts dt::after{border-bottom-color:#71717a}\n@media (prefers-reduced-motion:no-preference){\n@keyframes act-in{from{opacity:0;transform:translateY(-8px);background-color:#27272a}}\n}\n}\n`,G=/[\p{Cc}\p{Cf}\u2028\u2029]/gu,K=/^[A-Za-z0-9_.:-]{1,64}$/;function X(e,t){if("string"!=typeof e)return;const n=e.replace(G," ").trim();return""===n?void 0:n.slice(0,t)}function Z(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0?e:void 0}function J(e){if("object"!=typeof e||null===e)return;const t=e,n="number"==typeof t.id&&Number.isFinite(t.id)?String(t.id):X(t.id,64),o=X(t.code,64),a={key:"",at:"number"==typeof t.at&&Number.isFinite(t.at)?t.at:void 0,op:X(t.op,64)??U,path:X(t.path,256),space:X(t.space,64),host:X(t.host,128),bytes:Z(t.bytes),durationMs:Z(t.durationMs),ok:"boolean"==typeof t.ok?t.ok:void 0,code:void 0!==o&&K.test(o)?o:void 0,source:"replica"===t.source||"network"===t.source?t.source:void 0},i=[a.at,a.op,a.path,a.space,a.host,a.bytes,a.durationMs,a.ok,a.code,a.source];return{...a,key:n??`~${i.join("|")}`}}function Q(e){if(void 0===e)return;let t;try{t=e.snapshot()}catch{return}if(!Array.isArray(t))return;const n=[],o=new Map;for(const e of t){const t=J(e);if(void 0===t)continue;const a=o.get(t.key)??0;o.set(t.key,a+1),n.push(0!==a&&t.key.startsWith("~")?{...t,key:`${t.key}#${a}`}:t)}return n}function ee(e){const t=new Date(e),n=e=>String(e).padStart(2,"0");return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function te(e,t){let n=e("activity.res_unknown");!0===t.ok?n=e("activity.res_ok"):!1===t.ok&&(n=t.code??e("activity.res_unknown"));let o=U;return"replica"!==t.source&&"network"!==t.source||(o=t.source),[void 0===t.at?U:ee(t.at),t.op,t.path??U,t.space??U,t.host??("replica"===t.source?e("activity.host_local"):U),void 0===t.bytes?U:(a=t.bytes,a>=1048576?`${(a/1048576).toFixed(1)} MiB`:a>=1024?`${(a/1024).toFixed(1)} KiB`:`${a} B`),void 0===t.durationMs?U:`${t.durationMs} ms`,n,o];var a}let ne=0;const oe={id:"activity",labelCode:"nav.activity",icon:"term",summaryCode:"activity.summary",isAvailable:e=>e.developerMode(),status(e){const t=e.client()?.requests;if(void 0===t)return;const n=Q(t);if(void 0===n)return;const o=n.filter(e=>!1===e.ok).length;return o>0?{text:e.text("activity.glance.errors",{count:o}),tone:"warn"}:n.some(e=>void 0===e.ok)?void 0:{text:e.text("activity.glance.no_errors"),tone:"ok",count:e.text("activity.glance.clear")}},mount(e,t){const n=t.client()?.requests;return n?function(e,t,n){const o=t.text,a=document.createElement("div");a.className="act-root";const r=document.createElement("style");r.textContent=V+i;const c=document.createElement("div");c.className="act-head";const l=document.createElement("div");l.className="act-head-row";const p=document.createElement("h3");p.className="sec-title",p.tabIndex=-1,p.textContent=o("nav.activity");const u=document.createElement("span");u.className="act-chip",u.textContent=o("activity.chip"),l.append(p,u);const g=document.createElement("p");g.className="act-lede",g.textContent=o("activity.lede"),c.append(l,g);const f=t.appLabel()??o("activity.app_fallback"),m=document.createElement("div");m.className="act-devnote";const h=document.createElement("p"),y=document.createElement("b");y.textContent=o("activity.devnote_title",{app:f}),h.append(y,` ${o("activity.devnote",{app:f})}`),m.append(d("info"),h);const x=document.createElement("p");x.className="act-count";const b=document.createElement("b"),v=document.createTextNode(""),w=document.createElement("b"),k=document.createTextNode("");x.append(b,v,w,k);const C=document.createElement("span");C.id="act-eo-"+ ++ne,C.textContent=o("activity.errors_only");const E=document.createElement("button");E.type="button",E.className="switch",E.setAttribute("role","switch"),E.setAttribute("aria-labelledby",C.id);const N=document.createElement("span");N.className="knob",E.append(N);const _=document.createElement("label");_.className="act-chk",_.append(C,E);const A=s(o("activity.pause")),S=s(o("activity.copy_all"));S.prepend(d("copy"));const T=document.createElement("div");T.className="act-btns",T.append(A,S);const L=document.createElement("div");L.className="act-tools",L.append(x,_,T);const M=document.createElement("p");M.className="act-cap",M.hidden=!0;const z=document.createElement("div");z.className="act-table",z.setAttribute("role","table"),z.setAttribute("aria-label",o("activity.table_label"));const $=function(e){const t=document.createElement("div");t.className="act-ar act-hd",t.setAttribute("role","row");for(const[n,o]of ie)t.append(ae(n,"columnheader",e(o)));return t.append(ae("act-sr","columnheader",e("activity.col.copy"))),t}(o),O=document.createElement("div");O.className="act-empty",O.setAttribute("role","row");const D=document.createElement("span");D.setAttribute("role","cell"),O.append(D);const q=document.createElement("dl");q.className="act-facts";const B=document.createElement("div"),I=document.createElement("dt");I.textContent=o("activity.node");const j=document.createElement("dd");j.className="act-mono",B.append(I,j);const R=document.createElement("div"),P=document.createElement("dt");P.textContent=o("activity.local_copy");const F=document.createElement("dd");R.append(P,F),q.append(B,R),a.append(r,c,m,L,M,z,q),e.append(a);let Y,W,H=!1,G=n,K=!1,X=!1,Z=new Set;const J=new Map;let oe=[];function se(e){const t=te(o,e),n=document.createElement("div");n.className=!1===e.ok?"act-ar act-err":"act-ar",n.setAttribute("role","row"),ie.forEach(([o],a)=>{const i=t[a]??U;if("act-c-res"!==o)return void n.append(ae(o,"cell",i));const s=ae(o,"cell","");!1===e.ok&&s.append(d("warn")),s.append(i),n.append(s)});const a=document.createElement("span");a.className="act-c-copy",a.setAttribute("role","cell");const i=document.createElement("button");i.type="button",i.className="icon-btn";const s=void 0===e.path?e.op:`${e.op} ${e.path}`,r=void 0===e.at?U:ee(e.at);i.setAttribute("aria-label",o("activity.copy_one",{target:s,time:r})),i.append(d("copy")),i.addEventListener("click",()=>{le([e],"activity.copied_one")}),a.append(i);const c=document.createElement("span");return c.className="act-br",c.setAttribute("aria-hidden","true"),n.append(a,c),n}function re(){const e=function(){const e=t.data.latest("nodes");if("ready"!==e?.state)return;const n=e.data,o=n.find(e=>e.active)??n[0];if(void 0===o)return;const a=function(e){try{return new URL(e).host}catch{return e}}(o.origin);return void 0===o.version?a:`${a} · ${/^v/i.test(o.version)?o.version:`v${o.version}`}`}();B.hidden=void 0===e,void 0!==e&&(j.textContent=e);const n=t.client()?.sync;if(R.hidden=void 0===n,void 0!==n){const e="on"===n.state.effective||"pending"===n.state.effective;F.textContent=o(e?"activity.on":"activity.off")}q.hidden=B.hidden&&R.hidden}function ce(){const e=Y??Q(G),t=e??[],n=[...t].reverse(),a=t.filter(e=>!1===e.ok).length,i=H?n.filter(e=>!1===e.ok):n,s=new Set;oe=[];for(const e of i){if(100===oe.length)break;s.has(e.key)||(s.add(e.key),oe.push(e))}x.hidden=void 0===e,b.textContent=String(oe.length),v.data=o("activity.count_of",{total:t.length});const r=0===a&&t.some(e=>void 0===e.ok);w.textContent=r?U:String(a),k.data=o(1===a?"activity.count_error_one":"activity.count_error_many"),M.hidden=i.length<=oe.length,M.textContent=o("activity.cap",{shown:oe.length});const c=[$];for(const e of oe){let t=J.get(e.key);void 0===t&&(t=se(e),X&&!Z.has(e.key)&&t.classList.add("act-new"),J.set(e.key,t)),c.push(t)}0===oe.length&&(void 0===e?D.textContent=o("activity.unavailable"):0===t.length?D.textContent=o("activity.empty"):D.textContent=o(r?"activity.no_errors_unsure":"activity.no_errors_table"),c.push(O));const l=new Set(c);for(const[e,t]of J)l.has(t)||J.delete(e);for(c.forEach((e,t)=>{const n=z.children[t];n!==e&&z.insertBefore(e,n??null)});z.children.length>c.length;)z.lastElementChild?.remove();void 0!==e&&(Z=new Set(t.map(e=>e.key))),X=!0,E.setAttribute("aria-checked",String(H)),A.textContent=o(void 0===Y?"activity.pause":"activity.resume"),S.disabled=0===oe.length,re()}async function le(n,a){if(0===n.length)return;const i=await async function(e,t){try{return await navigator.clipboard.writeText(t),!0}catch{}const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.cssText="position:fixed;opacity:0;top:0;left:0",e.append(n);try{return n.select(),document.execCommand("copy")}catch{return!1}finally{n.remove()}}(e,n.map(e=>te(o,e).join(" ")).join("\n"));K||t.toast(i?{kind:"success",textCode:a}:{kind:"error",textCode:"activity.copy_failed"})}E.addEventListener("click",()=>{H=!H,ce()}),A.addEventListener("click",()=>{Y=void 0===Y?Q(G):void 0,ce()}),S.addEventListener("click",()=>{le(oe,"activity.copied_many")});let de=0,pe=[];function ue(){for(const e of pe)e();de+=1;const e=de,n=t.client();G=n?.requests,Y=void 0,void 0!==W&&cancelAnimationFrame(W),W=void 0,J.clear(),Z=new Set,X=!1,pe=[],void 0!==G&&pe.push(G.subscribe(()=>{e===de&&(K||void 0!==W||(W=requestAnimationFrame(()=>{W=void 0,K||(void 0===Y&&ce(),t.requestRender())})))}),G.onClear(()=>{e!==de||K||(Y=void 0,void 0!==W&&cancelAnimationFrame(W),W=void 0,ce(),t.requestRender())}));const o=n?.onReset(ge);void 0!==o&&pe.push(o);const a=n?.sync?.subscribe(()=>{e!==de||K||re()});void 0!==a&&pe.push(a)}function ge(){K||(ue(),ce(),t.requestRender())}ue();const fe=t.onClientChange(ge),me=t.data.subscribe(()=>{K||re()});return ce(),()=>{K=!0,de+=1;for(const e of pe)e();fe(),me(),void 0!==W&&cancelAnimationFrame(W),J.clear(),e.replaceChildren()}}(e,t,n):R(e)}};function ae(e,t,n){const o=document.createElement("span");return o.className=e,o.setAttribute("role",t),o.textContent=n,o}const ie=[["act-c-time","activity.col.time"],["act-c-op","activity.col.op"],["act-c-path","activity.col.path"],["act-c-space","activity.col.space"],["act-c-host","activity.col.host"],["act-c-bytes","activity.col.bytes"],["act-c-took","activity.col.took"],["act-c-res","activity.col.result"],["act-c-source","activity.col.source"]];function se(e,t,n){if(void 0===e.data.source)return{text:e.text("section.status.unavailable"),tone:"info"};if(void 0!==t)switch(t.state){case"loading":return{text:e.text("section.status.checking"),tone:"info"};case"needs-permission":return{text:e.text("section.status.needs_permission"),tone:"info"};case"error":return{text:e.text("section.status.unavailable"),tone:"info"};case"ready":return n(t.data)}}const re={"freshness.updating":"Updating…","freshness.updated":"Updated {age}","freshness.failed":"Couldn't refresh. Showing data from {age}.","freshness.age.now":"just now","freshness.age.minutes":"{n} min ago","freshness.age.hours":"{n} h ago","freshness.age.days":"{n} d ago"};function ce(e){return re[e]}const le={loading:"view.loading","needs-permission":"view.permission",error:"view.error"};function de(e,t){const n=document.createElement("p");return n.className=e,n.textContent=t,n}function pe(e,t){const n=de("busy","");n.setAttribute("role","status"),n.hidden=!0;const o=document.createElement("button");return o.type="button",o.className="action",o.textContent=e.text("view.retry"),o.hidden=!0,o.addEventListener("click",()=>t()),{status:n,retry:o}}function ue(e,t,n){if("ready"===n.state){e.retry.hidden=!0;const t=n.freshness?function(e){if(e.refreshing)return ce("freshness.updating");const t=function(e){const t=Math.floor(e/6e4);if(t<1)return ce("freshness.age.now");if(t<60)return ce("freshness.age.minutes").replace("{n}",String(t));const n=Math.floor(t/60);return n<24?ce("freshness.age.hours").replace("{n}",String(n)):ce("freshness.age.days").replace("{n}",String(Math.floor(n/24)))}(Date.now()-e.updatedAt);return ce(e.lastError?"freshness.failed":"freshness.updated").replace("{age}",t)}(n.freshness):void 0;return e.status.hidden=void 0===t,e.status.textContent=t??"",n.data}e.status.hidden=!1,e.status.textContent=t.text(le[n.state]),e.retry.hidden="error"!==n.state}function ge(e,t){ue(e,t,{state:"loading"})}function fe(e){return Promise.resolve().then(e).catch(()=>({state:"error",code:"unknown"}))}x({"delegations.summary":"Who can act on your data","delegations.glance.visible":"Visible","delegations.lede":"Who can use your TinyCloud, and what they can do.","delegations.unavailable":"Delegations aren't available here.","delegations.denied":"This session doesn't have access to this list.","delegations.app.fallback":"this app","delegations.app.subject":"This app","delegations.g.app":"Granted to {app}","delegations.g.app.sub":"Access {app} holds on this device.","delegations.g.others":"Granted to others","delegations.g.others.sub":"Other apps and agents you gave access to.","delegations.g.received":"Received","delegations.g.received.sub":"Access that other people or apps gave you.","delegations.g.none":"Nothing here.","delegations.g.none.more":"None in what's loaded so far.","delegations.party.unknown":"Unknown","delegations.firstpage":"Showing {count}. There are more.","delegations.more.btn":"Show more","delegations.more.busy":"Loading…","delegations.more.err":"Couldn't load more.","delegations.reload":"Reload list","delegations.more.loaded":"{count} more loaded.","delegations.empty.title":"No one has access yet","delegations.empty.body":"When you give an app or an agent access to your TinyCloud, it shows up here, with what it can do and when it ends. You can take access back at any time.","delegations.loading":"Loading delegations","delegations.error":"The list of delegations didn't load.","delegations.ask.title":"{app} can't list delegations yet","delegations.ask.body":"To show who has access, TinyCloud needs your permission to read your list of delegations. It can't change them.","delegations.ask.openkey":" You'll approve it in OpenKey.","delegations.ask.button":"Allow delegation list","delegations.ask.declined":"That wasn't allowed, so nothing changed.","delegations.kind.app":"This app","delegations.kind.others":"Granted by you","delegations.kind.received":"Shared with you by {who}","delegations.st.active":"Active","delegations.st.soon":"Expiring soon","delegations.st.expired":"Expired","delegations.st.revoked":"Revoked","delegations.st.pending":"Not active yet","delegations.st.unknown":"Unknown","delegations.meta.space":"{space} space","delegations.meta.spaces":"{count} spaces","delegations.meta.created":"Created {when}","delegations.meta.expires":"Expires {when}","delegations.meta.expired":"Expired {when}","delegations.meta.space.unknown":"Space unknown","delegations.meta.created.unknown":"Creation time unknown","delegations.meta.expires.unknown":"Expiry unknown","delegations.meta.sep":" · ","delegations.time.now":"just now","delegations.time.min":"{n} min ago","delegations.time.hour":"{n} h ago","delegations.time.day":"{n} d ago","delegations.time.in":"in {t}","delegations.time.ago":"{t} ago","delegations.ability.can":"Can {what}","delegations.ability.none":"No actions listed","delegations.ability.unknown":"Abilities unknown","delegations.ability.more":" and more that couldn't be read","delegations.ability.all":"everything","delegations.ability.and":" and ","delegations.ability.sep":"; ","delegations.verb.read":"read","delegations.verb.write":"write","delegations.verb.list":"list","delegations.verb.delete":"delete","delegations.chip.read":"Read","delegations.chip.write":"Write","delegations.chip.list":"List","delegations.chip.delete":"Delete","delegations.chip.terminal":"Terminal","delegations.chip.terminal.tip":"Terminal: it can't pass this access on to anyone else.","delegations.see":"See details","delegations.see.for":"See details for {name}","delegations.revoke.btn":"Revoke","delegations.revoke.for":"Revoke access for {name}","delegations.ended.expired":"Expired grants can't be used. Nothing to revoke.","delegations.ended.revoked":"Already revoked. Nothing to revoke.","delegations.ended.pending":"Not active yet. Nothing to revoke.","delegations.ended.unknown":"Status unknown. Nothing to revoke here.","delegations.ended.received":"Shared with you. Only the one who shared it can end it.","delegations.confirm.title":"Revoke access for {name}?","delegations.confirm.title.app":"Revoke access for {name} on this device?","delegations.confirm.after.app":"{name} will stop working here until you sign in again.","delegations.confirm.what":"{name} will stop being able to {what}{where}.","delegations.confirm.generic":"{name} will stop being able to use this access{where}.","delegations.confirm.where":" in your {space} space","delegations.confirm.openkey":"You'll confirm with your wallet in OpenKey. You can give access again later; this can't be undone from here.","delegations.confirm.keep":"Keep access","delegations.confirm.go":"Revoke access","delegations.busy":"Revoking…","delegations.err.failed":"Couldn't revoke this access.","delegations.err.unconfirmed":"We couldn't confirm whether this worked. The list was re-read; try again if this still shows Active.","delegations.err.unconfirmed.later":"We couldn't confirm whether this worked. Reload the list and check.","delegations.prev.ok":"A revoke for your previous account finished.","delegations.prev.failed":"A revoke for your previous account did not finish.","delegations.err.denied":"This session can't change this access. Nothing was changed.","delegations.err.stale":"This access had already ended, so nothing was changed.","delegations.err.ended":"This access has ended.","delegations.live.revoked":"Access revoked for {name}.","delegations.receipt.title":"Access revoked","delegations.receipt.body":"That access has ended.","delegations.receipt.for":"For","delegations.receipt.cid":"Delegation","delegations.receipt.time":"Time","delegations.d.close":"Close","delegations.d.status":"Status","delegations.d.by":"Granted by","delegations.d.to":"Granted to","delegations.d.id":"Delegation ID","delegations.d.resources":"What it covers","delegations.d.issued":"Issued","delegations.d.notbefore":"Not valid before","delegations.d.expires":"Expires","delegations.d.expired":"Expired","delegations.d.parents":"Passed down from","delegations.d.parents.none":"Nothing, it was granted directly","delegations.d.parents.n":"{count} earlier delegations","delegations.d.revokedat":"Revoked","delegations.d.revokedby":"Revoked by","delegations.d.revokedvia":"Revoked through","delegations.d.none":"Unknown","delegations.d.resources.unreadable":"Some of what it covers couldn't be read.","delegations.d.space":"Space","delegations.d.terminal":"Terminal","delegations.d.terminal.yes":"Yes · can't pass access on","delegations.d.terminal.no":"No · can pass access on","delegations.d.noforward":"It can't pass this access on to anyone else.","delegations.receipt.what":"{name} can no longer {what}.","delegations.receipt.generic":"{name} can no longer use this access.","delegations.receipt.what.app":"{name} can no longer {what} on this device.","delegations.receipt.generic.app":"{name} can no longer use this access on this device.","delegations.d.copy.by":"Copy the identity that granted this","delegations.d.copy.to":"Copy the identity that received this","delegations.d.copy.id":"Copy the delegation ID"});const me='"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif',he='ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace',ye=`\n.dl{container-type:inline-size}\n.dl-lede{margin:-22px 0 28px;max-width:56ch;font-size:15px;line-height:1.5}\n.dl-lede:has(+.dl-fresh:not([hidden])){margin-bottom:10px}\n.dl .dl-fresh{margin:0 0 24px;font-size:12.5px}\n.dl-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.dl-body{display:flex;flex-direction:column;gap:28px}\n.dl-h{display:flex;align-items:center;gap:10px;margin:0 0 12px;font:600 13px/1.3 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;letter-spacing:.02em}\n.dl-h::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.dl-cnt{font-weight:500;color:#71717a}\n.dl-sub{margin:-4px 0 12px;font-size:12.5px;line-height:1.4;color:#71717a}\n.dl-none{margin:0;font-size:14px;line-height:1.45;color:#71717a}\n.dl-list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}\n@container (min-width:720px){.dl-list{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:16px;align-items:start}}\n.dl-wrap{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:1fr;transition:grid-template-rows .4s cubic-bezier(.22,1,.36,1),opacity .3s}\n.dl-in{min-height:0;padding:3px 3px 12px;margin:-3px -3px 0}\n.dl-wrap.dl-leaving{grid-template-rows:0fr;opacity:0}\n.dl-wrap.dl-leaving>.dl-in{overflow:hidden;padding-bottom:0}\n.dl-card{display:flex;flex-direction:column;gap:10px;padding:16px 16px 16px 18px;border-radius:20px;background:#fff;box-shadow:inset 0 0 0 1px #e4e4e7}\n.dl-card:focus{outline:none}\n.dl-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-width:0}\n.dl-top .st{flex:none}\n.dl-name{margin:0;font-size:15px;font-weight:600;line-height:1.3;overflow-wrap:anywhere}\n.dl-kind{display:block;margin-top:2px;font-size:12.5px;font-weight:500;color:#71717a;overflow-wrap:anywhere}\n.dl-what{margin:0;font-size:14px;line-height:1.45;overflow-wrap:anywhere}\n.dl-meta{margin:0;font-size:13px;color:#71717a}\n.dl-chips{display:flex;flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none}\n.dl-chip{display:inline-flex;align-items:center;box-sizing:border-box;max-width:100%;min-height:28px;padding:4px 11px;border-radius:999px;background:#f4f4f5;color:#09090b;font-size:12.5px;font-weight:600;overflow-wrap:anywhere}\n.dl-chip-line{background:transparent;box-shadow:inset 0 0 0 1px #71717a}\n.dl-acts{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:2px}\n.dl-fine{margin:0;font-size:12.5px;line-height:1.4;color:#71717a}\n.dl-msg{margin:0;font-size:13px;line-height:1.4;color:#09090b}\n.dl-err{display:flex;flex-wrap:wrap;align-items:center;gap:8px}\n.dl-foot{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:16px 0 0}\n.dl-foot[hidden]{display:none}\n.dl-notice{display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:28px 22px;border-radius:20px;box-shadow:inset 0 0 0 1px #e4e4e7}\n.dl-notice-ask{padding:16px 16px 16px 18px}\n.dl-ic{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;box-shadow:inset 0 0 0 1px #71717a}\n.dl-notice-ask .dl-ic{width:44px;height:44px}\n.dl-ic .ui-ic{width:24px;height:24px}\n.dl-notice h4{margin:0;font:400 1.375rem/1.2 ${me}}\n.dl-notice p{margin:0;max-width:52ch;font-size:14px;line-height:1.45}\n.dl-skel{display:flex;flex-direction:column;gap:12px}\n.dl-skel-card{height:132px;border-radius:20px;background:#f4f4f5;animation:dl-pulse 1.4s ease-in-out infinite}\n.dl-skel-line{height:14px;width:40%;border-radius:7px;background:#f4f4f5;animation:dl-pulse 1.4s ease-in-out infinite}\n@keyframes dl-pulse{50%{opacity:.55}}\n.dl-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.dl-kv{display:flex;flex-direction:column;margin:0 0 12px;padding:0}\n.dl-kv>div{display:flex;align-items:center;justify-content:space-between;gap:10px;box-sizing:border-box;min-height:44px;padding:0;border-bottom:1px solid #e4e4e7}\n.dl-kv>div:last-child{border-bottom:0}\n.dl-kv dt{flex:none;font-size:14px}\n.dl-kv dd{display:flex;flex:1 1 auto;align-items:center;justify-content:flex-end;gap:2px;min-width:0;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.dl-kv dd.dl-plain{font-weight:400}\n.dl-kv dd.dl-mono{font:500 12.5px ${he}}\n.dl-sub-h{margin:12px 0 8px;font-size:13px;font-weight:600}\n.dl-res{display:flex;flex-direction:column;gap:8px;margin:0 0 12px;padding:0;list-style:none}\n.dl-res>li{display:flex;flex-direction:column;gap:6px;padding:10px 14px;border-radius:12px;background:#f4f4f5}\n.dl-res code{font:600 12px ${he};overflow-wrap:anywhere}\n.dl-res .dl-chips{gap:4px}\n.dl-res .dl-chip{min-height:24px;padding:4px 9px;background:#fff;font-size:12px;line-height:1}\n.section[data-section="delegations"] .confirm{margin-top:10px;padding:14px 16px;border-radius:16px;box-shadow:inset 0 0 0 1px #71717a}\n.section[data-section="delegations"] .confirm p{margin:0;font-size:14px;line-height:1.45;color:inherit}\n.section[data-section="delegations"] .confirm .actions .action:last-child,.section[data-section="delegations"] .confirm .actions .action:last-child:hover{border-color:#09090b;background:#09090b;color:#fff}\n.dl-q-title{display:block;margin-bottom:6px;font:400 1.25rem/1.25 ${me}}\n.dl-q-dim{display:block;margin-top:8px;color:#52525b}\n.drawer .dl-what{margin:0 0 8px}\n@media (prefers-reduced-motion:reduce){\n.dl-wrap{transition:none}\n.dl-skel-card,.dl-skel-line{animation:none}\n}\n@media (prefers-color-scheme: dark){\n.dl-h::after{background:#69696b}\n.dl-cnt,.dl-sub,.dl-none,.dl-kind,.dl-meta,.dl-fine{color:#a1a1aa}\n.dl-card{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.dl-msg{color:#fafafa}\n.dl-chip{background:#27272a;color:#fafafa}\n.dl-chip-line{background:transparent;box-shadow:inset 0 0 0 1px #a1a1aa}\n.dl-notice{box-shadow:inset 0 0 0 1px #69696b}\n.dl-ic{box-shadow:inset 0 0 0 1px #a1a1aa}\n.dl-skel-card,.dl-skel-line{background:#27272a}\n.dl-kv>div{border-bottom-color:#69696b}\n.dl-res>li{background:#27272a}\n.dl-res .dl-chip{height:24px;padding:0 9px;background:#151517}\n.section[data-section="delegations"] .confirm{box-shadow:inset 0 0 0 1px #a1a1aa}\n.section[data-section="delegations"] .confirm .actions .action:last-child,.section[data-section="delegations"] .confirm .actions .action:last-child:hover{border-color:#fafafa;background:#fafafa;color:#09090b}\n.dl-q-dim{color:#d4d4d8}\n}\n`,xe=["read","write","list","delete"],be={"tinycloud.kv/get":"read","tinycloud.kv/put":"write","tinycloud.kv/list":"list","tinycloud.kv/del":"delete",get:"read",put:"write",list:"list",del:"delete"};function ve(e,t=64){return e.replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g," ").trim().slice(0,t)}const we=/^(.*?)\/(?:kv|sql|duckdb|hooks|vault)(?:\/(.*))?$/,ke=/^tinycloud\.[a-z]+\/(.*)$/i;function Ce(e){const t=ke.exec(e);if(t)return{path:"/"===(t[1]??"")?"":t[1]??""};const n=we.exec(e);if(n){const e=(n[1]??"").split(/[:/]/).pop()??"",t=""===e||/^0x[0-9a-f]{16,}$/i.test(e)?void 0:e,o=n[2]??"";return{...void 0===t?{}:{space:t},path:"/"===o?"":o}}return{path:"/"===e?"":e}}function Ee(e){const t=[];if(!Array.isArray(e))return t;for(const n of e){if("object"!=typeof n||null===n)continue;const e="resource"in n?n.resource:void 0,o="actions"in n?n.actions:void 0;if("string"!=typeof e||!Array.isArray(o))continue;const a=new Set,i=[];for(const e of o){if("string"!=typeof e)continue;const t=e.trim().toLowerCase(),n=Object.prototype.hasOwnProperty.call(be,t)?be[t]:void 0;if(void 0!==n)a.add(n);else{const t=ve(e);""===t||i.includes(t)||i.push(t)}}const s=Ce(ve(e,200));t.push({...void 0===s.space?{}:{space:s.space},path:s.path,verbs:xe.filter(e=>a.has(e)),raws:i})}return t}function Ne(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")}${b("delegations.ability.and")}${e[e.length-1]??""}`}function _e(e){return e.filter((t,n)=>e.indexOf(t)===n)}function Ae(e){if(!Array.isArray(e))return 1;let t=0;for(const n of e)"object"==typeof n&&null!==n&&"resource"in n&&"string"==typeof n.resource&&"actions"in n&&Array.isArray(n.actions)&&n.actions.every(e=>"string"==typeof e)||(t+=1);return t}function Se(e){const t=function(e){const t=new Map;for(const n of e){const e=[...n.verbs.map(e=>b(`delegations.verb.${e}`)),...n.raws];if(0===e.length)continue;const o=e.join("\0"),a=t.get(o)??{words:e,paths:[]};a.paths.push(""===n.path?b("delegations.ability.all"):n.path),t.set(o,a)}return[...t.values()].map(e=>`${Ne(e.words)} ${Ne(_e(e.paths))}`).join(b("delegations.ability.sep"))}(Ee(e));return""!==t&&Ae(e)>0?`${t}${b("delegations.ability.more")}`:t}function Te(e){try{const t=Ee(e),n=Se(e),o=[...xe.filter(e=>t.some(t=>t.verbs.includes(e))).map(e=>b(`delegations.chip.${e}`)),..._e(t.flatMap(e=>e.raws))],a=Ae(e)>0?"delegations.ability.unknown":"delegations.ability.none";return{plain:""===n?b(a):b("delegations.ability.can",{what:n}),chips:o}}catch{return{plain:b("delegations.ability.unknown"),chips:[]}}}const Le={active:"ok",soon:"warn",expired:"info",revoked:"info",pending:"off",unknown:"info"};function Me(e,t){switch(e.status){case"active":{const n=e.expiresAt?.getTime();return void 0!==n&&!Number.isNaN(n)&&n<=t?"expired":e.expiringSoon?"soon":"active"}case"expired":return"expired";case"revoked":case"ancestor_revoked":return"revoked";case"pending":return"pending";default:return"unknown"}}const ze=e=>"active"===e||"soon"===e,$e=e=>"received"===e.group||"received"===e.direction,Oe=(e,t)=>ze(Me(e,t))&&!$e(e),De=["this-app","to-others","received"];function qe(e){const t=ve(e,200);return t.length<=22?t:`${t.slice(0,14)}…${t.slice(-6)}`}function Be(e){const t=ve(e,200);return t.length<=16?t:`${t.slice(0,10)}…${t.slice(-4)}`}function Ie(e){return $e(e)?e.delegatorDid:e.delegateDid}function je(e){const t=ve(e.label?.text??"",120),n=!$e(e)||""!==t&&t!==qe(e.delegateDid)?""===t?qe(Ie(e)):t:qe(e.delegatorDid);return""===n?b("delegations.party.unknown"):n}function Re(e){return _e(e.flatMap(e=>void 0===e.space?[]:[e.space]))}function Pe(e){const t=Math.round(Math.abs(e)/6e4),n=Math.floor(t/1440),o=Math.floor(t%1440/60),a=t%60;return n>0?o>0?`${n}d ${o}h`:`${n}d`:o>0?a>0?`${o}h ${a}m`:`${o}h`:`${a}m`}function Fe(e,t){const n=Math.max(0,Math.round((t-e.getTime())/6e4));return n<1?b("delegations.time.now"):n<60?b("delegations.time.min",{n}):n<1440?b("delegations.time.hour",{n:Math.floor(n/60)}):b("delegations.time.day",{n:Math.floor(n/1440)})}function Ye(e){return e instanceof Date&&!Number.isNaN(e.getTime())}const We={"not-revocable":!0,NOT_FOUND:!0,not_found:!0,"not-found":!0,"not-active":!0},Ue={PERMISSION_DENIED:!0,"permission-denied":!0,denied:!0},He={NETWORK_ERROR:!0,ABORTED:!0,thrown:!0};function Ve(e,t,n){const o=document.createElement(e);return void 0!==t&&(o.className=t),void 0!==n&&(o.textContent=n),o}let Ge=0;const Ke=new Set,Xe=new WeakMap;function Ze(e){const t=Xe.get(e);if(void 0!==t)return t;const n=new Set;return Xe.set(e,n),n}const Je={id:"delegations",labelCode:"nav.delegations",icon:"key",summaryCode:"delegations.summary",isAvailable:e=>!0===e.client()?.signedIn(),status:e=>se(e,e.data.latest("delegations"),t=>{const n=Ze(e.data),o=t.rows.filter(e=>!n.has(e.cid)).length,a=void 0!==t.nextCursor;return{text:e.text("delegations.glance.visible"),tone:"ok",...a&&0===o?{}:{count:`${o}${a?"+":""}`}}}),mount:function(e,t){const n=(e,n)=>t.text(e,n),o=()=>t.appLabel()??n("delegations.app.fallback"),a=e=>"this-app"===e.group?t.appLabel()??n("delegations.app.subject"):je(e),r=Ve("style");r.textContent=i+ye;const c=Ve("div","dl"),l=Ve("h3","sec-title",n("nav.delegations"));l.tabIndex=-1;const u=Ve("p","dl-lede",n("delegations.lede")),g=Ve("div","dl-live");g.setAttribute("role","status"),g.setAttribute("aria-live","polite");const f=Ve("div","dl-skel");f.setAttribute("role","status"),f.setAttribute("aria-busy","true"),f.append(Ve("span","dl-sr",n("delegations.loading")),Ve("div","dl-skel-line"),Ve("div","dl-skel-card"));const m=Ve("div"),h=Ve("div","dl-body"),y=Ve("div","dl-foot"),v=Ve("p","dl-fine"),w=s(n("delegations.more.btn")),k=Ve("p","dl-msg");k.setAttribute("role","alert"),k.hidden=!0,y.append(v,w,k),w.addEventListener("click",()=>{!async function(){const e=_,o=t.data.source;if("loading"===D||void 0===e||void 0===o)return;const a=ee(e);if(void 0===a)return;const i=L;let s;D="loading",te();try{s=await o.delegations(a)}catch{s={state:"error",code:"thrown"}}if(S||i!==L)return;if("ready"!==s.state)return D="error",te(),void w.focus({preventScroll:!0});const r=new Set([...e.rows,...O].map(e=>e.cid)),c=s.data.rows.filter(e=>!r.has(e.cid)&&(r.add(e.cid),!0));O=[...O,...c],A={next:s.data.nextCursor},D="idle",g.textContent=n("delegations.more.loaded",{count:c.length}),te(),void 0!==s.data.nextCursor?w.focus({preventScroll:!0}):(q.get(c[0]?.cid??"")?.article??l).focus({preventScroll:!0})}()});const C=pe(t,()=>{});C.status.classList.add("dl-fresh"),c.append(l,u,C.status,g,f,m,h),e.append(r,c);let E,N,_,A,S=!1,T=!1,L=0,M=0,z=!1,$=!1,O=[],D="idle";const q=new Map,B=Ze(t.data),I=new Set,j=new Map;function R(e){const t=j.get(e);if(void 0!==t)return t;const a="this-app"===e?"app":"to-others"===e?"others":"received",i=Ve("section"),s=Ve("h3","dl-h"),r=Ve("span",void 0,n(`delegations.g.${a}`,{app:o()})),c=Ve("span","dl-cnt");s.append(r,c);const l=Ve("p","dl-sub",n(`delegations.g.${a}.sub`,{app:o()})),d=Ve("ul","dl-list"),p=Ve("p","dl-none",n("delegations.g.none"));i.append(s,l,d,p);const u={section:i,count:c,list:d,none:p};return j.set(e,u),u}function P(e){const o="dl-"+ ++Ge,a=Ve("li","dl-wrap"),i=Ve("div","dl-in"),r=Ve("article","dl-card");r.tabIndex=-1;const c=Ve("div","dl-top"),d=Ve("div","dl-name");d.id=`${o}-n`;const p=Ve("small","dl-kind"),u=Ve("span");d.append(u,p);const g=Ve("span");c.append(d,g);const f=Ve("p","dl-what"),m=Ve("p","dl-meta"),h=Ve("ul","dl-chips"),y=Ve("div","dl-acts"),x=s(n("delegations.see")),b=s(n("delegations.revoke.btn")),v=Ve("span","dl-fine");y.append(x,b,v);const w=Ve("p","dl-msg",n("delegations.busy"));w.setAttribute("role","status");const k=Ve("div","dl-err");k.setAttribute("role","alert");const C=Ve("p","dl-msg"),E=s(n("view.retry")),N=s(n("delegations.reload"));N.hidden=!0,k.append(C,E,N),r.setAttribute("aria-labelledby",d.id),r.append(c,f,m,h,y,w,k),i.append(r),a.append(i);const _={cid:e.cid,row:e,phase:"idle",confirm:void 0,drawer:void 0,detail:void 0,li:a,article:r,name:u,kind:p,statusSlot:g,what:f,meta:m,chips:h,see:x,revoke:b,ended:v,busy:w,err:k,errText:C,retry:E,reload:N};return x.addEventListener("click",()=>function(e){for(const t of q.values())t!==e&&(t.drawer?.close(),t.drawer=void 0,t.detail=void 0);e.drawer?.close();const o=Ve("div");e.detail=o,o.replaceChildren(...X(e.row,Me(e.row,Date.now()),Date.now()));const a=t.openDrawer({title:je(e.row),body:[o],closeLabel:n("delegations.d.close"),anchor:e.article,onClose:()=>{e.drawer=void 0,e.detail=void 0,S||e.see.focus()}});a.el.addEventListener("keydown",t=>{"Escape"===t.key&&(t.stopPropagation(),a.close(),e.drawer=void 0,e.detail=void 0,e.see.focus())}),e.drawer=a}(_)),b.addEventListener("click",()=>U(_)),E.addEventListener("click",()=>U(_)),N.addEventListener("click",()=>{!async function(){const e=++L;O=[],A=void 0,D="idle",te(),await H(),S||e!==L||l.focus({preventScroll:!0})}()}),_}function F(e){const t=Date.now(),{row:o}=e,a=Me(o,t),i=Ee(o.resources),s=je(o);e.name.textContent=s,e.kind.textContent=function(e,t){if($e(e))return b("delegations.kind.received",{who:t});const n=b("this-app"===e.group?"delegations.kind.app":"delegations.kind.others"),o=qe(Ie(e));return o===t?n:`${n}${b("delegations.meta.sep")}${o}`}(o,s),e.statusSlot.replaceChildren(p({text:n(`delegations.st.${a}`),tone:Le[a]})),e.what.textContent=Te(o.resources).plain,e.meta.textContent=function(e,t,n,o){const a=[],i=Re(n);if(1===i.length?a.push(b("delegations.meta.space",{space:i[0]??""})):i.length>1?a.push(b("delegations.meta.spaces",{count:i.length})):a.push(b("delegations.meta.space.unknown")),Ye(e.issuedAt)&&e.issuedAt.getTime()<=o+3e5?a.push(b("delegations.meta.created",{when:Fe(e.issuedAt,o)})):a.push(b("delegations.meta.created.unknown")),Ye(e.expiresAt)){const n=e.expiresAt.getTime()<=o,i=b(n?"delegations.time.ago":"delegations.time.in",{t:Pe(e.expiresAt.getTime()-o)});a.push(b(n||"expired"===t?"delegations.meta.expired":"delegations.meta.expires",{when:i}))}else a.push(b("delegations.meta.expires.unknown"));return a.join(b("delegations.meta.sep"))}(o,a,i,t);const r=Te(o.resources).chips.map(e=>Ve("li","dl-chip",e));if(!0===o.terminal){const e=Ve("li","dl-chip dl-chip-line",n("delegations.chip.terminal"));e.title=n("delegations.chip.terminal.tip"),r.push(e)}e.chips.replaceChildren(...r),e.chips.hidden=0===r.length,e.see.setAttribute("aria-label",n("delegations.see.for",{name:s}));const c=Oe(o,t);e.revoke.hidden=!c,e.revoke.disabled=Ke.has(e.cid),e.revoke.setAttribute("aria-label",n("delegations.revoke.for",{name:s})),e.ended.hidden=c,c||(e.ended.textContent=n(ze(a)?"delegations.ended.received":"expired"===a?"delegations.ended.expired":"revoked"===a?"delegations.ended.revoked":"unknown"===a?"delegations.ended.unknown":"delegations.ended.pending"));const l=Ke.has(e.cid),d="busy"===e.phase||l;e.busy.hidden=!d;const u="failed"===e.phase||"denied"===e.phase||"stale"===e.phase||"unconfirmed"===e.phase;e.err.hidden=!u;const g=void 0!==_&&!_.rows.some(t=>t.cid===e.cid);if(u){const t=!(c||g||"failed"!==e.phase&&"unconfirmed"!==e.phase);e.errText.textContent=n(`delegations.err.${t?"ended":"unconfirmed"===e.phase&&g?"unconfirmed.later":e.phase}`)}e.reload.hidden=!(u&&"unconfirmed"===e.phase&&g),e.retry.hidden="failed"!==e.phase&&"unconfirmed"!==e.phase||!c,e.retry.disabled=l,void 0!==e.detail&&e.detail.replaceChildren(...X(o,a,t))}function Y(){for(const e of q.values())F(e)}function W(e){e.confirm?.close(),e.confirm=void 0}function U(o){if(Ke.has(o.cid)||"busy"===o.phase)return;if(!Oe(o.row,Date.now()))return;!function(){for(const e of q.values())void 0!==e&&W(e)}(),W(o),o.phase="idle",F(o);const i="this-app"===o.row.group,s=a(o.row),r=Re(Ee(o.row.resources)),c=1===r.length?n("delegations.confirm.where",{space:r[0]??""}):"",d=Se(o.row.resources),p=n(i?"delegations.confirm.title.app":"delegations.confirm.title",{name:s}),u=""===d?n("delegations.confirm.generic",{name:s,where:c}):n("delegations.confirm.what",{name:s,what:d,where:c}),f=i?`${u} ${n("delegations.confirm.after.app",{name:s})}`:u,m=n("delegations.confirm.openkey"),h=t.confirm({question:`${p} ${f} ${m}`,cancelLabel:n("delegations.confirm.keep"),confirmLabel:n("delegations.confirm.go"),anchor:o.article,onCancel:()=>{o.confirm=void 0,S||!o.revoke.isConnected||o.revoke.hidden||o.revoke.focus()},onConfirm:()=>{!async function(o){if(Ke.has(o.cid)||"busy"===o.phase)return;const i=o.confirm;void 0!==i&&(i.confirm.disabled=!0);const s=t.data.source;if(void 0===s||!Oe(o.row,Date.now()))return W(o),o.phase="stale",F(o),H(),void l.focus({preventScroll:!0});W(o);const r=L,c=function(){const e=t.data.source;let n=t.data.latest("delegations"),o=!1;return{moved:()=>o||t.data.source!==e,stop:t.data.subscribe(()=>{const e=t.data.latest("delegations");void 0===e&&void 0!==n&&(o=!0),n=e})}}();let d;Ke.add(o.cid),o.phase="busy",Y(),o.article.focus();try{d=await s.revoke(o.cid)}catch{d={ok:!1,code:"thrown"}}finally{Ke.delete(o.cid),c.stop()}const p=void 0!==d&&!0===d.ok;if(c.moved())return t.toastsEnabled()&&t.toast({kind:"info",textCode:p?"delegations.prev.ok":"delegations.prev.failed"}),S||Z(o),void t.requestRender();const u=!S&&r===L;if(p){if(B.add(o.cid),t.requestRender(),function(e){const o=(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),i=a(e.row),s="this-app"===e.row.group?".app":"",r=Se(e.row.resources),c=""===r?n(`delegations.receipt.generic${s}`,{name:i}):n(`delegations.receipt.what${s}`,{name:i,what:r}),l=c.includes("{");l||x({"delegations.receipt.sentence":c});!t.receipt({titleCode:"delegations.receipt.title",bodyCode:l?"delegations.receipt.body":"delegations.receipt.sentence",rows:[...l?[{labelCode:"delegations.receipt.for",value:i}]:[],{labelCode:"delegations.receipt.cid",value:ve(e.cid,200)},{labelCode:"delegations.receipt.time",value:o}]})&&t.toastsEnabled()&&t.toast({kind:"success",textCode:"delegations.receipt.title"})}(o),H(),S)return;return u?(g.textContent=n("delegations.live.revoked",{name:a(o.row)}),void function(t){q.delete(t.cid),W(t),t.drawer?.close(),t.drawer=void 0;const n=e.getRootNode().activeElement;null!==n&&t.li.contains(n)&&l.focus({preventScroll:!0});const o=()=>t.li.remove();if("function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)o();else{t.li.classList.add("dl-leaving");const e=window.setTimeout(()=>{I.delete(e),o()},420);I.add(e)}te()}(o)):void Z(o)}const f=void 0!==d&&!1===d.ok?d.code:"thrown";if(o.phase=function(e){return Object.prototype.hasOwnProperty.call(We,e)?"stale":Object.prototype.hasOwnProperty.call(Ue,e)?"denied":Object.prototype.hasOwnProperty.call(He,e)?"unconfirmed":"failed"}(f),H(),!u)return t.toastsEnabled()&&t.toast({kind:"error",textCode:`delegations.err.${o.phase}`}),void(S||Z(o));Y(),o.retry.hidden?o.article.focus():o.retry.focus()}(o)}});o.confirm=h;const y=h.cancel.closest('[role="alertdialog"]'),b=y?.querySelector("p");if(null!=y&&null!=b){const e="dl-"+ ++Ge,t=Ve("span","dl-q-title",p);t.id=`${e}-t`;const n=Ve("span",void 0,f);n.id=`${e}-b`;const o=Ve("span","dl-q-dim",m);o.id=`${e}-w`,b.replaceChildren(t,n,o),y.setAttribute("aria-labelledby",t.id),y.setAttribute("aria-describedby",`${n.id} ${o.id}`)}}async function H(){try{await t.data.refresh("delegations")}catch{}}function V(e,t){const o=Ve("div");return o.append(Ve("dt",void 0,n(e)),Ve("dd","dl-plain",t)),o}function G(e,o,a,i){if(""===o)return V(e,n("delegations.d.none"));const s=Ve("div"),r=Ve("dd","dl-mono");return r.append(Ve("span",void 0,a),function(e,o){const a=Ve("button","icon-btn");return a.type="button",a.setAttribute("aria-label",n(o)),a.append(d("copy")),a.addEventListener("click",()=>{(async()=>{try{await navigator.clipboard.writeText(e),t.toast({kind:"success",textCode:"toast.copied"})}catch{t.toast({kind:"error",textCode:"toast.copy_failed"})}})()}),a}(o,i)),s.append(Ve("dt",void 0,n(e)),r),s}function K(e){return Ye(e)?e.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):n("delegations.d.none")}function X(e,t,o){const a=Ee(e.resources),i=Ve("p","dl-what",`${Te(e.resources).plain}${!0===e.terminal?`. ${n("delegations.d.noforward")}`:"."}`),s=Ve("dl","dl-kv"),r=Ve("dd");r.append(p({text:n(`delegations.st.${t}`),tone:Le[t]}));const c=Ve("div");c.append(Ve("dt",void 0,n("delegations.d.status")),r),s.append(c,G("delegations.d.by",e.delegatorDid,qe(e.delegatorDid),"delegations.d.copy.by"),G("delegations.d.to",e.delegateDid,qe(e.delegateDid),"delegations.d.copy.to"),G("delegations.d.id",e.cid,Be(e.cid),"delegations.d.copy.id"),V("delegations.d.issued",K(e.issuedAt)),V("delegations.d.notbefore",K(e.notBefore)),V(Ye(e.expiresAt)&&e.expiresAt.getTime()<=o?"delegations.d.expired":"delegations.d.expires",K(e.expiresAt)),V("delegations.d.parents",Array.isArray(e.parents)?0===e.parents.length?n("delegations.d.parents.none"):n("delegations.d.parents.n",{count:e.parents.length}):n("delegations.d.none")));const l=Re(a);s.insertBefore(V("delegations.d.space",0===l.length?n("delegations.d.none"):l.join(", ")),s.children[1]??null),void 0!==e.terminal&&s.append(V("delegations.d.terminal",n(e.terminal?"delegations.d.terminal.yes":"delegations.d.terminal.no"))),("revoked"===t||void 0!==e.revokedAt&&null!==e.revokedAt)&&s.append(V("delegations.d.revokedat",K(e.revokedAt))),void 0!==e.revokedBy&&s.append(V("delegations.d.revokedby",qe(e.revokedBy))),void 0!==e.revokedAncestorCid&&s.append(V("delegations.d.revokedvia",Be(e.revokedAncestorCid)));const d=Ve("h4","dl-sub-h",n("delegations.d.resources")),u=Ve("ul","dl-res");for(const t of Ee(e.resources)){const e=Ve("li");e.append(Ve("code",void 0,""===t.path?n("delegations.ability.all"):t.path));const o=Ve("ul","dl-chips");for(const e of t.verbs)o.append(Ve("li","dl-chip",n(`delegations.chip.${e}`)));for(const e of t.raws)o.append(Ve("li","dl-chip",e));o.childElementCount>0&&e.append(o),u.append(e)}return[i,s,d,u,...Ae(e.resources)>0?[Ve("p","dl-fine",n("delegations.d.resources.unreadable"))]:[]]}function Z(e){q.get(e.cid)===e&&q.delete(e.cid),W(e),e.drawer?.close(),e.li.remove()}function J(e,t,...n){const o=Ve("div",e),a=Ve("span","dl-ic");return a.setAttribute("aria-hidden","true"),a.append(d("key")),o.append(a,Ve("h4",void 0,t),...n),o}function Q(e){m.replaceChildren(...void 0===e?[]:[e]),m.hidden=void 0===e}function ee(e){return void 0===A?e.nextCursor:A.next}function te(){if(S)return;const a=t.data.source,i=t.data.latest("delegations"),r=z&&(a!==E||void 0===i&&void 0!==N||"ready"===N?.state&&"ready"!==i?.state);if(z=!0,E=a,N=i,r){L+=1,M+=1,T=!1,$=!1;for(const e of[...q.values()])Z(e)}if(void 0!==i&&"ready"===i.state||(O=[],A=void 0,D="idle"),void 0===a||"ready"!==i?.state&&"needs-permission"!==i?.state?(C.status.hidden=!0,C.status.textContent=""):(ue(C,t,i),"needs-permission"===i.state&&(C.status.textContent=n("delegations.denied"))),f.hidden=!0,h.hidden=!0,void 0!==a){if(T||void 0===i||"loading"===i.state)return Q(void 0),void(f.hidden=!1);switch(i.state){case"needs-permission":return void Q(function(e){const a=t.client(),i=a?.requestAuthority,r="delegation/list"===e&&"function"==typeof i,c=[Ve("p",void 0,n("delegations.ask.body")+(r?n("delegations.ask.openkey"):""))];if($&&c.push(Ve("p","dl-fine",n("delegations.ask.declined"))),r&&void 0!==i){const t=s(n("delegations.ask.button"));t.addEventListener("click",()=>{t.disabled=!0;const n=L;(async()=>{let t=!1;try{t=!0===(await i(e)).approved}catch{t=!1}S||n!==L||($=!t,t&&await H(),S||n!==L||(t&&l.focus({preventScroll:!0}),te()))})()}),c.push(t)}return J("dl-notice dl-notice-ask",n("delegations.ask.title",{app:o()}),...c)}(i.ability));case"error":return void Q(function(){const e=Ve("div","dl-notice"),t=Ve("p",void 0,n("delegations.error"));t.setAttribute("role","status");const o=s(n("view.retry"));return o.addEventListener("click",()=>{const e=++M;T=!0,te(),H().then(()=>{e===M&&(T=!1,te())})}),e.append(t,o),e}());case"ready":!function(t){_=t;const o=new Set(t.rows.map(e=>e.cid)),a=[...t.rows,...O.filter(e=>!o.has(e.cid))].filter(e=>!B.has(e.cid)),i=void 0!==ee(t);if(0===a.length&&!i){for(const e of[...q.values()])"busy"!==e.phase&&Z(e);return Q(J("dl-notice",n("delegations.empty.title"),Ve("p",void 0,n("delegations.empty.body")))),void(h.hidden=!0)}Q(void 0),h.hidden=!1;const s=function(e){const t={"this-app":[],"to-others":[],received:[]};for(const n of e)t[$e(n)?"received":De.includes(n.group)?n.group:"to-others"].push(n);return t}(a),r=new Set,c=[];for(const t of De){const o=s[t];if("received"===t&&0===o.length)continue;const a=R(t);a.count.textContent=i?0===o.length?"":`${o.length}+`:String(o.length),a.none.hidden=o.length>0,a.none.textContent=n(i?"delegations.g.none.more":"delegations.g.none");const l=[];for(const t of o){let n=q.get(t.cid);if(void 0===n&&(n=P(t),q.set(t.cid,n)),n.row=t,r.add(t.cid),void 0!==n.confirm&&!Oe(t,Date.now())){const t=n.confirm.cancel.closest("[role=alertdialog]"),o=e.getRootNode().activeElement,a=null!==t&&null!==o&&t.contains(o);W(n),n.phase="stale",a&&n.article.focus({preventScroll:!0})}F(n),l.push(n.li)}l.forEach((e,t)=>{a.list.children[t]!==e&&a.list.insertBefore(e,a.list.children[t]??null)}),c.push(a.section)}for(const e of[...q.values()])r.has(e.cid)||"busy"===e.phase||Z(e);y.hidden=!i,v.textContent=n("delegations.firstpage",{count:`${a.length}+`}),w.textContent=n("loading"===D?"delegations.more.busy":"error"===D?"view.retry":"delegations.more.btn"),w.setAttribute("aria-disabled",String("loading"===D)),k.hidden="error"!==D,k.textContent=n("delegations.more.err");const l=[...c,y];for(l.forEach((e,t)=>{h.children[t]!==e&&h.insertBefore(e,h.children[t]??null)});h.children.length>l.length;)h.lastElementChild?.remove()}(i.data)}}else Q(Ve("p","note",n("delegations.unavailable")))}const ne=t.data.subscribe(te);te();const oe=t.data.age("delegations");return void 0!==oe&&oe>1e4&&H(),()=>{S=!0,ne();for(const e of I)window.clearTimeout(e);I.clear();for(const e of q.values())W(e),e.drawer?.close();e.replaceChildren()}}},Qe={off:!0,enabling:!0,on:!0,wiping:!0,pending:!0,unavailable:!0};function et(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(Qe,e)?e:"unavailable"}const tt=1e4,nt=new WeakMap,ot=new WeakMap,at=Object.freeze({ok:!1,retryNow:!1});function it(e){return new Promise(t=>{let n=!1;const o=e=>{n||(n=!0,clearTimeout(a),t(e))},a=setTimeout(()=>o(at),tt);Promise.resolve().then(e).then(e=>o(!0===e?.ok?{ok:!0}:{ok:!1,retryNow:!0===e?.retryNow}),()=>o({ok:!1,retryNow:!1}))})}function st(e){return t=>{const n=t?.signOut;if(void 0===t||void 0===n)return t;const o=ot.get(t);if(void 0!==o)return o;const a=t.purgeLocalCopy,i=void 0===a?void 0:function(e,t,n){let o,a,i=0;const s=new Set,r=e=>{if(o!==e){o=e;for(const e of[...s])e()}},c=()=>{const e=++i;return()=>i===e};return{begin:c,failure:()=>e.signedIn()?void 0:o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),settle(t,a){const i="readable"===o&&t===at,s=a||!1===t.ok&&t.retryNow||i?"readable":"pending";e.signedIn()?!1===t.ok&&r(s):!0!==t.ok?(r(s),n({kind:"warning",textCode:"readable"===s?"local-copy.purge.toast.readable":"local-copy.purge.toast.pending"})):r(void 0)},markPending(){r("readable"===o?"readable":"pending")},retry(){if(e.signedIn())return Promise.resolve(!1);if(void 0===o)return Promise.resolve(!0);if(void 0!==a&&a.latest())return a.promise;const n=c(),i=it(t).then(t=>!(!n()||(!0===t.ok?e.signedIn()||(r(void 0),0):(t.retryNow&&r("readable"),1)))).finally(()=>{a?.promise===i&&(a=void 0)});return a={promise:i,latest:n},i}}}(t,a,e);let s;const r=Object.create(t,{signOut:{value:()=>{const e=s;if(!(void 0===e||e.purging&&t.signedIn()))return e.promise;const o={purging:!1,promise:Promise.resolve()};return o.promise=(async()=>{let e,s=!1;try{await n()}catch(t){s=!0,e=t}if(o.purging=!0,void 0!==a&&void 0!==i)if(t.signedIn())i.markPending();else{const e=i.begin();let n=await it(a);if(e()){const o=!1===n.ok&&n.retryNow;o&&!t.signedIn()&&(n=await it(a)),e()&&i.settle(n,o)}}if(s)throw e})().finally(()=>{s===o&&(s=void 0)}),s=o,o.promise}}});return ot.set(t,r),void 0!==i&&(nt.set(t,i),nt.set(r,i)),r}}function rt(e){return"object"==typeof e&&null!==e&&"code"in e&&"string"==typeof e.code?e.code:"unknown"}x({"local-copy.summary":"Keep a copy of your data on this device","local-copy.glance.on":"On","local-copy.glance.off":"Off","local-copy.glance.pending":"Pending","local-copy.lede":"Keep a copy of your data in this browser, so it opens fast and works offline.","local-copy.switch":"Keep a local copy on this device","local-copy.switch.on":"Changes sync both ways","local-copy.switch.off":"Reads and writes go straight to your TinyCloud","local-copy.switch.state.on":"On","local-copy.switch.state.off":"Off","local-copy.state.enabling":"Turning on the local copy","local-copy.state.wiping":"Wiping local data","local-copy.state.pending":"The last wipe is not confirmed yet","local-copy.state.unavailable":"The local copy is not available here","local-copy.unavailable.note":"Your data in TinyCloud is not affected.","local-copy.pending.note":"Some local data may still be on this device. You can wipe it again below.","local-copy.off.title":"The local copy is off.","local-copy.off.empty":"Nothing is kept on this device.","local-copy.off.unknown":"What is kept on this device is unknown.","local-copy.off.body":"{app} reads and writes your TinyCloud directly, so it needs a connection.","local-copy.off.app":"This app","local-copy.synced":"Synced {ago}","local-copy.synced.unknown":"Last synced: unknown","local-copy.ago.now":"just now","local-copy.ago.minutes":"{count} min ago","local-copy.ago.hours":"{count} h ago","local-copy.ago.days":"{count} d ago","local-copy.unknown":"unknown","local-copy.row.waiting":"Waiting to sync","local-copy.row.waiting.none":"Nothing","local-copy.row.waiting.one":"1 change","local-copy.row.waiting.many":"{count} changes","local-copy.row.size":"Size on this device","local-copy.folders.title":"Folders covered","local-copy.folder.items":"{count} items","local-copy.folder.items.unknown":"items unknown","local-copy.folder.size.unknown":"size unknown","local-copy.folder.waiting":"{count} waiting","local-copy.folder.waiting.unknown":"waiting unknown","local-copy.folder.unknown":"details unknown","local-copy.folder.syncing":"Syncing","local-copy.folder.paused":"Paused","local-copy.bytes.b":"{value} B","local-copy.bytes.kib":"{value} KiB","local-copy.bytes.mib":"{value} MiB","local-copy.bytes.gib":"{value} GiB","local-copy.wipe.title":"Wipe local data","local-copy.wipe.body":"Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","local-copy.wipe.button":"Wipe local data","local-copy.wipe.question":"Wipe local data? Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","local-copy.wipe.question.off":"Turn off local copy and wipe local data? Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","local-copy.wipe.unsynced.one":"1 change hasn't synced yet. Wiping now loses it.","local-copy.wipe.unsynced.many":"{count} changes haven't synced yet. Wiping now loses them.","local-copy.wipe.unsynced.unknown":"It isn't known whether all changes have synced. Wiping now may lose changes that haven't.","local-copy.wipe.refill":"The copy downloads again the next time it syncs.","local-copy.wipe.keep":"Keep local data","local-copy.wipe.confirm":"Wipe local data","local-copy.wipe.busy":"Wiping…","local-copy.wipe.done":"Local data wiped. Your TinyCloud still has everything.","local-copy.wipe.failed":"The wipe didn't finish. The copy may still be on this device.","local-copy.wipe.retry":"Try again","local-copy.purge.pending":"The local copy on this browser was not removed yet.","local-copy.purge.readable":"The local copy on this browser was not removed yet. It may still be readable here.","local-copy.purge.toast.pending":"The local copy on this browser was not removed yet. Try again from Local copy.","local-copy.purge.toast.readable":"The local copy on this browser was not removed yet. It may still be readable here. Try again from Local copy.","local-copy.purge.done":"The local copy was removed from this browser."});const ct={off:!0,on:!0,pending:!0,enabling:!1,wiping:!1,unavailable:!1},lt={enabling:"local-copy.state.enabling",wiping:"local-copy.state.wiping",pending:"local-copy.state.pending",unavailable:"local-copy.state.unavailable"};function dt(e,t){const n=[["local-copy.bytes.b",1],["local-copy.bytes.kib",1024],["local-copy.bytes.mib",1048576],["local-copy.bytes.gib",1024**3]];let o=n[0];for(const e of n)t>=e[1]&&(o=e);const a=t/o[1],i=1===o[1]||Number.isInteger(a)?String(Math.round(a)):a.toFixed(1);return e.text(o[0],{value:i})}function pt(e,t,n){const o=Math.max(0,Math.floor((n-t.getTime())/6e4));return o<1?e.text("local-copy.ago.now"):o<60?e.text("local-copy.ago.minutes",{count:o}):o<1440?e.text("local-copy.ago.hours",{count:Math.floor(o/60)}):e.text("local-copy.ago.days",{count:Math.floor(o/1440)})}function ut(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0}function gt(e,t,n=!1,o=!1){const a=document.createElement("div"),i=document.createElement("dt");if(o){const t=document.createElement("span");t.className="lc-prefix",t.textContent=e,i.append(t)}else i.textContent=e;const s=document.createElement("dd");return n&&(s.className="lc-plain"),s.append(t),a.append(i,s),a}function ft(e,t){switch(et(t.effective)){case"on":return{text:e.text("local-copy.glance.on"),tone:"ok"};case"off":return{text:e.text("local-copy.glance.off"),tone:"off"};case"pending":return{text:e.text("local-copy.glance.pending"),tone:"warn"};case"unavailable":return{text:e.text("section.status.unavailable"),tone:"info"};default:return{text:e.text("section.status.checking"),tone:"info"}}}let mt=0;const ht={id:"local-copy",labelCode:"nav.local-copy",icon:"sync",summaryCode:"local-copy.summary",isAvailable:e=>void 0!==e.client()?.sync,status:function(e){const t=e.client()?.sync?.state;return void 0!==t?ft(e,t):se(e,e.data.latest("localCopy"),t=>ft(e,t))},mount:function(e,t){const n=t.client()?.sync;if(!n)return()=>{};const o=n;let a,s,r,c=!1,l=0,d=!1,u=!1,g=!1,f=!1,m=!1,h=!1;const y=void 0===(x=t.client())?void 0:nt.get(x);var x;let b=0;const v=document.createElement("style");v.textContent='\n.lc-lede{max-width:56ch;margin:-20px 0 20px;font-size:15px;line-height:1.5}\n.lc-sw{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:4px 0}\n.lc-sw strong{display:block;font:500 16px/1.3 "Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;letter-spacing:-.005em}\n.lc-sub{display:block;margin-top:2px;font-size:13.5px;color:#71717a}\n.lc-swctl{display:flex;flex:none;align-items:center;gap:10px}\n.lc-swlbl{min-width:22px;font-size:13px;font-weight:700;text-align:right}\n.lc-card{display:flex;flex-direction:column;gap:10px;margin-top:16px;padding:16px 18px;border-radius:16px;background:#fafafa;box-shadow:inset 0 0 0 1px #e4e4e7}\n.lc-card p{margin:0}\n.lc-small{font-size:14px;line-height:1.45}\n.lc-state{margin:6px 0 0}\n.lc-kv{display:flex;flex-direction:column;margin:0;padding:0}\n.lc-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.lc-kv>div:last-child{border-bottom:0}\n.lc-kv.lc-cozy>div{min-height:36px;padding:5px 0;border-bottom:0}\n.lc-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;white-space:nowrap}\n.lc-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.lc-kv dd{display:flex;flex:0 1 auto;align-items:center;justify-content:flex-end;max-width:78%;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.lc-kv dd.lc-plain{font-weight:400}\n.lc-kv .lc-prefix{font:600 .875rem ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}\n.lc-sec{margin-top:24px}\n.lc-h3{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-size:13px;font-weight:600;line-height:1.3;letter-spacing:.02em}\n.lc-h3::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.lc-cnt{font-weight:500;color:#71717a}\n.lc-wipe p{max-width:56ch;margin:0 0 12px;font-size:14px;line-height:1.45}\n.lc-fail{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:12px}\n.lc-fail p{margin:0;font-size:14px}\n.lc-sec .confirm,.lc-sw+.confirm{margin-top:12px}\n.lc-confirm.confirm .busy{margin:0;font-size:14.5px;line-height:1.5;color:inherit}\n.lc-confirm.confirm .actions{margin:16px 0 0}\n.lc-confirm .action:last-child{background:#09090b;border-color:#09090b;color:#fff}\n.lc-confirm .action:last-child:hover{background:#27272a}\n.lc-confirm .action:disabled{opacity:.6;cursor:default}\n@media (max-width:600px){\n.lc-confirm.confirm .actions{flex-direction:column}\n.lc-confirm .action{width:100%;white-space:normal}\n}\n.panel[data-layout="page"] .lc-card{background:#fff}\n@media (prefers-color-scheme: dark){\n.lc-sub,.lc-cnt{color:#a1a1aa}\n.lc-card{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.lc-kv>div{border-bottom-color:#69696b}\n.lc-kv dt::after{border-bottom-color:#71717a}\n.lc-h3::after{background:#69696b}\n.lc-confirm .action:last-child{background:#fafafa;border-color:#fafafa;color:#09090b}\n.lc-confirm .action:last-child:hover{background:#e4e4e7}\n.panel[data-layout="page"] .lc-card{background:#151517}\n}\n'+i;const w=document.createElement("h3");w.className="sec-title",w.tabIndex=-1,w.textContent=t.text("nav.local-copy");const k=de("lc-lede",t.text("local-copy.lede")),C=document.createElement("div");C.className="lc-fail lc-purge";const E=de("","");E.setAttribute("role","alert");const N=document.createElement("button");N.type="button",N.className="action",N.textContent=t.text("local-copy.wipe.retry"),C.append(E,N);const _=document.createElement("div");_.className="row lc-sw";const A=document.createElement("div"),S=document.createElement("strong");S.id="lc-switch-label",S.className="label",S.textContent=t.text("local-copy.switch");const T=document.createElement("span");T.className="lc-sub",A.append(S,T);const L=document.createElement("div");L.className="lc-swctl";const M=document.createElement("span");M.className="lc-swlbl",M.setAttribute("aria-hidden","true");const z=document.createElement("button");z.type="button",z.className="switch",z.setAttribute("role","switch"),z.setAttribute("aria-labelledby",S.id);const $=document.createElement("span");$.className="knob",z.append($),L.append(M,z),_.append(A,L);const O=de("note lc-state","");O.setAttribute("role","status");const D=de("note",""),q=pe(t,()=>{ie()}),B=de("error","");B.setAttribute("role","alert");const I=document.createElement("div");I.className="lc-card";const j=document.createElement("div"),R=document.createElement("dl");R.className="lc-kv lc-cozy";const P=de("lc-small","");I.append(j,R,P);const F=document.createElement("section");F.className="lc-sec";const Y=document.createElement("h3");Y.className="lc-h3",Y.id="lc-folders",F.setAttribute("aria-labelledby",Y.id);const W=document.createElement("span");W.className="lc-cnt";const U=document.createTextNode(t.text("local-copy.folders.title"));Y.append(U,W);const H=document.createElement("dl");H.className="lc-kv",F.append(Y,H);const V=document.createElement("section");V.className="lc-sec lc-wipe";const G=document.createElement("h3");G.className="lc-h3",G.id="lc-wipe",G.textContent=t.text("local-copy.wipe.title"),V.setAttribute("aria-labelledby",G.id);const K=de("",t.text("local-copy.wipe.body"));K.id="lc-wipe-text-"+ ++mt;const X=document.createElement("button");X.type="button",X.className="action",X.textContent=t.text("local-copy.wipe.button"),X.setAttribute("aria-describedby",K.id);const Z=document.createElement("div");Z.className="lc-fail";const J=de("",t.text("local-copy.wipe.failed"));J.setAttribute("role","alert");const Q=document.createElement("button");function ee(){return et(o.state.effective)}function te(){const e=ee();return"unavailable"!==e&&"enabling"!==e&&("off"!==e||0!==s?.bytesOnDevice)}function ne(){return!c&&!u&&!d&&ct[ee()]&&te()}function oe(){const e=a;a=void 0,e?.close()}function ae(){if(c)return;const e=o.state,n=ee(),i=n===e.effective,l=e.requested,f="enabling"===n||"wiping"===n||"pending"===n||"unavailable"===n;z.setAttribute("aria-checked",String(l));const x=f||d||u,b=z.getRootNode();x&&!z.disabled&&b.activeElement===z&&(h=!0),z.disabled=x,!x&&h&&(h=!1,null!==b.activeElement&&b.activeElement!==document.body||z.focus()),M.textContent=t.text(l?"local-copy.switch.state.on":"local-copy.switch.state.off"),T.textContent=t.text(l?"local-copy.switch.on":"local-copy.switch.off");const v="pending"===n&&"sync_pending"===t.topStatus()&&!u,w=u?"local-copy.state.wiping":lt[n];O.hidden=void 0===w||v,O.textContent=void 0===w?"":t.text(w);const k=i?e.reason??("pending"===n?"erase-pending":"unknown"):"unknown";"unavailable"===n?(D.hidden=!1,D.textContent=`${t.text(`sync.reason.${k}`)} ${t.text("local-copy.unavailable.note")}`):"pending"===n?(D.hidden=!1,D.textContent=`${t.text(`sync.reason.${k}`)} ${t.text("local-copy.pending.note")}`):(D.hidden=!0,D.textContent=""),B.hidden=void 0===r,B.textContent=void 0===r?"":t.text(`sync.error.${r}`);const _=y?.failure();C.hidden=void 0===_,E.textContent=void 0===_?"":t.text(`local-copy.purge.${_}`),N.disabled=m;const A="on"===n||"pending"===n||"enabling"===n||"wiping"===n,S=void 0!==s&&(A||"off"===n);if(I.hidden=!S,F.hidden=!(void 0!==s&&A&&s.folders.length>0),void 0!==s&&S)if(R.hidden=!A,j.hidden=!A,P.hidden=A,A){const e="enabling"===n?{text:t.text("local-copy.state.enabling"),tone:"info"}:(L=s.lastSyncedAt)instanceof Date&&Number.isFinite(L.getTime())?{text:t.text("local-copy.synced",{ago:pt(t,s.lastSyncedAt,Date.now())}),tone:"ok"}:{text:t.text("local-copy.synced.unknown"),tone:"info"};j.replaceChildren(p(e));const o=ut(s.pending)?0===s.pending?t.text("local-copy.row.waiting.none"):1===s.pending?t.text("local-copy.row.waiting.one"):t.text("local-copy.row.waiting.many",{count:s.pending}):t.text("local-copy.unknown"),a=ut(s.bytesOnDevice)?dt(t,s.bytesOnDevice):t.text("local-copy.unknown"),i=[gt(t.text("local-copy.row.waiting"),o),gt(t.text("local-copy.row.size"),a)];R.replaceChildren(...i),W.textContent=String(s.folders.length),H.replaceChildren(...s.folders.map(e=>gt(e.prefix,function(e,t){const n=[];return"syncing"!==t.state&&"paused"!==t.state||n.push(e.text(`local-copy.folder.${t.state}`)),ut(t.items)||ut(t.bytes)||ut(t.waiting)?(n.push(ut(t.items)?e.text("local-copy.folder.items",{count:t.items}):e.text("local-copy.folder.items.unknown")),n.push(ut(t.bytes)?dt(e,t.bytes):e.text("local-copy.folder.size.unknown")),ut(t.waiting)?t.waiting>0&&n.push(e.text("local-copy.folder.waiting",{count:t.waiting})):n.push(e.text("local-copy.folder.waiting.unknown"))):n.push(e.text("local-copy.folder.unknown")),n.join(" · ")}(t,e),!0,!0)))}else{const e=document.createElement("strong");e.textContent=t.text("local-copy.off.title");const n=0===s.bytesOnDevice?` ${t.text("local-copy.off.empty")}`:ut(s.bytesOnDevice)?"":` ${t.text("local-copy.off.unknown")}`;P.replaceChildren(e,`${n} ${t.text("local-copy.off.body",{app:t.appLabel()??t.text("local-copy.off.app")})}`)}var L;const $=te();V.hidden=!$,X.disabled=d||u||"wiping"===n||"enabling"===n,Z.hidden=!g,Q.disabled=X.disabled,void 0===a||u||ne()||oe()}async function ie(){const e=t.data.source;if(!e)return s=void 0,q.status.hidden=!0,q.retry.hidden=!0,void ae();const n=++l,o=b,a=await fe(()=>e.localCopy());if(c||n!==l||o!==b)return;const i=ue(q,t,a);void 0!==i&&(s=i),ae()}async function se(e){const t=b;d=!0,r=void 0,ae();try{await o.setEnabled(e)}catch(e){c||t!==b||(r=rt(e))}finally{t===b&&(d=!1,ae())}}function re(e,n,i){if(void 0!==a||!ne())return;f=e;const l=s?.pending,d=[t.text(e?"local-copy.wipe.question.off":"local-copy.wipe.question")];ut(l)?l>0&&d.push(t.text(1===l?"local-copy.wipe.unsynced.one":"local-copy.wipe.unsynced.many",{count:l})):d.push(t.text("local-copy.wipe.unsynced.unknown")),e||d.push(t.text("local-copy.wipe.refill"));const p=t.confirm({question:d.join(" "),cancelLabel:t.text("local-copy.wipe.keep"),confirmLabel:t.text("local-copy.wipe.confirm"),anchor:n,onCancel:()=>{a===p&&(a=void 0),c||i.focus()},onConfirm:()=>{!async function(e,n){if(u||a!==e||!ne())return;u=!0;const i=b;g=!1,r=void 0,e.confirm.disabled=!0,e.cancel.disabled=!0,e.confirm.textContent=t.text("local-copy.wipe.busy"),ae();let s=!0;try{await o.wipeLocalData()}catch{s=!1}if(i===b){if(s&&n&&o.state.requested){try{await o.setEnabled(!1)}catch(e){c||i!==b||(r=rt(e))}if(i!==b)return}u=!1,s&&t.toast({kind:"success",textCode:"local-copy.wipe.done"}),c||(oe(),g=!s,ae(),s?(z.focus(),ie()):V.hidden||Z.hidden||Q.disabled?w.focus():Q.focus())}}(p,e)}});a=p,p.confirm.closest(".confirm")?.classList.add("lc-confirm")}Q.type="button",Q.className="action",Q.textContent=t.text("local-copy.wipe.retry"),Z.append(J,Q),V.append(G,K,X,Z),e.append(v,w,k,C,_,O,D,q.status,q.retry,B,I,F,V),z.addEventListener("click",()=>{z.disabled||d||u||(o.state.requested?te()?re(!0,_,z):se(!1):se(!0))}),X.addEventListener("click",()=>{X.disabled||(g=!1,ae(),re(!1,X,X))}),Q.addEventListener("click",()=>{Q.disabled||(g=!1,ae(),re(f,f?_:X,f?z:X))}),N.addEventListener("click",()=>{if(void 0===y||N.disabled||m)return;const e=b;m=!0,ae(),y.retry().then(n=>{e===b&&(m=!1,n&&t.toast({kind:"success",textCode:"local-copy.purge.done"}),c||(ae(),n?w.focus():N.focus()))})});const ce=o.subscribe(()=>{ae(),t.requestRender(),ie()});let le;const me=()=>{le?.(),le=t.data.source?.subscribe(e=>{"copy"===e&&ie()})};me();const he=t.client()?.onReset(()=>{b+=1,d=!1,u=!1,m=!1,r=void 0,g=!1,s=void 0,oe(),ge(q,t),ae(),me(),ie()}),ye=t.onStatusChange(ae),xe=y?.subscribe(ae),be=setInterval(()=>{ae(),ie()},6e4),ve=t.data.latest("localCopy");return"ready"===ve?.state?s=ve.data:ge(q,t),ae(),ie(),()=>{c=!0,clearInterval(be),ce(),le?.(),he?.(),ye(),xe?.(),e.replaceChildren()}}},yt="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",xt=`\n.ll-intro{margin:-20px 0 20px;font-size:15px;line-height:1.5;max-width:56ch;color:#52525b}\n.ll-sub{margin:2px 0 0;font-size:12.5px;color:#52525b}\n.ll-ctl{display:flex;align-items:center;gap:10px;flex:none}\n.ll-word{min-width:22px;text-align:right;font-size:13px;font-weight:700}\n.ll-label{margin:0;font-family:"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;font-size:16px;font-weight:500;letter-spacing:-.005em}\n.ll-eyebrow{margin:0;font-size:13px;font-weight:600;line-height:1.3;color:#71717a}\n.ll-card{display:flex;flex-direction:column;gap:14px;margin-top:14px;padding:16px 18px;border-radius:16px;background:#fafafa;box-shadow:inset 0 0 0 1px #e4e4e7}\n.layer .panel[data-layout="page"] .ll-card{background:#fff}\n.ll-card-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}\n.ll-strong{margin:0;font-size:14px;font-weight:600}\n.ll-body{margin:0;font-size:14px;line-height:1.45;color:#52525b}\n.ll-looking{display:flex;align-items:center;gap:14px}\n.ll-spin{flex:none;width:26px;height:26px;border:3px solid #f4f4f5;border-top-color:#09090b;border-radius:50%;animation:ll-spin .9s linear infinite}\n@keyframes ll-spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion: reduce){.ll-spin{animation:none}}\n.ll-cancel{align-self:flex-start;width:auto}\n.ll-kv{display:flex;flex-direction:column;margin:0;padding:0}\n.ll-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.ll-kv>div:last-child{border-bottom:0}\n.ll-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;color:#52525b;white-space:nowrap}\n.ll-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.ll-kv dd{display:flex;flex:0 1 auto;align-items:center;justify-content:flex-end;gap:2px;max-width:100%;min-width:0;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.ll-mono,.ll-did{min-width:0;font-family:${yt};font-size:12.5px;overflow-wrap:anywhere}\n.ll-host{overflow-wrap:anywhere}\n.ll-cell{display:flex;align-items:center;gap:8px;min-width:0}\n.ll-codeline{display:flex;align-items:center;justify-content:space-between;gap:4px;box-sizing:border-box;margin-top:8px;padding:2px 4px 2px 14px;border-radius:12px;background:#f4f4f5;min-height:44px;font-family:${yt};font-size:13px}\n.ll-codeline code{min-width:0;overflow-wrap:anywhere}\n.ll-steps{display:flex;flex-direction:column;gap:12px;margin:0;padding:0;list-style:none;counter-reset:ll-step;font-size:14px;line-height:1.45;color:#09090b}\n.ll-steps li{position:relative;padding-left:34px;counter-increment:ll-step}\n.ll-steps li::before{content:counter(ll-step);position:absolute;left:0;top:-1px;width:24px;height:24px;border-radius:50%;box-shadow:inset 0 0 0 1px #71717a;font:600 12px/24px ${yt};text-align:center}\n.ll-unknown{color:#52525b}\n@media (prefers-color-scheme: dark){\n.ll-intro,.ll-sub,.ll-body,.ll-kv dt,.ll-unknown{color:#a1a1aa}\n.ll-card{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.layer .panel[data-layout="page"] .ll-card{background:#151517}\n.ll-eyebrow{color:#a1a1aa}\n.ll-spin{border-color:#27272a;border-top-color:#fafafa}\n.ll-kv>div{border-bottom-color:#69696b}\n.ll-kv dt::after{border-bottom-color:#71717a}\n.ll-codeline{background:#27272a}\n.ll-steps{color:#fafafa}\n}\n`,bt={found:{code:"local-tinycloud.glance.found",tone:"ok"},looking:{code:"local-tinycloud.glance.looking",tone:"info"},"not-found":{code:"local-tinycloud.glance.not_found",tone:"off"},off:{code:"local-tinycloud.glance.off",tone:"off"},unavailable:{code:"section.status.unavailable",tone:"off"}},vt={off:"local-tinycloud.sub.off",looking:"local-tinycloud.sub.looking",found:"local-tinycloud.sub.found","not-found":"local-tinycloud.sub.not_found",unavailable:"local-tinycloud.sub.unavailable"};x({"local-tinycloud.summary":"Use a TinyCloud node on this computer","local-tinycloud.intro":"Use a TinyCloud that runs on this computer, next to your browser, instead of only your hosted one.","local-tinycloud.switch":"Use TinyCloud on this computer","local-tinycloud.switch.on":"On","local-tinycloud.switch.off":"Off","local-tinycloud.sub.off":"Off for this app","local-tinycloud.sub.looking":"Checking this computer…","local-tinycloud.sub.found":"Connected to a TinyCloud on this computer","local-tinycloud.sub.not_found":"Switched on, but nothing answered","local-tinycloud.sub.unavailable":"Not available in this app yet","local-tinycloud.app_fallback":"This app","local-tinycloud.glance.found":"Found","local-tinycloud.glance.looking":"Looking","local-tinycloud.glance.not_found":"Not found","local-tinycloud.glance.off":"Off","local-tinycloud.off.body":"{app} talks to your hosted TinyCloud only. Turn this on and it looks for a TinyCloud running on this computer.","local-tinycloud.looking.title":"Looking for TinyCloud on this computer…","local-tinycloud.looking.permission":"Your browser may ask to let {app} reach devices on your network. Allow it so the check can finish.","local-tinycloud.looking.cancel":"Cancel","local-tinycloud.found.recheck":"Check again","local-tinycloud.found.node_id":"Node ID","local-tinycloud.found.version":"Version","local-tinycloud.found.host":"Host","local-tinycloud.unknown":"Unknown","local-tinycloud.copy.node_id_label":"Copy node ID","local-tinycloud.copy.host_label":"Copy host","local-tinycloud.copy.command_label":"Copy command","local-tinycloud.copied":"Copied","local-tinycloud.copy_failed":"Couldn't copy. Select the text and copy it by hand.","local-tinycloud.not_found.title":"We couldn't find TinyCloud on this computer.","local-tinycloud.not_found.unchanged":"Nothing has changed: {app} still uses your hosted TinyCloud.","local-tinycloud.not_found.steps_title":"To start it","local-tinycloud.not_found.step_open":"Open TinyCloud on this computer, or start it from a terminal.","local-tinycloud.not_found.step_command":"tinycloud start","local-tinycloud.not_found.step_listen":"Check that it's listening on 127.0.0.1:8787.","local-tinycloud.not_found.step_retry":"Come back here and choose Try again.","local-tinycloud.not_found.retry":"Try again","local-tinycloud.unavailable.line":"Local TinyCloud can't be checked from this app.","local-tinycloud.unavailable.explain":"This app can't turn TinyCloud on this computer on or off yet, so the switch is off.","local-tinycloud.error":"Couldn't change TinyCloud on this computer. Try again."});const wt={id:"local-tinycloud",labelCode:"nav.local-tinycloud",icon:"monitor",summaryCode:"local-tinycloud.summary",isAvailable:j,status:e=>se(e,e.data.latest("localNode"),t=>{const n=bt[t.connection];return{text:e.text(n.code),tone:n.tone}}),mount(e,t){const n=t.client()?.data;if(!n)return R(e);let o,a,r,c=n,l=0,u=!1,g=!1,f=0;const m=()=>t.appLabel()??t.text("local-tinycloud.app_fallback"),h=pe(t,()=>{q()}),y=document.createElement("div");y.hidden=!0;const x=de("ll-intro",t.text("local-tinycloud.intro")),b=document.createElement("h3");b.className="sec-title",b.tabIndex=-1,b.textContent=t.text("nav.local-tinycloud");const v=document.createElement("div");v.className="row";const w=document.createElement("div"),k=de("label ll-label",t.text("local-tinycloud.switch")),C=de("ll-sub","");w.append(k,C);const E=document.createElement("div");E.className="ll-ctl";const N=document.createElement("span");N.className="ll-word";const _=document.createElement("button");_.type="button",_.className="switch",_.setAttribute("role","switch"),_.setAttribute("aria-label",t.text("local-tinycloud.switch"));const A=document.createElement("span");A.className="knob",_.append(A),E.append(N,_),v.append(w,E);const S=document.createElement("div");S.className="ll-card";const T=de("error",t.text("local-tinycloud.error"));T.setAttribute("role","alert"),T.hidden=!0;const L=s(t.text("view.retry"));function M(e,n){const o=document.createElement("button");return o.className="icon-btn",o.setAttribute("aria-label",t.text(n)),o.append(d("copy")),o.addEventListener("click",()=>{!async function(e){const n=l;try{await navigator.clipboard.writeText(e),u||n!==l||t.toast({kind:"success",textCode:"local-tinycloud.copied"})}catch{u||n!==l||t.toast({kind:"error",textCode:"local-tinycloud.copy_failed"})}}(e)}),o}function z(){const e=document.createElement("span");return e.className="ll-unknown",e.textContent=t.text("local-tinycloud.unknown"),e}function $(e){const n=bt[e];return p({text:t.text(n.code),tone:n.tone})}function O(e,t){const n=document.createElement("div");return n.className="ll-card-head",n.append(e,...t?[t]:[]),n}function D(){if(u)return;if(y.hidden=void 0===a,void 0===a)return;const e=a.connection,n="off"!==e&&"unavailable"!==e;_.setAttribute("aria-checked",String(n)),_.disabled="unavailable"===e,_.setAttribute("aria-disabled",String(g)),N.textContent=t.text(n?"local-tinycloud.switch.on":"local-tinycloud.switch.off"),C.textContent=t.text(vt[e]),S.replaceChildren(...function(e){switch(e.connection){case"off":return[O($("off")),de("ll-body",t.text("local-tinycloud.off.body",{app:m()}))];case"looking":{const e=document.createElement("span");e.className="ll-spin",e.setAttribute("aria-hidden","true");const n=document.createElement("div");n.append(de("ll-strong",t.text("local-tinycloud.looking.title")),de("ll-body",t.text("local-tinycloud.looking.permission",{app:m()})));const o=document.createElement("div");o.className="ll-looking",o.append(e,n);const a=s(t.text("local-tinycloud.looking.cancel"));return a.classList.add("ll-cancel"),a.addEventListener("click",()=>{g||B(!1)}),[o,a]}case"found":{const n=s(t.text("local-tinycloud.found.recheck"));n.addEventListener("click",()=>{q()});const o=document.createElement("dl");o.className="ll-kv";const a=(e,n)=>{const a=document.createElement("div"),i=document.createElement("dt");i.textContent=t.text(e);const s=document.createElement("dd");s.append(n),a.append(i,s),o.append(a)},i=e.identity?.nodeDid,r=document.createElement("span");if(r.className="ll-cell",i){const e=document.createElement("span");e.className="ll-did",e.textContent=i.length>18?`${i.slice(0,12)}…${i.slice(-6)}`:i,e.title=i,r.append(e,M(i,"local-tinycloud.copy.node_id_label"))}else r.append(z());a("local-tinycloud.found.node_id",r);const c=document.createElement("span");e.version?c.textContent=e.version:c.append(z()),a("local-tinycloud.found.version",c);const l=document.createElement("span");if(l.className="ll-cell",e.url){const t=document.createElement("span");t.className="ll-mono ll-host",t.textContent=e.url,t.title=e.url,l.append(t,M(e.url,"local-tinycloud.copy.host_label"))}else l.append(z());return a("local-tinycloud.found.host",l),[O($("found"),n),o]}case"not-found":{const e=s(t.text("local-tinycloud.not_found.retry"));e.addEventListener("click",()=>{q()});const n=t.text("local-tinycloud.not_found.step_command"),o=document.createElement("code");o.textContent=n;const a=document.createElement("div");a.className="ll-codeline",a.append(o,M(n,"local-tinycloud.copy.command_label"));const i=document.createElement("ol");i.className="ll-steps";const r=document.createElement("li");r.append(t.text("local-tinycloud.not_found.step_open"),a);const c=document.createElement("li");c.textContent=t.text("local-tinycloud.not_found.step_listen");const l=document.createElement("li");l.textContent=t.text("local-tinycloud.not_found.step_retry"),i.append(r,c,l);const d=document.createElement("p");d.className="ll-body";const p=document.createElement("strong");return p.textContent=t.text("local-tinycloud.not_found.title"),d.append(p,` ${t.text("local-tinycloud.not_found.unchanged",{app:m()})}`),[O($("not-found"),e),d,de("ll-eyebrow",t.text("local-tinycloud.not_found.steps_title")),i]}case"unavailable":return[O($("unavailable")),de("ll-strong",t.text("local-tinycloud.unavailable.line")),de("ll-body",t.text("local-tinycloud.unavailable.explain"))]}}(a))}async function q(){const e=++f,n=c,o=l;if(void 0===n)return;const i=await fe(()=>n.localNode());u||e!==f||o!==l||(a=ue(h,t,i),D())}async function B(e){const t=c;if(void 0===t)return;const n=l;let o;g=!0,r=e,T.hidden=!0,L.hidden=!0,D();try{o=await t.setLocalNodeEnabled(e)}catch{o={ok:!1,code:"unknown"}}u||n!==l||(g=!1,T.hidden=o.ok,L.hidden=o.ok,o.ok&&(r=void 0),await q())}function I(){o?.(),o=c?.subscribe(e=>{"local"===e&&q()})}L.hidden=!0,L.addEventListener("click",()=>{void 0!==r&&B(r)}),y.append(v,S,T,L),_.addEventListener("click",()=>{g||void 0===a||"unavailable"===a.connection||B("off"===a.connection)});const j=t.onClientChange(()=>{if(l+=1,g=!1,r=void 0,T.hidden=!0,L.hidden=!0,a=void 0,c=t.client()?.data,I(),D(),void 0===c)return h.status.hidden=!0,void(h.retry.hidden=!0);ge(h,t),q()});I();const P=document.createElement("style");return P.textContent=xt+i,e.append(P,b,x,h.status,h.retry,y),ge(h,t),q(),()=>{u=!0,j(),o?.(),e.replaceChildren()}}};x({"nodes.summary":"Nodes your data syncs with","nodes.title":"Connected nodes","nodes.lede":"The nodes this session is talking to right now. TinyCloud picks the node for each space; there is nothing to switch here.","nodes.empty":"No node is in use right now.","nodes.unavailable":"Not available right now.","nodes.glance.none":"None","nodes.glance.healthy":"Healthy","nodes.glance.slow":"{count} slow","nodes.glance.down":"{count} down","nodes.card.ok":"Connected","nodes.card.slow":"Slow to respond","nodes.role.local":"On this computer","nodes.role.ownHosted":"Your hosted TinyCloud","nodes.nodeid":"Node ID","nodes.copy":"Copy the node ID of {host}","nodes.spaces":"Spaces here","nodes.latency.value":"{ms} ms · seen {seen}","nodes.latency.only":"{ms} ms","nodes.seen.seconds":"{count} s ago","nodes.seen.minutes":"{count} min ago"});const kt={ok:"nodes.card.ok",slow:"nodes.card.slow",down:"nodes.status.down"},Ct={ok:"ok",slow:"warn",down:"warn"},Et={id:"nodes",labelCode:"nav.nodes",icon:"nodes",summaryCode:"nodes.summary",isAvailable:j,status:e=>se(e,e.data.latest("nodes"),t=>{const n=String(t.length);if(0===t.length)return{text:e.text("nodes.glance.none"),tone:"off",count:n};const o=t.filter(e=>"down"===e.status).length;if(o>0)return{text:e.text("nodes.glance.down",{count:o}),tone:"warn",count:n};const a=t.filter(e=>"slow"===e.status).length;return a>0?{text:e.text("nodes.glance.slow",{count:a}),tone:"warn",count:n}:{text:e.text("nodes.glance.healthy"),tone:"ok",count:n}}),mount(e,t){let n=t.client()?.data,o=!1,a=0;const s=document.createElement("style");s.textContent='\n.nd-wrap{container-type:inline-size;min-width:0}\n.nd-wrap>.nd-lede{margin:0 0 20px;font-size:15px;line-height:1.5;max-width:56ch;color:#09090b}\n.nd-cards{display:grid;gap:14px;grid-template-columns:minmax(0,1fr);margin:0;padding:0;list-style:none}\n@container (min-width:720px){.nd-cards{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}\n.nd-card{min-width:0;padding:14px 16px;border:1px solid #e4e4e7;border-radius:12px;--nd-leader:#a1a1aa}\n.nd-card .row{align-items:baseline}\n.nd-card .row>div{min-width:0;flex:1}\n.nd-host{font:600 15px/1.3 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}\n.nd-kv{display:flex;flex-direction:column;margin:8px 0 0;padding:0}\n.nd-kv>div{display:flex;align-items:center;gap:10px;min-height:40px;padding:0;border-top:1px solid #f4f4f5}\n.nd-kv dt{display:flex;align-items:baseline;gap:10px;flex:1 1 auto;min-width:0;margin:0;font-size:14px;color:#52525b;white-space:nowrap}\n.nd-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted var(--nd-leader);transform:translateY(-3px)}\n.nd-kv dd{display:flex;align-items:center;justify-content:flex-end;gap:2px;flex:0 1 auto;max-width:78%;min-width:0;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.nd-kv dd.nd-mono{font-size:12px;font-weight:500}\n.nd-did-row{display:flex;align-items:center;gap:6px;min-width:0;max-width:100%}\n.nd-did{min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}\n.nd-did-head,.nd-did-tail{overflow-wrap:anywhere}\n.nd-chips{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;margin:0;padding:0;list-style:none}\n.nd-chip{display:inline-flex;align-items:center;min-height:28px;padding:0 11px;border-radius:999px;background:#f4f4f5;font-size:12.5px;font-weight:600;overflow-wrap:anywhere}\n.nd-card .icon-btn{margin:-10px -10px -10px 0}\n.nd-did-row .icon-btn{margin:-10px 0}\n@media (prefers-color-scheme: dark){\n.nd-wrap>.nd-lede{color:#fafafa}\n.nd-card{border-color:#3f3f46;--nd-leader:#71717a}\n.nd-kv>div{border-top-color:#27272a}\n.nd-kv dt{color:#a1a1aa}\n.nd-chip{background:#27272a}\n}\n'+i;const r=document.createElement("h3");r.className="sec-title",r.tabIndex=-1,r.textContent=t.text("nodes.title");const c=pe(t,()=>{m()}),l=document.createElement("div");l.hidden=!0;const u=de("note",t.text("nodes.lede"));u.classList.add("nd-lede");const g=de("note",t.text("nodes.empty"));g.hidden=!0;const f=document.createElement("ul");async function m(){const e=++a,i=n;if(void 0===i)return y(),c.status.hidden=!1,c.status.textContent=t.text("nodes.unavailable"),void(c.retry.hidden=!0);const s=await fe(()=>i.nodes());if(o||e!==a)return;const r=ue(c,t,s);l.hidden=void 0===r,void 0!==r&&(g.hidden=r.length>0,f.replaceChildren(...r.map(e=>function(e){const n=function(e){try{return new URL(e).host}catch{return e}}(e.origin),o=document.createElement("li");o.className="nd-card",o.setAttribute("aria-label",n);const a=document.createElement("div");a.className="row";const i=document.createElement("div"),s=de("label",n);s.classList.add("nd-host"),i.append(s,de("note",function(e,t){return"local"===e.kind?t.text("nodes.role.local"):e.active?t.text("nodes.role.ownHosted"):t.text("nodes.kind.hosted")}(e,t)));const r={text:t.text(kt[e.status]),tone:Ct[e.status]};a.append(i,p(r)),o.append(a);const c=[],l=(e,t,n=!1)=>{const o=document.createElement("div"),a=document.createElement("dt");a.textContent=e;const i=document.createElement("dd");n&&(i.className="nd-mono"),i.append(t),o.append(a,i),c.push(o)},u=e=>{const t=document.createElement("span");return t.textContent=e,t};if(void 0!==e.nodeDid){const o=document.createElement("span");o.className="nd-did";const a=Math.max(0,e.nodeDid.length-4),i=document.createElement("span");i.className="nd-did-head",i.textContent=e.nodeDid.slice(0,a);const s=document.createElement("span");s.className="nd-did-tail",s.textContent=e.nodeDid.slice(a),o.append(i,s);const r=document.createElement("button");r.type="button",r.className="icon-btn",r.setAttribute("aria-label",t.text("nodes.copy",{host:n})),r.append(d("copy")),r.addEventListener("click",()=>{navigator.clipboard?.writeText(o.textContent??"").catch(()=>{})});const c=document.createElement("span");c.className="nd-did-row",c.append(o,r),l(t.text("nodes.nodeid"),c,!0)}"string"==typeof e.version&&""!==e.version.trim()&&l(t.text("nodes.version"),u(`v${e.version}`));const g="number"==typeof e.latencyMs&&Number.isFinite(e.latencyMs)?e.latencyMs:void 0;if(void 0!==g){const n=String(g),o=function(e,t,n){if(!(e instanceof Date))return;const o=t-e.getTime();if(!Number.isFinite(o)||o<0)return;const a=Math.floor(o/1e3);return a<60?n.text("nodes.seen.seconds",{count:a}):n.text("nodes.seen.minutes",{count:Math.floor(a/60)})}(e.lastSeenAt,Date.now(),t),a=void 0!==o?t.text("nodes.latency.value",{ms:n,seen:o}):t.text("nodes.latency.only",{ms:n});l(t.text("nodes.latency"),u(a))}const f=Array.isArray(e.spaces)?e.spaces.filter(e=>"string"==typeof e&&""!==e.trim()):[];if(f.length>0){const e=document.createElement("ul");e.className="nd-chips",e.append(...f.map(e=>{const t=document.createElement("li");return t.className="nd-chip",t.textContent=e,t})),l(t.text("nodes.spaces"),e)}if(c.length>0){const e=document.createElement("dl");e.className="nd-kv",e.append(...c),o.append(e)}return o}(e))))}function h(e){return e.subscribe(e=>{"nodes"===e&&m()})}function y(){l.hidden=!0,g.hidden=!0,f.replaceChildren()}function x(){a++,b(),v?.(),y();const o=t.client()?.data;n=o,void 0===o?s.remove():e.prepend(s),b=o?h(o):()=>{},v=t.client()?.onReset(x),void 0!==o&&ge(c,t),m()}f.className="nd-cards",l.className="nd-wrap",l.append(u,g,f);let b=n?h(n):()=>{},v=t.client()?.onReset(x);const w=t.onClientChange(x);return e.append(r,c.status,c.retry,l),void 0!==n&&(e.prepend(s),ge(c,t)),m(),()=>{o=!0,w(),v?.(),b(),e.replaceChildren()}}},Nt="https://account.tinycloud.xyz/storage";function _t(e){if("object"!=typeof e||null===e||!("manageUrl"in e))return Nt;const t=e.manageUrl;if("string"!=typeof t)return Nt;try{return"https:"===new URL(t).protocol?t:Nt}catch{return Nt}}const At={unsupported:!0,STORAGE_STATUS_UNAVAILABLE:!0};function St(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function Tt(e){return"object"==typeof e&&null!==e&&"usedBytes"in e&&"limitBytes"in e&&St(e.usedBytes)&&(null===e.limitBytes||St(e.limitBytes))}x({"storage.summary":"How much space is used","storage.glance.normal":"Normal","storage.glance.nearly_full":"Nearly full","storage.glance.full":"Full","storage.page.lede":"Your storage is shared by every TinyCloud app you use.","storage.page.lede_short":"How much of your TinyCloud you use.","storage.page.used":"Used","storage.page.by_space":"By space","storage.page.meter":"Storage used","storage.page.of_limit":"of {limit}","storage.page.meter_text":"{used} of {limit} used. {state}.","storage.page.meter_text_open":"{used} used. {state}.","storage.page.space_meter":"{space} storage used","storage.page.space_meter_text":"{used} of {limit}","storage.page.plan":"Plan","storage.page.left":"Left","storage.page.none":"None","storage.page.no_limit":"No limit","storage.page.manage_hint":"(opens in a new tab)","storage.page.nearly_note":"You're close to your limit. Saving large recordings may fail soon.","storage.page.full_title":"Storage full: you can't add more data right now.","storage.page.full_body":"Your existing data stays as it is.","storage.page.unavailable_node":"Storage usage isn't available on this node.","storage.page.permission_title":"{app} can't see your storage yet","storage.page.permission_app":"This app","storage.page.permission_body":"To show how much you use and your plan, TinyCloud needs your permission to read storage details. It can't read, change or delete your files.","storage.page.permission_approve":"You'll approve it in OpenKey.","storage.page.permission_blocked":"This session has no way to ask for it here.","storage.page.allow":"Allow storage details","storage.page.waiting":"Waiting for OpenKey…","storage.page.age_now":"Updated just now","storage.page.age_minutes":"Updated {count} min ago","storage.page.age_hours":"Updated {count} h ago"});const Lt="\n.storage-banner{display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;margin:0 0 28px;padding:14px 16px;border-radius:12px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:14px;line-height:1.45}\n.storage-banner .ui-ic{width:22px;height:22px;margin-top:1px;color:#b35309}\n.storage-banner strong{display:block}\n.storage-banner a.storage-manage{padding-left:0}\n@media (prefers-color-scheme: dark){\n.storage-banner{box-shadow:inset 0 0 0 1px #69696b}\n.storage-banner .ui-ic{color:#f59e0b}\n}\n",Mt={ok:"normal",nearly_full:"nearly",full:"full"},zt=["B","KiB","MiB","GiB","TiB"];function $t(e,t){return Number(e.toFixed(t>=3?2:1))}function Ot(e){let t=0,n=e;for(;t<zt.length-1&&n>=1024;)n/=1024,t+=1;if(0===t)return{amount:String(n),unit:"B"};let o=$t(n,t);return o>=1024&&t<zt.length-1&&(t+=1,o=$t(n/1024,t)),{amount:String(o),unit:zt[t]??"B"}}function Dt(e){const{amount:t,unit:n}=Ot(e);return`${t} ${n}`}function qt(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function Bt(e){const t="perSpace"in e?e.perSpace:void 0;if(!Array.isArray(t))return[];const n=[];for(const e of t){if("object"!=typeof e||null===e)continue;const{space:t,usage:o,source:a}=e;if("string"!=typeof t||"object"!=typeof o||null===o)continue;const{usedBytes:i,limitBytes:s}=o;qt(i)&&(null===s||qt(s))&&n.push({space:t,usedBytes:i,limitBytes:null===s?null:s,source:"string"==typeof a?a:"real"})}return n}function It(e){if(!(Tt(t=e)&&"state"in t&&function(e){return"ok"===e||"nearly_full"===e||"full"===e}(t.state))||"account"in t&&void 0!==t.account&&!Tt(t.account))return;var t;const n=e.account??e,o=n.limitBytes,a=e.account?.plan??e.plan;return{level:null===o?"normal":Mt[e.state],usedBytes:n.usedBytes,limitBytes:o,percent:null!==o&&o>0?Math.min(100,Math.round(n.usedBytes/o*1e3)/10):void 0,plan:"string"==typeof a&&""!==a?a:void 0,leftBytes:null===o?void 0:Math.max(0,o-n.usedBytes),spaces:Bt(e),manageHref:_t(e)}}const jt={normal:{key:"storage.glance.normal",tone:"ok"},nearly:{key:"storage.glance.nearly_full",tone:"warn"},full:{key:"storage.glance.full",tone:"warn"}};function Rt(e,t,n=""){const o=document.createElement(e);return o.className=t,""!==n&&(o.textContent=n),o}function Pt(e,t,n,o){const a=Rt("div","storage-meter");a.setAttribute("role","meter"),a.setAttribute("aria-label",e),a.setAttribute("aria-valuemin","0"),a.setAttribute("aria-valuemax",String(t)),a.setAttribute("aria-valuenow",String(Math.min(n,t))),a.setAttribute("aria-valuetext",o);const i=Rt("i","storage-fill");return i.style.width=`${Math.min(100,n/t*100)}%`,a.append(i),a}function Ft(e,t){const n=Rt("div","storage-link"),o=Rt("a","storage-manage");return o.href=t,o.target="_blank",o.rel="noopener noreferrer",o.append(e.text("storage.manage"),Rt("span","storage-sr",` ${e.text("storage.page.manage_hint")}`),d("ext")),n.append(o),n}function Yt(e,t){const n=Rt("span","storage-st");n.dataset.tone=t;const o=Rt("span","storage-dot");return o.setAttribute("aria-hidden","true"),n.append(o,Rt("span","",e)),n}function Wt(e,t){const n=Rt("div","storage-banner");n.setAttribute("role","status");const o=document.createElement("div"),a=Rt("strong","",e.text("storage.page.full_title"));return o.append(a,e.text("storage.page.full_body"),Ft(e,t)),n.append(d("warn"),o),n}const Ut={id:"storage",labelCode:"nav.storage",icon:"drive",summaryCode:"storage.summary",status:e=>void 0!==e.client()?.storageEpisode?.current()?{text:e.text("storage.glance.full"),tone:"warn"}:se(e,e.data.latest("storage"),t=>{const n=null===It(t)?.limitBytes;return n||"full"!==t.state?n||"nearly_full"!==t.state?{text:e.text("storage.glance.normal"),tone:"ok"}:{text:e.text("storage.glance.nearly_full"),tone:"warn"}:{text:e.text("storage.glance.full"),tone:"warn"}}),isAvailable:e=>!0===e.client()?.signedIn(),mount:function(e,t){const n=document.createElement("style");n.textContent='\n.ui-ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}\n.storage-lede{margin:-14px 0 28px;max-width:56ch;font-size:15px;line-height:1.5}\n.storage-cols{display:grid;gap:28px 36px;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));align-items:start}\n.storage-h{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-size:13px;font-weight:600;line-height:1.3;letter-spacing:.02em}\n.storage-h::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.storage-hd{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:12px}\n.storage-fig{font-size:2.75rem;font-weight:600;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-.03em}\n.storage-fig small{margin-left:2px;white-space:pre-wrap;font-size:1rem;font-weight:500;letter-spacing:0;color:#71717a}\n.storage-st{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;white-space:nowrap;color:#18181b}\n.storage-dot{position:relative;flex:none;width:9px;height:9px;border-radius:50%;background:currentColor}\n.storage-st[data-tone="warn"]{color:#92400e}\n.storage-st[data-tone="warn"] .storage-dot{background:#b45309;box-shadow:0 0 0 1.5px #fff,0 0 0 2.5px #b45309}\n.storage-meter{height:6px;border-radius:999px;background:#f4f4f5;box-shadow:inset 0 0 0 1px #71717a;overflow:hidden}\n.storage-fill{display:block;height:100%;border-radius:999px;background:#09090b;transition:width .6s ease}\n.storage-kv{display:flex;flex-direction:column;margin:14px 0 0;padding:0}\n.storage-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.storage-kv>div:last-child{border-bottom:0}\n.storage-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;margin:0;font-size:14px;white-space:nowrap}\n.storage-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.storage-kv dd{flex:0 1 auto;max-width:78%;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.storage-link{margin-top:6px}\na.storage-manage{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:44px;padding:0 4px;color:inherit;font-size:13px;font-weight:600;text-decoration:underline;text-underline-offset:3px}\na.storage-manage:focus-visible{outline:2px solid #111827;outline-offset:2px}\na.storage-manage .ui-ic{width:14px;height:14px}\n.storage-sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.storage-updated{margin:18px 0 0;font-size:12.5px;line-height:1.4;color:#71717a}\n@media (prefers-reduced-motion:reduce){.storage-fill{transition:none}}\n@media (prefers-color-scheme: dark){\n.storage-kv>div{border-bottom-color:#3f3f46}\n.storage-h::after{background:#3f3f46}\n.storage-fig small,.storage-updated{color:#a1a1aa}\n.storage-st{color:#fafafa}\n.storage-st[data-tone="warn"]{color:#fcd34d}\n.storage-st[data-tone="warn"] .storage-dot{background:#f59e0b;box-shadow:0 0 0 1.5px #151517,0 0 0 2.5px #f59e0b}\n.storage-meter{background:#27272a}\n.storage-fill{background:#fafafa}\n.storage-kv dt::after{border-bottom-color:#71717a}\na.storage-manage:focus-visible{outline-color:#fafafa}\n}\n';const o=new Set,a=e=>{o.has(e)||(o.add(e),n.append(e))},i=Rt("h3","sec-title",t.text("nav.storage"));i.tabIndex=-1;const s=Rt("p","storage-lede");let r,c=!1,l=!1,p=0,u=!1;const g=()=>void 0!==t.client()?.storageEpisode?.current();let f=g();const m=pe(t,()=>{N()}),h=document.createElement("div"),y=Rt("p","storage-updated"),x=Rt("div","storage-ask"),b=Rt("span","ic");b.setAttribute("aria-hidden","true"),b.append(d("drive"));const v=Rt("h4",""),w=document.createElement("p"),k=Rt("p","note"),C=Rt("button","action storage-primary");C.type="button";const E=document.createElement("div");async function N(){if(l)return;const e=p;l=!0,A();try{await t.data.refresh("storage")}catch{}e===p&&(l=!1,A())}function _(){p+=1,l=!1,u=!1,r=void 0,A()}function A(){if(c)return;if(void 0===t.data.source)return m.status.hidden=!1,m.status.textContent=t.text("storage.unavailable"),m.retry.hidden=!0,x.hidden=!0,h.replaceChildren(),void(y.hidden=!0);const e=l?{state:"loading"}:t.data.latest("storage")??{state:"loading"},n=g(),o="needs-permission"===e.state&&!n;let i;if(s.textContent=t.text(o?"storage.page.lede_short":"storage.page.lede"),o)m.status.hidden=!0,m.retry.hidden=!0;else if(l||"error"!==e.state||(p=e.code,!0!==At[p])){const n=ue(m,t,e);i=void 0===n?void 0:It(n),void 0!==n&&void 0===i&&(m.status.hidden=!1,m.status.textContent=t.text("storage.unavailable"))}else m.status.hidden=!1,m.status.textContent=t.text("storage.page.unavailable_node"),m.retry.hidden=!0;var p;if(n&&(m.status.hidden=!0,m.retry.hidden=!0,i=void 0),o&&a('\n.storage-ask{display:flex;flex-direction:column;align-items:flex-start;gap:14px;box-sizing:border-box;padding:20px;border-radius:20px;box-shadow:inset 0 0 0 1px #e4e4e7}\n.storage-ask .ic{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;box-shadow:inset 0 0 0 1px #71717a}\n.storage-ask h4{margin:0 0 6px;font:400 1.375rem/1.2 "Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;overflow-wrap:anywhere}\n.storage-ask p{max-width:52ch;margin:0;font-size:14px;line-height:1.45}\n.storage-ask .note{margin-top:8px;font-size:13px}\n.action.storage-primary{border-color:#09090b;background:#09090b;color:#fff}\n.action.storage-primary:hover{background:#27272a}\n@media (prefers-color-scheme: dark){\n.storage-ask{box-shadow:inset 0 0 0 1px #69696b}\n.action.storage-primary{border-color:#fafafa;background:#fafafa;color:#09090b}\n.action.storage-primary:hover{background:#e4e4e7}\n}\n'),x.hidden=!o,"needs-permission"===e.state){const n=void 0!==t.client()?.requestAuthority&&"space/info"===e.ability;v.textContent=t.text("storage.page.permission_title",{app:t.appLabel()??t.text("storage.page.permission_app")}),w.textContent=n?`${t.text("storage.page.permission_body")} ${t.text("storage.page.permission_approve")}`:t.text("storage.page.permission_body"),C.hidden=!n,C.disabled=u,C.textContent=t.text(u?"storage.page.waiting":"declined"===r?"storage.try_again":"storage.page.allow");const o=n&&"blocked"!==r?"declined"===r?"storage.declined":"":"storage.page.permission_blocked";k.hidden=""===o,k.textContent=""===o?"":t.text(o)}if(n){a(Lt);const n=Rt("div","storage-hd");n.append(Yt(t.text(jt.full.key),jt.full.tone));const o="ready"===e.state?_t(e.data):Nt;h.replaceChildren(Wt(t,o),n)}else if(void 0===i)h.replaceChildren();else{"full"===i.level&&a(Lt),"nearly"===i.level&&a("\n.storage-near{display:flex;gap:6px;align-items:flex-start;margin:6px 0 0;font-size:12.5px;line-height:1.4}\n.storage-near .ui-ic{width:16px;height:16px;margin-top:1px;color:#b35309}\n@media (prefers-color-scheme: dark){.storage-near .ui-ic{color:#f59e0b}}\n"),i.spaces.length>0&&a("\n.storage-h .cnt{font-weight:500;color:#71717a}\n.storage-spaces{margin:0;padding:0;list-style:none}\n.storage-space{display:flex;flex-direction:column;gap:8px;padding:12px 0;border-bottom:1px solid #e4e4e7}\n.storage-space:last-child{border-bottom:0}\n.storage-space .l{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:14px}\n.storage-space .l b{font-weight:600;overflow-wrap:anywhere}\n.storage-space .l span{font-variant-numeric:tabular-nums}\n@media (prefers-color-scheme: dark){\n.storage-h .cnt{color:#a1a1aa}\n.storage-space{border-bottom-color:#3f3f46}\n}\n");const e=Rt("div","storage-cols");e.append(function(e,t){const n=jt[t.level],o=Rt("section","storage-used");o.setAttribute("aria-labelledby","storage-used-h");const a=Rt("h4","storage-h",e.text("storage.page.used"));a.id="storage-used-h";const i=Ot(t.usedBytes),s=Rt("div","storage-fig");s.append(i.amount,Rt("small","",` ${i.unit}`));const r=Dt(t.usedBytes),c=e.text(n.key);let l;if(null===t.limitBytes)s.append(Rt("small","",` ${e.text("storage.page.no_limit")}`)),l=e.text("storage.page.meter_text_open",{used:r,state:c});else{const n=Dt(t.limitBytes);s.append(Rt("small","",` ${e.text("storage.page.of_limit",{limit:n})}`)),l=e.text("storage.page.meter_text",{used:r,limit:n,state:c})}const p=Rt("div","storage-hd");p.append(s,Yt(c,n.tone)),o.append(a,p),null!==t.limitBytes&&t.limitBytes>0&&o.append(Pt(e.text("storage.page.meter"),t.limitBytes,t.usedBytes,l));const u=Rt("dl","storage-kv"),g=(e,t)=>{const n=document.createElement("div");n.append(Rt("dt","",e),Rt("dd","",t)),u.append(n)};if(void 0!==t.plan){const n=t.plan.charAt(0).toUpperCase()+t.plan.slice(1);g(e.text("storage.page.plan"),null===t.limitBytes?n:`${n} — ${Dt(t.limitBytes)}`)}if(null===t.limitBytes?g(e.text("storage.page.left"),e.text("storage.page.no_limit")):g(e.text("storage.page.left"),0===t.leftBytes?e.text("storage.page.none"):Dt(t.leftBytes??0)),o.append(u,Ft(e,t.manageHref)),"nearly"===t.level){const t=Rt("p","storage-near");t.append(d("warn"),e.text("storage.page.nearly_note")),o.append(t)}return o}(t,i)),i.spaces.length>0&&e.append(function(e,t){const n=Rt("section","storage-by-space");n.setAttribute("aria-labelledby","storage-space-h");const o=Rt("h4","storage-h",e.text("storage.page.by_space"));o.id="storage-space-h",o.append(" ",Rt("span","cnt",String(t.spaces.length)));const a=Rt("ul","storage-spaces");for(const n of t.spaces){const o=Rt("li","storage-space");o.dataset.source=n.source;const i=n.limitBytes??t.limitBytes,s=Dt(n.usedBytes),r=Rt("div","l");if(r.append(Rt("b","",n.space),Rt("span","",s)),o.append(r),null!==i&&i>0){const t=e.text("storage.page.space_meter_text",{used:s,limit:Dt(i)});o.append(Pt(e.text("storage.page.space_meter",{space:n.space}),i,n.usedBytes,t))}a.append(o)}return n.append(o,a),n}(t,i)),h.replaceChildren(..."full"===i.level?[Wt(t,i.manageHref)]:[],e)}const f=t.data.age("storage");y.hidden=void 0===i||void 0===f||n,y.textContent=void 0===f?"":function(e,t){const n=Math.floor(t/6e4);return n<1?e.text("storage.page.age_now"):n<60?e.text("storage.page.age_minutes",{count:n}):e.text("storage.page.age_hours",{count:Math.floor(n/60)})}(t,f)}E.append(v,w,k),x.append(b,E,C),C.addEventListener("click",e=>{const n=t.client()?.requestAuthority;if(!e.isTrusted||u||void 0===n)return;u=!0,r=void 0;const o=p;A(),(async()=>{let e;try{e=await n("space/info")}catch{e={approved:!1,code:"failed"}}c||o!==p||(u=!1,e.approved?await N():(r="unsupported"===e.code?"blocked":"declined",A()))})()});const S=t.data.subscribe(()=>A()),T=t.client()?.storageEpisode?.subscribe(()=>{const e=f;f=g(),A(),t.requestRender(),e&&!f&&N()}),L=t.client()?.onReset(_),M=t.onClientChange(_);return e.append(n,i,s,m.status,m.retry,x,h,y),A(),()=>{c=!0,S(),T?.(),L?.(),M(),e.replaceChildren()}}},Ht=[W,wt,ht,Je,Et,Ut,oe],Vt=["localNode","localCopy","delegations","nodes","storage"],Gt=6e4;function Kt(e,t,n){void 0!==t?t.after(n):e?.append(n)}const Xt={ok:!1,code:"stale"},Zt=new WeakMap;function Jt(e,t,a,i){const r=document.createElement("style");r.textContent=I+D,e.append(r);let l,d,p={open:!1,layout:"drawer",phone:!1,showLayoutToggle:!1},u=[],g=!1;const f=C({...t,onNavigate(e){l=e,Y()}}),m=e.querySelector(".layer"),h=m?function(e,t,n){const o=document.createElement("div");o.className="tstack";const a=document.createElement("div"),i=document.createElement("div");o.append(a,i),e.querySelector(":scope > .toasts")?.remove(),e.append(o);const s=new Map,r=new Set;function c(e){const{el:n,body:o,message:a}=B(e.kind);if(a.textContent=b(e.textCode),void 0!==e.href&&void 0!==e.hrefLabelCode){const t=document.createElement("a");t.href=e.href,t.target="_blank",t.rel="noopener noreferrer",t.textContent=b(e.hrefLabelCode),o.append(t)}return n.append(q(()=>t.dismiss(e.id))),n.addEventListener("mouseenter",()=>{r.has(e.id)||(r.add(e.id),t.pause())}),n.addEventListener("mouseleave",()=>{r.delete(e.id)&&t.resume()}),n}const l=t.subscribe(function(e){const n=new Set(e.map(e=>e.id));for(const[e,o]of s)n.has(e)||(r.delete(e)&&t.resume(),o.remove(),s.delete(e));for(const t of e){if(s.has(t.id))continue;const e=c(t);s.set(t.id,e),i.append(e)}}),d=[];let p=0;function u(e){void 0!==e.timer||p>0||(e.startedAt=Date.now(),e.timer=setTimeout(()=>f(e),e.remaining))}function g(e){void 0!==e.timer&&(clearTimeout(e.timer),e.timer=void 0,e.remaining=Math.max(0,e.remaining-(Date.now()-e.startedAt)))}function f(e){const t=d.indexOf(e);-1!==t&&(g(e),d.splice(t,1),e.el.remove())}return{receipt(e){const t=e.rows.map(e=>`${e.labelCode}=${e.value}|${e.copyValue??""}`).join("\n");if(d.some(e=>e.key===t))return!1;const{el:o,body:i,message:s}=B("success"),r=document.createElement("b");r.className="toast__title",r.textContent=b(e.titleCode),s.append(r),void 0!==e.bodyCode&&s.append(b(e.bodyCode));const c=document.createElement("div");c.className="slip";for(const t of e.rows){const e=document.createElement("div");e.textContent=`${b(t.labelCode)} ${t.value}`,c.append(e)}const l=document.createElement("button");l.type="button",l.className="toast__copy",l.textContent=b("toast.copy_receipt"),l.addEventListener("click",()=>{!async function(e){const t=e.map(e=>`${b(e.labelCode)} ${e.copyValue??e.value}`).join("\n");try{await navigator.clipboard.writeText(t),n({kind:"success",textCode:"toast.copied"})}catch{n({kind:"error",textCode:"toast.copy_failed"})}}(e.rows)}),i.append(c,l);const m={key:t,el:o,timer:void 0,remaining:$,startedAt:0};o.append(q(()=>f(m)));let h=!1;for(o.addEventListener("mouseenter",()=>{h||(h=!0,(()=>{p++;for(const e of d)g(e)})())}),o.addEventListener("mouseleave",()=>{h&&(h=!1,(()=>{p=Math.max(0,p-1);for(const e of d)u(e)})())}),d.push(m),a.append(o);d.length>O;)f(d[0]);return u(m),!0},clearReceipts(){for(const e of[...d])f(e)},dispose(){l();for(let e=0;e<r.size;e++)t.resume();r.clear();for(const e of[...d])f(e);s.clear(),o.remove()}}}(m,i,e=>a.toast(e)):void 0,y=m?function(e,t,n,o){const a=document.createElement("div");a.className="scrim",a.setAttribute("aria-hidden","true"),a.addEventListener("click",o);const i=t.querySelector(":scope > .pending");i?i.before(a):t.append(a);let s,r,c,l=!1,d=!1,p=!1;const u=()=>t.querySelector(":scope > .tstack");function g(){return[...Array.from(n.querySelectorAll(L)),...Array.from(u()?.querySelectorAll(L)??[])].filter(M)}const f=e=>null!==e&&(n.contains(e)||(u()?.contains(e)??!1));function m(t){if(!d||T())return;const a=e.activeElement;if(!f(a))return;if("Escape"===t.key)return void(n.contains(a)||o());if("Tab"!==t.key||null===a)return;const i=g(),s=i[0],r=i[i.length-1];if(!s||!r)return void t.preventDefault();const c=a===r||Boolean(r.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING),l=a===s||Boolean(s.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_PRECEDING);!t.shiftKey&&c?(t.preventDefault(),i[E(i.length,i.length-1,!1)]?.focus()):t.shiftKey&&l&&(t.preventDefault(),i[E(i.length,0,!0)]?.focus())}function h(){if(!p){p=!0;try{const e=c?.isConnected&&f(c)&&M(c)?c:g()[0];e?.focus()}finally{p=!1}}}function y(t){T()||t.target===e.host||h()}function x(e){if(p||T())return;const t=e.target;f(t)?c=t:t.matches(".button")&&h()}function b(){if(!d||T()||!c||c.isConnected||!function(){const t=document.activeElement;return null===t||t===document.body||t===e.host&&null===e.activeElement}())return;const t=n.querySelector('[role="alertdialog"],.drawer'),o=t&&M(t)?Array.from(t.querySelectorAll(L)).find(M):void 0,a=Array.from(u()?.querySelectorAll(L)??[]).find(M),i=n.querySelector(".main"),s=i?.querySelector(".sec-title")??i?.firstElementChild,r=o??a??(s instanceof HTMLElement?s:g()[0]);r&&r===s&&(r.tabIndex=-1),r?.focus()}const v=new(e.ownerDocument.defaultView?.MutationObserver??MutationObserver)(()=>b());function w(e){null===e.relatedTarget&&queueMicrotask(b)}function k(e){!d||T()||"Escape"!==e.key||e.composedPath().includes(t)||e.target!==document.body&&e.target!==document.documentElement||queueMicrotask(()=>{if(!d||T()||e.defaultPrevented)return;const t=n.querySelector('[role="alertdialog"],.drawer');t&&M(t)?Array.from(t.querySelectorAll(L)).find(M)?.focus():o()})}function C(){queueMicrotask(()=>{!d||T()||f(e.activeElement)||h()})}function N(e){e?(c=void 0,document.addEventListener("focusin",y,!0),t.addEventListener("focusin",x),t.addEventListener("focusout",w),document.addEventListener("keydown",k,!0),v.observe(t,{childList:!0,subtree:!0})):(document.removeEventListener("focusin",y,!0),t.removeEventListener("focusin",x),t.removeEventListener("focusout",w),document.removeEventListener("keydown",k,!0),v.disconnect())}return t.addEventListener(S,C),t.addEventListener("keydown",m),{sync(t,n){if(t&&!l){const t=document.activeElement;s=t instanceof HTMLElement&&t!==e.host&&t!==document.body?t:void 0,r=void 0}else!t&&l&&(r=d?s:void 0,s=void 0);l=t,n!==d&&(d=n,N(d))},restoreFocus(){const e=r;return r=void 0,!!e?.isConnected&&(e.focus(),!0)},dispose(){N(!1),t.removeEventListener("keydown",m),t.removeEventListener(S,C),a.remove()}}}(e,m,f.el,t.onClose):void 0,x=()=>{const e=a.client();return e&&function(e){let t=Zt.get(e);if(void 0===t){let a;t=Object.create(e,{data:{get:()=>e.data??(e.signedIn()?a??(a=function(e){const t=new Set,a=e=>{for(const n of[...t])n(e)};let i,s;const r=()=>{const t=(0,o.livePanelData)(e);if(t!==i){s?.(),i=t,s=t?.subscribe(a);for(const e of n)a(e)}};return(0,o.onLivePanelDataChange)(e,r),r(),{subscribe:e=>(t.add(e),()=>{t.delete(e)}),account:()=>i?.account()??{state:"loading"},knownDid:()=>i?.knownDid?.(),localNode:()=>i?.localNode()??{state:"loading"},localCopy:()=>i?.localCopy()??{state:"loading"},nodes:()=>i?.nodes()??{state:"loading"},storage:e=>i?.storage(e)??{state:"loading"},delegations:e=>i?.delegations(e)??{state:"loading"},revoke:e=>i?.revoke(e)??Xt,setLocalNodeEnabled:e=>i?.setLocalNodeEnabled(e)??Xt}}(e)):void 0),enumerable:!0}}),Zt.set(e,t)}return t}(e)},v=function(e,t=Date.now){const n=new Map,o=new Set;let a,i,s=0,r=0,c=!1;function l(){for(const e of[...o])e()}async function d(o){const a=e();if(void 0===a)return;const i=r;let s;try{s=await a[o]()}catch{s={state:"error",code:"unknown"}}i===r&&(n.set(o,{result:s,at:t()}),l())}function p(e){return void 0===e?Promise.all(Vt.map(d)).then(()=>{}):d(e)}function u(){a?.(),a=e()?.subscribe(()=>{p()})}return{get source(){return e()},latest:e=>n.get(e)?.result,age(e){const o=n.get(e);return void 0===o?void 0:t()-o.at},refresh:p,generation:()=>s,subscribe:e=>(o.add(e),()=>{o.delete(e)}),start(){c||(c=!0,u(),p(),i=setInterval(()=>{p()},Gt))},stop(){c=!1,r++,a?.(),a=void 0,void 0!==i&&clearInterval(i),i=void 0},reset(){s++,r++,n.clear(),l(),c&&(u(),p())},notify:l}}(()=>x()?.data),w=function(e){const t=new Set;function n(e){return!!t.delete(e)&&(e.remove(),!0)}return{confirm(o){const a=c({question:o.question,cancelLabel:o.cancelLabel,confirmLabel:o.confirmLabel,onCancel:()=>{n(a.el)&&o.onCancel?.()},onConfirm:o.onConfirm});return t.add(a.el),Kt(e(),o.anchor,a.el),a.cancel.focus(),{cancel:a.cancel,confirm:a.confirm,close:()=>{n(a.el)}}},openDrawer(o){const a=function(e){const t=document.createElement("section");t.className="drawer",t.setAttribute("role","region");const n=document.createElement("h3");n.textContent=e.title;const o=s(e.closeLabel);return o.addEventListener("click",e.onClose),t.append(n,...e.body,o),t}({title:o.title,body:o.body,closeLabel:o.closeLabel,onClose:()=>{n(a)&&o.onClose?.()}});t.add(a),Kt(e(),o.anchor,a);const i=a.querySelector("h3");return i?.setAttribute("tabindex","-1"),i?.focus(),{el:a,close:()=>{n(a)}}},closeAll(){for(const e of[...t])n(e)}}}(()=>d),k=st(e=>a.toast(e)),N={...a,client:()=>k(x()),text:b,data:v,layout:()=>p.layout,sections:()=>Ht.filter(e=>e.isAvailable(N)),requestRender:()=>v.notify(),confirm:e=>w.confirm(e),openDrawer:e=>w.openDrawer(e),receipt:e=>a.toastsEnabled()&&void 0!==h&&h.receipt(e),closePanel:t.onClose,openSection(e){l=e,Y()}};function _(){w.closeAll(),d=void 0;for(const e of u)e();u=[]}function A(e){return e.map(e=>{const t=e.status(N);return{id:e.id,labelCode:e.labelCode,icon:e.icon,meta:void 0===t?void 0:t.count??t.text}})}const z=v.subscribe(function(){f.setNav(A(Ht.filter(e=>e.isAvailable(N))),l)});function j(){v.reset(),w.closeAll(),h?.clearReceipts()}let R;function P(){R?.(),R=a.client()?.onReset(j)}const F=a.onClientChange(()=>{P(),j()});function Y(){_();const e=Ht.filter(e=>e.isAvailable(N)),t=e.find(e=>e.id===l)??e[0];if(l=t?.id,f.setLayout(p.layout,{showLayoutToggle:p.showLayoutToggle,phone:p.phone}),f.setAppLabel(N.appLabel()),f.setNav(A(e),l),!p.open||!t)return;const n=document.createElement("section");n.className="section",n.dataset.section=t.id,d=n,f.main.replaceChildren(n);const o=t.mount(n,N);u.push(()=>{o(),n.remove()})}return P(),Object.assign(f,{render(e){p=e,void 0!==e.section&&(l=e.section),y?.sync(e.open,e.open&&"drawer"===e.layout),e.open&&!g?v.start():!e.open&&g&&v.stop(),g=e.open,Y()},restoreFocus:()=>y?.restoreFocus()??!1,dispose(){_(),v.stop(),z(),R?.(),F(),h?.dispose(),y?.dispose()}})}module.exports=t})();
1
+ (()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{mountPanel:()=>Qt});const n=["overview","local","copy","delegations","nodes","storage","activity"],o=require("./panel-data.cjs"),a="tinycloud-ui-panel",i='\n.glance{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}\n.glance-row{display:flex;align-items:center;gap:14px;width:100%;min-height:56px;padding:6px 6px 6px 0;border:0;border-bottom:1px solid #e4e4e7;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}\n.glance-row:last-child{border-bottom:0}\n.glance-row .gl{flex:1;min-width:0}\n.glance-row .gl b{display:block;font-size:14.5px;font-weight:600}\n.glance-row .gl span{display:block;font-size:13px;color:#71717a}\n.glance-row .gr{display:flex;align-items:center;gap:10px;color:#71717a}\n.glance-row .gr .ui-ic{width:16px;height:16px}\n.glance-row .gi{display:inline-flex;flex:none;color:#71717a}\n.glance-row .gi .ui-ic{width:20px;height:20px}\n.ui-ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}\n.st{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;white-space:nowrap}\n.st .dot{top:auto;right:auto;width:9px;height:9px;border:0;border-radius:50%;background:transparent;flex:none;position:relative}\n.st-ok{color:#18181b}\n.st-ok .dot{background:currentColor}\n.st-warn{color:#92400e}\n/* Warning colour from the mockup (panel-mock index.html: --tc-color-warning #b35309 light line 34, #fbbd23 dark line 57; .st-warn .dot line 259). */\n.st-warn .dot{background:#b35309;box-shadow:0 0 0 1.5px #fff,0 0 0 2.5px #b35309}\n.st-off,.st-info{color:#71717a}\n.st-off .dot,.st-info .dot{box-shadow:inset 0 0 0 2px currentColor}\n.st-info .dot::after{content:"";position:absolute;left:-1px;right:-1px;top:3.5px;height:2px;background:currentColor;transform:rotate(-45deg)}\n.drawer{margin-top:12px;padding:14px 16px;border:1px solid #d4d4d8;border-radius:12px;background:#fafafa}\n.drawer>h3{margin:0 0 8px;font-size:15px;font-weight:600;overflow-wrap:anywhere}\n@media (prefers-color-scheme: dark){\n.glance-row{border-bottom-color:#3f3f46}\n.glance-row .gl span,.glance-row .gr{color:#a1a1aa}\n.drawer{border-color:#3f3f46;background:#151517}\n.st-ok{color:#fafafa}\n.st-warn{color:#fcd34d}\n.st-warn .dot{background:#fbbd23;box-shadow:0 0 0 1.5px #151517,0 0 0 2.5px #fbbd23}\n.st-off,.st-info{color:#a1a1aa}\n}\n';function s(e){const t=document.createElement("button");return t.type="button",t.className="action",t.textContent=e,t}let r=0;function c(e){const t=document.createElement("div");t.className="confirm",t.setAttribute("role","alertdialog");const n="tc-confirm-q-"+ ++r;t.setAttribute("aria-describedby",n),t.addEventListener("keydown",t=>{"Escape"===t.key&&(t.stopPropagation(),i.disabled||c.disabled||e.onCancel())});const o=document.createElement("p");o.className="busy",o.id=n,o.textContent=e.question;const a=document.createElement("div");a.className="actions";const i=s(e.cancelLabel);i.addEventListener("click",e.onCancel);const c=s(e.confirmLabel);return c.addEventListener("click",e.onConfirm),a.append(i,c),t.append(o,a),{el:t,cancel:i,confirm:c}}const l={monitor:'<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/>',sync:'<path d="M4 12a8 8 0 0 1 14-5l2 2M20 4v5h-5M20 12a8 8 0 0 1-14 5l-2-2M4 20v-5h5"/>',key:'<circle cx="8" cy="15" r="4"/><path d="M11 12l9-9M17 6l3 3M14 9l2 2"/>',nodes:'<circle cx="6" cy="6" r="2.5"/><circle cx="18" cy="6" r="2.5"/><circle cx="12" cy="18" r="2.5"/><path d="M8.5 6h7M7.2 8.2l3.6 7.6M16.8 8.2l-3.6 7.6"/>',drive:'<rect x="3" y="13" width="18" height="7" rx="2"/><path d="M3 13l3-8h12l3 8M7 16.5h.01"/>',term:'<rect x="3" y="4" width="18" height="16" rx="3"/><path d="M7 10l3 2-3 2M13 15h4"/>',chev:'<path d="M9 5l7 7-7 7"/>',ext:'<path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>',sidebar:'<rect x="3" y="4" width="18" height="16" rx="3"/><path d="M15 4v16"/>',out:'<path d="M10 4H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h5M16 8l4 4-4 4M20 12H9"/>',copy:'<rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a1 1 0 0 1 1-1h10"/>',check:'<path d="M5 12l5 5 9-10"/>',warn:'<path d="M12 3l10 18H2zM12 10v5M12 18h.01"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>',close:'<path d="M6 6l12 12M18 6L6 18"/>',person:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 4-6 8-6s8 2 8 6"/>',eyeoff:'<path d="M3 12s3.5-6 9-6 9 6 9 6-3.5 6-9 6-9-6-9-6zM4 4l16 16"/>'};function d(e){const t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("class","ui-ic"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true"),t.setAttribute("focusable","false"),t.innerHTML=l[e],t}function p(e){const t=document.createElement("span");t.className=`st st-${e.tone}`;const n=document.createElement("span");n.className="dot",n.setAttribute("aria-hidden","true");const o=document.createElement("span");return o.textContent=e.text,t.append(n,o),t}function u(e){const t=document.createElement("button");t.type="button",t.className="glance-row",t.addEventListener("click",e.onOpen);const n=document.createElement("span");n.className="gi",n.append(d(e.icon));const o=document.createElement("span");o.className="gl";const a=document.createElement("b");a.textContent=e.label;const i=document.createElement("span");i.textContent=e.sublabel,o.append(a,i);const s=document.createElement("span");return s.className="gr",void 0!==e.status&&s.append(p(e.status)),s.append(d("chev")),t.append(n,o,s),t}function g(e,t){const n=e.querySelector(".gr");null!==n&&(n.querySelector(".st")?.remove(),void 0!==t&&n.prepend(p(t)))}const f={"panel.title":"TinyCloud","panel.close":"Close","panel.hide":"Hide button","panel.sections":"Sections","panel.in":"in","panel.back":"Back to","section.placeholder":"Not available yet.","view.loading":"Loading…","view.error":"This didn't load.","view.retry":"Try again","view.permission":"This session can't show this yet.","nodes.kind.hosted":"Hosted","nodes.status.down":"Down","nodes.version":"Version","nodes.latency":"Latency","activity.empty":"No requests yet.","nav.account":"Overview","nav.local-tinycloud":"Local TinyCloud","nav.local-copy":"Local copy","nav.delegations":"Delegations","nav.nodes":"Nodes","nav.storage":"Storage","nav.activity":"Activity","button.aria":"TinyCloud settings","status.storage_full":"Storage is full","status.sync_pending":"Erase not confirmed","status.sync_attention":"Local copy needs attention","storage.state.full":"Storage is full","storage.declined":"You declined. Storage usage stays hidden.","storage.try_again":"Try again","storage.unavailable":"Storage usage isn't available here.","storage.manage":"Manage storage","storage.full":"Storage is full. Free up space or upgrade to keep saving.","sync.wipe.note":"Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","sync.error.declined":"You declined. The local copy stays off.","sync.error.unsupported":"This browser can't keep a local copy.","sync.error.failed":"That didn't work. Try again.","sync.reason.unsupported-browser":"This browser can't keep a local copy.","sync.reason.no-eligible-scope":"No space on this TinyCloud account can keep a local copy.","sync.reason.consent-declined":"You declined. The local copy stays off.","sync.reason.storage-blocked":"This browser blocks the storage the local copy needs.","sync.reason.erase-pending":"The last erase is not confirmed yet.","sync.reason.budget-reached":"This device's local copy has reached its size limit.","sync.reason.signed-out":"Sign in to use the local copy.","sync.reason.stale-tab":"Another tab changed this. Reload to continue.","sync.reason.wipe-failed":"Erase didn't finish. The local copy may still be on this device.","sync.reason.session-expired":"Your session expired. Sign in again.","sync.reason.unknown":"Something went wrong with the local copy.","toast.done":"Done","toast.signed_in":"Successfully signed in","toast.attention":"Something needs your attention. Details are in the console.","toast.error_generic":"Something went wrong.","toast.unexpected_error":"An unexpected error occurred. Try refreshing the page.","toast.space_created":"TinyCloud Space created successfully","toast.space_creation_timeout":"Setting up your TinyCloud Space timed out","toast.space_creation_failed":"Failed to create your TinyCloud Space","toast.error.auth.wallet_not_connected":"Please connect your wallet to continue","toast.error.auth.signature_rejected":"Signature was rejected. Please try again","toast.error.auth.chain_mismatch":"Please switch to the correct network","toast.error.storage.upload_failed":"Failed to upload file. Please check your connection","toast.error.storage.insufficient_space":"Insufficient storage space available","toast.error.storage.permission_denied":"Permission denied. Please check your access rights","toast.error.network.connection_failed":"Network connection failed. Please try again","toast.error.network.timeout":"Request timed out. Please try again","toast.error.wasm.initialization_failed":"Failed to initialize security module"};function m(e){return t=e,Object.prototype.hasOwnProperty.call(f,t)?f[e]:f["sync.reason.unknown"];var t}const h={"panel.full_page":"Open full page","panel.sidebar":"Show as sidebar","toast.dismiss":"Dismiss","toast.copy_receipt":"Copy receipt","toast.copied":"Copied","toast.copy_failed":"Couldn't copy. Select the text and copy it by hand.","section.status.checking":"Checking","section.status.needs_permission":"Needs permission","section.status.unavailable":"Unavailable"},y=new Map;function x(e){for(const[t,n]of Object.entries(e))y.set(t,n)}function b(e,t={}){return(Object.prototype.hasOwnProperty.call(h,e)?h[e]:y.get(e)??m(e)).replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e)}const v="http://www.w3.org/2000/svg",w=60,k={page:"M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7",drawer:"M6 4h12a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3zM15 4v16"},C={page:"panel.full_page",drawer:"panel.sidebar"};function E(e){const t=document.createElement("div");t.id=a,t.className="panel",t.dataset.layout="drawer",t.setAttribute("role","dialog"),t.setAttribute("aria-modal","false"),t.setAttribute("aria-label",b("button.aria")),t.hidden=!0;let n,o="drawer",i=!1,s="page",r=!1;const c=document.createElement("h2");c.className="title",c.textContent=b("panel.title");const l=document.createElement("span");l.className="ctx",l.hidden=!0;const p=document.createElement("div");p.className="brand",p.append(c,l);const u=document.createElement("span");u.className="status",u.hidden=!0;const g=document.createElementNS(v,"svg");g.setAttribute("viewBox","0 0 24 24"),g.setAttribute("aria-hidden","true");const f=document.createElementNS(v,"path");g.append(f);const m=document.createElement("span"),h=document.createElement("button");h.type="button",h.className="action layout-switch",h.append(g,m),h.addEventListener("click",()=>e.onLayout(s)),h.hidden=!0;const y=document.createElement("button");y.type="button",y.addEventListener("click",()=>e.onClose());const x=document.createElement("span"),E=document.createElementNS(v,"svg");E.setAttribute("viewBox","0 0 24 24"),E.setAttribute("aria-hidden","true");const N=document.createElementNS(v,"path");function _(){if("drawer"===o||i)return y.className="icon-btn ring",y.setAttribute("aria-label",b("panel.close")),void y.replaceChildren(E);y.className="action",x.textContent=void 0===n?b("panel.close"):`${b("panel.back")} ${n}`,y.setAttribute("aria-label",x.textContent),y.replaceChildren(x)}N.setAttribute("d","M6 6l12 12M18 6L6 18"),E.append(N),_();const A=`${a}-menu`,S=document.createElement("button");S.type="button",S.className="icon-btn ring menu-btn",S.setAttribute("aria-label",b("panel.sections")),S.setAttribute("aria-controls",A),S.setAttribute("aria-expanded","false");const T=document.createElementNS(v,"svg");T.setAttribute("viewBox","0 0 24 24"),T.setAttribute("aria-hidden","true");const L=document.createElementNS(v,"path");L.setAttribute("d","M4 7h16M4 12h16M4 17h16"),T.append(L),S.append(T);const M=document.createElement("div");M.id=A,M.className="menu",M.hidden=!0;const z=document.createElement("div");z.className="menu-wrap",z.append(S,M);const $=document.createElement("div");$.className="head-actions",$.append(z,h,y);const O=document.createElement("header");let D;O.className="head",O.append(p,u,$),O.addEventListener("pointerdown",e=>{D="touch"!==e.pointerType||e.target.closest("button")?void 0:{id:e.pointerId,x:e.clientX,y:e.clientY}}),O.addEventListener("pointerup",t=>{const n=D;if(D=void 0,!n||n.id!==t.pointerId)return;const o=t.clientY-n.y;o>=w&&o>Math.abs(t.clientX-n.x)&&e.onClose()}),O.addEventListener("pointercancel",()=>{D=void 0});const q=document.createElement("nav");q.className="nav",q.setAttribute("aria-label",b("panel.sections"));const B=new Map,I=document.createElement("div");function j(e){r=e,M.hidden=!e,S.setAttribute("aria-expanded",String(e))}return I.className="main",t.append(O,q,I),S.addEventListener("click",()=>{if(r)return void j(!1);j(!0);const e=M.querySelector('[aria-current="page"]')??M.querySelector("button");e?.focus()}),z.addEventListener("focusout",e=>{r&&(z.contains(e.relatedTarget)||j(!1))}),t.addEventListener("keydown",t=>{if("Escape"===t.key){if(t.stopPropagation(),r)return S.focus(),void j(!1);e.onEscape()}}),{el:t,main:I,setOpen(e){t.hidden=!e,t.setAttribute("aria-modal",String(e&&"drawer"===o&&!i)),e||j(!1)},setLayout(e,n){var a;o=e,i=n.phone,t.dataset.layout=e,t.setAttribute("aria-modal",String(!t.hidden&&"drawer"===e&&!i)),s="drawer"===e?"page":"drawer",a=s,f.setAttribute("d",k[a]),m.textContent=b(C[a]),h.hidden=!n.showLayoutToggle,i||j(!1),_()},setAppLabel(e){n=e,l.hidden=void 0===e,l.textContent=void 0===e?"":`${b("panel.in")} ${e}`,_()},setNav(t,n){const o=new Set(t.map(e=>e.id));for(const[e,t]of B)o.has(e)||(t.btn.remove(),t.pick.remove(),B.delete(e));t.forEach((t,o)=>{let a=B.get(t.id);a||(a=function(t){const n=document.createElement("button");n.type="button",n.className="nav-i",n.dataset.section=t.id;const o=document.createElement("span");o.className="nav-n",o.setAttribute("aria-hidden","true");const a=d(t.icon);a.classList.add("nav-ic");const i=document.createElement("span");i.className="nav-l",i.textContent=b(t.labelCode);const s=document.createElement("span");s.className="nav-m",s.setAttribute("aria-hidden","true"),n.append(a,o,i,s),n.addEventListener("click",()=>e.onNavigate(t.id));const r=document.createElement("button");return r.type="button",r.className="menu-i",r.dataset.section=t.id,r.textContent=b(t.labelCode),r.addEventListener("click",()=>{return n=t.id,j(!1),e.onNavigate(n),void function(){const e=I.querySelector(".sec-title")??I.firstElementChild;e instanceof HTMLElement&&(e.tabIndex=-1,e.focus())}();var n}),{btn:n,index:o,meta:s,pick:r}}(t),B.set(t.id,a)),a.index.textContent=String(o+1).padStart(2,"0"),a.meta.textContent=t.meta??"",void 0===t.meta?a.btn.removeAttribute("aria-description"):a.btn.setAttribute("aria-description",t.meta),q.children[o]!==a.btn&&q.insertBefore(a.btn,q.children[o]??null),M.children[o]!==a.pick&&M.insertBefore(a.pick,M.children[o]??null);const i=t.id===n;for(const e of[a.btn,a.pick])i?e.setAttribute("aria-current","page"):e.removeAttribute("aria-current")})},setStatus(e){u.hidden=null===e,u.textContent=null===e?"":b(`status.${e}`)},focusFirst(){i?S.focus():(q.querySelector('[aria-current="page"]')??y).focus()}}}function N(e,t,n){return 0===e?-1:n?t<=0?e-1:t-1:t<0||t>=e-1?0:t+1}var _;const A=Symbol.for("tinycloud.web-sdk.prompt-state"),S=(_=globalThis)[A]??(_[A]={open:new Set,layer:void 0}),T="tinycloud-prompt-settled";function L(){for(const e of S.open)if(e.element?.isConnected&&!e.element.hidden)return!0;return!1}const M='button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),a[href],[tabindex]:not([tabindex="-1"])';function z(e){return"function"==typeof e.checkVisibility?e.checkVisibility({visibilityProperty:!0}):null===e.closest("[hidden]")}const $={info:"info",success:"check",warning:"warn",error:"warn"},O=7e3,D=3,q='\n.tstack{position:fixed;bottom:calc(var(--b) + 56px);display:flex;flex-direction:column;gap:10px;width:min(400px,calc(100vw - 24px));pointer-events:none}\n.layer[data-position="bottom-right"] .tstack{right:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position="bottom-left"] .tstack{left:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position="bottom-center"] .tstack{left:50%;transform:translateX(-50%)}\n.layer[data-panel-open][data-layout="drawer"] .tstack{bottom:12px;width:min(396px,calc(100vw - 24px))}\n.layer[data-panel-open][data-layout="drawer"][data-position="bottom-right"] .tstack{right:12px}\n.layer[data-panel-open][data-layout="drawer"][data-position="bottom-left"] .tstack{left:12px}\n.layer[data-panel-open][data-layout="page"] .tstack{bottom:24px;right:24px;left:auto;transform:none;width:min(420px,calc(100vw - 32px))}\n.layer[data-phone][data-panel-open] .tstack{bottom:calc(var(--b));left:12px;right:12px;transform:none;width:auto}\n.tstack>div{display:contents}\n.tstack .toast{display:flex;align-items:flex-start;gap:12px;box-sizing:border-box;padding:14px 8px 14px 16px;border:0;border-radius:16px;background:#fff;color:#111827;box-shadow:0 12px 32px -8px rgba(0,0,0,.3),0 0 0 1px #a1a1aa;pointer-events:auto;animation:tc-toast-in .45s cubic-bezier(.22,1,.36,1)}\n.tstack .toast__icon{display:inline-flex;flex:none;margin-top:12px}\n.tstack .toast__icon .ui-ic{width:20px;height:20px}\n.tstack .toast__body{flex:1;min-width:0;padding-top:12px;overflow-wrap:anywhere}\n.tstack .toast__title{display:block;font-weight:700}\n.tstack .toast a,.tstack .toast__copy{display:inline-flex;align-items:center;min-height:44px;margin-top:2px;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;text-decoration:underline;text-underline-offset:3px;white-space:nowrap;cursor:pointer}\n.tstack .toast__close{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.tstack .toast__close .ui-ic{width:20px;height:20px}\n.tstack .slip{margin-top:8px;padding:8px 0;border-top:2px dashed #71717a;border-bottom:2px dashed #71717a;font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;overflow-wrap:anywhere}\n.tstack .slip>div{display:block}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n@keyframes tc-toast-in{from{opacity:0;transform:translateY(14px)}}\n@media (prefers-reduced-motion:reduce){\n.tstack .toast{animation:none}\n}\n@media (prefers-color-scheme: dark){\n.tstack .toast{background:#151517;color:#fafafa;box-shadow:0 12px 32px -8px rgba(0,0,0,.6),0 0 0 1px #69696b}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n}\n';function B(e){const t=document.createElement("button");return t.type="button",t.className="toast__close",t.setAttribute("aria-label",b("toast.dismiss")),t.append(d("close")),t.addEventListener("click",e),t}function I(e){const t=document.createElement("div");t.className=`toast toast--${e}`,t.setAttribute("role","error"===e?"alert":"status");const n=document.createElement("span");n.className="toast__icon",n.append(d($[e]));const o=document.createElement("div");o.className="toast__body";const a=document.createElement("div");return a.className="toast__message",o.append(a),t.append(n,o),{el:t,body:o,message:a}}const j='\n.glance-row:focus-visible,.nav-i:focus-visible,.action:focus-visible,.switch:focus-visible,.icon-btn:focus-visible,.menu-i:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n.panel{position:fixed;top:0;bottom:0;right:0;box-sizing:border-box;width:min(420px,100%);padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:"head" "nav" "main";overflow:hidden;border-left:1px solid #e4e4e7;background:#fff;color:#111827;box-shadow:-18px 0 48px -18px rgba(0,0,0,.35);pointer-events:auto;animation:tc-in .42s cubic-bezier(.22,1,.36,1)}\n.layer[data-position="bottom-left"] .panel{left:0;right:auto;border-left:0;border-right:1px solid #e4e4e7;box-shadow:18px 0 48px -18px rgba(0,0,0,.35);animation-name:tc-in-l}\n.layer .panel[data-layout="page"]{top:0;bottom:0;left:0;right:0;width:auto;border:0;box-shadow:none;grid-template-rows:auto minmax(0,1fr);grid-template-columns:288px minmax(0,1fr);grid-template-areas:"head head" "nav main"}\n.head{grid-area:head;position:sticky;top:0;z-index:1;touch-action:none;background:#fff;display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;min-height:68px;padding:14px 12px 10px 20px}\n.brand{display:flex;flex-direction:column;min-width:0;flex:1 0 92px}\n.title{margin:0;font-size:15px;font-weight:600}\n.ctx{overflow:hidden;font-size:12.5px;color:#71717a;text-overflow:ellipsis;white-space:nowrap}\n.head-actions{display:flex;flex-wrap:nowrap;align-items:center;min-width:0;flex-shrink:1;gap:6px}\n.head-actions .layout-switch{flex-shrink:0}\n.head-actions > .action{min-width:44px;overflow:hidden}\n.head-actions > .action span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.icon-btn{display:inline-flex;flex:none;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.icon-btn.ring{box-shadow:inset 0 0 0 1px #71717a}\n.icon-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}\n.status{font-size:12px;color:#4b5563}\n.nav{grid-area:nav;display:flex;flex-wrap:wrap;gap:6px;padding:6px 20px 14px}\n.nav-i{display:inline-flex;align-items:center;min-height:44px;padding:0 13px;border:0;border-radius:999px;background:#f4f4f5;color:#09090b;font:inherit;font-size:13.5px;font-weight:500;white-space:nowrap;cursor:pointer}\n.nav-i[aria-current="page"]{background:#fff;font-weight:700;box-shadow:inset 0 0 0 2px #09090b}\n.nav-n,.nav-ic,.nav-m{display:none}\n.main{grid-area:main;min-width:0;min-height:0;overflow:auto;overflow-wrap:anywhere;box-sizing:border-box;padding:24px 20px 56px;border-top:2px solid #09090b}\n.sec-title{margin:0 0 28px;font-family:"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;font-size:1.5rem;font-weight:400;line-height:1.2;letter-spacing:-.005em}\n.section+.section{margin-top:12px;padding-top:12px;border-top:1px solid #e4e4e7}\n.action{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:44px;min-height:44px;padding:0 20px;border:1px solid;border-color:#71717a;border-radius:999px;background:#fff;color:#09090b;font:inherit;font-size:13.5px;font-weight:700;white-space:nowrap;cursor:pointer}\n.action:hover{background:#f4f4f5}\n.layout-switch{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}\n.layout-switch[hidden]{display:none}\n.layout-switch svg{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}\n.row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px}\n.label{font-weight:500}\n.switch{display:inline-flex;align-items:center;width:56px;min-width:44px;height:44px;padding:0;border:0;background:none;cursor:pointer}\n.switch:disabled{cursor:default;opacity:.6}\n/* The mockup switch: a 56x30 track with a 1px #71717a edge (the .knob background, so it clears 3:1 on the panel) around a muted fill (::before), and a 22px thumb that is black when off and white on a black track when on. */\n.knob{position:relative;display:block;width:56px;height:30px;border-radius:999px;background:#71717a}\n.knob::before{content:"";position:absolute;inset:1px;border-radius:999px;background:#f4f4f5}\n.knob::after{content:"";position:absolute;top:4px;left:4px;width:22px;height:22px;border-radius:50%;background:#09090b;transition:transform .3s cubic-bezier(.22,1,.36,1)}\n.switch[aria-checked="true"] .knob{background:#09090b}\n.switch[aria-checked="true"] .knob::before{background:#09090b}\n.switch[aria-checked="true"] .knob::after{transform:translateX(26px);background:#fff}\n.busy,.note,.error{margin:6px 0 0;font-size:12px;color:#4b5563}\n.note{text-wrap:pretty}\n.action+.note,.note:not([hidden])+.action,.row~.action{margin-top:8px}\n.error{color:#111827}\n.confirm{margin-top:8px}\n.confirm .actions{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}\n.layer .panel[data-layout="page"] .head{padding:12px 24px;border-bottom:1px solid #e4e4e7;background:#fff}\n.layer .panel[data-layout="page"] .nav{flex-direction:column;flex-wrap:nowrap;width:288px;box-sizing:border-box;padding:24px 16px;border-right:1px solid #e4e4e7;background:#fafafa}\n.layer .panel[data-layout="page"] .nav-i{width:100%;min-height:48px;padding:0 12px;border-radius:14px;background:transparent;font-size:14.5px}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"]{background:#fff}\n.layer .panel[data-layout="page"] .nav-i{gap:8px}\n.layer .panel[data-layout="page"] .nav-ic{display:inline-block;width:16px;height:16px}\n.layer .panel[data-layout="page"] .nav-m{display:inline;max-width:90px;margin-left:auto;overflow:hidden;color:#71717a;font-size:12.5px;font-weight:400;text-overflow:ellipsis;white-space:nowrap}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"] .nav-m{color:#09090b}\n.layer .panel[data-layout="page"] .nav-n{display:inline-block;width:18px;font:500 11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;color:#71717a}\n.layer .panel[data-layout="page"] .main{padding:40px 40px 80px;border-top:0;max-width:960px;width:100%;margin:0 auto}\n.layer .panel[data-layout="page"] .sec-title{font-size:1.75rem;line-height:2.125rem;font-weight:600}\n@keyframes tc-in{from{transform:translateX(104%)}to{transform:none}}\n@keyframes tc-in-l{from{transform:translateX(-104%)}to{transform:none}}\n.menu-wrap{display:none;position:relative}\n.menu{position:absolute;top:calc(100% + 6px);right:0;z-index:2;box-sizing:border-box;width:min(280px,calc(100vw - 24px));padding:6px;border-radius:16px;background:#fff;box-shadow:inset 0 0 0 1px #e4e4e7,0 12px 32px -8px rgba(0,0,0,.3)}\n.menu[hidden]{display:none}\n.menu-i{display:flex;align-items:center;width:100%;min-height:44px;padding:0 12px;border:0;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;white-space:nowrap;cursor:pointer}\n.menu-i[aria-current="page"]{font-weight:700;background:#f4f4f5}\n.layer[data-phone] .menu-wrap{display:block}\n.layer[data-phone] .nav{display:none}\n.layer[data-phone] .panel[data-layout="page"]{grid-template-columns:minmax(0,1fr);grid-template-areas:"head" "main"}\n.layer[data-phone] .panel[data-layout="page"] .head{padding:12px 12px 12px 16px}\n.layer[data-phone] .panel[data-layout="page"] .main{padding:24px 16px 56px}\n.layer{--tc-color-overlay:rgb(9 9 11 / .4)}\n.scrim{position:fixed;inset:0;background:var(--tc-color-overlay);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .35s cubic-bezier(.22,1,.36,1),visibility 0s .35s}\n.layer[data-panel-open][data-layout="drawer"] .scrim{opacity:1;visibility:visible;pointer-events:auto;transition:opacity .35s cubic-bezier(.22,1,.36,1)}\n@media (prefers-reduced-motion:reduce){\n.panel,.knob::after,.scrim,.layer[data-panel-open][data-layout="drawer"] .scrim{animation:none;transition:none}\n}\n@media (prefers-color-scheme: dark){\n.layer{--tc-color-overlay:rgb(0 0 0 / .6)}\n.glance-row:focus-visible,.nav-i:focus-visible,.action:focus-visible,.switch:focus-visible,.icon-btn:focus-visible,.menu-i:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n.panel{border-left-color:#69696b;background:#151517;color:#fafafa}\n.head{background:#151517}\n.main{border-top-color:#fafafa}\n.ctx,.status,.busy,.note{color:#a1a1aa}\n.nav-i{background:#27272a;color:#fafafa}\n.nav-i[aria-current="page"]{background:#151517;box-shadow:inset 0 0 0 2px #fafafa}\n.icon-btn.ring{box-shadow:inset 0 0 0 1px #71717a}\n.section+.section{border-top-color:#69696b}\n.action{border-color:#71717a;background:#151517;color:#fafafa}\n.action:hover{background:#27272a}\n.error{color:#fafafa}\n.knob::before{background:#27272a}\n.knob::after{background:#fafafa}\n.switch[aria-checked="true"] .knob{background:#fafafa}\n.switch[aria-checked="true"] .knob::before{background:#fafafa}\n.switch[aria-checked="true"] .knob::after{background:#09090b}\n.layer .panel[data-layout="page"] .head{background:#151517;border-bottom-color:#69696b}\n.layer .panel[data-layout="page"] .nav{background:#151517;border-right-color:#69696b}\n.layer .panel[data-layout="page"] .nav-i{background:transparent}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"]{background:#27272a}\n.layer .panel[data-layout="page"] .nav-n,.layer .panel[data-layout="page"] .nav-m{color:#a1a1aa}\n.layer .panel[data-layout="page"] .nav-i[aria-current="page"] .nav-m{color:#fafafa}\n.menu{background:#151517;box-shadow:inset 0 0 0 1px #69696b,0 12px 32px -8px rgba(0,0,0,.6)}\n.menu-i[aria-current="page"]{background:#27272a}\n}\n',R=()=>!0;function P(e){const t=document.createElement("h3");t.className="sec-title",t.textContent=m(`nav.${e.dataset.section??""}`);const n=document.createElement("p");return n.className="note",n.textContent=m("section.placeholder"),e.append(t,n),()=>{}}x({"account.copied":"DID copied","account.copy_failed":"Could not copy the DID","account.signed_out":"TinyCloud is signed out in this app. Sign in to see your account.","account.signed_in_as":"Signed in as","account.copy_did":"Copy your DID","account.hint":"Need more room? Choose Open full page, at the top, for these same sections on a full screen.","account.button.title":"This button","account.button.body":"TinyCloud shows a round button at the bottom right of {app}. If you'd rather open TinyCloud from the app's own settings, hide it.","account.button.app":"this app","account.button.dev.lead":"For developers.","account.button.dev.body":"Once the button is hidden, your app needs its own way back in: add a place in your settings that calls","account.button.dev.tail":"TinyCloud doesn't bring the button back on its own.","account.loading":"Loading account…","account.unavailable":"Account details are unavailable.","account.session.label":"Session","account.session.expires":"Expires in {hours}h {minutes}m","account.app.label":"You're in","account.glance.title":"At a glance","account.signout.button":"Sign out","account.signout.question":"Sign out of TinyCloud on this device?","account.signout.cancel":"Stay signed in","account.signout.confirm":"Sign out","account.signout.busy":"Signing out…","account.signout.failed":"Sign-out failed. Try again.","account.status.signed_out":"Signed out"});const F='"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif',Y='ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace',W=`\n.account-hint{margin:-14px 0 28px;font-size:12.5px;line-height:1.4}\n.account-cols{display:grid;gap:28px 36px;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));align-items:start}\n.account-ident{display:flex;gap:16px;align-items:center;min-width:0}\n.account-avatar{flex:none;width:64px;height:64px;border-radius:50%;display:grid;place-items:center;font:500 30px/1 ${F};background:#09090b;color:#fff}\n.account-who{min-width:0}\n.account-ident .eyebrow{margin:0;font-size:13px;font-weight:600;line-height:1.3;color:#71717a}\n.account-ident .name{margin:0;font:500 1.375rem/1.2 ${F};overflow-wrap:anywhere}\n.account-idline{display:flex;flex-wrap:wrap;align-items:center;margin-top:2px;min-width:0}\n.account-did{min-width:0;font:.8125rem/1.5 ${Y};color:#71717a;overflow-wrap:anywhere}\n.account-copy{flex:none}\n.account-copy .ui-ic{width:16px;height:16px;stroke-width:2}\n.account-kv{display:flex;flex-direction:column;margin:18px 0 0;padding:0}\n.account-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.account-kv>div:last-child{border-bottom:0}\n.account-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;white-space:nowrap}\n.account-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.account-kv dd{display:flex;flex:0 1 auto;align-items:center;justify-content:flex-end;gap:2px;max-width:78%;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.account-kv .account-host{margin-left:8px;font:400 .8125rem ${Y};color:#71717a}\n.account-signout{margin-top:14px}\n.account-glance{display:flex;flex-direction:column;gap:0}\n.account-rule{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-size:13px;font-weight:600;line-height:1.3;letter-spacing:.02em}\n.account-rule::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.account-button{display:flex;flex-direction:column;align-items:flex-start;gap:12px;margin-top:28px}\n.account-button>*{margin:0}\n.account-button .account-rule{align-self:stretch;margin:0}\n.account-small{max-width:60ch;font-size:14px;line-height:1.45}\n.account-devnote{display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;width:100%;padding:14px 16px;border-radius:12px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:13.5px;line-height:1.5}\n.account-devnote .ui-ic{margin-top:2px;flex:none}\n.account-devnote code{padding:1px 6px;border-radius:6px;background:#f4f4f5;font:600 .8125rem ${Y}}\n@media (prefers-color-scheme: dark){\n.account-avatar{background:#fafafa;color:#09090b}\n.account-ident .eyebrow,.account-did,.account-kv .account-host{color:#a1a1aa}\n.account-kv>div{border-bottom-color:#69696b}\n.account-kv dt::after{border-bottom-color:#71717a}\n.account-rule::after{background:#69696b}\n.account-devnote{box-shadow:inset 0 0 0 1px #69696b}\n.account-devnote code{background:#27272a}\n}\n`,U={id:"account",labelCode:"nav.account",icon:"person",isAvailable:R,status:e=>!0===e.client()?.signedIn()?void 0:{text:e.text("account.status.signed_out"),tone:"off"},mount:function(e,t){const n=t.client(),o=document.createElement("style");o.textContent=W+i;const a=document.createElement("h3");a.className="sec-title",a.tabIndex=-1,a.textContent=t.text("nav.account"),e.append(o,a);let r,l,f=!1,m=0,h={state:"loading"},y=!1,x=!1;const b=document.createElement("p");b.className="note",b.textContent=t.text("account.signed_out");const v=document.createElement("p");v.className="account-hint",v.textContent=t.text("account.hint");const w=document.createElement("div");w.className="account-cols";const k=document.createElement("div"),C=document.createElement("div");C.className="account-ident";const E=document.createElement("div");E.className="account-avatar",E.setAttribute("aria-hidden","true");const N=document.createElement("div");N.className="account-who";const _=document.createElement("p");_.className="eyebrow",_.textContent=t.text("account.signed_in_as");const A=document.createElement("p");A.className="name";const S=document.createElement("div");S.className="account-idline";const T=document.createElement("span");T.className="account-did";const L=document.createElement("button");L.type="button",L.className="icon-btn account-copy",L.setAttribute("aria-label",t.text("account.copy_did")),L.append(d("copy")),S.append(T,L),N.append(_,A,S),C.append(E,N);const M=document.createElement("p");M.className="note";const z=document.createElement("dl");z.className="account-kv";const $=document.createElement("div"),O=document.createElement("dt");O.textContent=t.text("account.session.label");const D=document.createElement("dd");$.append(O,D);const q=document.createElement("div"),B=document.createElement("dt");B.textContent=t.text("account.app.label");const I=document.createElement("dd"),j=document.createTextNode(""),R=document.createElement("span");R.className="account-host",I.append(j,R),q.append(B,I),z.append($,q);const P=s(t.text("account.signout.button"));P.classList.add("account-signout"),P.prepend(d("out"));const F=document.createElement("p");F.className="note",F.textContent=t.text("account.signout.failed");const Y=document.createElement("div");Y.hidden=!0,k.append(C,M,z,P,F,Y);const U=document.createElement("div"),H=document.createElement("h4");H.className="account-rule",H.textContent=t.text("account.glance.title");const V=document.createElement("div");V.className="glance account-glance";const G=[];for(const e of t.sections()){if("account"===e.id||void 0===e.summaryCode)continue;const n=u({icon:e.icon,label:t.text(e.labelCode),sublabel:t.text(e.summaryCode),onOpen:()=>t.openSection(e.id)});G.push({section:e,row:n}),V.append(n)}U.append(H,V),w.append(k,U),e.append(b,v,w);const K=document.createElement("div");K.className="account-button";const X=document.createElement("h4");X.className="account-rule",X.textContent=t.text("account.button.title");const Z=document.createElement("p");Z.className="account-small",Z.textContent=t.text("account.button.body").replace("{app}",t.appLabel()??t.text("account.button.app"));const J=s(t.text("panel.hide"));J.prepend(d("eyeoff")),J.addEventListener("click",()=>t.hideButton());const Q=document.createElement("div");Q.className="account-devnote";const ee=document.createElement("b");ee.textContent=t.text("account.button.dev.lead");const te=document.createElement("code");te.textContent="tc.ui.open()";const ne=document.createElement("div");function oe(){t.canHideButton()?K.isConnected||e.append(K):K.remove()}ne.append(ee,` ${t.text("account.button.dev.body")} `,te,`. ${t.text("account.button.dev.tail")}`),Q.append(d("info"),ne),K.append(X,Z,J,Q),oe();const ae=t.onButtonChange?.(oe);function ie(){if(f)return;const e=!0===n?.signedIn();if(b.hidden=e,v.hidden=!e||"drawer"!==t.layout(),w.hidden=!e,!e)return;const o="ready"===h.state?h.data:void 0,a=void 0===o?n?.data?.knownDid?.():void 0,i=void 0===o?t.appLabel():void 0;if(M.hidden=void 0!==o,M.textContent="loading"===h.state?t.text("account.loading"):void 0===o?t.text("account.unavailable"):"",l=o?.did??a,C.hidden=void 0===l,z.hidden=void 0===o&&void 0===i,void 0!==l){const e=(s=l).length>26?`${s.slice(0,20)}…${s.slice(-4)}`:s,t=o?.displayName??e;A.textContent=t,A.title=void 0===o?.displayName?l:"",E.textContent=t.charAt(0).toUpperCase(),T.textContent=e,T.title=l,T.hidden=void 0===o?.displayName}var s;if($.hidden=void 0===o?.sessionExpiresAt,void 0!==o?.sessionExpiresAt){const{hours:e,minutes:n}=function(e,t){const n=Math.max(0,Math.ceil((e.getTime()-t)/6e4));return{hours:Math.floor(n/60),minutes:n%60}}(o.sessionExpiresAt,Date.now()),a=t.text("account.session.expires").replace("{hours}",String(e)).replace("{minutes}",String(n).padStart(2,"0"));D.replaceChildren(p({text:a,tone:"ok"}))}const r=o?.appName??i;q.hidden=void 0===r,void 0!==r&&(j.textContent=r),R.textContent=o?.appHost??"",R.hidden=void 0===o?.appHost,P.hidden=void 0===n?.signOut,P.disabled=y,F.hidden=!x}function se(){if(!f&&!0===n?.signedIn())for(const{section:e,row:n}of G)g(n,e.status(t))}function re(){r=void 0,Y.replaceChildren(),Y.hidden=!0}async function ce(){const e=++m,t=n?.data;if(!t)return h={state:"error",code:"unavailable"},void ie();let o;h="ready"===h.state||"error"===h.state?h:{state:"loading"},ie();try{o=await t.account()}catch{o={state:"error",code:"unknown"}}f||e!==m||(h=o,ie())}P.addEventListener("click",()=>function(){if(r)return;const e=c({question:t.text("account.signout.question"),cancelLabel:t.text("account.signout.cancel"),confirmLabel:t.text("account.signout.confirm"),onCancel:()=>{re(),P.focus()},onConfirm:()=>{!async function(){if(!n?.signOut||y)return;y=!0,x=!1,r&&(r.confirm.disabled=!0,r.cancel.disabled=!0,r.confirm.textContent=t.text("account.signout.busy")),ie();let e=!0;try{await n.signOut()}catch{e=!1}if(y=!1,!f){if(re(),e)return await ce(),void a.focus();x=!0,ie(),P.focus()}}()}});r=e,Y.replaceChildren(e.el),Y.hidden=!1,e.cancel.focus()}()),L.addEventListener("click",()=>{!async function(){if(void 0===l)return;const e=l,n=t.data.generation();let o=!0;try{await navigator.clipboard.writeText(e)}catch{o=!1}f||n!==t.data.generation()||t.toast(o?{kind:"success",textCode:"account.copied"}:{kind:"error",textCode:"account.copy_failed"})}()});const le=n?.onReset(()=>{h={state:"loading"},ce()}),de=t.data.subscribe(se),pe=n?.data?.subscribe(e=>{"overview"===e&&"error"===h.state&&ce()}),ue=setInterval(ie,6e4);return ce(),se(),()=>{f=!0,clearInterval(ue),le?.(),de(),pe?.(),ae?.(),e.replaceChildren()}}};x({"activity.summary":"Recent requests this session","activity.glance.no_errors":"No errors","activity.glance.errors":"{count} errors","activity.glance.clear":"Clear","activity.chip":"Developer mode","activity.lede":"Every request this app makes to TinyCloud, newest first. Only the first path segment is shown.","activity.devnote_title":"Developer mode is set by {app} in code,","activity.devnote":"in the SDK config. It isn't a user setting, and people using {app} never see this section.","activity.app_fallback":"this app","activity.count_of":" of {total} requests · ","activity.count_error_one":" error","activity.count_error_many":" errors","activity.cap":"Showing the newest {shown} requests.","activity.errors_only":"Errors only","activity.pause":"Pause live","activity.resume":"Resume live","activity.copy_all":"Copy all","activity.copy_one":"Copy request: {target} at {time}","activity.copied_one":"Request copied.","activity.copied_many":"Requests copied as text.","activity.copy_failed":"Could not copy. Select the text and copy it by hand.","activity.no_errors_table":"No errors. Everything this app asked for went through.","activity.table_label":"Request log","activity.col.time":"Time","activity.col.op":"Operation","activity.col.path":"Path","activity.col.space":"Space","activity.col.host":"Host","activity.col.bytes":"Bytes","activity.col.took":"Took","activity.col.result":"Result","activity.col.source":"Source","activity.col.copy":"Copy","activity.res_ok":"ok","activity.res_unknown":"unknown","activity.unavailable":"The request log can't be read right now.","activity.no_errors_unsure":"No failed requests in the log. Some requests have no recorded result.","activity.host_local":"this device","activity.node":"Node","activity.local_copy":"Local copy","activity.on":"On","activity.off":"Off"});const H="—",V='ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace',G=`\n.act-root{container:act/inline-size;min-width:0}\n.act-head{display:flex;flex-direction:column;gap:8px;margin:0 0 36px}\n.act-head-row{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 12px}\n.act-head .sec-title{margin:0}\n.act-chip{display:inline-flex;align-items:center;height:28px;padding:0 11px;border-radius:999px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:12.5px;font-weight:600;white-space:nowrap}\n.act-lede{margin:0;max-width:56ch;font-size:15px;line-height:1.5}\n.act-devnote{display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;margin:0 0 36px;padding:14px 16px;border-radius:12px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:13.5px;line-height:1.5}\n.act-devnote .ui-ic{margin-top:2px}\n.act-devnote p{margin:0}\n.act-tools{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin:0 0 36px}\n.act-count{margin:0;font-size:14px;line-height:1.45}\n.act-count b{font-weight:700}\n.act-chk{display:inline-flex;align-items:center;gap:10px;min-height:44px;font-size:14px;font-weight:600}\n.act-btns{display:flex;flex-wrap:wrap;align-items:center;gap:10px}\n.act-cap{margin:0 0 10px;font-size:12.5px;color:#71717a}\n.act-table{display:flex;flex-direction:column;border-radius:16px;box-shadow:inset 0 0 0 1px #e4e4e7;overflow:hidden;background:#ffffff}\n.act-ar{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:0 8px;padding:10px 4px 10px 12px;border-bottom:1px solid #e4e4e7;font-size:13px;font-variant-numeric:tabular-nums}\n.act-ar:last-child{border-bottom:0}\n.act-ar>*{min-width:0}\n.act-err{background:linear-gradient(90deg,#09090b 0 3px,transparent 3px)}\n.act-hd{display:none;background:#fafafa}\n.act-c-time{order:1;font-family:${V};font-size:12.5px;color:#71717a}\n.act-c-op{order:2;font-family:${V};font-weight:700;font-size:13px;overflow-wrap:anywhere}\n.act-c-path{order:3;font-family:${V};font-size:13px;overflow-wrap:anywhere}\n.act-c-res{order:4;display:inline-flex;align-items:center;gap:6px;font-weight:500;overflow-wrap:anywhere}\n.act-err .act-c-res{font-weight:700}\n.act-c-res .ui-ic{width:14px;height:14px}\n.act-err .act-c-res .ui-ic{color:#8a3f05}\n.act-c-source{order:4;font-size:12.5px;color:#71717a}\n.act-c-copy{order:5;display:flex;align-items:center;justify-content:center;width:44px;height:44px;margin:-9px -2px -9px auto}\n.act-br{order:6;flex-basis:100%;height:0}\n.act-c-space,.act-c-host,.act-c-bytes,.act-c-took{order:7;font-size:12.5px;color:#71717a;overflow-wrap:anywhere}\n.act-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.act-empty{padding:14px 16px;font-size:13.5px;color:#71717a}\n.act-facts{display:grid;gap:0 32px;grid-template-columns:minmax(0,1fr);margin:28px 0 0;padding:0}\n.act-facts>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.act-facts dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;white-space:nowrap}\n.act-facts dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.act-facts dd{margin:0;max-width:78%;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.act-facts .act-mono{font:600 .8125rem ${V}}\n@container act (min-width:720px){\n.act-tools{flex-direction:row;align-items:center;gap:20px}\n.act-count{margin-right:auto}\n.act-table{--act-cols:minmax(62px,70fr) minmax(64px,110fr) minmax(64px,100fr) minmax(64px,80fr) minmax(70px,150fr) minmax(58px,62fr) minmax(58px,64fr) minmax(84px,110fr) minmax(56px,56fr) 44px}\n.act-ar{display:grid;grid-template-columns:var(--act-cols);gap:0 8px;padding:0 6px 0 14px;min-height:48px}\n.act-ar>*{order:0!important}\n.act-c-copy{margin:0}\n.act-br{display:none}\n.act-c-bytes,.act-c-took{text-align:right}\n.act-hd{display:grid;min-height:40px}\n.act-hd>*{font:600 11px ${V}!important;letter-spacing:.08em;text-transform:uppercase;color:#71717a}\n.act-facts{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}\n}\n@media (prefers-reduced-motion:no-preference){\n.act-new{animation:act-in .5s cubic-bezier(.22,1,.36,1)}\n@keyframes act-in{from{opacity:0;transform:translateY(-8px);background-color:#f4f4f5}}\n}\n@media (prefers-color-scheme: dark){\n.act-chip,.act-devnote{box-shadow:inset 0 0 0 1px #69696b}\n.act-cap,.act-empty,.act-c-time,.act-c-source,.act-c-space,.act-c-host,.act-c-bytes,.act-c-took{color:#a1a1aa}\n.act-table{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.act-ar,.act-facts>div{border-bottom-color:#69696b}\n.act-err{background:linear-gradient(90deg,#fafafa 0 3px,transparent 3px)}\n.act-err .act-c-res .ui-ic{color:#fbbd23}\n.act-hd{background:#151517}\n.act-hd>*{color:#a1a1aa}\n.act-facts dt::after{border-bottom-color:#71717a}\n@media (prefers-reduced-motion:no-preference){\n@keyframes act-in{from{opacity:0;transform:translateY(-8px);background-color:#27272a}}\n}\n}\n`,K=/[\p{Cc}\p{Cf}\u2028\u2029]/gu,X=/^[A-Za-z0-9_.:-]{1,64}$/;function Z(e,t){if("string"!=typeof e)return;const n=e.replace(K," ").trim();return""===n?void 0:n.slice(0,t)}function J(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0?e:void 0}function Q(e){if("object"!=typeof e||null===e)return;const t=e,n="number"==typeof t.id&&Number.isFinite(t.id)?String(t.id):Z(t.id,64),o=Z(t.code,64),a={key:"",at:"number"==typeof t.at&&Number.isFinite(t.at)?t.at:void 0,op:Z(t.op,64)??H,path:Z(t.path,256),space:Z(t.space,64),host:Z(t.host,128),bytes:J(t.bytes),durationMs:J(t.durationMs),ok:"boolean"==typeof t.ok?t.ok:void 0,code:void 0!==o&&X.test(o)?o:void 0,source:"replica"===t.source||"network"===t.source?t.source:void 0},i=[a.at,a.op,a.path,a.space,a.host,a.bytes,a.durationMs,a.ok,a.code,a.source];return{...a,key:n??`~${i.join("|")}`}}function ee(e){if(void 0===e)return;let t;try{t=e.snapshot()}catch{return}if(!Array.isArray(t))return;const n=[],o=new Map;for(const e of t){const t=Q(e);if(void 0===t)continue;const a=o.get(t.key)??0;o.set(t.key,a+1),n.push(0!==a&&t.key.startsWith("~")?{...t,key:`${t.key}#${a}`}:t)}return n}function te(e){const t=new Date(e),n=e=>String(e).padStart(2,"0");return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function ne(e,t){let n=e("activity.res_unknown");!0===t.ok?n=e("activity.res_ok"):!1===t.ok&&(n=t.code??e("activity.res_unknown"));let o=H;return"replica"!==t.source&&"network"!==t.source||(o=t.source),[void 0===t.at?H:te(t.at),t.op,t.path??H,t.space??H,t.host??("replica"===t.source?e("activity.host_local"):H),void 0===t.bytes?H:(a=t.bytes,a>=1048576?`${(a/1048576).toFixed(1)} MiB`:a>=1024?`${(a/1024).toFixed(1)} KiB`:`${a} B`),void 0===t.durationMs?H:`${t.durationMs} ms`,n,o];var a}let oe=0;const ae={id:"activity",labelCode:"nav.activity",icon:"term",summaryCode:"activity.summary",isAvailable:e=>e.developerMode(),status(e){const t=e.client()?.requests;if(void 0===t)return;const n=ee(t);if(void 0===n)return;const o=n.filter(e=>!1===e.ok).length;return o>0?{text:e.text("activity.glance.errors",{count:o}),tone:"warn"}:n.some(e=>void 0===e.ok)?void 0:{text:e.text("activity.glance.no_errors"),tone:"ok",count:e.text("activity.glance.clear")}},mount(e,t){const n=t.client()?.requests;return n?function(e,t,n){const o=t.text,a=document.createElement("div");a.className="act-root";const r=document.createElement("style");r.textContent=G+i;const c=document.createElement("div");c.className="act-head";const l=document.createElement("div");l.className="act-head-row";const p=document.createElement("h3");p.className="sec-title",p.tabIndex=-1,p.textContent=o("nav.activity");const u=document.createElement("span");u.className="act-chip",u.textContent=o("activity.chip"),l.append(p,u);const g=document.createElement("p");g.className="act-lede",g.textContent=o("activity.lede"),c.append(l,g);const f=t.appLabel()??o("activity.app_fallback"),m=document.createElement("div");m.className="act-devnote";const h=document.createElement("p"),y=document.createElement("b");y.textContent=o("activity.devnote_title",{app:f}),h.append(y,` ${o("activity.devnote",{app:f})}`),m.append(d("info"),h);const x=document.createElement("p");x.className="act-count";const b=document.createElement("b"),v=document.createTextNode(""),w=document.createElement("b"),k=document.createTextNode("");x.append(b,v,w,k);const C=document.createElement("span");C.id="act-eo-"+ ++oe,C.textContent=o("activity.errors_only");const E=document.createElement("button");E.type="button",E.className="switch",E.setAttribute("role","switch"),E.setAttribute("aria-labelledby",C.id);const N=document.createElement("span");N.className="knob",E.append(N);const _=document.createElement("label");_.className="act-chk",_.append(C,E);const A=s(o("activity.pause")),S=s(o("activity.copy_all"));S.prepend(d("copy"));const T=document.createElement("div");T.className="act-btns",T.append(A,S);const L=document.createElement("div");L.className="act-tools",L.append(x,_,T);const M=document.createElement("p");M.className="act-cap",M.hidden=!0;const z=document.createElement("div");z.className="act-table",z.setAttribute("role","table"),z.setAttribute("aria-label",o("activity.table_label"));const $=function(e){const t=document.createElement("div");t.className="act-ar act-hd",t.setAttribute("role","row");for(const[n,o]of se)t.append(ie(n,"columnheader",e(o)));return t.append(ie("act-sr","columnheader",e("activity.col.copy"))),t}(o),O=document.createElement("div");O.className="act-empty",O.setAttribute("role","row");const D=document.createElement("span");D.setAttribute("role","cell"),O.append(D);const q=document.createElement("dl");q.className="act-facts";const B=document.createElement("div"),I=document.createElement("dt");I.textContent=o("activity.node");const j=document.createElement("dd");j.className="act-mono",B.append(I,j);const R=document.createElement("div"),P=document.createElement("dt");P.textContent=o("activity.local_copy");const F=document.createElement("dd");R.append(P,F),q.append(B,R),a.append(r,c,m,L,M,z,q),e.append(a);let Y,W,U=!1,V=n,K=!1,X=!1,Z=new Set;const J=new Map;let Q=[];function ae(e){const t=ne(o,e),n=document.createElement("div");n.className=!1===e.ok?"act-ar act-err":"act-ar",n.setAttribute("role","row"),se.forEach(([o],a)=>{const i=t[a]??H;if("act-c-res"!==o)return void n.append(ie(o,"cell",i));const s=ie(o,"cell","");!1===e.ok&&s.append(d("warn")),s.append(i),n.append(s)});const a=document.createElement("span");a.className="act-c-copy",a.setAttribute("role","cell");const i=document.createElement("button");i.type="button",i.className="icon-btn";const s=void 0===e.path?e.op:`${e.op} ${e.path}`,r=void 0===e.at?H:te(e.at);i.setAttribute("aria-label",o("activity.copy_one",{target:s,time:r})),i.append(d("copy")),i.addEventListener("click",()=>{le([e],"activity.copied_one")}),a.append(i);const c=document.createElement("span");return c.className="act-br",c.setAttribute("aria-hidden","true"),n.append(a,c),n}function re(){const e=function(){const e=t.data.latest("nodes");if("ready"!==e?.state)return;const n=e.data,o=n.find(e=>e.active)??n[0];if(void 0===o)return;const a=function(e){try{return new URL(e).host}catch{return e}}(o.origin);return void 0===o.version?a:`${a} · ${/^v/i.test(o.version)?o.version:`v${o.version}`}`}();B.hidden=void 0===e,void 0!==e&&(j.textContent=e);const n=t.client()?.sync;if(R.hidden=void 0===n,void 0!==n){const e="on"===n.state.effective||"pending"===n.state.effective;F.textContent=o(e?"activity.on":"activity.off")}q.hidden=B.hidden&&R.hidden}function ce(){const e=Y??ee(V),t=e??[],n=[...t].reverse(),a=t.filter(e=>!1===e.ok).length,i=U?n.filter(e=>!1===e.ok):n,s=new Set;Q=[];for(const e of i){if(100===Q.length)break;s.has(e.key)||(s.add(e.key),Q.push(e))}x.hidden=void 0===e,b.textContent=String(Q.length),v.data=o("activity.count_of",{total:t.length});const r=0===a&&t.some(e=>void 0===e.ok);w.textContent=r?H:String(a),k.data=o(1===a?"activity.count_error_one":"activity.count_error_many"),M.hidden=i.length<=Q.length,M.textContent=o("activity.cap",{shown:Q.length});const c=[$];for(const e of Q){let t=J.get(e.key);void 0===t&&(t=ae(e),X&&!Z.has(e.key)&&t.classList.add("act-new"),J.set(e.key,t)),c.push(t)}0===Q.length&&(void 0===e?D.textContent=o("activity.unavailable"):0===t.length?D.textContent=o("activity.empty"):D.textContent=o(r?"activity.no_errors_unsure":"activity.no_errors_table"),c.push(O));const l=new Set(c);for(const[e,t]of J)l.has(t)||J.delete(e);for(c.forEach((e,t)=>{const n=z.children[t];n!==e&&z.insertBefore(e,n??null)});z.children.length>c.length;)z.lastElementChild?.remove();void 0!==e&&(Z=new Set(t.map(e=>e.key))),X=!0,E.setAttribute("aria-checked",String(U)),A.textContent=o(void 0===Y?"activity.pause":"activity.resume"),S.disabled=0===Q.length,re()}async function le(n,a){if(0===n.length)return;const i=await async function(e,t){try{return await navigator.clipboard.writeText(t),!0}catch{}const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly",""),n.style.cssText="position:fixed;opacity:0;top:0;left:0",e.append(n);try{return n.select(),document.execCommand("copy")}catch{return!1}finally{n.remove()}}(e,n.map(e=>ne(o,e).join(" ")).join("\n"));K||t.toast(i?{kind:"success",textCode:a}:{kind:"error",textCode:"activity.copy_failed"})}E.addEventListener("click",()=>{U=!U,ce()}),A.addEventListener("click",()=>{Y=void 0===Y?ee(V):void 0,ce()}),S.addEventListener("click",()=>{le(Q,"activity.copied_many")});let de=0,pe=[];function ue(){for(const e of pe)e();de+=1;const e=de,n=t.client();V=n?.requests,Y=void 0,void 0!==W&&cancelAnimationFrame(W),W=void 0,J.clear(),Z=new Set,X=!1,pe=[],void 0!==V&&pe.push(V.subscribe(()=>{e===de&&(K||void 0!==W||(W=requestAnimationFrame(()=>{W=void 0,K||(void 0===Y&&ce(),t.requestRender())})))}),V.onClear(()=>{e!==de||K||(Y=void 0,void 0!==W&&cancelAnimationFrame(W),W=void 0,ce(),t.requestRender())}));const o=n?.onReset(ge);void 0!==o&&pe.push(o);const a=n?.sync?.subscribe(()=>{e!==de||K||re()});void 0!==a&&pe.push(a)}function ge(){K||(ue(),ce(),t.requestRender())}ue();const fe=t.onClientChange(ge),me=t.data.subscribe(()=>{K||re()});return ce(),()=>{K=!0,de+=1;for(const e of pe)e();fe(),me(),void 0!==W&&cancelAnimationFrame(W),J.clear(),e.replaceChildren()}}(e,t,n):P(e)}};function ie(e,t,n){const o=document.createElement("span");return o.className=e,o.setAttribute("role",t),o.textContent=n,o}const se=[["act-c-time","activity.col.time"],["act-c-op","activity.col.op"],["act-c-path","activity.col.path"],["act-c-space","activity.col.space"],["act-c-host","activity.col.host"],["act-c-bytes","activity.col.bytes"],["act-c-took","activity.col.took"],["act-c-res","activity.col.result"],["act-c-source","activity.col.source"]];function re(e,t,n){if(void 0===e.data.source)return{text:e.text("section.status.unavailable"),tone:"info"};if(void 0!==t)switch(t.state){case"loading":return{text:e.text("section.status.checking"),tone:"info"};case"needs-permission":return{text:e.text("section.status.needs_permission"),tone:"info"};case"error":return{text:e.text("section.status.unavailable"),tone:"info"};case"ready":return n(t.data)}}const ce={"freshness.updating":"Updating…","freshness.updated":"Updated {age}","freshness.failed":"Couldn't refresh. Showing data from {age}.","freshness.age.now":"just now","freshness.age.minutes":"{n} min ago","freshness.age.hours":"{n} h ago","freshness.age.days":"{n} d ago"};function le(e){return ce[e]}const de={loading:"view.loading","needs-permission":"view.permission",error:"view.error"};function pe(e,t){const n=document.createElement("p");return n.className=e,n.textContent=t,n}function ue(e,t){const n=pe("busy","");n.setAttribute("role","status"),n.hidden=!0;const o=document.createElement("button");return o.type="button",o.className="action",o.textContent=e.text("view.retry"),o.hidden=!0,o.addEventListener("click",()=>t()),{status:n,retry:o}}function ge(e,t,n){if("ready"===n.state){e.retry.hidden=!0;const t=n.freshness?function(e){if(e.refreshing)return le("freshness.updating");const t=function(e){const t=Math.floor(e/6e4);if(t<1)return le("freshness.age.now");if(t<60)return le("freshness.age.minutes").replace("{n}",String(t));const n=Math.floor(t/60);return n<24?le("freshness.age.hours").replace("{n}",String(n)):le("freshness.age.days").replace("{n}",String(Math.floor(n/24)))}(Date.now()-e.updatedAt);return le(e.lastError?"freshness.failed":"freshness.updated").replace("{age}",t)}(n.freshness):void 0;return e.status.hidden=void 0===t,e.status.textContent=t??"",n.data}e.status.hidden=!1,e.status.textContent=t.text(de[n.state]),e.retry.hidden="error"!==n.state}function fe(e,t){ge(e,t,{state:"loading"})}function me(e){return Promise.resolve().then(e).catch(()=>({state:"error",code:"unknown"}))}x({"delegations.summary":"Who can act on your data","delegations.glance.visible":"Visible","delegations.lede":"Who can use your TinyCloud, and what they can do.","delegations.unavailable":"Delegations aren't available here.","delegations.denied":"This session doesn't have access to this list.","delegations.app.fallback":"this app","delegations.app.subject":"This app","delegations.g.app":"Granted to {app}","delegations.g.app.sub":"Access {app} holds on this device.","delegations.g.others":"Granted to others","delegations.g.others.sub":"Other apps and agents you gave access to.","delegations.g.received":"Received","delegations.g.received.sub":"Access that other people or apps gave you.","delegations.g.none":"Nothing here.","delegations.g.none.more":"None in what's loaded so far.","delegations.party.unknown":"Unknown","delegations.firstpage":"Showing {count}. There are more.","delegations.more.btn":"Show more","delegations.more.busy":"Loading…","delegations.more.err":"Couldn't load more.","delegations.reload":"Reload list","delegations.more.loaded":"{count} more loaded.","delegations.empty.title":"No one has access yet","delegations.empty.body":"When you give an app or an agent access to your TinyCloud, it shows up here, with what it can do and when it ends. You can take access back at any time.","delegations.loading":"Loading delegations","delegations.error":"The list of delegations didn't load.","delegations.ask.title":"{app} can't list delegations yet","delegations.ask.body":"To show who has access, TinyCloud needs your permission to read your list of delegations. It can't change them.","delegations.ask.openkey":" You'll approve it in OpenKey.","delegations.ask.button":"Allow delegation list","delegations.ask.declined":"That wasn't allowed, so nothing changed.","delegations.ask.scope":"This shows every app and link that can reach your data across your whole account, and the names of what each can reach. It doesn't show keys or contents.","delegations.ask.busy":"Waiting for your answer…","delegations.ask.error":"The request didn't go through. Try again.","delegations.ask.signin":"Sign in again to allow it.","delegations.ask.native":"This app can't ask for this permission from here.","delegations.kind.app":"This app","delegations.kind.others":"Granted by you","delegations.kind.received":"Shared with you by {who}","delegations.st.active":"Active","delegations.st.soon":"Expiring soon","delegations.st.expired":"Expired","delegations.st.revoked":"Revoked","delegations.st.pending":"Not active yet","delegations.st.unknown":"Unknown","delegations.meta.space":"{space} space","delegations.meta.spaces":"{count} spaces","delegations.meta.created":"Created {when}","delegations.meta.expires":"Expires {when}","delegations.meta.expired":"Expired {when}","delegations.meta.space.unknown":"Space unknown","delegations.meta.created.unknown":"Creation time unknown","delegations.meta.expires.unknown":"Expiry unknown","delegations.meta.sep":" · ","delegations.time.now":"just now","delegations.time.min":"{n} min ago","delegations.time.hour":"{n} h ago","delegations.time.day":"{n} d ago","delegations.time.in":"in {t}","delegations.time.ago":"{t} ago","delegations.ability.can":"Can {what}","delegations.ability.none":"No actions listed","delegations.ability.unknown":"Abilities unknown","delegations.ability.more":" and more that couldn't be read","delegations.ability.all":"everything","delegations.ability.and":" and ","delegations.ability.sep":"; ","delegations.verb.read":"read","delegations.verb.write":"write","delegations.verb.list":"list","delegations.verb.delete":"delete","delegations.chip.read":"Read","delegations.chip.write":"Write","delegations.chip.list":"List","delegations.chip.delete":"Delete","delegations.chip.terminal":"Terminal","delegations.chip.terminal.tip":"Terminal: it can't pass this access on to anyone else.","delegations.see":"See details","delegations.see.for":"See details for {name}","delegations.revoke.btn":"Revoke","delegations.revoke.for":"Revoke access for {name}","delegations.ended.expired":"Expired grants can't be used. Nothing to revoke.","delegations.ended.revoked":"Already revoked. Nothing to revoke.","delegations.ended.pending":"Not active yet. Nothing to revoke.","delegations.ended.unknown":"Status unknown. Nothing to revoke here.","delegations.ended.received":"Shared with you. Only the one who shared it can end it.","delegations.confirm.title":"Revoke access for {name}?","delegations.confirm.title.app":"Revoke access for {name} on this device?","delegations.confirm.after.app":"{name} will stop working here until you sign in again.","delegations.confirm.what":"{name} will stop being able to {what}{where}.","delegations.confirm.generic":"{name} will stop being able to use this access{where}.","delegations.confirm.where":" in your {space} space","delegations.confirm.openkey":"You'll confirm with your wallet in OpenKey. You can give access again later; this can't be undone from here.","delegations.confirm.keep":"Keep access","delegations.confirm.go":"Revoke access","delegations.busy":"Revoking…","delegations.err.failed":"Couldn't revoke this access.","delegations.err.unconfirmed":"We couldn't confirm whether this worked. The list was re-read; try again if this still shows Active.","delegations.err.unconfirmed.later":"We couldn't confirm whether this worked. Reload the list and check.","delegations.prev.ok":"A revoke for your previous account finished.","delegations.prev.failed":"A revoke for your previous account did not finish.","delegations.err.denied":"This session can't change this access. Nothing was changed.","delegations.err.stale":"This access had already ended, so nothing was changed.","delegations.err.ended":"This access has ended.","delegations.live.revoked":"Access revoked for {name}.","delegations.receipt.title":"Access revoked","delegations.receipt.body":"That access has ended.","delegations.receipt.for":"For","delegations.receipt.cid":"Delegation","delegations.receipt.time":"Time","delegations.d.close":"Close","delegations.d.status":"Status","delegations.d.by":"Granted by","delegations.d.to":"Granted to","delegations.d.id":"Delegation ID","delegations.d.resources":"What it covers","delegations.d.issued":"Issued","delegations.d.notbefore":"Not valid before","delegations.d.expires":"Expires","delegations.d.expired":"Expired","delegations.d.parents":"Passed down from","delegations.d.parents.none":"Nothing, it was granted directly","delegations.d.parents.n":"{count} earlier delegations","delegations.d.revokedat":"Revoked","delegations.d.revokedby":"Revoked by","delegations.d.revokedvia":"Revoked through","delegations.d.none":"Unknown","delegations.d.resources.unreadable":"Some of what it covers couldn't be read.","delegations.d.space":"Space","delegations.d.terminal":"Terminal","delegations.d.terminal.yes":"Yes · can't pass access on","delegations.d.terminal.no":"No · can pass access on","delegations.d.noforward":"It can't pass this access on to anyone else.","delegations.receipt.what":"{name} can no longer {what}.","delegations.receipt.generic":"{name} can no longer use this access.","delegations.receipt.what.app":"{name} can no longer {what} on this device.","delegations.receipt.generic.app":"{name} can no longer use this access on this device.","delegations.d.copy.by":"Copy the identity that granted this","delegations.d.copy.to":"Copy the identity that received this","delegations.d.copy.id":"Copy the delegation ID"});const he='"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif',ye='ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace',xe=`\n.dl{container-type:inline-size}\n.dl-lede{margin:-22px 0 28px;max-width:56ch;font-size:15px;line-height:1.5}\n.dl-lede:has(+.dl-fresh:not([hidden])){margin-bottom:10px}\n.dl .dl-fresh{margin:0 0 24px;font-size:12.5px}\n.dl-live{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.dl-body{display:flex;flex-direction:column;gap:28px}\n.dl-h{display:flex;align-items:center;gap:10px;margin:0 0 12px;font:600 13px/1.3 ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;letter-spacing:.02em}\n.dl-h::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.dl-cnt{font-weight:500;color:#71717a}\n.dl-sub{margin:-4px 0 12px;font-size:12.5px;line-height:1.4;color:#71717a}\n.dl-none{margin:0;font-size:14px;line-height:1.45;color:#71717a}\n.dl-list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}\n@container (min-width:720px){.dl-list{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:16px;align-items:start}}\n.dl-wrap{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:1fr;transition:grid-template-rows .4s cubic-bezier(.22,1,.36,1),opacity .3s}\n.dl-in{min-height:0;padding:3px 3px 12px;margin:-3px -3px 0}\n.dl-wrap.dl-leaving{grid-template-rows:0fr;opacity:0}\n.dl-wrap.dl-leaving>.dl-in{overflow:hidden;padding-bottom:0}\n.dl-card{display:flex;flex-direction:column;gap:10px;padding:16px 16px 16px 18px;border-radius:20px;background:#fff;box-shadow:inset 0 0 0 1px #e4e4e7}\n.dl-card:focus{outline:none}\n.dl-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;min-width:0}\n.dl-top .st{flex:none}\n.dl-name{margin:0;font-size:15px;font-weight:600;line-height:1.3;overflow-wrap:anywhere}\n.dl-kind{display:block;margin-top:2px;font-size:12.5px;font-weight:500;color:#71717a;overflow-wrap:anywhere}\n.dl-what{margin:0;font-size:14px;line-height:1.45;overflow-wrap:anywhere}\n.dl-meta{margin:0;font-size:13px;color:#71717a}\n.dl-chips{display:flex;flex-wrap:wrap;gap:6px;margin:0;padding:0;list-style:none}\n.dl-chip{display:inline-flex;align-items:center;box-sizing:border-box;max-width:100%;min-height:28px;padding:4px 11px;border-radius:999px;background:#f4f4f5;color:#09090b;font-size:12.5px;font-weight:600;overflow-wrap:anywhere}\n.dl-chip-line{background:transparent;box-shadow:inset 0 0 0 1px #71717a}\n.dl-acts{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:2px}\n.dl-fine{margin:0;font-size:12.5px;line-height:1.4;color:#71717a}\n.dl-msg{margin:0;font-size:13px;line-height:1.4;color:#09090b}\n.dl-err{display:flex;flex-wrap:wrap;align-items:center;gap:8px}\n.dl-foot{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:16px 0 0}\n.dl-foot[hidden]{display:none}\n.dl-notice{display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:28px 22px;border-radius:20px;box-shadow:inset 0 0 0 1px #e4e4e7}\n.dl-notice-ask{padding:16px 16px 16px 18px}\n.dl-ic{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;box-shadow:inset 0 0 0 1px #71717a}\n.dl-notice-ask .dl-ic{width:44px;height:44px}\n.dl-ic .ui-ic{width:24px;height:24px}\n.dl-notice h4{margin:0;font:400 1.375rem/1.2 ${he}}\n.dl-notice p{margin:0;max-width:52ch;font-size:14px;line-height:1.45}\n.dl-skel{display:flex;flex-direction:column;gap:12px}\n.dl-skel-card{height:132px;border-radius:20px;background:#f4f4f5;animation:dl-pulse 1.4s ease-in-out infinite}\n.dl-skel-line{height:14px;width:40%;border-radius:7px;background:#f4f4f5;animation:dl-pulse 1.4s ease-in-out infinite}\n@keyframes dl-pulse{50%{opacity:.55}}\n.dl-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.dl-kv{display:flex;flex-direction:column;margin:0 0 12px;padding:0}\n.dl-kv>div{display:flex;align-items:center;justify-content:space-between;gap:10px;box-sizing:border-box;min-height:44px;padding:0;border-bottom:1px solid #e4e4e7}\n.dl-kv>div:last-child{border-bottom:0}\n.dl-kv dt{flex:none;font-size:14px}\n.dl-kv dd{display:flex;flex:1 1 auto;align-items:center;justify-content:flex-end;gap:2px;min-width:0;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.dl-kv dd.dl-plain{font-weight:400}\n.dl-kv dd.dl-mono{font:500 12.5px ${ye}}\n.dl-sub-h{margin:12px 0 8px;font-size:13px;font-weight:600}\n.dl-res{display:flex;flex-direction:column;gap:8px;margin:0 0 12px;padding:0;list-style:none}\n.dl-res>li{display:flex;flex-direction:column;gap:6px;padding:10px 14px;border-radius:12px;background:#f4f4f5}\n.dl-res code{font:600 12px ${ye};overflow-wrap:anywhere}\n.dl-res .dl-chips{gap:4px}\n.dl-res .dl-chip{min-height:24px;padding:4px 9px;background:#fff;font-size:12px;line-height:1}\n.section[data-section="delegations"] .confirm{margin-top:10px;padding:14px 16px;border-radius:16px;box-shadow:inset 0 0 0 1px #71717a}\n.section[data-section="delegations"] .confirm p{margin:0;font-size:14px;line-height:1.45;color:inherit}\n.section[data-section="delegations"] .confirm .actions .action:last-child,.section[data-section="delegations"] .confirm .actions .action:last-child:hover{border-color:#09090b;background:#09090b;color:#fff}\n.dl-q-title{display:block;margin-bottom:6px;font:400 1.25rem/1.25 ${he}}\n.dl-q-dim{display:block;margin-top:8px;color:#52525b}\n.drawer .dl-what{margin:0 0 8px}\n@media (prefers-reduced-motion:reduce){\n.dl-wrap{transition:none}\n.dl-skel-card,.dl-skel-line{animation:none}\n}\n@media (prefers-color-scheme: dark){\n.dl-h::after{background:#69696b}\n.dl-cnt,.dl-sub,.dl-none,.dl-kind,.dl-meta,.dl-fine{color:#a1a1aa}\n.dl-card{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.dl-msg{color:#fafafa}\n.dl-chip{background:#27272a;color:#fafafa}\n.dl-chip-line{background:transparent;box-shadow:inset 0 0 0 1px #a1a1aa}\n.dl-notice{box-shadow:inset 0 0 0 1px #69696b}\n.dl-ic{box-shadow:inset 0 0 0 1px #a1a1aa}\n.dl-skel-card,.dl-skel-line{background:#27272a}\n.dl-kv>div{border-bottom-color:#69696b}\n.dl-res>li{background:#27272a}\n.dl-res .dl-chip{height:24px;padding:0 9px;background:#151517}\n.section[data-section="delegations"] .confirm{box-shadow:inset 0 0 0 1px #a1a1aa}\n.section[data-section="delegations"] .confirm .actions .action:last-child,.section[data-section="delegations"] .confirm .actions .action:last-child:hover{border-color:#fafafa;background:#fafafa;color:#09090b}\n.dl-q-dim{color:#d4d4d8}\n}\n`,be=["read","write","list","delete"],ve={"tinycloud.kv/get":"read","tinycloud.kv/put":"write","tinycloud.kv/list":"list","tinycloud.kv/del":"delete",get:"read",put:"write",list:"list",del:"delete"};function we(e,t=64){return e.replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g," ").trim().slice(0,t)}const ke=/^(.*?)\/(?:kv|sql|duckdb|hooks|vault)(?:\/(.*))?$/,Ce=/^tinycloud\.[a-z]+\/(.*)$/i;function Ee(e){const t=Ce.exec(e);if(t)return{path:"/"===(t[1]??"")?"":t[1]??""};const n=ke.exec(e);if(n){const e=(n[1]??"").split(/[:/]/).pop()??"",t=""===e||/^0x[0-9a-f]{16,}$/i.test(e)?void 0:e,o=n[2]??"";return{...void 0===t?{}:{space:t},path:"/"===o?"":o}}return{path:"/"===e?"":e}}function Ne(e){const t=[];if(!Array.isArray(e))return t;for(const n of e){if("object"!=typeof n||null===n)continue;const e="resource"in n?n.resource:void 0,o="actions"in n?n.actions:void 0;if("string"!=typeof e||!Array.isArray(o))continue;const a=new Set,i=[];for(const e of o){if("string"!=typeof e)continue;const t=e.trim().toLowerCase(),n=Object.prototype.hasOwnProperty.call(ve,t)?ve[t]:void 0;if(void 0!==n)a.add(n);else{const t=we(e);""===t||i.includes(t)||i.push(t)}}const s=Ee(we(e,200));t.push({...void 0===s.space?{}:{space:s.space},path:s.path,verbs:be.filter(e=>a.has(e)),raws:i})}return t}function _e(e){return e.length<2?e.join(""):`${e.slice(0,-1).join(", ")}${b("delegations.ability.and")}${e[e.length-1]??""}`}function Ae(e){return e.filter((t,n)=>e.indexOf(t)===n)}function Se(e){if(!Array.isArray(e))return 1;let t=0;for(const n of e)"object"==typeof n&&null!==n&&"resource"in n&&"string"==typeof n.resource&&"actions"in n&&Array.isArray(n.actions)&&n.actions.every(e=>"string"==typeof e)||(t+=1);return t}function Te(e){const t=function(e){const t=new Map;for(const n of e){const e=[...n.verbs.map(e=>b(`delegations.verb.${e}`)),...n.raws];if(0===e.length)continue;const o=e.join("\0"),a=t.get(o)??{words:e,paths:[]};a.paths.push(""===n.path?b("delegations.ability.all"):n.path),t.set(o,a)}return[...t.values()].map(e=>`${_e(e.words)} ${_e(Ae(e.paths))}`).join(b("delegations.ability.sep"))}(Ne(e));return""!==t&&Se(e)>0?`${t}${b("delegations.ability.more")}`:t}function Le(e){try{const t=Ne(e),n=Te(e),o=[...be.filter(e=>t.some(t=>t.verbs.includes(e))).map(e=>b(`delegations.chip.${e}`)),...Ae(t.flatMap(e=>e.raws))],a=Se(e)>0?"delegations.ability.unknown":"delegations.ability.none";return{plain:""===n?b(a):b("delegations.ability.can",{what:n}),chips:o}}catch{return{plain:b("delegations.ability.unknown"),chips:[]}}}const Me={active:"ok",soon:"warn",expired:"info",revoked:"info",pending:"off",unknown:"info"};function ze(e,t){switch(e.status){case"active":{const n=e.expiresAt?.getTime();return void 0!==n&&!Number.isNaN(n)&&n<=t?"expired":e.expiringSoon?"soon":"active"}case"expired":return"expired";case"revoked":case"ancestor_revoked":return"revoked";case"pending":return"pending";default:return"unknown"}}const $e=e=>"active"===e||"soon"===e,Oe=e=>"received"===e.group||"received"===e.direction,De=(e,t)=>$e(ze(e,t))&&!Oe(e),qe=["this-app","to-others","received"];function Be(e){const t=we(e,200);return t.length<=22?t:`${t.slice(0,14)}…${t.slice(-6)}`}function Ie(e){const t=we(e,200);return t.length<=16?t:`${t.slice(0,10)}…${t.slice(-4)}`}function je(e){return Oe(e)?e.delegatorDid:e.delegateDid}function Re(e){const t=we(e.label?.text??"",120),n=!Oe(e)||""!==t&&t!==Be(e.delegateDid)?""===t?Be(je(e)):t:Be(e.delegatorDid);return""===n?b("delegations.party.unknown"):n}function Pe(e){return Ae(e.flatMap(e=>void 0===e.space?[]:[e.space]))}function Fe(e){const t=Math.round(Math.abs(e)/6e4),n=Math.floor(t/1440),o=Math.floor(t%1440/60),a=t%60;return n>0?o>0?`${n}d ${o}h`:`${n}d`:o>0?a>0?`${o}h ${a}m`:`${o}h`:`${a}m`}function Ye(e,t){const n=Math.max(0,Math.round((t-e.getTime())/6e4));return n<1?b("delegations.time.now"):n<60?b("delegations.time.min",{n}):n<1440?b("delegations.time.hour",{n:Math.floor(n/60)}):b("delegations.time.day",{n:Math.floor(n/1440)})}function We(e){return e instanceof Date&&!Number.isNaN(e.getTime())}const Ue={"not-revocable":!0,NOT_FOUND:!0,not_found:!0,"not-found":!0,"not-active":!0},He={PERMISSION_DENIED:!0,"permission-denied":!0,denied:!0},Ve={NETWORK_ERROR:!0,ABORTED:!0,thrown:!0};function Ge(e,t,n){const o=document.createElement(e);return void 0!==t&&(o.className=t),void 0!==n&&(o.textContent=n),o}let Ke=0;const Xe=new Set,Ze=new WeakMap;function Je(e){const t=Ze.get(e);if(void 0!==t)return t;const n=new Set;return Ze.set(e,n),n}const Qe={id:"delegations",labelCode:"nav.delegations",icon:"key",summaryCode:"delegations.summary",isAvailable:e=>!0===e.client()?.signedIn(),status:e=>re(e,e.data.latest("delegations"),t=>{const n=Je(e.data),o=t.rows.filter(e=>!n.has(e.cid)).length,a=void 0!==t.nextCursor;return{text:e.text("delegations.glance.visible"),tone:"ok",...a&&0===o?{}:{count:`${o}${a?"+":""}`}}}),mount:function(e,t){const n=(e,n)=>t.text(e,n),o=()=>t.appLabel()??n("delegations.app.fallback"),a=e=>"this-app"===e.group?t.appLabel()??n("delegations.app.subject"):Re(e),r=Ge("style");r.textContent=i+xe;const c=Ge("div","dl"),l=Ge("h3","sec-title",n("nav.delegations"));l.tabIndex=-1;const u=Ge("p","dl-lede",n("delegations.lede")),g=Ge("div","dl-live");g.setAttribute("role","status"),g.setAttribute("aria-live","polite");const f=Ge("div","dl-skel");f.setAttribute("role","status"),f.setAttribute("aria-busy","true"),f.append(Ge("span","dl-sr",n("delegations.loading")),Ge("div","dl-skel-line"),Ge("div","dl-skel-card"));const m=Ge("div"),h=Ge("div","dl-body"),y=Ge("div","dl-foot"),v=Ge("p","dl-fine"),w=s(n("delegations.more.btn")),k=Ge("p","dl-msg");k.setAttribute("role","alert"),k.hidden=!0,y.append(v,w,k),w.addEventListener("click",()=>{!async function(){const e=_,o=t.data.source;if("loading"===B||void 0===e||void 0===o)return;const a=ne(e);if(void 0===a)return;const i=L;let s;B="loading",oe();try{s=await o.delegations(a)}catch{s={state:"error",code:"thrown"}}if(S||i!==L)return;if("ready"!==s.state)return B="error",oe(),void w.focus({preventScroll:!0});const r=new Set([...e.rows,...q].map(e=>e.cid)),c=s.data.rows.filter(e=>!r.has(e.cid)&&(r.add(e.cid),!0));q=[...q,...c],A={next:s.data.nextCursor},B="idle",g.textContent=n("delegations.more.loaded",{count:c.length}),oe(),void 0!==s.data.nextCursor?w.focus({preventScroll:!0}):(I.get(c[0]?.cid??"")?.article??l).focus({preventScroll:!0})}()});const C=ue(t,()=>{});C.status.classList.add("dl-fresh"),c.append(l,u,C.status,g,f,m,h),e.append(r,c);let E,N,_,A,S=!1,T=!1,L=0,M=0,z=!1,$=!1,O=!1,D=!1,q=[],B="idle";const I=new Map,j=Je(t.data),R=new Set,P=new Map;function F(e){const t=P.get(e);if(void 0!==t)return t;const a="this-app"===e?"app":"to-others"===e?"others":"received",i=Ge("section"),s=Ge("h3","dl-h"),r=Ge("span",void 0,n(`delegations.g.${a}`,{app:o()})),c=Ge("span","dl-cnt");s.append(r,c);const l=Ge("p","dl-sub",n(`delegations.g.${a}.sub`,{app:o()})),d=Ge("ul","dl-list"),p=Ge("p","dl-none",n("delegations.g.none"));i.append(s,l,d,p);const u={section:i,count:c,list:d,none:p};return P.set(e,u),u}function Y(e){const o="dl-"+ ++Ke,a=Ge("li","dl-wrap"),i=Ge("div","dl-in"),r=Ge("article","dl-card");r.tabIndex=-1;const c=Ge("div","dl-top"),d=Ge("div","dl-name");d.id=`${o}-n`;const p=Ge("small","dl-kind"),u=Ge("span");d.append(u,p);const g=Ge("span");c.append(d,g);const f=Ge("p","dl-what"),m=Ge("p","dl-meta"),h=Ge("ul","dl-chips"),y=Ge("div","dl-acts"),x=s(n("delegations.see")),b=s(n("delegations.revoke.btn")),v=Ge("span","dl-fine");y.append(x,b,v);const w=Ge("p","dl-msg",n("delegations.busy"));w.setAttribute("role","status");const k=Ge("div","dl-err");k.setAttribute("role","alert");const C=Ge("p","dl-msg"),E=s(n("view.retry")),N=s(n("delegations.reload"));N.hidden=!0,k.append(C,E,N),r.setAttribute("aria-labelledby",d.id),r.append(c,f,m,h,y,w,k),i.append(r),a.append(i);const _={cid:e.cid,row:e,phase:"idle",confirm:void 0,drawer:void 0,detail:void 0,li:a,article:r,name:u,kind:p,statusSlot:g,what:f,meta:m,chips:h,see:x,revoke:b,ended:v,busy:w,err:k,errText:C,retry:E,reload:N};return x.addEventListener("click",()=>function(e){for(const t of I.values())t!==e&&(t.drawer?.close(),t.drawer=void 0,t.detail=void 0);e.drawer?.close();const o=Ge("div");e.detail=o,o.replaceChildren(...J(e.row,ze(e.row,Date.now()),Date.now()));const a=t.openDrawer({title:Re(e.row),body:[o],closeLabel:n("delegations.d.close"),anchor:e.article,onClose:()=>{e.drawer=void 0,e.detail=void 0,S||e.see.focus()}});a.el.addEventListener("keydown",t=>{"Escape"===t.key&&(t.stopPropagation(),a.close(),e.drawer=void 0,e.detail=void 0,e.see.focus())}),e.drawer=a}(_)),b.addEventListener("click",()=>V(_)),E.addEventListener("click",()=>V(_)),N.addEventListener("click",()=>{!async function(){const e=++L;q=[],A=void 0,B="idle",oe(),await G(),S||e!==L||l.focus({preventScroll:!0})}()}),_}function W(e){const t=Date.now(),{row:o}=e,a=ze(o,t),i=Ne(o.resources),s=Re(o);e.name.textContent=s,e.kind.textContent=function(e,t){if(Oe(e))return b("delegations.kind.received",{who:t});const n=b("this-app"===e.group?"delegations.kind.app":"delegations.kind.others"),o=Be(je(e));return o===t?n:`${n}${b("delegations.meta.sep")}${o}`}(o,s),e.statusSlot.replaceChildren(p({text:n(`delegations.st.${a}`),tone:Me[a]})),e.what.textContent=Le(o.resources).plain,e.meta.textContent=function(e,t,n,o){const a=[],i=Pe(n);if(1===i.length?a.push(b("delegations.meta.space",{space:i[0]??""})):i.length>1?a.push(b("delegations.meta.spaces",{count:i.length})):a.push(b("delegations.meta.space.unknown")),We(e.issuedAt)&&e.issuedAt.getTime()<=o+3e5?a.push(b("delegations.meta.created",{when:Ye(e.issuedAt,o)})):a.push(b("delegations.meta.created.unknown")),We(e.expiresAt)){const n=e.expiresAt.getTime()<=o,i=b(n?"delegations.time.ago":"delegations.time.in",{t:Fe(e.expiresAt.getTime()-o)});a.push(b(n||"expired"===t?"delegations.meta.expired":"delegations.meta.expires",{when:i}))}else a.push(b("delegations.meta.expires.unknown"));return a.join(b("delegations.meta.sep"))}(o,a,i,t);const r=Le(o.resources).chips.map(e=>Ge("li","dl-chip",e));if(!0===o.terminal){const e=Ge("li","dl-chip dl-chip-line",n("delegations.chip.terminal"));e.title=n("delegations.chip.terminal.tip"),r.push(e)}e.chips.replaceChildren(...r),e.chips.hidden=0===r.length,e.see.setAttribute("aria-label",n("delegations.see.for",{name:s}));const c=De(o,t);e.revoke.hidden=!c,e.revoke.disabled=Xe.has(e.cid),e.revoke.setAttribute("aria-label",n("delegations.revoke.for",{name:s})),e.ended.hidden=c,c||(e.ended.textContent=n($e(a)?"delegations.ended.received":"expired"===a?"delegations.ended.expired":"revoked"===a?"delegations.ended.revoked":"unknown"===a?"delegations.ended.unknown":"delegations.ended.pending"));const l=Xe.has(e.cid),d="busy"===e.phase||l;e.busy.hidden=!d;const u="failed"===e.phase||"denied"===e.phase||"stale"===e.phase||"unconfirmed"===e.phase;e.err.hidden=!u;const g=void 0!==_&&!_.rows.some(t=>t.cid===e.cid);if(u){const t=!(c||g||"failed"!==e.phase&&"unconfirmed"!==e.phase);e.errText.textContent=n(`delegations.err.${t?"ended":"unconfirmed"===e.phase&&g?"unconfirmed.later":e.phase}`)}e.reload.hidden=!(u&&"unconfirmed"===e.phase&&g),e.retry.hidden="failed"!==e.phase&&"unconfirmed"!==e.phase||!c,e.retry.disabled=l,void 0!==e.detail&&e.detail.replaceChildren(...J(o,a,t))}function U(){for(const e of I.values())W(e)}function H(e){e.confirm?.close(),e.confirm=void 0}function V(o){if(Xe.has(o.cid)||"busy"===o.phase)return;if(!De(o.row,Date.now()))return;!function(){for(const e of I.values())void 0!==e&&H(e)}(),H(o),o.phase="idle",W(o);const i="this-app"===o.row.group,s=a(o.row),r=Pe(Ne(o.row.resources)),c=1===r.length?n("delegations.confirm.where",{space:r[0]??""}):"",d=Te(o.row.resources),p=n(i?"delegations.confirm.title.app":"delegations.confirm.title",{name:s}),u=""===d?n("delegations.confirm.generic",{name:s,where:c}):n("delegations.confirm.what",{name:s,what:d,where:c}),f=i?`${u} ${n("delegations.confirm.after.app",{name:s})}`:u,m=n("delegations.confirm.openkey"),h=t.confirm({question:`${p} ${f} ${m}`,cancelLabel:n("delegations.confirm.keep"),confirmLabel:n("delegations.confirm.go"),anchor:o.article,onCancel:()=>{o.confirm=void 0,S||!o.revoke.isConnected||o.revoke.hidden||o.revoke.focus()},onConfirm:()=>{!async function(o){if(Xe.has(o.cid)||"busy"===o.phase)return;const i=o.confirm;void 0!==i&&(i.confirm.disabled=!0);const s=t.data.source;if(void 0===s||!De(o.row,Date.now()))return H(o),o.phase="stale",W(o),G(),void l.focus({preventScroll:!0});H(o);const r=L,c=function(){const e=t.data.source;let n=t.data.latest("delegations"),o=!1;return{moved:()=>o||t.data.source!==e,stop:t.data.subscribe(()=>{const e=t.data.latest("delegations");void 0===e&&void 0!==n&&(o=!0),n=e})}}();let d;Xe.add(o.cid),o.phase="busy",U(),o.article.focus();try{d=await s.revoke(o.cid)}catch{d={ok:!1,code:"thrown"}}finally{Xe.delete(o.cid),c.stop()}const p=void 0!==d&&!0===d.ok;if(c.moved())return t.toastsEnabled()&&t.toast({kind:"info",textCode:p?"delegations.prev.ok":"delegations.prev.failed"}),S||Q(o),void t.requestRender();const u=!S&&r===L;if(p){if(j.add(o.cid),t.requestRender(),function(e){const o=(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),i=a(e.row),s="this-app"===e.row.group?".app":"",r=Te(e.row.resources),c=""===r?n(`delegations.receipt.generic${s}`,{name:i}):n(`delegations.receipt.what${s}`,{name:i,what:r}),l=c.includes("{");l||x({"delegations.receipt.sentence":c});!t.receipt({titleCode:"delegations.receipt.title",bodyCode:l?"delegations.receipt.body":"delegations.receipt.sentence",rows:[...l?[{labelCode:"delegations.receipt.for",value:i}]:[],{labelCode:"delegations.receipt.cid",value:we(e.cid,200)},{labelCode:"delegations.receipt.time",value:o}]})&&t.toastsEnabled()&&t.toast({kind:"success",textCode:"delegations.receipt.title"})}(o),G(),S)return;return u?(g.textContent=n("delegations.live.revoked",{name:a(o.row)}),void function(t){I.delete(t.cid),H(t),t.drawer?.close(),t.drawer=void 0;const n=e.getRootNode().activeElement;null!==n&&t.li.contains(n)&&l.focus({preventScroll:!0});const o=()=>t.li.remove();if("function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)o();else{t.li.classList.add("dl-leaving");const e=window.setTimeout(()=>{R.delete(e),o()},420);R.add(e)}oe()}(o)):void Q(o)}const f=void 0!==d&&!1===d.ok?d.code:"thrown";if(o.phase=function(e){return Object.prototype.hasOwnProperty.call(Ue,e)?"stale":Object.prototype.hasOwnProperty.call(He,e)?"denied":Object.prototype.hasOwnProperty.call(Ve,e)?"unconfirmed":"failed"}(f),G(),!u)return t.toastsEnabled()&&t.toast({kind:"error",textCode:`delegations.err.${o.phase}`}),void(S||Q(o));U(),o.retry.hidden?o.article.focus():o.retry.focus()}(o)}});o.confirm=h;const y=h.cancel.closest('[role="alertdialog"]'),b=y?.querySelector("p");if(null!=y&&null!=b){const e="dl-"+ ++Ke,t=Ge("span","dl-q-title",p);t.id=`${e}-t`;const n=Ge("span",void 0,f);n.id=`${e}-b`;const o=Ge("span","dl-q-dim",m);o.id=`${e}-w`,b.replaceChildren(t,n,o),y.setAttribute("aria-labelledby",t.id),y.setAttribute("aria-describedby",`${n.id} ${o.id}`)}}async function G(){try{await t.data.refresh("delegations")}catch{}}function K(e,t){const o=Ge("div");return o.append(Ge("dt",void 0,n(e)),Ge("dd","dl-plain",t)),o}function X(e,o,a,i){if(""===o)return K(e,n("delegations.d.none"));const s=Ge("div"),r=Ge("dd","dl-mono");return r.append(Ge("span",void 0,a),function(e,o){const a=Ge("button","icon-btn");return a.type="button",a.setAttribute("aria-label",n(o)),a.append(d("copy")),a.addEventListener("click",()=>{(async()=>{try{await navigator.clipboard.writeText(e),t.toast({kind:"success",textCode:"toast.copied"})}catch{t.toast({kind:"error",textCode:"toast.copy_failed"})}})()}),a}(o,i)),s.append(Ge("dt",void 0,n(e)),r),s}function Z(e){return We(e)?e.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):n("delegations.d.none")}function J(e,t,o){const a=Ne(e.resources),i=Ge("p","dl-what",`${Le(e.resources).plain}${!0===e.terminal?`. ${n("delegations.d.noforward")}`:"."}`),s=Ge("dl","dl-kv"),r=Ge("dd");r.append(p({text:n(`delegations.st.${t}`),tone:Me[t]}));const c=Ge("div");c.append(Ge("dt",void 0,n("delegations.d.status")),r),s.append(c,X("delegations.d.by",e.delegatorDid,Be(e.delegatorDid),"delegations.d.copy.by"),X("delegations.d.to",e.delegateDid,Be(e.delegateDid),"delegations.d.copy.to"),X("delegations.d.id",e.cid,Ie(e.cid),"delegations.d.copy.id"),K("delegations.d.issued",Z(e.issuedAt)),K("delegations.d.notbefore",Z(e.notBefore)),K(We(e.expiresAt)&&e.expiresAt.getTime()<=o?"delegations.d.expired":"delegations.d.expires",Z(e.expiresAt)),K("delegations.d.parents",Array.isArray(e.parents)?0===e.parents.length?n("delegations.d.parents.none"):n("delegations.d.parents.n",{count:e.parents.length}):n("delegations.d.none")));const l=Pe(a);s.insertBefore(K("delegations.d.space",0===l.length?n("delegations.d.none"):l.join(", ")),s.children[1]??null),void 0!==e.terminal&&s.append(K("delegations.d.terminal",n(e.terminal?"delegations.d.terminal.yes":"delegations.d.terminal.no"))),("revoked"===t||void 0!==e.revokedAt&&null!==e.revokedAt)&&s.append(K("delegations.d.revokedat",Z(e.revokedAt))),void 0!==e.revokedBy&&s.append(K("delegations.d.revokedby",Be(e.revokedBy))),void 0!==e.revokedAncestorCid&&s.append(K("delegations.d.revokedvia",Ie(e.revokedAncestorCid)));const d=Ge("h4","dl-sub-h",n("delegations.d.resources")),u=Ge("ul","dl-res");for(const t of Ne(e.resources)){const e=Ge("li");e.append(Ge("code",void 0,""===t.path?n("delegations.ability.all"):t.path));const o=Ge("ul","dl-chips");for(const e of t.verbs)o.append(Ge("li","dl-chip",n(`delegations.chip.${e}`)));for(const e of t.raws)o.append(Ge("li","dl-chip",e));o.childElementCount>0&&e.append(o),u.append(e)}return[i,s,d,u,...Se(e.resources)>0?[Ge("p","dl-fine",n("delegations.d.resources.unreadable"))]:[]]}function Q(e){I.get(e.cid)===e&&I.delete(e.cid),H(e),e.drawer?.close(),e.li.remove()}function ee(e,t,...n){const o=Ge("div",e),a=Ge("span","dl-ic");return a.setAttribute("aria-hidden","true"),a.append(d("key")),o.append(a,Ge("h4",void 0,t),...n),o}function te(e){m.replaceChildren(...void 0===e?[]:[e]),m.hidden=void 0===e}function ne(e){return void 0===A?e.nextCursor:A.next}function oe(){if(S)return;const a=t.data.source,i=t.data.latest("delegations"),r=z&&(a!==E||void 0===i&&void 0!==N||"ready"===N?.state&&"ready"!==i?.state);if(z=!0,E=a,N=i,r){L+=1,M+=1,T=!1,$=!1,O=!1,D=!1;for(const e of[...I.values()])Q(e)}if(void 0!==i&&"ready"===i.state||(q=[],A=void 0,B="idle"),void 0===a||"ready"!==i?.state&&"needs-permission"!==i?.state?(C.status.hidden=!0,C.status.textContent=""):(ge(C,t,i),"needs-permission"===i.state&&(C.status.textContent=n("delegations.denied"))),f.hidden=!0,h.hidden=!0,void 0!==a){if(T||void 0===i||"loading"===i.state)return te(void 0),void(f.hidden=!1);switch(i.state){case"needs-permission":return void te(function(e){const a=t.client(),i=a?.requestAuthority,r="delegation/list"===e,c=r&&"function"==typeof i,d=[Ge("p",void 0,n("delegations.ask.body")+(c?n("delegations.ask.openkey"):""))];if(r&&d.push(Ge("p","dl-fine",n("delegations.ask.scope"))),$&&d.push(Ge("p","dl-fine",n("delegations.ask.declined"))),D){const e=Ge("p","dl-fine",n("delegations.ask.error"));e.setAttribute("role","status"),d.push(e)}if(c&&void 0!==i){const t=s(n(O?"delegations.ask.busy":"delegations.ask.button"));t.disabled=O,t.addEventListener("click",()=>{if(O)return;O=!0,D=!1,$=!1,t.disabled=!0,t.textContent=n("delegations.ask.busy");const o=L;(async()=>{let t;try{t=await i(e)}catch{t={approved:!1,code:"failed"}}S||o!==L||(O=!1,D="failed"===t.code,$=!t.approved&&!D,t.approved&&await G(),S||o!==L||(t.approved&&l.focus({preventScroll:!0}),oe()))})()}),d.push(t)}else if(r&&"native"===a?.platform){const e=s(n("delegations.ask.button"));e.disabled=!0,d.push(e,Ge("p","dl-fine",n("delegations.ask.native")))}else r&&d.push(Ge("p","dl-fine",n("delegations.ask.signin")));return ee("dl-notice dl-notice-ask",n("delegations.ask.title",{app:o()}),...d)}(i.ability));case"error":return void te(function(){const e=Ge("div","dl-notice"),t=Ge("p",void 0,n("delegations.error"));t.setAttribute("role","status");const o=s(n("view.retry"));return o.addEventListener("click",()=>{const e=++M;T=!0,oe(),G().then(()=>{e===M&&(T=!1,oe())})}),e.append(t,o),e}());case"ready":!function(t){_=t;const o=new Set(t.rows.map(e=>e.cid)),a=[...t.rows,...q.filter(e=>!o.has(e.cid))].filter(e=>!j.has(e.cid)),i=void 0!==ne(t);if(0===a.length&&!i){for(const e of[...I.values()])"busy"!==e.phase&&Q(e);return te(ee("dl-notice",n("delegations.empty.title"),Ge("p",void 0,n("delegations.empty.body")))),void(h.hidden=!0)}te(void 0),h.hidden=!1;const s=function(e){const t={"this-app":[],"to-others":[],received:[]};for(const n of e)t[Oe(n)?"received":qe.includes(n.group)?n.group:"to-others"].push(n);return t}(a),r=new Set,c=[];for(const t of qe){const o=s[t];if("received"===t&&0===o.length)continue;const a=F(t);a.count.textContent=i?0===o.length?"":`${o.length}+`:String(o.length),a.none.hidden=o.length>0,a.none.textContent=n(i?"delegations.g.none.more":"delegations.g.none");const l=[];for(const t of o){let n=I.get(t.cid);if(void 0===n&&(n=Y(t),I.set(t.cid,n)),n.row=t,r.add(t.cid),void 0!==n.confirm&&!De(t,Date.now())){const t=n.confirm.cancel.closest("[role=alertdialog]"),o=e.getRootNode().activeElement,a=null!==t&&null!==o&&t.contains(o);H(n),n.phase="stale",a&&n.article.focus({preventScroll:!0})}W(n),l.push(n.li)}l.forEach((e,t)=>{a.list.children[t]!==e&&a.list.insertBefore(e,a.list.children[t]??null)}),c.push(a.section)}for(const e of[...I.values()])r.has(e.cid)||"busy"===e.phase||Q(e);y.hidden=!i,v.textContent=n("delegations.firstpage",{count:`${a.length}+`}),w.textContent=n("loading"===B?"delegations.more.busy":"error"===B?"view.retry":"delegations.more.btn"),w.setAttribute("aria-disabled",String("loading"===B)),k.hidden="error"!==B,k.textContent=n("delegations.more.err");const l=[...c,y];for(l.forEach((e,t)=>{h.children[t]!==e&&h.insertBefore(e,h.children[t]??null)});h.children.length>l.length;)h.lastElementChild?.remove()}(i.data)}}else te(Ge("p","note",n("delegations.unavailable")))}const ae=t.data.subscribe(oe);oe();const ie=t.data.age("delegations");return void 0!==ie&&ie>1e4&&G(),()=>{S=!0,ae();for(const e of R)window.clearTimeout(e);R.clear();for(const e of I.values())H(e),e.drawer?.close();e.replaceChildren()}}},et={off:!0,enabling:!0,on:!0,wiping:!0,pending:!0,unavailable:!0};function tt(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(et,e)?e:"unavailable"}const nt=1e4,ot=new WeakMap,at=new WeakMap,it=Object.freeze({ok:!1,retryNow:!1});function st(e){return new Promise(t=>{let n=!1;const o=e=>{n||(n=!0,clearTimeout(a),t(e))},a=setTimeout(()=>o(it),nt);Promise.resolve().then(e).then(e=>o(!0===e?.ok?{ok:!0}:{ok:!1,retryNow:!0===e?.retryNow}),()=>o({ok:!1,retryNow:!1}))})}function rt(e){return t=>{const n=t?.signOut;if(void 0===t||void 0===n)return t;const o=at.get(t);if(void 0!==o)return o;const a=t.purgeLocalCopy,i=void 0===a?void 0:function(e,t,n){let o,a,i=0;const s=new Set,r=e=>{if(o!==e){o=e;for(const e of[...s])e()}},c=()=>{const e=++i;return()=>i===e};return{begin:c,failure:()=>e.signedIn()?void 0:o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),settle(t,a){const i="readable"===o&&t===it,s=a||!1===t.ok&&t.retryNow||i?"readable":"pending";e.signedIn()?!1===t.ok&&r(s):!0!==t.ok?(r(s),n({kind:"warning",textCode:"readable"===s?"local-copy.purge.toast.readable":"local-copy.purge.toast.pending"})):r(void 0)},markPending(){r("readable"===o?"readable":"pending")},retry(){if(e.signedIn())return Promise.resolve(!1);if(void 0===o)return Promise.resolve(!0);if(void 0!==a&&a.latest())return a.promise;const n=c(),i=st(t).then(t=>!(!n()||(!0===t.ok?e.signedIn()||(r(void 0),0):(t.retryNow&&r("readable"),1)))).finally(()=>{a?.promise===i&&(a=void 0)});return a={promise:i,latest:n},i}}}(t,a,e);let s;const r=Object.create(t,{signOut:{value:()=>{const e=s;if(!(void 0===e||e.purging&&t.signedIn()))return e.promise;const o={purging:!1,promise:Promise.resolve()};return o.promise=(async()=>{let e,s=!1;try{await n()}catch(t){s=!0,e=t}if(o.purging=!0,void 0!==a&&void 0!==i)if(t.signedIn())i.markPending();else{const e=i.begin();let n=await st(a);if(e()){const o=!1===n.ok&&n.retryNow;o&&!t.signedIn()&&(n=await st(a)),e()&&i.settle(n,o)}}if(s)throw e})().finally(()=>{s===o&&(s=void 0)}),s=o,o.promise}}});return at.set(t,r),void 0!==i&&(ot.set(t,i),ot.set(r,i)),r}}function ct(e){return"object"==typeof e&&null!==e&&"code"in e&&"string"==typeof e.code?e.code:"unknown"}x({"local-copy.summary":"Keep a copy of your data on this device","local-copy.glance.on":"On","local-copy.glance.off":"Off","local-copy.glance.pending":"Pending","local-copy.lede":"Keep a copy of your data in this browser, so it opens fast and works offline.","local-copy.switch":"Keep a local copy on this device","local-copy.switch.on":"Changes sync both ways","local-copy.switch.off":"Reads and writes go straight to your TinyCloud","local-copy.switch.state.on":"On","local-copy.switch.state.off":"Off","local-copy.state.enabling":"Turning on the local copy","local-copy.state.wiping":"Wiping local data","local-copy.state.pending":"The last wipe is not confirmed yet","local-copy.state.unavailable":"The local copy is not available here","local-copy.unavailable.note":"Your data in TinyCloud is not affected.","local-copy.pending.note":"Some local data may still be on this device. You can wipe it again below.","local-copy.off.title":"The local copy is off.","local-copy.off.empty":"Nothing is kept on this device.","local-copy.off.unknown":"What is kept on this device is unknown.","local-copy.off.body":"{app} reads and writes your TinyCloud directly, so it needs a connection.","local-copy.off.app":"This app","local-copy.synced":"Synced {ago}","local-copy.synced.unknown":"Last synced: unknown","local-copy.ago.now":"just now","local-copy.ago.minutes":"{count} min ago","local-copy.ago.hours":"{count} h ago","local-copy.ago.days":"{count} d ago","local-copy.unknown":"unknown","local-copy.row.waiting":"Waiting to sync","local-copy.row.waiting.none":"Nothing","local-copy.row.waiting.one":"1 change","local-copy.row.waiting.many":"{count} changes","local-copy.row.size":"Size on this device","local-copy.folders.title":"Folders covered","local-copy.folder.items":"{count} items","local-copy.folder.items.unknown":"items unknown","local-copy.folder.size.unknown":"size unknown","local-copy.folder.waiting":"{count} waiting","local-copy.folder.waiting.unknown":"waiting unknown","local-copy.folder.unknown":"details unknown","local-copy.folder.syncing":"Syncing","local-copy.folder.paused":"Paused","local-copy.bytes.b":"{value} B","local-copy.bytes.kib":"{value} KiB","local-copy.bytes.mib":"{value} MiB","local-copy.bytes.gib":"{value} GiB","local-copy.wipe.title":"Wipe local data","local-copy.wipe.body":"Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","local-copy.wipe.button":"Wipe local data","local-copy.wipe.question":"Wipe local data? Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","local-copy.wipe.question.off":"Turn off local copy and wipe local data? Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.","local-copy.wipe.unsynced.one":"1 change hasn't synced yet. Wiping now loses it.","local-copy.wipe.unsynced.many":"{count} changes haven't synced yet. Wiping now loses them.","local-copy.wipe.unsynced.unknown":"It isn't known whether all changes have synced. Wiping now may lose changes that haven't.","local-copy.wipe.refill":"The copy downloads again the next time it syncs.","local-copy.wipe.keep":"Keep local data","local-copy.wipe.confirm":"Wipe local data","local-copy.wipe.busy":"Wiping…","local-copy.wipe.done":"Local data wiped. Your TinyCloud still has everything.","local-copy.wipe.failed":"The wipe didn't finish. The copy may still be on this device.","local-copy.wipe.retry":"Try again","local-copy.purge.pending":"The local copy on this browser was not removed yet.","local-copy.purge.readable":"The local copy on this browser was not removed yet. It may still be readable here.","local-copy.purge.toast.pending":"The local copy on this browser was not removed yet. Try again from Local copy.","local-copy.purge.toast.readable":"The local copy on this browser was not removed yet. It may still be readable here. Try again from Local copy.","local-copy.purge.done":"The local copy was removed from this browser."});const lt={off:!0,on:!0,pending:!0,enabling:!1,wiping:!1,unavailable:!1},dt={enabling:"local-copy.state.enabling",wiping:"local-copy.state.wiping",pending:"local-copy.state.pending",unavailable:"local-copy.state.unavailable"};function pt(e,t){const n=[["local-copy.bytes.b",1],["local-copy.bytes.kib",1024],["local-copy.bytes.mib",1048576],["local-copy.bytes.gib",1024**3]];let o=n[0];for(const e of n)t>=e[1]&&(o=e);const a=t/o[1],i=1===o[1]||Number.isInteger(a)?String(Math.round(a)):a.toFixed(1);return e.text(o[0],{value:i})}function ut(e,t,n){const o=Math.max(0,Math.floor((n-t.getTime())/6e4));return o<1?e.text("local-copy.ago.now"):o<60?e.text("local-copy.ago.minutes",{count:o}):o<1440?e.text("local-copy.ago.hours",{count:Math.floor(o/60)}):e.text("local-copy.ago.days",{count:Math.floor(o/1440)})}function gt(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0}function ft(e,t,n=!1,o=!1){const a=document.createElement("div"),i=document.createElement("dt");if(o){const t=document.createElement("span");t.className="lc-prefix",t.textContent=e,i.append(t)}else i.textContent=e;const s=document.createElement("dd");return n&&(s.className="lc-plain"),s.append(t),a.append(i,s),a}function mt(e,t){switch(tt(t.effective)){case"on":return{text:e.text("local-copy.glance.on"),tone:"ok"};case"off":return{text:e.text("local-copy.glance.off"),tone:"off"};case"pending":return{text:e.text("local-copy.glance.pending"),tone:"warn"};case"unavailable":return{text:e.text("section.status.unavailable"),tone:"info"};default:return{text:e.text("section.status.checking"),tone:"info"}}}let ht=0;const yt={id:"local-copy",labelCode:"nav.local-copy",icon:"sync",summaryCode:"local-copy.summary",isAvailable:e=>void 0!==e.client()?.sync,status:function(e){const t=e.client()?.sync?.state;return void 0!==t?mt(e,t):re(e,e.data.latest("localCopy"),t=>mt(e,t))},mount:function(e,t){const n=t.client()?.sync;if(!n)return()=>{};const o=n;let a,s,r,c=!1,l=0,d=!1,u=!1,g=!1,f=!1,m=!1,h=!1;const y=void 0===(x=t.client())?void 0:ot.get(x);var x;let b=0;const v=document.createElement("style");v.textContent='\n.lc-lede{max-width:56ch;margin:-20px 0 20px;font-size:15px;line-height:1.5}\n.lc-sw{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:4px 0}\n.lc-sw strong{display:block;font:500 16px/1.3 "Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;letter-spacing:-.005em}\n.lc-sub{display:block;margin-top:2px;font-size:13.5px;color:#71717a}\n.lc-swctl{display:flex;flex:none;align-items:center;gap:10px}\n.lc-swlbl{min-width:22px;font-size:13px;font-weight:700;text-align:right}\n.lc-card{display:flex;flex-direction:column;gap:10px;margin-top:16px;padding:16px 18px;border-radius:16px;background:#fafafa;box-shadow:inset 0 0 0 1px #e4e4e7}\n.lc-card p{margin:0}\n.lc-small{font-size:14px;line-height:1.45}\n.lc-state{margin:6px 0 0}\n.lc-kv{display:flex;flex-direction:column;margin:0;padding:0}\n.lc-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.lc-kv>div:last-child{border-bottom:0}\n.lc-kv.lc-cozy>div{min-height:36px;padding:5px 0;border-bottom:0}\n.lc-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;white-space:nowrap}\n.lc-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.lc-kv dd{display:flex;flex:0 1 auto;align-items:center;justify-content:flex-end;max-width:78%;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.lc-kv dd.lc-plain{font-weight:400}\n.lc-kv .lc-prefix{font:600 .875rem ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}\n.lc-sec{margin-top:24px}\n.lc-h3{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-size:13px;font-weight:600;line-height:1.3;letter-spacing:.02em}\n.lc-h3::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.lc-cnt{font-weight:500;color:#71717a}\n.lc-wipe p{max-width:56ch;margin:0 0 12px;font-size:14px;line-height:1.45}\n.lc-fail{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-top:12px}\n.lc-fail p{margin:0;font-size:14px}\n.lc-sec .confirm,.lc-sw+.confirm{margin-top:12px}\n.lc-confirm.confirm .busy{margin:0;font-size:14.5px;line-height:1.5;color:inherit}\n.lc-confirm.confirm .actions{margin:16px 0 0}\n.lc-confirm .action:last-child{background:#09090b;border-color:#09090b;color:#fff}\n.lc-confirm .action:last-child:hover{background:#27272a}\n.lc-confirm .action:disabled{opacity:.6;cursor:default}\n@media (max-width:600px){\n.lc-confirm.confirm .actions{flex-direction:column}\n.lc-confirm .action{width:100%;white-space:normal}\n}\n.panel[data-layout="page"] .lc-card{background:#fff}\n@media (prefers-color-scheme: dark){\n.lc-sub,.lc-cnt{color:#a1a1aa}\n.lc-card{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.lc-kv>div{border-bottom-color:#69696b}\n.lc-kv dt::after{border-bottom-color:#71717a}\n.lc-h3::after{background:#69696b}\n.lc-confirm .action:last-child{background:#fafafa;border-color:#fafafa;color:#09090b}\n.lc-confirm .action:last-child:hover{background:#e4e4e7}\n.panel[data-layout="page"] .lc-card{background:#151517}\n}\n'+i;const w=document.createElement("h3");w.className="sec-title",w.tabIndex=-1,w.textContent=t.text("nav.local-copy");const k=pe("lc-lede",t.text("local-copy.lede")),C=document.createElement("div");C.className="lc-fail lc-purge";const E=pe("","");E.setAttribute("role","alert");const N=document.createElement("button");N.type="button",N.className="action",N.textContent=t.text("local-copy.wipe.retry"),C.append(E,N);const _=document.createElement("div");_.className="row lc-sw";const A=document.createElement("div"),S=document.createElement("strong");S.id="lc-switch-label",S.className="label",S.textContent=t.text("local-copy.switch");const T=document.createElement("span");T.className="lc-sub",A.append(S,T);const L=document.createElement("div");L.className="lc-swctl";const M=document.createElement("span");M.className="lc-swlbl",M.setAttribute("aria-hidden","true");const z=document.createElement("button");z.type="button",z.className="switch",z.setAttribute("role","switch"),z.setAttribute("aria-labelledby",S.id);const $=document.createElement("span");$.className="knob",z.append($),L.append(M,z),_.append(A,L);const O=pe("note lc-state","");O.setAttribute("role","status");const D=pe("note",""),q=ue(t,()=>{ie()}),B=pe("error","");B.setAttribute("role","alert");const I=document.createElement("div");I.className="lc-card";const j=document.createElement("div"),R=document.createElement("dl");R.className="lc-kv lc-cozy";const P=pe("lc-small","");I.append(j,R,P);const F=document.createElement("section");F.className="lc-sec";const Y=document.createElement("h3");Y.className="lc-h3",Y.id="lc-folders",F.setAttribute("aria-labelledby",Y.id);const W=document.createElement("span");W.className="lc-cnt";const U=document.createTextNode(t.text("local-copy.folders.title"));Y.append(U,W);const H=document.createElement("dl");H.className="lc-kv",F.append(Y,H);const V=document.createElement("section");V.className="lc-sec lc-wipe";const G=document.createElement("h3");G.className="lc-h3",G.id="lc-wipe",G.textContent=t.text("local-copy.wipe.title"),V.setAttribute("aria-labelledby",G.id);const K=pe("",t.text("local-copy.wipe.body"));K.id="lc-wipe-text-"+ ++ht;const X=document.createElement("button");X.type="button",X.className="action",X.textContent=t.text("local-copy.wipe.button"),X.setAttribute("aria-describedby",K.id);const Z=document.createElement("div");Z.className="lc-fail";const J=pe("",t.text("local-copy.wipe.failed"));J.setAttribute("role","alert");const Q=document.createElement("button");function ee(){return tt(o.state.effective)}function te(){const e=ee();return"unavailable"!==e&&"enabling"!==e&&("off"!==e||0!==s?.bytesOnDevice)}function ne(){return!c&&!u&&!d&&lt[ee()]&&te()}function oe(){const e=a;a=void 0,e?.close()}function ae(){if(c)return;const e=o.state,n=ee(),i=n===e.effective,l=e.requested,f="enabling"===n||"wiping"===n||"pending"===n||"unavailable"===n;z.setAttribute("aria-checked",String(l));const x=f||d||u,b=z.getRootNode();x&&!z.disabled&&b.activeElement===z&&(h=!0),z.disabled=x,!x&&h&&(h=!1,null!==b.activeElement&&b.activeElement!==document.body||z.focus()),M.textContent=t.text(l?"local-copy.switch.state.on":"local-copy.switch.state.off"),T.textContent=t.text(l?"local-copy.switch.on":"local-copy.switch.off");const v="pending"===n&&"sync_pending"===t.topStatus()&&!u,w=u?"local-copy.state.wiping":dt[n];O.hidden=void 0===w||v,O.textContent=void 0===w?"":t.text(w);const k=i?e.reason??("pending"===n?"erase-pending":"unknown"):"unknown";"unavailable"===n?(D.hidden=!1,D.textContent=`${t.text(`sync.reason.${k}`)} ${t.text("local-copy.unavailable.note")}`):"pending"===n?(D.hidden=!1,D.textContent=`${t.text(`sync.reason.${k}`)} ${t.text("local-copy.pending.note")}`):(D.hidden=!0,D.textContent=""),B.hidden=void 0===r,B.textContent=void 0===r?"":t.text(`sync.error.${r}`);const _=y?.failure();C.hidden=void 0===_,E.textContent=void 0===_?"":t.text(`local-copy.purge.${_}`),N.disabled=m;const A="on"===n||"pending"===n||"enabling"===n||"wiping"===n,S=void 0!==s&&(A||"off"===n);if(I.hidden=!S,F.hidden=!(void 0!==s&&A&&s.folders.length>0),void 0!==s&&S)if(R.hidden=!A,j.hidden=!A,P.hidden=A,A){const e="enabling"===n?{text:t.text("local-copy.state.enabling"),tone:"info"}:(L=s.lastSyncedAt)instanceof Date&&Number.isFinite(L.getTime())?{text:t.text("local-copy.synced",{ago:ut(t,s.lastSyncedAt,Date.now())}),tone:"ok"}:{text:t.text("local-copy.synced.unknown"),tone:"info"};j.replaceChildren(p(e));const o=gt(s.pending)?0===s.pending?t.text("local-copy.row.waiting.none"):1===s.pending?t.text("local-copy.row.waiting.one"):t.text("local-copy.row.waiting.many",{count:s.pending}):t.text("local-copy.unknown"),a=gt(s.bytesOnDevice)?pt(t,s.bytesOnDevice):t.text("local-copy.unknown"),i=[ft(t.text("local-copy.row.waiting"),o),ft(t.text("local-copy.row.size"),a)];R.replaceChildren(...i),W.textContent=String(s.folders.length),H.replaceChildren(...s.folders.map(e=>ft(e.prefix,function(e,t){const n=[];return"syncing"!==t.state&&"paused"!==t.state||n.push(e.text(`local-copy.folder.${t.state}`)),gt(t.items)||gt(t.bytes)||gt(t.waiting)?(n.push(gt(t.items)?e.text("local-copy.folder.items",{count:t.items}):e.text("local-copy.folder.items.unknown")),n.push(gt(t.bytes)?pt(e,t.bytes):e.text("local-copy.folder.size.unknown")),gt(t.waiting)?t.waiting>0&&n.push(e.text("local-copy.folder.waiting",{count:t.waiting})):n.push(e.text("local-copy.folder.waiting.unknown"))):n.push(e.text("local-copy.folder.unknown")),n.join(" · ")}(t,e),!0,!0)))}else{const e=document.createElement("strong");e.textContent=t.text("local-copy.off.title");const n=0===s.bytesOnDevice?` ${t.text("local-copy.off.empty")}`:gt(s.bytesOnDevice)?"":` ${t.text("local-copy.off.unknown")}`;P.replaceChildren(e,`${n} ${t.text("local-copy.off.body",{app:t.appLabel()??t.text("local-copy.off.app")})}`)}var L;const $=te();V.hidden=!$,X.disabled=d||u||"wiping"===n||"enabling"===n,Z.hidden=!g,Q.disabled=X.disabled,void 0===a||u||ne()||oe()}async function ie(){const e=t.data.source;if(!e)return s=void 0,q.status.hidden=!0,q.retry.hidden=!0,void ae();const n=++l,o=b,a=await me(()=>e.localCopy());if(c||n!==l||o!==b)return;const i=ge(q,t,a);void 0!==i&&(s=i),ae()}async function se(e){const t=b;d=!0,r=void 0,ae();try{await o.setEnabled(e)}catch(e){c||t!==b||(r=ct(e))}finally{t===b&&(d=!1,ae())}}function re(e,n,i){if(void 0!==a||!ne())return;f=e;const l=s?.pending,d=[t.text(e?"local-copy.wipe.question.off":"local-copy.wipe.question")];gt(l)?l>0&&d.push(t.text(1===l?"local-copy.wipe.unsynced.one":"local-copy.wipe.unsynced.many",{count:l})):d.push(t.text("local-copy.wipe.unsynced.unknown")),e||d.push(t.text("local-copy.wipe.refill"));const p=t.confirm({question:d.join(" "),cancelLabel:t.text("local-copy.wipe.keep"),confirmLabel:t.text("local-copy.wipe.confirm"),anchor:n,onCancel:()=>{a===p&&(a=void 0),c||i.focus()},onConfirm:()=>{!async function(e,n){if(u||a!==e||!ne())return;u=!0;const i=b;g=!1,r=void 0,e.confirm.disabled=!0,e.cancel.disabled=!0,e.confirm.textContent=t.text("local-copy.wipe.busy"),ae();let s=!0;try{await o.wipeLocalData()}catch{s=!1}if(i===b){if(s&&n&&o.state.requested){try{await o.setEnabled(!1)}catch(e){c||i!==b||(r=ct(e))}if(i!==b)return}u=!1,s&&t.toast({kind:"success",textCode:"local-copy.wipe.done"}),c||(oe(),g=!s,ae(),s?(z.focus(),ie()):V.hidden||Z.hidden||Q.disabled?w.focus():Q.focus())}}(p,e)}});a=p,p.confirm.closest(".confirm")?.classList.add("lc-confirm")}Q.type="button",Q.className="action",Q.textContent=t.text("local-copy.wipe.retry"),Z.append(J,Q),V.append(G,K,X,Z),e.append(v,w,k,C,_,O,D,q.status,q.retry,B,I,F,V),z.addEventListener("click",()=>{z.disabled||d||u||(o.state.requested?te()?re(!0,_,z):se(!1):se(!0))}),X.addEventListener("click",()=>{X.disabled||(g=!1,ae(),re(!1,X,X))}),Q.addEventListener("click",()=>{Q.disabled||(g=!1,ae(),re(f,f?_:X,f?z:X))}),N.addEventListener("click",()=>{if(void 0===y||N.disabled||m)return;const e=b;m=!0,ae(),y.retry().then(n=>{e===b&&(m=!1,n&&t.toast({kind:"success",textCode:"local-copy.purge.done"}),c||(ae(),n?w.focus():N.focus()))})});const ce=o.subscribe(()=>{ae(),t.requestRender(),ie()});let le;const de=()=>{le?.(),le=t.data.source?.subscribe(e=>{"copy"===e&&ie()})};de();const he=t.client()?.onReset(()=>{b+=1,d=!1,u=!1,m=!1,r=void 0,g=!1,s=void 0,oe(),fe(q,t),ae(),de(),ie()}),ye=t.onStatusChange(ae),xe=y?.subscribe(ae),be=setInterval(()=>{ae(),ie()},6e4),ve=t.data.latest("localCopy");return"ready"===ve?.state?s=ve.data:fe(q,t),ae(),ie(),()=>{c=!0,clearInterval(be),ce(),le?.(),he?.(),ye(),xe?.(),e.replaceChildren()}}},xt="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",bt=`\n.ll-intro{margin:-20px 0 20px;font-size:15px;line-height:1.5;max-width:56ch;color:#52525b}\n.ll-sub{margin:2px 0 0;font-size:12.5px;color:#52525b}\n.ll-ctl{display:flex;align-items:center;gap:10px;flex:none}\n.ll-word{min-width:22px;text-align:right;font-size:13px;font-weight:700}\n.ll-label{margin:0;font-family:"Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;font-size:16px;font-weight:500;letter-spacing:-.005em}\n.ll-eyebrow{margin:0;font-size:13px;font-weight:600;line-height:1.3;color:#71717a}\n.ll-card{display:flex;flex-direction:column;gap:14px;margin-top:14px;padding:16px 18px;border-radius:16px;background:#fafafa;box-shadow:inset 0 0 0 1px #e4e4e7}\n.layer .panel[data-layout="page"] .ll-card{background:#fff}\n.ll-card-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}\n.ll-strong{margin:0;font-size:14px;font-weight:600}\n.ll-body{margin:0;font-size:14px;line-height:1.45;color:#52525b}\n.ll-looking{display:flex;align-items:center;gap:14px}\n.ll-spin{flex:none;width:26px;height:26px;border:3px solid #f4f4f5;border-top-color:#09090b;border-radius:50%;animation:ll-spin .9s linear infinite}\n@keyframes ll-spin{to{transform:rotate(360deg)}}\n@media (prefers-reduced-motion: reduce){.ll-spin{animation:none}}\n.ll-cancel{align-self:flex-start;width:auto}\n.ll-kv{display:flex;flex-direction:column;margin:0;padding:0}\n.ll-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.ll-kv>div:last-child{border-bottom:0}\n.ll-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;font-size:14px;color:#52525b;white-space:nowrap}\n.ll-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.ll-kv dd{display:flex;flex:0 1 auto;align-items:center;justify-content:flex-end;gap:2px;max-width:100%;min-width:0;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.ll-mono,.ll-did{min-width:0;font-family:${xt};font-size:12.5px;overflow-wrap:anywhere}\n.ll-host{overflow-wrap:anywhere}\n.ll-cell{display:flex;align-items:center;gap:8px;min-width:0}\n.ll-codeline{display:flex;align-items:center;justify-content:space-between;gap:4px;box-sizing:border-box;margin-top:8px;padding:2px 4px 2px 14px;border-radius:12px;background:#f4f4f5;min-height:44px;font-family:${xt};font-size:13px}\n.ll-codeline code{min-width:0;overflow-wrap:anywhere}\n.ll-steps{display:flex;flex-direction:column;gap:12px;margin:0;padding:0;list-style:none;counter-reset:ll-step;font-size:14px;line-height:1.45;color:#09090b}\n.ll-steps li{position:relative;padding-left:34px;counter-increment:ll-step}\n.ll-steps li::before{content:counter(ll-step);position:absolute;left:0;top:-1px;width:24px;height:24px;border-radius:50%;box-shadow:inset 0 0 0 1px #71717a;font:600 12px/24px ${xt};text-align:center}\n.ll-unknown{color:#52525b}\n@media (prefers-color-scheme: dark){\n.ll-intro,.ll-sub,.ll-body,.ll-kv dt,.ll-unknown{color:#a1a1aa}\n.ll-card{background:#151517;box-shadow:inset 0 0 0 1px #69696b}\n.layer .panel[data-layout="page"] .ll-card{background:#151517}\n.ll-eyebrow{color:#a1a1aa}\n.ll-spin{border-color:#27272a;border-top-color:#fafafa}\n.ll-kv>div{border-bottom-color:#69696b}\n.ll-kv dt::after{border-bottom-color:#71717a}\n.ll-codeline{background:#27272a}\n.ll-steps{color:#fafafa}\n}\n`,vt={found:{code:"local-tinycloud.glance.found",tone:"ok"},looking:{code:"local-tinycloud.glance.looking",tone:"info"},"not-found":{code:"local-tinycloud.glance.not_found",tone:"off"},off:{code:"local-tinycloud.glance.off",tone:"off"},unavailable:{code:"section.status.unavailable",tone:"off"}},wt={off:"local-tinycloud.sub.off",looking:"local-tinycloud.sub.looking",found:"local-tinycloud.sub.found","not-found":"local-tinycloud.sub.not_found",unavailable:"local-tinycloud.sub.unavailable"};x({"local-tinycloud.summary":"Use a TinyCloud node on this computer","local-tinycloud.intro":"Use a TinyCloud that runs on this computer, next to your browser, instead of only your hosted one.","local-tinycloud.switch":"Use TinyCloud on this computer","local-tinycloud.switch.on":"On","local-tinycloud.switch.off":"Off","local-tinycloud.sub.off":"Off for this app","local-tinycloud.sub.looking":"Checking this computer…","local-tinycloud.sub.found":"Connected to a TinyCloud on this computer","local-tinycloud.sub.not_found":"Switched on, but nothing answered","local-tinycloud.sub.unavailable":"Not available in this app yet","local-tinycloud.app_fallback":"This app","local-tinycloud.glance.found":"Found","local-tinycloud.glance.looking":"Looking","local-tinycloud.glance.not_found":"Not found","local-tinycloud.glance.off":"Off","local-tinycloud.off.body":"{app} talks to your hosted TinyCloud only. Turn this on and it looks for a TinyCloud running on this computer.","local-tinycloud.looking.title":"Looking for TinyCloud on this computer…","local-tinycloud.looking.permission":"Your browser may ask to let {app} reach devices on your network. Allow it so the check can finish.","local-tinycloud.looking.cancel":"Cancel","local-tinycloud.found.recheck":"Check again","local-tinycloud.found.node_id":"Node ID","local-tinycloud.found.version":"Version","local-tinycloud.found.host":"Host","local-tinycloud.unknown":"Unknown","local-tinycloud.copy.node_id_label":"Copy node ID","local-tinycloud.copy.host_label":"Copy host","local-tinycloud.copy.command_label":"Copy command","local-tinycloud.copied":"Copied","local-tinycloud.copy_failed":"Couldn't copy. Select the text and copy it by hand.","local-tinycloud.not_found.title":"We couldn't find TinyCloud on this computer.","local-tinycloud.not_found.unchanged":"Nothing has changed: {app} still uses your hosted TinyCloud.","local-tinycloud.not_found.steps_title":"To start it","local-tinycloud.not_found.step_open":"Open TinyCloud on this computer, or start it from a terminal.","local-tinycloud.not_found.step_command":"tinycloud start","local-tinycloud.not_found.step_listen":"Check that it's listening on 127.0.0.1:8787.","local-tinycloud.not_found.step_retry":"Come back here and choose Try again.","local-tinycloud.not_found.retry":"Try again","local-tinycloud.unavailable.line":"Local TinyCloud can't be checked from this app.","local-tinycloud.unavailable.explain":"This app can't turn TinyCloud on this computer on or off yet, so the switch is off.","local-tinycloud.error":"Couldn't change TinyCloud on this computer. Try again."});const kt={id:"local-tinycloud",labelCode:"nav.local-tinycloud",icon:"monitor",summaryCode:"local-tinycloud.summary",isAvailable:R,status:e=>re(e,e.data.latest("localNode"),t=>{const n=vt[t.connection];return{text:e.text(n.code),tone:n.tone}}),mount(e,t){const n=t.client()?.data;if(!n)return P(e);let o,a,r,c=n,l=0,u=!1,g=!1,f=0;const m=()=>t.appLabel()??t.text("local-tinycloud.app_fallback"),h=ue(t,()=>{q()}),y=document.createElement("div");y.hidden=!0;const x=pe("ll-intro",t.text("local-tinycloud.intro")),b=document.createElement("h3");b.className="sec-title",b.tabIndex=-1,b.textContent=t.text("nav.local-tinycloud");const v=document.createElement("div");v.className="row";const w=document.createElement("div"),k=pe("label ll-label",t.text("local-tinycloud.switch")),C=pe("ll-sub","");w.append(k,C);const E=document.createElement("div");E.className="ll-ctl";const N=document.createElement("span");N.className="ll-word";const _=document.createElement("button");_.type="button",_.className="switch",_.setAttribute("role","switch"),_.setAttribute("aria-label",t.text("local-tinycloud.switch"));const A=document.createElement("span");A.className="knob",_.append(A),E.append(N,_),v.append(w,E);const S=document.createElement("div");S.className="ll-card";const T=pe("error",t.text("local-tinycloud.error"));T.setAttribute("role","alert"),T.hidden=!0;const L=s(t.text("view.retry"));function M(e,n){const o=document.createElement("button");return o.className="icon-btn",o.setAttribute("aria-label",t.text(n)),o.append(d("copy")),o.addEventListener("click",()=>{!async function(e){const n=l;try{await navigator.clipboard.writeText(e),u||n!==l||t.toast({kind:"success",textCode:"local-tinycloud.copied"})}catch{u||n!==l||t.toast({kind:"error",textCode:"local-tinycloud.copy_failed"})}}(e)}),o}function z(){const e=document.createElement("span");return e.className="ll-unknown",e.textContent=t.text("local-tinycloud.unknown"),e}function $(e){const n=vt[e];return p({text:t.text(n.code),tone:n.tone})}function O(e,t){const n=document.createElement("div");return n.className="ll-card-head",n.append(e,...t?[t]:[]),n}function D(){if(u)return;if(y.hidden=void 0===a,void 0===a)return;const e=a.connection,n="off"!==e&&"unavailable"!==e;_.setAttribute("aria-checked",String(n)),_.disabled="unavailable"===e,_.setAttribute("aria-disabled",String(g)),N.textContent=t.text(n?"local-tinycloud.switch.on":"local-tinycloud.switch.off"),C.textContent=t.text(wt[e]),S.replaceChildren(...function(e){switch(e.connection){case"off":return[O($("off")),pe("ll-body",t.text("local-tinycloud.off.body",{app:m()}))];case"looking":{const e=document.createElement("span");e.className="ll-spin",e.setAttribute("aria-hidden","true");const n=document.createElement("div");n.append(pe("ll-strong",t.text("local-tinycloud.looking.title")),pe("ll-body",t.text("local-tinycloud.looking.permission",{app:m()})));const o=document.createElement("div");o.className="ll-looking",o.append(e,n);const a=s(t.text("local-tinycloud.looking.cancel"));return a.classList.add("ll-cancel"),a.addEventListener("click",()=>{g||B(!1)}),[o,a]}case"found":{const n=s(t.text("local-tinycloud.found.recheck"));n.addEventListener("click",()=>{q()});const o=document.createElement("dl");o.className="ll-kv";const a=(e,n)=>{const a=document.createElement("div"),i=document.createElement("dt");i.textContent=t.text(e);const s=document.createElement("dd");s.append(n),a.append(i,s),o.append(a)},i=e.identity?.nodeDid,r=document.createElement("span");if(r.className="ll-cell",i){const e=document.createElement("span");e.className="ll-did",e.textContent=i.length>18?`${i.slice(0,12)}…${i.slice(-6)}`:i,e.title=i,r.append(e,M(i,"local-tinycloud.copy.node_id_label"))}else r.append(z());a("local-tinycloud.found.node_id",r);const c=document.createElement("span");e.version?c.textContent=e.version:c.append(z()),a("local-tinycloud.found.version",c);const l=document.createElement("span");if(l.className="ll-cell",e.url){const t=document.createElement("span");t.className="ll-mono ll-host",t.textContent=e.url,t.title=e.url,l.append(t,M(e.url,"local-tinycloud.copy.host_label"))}else l.append(z());return a("local-tinycloud.found.host",l),[O($("found"),n),o]}case"not-found":{const e=s(t.text("local-tinycloud.not_found.retry"));e.addEventListener("click",()=>{q()});const n=t.text("local-tinycloud.not_found.step_command"),o=document.createElement("code");o.textContent=n;const a=document.createElement("div");a.className="ll-codeline",a.append(o,M(n,"local-tinycloud.copy.command_label"));const i=document.createElement("ol");i.className="ll-steps";const r=document.createElement("li");r.append(t.text("local-tinycloud.not_found.step_open"),a);const c=document.createElement("li");c.textContent=t.text("local-tinycloud.not_found.step_listen");const l=document.createElement("li");l.textContent=t.text("local-tinycloud.not_found.step_retry"),i.append(r,c,l);const d=document.createElement("p");d.className="ll-body";const p=document.createElement("strong");return p.textContent=t.text("local-tinycloud.not_found.title"),d.append(p,` ${t.text("local-tinycloud.not_found.unchanged",{app:m()})}`),[O($("not-found"),e),d,pe("ll-eyebrow",t.text("local-tinycloud.not_found.steps_title")),i]}case"unavailable":return[O($("unavailable")),pe("ll-strong",t.text("local-tinycloud.unavailable.line")),pe("ll-body",t.text("local-tinycloud.unavailable.explain"))]}}(a))}async function q(){const e=++f,n=c,o=l;if(void 0===n)return;const i=await me(()=>n.localNode());u||e!==f||o!==l||(a=ge(h,t,i),D())}async function B(e){const t=c;if(void 0===t)return;const n=l;let o;g=!0,r=e,T.hidden=!0,L.hidden=!0,D();try{o=await t.setLocalNodeEnabled(e)}catch{o={ok:!1,code:"unknown"}}u||n!==l||(g=!1,T.hidden=o.ok,L.hidden=o.ok,o.ok&&(r=void 0),await q())}function I(){o?.(),o=c?.subscribe(e=>{"local"===e&&q()})}L.hidden=!0,L.addEventListener("click",()=>{void 0!==r&&B(r)}),y.append(v,S,T,L),_.addEventListener("click",()=>{g||void 0===a||"unavailable"===a.connection||B("off"===a.connection)});const j=t.onClientChange(()=>{if(l+=1,g=!1,r=void 0,T.hidden=!0,L.hidden=!0,a=void 0,c=t.client()?.data,I(),D(),void 0===c)return h.status.hidden=!0,void(h.retry.hidden=!0);fe(h,t),q()});I();const R=document.createElement("style");return R.textContent=bt+i,e.append(R,b,x,h.status,h.retry,y),fe(h,t),q(),()=>{u=!0,j(),o?.(),e.replaceChildren()}}};x({"nodes.summary":"Nodes your data syncs with","nodes.title":"Connected nodes","nodes.lede":"The nodes this session is talking to right now. TinyCloud picks the node for each space; there is nothing to switch here.","nodes.empty":"No node is in use right now.","nodes.unavailable":"Not available right now.","nodes.glance.none":"None","nodes.glance.healthy":"Healthy","nodes.glance.slow":"{count} slow","nodes.glance.down":"{count} down","nodes.card.ok":"Connected","nodes.card.slow":"Slow to respond","nodes.role.local":"On this computer","nodes.role.ownHosted":"Your hosted TinyCloud","nodes.nodeid":"Node ID","nodes.copy":"Copy the node ID of {host}","nodes.spaces":"Spaces here","nodes.latency.value":"{ms} ms · seen {seen}","nodes.latency.only":"{ms} ms","nodes.seen.seconds":"{count} s ago","nodes.seen.minutes":"{count} min ago"});const Ct={ok:"nodes.card.ok",slow:"nodes.card.slow",down:"nodes.status.down"},Et={ok:"ok",slow:"warn",down:"warn"},Nt={id:"nodes",labelCode:"nav.nodes",icon:"nodes",summaryCode:"nodes.summary",isAvailable:R,status:e=>re(e,e.data.latest("nodes"),t=>{const n=String(t.length);if(0===t.length)return{text:e.text("nodes.glance.none"),tone:"off",count:n};const o=t.filter(e=>"down"===e.status).length;if(o>0)return{text:e.text("nodes.glance.down",{count:o}),tone:"warn",count:n};const a=t.filter(e=>"slow"===e.status).length;return a>0?{text:e.text("nodes.glance.slow",{count:a}),tone:"warn",count:n}:{text:e.text("nodes.glance.healthy"),tone:"ok",count:n}}),mount(e,t){let n=t.client()?.data,o=!1,a=0;const s=document.createElement("style");s.textContent='\n.nd-wrap{container-type:inline-size;min-width:0}\n.nd-wrap>.nd-lede{margin:0 0 20px;font-size:15px;line-height:1.5;max-width:56ch;color:#09090b}\n.nd-cards{display:grid;gap:14px;grid-template-columns:minmax(0,1fr);margin:0;padding:0;list-style:none}\n@container (min-width:720px){.nd-cards{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}\n.nd-card{min-width:0;padding:14px 16px;border:1px solid #e4e4e7;border-radius:12px;--nd-leader:#a1a1aa}\n.nd-card .row{align-items:baseline}\n.nd-card .row>div{min-width:0;flex:1}\n.nd-host{font:600 15px/1.3 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}\n.nd-kv{display:flex;flex-direction:column;margin:8px 0 0;padding:0}\n.nd-kv>div{display:flex;align-items:center;gap:10px;min-height:40px;padding:0;border-top:1px solid #f4f4f5}\n.nd-kv dt{display:flex;align-items:baseline;gap:10px;flex:1 1 auto;min-width:0;margin:0;font-size:14px;color:#52525b;white-space:nowrap}\n.nd-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted var(--nd-leader);transform:translateY(-3px)}\n.nd-kv dd{display:flex;align-items:center;justify-content:flex-end;gap:2px;flex:0 1 auto;max-width:78%;min-width:0;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.nd-kv dd.nd-mono{font-size:12px;font-weight:500}\n.nd-did-row{display:flex;align-items:center;gap:6px;min-width:0;max-width:100%}\n.nd-did{min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;overflow-wrap:anywhere}\n.nd-did-head,.nd-did-tail{overflow-wrap:anywhere}\n.nd-chips{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;margin:0;padding:0;list-style:none}\n.nd-chip{display:inline-flex;align-items:center;min-height:28px;padding:0 11px;border-radius:999px;background:#f4f4f5;font-size:12.5px;font-weight:600;overflow-wrap:anywhere}\n.nd-card .icon-btn{margin:-10px -10px -10px 0}\n.nd-did-row .icon-btn{margin:-10px 0}\n@media (prefers-color-scheme: dark){\n.nd-wrap>.nd-lede{color:#fafafa}\n.nd-card{border-color:#3f3f46;--nd-leader:#71717a}\n.nd-kv>div{border-top-color:#27272a}\n.nd-kv dt{color:#a1a1aa}\n.nd-chip{background:#27272a}\n}\n'+i;const r=document.createElement("h3");r.className="sec-title",r.tabIndex=-1,r.textContent=t.text("nodes.title");const c=ue(t,()=>{m()}),l=document.createElement("div");l.hidden=!0;const u=pe("note",t.text("nodes.lede"));u.classList.add("nd-lede");const g=pe("note",t.text("nodes.empty"));g.hidden=!0;const f=document.createElement("ul");async function m(){const e=++a,i=n;if(void 0===i)return y(),c.status.hidden=!1,c.status.textContent=t.text("nodes.unavailable"),void(c.retry.hidden=!0);const s=await me(()=>i.nodes());if(o||e!==a)return;const r=ge(c,t,s);l.hidden=void 0===r,void 0!==r&&(g.hidden=r.length>0,f.replaceChildren(...r.map(e=>function(e){const n=function(e){try{return new URL(e).host}catch{return e}}(e.origin),o=document.createElement("li");o.className="nd-card",o.setAttribute("aria-label",n);const a=document.createElement("div");a.className="row";const i=document.createElement("div"),s=pe("label",n);s.classList.add("nd-host"),i.append(s,pe("note",function(e,t){return"local"===e.kind?t.text("nodes.role.local"):e.active?t.text("nodes.role.ownHosted"):t.text("nodes.kind.hosted")}(e,t)));const r={text:t.text(Ct[e.status]),tone:Et[e.status]};a.append(i,p(r)),o.append(a);const c=[],l=(e,t,n=!1)=>{const o=document.createElement("div"),a=document.createElement("dt");a.textContent=e;const i=document.createElement("dd");n&&(i.className="nd-mono"),i.append(t),o.append(a,i),c.push(o)},u=e=>{const t=document.createElement("span");return t.textContent=e,t};if(void 0!==e.nodeDid){const o=document.createElement("span");o.className="nd-did";const a=Math.max(0,e.nodeDid.length-4),i=document.createElement("span");i.className="nd-did-head",i.textContent=e.nodeDid.slice(0,a);const s=document.createElement("span");s.className="nd-did-tail",s.textContent=e.nodeDid.slice(a),o.append(i,s);const r=document.createElement("button");r.type="button",r.className="icon-btn",r.setAttribute("aria-label",t.text("nodes.copy",{host:n})),r.append(d("copy")),r.addEventListener("click",()=>{navigator.clipboard?.writeText(o.textContent??"").catch(()=>{})});const c=document.createElement("span");c.className="nd-did-row",c.append(o,r),l(t.text("nodes.nodeid"),c,!0)}"string"==typeof e.version&&""!==e.version.trim()&&l(t.text("nodes.version"),u(`v${e.version}`));const g="number"==typeof e.latencyMs&&Number.isFinite(e.latencyMs)?e.latencyMs:void 0;if(void 0!==g){const n=String(g),o=function(e,t,n){if(!(e instanceof Date))return;const o=t-e.getTime();if(!Number.isFinite(o)||o<0)return;const a=Math.floor(o/1e3);return a<60?n.text("nodes.seen.seconds",{count:a}):n.text("nodes.seen.minutes",{count:Math.floor(a/60)})}(e.lastSeenAt,Date.now(),t),a=void 0!==o?t.text("nodes.latency.value",{ms:n,seen:o}):t.text("nodes.latency.only",{ms:n});l(t.text("nodes.latency"),u(a))}const f=Array.isArray(e.spaces)?e.spaces.filter(e=>"string"==typeof e&&""!==e.trim()):[];if(f.length>0){const e=document.createElement("ul");e.className="nd-chips",e.append(...f.map(e=>{const t=document.createElement("li");return t.className="nd-chip",t.textContent=e,t})),l(t.text("nodes.spaces"),e)}if(c.length>0){const e=document.createElement("dl");e.className="nd-kv",e.append(...c),o.append(e)}return o}(e))))}function h(e){return e.subscribe(e=>{"nodes"===e&&m()})}function y(){l.hidden=!0,g.hidden=!0,f.replaceChildren()}function x(){a++,b(),v?.(),y();const o=t.client()?.data;n=o,void 0===o?s.remove():e.prepend(s),b=o?h(o):()=>{},v=t.client()?.onReset(x),void 0!==o&&fe(c,t),m()}f.className="nd-cards",l.className="nd-wrap",l.append(u,g,f);let b=n?h(n):()=>{},v=t.client()?.onReset(x);const w=t.onClientChange(x);return e.append(r,c.status,c.retry,l),void 0!==n&&(e.prepend(s),fe(c,t)),m(),()=>{o=!0,w(),v?.(),b(),e.replaceChildren()}}},_t="https://account.tinycloud.xyz/storage";function At(e){if("object"!=typeof e||null===e||!("manageUrl"in e))return _t;const t=e.manageUrl;if("string"!=typeof t)return _t;try{return"https:"===new URL(t).protocol?t:_t}catch{return _t}}const St={unsupported:!0,STORAGE_STATUS_UNAVAILABLE:!0};function Tt(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function Lt(e){return"object"==typeof e&&null!==e&&"usedBytes"in e&&"limitBytes"in e&&Tt(e.usedBytes)&&(null===e.limitBytes||Tt(e.limitBytes))}x({"storage.summary":"How much space is used","storage.glance.normal":"Normal","storage.glance.nearly_full":"Nearly full","storage.glance.full":"Full","storage.page.lede":"Your storage is shared by every TinyCloud app you use.","storage.page.lede_short":"How much of your TinyCloud you use.","storage.page.used":"Used","storage.page.by_space":"By space","storage.page.meter":"Storage used","storage.page.of_limit":"of {limit}","storage.page.meter_text":"{used} of {limit} used. {state}.","storage.page.meter_text_open":"{used} used. {state}.","storage.page.space_meter":"{space} storage used","storage.page.space_meter_text":"{used} of {limit}","storage.page.plan":"Plan","storage.page.left":"Left","storage.page.none":"None","storage.page.no_limit":"No limit","storage.page.manage_hint":"(opens in a new tab)","storage.page.nearly_note":"You're close to your limit. Saving large recordings may fail soon.","storage.page.full_title":"Storage full: you can't add more data right now.","storage.page.full_body":"Your existing data stays as it is.","storage.page.unavailable_node":"Storage usage isn't available on this node.","storage.page.permission_title":"{app} can't see your storage yet","storage.page.permission_app":"This app","storage.page.permission_body":"To show how much you use and your plan, TinyCloud needs your permission to read storage details. It can't read, change or delete your files.","storage.page.permission_approve":"You'll approve it in OpenKey.","storage.page.permission_blocked":"This session has no way to ask for it here.","storage.page.allow":"Allow storage details","storage.page.waiting":"Waiting for OpenKey…","storage.page.age_now":"Updated just now","storage.page.age_minutes":"Updated {count} min ago","storage.page.age_hours":"Updated {count} h ago"});const Mt="\n.storage-banner{display:flex;gap:12px;align-items:flex-start;box-sizing:border-box;margin:0 0 28px;padding:14px 16px;border-radius:12px;box-shadow:inset 0 0 0 1px #e4e4e7;font-size:14px;line-height:1.45}\n.storage-banner .ui-ic{width:22px;height:22px;margin-top:1px;color:#b35309}\n.storage-banner strong{display:block}\n.storage-banner a.storage-manage{padding-left:0}\n@media (prefers-color-scheme: dark){\n.storage-banner{box-shadow:inset 0 0 0 1px #69696b}\n.storage-banner .ui-ic{color:#f59e0b}\n}\n",zt={ok:"normal",nearly_full:"nearly",full:"full"},$t=["B","KiB","MiB","GiB","TiB"];function Ot(e,t){return Number(e.toFixed(t>=3?2:1))}function Dt(e){let t=0,n=e;for(;t<$t.length-1&&n>=1024;)n/=1024,t+=1;if(0===t)return{amount:String(n),unit:"B"};let o=Ot(n,t);return o>=1024&&t<$t.length-1&&(t+=1,o=Ot(n/1024,t)),{amount:String(o),unit:$t[t]??"B"}}function qt(e){const{amount:t,unit:n}=Dt(e);return`${t} ${n}`}function Bt(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function It(e){const t="perSpace"in e?e.perSpace:void 0;if(!Array.isArray(t))return[];const n=[];for(const e of t){if("object"!=typeof e||null===e)continue;const{space:t,usage:o,source:a}=e;if("string"!=typeof t||"object"!=typeof o||null===o)continue;const{usedBytes:i,limitBytes:s}=o;Bt(i)&&(null===s||Bt(s))&&n.push({space:t,usedBytes:i,limitBytes:null===s?null:s,source:"string"==typeof a?a:"real"})}return n}function jt(e){if(!(Lt(t=e)&&"state"in t&&function(e){return"ok"===e||"nearly_full"===e||"full"===e}(t.state))||"account"in t&&void 0!==t.account&&!Lt(t.account))return;var t;const n=e.account??e,o=n.limitBytes,a=e.account?.plan??e.plan;return{level:null===o?"normal":zt[e.state],usedBytes:n.usedBytes,limitBytes:o,percent:null!==o&&o>0?Math.min(100,Math.round(n.usedBytes/o*1e3)/10):void 0,plan:"string"==typeof a&&""!==a?a:void 0,leftBytes:null===o?void 0:Math.max(0,o-n.usedBytes),spaces:It(e),manageHref:At(e)}}const Rt={normal:{key:"storage.glance.normal",tone:"ok"},nearly:{key:"storage.glance.nearly_full",tone:"warn"},full:{key:"storage.glance.full",tone:"warn"}};function Pt(e,t,n=""){const o=document.createElement(e);return o.className=t,""!==n&&(o.textContent=n),o}function Ft(e,t,n,o){const a=Pt("div","storage-meter");a.setAttribute("role","meter"),a.setAttribute("aria-label",e),a.setAttribute("aria-valuemin","0"),a.setAttribute("aria-valuemax",String(t)),a.setAttribute("aria-valuenow",String(Math.min(n,t))),a.setAttribute("aria-valuetext",o);const i=Pt("i","storage-fill");return i.style.width=`${Math.min(100,n/t*100)}%`,a.append(i),a}function Yt(e,t){const n=Pt("div","storage-link"),o=Pt("a","storage-manage");return o.href=t,o.target="_blank",o.rel="noopener noreferrer",o.append(e.text("storage.manage"),Pt("span","storage-sr",` ${e.text("storage.page.manage_hint")}`),d("ext")),n.append(o),n}function Wt(e,t){const n=Pt("span","storage-st");n.dataset.tone=t;const o=Pt("span","storage-dot");return o.setAttribute("aria-hidden","true"),n.append(o,Pt("span","",e)),n}function Ut(e,t){const n=Pt("div","storage-banner");n.setAttribute("role","status");const o=document.createElement("div"),a=Pt("strong","",e.text("storage.page.full_title"));return o.append(a,e.text("storage.page.full_body"),Yt(e,t)),n.append(d("warn"),o),n}const Ht={id:"storage",labelCode:"nav.storage",icon:"drive",summaryCode:"storage.summary",status:e=>void 0!==e.client()?.storageEpisode?.current()?{text:e.text("storage.glance.full"),tone:"warn"}:re(e,e.data.latest("storage"),t=>{const n=null===jt(t)?.limitBytes;return n||"full"!==t.state?n||"nearly_full"!==t.state?{text:e.text("storage.glance.normal"),tone:"ok"}:{text:e.text("storage.glance.nearly_full"),tone:"warn"}:{text:e.text("storage.glance.full"),tone:"warn"}}),isAvailable:e=>!0===e.client()?.signedIn(),mount:function(e,t){const n=document.createElement("style");n.textContent='\n.ui-ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}\n.storage-lede{margin:-14px 0 28px;max-width:56ch;font-size:15px;line-height:1.5}\n.storage-cols{display:grid;gap:28px 36px;grid-template-columns:repeat(auto-fit,minmax(16rem,1fr));align-items:start}\n.storage-h{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-size:13px;font-weight:600;line-height:1.3;letter-spacing:.02em}\n.storage-h::after{content:"";flex:1;height:1px;background:#e4e4e7}\n.storage-hd{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px;margin-bottom:12px}\n.storage-fig{font-size:2.75rem;font-weight:600;line-height:1;font-variant-numeric:tabular-nums;letter-spacing:-.03em}\n.storage-fig small{margin-left:2px;white-space:pre-wrap;font-size:1rem;font-weight:500;letter-spacing:0;color:#71717a}\n.storage-st{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;white-space:nowrap;color:#18181b}\n.storage-dot{position:relative;flex:none;width:9px;height:9px;border-radius:50%;background:currentColor}\n.storage-st[data-tone="warn"]{color:#92400e}\n.storage-st[data-tone="warn"] .storage-dot{background:#b45309;box-shadow:0 0 0 1.5px #fff,0 0 0 2.5px #b45309}\n.storage-meter{height:6px;border-radius:999px;background:#f4f4f5;box-shadow:inset 0 0 0 1px #71717a;overflow:hidden}\n.storage-fill{display:block;height:100%;border-radius:999px;background:#09090b;transition:width .6s ease}\n.storage-kv{display:flex;flex-direction:column;margin:14px 0 0;padding:0}\n.storage-kv>div{display:flex;align-items:center;gap:10px;box-sizing:border-box;min-height:44px;padding:9px 0;border-bottom:1px solid #e4e4e7}\n.storage-kv>div:last-child{border-bottom:0}\n.storage-kv dt{display:flex;flex:1 1 auto;align-items:baseline;gap:10px;min-width:0;margin:0;font-size:14px;white-space:nowrap}\n.storage-kv dt::after{content:"";flex:1 1 12px;min-width:12px;border-bottom:2px dotted #a1a1aa;transform:translateY(-3px)}\n.storage-kv dd{flex:0 1 auto;max-width:78%;margin:0;font-size:14px;font-weight:600;text-align:right;overflow-wrap:anywhere}\n.storage-link{margin-top:6px}\na.storage-manage{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:44px;padding:0 4px;color:inherit;font-size:13px;font-weight:600;text-decoration:underline;text-underline-offset:3px}\na.storage-manage:focus-visible{outline:2px solid #111827;outline-offset:2px}\na.storage-manage .ui-ic{width:14px;height:14px}\n.storage-sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n.storage-updated{margin:18px 0 0;font-size:12.5px;line-height:1.4;color:#71717a}\n@media (prefers-reduced-motion:reduce){.storage-fill{transition:none}}\n@media (prefers-color-scheme: dark){\n.storage-kv>div{border-bottom-color:#3f3f46}\n.storage-h::after{background:#3f3f46}\n.storage-fig small,.storage-updated{color:#a1a1aa}\n.storage-st{color:#fafafa}\n.storage-st[data-tone="warn"]{color:#fcd34d}\n.storage-st[data-tone="warn"] .storage-dot{background:#f59e0b;box-shadow:0 0 0 1.5px #151517,0 0 0 2.5px #f59e0b}\n.storage-meter{background:#27272a}\n.storage-fill{background:#fafafa}\n.storage-kv dt::after{border-bottom-color:#71717a}\na.storage-manage:focus-visible{outline-color:#fafafa}\n}\n';const o=new Set,a=e=>{o.has(e)||(o.add(e),n.append(e))},i=Pt("h3","sec-title",t.text("nav.storage"));i.tabIndex=-1;const s=Pt("p","storage-lede");let r,c=!1,l=!1,p=0,u=!1;const g=()=>void 0!==t.client()?.storageEpisode?.current();let f=g();const m=ue(t,()=>{N()}),h=document.createElement("div"),y=Pt("p","storage-updated"),x=Pt("div","storage-ask"),b=Pt("span","ic");b.setAttribute("aria-hidden","true"),b.append(d("drive"));const v=Pt("h4",""),w=document.createElement("p"),k=Pt("p","note"),C=Pt("button","action storage-primary");C.type="button";const E=document.createElement("div");async function N(){if(l)return;const e=p;l=!0,A();try{await t.data.refresh("storage")}catch{}e===p&&(l=!1,A())}function _(){p+=1,l=!1,u=!1,r=void 0,A()}function A(){if(c)return;if(void 0===t.data.source)return m.status.hidden=!1,m.status.textContent=t.text("storage.unavailable"),m.retry.hidden=!0,x.hidden=!0,h.replaceChildren(),void(y.hidden=!0);const e=l?{state:"loading"}:t.data.latest("storage")??{state:"loading"},n=g(),o="needs-permission"===e.state&&!n;let i;if(s.textContent=t.text(o?"storage.page.lede_short":"storage.page.lede"),o)m.status.hidden=!0,m.retry.hidden=!0;else if(l||"error"!==e.state||(p=e.code,!0!==St[p])){const n=ge(m,t,e);i=void 0===n?void 0:jt(n),void 0!==n&&void 0===i&&(m.status.hidden=!1,m.status.textContent=t.text("storage.unavailable"))}else m.status.hidden=!1,m.status.textContent=t.text("storage.page.unavailable_node"),m.retry.hidden=!0;var p;if(n&&(m.status.hidden=!0,m.retry.hidden=!0,i=void 0),o&&a('\n.storage-ask{display:flex;flex-direction:column;align-items:flex-start;gap:14px;box-sizing:border-box;padding:20px;border-radius:20px;box-shadow:inset 0 0 0 1px #e4e4e7}\n.storage-ask .ic{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;box-shadow:inset 0 0 0 1px #71717a}\n.storage-ask h4{margin:0 0 6px;font:400 1.375rem/1.2 "Literata Variable","Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;overflow-wrap:anywhere}\n.storage-ask p{max-width:52ch;margin:0;font-size:14px;line-height:1.45}\n.storage-ask .note{margin-top:8px;font-size:13px}\n.action.storage-primary{border-color:#09090b;background:#09090b;color:#fff}\n.action.storage-primary:hover{background:#27272a}\n@media (prefers-color-scheme: dark){\n.storage-ask{box-shadow:inset 0 0 0 1px #69696b}\n.action.storage-primary{border-color:#fafafa;background:#fafafa;color:#09090b}\n.action.storage-primary:hover{background:#e4e4e7}\n}\n'),x.hidden=!o,"needs-permission"===e.state){const n=t.client(),o=void 0!==n?.requestAuthority&&!1!==n.canRequest?.("space/info")&&"space/info"===e.ability;v.textContent=t.text("storage.page.permission_title",{app:t.appLabel()??t.text("storage.page.permission_app")}),w.textContent=o?`${t.text("storage.page.permission_body")} ${t.text("storage.page.permission_approve")}`:t.text("storage.page.permission_body"),C.hidden=!o,C.disabled=u,C.textContent=t.text(u?"storage.page.waiting":"declined"===r?"storage.try_again":"storage.page.allow");const a=o&&"blocked"!==r?"declined"===r?"storage.declined":"":"storage.page.permission_blocked";k.hidden=""===a,k.textContent=""===a?"":t.text(a)}if(n){a(Mt);const n=Pt("div","storage-hd");n.append(Wt(t.text(Rt.full.key),Rt.full.tone));const o="ready"===e.state?At(e.data):_t;h.replaceChildren(Ut(t,o),n)}else if(void 0===i)h.replaceChildren();else{"full"===i.level&&a(Mt),"nearly"===i.level&&a("\n.storage-near{display:flex;gap:6px;align-items:flex-start;margin:6px 0 0;font-size:12.5px;line-height:1.4}\n.storage-near .ui-ic{width:16px;height:16px;margin-top:1px;color:#b35309}\n@media (prefers-color-scheme: dark){.storage-near .ui-ic{color:#f59e0b}}\n"),i.spaces.length>0&&a("\n.storage-h .cnt{font-weight:500;color:#71717a}\n.storage-spaces{margin:0;padding:0;list-style:none}\n.storage-space{display:flex;flex-direction:column;gap:8px;padding:12px 0;border-bottom:1px solid #e4e4e7}\n.storage-space:last-child{border-bottom:0}\n.storage-space .l{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:14px}\n.storage-space .l b{font-weight:600;overflow-wrap:anywhere}\n.storage-space .l span{font-variant-numeric:tabular-nums}\n@media (prefers-color-scheme: dark){\n.storage-h .cnt{color:#a1a1aa}\n.storage-space{border-bottom-color:#3f3f46}\n}\n");const e=Pt("div","storage-cols");e.append(function(e,t){const n=Rt[t.level],o=Pt("section","storage-used");o.setAttribute("aria-labelledby","storage-used-h");const a=Pt("h4","storage-h",e.text("storage.page.used"));a.id="storage-used-h";const i=Dt(t.usedBytes),s=Pt("div","storage-fig");s.append(i.amount,Pt("small","",` ${i.unit}`));const r=qt(t.usedBytes),c=e.text(n.key);let l;if(null===t.limitBytes)s.append(Pt("small","",` ${e.text("storage.page.no_limit")}`)),l=e.text("storage.page.meter_text_open",{used:r,state:c});else{const n=qt(t.limitBytes);s.append(Pt("small","",` ${e.text("storage.page.of_limit",{limit:n})}`)),l=e.text("storage.page.meter_text",{used:r,limit:n,state:c})}const p=Pt("div","storage-hd");p.append(s,Wt(c,n.tone)),o.append(a,p),null!==t.limitBytes&&t.limitBytes>0&&o.append(Ft(e.text("storage.page.meter"),t.limitBytes,t.usedBytes,l));const u=Pt("dl","storage-kv"),g=(e,t)=>{const n=document.createElement("div");n.append(Pt("dt","",e),Pt("dd","",t)),u.append(n)};if(void 0!==t.plan){const n=t.plan.charAt(0).toUpperCase()+t.plan.slice(1);g(e.text("storage.page.plan"),null===t.limitBytes?n:`${n} — ${qt(t.limitBytes)}`)}if(null===t.limitBytes?g(e.text("storage.page.left"),e.text("storage.page.no_limit")):g(e.text("storage.page.left"),0===t.leftBytes?e.text("storage.page.none"):qt(t.leftBytes??0)),o.append(u,Yt(e,t.manageHref)),"nearly"===t.level){const t=Pt("p","storage-near");t.append(d("warn"),e.text("storage.page.nearly_note")),o.append(t)}return o}(t,i)),i.spaces.length>0&&e.append(function(e,t){const n=Pt("section","storage-by-space");n.setAttribute("aria-labelledby","storage-space-h");const o=Pt("h4","storage-h",e.text("storage.page.by_space"));o.id="storage-space-h",o.append(" ",Pt("span","cnt",String(t.spaces.length)));const a=Pt("ul","storage-spaces");for(const n of t.spaces){const o=Pt("li","storage-space");o.dataset.source=n.source;const i=n.limitBytes??t.limitBytes,s=qt(n.usedBytes),r=Pt("div","l");if(r.append(Pt("b","",n.space),Pt("span","",s)),o.append(r),null!==i&&i>0){const t=e.text("storage.page.space_meter_text",{used:s,limit:qt(i)});o.append(Ft(e.text("storage.page.space_meter",{space:n.space}),i,n.usedBytes,t))}a.append(o)}return n.append(o,a),n}(t,i)),h.replaceChildren(..."full"===i.level?[Ut(t,i.manageHref)]:[],e)}const f=t.data.age("storage");y.hidden=void 0===i||void 0===f||n,y.textContent=void 0===f?"":function(e,t){const n=Math.floor(t/6e4);return n<1?e.text("storage.page.age_now"):n<60?e.text("storage.page.age_minutes",{count:n}):e.text("storage.page.age_hours",{count:Math.floor(n/60)})}(t,f)}E.append(v,w,k),x.append(b,E,C),C.addEventListener("click",e=>{const n=t.client()?.requestAuthority;if(!e.isTrusted||u||void 0===n)return;u=!0,r=void 0;const o=p;A(),(async()=>{let e;try{e=await n("space/info")}catch{e={approved:!1,code:"failed"}}c||o!==p||(u=!1,e.approved?await N():(r="unsupported"===e.code?"blocked":"declined",A()))})()});const S=t.data.subscribe(()=>A()),T=t.client()?.storageEpisode?.subscribe(()=>{const e=f;f=g(),A(),t.requestRender(),e&&!f&&N()}),L=t.client()?.onReset(_),M=t.onClientChange(_);return e.append(n,i,s,m.status,m.retry,x,h,y),A(),()=>{c=!0,S(),T?.(),L?.(),M(),e.replaceChildren()}}},Vt=[U,kt,yt,Qe,Nt,Ht,ae],Gt=["localNode","localCopy","delegations","nodes","storage"],Kt=6e4;function Xt(e,t,n){void 0!==t?t.after(n):e?.append(n)}const Zt={ok:!1,code:"stale"},Jt=new WeakMap;function Qt(e,t,a,i){const r=document.createElement("style");r.textContent=j+q,e.append(r);let l,d,p={open:!1,layout:"drawer",phone:!1,showLayoutToggle:!1},u=[],g=!1;const f=E({...t,onNavigate(e){l=e,Y()}}),m=e.querySelector(".layer"),h=m?function(e,t,n){const o=document.createElement("div");o.className="tstack";const a=document.createElement("div"),i=document.createElement("div");o.append(a,i),e.querySelector(":scope > .toasts")?.remove(),e.append(o);const s=new Map,r=new Set;function c(e){const{el:n,body:o,message:a}=I(e.kind);if(a.textContent=b(e.textCode),void 0!==e.href&&void 0!==e.hrefLabelCode){const t=document.createElement("a");t.href=e.href,t.target="_blank",t.rel="noopener noreferrer",t.textContent=b(e.hrefLabelCode),o.append(t)}return n.append(B(()=>t.dismiss(e.id))),n.addEventListener("mouseenter",()=>{r.has(e.id)||(r.add(e.id),t.pause())}),n.addEventListener("mouseleave",()=>{r.delete(e.id)&&t.resume()}),n}const l=t.subscribe(function(e){const n=new Set(e.map(e=>e.id));for(const[e,o]of s)n.has(e)||(r.delete(e)&&t.resume(),o.remove(),s.delete(e));for(const t of e){if(s.has(t.id))continue;const e=c(t);s.set(t.id,e),i.append(e)}}),d=[];let p=0;function u(e){void 0!==e.timer||p>0||(e.startedAt=Date.now(),e.timer=setTimeout(()=>f(e),e.remaining))}function g(e){void 0!==e.timer&&(clearTimeout(e.timer),e.timer=void 0,e.remaining=Math.max(0,e.remaining-(Date.now()-e.startedAt)))}function f(e){const t=d.indexOf(e);-1!==t&&(g(e),d.splice(t,1),e.el.remove())}return{receipt(e){const t=e.rows.map(e=>`${e.labelCode}=${e.value}|${e.copyValue??""}`).join("\n");if(d.some(e=>e.key===t))return!1;const{el:o,body:i,message:s}=I("success"),r=document.createElement("b");r.className="toast__title",r.textContent=b(e.titleCode),s.append(r),void 0!==e.bodyCode&&s.append(b(e.bodyCode));const c=document.createElement("div");c.className="slip";for(const t of e.rows){const e=document.createElement("div");e.textContent=`${b(t.labelCode)} ${t.value}`,c.append(e)}const l=document.createElement("button");l.type="button",l.className="toast__copy",l.textContent=b("toast.copy_receipt"),l.addEventListener("click",()=>{!async function(e){const t=e.map(e=>`${b(e.labelCode)} ${e.copyValue??e.value}`).join("\n");try{await navigator.clipboard.writeText(t),n({kind:"success",textCode:"toast.copied"})}catch{n({kind:"error",textCode:"toast.copy_failed"})}}(e.rows)}),i.append(c,l);const m={key:t,el:o,timer:void 0,remaining:O,startedAt:0};o.append(B(()=>f(m)));let h=!1;for(o.addEventListener("mouseenter",()=>{h||(h=!0,(()=>{p++;for(const e of d)g(e)})())}),o.addEventListener("mouseleave",()=>{h&&(h=!1,(()=>{p=Math.max(0,p-1);for(const e of d)u(e)})())}),d.push(m),a.append(o);d.length>D;)f(d[0]);return u(m),!0},clearReceipts(){for(const e of[...d])f(e)},dispose(){l();for(let e=0;e<r.size;e++)t.resume();r.clear();for(const e of[...d])f(e);s.clear(),o.remove()}}}(m,i,e=>a.toast(e)):void 0,y=m?function(e,t,n,o){const a=document.createElement("div");a.className="scrim",a.setAttribute("aria-hidden","true"),a.addEventListener("click",o);const i=t.querySelector(":scope > .pending");i?i.before(a):t.append(a);let s,r,c,l=!1,d=!1,p=!1;const u=()=>t.querySelector(":scope > .tstack");function g(){return[...Array.from(n.querySelectorAll(M)),...Array.from(u()?.querySelectorAll(M)??[])].filter(z)}const f=e=>null!==e&&(n.contains(e)||(u()?.contains(e)??!1));function m(t){if(!d||L())return;const a=e.activeElement;if(!f(a))return;if("Escape"===t.key)return void(n.contains(a)||o());if("Tab"!==t.key||null===a)return;const i=g(),s=i[0],r=i[i.length-1];if(!s||!r)return void t.preventDefault();const c=a===r||Boolean(r.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_FOLLOWING),l=a===s||Boolean(s.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_PRECEDING);!t.shiftKey&&c?(t.preventDefault(),i[N(i.length,i.length-1,!1)]?.focus()):t.shiftKey&&l&&(t.preventDefault(),i[N(i.length,0,!0)]?.focus())}function h(){if(!p){p=!0;try{const e=c?.isConnected&&f(c)&&z(c)?c:g()[0];e?.focus()}finally{p=!1}}}function y(t){L()||t.target===e.host||h()}function x(e){if(p||L())return;const t=e.target;f(t)?c=t:t.matches(".button")&&h()}function b(){if(!d||L()||!c||c.isConnected||!function(){const t=document.activeElement;return null===t||t===document.body||t===e.host&&null===e.activeElement}())return;const t=n.querySelector('[role="alertdialog"],.drawer'),o=t&&z(t)?Array.from(t.querySelectorAll(M)).find(z):void 0,a=Array.from(u()?.querySelectorAll(M)??[]).find(z),i=n.querySelector(".main"),s=i?.querySelector(".sec-title")??i?.firstElementChild,r=o??a??(s instanceof HTMLElement?s:g()[0]);r&&r===s&&(r.tabIndex=-1),r?.focus()}const v=new(e.ownerDocument.defaultView?.MutationObserver??MutationObserver)(()=>b());function w(e){null===e.relatedTarget&&queueMicrotask(b)}function k(e){!d||L()||"Escape"!==e.key||e.composedPath().includes(t)||e.target!==document.body&&e.target!==document.documentElement||queueMicrotask(()=>{if(!d||L()||e.defaultPrevented)return;const t=n.querySelector('[role="alertdialog"],.drawer');t&&z(t)?Array.from(t.querySelectorAll(M)).find(z)?.focus():o()})}function C(){queueMicrotask(()=>{!d||L()||f(e.activeElement)||h()})}function E(e){e?(c=void 0,document.addEventListener("focusin",y,!0),t.addEventListener("focusin",x),t.addEventListener("focusout",w),document.addEventListener("keydown",k,!0),v.observe(t,{childList:!0,subtree:!0})):(document.removeEventListener("focusin",y,!0),t.removeEventListener("focusin",x),t.removeEventListener("focusout",w),document.removeEventListener("keydown",k,!0),v.disconnect())}return t.addEventListener(T,C),t.addEventListener("keydown",m),{sync(t,n){if(t&&!l){const t=document.activeElement;s=t instanceof HTMLElement&&t!==e.host&&t!==document.body?t:void 0,r=void 0}else!t&&l&&(r=d?s:void 0,s=void 0);l=t,n!==d&&(d=n,E(d))},restoreFocus(){const e=r;return r=void 0,!!e?.isConnected&&(e.focus(),!0)},dispose(){E(!1),t.removeEventListener("keydown",m),t.removeEventListener(T,C),a.remove()}}}(e,m,f.el,t.onClose):void 0,x=()=>{const e=a.client();return e&&function(e){let t=Jt.get(e);if(void 0===t){let a;t=Object.create(e,{data:{get:()=>e.data??(e.signedIn()?a??(a=function(e){const t=new Set,a=e=>{for(const n of[...t])n(e)};let i,s;const r=()=>{const t=(0,o.livePanelData)(e);if(t!==i){s?.(),i=t,s=t?.subscribe(a);for(const e of n)a(e)}};return(0,o.onLivePanelDataChange)(e,r),r(),{subscribe:e=>(t.add(e),()=>{t.delete(e)}),account:()=>i?.account()??{state:"loading"},knownDid:()=>i?.knownDid?.(),localNode:()=>i?.localNode()??{state:"loading"},localCopy:()=>i?.localCopy()??{state:"loading"},nodes:()=>i?.nodes()??{state:"loading"},storage:e=>i?.storage(e)??{state:"loading"},delegations:e=>i?.delegations(e)??{state:"loading"},revoke:e=>i?.revoke(e)??Zt,setLocalNodeEnabled:e=>i?.setLocalNodeEnabled(e)??Zt}}(e)):void 0),enumerable:!0}}),Jt.set(e,t)}return t}(e)},v=function(e,t=Date.now){const n=new Map,o=new Set;let a,i,s=0,r=0,c=!1;function l(){for(const e of[...o])e()}async function d(o){const a=e();if(void 0===a)return;const i=r;let s;try{s=await a[o]()}catch{s={state:"error",code:"unknown"}}i===r&&(n.set(o,{result:s,at:t()}),l())}function p(e){return void 0===e?Promise.all(Gt.map(d)).then(()=>{}):d(e)}function u(){a?.(),a=e()?.subscribe(()=>{p()})}return{get source(){return e()},latest:e=>n.get(e)?.result,age(e){const o=n.get(e);return void 0===o?void 0:t()-o.at},refresh:p,generation:()=>s,subscribe:e=>(o.add(e),()=>{o.delete(e)}),start(){c||(c=!0,u(),p(),i=setInterval(()=>{p()},Kt))},stop(){c=!1,r++,a?.(),a=void 0,void 0!==i&&clearInterval(i),i=void 0},reset(){s++,r++,n.clear(),l(),c&&(u(),p())},notify:l}}(()=>x()?.data),w=function(e){const t=new Set;function n(e){return!!t.delete(e)&&(e.remove(),!0)}return{confirm(o){const a=c({question:o.question,cancelLabel:o.cancelLabel,confirmLabel:o.confirmLabel,onCancel:()=>{n(a.el)&&o.onCancel?.()},onConfirm:o.onConfirm});return t.add(a.el),Xt(e(),o.anchor,a.el),a.cancel.focus(),{cancel:a.cancel,confirm:a.confirm,close:()=>{n(a.el)}}},openDrawer(o){const a=function(e){const t=document.createElement("section");t.className="drawer",t.setAttribute("role","region");const n=document.createElement("h3");n.textContent=e.title;const o=s(e.closeLabel);return o.addEventListener("click",e.onClose),t.append(n,...e.body,o),t}({title:o.title,body:o.body,closeLabel:o.closeLabel,onClose:()=>{n(a)&&o.onClose?.()}});t.add(a),Xt(e(),o.anchor,a);const i=a.querySelector("h3");return i?.setAttribute("tabindex","-1"),i?.focus(),{el:a,close:()=>{n(a)}}},closeAll(){for(const e of[...t])n(e)}}}(()=>d),k=rt(e=>a.toast(e)),C={...a,client:()=>k(x()),text:b,data:v,layout:()=>p.layout,sections:()=>Vt.filter(e=>e.isAvailable(C)),requestRender:()=>v.notify(),confirm:e=>w.confirm(e),openDrawer:e=>w.openDrawer(e),receipt:e=>a.toastsEnabled()&&void 0!==h&&h.receipt(e),closePanel:t.onClose,openSection(e){l=e,Y()}};function _(){w.closeAll(),d=void 0;for(const e of u)e();u=[]}function A(e){return e.map(e=>{const t=e.status(C);return{id:e.id,labelCode:e.labelCode,icon:e.icon,meta:void 0===t?void 0:t.count??t.text}})}const S=v.subscribe(function(){f.setNav(A(Vt.filter(e=>e.isAvailable(C))),l)});function $(){v.reset(),w.closeAll(),h?.clearReceipts()}let R;function P(){R?.(),R=a.client()?.onReset($)}const F=a.onClientChange(()=>{P(),$()});function Y(){_();const e=Vt.filter(e=>e.isAvailable(C)),t=e.find(e=>e.id===l)??e[0];if(l=t?.id,f.setLayout(p.layout,{showLayoutToggle:p.showLayoutToggle,phone:p.phone}),f.setAppLabel(C.appLabel()),f.setNav(A(e),l),!p.open||!t)return;const n=document.createElement("section");n.className="section",n.dataset.section=t.id,d=n,f.main.replaceChildren(n);const o=t.mount(n,C);u.push(()=>{o(),n.remove()})}return P(),Object.assign(f,{render(e){p=e,void 0!==e.section&&(l=e.section),y?.sync(e.open,e.open&&"drawer"===e.layout),e.open&&!g?v.start():!e.open&&g&&v.stop(),g=e.open,Y()},restoreFocus:()=>y?.restoreFocus()??!1,dispose(){_(),v.stop(),S(),R?.(),F(),h?.dispose(),y?.dispose()}})}module.exports=t})();