@telepath-computer/television 1.4.29 → 1.5.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.
@@ -0,0 +1 @@
1
+ (function(){const A=document.createElement("link").relList;if(A&&A.supports&&A.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))M(f);new MutationObserver(f=>{for(const y of f)if(y.type==="childList")for(const S of y.addedNodes)S.tagName==="LINK"&&S.rel==="modulepreload"&&M(S)}).observe(document,{childList:!0,subtree:!0});function R(f){const y={};return f.integrity&&(y.integrity=f.integrity),f.referrerPolicy&&(y.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?y.credentials="include":f.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function M(f){if(f.ep)return;f.ep=!0;const y=R(f);fetch(f.href,y)}})();const k="url-target-request",G="url-target",K="artifact-missing-request",Y="artifact-missing",q="proxy-content-changed",F="bridge-ready",B="leaving",X="artifact-pointer";function v(t,A){return!(t.key==="ArrowLeft"||t.key==="ArrowRight"||t.key==="ArrowUp"||t.key==="ArrowDown")||t.isComposing||t.metaKey||t.shiftKey?!1:A==="darwin"||/^(Mac|iPhone|iPad|iPod)/i.test(A)?t.altKey&&!t.ctrlKey:t.ctrlKey&&!t.altKey}function h(t){return typeof t=="object"&&t!==null}function V(t){return!h(t)||t.type!==k?!1:!("id"in t)}function W(t){return!h(t)||t.type!==G||typeof t.url!="string"&&t.url!==null?!1:!("id"in t)}function $(t){return!h(t)||t.type!==K?!1:!("id"in t)}function j(t){return!h(t)||t.type!==Y||typeof t.title!="string"||typeof t.path!="string"?!1:!("id"in t)}function w(t){return!h(t)||t.type!==q?!1:!("id"in t)}function H(t){return!h(t)||t.type!==F||typeof t.guid!="string"?!1:!("id"in t)}function Q(t){return!h(t)||t.type!==B||typeof t.guid!="string"?!1:!("id"in t)}function z(t){return!h(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 Z(t){return!h(t)||t.type!=="navigation-key"||t.key!=="ArrowLeft"&&t.key!=="ArrowRight"&&t.key!=="ArrowUp"&&t.key!=="ArrowDown"?!1:!("id"in t)}function J(t){return!h(t)||t.type!==X||t.eventType!=="pointermove"&&t.eventType!=="pointerdown"&&t.eventType!=="pointerup"&&t.eventType!=="pointercancel"&&t.eventType!=="click"||typeof t.clientX!="number"||!Number.isFinite(t.clientX)||typeof t.clientY!="number"||!Number.isFinite(t.clientY)||typeof t.button!="number"||!Number.isFinite(t.button)||typeof t.buttons!="number"||!Number.isFinite(t.buttons)?!1:!("id"in t)}function tt(t=window,A={}){const R=t;if(t.parent===t||R.__televisionArtifactBridgeInstalled===!0)return;R.__televisionArtifactBridgeInstalled=!0;const f=(()=>{const c=Date.now().toString(36);try{const g=t.crypto;if(g&&typeof g.getRandomValues=="function"){const u=new Uint32Array(4);return g.getRandomValues(u),`tvb-${c}-${Array.from(u,L=>L.toString(36)).join("-")}`}}catch{}return`tvb-${c}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`})(),y=()=>{t.parent.postMessage({type:"bridge-ready",guid:f},"*")};t.addEventListener("pagehide",()=>{t.parent.postMessage({type:"leaving",guid:f},"*")}),t.addEventListener("pageshow",m=>{m.persisted===!0&&y()}),t.addEventListener("keydown",m=>{const a=m,c=a.key==="ArrowLeft"||a.key==="ArrowRight"||a.key==="ArrowUp"||a.key==="ArrowDown",g=t.navigator.platform,L=g==="darwin"||/^(Mac|iPhone|iPad|iPod)/i.test(g)?a.altKey&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey:a.ctrlKey&&!a.altKey&&!a.metaKey&&!a.shiftKey;!c||a.isComposing||!L||(a.preventDefault(),t.parent.postMessage({type:"navigation-key",key:a.key},"*"))},!0);const S=["pointermove","pointerdown","pointerup","pointercancel","click"];for(const m of S)t.addEventListener(m,a=>{const c=a;c.isTrusted&&t.parent.postMessage({type:"artifact-pointer",eventType:m,clientX:c.clientX,clientY:c.clientY,button:c.button,buttons:c.buttons},"*")},!0);const O=t.location.href;if((m=>{try{const a=new URL(m);return/^\/artifact\/[0-9A-Za-z]{26}(\/|$)/.test(a.pathname)}catch{return!1}})(O)&&typeof t.fetch=="function"){const c=A.pollCadence,g=c!==void 0&&Number.isFinite(c.normalMs)&&c.normalMs>0&&Number.isFinite(c.slowMs)&&c.slowMs>=c.normalMs?c:null,u=(g==null?void 0:g.normalMs)??5e3,L=(g==null?void 0:g.slowMs)??15e3;let o=null,l=u,s=0,i=!1,e=null,r=null;const d=()=>{i&&(i=!1,s+=1,e!==null&&(t.clearTimeout(e),e=null),r==null||r.abort(),r=null)},p=()=>{if(i)return;i=!0;const n=++s,E=()=>{if(!i||n!==s)return;e=null;const T=t.AbortController,_=typeof T=="function"?new T:null;r=_,(async()=>{try{const D=await t.fetch(O,{method:"HEAD",..._?{signal:_.signal}:{}});if(!i||n!==s)return;if(!D.ok)throw new Error("Artifact poll failed");const b=D.headers.get("ETag");if(!b)throw new Error("Artifact poll missing ETag");l=u,o===null?o=b:b!==o&&(o=b,t.parent.postMessage({type:"proxy-content-changed"},"*"))}catch{i&&n===s&&(l=Math.min(L,l*2))}finally{r===_&&(r=null),i&&n===s&&(e=t.setTimeout(E,l))}})()};E()};t.addEventListener("pagehide",d),t.addEventListener("pageshow",n=>{n.persisted===!0&&p()}),p()}if(A.reportNavigation!==!1){const m=new Set(["about:","blob:","chrome-extension:","chrome:","data:","devtools:","file:","filesystem:","javascript:","view-source:"]),a=(o,l)=>{try{const s=new URL(o,l);return s.protocol==="http:"||s.protocol==="https:"||m.has(s.protocol)?null:s}catch{return null}},c=(o,l)=>{try{const s=new URL(o,l);return s.protocol==="http:"||s.protocol==="https:"?s:null}catch{return null}},g=o=>{var n;const l=o.type==="click"&&o.button===0,s=o.type==="auxclick"&&o.button===1;if(!l&&!s)return;const i=(n=t.document.defaultView)==null?void 0:n.Element;if(!i||!(o.target instanceof i))return;const e=o.target.closest("a[href]");if(!e)return;const r=a(e.href,t.document.baseURI);if(!r)return;const d=e.target.toLowerCase();!(s||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey||d!==""&&d!=="_self")&&!e.hasAttribute("download")||(o.preventDefault(),t.location.href=r.href)};t.document.addEventListener("click",g,!0),t.document.addEventListener("auxclick",g,!0);const u=o=>{t.parent.postMessage({type:"navigation-request",...o},"*")};u({url:t.location.href});const L=t.navigation;if(L&&L.currentEntry!==null)L.addEventListener("navigate",o=>{var p,n;const l=o,s=(p=l.destination)==null?void 0:p.url;if(typeof s!="string")return;const i=c(s,t.location.href);if(!i)return;const e=((n=l.destination)==null?void 0:n.sameDocument)===!0,r={url:s,...l.navigationType==="replace"?{replace:!0}:{},...e?{sameDocument:!0}:{}};if(e){u(r);return}if(i.origin===t.location.origin){u({...r,native:!0});return}l.canIntercept!==!1&&l.preventDefault(),u(r)});else{const o=(i,e)=>{let r=null;t.addEventListener(i,d=>{r&&t.removeEventListener(i,r);const p=n=>{n===d&&(t.removeEventListener(i,p),r=null,n.defaultPrevented||e(n))};r=p,t.addEventListener(i,p)},!0)};o("click",i=>{var E;const e=i;if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const r=(E=t.document.defaultView)==null?void 0:E.Element;if(!r||!(e.target instanceof r))return;const d=e.target.closest("a[href]");if(!d||d.target&&d.target.toLowerCase()!=="_self"||d.hasAttribute("download")||!d.getAttribute("href"))return;const n=c(d.href,t.document.baseURI);if(n){if(n.origin===t.location.origin&&n.pathname===t.location.pathname&&n.search===t.location.search&&n.hash!==""){u({url:n.href,sameDocument:!0});return}e.preventDefault(),u({url:n.href})}});const l=t.history.pushState.bind(t.history),s=t.history.replaceState.bind(t.history);t.history.pushState=function(...e){l(...e),u({url:t.location.href,sameDocument:!0})},t.history.replaceState=function(...e){s(...e),u({url:t.location.href,replace:!0,sameDocument:!0})},t.addEventListener("popstate",()=>{u({url:t.location.href,sameDocument:!0})}),t.addEventListener("hashchange",()=>{u({url:t.location.href,sameDocument:!0})}),o("submit",i=>{var U,I,C;const e=i,r=e.target,d=(U=t.document.defaultView)==null?void 0:U.HTMLFormElement;if(!d||!(r instanceof d))return;const p=e.submitter??null,n=N=>p!=null&&p.hasAttribute(N)?p.getAttribute(N)??"":null,E=n("formtarget")??r.getAttribute("target");if(E&&E.toLowerCase()!=="_self")return;const T=(I=n("formmethod")??r.getAttribute("method"))==null?void 0:I.toLowerCase();if(T==="post"||T==="dialog")return;const _=c((n("formaction")??r.getAttribute("action"))||t.location.href,t.document.baseURI);if(!_)return;const D=(C=t.document.defaultView)==null?void 0:C.FormData;if(!D)return;const b=new URLSearchParams;for(const[N,P]of new D(r,p))b.append(N,typeof P=="string"?P:P.name);_.search=b.toString(),e.preventDefault(),u({url:_.href})})}}y()}export{Y as A,G as U,J as a,Q as b,H as c,Z as d,z as e,w as f,V as g,v as h,$ as i,tt as j,j as k,K as l,W as m,k as n};
@@ -0,0 +1 @@
1
+ import{j as d,k as m,l as p}from"./artifact-bridge-DTPacxDw.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&&m(t.data)&&i(t.data)});var a;(a=window.__televisionContentBridge)==null||a.onHostMessage(t=>{m(t)&&i(t)});const c={type:p};window.parent.postMessage(c,"*");var g;(g=window.__televisionContentBridge)==null||g.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}}