PageSourceSearch

https://nulltx.com/_next/static/chunks/3170.e842f1e35531b510.js

js nulltx.com collected 2026-10-02 02:57:04 UTC 11,348 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3170],{3170:(e,t,i)=>{i.d(t,{createBtcPriceChartManager:()=>M});var n=i(3992),a=i(4269);let r=null,l=!1,c=null,o=0,u=new Set,s=1e3,m=null;function d(){if(r){try{r.dispose()}catch(e){}r=null}l=!1}function h(e){if(e instanceof Error)return e.message;if("string"==typeof e)return e;let t=String(e);return"[object Event]"===t||"[object Object]"===t?"Connection error":t||"Connection error"}async function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:300;if(!e)throw Error("Price API URL not configured");let i=await fetch("".concat(e.replace(/\/+$/,""),"/v1/btc/history?limit=").concat(t),{cache:"no-store"});if(!i.ok)throw Error("History fetch failed: ".concat(i.status));return i.json()}let f={r:156,g:163,b:175},g={r:220,g:38,b:38},v={r:185,g:28,b:28};function y(e,t,i){return{r:Math.round(e.r+(t.r-e.r)*i),g:Math.round(e.g+(t.g-e.g)*i),b:Math.round(e.b+(t.b-e.b)*i)}}function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return"rgba(".concat(e.r,", ").concat(e.g,", ").concat(e.b,", ").concat(t,")")}function M(e,t){e.classList.add("price-chart","price-chart--hero","price-chart--loading");let i=document.createElement("div");i.className="price-chart__loading",i.setAttribute("aria-hidden","true"),i.innerHTML='<span class="price-chart__loading-bar"></span>';let M=document.createElement("div");M.className="price-chart__header";let C=document.createElement("div");C.className="price-chart__info";let P=document.createElement("span");P.className="price-chart__label",P.textContent="BTC/USD";let x=document.createElement("span");x.className="price-chart__price";let _=document.createElement("span");_.className="price-chart__direction-icon price-chart__direction-icon--neutral",_.setAttribute("aria-hidden","true");let A=document.createElement("span");A.textContent="—";let b=document.createElement("span");b.className="price-chart__change",b.style.display="none",x.appendChild(A),x.appendChild(_),x.appendChild(b),C.appendChild(P),C.appendChild(x);let w=document.createElement("div");w.className="price-chart__status";let S=document.createElement("span");S.className="price-chart__dot";let E=document.createElement("span");E.className="price-chart__status-text",E.textContent="Connecting...",w.appendChild(S),w.appendChild(E),M.appendChild(C),M.appendChild(w),e.appendChild(M);let k=document.createElement("div");k.className="price-chart__canvas";let D=document.createElement("canvas");k.appendChild(D),e.appendChild(k),e.appendChild(i);let N=!1;function F(){!B&&(N||(N=!0,e.classList.remove("price-chart--loading"),i.remove()))}let R={prices:[],displayPrice:0,targetPrice:0,windowOpenPrice:null,connected:!1,lastTickDirection:0,animatingTail:null,pointQueue:[],tickBuffer:[],reloading:!1,lastHistoryRefreshAt:0,priceAnimFrom:0,priceAnimTo:0,priceAnimStartAt:0,yCenter:0},L=0,B=!1,H=!0,q=null,Q=!1,j=null,U=!1,I=!1,O=0,$=window.matchMedia("(prefers-reduced-motion: reduce)").matches;function W(){B||H||$||(cancelAnimationFrame(L),L=requestAnimationFrame(V))}function z(e){for(let t of function(e,t,i,n){let a=-1/0;t.length>0&&(a=Math.max(a,t[t.length-1].time)),i.length>0&&(a=Math.max(a,i[i.length-1].time)),n&&(a=Math.max(a,n.to.time));let r=new Set(t.map(e=>Math.round(e.time)));for(let e of(n&&r.add(Math.round(n.to.time)),i))r.add(Math.round(e.time));let l=[];for(let t of e){let e=Math.round(t.time);t.time>a&&!r.has(e)&&(r.add(e),l.push({time:t.time,value:t.value}))}return l.sort((e,t)=>e.time-t.time),l}(e,R.prices,R.pointQueue,R.animatingTail)){let e=R.animatingTail?R.animatingTail.to:R.prices.length>0?R.prices[R.prices.length-1]:null;R.animatingTail?R.pointQueue.push(t):e?R.animatingTail={from:e,to:t,startAt:Date.now()}:R.prices.push(t)}let t=Date.now()/1e3-360;R.prices=R.prices.filter(e=>e.time>=t),R.prices.sort((e,t)=>e.time-t.time)}function G(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=R.animatingTail?R.animatingTail.from.value:R.prices.length>0?R.prices[R.prices.length-1].value:R.targetPrice;if(i<=0)return;if(R.yCenter<=0||e){R.yCenter=i;return}let n=i-R.yCenter;if(.25>Math.abs(n)){R.yCenter=i;return}let a=Math.min(1,(O>0?Math.max(1,t-O):16.67)/500);R.yCenter+=n*a}function J(e){if(B)return;if(!I)return void R.tickBuffer.push(e);if(R.reloading)return void(e.resyncRequired?X(!0):R.tickBuffer.push(e));if(e.resyncRequired)return void X(!0);if(R.connected=e.connected,e.value<=0)return;z([{time:e.time,value:e.value}]);let t=R.targetPrice;R.targetPrice=e.value,t>0&&(R.lastTickDirection=e.value>t?1:e.value<t?-1:0),$&&!H&&V()}async function X(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(R.reloading){e&&(U=!0);return}try{e&&(o=0,R.prices=[],R.animatingTail=null,R.pointQueue=[]),R.reloading=!0;let l=await p(t);if(B)return;let c=null!=(i=l.prices)?i:[];var i,n,a,r=(n=l.connected,a=c.length>0,!1!==n&&(!0===n||a));0!==R.prices.length||R.animatingTail?z(c):R.prices=c.slice().sort((e,t)=>
1e.time-t.time),R.connected=r;let u=c.length>0?c[c.length-1]:null;if(u){let e=R.targetPrice;R.targetPrice=u.value,e>0&&(R.lastTickDirection=u.value>e?1:u.value<e?-1:0),R.displayPrice<=0&&(R.displayPrice=u.value,R.priceAnimFrom=u.value,R.priceAnimTo=u.value,R.priceAnimStartAt=Date.now()),G(!0),F()}else F();R.lastHistoryRefreshAt=Date.now()/1e3,I=!0}catch(e){B||(R.connected=!1),I=!0,F()}finally{if(B)return;R.reloading=!1;let e=R.tickBuffer;for(let t of(R.tickBuffer=[],e))J(t);if(K(),$&&!H?V():W(),U)return U=!1,X(!0)}}function K(){let e=R.displayPrice;A.textContent=e>0?"$".concat(e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})):"—";let t=R.lastTickDirection;_.textContent=1===t?"▲":-1===t?"▼":"−",_.className="price-chart__direction-icon "+(1===t?"price-chart__direction-icon--up":-1===t?"price-chart__direction-icon--down":"price-chart__direction-icon--neutral"),S.className="price-chart__dot"+(R.connected?" price-chart__dot--live":""),E.textContent=R.connected?"Live":"Connecting..."}function V(){var e,t,i;if(H||B)return;L=0;let n=D.getContext("2d");if(!n)return void W();let a=window.devicePixelRatio||1,r=k.clientWidth,l=k.clientHeight;if(r<=0||l<=0)return void W();let c=Math.round(r*a),o=Math.round(l*a);D.width!==c&&(D.width=c),D.height!==o&&(D.height=o),D.style.width="".concat(r,"px"),D.style.height="".concat(l,"px"),n.setTransform(a,0,0,a,0,0),n.clearRect(0,0,r,l);let u=Date.now();if(R.animatingTail&&u-R.animatingTail.startAt>=1e3)if(R.prices.push(R.animatingTail.to),R.pointQueue.length>0){let e=R.pointQueue.shift();R.animatingTail={from:R.animatingTail.to,to:e,startAt:u}}else R.animatingTail=null;let s=Date.now()/1e3;if(!H&&s-R.lastHistoryRefreshAt>=15&&R.prices.length>0&&!R.reloading&&X(!1),R.animatingTail){let e=Math.min(1,(u-R.animatingTail.startAt)/1e3),t=R.animatingTail.from,i=R.animatingTail.to;R.displayPrice=t.value+(i.value-t.value)*e}else if(R.targetPrice!==R.priceAnimTo&&(R.priceAnimFrom=R.displayPrice>0?R.displayPrice:R.targetPrice,R.priceAnimTo=R.targetPrice,R.priceAnimStartAt=u),R.priceAnimStartAt){let e=Math.min(1,(u-R.priceAnimStartAt)/1e3);R.displayPrice=R.priceAnimFrom+(R.priceAnimTo-R.priceAnimFrom)*e}else R.displayPrice=R.targetPrice,R.priceAnimFrom=R.targetPrice,R.priceAnimTo=R.targetPrice,R.priceAnimStartAt=u;let m=Date.now()/1e3-1,d=m-180,h=[],p=null;for(let e=0;e<R.prices.length;e++)R.prices[e].time>=d?h.push(R.prices[e]):p=R.prices[e].value;R.windowOpenPrice=h.length>0?h[0].value:p;let M=1/0,C=-1/0;for(let e of h)M=Math.min(M,e.value),C=Math.max(C,e.value);R.displayPrice>0&&(M=Math.min(M,R.displayPrice),C=Math.max(C,R.displayPrice)),R.animatingTail&&(M=Math.min(M,R.animatingTail.to.value),C=Math.max(C,R.animatingTail.to.value)),G(!1,u),O=u;let P=R.yCenter>0?R.yCenter:R.targetPrice;(!Number.isFinite(P)||P<=0)&&(P=R.displayPrice>0?R.displayPrice:(M+C)/2||50),M=P-50;let x=Math.max((C=P+50)-M,1),_=(e=R.displayPrice,t=R.windowOpenPrice,i=x,null===t||t<=0?0:Math.min(1,Math.max(-1,(e-t)/Math.max(.35*i,10)))),A=_>=0?y(f,g,_):y(f,v,Math.abs(_)),b=Math.max(120,r-56),w=l-10-24,S=e=>(e-d)/(m-d)*b,E=b/Math.max(1,m-d),N=m+Math.max(0,(r-b)/Math.max(E,1e-6)),q=e=>10+(1-(e-M)/(C-M))*w;n.fillStyle=_>=0?T(g,.02+.015*Math.abs(_)):T(v,.02+.015*Math.abs(_)),n.fillRect(0,10,r,w);let Q=n.createLinearGradient(0,10,r,10);Q.addColorStop(0,T(A,.008)),Q.addColorStop(.45,T(A,.012)),Q.addColorStop(.72,T(A,.018)),Q.addColorStop(1,T(A,.024)),n.fillStyle=Q,n.fillRect(0,10,r,w),n.strokeStyle="rgba(107, 114, 128, 0.12)",n.lineWidth=1,n.fillStyle="rgba(107, 114, 128, 0.55)",n.font="10px ui-monospace, SFMono-Regular, Menlo, monospace",n.textAlign="left";for(let e=0;e<=5;e++){let t=M+(C-M)*e/5,i=Math.round(q(t))+.5;n.beginPath(),n.moveTo(0,i),n.lineTo(r,i),n.stroke(),n.fillText(t.toFixed(0),b+6,i+3.5)}n.textAlign="center";let j=60*Math.ceil(d/60);for(let e=j;e<=N;e+=60){let t=S(e);if(t<-1||t>r+1)continue;let i=new Date(1e3*e);n.fillText("".concat(i.getHours().toString().padStart(2,"0"),":").concat(i.getMinutes().toString().padStart(2,"0")),t,l-4)}let U=[],I=h.length>0?h[0].time:1/0;for(let e of(null!==p&&I>d+2&&U.push({x:0,y:q(p)}),h))U.push({x:S(e.time),y:q(e.value)});if(R.animatingTail){let e=Math.min(1,(u-R.animatingTail.startAt)/1e3),t=R.animatingTail.from,i=R.animatingTail.to,n=t.t
1ime+(i.time-t.time)*e,a=t.value+(i.value-t.value)*e,r=S(n),l=U.length>0?U[U.length-1].x:-1;r>=0&&r<=b+1&&r>=l-1&&U.push({x:Math.min(b,r),y:q(a)})}if(U.length>=2){F();let e=10+w,t=n.createLinearGradient(0,10,0,e);t.addColorStop(0,T(A,.22)),t.addColorStop(1,T(A,.01)),n.beginPath(),n.moveTo(U[0].x,U[0].y);for(let e=1;e<U.length;e++)n.lineTo(U[e].x,U[e].y);n.lineTo(U[U.length-1].x,e),n.lineTo(U[0].x,e),n.closePath(),n.fillStyle=t,n.fill(),n.beginPath(),n.moveTo(U[0].x,U[0].y);for(let e=1;e<U.length;e++)n.lineTo(U[e].x,U[e].y);n.strokeStyle=T(A,.97),n.lineWidth=2,n.lineJoin="round",n.stroke();let i=U[U.length-1];n.beginPath(),n.arc(i.x,i.y,6,0,2*Math.PI),n.fillStyle=T(A,.24),n.fill(),n.beginPath(),n.arc(i.x,i.y,3,0,2*Math.PI),n.fillStyle=T(A,1),n.fill()}K(),W()}function Y(){B||H||(H=!0,q=Date.now(),cancelAnimationFrame(L),L=0,j&&(j(),j=null))}return{pause:Y,resume:function(){if(B||!H)return;H=!1;let e=null!==q&&Date.now()-q>=5e3;q=null,j||(j=function(e){if(u.add(e),function e(){if(l)return;let t=(0,a.X)();if(!t)return;l=!0;let i=(r=(0,n.UU)({url:t})).iterate({query:"\n  subscription BtcPrice($fromCursor: Int) {\n    btcPrice(fromCursor: $fromCursor) {\n      cursor\n      time\n      value\n      connected\n      resyncRequired\n    }\n  }\n",variables:{fromCursor:o>0?o:void 0}});(async()=>{try{for await(let e of i){var t,n;if(null==(t=e.errors)?void 0:t.length){e.errors.map(e=>h(e)).join("; ");continue}let i=null==(n=e.data)?void 0:n.btcPrice;if(i)for(let e of(s=1e3,i.resyncRequired?o=0:i.cursor>
10&&(o=i.cursor),c=i,u))try{e(i)}catch(e){}}}catch(e){h(e)}finally{d(),u.size>0&&function(){if(null!=m)return;let t=.2*s*(Math.random()-.5);m=setTimeout(()=>{m=null,s=Math.min(3e4,2*s),e()},Math.min(3e4,Math.max(1e3,Math.floor(s+t))))}()}})()}(),c)try{e(c)}catch(e){}return()=>{u.delete(e),0===u.size&&(null!=m&&(clearTimeout(m),m=null),d())}}(e=>{J(e)})),Q?e?X(!0):$?V():W():(Q=!0,X(!1))},destroy(){B||(Y(),B=!0,cancelAnimationFrame(L),L=0,e.classList.remove("price-chart","price-chart--hero"),e.innerHTML="")}}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.