@applitools/dom-capture 11.2.6 → 11.2.8

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,8 +1,8 @@
1
- /* @applitools/dom-capture@11.2.6 */
1
+ /* @applitools/dom-capture@11.2.8 */
2
2
  function __captureDomPoll() {
3
- var captureDomPoll=function(){"use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(){const t=function(t){return function(){function e(t,e=0){const n=t.charCodeAt(e);return n>=55296&&n<56320?1024*(n-55296)+(t.charCodeAt(e+1)-56320)+65536:56320<=n&&n<=57343?-1:n}var n=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const o=n,r="WIP",s="SUCCESS",a="SUCCESS_CHUNKED",c="ERROR";var u=function(t,e,n={}){const u=function(t,{chunkByteLength:e=0}={}){if(t){if(t.value){if(e){if(!t.chunks)try{const n=JSON.stringify(t.value);t.chunks=o(n,e),t.chunks.length>0&&(t.from=0,t.value=n)}catch(t){return{status:c,error:t.message}}if(t.from>=0)return{status:a,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:s,value:t.value}}return t.error?{status:c,error:t.error}:{status:r}}return{status:c,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],n);return(u.status===s||u.status===c||u.status===a&&u.done)&&(t[e]=null),u};const i=u;var l={chunkify:n,pollify:function(t,e,n){return o=>function(){return e[n]||(e[n]={},Promise.resolve().then((()=>t.apply(null,arguments))).then((t=>e[n].value=t)).catch((t=>e[n].error=t.message))),i(e,n,o)}},poll:u,absolutizeUrl:function(t,e){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let n=!0;try{n=t!==decodeURI(t)}catch(t){n=!0}try{const o=new URL(t,e).href;return n?o:decodeURI(o)}catch(e){return n?t:decodeURI(t)}},isInlineFrame:function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)},isAccessibleFrame:function(t){try{const e=t.contentDocument;return Boolean(e&&e.defaultView&&e.defaultView.frameElement)}catch(t){return!1}}},d={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","font-family","line-height","margin","opacity","overflow","padding","visibility","text-align","position","border-radius","z-index"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const f=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;const{NODE_TYPES:m}=d;function h(t){return Array.prototype.filter.call(t.parentNode.childNodes,(e=>e.tagName===t.tagName)).indexOf(t)+1}var p=function(e){var n=t.implementation.createHTMLDocument(""),o=n.createElement("style");return o.textContent=e,n.body.appendChild(o),o.sheet},g=function(t){const e=Array.from(t.attributes).find((t=>"href"===t.name.toLowerCase()));return e&&e.value},y=function(t){if(t.nodeName&&"LINK"===t.nodeName.toUpperCase()&&t.attributes){const e=new Map(Array.from(t.attributes,(t=>[t.name.toLowerCase(),t.value.toLowerCase()])));return"stylesheet"===e.get("rel")||"style"===e.get("as")&&["preload","prefetch"].includes(e.get("rel"))}return!1};const w=g,E=y;const{absolutizeUrl:C,isInlineFrame:T}=l,N=p,b=g,S=y,{NODE_TYPES:A}=d;const{absolutizeUrl:$,isInlineFrame:_}=l,R=function(t){const e=t?t.match(f):void 0;return e?e[1]:e},P=async function({bgImages:t,timeout:e=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(t).map((t=>{return Promise.race([new Promise((e=>{const o=new n;o.onload=()=>e({url:t,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>e(),o.src=t})),(o=e,new Promise((t=>{setTimeout(t,o)})))]);var o})))).reduce(((t,e)=>(e&&(t[e.url]={width:e.width,height:e.height}),t)),{})},D=function t(e){if(!e.ownerDocument)return"";let n="",o=e,r=e.ownerDocument,s=r.defaultView.frameElement;for(;o!==r&&(!o||o.nodeType!==m.DOCUMENT_FRAGMENT);)n=`${o.tagName}[${h(o)}]/${n}`,o=o.parentNode;return s&&(n=`${t(s)},${n}`),n.replace(/\/$/,"")},U=function({parseCss:t,CSSImportRule:e,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let u,i="";try{const l=t(a);for(const t of Array.from(l.cssRules))if(t instanceof e){const e=n(t.href,c),a=o(e);if(void 0!==a){const{bundledCss:t,unfetchedResources:n}=s(a,e);n&&(u=new Set(n)),i=`${i}${t}`}else u=new Set([e]),i=`\n${r}${e}${r}`}}catch(t){console.log(`error during getBundledCssFromCssText, styleBaseUrl=${c}`,t)}var l,d;return i=`${i}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}},v=p,O=function(t){const e=["before","after"];try{let n=[];return e.forEach((e=>{const o=t.ownerDocument.defaultView.getComputedStyle(t,`:${e}`);o&&"none"!==o.getPropertyValue("content")&&n.push(e)})),n.join("_and_")}catch(t){return!1}},F=function(t,{fetchTimeLimit:e}={}){return async function(n){const o=new AbortController,r=[t(n,{cache:"force-cache",signal:o.signal}).then((t=>{if(t.ok)return t.text();console.log("/failed to fetch (status "+t.status+") css from: "+n+"/")})).catch((t=>{console.log("/failed to fetch (error "+t.toString()+") css from: "+n+"/")}))];return Number.isNaN(Number(e))||r.push(new Promise((t=>setTimeout(t,e))).then((()=>o.abort()))),Promise.race(r)}},I=function({getCssFromCache:t,absolutizeUrl:e}){return function(n,o){let r,s,a;if(n&&function(t){return t.nodeName&&"STYLE"===t.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map((t=>t.nodeValue)).join(""),s=o;else if(n&&E(n)){const c=w(n);!function(t){return t&&t.startsWith("data:")}(c)?(s=e(c,o),r=t(s)):(s=o,r=c.match(/,(.+)/)[1]),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}},k=function({extractCssFromNode:t,getBundledCssFromCssText:e,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=t(o,r);let u,i="";if(a){const{bundledCss:t,unfetchedResources:n}=e(a,s);i+=t,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},L=function(e){return async function(n=t){const o={},r=Date.now(),s=[];return function t(n,o,r,s){function c(t){if(s.push(async function(t,n,o){let r,s;t&&S(t)&&(s=C(b(t),n),r=await e(s),void 0!==r&&(o[s]=r)),r&&await a(r,s,o)}(t,o,r)),t.nodeType===A.ELEMENT)return"IFRAME"===t.tagName.toUpperCase()?i(t):u(t)}async function u(t){Array.prototype.map.call(t.childNodes,c)}async function i(e){if(u(e),e.contentDocument)try{const n=T(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}c(n.documentElement)}(n,n.location.href,o,s),await Promise.all(s),console.log("[prefetchAllCss]",Date.now()-r),function(t){return o[t]};async function a(t,n,o){try{const r=N(t),s=[];for(const t of Array.from(r.cssRules))t instanceof CSSImportRule&&s.push((async()=>{const r=C(t.href,n),s=await e(r);o[r]=s,void 0!==s&&await a(s,r,o)})());await Promise.all(s)}catch(t){console.log(`error during fetchBundledCss, resourceUrl=${n}`,t)}}}},{NODE_TYPES:x,DEFAULT_STYLE_PROPS:M,DEFAULT_RECT_PROPS:V,DEFAULT_IGNORED_TAG_NAMES:B}=d;const{pollify:Y}=l,{EYES_NAMESPACE:z,DOM_CAPTURE_KEY:G}=d,j=async function({doc:e=t,styleProps:n=M,rectProps:o=V,ignoredTagNames:r=B,addStats:s=!1,fetchTimeLimit:a=3e4}={}){
3
+ var captureDomPoll=function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=function(){const e=function(e){return function(){function t(e,t=0){const n=e.charCodeAt(t);return n>=55296&&n<56320?1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536:56320<=n&&n<=57343?-1:n}var n=function(e,n){const o=[];let r=0;for(let a=0;a<e.length;++a){const s=t(e,a);let c=0;s>0&&(c=s<128?1:s<2048?2:s<65536?3:s<2097152?4:s<67108864?5:6),r+c>n?(o.push(a),r=c):r+=c}return o};const o=n,r="WIP",a="SUCCESS",s="SUCCESS_CHUNKED",c="ERROR";var u=function(e,t,n={}){const u=function(e,{chunkByteLength:t=0}={}){if(e){if(e.value){if(t){if(!e.chunks)try{const n=JSON.stringify(e.value);e.chunks=o(n,t),e.chunks.length>0&&(e.from=0,e.value=n)}catch(e){return{status:c,error:e.message}}if(e.from>=0)return{status:s,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:a,value:e.value}}return e.error?{status:c,error:e.error}:{status:r}}return{status:c,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[t],n);return(u.status===a||u.status===c||u.status===s&&u.done)&&(e[t]=null),u};const i=u;var l={chunkify:n,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},Promise.resolve().then((()=>e.apply(null,arguments))).then((e=>t[n].value=e)).catch((e=>t[n].error=e.message))),i(t,n,o)}},poll:u,absolutizeUrl:function(e,t){if(function(e){try{return new URL(e),!0}catch(e){return!1}}(e))return e;let n=!0;try{n=e!==decodeURI(e)}catch(e){n=!0}try{const o=new URL(e,t).href;return n?o:decodeURI(o)}catch(t){return n?e:decodeURI(e)}},isInlineFrame:function(e){return e.contentDocument&&e.contentDocument.location&&!/^https?:$/.test(e.contentDocument.location.protocol)},isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}},d={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","font-family","line-height","margin","opacity","overflow","padding","visibility","text-align","position","border-radius","z-index"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const f=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;const{NODE_TYPES:m}=d;function h(e){return Array.prototype.filter.call(e.parentNode.childNodes,(t=>t.tagName===e.tagName)).indexOf(e)+1}var p=function(t){var n=e.implementation.createHTMLDocument(""),o=n.createElement("style");return o.textContent=t,n.body.appendChild(o),o.sheet},g=function(e){const t=Array.from(e.attributes).find((e=>"href"===e.name.toLowerCase()));return t&&t.value},y=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,(e=>[e.name.toLowerCase(),e.value.toLowerCase()])));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};const w=g,E=y;const{absolutizeUrl:C,isInlineFrame:T}=l,N=p,b=g,S=y,{NODE_TYPES:A}=d;const{absolutizeUrl:$,isInlineFrame:R}=l,_=function(e){const t=e?e.match(f):void 0;return t?t[1]:t},P=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map((e=>{return Promise.race([new Promise((t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e})),(o=t,new Promise((e=>{setTimeout(e,o)})))]);var o})))).reduce(((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e)),{})},v=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,a=r.defaultView.frameElement;for(;o!==r&&(!o||o.nodeType!==m.DOCUMENT_FRAGMENT);)n=`${o.tagName}[${h(o)}]/${n}`,o=o.parentNode;return a&&(n=`${e(a)},${n}`),n.replace(/\/$/,"")},D=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function a(s,c){let u,i="";try{const l=e(s);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),s=o(t);if(void 0!==s){const{bundledCss:e,unfetchedResources:n}=a(s,t);n&&(u=new Set(n)),i=`${i}${e}`}else u=new Set([t]),i=`\n${r}${t}${r}`}}catch(e){console.log(`error during getBundledCssFromCssText, styleBaseUrl=${c}`,e)}var l,d;return i=`${i}${l=s,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}},U=p,O=function(e){const t=["before","after"];try{let n=[];return t.forEach((t=>{const o=e.ownerDocument.defaultView.getComputedStyle(e,`:${t}`);o&&"none"!==o.getPropertyValue("content")&&n.push(t)})),n.join("_and_")}catch(e){return!1}},F=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then((e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")})).catch((e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")}))];return Number.isNaN(Number(t))||r.push(new Promise((e=>setTimeout(e,t))).then((()=>o.abort()))),Promise.race(r)}},I=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,a,s;if(n&&function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map((e=>e.nodeValue)).join(""),a=o;else if(n&&E(n)){const c=w(n);!function(e){return e&&e.startsWith("data:")}(c)?(a=t(c,o),r=e(a)):(a=o,r=c.match(/,(.+)/)[1]),s=void 0===r}return{cssText:r,styleBaseUrl:a,isUnfetched:s}}},k=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:a,cssText:s,isUnfetched:c}=e(o,r);let u,i="";if(s){const{bundledCss:e,unfetchedResources:n}=t(s,a);i+=e,u=new Set(n)}else c&&(i+=`${n}${a}${n}`,u=new Set([a]));return{bundledCss:i,unfetchedResources:u}}},L=function(t){return async function(n=e){const o={},r=Date.now(),a=[];return function e(n,o,r,a){function c(e){if(a.push(async function(e,n,o){let r,a;e&&S(e)&&(a=C(b(e),n),r=await t(a),void 0!==r&&(o[a]=r)),r&&await s(r,a,o)}(e,o,r)),e.nodeType===A.ELEMENT)return"IFRAME"===e.tagName.toUpperCase()?i(e):u(e)}async function u(e){Array.prototype.map.call(e.childNodes,c)}async function i(t){if(u(t),t.contentDocument)try{const n=T(t)?t.baseURI:t.contentDocument.location.href;e(t.contentDocument,n,r,a)}catch(t){console.log(t)}}c(n.documentElement)}(n,n.location.href,o,a),await Promise.all(a),console.log("[prefetchAllCss]",Date.now()-r),function(e){return o[e]};async function s(e,n,o){try{const r=N(e),a=[];for(const e of Array.from(r.cssRules))e instanceof CSSImportRule&&a.push((async()=>{const r=C(e.href,n),a=await t(r);o[r]=a,void 0!==a&&await s(a,r,o)})());await Promise.all(a)}catch(e){console.log(`error during fetchBundledCss, resourceUrl=${n}`,e)}}}},{NODE_TYPES:x,DEFAULT_STYLE_PROPS:M,DEFAULT_RECT_PROPS:V,DEFAULT_IGNORED_TAG_NAMES:B}=d;const{pollify:Y}=l,{EYES_NAMESPACE:z,DOM_CAPTURE_KEY:G}=d,j=async function({doc:t=e,styleProps:n=M,rectProps:o=V,ignoredTagNames:r=B,addStats:a=!1,fetchTimeLimit:s=3e4}={}){
4
4
  /* MARKER FOR TEST - DO NOT DELETE */
5
- arguments[1]&&(e=arguments[1]),arguments[2]&&(s=arguments[2]),arguments[3]&&(a=arguments[3]);const c={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function u(t){t.startTime=Date.now()}function i(t){t.endTime=Date.now(),t.elapsedTime=t.endTime-t.startTime}const l=[];u(c.total);const d=new Set,f=[],m="@@@@@",h="#####",p="-----";u(c.prefetchCss);const g=L(F(fetch,{fetchTimeLimit:a})),y=await g(e);i(c.prefetchCss);const w=U({parseCss:v,CSSImportRule:CSSImportRule,getCssFromCache:y,absolutizeUrl:$,unfetchedToken:h}),E=I({getCssFromCache:y,absolutizeUrl:$}),C=k({extractCssFromNode:E,getBundledCssFromCssText:w,unfetchedToken:h});u(c.doCaptureDoc);const T=function t(s,a=s.location&&s.location.href){const c=new Set;let u="";const i=h(s.documentElement||s);return i.css=u,l.push(P({bgImages:c}).then((t=>i.images=t))),i;function h(e){if(e.hasAttribute&&e.hasAttribute("data-applitools-skip"))return null;const{bundledCss:n,unfetchedResources:o}=C(e,a);if(u+=n,o)for(const t of o)d.add(t);switch(e.nodeType){case x.TEXT:return function(t){return{tagName:"#text",text:t.textContent}}(e);case x.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const n=p(e);let o;try{o=e.contentDocument}catch(e){return r(),n}try{o?n.childNodes=[t(o,_(e)?e.baseURI:o.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return n;function r(){const t=D(e);f.push(t),n.childNodes=[`${m}${t}${m}`]}}(e):p(e);case x.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,h).filter(Boolean)};default:return null}}function p(s){const u=Array.prototype.map.call(s.childNodes,h).filter(Boolean),i=s.shadowRoot&&t(s.shadowRoot,a),l=s.tagName.toUpperCase();if(r.indexOf(l)>-1)return null;const d=e.defaultView.getComputedStyle(s),f=s.getBoundingClientRect(),m={};for(const t of n)m[t]=d.getPropertyValue(t);m["border-width"]||(m["border-width"]=`${d.getPropertyValue("border-top-width")} ${d.getPropertyValue("border-right-width")} ${d.getPropertyValue("border-bottom-width")} ${d.getPropertyValue("border-left-width")}`);const p={};for(const t of o)p[t]=f[t];const g=Array.from(s.attributes).map((t=>({key:t.name,value:t.value}))).reduce(((t,e)=>(t[e.key]=e.value,t)),{}),y=R(d.getPropertyValue("background-image"));y&&c.add(y);const w=O(s);w&&(g["data-applitools-has-pseudo"]=w);const E={tagName:l,style:Y(m),rect:Y(p),attributes:Y(g),childNodes:u};return i&&(E.shadowRoot=i),E}}(e);i(c.doCaptureDoc),u(c.waitForImages),await Promise.all(l),i(c.waitForImages),T.version="1.3.0",T.scriptVersion="11.2.6";const N=f.length?`${f.join("\n")}\n`:"",b=d.size?`${Array.from(d).join("\n")}\n`:"",S=JSON.stringify({separator:p,cssStartToken:h,cssEndToken:h,iframeStartToken:`"${m}`,iframeEndToken:`${m}"`});i(c.total);const A=`${S}\n${b}${p}\n${N}${p}\n${JSON.stringify(T)}${s?`\n${p}\n${JSON.stringify(c)}`:""}`;return console.log("[captureFrame]",JSON.stringify(c)),A;function Y(t){return Object.keys(t).length?t:void 0}};window[z]=window[z]||{};const J=Y(j,window[z],G);return function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}((function(t){return JSON.stringify(J(t)(t))}))}()};let e=!0;try{let n=document.head.querySelector("[data-applitools-sandbox]");n||(n=document.createElement("iframe"),n.setAttribute("data-applitools-sandbox",""),n.setAttribute("data-applitools-skip",""),document.head.appendChild(n));const o=window.crypto.getRandomValues(new Uint32Array(1))[0],r=n.contentDocument.createElement("script");r.textContent=`window['ctor-${o}'] = ${t.toString()};`,n.contentDocument.head.appendChild(r);const s=n.contentWindow[`ctor-${o}`];if("function"!=typeof s)throw new Error("Sandbox failed to extract function");return e=!1,s(document).apply(null,arguments)}catch(n){try{return t(document).apply(null,arguments)}catch(t){throw e?t:n}}};return t(e)}();
5
+ arguments[1]&&(t=arguments[1]),arguments[2]&&(a=arguments[2]),arguments[3]&&(s=arguments[3]);const c={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function u(e){e.startTime=Date.now()}function i(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const l=[];u(c.total);const d=new Set,f=[],m="@@@@@",h="#####",p="-----";u(c.prefetchCss);const g=L(F(fetch,{fetchTimeLimit:s})),y=await g(t);i(c.prefetchCss);const w=D({parseCss:U,CSSImportRule:CSSImportRule,getCssFromCache:y,absolutizeUrl:$,unfetchedToken:h}),E=I({getCssFromCache:y,absolutizeUrl:$}),C=k({extractCssFromNode:E,getBundledCssFromCssText:w,unfetchedToken:h});u(c.doCaptureDoc);const T=function e(a,s=a.location&&a.location.href){const c=new Set;let u="";const i=h(a.documentElement||a);return i.css=u,l.push(P({bgImages:c}).then((e=>i.images=e))),i;function h(t){if(t.hasAttribute&&t.hasAttribute("data-applitools-skip"))return null;const{bundledCss:n,unfetchedResources:o}=C(t,s);if(u+=n,o)for(const e of o)d.add(e);switch(t.nodeType){case x.TEXT:return function(e){return{tagName:"#text",text:e.textContent}}(t);case x.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?function(t){const n=p(t);let o;try{o=t.contentDocument}catch(t){return r(),n}try{o?n.childNodes=[e(o,R(t)?t.baseURI:o.location.href)]:r()}catch(t){console.log("error in iframeToJSON",t)}return n;function r(){const e=v(t);f.push(e),n.childNodes=[`${m}${e}${m}`]}}(t):p(t);case x.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(t.childNodes,h).filter(Boolean)};default:return null}}function p(a){const u=Array.prototype.map.call(a.childNodes,h).filter(Boolean),i=a.shadowRoot&&e(a.shadowRoot,s),l=a.tagName.toUpperCase();if(r.indexOf(l)>-1)return null;const d=t.defaultView.getComputedStyle(a),f=a.getBoundingClientRect(),m={};for(const e of n)m[e]=d.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${d.getPropertyValue("border-top-width")} ${d.getPropertyValue("border-right-width")} ${d.getPropertyValue("border-bottom-width")} ${d.getPropertyValue("border-left-width")}`);const p={};for(const e of o)p[e]=f[e];const g=Array.from(a.attributes).map((e=>({key:e.name,value:e.value}))).reduce(((e,t)=>(e[t.key]=t.value,e)),{});"INPUT"!==l&&"TEXTAREA"!==l||!a.value||(g.value&&console.log(`[captureFrame] Overriding element attributes value from ${g.value} to ${a.value}`),g.value=a.value);const y=_(d.getPropertyValue("background-image"));y&&c.add(y);const w=O(a);w&&(g["data-applitools-has-pseudo"]=w);const E={tagName:l,style:Y(m),rect:Y(p),attributes:Y(g),childNodes:u};return i&&(E.shadowRoot=i),E}}(t);i(c.doCaptureDoc),u(c.waitForImages),await Promise.all(l),i(c.waitForImages),T.version="1.3.0",T.scriptVersion="11.2.8";const N=f.length?`${f.join("\n")}\n`:"",b=d.size?`${Array.from(d).join("\n")}\n`:"",S=JSON.stringify({separator:p,cssStartToken:h,cssEndToken:h,iframeStartToken:`"${m}`,iframeEndToken:`${m}"`});i(c.total);const A=`${S}\n${b}${p}\n${N}${p}\n${JSON.stringify(T)}${a?`\n${p}\n${JSON.stringify(c)}`:""}`;return console.log("[captureFrame]",JSON.stringify(c)),A;function Y(e){return Object.keys(e).length?e:void 0}};window[z]=window[z]||{};const J=Y(j,window[z],G);return function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((function(e){return JSON.stringify(J(e)(e))}))}()};let t=!0;try{let n=document.head.querySelector("[data-applitools-sandbox]");n||(n=document.createElement("iframe"),n.setAttribute("data-applitools-sandbox",""),n.setAttribute("data-applitools-skip",""),document.head.appendChild(n));const o=window.crypto.getRandomValues(new Uint32Array(1))[0],r=n.contentDocument.createElement("script");r.textContent=`window['ctor-${o}'] = ${e.toString()};`,n.contentDocument.head.appendChild(r);const a=n.contentWindow[`ctor-${o}`];if("function"!=typeof a)throw new Error("Sandbox failed to extract function");return t=!1,a(document).apply(null,arguments)}catch(n){try{return e(document).apply(null,arguments)}catch(e){throw t?e:n}}};return e(t)}();
6
6
 
7
7
  return captureDomPoll.apply(this, arguments);
8
8
  }
@@ -1,4 +1,4 @@
1
- /* @applitools/dom-capture@11.2.6 */
2
- "use strict";function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e=function(){const t=function(t){return function(){function e(t,e=0){const n=t.charCodeAt(e);return n>=55296&&n<56320?1024*(n-55296)+(t.charCodeAt(e+1)-56320)+65536:56320<=n&&n<=57343?-1:n}var n=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const o=n,r="WIP",s="SUCCESS",a="SUCCESS_CHUNKED",c="ERROR";var u=function(t,e,n={}){const u=function(t,{chunkByteLength:e=0}={}){if(t){if(t.value){if(e){if(!t.chunks)try{const n=JSON.stringify(t.value);t.chunks=o(n,e),t.chunks.length>0&&(t.from=0,t.value=n)}catch(t){return{status:c,error:t.message}}if(t.from>=0)return{status:a,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:s,value:t.value}}return t.error?{status:c,error:t.error}:{status:r}}return{status:c,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],n);return(u.status===s||u.status===c||u.status===a&&u.done)&&(t[e]=null),u};const i=u;var l={chunkify:n,pollify:function(t,e,n){return o=>function(){return e[n]||(e[n]={},Promise.resolve().then((()=>t.apply(null,arguments))).then((t=>e[n].value=t)).catch((t=>e[n].error=t.message))),i(e,n,o)}},poll:u,absolutizeUrl:function(t,e){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let n=!0;try{n=t!==decodeURI(t)}catch(t){n=!0}try{const o=new URL(t,e).href;return n?o:decodeURI(o)}catch(e){return n?t:decodeURI(t)}},isInlineFrame:function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)},isAccessibleFrame:function(t){try{const e=t.contentDocument;return Boolean(e&&e.defaultView&&e.defaultView.frameElement)}catch(t){return!1}}},d={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","font-family","line-height","margin","opacity","overflow","padding","visibility","text-align","position","border-radius","z-index"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const f=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;const{NODE_TYPES:m}=d;function h(t){return Array.prototype.filter.call(t.parentNode.childNodes,(e=>e.tagName===t.tagName)).indexOf(t)+1}var p=function(e){var n=t.implementation.createHTMLDocument(""),o=n.createElement("style");return o.textContent=e,n.body.appendChild(o),o.sheet},g=function(t){const e=Array.from(t.attributes).find((t=>"href"===t.name.toLowerCase()));return e&&e.value},y=function(t){if(t.nodeName&&"LINK"===t.nodeName.toUpperCase()&&t.attributes){const e=new Map(Array.from(t.attributes,(t=>[t.name.toLowerCase(),t.value.toLowerCase()])));return"stylesheet"===e.get("rel")||"style"===e.get("as")&&["preload","prefetch"].includes(e.get("rel"))}return!1};const w=g,E=y;const{absolutizeUrl:C,isInlineFrame:T}=l,N=p,b=g,S=y,{NODE_TYPES:A}=d;const{absolutizeUrl:$,isInlineFrame:_}=l,R=function(t){const e=t?t.match(f):void 0;return e?e[1]:e},P=async function({bgImages:t,timeout:e=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(t).map((t=>{return Promise.race([new Promise((e=>{const o=new n;o.onload=()=>e({url:t,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>e(),o.src=t})),(o=e,new Promise((t=>{setTimeout(t,o)})))]);var o})))).reduce(((t,e)=>(e&&(t[e.url]={width:e.width,height:e.height}),t)),{})},D=function t(e){if(!e.ownerDocument)return"";let n="",o=e,r=e.ownerDocument,s=r.defaultView.frameElement;for(;o!==r&&(!o||o.nodeType!==m.DOCUMENT_FRAGMENT);)n=`${o.tagName}[${h(o)}]/${n}`,o=o.parentNode;return s&&(n=`${t(s)},${n}`),n.replace(/\/$/,"")},U=function({parseCss:t,CSSImportRule:e,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let u,i="";try{const l=t(a);for(const t of Array.from(l.cssRules))if(t instanceof e){const e=n(t.href,c),a=o(e);if(void 0!==a){const{bundledCss:t,unfetchedResources:n}=s(a,e);n&&(u=new Set(n)),i=`${i}${t}`}else u=new Set([e]),i=`\n${r}${e}${r}`}}catch(t){console.log(`error during getBundledCssFromCssText, styleBaseUrl=${c}`,t)}var l,d;return i=`${i}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}},O=p,v=function(t){const e=["before","after"];try{let n=[];return e.forEach((e=>{const o=t.ownerDocument.defaultView.getComputedStyle(t,`:${e}`);o&&"none"!==o.getPropertyValue("content")&&n.push(e)})),n.join("_and_")}catch(t){return!1}},F=function(t,{fetchTimeLimit:e}={}){return async function(n){const o=new AbortController,r=[t(n,{cache:"force-cache",signal:o.signal}).then((t=>{if(t.ok)return t.text();console.log("/failed to fetch (status "+t.status+") css from: "+n+"/")})).catch((t=>{console.log("/failed to fetch (error "+t.toString()+") css from: "+n+"/")}))];return Number.isNaN(Number(e))||r.push(new Promise((t=>setTimeout(t,e))).then((()=>o.abort()))),Promise.race(r)}},I=function({getCssFromCache:t,absolutizeUrl:e}){return function(n,o){let r,s,a;if(n&&function(t){return t.nodeName&&"STYLE"===t.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map((t=>t.nodeValue)).join(""),s=o;else if(n&&E(n)){const c=w(n);!function(t){return t&&t.startsWith("data:")}(c)?(s=e(c,o),r=t(s)):(s=o,r=c.match(/,(.+)/)[1]),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}},k=function({extractCssFromNode:t,getBundledCssFromCssText:e,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=t(o,r);let u,i="";if(a){const{bundledCss:t,unfetchedResources:n}=e(a,s);i+=t,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},L=function(e){return async function(n=t){const o={},r=Date.now(),s=[];return function t(n,o,r,s){function c(t){if(s.push(async function(t,n,o){let r,s;t&&S(t)&&(s=C(b(t),n),r=await e(s),void 0!==r&&(o[s]=r)),r&&await a(r,s,o)}(t,o,r)),t.nodeType===A.ELEMENT)return"IFRAME"===t.tagName.toUpperCase()?i(t):u(t)}async function u(t){Array.prototype.map.call(t.childNodes,c)}async function i(e){if(u(e),e.contentDocument)try{const n=T(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}c(n.documentElement)}(n,n.location.href,o,s),await Promise.all(s),console.log("[prefetchAllCss]",Date.now()-r),function(t){return o[t]};async function a(t,n,o){try{const r=N(t),s=[];for(const t of Array.from(r.cssRules))t instanceof CSSImportRule&&s.push((async()=>{const r=C(t.href,n),s=await e(r);o[r]=s,void 0!==s&&await a(s,r,o)})());await Promise.all(s)}catch(t){console.log(`error during fetchBundledCss, resourceUrl=${n}`,t)}}}},{NODE_TYPES:x,DEFAULT_STYLE_PROPS:M,DEFAULT_RECT_PROPS:V,DEFAULT_IGNORED_TAG_NAMES:B}=d;const{pollify:Y}=l,{EYES_NAMESPACE:z,DOM_CAPTURE_KEY:G}=d,j=async function({doc:e=t,styleProps:n=M,rectProps:o=V,ignoredTagNames:r=B,addStats:s=!1,fetchTimeLimit:a=3e4}={}){
1
+ /* @applitools/dom-capture@11.2.8 */
2
+ "use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t=function(){const e=function(e){return function(){function t(e,t=0){const n=e.charCodeAt(t);return n>=55296&&n<56320?1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536:56320<=n&&n<=57343?-1:n}var n=function(e,n){const o=[];let r=0;for(let s=0;s<e.length;++s){const a=t(e,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const o=n,r="WIP",s="SUCCESS",a="SUCCESS_CHUNKED",c="ERROR";var u=function(e,t,n={}){const u=function(e,{chunkByteLength:t=0}={}){if(e){if(e.value){if(t){if(!e.chunks)try{const n=JSON.stringify(e.value);e.chunks=o(n,t),e.chunks.length>0&&(e.from=0,e.value=n)}catch(e){return{status:c,error:e.message}}if(e.from>=0)return{status:a,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:s,value:e.value}}return e.error?{status:c,error:e.error}:{status:r}}return{status:c,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[t],n);return(u.status===s||u.status===c||u.status===a&&u.done)&&(e[t]=null),u};const i=u;var l={chunkify:n,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},Promise.resolve().then((()=>e.apply(null,arguments))).then((e=>t[n].value=e)).catch((e=>t[n].error=e.message))),i(t,n,o)}},poll:u,absolutizeUrl:function(e,t){if(function(e){try{return new URL(e),!0}catch(e){return!1}}(e))return e;let n=!0;try{n=e!==decodeURI(e)}catch(e){n=!0}try{const o=new URL(e,t).href;return n?o:decodeURI(o)}catch(t){return n?e:decodeURI(e)}},isInlineFrame:function(e){return e.contentDocument&&e.contentDocument.location&&!/^https?:$/.test(e.contentDocument.location.protocol)},isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}},d={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","font-family","line-height","margin","opacity","overflow","padding","visibility","text-align","position","border-radius","z-index"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const f=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;const{NODE_TYPES:m}=d;function h(e){return Array.prototype.filter.call(e.parentNode.childNodes,(t=>t.tagName===e.tagName)).indexOf(e)+1}var p=function(t){var n=e.implementation.createHTMLDocument(""),o=n.createElement("style");return o.textContent=t,n.body.appendChild(o),o.sheet},g=function(e){const t=Array.from(e.attributes).find((e=>"href"===e.name.toLowerCase()));return t&&t.value},y=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,(e=>[e.name.toLowerCase(),e.value.toLowerCase()])));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};const w=g,E=y;const{absolutizeUrl:C,isInlineFrame:T}=l,N=p,b=g,S=y,{NODE_TYPES:A}=d;const{absolutizeUrl:$,isInlineFrame:R}=l,_=function(e){const t=e?e.match(f):void 0;return t?t[1]:t},P=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map((e=>{return Promise.race([new Promise((t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e})),(o=t,new Promise((e=>{setTimeout(e,o)})))]);var o})))).reduce(((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e)),{})},U=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r&&(!o||o.nodeType!==m.DOCUMENT_FRAGMENT);)n=`${o.tagName}[${h(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")},v=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${i}${e}`}else u=new Set([t]),i=`\n${r}${t}${r}`}}catch(e){console.log(`error during getBundledCssFromCssText, styleBaseUrl=${c}`,e)}var l,d;return i=`${i}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}},D=p,O=function(e){const t=["before","after"];try{let n=[];return t.forEach((t=>{const o=e.ownerDocument.defaultView.getComputedStyle(e,`:${t}`);o&&"none"!==o.getPropertyValue("content")&&n.push(t)})),n.join("_and_")}catch(e){return!1}},F=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then((e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")})).catch((e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")}))];return Number.isNaN(Number(t))||r.push(new Promise((e=>setTimeout(e,t))).then((()=>o.abort()))),Promise.race(r)}},I=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(n&&function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map((e=>e.nodeValue)).join(""),s=o;else if(n&&E(n)){const c=w(n);!function(e){return e&&e.startsWith("data:")}(c)?(s=t(c,o),r=e(s)):(s=o,r=c.match(/,(.+)/)[1]),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}},k=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},L=function(t){return async function(n=e){const o={},r=Date.now(),s=[];return function e(n,o,r,s){function c(e){if(s.push(async function(e,n,o){let r,s;e&&S(e)&&(s=C(b(e),n),r=await t(s),void 0!==r&&(o[s]=r)),r&&await a(r,s,o)}(e,o,r)),e.nodeType===A.ELEMENT)return"IFRAME"===e.tagName.toUpperCase()?i(e):u(e)}async function u(e){Array.prototype.map.call(e.childNodes,c)}async function i(t){if(u(t),t.contentDocument)try{const n=T(t)?t.baseURI:t.contentDocument.location.href;e(t.contentDocument,n,r,s)}catch(t){console.log(t)}}c(n.documentElement)}(n,n.location.href,o,s),await Promise.all(s),console.log("[prefetchAllCss]",Date.now()-r),function(e){return o[e]};async function a(e,n,o){try{const r=N(e),s=[];for(const e of Array.from(r.cssRules))e instanceof CSSImportRule&&s.push((async()=>{const r=C(e.href,n),s=await t(r);o[r]=s,void 0!==s&&await a(s,r,o)})());await Promise.all(s)}catch(e){console.log(`error during fetchBundledCss, resourceUrl=${n}`,e)}}}},{NODE_TYPES:x,DEFAULT_STYLE_PROPS:M,DEFAULT_RECT_PROPS:V,DEFAULT_IGNORED_TAG_NAMES:B}=d;const{pollify:Y}=l,{EYES_NAMESPACE:z,DOM_CAPTURE_KEY:G}=d,j=async function({doc:t=e,styleProps:n=M,rectProps:o=V,ignoredTagNames:r=B,addStats:s=!1,fetchTimeLimit:a=3e4}={}){
3
3
  /* MARKER FOR TEST - DO NOT DELETE */
4
- arguments[1]&&(e=arguments[1]),arguments[2]&&(s=arguments[2]),arguments[3]&&(a=arguments[3]);const c={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function u(t){t.startTime=Date.now()}function i(t){t.endTime=Date.now(),t.elapsedTime=t.endTime-t.startTime}const l=[];u(c.total);const d=new Set,f=[],m="@@@@@",h="#####",p="-----";u(c.prefetchCss);const g=L(F(fetch,{fetchTimeLimit:a})),y=await g(e);i(c.prefetchCss);const w=U({parseCss:O,CSSImportRule:CSSImportRule,getCssFromCache:y,absolutizeUrl:$,unfetchedToken:h}),E=I({getCssFromCache:y,absolutizeUrl:$}),C=k({extractCssFromNode:E,getBundledCssFromCssText:w,unfetchedToken:h});u(c.doCaptureDoc);const T=function t(s,a=s.location&&s.location.href){const c=new Set;let u="";const i=h(s.documentElement||s);return i.css=u,l.push(P({bgImages:c}).then((t=>i.images=t))),i;function h(e){if(e.hasAttribute&&e.hasAttribute("data-applitools-skip"))return null;const{bundledCss:n,unfetchedResources:o}=C(e,a);if(u+=n,o)for(const t of o)d.add(t);switch(e.nodeType){case x.TEXT:return function(t){return{tagName:"#text",text:t.textContent}}(e);case x.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const n=p(e);let o;try{o=e.contentDocument}catch(e){return r(),n}try{o?n.childNodes=[t(o,_(e)?e.baseURI:o.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return n;function r(){const t=D(e);f.push(t),n.childNodes=[`${m}${t}${m}`]}}(e):p(e);case x.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,h).filter(Boolean)};default:return null}}function p(s){const u=Array.prototype.map.call(s.childNodes,h).filter(Boolean),i=s.shadowRoot&&t(s.shadowRoot,a),l=s.tagName.toUpperCase();if(r.indexOf(l)>-1)return null;const d=e.defaultView.getComputedStyle(s),f=s.getBoundingClientRect(),m={};for(const t of n)m[t]=d.getPropertyValue(t);m["border-width"]||(m["border-width"]=`${d.getPropertyValue("border-top-width")} ${d.getPropertyValue("border-right-width")} ${d.getPropertyValue("border-bottom-width")} ${d.getPropertyValue("border-left-width")}`);const p={};for(const t of o)p[t]=f[t];const g=Array.from(s.attributes).map((t=>({key:t.name,value:t.value}))).reduce(((t,e)=>(t[e.key]=e.value,t)),{}),y=R(d.getPropertyValue("background-image"));y&&c.add(y);const w=v(s);w&&(g["data-applitools-has-pseudo"]=w);const E={tagName:l,style:Y(m),rect:Y(p),attributes:Y(g),childNodes:u};return i&&(E.shadowRoot=i),E}}(e);i(c.doCaptureDoc),u(c.waitForImages),await Promise.all(l),i(c.waitForImages),T.version="1.3.0",T.scriptVersion="11.2.6";const N=f.length?`${f.join("\n")}\n`:"",b=d.size?`${Array.from(d).join("\n")}\n`:"",S=JSON.stringify({separator:p,cssStartToken:h,cssEndToken:h,iframeStartToken:`"${m}`,iframeEndToken:`${m}"`});i(c.total);const A=`${S}\n${b}${p}\n${N}${p}\n${JSON.stringify(T)}${s?`\n${p}\n${JSON.stringify(c)}`:""}`;return console.log("[captureFrame]",JSON.stringify(c)),A;function Y(t){return Object.keys(t).length?t:void 0}};window[z]=window[z]||{};const J=Y(j,window[z],G);return function(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}((function(t){return JSON.stringify(J(t)(t))}))}()};let e=!0;try{let n=document.head.querySelector("[data-applitools-sandbox]");n||(n=document.createElement("iframe"),n.setAttribute("data-applitools-sandbox",""),n.setAttribute("data-applitools-skip",""),document.head.appendChild(n));const o=window.crypto.getRandomValues(new Uint32Array(1))[0],r=n.contentDocument.createElement("script");r.textContent=`window['ctor-${o}'] = ${t.toString()};`,n.contentDocument.head.appendChild(r);const s=n.contentWindow[`ctor-${o}`];if("function"!=typeof s)throw new Error("Sandbox failed to extract function");return e=!1,s(document).apply(null,arguments)}catch(n){try{return t(document).apply(null,arguments)}catch(t){throw e?t:n}}},n=t(e);module.exports=n;
4
+ arguments[1]&&(t=arguments[1]),arguments[2]&&(s=arguments[2]),arguments[3]&&(a=arguments[3]);const c={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function u(e){e.startTime=Date.now()}function i(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const l=[];u(c.total);const d=new Set,f=[],m="@@@@@",h="#####",p="-----";u(c.prefetchCss);const g=L(F(fetch,{fetchTimeLimit:a})),y=await g(t);i(c.prefetchCss);const w=v({parseCss:D,CSSImportRule:CSSImportRule,getCssFromCache:y,absolutizeUrl:$,unfetchedToken:h}),E=I({getCssFromCache:y,absolutizeUrl:$}),C=k({extractCssFromNode:E,getBundledCssFromCssText:w,unfetchedToken:h});u(c.doCaptureDoc);const T=function e(s,a=s.location&&s.location.href){const c=new Set;let u="";const i=h(s.documentElement||s);return i.css=u,l.push(P({bgImages:c}).then((e=>i.images=e))),i;function h(t){if(t.hasAttribute&&t.hasAttribute("data-applitools-skip"))return null;const{bundledCss:n,unfetchedResources:o}=C(t,a);if(u+=n,o)for(const e of o)d.add(e);switch(t.nodeType){case x.TEXT:return function(e){return{tagName:"#text",text:e.textContent}}(t);case x.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?function(t){const n=p(t);let o;try{o=t.contentDocument}catch(t){return r(),n}try{o?n.childNodes=[e(o,R(t)?t.baseURI:o.location.href)]:r()}catch(t){console.log("error in iframeToJSON",t)}return n;function r(){const e=U(t);f.push(e),n.childNodes=[`${m}${e}${m}`]}}(t):p(t);case x.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(t.childNodes,h).filter(Boolean)};default:return null}}function p(s){const u=Array.prototype.map.call(s.childNodes,h).filter(Boolean),i=s.shadowRoot&&e(s.shadowRoot,a),l=s.tagName.toUpperCase();if(r.indexOf(l)>-1)return null;const d=t.defaultView.getComputedStyle(s),f=s.getBoundingClientRect(),m={};for(const e of n)m[e]=d.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${d.getPropertyValue("border-top-width")} ${d.getPropertyValue("border-right-width")} ${d.getPropertyValue("border-bottom-width")} ${d.getPropertyValue("border-left-width")}`);const p={};for(const e of o)p[e]=f[e];const g=Array.from(s.attributes).map((e=>({key:e.name,value:e.value}))).reduce(((e,t)=>(e[t.key]=t.value,e)),{});"INPUT"!==l&&"TEXTAREA"!==l||!s.value||(g.value&&console.log(`[captureFrame] Overriding element attributes value from ${g.value} to ${s.value}`),g.value=s.value);const y=_(d.getPropertyValue("background-image"));y&&c.add(y);const w=O(s);w&&(g["data-applitools-has-pseudo"]=w);const E={tagName:l,style:Y(m),rect:Y(p),attributes:Y(g),childNodes:u};return i&&(E.shadowRoot=i),E}}(t);i(c.doCaptureDoc),u(c.waitForImages),await Promise.all(l),i(c.waitForImages),T.version="1.3.0",T.scriptVersion="11.2.8";const N=f.length?`${f.join("\n")}\n`:"",b=d.size?`${Array.from(d).join("\n")}\n`:"",S=JSON.stringify({separator:p,cssStartToken:h,cssEndToken:h,iframeStartToken:`"${m}`,iframeEndToken:`${m}"`});i(c.total);const A=`${S}\n${b}${p}\n${N}${p}\n${JSON.stringify(T)}${s?`\n${p}\n${JSON.stringify(c)}`:""}`;return console.log("[captureFrame]",JSON.stringify(c)),A;function Y(e){return Object.keys(e).length?e:void 0}};window[z]=window[z]||{};const J=Y(j,window[z],G);return function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((function(e){return JSON.stringify(J(e)(e))}))}()};let t=!0;try{let n=document.head.querySelector("[data-applitools-sandbox]");n||(n=document.createElement("iframe"),n.setAttribute("data-applitools-sandbox",""),n.setAttribute("data-applitools-skip",""),document.head.appendChild(n));const o=window.crypto.getRandomValues(new Uint32Array(1))[0],r=n.contentDocument.createElement("script");r.textContent=`window['ctor-${o}'] = ${e.toString()};`,n.contentDocument.head.appendChild(r);const s=n.contentWindow[`ctor-${o}`];if("function"!=typeof s)throw new Error("Sandbox failed to extract function");return t=!1,s(document).apply(null,arguments)}catch(n){try{return e(document).apply(null,arguments)}catch(e){throw t?e:n}}},n=e(t);module.exports=n;