PageSourceSearch

https://khachhang.superai.vn/assets/html-to-image-393f3531.js

js superai.vn collected 2026-09-24 15:15:26 UTC 13,029 bytes, 2 lines download raw bytes

1function j(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}const q=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function m(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let g=null;function A(t={}){return g||(t.includeStyleProperties?(g=t.includeStyleProperties,g):(g=m(window.getComputedStyle(document.documentElement)),g))}function y(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function z(t){const e=y(t,"border-left-width"),n=y(t,"border-right-width");return t.clientWidth+e+n}function B(t){const e=y(t,"border-top-width"),n=y(t,"border-bottom-width");return t.clientHeight+e+n}function k(t,e={}){const n=e.width||z(t),r=e.height||B(t);return{width:n,height:r}}function G(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const u=16384;function X(t){(t.width>u||t.height>u)&&(t.width>u&&t.height>u?t.width>t.height?(t.height*=u/t.width,t.width=u):(t.width*=u/t.height,t.height=u):t.width>u?(t.height*=u/t.width,t.width=u):(t.width*=u/t.height,t.height=u))}function w(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}async function K(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function J(t,e,n){const r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),s=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${e} ${n}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),i.appendChild(s),s.appendChild(t),K(i)}const l=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||l(n,e)};function Q(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Y(t,e){return A(e).map(n=>{const r=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function Z(t,e,n,r){const i=`.${t}:${e}`,s=n.cssText?Q(n):Y(n,r);return document.createTextNode(`${i}{${s}}`)}function C(t,e,n,r){const i=window.getComputedStyle(t,n),s=i.getPropertyValue("content");if(s===""||s==="none")return;const c=q();try{e.className=`${e.className} ${c}`}catch{return}const a=document.createElement("style");a.appendChild(Z(c,n,i,r)),e.appendChild(a)}function N(t,e,n){C(t,e,":before",n),C(t,e,":after",n)}const P="application/font-woff",$="image/jpeg",tt={woff:P,woff2:P,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:$,jpeg:$,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function et(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function x(t){const e=et(t).toLowerCase();return tt[e]||""}function nt(t){return t.split(/,/)[1]}function E(t){return t.search(/^(data:)/)!==-1}function D(t,e){return`data:${e};base64,${t}`}async function v(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const i=await r.blob();return new Promise((s,c)=>{const a=new FileReader;a.onerror=c,a.onloadend=()=>{try{s(n({res:r,result:a.result}))}catch(o){c(o)}},a.readAsDataURL(i)})}const b={};function rt(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}async function R(t,e,n){const r=rt(t,e,n.includeQueryParams);if(b[r]!=null)return b[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const s=await v(t,n.fetchRequestInit,({res:c,result:a})=>(e||(e=c.headers.get("Content-Type")||""),nt(a)));i=D(s,e)}catch(s){i=n.imagePlaceholder||"";let c=`Failed to fetch resource: ${t}`;s&&(c=typeof s=="string"?s:s.message),c&&console.warn(c)}return b[r]=i,i}async function st(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):w(e)}async function it(t,e){if(t.currentSrc){const s=document.createElement("canvas"),c=s.getContext("2d");s.width=t.clientWidth,s.height=t.clientHeight,c==null||c.drawImage(t,0,0,s.width,s.height);const a=s.toDataURL();return w(a)}const n=t.poster,r=x(n),i=await R(n,r,e);return w(i)}async function ct(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await p(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function at(t,e){return l(t,HTMLCanvasElement)?st(t):l(t,HTMLVideoElement)?it(t,e):l(t,HTMLIFrameElement)?ct(t,e):t.cloneNode(H(t))}const ot=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",H=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function lt(t,e,n){var r,i;if(H(e))return e;let s=[];return ot(t)&&t.assignedNodes?s=m(t.assignedNodes()):l(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?s=m(t.contentDocument.body.childNodes):s=m(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),s.length===0||l(t,HTMLVideoElement)||await s.reduce((c,a)=>c.then(()=>p(a,n)).then(o=>
1{o&&e.appendChild(o)}),Promise.resolve()),e}function ut(t,e,n){const r=e.style;if(!r)return;const i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):A(n).forEach(s=>{let c=i.getPropertyValue(s);s==="font-size"&&c.endsWith("px")&&(c=`${Math.floor(parseFloat(c.substring(0,c.length-2)))-.1}px`),l(t,HTMLIFrameElement)&&s==="display"&&c==="inline"&&(c="block"),s==="d"&&e.getAttribute("d")&&(c=`path(${e.getAttribute("d")})`),r.setProperty(s,c,i.getPropertyPriority(s))})}function ft(t,e){l(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),l(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function ht(t,e){if(l(t,HTMLSelectElement)){const n=e,r=Array.from(n.children).find(i=>t.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function mt(t,e,n){return l(e,Element)&&(ut(t,e,n),N(t,e,n),ft(t,e),ht(t,e)),e}async function gt(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let s=0;s<n.length;s++){const a=n[s].getAttribute("xlink:href");if(a){const o=t.querySelector(a),f=document.querySelector(a);
1!o&&f&&!r[a]&&(r[a]=await p(f,e,!0))}}const i=Object.values(r);if(i.length){const s="http://www.w3.org/1999/xhtml",c=document.createElementNS(s,"svg");c.setAttribute("xmlns",s),c.style.position="absolute",c.style.width="0",c.style.height="0",c.style.overflow="hidden",c.style.display="none";const a=document.createElementNS(s,"defs");c.appendChild(a);for(let o=0;o<i.length;o++)a.appendChild(i[o]);t.appendChild(c)}return t}async function p(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>at(r,e)).then(r=>lt(t,r,e)).then(r=>mt(t,r,e)).then(r=>gt(r,e))}const U=/url\((['"]?)([^'"]+?)\1\)/g,dt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,yt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function wt(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function pt(t){const e=[];return t.replace(U,(n,r,i)=>(e.push(i),n)),e.filter(n=>!E(n))}async function St(t,e,n,r,i){try{const s=n?j(e,n):e,c=x(e);let a;if(i){const o=await i(s);a=D(o,c)}else a=await R(s,c,r);return t.replace(wt(e),`$1${a}$3`)}catch{}return t}function bt(t,{preferredFontFormat:e}){return e?t.replace(yt,n=>{for(;;){const[r,,i]=dt.exec(n)||[];if(!i)return"";if(i===e)return`src: ${r};`}}):t}function V(t){return t.search(U)!==-1}async function M(t,e,n){if(!V(t))return t;const r=bt(t,n);return pt(r).reduce((s,c)=>s.then(a=>St(a,c,e,n)),Promise.resolve(r))}async function d(t,e,n){var r;const i=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(i){const s=await M(i,null,n);return e.style.setProperty(t,s,e.style.getPropertyPriority(t)),!0}return!1}async function Et(t,e){await d("background",t,e)||await d("background-image",t,e),await d("mask",t,e)||await d("-webkit-mask",t,e)||await d("mask-image",t,e)||await d("-webkit-mask-image",t,e)}async function xt(t,e){const n=l(t,HTMLImageElement);if(!(n&&!E(t.src))&&!(l(t,SVGImageElement)&&!E(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,i=await R(r,x(r),e);await new Promise((s,c)=>{t.onload=s,t.onerror=e.onImageErrorHandler?(...o)=>{try{s(e.onImageErrorHandler(...o))}catch(f){c(f)}}:c;const a=t;a.decode&&(a.decode=s),a.loading==="lazy"&&(a.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function Rt(t,e){const r=m(t.childNodes).map(i=>O(i,e));await Promise.all(r).then(()=>t)}async function O(t,e){l(t,Element)&&(await Et(t,e),await xt(t,e),await Rt(t,e))}function Ct(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;return r!=null&&Object.keys(r).forEach(i=>{n[i]=r[i]}),t}const T={};async function L(t){let e=T[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},T[t]=e,e}async function F(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,s=(n.match(/url\([^)]+\)/g)||[]).map(async c=>{let a=c.replace(r,"$1");return a.startsWith("https://")||(a=new URL(a,t.url).href),v(a,e.fetchRequestInit,({result:o})=>(n=n.replace(c,`url(${o})`),[c,o]))});return Promise.all(s).then(()=>n)}function I(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)}
1)","gi");for(;;){const o=i.exec(r);if(o===null)break;e.push(o[0])}r=r.replace(i,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,c="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(c,"gi");for(;;){let o=s.exec(r);if(o===null){if(o=a.exec(r),o===null)break;s.lastIndex=a.lastIndex}else a.lastIndex=s.lastIndex;e.push(o[0])}return e}async function Pt(t,e){const n=[],r=[];return t.forEach(i=>{if("cssRules"in i)try{m(i.cssRules||[]).forEach((s,c)=>{if(s.type===CSSRule.IMPORT_RULE){let a=c+1;const o=s.href,f=L(o).then(h=>F(h,e)).then(h=>I(h).forEach(S=>{try{i.insertRule(S,S.startsWith("@import")?a+=1:i.cssRules.length)}catch(W){console.error("Error inserting rule from remote css",{rule:S,error:W})}})).catch(h=>{console.error("Error loading remote css",h.toString())});r.push(f)}})}catch(s){const c=t.find(a=>a.href==null)||document.styleSheets[0];i.href!=null&&r.push(L(i.href).then(a=>F(a,e)).then(a=>I(a).forEach(o=>{c.insertRule(o,c.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",s)}}),Promise.all(r).then(()=>(t.forEach(i=>{if("cssRules"in i)try{m(i.cssRules||[]).forEach(s=>{n.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${i.href}`,s)}}),n))}function $t(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>V(e.style.getPropertyValue("src")))}async function Tt(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=m(t.ownerDocument.styleSheets),r=await Pt(n,e);return $t(r)}function _(t){return t.trim().replace(/["']/g,"")}function Lt(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(s=>{e.add(_(s))}),Array.from(r.children).forEach(s=>{s instanceof HTMLElement&&n(s)})}return n(t),e}async function Ft(t,e){const n=await Tt(t,e),r=Lt(t);return(await Promise.all(n.filter(s=>r.has(_(s.style.fontFamily))).map(s=>{const c=s.parentStyleSheet?s.parentStyleSheet.href:null;return M(s.cssText,c,e)}))).join(`
2`)}async function It(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await Ft(t,e);if(n){const r=document.createElement("style"),i=document.createTextNode(n);r.appendChild(i),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function At(t,e={}){const{width:n,height:r}=k(t,e),i=await p(t,e,!0);return await It(i,e),await O(i,e),Ct(i,e),await J(i,n,r)}async function kt(t,e={}){const{width:n,height:r}=k(t,e),i=await At(t,e),s=await w(i),c=document.createElement("canvas"),a=c.getContext("2d"),o=e.pixelRatio||G(),f=e.canvasWidth||n,h=e.canvasHeight||r;return c.width=f*o,c.height=h*o,e.skipAutoScale||X(c),c.style.width=`${f}`,c.style.height=`${h}`,e.backgroundColor&&(a.fillStyle=e.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(s,0,0,c.width,c.height),c}async function Dt(t,e={}){return(await kt(t,e)).toDataURL()}export{Dt as t};

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.