UNPKG

nstbrowser-sdk-node

Version:
63 lines 1.78 MB
"use strict";var A=require("axios"),e=require("fs/promises"),t=require("os"),i=require("path"),r=require("child_process"),s=require("fs"),o=require("readline"),n=require("http"),g=require("https"),a=require("url"),I=require("net"),C=require("tty"),B=require("util"),E=require("tls"),Q=require("crypto"),c=require("events"),u=require("assert"),l=require("buffer"),h=require("stream"),d=require("dns"),D=require("constants"),p=require("zlib");require("process");var f="undefined"!=typeof document?document.currentScript:null;function w(A){var e=Object.create(null);return A&&Object.keys(A).forEach((function(t){if("default"!==t){var i=Object.getOwnPropertyDescriptor(A,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:function(){return A[t]}})}})),e.default=A,Object.freeze(e)}var y=w(n),m=w(g);const F=A.create();async function S(A){try{return(await F.request(A)).data}catch(A){return A?.response?.data}}function k(A){return{getProfilesStatus:async function(){const e=await async function(A){return await S({url:A.baseUrl+"/browser/profiles/status",method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A);return e},forceStart:async function(e){const t=await async function(A,e){const t=A.baseUrl+`/browser/force_start/${e}`;return await S({url:t,method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},start:async function(e){const t=await async function(A,e){const t=A.baseUrl+`/browser/start/${e}`;return await S({url:t,method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},startSome:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+"/browser/startSome",method:"post",timeout:A.timeout,headers:{"x-api-key":A.apiKey},data:e})}(A,e);return t},stop:async function(e){const t=await async function(A,e){const t=A.baseUrl+`/browser/stop/${e}`;return await S({url:t,method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},stopSome:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+"/browser/stopSome",method:"post",timeout:A.timeout,headers:{"x-api-key":A.apiKey},data:e})}(A,e);return t},stopAll:async function(){const e=await async function(A){return await S({url:A.baseUrl+"/browser/stopAll",method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A);return e},getRunningBrowser:async function(){const e=await async function(A){return await S({url:A.baseUrl+"/browser/running",method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A);return e},getRunningBrowserAll:async function(){const e=await async function(A){return await S({url:A.baseUrl+"/browser/runningAll",method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A);return e},getRemoteDebuggingAddress:async function(e){const t=await async function(A,e){const t=A.baseUrl+`/browser/devtool/${e}`;return await S({url:t,method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t}}}function R(A){return{profiles:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+"/profile/list",method:"get",params:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},createProfile:async function(e){const t=await async function(A,e){const t=A.baseUrl+"/profile";return await S({url:t,method:"post",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},deleteProfile:async function(e){const t=await async function(A,e){const t=A.baseUrl+`/profile/${e}`;return await S({url:t,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchUpdateProxy:async function(e){const t=await async function(A,e){const t=A.baseUrl+"/profile/proxy/batch";return await S({url:t,method:"put",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},getProfileTags:async function(){const e=await async function(A){return await S({url:A.baseUrl+"/profile/tags",method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A);return e},batchUpdateProfileTags:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+"/profile/tags/batch",method:"put",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchCreateProfileTags:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+"/profile/tags/batch",method:"post",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchClearProfileTags:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+"/profile/tags/batch",method:"delete",data:{profileIds:e},timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},clearCookies:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+`/cookie/clear/${e}`,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},clearProfileCache:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+`/agent/cache/profile/${e}`,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchClearProfileCache:async function(e){const t=await async function(A,e){return await S({url:A.baseUrl+"/agent/cache/profile/batch",method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey},data:e})}(A,e);return t}}}function M(A){return{launchNewBrowser:function(e){const t=async function(A,e){return await S({url:A.baseUrl+"/devtool/launch",method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey},params:{config:e}})}(A,e);return t},launchExistBrowser:function(e,t){const i=async function(A,e,t){return await S({url:A.baseUrl+`/devtool/launch/${e}`,method:"get",params:{config:t?.config},timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e,t);return i}}}function b(A){return{startBrowser:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers/${e}`;return await S({url:t,method:"post",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},startBrowsers:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers`;return await S({url:t,method:"post",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},startOnceBrowser:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers/once`;return await S({url:t,method:"post",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},stopBrowser:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers/${e}`;return await S({url:t,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},stopBrowsers:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers`;return await S({url:t,method:"delete",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},getBrowsers:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers`;return await S({url:t,method:"get",params:e?{status:e}:void 0,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},getBrowserPages:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers/${e}/pages`;return await S({url:t,method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},getBrowserDebugger:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/browsers/${e}/debugger`;return await S({url:t,method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t}}}function N(A){return{updateProfileProxy:async function(e,t){const i=await async function(A,e,t){const i=`${A.baseUrl}/profiles/${e}/proxy`;return await S({url:i,method:"put",data:t,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e,t);return i},resetProfileProxy:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/${e}/proxy`;return await S({url:t,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},createProfileTags:async function(e,t){const i=await async function(A,e,t){const i=`${A.baseUrl}/profiles/${e}/tags`;return await S({url:i,method:"post",data:t,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e,t);return i},updateProfileTags:async function(e,t){const i=await async function(A,e,t){const i=`${A.baseUrl}/profiles/${e}/tags`;return await S({url:i,method:"put",data:t,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e,t);return i},clearProfileTags:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/${e}/tags`;return await S({url:t,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchUpdateProxy:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/proxy/batch`;return await S({url:t,method:"put",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchResetProfileProxy:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/proxy/batch`;return await S({url:t,method:"delete",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchCreateProfileTags:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/tags/batch`;return await S({url:t,method:"post",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchUpdateProfileTags:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/tags/batch`;return await S({url:t,method:"put",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},batchClearProfileTags:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/tags/batch`;return await S({url:t,method:"delete",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},createProfile:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles`;return await S({url:t,method:"post",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},deleteProfile:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/${e}`;return await S({url:t,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},deleteProfiles:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles`;return await S({url:t,method:"delete",data:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},getProfiles:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles`;return await S({url:t,method:"get",params:e,timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},getProfileTags:async function(){const e=await async function(A){const e=`${A.baseUrl}/profiles/tags`;return await S({url:e,method:"get",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A);return e},getAllProfileGroups:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/groups`;return await S({url:t,method:"get",params:{groupName:e},timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},changeProfileGroup:async function(e,t){const i=await async function(A,e,t){const i=`${A.baseUrl}/profiles/${e}/group`;return await S({url:i,method:"put",timeout:A.timeout,data:{groupId:t},headers:{"x-api-key":A.apiKey}})}(A,e,t);return i},batchChangeProfileGroup:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/profiles/group/batch`;return await S({url:t,method:"put",timeout:A.timeout,data:e,headers:{"x-api-key":A.apiKey}})}(A,e);return t}}}function G(A){return{connectBrowser:async function(e,t){const i=await async function(A,e,t){const i=`${A.baseUrl}/connect/${e}`;return await S({url:i,method:"get",params:{config:t},timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e,t);return i},connectOnceBrowser:async function(e){const t=await async function(A,e){const t=`${A.baseUrl}/connect`;return await S({url:t,method:"get",params:{config:e},timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t}}}function v(A){return{clearProfileCache:function(e){const t=async function(A,e){const t=`${A.baseUrl}/local/profiles/${e}`;return await S({url:t,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t},clearProfileCookies:function(e){const t=async function(A,e){const t=`${A.baseUrl}/local/profiles/${e}/cookies`;return await S({url:t,method:"delete",timeout:A.timeout,headers:{"x-api-key":A.apiKey}})}(A,e);return t}}}F.interceptors.response.use((function(A){return A}),(function(A){return Promise.reject(A)}));var U=function(A,e){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,e){A.__proto__=e}||function(A,e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(A[t]=e[t])},U(A,e)};function L(A,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=A}U(A,e),A.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)}function x(A,e,t,i){return new(t||(t=Promise))((function(r,s){function o(A){try{g(i.next(A))}catch(A){s(A)}}function n(A){try{g(i.throw(A))}catch(A){s(A)}}function g(A){var e;A.done?r(A.value):(e=A.value,e instanceof t?e:new t((function(A){A(e)}))).then(o,n)}g((i=i.apply(A,e||[])).next())}))}function K(A,e){var t,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function n(n){return function(g){return function(n){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,n[0]&&(o=0)),o;)try{if(t=1,i&&(r=2&n[0]?i.return:n[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,n[1])).done)return r;switch(i=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return o.label++,{value:n[1],done:!1};case 5:o.label++,i=n[1],n=[0];continue;case 7:n=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){o=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){o.label=n[1];break}if(6===n[0]&&o.label<r[1]){o.label=r[1],r=n;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(n);break}r[2]&&o.ops.pop(),o.trys.pop();continue}n=e.call(A,o)}catch(A){n=[6,A],i=0}finally{t=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,g])}}}function J(A){var e="function"==typeof Symbol&&Symbol.iterator,t=e&&A[e],i=0;if(t)return t.call(A);if(A&&"number"==typeof A.length)return{next:function(){return A&&i>=A.length&&(A=void 0),{value:A&&A[i++],done:!A}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(A,e){var t="function"==typeof Symbol&&A[Symbol.iterator];if(!t)return A;var i,r,s=t.call(A),o=[];try{for(;(void 0===e||e-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(A){r={error:A}}finally{try{i&&!i.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}return o}function Y(A,e,t){if(t||2===arguments.length)for(var i,r=0,s=e.length;r<s;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return A.concat(i||Array.prototype.slice.call(e))}function T(A){return this instanceof T?(this.v=A,this):new T(A)}function P(A,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=t.apply(A,e||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(A){r[A]&&(i[A]=function(e){return new Promise((function(t,i){s.push([A,e,t,i])>1||n(A,e)}))})}function n(A,e){try{!function(A){A.value instanceof T?Promise.resolve(A.value.v).then(g,a):I(s[0][2],A)}(r[A](e))}catch(A){I(s[0][3],A)}}function g(A){n("next",A)}function a(A){n("throw",A)}function I(A,e){A(e),s.shift(),s.length&&n(s[0][0],s[0][1])}}function O(A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,t=A[Symbol.asyncIterator];return t?t.call(A):(A=J(A),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(t){e[t]=A[t]&&function(e){return new Promise((function(i,r){(function(A,e,t,i){Promise.resolve(i).then((function(e){A({value:e,done:t})}),e)})(i,r,(e=A[t](e)).done,e.value)}))}}}function _(A){return"function"==typeof A}function q(A){var e=A((function(A){Error.call(A),A.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var W=q((function(A){return function(e){A(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(A,e){return e+1+") "+A.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function V(A,e){if(A){var t=A.indexOf(e);0<=t&&A.splice(t,1)}}var j=function(){function A(A){this.initialTeardown=A,this.closed=!1,this._parentage=null,this._finalizers=null}return A.prototype.unsubscribe=function(){var A,e,t,i,r;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=J(s),n=o.next();!n.done;n=o.next()){n.value.remove(this)}}catch(e){A={error:e}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(A)throw A.error}}else s.remove(this);var g=this.initialTeardown;if(_(g))try{g()}catch(A){r=A instanceof W?A.errors:[A]}var a=this._finalizers;if(a){this._finalizers=null;try{for(var I=J(a),C=I.next();!C.done;C=I.next()){var B=C.value;try{z(B)}catch(A){r=null!=r?r:[],A instanceof W?r=Y(Y([],H(r)),H(A.errors)):r.push(A)}}}catch(A){t={error:A}}finally{try{C&&!C.done&&(i=I.return)&&i.call(I)}finally{if(t)throw t.error}}}if(r)throw new W(r)}},A.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)z(e);else{if(e instanceof A){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(t=this._finalizers)&&void 0!==t?t:[]).push(e)}},A.prototype._hasParent=function(A){var e=this._parentage;return e===A||Array.isArray(e)&&e.includes(A)},A.prototype._addParent=function(A){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(A),e):e?[e,A]:A},A.prototype._removeParent=function(A){var e=this._parentage;e===A?this._parentage=null:Array.isArray(e)&&V(e,A)},A.prototype.remove=function(e){var t=this._finalizers;t&&V(t,e),e instanceof A&&e._removeParent(this)},A.EMPTY=function(){var e=new A;return e.closed=!0,e}(),A}(),Z=j.EMPTY;function X(A){return A instanceof j||A&&"closed"in A&&_(A.remove)&&_(A.add)&&_(A.unsubscribe)}function z(A){_(A)?A():A.unsubscribe()}var $=void 0,AA=!1,eA=function(A,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];return setTimeout.apply(void 0,Y([A,e],H(t)))};function tA(A){eA((function(){throw A}))}function iA(){}function rA(A){A()}var sA=function(A){function e(e){var t=A.call(this)||this;return t.isStopped=!1,e?(t.destination=e,X(e)&&e.add(t)):t.destination=CA,t}return L(e,A),e.create=function(A,e,t){return new aA(A,e,t)},e.prototype.next=function(A){this.isStopped||this._next(A)},e.prototype.error=function(A){this.isStopped||(this.isStopped=!0,this._error(A))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,A.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(A){this.destination.next(A)},e.prototype._error=function(A){try{this.destination.error(A)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(j),oA=Function.prototype.bind;function nA(A,e){return oA.call(A,e)}var gA=function(){function A(A){this.partialObserver=A}return A.prototype.next=function(A){var e=this.partialObserver;if(e.next)try{e.next(A)}catch(A){IA(A)}},A.prototype.error=function(A){var e=this.partialObserver;if(e.error)try{e.error(A)}catch(A){IA(A)}else IA(A)},A.prototype.complete=function(){var A=this.partialObserver;if(A.complete)try{A.complete()}catch(A){IA(A)}},A}(),aA=function(A){function e(e,t,i){var r,s,o=A.call(this)||this;_(e)||!e?r={next:null!=e?e:void 0,error:null!=t?t:void 0,complete:null!=i?i:void 0}:o&&AA?((s=Object.create(e)).unsubscribe=function(){return o.unsubscribe()},r={next:e.next&&nA(e.next,s),error:e.error&&nA(e.error,s),complete:e.complete&&nA(e.complete,s)}):r=e;return o.destination=new gA(r),o}return L(e,A),e}(sA);function IA(A){tA(A)}var CA={closed:!0,next:iA,error:function(A){throw A},complete:iA},BA="function"==typeof Symbol&&Symbol.observable||"@@observable";function EA(A){return A}function QA(A){return 0===A.length?EA:1===A.length?A[0]:function(e){return A.reduce((function(A,e){return e(A)}),e)}}var cA=function(){function A(A){A&&(this._subscribe=A)}return A.prototype.lift=function(e){var t=new A;return t.source=this,t.operator=e,t},A.prototype.subscribe=function(A,e,t){var i,r=this,s=(i=A)&&i instanceof sA||function(A){return A&&_(A.next)&&_(A.error)&&_(A.complete)}(i)&&X(i)?A:new aA(A,e,t);return rA((function(){var A=r,e=A.operator,t=A.source;s.add(e?e.call(s,t):t?r._subscribe(s):r._trySubscribe(s))})),s},A.prototype._trySubscribe=function(A){try{return this._subscribe(A)}catch(e){A.error(e)}},A.prototype.forEach=function(A,e){var t=this;return new(e=uA(e))((function(e,i){var r=new aA({next:function(e){try{A(e)}catch(A){i(A),r.unsubscribe()}},error:i,complete:e});t.subscribe(r)}))},A.prototype._subscribe=function(A){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(A)},A.prototype[BA]=function(){return this},A.prototype.pipe=function(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];return QA(A)(this)},A.prototype.toPromise=function(A){var e=this;return new(A=uA(A))((function(A,t){var i;e.subscribe((function(A){return i=A}),(function(A){return t(A)}),(function(){return A(i)}))}))},A.create=function(e){return new A(e)},A}();function uA(A){var e;return null!==(e=null!=A?A:$)&&void 0!==e?e:Promise}function lA(A){return function(e){if(function(A){return _(null==A?void 0:A.lift)}(e))return e.lift((function(e){try{return A(e,this)}catch(A){this.error(A)}}));throw new TypeError("Unable to lift unknown Observable type")}}function hA(A,e,t,i,r){return new dA(A,e,t,i,r)}var dA=function(A){function e(e,t,i,r,s,o){var n=A.call(this,e)||this;return n.onFinalize=s,n.shouldUnsubscribe=o,n._next=t?function(A){try{t(A)}catch(A){e.error(A)}}:A.prototype._next,n._error=r?function(A){try{r(A)}catch(A){e.error(A)}finally{this.unsubscribe()}}:A.prototype._error,n._complete=i?function(){try{i()}catch(A){e.error(A)}finally{this.unsubscribe()}}:A.prototype._complete,n}return L(e,A),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var t=this.closed;A.prototype.unsubscribe.call(this),!t&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(sA),DA=q((function(A){return function(){A(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),pA=function(A){function e(){var e=A.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return L(e,A),e.prototype.lift=function(A){var e=new fA(this,this);return e.operator=A,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new DA},e.prototype.next=function(A){var e=this;rA((function(){var t,i;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var r=J(e.currentObservers),s=r.next();!s.done;s=r.next()){s.value.next(A)}}catch(A){t={error:A}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}}}))},e.prototype.error=function(A){var e=this;rA((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=A;for(var t=e.observers;t.length;)t.shift().error(A)}}))},e.prototype.complete=function(){var A=this;rA((function(){if(A._throwIfClosed(),!A.isStopped){A.isStopped=!0;for(var e=A.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var A;return(null===(A=this.observers)||void 0===A?void 0:A.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),A.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(A){return this._throwIfClosed(),this._checkFinalizedStatuses(A),this._innerSubscribe(A)},e.prototype._innerSubscribe=function(A){var e=this,t=this,i=t.hasError,r=t.isStopped,s=t.observers;return i||r?Z:(this.currentObservers=null,s.push(A),new j((function(){e.currentObservers=null,V(s,A)})))},e.prototype._checkFinalizedStatuses=function(A){var e=this,t=e.hasError,i=e.thrownError,r=e.isStopped;t?A.error(i):r&&A.complete()},e.prototype.asObservable=function(){var A=new cA;return A.source=this,A},e.create=function(A,e){return new fA(A,e)},e}(cA),fA=function(A){function e(e,t){var i=A.call(this)||this;return i.destination=e,i.source=t,i}return L(e,A),e.prototype.next=function(A){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===t||t.call(e,A)},e.prototype.error=function(A){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===t||t.call(e,A)},e.prototype.complete=function(){var A,e;null===(e=null===(A=this.destination)||void 0===A?void 0:A.complete)||void 0===e||e.call(A)},e.prototype._subscribe=function(A){var e,t;return null!==(t=null===(e=this.source)||void 0===e?void 0:e.subscribe(A))&&void 0!==t?t:Z},e}(pA),wA={now:function(){return(wA.delegate||Date).now()},delegate:void 0},yA=function(A){function e(e,t,i){void 0===e&&(e=1/0),void 0===t&&(t=1/0),void 0===i&&(i=wA);var r=A.call(this)||this;return r._bufferSize=e,r._windowTime=t,r._timestampProvider=i,r._buffer=[],r._infiniteTimeWindow=!0,r._infiniteTimeWindow=t===1/0,r._bufferSize=Math.max(1,e),r._windowTime=Math.max(1,t),r}return L(e,A),e.prototype.next=function(e){var t=this,i=t.isStopped,r=t._buffer,s=t._infiniteTimeWindow,o=t._timestampProvider,n=t._windowTime;i||(r.push(e),!s&&r.push(o.now()+n)),this._trimBuffer(),A.prototype.next.call(this,e)},e.prototype._subscribe=function(A){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(A),t=this._infiniteTimeWindow,i=this._buffer.slice(),r=0;r<i.length&&!A.closed;r+=t?1:2)A.next(i[r]);return this._checkFinalizedStatuses(A),e},e.prototype._trimBuffer=function(){var A=this,e=A._bufferSize,t=A._timestampProvider,i=A._buffer,r=A._infiniteTimeWindow,s=(r?1:2)*e;if(e<1/0&&s<i.length&&i.splice(0,i.length-s),!r){for(var o=t.now(),n=0,g=1;g<i.length&&i[g]<=o;g+=2)n=g;n&&i.splice(0,n+1)}},e}(pA),mA=function(A){function e(e,t){return A.call(this)||this}return L(e,A),e.prototype.schedule=function(A,e){return this},e}(j),FA=function(A,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];return setInterval.apply(void 0,Y([A,e],H(t)))},SA=function(A){return clearInterval(A)},kA=function(A){function e(e,t){var i=A.call(this,e,t)||this;return i.scheduler=e,i.work=t,i.pending=!1,i}return L(e,A),e.prototype.schedule=function(A,e){var t;if(void 0===e&&(e=0),this.closed)return this;this.state=A;var i=this.id,r=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(r,i,e)),this.pending=!0,this.delay=e,this.id=null!==(t=this.id)&&void 0!==t?t:this.requestAsyncId(r,this.id,e),this},e.prototype.requestAsyncId=function(A,e,t){return void 0===t&&(t=0),FA(A.flush.bind(A,this),t)},e.prototype.recycleAsyncId=function(A,e,t){if(void 0===t&&(t=0),null!=t&&this.delay===t&&!1===this.pending)return e;null!=e&&SA(e)},e.prototype.execute=function(A,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var t=this._execute(A,e);if(t)return t;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(A,e){var t,i=!1;try{this.work(A)}catch(A){i=!0,t=A||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),t},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,t=this.scheduler,i=t.actions;this.work=this.state=this.scheduler=null,this.pending=!1,V(i,this),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null,A.prototype.unsubscribe.call(this)}},e}(mA),RA=function(){function A(e,t){void 0===t&&(t=A.now),this.schedulerActionCtor=e,this.now=t}return A.prototype.schedule=function(A,e,t){return void 0===e&&(e=0),new this.schedulerActionCtor(this,A).schedule(t,e)},A.now=wA.now,A}(),MA=new(function(A){function e(e,t){void 0===t&&(t=RA.now);var i=A.call(this,e,t)||this;return i.actions=[],i._active=!1,i}return L(e,A),e.prototype.flush=function(A){var e=this.actions;if(this._active)e.push(A);else{var t;this._active=!0;do{if(t=A.execute(A.state,A.delay))break}while(A=e.shift());if(this._active=!1,t){for(;A=e.shift();)A.unsubscribe();throw t}}},e}(RA))(kA),bA=new cA((function(A){return A.complete()}));function NA(A){return A&&_(A.schedule)}function GA(A){return A[A.length-1]}function vA(A){return NA(GA(A))?A.pop():void 0}var UA=function(A){return A&&"number"==typeof A.length&&"function"!=typeof A};function LA(A){return _(null==A?void 0:A.then)}function xA(A){return _(A[BA])}function KA(A){return Symbol.asyncIterator&&_(null==A?void 0:A[Symbol.asyncIterator])}function JA(A){return new TypeError("You provided "+(null!==A&&"object"==typeof A?"an invalid object":"'"+A+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var HA="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function YA(A){return _(null==A?void 0:A[HA])}function TA(A){return P(this,arguments,(function(){var e,t,i;return K(this,(function(r){switch(r.label){case 0:e=A.getReader(),r.label=1;case 1:r.trys.push([1,,9,10]),r.label=2;case 2:return[4,T(e.read())];case 3:return t=r.sent(),i=t.value,t.done?[4,T(void 0)]:[3,5];case 4:return[2,r.sent()];case 5:return[4,T(i)];case 6:return[4,r.sent()];case 7:return r.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function PA(A){return _(null==A?void 0:A.getReader)}function OA(A){if(A instanceof cA)return A;if(null!=A){if(xA(A))return r=A,new cA((function(A){var e=r[BA]();if(_(e.subscribe))return e.subscribe(A);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(UA(A))return i=A,new cA((function(A){for(var e=0;e<i.length&&!A.closed;e++)A.next(i[e]);A.complete()}));if(LA(A))return t=A,new cA((function(A){t.then((function(e){A.closed||(A.next(e),A.complete())}),(function(e){return A.error(e)})).then(null,tA)}));if(KA(A))return _A(A);if(YA(A))return e=A,new cA((function(A){var t,i;try{for(var r=J(e),s=r.next();!s.done;s=r.next()){var o=s.value;if(A.next(o),A.closed)return}}catch(A){t={error:A}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}A.complete()}));if(PA(A))return _A(TA(A))}var e,t,i,r;throw JA(A)}function _A(A){return new cA((function(e){(function(A,e){var t,i,r,s;return x(this,void 0,void 0,(function(){var o,n;return K(this,(function(g){switch(g.label){case 0:g.trys.push([0,5,6,11]),t=O(A),g.label=1;case 1:return[4,t.next()];case 2:if((i=g.sent()).done)return[3,4];if(o=i.value,e.next(o),e.closed)return[2];g.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return n=g.sent(),r={error:n},[3,11];case 6:return g.trys.push([6,,9,10]),i&&!i.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:g.sent(),g.label=8;case 8:return[3,10];case 9:if(r)throw r.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(A,e).catch((function(A){return e.error(A)}))}))}function qA(A,e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1);var s=e.schedule((function(){t(),r?A.add(this.schedule(null,i)):this.unsubscribe()}),i);if(A.add(s),!r)return s}function WA(A,e){return void 0===e&&(e=0),lA((function(t,i){t.subscribe(hA(i,(function(t){return qA(i,A,(function(){return i.next(t)}),e)}),(function(){return qA(i,A,(function(){return i.complete()}),e)}),(function(t){return qA(i,A,(function(){return i.error(t)}),e)})))}))}function VA(A,e){return void 0===e&&(e=0),lA((function(t,i){i.add(A.schedule((function(){return t.subscribe(i)}),e))}))}function jA(A,e){if(!A)throw new Error("Iterable cannot be null");return new cA((function(t){qA(t,e,(function(){var i=A[Symbol.asyncIterator]();qA(t,e,(function(){i.next().then((function(A){A.done?t.complete():t.next(A.value)}))}),0,!0)}))}))}function ZA(A,e){if(null!=A){if(xA(A))return function(A,e){return OA(A).pipe(VA(e),WA(e))}(A,e);if(UA(A))return function(A,e){return new cA((function(t){var i=0;return e.schedule((function(){i===A.length?t.complete():(t.next(A[i++]),t.closed||this.schedule())}))}))}(A,e);if(LA(A))return function(A,e){return OA(A).pipe(VA(e),WA(e))}(A,e);if(KA(A))return jA(A,e);if(YA(A))return function(A,e){return new cA((function(t){var i;return qA(t,e,(function(){i=A[HA](),qA(t,e,(function(){var A,e,r;try{e=(A=i.next()).value,r=A.done}catch(A){return void t.error(A)}r?t.complete():t.next(e)}),0,!0)})),function(){return _(null==i?void 0:i.return)&&i.return()}}))}(A,e);if(PA(A))return function(A,e){return jA(TA(A),e)}(A,e)}throw JA(A)}function XA(A,e){return e?ZA(A,e):OA(A)}function zA(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];return XA(A,vA(A))}var $A=q((function(A){return function(){A(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ae(A,e){var t="object"==typeof e;return new Promise((function(i,r){var s=new aA({next:function(A){i(A),s.unsubscribe()},error:r,complete:function(){t?i(e.defaultValue):r(new $A)}});A.subscribe(s)}))}function ee(A,e){return lA((function(t,i){var r=0;t.subscribe(hA(i,(function(t){i.next(A.call(e,t,r++))})))}))}var te=Array.isArray;function ie(A){return ee((function(e){return function(A,e){return te(e)?A.apply(void 0,Y([],H(e))):A(e)}(A,e)}))}var re=Array.isArray,se=Object.getPrototypeOf,oe=Object.prototype,ne=Object.keys;function ge(A){if(1===A.length){var e=A[0];if(re(e))return{args:e,keys:null};if((i=e)&&"object"==typeof i&&se(i)===oe){var t=ne(e);return{args:t.map((function(A){return e[A]})),keys:t}}}var i;return{args:A,keys:null}}function ae(A,e,t){A?qA(t,A,e):e()}function Ie(A,e,t,i,r,s,o,n){var g=[],a=0,I=0,C=!1,B=function(){!C||g.length||a||e.complete()},E=function(A){return a<i?Q(A):g.push(A)},Q=function(A){s&&e.next(A),a++;var n=!1;OA(t(A,I++)).subscribe(hA(e,(function(A){null==r||r(A),s?E(A):e.next(A)}),(function(){n=!0}),void 0,(function(){if(n)try{a--;for(var A=function(){var A=g.shift();o?qA(e,o,(function(){return Q(A)})):Q(A)};g.length&&a<i;)A();B()}catch(A){e.error(A)}})))};return A.subscribe(hA(e,E,(function(){C=!0,B()}))),function(){null==n||n()}}function Ce(A,e,t){return void 0===t&&(t=1/0),_(e)?Ce((function(t,i){return ee((function(A,r){return e(t,A,i,r)}))(OA(A(t,i)))}),t):("number"==typeof e&&(t=e),lA((function(e,i){return Ie(e,i,A,t)})))}function Be(A){return void 0===A&&(A=1/0),Ce(EA,A)}function Ee(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];return Be(1)(XA(A,vA(A)))}function Qe(A){return new cA((function(e){OA(A()).subscribe(e)}))}var ce=["addListener","removeListener"],ue=["addEventListener","removeEventListener"],le=["on","off"];function he(A,e,t,i){if(_(t)&&(i=t,t=void 0),i)return he(A,e,t).pipe(ie(i));var r=H(function(A){return _(A.addEventListener)&&_(A.removeEventListener)}(A)?ue.map((function(i){return function(r){return A[i](e,r,t)}})):function(A){return _(A.addListener)&&_(A.removeListener)}(A)?ce.map(de(A,e)):function(A){return _(A.on)&&_(A.off)}(A)?le.map(de(A,e)):[],2),s=r[0],o=r[1];if(!s&&UA(A))return Ce((function(A){return he(A,e,t)}))(OA(A));if(!s)throw new TypeError("Invalid event target");return new cA((function(A){var e=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A.next(1<e.length?e:e[0])};return s(e),function(){return o(e)}}))}function de(A,e){return function(t){return function(i){return A[t](e,i)}}}function De(A,e,t){void 0===A&&(A=0),void 0===t&&(t=MA);var i=-1;return null!=e&&(NA(e)?t=e:i=e),new cA((function(e){var r,s=(r=A)instanceof Date&&!isNaN(r)?+A-t.now():A;s<0&&(s=0);var o=0;return t.schedule((function(){e.closed||(e.next(o++),0<=i?this.schedule(void 0,i):e.complete())}),s)}))}function pe(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];var t=vA(A),i=function(A,e){return"number"==typeof GA(A)?A.pop():e}(A,1/0),r=A;return r.length?1===r.length?OA(r[0]):Be(i)(XA(r,t)):bA}var fe=new cA(iA),we=Array.isArray;function ye(A,e){return lA((function(t,i){var r=0;t.subscribe(hA(i,(function(t){return A.call(e,t,r++)&&i.next(t)})))}))}function me(){for(var A,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===(e=1===(A=e).length&&we(A[0])?A[0]:A).length?OA(e[0]):new cA(Fe(e))}function Fe(A){return function(e){for(var t=[],i=function(i){t.push(OA(A[i]).subscribe(hA(e,(function(A){if(t){for(var r=0;r<t.length;r++)r!==i&&t[r].unsubscribe();t=null}e.next(A)}))))},r=0;t&&!e.closed&&r<A.length;r++)i(r)}}function Se(A){return lA((function(e,t){var i,r=null,s=!1;r=e.subscribe(hA(t,void 0,void 0,(function(o){i=OA(A(o,Se(A)(e))),r?(r.unsubscribe(),r=null,i.subscribe(t)):s=!0}))),s&&(r.unsubscribe(),r=null,i.subscribe(t))}))}function ke(A){return lA((function(e,t){var i=!1;e.subscribe(hA(t,(function(A){i=!0,t.next(A)}),(function(){i||t.next(A),t.complete()})))}))}function Re(A){return A<=0?function(){return bA}:lA((function(e,t){var i=0;e.subscribe(hA(t,(function(e){++i<=A&&(t.next(e),A<=i&&t.complete())})))}))}function Me(){return lA((function(A,e){A.subscribe(hA(e,iA))}))}function be(A){return void 0===A&&(A=Ne),lA((function(e,t){var i=!1;e.subscribe(hA(t,(function(A){i=!0,t.next(A)}),(function(){return i?t.complete():t.error(A())})))}))}function Ne(){return new $A}function Ge(A,e){var t=arguments.length>=2;return function(i){return i.pipe(A?ye((function(e,t){return A(e,t,i)})):EA,Re(1),t?ke(e):be((function(){return new $A})))}}function ve(){for(var A=[],e=0;e<arguments.length;e++)A[e]=arguments[e];return A.length?lA((function(e,t){Fe(Y([e],H(A)))(t)})):EA}function Ue(A){var e;void 0===A&&(A=1/0);var t=(e=A&&"object"==typeof A?A:{count:A}).count,i=void 0===t?1/0:t,r=e.delay,s=e.resetOnSuccess,o=void 0!==s&&s;return i<=0?EA:lA((function(A,e){var t,s=0,n=function(){var g=!1;t=A.subscribe(hA(e,(function(A){o&&(s=0),e.next(A)}),void 0,(function(A){if(s++<i){var o=function(){t?(t.unsubscribe(),t=null,n()):g=!0};if(null!=r){var a="number"==typeof r?De(r):OA(r(A,s)),I=hA(e,(function(){I.unsubscribe(),o()}),(function(){e.complete()}));a.subscribe(I)}else o()}else e.error(A)}))),g&&(t.unsubscribe(),t=null,n())};n()}))}function Le(A,e){return lA((function(t,i){var r=null,s=0,o=!1,n=function(){return o&&!r&&i.complete()};t.subscribe(hA(i,(function(t){null==r||r.unsubscribe();var o=0,g=s++;OA(A(t,g)).subscribe(r=hA(i,(function(A){return i.next(e?e(t,A,g,o++):A)}),(function(){r=null,n()})))}),(function(){o=!0,n()})))}))}function xe(A){return lA((function(e,t){OA(A).subscribe(hA(t,(function(){return t.complete()}),iA)),!t.closed&&e.subscribe(t)}))}function Ke(A,e,t){var i=_(A)||e||t?{next:A,error:e,complete:t}:A;return i?lA((function(A,e){var t;null===(t=i.subscribe)||void 0===t||t.call(i);var r=!0;A.subscribe(hA(e,(function(A){var t;null===(t=i.next)||void 0===t||t.call(i,A),e.next(A)}),(function(){var A;r=!1,null===(A=i.complete)||void 0===A||A.call(i),e.complete()}),(function(A){var t;r=!1,null===(t=i.error)||void 0===t||t.call(i,A),e.error(A)}),(function(){var A,e;r&&(null===(A=i.unsubscribe)||void 0===A||A.call(i)),null===(e=i.finalize)||void 0===e||e.call(i)})))})):EA} /** * @license * Copyright 2023 Google Inc. * SPDX-License-Identifier: Apache-2.0 */ Symbol.dispose??=Symbol("dispose"),Symbol.asyncDispose??=Symbol("asyncDispose");const Je=Symbol.dispose,He=Symbol.asyncDispose;class Ye{#A=!1;#e=[];get disposed(){return this.#A}dispose(){if(!this.#A){this.#A=!0;for(const A of this.#e.reverse())A[Je]()}}use(A){return A&&this.#e.push(A),A}adopt(A,e){return this.#e.push({[Je](){e(A)}}),A}defer(A){this.#e.push({[Je](){A()}})}move(){if(this.#A)throw new ReferenceError("a disposed stack can not use anything new");const A=new Ye;return A.#e=this.#e,this.#A=!0,A}[Je]=this.dispose;[Symbol.toStringTag]="DisposableStack"}class Te{#A=!1;#e=[];get disposed(){return this.#A}async dispose(){if(!this.#A){this.#A=!0;for(const A of this.#e.reverse())await A[He]()}}use(A){return A&&this.#e.push(A),A}adopt(A,e){return this.#e.push({[He]:()=>e(A)}),A}defer(A){this.#e.push({[He]:()=>A()})}move(){if(this.#A)throw new ReferenceError("a disposed stack can not use anything new");const A=new Te;return A.#e=this.#e,this.#A=!0,A}[He]=this.dispose;[Symbol.toStringTag]="AsyncDisposableStack"} /** * @license * Copyright 2022 Google Inc. * SPDX-License-Identifier: Apache-2.0 */let Pe=class{#t;#i=new Map;constructor(A=function(A){return{all:A=A||new Map,on:function(e,t){var i=A.get(e);i?i.push(t):A.set(e,[t])},off:function(e,t){var i=A.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):A.set(e,[]))},emit:function(e,t){var i=A.get(e);i&&i.slice().map((function(A){A(t)})),(i=A.get("*"))&&i.slice().map((function(A){A(e,t)}))}}}(new Map)){this.#t=A}on(A,e){const t=this.#i.get(A);return void 0===t?this.#i.set(A,[e]):t.push(e),this.#t.on(A,e),this}off(A,e){const t=this.#i.get(A)??[];if(void 0===e){for(const e of t)this.#t.off(A,e);return this.#i.delete(A),this}const i=t.lastIndexOf(e);return i>-1&&this.#t.off(A,...t.splice(i,1)),this}emit(A,e){return this.#t.emit(A,e),this.listenerCount(A)>0}once(A,e){const t=i=>{e(i),this.off(A,t)};return this.on(A,t)}listenerCount(A){return this.#i.get(A)?.length||0}removeAllListeners(A){return void 0!==A?this.off(A):(this[Je](),this)}[Je](){for(const[A,e]of this.#i)for(const t of e)this.#t.off(A,t);this.#i.clear()}}; /** * @license * Copyright 2020 Google Inc. * SPDX-License-Identifier: Apache-2.0 */const Oe=!("undefined"==typeof process||!process.version),_e={value:{get fs(){throw new Error("fs is not available in this environment")},get path(){throw new Error("path is not available in this environment")},get ScreenRecorder(){throw new Error("ScreenRecorder is not available in this environment")}}},qe="23.3.0",We=(A,e)=>{if(!A)throw new Error(e)}; /** * @license * Copyright 2024 Google Inc. * SPDX-License-Identifier: Apache-2.0 */ function Ve(A,e=!1){if(e){const e=atob(A);return Uint8Array.from(e,(A=>A.codePointAt(0)))}return(new TextEncoder).encode(A)}function je(A){return Ze((new TextEncoder).encode(A))}function Ze(A){const e=[];for(let t=0;t<A.length;t+=65534){const i=A.subarray(t,t+65534);e.push(String.fromCodePoint.apply(null,i))}const t=e.join("");return btoa(t)} /** * @license * Copyright 2020 Google Inc. * SPDX-License-Identifier: Apache-2.0 */ let Xe=null;const ze=A=>Oe?async(...e)=>{(await async function(){return Xe||(Xe=(await Promise.resolve().then((function(){return Ga}))).default),Xe}())(A)(e)}:(...e)=>{const t=globalThis.__PUPPETEER_DEBUG;if(!t)return;("*"===t||(t.endsWith("*")?A.startsWith(t):A===t))&&console.log(`${A}:`,...e)}; /** * @license * Copyright 2018 Google Inc. * SPDX-License-Identifier: Apache-2.0 */class $e extends Error{constructor(A,e){super(A,e),this.name=this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}let At=class extends $e{};class et extends $e{#r;#s="";set code(A){this.#r=A}get code(){return this.#r}set originalMessage(A){this.#s=A}get originalMessage(){return this.#s}}class tt extends $e{}class it extends et{} /** * @license * Copyright 2020 Google Inc. * SPDX-License-Identifier: Apache-2.0 */const rt={letter:{width:8.5,height:11},legal:{width:8.5,height:14},tabloid:{width:11,height:17},ledger:{width:17,height:11},a0:{width:33.1,height:46.8},a1:{width:23.4,height:33.1},a2:{width:16.54,height:23.4},a3:{width:11.7,height:16.54},a4:{width:8.27,height:11.7},a5:{width:5.83,height:8.27},a6:{width:4.13,height:5.83}},st=ze("puppeteer:error"),ot=Object.freeze({width:800,height:600}),nt=Symbol("Source URL for Puppeteer evaluation scripts"); /** * @license * Copyright 2017 Google Inc. * SPDX-License-Identifier: Apache-2.0 */class gt{static INTERNAL_URL="pptr:internal";static fromCallSite(A,e){const t=new gt;return t.#o=A,t.#n=e.toString(),t}static parse=A=>{A=A.slice(5);const[e="",t=""]=A.split(";"),i=new gt;return i.#o=e,i.#n=decodeURIComponent(t),i};static isPuppeteerURL=A=>A.startsWith("pptr:");#o;#n;get functionName(){return this.#o}get siteString(){return this.#n}toString(){return`pptr:${[this.#o,encodeURIComponent(this.#n)].join(";")}`}}const at=(A,e)=>{if(Object.prototype.hasOwnProperty.call(e,nt))return e;const t=Error.prepareStackTrace;Error.prepareStackTrace=(A,e)=>e[2];const i=(new Error).stack;return Error.prepareStackTrace=t,Object.assign(e,{[nt]:gt.fromCallSite(A,i)})},It=A=>{if(Object.prototype.hasOwnProperty.call(A,nt))return A[nt]},Ct=A=>"string"==typeof A||A instanceof String;function Bt(A,...e){if(Ct(A))return We(0===e.length,"Cannot evaluate a string with arguments"),A;return`(${A})(${e.map((function(A){return Object.is(A,void 0)?"undefined":JSON.stringify(A)})).join(",")})`}async function Et(A,e){const t=[],i=A.getReader();if(e){const A=await _e.value.fs.promises.open(e,"w+");try{for(;;){const{done:e,value:r}=await i.read();if(e)break;t.push(r),await A.writeFile(r)}}finally{await A.close()}}else for(;;){const{done:A,value:e}=await i.read();if(A)break;t.push(e)}try{const A=function(A){let e=0;for(const t of A)e+=t.length;const t=new Uint8Array(e);let i=0;for(const e of A)t.set(e,i),i+=e.length;return t}(t);return 0===A.length?null:A}catch(A){return st(A),null}}async function Qt(A,e){return new ReadableStream({async pull(t){const{data:i,base64Encoded:r,eof:s}=await A.send("IO.read",{handle:e});t.enqueue(function(A,e){return e?Uint8Array.from(atob(A),(A=>A.codePointAt(0))):(new TextEncoder).encode(A)}(i,r??!1)),s&&(await A.send("IO.close",{handle:e}),t.close())}})}function ct(A,e){return 0===A?fe:De(A).pipe(ee((()=>{throw new At(`Timed out after waiting ${A}ms`,{cause:e})})))}const ut="__puppeteer_utility_world__"+qe,lt=/^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;function ht(A){return`//# sourceURL=${A}`}const dt=500;function Dt(A={},e="in"){let t=8.5,i=11;if(A.format){const e=rt[A.format.toLowerCase()];We(e,"Unknown paper format: "+A.format),t=e.width,i=e.height}else t=ft(A.width,e)??t,i=ft(A.height,e)??i;const r={top:ft(A.margin?.top,e)||0,left:ft(A.margin?.left,e)||0,bottom:ft(A.margin?.bottom,e)||0,right:ft(A.margin?.right,e)||0};return A.outline&&(A.tagged=!0),{scale:1,displayHeaderFooter:!1,headerTemplate:"",footerTemplate:"",printBackground:!1,landscape:!1,pageRanges:"",preferCSSPageSize:!1,omitBackground:!1,outline:!1,tagged:!0,waitForFonts:!0,...A,width:t,height:i,margin:r}}const pt={px:1,in:96,cm:37.8,mm:3.78};function ft(A,e="in"){if(void 0===A)return;let t;if("number"==typeof(i=A)||i instanceof Number)t=A;else{if(!Ct(A))throw new Error("page.pdf() Cannot handle parameter type: "+typeof A);{const e=A;let i=e.substring(e.length-2).toLowerCase(),r="";i in pt?r=e.substring(0,e.length-2):(i="px",r=e);const s=Number(r);We(!isNaN(s),"Failed to parse parameter value: "+e),t=s*pt[i]}}var i;return t/pt[e]}function wt(A,e){return new cA((t=>{const i=A=>{t.next(A)};return A.on(e,i),()=>{A.off(e,i)}}))}function yt(A,e){return A?he(A,"abort").pipe(ee((()=>{if(A.reason instanceof Error)throw A.reason.cause=e,A.reason;throw new Error(A.reason,{cause:e})}))):fe}function mt(A){return Ce((e=>XA(Promise.resolve(A(e))).pipe(ye((A=>A)),ee((()=>e)))))} /** * @license * Copyright 2017 Google Inc. * SPDX-License-Identifier: Apache-2.0 */const Ft=new Map([["geolocation","geolocation"],["midi","midi"],["notifications","notifications"],["camera","videoCapture"],["microphone","audioCapture"],["background-sync","backgroundSync"],["ambient-light-sensor","sensors"],["accelerometer","sensors"],["gyroscope","sensors"],["magnetometer","sensors"],["accessibility-events","accessibilityEvents"],["clipboard-read","clipboardReadWrite"],["clipboard-write","clipboardReadWrite"],["clipboard-sanitized-write","clipboardSanitizedWrite"],["payment-handler","paymentHandler"],["persistent-storage","durableStorage"],["idle-detection","idleDetection"],["midi-sysex","midiSysex"]]);let St=class extends Pe{constructor(){super()}async waitForTarget(A,e={}){const{timeout:t=3e4,signal:i}=e;return await Ae(pe(wt(this,"targetcreated"),wt(this,"targetchanged"),XA(this.targets())).pipe(mt(A),ve(yt(i),ct(t))))}async pages(){const A=await Promise.all(this.browserContexts().map((A=>A.pages())));return A.reduce(((A,e)=>A.concat(e)),[])}isConnected(){return this.connected}[Je](){this.process()?this.close().catch(st):this.disconnect().catch(st)}[He](){return this.process()?this.close():this.disconnect()}}; /** * @license * Copyright 2024 Google Inc. * SPDX-License-Identifier: Apache-2.0 */class kt{static create(A){return new kt(A)}static async race(A){const e=new Set;try{const t=A.map((A=>A instanceof kt?(A.#g&&e.add(A),A.valueOrThrow()):A));return await Promise.race(t)}finally{for(const A of e)A.reject(new Error("Timeout cleared"))}}#a=!1;#I=!1;#C;#B;#E=new Promise((A=>{this.#B=A}));#g;#Q;constructor(A){A&&A.timeout>0&&(this.#Q=new At(A.message),this.#g=setTimeout((()=>{this.reject(this.#Q)}),A.timeout))}#c(A){clearTimeout(this.#g),this.#C=A,this.#B()}resolve(A){this.#I||this.#a||(this.#a=!0,this.#c(A))}reject(A){this.#I||this.#a||(this.#I=!0,this.#c(A))}resolved(){return this.#a}finished(){return this.#a||this.#I}value(){return this.#C}#u;valueOrThrow(){return this.#u||(this.#u=(async()=>{if(await this.#E,this.#I)throw this.#C;return this.#C})()),this.#u}} /** * @license * Copyright 2024 Google Inc. * SPDX-License-Identifier: Apache-2.0 */class Rt{static Guard=class{#l;#h;constructor(A,e){this.#l=A,this.#h=e}[Je](){return this.#h?.(),this.#l.release()}};#d=!1;#D=[];async acquire(A){if(!this.#d)return this.#d=!0,new Rt.Guard(this);const e=kt.create();return this.#D.push(e.resolve.bind(e)),await e.valueOrThrow(),new Rt.Guard(this,A)}release(){const A=this.#D.shift();A?A():this.#d=!1}} /** * @license * Copyright 2017 Google Inc. * SPDX-License-Identif