MCPcopy Create free account
hub / github.com/Yorick-Ryu/deep-share / Re

Function Re

lib/snapdom.min.js:7–7  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

5* License: MIT
6*/
7var co=Object.defineProperty;var D=(t,e)=>()=>(t&&(e=t(t=0)),e);var kt=(t,e)=>{for(var n in e)co(t,n,{get:e[n],enumerable:!0})};function _t(t="soft"){switch(S.session.__counterEpoch=(S.session.__counterEpoch||0)+1,t){case"auto":{S.session.styleMap=new Map,S.session.nodeMap=new Map;return}case"soft":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap,S.computedStyle=new WeakMap,S.baseStyle=new Map,S.defaultStyle=new Map,S.image=new Map,S.background=new Map,S.resource=new Map,S.font=new Set;return}default:{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}}}var S,H=D(()=>{S={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function it(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function se(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==6?`matrix(${o})`:(s[4]="0",s[5]="0",`matrix(${s.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==16?`matrix3d(${o})`:(s[12]="0",s[13]="0",`matrix3d(${s.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function J(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}var At=D(()=>{});function lo(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,s=0;function r(i,l,c){if(s>=n)return;let a=Date.now();(o.get(l)||0)>a||(o.set(l,a+e),s++,i==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(i,l){r("warn",i,l)},errorOnce(i,l){r("error",i,l)},reset(){o.clear(),s=0}}}function uo(t){return/^data:|^blob:|^about:blank$/i.test(t)}function fo(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,s=new URL(o||".",n),r=new URL(t,n);if(r.origin===s.origin)return!0;let i=r.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}function mo(t,e){if(!e||uo(t)||fo(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location<"u"?o.origin!==location.origin:!0}catch{return!!e}}function po(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",J(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${J(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function Re(t){return new Promise((e,n)=>{let o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}function ho(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function P(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,s=e.useProxy||"",r=e.errorTTL??8e3,i=e.headers||{},l=!!e.silent;if(/^data:/i.test(t))try{if(n==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,d="",g=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(d)?atob(g):decodeURIComponent(g),w=new Uint8Array([...x].map(C=>C.charCodeAt(0))),k=new Blob([w],{type:(d||"").split(";")[0]||""});return{ok:!0,data:k,status:200,url:t,fromCache:!1,mime:k.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let d=await fetch(t);if(!d.ok)return{ok:!1,data:null,status:d.status,url:t,fromCache:!1,reason:"http_error"};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await g.text(),status:d.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:t,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=ho(t,{as:n,timeout:o,useProxy:s,errorTTL:r}),a=Wt.get(c);if(a&&a.until>Date.now())return{...a.result,fromCache:!0};a&&Wt.delete(c);let u=ie.get(c);if(u)return u;let m=mo(t,s)?po(t,s):t,p=e.credentials;if(!p)try{let d=typeof location<"u"&&location.href?location.href:"http://localhost/",g=new URL(t,d);p=typeof location<"u"&&g.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,y=setTimeout(()=>h.abort("timeout"),o),f=(async()=>{try{let d=await fetch(m,{signal:h.signal,credentials:p,headers:i});if(!d.ok){let x={ok:!1,data:null,status:d.status,url:m,fromCache:!1,reason:"http_error"};if(r>0&&Wt.set(c,{until:Date.now()+r,result:x}),!l){let w=`${d.status} ${d.statusText||""}`.trim();Ne.warnOnce(`http:${d.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${t}`)}return e.onError&&e.onError(x),x}if(n==="text")return{ok:!0,data:await d.text(),status:d.status,url:m,fromCache:!1};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:m,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:m,fromCache:!1,mime:b}}catch(d){let g=d&&typeof d=="object"&&"name"in d&&d.name==="AbortError"?String(d.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:m,fromCache:!1,reason:g};if(!/^blob:/i.test(t)&&r>0&&Wt.set(c,{until:Date.now()+r,result:b}),!l){let x=`${g}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,w=g==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:g==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Ne.errorOnce(x,w)}return e.onError&&e.onError(b),b}finally{clearTimeout(y),ie.delete(c)}})();return ie.set(c,f),f}var Ne,ie,Wt,at=D(()=>{At();Ne=lo("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ie=new Map,Wt=new Map});async function ct(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=it(t);if(!o)return t;let s=J(o);if(S.background.has(s)){let r=S.background.get(s);return r?`url("${r}")`:"none"}try{let r=await P(s,{as:"dataURL",useProxy:e.useProxy});return r.ok?(S.background.set(s,r.data),`url("${r.data}")`):(S.background.set(s,null),"none")}catch{return S.background.set(s,null),"none"}}var Te=D(()=>{H();At();at()});function ae(){for(let t of go){let e=String(t).toLowerCase();Ot.has(e)||gt.has(e)||ce(e)}}function ce(t){if(t=String(t).toLowerCase(),gt.has(t)){let r={};return S.defaultStyle.set(t,r),r}if(S.defaultStyle.has(t))return S.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let o=getComputedStyle(n),s={};for(let r of o){if(Pe(r))continue;let i=o.getPropertyValue(r);s[r]=i}return e.removeChild(n),S.defaultStyle.set(t,s),s}function Pe(t){let e=String(t).toLowerCase();return!!(bo.has(e)||wo.test(e)||yo.test(e))}function yt(t,e){if(e=String(e||"").toLowerCase(),gt.has(e))return"";let n=[],o=ce(e);for(let[s,r]of Object.entries(t)){if(Pe(s))continue;let i=o[s];r&&r!==i&&n.push(`${s}:${r}`)}return n.sort(),n.join(";")}function le(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(n=>e.add(n.tagName.toLowerCase())),Array.from(e))}function ue(t){let e=new Map;for(let o of t){let s=S.defaultStyle.get(o);if(!s)continue;let r=Object.entries(s).map(([i,l])=>`${i}:${l};`).sort().join("");r&&(e.has(r)||e.set(r,[]),e.get(r).push(o))}let n="";for(let[o,s]of e.entries())n+=`${s.join(",")} { ${o} }
8`;return n}function fe(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let s of e)n.set(s,`c${o++}`);return n}function lt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=S.computedStyle.get(t);if(n||(n=new Map,S.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Ut(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function vt(t){let e=[],n=0,o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&n++,r===")"&&n--,r===","&&n===0&&(e.push(t.slice(o,s).trim()),o=s+1)}return e.push(t.slice(o).trim()),e}var Ot,gt,go,yo,wo,bo,de=D(()=>{H();Ot=new Set(["meta","script","noscript","title","link","template"]),gt=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),go=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"];yo=/(?:^|-)(animation|transition)(?:-|$)/i,wo=/^(--|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,bo=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"])});function X(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function O(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),o=/applewebkit/i.test(t),s=/mobile/i.test(t),r=!/safari/i.test(t),i=o&&s&&r,l=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),a=/ipad|iphone|ipod/.test(e)&&o;return n||i||l||c||a}var Bt=D(()=>{});var Y=D(()=>{Te();de();Bt();At()});var ve={};kt(ve,{toCanvas:()=>ut});function $r(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Ir(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Lr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&o++,r===")"&&(o=Math.max(0,o-1)),r===";"&&o===0?(e.push(n),n=""):n+=r}return n.trim()&&e.push(n),e.map(s=>s.trim()).filter(Boolean)}function Rr(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&o++,i===")"&&(o=Math.max(0,o-1)),i===","&&o===0?(e.push(n.trim()),n=""):n+=i}n.trim()&&e.push(n.trim());let s=[];for(let r of e){if(/\binset\b/i.test(r))continue;let i=r.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",c="0px",a="0px"]=i,u=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),m=!!u&&u!==",";s.push(`drop-shadow(${l} ${c} ${a}${m?` ${u}`:""})`)}return s.join(" ")}function Gn(t){let e=Nr(t),n=null,o=null,s=null,r=[];for(let l of e){let c=l.indexOf(":");if(c<0)continue;let a=l.slice(0,c).trim().toLowerCase(),u=l.slice(c+1).trim();a==="box-shadow"?s=u:a==="filter"?n=u:a==="-webkit-filter"?o=u:r.push([a,u])}if(s){let l=Rr(s);l&&(n=n?`${n} ${l}`:l,o=o?`${o} ${l}`:l)}let i=[...r];return n&&i.push(["filter",n]),o&&i.push(["-webkit-filter",o]),i.map(([l,c])=>`${l}:${c}`).join(";")}function Tr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Gn(o)}}`)}function Pr(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Tr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Gn(o)}${n}`),t}function _r(t){if(!O()||!$r(t))return t;try{let e=Ir(t),n=Pr(e);return Lr(n)}catch{return t}}async function ut(t,e){let{width:n,height:o,scale:s=1,dpr:r=1,meta:i={},backgroundColor:l}=e;t=_r(t);let c=new Image;c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=t,await c.decode();let a=c.naturalWidth,u=c.naturalHeight,m=Number.isFinite(i.w0)?i.w0:a,p=Number.isFinite(i.h0)?i.h0:u,h,y,f=Number.isFinite(n),d=Number.isFinite(o);if(f&&d)h=Math.max(1,n),y=Math.max(1,o);else if(f){let x=n/Math.max(1,m);h=n,y=p*x}else if(d){let x=o/Math.max(1,p);y=o,h=m*x}else h=a,y=u;h=h*s,y=y*s;let g=document.createElement("canvas");g.width=h*r,g.height=y*r,g.style.width=`${h}px`,g.style.height=`${y}px`;let b=g.getContext("2d");return r!==1&&b.scale(r,r),l&&(b.save(),b.fillStyle=l,b.fillRect(0,0,h,y),b.restore()),b.drawImage(c,0,0,h,y),g}var St=D(()=>{Bt()});var tt={};kt(tt,{rasterize:()=>Me});async function Me(t,e){let n=await ut(t,e),o=new Image;return o.src=n.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${n.width/e.dpr}px`,o.style.height=`${n.height/e.dpr}px`,o}var K=D(()=>{St()});var Lt={};kt(Lt,{toImg:()=>Wr,toSvg:()=>Wr});async function Wr(t,e){let{scale:n=1,width:o,height:s,meta:r={}}=e,i=Number.isFinite(o),l=Number.isFinite(s),c=Number.isFinite(n)&&n!==1||i||l;if(O()&&c)return await Me(t,{...e,format:"png",quality:1,meta:r});let a=new Image;if(a.decoding="sync",a.loading="eager",a.src=t,await a.decode(),i&&l)a.style.width=`${o}px`,a.style.height=`${s}px`;else if(i){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=o/Math.max(1,u);a.style.width=`${o}px`,a.style.height=`${Math.round(m*p)}px`}else if(l){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=s/Math.max(1,m);a.style.height=`${s}px`,a.style.width=`${Math.round(u*p)}px`}else{let u=Math.round(a.naturalWidth*n),m=Math.round(a.naturalHeight*n);if(a.style.width=`${u}px`,a.style.height=`${m}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${m}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,a.src=t}catch{}}return a}var Nt=D(()=>{Y();K()});var Fe={};kt(Fe,{toBlob:()=>Ee});async function Ee(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let o=await ut(t,e);return new Promise(s=>o.toBlob(r=>s(r),`image/${n}`,e.quality))}var Jt=D(()=>{St()});var Qn={};kt(Qn,{download:()=>Or});async function Or(t,e){let n=(e?.format||e?.type||"").toLowerCase(),o=n==="jpg"?"jpeg":n||"png",s=e?.filename||`snapdom.${o}`,r={...e||{},format:o,type:o};if(r.dpr=1,o==="svg"){let c=await Ee(t,{...r,type:"svg"}),a=URL.createObjectURL(c),u=document.createElement("a");u.href=a,u.download=s,u.click(),URL.revokeObjectURL(a);return}let i=await ut(t,r),l=document.createElement("a");l.href=i.toDataURL(`image/${o}`,e?.quality),l.download=s,l.click()}var Jn=D(()=>{Jt();St()});Y();Y();H();var _e=new WeakMap,me=new Map,pe=0;function Mt(){pe++}var We=!1;function xo(t=document.documentElement){if(!We){We=!0;try{new MutationObserver(()=>Mt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Mt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Mt),e.ready?.then(()=>Mt()).catch(()=>{}))}catch{}}}function So(t,e={}){let n={},o=t.getPropertyValue("visibility");for(let r=0;r<t.length;r++){let i=t[r],l=t.getPropertyValue(i);(i==="background-image"||i==="content")&&l.includes("url(")&&!l.includes("data:")&&(l="none"),n[i]=l}let s=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let r of s)if(!n[r])try{let i=t.getPropertyValue(r);i&&(n[r]=i)}catch{}if(e.embedFonts){let r=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let i of r)if(!n[i])try{let l=t.getPropertyValue(i);l&&(n[i]=l)}catch{}}return o==="hidden"&&(n.opacity="0"),n}var Oe=new WeakMap;function Co(t){let e=Oe.get(t);return e||(e=Object.entries(t).sort((o,s)=>o[0]<s[0]?-1:o[0]>s[0]?1:0).map(([o,s])=>`${o}:${s}`).join(";"),Oe.set(t,e),e)}function ko(t,e=null,n={}){let o=_e.get(t);if(o&&o.epoch===pe)return o.snapshot;let s=e||getComputedStyle(t),r=So(s,n);return $o(t,s,r),_e.set(t,{epoch:pe,snapshot:r}),r}function Ao(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:me,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:e||{}}:{session:S.session,persist:{snapshotKeyCache:me,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:t||e||{}}}async function Z(t,e,n,o){if(t.tagName==="STYLE")return;let s=Ao(n,o),r=s.options&&s.options.cache||"auto";if(r!=="disabled"&&xo(document.documentElement),r==="disabled"&&!s.session.__bumpedForDisabled&&(Mt(),me.clear(),s.session.__bumpedForDisabled=!0),gt.has(t.tagName?.toLowerCase())){let p=t.getAttribute?.("style");p&&e.setAttribute("style",p)}let{session:i,persist:l}=s;i.styleCache.has(t)||i.styleCache.set(t,getComputedStyle(t));let c=i.styleCache.get(t),a=ko(t,c,s.options),u=Co(a),m=l.snapshotKeyCache.get(u);if(!m){let p=t.tagName?.toLowerCase()||"div";m=yt(a,p),l.snapshotKeyCache.set(u,m)}i.styleMap.set(e,m)}function vo(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Mo(t){return t.backgroundImage&&t.backgroundImage!=="none"||t.backgroundColor&&t.backgroundColor!=="rgba(0, 0, 0, 0)"&&t.backgroundColor!=="transparent"||(parseFloat(t.borderTopWidth)||0)>0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function Eo(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Fo(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let s=t.scrollHeight;if(s===0)return!1;let r=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return s>r+i}function $o(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||o!=="div"&&o!=="section"&&o!=="article"&&o!=="main"&&o!=="aside"&&o!=="header"&&o!=="footer"&&o!=="nav"&&o!=="ol"&&o!=="ul"&&o!=="li")return;let s=e.display||"";if(s.includes("flex")||s.includes("grid")||vo(t))return;let r=e.position;if(r==="absolute"||r==="fixed"||r==="sticky"||e.transform!=="none"||Mo(e)||Eo(t))return;let i=e.overflowX||e.overflow||"visible",l=e.overflowY||e.overflow||"visible";if(i!=="visible"||l!=="visible")return;let c=e.clip;c&&c!=="auto"&&c!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Fo(t,e)&&(delete n.height,delete n["block-size"])}de();var Be=["fill","stroke","color","background-color","stop-color"],Ue=new Map;function Io(t,e){let n=e+"::"+t.toLowerCase(),o=Ue.get(n);if(o)return o;let s=document,r=e==="http://www.w3.org/2000/svg"?s.createElementNS(e,t):s.createElement(t),i=s.createElement("div");i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(r),s.documentElement.appendChild(i);let l=getComputedStyle(r),c={};for(let a of Be)c[a]=l.getPropertyValue(a)||"";return i.remove(),Ue.set(n,c),c}function De(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(l&&typeof l.value=="string"&&l.value.includes("var(")){o=!0;break}}}let s=null;if(o)try{s=getComputedStyle(t)}catch{}if(o){let r=t.style;if(r&&r.length)for(let i=0;i<r.length;i++){let l=r[i],c=r.getPropertyValue(l);if(!c||!c.includes("var("))continue;let a=s&&s.getPropertyValue(l);if(a)try{e.style.setProperty(l,a.trim(),r.getPropertyPriority(l))}catch{}}}if(o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let c=l.name,a=s&&s.getPropertyValue(c);if(a)try{e.style.setProperty(c,a.trim())}catch{}}}if(!o){if(!s)try{s=getComputedStyle(t)}catch{s=null}if(!s)return;let r=t.namespaceURI||"html",i=Io(t.tagName,r);for(let l of Be){let c=s.getPropertyValue(l)||"",a=i[l]||"";if(c&&c!==a)try{e.style.setProperty(l,c.trim())}catch{}}}}Y();H();at();function Ht(t,e,n){return Promise.all(t.map(o=>new Promise(s=>{function r(){X(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,s):r()},{fast:n})}r()})))}function Lo(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function No(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let s=n?Lo(o):o;return`:where(${e} ${s})`}).join(", ")}function qe(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,s,r)=>{let i=No(r,e,!0);return`${o}${s}${i}{`}),t):""}function ze(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function je(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
9`});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let s of o.cssRules)e+=s.cssText+`
10`}catch{}}catch{}return e}function Ve(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function Xe(t,e){try{let n=t.currentSrc||t.src||"";if(!n)return;e.setAttribute("src",n),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function Ye(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function Ro(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch{}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch{}return""}function Ke(t,e,n){let o=[];for(let s of e){let r=Ro(t,s);r&&o.push(`${s}: ${r};`)}return o.length?`${n}{${o.join("")}}

Callers 1

PFunction · 0.70

Calls 2

eFunction · 0.70
nFunction · 0.70

Tested by

no test coverage detected