@telepath-computer/television 0.1.182 → 0.1.184

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.
@@ -0,0 +1 @@
1
+ (function(){const y=document.createElement("link").relList;if(y&&y.supports&&y.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))L(f);new MutationObserver(f=>{for(const u of f)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&L(h)}).observe(document,{childList:!0,subtree:!0});function _(f){const u={};return f.integrity&&(u.integrity=f.integrity),f.referrerPolicy&&(u.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?u.credentials="include":f.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function L(f){if(f.ep)return;f.ep=!0;const u=_(f);fetch(f.href,u)}})();const N="url-target-request",U="url-target",P="artifact-missing-request",X="artifact-missing",v="proxy-content-changed",G="bridge-ready",C="leaving";function p(t){return typeof t=="object"&&t!==null}function B(t){return!p(t)||t.type!==N?!1:!("id"in t)}function K(t){return!p(t)||t.type!==U||typeof t.url!="string"&&t.url!==null?!1:!("id"in t)}function x(t){return!p(t)||t.type!==P?!1:!("id"in t)}function W(t){return!p(t)||t.type!==X||typeof t.title!="string"||typeof t.path!="string"?!1:!("id"in t)}function k(t){return!p(t)||t.type!==v?!1:!("id"in t)}function q(t){return!p(t)||t.type!==G||typeof t.url!="string"||"guid"in t&&typeof t.guid!="string"?!1:!("id"in t)}function F(t){return!p(t)||t.type!==C||typeof t.guid!="string"?!1:!("id"in t)}function V(t){return!p(t)||t.type!=="wheel"||typeof t.deltaX!="number"||typeof t.shiftKey!="boolean"?!1:!("id"in t)}function $(t){return!p(t)||t.type!=="navigation-request"||typeof t.url!="string"||"replace"in t&&typeof t.replace!="boolean"||"sameDocument"in t&&typeof t.sameDocument!="boolean"||"native"in t&&typeof t.native!="boolean"?!1:!("id"in t)}function j(t){return!p(t)||t.type!=="filmstrip-key"||t.direction!==-1&&t.direction!==1?!1:!("id"in t)}function z(t){return!p(t)||t.type!=="swipe-move"||typeof t.deltaX!="number"?!1:!("id"in t)}function H(t){return!p(t)||t.type!=="swipe-end"||typeof t.velocityX!="number"?!1:!("id"in t)}function Q(t=window,y={}){const _=t;if(_.__televisionArtifactBridgeInstalled===!0||(_.__televisionArtifactBridgeInstalled=!0,t.parent===t))return;const f=(()=>{const r=Date.now().toString(36);try{const s=t.crypto;if(s&&typeof s.getRandomValues=="function"){const a=new Uint32Array(4);return s.getRandomValues(a),`tvb-${r}-${Array.from(a,n=>n.toString(36)).join("-")}`}}catch{}return`tvb-${r}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`})(),u=()=>{t.parent.postMessage({type:"bridge-ready",url:t.location.href,guid:f},"*")};t.addEventListener("pagehide",()=>{t.parent.postMessage({type:"leaving",guid:f},"*")}),t.addEventListener("pageshow",o=>{o.persisted===!0&&u()});const h=t.location.href;if((o=>{try{const e=new URL(o);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(e.pathname)}catch{return!1}})(h)&&typeof t.fetch=="function"){const r=y.pollCadence,s=r!==void 0&&Number.isFinite(r.normalMs)&&r.normalMs>0&&Number.isFinite(r.slowMs)&&r.slowMs>=r.normalMs?r:null,a=(s==null?void 0:s.normalMs)??5e3,n=(s==null?void 0:s.slowMs)??15e3;let i=null,l=a,d=!1;const c=()=>{(async()=>{try{const m=await t.fetch(h,{method:"HEAD"});if(!m.ok)throw new Error("Artifact poll failed");const g=m.headers.get("ETag");if(!g)throw new Error("Artifact poll missing ETag");l=a,i===null?i=g:g!==i&&(i=g,t.parent.postMessage({type:"proxy-content-changed"},"*"))}catch{l=Math.min(n,l*2)}finally{d||t.setTimeout(c,l)}})()};t.addEventListener("pagehide",()=>{d=!0}),c()}const S=()=>{t.document.documentElement&&(t.document.documentElement.style.touchAction="pan-y",t.document.documentElement.style.overscrollBehaviorX="contain",t.document.documentElement.style.overscrollBehaviorY="contain"),t.document.body&&(t.document.body.style.overscrollBehaviorX="contain",t.document.body.style.overscrollBehaviorY="contain")};if(S(),t.document.body||t.document.addEventListener("DOMContentLoaded",S,{once:!0}),y.reportNavigation!==!1){const o=r=>{t.parent.postMessage({type:"navigation-request",...r},"*")};o({url:t.location.href});const e=t.navigation;if(e)e.addEventListener("navigate",r=>{var d,c;const s=r,a=(d=s.destination)==null?void 0:d.url;if(typeof a!="string")return;const n=((c=s.destination)==null?void 0:c.sameDocument)===!0,i={url:a,...s.navigationType==="replace"?{replace:!0}:{},...n?{sameDocument:!0}:{}};if(n){o(i);return}try{if(new URL(a,t.location.href).origin===t.location.origin){o({...i,native:!0});return}}catch{}s.canIntercept!==!1&&s.preventDefault(),o(i)});else{t.document.addEventListener("click",a=>{var m;const n=a;if(n.metaKey||n.ctrlKey||n.shiftKey||n.altKey)return;const i=(m=t.document.defaultView)==null?void 0:m.Element;if(!i||!(n.target instanceof i))return;const l=n.target.closest("a[href]");if(!l||l.target&&l.target.toLowerCase()!=="_self"||l.hasAttribute("download"))return;const d=l.getAttribute("href");if(!d||d.startsWith("javascript:"))return;let c;try{c=new URL(l.href,t.document.baseURI)}catch{return}if(c.origin===t.location.origin&&c.pathname===t.location.pathname&&c.search===t.location.search&&c.hash!==""){o({url:c.href,sameDocument:!0});return}n.preventDefault(),o({url:c.href})},!0);const r=t.history.pushState.bind(t.history),s=t.history.replaceState.bind(t.history);t.history.pushState=function(...n){r(...n),o({url:t.location.href,sameDocument:!0})},t.history.replaceState=function(...n){s(...n),o({url:t.location.href,replace:!0,sameDocument:!0})},t.addEventListener("popstate",()=>{o({url:t.location.href,sameDocument:!0})}),t.addEventListener("hashchange",()=>{o({url:t.location.href,sameDocument:!0})}),t.document.addEventListener("submit",a=>{var m,g;const n=a,i=n.target,l=(m=t.document.defaultView)==null?void 0:m.HTMLFormElement;if(!l||!(i instanceof l)||i.target&&i.target.toLowerCase()!=="_self")return;n.preventDefault();const d=i.method.toLowerCase(),c=new URL(i.action||t.location.href,t.document.baseURI);if(d==="get"){const b=(g=t.document.defaultView)==null?void 0:g.FormData;if(!b)return;const R=new URLSearchParams;for(const[O,A]of new b(i))typeof A=="string"&&R.append(O,A);c.search=R.toString()}o({url:c.href})},!0)}}const D=o=>{var a,n;const e=(a=t.document.defaultView)==null?void 0:a.Element;if(!e||!(o instanceof e))return!1;const s=o.closest("input, textarea, select, [contenteditable], [role='textbox'], [role='searchbox'], [role='combobox'], [role='spinbutton'], [role='slider']");return s?s.hasAttribute("contenteditable")?((n=s.getAttribute("contenteditable"))==null?void 0:n.toLowerCase())!=="false":!0:!1};t.addEventListener("keydown",o=>{const e=o;e.key!=="ArrowLeft"&&e.key!=="ArrowRight"||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||D(e.target)||(e.preventDefault(),t.parent.postMessage({type:"filmstrip-key",direction:e.key==="ArrowRight"?1:-1},"*"))},{capture:!0}),t.addEventListener("wheel",o=>{const e=o,r=e.shiftKey&&e.deltaX===0&&e.deltaY!==0,s=r?e.deltaY:e.deltaX,a=Math.abs(s),n=r?0:Math.abs(e.deltaY);a<=n||(e.preventDefault(),t.parent.postMessage({type:"wheel",deltaX:s,shiftKey:e.shiftKey},"*"))},{passive:!1});const M=8,I=100,T=1e3,E=new Map;t.addEventListener("pointerdown",o=>{const e=o;e.pointerType==="touch"&&E.set(e.pointerId,{startX:e.clientX,startY:e.clientY,lastX:e.clientX,offset:0,active:!1,discarded:!1,samples:[{time:e.timeStamp,offset:0}]})},{passive:!0}),t.addEventListener("pointermove",o=>{const e=o,r=E.get(e.pointerId);if(!r||r.discarded)return;if(!r.active){const i=e.clientX-r.startX,l=e.clientY-r.startY,d=Math.abs(i),c=Math.abs(l);if(d<M&&c<M)return;if(c>=d){r.discarded=!0;return}r.active=!0}const s=e.clientX-r.lastX;r.lastX=e.clientX,r.offset+=s,r.samples.push({time:e.timeStamp,offset:r.offset});const a=e.timeStamp-I;let n=0;for(let i=0;i<r.samples.length;i+=1){if(r.samples[i].time>=a){n=i;break}n=i+1}if(n>0){const i=Math.max(0,n-1);r.samples.splice(0,i)}t.parent.postMessage({type:"swipe-move",deltaX:s},"*"),e.preventDefault()},{passive:!1}),t.addEventListener("pointerup",o=>{const e=o,r=E.get(e.pointerId);if(!r||(E.delete(e.pointerId),!r.active))return;let s=0;if(r.samples.length>=2){const a=r.samples[0],n=r.samples[r.samples.length-1],i=n.time-a.time;i>0&&(s=(n.offset-a.offset)/i*T)}t.parent.postMessage({type:"swipe-end",velocityX:s},"*")}),t.addEventListener("pointercancel",o=>{const e=o,r=E.get(e.pointerId);r&&(E.delete(e.pointerId),r.active&&t.parent.postMessage({type:"swipe-end",velocityX:0},"*"))}),u()}export{X as A,U,$ as a,q as b,V as c,j as d,B as e,x as f,k as g,z as h,F as i,H as j,Q as k,W as l,P as m,K as n,N as o};
@@ -1 +1 @@
1
- import{k as d,l as g,m as p}from"./artifact-bridge-C0H5cXgO.js";import{m as l,a as E,b as f}from"./missing-artifact-page-DVzJ41AE.js";d(window,{reportNavigation:!1});document.getElementById("missing-title")!==null&&i(null);window.addEventListener("message",t=>{t.source===window.parent&&g(t.data)&&i(t.data)});var a;(a=window.__televisionContentBridge)==null||a.onHostMessage(t=>{g(t)&&i(t)});const c={type:p};window.parent.postMessage(c,"*");var m;(m=window.__televisionContentBridge)==null||m.postToHost(c);function i(t,n=document){const e=w(n);if(e.title.textContent=l(),e.description.textContent=E(),e.recovery.textContent=f(),n.title=(t==null?void 0:t.title)||l(),t===null){e.path.textContent="",e.pathBlock.hidden=!0;return}e.path.textContent=t.path,e.pathBlock.hidden=!1}function w(t){const n=t.getElementById("missing-title"),e=t.getElementById("missing-description"),s=t.getElementById("path-block"),o=t.getElementById("missing-path"),r=t.getElementById("missing-recovery");if(!(n instanceof HTMLElement))throw new Error("Missing #missing-title");if(!(e instanceof HTMLElement))throw new Error("Missing #missing-description");if(!(s instanceof HTMLElement))throw new Error("Missing #path-block");if(!(o instanceof HTMLElement))throw new Error("Missing #missing-path");if(!(r instanceof HTMLElement))throw new Error("Missing #missing-recovery");return{title:n,description:e,pathBlock:s,path:o,recovery:r}}
1
+ import{k as d,l as g,m as p}from"./artifact-bridge-BhiFDvPj.js";import{m as l,a as E,b as f}from"./missing-artifact-page-DVzJ41AE.js";d(window,{reportNavigation:!1});document.getElementById("missing-title")!==null&&i(null);window.addEventListener("message",t=>{t.source===window.parent&&g(t.data)&&i(t.data)});var a;(a=window.__televisionContentBridge)==null||a.onHostMessage(t=>{g(t)&&i(t)});const c={type:p};window.parent.postMessage(c,"*");var m;(m=window.__televisionContentBridge)==null||m.postToHost(c);function i(t,n=document){const e=w(n);if(e.title.textContent=l(),e.description.textContent=E(),e.recovery.textContent=f(),n.title=(t==null?void 0:t.title)||l(),t===null){e.path.textContent="",e.pathBlock.hidden=!0;return}e.path.textContent=t.path,e.pathBlock.hidden=!1}function w(t){const n=t.getElementById("missing-title"),e=t.getElementById("missing-description"),s=t.getElementById("path-block"),o=t.getElementById("missing-path"),r=t.getElementById("missing-recovery");if(!(n instanceof HTMLElement))throw new Error("Missing #missing-title");if(!(e instanceof HTMLElement))throw new Error("Missing #missing-description");if(!(s instanceof HTMLElement))throw new Error("Missing #path-block");if(!(o instanceof HTMLElement))throw new Error("Missing #missing-path");if(!(r instanceof HTMLElement))throw new Error("Missing #missing-recovery");return{title:n,description:e,pathBlock:s,path:o,recovery:r}}