customer-chat-sdk 1.0.33 → 1.0.35

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.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CustomerSDK={})}(this,function(t){"use strict";class e{constructor(t){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.iconStartX=0,this.iconStartY=0,this.dragMoveHandler=null,this.dragEndHandler=null,this.iconPosition=null,this.iconPosition=t||null}async show(){if(this.iconElement)return;this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon";const t={position:"fixed",width:"30px",height:"30px",backgroundColor:"transparent",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"999999",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",overflow:"visible"};this.iconPosition?(void 0!==this.iconPosition.x?(t.left="number"==typeof this.iconPosition.x?`${this.iconPosition.x}px`:this.iconPosition.x,t.right="auto"):t.right="20px",void 0!==this.iconPosition.y?(t.top="number"==typeof this.iconPosition.y?`${this.iconPosition.y}px`:this.iconPosition.y,t.bottom="auto"):t.bottom="80px"):(t.bottom="80px",t.right="20px"),Object.assign(this.iconElement.style,t);const e=document.createElement("img");e.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAArKSURBVHgB7Z1NbFTXFcf/93mwaGyEabLoIgFTqWRFMZUitSoIu80ial01SFWrKgsGKXYpWdRtFilRK4xUgbKICosmCKIySKCo2UAE6i61XVroDuOoi2YT02RZVFNwQTAzN+e8N88ej9+8j5n3ce5wf5JhPvyY4f3f/9xzz73vXoUeYKish6oljCiFYQ2MaAebVR3D/Jzf1xpDUPTTggIW6feXoOlH0Q9wS9exRK/Pl6qYX6qoJRiOgoEMvqpHWUjlYJ9iQeEJmTb07y6y2CT6HP99/z01C8MwQmB26OMSyuTIH9LTkSA35oLn9FmKCB/WHmP2YUUtQjhiBV4jqsIoJKJJbOC8ZLHFCczhl75UWXvCFuPUDiBXV5TGeWlhXIzALCx9m6Ni3RqfeRL71PJZVYEAChfYdayDc1klSkXBCRr9caxooQsTuIccG4qbiddxsKjQnbvAlDwNVzfgXK8L2wq30ZSMHcs7GctV4IFX9ZTyXGtM8pQq2i2qnCQ3H0NO5CLwk+radnDYrj3CWB5udpAx7FoS96YVdxVy1XCJzgmfG2RMZg5268P9FI6BzP8TRlN3Q/YvkRGZCOyG5H5cApcVLZFkGbJTF3igrEccErfX+rVZk5XIqbbBmyb1y2oDZqy4yfHbZT6HSJHUHDwwqQ/QP1aBpWvIIOXlM+o8UiAVga246ZOWyF0LbMXNjjRE7kpgbi/oS1yCJTNIoP33zqjL6JCOBW5Up24+sWXHvKDyJplojEal5tEBHWXRLG6tHzNW3BxQ7oTBSxvpnKMDOhKYxbVdofxwu1BUW+DqIBKSWODBSf17K24hjFRLbuk3EYkEbhTHbW25KBxMJR2giJ1k2aRKCJR0VR9jd9ySZmwH26RKCKRBicfWYxJLYGp3j9p2VxA0th43VEeGaBuahRIzVEc6uFbCtBVXIDFDdaiDBw/pUdSp7bXIpY6xsCm5oQ5W9fiNuaUgVHjfuK2DN01ovj/IaIE3PwVs/TL9PEOPv7T2vX/fAe7+H/j4c5hPiItLbQ9SyasmRcOCvvJN4OvPAXueB7Y9He+4a/8CFkjoq1TO/9snMA7tuEbcHvReoINNc++eHcCb48De59E1t+94gp+46rncGNq4OFBg6vfehAEzIl/5FnDkB/GdmpQL1w0SWmP2/lk11vryOoFNyJx3Pgu89eN0HBuHP3zkCc1ttmgCXLwui1ZVlCGYw98Brv82P3GZ174L/P031LY/C9FQs3qg9bU1Dm5MWP8UAuEE6v1D+QobxPErnptFQtWt0mNsb14daI2Daxtk3j+09WnPQUWLy7xJbf6RcciEqlu8rknzS2sEpnT7AITB4v759ewSqU6QLHJjJaLV5/4DieFZorjNSA3XpUfY4ofpFQdLDM/vH5YrLsNO5qRPGs1hekVgGu9N9Z6YbuEQKD1rZVjkrcIuwuYw3dwG74MQ+ITxiTMBN7s/DGmsFKlcgd3ihqAxX253TYIjjahQTVq6qxihIbCuyilLcvlRcrvbDo447GYp6IaLXYGVoPUzjhgSmlthcSW52NfUF3gXBGCqe324pCnFxbqhqcO3Q0iZMckCm4w/Hi0Bvt2FtXWqG2W0v5w5SyhFdsv4boiBV8F3pCRYe3egJ+D/h6AwPewoR0b3yPTw3Mzer0EEvN2BQ/m0CAfzPKpeYY+QpoY3J3Eoj96Mgtn5nKw+ZLdI6QmoOraXoIsP0a1TWoPg6TLv/AW4/R/v9zmZSdJuv/MRsPCZd+xrL8avH/PnXryR7NidQqIRtcHbSkpjiy543feoK54nvX3vbW/Gow+LHWdclgXiYxc+T35su8996yfhRQ1JfXmHVUbBRDmCx11v3wl+fSFi4vobHwT/Dh977ZPOPveNP0VPwJPQ5JB5hzJfTjgNrt5q/x7PYQ7j48/av7cQ8l7U5164gVDiNDuZowwROIwoJy096PzYXkCEwFEnOmzgPyrRGt/V+bGhnxvRFZIyWV6GwA/C33+3HNxOc6ITdaIPv9j5se0+15TZJkxf/zempyhWb0SBbHsG+NEL7d8fooRlfGTV6Tu+4g0rvv4SIknz2Be+CvzqJW/UKAxu2//4V4hAbZrQi0Vn0uySfx5Hz8B3Kf70XRQOLzIuIkT79+r2ClHZeV5QN2nJoXqliLnQ1wy8L7cdgu4xvuuQyrchgKj+rClwJBJ0sZKDNURsY37xH+gJrna06G9GKMw7vHU5BCDsyu+YizcgBl1nB/dhEUI4cQVGw8mipIuUzeuUHspwMMMnx6h1MVo4LuwCLVVJYL4LTUqixRyqwEj4whQVnqkPzNo6jSeiXGxiWyzNvWRadyzME1hjFoL4ecWswsfF67Lcy/iaenc2lOQ4mOFB9uNS18FogUOzxJvA/d7RymSdwQn9X2mryp4uy55Oy1Hm278LnvVRKFTbuH9WbeGHq7VoR5aLmXbTbaTw6w8Eiusx5z9YvcO/hg8hjKAJc1LgPOGCsHbXh5LmlZ3SVgTeUJW5/6AvspQSIH8fyeIytb7VpHlFYHdVFiUrm/bhk8rhuujM2p9GK1lcsu/cw9Ory/yvXSdLYJhm/OWUipyKyhGEEyrJOQGjW3aCXSOwG6aFjC75FL1Wlu9anqGxZEDfvDk8M2sEdsuWSo6LixSXmwPu37JrTamsaYVKc3hm1q34rh1ycb34JQ2LEJdF5RB84oqZ5VJVw7rNpIMXBP+ZnqFQPYqCyEtc7sNyCOa7H1hQnmpjQhgORGOeihvr1hcI3rNB4ViRAv/vAfD9t5EpQgsUHUPJ1amg19vvujKpP7Xb2ZkBDw0un1GBm3K0nTZLbfFBWMxAU8RtQ/jOZwW3xZZowtzLhE98V+2vDIsMVD080oYKfP+0mpVavrR4/d6wfQuZyFtXSoquEGHVLQvcMd9ajAgbKfASVUa0DdXy0DjVWrUKIvbyKzbhkkNUYtVM7LsLbagWAodmB2Nxfz22wDZUy0BTnzdOaPZJdH8whYWTHPthKQY698vvkQYJSLwEGq9BXO13N68UvztpL5Gk3W0m8R3+PGZccrCfroxFWHKBxU3S7jbT8SKGAxN6hA6ekTaXuuegpKrah91J2t1mOl6jY/msmlfKDkhkDZ/jTsVlulqE5d4ZdVlpK3JWUMZ8kM8xuiCVdWY3TegydaHOwZIaLC5FyQq6JLWFhK3I6ZGWuExq62Tdoy9EV8t+W+3qAjp3fA7TEpdJfSnwoUN6uFbHjJ3ukwzuCtEfLG6qN+mkvtIdlzT7qM9m+8mJmOd+btriMpksZeiK/Ai7bVkzBnSOSk9hrJuuUBiZ79YwMKmnqCt11BZEWqD2lgcOktaWk5LLdhy2XV7HXNVBOSvXNpPrfiuDk3qartxfPLFuzsm1zeS+oU7DzdPk5sLvf8qZ3FzbTGE7JvG28qqOc09A2J6jVHbanaFaAAVvieVVwOhbHO01oblfqxwcLEpYn8IF9mmUOqfooYjdyLugUMe2IkZgn0boLhvVRnPy5OAyDe2dlyKsjziBfdxkrIZRcnWZnu6DTOZ0HZc3DKKydFKJrMGLFbiZFbGBl8FiF9XN4oEUhVvSRW3GCIFb4TDOW9NTSByln11ZJWi8zDKvxMsLe/J6ntLCbxyMFLiVoSk9VH2IEVd03rKedzX3XD7EO3AG7gvlDc3ddR8qLLpZr6LX6iRoHxZLGzFvgkOj+ALBlx6CtCZy6AAAAABJRU5ErkJggg==",e.style.width="100%",e.style.height="100%",e.style.objectFit="cover",e.style.display="block",e.alt="Customer Service",e.onload=()=>{this.iconElement&&(e.style.opacity="1",e.style.visibility="visible")},e.onerror=t=>{},e.style.opacity="1",e.style.visibility="visible";const n=document.createElement("div");Object.assign(n.style,{width:"100%",height:"100%",borderRadius:"50%",overflow:"hidden",position:"relative"}),n.appendChild(e),this.iconElement.appendChild(n),this.setupDragEvents(),document.body.appendChild(this.iconElement)}forceCleanupDragEvents(){if(this.dragMoveHandler)try{document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)}catch(t){}if(this.dragEndHandler)try{document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)}catch(t){}this.isDragging=!1,this.iconElement&&(this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer")}hide(){this.forceCleanupDragEvents(),this.iconElement&&(this.iconElement.remove(),this.iconElement=null,this.onClickCallback=null,this.dragMoveHandler=null,this.dragEndHandler=null)}setPosition(t){}setIconPosition(t){if(this.iconPosition=t,this.iconElement){void 0!==t.x&&(this.iconElement.style.left="number"==typeof t.x?`${t.x}px`:t.x,this.iconElement.style.right="auto"),void 0!==t.y&&(this.iconElement.style.top="number"==typeof t.y?`${t.y}px`:t.y,this.iconElement.style.bottom="auto");const e=this.iconElement.getBoundingClientRect();this.iconStartX=e.left,this.iconStartY=e.top}}setStyle(t){}onClick(t){this.onClickCallback=t}onNotification(t){this.notificationCallback=t}showNotification(t){if(!this.iconElement)return;const{showBadge:e=!0,badgeCount:n=0,badgeText:o="",pulse:r=!1}=t;(e||n>0)&&this.createBadge(n,o,r),this.notificationCallback&&this.notificationCallback({badgeCount:n,badgeText:o,pulse:r})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null)}setupDragEvents(){this.iconElement&&(this.dragMoveHandler=this.handleDragMove.bind(this),this.dragEndHandler=this.handleDragEnd.bind(this),this.iconElement.addEventListener("mousedown",this.handleDragStart.bind(this)),this.iconElement.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!1}))}handleDragStart(t){if(!this.iconElement)return;if(t.target!==this.iconElement&&!this.iconElement.contains(t.target))return;t.preventDefault(),t.stopPropagation();const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY;this.isDragging=!1,this.dragStartX=e,this.dragStartY=n;const o=this.iconElement.getBoundingClientRect();this.iconStartX=o.left,this.iconStartY=o.top,this.iconElement.style.transition="none",this.iconElement.style.cursor="grabbing";const r=t=>{const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY,o=e-this.dragStartX,i=n-this.dragStartY;(Math.abs(o)>5||Math.abs(i)>5)&&(this.isDragging=!0,"touches"in t?document.removeEventListener("touchmove",r):document.removeEventListener("mousemove",r),this.dragMoveHandler&&this.dragEndHandler&&("touches"in t?(document.addEventListener("touchmove",this.dragMoveHandler,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",this.dragMoveHandler),document.addEventListener("mouseup",this.dragEndHandler))))};"touches"in t?(document.addEventListener("touchmove",r,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",r),document.addEventListener("mouseup",this.dragEndHandler))}handleDragMove(t){if(!this.iconElement||!this.isDragging)return;const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY,o=t.target;if(o&&o!==this.iconElement&&!this.iconElement.contains(o)){if("IFRAME"===o.tagName||o.closest("iframe")||o.closest(".customer-sdk-container")||o.closest(".customer-sdk-overlay"))return void this.handleDragEnd()}const r=e-this.dragStartX,i=n-this.dragStartY,a=this.iconElement.getBoundingClientRect(),s=a.left+a.width/2,c=a.top+a.height/2;if(Math.sqrt(Math.pow(e-s,2)+Math.pow(n-c,2))>3*Math.max(a.width,a.height))return void this.handleDragEnd();t.preventDefault(),t.stopPropagation();const l=this.iconStartX+r,u=this.iconStartY+i,d=window.innerWidth-this.iconElement.offsetWidth,h=window.innerHeight-this.iconElement.offsetHeight,m=Math.max(0,Math.min(l,d)),f=Math.max(0,Math.min(u,h));this.iconElement.style.left=`${m}px`,this.iconElement.style.top=`${f}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto"}handleDragEnd(t){this.iconElement&&(this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)),this.dragEndHandler&&(document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)),this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer",this.isDragging||this.handleClick(),this.isDragging=!1)}handleClick(){this.onClickCallback&&this.onClickCallback()}createBadge(t,e="",n=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=t>0?t>99?"99+":t.toString():e||"",Object.assign(this.badgeElement.style,{position:"absolute",top:"-4px",left:"-4px",right:"auto",minWidth:"18px",height:"18px",borderRadius:"50%",backgroundColor:"#ff4444",color:"#ffffff",fontSize:"10px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000001",boxShadow:"0 -1px 4px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15)",...0===t&&""===e&&{width:"12px",height:"12px",minWidth:"12px",top:"-2px",left:"-2px"},...n&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}class n{constructor(t={}){this.iframeElement=null,this.overlayElement=null,this.containerElement=null,this.isOpen=!1,this.isCreated=!1,this.config={src:"",mode:"auto",width:400,height:600,allowClose:!0,...t},this.setupMessageListener()}async init(){try{this.createIframe(),this.isCreated=!0}catch(t){throw t}}show(){if(!this.isOpen){if(!this.isCreated)throw new Error("Iframe not initialized. Call init() first.");try{const t="popup"===this.getActualMode();t&&this.createOverlay(),this.containerElement&&(t?(Object.assign(this.containerElement.style,{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",visibility:"visible",opacity:"1",display:"block"}),this.overlayElement?.appendChild(this.containerElement)):(Object.assign(this.containerElement.style,{position:"fixed",visibility:"visible",opacity:"1",display:"block"}),this.preventBodyScroll(!0))),this.isOpen=!0}catch(t){}}}open(){this.show()}hide(){if(!this.isOpen)return;this.containerElement&&Object.assign(this.containerElement.style,{visibility:"hidden",opacity:"0",display:"none"}),this.overlayElement&&(this.overlayElement.remove(),this.overlayElement=null);"fullscreen"===this.getActualMode()&&this.preventBodyScroll(!1),this.isOpen=!1,this.config.onClose&&this.config.onClose()}close(){this.hide()}destroy(){this.hide(),this.containerElement&&(this.containerElement.remove(),this.containerElement=null,this.iframeElement=null),this.isCreated=!1}isIframeOpen(){return this.isOpen}sendToIframe(t){this.iframeElement&&this.iframeElement.contentWindow&&this.iframeElement.contentWindow.postMessage(t,"*")}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.className="customer-sdk-overlay",Object.assign(this.overlayElement.style,{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"999998",display:"flex",alignItems:"center",justifyContent:"center",cursor:this.config.allowClose?"pointer":"default"}),this.config.allowClose&&this.overlayElement.addEventListener("click",t=>{t.target===this.overlayElement&&this.close()}),document.body.appendChild(this.overlayElement)}createIframe(){this.containerElement=document.createElement("div"),this.containerElement.className="customer-sdk-container",this.iframeElement=document.createElement("iframe"),this.iframeElement.className="customer-sdk-iframe",this.iframeElement.src=this.config.src||"",this.iframeElement.frameBorder="0",this.iframeElement.setAttribute("allow",["microphone","camera","geolocation","clipboard-read","clipboard-write","fullscreen","autoplay","encrypted-media"].join("; ")),this.iframeElement.setAttribute("sandbox",["allow-same-origin","allow-scripts","allow-forms","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-storage-access-by-user-activation"].join(" "));const t="popup"===this.getActualMode();this.iframeElement.scrolling=t?"auto":"no";const e={width:t?`${this.config.width}px`:"100%",height:t?`${this.config.height}px`:"100%",maxWidth:t?"450px":"100%",maxHeight:t?"700px":"100%",backgroundColor:"#ffffff",borderRadius:t?"12px":"12px 12px 0 0",boxShadow:t?"0 20px 40px rgba(0, 0, 0, 0.15)":"0 -4px 16px rgba(0, 0, 0, 0.25)",border:"none",position:"fixed",zIndex:"999999",...t?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:"0",left:"0",bottom:"0",right:"0",transform:"none",overflow:"hidden",position:"fixed"},visibility:"hidden",opacity:"0",display:"none"};Object.assign(this.containerElement.style,e);const n={width:"100%",height:"100%",border:"none",borderRadius:"inherit",...t?{}:{overflow:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitScrollbar:"none"}};Object.assign(this.iframeElement.style,n),this.containerElement.appendChild(this.iframeElement),this.iframeElement.addEventListener("load",()=>{t||this.injectMobileStyles()}),document.body.appendChild(this.containerElement)}injectMobileStyles(){if(this.iframeElement)try{const t=this.iframeElement.contentDocument||this.iframeElement.contentWindow?.document;if(t){const e=t.createElement("style");e.textContent="\n /* 移动端iframe全屏样式优化 */\n * {\n -webkit-overflow-scrolling: touch !important;\n }\n \n body, html, #app, .container {\n overflow: auto !important;\n -webkit-overflow-scrolling: touch !important;\n }\n \n /* 隐藏所有滚动条 */\n ::-webkit-scrollbar {\n width: 0px !important;\n height: 0px !important;\n background: transparent !important;\n }\n \n /* Firefox */\n html {\n scrollbar-width: none !important;\n }\n \n /* IE/Edge */\n body {\n -ms-overflow-style: none !important;\n }\n \n /* 确保内容可以滚动 */\n body {\n overflow: auto !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ",t.head?.appendChild(e)}}catch(t){}}preventBodyScroll(t){if(t){const t=window.scrollY;Object.assign(document.body.style,{position:"fixed",top:`-${t}px`,width:"100%",overflow:"hidden"}),document.body.setAttribute("data-scroll-position",t.toString())}else{const t=parseInt(document.body.getAttribute("data-scroll-position")||"0");Object.assign(document.body.style,{position:"",top:"",width:"",overflow:""}),document.body.removeAttribute("data-scroll-position"),window.scrollTo(0,t)}}isMobileDevice(){return window.innerWidth<=768||/Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent)}getActualMode(){return"auto"===this.config.mode?this.isMobileDevice()?"fullscreen":"popup":this.config.mode}setupMessageListener(){window.addEventListener("message",t=>{this.config.src&&t.origin!==new URL(this.config.src).origin||this.handleIframeMessage(t.data)},!1)}handleIframeMessage(t){let e;if("string"==typeof t)e=t;else{if(!t||!t.type)return;e=t.type}switch(e){case"iframe_ready":break;case"close_iframe":case"close":this.close();break;case"resize_iframe":case"resize":t.width&&t.height&&this.resizeIframe(t.width,t.height);break;case"new-message":this.config.onMessage&&this.config.onMessage(e,t)}}resizeIframe(t,e){this.iframeElement&&(this.iframeElement.style.width=`${t}px`,this.iframeElement.style.height=`${e}px`)}}const o="p".charCodeAt(0),r="H".charCodeAt(0),i="Y".charCodeAt(0),a="s".charCodeAt(0);let s;function c(t){let e=-1;s||(s=function(){const t=new Int32Array(256);for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)n=1&n?3988292384^n>>>1:n>>>1;t[e]=n}return t}());for(let n=0;n<t.length;n++)e=s[255&(e^t[n])]^e>>>8;return-1^e}function l(t,e,n=!1){const s=new Uint8Array(13);e*=39.3701,s[0]=o,s[1]=r,s[2]=i,s[3]=a,s[4]=e>>>24,s[5]=e>>>16,s[6]=e>>>8,s[7]=255&e,s[8]=s[4],s[9]=s[5],s[10]=s[6],s[11]=s[7],s[12]=1;const l=c(s),u=new Uint8Array(4);if(u[0]=l>>>24,u[1]=l>>>16,u[2]=l>>>8,u[3]=255&l,n){const e=function(t){for(let e=t.length-1;e>=4;e--)if(9===t[e-4]&&t[e-3]===o&&t[e-2]===r&&t[e-1]===i&&t[e]===a)return e-3;return 0}(t);return t.set(s,e),t.set(u,e+13),t}{const e=new Uint8Array(4);e[0]=0,e[1]=0,e[2]=0,e[3]=9;const n=new Uint8Array(54);return n.set(t,0),n.set(e,33),n.set(s,37),n.set(u,50),n}}const u="undefined"!=typeof window,d=u&&"Worker"in window,h=u&&"atob"in window,m=u&&"btoa"in window,f=u?window.navigator?.userAgent:"",p=f.includes("Chrome"),g=f.includes("AppleWebKit")&&!p,y=f.includes("Firefox"),w=t=>1===t.nodeType,b=t=>"object"==typeof t.className,v=t=>"image"===t.tagName,x=t=>w(t)&&void 0!==t.style&&!b(t),S=t=>8===t.nodeType,C=t=>"IMG"===t.tagName,E=t=>"VIDEO"===t.tagName,M=t=>"SLOT"===t.tagName;function k(t){const e=t?.createElement?.("canvas");return e&&(e.height=e.width=1),Boolean(e)&&"toDataURL"in e&&Boolean(e.toDataURL("image/webp").includes("image/webp"))}const A=t=>t.startsWith("data:");function L(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(u&&t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;if(!u)return t;const n=I().implementation.createHTMLDocument(),o=n.createElement("base"),r=n.createElement("a");return n.head.appendChild(o),n.body.appendChild(r),e&&(o.href=e),r.href=t,r.href}function I(t){return(t&&w(t)?t?.ownerDocument:t)??window.document}const R="http://www.w3.org/2000/svg";const N=t=>function(t,e){return new Promise((n,o)=>{const r=new FileReader;r.onload=()=>n(r.result),r.onerror=()=>o(r.error),r.onabort=()=>o(new Error(`Failed read blob to ${e}`)),r.readAsDataURL(t)})}(t,"dataUrl");function T(t,e){const n=I(e).createElement("img");return n.decoding="sync",n.loading="eager",n.src=t,n}function P(t,e){return new Promise(n=>{const{timeout:o,ownerDocument:r,onError:i,onWarn:a}=e??{},s="string"==typeof t?T(t,I(r)):t;let c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(o&&(c=setTimeout(u,o)),E(s)){const t=s.currentSrc||s.src;if(!t)return s.poster?P(s.poster,e).then(n):u();if(s.readyState>=2)return u();const o=u,r=e=>{a?.("Failed video load",t,e),i?.(e),u()};l=()=>{s.removeEventListener("loadeddata",o),s.removeEventListener("error",r)},s.addEventListener("loadeddata",o,{once:!0}),s.addEventListener("error",r,{once:!0})}else{const t=v(s)?s.href.baseVal:s.currentSrc||s.src;if(!t)return u();const e=async()=>{if(C(s)&&"decode"in s)try{await s.decode()}catch(e){a?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||t,e)}u()},n=e=>{a?.("Failed image load",s.dataset.originalSrc||t,e),u()};if(C(s)&&s.complete)return e();l=()=>{s.removeEventListener("load",e),s.removeEventListener("error",n)},s.addEventListener("load",e,{once:!0}),s.addEventListener("error",n,{once:!0})}})}const F=function(){let t=0;return()=>(t+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${t}`)}();function W(t){return t?.split(",").map(t=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}function D(t){return{time:e=>t&&void 0,timeEnd:e=>t&&void 0,warn:(...e)=>t&&void 0}}async function $(t,e){return(n=t)&&"__CONTEXT__"in n?t:H(t,{...e,autoDestruct:!0});var n}async function H(t,e){const{scale:n=1,workerUrl:o,workerNumber:r=1}=e||{},i=Boolean(e?.debug),a=e?.features??!0,s=t.ownerDocument??(u?window.document:void 0),c=t.ownerDocument?.defaultView??(u?window:void 0),l=new Map,h={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:i,fetch:{requestInit:(m=e?.fetch?.bypassingCache,{cache:m?"no-cache":"force-cache"}),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...e?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:r,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...e,__CONTEXT__:!0,log:D(i),node:t,ownerDocument:s,ownerWindow:c,dpi:1===n?null:96*n,svgStyleElement:B(s),svgDefsElement:s?.createElementNS(R,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:d&&o&&r?r:0})].map(()=>{try{const t=new Worker(o);return t.onmessage=async t=>{const{url:e,result:n}=t.data;n?l.get(e)?.resolve?.(n):l.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},t.onmessageerror=t=>{const{url:e}=t.data;l.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},t}catch(t){return h.log.warn("Failed to new Worker",t),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[k(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:l,drawImageCount:0,tasks:[],features:a,isEnable:t=>"restoreScrollPosition"===t?"boolean"!=typeof a&&(a[t]??!1):"boolean"==typeof a?a:a[t]??!0,shadowRoots:[]};var m;h.log.time("wait until load"),await async function(t,e){x(t)&&(C(t)||E(t)?await P(t,e):await Promise.all(["img","video"].flatMap(n=>Array.from(t.querySelectorAll(n)).map(t=>P(t,e)))))}(t,{timeout:h.timeout,onWarn:h.log.warn}),h.log.timeEnd("wait until load");const{width:f,height:p}=function(t,e){let{width:n,height:o}=e;if(w(t)&&(!n||!o)){const e=t.getBoundingClientRect();n=n||e.width||Number(t.getAttribute("width"))||0,o=o||e.height||Number(t.getAttribute("height"))||0}return{width:n,height:o}}(t,h);return h.width=f,h.height=p,h}function B(t){if(!t)return;const e=t.createElement("style"),n=e.ownerDocument.createTextNode("\n.______background-clip--text {\n background-clip: text;\n -webkit-background-clip: text;\n}\n");return e.appendChild(n),e}async function V(t,e){const{log:n,timeout:o,drawImageCount:r,drawImageInterval:i}=e;n.time("image to canvas");const a=await P(t,{timeout:o,onWarn:e.log.warn}),{canvas:s,context2d:c}=function(t,e){const{width:n,height:o,scale:r,backgroundColor:i,maximumCanvasSize:a}=e,s=t.createElement("canvas");s.width=Math.floor(n*r),s.height=Math.floor(o*r),s.style.width=`${n}px`,s.style.height=`${o}px`,a&&(s.width>a||s.height>a)&&(s.width>a&&s.height>a?s.width>s.height?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a):s.width>a?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a));const c=s.getContext("2d");c&&i&&(c.fillStyle=i,c.fillRect(0,0,s.width,s.height));return{canvas:s,context2d:c}}(t.ownerDocument,e),l=()=>{try{c?.drawImage(a,0,0,s.width,s.height)}catch(t){e.log.warn("Failed to drawImage",t)}};if(l(),e.isEnable("fixSvgXmlDecode"))for(let t=0;t<r;t++)await new Promise(e=>{setTimeout(()=>{c?.clearRect(0,0,s.width,s.height),l(),e()},t+i)});return e.drawImageCount=0,n.timeEnd("image to canvas"),s}function U(t,e){if(t.ownerDocument)try{const e=t.toDataURL();if("data:,"!==e)return T(e,t.ownerDocument)}catch(t){e.log.warn("Failed to clone canvas",t)}const n=t.cloneNode(!1),o=t.getContext("2d"),r=n.getContext("2d");try{return o&&r&&r.putImageData(o.getImageData(0,0,t.width,t.height),0,0),n}catch(t){e.log.warn("Failed to clone canvas",t)}return n}function O(t,e){return(t=>"CANVAS"===t.tagName)(t)?U(t,e):(t=>"IFRAME"===t.tagName)(t)?function(t,e){try{if(t?.contentDocument?.body)return K(t.contentDocument.body,e)}catch(t){e.log.warn("Failed to clone iframe",t)}return t.cloneNode(!1)}(t,e):C(t)?function(t){const e=t.cloneNode(!1);return t.currentSrc&&t.currentSrc!==t.src&&(e.src=t.currentSrc,e.srcset=""),"lazy"===e.loading&&(e.loading="eager"),e}(t):E(t)?async function(t,e){if(t.ownerDocument&&!t.currentSrc&&t.poster)return T(t.poster,t.ownerDocument);const n=t.cloneNode(!1);n.crossOrigin="anonymous",t.currentSrc&&t.currentSrc!==t.src&&(n.src=t.currentSrc);const o=n.ownerDocument;if(o){let r=!0;if(await P(n,{onError:()=>r=!1,onWarn:e.log.warn}),!r)return t.poster?T(t.poster,t.ownerDocument):n;n.currentTime=t.currentTime,await new Promise(t=>{n.addEventListener("seeked",t,{once:!0})});const i=o.createElement("canvas");i.width=t.offsetWidth,i.height=t.offsetHeight;try{const t=i.getContext("2d");t&&t.drawImage(n,0,0,i.width,i.height)}catch(o){return e.log.warn("Failed to clone video",o),t.poster?T(t.poster,t.ownerDocument):n}return U(i,e)}return n}(t,e):t.cloneNode(!1)}const j=["width","height","-webkit-text-fill-color"],z=["stroke","fill"];function X(t,e,n){const{defaultComputedStyles:o}=n,r=t.nodeName.toLowerCase(),i=b(t)&&"svg"!==r,a=i?z.map(e=>[e,t.getAttribute(e)]).filter(([,t])=>null!==t):[],s=[i&&"svg",r,a.map((t,e)=>`${t}=${e}`).join(","),e].filter(Boolean).join(":");if(o.has(s))return o.get(s);const c=function(t){let e=t.sandbox;if(!e){const{ownerDocument:n}=t;try{n&&(e=n.createElement("iframe"),e.id=`__SANDBOX__${F()}`,e.width="0",e.height="0",e.style.visibility="hidden",e.style.position="fixed",n.body.appendChild(e),e.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',t.sandbox=e)}catch(e){t.log.warn("Failed to getSandBox",e)}}return e}(n),l=c?.contentWindow;if(!l)return new Map;const u=l?.document;let d,h;i?(d=u.createElementNS(R,"svg"),h=d.ownerDocument.createElementNS(d.namespaceURI,r),a.forEach(([t,e])=>{h.setAttributeNS(null,t,e)}),d.appendChild(h)):d=h=u.createElement(r),h.textContent=" ",u.body.appendChild(d);const m=l.getComputedStyle(h,e),f=new Map;for(let t=m.length,e=0;e<t;e++){const t=m.item(e);j.includes(t)||f.set(t,m.getPropertyValue(t))}return u.body.removeChild(d),o.set(s,f),f}function Z(t,e,n){const o=new Map,r=[],i=new Map;if(n)for(const t of n)a(t);else for(let e=t.length,n=0;n<e;n++){a(t.item(n))}for(let t=r.length,e=0;e<t;e++)i.get(r[e])?.forEach((t,e)=>o.set(e,t));function a(n){const a=t.getPropertyValue(n),s=t.getPropertyPriority(n),c=n.lastIndexOf("-"),l=c>-1?n.substring(0,c):void 0;if(l){let t=i.get(l);t||(t=new Map,i.set(l,t)),t.set(n,[a,s])}(e.get(n)!==a||s)&&(l?r.push(l):o.set(n,[a,s]))}return o}const G=[":before",":after"],Y=[":-webkit-scrollbar",":-webkit-scrollbar-button",":-webkit-scrollbar-thumb",":-webkit-scrollbar-track",":-webkit-scrollbar-track-piece",":-webkit-scrollbar-corner",":-webkit-resizer"];const _=new Set(["symbol"]);async function q(t,e,n,o,r){if(w(n)&&((t=>"STYLE"===t.tagName)(n)||(t=>"SCRIPT"===t.tagName)(n)))return;if(o.filter&&!o.filter(n))return;_.has(e.nodeName)||_.has(n.nodeName)?o.currentParentNodeStyle=void 0:o.currentParentNodeStyle=o.currentNodeStyle;const i=await K(n,o,!1,r);o.isEnable("restoreScrollPosition")&&function(t,e){if(!x(t)||!x(e))return;const{scrollTop:n,scrollLeft:o}=t;if(!n&&!o)return;const{transform:r}=e.style,i=new DOMMatrix(r),{a:a,b:s,c:c,d:l}=i;i.a=1,i.b=0,i.c=0,i.d=1,i.translateSelf(-o,-n),i.a=a,i.b=s,i.c=c,i.d=l,e.style.transform=i.toString()}(t,i),e.appendChild(i)}async function J(t,e,n,o){let r=t.firstChild;w(t)&&t.shadowRoot&&(r=t.shadowRoot?.firstChild,n.shadowRoots.push(t.shadowRoot));for(let i=r;i;i=i.nextSibling)if(!S(i))if(w(i)&&M(i)&&"function"==typeof i.assignedNodes){const r=i.assignedNodes();for(let i=0;i<r.length;i++)await q(t,e,r[i],n,o)}else await q(t,e,i,n,o)}const Q=/^[\w-:]+$/;async function K(t,e,n=!1,o){const{ownerDocument:r,ownerWindow:i,fontFamilies:a,onCloneEachNode:s}=e;if(r&&(t=>3===t.nodeType)(t))return o&&/\S/.test(t.data)&&o(t.data),r.createTextNode(t.data);if(r&&i&&w(t)&&(x(t)||b(t))){const o=await O(t,e);if(e.isEnable("removeAbnormalAttributes")){const t=o.getAttributeNames();for(let e=t.length,n=0;n<e;n++){const e=t[n];Q.test(e)||o.removeAttribute(e)}}const r=e.currentNodeStyle=function(t,e,n,o){const{ownerWindow:r,includeStyleProperties:i,currentParentNodeStyle:a}=o,s=e.style,c=r.getComputedStyle(t),l=X(t,null,o);a?.forEach((t,e)=>{l.delete(e)});const u=Z(c,l,i);u.delete("transition-property"),u.delete("all"),u.delete("d"),u.delete("content"),n&&(u.delete("margin-top"),u.delete("margin-right"),u.delete("margin-bottom"),u.delete("margin-left"),u.delete("margin-block-start"),u.delete("margin-block-end"),u.delete("margin-inline-start"),u.delete("margin-inline-end"),u.set("box-sizing",["border-box",""])),"text"===u.get("background-clip")?.[0]&&e.classList.add("______background-clip--text"),p&&(u.has("font-kerning")||u.set("font-kerning",["normal",""]),"hidden"!==u.get("overflow-x")?.[0]&&"hidden"!==u.get("overflow-y")?.[0]||"ellipsis"!==u.get("text-overflow")?.[0]||t.scrollWidth!==t.clientWidth||u.set("text-overflow",["clip",""]));for(let t=s.length,e=0;e<t;e++)s.removeProperty(s.item(e));return u.forEach(([t,e],n)=>{s.setProperty(n,t,e)}),u}(t,o,n,e);n&&function(t,e){const{backgroundColor:n,width:o,height:r,style:i}=e,a=t.style;if(n&&a.setProperty("background-color",n,"important"),o&&a.setProperty("width",`${o}px`,"important"),r&&a.setProperty("height",`${r}px`,"important"),i)for(const t in i)a[t]=i[t]}(o,e);let i=!1;if(e.isEnable("copyScrollbar")){const e=[r.get("overflow-x")?.[0],r.get("overflow-y")?.[0]];i=e.includes("scroll")||(e.includes("auto")||e.includes("overlay"))&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)}const c=r.get("text-transform")?.[0],l=W(r.get("font-family")?.[0]),u=l?t=>{"uppercase"===c?t=t.toUpperCase():"lowercase"===c?t=t.toLowerCase():"capitalize"===c&&(t=t[0].toUpperCase()+t.substring(1)),l.forEach(e=>{let n=a.get(e);n||a.set(e,n=new Set),t.split("").forEach(t=>n.add(t))})}:void 0;return function(t,e,n,o,r){const{ownerWindow:i,svgStyleElement:a,svgStyles:s,currentNodeStyle:c}=o;function l(n){const a=i.getComputedStyle(t,n);let l=a.getPropertyValue("content");if(!l||"none"===l)return;r?.(l),l=l.replace(/(')|(")|(counter\(.+\))/g,"");const u=[F()],d=X(t,n,o);c?.forEach((t,e)=>{d.delete(e)});const h=Z(a,d,o.includeStyleProperties);h.delete("content"),h.delete("-webkit-locale"),"text"===h.get("background-clip")?.[0]&&e.classList.add("______background-clip--text");const m=[`content: '${l}';`];if(h.forEach(([t,e],n)=>{m.push(`${n}: ${t}${e?" !important":""};`)}),1===m.length)return;try{e.className=[e.className,...u].join(" ")}catch(t){return void o.log.warn("Failed to copyPseudoClass",t)}const f=m.join("\n ");let p=s.get(f);p||(p=[],s.set(f,p)),p.push(`.${u[0]}:${n}`)}a&&i&&(G.forEach(l),n&&Y.forEach(l))}(t,o,i,e,u),function(t,e){((t=>"TEXTAREA"===t.tagName)(t)||(t=>"INPUT"===t.tagName)(t)||(t=>"SELECT"===t.tagName)(t))&&e.setAttribute("value",t.value)}(t,o),E(t)||await J(t,o,e,u),await(s?.(o)),o}const c=t.cloneNode(!1);return await J(t,c,e),await(s?.(c)),c}function tt(t){if(t.ownerDocument=void 0,t.ownerWindow=void 0,t.svgStyleElement=void 0,t.svgDefsElement=void 0,t.svgStyles.clear(),t.defaultComputedStyles.clear(),t.sandbox){try{t.sandbox.remove()}catch(e){t.log.warn("Failed to destroyContext",e)}t.sandbox=void 0}t.workers=[],t.fontFamilies.clear(),t.fontCssTexts.clear(),t.requests.clear(),t.tasks=[],t.shadowRoots=[]}function et(t,e){const{url:n,requestType:o="text",responseType:r="text",imageDom:i}=e;let a=n;const{timeout:s,acceptOfImage:c,requests:l,fetchFn:u,fetch:{requestInit:d,bypassingCache:h,placeholderImage:m},font:f,workers:p,fontFamilies:w}=t;"image"===o&&(g||y)&&t.drawImageCount++;let b=l.get(n);if(!b){h&&h instanceof RegExp&&h.test(a)&&(a+=(/\?/.test(a)?"&":"?")+(new Date).getTime());const e=o.startsWith("font")&&f&&f.minify,y=new Set;if(e){o.split(";")[1].split(",").forEach(t=>{w.has(t)&&w.get(t).forEach(t=>y.add(t))})}const v=e&&y.size,x={url:a,timeout:s,responseType:v?"arrayBuffer":r,headers:"image"===o?{accept:c}:void 0,...d};b={type:o,resolve:void 0,reject:void 0,response:null},b.response=(async()=>{if(u&&"image"===o){const t=await u(n);if(t)return t}return!g&&n.startsWith("http")&&p.length?new Promise((t,e)=>{p[l.size&p.length-1].postMessage({rawUrl:n,...x}),b.resolve=t,b.reject=e}):function(t){const{url:e,timeout:n,responseType:o,...r}=t,i=new AbortController,a=n?setTimeout(()=>i.abort(),n):void 0;return fetch(e,{signal:i.signal,...r}).then(t=>{if(!t.ok)throw new Error("Failed fetch, not 2xx response",{cause:t});switch(o){case"arrayBuffer":return t.arrayBuffer();case"dataUrl":return t.blob().then(N);default:return t.text()}}).finally(()=>clearTimeout(a))}(x)})().catch(e=>{if(l.delete(n),"image"===o&&m)return t.log.warn("Failed to fetch image base64, trying to use placeholder image",a),"string"==typeof m?m:m(i);throw e}),l.set(n,b)}return b.response}async function nt(t,e,n,o){if(!ot(t))return t;for(const[r,i]of function(t,e){const n=[];return t.replace(rt,(t,o,r)=>(n.push([r,L(r,e)]),t)),n.filter(([t])=>!A(t))}(t,e))try{const e=await et(n,{url:i,requestType:o?"image":"text",responseType:"dataUrl"});t=t.replace(it(r),`$1${e}$3`)}catch(t){n.log.warn("Failed to fetch css data url",r,t)}return t}function ot(t){return/url\((['"]?)([^'"]+?)\1\)/.test(t)}const rt=/url\((['"]?)([^'"]+?)\1\)/g;function it(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}const at=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function st(t,e){const{tasks:n}=e;w(t)&&((C(t)||v(t))&&n.push(...function(t,e){if(C(t)){const n=t.currentSrc||t.src;if(!A(n))return[et(e,{url:n,imageDom:t,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(t.srcset="",t.dataset.originalSrc=n,t.src=e||"")})];(g||y)&&e.drawImageCount++}else if(b(t)&&!A(t.href.baseVal)){const n=t.href.baseVal;return[et(e,{url:n,imageDom:t,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(t.dataset.originalSrc=n,t.href.baseVal=e||"")})]}return[]}(t,e)),"use"===t.tagName&&n.push(...function(t,e){const{ownerDocument:n,svgDefsElement:o}=e,r=t.getAttribute("href")??t.getAttribute("xlink:href");if(!r)return[];const[i,a]=r.split("#");if(a){const r=`#${a}`,s=e.shadowRoots.reduce((t,e)=>t??e.querySelector(`svg ${r}`),n?.querySelector(`svg ${r}`));if(i&&t.setAttribute("href",r),o?.querySelector(r))return[];if(s)return o?.appendChild(s.cloneNode(!0)),[];if(i)return[et(e,{url:i,responseType:"text"}).then(t=>{o?.insertAdjacentHTML("beforeend",t)})]}return[]}(t,e))),x(t)&&n.push(...function(t,e){return at.map(n=>{const o=t.getPropertyValue(n);return o&&"none"!==o?((g||y)&&e.drawImageCount++,nt(o,null,e,!0).then(e=>{e&&o!==e&&t.setProperty(n,e,t.getPropertyPriority(n))})):null}).filter(Boolean)}(t.style,e)),t.childNodes.forEach(t=>{st(t,e)})}async function ct(t,e){const{ownerDocument:n,svgStyleElement:o,fontFamilies:r,fontCssTexts:i,tasks:a,font:s}=e;if(n&&o&&r.size)if(s&&s.cssText){const t=mt(s.cssText,e);o.appendChild(n.createTextNode(`${t}\n`))}else{const t=Array.from(n.styleSheets).filter(t=>{try{return"cssRules"in t&&Boolean(t.cssRules.length)}catch(n){return e.log.warn(`Error while reading CSS rules from ${t.href}`,n),!1}});await Promise.all(t.flatMap(t=>Array.from(t.cssRules).map(async(n,o)=>{if("CSSImportRule"===n.constructor.name){let r=o+1;const i=n.href;let a="";try{a=await et(e,{url:i,requestType:"text",responseType:"text"})}catch(t){e.log.warn(`Error fetch remote css import from ${i}`,t)}const s=a.replace(rt,(t,e,n)=>t.replace(n,L(n,i)));for(const n of function(t){if(null==t)return[];const e=[];let n=t.replace(lt,"");for(;;){const t=ut.exec(n);if(!t)break;e.push(t[0])}n=n.replace(ut,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,r=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let t=o.exec(n);if(t)r.lastIndex=o.lastIndex;else{if(t=r.exec(n),!t)break;o.lastIndex=r.lastIndex}e.push(t[0])}return e}(s))try{t.insertRule(n,n.startsWith("@import")?r+=1:t.cssRules.length)}catch(t){e.log.warn("Error inserting rule from remote css import",{rule:n,error:t})}}})));t.flatMap(t=>Array.from(t.cssRules)).filter(t=>"CSSFontFaceRule"===t.constructor.name&&ot(t.style.getPropertyValue("src"))&&W(t.style.getPropertyValue("font-family"))?.some(t=>r.has(t))).forEach(t=>{const r=t,s=i.get(r.cssText);s?o.appendChild(n.createTextNode(`${s}\n`)):a.push(nt(r.cssText,r.parentStyleSheet?r.parentStyleSheet.href:null,e).then(t=>{t=mt(t,e),i.set(r.cssText,t),o.appendChild(n.createTextNode(`${t}\n`))}))})}}const lt=/(\/\*[\s\S]*?\*\/)/g,ut=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;const dt=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,ht=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function mt(t,e){const{font:n}=e,o=n?n?.preferredFormat:void 0;return o?t.replace(ht,t=>{for(;;){const[e,,n]=dt.exec(t)||[];if(!n)return"";if(n===o)return`src: ${e};`}}):t}async function ft(t,e){const n=await $(t,e);if(w(n.node)&&b(n.node))return n.node;const{ownerDocument:o,log:r,tasks:i,svgStyleElement:a,svgDefsElement:s,svgStyles:c,font:l,progress:u,autoDestruct:d,onCloneNode:h,onEmbedNode:m,onCreateForeignObjectSvg:f}=n;r.time("clone node");const p=await K(n.node,n,!0);if(a&&o){let t="";c.forEach((e,n)=>{t+=`${e.join(",\n")} {\n ${n}\n}\n`}),a.appendChild(o.createTextNode(t))}r.timeEnd("clone node"),await(h?.(p)),!1!==l&&w(p)&&(r.time("embed web font"),await ct(0,n),r.timeEnd("embed web font")),r.time("embed node"),st(p,n);const g=i.length;let y=0;u?.(y,g),await Promise.all([...Array.from({length:4})].map(async()=>{for(;;){const t=i.pop();if(!t)break;try{await t}catch(t){n.log.warn("Failed to run task",t)}u?.(++y,g)}})),r.timeEnd("embed node"),await(m?.(p));const v=function(t,e){const{width:n,height:o}=e,r=function(t,e,n){const o=I(n).createElementNS(R,"svg");return o.setAttributeNS(null,"width",t.toString()),o.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"viewBox",`0 0 ${t} ${e}`),o}(n,o,t.ownerDocument),i=r.ownerDocument.createElementNS(r.namespaceURI,"foreignObject");return i.setAttributeNS(null,"x","0%"),i.setAttributeNS(null,"y","0%"),i.setAttributeNS(null,"width","100%"),i.setAttributeNS(null,"height","100%"),i.append(t),r.appendChild(i),r}(p,n);return s&&v.insertBefore(s,v.children[0]),a&&v.insertBefore(a,v.children[0]),d&&tt(n),await(f?.(v)),v}async function pt(t,e){const n=await $(t,e),o=await ft(n),r=function(t,e){let n=(new XMLSerializer).serializeToString(t);return e&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}(o,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=B(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(R,"defs"),n.svgStyles.clear());const i=T(r,o.ownerDocument);return await V(i,n)}async function gt(t,e){return async function(t,e){const n=await $(t,e),{log:o,quality:r,type:i,dpi:a}=n,s=await pt(n);o.time("canvas to data url");let c=s.toDataURL(i,r);if(["image/png","image/jpeg"].includes(i)&&a&&h&&m){const[t,e]=c.split(",");let n=0,o=!1;if("image/png"===i){const t=function(t){let e=t.indexOf("AAlwSFlz");return-1===e&&(e=t.indexOf("AAAJcEhZ")),-1===e&&(e=t.indexOf("AAAACXBI")),e}(e);t>=0?(n=4*Math.ceil((t+28)/3),o=!0):n=44}else"image/jpeg"===i&&(n=24);const r=e.substring(0,n),s=e.substring(n),u=window.atob(r),d=new Uint8Array(u.length);for(let t=0;t<d.length;t++)d[t]=u.charCodeAt(t);const h="image/png"===i?l(d,a,o):function(t,e){return t[13]=1,t[14]=e>>8,t[15]=255&e,t[16]=e>>8,t[17]=255&e,t}(d,a);c=[t,",",window.btoa(String.fromCharCode(...h)),s].join("")}return o.timeEnd("canvas to data url"),c}(await $(t,{...e,type:"image/png"}))}var yt={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 wt(t){const e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;const n=e[2].trim();return n.startsWith("#")?null:n}function bt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}var vt=function(t="[snapDOM]",{ttlMs:e=3e5,maxEntries:n=12}={}){const o=new Map;let r=0;function i(t,i,a){if(r>=n)return;const s=Date.now();(o.get(i)||0)>s||(o.set(i,s+e),r++,"warn"===t&&console&&console.warn||console&&console.error)}return{warnOnce(t,e){i("warn",t)},errorOnce(t,e){i("error",t)},reset(){o.clear(),r=0}}}("[snapDOM]",{ttlMs:18e4,maxEntries:10}),xt=new Map,St=new Map;function Ct(t,e){if(!e)return!1;if(function(t){return/^data:|^blob:|^about:blank$/i.test(t)}(t))return!1;if(function(t,e){try{const n="undefined"!=typeof location&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,r=new URL(o||".",n),i=new URL(t,n);if(i.origin===r.origin)return!0;const a=i.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}(t,e))return!1;try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",n=new URL(t,e);return"undefined"==typeof location||n.origin!==location.origin}catch{return!!e}}function Et(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}async function Mt(t,e={}){const n=e.as??"blob",o=e.timeout??3e3,r=e.useProxy||"",i=e.errorTTL??8e3,a=e.headers||{},s=!!e.silent;if(/^data:/i.test(t))try{if("text"===n)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if("dataURL"===n)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};const[,e="",o=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],r=/;base64/i.test(e)?atob(o):decodeURIComponent(o),i=new Uint8Array([...r].map(t=>t.charCodeAt(0))),a=new Blob([i],{type:(e||"").split(";")[0]||""});return{ok:!0,data:a,status:200,url:t,fromCache:!1,mime:a.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{const e=await fetch(t);if(!e.ok)return{ok:!1,data:null,status:e.status,url:t,fromCache:!1,reason:"http_error"};const o=await e.blob(),r=o.type||e.headers.get("content-type")||"";if("dataURL"===n){return{ok:!0,data:await Et(o),status:e.status,url:t,fromCache:!1,mime:r}}if("text"===n){return{ok:!0,data:await o.text(),status:e.status,url:t,fromCache:!1,mime:r}}return{ok:!0,data:o,status:e.status,url:t,fromCache:!1,mime:r}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return"dataURL"===n?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:"text"===n?"":new Blob([]),status:200,url:t,fromCache:!1};const c=function(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}(t,{as:n,timeout:o,useProxy:r,errorTTL:i}),l=St.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&St.delete(c);const u=xt.get(c);if(u)return u;const d=Ct(t,r)?function(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",bt(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}${bt(t)}`;const n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}(t,r):t;let h=e.credentials;if(!h)try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",n=new URL(t,e),o="undefined"!=typeof location&&n.origin===location.origin;h=o?"include":"omit"}catch{h="omit"}const m=new AbortController,f=setTimeout(()=>m.abort("timeout"),o),p=(async()=>{try{const o=await fetch(d,{signal:m.signal,credentials:h,headers:a});if(!o.ok){const r={ok:!1,data:null,status:o.status,url:d,fromCache:!1,reason:"http_error"};if(i>0&&St.set(c,{until:Date.now()+i,result:r}),!s){const e=`${o.status} ${o.statusText||""}`.trim();vt.warnOnce(`http:${o.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${e} while fetching ${n} ${t}`)}return e.onError&&e.onError(r),r}if("text"===n){return{ok:!0,data:await o.text(),status:o.status,url:d,fromCache:!1}}const r=await o.blob(),l=r.type||o.headers.get("content-type")||"";if("dataURL"===n){return{ok:!0,data:await Et(r),status:o.status,url:d,fromCache:!1,mime:l}}return{ok:!0,data:r,status:o.status,url:d,fromCache:!1,mime:l}}catch(r){const a=r&&"object"==typeof r&&"name"in r&&"AbortError"===r.name?String(r.message||"").includes("timeout")?"timeout":"abort":"network",l={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:a};if(!/^blob:/i.test(t)&&i>0&&St.set(c,{until:Date.now()+i,result:l}),!s){const e=`${a}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,r="timeout"===a?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:"abort"===a?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;vt.errorOnce(e,r)}return e.onError&&e.onError(l),l}finally{clearTimeout(f),xt.delete(c)}})();return xt.set(c,p),p}function kt(t,e){if(!e||!t.width||!t.height)return t;const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const o=n.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,n.width,n.height),o.drawImage(t,0,0),n}async function At(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||"none"===t.trim())return t;const n=wt(t);if(!n)return t;const o=bt(n);if(yt.background.has(o)){const t=yt.background.get(o);return t?`url("${t}")`:"none"}try{const t=await Mt(o,{as:"dataURL",useProxy:e.useProxy});return t.ok?(yt.background.set(o,t.data),`url("${t.data}")`):(yt.background.set(o,null),"none")}catch{return yt.background.set(o,null),"none"}}var Lt=new Set(["meta","script","noscript","title","link","template"]),It=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"]);var Rt=/(?:^|-)(animation|transition)(?:-|$)/i,Nt=/^(--|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,Tt=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 Pt(t){const e=String(t).toLowerCase();return!!Tt.has(e)||(!!Nt.test(e)||!!Rt.test(e))}function Ft(t,e){if(e=String(e||"").toLowerCase(),It.has(e))return"";const n=[],o=function(t){if(t=String(t).toLowerCase(),It.has(t)){const e={};return yt.defaultStyle.set(t,e),e}if(yt.defaultStyle.has(t))return yt.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));const n=document.createElement(t);n.style.all="initial",e.appendChild(n);const o=getComputedStyle(n),r={};for(let t of o){if(Pt(t))continue;const e=o.getPropertyValue(t);r[t]=e}return e.removeChild(n),yt.defaultStyle.set(t,r),r}(e);for(let[e,r]of Object.entries(t)){if(Pt(e))continue;const t=o[e];r&&r!==t&&n.push(`${e}:${r}`)}return n.sort(),n.join(";")}function Wt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=yt.computedStyle.get(t);if(n||(n=new Map,yt.computedStyle.set(t,n)),!n.has(e)){const o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Dt(t){const e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function $t(t){const e=[];let n=0,o=0;for(let r=0;r<t.length;r++){const i=t[r];"("===i&&n++,")"===i&&n--,","===i&&0===n&&(e.push(t.slice(o,r).trim()),o=r+1)}return e.push(t.slice(o).trim()),e}function Ht(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function Bt(){const t="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(t),n=/AppleWebKit/i.test(t)&&/Mobile/i.test(t)&&!/Safari/i.test(t),o=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(t);return e||n||o}var Vt=new WeakMap,Ut=new Map,Ot=0;function jt(){Ot++}var zt=!1;var Xt=new WeakMap;function Zt(t,e=null,n={}){const o=Vt.get(t);if(o&&o.epoch===Ot)return o.snapshot;const r=e||getComputedStyle(t),i=function(t,e={}){const n={},o=t.getPropertyValue("visibility");for(let e=0;e<t.length;e++){const o=t[e];let r=t.getPropertyValue(o);"background-image"!==o&&"content"!==o||!r.includes("url(")||r.includes("data:")||(r="none"),n[o]=r}if(e.embedFonts){const e=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(const o of e)if(!n[o])try{const e=t.getPropertyValue(o);e&&(n[o]=e)}catch{}}return"hidden"===o&&(n.opacity="0"),n}(r,n);return function(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;const o=e.display||"";if(o.includes("flex")||o.includes("grid"))return;if(function(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}(t))return;const r=e.position;if("absolute"===r||"fixed"===r||"sticky"===r)return;if("none"!==e.transform)return;if(function(t){if(t.backgroundImage&&"none"!==t.backgroundImage)return!0;if(t.backgroundColor&&"rgba(0, 0, 0, 0)"!==t.backgroundColor&&"transparent"!==t.backgroundColor)return!0;if((parseFloat(t.borderTopWidth)||0)>0)return!0;if((parseFloat(t.borderBottomWidth)||0)>0)return!0;if((parseFloat(t.paddingTop)||0)>0)return!0;if((parseFloat(t.paddingBottom)||0)>0)return!0;const e=t.overflowBlock||t.overflowY||"visible";return"visible"!==e}(e))return;if(function(t){const e=t.parentElement;if(!e)return!1;const n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}(t))return;if(!function(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;const n=t.firstElementChild,o=t.lastElementChild;if(n&&"BR"===n.tagName||o&&"BR"===o.tagName)return!0;const r=t.scrollHeight;if(0===r)return!1;const i=parseFloat(e.paddingTop)||0,a=parseFloat(e.paddingBottom)||0;return r>i+a}(t,e))return;delete n.height,delete n["block-size"]}(t,r,i),Vt.set(t,{epoch:Ot,snapshot:i}),i}async function Gt(t,e,n,o){if("STYLE"===t.tagName)return;const r=function(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Ut,defaultStyle:yt.defaultStyle,baseStyle:yt.baseStyle,image:yt.image,resource:yt.resource,background:yt.background,font:yt.font},options:e||{}}:{session:yt.session,persist:{snapshotKeyCache:Ut,defaultStyle:yt.defaultStyle,baseStyle:yt.baseStyle,image:yt.image,resource:yt.resource,background:yt.background,font:yt.font},options:t||e||{}}}(n,o),i=r.options&&r.options.cache||"auto";if("disabled"!==i&&function(t=document.documentElement){if(!zt){zt=!0;try{new MutationObserver(()=>jt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>jt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{const t=document.fonts;t&&(t.addEventListener?.("loadingdone",jt),t.ready?.then(()=>jt()).catch(()=>{}))}catch{}}}(document.documentElement),"disabled"!==i||r.session.__bumpedForDisabled||(jt(),Ut.clear(),r.session.__bumpedForDisabled=!0),It.has(t.tagName?.toLowerCase())){const n=t.getAttribute?.("style");n&&e.setAttribute("style",n)}const{session:a,persist:s}=r;a.styleCache.has(t)||a.styleCache.set(t,getComputedStyle(t));const c=Zt(t,a.styleCache.get(t),r.options),l=function(t){let e=Xt.get(t);return e||(e=Object.entries(t).sort((t,e)=>t[0]<e[0]?-1:t[0]>e[0]?1:0).map(([t,e])=>`${t}:${e}`).join(";"),Xt.set(t,e),e)}(c);let u=s.snapshotKeyCache.get(l);if(!u){u=Ft(c,t.tagName?.toLowerCase()||"div"),s.snapshotKeyCache.set(l,u)}a.styleMap.set(e,u)}function Yt(t,e,n){return Promise.all(t.map(t=>new Promise(o=>{!function r(){Ht(n=>{!n||"function"!=typeof n.timeRemaining||n.timeRemaining()>0?e(t,o):r()},{fast:n})}()})))}function _t(t,e){return t?t=(t=(t=(t=(t=t.replace(/:host\(([^)]+)\)/g,(t,n)=>`:where(${e}:is(${n.trim()}))`)).replace(/:host\b/g,`:where(${e})`)).replace(/:host-context\(([^)]+)\)/g,(t,n)=>`:where(:where(${n.trim()}) ${e})`)).replace(/::slotted\(([^)]+)\)/g,(t,n)=>`:where(${e} ${n.trim()})`)).replace(/(^|})(\s*)([^@}{]+){/g,(t,n,o,r)=>{const i=function(t,e,n=!0){return t.split(",").map(t=>t.trim()).filter(Boolean).map(t=>{if(t.startsWith(":where("))return t;if(t.startsWith("@"))return t;const o=n?(r=(r=t).trim())?/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(r)?r:`${r}:not([data-sd-slotted])`:r:t;var r;return`:where(${e} ${o})`}).join(", ")}(r,e,!0);return`${n}${o}${i}{`}):""}function qt(t,e){try{let n=getComputedStyle(t).getPropertyValue(e).trim();if(n)return n}catch{}try{let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(t)return t}catch{}return""}async function Jt(t,e,n){const o=await async function(t,e=3){const n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}};let o=n(),r=0;for(;r<e&&(!o||!o.body&&!o.documentElement);)await new Promise(t=>setTimeout(t,0)),o=n(),r++;return o&&(o.body||o.documentElement)?o:null}(t,3);if(!o)throw new Error("iframe document not accessible/ready");const{contentWidth:r,contentHeight:i,rect:a}=function(t){const e=t.getBoundingClientRect();let n=0,o=0,r=0,i=0;try{const e=getComputedStyle(t);n=parseFloat(e.borderLeftWidth)||0,o=parseFloat(e.borderRightWidth)||0,r=parseFloat(e.borderTopWidth)||0,i=parseFloat(e.borderBottomWidth)||0}catch{}return{contentWidth:Math.max(0,Math.round(e.width-(n+o))),contentHeight:Math.max(0,Math.round(e.height-(r+i))),rect:e}}(t),s=n?.snap;if(!s||"function"!=typeof s.toPng)throw new Error("snapdom.toPng not available in iframe or window");const c={...n,scale:1},l=function(t,e,n){const o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(o),()=>{try{o.remove()}catch{}}}(o,r,i);let u;try{u=await s.toPng(o.documentElement,c)}finally{l()}u.style.display="block",u.style.width=`${r}px`,u.style.height=`${i}px`;const d=document.createElement("div");return e.nodeMap.set(d,t),Gt(t,d,e,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(u),d}async function Qt(t,e,n){if(!t)throw new Error("Invalid node");const o=new Set;let r,i=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){const e=(t.localName||t.tagName||"").toLowerCase();if("snapdom-sandbox"===t.id||t.hasAttribute("data-snapdom-sandbox"))return null;if(Lt.has(e))return null}if(t.nodeType===Node.TEXT_NODE)return t.cloneNode(!0);if(t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if("exclude"===t.getAttribute("data-capture")){if("hide"===n.excludeMode){const e=document.createElement("div"),n=t.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,e}if("remove"===n.excludeMode)return null}if(n.exclude&&Array.isArray(n.exclude))for(const e of n.exclude)try{if(t.matches?.(e)){if("hide"===n.excludeMode){const e=document.createElement("div"),n=t.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,e}if("remove"===n.excludeMode)return null}}catch(t){}if("function"==typeof n.filter)try{if(!n.filter(t)){if("hide"===n.filterMode){const e=document.createElement("div"),n=t.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,e}if("remove"===n.filterMode)return null}}catch(t){}if("IFRAME"===t.tagName){let o=!1;try{o=!(!t.contentDocument&&!t.contentWindow?.document)}catch{o=!1}if(o)try{return await Jt(t,e,n)}catch(t){}if(n.placeholders){const o=document.createElement("div");return o.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,Gt(t,o,e,n),o}{const o=t.getBoundingClientRect(),r=document.createElement("div");return r.style.cssText=`display:inline-block;width:${o.width}px;height:${o.height}px;visibility:hidden;`,Gt(t,r,e,n),r}}if("placeholder"===t.getAttribute("data-capture")){const o=t.cloneNode(!1);e.nodeMap.set(o,t),Gt(t,o,e,n);const r=document.createElement("div");return r.textContent=t.getAttribute("data-placeholder-text")||"",r.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",o.appendChild(r),o}if("CANVAS"===t.tagName){const o=t.toDataURL(),r=document.createElement("img");return r.src=o,r.width=t.width,r.height=t.height,e.nodeMap.set(r,t),Gt(t,r,e,n),r}try{if(r=t.cloneNode(!1),function(t,e){if(!(t instanceof Element&&e instanceof Element))return;const n=t.getAttribute?.("style");let o,r=!(!n||!n.includes("var("));if(!r&&t.attributes?.length){const e=t.attributes;for(let t=0;t<e.length;t++){const n=e[t];if(n&&"string"==typeof n.value&&n.value.includes("var(")){r=!0;break}}}if(!r)return;try{o=getComputedStyle(t)}catch{return}const i=t.style;if(i&&i.length)for(let t=0;t<i.length;t++){const n=i[t],r=i.getPropertyValue(n);if(!r||!r.includes("var("))continue;const a=o.getPropertyValue(n);if(a)try{e.style.setProperty(n,a.trim(),i.getPropertyPriority(n))}catch{}}if(t.attributes?.length){const n=t.attributes;for(let t=0;t<n.length;t++){const r=n[t];if(!r||"string"!=typeof r.value||!r.value.includes("var("))continue;const i=r.name;let a="";try{a=o.getPropertyValue(i)}catch{}if(a)try{e.style.setProperty(i,a.trim())}catch{}}}}(t,r),e.nodeMap.set(r,t),"IMG"===t.tagName){!function(t,e){try{const 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{}}(t,r);try{const e=t.getBoundingClientRect();let n=Math.round(e.width||0),o=Math.round(e.height||0);if(!n||!o){const e=window.getComputedStyle(t),r=parseFloat(e.width)||0,i=parseFloat(e.height)||0,a=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,c=t.width||t.naturalWidth||0,l=t.height||t.naturalHeight||0;n=Math.round(n||r||a||c||0),o=Math.round(o||i||s||l||0)}n&&(r.dataset.snapdomWidth=String(n)),o&&(r.dataset.snapdomHeight=String(o))}catch{}}}catch(t){throw t}if(t instanceof HTMLTextAreaElement){const e=t.getBoundingClientRect();r.style.width=`${e.width}px`,r.style.height=`${e.height}px`}if(t instanceof HTMLInputElement&&(r.value=t.value,r.setAttribute("value",t.value),void 0!==t.checked&&(r.checked=t.checked,t.checked&&r.setAttribute("checked",""),t.indeterminate&&(r.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(i=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),Gt(t,r,e,n),t.shadowRoot){let i=function(t,o){if(t.nodeType===Node.ELEMENT_NODE&&"STYLE"===t.tagName)return o(null);Qt(t,e,n).then(t=>{o(t||null)}).catch(()=>{o(null)})};try{const e=t.shadowRoot.querySelectorAll("slot");for(const t of e){let e=[];try{e=t.assignedNodes?.({flatten:!0})||t.assignedNodes?.()||[]}catch{e=t.assignedNodes?.()||[]}for(const t of e)o.add(t)}}catch{}const a=function(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}(e),s=`[data-sd="${a}"]`;try{r.setAttribute("data-sd",a)}catch{}const c=function(t){let e="";try{t.querySelectorAll("style").forEach(t=>{e+=(t.textContent||"")+"\n"});const n=t.adoptedStyleSheets||[];for(const t of n)try{if(t&&t.cssRules)for(const n of t.cssRules)e+=n.cssText+"\n"}catch{}}catch{}return e}(t.shadowRoot),l=_t(c,s),u=function(t,e,n){const o=[];for(const n of e){const e=qt(t,n);e&&o.push(`${n}: ${e};`)}return o.length?`${n}{${o.join("")}}\n`:""}(t,function(t){const e=new Set;if(!t)return e;const n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g;let o;for(;o=n.exec(t);)e.add(o[1]);return e}(c),s);!function(t,e,n){if(!e)return;const o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}(r,u+l,a);const d=document.createDocumentFragment(),h=await Yt(Array.from(t.shadowRoot.childNodes),i,n.fast);d.append(...h.filter(t=>!!t)),r.appendChild(d)}if("SLOT"===t.tagName){let o=function(t,o){Qt(t,e,n).then(t=>{var e;t&&(e=t)&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted",""))),o(t||null)}).catch(()=>{o(null)})};const r=t.assignedNodes?.({flatten:!0})||[],i=r.length>0?r:Array.from(t.childNodes),a=document.createDocumentFragment(),s=await Yt(Array.from(i),o,n.fast);return a.append(...s.filter(t=>!!t)),a}const s=await Yt(Array.from(t.childNodes),function(t,r){if(o.has(t))return r(null);Qt(t,e,n).then(t=>{r(t||null)}).catch(()=>{r(null)})},n.fast);if(r.append(...s.filter(t=>!!t)),null!==i&&r instanceof HTMLSelectElement){r.value=i;for(const t of r.options)t.value===i?t.setAttribute("selected",""):t.removeAttribute("selected")}return null!==a&&r instanceof HTMLTextAreaElement&&(r.textContent=a),r}var Kt=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],te=[];function ee(t){const e="string"==typeof t?t:"",n=[...Kt,...te];for(const t of n)if(t instanceof RegExp&&t.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function ne(t,e,n,o=32,r="#000"){e=e.replace(/^['"]+|['"]+$/g,"");const i=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}const a=document.createElement("span");a.textContent=t,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${e}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${o}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);const s=a.getBoundingClientRect(),c=Math.ceil(s.width),l=Math.ceil(s.height);document.body.removeChild(a);const u=document.createElement("canvas");u.width=Math.max(1,c*i),u.height=Math.max(1,l*i);const d=u.getContext("2d");return d.scale(i,i),d.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=r,d.fillText(t,0,0),{dataUrl:u.toDataURL(),width:c,height:l}}var oe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function re(t){if(!t)return"";for(let e of t.split(",")){let t=e.trim().replace(/^['"]+|['"]+$/g,"");if(t&&!oe.has(t.toLowerCase()))return t}return""}function ie(t){const e=String(t??"400").trim().toLowerCase();if("normal"===e)return 400;if("bold"===e)return 700;const n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function ae(t){const e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function se(t,e){if(!t)return!1;try{const n=new URL(t,location.href);if(n.origin===location.origin)return!0;const o=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(t=>o.endsWith(t)))return!0;const r=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(r)||/\.woff2?(\b|$)/.test(r))return!0;for(const t of e){const e=t.toLowerCase().replace(/\s+/g,"+"),n=t.toLowerCase().replace(/\s+/g,"-");if(r.includes(e)||r.includes(n))return!0}return!1}catch{return!1}}function ce(t,e){return t?t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(t,n,o)=>{const r=(o||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return t;let i=r;try{i=new URL(r,e||location.href).href}catch{}return`url("${i}")`}):t}var le=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g;async function ue(t,e,n){if(!t)return t;const o=new Set;function r(t,e){try{return new URL(t,e||location.href).href}catch{return t}}let i=ce(t,e||location.href);return i=await async function t(e,i,a=0){if(a>4)return e;let s,c="",l=0;for(;s=le.exec(e);){c+=e.slice(l,s.index),l=le.lastIndex;const u=r((s[2]||s[4]||"").trim(),i);if(o.has(u))continue;o.add(u);let d="";try{const t=await Mt(u,{as:"text",useProxy:n,silent:!0});t.ok&&"string"==typeof t.data&&(d=t.data)}catch{}d?(d=ce(d,u),d=await t(d,u,a+1),c+=`\n/* inlined: ${u} */\n${d}\n`):c+=s[0]}return c+=e.slice(l),c}(i,e||location.href,0),i}var de=/url\((["']?)([^"')]+)\1\)/g,he=/@font-face[^{}]*\{[^}]*\}/g;function me(t){if(!t)return[];const e=[],n=t.split(",").map(t=>t.trim()).filter(Boolean);for(const t of n){const n=t.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!n)continue;const o=n[1],r=n[2],i=t=>{if(!t.includes("?"))return parseInt(t,16);return[parseInt(t.replace(/\?/g,"0"),16),parseInt(t.replace(/\?/g,"F"),16)]};if(r){const t=i(o),n=i(r),a=Array.isArray(t)?t[0]:t,s=Array.isArray(n)?n[1]:n;e.push([Math.min(a,s),Math.max(a,s)])}else{const t=i(o);Array.isArray(t)?e.push([t[0],t[1]]):e.push([t,t])}}return e}function fe(t,e){if(!e.length)return!0;if(!t||0===t.size)return!0;for(const n of t)for(const[t,o]of e)if(n>=t&&n<=o)return!0;return!1}function pe(t,e){const n=[];if(!t)return n;for(const o of t.matchAll(de)){let t=(o[2]||"").trim();if(t&&!t.startsWith("data:")){if(!/^https?:/i.test(t))try{t=new URL(t,e||location.href).href}catch{}n.push(t)}}return n}async function ge(t,e,n=""){let o=t;for(const r of t.matchAll(de)){const t=wt(r[0]);if(!t)continue;let i=t;if(!i.startsWith("http")&&!i.startsWith("data:"))try{i=new URL(i,e||location.href).href}catch{}if(!ee(i))if(yt.resource?.has(i))yt.font?.add(i),o=o.replace(r[0],`url(${yt.resource.get(i)})`);else if(!yt.font?.has(i))try{const t=await Mt(i,{as:"dataURL",useProxy:n,silent:!0});if(t.ok&&"string"==typeof t.data){const e=t.data;yt.resource?.set(i,e),yt.font?.add(i),o=o.replace(r[0],`url(${e})`)}}catch{}}return o}function ye(t={}){const e=new Set((t.families||[]).map(t=>String(t).toLowerCase())),n=new Set((t.domains||[]).map(t=>String(t).toLowerCase())),o=new Set((t.subsets||[]).map(t=>String(t).toLowerCase()));return(t,r)=>{if(e.size&&e.has(t.family.toLowerCase()))return!0;if(n.size)for(const e of t.srcUrls)try{if(n.has(new URL(e).host.toLowerCase()))return!0}catch{}if(o.size){const t=function(t){if(!t.length)return null;const e=(e,n)=>t.some(([t,o])=>!(o<e||t>n)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),r=e(880,1023),i=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":i?"cyrillic":r?"greek":o?"latin-ext":n?"latin":null}(r);if(t&&o.has(t))return!0}return!1}}async function we(t,e,n,o){let r;try{r=t.cssRules||[]}catch{return}const i=(t,e)=>{try{return new URL(t,e||location.href).href}catch{return t}};for(const t of r){if(t.type===CSSRule.IMPORT_RULE&&t.styleSheet){const r=t.href?i(t.href,e):e;if(o.depth>=4)continue;if(r&&o.visitedSheets.has(r))continue;r&&o.visitedSheets.add(r);const a={...o,depth:(o.depth||0)+1};await we(t.styleSheet,r,n,a);continue}if(t.type===CSSRule.FONT_FACE_RULE){const r=re((t.style.getPropertyValue("font-family")||"").trim());if(!r||ee(r))continue;const i=(t.style.getPropertyValue("font-weight")||"400").trim(),a=(t.style.getPropertyValue("font-style")||"normal").trim(),s=(t.style.getPropertyValue("font-stretch")||"100%").trim(),c=(t.style.getPropertyValue("src")||"").trim(),l=(t.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(r,a,i,s))continue;const u=me(l);if(!fe(o.usedCodepoints,u))continue;const d={family:r,weightSpec:i,styleSpec:a,stretchSpec:s,unicodeRange:l,srcRaw:c,srcUrls:pe(c,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(d,u))continue;if(/url\(/i.test(c)){const t=await ge(c,e||location.href,o.useProxy);await n(`@font-face{font-family:${r};src:${t};font-style:${a};font-weight:${i};font-stretch:${s};${l?`unicode-range:${l};`:""}}`)}else await n(`@font-face{font-family:${r};src:${c};font-style:${a};font-weight:${i};font-stretch:${s};${l?`unicode-range:${l};`:""}}`)}}}async function be({required:t,usedCodepoints:e,exclude:n,localFonts:o=[],useProxy:r=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);const i=new Map;for(const e of t){const[t,n,o,r]=String(e).split("__");if(!t)continue;const a=i.get(t)||[];a.push({w:parseInt(n,10),s:o,st:parseInt(r,10)}),i.set(t,a)}function a(t,e,n,o){if(!i.has(t))return!1;const r=i.get(t),a=function(t){const e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){const t=ie(n[1]),e=ie(n[2]);return{min:Math.min(t,e),max:Math.max(t,e)}}const o=ie(e);return{min:o,max:o}}(n),s=function(t){const e=String(t||"normal").trim().toLowerCase();return"italic"===e?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}(e),c=function(t){const e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){const t=parseFloat(n[1]),e=parseFloat(n[2]);return{min:Math.min(t,e),max:Math.max(t,e)}}const o=e.match(/(\d+(?:\.\d+)?)\s*%/),r=o?parseFloat(o[1]):100;return{min:r,max:r}}(o),l=a.min!==a.max,u=a.min,d=t=>"normal"===s.kind&&"normal"===t||"normal"!==s.kind&&("italic"===t||"oblique"===t);let h=!1;for(const t of r){const e=l?t.w>=a.min&&t.w<=a.max:t.w===u,n=d(ae(t.s)),o=t.st>=c.min&&t.st<=c.max;if(e&&n&&o){h=!0;break}}if(h)return!0;if(!l)for(const t of r){const e=d(ae(t.s)),n=t.st>=c.min&&t.st<=c.max;if(Math.abs(u-t.w)<=300&&e&&n)return!0}return!1}const s=ye(n),c=function(t,e,n,o){return`fonts-embed-css::req=${Array.from(t||[]).sort().join("|")}::ex=${e?JSON.stringify({families:(e.families||[]).map(t=>String(t).toLowerCase()).sort(),domains:(e.domains||[]).map(t=>String(t).toLowerCase()).sort(),subsets:(e.subsets||[]).map(t=>String(t).toLowerCase()).sort()}):""}::lf=${(n||[]).map(t=>`${(t.family||"").toLowerCase()}::${t.weight||"normal"}::${t.style||"normal"}::${t.src||""}`).sort().join("|")}::px=${o||""}`}(t,n,o,r);if(yt.resource?.has(c))return yt.resource.get(c);const l=function(t){const e=new Set;for(const n of t||[]){const t=String(n).split("__")[0]?.trim();t&&e.add(t)}return e}(t),u=[],d=le;for(const t of document.querySelectorAll("style")){const e=t.textContent||"";for(const t of e.matchAll(d)){const e=(t[2]||t[4]||"").trim();if(!e||ee(e))continue;!!document.querySelector(`link[rel="stylesheet"][href="${e}"]`)||u.push(e)}}u.length&&await Promise.all(u.map(t=>new Promise(e=>{if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return e(null);const n=document.createElement("link");n.rel="stylesheet",n.href=t,n.setAttribute("data-snapdom","injected-import"),n.onload=()=>e(n),n.onerror=()=>e(null),document.head.appendChild(n)})));let h="";const m=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(t=>!!t.href);for(const t of m)try{if(ee(t.href))continue;let o="",i=!1;try{i=new URL(t.href,location.href).origin===location.origin}catch{}if(!i&&!se(t.href,l))continue;if(i){const e=Array.from(document.styleSheets).find(e=>e.href===t.href);if(e)try{const t=e.cssRules||[];o=Array.from(t).map(t=>t.cssText).join("")}catch{}}if(!o){if(o=(await Mt(t.href,{as:"text",useProxy:r})).data,ee(t.href))continue}o=await ue(o,t.href,r);let c="";for(const i of o.match(he)||[]){const o=re((i.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim());if(!o||ee(o))continue;const l=(i.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),u=(i.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),d=(i.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),h=(i.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(i.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),f=pe(m,t.href);if(!a(o,u,l,d))continue;const p=me(h);if(!fe(e,p))continue;const g={family:o,weightSpec:l,styleSpec:u,stretchSpec:d,unicodeRange:h,srcRaw:m,srcUrls:f,href:t.href};if(n&&s(g,p))continue;c+=/url\(/i.test(m)?await ge(i,t.href,r):i}c.trim()&&(h+=c)}catch{}const f={requiredIndex:i,usedCodepoints:e,faceMatchesRequired:a,simpleExcluder:n?ye(n):null,useProxy:r,visitedSheets:new Set,depth:0};for(const t of document.styleSheets)if(!t.href||!m.some(e=>e.href===t.href))try{const e=t.href||location.href;e&&f.visitedSheets.add(e),await we(t,e,async t=>{h+=t},f)}catch{}try{for(const t of document.fonts||[]){if(!t||!t.family||"loaded"!==t.status||!t._snapdomSrc)continue;const e=String(t.family).replace(/^['"]+|['"]+$/g,"");if(ee(e))continue;if(!i.has(e))continue;if(n?.families&&n.families.some(t=>String(t).toLowerCase()===e.toLowerCase()))continue;let o=t._snapdomSrc;if(!String(o).startsWith("data:"))if(yt.resource?.has(t._snapdomSrc))o=yt.resource.get(t._snapdomSrc),yt.font?.add(t._snapdomSrc);else if(!yt.font?.has(t._snapdomSrc))try{const e=await Mt(t._snapdomSrc,{as:"dataURL",useProxy:r,silent:!0});if(!e.ok||"string"!=typeof e.data)continue;o=e.data,yt.resource?.set(t._snapdomSrc,o),yt.font?.add(t._snapdomSrc)}catch{continue}h+=`@font-face{font-family:'${e}';src:url(${o});font-style:${t.style||"normal"};font-weight:${t.weight||"normal"};}`}}catch{}for(const t of o){if(!t||"object"!=typeof t)continue;const e=String(t.family||"").replace(/^['"]+|['"]+$/g,"");if(!e||ee(e))continue;if(!i.has(e))continue;if(n?.families&&n.families.some(t=>String(t).toLowerCase()===e.toLowerCase()))continue;const o=null!=t.weight?String(t.weight):"normal",a=null!=t.style?String(t.style):"normal",s=null!=t.stretchPct?`${t.stretchPct}%`:"100%",c=String(t.src||"");let l=c;if(!l.startsWith("data:"))if(yt.resource?.has(c))l=yt.resource.get(c),yt.font?.add(c);else if(!yt.font?.has(c))try{const t=await Mt(c,{as:"dataURL",useProxy:r,silent:!0});if(!t.ok||"string"!=typeof t.data)continue;l=t.data,yt.resource?.set(c,l),yt.font?.add(c)}catch{continue}h+=`@font-face{font-family:'${e}';src:url(${l});font-style:${a};font-weight:${o};font-stretch:${s};}`}return h&&(h=function(t){if(!t)return t;const e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(const r of t.match(e)||[]){const t=re(r.match(/font-family:\s*([^;]+);/i)?.[1]||""),e=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),i=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),a=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),s=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),c=(r.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),l=pe(c,location.href),u=l.length?l.map(t=>String(t).toLowerCase()).sort().join("|"):c.toLowerCase(),d=[String(t||"").toLowerCase(),e,i,a,s.toLowerCase(),u].join("|");n.has(d)||(n.add(d),o.push(r))}if(0===o.length)return t;let r=0;return t.replace(e,()=>o[r++]||"")}(h),yt.resource?.set(c,h)),h}function ve(t){const e=new Set;if(!t)return e;const n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=t=>{const n=re(t.fontFamily);if(!n)return;var o,r,i;e.add((o=t.fontWeight,r=t.fontStyle,i=t.fontStretch,`${n}__${ie(o)}__${ae(r)}__${function(t){const e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}(i)}`))};o(getComputedStyle(t));const r=getComputedStyle(t,"::before");r&&r.content&&"none"!==r.content&&o(r);const i=getComputedStyle(t,"::after");for(i&&i.content&&"none"!==i.content&&o(i);n.nextNode();){const t=n.currentNode;o(getComputedStyle(t));const e=getComputedStyle(t,"::before");e&&e.content&&"none"!==e.content&&o(e);const r=getComputedStyle(t,"::after");r&&r.content&&"none"!==r.content&&o(r)}return e}function xe(t,e=!1){let n="",o=Math.max(1,t);for(;o>0;)o--,n=String.fromCharCode(97+o%26)+n,o=Math.floor(o/26);return e?n.toUpperCase():n}function Se(t,e=!0){const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let o=Math.max(1,Math.min(3999,t)),r="";for(const[t,e]of n)for(;o>=t;)r+=e,o-=t;return e?r:r.toLowerCase()}function Ce(t,e){switch((e||"decimal").toLowerCase()){case"decimal":default:return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return xe(t,!1);case"upper-alpha":return xe(t,!0);case"lower-roman":return Se(t,!1);case"upper-roman":return Se(t,!0)}}function Ee(t){const e=new WeakMap,n=t instanceof Document?t.documentElement:t,o=t=>{let e=0,n=t?.parentElement;if(!n)return 0;for(const o of n.children){if(o===t)break;"LI"===o.tagName&&e++}return e},r=(t,e,n)=>{const r=(t=>{const e=new Map;for(const[n,o]of t)e.set(n,o.slice());return e})(t);let i,a;try{i=n.style?.counterReset||getComputedStyle(n).counterReset}catch{}if(i&&"none"!==i)for(const t of i.split(",")){const n=t.trim().split(/\s+/),o=n[0],i=Number.isFinite(Number(n[1]))?Number(n[1]):0;if(!o)continue;const a=e.get(o);if(a&&a.length){const t=a.slice();t.push(i),r.set(o,t)}else r.set(o,[i])}try{a=n.style?.counterIncrement||getComputedStyle(n).counterIncrement}catch{}if(a&&"none"!==a)for(const t of a.split(",")){const e=t.trim().split(/\s+/),n=e[0],o=Number.isFinite(Number(e[1]))?Number(e[1]):1;if(!n)continue;const i=r.get(n)||[];0===i.length&&i.push(0),i[i.length-1]+=o,r.set(n,i)}try{if("list-item"===getComputedStyle(n).display&&(t=>t&&"LI"===t.tagName)(n)){const t=n.parentElement;let e=1;if(t&&"OL"===t.tagName){const r=t.getAttribute("start"),i=Number.isFinite(Number(r))?Number(r):1,a=o(n),s=n.getAttribute("value");e=Number.isFinite(Number(s))?Number(s):i+a}else e=1+o(n);const i=r.get("list-item")||[];0===i.length&&i.push(0),i[i.length-1]=e,r.set("list-item",i)}}catch{}return r},i=(t,n,o)=>{const a=r(o,n,t);e.set(t,a);let s=a;for(const e of t.children){s=i(e,a,s)}return a},a=new Map;return i(n,a,a),{get(t,n){const o=e.get(t)?.get(n);return o&&o.length?o[o.length-1]:0},getStack(t,n){const o=e.get(t)?.get(n);return o?o.slice():[]}}}var Me=null,ke=new WeakMap;function Ae(t,e){const n=t.parentElement,o=n?ke.get(n):null;return o?{get(t,n){const r=e.get(t,n),i=o.get(n);return"number"==typeof i?Math.max(r,i):r},getStack(t,n){const r=e.getStack(t,n);if(!r.length)return r;const i=o.get(n);if("number"==typeof i){const t=r.slice();return t[t.length-1]=Math.max(t[t.length-1],i),t}return r}}:e}function Le(t,e,n){const o=new Map;function r(t){const e=[];if(!t||"none"===t)return e;for(const n of String(t).split(",")){const t=n.trim().split(/\s+/),o=t[0],r=Number.isFinite(Number(t[1]))?Number(t[1]):void 0;o&&e.push({name:o,num:r})}return e}const i=r(e?.counterReset),a=r(e?.counterIncrement);function s(e){if(o.has(e))return o.get(e).slice();let r=n.getStack(t,e);r=r.length?r.slice():[];const s=i.find(t=>t.name===e);if(s){const t=Number.isFinite(s.num)?s.num:0;r=r.length?[...r,t]:[t]}const c=a.find(t=>t.name===e);if(c){const t=Number.isFinite(c.num)?c.num:1;0===r.length&&(r=[0]),r[r.length-1]+=t}return o.set(e,r.slice()),r}return{get(t,e){const n=s(e);return n.length?n[n.length-1]:0},getStack:(t,e)=>s(e),__incs:a}}function Ie(t,e,n){let o;try{o=getComputedStyle(t,e)}catch{}const r=o?.content;if(!r||"none"===r||"normal"===r)return{text:"",incs:[]};const i=Le(t,o,Ae(t,n));let a=/\bcounter\s*\(|\bcounters\s*\(/.test(r||"")?function(t,e,n){if(!t||"none"===t)return t;try{const o=/\b(counter|counters)\s*\(([^)]+)\)/g;return(t.replace(o,(t,o,r)=>{const i=String(r).split(",").map(t=>t.trim());if("counter"===o){const t=i[0]?.replace(/^["']|["']$/g,""),o=(i[1]||"decimal").toLowerCase();return Ce(n.get(e,t),o)}{const t=i[0]?.replace(/^["']|["']$/g,""),o=i[1]?.replace(/^["']|["']$/g,"")??"",r=(i[2]||"decimal").toLowerCase(),a=n.getStack(e,t);return a.length?a.map(t=>Ce(t,r)).join(o):""}})||"").replace(/"([^"]*)"/g,"$1")}catch{return"- "}}(r,t,i):r;const s=function(t){if(!t)return"";const e=[],n=/"([^"]*)"/g;let o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):(t||"").replace(/"([^"]*)"/g,"$1")}(a);return{text:s,incs:i.__incs||[]}}async function Re(t,e,n,o){if(!(t instanceof Element&&e instanceof Element))return;if(!Me)try{Me=Ee(t.ownerDocument||document)}catch{}for(const r of["::before","::after","::first-letter"])try{const i=Wt(t,r);if(!i||"function"!=typeof i[Symbol.iterator])continue;if(!("none"!==i.content||"none"!==i.backgroundImage||"transparent"!==i.backgroundColor||"none"!==i.borderStyle&&0!==parseFloat(i.borderWidth)||i.transform&&"none"!==i.transform||"inline"!==i.display))continue;if("::first-letter"===r){const o=getComputedStyle(t);if(!(i.color!==o.color||i.fontSize!==o.fontSize||i.fontWeight!==o.fontWeight))continue;const r=Array.from(e.childNodes).find(t=>t.nodeType===Node.TEXT_NODE&&t.textContent?.trim().length>0);if(!r)continue;const a=r.textContent,s=a.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),c=s?.[0],l=a.slice(c?.length||0);if(!c||/[\uD800-\uDFFF]/.test(c))continue;const u=document.createElement("span");u.textContent=c,u.dataset.snapdomPseudo="::first-letter";const d=Ft(Dt(i),"span");n.styleMap.set(u,d);const h=document.createTextNode(l);e.replaceChild(h,r),e.insertBefore(u,h);continue}const a=i.content,{text:s,incs:c}=Ie(t,r,Me),l=i.backgroundImage,u=i.backgroundColor,d=i.fontFamily,h=parseInt(i.fontSize)||32,m=parseInt(i.fontWeight)||!1,f=i.color||"#000",p=i.borderStyle,g=parseFloat(i.borderWidth),y=i.transform,w=ee(d),b="none"!==a&&""!==s,v=l&&"none"!==l,x=u&&"transparent"!==u&&"rgba(0, 0, 0, 0)"!==u,S=p&&"none"!==p&&g>0,C=y&&"none"!==y;if(!(b||v||x||S||C)){if(c&&c.length&&t.parentElement){const e=ke.get(t.parentElement)||new Map;for(const{name:n}of c){if(!n)continue;const o=Ae(t,Me),i=Le(t,getComputedStyle(t,r),o).get(t,n);e.set(n,i)}ke.set(t.parentElement,e)}continue}const E=document.createElement("span");E.dataset.snapdomPseudo=r,E.style.verticalAlign="middle",E.style.pointerEvents="none";const M=Ft(Dt(i),"span");if(n.styleMap.set(E,M),w&&s&&1===s.length){const{dataUrl:t,width:n,height:o}=await ne(s,d,m,h,f),r=document.createElement("img");r.src=t,r.style=`height:${h}px;width:${n/o*h}px;object-fit:contain;`,E.appendChild(r),e.dataset.snapdomHasIcon="true"}else if(s&&s.startsWith("url(")){const t=wt(s);if(t?.trim())try{const e=document.createElement("img"),n=await Mt(bt(t),{as:"dataURL",useProxy:o.useProxy});e.src=n.data,e.style=`width:${h}px;height:auto;object-fit:contain;`,E.appendChild(e)}catch(t){}}else!w&&b&&(E.textContent=s);if(E.style.background="none","mask"in E.style&&(E.style.mask="none"),v)try{const t=$t(l),e=await Promise.all(t.map(At));E.style.backgroundImage=e.join(", ")}catch(t){}x&&(E.style.backgroundColor=u);const k=E.childNodes.length>0||""!==E.textContent?.trim()||v||x||S||C;if(c&&c.length&&t.parentElement){const e=ke.get(t.parentElement)||new Map,n=Ae(t,Me),o=Le(t,getComputedStyle(t,r),n);for(const{name:n}of c){if(!n)continue;const r=o.get(t,n);e.set(n,r)}ke.set(t.parentElement,e)}if(!k)continue;"::before"===r?e.insertBefore(E,e.firstChild):e.appendChild(E)}catch(t){}const r=Array.from(t.children),i=Array.from(e.children).filter(t=>!t.dataset.snapdomPseudo);for(let t=0;t<Math.min(r.length,i.length);t++)await Re(r[t],i[t],n,o)}function Ne(t){if(!t||"auto"===t)return null;const e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Te(t,e){const n=[];for(let o=t;o&&o!==e;){const t=o.parentElement;if(!t)break;n.push(Array.prototype.indexOf.call(t.children,o)),o=t}return n.reverse()}function Pe(t,e,n){let o=t;for(let t=0;t<e.length;t++){if(o=Fe(o,n)[e[t]],!o)return null}return o instanceof HTMLElement?o:null}function Fe(t,e){const n=[],o=t.children;for(let t=0;t<o.length;t++){const r=o[t];r.hasAttribute(e)||n.push(r)}return n}async function We(t,e={}){const n={styleMap:yt.session.styleMap,styleCache:yt.session.styleCache,nodeMap:yt.session.nodeMap};let o,r="",i="";!function(t){const e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,r=e.borderStyle,i=e.borderWidth,a="none"!==n&&parseFloat(o)>0,s="none"===r||0===parseFloat(i);a&&s&&(t.style.border=`${o} solid transparent`)}(t);try{!function(t){if(!t)return;const e=new Set;if(t.querySelectorAll("use").forEach(t=>{const n=t.getAttribute("xlink:href")||t.getAttribute("href");n&&n.startsWith("#")&&e.add(n.slice(1))}),!e.size)return;const n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),o=n.filter(t=>"symbol"===t.tagName.toLowerCase()),r=n.filter(t=>"defs"===t.tagName.toLowerCase());let i=t.querySelector("svg.inline-defs-container");i||(i=document.createElementNS("http://www.w3.org/2000/svg","svg"),i.setAttribute("aria-hidden","true"),i.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),i.classList.add("inline-defs-container"),t.insertBefore(i,t.firstChild));const a=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(t=>{a.add(t.id)}),e.forEach(t=>{if(a.has(t))return;const e=o.find(e=>e.id===t);if(e)return i.appendChild(e.cloneNode(!0)),void a.add(t);for(const e of r){const n=e.querySelector(`#${CSS.escape(t)}`);if(n){let e=i.querySelector("defs");e||(e=document.createElementNS("http://www.w3.org/2000/svg","defs"),i.appendChild(e)),e.appendChild(n.cloneNode(!0)),a.add(t);break}}})}(t)}catch(t){}try{o=await Qt(t,n,e)}catch(t){throw t}try{await Re(t,o,n,e)}catch(t){}await async function(t){if(!t)return;const e=t.querySelectorAll?t.querySelectorAll("img"):[];for(const t of e)try{const e=t.getAttribute("src")||t.currentSrc||"";if(Ve(e)){const n=await $e(e);t.setAttribute("src",n)}const n=t.getAttribute("srcset");if(n&&n.includes("blob:")){const e=Ue(n);let o=!1;for(const t of e)if(Ve(t.url))try{t.url=await $e(t.url),o=!0}catch{}o&&t.setAttribute("srcset",Oe(e))}}catch{}const n=t.querySelectorAll?t.querySelectorAll("image"):[];for(const t of n)try{const e="http://www.w3.org/1999/xlink",n=t.getAttribute("href")||t.getAttributeNS?.(e,"href");if(Ve(n)){const o=await $e(n);t.setAttribute("href",o),t.removeAttributeNS?.(e,"href")}}catch{}const o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(const t of o)try{const e=t.getAttribute("style");if(e&&e.includes("blob:")){const n=await Be(e);t.setAttribute("style",n)}}catch{}const r=t.querySelectorAll?t.querySelectorAll("style"):[];for(const t of r)try{const e=t.textContent||"";e.includes("blob:")&&(t.textContent=await Be(e))}catch{}const i=["poster"];for(const e of i){const n=t.querySelectorAll?t.querySelectorAll(`[${e}^='blob:']`):[];for(const t of n)try{const n=t.getAttribute(e);Ve(n)&&t.setAttribute(e,await $e(n))}catch{}}}(o);try{const t=o.querySelectorAll("style[data-sd]");for(const e of t)i+=e.textContent||"",e.remove()}catch{}const a=function(t){const e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map;let o=1;for(const t of e)n.set(t,"c"+o++);return n}(n.styleMap);r=Array.from(a.entries()).map(([t,e])=>`.${e}{${t}}`).join(""),r=i+r;for(const[t,e]of n.styleMap.entries()){if("STYLE"===t.tagName)continue;if(t.getRootNode&&t.getRootNode()instanceof ShadowRoot){t.setAttribute("style",e.replace(/;/g,"; "));continue}const n=a.get(e);n&&t.classList.add(n);const o=t.style?.backgroundImage,r=t.dataset?.snapdomHasIcon;o&&"none"!==o&&(t.style.backgroundImage=o),r&&(t.style.verticalAlign="middle",t.style.display="inline")}for(const[t,e]of n.nodeMap.entries()){const n=e.scrollLeft,o=e.scrollTop;if((n||o)&&t instanceof HTMLElement){t.style.overflow="hidden",t.style.scrollbarWidth="none",t.style.msOverflowStyle="none";const e=document.createElement("div");for(e.style.transform=`translate(${-n}px, ${-o}px)`,e.style.willChange="transform",e.style.display="inline-block",e.style.width="100%";t.firstChild;)e.appendChild(t.firstChild);t.appendChild(e)}}if(function(t,e){if(!t||!e)return;const n=t.scrollTop||0;if(!n)return;"static"===getComputedStyle(e).position&&(e.style.position="relative");const o=t.getBoundingClientRect(),r=t.clientHeight,i="data-snap-ph",a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){const s=a.currentNode,c=getComputedStyle(s),l=c.position;if("sticky"!==l&&"-webkit-sticky"!==l)continue;const u=Ne(c.top),d=Ne(c.bottom);if(null==u&&null==d)continue;const h=Pe(e,Te(s,t),i);if(!h)continue;const m=s.getBoundingClientRect(),f=m.width,p=m.height,g=m.left-o.left;if(!(f>0&&p>0))continue;if(!Number.isFinite(g))continue;const y=null!=u?u+n:n+(r-p-d);if(!Number.isFinite(y))continue;const w=Number.parseInt(c.zIndex,10),b=Number.isFinite(w),v=b?Math.max(w,1)+1:2,x=b?w-1:0,S=h.cloneNode(!1);S.setAttribute(i,"1"),S.style.position="sticky",S.style.left=`${g}px`,S.style.top=`${y}px`,S.style.width=`${f}px`,S.style.height=`${p}px`,S.style.visibility="hidden",S.style.zIndex=String(x),S.style.overflow="hidden",S.style.background="transparent",S.style.boxShadow="none",S.style.filter="none",h.parentElement?.insertBefore(S,h),h.style.position="absolute",h.style.left=`${g}px`,h.style.top=`${y}px`,h.style.bottom="auto",h.style.zIndex=String(v),h.style.pointerEvents="none"}}(t,o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o),t===n.nodeMap.get(o)){const e=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,e);const r=function(t){if(!t||"none"===t)return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(t,e)=>{const n=e.split(",").map(t=>t.trim());return 6!==n.length?`matrix(${e})`:(n[4]="0",n[5]="0",`matrix(${n.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(t,e)=>{const n=e.split(",").map(t=>t.trim());return 16!==n.length?`matrix3d(${e})`:(n[12]="0",n[13]="0",`matrix3d(${n.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}(e.transform);o.style.margin="0",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.animation="none",o.style.transition="none",o.style.willChange="auto",o.style.float="none",o.style.clear="none",o.style.transform=r||""}for(const[t,e]of n.nodeMap.entries())"PRE"===e.tagName&&(t.style.marginTop="0",t.style.marginBlockStart="0");return{clone:o,classCSS:r,styleCache:n.styleCache}}var De=new Map;async function $e(t){if(yt.resource?.has(t))return yt.resource.get(t);if(De.has(t))return De.get(t);const e=(async()=>{const e=await Mt(t,{as:"dataURL",silent:!0});if(!e.ok||"string"!=typeof e.data)throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return yt.resource?.set(t,e.data),e.data})();De.set(t,e);try{const n=await e;return De.set(t,n),n}catch(e){throw De.delete(t),e}}var He=/\bblob:[^)"'\s]+/g;async function Be(t){if(!t||-1===t.indexOf("blob:"))return t;const e=Array.from(new Set(t.match(He)||[]));if(0===e.length)return t;let n=t;for(const t of e)try{const e=await $e(t);n=n.split(t).join(e)}catch{}return n}function Ve(t){return"string"==typeof t&&t.startsWith("blob:")}function Ue(t){return(t||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{const e=t.match(/^(\S+)(\s+.+)?$/);return e?{url:e[1],desc:e[2]||""}:null}).filter(Boolean)}function Oe(t){return t.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}function je(t){if(!t)return()=>{};const e=function(t){const e=getComputedStyle(t);let n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();const o=parseInt(n,10);return Number.isFinite(o)&&o>0?o:0}(t);if(e<=0)return()=>{};if(!function(t){return!(t.childElementCount>0)&&Array.from(t.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}(t))return()=>{};const n=getComputedStyle(t),o=Math.round(function(t){const e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return e&&"normal"!==e?e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(1.2*n):Math.round(1.2*n)}(n)*e+function(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}(n)),r=t.textContent??"",i=r;if(t.scrollHeight<=o+.5)return()=>{};let a=0,s=r.length,c=-1;for(;a<=s;){const e=a+s>>1;t.textContent=r.slice(0,e)+"…",t.scrollHeight<=o+.5?(c=e,a=e+1):s=e-1}return t.textContent=(c>=0?r.slice(0,c):"")+"…",()=>{t.textContent=i}}async function ze(t,e){if(!t)throw new Error("Element cannot be null or undefined");!function(t="soft"){switch(t){case"auto":return yt.session.styleMap=new Map,void(yt.session.nodeMap=new Map);case"soft":default:return yt.session.styleMap=new Map,yt.session.nodeMap=new Map,void(yt.session.styleCache=new WeakMap);case"full":return;case"disabled":yt.session.styleMap=new Map,yt.session.nodeMap=new Map,yt.session.styleCache=new WeakMap,yt.computedStyle=new WeakMap,yt.baseStyle=new Map,yt.defaultStyle=new Map,yt.image=new Map,yt.background=new Map,yt.resource=new Map,yt.font=new Set}}(e.cache);const n=e.fast,o=!!e.straighten,r=!!e.noShadows;let i,a,s,c,l,u="",d="",h=null;const m=je(t);try{({clone:i,classCSS:a,styleCache:s}=await We(t,e)),o&&i&&(h=function(t,e){if(!t||!e||!e.style)return null;const n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}const o=n.transform||"none";if("none"===o)try{const n=Ze(t);if(1===n.a&&0===n.b&&0===n.c&&1===n.d)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}const r=o.match(/^matrix\(\s*([^)]+)\)$/i);if(r){const t=r[1].split(",").map(t=>parseFloat(t.trim()));if(6===t.length&&t.every(Number.isFinite)){const[n,o,r,i]=t,a=Math.sqrt(n*n+o*o)||0;let s=0,c=0,l=0,u=0,d=0,h=0;a>0&&(s=n/a,c=o/a,l=s*r+c*i,u=r-s*l,d=i-c*l,h=Math.sqrt(u*u+d*d)||0,h>0?l/=h:l=0);const m=a,f=0,p=l*h,g=h;try{e.style.transform=`matrix(${m}, ${f}, ${p}, ${g}, 0, 0)`}catch{}return{a:m,b:f,c:p,d:g}}}try{const t=String(o).trim();return e.style.transform=t+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}(t,i)),r&&i&&function(t,e){if(!t||!e||!e.style)return;const n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}const o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}(t,i)}finally{m()}await new Promise(t=>{Ht(async()=>{await async function(t,e={}){const n=Array.from(t.querySelectorAll("img")),o=async t=>{if(!t.getAttribute("src")){const e=t.currentSrc||t.src||"";e&&t.setAttribute("src",e)}t.removeAttribute("srcset"),t.removeAttribute("sizes");const n=t.src||"";if(!n)return;const o=await Mt(n,{as:"dataURL",useProxy:e.useProxy});if(o.ok&&"string"==typeof o.data&&o.data.startsWith("data:"))return t.src=o.data,t.width||(t.width=t.naturalWidth||100),void(t.height||(t.height=t.naturalHeight||100));const{fallbackURL:r}=e||{};if(r)try{const o=parseInt(t.dataset?.snapdomWidth||"",10)||0,i=parseInt(t.dataset?.snapdomHeight||"",10)||0,a=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,c=parseFloat(t.style?.width||"")||0,l=parseFloat(t.style?.height||"")||0,u=o||c||a||t.width||void 0,d=i||l||s||t.height||void 0,h="function"==typeof r?await r({width:u,height:d,src:n,element:t}):r;if(h){const n=await Mt(h,{as:"dataURL",useProxy:e.useProxy});return t.src=n.data,!t.width&&u&&(t.width=u),!t.height&&d&&(t.height=d),t.width||(t.width=t.naturalWidth||100),void(t.height||(t.height=t.naturalHeight||100))}}catch{}const i=t.width||t.naturalWidth||100,a=t.height||t.naturalHeight||100;if(!1!==e.placeholders){const e=document.createElement("div");e.style.cssText=[`width:${i}px`,`height:${a}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${a}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),e.textContent="img",t.replaceWith(e)}else{const e=document.createElement("div");e.style.cssText=`display:inline-block;width:${i}px;height:${a}px;visibility:hidden;`,t.replaceWith(e)}};for(let t=0;t<n.length;t+=4){const e=n.slice(t,t+4).map(o);await Promise.allSettled(e)}}(i,e),t()},{fast:n})}),await new Promise(o=>{Ht(async()=>{await async function(t,e,n,o={}){const r=[[t,e]],i=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],s=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;r.length;){const[t,e]=r.shift(),c=n.get(t)||Wt(t);n.has(t)||n.set(t,c);const l=(()=>{const t=c.getPropertyValue("border-image"),e=c.getPropertyValue("border-image-source");return t&&"none"!==t||e&&"none"!==e})();for(const t of i){const n=c.getPropertyValue(t);if(!n||"none"===n)continue;const r=$t(n),i=await Promise.all(r.map(t=>At(t,o)));i.some(t=>t&&"none"!==t&&!/^url\(undefined/.test(t))&&e.style.setProperty(t,i.join(", "))}for(const t of a){const n=c.getPropertyValue(t);n&&"initial"!==n&&e.style.setProperty(t,n)}if(l)for(const t of s){const n=c.getPropertyValue(t);n&&"initial"!==n&&e.style.setProperty(t,n)}const u=Array.from(t.children),d=Array.from(e.children);for(let t=0;t<Math.min(u.length,d.length);t++)r.push([u[t],d[t]])}}(t,i,s,e),o()},{fast:n})}),e.embedFonts&&await new Promise(o=>{Ht(async()=>{const n=ve(t),r=function(t){const e=new Set,n=t=>{if(t)for(const n of t)e.add(n.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){const t=o.currentNode;if(t.nodeType===Node.TEXT_NODE)n(t.nodeValue||"");else if(t.nodeType===Node.ELEMENT_NODE){const o=t;for(const t of["::before","::after"]){const r=getComputedStyle(o,t),i=r?.getPropertyValue("content");if(i&&"none"!==i)if(/^"/.test(i)||/^'/.test(i))n(i.slice(1,-1));else{const t=i.match(/\\[0-9A-Fa-f]{1,6}/g);if(t)for(const n of t)try{e.add(parseInt(n.slice(1),16))}catch{}}}}}return e}(t);if(Bt()){const t=new Set(Array.from(n).map(t=>String(t).split("__")[0]).filter(Boolean));await async function(t,e=2){try{await document.fonts.ready}catch{}const n=Array.from(t||[]).filter(Boolean);if(0===n.length)return;const o=()=>{const t=document.createElement("div");t.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(const e of n){const n=document.createElement("span");n.textContent="AaBbGg1234ÁÉÍÓÚçñ—∞",n.style.fontFamily=`"${e}"`,n.style.fontWeight="700",n.style.fontStyle="italic",n.style.fontSize="32px",n.style.lineHeight="1",n.style.whiteSpace="nowrap",n.style.margin="0",n.style.padding="0",t.appendChild(n)}document.body.appendChild(t),t.offsetWidth,document.body.removeChild(t)};for(let t=0;t<Math.max(1,e);t++)o(),await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)))}(t,1)}u=await be({required:n,usedCodepoints:r,exclude:e.excludeFonts,useProxy:e.useProxy}),o()},{fast:n})});const f=function(t){const e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),"function"==typeof t.querySelectorAll&&t.querySelectorAll("*").forEach(t=>e.add(t.tagName.toLowerCase())),Array.from(e))}(i).sort(),p=f.join(",");yt.baseStyle.has(p)?d=yt.baseStyle.get(p):await new Promise(t=>{Ht(()=>{d=function(t){const e=new Map;for(let n of t){const t=yt.defaultStyle.get(n);if(!t)continue;const o=Object.entries(t).map(([t,e])=>`${t}:${e};`).sort().join("");o&&(e.has(o)||e.set(o,[]),e.get(o).push(n))}let n="";for(let[t,o]of e.entries())n+=`${o.join(",")} { ${t} }\n`;return n}(f),yt.baseStyle.set(p,d),t()},{fast:n})}),await new Promise(s=>{Ht(()=>{const n=getComputedStyle(t);const m=t.getBoundingClientRect(),f=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(n.width)||m.width||1)),p=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(n.height)||m.height||1)),g=(t,e=NaN)=>{const n="string"==typeof t?parseFloat(t):t;return Number.isFinite(n)?n:e},y=g(e.width),w=g(e.height);let b=f,v=p;const x=Number.isFinite(y),S=Number.isFinite(w),C=p>0?f/p:1;x&&S?(b=Math.max(1,Math.ceil(y)),v=Math.max(1,Math.ceil(w))):x?(b=Math.max(1,Math.ceil(y)),v=Math.max(1,Math.ceil(b/(C||1)))):S?(v=Math.max(1,Math.ceil(w)),b=Math.max(1,Math.ceil(v*(C||1)))):(b=f,v=p);let E=0,M=0,k=f,A=p;if(o&&h&&Number.isFinite(h.a)){const t=Xe(f,p,{a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},0,0);E=t.minX,M=t.minY,k=t.maxX,A=t.maxY}else{if(!o&&function(t){const e=getComputedStyle(t),n=e.transform||"none";if("none"!==n&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;const o=e.rotate&&"none"!==e.rotate&&"0deg"!==e.rotate,r=e.scale&&"none"!==e.scale&&"1"!==e.scale,i=e.translate&&"none"!==e.translate&&"0px 0px"!==e.translate;return Boolean(o||r||i)}(t)){const e=n.transform&&"none"!==n.transform?n.transform:"",o=function(t){const e={rotate:"0deg",scale:null,translate:null},n="function"==typeof t.computedStyleMap?t.computedStyleMap():null;if(n){const o=t=>{try{return"function"!=typeof n.has||n.has(t)?"function"!=typeof n.get?null:n.get(t):null}catch{return null}},r=o("rotate");if(r)if(r.angle){const t=r.angle;e.rotate="rad"===t.unit?180*t.value/Math.PI+"deg":t.value+t.unit}else r.unit?e.rotate="rad"===r.unit?180*r.value/Math.PI+"deg":r.value+r.unit:e.rotate=String(r);else{const n=getComputedStyle(t);e.rotate=n.rotate&&"none"!==n.rotate?n.rotate:"0deg"}const i=o("scale");if(i){const t="x"in i&&null!=i.x?.value?i.x.value:Array.isArray(i)?i[0]?.value:Number(i)||1,n="y"in i&&null!=i.y?.value?i.y.value:Array.isArray(i)?i[1]?.value:t;e.scale=`${t} ${n}`}else{const n=getComputedStyle(t);e.scale=n.scale&&"none"!==n.scale?n.scale:null}const a=o("translate");if(a){const t="x"in a&&"value"in a.x?a.x.value:Array.isArray(a)?a[0]?.value:0,n="y"in a&&"value"in a.y?a.y.value:Array.isArray(a)?a[1]?.value:0,o="x"in a&&a.x?.unit?a.x.unit:"px",r="y"in a&&a.y?.unit?a.y.unit:"px";e.translate=`${t}${o} ${n}${r}`}else{const n=getComputedStyle(t);e.translate=n.translate&&"none"!==n.translate?n.translate:null}return e}const o=getComputedStyle(t);return e.rotate=o.rotate&&"none"!==o.rotate?o.rotate:"0deg",e.scale=o.scale&&"none"!==o.scale?o.scale:null,e.translate=o.translate&&"none"!==o.translate?o.translate:null,e}(t),r=function(t){const e=function(){if(Ge)return Ge;const t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),Ge=t,t}(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform);t.rotate&&(n.style.rotate=t.rotate);t.scale&&(n.style.scale=t.scale);t.translate&&(n.style.translate=t.translate);e.appendChild(n);const o=Ze(n);return e.removeChild(n),o}({baseTransform:e,rotate:o.rotate||"0deg",scale:o.scale,translate:o.translate}),{ox:i,oy:a}=function(t,e,n){const o=(t.transformOrigin||"0 0").trim().split(/\s+/),[r,i]=[o[0]||"0",o[1]||"0"],a=(t,e)=>{const n=t.toLowerCase();return"left"===n||"top"===n?0:"center"===n?e/2:"right"===n||"bottom"===n?e:n.endsWith("px")?parseFloat(n)||0:n.endsWith("%")?(parseFloat(n)||0)*e/100:/^-?\d+(\.\d+)?$/.test(n)&&parseFloat(n)||0};return{ox:a(r,e),oy:a(i,n)}}(n,f,p),s=Xe(f,p,r.is2D?r:new DOMMatrix(r.toString()),i,a);E=s.minX,M=s.minY,k=s.maxX,A=s.maxY}}const L=function(t){const e=t.boxShadow||"";if(!e||"none"===e)return{top:0,right:0,bottom:0,left:0};const n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(t=>t.trim());let o=0,r=0,i=0,a=0;for(const t of n){const e=t.match(/-?\d+(\.\d+)?px/g)?.map(t=>parseFloat(t))||[];if(e.length<2)continue;const[n,s,c=0,l=0]=e,u=Math.abs(n)+c+l,d=Math.abs(s)+c+l;r=Math.max(r,u+Math.max(n,0)),a=Math.max(a,u+Math.max(-n,0)),i=Math.max(i,d+Math.max(s,0)),o=Math.max(o,d+Math.max(-s,0))}return{top:Math.ceil(o),right:Math.ceil(r),bottom:Math.ceil(i),left:Math.ceil(a)}}(n),I=function(t){const e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}(n),R=function(t){if("none"===(t.outlineStyle||"none"))return{top:0,right:0,bottom:0,left:0};const e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}(n),N=function(t){const e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||"none"===e)return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};const n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[];let o=0,r=0,i=0,a=0,s=!1;for(const t of n){s=!0;const e=t.match(/-?\d+(?:\.\d+)?px/gi)?.map(t=>parseFloat(t))||[],[n=0,c=0,l=0]=e,u=Math.abs(n)+l,d=Math.abs(c)+l;r=Math.max(r,u+Math.max(n,0)),a=Math.max(a,u+Math.max(-n,0)),i=Math.max(i,d+Math.max(c,0)),o=Math.max(o,d+Math.max(-c,0))}return{bleed:{top:Math.ceil(o),right:Math.ceil(r),bottom:Math.ceil(i),left:Math.ceil(a)},has:s}}(n),T=r?{top:0,right:0,bottom:0,left:0}:{top:L.top+I.top+R.top+N.bleed.top,right:L.right+I.right+R.right+N.bleed.right,bottom:L.bottom+I.bottom+R.bottom+N.bleed.bottom,left:L.left+I.left+R.left+N.bleed.left};E-=T.left,M-=T.top,k+=T.right,A+=T.bottom;const P=Math.max(1,Math.ceil(k-E)),F=Math.max(1,Math.ceil(A-M)),W=Math.max(1,Math.round(P*(x||S?b/f:1))),D=Math.max(1,Math.round(F*(S||x?v/p:1))),$="http://www.w3.org/2000/svg",H=(Bt()?1:0)+(o?1:0),B=document.createElementNS($,"foreignObject"),V=Math.floor(E),U=Math.floor(M);B.setAttribute("x",String(-(V-H))),B.setAttribute("y",String(-(U-H))),B.setAttribute("width",String(Math.ceil(f+2*H))),B.setAttribute("height",String(Math.ceil(p+2*H))),B.style.overflow="visible";const O=document.createElement("style");O.textContent=d+u+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a,B.appendChild(O);const j=document.createElement("div");j.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),j.style.width=`${f}px`,j.style.height=`${p}px`,j.style.overflow="visible",i.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),j.appendChild(i),B.appendChild(j);const z=(new XMLSerializer).serializeToString(B),X=P+2*H,Z=F+2*H,G=x||S;e.meta={w0:f,h0:p,vbW:X,vbH:Z,targetW:b,targetH:v};const Y=Bt()&&G?X:W+2*H,_=Bt()&&G?Z:D+2*H;l=`<svg xmlns="${$}" width="${Y}" height="${_}" viewBox="0 0 ${X} ${Z}">`+z+"</svg>",c=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(l)}`,s()},{fast:n})});const g=document.getElementById("snapdom-sandbox");return g&&"absolute"===g.style.position&&g.remove(),c}function Xe(t,e,n,o,r){const i=n.a,a=n.b,s=n.c,c=n.d,l=n.e||0,u=n.f||0;function d(t,e){let n=t-o,d=e-r,h=i*n+s*d,m=a*n+c*d;return h+=o+l,m+=r+u,[h,m]}const h=[d(0,0),d(t,0),d(0,e),d(t,e)];let m=1/0,f=1/0,p=-1/0,g=-1/0;for(const[t,e]of h)t<m&&(m=t),e<f&&(f=e),t>p&&(p=t),e>g&&(g=e);return{minX:m,minY:f,maxX:p,maxY:g,width:p-m,height:g-f}}function Ze(t){const e=getComputedStyle(t).transform;if(!e||"none"===e)return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}var Ge=null;function Ye(t){const e=function(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){const i=t[r];"("===i&&o++,")"===i&&(o=Math.max(0,o-1)),";"===i&&0===o?(e.push(n),n=""):n+=i}return n.trim()&&e.push(n),e.map(t=>t.trim()).filter(Boolean)}(t);let n=null,o=null,r=null;const i=[];for(const t of e){const e=t.indexOf(":");if(e<0)continue;const a=t.slice(0,e).trim().toLowerCase(),s=t.slice(e+1).trim();"box-shadow"===a?r=s:"filter"===a?n=s:"-webkit-filter"===a?o=s:i.push([a,s])}if(r){const t=function(t){const e=[];let n="",o=0;for(let r=0;r<t.length;r++){const i=t[r];"("===i&&o++,")"===i&&(o=Math.max(0,o-1)),","===i&&0===o?(e.push(n.trim()),n=""):n+=i}n.trim()&&e.push(n.trim());const r=[];for(const t of e){if(/\binset\b/i.test(t))continue;const e=t.match(/-?\d+(?:\.\d+)?px/gi)||[],[n="0px",o="0px",i="0px"]=e;let a=t.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/gi,"").trim().replace(/\s{2,}/g," ");const s=!!a&&","!==a;r.push(`drop-shadow(${n} ${o} ${i}${s?` ${a}`:""})`)}return r.join(" ")}(r);t&&(n=n?`${n} ${t}`:t,o=o?`${o} ${t}`:t)}const a=[...i];return n&&a.push(["filter",n]),o&&a.push(["-webkit-filter",o]),a.map(([t,e])=>`${t}:${e}`).join(";")}function _e(t){return t=(t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,e)=>t.replace(e,function(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(t,e,n)=>`${e}{${Ye(n)}}`)}(e)))).replace(/style=(['"])([\s\S]*?)\1/gi,(t,e,n)=>`style=${e}${Ye(n)}${e}`)}function qe(t){if(!Bt()||("string"!=typeof(e=t)||!/^data:image\/svg\+xml/i.test(e)))return t;var e;try{const e=function(t){const e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}(t),n=_e(e);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}catch{return t}}async function Je(t,e){let{width:n,height:o,scale:r=1,dpr:i=1,meta:a={}}=e;t=qe(t);const s=new Image;s.loading="eager",s.decoding="sync",s.crossOrigin="anonymous",s.src=t,await s.decode();const c=s.naturalWidth,l=s.naturalHeight,u=Number.isFinite(a.w0)?a.w0:c,d=Number.isFinite(a.h0)?a.h0:l;let h,m;const f=Number.isFinite(n),p=Number.isFinite(o);if(f&&p)h=Math.max(1,n),m=Math.max(1,o);else if(f){const t=n/Math.max(1,u);h=n,m=Math.round(d*t)}else if(p){const t=o/Math.max(1,d);m=o,h=Math.round(u*t)}else h=c,m=l;h=Math.round(h*r),m=Math.round(m*r);const g=document.createElement("canvas");g.width=Math.ceil(h*i),g.height=Math.ceil(m*i),g.style.width=`${h}px`,g.style.height=`${m}px`;const y=g.getContext("2d");return 1!==i&&y.scale(i,i),y.drawImage(s,0,0,h,m),g}async function Qe(t,e){const n=await Je(t,e),o=e.backgroundColor?kt(n,e.backgroundColor):n,r=new Image;return r.src=o.toDataURL(`image/${e.format}`,e.quality),await r.decode(),r.style.width=o.width/e.dpr+"px",r.style.height=o.height/e.dpr+"px",r}async function Ke(t,e){const{scale:n=1,width:o,height:r,meta:i={}}=e,a=Number.isFinite(o),s=Number.isFinite(r),c=Number.isFinite(n)&&1!==n||a||s;if(Bt()&&c){return await Qe(t,{...e,format:"png",quality:1,meta:i})}const l=new Image;if(l.decoding="sync",l.loading="eager",l.src=t,await l.decode(),a&&s)l.style.width=`${o}px`,l.style.height=`${r}px`;else if(a){const t=Number.isFinite(i.w0)?i.w0:l.naturalWidth,e=Number.isFinite(i.h0)?i.h0:l.naturalHeight,n=o/Math.max(1,t);l.style.width=`${o}px`,l.style.height=`${Math.round(e*n)}px`}else if(s){const t=Number.isFinite(i.w0)?i.w0:l.naturalWidth,e=Number.isFinite(i.h0)?i.h0:l.naturalHeight,n=r/Math.max(1,e);l.style.height=`${r}px`,l.style.width=`${Math.round(t*n)}px`}else{const e=Math.round(l.naturalWidth*n),o=Math.round(l.naturalHeight*n);if(l.style.width=`${e}px`,l.style.height=`${o}px`,"string"==typeof t&&t.startsWith("data:image/svg+xml"))try{const n=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${e}"`).replace(/height="[^"]*"/,`height="${o}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,l.src=t}catch{}}return l}async function tn(t,e){const n=e.type;if("svg"===n){const e=decodeURIComponent(t.split(",")[1]);return new Blob([e],{type:"image/svg+xml"})}const o=await Je(t,e),r=e.backgroundColor?kt(o,e.backgroundColor):o;return new Promise(t=>r.toBlob(e=>t(e),`image/${n}`,e.quality))}var en=Symbol("snapdom.internal"),nn=!1;async function on(t,e){if(!t)throw new Error("Element cannot be null or undefined");const n=function(t={}){const e=t.format??"png",n=function(t){if("string"==typeof t){const e=t.toLowerCase().trim();if("disabled"===e||"full"===e||"auto"===e||"soft"===e)return e}return"soft"}(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:!1!==t.placeholders,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:"string"==typeof t.useProxy?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}(e);if(Bt()&&(!0===n.embedFonts||function(t){const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){const t=e.currentNode,n=getComputedStyle(t),o=n.backgroundImage&&"none"!==n.backgroundImage,r=n.maskImage&&"none"!==n.maskImage||n.webkitMaskImage&&"none"!==n.webkitMaskImage;if(o||r)return!0}return!1}(t)))for(let n=0;n<3;n++)try{await rn(t,e),nn=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&function(t){const e=Array.isArray(t)?t:[t];for(const t of e)t instanceof RegExp?te.push(t):"string"==typeof t&&te.push(new RegExp(t,"i"))}(n.iconFonts),n.snap||(n.snap={toPng:(t,e)=>on.toPng(t,e),toSvg:(t,e)=>on.toSvg(t,e)}),on.capture(t,n,en)}async function rn(t,e){if(nn)return;const n={...e,fast:!0,embedFonts:!0,scale:.2};let o;try{o=await ze(t,n)}catch{return}await new Promise(t=>{const e=new Image;e.decoding="sync",e.loading="eager",e.style.position="fixed",e.style.left=0,e.style.top=0,e.style.width="10px",e.style.height="10px",e.style.opacity="0.01",e.style.transform="translateZ(10px)",e.style.willChange="transform,opacity;",e.src=o;document.body.appendChild(e),(async()=>{await new Promise(t=>setTimeout(t,100)),e&&e.parentNode&&e.parentNode.removeChild(e),nn=!0,t()})()})}on.capture=async(t,e,n)=>{if(n!==en)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");const o=await ze(t,e),r=t=>({...e,...t||{}}),i=t=>e=>{const n=r({...e||{},format:t}),i="jpeg"===t||"jpg"===t,a=null==n.backgroundColor||"transparent"===n.backgroundColor;return i&&a&&(n.backgroundColor="#ffffff"),Qe(o,n)};return{url:o,toRaw:()=>o,toImg:t=>Ke(o,r(t)),toSvg:t=>Ke(o,r(t)),toCanvas:t=>Je(o,r(t)),toBlob:t=>tn(o,r(t)),toPng:i("png"),toJpg:i("jpeg"),toWebp:i("webp"),download:t=>async function(t,e){if(e.dpr=1,"svg"===e.format){const n=await tn(t,{...e,type:"svg"}),o=URL.createObjectURL(n),r=document.createElement("a");return r.href=o,r.download=e.filename,r.click(),void URL.revokeObjectURL(o)}const n=await Je(t,e),o=e.backgroundColor?kt(n,e.backgroundColor):n,r=document.createElement("a");r.href=o.toDataURL(`image/${e.format}`,e.quality),r.download=e.filename,r.click()}(o,r(t))}},on.toRaw=(t,e)=>on(t,e).then(t=>t.toRaw()),on.toImg=(t,e)=>on(t,e).then(t=>t.toImg()),on.toSvg=(t,e)=>on(t,e).then(t=>t.toSvg()),on.toCanvas=(t,e)=>on(t,e).then(t=>t.toCanvas()),on.toBlob=(t,e)=>on(t,e).then(t=>t.toBlob()),on.toPng=(t,e)=>on(t,{...e,format:"png"}).then(t=>t.toPng()),on.toJpg=(t,e)=>on(t,{...e,format:"jpeg"}).then(t=>t.toJpg()),on.toWebp=(t,e)=>on(t,{...e,format:"webp"}).then(t=>t.toWebp()),on.download=(t,e)=>on(t,e).then(t=>t.download());class an{constructor(t,e={}){this.targetElement=null,this.isRunning=!1,this.screenshotCount=0,this.screenshotHistory=[],this.lastScreenshotTime=0,this.error=null,this.isEnabled=!1,this.isUploading=!1,this.uploadError=null,this.uploadProgress={success:0,failed:0},this.currentUploadConfig=null,this.worker=null,this.screenshotTimer=null,this.screenshotContext=null,this.messageHandler=null,this.dynamicInterval=null,this.expirationTimer=null,this.imageProxyCache=new Map,this.indexedDBCache=null,this.indexedDBReady=!1,this.intersectionObserver=null,this.visibleElementsCache=new Set,this.preconnected=!1,this.globalErrorHandler=null,this.globalRejectionHandler=null,this.targetElement=t,this.options={interval:e.interval??5e3,quality:e.quality??.4,scale:e.scale??1,maxHistory:e.maxHistory??10,compress:e.compress??!1,maxWidth:e.maxWidth??1600,maxHeight:e.maxHeight??900,outputFormat:e.outputFormat??"webp",enableCORS:e.enableCORS??!0,proxyUrl:e.proxyUrl??"",useProxy:e.useProxy??!0,engine:e.engine??"modern-screenshot",corsMode:e.corsMode??"canvas-proxy",silentMode:e.silentMode??!1,maxRetries:e.maxRetries??2,preloadImages:e.preloadImages??!1,maxConcurrentDownloads:e.maxConcurrentDownloads??10,onlyVisibleImages:e.onlyVisibleImages??!0,imageCacheTTL:e.imageCacheTTL??6e5,useIndexedDB:e.useIndexedDB??!0,usePreconnect:e.usePreconnect??!0,imageLoadTimeout:e.imageLoadTimeout??5e3,useIntersectionObserver:e.useIntersectionObserver??!0,fetchPriority:e.fetchPriority??"high",maxCacheSize:e.maxCacheSize??50,maxCacheAge:e.maxCacheAge??864e5},this.setupMessageListener(),this.setupVisibilityChangeListener(),this.startCacheCleanup(),this.options.usePreconnect&&this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()&&this.preconnectProxy(),this.options.useIntersectionObserver&&this.options.onlyVisibleImages&&this.initIntersectionObserver(),this.options.useIndexedDB&&this.initIndexedDB().catch(()=>{this.options.silentMode})}setTargetElement(t){if(this.targetElement!==t&&this.screenshotContext){try{tt(this.screenshotContext)}catch(t){}this.screenshotContext=null}this.targetElement=t}setupMessageListener(){this.messageHandler||(this.messageHandler=t=>{this.handleIframeMessage(t)},window.addEventListener("message",this.messageHandler))}setupVisibilityChangeListener(){document.addEventListener("visibilitychange",()=>{document.hidden,this.options.silentMode})}handleIframeMessage(t){try{if(!t.data||"checkScreenshot"!==t.data.type)return;this.options.silentMode;const e=this.parseUploadConfig(t.data.data);if(!e)return void(this.uploadError="解析上传配置失败");this.currentUploadConfig=e;const n=Date.now();if(!(e.ttl>0&&e.ttl>n))return this.options.silentMode||e.ttl,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,void(this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null));{this.isEnabled||(this.options.silentMode,this.isEnabled=!0),this.dynamicInterval=e.duration||this.options.interval;const t=e.ttl-n;if(!this.options.silentMode){Math.ceil(t/6e4)}this.takeScreenshotAndUpload(e),this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.expirationTimer=setTimeout(()=>{this.options.silentMode,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,this.expirationTimer=null},t)}}catch(t){this.uploadError=t instanceof Error?t.message:String(t)}}async takeScreenshotAndUpload(t){this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.startScreenshot(this.dynamicInterval||t.duration||this.options.interval);try{if(await this.takeScreenshot()){await new Promise(t=>setTimeout(t,100));const e=this.getLatestScreenshot();e?(this.isUploading=!0,this.uploadError=null,this.uploadScreenshot(e,t).then(t=>{t&&this.options.silentMode}).catch(t=>{this.uploadError=t instanceof Error?t.message:String(t)}).finally(()=>{this.isUploading=!1})):this.options.silentMode}}catch(t){this.uploadError=t instanceof Error?t.message:String(t)}}parseUploadConfig(t){try{const e="string"==typeof t?t:JSON.stringify(t),n=JSON.parse(e);return n.uploadUrl&&n.contentType?(("number"!=typeof n.duration||n.duration<=0)&&(n.duration=this.options.interval),"number"!=typeof n.ttl&&("number"==typeof n.expirationMinutes&&n.expirationMinutes>0?n.ttl=Date.now()+60*n.expirationMinutes*1e3:n.ttl=0),n):null}catch(t){return null}}startScreenshot(t){if(!this.isEnabled)return;const e=t||this.dynamicInterval||this.options.interval;this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.options.silentMode,this.isRunning=!0,!this.worker&&this.options.compress&&(this.worker=this.createWorker()),this.screenshotTimer=setInterval(async()=>{if(this.isRunning&&this.isEnabled&&!document.hidden&&(await this.takeScreenshot(),this.currentUploadConfig)){const t=this.getLatestScreenshot();t&&!this.isUploading&&this.uploadScreenshot(t,this.currentUploadConfig).catch(t=>{})}},e)}stopScreenshot(){this.isRunning&&(this.options.silentMode,this.isRunning=!1,this.screenshotTimer&&(clearInterval(this.screenshotTimer),this.screenshotTimer=null))}async captureOnce(t=!1){return!(!this.isEnabled&&!t)&&await this.takeScreenshot()}async takeScreenshot(){if(!this.targetElement)return!1;this.setupGlobalErrorHandlers();try{this.options.silentMode,await Promise.all([this.waitForStylesAndFonts(),this.waitForFonts()]),await new Promise(t=>requestAnimationFrame(()=>{requestAnimationFrame(()=>t())}));const t=this.options.engine||"modern-screenshot";let e;this.options.silentMode,this.options.preloadImages&&this.options.enableCORS&&"modern-screenshot"===t?(this.cleanExpiredCache(),this.options.useIndexedDB&&await this.cleanIndexedDBCache(),await this.preprocessNetworkImages(this.targetElement),await this.waitForImagesToLoad(this.targetElement)):(this.cleanExpiredCache(),this.options.useIndexedDB&&await this.cleanIndexedDBCache()),await new Promise(t=>setTimeout(t,50)),e="snapdom"===t?await this.takeScreenshotWithSnapdom(this.targetElement):await this.takeScreenshotWithModernScreenshot(this.targetElement);const n=Date.now();this.screenshotCount++,this.lastScreenshotTime=n,this.screenshotHistory.length>=this.options.maxHistory&&this.screenshotHistory.shift(),this.screenshotHistory.push(e);e.split(",")[1];this.options.silentMode;const o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),r=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4;return this.options.compress&&!o&&!r&&this.worker&&(this.options.silentMode,this.worker.postMessage({type:"COMPRESS_IMAGE",data:{dataUrl:e,maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight,quality:this.options.quality,outputFormat:this.options.outputFormat,timestamp:n,count:this.screenshotCount}})),this.error=null,!0}catch(t){const e=t instanceof Error?t.message:String(t);return e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin")||e.includes("XMLHttpRequest")||e.includes("Status:0")?this.options.silentMode:this.error=e,!1}finally{this.removeGlobalErrorHandlers()}}async takeScreenshotWithSnapdom(t){this.options.silentMode;try{const e=t.getBoundingClientRect();if(0===e.width||0===e.height)throw new Error("元素尺寸为 0,无法截图");const n={};if(this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){let t=this.options.proxyUrl.trim();t.includes("?url=")||(t=t.endsWith("?")?t+"url=":t+"?url="),n.useProxy=t,this.options.silentMode}else this.options.silentMode||this.options.useProxy&&(!this.options.proxyUrl||this.options.proxyUrl.trim());let o;switch(this.options.outputFormat||"png"){case"jpeg":o=await on.toJpg(t,n);break;case"webp":o=await on.toWebp(t,n);break;default:o=await on.toPng(t,n)}const r=o.src;if(!r||r.length<100)throw new Error("生成的 base64 数据无效或过短");return this.options.silentMode,r}catch(t){const e=t instanceof Error?t.message:String(t);throw("EncodingError"===(t instanceof Error?t.name:"Unknown")||e.includes("cannot be decoded")||e.includes("CORS")||e.includes("cross-origin"))&&this.options.silentMode,t}}async takeScreenshotWithModernScreenshot(t){let e,n;this.options.silentMode,t===document.body||t===document.documentElement?(e=Math.max(t.scrollWidth,t.offsetWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,window.innerWidth),n=Math.max(t.scrollHeight,t.offsetHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,window.innerHeight)):(e=t.scrollWidth||t.clientWidth||t.offsetWidth,n=t.scrollHeight||t.clientHeight||t.offsetHeight),this.options.silentMode||t===document.body||document.documentElement;const o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),r=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4,i=o||r?Math.max(.7*this.options.quality,.3):this.options.quality,{width:a,height:s}=this.calculateCompressedSize(e,n,this.options.maxWidth,this.options.maxHeight),c=a<e?a:void 0,l=s<n?s:void 0,u=t.getBoundingClientRect();if(0===u.width||0===u.height)throw new Error("元素尺寸为 0,无法截图");if(this.screenshotContext){try{tt(this.screenshotContext)}catch(t){}this.screenshotContext=null}const d={workerNumber:o||r?1:2,quality:i,fetchFn:async t=>{if(t.startsWith("data:")||t.startsWith("blob:"))return t;try{if(new URL(t,window.location.href).origin===window.location.origin)return t}catch(t){}if(this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){const e=this.getCachedImage(t);if(e)return this.options.silentMode,e;if(this.options.useIndexedDB){const e=await this.getIndexedDBCache(t);if(e)return this.setCachedImage(t,e),this.options.silentMode,e}try{const e=new URLSearchParams({url:t,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const o=`${n}?${e.toString()}`,r=new AbortController,i=setTimeout(()=>r.abort(),this.options.imageLoadTimeout);try{const e={method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"},cache:"no-cache",signal:r.signal};"priority"in e&&(e.priority=this.options.fetchPriority);const n=await fetch(o,e);if(clearTimeout(i),!n.ok)throw new Error(`代理请求失败: ${n.status}`);const a=await n.blob(),s=await this.blobToDataUrl(a);return this.setCachedImage(t,s),this.options.useIndexedDB&&await this.setIndexedDBCache(t,s),s}catch(t){throw clearTimeout(i),t}}catch(e){return this.options.silentMode,t}}return this.options.enableCORS,t},fetch:{requestInit:{cache:"no-cache"},bypassingCache:!0}};t!==document.body&&t!==document.documentElement&&c&&l&&(c<e||l<n)?(d.width=c,d.height=l,this.options.silentMode):this.options.silentMode,1!==this.options.scale&&(d.scale=o?.8:this.options.scale),this.screenshotContext=await H(t,d);try{const t=await gt(this.screenshotContext);if(!t||t.length<100)throw new Error("生成的截图数据无效或过短");if("png"!==this.options.outputFormat){const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("无法获取 canvas context");const r=new Image;await new Promise((o,i)=>{r.onload=()=>{e.width=r.width,e.height=r.height,n.drawImage(r,0,0),o()},r.onerror=i,r.src=t});let a="image/jpeg",s=i;if("webp"===this.options.outputFormat&&!o)try{const t=document.createElement("canvas");t.width=1,t.height=1;-1!==t.toDataURL("image/webp").indexOf("webp")&&(a="image/webp")}catch{a="image/jpeg"}return"image/png"===a?e.toDataURL(a):e.toDataURL(a,s)}return t}catch(t){t instanceof Error?t.message:String(t);throw this.options.silentMode,t}finally{if(this.screenshotContext){try{tt(this.screenshotContext)}catch(t){}this.screenshotContext=null}}}preconnectProxy(){if(!this.preconnected&&this.options.proxyUrl)try{const t=new URL(this.options.proxyUrl).origin,e=document.createElement("link");e.rel="preconnect",e.href=t,e.crossOrigin="anonymous",document.head.appendChild(e),this.preconnected=!0,this.options.silentMode}catch(t){}}initIntersectionObserver(){"IntersectionObserver"in window&&(this.intersectionObserver=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting?this.visibleElementsCache.add(t.target):this.visibleElementsCache.delete(t.target)})},{root:null,rootMargin:"50px",threshold:.01}))}async initIndexedDB(){return new Promise((t,e)=>{const n=indexedDB.open("screenshot-cache",1);n.onerror=()=>e(n.error),n.onsuccess=()=>{this.indexedDBCache=n.result,this.indexedDBReady=!0,this.cleanIndexedDBCache().catch(()=>{}),t()},n.onupgradeneeded=t=>{const e=t.target.result;if(!e.objectStoreNames.contains("images")){e.createObjectStore("images",{keyPath:"url"}).createIndex("timestamp","timestamp",{unique:!1})}}})}async getIndexedDBCache(t){if(!this.indexedDBReady||!this.indexedDBCache)return null;try{const e=this.indexedDBCache.transaction(["images"],"readonly"),n=e.objectStore("images").get(t);return new Promise(e=>{n.onsuccess=()=>{const o=n.result;if(o){if(Date.now()-o.timestamp>this.options.maxCacheAge)return this.deleteIndexedDBCache(t),void e(null);e(o.dataUrl)}else e(null)},n.onerror=()=>e(null)})}catch{return null}}async setIndexedDBCache(t,e){if(this.indexedDBReady&&this.indexedDBCache)try{const n=await this.getIndexedDBCacheSize(),o=this.estimateDataUrlSize(e),r=1024*(this.options.maxCacheSize||50)*1024;n+o>r&&await this.cleanIndexedDBCacheBySize(r-o);const i=this.indexedDBCache.transaction(["images"],"readwrite");i.objectStore("images").put({url:t,dataUrl:e,timestamp:Date.now()})}catch{}}estimateDataUrlSize(t){const e=t.split(",")[1]||"";return Math.ceil(.75*e.length)+30}async getIndexedDBCacheSize(){if(!this.indexedDBReady||!this.indexedDBCache)return 0;try{const t=this.indexedDBCache.transaction(["images"],"readonly"),e=t.objectStore("images").getAll();return new Promise(t=>{e.onsuccess=()=>{const n=e.result||[];let o=0;n.forEach(t=>{o+=this.estimateDataUrlSize(t.dataUrl)}),t(o)},e.onerror=()=>t(0)})}catch{return 0}}async cleanIndexedDBCache(){if(this.indexedDBReady&&this.indexedDBCache)try{const t=this.indexedDBCache.transaction(["images"],"readwrite").objectStore("images"),e=t.index("timestamp").getAll();return new Promise(n=>{e.onsuccess=()=>{const o=e.result||[],r=Date.now(),i=[];let a=0;const s=1024*(this.options.maxCacheSize||50)*1024;o.sort((t,e)=>t.timestamp-e.timestamp),o.forEach(t=>{r-t.timestamp>this.options.maxCacheAge?i.push(t.url):a+=this.estimateDataUrlSize(t.dataUrl)});const c=[...i];if(a>s)for(const t of o)if(!i.includes(t.url)&&(a-=this.estimateDataUrlSize(t.dataUrl),c.push(t.url),a<=s))break;c.forEach(e=>{t.delete(e)}),c.length>0&&this.options.silentMode,n()},e.onerror=()=>n()})}catch{}}async cleanIndexedDBCacheBySize(t){if(this.indexedDBReady&&this.indexedDBCache)try{const e=this.indexedDBCache.transaction(["images"],"readwrite").objectStore("images"),n=e.index("timestamp").getAll();return new Promise(o=>{n.onsuccess=()=>{const r=n.result||[];r.sort((t,e)=>t.timestamp-e.timestamp);let i=0;const a=[];if(r.forEach(t=>{i+=this.estimateDataUrlSize(t.dataUrl)}),i>t)for(const e of r){if(i<=t)break;i-=this.estimateDataUrlSize(e.dataUrl),a.push(e.url)}a.forEach(t=>{e.delete(t)}),a.length>0&&this.options.silentMode,o()},n.onerror=()=>o()})}catch{}}async deleteIndexedDBCache(t){if(this.indexedDBReady&&this.indexedDBCache)try{const e=this.indexedDBCache.transaction(["images"],"readwrite");e.objectStore("images").delete(t)}catch{}}isElementVisible(t,e){if(!this.options.onlyVisibleImages)return!0;if(this.options.useIntersectionObserver&&this.intersectionObserver){if(this.visibleElementsCache.has(t))return!0;this.intersectionObserver.observe(t)}try{const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),r=!(n.bottom<o.top||n.top>o.bottom||n.right<o.left||n.left>o.right)&&n.width>0&&n.height>0&&"none"!==window.getComputedStyle(t).display&&"hidden"!==window.getComputedStyle(t).visibility&&"0"!==window.getComputedStyle(t).opacity;return this.options.useIntersectionObserver&&this.intersectionObserver&&(r?this.visibleElementsCache.add(t):this.visibleElementsCache.delete(t)),r}catch{return!0}}async preprocessNetworkImages(t){const e=t.querySelectorAll("img"),n=Array.from(e).filter(e=>{const n=e.src.startsWith("blob:"),o=e.src.startsWith("data:"),r=e.src.startsWith(window.location.origin),i=this.isElementVisible(e,t);return!n&&!o&&!r&&i});if(0===n.length)return;if(!this.options.silentMode){e.length}if(this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){this.options.silentMode;const t=this.options.maxConcurrentDownloads||10,e=[];for(let o=0;o<n.length;o+=t)e.push(n.slice(o,o+t));await Promise.all(e.map(async t=>{await Promise.all(t.map(async t=>{const e=t.src;if(!this.getCachedImage(e))try{const t=await this.proxyImage(e);t&&this.setCachedImage(e,t)}catch(t){this.options.silentMode}}))})),this.options.silentMode}}async proxyImage(t){if(!this.options.proxyUrl||""===this.options.proxyUrl.trim())throw new Error("proxyUrl 未配置");const e=new URLSearchParams({url:t,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const o=`${n}?${e.toString()}`;this.options.silentMode;const r=await fetch(o,{method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"}});if(!r.ok){const t=await r.text().catch(()=>"");throw new Error(`代理请求失败: ${r.status} ${r.statusText}${t?` - ${t.substring(0,200)}`:""}`)}const i=await r.blob(),a=await this.blobToDataUrl(i);return this.options.silentMode,a}blobToDataUrl(t){return new Promise((e,n)=>{const o=new FileReader,r=setTimeout(()=>{n(new Error("图片转换超时"))},1e4);o.onload=()=>{clearTimeout(r),e(o.result)},o.onerror=t=>{clearTimeout(r),n(t)},o.readAsDataURL(t)})}async waitForImagesToLoad(t){const e=t.querySelectorAll("img"),n=[];Array.from(e).forEach(t=>{if(t.complete)return;const e=this.options.imageLoadTimeout||5e3;n.push(Promise.race([new Promise(e=>{t.onload=()=>e(),t.onerror=()=>e()}),new Promise(t=>{setTimeout(()=>t(),e)})]))}),n.length>0&&await Promise.all(n)}async waitForStylesAndFonts(){return new Promise(t=>{requestAnimationFrame(()=>{setTimeout(()=>{t()},30)})})}async waitForFonts(){if(!document.fonts)return Promise.resolve();try{await document.fonts.ready,await new Promise(t=>setTimeout(t,100))}catch{}}calculateCompressedSize(t,e,n,o){let r=t,i=e;if(r>n||i>o){const t=n/r,e=o/i,a=Math.min(t,e);r=Math.round(r*a),i=Math.round(i*a)}return{width:r,height:i}}createWorker(){if("undefined"==typeof Worker||"undefined"==typeof OffscreenCanvas)return null;try{const t=new Blob(["\n self.onmessage = function(e) {\n const { type, data } = e.data;\n if (type === 'COMPRESS_IMAGE') {\n // 压缩逻辑(简化版)\n self.postMessage({\n type: 'SCREENSHOT_RESULT',\n data: { compressed: { dataUrl: data.dataUrl } }\n });\n }\n };\n "],{type:"application/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);return n.onmessage=t=>{const{type:e,data:n}=t.data;"SCREENSHOT_RESULT"===e&&n?.compressed&&this.screenshotHistory.length>0&&(this.screenshotHistory[this.screenshotHistory.length-1]=n.compressed.dataUrl)},n.onerror=t=>{},n}catch(t){return null}}setupGlobalErrorHandlers(){this.globalErrorHandler=t=>{const e=t.message||t.error?.message||"";return!(e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin"))||(t.preventDefault(),t.stopPropagation(),!1)},this.globalRejectionHandler=t=>{const e=t.reason?.message||String(t.reason)||"";return!(e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin"))||(t.preventDefault(),!1)},window.addEventListener("error",this.globalErrorHandler,!0),window.addEventListener("unhandledrejection",this.globalRejectionHandler,!0)}removeGlobalErrorHandlers(){this.globalErrorHandler&&(window.removeEventListener("error",this.globalErrorHandler,!0),this.globalErrorHandler=null),this.globalRejectionHandler&&(window.removeEventListener("unhandledrejection",this.globalRejectionHandler,!0),this.globalRejectionHandler=null)}async uploadScreenshot(t,e){try{this.options.silentMode;const n=this.dataUrlToBlob(t,e.contentType),o=await fetch(e.uploadUrl,{method:"PUT",body:n,headers:{"Content-Type":e.contentType}});if(200===o.status||204===o.status)return this.options.silentMode,this.uploadProgress.success++,!0;{const t=await o.text().catch(()=>""),e=`上传失败: HTTP ${o.status} ${o.statusText}${t?` - ${t.substring(0,200)}`:""}`;return this.uploadError=e,this.uploadProgress.failed++,!1}}catch(t){const e=t instanceof Error?t.message:String(t);return this.uploadError=`上传异常: ${e}`,this.uploadProgress.failed++,!1}}dataUrlToBlob(t,e){const n=t.split(","),o=n[0].match(/:(.*?);/),r=o?o[1]:e,i=atob(n[1]);let a=i.length;const s=new Uint8Array(a);for(;a--;)s[a]=i.charCodeAt(a);return new Blob([s],{type:r})}getLatestScreenshot(){return this.screenshotHistory[this.screenshotHistory.length-1]||null}enable(t){this.isEnabled=t,!t&&this.isRunning&&this.stopScreenshot()}destroy(){if(this.stopScreenshot(),this.worker&&(this.worker.terminate(),this.worker=null),this.screenshotContext){try{tt(this.screenshotContext)}catch(t){}this.screenshotContext=null}this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.removeGlobalErrorHandlers(),this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null,this.visibleElementsCache.clear()),this.indexedDBCache&&(this.indexedDBCache.close(),this.indexedDBCache=null,this.indexedDBReady=!1),this.imageProxyCache.clear()}getCachedImage(t){const e=this.imageProxyCache.get(t);if(!e)return null;return Date.now()-e.timestamp>this.options.imageCacheTTL?(this.imageProxyCache.delete(t),null):e.dataUrl}setCachedImage(t,e){this.imageProxyCache.set(t,{dataUrl:e,timestamp:Date.now()})}cleanExpiredCache(){const t=Date.now(),e=[];this.imageProxyCache.forEach((n,o)=>{t-n.timestamp>this.options.imageCacheTTL&&e.push(o)}),e.forEach(t=>{this.imageProxyCache.delete(t)}),e.length>0&&this.options.silentMode}startCacheCleanup(){setInterval(()=>{if(this.cleanExpiredCache(),this.options.useIndexedDB&&this.cleanIndexedDBCache().catch(()=>{}),!this.options.silentMode){this.imageProxyCache.size}},3e5)}getState(){return{isRunning:this.isRunning,screenshotCount:this.screenshotCount,lastScreenshotTime:this.lastScreenshotTime,error:this.error,isEnabled:this.isEnabled,isUploading:this.isUploading,uploadError:this.uploadError,uploadProgress:{...this.uploadProgress},currentUploadConfig:this.currentUploadConfig}}}var sn=function(){return sn=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},sn.apply(this,arguments)};function cn(t,e,n,o){return new(n||(n=Promise))(function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})}function ln(t,e){var n,o,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,o=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){i.label=s[1];break}if(6===s[0]&&i.label<r[1]){i.label=r[1],r=s;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(s);break}r[2]&&i.ops.pop(),i.trys.pop();continue}s=e.call(t,i)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function un(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var dn="4.6.2";function hn(t,e){return new Promise(function(n){return setTimeout(n,t,e)})}function mn(t){return!!t&&"function"==typeof t.then}function fn(t,e){try{var n=t();mn(n)?n.then(function(t){return e(!0,t)},function(t){return e(!1,t)}):e(!0,n)}catch(t){e(!1,t)}}function pn(t,e,n){return void 0===n&&(n=16),cn(this,void 0,void 0,function(){var o,r,i,a;return ln(this,function(s){switch(s.label){case 0:o=Array(t.length),r=Date.now(),i=0,s.label=1;case 1:return i<t.length?(o[i]=e(t[i],i),(a=Date.now())>=r+n?(r=a,[4,new Promise(function(t){var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(null)})]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++i,[3,1];case 4:return[2,o]}})})}function gn(t){return t.then(void 0,function(){}),t}function yn(t){return parseInt(t)}function wn(t){return parseFloat(t)}function bn(t,e){return"number"==typeof t&&isNaN(t)?e:t}function vn(t){return t.reduce(function(t,e){return t+(e?1:0)},0)}function xn(t,e){if(void 0===e&&(e=1),Math.abs(e)>=1)return Math.round(t/e)*e;var n=1/e;return Math.round(t*n)/n}function Sn(t,e){var n=t[0]>>>16,o=65535&t[0],r=t[1]>>>16,i=65535&t[1],a=e[0]>>>16,s=65535&e[0],c=e[1]>>>16,l=0,u=0,d=0,h=0;d+=(h+=i+(65535&e[1]))>>>16,h&=65535,u+=(d+=r+c)>>>16,d&=65535,l+=(u+=o+s)>>>16,u&=65535,l+=n+a,l&=65535,t[0]=l<<16|u,t[1]=d<<16|h}function Cn(t,e){var n=t[0]>>>16,o=65535&t[0],r=t[1]>>>16,i=65535&t[1],a=e[0]>>>16,s=65535&e[0],c=e[1]>>>16,l=65535&e[1],u=0,d=0,h=0,m=0;h+=(m+=i*l)>>>16,m&=65535,d+=(h+=r*l)>>>16,h&=65535,d+=(h+=i*c)>>>16,h&=65535,u+=(d+=o*l)>>>16,d&=65535,u+=(d+=r*c)>>>16,d&=65535,u+=(d+=i*s)>>>16,d&=65535,u+=n*l+o*c+r*s+i*a,u&=65535,t[0]=u<<16|d,t[1]=h<<16|m}function En(t,e){var n=t[0];32===(e%=64)?(t[0]=t[1],t[1]=n):e<32?(t[0]=n<<e|t[1]>>>32-e,t[1]=t[1]<<e|n>>>32-e):(e-=32,t[0]=t[1]<<e|n>>>32-e,t[1]=n<<e|t[1]>>>32-e)}function Mn(t,e){0!==(e%=64)&&(e<32?(t[0]=t[1]>>>32-e,t[1]=t[1]<<e):(t[0]=t[1]<<e-32,t[1]=0))}function kn(t,e){t[0]^=e[0],t[1]^=e[1]}var An=[4283543511,3981806797],Ln=[3301882366,444984403];function In(t){var e=[0,t[0]>>>1];kn(t,e),Cn(t,An),e[1]=t[0]>>>1,kn(t,e),Cn(t,Ln),e[1]=t[0]>>>1,kn(t,e)}var Rn=[2277735313,289559509],Nn=[1291169091,658871167],Tn=[0,5],Pn=[0,1390208809],Fn=[0,944331445];function Wn(t,e){var n=function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++){var o=t.charCodeAt(n);if(o>127)return(new TextEncoder).encode(t);e[n]=o}return e}(t);e=e||0;var o,r=[0,n.length],i=r[1]%16,a=r[1]-i,s=[0,e],c=[0,e],l=[0,0],u=[0,0];for(o=0;o<a;o+=16)l[0]=n[o+4]|n[o+5]<<8|n[o+6]<<16|n[o+7]<<24,l[1]=n[o]|n[o+1]<<8|n[o+2]<<16|n[o+3]<<24,u[0]=n[o+12]|n[o+13]<<8|n[o+14]<<16|n[o+15]<<24,u[1]=n[o+8]|n[o+9]<<8|n[o+10]<<16|n[o+11]<<24,Cn(l,Rn),En(l,31),Cn(l,Nn),kn(s,l),En(s,27),Sn(s,c),Cn(s,Tn),Sn(s,Pn),Cn(u,Nn),En(u,33),Cn(u,Rn),kn(c,u),En(c,31),Sn(c,s),Cn(c,Tn),Sn(c,Fn);l[0]=0,l[1]=0,u[0]=0,u[1]=0;var d=[0,0];switch(i){case 15:d[1]=n[o+14],Mn(d,48),kn(u,d);case 14:d[1]=n[o+13],Mn(d,40),kn(u,d);case 13:d[1]=n[o+12],Mn(d,32),kn(u,d);case 12:d[1]=n[o+11],Mn(d,24),kn(u,d);case 11:d[1]=n[o+10],Mn(d,16),kn(u,d);case 10:d[1]=n[o+9],Mn(d,8),kn(u,d);case 9:d[1]=n[o+8],kn(u,d),Cn(u,Nn),En(u,33),Cn(u,Rn),kn(c,u);case 8:d[1]=n[o+7],Mn(d,56),kn(l,d);case 7:d[1]=n[o+6],Mn(d,48),kn(l,d);case 6:d[1]=n[o+5],Mn(d,40),kn(l,d);case 5:d[1]=n[o+4],Mn(d,32),kn(l,d);case 4:d[1]=n[o+3],Mn(d,24),kn(l,d);case 3:d[1]=n[o+2],Mn(d,16),kn(l,d);case 2:d[1]=n[o+1],Mn(d,8),kn(l,d);case 1:d[1]=n[o],kn(l,d),Cn(l,Rn),En(l,31),Cn(l,Nn),kn(s,l)}return kn(s,r),kn(c,r),Sn(s,c),Sn(c,s),In(s),In(c),Sn(s,c),Sn(c,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)}function Dn(t,e,n,o){var r=Object.keys(t).filter(function(t){return!function(t,e){for(var n=0,o=t.length;n<o;++n)if(t[n]===e)return!0;return!1}(n,t)}),i=gn(pn(r,function(n){return function(t,e){var n=gn(new Promise(function(n){var o=Date.now();fn(t.bind(null,e),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Date.now()-o;if(!t[0])return n(function(){return{error:t[1],duration:r}});var i=t[1];if(function(t){return"function"!=typeof t}(i))return n(function(){return{value:i,duration:r}});n(function(){return new Promise(function(t){var e=Date.now();fn(i,function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=r+Date.now()-e;if(!n[0])return t({error:n[1],duration:i});t({value:n[1],duration:i})})})})})}));return function(){return n.then(function(t){return t()})}}(t[n],e)},o));return function(){return cn(this,void 0,void 0,function(){var t,e,n,a;return ln(this,function(s){switch(s.label){case 0:return[4,i];case 1:return[4,pn(s.sent(),function(t){return gn(t())},o)];case 2:return t=s.sent(),[4,Promise.all(t)];case 3:for(e=s.sent(),n={},a=0;a<r.length;++a)n[r[a]]=e[a];return[2,n]}})})}}function $n(){var t=window,e=navigator;return vn(["MSCSSMatrix"in t,"msSetImmediate"in t,"msIndexedDB"in t,"msMaxTouchPoints"in e,"msPointerEnabled"in e])>=4}function Hn(){var t=window,e=navigator;return vn(["webkitPersistentStorage"in e,"webkitTemporaryStorage"in e,0===(e.vendor||"").indexOf("Google"),"webkitResolveLocalFileSystemURL"in t,"BatteryManager"in t,"webkitMediaStream"in t,"webkitSpeechGrammar"in t])>=5}function Bn(){var t=window;return vn(["ApplePayError"in t,"CSSPrimitiveValue"in t,"Counter"in t,0===navigator.vendor.indexOf("Apple"),"RGBColor"in t,"WebKitMediaKeys"in t])>=4}function Vn(){var t=window,e=t.HTMLElement,n=t.Document;return vn(["safari"in t,!("ongestureend"in t),!("TouchEvent"in t),!("orientation"in t),e&&!("autocapitalize"in e.prototype),n&&"pointerLockElement"in n.prototype])>=4}function Un(){var t,e=window;return t=e.print,/^function\s.*?\{\s*\[native code]\s*}$/.test(String(t))&&"[object WebPageNamespace]"===String(e.browser)}function On(){var t,e,n=window;return vn(["buildID"in navigator,"MozAppearance"in(null!==(e=null===(t=document.documentElement)||void 0===t?void 0:t.style)&&void 0!==e?e:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function jn(){var t=window,e=navigator,n=t.CSS,o=t.HTMLButtonElement;return vn([!("getStorageUpdates"in e),o&&"popover"in o.prototype,"CSSCounterStyleRule"in t,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function zn(){var t=document;return(t.exitFullscreen||t.msExitFullscreen||t.mozCancelFullScreen||t.webkitExitFullscreen).call(t)}function Xn(){var t=Hn(),e=On(),n=window,o=navigator,r="connection";return t?vn([!("SharedWorker"in n),o[r]&&"ontypechange"in o[r],!("sinkId"in new Audio)])>=2:!!e&&vn(["onorientationchange"in n,"orientation"in n,/android/i.test(o.appVersion)])>=2}function Zn(t){var e=new Error(t);return e.name=t,e}function Gn(t,e,n){var o,r,i;return void 0===n&&(n=50),cn(this,void 0,void 0,function(){var a,s;return ln(this,function(c){switch(c.label){case 0:a=document,c.label=1;case 1:return a.body?[3,3]:[4,hn(n)];case 2:return c.sent(),[3,1];case 3:s=a.createElement("iframe"),c.label=4;case 4:return c.trys.push([4,,10,11]),[4,new Promise(function(t,n){var o=!1,r=function(){o=!0,t()};s.onload=r,s.onerror=function(t){o=!0,n(t)};var i=s.style;i.setProperty("display","block","important"),i.position="absolute",i.top="0",i.left="0",i.visibility="hidden",e&&"srcdoc"in s?s.srcdoc=e:s.src="about:blank",a.body.appendChild(s);var c=function(){var t,e;o||("complete"===(null===(e=null===(t=s.contentWindow)||void 0===t?void 0:t.document)||void 0===e?void 0:e.readyState)?r():setTimeout(c,10))};c()})];case 5:c.sent(),c.label=6;case 6:return(null===(r=null===(o=s.contentWindow)||void 0===o?void 0:o.document)||void 0===r?void 0:r.body)?[3,8]:[4,hn(n)];case 7:return c.sent(),[3,6];case 8:return[4,t(s,s.contentWindow)];case 9:return[2,c.sent()];case 10:return null===(i=s.parentNode)||void 0===i||i.removeChild(s),[7];case 11:return[2]}})})}function Yn(t){for(var e=function(t){for(var e,n,o="Unexpected syntax '".concat(t,"'"),r=/^\s*([a-z-]*)(.*)$/i.exec(t),i=r[1]||void 0,a={},s=/([.:#][\w-]+|\[.+?\])/gi,c=function(t,e){a[t]=a[t]||[],a[t].push(e)};;){var l=s.exec(r[2]);if(!l)break;var u=l[0];switch(u[0]){case".":c("class",u.slice(1));break;case"#":c("id",u.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(!d)throw new Error(o);c(d[1],null!==(n=null!==(e=d[4])&&void 0!==e?e:d[5])&&void 0!==n?n:"");break;default:throw new Error(o)}}return[i,a]}(t),n=e[0],o=e[1],r=document.createElement(null!=n?n:"div"),i=0,a=Object.keys(o);i<a.length;i++){var s=a[i],c=o[s].join(" ");"style"===s?_n(r.style,c):r.setAttribute(s,c)}return r}function _n(t,e){for(var n=0,o=e.split(";");n<o.length;n++){var r=o[n],i=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(r);if(i){var a=i[1],s=i[2],c=i[4];t.setProperty(a,s,c||"")}}}var qn=["monospace","sans-serif","serif"],Jn=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function Qn(t){return t.toDataURL()}var Kn,to;function eo(){var t=this;return function(){if(void 0===to){var t=function(){var e=no();oo(e)?to=setTimeout(t,2500):(Kn=e,to=void 0)};t()}}(),function(){return cn(t,void 0,void 0,function(){var t;return ln(this,function(e){switch(e.label){case 0:return oo(t=no())?Kn?[2,un([],Kn,!0)]:(n=document).fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement?[4,zn()]:[3,2]:[3,2];case 1:e.sent(),t=no(),e.label=2;case 2:return oo(t)||(Kn=t),[2,t]}var n})})}}function no(){var t=screen;return[bn(wn(t.availTop),null),bn(wn(t.width)-wn(t.availWidth)-bn(wn(t.availLeft),0),null),bn(wn(t.height)-wn(t.availHeight)-bn(wn(t.availTop),0),null),bn(wn(t.availLeft),null)]}function oo(t){for(var e=0;e<4;++e)if(t[e])return!1;return!0}function ro(t){var e;return cn(this,void 0,void 0,function(){var n,o,r,i,a,s,c;return ln(this,function(l){switch(l.label){case 0:for(n=document,o=n.createElement("div"),r=new Array(t.length),i={},io(o),c=0;c<t.length;++c)"DIALOG"===(a=Yn(t[c])).tagName&&a.show(),io(s=n.createElement("div")),s.appendChild(a),o.appendChild(s),r[c]=a;l.label=1;case 1:return n.body?[3,3]:[4,hn(50)];case 2:return l.sent(),[3,1];case 3:n.body.appendChild(o);try{for(c=0;c<t.length;++c)r[c].offsetParent||(i[t[c]]=!0)}finally{null===(e=o.parentNode)||void 0===e||e.removeChild(o)}return[2,i]}})})}function io(t){t.style.setProperty("visibility","hidden","important"),t.style.setProperty("display","block","important")}function ao(t){return matchMedia("(inverted-colors: ".concat(t,")")).matches}function so(t){return matchMedia("(forced-colors: ".concat(t,")")).matches}function co(t){return matchMedia("(prefers-contrast: ".concat(t,")")).matches}function lo(t){return matchMedia("(prefers-reduced-motion: ".concat(t,")")).matches}function uo(t){return matchMedia("(prefers-reduced-transparency: ".concat(t,")")).matches}function ho(t){return matchMedia("(dynamic-range: ".concat(t,")")).matches}var mo=Math,fo=function(){return 0};var po={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var go=function(){for(var t=window;;){var e=t.parent;if(!e||e===t)return!1;try{if(e.location.origin!==t.location.origin)return!0}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return!0;throw t}t=e}};var yo=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),wo=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),bo=["FRAGMENT_SHADER","VERTEX_SHADER"],vo=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],xo="WEBGL_debug_renderer_info";function So(t){if(t.webgl)return t.webgl.context;var e,n=document.createElement("canvas");n.addEventListener("webglCreateContextError",function(){return e=void 0});for(var o=0,r=["webgl","experimental-webgl"];o<r.length;o++){var i=r[o];try{e=n.getContext(i)}catch(t){}if(e)break}return t.webgl={context:e},e}function Co(t,e,n){var o=t.getShaderPrecisionFormat(t[e],t[n]);return o?[o.rangeMin,o.rangeMax,o.precision]:[]}function Eo(t){return Object.keys(t.__proto__).filter(Mo)}function Mo(t){return"string"==typeof t&&!t.match(/[^A-Z0-9_x]/)}function ko(){return On()}function Ao(){return Hn()||Bn()}function Lo(t){return"function"==typeof t.getParameter}var Io={fonts:function(){var t=this;return Gn(function(e,n){var o=n.document;return cn(t,void 0,void 0,function(){var t,e,n,r,i,a,s,c,l,u,d;return ln(this,function(h){for((t=o.body).style.fontSize="48px",(e=o.createElement("div")).style.setProperty("visibility","hidden","important"),n={},r={},i=function(t){var n=o.createElement("span"),r=n.style;return r.position="absolute",r.top="0",r.left="0",r.fontFamily=t,n.textContent="mmMwWLliI0O&1",e.appendChild(n),n},a=function(t,e){return i("'".concat(t,"',").concat(e))},s=function(){for(var t={},e=function(e){t[e]=qn.map(function(t){return a(e,t)})},n=0,o=Jn;n<o.length;n++){e(o[n])}return t},c=function(t){return qn.some(function(e,o){return t[o].offsetWidth!==n[e]||t[o].offsetHeight!==r[e]})},l=function(){return qn.map(i)}(),u=s(),t.appendChild(e),d=0;d<qn.length;d++)n[qn[d]]=l[d].offsetWidth,r[qn[d]]=l[d].offsetHeight;return[2,Jn.filter(function(t){return c(u[t])})]})})})},domBlockers:function(t){var e=(void 0===t?{}:t).debug;return cn(this,void 0,void 0,function(){var t,n,o,r,i;return ln(this,function(a){switch(a.label){case 0:return Bn()||Xn()?(s=atob,t={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',s("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",s("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",s("LnNwb25zb3JpdA=="),".ylamainos",s("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",s("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",s("LmhlYWRlci1ibG9ja2VkLWFk"),s("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",s("I2FkXzMwMFgyNTA="),s("I2Jhbm5lcmZsb2F0MjI="),s("I2NhbXBhaWduLWJhbm5lcg=="),s("I0FkLUNvbnRlbnQ=")],adGuardChinese:[s("LlppX2FkX2FfSA=="),s("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",s("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),s("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",s("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",s("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",s("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),s("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),s("LmFkZ29vZ2xl"),s("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[s("YW1wLWF1dG8tYWRz"),s("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",s("I2FkX2ludmlld19hcmVh")],adGuardRussian:[s("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),s("LnJlY2xhbWE="),'div[id^="smi2adblock"]',s("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[s("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),s("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",s("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),s("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),s("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",s("I3Jla2xhbWk="),s("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),s("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),s("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[s("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",s("LndpZGdldF9wb19hZHNfd2lkZ2V0"),s("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",s("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[s("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),s("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",s("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",s("I3Jla2xhbW5pLWJveA=="),s("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",s("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[s("I2FkdmVydGVudGll"),s("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",s("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",s("LnNwb25zb3JsaW5rZ3J1ZW4="),s("I3dlcmJ1bmdza3k="),s("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),s("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[s("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",s("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[s("LnJla2xhbW9zX3RhcnBhcw=="),s("LnJla2xhbW9zX251b3JvZG9z"),s("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),s("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),s("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[s("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[s("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),s("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",s("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[s("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),s("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),s("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",s("LmFkX19tYWlu"),s("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[s("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[s("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),s("I2xpdmVyZUFkV3JhcHBlcg=="),s("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),s("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[s("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",s("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),s("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),s("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[s("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),s("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),s("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",s("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),s("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),s("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),s("ZGl2I3NrYXBpZWNfYWQ=")],ro:[s("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),s("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[s("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),s("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),s("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",s("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),s("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",s("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]},n=Object.keys(t),[4,ro((i=[]).concat.apply(i,n.map(function(e){return t[e]})))]):[2,void 0];case 1:return o=a.sent(),e&&function(t,e){for(var n=0,o=Object.keys(t);n<o.length;n++){var r=o[n];"\n".concat(r,":");for(var i=0,a=t[r];i<a.length;i++){var s=a[i];"\n ".concat(e[s]?"🚫":"➡️"," ").concat(s)}}}(t,o),(r=n.filter(function(e){var n=t[e];return vn(n.map(function(t){return o[t]}))>.6*n.length})).sort(),[2,r]}var s})})},fontPreferences:function(){return function(t,e){void 0===e&&(e=4e3);return Gn(function(n,o){var r=o.document,i=r.body,a=i.style;a.width="".concat(e,"px"),a.webkitTextSizeAdjust=a.textSizeAdjust="none",Hn()?i.style.zoom="".concat(1/o.devicePixelRatio):Bn()&&(i.style.zoom="reset");var s=r.createElement("div");return s.textContent=un([],Array(e/20|0),!0).map(function(){return"word"}).join(" "),i.appendChild(s),t(r,i)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}(function(t,e){for(var n={},o={},r=0,i=Object.keys(po);r<i.length;r++){var a=i[r],s=po[a],c=s[0],l=void 0===c?{}:c,u=s[1],d=void 0===u?"mmMwWLliI0fiflO&1":u,h=t.createElement("span");h.textContent=d,h.style.whiteSpace="nowrap";for(var m=0,f=Object.keys(l);m<f.length;m++){var p=f[m],g=l[p];void 0!==g&&(h.style[p]=g)}n[a]=h,e.append(t.createElement("br"),h)}for(var y=0,w=Object.keys(po);y<w.length;y++){o[a=w[y]]=n[a].getBoundingClientRect().width}return o})},audio:function(){return Bn()&&jn()&&Un()||Hn()&&(t=navigator,e=window,n=Audio.prototype,o=e.visualViewport,vn(["srLatency"in n,"srChannelCount"in n,"devicePosture"in t,o&&"segments"in o,"getTextInformation"in Image.prototype])>=3)&&function(){var t=window,e=t.URLPattern;return vn(["union"in Set.prototype,"Iterator"in t,e&&"hasRegExpGroups"in e.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}()?-4:function(){var t=window,e=t.OfflineAudioContext||t.webkitOfflineAudioContext;if(!e)return-2;if(Bn()&&!Vn()&&!function(){var t=window;return vn(["DOMRectList"in t,"RTCPeerConnectionIceEvent"in t,"SVGGeometryElement"in t,"ontransitioncancel"in t])>=3}())return-1;var n=4500,o=new e(1,5e3,44100),r=o.createOscillator();r.type="triangle",r.frequency.value=1e4;var i=o.createDynamicsCompressor();i.threshold.value=-50,i.knee.value=40,i.ratio.value=12,i.attack.value=0,i.release.value=.25,r.connect(i),i.connect(o.destination),r.start(0);var a=function(t){var e=3,n=500,o=500,r=5e3,i=function(){},a=new Promise(function(a,s){var c=!1,l=0,u=0;t.oncomplete=function(t){return a(t.renderedBuffer)};var d=function(){setTimeout(function(){return s(Zn("timeout"))},Math.min(o,u+r-Date.now()))},h=function(){try{var o=t.startRendering();switch(mn(o)&&gn(o),t.state){case"running":u=Date.now(),c&&d();break;case"suspended":document.hidden||l++,c&&l>=e?s(Zn("suspended")):setTimeout(h,n)}}catch(t){s(t)}};h(),i=function(){c||(c=!0,u>0&&d())}});return[a,i]}(o),s=a[0],c=a[1],l=gn(s.then(function(t){return function(t){for(var e=0,n=0;n<t.length;++n)e+=Math.abs(t[n]);return e}(t.getChannelData(0).subarray(n))},function(t){if("timeout"===t.name||"suspended"===t.name)return-3;throw t}));return function(){return c(),l}}();var t,e,n,o},screenFrame:function(){var t=this;if(Bn()&&jn()&&Un())return function(){return Promise.resolve(void 0)};var e=eo();return function(){return cn(t,void 0,void 0,function(){var t,n;return ln(this,function(o){switch(o.label){case 0:return[4,e()];case 1:return t=o.sent(),[2,[(n=function(t){return null===t?null:xn(t,10)})(t[0]),n(t[1]),n(t[2]),n(t[3])]]}})})}},canvas:function(){return function(t){var e,n,o,r=!1,i=function(){var t=document.createElement("canvas");return t.width=1,t.height=1,[t,t.getContext("2d")]}(),a=i[0],s=i[1];!function(t,e){return!(!e||!t.toDataURL)}(a,s)?n=o="unsupported":(r=function(t){return t.rect(0,0,10,10),t.rect(2,2,6,6),!t.isPointInPath(5,5,"evenodd")}(s),t?n=o="skipped":(e=function(t,e){!function(t,e){t.width=240,t.height=60,e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(100,1,62,20),e.fillStyle="#069",e.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat(String.fromCharCode(55357,56835));e.fillText(n,2,15),e.fillStyle="rgba(102, 204, 0, 0.2)",e.font="18pt Arial",e.fillText(n,4,45)}(t,e);var n=Qn(t),o=Qn(t);if(n!==o)return["unstable","unstable"];!function(t,e){t.width=122,t.height=110,e.globalCompositeOperation="multiply";for(var n=0,o=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<o.length;n++){var r=o[n],i=r[0],a=r[1],s=r[2];e.fillStyle=i,e.beginPath(),e.arc(a,s,40,0,2*Math.PI,!0),e.closePath(),e.fill()}e.fillStyle="#f9c",e.arc(60,60,60,0,2*Math.PI,!0),e.arc(60,60,20,0,2*Math.PI,!0),e.fill("evenodd")}(t,e);var r=Qn(t);return[r,n]}(a,s),n=e[0],o=e[1]));return{winding:r,geometry:n,text:o}}(Bn()&&jn()&&Un())},osCpu:function(){return navigator.oscpu},languages:function(){var t,e=navigator,n=[],o=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(void 0!==o&&n.push([o]),Array.isArray(e.languages))Hn()&&vn([!("MediaSettingsRange"in(t=window)),"RTCEncodedAudioFrame"in t,""+t.Intl=="[object Intl]",""+t.Reflect=="[object Reflect]"])>=3||n.push(e.languages);else if("string"==typeof e.languages){var r=e.languages;r&&n.push(r.split(","))}return n},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return bn(wn(navigator.deviceMemory),void 0)},screenResolution:function(){var t,e,n;if(!(Bn()&&jn()&&Un()))return t=screen,(n=[(e=function(t){return bn(yn(t),null)})(t.width),e(t.height)]).sort().reverse(),n},hardwareConcurrency:function(){return bn(yn(navigator.hardwareConcurrency),void 0)},timezone:function(){var t,e=null===(t=window.Intl)||void 0===t?void 0:t.DateTimeFormat;if(e){var n=(new e).resolvedOptions().timeZone;if(n)return n}var o,r=(o=(new Date).getFullYear(),-Math.max(wn(new Date(o,0,1).getTimezoneOffset()),wn(new Date(o,6,1).getTimezoneOffset())));return"UTC".concat(r>=0?"+":"").concat(r)},sessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},localStorage:function(){try{return!!window.localStorage}catch(t){return!0}},indexedDB:function(){var t,e;if(!($n()||(t=window,e=navigator,vn(["msWriteProfilerMark"in t,"MSStream"in t,"msLaunchUri"in e,"msSaveBlob"in e])>=3&&!$n())))try{return!!window.indexedDB}catch(t){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var t=navigator.platform;return"MacIntel"===t&&Bn()&&!Vn()?function(){if("iPad"===navigator.platform)return!0;var t=screen,e=t.width/t.height;return vn(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,e>.65&&e<1.53])>=2}()?"iPad":"iPhone":t},plugins:function(){var t=navigator.plugins;if(t){for(var e=[],n=0;n<t.length;++n){var o=t[n];if(o){for(var r=[],i=0;i<o.length;++i){var a=o[i];r.push({type:a.type,suffixes:a.suffixes})}e.push({name:o.name,description:o.description,mimeTypes:r})}}return e}},touchSupport:function(){var t,e=navigator,n=0;void 0!==e.maxTouchPoints?n=yn(e.maxTouchPoints):void 0!==e.msMaxTouchPoints&&(n=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){t=!1}return{maxTouchPoints:n,touchEvent:t,touchStart:"ontouchstart"in window}},vendor:function(){return navigator.vendor||""},vendorFlavors:function(){for(var t=[],e=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];e<n.length;e++){var o=n[e],r=window[o];r&&"object"==typeof r&&t.push(o)}return t.sort()},cookiesEnabled:function(){var t=document;try{t.cookie="cookietest=1; SameSite=Strict;";var e=-1!==t.cookie.indexOf("cookietest=");return t.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(t){return!1}},colorGamut:function(){for(var t=0,e=["rec2020","p3","srgb"];t<e.length;t++){var n=e[t];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}},invertedColors:function(){return!!ao("inverted")||!ao("none")&&void 0},forcedColors:function(){return!!so("active")||!so("none")&&void 0},monochrome:function(){if(matchMedia("(min-monochrome: 0)").matches){for(var t=0;t<=100;++t)if(matchMedia("(max-monochrome: ".concat(t,")")).matches)return t;throw new Error("Too high value")}},contrast:function(){return co("no-preference")?0:co("high")||co("more")?1:co("low")||co("less")?-1:co("forced")?10:void 0},reducedMotion:function(){return!!lo("reduce")||!lo("no-preference")&&void 0},reducedTransparency:function(){return!!uo("reduce")||!uo("no-preference")&&void 0},hdr:function(){return!!ho("high")||!ho("standard")&&void 0},math:function(){var t,e=mo.acos||fo,n=mo.acosh||fo,o=mo.asin||fo,r=mo.asinh||fo,i=mo.atanh||fo,a=mo.atan||fo,s=mo.sin||fo,c=mo.sinh||fo,l=mo.cos||fo,u=mo.cosh||fo,d=mo.tan||fo,h=mo.tanh||fo,m=mo.exp||fo,f=mo.expm1||fo,p=mo.log1p||fo;return{acos:e(.12312423423423424),acosh:n(1e308),acoshPf:(t=1e154,mo.log(t+mo.sqrt(t*t-1))),asin:o(.12312423423423424),asinh:r(1),asinhPf:function(t){return mo.log(t+mo.sqrt(t*t+1))}(1),atanh:i(.5),atanhPf:function(t){return mo.log((1+t)/(1-t))/2}(.5),atan:a(.5),sin:s(-1e300),sinh:c(1),sinhPf:function(t){return mo.exp(t)-1/mo.exp(t)/2}(1),cos:l(10.000000000123),cosh:u(1),coshPf:function(t){return(mo.exp(t)+1/mo.exp(t))/2}(1),tan:d(-1e300),tanh:h(1),tanhPf:function(t){return(mo.exp(2*t)-1)/(mo.exp(2*t)+1)}(1),exp:m(1),expm1:f(1),expm1Pf:function(t){return mo.exp(t)-1}(1),log1p:p(10),log1pPf:function(t){return mo.log(1+t)}(10),powPI:function(t){return mo.pow(mo.PI,t)}(-100)}},pdfViewerEnabled:function(){return navigator.pdfViewerEnabled},architecture:function(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=1/0,t[0]=t[0]-t[0],e[3]},applePay:function(){var t=window.ApplePaySession;if("function"!=typeof(null==t?void 0:t.canMakePayments))return-1;if(go())return-3;try{return t.canMakePayments()?1:0}catch(t){return function(t){if(t instanceof Error&&"InvalidAccessError"===t.name&&/\bfrom\b.*\binsecure\b/i.test(t.message))return-2;throw t}(t)}},privateClickMeasurement:function(){var t,e=document.createElement("a"),n=null!==(t=e.attributionSourceId)&&void 0!==t?t:e.attributionsourceid;return void 0===n?void 0:String(n)},audioBaseLatency:function(){if(!(Xn()||Bn()))return-2;if(!window.AudioContext)return-1;var t=(new AudioContext).baseLatency;return null==t?-1:isFinite(t)?t:-3},dateTimeLocale:function(){if(!window.Intl)return-1;var t=window.Intl.DateTimeFormat;if(!t)return-2;var e=t().resolvedOptions().locale;return e||""===e?e:-3},webGlBasics:function(t){var e,n,o,r,i,a,s=So(t.cache);if(!s)return-1;if(!Lo(s))return-2;var c=ko()?null:s.getExtension(xo);return{version:(null===(e=s.getParameter(s.VERSION))||void 0===e?void 0:e.toString())||"",vendor:(null===(n=s.getParameter(s.VENDOR))||void 0===n?void 0:n.toString())||"",vendorUnmasked:c?null===(o=s.getParameter(c.UNMASKED_VENDOR_WEBGL))||void 0===o?void 0:o.toString():"",renderer:(null===(r=s.getParameter(s.RENDERER))||void 0===r?void 0:r.toString())||"",rendererUnmasked:c?null===(i=s.getParameter(c.UNMASKED_RENDERER_WEBGL))||void 0===i?void 0:i.toString():"",shadingLanguageVersion:(null===(a=s.getParameter(s.SHADING_LANGUAGE_VERSION))||void 0===a?void 0:a.toString())||""}},webGlExtensions:function(t){var e=So(t.cache);if(!e)return-1;if(!Lo(e))return-2;var n=e.getSupportedExtensions(),o=e.getContextAttributes(),r=[],i=[],a=[],s=[],c=[];if(o)for(var l=0,u=Object.keys(o);l<u.length;l++){var d=u[l];i.push("".concat(d,"=").concat(o[d]))}for(var h=0,m=Eo(e);h<m.length;h++){var f=e[x=m[h]];a.push("".concat(x,"=").concat(f).concat(yo.has(f)?"=".concat(e.getParameter(f)):""))}if(n)for(var p=0,g=n;p<g.length;p++){var y=g[p];if(!(y===xo&&ko()||"WEBGL_polygon_mode"===y&&Ao())){var w=e.getExtension(y);if(w)for(var b=0,v=Eo(w);b<v.length;b++){var x;f=w[x=v[b]];s.push("".concat(x,"=").concat(f).concat(wo.has(f)?"=".concat(e.getParameter(f)):""))}else r.push(y)}}for(var S=0,C=bo;S<C.length;S++)for(var E=C[S],M=0,k=vo;M<k.length;M++){var A=k[M],L=Co(e,E,A);c.push("".concat(E,".").concat(A,"=").concat(L.join(",")))}return s.sort(),a.sort(),{contextAttributes:i,parameters:a,shaderPrecisions:c,extensions:n,extensionParameters:s,unsupportedExtensions:r}}};function Ro(t){var e=function(t){if(Xn())return.4;if(Bn())return!Vn()||jn()&&Un()?.3:.5;var e="value"in t.platform?t.platform.value:"";if(/^Win/.test(e))return.6;if(/^Mac/.test(e))return.5;return.7}(t),n=function(t){return xn(.99+.01*t,1e-4)}(e);return{score:e,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,"".concat(n))}}function No(t){return Wn(function(t){for(var e="",n=0,o=Object.keys(t).sort();n<o.length;n++){var r=o[n],i=t[r],a="error"in i?"error":JSON.stringify(i.value);e+="".concat(e?"|":"").concat(r.replace(/([:|\\])/g,"\\$1"),":").concat(a)}return e}(t))}function To(t){return void 0===t&&(t=50),function(t,e){void 0===e&&(e=1/0);var n=window.requestIdleCallback;return n?new Promise(function(t){return n.call(window,function(){return t()},{timeout:e})}):hn(Math.min(t,e))}(t,2*t)}function Po(t,e){Date.now();return{get:function(n){return cn(this,void 0,void 0,function(){var o,r;return ln(this,function(i){switch(i.label){case 0:return Date.now(),[4,t()];case 1:return o=i.sent(),r=function(t){var e,n=Ro(t);return{get visitorId(){return void 0===e&&(e=No(this.components)),e},set visitorId(t){e=t},confidence:n,components:t,version:dn}}(o),e||null==n||n.debug,[2,r]}})})}}}var Fo={load:function(t){var e;return void 0===t&&(t={}),cn(this,void 0,void 0,function(){var n,o,r;return ln(this,function(i){switch(i.label){case 0:return(null===(e=t.monitoring)||void 0===e||e)&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var t=new XMLHttpRequest;t.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(dn,"/npm-monitoring"),!0),t.send()}catch(t){}}(),n=t.delayFallback,o=t.debug,[4,To(n)];case 1:return i.sent(),r=function(t){return Dn(Io,t,[])}({cache:{},debug:o}),[2,Po(r,o)]}})})},hashComponents:No,componentsToDebugString:function(t){return JSON.stringify(t,function(t,e){return e instanceof Error?sn({name:(n=e).name,message:n.message,stack:null===(o=n.stack)||void 0===o?void 0:o.split("\n")},n):e;var n,o},2)}};class Wo{constructor(){this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async init(t,o){if(!this.isInitialized){this.config=t;try{const r=await this.getDeviceId(),i=this.buildIframeUrl(t,r),a=o?.iconPosition||void 0;if(this.iconManager=new e(a),await this.iconManager.show(),this.iframeManager=new n({src:i,mode:"auto",width:400,height:600,allowClose:!0,onMessage:(t,e)=>{"new-message"===t&&this.showNotification(0,{pulse:!0})},onClose:()=>{this.iconManager?.forceCleanupDragEvents()},...o}),await this.iframeManager.init(),this.iconManager.onClick(()=>{this.clearNotification(),this.iframeManager?.show()}),t.screenshot){const e=document.body;this.screenshotManager=new an(e,t.screenshot),this.screenshotManager.enable(!0)}this.isInitialized=!0}catch(t){throw t}}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(t){this.iconManager?.setPosition(t)}setIconCoordinates(t){this.iconManager?.setIconPosition(t)}setIconStyle(t){this.iconManager?.setStyle(t)}openChat(){this.clearNotification(),this.iframeManager?.open()}closeChat(){this.iconManager?.forceCleanupDragEvents(),this.iframeManager?.close()}isChatOpen(){return this.iframeManager?.isIframeOpen()||!1}sendToIframe(t){this.iframeManager?.sendToIframe(t)}getConnectionStatus(){return this.isInitialized}showNotification(t=1,e={}){this.iconManager&&(this.iconManager.showNotification({badgeCount:"string"==typeof t?0:t,badgeText:"string"==typeof t?t:"",pulse:e.pulse||!1}),e.autoHide&&e.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},e.autoHide))}clearNotification(){this.iconManager?.clearNotification()}setScreenshotTarget(t){this.screenshotManager?.setTargetElement(t)}async captureScreenshot(t=!1){return!!this.screenshotManager&&await this.screenshotManager.captureOnce(t)}enableScreenshot(t){this.screenshotManager&&this.screenshotManager.enable(t)}getScreenshotState(){return this.screenshotManager?.getState()||null}destroy(){this.iconManager?.hide(),this.iframeManager?.close(),this.screenshotManager?.destroy(),this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async getDeviceId(){try{const t=await Fo.load();return(await t.get()).visitorId}catch(t){return"device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}}buildIframeUrl(t,e){const n=t.iframeUrl;if(!n||""===n.trim())throw new Error("iframeUrl is required but not provided or is empty");const o=new URL(n);return t.agent&&""!==t.agent.trim()&&o.searchParams.set("Agent",t.agent),t.token&&""!==t.token.trim()&&o.searchParams.set("Authorization",t.token),o.searchParams.set("DeviceSign",e),o.searchParams.set("Referrer",document.referrer),o.toString()}}let Do=null;const $o=async(t,e)=>{Do||(Do=new Wo),await Do.init(t,e)},Ho=()=>{if(!Do)throw new Error("SDK not initialized. Call init() first.");return Do},Bo=()=>{Ho().showIcon()},Vo=()=>{Ho().hideIcon()},Uo=t=>{Ho().setIconPosition(t)},Oo=t=>{Ho().setIconCoordinates(t)},jo=t=>{Ho().setIconStyle(t)},zo=()=>{Ho().openChat()},Xo=()=>{Ho().closeChat()},Zo=()=>Ho().isChatOpen(),Go=t=>{Ho().sendToIframe(t)},Yo=()=>Ho().getConnectionStatus(),_o=(t=1,e={})=>{Ho().showNotification(t,e)},qo=()=>{Ho().clearNotification()},Jo=()=>{Ho().destroy(),Do=null},Qo=t=>{Ho().setScreenshotTarget(t)},Ko=async(t=!1)=>{const e=Ho();return await e.captureScreenshot(t)},tr=t=>{Ho().enableScreenshot(t)},er=()=>Ho().getScreenshotState();var nr={init:$o,getInstance:Ho,showIcon:Bo,hideIcon:Vo,setIconPosition:Uo,setIconCoordinates:Oo,setIconStyle:jo,openChat:zo,closeChat:Xo,isChatOpen:Zo,sendToIframe:Go,getConnectionStatus:Yo,showNotification:_o,clearNotification:qo,setScreenshotTarget:Qo,captureScreenshot:Ko,enableScreenshot:tr,getScreenshotState:er,destroy:Jo};t.CustomerServiceSDK=Wo,t.captureScreenshot=Ko,t.clearNotification=qo,t.closeChat=Xo,t.default=nr,t.destroy=Jo,t.enableScreenshot=tr,t.getConnectionStatus=Yo,t.getInstance=Ho,t.getScreenshotState=er,t.hideIcon=Vo,t.init=$o,t.isChatOpen=Zo,t.openChat=zo,t.sendToIframe=Go,t.setIconCoordinates=Oo,t.setIconPosition=Uo,t.setIconStyle=jo,t.setScreenshotTarget=Qo,t.showIcon=Bo,t.showNotification=_o,Object.defineProperty(t,"__esModule",{value:!0})});
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("html2canvas")):"function"==typeof define&&define.amd?define(["exports","html2canvas"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CustomerSDK={},t.html2canvas)}(this,function(t,e){"use strict";class n{constructor(t){this.iconElement=null,this.badgeElement=null,this.onClickCallback=null,this.notificationCallback=null,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.iconStartX=0,this.iconStartY=0,this.dragMoveHandler=null,this.dragEndHandler=null,this.iconPosition=null,this.iconPosition=t||null}async show(){if(this.iconElement)return;this.iconElement=document.createElement("div"),this.iconElement.className="customer-sdk-icon";const t={position:"fixed",width:"30px",height:"30px",backgroundColor:"transparent",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:"999999",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",userSelect:"none",transition:"transform 0.2s ease",border:"none",outline:"none",overflow:"visible"};this.iconPosition?(void 0!==this.iconPosition.x?(t.left="number"==typeof this.iconPosition.x?`${this.iconPosition.x}px`:this.iconPosition.x,t.right="auto"):t.right="20px",void 0!==this.iconPosition.y?(t.top="number"==typeof this.iconPosition.y?`${this.iconPosition.y}px`:this.iconPosition.y,t.bottom="auto"):t.bottom="80px"):(t.bottom="80px",t.right="20px"),Object.assign(this.iconElement.style,t);const e=document.createElement("img");e.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAArKSURBVHgB7Z1NbFTXFcf/93mwaGyEabLoIgFTqWRFMZUitSoIu80ial01SFWrKgsGKXYpWdRtFilRK4xUgbKICosmCKIySKCo2UAE6i61XVroDuOoi2YT02RZVFNwQTAzN+e8N88ej9+8j5n3ce5wf5JhPvyY4f3f/9xzz73vXoUeYKish6oljCiFYQ2MaAebVR3D/Jzf1xpDUPTTggIW6feXoOlH0Q9wS9exRK/Pl6qYX6qoJRiOgoEMvqpHWUjlYJ9iQeEJmTb07y6y2CT6HP99/z01C8MwQmB26OMSyuTIH9LTkSA35oLn9FmKCB/WHmP2YUUtQjhiBV4jqsIoJKJJbOC8ZLHFCczhl75UWXvCFuPUDiBXV5TGeWlhXIzALCx9m6Ni3RqfeRL71PJZVYEAChfYdayDc1klSkXBCRr9caxooQsTuIccG4qbiddxsKjQnbvAlDwNVzfgXK8L2wq30ZSMHcs7GctV4IFX9ZTyXGtM8pQq2i2qnCQ3H0NO5CLwk+radnDYrj3CWB5udpAx7FoS96YVdxVy1XCJzgmfG2RMZg5268P9FI6BzP8TRlN3Q/YvkRGZCOyG5H5cApcVLZFkGbJTF3igrEccErfX+rVZk5XIqbbBmyb1y2oDZqy4yfHbZT6HSJHUHDwwqQ/QP1aBpWvIIOXlM+o8UiAVga246ZOWyF0LbMXNjjRE7kpgbi/oS1yCJTNIoP33zqjL6JCOBW5Up24+sWXHvKDyJplojEal5tEBHWXRLG6tHzNW3BxQ7oTBSxvpnKMDOhKYxbVdofxwu1BUW+DqIBKSWODBSf17K24hjFRLbuk3EYkEbhTHbW25KBxMJR2giJ1k2aRKCJR0VR9jd9ySZmwH26RKCKRBicfWYxJLYGp3j9p2VxA0th43VEeGaBuahRIzVEc6uFbCtBVXIDFDdaiDBw/pUdSp7bXIpY6xsCm5oQ5W9fiNuaUgVHjfuK2DN01ovj/IaIE3PwVs/TL9PEOPv7T2vX/fAe7+H/j4c5hPiItLbQ9SyasmRcOCvvJN4OvPAXueB7Y9He+4a/8CFkjoq1TO/9snMA7tuEbcHvReoINNc++eHcCb48De59E1t+94gp+46rncGNq4OFBg6vfehAEzIl/5FnDkB/GdmpQL1w0SWmP2/lk11vryOoFNyJx3Pgu89eN0HBuHP3zkCc1ttmgCXLwui1ZVlCGYw98Brv82P3GZ174L/P031LY/C9FQs3qg9bU1Dm5MWP8UAuEE6v1D+QobxPErnptFQtWt0mNsb14daI2Daxtk3j+09WnPQUWLy7xJbf6RcciEqlu8rknzS2sEpnT7AITB4v759ewSqU6QLHJjJaLV5/4DieFZorjNSA3XpUfY4ofpFQdLDM/vH5YrLsNO5qRPGs1hekVgGu9N9Z6YbuEQKD1rZVjkrcIuwuYw3dwG74MQ+ITxiTMBN7s/DGmsFKlcgd3ihqAxX253TYIjjahQTVq6qxihIbCuyilLcvlRcrvbDo447GYp6IaLXYGVoPUzjhgSmlthcSW52NfUF3gXBGCqe324pCnFxbqhqcO3Q0iZMckCm4w/Hi0Bvt2FtXWqG2W0v5w5SyhFdsv4boiBV8F3pCRYe3egJ+D/h6AwPewoR0b3yPTw3Mzer0EEvN2BQ/m0CAfzPKpeYY+QpoY3J3Eoj96Mgtn5nKw+ZLdI6QmoOraXoIsP0a1TWoPg6TLv/AW4/R/v9zmZSdJuv/MRsPCZd+xrL8avH/PnXryR7NidQqIRtcHbSkpjiy543feoK54nvX3vbW/Gow+LHWdclgXiYxc+T35su8996yfhRQ1JfXmHVUbBRDmCx11v3wl+fSFi4vobHwT/Dh977ZPOPveNP0VPwJPQ5JB5hzJfTjgNrt5q/x7PYQ7j48/av7cQ8l7U5164gVDiNDuZowwROIwoJy096PzYXkCEwFEnOmzgPyrRGt/V+bGhnxvRFZIyWV6GwA/C33+3HNxOc6ITdaIPv9j5se0+15TZJkxf/zempyhWb0SBbHsG+NEL7d8fooRlfGTV6Tu+4g0rvv4SIknz2Be+CvzqJW/UKAxu2//4V4hAbZrQi0Vn0uySfx5Hz8B3Kf70XRQOLzIuIkT79+r2ClHZeV5QN2nJoXqliLnQ1wy8L7cdgu4xvuuQyrchgKj+rClwJBJ0sZKDNURsY37xH+gJrna06G9GKMw7vHU5BCDsyu+YizcgBl1nB/dhEUI4cQVGw8mipIuUzeuUHspwMMMnx6h1MVo4LuwCLVVJYL4LTUqixRyqwEj4whQVnqkPzNo6jSeiXGxiWyzNvWRadyzME1hjFoL4ecWswsfF67Lcy/iaenc2lOQ4mOFB9uNS18FogUOzxJvA/d7RymSdwQn9X2mryp4uy55Oy1Hm278LnvVRKFTbuH9WbeGHq7VoR5aLmXbTbaTw6w8Eiusx5z9YvcO/hg8hjKAJc1LgPOGCsHbXh5LmlZ3SVgTeUJW5/6AvspQSIH8fyeIytb7VpHlFYHdVFiUrm/bhk8rhuujM2p9GK1lcsu/cw9Ory/yvXSdLYJhm/OWUipyKyhGEEyrJOQGjW3aCXSOwG6aFjC75FL1Wlu9anqGxZEDfvDk8M2sEdsuWSo6LixSXmwPu37JrTamsaYVKc3hm1q34rh1ycb34JQ2LEJdF5RB84oqZ5VJVw7rNpIMXBP+ZnqFQPYqCyEtc7sNyCOa7H1hQnmpjQhgORGOeihvr1hcI3rNB4ViRAv/vAfD9t5EpQgsUHUPJ1amg19vvujKpP7Xb2ZkBDw0un1GBm3K0nTZLbfFBWMxAU8RtQ/jOZwW3xZZowtzLhE98V+2vDIsMVD080oYKfP+0mpVavrR4/d6wfQuZyFtXSoquEGHVLQvcMd9ajAgbKfASVUa0DdXy0DjVWrUKIvbyKzbhkkNUYtVM7LsLbagWAodmB2Nxfz22wDZUy0BTnzdOaPZJdH8whYWTHPthKQY698vvkQYJSLwEGq9BXO13N68UvztpL5Gk3W0m8R3+PGZccrCfroxFWHKBxU3S7jbT8SKGAxN6hA6ekTaXuuegpKrah91J2t1mOl6jY/msmlfKDkhkDZ/jTsVlulqE5d4ZdVlpK3JWUMZ8kM8xuiCVdWY3TegydaHOwZIaLC5FyQq6JLWFhK3I6ZGWuExq62Tdoy9EV8t+W+3qAjp3fA7TEpdJfSnwoUN6uFbHjJ3ukwzuCtEfLG6qN+mkvtIdlzT7qM9m+8mJmOd+btriMpksZeiK/Ai7bVkzBnSOSk9hrJuuUBiZ79YwMKmnqCt11BZEWqD2lgcOktaWk5LLdhy2XV7HXNVBOSvXNpPrfiuDk3qartxfPLFuzsm1zeS+oU7DzdPk5sLvf8qZ3FzbTGE7JvG28qqOc09A2J6jVHbanaFaAAVvieVVwOhbHO01oblfqxwcLEpYn8IF9mmUOqfooYjdyLugUMe2IkZgn0boLhvVRnPy5OAyDe2dlyKsjziBfdxkrIZRcnWZnu6DTOZ0HZc3DKKydFKJrMGLFbiZFbGBl8FiF9XN4oEUhVvSRW3GCIFb4TDOW9NTSByln11ZJWi8zDKvxMsLe/J6ntLCbxyMFLiVoSk9VH2IEVd03rKedzX3XD7EO3AG7gvlDc3ddR8qLLpZr6LX6iRoHxZLGzFvgkOj+ALBlx6CtCZy6AAAAABJRU5ErkJggg==",e.style.width="100%",e.style.height="100%",e.style.objectFit="cover",e.style.display="block",e.alt="Customer Service",e.onload=()=>{this.iconElement&&(e.style.opacity="1",e.style.visibility="visible")},e.onerror=t=>{},e.style.opacity="1",e.style.visibility="visible";const n=document.createElement("div");Object.assign(n.style,{width:"100%",height:"100%",borderRadius:"50%",overflow:"hidden",position:"relative"}),n.appendChild(e),this.iconElement.appendChild(n),this.setupDragEvents(),document.body.appendChild(this.iconElement)}forceCleanupDragEvents(){if(this.dragMoveHandler)try{document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)}catch(t){}if(this.dragEndHandler)try{document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)}catch(t){}this.isDragging=!1,this.iconElement&&(this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer")}hide(){this.forceCleanupDragEvents(),this.iconElement&&(this.iconElement.remove(),this.iconElement=null,this.onClickCallback=null,this.dragMoveHandler=null,this.dragEndHandler=null)}setPosition(t){}setIconPosition(t){if(this.iconPosition=t,this.iconElement){void 0!==t.x&&(this.iconElement.style.left="number"==typeof t.x?`${t.x}px`:t.x,this.iconElement.style.right="auto"),void 0!==t.y&&(this.iconElement.style.top="number"==typeof t.y?`${t.y}px`:t.y,this.iconElement.style.bottom="auto");const e=this.iconElement.getBoundingClientRect();this.iconStartX=e.left,this.iconStartY=e.top}}setStyle(t){}onClick(t){this.onClickCallback=t}onNotification(t){this.notificationCallback=t}showNotification(t){if(!this.iconElement)return;const{showBadge:e=!0,badgeCount:n=0,badgeText:o="",pulse:i=!1}=t;(e||n>0)&&this.createBadge(n,o,i),this.notificationCallback&&this.notificationCallback({badgeCount:n,badgeText:o,pulse:i})}clearNotification(){this.badgeElement&&(this.badgeElement.remove(),this.badgeElement=null)}setupDragEvents(){this.iconElement&&(this.dragMoveHandler=this.handleDragMove.bind(this),this.dragEndHandler=this.handleDragEnd.bind(this),this.iconElement.addEventListener("mousedown",this.handleDragStart.bind(this)),this.iconElement.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!1}))}handleDragStart(t){if(!this.iconElement)return;if(t.target!==this.iconElement&&!this.iconElement.contains(t.target))return;t.preventDefault(),t.stopPropagation();const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY;this.isDragging=!1,this.dragStartX=e,this.dragStartY=n;const o=this.iconElement.getBoundingClientRect();this.iconStartX=o.left,this.iconStartY=o.top,this.iconElement.style.transition="none",this.iconElement.style.cursor="grabbing";const i=t=>{const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY,o=e-this.dragStartX,r=n-this.dragStartY;(Math.abs(o)>5||Math.abs(r)>5)&&(this.isDragging=!0,"touches"in t?document.removeEventListener("touchmove",i):document.removeEventListener("mousemove",i),this.dragMoveHandler&&this.dragEndHandler&&("touches"in t?(document.addEventListener("touchmove",this.dragMoveHandler,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",this.dragMoveHandler),document.addEventListener("mouseup",this.dragEndHandler))))};"touches"in t?(document.addEventListener("touchmove",i,{passive:!1}),document.addEventListener("touchend",this.dragEndHandler)):(document.addEventListener("mousemove",i),document.addEventListener("mouseup",this.dragEndHandler))}handleDragMove(t){if(!this.iconElement||!this.isDragging)return;const e="touches"in t?t.touches[0].clientX:t.clientX,n="touches"in t?t.touches[0].clientY:t.clientY,o=t.target;if(o&&o!==this.iconElement&&!this.iconElement.contains(o)){if("IFRAME"===o.tagName||o.closest("iframe")||o.closest(".customer-sdk-container")||o.closest(".customer-sdk-overlay"))return void this.handleDragEnd()}const i=e-this.dragStartX,r=n-this.dragStartY,a=this.iconElement.getBoundingClientRect(),s=a.left+a.width/2,c=a.top+a.height/2;if(Math.sqrt(Math.pow(e-s,2)+Math.pow(n-c,2))>3*Math.max(a.width,a.height))return void this.handleDragEnd();t.preventDefault(),t.stopPropagation();const l=this.iconStartX+i,u=this.iconStartY+r,d=window.innerWidth-this.iconElement.offsetWidth,h=window.innerHeight-this.iconElement.offsetHeight,m=Math.max(0,Math.min(l,d)),f=Math.max(0,Math.min(u,h));this.iconElement.style.left=`${m}px`,this.iconElement.style.top=`${f}px`,this.iconElement.style.right="auto",this.iconElement.style.bottom="auto"}handleDragEnd(t){this.iconElement&&(this.dragMoveHandler&&(document.removeEventListener("mousemove",this.dragMoveHandler),document.removeEventListener("touchmove",this.dragMoveHandler)),this.dragEndHandler&&(document.removeEventListener("mouseup",this.dragEndHandler),document.removeEventListener("touchend",this.dragEndHandler)),this.iconElement.style.transition="transform 0.2s ease",this.iconElement.style.cursor="pointer",this.isDragging||this.handleClick(),this.isDragging=!1)}handleClick(){this.onClickCallback&&this.onClickCallback()}createBadge(t,e="",n=!1){this.clearNotification(),this.badgeElement=document.createElement("div"),this.badgeElement.className="customer-sdk-icon-badge",this.badgeElement.textContent=t>0?t>99?"99+":t.toString():e||"",Object.assign(this.badgeElement.style,{position:"absolute",top:"-4px",left:"-4px",right:"auto",minWidth:"18px",height:"18px",borderRadius:"50%",backgroundColor:"#ff4444",color:"#ffffff",fontSize:"10px",fontWeight:"bold",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"1000001",boxShadow:"0 -1px 4px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.15)",...0===t&&""===e&&{width:"12px",height:"12px",minWidth:"12px",top:"-2px",left:"-2px"},...n&&{animation:"sdk-badge-pulse 1.5s infinite"}}),this.iconElement&&this.iconElement.appendChild(this.badgeElement)}}class o{constructor(t={}){this.iframeElement=null,this.overlayElement=null,this.containerElement=null,this.isOpen=!1,this.isCreated=!1,this.config={src:"",mode:"auto",width:400,height:600,allowClose:!0,...t},this.setupMessageListener()}async init(){try{this.createIframe(),this.isCreated=!0}catch(t){throw t}}show(){if(!this.isOpen){if(!this.isCreated)throw new Error("Iframe not initialized. Call init() first.");try{const t="popup"===this.getActualMode();t&&this.createOverlay(),this.containerElement&&(t?(Object.assign(this.containerElement.style,{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",visibility:"visible",opacity:"1",display:"block"}),this.overlayElement?.appendChild(this.containerElement)):(Object.assign(this.containerElement.style,{position:"fixed",visibility:"visible",opacity:"1",display:"block"}),this.preventBodyScroll(!0))),this.isOpen=!0}catch(t){}}}open(){this.show()}hide(){if(!this.isOpen)return;this.containerElement&&Object.assign(this.containerElement.style,{visibility:"hidden",opacity:"0",display:"none"}),this.overlayElement&&(this.overlayElement.remove(),this.overlayElement=null);"fullscreen"===this.getActualMode()&&this.preventBodyScroll(!1),this.isOpen=!1,this.config.onClose&&this.config.onClose()}close(){this.hide()}destroy(){this.hide(),this.containerElement&&(this.containerElement.remove(),this.containerElement=null,this.iframeElement=null),this.isCreated=!1}isIframeOpen(){return this.isOpen}sendToIframe(t){this.iframeElement&&this.iframeElement.contentWindow&&this.iframeElement.contentWindow.postMessage(t,"*")}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.className="customer-sdk-overlay",Object.assign(this.overlayElement.style,{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:"999998",display:"flex",alignItems:"center",justifyContent:"center",cursor:this.config.allowClose?"pointer":"default"}),this.config.allowClose&&this.overlayElement.addEventListener("click",t=>{t.target===this.overlayElement&&this.close()}),document.body.appendChild(this.overlayElement)}createIframe(){this.containerElement=document.createElement("div"),this.containerElement.className="customer-sdk-container",this.iframeElement=document.createElement("iframe"),this.iframeElement.className="customer-sdk-iframe",this.iframeElement.src=this.config.src||"",this.iframeElement.frameBorder="0",this.iframeElement.setAttribute("allow",["microphone","camera","geolocation","clipboard-read","clipboard-write","fullscreen","autoplay","encrypted-media"].join("; ")),this.iframeElement.setAttribute("sandbox",["allow-same-origin","allow-scripts","allow-forms","allow-popups","allow-popups-to-escape-sandbox","allow-presentation","allow-top-navigation","allow-top-navigation-by-user-activation","allow-downloads","allow-modals","allow-orientation-lock","allow-pointer-lock","allow-storage-access-by-user-activation"].join(" "));const t="popup"===this.getActualMode();this.iframeElement.scrolling=t?"auto":"no";const e={width:t?`${this.config.width}px`:"100%",height:t?`${this.config.height}px`:"100%",maxWidth:t?"450px":"100%",maxHeight:t?"700px":"100%",backgroundColor:"#ffffff",borderRadius:t?"12px":"12px 12px 0 0",boxShadow:t?"0 20px 40px rgba(0, 0, 0, 0.15)":"0 -4px 16px rgba(0, 0, 0, 0.25)",border:"none",position:"fixed",zIndex:"999999",...t?{top:"50%",left:"50%",transform:"translate(-50%, -50%)"}:{top:"0",left:"0",bottom:"0",right:"0",transform:"none",overflow:"hidden",position:"fixed"},visibility:"hidden",opacity:"0",display:"none"};Object.assign(this.containerElement.style,e);const n={width:"100%",height:"100%",border:"none",borderRadius:"inherit",...t?{}:{overflow:"hidden",scrollbarWidth:"none",msOverflowStyle:"none",WebkitScrollbar:"none"}};Object.assign(this.iframeElement.style,n),this.containerElement.appendChild(this.iframeElement),this.iframeElement.addEventListener("load",()=>{t||this.injectMobileStyles()}),document.body.appendChild(this.containerElement)}injectMobileStyles(){if(this.iframeElement)try{const t=this.iframeElement.contentDocument||this.iframeElement.contentWindow?.document;if(t){const e=t.createElement("style");e.textContent="\n /* 移动端iframe全屏样式优化 */\n * {\n -webkit-overflow-scrolling: touch !important;\n }\n \n body, html, #app, .container {\n overflow: auto !important;\n -webkit-overflow-scrolling: touch !important;\n }\n \n /* 隐藏所有滚动条 */\n ::-webkit-scrollbar {\n width: 0px !important;\n height: 0px !important;\n background: transparent !important;\n }\n \n /* Firefox */\n html {\n scrollbar-width: none !important;\n }\n \n /* IE/Edge */\n body {\n -ms-overflow-style: none !important;\n }\n \n /* 确保内容可以滚动 */\n body {\n overflow: auto !important;\n height: 100vh !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n ",t.head?.appendChild(e)}}catch(t){}}preventBodyScroll(t){if(t){const t=window.scrollY;Object.assign(document.body.style,{position:"fixed",top:`-${t}px`,width:"100%",overflow:"hidden"}),document.body.setAttribute("data-scroll-position",t.toString())}else{const t=parseInt(document.body.getAttribute("data-scroll-position")||"0");Object.assign(document.body.style,{position:"",top:"",width:"",overflow:""}),document.body.removeAttribute("data-scroll-position"),window.scrollTo(0,t)}}isMobileDevice(){return window.innerWidth<=768||/Android|iPhone|iPad|iPod|Opera Mini|IEMobile/i.test(navigator.userAgent)}getActualMode(){return"auto"===this.config.mode?this.isMobileDevice()?"fullscreen":"popup":this.config.mode}setupMessageListener(){window.addEventListener("message",t=>{this.config.src&&t.origin!==new URL(this.config.src).origin||this.handleIframeMessage(t.data)},!1)}handleIframeMessage(t){let e;if("string"==typeof t)e=t;else{if(!t||!t.type)return;e=t.type}switch(e){case"iframe_ready":break;case"close_iframe":case"close":this.close();break;case"resize_iframe":case"resize":t.width&&t.height&&this.resizeIframe(t.width,t.height);break;case"new-message":this.config.onMessage&&this.config.onMessage(e,t)}}resizeIframe(t,e){this.iframeElement&&(this.iframeElement.style.width=`${t}px`,this.iframeElement.style.height=`${e}px`)}}const i="p".charCodeAt(0),r="H".charCodeAt(0),a="Y".charCodeAt(0),s="s".charCodeAt(0);let c;function l(t){let e=-1;c||(c=function(){const t=new Int32Array(256);for(let e=0;e<256;e++){let n=e;for(let t=0;t<8;t++)n=1&n?3988292384^n>>>1:n>>>1;t[e]=n}return t}());for(let n=0;n<t.length;n++)e=c[255&(e^t[n])]^e>>>8;return-1^e}function u(t,e,n=!1){const o=new Uint8Array(13);e*=39.3701,o[0]=i,o[1]=r,o[2]=a,o[3]=s,o[4]=e>>>24,o[5]=e>>>16,o[6]=e>>>8,o[7]=255&e,o[8]=o[4],o[9]=o[5],o[10]=o[6],o[11]=o[7],o[12]=1;const c=l(o),u=new Uint8Array(4);if(u[0]=c>>>24,u[1]=c>>>16,u[2]=c>>>8,u[3]=255&c,n){const e=function(t){for(let e=t.length-1;e>=4;e--)if(9===t[e-4]&&t[e-3]===i&&t[e-2]===r&&t[e-1]===a&&t[e]===s)return e-3;return 0}(t);return t.set(o,e),t.set(u,e+13),t}{const e=new Uint8Array(4);e[0]=0,e[1]=0,e[2]=0,e[3]=9;const n=new Uint8Array(54);return n.set(t,0),n.set(e,33),n.set(o,37),n.set(u,50),n}}const d="undefined"!=typeof window,h=d&&"Worker"in window,m=d&&"atob"in window,f=d&&"btoa"in window,p=d?window.navigator?.userAgent:"",g=p.includes("Chrome"),y=p.includes("AppleWebKit")&&!g,w=p.includes("Firefox"),b=t=>1===t.nodeType,v=t=>"object"==typeof t.className,x=t=>"image"===t.tagName,S=t=>b(t)&&void 0!==t.style&&!v(t),C=t=>8===t.nodeType,E=t=>"IMG"===t.tagName,M=t=>"VIDEO"===t.tagName,k=t=>"SLOT"===t.tagName;function A(t){const e=t?.createElement?.("canvas");return e&&(e.height=e.width=1),Boolean(e)&&"toDataURL"in e&&Boolean(e.toDataURL("image/webp").includes("image/webp"))}const L=t=>t.startsWith("data:");function I(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(d&&t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;if(!d)return t;const n=R().implementation.createHTMLDocument(),o=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(o),n.body.appendChild(i),e&&(o.href=e),i.href=t,i.href}function R(t){return(t&&b(t)?t?.ownerDocument:t)??window.document}const T="http://www.w3.org/2000/svg";const P=t=>function(t,e){return new Promise((n,o)=>{const i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>o(i.error),i.onabort=()=>o(new Error(`Failed read blob to ${e}`)),i.readAsDataURL(t)})}(t,"dataUrl");function N(t,e){const n=R(e).createElement("img");return n.decoding="sync",n.loading="eager",n.src=t,n}function F(t,e){return new Promise(n=>{const{timeout:o,ownerDocument:i,onError:r,onWarn:a}=e??{},s="string"==typeof t?N(t,R(i)):t;let c=null,l=null;function u(){n(s),c&&clearTimeout(c),l?.()}if(o&&(c=setTimeout(u,o)),M(s)){const t=s.currentSrc||s.src;if(!t)return s.poster?F(s.poster,e).then(n):u();if(s.readyState>=2)return u();const o=u,i=e=>{a?.("Failed video load",t,e),r?.(e),u()};l=()=>{s.removeEventListener("loadeddata",o),s.removeEventListener("error",i)},s.addEventListener("loadeddata",o,{once:!0}),s.addEventListener("error",i,{once:!0})}else{const t=x(s)?s.href.baseVal:s.currentSrc||s.src;if(!t)return u();const e=async()=>{if(E(s)&&"decode"in s)try{await s.decode()}catch(e){a?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||t,e)}u()},n=e=>{a?.("Failed image load",s.dataset.originalSrc||t,e),u()};if(E(s)&&s.complete)return e();l=()=>{s.removeEventListener("load",e),s.removeEventListener("error",n)},s.addEventListener("load",e,{once:!0}),s.addEventListener("error",n,{once:!0})}})}const W=function(){let t=0;return()=>(t+=1,`u${`0000${(Math.random()*36**4|0).toString(36)}`.slice(-4)}${t}`)}();function D(t){return t?.split(",").map(t=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}function H(t){return{time:e=>t&&void 0,timeEnd:e=>t&&void 0,warn:(...e)=>t&&void 0}}async function $(t,e){return(n=t)&&"__CONTEXT__"in n?t:B(t,{...e,autoDestruct:!0});var n}async function B(t,e){const{scale:n=1,workerUrl:o,workerNumber:i=1}=e||{},r=Boolean(e?.debug),a=e?.features??!0,s=t.ownerDocument??(d?window.document:void 0),c=t.ownerDocument?.defaultView??(d?window:void 0),l=new Map,u={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:r,fetch:{requestInit:(m=e?.fetch?.bypassingCache,{cache:m?"no-cache":"force-cache"}),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:!1,...e?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:!1,...e,__CONTEXT__:!0,log:H(r),node:t,ownerDocument:s,ownerWindow:c,dpi:1===n?null:96*n,svgStyleElement:U(s),svgDefsElement:s?.createElementNS(T,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:h&&o&&i?i:0})].map(()=>{try{const t=new Worker(o);return t.onmessage=async t=>{const{url:e,result:n}=t.data;n?l.get(e)?.resolve?.(n):l.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},t.onmessageerror=t=>{const{url:e}=t.data;l.get(e)?.reject?.(new Error(`Error receiving message from worker: ${e}`))},t}catch(t){return u.log.warn("Failed to new Worker",t),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[A(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:l,drawImageCount:0,tasks:[],features:a,isEnable:t=>"restoreScrollPosition"===t?"boolean"!=typeof a&&(a[t]??!1):"boolean"==typeof a?a:a[t]??!0,shadowRoots:[]};var m;u.log.time("wait until load"),await async function(t,e){S(t)&&(E(t)||M(t)?await F(t,e):await Promise.all(["img","video"].flatMap(n=>Array.from(t.querySelectorAll(n)).map(t=>F(t,e)))))}(t,{timeout:u.timeout,onWarn:u.log.warn}),u.log.timeEnd("wait until load");const{width:f,height:p}=function(t,e){let{width:n,height:o}=e;if(b(t)&&(!n||!o)){const e=t.getBoundingClientRect();n=n||e.width||Number(t.getAttribute("width"))||0,o=o||e.height||Number(t.getAttribute("height"))||0}return{width:n,height:o}}(t,u);return u.width=f,u.height=p,u}function U(t){if(!t)return;const e=t.createElement("style"),n=e.ownerDocument.createTextNode("\n.______background-clip--text {\n background-clip: text;\n -webkit-background-clip: text;\n}\n");return e.appendChild(n),e}async function V(t,e){const{log:n,timeout:o,drawImageCount:i,drawImageInterval:r}=e;n.time("image to canvas");const a=await F(t,{timeout:o,onWarn:e.log.warn}),{canvas:s,context2d:c}=function(t,e){const{width:n,height:o,scale:i,backgroundColor:r,maximumCanvasSize:a}=e,s=t.createElement("canvas");s.width=Math.floor(n*i),s.height=Math.floor(o*i),s.style.width=`${n}px`,s.style.height=`${o}px`,a&&(s.width>a||s.height>a)&&(s.width>a&&s.height>a?s.width>s.height?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a):s.width>a?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a));const c=s.getContext("2d");c&&r&&(c.fillStyle=r,c.fillRect(0,0,s.width,s.height));return{canvas:s,context2d:c}}(t.ownerDocument,e),l=()=>{try{c?.drawImage(a,0,0,s.width,s.height)}catch(t){e.log.warn("Failed to drawImage",t)}};if(l(),e.isEnable("fixSvgXmlDecode"))for(let t=0;t<i;t++)await new Promise(e=>{setTimeout(()=>{c?.clearRect(0,0,s.width,s.height),l(),e()},t+r)});return e.drawImageCount=0,n.timeEnd("image to canvas"),s}function O(t,e){if(t.ownerDocument)try{const e=t.toDataURL();if("data:,"!==e)return N(e,t.ownerDocument)}catch(t){e.log.warn("Failed to clone canvas",t)}const n=t.cloneNode(!1),o=t.getContext("2d"),i=n.getContext("2d");try{return o&&i&&i.putImageData(o.getImageData(0,0,t.width,t.height),0,0),n}catch(t){e.log.warn("Failed to clone canvas",t)}return n}function j(t,e){return(t=>"CANVAS"===t.tagName)(t)?O(t,e):(t=>"IFRAME"===t.tagName)(t)?function(t,e){try{if(t?.contentDocument?.body)return tt(t.contentDocument.body,e)}catch(t){e.log.warn("Failed to clone iframe",t)}return t.cloneNode(!1)}(t,e):E(t)?function(t){const e=t.cloneNode(!1);return t.currentSrc&&t.currentSrc!==t.src&&(e.src=t.currentSrc,e.srcset=""),"lazy"===e.loading&&(e.loading="eager"),e}(t):M(t)?async function(t,e){if(t.ownerDocument&&!t.currentSrc&&t.poster)return N(t.poster,t.ownerDocument);const n=t.cloneNode(!1);n.crossOrigin="anonymous",t.currentSrc&&t.currentSrc!==t.src&&(n.src=t.currentSrc);const o=n.ownerDocument;if(o){let i=!0;if(await F(n,{onError:()=>i=!1,onWarn:e.log.warn}),!i)return t.poster?N(t.poster,t.ownerDocument):n;n.currentTime=t.currentTime,await new Promise(t=>{n.addEventListener("seeked",t,{once:!0})});const r=o.createElement("canvas");r.width=t.offsetWidth,r.height=t.offsetHeight;try{const t=r.getContext("2d");t&&t.drawImage(n,0,0,r.width,r.height)}catch(o){return e.log.warn("Failed to clone video",o),t.poster?N(t.poster,t.ownerDocument):n}return O(r,e)}return n}(t,e):t.cloneNode(!1)}const z=["width","height","-webkit-text-fill-color"],X=["stroke","fill"];function Z(t,e,n){const{defaultComputedStyles:o}=n,i=t.nodeName.toLowerCase(),r=v(t)&&"svg"!==i,a=r?X.map(e=>[e,t.getAttribute(e)]).filter(([,t])=>null!==t):[],s=[r&&"svg",i,a.map((t,e)=>`${t}=${e}`).join(","),e].filter(Boolean).join(":");if(o.has(s))return o.get(s);const c=function(t){let e=t.sandbox;if(!e){const{ownerDocument:n}=t;try{n&&(e=n.createElement("iframe"),e.id=`__SANDBOX__${W()}`,e.width="0",e.height="0",e.style.visibility="hidden",e.style.position="fixed",n.body.appendChild(e),e.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',t.sandbox=e)}catch(e){t.log.warn("Failed to getSandBox",e)}}return e}(n),l=c?.contentWindow;if(!l)return new Map;const u=l?.document;let d,h;r?(d=u.createElementNS(T,"svg"),h=d.ownerDocument.createElementNS(d.namespaceURI,i),a.forEach(([t,e])=>{h.setAttributeNS(null,t,e)}),d.appendChild(h)):d=h=u.createElement(i),h.textContent=" ",u.body.appendChild(d);const m=l.getComputedStyle(h,e),f=new Map;for(let t=m.length,e=0;e<t;e++){const t=m.item(e);z.includes(t)||f.set(t,m.getPropertyValue(t))}return u.body.removeChild(d),o.set(s,f),f}function G(t,e,n){const o=new Map,i=[],r=new Map;if(n)for(const t of n)a(t);else for(let e=t.length,n=0;n<e;n++){a(t.item(n))}for(let t=i.length,e=0;e<t;e++)r.get(i[e])?.forEach((t,e)=>o.set(e,t));function a(n){const a=t.getPropertyValue(n),s=t.getPropertyPriority(n),c=n.lastIndexOf("-"),l=c>-1?n.substring(0,c):void 0;if(l){let t=r.get(l);t||(t=new Map,r.set(l,t)),t.set(n,[a,s])}(e.get(n)!==a||s)&&(l?i.push(l):o.set(n,[a,s]))}return o}const Y=[":before",":after"],_=[":-webkit-scrollbar",":-webkit-scrollbar-button",":-webkit-scrollbar-thumb",":-webkit-scrollbar-track",":-webkit-scrollbar-track-piece",":-webkit-scrollbar-corner",":-webkit-resizer"];const q=new Set(["symbol"]);async function J(t,e,n,o,i){if(b(n)&&((t=>"STYLE"===t.tagName)(n)||(t=>"SCRIPT"===t.tagName)(n)))return;if(o.filter&&!o.filter(n))return;q.has(e.nodeName)||q.has(n.nodeName)?o.currentParentNodeStyle=void 0:o.currentParentNodeStyle=o.currentNodeStyle;const r=await tt(n,o,!1,i);o.isEnable("restoreScrollPosition")&&function(t,e){if(!S(t)||!S(e))return;const{scrollTop:n,scrollLeft:o}=t;if(!n&&!o)return;const{transform:i}=e.style,r=new DOMMatrix(i),{a:a,b:s,c:c,d:l}=r;r.a=1,r.b=0,r.c=0,r.d=1,r.translateSelf(-o,-n),r.a=a,r.b=s,r.c=c,r.d=l,e.style.transform=r.toString()}(t,r),e.appendChild(r)}async function Q(t,e,n,o){let i=t.firstChild;b(t)&&t.shadowRoot&&(i=t.shadowRoot?.firstChild,n.shadowRoots.push(t.shadowRoot));for(let r=i;r;r=r.nextSibling)if(!C(r))if(b(r)&&k(r)&&"function"==typeof r.assignedNodes){const i=r.assignedNodes();for(let r=0;r<i.length;r++)await J(t,e,i[r],n,o)}else await J(t,e,r,n,o)}const K=/^[\w-:]+$/;async function tt(t,e,n=!1,o){const{ownerDocument:i,ownerWindow:r,fontFamilies:a,onCloneEachNode:s}=e;if(i&&(t=>3===t.nodeType)(t))return o&&/\S/.test(t.data)&&o(t.data),i.createTextNode(t.data);if(i&&r&&b(t)&&(S(t)||v(t))){const o=await j(t,e);if(e.isEnable("removeAbnormalAttributes")){const t=o.getAttributeNames();for(let e=t.length,n=0;n<e;n++){const e=t[n];K.test(e)||o.removeAttribute(e)}}const i=e.currentNodeStyle=function(t,e,n,o){const{ownerWindow:i,includeStyleProperties:r,currentParentNodeStyle:a}=o,s=e.style,c=i.getComputedStyle(t),l=Z(t,null,o);a?.forEach((t,e)=>{l.delete(e)});const u=G(c,l,r);u.delete("transition-property"),u.delete("all"),u.delete("d"),u.delete("content"),n&&(u.delete("margin-top"),u.delete("margin-right"),u.delete("margin-bottom"),u.delete("margin-left"),u.delete("margin-block-start"),u.delete("margin-block-end"),u.delete("margin-inline-start"),u.delete("margin-inline-end"),u.set("box-sizing",["border-box",""])),"text"===u.get("background-clip")?.[0]&&e.classList.add("______background-clip--text"),g&&(u.has("font-kerning")||u.set("font-kerning",["normal",""]),"hidden"!==u.get("overflow-x")?.[0]&&"hidden"!==u.get("overflow-y")?.[0]||"ellipsis"!==u.get("text-overflow")?.[0]||t.scrollWidth!==t.clientWidth||u.set("text-overflow",["clip",""]));for(let t=s.length,e=0;e<t;e++)s.removeProperty(s.item(e));return u.forEach(([t,e],n)=>{s.setProperty(n,t,e)}),u}(t,o,n,e);n&&function(t,e){const{backgroundColor:n,width:o,height:i,style:r}=e,a=t.style;if(n&&a.setProperty("background-color",n,"important"),o&&a.setProperty("width",`${o}px`,"important"),i&&a.setProperty("height",`${i}px`,"important"),r)for(const t in r)a[t]=r[t]}(o,e);let r=!1;if(e.isEnable("copyScrollbar")){const e=[i.get("overflow-x")?.[0],i.get("overflow-y")?.[0]];r=e.includes("scroll")||(e.includes("auto")||e.includes("overlay"))&&(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)}const c=i.get("text-transform")?.[0],l=D(i.get("font-family")?.[0]),u=l?t=>{"uppercase"===c?t=t.toUpperCase():"lowercase"===c?t=t.toLowerCase():"capitalize"===c&&(t=t[0].toUpperCase()+t.substring(1)),l.forEach(e=>{let n=a.get(e);n||a.set(e,n=new Set),t.split("").forEach(t=>n.add(t))})}:void 0;return function(t,e,n,o,i){const{ownerWindow:r,svgStyleElement:a,svgStyles:s,currentNodeStyle:c}=o;function l(n){const a=r.getComputedStyle(t,n);let l=a.getPropertyValue("content");if(!l||"none"===l)return;i?.(l),l=l.replace(/(')|(")|(counter\(.+\))/g,"");const u=[W()],d=Z(t,n,o);c?.forEach((t,e)=>{d.delete(e)});const h=G(a,d,o.includeStyleProperties);h.delete("content"),h.delete("-webkit-locale"),"text"===h.get("background-clip")?.[0]&&e.classList.add("______background-clip--text");const m=[`content: '${l}';`];if(h.forEach(([t,e],n)=>{m.push(`${n}: ${t}${e?" !important":""};`)}),1===m.length)return;try{e.className=[e.className,...u].join(" ")}catch(t){return void o.log.warn("Failed to copyPseudoClass",t)}const f=m.join("\n ");let p=s.get(f);p||(p=[],s.set(f,p)),p.push(`.${u[0]}:${n}`)}a&&r&&(Y.forEach(l),n&&_.forEach(l))}(t,o,r,e,u),function(t,e){((t=>"TEXTAREA"===t.tagName)(t)||(t=>"INPUT"===t.tagName)(t)||(t=>"SELECT"===t.tagName)(t))&&e.setAttribute("value",t.value)}(t,o),M(t)||await Q(t,o,e,u),await(s?.(o)),o}const c=t.cloneNode(!1);return await Q(t,c,e),await(s?.(c)),c}function et(t){if(t.ownerDocument=void 0,t.ownerWindow=void 0,t.svgStyleElement=void 0,t.svgDefsElement=void 0,t.svgStyles.clear(),t.defaultComputedStyles.clear(),t.sandbox){try{t.sandbox.remove()}catch(e){t.log.warn("Failed to destroyContext",e)}t.sandbox=void 0}t.workers=[],t.fontFamilies.clear(),t.fontCssTexts.clear(),t.requests.clear(),t.tasks=[],t.shadowRoots=[]}function nt(t,e){const{url:n,requestType:o="text",responseType:i="text",imageDom:r}=e;let a=n;const{timeout:s,acceptOfImage:c,requests:l,fetchFn:u,fetch:{requestInit:d,bypassingCache:h,placeholderImage:m},font:f,workers:p,fontFamilies:g}=t;"image"===o&&(y||w)&&t.drawImageCount++;let b=l.get(n);if(!b){h&&h instanceof RegExp&&h.test(a)&&(a+=(/\?/.test(a)?"&":"?")+(new Date).getTime());const e=o.startsWith("font")&&f&&f.minify,w=new Set;if(e){o.split(";")[1].split(",").forEach(t=>{g.has(t)&&g.get(t).forEach(t=>w.add(t))})}const v=e&&w.size,x={url:a,timeout:s,responseType:v?"arrayBuffer":i,headers:"image"===o?{accept:c}:void 0,...d};b={type:o,resolve:void 0,reject:void 0,response:null},b.response=(async()=>{if(u&&"image"===o){const t=await u(n);if(t)return t}return!y&&n.startsWith("http")&&p.length?new Promise((t,e)=>{p[l.size&p.length-1].postMessage({rawUrl:n,...x}),b.resolve=t,b.reject=e}):function(t){const{url:e,timeout:n,responseType:o,...i}=t,r=new AbortController,a=n?setTimeout(()=>r.abort(),n):void 0;return fetch(e,{signal:r.signal,...i}).then(t=>{if(!t.ok)throw new Error("Failed fetch, not 2xx response",{cause:t});switch(o){case"arrayBuffer":return t.arrayBuffer();case"dataUrl":return t.blob().then(P);default:return t.text()}}).finally(()=>clearTimeout(a))}(x)})().catch(e=>{if(l.delete(n),"image"===o&&m)return t.log.warn("Failed to fetch image base64, trying to use placeholder image",a),"string"==typeof m?m:m(r);throw e}),l.set(n,b)}return b.response}async function ot(t,e,n,o){if(!it(t))return t;for(const[i,r]of function(t,e){const n=[];return t.replace(rt,(t,o,i)=>(n.push([i,I(i,e)]),t)),n.filter(([t])=>!L(t))}(t,e))try{const e=await nt(n,{url:r,requestType:o?"image":"text",responseType:"dataUrl"});t=t.replace(at(i),`$1${e}$3`)}catch(t){n.log.warn("Failed to fetch css data url",i,t)}return t}function it(t){return/url\((['"]?)([^'"]+?)\1\)/.test(t)}const rt=/url\((['"]?)([^'"]+?)\1\)/g;function at(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}const st=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function ct(t,e){const{tasks:n}=e;b(t)&&((E(t)||x(t))&&n.push(...function(t,e){if(E(t)){const n=t.currentSrc||t.src;if(!L(n))return[nt(e,{url:n,imageDom:t,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(t.srcset="",t.dataset.originalSrc=n,t.src=e||"")})];(y||w)&&e.drawImageCount++}else if(v(t)&&!L(t.href.baseVal)){const n=t.href.baseVal;return[nt(e,{url:n,imageDom:t,requestType:"image",responseType:"dataUrl"}).then(e=>{e&&(t.dataset.originalSrc=n,t.href.baseVal=e||"")})]}return[]}(t,e)),"use"===t.tagName&&n.push(...function(t,e){const{ownerDocument:n,svgDefsElement:o}=e,i=t.getAttribute("href")??t.getAttribute("xlink:href");if(!i)return[];const[r,a]=i.split("#");if(a){const i=`#${a}`,s=e.shadowRoots.reduce((t,e)=>t??e.querySelector(`svg ${i}`),n?.querySelector(`svg ${i}`));if(r&&t.setAttribute("href",i),o?.querySelector(i))return[];if(s)return o?.appendChild(s.cloneNode(!0)),[];if(r)return[nt(e,{url:r,responseType:"text"}).then(t=>{o?.insertAdjacentHTML("beforeend",t)})]}return[]}(t,e))),S(t)&&n.push(...function(t,e){return st.map(n=>{const o=t.getPropertyValue(n);return o&&"none"!==o?((y||w)&&e.drawImageCount++,ot(o,null,e,!0).then(e=>{e&&o!==e&&t.setProperty(n,e,t.getPropertyPriority(n))})):null}).filter(Boolean)}(t.style,e)),t.childNodes.forEach(t=>{ct(t,e)})}async function lt(t,e){const{ownerDocument:n,svgStyleElement:o,fontFamilies:i,fontCssTexts:r,tasks:a,font:s}=e;if(n&&o&&i.size)if(s&&s.cssText){const t=ft(s.cssText,e);o.appendChild(n.createTextNode(`${t}\n`))}else{const t=Array.from(n.styleSheets).filter(t=>{try{return"cssRules"in t&&Boolean(t.cssRules.length)}catch(n){return e.log.warn(`Error while reading CSS rules from ${t.href}`,n),!1}});await Promise.all(t.flatMap(t=>Array.from(t.cssRules).map(async(n,o)=>{if("CSSImportRule"===n.constructor.name){let i=o+1;const r=n.href;let a="";try{a=await nt(e,{url:r,requestType:"text",responseType:"text"})}catch(t){e.log.warn(`Error fetch remote css import from ${r}`,t)}const s=a.replace(rt,(t,e,n)=>t.replace(n,I(n,r)));for(const n of function(t){if(null==t)return[];const e=[];let n=t.replace(ut,"");for(;;){const t=dt.exec(n);if(!t)break;e.push(t[0])}n=n.replace(dt,"");const o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let t=o.exec(n);if(t)i.lastIndex=o.lastIndex;else{if(t=i.exec(n),!t)break;o.lastIndex=i.lastIndex}e.push(t[0])}return e}(s))try{t.insertRule(n,n.startsWith("@import")?i+=1:t.cssRules.length)}catch(t){e.log.warn("Error inserting rule from remote css import",{rule:n,error:t})}}})));t.flatMap(t=>Array.from(t.cssRules)).filter(t=>"CSSFontFaceRule"===t.constructor.name&&it(t.style.getPropertyValue("src"))&&D(t.style.getPropertyValue("font-family"))?.some(t=>i.has(t))).forEach(t=>{const i=t,s=r.get(i.cssText);s?o.appendChild(n.createTextNode(`${s}\n`)):a.push(ot(i.cssText,i.parentStyleSheet?i.parentStyleSheet.href:null,e).then(t=>{t=ft(t,e),r.set(i.cssText,t),o.appendChild(n.createTextNode(`${t}\n`))}))})}}const ut=/(\/\*[\s\S]*?\*\/)/g,dt=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;const ht=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,mt=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ft(t,e){const{font:n}=e,o=n?n?.preferredFormat:void 0;return o?t.replace(mt,t=>{for(;;){const[e,,n]=ht.exec(t)||[];if(!n)return"";if(n===o)return`src: ${e};`}}):t}async function pt(t,e){const n=await $(t,e);if(b(n.node)&&v(n.node))return n.node;const{ownerDocument:o,log:i,tasks:r,svgStyleElement:a,svgDefsElement:s,svgStyles:c,font:l,progress:u,autoDestruct:d,onCloneNode:h,onEmbedNode:m,onCreateForeignObjectSvg:f}=n;i.time("clone node");const p=await tt(n.node,n,!0);if(a&&o){let t="";c.forEach((e,n)=>{t+=`${e.join(",\n")} {\n ${n}\n}\n`}),a.appendChild(o.createTextNode(t))}i.timeEnd("clone node"),await(h?.(p)),!1!==l&&b(p)&&(i.time("embed web font"),await lt(0,n),i.timeEnd("embed web font")),i.time("embed node"),ct(p,n);const g=r.length;let y=0;u?.(y,g),await Promise.all([...Array.from({length:4})].map(async()=>{for(;;){const t=r.pop();if(!t)break;try{await t}catch(t){n.log.warn("Failed to run task",t)}u?.(++y,g)}})),i.timeEnd("embed node"),await(m?.(p));const w=function(t,e){const{width:n,height:o}=e,i=function(t,e,n){const o=R(n).createElementNS(T,"svg");return o.setAttributeNS(null,"width",t.toString()),o.setAttributeNS(null,"height",e.toString()),o.setAttributeNS(null,"viewBox",`0 0 ${t} ${e}`),o}(n,o,t.ownerDocument),r=i.ownerDocument.createElementNS(i.namespaceURI,"foreignObject");return r.setAttributeNS(null,"x","0%"),r.setAttributeNS(null,"y","0%"),r.setAttributeNS(null,"width","100%"),r.setAttributeNS(null,"height","100%"),r.append(t),i.appendChild(r),i}(p,n);return s&&w.insertBefore(s,w.children[0]),a&&w.insertBefore(a,w.children[0]),d&&et(n),await(f?.(w)),w}async function gt(t,e){const n=await $(t,e),o=await pt(n),i=function(t,e){let n=(new XMLSerializer).serializeToString(t);return e&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}(o,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=U(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(T,"defs"),n.svgStyles.clear());const r=N(i,o.ownerDocument);return await V(r,n)}async function yt(t,e){return async function(t,e){const n=await $(t,e),{log:o,quality:i,type:r,dpi:a}=n,s=await gt(n);o.time("canvas to data url");let c=s.toDataURL(r,i);if(["image/png","image/jpeg"].includes(r)&&a&&m&&f){const[t,e]=c.split(",");let n=0,o=!1;if("image/png"===r){const t=function(t){let e=t.indexOf("AAlwSFlz");return-1===e&&(e=t.indexOf("AAAJcEhZ")),-1===e&&(e=t.indexOf("AAAACXBI")),e}(e);t>=0?(n=4*Math.ceil((t+28)/3),o=!0):n=44}else"image/jpeg"===r&&(n=24);const i=e.substring(0,n),s=e.substring(n),l=window.atob(i),d=new Uint8Array(l.length);for(let t=0;t<d.length;t++)d[t]=l.charCodeAt(t);const h="image/png"===r?u(d,a,o):function(t,e){return t[13]=1,t[14]=e>>8,t[15]=255&e,t[16]=e>>8,t[17]=255&e,t}(d,a);c=[t,",",window.btoa(String.fromCharCode(...h)),s].join("")}return o.timeEnd("canvas to data url"),c}(await $(t,{...e,type:"image/png"}))}var wt={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 bt(t){const e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;const n=e[2].trim();return n.startsWith("#")?null:n}function vt(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}var xt=function(t="[snapDOM]",{ttlMs:e=3e5,maxEntries:n=12}={}){const o=new Map;let i=0;function r(t,r,a){if(i>=n)return;const s=Date.now();(o.get(r)||0)>s||(o.set(r,s+e),i++,"warn"===t&&console&&console.warn||console&&console.error)}return{warnOnce(t,e){r("warn",t)},errorOnce(t,e){r("error",t)},reset(){o.clear(),i=0}}}("[snapDOM]",{ttlMs:18e4,maxEntries:10}),St=new Map,Ct=new Map;function Et(t,e){if(!e)return!1;if(function(t){return/^data:|^blob:|^about:blank$/i.test(t)}(t))return!1;if(function(t,e){try{const n="undefined"!=typeof location&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,i=new URL(o||".",n),r=new URL(t,n);if(r.origin===i.origin)return!0;const a=r.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}(t,e))return!1;try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",n=new URL(t,e);return"undefined"==typeof location||n.origin!==location.origin}catch{return!!e}}function Mt(t){return new Promise((e,n)=>{const o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}async function kt(t,e={}){const n=e.as??"blob",o=e.timeout??3e3,i=e.useProxy||"",r=e.errorTTL??8e3,a=e.headers||{},s=!!e.silent;if(/^data:/i.test(t))try{if("text"===n)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if("dataURL"===n)return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};const[,e="",o=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],i=/;base64/i.test(e)?atob(o):decodeURIComponent(o),r=new Uint8Array([...i].map(t=>t.charCodeAt(0))),a=new Blob([r],{type:(e||"").split(";")[0]||""});return{ok:!0,data:a,status:200,url:t,fromCache:!1,mime:a.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{const e=await fetch(t);if(!e.ok)return{ok:!1,data:null,status:e.status,url:t,fromCache:!1,reason:"http_error"};const o=await e.blob(),i=o.type||e.headers.get("content-type")||"";if("dataURL"===n){return{ok:!0,data:await Mt(o),status:e.status,url:t,fromCache:!1,mime:i}}if("text"===n){return{ok:!0,data:await o.text(),status:e.status,url:t,fromCache:!1,mime:i}}return{ok:!0,data:o,status:e.status,url:t,fromCache:!1,mime:i}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return"dataURL"===n?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:"text"===n?"":new Blob([]),status:200,url:t,fromCache:!1};const c=function(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}(t,{as:n,timeout:o,useProxy:i,errorTTL:r}),l=Ct.get(c);if(l&&l.until>Date.now())return{...l.result,fromCache:!0};l&&Ct.delete(c);const u=St.get(c);if(u)return u;const d=Et(t,i)?function(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",vt(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}${vt(t)}`;const n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}(t,i):t;let h=e.credentials;if(!h)try{const e="undefined"!=typeof location&&location.href?location.href:"http://localhost/",n=new URL(t,e),o="undefined"!=typeof location&&n.origin===location.origin;h=o?"include":"omit"}catch{h="omit"}const m=new AbortController,f=setTimeout(()=>m.abort("timeout"),o),p=(async()=>{try{const o=await fetch(d,{signal:m.signal,credentials:h,headers:a});if(!o.ok){const i={ok:!1,data:null,status:o.status,url:d,fromCache:!1,reason:"http_error"};if(r>0&&Ct.set(c,{until:Date.now()+r,result:i}),!s){const e=`${o.status} ${o.statusText||""}`.trim();xt.warnOnce(`http:${o.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${e} while fetching ${n} ${t}`)}return e.onError&&e.onError(i),i}if("text"===n){return{ok:!0,data:await o.text(),status:o.status,url:d,fromCache:!1}}const i=await o.blob(),l=i.type||o.headers.get("content-type")||"";if("dataURL"===n){return{ok:!0,data:await Mt(i),status:o.status,url:d,fromCache:!1,mime:l}}return{ok:!0,data:i,status:o.status,url:d,fromCache:!1,mime:l}}catch(i){const a=i&&"object"==typeof i&&"name"in i&&"AbortError"===i.name?String(i.message||"").includes("timeout")?"timeout":"abort":"network",l={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:a};if(!/^blob:/i.test(t)&&r>0&&Ct.set(c,{until:Date.now()+r,result:l}),!s){const e=`${a}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,i="timeout"===a?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:"abort"===a?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;xt.errorOnce(e,i)}return e.onError&&e.onError(l),l}finally{clearTimeout(f),St.delete(c)}})();return St.set(c,p),p}function At(t,e){if(!e||!t.width||!t.height)return t;const n=document.createElement("canvas");n.width=t.width,n.height=t.height;const o=n.getContext("2d");return o.fillStyle=e,o.fillRect(0,0,n.width,n.height),o.drawImage(t,0,0),n}async function Lt(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||"none"===t.trim())return t;const n=bt(t);if(!n)return t;const o=vt(n);if(wt.background.has(o)){const t=wt.background.get(o);return t?`url("${t}")`:"none"}try{const t=await kt(o,{as:"dataURL",useProxy:e.useProxy});return t.ok?(wt.background.set(o,t.data),`url("${t.data}")`):(wt.background.set(o,null),"none")}catch{return wt.background.set(o,null),"none"}}var It=new Set(["meta","script","noscript","title","link","template"]),Rt=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"]);var Tt=/(?:^|-)(animation|transition)(?:-|$)/i,Pt=/^(--|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,Nt=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 Ft(t){const e=String(t).toLowerCase();return!!Nt.has(e)||(!!Pt.test(e)||!!Tt.test(e))}function Wt(t,e){if(e=String(e||"").toLowerCase(),Rt.has(e))return"";const n=[],o=function(t){if(t=String(t).toLowerCase(),Rt.has(t)){const e={};return wt.defaultStyle.set(t,e),e}if(wt.defaultStyle.has(t))return wt.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));const n=document.createElement(t);n.style.all="initial",e.appendChild(n);const o=getComputedStyle(n),i={};for(let t of o){if(Ft(t))continue;const e=o.getPropertyValue(t);i[t]=e}return e.removeChild(n),wt.defaultStyle.set(t,i),i}(e);for(let[e,i]of Object.entries(t)){if(Ft(e))continue;const t=o[e];i&&i!==t&&n.push(`${e}:${i}`)}return n.sort(),n.join(";")}function Dt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=wt.computedStyle.get(t);if(n||(n=new Map,wt.computedStyle.set(t,n)),!n.has(e)){const o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Ht(t){const e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function $t(t){const e=[];let n=0,o=0;for(let i=0;i<t.length;i++){const r=t[i];"("===r&&n++,")"===r&&n--,","===r&&0===n&&(e.push(t.slice(o,i).trim()),o=i+1)}return e.push(t.slice(o).trim()),e}function Bt(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function Ut(){const t="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent:"",e=/^((?!chrome|android).)*safari/i.test(t),n=/AppleWebKit/i.test(t)&&/Mobile/i.test(t)&&!/Safari/i.test(t),o=/(MicroMessenger|wxwork|WeCom|WindowsWechat|MacWechat)/i.test(t);return e||n||o}var Vt=new WeakMap,Ot=new Map,jt=0;function zt(){jt++}var Xt=!1;var Zt=new WeakMap;function Gt(t,e=null,n={}){const o=Vt.get(t);if(o&&o.epoch===jt)return o.snapshot;const i=e||getComputedStyle(t),r=function(t,e={}){const n={},o=t.getPropertyValue("visibility");for(let e=0;e<t.length;e++){const o=t[e];let i=t.getPropertyValue(o);"background-image"!==o&&"content"!==o||!i.includes("url(")||i.includes("data:")||(i="none"),n[o]=i}if(e.embedFonts){const e=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(const o of e)if(!n[o])try{const e=t.getPropertyValue(o);e&&(n[o]=e)}catch{}}return"hidden"===o&&(n.opacity="0"),n}(i,n);return function(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;const o=e.display||"";if(o.includes("flex")||o.includes("grid"))return;if(function(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}(t))return;const i=e.position;if("absolute"===i||"fixed"===i||"sticky"===i)return;if("none"!==e.transform)return;if(function(t){if(t.backgroundImage&&"none"!==t.backgroundImage)return!0;if(t.backgroundColor&&"rgba(0, 0, 0, 0)"!==t.backgroundColor&&"transparent"!==t.backgroundColor)return!0;if((parseFloat(t.borderTopWidth)||0)>0)return!0;if((parseFloat(t.borderBottomWidth)||0)>0)return!0;if((parseFloat(t.paddingTop)||0)>0)return!0;if((parseFloat(t.paddingBottom)||0)>0)return!0;const e=t.overflowBlock||t.overflowY||"visible";return"visible"!==e}(e))return;if(function(t){const e=t.parentElement;if(!e)return!1;const n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}(t))return;if(!function(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;const n=t.firstElementChild,o=t.lastElementChild;if(n&&"BR"===n.tagName||o&&"BR"===o.tagName)return!0;const i=t.scrollHeight;if(0===i)return!1;const r=parseFloat(e.paddingTop)||0,a=parseFloat(e.paddingBottom)||0;return i>r+a}(t,e))return;delete n.height,delete n["block-size"]}(t,i,r),Vt.set(t,{epoch:jt,snapshot:r}),r}async function Yt(t,e,n,o){if("STYLE"===t.tagName)return;const i=function(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:Ot,defaultStyle:wt.defaultStyle,baseStyle:wt.baseStyle,image:wt.image,resource:wt.resource,background:wt.background,font:wt.font},options:e||{}}:{session:wt.session,persist:{snapshotKeyCache:Ot,defaultStyle:wt.defaultStyle,baseStyle:wt.baseStyle,image:wt.image,resource:wt.resource,background:wt.background,font:wt.font},options:t||e||{}}}(n,o),r=i.options&&i.options.cache||"auto";if("disabled"!==r&&function(t=document.documentElement){if(!Xt){Xt=!0;try{new MutationObserver(()=>zt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>zt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{const t=document.fonts;t&&(t.addEventListener?.("loadingdone",zt),t.ready?.then(()=>zt()).catch(()=>{}))}catch{}}}(document.documentElement),"disabled"!==r||i.session.__bumpedForDisabled||(zt(),Ot.clear(),i.session.__bumpedForDisabled=!0),Rt.has(t.tagName?.toLowerCase())){const n=t.getAttribute?.("style");n&&e.setAttribute("style",n)}const{session:a,persist:s}=i;a.styleCache.has(t)||a.styleCache.set(t,getComputedStyle(t));const c=Gt(t,a.styleCache.get(t),i.options),l=function(t){let e=Zt.get(t);return e||(e=Object.entries(t).sort((t,e)=>t[0]<e[0]?-1:t[0]>e[0]?1:0).map(([t,e])=>`${t}:${e}`).join(";"),Zt.set(t,e),e)}(c);let u=s.snapshotKeyCache.get(l);if(!u){u=Wt(c,t.tagName?.toLowerCase()||"div"),s.snapshotKeyCache.set(l,u)}a.styleMap.set(e,u)}function _t(t,e,n){return Promise.all(t.map(t=>new Promise(o=>{!function i(){Bt(n=>{!n||"function"!=typeof n.timeRemaining||n.timeRemaining()>0?e(t,o):i()},{fast:n})}()})))}function qt(t,e){return t?t=(t=(t=(t=(t=t.replace(/:host\(([^)]+)\)/g,(t,n)=>`:where(${e}:is(${n.trim()}))`)).replace(/:host\b/g,`:where(${e})`)).replace(/:host-context\(([^)]+)\)/g,(t,n)=>`:where(:where(${n.trim()}) ${e})`)).replace(/::slotted\(([^)]+)\)/g,(t,n)=>`:where(${e} ${n.trim()})`)).replace(/(^|})(\s*)([^@}{]+){/g,(t,n,o,i)=>{const r=function(t,e,n=!0){return t.split(",").map(t=>t.trim()).filter(Boolean).map(t=>{if(t.startsWith(":where("))return t;if(t.startsWith("@"))return t;const o=n?(i=(i=t).trim())?/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(i)?i:`${i}:not([data-sd-slotted])`:i:t;var i;return`:where(${e} ${o})`}).join(", ")}(i,e,!0);return`${n}${o}${r}{`}):""}function Jt(t,e){try{let n=getComputedStyle(t).getPropertyValue(e).trim();if(n)return n}catch{}try{let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(t)return t}catch{}return""}async function Qt(t,e,n){const o=await async function(t,e=3){const n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}};let o=n(),i=0;for(;i<e&&(!o||!o.body&&!o.documentElement);)await new Promise(t=>setTimeout(t,0)),o=n(),i++;return o&&(o.body||o.documentElement)?o:null}(t,3);if(!o)throw new Error("iframe document not accessible/ready");const{contentWidth:i,contentHeight:r,rect:a}=function(t){const e=t.getBoundingClientRect();let n=0,o=0,i=0,r=0;try{const e=getComputedStyle(t);n=parseFloat(e.borderLeftWidth)||0,o=parseFloat(e.borderRightWidth)||0,i=parseFloat(e.borderTopWidth)||0,r=parseFloat(e.borderBottomWidth)||0}catch{}return{contentWidth:Math.max(0,Math.round(e.width-(n+o))),contentHeight:Math.max(0,Math.round(e.height-(i+r))),rect:e}}(t),s=n?.snap;if(!s||"function"!=typeof s.toPng)throw new Error("snapdom.toPng not available in iframe or window");const c={...n,scale:1},l=function(t,e,n){const o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(o),()=>{try{o.remove()}catch{}}}(o,i,r);let u;try{u=await s.toPng(o.documentElement,c)}finally{l()}u.style.display="block",u.style.width=`${i}px`,u.style.height=`${r}px`;const d=document.createElement("div");return e.nodeMap.set(d,t),Yt(t,d,e,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(u),d}async function Kt(t,e,n){if(!t)throw new Error("Invalid node");const o=new Set;let i,r=null,a=null;if(t.nodeType===Node.ELEMENT_NODE){const e=(t.localName||t.tagName||"").toLowerCase();if("snapdom-sandbox"===t.id||t.hasAttribute("data-snapdom-sandbox"))return null;if(It.has(e))return null}if(t.nodeType===Node.TEXT_NODE)return t.cloneNode(!0);if(t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if("exclude"===t.getAttribute("data-capture")){if("hide"===n.excludeMode){const e=document.createElement("div"),n=t.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,e}if("remove"===n.excludeMode)return null}if(n.exclude&&Array.isArray(n.exclude))for(const e of n.exclude)try{if(t.matches?.(e)){if("hide"===n.excludeMode){const e=document.createElement("div"),n=t.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,e}if("remove"===n.excludeMode)return null}}catch(t){}if("function"==typeof n.filter)try{if(!n.filter(t)){if("hide"===n.filterMode){const e=document.createElement("div"),n=t.getBoundingClientRect();return e.style.cssText=`display:inline-block;width:${n.width}px;height:${n.height}px;visibility:hidden;`,e}if("remove"===n.filterMode)return null}}catch(t){}if("IFRAME"===t.tagName){let o=!1;try{o=!(!t.contentDocument&&!t.contentWindow?.document)}catch{o=!1}if(o)try{return await Qt(t,e,n)}catch(t){}if(n.placeholders){const o=document.createElement("div");return o.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,Yt(t,o,e,n),o}{const o=t.getBoundingClientRect(),i=document.createElement("div");return i.style.cssText=`display:inline-block;width:${o.width}px;height:${o.height}px;visibility:hidden;`,Yt(t,i,e,n),i}}if("placeholder"===t.getAttribute("data-capture")){const o=t.cloneNode(!1);e.nodeMap.set(o,t),Yt(t,o,e,n);const i=document.createElement("div");return i.textContent=t.getAttribute("data-placeholder-text")||"",i.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",o.appendChild(i),o}if("CANVAS"===t.tagName){const o=t.toDataURL(),i=document.createElement("img");return i.src=o,i.width=t.width,i.height=t.height,e.nodeMap.set(i,t),Yt(t,i,e,n),i}try{if(i=t.cloneNode(!1),function(t,e){if(!(t instanceof Element&&e instanceof Element))return;const n=t.getAttribute?.("style");let o,i=!(!n||!n.includes("var("));if(!i&&t.attributes?.length){const e=t.attributes;for(let t=0;t<e.length;t++){const n=e[t];if(n&&"string"==typeof n.value&&n.value.includes("var(")){i=!0;break}}}if(!i)return;try{o=getComputedStyle(t)}catch{return}const r=t.style;if(r&&r.length)for(let t=0;t<r.length;t++){const n=r[t],i=r.getPropertyValue(n);if(!i||!i.includes("var("))continue;const a=o.getPropertyValue(n);if(a)try{e.style.setProperty(n,a.trim(),r.getPropertyPriority(n))}catch{}}if(t.attributes?.length){const n=t.attributes;for(let t=0;t<n.length;t++){const i=n[t];if(!i||"string"!=typeof i.value||!i.value.includes("var("))continue;const r=i.name;let a="";try{a=o.getPropertyValue(r)}catch{}if(a)try{e.style.setProperty(r,a.trim())}catch{}}}}(t,i),e.nodeMap.set(i,t),"IMG"===t.tagName){!function(t,e){try{const 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{}}(t,i);try{const e=t.getBoundingClientRect();let n=Math.round(e.width||0),o=Math.round(e.height||0);if(!n||!o){const e=window.getComputedStyle(t),i=parseFloat(e.width)||0,r=parseFloat(e.height)||0,a=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,c=t.width||t.naturalWidth||0,l=t.height||t.naturalHeight||0;n=Math.round(n||i||a||c||0),o=Math.round(o||r||s||l||0)}n&&(i.dataset.snapdomWidth=String(n)),o&&(i.dataset.snapdomHeight=String(o))}catch{}}}catch(t){throw t}if(t instanceof HTMLTextAreaElement){const e=t.getBoundingClientRect();i.style.width=`${e.width}px`,i.style.height=`${e.height}px`}if(t instanceof HTMLInputElement&&(i.value=t.value,i.setAttribute("value",t.value),void 0!==t.checked&&(i.checked=t.checked,t.checked&&i.setAttribute("checked",""),t.indeterminate&&(i.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(r=t.value),t instanceof HTMLTextAreaElement&&(a=t.value),Yt(t,i,e,n),t.shadowRoot){let r=function(t,o){if(t.nodeType===Node.ELEMENT_NODE&&"STYLE"===t.tagName)return o(null);Kt(t,e,n).then(t=>{o(t||null)}).catch(()=>{o(null)})};try{const e=t.shadowRoot.querySelectorAll("slot");for(const t of e){let e=[];try{e=t.assignedNodes?.({flatten:!0})||t.assignedNodes?.()||[]}catch{e=t.assignedNodes?.()||[]}for(const t of e)o.add(t)}}catch{}const a=function(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}(e),s=`[data-sd="${a}"]`;try{i.setAttribute("data-sd",a)}catch{}const c=function(t){let e="";try{t.querySelectorAll("style").forEach(t=>{e+=(t.textContent||"")+"\n"});const n=t.adoptedStyleSheets||[];for(const t of n)try{if(t&&t.cssRules)for(const n of t.cssRules)e+=n.cssText+"\n"}catch{}}catch{}return e}(t.shadowRoot),l=qt(c,s),u=function(t,e,n){const o=[];for(const n of e){const e=Jt(t,n);e&&o.push(`${n}: ${e};`)}return o.length?`${n}{${o.join("")}}\n`:""}(t,function(t){const e=new Set;if(!t)return e;const n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g;let o;for(;o=n.exec(t);)e.add(o[1]);return e}(c),s);!function(t,e,n){if(!e)return;const o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}(i,u+l,a);const d=document.createDocumentFragment(),h=await _t(Array.from(t.shadowRoot.childNodes),r,n.fast);d.append(...h.filter(t=>!!t)),i.appendChild(d)}if("SLOT"===t.tagName){let o=function(t,o){Kt(t,e,n).then(t=>{var e;t&&(e=t)&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted",""))),o(t||null)}).catch(()=>{o(null)})};const i=t.assignedNodes?.({flatten:!0})||[],r=i.length>0?i:Array.from(t.childNodes),a=document.createDocumentFragment(),s=await _t(Array.from(r),o,n.fast);return a.append(...s.filter(t=>!!t)),a}const s=await _t(Array.from(t.childNodes),function(t,i){if(o.has(t))return i(null);Kt(t,e,n).then(t=>{i(t||null)}).catch(()=>{i(null)})},n.fast);if(i.append(...s.filter(t=>!!t)),null!==r&&i instanceof HTMLSelectElement){i.value=r;for(const t of i.options)t.value===r?t.setAttribute("selected",""):t.removeAttribute("selected")}return null!==a&&i instanceof HTMLTextAreaElement&&(i.textContent=a),i}var te=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],ee=[];function ne(t){const e="string"==typeof t?t:"",n=[...te,...ee];for(const t of n)if(t instanceof RegExp&&t.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}async function oe(t,e,n,o=32,i="#000"){e=e.replace(/^['"]+|['"]+$/g,"");const r=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}const a=document.createElement("span");a.textContent=t,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${e}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${o}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);const s=a.getBoundingClientRect(),c=Math.ceil(s.width),l=Math.ceil(s.height);document.body.removeChild(a);const u=document.createElement("canvas");u.width=Math.max(1,c*r),u.height=Math.max(1,l*r);const d=u.getContext("2d");return d.scale(r,r),d.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=i,d.fillText(t,0,0),{dataUrl:u.toDataURL(),width:c,height:l}}var ie=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function re(t){if(!t)return"";for(let e of t.split(",")){let t=e.trim().replace(/^['"]+|['"]+$/g,"");if(t&&!ie.has(t.toLowerCase()))return t}return""}function ae(t){const e=String(t??"400").trim().toLowerCase();if("normal"===e)return 400;if("bold"===e)return 700;const n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function se(t){const e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function ce(t,e){if(!t)return!1;try{const n=new URL(t,location.href);if(n.origin===location.origin)return!0;const o=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(t=>o.endsWith(t)))return!0;const i=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(i)||/\.woff2?(\b|$)/.test(i))return!0;for(const t of e){const e=t.toLowerCase().replace(/\s+/g,"+"),n=t.toLowerCase().replace(/\s+/g,"-");if(i.includes(e)||i.includes(n))return!0}return!1}catch{return!1}}function le(t,e){return t?t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(t,n,o)=>{const i=(o||"").trim();if(!i||/^data:|^blob:|^https?:|^file:|^about:/i.test(i))return t;let r=i;try{r=new URL(i,e||location.href).href}catch{}return`url("${r}")`}):t}var ue=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g;async function de(t,e,n){if(!t)return t;const o=new Set;function i(t,e){try{return new URL(t,e||location.href).href}catch{return t}}let r=le(t,e||location.href);return r=await async function t(e,r,a=0){if(a>4)return e;let s,c="",l=0;for(;s=ue.exec(e);){c+=e.slice(l,s.index),l=ue.lastIndex;const u=i((s[2]||s[4]||"").trim(),r);if(o.has(u))continue;o.add(u);let d="";try{const t=await kt(u,{as:"text",useProxy:n,silent:!0});t.ok&&"string"==typeof t.data&&(d=t.data)}catch{}d?(d=le(d,u),d=await t(d,u,a+1),c+=`\n/* inlined: ${u} */\n${d}\n`):c+=s[0]}return c+=e.slice(l),c}(r,e||location.href,0),r}var he=/url\((["']?)([^"')]+)\1\)/g,me=/@font-face[^{}]*\{[^}]*\}/g;function fe(t){if(!t)return[];const e=[],n=t.split(",").map(t=>t.trim()).filter(Boolean);for(const t of n){const n=t.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!n)continue;const o=n[1],i=n[2],r=t=>{if(!t.includes("?"))return parseInt(t,16);return[parseInt(t.replace(/\?/g,"0"),16),parseInt(t.replace(/\?/g,"F"),16)]};if(i){const t=r(o),n=r(i),a=Array.isArray(t)?t[0]:t,s=Array.isArray(n)?n[1]:n;e.push([Math.min(a,s),Math.max(a,s)])}else{const t=r(o);Array.isArray(t)?e.push([t[0],t[1]]):e.push([t,t])}}return e}function pe(t,e){if(!e.length)return!0;if(!t||0===t.size)return!0;for(const n of t)for(const[t,o]of e)if(n>=t&&n<=o)return!0;return!1}function ge(t,e){const n=[];if(!t)return n;for(const o of t.matchAll(he)){let t=(o[2]||"").trim();if(t&&!t.startsWith("data:")){if(!/^https?:/i.test(t))try{t=new URL(t,e||location.href).href}catch{}n.push(t)}}return n}async function ye(t,e,n=""){let o=t;for(const i of t.matchAll(he)){const t=bt(i[0]);if(!t)continue;let r=t;if(!r.startsWith("http")&&!r.startsWith("data:"))try{r=new URL(r,e||location.href).href}catch{}if(!ne(r))if(wt.resource?.has(r))wt.font?.add(r),o=o.replace(i[0],`url(${wt.resource.get(r)})`);else if(!wt.font?.has(r))try{const t=await kt(r,{as:"dataURL",useProxy:n,silent:!0});if(t.ok&&"string"==typeof t.data){const e=t.data;wt.resource?.set(r,e),wt.font?.add(r),o=o.replace(i[0],`url(${e})`)}}catch{}}return o}function we(t={}){const e=new Set((t.families||[]).map(t=>String(t).toLowerCase())),n=new Set((t.domains||[]).map(t=>String(t).toLowerCase())),o=new Set((t.subsets||[]).map(t=>String(t).toLowerCase()));return(t,i)=>{if(e.size&&e.has(t.family.toLowerCase()))return!0;if(n.size)for(const e of t.srcUrls)try{if(n.has(new URL(e).host.toLowerCase()))return!0}catch{}if(o.size){const t=function(t){if(!t.length)return null;const e=(e,n)=>t.some(([t,o])=>!(o<e||t>n)),n=e(0,255)||e(305,305),o=e(256,591)||e(7680,7935),i=e(880,1023),r=e(1024,1279);return e(7840,7929)||e(258,259)||e(416,417)||e(431,432)?"vietnamese":r?"cyrillic":i?"greek":o?"latin-ext":n?"latin":null}(i);if(t&&o.has(t))return!0}return!1}}async function be(t,e,n,o){let i;try{i=t.cssRules||[]}catch{return}const r=(t,e)=>{try{return new URL(t,e||location.href).href}catch{return t}};for(const t of i){if(t.type===CSSRule.IMPORT_RULE&&t.styleSheet){const i=t.href?r(t.href,e):e;if(o.depth>=4)continue;if(i&&o.visitedSheets.has(i))continue;i&&o.visitedSheets.add(i);const a={...o,depth:(o.depth||0)+1};await be(t.styleSheet,i,n,a);continue}if(t.type===CSSRule.FONT_FACE_RULE){const i=re((t.style.getPropertyValue("font-family")||"").trim());if(!i||ne(i))continue;const r=(t.style.getPropertyValue("font-weight")||"400").trim(),a=(t.style.getPropertyValue("font-style")||"normal").trim(),s=(t.style.getPropertyValue("font-stretch")||"100%").trim(),c=(t.style.getPropertyValue("src")||"").trim(),l=(t.style.getPropertyValue("unicode-range")||"").trim();if(!o.faceMatchesRequired(i,a,r,s))continue;const u=fe(l);if(!pe(o.usedCodepoints,u))continue;const d={family:i,weightSpec:r,styleSpec:a,stretchSpec:s,unicodeRange:l,srcRaw:c,srcUrls:ge(c,e||location.href),href:e||location.href};if(o.simpleExcluder&&o.simpleExcluder(d,u))continue;if(/url\(/i.test(c)){const t=await ye(c,e||location.href,o.useProxy);await n(`@font-face{font-family:${i};src:${t};font-style:${a};font-weight:${r};font-stretch:${s};${l?`unicode-range:${l};`:""}}`)}else await n(`@font-face{font-family:${i};src:${c};font-style:${a};font-weight:${r};font-stretch:${s};${l?`unicode-range:${l};`:""}}`)}}}async function ve({required:t,usedCodepoints:e,exclude:n,localFonts:o=[],useProxy:i=""}={}){t instanceof Set||(t=new Set),e instanceof Set||(e=new Set);const r=new Map;for(const e of t){const[t,n,o,i]=String(e).split("__");if(!t)continue;const a=r.get(t)||[];a.push({w:parseInt(n,10),s:o,st:parseInt(i,10)}),r.set(t,a)}function a(t,e,n,o){if(!r.has(t))return!1;const i=r.get(t),a=function(t){const e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){const t=ae(n[1]),e=ae(n[2]);return{min:Math.min(t,e),max:Math.max(t,e)}}const o=ae(e);return{min:o,max:o}}(n),s=function(t){const e=String(t||"normal").trim().toLowerCase();return"italic"===e?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}(e),c=function(t){const e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){const t=parseFloat(n[1]),e=parseFloat(n[2]);return{min:Math.min(t,e),max:Math.max(t,e)}}const o=e.match(/(\d+(?:\.\d+)?)\s*%/),i=o?parseFloat(o[1]):100;return{min:i,max:i}}(o),l=a.min!==a.max,u=a.min,d=t=>"normal"===s.kind&&"normal"===t||"normal"!==s.kind&&("italic"===t||"oblique"===t);let h=!1;for(const t of i){const e=l?t.w>=a.min&&t.w<=a.max:t.w===u,n=d(se(t.s)),o=t.st>=c.min&&t.st<=c.max;if(e&&n&&o){h=!0;break}}if(h)return!0;if(!l)for(const t of i){const e=d(se(t.s)),n=t.st>=c.min&&t.st<=c.max;if(Math.abs(u-t.w)<=300&&e&&n)return!0}return!1}const s=we(n),c=function(t,e,n,o){return`fonts-embed-css::req=${Array.from(t||[]).sort().join("|")}::ex=${e?JSON.stringify({families:(e.families||[]).map(t=>String(t).toLowerCase()).sort(),domains:(e.domains||[]).map(t=>String(t).toLowerCase()).sort(),subsets:(e.subsets||[]).map(t=>String(t).toLowerCase()).sort()}):""}::lf=${(n||[]).map(t=>`${(t.family||"").toLowerCase()}::${t.weight||"normal"}::${t.style||"normal"}::${t.src||""}`).sort().join("|")}::px=${o||""}`}(t,n,o,i);if(wt.resource?.has(c))return wt.resource.get(c);const l=function(t){const e=new Set;for(const n of t||[]){const t=String(n).split("__")[0]?.trim();t&&e.add(t)}return e}(t),u=[],d=ue;for(const t of document.querySelectorAll("style")){const e=t.textContent||"";for(const t of e.matchAll(d)){const e=(t[2]||t[4]||"").trim();if(!e||ne(e))continue;!!document.querySelector(`link[rel="stylesheet"][href="${e}"]`)||u.push(e)}}u.length&&await Promise.all(u.map(t=>new Promise(e=>{if(document.querySelector(`link[rel="stylesheet"][href="${t}"]`))return e(null);const n=document.createElement("link");n.rel="stylesheet",n.href=t,n.setAttribute("data-snapdom","injected-import"),n.onload=()=>e(n),n.onerror=()=>e(null),document.head.appendChild(n)})));let h="";const m=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(t=>!!t.href);for(const t of m)try{if(ne(t.href))continue;let o="",r=!1;try{r=new URL(t.href,location.href).origin===location.origin}catch{}if(!r&&!ce(t.href,l))continue;if(r){const e=Array.from(document.styleSheets).find(e=>e.href===t.href);if(e)try{const t=e.cssRules||[];o=Array.from(t).map(t=>t.cssText).join("")}catch{}}if(!o){if(o=(await kt(t.href,{as:"text",useProxy:i})).data,ne(t.href))continue}o=await de(o,t.href,i);let c="";for(const r of o.match(me)||[]){const o=re((r.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim());if(!o||ne(o))continue;const l=(r.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),u=(r.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),d=(r.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),h=(r.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),m=(r.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),f=ge(m,t.href);if(!a(o,u,l,d))continue;const p=fe(h);if(!pe(e,p))continue;const g={family:o,weightSpec:l,styleSpec:u,stretchSpec:d,unicodeRange:h,srcRaw:m,srcUrls:f,href:t.href};if(n&&s(g,p))continue;c+=/url\(/i.test(m)?await ye(r,t.href,i):r}c.trim()&&(h+=c)}catch{}const f={requiredIndex:r,usedCodepoints:e,faceMatchesRequired:a,simpleExcluder:n?we(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(const t of document.styleSheets)if(!t.href||!m.some(e=>e.href===t.href))try{const e=t.href||location.href;e&&f.visitedSheets.add(e),await be(t,e,async t=>{h+=t},f)}catch{}try{for(const t of document.fonts||[]){if(!t||!t.family||"loaded"!==t.status||!t._snapdomSrc)continue;const e=String(t.family).replace(/^['"]+|['"]+$/g,"");if(ne(e))continue;if(!r.has(e))continue;if(n?.families&&n.families.some(t=>String(t).toLowerCase()===e.toLowerCase()))continue;let o=t._snapdomSrc;if(!String(o).startsWith("data:"))if(wt.resource?.has(t._snapdomSrc))o=wt.resource.get(t._snapdomSrc),wt.font?.add(t._snapdomSrc);else if(!wt.font?.has(t._snapdomSrc))try{const e=await kt(t._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(!e.ok||"string"!=typeof e.data)continue;o=e.data,wt.resource?.set(t._snapdomSrc,o),wt.font?.add(t._snapdomSrc)}catch{continue}h+=`@font-face{font-family:'${e}';src:url(${o});font-style:${t.style||"normal"};font-weight:${t.weight||"normal"};}`}}catch{}for(const t of o){if(!t||"object"!=typeof t)continue;const e=String(t.family||"").replace(/^['"]+|['"]+$/g,"");if(!e||ne(e))continue;if(!r.has(e))continue;if(n?.families&&n.families.some(t=>String(t).toLowerCase()===e.toLowerCase()))continue;const o=null!=t.weight?String(t.weight):"normal",a=null!=t.style?String(t.style):"normal",s=null!=t.stretchPct?`${t.stretchPct}%`:"100%",c=String(t.src||"");let l=c;if(!l.startsWith("data:"))if(wt.resource?.has(c))l=wt.resource.get(c),wt.font?.add(c);else if(!wt.font?.has(c))try{const t=await kt(c,{as:"dataURL",useProxy:i,silent:!0});if(!t.ok||"string"!=typeof t.data)continue;l=t.data,wt.resource?.set(c,l),wt.font?.add(c)}catch{continue}h+=`@font-face{font-family:'${e}';src:url(${l});font-style:${a};font-weight:${o};font-stretch:${s};}`}return h&&(h=function(t){if(!t)return t;const e=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,o=[];for(const i of t.match(e)||[]){const t=re(i.match(/font-family:\s*([^;]+);/i)?.[1]||""),e=(i.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),r=(i.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),a=(i.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),s=(i.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),c=(i.match(/src\s*:\s*([^;]+);/i)?.[1]||"").trim(),l=ge(c,location.href),u=l.length?l.map(t=>String(t).toLowerCase()).sort().join("|"):c.toLowerCase(),d=[String(t||"").toLowerCase(),e,r,a,s.toLowerCase(),u].join("|");n.has(d)||(n.add(d),o.push(i))}if(0===o.length)return t;let i=0;return t.replace(e,()=>o[i++]||"")}(h),wt.resource?.set(c,h)),h}function xe(t){const e=new Set;if(!t)return e;const n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,null),o=t=>{const n=re(t.fontFamily);if(!n)return;var o,i,r;e.add((o=t.fontWeight,i=t.fontStyle,r=t.fontStretch,`${n}__${ae(o)}__${se(i)}__${function(t){const e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}(r)}`))};o(getComputedStyle(t));const i=getComputedStyle(t,"::before");i&&i.content&&"none"!==i.content&&o(i);const r=getComputedStyle(t,"::after");for(r&&r.content&&"none"!==r.content&&o(r);n.nextNode();){const t=n.currentNode;o(getComputedStyle(t));const e=getComputedStyle(t,"::before");e&&e.content&&"none"!==e.content&&o(e);const i=getComputedStyle(t,"::after");i&&i.content&&"none"!==i.content&&o(i)}return e}function Se(t,e=!1){let n="",o=Math.max(1,t);for(;o>0;)o--,n=String.fromCharCode(97+o%26)+n,o=Math.floor(o/26);return e?n.toUpperCase():n}function Ce(t,e=!0){const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let o=Math.max(1,Math.min(3999,t)),i="";for(const[t,e]of n)for(;o>=t;)i+=e,o-=t;return e?i:i.toLowerCase()}function Ee(t,e){switch((e||"decimal").toLowerCase()){case"decimal":default:return String(Math.max(0,t));case"decimal-leading-zero":return(t<10?"0":"")+String(Math.max(0,t));case"lower-alpha":return Se(t,!1);case"upper-alpha":return Se(t,!0);case"lower-roman":return Ce(t,!1);case"upper-roman":return Ce(t,!0)}}function Me(t){const e=new WeakMap,n=t instanceof Document?t.documentElement:t,o=t=>{let e=0,n=t?.parentElement;if(!n)return 0;for(const o of n.children){if(o===t)break;"LI"===o.tagName&&e++}return e},i=(t,e,n)=>{const i=(t=>{const e=new Map;for(const[n,o]of t)e.set(n,o.slice());return e})(t);let r,a;try{r=n.style?.counterReset||getComputedStyle(n).counterReset}catch{}if(r&&"none"!==r)for(const t of r.split(",")){const n=t.trim().split(/\s+/),o=n[0],r=Number.isFinite(Number(n[1]))?Number(n[1]):0;if(!o)continue;const a=e.get(o);if(a&&a.length){const t=a.slice();t.push(r),i.set(o,t)}else i.set(o,[r])}try{a=n.style?.counterIncrement||getComputedStyle(n).counterIncrement}catch{}if(a&&"none"!==a)for(const t of a.split(",")){const e=t.trim().split(/\s+/),n=e[0],o=Number.isFinite(Number(e[1]))?Number(e[1]):1;if(!n)continue;const r=i.get(n)||[];0===r.length&&r.push(0),r[r.length-1]+=o,i.set(n,r)}try{if("list-item"===getComputedStyle(n).display&&(t=>t&&"LI"===t.tagName)(n)){const t=n.parentElement;let e=1;if(t&&"OL"===t.tagName){const i=t.getAttribute("start"),r=Number.isFinite(Number(i))?Number(i):1,a=o(n),s=n.getAttribute("value");e=Number.isFinite(Number(s))?Number(s):r+a}else e=1+o(n);const r=i.get("list-item")||[];0===r.length&&r.push(0),r[r.length-1]=e,i.set("list-item",r)}}catch{}return i},r=(t,n,o)=>{const a=i(o,n,t);e.set(t,a);let s=a;for(const e of t.children){s=r(e,a,s)}return a},a=new Map;return r(n,a,a),{get(t,n){const o=e.get(t)?.get(n);return o&&o.length?o[o.length-1]:0},getStack(t,n){const o=e.get(t)?.get(n);return o?o.slice():[]}}}var ke=null,Ae=new WeakMap;function Le(t,e){const n=t.parentElement,o=n?Ae.get(n):null;return o?{get(t,n){const i=e.get(t,n),r=o.get(n);return"number"==typeof r?Math.max(i,r):i},getStack(t,n){const i=e.getStack(t,n);if(!i.length)return i;const r=o.get(n);if("number"==typeof r){const t=i.slice();return t[t.length-1]=Math.max(t[t.length-1],r),t}return i}}:e}function Ie(t,e,n){const o=new Map;function i(t){const e=[];if(!t||"none"===t)return e;for(const n of String(t).split(",")){const t=n.trim().split(/\s+/),o=t[0],i=Number.isFinite(Number(t[1]))?Number(t[1]):void 0;o&&e.push({name:o,num:i})}return e}const r=i(e?.counterReset),a=i(e?.counterIncrement);function s(e){if(o.has(e))return o.get(e).slice();let i=n.getStack(t,e);i=i.length?i.slice():[];const s=r.find(t=>t.name===e);if(s){const t=Number.isFinite(s.num)?s.num:0;i=i.length?[...i,t]:[t]}const c=a.find(t=>t.name===e);if(c){const t=Number.isFinite(c.num)?c.num:1;0===i.length&&(i=[0]),i[i.length-1]+=t}return o.set(e,i.slice()),i}return{get(t,e){const n=s(e);return n.length?n[n.length-1]:0},getStack:(t,e)=>s(e),__incs:a}}function Re(t,e,n){let o;try{o=getComputedStyle(t,e)}catch{}const i=o?.content;if(!i||"none"===i||"normal"===i)return{text:"",incs:[]};const r=Ie(t,o,Le(t,n));let a=/\bcounter\s*\(|\bcounters\s*\(/.test(i||"")?function(t,e,n){if(!t||"none"===t)return t;try{const o=/\b(counter|counters)\s*\(([^)]+)\)/g;return(t.replace(o,(t,o,i)=>{const r=String(i).split(",").map(t=>t.trim());if("counter"===o){const t=r[0]?.replace(/^["']|["']$/g,""),o=(r[1]||"decimal").toLowerCase();return Ee(n.get(e,t),o)}{const t=r[0]?.replace(/^["']|["']$/g,""),o=r[1]?.replace(/^["']|["']$/g,"")??"",i=(r[2]||"decimal").toLowerCase(),a=n.getStack(e,t);return a.length?a.map(t=>Ee(t,i)).join(o):""}})||"").replace(/"([^"]*)"/g,"$1")}catch{return"- "}}(i,t,r):i;const s=function(t){if(!t)return"";const e=[],n=/"([^"]*)"/g;let o;for(;o=n.exec(t);)e.push(o[1]);return e.length?e.join(""):(t||"").replace(/"([^"]*)"/g,"$1")}(a);return{text:s,incs:r.__incs||[]}}async function Te(t,e,n,o){if(!(t instanceof Element&&e instanceof Element))return;if(!ke)try{ke=Me(t.ownerDocument||document)}catch{}for(const i of["::before","::after","::first-letter"])try{const r=Dt(t,i);if(!r||"function"!=typeof r[Symbol.iterator])continue;if(!("none"!==r.content||"none"!==r.backgroundImage||"transparent"!==r.backgroundColor||"none"!==r.borderStyle&&0!==parseFloat(r.borderWidth)||r.transform&&"none"!==r.transform||"inline"!==r.display))continue;if("::first-letter"===i){const o=getComputedStyle(t);if(!(r.color!==o.color||r.fontSize!==o.fontSize||r.fontWeight!==o.fontWeight))continue;const i=Array.from(e.childNodes).find(t=>t.nodeType===Node.TEXT_NODE&&t.textContent?.trim().length>0);if(!i)continue;const a=i.textContent,s=a.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u),c=s?.[0],l=a.slice(c?.length||0);if(!c||/[\uD800-\uDFFF]/.test(c))continue;const u=document.createElement("span");u.textContent=c,u.dataset.snapdomPseudo="::first-letter";const d=Wt(Ht(r),"span");n.styleMap.set(u,d);const h=document.createTextNode(l);e.replaceChild(h,i),e.insertBefore(u,h);continue}const a=r.content,{text:s,incs:c}=Re(t,i,ke),l=r.backgroundImage,u=r.backgroundColor,d=r.fontFamily,h=parseInt(r.fontSize)||32,m=parseInt(r.fontWeight)||!1,f=r.color||"#000",p=r.borderStyle,g=parseFloat(r.borderWidth),y=r.transform,w=ne(d),b="none"!==a&&""!==s,v=l&&"none"!==l,x=u&&"transparent"!==u&&"rgba(0, 0, 0, 0)"!==u,S=p&&"none"!==p&&g>0,C=y&&"none"!==y;if(!(b||v||x||S||C)){if(c&&c.length&&t.parentElement){const e=Ae.get(t.parentElement)||new Map;for(const{name:n}of c){if(!n)continue;const o=Le(t,ke),r=Ie(t,getComputedStyle(t,i),o).get(t,n);e.set(n,r)}Ae.set(t.parentElement,e)}continue}const E=document.createElement("span");E.dataset.snapdomPseudo=i,E.style.verticalAlign="middle",E.style.pointerEvents="none";const M=Wt(Ht(r),"span");if(n.styleMap.set(E,M),w&&s&&1===s.length){const{dataUrl:t,width:n,height:o}=await oe(s,d,m,h,f),i=document.createElement("img");i.src=t,i.style=`height:${h}px;width:${n/o*h}px;object-fit:contain;`,E.appendChild(i),e.dataset.snapdomHasIcon="true"}else if(s&&s.startsWith("url(")){const t=bt(s);if(t?.trim())try{const e=document.createElement("img"),n=await kt(vt(t),{as:"dataURL",useProxy:o.useProxy});e.src=n.data,e.style=`width:${h}px;height:auto;object-fit:contain;`,E.appendChild(e)}catch(t){}}else!w&&b&&(E.textContent=s);if(E.style.background="none","mask"in E.style&&(E.style.mask="none"),v)try{const t=$t(l),e=await Promise.all(t.map(Lt));E.style.backgroundImage=e.join(", ")}catch(t){}x&&(E.style.backgroundColor=u);const k=E.childNodes.length>0||""!==E.textContent?.trim()||v||x||S||C;if(c&&c.length&&t.parentElement){const e=Ae.get(t.parentElement)||new Map,n=Le(t,ke),o=Ie(t,getComputedStyle(t,i),n);for(const{name:n}of c){if(!n)continue;const i=o.get(t,n);e.set(n,i)}Ae.set(t.parentElement,e)}if(!k)continue;"::before"===i?e.insertBefore(E,e.firstChild):e.appendChild(E)}catch(t){}const i=Array.from(t.children),r=Array.from(e.children).filter(t=>!t.dataset.snapdomPseudo);for(let t=0;t<Math.min(i.length,r.length);t++)await Te(i[t],r[t],n,o)}function Pe(t){if(!t||"auto"===t)return null;const e=Number.parseFloat(t);return Number.isFinite(e)?e:null}function Ne(t,e){const n=[];for(let o=t;o&&o!==e;){const t=o.parentElement;if(!t)break;n.push(Array.prototype.indexOf.call(t.children,o)),o=t}return n.reverse()}function Fe(t,e,n){let o=t;for(let t=0;t<e.length;t++){if(o=We(o,n)[e[t]],!o)return null}return o instanceof HTMLElement?o:null}function We(t,e){const n=[],o=t.children;for(let t=0;t<o.length;t++){const i=o[t];i.hasAttribute(e)||n.push(i)}return n}async function De(t,e={}){const n={styleMap:wt.session.styleMap,styleCache:wt.session.styleCache,nodeMap:wt.session.nodeMap};let o,i="",r="";!function(t){const e=getComputedStyle(t),n=e.outlineStyle,o=e.outlineWidth,i=e.borderStyle,r=e.borderWidth,a="none"!==n&&parseFloat(o)>0,s="none"===i||0===parseFloat(r);a&&s&&(t.style.border=`${o} solid transparent`)}(t);try{!function(t){if(!t)return;const e=new Set;if(t.querySelectorAll("use").forEach(t=>{const n=t.getAttribute("xlink:href")||t.getAttribute("href");n&&n.startsWith("#")&&e.add(n.slice(1))}),!e.size)return;const n=Array.from(document.querySelectorAll("svg > symbol, svg > defs")),o=n.filter(t=>"symbol"===t.tagName.toLowerCase()),i=n.filter(t=>"defs"===t.tagName.toLowerCase());let r=t.querySelector("svg.inline-defs-container");r||(r=document.createElementNS("http://www.w3.org/2000/svg","svg"),r.setAttribute("aria-hidden","true"),r.setAttribute("style","position: absolute; width: 0; height: 0; overflow: hidden;"),r.classList.add("inline-defs-container"),t.insertBefore(r,t.firstChild));const a=new Set;t.querySelectorAll("symbol[id], defs > *[id]").forEach(t=>{a.add(t.id)}),e.forEach(t=>{if(a.has(t))return;const e=o.find(e=>e.id===t);if(e)return r.appendChild(e.cloneNode(!0)),void a.add(t);for(const e of i){const n=e.querySelector(`#${CSS.escape(t)}`);if(n){let e=r.querySelector("defs");e||(e=document.createElementNS("http://www.w3.org/2000/svg","defs"),r.appendChild(e)),e.appendChild(n.cloneNode(!0)),a.add(t);break}}})}(t)}catch(t){}try{o=await Kt(t,n,e)}catch(t){throw t}try{await Te(t,o,n,e)}catch(t){}await async function(t){if(!t)return;const e=t.querySelectorAll?t.querySelectorAll("img"):[];for(const t of e)try{const e=t.getAttribute("src")||t.currentSrc||"";if(Ve(e)){const n=await $e(e);t.setAttribute("src",n)}const n=t.getAttribute("srcset");if(n&&n.includes("blob:")){const e=Oe(n);let o=!1;for(const t of e)if(Ve(t.url))try{t.url=await $e(t.url),o=!0}catch{}o&&t.setAttribute("srcset",je(e))}}catch{}const n=t.querySelectorAll?t.querySelectorAll("image"):[];for(const t of n)try{const e="http://www.w3.org/1999/xlink",n=t.getAttribute("href")||t.getAttributeNS?.(e,"href");if(Ve(n)){const o=await $e(n);t.setAttribute("href",o),t.removeAttributeNS?.(e,"href")}}catch{}const o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(const t of o)try{const e=t.getAttribute("style");if(e&&e.includes("blob:")){const n=await Ue(e);t.setAttribute("style",n)}}catch{}const i=t.querySelectorAll?t.querySelectorAll("style"):[];for(const t of i)try{const e=t.textContent||"";e.includes("blob:")&&(t.textContent=await Ue(e))}catch{}const r=["poster"];for(const e of r){const n=t.querySelectorAll?t.querySelectorAll(`[${e}^='blob:']`):[];for(const t of n)try{const n=t.getAttribute(e);Ve(n)&&t.setAttribute(e,await $e(n))}catch{}}}(o);try{const t=o.querySelectorAll("style[data-sd]");for(const e of t)r+=e.textContent||"",e.remove()}catch{}const a=function(t){const e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map;let o=1;for(const t of e)n.set(t,"c"+o++);return n}(n.styleMap);i=Array.from(a.entries()).map(([t,e])=>`.${e}{${t}}`).join(""),i=r+i;for(const[t,e]of n.styleMap.entries()){if("STYLE"===t.tagName)continue;if(t.getRootNode&&t.getRootNode()instanceof ShadowRoot){t.setAttribute("style",e.replace(/;/g,"; "));continue}const n=a.get(e);n&&t.classList.add(n);const o=t.style?.backgroundImage,i=t.dataset?.snapdomHasIcon;o&&"none"!==o&&(t.style.backgroundImage=o),i&&(t.style.verticalAlign="middle",t.style.display="inline")}for(const[t,e]of n.nodeMap.entries()){const n=e.scrollLeft,o=e.scrollTop;if((n||o)&&t instanceof HTMLElement){t.style.overflow="hidden",t.style.scrollbarWidth="none",t.style.msOverflowStyle="none";const e=document.createElement("div");for(e.style.transform=`translate(${-n}px, ${-o}px)`,e.style.willChange="transform",e.style.display="inline-block",e.style.width="100%";t.firstChild;)e.appendChild(t.firstChild);t.appendChild(e)}}if(function(t,e){if(!t||!e)return;const n=t.scrollTop||0;if(!n)return;"static"===getComputedStyle(e).position&&(e.style.position="relative");const o=t.getBoundingClientRect(),i=t.clientHeight,r="data-snap-ph",a=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){const s=a.currentNode,c=getComputedStyle(s),l=c.position;if("sticky"!==l&&"-webkit-sticky"!==l)continue;const u=Pe(c.top),d=Pe(c.bottom);if(null==u&&null==d)continue;const h=Fe(e,Ne(s,t),r);if(!h)continue;const m=s.getBoundingClientRect(),f=m.width,p=m.height,g=m.left-o.left;if(!(f>0&&p>0))continue;if(!Number.isFinite(g))continue;const y=null!=u?u+n:n+(i-p-d);if(!Number.isFinite(y))continue;const w=Number.parseInt(c.zIndex,10),b=Number.isFinite(w),v=b?Math.max(w,1)+1:2,x=b?w-1:0,S=h.cloneNode(!1);S.setAttribute(r,"1"),S.style.position="sticky",S.style.left=`${g}px`,S.style.top=`${y}px`,S.style.width=`${f}px`,S.style.height=`${p}px`,S.style.visibility="hidden",S.style.zIndex=String(x),S.style.overflow="hidden",S.style.background="transparent",S.style.boxShadow="none",S.style.filter="none",h.parentElement?.insertBefore(S,h),h.style.position="absolute",h.style.left=`${g}px`,h.style.top=`${y}px`,h.style.bottom="auto",h.style.zIndex=String(v),h.style.pointerEvents="none"}}(t,o instanceof HTMLElement&&o.firstElementChild instanceof HTMLElement?o.firstElementChild:o),t===n.nodeMap.get(o)){const e=n.styleCache.get(t)||window.getComputedStyle(t);n.styleCache.set(t,e);const i=function(t){if(!t||"none"===t)return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(t,e)=>{const n=e.split(",").map(t=>t.trim());return 6!==n.length?`matrix(${e})`:(n[4]="0",n[5]="0",`matrix(${n.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(t,e)=>{const n=e.split(",").map(t=>t.trim());return 16!==n.length?`matrix3d(${e})`:(n[12]="0",n[13]="0",`matrix3d(${n.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}(e.transform);o.style.margin="0",o.style.top="auto",o.style.left="auto",o.style.right="auto",o.style.bottom="auto",o.style.animation="none",o.style.transition="none",o.style.willChange="auto",o.style.float="none",o.style.clear="none",o.style.transform=i||""}for(const[t,e]of n.nodeMap.entries())"PRE"===e.tagName&&(t.style.marginTop="0",t.style.marginBlockStart="0");return{clone:o,classCSS:i,styleCache:n.styleCache}}var He=new Map;async function $e(t){if(wt.resource?.has(t))return wt.resource.get(t);if(He.has(t))return He.get(t);const e=(async()=>{const e=await kt(t,{as:"dataURL",silent:!0});if(!e.ok||"string"!=typeof e.data)throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return wt.resource?.set(t,e.data),e.data})();He.set(t,e);try{const n=await e;return He.set(t,n),n}catch(e){throw He.delete(t),e}}var Be=/\bblob:[^)"'\s]+/g;async function Ue(t){if(!t||-1===t.indexOf("blob:"))return t;const e=Array.from(new Set(t.match(Be)||[]));if(0===e.length)return t;let n=t;for(const t of e)try{const e=await $e(t);n=n.split(t).join(e)}catch{}return n}function Ve(t){return"string"==typeof t&&t.startsWith("blob:")}function Oe(t){return(t||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{const e=t.match(/^(\S+)(\s+.+)?$/);return e?{url:e[1],desc:e[2]||""}:null}).filter(Boolean)}function je(t){return t.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}function ze(t){if(!t)return()=>{};const e=function(t){const e=getComputedStyle(t);let n=e.getPropertyValue("-webkit-line-clamp")||e.getPropertyValue("line-clamp");n=(n||"").trim();const o=parseInt(n,10);return Number.isFinite(o)&&o>0?o:0}(t);if(e<=0)return()=>{};if(!function(t){return!(t.childElementCount>0)&&Array.from(t.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}(t))return()=>{};const n=getComputedStyle(t),o=Math.round(function(t){const e=(t.lineHeight||"").trim(),n=parseFloat(t.fontSize)||16;return e&&"normal"!==e?e.endsWith("px")?parseFloat(e):/^\d+(\.\d+)?$/.test(e)?Math.round(parseFloat(e)*n):e.endsWith("%")?Math.round(parseFloat(e)/100*n):Math.round(1.2*n):Math.round(1.2*n)}(n)*e+function(t){return(parseFloat(t.paddingTop)||0)+(parseFloat(t.paddingBottom)||0)}(n)),i=t.textContent??"",r=i;if(t.scrollHeight<=o+.5)return()=>{};let a=0,s=i.length,c=-1;for(;a<=s;){const e=a+s>>1;t.textContent=i.slice(0,e)+"…",t.scrollHeight<=o+.5?(c=e,a=e+1):s=e-1}return t.textContent=(c>=0?i.slice(0,c):"")+"…",()=>{t.textContent=r}}async function Xe(t,e){if(!t)throw new Error("Element cannot be null or undefined");!function(t="soft"){switch(t){case"auto":return wt.session.styleMap=new Map,void(wt.session.nodeMap=new Map);case"soft":default:return wt.session.styleMap=new Map,wt.session.nodeMap=new Map,void(wt.session.styleCache=new WeakMap);case"full":return;case"disabled":wt.session.styleMap=new Map,wt.session.nodeMap=new Map,wt.session.styleCache=new WeakMap,wt.computedStyle=new WeakMap,wt.baseStyle=new Map,wt.defaultStyle=new Map,wt.image=new Map,wt.background=new Map,wt.resource=new Map,wt.font=new Set}}(e.cache);const n=e.fast,o=!!e.straighten,i=!!e.noShadows;let r,a,s,c,l,u="",d="",h=null;const m=ze(t);try{({clone:r,classCSS:a,styleCache:s}=await De(t,e)),o&&r&&(h=function(t,e){if(!t||!e||!e.style)return null;const n=getComputedStyle(t);try{e.style.transformOrigin="0 0"}catch{}try{"translate"in e.style&&(e.style.translate="none"),"rotate"in e.style&&(e.style.rotate="none")}catch{}const o=n.transform||"none";if("none"===o)try{const n=Ge(t);if(1===n.a&&0===n.b&&0===n.c&&1===n.d)return e.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}const i=o.match(/^matrix\(\s*([^)]+)\)$/i);if(i){const t=i[1].split(",").map(t=>parseFloat(t.trim()));if(6===t.length&&t.every(Number.isFinite)){const[n,o,i,r]=t,a=Math.sqrt(n*n+o*o)||0;let s=0,c=0,l=0,u=0,d=0,h=0;a>0&&(s=n/a,c=o/a,l=s*i+c*r,u=i-s*l,d=r-c*l,h=Math.sqrt(u*u+d*d)||0,h>0?l/=h:l=0);const m=a,f=0,p=l*h,g=h;try{e.style.transform=`matrix(${m}, ${f}, ${p}, ${g}, 0, 0)`}catch{}return{a:m,b:f,c:p,d:g}}}try{const t=String(o).trim();return e.style.transform=t+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}(t,r)),i&&r&&function(t,e){if(!t||!e||!e.style)return;const n=getComputedStyle(t);try{e.style.boxShadow="none"}catch{}try{e.style.textShadow="none"}catch{}try{e.style.outline="none"}catch{}const o=(n.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{e.style.filter=o.length?o:"none"}catch{}}(t,r)}finally{m()}await new Promise(t=>{Bt(async()=>{await async function(t,e={}){const n=Array.from(t.querySelectorAll("img")),o=async t=>{if(!t.getAttribute("src")){const e=t.currentSrc||t.src||"";e&&t.setAttribute("src",e)}t.removeAttribute("srcset"),t.removeAttribute("sizes");const n=t.src||"";if(!n)return;const o=await kt(n,{as:"dataURL",useProxy:e.useProxy});if(o.ok&&"string"==typeof o.data&&o.data.startsWith("data:"))return t.src=o.data,t.width||(t.width=t.naturalWidth||100),void(t.height||(t.height=t.naturalHeight||100));const{fallbackURL:i}=e||{};if(i)try{const o=parseInt(t.dataset?.snapdomWidth||"",10)||0,r=parseInt(t.dataset?.snapdomHeight||"",10)||0,a=parseInt(t.getAttribute("width")||"",10)||0,s=parseInt(t.getAttribute("height")||"",10)||0,c=parseFloat(t.style?.width||"")||0,l=parseFloat(t.style?.height||"")||0,u=o||c||a||t.width||void 0,d=r||l||s||t.height||void 0,h="function"==typeof i?await i({width:u,height:d,src:n,element:t}):i;if(h){const n=await kt(h,{as:"dataURL",useProxy:e.useProxy});return t.src=n.data,!t.width&&u&&(t.width=u),!t.height&&d&&(t.height=d),t.width||(t.width=t.naturalWidth||100),void(t.height||(t.height=t.naturalHeight||100))}}catch{}const r=t.width||t.naturalWidth||100,a=t.height||t.naturalHeight||100;if(!1!==e.placeholders){const e=document.createElement("div");e.style.cssText=[`width:${r}px`,`height:${a}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${a}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),e.textContent="img",t.replaceWith(e)}else{const e=document.createElement("div");e.style.cssText=`display:inline-block;width:${r}px;height:${a}px;visibility:hidden;`,t.replaceWith(e)}};for(let t=0;t<n.length;t+=4){const e=n.slice(t,t+4).map(o);await Promise.allSettled(e)}}(r,e),t()},{fast:n})}),await new Promise(o=>{Bt(async()=>{await async function(t,e,n,o={}){const i=[[t,e]],r=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],s=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){const[t,e]=i.shift(),c=n.get(t)||Dt(t);n.has(t)||n.set(t,c);const l=(()=>{const t=c.getPropertyValue("border-image"),e=c.getPropertyValue("border-image-source");return t&&"none"!==t||e&&"none"!==e})();for(const t of r){const n=c.getPropertyValue(t);if(!n||"none"===n)continue;const i=$t(n),r=await Promise.all(i.map(t=>Lt(t,o)));r.some(t=>t&&"none"!==t&&!/^url\(undefined/.test(t))&&e.style.setProperty(t,r.join(", "))}for(const t of a){const n=c.getPropertyValue(t);n&&"initial"!==n&&e.style.setProperty(t,n)}if(l)for(const t of s){const n=c.getPropertyValue(t);n&&"initial"!==n&&e.style.setProperty(t,n)}const u=Array.from(t.children),d=Array.from(e.children);for(let t=0;t<Math.min(u.length,d.length);t++)i.push([u[t],d[t]])}}(t,r,s,e),o()},{fast:n})}),e.embedFonts&&await new Promise(o=>{Bt(async()=>{const n=xe(t),i=function(t){const e=new Set,n=t=>{if(t)for(const n of t)e.add(n.codePointAt(0))},o=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){const t=o.currentNode;if(t.nodeType===Node.TEXT_NODE)n(t.nodeValue||"");else if(t.nodeType===Node.ELEMENT_NODE){const o=t;for(const t of["::before","::after"]){const i=getComputedStyle(o,t),r=i?.getPropertyValue("content");if(r&&"none"!==r)if(/^"/.test(r)||/^'/.test(r))n(r.slice(1,-1));else{const t=r.match(/\\[0-9A-Fa-f]{1,6}/g);if(t)for(const n of t)try{e.add(parseInt(n.slice(1),16))}catch{}}}}}return e}(t);if(Ut()){const t=new Set(Array.from(n).map(t=>String(t).split("__")[0]).filter(Boolean));await async function(t,e=2){try{await document.fonts.ready}catch{}const n=Array.from(t||[]).filter(Boolean);if(0===n.length)return;const o=()=>{const t=document.createElement("div");t.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(const e of n){const n=document.createElement("span");n.textContent="AaBbGg1234ÁÉÍÓÚçñ—∞",n.style.fontFamily=`"${e}"`,n.style.fontWeight="700",n.style.fontStyle="italic",n.style.fontSize="32px",n.style.lineHeight="1",n.style.whiteSpace="nowrap",n.style.margin="0",n.style.padding="0",t.appendChild(n)}document.body.appendChild(t),t.offsetWidth,document.body.removeChild(t)};for(let t=0;t<Math.max(1,e);t++)o(),await new Promise(t=>requestAnimationFrame(()=>requestAnimationFrame(t)))}(t,1)}u=await ve({required:n,usedCodepoints:i,exclude:e.excludeFonts,useProxy:e.useProxy}),o()},{fast:n})});const f=function(t){const e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),"function"==typeof t.querySelectorAll&&t.querySelectorAll("*").forEach(t=>e.add(t.tagName.toLowerCase())),Array.from(e))}(r).sort(),p=f.join(",");wt.baseStyle.has(p)?d=wt.baseStyle.get(p):await new Promise(t=>{Bt(()=>{d=function(t){const e=new Map;for(let n of t){const t=wt.defaultStyle.get(n);if(!t)continue;const o=Object.entries(t).map(([t,e])=>`${t}:${e};`).sort().join("");o&&(e.has(o)||e.set(o,[]),e.get(o).push(n))}let n="";for(let[t,o]of e.entries())n+=`${o.join(",")} { ${t} }\n`;return n}(f),wt.baseStyle.set(p,d),t()},{fast:n})}),await new Promise(s=>{Bt(()=>{const n=getComputedStyle(t);const m=t.getBoundingClientRect(),f=Math.max(1,Math.ceil(t.offsetWidth||parseFloat(n.width)||m.width||1)),p=Math.max(1,Math.ceil(t.offsetHeight||parseFloat(n.height)||m.height||1)),g=(t,e=NaN)=>{const n="string"==typeof t?parseFloat(t):t;return Number.isFinite(n)?n:e},y=g(e.width),w=g(e.height);let b=f,v=p;const x=Number.isFinite(y),S=Number.isFinite(w),C=p>0?f/p:1;x&&S?(b=Math.max(1,Math.ceil(y)),v=Math.max(1,Math.ceil(w))):x?(b=Math.max(1,Math.ceil(y)),v=Math.max(1,Math.ceil(b/(C||1)))):S?(v=Math.max(1,Math.ceil(w)),b=Math.max(1,Math.ceil(v*(C||1)))):(b=f,v=p);let E=0,M=0,k=f,A=p;if(o&&h&&Number.isFinite(h.a)){const t=Ze(f,p,{a:h.a,b:h.b||0,c:h.c||0,d:h.d||1,e:0,f:0},0,0);E=t.minX,M=t.minY,k=t.maxX,A=t.maxY}else{if(!o&&function(t){const e=getComputedStyle(t),n=e.transform||"none";if("none"!==n&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;const o=e.rotate&&"none"!==e.rotate&&"0deg"!==e.rotate,i=e.scale&&"none"!==e.scale&&"1"!==e.scale,r=e.translate&&"none"!==e.translate&&"0px 0px"!==e.translate;return Boolean(o||i||r)}(t)){const e=n.transform&&"none"!==n.transform?n.transform:"",o=function(t){const e={rotate:"0deg",scale:null,translate:null},n="function"==typeof t.computedStyleMap?t.computedStyleMap():null;if(n){const o=t=>{try{return"function"!=typeof n.has||n.has(t)?"function"!=typeof n.get?null:n.get(t):null}catch{return null}},i=o("rotate");if(i)if(i.angle){const t=i.angle;e.rotate="rad"===t.unit?180*t.value/Math.PI+"deg":t.value+t.unit}else i.unit?e.rotate="rad"===i.unit?180*i.value/Math.PI+"deg":i.value+i.unit:e.rotate=String(i);else{const n=getComputedStyle(t);e.rotate=n.rotate&&"none"!==n.rotate?n.rotate:"0deg"}const r=o("scale");if(r){const t="x"in r&&null!=r.x?.value?r.x.value:Array.isArray(r)?r[0]?.value:Number(r)||1,n="y"in r&&null!=r.y?.value?r.y.value:Array.isArray(r)?r[1]?.value:t;e.scale=`${t} ${n}`}else{const n=getComputedStyle(t);e.scale=n.scale&&"none"!==n.scale?n.scale:null}const a=o("translate");if(a){const t="x"in a&&"value"in a.x?a.x.value:Array.isArray(a)?a[0]?.value:0,n="y"in a&&"value"in a.y?a.y.value:Array.isArray(a)?a[1]?.value:0,o="x"in a&&a.x?.unit?a.x.unit:"px",i="y"in a&&a.y?.unit?a.y.unit:"px";e.translate=`${t}${o} ${n}${i}`}else{const n=getComputedStyle(t);e.translate=n.translate&&"none"!==n.translate?n.translate:null}return e}const o=getComputedStyle(t);return e.rotate=o.rotate&&"none"!==o.rotate?o.rotate:"0deg",e.scale=o.scale&&"none"!==o.scale?o.scale:null,e.translate=o.translate&&"none"!==o.translate?o.translate:null,e}(t),i=function(t){const e=function(){if(Ye)return Ye;const t=document.createElement("div");return t.id="snapdom-measure-slot",t.setAttribute("aria-hidden","true"),Object.assign(t.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(t),Ye=t,t}(),n=document.createElement("div");n.style.transformOrigin="0 0",t.baseTransform&&(n.style.transform=t.baseTransform);t.rotate&&(n.style.rotate=t.rotate);t.scale&&(n.style.scale=t.scale);t.translate&&(n.style.translate=t.translate);e.appendChild(n);const o=Ge(n);return e.removeChild(n),o}({baseTransform:e,rotate:o.rotate||"0deg",scale:o.scale,translate:o.translate}),{ox:r,oy:a}=function(t,e,n){const o=(t.transformOrigin||"0 0").trim().split(/\s+/),[i,r]=[o[0]||"0",o[1]||"0"],a=(t,e)=>{const n=t.toLowerCase();return"left"===n||"top"===n?0:"center"===n?e/2:"right"===n||"bottom"===n?e:n.endsWith("px")?parseFloat(n)||0:n.endsWith("%")?(parseFloat(n)||0)*e/100:/^-?\d+(\.\d+)?$/.test(n)&&parseFloat(n)||0};return{ox:a(i,e),oy:a(r,n)}}(n,f,p),s=Ze(f,p,i.is2D?i:new DOMMatrix(i.toString()),r,a);E=s.minX,M=s.minY,k=s.maxX,A=s.maxY}}const L=function(t){const e=t.boxShadow||"";if(!e||"none"===e)return{top:0,right:0,bottom:0,left:0};const n=e.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(t=>t.trim());let o=0,i=0,r=0,a=0;for(const t of n){const e=t.match(/-?\d+(\.\d+)?px/g)?.map(t=>parseFloat(t))||[];if(e.length<2)continue;const[n,s,c=0,l=0]=e,u=Math.abs(n)+c+l,d=Math.abs(s)+c+l;i=Math.max(i,u+Math.max(n,0)),a=Math.max(a,u+Math.max(-n,0)),r=Math.max(r,d+Math.max(s,0)),o=Math.max(o,d+Math.max(-s,0))}return{top:Math.ceil(o),right:Math.ceil(i),bottom:Math.ceil(r),left:Math.ceil(a)}}(n),I=function(t){const e=(t.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=e?Math.ceil(parseFloat(e[1])||0):0;return{top:n,right:n,bottom:n,left:n}}(n),R=function(t){if("none"===(t.outlineStyle||"none"))return{top:0,right:0,bottom:0,left:0};const e=Math.ceil(parseFloat(t.outlineWidth||"0")||0);return{top:e,right:e,bottom:e,left:e}}(n),T=function(t){const e=`${t.filter||""} ${t.webkitFilter||""}`.trim();if(!e||"none"===e)return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};const n=e.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[];let o=0,i=0,r=0,a=0,s=!1;for(const t of n){s=!0;const e=t.match(/-?\d+(?:\.\d+)?px/gi)?.map(t=>parseFloat(t))||[],[n=0,c=0,l=0]=e,u=Math.abs(n)+l,d=Math.abs(c)+l;i=Math.max(i,u+Math.max(n,0)),a=Math.max(a,u+Math.max(-n,0)),r=Math.max(r,d+Math.max(c,0)),o=Math.max(o,d+Math.max(-c,0))}return{bleed:{top:Math.ceil(o),right:Math.ceil(i),bottom:Math.ceil(r),left:Math.ceil(a)},has:s}}(n),P=i?{top:0,right:0,bottom:0,left:0}:{top:L.top+I.top+R.top+T.bleed.top,right:L.right+I.right+R.right+T.bleed.right,bottom:L.bottom+I.bottom+R.bottom+T.bleed.bottom,left:L.left+I.left+R.left+T.bleed.left};E-=P.left,M-=P.top,k+=P.right,A+=P.bottom;const N=Math.max(1,Math.ceil(k-E)),F=Math.max(1,Math.ceil(A-M)),W=Math.max(1,Math.round(N*(x||S?b/f:1))),D=Math.max(1,Math.round(F*(S||x?v/p:1))),H="http://www.w3.org/2000/svg",$=(Ut()?1:0)+(o?1:0),B=document.createElementNS(H,"foreignObject"),U=Math.floor(E),V=Math.floor(M);B.setAttribute("x",String(-(U-$))),B.setAttribute("y",String(-(V-$))),B.setAttribute("width",String(Math.ceil(f+2*$))),B.setAttribute("height",String(Math.ceil(p+2*$))),B.style.overflow="visible";const O=document.createElement("style");O.textContent=d+u+"svg{overflow:visible;} foreignObject{overflow:visible;}"+a,B.appendChild(O);const j=document.createElement("div");j.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),j.style.width=`${f}px`,j.style.height=`${p}px`,j.style.overflow="visible",r.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),j.appendChild(r),B.appendChild(j);const z=(new XMLSerializer).serializeToString(B),X=N+2*$,Z=F+2*$,G=x||S;e.meta={w0:f,h0:p,vbW:X,vbH:Z,targetW:b,targetH:v};const Y=Ut()&&G?X:W+2*$,_=Ut()&&G?Z:D+2*$;l=`<svg xmlns="${H}" width="${Y}" height="${_}" viewBox="0 0 ${X} ${Z}">`+z+"</svg>",c=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(l)}`,s()},{fast:n})});const g=document.getElementById("snapdom-sandbox");return g&&"absolute"===g.style.position&&g.remove(),c}function Ze(t,e,n,o,i){const r=n.a,a=n.b,s=n.c,c=n.d,l=n.e||0,u=n.f||0;function d(t,e){let n=t-o,d=e-i,h=r*n+s*d,m=a*n+c*d;return h+=o+l,m+=i+u,[h,m]}const h=[d(0,0),d(t,0),d(0,e),d(t,e)];let m=1/0,f=1/0,p=-1/0,g=-1/0;for(const[t,e]of h)t<m&&(m=t),e<f&&(f=e),t>p&&(p=t),e>g&&(g=e);return{minX:m,minY:f,maxX:p,maxY:g,width:p-m,height:g-f}}function Ge(t){const e=getComputedStyle(t).transform;if(!e||"none"===e)return new DOMMatrix;try{return new DOMMatrix(e)}catch{return new WebKitCSSMatrix(e)}}var Ye=null;function _e(t){const e=function(t){let e=[],n="",o=0;for(let i=0;i<t.length;i++){const r=t[i];"("===r&&o++,")"===r&&(o=Math.max(0,o-1)),";"===r&&0===o?(e.push(n),n=""):n+=r}return n.trim()&&e.push(n),e.map(t=>t.trim()).filter(Boolean)}(t);let n=null,o=null,i=null;const r=[];for(const t of e){const e=t.indexOf(":");if(e<0)continue;const a=t.slice(0,e).trim().toLowerCase(),s=t.slice(e+1).trim();"box-shadow"===a?i=s:"filter"===a?n=s:"-webkit-filter"===a?o=s:r.push([a,s])}if(i){const t=function(t){const e=[];let n="",o=0;for(let i=0;i<t.length;i++){const r=t[i];"("===r&&o++,")"===r&&(o=Math.max(0,o-1)),","===r&&0===o?(e.push(n.trim()),n=""):n+=r}n.trim()&&e.push(n.trim());const i=[];for(const t of e){if(/\binset\b/i.test(t))continue;const e=t.match(/-?\d+(?:\.\d+)?px/gi)||[],[n="0px",o="0px",r="0px"]=e;let a=t.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/gi,"").trim().replace(/\s{2,}/g," ");const s=!!a&&","!==a;i.push(`drop-shadow(${n} ${o} ${r}${s?` ${a}`:""})`)}return i.join(" ")}(i);t&&(n=n?`${n} ${t}`:t,o=o?`${o} ${t}`:t)}const a=[...r];return n&&a.push(["filter",n]),o&&a.push(["-webkit-filter",o]),a.map(([t,e])=>`${t}:${e}`).join(";")}function qe(t){return t=(t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,e)=>t.replace(e,function(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(t,e,n)=>`${e}{${_e(n)}}`)}(e)))).replace(/style=(['"])([\s\S]*?)\1/gi,(t,e,n)=>`style=${e}${_e(n)}${e}`)}function Je(t){if(!Ut()||("string"!=typeof(e=t)||!/^data:image\/svg\+xml/i.test(e)))return t;var e;try{const e=function(t){const e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}(t),n=qe(e);return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}catch{return t}}async function Qe(t,e){let{width:n,height:o,scale:i=1,dpr:r=1,meta:a={}}=e;t=Je(t);const s=new Image;s.loading="eager",s.decoding="sync",s.crossOrigin="anonymous",s.src=t,await s.decode();const c=s.naturalWidth,l=s.naturalHeight,u=Number.isFinite(a.w0)?a.w0:c,d=Number.isFinite(a.h0)?a.h0:l;let h,m;const f=Number.isFinite(n),p=Number.isFinite(o);if(f&&p)h=Math.max(1,n),m=Math.max(1,o);else if(f){const t=n/Math.max(1,u);h=n,m=Math.round(d*t)}else if(p){const t=o/Math.max(1,d);m=o,h=Math.round(u*t)}else h=c,m=l;h=Math.round(h*i),m=Math.round(m*i);const g=document.createElement("canvas");g.width=Math.ceil(h*r),g.height=Math.ceil(m*r),g.style.width=`${h}px`,g.style.height=`${m}px`;const y=g.getContext("2d");return 1!==r&&y.scale(r,r),y.drawImage(s,0,0,h,m),g}async function Ke(t,e){const n=await Qe(t,e),o=e.backgroundColor?At(n,e.backgroundColor):n,i=new Image;return i.src=o.toDataURL(`image/${e.format}`,e.quality),await i.decode(),i.style.width=o.width/e.dpr+"px",i.style.height=o.height/e.dpr+"px",i}async function tn(t,e){const{scale:n=1,width:o,height:i,meta:r={}}=e,a=Number.isFinite(o),s=Number.isFinite(i),c=Number.isFinite(n)&&1!==n||a||s;if(Ut()&&c){return await Ke(t,{...e,format:"png",quality:1,meta:r})}const l=new Image;if(l.decoding="sync",l.loading="eager",l.src=t,await l.decode(),a&&s)l.style.width=`${o}px`,l.style.height=`${i}px`;else if(a){const t=Number.isFinite(r.w0)?r.w0:l.naturalWidth,e=Number.isFinite(r.h0)?r.h0:l.naturalHeight,n=o/Math.max(1,t);l.style.width=`${o}px`,l.style.height=`${Math.round(e*n)}px`}else if(s){const t=Number.isFinite(r.w0)?r.w0:l.naturalWidth,e=Number.isFinite(r.h0)?r.h0:l.naturalHeight,n=i/Math.max(1,e);l.style.height=`${i}px`,l.style.width=`${Math.round(t*n)}px`}else{const e=Math.round(l.naturalWidth*n),o=Math.round(l.naturalHeight*n);if(l.style.width=`${e}px`,l.style.height=`${o}px`,"string"==typeof t&&t.startsWith("data:image/svg+xml"))try{const n=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${e}"`).replace(/height="[^"]*"/,`height="${o}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,l.src=t}catch{}}return l}async function en(t,e){const n=e.type;if("svg"===n){const e=decodeURIComponent(t.split(",")[1]);return new Blob([e],{type:"image/svg+xml"})}const o=await Qe(t,e),i=e.backgroundColor?At(o,e.backgroundColor):o;return new Promise(t=>i.toBlob(e=>t(e),`image/${n}`,e.quality))}var nn=Symbol("snapdom.internal"),on=!1;async function rn(t,e){if(!t)throw new Error("Element cannot be null or undefined");const n=function(t={}){const e=t.format??"png",n=function(t){if("string"==typeof t){const e=t.toLowerCase().trim();if("disabled"===e||"full"===e||"auto"===e||"soft"===e)return e}return"soft"}(t.cache);return{debug:t.debug??!1,fast:t.fast??!0,scale:t.scale??1,exclude:t.exclude??[],excludeMode:t.excludeMode??"hide",filter:t.filter??null,filterMode:t.filterMode??"hide",placeholders:!1!==t.placeholders,embedFonts:t.embedFonts??!1,iconFonts:Array.isArray(t.iconFonts)?t.iconFonts:t.iconFonts?[t.iconFonts]:[],localFonts:Array.isArray(t.localFonts)?t.localFonts:[],excludeFonts:t.excludeFonts??void 0,fallbackURL:t.fallbackURL??void 0,cache:n,useProxy:"string"==typeof t.useProxy?t.useProxy:"",width:t.width??null,height:t.height??null,format:e,type:t.type??"svg",quality:t.quality??.92,dpr:t.dpr??(window.devicePixelRatio||1),backgroundColor:t.backgroundColor??(["jpg","jpeg","webp"].includes(e)?"#ffffff":null),filename:t.filename??"snapDOM",straighten:t.straighten??!1,noShadows:t.noShadows??!1}}(e);if(Ut()&&(!0===n.embedFonts||function(t){const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(;e.nextNode();){const t=e.currentNode,n=getComputedStyle(t),o=n.backgroundImage&&"none"!==n.backgroundImage,i=n.maskImage&&"none"!==n.maskImage||n.webkitMaskImage&&"none"!==n.webkitMaskImage;if(o||i)return!0}return!1}(t)))for(let n=0;n<3;n++)try{await an(t,e),on=!1}catch{}return n.iconFonts&&n.iconFonts.length>0&&function(t){const e=Array.isArray(t)?t:[t];for(const t of e)t instanceof RegExp?ee.push(t):"string"==typeof t&&ee.push(new RegExp(t,"i"))}(n.iconFonts),n.snap||(n.snap={toPng:(t,e)=>rn.toPng(t,e),toSvg:(t,e)=>rn.toSvg(t,e)}),rn.capture(t,n,nn)}async function an(t,e){if(on)return;const n={...e,fast:!0,embedFonts:!0,scale:.2};let o;try{o=await Xe(t,n)}catch{return}await new Promise(t=>{const e=new Image;e.decoding="sync",e.loading="eager",e.style.position="fixed",e.style.left=0,e.style.top=0,e.style.width="10px",e.style.height="10px",e.style.opacity="0.01",e.style.transform="translateZ(10px)",e.style.willChange="transform,opacity;",e.src=o;document.body.appendChild(e),(async()=>{await new Promise(t=>setTimeout(t,100)),e&&e.parentNode&&e.parentNode.removeChild(e),on=!0,t()})()})}rn.capture=async(t,e,n)=>{if(n!==nn)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");const o=await Xe(t,e),i=t=>({...e,...t||{}}),r=t=>e=>{const n=i({...e||{},format:t}),r="jpeg"===t||"jpg"===t,a=null==n.backgroundColor||"transparent"===n.backgroundColor;return r&&a&&(n.backgroundColor="#ffffff"),Ke(o,n)};return{url:o,toRaw:()=>o,toImg:t=>tn(o,i(t)),toSvg:t=>tn(o,i(t)),toCanvas:t=>Qe(o,i(t)),toBlob:t=>en(o,i(t)),toPng:r("png"),toJpg:r("jpeg"),toWebp:r("webp"),download:t=>async function(t,e){if(e.dpr=1,"svg"===e.format){const n=await en(t,{...e,type:"svg"}),o=URL.createObjectURL(n),i=document.createElement("a");return i.href=o,i.download=e.filename,i.click(),void URL.revokeObjectURL(o)}const n=await Qe(t,e),o=e.backgroundColor?At(n,e.backgroundColor):n,i=document.createElement("a");i.href=o.toDataURL(`image/${e.format}`,e.quality),i.download=e.filename,i.click()}(o,i(t))}},rn.toRaw=(t,e)=>rn(t,e).then(t=>t.toRaw()),rn.toImg=(t,e)=>rn(t,e).then(t=>t.toImg()),rn.toSvg=(t,e)=>rn(t,e).then(t=>t.toSvg()),rn.toCanvas=(t,e)=>rn(t,e).then(t=>t.toCanvas()),rn.toBlob=(t,e)=>rn(t,e).then(t=>t.toBlob()),rn.toPng=(t,e)=>rn(t,{...e,format:"png"}).then(t=>t.toPng()),rn.toJpg=(t,e)=>rn(t,{...e,format:"jpeg"}).then(t=>t.toJpg()),rn.toWebp=(t,e)=>rn(t,{...e,format:"webp"}).then(t=>t.toWebp()),rn.download=(t,e)=>rn(t,e).then(t=>t.download());class sn{constructor(t,e={}){this.targetElement=null,this.isRunning=!1,this.screenshotCount=0,this.screenshotHistory=[],this.lastScreenshotTime=0,this.error=null,this.isEnabled=!1,this.isUploading=!1,this.uploadError=null,this.uploadProgress={success:0,failed:0},this.currentUploadConfig=null,this.worker=null,this.screenshotTimer=null,this.screenshotContext=null,this.messageHandler=null,this.dynamicInterval=null,this.expirationTimer=null,this.imageProxyCache=new Map,this.indexedDBCache=null,this.indexedDBReady=!1,this.intersectionObserver=null,this.visibleElementsCache=new Set,this.preconnected=!1,this.imageDownloadQueue=new Map,this.activeDownloads=new Set,this.maxConcurrentImageDownloads=5,this.globalErrorHandler=null,this.globalRejectionHandler=null,this.targetElement=t,this.options={interval:e.interval??5e3,quality:e.quality??.3,scale:e.scale??1,maxHistory:e.maxHistory??10,compress:e.compress??!1,maxWidth:e.maxWidth??1600,maxHeight:e.maxHeight??900,outputFormat:e.outputFormat??"webp",enableCORS:e.enableCORS??!0,proxyUrl:e.proxyUrl??"",useProxy:e.useProxy??!0,engine:e.engine??"modern-screenshot",corsMode:e.corsMode??"canvas-proxy",silentMode:e.silentMode??!1,maxRetries:e.maxRetries??2,preloadImages:e.preloadImages??!1,maxConcurrentDownloads:e.maxConcurrentDownloads??10,onlyVisibleImages:e.onlyVisibleImages??!0,imageCacheTTL:e.imageCacheTTL??6e5,useIndexedDB:e.useIndexedDB??!0,usePreconnect:e.usePreconnect??!0,imageLoadTimeout:e.imageLoadTimeout??5e3,useIntersectionObserver:e.useIntersectionObserver??!0,fetchPriority:e.fetchPriority??"high",maxCacheSize:e.maxCacheSize??50,maxCacheAge:e.maxCacheAge??864e5,maxImageSize:e.maxImageSize??5,skipLargeImages:e.skipLargeImages??!0},this.setupMessageListener(),this.setupVisibilityChangeListener(),this.startCacheCleanup(),this.options.usePreconnect&&this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()&&this.preconnectProxy(),this.options.useIntersectionObserver&&this.options.onlyVisibleImages&&this.initIntersectionObserver(),this.options.useIndexedDB&&this.initIndexedDB().catch(()=>{this.options.silentMode})}setTargetElement(t){if(this.targetElement!==t&&this.screenshotContext){try{et(this.screenshotContext)}catch(t){}this.screenshotContext=null}this.targetElement=t}setupMessageListener(){this.messageHandler||(this.messageHandler=t=>{this.handleIframeMessage(t)},window.addEventListener("message",this.messageHandler))}setupVisibilityChangeListener(){document.addEventListener("visibilitychange",()=>{document.hidden,this.options.silentMode})}handleIframeMessage(t){try{if(!t.data||"checkScreenshot"!==t.data.type)return;this.options.silentMode;const e=this.parseUploadConfig(t.data.data);if(!e)return void(this.uploadError="解析上传配置失败");this.currentUploadConfig=e;const n=Date.now();if(!(e.ttl>0&&e.ttl>n))return this.options.silentMode||e.ttl,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,void(this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null));{this.isEnabled||(this.options.silentMode,this.isEnabled=!0),this.dynamicInterval=e.duration||this.options.interval;const t=e.ttl-n;if(!this.options.silentMode){Math.ceil(t/6e4)}this.takeScreenshotAndUpload(e),this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.expirationTimer=setTimeout(()=>{this.options.silentMode,this.stopScreenshot(),this.isEnabled=!1,this.currentUploadConfig=null,this.expirationTimer=null},t)}}catch(t){this.uploadError=t instanceof Error?t.message:String(t)}}async takeScreenshotAndUpload(t){this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.startScreenshot(this.dynamicInterval||t.duration||this.options.interval);try{if(await this.takeScreenshot()){await new Promise(t=>setTimeout(t,100));const e=this.getLatestScreenshot();e?(this.isUploading=!0,this.uploadError=null,this.uploadScreenshot(e,t).then(t=>{t&&this.options.silentMode}).catch(t=>{this.uploadError=t instanceof Error?t.message:String(t)}).finally(()=>{this.isUploading=!1})):this.options.silentMode}}catch(t){this.uploadError=t instanceof Error?t.message:String(t)}}parseUploadConfig(t){try{const e="string"==typeof t?t:JSON.stringify(t),n=JSON.parse(e);return n.uploadUrl&&n.contentType?(("number"!=typeof n.duration||n.duration<=0)&&(n.duration=this.options.interval),"number"!=typeof n.ttl&&("number"==typeof n.expirationMinutes&&n.expirationMinutes>0?n.ttl=Date.now()+60*n.expirationMinutes*1e3:n.ttl=0),n):null}catch(t){return null}}startScreenshot(t){if(!this.isEnabled)return;const e=t||this.dynamicInterval||this.options.interval;this.isRunning&&(this.options.silentMode,this.stopScreenshot()),this.options.silentMode,this.isRunning=!0,!this.worker&&this.options.compress&&(this.worker=this.createWorker()),this.screenshotTimer=setInterval(async()=>{if(this.isRunning&&this.isEnabled&&!document.hidden&&(await this.takeScreenshot(),this.currentUploadConfig)){const t=this.getLatestScreenshot();t&&!this.isUploading&&this.uploadScreenshot(t,this.currentUploadConfig).catch(t=>{})}},e)}stopScreenshot(){this.isRunning&&(this.options.silentMode,this.isRunning=!1,this.screenshotTimer&&(clearInterval(this.screenshotTimer),this.screenshotTimer=null))}async captureOnce(t=!1){return!(!this.isEnabled&&!t)&&await this.takeScreenshot()}async takeScreenshot(){if(!this.targetElement)return!1;this.setupGlobalErrorHandlers();try{this.options.silentMode,await Promise.all([this.waitForStylesAndFonts(),this.waitForFonts()]),await new Promise(t=>requestAnimationFrame(()=>{requestAnimationFrame(()=>t())}));const t=this.options.engine||"modern-screenshot";let e;this.options.silentMode,this.options.preloadImages&&this.options.enableCORS&&"modern-screenshot"===t?(this.cleanExpiredCache(),this.options.useIndexedDB&&await this.cleanIndexedDBCache(),await this.preprocessNetworkImages(this.targetElement),await this.waitForImagesToLoad(this.targetElement)):(this.cleanExpiredCache(),this.options.useIndexedDB&&await this.cleanIndexedDBCache()),await new Promise(t=>setTimeout(t,50)),e="snapdom"===t?await this.takeScreenshotWithSnapdom(this.targetElement):"html2canvas"===t?await this.takeScreenshotWithHtml2Canvas(this.targetElement):await this.takeScreenshotWithModernScreenshot(this.targetElement);const n=Date.now();this.screenshotCount++,this.lastScreenshotTime=n,this.screenshotHistory.length>=this.options.maxHistory&&this.screenshotHistory.shift(),this.screenshotHistory.push(e);e.split(",")[1];this.options.silentMode;const o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),i=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4;return this.options.compress&&!o&&!i&&this.worker&&(this.options.silentMode,this.worker.postMessage({type:"COMPRESS_IMAGE",data:{dataUrl:e,maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight,quality:this.options.quality,outputFormat:this.options.outputFormat,timestamp:n,count:this.screenshotCount}})),this.error=null,!0}catch(t){const e=t instanceof Error?t.message:String(t);return e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin")||e.includes("XMLHttpRequest")||e.includes("Status:0")?this.options.silentMode:this.error=e,!1}finally{this.removeGlobalErrorHandlers()}}async takeScreenshotWithSnapdom(t){this.options.silentMode;try{const e=t.getBoundingClientRect();if(0===e.width||0===e.height)throw new Error("元素尺寸为 0,无法截图");const n={};if(this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){let t=this.options.proxyUrl.trim();t.includes("?url=")||(t=t.endsWith("?")?t+"url=":t+"?url="),n.useProxy=t,this.options.silentMode}else this.options.silentMode||this.options.useProxy&&(!this.options.proxyUrl||this.options.proxyUrl.trim());let o;switch(this.options.outputFormat||"png"){case"jpeg":o=await rn.toJpg(t,n);break;case"webp":o=await rn.toWebp(t,n);break;default:o=await rn.toPng(t,n)}const i=o.src;if(!i||i.length<100)throw new Error("生成的 base64 数据无效或过短");return this.options.silentMode,i}catch(t){const e=t instanceof Error?t.message:String(t);throw("EncodingError"===(t instanceof Error?t.name:"Unknown")||e.includes("cannot be decoded")||e.includes("CORS")||e.includes("cross-origin"))&&this.options.silentMode,t}}async takeScreenshotWithHtml2Canvas(t){this.options.silentMode;try{const n=t.getBoundingClientRect();if(0===n.width||0===n.height)throw new Error("元素尺寸为 0,无法截图");const o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),i=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4;let r=t.scrollWidth||t.clientWidth||t.offsetWidth,a=t.scrollHeight||t.clientHeight||t.offsetHeight;t!==document.body&&t!==document.documentElement||(r=Math.max(t.scrollWidth,t.offsetWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,window.innerWidth),a=Math.max(t.scrollHeight,t.offsetHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,window.innerHeight));const{width:s,height:c}=this.calculateCompressedSize(r,a,this.options.maxWidth,this.options.maxHeight),l=s<r?s:Math.min(r,this.options.maxWidth),u=c<a?c:Math.min(a,this.options.maxHeight),d=o||i?Math.max(.65*this.options.quality,.2):this.options.quality,h={backgroundColor:"#ffffff",scale:1!==this.options.scale?o?.7:this.options.scale:o?.7:1,useCORS:this.options.enableCORS,allowTaint:!this.options.enableCORS,logging:!this.options.silentMode,width:l,height:u,removeContainer:!0,imageTimeout:this.options.imageLoadTimeout||5e3,ignoreElements:t=>{const e=window.getComputedStyle(t);return"none"===e.display||"hidden"===e.visibility||"0"===e.opacity}};this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()&&(h.onclone=t=>{t.querySelectorAll("img").forEach(t=>{const e=t.getAttribute("src");if(!e)return;try{if(new URL(e,window.location.href).origin===window.location.origin)return}catch{}const n=this.getCachedImage(e);n&&(t.src=n)})}),this.options.silentMode;const m=await e(t,h);let f,p="image/png";if("webp"!==this.options.outputFormat||o)"jpeg"===this.options.outputFormat&&(p="image/jpeg",f=d);else try{const t=document.createElement("canvas");t.width=1,t.height=1;-1!==t.toDataURL("image/webp").indexOf("webp")&&(p="image/webp",f=d)}catch{p="image/jpeg",f=d}const g="image/png"===p?m.toDataURL(p):m.toDataURL(p,f);if(!g||g.length<100)throw new Error("生成的截图数据无效或过短");return this.options.silentMode,g}catch(t){const e=t instanceof Error?t.message:String(t);throw this.options.silentMode||e.includes("CORS")||e.includes("cross-origin"),t}}async takeScreenshotWithModernScreenshot(t){let e,n;this.options.silentMode,t===document.body||t===document.documentElement?(e=Math.max(t.scrollWidth,t.offsetWidth,document.documentElement.scrollWidth,document.documentElement.offsetWidth,window.innerWidth),n=Math.max(t.scrollHeight,t.offsetHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight,window.innerHeight)):(e=t.scrollWidth||t.clientWidth||t.offsetWidth,n=t.scrollHeight||t.clientHeight||t.offsetHeight),this.options.silentMode||t===document.body||document.documentElement;const o=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),i=navigator.hardwareConcurrency&&navigator.hardwareConcurrency<=4,r=o||i?Math.max(.65*this.options.quality,.2):this.options.quality,{width:a,height:s}=this.calculateCompressedSize(e,n,this.options.maxWidth,this.options.maxHeight),c=a<e?a:Math.min(e,this.options.maxWidth),l=s<n?s:Math.min(n,this.options.maxHeight),u=t.getBoundingClientRect();if(0===u.width||0===u.height)throw new Error("元素尺寸为 0,无法截图");if(this.screenshotContext){try{et(this.screenshotContext)}catch(t){}this.screenshotContext=null}const d={workerNumber:o||i?1:2,quality:r,fetchFn:async t=>{if(t.startsWith("data:")||t.startsWith("blob:"))return t;try{if(new URL(t,window.location.href).origin===window.location.origin)return t}catch(t){}if(this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){const e=this.getCachedImage(t);if(e)return this.options.silentMode,e;if(this.options.useIndexedDB){const e=await this.getIndexedDBCache(t);if(e)return this.setCachedImage(t,e),this.options.silentMode,e}try{const e=new URLSearchParams({url:t,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const o=`${n}?${e.toString()}`,i=new AbortController,r=setTimeout(()=>i.abort(),this.options.imageLoadTimeout);try{const e={method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"},cache:"no-cache",signal:i.signal};"priority"in e&&(e.priority=this.options.fetchPriority);const n=await fetch(o,e);if(clearTimeout(r),!n.ok)throw new Error(`代理请求失败: ${n.status}`);const a=await n.blob(),s=await this.blobToDataUrl(a);return this.setCachedImage(t,s),this.options.useIndexedDB&&await this.setIndexedDBCache(t,s),s}catch(t){throw clearTimeout(r),t}}catch(e){return this.options.silentMode,t}}if(this.options.enableCORS){const e=this.getCachedImage(t);if(e)return this.options.silentMode,e;if(this.options.useIndexedDB){const e=await this.getIndexedDBCache(t);if(e)return this.setCachedImage(t,e),this.options.silentMode,e}if(this.imageDownloadQueue.has(t))return this.options.silentMode,await this.imageDownloadQueue.get(t);if(this.activeDownloads.size>=this.maxConcurrentImageDownloads)return this.options.silentMode,t;const n=this.downloadImageWithoutProxy(t);this.imageDownloadQueue.set(t,n),this.activeDownloads.add(t);try{return await n}finally{this.imageDownloadQueue.delete(t),this.activeDownloads.delete(t)}}return t},fetch:{requestInit:{cache:"no-cache"},bypassingCache:!0},maximumCanvasSize:16777216};c&&l?(d.width=c,d.height=l,this.options.silentMode||t===document.body||document.documentElement):this.options.silentMode,1!==this.options.scale?d.scale=o?.7:this.options.scale:o&&(d.scale=.7),this.options.silentMode,this.screenshotContext=await B(t,d);try{const t=await yt(this.screenshotContext);if(!t||t.length<100)throw new Error("生成的截图数据无效或过短");if("png"!==this.options.outputFormat){const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("无法获取 canvas context");const i=new Image;await new Promise((o,r)=>{i.onload=()=>{e.width=i.width,e.height=i.height,n.drawImage(i,0,0),o()},i.onerror=r,i.src=t});let a="image/jpeg",s=r;if("webp"===this.options.outputFormat&&!o)try{const t=document.createElement("canvas");t.width=1,t.height=1;-1!==t.toDataURL("image/webp").indexOf("webp")&&(a="image/webp")}catch{a="image/jpeg"}return"image/png"===a?e.toDataURL(a):e.toDataURL(a,s)}return t}catch(t){t instanceof Error?t.message:String(t);throw this.options.silentMode,t}finally{if(this.screenshotContext){try{et(this.screenshotContext)}catch(t){}this.screenshotContext=null}}}preconnectProxy(){if(!this.preconnected&&this.options.proxyUrl)try{const t=new URL(this.options.proxyUrl).origin,e=document.createElement("link");e.rel="preconnect",e.href=t,e.crossOrigin="anonymous",document.head.appendChild(e),this.preconnected=!0,this.options.silentMode}catch(t){}}initIntersectionObserver(){"IntersectionObserver"in window&&(this.intersectionObserver=new IntersectionObserver(t=>{t.forEach(t=>{t.isIntersecting?this.visibleElementsCache.add(t.target):this.visibleElementsCache.delete(t.target)})},{root:null,rootMargin:"50px",threshold:.01}))}async initIndexedDB(){return new Promise((t,e)=>{const n=indexedDB.open("screenshot-cache",1);n.onerror=()=>e(n.error),n.onsuccess=()=>{this.indexedDBCache=n.result,this.indexedDBReady=!0,this.cleanIndexedDBCache().catch(()=>{}),t()},n.onupgradeneeded=t=>{const e=t.target.result;if(!e.objectStoreNames.contains("images")){e.createObjectStore("images",{keyPath:"url"}).createIndex("timestamp","timestamp",{unique:!1})}}})}async getIndexedDBCache(t){if(!this.indexedDBReady||!this.indexedDBCache)return null;try{const e=this.indexedDBCache.transaction(["images"],"readonly"),n=e.objectStore("images").get(t);return new Promise(e=>{n.onsuccess=()=>{const o=n.result;if(o){if(Date.now()-o.timestamp>this.options.maxCacheAge)return this.deleteIndexedDBCache(t),void e(null);e(o.dataUrl)}else e(null)},n.onerror=()=>e(null)})}catch{return null}}async setIndexedDBCache(t,e){if(this.indexedDBReady&&this.indexedDBCache)try{const n=await this.getIndexedDBCacheSize(),o=this.estimateDataUrlSize(e),i=1024*(this.options.maxCacheSize||50)*1024;n+o>i&&await this.cleanIndexedDBCacheBySize(i-o);const r=this.indexedDBCache.transaction(["images"],"readwrite");r.objectStore("images").put({url:t,dataUrl:e,timestamp:Date.now()})}catch{}}estimateDataUrlSize(t){const e=t.split(",")[1]||"";return Math.ceil(.75*e.length)+30}async getIndexedDBCacheSize(){if(!this.indexedDBReady||!this.indexedDBCache)return 0;try{const t=this.indexedDBCache.transaction(["images"],"readonly"),e=t.objectStore("images").getAll();return new Promise(t=>{e.onsuccess=()=>{const n=e.result||[];let o=0;n.forEach(t=>{o+=this.estimateDataUrlSize(t.dataUrl)}),t(o)},e.onerror=()=>t(0)})}catch{return 0}}async cleanIndexedDBCache(){if(this.indexedDBReady&&this.indexedDBCache)try{const t=this.indexedDBCache.transaction(["images"],"readwrite").objectStore("images"),e=t.index("timestamp").getAll();return new Promise(n=>{e.onsuccess=()=>{const o=e.result||[],i=Date.now(),r=[];let a=0;const s=1024*(this.options.maxCacheSize||50)*1024;o.sort((t,e)=>t.timestamp-e.timestamp),o.forEach(t=>{i-t.timestamp>this.options.maxCacheAge?r.push(t.url):a+=this.estimateDataUrlSize(t.dataUrl)});const c=[...r];if(a>s)for(const t of o)if(!r.includes(t.url)&&(a-=this.estimateDataUrlSize(t.dataUrl),c.push(t.url),a<=s))break;c.forEach(e=>{t.delete(e)}),c.length>0&&this.options.silentMode,n()},e.onerror=()=>n()})}catch{}}async cleanIndexedDBCacheBySize(t){if(this.indexedDBReady&&this.indexedDBCache)try{const e=this.indexedDBCache.transaction(["images"],"readwrite").objectStore("images"),n=e.index("timestamp").getAll();return new Promise(o=>{n.onsuccess=()=>{const i=n.result||[];i.sort((t,e)=>t.timestamp-e.timestamp);let r=0;const a=[];if(i.forEach(t=>{r+=this.estimateDataUrlSize(t.dataUrl)}),r>t)for(const e of i){if(r<=t)break;r-=this.estimateDataUrlSize(e.dataUrl),a.push(e.url)}a.forEach(t=>{e.delete(t)}),a.length>0&&this.options.silentMode,o()},n.onerror=()=>o()})}catch{}}async deleteIndexedDBCache(t){if(this.indexedDBReady&&this.indexedDBCache)try{const e=this.indexedDBCache.transaction(["images"],"readwrite");e.objectStore("images").delete(t)}catch{}}isElementVisible(t,e){if(!this.options.onlyVisibleImages)return!0;if(this.options.useIntersectionObserver&&this.intersectionObserver){if(this.visibleElementsCache.has(t))return!0;this.intersectionObserver.observe(t)}try{const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=!(n.bottom<o.top||n.top>o.bottom||n.right<o.left||n.left>o.right)&&n.width>0&&n.height>0&&"none"!==window.getComputedStyle(t).display&&"hidden"!==window.getComputedStyle(t).visibility&&"0"!==window.getComputedStyle(t).opacity;return this.options.useIntersectionObserver&&this.intersectionObserver&&(i?this.visibleElementsCache.add(t):this.visibleElementsCache.delete(t)),i}catch{return!0}}async preprocessNetworkImages(t){const e=t.querySelectorAll("img"),n=Array.from(e).filter(e=>{const n=e.src.startsWith("blob:"),o=e.src.startsWith("data:"),i=e.src.startsWith(window.location.origin),r=this.isElementVisible(e,t);return!n&&!o&&!i&&r});if(0===n.length)return;if(!this.options.silentMode){e.length}if(this.options.useProxy&&this.options.proxyUrl&&""!==this.options.proxyUrl.trim()){this.options.silentMode;const t=this.options.maxConcurrentDownloads||10,e=[];for(let o=0;o<n.length;o+=t)e.push(n.slice(o,o+t));await Promise.all(e.map(async t=>{await Promise.all(t.map(async t=>{const e=t.src;if(!this.getCachedImage(e))try{const t=await this.proxyImage(e);t&&this.setCachedImage(e,t)}catch(t){this.options.silentMode}}))})),this.options.silentMode}}async proxyImage(t){if(!this.options.proxyUrl||""===this.options.proxyUrl.trim())throw new Error("proxyUrl 未配置");const e=new URLSearchParams({url:t,maxWidth:String(this.options.maxWidth||1600),maxHeight:String(this.options.maxHeight||900),quality:String(Math.round(100*(this.options.quality||.4))),format:this.options.outputFormat||"webp"});let n=this.options.proxyUrl;n=n.replace(/[?&]$/,"");const o=`${n}?${e.toString()}`;this.options.silentMode;const i=await fetch(o,{method:"GET",mode:"cors",credentials:"omit",headers:{Accept:"image/*"}});if(!i.ok){const t=await i.text().catch(()=>"");throw new Error(`代理请求失败: ${i.status} ${i.statusText}${t?` - ${t.substring(0,200)}`:""}`)}const r=await i.blob(),a=await this.blobToDataUrl(r);return this.options.silentMode,a}async downloadImageWithoutProxy(t){try{const e=new AbortController,n=setTimeout(()=>e.abort(),this.options.imageLoadTimeout||5e3),o=await fetch(t,{method:"GET",mode:"cors",credentials:"omit",cache:"no-cache",signal:e.signal}).catch(()=>null).finally(()=>{clearTimeout(n)});if(o&&o.ok){const e=o.headers.get("content-length");if(e){const t=parseInt(e,10)/1048576;if(t>(this.options.maxImageSize||5)){if(this.options.skipLargeImages)return this.options.silentMode,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";this.options.silentMode}}const n=await o.blob(),i=n.size/1048576;if(i>(this.options.maxImageSize||5)){if(this.options.skipLargeImages)return this.options.silentMode,"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==";this.options.silentMode}const r=await this.blobToDataUrl(n);return this.setCachedImage(t,r),this.options.useIndexedDB&&await this.setIndexedDBCache(t,r),r}return t}catch(e){return this.options.silentMode,t}}blobToDataUrl(t){return new Promise((e,n)=>{const o=new FileReader,i=setTimeout(()=>{n(new Error("图片转换超时"))},1e4);o.onload=()=>{clearTimeout(i),e(o.result)},o.onerror=t=>{clearTimeout(i),n(t)},o.readAsDataURL(t)})}async waitForImagesToLoad(t){const e=t.querySelectorAll("img"),n=[];Array.from(e).forEach(t=>{if(t.complete)return;const e=this.options.imageLoadTimeout||5e3;n.push(Promise.race([new Promise(e=>{t.onload=()=>e(),t.onerror=()=>e()}),new Promise(t=>{setTimeout(()=>t(),e)})]))}),n.length>0&&await Promise.all(n)}async waitForStylesAndFonts(){return new Promise(t=>{requestAnimationFrame(()=>{setTimeout(()=>{t()},30)})})}async waitForFonts(){if(!document.fonts)return Promise.resolve();try{await document.fonts.ready,await new Promise(t=>setTimeout(t,100))}catch{}}calculateCompressedSize(t,e,n,o){let i=t,r=e;if(i>n||r>o){const t=n/i,e=o/r,a=Math.min(t,e);i=Math.round(i*a),r=Math.round(r*a)}return{width:i,height:r}}createWorker(){if("undefined"==typeof Worker||"undefined"==typeof OffscreenCanvas)return null;try{const t=new Blob(["\n self.onmessage = function(e) {\n const { type, data } = e.data;\n if (type === 'COMPRESS_IMAGE') {\n // 压缩逻辑(简化版)\n self.postMessage({\n type: 'SCREENSHOT_RESULT',\n data: { compressed: { dataUrl: data.dataUrl } }\n });\n }\n };\n "],{type:"application/javascript"}),e=URL.createObjectURL(t),n=new Worker(e);return n.onmessage=t=>{const{type:e,data:n}=t.data;"SCREENSHOT_RESULT"===e&&n?.compressed&&this.screenshotHistory.length>0&&(this.screenshotHistory[this.screenshotHistory.length-1]=n.compressed.dataUrl)},n.onerror=t=>{},n}catch(t){return null}}setupGlobalErrorHandlers(){this.globalErrorHandler=t=>{const e=t.message||t.error?.message||"";return!(e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin"))||(t.preventDefault(),t.stopPropagation(),!1)},this.globalRejectionHandler=t=>{const e=t.reason?.message||String(t.reason)||"";return!(e.includes("CORS")||e.includes("Access-Control-Allow-Origin")||e.includes("cross-origin"))||(t.preventDefault(),!1)},window.addEventListener("error",this.globalErrorHandler,!0),window.addEventListener("unhandledrejection",this.globalRejectionHandler,!0)}removeGlobalErrorHandlers(){this.globalErrorHandler&&(window.removeEventListener("error",this.globalErrorHandler,!0),this.globalErrorHandler=null),this.globalRejectionHandler&&(window.removeEventListener("unhandledrejection",this.globalRejectionHandler,!0),this.globalRejectionHandler=null)}async uploadScreenshot(t,e){try{this.options.silentMode;const n=this.dataUrlToBlob(t,e.contentType),o=await fetch(e.uploadUrl,{method:"PUT",body:n,headers:{"Content-Type":e.contentType}});if(200===o.status||204===o.status)return this.options.silentMode,this.uploadProgress.success++,!0;{const t=await o.text().catch(()=>""),e=`上传失败: HTTP ${o.status} ${o.statusText}${t?` - ${t.substring(0,200)}`:""}`;return this.uploadError=e,this.uploadProgress.failed++,!1}}catch(t){const e=t instanceof Error?t.message:String(t);return this.uploadError=`上传异常: ${e}`,this.uploadProgress.failed++,!1}}dataUrlToBlob(t,e){const n=t.split(","),o=n[0].match(/:(.*?);/),i=o?o[1]:e,r=atob(n[1]);let a=r.length;const s=new Uint8Array(a);for(;a--;)s[a]=r.charCodeAt(a);return new Blob([s],{type:i})}getLatestScreenshot(){return this.screenshotHistory[this.screenshotHistory.length-1]||null}enable(t){this.isEnabled=t,!t&&this.isRunning&&this.stopScreenshot()}destroy(){if(this.stopScreenshot(),this.worker&&(this.worker.terminate(),this.worker=null),this.screenshotContext){try{et(this.screenshotContext)}catch(t){}this.screenshotContext=null}this.expirationTimer&&(clearTimeout(this.expirationTimer),this.expirationTimer=null),this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.removeGlobalErrorHandlers(),this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null,this.visibleElementsCache.clear()),this.indexedDBCache&&(this.indexedDBCache.close(),this.indexedDBCache=null,this.indexedDBReady=!1),this.imageProxyCache.clear()}getCachedImage(t){const e=this.imageProxyCache.get(t);if(!e)return null;return Date.now()-e.timestamp>this.options.imageCacheTTL?(this.imageProxyCache.delete(t),null):e.dataUrl}setCachedImage(t,e){this.imageProxyCache.set(t,{dataUrl:e,timestamp:Date.now()})}cleanExpiredCache(){const t=Date.now(),e=[];this.imageProxyCache.forEach((n,o)=>{t-n.timestamp>this.options.imageCacheTTL&&e.push(o)}),e.forEach(t=>{this.imageProxyCache.delete(t)}),e.length>0&&this.options.silentMode}startCacheCleanup(){setInterval(()=>{if(this.cleanExpiredCache(),this.options.useIndexedDB&&this.cleanIndexedDBCache().catch(()=>{}),!this.options.silentMode){this.imageProxyCache.size}},3e5)}getState(){return{isRunning:this.isRunning,screenshotCount:this.screenshotCount,lastScreenshotTime:this.lastScreenshotTime,error:this.error,isEnabled:this.isEnabled,isUploading:this.isUploading,uploadError:this.uploadError,uploadProgress:{...this.uploadProgress},currentUploadConfig:this.currentUploadConfig}}}var cn=function(){return cn=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},cn.apply(this,arguments)};function ln(t,e,n,o){return new(n||(n=Promise))(function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((o=o.apply(t,e||[])).next())})}function un(t,e){var n,o,i,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(r=0)),r;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=e.call(t,r)}catch(t){s=[6,t],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function dn(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var hn="4.6.2";function mn(t,e){return new Promise(function(n){return setTimeout(n,t,e)})}function fn(t){return!!t&&"function"==typeof t.then}function pn(t,e){try{var n=t();fn(n)?n.then(function(t){return e(!0,t)},function(t){return e(!1,t)}):e(!0,n)}catch(t){e(!1,t)}}function gn(t,e,n){return void 0===n&&(n=16),ln(this,void 0,void 0,function(){var o,i,r,a;return un(this,function(s){switch(s.label){case 0:o=Array(t.length),i=Date.now(),r=0,s.label=1;case 1:return r<t.length?(o[r]=e(t[r],r),(a=Date.now())>=i+n?(i=a,[4,new Promise(function(t){var e=new MessageChannel;e.port1.onmessage=function(){return t()},e.port2.postMessage(null)})]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++r,[3,1];case 4:return[2,o]}})})}function yn(t){return t.then(void 0,function(){}),t}function wn(t){return parseInt(t)}function bn(t){return parseFloat(t)}function vn(t,e){return"number"==typeof t&&isNaN(t)?e:t}function xn(t){return t.reduce(function(t,e){return t+(e?1:0)},0)}function Sn(t,e){if(void 0===e&&(e=1),Math.abs(e)>=1)return Math.round(t/e)*e;var n=1/e;return Math.round(t*n)/n}function Cn(t,e){var n=t[0]>>>16,o=65535&t[0],i=t[1]>>>16,r=65535&t[1],a=e[0]>>>16,s=65535&e[0],c=e[1]>>>16,l=0,u=0,d=0,h=0;d+=(h+=r+(65535&e[1]))>>>16,h&=65535,u+=(d+=i+c)>>>16,d&=65535,l+=(u+=o+s)>>>16,u&=65535,l+=n+a,l&=65535,t[0]=l<<16|u,t[1]=d<<16|h}function En(t,e){var n=t[0]>>>16,o=65535&t[0],i=t[1]>>>16,r=65535&t[1],a=e[0]>>>16,s=65535&e[0],c=e[1]>>>16,l=65535&e[1],u=0,d=0,h=0,m=0;h+=(m+=r*l)>>>16,m&=65535,d+=(h+=i*l)>>>16,h&=65535,d+=(h+=r*c)>>>16,h&=65535,u+=(d+=o*l)>>>16,d&=65535,u+=(d+=i*c)>>>16,d&=65535,u+=(d+=r*s)>>>16,d&=65535,u+=n*l+o*c+i*s+r*a,u&=65535,t[0]=u<<16|d,t[1]=h<<16|m}function Mn(t,e){var n=t[0];32===(e%=64)?(t[0]=t[1],t[1]=n):e<32?(t[0]=n<<e|t[1]>>>32-e,t[1]=t[1]<<e|n>>>32-e):(e-=32,t[0]=t[1]<<e|n>>>32-e,t[1]=n<<e|t[1]>>>32-e)}function kn(t,e){0!==(e%=64)&&(e<32?(t[0]=t[1]>>>32-e,t[1]=t[1]<<e):(t[0]=t[1]<<e-32,t[1]=0))}function An(t,e){t[0]^=e[0],t[1]^=e[1]}var Ln=[4283543511,3981806797],In=[3301882366,444984403];function Rn(t){var e=[0,t[0]>>>1];An(t,e),En(t,Ln),e[1]=t[0]>>>1,An(t,e),En(t,In),e[1]=t[0]>>>1,An(t,e)}var Tn=[2277735313,289559509],Pn=[1291169091,658871167],Nn=[0,5],Fn=[0,1390208809],Wn=[0,944331445];function Dn(t,e){var n=function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++){var o=t.charCodeAt(n);if(o>127)return(new TextEncoder).encode(t);e[n]=o}return e}(t);e=e||0;var o,i=[0,n.length],r=i[1]%16,a=i[1]-r,s=[0,e],c=[0,e],l=[0,0],u=[0,0];for(o=0;o<a;o+=16)l[0]=n[o+4]|n[o+5]<<8|n[o+6]<<16|n[o+7]<<24,l[1]=n[o]|n[o+1]<<8|n[o+2]<<16|n[o+3]<<24,u[0]=n[o+12]|n[o+13]<<8|n[o+14]<<16|n[o+15]<<24,u[1]=n[o+8]|n[o+9]<<8|n[o+10]<<16|n[o+11]<<24,En(l,Tn),Mn(l,31),En(l,Pn),An(s,l),Mn(s,27),Cn(s,c),En(s,Nn),Cn(s,Fn),En(u,Pn),Mn(u,33),En(u,Tn),An(c,u),Mn(c,31),Cn(c,s),En(c,Nn),Cn(c,Wn);l[0]=0,l[1]=0,u[0]=0,u[1]=0;var d=[0,0];switch(r){case 15:d[1]=n[o+14],kn(d,48),An(u,d);case 14:d[1]=n[o+13],kn(d,40),An(u,d);case 13:d[1]=n[o+12],kn(d,32),An(u,d);case 12:d[1]=n[o+11],kn(d,24),An(u,d);case 11:d[1]=n[o+10],kn(d,16),An(u,d);case 10:d[1]=n[o+9],kn(d,8),An(u,d);case 9:d[1]=n[o+8],An(u,d),En(u,Pn),Mn(u,33),En(u,Tn),An(c,u);case 8:d[1]=n[o+7],kn(d,56),An(l,d);case 7:d[1]=n[o+6],kn(d,48),An(l,d);case 6:d[1]=n[o+5],kn(d,40),An(l,d);case 5:d[1]=n[o+4],kn(d,32),An(l,d);case 4:d[1]=n[o+3],kn(d,24),An(l,d);case 3:d[1]=n[o+2],kn(d,16),An(l,d);case 2:d[1]=n[o+1],kn(d,8),An(l,d);case 1:d[1]=n[o],An(l,d),En(l,Tn),Mn(l,31),En(l,Pn),An(s,l)}return An(s,i),An(c,i),Cn(s,c),Cn(c,s),Rn(s),Rn(c),Cn(s,c),Cn(c,s),("00000000"+(s[0]>>>0).toString(16)).slice(-8)+("00000000"+(s[1]>>>0).toString(16)).slice(-8)+("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)}function Hn(t,e,n,o){var i=Object.keys(t).filter(function(t){return!function(t,e){for(var n=0,o=t.length;n<o;++n)if(t[n]===e)return!0;return!1}(n,t)}),r=yn(gn(i,function(n){return function(t,e){var n=yn(new Promise(function(n){var o=Date.now();pn(t.bind(null,e),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=Date.now()-o;if(!t[0])return n(function(){return{error:t[1],duration:i}});var r=t[1];if(function(t){return"function"!=typeof t}(r))return n(function(){return{value:r,duration:i}});n(function(){return new Promise(function(t){var e=Date.now();pn(r,function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var r=i+Date.now()-e;if(!n[0])return t({error:n[1],duration:r});t({value:n[1],duration:r})})})})})}));return function(){return n.then(function(t){return t()})}}(t[n],e)},o));return function(){return ln(this,void 0,void 0,function(){var t,e,n,a;return un(this,function(s){switch(s.label){case 0:return[4,r];case 1:return[4,gn(s.sent(),function(t){return yn(t())},o)];case 2:return t=s.sent(),[4,Promise.all(t)];case 3:for(e=s.sent(),n={},a=0;a<i.length;++a)n[i[a]]=e[a];return[2,n]}})})}}function $n(){var t=window,e=navigator;return xn(["MSCSSMatrix"in t,"msSetImmediate"in t,"msIndexedDB"in t,"msMaxTouchPoints"in e,"msPointerEnabled"in e])>=4}function Bn(){var t=window,e=navigator;return xn(["webkitPersistentStorage"in e,"webkitTemporaryStorage"in e,0===(e.vendor||"").indexOf("Google"),"webkitResolveLocalFileSystemURL"in t,"BatteryManager"in t,"webkitMediaStream"in t,"webkitSpeechGrammar"in t])>=5}function Un(){var t=window;return xn(["ApplePayError"in t,"CSSPrimitiveValue"in t,"Counter"in t,0===navigator.vendor.indexOf("Apple"),"RGBColor"in t,"WebKitMediaKeys"in t])>=4}function Vn(){var t=window,e=t.HTMLElement,n=t.Document;return xn(["safari"in t,!("ongestureend"in t),!("TouchEvent"in t),!("orientation"in t),e&&!("autocapitalize"in e.prototype),n&&"pointerLockElement"in n.prototype])>=4}function On(){var t,e=window;return t=e.print,/^function\s.*?\{\s*\[native code]\s*}$/.test(String(t))&&"[object WebPageNamespace]"===String(e.browser)}function jn(){var t,e,n=window;return xn(["buildID"in navigator,"MozAppearance"in(null!==(e=null===(t=document.documentElement)||void 0===t?void 0:t.style)&&void 0!==e?e:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}function zn(){var t=window,e=navigator,n=t.CSS,o=t.HTMLButtonElement;return xn([!("getStorageUpdates"in e),o&&"popover"in o.prototype,"CSSCounterStyleRule"in t,n.supports("font-size-adjust: ex-height 0.5"),n.supports("text-transform: full-width")])>=4}function Xn(){var t=document;return(t.exitFullscreen||t.msExitFullscreen||t.mozCancelFullScreen||t.webkitExitFullscreen).call(t)}function Zn(){var t=Bn(),e=jn(),n=window,o=navigator,i="connection";return t?xn([!("SharedWorker"in n),o[i]&&"ontypechange"in o[i],!("sinkId"in new Audio)])>=2:!!e&&xn(["onorientationchange"in n,"orientation"in n,/android/i.test(o.appVersion)])>=2}function Gn(t){var e=new Error(t);return e.name=t,e}function Yn(t,e,n){var o,i,r;return void 0===n&&(n=50),ln(this,void 0,void 0,function(){var a,s;return un(this,function(c){switch(c.label){case 0:a=document,c.label=1;case 1:return a.body?[3,3]:[4,mn(n)];case 2:return c.sent(),[3,1];case 3:s=a.createElement("iframe"),c.label=4;case 4:return c.trys.push([4,,10,11]),[4,new Promise(function(t,n){var o=!1,i=function(){o=!0,t()};s.onload=i,s.onerror=function(t){o=!0,n(t)};var r=s.style;r.setProperty("display","block","important"),r.position="absolute",r.top="0",r.left="0",r.visibility="hidden",e&&"srcdoc"in s?s.srcdoc=e:s.src="about:blank",a.body.appendChild(s);var c=function(){var t,e;o||("complete"===(null===(e=null===(t=s.contentWindow)||void 0===t?void 0:t.document)||void 0===e?void 0:e.readyState)?i():setTimeout(c,10))};c()})];case 5:c.sent(),c.label=6;case 6:return(null===(i=null===(o=s.contentWindow)||void 0===o?void 0:o.document)||void 0===i?void 0:i.body)?[3,8]:[4,mn(n)];case 7:return c.sent(),[3,6];case 8:return[4,t(s,s.contentWindow)];case 9:return[2,c.sent()];case 10:return null===(r=s.parentNode)||void 0===r||r.removeChild(s),[7];case 11:return[2]}})})}function _n(t){for(var e=function(t){for(var e,n,o="Unexpected syntax '".concat(t,"'"),i=/^\s*([a-z-]*)(.*)$/i.exec(t),r=i[1]||void 0,a={},s=/([.:#][\w-]+|\[.+?\])/gi,c=function(t,e){a[t]=a[t]||[],a[t].push(e)};;){var l=s.exec(i[2]);if(!l)break;var u=l[0];switch(u[0]){case".":c("class",u.slice(1));break;case"#":c("id",u.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(!d)throw new Error(o);c(d[1],null!==(n=null!==(e=d[4])&&void 0!==e?e:d[5])&&void 0!==n?n:"");break;default:throw new Error(o)}}return[r,a]}(t),n=e[0],o=e[1],i=document.createElement(null!=n?n:"div"),r=0,a=Object.keys(o);r<a.length;r++){var s=a[r],c=o[s].join(" ");"style"===s?qn(i.style,c):i.setAttribute(s,c)}return i}function qn(t,e){for(var n=0,o=e.split(";");n<o.length;n++){var i=o[n],r=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(i);if(r){var a=r[1],s=r[2],c=r[4];t.setProperty(a,s,c||"")}}}var Jn=["monospace","sans-serif","serif"],Qn=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function Kn(t){return t.toDataURL()}var to,eo;function no(){var t=this;return function(){if(void 0===eo){var t=function(){var e=oo();io(e)?eo=setTimeout(t,2500):(to=e,eo=void 0)};t()}}(),function(){return ln(t,void 0,void 0,function(){var t;return un(this,function(e){switch(e.label){case 0:return io(t=oo())?to?[2,dn([],to,!0)]:(n=document).fullscreenElement||n.msFullscreenElement||n.mozFullScreenElement||n.webkitFullscreenElement?[4,Xn()]:[3,2]:[3,2];case 1:e.sent(),t=oo(),e.label=2;case 2:return io(t)||(to=t),[2,t]}var n})})}}function oo(){var t=screen;return[vn(bn(t.availTop),null),vn(bn(t.width)-bn(t.availWidth)-vn(bn(t.availLeft),0),null),vn(bn(t.height)-bn(t.availHeight)-vn(bn(t.availTop),0),null),vn(bn(t.availLeft),null)]}function io(t){for(var e=0;e<4;++e)if(t[e])return!1;return!0}function ro(t){var e;return ln(this,void 0,void 0,function(){var n,o,i,r,a,s,c;return un(this,function(l){switch(l.label){case 0:for(n=document,o=n.createElement("div"),i=new Array(t.length),r={},ao(o),c=0;c<t.length;++c)"DIALOG"===(a=_n(t[c])).tagName&&a.show(),ao(s=n.createElement("div")),s.appendChild(a),o.appendChild(s),i[c]=a;l.label=1;case 1:return n.body?[3,3]:[4,mn(50)];case 2:return l.sent(),[3,1];case 3:n.body.appendChild(o);try{for(c=0;c<t.length;++c)i[c].offsetParent||(r[t[c]]=!0)}finally{null===(e=o.parentNode)||void 0===e||e.removeChild(o)}return[2,r]}})})}function ao(t){t.style.setProperty("visibility","hidden","important"),t.style.setProperty("display","block","important")}function so(t){return matchMedia("(inverted-colors: ".concat(t,")")).matches}function co(t){return matchMedia("(forced-colors: ".concat(t,")")).matches}function lo(t){return matchMedia("(prefers-contrast: ".concat(t,")")).matches}function uo(t){return matchMedia("(prefers-reduced-motion: ".concat(t,")")).matches}function ho(t){return matchMedia("(prefers-reduced-transparency: ".concat(t,")")).matches}function mo(t){return matchMedia("(dynamic-range: ".concat(t,")")).matches}var fo=Math,po=function(){return 0};var go={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var yo=function(){for(var t=window;;){var e=t.parent;if(!e||e===t)return!1;try{if(e.location.origin!==t.location.origin)return!0}catch(t){if(t instanceof Error&&"SecurityError"===t.name)return!0;throw t}t=e}};var wo=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),bo=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),vo=["FRAGMENT_SHADER","VERTEX_SHADER"],xo=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],So="WEBGL_debug_renderer_info";function Co(t){if(t.webgl)return t.webgl.context;var e,n=document.createElement("canvas");n.addEventListener("webglCreateContextError",function(){return e=void 0});for(var o=0,i=["webgl","experimental-webgl"];o<i.length;o++){var r=i[o];try{e=n.getContext(r)}catch(t){}if(e)break}return t.webgl={context:e},e}function Eo(t,e,n){var o=t.getShaderPrecisionFormat(t[e],t[n]);return o?[o.rangeMin,o.rangeMax,o.precision]:[]}function Mo(t){return Object.keys(t.__proto__).filter(ko)}function ko(t){return"string"==typeof t&&!t.match(/[^A-Z0-9_x]/)}function Ao(){return jn()}function Lo(){return Bn()||Un()}function Io(t){return"function"==typeof t.getParameter}var Ro={fonts:function(){var t=this;return Yn(function(e,n){var o=n.document;return ln(t,void 0,void 0,function(){var t,e,n,i,r,a,s,c,l,u,d;return un(this,function(h){for((t=o.body).style.fontSize="48px",(e=o.createElement("div")).style.setProperty("visibility","hidden","important"),n={},i={},r=function(t){var n=o.createElement("span"),i=n.style;return i.position="absolute",i.top="0",i.left="0",i.fontFamily=t,n.textContent="mmMwWLliI0O&1",e.appendChild(n),n},a=function(t,e){return r("'".concat(t,"',").concat(e))},s=function(){for(var t={},e=function(e){t[e]=Jn.map(function(t){return a(e,t)})},n=0,o=Qn;n<o.length;n++){e(o[n])}return t},c=function(t){return Jn.some(function(e,o){return t[o].offsetWidth!==n[e]||t[o].offsetHeight!==i[e]})},l=function(){return Jn.map(r)}(),u=s(),t.appendChild(e),d=0;d<Jn.length;d++)n[Jn[d]]=l[d].offsetWidth,i[Jn[d]]=l[d].offsetHeight;return[2,Qn.filter(function(t){return c(u[t])})]})})})},domBlockers:function(t){var e=(void 0===t?{}:t).debug;return ln(this,void 0,void 0,function(){var t,n,o,i,r;return un(this,function(a){switch(a.label){case 0:return Un()||Zn()?(s=atob,t={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',s("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",s("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",s("LnNwb25zb3JpdA=="),".ylamainos",s("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",s("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",s("LmhlYWRlci1ibG9ja2VkLWFk"),s("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",s("I2FkXzMwMFgyNTA="),s("I2Jhbm5lcmZsb2F0MjI="),s("I2NhbXBhaWduLWJhbm5lcg=="),s("I0FkLUNvbnRlbnQ=")],adGuardChinese:[s("LlppX2FkX2FfSA=="),s("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",s("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),s("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",s("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",s("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",s("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),s("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),s("LmFkZ29vZ2xl"),s("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[s("YW1wLWF1dG8tYWRz"),s("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",s("I2FkX2ludmlld19hcmVh")],adGuardRussian:[s("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),s("LnJlY2xhbWE="),'div[id^="smi2adblock"]',s("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[s("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),s("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",s("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),s("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),s("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",s("I3Jla2xhbWk="),s("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),s("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),s("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[s("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",s("LndpZGdldF9wb19hZHNfd2lkZ2V0"),s("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",s("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[s("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),s("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",s("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",s("I3Jla2xhbW5pLWJveA=="),s("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",s("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[s("I2FkdmVydGVudGll"),s("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",s("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",s("LnNwb25zb3JsaW5rZ3J1ZW4="),s("I3dlcmJ1bmdza3k="),s("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),s("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[s("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",s("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[s("LnJla2xhbW9zX3RhcnBhcw=="),s("LnJla2xhbW9zX251b3JvZG9z"),s("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),s("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),s("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[s("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[s("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),s("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",s("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[s("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),s("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),s("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",s("LmFkX19tYWlu"),s("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[s("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),s("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[s("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),s("I2xpdmVyZUFkV3JhcHBlcg=="),s("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),s("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[s("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",s("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),s("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),s("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[s("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),s("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),s("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",s("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),s("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),s("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),s("ZGl2I3NrYXBpZWNfYWQ=")],ro:[s("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),s("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),s("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[s("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),s("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),s("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",s("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),s("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",s("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]},n=Object.keys(t),[4,ro((r=[]).concat.apply(r,n.map(function(e){return t[e]})))]):[2,void 0];case 1:return o=a.sent(),e&&function(t,e){for(var n=0,o=Object.keys(t);n<o.length;n++){var i=o[n];"\n".concat(i,":");for(var r=0,a=t[i];r<a.length;r++){var s=a[r];"\n ".concat(e[s]?"🚫":"➡️"," ").concat(s)}}}(t,o),(i=n.filter(function(e){var n=t[e];return xn(n.map(function(t){return o[t]}))>.6*n.length})).sort(),[2,i]}var s})})},fontPreferences:function(){return function(t,e){void 0===e&&(e=4e3);return Yn(function(n,o){var i=o.document,r=i.body,a=r.style;a.width="".concat(e,"px"),a.webkitTextSizeAdjust=a.textSizeAdjust="none",Bn()?r.style.zoom="".concat(1/o.devicePixelRatio):Un()&&(r.style.zoom="reset");var s=i.createElement("div");return s.textContent=dn([],Array(e/20|0),!0).map(function(){return"word"}).join(" "),r.appendChild(s),t(i,r)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}(function(t,e){for(var n={},o={},i=0,r=Object.keys(go);i<r.length;i++){var a=r[i],s=go[a],c=s[0],l=void 0===c?{}:c,u=s[1],d=void 0===u?"mmMwWLliI0fiflO&1":u,h=t.createElement("span");h.textContent=d,h.style.whiteSpace="nowrap";for(var m=0,f=Object.keys(l);m<f.length;m++){var p=f[m],g=l[p];void 0!==g&&(h.style[p]=g)}n[a]=h,e.append(t.createElement("br"),h)}for(var y=0,w=Object.keys(go);y<w.length;y++){o[a=w[y]]=n[a].getBoundingClientRect().width}return o})},audio:function(){return Un()&&zn()&&On()||Bn()&&(t=navigator,e=window,n=Audio.prototype,o=e.visualViewport,xn(["srLatency"in n,"srChannelCount"in n,"devicePosture"in t,o&&"segments"in o,"getTextInformation"in Image.prototype])>=3)&&function(){var t=window,e=t.URLPattern;return xn(["union"in Set.prototype,"Iterator"in t,e&&"hasRegExpGroups"in e.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}()?-4:function(){var t=window,e=t.OfflineAudioContext||t.webkitOfflineAudioContext;if(!e)return-2;if(Un()&&!Vn()&&!function(){var t=window;return xn(["DOMRectList"in t,"RTCPeerConnectionIceEvent"in t,"SVGGeometryElement"in t,"ontransitioncancel"in t])>=3}())return-1;var n=4500,o=new e(1,5e3,44100),i=o.createOscillator();i.type="triangle",i.frequency.value=1e4;var r=o.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,i.connect(r),r.connect(o.destination),i.start(0);var a=function(t){var e=3,n=500,o=500,i=5e3,r=function(){},a=new Promise(function(a,s){var c=!1,l=0,u=0;t.oncomplete=function(t){return a(t.renderedBuffer)};var d=function(){setTimeout(function(){return s(Gn("timeout"))},Math.min(o,u+i-Date.now()))},h=function(){try{var o=t.startRendering();switch(fn(o)&&yn(o),t.state){case"running":u=Date.now(),c&&d();break;case"suspended":document.hidden||l++,c&&l>=e?s(Gn("suspended")):setTimeout(h,n)}}catch(t){s(t)}};h(),r=function(){c||(c=!0,u>0&&d())}});return[a,r]}(o),s=a[0],c=a[1],l=yn(s.then(function(t){return function(t){for(var e=0,n=0;n<t.length;++n)e+=Math.abs(t[n]);return e}(t.getChannelData(0).subarray(n))},function(t){if("timeout"===t.name||"suspended"===t.name)return-3;throw t}));return function(){return c(),l}}();var t,e,n,o},screenFrame:function(){var t=this;if(Un()&&zn()&&On())return function(){return Promise.resolve(void 0)};var e=no();return function(){return ln(t,void 0,void 0,function(){var t,n;return un(this,function(o){switch(o.label){case 0:return[4,e()];case 1:return t=o.sent(),[2,[(n=function(t){return null===t?null:Sn(t,10)})(t[0]),n(t[1]),n(t[2]),n(t[3])]]}})})}},canvas:function(){return function(t){var e,n,o,i=!1,r=function(){var t=document.createElement("canvas");return t.width=1,t.height=1,[t,t.getContext("2d")]}(),a=r[0],s=r[1];!function(t,e){return!(!e||!t.toDataURL)}(a,s)?n=o="unsupported":(i=function(t){return t.rect(0,0,10,10),t.rect(2,2,6,6),!t.isPointInPath(5,5,"evenodd")}(s),t?n=o="skipped":(e=function(t,e){!function(t,e){t.width=240,t.height=60,e.textBaseline="alphabetic",e.fillStyle="#f60",e.fillRect(100,1,62,20),e.fillStyle="#069",e.font='11pt "Times New Roman"';var n="Cwm fjordbank gly ".concat(String.fromCharCode(55357,56835));e.fillText(n,2,15),e.fillStyle="rgba(102, 204, 0, 0.2)",e.font="18pt Arial",e.fillText(n,4,45)}(t,e);var n=Kn(t),o=Kn(t);if(n!==o)return["unstable","unstable"];!function(t,e){t.width=122,t.height=110,e.globalCompositeOperation="multiply";for(var n=0,o=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];n<o.length;n++){var i=o[n],r=i[0],a=i[1],s=i[2];e.fillStyle=r,e.beginPath(),e.arc(a,s,40,0,2*Math.PI,!0),e.closePath(),e.fill()}e.fillStyle="#f9c",e.arc(60,60,60,0,2*Math.PI,!0),e.arc(60,60,20,0,2*Math.PI,!0),e.fill("evenodd")}(t,e);var i=Kn(t);return[i,n]}(a,s),n=e[0],o=e[1]));return{winding:i,geometry:n,text:o}}(Un()&&zn()&&On())},osCpu:function(){return navigator.oscpu},languages:function(){var t,e=navigator,n=[],o=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(void 0!==o&&n.push([o]),Array.isArray(e.languages))Bn()&&xn([!("MediaSettingsRange"in(t=window)),"RTCEncodedAudioFrame"in t,""+t.Intl=="[object Intl]",""+t.Reflect=="[object Reflect]"])>=3||n.push(e.languages);else if("string"==typeof e.languages){var i=e.languages;i&&n.push(i.split(","))}return n},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return vn(bn(navigator.deviceMemory),void 0)},screenResolution:function(){var t,e,n;if(!(Un()&&zn()&&On()))return t=screen,(n=[(e=function(t){return vn(wn(t),null)})(t.width),e(t.height)]).sort().reverse(),n},hardwareConcurrency:function(){return vn(wn(navigator.hardwareConcurrency),void 0)},timezone:function(){var t,e=null===(t=window.Intl)||void 0===t?void 0:t.DateTimeFormat;if(e){var n=(new e).resolvedOptions().timeZone;if(n)return n}var o,i=(o=(new Date).getFullYear(),-Math.max(bn(new Date(o,0,1).getTimezoneOffset()),bn(new Date(o,6,1).getTimezoneOffset())));return"UTC".concat(i>=0?"+":"").concat(i)},sessionStorage:function(){try{return!!window.sessionStorage}catch(t){return!0}},localStorage:function(){try{return!!window.localStorage}catch(t){return!0}},indexedDB:function(){var t,e;if(!($n()||(t=window,e=navigator,xn(["msWriteProfilerMark"in t,"MSStream"in t,"msLaunchUri"in e,"msSaveBlob"in e])>=3&&!$n())))try{return!!window.indexedDB}catch(t){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var t=navigator.platform;return"MacIntel"===t&&Un()&&!Vn()?function(){if("iPad"===navigator.platform)return!0;var t=screen,e=t.width/t.height;return xn(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,e>.65&&e<1.53])>=2}()?"iPad":"iPhone":t},plugins:function(){var t=navigator.plugins;if(t){for(var e=[],n=0;n<t.length;++n){var o=t[n];if(o){for(var i=[],r=0;r<o.length;++r){var a=o[r];i.push({type:a.type,suffixes:a.suffixes})}e.push({name:o.name,description:o.description,mimeTypes:i})}}return e}},touchSupport:function(){var t,e=navigator,n=0;void 0!==e.maxTouchPoints?n=wn(e.maxTouchPoints):void 0!==e.msMaxTouchPoints&&(n=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(e){t=!1}return{maxTouchPoints:n,touchEvent:t,touchStart:"ontouchstart"in window}},vendor:function(){return navigator.vendor||""},vendorFlavors:function(){for(var t=[],e=0,n=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];e<n.length;e++){var o=n[e],i=window[o];i&&"object"==typeof i&&t.push(o)}return t.sort()},cookiesEnabled:function(){var t=document;try{t.cookie="cookietest=1; SameSite=Strict;";var e=-1!==t.cookie.indexOf("cookietest=");return t.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(t){return!1}},colorGamut:function(){for(var t=0,e=["rec2020","p3","srgb"];t<e.length;t++){var n=e[t];if(matchMedia("(color-gamut: ".concat(n,")")).matches)return n}},invertedColors:function(){return!!so("inverted")||!so("none")&&void 0},forcedColors:function(){return!!co("active")||!co("none")&&void 0},monochrome:function(){if(matchMedia("(min-monochrome: 0)").matches){for(var t=0;t<=100;++t)if(matchMedia("(max-monochrome: ".concat(t,")")).matches)return t;throw new Error("Too high value")}},contrast:function(){return lo("no-preference")?0:lo("high")||lo("more")?1:lo("low")||lo("less")?-1:lo("forced")?10:void 0},reducedMotion:function(){return!!uo("reduce")||!uo("no-preference")&&void 0},reducedTransparency:function(){return!!ho("reduce")||!ho("no-preference")&&void 0},hdr:function(){return!!mo("high")||!mo("standard")&&void 0},math:function(){var t,e=fo.acos||po,n=fo.acosh||po,o=fo.asin||po,i=fo.asinh||po,r=fo.atanh||po,a=fo.atan||po,s=fo.sin||po,c=fo.sinh||po,l=fo.cos||po,u=fo.cosh||po,d=fo.tan||po,h=fo.tanh||po,m=fo.exp||po,f=fo.expm1||po,p=fo.log1p||po;return{acos:e(.12312423423423424),acosh:n(1e308),acoshPf:(t=1e154,fo.log(t+fo.sqrt(t*t-1))),asin:o(.12312423423423424),asinh:i(1),asinhPf:function(t){return fo.log(t+fo.sqrt(t*t+1))}(1),atanh:r(.5),atanhPf:function(t){return fo.log((1+t)/(1-t))/2}(.5),atan:a(.5),sin:s(-1e300),sinh:c(1),sinhPf:function(t){return fo.exp(t)-1/fo.exp(t)/2}(1),cos:l(10.000000000123),cosh:u(1),coshPf:function(t){return(fo.exp(t)+1/fo.exp(t))/2}(1),tan:d(-1e300),tanh:h(1),tanhPf:function(t){return(fo.exp(2*t)-1)/(fo.exp(2*t)+1)}(1),exp:m(1),expm1:f(1),expm1Pf:function(t){return fo.exp(t)-1}(1),log1p:p(10),log1pPf:function(t){return fo.log(1+t)}(10),powPI:function(t){return fo.pow(fo.PI,t)}(-100)}},pdfViewerEnabled:function(){return navigator.pdfViewerEnabled},architecture:function(){var t=new Float32Array(1),e=new Uint8Array(t.buffer);return t[0]=1/0,t[0]=t[0]-t[0],e[3]},applePay:function(){var t=window.ApplePaySession;if("function"!=typeof(null==t?void 0:t.canMakePayments))return-1;if(yo())return-3;try{return t.canMakePayments()?1:0}catch(t){return function(t){if(t instanceof Error&&"InvalidAccessError"===t.name&&/\bfrom\b.*\binsecure\b/i.test(t.message))return-2;throw t}(t)}},privateClickMeasurement:function(){var t,e=document.createElement("a"),n=null!==(t=e.attributionSourceId)&&void 0!==t?t:e.attributionsourceid;return void 0===n?void 0:String(n)},audioBaseLatency:function(){if(!(Zn()||Un()))return-2;if(!window.AudioContext)return-1;var t=(new AudioContext).baseLatency;return null==t?-1:isFinite(t)?t:-3},dateTimeLocale:function(){if(!window.Intl)return-1;var t=window.Intl.DateTimeFormat;if(!t)return-2;var e=t().resolvedOptions().locale;return e||""===e?e:-3},webGlBasics:function(t){var e,n,o,i,r,a,s=Co(t.cache);if(!s)return-1;if(!Io(s))return-2;var c=Ao()?null:s.getExtension(So);return{version:(null===(e=s.getParameter(s.VERSION))||void 0===e?void 0:e.toString())||"",vendor:(null===(n=s.getParameter(s.VENDOR))||void 0===n?void 0:n.toString())||"",vendorUnmasked:c?null===(o=s.getParameter(c.UNMASKED_VENDOR_WEBGL))||void 0===o?void 0:o.toString():"",renderer:(null===(i=s.getParameter(s.RENDERER))||void 0===i?void 0:i.toString())||"",rendererUnmasked:c?null===(r=s.getParameter(c.UNMASKED_RENDERER_WEBGL))||void 0===r?void 0:r.toString():"",shadingLanguageVersion:(null===(a=s.getParameter(s.SHADING_LANGUAGE_VERSION))||void 0===a?void 0:a.toString())||""}},webGlExtensions:function(t){var e=Co(t.cache);if(!e)return-1;if(!Io(e))return-2;var n=e.getSupportedExtensions(),o=e.getContextAttributes(),i=[],r=[],a=[],s=[],c=[];if(o)for(var l=0,u=Object.keys(o);l<u.length;l++){var d=u[l];r.push("".concat(d,"=").concat(o[d]))}for(var h=0,m=Mo(e);h<m.length;h++){var f=e[x=m[h]];a.push("".concat(x,"=").concat(f).concat(wo.has(f)?"=".concat(e.getParameter(f)):""))}if(n)for(var p=0,g=n;p<g.length;p++){var y=g[p];if(!(y===So&&Ao()||"WEBGL_polygon_mode"===y&&Lo())){var w=e.getExtension(y);if(w)for(var b=0,v=Mo(w);b<v.length;b++){var x;f=w[x=v[b]];s.push("".concat(x,"=").concat(f).concat(bo.has(f)?"=".concat(e.getParameter(f)):""))}else i.push(y)}}for(var S=0,C=vo;S<C.length;S++)for(var E=C[S],M=0,k=xo;M<k.length;M++){var A=k[M],L=Eo(e,E,A);c.push("".concat(E,".").concat(A,"=").concat(L.join(",")))}return s.sort(),a.sort(),{contextAttributes:r,parameters:a,shaderPrecisions:c,extensions:n,extensionParameters:s,unsupportedExtensions:i}}};function To(t){var e=function(t){if(Zn())return.4;if(Un())return!Vn()||zn()&&On()?.3:.5;var e="value"in t.platform?t.platform.value:"";if(/^Win/.test(e))return.6;if(/^Mac/.test(e))return.5;return.7}(t),n=function(t){return Sn(.99+.01*t,1e-4)}(e);return{score:e,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,"".concat(n))}}function Po(t){return Dn(function(t){for(var e="",n=0,o=Object.keys(t).sort();n<o.length;n++){var i=o[n],r=t[i],a="error"in r?"error":JSON.stringify(r.value);e+="".concat(e?"|":"").concat(i.replace(/([:|\\])/g,"\\$1"),":").concat(a)}return e}(t))}function No(t){return void 0===t&&(t=50),function(t,e){void 0===e&&(e=1/0);var n=window.requestIdleCallback;return n?new Promise(function(t){return n.call(window,function(){return t()},{timeout:e})}):mn(Math.min(t,e))}(t,2*t)}function Fo(t,e){Date.now();return{get:function(n){return ln(this,void 0,void 0,function(){var o,i;return un(this,function(r){switch(r.label){case 0:return Date.now(),[4,t()];case 1:return o=r.sent(),i=function(t){var e,n=To(t);return{get visitorId(){return void 0===e&&(e=Po(this.components)),e},set visitorId(t){e=t},confidence:n,components:t,version:hn}}(o),e||null==n||n.debug,[2,i]}})})}}}var Wo={load:function(t){var e;return void 0===t&&(t={}),ln(this,void 0,void 0,function(){var n,o,i;return un(this,function(r){switch(r.label){case 0:return(null===(e=t.monitoring)||void 0===e||e)&&function(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var t=new XMLHttpRequest;t.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(hn,"/npm-monitoring"),!0),t.send()}catch(t){}}(),n=t.delayFallback,o=t.debug,[4,No(n)];case 1:return r.sent(),i=function(t){return Hn(Ro,t,[])}({cache:{},debug:o}),[2,Fo(i,o)]}})})},hashComponents:Po,componentsToDebugString:function(t){return JSON.stringify(t,function(t,e){return e instanceof Error?cn({name:(n=e).name,message:n.message,stack:null===(o=n.stack)||void 0===o?void 0:o.split("\n")},n):e;var n,o},2)}};class Do{constructor(){this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async init(t,e){if(!this.isInitialized){this.config=t;try{const i=await this.getDeviceId(),r=this.buildIframeUrl(t,i),a=e?.iconPosition||void 0;if(this.iconManager=new n(a),await this.iconManager.show(),this.iframeManager=new o({src:r,mode:"auto",width:400,height:600,allowClose:!0,onMessage:(t,e)=>{"new-message"===t&&this.showNotification(0,{pulse:!0})},onClose:()=>{this.iconManager?.forceCleanupDragEvents()},...e}),await this.iframeManager.init(),this.iconManager.onClick(()=>{this.clearNotification(),this.iframeManager?.show()}),t.screenshot){const e=document.body;this.screenshotManager=new sn(e,t.screenshot),this.screenshotManager.enable(!0)}this.isInitialized=!0}catch(t){throw t}}}showIcon(){this.iconManager?.show()}hideIcon(){this.iconManager?.hide()}setIconPosition(t){this.iconManager?.setPosition(t)}setIconCoordinates(t){this.iconManager?.setIconPosition(t)}setIconStyle(t){this.iconManager?.setStyle(t)}openChat(){this.clearNotification(),this.iframeManager?.open()}closeChat(){this.iconManager?.forceCleanupDragEvents(),this.iframeManager?.close()}isChatOpen(){return this.iframeManager?.isIframeOpen()||!1}sendToIframe(t){this.iframeManager?.sendToIframe(t)}getConnectionStatus(){return this.isInitialized}showNotification(t=1,e={}){this.iconManager&&(this.iconManager.showNotification({badgeCount:"string"==typeof t?0:t,badgeText:"string"==typeof t?t:"",pulse:e.pulse||!1}),e.autoHide&&e.autoHide>0&&setTimeout(()=>{this.iconManager?.clearNotification()},e.autoHide))}clearNotification(){this.iconManager?.clearNotification()}setScreenshotTarget(t){this.screenshotManager?.setTargetElement(t)}async captureScreenshot(t=!1){return!!this.screenshotManager&&await this.screenshotManager.captureOnce(t)}enableScreenshot(t){this.screenshotManager&&this.screenshotManager.enable(t)}getScreenshotState(){return this.screenshotManager?.getState()||null}destroy(){this.iconManager?.hide(),this.iframeManager?.close(),this.screenshotManager?.destroy(),this.iconManager=null,this.iframeManager=null,this.screenshotManager=null,this.config=null,this.isInitialized=!1}async getDeviceId(){try{const t=await Wo.load();return(await t.get()).visitorId}catch(t){return"device_"+Date.now()+"_"+Math.random().toString(36).substr(2,9)}}buildIframeUrl(t,e){const n=t.iframeUrl;if(!n||""===n.trim())throw new Error("iframeUrl is required but not provided or is empty");const o=new URL(n);return t.agent&&""!==t.agent.trim()&&o.searchParams.set("Agent",t.agent),t.token&&""!==t.token.trim()&&o.searchParams.set("Authorization",t.token),o.searchParams.set("DeviceSign",e),o.searchParams.set("Referrer",document.referrer),o.toString()}}let Ho=null;const $o=async(t,e)=>{Ho||(Ho=new Do),await Ho.init(t,e)},Bo=()=>{if(!Ho)throw new Error("SDK not initialized. Call init() first.");return Ho},Uo=()=>{Bo().showIcon()},Vo=()=>{Bo().hideIcon()},Oo=t=>{Bo().setIconPosition(t)},jo=t=>{Bo().setIconCoordinates(t)},zo=t=>{Bo().setIconStyle(t)},Xo=()=>{Bo().openChat()},Zo=()=>{Bo().closeChat()},Go=()=>Bo().isChatOpen(),Yo=t=>{Bo().sendToIframe(t)},_o=()=>Bo().getConnectionStatus(),qo=(t=1,e={})=>{Bo().showNotification(t,e)},Jo=()=>{Bo().clearNotification()},Qo=()=>{Bo().destroy(),Ho=null},Ko=t=>{Bo().setScreenshotTarget(t)},ti=async(t=!1)=>{const e=Bo();return await e.captureScreenshot(t)},ei=t=>{Bo().enableScreenshot(t)},ni=()=>Bo().getScreenshotState();var oi={init:$o,getInstance:Bo,showIcon:Uo,hideIcon:Vo,setIconPosition:Oo,setIconCoordinates:jo,setIconStyle:zo,openChat:Xo,closeChat:Zo,isChatOpen:Go,sendToIframe:Yo,getConnectionStatus:_o,showNotification:qo,clearNotification:Jo,setScreenshotTarget:Ko,captureScreenshot:ti,enableScreenshot:ei,getScreenshotState:ni,destroy:Qo};t.CustomerServiceSDK=Do,t.captureScreenshot=ti,t.clearNotification=Jo,t.closeChat=Zo,t.default=oi,t.destroy=Qo,t.enableScreenshot=ei,t.getConnectionStatus=_o,t.getInstance=Bo,t.getScreenshotState=ni,t.hideIcon=Vo,t.init=$o,t.isChatOpen=Go,t.openChat=Xo,t.sendToIframe=Yo,t.setIconCoordinates=jo,t.setIconPosition=Oo,t.setIconStyle=zo,t.setScreenshotTarget=Ko,t.showIcon=Uo,t.showNotification=qo,Object.defineProperty(t,"__esModule",{value:!0})});