@applitools/dom-snapshot 4.18.7 → 4.18.9

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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,62 @@
9
9
  - fix style programmatic generated fallback
10
10
  - performance boost
11
11
 
12
+ ## [4.18.9](https://github.com/Applitools-Dev/sdk/compare/js/dom-snapshot@4.18.8...js/dom-snapshot@4.18.9) (2026-11-04)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * keep the value of the all shorthand on Chrome 148+ | AD-17608 ([#4408](https://github.com/Applitools-Dev/sdk/issues/4408)) ([4488308](https://github.com/Applitools-Dev/sdk/commit/448830893cd605150ac046bd874555feea95b006))
18
+
19
+
20
+ ### Dependencies
21
+
22
+ * @applitools/logger bumped to 2.3.3
23
+ #### Bug Fixes
24
+
25
+ * ignore empty and non-string mask values | AD-17629 ([#4403](https://github.com/Applitools-Dev/sdk/issues/4403)) ([01cdbf1](https://github.com/Applitools-Dev/sdk/commit/01cdbf15f562044636783401e341bda581927589))
26
+ * @applitools/driver bumped to 1.26.15
27
+
28
+ * @applitools/spec-driver-webdriver bumped to 1.6.15
29
+
30
+ * @applitools/spec-driver-puppeteer bumped to 1.8.15
31
+
32
+ * @applitools/test-server bumped to 1.4.9
33
+
34
+
35
+ ## [4.18.8](https://github.com/Applitools-Dev/sdk/compare/js/dom-snapshot@4.18.7...js/dom-snapshot@4.18.8) (2026-10-29)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * recreate the sandbox iframe when the page removed it | AD-17409 ([0a0b184](https://github.com/Applitools-Dev/sdk/commit/0a0b1841dd4bad2e597d47688f469716fa7b1748))
41
+
42
+
43
+ ### Performance Improvements
44
+
45
+ * ship the largest style elements as css resources | FLD-4733 ([#4334](https://github.com/Applitools-Dev/sdk/issues/4334)) ([8d407ae](https://github.com/Applitools-Dev/sdk/commit/8d407ae5804364e1de2c50abb08413f403f53823))
46
+
47
+
48
+ ### Dependencies
49
+
50
+ * @applitools/dom-shared bumped to 1.2.5
51
+ #### Bug Fixes
52
+
53
+ * recreate the sandbox iframe when the page removed it | AD-17409 ([0a0b184](https://github.com/Applitools-Dev/sdk/commit/0a0b1841dd4bad2e597d47688f469716fa7b1748))
54
+ * @applitools/driver bumped to 1.26.14
55
+ #### Bug Fixes
56
+
57
+ * recreate the sandbox iframe when the page removed it | AD-17409 ([0a0b184](https://github.com/Applitools-Dev/sdk/commit/0a0b1841dd4bad2e597d47688f469716fa7b1748))
58
+
59
+
60
+
61
+ * @applitools/snippets bumped to 2.9.10
62
+
63
+ * @applitools/spec-driver-webdriver bumped to 1.6.14
64
+
65
+ * @applitools/spec-driver-puppeteer bumped to 1.8.14
66
+
67
+
12
68
  ## [4.18.7](https://github.com/Applitools-Dev/sdk/compare/js/dom-snapshot@4.18.6...js/dom-snapshot@4.18.7) (2026-10-25)
13
69
 
14
70
 
package/README.md CHANGED
@@ -283,6 +283,7 @@ Status could be one of:
283
283
  - "ERROR" - there's an `error` field with the result
284
284
  - "WIP" - internal status, handled by `pollResult` to continue polling until "SUCCESS" or "ERROR" are received.
285
285
  - "SUCCESS_CHUNKED" - internal status, handled by `pollResult` to continue polling until the entire value is received (used with `chunkByteLength`).
286
+ - "STATE_LOST" - the page removed the sandbox iframe and the pending work died with it. Rerun the main script once; if it is lost again, treat it as an error.
286
287
 
287
288
  ## `pollResult`
288
289
 
@@ -6,3 +6,4 @@ import type { CDTNode, CrossFrame } from '../types';
6
6
  * Call after every pass that mutates nodes. Relies on the CDT being post-order.
7
7
  */
8
8
  export declare function dedupeCdt(cdt: CDTNode[], crossFrames: CrossFrame[]): void;
9
+ export declare function removeHoles(cdt: CDTNode[], crossFrames: CrossFrame[]): void;
@@ -0,0 +1,10 @@
1
+ import type { CDTNode, CrossFrame, InlineStyle, BlobResult } from '../types';
2
+ declare function extractStyleResources(cdt: CDTNode[], inlineStyles: InlineStyle[], crossFrames: CrossFrame[], baseUrl: string, limits: {
3
+ maxCount?: number | null;
4
+ minLength?: number | null;
5
+ }, { compress, serialize, dependenciesOf, }: {
6
+ compress?: boolean;
7
+ serialize?: boolean;
8
+ dependenciesOf: (sheet: CSSStyleSheet) => string[];
9
+ }): BlobResult[];
10
+ export default extractStyleResources;
@@ -17,6 +17,11 @@ export interface ProcessPageOptions {
17
17
  elements?: HTMLElement[][];
18
18
  /** Kill switch for AD-15243. Remove once CDT dedup has ridden a release without incident. */
19
19
  skipCDTDedup?: boolean;
20
+ skipExternalizeStyles?: boolean;
21
+ externalizeStyles?: {
22
+ maxCount?: number;
23
+ minLength?: number;
24
+ };
20
25
  }
21
26
  export interface ProcessPageResult {
22
27
  cdt: any[];
@@ -33,5 +38,5 @@ export interface ProcessPageResult {
33
38
  errors?: string[];
34
39
  scriptVersion?: string;
35
40
  }
36
- declare function processPage({ doc, showLogs, useSessionCache, dontFetchResources, fetchTimeout, fetchConcurrency, skipResources, skipRootHtmlResource, compressResources, serializeResources, removeReverseProxyURLPrefixes, skipDataUriExtraction, elements, skipCDTDedup, }?: ProcessPageOptions): Promise<ProcessPageResult>;
41
+ declare function processPage({ doc, showLogs, useSessionCache, dontFetchResources, fetchTimeout, fetchConcurrency, skipResources, skipRootHtmlResource, compressResources, serializeResources, removeReverseProxyURLPrefixes, skipDataUriExtraction, elements, skipCDTDedup, skipExternalizeStyles, externalizeStyles, }?: ProcessPageOptions): Promise<ProcessPageResult>;
37
42
  export default processPage;
@@ -1,6 +1,6 @@
1
- /* @applitools/dom-snapshot@4.18.7 */
1
+ /* @applitools/dom-snapshot@4.18.9 */
2
2
  function __pollResult() {
3
- var pollResult=function(){"use strict";return function(...t){const n=function(t,n,e){return function(){var t={};function r(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var o=function(t,n){const e=[];let o=0;for(let c=0;c<t.length;++c){const i=r(t,c);let u=0;i>0&&(u=i<128?1:i<2048?2:i<65536?3:i<2097152?4:i<67108864?5:6),o+u>n?(e.push(c),o=u):o+=u}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(o),i="WIP",u="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR";var l=function(t,e,r={}){const o=function(t,{chunkByteLength:e=0}={}){var r;if(t){if(t.value){if(e){if(!t.chunks)try{const o=void 0!==n?null===(r=n.__EYES__APPLITOOLS__)||void 0===r?void 0:r._stringify:void 0,i=(null!=o?o:JSON.stringify)(t.value);t.chunks=(0,c.default)(i,e),t.chunks.length>0&&(t.from=0,t.value=i)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:u,value:t.value}}return t.error?{status:a,error:t.error}:{status:i}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],r);return(o.status===u||o.status===a||o.status===s&&o.done)&&delete t[e],o};const f=l;var d=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=m=t.poll=t.pollify=t.chunkify=void 0;const _=d(o);t.chunkify=_.default;const h=d((function(t,n,e){return r=>function(...o){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...o))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),f(n,e,r)}}));t.pollify=h.default;const y=d(l);var m=t.poll=y.default;const p=d((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const r=new URL(t,n).href;return e?r:decodeURI(r)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=p.default;const w=d((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=w.default;const S=d((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=S.default,function(t){var n;const r=e.__EYES__APPLITOOLS__,o=null!==(n=null==r?void 0:r._stringify)&&void 0!==n?n:JSON.stringify;try{return o(m(r,"domSnapshotResult",t))}catch(t){return o({status:"ERROR",error:t.message})}}}()};let e=!0;if("undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.id)return n(document,window,window)(...t);try{let r=window.__applitools_sandbox;r||(r=document.createElement("iframe"),r.setAttribute("data-applitools-sandbox",""),r.setAttribute("data-applitools-skip",""),document.head.appendChild(r),window.__applitools_sandbox=r);const o=Math.floor(4294967296*Math.random()),c=r.contentDocument.createElement("script");c.textContent="window['ctor-"+o+"'] = "+n.toString()+";",r.contentDocument.head.appendChild(c);const i=r.contentWindow["ctor-"+o];if(delete r.contentWindow["ctor-"+o],"function"!=typeof i)throw new Error("Sandbox failed to extract function");e=!1;const u=r.contentWindow,s=u.__EYES__APPLITOOLS__=u.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=u.JSON.stringify.bind(u.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(u.Array.isArray(t)){const n=new u.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new u.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=u.JSON.stringify.bind(u.JSON));const f=new u.Array(t.length);for(let d=0;d<t.length;d++)f[d]=l(t[d]);return i(document,window,u)(...f)}catch(_){try{return n(document,window,window)(...t)}catch(h){throw e?h:_}}}}();
3
+ var pollResult=function(){"use strict";return function(...t){const n=function(t,n,e){return function(){var t={};function o(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var r=function(t,n){const e=[];let r=0;for(let c=0;c<t.length;++c){const u=o(t,c);let i=0;u>0&&(i=u<128?1:u<2048?2:u<65536?3:u<2097152?4:u<67108864?5:6),r+i>n?(e.push(c),r=i):r+=i}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(r),u="WIP",i="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR",l="STATE_LOST";var f=function(t,e,o={}){const r=function(t,{chunkByteLength:e=0}={}){var o;if(t){if(t.status===l)return{status:l};if(t.value){if(e){if(!t.chunks)try{const r=void 0!==n?null===(o=n.__EYES__APPLITOOLS__)||void 0===o?void 0:o._stringify:void 0,u=(null!=r?r:JSON.stringify)(t.value);t.chunks=(0,c.default)(u,e),t.chunks.length>0&&(t.from=0,t.value=u)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:i,value:t.value}}return t.error?{status:a,error:t.error}:{status:u}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],o);return(r.status===i||r.status===a||r.status===l||r.status===s&&r.done)&&delete t[e],r};const d=f;var _=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=p=t.poll=t.pollify=t.chunkify=void 0;const h=_(r);t.chunkify=h.default;const y=_((function(t,n,e){return o=>function(...r){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...r))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),d(n,e,o)}}));t.pollify=y.default;const m=_(f);var p=t.poll=m.default;const w=_((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const o=new URL(t,n).href;return e?o:decodeURI(o)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=w.default;const S=_((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=S.default;const O=_((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=O.default,function(t){var n;const o=e.__EYES__APPLITOOLS__,r=null!==(n=null==o?void 0:o._stringify)&&void 0!==n?n:JSON.stringify;try{return r(p(o,"domSnapshotResult",t))}catch(t){return r({status:"ERROR",error:t.message})}}}()};let e=!0;if("undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.id)return n(document,window,window)(...t);try{let o=window.__applitools_sandbox;if(o&&!o.contentDocument){const d=window.__EYES__APPLITOOLS__||{};for(const _ in d){const h=d[_];!h||"object"!=typeof h||"value"in h||"error"in h||(d[_]={status:"STATE_LOST"})}o=null}o||(o=document.createElement("iframe"),o.setAttribute("data-applitools-sandbox",""),o.setAttribute("data-applitools-skip",""),document.head.appendChild(o),window.__applitools_sandbox=o);const r=Math.floor(4294967296*Math.random()),c=o.contentDocument.createElement("script");c.textContent="window['ctor-"+r+"'] = "+n.toString()+";",o.contentDocument.head.appendChild(c);const u=o.contentWindow["ctor-"+r];if(delete o.contentWindow["ctor-"+r],"function"!=typeof u)throw new Error("Sandbox failed to extract function");e=!1;const i=o.contentWindow,s=i.__EYES__APPLITOOLS__=i.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=i.JSON.stringify.bind(i.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(i.Array.isArray(t)){const n=new i.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new i.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=i.JSON.stringify.bind(i.JSON));const f=new i.Array(t.length);for(let y=0;y<t.length;y++)f[y]=l(t[y]);return u(document,window,i)(...f)}catch(m){try{return n(document,window,window)(...t)}catch(p){throw e?p:m}}}}();
4
4
  //# sourceMappingURL=pollResult.js.map
5
5
 
6
6
  return pollResult.apply(this, arguments);
@@ -1 +1 @@
1
- {"version":3,"file":"pollResult.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","_a","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"gDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,MACK,EACZA,EAAO,QACK,EACZA,EAAO,SACK,EAEA,GAErBI,EAAsBE,EAAiBJ,GACvCC,EAAOI,KAAKR,GACZK,EAAsBE,GAGtBF,GAAuBE,CAE9B,CACD,OAAOH,CACX,ECxCA,MAAMF,EAHkD,SAAUO,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,CACmBG,CAAgBC,GAC7BC,EAAW,CACbC,IAAK,MACLC,QAAS,UACTC,gBAAiB,kBACjBC,MAAO,SA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,EAAWS,QAC9B,MAAMkC,EAAYjC,EAAgBsE,GAClCN,EAAAI,QAAkBnC,EAAUlC,QAC5B,MAAMQ,EAASP,EAAgBuE,GAC/B,IAAAvC,EAAAgC,EAAAhC,KAAezB,EAAOR,QACtB,MAAM2C,EAAkB1C,EAAgBwE,GACxCR,EAAAG,cAAwBzB,EAAgB3C,QACxC,MAAMoD,EAAkBnD,EAAgByE,GACxCT,EAAAE,cAAwBf,EAAgBpD,QACxC,MAAM0D,EAAsBzD,EAAgB0E,GACnBV,EAAAC,kBAAGR,EAAoB1D,eCVlC,SAAWW,SACvB,MAAMiE,EAASC,YAA0B,qBACnC1D,EAA+B,QAAlBL,EAAA8D,aAAM,EAANA,EAAQzD,kBAAU,IAAAL,EAAAA,EAAIQ,KAAKC,UAC9C,IACE,OAAOJ,EAAWc,EAAK2C,ECVK,oBDUqBjE,GAClD,CAAC,MAAO8B,GACP,OAAOtB,EAAW,CAChBO,OAAQ,QACRC,MAAOc,EAAIb,SAEd,CACH"}
1
+ {"version":3,"file":"pollResult.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n STATE_LOST: 'STATE_LOST',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.status === STATUSES.STATE_LOST) {\n return { status: STATUSES.STATE_LOST };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n result.status === STATUSES.STATE_LOST ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","STATE_LOST","poll_1","context","key","options","result","state","_a","status","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"gDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAW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AAN,EAAAA,EAAIS,KAAKC,UAC9C,IACE,OAAOJ,EAAWa,EAAK2C,ECVK,oBDUqBjE,GAClD,CAAC,MAAO8B,GACP,OAAOrB,EAAW,CAChBL,OAAQ,QACRY,MAAOc,EAAIb,SAEd,CACH"}
@@ -1,3 +1,3 @@
1
- /* @applitools/dom-snapshot@4.18.7 */
2
- "use strict";module.exports=function(...t){const n=function(t,n,e){return function(){var t={};function r(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var o=function(t,n){const e=[];let o=0;for(let c=0;c<t.length;++c){const i=r(t,c);let u=0;i>0&&(u=i<128?1:i<2048?2:i<65536?3:i<2097152?4:i<67108864?5:6),o+u>n?(e.push(c),o=u):o+=u}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(o),i="WIP",u="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR";var l=function(t,e,r={}){const o=function(t,{chunkByteLength:e=0}={}){var r;if(t){if(t.value){if(e){if(!t.chunks)try{const o=void 0!==n?null===(r=n.__EYES__APPLITOOLS__)||void 0===r?void 0:r._stringify:void 0,i=(null!=o?o:JSON.stringify)(t.value);t.chunks=(0,c.default)(i,e),t.chunks.length>0&&(t.from=0,t.value=i)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:u,value:t.value}}return t.error?{status:a,error:t.error}:{status:i}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],r);return(o.status===u||o.status===a||o.status===s&&o.done)&&delete t[e],o};const f=l;var d=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=y=t.poll=t.pollify=t.chunkify=void 0;const _=d(o);t.chunkify=_.default;const h=d((function(t,n,e){return r=>function(...o){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...o))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),f(n,e,r)}}));t.pollify=h.default;const m=d(l);var y=t.poll=m.default;const p=d((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const r=new URL(t,n).href;return e?r:decodeURI(r)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=p.default;const w=d((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=w.default;const S=d((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=S.default,function(t){var n;const r=e.__EYES__APPLITOOLS__,o=null!==(n=null==r?void 0:r._stringify)&&void 0!==n?n:JSON.stringify;try{return o(y(r,"domSnapshotResult",t))}catch(t){return o({status:"ERROR",error:t.message})}}}()};let e=!0;if("undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.id)return n(document,window,window)(...t);try{let r=window.__applitools_sandbox;r||(r=document.createElement("iframe"),r.setAttribute("data-applitools-sandbox",""),r.setAttribute("data-applitools-skip",""),document.head.appendChild(r),window.__applitools_sandbox=r);const o=Math.floor(4294967296*Math.random()),c=r.contentDocument.createElement("script");c.textContent="window['ctor-"+o+"'] = "+n.toString()+";",r.contentDocument.head.appendChild(c);const i=r.contentWindow["ctor-"+o];if(delete r.contentWindow["ctor-"+o],"function"!=typeof i)throw new Error("Sandbox failed to extract function");e=!1;const u=r.contentWindow,s=u.__EYES__APPLITOOLS__=u.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=u.JSON.stringify.bind(u.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(u.Array.isArray(t)){const n=new u.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new u.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=u.JSON.stringify.bind(u.JSON));const f=new u.Array(t.length);for(let d=0;d<t.length;d++)f[d]=l(t[d]);return i(document,window,u)(...f)}catch(_){try{return n(document,window,window)(...t)}catch(h){throw e?h:_}}};
1
+ /* @applitools/dom-snapshot@4.18.9 */
2
+ "use strict";module.exports=function(...t){const n=function(t,n,e){return function(){var t={};function o(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var r=function(t,n){const e=[];let r=0;for(let c=0;c<t.length;++c){const u=o(t,c);let i=0;u>0&&(i=u<128?1:u<2048?2:u<65536?3:u<2097152?4:u<67108864?5:6),r+i>n?(e.push(c),r=i):r+=i}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(r),u="WIP",i="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR",l="STATE_LOST";var f=function(t,e,o={}){const r=function(t,{chunkByteLength:e=0}={}){var o;if(t){if(t.status===l)return{status:l};if(t.value){if(e){if(!t.chunks)try{const r=void 0!==n?null===(o=n.__EYES__APPLITOOLS__)||void 0===o?void 0:o._stringify:void 0,u=(null!=r?r:JSON.stringify)(t.value);t.chunks=(0,c.default)(u,e),t.chunks.length>0&&(t.from=0,t.value=u)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:i,value:t.value}}return t.error?{status:a,error:t.error}:{status:u}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],o);return(r.status===i||r.status===a||r.status===l||r.status===s&&r.done)&&delete t[e],r};const d=f;var _=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=p=t.poll=t.pollify=t.chunkify=void 0;const h=_(r);t.chunkify=h.default;const m=_((function(t,n,e){return o=>function(...r){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...r))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),d(n,e,o)}}));t.pollify=m.default;const y=_(f);var p=t.poll=y.default;const w=_((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const o=new URL(t,n).href;return e?o:decodeURI(o)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=w.default;const S=_((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=S.default;const O=_((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=O.default,function(t){var n;const o=e.__EYES__APPLITOOLS__,r=null!==(n=null==o?void 0:o._stringify)&&void 0!==n?n:JSON.stringify;try{return r(p(o,"domSnapshotResult",t))}catch(t){return r({status:"ERROR",error:t.message})}}}()};let e=!0;if("undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.id)return n(document,window,window)(...t);try{let o=window.__applitools_sandbox;if(o&&!o.contentDocument){const d=window.__EYES__APPLITOOLS__||{};for(const _ in d){const h=d[_];!h||"object"!=typeof h||"value"in h||"error"in h||(d[_]={status:"STATE_LOST"})}o=null}o||(o=document.createElement("iframe"),o.setAttribute("data-applitools-sandbox",""),o.setAttribute("data-applitools-skip",""),document.head.appendChild(o),window.__applitools_sandbox=o);const r=Math.floor(4294967296*Math.random()),c=o.contentDocument.createElement("script");c.textContent="window['ctor-"+r+"'] = "+n.toString()+";",o.contentDocument.head.appendChild(c);const u=o.contentWindow["ctor-"+r];if(delete o.contentWindow["ctor-"+r],"function"!=typeof u)throw new Error("Sandbox failed to extract function");e=!1;const i=o.contentWindow,s=i.__EYES__APPLITOOLS__=i.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=i.JSON.stringify.bind(i.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(i.Array.isArray(t)){const n=new i.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new i.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=i.JSON.stringify.bind(i.JSON));const f=new i.Array(t.length);for(let m=0;m<t.length;m++)f[m]=l(t[m]);return u(document,window,i)(...f)}catch(y){try{return n(document,window,window)(...t)}catch(p){throw e?p:y}}};
3
3
  //# sourceMappingURL=pollResultCjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pollResultCjs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","_a","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"mDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EA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AAC,EATA,SAA2BL,GACvB,IACI,MAAMM,EAAMN,EAAMC,gBAClB,OAAOM,QAAQD,GAAOA,EAAIE,aAAeF,EAAIE,YAAYC,aAC5D,CACD,MAAOrB,GACH,OAAO,CACV,CACL,ECRIxC,EAAoD,SAAUH,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,EACAiE,OAAOC,eAAeC,EAAS,aAAc,CAAElD,OAAO,IACtDkD,EAAAC,kBAA4BD,EAAAE,cAAwBF,EAAAG,cAAwBnC,EAAAgC,EAAAhC,KAAegC,EAAAI,QAAkBJ,EAAAK,cAAmB,EAChI,MAAM/E,EAAaU,EAAgBC,GACnC+D,EAAAK,SAAmB/E,EAAWS,QAC9B,MAAMkC,EAAYjC,EAAgBsE,GAClCN,EAAAI,QAAkBnC,EAAUlC,QAC5B,MAAMQ,EAASP,EAAgBuE,GAC/B,IAAAvC,EAAAgC,EAAAhC,KAAezB,EAAOR,QACtB,MAAM2C,EAAkB1C,EAAgBwE,GACxCR,EAAAG,cAAwBzB,EAAgB3C,QACxC,MAAMoD,EAAkBnD,EAAgByE,GACxCT,EAAAE,cAAwBf,EAAgBpD,QACxC,MAAM0D,EAAsBzD,EAAgB0E,GACnBV,EAAAC,kBAAGR,EAAoB1D,eCVlC,SAAWW,SACvB,MAAMiE,EAASC,YAA0B,qBACnC1D,EAA+B,QAAlBL,EAAA8D,aAAM,EAANA,EAAQzD,kBAAU,IAAAL,EAAAA,EAAIQ,KAAKC,UAC9C,IACE,OAAOJ,EAAWc,EAAK2C,ECVK,oBDUqBjE,GAClD,CAAC,MAAO8B,GACP,OAAOtB,EAAW,CAChBO,OAAQ,QACRC,MAAOc,EAAIb,SAEd,CACH"}
1
+ {"version":3,"file":"pollResultCjs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n STATE_LOST: 'STATE_LOST',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.status === STATUSES.STATE_LOST) {\n return { status: STATUSES.STATE_LOST };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n result.status === STATUSES.STATE_LOST ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","STATE_LOST","poll_1","context","key","options","result","state","_a","status","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"mDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,MACK,EACZA,EAAO,QACK,EACZA,EAAO,SACK,EAEA,GAErBI,EAAsBE,EAAiBJ,GACvCC,EAAOI,KAAKR,GACZK,EAAsBE,GAGtBF,GAAuBE,CAE9B,CACD,OAAOH,CACX,ECxCA,MAAMF,EAHkD,SAAUO,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,CACmBG,CAAgBC,GAC7BC,EAAW,CACbC,IAAK,MACLC,QAAS,UACTC,gBAAiB,kBACjBC,MAAO,QACPC,WAAY,cA0DhB,IAAAC,EAXA,SAAcC,EAASC,EAAKC,EAAU,CAAA,GAElC,MAAMC,EA9CV,SAA4BC,GAAOtB,gBAAEA,EAAkB,GA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AWS,QAC9B,MAAMmC,EAAYlC,EAAgBuE,GAClCN,EAAAI,QAAkBnC,EAAUnC,QAC5B,MAAMS,EAASR,EAAgBwE,GAC/B,IAAAvC,EAAAgC,EAAAhC,KAAezB,EAAOT,QACtB,MAAM4C,EAAkB3C,EAAgByE,GACxCR,EAAAG,cAAwBzB,EAAgB5C,QACxC,MAAMqD,EAAkBpD,EAAgB0E,GACxCT,EAAAE,cAAwBf,EAAgBrD,QACxC,MAAM2D,EAAsB1D,EAAgB2E,GACnBV,EAAAC,kBAAGR,EAAoB3D,eCVlC,SAAWY,SACvB,MAAMiE,EAASC,YAA0B,qBACnCzD,EAA+B,QAAlBN,EAAA8D,aAAM,EAANA,EAAQxD,kBAAU,IAAAN,EAAAA,EAAIS,KAAKC,UAC9C,IACE,OAAOJ,EAAWa,EAAK2C,ECVK,oBDUqBjE,GAClD,CAAC,MAAO8B,GACP,OAAOrB,EAAW,CAChBL,OAAQ,QACRY,MAAOc,EAAIb,SAEd,CACH"}
@@ -1,3 +1,3 @@
1
- /* @applitools/dom-snapshot@4.18.7 */
2
- function t(...t){const n=function(t,n,e){return function(){var t={};function r(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var o=function(t,n){const e=[];let o=0;for(let c=0;c<t.length;++c){const i=r(t,c);let u=0;i>0&&(u=i<128?1:i<2048?2:i<65536?3:i<2097152?4:i<67108864?5:6),o+u>n?(e.push(c),o=u):o+=u}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(o),i="WIP",u="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR";var l=function(t,e,r={}){const o=function(t,{chunkByteLength:e=0}={}){var r;if(t){if(t.value){if(e){if(!t.chunks)try{const o=void 0!==n?null===(r=n.__EYES__APPLITOOLS__)||void 0===r?void 0:r._stringify:void 0,i=(null!=o?o:JSON.stringify)(t.value);t.chunks=(0,c.default)(i,e),t.chunks.length>0&&(t.from=0,t.value=i)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:u,value:t.value}}return t.error?{status:a,error:t.error}:{status:i}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],r);return(o.status===u||o.status===a||o.status===s&&o.done)&&delete t[e],o};const f=l;var d=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=m=t.poll=t.pollify=t.chunkify=void 0;const _=d(o);t.chunkify=_.default;const h=d((function(t,n,e){return r=>function(...o){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...o))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),f(n,e,r)}}));t.pollify=h.default;const y=d(l);var m=t.poll=y.default;const p=d((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const r=new URL(t,n).href;return e?r:decodeURI(r)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=p.default;const w=d((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=w.default;const S=d((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=S.default,function(t){var n;const r=e.__EYES__APPLITOOLS__,o=null!==(n=null==r?void 0:r._stringify)&&void 0!==n?n:JSON.stringify;try{return o(m(r,"domSnapshotResult",t))}catch(t){return o({status:"ERROR",error:t.message})}}}()};let e=!0;if("undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.id)return n(document,window,window)(...t);try{let r=window.__applitools_sandbox;r||(r=document.createElement("iframe"),r.setAttribute("data-applitools-sandbox",""),r.setAttribute("data-applitools-skip",""),document.head.appendChild(r),window.__applitools_sandbox=r);const o=Math.floor(4294967296*Math.random()),c=r.contentDocument.createElement("script");c.textContent="window['ctor-"+o+"'] = "+n.toString()+";",r.contentDocument.head.appendChild(c);const i=r.contentWindow["ctor-"+o];if(delete r.contentWindow["ctor-"+o],"function"!=typeof i)throw new Error("Sandbox failed to extract function");e=!1;const u=r.contentWindow,s=u.__EYES__APPLITOOLS__=u.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=u.JSON.stringify.bind(u.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(u.Array.isArray(t)){const n=new u.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new u.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=u.JSON.stringify.bind(u.JSON));const f=new u.Array(t.length);for(let d=0;d<t.length;d++)f[d]=l(t[d]);return i(document,window,u)(...f)}catch(_){try{return n(document,window,window)(...t)}catch(h){throw e?h:_}}}export{t as default};
1
+ /* @applitools/dom-snapshot@4.18.9 */
2
+ function t(...t){const n=function(t,n,e){return function(){var t={};function o(t,n=0){const e=t.charCodeAt(n);return e>=55296&&e<56320?1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536:56320<=e&&e<=57343?-1:e}var r=function(t,n){const e=[];let r=0;for(let c=0;c<t.length;++c){const u=o(t,c);let i=0;u>0&&(i=u<128?1:u<2048?2:u<65536?3:u<2097152?4:u<67108864?5:6),r+i>n?(e.push(c),r=i):r+=i}return e};const c=function(t){return t&&t.__esModule?t:{default:t}}(r),u="WIP",i="SUCCESS",s="SUCCESS_CHUNKED",a="ERROR",l="STATE_LOST";var f=function(t,e,o={}){const r=function(t,{chunkByteLength:e=0}={}){var o;if(t){if(t.status===l)return{status:l};if(t.value){if(e){if(!t.chunks)try{const r=void 0!==n?null===(o=n.__EYES__APPLITOOLS__)||void 0===o?void 0:o._stringify:void 0,u=(null!=r?r:JSON.stringify)(t.value);t.chunks=(0,c.default)(u,e),t.chunks.length>0&&(t.from=0,t.value=u)}catch(t){return{status:a,error:t.message}}if(t.from>=0)return{status:s,value:t.value.substring(t.from,t.from=t.chunks.shift()),done:!t.from}}return{status:i,value:t.value}}return t.error?{status:a,error:t.error}:{status:u}}return{status:a,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[e],o);return(r.status===i||r.status===a||r.status===l||r.status===s&&r.done)&&delete t[e],r};const d=f;var _=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAccessibleFrame=t.isInlineFrame=t.absolutizeUrl=p=t.poll=t.pollify=t.chunkify=void 0;const h=_(r);t.chunkify=h.default;const y=_((function(t,n,e){return o=>function(...r){return n[e]||(n[e]={},Promise.resolve().then((()=>t(...r))).then((t=>n[e].value=t)).catch((t=>n[e].error=t.message+"\nStack:"+t.stack))),d(n,e,o)}}));t.pollify=y.default;const m=_(f);var p=t.poll=m.default;const w=_((function(t,n){if(function(t){try{return new URL(t),!0}catch(t){return!1}}(t))return t;let e=!0;try{e=t!==decodeURI(t)}catch(t){e=!0}try{const o=new URL(t,n).href;return e?o:decodeURI(o)}catch(n){return e?t:decodeURI(t)}}));t.absolutizeUrl=w.default;const S=_((function(t){return t.contentDocument&&t.contentDocument.location&&!/^https?:$/.test(t.contentDocument.location.protocol)}));t.isInlineFrame=S.default;const O=_((function(t){try{const n=t.contentDocument;return Boolean(n&&n.defaultView&&n.defaultView.frameElement)}catch(t){return!1}}));return t.isAccessibleFrame=O.default,function(t){var n;const o=e.__EYES__APPLITOOLS__,r=null!==(n=null==o?void 0:o._stringify)&&void 0!==n?n:JSON.stringify;try{return r(p(o,"domSnapshotResult",t))}catch(t){return r({status:"ERROR",error:t.message})}}}()};let e=!0;if("undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.id)return n(document,window,window)(...t);try{let o=window.__applitools_sandbox;if(o&&!o.contentDocument){const d=window.__EYES__APPLITOOLS__||{};for(const _ in d){const h=d[_];!h||"object"!=typeof h||"value"in h||"error"in h||(d[_]={status:"STATE_LOST"})}o=null}o||(o=document.createElement("iframe"),o.setAttribute("data-applitools-sandbox",""),o.setAttribute("data-applitools-skip",""),document.head.appendChild(o),window.__applitools_sandbox=o);const r=Math.floor(4294967296*Math.random()),c=o.contentDocument.createElement("script");c.textContent="window['ctor-"+r+"'] = "+n.toString()+";",o.contentDocument.head.appendChild(c);const u=o.contentWindow["ctor-"+r];if(delete o.contentWindow["ctor-"+r],"function"!=typeof u)throw new Error("Sandbox failed to extract function");e=!1;const i=o.contentWindow,s=i.__EYES__APPLITOOLS__=i.__EYES__APPLITOOLS__||{};s._stringify||(s._stringify=i.JSON.stringify.bind(i.JSON));const a=window.__EYES__APPLITOOLS__=window.__EYES__APPLITOOLS__||{};function l(t){if(i.Array.isArray(t)){const n=new i.Array(t.length);for(let e=0;e<t.length;e++)n[e]=l(t[e]);return n}if(t&&"object"==typeof t&&Object.getPrototypeOf(t)===Object.prototype){const n=new i.Object;for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=l(t[e]));return n}return t}a._stringify&&a._stringify!==JSON.stringify||(a._stringify=i.JSON.stringify.bind(i.JSON));const f=new i.Array(t.length);for(let y=0;y<t.length;y++)f[y]=l(t[y]);return u(document,window,i)(...f)}catch(m){try{return n(document,window,window)(...t)}catch(p){throw e?p:m}}}export{t as default};
3
3
  //# sourceMappingURL=pollResultEs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pollResultEs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","poll_1","context","key","options","result","state","_a","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","status","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"kDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,MACK,EACZA,EAAO,QACK,EACZA,EAAO,SACK,EAEA,GAErBI,EAAsBE,EAAiBJ,GACvCC,EAAOI,KAAKR,GACZK,EAAsBE,GAGtBF,GAAuBE,CAE9B,CACD,OAAOH,CACX,ECxCA,MAAMF,EAHkD,SAAUO,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAEE,QAAWF,EACxD,CACmBG,CAAgBC,GAC7BC,EAAW,CACbC,IAAK,MACLC,QAAS,UACTC,gBAAiB,kBACjBC,MAAO,SAsDX,IAAAC,EAVA,SAAcC,EAASC,EAAKC,EAAU,CAAA,GAElC,MAAMC,EA3CV,SAA4BC,GAAOrB,gBAAEA,EAAkB,GAAM,IACzD,IAAIsB,EACJ,GAAKD,EAMA,IAAIA,EAAME,MAAO,CAClB,GAAIvB,EAAiB,CACjB,IAAKqB,EAAMpB,OACP,IACI,MAAMuB,EAAqC,oBAAXC,OAAgE,QAAtCH,EAAKG,OAAOC,4BAAyC,IAAPJ,OAAgB,EAASA,EAAGK,gBAAaC,EAC3IC,GAAeL,QAA2DA,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,EAAoB1D,eCVlC,SAAWW,SACvB,MAAMiE,EAASC,YAA0B,qBACnC1D,EAA+B,QAAlBL,EAAA8D,aAAM,EAANA,EAAQzD,kBAAU,IAAAL,EAAAA,EAAIQ,KAAKC,UAC9C,IACE,OAAOJ,EAAWc,EAAK2C,ECVK,oBDUqBjE,GAClD,CAAC,MAAO8B,GACP,OAAOtB,EAAW,CAChBO,OAAQ,QACRC,MAAOc,EAAIb,SAEd,CACH"}
1
+ {"version":3,"file":"pollResultEs.js","sources":["../../dom-shared/dist/chunkify.js","../../dom-shared/dist/poll.js","../../dom-shared/dist/pollify.js","../../dom-shared/dist/browser/absolutizeUrl.js","../../dom-shared/dist/browser/isInlineFrame.js","../../dom-shared/dist/browser/isAccessibleFrame.js","../../dom-shared/dist/index.js","../src/browser/pollResult.ts","../src/browser/constants.ts"],"sourcesContent":["\"use strict\";\nfunction charCodeAt(string, index = 0) {\n const code = string.charCodeAt(index);\n // if the code of high word (16 bits) in this diapason the character encoded by two words\n if (code >= 0xd800 && code < 0xdc00) {\n const high = code;\n const low = string.charCodeAt(index + 1);\n // convert 2 utf16le words into integer code\n return (high - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;\n }\n // diapason is reserved for surrogates, we can skip it\n if (0xdc00 <= code && code <= 0xdfff)\n return -1;\n return code;\n}\nfunction chunkify(string, chunkByteLength) {\n const chunks = [];\n let currChunkByteLength = 0;\n for (let index = 0; index < string.length; ++index) {\n const code = charCodeAt(string, index);\n let charByteLength = 0;\n if (code > 0) {\n if (code < 128)\n charByteLength = 1;\n else if (code < 2048)\n charByteLength = 2;\n else if (code < 65536)\n charByteLength = 3;\n else if (code < 2097152)\n charByteLength = 4;\n else if (code < 67108864)\n charByteLength = 5;\n else\n charByteLength = 6;\n }\n if (currChunkByteLength + charByteLength > chunkByteLength) {\n chunks.push(index);\n currChunkByteLength = charByteLength;\n }\n else {\n currChunkByteLength += charByteLength;\n }\n }\n return chunks;\n}\nmodule.exports = chunkify;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nconst STATUSES = {\n WIP: 'WIP',\n SUCCESS: 'SUCCESS',\n SUCCESS_CHUNKED: 'SUCCESS_CHUNKED',\n ERROR: 'ERROR',\n STATE_LOST: 'STATE_LOST',\n};\nconst _DEFAULT_CHUNK_BYTE_LENGTH = 268435456; // 256MB\nfunction createPollResponse(state, { chunkByteLength = 0 } = {}) {\n var _a;\n if (!state) {\n return {\n status: STATUSES.ERROR,\n error: 'unexpected poll request received - cannot find state of current operation',\n };\n }\n else if (state.status === STATUSES.STATE_LOST) {\n return { status: STATUSES.STATE_LOST };\n }\n else if (state.value) {\n if (chunkByteLength) {\n if (!state.chunks) {\n try {\n const _nativeStringify = typeof window !== 'undefined' ? (_a = window.__EYES__APPLITOOLS__) === null || _a === void 0 ? void 0 : _a._stringify : undefined;\n const stringified = (_nativeStringify !== null && _nativeStringify !== void 0 ? _nativeStringify : JSON.stringify)(state.value);\n state.chunks = (0, chunkify_1.default)(stringified, chunkByteLength);\n if (state.chunks.length > 0) {\n state.from = 0;\n state.value = stringified;\n }\n }\n catch (e) {\n return { status: STATUSES.ERROR, error: e.message };\n }\n }\n if (state.from >= 0) {\n return {\n status: STATUSES.SUCCESS_CHUNKED,\n value: state.value.substring(state.from, (state.from = state.chunks.shift())),\n done: !state.from,\n };\n }\n }\n return { status: STATUSES.SUCCESS, value: state.value };\n }\n else if (state.error) {\n return { status: STATUSES.ERROR, error: state.error };\n }\n else {\n return { status: STATUSES.WIP };\n }\n}\nfunction poll(context, key, options = {}) {\n context = context || {};\n const result = createPollResponse(context[key], options);\n if (result.status === STATUSES.SUCCESS ||\n result.status === STATUSES.ERROR ||\n result.status === STATUSES.STATE_LOST ||\n (result.status === STATUSES.SUCCESS_CHUNKED && result.done)) {\n delete context[key];\n }\n return result;\n}\nmodule.exports = poll;\n","\"use strict\";\nconst poll = require(\"./poll\");\nfunction pollify(script, context, key) {\n return (options) => function (...args) {\n if (!context[key]) {\n context[key] = {};\n Promise.resolve()\n .then(() => script(...args))\n .then(value => (context[key].value = value))\n .catch(err => (context[key].error = err.message + '\\nStack:' + err.stack));\n }\n return poll(context, key, options);\n };\n}\nmodule.exports = pollify;\n","\"use strict\";\nfunction isAbsoluteUrl(url) {\n try {\n new URL(url);\n return true;\n }\n catch (err) {\n return false;\n }\n}\nfunction absolutizeUrl(url, baseUrl) {\n if (isAbsoluteUrl(url))\n return url;\n let isEncoded = true;\n try {\n isEncoded = url !== decodeURI(url);\n }\n catch (err) {\n isEncoded = true;\n }\n try {\n const absoluteUrl = new URL(url, baseUrl).href;\n return !isEncoded ? decodeURI(absoluteUrl) : absoluteUrl;\n }\n catch (err) {\n return !isEncoded ? decodeURI(url) : url;\n }\n}\nmodule.exports = absolutizeUrl;\n","\"use strict\";\nfunction isInlineFrame(frame) {\n return (frame.contentDocument &&\n frame.contentDocument.location &&\n !/^https?:$/.test(frame.contentDocument.location.protocol));\n}\nmodule.exports = isInlineFrame;\n","\"use strict\";\nfunction isAccessibleFrame(frame) {\n try {\n const doc = frame.contentDocument;\n return Boolean(doc && doc.defaultView && doc.defaultView.frameElement);\n }\n catch (err) {\n return false;\n }\n}\nmodule.exports = isAccessibleFrame;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAccessibleFrame = exports.isInlineFrame = exports.absolutizeUrl = exports.poll = exports.pollify = exports.chunkify = void 0;\nconst chunkify_1 = __importDefault(require(\"./chunkify\"));\nexports.chunkify = chunkify_1.default;\nconst pollify_1 = __importDefault(require(\"./pollify\"));\nexports.pollify = pollify_1.default;\nconst poll_1 = __importDefault(require(\"./poll\"));\nexports.poll = poll_1.default;\nconst absolutizeUrl_1 = __importDefault(require(\"./browser/absolutizeUrl\"));\nexports.absolutizeUrl = absolutizeUrl_1.default;\nconst isInlineFrame_1 = __importDefault(require(\"./browser/isInlineFrame\"));\nexports.isInlineFrame = isInlineFrame_1.default;\nconst isAccessibleFrame_1 = __importDefault(require(\"./browser/isAccessibleFrame\"));\nexports.isAccessibleFrame = isAccessibleFrame_1.default;\n",null,null],"names":["charCodeAt","string","index","code","chunkify_1","chunkByteLength","chunks","currChunkByteLength","length","charByteLength","push","mod","__esModule","default","__importDefault","require$$0","STATUSES","WIP","SUCCESS","SUCCESS_CHUNKED","ERROR","STATE_LOST","poll_1","context","key","options","result","state","_a","status","value","_nativeStringify","window","__EYES__APPLITOOLS__","_stringify","undefined","stringified","JSON","stringify","from","e","error","message","substring","shift","done","createPollResponse","poll","pollify_1","script","args","Promise","resolve","then","catch","err","stack","absolutizeUrl_1","url","baseUrl","URL","isAbsoluteUrl","isEncoded","decodeURI","absoluteUrl","href","isInlineFrame_1","frame","contentDocument","location","test","protocol","isAccessibleFrame_1","doc","Boolean","defaultView","frameElement","Object","defineProperty","dist","isAccessibleFrame","isInlineFrame","absolutizeUrl","pollify","chunkify","require$$1","require$$2","require$$3","require$$4","require$$5","eyesNs","cleanWindow"],"mappings":"kDACA,SAASA,EAAWC,EAAQC,EAAQ,GAChC,MAAMC,EAAOF,EAAOD,WAAWE,GAE/B,GAAIC,GAAQ,OAAUA,EAAO,MAAQ,CAIjC,OAAyB,MAHZA,EAGE,QAFHF,EAAOD,WAAWE,EAAQ,GAEE,OAAU,KACrD,CAED,OAAI,OAAUC,GAAQA,GAAQ,OAClB,EACLA,CACX,CA+BA,IAAAC,EA9BA,SAAkBH,EAAQI,GACtB,MAAMC,EAAS,GACf,IAAIC,EAAsB,EAC1B,IAAK,IAAIL,EAAQ,EAAGA,EAAQD,EAAOO,SAAUN,EAAO,CAChD,MAAMC,EAAOH,EAAWC,EAAQC,GAChC,IAAIO,EAAiB,EACjBN,EAAO,IAEHM,EADAN,EAAO,IACU,EACZA,EAAO,KACK,EACZA,EAAO,M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