File: C:/Users/fred/.codex/plugins/cache/openai-bundled/chrome/latest/scripts/browser-client.mjs
const listeners = new Map();
const processShim = {
env: {},
version: "v20.0.0",
versions: {
node: "20.0.0",
icu: "shim",
},
pid: 0,
argv: ["node", ""],
cwd: () => "/",
uptime: () => 0,
memoryUsage: () => ({ rss: 0 }),
availableMemory: undefined,
on: (event, listener) => {
const set = listeners.get(event) ?? new Set();
set.add(listener);
listeners.set(event, set);
return processShim;
},
off: (event, listener) => {
listeners.get(event)?.delete(listener);
return processShim;
},
listeners: (event) => Array.from(listeners.get(event) ?? []),
exit: (code = 0) => {
throw new Error(`process.exit(${code}) called`);
},
};
globalThis.process = processShim;
globalThis.global = globalThis.global ?? globalThis;
globalThis.global.process = processShim;
var Mk=Object.create;var Kc=Object.defineProperty;var Fk=Object.getOwnPropertyDescriptor;var Bk=Object.getOwnPropertyNames;var Lk=Object.getPrototypeOf,Uk=Object.prototype.hasOwnProperty;var Ya=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),T=(e,t)=>{for(var r in t)Kc(e,r,{get:t[r],enumerable:!0})},jk=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Bk(t))!Uk.call(e,o)&&o!==r&&Kc(e,o,{get:()=>t[o],enumerable:!(n=Fk(t,o))||n.enumerable});return e};var Mh=(e,t,r)=>(r=e!=null?Mk(Lk(e)):{},jk(t||!e||!e.__esModule?Kc(r,"default",{value:e,enumerable:!0}):r,e));var re=N(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.Log=We.LogLevel=void 0;var L2=" DEBUG ",U2=" INFO ",j2=" WARN ",q2=" ERROR ";function Fu(e){return e.unshift("[Statsig]"),e}We.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};var Bu=class e{static info(...t){e.level>=We.LogLevel.Info&&console.info(U2,...Fu(t))}static debug(...t){e.level>=We.LogLevel.Debug&&console.debug(L2,...Fu(t))}static warn(...t){e.level>=We.LogLevel.Warn&&console.warn(j2,...Fu(t))}static error(...t){e.level>=We.LogLevel.Error&&console.error(q2,...Fu(t))}};We.Log=Bu;Bu.level=We.LogLevel.Warn});var Qt=N(He=>{"use strict";var up,lp,cp;Object.defineProperty(He,"__esModule",{value:!0});He._getInstance=He._getStatsigGlobalFlag=He._getStatsigGlobal=void 0;var $2=re(),z2=()=>{try{return typeof __STATSIG__<"u"?__STATSIG__:Ki}catch{return Ki}};He._getStatsigGlobal=z2;var W2=e=>(0,He._getStatsigGlobal)()[e];He._getStatsigGlobalFlag=W2;var H2=e=>{let t=(0,He._getStatsigGlobal)();return e?t.instances&&t.instances[e]:(t.instances&&Object.keys(t.instances).length>1&&$2.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),t.firstInstance)};He._getInstance=H2;var Jn="__STATSIG__",Wy=typeof window<"u"?window:{},Hy=typeof global<"u"?global:{},Vy=typeof globalThis<"u"?globalThis:{},Ki=(cp=(lp=(up=Wy[Jn])!==null&&up!==void 0?up:Hy[Jn])!==null&&lp!==void 0?lp:Vy[Jn])!==null&&cp!==void 0?cp:{instance:He._getInstance};Wy[Jn]=Ki;Hy[Jn]=Ki;Vy[Jn]=Ki});var Uu=N(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Diagnostics=void 0;var Lu=new Map,dp="start",pp="end",V2="statsig::diagnostics";Rr.Diagnostics={_getMarkers:e=>Lu.get(e),_markInitOverallStart:e=>{Zn(e,Yn({},dp,"overall"))},_markInitOverallEnd:(e,t,r)=>{Zn(e,Yn({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:r},pp,"overall"))},_markInitNetworkReqStart:(e,t)=>{Zn(e,Yn(t,dp,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{Zn(e,Yn(t,pp,"initialize","network_request"))},_markInitProcessStart:e=>{Zn(e,Yn({},dp,"initialize","process"))},_markInitProcessEnd:(e,t)=>{Zn(e,Yn(t,pp,"initialize","process"))},_clearMarkers:e=>{Lu.delete(e)},_formatError(e){if(e&&typeof e=="object")return{code:fp(e,"code"),name:fp(e,"name"),message:fp(e,"message")}},_getDiagnosticsData(e,t,r,n){var o;return{success:e?.ok===!0,statusCode:e?.status,sdkRegion:(o=e?.headers)===null||o===void 0?void 0:o.get("x-statsig-region"),isDelta:r.includes('"is_delta":true')===!0?!0:void 0,attempt:t,error:Rr.Diagnostics._formatError(n)}},_enqueueDiagnosticsEvent(e,t,r,n){let o=Rr.Diagnostics._getMarkers(r);if(o==null||o.length<=0)return-1;let i=o[o.length-1].timestamp-o[0].timestamp;Rr.Diagnostics._clearMarkers(r);let s=G2(e,{context:"initialize",markers:o.slice(),statsigOptions:n});return t.enqueue(s),i}};function Yn(e,t,r,n){return Object.assign({key:r,action:t,step:n,timestamp:Date.now()},e)}function G2(e,t){return{eventName:V2,user:e,value:null,metadata:t,time:Date.now()}}function Zn(e,t){var r;let n=(r=Lu.get(e))!==null&&r!==void 0?r:[];n.push(t),Lu.set(e,n)}function fp(e,t){if(t in e)return e[t]}});var Gy=N(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});ju.EventBatch=void 0;var mp=class{constructor(t){this.attempts=0,this.createdAt=Date.now(),this.events=t}incrementAttempts(){this.attempts++}};ju.EventBatch=mp});var $u=N(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});qu.EventRetryConstants=void 0;qu.EventRetryConstants={MAX_RETRY_ATTEMPTS:8,DEFAULT_BATCH_SIZE:100,MAX_PENDING_BATCHES:40,TICK_INTERVAL_MS:1e3,QUICK_FLUSH_WINDOW_MS:200,MAX_LOCAL_STORAGE:500,get MAX_QUEUED_EVENTS(){return this.DEFAULT_BATCH_SIZE*this.MAX_PENDING_BATCHES}}});var Jy=N(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.BatchQueue=void 0;var K2=Gy(),Ky=$u(),hp=class{constructor(t=Ky.EventRetryConstants.DEFAULT_BATCH_SIZE){this._batches=[],this._batchSize=t}batchSize(){return this._batchSize}requeueBatch(t){return this._enqueueBatch(t)}hasFullBatch(){return this._batches.some(t=>t.events.length>=this._batchSize)}takeNextBatch(){return this._batches.shift()}takeAllBatches(){let t=this._batches;return this._batches=[],t}createBatches(t){let r=0,n=0;for(;r<t.length;){let o=t.slice(r,r+this._batchSize);n+=this._enqueueBatch(new K2.EventBatch(o)),r+=this._batchSize}return n}_enqueueBatch(t){this._batches.push(t);let r=0;for(;this._batches.length>Ky.EventRetryConstants.MAX_PENDING_BATCHES;){let n=this._batches.shift();n&&(r+=n.events.length)}return r}};zu.BatchQueue=hp});var Wu=N(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn._isTypeMatch=Xn._typeOf=void 0;function J2(e){return Array.isArray(e)?"array":typeof e}Xn._typeOf=J2;function Y2(e,t){let r=n=>Array.isArray(n)?"array":n===null?"null":typeof n;return r(e)===r(t)}Xn._isTypeMatch=Y2});var er=N(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve._getSortedObject=Ve._DJB2Object=Ve._DJB2=void 0;var Z2=Wu(),X2=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return String(t>>>0)};Ve._DJB2=X2;var Q2=(e,t)=>(0,Ve._DJB2)(JSON.stringify((0,Ve._getSortedObject)(e,t)));Ve._DJB2Object=Q2;var eD=(e,t)=>{if(e==null)return null;let r=Object.keys(e).sort(),n={};return r.forEach(o=>{let i=e[o];if(t===0||(0,Z2._typeOf)(i)!=="object"){n[o]=i;return}n[o]=(0,Ve._getSortedObject)(i,t!=null?t-1:t)}),n};Ve._getSortedObject=eD});var Ji=N(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn._getStorageKey=Qn._getUserStorageKey=void 0;var Yy=er();function Zy(e,t,r){var n;if(r)return r(e,t);let o=t&&t.customIDs?t.customIDs:{},i=[`uid:${(n=t?.userID)!==null&&n!==void 0?n:""}`,`cids:${Object.keys(o).sort((s,a)=>s.localeCompare(a)).map(s=>`${s}-${o[s]}`).join(",")}`,`k:${e}`];return(0,Yy._DJB2)(i.join("|"))}Qn._getUserStorageKey=Zy;function tD(e,t,r){return t?Zy(e,t,r):(0,Yy._DJB2)(`k:${e}`)}Qn._getStorageKey=tD});var eo=N(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.NetworkParam=Ge.NetworkDefault=Ge.Endpoint=void 0;Ge.Endpoint={_initialize:"initialize",_rgstr:"rgstr",_download_config_specs:"download_config_specs"};Ge.NetworkDefault={[Ge.Endpoint._rgstr]:"https://prodregistryv2.org/v1",[Ge.Endpoint._initialize]:"https://featureassets.org/v1",[Ge.Endpoint._download_config_specs]:"https://api.statsigcdn.com/v1"};Ge.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}});var Yi=N(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});Hu.SDKType=void 0;var Xy={},to;Hu.SDKType={_get:e=>{var t;return((t=Xy[e])!==null&&t!==void 0?t:"js-mono")+(to??"")},_setClientType(e,t){Xy[e]=t},_setBindingType(e){(!to||to==="-react")&&(to="-"+e)}}});var ro=N(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.StatsigMetadataProvider=Pr.SDK_VERSION=void 0;Pr.SDK_VERSION="3.32.6";var gp={sdkVersion:Pr.SDK_VERSION,sdkType:"js-mono"};Pr.StatsigMetadataProvider={get:()=>gp,add:e=>{gp=Object.assign(Object.assign({},gp),e)}}});var Ke=N(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te._cloneObject=te._getUnloadEvent=te._getCurrentPageUrlSafe=te._addDocumentEventListenerSafe=te._addWindowEventListenerSafe=te._isServerEnv=te._getDocumentSafe=te._getWindowSafe=void 0;var rD=re(),nD=()=>typeof window<"u"?window:null;te._getWindowSafe=nD;var oD=()=>{var e;let t=(0,te._getWindowSafe)();return(e=t?.document)!==null&&e!==void 0?e:null};te._getDocumentSafe=oD;var iD=()=>{if((0,te._getDocumentSafe)()!==null)return!1;let e=typeof process<"u"&&process.versions!=null&&process.versions.node!=null;return typeof EdgeRuntime=="string"||e};te._isServerEnv=iD;var sD=(e,t)=>{let r=(0,te._getWindowSafe)();typeof r?.addEventListener=="function"&&r.addEventListener(e,t)};te._addWindowEventListenerSafe=sD;var aD=(e,t)=>{let r=(0,te._getDocumentSafe)();typeof r?.addEventListener=="function"&&r.addEventListener(e,t)};te._addDocumentEventListenerSafe=aD;var uD=()=>{var e;try{return(e=(0,te._getWindowSafe)())===null||e===void 0?void 0:e.location.href.split(/[?#]/)[0]}catch{return}};te._getCurrentPageUrlSafe=uD;var lD=()=>{let e=(0,te._getWindowSafe)();return e&&"onpagehide"in e?"pagehide":"beforeunload"};te._getUnloadEvent=lD;var cD=(e,t)=>{try{return JSON.parse(JSON.stringify(t))}catch{return rD.Log.error(`Failed to clone object ${e}`),null}};te._cloneObject=cD});var no=N(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve._notifyVisibilityChanged=ve._subscribeToVisiblityChanged=ve._isUnloading=ve._isCurrentlyVisible=void 0;var Zi=Ke(),Vu="foreground",yp="background",Qy=[],bp=Vu,_p=!1,dD=()=>bp===Vu;ve._isCurrentlyVisible=dD;var pD=()=>_p;ve._isUnloading=pD;var fD=e=>{Qy.unshift(e)};ve._subscribeToVisiblityChanged=fD;var mD=e=>{e!==bp&&(bp=e,Qy.forEach(t=>t(e)))};ve._notifyVisibilityChanged=mD;(0,Zi._addWindowEventListenerSafe)("focus",()=>{_p=!1,(0,ve._notifyVisibilityChanged)(Vu)});(0,Zi._addWindowEventListenerSafe)("blur",()=>(0,ve._notifyVisibilityChanged)(yp));(0,Zi._addDocumentEventListenerSafe)("visibilitychange",()=>{(0,ve._notifyVisibilityChanged)(document.visibilityState==="visible"?Vu:yp)});(0,Zi._addWindowEventListenerSafe)((0,Zi._getUnloadEvent)(),()=>{_p=!0,(0,ve._notifyVisibilityChanged)(yp)})});var t_=N(oo=>{"use strict";var e_=oo&&oo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(oo,"__esModule",{value:!0});oo.EventSender=void 0;var hD=re(),gD=eo(),bD=Yi(),yD=ro(),_D=no(),wp=class{constructor(t,r,n,o,i){this._sdkKey=t,this._network=r,this._emitter=n,this._options=i,this._logEventUrlConfig=o}setLogEventCompressionMode(t){this._network.setLogEventCompressionMode(t)}sendBatch(t){return e_(this,void 0,void 0,function*(){var r,n,o;let i="event_sender_unexpected_exception",s={};try{let u=(0,_D._isUnloading)()&&this._network.isBeaconSupported()&&((n=(r=this._options)===null||r===void 0?void 0:r.networkConfig)===null||n===void 0?void 0:n.networkOverrideFunc)==null;i="event_sender_pre_logs_flushed_emitter_exception",this._emitter({name:"pre_logs_flushed",events:t.events}),i=u?"event_sender_unexpected_exception":"event_sender_post_exception";let l=u?this._sendEventsViaBeacon(t,s):yield this._sendEventsViaPost(t,s);return l.success?(i="event_sender_logs_flushed_emitter_exception",this._emitter({name:"logs_flushed",events:t.events}),l):Object.assign(Object.assign(Object.assign({success:!1,statusCode:l.statusCode,failurePath:l.failurePath},l.failureErrorMessage?{failureErrorMessage:l.failureErrorMessage}:{}),l.failureDiagnosticBucket?{failureDiagnosticBucket:l.failureDiagnosticBucket}:{}),l.failureDiagnosticMetadata?{failureDiagnosticMetadata:l.failureDiagnosticMetadata}:{})}catch(a){return hD.Log.warn("Failed to send batch:",a),Object.assign(Object.assign(Object.assign({success:!1,statusCode:-1,failurePath:(o=s.path)!==null&&o!==void 0?o:i},s.errorMessage?{failureErrorMessage:s.errorMessage}:{}),s.diagnosticBucket?{failureDiagnosticBucket:s.diagnosticBucket}:{}),s.diagnosticMetadata?{failureDiagnosticMetadata:s.diagnosticMetadata}:{})}})}_sendEventsViaPost(t,r){return e_(this,void 0,void 0,function*(){var n,o;let i=yield this._network.post(this._getRequestData(t),r),s=(n=i?.code)!==null&&n!==void 0?n:-1;return s===-1?Object.assign(Object.assign(Object.assign({success:!1,statusCode:-1,failurePath:(o=r.path)!==null&&o!==void 0?o:i===void 0?"event_sender_post_returned_undefined":"event_sender_post_returned_null"},r.errorMessage?{failureErrorMessage:r.errorMessage}:{}),r.diagnosticBucket?{failureDiagnosticBucket:r.diagnosticBucket}:{}),r.diagnosticMetadata?{failureDiagnosticMetadata:r.diagnosticMetadata}:{}):{success:s>=200&&s<300,statusCode:s}})}_sendEventsViaBeacon(t,r){var n;let o=this._network.beacon(this._getRequestData(t),r);return Object.assign(Object.assign(Object.assign({success:o,statusCode:o?200:-1,failurePath:o?void 0:(n=r.path)!==null&&n!==void 0?n:"beacon_send_false"},!o&&r.errorMessage?{failureErrorMessage:r.errorMessage}:{}),!o&&r.diagnosticBucket?{failureDiagnosticBucket:r.diagnosticBucket}:{}),!o&&r.diagnosticMetadata?{failureDiagnosticMetadata:r.diagnosticMetadata}:{})}_getRequestData(t){return{sdkKey:this._sdkKey,data:{events:t.events},urlConfig:this._logEventUrlConfig,retries:3,preserveFailedStatusCode:!0,isCompressable:!0,params:{[gD.NetworkParam.EventCount]:String(t.events.length)},headers:{"statsig-event-count":String(t.events.length),"statsig-retry-count":String(t.attempts),"statsig-sdk-type":bD.SDKType._get(this._sdkKey),"statsig-sdk-version":yD.SDK_VERSION},credentials:"same-origin"}}};oo.EventSender=wp});var r_=N(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});Ku.FlushInterval=void 0;var Gu=1e3,xp=6e4,Sp=class{constructor(){this._currentIntervalMs=Gu,this._lastFlushAttemptTime=Date.now()}getCurrentIntervalMs(){return this._currentIntervalMs}markFlushAttempt(){this._lastFlushAttemptTime=Date.now()}getTimeSinceLastAttempt(){return Date.now()-this._lastFlushAttemptTime}hasReachedMaxInterval(){return this.getTimeSinceLastAttempt()>=xp}getTimeTillMaxInterval(){return xp-this.getTimeSinceLastAttempt()}hasCompletelyRecoveredFromBackoff(){return this._currentIntervalMs<=Gu}adjustForSuccess(){let t=this._currentIntervalMs;t!==Gu&&(this._currentIntervalMs=Math.max(Gu,Math.floor(t/2)))}adjustForFailure(){let t=this._currentIntervalMs;this._currentIntervalMs=Math.min(xp,t*2)}getTimeUntilNextFlush(){return this.getCurrentIntervalMs()-this.getTimeSinceLastAttempt()}};Ku.FlushInterval=Sp});var o_=N(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});Ju.FlushType=void 0;var n_;(function(e){e.ScheduledMaxTime="scheduled:max_time",e.ScheduledFullBatch="scheduled:full_batch",e.Limit="limit",e.Manual="manual",e.Shutdown="shutdown"})(n_||(Ju.FlushType=n_={}))});var i_=N(io=>{"use strict";var wD=io&&io.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(io,"__esModule",{value:!0});io._fetchTxtRecords=void 0;var xD=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),SD="https://cloudflare-dns.com/dns-query",vD=["i","e","d"],ED=200;function CD(e){return wD(this,void 0,void 0,function*(){let t=yield e(SD,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:xD});if(!t.ok){let o=new Error("Failed to fetch TXT records from DNS");throw o.name="DnsTxtFetchError",o}let r=yield t.arrayBuffer(),n=new Uint8Array(r);return TD(n)})}io._fetchTxtRecords=CD;function TD(e){let t=e.findIndex((n,o)=>o<ED&&String.fromCharCode(n)==="="&&vD.includes(String.fromCharCode(e[o-1])));if(t===-1){let n=new Error("Failed to parse TXT records from DNS");throw n.name="DnsTxtParseError",n}let r="";for(let n=t-1;n<e.length;n++)r+=String.fromCharCode(e[n]);return r.split(",")}});var ct=N(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je._setObjectInStorage=Je._getObjectFromStorage=Je.Storage=void 0;var a_=re(),kD=Ke(),Xi={},Ep={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>Xi[e]?Xi[e]:null,setItem:(e,t)=>{Xi[e]=t},removeItem:e=>{delete Xi[e]},getAllKeys:()=>Object.keys(Xi)},Yu=null;try{let e=(0,kD._getWindowSafe)();e&&e.localStorage&&typeof e.localStorage.getItem=="function"&&(Yu={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,r)=>e.localStorage.setItem(t,r),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch{a_.Log.warn("Failed to setup localStorageProvider.")}var vp=Yu??Ep,lt=vp;function s_(e){try{return e()}catch(t){if(t instanceof Error&&t.name==="SecurityError")return Je.Storage._setProvider(Ep),null;throw t}}Je.Storage={isReady:()=>lt.isReady(),isReadyResolver:()=>lt.isReadyResolver(),getProviderName:()=>lt.getProviderName(),getItem:e=>s_(()=>lt.getItem(e)),setItem:(e,t)=>s_(()=>lt.setItem(e,t)),removeItem:e=>lt.removeItem(e),getAllKeys:()=>lt.getAllKeys(),_setProvider:e=>{vp=e,lt=e},_setDisabled:e=>{e?lt=Ep:lt=vp}};function AD(e){let t=Je.Storage.getItem(e);try{return JSON.parse(t??"null")}catch{return a_.Log.error(`Failed to parse value for key "${e}"`),null}}Je._getObjectFromStorage=AD;function ID(e,t){Je.Storage.setItem(e,JSON.stringify(t))}Je._setObjectInStorage=ID});var p_=N(tr=>{"use strict";var u_=tr&&tr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(tr,"__esModule",{value:!0});tr._isDomainFailure=tr.NetworkFallbackResolver=void 0;var RD=i_(),PD=er(),DD=re(),Tp=ct(),l_=10080*60*1e3,ND=14400*1e3,kp=class{constructor(t){var r;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=(r=t.networkConfig)===null||r===void 0?void 0:r.networkOverrideFunc}setErrorBoundary(t){this._errorBoundary=t}tryBumpExpiryTime(t,r){var n;let o=(n=this._fallbackInfo)===null||n===void 0?void 0:n[r.endpoint];o&&(o.expiryTime=Date.now()+l_,Cp(t,Object.assign(Object.assign({},this._fallbackInfo),{[r.endpoint]:o})))}getActiveFallbackUrl(t,r){var n,o;if(r.customUrl!=null&&r.fallbackUrls!=null)return null;let i=this._fallbackInfo;i==null&&(i=(n=OD(t))!==null&&n!==void 0?n:{},this._fallbackInfo=i);let s=i[r.endpoint];return!s||Date.now()>((o=s.expiryTime)!==null&&o!==void 0?o:0)||r.getChecksum()!==s.urlConfigChecksum?(delete i[r.endpoint],this._fallbackInfo=i,Cp(t,this._fallbackInfo),null):s.url?s.url:null}tryFetchUpdatedFallbackInfo(t,r,n,o){return u_(this,void 0,void 0,function*(){var i,s;try{if(!c_(n,o))return!1;let u=r.customUrl==null&&r.fallbackUrls==null?yield this._tryFetchFallbackUrlsFromNetwork(r):r.fallbackUrls,l=this._pickNewFallbackUrl((i=this._fallbackInfo)===null||i===void 0?void 0:i[r.endpoint],u);return l?(this._updateFallbackInfoWithNewUrl(t,r,l),!0):!1}catch(a){return(s=this._errorBoundary)===null||s===void 0||s.logError("tryFetchUpdatedFallbackInfo",a),!1}})}_updateFallbackInfoWithNewUrl(t,r,n){var o,i,s;let a={urlConfigChecksum:r.getChecksum(),url:n,expiryTime:Date.now()+l_,previous:[]},u=r.endpoint,l=(o=this._fallbackInfo)===null||o===void 0?void 0:o[u];l&&a.previous.push(...l.previous),a.previous.length>10&&(a.previous=[]);let d=(s=(i=this._fallbackInfo)===null||i===void 0?void 0:i[u])===null||s===void 0?void 0:s.url;d!=null&&a.previous.push(d),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[u]:a}),Cp(t,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(t){return u_(this,void 0,void 0,function*(){var r;let n=this._dnsQueryCooldowns[t.endpoint];if(n&&Date.now()<n)return null;this._dnsQueryCooldowns[t.endpoint]=Date.now()+ND;let o=[],i=yield(0,RD._fetchTxtRecords)((r=this._networkOverrideFunc)!==null&&r!==void 0?r:fetch),s=MD(t.defaultUrl);for(let a of i){if(!a.startsWith(t.endpointDnsKey+"="))continue;let u=a.split("=");if(u.length>1){let l=u[1];l.endsWith("/")&&(l=l.slice(0,-1)),o.push(`https://${l}${s}`)}}return o})}_pickNewFallbackUrl(t,r){var n;if(r==null)return null;let o=new Set((n=t?.previous)!==null&&n!==void 0?n:[]),i=t?.url,s=null;for(let a of r){let u=a.endsWith("/")?a.slice(0,-1):a;if(!o.has(a)&&u!==i){s=u;break}}return s}};tr.NetworkFallbackResolver=kp;function c_(e,t){var r;let n=(r=e?.toLowerCase())!==null&&r!==void 0?r:"";return t||n.includes("uncaught exception")||n.includes("failed to fetch")||n.includes("networkerror when attempting to fetch resource")}tr._isDomainFailure=c_;function d_(e){return`statsig.network_fallback.${(0,PD._DJB2)(e)}`}function Cp(e,t){let r=d_(e);if(!t||Object.keys(t).length===0){Tp.Storage.removeItem(r);return}Tp.Storage.setItem(r,JSON.stringify(t))}function OD(e){let t=d_(e),r=Tp.Storage.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return DD.Log.error("Failed to parse FallbackInfo"),null}}function MD(e){try{return new URL(e).pathname}catch{return null}}});var Ap=N(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.SDKFlags=void 0;var f_={};Zu.SDKFlags={setFlags:(e,t)=>{f_[e]=t},get:(e,t)=>{var r,n;return(n=(r=f_[e])===null||r===void 0?void 0:r[t])!==null&&n!==void 0?n:!1}}});var Qu=N(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});Xu.getUUID=void 0;function FD(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(Math.random()*4)]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,n=>{let o=Math.random()*16;return e>0?(o=(e+o)%16|0,e=Math.floor(e/16)):(o=(t+o)%16|0,t=Math.floor(t/16)),(n==="x"?o:o&7|8).toString(16)})}Xu.getUUID=FD});var ao=N(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.StatsigSession=Dr.SessionID=void 0;var BD=Ji(),LD=re(),m_=ct(),UD=Qu(),jD=no(),qD=1800*1e3,$D=14400*1e3,zD=15e3,so={};(0,jD._subscribeToVisiblityChanged)(e=>{e==="background"&&Object.values(so).forEach(t=>Qi(t))});Dr.SessionID={get:e=>Dr.StatsigSession.get(e).data.sessionID};Dr.StatsigSession={get:(e,t=!0)=>{so[e]==null&&(so[e]=JD(e));let r=so[e];return WD(r,t)},overrideInitialSessionID:(e,t)=>{let r=Date.now(),n={data:{sessionID:e,startTime:r,lastUpdate:r},sdkKey:t,lastPersistedAt:Date.now(),storageKey:g_(t)};Qi(n),so[t]=n},checkForIdleSession:e=>{let t=so[e];if(!t)return;h_(t)&&Qi(t)}};function WD(e,t){let r=Date.now();return h_(e)?Qi(e):t&&(e.data.lastUpdate=r,GD(e)),e}function h_(e){var t;let r=e.data,n=HD(r)||VD(r);return n&&(e.data=b_(),(t=__STATSIG__==null?void 0:__STATSIG__.instance(e.sdkKey))===null||t===void 0||t.$emt({name:"session_expired"})),n}function HD({lastUpdate:e}){return Date.now()-e>qD}function VD({startTime:e}){return Date.now()-e>$D}function g_(e){return`statsig.session_id.${(0,BD._getStorageKey)(e)}`}function Qi(e){try{(0,m_._setObjectInStorage)(e.storageKey,e.data),e.lastPersistedAt=Date.now()}catch{LD.Log.warn("Failed to save SessionID")}}function GD(e){Date.now()-e.lastPersistedAt>zD&&Qi(e)}function KD(e){return(0,m_._getObjectFromStorage)(e)}function JD(e){let t=g_(e),r=KD(t);return r&&r.sessionID&&r.startTime&&r.lastUpdate?{data:r,sdkKey:e,lastPersistedAt:0,storageKey:t}:{data:b_(),sdkKey:e,lastPersistedAt:0,storageKey:t}}function b_(){return{sessionID:(0,UD.getUUID)(),startTime:Date.now(),lastUpdate:Date.now()}}});var lo=N(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.getCookieName=uo.StableID=void 0;var w_=Ji(),YD=re(),x_=Ke(),S_=ct(),ZD=Qu(),es={},Rp={},y_={};uo.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:e=>{if(y_[e])return null;if(es[e]!=null)return es[e];let t=null;return t=QD(e),t!=null?(es[e]=t,Ip(t,e),t):(t=XD(e),t==null&&(t=(0,ZD.getUUID)()),Ip(t,e),__(t,e),es[e]=t,t)},setOverride:(e,t)=>{es[t]=e,Ip(e,t),__(e,t)},_setCookiesEnabled:(e,t)=>{Rp[e]=t},_setDisabled:(e,t)=>{y_[e]=t}};function v_(e){return`statsig.stable_id.${(0,w_._getStorageKey)(e)}`}function Ip(e,t){let r=v_(t);try{(0,S_._setObjectInStorage)(r,e)}catch{YD.Log.warn("Failed to save StableID to storage")}}function XD(e){let t=v_(e);return(0,S_._getObjectFromStorage)(t)}function QD(e){if(!Rp[e]||(0,x_._getDocumentSafe)()==null)return null;let t=document.cookie.split(";");for(let r of t){let[n,o]=r.trim().split("=");if(n===Pp(e))return decodeURIComponent(o)}return null}function __(e,t){if(!Rp[t]||(0,x_._getDocumentSafe)()==null)return;let r=new Date;r.setFullYear(r.getFullYear()+1),document.cookie=`${Pp(t)}=${encodeURIComponent(e)}; expires=${r.toUTCString()}; path=/`}function Pp(e){return`statsig.stable_id.${(0,w_._getStorageKey)(e)}`}uo.getCookieName=Pp});var Dp=N(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.ErrorTag=void 0;el.ErrorTag={NetworkError:"NetworkError"}});var po=N(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});co.LoggingEnabledOption=co.LogEventCompressionMode=void 0;co.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"};co.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}});var Mp=N(It=>{"use strict";var tl=It&&It.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(It,"__esModule",{value:!0});It.NetworkCore=It.RETRYABLE_CODES=void 0;Qt();var k_=Qt(),Np=Uu(),Nr=re(),Ye=eo(),eN=p_(),tN=Ap(),A_=Yi(),I_=Ke(),R_=ao(),rN=lo(),nN=Dp(),P_=ro(),ts=po(),D_=no(),oN=1e4,iN=500,sN=3e4,aN=1e3,N_=50,uN=N_/aN;It.RETRYABLE_CODES=new Set([408,500,502,503,504,522,524,599]);var Op=class{constructor(t,r){this._emitter=r,this._errorBoundary=null,this._timeout=oN,this._netConfig={},this._options={},this._leakyBucket={},this._lastUsedInitUrl=null,t&&(this._options=t),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs),this._fallbackResolver=new eN.NetworkFallbackResolver(this._options),this.setLogEventCompressionMode(this._getLogEventCompressionMode(t))}setLogEventCompressionMode(t){this._options.logEventCompressionMode=t}setErrorBoundary(t){this._errorBoundary=t,this._errorBoundary.wrap(this),this._errorBoundary.wrap(this._fallbackResolver),this._fallbackResolver.setErrorBoundary(t)}isBeaconSupported(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}getLastUsedInitUrlAndReset(){let t=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,t}beacon(t,r){if(!E_(t))return r&&(r.path="beacon_invalid_sdk_key"),!1;let n=this._getInternalRequestArgs("POST",t),o=this._getPopulatedURL(n),i=navigator;try{let s=i.sendBeacon.bind(i)(o,n.body);return s||r&&(r.path="beacon_send_false"),s}catch(s){throw r&&(r.path="beacon_send_exception"),s}}post(t,r){return tl(this,void 0,void 0,function*(){let n=this._getInternalRequestArgs("POST",t);return this._tryEncodeBody(n),yield this._tryToCompressBody(n),this._sendRequest(n,r)})}get(t){let r=this._getInternalRequestArgs("GET",t);return this._sendRequest(r)}_sendRequest(t,r){return tl(this,void 0,void 0,function*(){var n,o,i,s;if(!E_(t))return r&&(r.path="network_invalid_sdk_key"),null;if(this._netConfig.preventAllNetworkTraffic)return r&&(r.path="network_prevent_all_network_traffic"),null;let{method:a,body:u,retries:l,attempt:d}=t,p=t.urlConfig.endpoint;if(this._isRateLimited(p))return Nr.Log.warn(`Request to ${p} was blocked because you are making requests too frequently.`),r&&(r.path="network_rate_limited"),null;let f=d??1,m=!1,h=this._getPopulatedURL(t),y=Date.now(),S=null,D=(0,D_._isUnloading)();try{let w={method:a,body:u,headers:Object.assign({},t.headers),priority:t.priority,keepalive:D};gN(t,f);let x=this._leakyBucket[p];x&&(x.lastRequestTime=Date.now(),this._leakyBucket[p]=x);let E=(n=this._netConfig.networkOverrideFunc)!==null&&n!==void 0?n:fetch,I;if(S=yield Promise.race([E(h,w).finally(()=>clearTimeout(I)),new Promise((j,X)=>{I=setTimeout(()=>{m=!0,X(new Error(`Timeout of ${this._timeout}ms expired.`))},this._timeout)})]),!S.ok){let j=yield S.text().catch(()=>"No Text"),X=new Error(`NetworkError: ${h} ${j}`);throw X.name="NetworkError",X}let C=yield S.text();return T_(t,S,f,C),this._fallbackResolver.tryBumpExpiryTime(t.sdkKey,t.urlConfig),{body:C,code:S.status}}catch(w){let x=dN(w),E=pN(x??"",m);if(T_(t,S,f,"",w),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(t.sdkKey,t.urlConfig,x,E))&&(t.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig)),!l||f>l||!It.RETRYABLE_CODES.has((o=S?.status)!==null&&o!==void 0?o:500)){(i=this._emitter)===null||i===void 0||i.call(this,{name:"error",error:w,tag:nN.ErrorTag.NetworkError,requestArgs:t});let C=`A networking error occurred during ${a} request to ${h}.`;if(Nr.Log.error(C,x,w),(s=this._errorBoundary)===null||s===void 0||s.attachErrorIfNoneExists(C),t.preserveFailedStatusCode&&S!=null)return{body:null,code:S.status};if(S==null&&r){r.path=E?"network_request_timed_out_no_response":"network_request_exception_no_response",x&&(r.errorMessage=x);try{let j=fN(t,h,E,Date.now()-y);r.diagnosticBucket=j.bucket,r.diagnosticMetadata=j.metadata}catch{}}return null}return yield bN(f),this._sendRequest(Object.assign(Object.assign({},t),{retries:l,attempt:f+1}),r)}})}_getLogEventCompressionMode(t){let r=t?.logEventCompressionMode;return!r&&t?.disableCompression===!0&&(r=ts.LogEventCompressionMode.Disabled),r||(r=ts.LogEventCompressionMode.Enabled),r}_isRateLimited(t){var r;let n=Date.now(),o=(r=this._leakyBucket[t])!==null&&r!==void 0?r:{count:0,lastRequestTime:n},i=n-o.lastRequestTime,s=Math.floor(i*uN);return o.count=Math.max(0,o.count-s),o.count>=N_?!0:(o.count+=1,o.lastRequestTime=n,this._leakyBucket[t]=o,!1)}_getPopulatedURL(t){var r;let n=(r=t.fallbackUrl)!==null&&r!==void 0?r:t.urlConfig.getUrl();(t.urlConfig.endpoint===Ye.Endpoint._initialize||t.urlConfig.endpoint===Ye.Endpoint._download_config_specs)&&(this._lastUsedInitUrl=n);let o=Object.assign({[Ye.NetworkParam.SdkKey]:t.sdkKey,[Ye.NetworkParam.SdkType]:A_.SDKType._get(t.sdkKey),[Ye.NetworkParam.SdkVersion]:P_.SDK_VERSION,[Ye.NetworkParam.Time]:String(Date.now()),[Ye.NetworkParam.SessionID]:R_.SessionID.get(t.sdkKey)},t.params),i=Object.keys(o).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(o[s])}`).join("&");return`${n}${i?`?${i}`:""}`}_tryEncodeBody(t){var r;let n=(0,I_._getWindowSafe)(),o=t.body;if(!(!t.isStatsigEncodable||this._options.disableStatsigEncoding||typeof o!="string"||(0,k_._getStatsigGlobalFlag)("no-encode")!=null||!n?.btoa))try{t.body=n.btoa(o).split("").reverse().join(""),t.params=Object.assign(Object.assign({},(r=t.params)!==null&&r!==void 0?r:{}),{[Ye.NetworkParam.StatsigEncoded]:"1"})}catch(i){Nr.Log.warn(`Request encoding failed for ${t.urlConfig.getUrl()}`,i)}}_tryToCompressBody(t){return tl(this,void 0,void 0,function*(){var r;let n=t.body;if(!(typeof n!="string"||!cN(t,this._options)))try{let o=new TextEncoder().encode(n),i=new CompressionStream("gzip"),s=i.writable.getWriter();s.write(o).catch(Nr.Log.error),s.close().catch(Nr.Log.error);let a=i.readable.getReader(),u=[],l;for(;!(l=yield a.read()).done;)u.push(l.value);let d=u.reduce((m,h)=>m+h.length,0),p=new Uint8Array(d),f=0;for(let m of u)p.set(m,f),f+=m.length;t.body=p,t.params=Object.assign(Object.assign({},(r=t.params)!==null&&r!==void 0?r:{}),{[Ye.NetworkParam.IsGzipped]:"1"})}catch(o){Nr.Log.warn(`Request compression failed for ${t.urlConfig.getUrl()}`,o)}})}_getInternalRequestArgs(t,r){let n=this._fallbackResolver.getActiveFallbackUrl(r.sdkKey,r.urlConfig),o=Object.assign(Object.assign({},r),{method:t,fallbackUrl:n});return"data"in r&&lN(o,r.data),o}};It.NetworkCore=Op;var E_=e=>e.sdkKey?!0:(Nr.Log.warn("Unable to make request without an SDK key"),!1),lN=(e,t)=>{let{sdkKey:r,fallbackUrl:n}=e,o=rN.StableID.get(r),i=R_.SessionID.get(r),s=A_.SDKType._get(r);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},P_.StatsigMetadataProvider.get()),{stableID:o,sessionID:i,sdkType:s,fallbackUrl:n})}))};function cN(e,t){if(!e.isCompressable||(0,k_._getStatsigGlobalFlag)("no-compress")!=null||typeof CompressionStream>"u"||typeof TextEncoder>"u")return!1;let r=e.urlConfig.customUrl!=null||e.urlConfig.fallbackUrls!=null,n=tN.SDKFlags.get(e.sdkKey,"enable_log_event_compression")===!0;switch(t.logEventCompressionMode){case ts.LogEventCompressionMode.Disabled:return!1;case ts.LogEventCompressionMode.Enabled:return!(r&&!n);case ts.LogEventCompressionMode.Forced:return!0;default:return!1}}function dN(e){return typeof e=="string"?e:e instanceof Error?`${e.name}: ${e.message}`:"Unknown Error"}function pN(e,t){return e.includes("Timeout")||t}function fN(e,t,r,n){var o,i,s;let a=(0,I_._getWindowSafe)(),u=a?.document,l=typeof navigator<"u"?navigator:null,d=(0,D_._isUnloading)(),p=l&&typeof l.onLine=="boolean"?String(l.onLine):"unknown",f=(o=u?.visibilityState)!==null&&o!==void 0?o:"unknown",m=Object.keys((i=e.headers)!==null&&i!==void 0?i:{}).length>0,h=mN(t,(s=a?.location)===null||s===void 0?void 0:s.origin),y=e.urlConfig.customUrl!=null,S=e.fallbackUrl!=null,D=C_(n,[250,1e3,5e3,1e4]),w=C_(hN(e.body),[16384,65536,262144,1048576]),x="unknown_no_response";return r?x="timeout":p==="false"?x="browser_offline":d?x="page_unloading":f==="hidden"?x="page_hidden":h&&m?x="cross_origin_custom_headers_preflight_risk":y||S?x="custom_url_no_response":n<250&&(x="immediate_network_rejection"),{bucket:x,metadata:{elapsedMsBucket:D,bodySizeBucket:w,online:p,visibilityState:f,isUnloading:String(d),crossOrigin:String(h),hasCustomUrl:String(y)}}}function mN(e,t){return t?!e.startsWith(`${t}/`)&&!e.startsWith(`${t}?`)&&e!==t:!0}function hN(e){return e==null?0:typeof e=="string"?e.length:e instanceof Uint8Array?e.byteLength:typeof Blob<"u"&&e instanceof Blob?e.size:-1}function C_(e,t){if(e<0)return"unknown";for(let r of t)if(e<r)return`<${r}`;return`>=${t[t.length-1]}`}function gN(e,t){e.urlConfig.endpoint===Ye.Endpoint._initialize&&Np.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}function T_(e,t,r,n,o){e.urlConfig.endpoint===Ye.Endpoint._initialize&&Np.Diagnostics._markInitNetworkReqEnd(e.sdkKey,Np.Diagnostics._getDiagnosticsData(t,r,n,o))}function bN(e){return tl(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(iN*(e*e),sN)))})}});var O_=N(fo=>{"use strict";var Or=fo&&fo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(fo,"__esModule",{value:!0});fo.FlushCoordinator=void 0;var rr=$u(),yN=t_(),_N=r_(),Mr=o_(),wN=er(),Ae=re(),xN=Mp(),SN=Ke(),rl=ao(),vN=po(),rs=ct(),EN=new Set(["network_request_timed_out_no_response","network_request_exception_no_response","event_sender_post_returned_null","event_sender_post_returned_undefined","event_sender_post_exception"]),Fp=class{constructor(t,r,n,o,i,s,a,u,l,d){this._cooldownTimer=null,this._maxIntervalTimer=null,this._hasRunQuickFlush=!1,this._currentFlushPromise=null,this._creationTime=Date.now(),this._isShuttingDown=!1,this._storageKey=null,this._flushInterval=new _N.FlushInterval,this._batchQueue=t,this._pendingEvents=r,this._onPrepareFlush=n,this._errorBoundary=d,this._sdkKey=o,this._loggingEnabled=l,this._eventSender=new yN.EventSender(o,i,s,a,u)}setLoggingEnabled(t){this._loggingEnabled=t}setLogEventCompressionMode(t){this._eventSender.setLogEventCompressionMode(t)}startScheduledFlushCycle(){this._scheduleNextFlush()}stopScheduledFlushCycle(){this._clearAllTimers()}addEvent(t){this._pendingEvents.addToPendingEventsQueue(t),!this._currentFlushPromise&&this._pendingEvents.hasEventsForFullBatch()&&this.processLimitFlush()}processManualFlush(){return Or(this,void 0,void 0,function*(){return this._currentFlushPromise&&(yield this._currentFlushPromise),this._currentFlushPromise=this._executeFlush(Mr.FlushType.Manual).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()}),this._currentFlushPromise})}processShutdown(){return Or(this,void 0,void 0,function*(){return this._isShuttingDown=!0,this._clearAllTimers(),this._currentFlushPromise&&(yield this._currentFlushPromise),this._currentFlushPromise=this._executeFlush(Mr.FlushType.Shutdown).catch(t=>{Ae.Log.error(`Error during shutdown flush: ${t}`)}).finally(()=>{this._currentFlushPromise=null}),this._currentFlushPromise})}_executeFlush(t){return Or(this,void 0,void 0,function*(){this._clearAllTimers();try{this._prepareQueueForFlush(t);let r=this._batchQueue.takeAllBatches();if(r.length===0)return;yield Promise.all(r.map(n=>this._processOneBatch(n,t)))}finally{this._isShuttingDown||this._scheduleNextFlush()}})}checkQuickFlush(){this._hasRunQuickFlush||Date.now()-this._creationTime>rr.EventRetryConstants.QUICK_FLUSH_WINDOW_MS||(this._hasRunQuickFlush=!0,setTimeout(()=>{this.processManualFlush().catch(t=>{Ae.Log.warn("Quick flush failed:",t)})},rr.EventRetryConstants.QUICK_FLUSH_WINDOW_MS))}_attemptScheduledFlush(){if(this._currentFlushPromise){this._scheduleNextFlush();return}let t=this.containsAtLeastOneFullBatch(),r=this._flushInterval.hasReachedMaxInterval();if(!t&&!r){this._scheduleNoopPollTick();return}this._flushInterval.markFlushAttempt();let n;t?n=Mr.FlushType.ScheduledFullBatch:n=Mr.FlushType.ScheduledMaxTime,this._currentFlushPromise=this._processNextBatch(n).then(()=>{}).catch(o=>{Ae.Log.error("Error during scheduled flush:",o)}).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()})}processLimitFlush(){this._flushInterval.hasCompletelyRecoveredFromBackoff()&&(this._currentFlushPromise||(this._currentFlushPromise=this._processLimitFlushInternal().catch(t=>{Ae.Log.error("Error during limit flush",t)}).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()})))}_processLimitFlushInternal(){return Or(this,void 0,void 0,function*(){if(yield this._processNextBatch(Mr.FlushType.Limit))for(;this._flushInterval.hasCompletelyRecoveredFromBackoff()&&this.containsAtLeastOneFullBatch()&&(yield this._processNextBatch(Mr.FlushType.Limit)););})}_scheduleNextFlush(){if(this._clearAllTimers(),this._isShuttingDown)return;let t=Math.max(0,this._flushInterval.getTimeUntilNextFlush());this._cooldownTimer=setTimeout(()=>{this._cooldownTimer=null,rl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},t);let r=Math.max(0,this._flushInterval.getTimeTillMaxInterval());this._maxIntervalTimer=setTimeout(()=>{this._maxIntervalTimer=null,rl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},r)}_clearAllTimers(){this._cooldownTimer!==null&&(clearTimeout(this._cooldownTimer),this._cooldownTimer=null),this._maxIntervalTimer!==null&&(clearTimeout(this._maxIntervalTimer),this._maxIntervalTimer=null)}_scheduleNoopPollTick(){if(this._clearAllTimers(),this._isShuttingDown)return;this._cooldownTimer=setTimeout(()=>{this._cooldownTimer=null,rl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},rr.EventRetryConstants.TICK_INTERVAL_MS);let t=Math.max(0,this._flushInterval.getTimeTillMaxInterval());this._maxIntervalTimer=setTimeout(()=>{this._maxIntervalTimer=null,rl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},t)}_processNextBatch(t){return Or(this,void 0,void 0,function*(){this._prepareQueueForFlush(t);let r=this._batchQueue.takeNextBatch();return r?this._processOneBatch(r,t):!1})}_processOneBatch(t,r){return Or(this,void 0,void 0,function*(){if(this._loggingEnabled!==vN.LoggingEnabledOption.always&&(0,SN._isServerEnv)())return this._flushInterval.adjustForSuccess(),!0;let n=yield this._eventSender.sendBatch(t);return n.success?(this._flushInterval.adjustForSuccess(),!0):(this._flushInterval.adjustForFailure(),this._handleFailure(t,r,n.statusCode,n.failurePath,n.failureErrorMessage,n.failureDiagnosticBucket,n.failureDiagnosticMetadata),!1)})}_prepareQueueForFlush(t){this._onPrepareFlush();let r=this.convertPendingEventsToBatches();r>0&&(Ae.Log.warn(`Dropped ${r} events`),this._errorBoundary.logDroppedEvents(r,"Batch queue limit reached during batching",{loggingInterval:this._flushInterval.getCurrentIntervalMs(),batchSize:this._batchQueue.batchSize(),maxPendingBatches:rr.EventRetryConstants.MAX_PENDING_BATCHES,flushType:t,retries:"dropped before batching"}))}containsAtLeastOneFullBatch(){return this._pendingEvents.hasEventsForFullBatch()||this._batchQueue.hasFullBatch()}convertPendingEventsToBatches(){if(this._pendingEvents.isEmpty())return 0;let t=this._pendingEvents.takeAll();return this._batchQueue.createBatches(t)}_isRetryableBatch(t,r){return!!(xN.RETRYABLE_CODES.has(t)||t===-1&&r&&EN.has(r))}_handleFailure(t,r,n,o,i,s,a){if(r===Mr.FlushType.Shutdown){Ae.Log.warn(`${r} flush failed during shutdown. ${t.events.length} event(s) will be saved to storage for retry in next session.`),this._saveShutdownFailedEventsToStorage(t.events);return}if(!this._isRetryableBatch(n,o)){let l="non-retryable error";Ae.Log.warn(`${r} flush failed after ${t.attempts} attempt(s). ${t.events.length} event(s) will be dropped. Non-retryable error: ${n}`),this._errorBoundary.logEventRequestFailure(t.events.length,l,r,n,t.attempts,o,i,s,a);return}if(t.attempts>=rr.EventRetryConstants.MAX_RETRY_ATTEMPTS){let l="max retry attempts exceeded";Ae.Log.warn(`${r} flush failed after ${t.attempts} attempt(s). ${t.events.length} event(s) will be dropped.`),this._errorBoundary.logEventRequestFailure(t.events.length,l,r,n,t.attempts,o,i,s,a);return}t.incrementAttempts();let u=this._batchQueue.requeueBatch(t);u>0&&(Ae.Log.warn(`Failed to requeue batch : dropped ${u} events due to full queue`),this._errorBoundary.logDroppedEvents(u,"Batch queue limit reached during requeue",{loggingInterval:this._flushInterval.getCurrentIntervalMs(),batchSize:this._batchQueue.batchSize(),maxPendingBatches:rr.EventRetryConstants.MAX_PENDING_BATCHES,flushType:r,retries:t.attempts}))}loadAndRetryShutdownFailedEvents(){return Or(this,void 0,void 0,function*(){let t=this._getStorageKey();try{rs.Storage.isReady()||(yield rs.Storage.isReadyResolver());let r=this._getShutdownFailedEventsFromStorage(t);if(r.length===0)return;Ae.Log.debug(`Loading ${r.length} failed shutdown event(s) from storage for retry`),rs.Storage.removeItem(t),r.forEach(n=>{this.addEvent(n)}),yield this.processManualFlush()}catch(r){Ae.Log.warn("Failed to load and retry failed shutdown events:",r)}})}_getStorageKey(){return this._storageKey||(this._storageKey=`statsig.failed_shutdown_events.${(0,wN._DJB2)(this._sdkKey)}`),this._storageKey}_saveShutdownFailedEventsToStorage(t){let r=this._getStorageKey();try{let o=[...this._getShutdownFailedEventsFromStorage(r),...t];o.length>rr.EventRetryConstants.MAX_LOCAL_STORAGE&&(o=o.slice(-rr.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,rs._setObjectInStorage)(r,o),Ae.Log.debug(`Saved ${t.length} failed shutdown event(s) to storage (total stored: ${o.length})`)}catch(n){Ae.Log.warn("Unable to save failed shutdown events to storage:",n)}}_getShutdownFailedEventsFromStorage(t){try{let r=(0,rs._getObjectFromStorage)(t);return Array.isArray(r)?r:[]}catch{return[]}}};fo.FlushCoordinator=Fp});var M_=N(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});nl.PendingEvents=void 0;var CN=re(),Bp=class{constructor(t){this._pendingEvents=[],this._batchSize=t}addToPendingEventsQueue(t){this._pendingEvents.push(t),CN.Log.debug("Enqueued Event:",t)}hasEventsForFullBatch(){return this._pendingEvents.length>=this._batchSize}takeAll(){let t=this._pendingEvents;return this._pendingEvents=[],t}isEmpty(){return this._pendingEvents.length===0}};nl.PendingEvents=Bp});var Up=N(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe._createLayerParameterExposure=Oe._createConfigExposure=Oe._mapExposures=Oe._createGateExposure=Oe._isExposureEvent=void 0;var F_="statsig::config_exposure",B_="statsig::gate_exposure",L_="statsig::layer_exposure",Lp=(e,t,r,n,o)=>(r.bootstrapMetadata&&(n.bootstrapMetadata=r.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:RN(r,n),secondaryExposures:o,time:Date.now()}),TN=({eventName:e})=>e===B_||e===F_||e===L_;Oe._isExposureEvent=TN;var kN=(e,t,r)=>{var n,o,i;let s={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return((n=t.__evaluation)===null||n===void 0?void 0:n.version)!=null&&(s.configVersion=t.__evaluation.version),Lp(B_,e,t.details,s,ol((i=(o=t.__evaluation)===null||o===void 0?void 0:o.secondary_exposures)!==null&&i!==void 0?i:[],r))};Oe._createGateExposure=kN;function ol(e,t){return e.map(r=>typeof r=="string"?(t??{})[r]:r).filter(r=>r!=null)}Oe._mapExposures=ol;var AN=(e,t,r)=>{var n,o,i,s;let a={config:t.name,ruleID:t.ruleID};return((n=t.__evaluation)===null||n===void 0?void 0:n.version)!=null&&(a.configVersion=t.__evaluation.version),((o=t.__evaluation)===null||o===void 0?void 0:o.passed)!=null&&(a.rulePassed=String(t.__evaluation.passed)),Lp(F_,e,t.details,a,ol((s=(i=t.__evaluation)===null||i===void 0?void 0:i.secondary_exposures)!==null&&s!==void 0?s:[],r))};Oe._createConfigExposure=AN;var IN=(e,t,r,n)=>{var o,i,s,a,u,l,d;let p=t.__evaluation,f=((o=p?.explicit_parameters)===null||o===void 0?void 0:o.includes(r))===!0,m="",h=(i=p?.undelegated_secondary_exposures)!==null&&i!==void 0?i:[];f&&(m=(s=p.allocated_experiment_name)!==null&&s!==void 0?s:"",h=(a=p.secondary_exposures)!==null&&a!==void 0?a:[]);let y=(u=t.__evaluation)===null||u===void 0?void 0:u.parameter_rule_ids,S={config:t.name,parameterName:r,ruleID:(l=y?.[r])!==null&&l!==void 0?l:t.ruleID,allocatedExperiment:m,isExplicitParameter:String(f)};return((d=t.__evaluation)===null||d===void 0?void 0:d.version)!=null&&(S.configVersion=t.__evaluation.version),Lp(L_,e,t.details,S,ol(h,n))};Oe._createLayerParameterExposure=IN;var RN=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)});var qp=N(sl=>{"use strict";Object.defineProperty(sl,"__esModule",{value:!0});sl.UrlConfiguration=void 0;var PN=er(),il=eo(),DN={[il.Endpoint._initialize]:"i",[il.Endpoint._rgstr]:"e",[il.Endpoint._download_config_specs]:"d"},jp=class{constructor(t,r,n,o){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=DN[t],r&&(this.customUrl=r),!r&&n&&(this.customUrl=n.endsWith("/")?`${n}${t}`:`${n}/${t}`),o&&(this.fallbackUrls=o);let i=il.NetworkDefault[t];this.defaultUrl=`${i}/${t}`}getUrl(){var t;return(t=this.customUrl)!==null&&t!==void 0?t:this.defaultUrl}getChecksum(){var t;let r=((t=this.fallbackUrls)!==null&&t!==void 0?t:[]).sort().join(",");return(0,PN._DJB2)(this.customUrl+r)}};sl.UrlConfiguration=jp});var Gp=N(mo=>{"use strict";var U_=mo&&mo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(mo,"__esModule",{value:!0});mo.EventLogger=void 0;var NN=Jy(),ON=Ji(),$p=$u(),MN=O_(),FN=er(),ns=re(),BN=eo(),LN=M_(),zp=Ke(),UN=Up(),j_=po(),Wp=ct(),jN=qp(),qN=no(),$N=1e3,zN=6e5,Hp={},Vp=class e{static _safeFlushAndForget(t){var r;(r=Hp[t])===null||r===void 0||r.flush().catch(()=>{})}constructor(t,r,n,o,i){var s;this._sdkKey=t,this._emitter=r,this._network=n,this._options=o,this._errorBoundary=i,this._pendingEvents=null,this._batchQueue=null,this._flushCoordinator=null,this._lastExposureTimeMap={},this._nonExposedChecks={},this._isShuttingDown=!1,this._storageKey=null,this._pendingCompressionMode=null,this._loggingEnabled=(s=o?.loggingEnabled)!==null&&s!==void 0?s:o?.disableLogging===!0?j_.LoggingEnabledOption.disabled:j_.LoggingEnabledOption.browserOnly,o?.loggingEnabled&&o.disableLogging!==void 0&&ns.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging.");let a=o?.networkConfig;this._logEventUrlConfig=new jN.UrlConfiguration(BN.Endpoint._rgstr,a?.logEventUrl,a?.api,a?.logEventFallbackUrls)}setLogEventCompressionMode(t){this._flushCoordinator?this._flushCoordinator.setLogEventCompressionMode(t):this._pendingCompressionMode=t}setLoggingEnabled(t){let r=this._loggingEnabled==="disabled",n=t!=="disabled";if(this._loggingEnabled=t,this._flushCoordinator&&this._flushCoordinator.setLoggingEnabled(t),r&&n){let o=this._loadStoredEvents();ns.Log.debug(`Loaded ${o.length} stored event(s) from storage`),o.length>0&&(o.forEach(i=>{this._initFlushCoordinator().addEvent(i)}),this.flush().catch(i=>{ns.Log.warn("Failed to flush events after enabling logging:",i)}))}}enqueue(t){var r;if(!this._shouldLogEvent(t))return;let n=this._normalizeEvent(t);if(this._loggingEnabled==="disabled"){this._storeEventToStorage(n);return}this._initFlushCoordinator().addEvent(n),(r=this._flushCoordinator)===null||r===void 0||r.checkQuickFlush()}incrementNonExposureCount(t){var r;let n=(r=this._nonExposedChecks[t])!==null&&r!==void 0?r:0;this._nonExposedChecks[t]=n+1}reset(){this.flush().catch(()=>{}),this._lastExposureTimeMap={}}start(){var t;let r=(0,zp._isServerEnv)();if(r&&((t=this._options)===null||t===void 0?void 0:t.loggingEnabled)!=="always")return;let n=this._initFlushCoordinator();Hp[this._sdkKey]=this,r||(0,qN._subscribeToVisiblityChanged)(o=>{o==="background"?e._safeFlushAndForget(this._sdkKey):o==="foreground"&&n.startScheduledFlushCycle()}),n.loadAndRetryShutdownFailedEvents().catch(o=>{ns.Log.warn("Failed to load failed shutdown events:",o)}),n.startScheduledFlushCycle()}stop(){return U_(this,void 0,void 0,function*(){this._isShuttingDown=!0,this._flushCoordinator&&(yield this._flushCoordinator.processShutdown()),delete Hp[this._sdkKey],this._flushCoordinator=null,this._pendingEvents=null,this._batchQueue=null})}flush(){return U_(this,void 0,void 0,function*(){if(this._flushCoordinator)return this._flushCoordinator.processManualFlush()})}appendAndResetNonExposedChecks(){if(Object.keys(this._nonExposedChecks).length===0)return;let t=Object.assign({},this._nonExposedChecks);this._nonExposedChecks={};let r=this._normalizeEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:t}});this._flushCoordinator&&this._flushCoordinator.addEvent(r)}_shouldLogEvent(t){var r;if(((r=this._options)===null||r===void 0?void 0:r.loggingEnabled)!=="always"&&(0,zp._isServerEnv)())return!1;if(!(0,UN._isExposureEvent)(t))return!0;let n=t.user?t.user:{statsigEnvironment:void 0},o=(0,ON._getUserStorageKey)(this._sdkKey,n),i=t.metadata?t.metadata:{},s=[t.eventName,o,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),a=this._lastExposureTimeMap[s],u=Date.now();return a&&u-a<zN?!1:(Object.keys(this._lastExposureTimeMap).length>$N&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[s]=u,!0)}_getCurrentPageUrl(){var t;if(((t=this._options)===null||t===void 0?void 0:t.includeCurrentPageUrlWithEvents)!==!1)return(0,zp._getCurrentPageUrlSafe)()}_getStorageKey(){return this._storageKey||(this._storageKey=`statsig.pending_events.${(0,FN._DJB2)(this._sdkKey)}`),this._storageKey}_initFlushCoordinator(){var t,r;if(this._flushCoordinator)return this._flushCoordinator;let n=(r=(t=this._options)===null||t===void 0?void 0:t.loggingBufferMaxSize)!==null&&r!==void 0?r:$p.EventRetryConstants.DEFAULT_BATCH_SIZE;return this._pendingEvents=new LN.PendingEvents(n),this._batchQueue=new NN.BatchQueue(n),this._flushCoordinator=new MN.FlushCoordinator(this._batchQueue,this._pendingEvents,()=>this.appendAndResetNonExposedChecks(),this._sdkKey,this._network,this._emitter,this._logEventUrlConfig,this._options,this._loggingEnabled,this._errorBoundary),this._pendingCompressionMode&&(this._flushCoordinator.setLogEventCompressionMode(this._pendingCompressionMode),this._pendingCompressionMode=null),this._flushCoordinator}_storeEventToStorage(t){let r=this._getStorageKey();try{let n=this._getEventsFromStorage(r);n.push(t),n.length>$p.EventRetryConstants.MAX_LOCAL_STORAGE&&(n=n.slice(-$p.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,Wp._setObjectInStorage)(r,n)}catch{ns.Log.warn("Unable to save events to storage")}}_getEventsFromStorage(t){try{let r=(0,Wp._getObjectFromStorage)(t);return Array.isArray(r)?r:[]}catch{return[]}}_loadStoredEvents(){let t=this._getStorageKey(),r=this._getEventsFromStorage(t);return r.length>0&&Wp.Storage.removeItem(t),r}_normalizeEvent(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);let r={},n=this._getCurrentPageUrl();return n&&(r.statsigMetadata={currentPage:n}),Object.assign(Object.assign({},t),r)}};mo.EventLogger=Vp});var q_=N(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.PrecomputedEvaluationsContextHandle=void 0;var WN=re(),HN=Ke(),VN=ao(),GN=lo(),Kp=class{constructor(t,r,n,o,i,s){this._sdkKey=t,this._getOptions=r,this._getErrorBoundary=n,this._getValues=o,this._getUser=i,this._getSdkInstanceID=s}get sdkKey(){return this._sdkKey}get options(){return this._getOptions()}get errorBoundary(){return this._getErrorBoundary()}get values(){return this._getValues()}get user(){let t=(0,HN._cloneObject)("StatsigUser",this._getUser());return t==null&&(WN.Log.error("Failed to clone user"),t={}),t}getSession(t=!0){return VN.StatsigSession.get(this._sdkKey,t)}get stableID(){return GN.StableID.get(this._sdkKey)}get sdkInstanceID(){return this._getSdkInstanceID()}toContext(t=!0){return{sdkKey:this.sdkKey,options:this.options,values:this.values,user:this.user,errorBoundary:this.errorBoundary,session:this.getSession(t),stableID:this.stableID,sdkInstanceID:this.sdkInstanceID}}};al.PrecomputedEvaluationsContextHandle=Kp});var Jp=N(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr._getUnitIDFromUser=nr._getFullUserHash=nr._normalizeUser=void 0;var KN=er(),JN=re(),YN=Ke();function ZN(e,t,r){let n=(0,YN._cloneObject)("StatsigUser",e);return n==null?(JN.Log.error("Failed to clone user"),{statsigEnvironment:void 0}):(t!=null&&t.environment!=null?n.statsigEnvironment=t.environment:r!=null&&(n.statsigEnvironment={tier:r}),n)}nr._normalizeUser=ZN;function XN(e){return e?(0,KN._DJB2Object)(e):null}nr._getFullUserHash=XN;function QN(e,t){var r,n,o;if(typeof t!="string")return e.userID;let i=t.toLowerCase();return i!=="userid"?(n=(r=e.customIDs)===null||r===void 0?void 0:r[t])!==null&&n!==void 0?n:(o=e.customIDs)===null||o===void 0?void 0:o[i]:e.userID}nr._getUnitIDFromUser=QN});var Yp=N(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul._typedJsonParse=void 0;var eO=re();function tO(e,t,r){try{let n=JSON.parse(e);if(n&&typeof n=="object"&&t in n)return n}catch{}return eO.Log.error(`Failed to parse ${r}`),null}ul._typedJsonParse=tO});var H_=N(ir=>{"use strict";var Zp=ir&&ir.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(ir,"__esModule",{value:!0});ir._makeDataAdapterResult=ir.DataAdapterCore=void 0;var ll=re(),$_=lo(),cl=Jp(),or=ct(),z_=Yp(),rO=10,nO=8,Xp=class{constructor(t,r){this._adapterName=t,this._cacheSuffix=r,this._options=null,this._sdkKey=null,this._cacheLimit=rO,this._lastModifiedStoreKey=`statsig.last_modified_time.${r}`,this._inMemoryCache=new Qp}attach(t,r,n){this._sdkKey=t,this._options=r}getDataSync(t){let r=t&&(0,cl._normalizeUser)(t,this._options),n=this._getCacheKey(r),o=this._inMemoryCache.get(n,r);if(o&&this._getIsCacheValueValid(o))return o;let i=this._loadFromCache(n);return i&&this._getIsCacheValueValid(i)?(this._inMemoryCache.add(n,i,this._cacheLimit),this._inMemoryCache.get(n,r)):null}setData(t,r){let n=r&&(0,cl._normalizeUser)(r,this._options),o=this._getCacheKey(n);this._inMemoryCache.add(o,dl("Bootstrap",t,null,n),this._cacheLimit)}_getIsCacheValueValid(t){return t.stableID==null||t.stableID===$_.StableID.get(this._getSdkKey())}_getDataAsyncImpl(t,r,n){return Zp(this,void 0,void 0,function*(){or.Storage.isReady()||(yield or.Storage.isReadyResolver());let o=t??this.getDataSync(r),i=[this._fetchAndPrepFromNetwork(o,r,n)];return n?.timeoutMs&&i.push(new Promise(s=>setTimeout(s,n.timeoutMs)).then(()=>(ll.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(i)})}_prefetchDataImpl(t,r){return Zp(this,void 0,void 0,function*(){let n=t&&(0,cl._normalizeUser)(t,this._options),o=this._getCacheKey(n),i=yield this._getDataAsyncImpl(null,n,r);i&&this._inMemoryCache.add(o,Object.assign(Object.assign({},i),{source:"Prefetch"}),this._cacheLimit)})}_fetchAndPrepFromNetwork(t,r,n){return Zp(this,void 0,void 0,function*(){var o;let i=(o=t?.data)!==null&&o!==void 0?o:null,s=t!=null&&this._isCachedResultValidFor204(t,r),a=yield this._fetchFromNetwork(i,r,n,s);if(!a)return ll.Log.debug("No response returned for latest value"),null;let u=(0,z_._typedJsonParse)(a,"has_updates","Response"),l=this._getSdkKey(),d=$_.StableID.get(l),p=null;if(u?.has_updates===!0)p=dl("Network",a,d,r);else if(i&&u?.has_updates===!1)p=dl("NetworkNotModified",i,d,r);else return null;let f=this._getCacheKey(r);return this._inMemoryCache.add(f,p,this._cacheLimit),this._writeToCache(f,p),p})}_getSdkKey(){return this._sdkKey!=null?this._sdkKey:(ll.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(t){var r;let n=(r=or.Storage.getItem)===null||r===void 0?void 0:r.call(or.Storage,t);if(n==null)return null;let o=(0,z_._typedJsonParse)(n,"source","Cached Result");return o?Object.assign(Object.assign({},o),{source:"Cache"}):null}_writeToCache(t,r){let n=JSON.stringify(r);for(let o=0;o<nO;o++)try{or.Storage.setItem(t,n);break}catch(i){if(!(i instanceof Error)||!(i.toString().includes("QuotaExceededError")||i.toString().includes("QUOTA_EXCEEDED_ERR"))||this._cacheLimit<=1)throw i;this._cacheLimit=Math.ceil(this._cacheLimit/2),this._runLocalStorageCacheEviction(t,this._cacheLimit-1)}this._runLocalStorageCacheEviction(t)}_runLocalStorageCacheEviction(t,r=this._cacheLimit){var n;let o=(n=(0,or._getObjectFromStorage)(this._lastModifiedStoreKey))!==null&&n!==void 0?n:{};o[t]=Date.now();let i=W_(o,r);for(let s of i)delete o[s],or.Storage.removeItem(s);(0,or._setObjectInStorage)(this._lastModifiedStoreKey,o)}};ir.DataAdapterCore=Xp;function dl(e,t,r,n){return{source:e,data:t,receivedAt:Date.now(),stableID:r,fullUserHash:(0,cl._getFullUserHash)(n)}}ir._makeDataAdapterResult=dl;var Qp=class{constructor(){this._data={}}get(t,r){var n;let o=this._data[t],i=o?.stableID,s=(n=r?.customIDs)===null||n===void 0?void 0:n.stableID;return s&&i&&s!==i?(ll.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):o}add(t,r,n){let o=W_(this._data,n-1);for(let i of o)delete this._data[i];this._data[t]=r}merge(t){this._data=Object.assign(Object.assign({},this._data),t)}};function W_(e,t){let r=Object.keys(e);return r.length<=t?[]:t===0?r:r.sort((n,o)=>{let i=e[n],s=e[o];return typeof i=="object"&&typeof s=="object"?i.receivedAt-s.receivedAt:i-s}).slice(0,r.length-t)}});var G_=N(V_=>{"use strict";Object.defineProperty(V_,"__esModule",{value:!0})});var tf=N(Rt=>{"use strict";var oO=Rt&&Rt.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.ErrorBoundary=Rt.EXCEPTION_ENDPOINT=void 0;var iO=re(),sO=Yi(),aO=ro();Rt.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";var J_="[Statsig] UnknownError",ef=class{constructor(t,r,n,o){this._sdkKey=t,this._options=r,this._emitter=n,this._lastSeenError=o,this._seen=new Set}wrap(t,r){try{let n=t;lO(n).forEach(o=>{let i=n[o];"$EB"in i||(n[o]=(...s)=>this._capture(r?`${r}:${o}`:o,()=>i.apply(t,s)),n[o].$EB=!0)})}catch(n){this._onError("eb:wrap",n)}}logError(t,r){this._onError(t,r)}logDroppedEvents(t,r,n){let o={eventCount:String(t),reason:r};n&&Object.keys(n).forEach(i=>{o[i]=String(n[i])}),this._onError("statsig::log_event_dropped_event_count",new Error(r),!0,o)}logEventRequestFailure(t,r,n,o,i,s,a,u,l){let d={eventCount:String(t),flushType:n,statusCode:String(o),reason:r,retries:String(i)};s&&(d.failurePath=s),typeof a=="string"&&a.length>0&&(d.failureErrorMessage=a),typeof u=="string"&&u.length>0&&(d.failureDiagnosticBucket=u),l&&Object.keys(l).forEach(p=>{let f=l[p];f.length>0&&(d[`failureDiagnostic_${p}`]=f)}),this._onError("statsig::log_event_failed",new Error(r),!0,d)}getLastSeenErrorAndReset(){let t=this._lastSeenError;return this._lastSeenError=void 0,t??null}attachErrorIfNoneExists(t){this._lastSeenError||(this._lastSeenError=K_(t))}_capture(t,r){try{let n=r();return n&&n instanceof Promise?n.catch(o=>this._onError(t,o)):n}catch(n){return this._onError(t,n),null}}_onError(t,r,n=!1,o){try{iO.Log.warn(`Caught error in ${t}`,{error:r}),oO(this,void 0,void 0,function*(){var s,a,u,l,d,p,f;let m=r||Error(J_),h=m instanceof Error,y=h?m.name:"No Name",S=K_(m);if(this._lastSeenError=S,!n&&this._seen.has(y))return;if(this._seen.add(y),!((a=(s=this._options)===null||s===void 0?void 0:s.networkConfig)===null||a===void 0)&&a.preventAllNetworkTraffic){(u=this._emitter)===null||u===void 0||u.call(this,{name:"error",error:r,tag:t});return}let D=sO.SDKType._get(this._sdkKey),w=aO.StatsigMetadataProvider.get(),x=h?m.stack:uO(m),E=Object.assign(Object.assign({tag:t,exception:y,info:x,statsigOptions:cO(this._options)},Object.assign(Object.assign({},w),{sdkType:D})),o??{}),I=(l=this._options)===null||l===void 0?void 0:l.networkConfig;yield((d=I?.networkOverrideFunc)!==null&&d!==void 0?d:fetch)((p=I?.sdkExceptionUrl)!==null&&p!==void 0?p:Rt.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(D),"STATSIG-SDK-VERSION":String(w.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(E)}),(f=this._emitter)===null||f===void 0||f.call(this,{name:"error",error:r,tag:t})}).then(()=>{}).catch(()=>{})}catch{}}};Rt.ErrorBoundary=ef;function K_(e){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error("An unknown error occurred.")}function uO(e){try{return JSON.stringify(e)}catch{return J_}}function lO(e){let t=new Set,r=Object.getPrototypeOf(e);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).filter(n=>typeof r?.[n]=="function").forEach(n=>t.add(n)),r=Object.getPrototypeOf(r);return Array.from(t)}function cO(e){if(!e)return{};let t={};return Object.keys(e).forEach(r=>{let n=r,o=e[n];switch(typeof o){case"number":case"bigint":case"boolean":t[String(n)]=o;break;case"string":o.length<50?t[String(n)]=o:t[String(n)]="set";break;case"object":n==="environment"?t.environment=o:n==="networkConfig"?t.networkConfig=o:t[String(n)]=o!=null?"set":"unset";break;default:}}),t}});var Z_=N(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0})});var Q_=N(X_=>{"use strict";Object.defineProperty(X_,"__esModule",{value:!0})});var tw=N(ew=>{"use strict";Object.defineProperty(ew,"__esModule",{value:!0})});var rf=N(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.createMemoKey=ho.MemoPrefix=void 0;ho.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_configList:"cl",_layer:"l",_paramStore:"p"};var dO=new Set([]),pO=new Set(["userPersistedValues"]);function fO(e,t,r){let n=`${e}|${t}`;if(!r)return n;for(let o of Object.keys(r)){if(pO.has(o))return;dO.has(o)?n+=`|${o}=true`:n+=`|${o}=${r[o]}`}return n}ho.createMemoKey=fO});var nw=N(rw=>{"use strict";Object.defineProperty(rw,"__esModule",{value:!0})});var iw=N(ow=>{"use strict";Object.defineProperty(ow,"__esModule",{value:!0})});var sw=N(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os._fastApproxSizeOf=void 0;var mO=2,hO=1,gO=(e,t)=>{let r=0,n=Object.keys(e);for(let o=0;o<n.length;o++){let i=n[o],s=e[i];if(r+=i.length,typeof s=="object"&&s!==null?r+=(0,os._fastApproxSizeOf)(s,t)+mO:r+=String(s).length+hO,r>=t)return r}return r};os._fastApproxSizeOf=gO});var aw=N(go=>{"use strict";var bO=go&&go.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(go,"__esModule",{value:!0});go.StatsigClientBase=void 0;Qt();var yO=Qt(),_O=tf(),wO=Gp(),of=re(),xO=rf(),SO=Ke(),vO=ao(),nf=lo(),EO=po(),pl=ct(),CO=3e3,sf=class{constructor(t,r,n,o){var i,s,a,u;this.loadingStatus="Uninitialized",this._initializePromise=null,this._listeners={};let l=this.$emt.bind(this);o?.logLevel!=null&&(of.Log.level=o.logLevel),o?.disableStorage&&pl.Storage._setDisabled(!0),o?.initialSessionID&&vO.StatsigSession.overrideInitialSessionID(o.initialSessionID,t),o?.storageProvider&&pl.Storage._setProvider(o.storageProvider),o?.enableCookies&&nf.StableID._setCookiesEnabled(t,o.enableCookies),o?.disableStableID&&nf.StableID._setDisabled(t,!0),this._sdkKey=t,this._options=o??{},this._memoCache={},this.overrideAdapter=(i=o?.overrideAdapter)!==null&&i!==void 0?i:null,this._errorBoundary=new _O.ErrorBoundary(t,o,l),this._logger=new wO.EventLogger(t,l,n,o,this._errorBoundary),this._errorBoundary.wrap(this),this._errorBoundary.wrap(r),this._errorBoundary.wrap(this._logger),n.setErrorBoundary(this._errorBoundary),this.dataAdapter=r,this.dataAdapter.attach(t,o,n),this.storageProvider=pl.Storage,(u=(a=(s=this.overrideAdapter)===null||s===void 0?void 0:s.loadFromStorage)===null||a===void 0?void 0:a.call(s))===null||u===void 0||u.catch(d=>this._errorBoundary.logError("OA::loadFromStorage",d)),this._primeReadyRipcord(),TO(t,this)}updateRuntimeOptions(t){t.loggingEnabled?(this._options.loggingEnabled=t.loggingEnabled,this._logger.setLoggingEnabled(t.loggingEnabled)):t.disableLogging!=null&&(this._options.disableLogging=t.disableLogging,this._logger.setLoggingEnabled(t.disableLogging?"disabled":"browser-only")),t.disableStorage!=null&&(this._options.disableStorage=t.disableStorage,pl.Storage._setDisabled(t.disableStorage)),t.enableCookies!=null&&(this._options.enableCookies=t.enableCookies,nf.StableID._setCookiesEnabled(this._sdkKey,t.enableCookies)),t.logEventCompressionMode?this._logger.setLogEventCompressionMode(t.logEventCompressionMode):t.disableCompression&&this._logger.setLogEventCompressionMode(EO.LogEventCompressionMode.Disabled)}flush(){return this._logger.flush()}shutdown(){return bO(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this._setStatus("Uninitialized",null),this._initializePromise=null,yield this._logger.stop()})}on(t,r){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(r)}off(t,r){if(this._listeners[t]){let n=this._listeners[t].indexOf(r);n!==-1&&this._listeners[t].splice(n,1)}}$on(t,r){r.__isInternal=!0,this.on(t,r)}$emt(t){var r;let n=o=>{try{o(t)}catch(i){if(o.__isInternal===!0){this._errorBoundary.logError(`__emit:${t.name}`,i);return}of.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",t)}};this._listeners[t.name]&&this._listeners[t.name].forEach(o=>n(o)),(r=this._listeners["*"])===null||r===void 0||r.forEach(n)}_setStatus(t,r){this.loadingStatus=t,this._memoCache={},this.$emt({name:"values_updated",status:t,values:r})}_enqueueExposure(t,r,n){if(n?.disableExposureLog===!0){this._logger.incrementNonExposureCount(t);return}this._logger.enqueue(r)}_memoize(t,r){return(n,o)=>{if(this._options.disableEvaluationMemoization)return r(n,o);let i=(0,xO.createMemoKey)(t,n,o);return i?(i in this._memoCache||(Object.keys(this._memoCache).length>=CO&&(this._memoCache={}),this._memoCache[i]=r(n,o)),this._memoCache[i]):r(n,o)}}};go.StatsigClientBase=sf;function TO(e,t){var r;if((0,SO._isServerEnv)())return;let n=(0,yO._getStatsigGlobal)(),o=(r=n.instances)!==null&&r!==void 0?r:{},i=t;o[e]!=null&&of.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),o[e]=i,n.firstInstance||(n.firstInstance=i),n.instances=o,__STATSIG__=n}});var uw=N(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.DataAdapterCachePrefix=void 0;fl.DataAdapterCachePrefix="statsig.cached"});var cw=N(lw=>{"use strict";Object.defineProperty(lw,"__esModule",{value:!0})});var pw=N(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee._makeTypedGet=Ee._mergeOverride=Ee._makeLayer=Ee._makeExperiment=Ee._makeDynamicConfig=Ee._makeFeatureGate=void 0;var kO=re(),AO=Wu();function af(e,t,r,n){var o;return{name:e,details:t,ruleID:(o=r?.rule_id)!==null&&o!==void 0?o:"",__evaluation:r,value:n}}function IO(e,t,r){var n;return Object.assign(Object.assign({},af(e,t,r,r?.value===!0)),{idType:(n=r?.id_type)!==null&&n!==void 0?n:null})}Ee._makeFeatureGate=IO;function dw(e,t,r){var n,o;let i=(n=r?.value)!==null&&n!==void 0?n:{};return Object.assign(Object.assign({},af(e,t,r,i)),{idType:(o=r?.id_type)!==null&&o!==void 0?o:null,get:ml(e,r?.value)})}Ee._makeDynamicConfig=dw;function RO(e,t,r){var n;let o=dw(e,t,r);return Object.assign(Object.assign({},o),{groupName:(n=r?.group_name)!==null&&n!==void 0?n:null})}Ee._makeExperiment=RO;function PO(e,t,r,n){var o,i;return Object.assign(Object.assign({},af(e,t,r,void 0)),{get:ml(e,r?.value,n),groupName:(o=r?.group_name)!==null&&o!==void 0?o:null,__value:(i=r?.value)!==null&&i!==void 0?i:{}})}Ee._makeLayer=PO;function DO(e,t,r,n){return Object.assign(Object.assign(Object.assign({},e),t),{get:ml(e.name,r,n)})}Ee._mergeOverride=DO;function ml(e,t,r){return(n,o)=>{var i;let s=(i=t?.[n])!==null&&i!==void 0?i:null;return s==null?o??null:o!=null&&!(0,AO._isTypeMatch)(s,o)?(kO.Log.warn(`Parameter type mismatch. '${e}.${n}' was found to be type '${typeof s}' but fallback/return type is '${typeof o}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),o??null):(r?.(n),s)}}Ee._makeTypedGet=ml});var mw=N(fw=>{"use strict";Object.defineProperty(fw,"__esModule",{value:!0})});var hw=N(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.UPDATE_DETAIL_ERROR_MESSAGES=bo.createUpdateDetails=void 0;var NO=(e,t,r,n,o,i)=>({duration:r,source:t,success:e,error:n,sourceUrl:o,warnings:i});bo.createUpdateDetails=NO;bo.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}});var Ze=N(F=>{"use strict";var OO=F&&F.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),H=F&&F.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&OO(t,e,r)};Object.defineProperty(F,"__esModule",{value:!0});F.Storage=F.Log=F.EventLogger=F.Diagnostics=void 0;Qt();var MO=Qt(),FO=Uu();Object.defineProperty(F,"Diagnostics",{enumerable:!0,get:function(){return FO.Diagnostics}});var BO=Gp();Object.defineProperty(F,"EventLogger",{enumerable:!0,get:function(){return BO.EventLogger}});var gw=re();Object.defineProperty(F,"Log",{enumerable:!0,get:function(){return gw.Log}});var LO=ro(),UO=ct();Object.defineProperty(F,"Storage",{enumerable:!0,get:function(){return UO.Storage}});H(Qt(),F);H(Ji(),F);H(q_(),F);H(H_(),F);H(Uu(),F);H(G_(),F);H(tf(),F);H(Z_(),F);H(Q_(),F);H(er(),F);H(tw(),F);H(re(),F);H(rf(),F);H(eo(),F);H(Mp(),F);H(nw(),F);H(iw(),F);H(Ke(),F);H(Yi(),F);H(ao(),F);H(sw(),F);H(lo(),F);H(aw(),F);H(Dp(),F);H(uw(),F);H(Up(),F);H(ro(),F);H(po(),F);H(cw(),F);H(pw(),F);H(mw(),F);H(Jp(),F);H(ct(),F);H(Yp(),F);H(Wu(),F);H(qp(),F);H(Qu(),F);H(no(),F);H(hw(),F);H(Ap(),F);Object.assign((0,MO._getStatsigGlobal)(),{Log:gw.Log,SDK_VERSION:LO.SDK_VERSION})});var bw=N(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});hl.V1InitializeContainer=void 0;var jO=Ze(),uf=class{constructor(t){this._values=t}getGate(t){return this._getResultFromLookup(this._values.feature_gates,t)}getConfig(t){return this._getResultFromLookup(this._values.dynamic_configs,t)}getLayer(t){return this._getResultFromLookup(this._values.layer_configs,t)}getParamStore(t){return this._getResultFromLookup(this._values.param_stores,t)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(t,r){var n,o;return t&&(o=(n=t[r])!==null&&n!==void 0?n:t[(0,jO._DJB2)(r)])!==null&&o!==void 0?o:null}};hl.V1InitializeContainer=uf});var yw=N(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.V2InitializeContainer=void 0;var qO=Ze(),lf=class{constructor(t){this._values=t}getGate(t){var r,n,o;let i=this._getResultFromLookup(this._values.feature_gates,t);return i?{name:t,value:i.v===!0,rule_id:(r=i.r)!==null&&r!==void 0?r:"default",secondary_exposures:(n=i.s)!==null&&n!==void 0?n:[],id_type:(o=i.i)!==null&&o!==void 0?o:""}:null}getConfig(t){var r,n,o,i;let s=this._getResultFromLookup(this._values.dynamic_configs,t);return s?{name:t,value:(r=this._values.values[s.v])!==null&&r!==void 0?r:{},rule_id:s.r,secondary_exposures:(n=s.s)!==null&&n!==void 0?n:[],id_type:(o=s.i)!==null&&o!==void 0?o:"",is_user_in_experiment:s.ue===!0,passed:s.p===!0,group_name:(i=s.gn)!==null&&i!==void 0?i:void 0,is_experiment_active:s.ea===!0,group:s.r,is_device_based:s.i==="stableID"}:null}getLayer(t){var r,n,o,i,s,a;let u=this._getResultFromLookup(this._values.layer_configs,t);return u?{name:t,value:(r=this._values.values[u.v])!==null&&r!==void 0?r:{},rule_id:u.r,secondary_exposures:(n=u.s)!==null&&n!==void 0?n:[],is_user_in_experiment:u.ue===!0,group_name:(o=u.gn)!==null&&o!==void 0?o:void 0,is_experiment_active:u.ea===!0,group:u.r,is_device_based:u.i==="stableID",allocated_experiment_name:(i=u.ae)!==null&&i!==void 0?i:"",explicit_parameters:(s=u.ep)!==null&&s!==void 0?s:[],undelegated_secondary_exposures:(a=u.us)!==null&&a!==void 0?a:[],parameter_rule_ids:u.pr}:null}getParamStore(t){return this._getResultFromLookup(this._values.param_stores,t)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(t,r){var n,o;return t&&(o=(n=t[r])!==null&&n!==void 0?n:t[(0,qO._DJB2)(r)])!==null&&o!==void 0?o:null}};gl.V2InitializeContainer=lf});var _w=N(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var yo=Ze(),$O=bw(),zO=yw(),cf=class{constructor(t,r){this._sdkKey=t,this._options=r,this._valuesForExternalUse=null,this._values=null,this._source="Uninitialized",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings=new Set}reset(){this._values=null,this._valuesForExternalUse=null,this._source="Loading",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings.clear()}finalize(){this._values||(this._source="NoValues")}getValues(){return this._valuesForExternalUse}setValues(t,r){var n,o;if(!t)return!1;let i=(0,yo._typedJsonParse)(t.data,"has_updates","EvaluationResponse");return i==null?!1:(this._source=t.source,i?.has_updates!==!0||((n=i.time)!==null&&n!==void 0?n:0)<this._lcut||(this._valuesForExternalUse=(0,yo._typedJsonParse)(t.data,"has_updates","EvaluationResponse"),this._lcut=i.time,this._receivedAt=t.receivedAt,i.response_format==="init-v2"?this._values=new zO.V2InitializeContainer(i):this._values=new $O.V1InitializeContainer(i),this._bootstrapMetadata=this._extractBootstrapMetadata(t.source,i),t.source&&i.user&&this._setWarningState(r,i),yo.SDKFlags.setFlags(this._sdkKey,(o=i.sdk_flags)!==null&&o!==void 0?o:{})),!0)}getWarnings(){if(this._warnings.size!==0)return Array.from(this._warnings)}getGate(t){let r=this._values?this._values.getGate(t):null;return this._getDetailedStoreResult(r)}getConfig(t){let r=this._values?this._values.getConfig(t):null;return this._getDetailedStoreResult(r)}getConfigList(){return this._values?this._values.getConfigList():[]}getLayer(t){let r=this._values?this._values.getLayer(t):null;return this._getDetailedStoreResult(r)}getParamStore(t){let r=this._values?this._values.getParamStore(t):null;return this._getDetailedStoreResult(r)}getSource(){return this._source}getExposureMapping(){var t;return(t=this._values)===null||t===void 0?void 0:t.getExposureMapping()}_extractBootstrapMetadata(t,r){if(t!=="Bootstrap")return null;let n={};return r.user&&(n.user=r.user),r.sdkInfo&&(n.generatorSDKInfo=r.sdkInfo),n.lcut=r.time,n}_getDetailedStoreResult(t){return{result:t,details:this._getDetails(t==null)}}_setWarningState(t,r){var n,o,i;let s=yo.StableID.get(this._sdkKey);if(((n=t.customIDs)===null||n===void 0?void 0:n.stableID)!==s&&(!((o=t.customIDs)===null||o===void 0)&&o.stableID||s)){this._warnings.add("StableIDMismatch");return}if("user"in r){let a=r.user,u=Object.assign(Object.assign({},t),{analyticsOnlyMetadata:void 0,privateAttributes:void 0});!((i=this._options)===null||i===void 0)&&i.disableStableID&&(u=Object.assign(Object.assign({},u),{customIDs:Object.assign(Object.assign({},u.customIDs),{stableID:void 0})}),a=Object.assign(Object.assign({},a),{customIDs:Object.assign(Object.assign({},a.customIDs),{stableID:void 0})})),(0,yo._getFullUserHash)(u)!==(0,yo._getFullUserHash)(a)&&this._warnings.add("PartialUserMatch")}}getCurrentSourceDetails(){if(this._source==="Uninitialized"||this._source==="NoValues")return{reason:this._source};let t={reason:this._source,lcut:this._lcut,receivedAt:this._receivedAt};return this._warnings.size>0&&(t.warnings=Array.from(this._warnings)),t}_getDetails(t){var r,n;let o=this.getCurrentSourceDetails(),i=o.reason,s=(r=o.warnings)!==null&&r!==void 0?r:[];this._source==="Bootstrap"&&s.length>0&&(i=i+s[0]),i!=="Uninitialized"&&i!=="NoValues"&&(i=`${i}:${t?"Unrecognized":"Recognized"}`);let a=this._source==="Bootstrap"&&(n=this._bootstrapMetadata)!==null&&n!==void 0?n:void 0;return a&&(o.bootstrapMetadata=a),Object.assign(Object.assign({},o),{reason:i})}};df.default=cf});var xw=N(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});bl._resolveDeltasResponse=void 0;var ww=Ze(),WO=2;function HO(e,t){let r=(0,ww._typedJsonParse)(t,"checksum","DeltasEvaluationResponse");if(!r)return{hadBadDeltaChecksum:!0};let n=VO(e,r),o=GO(n),i=(0,ww._DJB2Object)({feature_gates:o.feature_gates,dynamic_configs:o.dynamic_configs,layer_configs:o.layer_configs},WO);return i===r.checksumV2?JSON.stringify(o):{hadBadDeltaChecksum:!0,badChecksum:i,badMergedConfigs:o,badFullResponse:r.deltas_full_response}}bl._resolveDeltasResponse=HO;function VO(e,t){return Object.assign(Object.assign(Object.assign({},e),t),{feature_gates:Object.assign(Object.assign({},e.feature_gates),t.feature_gates),layer_configs:Object.assign(Object.assign({},e.layer_configs),t.layer_configs),dynamic_configs:Object.assign(Object.assign({},e.dynamic_configs),t.dynamic_configs)})}function GO(e){let t=e;return pf(e.deleted_gates,t.feature_gates),delete t.deleted_gates,pf(e.deleted_configs,t.dynamic_configs),delete t.deleted_configs,pf(e.deleted_layers,t.layer_configs),delete t.deleted_layers,t}function pf(e,t){e?.forEach(r=>{delete t[r]})}});var mf=N(is=>{"use strict";var Sw=is&&is.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(is,"__esModule",{value:!0});var yl=Ze(),KO=xw(),ff=class extends yl.NetworkCore{constructor(t,r){super(t,r);let n=t?.networkConfig;this._option=t,this._initializeUrlConfig=new yl.UrlConfiguration(yl.Endpoint._initialize,n?.initializeUrl,n?.api,n?.initializeFallbackUrls)}fetchEvaluations(t,r,n,o,i){return Sw(this,void 0,void 0,function*(){var s,a,u,l,d,p;let f=r?(0,yl._typedJsonParse)(r,"has_updates","InitializeResponse"):null,m={user:o,hash:(u=(a=(s=this._option)===null||s===void 0?void 0:s.networkConfig)===null||a===void 0?void 0:a.initializeHashAlgorithm)!==null&&u!==void 0?u:"djb2",deltasResponseRequested:!1,full_checksum:null};if(f?.has_updates){let h=f?.hash_used!==((p=(d=(l=this._option)===null||l===void 0?void 0:l.networkConfig)===null||d===void 0?void 0:d.initializeHashAlgorithm)!==null&&p!==void 0?p:"djb2");m=Object.assign(Object.assign({},m),{sinceTime:i&&!h?f.time:0,previousDerivedFields:"derived_fields"in f&&i?f.derived_fields:{},deltasResponseRequested:!0,full_checksum:f.full_checksum,partialUserMatchSinceTime:h?0:f.time})}return this._fetchEvaluations(t,f,m,n)})}_fetchEvaluations(t,r,n,o){return Sw(this,void 0,void 0,function*(){var i,s;let a=yield this.post({sdkKey:t,urlConfig:this._initializeUrlConfig,data:n,retries:2,isStatsigEncodable:!0,priority:o});if(a?.code===204)return'{"has_updates": false}';if(a?.code!==200)return(i=a?.body)!==null&&i!==void 0?i:null;if(r?.has_updates!==!0||((s=a.body)===null||s===void 0?void 0:s.includes('"is_delta":true'))!==!0||n.deltasResponseRequested!==!0)return a.body;let u=(0,KO._resolveDeltasResponse)(r,a.body);return typeof u=="string"?u:this._fetchEvaluations(t,r,Object.assign(Object.assign(Object.assign({},n),u),{deltasResponseRequested:!1}),o)})}};is.default=ff});var Ew=N(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl._makeParamStoreGetter=void 0;var vw=Ze(),_l={disableExposureLog:!0};function wl(e){return e==null||e.disableExposureLog===!1}function hf(e,t){return t!=null&&!(0,vw._isTypeMatch)(e,t)}function JO(e,t){return e.value}function YO(e,t,r){return e.getFeatureGate(t.gate_name,wl(r)?void 0:_l).value?t.pass_value:t.fail_value}function ZO(e,t,r,n){let i=e.getDynamicConfig(t.config_name,wl(n)?void 0:_l).get(t.param_name);return hf(i,r)?r:i}function XO(e,t,r,n){let i=e.getExperiment(t.experiment_name,wl(n)?void 0:_l).get(t.param_name);return hf(i,r)?r:i}function QO(e,t,r,n){let i=e.getLayer(t.layer_name,wl(n)?void 0:_l).get(t.param_name);return hf(i,r)?r:i}function eM(e,t,r){return(n,o)=>{if(t==null)return o;let i=t[n];if(i==null||o!=null&&(0,vw._typeOf)(o)!==i.param_type)return o;switch(i.ref_type){case"static":return JO(i,r);case"gate":return YO(e,i,r);case"dynamic_config":return ZO(e,i,o,r);case"experiment":return XO(e,i,o,r);case"layer":return QO(e,i,o,r);default:return o}}}xl._makeParamStoreGetter=eM});var Tw=N(_o=>{"use strict";var tM=_o&&_o.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(_o,"__esModule",{value:!0});_o.StatsigEvaluationsDataAdapter=void 0;var Fr=Ze(),Cw=mf(),gf=class extends Fr.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this._network=null,this._options=null}attach(t,r,n){super.attach(t,r,n),n!==null&&n instanceof Cw.default?this._network=n:this._network=new Cw.default(r??{})}getDataAsync(t,r,n){return this._getDataAsyncImpl(t,(0,Fr._normalizeUser)(r,this._options),n)}prefetchData(t,r){return this._prefetchDataImpl(t,r)}setData(t){let r=(0,Fr._typedJsonParse)(t,"has_updates","data");r&&"user"in r?super.setData(t,r.user):Fr.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,r){super.setData(t,r)}_fetchFromNetwork(t,r,n,o){return tM(this,void 0,void 0,function*(){var i;let s=yield(i=this._network)===null||i===void 0?void 0:i.fetchEvaluations(this._getSdkKey(),t,n?.priority,r,o);return s??null})}_getCacheKey(t){var r;let n=(0,Fr._getStorageKey)(this._getSdkKey(),t,(r=this._options)===null||r===void 0?void 0:r.customUserCacheKeyFunc);return`${Fr.DataAdapterCachePrefix}.${this._cacheSuffix}.${n}`}_isCachedResultValidFor204(t,r){return t.fullUserHash!=null&&t.fullUserHash===(0,Fr._getFullUserHash)(r)}};_o.StatsigEvaluationsDataAdapter=gf});var Aw=N(ss=>{"use strict";var Sl=ss&&ss.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(ss,"__esModule",{value:!0});var L=Ze(),rM=_w(),nM=mf(),kw=Ew(),oM=Tw(),bf=class e extends L.StatsigClientBase{static instance(t){let r=(0,L._getStatsigGlobal)().instance(t);return r instanceof e?r:(L.Log.warn((0,L._isServerEnv)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new e(t??"",{}))}constructor(t,r,n=null){var o,i;L.SDKType._setClientType(t,"javascript-client");let s=new nM.default(n,u=>{this.$emt(u)});super(t,(o=n?.dataAdapter)!==null&&o!==void 0?o:new oM.StatsigEvaluationsDataAdapter,s,n),this._possibleFirstTouchMetadata={},this.getFeatureGate=this._memoize(L.MemoPrefix._gate,this._getFeatureGateImpl.bind(this)),this.getDynamicConfig=this._memoize(L.MemoPrefix._dynamicConfig,this._getDynamicConfigImpl.bind(this)),this.getExperiment=this._memoize(L.MemoPrefix._experiment,this._getExperimentImpl.bind(this)),this.getConfigList=this._memoize(L.MemoPrefix._configList,this._getConfigListImpl.bind(this)),this.getLayer=this._memoize(L.MemoPrefix._layer,this._getLayerImpl.bind(this)),this.getParameterStore=this._memoize(L.MemoPrefix._paramStore,this._getParameterStoreImpl.bind(this)),this._store=new rM.default(t,n??null),this._network=s,this._user=this._configureUser(r,n),this._sdkInstanceID=(0,L.getUUID)(),this._contextHandle=new L.PrecomputedEvaluationsContextHandle(t,()=>this._options,()=>this._errorBoundary,()=>this._store.getValues(),()=>this._user,()=>this._sdkInstanceID);let a=(i=n?.plugins)!==null&&i!==void 0?i:[];for(let u of a)u.bind(this)}initializeSync(t){var r;return this.loadingStatus!=="Uninitialized"?(0,L.createUpdateDetails)(!0,this._store.getSource(),-1,null,null,["MultipleInitializations",...(r=this._store.getWarnings())!==null&&r!==void 0?r:[]]):(this._logger.start(),this.updateUserSync(this._user,t))}initializeAsync(t){return Sl(this,void 0,void 0,function*(){return this._initializePromise?this._initializePromise:(this._initializePromise=this._initializeAsyncImpl(t),this._initializePromise)})}updateUserSync(t,r){let n=performance.now();try{return this._updateUserSyncImpl(t,r,n)}catch(o){let i=o instanceof Error?o:new Error(String(o));return this._createErrorUpdateDetails(i,n)}}_updateUserSyncImpl(t,r,n){var o;let i=[...(o=this._store.getWarnings())!==null&&o!==void 0?o:[]];this._resetForUser(t);let s=this.dataAdapter.getDataSync(this._user);s==null&&i.push("NoCachedValues"),this._store.setValues(s,this._user),this._finalizeUpdate(s);let a=r?.disableBackgroundCacheRefresh;return a===!0||a==null&&s?.source==="Bootstrap"?(0,L.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),i):(this._runPostUpdate(s??null,this._user),(0,L.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),i))}updateUserAsync(t,r){return Sl(this,void 0,void 0,function*(){let n=performance.now();try{return yield this._updateUserAsyncImpl(t,r)}catch(o){let i=o instanceof Error?o:new Error(String(o));return this._createErrorUpdateDetails(i,n)}})}_updateUserAsyncImpl(t,r){return Sl(this,void 0,void 0,function*(){this._resetForUser(t);let n=this._user;L.Diagnostics._markInitOverallStart(this._sdkKey);let o=this.dataAdapter.getDataSync(n);if(this._store.setValues(o,this._user),this._setStatus("Loading",o),o=yield this.dataAdapter.getDataAsync(o,n,r),n!==this._user)return(0,L.createUpdateDetails)(!1,this._store.getSource(),-1,new Error("User changed during update"),this._network.getLastUsedInitUrlAndReset());let i=!1;o!=null&&(L.Diagnostics._markInitProcessStart(this._sdkKey),i=this._store.setValues(o,this._user),L.Diagnostics._markInitProcessEnd(this._sdkKey,{success:i})),this._finalizeUpdate(o),i||(this._errorBoundary.attachErrorIfNoneExists(L.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),L.Diagnostics._markInitOverallEnd(this._sdkKey,i,this._store.getCurrentSourceDetails());let s=L.Diagnostics._enqueueDiagnosticsEvent(this._user,this._logger,this._sdkKey,this._options);return(0,L.createUpdateDetails)(i,this._store.getSource(),s,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),this._store.getWarnings())})}getContext(){let t=(0,L._cloneObject)("StatsigUser",this._user);return t==null&&(L.Log.error("Failed to clone user"),t={}),{sdkKey:this._sdkKey,options:this._options,values:this._store.getValues(),user:t,errorBoundary:this._errorBoundary,session:L.StatsigSession.get(this._sdkKey),stableID:L.StableID.get(this._sdkKey),sdkInstanceID:this._sdkInstanceID}}getContextHandle(){return this._contextHandle}checkGate(t,r){return this.getFeatureGate(t,r).value}logEvent(t,r,n){let o=typeof t=="string"?{eventName:t,value:r,metadata:n}:t;this.$emt({name:"log_event_called",event:o}),this._logger.enqueue(Object.assign(Object.assign({},o),{user:this._user,time:Date.now()}))}updateUserWithAnalyticsOnlyMetadata(t){this._user=this._configureUser(Object.assign(Object.assign({},this._user),{analyticsOnlyMetadata:t}),this._options)}_primeReadyRipcord(){this.$on("error",()=>{this.loadingStatus==="Loading"&&this._finalizeUpdate(null)})}_initializeAsyncImpl(t){return Sl(this,void 0,void 0,function*(){return L.Storage.isReady()||(yield L.Storage.isReadyResolver()),this._logger.start(),this.updateUserAsync(this._user,t)})}_createErrorUpdateDetails(t,r){var n;return(0,L.createUpdateDetails)(!1,this._store.getSource(),performance.now()-r,t,null,[...(n=this._store.getWarnings())!==null&&n!==void 0?n:[]])}_finalizeUpdate(t){this._store.finalize(),this._setStatus("Ready",t)}_runPostUpdate(t,r){this.dataAdapter.getDataAsync(t,r,{priority:"low"}).catch(n=>{L.Log.error("An error occurred after update.",n)})}_resetForUser(t){this._logger.reset(),this._store.reset(),this._user=this._configureUser(t,this._options)}_configureUser(t,r){var n,o,i;let s=(0,L._normalizeUser)(t,r),a=(n=s.customIDs)===null||n===void 0?void 0:n.stableID;if(a){let u=(i=(o=this.storageProvider).isReadyResolver)===null||i===void 0?void 0:i.call(o);u?u.then(()=>L.StableID.setOverride(a,this._sdkKey),()=>L.StableID.setOverride(a,this._sdkKey)):L.StableID.setOverride(a,this._sdkKey)}return Object.keys(this._possibleFirstTouchMetadata).length>0&&(s.analyticsOnlyMetadata=Object.assign(Object.assign({},s.analyticsOnlyMetadata),this._possibleFirstTouchMetadata)),s}_getFeatureGateImpl(t,r){var n,o;let{result:i,details:s}=this._store.getGate(t);this._checkUserHasIdForEvaluation(i?.id_type,t,"Gate"),this._checkInitializationStatus(s.reason);let a=(0,L._makeFeatureGate)(t,s,i),u=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getGateOverride)===null||o===void 0?void 0:o.call(n,a,this._user,r),l=u??a;return this._enqueueExposure(t,(0,L._createGateExposure)(this._user,l,this._store.getExposureMapping()),r),this.$emt({name:"gate_evaluation",gate:l}),l}_getDynamicConfigImpl(t,r){var n,o;let{result:i,details:s}=this._store.getConfig(t);this._checkUserHasIdForEvaluation(i?.id_type,t,"Dynamic config"),this._checkInitializationStatus(s.reason);let a=(0,L._makeDynamicConfig)(t,s,i),u=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getDynamicConfigOverride)===null||o===void 0?void 0:o.call(n,a,this._user,r),l=u??a;return this._enqueueExposure(t,(0,L._createConfigExposure)(this._user,l,this._store.getExposureMapping()),r),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:l}),l}_getExperimentImpl(t,r){var n,o,i,s;let{result:a,details:u}=this._store.getConfig(t);this._checkUserHasIdForEvaluation(a?.id_type,t,"Experiment"),this._checkInitializationStatus(u.reason);let l=(0,L._makeExperiment)(t,u,a);l.__evaluation!=null&&(l.__evaluation.secondary_exposures=(0,L._mapExposures)((o=(n=l.__evaluation)===null||n===void 0?void 0:n.secondary_exposures)!==null&&o!==void 0?o:[],this._store.getExposureMapping()));let d=(s=(i=this.overrideAdapter)===null||i===void 0?void 0:i.getExperimentOverride)===null||s===void 0?void 0:s.call(i,l,this._user,r),p=d??l;return this._enqueueExposure(t,(0,L._createConfigExposure)(this._user,p,this._store.getExposureMapping()),r),this.$emt({name:"experiment_evaluation",experiment:p}),p}_getConfigListImpl(){return this._store.getConfigList()}_getLayerImpl(t,r){var n,o,i;let{result:s,details:a}=this._store.getLayer(t),u=(0,L._makeLayer)(t,a,s),l=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getLayerOverride)===null||o===void 0?void 0:o.call(n,u,this._user,r);r?.disableExposureLog&&this._logger.incrementNonExposureCount(t);let d=(0,L._mergeOverride)(u,l,(i=l?.__value)!==null&&i!==void 0?i:u.__value,p=>{r?.disableExposureLog||this._enqueueExposure(t,(0,L._createLayerParameterExposure)(this._user,d,p,this._store.getExposureMapping()),r)});return this.$emt({name:"layer_evaluation",layer:d}),d}_getParameterStoreImpl(t,r){var n,o;let{result:i,details:s}=this._store.getParamStore(t);this._logger.incrementNonExposureCount(t);let a={name:t,details:s,__configuration:i,get:(0,kw._makeParamStoreGetter)(this,i,r)},u=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getParamStoreOverride)===null||o===void 0?void 0:o.call(n,a,r);return u!=null&&(a.__configuration=u.config,a.details=u.details,a.get=(0,kw._makeParamStoreGetter)(this,u.config,r)),a}_checkUserHasIdForEvaluation(t,r,n){t&&((0,L._getUnitIDFromUser)(this._user,t)||L.Log.warn(`The user does not have the required id_type "${t}" for ${n} "${r}"`))}_checkInitializationStatus(t){(t==="Uninitialized"||t.startsWith("Loading"))&&L.Log.warn(`SDK initialization has not completed. Reason: ${t}`)}};ss.default=bf});var Rw=N(dt=>{"use strict";var iM=dt&&dt.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),sM=dt&&dt.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&iM(t,e,r)};Object.defineProperty(dt,"__esModule",{value:!0});dt.StatsigClient=void 0;var aM=Ze(),Iw=Aw();dt.StatsigClient=Iw.default;sM(Ze(),dt);var uM=Object.assign((0,aM._getStatsigGlobal)(),{StatsigClient:Iw.default});dt.default=uM});var xC=N((gue,wC)=>{"use strict";var uU=/^xn--/,lU=/[^\0-\x7F]/,cU=/[\x2E\u3002\uFF0E\uFF61]/g,dU={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Gm=35,St=Math.floor,Km=String.fromCharCode;function fr(e){throw new RangeError(dU[e])}function pU(e,t){let r=[],n=e.length;for(;n--;)r[n]=t(e[n]);return r}function hC(e,t){let r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(cU,".");let o=e.split("."),i=pU(o,t).join(".");return n+i}function gC(e){let t=[],r=0,n=e.length;for(;r<n;){let o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){let i=e.charCodeAt(r++);(i&64512)==56320?t.push(((o&1023)<<10)+(i&1023)+65536):(t.push(o),r--)}else t.push(o)}return t}var fU=e=>String.fromCodePoint(...e),mU=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},mC=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},bC=function(e,t,r){let n=0;for(e=r?St(e/700):e>>1,e+=St(e/t);e>Gm*26>>1;n+=36)e=St(e/Gm);return St(n+(Gm+1)*e/(e+38))},yC=function(e){let t=[],r=e.length,n=0,o=128,i=72,s=e.lastIndexOf("-");s<0&&(s=0);for(let a=0;a<s;++a)e.charCodeAt(a)>=128&&fr("not-basic"),t.push(e.charCodeAt(a));for(let a=s>0?s+1:0;a<r;){let u=n;for(let d=1,p=36;;p+=36){a>=r&&fr("invalid-input");let f=mU(e.charCodeAt(a++));f>=36&&fr("invalid-input"),f>St((2147483647-n)/d)&&fr("overflow"),n+=f*d;let m=p<=i?1:p>=i+26?26:p-i;if(f<m)break;let h=36-m;d>St(2147483647/h)&&fr("overflow"),d*=h}let l=t.length+1;i=bC(n-u,l,u==0),St(n/l)>2147483647-o&&fr("overflow"),o+=St(n/l),n%=l,t.splice(n++,0,o)}return String.fromCodePoint(...t)},_C=function(e){let t=[];e=gC(e);let r=e.length,n=128,o=0,i=72;for(let u of e)u<128&&t.push(Km(u));let s=t.length,a=s;for(s&&t.push("-");a<r;){let u=2147483647;for(let d of e)d>=n&&d<u&&(u=d);let l=a+1;u-n>St((2147483647-o)/l)&&fr("overflow"),o+=(u-n)*l,n=u;for(let d of e)if(d<n&&++o>2147483647&&fr("overflow"),d===n){let p=o;for(let f=36;;f+=36){let m=f<=i?1:f>=i+26?26:f-i;if(p<m)break;let h=p-m,y=36-m;t.push(Km(mC(m+h%y,0))),p=St(h/y)}t.push(Km(mC(p,0))),i=bC(o,l,a===s),o=0,++a}++o,++n}return t.join("")},hU=function(e){return hC(e,function(t){return uU.test(t)?yC(t.slice(4).toLowerCase()):t})},gU=function(e){return hC(e,function(t){return lU.test(t)?"xn--"+_C(t):t})},bU={version:"2.3.1",ucs2:{decode:gC,encode:fU},decode:yC,encode:_C,toASCII:gU,toUnicode:hU};wC.exports=bU});import*as wb from"node:os";var R=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var $=globalThis;var qe="10.48.0";function he(){return qt($),$}function qt(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||qe,t[qe]=t[qe]||{}}function $e(e,t,r=$){let n=r.__SENTRY__=r.__SENTRY__||{},o=n[qe]=n[qe]||{};return o[e]||(o[e]=t())}var oi=["debug","info","warn","error","log","assert","trace"],qk="Sentry Logger ",yn={};function pe(e){if(!("console"in $))return e();let t=$.console,r={},n=Object.keys(yn);n.forEach(o=>{let i=yn[o];r[o]=t[o],t[o]=i});try{return e()}finally{n.forEach(o=>{t[o]=r[o]})}}function $k(){Yc().enabled=!0}function zk(){Yc().enabled=!1}function Fh(){return Yc().enabled}function Wk(...e){Jc("log",...e)}function Hk(...e){Jc("warn",...e)}function Vk(...e){Jc("error",...e)}function Jc(e,...t){R&&Fh()&&pe(()=>{$.console[e](`${qk}[${e}]:`,...t)})}function Yc(){return R?$e("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var b={enable:$k,disable:zk,isEnabled:Fh,log:Wk,warn:Hk,error:Vk};var Bh=/\(error: (.*)\)/,Lh=/captureMessage|captureException/;function Xa(...e){let t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,o=0)=>{let i=[],s=r.split(`
`);for(let a=n;a<s.length;a++){let u=s[a];u.length>1024&&(u=u.slice(0,1024));let l=Bh.test(u)?u.replace(Bh,"$1"):u;if(!l.includes("Error: ")){for(let d of t){let p=d(l);if(p){i.push(p);break}}if(i.length>=50+o)break}}return Uh(i.slice(o))}}function Xc(e){return Array.isArray(e)?Xa(...e):e}function Uh(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(Za(t).function||"")&&t.pop(),t.reverse(),Lh.test(Za(t).function||"")&&(t.pop(),Lh.test(Za(t).function||"")&&t.pop()),t.slice(0,50).map(r=>({...r,filename:r.filename||Za(t).filename,function:r.function||"?"}))}function Za(e){return e[e.length-1]||{}}var Zc="<anonymous>";function ii(e){try{return!e||typeof e!="function"?Zc:e.name||Zc}catch{return Zc}}function Qa(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function jh(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var eu={},qh={};function _n(e,t){eu[e]=eu[e]||[],eu[e].push(t)}function wn(e,t){if(!qh[e]){qh[e]=!0;try{t()}catch(r){R&&b.error(`Error while instrumenting ${e}`,r)}}}function xn(e,t){let r=e&&eu[e];if(r)for(let n of r)try{n(t)}catch(o){R&&b.error(`Error while triggering instrumentation handler.
Type: ${e}
Name: ${ii(n)}
Error:`,o)}}var Qc=null;function $h(e){let t="error";_n(t,e),wn(t,Gk)}function Gk(){Qc=$.onerror,$.onerror=function(e,t,r,n,o){return xn("error",{column:n,error:o,line:r,msg:e,url:t}),Qc?Qc.apply(this,arguments):!1},$.onerror.__SENTRY_INSTRUMENTED__=!0}var ed=null;function zh(e){let t="unhandledrejection";_n(t,e),wn(t,Kk)}function Kk(){ed=$.onunhandledrejection,$.onunhandledrejection=function(e){return xn("unhandledrejection",e),ed?ed.apply(this,arguments):!0},$.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var Wh=Object.prototype.toString;function tt(e){switch(Wh.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return nt(e,Error)}}function tu(e,t){return Wh.call(e)===`[object ${t}]`}function td(e){return tu(e,"ErrorEvent")}function $t(e){return tu(e,"String")}function Sn(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function Sr(e){return e===null||Sn(e)||typeof e!="object"&&typeof e!="function"}function vt(e){return tu(e,"Object")}function rd(e){return typeof Event<"u"&&nt(e,Event)}function nd(e){return typeof Element<"u"&&nt(e,Element)}function od(e){return tu(e,"RegExp")}function rt(e){return!!(e?.then&&typeof e.then=="function")}function id(e){return vt(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function nt(e,t){try{return e instanceof t}catch{return!1}}function si(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue||e.__v_isVNode))}var Jk=$,Yk=80;function Hh(e,t={}){if(!e)return"<unknown>";try{let r=e,n=5,o=[],i=0,s=0,a=" > ",u=a.length,l,d=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||Yk;for(;r&&i++<n&&(l=Zk(r,d),!(l==="html"||i>1&&s+o.length*u+l.length>=p));)o.push(l),s+=l.length,r=r.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function Zk(e,t){let r=e,n=[];if(!r?.tagName)return"";if(Jk.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let o=t?.length?t.filter(i=>r.getAttribute(i)).map(i=>[i,r.getAttribute(i)]):null;if(o?.length)o.forEach(i=>{n.push(`[${i[0]}="${i[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let i=r.className;if(i&&$t(i)){let s=i.split(/\s+/);for(let a of s)n.push(`.${a}`)}}for(let i of["aria-label","type","name","title","alt"]){let s=r.getAttribute(i);s&&n.push(`[${i}="${s}"]`)}return n.join("")}function Kh(e,t,r){if(!(t in e))return;let n=e[t];if(typeof n!="function")return;let o=r(n);typeof o=="function"&&Xk(o,n);try{e[t]=o}catch{R&&b.log(`Failed to replace method "${t}" in object`,e)}}function ai(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{R&&b.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Xk(e,t){try{let r=t.prototype||{};e.prototype=t.prototype=r,ai(e,"__sentry_original__",t)}catch{}}function Jh(e){return e.__sentry_original__}function sd(e){if(tt(e))return{message:e.message,name:e.name,stack:e.stack,...Gh(e)};if(rd(e)){let t={type:e.type,target:Vh(e.target),currentTarget:Vh(e.currentTarget),...Gh(e)};return typeof CustomEvent<"u"&&nt(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Vh(e){try{return nd(e)?Hh(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Gh(e){return typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e)):{}}function Yh(e){let t=Object.keys(sd(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var vn;function En(e){if(vn!==void 0)return vn?vn(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),r=$;return t in r&&typeof r[t]=="function"?(vn=r[t],vn(e)):(vn=null,e())}function xe(){return En(()=>Math.random())}function Cn(){return En(()=>Date.now())}function Tn(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function ad(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let o=Math.max(t-60,0);o<5&&(o=0);let i=Math.min(o+140,n);return i>n-5&&(i=n),i===n&&(o=Math.max(i-140,0)),r=r.slice(o,i),o>0&&(r=`'{snip} ${r}`),i<n&&(r+=" {snip}"),r}function ud(e,t){if(!Array.isArray(e))return"";let r=[];for(let n=0;n<e.length;n++){let o=e[n];try{si(o)?r.push(Qa(o)):r.push(String(o))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function Et(e,t,r=!1){return $t(e)?od(t)?t.test(e):$t(t)?r?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function zt(e,t=[],r=!1){return t.some(n=>Et(e,n,r))}function Qk(){let e=$;return e.crypto||e.msCrypto}var ld;function eA(){return xe()*16}function ie(e=Qk()){try{if(e?.randomUUID)return En(()=>e.randomUUID()).replace(/-/g,"")}catch{}return ld||(ld="10000000100040008000"+1e11),ld.replace(/[018]/g,t=>(t^(eA()&15)>>t/4).toString(16))}function Zh(e){return e.exception?.values?.[0]}function Wt(e){let{message:t,event_id:r}=e;if(t)return t;let n=Zh(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function dd(e,t,r){let n=e.exception=e.exception||{},o=n.values=n.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type=r||"Error")}function kn(e,t){let r=Zh(e);if(!r)return;let n={type:"generic",handled:!0},o=r.mechanism;if(r.mechanism={...n,...o,...t},t&&"data"in t){let i={...o?.data,...t.data};r.mechanism.data=i}}var tA=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function cd(e){return parseInt(e||"",10)}function pd(e){let t=e.match(tA)||[],r=cd(t[1]),n=cd(t[2]),o=cd(t[3]);return{buildmetadata:t[5],major:isNaN(r)?void 0:r,minor:isNaN(n)?void 0:n,patch:isNaN(o)?void 0:o,prerelease:t[4]}}function ru(e){if(Xh(e))return!0;try{ai(e,"__sentry_captured__",!0)}catch{}return!1}function Xh(e){try{return e.__sentry_captured__}catch{}}var eg=1e3;function Ct(){return Cn()/eg}function rA(){let{performance:e}=$;if(!e?.now||!e.timeOrigin)return Ct;let t=e.timeOrigin;return()=>(t+En(()=>e.now()))/eg}var Qh;function ui(){return(Qh??(Qh=rA()))()}function tg(e){let t=ui(),r={sid:ie(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>nA(r)};return e&&Tt(r,e),r}function Tt(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||ui(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:ie()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{let r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function rg(e,t){let r={};t?r={status:t}:e.status==="ok"&&(r={status:"exited"}),Tt(e,r)}function nA(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Ht(e,t,r=2){if(!t||typeof t!="object"||r<=0)return t;if(e&&Object.keys(t).length===0)return e;let n={...e};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=Ht(n[o],t[o],r-1));return n}function ot(){return ie()}function it(){return ie().substring(16)}var fd="_sentrySpan";function An(e,t){t?ai(e,fd,t):delete e[fd]}function In(e){return e[fd]}var oA=100,_e=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:ot(),sampleRand:xe()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,An(t,In(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Tt(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,r){return this.setTags({[t]:r})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,r){return this.setAttributes({[t]:r})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,r){return this._extra={...this._extra,[t]:r},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,r){return r===null?delete this._contexts[t]:this._contexts[t]=r,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let r=typeof t=="function"?t(this):t,n=r instanceof e?r.getScopeData():vt(r)?t:void 0,{tags:o,attributes:i,extra:s,user:a,contexts:u,level:l,fingerprint:d=[],propagationContext:p,conversationId:f}=n||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...u},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),d.length&&(this._fingerprint=d),p&&(this._propagationContext=p),f&&(this._conversationId=f),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,An(this,void 0),this._attachments=[],this.setPropagationContext({traceId:ot(),sampleRand:xe()}),this._notifyScopeListeners(),this}addBreadcrumb(t,r){let n=typeof r=="number"?r:oA;if(n<=0)return this;let o={timestamp:Ct(),...t,message:t.message?Tn(t.message,2048):t.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:In(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Ht(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,r){let n=r?.event_id||ie();if(!this._client)return R&&b.warn("No client configured on scope - will not capture exception!"),n;let o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...r,event_id:n},this),n}captureMessage(t,r,n){let o=n?.event_id||ie();if(!this._client)return R&&b.warn("No client configured on scope - will not capture message!"),o;let i=n?.syntheticException??new Error(t);return this._client.captureMessage(t,r,{originalException:t,syntheticException:i,...n,event_id:o},this),o}captureEvent(t,r){let n=t.event_id||r?.event_id||ie();return this._client?(this._client.captureEvent(t,{...r,event_id:n},this),n):(R&&b.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}};function li(){return $e("defaultCurrentScope",()=>new _e)}function ci(){return $e("defaultIsolationScope",()=>new _e)}var ng=e=>e instanceof Promise&&!e[og],og=Symbol("chained PromiseLike"),ig=(e,t,r)=>{let n=e.then(o=>(t(o),o),o=>{throw r(o),o});return ng(n)&&ng(e)?n:iA(e,n)},iA=(e,t)=>{let r=!1;for(let n in e){if(n in t)continue;r=!0;let o=e[n];typeof o=="function"?Object.defineProperty(t,n,{value:(...i)=>o.apply(e,i),enumerable:!0,configurable:!0,writable:!0}):t[n]=o}return r&&Object.assign(t,{[og]:!0}),t};var md=class{constructor(t,r){let n;t?n=t:n=new _e;let o;r?o=r:o=new _e,this._stack=[{scope:n}],this._isolationScope=o}withScope(t){let r=this._pushScope(),n;try{n=t(r)}catch(o){throw this._popScope(),o}return rt(n)?ig(n,()=>this._popScope(),()=>this._popScope()):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function Rn(){let e=he(),t=qt(e);return t.stack=t.stack||new md(li(),ci())}function sA(e){return Rn().withScope(e)}function aA(e,t){let r=Rn();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function sg(e){return Rn().withScope(()=>e(Rn().getIsolationScope()))}function ag(){return{withIsolationScope:sg,withScope:sA,withSetScope:aA,withSetIsolationScope:(e,t)=>sg(t),getCurrentScope:()=>Rn().getScope(),getIsolationScope:()=>Rn().getIsolationScope()}}function hd(e){let t=he(),r=qt(t);r.acs=e}function De(e){let t=qt(e);return t.acs?t.acs:ag()}function uA(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function lA(e,t){let{value:r,unit:n}=uA(e)?e:{value:e,unit:void 0},o=cA(r),i=n&&typeof n=="string"?{unit:n}:{};if(o)return{...o,...i};if(!t||t==="skip-undefined"&&r===void 0)return;let s="";try{s=JSON.stringify(r)??""}catch{}return{value:s,type:"string",...i}}function gd(e,t=!1){let r={};for(let[n,o]of Object.entries(e??{})){let i=lA(o,t);i&&(r[n]=i)}return r}function bd(e){if(!e)return 0;let t=0;for(let[r,n]of Object.entries(e)){t+=r.length*2,t+=n.type.length*2,t+=(n.unit?.length??0)*2;let o=n.value;Array.isArray(o)?t+=ug(o[0])*o.length:Sr(o)?t+=ug(o):t+=100}return t}function ug(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function cA(e){let t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}var lg;function cg(){return lg?.()}function yd(){return lg!==void 0}function ee(){let e=he();return De(e).getCurrentScope()}function ne(){let e=he();return De(e).getIsolationScope()}function di(){return $e("globalScope",()=>new _e)}function st(...e){let t=he(),r=De(t);if(e.length===2){let[n,o]=e;return n?r.withSetScope(n,o):r.withScope(o)}return r.withScope(e[0])}function Pn(...e){let t=he(),r=De(t);if(e.length===2){let[n,o]=e;return n?r.withSetIsolationScope(n,o):r.withIsolationScope(o)}return r.withIsolationScope(e[0])}function Y(){return ee().getClient()}function pi(e){let t=cg();if(t)return{trace_id:t.traceId,span_id:t.spanId};let r=e.getPropagationContext(),{traceId:n,parentSpanId:o,propagationSpanId:i}=r,s={trace_id:n,span_id:i||it()};return o&&(s.parent_span_id=o),s}var vr="sentry.source",nu="sentry.sample_rate",dg="sentry.previous_trace_sample_rate",ou="sentry.op",iu="sentry.origin";var pg="sentry.release",fg="sentry.environment",mg="sentry.segment.name",hg="sentry.segment.id",gg="sentry.sdk.name",bg="sentry.sdk.version",yg="user.id",_g="user.email",wg="user.ip_address",xg="user.name";var _d="sentry.profile_id",wd="sentry.exclusive_time";var dA="_sentryScope",pA="_sentryIsolationScope";function fA(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}function Dn(e){let t=e;return{scope:t[dA],isolationScope:fA(t[pA])}}var Er="sentry-";var vg=8192;function Cr(e){let t=fi(e);if(!t)return;let r=Object.entries(t).reduce((n,[o,i])=>{if(o.startsWith(Er)){let s=o.slice(Er.length);n[s]=i}return n},{});if(Object.keys(r).length>0)return r}function su(e){if(!e)return;let t=Object.entries(e).reduce((r,[n,o])=>(o&&(r[`${Er}${n}`]=o),r),{});return au(t)}function fi(e){if(!(!e||!$t(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,r)=>{let n=Sg(r);return Object.entries(n).forEach(([o,i])=>{t[o]=i}),t},{}):Sg(e)}function Sg(e){return e.split(",").map(t=>{let r=t.indexOf("=");if(r===-1)return[];let n=t.slice(0,r),o=t.slice(r+1);return[n,o].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((t,[r,n])=>(r&&n&&(t[r]=n),t),{})}function au(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[r,n],o)=>{let i=`${encodeURIComponent(r)}=${encodeURIComponent(n)}`,s=o===0?i:`${t},${i}`;return s.length>vg?(R&&b.warn(`Not adding key: ${r} with val: ${n} to baggage header due to exceeding baggage size limits.`),t):s},"")}var mA=/^o(\d+)\./,hA=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function gA(e){return e==="http"||e==="https"}function Se(e,t=!1){let{host:r,path:n,pass:o,port:i,projectId:s,protocol:a,publicKey:u}=e;return`${a}://${u}${t&&o?`:${o}`:""}@${r}${i?`:${i}`:""}/${n&&`${n}/`}${s}`}function bA(e){let t=hA.exec(e);if(!t){pe(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[r,n,o="",i="",s="",a=""]=t.slice(1),u="",l=a,d=l.split("/");if(d.length>1&&(u=d.slice(0,-1).join("/"),l=d.pop()),l){let p=l.match(/^\d+/);p&&(l=p[0])}return Eg({host:i,pass:o,path:u,projectId:l,port:s,protocol:r,publicKey:n})}function Eg(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function yA(e){if(!R)return!0;let{port:t,projectId:r,protocol:n}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(b.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?gA(n)?t&&isNaN(parseInt(t,10))?(b.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(b.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(b.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function _A(e){return e.match(mA)?.[1]}function uu(e){let t=e.getOptions(),{host:r}=e.getDsn()||{},n;return t.orgId?n=String(t.orgId):r&&(n=_A(r)),n}function Cg(e){let t=typeof e=="string"?bA(e):Eg(e);if(!(!t||!yA(t)))return t}function mi(e){if(typeof e=="boolean")return Number(e);let t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}var lu=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Tg(e){if(!e)return;let t=e.match(lu);if(!t)return;let r;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}function hi(e,t){let r=Tg(e),n=Cr(t);if(!r?.traceId)return{traceId:ot(),sampleRand:xe()};let o=wA(r,n);n&&(n.sample_rand=o.toString());let{traceId:i,parentSpanId:s,parentSampled:a}=r;return{traceId:i,parentSpanId:s,sampled:a,dsc:n||{},sampleRand:o}}function gi(e=ot(),t=it(),r){let n="";return r!==void 0&&(n=r?"-1":"-0"),`${e}-${t}${n}`}function bi(e=ot(),t=it(),r){return`00-${e}-${t}-${r?"01":"00"}`}function wA(e,t){let r=mi(t?.sample_rand);if(r!==void 0)return r;let n=mi(t?.sample_rate);return n&&e?.parentSampled!==void 0?e.parentSampled?xe()*n:n+xe()*(1-n):xe()}function xd(e,t){let r=uu(e);return t&&r&&t!==r?(b.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${r})`),!1):(e.getOptions().strictTraceContinuation||!1)&&(t&&!r||!t&&r)?(b.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${r})`),!1):!0}var Sd=1,kg=!1;function du(e){let{spanId:t,traceId:r,isRemote:n}=e.spanContext(),o=n?t:Tr(e).parent_span_id,i=Dn(e).scope,s=n?i?.getPropagationContext().propagationSpanId||it():t;return{parent_span_id:o,span_id:s,trace_id:r}}function pu(e){let{traceId:t,spanId:r}=e.spanContext(),n=Nn(e);return gi(t,r,n)}function Ig(e){let{traceId:t,spanId:r}=e.spanContext(),n=Nn(e);return bi(t,r,n)}function vA(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:r,traceFlags:n,...o},attributes:i})=>({span_id:t,trace_id:r,sampled:n===Sd,attributes:i,...o}))}function EA(e){if(e?.length)return e.map(({context:{spanId:t,traceId:r,traceFlags:n},attributes:o})=>({span_id:t,trace_id:r,sampled:n===Sd,attributes:o}))}function cu(e){return typeof e=="number"?Ag(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Ag(e.getTime()):ui()}function Ag(e){return e>9999999999?e/1e3:e}function Tr(e){if(Ng(e))return e.getSpanJSON();let{spanId:t,traceId:r}=e.spanContext();if(Dg(e)){let{attributes:n,startTime:o,name:i,endTime:s,status:a,links:u}=e;return{span_id:t,trace_id:r,data:n,description:i,parent_span_id:Rg(e),start_timestamp:cu(o),timestamp:cu(s)||void 0,status:CA(a),op:n[ou],origin:n[iu],links:vA(u)}}return{span_id:t,trace_id:r,start_timestamp:0,data:{}}}function vd(e){if(Ng(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:r}=e.spanContext();if(Dg(e)){let{attributes:n,startTime:o,name:i,endTime:s,status:a,links:u}=e;return{name:i,span_id:t,trace_id:r,parent_span_id:Rg(e),start_timestamp:cu(o),end_timestamp:cu(s),is_segment:e===yi(e),status:TA(a),attributes:n,links:EA(u)}}return{span_id:t,trace_id:r,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===yi(e)}}function Rg(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function Pg(e){return{...e,attributes:gd(e.attributes),links:e.links?.map(t=>({...t,attributes:gd(t.attributes)}))}}function Dg(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function Ng(e){return typeof e.getSpanJSON=="function"}function Nn(e){let{traceFlags:t}=e.spanContext();return t===Sd}function CA(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function TA(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}var kA="_sentryRootSpan";var Vt=yi;function yi(e){return e[kA]||e}function Gt(){let e=he(),t=De(e);return t.getActiveSpan?t.getActiveSpan():In(ee())}function _i(){kg||(pe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),kg=!0)}var Og=!1;function Mg(){if(Og)return;function e(){let t=Gt(),r=t&&Vt(t);if(r){let n="internal_error";R&&b.log(`[Tracing] Root span: ${n} -> Global error occurred`),r.setStatus({code:2,message:n})}}e.tag="sentry_tracingErrorCallback",Og=!0,$h(e),zh(e)}function Fg(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||Y()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function Bg(e){b.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Ed(e,t){if(!t?.length||!e.description)return!1;for(let r of t){if(AA(r)){if(Et(e.description,r))return R&&Bg(e),!0;continue}if(!r.name&&!r.op)continue;let n=r.name?Et(e.description,r.name):!0,o=r.op?e.op&&Et(e.op,r.op):!0;if(n&&o)return R&&Bg(e),!0}return!1}function Lg(e,t){let r=t.parent_span_id,n=t.span_id;if(r)for(let o of e)o.parent_span_id===n&&(o.parent_span_id=r)}function AA(e){return typeof e=="string"||e instanceof RegExp}var On="production";var IA="_frozenDsc";function Ug(e,t){let r=t.getOptions(),{publicKey:n}=t.getDsn()||{},o={environment:r.environment||On,release:r.release,public_key:n,trace_id:e,org_id:uu(t)};return t.emit("createDsc",o),o}function Mn(e,t){let r=t.getPropagationContext();return r.dsc||Ug(r.traceId,e)}function Kt(e){let t=Y();if(!t)return{};let r=Vt(e),n=Tr(r),o=n.data,i=r.spanContext().traceState,s=i?.get("sentry.sample_rate")??o[nu]??o[dg];function a(h){return(typeof s=="number"||typeof s=="string")&&(h.sample_rate=`${s}`),h}let u=r[IA];if(u)return a(u);let l=i?.get("sentry.dsc"),d=l&&Cr(l);if(d)return a(d);let p=Ug(e.spanContext().traceId,t),f=o[vr]??o["sentry.span.source"],m=n.description;return f!=="url"&&m&&(p.transaction=m),Fg()&&(p.sampled=String(Nn(r)),p.sample_rand=i?.get("sentry.sample_rand")??Dn(r).scope?.getPropagationContext().sampleRand.toString()),a(p),t.emit("createDsc",p,r),p}function Fn(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function ze(e,t=100,r=1/0){try{return Cd("",e,t,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Td(e,t=3,r=100*1024){let n=ze(e,t);return NA(n)>r?Td(e,t-1,r):n}function Cd(e,t,r=1/0,n=1/0,o=OA()){let[i,s]=o;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let a=RA(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;let u=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:r;if(u===0)return a.replace("object ","");if(i(t))return"[Circular ~]";let l=t;if(l&&typeof l.toJSON=="function")try{let m=l.toJSON();return Cd("",m,u-1,n,o)}catch{}let d=Array.isArray(t)?[]:{},p=0,f=sd(t);for(let m in f){if(!Object.prototype.hasOwnProperty.call(f,m))continue;if(p>=n){d[m]="[MaxProperties ~]";break}let h=f[m];d[m]=Cd(m,h,u-1,n,o),p++}return s(t),d}function RA(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(si(t))return Qa(t);if(id(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${ii(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;let r=PA(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function PA(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function DA(e){return~-encodeURI(e).split(/%..|./).length}function NA(e){return DA(JSON.stringify(e))}function OA(){let e=new WeakSet;function t(n){return e.has(n)?!0:(e.add(n),!1)}function r(n){e.delete(n)}return[t,r]}function ge(e,t=[]){return[e,t]}function Ad(e,t){let[r,n]=e;return[r,[...n,t]]}function wi(e,t){let r=e[1];for(let n of r){let o=n[0].type;if(t(n,o))return!0}return!1}function Id(e,t){return wi(e,(r,n)=>t.includes(n))}function kd(e){let t=qt($);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function xi(e){let[t,r]=e,n=JSON.stringify(t);function o(i){typeof n=="string"?n=typeof i=="string"?n+i:[kd(n),i]:n.push(typeof i=="string"?kd(i):i)}for(let i of r){let[s,a]=i;if(o(`
${JSON.stringify(s)}
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let u;try{u=JSON.stringify(a)}catch{u=JSON.stringify(ze(a))}o(u)}}return typeof n=="string"?n:MA(n)}function MA(e){let t=e.reduce((o,i)=>o+i.length,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function Rd(e){let t=typeof e.data=="string"?kd(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var jg={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function FA(e){return e in jg}function fu(e){return FA(e)?jg[e]:e}function Bn(e){if(!e?.sdk)return;let{name:t,version:r}=e.sdk;return{name:t,version:r}}function Pd(e,t,r,n){let o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!r&&n&&{dsn:Se(n)},...o&&{trace:o}}}function LA(e,t){if(!t)return e;let r=e.sdk||{};return e.sdk={...r,name:r.name||t.name,version:r.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function qg(e,t,r,n){let o=Bn(r),i={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!n&&t&&{dsn:Se(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return ge(i,[s])}function $g(e,t,r,n){let o=Bn(r),i=e.type&&e.type!=="replay_event"?e.type:"event";LA(e,r?.sdk);let s=Pd(e,o,n,t);return delete e.sdkProcessingMetadata,ge(s,[[{type:i},e]])}function zg(e){return e.getOptions().traceLifecycle==="stream"}var Wg="__SENTRY_SUPPRESS_TRACING__";var Si=(e,t)=>{let r=he(),n=De(r);if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:o,baggage:i}=e,s=Y(),a=Cr(i);return s&&!xd(s,a?.org_id)?mu(t):st(u=>{let l=hi(o,i);return u.setPropagationContext(l),An(u,void 0),t()})};function Ln(e,t){let r=Dd();return r.withActiveSpan?r.withActiveSpan(e,t):st(n=>(An(n,e||void 0),t(n)))}function kr(e){let t=Dd();return t.suppressTracing?t.suppressTracing(e):st(r=>{r.setSDKProcessingMetadata({[Wg]:!0});let n=e();return r.setSDKProcessingMetadata({[Wg]:void 0}),n})}function mu(e){let t=Dd();return t.startNewTrace?t.startNewTrace(e):st(r=>(r.setPropagationContext({traceId:ot(),sampleRand:xe()}),R&&b.log(`Starting a new trace with id ${r.getPropagationContext().traceId}`),Ln(null,e)))}function Dd(){let e=he();return De(e)}function Vg(e,t){let{fingerprint:r,span:n,breadcrumbs:o,sdkProcessingMetadata:i}=t;UA(e,t),n&&$A(e,n),zA(e,r),jA(e,o),qA(e,i)}function Hg(e,t){let{extra:r,tags:n,attributes:o,user:i,contexts:s,level:a,sdkProcessingMetadata:u,breadcrumbs:l,fingerprint:d,eventProcessors:p,attachments:f,propagationContext:m,transactionName:h,span:y}=t;vi(e,"extra",r),vi(e,"tags",n),vi(e,"attributes",o),vi(e,"user",i),vi(e,"contexts",s),e.sdkProcessingMetadata=Ht(e.sdkProcessingMetadata,u,2),a&&(e.level=a),h&&(e.transactionName=h),y&&(e.span=y),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),p.length&&(e.eventProcessors=[...e.eventProcessors,...p]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...m}}function vi(e,t,r){e[t]=Ht(e[t],r,1)}function Un(e,t){let r=di().getScopeData();return e&&Hg(r,e.getScopeData()),t&&Hg(r,t.getScopeData()),r}function UA(e,t){let{extra:r,tags:n,user:o,contexts:i,level:s,transactionName:a}=t;Object.keys(r).length&&(e.extra={...r,...e.extra}),Object.keys(n).length&&(e.tags={...n,...e.tags}),Object.keys(o).length&&(e.user={...o,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),s&&(e.level=s),a&&e.type!=="transaction"&&(e.transaction=a)}function jA(e,t){let r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}function qA(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function $A(e,t){e.contexts={trace:du(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Kt(t),...e.sdkProcessingMetadata};let r=Vt(t),n=Tr(r).description;n&&!e.transaction&&e.type==="transaction"&&(e.transaction=n)}function zA(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function Gg(e,t){let r=vd(e),n=yi(e),o=vd(n),{isolationScope:i,scope:s}=Dn(e),a=Un(i,s);WA(r,o,t,a),r.is_segment&&t.emit("processSegmentSpan",r),t.emit("processSpan",r);let{beforeSendSpan:u}=t.getOptions(),l=u&&Fn(u)?HA(r,u):r,d=l.attributes?.[vr];return d&&Kg(l,{"sentry.span.source":d}),{...Pg(l),_segmentSpan:n}}function WA(e,t,r,n){let o=r.getSdkMetadata(),{release:i,environment:s,sendDefaultPii:a}=r.getOptions();Kg(e,{[pg]:i,[fg]:s,[mg]:t.name,[hg]:t.span_id,[gg]:o?.sdk?.name,[bg]:o?.sdk?.version,...a?{[yg]:n.user?.id,[_g]:n.user?.email,[wg]:n.user?.ip_address,[xg]:n.user?.username}:{},...n.attributes})}function HA(e,t){let r=t(e);return r||(_i(),e)}function Kg(e,t){let r=e.attributes??(e.attributes={});Object.entries(t).forEach(([n,o])=>{o!=null&&!(n in r)&&(r[n]=o)})}var Nd=0,Jg=1,Yg=2;function kt(e){return new hu(t=>{t(e)})}function jn(e){return new hu((t,r)=>{r(e)})}var hu=class e{constructor(t){this._state=Nd,this._handlers=[],this._runExecutor(t)}then(t,r){return new e((n,o)=>{this._handlers.push([!1,i=>{if(!t)n(i);else try{n(t(i))}catch(s){o(s)}},i=>{if(!r)o(i);else try{n(r(i))}catch(s){o(s)}}]),this._executeHandlers()})}catch(t){return this.then(r=>r,t)}finally(t){return new e((r,n)=>{let o,i;return this.then(s=>{i=!1,o=s,t&&t()},s=>{i=!0,o=s,t&&t()}).then(()=>{if(i){n(o);return}r(o)})})}_executeHandlers(){if(this._state===Nd)return;let t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===Jg&&r[1](this._value),this._state===Yg&&r[2](this._value),r[0]=!0)})}_runExecutor(t){let r=(i,s)=>{if(this._state===Nd){if(rt(s)){s.then(n,o);return}this._state=i,this._value=s,this._executeHandlers()}},n=i=>{r(Jg,i)},o=i=>{r(Yg,i)};try{t(n,o)}catch(i){o(i)}}};function Zg(e,t,r,n=0){try{let o=Od(t,r,e,n);return rt(o)?o:kt(o)}catch(o){return jn(o)}}function Od(e,t,r,n){let o=r[n];if(!e||!o)return e;let i=o({...e},t);return R&&i===null&&b.log(`Event processor "${o.id||"?"}" dropped event`),rt(i)?i.then(s=>Od(s,t,r,n+1)):Od(i,t,r,n+1)}var Ar,Xg,Qg,Jt;function e0(e){let t=$._sentryDebugIds,r=$._debugIds;if(!t&&!r)return{};let n=t?Object.keys(t):[],o=r?Object.keys(r):[];if(Jt&&n.length===Xg&&o.length===Qg)return Jt;Xg=n.length,Qg=o.length,Jt={},Ar||(Ar={});let i=(s,a)=>{for(let u of s){let l=a[u],d=Ar?.[u];if(d&&Jt&&l)Jt[d[0]]=l,Ar&&(Ar[u]=[d[0],l]);else if(l){let p=e(u);for(let f=p.length-1;f>=0;f--){let h=p[f]?.filename;if(h&&Jt&&Ar){Jt[h]=l,Ar[u]=[h,l];break}}}}};return t&&i(n,t),r&&i(o,r),Jt}function t0(e,t,r,n,o,i){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,u={...t,event_id:t.event_id||r.event_id||ie(),timestamp:t.timestamp||Ct()},l=r.integrations||e.integrations.map(D=>D.name);VA(u,e),JA(u,l),o&&o.emit("applyFrameMetadata",t),t.type===void 0&&GA(u,e.stackParser);let d=ZA(n,r.captureContext);r.mechanism&&kn(u,r.mechanism);let p=o?o.getEventProcessors():[],f=Un(i,d),m=[...r.attachments||[],...f.attachments];m.length&&(r.attachments=m),Vg(u,f);let h=[...p,...f.eventProcessors];return(r.data&&r.data.__sentry__===!0?kt(u):Zg(h,u,r)).then(D=>(D&&KA(D),typeof s=="number"&&s>0?YA(D,s,a):D))}function VA(e,t){let{environment:r,release:n,dist:o,maxValueLength:i}=t;e.environment=e.environment||r||On,!e.release&&n&&(e.release=n),!e.dist&&o&&(e.dist=o);let s=e.request;s?.url&&i&&(s.url=Tn(s.url,i)),i&&e.exception?.values?.forEach(a=>{a.value&&(a.value=Tn(a.value,i))})}function GA(e,t){let r=e0(t);e.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=r[o.filename])})})}function KA(e){let t={};if(e.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?t[o.abs_path]=o.debug_id:o.filename&&(t[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let r=e.debug_meta.images;Object.entries(t).forEach(([n,o])=>{r.push({type:"sourcemap",code_file:n,debug_id:o})})}function JA(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function YA(e,t,r){if(!e)return null;let n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:ze(o.data,t,r)}}))},...e.user&&{user:ze(e.user,t,r)},...e.contexts&&{contexts:ze(e.contexts,t,r)},...e.extra&&{extra:ze(e.extra,t,r)}};return e.contexts?.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=ze(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(o=>({...o,...o.data&&{data:ze(o.data,t,r)}}))),e.contexts?.flags&&n.contexts&&(n.contexts.flags=ze(e.contexts.flags,3,r)),n}function ZA(e,t){if(!t)return e;let r=e?e.clone():new _e;return r.update(t),r}function r0(e){if(e)return XA(e)?{captureContext:e}:eI(e)?{captureContext:e}:e}function XA(e){return e instanceof _e||typeof e=="function"}var QA=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function eI(e){return Object.keys(e).some(t=>QA.includes(t))}function ue(e,t){return ee().captureException(e,r0(t))}function Ei(e,t){ne().setTag(e,t)}function Ci(e){ne().setUser(e)}function Ti(){let e=Y();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function ki(e){let t=ne(),{user:r}=Un(t,ee()),{userAgent:n}=$.navigator||{},o=tg({user:r,...n&&{userAgent:n},...e}),i=t.getSession();return i?.status==="ok"&&Tt(i,{status:"exited"}),qn(),t.setSession(o),o}function qn(){let e=ne(),r=ee().getSession()||e.getSession();r&&rg(r),tI(),e.setSession()}function tI(){let e=ne(),t=Y(),r=e.getSession();r&&t&&t.captureSession(r)}var rI="7";function nI(e){let t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}function oI(e){return`${nI(e)}${e.projectId}/envelope/`}function iI(e,t){let r={sentry_version:rI};return e.publicKey&&(r.sentry_key=e.publicKey),t&&(r.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(r).toString()}function n0(e,t,r){return t||`${oI(e)}?${iI(e,r)}`}var Md=[];function sI(e){let t={};return e.forEach(r=>{let{name:n}=r,o=t[n];o&&!o.isDefaultInstance&&r.isDefaultInstance||(t[n]=r)}),Object.values(t)}function Fd(e){let t=e.defaultIntegrations||[],r=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let n;if(Array.isArray(r))n=[...t,...r];else if(typeof r=="function"){let o=r(t);n=Array.isArray(o)?o:[o]}else n=t;return sI(n)}function o0(e,t){let r={};return t.forEach(n=>{n?.beforeSetup&&n.beforeSetup(e)}),t.forEach(n=>{n&&Ld(e,n,r)}),r}function Bd(e,t){for(let r of t)r?.afterAllSetup&&r.afterAllSetup(e)}function Ld(e,t,r){if(r[t.name]){R&&b.log(`Integration skipped because it was already installed: ${t.name}`);return}if(r[t.name]=t,!Md.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),Md.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(o,i)=>n(o,i,e))}if(typeof t.processEvent=="function"){let n=t.processEvent.bind(t),o=Object.assign((i,s)=>n(i,s,e),{id:t.name});e.addEventProcessor(o)}R&&b.log(`Integration installed: ${t.name}`)}function i0(e,t){return t?st(t,()=>{let r=Gt(),n=r?du(r):pi(t);return[r?Kt(r):Mn(e,t),n]}):[void 0,void 0]}function aI(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function s0(e,t,r,n){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),r&&n&&(o.dsn=Se(n)),ge(o,[aI(e)])}function $n(e,t){let r=t??uI(e)??[];if(r.length===0)return;let n=e.getOptions(),o=s0(r,n._metadata,n.tunnel,e.getDsn());a0().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function uI(e){return a0().get(e)}function a0(){return $e("clientToLogBufferMap",()=>new WeakMap)}function lI(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function u0(e,t,r,n){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),r&&n&&(o.dsn=Se(n)),ge(o,[lI(e)])}function l0(e,t){let r=t??cI(e)??[];if(r.length===0)return;let n=e.getOptions(),o=u0(r,n._metadata,n.tunnel,e.getDsn());c0().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function cI(e){return c0().get(e)}function c0(){return $e("clientToMetricBufferMap",()=>new WeakMap)}function zn(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}var Ai=Symbol.for("SentryBufferFullError");function Wn(e=100){let t=new Set;function r(){return t.size<e}function n(s){t.delete(s)}function o(s){if(!r())return jn(Ai);let a=s();return t.add(a),a.then(()=>n(a),()=>n(a)),a}function i(s){if(!t.size)return kt(!0);let a=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return a;let u=[a,new Promise(l=>zn(setTimeout(()=>l(!1),s)))];return Promise.race(u)}return{get $(){return Array.from(t)},add:o,drain:i}}var dI=60*1e3;function pI(e,t=Cn()){let r=parseInt(`${e}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${e}`);return isNaN(n)?dI:n-t}function fI(e,t){return e[t]||e.all||0}function d0(e,t,r=Cn()){return fI(e,t)>r}function p0(e,{statusCode:t,headers:r},n=Cn()){let o={...e},i=r?.["x-sentry-rate-limits"],s=r?.["retry-after"];if(i)for(let a of i.trim().split(",")){let[u,l,,,d]=a.split(":",5),p=parseInt(u,10),f=(isNaN(p)?60:p)*1e3;if(!l)o.all=n+f;else for(let m of l.split(";"))m==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(o[m]=n+f):o[m]=n+f}else s?o.all=n+pI(s,n):t===429&&(o.all=n+60*1e3);return o}var Ii=64;function Yt(e,t,r=Wn(e.bufferSize||Ii)){let n={},o=s=>r.drain(s);function i(s){let a=[];if(wi(s,(p,f)=>{let m=fu(f);d0(n,m)?e.recordDroppedEvent("ratelimit_backoff",m):a.push(p)}),a.length===0)return Promise.resolve({});let u=ge(s[0],a),l=p=>{if(Id(u,["client_report"])){R&&b.warn(`Dropping client report. Will not send outcomes (reason: ${p}).`);return}wi(u,(f,m)=>{e.recordDroppedEvent(p,fu(m))})},d=()=>t({body:xi(u)}).then(p=>p.statusCode===413?(R&&b.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),p):(R&&p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&b.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),n=p0(n,p),p),p=>{throw l("network_error"),R&&b.error("Encountered error running transport request:",p),p});return r.add(d).then(p=>p,p=>{if(p===Ai)return R&&b.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw p})}return{send:i,flush:o}}function f0(e,t,r){let n=[{type:"client_report"},{timestamp:r||Ct(),discarded_events:e}];return ge(t?{dsn:t}:{},[n])}function gu(e){let t=[];e.message&&t.push(e.message);try{let r=e.exception.values[e.exception.values.length-1];r?.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`))}catch{}return t}function m0(e){let{trace_id:t,parent_span_id:r,span_id:n,status:o,origin:i,data:s,op:a}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:s?.[_d],exclusive_time:s?.[wd],measurements:e.measurements,is_segment:!0}}function h0(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[_d]:e.profile_id},...e.exclusive_time&&{[wd]:e.exclusive_time}}}},measurements:e.measurements}}var g0="Not capturing exception because it's already been captured.",b0="Discarded session because of missing or non-string release",v0=Symbol.for("SentryInternalError"),E0=Symbol.for("SentryDoNotSendEventError"),mI=5e3;function bu(e){return{message:e,[v0]:!0}}function Ud(e){return{message:e,[E0]:!0}}function y0(e){return!!e&&typeof e=="object"&&v0 in e}function _0(e){return!!e&&typeof e=="object"&&E0 in e}function w0(e,t,r,n,o){let i=0,s,a=!1;e.on(r,()=>{i=0,clearTimeout(s),a=!1}),e.on(t,u=>{i+=n(u),i>=8e5?o(e):a||(a=!0,s=zn(setTimeout(()=>{o(e)},mI)))}),e.on("flush",()=>{o(e)})}var yu=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Wn(t.transportOptions?.bufferSize??Ii),t.dsn?this._dsn=Cg(t.dsn):R&&b.warn("No DSN provided, client will not send events."),this._dsn){let n=n0(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:n})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&w0(this,"afterCaptureLog","flushLogs",yI,$n),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&w0(this,"afterCaptureMetric","flushMetrics",bI,l0)}captureException(t,r,n){let o=ie();if(ru(t))return R&&b.log(g0),o;let i={event_id:o,...r};return this._process(()=>this.eventFromException(t,i).then(s=>this._captureEvent(s,i,n)).then(s=>s),"error"),i.event_id}captureMessage(t,r,n,o){let i={event_id:ie(),...n},s=Sn(t)?t:String(t),a=Sr(t),u=a?this.eventFromMessage(s,r,i):this.eventFromException(t,i);return this._process(()=>u.then(l=>this._captureEvent(l,i,o)),a?"unknown":"error"),i.event_id}captureEvent(t,r,n){let o=ie();if(r?.originalException&&ru(r.originalException))return R&&b.log(g0),o;let i={event_id:o,...r},s=t.sdkProcessingMetadata||{},a=s.capturedSpanScope,u=s.capturedSpanIsolationScope,l=x0(t.type);return this._process(()=>this._captureEvent(t,i,a||n,u),l),i.event_id}captureSession(t){this.sendSession(t),Tt(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){let r=this._transport;if(!r)return!0;this.emit("flush");let n=await this._isClientDoneProcessing(t),o=await r.flush(t);return n&&o}async close(t){$n(this);let r=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),r}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let r=this._integrations[t.name];!r&&t.beforeSetup&&t.beforeSetup(this),Ld(this,t,this._integrations),r||Bd(this,[t])}sendEvent(t,r={}){this.emit("beforeSendEvent",t,r);let n=$g(t,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=Ad(n,Rd(o));this.sendEnvelope(n).then(o=>this.emit("afterSendEvent",t,o))}sendSession(t){let{release:r,environment:n=On}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!r){R&&b.warn(b0);return}i.release=i.release||r,i.environment=i.environment||n,t.attrs=i}else{if(!t.release&&!r){R&&b.warn(b0);return}t.release=t.release||r,t.environment=t.environment||n}this.emit("beforeSendSession",t);let o=qg(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(t,r,n=1){if(this._options.sendClientReports){let o=`${t}:${r}`;R&&b.log(`Recording outcome: "${o}"${n>1?` (${n} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+n}}on(t,r){let n=this._hooks[t]=this._hooks[t]||new Set,o=(...i)=>r(...i);return n.add(o),()=>{n.delete(o)}}emit(t,...r){let n=this._hooks[t];n&&n.forEach(o=>o(...r))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(r){return R&&b.error("Error while sending envelope:",r),{}}return R&&b.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=o0(this,t),Bd(this,t)}_updateSessionFromEvent(t,r){let n=r.level==="fatal",o=!1,i=r.exception?.values;if(i){o=!0,n=!1;for(let u of i)if(u.mechanism?.handled===!1){n=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&n)&&(Tt(t,{...n&&{status:"crashed"},errors:t.errors||Number(o||n)}),this.captureSession(t))}async _isClientDoneProcessing(t){let r=0;for(;!t||r<t;){if(await new Promise(n=>setTimeout(n,1)),!this._numProcessing)return!0;r++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,r,n,o){let i=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",t,r),t.type||o.setLastEventId(t.event_id||r.event_id),t0(i,t,r,n,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts={trace:{...a.contexts?.trace,...pi(n)},...a.contexts};let u=Mn(this,n);return a.sdkProcessingMetadata={dynamicSamplingContext:u,...a.sdkProcessingMetadata},a})}_captureEvent(t,r={},n=ee(),o=ne()){return R&&jd(t)&&b.log(`Captured error event \`${gu(t)[0]||"<unknown>"}\``),this._processEvent(t,r,n,o).then(i=>i.event_id,i=>{R&&(_0(i)?b.log(i.message):y0(i)?b.warn(i.message):b.warn(i))})}_processEvent(t,r,n,o){let i=this.getOptions(),{sampleRate:s}=i,a=C0(t),u=jd(t),d=`before send for type \`${t.type||"error"}\``,p=typeof s>"u"?void 0:mi(s);if(u&&typeof p=="number"&&xe()>p)return this.recordDroppedEvent("sample_rate","error"),jn(Ud(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let f=x0(t.type);return this._prepareEvent(t,r,n,o).then(m=>{if(m===null)throw this.recordDroppedEvent("event_processor",f),Ud("An event processor returned `null`, will not send event.");if(r.data?.__sentry__===!0)return m;let y=gI(this,i,m,r);return hI(y,d)}).then(m=>{if(m===null){if(this.recordDroppedEvent("before_send",f),a){let D=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",D)}throw Ud(`${d} returned \`null\`, will not send event.`)}let h=n.getSession()||o.getSession();if(u&&h&&this._updateSessionFromEvent(h,m),a){let S=m.sdkProcessingMetadata?.spanCountBeforeProcessing||0,D=m.spans?m.spans.length:0,w=S-D;w>0&&this.recordDroppedEvent("before_send","span",w)}let y=m.transaction_info;if(a&&y&&m.transaction!==t.transaction){let S="custom";m.transaction_info={...y,source:S}}return this.sendEvent(m,r),m}).then(null,m=>{throw _0(m)||y0(m)?m:(this.captureException(m,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:m}),bu(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
Reason: ${m}`))})}_process(t,r){this._numProcessing++,this._promiseBuffer.add(t).then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n===Ai&&this.recordDroppedEvent("queue_overflow",r),n))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([r,n])=>{let[o,i]=r.split(":");return{reason:o,category:i,quantity:n}})}_flushOutcomes(){R&&b.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){R&&b.log("No outcomes to send");return}if(!this._dsn){R&&b.log("No dsn provided, will not send outcomes");return}R&&b.log("Sending outcomes:",t);let r=f0(t,this._options.tunnel&&Se(this._dsn));this.sendEnvelope(r)}};function x0(e){return e==="replay_event"?"replay":e||"error"}function hI(e,t){let r=`${t} must return \`null\` or a valid event.`;if(rt(e))return e.then(n=>{if(!vt(n)&&n!==null)throw bu(r);return n},n=>{throw bu(`${t} rejected with ${n}`)});if(!vt(e)&&e!==null)throw bu(r);return e}function gI(e,t,r,n){let{beforeSend:o,beforeSendTransaction:i,ignoreSpans:s}=t,a=!Fn(t.beforeSendSpan)&&t.beforeSendSpan,u=r;if(jd(u)&&o)return o(u,n);if(C0(u)){if(a||s){let l=m0(u);if(s?.length&&Ed(l,s))return null;if(a){let d=a(l);d?u=Ht(r,h0(d)):_i()}if(u.spans){let d=[],p=u.spans;for(let m of p){if(s?.length&&Ed(m,s)){Lg(p,m);continue}if(a){let h=a(m);h?d.push(h):(_i(),d.push(m))}else d.push(m)}let f=u.spans.length-d.length;f&&e.recordDroppedEvent("before_send","span",f),u.spans=d}}if(i){if(u.spans){let l=u.spans.length;u.sdkProcessingMetadata={...r.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return i(u,n)}}return u}function jd(e){return e.type===void 0}function C0(e){return e.type==="transaction"}function bI(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+T0(e.attributes)}function yI(e){let t=0;return e.message&&(t+=e.message.length*2),t+T0(e.attributes)}function T0(e){if(!e)return 0;let t=0;return Object.values(e).forEach(r=>{Array.isArray(r)?t+=r.length*S0(r[0]):Sr(r)?t+=S0(r):t+=100}),t}function S0(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function k0(e,t,r,n,o){let i={sent_at:new Date().toISOString()};r?.sdk&&(i.sdk={name:r.sdk.name,version:r.sdk.version}),n&&o&&(i.dsn=Se(o)),t&&(i.trace=t);let s=_I(e);return ge(i,[s])}function _I(e){return[{type:"check_in"},e]}function A0(e){let t=e._metadata?.sdk,r=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...r&&{"user-agent":r},...e.transportOptions?.headers}}}function I0(e,t){return e(t.stack||"",1)}function wI(e){return tt(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function xI(e){return wI(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function qd(e,t){let r={type:t.name||t.constructor.name,value:xI(t)},n=I0(e,t);return n.length&&(r.stacktrace={frames:n}),r}function SI(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(r instanceof Error)return r}}function vI(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message '${e.message}'`),n}else if("message"in e&&typeof e.message=="string")return e.message;let t=Yh(e);if(td(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=EI(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function EI(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function CI(e,t,r,n){if(tt(r))return[r,void 0];if(t.synthetic=!0,vt(r)){let i=e?.getOptions().normalizeDepth,s={__serialized__:Td(r,i)},a=SI(r);if(a)return[a,s];let u=vI(r),l=n?.syntheticException||new Error(u);return l.message=u,[l,s]}let o=n?.syntheticException||new Error(r);return o.message=`${r}`,[o,void 0]}function R0(e,t,r,n){let i=n?.data&&n.data.mechanism||{handled:!0,type:"generic"},[s,a]=CI(e,i,r,n),u={exception:{values:[qd(t,s)]}};return a&&(u.extra=a),dd(u,void 0,void 0),kn(u,i),{...u,event_id:n?.event_id}}function P0(e,t,r="info",n,o){let i={event_id:n?.event_id,level:r};if(o&&n?.syntheticException){let s=I0(e,n.syntheticException);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]},kn(i,{synthetic:!0}))}if(Sn(t)){let{__sentry_template_string__:s,__sentry_template_values__:a}=t;return i.logentry={message:s,params:a},i}return i.message=t,i}var Ri=class extends yu{constructor(t){Mg(),A0(t),super(t),this._setUpMetricsProcessing()}eventFromException(t,r){let n=R0(this,this._options.stackParser,t,r);return n.level="error",kt(n)}eventFromMessage(t,r="info",n){return kt(P0(this._options.stackParser,t,r,n,this._options.attachStacktrace))}captureException(t,r,n){return D0(r),super.captureException(t,r,n)}captureEvent(t,r,n){return!t.type&&t.exception?.values&&t.exception.values.length>0&&D0(r),super.captureEvent(t,r,n)}captureCheckIn(t,r,n){let o="checkInId"in t&&t.checkInId?t.checkInId:ie();if(!this._isEnabled())return R&&b.warn("SDK not enabled, will not capture check-in."),o;let i=this.getOptions(),{release:s,environment:a,tunnel:u}=i,l={check_in_id:o,monitor_slug:t.monitorSlug,status:t.status,release:s,environment:a};"duration"in t&&(l.duration=t.duration),r&&(l.monitor_config={schedule:r.schedule,checkin_margin:r.checkinMargin,max_runtime:r.maxRuntime,timezone:r.timezone,failure_issue_threshold:r.failureIssueThreshold,recovery_threshold:r.recoveryThreshold});let[d,p]=i0(this,n);p&&(l.contexts={trace:p});let f=k0(l,d,this.getSdkMetadata(),u,this.getDsn());return R&&b.log("Sending checkin:",t.monitorSlug,t.status),this.sendEnvelope(f),o}dispose(){R&&b.log("Disposing client...");for(let t of Object.keys(this._hooks))this._hooks[t]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Wn(Ii)}_prepareEvent(t,r,n,o){return this._options.platform&&(t.platform=t.platform||this._options.platform),this._options.runtime&&(t.contexts={...t.contexts,runtime:t.contexts?.runtime||this._options.runtime}),this._options.serverName&&(t.server_name=t.server_name||this._options.serverName),super._prepareEvent(t,r,n,o)}_setUpMetricsProcessing(){this.on("processMetric",t=>{this._options.serverName&&(t.attributes={"server.address":this._options.serverName,...t.attributes})})}};function D0(e){let t=ne().getScopeData().sdkProcessingMetadata.requestSession;if(t){let r=e?.mechanism?.handled??!0;r&&t.status!=="crashed"?t.status="errored":r||(t.status="crashed")}}var TI=new Set(["false","f","n","no","off","0"]),kI=new Set(["true","t","y","yes","on","1"]);function Zt(e,t){let r=String(e).toLowerCase();return TI.has(r)?!1:kI.has(r)?!0:t?.strict?null:!!e}function Pi(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}function $d(e){return e.split(/[?#]/,1)[0]}function Di(e){let{protocol:t,host:r,path:n}=e,o=r?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${o}${n}`}function Ni(e,t,r=[t],n="npm"){let o=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${t}`,o.packages=r.map(i=>({name:`${n}:@sentry/${i}`,version:qe})),o.version=qe)}function Ir(e={}){let t=e.client||Y();if(!Ti()||!t)return{};let r=he(),n=De(r);if(n.getTraceData)return n.getTraceData(e);let o=e.scope||ee(),i=e.span||Gt();if(!i&&yd())return{};let s=i?pu(i):AI(o),a=i?Kt(i):Mn(t,o),u=su(a);if(!lu.test(s))return b.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let d={"sentry-trace":s,baggage:u};return e.propagateTraceparent&&(d.traceparent=i?Ig(i):II(o)),d}function AI(e){let{traceId:t,sampled:r,propagationSpanId:n}=e.getPropagationContext();return gi(t,n,r)}function II(e){let{traceId:t,sampled:r,propagationSpanId:n}=e.getPropagationContext();return bi(t,n,r)}var N0="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function Oi(e,t,r){if(typeof e!="string"||!t)return!0;let n=r?.get(e);if(n!==void 0)return R&&!n&&b.log(N0,e),n;let o=zt(e,t);return r?.set(e,o),R&&!o&&b.log(N0,e),o}function O0(e){let t=Object.create(null);try{Object.entries(e).forEach(([r,n])=>{typeof n=="string"&&(t[r]=n)})}catch{}return t}function zd(e){let t=e.headers||{},n=(typeof t["x-forwarded-host"]=="string"?t["x-forwarded-host"]:void 0)||(typeof t.host=="string"?t.host:void 0),i=(typeof t["x-forwarded-proto"]=="string"?t["x-forwarded-proto"]:void 0)||e.protocol||(e.socket?.encrypted?"https":"http"),s=e.url||"",a=RI({url:s,host:n,protocol:i}),u=e.body||void 0,l=e.cookies;return{url:a,method:e.method,query_string:M0(s),headers:O0(t),cookies:l,data:u}}function RI({url:e,protocol:t,host:r}){if(e?.startsWith("http"))return e;if(e&&r)return`${t}://${r}${e}`}function M0(e){if(e)try{let t=new URL(e,"http://s.io").search.slice(1);return t.length?t:void 0}catch{return}}var PI=100;function ke(e,t){let r=Y(),n=ne();if(!r)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:i=PI}=r.getOptions();if(i<=0)return;let a={timestamp:Ct(),...e},u=o?pe(()=>o(a,t)):a;u!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",u,t),n.addBreadcrumb(u,i))}var F0,DI="FunctionToString",B0=new WeakMap,NI=(()=>({name:DI,setupOnce(){F0=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Jh(this),r=B0.has(Y())&&t!==void 0?t:this;return F0.apply(r,e)}}catch{}},setup(e){B0.set(e,!0)}})),Mi=NI;var OI=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],MI="EventFilters",Hn=(e={})=>{let t;return{name:MI,setup(r){let n=r.getOptions();t=L0(e,n)},processEvent(r,n,o){if(!t){let i=o.getOptions();t=L0(e,i)}return FI(r,t)?null:r}}},U0=((e={})=>({...Hn(e),name:"InboundFilters"}));function L0(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:OI],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function FI(e,t){if(e.type){if(e.type==="transaction"&&LI(e,t.ignoreTransactions))return R&&b.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
Event: ${Wt(e)}`),!0}else{if(BI(e,t.ignoreErrors))return R&&b.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
Event: ${Wt(e)}`),!0;if($I(e))return R&&b.warn(`Event dropped due to not having an error message, error type or stacktrace.
Event: ${Wt(e)}`),!0;if(UI(e,t.denyUrls))return R&&b.warn(`Event dropped due to being matched by \`denyUrls\` option.
Event: ${Wt(e)}.
Url: ${_u(e)}`),!0;if(!jI(e,t.allowUrls))return R&&b.warn(`Event dropped due to not being matched by \`allowUrls\` option.
Event: ${Wt(e)}.
Url: ${_u(e)}`),!0}return!1}function BI(e,t){return t?.length?gu(e).some(r=>zt(r,t)):!1}function LI(e,t){if(!t?.length)return!1;let r=e.transaction;return r?zt(r,t):!1}function UI(e,t){if(!t?.length)return!1;let r=_u(e);return r?zt(r,t):!1}function jI(e,t){if(!t?.length)return!0;let r=_u(e);return r?zt(r,t):!0}function qI(e=[]){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function _u(e){try{let r=[...e.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?qI(r):null}catch{return R&&b.error(`Cannot extract url for event ${Wt(e)}`),null}}function $I(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function $0(e,t,r,n,o,i){if(!o.exception?.values||!i||!nt(i.originalException,Error))return;let s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=Wd(e,t,n,i.originalException,r,o.exception.values,s,0))}function Wd(e,t,r,n,o,i,s,a){if(i.length>=r+1)return i;let u=[...i];if(nt(n[o],Error)){j0(s,a,n);let l=e(t,n[o]),d=u.length;q0(l,o,d,a),u=Wd(e,t,r,n[o],o,[l,...u],l,d)}return z0(n)&&n.errors.forEach((l,d)=>{if(nt(l,Error)){j0(s,a,n);let p=e(t,l),f=u.length;q0(p,`errors[${d}]`,f,a),u=Wd(e,t,r,l,o,[p,...u],p,f)}}),u}function z0(e){return Array.isArray(e.errors)}function j0(e,t,r){e.mechanism={handled:!0,type:"auto.core.linked_errors",...z0(r)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function q0(e,t,r,n){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}var zI="cause",WI=5,HI="LinkedErrors",VI=((e={})=>{let t=e.limit||WI,r=e.key||zI;return{name:HI,preprocessEvent(n,o,i){let s=i.getOptions();$0(qd,s.stackParser,r,t,n,o)}}}),Fi=VI;function W0(e){let t={},r=0;for(;r<e.length;){let n=e.indexOf("=",r);if(n===-1)break;let o=e.indexOf(";",r);if(o===-1)o=e.length;else if(o<n){r=e.lastIndexOf(";",n-1)+1;continue}let i=e.slice(r,n).trim();if(t[i]===void 0){let s=e.slice(n+1,o).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));try{t[i]=s.indexOf("%")!==-1?decodeURIComponent(s):s}catch{t[i]=s}}r=o+1}return t}var Hd=["X-Client-IP","X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP","Fastly-Client-Ip","True-Client-Ip","X-Real-IP","X-Cluster-Client-IP","X-Forwarded","Forwarded-For","Forwarded","X-Vercel-Forwarded-For"];function H0(e){let t={};for(let i of Object.keys(e))t[i.toLowerCase()]=e[i];return Hd.map(i=>{let s=t[i.toLowerCase()],a=Array.isArray(s)?s.join(";"):s;return i==="Forwarded"?GI(a):a?.split(",").map(u=>u.trim())}).reduce((i,s)=>s?i.concat(s):i,[]).find(i=>i!==null&&KI(i))||null}function GI(e){if(!e)return null;for(let t of e.split(";"))if(t.startsWith("for="))return t.slice(4);return null}function KI(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}var JI={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},YI="RequestData",ZI=((e={})=>{let t={...JI,...e.include};return{name:YI,processEvent(r,n,o){let{sdkProcessingMetadata:i={}}=r,{normalizedRequest:s,ipAddress:a}=i,u={...t,ip:t.ip??o.getOptions().sendDefaultPii};return s&&XI(r,s,{ipAddress:a},u),r}}}),Bi=ZI;function XI(e,t,r,n){if(e.request={...e.request,...QI(t,n)},n.ip){let o=t.headers&&H0(t.headers)||r.ipAddress;o&&(e.user={...e.user,ip_address:o})}}function QI(e,t){let r={},n={...e.headers};if(t.headers&&(r.headers=n,t.cookies||delete n.cookie,t.ip||Hd.forEach(o=>{delete n[o]})),r.method=e.method,t.url&&(r.url=e.url),t.cookies){let o=e.cookies||(n?.cookie?W0(n.cookie):void 0);r.cookies=o||{}}return t.query_string&&(r.query_string=e.query_string),t.data&&(r.data=e.data),r}function V0(e){let t="console";_n(t,e),wn(t,eR)}function eR(){"console"in $&&oi.forEach(function(e){e in $.console&&Kh($.console,e,function(t){return yn[e]=t,function(...r){xn("console",{args:r,level:e}),yn[e]?.apply($.console,r)}})})}function G0(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var tR=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function rR(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,r=tR.exec(t);return r?r.slice(1):[]}function Vd(e){let t=rR(e),r=t[0]||"",n=t[1];return!r&&!n?".":(n&&(n=n.slice(0,n.length-1)),r+n)}var nR="Console",Li=(e={})=>{let t=new Set(e.levels||oi);return{name:nR,setup(r){V0(({args:n,level:o})=>{Y()!==r||!t.has(o)||oR(o,n)})}}};function oR(e,t){let r={category:"console",data:{arguments:t,logger:"console"},level:G0(e),message:K0(t)};if(e==="assert")if(t[0]===!1){let n=t.slice(1);r.message=n.length>0?`Assertion failed: ${K0(n)}`:"Assertion failed",r.data.arguments=n}else return;ke(r,{input:t,level:e})}function K0(e){return"util"in $&&typeof $.util.format=="function"?$.util.format(...e):ud(e," ")}function J0(e,t,r){let n=r.getDsn(),o=r.getOptions().tunnel,i=Bn(r.getOptions()._metadata),s={sent_at:new Date().toISOString(),...iR(t)&&{trace:t},...i&&{sdk:i},...!!o&&n&&{dsn:Se(n)}},a=[{type:"span",item_count:e.length,content_type:"application/vnd.sentry.items.span.v2+json"},{items:e}];return ge(s,[a])}function iR(e){return!!e.trace_id&&!!e.public_key}function Y0(e){let t=156;if(t+=e.name.length*2,t+=bd(e.attributes),e.links&&e.links.length>0){let n=e.links[0]?.attributes,o=100+(n?bd(n):0);t+=o*e.links.length}return t}var Z0=1e3,sR=5e6,wu=class{constructor(t,r){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:n,flushInterval:o,maxTraceWeightInBytes:i}=r??{};this._maxSpanLimit=n&&n>0&&n<=Z0?n:Z0,this._flushInterval=o&&o>0?o:5e3,this._maxTraceWeight=i&&i>0?i:sR,this._client.on("flush",()=>{this.drain()}),this._client.on("close",()=>{this._traceBuckets.forEach(s=>{clearTimeout(s.timeout)}),this._traceBuckets.clear()})}add(t){let r=t.trace_id,n=this._traceBuckets.get(r);n||(n={spans:new Set,size:0,timeout:zn(setTimeout(()=>{this.flush(r)},this._flushInterval))},this._traceBuckets.set(r,n)),n.spans.add(t),n.size+=Y0(t),(n.spans.size>=this._maxSpanLimit||n.size>=this._maxTraceWeight)&&this.flush(r)}drain(){this._traceBuckets.size&&(R&&b.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((t,r)=>{this.flush(r)}))}flush(t){let r=this._traceBuckets.get(t);if(!r)return;if(!r.spans.size){this._removeTrace(t);return}let n=Array.from(r.spans),o=n[0]?._segmentSpan;if(!o){R&&b.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let i=Kt(o),s=n.map(u=>{let{_segmentSpan:l,...d}=u;return d}),a=J0(s,i,this._client);R&&b.log(`Sending span envelope for trace ${t} with ${s.length} spans`),this._client.sendEnvelope(a).then(null,u=>{R&&b.error("Error while sending streamed span envelope:",u)}),this._removeTrace(t)}_removeTrace(t){let r=this._traceBuckets.get(t);r&&clearTimeout(r.timeout),this._traceBuckets.delete(t)}};var Ui=()=>({name:"SpanStreaming",setup(e){let t="SpanStreaming integration requires",r="Falling back to static trace lifecycle.",n=e.getOptions();if(!zg(e)){n.traceLifecycle="static",R&&b.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${r}`);return}let o=n.beforeSendSpan;if(o&&!Fn(o)){n.traceLifecycle="static",R&&b.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${r}`);return}let i=new wu(e);e.on("afterSpanEnd",s=>{Nn(s)&&i.add(Gg(s,e))})}});function ji(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}function eb(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function tb(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,n=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let i=o.match(n);if(i)return{filename:`<data:${i[2]}>`,function:i[1]};let s=o.match(r);if(s){let a,u,l,d,p;if(s[1]){l=s[1];let y=l.lastIndexOf(".");if(l[y-1]==="."&&y--,y>0){a=l.slice(0,y),u=l.slice(y+1);let S=a.indexOf(".Module");S>0&&(l=l.slice(S+1),a=a.slice(0,S))}d=void 0}u&&(d=a,p=u),u==="<anonymous>"&&(p=void 0,l=void 0),l===void 0&&(p=p||"?",l=d?`${d}.${p}`:p);let f=jh(s[2]),m=s[5]==="native";!f&&s[5]&&!m&&(f=s[5]);let h=f?aR(f):void 0;return{filename:h??f,module:h&&e?.(h),function:l,lineno:X0(s[3]),colno:X0(s[4]),in_app:eb(f||"",m)}}if(o.match(t))return{filename:o}}}function Gd(e){return[90,tb(e)]}function X0(e){return parseInt(e||"",10)||void 0}function aR(e){try{return decodeURI(e)}catch{return}}var Ne=class{constructor(t){this._maxSize=t,this._cache=new Map}get size(){return this._cache.size}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){if(this._cache.size>=this._maxSize){let n=this._cache.keys().next().value;this._cache.delete(n)}this._cache.set(t,r)}remove(t){let r=this._cache.get(t);return r&&this._cache.delete(t),r}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let t=[];return this._cache.forEach(r=>t.push(r)),t}};import{threadId as uR,isMainThread as lR}from"worker_threads";var Z=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var cR=6e4,xu=class extends Ri{constructor(t){let r=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||wb.hostname(),n={...t,platform:"node",runtime:{name:"node",version:global.process.version},serverName:r};Ni(n,"node-light",["node-core"]),b.log(`Initializing Sentry: process: ${process.pid}, thread: ${lR?"main":`worker-${uR}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{$n(this)},r&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":r}}),process.on("beforeExit",this._logOnExitFlushListener))}async flush(t){return this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(t)}async close(t){return this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener),super.close(t)}startClientReportTracking(){let t=this.getOptions();t.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{Z&&b.log("Flushing client reports based on interval."),this._flushOutcomes()},t.clientReportFlushInterval??cR).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}};import*as Kd from"node:diagnostics_channel";var dR="ChildProcess",xb=(e={})=>({name:dR,setup(){Kd.channel("child_process").subscribe(t=>{t&&typeof t=="object"&&"process"in t&&pR(t.process,e)}),Kd.channel("worker_threads").subscribe(t=>{t&&typeof t=="object"&&"worker"in t&&fR(t.worker,e)})}});function pR(e,t){let r=!1,n;e.on("spawn",()=>{if(e.spawnfile==="/usr/bin/sw_vers"){r=!0;return}n={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(n.spawnargs=e.spawnargs)}).on("exit",o=>{r||(r=!0,o!==null&&o!==0&&ke({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:n}))}).on("error",o=>{r||(r=!0,ke({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:n}))})}function fR(e,t){let r;e.on("online",()=>{r=e.threadId}).on("error",n=>{t.captureWorkerErrors!==!1?ue(n,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(r)}}}):ke({category:"worker_thread",message:`Worker thread errored with '${n.message}'`,level:"error",data:{threadId:r}})})}import{execFile as mR}from"node:child_process";import{readFile as hR,readdir as gR}from"node:fs";import*as le from"node:os";import{join as bR}from"node:path";import{promisify as vb}from"node:util";var yR=vb(hR),_R=vb(gR),wR="Context",xR=((e={})=>{let t,r={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e};async function n(i){t===void 0&&(t=o());let s=SR(await t);return i.contexts={...i.contexts,app:{...s.app,...i.contexts?.app},os:{...s.os,...i.contexts?.os},device:{...s.device,...i.contexts?.device},culture:{...s.culture,...i.contexts?.culture},cloud_resource:{...s.cloud_resource,...i.contexts?.cloud_resource}},i}async function o(){let i={};if(r.os&&(i.os=await vR()),r.app&&(i.app=CR()),r.device&&(i.device=TR(r.device)),r.culture){let s=ER();s&&(i.culture=s)}return r.cloudResource&&(i.cloud_resource=DR()),i}return{name:wR,processEvent(i){return n(i)}}}),Eb=xR;function SR(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory=="function"){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=le.freemem()),e}async function vR(){let e=le.platform();switch(e){case"darwin":return RR();case"linux":return PR();default:return{name:kR[e]||e,version:le.release()}}}function ER(){try{if(typeof process.versions.icu!="string")return;let e=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(e)==="enero"){let r=Intl.DateTimeFormat().resolvedOptions();return{locale:r.locale,timezone:r.timeZone}}}catch{}}function CR(){let e=process.memoryUsage().rss,r={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory=="function"){let n=process.availableMemory?.();n!=null&&(r.free_memory=n)}return r}function TR(e){let t={},r;try{r=le.uptime()}catch{}if(typeof r=="number"&&(t.boot_time=new Date(Date.now()-r*1e3).toISOString()),t.arch=le.arch(),(e===!0||e.memory)&&(t.memory_size=le.totalmem(),t.free_memory=le.freemem()),e===!0||e.cpu){let n=le.cpus(),o=n?.[0];o&&(t.processor_count=n.length,t.cpu_description=o.model,t.processor_frequency=o.speed)}return t}var kR={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},AR=[{name:"fedora-release",distros:["Fedora"]},{name:"redhat-release",distros:["Red Hat Linux","Centos"]},{name:"redhat_version",distros:["Red Hat Linux"]},{name:"SuSE-release",distros:["SUSE Linux"]},{name:"lsb-release",distros:["Ubuntu Linux","Arch Linux"]},{name:"debian_version",distros:["Debian"]},{name:"debian_release",distros:["Debian"]},{name:"arch-release",distros:["Arch Linux"]},{name:"gentoo-release",distros:["Gentoo Linux"]},{name:"novell-release",distros:["SUSE Linux"]},{name:"alpine-release",distros:["Alpine Linux"]}],IR={alpine:e=>e,arch:e=>at(/distrib_release=(.*)/,e),centos:e=>at(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>at(/release (..)/,e),mint:e=>at(/distrib_release=(.*)/,e),red:e=>at(/release ([^ ]+)/,e),suse:e=>at(/VERSION = (.*)\n/,e),ubuntu:e=>at(/distrib_release=(.*)/,e)};function at(e,t){let r=e.exec(t);return r?r[1]:void 0}async function RR(){let e={kernel_version:le.release(),name:"Mac OS X",version:`10.${Number(le.release().split(".")[0])-4}`};try{let t=await new Promise((r,n)=>{mR("/usr/bin/sw_vers",(o,i)=>{if(o){n(o);return}r(i)})});e.name=at(/^ProductName:\s+(.*)$/m,t),e.version=at(/^ProductVersion:\s+(.*)$/m,t),e.build=at(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Sb(e){return e.split(" ")[0].toLowerCase()}async function PR(){let e={kernel_version:le.release(),name:"Linux"};try{let t=await _R("/etc"),r=AR.find(a=>t.includes(a.name));if(!r)return e;let n=bR("/etc",r.name),o=(await yR(n,{encoding:"utf-8"})).toLowerCase(),{distros:i}=r;e.name=i.find(a=>o.indexOf(Sb(a))>=0)||i[0];let s=Sb(e.name);e.version=IR[s]?.(o)}catch{}return e}function DR(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as NR}from"node:fs";import{createInterface as OR}from"node:readline";var Jd=new Ne(10),kb=new Ne(20),MR=7,FR="ContextLines",BR=1e3,LR=1e4;function UR(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function jR(e){return!!(e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:"))}function qR(e){return e.lineno!==void 0&&e.lineno>LR||e.colno!==void 0&&e.colno>BR}function $R(e,t){let r=Jd.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function zR(e,t){if(!e.length)return[];let r=0,n=e[0];if(typeof n!="number")return[];let o=Tb(n,t),i=[];for(;;){if(r===e.length-1){i.push(o);break}let s=e[r+1];if(typeof s!="number")break;s<=o[1]?o[1]=s+t:(i.push(o),o=Tb(s,t)),r++}return i}function WR(e,t,r){return new Promise((n,o)=>{let i=NR(e),s=OR({input:i});function a(){i.destroy(),n()}let u=0,l=0,d=t[l];if(d===void 0){a();return}let p=d[0],f=d[1];function m(h){kb.set(e,1),Z&&b.error(`Failed to read file: ${e}. Error: ${h}`),s.close(),s.removeAllListeners(),a()}i.on("error",m),s.on("error",m),s.on("close",a),s.on("line",h=>{if(u++,!(u<p)&&(r[u]=ad(h,0),u>=f)){if(l===t.length-1){s.close(),s.removeAllListeners();return}l++;let y=t[l];if(y===void 0){s.close(),s.removeAllListeners();return}p=y[0],f=y[1]}})})}async function HR(e,t){let r={};if(t>0&&e.exception?.values){for(let i of e.exception.values)if(i.stacktrace?.frames?.length)for(let s=i.stacktrace.frames.length-1;s>=0;s--){let a=i.stacktrace.frames[s],u=a?.filename;if(!a||typeof u!="string"||typeof a.lineno!="number"||jR(u)||qR(a))continue;r[u]||(r[u]=[]),r[u].push(a.lineno)}}let n=Object.keys(r);if(n.length==0)return e;let o=[];for(let i of n){if(kb.get(i))continue;let s=r[i];if(!s)continue;s.sort((l,d)=>l-d);let a=zR(s,t);if(a.every(l=>$R(i,l)))continue;let u=UR(Jd,i,{});o.push(WR(i,a,u))}if(await Promise.all(o).catch(()=>{Z&&b.log("Failed to read one or more source files and resolve context lines")}),t>0&&e.exception?.values)for(let i of e.exception.values)i.stacktrace?.frames&&i.stacktrace.frames.length>0&&VR(i.stacktrace.frames,t,Jd);return e}function VR(e,t,r){for(let n of e)if(n.filename&&n.context_line===void 0&&typeof n.lineno=="number"){let o=r.get(n.filename);if(o===void 0)continue;GR(n.lineno,n,t,o)}}function Cb(e){delete e.pre_context,delete e.context_line,delete e.post_context}function GR(e,t,r,n){if(t.lineno===void 0||n===void 0){Z&&b.error("Cannot resolve context for frame with no lineno or file contents");return}t.pre_context=[];for(let i=Ab(e,r);i<e;i++){let s=n[i];if(s===void 0){Cb(t),Z&&b.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(s)}if(n[e]===void 0){Cb(t),Z&&b.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=n[e];let o=Ib(e,r);t.post_context=[];for(let i=e+1;i<=o;i++){let s=n[i];if(s===void 0)break;t.post_context.push(s)}}function Ab(e,t){return Math.max(1,e-t)}function Ib(e,t){return e+t}function Tb(e,t){return[Ab(e,t),Ib(e,t)]}var KR=((e={})=>{let t=e.frameContextLines!==void 0?e.frameContextLines:MR;return{name:FR,processEvent(r){return HR(r,t)}}}),Rb=KR;var Su=pd(process.versions.node),Pb=Su.major,WK=Su.minor;import{Worker as JR}from"node:worker_threads";var vu;async function Eu(){if(vu===void 0)try{vu=!!(await import("node:inspector")).url()}catch{vu=!1}return vu}var qi="__SENTRY_ERROR_LOCAL_VARIABLES__";function Nb(e,t,r){let n=0,o=5,i=0;return setInterval(()=>{i===0?n>e&&(o*=2,r(o),o>86400&&(o=86400),i=o):(i-=1,i===0&&t()),n=0},1e3).unref(),()=>{n+=1}}function Db(e){return e!==void 0&&(e.length===0||e==="?"||e==="<anonymous>")}function Cu(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||Db(e)&&Db(t)}var YR="LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjQ4LjAgKGE2N2RmNGQpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";function Ob(...e){b.log("[LocalVariables]",...e)}var Mb=((e={})=>{function t(i,s){let a=(i.stacktrace?.frames||[]).filter(u=>u.function!=="new Promise");for(let u=0;u<a.length;u++){let l=a.length-u-1,d=s[u],p=a[l];if(!p||!d)break;d.vars===void 0||p.in_app===!1&&e.includeOutOfAppFrames!==!0||!Cu(p.function,d.function)||(p.vars=d.vars)}}function r(i,s){if(s.originalException&&typeof s.originalException=="object"&&qi in s.originalException&&Array.isArray(s.originalException[qi])){for(let a of i.exception?.values||[])t(a,s.originalException[qi]);s.originalException[qi]=void 0}return i}async function n(){let i=await import("node:inspector");i.url()||i.open(0)}function o(i){let s=new JR(new URL(`data:application/javascript;base64,${YR}`),{workerData:i,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{s.terminate()}),s.once("error",a=>{Ob("Worker error",a)}),s.once("exit",a=>{Ob("Worker exit",a)}),s.unref()}return{name:"LocalVariablesAsync",async setup(i){if(!i.getOptions().includeLocalVariables)return;if(await Eu()){b.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...e,debug:b.isEnabled()};n().then(()=>{try{o(a)}catch(u){b.error("Failed to start worker",u)}},u=>{b.error("Failed to start inspector",u)})},processEvent(i,s){return r(i,s)}}});function Fb(e){if(e!==void 0)return e.slice(-10).reduce((t,r)=>`${t},${r.function},${r.lineno},${r.colno}`,"")}function ZR(e,t){if(t!==void 0)return Fb(e(t,1))}function Bb(e){let t=[],r=!1;function n(s){t=[],!r&&(r=!0,e(s))}t.push(n);function o(s){t.push(s)}function i(s){let a=t.pop()||n;try{a(s)}catch{n(s)}}return{add:o,next:i}}var Yd=class e{constructor(t){this._session=t}static async create(t){if(t)return t;let r=await import("node:inspector");return new e(new r.Session)}configureAndConnect(t,r){this._session.connect(),this._session.on("Debugger.paused",n=>{t(n,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:r?"all":"uncaught"})}setPauseOnExceptions(t){this._session.post("Debugger.setPauseOnExceptions",{state:t?"all":"uncaught"})}getLocalVariables(t,r){this._getProperties(t,n=>{let{add:o,next:i}=Bb(r);for(let s of n)if(s.value?.objectId&&s.value.className==="Array"){let a=s.value.objectId;o(u=>this._unrollArray(a,s.name,u,i))}else if(s.value?.objectId&&s.value.className==="Object"){let a=s.value.objectId;o(u=>this._unrollObject(a,s.name,u,i))}else s.value&&o(a=>this._unrollOther(s,a,i));i({})})}_getProperties(t,r){this._session.post("Runtime.getProperties",{objectId:t,ownProperties:!0},(n,o)=>{r(n?[]:o.result)})}_unrollArray(t,r,n,o){this._getProperties(t,i=>{n[r]=i.filter(s=>s.name!=="length"&&!isNaN(parseInt(s.name,10))).sort((s,a)=>parseInt(s.name,10)-parseInt(a.name,10)).map(s=>s.value?.value),o(n)})}_unrollObject(t,r,n,o){this._getProperties(t,i=>{n[r]=i.map(s=>[s.name,s.value?.value]).reduce((s,[a,u])=>(s[a]=u,s),{}),o(n)})}_unrollOther(t,r,n){t.value&&("value"in t.value?t.value.value===void 0||t.value.value===null?r[t.name]=`<${t.value.value}>`:r[t.name]=t.value.value:"description"in t.value&&t.value.type!=="function"?r[t.name]=`<${t.value.description}>`:t.value.type==="undefined"&&(r[t.name]="<undefined>")),n(r)}},XR="LocalVariables",QR=((e={},t)=>{let r=new Ne(20),n,o=!1;function i(l){let d=Fb(l.stacktrace?.frames);if(d===void 0)return;let p=r.remove(d);if(p===void 0)return;let f=(l.stacktrace?.frames||[]).filter(m=>m.function!=="new Promise");for(let m=0;m<f.length;m++){let h=f.length-m-1,y=p[m],S=f[h];if(!S||!y)break;y.vars===void 0||S.in_app===!1&&e.includeOutOfAppFrames!==!0||!Cu(S.function,y.function)||(S.vars=y.vars)}}function s(l){for(let d of l.exception?.values||[])i(d);return l}let a;async function u(){let d=Y()?.getOptions();if(!d?.includeLocalVariables)return;if(Pb<18){b.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Eu()){b.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let f=await Yd.create(t),m=(y,{params:{reason:S,data:D,callFrames:w}},x)=>{if(S!=="exception"&&S!=="promiseRejection"){x();return}n?.();let E=ZR(y,D.description);if(E==null){x();return}let{add:I,next:C}=Bb(j=>{r.set(E,j),x()});for(let j=0;j<Math.min(w.length,5);j++){let{scopeChain:X,functionName:ae,this:ye}=w[j],me=X.find(q=>q.type==="local"),M=ye.className==="global"||!ye.className?ae:`${ye.className}.${ae}`;if(me?.object.objectId===void 0)I(q=>{q[j]={function:M},C(q)});else{let q=me.object.objectId;I(z=>f.getLocalVariables(q,Q=>{z[j]={function:M,vars:Q},C(z)}))}}C([])},h=e.captureAllExceptions!==!1;if(f.configureAndConnect((y,S)=>m(d.stackParser,y,S),h),h){let y=e.maxExceptionsPerSecond||50;n=Nb(y,()=>{b.log("Local variables rate-limit lifted."),f.setPauseOnExceptions(!0)},S=>{b.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${S} seconds.`),f.setPauseOnExceptions(!1)})}o=!0}catch(f){b.log("The `LocalVariables` integration failed to start.",f)}}return{name:XR,setupOnce(){a=u()},async processEvent(l){return await a,o?s(l):l},_getCachedFramesCount(){return r.size},_getFirstCachedFrame(){return r.values()[0]}}}),Lb=QR;var Ub=(e={})=>Su.major<19?Lb(e):Mb(e);import{existsSync as eP,readFileSync as qb}from"node:fs";import{dirname as tP,join as $b}from"node:path";function Tu(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var Zd,rP="Modules",nP=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,oP=(()=>({name:rP,processEvent(e){return e.modules={...e.modules,...jb()},e},getModules:jb})),zb=oP;function iP(){try{return Ya.cache?Object.keys(Ya.cache):[]}catch{return[]}}function sP(){return{...nP,...lP(),...Tu()?aP():{}}}function aP(){let e=Ya.main?.paths||[],t=iP(),r={},n=new Set;return t.forEach(o=>{let i=o,s=()=>{let a=i;if(i=tP(a),!i||a===i||n.has(a))return;if(e.indexOf(i)<0)return s();let u=$b(a,"package.json");if(n.add(a),!eP(u))return s();try{let l=JSON.parse(qb(u,"utf8"));r[l.name]=l.version}catch{}};s()}),r}function jb(){return Zd||(Zd=sP()),Zd}function uP(){try{let e=$b(process.cwd(),"package.json");return JSON.parse(qb(e,"utf8"))}catch{return{}}}function lP(){let e=uP();return{...e.dependencies,...e.devDependencies}}import{isMainThread as dP}from"worker_threads";var cP=2e3;function $i(e){pe(()=>{console.error(e)});let t=Y();if(t===void 0){Z&&b.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let r=t.getOptions(),n=r?.shutdownTimeout&&r.shutdownTimeout>0?r.shutdownTimeout:cP;t.close(n).then(o=>{o||Z&&b.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{Z&&b.error(o)})}var pP="OnUncaughtException",Wb=(e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:pP,setup(r){dP&&global.process.on("uncaughtException",fP(r,t))}}};function fP(e,t){let n=!1,o=!1,i=!1,s,a=e.getOptions();return Object.assign(u=>{let l=$i;t.onFatalError?l=t.onFatalError:a.onFatalError&&(l=a.onFatalError);let p=global.process.listeners("uncaughtException").filter(m=>m.name!=="domainUncaughtExceptionClear"&&m.tag!=="sentry_tracingErrorCallback"&&m._errorHandler!==!0).length===0,f=t.exitEvenIfOtherHandlersAreRegistered||p;n?f&&(i?(Z&&b.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),$i(u)):o||(o=!0,setTimeout(()=>{i||(i=!0,l(s,u))},2e3))):(s=u,n=!0,Y()===e&&ue(u,{originalException:u,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!i&&f&&(i=!0,l(u)))},{_errorHandler:!0})}var mP="OnUnhandledRejection",hP=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],gP=((e={})=>{let t={mode:e.mode??"warn",ignore:[...hP,...e.ignore??[]]};return{name:mP,setup(r){global.process.on("unhandledRejection",wP(r,t))}}}),Hb=gP;function bP(e){if(typeof e!="object"||e===null)return{name:"",message:String(e??"")};let t=e,r=typeof t.name=="string"?t.name:"",n=typeof t.message=="string"?t.message:String(e);return{name:r,message:n}}function yP(e,t){let r=e.name===void 0||Et(t.name,e.name,!0),n=e.message===void 0||Et(t.message,e.message);return r&&n}function _P(e,t){let r=bP(t);return e.some(n=>yP(n,r))}function wP(e,t){return function(n,o){if(Y()!==e||_P(t.ignore??[],n))return;let i=t.mode==="strict"?"fatal":"error",s=n&&typeof n=="object"?n._sentry_active_span:void 0;(s?u=>Ln(s,u):u=>u())(()=>{ue(n,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),xP(n,t.mode)}}function xP(e,t){let r="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";t==="warn"?pe(()=>{console.warn(r),console.error(e&&typeof e=="object"&&"stack"in e?e.stack:e)}):t==="strict"&&(pe(()=>{console.warn(r)}),$i(e))}var SP="ProcessSession",Vb=()=>({name:SP,setupOnce(){ki(),process.on("beforeExit",()=>{ne().getSession()?.status!=="ok"&&qn()})}});import*as Gb from"node:http";var Xd="Spotlight",vP=((e={})=>{let t={sidecarUrl:e.sidecarUrl||"http://localhost:8969/stream"};return{name:Xd,setup(r){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&b.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}EP(r,t)}}}),Kb=vP;function EP(e,t){let r=CP(t.sidecarUrl);if(!r)return;let n=0;e.on("beforeEnvelope",o=>{if(n>3){b.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let i=xi(o);kr(()=>{let s=Gb.request({method:"POST",path:r.pathname,hostname:r.hostname,port:r.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(n=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});s.on("error",()=>{n++,b.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),s.write(i),s.end()})})}function CP(e){try{return new URL(`${e}`)}catch{b.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}import*as Jb from"node:util";var TP="NodeSystemError";function kP(e){return!(e instanceof Error)||!("errno"in e)||typeof e.errno!="number"?!1:Jb.getSystemErrorMap().has(e.errno)}var Yb=(e={})=>({name:TP,processEvent:(t,r,n)=>{if(!kP(r.originalException))return t;let o=r.originalException,i={...o};!n.getOptions().sendDefaultPii&&e.includePaths!==!0&&(delete i.path,delete i.dest),t.contexts={...t.contexts,node_system_error:i};for(let s of t.exception?.values||[])s.value&&(o.path&&s.value.includes(o.path)&&(s.value=s.value.replace(`'${o.path}'`,"").trim()),o.dest&&s.value.includes(o.dest)&&(s.value=s.value.replace(`'${o.dest}'`,"").trim()));return t}});import{posix as AP,sep as IP}from"node:path";function Zb(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function Xb(e=process.argv[1]?Vd(process.argv[1]):process.cwd(),t=IP==="\\"){let r=t?Zb(e):e;return n=>{if(!n)return;let o=t?Zb(n):n,{dir:i,base:s,ext:a}=AP.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,a.length*-1));let u=decodeURIComponent(s);i||(i=".");let l=i.lastIndexOf("/node_modules");if(l>-1)return`${i.slice(l+14).replace(/\//g,".")}:${u}`;if(i.startsWith(r)){let d=i.slice(r.length+1).replace(/\//g,".");return d?`${d}:${u}`:u}return u}}function Qb(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if($.SENTRY_RELEASE?.id)return $.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,r=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,n=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||r||n||e}var ey=Xa(Gd(Xb()));import*as PP from"node:http";import*as DP from"node:https";import{Readable as NP}from"node:stream";import{createGzip as OP}from"node:zlib";import*as At from"node:net";import*as ep from"node:tls";import*as Qd from"node:http";var ut=Symbol("AgentBaseInternalState"),ku=class extends Qd.Agent{constructor(t){super(t),this[ut]={}}isSecureEndpoint(t){if(t){if(typeof t.secureEndpoint=="boolean")return t.secureEndpoint;if(typeof t.protocol=="string")return t.protocol==="https:"}let{stack:r}=new Error;return typeof r!="string"?!1:r.split(`
`).some(n=>n.indexOf("(https.js:")!==-1||n.indexOf("node:https:")!==-1)}createSocket(t,r,n){let o={...r,secureEndpoint:this.isSecureEndpoint(r)};Promise.resolve().then(()=>this.connect(t,o)).then(i=>{if(i instanceof Qd.Agent)return i.addRequest(t,o);this[ut].currentSocket=i,super.createSocket(t,r,n)},n)}createConnection(){let t=this[ut].currentSocket;if(this[ut].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[ut].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[ut]&&(this[ut].defaultPort=t)}get protocol(){return this[ut].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[ut]&&(this[ut].protocol=t)}};function Au(...e){b.log("[https-proxy-agent:parse-proxy-response]",...e)}function ty(e){return new Promise((t,r)=>{let n=0,o=[];function i(){let d=e.read();d?l(d):e.once("readable",i)}function s(){e.removeListener("end",a),e.removeListener("error",u),e.removeListener("readable",i)}function a(){s(),Au("onend"),r(new Error("Proxy connection ended before receiving CONNECT response"))}function u(d){s(),Au("onerror %o",d),r(d)}function l(d){o.push(d),n+=d.length;let p=Buffer.concat(o,n),f=p.indexOf(`\r
\r
`);if(f===-1){Au("have not received end of HTTP headers yet..."),i();return}let m=p.subarray(0,f).toString("ascii").split(`\r
`),h=m.shift();if(!h)return e.destroy(),r(new Error("No header received from proxy CONNECT response"));let y=h.split(" "),S=+(y[1]||0),D=y.slice(2).join(" "),w={};for(let x of m){if(!x)continue;let E=x.indexOf(":");if(E===-1)return e.destroy(),r(new Error(`Invalid header from proxy CONNECT response: "${x}"`));let I=x.slice(0,E).toLowerCase(),C=x.slice(E+1).trimStart(),j=w[I];typeof j=="string"?w[I]=[j,C]:Array.isArray(j)?j.push(C):w[I]=C}Au("got proxy server response: %o %o",h,w),s(),t({connect:{statusCode:S,statusText:D,headers:w},buffered:p})}e.on("error",u),e.on("end",a),i()})}function zi(...e){b.log("[https-proxy-agent]",...e)}var Wi=class extends ku{static __initStatic(){this.protocols=["http","https"]}constructor(t,r){super(r),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=r?.headers??{},zi("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?ry(r,"headers"):null,host:n,port:o}}async connect(t,r){let{proxy:n}=this;if(!r.host)throw new TypeError('No "host" provided');let o;if(n.protocol==="https:"){zi("Creating `tls.Socket`: %o",this.connectOpts);let f=this.connectOpts.servername||this.connectOpts.host;o=ep.connect({...this.connectOpts,servername:f&&At.isIP(f)?void 0:f})}else zi("Creating `net.Socket`: %o",this.connectOpts),o=At.connect(this.connectOpts);let i=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=At.isIPv6(r.host)?`[${r.host}]`:r.host,a=`CONNECT ${s}:${r.port} HTTP/1.1\r
`;if(n.username||n.password){let f=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i["Proxy-Authorization"]=`Basic ${Buffer.from(f).toString("base64")}`}i.Host=`${s}:${r.port}`,i["Proxy-Connection"]||(i["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let f of Object.keys(i))a+=`${f}: ${i[f]}\r
`;let u=ty(o);o.write(`${a}\r
`);let{connect:l,buffered:d}=await u;if(t.emit("proxyConnect",l),this.emit("proxyConnect",l,t),l.statusCode===200){if(t.once("socket",RP),r.secureEndpoint){zi("Upgrading socket connection to TLS");let f=r.servername||r.host;return ep.connect({...ry(r,"host","path","port"),socket:o,servername:At.isIP(f)?void 0:f})}return o}o.destroy();let p=new At.Socket({writable:!1});return p.readable=!0,t.once("socket",f=>{zi("Replaying proxy buffer for failed request"),f.push(d),f.push(null)}),p}};Wi.__initStatic();function RP(e){e.resume()}function ry(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}var MP=1024*32;function FP(e){return new NP({read(){this.push(e),this.push(null)}})}function ny(e){let t;try{t=new URL(e.url)}catch{return pe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),Yt(e,()=>Promise.resolve({}))}let r=t.protocol==="https:",n=BP(t,e.proxy||(r?process.env.https_proxy:void 0)||process.env.http_proxy),o=r?DP:PP,i=e.keepAlive===void 0?!1:e.keepAlive,s=n?new Wi(n):new o.Agent({keepAlive:i,maxSockets:30,timeout:2e3}),a=LP(e,e.httpModule??o,s);return Yt(e,a)}function BP(e,t){let{no_proxy:r}=process.env;if(!r?.split(",").some(o=>e.host.endsWith(o)||e.hostname.endsWith(o)))return t}function LP(e,t,r){let{hostname:n,pathname:o,port:i,protocol:s,search:a}=new URL(e.url);return function(l){return new Promise((d,p)=>{kr(()=>{let f=FP(l.body),m={...e.headers};l.body.length>MP&&(m["content-encoding"]="gzip",f=f.pipe(OP()));let h=n.startsWith("["),y=t.request({method:"POST",agent:r,headers:m,hostname:h?n.slice(1,-1):n,path:`${o}${a}`,port:i,protocol:s,ca:e.caCerts},S=>{S.on("data",()=>{}),S.on("end",()=>{}),S.setEncoding("utf8");let D=S.headers["retry-after"]??null,w=S.headers["x-sentry-rate-limits"]??null;d({statusCode:S.statusCode,headers:{"retry-after":D,"x-sentry-rate-limits":Array.isArray(w)?w[0]||null:w}})});y.on("error",p),f.pipe(y)})})}}function oy(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=Zt(process.env.SENTRY_SPOTLIGHT,{strict:!0}),r=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?r??!0:t??r}import{AsyncLocalStorage as UP}from"node:async_hooks";function iy(){let e=new UP;function t(){let a=e.getStore();return a||{scope:li(),isolationScope:ci()}}function r(a){let u=t().scope.clone(),l=t().isolationScope;return e.run({scope:u,isolationScope:l},()=>a(u))}function n(a,u){let l=t().isolationScope.clone();return e.run({scope:a,isolationScope:l},()=>u(a))}function o(a){let u=t().scope.clone(),l=t().isolationScope.clone();return e.run({scope:u,isolationScope:l},()=>a(l))}function i(a,u){let l=t().scope.clone();return e.run({scope:l,isolationScope:a},()=>u(a))}function s(a){return r(u=>(u.setSDKProcessingMetadata({__SENTRY_SUPPRESS_TRACING__:!0}),a()))}hd({suppressTracing:s,withScope:r,withSetScope:n,withIsolationScope:o,withSetIsolationScope:i,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}import{subscribe as Iu}from"node:diagnostics_channel";function sy(e,t,r,n){let o=0,i=[];Z&&b.log(n,"Patching request.on");let s=new WeakMap,a=r==="small"?1e3:r==="medium"?1e4:1048576;try{e.on=new Proxy(e.on,{apply:(u,l,d)=>{let[p,f,...m]=d;if(p==="data"){Z&&b.log(n,`Handling request.on("data") with maximum body size of ${a}b`);let h=new Proxy(f,{apply:(y,S,D)=>{try{let w=D[0],x=Buffer.from(w);o<a?(i.push(x),o+=x.byteLength):Z&&b.log(n,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{Z&&b.error(n,"Encountered error while storing body chunk.")}return Reflect.apply(y,S,D)}});return s.set(f,h),Reflect.apply(u,l,[p,h,...m])}return Reflect.apply(u,l,d)}}),e.off=new Proxy(e.off,{apply:(u,l,d)=>{let[,p]=d,f=s.get(p);if(f){s.delete(p);let m=d.slice();return m[1]=f,Reflect.apply(u,l,m)}return Reflect.apply(u,l,d)}}),e.on("end",()=>{try{let u=Buffer.concat(i).toString("utf-8");if(u){let d=Buffer.byteLength(u,"utf-8")>a?`${Buffer.from(u).subarray(0,a-3).toString("utf-8")}...`:u;t.setSDKProcessingMetadata({normalizedRequest:{data:d}})}}catch(u){Z&&b.error(n,"Error building captured request body",u)}})}catch(u){Z&&b.error(n,"Error patching request to capture body",u)}}function Hi(e,t){if(!e)return t;let r=fi(e),n=fi(t);if(!n)return e;let o={},i={};for(let[u,l]of Object.entries(n))u.startsWith(Er)?o[u]=l:i[u]=l;let s=Object.keys(o).length>0,a={};if(r)for(let[u,l]of Object.entries(r))s&&u.startsWith(Er)||(a[u]=l);Object.assign(a,o);for(let[u,l]of Object.entries(i))a[u]||(a[u]=l);return au(a)}var Vn="@sentry/instrumentation-http";function ay(e,t){let r=jP(e),n=t?.statusCode,o=ji(n);ke({category:"http",data:{status_code:n,...r},type:"http",level:o},{event:"response",request:e,response:t})}function uy(e,t){let r=tp(e),{tracePropagationTargets:n,propagateTraceparent:o}=Y()?.getOptions()||{},i=Oi(r,n,t)?Ir({propagateTraceparent:o}):void 0;if(!i)return;let{"sentry-trace":s,baggage:a,traceparent:u}=i;if(!e.getHeader("sentry-trace")){if(s)try{e.setHeader("sentry-trace",s),Z&&b.log(Vn,"Added sentry-trace header to outgoing request")}catch(d){Z&&b.error(Vn,"Failed to add sentry-trace header to outgoing request:",tt(d)?d.message:"Unknown error")}if(u&&!e.getHeader("traceparent"))try{e.setHeader("traceparent",u),Z&&b.log(Vn,"Added traceparent header to outgoing request")}catch(d){Z&&b.error(Vn,"Failed to add traceparent header to outgoing request:",tt(d)?d.message:"Unknown error")}if(a){let d=e.getHeader("baggage"),p=Hi(d,a);if(p)try{e.setHeader("baggage",p),Z&&b.log(Vn,"Added baggage header to outgoing request")}catch(f){Z&&b.error(Vn,"Failed to add baggage header to outgoing request:",tt(f)?f.message:"Unknown error")}}}}function jP(e){try{let t=e.getHeader("host")||e.host,r=new URL(e.path,`${e.protocol}//${t}`),n=Pi(r.toString()),o={url:Di(n),"http.method":e.method||"GET"};return n.search&&(o["http.query"]=n.search),n.hash&&(o["http.fragment"]=n.hash),o}catch{return{}}}function ly(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function tp(e){let t=e.getHeader("host")||e.host,r=e.protocol,n=e.path;return`${r}//${t}${n}`}var rp="Http",cy=new WeakSet,qP=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??"medium",ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,tracePropagation:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},r=new Ne(100),n=new WeakMap;return{name:rp,setupOnce(){let o=(u=>{$P(u.server,t)}),i=(u=>{zP(u.request,t,r,n)}),s=(u=>{let l=u;dy(l.request,l.response,t,n)}),a=(u=>{dy(u.request,void 0,t,n)});Iu("http.server.request.start",o),Iu("http.client.request.created",i),Iu("http.client.response.finish",s),Iu("http.client.request.error",a)}}}),py=qP;function $P(e,{ignoreRequestBody:t,maxRequestBodySize:r}){let n=e.emit;if(cy.has(n))return;let o=new Proxy(n,{apply(i,s,a){if(a[0]!=="request"||!ee().getClient())return i.apply(s,a);Z&&b.log(rp,"Handling incoming request");let l=ne().clone(),d=a[1],p=zd(d),f=d.ip||d.socket?.remoteAddress,m=d.url||"/";r!=="none"&&!t?.(m,d)&&sy(d,l,r,rp),l.setSDKProcessingMetadata({normalizedRequest:p,ipAddress:f});let h=(d.method||"GET").toUpperCase(),y=$d(m),S=`${h} ${y}`;return l.setTransactionName(S),Pn(l,()=>{let D=p.headers?.["sentry-trace"],w=p.headers?.baggage;return Si({sentryTrace:Array.isArray(D)?D[0]:D,baggage:Array.isArray(w)?w[0]:w},()=>(ee().getPropagationContext().propagationSpanId=it(),i.apply(s,a)))})}});cy.add(o),e.emit=o}function zP(e,t,r,n){let o=fy(e,t);n.set(e,o),!o&&t.tracePropagation&&uy(e,r)}function dy(e,t,r,n){!r.breadcrumbs||(n.get(e)??fy(e,r))||ay(e,t)}function fy(e,t){if(ee().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:r}=t;if(!r)return!1;let n=tp(e);return r(n,ly(e))}import{subscribe as gy}from"node:diagnostics_channel";var np="sentry-trace",Ru="baggage",WP="traceparent";function my(e,t){let r=Pu(e.origin,e.path),{tracePropagationTargets:n,propagateTraceparent:o}=Y()?.getOptions()||{},i=Oi(r,n,t)?Ir({propagateTraceparent:o}):void 0;if(!i)return;let{"sentry-trace":s,baggage:a,traceparent:u}=i,l=Array.isArray(e.headers)?e.headers:HP(e.headers);if(op(l,np),op(l,Ru),o&&op(l,WP),!(ip(l,np)!==-1)){s&&l.push(np,s),u&&ip(l,"traceparent")===-1&&l.push("traceparent",u);let p=ip(l,Ru);if(a&&p===-1)l.push(Ru,a);else if(a){let f=l[p+1],m=Hi(f,a);m&&(l[p+1]=m)}}Array.isArray(e.headers)||(e.headers=VP(l))}function HP(e){let t=e.split(`\r
`),r=[];for(let n of t)try{let o=n.indexOf(":");if(o===-1)continue;let i=n.slice(0,o).trim(),s=n.slice(o+1).trim();i&&r.push(i,s)}catch{b.warn(`Failed to convert string request header to array header: ${n}`)}return r}function VP(e){let t=[];for(let r=0;r<e.length;r+=2){let n=e[r],o=e[r+1];!n||o==null||t.push(`${n}: ${o}`)}return t.length?t.join(`\r
`).concat(`\r
`):""}function op(e,t){let r=-1;for(let n=0;n<e.length;n+=2){if(e[n]!==t)continue;if(r===-1){r=n;continue}let o=e[r+1];if(t===Ru&&o){let i=Hi(e[n+1],o);i&&(e[r+1]=i)}e.splice(n,2),n-=2}}function ip(e,t){return e.findIndex((r,n)=>n%2===0&&r===t)}function hy(e,t){let r=GP(e),n=t.statusCode,o=ji(n);ke({category:"http",data:{status_code:n,...r},type:"http",level:o},{event:"response",request:e,response:t})}function GP(e){try{let t=Pu(e.origin,e.path),r=Pi(t),n={url:Di(r),"http.method":e.method||"GET"};return r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash),n}catch{return{}}}function Pu(e,t="/"){try{return new URL(t,e).toString()}catch{let r=`${e}`;return r.endsWith("/")&&t.startsWith("/")?`${r}${t.slice(1)}`:!r.endsWith("/")&&!t.startsWith("/")?`${r}/${t}`:`${r}${t}`}}var KP="NodeFetch",JP=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,tracePropagation:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},r=new Ne(100),n=new WeakMap;return{name:KP,setupOnce(){let o=(s=>{YP(s.request,t,r,n)}),i=(s=>{let a=s;ZP(a.request,a.response,t,n)});gy("undici:request:create",o),gy("undici:request:headers",i)}}}),by=JP;function YP(e,t,r,n){let o=XP(e,t);n.set(e,o),!o&&t.tracePropagation&&my(e,r)}function ZP(e,t,r,n){!r.breadcrumbs||n.get(e)||hy(e,t)}function XP(e,t){if(ee().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:r}=t;if(!r)return!1;let n=Pu(e.origin,e.path);return r(n)}function yy(){return[Hn(),Mi(),Fi(),Bi(),Yb(),Li(),py(),by(),Wb(),Hb(),Rb(),Ub(),Eb(),xb(),Vb(),zb()]}function sp(e={}){return QP(e,yy)}function QP(e={},t){let r=e2(e,t);r.debug===!0&&(Z?b.enable():pe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),iy(),ee().update(r.initialScope),r.spotlight&&!r.integrations.some(({name:i})=>i===Xd)&&r.integrations.push(Kb({sidecarUrl:typeof r.spotlight=="string"?r.spotlight:void 0})),Ni(r,"node-light",["node-core"]);let o=new xu(r);return ee().setClient(o),o.init(),b.log(`SDK initialized from ${Tu()?"CommonJS":"ESM"} (light mode)`),o.startClientReportTracking(),n2(),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function e2(e,t){let r=t2(e.release),n=oy(e.spotlight),o=r2(e.tracesSampleRate),i={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??ny,stackParser:Xc(e.stackParser||ey),release:r,tracesSampleRate:o,spotlight:n,debug:Zt(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,a=e.defaultIntegrations??t(i),u=Fd({defaultIntegrations:a,integrations:s});return i.traceLifecycle==="stream"&&!u.some(l=>l.name==="SpanStreaming")&&u.push(Ui()),{...i,integrations:u}}function t2(e){if(e!==void 0)return e;let t=Qb();if(t!==void 0)return t}function r2(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let r=parseFloat(t);return isFinite(r)?r:void 0}function n2(){if(Zt(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,r=hi(e,t);ee().setPropagationContext(r)}}var R2=new Set(["about:blank"]);function _y(e){if(R2.has(e))return!0;let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}var P2=["chrome","iab","cdp"];function wy(e){return P2.some(t=>t===e)}var Vi="browser/config.toml",xy="full_cdp_access_enabled",Sy="browser_use_developer_mode_full_cdp";var vy="BROWSER_USE_AVAILABLE_BACKENDS",Ey="BROWSER_USE_CODEX_APP_BUILD_FLAVOR",Cy="BROWSER_USE_DISABLE_AMBIENT_NETWORK",Ty="BROWSER_USE_DISABLE_BROWSER_CAPABILITIES",ky="BROWSER_USE_DISABLE_TAB_CAPABILITIES",Ay="BROWSER_USE_SECURITY_MODE";var Gi=class{constructor(t){this.transport=t;this.transport.setMessageCallback(r=>{this.handleIncomingMessage(r)}),this.transport.addCloseListener?.(r=>{this.rejectPendingRequests(r?.message??"transport closed before response")})}transport;nextId=1;pendingRequests=new Map;requestHandlers=new Map;eventHandlers=new Map;registerRequestHandlerObject(t){[...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(Object.getPrototypeOf(t))].filter(n=>n!=="constructor"&&typeof t[n]=="function").forEach(n=>{let o=t[n];o&&this.registerRequestHandler(n,o.bind(t))})}registerRequestHandler(t,r){this.requestHandlers.set(t,r)}addEventListener(t,r){let n=t.toString(),o=this.eventHandlers.get(n)??[];o.push(r),this.eventHandlers.set(n,o)}removeEventListener(t,r){let n=t.toString(),o=this.eventHandlers.get(n)??[];this.eventHandlers.set(n,o.filter(i=>i!==r))}sendNotification(t,r){this.transport.sendMessage({jsonrpc:"2.0",method:t,params:r})}sendRequest(t,r){let n=this.nextId++;return new Promise((o,i)=>{this.pendingRequests.set(n,{resolve:o,reject:i});try{this.transport.sendMessage({jsonrpc:"2.0",method:t.toString(),params:r,id:n})}catch(s){this.pendingRequests.delete(n),i(s)}})}async handleIncomingMessage(t){if("method"in t)return this.handleIncomingRequest(t);if(t.id===void 0)return;let r=this.pendingRequests.get(t.id);if(r){if(this.pendingRequests.delete(t.id),"error"in t){r.reject(t.error?.message||"Something went wrong");return}r.resolve(t.result)}}rejectPendingRequests(t){for(let r of this.pendingRequests.values())r.reject(t);this.pendingRequests.clear()}async handleIncomingRequest(t){if(t.id===void 0){(this.eventHandlers.get(t.method??"")??[]).forEach(o=>o(t.params));return}let r=this.requestHandlers.get(t.method??"");if(!r){this.transport.sendMessage({jsonrpc:"2.0",id:t.id,error:{code:-1,message:`No handler registered for method: ${t.method}`}});return}try{let n=await r(t.params);this.transport.sendMessage({jsonrpc:"2.0",id:t.id,result:n})}catch(n){this.transport.sendMessage({jsonrpc:"2.0",id:t.id,error:{code:1,message:n instanceof Error?n.message:String(n)}})}}};function Du(e,t){return new Error(`${e} does not support command "${t.type}".`)}var Iy=e=>e==="win32"?"\\\\.\\pipe\\codex-browser-use":"/tmp/codex-browser-use";var D2="https://chatgpt.com/backend-api",N2="agent";var Nu="codex_browser_use";function J(e){return`Browser Use rejected this action due to browser security policy. Reason: ${e} The agent must not attempt to achieve the same outcome via workaround, indirect execution, raw CDP or browser commands, alternate browser surfaces, or policy circumvention. Proceed only with a materially safer alternative that does not require this blocked browser action; if none exists, stop and request user input.`}function Py(e){return O2(e,N2)}function O2(e,t){if(!Ry(e))return!1;let r=e.feature_status;return Ry(r)?r[t]===!0:!1}function Dy(e,{conversationId:t,turnId:r,urlRequestSource:n=Nu}={}){let o;try{o=new URL(e)}catch{throw new Error("Browser Use cannot visit the requested page because the URL is invalid. Use a complete http:// or https:// URL.")}if(o.protocol!=="http:"&&o.protocol!=="https:")return null;let i=o.hostname.trim().toLowerCase();if(i.length===0)throw new Error("Browser Use cannot visit the requested page because the URL does not include a website host.");return B2(i)?null:{cacheKey:i.startsWith("www.")?i.slice(4):i,displayUrl:F2(o),endpoint:M2(o,{conversationId:t,turnId:r,urlRequestSource:n})}}function M2(e,{conversationId:t,turnId:r,urlRequestSource:n}){let o=new URL(e.origin);o.pathname=e.pathname,o.search=e.search;let i=new URL(`${D2}/aura/site_status`);return i.searchParams.set("site_url",o.toString()),i.searchParams.set("url_request_source",n),t!=null&&i.searchParams.set("conversation_id",t),r!=null&&i.searchParams.set("turn_id",r),i.toString()}function F2(e){let t=new URL(e.origin);t.pathname=e.pathname;let r=t.toString();return t.pathname==="/"?r.slice(0,-1):r}function B2(e){return e==="localhost"||e.endsWith(".localhost")||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function Ry(e){return typeof e=="object"&&e!=null}var Ny="codex-agent-overlay-root";function Fy(){let e=Ou(vy);return e==null?null:jy(e).filter(wy)}function By(e){return{browser:My(e?.browser??[],Oy("browser")),tab:My(e?.tab??[],Oy("tab"))}}function Ly(){return ap(Ay)}function Uy(e){return Ou(e)==="1"}function Oy(e){let t=Ou(e==="browser"?Ty:ky);return new Set(jy(t))}function Ou(e){let t=globalThis.nodeRepl?.env[e];return typeof t=="string"?t:void 0}function ap(e){let t=Ou(e)?.trim();return t||void 0}function My(e,t){return t.size===0?e:e.filter(r=>!t.has(r.id))}function jy(e){return(e??"").split(",").map(t=>t.trim()).filter(Boolean)}function Mu(){return Uy(Cy)}var Gn=globalThis.nodeRepl?.fetch?globalThis.nodeRepl.fetch:fetch;function Kn(){return"production"}var qy=!1,$y=()=>{qy||(sp({dsn:"https://[email protected]/4511236780326912",sendDefaultPii:!1,environment:Kn(),transport:e=>Yt(e,t=>{let r={body:t.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:e.keepAlive};return Gn(e.url,r).then(n=>({statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}))})}),qy=!0)},zy=(e,t)=>{Ci({email:e.email,id:e.id}),Ei("backend",t)};var Dw=Mh(Rw(),1);var pt="1.0.0";import{platform as cM}from"os";var dM="client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR",pM=Kn(),yf=new Dw.StatsigClient(dM,{appVersion:pt},{environment:{tier:pM},networkConfig:{api:"https://ab.chatgpt.com/v1",sdkExceptionUrl:"https://ab.chatgpt.com/v1/sdk_exception",networkOverrideFunc:Gn},loggingEnabled:"always"}),Pw=!1,Nw=async()=>{if(!Pw)try{await yf.initializeAsync(),Pw=!0}catch(e){console.warn(e),ue(e)}},vl=(...e)=>yf.logEvent(...e),Ow=(e,t)=>{yf.updateUserSync({userID:e.id,email:e.email,appVersion:pt,custom:{backend:t,platform:cM()}})};var _f=null,Mw=async()=>{if(_f)return _f;let t=await(await Gn("https://chatgpt.com/backend-api/me")).json();if(!("object"in t)||t.object!=="user")throw new Error("User unavailable");return _f=t,t};var fM="codex_",Fw=()=>{Mu()||($y(),Nw(),wf())},wf=async e=>{if(!Mu())try{let t=await Mw();zy(t,e),Ow(t,e)}catch(t){ue(t)}};function mM(e){return`${fM}${e}`}var Pt=(e,t,r)=>{if(!Mu())return vl(mM(e),t,r)};var oe={};T(oe,{AtlasCommand:()=>g,BrowserUserClaimTab:()=>ws,BrowserUserHistory:()=>Ss,BrowserUserOpenTabs:()=>xs,CloseTab:()=>ds,CreateTab:()=>cs,CuaClick:()=>Ps,CuaDoubleClick:()=>Ns,CuaDownloadMedia:()=>Ds,CuaDrag:()=>Ms,CuaKeypress:()=>Os,CuaMove:()=>Fs,CuaScroll:()=>Bs,CuaType:()=>Ls,DomCuaClick:()=>Us,DomCuaDoubleClick:()=>qs,DomCuaDownloadMedia:()=>js,DomCuaGetVisibleDom:()=>$s,DomCuaKeypress:()=>zs,DomCuaScroll:()=>Ws,DomCuaType:()=>Hs,FinalizeTabs:()=>ps,ListTabs:()=>Qr,NameSession:()=>fs,NavigateTab:()=>ys,NavigateTabBack:()=>en,NavigateTabForward:()=>tn,NavigateTabReload:()=>_s,PlaywrightDomSnapshot:()=>ca,PlaywrightDownloadPath:()=>ma,PlaywrightElementInfo:()=>da,PlaywrightElementScreenshot:()=>pa,PlaywrightEvaluate:()=>Rs,PlaywrightFileChooserSetFiles:()=>ga,PlaywrightLocatorAllTextContents:()=>ra,PlaywrightLocatorClick:()=>Vs,PlaywrightLocatorCount:()=>Zs,PlaywrightLocatorDblclick:()=>Gs,PlaywrightLocatorDownloadMedia:()=>Ks,PlaywrightLocatorFill:()=>Io,PlaywrightLocatorGetAttribute:()=>ia,PlaywrightLocatorInnerText:()=>oa,PlaywrightLocatorIsEnabled:()=>ta,PlaywrightLocatorIsVisible:()=>ea,PlaywrightLocatorPress:()=>Js,PlaywrightLocatorReadAll:()=>sa,PlaywrightLocatorSelectOption:()=>Xs,PlaywrightLocatorSetChecked:()=>Qs,PlaywrightLocatorTextContent:()=>na,PlaywrightLocatorWaitFor:()=>Ys,PlaywrightWaitForDownload:()=>fa,PlaywrightWaitForFileChooser:()=>ha,PlaywrightWaitForLoadState:()=>ua,PlaywrightWaitForTimeout:()=>la,PlaywrightWaitForURL:()=>aa,RuntimeConfig:()=>Ef,SelectedTab:()=>ms,TabClipboardRead:()=>ks,TabClipboardReadText:()=>Cs,TabClipboardWrite:()=>As,TabClipboardWriteText:()=>Ts,TabContentExport:()=>vs,TabContentExportGSuite:()=>Es,TabDevLogs:()=>Ao,TabScreenshot:()=>Is,TabsContent:()=>hs,WebMcpInvokeTool:()=>bs,WebMcpListTools:()=>gs});var g=class{constructor(t,r,n){this.type=t,this.schema=r,this.payload=n}parse(){return this.schema.parse(this.payload)}toJSON(){return{type:this.type,...this.payload}}};var cs={};T(cs,{PayloadSchema:()=>Kw,ResultSchema:()=>CF,commandType:()=>Jw,create:()=>TF});var c={};T(c,{BRAND:()=>jM,DIRTY:()=>Br,EMPTY_PATH:()=>yM,INVALID:()=>B,NEVER:()=>EF,OK:()=>be,ParseStatus:()=>fe,Schema:()=>V,ZodAny:()=>ur,ZodArray:()=>Mt,ZodBigInt:()=>Ur,ZodBoolean:()=>jr,ZodBranded:()=>us,ZodCatch:()=>Zr,ZodDate:()=>qr,ZodDefault:()=>Yr,ZodDiscriminatedUnion:()=>Tl,ZodEffects:()=>Be,ZodEnum:()=>Kr,ZodError:()=>Ce,ZodFirstPartyTypeKind:()=>U,ZodFunction:()=>Al,ZodIntersection:()=>Hr,ZodIssueCode:()=>v,ZodLazy:()=>Vr,ZodLiteral:()=>Gr,ZodMap:()=>Co,ZodNaN:()=>ko,ZodNativeEnum:()=>Jr,ZodNever:()=>Xe,ZodNull:()=>zr,ZodNullable:()=>ht,ZodNumber:()=>Lr,ZodObject:()=>Te,ZodOptional:()=>Me,ZodParsedType:()=>P,ZodPipeline:()=>ls,ZodPromise:()=>lr,ZodReadonly:()=>Xr,ZodRecord:()=>kl,ZodSchema:()=>V,ZodSet:()=>To,ZodString:()=>ar,ZodSymbol:()=>vo,ZodTransformer:()=>Be,ZodTuple:()=>mt,ZodType:()=>V,ZodUndefined:()=>$r,ZodUnion:()=>Wr,ZodUnknown:()=>Ot,ZodVoid:()=>Eo,addIssueToContext:()=>A,any:()=>JM,array:()=>QM,bigint:()=>WM,boolean:()=>Gw,coerce:()=>vF,custom:()=>Ww,date:()=>HM,datetimeRegex:()=>$w,defaultErrorMap:()=>Dt,discriminatedUnion:()=>nF,effect:()=>hF,enum:()=>pF,function:()=>lF,getErrorMap:()=>wo,getParsedType:()=>ft,instanceof:()=>$M,intersection:()=>oF,isAborted:()=>El,isAsync:()=>xo,isDirty:()=>Cl,isValid:()=>sr,late:()=>qM,lazy:()=>cF,literal:()=>dF,makeIssue:()=>as,map:()=>aF,nan:()=>zM,nativeEnum:()=>fF,never:()=>ZM,null:()=>KM,nullable:()=>bF,number:()=>Vw,object:()=>eF,objectUtil:()=>xf,oboolean:()=>SF,onumber:()=>xF,optional:()=>gF,ostring:()=>wF,pipeline:()=>_F,preprocess:()=>yF,promise:()=>mF,quotelessJson:()=>hM,record:()=>sF,set:()=>uF,setErrorMap:()=>bM,strictObject:()=>tF,string:()=>Hw,symbol:()=>VM,transformer:()=>hF,tuple:()=>iF,undefined:()=>GM,union:()=>rF,unknown:()=>YM,util:()=>G,void:()=>XM});var G;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(G||(G={}));var xf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(xf||(xf={}));var P=G.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ft=e=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?P.promise:typeof Map<"u"&&e instanceof Map?P.map:typeof Set<"u"&&e instanceof Set?P.set:typeof Date<"u"&&e instanceof Date?P.date:P.object;default:return P.unknown}};var v=G.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),hM=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Ce=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,u=0;for(;u<s.path.length;){let l=s.path[u];u===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ce.create=e=>new Ce(e);var gM=(e,t)=>{let r;switch(e.code){case v.invalid_type:e.received===P.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,G.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${G.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${G.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${G.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:G.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case v.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case v.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,G.assertNever(e)}return{message:r}},Dt=gM;var Bw=Dt;function bM(e){Bw=e}function wo(){return Bw}var as=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)a=l(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},yM=[];function A(e,t){let r=wo(),n=as({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Dt?void 0:Dt].filter(o=>!!o)});e.common.issues.push(n)}var fe=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return B;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return B;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},B=Object.freeze({status:"aborted"}),Br=e=>({status:"dirty",value:e}),be=e=>({status:"valid",value:e}),El=e=>e.status==="aborted",Cl=e=>e.status==="dirty",sr=e=>e.status==="valid",xo=e=>typeof Promise<"u"&&e instanceof Promise;var O;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}));var Fe=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Lw=(e,t)=>{if(sr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ce(e.common.issues);return this._error=r,this._error}}};function W(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:o}}var V=class{get description(){return this._def.description}_getType(t){return ft(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ft(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new fe,ctx:{common:t.parent.common,data:t.data,parsedType:ft(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(xo(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ft(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Lw(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ft(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return sr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>sr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ft(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(xo(o)?o:Promise.resolve(o));return Lw(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:v.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Be({schema:this,typeName:U.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Me.create(this,this._def)}nullable(){return ht.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mt.create(this)}promise(){return lr.create(this,this._def)}or(t){return Wr.create([this,t],this._def)}and(t){return Hr.create(this,t,this._def)}transform(t){return new Be({...W(this._def),schema:this,typeName:U.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Yr({...W(this._def),innerType:this,defaultValue:r,typeName:U.ZodDefault})}brand(){return new us({typeName:U.ZodBranded,type:this,...W(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Zr({...W(this._def),innerType:this,catchValue:r,typeName:U.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ls.create(this,t)}readonly(){return Xr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_M=/^c[^\s-]{8,}$/i,wM=/^[0-9a-z]+$/,xM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SM=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,vM=/^[a-z0-9_-]{21}$/i,EM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,CM=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,TM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Sf,AM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,IM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,RM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,PM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,DM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,NM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jw="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",OM=new RegExp(`^${jw}$`);function qw(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function MM(e){return new RegExp(`^${qw(e)}$`)}function $w(e){let t=`${jw}T${qw(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function FM(e,t){return!!((t==="v4"||!t)&&AM.test(e)||(t==="v6"||!t)&&RM.test(e))}function BM(e,t){if(!EM.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function LM(e,t){return!!((t==="v4"||!t)&&IM.test(e)||(t==="v6"||!t)&&PM.test(e))}var ar=class e extends V{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==P.string){let i=this._getOrReturnCtx(t);return A(i,{code:v.invalid_type,expected:P.string,received:i.parsedType}),B}let n=new fe,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?A(o,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&A(o,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")TM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"email",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Sf||(Sf=new RegExp(kM,"u")),Sf.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"emoji",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")SM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"uuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")vM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"nanoid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")_M.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")wM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cuid2",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")xM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"ulid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),A(o,{validation:"url",code:v.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"regex",code:v.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),A(o,{code:v.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),A(o,{code:v.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),A(o,{code:v.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?$w(i).test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:v.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?OM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:v.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?MM(i).test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{code:v.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?CM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"duration",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?FM(t.data,i.version)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"ip",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?BM(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"jwt",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?LM(t.data,i.version)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"cidr",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?DM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"base64",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?NM.test(t.data)||(o=this._getOrReturnCtx(t,o),A(o,{validation:"base64url",code:v.invalid_string,message:i.message}),n.dirty()):G.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:v.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};ar.create=e=>new ar({checks:[],typeName:U.ZodString,coerce:e?.coerce??!1,...W(e)});function UM(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var Lr=class e extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==P.number){let i=this._getOrReturnCtx(t);return A(i,{code:v.invalid_type,expected:P.number,received:i.parsedType}),B}let n,o=new fe;for(let i of this._def.checks)i.kind==="int"?G.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),A(n,{code:v.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:v.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:v.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?UM(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),A(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),A(n,{code:v.not_finite,message:i.message}),o.dirty()):G.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&G.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Lr.create=e=>new Lr({checks:[],typeName:U.ZodNumber,coerce:e?.coerce||!1,...W(e)});var Ur=class e extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==P.bigint)return this._getInvalidInput(t);let n,o=new fe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:v.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),A(n,{code:v.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),A(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):G.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return A(r,{code:v.invalid_type,expected:P.bigint,received:r.parsedType}),B}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ur.create=e=>new Ur({checks:[],typeName:U.ZodBigInt,coerce:e?.coerce??!1,...W(e)});var jr=class extends V{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==P.boolean){let n=this._getOrReturnCtx(t);return A(n,{code:v.invalid_type,expected:P.boolean,received:n.parsedType}),B}return be(t.data)}};jr.create=e=>new jr({typeName:U.ZodBoolean,coerce:e?.coerce||!1,...W(e)});var qr=class e extends V{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==P.date){let i=this._getOrReturnCtx(t);return A(i,{code:v.invalid_type,expected:P.date,received:i.parsedType}),B}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return A(i,{code:v.invalid_date}),B}let n=new fe,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:v.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),A(o,{code:v.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):G.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:O.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:O.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};qr.create=e=>new qr({checks:[],coerce:e?.coerce||!1,typeName:U.ZodDate,...W(e)});var vo=class extends V{_parse(t){if(this._getType(t)!==P.symbol){let n=this._getOrReturnCtx(t);return A(n,{code:v.invalid_type,expected:P.symbol,received:n.parsedType}),B}return be(t.data)}};vo.create=e=>new vo({typeName:U.ZodSymbol,...W(e)});var $r=class extends V{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return A(n,{code:v.invalid_type,expected:P.undefined,received:n.parsedType}),B}return be(t.data)}};$r.create=e=>new $r({typeName:U.ZodUndefined,...W(e)});var zr=class extends V{_parse(t){if(this._getType(t)!==P.null){let n=this._getOrReturnCtx(t);return A(n,{code:v.invalid_type,expected:P.null,received:n.parsedType}),B}return be(t.data)}};zr.create=e=>new zr({typeName:U.ZodNull,...W(e)});var ur=class extends V{constructor(){super(...arguments),this._any=!0}_parse(t){return be(t.data)}};ur.create=e=>new ur({typeName:U.ZodAny,...W(e)});var Ot=class extends V{constructor(){super(...arguments),this._unknown=!0}_parse(t){return be(t.data)}};Ot.create=e=>new Ot({typeName:U.ZodUnknown,...W(e)});var Xe=class extends V{_parse(t){let r=this._getOrReturnCtx(t);return A(r,{code:v.invalid_type,expected:P.never,received:r.parsedType}),B}};Xe.create=e=>new Xe({typeName:U.ZodNever,...W(e)});var Eo=class extends V{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return A(n,{code:v.invalid_type,expected:P.void,received:n.parsedType}),B}return be(t.data)}};Eo.create=e=>new Eo({typeName:U.ZodVoid,...W(e)});var Mt=class e extends V{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==P.array)return A(r,{code:v.invalid_type,expected:P.array,received:r.parsedType}),B;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(A(r,{code:s?v.too_big:v.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(A(r,{code:v.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(A(r,{code:v.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Fe(r,s,r.path,a)))).then(s=>fe.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Fe(r,s,r.path,a)));return fe.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};Mt.create=(e,t)=>new Mt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:U.ZodArray,...W(t)});function So(e){if(e instanceof Te){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Me.create(So(n))}return new Te({...e._def,shape:()=>t})}else return e instanceof Mt?new Mt({...e._def,type:So(e.element)}):e instanceof Me?Me.create(So(e.unwrap())):e instanceof ht?ht.create(So(e.unwrap())):e instanceof mt?mt.create(e.items.map(t=>So(t))):e}var Te=class e extends V{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=G.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==P.object){let l=this._getOrReturnCtx(t);return A(l,{code:v.invalid_type,expected:P.object,received:l.parsedType}),B}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Xe&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let u=[];for(let l of s){let d=i[l],p=o.data[l];u.push({key:{status:"valid",value:l},value:d._parse(new Fe(o,p,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Xe){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of a)u.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")a.length>0&&(A(o,{code:v.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of a){let p=o.data[d];u.push({key:{status:"valid",value:d},value:l._parse(new Fe(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of u){let p=await d.key,f=await d.value;l.push({key:p,value:f,alwaysSet:d.alwaysSet})}return l}).then(l=>fe.mergeObjectSync(n,l)):fe.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:U.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of G.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of G.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return So(this)}partial(t){let r={};for(let n of G.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of G.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Me;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return zw(G.objectKeys(this.shape))}};Te.create=(e,t)=>new Te({shape:()=>e,unknownKeys:"strip",catchall:Xe.create(),typeName:U.ZodObject,...W(t)});Te.strictCreate=(e,t)=>new Te({shape:()=>e,unknownKeys:"strict",catchall:Xe.create(),typeName:U.ZodObject,...W(t)});Te.lazycreate=(e,t)=>new Te({shape:e,unknownKeys:"strip",catchall:Xe.create(),typeName:U.ZodObject,...W(t)});var Wr=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Ce(a.ctx.common.issues));return A(r,{code:v.invalid_union,unionErrors:s}),B}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},d=u._parseSync({data:r.data,path:r.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(u=>new Ce(u));return A(r,{code:v.invalid_union,unionErrors:a}),B}}get options(){return this._def.options}};Wr.create=(e,t)=>new Wr({options:e,typeName:U.ZodUnion,...W(t)});var Nt=e=>e instanceof Vr?Nt(e.schema):e instanceof Be?Nt(e.innerType()):e instanceof Gr?[e.value]:e instanceof Kr?e.options:e instanceof Jr?G.objectValues(e.enum):e instanceof Yr?Nt(e._def.innerType):e instanceof $r?[void 0]:e instanceof zr?[null]:e instanceof Me?[void 0,...Nt(e.unwrap())]:e instanceof ht?[null,...Nt(e.unwrap())]:e instanceof us||e instanceof Xr?Nt(e.unwrap()):e instanceof Zr?Nt(e._def.innerType):[],Tl=class e extends V{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.object)return A(r,{code:v.invalid_type,expected:P.object,received:r.parsedType}),B;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(A(r,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=Nt(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:U.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...W(n)})}};function vf(e,t){let r=ft(e),n=ft(t);if(e===t)return{valid:!0,data:e};if(r===P.object&&n===P.object){let o=G.objectKeys(t),i=G.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let u=vf(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===P.array&&n===P.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],u=vf(s,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===P.date&&n===P.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Hr=class extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(El(i)||El(s))return B;let a=vf(i.value,s.value);return a.valid?((Cl(i)||Cl(s))&&r.dirty(),{status:r.value,value:a.data}):(A(n,{code:v.invalid_intersection_types}),B)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Hr.create=(e,t,r)=>new Hr({left:e,right:t,typeName:U.ZodIntersection,...W(r)});var mt=class e extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.array)return A(n,{code:v.invalid_type,expected:P.array,received:n.parsedType}),B;if(n.data.length<this._def.items.length)return A(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&n.data.length>this._def.items.length&&(A(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Fe(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>fe.mergeArray(r,s)):fe.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};mt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new mt({items:e,typeName:U.ZodTuple,rest:null,...W(t)})};var kl=class e extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.object)return A(n,{code:v.invalid_type,expected:P.object,received:n.parsedType}),B;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Fe(n,a,n.path,a)),value:s._parse(new Fe(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?fe.mergeObjectAsync(r,o):fe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof V?new e({keyType:t,valueType:r,typeName:U.ZodRecord,...W(n)}):new e({keyType:ar.create(),valueType:t,typeName:U.ZodRecord,...W(r)})}},Co=class extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.map)return A(n,{code:v.invalid_type,expected:P.map,received:n.parsedType}),B;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,u],l)=>({key:o._parse(new Fe(n,a,n.path,[l,"key"])),value:i._parse(new Fe(n,u,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of s){let l=await u.key,d=await u.value;if(l.status==="aborted"||d.status==="aborted")return B;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(l.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of s){let l=u.key,d=u.value;if(l.status==="aborted"||d.status==="aborted")return B;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(l.value,d.value)}return{status:r.value,value:a}}}};Co.create=(e,t,r)=>new Co({valueType:t,keyType:e,typeName:U.ZodMap,...W(r)});var To=class e extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.set)return A(n,{code:v.invalid_type,expected:P.set,received:n.parsedType}),B;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(A(n,{code:v.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(A(n,{code:v.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(u){let l=new Set;for(let d of u){if(d.status==="aborted")return B;d.status==="dirty"&&r.dirty(),l.add(d.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((u,l)=>i._parse(new Fe(n,u,n.path,l)));return n.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:O.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};To.create=(e,t)=>new To({valueType:e,minSize:null,maxSize:null,typeName:U.ZodSet,...W(t)});var Al=class e extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.function)return A(r,{code:v.invalid_type,expected:P.function,received:r.parsedType}),B;function n(a,u){return as({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,wo(),Dt].filter(l=>!!l),issueData:{code:v.invalid_arguments,argumentsError:u}})}function o(a,u){return as({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,wo(),Dt].filter(l=>!!l),issueData:{code:v.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof lr){let a=this;return be(async function(...u){let l=new Ce([]),d=await a._def.args.parseAsync(u,i).catch(m=>{throw l.addIssue(n(u,m)),l}),p=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(p,i).catch(m=>{throw l.addIssue(o(p,m)),l})})}else{let a=this;return be(function(...u){let l=a._def.args.safeParse(u,i);if(!l.success)throw new Ce([n(u,l.error)]);let d=Reflect.apply(s,this,l.data),p=a._def.returns.safeParse(d,i);if(!p.success)throw new Ce([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:mt.create(t).rest(Ot.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||mt.create([]).rest(Ot.create()),returns:r||Ot.create(),typeName:U.ZodFunction,...W(n)})}},Vr=class extends V{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Vr.create=(e,t)=>new Vr({getter:e,typeName:U.ZodLazy,...W(t)});var Gr=class extends V{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return A(r,{received:r.data,code:v.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:t.data}}get value(){return this._def.value}};Gr.create=(e,t)=>new Gr({value:e,typeName:U.ZodLiteral,...W(t)});function zw(e,t){return new Kr({values:e,typeName:U.ZodEnum,...W(t)})}var Kr=class e extends V{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return A(r,{expected:G.joinValues(n),received:r.parsedType,code:v.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return A(r,{received:r.data,code:v.invalid_enum_value,options:n}),B}return be(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Kr.create=zw;var Jr=class extends V{_parse(t){let r=G.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==P.string&&n.parsedType!==P.number){let o=G.objectValues(r);return A(n,{expected:G.joinValues(o),received:n.parsedType,code:v.invalid_type}),B}if(this._cache||(this._cache=new Set(G.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=G.objectValues(r);return A(n,{received:n.data,code:v.invalid_enum_value,options:o}),B}return be(t.data)}get enum(){return this._def.values}};Jr.create=(e,t)=>new Jr({values:e,typeName:U.ZodNativeEnum,...W(t)});var lr=class extends V{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.promise&&r.common.async===!1)return A(r,{code:v.invalid_type,expected:P.promise,received:r.parsedType}),B;let n=r.parsedType===P.promise?r.data:Promise.resolve(r.data);return be(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};lr.create=(e,t)=>new lr({type:e,typeName:U.ZodPromise,...W(t)});var Be=class extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===U.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{A(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return B;let u=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return u.status==="aborted"?B:u.status==="dirty"?Br(u.value):r.value==="dirty"?Br(u.value):u});{if(r.value==="aborted")return B;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?B:a.status==="dirty"?Br(a.value):r.value==="dirty"?Br(a.value):a}}if(o.type==="refinement"){let s=a=>{let u=o.refinement(a,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?B:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?B:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!sr(s))return B;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>sr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):B);G.assertNever(o)}};Be.create=(e,t,r)=>new Be({schema:e,typeName:U.ZodEffects,effect:t,...W(r)});Be.createWithPreprocess=(e,t,r)=>new Be({schema:t,effect:{type:"preprocess",transform:e},typeName:U.ZodEffects,...W(r)});var Me=class extends V{_parse(t){return this._getType(t)===P.undefined?be(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Me.create=(e,t)=>new Me({innerType:e,typeName:U.ZodOptional,...W(t)});var ht=class extends V{_parse(t){return this._getType(t)===P.null?be(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ht.create=(e,t)=>new ht({innerType:e,typeName:U.ZodNullable,...W(t)});var Yr=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Yr.create=(e,t)=>new Yr({innerType:e,typeName:U.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...W(t)});var Zr=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xo(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Zr.create=(e,t)=>new Zr({innerType:e,typeName:U.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...W(t)});var ko=class extends V{_parse(t){if(this._getType(t)!==P.nan){let n=this._getOrReturnCtx(t);return A(n,{code:v.invalid_type,expected:P.nan,received:n.parsedType}),B}return{status:"valid",value:t.data}}};ko.create=e=>new ko({typeName:U.ZodNaN,...W(e)});var jM=Symbol("zod_brand"),us=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ls=class e extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?B:i.status==="dirty"?(r.dirty(),Br(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?B:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:U.ZodPipeline})}},Xr=class extends V{_parse(t){let r=this._def.innerType._parse(t),n=o=>(sr(o)&&(o.value=Object.freeze(o.value)),o);return xo(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Xr.create=(e,t)=>new Xr({innerType:e,typeName:U.ZodReadonly,...W(t)});function Uw(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Ww(e,t={},r){return e?ur.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=Uw(t,n),u=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!i){let s=Uw(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):ur.create()}var qM={object:Te.lazycreate},U;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(U||(U={}));var $M=(e,t={message:`Input not instance of ${e.name}`})=>Ww(r=>r instanceof e,t),Hw=ar.create,Vw=Lr.create,zM=ko.create,WM=Ur.create,Gw=jr.create,HM=qr.create,VM=vo.create,GM=$r.create,KM=zr.create,JM=ur.create,YM=Ot.create,ZM=Xe.create,XM=Eo.create,QM=Mt.create,eF=Te.create,tF=Te.strictCreate,rF=Wr.create,nF=Tl.create,oF=Hr.create,iF=mt.create,sF=kl.create,aF=Co.create,uF=To.create,lF=Al.create,cF=Vr.create,dF=Gr.create,pF=Kr.create,fF=Jr.create,mF=lr.create,hF=Be.create,gF=Me.create,bF=ht.create,yF=Be.createWithPreprocess,_F=ls.create,wF=()=>Hw().optional(),xF=()=>Vw().optional(),SF=()=>Gw().optional(),vF={string:(e=>ar.create({...e,coerce:!0})),number:(e=>Lr.create({...e,coerce:!0})),boolean:(e=>jr.create({...e,coerce:!0})),bigint:(e=>Ur.create({...e,coerce:!0})),date:(e=>qr.create({...e,coerce:!0}))};var EF=B;var Kw=c.object({browser_id:c.string()}),CF=c.object({id:c.string()}),Jw="create_tab";function TF(e){return new g(Jw,Kw,e)}var ds={};T(ds,{PayloadSchema:()=>Yw,ResultSchema:()=>kF,commandType:()=>Zw,create:()=>AF});var Yw=c.object({browser_id:c.string(),tab_id:c.string()}),kF=c.object({}),Zw="close_tab";function AF(e){return new g(Zw,Yw,e)}var ps={};T(ps,{FinalizeTabStatusSchema:()=>Xw,PayloadSchema:()=>Qw,ResultSchema:()=>IF,commandType:()=>ex,create:()=>RF});var Xw=c.enum(["handoff","deliverable"]),Qw=c.object({browser_id:c.string(),keep:c.array(c.object({tab_id:c.string(),status:Xw})).optional()}),IF=c.object({}),ex="finalize_tabs";function RF(e){return new g(ex,Qw,e)}var Ef={};T(Ef,{PayloadSchema:()=>tx,ResultSchema:()=>PF,commandType:()=>rx,create:()=>DF});var tx=c.object({browser_id:c.string()}),PF=c.object({display_truncate_max_chars:c.number().int().positive().optional()}),rx="runtime_config";function DF(e){return new g(rx,tx,e)}var fs={};T(fs,{PayloadSchema:()=>nx,ResultSchema:()=>NF,commandType:()=>ox,create:()=>OF});var nx=c.object({browser_id:c.string(),name:c.string()}),NF=c.object({}),ox="name_session";function OF(e){return new g(ox,nx,e)}var ms={};T(ms,{PayloadSchema:()=>ix,ResultSchema:()=>MF,commandType:()=>sx,create:()=>FF});var ix=c.object({browser_id:c.string()}),MF=c.object({id:c.string().optional()}),sx="selected_tab";function FF(e){return new g(sx,ix,e)}var Qr={};T(Qr,{PayloadSchema:()=>ax,ResultSchema:()=>BF,commandType:()=>ux,create:()=>LF});var ax=c.object({browser_id:c.string()}),BF=c.object({tabs:c.array(c.object({id:c.string(),url:c.string().optional(),title:c.string().optional()}))}),ux="list_tabs";function LF(e){return new g(ux,ax,e)}var hs={};T(hs,{ContentTypeSchema:()=>lx,PayloadSchema:()=>cx,ResultSchema:()=>UF,commandType:()=>dx,create:()=>jF});var lx=c.enum(["html","text","domSnapshot"]),cx=c.object({browser_id:c.string(),urls:c.array(c.string()),content_type:lx,timeout_ms:c.number().int().positive().optional()}),UF=c.object({results:c.array(c.object({url:c.string(),title:c.string().nullable(),content:c.string().nullable()}))}),dx="tabs_content";function jF(e){return new g(dx,cx,e)}var gs={};T(gs,{PayloadSchema:()=>px,ResultSchema:()=>zF,commandType:()=>fx,create:()=>WF});var qF=c.object({readOnlyHint:c.boolean().optional(),untrustedContentHint:c.boolean().optional()}),$F=c.object({name:c.string(),title:c.string().optional(),description:c.string().optional(),input_schema:c.unknown(),annotations:qF.optional(),origin:c.string().optional(),pageUrl:c.string().optional()}),px=c.object({browser_id:c.string(),tab_id:c.string()}),zF=c.object({tools:c.array($F)}),fx="webmcp_list_tools";function WF(e){return new g(fx,px,e)}var bs={};T(bs,{PayloadSchema:()=>mx,ResultSchema:()=>HF,commandType:()=>hx,create:()=>VF});var mx=c.object({browser_id:c.string(),tab_id:c.string(),tool_name:c.string(),input:c.unknown(),timeout_ms:c.number().int().positive().optional()}),HF=c.object({result:c.unknown()}),hx="webmcp_invoke_tool";function VF(e){return new g(hx,mx,e)}var ys={};T(ys,{PayloadSchema:()=>gx,ResultSchema:()=>GF,commandType:()=>bx,create:()=>KF});var gx=c.object({browser_id:c.string(),tab_id:c.string(),url:c.string()}),GF=c.object({}),bx="navigate_tab_url";function KF(e){return new g(bx,gx,e)}var en={};T(en,{PayloadSchema:()=>yx,ResultSchema:()=>JF,commandType:()=>_x,create:()=>YF});var yx=c.object({browser_id:c.string(),tab_id:c.string()}),JF=c.object({}),_x="navigate_tab_back";function YF(e){return new g(_x,yx,e)}var tn={};T(tn,{PayloadSchema:()=>wx,ResultSchema:()=>ZF,commandType:()=>xx,create:()=>XF});var wx=c.object({browser_id:c.string(),tab_id:c.string()}),ZF=c.object({}),xx="navigate_tab_forward";function XF(e){return new g(xx,wx,e)}var _s={};T(_s,{PayloadSchema:()=>Sx,ResultSchema:()=>QF,commandType:()=>vx,create:()=>e3});var Sx=c.object({browser_id:c.string(),tab_id:c.string()}),QF=c.object({}),vx="navigate_tab_reload";function e3(e){return new g(vx,Sx,e)}var ws={};T(ws,{PayloadSchema:()=>Ex,ResultSchema:()=>t3,commandType:()=>Cx,create:()=>r3});var Ex=c.object({browser_id:c.string(),tab_id:c.string()}),t3=c.object({id:c.string(),title:c.string().optional(),url:c.string().optional()}),Cx="browser_user_claim_tab";function r3(e){return new g(Cx,Ex,e)}var xs={};T(xs,{PayloadSchema:()=>Tx,ResultSchema:()=>n3,commandType:()=>kx,create:()=>o3});var Tx=c.object({browser_id:c.string()}),n3=c.object({tabs:c.array(c.object({id:c.string(),title:c.string().optional(),url:c.string().optional(),lastOpened:c.string().optional(),tabGroup:c.string().optional()}))}),kx="browser_user_open_tabs";function o3(e){return new g(kx,Tx,e)}var Ss={};T(Ss,{PayloadSchema:()=>Ax,ResultSchema:()=>i3,commandType:()=>Ix,create:()=>s3});var Ax=c.object({browser_id:c.string(),query:c.string().optional(),limit:c.number().int().positive().optional(),from:c.string().optional(),to:c.string().optional()}),i3=c.object({items:c.array(c.object({url:c.string(),title:c.string().optional(),dateVisited:c.string()}))}),Ix="browser_user_history";function s3(e){return new g(Ix,Ax,e)}var Ao={};T(Ao,{LogLevelSchema:()=>Cf,PayloadSchema:()=>Rx,ResultSchema:()=>a3,commandType:()=>Px,create:()=>u3});var Cf=c.enum(["debug","info","log","warn","error"]),Rx=c.object({browser_id:c.string(),tab_id:c.string(),filter:c.string().optional(),levels:c.array(Cf).optional(),limit:c.number().int().positive().optional()}),a3=c.object({logs:c.array(c.object({level:Cf,message:c.string(),timestamp:c.string(),url:c.string().optional()}))}),Px="tab_dev_logs";function u3(e){return new g(Px,Rx,e)}var vs={};T(vs,{PayloadSchema:()=>Dx,ResultSchema:()=>l3,commandType:()=>Nx,create:()=>c3});var Dx=c.object({browser_id:c.string(),tab_id:c.string()}),l3=c.object({path:c.string()}),Nx="tab_content_export";function c3(e){return new g(Nx,Dx,e)}var Es={};T(Es,{GSuiteExportTypeSchema:()=>Ox,PayloadSchema:()=>Mx,ResultSchema:()=>d3,commandType:()=>Fx,create:()=>p3});var Ox=c.enum(["pdf","md","xlsx","csv","docx","pptx"]),Mx=c.object({browser_id:c.string(),tab_id:c.string(),format:Ox}),d3=c.object({path:c.string()}),Fx="tab_content_export_gsuite";function p3(e){return new g(Fx,Mx,e)}var Cs={};T(Cs,{PayloadSchema:()=>Bx,ResultSchema:()=>f3,commandType:()=>Lx,create:()=>m3});var Bx=c.object({browser_id:c.string(),tab_id:c.string()}),f3=c.object({text:c.string()}),Lx="tab_clipboard_read_text";function m3(e){return new g(Lx,Bx,e)}var Ts={};T(Ts,{PayloadSchema:()=>Ux,ResultSchema:()=>h3,commandType:()=>jx,create:()=>g3});var Ux=c.object({browser_id:c.string(),tab_id:c.string(),text:c.string()}),h3=c.object({}),jx="tab_clipboard_write_text";function g3(e){return new g(jx,Ux,e)}var ks={};T(ks,{PayloadSchema:()=>qx,ResultSchema:()=>_3,commandType:()=>$x,create:()=>w3});var b3=c.object({mime_type:c.string(),text:c.string().optional(),base64:c.string().optional()}).superRefine((e,t)=>{let r=e.text!==void 0,n=e.base64!==void 0;r===n&&t.addIssue({code:c.ZodIssueCode.custom,message:"Clipboard entries must set exactly one of text or base64"})}),y3=c.object({entries:c.array(b3),presentation_style:c.enum(["unspecified","inline","attachment"]).optional()}),qx=c.object({browser_id:c.string(),tab_id:c.string()}),_3=c.object({items:c.array(y3)}),$x="tab_clipboard_read";function w3(e){return new g($x,qx,e)}var As={};T(As,{PayloadSchema:()=>zx,ResultSchema:()=>v3,commandType:()=>Wx,create:()=>E3});var x3=c.object({mime_type:c.string(),text:c.string().optional(),base64:c.string().optional()}).superRefine((e,t)=>{let r=e.text!==void 0,n=e.base64!==void 0;r===n&&t.addIssue({code:c.ZodIssueCode.custom,message:"Clipboard entries must set exactly one of text or base64"})}),S3=c.object({entries:c.array(x3),presentation_style:c.enum(["unspecified","inline","attachment"]).optional()}),zx=c.object({browser_id:c.string(),tab_id:c.string(),items:c.array(S3)}),v3=c.object({}),Wx="tab_clipboard_write";function E3(e){return new g(Wx,zx,e)}var Is={};T(Is,{PayloadSchema:()=>Hx,ResultSchema:()=>C3,commandType:()=>Vx,create:()=>T3});var Hx=c.object({browser_id:c.string(),tab_id:c.string(),fullPage:c.boolean().optional(),cropX:c.number().optional(),cropY:c.number().optional(),cropWidth:c.number().optional(),cropHeight:c.number().optional()}),C3=c.object({data:c.string()}),Vx="tab_screenshot";function T3(e){return new g(Vx,Hx,e)}var Rs={};T(Rs,{PayloadSchema:()=>Gx,ResultSchema:()=>k3,commandType:()=>Kx,create:()=>A3});var Gx=c.object({browser_id:c.string(),tab_id:c.string(),script:c.string(),timeout_ms:c.number().int().positive().optional()}),k3=c.object({value:c.unknown().optional()}),Kx="playwright_evaluate";function A3(e){return new g(Kx,Gx,e)}var Ps={};T(Ps,{PayloadSchema:()=>Jx,ResultSchema:()=>I3,commandType:()=>Yx,create:()=>R3});var Jx=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),button:c.number().optional(),keys:c.array(c.string()).optional()}),I3=c.object({}),Yx="cua_click";function R3(e){return new g(Yx,Jx,e)}var Ds={};T(Ds,{PayloadSchema:()=>Zx,ResultSchema:()=>P3,commandType:()=>Xx,create:()=>D3});var Zx=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),timeout_ms:c.number().int().positive().optional()}),P3=c.object({}),Xx="cua_download_media";function D3(e){return new g(Xx,Zx,e)}var Ns={};T(Ns,{PayloadSchema:()=>Qx,ResultSchema:()=>N3,commandType:()=>eS,create:()=>O3});var Qx=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),keys:c.array(c.string()).optional()}),N3=c.object({}),eS="cua_double_click";function O3(e){return new g(eS,Qx,e)}var Os={};T(Os,{PayloadSchema:()=>tS,ResultSchema:()=>M3,commandType:()=>rS,create:()=>F3});var tS=c.object({browser_id:c.string(),tab_id:c.string(),keys:c.array(c.string())}),M3=c.object({}),rS="cua_keypress";function F3(e){return new g(rS,tS,e)}var Ms={};T(Ms,{PayloadSchema:()=>nS,ResultSchema:()=>B3,commandType:()=>oS,create:()=>L3});var nS=c.object({browser_id:c.string(),tab_id:c.string(),path:c.array(c.object({x:c.number(),y:c.number()})),keys:c.array(c.string()).optional()}),B3=c.object({}),oS="cua_drag";function L3(e){return new g(oS,nS,e)}var Fs={};T(Fs,{PayloadSchema:()=>iS,ResultSchema:()=>U3,commandType:()=>sS,create:()=>j3});var iS=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),keys:c.array(c.string()).optional()}),U3=c.object({}),sS="cua_move";function j3(e){return new g(sS,iS,e)}var Bs={};T(Bs,{PayloadSchema:()=>aS,ResultSchema:()=>q3,commandType:()=>uS,create:()=>$3});var aS=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),scroll_x:c.number(),scroll_y:c.number(),keys:c.array(c.string()).optional()}),q3=c.object({}),uS="cua_scroll";function $3(e){return new g(uS,aS,e)}var Ls={};T(Ls,{PayloadSchema:()=>lS,ResultSchema:()=>z3,commandType:()=>cS,create:()=>W3});var lS=c.object({browser_id:c.string(),tab_id:c.string(),text:c.string()}),z3=c.object({}),cS="cua_type";function W3(e){return new g(cS,lS,e)}var Us={};T(Us,{PayloadSchema:()=>dS,ResultSchema:()=>H3,commandType:()=>pS,create:()=>V3});var dS=c.object({browser_id:c.string(),tab_id:c.string(),node_id:c.string()}),H3=c.object({}),pS="dom_cua_click";function V3(e){return new g(pS,dS,e)}var js={};T(js,{PayloadSchema:()=>fS,ResultSchema:()=>G3,commandType:()=>mS,create:()=>K3});var fS=c.object({browser_id:c.string(),tab_id:c.string(),node_id:c.string(),timeout_ms:c.number().int().positive().optional()}),G3=c.object({}),mS="dom_cua_download_media";function K3(e){return new g(mS,fS,e)}var qs={};T(qs,{PayloadSchema:()=>hS,ResultSchema:()=>J3,commandType:()=>gS,create:()=>Y3});var hS=c.object({browser_id:c.string(),tab_id:c.string(),node_id:c.string()}),J3=c.object({}),gS="dom_cua_double_click";function Y3(e){return new g(gS,hS,e)}var $s={};T($s,{PayloadSchema:()=>bS,ResultSchema:()=>Z3,commandType:()=>yS,create:()=>X3});var bS=c.object({browser_id:c.string(),tab_id:c.string()}),Z3=c.unknown(),yS="dom_cua_get_visible_dom";function X3(e){return new g(yS,bS,e)}var zs={};T(zs,{PayloadSchema:()=>_S,ResultSchema:()=>Q3,commandType:()=>wS,create:()=>eB});var _S=c.object({browser_id:c.string(),tab_id:c.string(),keys:c.array(c.string())}),Q3=c.object({}),wS="dom_cua_keypress";function eB(e){return new g(wS,_S,e)}var Ws={};T(Ws,{PayloadSchema:()=>xS,ResultSchema:()=>tB,commandType:()=>SS,create:()=>rB});var xS=c.object({browser_id:c.string(),tab_id:c.string(),scroll_x:c.number(),scroll_y:c.number(),node_id:c.string().optional()}),tB=c.object({}),SS="dom_cua_scroll";function rB(e){return new g(SS,xS,e)}var Hs={};T(Hs,{PayloadSchema:()=>vS,ResultSchema:()=>nB,commandType:()=>ES,create:()=>oB});var vS=c.object({browser_id:c.string(),tab_id:c.string(),text:c.string()}),nB=c.object({}),ES="dom_cua_type";function oB(e){return new g(ES,vS,e)}var Vs={};T(Vs,{PayloadSchema:()=>CS,ResultSchema:()=>iB,commandType:()=>TS,create:()=>sB});var CS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),modifiers:c.array(c.enum(["Alt","Control","ControlOrMeta","Meta","Shift"])).optional(),button:c.enum(["left","right","middle"]).optional(),force:c.boolean().optional(),timeout_ms:c.number().int().positive().optional()}),iB=c.object({}),TS="playwright_locator_click";function sB(e){return new g(TS,CS,e)}var Gs={};T(Gs,{PayloadSchema:()=>kS,ResultSchema:()=>aB,commandType:()=>AS,create:()=>uB});var kS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),modifiers:c.array(c.enum(["Alt","Control","ControlOrMeta","Meta","Shift"])).optional(),button:c.enum(["left","right","middle"]).optional(),force:c.boolean().optional(),timeout_ms:c.number().int().positive().optional()}),aB=c.object({}),AS="playwright_locator_dblclick";function uB(e){return new g(AS,kS,e)}var Ks={};T(Ks,{PayloadSchema:()=>IS,ResultSchema:()=>lB,commandType:()=>RS,create:()=>cB});var IS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),lB=c.object({}),RS="playwright_locator_download_media";function cB(e){return new g(RS,IS,e)}var Io={};T(Io,{PayloadSchema:()=>PS,ResultSchema:()=>dB,commandType:()=>DS,create:()=>pB});var PS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),value:c.string(),replace:c.boolean()}),dB=c.object({}),DS="playwright_locator_fill";function pB(e){return new g(DS,PS,e)}var Js={};T(Js,{PayloadSchema:()=>NS,ResultSchema:()=>fB,commandType:()=>OS,create:()=>mB});var NS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),value:c.string()}),fB=c.object({}),OS="playwright_locator_press";function mB(e){return new g(OS,NS,e)}var Ys={};T(Ys,{PayloadSchema:()=>MS,ResultSchema:()=>hB,commandType:()=>FS,create:()=>gB});var MS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),state:c.enum(["attached","detached","visible","hidden"]),timeout_ms:c.number().int().positive().optional()}),hB=c.object({}),FS="playwright_locator_wait_for";function gB(e){return new g(FS,MS,e)}var Zs={};T(Zs,{PayloadSchema:()=>BS,ResultSchema:()=>bB,commandType:()=>LS,create:()=>yB});var BS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string()}),bB=c.object({count:c.number().int()}),LS="playwright_locator_count";function yB(e){return new g(LS,BS,e)}var Xs={};T(Xs,{PayloadSchema:()=>jS,ResultSchema:()=>_B,SelectOptionSchema:()=>US,commandType:()=>qS,create:()=>wB});var US=c.object({value:c.string().optional(),label:c.string().optional(),index:c.number().int().nonnegative().optional()}).superRefine((e,t)=>{e.value===void 0&&e.label===void 0&&e.index===void 0&&t.addIssue({code:c.ZodIssueCode.custom,message:"Select option requires value, label, or index"})}),jS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),selections:c.array(US).min(1),timeout_ms:c.number().int().positive().optional()}),_B=c.object({}),qS="playwright_locator_select_option";function wB(e){return new g(qS,jS,e)}var Qs={};T(Qs,{PayloadSchema:()=>$S,ResultSchema:()=>xB,commandType:()=>zS,create:()=>SB});var $S=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),checked:c.boolean(),force:c.boolean().optional(),timeout_ms:c.number().int().positive().optional()}),xB=c.object({}),zS="playwright_locator_set_checked";function SB(e){return new g(zS,$S,e)}var ea={};T(ea,{PayloadSchema:()=>WS,ResultSchema:()=>vB,commandType:()=>HS,create:()=>EB});var WS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string()}),vB=c.object({value:c.boolean()}),HS="playwright_locator_is_visible";function EB(e){return new g(HS,WS,e)}var ta={};T(ta,{PayloadSchema:()=>VS,ResultSchema:()=>CB,commandType:()=>GS,create:()=>TB});var VS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string()}),CB=c.object({value:c.boolean()}),GS="playwright_locator_is_enabled";function TB(e){return new g(GS,VS,e)}var ra={};T(ra,{PayloadSchema:()=>KS,ResultSchema:()=>kB,commandType:()=>JS,create:()=>AB});var KS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),kB=c.object({values:c.array(c.string())}),JS="playwright_locator_all_text_contents";function AB(e){return new g(JS,KS,e)}var na={};T(na,{PayloadSchema:()=>YS,ResultSchema:()=>IB,commandType:()=>ZS,create:()=>RB});var YS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),IB=c.object({value:c.string().nullable()}),ZS="playwright_locator_text_content";function RB(e){return new g(ZS,YS,e)}var oa={};T(oa,{PayloadSchema:()=>XS,ResultSchema:()=>PB,commandType:()=>QS,create:()=>DB});var XS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),PB=c.object({value:c.string()}),QS="playwright_locator_inner_text";function DB(e){return new g(QS,XS,e)}var ia={};T(ia,{PayloadSchema:()=>ev,ResultSchema:()=>NB,commandType:()=>tv,create:()=>OB});var ev=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),name:c.string(),timeout_ms:c.number().int().positive().optional()}),NB=c.object({value:c.string().nullable()}),tv="playwright_locator_get_attribute";function OB(e){return new g(tv,ev,e)}var sa={};T(sa,{PayloadSchema:()=>rv,ResultSchema:()=>FB,commandType:()=>nv,create:()=>BB});var rv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),relative_selector:c.string().optional(),timeout_ms:c.number().int().positive().optional()}),MB=c.object({attributes:c.record(c.string()),inner_text:c.string(),text_content:c.string().nullable()}),FB=c.object({values:c.array(MB.nullable())}),nv="playwright_locator_read_all";function BB(e){return new g(nv,rv,e)}var aa={};T(aa,{PayloadSchema:()=>ov,ResultSchema:()=>UB,commandType:()=>iv,create:()=>jB});var LB=c.enum(["load","domcontentloaded","networkidle","commit"]),ov=c.object({browser_id:c.string(),tab_id:c.string(),url:c.string(),wait_until:LB.optional(),timeout_ms:c.number().int().positive().optional()}),UB=c.object({url:c.string().optional()}),iv="playwright_wait_for_url";function jB(e){return new g(iv,ov,e)}var ua={};T(ua,{LoadStateSchema:()=>sv,PayloadSchema:()=>av,ResultSchema:()=>qB,commandType:()=>uv,create:()=>$B});var sv=c.enum(["load","domcontentloaded","networkidle"]),av=c.object({browser_id:c.string(),tab_id:c.string(),state:sv.optional(),timeout_ms:c.number().int().positive().optional()}),qB=c.object({}),uv="playwright_wait_for_load_state";function $B(e){return new g(uv,av,e)}var la={};T(la,{PayloadSchema:()=>lv,ResultSchema:()=>zB,commandType:()=>cv,create:()=>WB});var lv=c.object({browser_id:c.string(),tab_id:c.string(),timeout_ms:c.number().int().nonnegative()}),zB=c.object({}),cv="playwright_wait_for_timeout";function WB(e){return new g(cv,lv,e)}var ca={};T(ca,{PayloadSchema:()=>dv,ResultSchema:()=>HB,commandType:()=>pv,create:()=>VB});var dv=c.object({browser_id:c.string(),tab_id:c.string()}),HB=c.object({dom_snapshot:c.string()}),pv="playwright_dom_snapshot";function VB(e){return new g(pv,dv,e)}var da={};T(da,{PayloadSchema:()=>fv,ResultSchema:()=>YB,commandType:()=>mv,create:()=>ZB});var GB=c.object({x:c.number(),y:c.number(),width:c.number(),height:c.number()}),KB=c.object({primary:c.string().nullable().optional(),candidates:c.array(c.string()),frameSelectors:c.array(c.string()).optional()}),JB=c.object({nodeId:c.number().int().positive().nullable().optional(),tagName:c.string(),role:c.string().nullable().optional(),visibleText:c.string().nullable().optional(),ariaName:c.string().nullable().optional(),testId:c.string().nullable().optional(),boundingBox:GB.nullable().optional(),preview:c.string(),selector:KB}),fv=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),include_non_interactable:c.boolean().optional()}),YB=c.array(JB),mv="playwright_element_info";function ZB(e){return new g(mv,fv,e)}var pa={};T(pa,{PayloadSchema:()=>hv,ResultSchema:()=>XB,commandType:()=>gv,create:()=>QB});var hv=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),include_non_interactable:c.boolean().optional()}),XB=c.object({data:c.string()}),gv="playwright_element_screenshot";function QB(e){return new g(gv,hv,e)}var fa={};T(fa,{PayloadSchema:()=>bv,ResultSchema:()=>eL,commandType:()=>yv,create:()=>tL});var bv=c.object({browser_id:c.string(),tab_id:c.string(),timeout_ms:c.number().int().positive().optional()}),eL=c.object({download_id:c.string()}),yv="playwright_wait_for_download";function tL(e){return new g(yv,bv,e)}var ma={};T(ma,{PayloadSchema:()=>_v,ResultSchema:()=>rL,commandType:()=>wv,create:()=>nL});var _v=c.object({browser_id:c.string(),tab_id:c.string(),download_id:c.string(),timeout_ms:c.number().int().positive().optional()}),rL=c.object({path:c.string().nullable()}),wv="playwright_download_path";function nL(e){return new g(wv,_v,e)}var ha={};T(ha,{PayloadSchema:()=>xv,ResultSchema:()=>oL,commandType:()=>Sv,create:()=>iL});var xv=c.object({browser_id:c.string(),tab_id:c.string(),timeout_ms:c.number().int().positive().optional()}),oL=c.object({file_chooser_id:c.string(),is_multiple:c.boolean()}),Sv="playwright_wait_for_file_chooser";function iL(e){return new g(Sv,xv,e)}var ga={};T(ga,{PayloadSchema:()=>vv,ResultSchema:()=>sL,commandType:()=>Ev,create:()=>aL});var vv=c.object({browser_id:c.string(),tab_id:c.string(),file_chooser_id:c.string(),files:c.array(c.string()),timeout_ms:c.number().int().positive().optional()}),sL=c.object({}),Ev="playwright_file_chooser_set_files";function aL(e){return new g(Ev,vv,e)}var ba=class{#e;#t;#r;constructor({browserId:t,createTab:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async new(){let t=await this.#r.send({command:cs.create({browser_id:this.#e})});return this.#t(t)}async selected(){let t=await this.#r.send({command:ms.create({browser_id:this.#e})});if(t.id)return this.#t(t)}async list(){return(await this.#r.send({command:Qr.create({browser_id:this.#e})})).tabs}async finalize(t={}){if(t===null||Array.isArray(t)||typeof t!="object")throw new Error("browser.tabs.finalize expects an options object");let r=t.keep??[];if(!Array.isArray(r))throw new Error("browser.tabs.finalize keep must be an array");await this.#r.send({command:ps.create({browser_id:this.#e,keep:r.map(n=>({tab_id:uL(n.tab),status:lL(n.status)}))})})}async content(t){let r=hs.create({browser_id:this.#e,urls:t.urls,content_type:t.contentType,...t.timeoutMs===void 0?{}:{timeout_ms:t.timeoutMs}});return r.parse(),t.urls.length===0?[]:(await this.#r.send({command:r})).results}async get(t){if(!t)throw new Error("tabs.get requires a tab id");let r=await this.list(),n=r.find(o=>o.id===t);if(!n){let o=r.length?r.map(i=>`${i.id}|${i.title??"<no title>"}|${i.url??"<no url>"}`).join(", "):"none";throw new Error(`tabs.get could not find tab id "${t}". Existing tabs: ${o}`)}return this.#t(n)}};function uL(e){if(typeof e=="string"){if(!e)throw new Error("browser.tabs.finalize received an empty tab id");return e}if(e&&typeof e=="object"&&typeof e.id=="string")return e.id;throw new Error("browser.tabs.finalize keep entries must be objects like { tab, status }; do not pass a Tab or tab id directly")}function lL(e){if(e==="handoff"||e==="deliverable")return e;throw new Error(`browser.tabs.finalize received invalid status ${String(e)}`)}var ya=class{#e;#t;#r;constructor({browserId:t,createTab:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async openTabs(){return(await this.#r.send({command:xs.create({browser_id:this.#e})})).tabs}async claimTab(t){let r=cL(t),n=await this.#r.send({command:ws.create({browser_id:this.#e,tab_id:r})});return this.#t(n)}async history(t={}){if(t===null||Array.isArray(t)||typeof t!="object")throw new Error("browser.user.history expects an options object");let r={browser_id:this.#e},n=dL(t.query),o=pL(t.limit),i=Cv(t.from,"from"),s=Cv(t.to,"to");return n!==void 0&&(r.query=n),o!==void 0&&(r.limit=o),i!==void 0&&(r.from=i),s!==void 0&&(r.to=s),(await this.#r.send({command:Ss.create(r)})).items}},Cv=(e,t)=>{if(e==null)return;let r=e instanceof Date?e:new Date(e);if(Number.isNaN(r.getTime()))throw new Error(`browser.user.history received an invalid ${t} date`);return r.toISOString()},cL=e=>{if(typeof e=="string"){if(e.length===0)throw new Error("browser.user.claimTab received an empty tab id");return e}if(e&&typeof e=="object"&&typeof e.id=="string")return e.id;throw new Error("browser.user.claimTab expects a tab returned by browser.user.openTabs() or a tab id")},dL=e=>{if(e!=null){if(typeof e!="string")throw new Error("browser.user.history received an invalid query");return e}},pL=e=>{if(e!=null){if(!Number.isInteger(e)||e<=0)throw new Error("browser.user.history received an invalid limit");return e}};var Il=e=>{let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n+=1)r[n]=t.charCodeAt(n);return r};function Qe(e,t){let r=e instanceof Error?e.message:String(e),n=new Error(`${r}
${t}`);return e instanceof Error&&e.stack&&(n.stack=`${n.name}: ${n.message}
${e.stack}`),n}function fL(e,t){let r=mL(t);if(typeof e=="string"){if(e.length===0)throw new Error("playwright.evaluate requires a pageFunction");return`const arg = ${r};
return (${e});`}if(typeof e=="function")return[`const arg = ${r};`,`const __playwrightEvaluate = (${e.toString()});`,"return await __playwrightEvaluate(arg);"].join(`
`);throw new Error("playwright.evaluate requires a string or function")}function mL(e){if(e===void 0)return"undefined";try{let t=JSON.stringify(e);if(t!==void 0)return t}catch(t){throw Qe(t,"playwright.evaluate arg must be JSON-serializable")}throw new Error("playwright.evaluate arg must be JSON-serializable")}function Tv(e,t){let{x:r,y:n}=t;if(!Number.isFinite(r)||!Number.isFinite(n))throw new Error(`${e} requires numeric x and y coordinates`);return{x:r,y:n}}function hL(e){let t=Array.isArray(e)?e:[e];if(!t.length)throw new Error("locator.selectOption requires at least one value");return t.map(r=>{if(typeof r=="string")return{value:r};if(!r||typeof r!="object")throw new Error("locator.selectOption requires a string or { value?, label?, index? }");let n={};if(r.value!==void 0){if(typeof r.value!="string")throw new Error("locator.selectOption value must be a string");n.value=r.value}if(r.label!==void 0){if(typeof r.label!="string")throw new Error("locator.selectOption label must be a string");n.label=r.label}if(r.index!==void 0){if(!Number.isInteger(r.index)||r.index<0)throw new Error("locator.selectOption index must be a non-negative integer");n.index=r.index}if(n.value===void 0&&n.label===void 0&&n.index===void 0)throw new Error("locator.selectOption requires value, label, or index for each selection");return n})}var _a=class e{#e;#t;#r;#n;#o;#i;#s;constructor({browserId:t,tabId:r,selector:n,transport:o,collectionReadCache:i,collectionReadIndex:s,collectionRelativeSelector:a}){this.#e=t,this.#t=r,this.#r=n,this.#n=o,this.#o=i,this.#i=s,this.#s=a}async click(t={}){try{await this.#n.send({command:Vs.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,modifiers:t.modifiers,button:t.button,force:t.force,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs}),this.#o?.clear()}catch(r){throw Qe(r,`waiting on click for selector ${this.#r}`)}}async dblclick(t={}){try{await this.#n.send({command:Gs.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,modifiers:t.modifiers,button:t.button,force:t.force,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs}),this.#o?.clear()}catch(r){throw Qe(r,`waiting on dblclick for selector ${this.#r}`)}}async selectOption(t,{timeoutMs:r}={}){let n=hL(t);try{await this.#n.send({command:Xs.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,selections:n,timeout_ms:r}),timeoutMs:r}),this.#o?.clear()}catch(o){throw Qe(o,`locator.selectOption failed for selector ${this.#r}`)}}async fill(t,{timeoutMs:r}={}){if(t==null)throw new Error("locator.fill requires a value");try{await this.#n.send({command:Io.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,value:t,replace:!0}),timeoutMs:r}),this.#o?.clear()}catch(n){throw Qe(n,`locator.fill failed for selector ${this.#r}`)}}async type(t,{timeoutMs:r}={}){if(t==null)throw new Error("locator.type requires a value");try{await this.#n.send({command:Io.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,value:t,replace:!1}),timeoutMs:r}),this.#o?.clear()}catch(n){throw Qe(n,`locator.type failed for selector ${this.#r}`)}}async press(t,{timeoutMs:r}={}){if(t==null)throw new Error("locator.press requires a value");try{await this.#n.send({command:Js.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,value:t}),timeoutMs:r}),this.#o?.clear()}catch(n){throw Qe(n,`locator.press failed for selector ${this.#r}`)}}async setChecked(t,r={}){if(typeof t!="boolean")throw new Error("locator.setChecked requires a boolean");try{await this.#n.send({command:Qs.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,checked:t,force:r.force,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs}),this.#o?.clear()}catch(n){throw Qe(n,`locator.setChecked(${t}) failed for selector ${this.#r}`)}}async check(t={}){await this.setChecked(!0,t)}async uncheck(t={}){await this.setChecked(!1,t)}async waitFor({state:t,timeoutMs:r}){if(!t)throw new Error("locator.waitFor requires a state");try{await this.#n.send({command:Ys.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,state:t,timeout_ms:r}),timeoutMs:r})}catch(n){throw Qe(n,`locator.waitFor(${t}) timed out for selector ${this.#r}`)}}async count(){return(await this.#n.send({command:Zs.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r})})).count}async all(){let t=await this.count(),r=new Tf({browserId:this.#e,tabId:this.#t,selector:this.#r,transport:this.#n});return Array.from({length:t},(n,o)=>new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> nth=${o}`,transport:this.#n,collectionReadCache:r,collectionReadIndex:o}))}async textContent({timeoutMs:t}={}){let r=await this.cachedRead(t);return r?r.text_content:(await this.#n.send({command:na.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,timeout_ms:t}),timeoutMs:t})).value}async innerText({timeoutMs:t}={}){let r=await this.cachedRead(t);return r?r.inner_text:(await this.#n.send({command:oa.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,timeout_ms:t}),timeoutMs:t})).value}async getAttribute(t,{timeoutMs:r}={}){if(!t)throw new Error("locator.getAttribute requires a name");let n=await this.cachedRead(r);return n?Object.prototype.hasOwnProperty.call(n.attributes,t)?n.attributes[t]??null:null:(await this.#n.send({command:ia.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,name:t,timeout_ms:r}),timeoutMs:r})).value}async isVisible(){return(await this.#n.send({command:ea.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r})})).value}async isEnabled(){return(await this.#n.send({command:ta.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r})})).value}async allTextContents({timeoutMs:t}={}){return(await this.#n.send({command:ra.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,timeout_ms:t}),timeoutMs:t})).values}async downloadMedia({timeoutMs:t}={}){try{await this.#n.send({command:Ks.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,timeout_ms:t}),timeoutMs:t}),this.#o?.clear()}catch(r){throw Qe(r,`locator.downloadMedia failed for selector ${this.#r}`)}}locator(t,r={}){if(!t)throw new Error("locator.locator requires a selector");return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> ${t}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,t):void 0}).filter(r)}first(){return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> nth=0`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,"nth=0"):void 0})}last(){return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> nth=-1`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,"nth=-1"):void 0})}nth(t){if(typeof t!="number")throw new Error("locator.nth requires a numeric index");return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> nth=${t}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,`nth=${t}`):void 0})}and(t){if(!(t instanceof e))throw new Error("locator.and requires a PlaywrightLocator");if(t.#e!==this.#e||t.#t!==this.#t)throw new Error("Locators must belong to the same tab");return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> internal:and=${JSON.stringify(t.#r)}`,transport:this.#n})}or(t){if(!(t instanceof e))throw new Error("locator.or requires a PlaywrightLocator");if(t.#e!==this.#e||t.#t!==this.#t)throw new Error("Locators must belong to the same tab");return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> internal:or=${JSON.stringify(t.#r)}`,transport:this.#n})}filter(t={}){let r=[this.#r];if(t.hasText!==void 0&&r.push(`internal:has-text=${Rl(t.hasText,!1)}`),t.hasNotText!==void 0&&r.push(`internal:has-not-text=${Rl(t.hasNotText,!1)}`),t.has!==void 0&&(this.assertCompatibleLocator(t.has,"locator.filter has"),r.push(`internal:has=${JSON.stringify(t.has.#r)}`)),t.hasNot!==void 0&&(this.assertCompatibleLocator(t.hasNot,"locator.filter hasNot"),r.push(`internal:has-not=${JSON.stringify(t.hasNot.#r)}`)),t.visible!==void 0){if(typeof t.visible!="boolean")throw new Error("locator.filter visible must be a boolean");r.push(`visible=${t.visible}`)}let n=r.slice(1).join(" >> "),o=this.#o&&this.#i!==void 0&&(!n||this.#s!==void 0);return new e({browserId:this.#e,tabId:this.#t,selector:r.join(" >> "),transport:this.#n,collectionReadCache:o?this.#o:void 0,collectionReadIndex:o?this.#i:void 0,collectionRelativeSelector:o?gt(this.#s,n):void 0})}getByRole(t,r={}){let n=Af(t,r);return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,n):void 0})}getByText(t,r={}){let n=If(t,r);return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,n):void 0})}getByLabel(t,r={}){let n=Rf(t,r);return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,n):void 0})}getByPlaceholder(t,r={}){let n=Pf(t,r);return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,n):void 0})}getByTestId(t){let r=Df(t);return new e({browserId:this.#e,tabId:this.#t,selector:`${this.#r} >> ${r}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?gt(this.#s,r):void 0})}async cachedRead(t){return!this.#o||this.#i===void 0?null:await this.#o.read({index:this.#i,relativeSelector:this.#s,timeoutMs:t})}assertCompatibleLocator(t,r){if(!(t instanceof e))throw new Error(`${r} requires a PlaywrightLocator`);if(t.#e!==this.#e||t.#t!==this.#t)throw new Error("Locators must belong to the same tab")}},Tf=class{#e;#t;#r;#n;#o=new Map;constructor({browserId:t,tabId:r,selector:n,transport:o}){this.#e=t,this.#t=r,this.#r=n,this.#n=o}clear(){this.#o.clear()}async read({index:t,relativeSelector:r,timeoutMs:n}){let o=r??"",i=this.#o.get(o);return i||(i=this.#i(r,n).catch(s=>{throw this.#o.delete(o),s}),this.#o.set(o,i)),(await i)[t]??null}async#i(t,r){return(await this.#n.send({command:sa.create({browser_id:this.#e,tab_id:this.#t,selector:this.#r,relative_selector:t,timeout_ms:r}),timeoutMs:r})).values}};function gt(e,t){return e?t?`${e} >> ${t}`:e:t||void 0}function kv(e){let t=e;return e.unicode||t.unicodeSets?String(e):String(e).replace(/(^|[^\\])(\\\\)*(["'`])/g,"$1$2\\\\$3").replace(/>>/g,"\\>\\>")}function Rl(e,t){return typeof e!="string"?kv(e):`${JSON.stringify(e)}${t?"s":"i"}`}function kf(e,t){return typeof e!="string"?kv(e):`"${e.replace(/\\/g,"\\\\").replace(/["]/g,'\\"')}"${t?"s":"i"}`}function Af(e,t){if(!e)throw new Error("getByRole requires a role");let r=[];return t.name!==void 0&&r.push(`[name=${kf(t.name,!!t.exact)}]`),`internal:role=${e}${r.join("")}`}function If(e,t){if(typeof e!="string"&&!(e instanceof RegExp))throw new Error("getByText requires a string or RegExp");return`internal:text=${Rl(e,!!t.exact)}`}function Rf(e,t){if(typeof e!="string"&&!(e instanceof RegExp))throw new Error("getByLabel requires a string or RegExp");return`internal:label=${Rl(e,!!t.exact)}`}function Pf(e,t){if(typeof e!="string"&&!(e instanceof RegExp))throw new Error("getByPlaceholder requires a string or RegExp");return`internal:attr=[placeholder=${kf(e,!!t.exact)}]`}function Df(e){if(!e)throw new Error("getByTestId requires a testId");return`internal:testid=[data-testid=${kf(e,!0)}]`}var Pl=class e{#e;#t;#r;#n;constructor({browserId:t,tabId:r,frameSelector:n,transport:o}){this.#e=t,this.#t=r,this.#r=n,this.#n=o}locator(t){if(!t)throw new Error("frameLocator.locator requires a selector");let r=`${this.#r} >> internal:control=enter-frame >> ${t}`;return new _a({browserId:this.#e,tabId:this.#t,selector:r,transport:this.#n})}frameLocator(t){if(!t)throw new Error("frameLocator.frameLocator requires a selector");return new e({browserId:this.#e,tabId:this.#t,frameSelector:`${this.#r} >> internal:control=enter-frame >> ${t}`,transport:this.#n})}getByRole(t,r={}){return this.locator(Af(t,r))}getByText(t,r={}){return this.locator(If(t,r))}getByLabel(t,r={}){return this.locator(Rf(t,r))}getByPlaceholder(t,r={}){return this.locator(Pf(t,r))}getByTestId(t){return this.locator(Df(t))}},Dl=class{#e;#t;#r;#n;constructor({browserId:t,tabId:r,downloadId:n,transport:o}){this.#e=t,this.#t=r,this.#r=n,this.#n=o}async path({timeoutMs:t}={}){return(await this.#n.send({command:ma.create({browser_id:this.#e,tab_id:this.#t,download_id:this.#r,timeout_ms:t}),timeoutMs:t})).path??null}},Nl=class{#e;#t;#r;#n;#o;constructor({browserId:t,tabId:r,fileChooserId:n,isMultiple:o,transport:i}){this.#e=t,this.#t=r,this.#r=n,this.#n=o,this.#o=i}isMultiple(){return this.#n}async setFiles(t,{timeoutMs:r}={}){if(t==null)throw new Error("fileChooser.setFiles requires files");let n=Array.isArray(t)?t:[t];if(!n.length)throw new Error("fileChooser.setFiles requires at least one file");try{await this.#o.send({command:ga.create({browser_id:this.#e,tab_id:this.#t,file_chooser_id:this.#r,files:n,timeout_ms:r}),timeoutMs:r})}catch(o){throw Qe(o,"fileChooser.setFiles failed")}}},wa=class{#e;#t;#r;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async goBack(){await this.#r.send({command:en.create({browser_id:this.#e,tab_id:this.#t})})}async goForward(){await this.#r.send({command:tn.create({browser_id:this.#e,tab_id:this.#t})})}async evaluate(t,r,n){return(await this.#r.send({command:Rs.create({browser_id:this.#e,script:fL(t,r),tab_id:this.#t,timeout_ms:n?.timeoutMs}),timeoutMs:n?.timeoutMs})).value}locator(t){if(!t)throw new Error("playwright.locator requires a selector");return new _a({browserId:this.#e,tabId:this.#t,selector:t,transport:this.#r})}getByRole(t,r={}){return this.locator(Af(t,r))}getByText(t,r={}){return this.locator(If(t,r))}getByLabel(t,r={}){return this.locator(Rf(t,r))}getByPlaceholder(t,r={}){return this.locator(Pf(t,r))}getByTestId(t){return this.locator(Df(t))}frameLocator(t){if(!t)throw new Error("playwright.frameLocator requires a selector");return new Pl({browserId:this.#e,tabId:this.#t,frameSelector:t,transport:this.#r})}async waitForURL(t,r={}){if(!t)throw new Error("playwright.waitForURL requires a url");await this.#r.send({command:aa.create({browser_id:this.#e,tab_id:this.#t,url:t,wait_until:r.waitUntil,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs})}async waitForLoadState(t={}){await this.#r.send({command:ua.create({browser_id:this.#e,tab_id:this.#t,state:t.state,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs})}async waitForTimeout(t){if(!Number.isInteger(t)||t<0)throw new Error("playwright.waitForTimeout requires a non-negative integer");await this.#r.send({command:la.create({browser_id:this.#e,tab_id:this.#t,timeout_ms:t}),timeoutMs:t+2e3})}async waitForEvent(t,r={}){if(t==="download"){let n=await this.#r.send({command:fa.create({browser_id:this.#e,tab_id:this.#t,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs});return new Dl({browserId:this.#e,tabId:this.#t,downloadId:n.download_id,transport:this.#r})}if(t==="filechooser"){let n=await this.#r.send({command:ha.create({browser_id:this.#e,tab_id:this.#t,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs});return new Nl({browserId:this.#e,tabId:this.#t,fileChooserId:n.file_chooser_id,isMultiple:n.is_multiple,transport:this.#r})}throw new Error("playwright.waitForEvent only supports 'download' and 'filechooser'")}async expectNavigation(t,r={}){let n=r.url?this.waitForURL(r.url,{timeoutMs:r.timeoutMs,waitUntil:r.waitUntil}):this.waitForLoadState({timeoutMs:r.timeoutMs,state:r.waitUntil}),o=t(),[i]=await Promise.all([o,n]);return i}async elementInfo(t){let r=Tv("playwright.elementInfo",t);return await this.#r.send({command:da.create({browser_id:this.#e,tab_id:this.#t,x:r.x,y:r.y,include_non_interactable:t.includeNonInteractable})})}async elementScreenshot(t){let r=Tv("playwright.elementScreenshot",t),n=await this.#r.send({command:pa.create({browser_id:this.#e,tab_id:this.#t,x:r.x,y:r.y,include_non_interactable:t.includeNonInteractable})});return Il(n.data)}async domSnapshot(){return(await this.#r.send({command:ca.create({browser_id:this.#e,tab_id:this.#t})})).dom_snapshot}};var xa=class{#e;#t;#r;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async get_visible_dom(){return this.#r.send({command:$s.create({browser_id:this.#e,tab_id:this.#t})})}async click(t){if(!t?.node_id)throw new Error("dom_cua.click requires a node_id");await this.#r.send({command:Us.create({browser_id:this.#e,tab_id:this.#t,node_id:t.node_id})})}async double_click(t){if(!t?.node_id)throw new Error("dom_cua.double_click requires a node_id");await this.#r.send({command:qs.create({browser_id:this.#e,tab_id:this.#t,node_id:t.node_id})})}async scroll({node_id:t,x:r,y:n}){if(typeof r!="number"||typeof n!="number")throw new Error("dom_cua.scroll requires x and y numbers");await this.#r.send({command:Ws.create({browser_id:this.#e,tab_id:this.#t,node_id:t,scroll_x:r,scroll_y:n})})}async type({text:t}){if(typeof t!="string")throw new Error("dom_cua.type requires text");await this.#r.send({command:Hs.create({browser_id:this.#e,tab_id:this.#t,text:t})})}async keypress(t){if(!Array.isArray(t?.keys)||t.keys.length===0)throw new Error("dom_cua.keypress requires a non-empty keys array");await this.#r.send({command:zs.create({browser_id:this.#e,tab_id:this.#t,keys:t.keys})})}async downloadMedia(t){if(!t?.node_id)throw new Error("dom_cua.downloadMedia requires a node_id");await this.#r.send({command:js.create({browser_id:this.#e,tab_id:this.#t,node_id:t.node_id,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs})}};var Sa=class{#e;#t;#r;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async click(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.click requires x and y");await this.#r.send({command:Ps.create({browser_id:this.#e,tab_id:this.#t,x:t.x,y:t.y,button:t.button,keys:t.keypress})})}async scroll(t){if(typeof t?.x!="number"||typeof t?.y!="number"||typeof t?.scrollX!="number"||typeof t?.scrollY!="number")throw new Error("cua.scroll requires x, y, scrollX, and scrollY");await this.#r.send({command:Bs.create({browser_id:this.#e,tab_id:this.#t,x:t.x,y:t.y,scroll_x:t.scrollX,scroll_y:t.scrollY,keys:t.keypress})})}async double_click(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.double_click requires x and y");await this.#r.send({command:Ns.create({browser_id:this.#e,tab_id:this.#t,x:t.x,y:t.y,keys:t.keypress})})}async type(t){if(typeof t?.text!="string")throw new Error("cua.type requires text");await this.#r.send({command:Ls.create({browser_id:this.#e,tab_id:this.#t,text:t.text})})}async keypress(t){if(!Array.isArray(t?.keys)||t.keys.length===0)throw new Error("cua.keypress requires a non-empty keys array");await this.#r.send({command:Os.create({browser_id:this.#e,tab_id:this.#t,keys:t.keys})})}async drag(t){if(!Array.isArray(t?.path)||t.path.length===0||t.path.some(r=>typeof r?.x!="number"||typeof r?.y!="number"))throw new Error("cua.drag requires a non-empty path of {x, y} points");await this.#r.send({command:Ms.create({browser_id:this.#e,tab_id:this.#t,path:t.path,keys:t.keys})})}async move(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.move requires x and y");await this.#r.send({command:Fs.create({browser_id:this.#e,tab_id:this.#t,x:t.x,y:t.y,keys:t.keys})})}async downloadMedia(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.downloadMedia requires x and y");await this.#r.send({command:Ds.create({browser_id:this.#e,tab_id:this.#t,x:t.x,y:t.y,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs})}};var va=class{#e;#t;#r;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async export(){return(await this.#r.send({command:vs.create({browser_id:this.#e,tab_id:this.#t})})).path}async exportGsuite(t){return(await this.#r.send({command:Es.create({browser_id:this.#e,tab_id:this.#t,format:t})})).path}};var Ea=class{#e;#t;#r;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async readText(){return(await this.#r.send({command:Cs.create({browser_id:this.#e,tab_id:this.#t})})).text}async writeText(t){if(t==null)throw new Error("tab.clipboard.writeText requires text");await this.#r.send({command:Ts.create({browser_id:this.#e,tab_id:this.#t,text:t})})}async read(){return(await this.#r.send({command:ks.create({browser_id:this.#e,tab_id:this.#t})})).items.map(r=>({entries:r.entries.map(n=>({mimeType:n.mime_type,text:n.text,base64:n.base64})),presentationStyle:r.presentation_style}))}async write(t){if(!Array.isArray(t)||t.length===0)throw new Error("tab.clipboard.write requires at least one clipboard item");await this.#r.send({command:As.create({browser_id:this.#e,tab_id:this.#t,items:t.map(r=>({presentation_style:r.presentationStyle,entries:r.entries.map(n=>({mime_type:n.mimeType,text:n.text,base64:n.base64}))}))})})}};var Ca=class{#e;#t;#r;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#t=r,this.#r=n}async logs(t={}){let r=gL(t.filter),n=bL(t.levels),o=yL(t.limit),i={browser_id:this.#e,tab_id:this.#t,...r!==void 0?{filter:r}:{},...n!==void 0?{levels:n}:{},...o!==void 0?{limit:o}:{}};return(await this.#r.send({command:Ao.create(i)})).logs}},gL=e=>{if(e!=null){if(typeof e!="string")throw new Error("tab.dev.logs received an invalid filter");return e}},bL=e=>{if(e!=null){if(!Array.isArray(e)||e.length===0)throw new Error("tab.dev.logs received invalid levels");return e.map(t=>{if(t==="warning")return"warn";if(Ao.LogLevelSchema.options.includes(t))return t;throw new Error(`tab.dev.logs received invalid level "${String(t)}"`)})}},yL=e=>{if(e!=null){if(!Number.isInteger(e)||e<=0)throw new Error("tab.dev.logs received an invalid limit");return e}};var Ro=class{constructor(t,r,n){this.transport=t;this.browserId=r;this.info=n}get id(){return this.info.id}},cr=class{constructor(t,r,n,o){this.transport=t;this.browserId=r;this.tabId=n;this.info=o}get id(){return this.info.id}};function Ol({capability:e,info:t}){return{capability:e,create:r=>new e({...r,info:t}),id:t.id,info:t}}function Do({capability:e,info:t}){return{capability:e,create:r=>new e({...r,info:t}),id:t.id,info:t}}var Po=class{#e;constructor(t){this.#e=t}async get(t){let r=this.#e[t];if(!r)throw new Error(`Capability is not available: ${t}`);return r}async list(){return Object.values(this.#e).map(t=>t.info)}};var Ft={};T(Ft,{Call:()=>No,Events:()=>Oo});var No={};T(No,{PayloadSchema:()=>Rv,ResultSchema:()=>wL,commandType:()=>Iv,create:()=>xL});var Ml=c.object({session_id:c.string().min(1).optional(),target_id:c.string().min(1).optional()}).refine(e=>e.session_id==null!=(e.target_id==null),"CDP target must provide exactly one of session_id or target_id."),_L=c.object({extensionId:c.string().optional(),sessionId:c.string().optional(),tabId:c.number().int().optional(),targetId:c.string().optional()}),Av=c.object({sequence:c.number().int().positive(),source:_L,method:c.string().min(1),params:c.record(c.string(),c.unknown()).optional()});var Iv="tab_cdp_call",Rv=c.object({browser_id:c.string(),tab_id:c.string(),method:c.string().min(1),params:c.record(c.string(),c.unknown()).optional(),target:Ml.optional(),timeout_ms:c.number().int().positive().optional()}),wL=c.unknown();function xL(e){return new g(Iv,Rv,e)}var Oo={};T(Oo,{PayloadSchema:()=>Dv,ResultSchema:()=>SL,commandType:()=>Pv,create:()=>vL});var Pv="tab_cdp_events",Dv=c.object({after_sequence:c.number().int().nonnegative().optional(),browser_id:c.string(),limit:c.number().int().positive().max(1e3).optional(),methods:c.array(c.string().min(1)).min(1).optional(),tab_id:c.string(),target:Ml.optional(),timeout_ms:c.number().int().nonnegative().optional()}),SL=c.object({cursor:c.number().int().nonnegative(),events:c.array(Av),hasMore:c.boolean(),truncated:c.boolean()});function vL(e){return new g(Pv,Dv,e)}var Nv={id:"cdp",description:"Send raw Chrome DevTools Protocol commands and read debugger events through a supported Browser Use tab when full CDP access is enabled."};var EL=2e3,Ta=class extends cr{constructor({browserId:t,info:r,tabId:n,transport:o}){super(o,t,n,r)}async send(t,r,n){let o=await this.transport.send({command:No.create({browser_id:this.browserId,method:t,params:r,tab_id:this.tabId,target:Ov(n?.target),timeout_ms:n?.timeoutMs}),timeoutMs:n?.timeoutMs});return No.ResultSchema.parse(o)}async readEvents(t){let r=await this.transport.send({command:Oo.create({after_sequence:t?.afterSequence,browser_id:this.browserId,limit:t?.limit,methods:t?.methods,tab_id:this.tabId,target:Ov(t?.target),timeout_ms:t?.timeoutMs}),timeoutMs:CL(t?.timeoutMs)});return Oo.ResultSchema.parse(r)}},Mo=Do({capability:Ta,info:Nv});function Ov(e){if(e!=null)return{session_id:e.sessionId,target_id:e.targetId}}function CL(e){return e!=null&&e>0?e+EL:void 0}var rn={};T(rn,{Bundle:()=>Fo,List:()=>Bo});var Fo={};T(Fo,{PayloadSchema:()=>qv,ResultSchema:()=>PL,commandType:()=>jv,create:()=>DL});var Mv=c.enum(["font","image","script","stylesheet","video","other"]),Fv=c.enum(["font","image","stylesheet","video"]),TL=c.object({kind:c.enum(["attribute","computedStyle","resource"]),nodeId:c.number().int().positive().optional(),property:c.string().optional()}),kL=c.object({id:c.string(),kind:Mv,name:c.string(),sources:c.array(TL),url:c.string()}),AL=c.object({id:c.string(),markup:c.string(),name:c.string()}),Bv=c.object({assets:c.array(kL),id:c.string(),inlineSvgs:c.array(AL),pageUrl:c.string().nullable(),summary:c.object({byKind:c.record(Mv,c.number().int().nonnegative()),inlineSvgCount:c.number().int().nonnegative(),totalCount:c.number().int().nonnegative()})}),Lv=c.object({assetIds:c.array(c.string()).optional(),inventoryId:c.string(),kinds:c.array(Fv).optional()}),IL=c.object({contentType:c.string().nullable(),id:c.string(),kind:Fv,name:c.string(),path:c.string(),url:c.string()}),RL=c.object({contentType:c.string().nullable(),id:c.string(),name:c.string(),reason:c.string(),url:c.string()}),Uv=c.object({assets:c.array(IL),directoryPath:c.string(),failures:c.array(RL),manifestPath:c.string(),summary:c.object({downloadedCount:c.number().int().nonnegative(),elapsedMs:c.number().nonnegative(),failedCount:c.number().int().nonnegative(),requestedCount:c.number().int().nonnegative()})});var jv="tab_page_assets_bundle",qv=Lv.extend({browser_id:c.string(),tab_id:c.string()}),PL=Uv;function DL(e){return new g(jv,qv,e)}var Bo={};T(Bo,{PayloadSchema:()=>zv,ResultSchema:()=>NL,commandType:()=>$v,create:()=>OL});var $v="tab_page_assets_list",zv=c.object({browser_id:c.string(),tab_id:c.string()}),NL=Bv;function OL(e){return new g($v,zv,e)}var Wv={id:"pageAssets",description:"List assets already observed in the current page state and bundle selected assets into a temporary local artifact."};var ka=class extends cr{constructor({browserId:t,info:r,tabId:n,transport:o}){super(o,t,n,r)}async list(){let t=await this.transport.send({command:Bo.create({browser_id:this.browserId,tab_id:this.tabId})});return Bo.ResultSchema.parse(t)}async bundle(t){let r=await this.transport.send({command:Fo.create({...t,browser_id:this.browserId,tab_id:this.tabId})});return Fo.ResultSchema.parse(r)}},Nf=Do({capability:ka,info:Wv});var Of={id:"webmcp",description:"List and invoke page-defined WebMCP tools registered through navigator.modelContext in the active tab."};var Aa=class extends cr{constructor({browserId:t,info:r,tabId:n,transport:o}){super(o,t,n,r)}async listTools(){return(await this.transport.send({command:gs.create({browser_id:this.browserId,tab_id:this.tabId})})).tools.map(r=>this.toTool(r))}async invokeTool({input:t,timeoutMs:r,toolName:n}){let o=n.trim();if(!o)throw new Error("tab.capabilities.webmcp.invokeTool requires a toolName");return(await this.transport.send({command:bs.create({browser_id:this.browserId,tab_id:this.tabId,tool_name:o,input:t,...r==null?{}:{timeout_ms:r}})})).result}toTool(t){return{name:t.name,...t.title==null?{}:{title:t.title},...t.description==null?{}:{description:t.description},inputSchema:t.input_schema,...t.annotations==null?{}:{annotations:t.annotations},...t.origin==null?{}:{origin:t.origin},...t.pageUrl==null?{}:{pageUrl:t.pageUrl},invoke:async(r,n)=>await this.invokeTool({toolName:t.name,input:r,...n?.timeoutMs==null?{}:{timeoutMs:n.timeoutMs}})}}},nn=Do({capability:Aa,info:Of});var ML=[Mo,Nf,nn],FL=BL(ML),Hv=({browserId:e,capabilities:t,tabId:r,transport:n})=>{let o={};for(let i of t??[]){let s=FL.get(i.id);s!=null&&Object.assign(o,{[i.id]:s({browserId:e,info:i,tabId:r,transport:n})})}return new Po(o)};function BL(e){return new Map(e.map(t=>[t.id,t.create]))}var Ia=class{#e;#t;constructor({browserId:t,capabilities:r,transport:n,tabPayload:o={}}){if(!o.id)throw new Error("Tab requires an id");this.#e=t,this.#t=n,this.id=o.id,this.playwright=new wa({browserId:t,tabId:this.id,transport:this.#t}),this.dom_cua=new xa({browserId:t,tabId:this.id,transport:this.#t}),this.cua=new Sa({browserId:t,tabId:this.id,transport:this.#t}),this.content=new va({browserId:t,tabId:this.id,transport:this.#t}),this.clipboard=new Ea({browserId:t,tabId:this.id,transport:this.#t}),this.dev=new Ca({browserId:t,tabId:this.id,transport:this.#t}),this.capabilities=Hv({browserId:this.#e,capabilities:r,tabId:this.id,transport:this.#t})}async goto(t){if(!t)throw new Error("tab.goto requires a url");if(this.#r(),!this.id)throw new Error("tab.goto requires a tab id");await this.#t.send({command:ys.create({browser_id:this.#e,tab_id:this.id,url:t})})}async back(){this.#r(),await this.#t.send({command:en.create({browser_id:this.#e,tab_id:this.id})})}async forward(){this.#r(),await this.#t.send({command:tn.create({browser_id:this.#e,tab_id:this.id})})}async reload(){this.#r(),await this.#t.send({command:_s.create({browser_id:this.#e,tab_id:this.id})})}async close(){this.#r(),await this.#t.send({command:ds.create({browser_id:this.#e,tab_id:this.id})})}async screenshot(t={}){this.#r();let r={browser_id:this.#e,tab_id:this.id,fullPage:t.fullPage};if(t.clip){let{x:o,y:i,width:s,height:a}=t.clip;if(typeof o!="number"||typeof i!="number"||typeof s!="number"||typeof a!="number")throw new Error("tab.screenshot clip requires x, y, width, and height");r.cropX=o,r.cropY=i,r.cropWidth=s,r.cropHeight=a}let n=await this.#t.send({command:Is.create(r)});return Il(n.data)}async title(){return(await this.#n())?.title}async url(){return(await this.#n())?.url}#r(){if(!this.#t)throw new Error("Tab is not bound to a transport")}async#n(){this.#r();let r=(await this.#t.send({command:Qr.create({browser_id:this.#e})})).tabs.find(n=>n.id===this.id);if(r)return{title:r.title,url:r.url}}};var Lo={};T(Lo,{PayloadSchema:()=>Vv,ResultSchema:()=>LL,commandType:()=>Fl,create:()=>UL});var Fl="browser_visibility_get",Vv=c.object({browser_id:c.string()}),LL=c.object({visible:c.boolean()});function UL(e){return new g(Fl,Vv,e)}var Uo={};T(Uo,{PayloadSchema:()=>Gv,ResultSchema:()=>jL,commandType:()=>Bl,create:()=>qL});var Bl="browser_visibility_set",Gv=c.object({browser_id:c.string(),visible:c.boolean()}),jL=c.object({});function qL(e){return new g(Bl,Gv,e)}var Ane={[Fl]:Lo,[Bl]:Uo};var Jv={id:"visibility",description:"Use to show or hide the browser to the user, and to determine the browser's current visibility. Keep browser work in the background unless the user asks to see it or live viewing is useful. When the browser should be visible, call set(true)."};var Ra=class extends Ro{constructor({browserId:t,info:r,transport:n}){super(n,t,r)}async set(t){let r=await this.transport.send({command:Uo.create({browser_id:this.browserId,visible:t})});Uo.ResultSchema.parse(r)}async get(){let t=await this.transport.send({command:Lo.create({browser_id:this.browserId})});return Lo.ResultSchema.parse(t).visible}},Mf=Ol({capability:Ra,info:Jv});var jo={};T(jo,{PayloadSchema:()=>Yv,ResultSchema:()=>$L,commandType:()=>Ll,create:()=>zL});var Ll="browser_viewport_reset",Yv=c.object({browser_id:c.string()}),$L=c.object({});function zL(e){return new g(Ll,Yv,e)}var qo={};T(qo,{PayloadSchema:()=>Zv,ResultSchema:()=>WL,commandType:()=>Ul,create:()=>HL});var Ul="browser_viewport_set",Zv=c.object({browser_id:c.string(),height:c.number().int().positive(),width:c.number().int().positive()}),WL=c.object({});function HL(e){return new g(Ul,Zv,e)}var Bne={[Ll]:jo,[Ul]:qo};var Qv={id:"viewport",description:"Controls an explicit browser viewport override for responsive or device-size testing. Use it when a task calls for specific dimensions or breakpoint validation; otherwise leave it unset so the browser uses its normal 1280x720 viewport. Reset temporary overrides before finishing unless the user asked to keep them."};var Pa=class extends Ro{constructor({browserId:t,info:r,transport:n}){super(n,t,r)}async set(t){let r=await this.transport.send({command:qo.create({browser_id:this.browserId,...t})});qo.ResultSchema.parse(r)}async reset(){let t=await this.transport.send({command:jo.create({browser_id:this.browserId})});jo.ResultSchema.parse(t)}},Ff=Ol({capability:Pa,info:Qv});var VL=[Mf,Ff],GL=KL(VL),eE=({browserId:e,capabilities:t,transport:r})=>{let n={};for(let o of t??[]){let i=GL.get(o.id);i!=null&&(n[o.id]=i({browserId:e,info:o,transport:r}))}return new Po(n)};function KL(e){return new Map(e.map(t=>[t.id,t.create]))}var Da=class{#e;constructor({capabilities:t,transport:r,browserId:n}){this.#e=r,this.browserId=n,this.capabilities=eE({browserId:n,capabilities:t?.browser,transport:r});let o=i=>new Ia({browserId:n,capabilities:t?.tab,transport:r,tabPayload:i});this.tabs=new ba({browserId:n,createTab:o,transport:r}),this.user=new ya({browserId:n,createTab:o,transport:r})}async nameSession(t){let r=t.trim();if(!r)throw new Error("browser.nameSession requires a name");await this.#e.send({command:fs.create({browser_id:this.browserId,name:r})})}};var Na=class{#e;#t;constructor({browserInfos:t=[],transport:r}){this.#e=t,this.#t=r}async list(){return this.#e}async get(t){if(!t)throw new Error("browsers.get requires a browser id");let r=this.#e.find(n=>n.id===t||n.type===t);if(r==null)throw new Error(`Browser is not available: ${t}`);return await this.#t.display({selectedBrowser:r}),new Da({capabilities:r.capabilities,transport:this.#t,browserId:t})}};var Oa=class{constructor({browserInfos:t,transport:r}){if(!r)throw new Error("Agent requires a transport instance");this.browsers=new Na({browserInfos:t,transport:r})}};var Ma=class{constructor({executeAgentCommand:t,displaySideEffect:r}={}){if(typeof t!="function")throw new Error("FunctionAgentTransport requires an executeAgentCommand function");this.executeAgentCommand=t,this.displaySideEffect=r??ZL}async display(t){await this.displaySideEffect(t)}async send({command:t,timeoutMs:r}){let n=t.toJSON(),o=await this.executeAgentCommand({...n,client_timeout_ms:typeof r=="number"&&r>0?r:void 0}),i=await JL(o,this.displaySideEffect);if(i==null)throw new Error("transport send returned empty response");return i}},JL=async(e,t)=>{let r=YL.safeParse(e);if(!r.success)return e;for(let i of r.data.side_effects)await t(i);let{side_effects:n,...o}=r.data;return o},YL=c.object({side_effects:c.array(c.string())}).passthrough(),ZL=async e=>{let t=globalThis.display;if(typeof t=="function"){await t(e);return}console.log(e)};var lh={};T(lh,{BrowserUserClaimTabCommand:()=>kC,BrowserUserHistoryCommand:()=>AC,BrowserUserOpenTabsCommand:()=>IC,CloseTabCommand:()=>QC,CreateTabCommand:()=>eT,CuaClickCommand:()=>uE,CuaDoubleClickCommand:()=>lE,CuaDragCommand:()=>cE,CuaKeypressCommand:()=>_E,CuaMoveCommand:()=>wE,CuaScrollCommand:()=>xE,CuaTypeCommand:()=>eh,DomCuaClickCommand:()=>DC,DomCuaDoubleClickCommand:()=>NC,DomCuaGetVisibleDomCommand:()=>GC,DomCuaKeypressCommand:()=>ZC,DomCuaScrollCommand:()=>XC,DomCuaTypeCommand:()=>oh,FinalizeTabsCommand:()=>tT,ListTabsCommand:()=>rT,NameSessionCommand:()=>nT,NavigateTabBackCommand:()=>oT,NavigateTabForwardCommand:()=>iT,NavigateTabReloadCommand:()=>sT,NavigateTabUrlCommand:()=>cT,PlaywrightDomSnapshotCommand:()=>pT,PlaywrightDownloadPathCommand:()=>hT,PlaywrightEvaluateCommand:()=>u1,PlaywrightFileChooserSetFilesCommand:()=>gT,PlaywrightLocatorAllTextContentsCommand:()=>CT,PlaywrightLocatorClickCommand:()=>bT,PlaywrightLocatorCountCommand:()=>yT,PlaywrightLocatorDblclickCommand:()=>_T,PlaywrightLocatorDownloadMediaCommand:()=>wT,PlaywrightLocatorFillCommand:()=>mc,PlaywrightLocatorGetAttributeCommand:()=>xT,PlaywrightLocatorInnerTextCommand:()=>ST,PlaywrightLocatorIsEnabledCommand:()=>vT,PlaywrightLocatorIsVisibleCommand:()=>ET,PlaywrightLocatorPressCommand:()=>TT,PlaywrightLocatorReadAllCommand:()=>RT,PlaywrightLocatorSelectOptionCommand:()=>kT,PlaywrightLocatorSetCheckedCommand:()=>AT,PlaywrightLocatorTextContentCommand:()=>IT,PlaywrightLocatorWaitForCommand:()=>PT,PlaywrightWaitForDownloadCommand:()=>DT,PlaywrightWaitForFileChooserCommand:()=>NT,PlaywrightWaitForLoadStateCommand:()=>FT,PlaywrightWaitForTimeoutCommand:()=>BT,PlaywrightWaitForURLCommand:()=>jT,SelectedTabCommand:()=>qT,TabCdpCallCommand:()=>ZT,TabCdpEventsCommand:()=>XT,TabClipboardReadCommand:()=>zT,TabClipboardReadTextCommand:()=>HT,TabClipboardWriteCommand:()=>TC,TabClipboardWriteTextCommand:()=>VT,TabContentExportGSuiteCommand:()=>t1,TabDevLogsCommand:()=>r1,TabPageAssetsBundleCommand:()=>c1,TabPageAssetsListCommand:()=>d1,TabScreenshotCommand:()=>i1,WebMcpInvokeToolCommand:()=>RC,WebMcpListToolsCommand:()=>PC});import{AsyncLocalStorage as XL}from"node:async_hooks";var tE={end(){}},Uf=new XL,QL={cua_click:{action:"click",name:"browser_use.tab.click"},cua_double_click:{action:"dblclick",name:"browser_use.tab.click"},cua_type:{action:"type",name:"browser_use.tab.type"},navigate_tab_url:{attrs:e=>({"url.origin":e6(Bf(e,"url"))}),name:"browser_use.tab.goto"},playwright_dom_snapshot:{attrs:()=>({"browser_use.playwright.snapshot.mode":"ai","browser_use.playwright.snapshot.target":"body_or_document"}),name:"browser_use.playwright.dom_snapshot",operation:"dom_snapshot",resultAttrs:e=>{let t=Bf(e,"dom_snapshot")??"";return{"browser_use.playwright.snapshot.length":t.length,"browser_use.playwright.snapshot.line_count":n6(t)}}},playwright_locator_click:{action:"click",name:"browser_use.tab.click"},playwright_locator_dblclick:{action:"dblclick",name:"browser_use.tab.click"},playwright_locator_fill:{action:"fill",name:"browser_use.tab.type"},playwright_locator_press:{action:"press",name:"browser_use.tab.type"},playwright_locator_set_checked:{action:"set_checked",name:"browser_use.tab.click"},tab_screenshot:{name:"browser_use.tab.screenshot"},playwright_wait_for_load_state:{attrs:e=>({"load.state":Bf(e,"state")??"load"}),name:"browser_use.tab.wait_for_load_state"}};async function jf(e,t,r,n={}){let o=Lf(t),i=sE();if(i?.withSpan)return await i.withSpan(e,o,r,n);let s=o6(e,o);try{let a=await r();return rE(s,{attrs:Lf(n.resultAttrs?.(a)??{}),status:"ok"}),a}catch(a){throw rE(s,{attrs:{"error.kind":i6(a)},status:"error"}),a}}async function jl(e,t,r){let n=QL[e],o={commandType:e,playwrightOperation:n?.operation??e};return await Uf.run(o,async()=>n==null?await r():await jf(n.name,{"browser.action":n.action,"browser_use.command.type":e,"browser_use.playwright.operation":n.operation,...t6(t),...r6(t),...n.attrs?.(t)},r,{resultAttrs:n.resultAttrs}))}function nE(){let e=Uf.getStore();return e==null?{}:{"browser_use.command.type":e.commandType}}function on(e){return Uf.getStore()?.playwrightOperation??e}function e6(e){if(e!=null)try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t.origin:t.protocol.replace(/:$/,"")}catch{return}}function t6(e){let t=oE(e,"tab_id");return{"browser_use.tab.id":t,"tab.id":t}}function r6(e){return{timeout_ms:oE(e,"timeout_ms")}}function oE(e,t){if(!iE(e))return;let r=e[t],n=typeof r=="string"?Number(r):r;return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Bf(e,t){if(!iE(e))return;let r=e[t];return typeof r=="string"?r:void 0}function iE(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function n6(e){return e===""?0:e.split(`
`).length}function sE(){return globalThis.nodeRepl?.telemetry}function o6(e,t){try{return sE()?.startSpan(e,Lf(t))??tE}catch{return tE}}function rE(e,t){try{e.end(t)}catch{}}function Lf(e){return Object.fromEntries(Object.entries(e).filter(t=>{let r=t[1];return typeof r=="boolean"||typeof r=="number"||typeof r=="string"}))}function i6(e){return e instanceof Error&&e.name?e.name:typeof e}function _(e,t){let r=typeof e=="string"?e:e.commandType,n=(async(o,i)=>await jl(r,o,async()=>t(o,i)));return n.type=r,n}import{platform as s6}from"node:os";function qf(e){return e==="ControlOrMeta"?$f()?"Meta":"Control":e}function sn(e){if(!e)return 0;let t=0;for(let r of e)switch(qf(r)){case"Alt":t|=1;break;case"Control":t|=2;break;case"Meta":t|=4;break;case"Shift":t|=8;break}return t}function $f(){return s6()==="darwin"}function bt(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error(`${e} requires finite x and y coordinates`)}function yt(e){return sn(e)}function aE(e){switch(e){case void 0:case 1:return"left";case 2:return"middle";case 3:return"right";default:throw new Error(`Unsupported CUA mouse button: ${e}`)}}function k(e){let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new Error("Expected a positive integer");return t}function se(e){let t=typeof e.timeout_ms=="number"?e.timeout_ms:3e3;return Math.min(Math.max(0,t),e.max||3e3)}var uE=_("cua_click",async(e,t)=>{let r=k(e.tab_id);return bt("cua_click",e),await t.cua.clickPoint({button:aE(e.button),clickCount:1,modifiers:yt(e.keys),point:{x:e.x,y:e.y},tabId:r,timeoutMs:1e4}),{}});var lE=_("cua_double_click",async(e,t)=>{let r=k(e.tab_id);return bt("cua_double_click",e),await t.cua.clickPoint({clickCount:2,modifiers:yt(e.keys),point:{x:e.x,y:e.y},tabId:r,timeoutMs:1e4}),{}});var cE=_("cua_drag",async(e,t)=>{let r=k(e.tab_id),n=yt(e.keys);if(e.path.length===0)throw new Error("cua_drag requires a non-empty path");for(let o of e.path)bt("cua_drag",o);return await t.cua.dragPath({modifiers:n,path:e.path,tabId:r}),{}});var a6="__codexIabExpectedInputTargetToken";var dE=0;function ql(e){if(e===!0)return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():(dE+=1,`iab-input-${Date.now()}-${dE}-${Math.random().toString(36).slice(2)}`)}function zf(e,t){return t==null?e:{...e,[a6]:t}}async function Wl(e,t,r,n={}){let o=new Wf(e,u6(t),n.iabInputTargetToken),i=Array.isArray(r)?r.flatMap(zl):zl(r),s=fE(i),a=s[s.length-1];if(!a)throw new Error("keypress requires at least one key");if(pE(s)!=null)throw new Error("Native clipboard shortcuts are disabled; use Browser Use virtual clipboard commands instead.");for(let u of s.slice(0,-1))await o.down(u);await o.down(a),await o.up(a);for(let u of s.slice(0,-1).reverse())await o.up(u)}function $o(e){let t=Array.isArray(e)?e.flatMap(zl):zl(e);return pE(fE(t))}var Wf=class{constructor(t,r,n){this.cdp=t;this.target=r;this.iabInputTargetToken=n}cdp;target;iabInputTargetToken;pressedModifiers=new Set;async down(t){let r=$l(t,this.pressedModifiers),n=Hf(r.key);n&&this.pressedModifiers.add(n);let o=this.keyText(r),i=d6(r.code,this.pressedModifiers);await this.callInputDispatch(zf({type:o?"keyDown":"rawKeyDown",modifiers:sn(this.pressedModifiers),windowsVirtualKeyCode:r.keyCodeWithoutLocation,code:r.code,...i.length>0?{commands:i}:{},key:r.key,text:o,unmodifiedText:o,location:r.location,isKeypad:r.location===mE},this.iabInputTargetToken))}async up(t){let r=$l(t,this.pressedModifiers),n=Hf(r.key);n&&this.pressedModifiers.delete(n),await this.callInputDispatch(zf({type:"keyUp",modifiers:sn(this.pressedModifiers),windowsVirtualKeyCode:r.keyCodeWithoutLocation,code:r.code,key:r.key,location:r.location},this.iabInputTargetToken))}keyText(t){return this.pressedModifiers.size===0||this.pressedModifiers.size===1&&this.pressedModifiers.has("Shift")?t.text:""}async callInputDispatch(t){if(this.target.sessionId==null&&this.target.targetId==null){await this.cdp.call(this.target.tabId,"Input.dispatchKeyEvent",t);return}await this.cdp.callTarget(this.target,"Input.dispatchKeyEvent",t)}};function u6(e){return typeof e=="object"?e:{tabId:e}}function pE(e){let t=new Set;for(let o of e.slice(0,-1)){let i=$l(o,t),s=Hf(i.key);s&&t.add(s)}let r=e[e.length-1];if(r==null)return null;let n=$l(r,t);return f6(n.code,t)?"paste":p6(n.code,t)?"blocked":null}function $l(e,t){let r=qf(e),n=hE.get(r);if(!n)throw new Error(`Unknown key: "${e}"`);return t.has("Shift")&&n.shifted?n.shifted:n}function zl(e){let t=[],r="";for(let n of e)n==="+"&&r?(t.push(r),r=""):r+=n;return r&&t.push(r),t}function fE(e){let t=y6.get(c6(e));return t||e.map(l6)}function l6(e){return hE.has(e)?e:b6.get(e.toLowerCase())??e}function c6(e){return e.map(t=>t.toLowerCase()).join("+")}function Hf(e){switch(e){case"Alt":case"Control":case"Meta":case"Shift":return e;default:return}}function d6(e,t){if(!$f())return[];let n=[...m6.filter(i=>t.has(i)),e].join("+"),o=g6.get(n);return o?[o]:[]}function p6(e,t){return(t.has("Meta")||t.has("Control"))&&h6.has(e)||e==="Insert"&&(t.has("Control")||t.has("Shift"))}function f6(e,t){let r=(t.has("Meta")||t.has("Control"))&&!(t.has("Meta")&&t.has("Control"));return e==="KeyV"&&r&&t.size===1}var mE=3,m6=["Shift","Control","Alt","Meta"],h6=new Set(["KeyC","KeyV","KeyX"]),g6=new Map([["Backspace","deleteBackward"],["Delete","deleteForward"],["Meta+KeyA","selectAll"],["Meta+KeyZ","undo"],["Shift+Meta+KeyZ","redo"]]),b6=new Map([["alt","Alt"],["option","Alt"],["control","Control"],["controlormeta","ControlOrMeta"],["ctrl","ControlOrMeta"],["cmd","Meta"],["win","Meta"],["super","Meta"],["shift","Shift"],["capslock","CapsLock"],["esc","Escape"],["escape","Escape"],["enter","Enter"],["return","Enter"],["backspace","Backspace"],["delete","Delete"],["del","Delete"],["tab","Tab"],["space","Space"],["left","ArrowLeft"],["arrowleft","ArrowLeft"],["right","ArrowRight"],["arrowright","ArrowRight"],["up","ArrowUp"],["arrowup","ArrowUp"],["down","ArrowDown"],["arrowdown","ArrowDown"],["home","Home"],["end","End"],["insert","Insert"],["pageup","PageUp"],["pagedown","PageDown"]]),y6=new Map([["ctrl+a",["ControlOrMeta","a"]],["ctrl+c",["ControlOrMeta","c"]],["ctrl+l",["ControlOrMeta","l"]],["ctrl+n",["ControlOrMeta","n"]],["ctrl+shift+v",["ControlOrMeta","Shift","v"]],["ctrl+v",["ControlOrMeta","v"]],["ctrl+x",["ControlOrMeta","x"]],["ctrl+y",["ControlOrMeta","Shift","z"]],["ctrl+z",["ControlOrMeta","z"]]]),_6=new Map([["AltLeft",["Alt"]],["ControlLeft",["Control"]],["Enter",[`
`,"\r"]],["MetaLeft",["Meta"]],["ShiftLeft",["Shift"]]]),hE=w6({Escape:{keyCode:27,key:"Escape"},F1:{keyCode:112,key:"F1"},F2:{keyCode:113,key:"F2"},F3:{keyCode:114,key:"F3"},F4:{keyCode:115,key:"F4"},F5:{keyCode:116,key:"F5"},F6:{keyCode:117,key:"F6"},F7:{keyCode:118,key:"F7"},F8:{keyCode:119,key:"F8"},F9:{keyCode:120,key:"F9"},F10:{keyCode:121,key:"F10"},F11:{keyCode:122,key:"F11"},F12:{keyCode:123,key:"F12"},Backquote:{keyCode:192,shiftKey:"~",key:"`"},Digit1:{keyCode:49,shiftKey:"!",key:"1"},Digit2:{keyCode:50,shiftKey:"@",key:"2"},Digit3:{keyCode:51,shiftKey:"#",key:"3"},Digit4:{keyCode:52,shiftKey:"$",key:"4"},Digit5:{keyCode:53,shiftKey:"%",key:"5"},Digit6:{keyCode:54,shiftKey:"^",key:"6"},Digit7:{keyCode:55,shiftKey:"&",key:"7"},Digit8:{keyCode:56,shiftKey:"*",key:"8"},Digit9:{keyCode:57,shiftKey:"(",key:"9"},Digit0:{keyCode:48,shiftKey:")",key:"0"},Minus:{keyCode:189,shiftKey:"_",key:"-"},Equal:{keyCode:187,shiftKey:"+",key:"="},Backslash:{keyCode:220,shiftKey:"|",key:"\\"},Backspace:{keyCode:8,key:"Backspace"},Tab:{keyCode:9,key:"Tab"},KeyQ:{keyCode:81,shiftKey:"Q",key:"q"},KeyW:{keyCode:87,shiftKey:"W",key:"w"},KeyE:{keyCode:69,shiftKey:"E",key:"e"},KeyR:{keyCode:82,shiftKey:"R",key:"r"},KeyT:{keyCode:84,shiftKey:"T",key:"t"},KeyY:{keyCode:89,shiftKey:"Y",key:"y"},KeyU:{keyCode:85,shiftKey:"U",key:"u"},KeyI:{keyCode:73,shiftKey:"I",key:"i"},KeyO:{keyCode:79,shiftKey:"O",key:"o"},KeyP:{keyCode:80,shiftKey:"P",key:"p"},BracketLeft:{keyCode:219,shiftKey:"{",key:"["},BracketRight:{keyCode:221,shiftKey:"}",key:"]"},CapsLock:{keyCode:20,key:"CapsLock"},KeyA:{keyCode:65,shiftKey:"A",key:"a"},KeyS:{keyCode:83,shiftKey:"S",key:"s"},KeyD:{keyCode:68,shiftKey:"D",key:"d"},KeyF:{keyCode:70,shiftKey:"F",key:"f"},KeyG:{keyCode:71,shiftKey:"G",key:"g"},KeyH:{keyCode:72,shiftKey:"H",key:"h"},KeyJ:{keyCode:74,shiftKey:"J",key:"j"},KeyK:{keyCode:75,shiftKey:"K",key:"k"},KeyL:{keyCode:76,shiftKey:"L",key:"l"},Semicolon:{keyCode:186,shiftKey:":",key:";"},Quote:{keyCode:222,shiftKey:'"',key:"'"},Enter:{keyCode:13,key:"Enter",text:"\r"},ShiftLeft:{keyCode:160,keyCodeWithoutLocation:16,key:"Shift",location:1},KeyZ:{keyCode:90,shiftKey:"Z",key:"z"},KeyX:{keyCode:88,shiftKey:"X",key:"x"},KeyC:{keyCode:67,shiftKey:"C",key:"c"},KeyV:{keyCode:86,shiftKey:"V",key:"v"},KeyB:{keyCode:66,shiftKey:"B",key:"b"},KeyN:{keyCode:78,shiftKey:"N",key:"n"},KeyM:{keyCode:77,shiftKey:"M",key:"m"},Comma:{keyCode:188,shiftKey:"<",key:","},Period:{keyCode:190,shiftKey:">",key:"."},Slash:{keyCode:191,shiftKey:"?",key:"/"},ShiftRight:{keyCode:161,keyCodeWithoutLocation:16,key:"Shift",location:2},ControlLeft:{keyCode:162,keyCodeWithoutLocation:17,key:"Control",location:1},MetaLeft:{keyCode:91,key:"Meta",location:1},AltLeft:{keyCode:164,keyCodeWithoutLocation:18,key:"Alt",location:1},Space:{keyCode:32,key:" "},AltRight:{keyCode:165,keyCodeWithoutLocation:18,key:"Alt",location:2},AltGraph:{keyCode:225,key:"AltGraph"},MetaRight:{keyCode:92,key:"Meta",location:2},ContextMenu:{keyCode:93,key:"ContextMenu"},ControlRight:{keyCode:163,keyCodeWithoutLocation:17,key:"Control",location:2},PageUp:{keyCode:33,key:"PageUp"},PageDown:{keyCode:34,key:"PageDown"},Insert:{keyCode:45,key:"Insert"},Delete:{keyCode:46,key:"Delete"},Home:{keyCode:36,key:"Home"},End:{keyCode:35,key:"End"},ArrowLeft:{keyCode:37,key:"ArrowLeft"},ArrowUp:{keyCode:38,key:"ArrowUp"},ArrowRight:{keyCode:39,key:"ArrowRight"},ArrowDown:{keyCode:40,key:"ArrowDown"},NumpadEnter:{keyCode:13,key:"Enter",text:"\r",location:mE}});function w6(e){let t=new Map;for(let[r,n]of Object.entries(e)){let o={key:n.key,keyCode:n.keyCode,keyCodeWithoutLocation:n.keyCodeWithoutLocation??n.keyCode,code:r,text:n.text??"",location:n.location??0};n.key.length===1&&(o.text=n.key);let i;n.shiftKey&&(i={...o,key:n.shiftKey,keyCode:n.shiftKeyCode??o.keyCode,text:n.shiftKey},o.shifted=i),t.set(r,o);for(let s of _6.get(r)??[])t.set(s,o);n.location||(o.key.length===1&&t.set(o.key,o),i&&t.set(i.key,{...i,shifted:void 0}))}return t}var Vf=new WeakMap,gE=new WeakSet,Gf="const __name = (target) => target;",x6=()=>{let e=globalThis,t=Object.prototype.hasOwnProperty.call(navigator,"clipboard"),r=Object.getOwnPropertyDescriptor(navigator,"clipboard"),n=e.__browserUseFakeClipboard??={installed:!1,items:[]};if(n.installed)return;let o=f=>{let m=new Uint8Array(f),h=32768,y="";for(let S=0;S<m.length;S+=h){let D=m.subarray(S,S+h);y+=String.fromCharCode(...D)}return btoa(y)},i=f=>{let m=atob(f),h=new Uint8Array(m.length);for(let y=0;y<m.length;y+=1)h[y]=m.charCodeAt(y);return h.buffer},s=f=>typeof f.text=="string"?new Blob([f.text],{type:f.mime_type}):new Blob([i(f.base64??"")],{type:f.mime_type}),a=f=>({types:f.entries.map(h=>h.mime_type),presentationStyle:f.presentation_style??"unspecified",getType:async h=>{let y=f.entries.find(S=>S.mime_type===h);if(y==null)throw new DOMException(`No fake clipboard entry for ${h}`,"NotFoundError");return s(y)}}),u=async f=>Promise.all(f.map(async m=>({entries:await Promise.all(m.types.map(async y=>{let S=await m.getType(y);return y.startsWith("text/")?{mime_type:y,text:await S.text()}:{mime_type:y,base64:o(await S.arrayBuffer())}})),presentation_style:m.presentationStyle??"unspecified"}))),l=()=>n.items.flatMap(f=>f.entries).find(f=>f.mime_type==="text/plain")?.text??"",d={read:async()=>n.items.map(a),readText:async()=>l(),write:async f=>{n.items=await u(Array.from(f))},writeText:async f=>{n.items=[{entries:[{mime_type:"text/plain",text:f}],presentation_style:"unspecified"}]},addEventListener:()=>{},dispatchEvent:()=>!0,removeEventListener:()=>{}};Object.defineProperty(d,"__browserUseFakeClipboard",{value:!0});let p={configurable:!0,get:()=>d};Object.defineProperty(navigator,"clipboard",p),e.__browserUseFakeClipboardCleanup=()=>{Object.getOwnPropertyDescriptor(navigator,"clipboard")?.get===p.get&&(t&&r!=null?Object.defineProperty(navigator,"clipboard",r):Reflect.deleteProperty(navigator,"clipboard")),n.items=[],n.installed=!1,delete e.__browserUseFakeClipboard,delete e.__browserUseFakeClipboardCleanup},n.installed=!0},S6=()=>{globalThis.__browserUseFakeClipboardCleanup?.()},Hl=async(e={})=>{let t=w=>{if(w==null||typeof w!="object"||!("ownerDocument"in w))return null;let E=w.ownerDocument?.defaultView??null;return E==null?null:w instanceof E.Element?w:null},r=w=>w.ownerDocument.defaultView??window,n=w=>{let x=w.activeElement;if(x==null)return null;let E=r(x);if(x instanceof E.HTMLElement&&x.shadowRoot!=null)return n(x.shadowRoot)??x;if(x instanceof E.HTMLIFrameElement||x instanceof E.HTMLFrameElement)try{let I=x.contentDocument??x.contentWindow?.document??null;if(I!=null)return n(I)??x}catch{return x}return x},o=(w,x)=>{if(x==null)return;let E=t(w);if((E??null)?.__codexIabInputTargetToken!==x)throw new Error("Active element is no longer the expected input target")},i=async(w,x)=>{for(let E of w)if(E.types.includes(x))return await(await E.getType(x)).text();return""},s=async(w,x,E)=>{w.clearData();for(let I of x)for(let C of I.types){let j=await I.getType(C);if(C.startsWith("text/")){w.setData(C,await j.text());continue}let X=C.split("/")[1]??"bin";w.items.add(new E.File([j],`clipboard.${X}`,{type:C}))}},a=(w,x,E,I)=>{let C=t(w);if(C==null)return;let j=r(C);if(C instanceof j.HTMLTextAreaElement||C instanceof j.HTMLInputElement){if(E.length===0)return;let X=ae=>{let ye=Object.getPrototypeOf(C),me=Object.getOwnPropertyDescriptor(ye,"value")?.set,M=Object.getOwnPropertyDescriptor(C,"value")?.set;if(me!=null&&M!==me){me.call(C,ae);return}C.value=ae};if(C.selectionStart==null||C.selectionEnd==null)X(I?E:C.value+E);else{let ae=C.selectionStart??C.value.length,ye=C.selectionEnd??C.value.length;try{C.setRangeText(E,ae,ye,"end")}catch{X(I?E:C.value+E)}}C.dispatchEvent(new j.InputEvent("input",{bubbles:!0}));return}if(C instanceof j.HTMLElement&&(C.isContentEditable||C.closest("[contenteditable=true]"))){if(C.focus(),x.length>0){C.ownerDocument.execCommand("insertHTML",!1,x);return}E.length>0&&C.ownerDocument.execCommand("insertText",!1,E)}};if(navigator.clipboard?.read==null)throw new Error("navigator.clipboard.read is not available");let u=await navigator.clipboard.read();if(u.length===0)throw new Error("Browser Use virtual clipboard has no data to paste");let l=n(document)??document.body;o(l,e.iabInputTargetToken);let d=t(l),p=d==null?window:r(d),f=await i(u,"text/html"),m=await i(u,"text/plain"),h=p.navigator.clipboard;if(h?.__browserUseFakeClipboard===!0&&h!==navigator.clipboard&&await h.write(u),typeof p.DataTransfer!="function"||typeof p.ClipboardEvent!="function"){a(l,f,m,e.replaceInputValue===!0);return}let y=new p.DataTransfer;await s(y,u,p);let S=new p.ClipboardEvent("paste",{bubbles:!0,cancelable:!0,clipboardData:y,composed:!0});l.dispatchEvent(S)&&!S.defaultPrevented&&a(l,f,m,e.replaceInputValue===!0)},bE=()=>{let e=globalThis,t=navigator.clipboard;if(e.__browserUseFakeClipboard?.installed!==!0||t?.__browserUseFakeClipboard!==!0)throw new Error("Browser Use virtual clipboard is not installed")};function v6(){return`(() => {
${Gf}
const installFakeClipboard = ${x6.toString()};
installFakeClipboard();
const assertFakeClipboardInstalled = ${bE.toString()};
assertFakeClipboardInstalled();
})()`}function E6(){return`(() => {
${Gf}
const cleanupFakeClipboard = ${S6.toString()};
cleanupFakeClipboard();
})()`}function C6(e){gE.has(e)||(gE.add(e),e.cdp.addTabCleanupHandler(async t=>{await k6(e,t)}))}async function T6(e,t){C6(e);let r=Vf.get(e);r==null&&(r=new Map,Vf.set(e,r));let n=A6(t),o=r.get(n);o==null&&(o=(async()=>{let i=v6(),s;try{s=(await zo(e,t,"Page.addScriptToEvaluateOnNewDocument",{runImmediately:!0,source:i})).identifier;let u=await zo(e,t,"Runtime.evaluate",{expression:i,returnByValue:!0}),l=yE(u,"Browser Use virtual clipboard install failed");if(l!=null)throw new Error(`Browser Use virtual clipboard install failed: ${l}`);return s==null?{target:t}:{identifier:s,target:t}}catch(a){throw s!=null&&await zo(e,t,"Page.removeScriptToEvaluateOnNewDocument",{identifier:s}).catch(()=>{}),a}})().catch(i=>{throw r.delete(n),i}),r.set(n,o)),await o}async function k6(e,t){let r=Vf.get(e);if(r==null)return;let n=Array.from(r.entries()).filter(([o])=>I6(o,t));for(let[o,i]of n){r.delete(o);let s=await i.catch(()=>{});s!=null&&(await zo(e,s.target,"Runtime.evaluate",{expression:E6(),returnByValue:!0}).catch(()=>{}),s.identifier!=null&&await zo(e,s.target,"Page.removeScriptToEvaluateOnNewDocument",{identifier:s.identifier}).catch(()=>{}))}}function A6(e){return e.sessionId!=null?`${e.tabId}:session:${e.sessionId}`:e.targetId!=null?`${e.tabId}:target:${e.targetId}`:`${e.tabId}:`}function I6(e,t){return e===`${t}:`||e.startsWith(`${t}:`)}async function zo(e,t,r,n){return t.sessionId==null&&t.targetId==null?await e.cdp.call(t.tabId,r,n):await e.cdp.callTarget(t,r,n)}function yE(e,t){return e.exceptionDetails==null?null:String(e.exceptionDetails.exception?.description??e.exceptionDetails.exception?.value??e.exceptionDetails.text??t)}function Vl(e,t){if(!Array.isArray(e)||e.length===0)throw new Error(`${t} requires items`);for(let r of e){if(!Array.isArray(r.entries)||r.entries.length===0)throw new Error(`${t} requires clipboard item entries`);for(let n of r.entries){if(typeof n.mime_type!="string"||n.mime_type.length===0)throw new Error(`${t} requires entry mime_type`);let o=typeof n.text=="string",i=typeof n.base64=="string";if(o===i)throw new Error(`${t} requires exactly one of entry text or base64`)}}}async function Ie({args:e,commandType:t,ctx:r,pageFunction:n,tabId:o,target:i}){let s=i??{tabId:o};await T6(r,s);let a=await zo(r,s,"Runtime.evaluate",{expression:`(
async () => {
try {
${Gf}
const assertFakeClipboardInstalled = ${bE.toString()};
assertFakeClipboardInstalled();
const pageFunction = ${n.toString()};
const data = await pageFunction(${JSON.stringify(e)});
return { ok: true, data };
} catch (error) {
return {
ok: false,
error:
error instanceof Error
? error.message
: String(error),
};
}
}
)()`,awaitPromise:!0,returnByValue:!0}),u=yE(a,`${t} failed`);if(u!=null)throw new Error(`Browser Use encountered an error interacting with this webpage's clipboard: ${u}`);if(a.result?.value?.ok!==!0){let l=a.result?.value?.error??`${t} failed`;throw new Error(`Browser Use encountered an error interacting with this webpage's clipboard: ${l}`)}return a.result.value.data}async function Wo({commandType:e,ctx:t,iabInputTargetToken:r,tabId:n,target:o}){await Ie({args:r==null?{}:{iabInputTargetToken:r},commandType:e,ctx:t,pageFunction:Hl,tabId:k(n),...o!=null?{target:o}:{}})}var _E=_("cua_keypress",async(e,t)=>(Array.isArray(e.keys)?$o(e.keys):null)==="paste"?(await Wo({commandType:"cua_keypress",ctx:t,tabId:e.tab_id}),{}):(await t.cua.dispatchKeyPress({commandName:"cua_keypress",keys:e.keys,tabId:e.tab_id}),{}));var wE=_("cua_move",async(e,t)=>{let r=k(e.tab_id);return bt("cua_move",e),await t.cua.dispatchMouseMove(r,{x:e.x,y:e.y},yt(e.keys)),{}});var xE=_("cua_scroll",async(e,t)=>{let r=k(e.tab_id);bt("cua_scroll",e);let n=yt(e.keys),o={x:e.x,y:e.y};return await t.cua.scrollPoint({modifiers:n,point:o,scrollX:e.scroll_x,scrollY:e.scroll_y,tabId:r}),{}});var rm={};T(rm,{arrayReplaceAt:()=>tm,assign:()=>Go,escapeHtml:()=>Lt,escapeRE:()=>p4,fromCodePoint:()=>La,has:()=>t4,isMdAsciiPunct:()=>ln,isPunctChar:()=>un,isSpace:()=>K,isString:()=>oc,isValidEntityCode:()=>ic,isWhiteSpace:()=>an,lib:()=>f4,normalizeReference:()=>cn,unescapeAll:()=>Bt,unescapeMd:()=>s4});var Zl={};T(Zl,{decode:()=>Fa,encode:()=>Jl,format:()=>Ho,parse:()=>Ba});var SE={};function R6(e){let t=SE[e];if(t)return t;t=SE[e]=[];for(let r=0;r<128;r++){let n=String.fromCharCode(r);t.push(n)}for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t[n]="%"+("0"+n.toString(16).toUpperCase()).slice(-2)}return t}function Gl(e,t){typeof t!="string"&&(t=Gl.defaultChars);let r=R6(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(n){let o="";for(let i=0,s=n.length;i<s;i+=3){let a=parseInt(n.slice(i+1,i+3),16);if(a<128){o+=r[a];continue}if((a&224)===192&&i+3<s){let u=parseInt(n.slice(i+4,i+6),16);if((u&192)===128){let l=a<<6&1984|u&63;l<128?o+="\uFFFD\uFFFD":o+=String.fromCharCode(l),i+=3;continue}}if((a&240)===224&&i+6<s){let u=parseInt(n.slice(i+4,i+6),16),l=parseInt(n.slice(i+7,i+9),16);if((u&192)===128&&(l&192)===128){let d=a<<12&61440|u<<6&4032|l&63;d<2048||d>=55296&&d<=57343?o+="\uFFFD\uFFFD\uFFFD":o+=String.fromCharCode(d),i+=6;continue}}if((a&248)===240&&i+9<s){let u=parseInt(n.slice(i+4,i+6),16),l=parseInt(n.slice(i+7,i+9),16),d=parseInt(n.slice(i+10,i+12),16);if((u&192)===128&&(l&192)===128&&(d&192)===128){let p=a<<18&1835008|u<<12&258048|l<<6&4032|d&63;p<65536||p>1114111?o+="\uFFFD\uFFFD\uFFFD\uFFFD":(p-=65536,o+=String.fromCharCode(55296+(p>>10),56320+(p&1023))),i+=9;continue}}o+="\uFFFD"}return o})}Gl.defaultChars=";/?:@&=+$,#";Gl.componentChars="";var Fa=Gl;var vE={};function P6(e){let t=vE[e];if(t)return t;t=vE[e]=[];for(let r=0;r<128;r++){let n=String.fromCharCode(r);/^[0-9a-z]$/i.test(n)?t.push(n):t.push("%"+("0"+r.toString(16).toUpperCase()).slice(-2))}for(let r=0;r<e.length;r++)t[e.charCodeAt(r)]=e[r];return t}function Kl(e,t,r){typeof t!="string"&&(r=t,t=Kl.defaultChars),typeof r>"u"&&(r=!0);let n=P6(t),o="";for(let i=0,s=e.length;i<s;i++){let a=e.charCodeAt(i);if(r&&a===37&&i+2<s&&/^[0-9a-f]{2}$/i.test(e.slice(i+1,i+3))){o+=e.slice(i,i+3),i+=2;continue}if(a<128){o+=n[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&i+1<s){let u=e.charCodeAt(i+1);if(u>=56320&&u<=57343){o+=encodeURIComponent(e[i]+e[i+1]),i++;continue}}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[i])}return o}Kl.defaultChars=";/?:@&=+$,-_.!~*'()#";Kl.componentChars="-_.!~*'()";var Jl=Kl;function Ho(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function Yl(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var D6=/^([a-z0-9.+-]+:)/i,N6=/:[0-9]*$/,O6=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,M6=["<",">",'"',"`"," ","\r",`
`," "],F6=["{","}","|","\\","^","`"].concat(M6),B6=["'"].concat(F6),EE=["%","/","?",";","#"].concat(B6),CE=["/","?","#"],L6=255,TE=/^[+a-z0-9A-Z_-]{0,63}$/,U6=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kE={javascript:!0,"javascript:":!0},AE={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function j6(e,t){if(e&&e instanceof Yl)return e;let r=new Yl;return r.parse(e,t),r}Yl.prototype.parse=function(e,t){let r,n,o,i=e;if(i=i.trim(),!t&&e.split("#").length===1){let l=O6.exec(i);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let s=D6.exec(i);if(s&&(s=s[0],r=s.toLowerCase(),this.protocol=s,i=i.substr(s.length)),(t||s||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=i.substr(0,2)==="//",o&&!(s&&kE[s])&&(i=i.substr(2),this.slashes=!0)),!kE[s]&&(o||s&&!AE[s])){let l=-1;for(let h=0;h<CE.length;h++)n=i.indexOf(CE[h]),n!==-1&&(l===-1||n<l)&&(l=n);let d,p;l===-1?p=i.lastIndexOf("@"):p=i.lastIndexOf("@",l),p!==-1&&(d=i.slice(0,p),i=i.slice(p+1),this.auth=d),l=-1;for(let h=0;h<EE.length;h++)n=i.indexOf(EE[h]),n!==-1&&(l===-1||n<l)&&(l=n);l===-1&&(l=i.length),i[l-1]===":"&&l--;let f=i.slice(0,l);i=i.slice(l),this.parseHost(f),this.hostname=this.hostname||"";let m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m){let h=this.hostname.split(/\./);for(let y=0,S=h.length;y<S;y++){let D=h[y];if(D&&!D.match(TE)){let w="";for(let x=0,E=D.length;x<E;x++)D.charCodeAt(x)>127?w+="x":w+=D[x];if(!w.match(TE)){let x=h.slice(0,y),E=h.slice(y+1),I=D.match(U6);I&&(x.push(I[1]),E.unshift(I[2])),E.length&&(i=E.join(".")+i),this.hostname=x.join(".");break}}}}this.hostname.length>L6&&(this.hostname=""),m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let a=i.indexOf("#");a!==-1&&(this.hash=i.substr(a),i=i.slice(0,a));let u=i.indexOf("?");return u!==-1&&(this.search=i.substr(u),i=i.slice(0,u)),i&&(this.pathname=i),AE[r]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Yl.prototype.parseHost=function(e){let t=N6.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var Ba=j6;var Kf={};T(Kf,{Any:()=>Xl,Cc:()=>Ql,Cf:()=>IE,P:()=>Vo,S:()=>ec,Z:()=>tc});var Xl=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;var Ql=/[\0-\x1F\x7F-\x9F]/;var IE=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;var Vo=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;var ec=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;var tc=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var RE=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(e=>e.charCodeAt(0)));var PE=new Uint16Array("\u0200aglq \x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(e=>e.charCodeAt(0)));var Jf,q6=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Yf=(Jf=String.fromCodePoint)!==null&&Jf!==void 0?Jf:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function Zf(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=q6.get(e))!==null&&t!==void 0?t:e}var de;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(de||(de={}));var $6=32,dr;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(dr||(dr={}));function Xf(e){return e>=de.ZERO&&e<=de.NINE}function z6(e){return e>=de.UPPER_A&&e<=de.UPPER_F||e>=de.LOWER_A&&e<=de.LOWER_F}function W6(e){return e>=de.UPPER_A&&e<=de.UPPER_Z||e>=de.LOWER_A&&e<=de.LOWER_Z||Xf(e)}function H6(e){return e===de.EQUALS||W6(e)}var ce;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(ce||(ce={}));var _t;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(_t||(_t={}));var rc=class{constructor(t,r,n){this.decodeTree=t,this.emitCodePoint=r,this.errors=n,this.state=ce.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=_t.Strict}startEntity(t){this.decodeMode=t,this.state=ce.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,r){switch(this.state){case ce.EntityStart:return t.charCodeAt(r)===de.NUM?(this.state=ce.NumericStart,this.consumed+=1,this.stateNumericStart(t,r+1)):(this.state=ce.NamedEntity,this.stateNamedEntity(t,r));case ce.NumericStart:return this.stateNumericStart(t,r);case ce.NumericDecimal:return this.stateNumericDecimal(t,r);case ce.NumericHex:return this.stateNumericHex(t,r);case ce.NamedEntity:return this.stateNamedEntity(t,r)}}stateNumericStart(t,r){return r>=t.length?-1:(t.charCodeAt(r)|$6)===de.LOWER_X?(this.state=ce.NumericHex,this.consumed+=1,this.stateNumericHex(t,r+1)):(this.state=ce.NumericDecimal,this.stateNumericDecimal(t,r))}addToNumericResult(t,r,n,o){if(r!==n){let i=n-r;this.result=this.result*Math.pow(o,i)+parseInt(t.substr(r,i),o),this.consumed+=i}}stateNumericHex(t,r){let n=r;for(;r<t.length;){let o=t.charCodeAt(r);if(Xf(o)||z6(o))r+=1;else return this.addToNumericResult(t,n,r,16),this.emitNumericEntity(o,3)}return this.addToNumericResult(t,n,r,16),-1}stateNumericDecimal(t,r){let n=r;for(;r<t.length;){let o=t.charCodeAt(r);if(Xf(o))r+=1;else return this.addToNumericResult(t,n,r,10),this.emitNumericEntity(o,2)}return this.addToNumericResult(t,n,r,10),-1}emitNumericEntity(t,r){var n;if(this.consumed<=r)return(n=this.errors)===null||n===void 0||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===de.SEMI)this.consumed+=1;else if(this.decodeMode===_t.Strict)return 0;return this.emitCodePoint(Zf(this.result),this.consumed),this.errors&&(t!==de.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,r){let{decodeTree:n}=this,o=n[this.treeIndex],i=(o&dr.VALUE_LENGTH)>>14;for(;r<t.length;r++,this.excess++){let s=t.charCodeAt(r);if(this.treeIndex=V6(n,o,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return this.result===0||this.decodeMode===_t.Attribute&&(i===0||H6(s))?0:this.emitNotTerminatedNamedEntity();if(o=n[this.treeIndex],i=(o&dr.VALUE_LENGTH)>>14,i!==0){if(s===de.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==_t.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;let{result:r,decodeTree:n}=this,o=(n[r]&dr.VALUE_LENGTH)>>14;return this.emitNamedEntityData(r,o,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,r,n){let{decodeTree:o}=this;return this.emitCodePoint(r===1?o[t]&~dr.VALUE_LENGTH:o[t+1],n),r===3&&this.emitCodePoint(o[t+2],n),n}end(){var t;switch(this.state){case ce.NamedEntity:return this.result!==0&&(this.decodeMode!==_t.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ce.NumericDecimal:return this.emitNumericEntity(0,2);case ce.NumericHex:return this.emitNumericEntity(0,3);case ce.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ce.EntityStart:return 0}}};function DE(e){let t="",r=new rc(e,n=>t+=Yf(n));return function(o,i){let s=0,a=0;for(;(a=o.indexOf("&",a))>=0;){t+=o.slice(s,a),r.startEntity(i);let l=r.write(o,a+1);if(l<0){s=a+r.end();break}s=a+l,a=l===0?s+1:s}let u=t+o.slice(s);return t="",u}}function V6(e,t,r,n){let o=(t&dr.BRANCH_LENGTH)>>7,i=t&dr.JUMP_TABLE;if(o===0)return i!==0&&n===i?r:-1;if(i){let u=n-i;return u<0||u>=o?-1:e[r+u]-1}let s=r,a=s+o-1;for(;s<=a;){let u=s+a>>>1,l=e[u];if(l<n)s=u+1;else if(l>n)a=u-1;else return e[u+o]}return-1}var G6=DE(RE),zie=DE(PE);function pr(e,t=_t.Legacy){return G6(e,t)}function nc(e){for(let t=1;t<e.length;t++)e[t][0]+=e[t-1][0]+1;return e}var K6=new Map(nc([[9,"	"],[0,"
"],[22,"!"],[0,"""],[0,"#"],[0,"$"],[0,"%"],[0,"&"],[0,"'"],[0,"("],[0,")"],[0,"*"],[0,"+"],[0,","],[1,"."],[0,"/"],[10,":"],[0,";"],[0,{v:"<",n:8402,o:"<⃒"}],[0,{v:"=",n:8421,o:"=⃥"}],[0,{v:">",n:8402,o:">⃒"}],[0,"?"],[0,"@"],[26,"["],[0,"\"],[0,"]"],[0,"^"],[0,"_"],[0,"`"],[5,{n:106,o:"fj"}],[20,"{"],[0,"|"],[0,"}"],[34," "],[0,"¡"],[0,"¢"],[0,"£"],[0,"¤"],[0,"¥"],[0,"¦"],[0,"§"],[0,"¨"],[0,"©"],[0,"ª"],[0,"«"],[0,"¬"],[0,"­"],[0,"®"],[0,"¯"],[0,"°"],[0,"±"],[0,"²"],[0,"³"],[0,"´"],[0,"µ"],[0,"¶"],[0,"·"],[0,"¸"],[0,"¹"],[0,"º"],[0,"»"],[0,"¼"],[0,"½"],[0,"¾"],[0,"¿"],[0,"À"],[0,"Á"],[0,"Â"],[0,"Ã"],[0,"Ä"],[0,"Å"],[0,"Æ"],[0,"Ç"],[0,"È"],[0,"É"],[0,"Ê"],[0,"Ë"],[0,"Ì"],[0,"Í"],[0,"Î"],[0,"Ï"],[0,"Ð"],[0,"Ñ"],[0,"Ò"],[0,"Ó"],[0,"Ô"],[0,"Õ"],[0,"Ö"],[0,"×"],[0,"Ø"],[0,"Ù"],[0,"Ú"],[0,"Û"],[0,"Ü"],[0,"Ý"],[0,"Þ"],[0,"ß"],[0,"à"],[0,"á"],[0,"â"],[0,"ã"],[0,"ä"],[0,"å"],[0,"æ"],[0,"ç"],[0,"è"],[0,"é"],[0,"ê"],[0,"ë"],[0,"ì"],[0,"í"],[0,"î"],[0,"ï"],[0,"ð"],[0,"ñ"],[0,"ò"],[0,"ó"],[0,"ô"],[0,"õ"],[0,"ö"],[0,"÷"],[0,"ø"],[0,"ù"],[0,"ú"],[0,"û"],[0,"ü"],[0,"ý"],[0,"þ"],[0,"ÿ"],[0,"Ā"],[0,"ā"],[0,"Ă"],[0,"ă"],[0,"Ą"],[0,"ą"],[0,"Ć"],[0,"ć"],[0,"Ĉ"],[0,"ĉ"],[0,"Ċ"],[0,"ċ"],[0,"Č"],[0,"č"],[0,"Ď"],[0,"ď"],[0,"Đ"],[0,"đ"],[0,"Ē"],[0,"ē"],[2,"Ė"],[0,"ė"],[0,"Ę"],[0,"ę"],[0,"Ě"],[0,"ě"],[0,"Ĝ"],[0,"ĝ"],[0,"Ğ"],[0,"ğ"],[0,"Ġ"],[0,"ġ"],[0,"Ģ"],[1,"Ĥ"],[0,"ĥ"],[0,"Ħ"],[0,"ħ"],[0,"Ĩ"],[0,"ĩ"],[0,"Ī"],[0,"ī"],[2,"Į"],[0,"į"],[0,"İ"],[0,"ı"],[0,"IJ"],[0,"ij"],[0,"Ĵ"],[0,"ĵ"],[0,"Ķ"],[0,"ķ"],[0,"ĸ"],[0,"Ĺ"],[0,"ĺ"],[0,"Ļ"],[0,"ļ"],[0,"Ľ"],[0,"ľ"],[0,"Ŀ"],[0,"ŀ"],[0,"Ł"],[0,"ł"],[0,"Ń"],[0,"ń"],[0,"Ņ"],[0,"ņ"],[0,"Ň"],[0,"ň"],[0,"ʼn"],[0,"Ŋ"],[0,"ŋ"],[0,"Ō"],[0,"ō"],[2,"Ő"],[0,"ő"],[0,"Œ"],[0,"œ"],[0,"Ŕ"],[0,"ŕ"],[0,"Ŗ"],[0,"ŗ"],[0,"Ř"],[0,"ř"],[0,"Ś"],[0,"ś"],[0,"Ŝ"],[0,"ŝ"],[0,"Ş"],[0,"ş"],[0,"Š"],[0,"š"],[0,"Ţ"],[0,"ţ"],[0,"Ť"],[0,"ť"],[0,"Ŧ"],[0,"ŧ"],[0,"Ũ"],[0,"ũ"],[0,"Ū"],[0,"ū"],[0,"Ŭ"],[0,"ŭ"],[0,"Ů"],[0,"ů"],[0,"Ű"],[0,"ű"],[0,"Ų"],[0,"ų"],[0,"Ŵ"],[0,"ŵ"],[0,"Ŷ"],[0,"ŷ"],[0,"Ÿ"],[0,"Ź"],[0,"ź"],[0,"Ż"],[0,"ż"],[0,"Ž"],[0,"ž"],[19,"ƒ"],[34,"Ƶ"],[63,"ǵ"],[65,"ȷ"],[142,"ˆ"],[0,"ˇ"],[16,"˘"],[0,"˙"],[0,"˚"],[0,"˛"],[0,"˜"],[0,"˝"],[51,"̑"],[127,"Α"],[0,"Β"],[0,"Γ"],[0,"Δ"],[0,"Ε"],[0,"Ζ"],[0,"Η"],[0,"Θ"],[0,"Ι"],[0,"Κ"],[0,"Λ"],[0,"Μ"],[0,"Ν"],[0,"Ξ"],[0,"Ο"],[0,"Π"],[0,"Ρ"],[1,"Σ"],[0,"Τ"],[0,"Υ"],[0,"Φ"],[0,"Χ"],[0,"Ψ"],[0,"Ω"],[7,"α"],[0,"β"],[0,"γ"],[0,"δ"],[0,"ε"],[0,"ζ"],[0,"η"],[0,"θ"],[0,"ι"],[0,"κ"],[0,"λ"],[0,"μ"],[0,"ν"],[0,"ξ"],[0,"ο"],[0,"π"],[0,"ρ"],[0,"ς"],[0,"σ"],[0,"τ"],[0,"υ"],[0,"φ"],[0,"χ"],[0,"ψ"],[0,"ω"],[7,"ϑ"],[0,"ϒ"],[2,"ϕ"],[0,"ϖ"],[5,"Ϝ"],[0,"ϝ"],[18,"ϰ"],[0,"ϱ"],[3,"ϵ"],[0,"϶"],[10,"Ё"],[0,"Ђ"],[0,"Ѓ"],[0,"Є"],[0,"Ѕ"],[0,"І"],[0,"Ї"],[0,"Ј"],[0,"Љ"],[0,"Њ"],[0,"Ћ"],[0,"Ќ"],[1,"Ў"],[0,"Џ"],[0,"А"],[0,"Б"],[0,"В"],[0,"Г"],[0,"Д"],[0,"Е"],[0,"Ж"],[0,"З"],[0,"И"],[0,"Й"],[0,"К"],[0,"Л"],[0,"М"],[0,"Н"],[0,"О"],[0,"П"],[0,"Р"],[0,"С"],[0,"Т"],[0,"У"],[0,"Ф"],[0,"Х"],[0,"Ц"],[0,"Ч"],[0,"Ш"],[0,"Щ"],[0,"Ъ"],[0,"Ы"],[0,"Ь"],[0,"Э"],[0,"Ю"],[0,"Я"],[0,"а"],[0,"б"],[0,"в"],[0,"г"],[0,"д"],[0,"е"],[0,"ж"],[0,"з"],[0,"и"],[0,"й"],[0,"к"],[0,"л"],[0,"м"],[0,"н"],[0,"о"],[0,"п"],[0,"р"],[0,"с"],[0,"т"],[0,"у"],[0,"ф"],[0,"х"],[0,"ц"],[0,"ч"],[0,"ш"],[0,"щ"],[0,"ъ"],[0,"ы"],[0,"ь"],[0,"э"],[0,"ю"],[0,"я"],[1,"ё"],[0,"ђ"],[0,"ѓ"],[0,"є"],[0,"ѕ"],[0,"і"],[0,"ї"],[0,"ј"],[0,"љ"],[0,"њ"],[0,"ћ"],[0,"ќ"],[1,"ў"],[0,"џ"],[7074," "],[0," "],[0," "],[0," "],[1," "],[0," "],[0," "],[0," "],[0,"​"],[0,"‌"],[0,"‍"],[0,"‎"],[0,"‏"],[0,"‐"],[2,"–"],[0,"—"],[0,"―"],[0,"‖"],[1,"‘"],[0,"’"],[0,"‚"],[1,"“"],[0,"”"],[0,"„"],[1,"†"],[0,"‡"],[0,"•"],[2,"‥"],[0,"…"],[9,"‰"],[0,"‱"],[0,"′"],[0,"″"],[0,"‴"],[0,"‵"],[3,"‹"],[0,"›"],[3,"‾"],[2,"⁁"],[1,"⁃"],[0,"⁄"],[10,"⁏"],[7,"⁗"],[7,{v:" ",n:8202,o:"  "}],[0,"⁠"],[0,"⁡"],[0,"⁢"],[0,"⁣"],[72,"€"],[46,"⃛"],[0,"⃜"],[37,"ℂ"],[2,"℅"],[4,"ℊ"],[0,"ℋ"],[0,"ℌ"],[0,"ℍ"],[0,"ℎ"],[0,"ℏ"],[0,"ℐ"],[0,"ℑ"],[0,"ℒ"],[0,"ℓ"],[1,"ℕ"],[0,"№"],[0,"℗"],[0,"℘"],[0,"ℙ"],[0,"ℚ"],[0,"ℛ"],[0,"ℜ"],[0,"ℝ"],[0,"℞"],[3,"™"],[1,"ℤ"],[2,"℧"],[0,"ℨ"],[0,"℩"],[2,"ℬ"],[0,"ℭ"],[1,"ℯ"],[0,"ℰ"],[0,"ℱ"],[1,"ℳ"],[0,"ℴ"],[0,"ℵ"],[0,"ℶ"],[0,"ℷ"],[0,"ℸ"],[12,"ⅅ"],[0,"ⅆ"],[0,"ⅇ"],[0,"ⅈ"],[10,"⅓"],[0,"⅔"],[0,"⅕"],[0,"⅖"],[0,"⅗"],[0,"⅘"],[0,"⅙"],[0,"⅚"],[0,"⅛"],[0,"⅜"],[0,"⅝"],[0,"⅞"],[49,"←"],[0,"↑"],[0,"→"],[0,"↓"],[0,"↔"],[0,"↕"],[0,"↖"],[0,"↗"],[0,"↘"],[0,"↙"],[0,"↚"],[0,"↛"],[1,{v:"↝",n:824,o:"↝̸"}],[0,"↞"],[0,"↟"],[0,"↠"],[0,"↡"],[0,"↢"],[0,"↣"],[0,"↤"],[0,"↥"],[0,"↦"],[0,"↧"],[1,"↩"],[0,"↪"],[0,"↫"],[0,"↬"],[0,"↭"],[0,"↮"],[1,"↰"],[0,"↱"],[0,"↲"],[0,"↳"],[1,"↵"],[0,"↶"],[0,"↷"],[2,"↺"],[0,"↻"],[0,"↼"],[0,"↽"],[0,"↾"],[0,"↿"],[0,"⇀"],[0,"⇁"],[0,"⇂"],[0,"⇃"],[0,"⇄"],[0,"⇅"],[0,"⇆"],[0,"⇇"],[0,"⇈"],[0,"⇉"],[0,"⇊"],[0,"⇋"],[0,"⇌"],[0,"⇍"],[0,"⇎"],[0,"⇏"],[0,"⇐"],[0,"⇑"],[0,"⇒"],[0,"⇓"],[0,"⇔"],[0,"⇕"],[0,"⇖"],[0,"⇗"],[0,"⇘"],[0,"⇙"],[0,"⇚"],[0,"⇛"],[1,"⇝"],[6,"⇤"],[0,"⇥"],[15,"⇵"],[7,"⇽"],[0,"⇾"],[0,"⇿"],[0,"∀"],[0,"∁"],[0,{v:"∂",n:824,o:"∂̸"}],[0,"∃"],[0,"∄"],[0,"∅"],[1,"∇"],[0,"∈"],[0,"∉"],[1,"∋"],[0,"∌"],[2,"∏"],[0,"∐"],[0,"∑"],[0,"−"],[0,"∓"],[0,"∔"],[1,"∖"],[0,"∗"],[0,"∘"],[1,"√"],[2,"∝"],[0,"∞"],[0,"∟"],[0,{v:"∠",n:8402,o:"∠⃒"}],[0,"∡"],[0,"∢"],[0,"∣"],[0,"∤"],[0,"∥"],[0,"∦"],[0,"∧"],[0,"∨"],[0,{v:"∩",n:65024,o:"∩︀"}],[0,{v:"∪",n:65024,o:"∪︀"}],[0,"∫"],[0,"∬"],[0,"∭"],[0,"∮"],[0,"∯"],[0,"∰"],[0,"∱"],[0,"∲"],[0,"∳"],[0,"∴"],[0,"∵"],[0,"∶"],[0,"∷"],[0,"∸"],[1,"∺"],[0,"∻"],[0,{v:"∼",n:8402,o:"∼⃒"}],[0,{v:"∽",n:817,o:"∽̱"}],[0,{v:"∾",n:819,o:"∾̳"}],[0,"∿"],[0,"≀"],[0,"≁"],[0,{v:"≂",n:824,o:"≂̸"}],[0,"≃"],[0,"≄"],[0,"≅"],[0,"≆"],[0,"≇"],[0,"≈"],[0,"≉"],[0,"≊"],[0,{v:"≋",n:824,o:"≋̸"}],[0,"≌"],[0,{v:"≍",n:8402,o:"≍⃒"}],[0,{v:"≎",n:824,o:"≎̸"}],[0,{v:"≏",n:824,o:"≏̸"}],[0,{v:"≐",n:824,o:"≐̸"}],[0,"≑"],[0,"≒"],[0,"≓"],[0,"≔"],[0,"≕"],[0,"≖"],[0,"≗"],[1,"≙"],[0,"≚"],[1,"≜"],[2,"≟"],[0,"≠"],[0,{v:"≡",n:8421,o:"≡⃥"}],[0,"≢"],[1,{v:"≤",n:8402,o:"≤⃒"}],[0,{v:"≥",n:8402,o:"≥⃒"}],[0,{v:"≦",n:824,o:"≦̸"}],[0,{v:"≧",n:824,o:"≧̸"}],[0,{v:"≨",n:65024,o:"≨︀"}],[0,{v:"≩",n:65024,o:"≩︀"}],[0,{v:"≪",n:new Map(nc([[824,"≪̸"],[7577,"≪⃒"]]))}],[0,{v:"≫",n:new Map(nc([[824,"≫̸"],[7577,"≫⃒"]]))}],[0,"≬"],[0,"≭"],[0,"≮"],[0,"≯"],[0,"≰"],[0,"≱"],[0,"≲"],[0,"≳"],[0,"≴"],[0,"≵"],[0,"≶"],[0,"≷"],[0,"≸"],[0,"≹"],[0,"≺"],[0,"≻"],[0,"≼"],[0,"≽"],[0,"≾"],[0,{v:"≿",n:824,o:"≿̸"}],[0,"⊀"],[0,"⊁"],[0,{v:"⊂",n:8402,o:"⊂⃒"}],[0,{v:"⊃",n:8402,o:"⊃⃒"}],[0,"⊄"],[0,"⊅"],[0,"⊆"],[0,"⊇"],[0,"⊈"],[0,"⊉"],[0,{v:"⊊",n:65024,o:"⊊︀"}],[0,{v:"⊋",n:65024,o:"⊋︀"}],[1,"⊍"],[0,"⊎"],[0,{v:"⊏",n:824,o:"⊏̸"}],[0,{v:"⊐",n:824,o:"⊐̸"}],[0,"⊑"],[0,"⊒"],[0,{v:"⊓",n:65024,o:"⊓︀"}],[0,{v:"⊔",n:65024,o:"⊔︀"}],[0,"⊕"],[0,"⊖"],[0,"⊗"],[0,"⊘"],[0,"⊙"],[0,"⊚"],[0,"⊛"],[1,"⊝"],[0,"⊞"],[0,"⊟"],[0,"⊠"],[0,"⊡"],[0,"⊢"],[0,"⊣"],[0,"⊤"],[0,"⊥"],[1,"⊧"],[0,"⊨"],[0,"⊩"],[0,"⊪"],[0,"⊫"],[0,"⊬"],[0,"⊭"],[0,"⊮"],[0,"⊯"],[0,"⊰"],[1,"⊲"],[0,"⊳"],[0,{v:"⊴",n:8402,o:"⊴⃒"}],[0,{v:"⊵",n:8402,o:"⊵⃒"}],[0,"⊶"],[0,"⊷"],[0,"⊸"],[0,"⊹"],[0,"⊺"],[0,"⊻"],[1,"⊽"],[0,"⊾"],[0,"⊿"],[0,"⋀"],[0,"⋁"],[0,"⋂"],[0,"⋃"],[0,"⋄"],[0,"⋅"],[0,"⋆"],[0,"⋇"],[0,"⋈"],[0,"⋉"],[0,"⋊"],[0,"⋋"],[0,"⋌"],[0,"⋍"],[0,"⋎"],[0,"⋏"],[0,"⋐"],[0,"⋑"],[0,"⋒"],[0,"⋓"],[0,"⋔"],[0,"⋕"],[0,"⋖"],[0,"⋗"],[0,{v:"⋘",n:824,o:"⋘̸"}],[0,{v:"⋙",n:824,o:"⋙̸"}],[0,{v:"⋚",n:65024,o:"⋚︀"}],[0,{v:"⋛",n:65024,o:"⋛︀"}],[2,"⋞"],[0,"⋟"],[0,"⋠"],[0,"⋡"],[0,"⋢"],[0,"⋣"],[2,"⋦"],[0,"⋧"],[0,"⋨"],[0,"⋩"],[0,"⋪"],[0,"⋫"],[0,"⋬"],[0,"⋭"],[0,"⋮"],[0,"⋯"],[0,"⋰"],[0,"⋱"],[0,"⋲"],[0,"⋳"],[0,"⋴"],[0,{v:"⋵",n:824,o:"⋵̸"}],[0,"⋶"],[0,"⋷"],[1,{v:"⋹",n:824,o:"⋹̸"}],[0,"⋺"],[0,"⋻"],[0,"⋼"],[0,"⋽"],[0,"⋾"],[6,"⌅"],[0,"⌆"],[1,"⌈"],[0,"⌉"],[0,"⌊"],[0,"⌋"],[0,"⌌"],[0,"⌍"],[0,"⌎"],[0,"⌏"],[0,"⌐"],[1,"⌒"],[0,"⌓"],[1,"⌕"],[0,"⌖"],[5,"⌜"],[0,"⌝"],[0,"⌞"],[0,"⌟"],[2,"⌢"],[0,"⌣"],[9,"⌭"],[0,"⌮"],[7,"⌶"],[6,"⌽"],[1,"⌿"],[60,"⍼"],[51,"⎰"],[0,"⎱"],[2,"⎴"],[0,"⎵"],[0,"⎶"],[37,"⏜"],[0,"⏝"],[0,"⏞"],[0,"⏟"],[2,"⏢"],[4,"⏧"],[59,"␣"],[164,"Ⓢ"],[55,"─"],[1,"│"],[9,"┌"],[3,"┐"],[3,"└"],[3,"┘"],[3,"├"],[7,"┤"],[7,"┬"],[7,"┴"],[7,"┼"],[19,"═"],[0,"║"],[0,"╒"],[0,"╓"],[0,"╔"],[0,"╕"],[0,"╖"],[0,"╗"],[0,"╘"],[0,"╙"],[0,"╚"],[0,"╛"],[0,"╜"],[0,"╝"],[0,"╞"],[0,"╟"],[0,"╠"],[0,"╡"],[0,"╢"],[0,"╣"],[0,"╤"],[0,"╥"],[0,"╦"],[0,"╧"],[0,"╨"],[0,"╩"],[0,"╪"],[0,"╫"],[0,"╬"],[19,"▀"],[3,"▄"],[3,"█"],[8,"░"],[0,"▒"],[0,"▓"],[13,"□"],[8,"▪"],[0,"▫"],[1,"▭"],[0,"▮"],[2,"▱"],[1,"△"],[0,"▴"],[0,"▵"],[2,"▸"],[0,"▹"],[3,"▽"],[0,"▾"],[0,"▿"],[2,"◂"],[0,"◃"],[6,"◊"],[0,"○"],[32,"◬"],[2,"◯"],[8,"◸"],[0,"◹"],[0,"◺"],[0,"◻"],[0,"◼"],[8,"★"],[0,"☆"],[7,"☎"],[49,"♀"],[1,"♂"],[29,"♠"],[2,"♣"],[1,"♥"],[0,"♦"],[3,"♪"],[2,"♭"],[0,"♮"],[0,"♯"],[163,"✓"],[3,"✗"],[8,"✠"],[21,"✶"],[33,"❘"],[25,"❲"],[0,"❳"],[84,"⟈"],[0,"⟉"],[28,"⟦"],[0,"⟧"],[0,"⟨"],[0,"⟩"],[0,"⟪"],[0,"⟫"],[0,"⟬"],[0,"⟭"],[7,"⟵"],[0,"⟶"],[0,"⟷"],[0,"⟸"],[0,"⟹"],[0,"⟺"],[1,"⟼"],[2,"⟿"],[258,"⤂"],[0,"⤃"],[0,"⤄"],[0,"⤅"],[6,"⤌"],[0,"⤍"],[0,"⤎"],[0,"⤏"],[0,"⤐"],[0,"⤑"],[0,"⤒"],[0,"⤓"],[2,"⤖"],[2,"⤙"],[0,"⤚"],[0,"⤛"],[0,"⤜"],[0,"⤝"],[0,"⤞"],[0,"⤟"],[0,"⤠"],[2,"⤣"],[0,"⤤"],[0,"⤥"],[0,"⤦"],[0,"⤧"],[0,"⤨"],[0,"⤩"],[0,"⤪"],[8,{v:"⤳",n:824,o:"⤳̸"}],[1,"⤵"],[0,"⤶"],[0,"⤷"],[0,"⤸"],[0,"⤹"],[2,"⤼"],[0,"⤽"],[7,"⥅"],[2,"⥈"],[0,"⥉"],[0,"⥊"],[0,"⥋"],[2,"⥎"],[0,"⥏"],[0,"⥐"],[0,"⥑"],[0,"⥒"],[0,"⥓"],[0,"⥔"],[0,"⥕"],[0,"⥖"],[0,"⥗"],[0,"⥘"],[0,"⥙"],[0,"⥚"],[0,"⥛"],[0,"⥜"],[0,"⥝"],[0,"⥞"],[0,"⥟"],[0,"⥠"],[0,"⥡"],[0,"⥢"],[0,"⥣"],[0,"⥤"],[0,"⥥"],[0,"⥦"],[0,"⥧"],[0,"⥨"],[0,"⥩"],[0,"⥪"],[0,"⥫"],[0,"⥬"],[0,"⥭"],[0,"⥮"],[0,"⥯"],[0,"⥰"],[0,"⥱"],[0,"⥲"],[0,"⥳"],[0,"⥴"],[0,"⥵"],[0,"⥶"],[1,"⥸"],[0,"⥹"],[1,"⥻"],[0,"⥼"],[0,"⥽"],[0,"⥾"],[0,"⥿"],[5,"⦅"],[0,"⦆"],[4,"⦋"],[0,"⦌"],[0,"⦍"],[0,"⦎"],[0,"⦏"],[0,"⦐"],[0,"⦑"],[0,"⦒"],[0,"⦓"],[0,"⦔"],[0,"⦕"],[0,"⦖"],[3,"⦚"],[1,"⦜"],[0,"⦝"],[6,"⦤"],[0,"⦥"],[0,"⦦"],[0,"⦧"],[0,"⦨"],[0,"⦩"],[0,"⦪"],[0,"⦫"],[0,"⦬"],[0,"⦭"],[0,"⦮"],[0,"⦯"],[0,"⦰"],[0,"⦱"],[0,"⦲"],[0,"⦳"],[0,"⦴"],[0,"⦵"],[0,"⦶"],[0,"⦷"],[1,"⦹"],[1,"⦻"],[0,"⦼"],[1,"⦾"],[0,"⦿"],[0,"⧀"],[0,"⧁"],[0,"⧂"],[0,"⧃"],[0,"⧄"],[0,"⧅"],[3,"⧉"],[3,"⧍"],[0,"⧎"],[0,{v:"⧏",n:824,o:"⧏̸"}],[0,{v:"⧐",n:824,o:"⧐̸"}],[11,"⧜"],[0,"⧝"],[0,"⧞"],[4,"⧣"],[0,"⧤"],[0,"⧥"],[5,"⧫"],[8,"⧴"],[1,"⧶"],[9,"⨀"],[0,"⨁"],[0,"⨂"],[1,"⨄"],[1,"⨆"],[5,"⨌"],[0,"⨍"],[2,"⨐"],[0,"⨑"],[0,"⨒"],[0,"⨓"],[0,"⨔"],[0,"⨕"],[0,"⨖"],[0,"⨗"],[10,"⨢"],[0,"⨣"],[0,"⨤"],[0,"⨥"],[0,"⨦"],[0,"⨧"],[1,"⨩"],[0,"⨪"],[2,"⨭"],[0,"⨮"],[0,"⨯"],[0,"⨰"],[0,"⨱"],[1,"⨳"],[0,"⨴"],[0,"⨵"],[0,"⨶"],[0,"⨷"],[0,"⨸"],[0,"⨹"],[0,"⨺"],[0,"⨻"],[0,"⨼"],[2,"⨿"],[0,"⩀"],[1,"⩂"],[0,"⩃"],[0,"⩄"],[0,"⩅"],[0,"⩆"],[0,"⩇"],[0,"⩈"],[0,"⩉"],[0,"⩊"],[0,"⩋"],[0,"⩌"],[0,"⩍"],[2,"⩐"],[2,"⩓"],[0,"⩔"],[0,"⩕"],[0,"⩖"],[0,"⩗"],[0,"⩘"],[1,"⩚"],[0,"⩛"],[0,"⩜"],[0,"⩝"],[1,"⩟"],[6,"⩦"],[3,"⩪"],[2,{v:"⩭",n:824,o:"⩭̸"}],[0,"⩮"],[0,"⩯"],[0,{v:"⩰",n:824,o:"⩰̸"}],[0,"⩱"],[0,"⩲"],[0,"⩳"],[0,"⩴"],[0,"⩵"],[1,"⩷"],[0,"⩸"],[0,"⩹"],[0,"⩺"],[0,"⩻"],[0,"⩼"],[0,{v:"⩽",n:824,o:"⩽̸"}],[0,{v:"⩾",n:824,o:"⩾̸"}],[0,"⩿"],[0,"⪀"],[0,"⪁"],[0,"⪂"],[0,"⪃"],[0,"⪄"],[0,"⪅"],[0,"⪆"],[0,"⪇"],[0,"⪈"],[0,"⪉"],[0,"⪊"],[0,"⪋"],[0,"⪌"],[0,"⪍"],[0,"⪎"],[0,"⪏"],[0,"⪐"],[0,"⪑"],[0,"⪒"],[0,"⪓"],[0,"⪔"],[0,"⪕"],[0,"⪖"],[0,"⪗"],[0,"⪘"],[0,"⪙"],[0,"⪚"],[2,"⪝"],[0,"⪞"],[0,"⪟"],[0,"⪠"],[0,{v:"⪡",n:824,o:"⪡̸"}],[0,{v:"⪢",n:824,o:"⪢̸"}],[1,"⪤"],[0,"⪥"],[0,"⪦"],[0,"⪧"],[0,"⪨"],[0,"⪩"],[0,"⪪"],[0,"⪫"],[0,{v:"⪬",n:65024,o:"⪬︀"}],[0,{v:"⪭",n:65024,o:"⪭︀"}],[0,"⪮"],[0,{v:"⪯",n:824,o:"⪯̸"}],[0,{v:"⪰",n:824,o:"⪰̸"}],[2,"⪳"],[0,"⪴"],[0,"⪵"],[0,"⪶"],[0,"⪷"],[0,"⪸"],[0,"⪹"],[0,"⪺"],[0,"⪻"],[0,"⪼"],[0,"⪽"],[0,"⪾"],[0,"⪿"],[0,"⫀"],[0,"⫁"],[0,"⫂"],[0,"⫃"],[0,"⫄"],[0,{v:"⫅",n:824,o:"⫅̸"}],[0,{v:"⫆",n:824,o:"⫆̸"}],[0,"⫇"],[0,"⫈"],[2,{v:"⫋",n:65024,o:"⫋︀"}],[0,{v:"⫌",n:65024,o:"⫌︀"}],[2,"⫏"],[0,"⫐"],[0,"⫑"],[0,"⫒"],[0,"⫓"],[0,"⫔"],[0,"⫕"],[0,"⫖"],[0,"⫗"],[0,"⫘"],[0,"⫙"],[0,"⫚"],[0,"⫛"],[8,"⫤"],[1,"⫦"],[0,"⫧"],[0,"⫨"],[0,"⫩"],[1,"⫫"],[0,"⫬"],[0,"⫭"],[0,"⫮"],[0,"⫯"],[0,"⫰"],[0,"⫱"],[0,"⫲"],[0,"⫳"],[9,{v:"⫽",n:8421,o:"⫽⃥"}],[44343,{n:new Map(nc([[56476,"𝒜"],[1,"𝒞"],[0,"𝒟"],[2,"𝒢"],[2,"𝒥"],[0,"𝒦"],[2,"𝒩"],[0,"𝒪"],[0,"𝒫"],[0,"𝒬"],[1,"𝒮"],[0,"𝒯"],[0,"𝒰"],[0,"𝒱"],[0,"𝒲"],[0,"𝒳"],[0,"𝒴"],[0,"𝒵"],[0,"𝒶"],[0,"𝒷"],[0,"𝒸"],[0,"𝒹"],[1,"𝒻"],[1,"𝒽"],[0,"𝒾"],[0,"𝒿"],[0,"𝓀"],[0,"𝓁"],[0,"𝓂"],[0,"𝓃"],[1,"𝓅"],[0,"𝓆"],[0,"𝓇"],[0,"𝓈"],[0,"𝓉"],[0,"𝓊"],[0,"𝓋"],[0,"𝓌"],[0,"𝓍"],[0,"𝓎"],[0,"𝓏"],[52,"𝔄"],[0,"𝔅"],[1,"𝔇"],[0,"𝔈"],[0,"𝔉"],[0,"𝔊"],[2,"𝔍"],[0,"𝔎"],[0,"𝔏"],[0,"𝔐"],[0,"𝔑"],[0,"𝔒"],[0,"𝔓"],[0,"𝔔"],[1,"𝔖"],[0,"𝔗"],[0,"𝔘"],[0,"𝔙"],[0,"𝔚"],[0,"𝔛"],[0,"𝔜"],[1,"𝔞"],[0,"𝔟"],[0,"𝔠"],[0,"𝔡"],[0,"𝔢"],[0,"𝔣"],[0,"𝔤"],[0,"𝔥"],[0,"𝔦"],[0,"𝔧"],[0,"𝔨"],[0,"𝔩"],[0,"𝔪"],[0,"𝔫"],[0,"𝔬"],[0,"𝔭"],[0,"𝔮"],[0,"𝔯"],[0,"𝔰"],[0,"𝔱"],[0,"𝔲"],[0,"𝔳"],[0,"𝔴"],[0,"𝔵"],[0,"𝔶"],[0,"𝔷"],[0,"𝔸"],[0,"𝔹"],[1,"𝔻"],[0,"𝔼"],[0,"𝔽"],[0,"𝔾"],[1,"𝕀"],[0,"𝕁"],[0,"𝕂"],[0,"𝕃"],[0,"𝕄"],[1,"𝕆"],[3,"𝕊"],[0,"𝕋"],[0,"𝕌"],[0,"𝕍"],[0,"𝕎"],[0,"𝕏"],[0,"𝕐"],[1,"𝕒"],[0,"𝕓"],[0,"𝕔"],[0,"𝕕"],[0,"𝕖"],[0,"𝕗"],[0,"𝕘"],[0,"𝕙"],[0,"𝕚"],[0,"𝕛"],[0,"𝕜"],[0,"𝕝"],[0,"𝕞"],[0,"𝕟"],[0,"𝕠"],[0,"𝕡"],[0,"𝕢"],[0,"𝕣"],[0,"𝕤"],[0,"𝕥"],[0,"𝕦"],[0,"𝕧"],[0,"𝕨"],[0,"𝕩"],[0,"𝕪"],[0,"𝕫"]]))}],[8906,"ff"],[0,"fi"],[0,"fl"],[0,"ffi"],[0,"ffl"]]));var J6=new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]),Y6=String.prototype.codePointAt!=null?(e,t)=>e.codePointAt(t):(e,t)=>(e.charCodeAt(t)&64512)===55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t);function Qf(e,t){return function(n){let o,i=0,s="";for(;o=e.exec(n);)i!==o.index&&(s+=n.substring(i,o.index)),s+=t.get(o[0].charCodeAt(0)),i=o.index+1;return s+n.substring(i)}}var NE=Qf(/[&<>'"]/g,J6),OE=Qf(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),ME=Qf(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]));var FE;(function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"})(FE||(FE={}));var BE;(function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"})(BE||(BE={}));function Q6(e){return Object.prototype.toString.call(e)}function oc(e){return Q6(e)==="[object String]"}var e4=Object.prototype.hasOwnProperty;function t4(e,t){return e4.call(e,t)}function Go(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){if(r){if(typeof r!="object")throw new TypeError(r+"must be object");Object.keys(r).forEach(function(n){e[n]=r[n]})}}),e}function tm(e,t,r){return[].concat(e.slice(0,t),r,e.slice(t+1))}function ic(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function La(e){if(e>65535){e-=65536;let t=55296+(e>>10),r=56320+(e&1023);return String.fromCharCode(t,r)}return String.fromCharCode(e)}var jE=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,r4=/&([a-z#][a-z0-9]{1,31});/gi,n4=new RegExp(jE.source+"|"+r4.source,"gi"),o4=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function i4(e,t){if(t.charCodeAt(0)===35&&o4.test(t)){let n=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return ic(n)?La(n):e}let r=pr(e);return r!==e?r:e}function s4(e){return e.indexOf("\\")<0?e:e.replace(jE,"$1")}function Bt(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(n4,function(t,r,n){return r||i4(t,n)})}var a4=/[&<>"]/,u4=/[&<>"]/g,l4={"&":"&","<":"<",">":">",'"':"""};function c4(e){return l4[e]}function Lt(e){return a4.test(e)?e.replace(u4,c4):e}var d4=/[.?*+^$[\]\\(){}|-]/g;function p4(e){return e.replace(d4,"\\$&")}function K(e){switch(e){case 9:case 32:return!0}return!1}function an(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function un(e){return Vo.test(e)||ec.test(e)}function ln(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function cn(e){return e=e.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(e=e.replace(/ẞ/g,"\xDF")),e.toLowerCase().toUpperCase()}var f4={mdurl:Zl,ucmicro:Kf};var sm={};T(sm,{parseLinkDestination:()=>om,parseLinkLabel:()=>nm,parseLinkTitle:()=>im});function nm(e,t,r){let n,o,i,s,a=e.posMax,u=e.pos;for(e.pos=t+1,n=1;e.pos<a;){if(i=e.src.charCodeAt(e.pos),i===93&&(n--,n===0)){o=!0;break}if(s=e.pos,e.md.inline.skipToken(e),i===91){if(s===e.pos-1)n++;else if(r)return e.pos=u,-1}}let l=-1;return o&&(l=e.pos),e.pos=u,l}function om(e,t,r){let n,o=t,i={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<r;){if(n=e.charCodeAt(o),n===10||n===60)return i;if(n===62)return i.pos=o+1,i.str=Bt(e.slice(t+1,o)),i.ok=!0,i;if(n===92&&o+1<r){o+=2;continue}o++}return i}let s=0;for(;o<r&&(n=e.charCodeAt(o),!(n===32||n<32||n===127));){if(n===92&&o+1<r){if(e.charCodeAt(o+1)===32)break;o+=2;continue}if(n===40&&(s++,s>32))return i;if(n===41){if(s===0)break;s--}o++}return t===o||s!==0||(i.str=Bt(e.slice(t,o)),i.pos=o,i.ok=!0),i}function im(e,t,r,n){let o,i=t,s={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)s.str=n.str,s.marker=n.marker;else{if(i>=r)return s;let a=e.charCodeAt(i);if(a!==34&&a!==39&&a!==40)return s;t++,i++,a===40&&(a=41),s.marker=a}for(;i<r;){if(o=e.charCodeAt(i),o===s.marker)return s.pos=i+1,s.str+=Bt(e.slice(t,i)),s.ok=!0,s;if(o===40&&s.marker===41)return s;o===92&&i+1<r&&i++,i++}return s.can_continue=!0,s.str+=Bt(e.slice(t,i)),s}var wt={};wt.code_inline=function(e,t,r,n,o){let i=e[t];return"<code"+o.renderAttrs(i)+">"+Lt(i.content)+"</code>"};wt.code_block=function(e,t,r,n,o){let i=e[t];return"<pre"+o.renderAttrs(i)+"><code>"+Lt(e[t].content)+`</code></pre>
`};wt.fence=function(e,t,r,n,o){let i=e[t],s=i.info?Bt(i.info).trim():"",a="",u="";if(s){let d=s.split(/(\s+)/g);a=d[0],u=d.slice(2).join("")}let l;if(r.highlight?l=r.highlight(i.content,a,u)||Lt(i.content):l=Lt(i.content),l.indexOf("<pre")===0)return l+`
`;if(s){let d=i.attrIndex("class"),p=i.attrs?i.attrs.slice():[];d<0?p.push(["class",r.langPrefix+a]):(p[d]=p[d].slice(),p[d][1]+=" "+r.langPrefix+a);let f={attrs:p};return`<pre><code${o.renderAttrs(f)}>${l}</code></pre>
`}return`<pre><code${o.renderAttrs(i)}>${l}</code></pre>
`};wt.image=function(e,t,r,n,o){let i=e[t];return i.attrs[i.attrIndex("alt")][1]=o.renderInlineAsText(i.children,r,n),o.renderToken(e,t,r)};wt.hardbreak=function(e,t,r){return r.xhtmlOut?`<br />
`:`<br>
`};wt.softbreak=function(e,t,r){return r.breaks?r.xhtmlOut?`<br />
`:`<br>
`:`
`};wt.text=function(e,t){return Lt(e[t].content)};wt.html_block=function(e,t){return e[t].content};wt.html_inline=function(e,t){return e[t].content};function Ko(){this.rules=Go({},wt)}Ko.prototype.renderAttrs=function(t){let r,n,o;if(!t.attrs)return"";for(o="",r=0,n=t.attrs.length;r<n;r++)o+=" "+Lt(t.attrs[r][0])+'="'+Lt(t.attrs[r][1])+'"';return o};Ko.prototype.renderToken=function(t,r,n){let o=t[r],i="";if(o.hidden)return"";o.block&&o.nesting!==-1&&r&&t[r-1].hidden&&(i+=`
`),i+=(o.nesting===-1?"</":"<")+o.tag,i+=this.renderAttrs(o),o.nesting===0&&n.xhtmlOut&&(i+=" /");let s=!1;if(o.block&&(s=!0,o.nesting===1&&r+1<t.length)){let a=t[r+1];(a.type==="inline"||a.hidden||a.nesting===-1&&a.tag===o.tag)&&(s=!1)}return i+=s?`>
`:">",i};Ko.prototype.renderInline=function(e,t,r){let n="",o=this.rules;for(let i=0,s=e.length;i<s;i++){let a=e[i].type;typeof o[a]<"u"?n+=o[a](e,i,t,r,this):n+=this.renderToken(e,i,t)}return n};Ko.prototype.renderInlineAsText=function(e,t,r){let n="";for(let o=0,i=e.length;o<i;o++)switch(e[o].type){case"text":n+=e[o].content;break;case"image":n+=this.renderInlineAsText(e[o].children,t,r);break;case"html_inline":case"html_block":n+=e[o].content;break;case"softbreak":case"hardbreak":n+=`
`;break;default:}return n};Ko.prototype.render=function(e,t,r){let n="",o=this.rules;for(let i=0,s=e.length;i<s;i++){let a=e[i].type;a==="inline"?n+=this.renderInline(e[i].children,t,r):typeof o[a]<"u"?n+=o[a](e,i,t,r,this):n+=this.renderToken(e,i,t,r)}return n};var qE=Ko;function et(){this.__rules__=[],this.__cache__=null}et.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1};et.prototype.__compile__=function(){let e=this,t=[""];e.__rules__.forEach(function(r){r.enabled&&r.alt.forEach(function(n){t.indexOf(n)<0&&t.push(n)})}),e.__cache__={},t.forEach(function(r){e.__cache__[r]=[],e.__rules__.forEach(function(n){n.enabled&&(r&&n.alt.indexOf(r)<0||e.__cache__[r].push(n.fn))})})};et.prototype.at=function(e,t,r){let n=this.__find__(e),o=r||{};if(n===-1)throw new Error("Parser rule not found: "+e);this.__rules__[n].fn=t,this.__rules__[n].alt=o.alt||[],this.__cache__=null};et.prototype.before=function(e,t,r,n){let o=this.__find__(e),i=n||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o,0,{name:t,enabled:!0,fn:r,alt:i.alt||[]}),this.__cache__=null};et.prototype.after=function(e,t,r,n){let o=this.__find__(e),i=n||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o+1,0,{name:t,enabled:!0,fn:r,alt:i.alt||[]}),this.__cache__=null};et.prototype.push=function(e,t,r){let n=r||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null};et.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let r=[];return e.forEach(function(n){let o=this.__find__(n);if(o<0){if(t)return;throw new Error("Rules manager: invalid rule name "+n)}this.__rules__[o].enabled=!0,r.push(n)},this),this.__cache__=null,r};et.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(r){r.enabled=!1}),this.enable(e,t)};et.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let r=[];return e.forEach(function(n){let o=this.__find__(n);if(o<0){if(t)return;throw new Error("Rules manager: invalid rule name "+n)}this.__rules__[o].enabled=!1,r.push(n)},this),this.__cache__=null,r};et.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};var dn=et;function Jo(e,t,r){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}Jo.prototype.attrIndex=function(t){if(!this.attrs)return-1;let r=this.attrs;for(let n=0,o=r.length;n<o;n++)if(r[n][0]===t)return n;return-1};Jo.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]};Jo.prototype.attrSet=function(t,r){let n=this.attrIndex(t),o=[t,r];n<0?this.attrPush(o):this.attrs[n]=o};Jo.prototype.attrGet=function(t){let r=this.attrIndex(t),n=null;return r>=0&&(n=this.attrs[r][1]),n};Jo.prototype.attrJoin=function(t,r){let n=this.attrIndex(t);n<0?this.attrPush([t,r]):this.attrs[n][1]=this.attrs[n][1]+" "+r};var Ut=Jo;function $E(e,t,r){this.src=e,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=t}$E.prototype.Token=Ut;var zE=$E;var m4=/\r\n?|\n/g,h4=/\0/g;function am(e){let t;t=e.src.replace(m4,`
`),t=t.replace(h4,"\uFFFD"),e.src=t}function um(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function lm(e){let t=e.tokens;for(let r=0,n=t.length;r<n;r++){let o=t[r];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function g4(e){return/^<a[>\s]/i.test(e)}function b4(e){return/^<\/a\s*>/i.test(e)}function cm(e){let t=e.tokens;if(e.md.options.linkify)for(let r=0,n=t.length;r<n;r++){if(t[r].type!=="inline"||!e.md.linkify.pretest(t[r].content))continue;let o=t[r].children,i=0;for(let s=o.length-1;s>=0;s--){let a=o[s];if(a.type==="link_close"){for(s--;o[s].level!==a.level&&o[s].type!=="link_open";)s--;continue}if(a.type==="html_inline"&&(g4(a.content)&&i>0&&i--,b4(a.content)&&i++),!(i>0)&&a.type==="text"&&e.md.linkify.test(a.content)){let u=a.content,l=e.md.linkify.match(u),d=[],p=a.level,f=0;l.length>0&&l[0].index===0&&s>0&&o[s-1].type==="text_special"&&(l=l.slice(1));for(let m=0;m<l.length;m++){let h=l[m].url,y=e.md.normalizeLink(h);if(!e.md.validateLink(y))continue;let S=l[m].text;l[m].schema?l[m].schema==="mailto:"&&!/^mailto:/i.test(S)?S=e.md.normalizeLinkText("mailto:"+S).replace(/^mailto:/,""):S=e.md.normalizeLinkText(S):S=e.md.normalizeLinkText("http://"+S).replace(/^http:\/\//,"");let D=l[m].index;if(D>f){let I=new e.Token("text","",0);I.content=u.slice(f,D),I.level=p,d.push(I)}let w=new e.Token("link_open","a",1);w.attrs=[["href",y]],w.level=p++,w.markup="linkify",w.info="auto",d.push(w);let x=new e.Token("text","",0);x.content=S,x.level=p,d.push(x);let E=new e.Token("link_close","a",-1);E.level=--p,E.markup="linkify",E.info="auto",d.push(E),f=l[m].lastIndex}if(f<u.length){let m=new e.Token("text","",0);m.content=u.slice(f),m.level=p,d.push(m)}t[r].children=o=tm(o,s,d)}}}}var WE=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,y4=/\((c|tm|r)\)/i,_4=/\((c|tm|r)\)/ig,w4={c:"\xA9",r:"\xAE",tm:"\u2122"};function x4(e,t){return w4[t.toLowerCase()]}function S4(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e[r];n.type==="text"&&!t&&(n.content=n.content.replace(_4,x4)),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function v4(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e[r];n.type==="text"&&!t&&WE.test(n.content)&&(n.content=n.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function dm(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(y4.test(e.tokens[t].content)&&S4(e.tokens[t].children),WE.test(e.tokens[t].content)&&v4(e.tokens[t].children))}var E4=/['"]/,HE=/['"]/g,VE="\u2019";function sc(e,t,r){return e.slice(0,t)+r+e.slice(t+1)}function C4(e,t){let r,n=[];for(let o=0;o<e.length;o++){let i=e[o],s=e[o].level;for(r=n.length-1;r>=0&&!(n[r].level<=s);r--);if(n.length=r+1,i.type!=="text")continue;let a=i.content,u=0,l=a.length;e:for(;u<l;){HE.lastIndex=u;let d=HE.exec(a);if(!d)break;let p=!0,f=!0;u=d.index+1;let m=d[0]==="'",h=32;if(d.index-1>=0)h=a.charCodeAt(d.index-1);else for(r=o-1;r>=0&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r--)if(e[r].content){h=e[r].content.charCodeAt(e[r].content.length-1);break}let y=32;if(u<l)y=a.charCodeAt(u);else for(r=o+1;r<e.length&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r++)if(e[r].content){y=e[r].content.charCodeAt(0);break}let S=ln(h)||un(String.fromCharCode(h)),D=ln(y)||un(String.fromCharCode(y)),w=an(h),x=an(y);if(x?p=!1:D&&(w||S||(p=!1)),w?f=!1:S&&(x||D||(f=!1)),y===34&&d[0]==='"'&&h>=48&&h<=57&&(f=p=!1),p&&f&&(p=S,f=D),!p&&!f){m&&(i.content=sc(i.content,d.index,VE));continue}if(f)for(r=n.length-1;r>=0;r--){let E=n[r];if(n[r].level<s)break;if(E.single===m&&n[r].level===s){E=n[r];let I,C;m?(I=t.md.options.quotes[2],C=t.md.options.quotes[3]):(I=t.md.options.quotes[0],C=t.md.options.quotes[1]),i.content=sc(i.content,d.index,C),e[E.token].content=sc(e[E.token].content,E.pos,I),u+=C.length-1,E.token===o&&(u+=I.length-1),a=i.content,l=a.length,n.length=r;continue e}}p?n.push({token:o,pos:d.index,single:m,level:s}):f&&m&&(i.content=sc(i.content,d.index,VE))}}}function pm(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!E4.test(e.tokens[t].content)||C4(e.tokens[t].children,e)}function fm(e){let t,r,n=e.tokens,o=n.length;for(let i=0;i<o;i++){if(n[i].type!=="inline")continue;let s=n[i].children,a=s.length;for(t=0;t<a;t++)s[t].type==="text_special"&&(s[t].type="text");for(t=r=0;t<a;t++)s[t].type==="text"&&t+1<a&&s[t+1].type==="text"?s[t+1].content=s[t].content+s[t+1].content:(t!==r&&(s[r]=s[t]),r++);t!==r&&(s.length=r)}}var mm=[["normalize",am],["block",um],["inline",lm],["linkify",cm],["replacements",dm],["smartquotes",pm],["text_join",fm]];function hm(){this.ruler=new dn;for(let e=0;e<mm.length;e++)this.ruler.push(mm[e][0],mm[e][1])}hm.prototype.process=function(e){let t=this.ruler.getRules("");for(let r=0,n=t.length;r<n;r++)t[r](e)};hm.prototype.State=zE;var GE=hm;function xt(e,t,r,n){this.src=e,this.md=t,this.env=r,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;let o=this.src;for(let i=0,s=0,a=0,u=0,l=o.length,d=!1;s<l;s++){let p=o.charCodeAt(s);if(!d)if(K(p)){a++,p===9?u+=4-u%4:u++;continue}else d=!0;(p===10||s===l-1)&&(p!==10&&s++,this.bMarks.push(i),this.eMarks.push(s),this.tShift.push(a),this.sCount.push(u),this.bsCount.push(0),d=!1,a=0,u=0,i=s+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}xt.prototype.push=function(e,t,r){let n=new Ut(e,t,r);return n.block=!0,r<0&&this.level--,n.level=this.level,r>0&&this.level++,this.tokens.push(n),n};xt.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]};xt.prototype.skipEmptyLines=function(t){for(let r=this.lineMax;t<r&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t};xt.prototype.skipSpaces=function(t){for(let r=this.src.length;t<r;t++){let n=this.src.charCodeAt(t);if(!K(n))break}return t};xt.prototype.skipSpacesBack=function(t,r){if(t<=r)return t;for(;t>r;)if(!K(this.src.charCodeAt(--t)))return t+1;return t};xt.prototype.skipChars=function(t,r){for(let n=this.src.length;t<n&&this.src.charCodeAt(t)===r;t++);return t};xt.prototype.skipCharsBack=function(t,r,n){if(t<=n)return t;for(;t>n;)if(r!==this.src.charCodeAt(--t))return t+1;return t};xt.prototype.getLines=function(t,r,n,o){if(t>=r)return"";let i=new Array(r-t);for(let s=0,a=t;a<r;a++,s++){let u=0,l=this.bMarks[a],d=l,p;for(a+1<r||o?p=this.eMarks[a]+1:p=this.eMarks[a];d<p&&u<n;){let f=this.src.charCodeAt(d);if(K(f))f===9?u+=4-(u+this.bsCount[a])%4:u++;else if(d-l<this.tShift[a])u++;else break;d++}u>n?i[s]=new Array(u-n+1).join(" ")+this.src.slice(d,p):i[s]=this.src.slice(d,p)}return i.join("")};xt.prototype.Token=Ut;var KE=xt;var T4=65536;function gm(e,t){let r=e.bMarks[t]+e.tShift[t],n=e.eMarks[t];return e.src.slice(r,n)}function JE(e){let t=[],r=e.length,n=0,o=e.charCodeAt(n),i=!1,s=0,a="";for(;n<r;)o===124&&(i?(a+=e.substring(s,n-1),s=n):(t.push(a+e.substring(s,n)),a="",s=n+1)),i=o===92,n++,o=e.charCodeAt(n);return t.push(a+e.substring(s)),t}function bm(e,t,r,n){if(t+2>r)return!1;let o=t+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let i=e.bMarks[o]+e.tShift[o];if(i>=e.eMarks[o])return!1;let s=e.src.charCodeAt(i++);if(s!==124&&s!==45&&s!==58||i>=e.eMarks[o])return!1;let a=e.src.charCodeAt(i++);if(a!==124&&a!==45&&a!==58&&!K(a)||s===45&&K(a))return!1;for(;i<e.eMarks[o];){let E=e.src.charCodeAt(i);if(E!==124&&E!==45&&E!==58&&!K(E))return!1;i++}let u=gm(e,t+1),l=u.split("|"),d=[];for(let E=0;E<l.length;E++){let I=l[E].trim();if(!I){if(E===0||E===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(I))return!1;I.charCodeAt(I.length-1)===58?d.push(I.charCodeAt(0)===58?"center":"right"):I.charCodeAt(0)===58?d.push("left"):d.push("")}if(u=gm(e,t).trim(),u.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=JE(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();let p=l.length;if(p===0||p!==d.length)return!1;if(n)return!0;let f=e.parentType;e.parentType="table";let m=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),y=[t,0];h.map=y;let S=e.push("thead_open","thead",1);S.map=[t,t+1];let D=e.push("tr_open","tr",1);D.map=[t,t+1];for(let E=0;E<l.length;E++){let I=e.push("th_open","th",1);d[E]&&(I.attrs=[["style","text-align:"+d[E]]]);let C=e.push("inline","",0);C.content=l[E].trim(),C.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let w,x=0;for(o=t+2;o<r&&!(e.sCount[o]<e.blkIndent);o++){let E=!1;for(let C=0,j=m.length;C<j;C++)if(m[C](e,o,r,!0)){E=!0;break}if(E||(u=gm(e,o).trim(),!u)||e.sCount[o]-e.blkIndent>=4||(l=JE(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),x+=p-l.length,x>T4))break;if(o===t+2){let C=e.push("tbody_open","tbody",1);C.map=w=[t+2,0]}let I=e.push("tr_open","tr",1);I.map=[o,o+1];for(let C=0;C<p;C++){let j=e.push("td_open","td",1);d[C]&&(j.attrs=[["style","text-align:"+d[C]]]);let X=e.push("inline","",0);X.content=l[C]?l[C].trim():"",X.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return w&&(e.push("tbody_close","tbody",-1),w[1]=o),e.push("table_close","table",-1),y[1]=o,e.parentType=f,e.line=o,!0}function ym(e,t,r){if(e.sCount[t]-e.blkIndent<4)return!1;let n=t+1,o=n;for(;n<r;){if(e.isEmpty(n)){n++;continue}if(e.sCount[n]-e.blkIndent>=4){n++,o=n;continue}break}e.line=o;let i=e.push("code_block","code",0);return i.content=e.getLines(t,o,4+e.blkIndent,!1)+`
`,i.map=[t,e.line],!0}function _m(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||o+3>i)return!1;let s=e.src.charCodeAt(o);if(s!==126&&s!==96)return!1;let a=o;o=e.skipChars(o,s);let u=o-a;if(u<3)return!1;let l=e.src.slice(a,o),d=e.src.slice(o,i);if(s===96&&d.indexOf(String.fromCharCode(s))>=0)return!1;if(n)return!0;let p=t,f=!1;for(;p++,!(p>=r||(o=a=e.bMarks[p]+e.tShift[p],i=e.eMarks[p],o<i&&e.sCount[p]<e.blkIndent));)if(e.src.charCodeAt(o)===s&&!(e.sCount[p]-e.blkIndent>=4)&&(o=e.skipChars(o,s),!(o-a<u)&&(o=e.skipSpaces(o),!(o<i)))){f=!0;break}u=e.sCount[t],e.line=p+(f?1:0);let m=e.push("fence","code",0);return m.info=d,m.content=e.getLines(t+1,p,u,!0),m.markup=l,m.map=[t,e.line],!0}function wm(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t],s=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(n)return!0;let a=[],u=[],l=[],d=[],p=e.md.block.ruler.getRules("blockquote"),f=e.parentType;e.parentType="blockquote";let m=!1,h;for(h=t;h<r;h++){let x=e.sCount[h]<e.blkIndent;if(o=e.bMarks[h]+e.tShift[h],i=e.eMarks[h],o>=i)break;if(e.src.charCodeAt(o++)===62&&!x){let I=e.sCount[h]+1,C,j;e.src.charCodeAt(o)===32?(o++,I++,j=!1,C=!0):e.src.charCodeAt(o)===9?(C=!0,(e.bsCount[h]+I)%4===3?(o++,I++,j=!1):j=!0):C=!1;let X=I;for(a.push(e.bMarks[h]),e.bMarks[h]=o;o<i;){let ae=e.src.charCodeAt(o);if(K(ae))ae===9?X+=4-(X+e.bsCount[h]+(j?1:0))%4:X++;else break;o++}m=o>=i,u.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(C?1:0),l.push(e.sCount[h]),e.sCount[h]=X-I,d.push(e.tShift[h]),e.tShift[h]=o-e.bMarks[h];continue}if(m)break;let E=!1;for(let I=0,C=p.length;I<C;I++)if(p[I](e,h,r,!0)){E=!0;break}if(E){e.lineMax=h,e.blkIndent!==0&&(a.push(e.bMarks[h]),u.push(e.bsCount[h]),d.push(e.tShift[h]),l.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}a.push(e.bMarks[h]),u.push(e.bsCount[h]),d.push(e.tShift[h]),l.push(e.sCount[h]),e.sCount[h]=-1}let y=e.blkIndent;e.blkIndent=0;let S=e.push("blockquote_open","blockquote",1);S.markup=">";let D=[t,0];S.map=D,e.md.block.tokenize(e,t,h);let w=e.push("blockquote_close","blockquote",-1);w.markup=">",e.lineMax=s,e.parentType=f,D[1]=e.line;for(let x=0;x<d.length;x++)e.bMarks[x+t]=a[x],e.tShift[x+t]=d[x],e.sCount[x+t]=l[x],e.bsCount[x+t]=u[x];return e.blkIndent=y,!0}function xm(e,t,r,n){let o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.bMarks[t]+e.tShift[t],s=e.src.charCodeAt(i++);if(s!==42&&s!==45&&s!==95)return!1;let a=1;for(;i<o;){let l=e.src.charCodeAt(i++);if(l!==s&&!K(l))return!1;l===s&&a++}if(a<3)return!1;if(n)return!0;e.line=t+1;let u=e.push("hr","hr",0);return u.map=[t,e.line],u.markup=Array(a+1).join(String.fromCharCode(s)),!0}function YE(e,t){let r=e.eMarks[t],n=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(n++);if(o!==42&&o!==45&&o!==43)return-1;if(n<r){let i=e.src.charCodeAt(n);if(!K(i))return-1}return n}function ZE(e,t){let r=e.bMarks[t]+e.tShift[t],n=e.eMarks[t],o=r;if(o+1>=n)return-1;let i=e.src.charCodeAt(o++);if(i<48||i>57)return-1;for(;;){if(o>=n)return-1;if(i=e.src.charCodeAt(o++),i>=48&&i<=57){if(o-r>=10)return-1;continue}if(i===41||i===46)break;return-1}return o<n&&(i=e.src.charCodeAt(o),!K(i))?-1:o}function k4(e,t){let r=e.level+2;for(let n=t+2,o=e.tokens.length-2;n<o;n++)e.tokens[n].level===r&&e.tokens[n].type==="paragraph_open"&&(e.tokens[n+2].hidden=!0,e.tokens[n].hidden=!0,n+=2)}function Sm(e,t,r,n){let o,i,s,a,u=t,l=!0;if(e.sCount[u]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[u]-e.listIndent>=4&&e.sCount[u]<e.blkIndent)return!1;let d=!1;n&&e.parentType==="paragraph"&&e.sCount[u]>=e.blkIndent&&(d=!0);let p,f,m;if((m=ZE(e,u))>=0){if(p=!0,s=e.bMarks[u]+e.tShift[u],f=Number(e.src.slice(s,m-1)),d&&f!==1)return!1}else if((m=YE(e,u))>=0)p=!1;else return!1;if(d&&e.skipSpaces(m)>=e.eMarks[u])return!1;if(n)return!0;let h=e.src.charCodeAt(m-1),y=e.tokens.length;p?(a=e.push("ordered_list_open","ol",1),f!==1&&(a.attrs=[["start",f]])):a=e.push("bullet_list_open","ul",1);let S=[u,0];a.map=S,a.markup=String.fromCharCode(h);let D=!1,w=e.md.block.ruler.getRules("list"),x=e.parentType;for(e.parentType="list";u<r;){i=m,o=e.eMarks[u];let E=e.sCount[u]+m-(e.bMarks[u]+e.tShift[u]),I=E;for(;i<o;){let Q=e.src.charCodeAt(i);if(Q===9)I+=4-(I+e.bsCount[u])%4;else if(Q===32)I++;else break;i++}let C=i,j;C>=o?j=1:j=I-E,j>4&&(j=1);let X=E+j;a=e.push("list_item_open","li",1),a.markup=String.fromCharCode(h);let ae=[u,0];a.map=ae,p&&(a.info=e.src.slice(s,m-1));let ye=e.tight,me=e.tShift[u],M=e.sCount[u],q=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=X,e.tight=!0,e.tShift[u]=C-e.bMarks[u],e.sCount[u]=I,C>=o&&e.isEmpty(u+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,u,r,!0),(!e.tight||D)&&(l=!1),D=e.line-u>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=q,e.tShift[u]=me,e.sCount[u]=M,e.tight=ye,a=e.push("list_item_close","li",-1),a.markup=String.fromCharCode(h),u=e.line,ae[1]=u,u>=r||e.sCount[u]<e.blkIndent||e.sCount[u]-e.blkIndent>=4)break;let z=!1;for(let Q=0,Pe=w.length;Q<Pe;Q++)if(w[Q](e,u,r,!0)){z=!0;break}if(z)break;if(p){if(m=ZE(e,u),m<0)break;s=e.bMarks[u]+e.tShift[u]}else if(m=YE(e,u),m<0)break;if(h!==e.src.charCodeAt(m-1))break}return p?a=e.push("ordered_list_close","ol",-1):a=e.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(h),S[1]=u,e.line=u,e.parentType=x,l&&k4(e,y),!0}function vm(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t],s=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function a(w){let x=e.lineMax;if(w>=x||e.isEmpty(w))return null;let E=!1;if(e.sCount[w]-e.blkIndent>3&&(E=!0),e.sCount[w]<0&&(E=!0),!E){let j=e.md.block.ruler.getRules("reference"),X=e.parentType;e.parentType="reference";let ae=!1;for(let ye=0,me=j.length;ye<me;ye++)if(j[ye](e,w,x,!0)){ae=!0;break}if(e.parentType=X,ae)return null}let I=e.bMarks[w]+e.tShift[w],C=e.eMarks[w];return e.src.slice(I,C+1)}let u=e.src.slice(o,i+1);i=u.length;let l=-1;for(o=1;o<i;o++){let w=u.charCodeAt(o);if(w===91)return!1;if(w===93){l=o;break}else if(w===10){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}else if(w===92&&(o++,o<i&&u.charCodeAt(o)===10)){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}}if(l<0||u.charCodeAt(l+1)!==58)return!1;for(o=l+2;o<i;o++){let w=u.charCodeAt(o);if(w===10){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}else if(!K(w))break}let d=e.md.helpers.parseLinkDestination(u,o,i);if(!d.ok)return!1;let p=e.md.normalizeLink(d.str);if(!e.md.validateLink(p))return!1;o=d.pos;let f=o,m=s,h=o;for(;o<i;o++){let w=u.charCodeAt(o);if(w===10){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}else if(!K(w))break}let y=e.md.helpers.parseLinkTitle(u,o,i);for(;y.can_continue;){let w=a(s);if(w===null)break;u+=w,o=i,i=u.length,s++,y=e.md.helpers.parseLinkTitle(u,o,i,y)}let S;for(o<i&&h!==o&&y.ok?(S=y.str,o=y.pos):(S="",o=f,s=m);o<i;){let w=u.charCodeAt(o);if(!K(w))break;o++}if(o<i&&u.charCodeAt(o)!==10&&S)for(S="",o=f,s=m;o<i;){let w=u.charCodeAt(o);if(!K(w))break;o++}if(o<i&&u.charCodeAt(o)!==10)return!1;let D=cn(u.slice(1,l));return D?(n||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[D]>"u"&&(e.env.references[D]={title:S,href:p}),e.line=s),!0):!1}var XE=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"];var A4="[a-zA-Z_:][a-zA-Z0-9:._-]*",I4="[^\"'=<>`\\x00-\\x20]+",R4="'[^']*'",P4='"[^"]*"',D4="(?:"+I4+"|"+R4+"|"+P4+")",N4="(?:\\s+"+A4+"(?:\\s*=\\s*"+D4+")?)",QE="<[A-Za-z][A-Za-z0-9\\-]*"+N4+"*\\s*\\/?>",eC="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",O4="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",M4="<[?][\\s\\S]*?[?]>",F4="<![A-Za-z][^>]*>",B4="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",tC=new RegExp("^(?:"+QE+"|"+eC+"|"+O4+"|"+M4+"|"+F4+"|"+B4+")"),rC=new RegExp("^(?:"+QE+"|"+eC+")");var Yo=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+XE.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(rC.source+"\\s*$"),/^$/,!1]];function Em(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let s=e.src.slice(o,i),a=0;for(;a<Yo.length&&!Yo[a][0].test(s);a++);if(a===Yo.length)return!1;if(n)return Yo[a][2];let u=t+1;if(!Yo[a][1].test(s)){for(;u<r&&!(e.sCount[u]<e.blkIndent);u++)if(o=e.bMarks[u]+e.tShift[u],i=e.eMarks[u],s=e.src.slice(o,i),Yo[a][1].test(s)){s.length!==0&&u++;break}}e.line=u;let l=e.push("html_block","",0);return l.map=[t,u],l.content=e.getLines(t,u,e.blkIndent,!0),!0}function Cm(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let s=e.src.charCodeAt(o);if(s!==35||o>=i)return!1;let a=1;for(s=e.src.charCodeAt(++o);s===35&&o<i&&a<=6;)a++,s=e.src.charCodeAt(++o);if(a>6||o<i&&!K(s))return!1;if(n)return!0;i=e.skipSpacesBack(i,o);let u=e.skipCharsBack(i,35,o);u>o&&K(e.src.charCodeAt(u-1))&&(i=u),e.line=t+1;let l=e.push("heading_open","h"+String(a),1);l.markup="########".slice(0,a),l.map=[t,e.line];let d=e.push("inline","",0);d.content=e.src.slice(o,i).trim(),d.map=[t,e.line],d.children=[];let p=e.push("heading_close","h"+String(a),-1);return p.markup="########".slice(0,a),!0}function Tm(e,t,r){let n=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.parentType;e.parentType="paragraph";let i=0,s,a=t+1;for(;a<r&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3)continue;if(e.sCount[a]>=e.blkIndent){let m=e.bMarks[a]+e.tShift[a],h=e.eMarks[a];if(m<h&&(s=e.src.charCodeAt(m),(s===45||s===61)&&(m=e.skipChars(m,s),m=e.skipSpaces(m),m>=h))){i=s===61?1:2;break}}if(e.sCount[a]<0)continue;let f=!1;for(let m=0,h=n.length;m<h;m++)if(n[m](e,a,r,!0)){f=!0;break}if(f)break}if(!i)return!1;let u=e.getLines(t,a,e.blkIndent,!1).trim();e.line=a+1;let l=e.push("heading_open","h"+String(i),1);l.markup=String.fromCharCode(s),l.map=[t,e.line];let d=e.push("inline","",0);d.content=u,d.map=[t,e.line-1],d.children=[];let p=e.push("heading_close","h"+String(i),-1);return p.markup=String.fromCharCode(s),e.parentType=o,!0}function km(e,t,r){let n=e.md.block.ruler.getRules("paragraph"),o=e.parentType,i=t+1;for(e.parentType="paragraph";i<r&&!e.isEmpty(i);i++){if(e.sCount[i]-e.blkIndent>3||e.sCount[i]<0)continue;let l=!1;for(let d=0,p=n.length;d<p;d++)if(n[d](e,i,r,!0)){l=!0;break}if(l)break}let s=e.getLines(t,i,e.blkIndent,!1).trim();e.line=i;let a=e.push("paragraph_open","p",1);a.map=[t,e.line];let u=e.push("inline","",0);return u.content=s,u.map=[t,e.line],u.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}var ac=[["table",bm,["paragraph","reference"]],["code",ym],["fence",_m,["paragraph","reference","blockquote","list"]],["blockquote",wm,["paragraph","reference","blockquote","list"]],["hr",xm,["paragraph","reference","blockquote","list"]],["list",Sm,["paragraph","reference","blockquote"]],["reference",vm],["html_block",Em,["paragraph","reference","blockquote"]],["heading",Cm,["paragraph","reference","blockquote"]],["lheading",Tm],["paragraph",km]];function uc(){this.ruler=new dn;for(let e=0;e<ac.length;e++)this.ruler.push(ac[e][0],ac[e][1],{alt:(ac[e][2]||[]).slice()})}uc.prototype.tokenize=function(e,t,r){let n=this.ruler.getRules(""),o=n.length,i=e.md.options.maxNesting,s=t,a=!1;for(;s<r&&(e.line=s=e.skipEmptyLines(s),!(s>=r||e.sCount[s]<e.blkIndent));){if(e.level>=i){e.line=r;break}let u=e.line,l=!1;for(let d=0;d<o;d++)if(l=n[d](e,s,r,!1),l){if(u>=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),s=e.line,s<r&&e.isEmpty(s)&&(a=!0,s++,e.line=s)}};uc.prototype.parse=function(e,t,r,n){if(!e)return;let o=new this.State(e,t,r,n);this.tokenize(o,o.line,o.lineMax)};uc.prototype.State=KE;var nC=uc;function Ua(e,t,r,n){this.src=e,this.env=r,this.md=t,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}Ua.prototype.pushPending=function(){let e=new Ut("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e};Ua.prototype.push=function(e,t,r){this.pending&&this.pushPending();let n=new Ut(e,t,r),o=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(o),n};Ua.prototype.scanDelims=function(e,t){let r=this.posMax,n=this.src.charCodeAt(e),o=e>0?this.src.charCodeAt(e-1):32,i=e;for(;i<r&&this.src.charCodeAt(i)===n;)i++;let s=i-e,a=i<r?this.src.charCodeAt(i):32,u=ln(o)||un(String.fromCharCode(o)),l=ln(a)||un(String.fromCharCode(a)),d=an(o),p=an(a),f=!p&&(!l||d||u),m=!d&&(!u||p||l);return{can_open:f&&(t||!m||u),can_close:m&&(t||!f||l),length:s}};Ua.prototype.Token=Ut;var oC=Ua;function L4(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Am(e,t){let r=e.pos;for(;r<e.posMax&&!L4(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)}var U4=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Im(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let r=e.pos,n=e.posMax;if(r+3>n||e.src.charCodeAt(r)!==58||e.src.charCodeAt(r+1)!==47||e.src.charCodeAt(r+2)!==47)return!1;let o=e.pending.match(U4);if(!o)return!1;let i=o[1],s=e.md.linkify.matchAtStart(e.src.slice(r-i.length));if(!s)return!1;let a=s.url;if(a.length<=i.length)return!1;let u=a.length;for(;u>0&&a.charCodeAt(u-1)===42;)u--;u!==a.length&&(a=a.slice(0,u));let l=e.md.normalizeLink(a);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);let d=e.push("link_open","a",1);d.attrs=[["href",l]],d.markup="linkify",d.info="auto";let p=e.push("text","",0);p.content=e.md.normalizeLinkText(a);let f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=a.length-i.length,!0}function Rm(e,t){let r=e.pos;if(e.src.charCodeAt(r)!==10)return!1;let n=e.pending.length-1,o=e.posMax;if(!t)if(n>=0&&e.pending.charCodeAt(n)===32)if(n>=1&&e.pending.charCodeAt(n-1)===32){let i=n-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(r++;r<o&&K(e.src.charCodeAt(r));)r++;return e.pos=r,!0}var Pm=[];for(let e=0;e<256;e++)Pm.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Pm[e.charCodeAt(0)]=1});function Dm(e,t){let r=e.pos,n=e.posMax;if(e.src.charCodeAt(r)!==92||(r++,r>=n))return!1;let o=e.src.charCodeAt(r);if(o===10){for(t||e.push("hardbreak","br",0),r++;r<n&&(o=e.src.charCodeAt(r),!!K(o));)r++;return e.pos=r,!0}let i=e.src[r];if(o>=55296&&o<=56319&&r+1<n){let a=e.src.charCodeAt(r+1);a>=56320&&a<=57343&&(i+=e.src[r+1],r++)}let s="\\"+i;if(!t){let a=e.push("text_special","",0);o<256&&Pm[o]!==0?a.content=i:a.content=s,a.markup=s,a.info="escape"}return e.pos=r+1,!0}function Nm(e,t){let r=e.pos;if(e.src.charCodeAt(r)!==96)return!1;let o=r;r++;let i=e.posMax;for(;r<i&&e.src.charCodeAt(r)===96;)r++;let s=e.src.slice(o,r),a=s.length;if(e.backticksScanned&&(e.backticks[a]||0)<=o)return t||(e.pending+=s),e.pos+=a,!0;let u=r,l;for(;(l=e.src.indexOf("`",u))!==-1;){for(u=l+1;u<i&&e.src.charCodeAt(u)===96;)u++;let d=u-l;if(d===a){if(!t){let p=e.push("code_inline","code",0);p.markup=s,p.content=e.src.slice(r,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=u,!0}e.backticks[d]=l}return e.backticksScanned=!0,t||(e.pending+=s),e.pos+=a,!0}function j4(e,t){let r=e.pos,n=e.src.charCodeAt(r);if(t||n!==126)return!1;let o=e.scanDelims(e.pos,!0),i=o.length,s=String.fromCharCode(n);if(i<2)return!1;let a;i%2&&(a=e.push("text","",0),a.content=s,i--);for(let u=0;u<i;u+=2)a=e.push("text","",0),a.content=s+s,e.delimiters.push({marker:n,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function iC(e,t){let r,n=[],o=t.length;for(let i=0;i<o;i++){let s=t[i];if(s.marker!==126||s.end===-1)continue;let a=t[s.end];r=e.tokens[s.token],r.type="s_open",r.tag="s",r.nesting=1,r.markup="~~",r.content="",r=e.tokens[a.token],r.type="s_close",r.tag="s",r.nesting=-1,r.markup="~~",r.content="",e.tokens[a.token-1].type==="text"&&e.tokens[a.token-1].content==="~"&&n.push(a.token-1)}for(;n.length;){let i=n.pop(),s=i+1;for(;s<e.tokens.length&&e.tokens[s].type==="s_close";)s++;s--,i!==s&&(r=e.tokens[s],e.tokens[s]=e.tokens[i],e.tokens[i]=r)}}function q4(e){let t=e.tokens_meta,r=e.tokens_meta.length;iC(e,e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&iC(e,t[n].delimiters)}var Om={tokenize:j4,postProcess:q4};function $4(e,t){let r=e.pos,n=e.src.charCodeAt(r);if(t||n!==95&&n!==42)return!1;let o=e.scanDelims(e.pos,n===42);for(let i=0;i<o.length;i++){let s=e.push("text","",0);s.content=String.fromCharCode(n),e.delimiters.push({marker:n,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function sC(e,t){let r=t.length;for(let n=r-1;n>=0;n--){let o=t[n];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;let i=t[o.end],s=n>0&&t[n-1].end===o.end+1&&t[n-1].marker===o.marker&&t[n-1].token===o.token-1&&t[o.end+1].token===i.token+1,a=String.fromCharCode(o.marker),u=e.tokens[o.token];u.type=s?"strong_open":"em_open",u.tag=s?"strong":"em",u.nesting=1,u.markup=s?a+a:a,u.content="";let l=e.tokens[i.token];l.type=s?"strong_close":"em_close",l.tag=s?"strong":"em",l.nesting=-1,l.markup=s?a+a:a,l.content="",s&&(e.tokens[t[n-1].token].content="",e.tokens[t[o.end+1].token].content="",n--)}}function z4(e){let t=e.tokens_meta,r=e.tokens_meta.length;sC(e,e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&sC(e,t[n].delimiters)}var Mm={tokenize:$4,postProcess:z4};function Fm(e,t){let r,n,o,i,s="",a="",u=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let d=e.pos,p=e.posMax,f=e.pos+1,m=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(m<0)return!1;let h=m+1;if(h<p&&e.src.charCodeAt(h)===40){for(l=!1,h++;h<p&&(r=e.src.charCodeAt(h),!(!K(r)&&r!==10));h++);if(h>=p)return!1;if(u=h,o=e.md.helpers.parseLinkDestination(e.src,h,e.posMax),o.ok){for(s=e.md.normalizeLink(o.str),e.md.validateLink(s)?h=o.pos:s="",u=h;h<p&&(r=e.src.charCodeAt(h),!(!K(r)&&r!==10));h++);if(o=e.md.helpers.parseLinkTitle(e.src,h,e.posMax),h<p&&u!==h&&o.ok)for(a=o.str,h=o.pos;h<p&&(r=e.src.charCodeAt(h),!(!K(r)&&r!==10));h++);}(h>=p||e.src.charCodeAt(h)!==41)&&(l=!0),h++}if(l){if(typeof e.env.references>"u")return!1;if(h<p&&e.src.charCodeAt(h)===91?(u=h+1,h=e.md.helpers.parseLinkLabel(e,h),h>=0?n=e.src.slice(u,h++):h=m+1):h=m+1,n||(n=e.src.slice(f,m)),i=e.env.references[cn(n)],!i)return e.pos=d,!1;s=i.href,a=i.title}if(!t){e.pos=f,e.posMax=m;let y=e.push("link_open","a",1),S=[["href",s]];y.attrs=S,a&&S.push(["title",a]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=h,e.posMax=p,!0}function Bm(e,t){let r,n,o,i,s,a,u,l,d="",p=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let m=e.pos+2,h=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(h<0)return!1;if(i=h+1,i<f&&e.src.charCodeAt(i)===40){for(i++;i<f&&(r=e.src.charCodeAt(i),!(!K(r)&&r!==10));i++);if(i>=f)return!1;for(l=i,a=e.md.helpers.parseLinkDestination(e.src,i,e.posMax),a.ok&&(d=e.md.normalizeLink(a.str),e.md.validateLink(d)?i=a.pos:d=""),l=i;i<f&&(r=e.src.charCodeAt(i),!(!K(r)&&r!==10));i++);if(a=e.md.helpers.parseLinkTitle(e.src,i,e.posMax),i<f&&l!==i&&a.ok)for(u=a.str,i=a.pos;i<f&&(r=e.src.charCodeAt(i),!(!K(r)&&r!==10));i++);else u="";if(i>=f||e.src.charCodeAt(i)!==41)return e.pos=p,!1;i++}else{if(typeof e.env.references>"u")return!1;if(i<f&&e.src.charCodeAt(i)===91?(l=i+1,i=e.md.helpers.parseLinkLabel(e,i),i>=0?o=e.src.slice(l,i++):i=h+1):i=h+1,o||(o=e.src.slice(m,h)),s=e.env.references[cn(o)],!s)return e.pos=p,!1;d=s.href,u=s.title}if(!t){n=e.src.slice(m,h);let y=[];e.md.inline.parse(n,e.md,e.env,y);let S=e.push("image","img",0),D=[["src",d],["alt",""]];S.attrs=D,S.children=y,S.content=n,u&&D.push(["title",u])}return e.pos=i,e.posMax=f,!0}var W4=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,H4=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Lm(e,t){let r=e.pos;if(e.src.charCodeAt(r)!==60)return!1;let n=e.pos,o=e.posMax;for(;;){if(++r>=o)return!1;let s=e.src.charCodeAt(r);if(s===60)return!1;if(s===62)break}let i=e.src.slice(n+1,r);if(H4.test(i)){let s=e.md.normalizeLink(i);if(!e.md.validateLink(s))return!1;if(!t){let a=e.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=e.push("text","",0);u.content=e.md.normalizeLinkText(i);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=i.length+2,!0}if(W4.test(i)){let s=e.md.normalizeLink("mailto:"+i);if(!e.md.validateLink(s))return!1;if(!t){let a=e.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=e.push("text","",0);u.content=e.md.normalizeLinkText(i);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=i.length+2,!0}return!1}function V4(e){return/^<a[>\s]/i.test(e)}function G4(e){return/^<\/a\s*>/i.test(e)}function K4(e){let t=e|32;return t>=97&&t<=122}function Um(e,t){if(!e.md.options.html)return!1;let r=e.posMax,n=e.pos;if(e.src.charCodeAt(n)!==60||n+2>=r)return!1;let o=e.src.charCodeAt(n+1);if(o!==33&&o!==63&&o!==47&&!K4(o))return!1;let i=e.src.slice(n).match(tC);if(!i)return!1;if(!t){let s=e.push("html_inline","",0);s.content=i[0],V4(s.content)&&e.linkLevel++,G4(s.content)&&e.linkLevel--}return e.pos+=i[0].length,!0}var J4=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Y4=/^&([a-z][a-z0-9]{1,31});/i;function jm(e,t){let r=e.pos,n=e.posMax;if(e.src.charCodeAt(r)!==38||r+1>=n)return!1;if(e.src.charCodeAt(r+1)===35){let i=e.src.slice(r).match(J4);if(i){if(!t){let s=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),a=e.push("text_special","",0);a.content=ic(s)?La(s):La(65533),a.markup=i[0],a.info="entity"}return e.pos+=i[0].length,!0}}else{let i=e.src.slice(r).match(Y4);if(i){let s=pr(i[0]);if(s!==i[0]){if(!t){let a=e.push("text_special","",0);a.content=s,a.markup=i[0],a.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function aC(e){let t={},r=e.length;if(!r)return;let n=0,o=-2,i=[];for(let s=0;s<r;s++){let a=e[s];if(i.push(0),(e[n].marker!==a.marker||o!==a.token-1)&&(n=s),o=a.token,a.length=a.length||0,!a.close)continue;t.hasOwnProperty(a.marker)||(t[a.marker]=[-1,-1,-1,-1,-1,-1]);let u=t[a.marker][(a.open?3:0)+a.length%3],l=n-i[n]-1,d=l;for(;l>u;l-=i[l]+1){let p=e[l];if(p.marker===a.marker&&p.open&&p.end<0){let f=!1;if((p.close||a.open)&&(p.length+a.length)%3===0&&(p.length%3!==0||a.length%3!==0)&&(f=!0),!f){let m=l>0&&!e[l-1].open?i[l-1]+1:0;i[s]=s-l+m,i[l]=m,a.open=!1,p.end=s,p.close=!1,d=-1,o=-2;break}}}d!==-1&&(t[a.marker][(a.open?3:0)+(a.length||0)%3]=d)}}function qm(e){let t=e.tokens_meta,r=e.tokens_meta.length;aC(e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&aC(t[n].delimiters)}function $m(e){let t,r,n=0,o=e.tokens,i=e.tokens.length;for(t=r=0;t<i;t++)o[t].nesting<0&&n--,o[t].level=n,o[t].nesting>0&&n++,o[t].type==="text"&&t+1<i&&o[t+1].type==="text"?o[t+1].content=o[t].content+o[t+1].content:(t!==r&&(o[r]=o[t]),r++);t!==r&&(o.length=r)}var zm=[["text",Am],["linkify",Im],["newline",Rm],["escape",Dm],["backticks",Nm],["strikethrough",Om.tokenize],["emphasis",Mm.tokenize],["link",Fm],["image",Bm],["autolink",Lm],["html_inline",Um],["entity",jm]],Wm=[["balance_pairs",qm],["strikethrough",Om.postProcess],["emphasis",Mm.postProcess],["fragments_join",$m]];function ja(){this.ruler=new dn;for(let e=0;e<zm.length;e++)this.ruler.push(zm[e][0],zm[e][1]);this.ruler2=new dn;for(let e=0;e<Wm.length;e++)this.ruler2.push(Wm[e][0],Wm[e][1])}ja.prototype.skipToken=function(e){let t=e.pos,r=this.ruler.getRules(""),n=r.length,o=e.md.options.maxNesting,i=e.cache;if(typeof i[t]<"u"){e.pos=i[t];return}let s=!1;if(e.level<o){for(let a=0;a<n;a++)if(e.level++,s=r[a](e,!0),e.level--,s){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;s||e.pos++,i[t]=e.pos};ja.prototype.tokenize=function(e){let t=this.ruler.getRules(""),r=t.length,n=e.posMax,o=e.md.options.maxNesting;for(;e.pos<n;){let i=e.pos,s=!1;if(e.level<o){for(let a=0;a<r;a++)if(s=t[a](e,!1),s){if(i>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};ja.prototype.parse=function(e,t,r,n){let o=new this.State(e,t,r,n);this.tokenize(o);let i=this.ruler2.getRules(""),s=i.length;for(let a=0;a<s;a++)i[a](o)};ja.prototype.State=oC;var uC=ja;function lC(e){let t={};e=e||{},t.src_Any=Xl.source,t.src_Cc=Ql.source,t.src_Z=tc.source,t.src_P=Vo.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");let r="[><\uFF5C]";return t.src_pseudo_letter="(?:(?!"+r+"|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|"+r+"|"+t.src_ZPCc+")(?!"+(e["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+r+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+t.src_ZCc+"|[.]|$)|"+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+t.src_ZCc+"|$)|;(?!"+t.src_ZCc+"|$)|\\!+(?!"+t.src_ZCc+"|[!]|$)|\\?(?!"+t.src_ZCc+"|[?]|$))+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|"+r+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+t.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+t.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function Hm(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){r&&Object.keys(r).forEach(function(n){e[n]=r[n]})}),e}function cc(e){return Object.prototype.toString.call(e)}function Z4(e){return cc(e)==="[object String]"}function X4(e){return cc(e)==="[object Object]"}function Q4(e){return cc(e)==="[object RegExp]"}function cC(e){return cc(e)==="[object Function]"}function eU(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var pC={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function tU(e){return Object.keys(e||{}).reduce(function(t,r){return t||pC.hasOwnProperty(r)},!1)}var rU={"http:":{validate:function(e,t,r){let n=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){let n=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){let n=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},nU="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",oU="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");function iU(e){e.__index__=-1,e.__text_cache__=""}function sU(e){return function(t,r){let n=t.slice(r);return e.test(n)?n.match(e)[0].length:0}}function dC(){return function(e,t){t.normalize(e)}}function lc(e){let t=e.re=lC(e.__opts__),r=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||r.push(nU),r.push(t.src_xn),t.src_tlds=r.join("|");function n(a){return a.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(n(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(n(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(n(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(n(t.tpl_host_fuzzy_test),"i");let o=[];e.__compiled__={};function i(a,u){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+u)}Object.keys(e.__schemas__).forEach(function(a){let u=e.__schemas__[a];if(u===null)return;let l={validate:null,link:null};if(e.__compiled__[a]=l,X4(u)){Q4(u.validate)?l.validate=sU(u.validate):cC(u.validate)?l.validate=u.validate:i(a,u),cC(u.normalize)?l.normalize=u.normalize:u.normalize?i(a,u):l.normalize=dC();return}if(Z4(u)){o.push(a);return}i(a,u)}),o.forEach(function(a){e.__compiled__[e.__schemas__[a]]&&(e.__compiled__[a].validate=e.__compiled__[e.__schemas__[a]].validate,e.__compiled__[a].normalize=e.__compiled__[e.__schemas__[a]].normalize)}),e.__compiled__[""]={validate:null,normalize:dC()};let s=Object.keys(e.__compiled__).filter(function(a){return a.length>0&&e.__compiled__[a]}).map(eU).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><\uFF5C]|"+t.src_ZPCc+"))("+s+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><\uFF5C]|"+t.src_ZPCc+"))("+s+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),iU(e)}function aU(e,t){let r=e.__index__,n=e.__last_index__,o=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=o,this.text=o,this.url=o}function Vm(e,t){let r=new aU(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function Re(e,t){if(!(this instanceof Re))return new Re(e,t);t||tU(e)&&(t=e,e={}),this.__opts__=Hm({},pC,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Hm({},rU,e),this.__compiled__={},this.__tlds__=oU,this.__tlds_replaced__=!1,this.re={},lc(this)}Re.prototype.add=function(t,r){return this.__schemas__[t]=r,lc(this),this};Re.prototype.set=function(t){return this.__opts__=Hm(this.__opts__,t),this};Re.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let r,n,o,i,s,a,u,l,d;if(this.re.schema_test.test(t)){for(u=this.re.schema_search,u.lastIndex=0;(r=u.exec(t))!==null;)if(i=this.testSchemaAt(t,r[2],u.lastIndex),i){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=t.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(n=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=n.index+n[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(d=t.indexOf("@"),d>=0&&(o=t.match(this.re.email_fuzzy))!==null&&(s=o.index+o[1].length,a=o.index+o[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=a))),this.__index__>=0};Re.prototype.pretest=function(t){return this.re.pretest.test(t)};Re.prototype.testSchemaAt=function(t,r,n){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(t,n,this):0};Re.prototype.match=function(t){let r=[],n=0;this.__index__>=0&&this.__text_cache__===t&&(r.push(Vm(this,n)),n=this.__last_index__);let o=n?t.slice(n):t;for(;this.test(o);)r.push(Vm(this,n)),o=o.slice(this.__last_index__),n+=this.__last_index__;return r.length?r:null};Re.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;let r=this.re.schema_at_start.exec(t);if(!r)return null;let n=this.testSchemaAt(t,r[2],r[0].length);return n?(this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+n,Vm(this,0)):null};Re.prototype.tlds=function(t,r){return t=Array.isArray(t)?t:[t],r?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(n,o,i){return n!==i[o-1]}).reverse(),lc(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,lc(this),this)};Re.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Re.prototype.onCompile=function(){};var fC=Re;var Jm=Mh(xC(),1);var SC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var vC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}};var EC={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}};var yU={default:SC,zero:vC,commonmark:EC},_U=/^(vbscript|javascript|file|data):/,wU=/^data:image\/(gif|png|jpeg|webp);/;function xU(e){let t=e.trim().toLowerCase();return _U.test(t)?wU.test(t):!0}var CC=["http:","https:","mailto:"];function SU(e){let t=Ba(e,!0);if(t.hostname&&(!t.protocol||CC.indexOf(t.protocol)>=0))try{t.hostname=Jm.default.toASCII(t.hostname)}catch{}return Jl(Ho(t))}function vU(e){let t=Ba(e,!0);if(t.hostname&&(!t.protocol||CC.indexOf(t.protocol)>=0))try{t.hostname=Jm.default.toUnicode(t.hostname)}catch{}return Fa(Ho(t),Fa.defaultChars+"%")}function Le(e,t){if(!(this instanceof Le))return new Le(e,t);t||oc(e)||(t=e||{},e="default"),this.inline=new uC,this.block=new nC,this.core=new GE,this.renderer=new qE,this.linkify=new fC,this.validateLink=xU,this.normalizeLink=SU,this.normalizeLinkText=vU,this.utils=rm,this.helpers=Go({},sm),this.options={},this.configure(e),t&&this.set(t)}Le.prototype.set=function(e){return Go(this.options,e),this};Le.prototype.configure=function(e){let t=this;if(oc(e)){let r=e;if(e=yU[r],!e)throw new Error('Wrong `markdown-it` preset "'+r+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)}),this};Le.prototype.enable=function(e,t){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.enable(e,!0))},this),r=r.concat(this.inline.ruler2.enable(e,!0));let n=e.filter(function(o){return r.indexOf(o)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this};Le.prototype.disable=function(e,t){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.disable(e,!0))},this),r=r.concat(this.inline.ruler2.disable(e,!0));let n=e.filter(function(o){return r.indexOf(o)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this};Le.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};Le.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");let r=new this.core.State(e,this,t);return this.core.process(r),r.tokens};Le.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};Le.prototype.parseInline=function(e,t){let r=new this.core.State(e,this,t);return r.inlineMode=!0,this.core.process(r),r.tokens};Le.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var Ym=Le;var Zm="tab_clipboard_write",Xm=async({items:e})=>{if(navigator.clipboard?.write==null)throw new Error("navigator.clipboard.write is not available");let t=navigator.clipboard,r=i=>{let s=atob(i),a=new Uint8Array(s.length);for(let u=0;u<s.length;u+=1)a[u]=s.charCodeAt(u);return a.buffer},n=(i,s)=>({types:Object.keys(i),presentationStyle:s,getType:async a=>{let u=i[a];if(u==null)throw new DOMException(`No fake clipboard entry for ${a}`,"NotFoundError");return u}}),o=e.map(i=>{let s={};for(let a of i.entries){let u;if(typeof a.text=="string")u=a.text;else if(typeof a.base64=="string")u=r(a.base64);else throw new Error("Clipboard entry must include text or base64");s[a.mime_type]=new Blob([u],{type:a.mime_type})}if(i.presentation_style!=null&&i.presentation_style!=="unspecified"){if(typeof ClipboardItem!="function"){if(t.__browserUseFakeClipboard!==!0)throw new Error("ClipboardItem is not available");return n(s,i.presentation_style)}return new ClipboardItem(s,{presentationStyle:i.presentation_style})}if(typeof ClipboardItem!="function"){if(t.__browserUseFakeClipboard!==!0)throw new Error("ClipboardItem is not available");return n(s,"unspecified")}return new ClipboardItem(s)});await t.write(o)},TC=_(Zm,async(e,t)=>{let r=k(e.tab_id);return Vl(e.items,Zm),await Ie({args:{items:e.items},commandType:Zm,ctx:t,pageFunction:Xm,tabId:r}),{}});var EU=new Ym({breaks:!0,html:!1,linkify:!1,typographer:!1});async function pn(e,t,r){if(typeof e.text!="string")throw new Error(`${r} requires text`);let n=k(e.tab_id),o=e.includeRichText!==!1&&await TU(n,t),i=AU(e.text,o);Vl(i,r),await Ie({args:{items:i},commandType:r,ctx:t,pageFunction:Xm,tabId:n,...e.target!=null?{target:e.target}:{}}),await Ie({args:e.iabInputTargetToken==null?{replaceInputValue:e.replaceInputValue}:{iabInputTargetToken:e.iabInputTargetToken,replaceInputValue:e.replaceInputValue},commandType:r,ctx:t,pageFunction:Hl,tabId:n,...e.target!=null?{target:e.target}:{}})}function CU(e){return IU(EU.render(e),e)}async function TU(e,t){let r=await t.tabs.get(e);return kU(r.url)}function kU(e){return RU(e)!=="spreadsheets"}function AU(e,t){let r=[{mime_type:"text/plain",text:e}];return t&&r.push({mime_type:"text/html",text:CU(e)}),[{entries:r,presentation_style:"unspecified"}]}function IU(e,t){let r=e.trim();if(t.trim().length===0)return Qm(t);let n=Qm(t),o=Qm(Array.from(t).reverse(),!0),i="<p>",s="</p>";if(r.startsWith(i)&&r.endsWith(s)){let a=r.slice(i.length,-s.length);a.includes(i)||(r=n+a+o)}return r===e.trim()?n+r+o:r}function Qm(e,t=!1){let r=[];for(let n of e){if(/\r|\n|\u2028|\u2029/.test(n)){r.push("<br>");continue}if(/\s/.test(n)){r.push(" ");continue}break}return t&&r.reverse(),r.join("")}function RU(e){if(e==null)return null;let t;try{t=new URL(e)}catch{return null}if(t.host!=="docs.google.com")return null;let r=t.pathname.split("/").filter(Boolean)[0];return r!=="document"&&r!=="spreadsheets"&&r!=="presentation"?null:r}var eh=_("cua_type",async(e,t)=>(await pn(e,t,eh.type),{}));var kC=_("browser_user_claim_tab",async(e,t)=>{let r=k(e.tab_id),n=await t.browserUser.claimTab(r);return{id:String(n.id),...n.title==null?{}:{title:n.title},...n.url==null?{}:{url:n.url}}});var AC=_("browser_user_history",async(e,t)=>{let r=PU(e);return{items:(await t.browserUser.history(r)).map(o=>({url:o.url,...o.title==null?{}:{title:o.title},dateVisited:o.dateVisited}))}});function PU(e){let t={};if(e.query!=null){if(typeof e.query!="string")throw new Error("browser_user_history requires query to be a string");t.query=e.query}if(e.limit!=null){if(!Number.isInteger(e.limit)||e.limit<=0)throw new Error("browser_user_history requires limit to be a positive integer");t.limit=e.limit}if(e.from!=null){if(typeof e.from!="string"||Number.isNaN(Date.parse(e.from)))throw new Error("browser_user_history requires from to be a valid date");t.from=e.from}if(e.to!=null){if(typeof e.to!="string"||Number.isNaN(Date.parse(e.to)))throw new Error("browser_user_history requires to to be a valid date");t.to=e.to}return t}var IC=_("browser_user_open_tabs",async(e,t)=>({tabs:(await t.browserUser.openTabs()).map(n=>({id:String(n.id),...n.title==null?{}:{title:n.title},...n.url==null?{}:{url:n.url},...n.lastOpened==null?{}:{lastOpened:n.lastOpened},...n.tabGroup==null?{}:{tabGroup:n.tabGroup}}))}));var RC=_(oe.WebMcpInvokeTool,async(e,t)=>{if(!(t.clientInfo.capabilities?.tab?.some(i=>i.id===nn.id)===!0))throw Du(t.clientInfo.name,{type:oe.WebMcpInvokeTool.commandType});let n=k(e.tab_id);return{result:await t.cdp.evaluateJavascript(n,`(() => {
const modelContext = navigator.modelContext;
if (
!modelContext ||
typeof modelContext.getTools !== "function" ||
typeof modelContext.executeTool !== "function"
) {
throw new Error("WebMCP modelContext is unavailable in the current page.");
}
return Promise.resolve(modelContext.getTools())
.then((tools) => {
const tool = tools.find(
(candidate) => candidate.name === ${JSON.stringify(e.tool_name)},
);
if (!tool) {
throw new Error(
${JSON.stringify(`WebMCP tool not found: ${e.tool_name}`)},
);
}
return modelContext.executeTool(
tool,
${JSON.stringify(JSON.stringify(e.input??null))},
);
})
.then((result) => {
if (result == null) {
return null;
}
try {
return JSON.parse(result);
} catch {
return result;
}
});
})()`,{awaitPromise:!0,timeoutMs:e.timeout_ms})??null}});var DU=1e4,NU="WebMCP listTools failed: no result returned.",PC=_(oe.WebMcpListTools,async(e,t)=>{if(!(t.clientInfo.capabilities?.tab?.some(i=>i.id===nn.id)===!0))throw Du(t.clientInfo.name,{type:oe.WebMcpListTools.commandType});let n=k(e.tab_id),o=await t.cdp.evaluateJavascript(n,`(() => {
const modelContext = navigator.modelContext;
if (!modelContext || typeof modelContext.getTools !== "function") {
throw new Error("WebMCP modelContext is unavailable in the current page.");
}
return Promise.resolve(modelContext.getTools()).then((tools) =>
tools.map((tool) => ({
name: tool.name,
title: tool.title,
description: tool.description,
input_schema: tool.inputSchema ?? null,
annotations: tool.annotations,
origin: tool.origin,
pageUrl: tool.pageUrl,
})),
);
})()`,{awaitPromise:!0,timeoutMs:DU});if(!Array.isArray(o))throw new Error(NU);return{tools:o.map(i=>{try{return{...i,input_schema:i.input_schema==null?null:JSON.parse(i.input_schema)}}catch{throw new Error("WebMCP tool inputSchema is not valid JSON.")}})}});var DC=_("dom_cua_click",async(e,t)=>{if(typeof e.node_id!="string"||e.node_id.length===0)throw new Error("dom_cua_click requires node_id");return await t.cua.clickDomCuaNode({clickCount:1,nodeId:e.node_id,tabId:k(e.tab_id),timeoutMs:e.timeout_ms}),{}});var NC=_("dom_cua_double_click",async(e,t)=>{if(typeof e.node_id!="string"||e.node_id.length===0)throw new Error("dom_cua_double_click requires node_id");return await t.cua.clickDomCuaNode({clickCount:2,nodeId:e.node_id,tabId:k(e.tab_id),timeoutMs:e.timeout_ms}),{}});var OU="browser-use-dom-cua",OC=new WeakSet,mr=new Map,fn=new Map;function BC(e){OC.has(e)||(OC.add(e),e.addTabCleanupHandler(t=>{fn.delete(t);for(let r of mr.keys())r.startsWith(`${t}:`)&&mr.delete(r)}))}function LC(e,t){let r=fn.get(e),n=r?.mainFrameKey===t?r:{framesById:new Map,mainFrameKey:t,nextPublicId:1,nodeByPublicId:new Map,publicIdByFrameLocalRef:new Map};n.framesById.clear(),n.nodeByPublicId.clear(),n.publicIdByFrameLocalRef.size>5e3&&(n.publicIdByFrameLocalRef.clear(),n.nextPublicId=1),fn.set(e,n)}function UC(e,t){let r=fn.get(e);r?.framesById.set(t.frameId,t)}function jC(e,t,r,n){let o=fn.get(e);if(o==null)throw new Error("DOM CUA snapshot state is missing");let i=FU(t,r),s=o.publicIdByFrameLocalRef.get(i);return s==null&&(s=String(o.nextPublicId++),o.publicIdByFrameLocalRef.set(i,s)),o.nodeByPublicId.set(s,{frameId:t.frameId,loaderId:t.loaderId,localRef:r,target:t.target,viewportClip:n}),s}function qC(e,t){let r=fn.get(e)?.nodeByPublicId.get(t);if(r==null)throw new Error(`DOM node ${t} is stale or missing`);return r}async function qa(e,t,r,n,o,i){let s=await MC(e,t,r,n,i.timeoutMs);try{return await FC(e,t,s,o,i)}catch(a){if(!UU(a))throw a;return mr.delete(WC(t,r,n)),s=await MC(e,t,r,n,i.timeoutMs),await FC(e,t,s,o,i)}}async function MU(e,t,r,n={}){let{backendNodeId:o}=await e.callTarget(t,"DOM.getFrameOwner",{frameId:r},{timeoutMs:n.timeoutMs}),{quads:i}=await e.callTarget(t,"DOM.getContentQuads",{backendNodeId:o},{timeoutMs:n.timeoutMs});return LU(i[0])}async function $C(e,t,r,n){let o=fn.get(e);if(o==null)throw new Error(`Missing DOM CUA frame ${r}`);let i=o.framesById.get(r);if(i==null)throw new Error(`Missing DOM CUA frame ${r}`);let s=n;for(;i?.parentFrameId!=null;){let a=o.framesById.get(i.parentFrameId);if(a==null)throw new Error(`Missing parent DOM CUA frame ${i.frameId}`);let u=await MU(t,a.target,i.frameId);if(u==null)throw new Error(`Missing frame geometry for DOM CUA frame ${r}`);s={x:u.left+s.x,y:u.top+s.y},i=a}return s}function th(e,t){let r={bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top)};return r.right>r.left&&r.bottom>r.top?r:null}function zC(e,t){let r=th(e,t);return r==null?null:{bottom:r.bottom-e.top,left:r.left-e.left,right:r.right-e.left,top:r.top-e.top}}async function MC(e,t,r,n,o){let i=WC(t,r,n),s=mr.get(i);if(s!=null)return s;let u={executionContextId:(await e.callTarget(t,"Page.createIsolatedWorld",{frameId:r,grantUniveralAccess:!1,worldName:OU},{timeoutMs:o})).executionContextId};if(mr.set(i,u),mr.size>50){let l=mr.keys().next().value;l!=null&&mr.delete(l)}return u}async function FC(e,t,r,n,o){return await e.callTarget(t,"Runtime.evaluate",{awaitPromise:!0,contextId:r.executionContextId,expression:n,returnByValue:o.returnByValue,timeout:o.timeoutMs},{timeoutMs:o.timeoutMs})}function FU(e,t){return`${e.frameId}:${e.loaderId??""}:${t}`}function WC(e,t,r){return`${BU(e)}:${t}:${r??""}`}function BU(e){return`${e.tabId}:${e.sessionId??""}:${e.targetId??""}`}function LU(e){if(e==null||e.length<8)return null;let t=[e[0],e[2],e[4],e[6]],r=[e[1],e[3],e[5],e[7]];return t.some(n=>n==null)||r.some(n=>n==null)?null:{bottom:Math.max(...r),left:Math.min(...t),right:Math.max(...t),top:Math.min(...r)}}function UU(e){let t=e instanceof Error?e.message:String(e);return/Cannot find context|Execution context was destroyed|context.*destroyed|context.*not found/i.test(t)}var jU=new Set(["a","button","details","input","option","select","summary","textarea"]),qU=["aria-disabled","aria-label","contenteditable","href","name","placeholder","role","title","type","value"],$U=["checked","disabled","multiple","readonly","required","selected"],zU=["button","checkbox","combobox","link","menuitem","option","radio","slider","spinbutton","switch","tab","textbox"],$a=2e4,dc=200,WU=500,HC=1e3,VC="const __name = (target) => target;",GC=_("dom_cua_get_visible_dom",async(e,t)=>{let r=k(e.tab_id);return await HU(r,t.cdp)});async function HU(e,t){BC(t);let{frameTree:r}=await t.call(e,"Page.getFrameTree"),n=YU(r.frame);LC(e,n);let o={chars:0,lines:[]},i=await KC({cdp:t,childFrameDeadline:Date.now()+HC,frameReference:{frameId:r.frame.id,loaderId:r.frame.loaderId,target:{tabId:e}},output:o,tabId:e,viewportClip:void 0});return i?.viewportClip==null||!rh(o)||await JC({childFrames:i.childFrames,cdp:t,childFrameDeadline:Date.now()+HC,frameReference:i.frame,output:o,tabId:e,viewportClip:i.viewportClip}),o.lines.join(`
`)}function VU(e,t,r){let n={booleanAttributeNames:$U,codexOverlayRootId:Ny,interactiveRoleNames:zU,interactiveTags:[...jU],maxChars:e,maxElements:t,renderedAttributeNames:qU,viewportClip:r};return`(() => {
${VC}
return (${t8.toString()})(${JSON.stringify(n)});
})()`}async function KC(e){if(e.output.lines.length>=dc||e.output.chars>=$a||e.frameReference.parentFrameId!=null&&Date.now()>=e.childFrameDeadline)return null;let t=e.frameReference;UC(e.tabId,t);let r=dc-e.output.lines.length,n=$a-e.output.chars,o=await GU(e.cdp,t,n,r,e.viewportClip,t.parentFrameId==null?void 0:nh(e.childFrameDeadline)).catch(s=>{if(t.parentFrameId!=null)return null;throw s});if(o==null)return null;let i=e.viewportClip==null?o.viewport:th(e.viewportClip,o.viewport);if(i==null)return{childFrames:[],frame:t,viewportClip:i};for(let s of o.items){if(e.output.lines.length>=dc||e.output.chars>=$a)break;let a=jC(e.tabId,t,s.ref,i),u=s.line.replace(`node_id=${s.ref}`,`node_id=${a}`),l=u.length+(e.output.lines.length===0?0:1);if(e.output.chars+l>$a)break;e.output.lines.push(u),e.output.chars+=l}return{childFrames:o.frameElements,frame:t,viewportClip:i}}async function JC(e){if(rh(e.output))for(let t of e.childFrames){if(!rh(e.output)||Date.now()>=e.childFrameDeadline)break;let r=zC(t.rect,e.viewportClip);if(r==null)continue;let n=await KU(e.cdp,e.frameReference,t.ref,nh(e.childFrameDeadline)).catch(()=>null);if(n==null)continue;let o=await e.cdp.targetForFrameOrAttach(e.tabId,n,{timeoutMs:nh(e.childFrameDeadline)},t.url==null?{}:{url:t.url}).catch(()=>null)??e.frameReference.target,i=await KC({cdp:e.cdp,childFrameDeadline:e.childFrameDeadline,frameReference:{frameId:n,parentFrameId:e.frameReference.frameId,target:o},output:e.output,tabId:e.tabId,viewportClip:r});i?.viewportClip!=null&&await JC({childFrames:i.childFrames,cdp:e.cdp,childFrameDeadline:e.childFrameDeadline,frameReference:i.frame,output:e.output,tabId:e.tabId,viewportClip:i.viewportClip})}}function rh(e){return e.lines.length<dc&&e.chars<$a}async function GU(e,t,r,n,o,i){let s=await qa(e,t.target,t.frameId,t.loaderId,VU(r,n,o),{returnByValue:!0,timeoutMs:i});if(s.exceptionDetails!=null)throw new Error(YC(s.exceptionDetails));return ZU(s.result.value)}async function KU(e,t,r,n){let o=await qa(e,t.target,t.frameId,t.loaderId,JU(r),{returnByValue:!1,timeoutMs:n});if(o.exceptionDetails!=null)throw new Error(YC(o.exceptionDetails));let i=o.result.objectId;if(typeof i!="string")return null;try{let{node:s}=await e.callTarget(t.target,"DOM.describeNode",{objectId:i},{timeoutMs:n});return typeof s.frameId=="string"?s.frameId:null}finally{await e.callTarget(t.target,"Runtime.releaseObject",{objectId:i},{timeoutMs:n}).catch(()=>{})}}function JU(e){return`(() => {
${VC}
const state = globalThis.__browserUseVisibleDomState;
return state?.refToElement?.get(${JSON.stringify(e)}) ?? null;
})()`}function nh(e){return Math.max(1,Math.min(WU,e-Date.now()))}function YU(e){return`${e.id}:${e.loaderId??""}`}function ZU(e){if(e==null||typeof e!="object")return null;let t=e;return!Array.isArray(t.items)||t.viewport==null?null:{frameElements:Array.isArray(t.frameElements)?t.frameElements.filter(XU):[],items:t.items.filter(QU),viewport:t.viewport}}function XU(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.ref=="string"&&e8(t.rect)&&(t.url==null||typeof t.url=="string")}function QU(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.ref=="string"&&typeof t.line=="string"}function e8(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.bottom=="number"&&Number.isFinite(t.bottom)&&typeof t.left=="number"&&Number.isFinite(t.left)&&typeof t.right=="number"&&Number.isFinite(t.right)&&typeof t.top=="number"&&Number.isFinite(t.top)}function t8(e){let t=new Set(e.interactiveTags),r=new Set(e.interactiveRoleNames),n=[],o=[],i=0,s=!1,a=globalThis,u=a.__browserUseVisibleDomState??(a.__browserUseVisibleDomState={elementToRef:new WeakMap,nextId:1,refToElement:new Map});u.refToElement.clear();let l=window.visualViewport,d=l?{bottom:l.offsetTop+l.height,left:l.offsetLeft,right:l.offsetLeft+l.width,top:l.offsetTop}:{bottom:window.innerHeight,left:0,right:window.innerWidth,top:0},p=e.viewportClip==null?d:{bottom:Math.min(d.bottom,e.viewportClip.bottom),left:Math.max(d.left,e.viewportClip.left),right:Math.min(d.right,e.viewportClip.right),top:Math.max(d.top,e.viewportClip.top)},f=M=>(M.localName||M.nodeName||"").toLowerCase(),m=new Set(["noscript","script","style","template"]),h=M=>M.getAttribute("id")===e.codexOverlayRootId,y=M=>{let q=f(M);if(M.getAttribute("aria-hidden")==="true"||M.hasAttribute("hidden")||q==="input"&&M.getAttribute("type")==="hidden")return!1;let z=M.getAttribute("contenteditable"),Q=M.getAttribute("role");return t.has(q)||z!=null&&z.toLowerCase()!=="false"||M.hasAttribute("href")||M.hasAttribute("onclick")||Q!=null&&r.has(Q.trim().toLowerCase())||Number(M.getAttribute("tabindex")??-1)>=0},S=M=>{let q=f(M);return q==="frame"||q==="iframe"},D=M=>{let q=window.getComputedStyle(M);if(q.visibility!=="visible"||q.display==="none"||q.pointerEvents==="none"||Number(q.opacity)<=.01)return null;for(let z of M.getClientRects())if(!(z.width<=0||z.height<=0||z.right<=p.left||z.left>=p.right||z.bottom<=p.top||z.top>=p.bottom))return{bottom:z.bottom,left:z.left,right:z.right,top:z.top};return null},w=M=>D(M)!=null,x=M=>M.replace(/\s+/g," ").trim(),E=M=>M.replace(/[\t\n\f\r]+/g," ").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',"""),I=M=>{let q=[],z=0,Q=Pe=>{if(!(z>=160)){if(Pe.nodeType===Node.TEXT_NODE){let we=x(Pe.nodeValue||"");we.length>0&&(q.push(we),z+=we.length+1);return}if(!(Pe.nodeType===Node.ELEMENT_NODE&&m.has(f(Pe)))){for(let we of Pe.childNodes||[]){if(z>=160)break;Q(we)}if(Pe.nodeType===Node.ELEMENT_NODE){let we=Pe;if(!we.shadowRoot)return;for(let ni of we.shadowRoot.childNodes){if(z>=160)break;Q(ni)}}}}};return Q(M),x(q.join(" ")).slice(0,160)},C=M=>{let q=u.elementToRef.get(M);return q==null&&(q=String(u.nextId++),u.elementToRef.set(M,q)),q},j=(M,q)=>{let z=[`node_id=${q}`];for(let we of e.renderedAttributeNames){let ni=M.getAttribute(we);ni!=null&&ni!==""&&z.push(`${we}="${E(ni)}"`)}for(let we of e.booleanAttributeNames)M.hasAttribute(we)&&z.push(`${we}="true"`);let Q=f(M),Pe=I(M);return Pe.length===0?`<${Q} ${z.join(" ")} />`:`<${Q} ${z.join(" ")}>${E(Pe)}</${Q}>`},X=()=>s||o.length>=e.maxElements||i>=e.maxChars,ae=M=>{if(X())return;let q=C(M),z=j(M,q),Q=z.length+(o.length===0?0:1);if(i+Q>e.maxChars){s=!0;return}o.push({line:z,ref:q}),u.refToElement.set(q,M),i+=Q},ye=M=>{if(n.length>=e.maxElements)return;let q=D(M);if(q==null)return;let z=C(M),Q=M.src;n.push({rect:q,ref:z,...Q.length>0?{url:Q}:{}}),u.refToElement.set(z,M)},me=M=>{if(X())return;if(M.nodeType===Node.DOCUMENT_NODE){let z=M.documentElement;z&&me(z);return}if(M.nodeType===Node.DOCUMENT_FRAGMENT_NODE){for(let z of M.children){if(X())break;me(z)}return}if(M.nodeType!==Node.ELEMENT_NODE)return;let q=M;if(!h(q)){S(q)&&ye(q),y(q)&&w(q)&&ae(q),q.shadowRoot&&!X()&&me(q.shadowRoot);for(let z of q.children){if(X())break;me(z)}}};return me(document),{frameElements:n,items:o,viewport:d}}function YC(e){let t=e.exception;return typeof t?.value=="string"?t.value:t?.description??e.text??"Visible DOM evaluation failed"}var ZC=_("dom_cua_keypress",async(e,t)=>(Array.isArray(e.keys)?$o(e.keys):null)==="paste"?(await Wo({commandType:"dom_cua_keypress",ctx:t,tabId:e.tab_id}),{}):(await t.cua.dispatchKeyPress({commandName:"dom_cua_keypress",keys:e.keys,tabId:e.tab_id}),{}));var XC=_("dom_cua_scroll",async(e,t)=>{let r=k(e.tab_id);if(e.node_id!=null&&(typeof e.node_id!="string"||e.node_id.length===0))throw new Error("dom_cua_scroll requires node_id to be a string");if(e.node_id!=null)return await t.cua.scrollDomCuaNode({nodeId:e.node_id,scrollX:e.scroll_x,scrollY:e.scroll_y,tabId:r}),{};let n=await r8(t.cdp,r);return await t.cua.scrollPoint({modifiers:0,point:n,scrollX:e.scroll_x,scrollY:e.scroll_y,tabId:r}),{}});async function r8(e,t){let{cssVisualViewport:r}=await e.call(t,"Page.getLayoutMetrics");return{x:r.clientWidth/2,y:r.clientHeight/2}}var oh=_("dom_cua_type",async(e,t)=>(await pn(e,t,oh.type),{}));var QC=_("close_tab",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("close_tab requires a positive integer tab_id");return await t.cdp.closeTab(r),{}});var eT=_("create_tab",async(e,t)=>({id:(await t.tabs.create()).id.toString()}));var tT=_("finalize_tabs",async(e,t)=>{let n=(e.keep??[]).map(o=>({tabId:k(o.tab_id),status:o.status}));return await t.tabs.finalize(n),{}});var rT=_("list_tabs",async(e,t)=>({tabs:(await t.tabs.list()).map(n=>({id:n.id.toString(),...n.url==null?{}:{url:n.url},...n.title==null?{}:{title:n.title}}))}));var nT=_("name_session",async(e,t)=>{let r=e.name.trim();if(!r)throw new Error("name_session requires a name");return await t.nameSession(r),{}});var oT=_("navigate_tab_back",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_back requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=await t.cdp.call(r,"Page.getNavigationHistory"),i=o.entries[o.currentIndex-1];if(!i)throw new Error("Cannot navigate back: no previous page in history.");let s=t.cdp.waitForPageLoadEvent(r,{timeoutMs:n});return await t.cdp.call(r,"Page.navigateToHistoryEntry",{entryId:i.id}),await s,{}});var iT=_("navigate_tab_forward",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_forward requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=await t.cdp.call(r,"Page.getNavigationHistory"),i=o.entries[o.currentIndex+1];if(!i)throw new Error("Cannot navigate forward: no next page in history.");let s=t.cdp.waitForPageLoadEvent(r,{timeoutMs:n});return await t.cdp.call(r,"Page.navigateToHistoryEntry",{entryId:i.id}),await s,{}});var sT=_("navigate_tab_reload",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_reload requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=t.cdp.waitForPageLoadEvent(r,{timeoutMs:n});return await t.cdp.call(r,"Page.reload",{}),await o,{}});import n8 from"node:events";var o8="Page.navigationBlocked",aT=1e3;function Wa(e){return e.sessionId!=null||e.targetId!=null}var pc=class extends n8{constructor(r){super();this.api=r;this.api.addEventListener("onCDPEvent",n=>{let o=this.attachedTabIdForCdpEvent(n.source);o!=null&&(this.recordRawCdpEvent(o,n),this.handleTargetEvent(n),this.emit("event",n))}),this.addTabAttachHandler(async n=>{await this.call(n,"Page.enable"),await this.enableOopifAutoAttach(n)}),this.addTabCleanupHandler(async n=>{await this.detachAttachedFrameTargets(n)}),this.on("event",n=>{this.handleJavaScriptDialogOpening(n)})}api;fileChoosersById=new Map;attachedTabIds=new Set;tabAttachHandlers=new Set;tabCleanupHandlers=new Set;frameSessionsByTabId=new Map;frameSessionsBySessionId=new Map;attachedFrameTargetIdsByTabId=new Map;oopifAutoAttachTabIds=new Set;rawCdpEventsByTabId=new Map;rawCdpEventEvictedThroughSequenceByTabId=new Map;rawCdpEventSequenceByTabId=new Map;async call(r,n,o,i={}){let s=Number(r);if(!Number.isFinite(s))throw new Error("callCdp requires numeric tab_id");return await this.callTarget({tabId:s},n,o,i)}async callTarget(r,n,o,i={}){return await this.executeTargetCdp(r,n,o,i)}async callRawCdp(r,n,o,i={}){let s=Number(r);if(!Number.isFinite(s))throw new Error("callRawCdp requires numeric tab_id");let{target:a,...u}=i;return await this.executeTargetCdp(this.rawCdpTarget(s,a),n,o,{...u,telemetryAttrs:c8(u.telemetryAttrs)})}async readRawCdpEvents(r,n={}){let o=Number(r);if(!Number.isFinite(o))throw new Error("readRawCdpEvents requires numeric tab_id");let i=n.afterSequence??(n.timeoutMs==null?void 0:this.rawCdpEventSequenceForTab(o));await this.ensureAttachedTab(o);let s=i??this.rawCdpEventSequenceForTab(o),a=this.rawCdpEventsResult(o,s,n);return a.events.length>0||n.timeoutMs==null||n.timeoutMs<=0?a:await new Promise(u=>{let l=!1,d=()=>{this.removeListener("event",f),this.removeListener("tabDetached",m),clearTimeout(h)},p=()=>{l||(l=!0,d(),u(this.rawCdpEventsResult(o,s,n)))},f=()=>{this.rawCdpEventsResult(o,s,n).events.length>0&&p()},m=y=>{y===o&&p()},h=setTimeout(p,n.timeoutMs);this.addListener("event",f),this.addListener("tabDetached",m),this.rawCdpEventsResult(o,s,n).events.length>0&&p()})}async executeTargetCdp(r,n,o,i={}){return await this.ensureAttachedTab(r.tabId),await jf("browser_use.cdp.execute",{"browser_use.cdp.domain":l8(n),"browser_use.cdp.method":n,"browser_use.tab.id":r.tabId,"tab.id":r.tabId,...nE(),...d8(n,o),...i.telemetryAttrs},async()=>{try{return await this.api.executeCdp({target:r,method:n,commandParams:o??{},timeoutMs:i.timeoutMs})}catch(s){if((s==="Debugger unattached"||typeof s=="string"&&s.includes("Debugger is not attached"))&&(this.forgetAttachedTab(r.tabId),r.sessionId==null&&r.targetId==null))return this.executeTargetCdp(r,n,o,i);throw s}})}async enableOopifAutoAttach(r,n={}){let o=Number(r);if(!Number.isFinite(o))throw new Error("enableOopifAutoAttach requires numeric tab_id");this.oopifAutoAttachTabIds.has(o)||(await this.ensureAttachedTab(o),!this.oopifAutoAttachTabIds.has(o)&&(await this.enableOopifAutoAttachForTarget({tabId:o},n),this.oopifAutoAttachTabIds.add(o)))}targetForFrame(r,n){let o=Number(r);return Number.isFinite(o)?this.frameSessionsByTabId.get(o)?.get(n)?.target??null:null}async targetForFrameOrAttach(r,n,o={},i={}){if(n!=null){let h=this.targetForFrame(r,n);if(h!=null)return h}let s=Number(r);if(!Number.isFinite(s))return null;await this.ensureAttachedTab(s);let l=((await this.callTarget({tabId:s},"Target.getTargets",{},o).catch(()=>null))?.targetInfos.filter(h=>s8(h,s))??[]).filter(h=>a8(h,i)),d=l.find(h=>za(h)===n),p=i.url==null?[]:l.filter(h=>h.url===i.url),f=za(d)??(p.length===1?za(p[0]):void 0)??n;return f==null?null:await this.attachDebuggerFrameTarget(s,f,n)??(n==null?null:this.targetForFrame(s,n))}async attachDebuggerFrameTarget(r,n,o){let i=`target:${n}`,s=this.frameSessionsBySessionId.get(i);if(s!=null)return o!=null&&this.setFrameSessionForFrame(r,o,s),s.target;let a=this.api;if(typeof a.attachTarget!="function"||!await a.attachTarget(r,n).then(()=>!0).catch(()=>!1))return null;let l={frameId:null,sessionId:i,target:{tabId:r,targetId:n},targetId:n};return this.frameSessionsBySessionId.set(i,l),this.setFrameSessionForFrame(r,o??n,l),this.rememberAttachedFrameTarget(r,n),await this.initializeAttachedFrameSession(l).catch(()=>{}),l.target}async evaluateJavascript(r,n,o={}){let i={expression:n,returnByValue:o.returnByValue??!0};o.awaitPromise!=null&&(i.awaitPromise=o.awaitPromise);let s=await this.call(r,"Runtime.evaluate",i,{telemetryAttrs:o.telemetryAttrs,timeoutMs:o.timeoutMs});if(s.exceptionDetails!=null)throw new Error(i8(s.exceptionDetails));return s.result?.value}async readDocumentState(r){try{return await this.evaluateJavascript(r,"({ href: window.location.href, readyState: document.readyState })",{telemetryAttrs:{"browser_use.cdp.eval.kind":"document_state"}})}catch{return}}async waitForPageLoadEvent(r,n){let o=n.classificationTimeoutMs??250,i=g8(r),s;try{s=await this.waitForEvent(i.tabId,u=>uT(u,i)&&(jt(u)||_8(u)),{timeoutMs:o,timeoutMessage:"Timed out waiting for page load start."})}catch{return}hr(s);let a;try{a=await this.waitForEvent(i.tabId,u=>uT(u,i)&&(jt(u)||w8(u)),{timeoutMs:n.timeoutMs,timeoutMessage:"Timed out waiting for page load completion."})}catch{return}hr(a)}waitForEvent(r,n,o){let i=Number(r);if(!Number.isFinite(i))throw new Error("waitForEvent requires numeric tab_id");return new Promise((s,a)=>{let u=!1,l=()=>{this.removeListener("event",m),clearTimeout(h),o.signal?.removeEventListener("abort",f)},d=y=>{u||(u=!0,l(),s(y))},p=y=>{u||(u=!0,l(),a(y))},f=()=>{p(new Error("waitForEvent aborted"))},m=y=>{if(y.source.tabId===i)try{n(y)&&d(y)}catch(S){p(S instanceof Error?S:new Error(`waitForEvent predicate failed: ${String(S)}`));return}},h=setTimeout(()=>{p(new Error(o.timeoutMessage))},o.timeoutMs);if(o.signal?.aborted){f();return}o.signal?.addEventListener("abort",f,{once:!0}),this.addListener("event",m)})}async detachAllTabs(){let r=[...this.attachedTabIds];await Promise.allSettled(r.map(async n=>this.detachTab(n)))}async closeTab(r){let n=Number(r);if(!Number.isFinite(n))throw new Error("closeTab requires numeric tab_id");let i=(await this.call(r,"Target.getTargets",{})).targetInfos.find(s=>"tabId"in s?s.tabId===n:!1);await this.ensureAttachedTab(n);try{await this.runTabCleanupHandlers(n);let s=za(i);s!=null?await this.api.executeCdp({target:{tabId:n},method:"Target.closeTarget",commandParams:{targetId:s}}):await this.api.executeCdp({target:{tabId:n},method:"Page.close",commandParams:{}})}finally{this.forgetAttachedTab(n)}}async detachTab(r){let n=Number(r);if(!Number.isFinite(n))throw new Error("detachTab requires numeric tab_id");if(this.attachedTabIds.has(n))try{await this.runTabCleanupHandlers(n),await this.api.detach(n)}finally{this.forgetAttachedTab(n)}}addTabCleanupHandler(r){return this.tabCleanupHandlers.add(r),()=>{this.tabCleanupHandlers.delete(r)}}addTabAttachHandler(r){return this.tabAttachHandlers.add(r),()=>{this.tabAttachHandlers.delete(r)}}async runTabAttachHandlers(r){await Promise.allSettled([...this.tabAttachHandlers].map(async n=>n(r)))}async runTabCleanupHandlers(r){await Promise.allSettled([...this.tabCleanupHandlers].map(async n=>n(r)))}deleteFileChoosersForTab(r){for(let[n,o]of this.fileChoosersById)o.tabId===r&&this.fileChoosersById.delete(n)}async ensureAttachedTab(r){this.attachedTabIds.has(r)||(await this.api.attach(r),await this.enableFocusEmulation(r),this.attachedTabIds.add(r),this.emit("tabAttached",r),await this.runTabAttachHandlers(r))}async enableFocusEmulation(r){try{await this.api.executeCdp({target:{tabId:r},method:"Emulation.setFocusEmulationEnabled",commandParams:{enabled:!0}})}catch{}}async enableOopifAutoAttachForTarget(r,n={}){let o={autoAttach:!0,flatten:!0,waitForDebuggerOnStart:!1};try{await this.api.executeCdp({target:r,method:"Target.setAutoAttach",commandParams:{...o,filter:[{type:"iframe",exclude:!1}]},timeoutMs:n.timeoutMs})}catch{try{await this.api.executeCdp({target:r,method:"Target.setAutoAttach",commandParams:o,timeoutMs:n.timeoutMs})}catch{}}}recordRawCdpEvent(r,n){let o=n.source.targetId??(n.source.sessionId==null?void 0:this.frameSessionsBySessionId.get(n.source.sessionId)?.targetId),i={method:n.method,...n.params==null?{}:{params:m8(n.params)},sequence:this.nextRawCdpEventSequence(r),source:n.source,...o==null?{}:{trackedTargetId:o}},s=this.rawCdpEventsByTabId.get(r)??[];if(s.push(i),s.length>aT){let u=s.splice(0,s.length-aT).at(-1);u!=null&&this.rawCdpEventEvictedThroughSequenceByTabId.set(r,u.sequence)}this.rawCdpEventsByTabId.set(r,s)}attachedTabIdForCdpEvent(r){if(typeof r.tabId=="number")return this.attachedTabIds.has(r.tabId)?r.tabId:void 0;if(r.sessionId!=null)return this.frameSessionsBySessionId.get(r.sessionId)?.target.tabId;if(r.targetId!=null){for(let[n,o]of this.frameSessionsByTabId)if(o.has(r.targetId))return n}}rawCdpEventsResult(r,n,o){let i=this.rawCdpEventsByTabId.get(r)??[],s=n<(this.rawCdpEventEvictedThroughSequenceByTabId.get(r)??0),a=i.filter(m=>m.sequence>n&&f8(m,o.methods)&&this.matchesRawCdpEventTarget(m,o.target)),u=o.limit??a.length,l=a.slice(0,u).map(h8),d=a.length>l.length,p=l.at(-1);return{cursor:d&&p!=null?p.sequence:this.rawCdpEventSequenceForTab(r),events:l,hasMore:d,truncated:s}}rawCdpEventSequenceForTab(r){return this.rawCdpEventSequenceByTabId.get(r)??0}nextRawCdpEventSequence(r){let n=this.rawCdpEventSequenceForTab(r)+1;return this.rawCdpEventSequenceByTabId.set(r,n),n}rawCdpTarget(r,n){if(n?.sessionId!=null&&n.targetId!=null)throw new Error("CDP target must provide either sessionId or targetId, not both.");if(n?.sessionId!=null){let o=this.frameSessionsBySessionId.get(n.sessionId);if(o?.target.tabId!==r)throw new Error(`CDP session ${n.sessionId} is not attached to tab ${r}.`);return o.target}if(n?.targetId!=null){let o=this.frameSessionsByTabId.get(r)?.get(n.targetId);if(o==null)throw new Error(`CDP target ${n.targetId} is not attached to tab ${r}.`);return o.target}return{tabId:r}}matchesRawCdpEventTarget(r,n){return n?.sessionId!=null?r.source.sessionId===n.sessionId:n?.targetId==null?!0:r.source.targetId===n.targetId||r.trackedTargetId===n.targetId}discardRawCdpEventsForTab(r){let n=this.rawCdpEventSequenceForTab(r);n>0&&this.rawCdpEventEvictedThroughSequenceByTabId.set(r,Math.max(n,this.rawCdpEventEvictedThroughSequenceByTabId.get(r)??0)),this.rawCdpEventsByTabId.delete(r)}forgetAttachedTab(r){this.attachedTabIds.has(r)&&(this.deleteFileChoosersForTab(r),this.deleteFrameSessionsForTab(r),this.oopifAutoAttachTabIds.delete(r),this.discardRawCdpEventsForTab(r),this.attachedTabIds.delete(r),this.emit("tabDetached",r))}handleTargetEvent(r){if(r.method==="Target.attachedToTarget"){this.handleAttachedToTarget(r);return}if(r.method==="Target.detachedFromTarget"){this.handleDetachedFromTarget(r);return}if(r.method==="Page.frameNavigated"){this.handleFrameNavigated(r);return}r.method==="Page.frameDetached"&&this.handleFrameDetached(r)}handleAttachedToTarget(r){let n=r.source.tabId,o=r.params.targetInfo,i=r.params.sessionId;if(typeof n!="number"||typeof i!="string"||!u8(o))return;let s=za(o);if(s==null)return;let a=this.frameSessionsBySessionId.get(i);if(a!=null){this.setFrameSessionTargetId(n,s,a);return}let u={frameId:null,sessionId:i,target:{tabId:n,sessionId:i},targetId:s};this.frameSessionsBySessionId.set(i,u),this.setFrameSessionTargetId(n,s,u),this.initializeAttachedFrameSession(u).catch(()=>{})}handleDetachedFromTarget(r){let n=this.frameSessionsBySessionId.get(r.params.sessionId);n!=null&&this.deleteFrameSession(n)}handleFrameNavigated(r){let n=r.source.sessionId,o=r.source.tabId,i=r.params.frame.id;if(typeof o!="number"||typeof n!="string")return;let s=this.frameSessionsBySessionId.get(n);s!=null&&(s.frameId!=null&&s.frameId!==i||this.setFrameSessionForFrame(o,i,s))}handleFrameDetached(r){let n=r.source.tabId;if(typeof n!="number")return;let o=this.frameSessionsByTabId.get(n)?.get(r.params.frameId);o!=null&&this.deleteFrameSession(o)}async initializeAttachedFrameSession(r){await this.enableOopifAutoAttachForTarget(r.target),await this.api.executeCdp({target:r.target,method:"Page.enable",commandParams:{}}),await this.api.executeCdp({target:r.target,method:"Runtime.enable",commandParams:{}});let n=await this.api.executeCdp({target:r.target,method:"Page.getFrameTree",commandParams:{}});if(this.frameSessionsBySessionId.get(r.sessionId)!==r)return;let o=n.frameTree.frame.id;this.setFrameSessionForFrame(r.target.tabId,o,r)}setFrameSessionForFrame(r,n,o){let i=this.frameSessionsByTabId.get(r)??new Map;this.frameSessionsByTabId.set(r,i),o.frameId!=null&&o.frameId!==n&&i.delete(o.frameId),o.frameId=n,i.set(n,o)}setFrameSessionTargetId(r,n,o){let i=this.frameSessionsByTabId.get(r)??new Map;this.frameSessionsByTabId.set(r,i),o.targetId!==n&&o.targetId!==o.frameId&&i.delete(o.targetId),o.targetId=n,i.set(n,o)}deleteFrameSession(r){this.frameSessionsBySessionId.delete(r.sessionId);let n=this.frameSessionsByTabId.get(r.target.tabId);r.frameId!=null&&n?.delete(r.frameId),n?.delete(r.targetId)}deleteFrameSessionsForTab(r){let n=this.frameSessionsByTabId.get(r);if(n!=null){for(let o of n.values())this.frameSessionsBySessionId.delete(o.sessionId);this.frameSessionsByTabId.delete(r)}}rememberAttachedFrameTarget(r,n){let o=this.attachedFrameTargetIdsByTabId.get(r)??new Set;this.attachedFrameTargetIdsByTabId.set(r,o),o.add(n)}async detachAttachedFrameTargets(r){let n=this.attachedFrameTargetIdsByTabId.get(r);if(n==null)return;this.attachedFrameTargetIdsByTabId.delete(r);let o=this.api;typeof o.detachTarget=="function"&&await Promise.allSettled([...n].map(async i=>o.detachTarget(r,i)))}handleJavaScriptDialogOpening(r){if(r.method!=="Page.javascriptDialogOpening"||!r.params)return;let n=r.params.type,o=r.source.tabId;if(n!=="alert"&&n!=="beforeunload"||typeof o!="number")return;let i=typeof r.source.sessionId=="string"?{tabId:o,sessionId:r.source.sessionId}:{tabId:o};this.api.executeCdp({target:i,method:"Page.handleJavaScriptDialog",commandParams:{accept:!0}}).catch(()=>{})}};function i8(e){let t=e.exception?.value;return`Browser Use encountered an error interacting with this webpage: ${typeof t=="string"?t:e.exception?.description??e.text??"JavaScript evaluation failed"}`}function za(e){if(typeof e?.targetId=="string")return e.targetId;if(typeof e?.id=="string")return e.id}function s8(e,t){return!("tabId"in e)||e.tabId==null?!0:e.tabId===t}function a8(e,t){return e.type==="iframe"?!0:e.type==="other"&&t.url!=null&&e.url===t.url}function u8(e){return e.type==="iframe"||e.type==="other"}function l8(e){return e.split(".",1)[0]??e}function c8(e){return{...e,"browser_use.cdp.domain":"full","browser_use.cdp.method":"full"}}function d8(e,t){return e!=="Runtime.evaluate"||!p8(t)?{}:{"browser_use.cdp.eval.await_promise":t.awaitPromise,"browser_use.cdp.eval.return_by_value":t.returnByValue}}function p8(e){return typeof e=="object"&&e!=null&&"expression"in e&&typeof e.expression=="string"}function jt(e){return e.method===o8}function mn(e){return e.source.sessionId==null}function uT(e,t){return t.sessionId!=null?e.source.sessionId===t.sessionId:t.targetId!=null?e.source.targetId===t.targetId:mn(e)}function f8(e,t){return t==null||t.includes(e.method)}function m8(e){return Object.fromEntries(Object.entries(e))}function h8(e){return{method:e.method,...e.params==null?{}:{params:e.params},sequence:e.sequence,source:e.source}}function g8(e){if(typeof e=="object")return e;let t=Number(e);if(!Number.isFinite(t))throw new Error("waitForPageLoadEvent requires numeric tab_id");return{tabId:t}}function hr(e){if(!(e==null||!jt(e)))throw new Error(b8(e))}function b8(e){let t=y8(e.params.url)??"this page";return J(`Browser Use is not permitted on ${t}.`)}function y8(e){if(typeof e!="string")return null;try{let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return null;t.username="",t.password="",t.search="",t.hash="";let r=t.toString();return t.pathname==="/"?r.slice(0,-1):r}catch{return null}}function _8(e){return e.method==="Page.frameStartedLoading"||e.method==="Page.frameNavigated"||e.method==="Page.navigatedWithinDocument"}function w8(e){return e.method==="Page.domContentEventFired"||e.method==="Page.loadEventFired"}var cT=_("navigate_tab_url",async(e,t)=>{if(typeof e.url!="string"||!e.url)throw new Error("navigate_tab_url requires a url");let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_url requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=await t.cdp.readDocumentState(r),i=fc(o?.href),s=fc(e.url);await t.cdp.call(r,"Page.enable",{});let a=await x8(r,t),u=S8({mainFrameId:a,previousUrl:i,targetUrl:s}),l=new AbortController,d=t.cdp.waitForEvent(r,p=>mn(p)&&(jt(p)||u(p)),{timeoutMs:n,timeoutMessage:`Timed out waiting for tab ${r} to navigate to ${e.url}.`,signal:l.signal}).then(p=>({event:p}),p=>l.signal.aborted?{event:void 0}:{error:p});try{let p=await t.cdp.call(r,"Page.navigate",{url:e.url});if(p.errorText){let m=A8(e.url)??"this page";throw new Error(`Browser Use cannot open ${m} in tab ${r}. Browser reported: ${k8(p.errorText,e.url,m)}`)}let f=await d;if("error"in f)throw f.error;hr(f.event)}finally{l.abort()}return{}});async function x8(e,t){try{return(await t.cdp.call(e,"Page.getFrameTree")).frameTree?.frame?.id}catch{return}}function S8({mainFrameId:e,previousUrl:t,targetUrl:r}){let n=!1;return o=>{if(v8(o))return lT(fc(o.params?.url),t,r);if(E8(o,e)){let i=fc(o.params.frame.url);lT(i,t,r)&&(n=!0)}return C8(o,e)&&(n=!0),n&&T8(o)}}function lT(e,t,r){return e==null?!1:r!=null&&e===r||t!=null&&e!==t?!0:t==null&&r==null}function v8(e){return e.method==="Page.navigatedWithinDocument"}function E8(e,t){if(e.method!=="Page.frameNavigated"||!ih(e.params))return!1;let r=e.params.frame;return ih(r)?t!=null?r.id===t:!("parentId"in r):!1}function C8(e,t){return e.method!=="Page.frameStartedLoading"||t==null||!ih(e.params)?!1:e.params.frameId===t}function T8(e){return e.method==="Page.domContentEventFired"||e.method==="Page.loadEventFired"}function fc(e){if(typeof e=="string")try{return new URL(e).href}catch{return e}}function k8(e,t,r){return e.replaceAll(t,r)}function A8(e){if(typeof e!="string")return null;try{let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return null;t.username="",t.password="",t.search="",t.hash="";let r=t.toString();return t.pathname==="/"?r.slice(0,-1):r}catch{return null}}function ih(e){return typeof e=="object"&&e!=null}var pT=_("playwright_dom_snapshot",async(e,t)=>{let r=se(e),n=await t.playwright.evaluateOnPlaywrightPage(e.tab_id,o=>{let i=document.body||document.documentElement;return i?o.ariaSnapshot(i,{mode:"ai"}):""},{timeoutMs:r});return{dom_snapshot:I8(n)}});function I8(e){return!e.startsWith("- ")&&!e.includes(`
- `)&&!e.includes(`
- `)?e:mT(R8(e).flatMap(fT))}function R8(e){let t={children:[],indent:-1,line:""},r=[t];for(let n of e.split(`
`)){if(n.trim()==="")continue;let o=n.match(/^ */)?.[0].length??0,i={children:[],indent:o,line:n.slice(o)};for(;r.length>1&&o<=dT(r).indent;)r.pop();dT(r).children.push(i),r.push(i)}return t.children}function dT(e){let t=e.at(-1);if(t==null)throw new Error("Expected snapshot stack to be non-empty");return t}function fT(e){let t=e.children.flatMap(fT),r={children:t,line:P8(e.line)};return N8(r.line)?[]:D8(r.line)?t:[r]}function mT(e,t=0){let r=[],n=" ".repeat(t);for(let o of e){r.push(n+o.line);let i=mT(o.children,t+1);i!==""&&r.push(i)}return r.join(`
`)}function P8(e){return e.replace(/ \[ref=[^\]]+\]/g,"").replace(/ \[cursor=[^\]]+\]/g,"")}function D8(e){return/^- (generic|listitem|group)(?: \[[^\]]+\])*:?$/.test(e)}function N8(e){return/^- img(?: \[[^\]]+\])*:?$/.test(e)}var hT=_("playwright_download_path",async(e,t)=>{if(k(e.tab_id),typeof e.download_id!="string"||e.download_id.length===0)throw new Error("playwright_download_path requires a download_id");return{path:t.downloads.getPath(e.download_id)}});var O8='To enable file upload, go to chrome://extensions in Chrome, click Details under the Codex extension, and enable "Allow access to file URLs." See [here](https://developers.openai.com/codex/app/chrome-extension#upload-files) for details.',gT=_("playwright_file_chooser_set_files",async(e,t)=>{let r=k(e.tab_id),n=t.cdp.fileChoosersById.get(e.file_chooser_id);if(n==null)throw new Error(`Unknown file chooser id "${e.file_chooser_id}"`);let o=`File chooser "${e.file_chooser_id}" belongs to tab ${n.tabId}`;if(n.tabId!==r)throw new Error(o);if(e.files.length===0)throw new Error("fileChooser.setFiles requires at least one file");if(!n.isMultiple&&e.files.length>1)throw new Error("File chooser does not accept multiple files");await t.security.ensureFileUploadAllowed(r);try{await t.cdp.call(r,"DOM.setFileInputFiles",{backendNodeId:n.backendNodeId,files:e.files})}catch(i){throw M8(i)?new Error(O8):i}return t.cdp.fileChoosersById.delete(e.file_chooser_id),{}});function M8(e){return e==="Not allowed"?!0:e instanceof Error?e.message==="Not allowed":typeof e!="object"||e==null||!("message"in e)?!1:e.message==="Not allowed"}var bT=_("playwright_locator_click",async(e,t)=>(await t.playwright.clickLocator(e,1),{}));var yT=_("playwright_locator_count",async(e,t)=>({count:await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,r=>r.length)}));var _T=_("playwright_locator_dblclick",async(e,t)=>(await t.playwright.clickLocator(e,2),{}));var wT=_("playwright_locator_download_media",async(e,t)=>(await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,r=>{r.scrollIntoView({block:"center",inline:"nearest"});let n=r.closest?.("img, video, source, a[href]")??r.querySelector?.("img, video, source, a[href]")??r,o=(a,u)=>{let l=a[u];return typeof l=="string"?l:null},i=o(n,"currentSrc")??o(n,"src")??o(n,"href")??"";if(!i)throw new Error("Matched element does not expose a downloadable media URL");let s=document.createElement("a");return s.href=i,s.download=i.split("/").pop()?.split("?")[0]||"download",s.rel="noopener",s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),!0},{timeoutMs:e.timeout_ms}),{}));var mc=_("playwright_locator_fill",async(e,t)=>{if(typeof e.value!="string")throw new Error("playwright_locator_fill requires string value");let r=ql(t.isIabBackend);if(e.replace===!1){let a=await t.playwright.focusLocator(e,{...r!=null?{iabInputTargetToken:r}:{},selectText:!1,requireEditable:!0});return await pn({includeRichText:!1,...r!=null?{iabInputTargetToken:r}:{},replaceInputValue:!1,tab_id:e.tab_id,target:a,text:e.value},t,mc.type),{}}let n=["visible","enabled","editable"],o={...r!=null?{iabInputTargetToken:r}:{},states:n,value:e.value},{result:i,target:s}=await t.playwright.evaluateOnPlaywrightSelectorWithTarget(e.tab_id,e.selector,(a,u,l)=>{for(let f of l.states){let m=u.elementState(a,f);if(m.received==="error:notconnected")throw new Error("Element is not connected");if(!m.matches)throw new Error("Element is not "+f)}a.scrollIntoView({block:"center",inline:"nearest"});let d=u.fill(a,l.value);if(d==="error:notconnected")throw new Error("Element is not connected");if(d!=="done"&&d!=="needsinput")throw new Error(d);if(d==="done")return"done";let p=typeof u.retarget=="function"?u.retarget(a,"follow-label"):a;if(p==null)throw new Error("Element is not connected");return l.iabInputTargetToken==null||Object.defineProperty(p,"__codexIabInputTargetToken",{configurable:!0,value:l.iabInputTargetToken,writable:!0}),d},{arg:o,timeoutMs:e.timeout_ms});return i!=="needsinput"?{}:(await pn({includeRichText:!1,...r!=null?{iabInputTargetToken:r}:{},replaceInputValue:!0,tab_id:e.tab_id,target:s,text:e.value},t,mc.type),{})});var xT=_("playwright_locator_get_attribute",async(e,t)=>{if(typeof e.name!="string"||!e.name)throw new Error("playwright_locator_get_attribute requires name");return{value:await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,(r,n,o)=>r.getAttribute(o.name),{arg:{name:e.name},timeoutMs:e.timeout_ms})}});var ST=_("playwright_locator_inner_text",async(e,t)=>({value:await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,r=>"innerText"in r?String(r.innerText):"",{timeoutMs:e.timeout_ms})}));var vT=_("playwright_locator_is_enabled",async(e,t)=>({value:await t.playwright.readElementState(e,"enabled")}));var ET=_("playwright_locator_is_visible",async(e,t)=>({value:await t.playwright.readElementState(e,"visible")}));var CT=_("playwright_locator_all_text_contents",async(e,t)=>({values:await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,r=>r.map(n=>typeof n.textContent=="string"?n.textContent:""),{timeoutMs:e.timeout_ms})}));var TT=_("playwright_locator_press",async(e,t)=>{if(typeof e.value!="string"||!e.value)throw new Error("playwright_locator_press requires value");let r=k(e.tab_id),n=ql(t.isIabBackend),o=await t.playwright.focusLocator(e,{...n!=null?{iabInputTargetToken:n}:{},requireEditable:!1});return $o(e.value)==="paste"?(await Wo({commandType:"playwright_locator_press",ctx:t,iabInputTargetToken:n,tabId:r,target:o}),{}):(await Wl(t.cdp,o,e.value,{iabInputTargetToken:n}),{})});var kT=_("playwright_locator_select_option",async(e,t)=>(await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,(r,n,o)=>{let i=n.elementState(r,"enabled");if(i.received==="error:notconnected")throw new Error("Element is not connected");if(!i.matches)throw new Error("Element is not enabled");let s=n.selectOptions(r,o.selections);if(typeof s=="string"&&s.startsWith("error:"))throw new Error(s);return!0},{arg:{selections:e.selections??[]},timeoutMs:e.timeout_ms}),{}));var AT=_("playwright_locator_set_checked",async(e,t)=>{if(typeof e.checked!="boolean")throw new Error("playwright_locator_set_checked requires checked");let r=await t.playwright.readCheckedState(e);if(r.checked===e.checked)return{};if(r.isRadio&&!e.checked)throw new Error("Cannot uncheck a radio button");if(await t.playwright.clickLocator(e,1),(await t.playwright.readCheckedState(e)).checked!==e.checked)throw new Error(`Click did not change checked state to ${String(e.checked)}`);return{}});var IT=_("playwright_locator_text_content",async(e,t)=>({value:await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,r=>r.textContent,{timeoutMs:e.timeout_ms})}));var RT=_("playwright_locator_read_all",async(e,t)=>({values:await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,(r,n,o)=>{let i=u=>({attributes:Object.fromEntries(Array.from(u.attributes,l=>[l.name,l.value])),inner_text:"innerText"in u?String(u.innerText):"",text_content:u.textContent});if(!o.relativeSelector)return r.map(i);let s=n,a=s.parseSelector(o.relativeSelector);return r.map(u=>{let l=s.querySelectorAll(a,u);return l[0]?i(l[0]):null})},{arg:{relativeSelector:e.relative_selector},timeoutMs:e.timeout_ms})}));var PT=_("playwright_locator_wait_for",async(e,t)=>{let r=e.state??"visible";if(r!=="attached"&&r!=="detached"&&r!=="visible"&&r!=="hidden")throw new Error(`Unsupported waitFor state: ${String(r)}`);return await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,(n,o,i)=>{let s=n[0]??null;if(i.state==="attached"){if(s)return!0;throw new Error("Element is not attached")}if(i.state==="detached"){if(!s)return!0;throw new Error("Element is still attached")}if(!s){if(i.state==="hidden")return!0;throw new Error("Element is not attached")}let a=o.elementState(s,i.state);if(a.received==="error:notconnected")throw new Error("Element is not connected");if(a.matches)return!0;throw new Error("Element is not "+i.state)},{arg:{state:r},timeoutMs:e.timeout_ms}),{}});var DT=_("playwright_wait_for_download",async(e,t)=>{let r=k(e.tab_id),n=se({...e,max:12e4});await t.downloads.enableDownload(r);try{return{download_id:(await t.downloads.waitForDownload(r,n)).id}}finally{await t.downloads.disableDownload(r)}});var NT=_("playwright_wait_for_file_chooser",async(e,t)=>{let r=k(e.tab_id),n=se(e);await t.cdp.call(r,"Page.enable"),await t.cdp.call(r,"Page.setInterceptFileChooserDialog",{enabled:!0});try{let o=await t.cdp.waitForEvent(r,F8,{timeoutMs:n,timeoutMessage:`Timed out after ${n}ms waiting for file chooser.`}),i=crypto.randomUUID(),s=B8(r,o);return t.cdp.fileChoosersById.set(i,s),{file_chooser_id:i,is_multiple:s.isMultiple}}finally{await t.cdp.call(r,"Page.setInterceptFileChooserDialog",{enabled:!1}).catch(()=>{})}});function F8(e){let t=OT(e);return e.method==="Page.fileChooserOpened"&&MT(t?.backendNodeId)}function B8(e,t){let r=OT(t);if(!MT(r?.backendNodeId))throw new Error("File chooser event did not include a backend node id");return{backendNodeId:r.backendNodeId,isMultiple:r.mode==="selectMultiple",tabId:e}}function OT(e){return e.params}function MT(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}var FT=_("playwright_wait_for_load_state",async(e,t)=>(await sh(e.tab_id,e.state,se(e),t),{}));async function sh(e,t,r,n){let o=k(e),i=t??"load";if(i==="networkidle")throw new Error("playwright_wait_for_load_state does not support networkidle");await n.cdp.call(o,"Page.enable",{});let s=await n.cdp.readDocumentState(o);if(L8(s?.readyState,i))return;let a=await n.cdp.waitForEvent(o,u=>mn(u)&&(jt(u)||U8(u,i)),{timeoutMs:r,timeoutMessage:`Timed out waiting for ${i} in tab ${o}.`});hr(a)}function L8(e,t){return t==="domcontentloaded"&&e==="interactive"||e==="complete"}function U8(e,t){return t==="domcontentloaded"&&e.method==="Page.domContentEventFired"||e.method==="Page.loadEventFired"}var BT=_("playwright_wait_for_timeout",async e=>(k(e.tab_id),await new Promise(t=>setTimeout(t,e.timeout_ms)),{}));var jT=_("playwright_wait_for_url",async(e,t)=>{if(typeof e.url!="string"||!e.url)throw new Error("playwright_wait_for_url requires a url");let r=k(e.tab_id),n=se(e),o=new RegExp(q8(e.url)),i=d=>o.test(d);await t.cdp.call(r,"Page.enable",{});let s=await t.cdp.readDocumentState(r);if(s?.href&&i(s.href))return await LT(e,n,t),{url:s.href};let a=await j8(r,t),u=await t.cdp.waitForEvent(r,d=>mn(d)&&(jt(d)||UT(d,a,i)!=null),{timeoutMs:n,timeoutMessage:`Timed out waiting for URL ${e.url} in tab ${r}.`});hr(u);let l=UT(u,a,i);return await LT(e,n,t),l==null?{}:{url:l}});async function LT(e,t,r){switch(e.wait_until){case void 0:case"commit":return;case"load":case"domcontentloaded":case"networkidle":await sh(e.tab_id,e.wait_until,t,r);return}}async function j8(e,t){try{return(await t.cdp.call(e,"Page.getFrameTree")).frameTree?.frame?.id}catch{return}}function UT(e,t,r){if(e.method==="Page.navigatedWithinDocument"){let a=hc(e.params,"url");return a!=null&&r(a)?a:void 0}if(e.method!=="Page.frameNavigated"||!ah(e.params)||!ah(e.params.frame))return;let n=e.params.frame,o=hc(n,"id"),i=hc(n,"parentId");if(t!=null?o!==t:i!=null)return;let s=hc(n,"url");return s!=null&&r(s)?s:void 0}function q8(e){let t="^";for(let r=0;r<e.length;){let n=e[r];if(n==null)break;if(n==="*"){let o=e[r+1]==="*";t+=o?".*":"[^/]*",r+=o?2:1;continue}t+=/[\\.^$|()[\]{}+?]/.test(n)?`\\${n}`:n,r+=1}return`${t}$`}function hc(e,t){if(!ah(e))return;let r=e[t];return typeof r=="string"?r:void 0}function ah(e){return typeof e=="object"&&e!=null}var qT=_("selected_tab",async(e,t)=>({id:(await t.tabs.getActive()).id.toString()}));var $T="tab_clipboard_read",$8=async()=>{if(navigator.clipboard?.read==null)throw new Error("navigator.clipboard.read is not available");let e=n=>{let o=new Uint8Array(n),i=32768,s="";for(let a=0;a<o.length;a+=i){let u=o.subarray(a,a+i);s+=String.fromCharCode(...u)}return btoa(s)},t=await navigator.clipboard.read();return{items:await Promise.all(t.map(async n=>({entries:await Promise.all(n.types.map(async i=>{let s=await n.getType(i);return i.startsWith("text/")?{mime_type:i,text:await s.text()}:{mime_type:i,base64:e(await s.arrayBuffer())}})),presentation_style:n.presentationStyle??"unspecified"})))}},zT=_($T,async(e,t)=>{let r=k(e.tab_id);return Ie({args:{},commandType:$T,ctx:t,pageFunction:$8,tabId:r})});var WT="tab_clipboard_read_text",z8=async()=>{if(navigator.clipboard?.readText==null)throw new Error("navigator.clipboard.readText is not available");return navigator.clipboard.readText()},HT=_(WT,async(e,t)=>{let r=k(e.tab_id);return{text:await Ie({args:{},commandType:WT,ctx:t,pageFunction:z8,tabId:r})}});var W8=async({text:e})=>{if(navigator.clipboard?.writeText==null)throw new Error("navigator.clipboard.writeText is not available");await navigator.clipboard.writeText(e)},uh="tab_clipboard_write_text",VT=_(uh,async(e,t)=>{let r=k(e.tab_id);if(typeof e.text!="string")throw new Error(`${uh} requires text`);return await Ie({args:{text:e.text},commandType:uh,ctx:t,pageFunction:W8,tabId:r}),{}});function Zo(){let e=globalThis.nodeRepl;return e?.config==null?void 0:e}async function KT(e){return(await YT(e)).enabled}async function JT(e){let t=await YT(e);if(!t.enabled)throw new Error(J(t.reason))}function Xo(e){switch(e){case"extension":case"iab":return!0;case"cdp":return!1}}async function YT({internalBuild:e=!1,privilegedNodeRepl:t=Zo()}={}){if(!e)return Ha("Full CDP access is disabled in this Browser Use build.");if(t==null)return Ha("Full CDP access could not be verified for this Browser Use session.");try{let[r,n]=await Promise.all([t.config.readToml(Vi),t.config.readRequirements()]);return V8(n)===!1?Ha("Full CDP access is disabled by enterprise policy."):r[xy]!==!0?Ha("Full CDP access is disabled in browser config."):{enabled:!0}}catch{return Ha("Full CDP access could not be verified from browser config and enterprise policy.")}}function V8(e){let r=GT(GT(e.requirements)?.featureRequirements)?.[Sy];return typeof r=="boolean"?r:void 0}function GT(e){return e==null||typeof e!="object"||Array.isArray(e)?null:e}function Ha(e){return{enabled:!1,reason:e}}function gc(e){if(e!=null)return{sessionId:e.session_id,targetId:e.target_id}}var ZT=_(Ft.Call,async(e,t)=>{if(await t.assertFullCdpAccessEnabled(),!Xo(t.clientInfo.type))throw new Error("Full CDP access is currently only available for Chrome and in-app browser tabs.");let r=Ft.Call.PayloadSchema.parse(e),n=k(r.tab_id),o=gc(r.target);if(r.method==="Fetch.enable"||r.method==="Fetch.disable")throw new Error("Fetch interception is not supported through raw CDP.");return await t.security.ensureFullCdpAllowed(n),await t.cdp.callRawCdp(n,r.method,r.params,{target:o,timeoutMs:r.timeout_ms??3e3})??{}});var XT=_(Ft.Events,async(e,t)=>{if(await t.assertFullCdpAccessEnabled(),!Xo(t.clientInfo.type))throw new Error("Full CDP access is currently only available for Chrome and in-app browser tabs.");let r=Ft.Events.PayloadSchema.parse(e),n=k(r.tab_id);return await t.security.ensureFullCdpAllowed(n),await t.cdp.readRawCdpEvents(n,{afterSequence:r.after_sequence,limit:r.limit,methods:r.methods,target:gc(r.target),timeoutMs:r.timeout_ms})});import{randomUUID as K8}from"node:crypto";import{mkdir as J8,writeFile as Y8}from"node:fs/promises";import{tmpdir as Z8}from"node:os";import{join as QT}from"node:path";var e1="tab_content_export_gsuite",X8={document:new Set(["pdf","md","docx"]),spreadsheets:new Set(["pdf","xlsx","csv"]),presentation:new Set(["pdf","pptx"])},Q8=new Set(["pdf","md","xlsx","csv","docx","pptx"]);async function e5({exportUrl:e}){let t=await fetch(e,{method:"GET"});if(!t.ok)throw new Error("GSuite export request failed with HTTP "+t.status);let r=new Uint8Array(await t.arrayBuffer()),n=32768,o="";for(let i=0;i<r.length;i+=n){let s=r.subarray(i,i+n);o+=String.fromCharCode(...s)}return{base64:btoa(o)}}function t5(e){return`(${e5.toString()})(${JSON.stringify(e)})`}var r5=async({tabId:e,exportUrl:t,cdp:r})=>{let n=await r.evaluateJavascript(e,t5({exportUrl:t}),{awaitPromise:!0});if(n?.base64==null)throw new Error("Unable to export GSuite content for this tab");return n};function n5(e){return e.replace(/^\s*\[[^\]]+\]:\s*<data:[^>]+>\s*\n?/gm,"").trim()}var t1=_(e1,async(e,t)=>{let r=k(e.tab_id),n=o5(e.format),o=await t.tabs.get(r),i=i5(o.url);if(i==null)throw new Error("Tab is not a Google Workspace document");if(!X8[i.docType].has(n))throw new Error("GSuite export type is not supported for this tab");let s=u5(i,n);if(s==null)throw new Error("Unable to export GSuite content for this tab");let a=await r5({exportUrl:s,tabId:r,cdp:t.cdp}),u=await c5(o.title,n),l=l5(a,n);if(l.length===0)throw new Error("Unable to export GSuite content for this tab");try{await Y8(u,l)}catch(d){throw new Error("Unable to write exported content to disk",{cause:d})}return{path:u}});function o5(e){if(typeof e!="string"||!Q8.has(e))throw new Error(`${e1} requires supported format`);return e}function i5(e){if(e==null)return null;let t;try{t=new URL(e)}catch{return null}if(t.host!=="docs.google.com")return null;let r=t.pathname.split("/").filter(Boolean);if(r.length<3)return null;let n=r[0];if(!a5(n))return null;let o=s5(r);return o==null||r.at(-1)==="pub"?null:{docId:o,docType:n,url:t}}function s5(e){let t=e.indexOf("d",1);if(!(t<0))return e[t+1]}function a5(e){return e==="document"||e==="spreadsheets"||e==="presentation"}function u5(e,t){if(e.docId==null||e.docId.length===0)return null;let r=new URL(`https://docs.google.com/${e.docType}/d/${e.docId}/export`);r.searchParams.set("format",t);let n=e.url.searchParams.get("tab");return n!=null&&r.searchParams.append("tab",n),r.hash=e.url.hash,r.toString()}function l5(e,t){let r=Buffer.from(e.base64,"base64");return t==="md"?Buffer.from(n5(r.toString("utf8")),"utf8"):r}async function c5(e,t){let r=QT(Z8(),"browser-use","exports");return await J8(r,{recursive:!0}),QT(r,`${p5(d5(e))}-${K8()}.${t}`)}function d5(e){if(e==null)return"Asset";let t=e.split(" - "),r=t.at(-1);return t.length>1&&r?.startsWith("Google")===!0?t.slice(0,-1).join(" - "):e}function p5(e,t="_"){let r=e.replaceAll(/[/\\?%*|"<>:]/g,t).trim();return r.length===0?"ExportedContent":r}var r1=_("tab_dev_logs",async(e,t)=>{let r=k(e.tab_id);return{logs:(await t.dev.logs({tabId:r,filter:e.filter,levels:e.levels,limit:e.limit})).map(({level:o,message:i,timestamp:s,url:a})=>({level:o,message:i,timestamp:s,...a==null?{}:{url:a}}))}});async function n1(e,t){try{let n=(await t.cdp.call(e,"Runtime.evaluate",{expression:"window.devicePixelRatio",returnByValue:!0},{telemetryAttrs:{"browser_use.cdp.eval.kind":"device_pixel_ratio"}}))?.result?.value;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return 1/n}catch{}return 1}var o1="jpeg";var i1=_("tab_screenshot",async(e,t)=>{let r=k(e.tab_id),n={format:o1,quality:80},o=m5(e),i=await n1(r,t);if(o!=null)n.captureBeyondViewport=!0,n.clip={...o,scale:i};else if(e.fullPage===!0){let u=(await t.cdp.call(r,"Page.getLayoutMetrics")).cssContentSize;if(u?.width==null||u.height==null||u.width<=0||u.height<=0)throw new Error("Page.getLayoutMetrics returned no valid cssContentSize for full-page screenshot.");n.captureBeyondViewport=!0,n.clip={x:u.x??0,y:u.y??0,width:u.width,height:u.height,scale:i}}else{let{cssVisualViewport:a}=await t.cdp.call(r,"Page.getLayoutMetrics");n.clip={x:a.pageX,y:a.pageY,width:a.clientWidth,height:a.clientHeight,scale:i}}let s=await t.cdp.call(r,"Page.captureScreenshot",n);if(typeof s.data!="string"||!s.data)throw new Error(`Page.captureScreenshot returned no data for tab ${r}.`);return{data:s.data}});function m5(e){if(!(e.cropX==null||e.cropY==null||e.cropWidth==null||e.cropHeight==null)){if(e.cropWidth<=0||e.cropHeight<=0)throw new Error("tab_screenshot crop width and height must be positive");return{x:e.cropX,y:e.cropY,width:e.cropWidth,height:e.cropHeight,scale:1}}}var h5=8,g5=2e3,b5=200,y5=2e5,_5=20,w5="browser-use-readonly-js",x5=/\bimport\b(?:(?:\s+)|(?:\/\/[^\n\r]*(?:\r?\n|$))|(?:\/\*[\s\S]*?\*\/))*\(/,Qo=new Map,u1=_(oe.PlaywrightEvaluate,async(e,t)=>{let r=k(e.tab_id),n=se(e),o=v5(e.script),i=await t.cdp.call(r,"Page.getFrameTree",void 0,{telemetryAttrs:{"browser_use.cdp.eval.kind":"readonly_js_frame_tree"},timeoutMs:n}),s=C5(i),a=await s1(t,r,s,n),u;try{u=await a1(t,r,a.executionContextId,o,n)}catch(l){if(!S5(l))throw l;Qo.delete(l1(r,s)),a=await s1(t,r,s,n),u=await a1(t,r,a.executionContextId,o,n)}return{value:T5(u)}});async function s1(e,t,r,n){let o=l1(t,r),i=Qo.get(o);if(i!=null)return i;let a={executionContextId:(await e.cdp.call(t,"Page.createIsolatedWorld",{frameId:r,grantUniveralAccess:!1,worldName:w5},{telemetryAttrs:{"browser_use.cdp.eval.kind":"readonly_js_world"},timeoutMs:n})).executionContextId,frameId:r};if(Qo.set(o,a),Qo.size>_5){let u=Qo.keys().next().value;u!=null&&Qo.delete(u)}return a}async function a1(e,t,r,n,o){return await e.cdp.call(t,"Runtime.evaluate",{awaitPromise:!0,contextId:r,expression:n,returnByValue:!0,timeout:o},{telemetryAttrs:{"browser_use.cdp.eval.kind":"readonly_live_dom"},timeoutMs:o})}function l1(e,t){return`${e}:${t}`}function S5(e){let t=e instanceof Error?e.message:String(e);return/Cannot find context|Execution context was destroyed|context.*destroyed|context.*not found/i.test(t)}function v5(e){return E5(e),`(() => {
const RESULT_MAX_DEPTH = ${h5};
const RESULT_MAX_ARRAY_LENGTH = ${g5};
const RESULT_MAX_OBJECT_KEYS = ${b5};
const RESULT_MAX_STRING_LENGTH = ${y5};
const ELEMENT_NODE = 1;
const TEXT_NODE = 3;
const COMMENT_NODE = 8;
const DOCUMENT_NODE = 9;
const DOCUMENT_TYPE_NODE = 10;
const DOCUMENT_FRAGMENT_NODE = 11;
const rawWindow = globalThis;
const rawDocument = rawWindow.document;
const wrapperToken = {};
const nodeWrappers = new WeakMap();
const rawNodesByWrapper = new WeakMap();
const styleWrappers = new WeakSet();
const mediaListWrappers = new WeakMap();
const cssRuleWrappers = new WeakMap();
const styleSheetWrappers = new WeakMap();
const cssWrappers = new WeakSet();
const rangeWrappers = new WeakMap();
const rawRangesByWrapper = new WeakMap();
const selectionWrappers = new WeakMap();
const selectionAndRangeWrappers = new WeakSet();
const fontFaceSetWrappers = new WeakMap();
const mediaQueryListWrappers = new WeakMap();
const readonlyApiWrappers = new WeakSet();
// Define fixed data properties so sandbox bindings cannot be replaced,
// deleted, or reconfigured by the evaluated script.
const defineReadonly = (target, name, value) => {
Object.defineProperty(target, name, {
configurable: false,
enumerable: true,
value,
writable: false,
});
};
const defineHiddenReadonly = (target, name, value) => {
Object.defineProperty(target, name, {
configurable: false,
enumerable: false,
value,
writable: false,
});
};
const defineReadonlyGetter = (target, name, get) => {
Object.defineProperty(target, name, {
configurable: false,
enumerable: true,
get,
});
};
const readonlyError = (name) =>
new Error(
name +
" is not available in playwright.evaluate because the DOM is read-only",
);
const camelToHyphen = (value) =>
String(value).replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
const ownKeys = (value) => Object.keys(value).slice(0, RESULT_MAX_OBJECT_KEYS);
const makeReadonlyList = (items, configure) => {
const list = Array.from(items);
defineHiddenReadonly(list, "constructor", undefined);
defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
if (typeof configure === "function") configure(list);
return Object.freeze(list);
};
const makeReadonlyAttribute = (attribute) =>
Object.freeze({
name: attribute.name,
nodeName: attribute.name,
nodeValue: attribute.value,
specified: true,
value: attribute.value,
});
const makeReadonlyAttributeList = (attributes) => {
const list = Array.from(attributes, makeReadonlyAttribute);
defineHiddenReadonly(list, "constructor", undefined);
defineHiddenReadonly(list, "getNamedItem", (name) => {
const attribute = attributes.getNamedItem(String(name));
return attribute == null ? null : makeReadonlyAttribute(attribute);
});
defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
return Object.freeze(list);
};
const makeReadonlyTokenList = (tokenList) => {
if (tokenList == null) return undefined;
const list = Array.from(tokenList, String);
defineHiddenReadonly(list, "constructor", undefined);
defineHiddenReadonly(list, "contains", (value) =>
tokenList.contains(String(value)),
);
defineHiddenReadonly(list, "item", (index) => tokenList.item(index));
defineHiddenReadonly(list, "value", tokenList.value);
return Object.freeze(list);
};
const makeReadonlyTimeRanges = (ranges) => {
if (ranges == null) return undefined;
const list = [];
for (let index = 0; index < ranges.length; index += 1) {
list.push(Object.freeze({
end: ranges.end(index),
start: ranges.start(index),
}));
}
defineHiddenReadonly(list, "constructor", undefined);
defineHiddenReadonly(list, "end", (index) => ranges.end(Number(index)));
defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
defineHiddenReadonly(list, "start", (index) => ranges.start(Number(index)));
return Object.freeze(list);
};
const makeReadonlyTrackList = (tracks) => {
if (tracks == null) return undefined;
const list = Array.from(tracks, (track) =>
Object.freeze({
enabled: track.enabled === true,
id: typeof track.id === "string" ? track.id : "",
kind: typeof track.kind === "string" ? track.kind : "",
label: typeof track.label === "string" ? track.label : "",
language: typeof track.language === "string" ? track.language : "",
mode: typeof track.mode === "string" ? track.mode : undefined,
selected: track.selected === true,
}),
);
defineHiddenReadonly(list, "constructor", undefined);
defineHiddenReadonly(list, "getTrackById", (id) =>
list.find((track) => track.id === String(id)) ?? null,
);
defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
return Object.freeze(list);
};
const makeReadonlyDataset = (dataset) => {
const output = Object.create(null);
for (const key of Object.keys(dataset)) {
defineReadonly(output, key, dataset[key]);
}
defineHiddenReadonly(output, "constructor", undefined);
return Object.freeze(output);
};
const makeReadonlyRect = (rect) =>
Object.freeze({
bottom: rect.bottom,
height: rect.height,
left: rect.left,
right: rect.right,
top: rect.top,
width: rect.width,
x: rect.x,
y: rect.y,
toJSON() {
return {
bottom: rect.bottom,
height: rect.height,
left: rect.left,
right: rect.right,
top: rect.top,
width: rect.width,
x: rect.x,
y: rect.y,
};
},
});
const makeReadonlyValidityState = (validity) => {
if (validity == null) return undefined;
return Object.freeze({
badInput: validity.badInput === true,
customError: validity.customError === true,
patternMismatch: validity.patternMismatch === true,
rangeOverflow: validity.rangeOverflow === true,
rangeUnderflow: validity.rangeUnderflow === true,
stepMismatch: validity.stepMismatch === true,
tooLong: validity.tooLong === true,
tooShort: validity.tooShort === true,
typeMismatch: validity.typeMismatch === true,
valid: validity.valid === true,
valueMissing: validity.valueMissing === true,
});
};
const makeNodeSummary = (node) => {
const wrapper = wrapNode(node);
return wrapper == null ? null : wrapper.toJSON();
};
class ReadonlyStyleDeclaration {
#style;
constructor(style, token) {
if (token !== wrapperToken) throw readonlyError("CSSStyleDeclaration constructor");
this.#style = style;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get length() {
return this.#style.length;
}
get cssText() {
return this.#style.cssText ?? "";
}
getPropertyValue(name) {
return this.#style.getPropertyValue(String(name));
}
getPropertyPriority(name) {
return this.#style.getPropertyPriority(String(name));
}
item(index) {
return this.#style.item(Number(index)) ?? "";
}
*[Symbol.iterator]() {
for (let index = 0; index < this.#style.length; index += 1) {
yield this.item(index);
}
}
toJSON() {
const output = {};
const length = Math.min(this.#style.length, RESULT_MAX_OBJECT_KEYS);
for (let index = 0; index < length; index += 1) {
const name = this.#style.item(index);
output[name] = this.#style.getPropertyValue(name);
}
return output;
}
}
const wrapStyle = (style) => {
const wrapper = new Proxy(new ReadonlyStyleDeclaration(style, wrapperToken), {
get(target, property, receiver) {
if (property === Symbol.toStringTag) return "CSSStyleDeclaration";
if (property === Symbol.iterator)
return target[Symbol.iterator].bind(target);
if (typeof property === "string") {
if (/^\\d+$/.test(property)) return target.item(Number(property));
if (property in target) {
const value = Reflect.get(target, property, target);
return typeof value === "function" ? value.bind(target) : value;
}
if (typeof style[property] === "function") return undefined;
return (
target.getPropertyValue(camelToHyphen(property)) ||
target.getPropertyValue(property)
);
}
return Reflect.get(target, property, receiver);
},
set() {
throw readonlyError("CSSStyleDeclaration assignment");
},
});
styleWrappers.add(wrapper);
return wrapper;
};
// CSSOM wrappers expose stylesheet and rule reads without exposing mutation
// methods like insertRule(), deleteRule(), replace(), or setProperty().
// Inaccessible cssRules keep native browser behavior when read directly; the
// serializer records that state without trying a network fallback.
class ReadonlyMediaList {
#media;
constructor(media, token) {
if (token !== wrapperToken) throw readonlyError("MediaList constructor");
this.#media = media;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get length() {
return this.#media.length;
}
get mediaText() {
return this.#media.mediaText;
}
item(index) {
return this.#media.item(Number(index)) ?? "";
}
*[Symbol.iterator]() {
for (let index = 0; index < this.#media.length; index += 1) {
yield this.item(index);
}
}
toJSON() {
return Array.from(this);
}
}
const wrapMediaList = (media) => {
if (media == null) return null;
const existing = mediaListWrappers.get(media);
if (existing != null) return existing;
const wrapper = new ReadonlyMediaList(media, wrapperToken);
mediaListWrappers.set(media, wrapper);
cssWrappers.add(wrapper);
return wrapper;
};
class ReadonlyCSSRule {
#rule;
constructor(rule, token) {
if (token !== wrapperToken) throw readonlyError("CSSRule constructor");
this.#rule = rule;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get conditionText() {
return typeof this.#rule.conditionText === "string"
? this.#rule.conditionText
: undefined;
}
get cssRules() {
if (!("cssRules" in this.#rule)) return undefined;
return makeReadonlyList(Array.from(this.#rule.cssRules, wrapCSSRule));
}
get cssText() {
return this.#rule.cssText;
}
get href() {
return typeof this.#rule.href === "string" ? this.#rule.href : undefined;
}
get keyText() {
return typeof this.#rule.keyText === "string" ? this.#rule.keyText : undefined;
}
get media() {
return "media" in this.#rule ? wrapMediaList(this.#rule.media) : undefined;
}
get name() {
return typeof this.#rule.name === "string" ? this.#rule.name : undefined;
}
get parentRule() {
return wrapCSSRule(this.#rule.parentRule);
}
get parentStyleSheet() {
return wrapCSSStyleSheet(this.#rule.parentStyleSheet);
}
get selectorText() {
return typeof this.#rule.selectorText === "string"
? this.#rule.selectorText
: undefined;
}
get style() {
return this.#rule.style == null ? undefined : wrapStyle(this.#rule.style);
}
get styleSheet() {
return wrapCSSStyleSheet(this.#rule.styleSheet);
}
get type() {
return this.#rule.type;
}
toJSON() {
const output = {
cssText: this.cssText,
type: this.type,
};
for (const name of [
"conditionText",
"href",
"keyText",
"name",
"selectorText",
]) {
const value = this[name];
if (value !== undefined) output[name] = value;
}
if (this.style !== undefined) output.style = this.style.toJSON();
return output;
}
}
const wrapCSSRule = (rule) => {
if (rule == null) return null;
const existing = cssRuleWrappers.get(rule);
if (existing != null) return existing;
const wrapper = new ReadonlyCSSRule(rule, wrapperToken);
cssRuleWrappers.set(rule, wrapper);
cssWrappers.add(wrapper);
return wrapper;
};
class ReadonlyCSSStyleSheet {
#sheet;
constructor(sheet, token) {
if (token !== wrapperToken) throw readonlyError("CSSStyleSheet constructor");
this.#sheet = sheet;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get cssRules() {
return makeReadonlyList(Array.from(this.#sheet.cssRules, wrapCSSRule));
}
get disabled() {
return this.#sheet.disabled === true;
}
get href() {
return this.#sheet.href;
}
get media() {
return wrapMediaList(this.#sheet.media);
}
get ownerNode() {
return wrapNode(this.#sheet.ownerNode);
}
get ownerRule() {
return wrapCSSRule(this.#sheet.ownerRule);
}
get parentStyleSheet() {
return wrapCSSStyleSheet(this.#sheet.parentStyleSheet);
}
get rules() {
return this.cssRules;
}
get title() {
return this.#sheet.title;
}
get type() {
return this.#sheet.type;
}
toJSON() {
const output = {
disabled: this.disabled,
href: this.href,
media: this.media?.toJSON() ?? null,
title: this.title,
type: this.type,
};
try {
output.ruleCount = this.cssRules.length;
} catch (error) {
output.ruleAccessError =
error instanceof Error ? error.name || error.message : String(error);
}
return output;
}
}
const wrapCSSStyleSheet = (sheet) => {
if (sheet == null) return null;
const existing = styleSheetWrappers.get(sheet);
if (existing != null) return existing;
const wrapper = new ReadonlyCSSStyleSheet(sheet, wrapperToken);
styleSheetWrappers.set(sheet, wrapper);
cssWrappers.add(wrapper);
return wrapper;
};
const unwrapRange = (value) =>
value != null && (typeof value === "object" || typeof value === "function")
? rawRangesByWrapper.get(value) ?? null
: null;
class ReadonlyRange {
#range;
constructor(range, token) {
if (token !== wrapperToken) throw readonlyError("Range constructor");
this.#range = range;
rawRangesByWrapper.set(this, range);
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get collapsed() {
return this.#range.collapsed === true;
}
get commonAncestorContainer() {
return wrapNode(this.#range.commonAncestorContainer);
}
get endContainer() {
return wrapNode(this.#range.endContainer);
}
get endOffset() {
return this.#range.endOffset;
}
get startContainer() {
return wrapNode(this.#range.startContainer);
}
get startOffset() {
return this.#range.startOffset;
}
compareBoundaryPoints(how, sourceRange) {
const rawRange = unwrapRange(sourceRange);
if (rawRange == null) throw new TypeError("compareBoundaryPoints expects a Range");
return this.#range.compareBoundaryPoints(Number(how), rawRange);
}
comparePoint(node, offset) {
const rawNode = unwrapNode(node);
if (rawNode == null) throw new TypeError("comparePoint expects a Node");
return this.#range.comparePoint(rawNode, Number(offset));
}
getBoundingClientRect() {
return makeReadonlyRect(this.#range.getBoundingClientRect());
}
getClientRects() {
return makeReadonlyList(
Array.from(this.#range.getClientRects(), makeReadonlyRect),
);
}
intersectsNode(node) {
const rawNode = unwrapNode(node);
return rawNode != null && this.#range.intersectsNode(rawNode);
}
isPointInRange(node, offset) {
const rawNode = unwrapNode(node);
return rawNode != null && this.#range.isPointInRange(rawNode, Number(offset));
}
toJSON() {
return {
collapsed: this.collapsed,
commonAncestorContainer: makeNodeSummary(this.#range.commonAncestorContainer),
endOffset: this.endOffset,
startOffset: this.startOffset,
text: this.toString(),
};
}
toString() {
return this.#range.toString();
}
}
const wrapRange = (range) => {
if (range == null) return null;
const existing = rangeWrappers.get(range);
if (existing != null) return existing;
const wrapper = new ReadonlyRange(range, wrapperToken);
rangeWrappers.set(range, wrapper);
selectionAndRangeWrappers.add(wrapper);
return wrapper;
};
class ReadonlySelection {
#selection;
constructor(selection, token) {
if (token !== wrapperToken) throw readonlyError("Selection constructor");
this.#selection = selection;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get anchorNode() {
return wrapNode(this.#selection.anchorNode);
}
get anchorOffset() {
return this.#selection.anchorOffset;
}
get focusNode() {
return wrapNode(this.#selection.focusNode);
}
get focusOffset() {
return this.#selection.focusOffset;
}
get isCollapsed() {
return this.#selection.isCollapsed === true;
}
get rangeCount() {
return this.#selection.rangeCount;
}
get type() {
return this.#selection.type;
}
containsNode(node, allowPartialContainment = false) {
const rawNode = unwrapNode(node);
return (
rawNode != null &&
this.#selection.containsNode(rawNode, Boolean(allowPartialContainment))
);
}
getRangeAt(index) {
return wrapRange(this.#selection.getRangeAt(Number(index)));
}
toJSON() {
return {
anchorNode: makeNodeSummary(this.#selection.anchorNode),
anchorOffset: this.anchorOffset,
focusNode: makeNodeSummary(this.#selection.focusNode),
focusOffset: this.focusOffset,
isCollapsed: this.isCollapsed,
rangeCount: this.rangeCount,
text: this.toString(),
type: this.type,
};
}
toString() {
return this.#selection.toString();
}
}
const wrapSelection = (selection) => {
if (selection == null) return null;
const existing = selectionWrappers.get(selection);
if (existing != null) return existing;
const wrapper = new ReadonlySelection(selection, wrapperToken);
selectionWrappers.set(selection, wrapper);
selectionAndRangeWrappers.add(wrapper);
return wrapper;
};
class ReadonlyFontFaceSet {
#fonts;
constructor(fonts, token) {
if (token !== wrapperToken) throw readonlyError("FontFaceSet constructor");
this.#fonts = fonts;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get size() {
return this.#fonts.size;
}
get status() {
return this.#fonts.status;
}
check(font, text) {
return this.#fonts.check(
String(font),
text === undefined ? undefined : String(text),
);
}
toJSON() {
return {
size: this.size,
status: this.status,
};
}
}
const wrapFontFaceSet = (fonts) => {
if (fonts == null) return undefined;
const existing = fontFaceSetWrappers.get(fonts);
if (existing != null) return existing;
const wrapper = new ReadonlyFontFaceSet(fonts, wrapperToken);
fontFaceSetWrappers.set(fonts, wrapper);
readonlyApiWrappers.add(wrapper);
return wrapper;
};
class ReadonlyMediaQueryList {
#query;
constructor(query, token) {
if (token !== wrapperToken) throw readonlyError("MediaQueryList constructor");
this.#query = query;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get matches() {
return this.#query.matches === true;
}
get media() {
return this.#query.media;
}
toJSON() {
return {
matches: this.matches,
media: this.media,
};
}
}
const wrapMediaQueryList = (query) => {
if (query == null) return null;
const existing = mediaQueryListWrappers.get(query);
if (existing != null) return existing;
const wrapper = new ReadonlyMediaQueryList(query, wrapperToken);
mediaQueryListWrappers.set(query, wrapper);
readonlyApiWrappers.add(wrapper);
return wrapper;
};
class ReadonlyVisualViewport {
#viewport;
constructor(viewport, token) {
if (token !== wrapperToken) throw readonlyError("VisualViewport constructor");
this.#viewport = viewport;
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get height() {
return this.#viewport.height;
}
get offsetLeft() {
return this.#viewport.offsetLeft;
}
get offsetTop() {
return this.#viewport.offsetTop;
}
get pageLeft() {
return this.#viewport.pageLeft;
}
get pageTop() {
return this.#viewport.pageTop;
}
get scale() {
return this.#viewport.scale;
}
get width() {
return this.#viewport.width;
}
toJSON() {
return {
height: this.height,
offsetLeft: this.offsetLeft,
offsetTop: this.offsetTop,
pageLeft: this.pageLeft,
pageTop: this.pageTop,
scale: this.scale,
width: this.width,
};
}
}
const wrapVisualViewport = (viewport) => {
if (viewport == null) return null;
const wrapper = new ReadonlyVisualViewport(viewport, wrapperToken);
readonlyApiWrappers.add(wrapper);
return wrapper;
};
class ReadonlyLocation {
constructor() {
defineHiddenReadonly(this, "constructor", undefined);
Object.freeze(this);
}
get hash() {
return rawWindow.location.hash;
}
get host() {
return rawWindow.location.host;
}
get hostname() {
return rawWindow.location.hostname;
}
get href() {
return rawWindow.location.href;
}
get origin() {
return rawWindow.location.origin;
}
get pathname() {
return rawWindow.location.pathname;
}
get port() {
return rawWindow.location.port;
}
get protocol() {
return rawWindow.location.protocol;
}
get search() {
return rawWindow.location.search;
}
toJSON() {
return this.href;
}
toString() {
return this.href;
}
}
class ReadonlyNode {
#node;
constructor(node, token) {
if (token !== wrapperToken) throw readonlyError("Node constructor");
this.#node = node;
rawNodesByWrapper.set(this, node);
defineHiddenReadonly(this, "constructor", undefined);
if (new.target === ReadonlyNode) Object.freeze(this);
}
get childNodes() {
return makeReadonlyNodeList(this.#node.childNodes);
}
get firstChild() {
return wrapNode(this.#node.firstChild);
}
get lastChild() {
return wrapNode(this.#node.lastChild);
}
get nextSibling() {
return wrapNode(this.#node.nextSibling);
}
get nodeName() {
return this.#node.nodeName;
}
get name() {
return typeof this.#node.name === "string" ? this.#node.name : undefined;
}
get nodeType() {
return this.#node.nodeType;
}
get nodeValue() {
return this.#node.nodeValue;
}
get publicId() {
return typeof this.#node.publicId === "string" ? this.#node.publicId : undefined;
}
get systemId() {
return typeof this.#node.systemId === "string" ? this.#node.systemId : undefined;
}
get isConnected() {
return this.#node.isConnected === true;
}
get ownerDocument() {
return wrapNode(this.#node.ownerDocument ?? rawDocument);
}
get parentElement() {
return wrapNode(this.#node.parentElement);
}
get parentNode() {
return wrapNode(this.#node.parentNode);
}
get previousSibling() {
return wrapNode(this.#node.previousSibling);
}
get textContent() {
return this.#node.textContent;
}
contains(node) {
const rawNode = unwrapNode(node);
return rawNode != null && this.#node.contains(rawNode);
}
getRootNode(options) {
return wrapNode(
typeof this.#node.getRootNode === "function"
? this.#node.getRootNode(options)
: (this.#node.ownerDocument ?? rawDocument),
);
}
toJSON() {
return {
name: this.name,
nodeName: this.nodeName,
nodeType: this.nodeType,
publicId: this.publicId,
systemId: this.systemId,
textContent: this.textContent,
};
}
}
class ReadonlyElement extends ReadonlyNode {
#element;
constructor(element, token) {
super(element, token);
this.#element = element;
Object.freeze(this);
}
get attributes() {
return makeReadonlyAttributeList(this.#element.attributes);
}
get alt() {
return typeof this.#element.alt === "string" ? this.#element.alt : "";
}
get ariaChecked() {
return typeof this.#element.ariaChecked === "string"
? this.#element.ariaChecked
: null;
}
get ariaControls() {
return typeof this.#element.ariaControls === "string"
? this.#element.ariaControls
: null;
}
get ariaCurrent() {
return typeof this.#element.ariaCurrent === "string"
? this.#element.ariaCurrent
: null;
}
get ariaDescribedBy() {
return typeof this.#element.ariaDescribedBy === "string"
? this.#element.ariaDescribedBy
: null;
}
get ariaDescription() {
return typeof this.#element.ariaDescription === "string"
? this.#element.ariaDescription
: null;
}
get ariaDisabled() {
return typeof this.#element.ariaDisabled === "string"
? this.#element.ariaDisabled
: null;
}
get ariaExpanded() {
return typeof this.#element.ariaExpanded === "string"
? this.#element.ariaExpanded
: null;
}
get ariaHasPopup() {
return typeof this.#element.ariaHasPopup === "string"
? this.#element.ariaHasPopup
: null;
}
get ariaHidden() {
return typeof this.#element.ariaHidden === "string"
? this.#element.ariaHidden
: null;
}
get ariaInvalid() {
return typeof this.#element.ariaInvalid === "string"
? this.#element.ariaInvalid
: null;
}
get action() {
return typeof this.#element.action === "string" ? this.#element.action : "";
}
get allow() {
return typeof this.#element.allow === "string" ? this.#element.allow : "";
}
get ariaLabel() {
return typeof this.#element.ariaLabel === "string"
? this.#element.ariaLabel
: null;
}
get ariaLabelledBy() {
return typeof this.#element.ariaLabelledBy === "string"
? this.#element.ariaLabelledBy
: null;
}
get ariaPressed() {
return typeof this.#element.ariaPressed === "string"
? this.#element.ariaPressed
: null;
}
get ariaSelected() {
return typeof this.#element.ariaSelected === "string"
? this.#element.ariaSelected
: null;
}
get ariaSort() {
return typeof this.#element.ariaSort === "string"
? this.#element.ariaSort
: null;
}
get ariaValueMax() {
return typeof this.#element.ariaValueMax === "string"
? this.#element.ariaValueMax
: null;
}
get ariaValueMin() {
return typeof this.#element.ariaValueMin === "string"
? this.#element.ariaValueMin
: null;
}
get ariaValueNow() {
return typeof this.#element.ariaValueNow === "string"
? this.#element.ariaValueNow
: null;
}
get ariaValueText() {
return typeof this.#element.ariaValueText === "string"
? this.#element.ariaValueText
: null;
}
get as() {
return typeof this.#element.as === "string" ? this.#element.as : "";
}
get assignedElements() {
if (typeof this.#element.assignedElements !== "function") return undefined;
return (options = {}) =>
makeReadonlyList(
Array.from(
this.#element.assignedElements({ flatten: options.flatten === true }),
wrapNode,
),
);
}
get assignedNodes() {
if (typeof this.#element.assignedNodes !== "function") return undefined;
return (options = {}) =>
makeReadonlyList(
Array.from(
this.#element.assignedNodes({ flatten: options.flatten === true }),
wrapNode,
),
);
}
get assignedSlot() {
return wrapNode(this.#element.assignedSlot);
}
get async() {
return this.#element.async === true;
}
get autoplay() {
return this.#element.autoplay === true;
}
get autocomplete() {
return typeof this.#element.autocomplete === "string"
? this.#element.autocomplete
: "";
}
get buffered() {
return makeReadonlyTimeRanges(this.#element.buffered);
}
get checked() {
return this.#element.checked === true;
}
get children() {
return makeReadonlyNodeList(this.#element.children);
}
get caption() {
return wrapNode(this.#element.caption);
}
get cellIndex() {
return this.#element.cellIndex ?? -1;
}
get cells() {
return makeReadonlyNodeList(this.#element.cells);
}
get clientHeight() {
return this.#element.clientHeight ?? 0;
}
get clientLeft() {
return this.#element.clientLeft ?? 0;
}
get clientTop() {
return this.#element.clientTop ?? 0;
}
get clientWidth() {
return this.#element.clientWidth ?? 0;
}
get classList() {
return makeReadonlyTokenList(this.#element.classList);
}
get className() {
const className = this.#element.className;
if (typeof className === "string") return className;
if (typeof className?.baseVal === "string") return className.baseVal;
return "";
}
get colSpan() {
return this.#element.colSpan ?? 1;
}
get content() {
const content = this.#element.content;
if (content === undefined) return undefined;
return content != null && typeof content === "object" && "nodeType" in content
? wrapNode(content)
: content;
}
get controls() {
return this.#element.controls === true;
}
get crossOrigin() {
return typeof this.#element.crossOrigin === "string"
? this.#element.crossOrigin
: null;
}
get currentTime() {
return this.#element.currentTime ?? 0;
}
get dataset() {
return makeReadonlyDataset(this.#element.dataset);
}
get decoding() {
return typeof this.#element.decoding === "string"
? this.#element.decoding
: "";
}
get defaultSelected() {
return this.#element.defaultSelected === true;
}
get defaultValue() {
return typeof this.#element.defaultValue === "string"
? this.#element.defaultValue
: "";
}
get defer() {
return this.#element.defer === true;
}
get defaultMuted() {
return this.#element.defaultMuted === true;
}
get defaultPlaybackRate() {
return this.#element.defaultPlaybackRate ?? 1;
}
get disabled() {
return this.#element.disabled === true;
}
get dir() {
return typeof this.#element.dir === "string" ? this.#element.dir : "";
}
get download() {
return typeof this.#element.download === "string"
? this.#element.download
: "";
}
get complete() {
return this.#element.complete === true;
}
get currentSrc() {
return typeof this.#element.currentSrc === "string" ? this.#element.currentSrc : "";
}
get duration() {
return this.#element.duration ?? 0;
}
get elements() {
return makeReadonlyNodeList(this.#element.elements);
}
get ended() {
return this.#element.ended === true;
}
get enctype() {
return typeof this.#element.enctype === "string"
? this.#element.enctype
: "";
}
get exportparts() {
return typeof this.#element.exportparts === "string"
? this.#element.exportparts
: "";
}
get firstElementChild() {
return wrapNode(this.#element.firstElementChild);
}
get form() {
return wrapNode(this.#element.form);
}
get formAction() {
return typeof this.#element.formAction === "string"
? this.#element.formAction
: "";
}
get formEnctype() {
return typeof this.#element.formEnctype === "string"
? this.#element.formEnctype
: "";
}
get formMethod() {
return typeof this.#element.formMethod === "string"
? this.#element.formMethod
: "";
}
get formNoValidate() {
return this.#element.formNoValidate === true;
}
get formTarget() {
return typeof this.#element.formTarget === "string"
? this.#element.formTarget
: "";
}
get height() {
return this.#element.height ?? 0;
}
get hash() {
return typeof this.#element.hash === "string" ? this.#element.hash : "";
}
get hidden() {
return this.#element.hidden === true;
}
get fetchPriority() {
return typeof this.#element.fetchPriority === "string"
? this.#element.fetchPriority
: "";
}
get host() {
return typeof this.#element.host === "string" ? this.#element.host : "";
}
get hostname() {
return typeof this.#element.hostname === "string"
? this.#element.hostname
: "";
}
get href() {
return typeof this.#element.href === "string" ? this.#element.href : "";
}
get hreflang() {
return typeof this.#element.hreflang === "string"
? this.#element.hreflang
: "";
}
get httpEquiv() {
return typeof this.#element.httpEquiv === "string"
? this.#element.httpEquiv
: "";
}
get htmlFor() {
return typeof this.#element.htmlFor === "string" ? this.#element.htmlFor : "";
}
get id() {
return this.#element.id;
}
get index() {
return this.#element.index ?? -1;
}
get innerHTML() {
return this.#element.innerHTML;
}
get innerText() {
return this.#element.innerText;
}
get lastElementChild() {
return wrapNode(this.#element.lastElementChild);
}
get labels() {
return makeReadonlyNodeList(this.#element.labels);
}
get label() {
return typeof this.#element.label === "string" ? this.#element.label : "";
}
get lang() {
return typeof this.#element.lang === "string" ? this.#element.lang : "";
}
get length() {
return this.#element.length ?? 0;
}
get loading() {
return typeof this.#element.loading === "string"
? this.#element.loading
: "";
}
get loop() {
return this.#element.loop === true;
}
get list() {
return wrapNode(this.#element.list);
}
get localName() {
return this.#element.localName;
}
get maxLength() {
return this.#element.maxLength ?? -1;
}
get minLength() {
return this.#element.minLength ?? -1;
}
get media() {
return typeof this.#element.media === "string" ? this.#element.media : "";
}
get max() {
return typeof this.#element.max === "string" ? this.#element.max : "";
}
get method() {
return typeof this.#element.method === "string" ? this.#element.method : "";
}
get min() {
return typeof this.#element.min === "string" ? this.#element.min : "";
}
get multiple() {
return this.#element.multiple === true;
}
get muted() {
return this.#element.muted === true;
}
get name() {
return typeof this.#element.name === "string" ? this.#element.name : "";
}
get namespaceURI() {
return this.#element.namespaceURI;
}
get noValidate() {
return this.#element.noValidate === true;
}
get naturalHeight() {
return this.#element.naturalHeight ?? 0;
}
get naturalWidth() {
return this.#element.naturalWidth ?? 0;
}
get nextElementSibling() {
return wrapNode(this.#element.nextElementSibling);
}
get outerHTML() {
return this.#element.outerHTML;
}
get offsetHeight() {
return this.#element.offsetHeight ?? 0;
}
get offsetLeft() {
return this.#element.offsetLeft ?? 0;
}
get offsetTop() {
return this.#element.offsetTop ?? 0;
}
get offsetWidth() {
return this.#element.offsetWidth ?? 0;
}
get options() {
return makeReadonlyNodeList(this.#element.options);
}
get open() {
return this.#element.open === true;
}
get origin() {
return typeof this.#element.origin === "string" ? this.#element.origin : "";
}
get paused() {
return this.#element.paused === true;
}
get part() {
return makeReadonlyTokenList(this.#element.part);
}
get pathname() {
return typeof this.#element.pathname === "string"
? this.#element.pathname
: "";
}
get pattern() {
return typeof this.#element.pattern === "string"
? this.#element.pattern
: "";
}
get playbackRate() {
return this.#element.playbackRate ?? 1;
}
get ping() {
return typeof this.#element.ping === "string" ? this.#element.ping : "";
}
get played() {
return makeReadonlyTimeRanges(this.#element.played);
}
get placeholder() {
return typeof this.#element.placeholder === "string"
? this.#element.placeholder
: "";
}
get port() {
return typeof this.#element.port === "string" ? this.#element.port : "";
}
get poster() {
return typeof this.#element.poster === "string" ? this.#element.poster : "";
}
get protocol() {
return typeof this.#element.protocol === "string"
? this.#element.protocol
: "";
}
get previousElementSibling() {
return wrapNode(this.#element.previousElementSibling);
}
get readOnly() {
return this.#element.readOnly === true;
}
get readyState() {
return this.#element.readyState ?? 0;
}
get referrerPolicy() {
return typeof this.#element.referrerPolicy === "string"
? this.#element.referrerPolicy
: "";
}
get rel() {
return typeof this.#element.rel === "string" ? this.#element.rel : "";
}
get relList() {
return makeReadonlyTokenList(this.#element.relList);
}
get required() {
return this.#element.required === true;
}
get role() {
return typeof this.#element.role === "string" ? this.#element.role : null;
}
get sandbox() {
return makeReadonlyTokenList(this.#element.sandbox);
}
get scrollHeight() {
return this.#element.scrollHeight ?? 0;
}
get scrollLeft() {
return this.#element.scrollLeft ?? 0;
}
get scrollTop() {
return this.#element.scrollTop ?? 0;
}
get scrollWidth() {
return this.#element.scrollWidth ?? 0;
}
get rowIndex() {
return this.#element.rowIndex ?? -1;
}
get rows() {
return makeReadonlyNodeList(this.#element.rows);
}
get rowSpan() {
return this.#element.rowSpan ?? 1;
}
get sectionRowIndex() {
return this.#element.sectionRowIndex ?? -1;
}
get selected() {
return this.#element.selected === true;
}
get selectedOptions() {
return makeReadonlyNodeList(this.#element.selectedOptions);
}
get selectedIndex() {
return this.#element.selectedIndex ?? -1;
}
get selectionDirection() {
return typeof this.#element.selectionDirection === "string"
? this.#element.selectionDirection
: null;
}
get selectionEnd() {
return this.#element.selectionEnd ?? null;
}
get selectionStart() {
return this.#element.selectionStart ?? null;
}
get shadowRoot() {
return wrapNode(this.#element.shadowRoot);
}
get search() {
return typeof this.#element.search === "string" ? this.#element.search : "";
}
get seekable() {
return makeReadonlyTimeRanges(this.#element.seekable);
}
get size() {
return this.#element.size ?? 0;
}
get sizes() {
return typeof this.#element.sizes === "string" ? this.#element.sizes : "";
}
get slot() {
return typeof this.#element.slot === "string" ? this.#element.slot : "";
}
get src() {
return typeof this.#element.src === "string" ? this.#element.src : "";
}
get srcdoc() {
return typeof this.#element.srcdoc === "string" ? this.#element.srcdoc : "";
}
get srcset() {
return typeof this.#element.srcset === "string" ? this.#element.srcset : "";
}
get step() {
return typeof this.#element.step === "string" ? this.#element.step : "";
}
get style() {
return wrapStyle(this.#element.style);
}
get tagName() {
return this.#element.tagName;
}
get tabIndex() {
return this.#element.tabIndex ?? -1;
}
get tBodies() {
return makeReadonlyNodeList(this.#element.tBodies);
}
get tFoot() {
return wrapNode(this.#element.tFoot);
}
get tHead() {
return wrapNode(this.#element.tHead);
}
get target() {
return typeof this.#element.target === "string" ? this.#element.target : "";
}
get text() {
return typeof this.#element.text === "string"
? this.#element.text
: this.textContent;
}
get textTracks() {
return makeReadonlyTrackList(this.#element.textTracks);
}
get title() {
return typeof this.#element.title === "string" ? this.#element.title : "";
}
get type() {
return typeof this.#element.type === "string" ? this.#element.type : "";
}
get validationMessage() {
return typeof this.#element.validationMessage === "string"
? this.#element.validationMessage
: "";
}
get validity() {
return makeReadonlyValidityState(this.#element.validity);
}
get value() {
return typeof this.#element.value === "string" ? this.#element.value : "";
}
get valueAsNumber() {
return this.#element.valueAsNumber ?? null;
}
get audioTracks() {
return makeReadonlyTrackList(this.#element.audioTracks);
}
get videoHeight() {
return this.#element.videoHeight ?? 0;
}
get videoTracks() {
return makeReadonlyTrackList(this.#element.videoTracks);
}
get videoWidth() {
return this.#element.videoWidth ?? 0;
}
get width() {
return this.#element.width ?? 0;
}
get willValidate() {
return this.#element.willValidate === true;
}
closest(selector) {
return wrapNode(this.#element.closest(String(selector)));
}
getAttribute(name) {
return this.#element.getAttribute(String(name));
}
getBoundingClientRect() {
return makeReadonlyRect(this.#element.getBoundingClientRect());
}
getClientRects() {
return makeReadonlyList(
Array.from(this.#element.getClientRects(), makeReadonlyRect),
);
}
getElementsByClassName(className) {
return makeReadonlyNodeList(
this.#element.getElementsByClassName(String(className)),
);
}
getElementsByTagName(tagName) {
return makeReadonlyNodeList(
this.#element.getElementsByTagName(String(tagName)),
);
}
hasAttribute(name) {
return this.#element.hasAttribute(String(name));
}
matches(selector) {
return this.#element.matches(String(selector));
}
querySelector(selector) {
return wrapNode(this.#element.querySelector(String(selector)));
}
querySelectorAll(selector) {
return makeReadonlyNodeList(
this.#element.querySelectorAll(String(selector)),
);
}
scroll(leftOrOptions, top) {
this.scrollTo(leftOrOptions, top);
}
scrollBy(leftOrOptions, top) {
if (typeof this.#element.scrollBy !== "function") {
return;
}
if (
leftOrOptions != null &&
typeof leftOrOptions === "object" &&
!Array.isArray(leftOrOptions)
) {
this.#element.scrollBy({ ...leftOrOptions });
return;
}
this.#element.scrollBy(Number(leftOrOptions ?? 0), Number(top ?? 0));
}
scrollIntoView(arg) {
if (typeof this.#element.scrollIntoView !== "function") {
return;
}
if (arg == null || typeof arg === "boolean") {
this.#element.scrollIntoView(arg);
return;
}
if (typeof arg === "object" && !Array.isArray(arg)) {
this.#element.scrollIntoView({ ...arg });
return;
}
this.#element.scrollIntoView(Boolean(arg));
}
scrollTo(leftOrOptions, top) {
if (typeof this.#element.scrollTo !== "function") {
return;
}
if (
leftOrOptions != null &&
typeof leftOrOptions === "object" &&
!Array.isArray(leftOrOptions)
) {
this.#element.scrollTo({ ...leftOrOptions });
return;
}
this.#element.scrollTo(Number(leftOrOptions ?? 0), Number(top ?? 0));
}
toJSON() {
return {
id: this.id,
tagName: this.tagName,
textContent: this.textContent,
};
}
}
class ReadonlyDocumentFragment extends ReadonlyNode {
#fragment;
constructor(fragment, token) {
super(fragment, token);
this.#fragment = fragment;
Object.freeze(this);
}
get activeElement() {
return wrapNode(this.#fragment.activeElement);
}
get adoptedStyleSheets() {
return makeReadonlyList(
Array.from(this.#fragment.adoptedStyleSheets ?? [], wrapCSSStyleSheet),
);
}
get childElementCount() {
return this.#fragment.childElementCount ?? this.children.length;
}
get children() {
return makeReadonlyNodeList(this.#fragment.children);
}
get firstElementChild() {
return wrapNode(this.#fragment.firstElementChild);
}
get host() {
return wrapNode(this.#fragment.host);
}
get innerHTML() {
return typeof this.#fragment.innerHTML === "string"
? this.#fragment.innerHTML
: "";
}
get lastElementChild() {
return wrapNode(this.#fragment.lastElementChild);
}
get mode() {
return typeof this.#fragment.mode === "string"
? this.#fragment.mode
: undefined;
}
get styleSheets() {
return makeReadonlyList(
Array.from(this.#fragment.styleSheets ?? [], wrapCSSStyleSheet),
);
}
getElementById(id) {
return typeof this.#fragment.getElementById === "function"
? wrapNode(this.#fragment.getElementById(String(id)))
: null;
}
querySelector(selector) {
return typeof this.#fragment.querySelector === "function"
? wrapNode(this.#fragment.querySelector(String(selector)))
: null;
}
querySelectorAll(selector) {
return makeReadonlyNodeList(
typeof this.#fragment.querySelectorAll === "function"
? this.#fragment.querySelectorAll(String(selector))
: [],
);
}
}
class ReadonlyDocument extends ReadonlyNode {
#document;
constructor(document, token) {
super(document, token);
this.#document = document;
Object.freeze(this);
}
get activeElement() {
return wrapNode(this.#document.activeElement);
}
get body() {
return wrapNode(this.#document.body);
}
get characterSet() {
return this.#document.characterSet;
}
get cookie() {
return undefined;
}
get contentType() {
return this.#document.contentType;
}
get defaultView() {
return windowObject;
}
get adoptedStyleSheets() {
return makeReadonlyList(
Array.from(this.#document.adoptedStyleSheets ?? [], wrapCSSStyleSheet),
);
}
get compatMode() {
return this.#document.compatMode;
}
get doctype() {
return wrapNode(this.#document.doctype);
}
get documentElement() {
return wrapNode(this.#document.documentElement);
}
get fonts() {
return wrapFontFaceSet(this.#document.fonts);
}
get forms() {
return makeReadonlyNodeList(this.#document.forms);
}
get head() {
return wrapNode(this.#document.head);
}
get hidden() {
return this.#document.hidden === true;
}
get images() {
return makeReadonlyNodeList(this.#document.images);
}
get lastModified() {
return this.#document.lastModified;
}
get links() {
return makeReadonlyNodeList(this.#document.links);
}
get location() {
return locationObject;
}
get readyState() {
return this.#document.readyState;
}
get referrer() {
return this.#document.referrer;
}
get scripts() {
return makeReadonlyNodeList(this.#document.scripts);
}
get scrollingElement() {
return wrapNode(this.#document.scrollingElement);
}
get styleSheets() {
return makeReadonlyList(
Array.from(this.#document.styleSheets ?? [], wrapCSSStyleSheet),
);
}
get title() {
return this.#document.title;
}
get URL() {
return this.#document.URL;
}
get visibilityState() {
return this.#document.visibilityState;
}
elementFromPoint(x, y) {
return typeof this.#document.elementFromPoint === "function"
? wrapNode(this.#document.elementFromPoint(Number(x), Number(y)))
: null;
}
elementsFromPoint(x, y) {
return makeReadonlyNodeList(
typeof this.#document.elementsFromPoint === "function"
? this.#document.elementsFromPoint(Number(x), Number(y))
: [],
);
}
getElementById(id) {
return wrapNode(this.#document.getElementById(String(id)));
}
getElementsByClassName(className) {
return makeReadonlyNodeList(
this.#document.getElementsByClassName(String(className)),
);
}
getElementsByName(name) {
return makeReadonlyNodeList(
this.#document.getElementsByName(String(name)),
);
}
getElementsByTagName(tagName) {
return makeReadonlyNodeList(this.#document.getElementsByTagName(String(tagName)));
}
querySelector(selector) {
return wrapNode(this.#document.querySelector(String(selector)));
}
querySelectorAll(selector) {
return makeReadonlyNodeList(
this.#document.querySelectorAll(String(selector)),
);
}
}
// Raw DOM references are closure-owned, not methods on exposed wrappers.
// That keeps helper APIs like contains() and getComputedStyle() usable without
// adding a model-visible path back to the mutable DOM.
const unwrapNode = (value) =>
value != null && (typeof value === "object" || typeof value === "function")
? rawNodesByWrapper.get(value) ?? null
: null;
const unwrapElement = (value) => {
const node = unwrapNode(value);
return node?.nodeType === ELEMENT_NODE ? node : null;
};
const isElement = (node) => node?.nodeType === ELEMENT_NODE;
const isDocument = (node) => node?.nodeType === DOCUMENT_NODE;
const isDocumentFragment = (node) => node?.nodeType === DOCUMENT_FRAGMENT_NODE;
const wrapNode = (node) => {
if (node == null) return null;
const existing = nodeWrappers.get(node);
if (existing != null) return existing;
const wrapper = isDocument(node)
? new ReadonlyDocument(node, wrapperToken)
: isElement(node)
? new ReadonlyElement(node, wrapperToken)
: isDocumentFragment(node)
? new ReadonlyDocumentFragment(node, wrapperToken)
: new ReadonlyNode(node, wrapperToken);
nodeWrappers.set(node, wrapper);
return wrapper;
};
const wrapNodeCollectionResult = (value) => {
if (value == null) return null;
if (typeof value.nodeType === "number") return wrapNode(value);
if (
(typeof value === "object" || typeof value === "function") &&
typeof value.length === "number"
) {
return makeReadonlyNodeList(value);
}
return null;
};
const makeReadonlyNodeList = (nodes) => {
const rawNodes = Array.from(nodes ?? []);
return makeReadonlyList(rawNodes.map(wrapNode), (list) => {
defineHiddenReadonly(list, "namedItem", (name) => {
const key = String(name);
const rawNamedItem =
typeof nodes?.namedItem === "function"
? nodes.namedItem(key)
: (rawNodes.find((node) => node?.id === key || node?.name === key) ??
null);
return wrapNodeCollectionResult(rawNamedItem);
});
});
};
const locationObject = new ReadonlyLocation();
const windowObject = Object.create(null);
const documentObject = wrapNode(rawDocument);
const safeGetComputedStyle = (element, pseudoElement) => {
const rawElement = unwrapElement(element);
if (rawElement == null) throw new TypeError("getComputedStyle expects an Element");
return wrapStyle(rawWindow.getComputedStyle(rawElement, pseudoElement));
};
const safeGetSelection = () =>
typeof rawWindow.getSelection === "function"
? wrapSelection(rawWindow.getSelection())
: null;
const safeMatchMedia = (query) => {
if (typeof rawWindow.matchMedia !== "function") return null;
return wrapMediaQueryList(rawWindow.matchMedia(String(query)));
};
const isScrollOptionsObject = (value) =>
value != null && typeof value === "object" && !Array.isArray(value);
const finiteNumber = (value, fallback) => {
if (value == null) return fallback;
const number = Number(value);
return Number.isFinite(number) ? number : fallback;
};
const safeWindowScrollTo = (leftOrOptions, top) => {
if (typeof rawWindow.scrollTo !== "function") {
throw new TypeError("scrollTo is not available");
}
if (isScrollOptionsObject(leftOrOptions)) {
rawWindow.scrollTo({ ...leftOrOptions });
return;
}
rawWindow.scrollTo(
finiteNumber(leftOrOptions, 0),
finiteNumber(top, 0),
);
};
const safeWindowScrollBy = (leftOrOptions, top) => {
const currentX = finiteNumber(rawWindow.scrollX, 0);
const currentY = finiteNumber(rawWindow.scrollY, 0);
if (typeof rawWindow.scrollBy === "function") {
if (isScrollOptionsObject(leftOrOptions)) {
rawWindow.scrollBy({ ...leftOrOptions });
return;
}
rawWindow.scrollBy(
finiteNumber(leftOrOptions, 0),
finiteNumber(top, 0),
);
return;
}
if (isScrollOptionsObject(leftOrOptions)) {
safeWindowScrollTo({
left: currentX + finiteNumber(leftOrOptions.left, 0),
top: currentY + finiteNumber(leftOrOptions.top, 0),
});
return;
}
safeWindowScrollTo(
currentX + finiteNumber(leftOrOptions, 0),
currentY + finiteNumber(top, 0),
);
};
const safeSetTimeout = (callback, delay, ...args) => {
if (typeof callback !== "function") {
throw new TypeError("setTimeout callback must be a function");
}
if (typeof rawWindow.setTimeout !== "function") {
throw new TypeError("setTimeout is not available");
}
return rawWindow.setTimeout(
() => {
callback(...args);
},
finiteNumber(delay, 0),
);
};
const safeClearTimeout = (timeoutId) => {
if (typeof rawWindow.clearTimeout === "function") {
rawWindow.clearTimeout(timeoutId);
}
};
const cssObject = Object.freeze({
escape:
typeof rawWindow.CSS?.escape === "function"
? (value) => rawWindow.CSS.escape(String(value))
: undefined,
supports:
typeof rawWindow.CSS?.supports === "function"
? (property, value) =>
value === undefined
? rawWindow.CSS.supports(String(property))
: rawWindow.CSS.supports(String(property), String(value))
: undefined,
});
defineHiddenReadonly(windowObject, "constructor", undefined);
defineReadonly(windowObject, "CSS", cssObject);
defineReadonly(windowObject, "document", documentObject);
defineReadonly(windowObject, "location", locationObject);
defineReadonly(windowObject, "self", windowObject);
defineReadonly(windowObject, "top", windowObject);
defineReadonly(windowObject, "window", windowObject);
defineReadonly(windowObject, "getComputedStyle", safeGetComputedStyle);
defineReadonly(windowObject, "getSelection", safeGetSelection);
defineReadonly(windowObject, "matchMedia", safeMatchMedia);
defineReadonly(windowObject, "clearTimeout", safeClearTimeout);
defineReadonly(windowObject, "scroll", safeWindowScrollTo);
defineReadonly(windowObject, "scrollBy", safeWindowScrollBy);
defineReadonly(windowObject, "scrollTo", safeWindowScrollTo);
defineReadonly(windowObject, "setTimeout", safeSetTimeout);
defineReadonly(
windowObject,
"visualViewport",
wrapVisualViewport(rawWindow.visualViewport),
);
for (const name of [
"devicePixelRatio",
"innerHeight",
"innerWidth",
"outerHeight",
"outerWidth",
"pageXOffset",
"pageYOffset",
"scrollX",
"scrollY",
]) {
defineReadonlyGetter(windowObject, name, () => rawWindow[name]);
}
Object.freeze(windowObject);
const consoleObject = Object.freeze({
debug() {},
error() {},
info() {},
log() {},
warn() {},
});
const cssRuleObject = Object.freeze({
CHARSET_RULE: rawWindow.CSSRule?.CHARSET_RULE ?? 2,
FONT_FACE_RULE: rawWindow.CSSRule?.FONT_FACE_RULE ?? 5,
IMPORT_RULE: rawWindow.CSSRule?.IMPORT_RULE ?? 3,
KEYFRAME_RULE: rawWindow.CSSRule?.KEYFRAME_RULE ?? 8,
KEYFRAMES_RULE: rawWindow.CSSRule?.KEYFRAMES_RULE ?? 7,
MEDIA_RULE: rawWindow.CSSRule?.MEDIA_RULE ?? 4,
NAMESPACE_RULE: rawWindow.CSSRule?.NAMESPACE_RULE ?? 10,
PAGE_RULE: rawWindow.CSSRule?.PAGE_RULE ?? 6,
STYLE_RULE: rawWindow.CSSRule?.STYLE_RULE ?? 1,
SUPPORTS_RULE: rawWindow.CSSRule?.SUPPORTS_RULE ?? 12,
});
const nodeObject = Object.freeze({
COMMENT_NODE,
DOCUMENT_FRAGMENT_NODE,
DOCUMENT_NODE,
DOCUMENT_TYPE_NODE,
ELEMENT_NODE,
TEXT_NODE,
});
const rangeObject = Object.freeze({
END_TO_END: rawWindow.Range?.END_TO_END ?? 2,
END_TO_START: rawWindow.Range?.END_TO_START ?? 3,
START_TO_END: rawWindow.Range?.START_TO_END ?? 1,
START_TO_START: rawWindow.Range?.START_TO_START ?? 0,
});
for (const name of ["createObjectURL", "revokeObjectURL"]) {
defineHiddenReadonly(URL, name, undefined);
}
for (const namespace of [
JSON,
Math,
Reflect,
consoleObject,
cssObject,
cssRuleObject,
nodeObject,
rangeObject,
]) {
Object.freeze(namespace);
}
// This object is the global allowlist used by the scope proxy below.
// Anything not listed here resolves as undefined instead of falling through
// to the isolated world's real global.
const safeBindings = Object.freeze({
Array,
Boolean,
console: consoleObject,
CSS: cssObject,
CSSRule: cssRuleObject,
CSSRuleList: Array,
CSSStyleDeclaration: ReadonlyStyleDeclaration,
CSSStyleSheet: ReadonlyCSSStyleSheet,
Date,
document: documentObject,
Element: ReadonlyElement,
DocumentFragment: ReadonlyDocumentFragment,
Error,
getComputedStyle: safeGetComputedStyle,
getSelection: safeGetSelection,
HTMLCollection: Array,
Infinity,
isFinite,
isNaN,
JSON,
location: locationObject,
Map,
Math,
matchMedia: safeMatchMedia,
MediaList: Array,
NaN,
Node: nodeObject,
NodeList: Array,
Number,
Object,
Promise,
RangeError,
Range: rangeObject,
ReferenceError,
Reflect,
RegExp,
Set,
Selection: ReadonlySelection,
String,
StyleSheetList: Array,
Symbol,
ShadowRoot: ReadonlyDocumentFragment,
clearTimeout: safeClearTimeout,
scroll: safeWindowScrollTo,
scrollBy: safeWindowScrollBy,
scrollTo: safeWindowScrollTo,
setTimeout: safeSetTimeout,
TypeError,
undefined,
URIError,
URL,
URLSearchParams,
visualViewport: windowObject.visualViewport,
window: windowObject,
self: windowObject,
top: windowObject,
});
// The with-scope proxy claims every identifier lookup made by the user
// script, so unlisted globals cannot leak through.
const scope = new Proxy(Object.create(null), {
defineProperty() {
throw readonlyError("global defineProperty");
},
deleteProperty() {
throw readonlyError("global delete");
},
get(_target, property) {
if (property === Symbol.unscopables) return undefined;
if (typeof property !== "string") return undefined;
if (Object.prototype.hasOwnProperty.call(safeBindings, property)) {
return safeBindings[property];
}
if (Object.prototype.hasOwnProperty.call(windowObject, property)) {
return windowObject[property];
}
return undefined;
},
has() {
return true;
},
set() {
throw readonlyError("global assignment");
},
});
const poisonConstructor = (prototype) => {
try {
Object.defineProperty(prototype, "constructor", {
configurable: false,
enumerable: false,
value: undefined,
writable: false,
});
} catch {}
};
// User code can create functions/classes/objects inside the isolated world.
// Hide constructor links and freeze exposed intrinsics before it runs so those
// objects cannot be used to climb back to a broader global or mutate helpers
// that serialization relies on.
const lockdownConstructors = (constructors) => {
for (const constructor of constructors) {
poisonConstructor(constructor.prototype);
Object.freeze(constructor.prototype);
Object.freeze(constructor);
}
};
lockdownConstructors([
Object,
Function,
Array,
Promise,
Map,
Set,
WeakMap,
WeakSet,
RegExp,
Error,
Number,
String,
Boolean,
Date,
URL,
URLSearchParams,
ReadonlyStyleDeclaration,
ReadonlyMediaList,
ReadonlyCSSRule,
ReadonlyCSSStyleSheet,
ReadonlyRange,
ReadonlySelection,
ReadonlyFontFaceSet,
ReadonlyMediaQueryList,
ReadonlyVisualViewport,
ReadonlyLocation,
ReadonlyNode,
ReadonlyElement,
ReadonlyDocumentFragment,
ReadonlyDocument,
]);
for (const prototype of [
Object.getPrototypeOf(async function () {}),
Object.getPrototypeOf(function* () {}),
Object.getPrototypeOf(async function* () {}),
]) {
if (prototype != null) {
poisonConstructor(prototype);
Object.freeze(prototype);
}
}
const serializeResult = (value) => {
// Runtime.evaluate returns only this bounded JSON-ish projection. Live DOM
// wrappers never cross the boundary back to the caller.
const seen = new WeakSet();
const serializeNonObject = (current) => {
switch (typeof current) {
case "bigint":
return current.toString();
case "boolean":
case "undefined":
return current;
case "function":
case "symbol":
return undefined;
case "number":
return Number.isFinite(current) ? current : null;
case "string":
return current.length > RESULT_MAX_STRING_LENGTH
? current.slice(0, RESULT_MAX_STRING_LENGTH) + "[Truncated]"
: current;
default:
return current;
}
};
const serializeArray = (items, depth) =>
items
.slice(0, RESULT_MAX_ARRAY_LENGTH)
.map((item) => serialize(item, depth + 1));
const serializeObject = (current, depth) => {
if (depth > RESULT_MAX_DEPTH) return "[MaxDepth]";
if (seen.has(current)) return "[Circular]";
seen.add(current);
if (
rawNodesByWrapper.has(current) ||
styleWrappers.has(current) ||
cssWrappers.has(current) ||
selectionAndRangeWrappers.has(current) ||
readonlyApiWrappers.has(current)
) {
return serialize(current.toJSON(), depth);
}
if (Array.isArray(current)) return serializeArray(current, depth);
const output = {};
for (const key of ownKeys(current)) {
const serialized = serialize(current[key], depth + 1);
if (serialized !== undefined) output[key] = serialized;
}
return output;
};
const serialize = (current, depth) =>
current == null || typeof current !== "object"
? serializeNonObject(current)
: serializeObject(current, depth);
return serialize(value, 0);
};
const runUserScript = async () => {
with (scope) {
return await (async function () {
"use strict";
${e}
}).call(windowObject);
}
};
return runUserScript().then(serializeResult);
})()`}function E5(e){if(x5.test(e))throw new Error("module loading is not available in playwright.evaluate")}function C5(e){let t=e.frameTree.frame.id;if(!t)throw new Error("playwright.evaluate could not find a frame");return t}function T5(e){if(e.exceptionDetails!=null){let r=e.exceptionDetails.exception?.description??e.exceptionDetails.text??"Runtime.evaluate failed";throw new Error(r)}let t=e.result;if(t!=null)return t.unserializableValue!=null?k5(t.unserializableValue):t.value}function k5(e){switch(e){case"-0":return-0;case"NaN":return null;case"Infinity":return null;case"-Infinity":return null}return/^-?\d+n$/.test(e)?e.slice(0,-1):e}var c1=_(rn.Bundle,async(e,t)=>{let r=k(e.tab_id),n=await t.tabs.get(r);return await t.pageAssets.bundle({assetIds:e.assetIds,documentUrl:n.url,inventoryId:e.inventoryId,kinds:e.kinds,tabId:r})});var d1=_(rn.List,async(e,t)=>{let r=k(e.tab_id),n=await t.tabs.get(r);return await t.pageAssets.list({documentUrl:n.url,tabId:r})});var A5=e=>{if(e===null)return null;if(typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof String||e instanceof Boolean)return e.valueOf();if(e instanceof Number){let t=e.valueOf();return Number.isFinite(t)?t:void 0}},I5=e=>typeof e=="number"&&Number.isInteger(e)&&e>0,p1=(e,t)=>{if(!I5(t))return e;let r=t;if(e.length<=r)return e;let n=e.length-r;return`${e.slice(0,r)}[truncated ${n} chars]`},R5=(e,t)=>{switch(e.type){case"function":return e;case"error":case"object":return{...e,value:p1(e.value,t)};case"value":return typeof e.value!="string"?e:{...e,value:p1(e.value,t)}}},P5=async(e,t,r)=>{let{displayImage:n,displayValue:o}=e,i=null;try{if(t instanceof Uint8Array){await n(t);return}else if(t===void 0)i={type:"value",value:void 0};else if(typeof t=="function")i={type:"function",value:void 0};else{let s=A5(t);s!==void 0&&(i={type:"value",value:s})}if(i===null){let s=JSON.stringify(t);s===void 0&&(s=String(t)),i={type:"object",value:s}}}catch(s){i={type:"error",value:String(s)}}i&&await o(R5(i,r))};function f1({displayBridge:e,displayTruncateMaxChars:t}){return r=>P5(e,r,t)}function bc(e){return e?.type==="extension"||e?.type==="iab"&&e.metadata?.codexIabTabMode==="multiTab"}var yc=class{constructor(t,r){this.api=t;this.clientInfo=r}api;clientInfo;async openTabs(){return await this.api.getUserTabs()}async history(t){return await this.api.getUserHistory(t)}async claimTab(t){if(!bc(this.clientInfo))throw new Error("browser.user.claimTab is only available with the Chrome or multi-tab IAB backend.");return await this.api.claimUserTab(t)}};function m1(e){return e==="right"||e==="middle"?e:"left"}function ch(e){switch(e){case"right":return 2;case"middle":return 4;case"left":return 1}}var D5="const __name = (target) => target;";async function dh(e,t,r){let n=qC(e,r),o=await qa(t,n.target,n.frameId,n.loaderId,N5(n.localRef,n.viewportClip),{returnByValue:!0});if(o.exceptionDetails!=null)throw new Error(F5(o.exceptionDetails));let i=M5(o.result.value);if(i==null)throw new Error(`DOM node ${r} is stale or missing`);return{point:await $C(e,t,n.frameId,i),target:n.target}}function N5(e,t){return`(() => {
${D5}
return (${O5.toString()})(${JSON.stringify(e)}, ${JSON.stringify(t)});
})()`}function O5(e,t){let n=globalThis.__browserUseVisibleDomState?.refToElement.get(e);if(!n?.isConnected)return null;n.scrollIntoView({block:"nearest",inline:"nearest"});let o=i=>{if(i.width<=0||i.height<=0)return null;let s=Math.max(i.left,t.left),a=Math.min(i.right,t.right),u=Math.max(i.top,t.top),l=Math.min(i.bottom,t.bottom);return a>s&&l>u?{x:s+(a-s)/2,y:u+(l-u)/2}:null};for(let i of n.getClientRects()){let s=o(i);if(s!=null)return s}return o(n.getBoundingClientRect())}function M5(e){if(e==null||typeof e!="object")return null;let t=e;return typeof t.x=="number"&&typeof t.y=="number"?{x:t.x,y:t.y}:null}function F5(e){let t=e.exception;return typeof t?.value=="string"?t.value:t?.description??e.text??"DOM node failed"}var _c=class{constructor(t,r){this.cdp=t;this.ui=r}cdp;ui;async dispatchKeyPress(t){if(!Array.isArray(t.keys)||t.keys.length===0)throw new Error(`${t.commandName} requires a non-empty keys array`);await Wl(this.cdp,k(t.tabId),t.keys)}async dispatchMouseMove(t,r,n){await this.ui.moveMouse(t,r.x,r.y),await this.cdp.call(t,"Input.dispatchMouseEvent",{type:"mouseMoved",x:r.x,y:r.y,button:"none",buttons:0,modifiers:n})}async getBackendNodeViewportPoint(t,r){await this.cdp.call(t,"DOM.scrollIntoViewIfNeeded",{backendNodeId:r});try{let{quads:i}=await this.cdp.call(t,"DOM.getContentQuads",{backendNodeId:r}),s=h1(i[0]);if(s!=null)return s}catch{}let{model:n}=await this.cdp.call(t,"DOM.getBoxModel",{backendNodeId:r}),o=h1(n.border);if(o==null)throw new Error(`Missing DOM geometry for backend node ${r}`);return o}async clickDomCuaNode(t){let{point:r,target:n}=await dh(t.tabId,this.cdp,t.nodeId);await this.clickPoint({clickCount:t.clickCount,...Wa(n)?{loadTarget:n}:{},modifiers:0,point:r,tabId:t.tabId,timeoutMs:t.timeoutMs==null?void 0:se({timeout_ms:t.timeoutMs})})}async scrollDomCuaNode(t){let{point:r}=await dh(t.tabId,this.cdp,t.nodeId);await this.scrollPoint({modifiers:0,point:r,scrollX:t.scrollX,scrollY:t.scrollY,tabId:t.tabId})}async dragPath(t){let r=k(t.tabId),[n,...o]=t.path;if(!n)throw new Error("cua_drag requires a non-empty path");let i="left";await this.dispatchMouseMove(r,n,t.modifiers),await this.dispatchMouseDown({button:i,clickCount:1,modifiers:t.modifiers,point:n,tabId:r});let s=n,a=!1;try{for(let u of o)s=u,await this.dispatchPressedMouseMove(r,u,i,t.modifiers);a=!0,await this.dispatchMouseUp({button:i,clickCount:1,modifiers:t.modifiers,point:s,tabId:r})}finally{a||await this.dispatchMouseUp({button:i,clickCount:1,modifiers:t.modifiers,point:s,tabId:r}).catch(()=>{})}}async scrollPoint(t){let r=k(t.tabId),n=t.scrollX===0?0:-t.scrollX,o=t.scrollY===0?0:-t.scrollY;await this.dispatchMouseMove(r,t.point,t.modifiers),await this.cdp.call(r,"Input.synthesizeScrollGesture",{x:t.point.x,y:t.point.y,xDistance:n,yDistance:o,gestureSourceType:"mouse",preventFling:!0,speed:8e3})}async clickPoint(t){let r=k(t.tabId),n=se({timeout_ms:t.timeoutMs}),o=t.button??"left",i=t.loadTarget==null||!Wa(t.loadTarget)?[r]:[t.loadTarget,r],s=Promise.all(i.map(async u=>this.cdp.waitForPageLoadEvent(u,{timeoutMs:n}))),a=s.catch(()=>{});try{await this.dispatchMouseMove(r,t.point,t.modifiers);for(let u=1;u<=t.clickCount;u+=1)await this.dispatchMouseDown({button:o,clickCount:u,modifiers:t.modifiers,point:t.point,tabId:r}),await this.dispatchMouseUp({button:o,clickCount:u,modifiers:t.modifiers,point:t.point,tabId:r})}catch(u){throw await a,u}await s}async dispatchMouseDown(t){await this.cdp.call(t.tabId,"Input.dispatchMouseEvent",{type:"mousePressed",x:t.point.x,y:t.point.y,button:t.button,buttons:ch(t.button),clickCount:t.clickCount,modifiers:t.modifiers})}async dispatchMouseUp(t){await this.dispatchCdpMouseRelease(t)}async dispatchPressedMouseMove(t,r,n,o){await this.ui.moveMouse(t,r.x,r.y,{waitForArrival:!1}),await this.cdp.call(t,"Input.dispatchMouseEvent",{type:"mouseMoved",x:r.x,y:r.y,button:n,buttons:ch(n),modifiers:o})}async dispatchCdpMouseRelease(t){await this.cdp.call(t.tabId,"Input.dispatchMouseEvent",{type:"mouseReleased",x:t.point.x,y:t.point.y,button:t.button,buttons:0,clickCount:t.clickCount,modifiers:t.modifiers})}};function h1(e){if(e==null||e.length<8)return null;let[t,r,n,o,i,s,a,u]=e;return{x:(t+n+i+a)/4,y:(r+o+s+u)/4}}var wc=class{constructor(t){this.cdp=t;this.cdp.addTabAttachHandler(r=>{if(!this.runtimeEnablePromises.has(r))return this.ensureRuntimeEnabled(r)}),this.cdp.on("tabDetached",r=>{this.logsByTabId.delete(r),this.runtimeEnabledTabIds.delete(r),this.runtimeEnablePromises.delete(r)}),this.cdp.on("event",r=>{this.handleCdpEvent(r)})}cdp;logsByTabId=new Map;runtimeEnabledTabIds=new Set;runtimeEnablePromises=new Map;async logs({tabId:t,filter:r,levels:n,limit:o=100}){await this.ensureRuntimeEnabled(t);let i=n?new Set(n):null;return(this.logsByTabId.get(t)??[]).filter(a=>!(r&&!a.message.includes(r)||i&&!i.has(a.level))).slice(-o)}async ensureRuntimeEnabled(t){if(this.runtimeEnabledTabIds.has(t))return;let r=this.runtimeEnablePromises.get(t);if(r){await r;return}let n=(async()=>{await this.cdp.call(t,"Runtime.enable"),this.runtimeEnabledTabIds.add(t)})();this.runtimeEnablePromises.set(t,n);try{await n}finally{this.runtimeEnablePromises.delete(t)}}handleCdpEvent(t){let r=t.source.tabId;if(typeof r=="number"){if(t.method==="Runtime.consoleAPICalled"){let n=B5(t.params);n&&this.pushLog(r,n);return}if(t.method==="Runtime.exceptionThrown"){let n=L5(t.params);n&&this.pushLog(r,n)}}}pushLog(t,r){let n=this.logsByTabId.get(t)??[];n.push(r),n.length>500&&n.splice(0,n.length-500),this.logsByTabId.set(t,n)}};function B5(e){return hn(e)?{level:$5(Va(e,"type")),message:j5(e.args),timestamp:new Date().toISOString(),...q5(e.stackTrace)}:null}function L5(e){if(!hn(e)||!hn(e.exceptionDetails))return null;let t=hn(e.exceptionDetails.exception)?e.exceptionDetails.exception:null;return{level:"error",message:U5(e.exceptionDetails,t),timestamp:new Date().toISOString(),...g1(Va(e.exceptionDetails,"url"))}}function U5(e,t){let r=t?.value;return typeof r=="string"?r:Va(t??{},"description")??Va(e,"text")??"Uncaught exception"}function j5(e){return!Array.isArray(e)||e.length===0?"":e.map(t=>hn(t)?t.type==="string"?String(t.value??""):t.value!==void 0?String(t.value):typeof t.description=="string"?t.description:"[object]":"[object]").join(" ")}function q5(e){if(!hn(e)||!Array.isArray(e.callFrames))return{};let[t]=e.callFrames;return hn(t)?g1(Va(t,"url")):{}}function g1(e){return e?{url:e}:{}}function $5(e){switch(e){case"debug":return"debug";case"info":return"info";case"warning":case"warn":return"warn";case"error":return"error";default:return"log"}}function Va(e,t){let r=e[t];return typeof r=="string"?r:void 0}function hn(e){return typeof e=="object"&&e!=null}import{EventEmitter as z5}from"node:events";var xc=class extends z5{constructor(r,n,o,i){super();this.cdp=n;this.security=o;this.clientType=i;r.addEventListener("onDownloadChange",s=>{this.filenamesById.set(s.id,s.filename),this.emit("change",s)}),this.cdp.addTabAttachHandler(async s=>{await this.cdp.call(s,"Fetch.enable",{patterns:[{requestStage:"Response",resourceType:"Document"}]})}),this.cdp.on("tabDetached",async s=>{this.removeEnabledTab(s),this.allowedDownloadUrlsByTabId.delete(s),this.pendingDownloadRequestsByTabId.delete(s)}),this.cdp.on("event",s=>{this.handleCdpEvent(s).catch(()=>{})})}cdp;security;clientType;filenamesById=new Map;downloadEnabled=[];allowedDownloadUrlsByTabId=new Map;pendingDownloadRequestsByTabId=new Map;disposeList=[];async enableDownload(r){this.allowedDownloadUrlsByTabId.delete(r),this.downloadEnabled.includes(r)||this.downloadEnabled.push(r)}async disableDownload(r){this.removeEnabledTab(r),this.allowedDownloadUrlsByTabId.delete(r),await this.failPendingDownloadRequest(r)}async waitForDownload(r,n){let o=await this.waitForDownloadRequest(r,n);try{await this.security.ensureDownloadAllowed(r)}catch(i){throw await this.failPendingDownloadRequest(r,o.requestId),i}return this.pendingDownloadRequestsByTabId.delete(r),this.allowedDownloadUrlsByTabId.set(r,o.url),await this.cdp.call(r,"Fetch.continueResponse",{requestId:o.requestId}),await this.waitForCompletedDownload(r)}waitForDownloadRequest(r,n){let o=this.pendingDownloadRequestsByTabId.get(r);return o!=null?Promise.resolve(o):new Promise((i,s)=>{let a=setTimeout(()=>{l(),s(new Error(`Timed out after ${n}ms waiting for download.`))},n),u=(d,p)=>{d===r&&(l(),i(p))},l=()=>{clearTimeout(a),this.removeListener("request",u)};this.addListener("request",u)})}waitForCompletedDownload(r){return new Promise((n,o)=>{let i=null,s=a=>{if(i==null){if(a.status!=="started"||a.url!==this.allowedDownloadUrlsByTabId.get(r))return;i=a.id;return}if(a.id===i&&!(a.status==="started"||a.status==="in_progress"))switch(this.removeListener("change",s),a.status){case"complete":n(a);return;case"failed":o(new Error(`Download ${a.id} failed.`));return;case"canceled":o(new Error(`Download ${a.id} was canceled.`));return}};this.addListener("change",s)})}getPath(r){return this.filenamesById.get(r)??null}isDownload(r){return r.resourceType==="Document"&&!G5(r)&&(W5(r.responseHeaders)||!V5(H5(r.responseHeaders),this.clientType))}async handleCdpEvent(r){if(r.method!=="Fetch.requestPaused")return;let n=r.source.tabId;if(typeof n!="number")return;if(!this.isDownload(r.params)){await this.cdp.call(n,"Fetch.continueResponse",{requestId:r.params.requestId});return}if(!this.downloadEnabled.includes(n)){await this.cdp.call(n,"Fetch.failRequest",{requestId:r.params.requestId,errorReason:"BlockedByClient"});return}let i={requestId:r.params.requestId,url:r.params.request.url};this.pendingDownloadRequestsByTabId.set(n,i),this.removeEnabledTab(n),this.emit("request",n,i)}removeEnabledTab(r){let n=this.downloadEnabled.indexOf(r);n>=0&&this.downloadEnabled.splice(n,1)}async failPendingDownloadRequest(r,n){let o=this.pendingDownloadRequestsByTabId.get(r);o!=null&&(n!=null&&o.requestId!==n||(this.pendingDownloadRequestsByTabId.delete(r),await this.cdp.call(r,"Fetch.failRequest",{requestId:o.requestId,errorReason:"BlockedByClient"})))}};function W5(e){let t=ph(e,"content-disposition");return/^attachment(?:\s*;|\s*$)/i.test(t??"")}function H5(e){return ph(e,"content-type")?.split(";",1)[0]?.trim().toLowerCase()}function ph(e,t){return e?.find(r=>r.name.toLowerCase()===t)?.value}function V5(e,t){return e==="text/html"||t==="iab"&&e==="application/pdf"}function G5(e){return K5(e.responseStatusCode)&&ph(e.responseHeaders,"location")!=null}function K5(e){return e===301||e===302||e===303||e===307||e===308}import{randomUUID as W1}from"node:crypto";import{mkdir as Z9,rm as X9,writeFile as wh}from"node:fs/promises";import{tmpdir as Q9}from"node:os";import{extname as ej,join as Nc}from"node:path";function Ue(){return globalThis.nodeRepl?.requestMeta?.["x-codex-turn-metadata"]}function gr(e=Ue()){if(e?.thread_source==="subagent"&&typeof e.thread_id=="string")return e.thread_id;let t=e?.session_id;return typeof t=="string"?t:void 0}function J5(){let e=Ue();return["session_id","turn_id"].filter(r=>typeof e?.[r]!="string")}function Sc(){let e=J5();if(e.length!==0)throw new Error(`Missing required Codex turn metadata: ${e.join(", ")}`)}async function w1(e,t=Zo()){return Y5(e,t)}async function Y5(e,t){if(t==null)return null;try{let[r,n]=await Promise.all([t.config.readRequirements(),t.config.read({cwd:t.cwd??globalThis.nodeRepl?.cwd??null,includeLayers:!1})]);return e9(Z5(r,n),e)}catch{return"deny"}}function Z5(e,t){let r={enabled:null,allowedDomains:[],deniedDomains:[],hardDenyAllowlistMisses:!1},n=gn(gn(e.requirements)?.network);n!=null&&(b1(r,n),r.hardDenyAllowlistMisses=hh(n,"managedAllowedDomainsOnly","managed_allowed_domains_only")??!1);let o=X5(t);return r.hardDenyAllowlistMisses?o!=null&&(hh(o,"enabled")===!1&&(r.enabled=!1),Q5(r,o)):o!=null&&b1(r,o),r}function X5(e){let t=gn(e.config)??e,r=i9(t,"default_permissions","defaultPermissions");return r==null?null:gn(gn(gn(t.permissions)?.[r])?.network)??null}function b1(e,t){let r=hh(t,"enabled");r!=null&&(!r||e.enabled==null)&&(e.enabled=r);let[n,o]=x1(t);mh(e.allowedDomains,n),mh(e.deniedDomains,o)}function Q5(e,t){let[,r]=x1(t);mh(e.deniedDomains,r)}function x1(e){let t=gn(e.domains);if(t!=null){let r=[],n=[];for(let[o,i]of Object.entries(t))i==="allow"?r.push(o):i==="deny"&&n.push(o);return[r,n]}return[_1(e,"allowedDomains","allowed_domains"),_1(e,"deniedDomains","denied_domains")]}function e9(e,t){let r=t9(t);return r==null?null:e.enabled===!1||y1(e.deniedDomains,r)?"deny":!e.hardDenyAllowlistMisses||y1(e.allowedDomains,r)?null:"deny"}function t9(e){try{let t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:Ga(t.host)}catch{return null}}function y1(e,t){return e.some(r=>r9(r,t))}function r9(e,t){let r=n9(e),n=Ga(t);if(r.length===0||n.length===0)return!1;if(r==="*")return!0;if(r.startsWith("**.")){let o=r.slice(3);return n===o||n.endsWith(`.${o}`)}return o9(r,n)}function n9(e){let t=e.trim();return t==="*"?"*":t.startsWith("**.")?`**.${Ga(t.slice(3))}`:t.startsWith("*.")?`*.${Ga(t.slice(2))}`:Ga(t)}function Ga(e){let t=e.trim();if(t.startsWith("[")){let r=t.indexOf("]");if(r!==-1)return fh(t.slice(1,r))}return(t.match(/:/g)??[]).length===1?fh(t.split(":")[0]??""):fh(t)}function fh(e){return e.toLowerCase().replace(/\.+$/u,"")}function o9(e,t){let n=`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(n,"u").test(t)}function mh(e,t){for(let r of t)e.some(n=>n.toLowerCase()===r.toLowerCase())||e.push(r)}function gn(e){return e==null||typeof e!="object"||Array.isArray(e)?null:e}function hh(e,...t){for(let r of t)if(typeof e[r]=="boolean")return e[r]}function i9(e,...t){for(let r of t)if(typeof e[r]=="string")return e[r].trim()||null;return null}function _1(e,...t){for(let r of t){let n=e[r];if(Array.isArray(n))return n.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0)}return[]}function br(e){return e?.privilegedNodeRepl??Zo()}var s9="approval_mode",a9="history_approval_mode",u9="never_ask",l9="origins",c9="full_cdp_origins",d9="downloads",p9="uploads",Cc="allowed",Tc="denied",f9="download_approval_mode",m9="upload_approval_mode",C1="browsing_history",S1="approvals_reviewer",h9="guardian_subagent",g9="auto_review",b9=300*1e3,ei=new Map;async function T1(e,t){return Ic({conversationId:yr(),resource:{kind:"origin",origin:e},turn:_r()},br(t))}async function kc(e,t,r){return Ic({conversationId:yr(),resource:{kind:"fileTransfer",origin:t,transferKind:e},turn:_r()},br(r))}async function k1(e,t){return Ic({conversationId:yr(),resource:{kind:"fullCdp",origin:e},turn:_r()},br(t))}async function A1(e){return Ic({conversationId:yr(),resource:{kind:"sensitiveData",sensitiveData:C1},turn:_r()},br(e))}async function I1(e,t,r){await Rc({conversationId:yr(),resource:{kind:"origin",origin:e},turn:_r()},!0,t,br(r))}async function Ac(e,t,r,n){await Rc({conversationId:yr(),resource:{kind:"fileTransfer",origin:t,transferKind:e},turn:_r()},!1,r,br(n))}async function R1(e,t,r){await Rc({conversationId:yr(),resource:{kind:"fullCdp",origin:e},turn:_r()},!1,t,br(r))}async function P1(e,t){await Rc({conversationId:yr(),resource:{kind:"sensitiveData",sensitiveData:C1},turn:_r()},!1,e,br(t))}async function Ic(e,t){let r=null;e.resource.kind==="origin"&&(r=await w1(e.resource.origin,t));try{let n=await bh(t,Vi),o=S9(n,e.resource),i=yh(e.resource),s=i==null?{}:await x9(t,e.conversationId),a=v1(n,i),u=v1(s,i),l=B9(e.resource);return A9(e),u!=null&&vc(u,Tc,l)?{decision:"deny",scope:"conversation",source:"browser-use-persisted-state"}:a!=null&&vc(a,Tc,l)?{decision:"deny",scope:"global",source:"browser-use-persisted-state"}:r==="deny"?{decision:"deny",scope:"global",source:"codex-network-policy"}:I9(e)?{decision:"approve",scope:"turn",source:"guardian-origin-cache"}:u!=null&&vc(u,Cc,l)?{decision:"approve",scope:"conversation",source:"browser-use-persisted-state"}:a!=null&&vc(a,Cc,l)?{decision:"approve",scope:"global",source:"browser-use-persisted-state"}:o==="never_ask"?{decision:"approve",scope:"global",source:"browser-use-persisted-state"}:null}catch{return null}}async function Rc(e,t,r,n){try{if(y9(e,t,r))return;await _9(e,r,n)}catch{}}function y9(e,t,r){return P9(t,r)?(r.action==="accept"&&R9(e),!0):!1}async function _9(e,t,r){if(r==null)return;let n=t.action==="accept"?"approve":t.action==="decline"?"deny":null;if(n==null||!v9(e.resource))return;let o=C9(t)??(E9(e.resource)?"conversation":null);o!=null&&await w9(r,e,o,n)}async function w9(e,t,r,n){let o=T9(r,t.conversationId);if(o==null)return;let i=await bh(e,o),s=yh(t.resource);if(s==null)return;let a=O9(i,s),[u,l]=n==="approve"?[Cc,Tc]:[Tc,Cc],d=U9(Ec(t.resource));E1(a,l,Ec(t.resource)),d!==Ec(t.resource)&&E1(a,l,d),M9(a,u,d),await e.config.writeToml(o,i)}async function bh(e,t){if(e==null)return{};let r=await e.config.readToml(t);return Pc(r)?r:{}}async function x9(e,t){let r=D1(t);return r==null?{}:bh(e,r)}function yr(){let e=Ue(),t=gr(e);return typeof t=="string"?t:D9(globalThis.nodeRepl?.requestMeta)}function _r(){let e=Ue(),t=gr(e);return typeof t=="string"&&typeof e?.turn_id=="string"?{sessionId:t,turnId:e.turn_id}:N9(globalThis.nodeRepl?.requestMeta)}function S9(e,t){let r;switch(t.kind){case"origin":r=s9;break;case"fileTransfer":r=t.transferKind==="download"?f9:m9;break;case"fullCdp":return"always_ask";case"sensitiveData":r=a9;break}return e[r]===u9?"never_ask":"always_ask"}function yh(e){switch(e.kind){case"origin":return l9;case"fileTransfer":return e.transferKind==="download"?d9:p9;case"fullCdp":return c9;case"sensitiveData":return null}}function Ec(e){switch(e.kind){case"origin":case"fileTransfer":case"fullCdp":return e.origin;case"sensitiveData":return e.sensitiveData}}function v9(e){return yh(e)!=null}function E9(e){return e.kind==="origin"}function C9(e){for(let t of[e.meta,e._meta,e.content]){let r=Pc(t)?t.persist:void 0;if(r==="session")return"conversation";if(r==="always")return"global"}return null}function T9(e,t){return e==="global"?Vi:D1(t)}function D1(e){return k9(e)?`browser/sessions/${e}.toml`:null}function k9(e){return typeof e=="string"&&e.length>0&&e.length<=128&&/^[A-Za-z0-9_-]+$/u.test(e)}function A9(e){let t=e.turn;if(t==null||e.resource.kind!=="origin")return;let r=ei.get(t.sessionId);if(r!=null){if(r.expiresAt<=Date.now()){ei.delete(t.sessionId);return}(r.turnId!==t.turnId||r.origin!==e.resource.origin)&&ei.delete(t.sessionId)}}function I9(e){let t=e.turn;if(t==null||e.resource.kind!=="origin")return!1;let r=ei.get(t.sessionId);return r==null?!1:r.expiresAt<=Date.now()?(ei.delete(t.sessionId),!1):r.turnId===t.turnId&&r.origin===e.resource.origin}function R9(e){let t=e.turn;t==null||e.resource.kind!=="origin"||ei.set(t.sessionId,{expiresAt:Date.now()+b9,origin:e.resource.origin,turnId:t.turnId})}function P9(e,t){if(!e)return!1;let r=t.meta?.[S1]??t._meta?.[S1];return r===h9||r===g9}function D9(e){if(e!=null)for(let t of["conversation_id","conversationId","thread_id","threadId","session_id","sessionId"]){let r=e[t];if(typeof r=="string"&&r.trim().length>0)return r}}function N9(e){if(e==null)return;let t;for(let n of["conversation_id","thread_id","session_id"]){let o=e[n];if(typeof o=="string"&&o.trim().length>0){t=o;break}}let r;for(let n of["turn_id","turnId"]){let o=e[n];if(typeof o=="string"&&o.trim().length>0){r=o;break}}if(!(t==null||r==null))return{sessionId:t,turnId:r}}function v1(e,t){if(t==null)return null;let r=e[t];return Pc(r)?r:null}function O9(e,t){let r=e[t];if(r==null){let n={};return e[t]=n,n}if(!Pc(r))throw new Error(`browser-use table ${t} must be an object`);return r}function M9(e,t,r){let n=e[t];if(n==null){e[t]=[r];return}if(!Array.isArray(n))throw new Error(`browser-use table key ${t} must be an array`);let o=n.filter(i=>typeof i=="string");o.includes(r)||o.push(r),e[t]=o}function E1(e,t,r){let n=e[t];Array.isArray(n)&&(e[t]=n.filter(o=>o!==r))}function vc(e,t,r){let n=e[t];return Array.isArray(n)?n.some(o=>typeof o=="string"&&F9(o.trim(),r)):!1}function F9(e,t){return e.includes("://")?gh(e,t.raw):t.hostPort!=null?gh(e,t.hostPort):!t.raw.includes("://")&&gh(e,t.raw)}function B9(e){let t=Ec(e),r=e.kind==="origin"||e.kind==="fileTransfer"||e.kind==="fullCdp"?L9(e.origin):null;return{raw:t,hostPort:r!=null&&r!==t?r:null}}function L9(e){let t=e.indexOf("://");if(t===-1)return null;let r=e.slice(0,t);if(r.toLowerCase()!=="http"&&r.toLowerCase()!=="https")return null;let n=e.slice(t+3),o=n.search(/[/?#]/u),s=(o===-1?n:n.slice(0,o)).split("@").at(-1)?.trim()??"";return s.length>0?s:null}function U9(e){let t="";for(let r of e)r==="*"?t+="\\*":r==="\\"?t+="\\\\":t+=r;return t}function gh(e,t){let r=j9(e);if(r.length===1)return r[0]===t;let[n=""]=r,o=t;if(n.length>0){if(!o.startsWith(n))return!1;o=o.slice(n.length)}for(let s of r.slice(1,-1)){if(s.length===0)continue;let a=o.indexOf(s);if(a===-1)return!1;o=o.slice(a+s.length)}let i=r.at(-1)??"";return i.length===0||o.endsWith(i)}function j9(e){let t=[],r="";for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="*"){t.push(r),r="";continue}if(o==="\\"){let i=e[n+1];if(i==="*"||i==="\\"){r+=i,n+=1;continue}}r+=o}return t.push(r),t}function Pc(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}async function N1(e,t,r){let n=await T1(t,r);if(n?.decision==="approve")return;if(n?.decision==="deny"){let s=n.source==="codex-network-policy"?`Browser Use cannot access ${t} because enterprise network policy blocks it.`:`The user has requested that ${t} should not be used.`;throw new Error(J(s))}let o=e();if(o==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to access ${t}. Please use another source or try another approach.`));let i=await o({message:`Allow Browser Use to access ${t}?`,meta:{codex_approval_kind:"mcp_tool_call",codex_request_type:"approval_request",connector_id:"browser-use",connector_name:"Browser Use",persist:"always",tool_name:"access_browser_origin",tool_title:"Access browser origin",tool_params:{origin:t},tool_params_display:[],origin:t}});if(await I1(t,i,r),i.action!=="accept")throw new Error(J(`The user has requested that ${t} should not be used.`))}async function O1(e,t,r){if((await A1(r))?.decision==="approve")return;let o=e();if(o==null)throw new Error("Browser Use encountered an error attempting to request permission to read browsing history. Please use another source or try another approach.");let i=await o({message:"Allow Browser Use to read your browsing history?",meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",tool_params:t,sensitive_data:"browsing_history"}});if(await P1(i,r),i.action!=="accept")throw new Error("The user has requested that browsing history not be read.")}function je(e){if(typeof e!="string"||e.trim().length===0)return null;try{let t=new URL(e);return t.protocol==="file:"?q9(t):t.protocol!=="http:"&&t.protocol!=="https:"?null:t.origin}catch{return null}}function q9(e){return e.search="",e.hash="",e.href}import{createHash as L1}from"node:crypto";var U1=["background-image","border-image-source","cursor","list-style-image","mask-image"];async function j1({cdp:e,tabId:t}){let r=await $9({cdp:e,tabId:t}),n=r.documents[0];if(n==null)return await F1({cdp:e,tabId:t});let o=Ja(r.strings,n.documentURL),i=new Map;for(let s of await F1({cdp:e,tabId:t}))$1(i,s);for(let s of z9(n,r.strings))for(let a of H9(s,o))B1(i,a);for(let s of V9(n,r.strings,o))B1(i,s);return[...i.values()]}async function q1({cdp:e,tabId:t}){return(await e.evaluateJavascript(t,`Array.from(document.querySelectorAll("svg")).map((svg, index) => ({
markup: svg.outerHTML,
name:
svg.getAttribute("aria-label") ||
svg.querySelector("title")?.textContent?.trim() ||
svg.id ||
"svg-" + (index + 1),
}))`)??[]).flatMap((n,o)=>n.markup?[{id:L1("sha256").update(`${o}:${n.markup}`).digest("hex").slice(0,16),markup:n.markup,name:n.name||`svg-${o+1}`}]:[])}async function $9({cdp:e,tabId:t}){return await e.call(t,"DOMSnapshot.captureSnapshot",{computedStyles:[...U1],includeDOMRects:!1})}function z9(e,t){return(e.nodes.backendNodeId??[]).flatMap((r,n)=>r<=0?[]:[{attributes:W9(e,t,n),nodeId:r,tagName:Ja(t,e.nodes.nodeName?.[n]).toLowerCase()}])}function W9(e,t,r){let n=e.nodes.attributes?.[r]??[],o={};for(let i=0;i<n.length;i+=2){let s=Ja(t,n[i]),a=Ja(t,n[i+1]);s.length>0&&(o[s]=a)}return o}function H9(e,t){let r=[];switch(e.tagName){case"img":wr(r,e,"src","image",t),M1(r,e,"srcset","image",t);break;case"source":wr(r,e,"src","video",t),M1(r,e,"srcset","image",t);break;case"video":wr(r,e,"poster","image",t),wr(r,e,"src","video",t);break;case"script":wr(r,e,"src","script",t);break;case"link":wr(r,e,"href",e.attributes.rel==="stylesheet"?"stylesheet":"other",t);break;case"use":wr(r,e,"href","image",t),wr(r,e,"xlink:href","image",t);break}return r}function wr(e,t,r,n,o){let i=t.attributes[r];i&&e.push(Dc({kind:n,source:{kind:"attribute",nodeId:t.nodeId,property:r},url:_h(i,o)}))}function M1(e,t,r,n,o){let i=t.attributes[r];if(i)for(let s of i.split(",")){let a=s.trim().split(/\s+/,1)[0];a&&e.push(Dc({kind:n,source:{kind:"attribute",nodeId:t.nodeId,property:r},url:_h(a,o)}))}}function V9(e,t,r){let n=[];for(let[o,i]of e.layout.nodeIndex.entries()){let s=e.nodes.backendNodeId?.[i];if(s==null||s<=0)continue;let a=e.layout.styles[o]??[];for(let[u,l]of U1.entries()){let d=Ja(t,a[u]);for(let p of Y9(d))n.push(Dc({kind:"image",source:{kind:"computedStyle",nodeId:s,property:l},url:_h(p,r)}))}}return n}async function F1({cdp:e,tabId:t}){return(await e.evaluateJavascript(t,`performance.getEntriesByType("resource").map((entry) => ({
initiatorType: "initiatorType" in entry ? entry.initiatorType : undefined,
name: entry.name,
}))`)??[]).flatMap(n=>n.name?[Dc({kind:G9(n),source:{kind:"resource",property:n.initiatorType},url:n.name})]:[])}function G9(e){let t=Ka(e.name??"");if(t!=="other")return t;switch(e.initiatorType){case"css":return"stylesheet";case"font":return"font";case"img":return"image";case"script":return"script";case"video":return"video";default:return Ka(e.name??"")}}function $1(e,t){let r=e.get(t.url);if(r==null){e.set(t.url,t);return}r.sources.push(...t.sources),r.kind==="other"&&t.kind!=="other"&&(r.kind=t.kind)}function B1(e,t){e.has(t.url)&&$1(e,t)}function Dc({kind:e,source:t,url:r}){return{id:L1("sha256").update(r).digest("hex").slice(0,16),kind:e==="other"?Ka(r):e,name:K9(r),sources:[t],url:r}}function Ka(e){let t=z1(e).toLowerCase();return/\.(avif|gif|ico|jpe?g|png|svg|webp)$/.test(t)?"image":/\.(mp4|mov|m4v|webm)$/.test(t)?"video":/\.(otf|ttf|woff2?)$/.test(t)?"font":/\.css$/.test(t)?"stylesheet":/\.m?js$/.test(t)?"script":"other"}function K9(e){let r=z1(e).split("/").filter(Boolean).at(-1);if(r){let n=J9(e);return n==null?r:`${r}#${n}`}return e}function z1(e){try{return new URL(e,"https://example.invalid").pathname}catch{return e.split(/[?#]/,1)[0]??e}}function J9(e){try{return new URL(e,"https://example.invalid").hash.slice(1)||null}catch{return e.split("#",2)[1]||null}}function Y9(e){return[...e.matchAll(/url\((["']?)(.*?)\1\)/g)].map(t=>t[2]?.trim()).filter(t=>!!t)}function _h(e,t){try{return new URL(e,t||void 0).toString()}catch{return e}}function Ja(e,t){return t==null||t<0?"":e[t]??""}var Oc=class{constructor(t,r){this.cdp=t;this.security=r}cdp;security;inventoriesById=new Map;async list({documentUrl:t,tabId:r}){let[n,o]=await Promise.all([j1({cdp:this.cdp,tabId:r}),q1({cdp:this.cdp,tabId:r})]),i=this.createInventory({assets:n,documentUrl:t,inlineSvgs:o,tabId:r});return{assets:n,id:i,inlineSvgs:o,pageUrl:t??null,summary:{byKind:tj(n),inlineSvgCount:o.length,totalCount:n.length}}}async bundle({assetIds:t,documentUrl:r,inventoryId:n,kinds:o,tabId:i}){let s=performance.now(),a=this.getAssets({assetIds:t,documentUrl:r,inventoryId:n,kinds:o,tabId:i});if(a==null)throw new Error("Asset inventory is no longer valid for this page");if(a.missingAssetIds.length>0)throw new Error("Asset bundle request included unknown asset ids");if(t!=null&&a.assets.some(w=>!V1(w)))throw new Error("Asset bundle request included unsupported asset kinds");let u=a.assets.filter(V1);if(u.length===0)throw new Error("Asset bundle request matched no discovered assets");await this.security.ensurePageAssetDownloadAllowed(r);let l=Nc(Q9(),"browser-use","assets",W1());await Z9(l,{recursive:!0});let d=new Map,p,f=Promise.resolve(),m=w=>{let x=je(w)??w,E=d.get(x);if(E!=null)return E;let I=f.then(async()=>{if(p!=null)throw p;try{await this.security.ensurePageAssetFallbackFetchAllowed(r,w)}catch(C){throw p=C instanceof Error?C:new Error("Page asset fallback download approval failed"),p}});return d.set(x,I),f=I.catch(()=>{}),I},h=await Promise.all(u.map(w=>rj({cdp:this.cdp,directoryPath:l,ensureFallbackFetchAllowed:m,inventoryAsset:w,tabId:i})));if(p!=null)throw await X9(l,{force:!0,recursive:!0}),p;let y=h.flatMap(w=>w.asset==null?[]:[w.asset]),S=h.flatMap(w=>w.failure==null?[]:[w.failure]),D=Nc(l,"manifest.json");return await wh(D,JSON.stringify({assets:y,failures:S},null,2)),{assets:y,directoryPath:l,failures:S,manifestPath:D,summary:{downloadedCount:y.length,elapsedMs:performance.now()-s,failedCount:S.length,requestedCount:u.length}}}createInventory({assets:t,documentUrl:r,inlineSvgs:n,tabId:o}){let i=W1(),s=new Map;for(let a of t)s.set(a.id,{source:"page-asset",asset:a});for(let a of n)s.set(a.id,{source:"inline-svg",asset:a});return this.inventoriesById.set(i,{assetsById:s,documentUrl:r,tabId:o}),i}getAssets({assetIds:t,documentUrl:r,inventoryId:n,kinds:o,tabId:i}){let s=this.inventoriesById.get(n);if(s==null||s.documentUrl!==r||s.tabId!==i)return null;let a=t?.filter(l=>!s.assetsById.has(l))??[];return{assets:(t==null?[...s.assetsById.values()]:t.flatMap(l=>{let d=s.assetsById.get(l);return d==null?[]:[d]})).filter(l=>o==null||o.includes(l.source==="inline-svg"?"image":l.asset.kind)),missingAssetIds:a}}};function tj(e){let t={font:0,image:0,other:0,script:0,stylesheet:0,video:0};for(let r of e)t[r.kind]+=1;return t}async function rj({cdp:e,directoryPath:t,ensureFallbackFetchAllowed:r,inventoryAsset:n,tabId:o}){try{if(n.source==="inline-svg"){let l=Nc(t,`${n.asset.id}.svg`);return await wh(l,n.asset.markup),{asset:{contentType:"image/svg+xml",id:n.asset.id,kind:"image",name:n.asset.name,path:l,url:`inline-svg:${n.asset.id}`}}}let i=n.asset,s=await oj({cdp:e,ensureFallbackFetchAllowed:r,tabId:o,url:i.url}),a=lj(s.contentType);if(!aj(i,a)){let l=G1({contentType:a,inventoryAsset:n,reason:`Asset response type ${a??"missing"} is not valid for ${i.kind}`});return K1(i.kind,a,"content_type_mismatch"),{failure:l}}let u=Nc(t,`${i.id}${ej(cj(i.url))}`);return await wh(u,Buffer.from(s.base64,"base64")),{asset:{contentType:s.contentType,id:i.id,kind:i.kind,name:i.name,path:u,url:i.url}}}catch(i){return K1(n.source==="inline-svg"?"image":n.asset.kind,null,"request_failed"),{failure:G1({contentType:null,inventoryAsset:n,reason:i instanceof Error?i.message:"Asset bundling failed"})}}}async function nj({url:e}){let t=await fetch(e,{credentials:"include",method:"GET"});if(!t.ok)throw new Error(`Asset request failed with HTTP ${t.status}`);let r=new Uint8Array(await t.arrayBuffer()),n=32768,o="";for(let i=0;i<r.length;i+=n)o+=String.fromCharCode(...r.subarray(i,i+n));return{base64:btoa(o),contentType:t.headers.get("content-type")}}async function oj({cdp:e,ensureFallbackFetchAllowed:t,tabId:r,url:n}){let o=await sj({cdp:e,tabId:r}),i;try{if(o==null)throw new Error("Unable to determine frame id");return await ij({cdp:e,frameId:o,tabId:r,url:n})}catch(s){i=s}await t(n);try{let s=await e.evaluateJavascript(r,`(${nj.toString()})(${JSON.stringify({url:n})})`,{awaitPromise:!0});if(s==null)throw new Error("Unable to bundle asset");return s}catch(s){throw new Error(`Loaded resource fetch failed: ${H1(i)}; page fetch failed: ${H1(s)}`,{cause:s})}}async function ij({cdp:e,frameId:t,tabId:r,url:n}){await e.call(r,"Page.enable");let[o,i]=await Promise.all([e.call(r,"Page.getResourceContent",{frameId:t,url:n}),e.call(r,"Page.getResourceTree")]);return{base64:o.base64Encoded===!0?o.content:Buffer.from(o.content).toString("base64"),contentType:J1(i.frameTree,n)}}function H1(e){return e instanceof Error?e.message:"Asset bundling failed"}async function sj({cdp:e,tabId:t}){return(await e.call(t,"Page.getFrameTree")).frameTree?.frame?.id??null}function J1(e,t){if(e==null)return null;let r=e.resources?.find(n=>n.url===t)?.mimeType;if(r!=null)return r;for(let n of e.childFrames??[]){let o=J1(n,t);if(o!=null)return o}return null}function V1(e){if(e.source==="inline-svg")return!0;switch(e.asset.kind){case"font":case"image":case"stylesheet":case"video":return!0;case"other":case"script":return!1}}function aj(e,t){return uj(e.kind,t)||t==="application/octet-stream"&&Ka(e.url)===e.kind}function uj(e,t){if(t==null)return e==="stylesheet";switch(e){case"font":return t.startsWith("font/")||t==="application/font-woff"||t==="application/font-woff2"||t==="application/vnd.ms-fontobject"||t==="application/x-font-opentype"||t==="application/x-font-ttf";case"image":return t.startsWith("image/");case"stylesheet":return t==="text/css";case"video":return t.startsWith("video/")}}function G1({contentType:e,inventoryAsset:t,reason:r}){return t.source==="inline-svg"?{contentType:e,id:t.asset.id,name:t.asset.name,reason:r,url:`inline-svg:${t.asset.id}`}:{contentType:e,id:t.asset.id,name:t.asset.name,reason:r,url:t.asset.url}}function K1(e,t,r){Pt("browser_use_page_asset_bundle_failed",r,{assetKind:e,contentType:t??"missing",failureType:r})}function lj(e){let t=e?.split(";",1)[0]?.trim().toLowerCase();return t?/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/.test(t)?t:"invalid":null}function cj(e){try{return new URL(e).pathname}catch{return e.split(/[?#]/,1)[0]??e}}var Mc=class{constructor(t,r){this.api=t;this.clientInfo=r}api;clientInfo;async create(){return await this.api.createTab()}async list(){return await this.api.getTabs()}async finalize(t){if(!bc(this.clientInfo))throw new Error("browser.tabs.finalize is only available with Chrome or multi-tab IAB.");await this.api.finalizeTabs(t)}async get(t){let r=await this.list(),n=r.find(o=>o.id===t);if(n==null){let o=r.length?r.map(i=>`${i.id}|${i.title??"<no title>"}|${i.url??"<no url>"}`).join(", "):"none";throw new Error(`Tab not found: ${t}. Existing tabs: ${o}`)}return n}async getActive(){let r=(await this.list()).find(n=>n.active);if(r==null)throw new Error("No active tab found");return r}};var Y1='"use strict";var PlaywrightInjected=(()=>{var hr=Object.defineProperty;var Oi=Object.getOwnPropertyDescriptor;var $i=Object.getOwnPropertyNames;var Pi=Object.prototype.hasOwnProperty;var Di=(r,e)=>{for(var t in e)hr(r,t,{get:e[t],enumerable:!0})},Hi=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $i(e))!Pi.call(r,i)&&i!==t&&hr(r,i,{get:()=>e[i],enumerable:!(n=Oi(e,i))||n.enumerable});return r};var qi=r=>Hi(hr({},"__esModule",{value:!0}),r);var xo={};Di(xo,{InjectedScript:()=>nn});function an(r,e){if(r.role!==e.role||r.name!==e.name||!Bi(r,e)||Fe(r)!==Fe(e))return!1;let t=Object.keys(r.props),n=Object.keys(e.props);return t.length===n.length&&t.every(i=>r.props[i]===e.props[i])}function Fe(r){return r.box.cursor==="pointer"}function Bi(r,e){return r.active===e.active&&r.checked===e.checked&&r.disabled===e.disabled&&r.expanded===e.expanded&&r.invalid===e.invalid&&r.selected===e.selected&&r.level===e.level&&r.pressed===e.pressed}function ln(r,e,t={}){var u;let n=new r.LineCounter,i={keepSourceTokens:!0,lineCounter:n,...t},s=r.parseDocument(e,i),o=[],a=f=>[n.linePos(f[0]),n.linePos(f[1])],l=f=>{o.push({message:f.message,range:[n.linePos(f.pos[0]),n.linePos(f.pos[1])]})},c=(f,h)=>{for(let g of h.items){if(g instanceof r.Scalar&&typeof g.value=="string"){let E=Pt.parse(g,i,o);E&&(f.children=f.children||[],f.children.push(E));continue}if(g instanceof r.YAMLMap){p(f,g);continue}o.push({message:"Sequence items should be strings or maps",range:a(g.range||h.range)})}},p=(f,h)=>{var g;for(let m of h.items){if(f.children=f.children||[],!(m.key instanceof r.Scalar&&typeof m.key.value=="string")){o.push({message:"Only string keys are supported",range:a(m.key.range||h.range)});continue}let E=m.key,y=m.value;if(E.value==="text"){if(!(y instanceof r.Scalar&&typeof y.value=="string")){o.push({message:"Text value should be a string",range:a(m.value.range||h.range)});continue}f.children.push({kind:"text",text:fr(y.value)});continue}if(E.value==="/children"){if(!(y instanceof r.Scalar&&typeof y.value=="string")||y.value!=="contain"&&y.value!=="equal"&&y.value!=="deep-equal"){o.push({message:\'Strict value should be "contain", "equal" or "deep-equal"\',range:a(m.value.range||h.range)});continue}f.containerMode=y.value;continue}if(E.value.startsWith("/")){if(!(y instanceof r.Scalar&&typeof y.value=="string")){o.push({message:"Property value should be a string",range:a(m.value.range||h.range)});continue}f.props=(g=f.props)!=null?g:{},f.props[E.value.slice(1)]=fr(y.value);continue}let D=Pt.parse(E,i,o);if(!D)continue;if(y instanceof r.Scalar){let N=typeof y.value;if(N!=="string"&&N!=="number"&&N!=="boolean"){o.push({message:"Node value should be a string or a sequence",range:a(m.value.range||h.range)});continue}f.children.push({...D,children:[{kind:"text",text:fr(String(y.value))}]});continue}if(y instanceof r.YAMLSeq){f.children.push(D),c(D,y);continue}o.push({message:"Map values should be strings or sequences",range:a(m.value.range||h.range)})}},d={kind:"role",role:"fragment"};return s.errors.forEach(l),o.length?{errors:o,fragment:d}:(s.contents instanceof r.YAMLSeq||o.push({message:\'Aria snapshot must be a YAML sequence, elements starting with " -"\',range:s.contents?a(s.contents.range):[{line:0,col:0},{line:0,col:0}]}),o.length?{errors:o,fragment:d}:(c(d,s.contents),o.length?{errors:o,fragment:Fi}:((u=d.children)==null?void 0:u.length)===1&&(!d.containerMode||d.containerMode==="contain")?{fragment:d.children[0],errors:[]}:{fragment:d,errors:[]}))}var Fi={kind:"role",role:"fragment"};function cn(r){return r.replace(/[\\u200b\\u00ad]/g,"").replace(/[\\r\\n\\s\\t]+/g," ").trim()}function fr(r){return{raw:r,normalized:cn(r)}}var Pt=class r{static parse(e,t,n){try{return new r(e.value)._parse()}catch(i){if(i instanceof Dt){let s=t.prettyErrors===!1?i.message:i.message+`:\n\n`+e.value+`\n`+" ".repeat(i.pos)+`^\n`;return n.push({message:s,range:[t.lineCounter.linePos(e.range[0]),t.lineCounter.linePos(e.range[0]+i.pos)]}),null}throw i}}constructor(e){this._input=e,this._pos=0,this._length=e.length}_peek(){return this._input[this._pos]||""}_next(){return this._pos<this._length?this._input[this._pos++]:null}_eof(){return this._pos>=this._length}_isWhitespace(){return!this._eof()&&/\\s/.test(this._peek())}_skipWhitespace(){for(;this._isWhitespace();)this._pos++}_readIdentifier(e){this._eof()&&this._throwError(`Unexpected end of input when expecting ${e}`);let t=this._pos;for(;!this._eof()&&/[a-zA-Z]/.test(this._peek());)this._pos++;return this._input.slice(t,this._pos)}_readString(){let e="",t=!1;for(;!this._eof();){let n=this._next();if(t)e+=n,t=!1;else if(n==="\\\\")t=!0;else{if(n===\'"\')return e;e+=n}}this._throwError("Unterminated string")}_throwError(e,t=0){throw new Dt(e,t||this._pos)}_readRegex(){let e="",t=!1,n=!1;for(;!this._eof();){let i=this._next();if(t)e+=i,t=!1;else if(i==="\\\\")t=!0,e+=i;else{if(i==="/"&&!n)return{pattern:e};i==="["?(n=!0,e+=i):i==="]"&&n?(e+=i,n=!1):e+=i}}this._throwError("Unterminated regex")}_readStringOrRegex(){let e=this._peek();return e===\'"\'?(this._next(),cn(this._readString())):e==="/"?(this._next(),this._readRegex()):null}_readAttributes(e){let t=this._pos;for(;this._skipWhitespace(),this._peek()==="[";){this._next(),this._skipWhitespace(),t=this._pos;let n=this._readIdentifier("attribute");this._skipWhitespace();let i="";if(this._peek()==="=")for(this._next(),this._skipWhitespace(),t=this._pos;this._peek()!=="]"&&!this._isWhitespace()&&!this._eof();)i+=this._next();this._skipWhitespace(),this._peek()!=="]"&&this._throwError("Expected ]"),this._next(),this._applyAttribute(e,n,i||"true",t)}}_parse(){this._skipWhitespace();let e=this._readIdentifier("role");this._skipWhitespace();let t=this._readStringOrRegex()||"",n={kind:"role",role:e,name:t};return this._readAttributes(n),this._skipWhitespace(),this._eof()||this._throwError("Unexpected input"),n}_applyAttribute(e,t,n,i){if(t==="checked"){this._assert(n==="true"||n==="false"||n==="mixed",\'Value of "checked" attribute must be a boolean or "mixed"\',i),e.checked=n==="true"?!0:n==="false"?!1:"mixed";return}if(t==="disabled"){this._assert(n==="true"||n==="false",\'Value of "disabled" attribute must be a boolean\',i),e.disabled=n==="true";return}if(t==="expanded"){this._assert(n==="true"||n==="false",\'Value of "expanded" attribute must be a boolean\',i),e.expanded=n==="true";return}if(t==="active"){this._assert(n==="true"||n==="false",\'Value of "active" attribute must be a boolean\',i),e.active=n==="true";return}if(t==="invalid"){this._assert(n==="true"||n==="false"||n==="grammar"||n==="spelling",\'Value of "invalid" attribute must be a boolean, "grammar" or "spelling"\',i),e.invalid=n==="true"?!0:n==="false"?!1:n;return}if(t==="level"){this._assert(!isNaN(Number(n)),\'Value of "level" attribute must be a number\',i),e.level=Number(n);return}if(t==="pressed"){this._assert(n==="true"||n==="false"||n==="mixed",\'Value of "pressed" attribute must be a boolean or "mixed"\',i),e.pressed=n==="true"?!0:n==="false"?!1:"mixed";return}if(t==="selected"){this._assert(n==="true"||n==="false",\'Value of "selected" attribute must be a boolean\',i),e.selected=n==="true";return}this._assert(!1,`Unsupported attribute [${t}]`,i)}_assert(e,t,n){e||this._throwError(t||"Assertion error",n)}},Dt=class extends Error{constructor(e,t){super(e),this.pos=t}};function un(r,e){var o,a;function t(l,c,p){let d=1,u=p+d;for(let f of l.children||[])typeof f=="string"?(d++,u++):(d+=t(f,c,u),u+=d);if(!["none","presentation","fragment","iframe","generic"].includes(l.role)&&l.name){let f=c.get(l.role);f||(f=new Map,c.set(l.role,f));let h=f.get(l.name),g=d*100-p;(!h||h.sizeAndPosition<g)&&f.set(l.name,{node:l,sizeAndPosition:g})}return d}let n=new Map;r&&t(r,n,0);let i=new Map;t(e,i,0);let s=[];for(let[l,c]of i)for(let[p,d]of c)(o=n.get(l))!=null&&o.get(p)||s.push(d);return s.sort((l,c)=>c.sizeAndPosition-l.sizeAndPosition),(a=s[0])==null?void 0:a.node}var R=function(r,e,t){return r>=e&&r<=t};function B(r){return R(r,48,57)}function dn(r){return B(r)||R(r,65,70)||R(r,97,102)}function ji(r){return R(r,65,90)}function Wi(r){return R(r,97,122)}function Vi(r){return ji(r)||Wi(r)}function zi(r){return r>=128}function Ht(r){return Vi(r)||zi(r)||r===95}function hn(r){return Ht(r)||B(r)||r===45}function Qi(r){return R(r,0,8)||r===11||R(r,14,31)||r===127}function _e(r){return r===10}function J(r){return _e(r)||r===9||r===32}var Gi=1114111,Ue=class extends Error{constructor(e){super(e),this.name="InvalidCharacterError"}};function Ji(r){let e=[];for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===13&&r.charCodeAt(t+1)===10&&(n=10,t++),(n===13||n===12)&&(n=10),n===0&&(n=65533),R(n,55296,56319)&&R(r.charCodeAt(t+1),56320,57343)){let i=n-55296,s=r.charCodeAt(t+1)-56320;n=Math.pow(2,16)+i*Math.pow(2,10)+s,t++}e.push(n)}return e}function M(r){if(r<=65535)return String.fromCharCode(r);r-=Math.pow(2,16);let e=Math.floor(r/Math.pow(2,10))+55296,t=r%Math.pow(2,10)+56320;return String.fromCharCode(e)+String.fromCharCode(t)}function qt(r){let e=Ji(r),t=-1,n=[],i,s=0,o=0,a=0,l=function(){s+=1,a=o,o=0},c={line:s,column:o},p=function(x){return x>=e.length?-1:e[x]},d=function(x){if(x===void 0&&(x=1),x>3)throw"Spec Error: no more than three codepoints of lookahead.";return p(t+x)},u=function(x){return x===void 0&&(x=1),t+=x,i=p(t),_e(i)?l():o+=x,!0},f=function(){return t-=1,_e(i)?(s-=1,o=a):o-=1,c.line=s,c.column=o,!0},h=function(x){return x===void 0&&(x=i),x===-1},g=function(){},m=function(){},S=function(){if(E(),u(),J(i)){for(;J(d());)u();return new ne}else{if(i===34)return Ae();if(i===35)if(hn(d())||G(d(1),d(2))){let x=new tt("");return H(d(1),d(2),d(3))&&(x.type="id"),x.value=$t(),x}else return new _(i);else return i===36?d()===61?(u(),new br):new _(i):i===39?Ae():i===40?new Ke:i===41?new he:i===42?d()===61?(u(),new xr):new _(i):i===43?cr()?(f(),y()):new _(i):i===44?new Ge:i===45?cr()?(f(),y()):d(1)===45&&d(2)===62?(u(2),new Ve):U()?(f(),D()):new _(i):i===46?cr()?(f(),y()):new _(i):i===58?new ze:i===59?new Qe:i===60?d(1)===33&&d(2)===45&&d(3)===45?(u(3),new We):new _(i):i===64?H(d(1),d(2),d(3))?new et($t()):new _(i):i===91?new Xe:i===92?b()?(f(),D()):(m(),new _(i)):i===93?new Ce:i===94?d()===61?(u(),new mr):new _(i):i===123?new Je:i===124?d()===61?(u(),new gr):d()===124?(u(),new Ze):new _(i):i===125?new Ye:i===126?d()===61?(u(),new pr):new _(i):B(i)?(f(),y()):Ht(i)?(f(),D()):h()?new fe:new _(i)}},E=function(){for(;d(1)===47&&d(2)===42;)for(u(2);;)if(u(),i===42&&d()===47){u();break}else if(h()){m();return}},y=function(){let x=Ri();if(H(d(1),d(2),d(3))){let w=new Er;return w.value=x.value,w.repr=x.repr,w.type=x.type,w.unit=$t(),w}else if(d()===37){u();let w=new it;return w.value=x.value,w.repr=x.repr,w}else{let w=new nt;return w.value=x.value,w.repr=x.repr,w.type=x.type,w}},D=function(){let x=$t();if(x.toLowerCase()==="url"&&d()===40){for(u();J(d(1))&&J(d(2));)u();return d()===34||d()===39?new Y(x):J(d())&&(d(2)===34||d(2)===39)?new Y(x):re()}else return d()===40?(u(),new Y(x)):new pe(x)},Ae=function(x){x===void 0&&(x=i);let w="";for(;u();){if(i===x||h())return new ge(w);if(_e(i))return m(),f(),new je;i===92?h(d())?g():_e(d())?u():w+=M(N()):w+=M(i)}throw new Error("Internal error")},re=function(){let x=new rt("");for(;J(d());)u();if(h(d()))return x;for(;u();){if(i===41||h())return x;if(J(i)){for(;J(d());)u();return d()===41||h(d())?(u(),x):(ur(),new de)}else{if(i===34||i===39||i===40||Qi(i))return m(),ur(),new de;if(i===92)if(b())x.value+=M(N());else return m(),ur(),new de;else x.value+=M(i)}}throw new Error("Internal error")},N=function(){if(u(),dn(i)){let x=[i];for(let j=0;j<5&&dn(d());j++)u(),x.push(i);J(d())&&u();let w=parseInt(x.map(function(j){return String.fromCharCode(j)}).join(""),16);return w>Gi&&(w=65533),w}else return h()?65533:i},G=function(x,w){return!(x!==92||_e(w))},b=function(){return G(i,d())},H=function(x,w,j){return x===45?Ht(w)||w===45||G(w,j):Ht(x)?!0:x===92?G(x,w):!1},U=function(){return H(i,d(1),d(2))},Ni=function(x,w,j){return x===43||x===45?!!(B(w)||w===46&&B(j)):x===46?!!B(w):!!B(x)},cr=function(){return Ni(i,d(1),d(2))},$t=function(){let x="";for(;u();)if(hn(i))x+=M(i);else if(b())x+=M(N());else return f(),x;throw new Error("Internal parse error")},Ri=function(){let x="",w="integer";for((d()===43||d()===45)&&(u(),x+=M(i));B(d());)u(),x+=M(i);if(d(1)===46&&B(d(2)))for(u(),x+=M(i),u(),x+=M(i),w="number";B(d());)u(),x+=M(i);let j=d(1),dr=d(2),Ii=d(3);if((j===69||j===101)&&B(dr))for(u(),x+=M(i),u(),x+=M(i),w="number";B(d());)u(),x+=M(i);else if((j===69||j===101)&&(dr===43||dr===45)&&B(Ii))for(u(),x+=M(i),u(),x+=M(i),u(),x+=M(i),w="number";B(d());)u(),x+=M(i);let Mi=Li(x);return{type:w,value:Mi,repr:x}},Li=function(x){return+x},ur=function(){for(;u();){if(i===41||h())return;b()&&N(),g()}},on=0;for(;!h(d());)if(n.push(S()),on++,on>e.length*2)throw new Error("I\'m infinite-looping!");return n}var T=class{constructor(){this.tokenType=""}toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}},je=class extends T{constructor(){super(...arguments);this.tokenType="BADSTRING"}},de=class extends T{constructor(){super(...arguments);this.tokenType="BADURL"}},ne=class extends T{constructor(){super(...arguments);this.tokenType="WHITESPACE"}toString(){return"WS"}toSource(){return" "}},We=class extends T{constructor(){super(...arguments);this.tokenType="CDO"}toSource(){return"<!--"}},Ve=class extends T{constructor(){super(...arguments);this.tokenType="CDC"}toSource(){return"-->"}},ze=class extends T{constructor(){super(...arguments);this.tokenType=":"}},Qe=class extends T{constructor(){super(...arguments);this.tokenType=";"}},Ge=class extends T{constructor(){super(...arguments);this.tokenType=","}},ie=class extends T{constructor(){super(...arguments);this.value="";this.mirror=""}},Je=class extends ie{constructor(){super();this.tokenType="{";this.value="{",this.mirror="}"}},Ye=class extends ie{constructor(){super();this.tokenType="}";this.value="}",this.mirror="{"}},Xe=class extends ie{constructor(){super();this.tokenType="[";this.value="[",this.mirror="]"}},Ce=class extends ie{constructor(){super();this.tokenType="]";this.value="]",this.mirror="["}},Ke=class extends ie{constructor(){super();this.tokenType="(";this.value="(",this.mirror=")"}},he=class extends ie{constructor(){super();this.tokenType=")";this.value=")",this.mirror="("}},pr=class extends T{constructor(){super(...arguments);this.tokenType="~="}},gr=class extends T{constructor(){super(...arguments);this.tokenType="|="}},mr=class extends T{constructor(){super(...arguments);this.tokenType="^="}},br=class extends T{constructor(){super(...arguments);this.tokenType="$="}},xr=class extends T{constructor(){super(...arguments);this.tokenType="*="}},Ze=class extends T{constructor(){super(...arguments);this.tokenType="||"}},fe=class extends T{constructor(){super(...arguments);this.tokenType="EOF"}toSource(){return""}},_=class extends T{constructor(t){super();this.tokenType="DELIM";this.value="";this.value=M(t)}toString(){return"DELIM("+this.value+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t}toSource(){return this.value==="\\\\"?`\\\\\n`:this.value}},se=class extends T{constructor(){super(...arguments);this.value=""}ASCIIMatch(t){return this.value.toLowerCase()===t.toLowerCase()}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t}},pe=class extends se{constructor(t){super();this.tokenType="IDENT";this.value=t}toString(){return"IDENT("+this.value+")"}toSource(){return st(this.value)}},Y=class extends se{constructor(t){super();this.tokenType="FUNCTION";this.value=t,this.mirror=")"}toString(){return"FUNCTION("+this.value+")"}toSource(){return st(this.value)+"("}},et=class extends se{constructor(t){super();this.tokenType="AT-KEYWORD";this.value=t}toString(){return"AT("+this.value+")"}toSource(){return"@"+st(this.value)}},tt=class extends se{constructor(t){super();this.tokenType="HASH";this.value=t,this.type="unrestricted"}toString(){return"HASH("+this.value+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t.type=this.type,t}toSource(){return this.type==="id"?"#"+st(this.value):"#"+Yi(this.value)}},ge=class extends se{constructor(t){super();this.tokenType="STRING";this.value=t}toString(){return\'"\'+fn(this.value)+\'"\'}},rt=class extends se{constructor(t){super();this.tokenType="URL";this.value=t}toString(){return"URL("+this.value+")"}toSource(){return\'url("\'+fn(this.value)+\'")\'}},nt=class extends T{constructor(){super();this.tokenType="NUMBER";this.type="integer",this.repr=""}toString(){return this.type==="integer"?"INT("+this.value+")":"NUMBER("+this.value+")"}toJSON(){let t=super.toJSON();return t.value=this.value,t.type=this.type,t.repr=this.repr,t}toSource(){return this.repr}},it=class extends T{constructor(){super();this.tokenType="PERCENTAGE";this.repr=""}toString(){return"PERCENTAGE("+this.value+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t.repr=this.repr,t}toSource(){return this.repr+"%"}},Er=class extends T{constructor(){super();this.tokenType="DIMENSION";this.type="integer",this.repr="",this.unit=""}toString(){return"DIM("+this.value+","+this.unit+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t.type=this.type,t.repr=this.repr,t.unit=this.unit,t}toSource(){let t=this.repr,n=st(this.unit);return n[0].toLowerCase()==="e"&&(n[1]==="-"||R(n.charCodeAt(1),48,57))&&(n="\\\\65 "+n.slice(1,n.length)),t+n}};function st(r){r=""+r;let e="",t=r.charCodeAt(0);for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);if(i===0)throw new Ue("Invalid character: the input contains U+0000.");R(i,1,31)||i===127||n===0&&R(i,48,57)||n===1&&R(i,48,57)&&t===45?e+="\\\\"+i.toString(16)+" ":i>=128||i===45||i===95||R(i,48,57)||R(i,65,90)||R(i,97,122)?e+=r[n]:e+="\\\\"+r[n]}return e}function Yi(r){r=""+r;let e="";for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===0)throw new Ue("Invalid character: the input contains U+0000.");n>=128||n===45||n===95||R(n,48,57)||R(n,65,90)||R(n,97,122)?e+=r[t]:e+="\\\\"+n.toString(16)+" "}return e}function fn(r){r=""+r;let e="";for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===0)throw new Ue("Invalid character: the input contains U+0000.");R(n,1,31)||n===127?e+="\\\\"+n.toString(16)+" ":n===34||n===92?e+="\\\\"+r[t]:e+=r[t]}return e}var O=class extends Error{};function gn(r,e){let t;try{t=qt(r),t[t.length-1]instanceof fe||t.push(new fe)}catch(b){let H=b.message+` while parsing css selector "${r}". Did you mean to CSS.escape it?`,U=(b.stack||"").indexOf(b.message);throw U!==-1&&(b.stack=b.stack.substring(0,U)+H+b.stack.substring(U+b.message.length)),b.message=H,b}let n=t.find(b=>b instanceof et||b instanceof je||b instanceof de||b instanceof Ze||b instanceof We||b instanceof Ve||b instanceof Qe||b instanceof Je||b instanceof Ye||b instanceof rt||b instanceof it);if(n)throw new O(`Unsupported token "${n.toSource()}" while parsing css selector "${r}". Did you mean to CSS.escape it?`);let i=0,s=new Set;function o(){return new O(`Unexpected token "${t[i].toSource()}" while parsing css selector "${r}". Did you mean to CSS.escape it?`)}function a(){for(;t[i]instanceof ne;)i++}function l(b=i){return t[b]instanceof pe}function c(b=i){return t[b]instanceof ge}function p(b=i){return t[b]instanceof nt}function d(b=i){return t[b]instanceof Ge}function u(b=i){return t[b]instanceof Ke}function f(b=i){return t[b]instanceof he}function h(b=i){return t[b]instanceof Y}function g(b=i){return t[b]instanceof _&&t[b].value==="*"}function m(b=i){return t[b]instanceof fe}function S(b=i){return t[b]instanceof _&&[">","+","~"].includes(t[b].value)}function E(b=i){return d(b)||f(b)||m(b)||S(b)||t[b]instanceof ne}function y(){let b=[D()];for(;a(),!!d();)i++,b.push(D());return b}function D(){return a(),p()||c()?t[i++].value:Ae()}function Ae(){let b={simples:[]};for(a(),S()?b.simples.push({selector:{functions:[{name:"scope",args:[]}]},combinator:""}):b.simples.push({selector:re(),combinator:""});;){if(a(),S())b.simples[b.simples.length-1].combinator=t[i++].value,a();else if(E())break;b.simples.push({combinator:"",selector:re()})}return b}function re(){let b="",H=[];for(;!E();)if(l()||g())b+=t[i++].toSource();else if(t[i]instanceof tt)b+=t[i++].toSource();else if(t[i]instanceof _&&t[i].value===".")if(i++,l())b+="."+t[i++].toSource();else throw o();else if(t[i]instanceof ze)if(i++,l())if(!e.has(t[i].value.toLowerCase()))b+=":"+t[i++].toSource();else{let U=t[i++].value.toLowerCase();H.push({name:U,args:[]}),s.add(U)}else if(h()){let U=t[i++].value.toLowerCase();if(e.has(U)?(H.push({name:U,args:y()}),s.add(U)):b+=`:${U}(${N()})`,a(),!f())throw o();i++}else throw o();else if(t[i]instanceof Xe){for(b+="[",i++;!(t[i]instanceof Ce)&&!m();)b+=t[i++].toSource();if(!(t[i]instanceof Ce))throw o();b+="]",i++}else throw o();if(!b&&!H.length)throw o();return{css:b||void 0,functions:H}}function N(){let b="",H=1;for(;!m()&&((u()||h())&&H++,f()&&H--,!!H);)b+=t[i++].toSource();return b}let G=y();if(!m())throw o();if(G.some(b=>typeof b!="object"||!("simples"in b)))throw new O(`Error while parsing css selector "${r}". Did you mean to CSS.escape it?`);return{selector:G,names:Array.from(s)}}var Sr=new Set(["internal:has","internal:has-not","internal:and","internal:or","internal:chain","left-of","right-of","above","below","near"]),Xi=new Set(["left-of","right-of","above","below","near"]),yr=new Set(["not","is","where","has","scope","light","visible","text","text-matches","text-is","has-text","above","below","right-of","left-of","near","nth-match"]);function ot(r){let e=Zi(r),t=[];for(let n of e.parts){if(n.name==="css"||n.name==="css:light"){n.name==="css:light"&&(n.body=":light("+n.body+")");let i=gn(n.body,yr);t.push({name:"css",body:i.selector,source:n.body});continue}if(Sr.has(n.name)){let i,s;try{let c=JSON.parse("["+n.body+"]");if(!Array.isArray(c)||c.length<1||c.length>2||typeof c[0]!="string")throw new O(`Malformed selector: ${n.name}=`+n.body);if(i=c[0],c.length===2){if(typeof c[1]!="number"||!Xi.has(n.name))throw new O(`Malformed selector: ${n.name}=`+n.body);s=c[1]}}catch{throw new O(`Malformed selector: ${n.name}=`+n.body)}let o={name:n.name,source:n.body,body:{parsed:ot(i),distance:s}},a=[...o.body.parsed.parts].reverse().find(c=>c.name==="internal:control"&&c.body==="enter-frame"),l=a?o.body.parsed.parts.indexOf(a):-1;l!==-1&&Ki(o.body.parsed.parts.slice(0,l+1),t.slice(0,l+1))&&o.body.parsed.parts.splice(0,l+1),t.push(o);continue}t.push({...n,source:n.body})}if(Sr.has(t[0].name))throw new O(`"${t[0].name}" selector cannot be first`);return{capture:e.capture,parts:t}}function Ki(r,e){return $({parts:r})===$({parts:e})}function $(r,e){return typeof r=="string"?r:r.parts.map((t,n)=>{let i=!0;!e&&n!==r.capture&&(t.name==="css"||t.name==="xpath"&&t.source.startsWith("//")||t.source.startsWith(".."))&&(i=!1);let s=i?t.name+"=":"";return`${n===r.capture?"*":""}${s}${t.source}`}).join(" >> ")}function mn(r,e){let t=(n,i)=>{for(let s of n.parts)e(s,i),Sr.has(s.name)&&t(s.body.parsed,!0)};t(r,!1)}function Zi(r){let e=0,t,n=0,i={parts:[]},s=()=>{let a=r.substring(n,e).trim(),l=a.indexOf("="),c,p;l!==-1&&a.substring(0,l).trim().match(/^[a-zA-Z_0-9-+:*]+$/)?(c=a.substring(0,l).trim(),p=a.substring(l+1)):a.length>1&&a[0]===\'"\'&&a[a.length-1]===\'"\'||a.length>1&&a[0]==="\'"&&a[a.length-1]==="\'"?(c="text",p=a):/^\\(*\\/\\//.test(a)||a.startsWith("..")?(c="xpath",p=a):(c="css",p=a);let d=!1;if(c[0]==="*"&&(d=!0,c=c.substring(1)),i.parts.push({name:c,body:p}),d){if(i.capture!==void 0)throw new O("Only one of the selectors can capture using * modifier");i.capture=i.parts.length-1}};if(!r.includes(">>"))return e=r.length,s(),i;let o=()=>{let l=r.substring(n,e).match(/^\\s*text\\s*=(.*)$/);return!!l&&!!l[1]};for(;e<r.length;){let a=r[e];a==="\\\\"&&e+1<r.length?e+=2:a===t?(t=void 0,e++):!t&&(a===\'"\'||a==="\'"||a==="`")&&!o()?(t=a,e++):!t&&a===">"&&r[e+1]===">"?(s(),e+=2,n=e):e++}return s(),i}function X(r,e){let t=0,n=r.length===0,i=()=>r[t]||"",s=()=>{let m=i();return++t,n=t>=r.length,m},o=m=>{throw n?new O(`Unexpected end of selector while parsing selector \\`${r}\\``):new O(`Error while parsing selector \\`${r}\\` - unexpected symbol "${i()}" at position ${t}`+(m?" during "+m:""))};function a(){for(;!n&&/\\s/.test(i());)s()}function l(m){return m>="\\x80"||m>="0"&&m<="9"||m>="A"&&m<="Z"||m>="a"&&m<="z"||m>="0"&&m<="9"||m==="_"||m==="-"}function c(){let m="";for(a();!n&&l(i());)m+=s();return m}function p(m){let S=s();for(S!==m&&o("parsing quoted string");!n&&i()!==m;)i()==="\\\\"&&s(),S+=s();return i()!==m&&o("parsing quoted string"),S+=s(),S}function d(){s()!=="/"&&o("parsing regular expression");let m="",S=!1;for(;!n;){if(i()==="\\\\")m+=s(),n&&o("parsing regular expression");else if(S&&i()==="]")S=!1;else if(!S&&i()==="[")S=!0;else if(!S&&i()==="/")break;m+=s()}s()!=="/"&&o("parsing regular expression");let E="";for(;!n&&i().match(/[dgimsuy]/);)E+=s();try{return new RegExp(m,E)}catch(y){throw new O(`Error while parsing selector \\`${r}\\`: ${y.message}`)}}function u(){let m="";return a(),i()==="\'"||i()===\'"\'?m=p(i()).slice(1,-1):m=c(),m||o("parsing property path"),m}function f(){a();let m="";return n||(m+=s()),!n&&m!=="="&&(m+=s()),["=","*=","^=","$=","|=","~="].includes(m)||o("parsing operator"),m}function h(){s();let m=[];for(m.push(u()),a();i()===".";)s(),m.push(u()),a();if(i()==="]")return s(),{name:m.join("."),jsonPath:m,op:"<truthy>",value:null,caseSensitive:!1};let S=f(),E,y=!0;if(a(),i()==="/"){if(S!=="=")throw new O(`Error while parsing selector \\`${r}\\` - cannot use ${S} in attribute with regular expression`);E=d()}else if(i()==="\'"||i()===\'"\')E=p(i()).slice(1,-1),a(),i()==="i"||i()==="I"?(y=!1,s()):(i()==="s"||i()==="S")&&(y=!0,s());else{for(E="";!n&&(l(i())||i()==="+"||i()===".");)E+=s();E==="true"?E=!0:E==="false"?E=!1:e||(E=+E,Number.isNaN(E)&&o("parsing attribute value"))}if(a(),i()!=="]"&&o("parsing attribute value"),s(),S!=="="&&typeof E!="string")throw new O(`Error while parsing selector \\`${r}\\` - cannot use ${S} in attribute with non-string matching value - ${E}`);return{name:m.join("."),jsonPath:m,op:S,value:E,caseSensitive:y}}let g={name:"",attributes:[]};for(g.name=c(),a();i()==="[";)g.attributes.push(h()),a();if(n||o(void 0),!g.name&&!g.attributes.length)throw new O(`Error while parsing selector \\`${r}\\` - selector cannot be empty`);return g}function at(r,e="\'"){let t=JSON.stringify(r),n=t.substring(1,t.length-1).replace(/\\\\"/g,\'"\');if(e==="\'")return e+n.replace(/[\']/g,"\\\\\'")+e;if(e===\'"\')return e+n.replace(/["]/g,\'\\\\"\')+e;if(e==="`")return e+n.replace(/[`]/g,"\\\\`")+e;throw new Error("Invalid escape char")}function lt(r){return r.charAt(0).toUpperCase()+r.substring(1)}function wr(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function be(r){return`"${r.replace(/["\\\\]/g,e=>"\\\\"+e)}"`}var me;function bn(){me=new Map}function v(r){let e=me==null?void 0:me.get(r);return e===void 0&&(e=r.replace(/[\\u200b\\u00ad]/g,"").trim().replace(/\\s+/g," "),me==null||me.set(r,e)),e}function ct(r){return r.replace(/(^|[^\\\\])(\\\\\\\\)*\\\\([\'"`])/g,"$1$2$3")}function xn(r){return r.unicode||r.unicodeSets?String(r):String(r).replace(/(^|[^\\\\])(\\\\\\\\)*(["\'`])/g,"$1$2\\\\$3").replace(/>>/g,"\\\\>\\\\>")}function q(r,e){return typeof r!="string"?xn(r):`${JSON.stringify(r)}${e?"s":"i"}`}function L(r,e){return typeof r!="string"?xn(r):`"${r.replace(/\\\\/g,"\\\\\\\\").replace(/["]/g,\'\\\\"\')}"${e?"s":"i"}`}function es(r,e,t=""){if(r.length<=e)return r;let n=[...r];return n.length>e?n.slice(0,e-t.length).join("")+t:n.join("")}function vr(r,e){return es(r,e,"\\u2026")}function ke(r){return r.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function En(r,e){let t=r.length,n=e.length,i=0,s=0,o=Array(t+1).fill(null).map(()=>Array(n+1).fill(0));for(let a=1;a<=t;a++)for(let l=1;l<=n;l++)r[a-1]===e[l-1]&&(o[a][l]=o[a-1][l-1]+1,o[a][l]>i&&(i=o[a][l],s=a));return r.slice(s-i,s)}var Ao=new RegExp("([\\\\u001B\\\\u009B][[\\\\]()#?]*(?:(?:(?:[a-zA-Z\\\\d]*(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)|(?:(?:\\\\d{0,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~])))","g");function K(r,e,t=!1){return ts(r,e,t,1)[0]}function ts(r,e,t=!1,n=20,i){try{return Ne(new ns[r](i),ot(e),t,n)}catch{return[e]}}function Ne(r,e,t=!1,n=20){let i=[...e.parts],s=[],o=t?"frame-locator":"page";for(let a=0;a<i.length;a++){let l=i[a],c=o;if(o="locator",l.name==="internal:describe")continue;if(l.name==="nth"){l.body==="0"?s.push([r.generateLocator(c,"first",""),r.generateLocator(c,"nth","0")]):l.body==="-1"?s.push([r.generateLocator(c,"last",""),r.generateLocator(c,"nth","-1")]):s.push([r.generateLocator(c,"nth",l.body)]);continue}if(l.name==="visible"){s.push([r.generateLocator(c,"visible",l.body),r.generateLocator(c,"default",`visible=${l.body}`)]);continue}if(l.name==="internal:text"){let{exact:h,text:g}=ut(l.body);s.push([r.generateLocator(c,"text",g,{exact:h})]);continue}if(l.name==="internal:has-text"){let{exact:h,text:g}=ut(l.body);if(!h){s.push([r.generateLocator(c,"has-text",g,{exact:h})]);continue}}if(l.name==="internal:has-not-text"){let{exact:h,text:g}=ut(l.body);if(!h){s.push([r.generateLocator(c,"has-not-text",g,{exact:h})]);continue}}if(l.name==="internal:has"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"has",g)));continue}if(l.name==="internal:has-not"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"hasNot",g)));continue}if(l.name==="internal:and"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"and",g)));continue}if(l.name==="internal:or"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"or",g)));continue}if(l.name==="internal:chain"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"chain",g)));continue}if(l.name==="internal:label"){let{exact:h,text:g}=ut(l.body);s.push([r.generateLocator(c,"label",g,{exact:h})]);continue}if(l.name==="internal:role"){let h=X(l.body,!0),g={attrs:[]};for(let m of h.attributes)if(m.name==="name"){if(g.exact!==void 0&&g.exact!==m.caseSensitive)throw new Error(`Conflicting exactness in internal:role selector: ${$({parts:[l]})}`);g.exact=m.caseSensitive,g.name=m.value}else if(m.name==="description"){if(g.exact!==void 0&&g.exact!==m.caseSensitive)throw new Error(`Conflicting exactness in internal:role selector: ${$({parts:[l]})}`);g.exact=m.caseSensitive,g.description=m.value}else m.name==="level"&&typeof m.value=="string"&&(m.value=+m.value),g.attrs.push({name:m.name==="include-hidden"?"includeHidden":m.name,value:m.value});s.push([r.generateLocator(c,"role",h.name,g)]);continue}if(l.name==="internal:testid"){let h=X(l.body,!0),{value:g}=h.attributes[0];s.push([r.generateLocator(c,"test-id",g)]);continue}if(l.name==="internal:attr"){let h=X(l.body,!0),{name:g,value:m,caseSensitive:S}=h.attributes[0],E=m,y=!!S;if(g==="placeholder"){s.push([r.generateLocator(c,"placeholder",E,{exact:y})]);continue}if(g==="alt"){s.push([r.generateLocator(c,"alt",E,{exact:y})]);continue}if(g==="title"){s.push([r.generateLocator(c,"title",E,{exact:y})]);continue}}if(l.name==="internal:control"&&l.body==="enter-frame"){let h=s[s.length-1],g=i[a-1],m=h.map(S=>r.chainLocators([S,r.generateLocator(c,"frame","")]));["xpath","css"].includes(g.name)&&m.push(r.generateLocator(c,"frame-locator",$({parts:[g]})),r.generateLocator(c,"frame-locator",$({parts:[g]},!0))),h.splice(0,h.length,...m),o="frame-locator";continue}let p=i[a+1],d=$({parts:[l]}),u=r.generateLocator(c,"default",d);if(p&&["internal:has-text","internal:has-not-text"].includes(p.name)){let{exact:h,text:g}=ut(p.body);if(!h){let m=r.generateLocator("locator",p.name==="internal:has-text"?"has-text":"has-not-text",g,{exact:h}),S={};p.name==="internal:has-text"?S.hasText=g:S.hasNotText=g;let E=r.generateLocator(c,"default",d,S);s.push([r.chainLocators([u,m]),E]),a++;continue}}let f;if(["xpath","css"].includes(l.name)){let h=$({parts:[l]},!0);f=r.generateLocator(c,"default",h)}s.push([u,f].filter(Boolean))}return rs(r,s,n)}function rs(r,e,t){let n=e.map(()=>""),i=[],s=o=>{if(o===e.length)return i.push(r.chainLocators(n)),i.length<t;for(let a of e[o])if(n[o]=a,!s(o+1))return!1;return!0};return s(0),i}function ut(r){let e=!1,t=r.match(/^\\/(.*)\\/([igm]*)$/);return t?{text:new RegExp(t[1],t[2])}:(r.endsWith(\'"\')?(r=JSON.parse(r),e=!0):r.endsWith(\'"s\')?(r=JSON.parse(r.substring(0,r.length-1)),e=!0):r.endsWith(\'"i\')&&(r=JSON.parse(r.substring(0,r.length-1)),e=!1),{exact:e,text:r})}var Tr=class{constructor(e){this.preferredQuote=e}generateLocator(e,t,n,i={}){switch(t){case"default":return i.hasText!==void 0?`locator(${this.quote(n)}, { hasText: ${this.toHasText(i.hasText)} })`:i.hasNotText!==void 0?`locator(${this.quote(n)}, { hasNotText: ${this.toHasText(i.hasNotText)} })`:`locator(${this.quote(n)})`;case"frame-locator":return`frameLocator(${this.quote(n)})`;case"frame":return"contentFrame()";case"nth":return`nth(${n})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter({ visible: ${n==="true"?"true":"false"} })`;case"role":let s=[];C(i.name)?s.push(`name: ${this.regexToSourceString(i.name)}`):typeof i.name=="string"&&s.push(`name: ${this.quote(i.name)}`),C(i.description)?s.push(`description: ${this.regexToSourceString(i.description)}`):typeof i.description=="string"&&s.push(`description: ${this.quote(i.description)}`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&s.push("exact: true");for(let{name:a,value:l}of i.attrs)s.push(`${a}: ${typeof l=="string"?this.quote(l):l}`);let o=s.length?`, { ${s.join(", ")} }`:"";return`getByRole(${this.quote(n)}${o})`;case"has-text":return`filter({ hasText: ${this.toHasText(n)} })`;case"has-not-text":return`filter({ hasNotText: ${this.toHasText(n)} })`;case"has":return`filter({ has: ${n} })`;case"hasNot":return`filter({ hasNot: ${n} })`;case"and":return`and(${n})`;case"or":return`or(${n})`;case"chain":return`locator(${n})`;case"test-id":return`getByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("getByText",n,!!i.exact);case"alt":return this.toCallWithExact("getByAltText",n,!!i.exact);case"placeholder":return this.toCallWithExact("getByPlaceholder",n,!!i.exact);case"label":return this.toCallWithExact("getByLabel",n,!!i.exact);case"title":return this.toCallWithExact("getByTitle",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToSourceString(e){return ct(String(e))}toCallWithExact(e,t,n){return C(t)?`${e}(${this.regexToSourceString(t)})`:n?`${e}(${this.quote(t)}, { exact: true })`:`${e}(${this.quote(t)})`}toHasText(e){return C(e)?this.regexToSourceString(e):this.quote(e)}toTestIdValue(e){return C(e)?this.regexToSourceString(e):this.quote(e)}quote(e){var t;return at(e,(t=this.preferredQuote)!=null?t:"\'")}},Ar=class{generateLocator(e,t,n,i={}){switch(t){case"default":return i.hasText!==void 0?`locator(${this.quote(n)}, has_text=${this.toHasText(i.hasText)})`:i.hasNotText!==void 0?`locator(${this.quote(n)}, has_not_text=${this.toHasText(i.hasNotText)})`:`locator(${this.quote(n)})`;case"frame-locator":return`frame_locator(${this.quote(n)})`;case"frame":return"content_frame";case"nth":return`nth(${n})`;case"first":return"first";case"last":return"last";case"visible":return`filter(visible=${n==="true"?"True":"False"})`;case"role":let s=[];C(i.name)?s.push(`name=${this.regexToString(i.name)}`):typeof i.name=="string"&&s.push(`name=${this.quote(i.name)}`),C(i.description)?s.push(`description=${this.regexToString(i.description)}`):typeof i.description=="string"&&s.push(`description=${this.quote(i.description)}`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&s.push("exact=True");for(let{name:a,value:l}of i.attrs){let c=typeof l=="string"?this.quote(l):l;typeof l=="boolean"&&(c=l?"True":"False"),s.push(`${wr(a)}=${c}`)}let o=s.length?`, ${s.join(", ")}`:"";return`get_by_role(${this.quote(n)}${o})`;case"has-text":return`filter(has_text=${this.toHasText(n)})`;case"has-not-text":return`filter(has_not_text=${this.toHasText(n)})`;case"has":return`filter(has=${n})`;case"hasNot":return`filter(has_not=${n})`;case"and":return`and_(${n})`;case"or":return`or_(${n})`;case"chain":return`locator(${n})`;case"test-id":return`get_by_test_id(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("get_by_text",n,!!i.exact);case"alt":return this.toCallWithExact("get_by_alt_text",n,!!i.exact);case"placeholder":return this.toCallWithExact("get_by_placeholder",n,!!i.exact);case"label":return this.toCallWithExact("get_by_label",n,!!i.exact);case"title":return this.toCallWithExact("get_by_title",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", re.IGNORECASE":"";return`re.compile(r"${ct(e.source).replace(/\\\\\\//,"/").replace(/"/g,\'\\\\"\')}"${t})`}toCallWithExact(e,t,n){return C(t)?`${e}(${this.regexToString(t)})`:n?`${e}(${this.quote(t)}, exact=True)`:`${e}(${this.quote(t)})`}toHasText(e){return C(e)?this.regexToString(e):`${this.quote(e)}`}toTestIdValue(e){return C(e)?this.regexToString(e):this.quote(e)}quote(e){return at(e,\'"\')}},_r=class{generateLocator(e,t,n,i={}){let s;switch(e){case"page":s="Page";break;case"frame-locator":s="FrameLocator";break;case"locator":s="Locator";break}switch(t){case"default":return i.hasText!==void 0?`locator(${this.quote(n)}, new ${s}.LocatorOptions().setHasText(${this.toHasText(i.hasText)}))`:i.hasNotText!==void 0?`locator(${this.quote(n)}, new ${s}.LocatorOptions().setHasNotText(${this.toHasText(i.hasNotText)}))`:`locator(${this.quote(n)})`;case"frame-locator":return`frameLocator(${this.quote(n)})`;case"frame":return"contentFrame()";case"nth":return`nth(${n})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter(new ${s}.FilterOptions().setVisible(${n==="true"?"true":"false"}))`;case"role":let o=[];C(i.name)?o.push(`.setName(${this.regexToString(i.name)})`):typeof i.name=="string"&&o.push(`.setName(${this.quote(i.name)})`),C(i.description)?o.push(`.setDescription(${this.regexToString(i.description)})`):typeof i.description=="string"&&o.push(`.setDescription(${this.quote(i.description)})`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&o.push(".setExact(true)");for(let{name:l,value:c}of i.attrs)o.push(`.set${lt(l)}(${typeof c=="string"?this.quote(c):c})`);let a=o.length?`, new ${s}.GetByRoleOptions()${o.join("")}`:"";return`getByRole(AriaRole.${wr(n).toUpperCase()}${a})`;case"has-text":return`filter(new ${s}.FilterOptions().setHasText(${this.toHasText(n)}))`;case"has-not-text":return`filter(new ${s}.FilterOptions().setHasNotText(${this.toHasText(n)}))`;case"has":return`filter(new ${s}.FilterOptions().setHas(${n}))`;case"hasNot":return`filter(new ${s}.FilterOptions().setHasNot(${n}))`;case"and":return`and(${n})`;case"or":return`or(${n})`;case"chain":return`locator(${n})`;case"test-id":return`getByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact(s,"getByText",n,!!i.exact);case"alt":return this.toCallWithExact(s,"getByAltText",n,!!i.exact);case"placeholder":return this.toCallWithExact(s,"getByPlaceholder",n,!!i.exact);case"label":return this.toCallWithExact(s,"getByLabel",n,!!i.exact);case"title":return this.toCallWithExact(s,"getByTitle",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", Pattern.CASE_INSENSITIVE":"";return`Pattern.compile(${this.quote(ct(e.source))}${t})`}toCallWithExact(e,t,n,i){return C(n)?`${t}(${this.regexToString(n)})`:i?`${t}(${this.quote(n)}, new ${e}.${lt(t)}Options().setExact(true))`:`${t}(${this.quote(n)})`}toHasText(e){return C(e)?this.regexToString(e):this.quote(e)}toTestIdValue(e){return C(e)?this.regexToString(e):this.quote(e)}quote(e){return at(e,\'"\')}},Cr=class{generateLocator(e,t,n,i={}){switch(t){case"default":return i.hasText!==void 0?`Locator(${this.quote(n)}, new() { ${this.toHasText(i.hasText)} })`:i.hasNotText!==void 0?`Locator(${this.quote(n)}, new() { ${this.toHasNotText(i.hasNotText)} })`:`Locator(${this.quote(n)})`;case"frame-locator":return`FrameLocator(${this.quote(n)})`;case"frame":return"ContentFrame";case"nth":return`Nth(${n})`;case"first":return"First";case"last":return"Last";case"visible":return`Filter(new() { Visible = ${n==="true"?"true":"false"} })`;case"role":let s=[];C(i.name)?s.push(`NameRegex = ${this.regexToString(i.name)}`):typeof i.name=="string"&&s.push(`Name = ${this.quote(i.name)}`),C(i.description)?s.push(`DescriptionRegex = ${this.regexToString(i.description)}`):typeof i.description=="string"&&s.push(`Description = ${this.quote(i.description)}`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&s.push("Exact = true");for(let{name:a,value:l}of i.attrs)s.push(`${lt(a)} = ${typeof l=="string"?this.quote(l):l}`);let o=s.length?`, new() { ${s.join(", ")} }`:"";return`GetByRole(AriaRole.${lt(n)}${o})`;case"has-text":return`Filter(new() { ${this.toHasText(n)} })`;case"has-not-text":return`Filter(new() { ${this.toHasNotText(n)} })`;case"has":return`Filter(new() { Has = ${n} })`;case"hasNot":return`Filter(new() { HasNot = ${n} })`;case"and":return`And(${n})`;case"or":return`Or(${n})`;case"chain":return`Locator(${n})`;case"test-id":return`GetByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("GetByText",n,!!i.exact);case"alt":return this.toCallWithExact("GetByAltText",n,!!i.exact);case"placeholder":return this.toCallWithExact("GetByPlaceholder",n,!!i.exact);case"label":return this.toCallWithExact("GetByLabel",n,!!i.exact);case"title":return this.toCallWithExact("GetByTitle",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", RegexOptions.IgnoreCase":"";return`new Regex(${this.quote(ct(e.source))}${t})`}toCallWithExact(e,t,n){return C(t)?`${e}(${this.regexToString(t)})`:n?`${e}(${this.quote(t)}, new() { Exact = true })`:`${e}(${this.quote(t)})`}toHasText(e){return C(e)?`HasTextRegex = ${this.regexToString(e)}`:`HasText = ${this.quote(e)}`}toTestIdValue(e){return C(e)?this.regexToString(e):this.quote(e)}toHasNotText(e){return C(e)?`HasNotTextRegex = ${this.regexToString(e)}`:`HasNotText = ${this.quote(e)}`}quote(e){return at(e,\'"\')}},kr=class{generateLocator(e,t,n,i={}){return JSON.stringify({kind:t,body:n,options:i})}chainLocators(e){let t=e.map(n=>JSON.parse(n));for(let n=0;n<t.length-1;++n)t[n].next=t[n+1];return JSON.stringify(t[0])}},ns={javascript:Tr,python:Ar,java:_r,csharp:Cr,jsonl:kr};function C(r){return r instanceof RegExp}function Nr(r,e,t){return`internal:attr=[${r}=${L(e,(t==null?void 0:t.exact)||!1)}]`}function Bt(r){return r.split(",")}function is(r){return r.includes(",")?JSON.stringify(r):r}function Sn(r,e){return`internal:testid=[${is(r)}=${L(e,!0)}]`}function yn(r,e){return"internal:label="+q(r,!!(e!=null&&e.exact))}function wn(r,e){return Nr("alt",r,e)}function vn(r,e){return Nr("title",r,e)}function Tn(r,e){return Nr("placeholder",r,e)}function An(r,e){return"internal:text="+q(r,!!(e!=null&&e.exact))}function _n(r,e={}){let t=[];return e.checked!==void 0&&t.push(["checked",String(e.checked)]),e.disabled!==void 0&&t.push(["disabled",String(e.disabled)]),e.selected!==void 0&&t.push(["selected",String(e.selected)]),e.expanded!==void 0&&t.push(["expanded",String(e.expanded)]),e.includeHidden!==void 0&&t.push(["include-hidden",String(e.includeHidden)]),e.level!==void 0&&t.push(["level",String(e.level)]),e.name!==void 0&&t.push(["name",L(e.name,!!e.exact)]),e.description!==void 0&&t.push(["description",L(e.description,!!e.exact)]),e.pressed!==void 0&&t.push(["pressed",String(e.pressed)]),`internal:role=${r}${t.map(([n,i])=>`[${n}=${i}]`).join("")}`}function Cn(r){return kn(r)?"\'"+r.replace(/\'/g,"\'\'")+"\'":r}function Ft(r){return kn(r)?\'"\'+r.replace(/[\\\\"\\x00-\\x1f\\x7f-\\x9f]/g,e=>{switch(e){case"\\\\":return"\\\\\\\\";case\'"\':return\'\\\\"\';case"\\b":return"\\\\b";case"\\f":return"\\\\f";case`\n`:return"\\\\n";case"\\r":return"\\\\r";case" ":return"\\\\t";default:return"\\\\x"+e.charCodeAt(0).toString(16).padStart(2,"0")}})+\'"\':r}function kn(r){return!!(r.length===0||/^\\s|\\s$/.test(r)||/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f-\\x9f]/.test(r)||/^-/.test(r)||/[\\n:](\\s|$)/.test(r)||/\\s#/.test(r)||/[\\n\\r]/.test(r)||/^[&*\\],?!>|@"\'#%]/.test(r)||/[{}`]/.test(r)||/^\\[/.test(r)||!isNaN(Number(r))||["y","n","yes","no","true","false","on","off","null"].includes(r.toLowerCase()))}var Nn={};function Rn(r){Nn=r}function pt(r,e){for(;e;){if(r.contains(e))return!0;e=Ln(e)}return!1}function I(r){if(r.parentElement)return r.parentElement;if(r.parentNode&&r.parentNode.nodeType===11&&r.parentNode.host)return r.parentNode.host}function Ut(r){let e=r;for(;e.parentNode;)e=e.parentNode;if(e.nodeType===11||e.nodeType===9)return e}function Ln(r){for(;r.parentElement;)r=r.parentElement;return I(r)}function xe(r,e,t){for(;r;){let n=r.closest(e);if(t&&n!==t&&(n!=null&&n.contains(t)))return;if(n)return n;r=Ln(r)}}function z(r,e){let t=e==="::before"?ht:e==="::after"?ft:dt;if(t&&t.has(r))return t.get(r);let n=r.ownerDocument&&r.ownerDocument.defaultView?r.ownerDocument.defaultView.getComputedStyle(r,e):void 0;return t==null||t.set(r,n),n}function Rr(r,e){if(e=e!=null?e:z(r),!e)return!0;if(Element.prototype.checkVisibility&&Nn.browserNameForWorkarounds!=="webkit"){if(!r.checkVisibility())return!1}else{let t=r.closest("details,summary");if(t!==r&&(t==null?void 0:t.nodeName)==="DETAILS"&&!t.open)return!1}return e.visibility==="visible"}function gt(r){let e=z(r);if(!e)return{visible:!0,inline:!1};let t=e.cursor;if(e.display==="contents"){for(let i=r.firstChild;i;i=i.nextSibling){if(i.nodeType===1&&W(i))return{visible:!0,inline:!1,cursor:t};if(i.nodeType===3&&Lr(i))return{visible:!0,inline:!0,cursor:t}}return{visible:!1,inline:!1,cursor:t}}if(!Rr(r,e))return{cursor:t,visible:!1,inline:!1};let n=r.getBoundingClientRect();return{cursor:t,visible:n.width>0&&n.height>0,inline:e.display==="inline"}}function W(r){return gt(r).visible}function Lr(r){let e=r.ownerDocument.createRange();e.selectNode(r);let t=e.getBoundingClientRect();return t.width>0&&t.height>0}function A(r){let e=r.tagName;return typeof e=="string"?e.toUpperCase():r instanceof HTMLFormElement?"FORM":r.tagName.toUpperCase()}var dt,ht,ft,In=0;function Re(){++In,dt!=null||(dt=new Map),ht!=null||(ht=new Map),ft!=null||(ft=new Map)}function Le(){--In||(dt=void 0,ht=void 0,ft=void 0)}function Mn(r){return r.hasAttribute("aria-label")||r.hasAttribute("aria-labelledby")}var On="article:not([role]), aside:not([role]), main:not([role]), nav:not([role]), section:not([role]), [role=article], [role=complementary], [role=main], [role=navigation], [role=region]",ss=[["aria-atomic",void 0],["aria-busy",void 0],["aria-controls",void 0],["aria-current",void 0],["aria-describedby",void 0],["aria-details",void 0],["aria-dropeffect",void 0],["aria-flowto",void 0],["aria-grabbed",void 0],["aria-hidden",void 0],["aria-keyshortcuts",void 0],["aria-label",["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"]],["aria-labelledby",["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"]],["aria-live",void 0],["aria-owns",void 0],["aria-relevant",void 0],["aria-roledescription",["generic"]]];function qn(r,e){return ss.some(([t,n])=>!(n!=null&&n.includes(e||""))&&r.hasAttribute(t))}function Bn(r){return!Number.isNaN(Number(String(r.getAttribute("tabindex"))))}function os(r){return!Yn(r)&&(as(r)||Bn(r))}function as(r){let e=A(r);return["BUTTON","DETAILS","SELECT","TEXTAREA"].includes(e)?!0:e==="A"||e==="AREA"?r.hasAttribute("href"):e==="INPUT"?!r.hidden:!1}var Ir={A:r=>r.hasAttribute("href")?"link":null,AREA:r=>r.hasAttribute("href")?"link":null,ARTICLE:()=>"article",ASIDE:()=>"complementary",BLOCKQUOTE:()=>"blockquote",BUTTON:()=>"button",CAPTION:()=>"caption",CODE:()=>"code",DATALIST:()=>"listbox",DD:()=>"definition",DEL:()=>"deletion",DETAILS:()=>"group",DFN:()=>"term",DIALOG:()=>"dialog",DT:()=>"term",EM:()=>"emphasis",FIELDSET:()=>"group",FIGURE:()=>"figure",FOOTER:r=>xe(r,On)?null:"contentinfo",FORM:r=>Mn(r)?"form":null,H1:()=>"heading",H2:()=>"heading",H3:()=>"heading",H4:()=>"heading",H5:()=>"heading",H6:()=>"heading",HEADER:r=>xe(r,On)?null:"banner",HR:()=>"separator",HTML:()=>"document",IMG:r=>r.getAttribute("alt")===""&&!r.getAttribute("title")&&!qn(r)&&!Bn(r)?"presentation":"img",INPUT:r=>{let e=r.type.toLowerCase();if(e==="search")return r.hasAttribute("list")?"combobox":"searchbox";if(["email","tel","text","url",""].includes(e)){let t=Me(r,r.getAttribute("list"))[0];return t&&A(t)==="DATALIST"?"combobox":"textbox"}return e==="hidden"?null:e==="file"?"button":bs[e]||"textbox"},INS:()=>"insertion",LI:()=>"listitem",MAIN:()=>"main",MARK:()=>"mark",MATH:()=>"math",MENU:()=>"list",METER:()=>"meter",NAV:()=>"navigation",OL:()=>"list",OPTGROUP:()=>"group",OPTION:()=>"option",OUTPUT:()=>"status",P:()=>"paragraph",PROGRESS:()=>"progressbar",SEARCH:()=>"search",SECTION:r=>Mn(r)?"region":null,SELECT:r=>r.hasAttribute("multiple")||r.size>1?"listbox":"combobox",STRONG:()=>"strong",SUB:()=>"subscript",SUP:()=>"superscript",SVG:()=>"img",TABLE:()=>"table",TBODY:()=>"rowgroup",TD:r=>{let e=xe(r,"table"),t=e?Mr(e):"";return t==="grid"||t==="treegrid"?"gridcell":"cell"},TEXTAREA:()=>"textbox",TFOOT:()=>"rowgroup",TH:r=>{let e=r.getAttribute("scope");if(e==="col"||e==="colgroup")return"columnheader";if(e==="row"||e==="rowgroup")return"rowheader";let t=r.nextElementSibling,n=r.previousElementSibling,i=r.parentElement&&A(r.parentElement)==="TR"?r.parentElement:void 0;if(!t&&!n){if(i){let s=xe(i,"table");if(s&&s.rows.length<=1)return null}return"columnheader"}return $n(t)&&$n(n)?"columnheader":Pn(t)||Pn(n)?"rowheader":"columnheader"},THEAD:()=>"rowgroup",TIME:()=>"time",TR:()=>"row",UL:()=>"list"};function $n(r){return!!r&&A(r)==="TH"}function Pn(r){var e;return!r||A(r)!=="TD"?!1:!!((e=r.textContent)!=null&&e.trim()||r.children.length>0)}var ls={DD:["DL","DIV"],DIV:["DL"],DT:["DL","DIV"],LI:["OL","UL"],TBODY:["TABLE"],TD:["TR"],TFOOT:["TABLE"],TH:["TR"],THEAD:["TABLE"],TR:["THEAD","TBODY","TFOOT","TABLE"]};function Dn(r){var n;let e=((n=Ir[A(r)])==null?void 0:n.call(Ir,r))||"";if(!e)return null;let t=r;for(;t;){let i=I(t),s=ls[A(t)];if(!s||!i||!s.includes(A(i)))break;let o=Mr(i);if((o==="none"||o==="presentation")&&!Fn(i,o))return o;t=i}return e}var cs=["alert","alertdialog","application","article","banner","blockquote","button","caption","cell","checkbox","code","columnheader","combobox","complementary","contentinfo","definition","deletion","dialog","directory","document","emphasis","feed","figure","form","generic","grid","gridcell","group","heading","img","insertion","link","list","listbox","listitem","log","main","mark","marquee","math","meter","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","navigation","none","note","option","paragraph","presentation","progressbar","radio","radiogroup","region","row","rowgroup","rowheader","scrollbar","search","searchbox","separator","slider","spinbutton","status","strong","subscript","superscript","switch","tab","table","tablist","tabpanel","term","textbox","time","timer","toolbar","tooltip","tree","treegrid","treeitem"];function Mr(r){return(r.getAttribute("role")||"").split(" ").map(t=>t.trim()).find(t=>cs.includes(t))||null}function Fn(r,e){return qn(r,e)||os(r)}function k(r){let e=Mr(r);if(!e)return Dn(r);if(e==="none"||e==="presentation"){let t=Dn(r);if(Fn(r,t))return t}return e}function Un(r){return r===null?void 0:r.toLowerCase()==="true"}function jn(r){return["STYLE","SCRIPT","NOSCRIPT","TEMPLATE"].includes(A(r))}function F(r){if(jn(r))return!0;let e=z(r),t=r.nodeName==="SLOT";if((e==null?void 0:e.display)==="contents"&&!t){for(let i=r.firstChild;i;i=i.nextSibling)if(i.nodeType===1&&!F(i)||i.nodeType===3&&Lr(i))return!1;return!0}return!(r.nodeName==="OPTION"&&!!r.closest("select"))&&!t&&!Rr(r,e)?!0:Wn(r)}function Wn(r){let e=Q==null?void 0:Q.get(r);if(e===void 0){if(e=!1,r.parentElement&&r.parentElement.shadowRoot&&!r.assignedSlot&&(e=!0),!e){let t=z(r);e=!t||t.display==="none"||Un(r.getAttribute("aria-hidden"))===!0}if(!e){let t=I(r);t&&(e=Wn(t))}Q==null||Q.set(r,e)}return e}function Me(r,e){if(!e)return[];let t=Ut(r);if(!t)return[];try{let n=e.split(" ").filter(s=>!!s),i=[];for(let s of n){let o=t.querySelector("#"+CSS.escape(s));o&&!i.includes(o)&&i.push(o)}return i}catch{return[]}}function Z(r){return r.trim()}function bt(r){return r.split("\\xA0").map(e=>e.replace(/\\r\\n/g,`\n`).replace(/[\\u200b\\u00ad]/g,"").replace(/\\s\\s*/g," ")).join("\\xA0").trim()}function Hn(r,e){let t=[...r.querySelectorAll(e)];for(let n of Me(r,r.getAttribute("aria-owns")))n.matches(e)&&t.push(n),t.push(...n.querySelectorAll(e));return t}function Ie(r,e){let t=e==="::before"?vt:e==="::after"?Tt:wt;if(t!=null&&t.has(r))return t==null?void 0:t.get(r);let n=z(r,e),i;if(n){let s=n.content;s&&s!=="none"&&s!=="normal"&&n.display!=="none"&&n.visibility!=="hidden"&&(i=us(r,s,!!e))}return e&&i!==void 0&&((n==null?void 0:n.display)||"inline")!=="inline"&&(i=" "+i+" "),t&&t.set(r,i),i}function us(r,e,t){if(!(!e||e==="none"||e==="normal"))try{let n=qt(e).filter(a=>!(a instanceof ne)),i=n.findIndex(a=>a instanceof _&&a.value==="/");if(i!==-1)n=n.slice(i+1);else if(!t)return;let s=[],o=0;for(;o<n.length;)if(n[o]instanceof ge)s.push(n[o].value),o++;else if(o+2<n.length&&n[o]instanceof Y&&n[o].value==="attr"&&n[o+1]instanceof pe&&n[o+2]instanceof he){let a=n[o+1].value;s.push(r.getAttribute(a)||""),o+=3}else return;return s.join("")}catch{}}function Or(r){let e=r.getAttribute("aria-labelledby");if(e===null)return null;let t=Me(r,e);return t.length?t:null}function ds(r,e){let t=["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"].includes(r),n=e&&["","caption","code","contentinfo","definition","deletion","emphasis","insertion","list","listitem","mark","none","paragraph","presentation","region","row","rowgroup","section","strong","subscript","superscript","table","term","time"].includes(r);return t||n}function ee(r,e){let t=e?Et:xt,n=t==null?void 0:t.get(r);return n===void 0&&(n="",["caption","code","definition","deletion","emphasis","generic","insertion","mark","paragraph","presentation","strong","subscript","suggestion","superscript","term","time"].includes(k(r)||"")||(n=bt(V(r,{includeHidden:e,visitedElements:new Set,embeddedInTargetElement:"self"}))),t==null||t.set(r,n)),n}function ae(r,e){let t=e?yt:St,n=t==null?void 0:t.get(r);if(n===void 0){if(n="",r.hasAttribute("aria-describedby")){let i=Me(r,r.getAttribute("aria-describedby"));n=bt(i.map(s=>V(s,{includeHidden:e,visitedElements:new Set,embeddedInDescribedBy:{element:s,hidden:F(s)}})).join(" "))}else r.hasAttribute("aria-description")?n=bt(r.getAttribute("aria-description")||""):n=bt(r.getAttribute("title")||"");t==null||t.set(r,n)}return n}var Vn=["application","checkbox","columnheader","combobox","gridcell","listbox","radiogroup","rowheader","searchbox","slider","spinbutton","switch","textbox","tree"];function $r(r){let e=r.getAttribute("aria-invalid");return!e||e.trim()===""||e.toLocaleLowerCase()==="false"?"false":e==="true"||e==="grammar"||e==="spelling"?e:"true"}function hs(r){if("validity"in r){let e=r.validity;return(e==null?void 0:e.valid)===!1}return!1}function zn(r){let e=oe,t=oe==null?void 0:oe.get(r);if(t===void 0){t="";let n=$r(r)!=="false",i=hs(r);if(n||i){let s=r.getAttribute("aria-errormessage");t=Me(r,s).map(l=>bt(V(l,{visitedElements:new Set,embeddedInDescribedBy:{element:l,hidden:F(l)}}))).join(" ").trim()}e==null||e.set(r,t)}return t}function V(r,e){var l,c,p,d;if(e.visitedElements.has(r))return"";let t={...e,embeddedInTargetElement:e.embeddedInTargetElement==="self"?"descendant":e.embeddedInTargetElement};if(!e.includeHidden){let u=!!((l=e.embeddedInLabelledBy)!=null&&l.hidden)||!!((c=e.embeddedInDescribedBy)!=null&&c.hidden)||!!((p=e.embeddedInNativeTextAlternative)!=null&&p.hidden)||!!((d=e.embeddedInLabel)!=null&&d.hidden);if(jn(r)||!u&&F(r))return e.visitedElements.add(r),""}let n=Or(r);if(!e.embeddedInLabelledBy){let u=(n||[]).map(f=>V(f,{...e,embeddedInLabelledBy:{element:f,hidden:F(f)},embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0,embeddedInLabel:void 0,embeddedInNativeTextAlternative:void 0})).join(" ");if(u)return u}let i=k(r)||"",s=A(r);if(e.embeddedInLabel||e.embeddedInLabelledBy||e.embeddedInTargetElement==="descendant"){let u=[...r.labels||[]].includes(r),f=(n||[]).includes(r);if(!u&&!f){if(i==="textbox")return e.visitedElements.add(r),s==="INPUT"||s==="TEXTAREA"?r.value:r.textContent||"";if(["combobox","listbox"].includes(i)){e.visitedElements.add(r);let h;if(s==="SELECT")h=[...r.selectedOptions],!h.length&&r.options.length&&h.push(r.options[0]);else{let g=i==="combobox"?Hn(r,"*").find(m=>k(m)==="listbox"):r;h=g?Hn(g,\'[aria-selected="true"]\').filter(m=>k(m)==="option"):[]}return!h.length&&s==="INPUT"?r.value:h.map(g=>V(g,t)).join(" ")}if(["progressbar","scrollbar","slider","spinbutton","meter"].includes(i))return e.visitedElements.add(r),r.hasAttribute("aria-valuetext")?r.getAttribute("aria-valuetext")||"":r.hasAttribute("aria-valuenow")?r.getAttribute("aria-valuenow")||"":r.getAttribute("value")||"";if(["menu"].includes(i))return e.visitedElements.add(r),""}}let o=r.getAttribute("aria-label")||"";if(Z(o))return e.visitedElements.add(r),o;if(!["presentation","none"].includes(i)){if(s==="INPUT"&&["button","submit","reset"].includes(r.type)){e.visitedElements.add(r);let u=r.value||"";return Z(u)?u:r.type==="submit"?"Submit":r.type==="reset"?"Reset":r.getAttribute("title")||""}if(s==="INPUT"&&r.type==="file"){e.visitedElements.add(r);let u=r.labels||[];return u.length&&!e.embeddedInLabelledBy?mt(u,e):"Choose File"}if(s==="INPUT"&&r.type==="image"){e.visitedElements.add(r);let u=r.labels||[];if(u.length&&!e.embeddedInLabelledBy)return mt(u,e);let f=r.getAttribute("alt")||"";if(Z(f))return f;let h=r.getAttribute("title")||"";return Z(h)?h:"Submit"}if(!n&&s==="BUTTON"){e.visitedElements.add(r);let u=r.labels||[];if(u.length)return mt(u,e)}if(!n&&s==="OUTPUT"){e.visitedElements.add(r);let u=r.labels||[];return u.length?mt(u,e):r.getAttribute("title")||""}if(!n&&(s==="TEXTAREA"||s==="SELECT"||s==="INPUT")){e.visitedElements.add(r);let u=r.labels||[];if(u.length)return mt(u,e);let f=s==="INPUT"&&["text","password","search","tel","email","url"].includes(r.type)||s==="TEXTAREA",h=r.getAttribute("placeholder")||"",g=r.getAttribute("title")||"";return!f||g?g:h}if(!n&&s==="FIELDSET"){e.visitedElements.add(r);for(let f=r.firstElementChild;f;f=f.nextElementSibling)if(A(f)==="LEGEND")return V(f,{...t,embeddedInNativeTextAlternative:{element:f,hidden:F(f)}});return r.getAttribute("title")||""}if(!n&&s==="FIGURE"){e.visitedElements.add(r);for(let f=r.firstElementChild;f;f=f.nextElementSibling)if(A(f)==="FIGCAPTION")return V(f,{...t,embeddedInNativeTextAlternative:{element:f,hidden:F(f)}});return r.getAttribute("title")||""}if(s==="IMG"){e.visitedElements.add(r);let u=r.getAttribute("alt")||"";return Z(u)?u:r.getAttribute("title")||""}if(s==="TABLE"){e.visitedElements.add(r);for(let f=r.firstElementChild;f;f=f.nextElementSibling)if(A(f)==="CAPTION")return V(f,{...t,embeddedInNativeTextAlternative:{element:f,hidden:F(f)}});let u=r.getAttribute("summary")||"";if(u)return u}if(s==="AREA"){e.visitedElements.add(r);let u=r.getAttribute("alt")||"";return Z(u)?u:r.getAttribute("title")||""}if(s==="SVG"||r.ownerSVGElement){e.visitedElements.add(r);for(let u=r.firstElementChild;u;u=u.nextElementSibling)if(A(u)==="TITLE"&&u.ownerSVGElement)return V(u,{...t,embeddedInLabelledBy:{element:u,hidden:F(u)}})}if(r.ownerSVGElement&&s==="A"){let u=r.getAttribute("xlink:title")||"";if(Z(u))return e.visitedElements.add(r),u}}let a=s==="SUMMARY"&&!["presentation","none"].includes(i);if(ds(i,e.embeddedInTargetElement==="descendant")||a||e.embeddedInLabelledBy||e.embeddedInDescribedBy||e.embeddedInLabel||e.embeddedInNativeTextAlternative){e.visitedElements.add(r);let u=fs(r,t);if(e.embeddedInTargetElement==="self"?Z(u):u)return u}if(!["presentation","none"].includes(i)||s==="IFRAME"){e.visitedElements.add(r);let u=r.getAttribute("title")||"";if(Z(u))return u}return e.visitedElements.add(r),""}function fs(r,e){let t=[],n=(s,o)=>{var a;if(!(o&&s.assignedSlot))if(s.nodeType===1){let l=((a=z(s))==null?void 0:a.display)||"inline",c=V(s,e);(l!=="inline"||s.nodeName==="BR")&&(c=" "+c+" "),t.push(c)}else s.nodeType===3&&t.push(s.textContent||"")};t.push(Ie(r,"::before")||"");let i=Ie(r);if(i!==void 0)t.push(i);else{let s=r.nodeName==="SLOT"?r.assignedNodes():[];if(s.length)for(let o of s)n(o,!1);else{for(let o=r.firstChild;o;o=o.nextSibling)n(o,!0);if(r.shadowRoot)for(let o=r.shadowRoot.firstChild;o;o=o.nextSibling)n(o,!0);for(let o of Me(r,r.getAttribute("aria-owns")))n(o,!0)}}return t.push(Ie(r,"::after")||""),t.join("")}var _t=["gridcell","option","row","tab","rowheader","columnheader","treeitem"];function jt(r){return A(r)==="OPTION"?r.selected:_t.includes(k(r)||"")?Un(r.getAttribute("aria-selected"))===!0:!1}var Ct=["checkbox","menuitemcheckbox","option","radio","switch","menuitemradio","treeitem"];function Wt(r){let e=Pr(r,!0);return e==="error"?!1:e}function Qn(r){return Pr(r,!0)}function Gn(r){return Pr(r,!1)}function Pr(r,e){let t=A(r);if(e&&t==="INPUT"&&r.indeterminate)return"mixed";if(t==="INPUT"&&["checkbox","radio"].includes(r.type))return r.checked;if(Ct.includes(k(r)||"")){let n=r.getAttribute("aria-checked");return n==="true"?!0:e&&n==="mixed"?"mixed":!1}return"error"}var ps=["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox","columnheader","rowheader","searchbox","switch","treegrid"];function Jn(r){let e=A(r);return["INPUT","TEXTAREA","SELECT"].includes(e)?r.hasAttribute("readonly"):ps.includes(k(r)||"")?r.getAttribute("aria-readonly")==="true":r.isContentEditable?!1:"error"}var kt=["button"];function Vt(r){if(kt.includes(k(r)||"")){let e=r.getAttribute("aria-pressed");if(e==="true")return!0;if(e==="mixed")return"mixed"}return!1}var Nt=["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","rowheader","switch"];function zt(r){if(A(r)==="DETAILS")return r.open;if(Nt.includes(k(r)||"")){let e=r.getAttribute("aria-expanded");return e===null?void 0:e==="true"}}var Rt=["heading","listitem","row","treeitem"];function Qt(r){let e={H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[A(r)];if(e)return e;if(Rt.includes(k(r)||"")){let t=r.getAttribute("aria-level"),n=t===null?Number.NaN:Number(t);if(Number.isInteger(n)&&n>=1)return n}return 0}var Dr=["application","button","composite","gridcell","group","input","link","menuitem","scrollbar","separator","tab","checkbox","columnheader","combobox","grid","listbox","menu","menubar","menuitemcheckbox","menuitemradio","option","radio","radiogroup","row","rowheader","searchbox","select","slider","spinbutton","switch","tablist","textbox","toolbar","tree","treegrid","treeitem"];function Ee(r){return Yn(r)||Xn(r)}function Yn(r){return["BUTTON","INPUT","SELECT","TEXTAREA","OPTION","OPTGROUP"].includes(A(r))&&(r.hasAttribute("disabled")||gs(r)||ms(r))}function gs(r){return A(r)==="OPTION"&&!!r.closest("OPTGROUP[DISABLED]")}function ms(r){let e=r==null?void 0:r.closest("FIELDSET[DISABLED]");if(!e)return!1;let t=e.querySelector(":scope > LEGEND");return!t||!t.contains(r)}function Xn(r,e=!1){if(!r)return!1;if(e||Dr.includes(k(r)||"")){let t=(r.getAttribute("aria-disabled")||"").toLowerCase();return t==="true"?!0:t==="false"?!1:Xn(I(r),!0)}return!1}function mt(r,e){return[...r].map(t=>V(t,{...e,embeddedInLabel:{element:t,hidden:F(t)},embeddedInNativeTextAlternative:void 0,embeddedInLabelledBy:void 0,embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0})).filter(t=>!!t).join(" ")}function Kn(r){let e=At,t=r,n,i=[];for(;t;t=I(t)){let s=e.get(t);if(s!==void 0){n=s;break}i.push(t);let o=z(t);if(!o){n=!0;break}let a=o.pointerEvents;if(a){n=a!=="none";break}}n===void 0&&(n=!0);for(let s of i)e.set(s,n);return n}var xt,Et,St,yt,oe,Q,wt,vt,Tt,At,Zn=0;function le(){Re(),++Zn,xt!=null||(xt=new Map),Et!=null||(Et=new Map),St!=null||(St=new Map),yt!=null||(yt=new Map),oe!=null||(oe=new Map),Q!=null||(Q=new Map),wt!=null||(wt=new Map),vt!=null||(vt=new Map),Tt!=null||(Tt=new Map),At!=null||(At=new Map)}function ce(){--Zn||(xt=void 0,Et=void 0,St=void 0,yt=void 0,oe=void 0,Q=void 0,wt=void 0,vt=void 0,Tt=void 0,At=void 0),Le()}var bs={button:"button",checkbox:"checkbox",image:"button",number:"spinbutton",radio:"radio",range:"slider",reset:"button",submit:"button"};var Es=0;function ii(r){let e=r.boxes;return r.mode==="ai"?{visibility:"ariaOrVisible",refs:"interactable",refPrefix:r.refPrefix,includeGenericRole:!0,renderActive:!r.doNotRenderActive,renderCursorPointer:!0,renderBoxes:e}:r.mode==="autoexpect"?{visibility:"ariaAndVisible",refs:"none",renderBoxes:e}:r.mode==="codegen"?{visibility:"aria",refs:"none",renderStringsAsRegex:!0,renderBoxes:e}:{visibility:"aria",refs:"none",renderBoxes:e}}function ye(r,e){let t=ii(e),n=new Set,i={root:{role:"fragment",name:"",children:[],props:{},box:gt(r),receivesPointerEvents:!0},elements:new Map,refs:new Map,iframeRefs:[]};qr(i.root,r);let s=(a,l,c)=>{if(n.has(l))return;if(n.add(l),l.nodeType===Node.TEXT_NODE&&l.nodeValue){if(!c)return;let g=l.nodeValue;a.role!=="textbox"&&g&&a.children.push(l.nodeValue||"");return}if(l.nodeType!==Node.ELEMENT_NODE)return;let p=l,d=!F(p),u=d;if(t.visibility==="ariaOrVisible"&&(u=d||W(p)),t.visibility==="ariaAndVisible"&&(u=d&&W(p)),t.visibility==="aria"&&!u)return;let f=[];if(p.hasAttribute("aria-owns")){let g=p.getAttribute("aria-owns").split(/\\s+/);for(let m of g){let S=r.ownerDocument.getElementById(m);S&&f.push(S)}}let h=u?Ss(p,t):null;h&&(h.ref&&(i.elements.set(h.ref,p),i.refs.set(p,h.ref),h.role==="iframe"&&i.iframeRefs.push(h.ref)),a.children.push(h)),o(h||a,p,f,u)};function o(a,l,c,p){var h;let u=(((h=z(l))==null?void 0:h.display)||"inline")!=="inline"||l.nodeName==="BR"?" ":"";u&&a.children.push(u),a.children.push(Ie(l,"::before")||"");let f=l.nodeName==="SLOT"?l.assignedNodes():[];if(f.length)for(let g of f)s(a,g,p);else{for(let g=l.firstChild;g;g=g.nextSibling)g.assignedSlot||s(a,g,p);if(l.shadowRoot)for(let g=l.shadowRoot.firstChild;g;g=g.nextSibling)s(a,g,p)}for(let g of c)s(a,g,p);if(a.children.push(Ie(l,"::after")||""),u&&a.children.push(u),a.children.length===1&&a.name===a.children[0]&&(a.children=[]),a.role==="link"&&l.hasAttribute("href")){let g=l.getAttribute("href");a.props.url=g}if(a.role==="textbox"&&l.hasAttribute("placeholder")&&l.getAttribute("placeholder")!==a.name){let g=l.getAttribute("placeholder");a.props.placeholder=g}}le();try{s(i.root,r,!0)}finally{ce()}return ws(i.root),ys(i.root),i}function ei(r,e){var i;if(e.refs==="none"||e.refs==="interactable"&&(!r.box.visible||!r.receivesPointerEvents))return;let t=Jt(r),n=t._ariaRef;(!n||n.role!==r.role||n.name!==r.name)&&(n={role:r.role,name:r.name,ref:((i=e.refPrefix)!=null?i:"")+"e"+ ++Es},t._ariaRef=n),r.ref=n.ref}function Ss(r,e){var c;let t=r.ownerDocument.activeElement===r;if(r.nodeName==="IFRAME"){let p={role:"iframe",name:"",children:[],props:{},box:gt(r),receivesPointerEvents:!0,active:t};return qr(p,r),ei(p,e),p}let n=e.includeGenericRole?"generic":null,i=(c=k(r))!=null?c:n;if(!i||i==="presentation"||i==="none")return null;let s=v(ee(r,!1)||""),o=Kn(r),a=gt(r);if(i==="generic"&&a.inline&&r.childNodes.length===1&&r.childNodes[0].nodeType===Node.TEXT_NODE)return null;let l={role:i,name:s,children:[],props:{},box:a,receivesPointerEvents:o,active:t};if(qr(l,r),ei(l,e),Ct.includes(i)&&(l.checked=Wt(r)),Dr.includes(i)&&(l.disabled=Ee(r)),Nt.includes(i)&&(l.expanded=zt(r)),Vn.includes(i)){let p=$r(r);l.invalid=p==="false"?!1:p==="true"?!0:p}return Rt.includes(i)&&(l.level=Qt(r)),kt.includes(i)&&(l.pressed=Vt(r)),_t.includes(i)&&(l.selected=jt(r)),(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&r.type!=="checkbox"&&r.type!=="radio"&&r.type!=="file"&&(l.children=[r.value]),l}function ys(r){let e=t=>{let n=[];for(let s of t.children||[]){if(typeof s=="string"){n.push(s);continue}let o=e(s);n.push(...o)}return t.role==="generic"&&!t.name&&n.length<=1&&n.every(s=>typeof s!="string"&&!!s.ref)?n:(t.children=n,[t])};e(r)}function ws(r){let e=(n,i)=>{if(!n.length)return;let s=v(n.join(""));s&&i.push(s),n.length=0},t=n=>{let i=[],s=[];for(let o of n.children||[])typeof o=="string"?s.push(o):(e(s,i),t(o),i.push(o));e(s,i),n.children=i.length?i:[],n.children.length===1&&n.children[0]===n.name&&(n.children=[])};t(r)}function vs(r,e){return e?r?typeof e=="string"?r===e:!!r.match(new RegExp(e.pattern)):!1:!0}function ti(r,e){if(!(e!=null&&e.normalized))return!0;if(!r)return!1;if(r===e.normalized||r===e.raw)return!0;let t=Ts(e);return t?!!r.match(t):!1}var Hr=Symbol("cachedRegex");function Ts(r){if(r[Hr]!==void 0)return r[Hr];let{raw:e}=r,t=e.startsWith("/")&&e.endsWith("/")&&e.length>1,n;try{n=t?new RegExp(e.slice(1,-1)):null}catch{n=null}return r[Hr]=n,n}function Br(r,e){let t=ye(r,{mode:"default"});return{matches:oi(t.root,e,!1,!1),received:{raw:Se(t,{mode:"default"}).text,regex:Se(t,{mode:"codegen"}).text}}}function si(r,e){let t=ye(r,{mode:"default"}).root;return oi(t,e,!0,!1).map(i=>Jt(i))}function Fr(r,e,t){var n;return typeof r=="string"&&e.kind==="text"?ti(r,e.text):r===null||typeof r!="object"||e.kind!=="role"||e.role!=="fragment"&&e.role!==r.role||e.checked!==void 0&&e.checked!==r.checked||e.disabled!==void 0&&e.disabled!==r.disabled||e.expanded!==void 0&&e.expanded!==r.expanded||e.invalid!==void 0&&e.invalid!==r.invalid||e.level!==void 0&&e.level!==r.level||e.pressed!==void 0&&e.pressed!==r.pressed||e.selected!==void 0&&e.selected!==r.selected||!vs(r.name,e.name)||!ti(r.props.url,(n=e.props)==null?void 0:n.url)?!1:e.containerMode==="contain"?ni(r.children||[],e.children||[]):e.containerMode==="equal"?ri(r.children||[],e.children||[],!1):e.containerMode==="deep-equal"||t?ri(r.children||[],e.children||[],!0):ni(r.children||[],e.children||[])}function ri(r,e,t){if(e.length!==r.length)return!1;for(let n=0;n<e.length;++n)if(!Fr(r[n],e[n],t))return!1;return!0}function ni(r,e){if(e.length>r.length)return!1;let t=r.slice(),n=e.slice();for(let i of n){let s=t.shift();for(;s&&!Fr(s,i,!1);)s=t.shift();if(!s)return!1}return!0}function oi(r,e,t,n){let i=[],s=(o,a)=>{if(Fr(o,e,n)){let l=typeof o=="string"?a:o;return l&&i.push(l),!t}if(typeof o=="string")return!1;for(let l of o.children||[])if(s(l,o))return!0;return!1};return s(r,null),i}function ai(r,e=new Map){r!=null&&r.ref&&e.set(r.ref,r);for(let t of(r==null?void 0:r.children)||[])typeof t!="string"&&ai(t,e);return e}function As(r,e){var s;let t=ai(e==null?void 0:e.root),n=new Map,i=(o,a)=>{let l=o.children.length===(a==null?void 0:a.children.length)&&an(o,a),c=l;for(let p=0;p<o.children.length;p++){let d=o.children[p],u=a==null?void 0:a.children[p];if(typeof d=="string")l&&(l=d===u),c&&(c=d===u);else{let f=typeof u!="string"?u:void 0;d.ref&&(f=t.get(d.ref));let h=i(d,f);(!f||!h&&!d.ref||f!==u)&&(c=!1),l&&(l=h&&f===u)}}return n.set(o,l?"same":c?"skip":"changed"),l};return i(r.root,t.get((s=e==null?void 0:e.root)==null?void 0:s.ref)),n}function _s(r,e){let t=[],n=i=>{let s=e.get(i);if(s!=="same")if(s==="skip")for(let o of i.children)typeof o!="string"&&n(o);else t.push(i)};for(let i of r)typeof i=="string"?t.push(i):n(i);return t}function Gt(r){return" ".repeat(r)}function Se(r,e,t){let n=ii(e),i=[],s={},o=n.renderStringsAsRegex?ks:()=>!0,a=n.renderStringsAsRegex?Cs:h=>h,l=r.root.role==="fragment"?r.root.children:[r.root],c=As(r,t);t&&(l=_s(l,c));let p=(h,g)=>{if(e.depth&&g>e.depth)return;let m=Ft(a(h));m&&i.push(Gt(g)+"- text: "+m)},d=(h,g)=>{let m=h.role;if(h.name&&h.name.length<=900){let S=a(h.name);if(S){let E=S.startsWith("/")&&S.endsWith("/")?S:JSON.stringify(S);m+=" "+E}}if(h.checked==="mixed"&&(m+=" [checked=mixed]"),h.checked===!0&&(m+=" [checked]"),h.disabled&&(m+=" [disabled]"),h.expanded&&(m+=" [expanded]"),h.active&&n.renderActive&&(m+=" [active]"),(h.invalid==="grammar"||h.invalid==="spelling")&&(m+=` [invalid=${h.invalid}]`),h.invalid===!0&&(m+=" [invalid]"),h.level&&(m+=` [level=${h.level}]`),h.pressed==="mixed"&&(m+=" [pressed=mixed]"),h.pressed===!0&&(m+=" [pressed]"),h.selected===!0&&(m+=" [selected]"),h.ref&&(m+=` [ref=${h.ref}]`,g&&Fe(h)&&(m+=" [cursor=pointer]")),n.renderBoxes){let S=Jt(h);if(S){let E=S.getBoundingClientRect();m+=` [box=${Math.round(E.x)},${Math.round(E.y)},${Math.round(E.width)},${Math.round(E.height)}]`}}return m},u=h=>(h==null?void 0:h.children.length)===1&&typeof h.children[0]=="string"&&!Object.keys(h.props).length?h.children[0]:void 0,f=(h,g,m)=>{if(e.depth&&g>e.depth)return;if(h.role==="iframe"&&h.ref&&(s[h.ref]=g),c.get(h)==="same"&&h.ref){i.push(Gt(g)+`- ref=${h.ref} [unchanged]`);return}let S=!!t&&!g,E=Gt(g)+"- "+(S?"<changed> ":"")+Cn(d(h,m)),y=u(h),D=!!e.depth&&g===e.depth;if(!y&&(!h.children.length||D)&&!Object.keys(h.props).length)i.push(E);else if(y!==void 0)o(h,y)?i.push(E+": "+Ft(a(y))):i.push(E);else{i.push(E+":");for(let[N,G]of Object.entries(h.props))i.push(Gt(g+1)+"- /"+N+": "+Ft(G));let re=!!h.ref&&m&&Fe(h);for(let N of h.children)typeof N=="string"?p(o(h,N)?N:"",g+1):f(N,g+1,m&&!re)}};for(let h of l)typeof h=="string"?p(h,0):f(h,0,!!n.renderCursorPointer);return{text:i.join(`\n`),iframeDepths:s}}function Cs(r){let e=[{regex:/\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/,replacement:"[0-9a-fA-F-]+"},{regex:/\\b[\\d,.]+[bkmBKM]+\\b/,replacement:"[\\\\d,.]+[bkmBKM]+"},{regex:/\\b\\d+[hmsp]+\\b/,replacement:"\\\\d+[hmsp]+"},{regex:/\\b[\\d,.]+[hmsp]+\\b/,replacement:"[\\\\d,.]+[hmsp]+"},{regex:/\\b\\d+,\\d+\\b/,replacement:"\\\\d+,\\\\d+"},{regex:/\\b\\d+\\.\\d{2,}\\b/,replacement:"\\\\d+\\\\.\\\\d+"},{regex:/\\b\\d{2,}\\.\\d+\\b/,replacement:"\\\\d+\\\\.\\\\d+"},{regex:/\\b\\d{2,}\\b/,replacement:"\\\\d+"}],t="",n=0,i=new RegExp(e.map(s=>"("+s.regex.source+")").join("|"),"g");return r.replace(i,(s,...o)=>{let a=o[o.length-2],l=o.slice(0,-2);t+=ke(r.slice(n,a));for(let c=0;c<l.length;c++)if(l[c]){let{replacement:p}=e[c];t+=p;break}return n=a+s.length,s}),t?(t+=ke(r.slice(n)),String(new RegExp(t))):r}function ks(r,e){if(!e.length)return!1;if(!r.name)return!0;let t=e.length<=200&&r.name.length<=200?En(e,r.name):"",n=e;for(;t&&n.includes(t);)n=n.replace(t,"");return n.trim().length/e.length>.1}var li=Symbol("element");function Jt(r){return r[li]}function qr(r,e){r[li]=e}function ci(r,e){let t=un(r,e);return t?Jt(t):void 0}var Ur=`:host{font-size:13px;font-family:system-ui,Ubuntu,Droid Sans,sans-serif;color:#333;color-scheme:light}svg{position:absolute;height:0}x-pw-tooltip{backdrop-filter:blur(5px);background-color:#fff;border-radius:6px;box-shadow:0 .5rem 1.2rem #0000004d;display:none;font-size:12.8px;font-weight:400;left:0;line-height:1.5;max-width:600px;position:absolute;top:0;padding:0;flex-direction:column;overflow:hidden}x-pw-tooltip-line{display:flex;max-width:600px;padding:6px;user-select:none;cursor:pointer}x-pw-tooltip-footer{display:flex;max-width:600px;padding:6px;user-select:none;color:#777}x-pw-dialog{background-color:#fff;pointer-events:auto;border-radius:6px;box-shadow:0 .5rem 1.2rem #0000004d;display:flex;flex-direction:column;position:absolute;z-index:10;font-size:13px}x-pw-dialog:not(.autosize){width:400px;height:150px}x-pw-dialog-body{display:flex;flex-direction:column;flex:auto}x-pw-dialog-body label{margin:5px 8px;display:flex;flex-direction:row;align-items:center}x-pw-highlight{position:absolute;top:0;left:0;width:0;height:0}x-pw-action-point{position:absolute;width:20px;height:20px;background:red;border-radius:10px;margin:-10px 0 0 -10px;z-index:2}x-pw-action-cursor{position:absolute;width:18px;height:22px;pointer-events:none;z-index:4;filter:drop-shadow(0 1px 2px rgba(0,0,0,.4))}x-pw-action-cursor svg{width:100%;height:100%;position:static}x-pw-title{position:absolute;backdrop-filter:blur(5px);background-color:#00000080;color:#fff;border-radius:6px;padding:6px;font-size:24px;line-height:1.4;white-space:nowrap;user-select:none;z-index:3}x-pw-user-overlays,x-pw-user-overlay{position:absolute;inset:0}@keyframes pw-fade-out{0%{opacity:1}to{opacity:0}}x-pw-separator{height:1px;margin:6px 9px;background:#949494e5}x-pw-tool-gripper{height:28px;width:24px;margin:2px 0;cursor:grab}x-pw-tool-gripper:active{cursor:grabbing}x-pw-tool-gripper>x-div{width:16px;height:16px;margin:6px 4px;clip-path:url(#icon-gripper);background-color:#555}x-pw-tools-list>label{display:flex;align-items:center;margin:0 10px;user-select:none}x-pw-tools-list{display:flex;width:100%;border-bottom:1px solid #dddddd}x-pw-tool-item{pointer-events:auto;height:28px;width:28px;border-radius:3px}x-pw-tool-item:not(.disabled){cursor:pointer}x-pw-tool-item:not(.disabled):hover{background-color:#dbdbdb}x-pw-tool-item.toggled{background-color:#8acae480}x-pw-tool-item.toggled:not(.disabled):hover{background-color:#8acae4c4}x-pw-tool-item>x-div{width:16px;height:16px;margin:6px;background-color:#3a3a3a}x-pw-tool-item.disabled>x-div{background-color:#61616180;cursor:default}x-pw-tool-item.record.toggled{background-color:transparent}x-pw-tool-item.record.toggled:not(.disabled):hover{background-color:#dbdbdb}x-pw-tool-item.record.toggled>x-div{background-color:#a1260d}x-pw-tool-item.record.disabled.toggled>x-div{opacity:.8}x-pw-tool-item.accept>x-div{background-color:#388a34}x-pw-tool-item.record>x-div{clip-path:url(#icon-circle-large-filled)}x-pw-tool-item.record.toggled>x-div{clip-path:url(#icon-stop-circle)}x-pw-tool-item.pick-locator>x-div{clip-path:url(#icon-inspect)}x-pw-tool-item.text>x-div{clip-path:url(#icon-whole-word)}x-pw-tool-item.visibility>x-div{clip-path:url(#icon-eye)}x-pw-tool-item.value>x-div{clip-path:url(#icon-symbol-constant)}x-pw-tool-item.snapshot>x-div{clip-path:url(#icon-gist)}x-pw-tool-item.accept>x-div{clip-path:url(#icon-check)}x-pw-tool-item.cancel>x-div{clip-path:url(#icon-close)}x-pw-tool-item.succeeded>x-div{clip-path:url(#icon-pass);background-color:#388a34!important}x-pw-overlay{position:absolute;top:0;max-width:min-content;z-index:2147483647;background:transparent;pointer-events:auto}x-pw-overlay x-pw-tools-list{background-color:#fffd;box-shadow:#0000001a 0 5px 5px;border-radius:3px;border-bottom:none}x-pw-overlay x-pw-tool-item{margin:2px}textarea.text-editor{font-family:system-ui,Ubuntu,Droid Sans,sans-serif;flex:auto;border:none;margin:6px 10px;color:#333;outline:1px solid transparent!important;resize:none;padding:0;font-size:13px}textarea.text-editor.does-not-match{outline:1px solid red!important}x-div{display:block}x-spacer{flex:auto}*{box-sizing:border-box}*[hidden]{display:none!important}x-locator-editor{flex:none;width:100%;height:60px;padding:4px;border-bottom:1px solid #dddddd;outline:1px solid transparent}x-locator-editor.does-not-match{outline:1px solid red}.CodeMirror{width:100%!important;height:100%!important}x-pw-action-list{flex:auto;display:flex;flex-direction:column;user-select:none}x-pw-action-item{padding:6px 10px;cursor:pointer;overflow:hidden}x-pw-action-item:hover{background-color:#f2f2f2}x-pw-action-item:last-child{border-bottom-left-radius:6px;border-bottom-right-radius:6px}\n`;var Oe=class{constructor(e){this._renderedEntries=[];this._userOverlays=new Map;this._userOverlayHidden=!1;this._language="javascript";this._elementHighlightSelectors=new Map;this._injectedScript=e;let t=e.document;if(this._isUnderTest=e.isUnderTest,this._glassPaneElement=t.createElement("x-pw-glass"),this._glassPaneElement.setAttribute("popover","manual"),this._glassPaneElement.style.inset="0",this._glassPaneElement.style.width="100%",this._glassPaneElement.style.height="100%",this._glassPaneElement.style.maxWidth="none",this._glassPaneElement.style.maxHeight="none",this._glassPaneElement.style.padding="0",this._glassPaneElement.style.margin="0",this._glassPaneElement.style.border="none",this._glassPaneElement.style.overflow="visible",this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.display="flex",this._glassPaneElement.style.backgroundColor="transparent",this._actionPointElement=t.createElement("x-pw-action-point"),this._actionPointElement.setAttribute("hidden","true"),this._actionCursorElement=t.createElement("x-pw-action-cursor"),this._actionCursorElement.style.visibility="hidden",this._actionCursorElement.appendChild(this._createCursorSvg(t)),this._titleElement=t.createElement("x-pw-title"),this._titleElement.setAttribute("hidden","true"),this._userOverlayContainer=t.createElement("x-pw-user-overlays"),this._userOverlayContainer.setAttribute("hidden","true"),this._glassPaneShadow=this._glassPaneElement.attachShadow({mode:this._isUnderTest?"open":"closed"}),typeof this._glassPaneShadow.adoptedStyleSheets.push=="function"){let n=new this._injectedScript.window.CSSStyleSheet;n.replaceSync(Ur),this._glassPaneShadow.adoptedStyleSheets.push(n)}else{let n=this._injectedScript.document.createElement("style");n.textContent=Ur,this._glassPaneShadow.appendChild(n)}this._glassPaneShadow.appendChild(this._actionPointElement),this._glassPaneShadow.appendChild(this._actionCursorElement),this._glassPaneShadow.appendChild(this._titleElement),this._glassPaneShadow.appendChild(this._userOverlayContainer)}install(){this._injectedScript.document.documentElement&&((!this._injectedScript.document.documentElement.contains(this._glassPaneElement)||this._glassPaneElement.nextElementSibling)&&this._injectedScript.document.documentElement.appendChild(this._glassPaneElement),this._bringToFront())}_bringToFront(){this._glassPaneElement.hidePopover(),this._glassPaneElement.showPopover()}setLanguage(e){this._language=e}addElementHighlight(e,t){let n=$(e);this._elementHighlightSelectors.set(n,{selector:e,cssStyle:t}),this._ensureElementHighlightRaf()}removeElementHighlight(e){let t=$(e);this._elementHighlightSelectors.delete(t)&&this._elementHighlightSelectors.size===0&&(this._rafRequest&&(this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0),this.clearHighlight())}_ensureElementHighlightRaf(){if(this._rafRequest)return;let e=()=>{let t=[];for(let{selector:n,cssStyle:i}of this._elementHighlightSelectors.values()){let s=this._injectedScript.querySelectorAll(n,this._injectedScript.document.documentElement),o=K(this._language,$(n)),a=s.length>1?"#f6b26b7f":"#6fa8dc7f";for(let l=0;l<s.length;++l){let c=s.length>1?` [${l+1} of ${s.length}]`:"";t.push({element:s[l],color:a,tooltipText:o+c,cssStyle:i})}}this.updateHighlight(t),this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)};this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)}uninstall(){this._rafRequest&&(this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0),this._elementHighlightSelectors.clear(),this._glassPaneElement.remove()}showActionPoint(e,t,n){this._actionPointElement.style.top=t+"px",this._actionPointElement.style.left=e+"px",this._actionPointElement.hidden=!1,n?this._actionPointElement.style.animation=`pw-fade-out ${n}ms ease-out forwards`:this._actionPointElement.style.animation=""}hideActionPoint(){this._actionPointElement.hidden=!0}moveActionCursor(e,t,n){let i=n?Math.max(80,Math.min(n*.6,400)):0;this._actionCursorElement.style.transition=`top ${i}ms ease, left ${i}ms ease`,this._actionCursorElement.style.left=e+"px",this._actionCursorElement.style.top=t+"px",this._actionCursorElement.style.visibility="visible"}hideActionCursor(){this._actionCursorElement.style.visibility="hidden"}_createCursorSvg(e){let t="http://www.w3.org/2000/svg",n=e.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 18 22");let i=e.createElementNS(t,"path");return i.setAttribute("d","M1 1 L1 17 L5.5 13 L8 20.5 L11 19.5 L8.5 12 L15 12 Z"),i.setAttribute("fill","white"),i.setAttribute("stroke","black"),i.setAttribute("stroke-width","1.5"),i.setAttribute("stroke-linejoin","round"),n.appendChild(i),n}showActionTitle(e,t,n,i){if(this._titleElement.textContent=e,this._titleElement.hidden=!1,t){let s=t/4;this._titleElement.style.animation=`pw-fade-out ${s}ms ease-out ${t-s}ms forwards`}else this._titleElement.style.animation="";switch(this._titleElement.style.top="",this._titleElement.style.bottom="",this._titleElement.style.left="",this._titleElement.style.right="",this._titleElement.style.transform="",n){case"top-left":this._titleElement.style.top="6px",this._titleElement.style.left="6px";break;case"top":this._titleElement.style.top="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-left":this._titleElement.style.bottom="6px",this._titleElement.style.left="6px";break;case"bottom":this._titleElement.style.bottom="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-right":this._titleElement.style.bottom="6px",this._titleElement.style.right="6px";break;default:this._titleElement.style.top="6px",this._titleElement.style.right="6px";break}i&&(this._titleElement.style.fontSize=i+"px")}hideActionTitle(){this._titleElement.hidden=!0}addUserOverlay(e,t){let n=this._injectedScript.document.createElement("div");n.className="x-pw-user-overlay",n.innerHTML=t;for(let i of n.querySelectorAll("script"))i.remove();for(let i of n.querySelectorAll("*"))for(let s of[...i.attributes])s.name.startsWith("on")&&i.removeAttribute(s.name);return this._userOverlays.set(e,n),this._userOverlayContainer.appendChild(n),this._userOverlayContainer.hidden=this._userOverlayHidden,e}getUserOverlay(e){return this._userOverlays.get(e)}removeUserOverlay(e){let t=this._userOverlays.get(e);t&&(t.remove(),this._userOverlays.delete(e)),this._userOverlays.size===0&&(this._userOverlayContainer.hidden=!0)}setUserOverlaysVisible(e){this._userOverlayHidden=!e,this._userOverlayContainer.hidden=!e||this._userOverlays.size===0}clearHighlight(){var e,t;for(let n of this._renderedEntries)(e=n.highlightElement)==null||e.remove(),(t=n.tooltipElement)==null||t.remove();this._renderedEntries=[]}maskElements(e,t){this.updateHighlight(e.map(n=>({element:n,color:t})))}updateHighlight(e){if(!this._highlightIsUpToDate(e)){this.clearHighlight();for(let t of e){let n=this._createHighlightElement();this._glassPaneShadow.appendChild(n);let i;if(t.tooltipText){i=this._injectedScript.document.createElement("x-pw-tooltip"),this._glassPaneShadow.appendChild(i),i.style.top="0",i.style.left="0",i.style.display="flex";let s=this._injectedScript.document.createElement("x-pw-tooltip-line");s.textContent=t.tooltipText,i.appendChild(s)}this._renderedEntries.push({targetElement:t.element,box:ui(t.box),color:t.color,borderColor:t.borderColor,fadeDuration:t.fadeDuration,cssStyle:t.cssStyle,tooltipElement:i,highlightElement:n})}for(let t of this._renderedEntries){if(!t.box&&!t.targetElement||(t.box=t.box||t.targetElement.getBoundingClientRect(),!t.tooltipElement))continue;let{anchorLeft:n,anchorTop:i}=this.tooltipPosition(t.box,t.tooltipElement);t.tooltipTop=i,t.tooltipLeft=n}for(let t of this._renderedEntries){t.tooltipElement&&(t.tooltipElement.style.top=t.tooltipTop+"px",t.tooltipElement.style.left=t.tooltipLeft+"px");let n=t.box;t.highlightElement.style.backgroundColor=t.color,t.highlightElement.style.left=n.x+"px",t.highlightElement.style.top=n.y+"px",t.highlightElement.style.width=n.width+"px",t.highlightElement.style.height=n.height+"px",t.highlightElement.style.display="block",t.borderColor&&(t.highlightElement.style.border="2px solid "+t.borderColor),t.fadeDuration&&(t.highlightElement.style.animation=`pw-fade-out ${t.fadeDuration}ms ease-out forwards`),t.cssStyle&&(t.highlightElement.style.cssText+=";"+t.cssStyle),this._isUnderTest&&console.error("Highlight box for test: "+JSON.stringify({x:n.x,y:n.y,width:n.width,height:n.height}))}}}firstBox(){var e;return(e=this._renderedEntries[0])==null?void 0:e.box}firstTooltipBox(){let e=this._renderedEntries[0];if(!(!e||!e.tooltipElement||e.tooltipLeft===void 0||e.tooltipTop===void 0))return{x:e.tooltipLeft,y:e.tooltipTop,left:e.tooltipLeft,top:e.tooltipTop,width:e.tooltipElement.offsetWidth,height:e.tooltipElement.offsetHeight,bottom:e.tooltipTop+e.tooltipElement.offsetHeight,right:e.tooltipLeft+e.tooltipElement.offsetWidth,toJSON:()=>{}}}tooltipPosition(e,t){let n=t.offsetWidth,i=t.offsetHeight,s=this._glassPaneElement.offsetWidth,o=this._glassPaneElement.offsetHeight,a=Math.max(5,e.left);a+n>s-5&&(a=s-n-5);let l=Math.max(0,e.bottom)+5;return l+i>o-5&&(Math.max(0,e.top)>i+5?l=Math.max(0,e.top)-i-5:l=o-5-i),{anchorLeft:a,anchorTop:l}}_highlightIsUpToDate(e){if(e.length!==this._renderedEntries.length)return!1;for(let t=0;t<this._renderedEntries.length;++t){if(e[t].element!==this._renderedEntries[t].targetElement||e[t].color!==this._renderedEntries[t].color||e[t].cssStyle!==this._renderedEntries[t].cssStyle)return!1;let n=this._renderedEntries[t].box;if(!n)return!1;let i=e[t].box?ui(e[t].box):e[t].element.getBoundingClientRect();if(i.top!==n.top||i.right!==n.right||i.bottom!==n.bottom||i.left!==n.left)return!1}return!0}_createHighlightElement(){return this._injectedScript.document.createElement("x-pw-highlight")}appendChild(e){this._glassPaneShadow.appendChild(e)}onGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="auto",this._glassPaneElement.style.backgroundColor="rgba(0, 0, 0, 0.3)",this._glassPaneElement.addEventListener("click",e)}offGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.backgroundColor="transparent",this._glassPaneElement.removeEventListener("click",e)}};function ui(r){if(r)return new DOMRect(r.x,r.y,r.width,r.height)}function Rs(r,e,t){let n=r.left-e.right;if(!(n<0||t!==void 0&&n>t))return n+Math.max(e.bottom-r.bottom,0)+Math.max(r.top-e.top,0)}function Ls(r,e,t){let n=e.left-r.right;if(!(n<0||t!==void 0&&n>t))return n+Math.max(e.bottom-r.bottom,0)+Math.max(r.top-e.top,0)}function Is(r,e,t){let n=e.top-r.bottom;if(!(n<0||t!==void 0&&n>t))return n+Math.max(r.left-e.left,0)+Math.max(e.right-r.right,0)}function Ms(r,e,t){let n=r.top-e.bottom;if(!(n<0||t!==void 0&&n>t))return n+Math.max(r.left-e.left,0)+Math.max(e.right-r.right,0)}function Os(r,e,t){let n=t===void 0?50:t,i=0;return r.left-e.right>=0&&(i+=r.left-e.right),e.left-r.right>=0&&(i+=e.left-r.right),e.top-r.bottom>=0&&(i+=e.top-r.bottom),r.top-e.bottom>=0&&(i+=r.top-e.bottom),i>n?void 0:i}var di=["left-of","right-of","above","below","near"];function Yt(r,e,t,n){let i=e.getBoundingClientRect(),s={"left-of":Ls,"right-of":Rs,above:Is,below:Ms,near:Os}[r],o;for(let a of t){if(a===e)continue;let l=s(i,a.getBoundingClientRect(),n);l!==void 0&&(o===void 0||l<o)&&(o=l)}return o}function jr(r,e){let t=typeof r=="string"&&!e.caseSensitive?r.toUpperCase():r,n=typeof e.value=="string"&&!e.caseSensitive?e.value.toUpperCase():e.value;return e.op==="<truthy>"?!!t:e.op==="="?n instanceof RegExp?typeof t=="string"&&!!t.match(n):t===n:typeof t!="string"||typeof n!="string"?!1:e.op==="*="?t.includes(n):e.op==="^="?t.startsWith(n):e.op==="$="?t.endsWith(n):e.op==="|="?t===n||t.startsWith(n+"-"):e.op==="~="?t.split(" ").includes(n):!1}function Xt(r){let e=r.ownerDocument;return r.nodeName==="SCRIPT"||r.nodeName==="NOSCRIPT"||r.nodeName==="STYLE"||e.head&&e.head.contains(r)}function P(r,e){let t=r.get(e);if(t===void 0){if(t={full:"",normalized:"",immediate:[]},!Xt(e)){let n="";if(e instanceof HTMLInputElement&&(e.type==="submit"||e.type==="button"))t={full:e.value,normalized:v(e.value),immediate:[e.value]};else{for(let i=e.firstChild;i;i=i.nextSibling)if(i.nodeType===Node.TEXT_NODE)t.full+=i.nodeValue||"",n+=i.nodeValue||"";else{if(i.nodeType===Node.COMMENT_NODE)continue;n&&t.immediate.push(n),n="",i.nodeType===Node.ELEMENT_NODE&&(t.full+=P(r,i).full)}n&&t.immediate.push(n),e.shadowRoot&&(t.full+=P(r,e.shadowRoot).full),t.full&&(t.normalized=v(t.full))}}r.set(e,t)}return t}function $e(r,e,t){if(Xt(e)||!t(P(r,e)))return"none";for(let n=e.firstChild;n;n=n.nextSibling)if(n.nodeType===Node.ELEMENT_NODE&&t(P(r,n)))return"selfAndChildren";return e.shadowRoot&&t(P(r,e.shadowRoot))?"selfAndChildren":"self"}function Kt(r,e){let t=Or(e);if(t)return t.map(s=>P(r,s));let n=e.getAttribute("aria-label");if(n!==null&&n.trim())return[{full:n,normalized:v(n),immediate:[n]}];let i=e.nodeName==="INPUT"&&e.type!=="hidden";if(["BUTTON","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"].includes(e.nodeName)||i){let s=e.labels;if(s)return[...s].map(o=>P(r,o))}return[]}var hi=["selected","checked","pressed","expanded","level","disabled","name","description","include-hidden"];hi.sort();function Lt(r,e,t){if(!e.includes(t))throw new Error(`"${r}" attribute is only supported for roles: ${e.slice().sort().map(n=>`"${n}"`).join(", ")}`)}function Pe(r,e){if(r.op!=="<truthy>"&&!e.includes(r.value))throw new Error(`"${r.name}" must be one of ${e.map(t=>JSON.stringify(t)).join(", ")}`)}function De(r,e){if(!e.includes(r.op))throw new Error(`"${r.name}" does not support "${r.op}" matcher`)}function $s(r,e){let t={role:e};for(let n of r)switch(n.name){case"checked":{Lt(n.name,Ct,e),Pe(n,[!0,!1,"mixed"]),De(n,["<truthy>","="]),t.checked=n.op==="<truthy>"?!0:n.value;break}case"pressed":{Lt(n.name,kt,e),Pe(n,[!0,!1,"mixed"]),De(n,["<truthy>","="]),t.pressed=n.op==="<truthy>"?!0:n.value;break}case"selected":{Lt(n.name,_t,e),Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.selected=n.op==="<truthy>"?!0:n.value;break}case"expanded":{Lt(n.name,Nt,e),Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.expanded=n.op==="<truthy>"?!0:n.value;break}case"level":{if(Lt(n.name,Rt,e),typeof n.value=="string"&&(n.value=+n.value),n.op!=="="||typeof n.value!="number"||Number.isNaN(n.value))throw new Error(\'"level" attribute must be compared to a number\');t.level=n.value;break}case"disabled":{Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.disabled=n.op==="<truthy>"?!0:n.value;break}case"name":{if(n.op==="<truthy>")throw new Error(\'"name" attribute must have a value\');if(typeof n.value!="string"&&!(n.value instanceof RegExp))throw new Error(\'"name" attribute must be a string or a regular expression\');t.name=n.value,t.nameOp=n.op,t.nameExact=n.caseSensitive;break}case"description":{if(n.op==="<truthy>")throw new Error(\'"description" attribute must have a value\');if(typeof n.value!="string"&&!(n.value instanceof RegExp))throw new Error(\'"description" attribute must be a string or a regular expression\');t.description=n.value,t.descriptionOp=n.op,t.descriptionExact=n.caseSensitive;break}case"include-hidden":{Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.includeHidden=n.op==="<truthy>"?!0:n.value;break}default:throw new Error(`Unknown attribute "${n.name}", must be one of ${hi.map(i=>`"${i}"`).join(", ")}.`)}return t}function Ps(r,e,t){let n=[],i=o=>{if(k(o)===e.role&&!(e.selected!==void 0&&jt(o)!==e.selected)&&!(e.checked!==void 0&&Wt(o)!==e.checked)&&!(e.pressed!==void 0&&Vt(o)!==e.pressed)&&!(e.expanded!==void 0&&zt(o)!==e.expanded)&&!(e.level!==void 0&&Qt(o)!==e.level)&&!(e.disabled!==void 0&&Ee(o)!==e.disabled)&&!(!e.includeHidden&&F(o))){if(e.name!==void 0){let a=v(ee(o,!!e.includeHidden));if(typeof e.name=="string"&&(e.name=v(e.name)),t&&!e.nameExact&&e.nameOp==="="&&(e.nameOp="*="),!jr(a,{name:"",jsonPath:[],op:e.nameOp||"=",value:e.name,caseSensitive:!!e.nameExact}))return}if(e.description!==void 0){let a=v(ae(o,!!e.includeHidden));if(typeof e.description=="string"&&(e.description=v(e.description)),t&&!e.descriptionExact&&e.descriptionOp==="="&&(e.descriptionOp="*="),!jr(a,{name:"",jsonPath:[],op:e.descriptionOp||"=",value:e.description,caseSensitive:!!e.descriptionExact}))return}n.push(o)}},s=o=>{let a=[];o.shadowRoot&&a.push(o.shadowRoot);for(let l of o.querySelectorAll("*"))i(l),l.shadowRoot&&a.push(l.shadowRoot);a.forEach(s)};return s(r),n}function Wr(r){return{queryAll:(e,t)=>{let n=X(t,!0),i=n.name.toLowerCase();if(!i)throw new Error("Role must not be empty");let s=$s(n.attributes,i);le();try{return Ps(e,s,r)}finally{ce()}}}}var er=class{constructor(){this._retainCacheCounter=0;this._cacheText=new Map,this._cacheQueryCSS=new Map,this._cacheMatches=new Map,this._cacheQuery=new Map,this._cacheMatchesSimple=new Map,this._cacheMatchesParents=new Map,this._cacheCallMatches=new Map,this._cacheCallQuery=new Map,this._cacheQuerySimple=new Map,this._engines=new Map,this._engines.set("not",qs),this._engines.set("is",Mt),this._engines.set("where",Mt),this._engines.set("has",Ds),this._engines.set("scope",Hs),this._engines.set("light",Bs),this._engines.set("visible",Fs),this._engines.set("text",Us),this._engines.set("text-is",js),this._engines.set("text-matches",Ws),this._engines.set("has-text",Vs),this._engines.set("right-of",It("right-of")),this._engines.set("left-of",It("left-of")),this._engines.set("above",It("above")),this._engines.set("below",It("below")),this._engines.set("near",It("near")),this._engines.set("nth-match",zs);let e=[...this._engines.keys()];e.sort();let t=[...yr];if(t.sort(),e.join("|")!==t.join("|"))throw new Error(`Please keep customCSSNames in sync with evaluator engines: ${e.join("|")} vs ${t.join("|")}`)}begin(){++this._retainCacheCounter}end(){--this._retainCacheCounter,this._retainCacheCounter||(this._cacheQueryCSS.clear(),this._cacheMatches.clear(),this._cacheQuery.clear(),this._cacheMatchesSimple.clear(),this._cacheMatchesParents.clear(),this._cacheCallMatches.clear(),this._cacheCallQuery.clear(),this._cacheQuerySimple.clear(),this._cacheText.clear())}_cached(e,t,n,i){e.has(t)||e.set(t,[]);let s=e.get(t),o=s.find(l=>n.every((c,p)=>l.rest[p]===c));if(o)return o.result;let a=i();return s.push({rest:n,result:a}),a}_checkSelector(e){if(!(typeof e=="object"&&e&&(Array.isArray(e)||"simples"in e&&e.simples.length)))throw new Error(`Malformed selector "${e}"`);return e}matches(e,t,n){let i=this._checkSelector(t);this.begin();try{return this._cached(this._cacheMatches,e,[i,n.scope,n.pierceShadow,n.originalScope],()=>Array.isArray(i)?this._matchesEngine(Mt,e,i,n):(this._hasScopeClause(i)&&(n=this._expandContextForScopeMatching(n)),this._matchesSimple(e,i.simples[i.simples.length-1].selector,n)?this._matchesParents(e,i,i.simples.length-2,n):!1))}finally{this.end()}}query(e,t){let n=this._checkSelector(t);this.begin();try{return this._cached(this._cacheQuery,n,[e.scope,e.pierceShadow,e.originalScope],()=>{if(Array.isArray(n))return this._queryEngine(Mt,e,n);this._hasScopeClause(n)&&(e=this._expandContextForScopeMatching(e));let i=this._scoreMap;this._scoreMap=new Map;let s=this._querySimple(e,n.simples[n.simples.length-1].selector);return s=s.filter(o=>this._matchesParents(o,n,n.simples.length-2,e)),this._scoreMap.size&&s.sort((o,a)=>{let l=this._scoreMap.get(o),c=this._scoreMap.get(a);return l===c?0:l===void 0?1:c===void 0?-1:l-c}),this._scoreMap=i,s})}finally{this.end()}}_markScore(e,t){this._scoreMap&&this._scoreMap.set(e,t)}_hasScopeClause(e){return e.simples.some(t=>t.selector.functions.some(n=>n.name==="scope"))}_expandContextForScopeMatching(e){if(e.scope.nodeType!==1)return e;let t=I(e.scope);return t?{...e,scope:t,originalScope:e.originalScope||e.scope}:e}_matchesSimple(e,t,n){return this._cached(this._cacheMatchesSimple,e,[t,n.scope,n.pierceShadow,n.originalScope],()=>{if(e===n.scope||t.css&&!this._matchesCSS(e,t.css))return!1;for(let i of t.functions)if(!this._matchesEngine(this._getEngine(i.name),e,i.args,n))return!1;return!0})}_querySimple(e,t){return t.functions.length?this._cached(this._cacheQuerySimple,t,[e.scope,e.pierceShadow,e.originalScope],()=>{let n=t.css,i=t.functions;n==="*"&&i.length&&(n=void 0);let s,o=-1;n!==void 0?s=this._queryCSS(e,n):(o=i.findIndex(a=>this._getEngine(a.name).query!==void 0),o===-1&&(o=0),s=this._queryEngine(this._getEngine(i[o].name),e,i[o].args));for(let a=0;a<i.length;a++){if(a===o)continue;let l=this._getEngine(i[a].name);l.matches!==void 0&&(s=s.filter(c=>this._matchesEngine(l,c,i[a].args,e)))}for(let a=0;a<i.length;a++){if(a===o)continue;let l=this._getEngine(i[a].name);l.matches===void 0&&(s=s.filter(c=>this._matchesEngine(l,c,i[a].args,e)))}return s}):this._queryCSS(e,t.css||"*")}_matchesParents(e,t,n,i){return n<0?!0:this._cached(this._cacheMatchesParents,e,[t,n,i.scope,i.pierceShadow,i.originalScope],()=>{let{selector:s,combinator:o}=t.simples[n];if(o===">"){let a=Zt(e,i);return!a||!this._matchesSimple(a,s,i)?!1:this._matchesParents(a,t,n-1,i)}if(o==="+"){let a=Vr(e,i);return!a||!this._matchesSimple(a,s,i)?!1:this._matchesParents(a,t,n-1,i)}if(o===""){let a=Zt(e,i);for(;a;){if(this._matchesSimple(a,s,i)){if(this._matchesParents(a,t,n-1,i))return!0;if(t.simples[n-1].combinator==="")break}a=Zt(a,i)}return!1}if(o==="~"){let a=Vr(e,i);for(;a;){if(this._matchesSimple(a,s,i)){if(this._matchesParents(a,t,n-1,i))return!0;if(t.simples[n-1].combinator==="~")break}a=Vr(a,i)}return!1}if(o===">="){let a=e;for(;a;){if(this._matchesSimple(a,s,i)){if(this._matchesParents(a,t,n-1,i))return!0;if(t.simples[n-1].combinator==="")break}a=Zt(a,i)}return!1}throw new Error(`Unsupported combinator "${o}"`)})}_matchesEngine(e,t,n,i){if(e.matches)return this._callMatches(e,t,n,i);if(e.query)return this._callQuery(e,n,i).includes(t);throw new Error(\'Selector engine should implement "matches" or "query"\')}_queryEngine(e,t,n){if(e.query)return this._callQuery(e,n,t);if(e.matches)return this._queryCSS(t,"*").filter(i=>this._callMatches(e,i,n,t));throw new Error(\'Selector engine should implement "matches" or "query"\')}_callMatches(e,t,n,i){return this._cached(this._cacheCallMatches,t,[e,i.scope,i.pierceShadow,i.originalScope,...n],()=>e.matches(t,n,i,this))}_callQuery(e,t,n){return this._cached(this._cacheCallQuery,e,[n.scope,n.pierceShadow,n.originalScope,...t],()=>e.query(n,t,this))}_matchesCSS(e,t){return e.matches(t)}_queryCSS(e,t){return this._cached(this._cacheQueryCSS,t,[e.scope,e.pierceShadow,e.originalScope],()=>{let n=[];function i(s){if(n=n.concat([...s.querySelectorAll(t)]),!!e.pierceShadow){s.shadowRoot&&i(s.shadowRoot);for(let o of s.querySelectorAll("*"))o.shadowRoot&&i(o.shadowRoot)}}return i(e.scope),n})}_getEngine(e){let t=this._engines.get(e);if(!t)throw new Error(`Unknown selector engine "${e}"`);return t}},Mt={matches(r,e,t,n){if(e.length===0)throw new Error(\'"is" engine expects non-empty selector list\');return e.some(i=>n.matches(r,i,t))},query(r,e,t){if(e.length===0)throw new Error(\'"is" engine expects non-empty selector list\');let n=[];for(let i of e)n=n.concat(t.query(r,i));return e.length===1?n:zr(n)}},Ds={matches(r,e,t,n){if(e.length===0)throw new Error(\'"has" engine expects non-empty selector list\');return n.query({...t,scope:r},e).length>0}},Hs={matches(r,e,t,n){if(e.length!==0)throw new Error(\'"scope" engine expects no arguments\');let i=t.originalScope||t.scope;return i.nodeType===9?r===i.documentElement:r===i},query(r,e,t){if(e.length!==0)throw new Error(\'"scope" engine expects no arguments\');let n=r.originalScope||r.scope;if(n.nodeType===9){let i=n.documentElement;return i?[i]:[]}return n.nodeType===1?[n]:[]}},qs={matches(r,e,t,n){if(e.length===0)throw new Error(\'"not" engine expects non-empty selector list\');return!n.matches(r,e,t)}},Bs={query(r,e,t){return t.query({...r,pierceShadow:!1},e)},matches(r,e,t,n){return n.matches(r,e,{...t,pierceShadow:!1})}},Fs={matches(r,e,t,n){if(e.length)throw new Error(\'"visible" engine expects no arguments\');return W(r)}},Us={matches(r,e,t,n){if(e.length!==1||typeof e[0]!="string")throw new Error(\'"text" engine expects a single string\');let i=v(e[0]).toLowerCase(),s=o=>o.normalized.toLowerCase().includes(i);return $e(n._cacheText,r,s)==="self"}},js={matches(r,e,t,n){if(e.length!==1||typeof e[0]!="string")throw new Error(\'"text-is" engine expects a single string\');let i=v(e[0]),s=o=>!i&&!o.immediate.length?!0:o.immediate.some(a=>v(a)===i);return $e(n._cacheText,r,s)!=="none"}},Ws={matches(r,e,t,n){if(e.length===0||typeof e[0]!="string"||e.length>2||e.length===2&&typeof e[1]!="string")throw new Error(\'"text-matches" engine expects a regexp body and optional regexp flags\');let i=new RegExp(e[0],e.length===2?e[1]:void 0),s=o=>i.test(o.full);return $e(n._cacheText,r,s)==="self"}},Vs={matches(r,e,t,n){if(e.length!==1||typeof e[0]!="string")throw new Error(\'"has-text" engine expects a single string\');if(Xt(r))return!1;let i=v(e[0]).toLowerCase();return(o=>o.normalized.toLowerCase().includes(i))(P(n._cacheText,r))}};function It(r){return{matches(e,t,n,i){let s=t.length&&typeof t[t.length-1]=="number"?t[t.length-1]:void 0,o=s===void 0?t:t.slice(0,t.length-1);if(t.length<1+(s===void 0?0:1))throw new Error(`"${r}" engine expects a selector list and optional maximum distance in pixels`);let a=i.query(n,o),l=Yt(r,e,a,s);return l===void 0?!1:(i._markScore(e,l),!0)}}}var zs={query(r,e,t){let n=e[e.length-1];if(e.length<2)throw new Error(\'"nth-match" engine expects non-empty selector list and an index argument\');if(typeof n!="number"||n<1)throw new Error(\'"nth-match" engine expects a one-based index as the last argument\');let i=Mt.query(r,e.slice(0,e.length-1),t);return n--,n<i.length?[i[n]]:[]}};function Zt(r,e){if(r!==e.scope)return e.pierceShadow?I(r):r.parentElement||void 0}function Vr(r,e){if(r!==e.scope)return r.previousElementSibling||void 0}function zr(r){let e=new Map,t=[],n=[];function i(o){let a=e.get(o);if(a)return a;let l=I(o);return l?i(l).children.push(o):t.push(o),a={children:[],taken:!1},e.set(o,a),a}for(let o of r)i(o).taken=!0;function s(o){let a=e.get(o);if(a.taken&&n.push(o),a.children.length>1){let l=new Set(a.children);a.children=[];let c=o.firstElementChild;for(;c&&a.children.length<l.size;)l.has(c)&&a.children.push(c),c=c.nextElementSibling;for(c=o.shadowRoot?o.shadowRoot.firstElementChild:null;c&&a.children.length<l.size;)l.has(c)&&a.children.push(c),c=c.nextElementSibling}a.children.forEach(s)}return t.forEach(s),n}var mi=10,He=mi/2,fi=1,Qs=2,Gs=10,Js=50,Jr=100,bi=120,xi=140,Ei=160,rr=180,Si=200,pi=250,Ys=bi+He,Xs=xi+He,gi=Jr+He,Ks=Ei+He,Zs=rr+He,eo=Si+He,to=300,ro=500,Yr=510,Qr=520,yi=530,Xr=1e4,no=1e7,io=1e3;function Zr(r,e,t){var i;r._evaluator.begin();let n={allowText:new Map,disallowText:new Map};le(),Re();try{let s=[];if(t.forTextExpect){let l=Ot(r,e.ownerDocument.documentElement,t);for(let c=e;c;c=I(c)){let p=we(n,r,c,{...t,noText:!0});if(!p)continue;if(ve(p)<=io){l=p;break}}s=[nr(l)]}else{if(!e.matches("input,textarea,select")&&!e.isContentEditable){let l=xe(e,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",t.root);l&&W(l)&&(e=l)}if(t.multiple){let l=we(n,r,e,t),c=we(n,r,e,{...t,noText:!0}),p=[l,c];if(n.allowText.clear(),n.disallowText.clear(),l&&Gr(l)&&p.push(we(n,r,e,{...t,noCSSId:!0})),c&&Gr(c)&&p.push(we(n,r,e,{...t,noText:!0,noCSSId:!0})),p=p.filter(Boolean),!p.length){let d=Ot(r,e,t);p.push(d),Gr(d)&&p.push(Ot(r,e,{...t,noCSSId:!0}))}s=[...new Set(p.map(d=>nr(d)))]}else{let l=we(n,r,e,t)||Ot(r,e,t);s=[nr(l)]}}let o=s[0],a=r.parseSelector(o);return{selector:o,selectors:s,elements:r.querySelectorAll(a,(i=t.root)!=null?i:e.ownerDocument)}}finally{Le(),ce(),r._evaluator.end()}}function we(r,e,t,n){var a;if(n.root&&!pt(n.root,t))throw new Error("Target element must belong to the root\'s subtree");if(t===n.root)return[{engine:"css",selector:":scope",score:1}];if(t.ownerDocument.documentElement===t)return[{engine:"css",selector:"html",score:1}];let i=null,s=l=>{(!i||ve(l)<ve(i))&&(i=l)},o=[];if(!n.noText)for(let l of oo(e,t,!n.isRecursive))o.push({candidate:l,isTextCandidate:!0});for(let l of so(e,t,n))n.omitInternalEngines&&l.engine.startsWith("internal:")||o.push({candidate:[l],isTextCandidate:!1});o.sort((l,c)=>ve(l.candidate)-ve(c.candidate));for(let{candidate:l,isTextCandidate:c}of o){let p=e.querySelectorAll(e.parseSelector(nr(l)),(a=n.root)!=null?a:t.ownerDocument);if(!p.includes(t))continue;if(p.length===1){s(l);break}let d=p.indexOf(t);if(!(d>5)&&(s([...l,{engine:"nth",selector:String(d),score:Xr}]),!n.isRecursive))for(let u=I(t);u&&u!==n.root;u=I(u)){let f=p.filter(D=>pt(u,D)&&D!==u),h=f.indexOf(t);if(f.length>5||h===-1||h===d&&f.length>1)continue;let g=f.length===1?l:[...l,{engine:"nth",selector:String(h),score:Xr}];if(i&&ve([{engine:"",selector:"",score:1},...g])>=ve(i))continue;let S=!!n.noText||c,E=S?r.disallowText:r.allowText,y=E.get(u);y===void 0&&(y=we(r,e,u,{...n,isRecursive:!0,noText:S})||Ot(e,u,n),E.set(u,y)),y&&s([...y,...g])}}return i}function so(r,e,t){let n=[],i=Bt(t.testIdAttributeName);{for(let a of["data-testid","data-test-id","data-test"])!i.includes(a)&&e.getAttribute(a)&&n.push({engine:"css",selector:`[${a}=${be(e.getAttribute(a))}]`,score:Qs});if(!t.noCSSId){let a=e.getAttribute("id");a&&!ao(a)&&n.push({engine:"css",selector:wi(a),score:ro})}n.push({engine:"css",selector:te(e),score:yi})}if(e.nodeName==="IFRAME"){for(let a of["name","title"])e.getAttribute(a)&&n.push({engine:"css",selector:`${te(e)}[${a}=${be(e.getAttribute(a))}]`,score:Gs});for(let a of i)e.getAttribute(a)&&n.push({engine:"css",selector:`[${a}=${be(e.getAttribute(a))}]`,score:fi});return Kr([n]),n}for(let a of i)e.getAttribute(a)&&n.push({engine:"internal:testid",selector:`[${a}=${L(e.getAttribute(a),!0)}]`,score:fi});if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){let a=e;if(a.placeholder){n.push({engine:"internal:attr",selector:`[placeholder=${L(a.placeholder,!0)}]`,score:Ys});for(let l of Te(a.placeholder))n.push({engine:"internal:attr",selector:`[placeholder=${L(l.text,!1)}]`,score:bi-l.scoreBonus})}}let s=Kt(r._evaluator._cacheText,e);for(let a of s){let l=a.normalized;n.push({engine:"internal:label",selector:q(l,!0),score:Xs});for(let c of Te(l))n.push({engine:"internal:label",selector:q(c.text,!1),score:xi-c.scoreBonus})}let o=k(e);return o&&!["none","presentation"].includes(o)&&n.push({engine:"internal:role",selector:o,score:Yr}),e.getAttribute("name")&&["BUTTON","FORM","FIELDSET","FRAME","IFRAME","INPUT","KEYGEN","OBJECT","OUTPUT","SELECT","TEXTAREA","MAP","META","PARAM"].includes(e.nodeName)&&n.push({engine:"css",selector:`${te(e)}[name=${be(e.getAttribute("name"))}]`,score:Qr}),["INPUT","TEXTAREA"].includes(e.nodeName)&&e.getAttribute("type")!=="hidden"&&e.getAttribute("type")&&n.push({engine:"css",selector:`${te(e)}[type=${be(e.getAttribute("type"))}]`,score:Qr}),["INPUT","TEXTAREA","SELECT"].includes(e.nodeName)&&e.getAttribute("type")!=="hidden"&&n.push({engine:"css",selector:te(e),score:Qr+1}),Kr([n]),n}function oo(r,e,t){if(e.nodeName==="SELECT")return[];let n=[],i=e.getAttribute("title");if(i){n.push([{engine:"internal:attr",selector:`[title=${L(i,!0)}]`,score:eo}]);for(let c of Te(i))n.push([{engine:"internal:attr",selector:`[title=${L(c.text,!1)}]`,score:Si-c.scoreBonus}])}let s=e.getAttribute("alt");if(s&&["APPLET","AREA","IMG","INPUT"].includes(e.nodeName)){n.push([{engine:"internal:attr",selector:`[alt=${L(s,!0)}]`,score:Ks}]);for(let c of Te(s))n.push([{engine:"internal:attr",selector:`[alt=${L(c.text,!1)}]`,score:Ei-c.scoreBonus}])}let o=P(r._evaluator._cacheText,e).normalized,a=o?Te(o):[];if(o){if(t){o.length<=80&&n.push([{engine:"internal:text",selector:q(o,!0),score:Zs}]);for(let p of a)n.push([{engine:"internal:text",selector:q(p.text,!1),score:rr-p.scoreBonus}])}let c={engine:"css",selector:te(e),score:yi};for(let p of a)n.push([c,{engine:"internal:has-text",selector:q(p.text,!1),score:rr-p.scoreBonus}]);if(t&&o.length<=80){let p=new RegExp("^"+ke(o)+"$");n.push([c,{engine:"internal:has-text",selector:q(p,!1),score:pi}])}}let l=k(e);if(l&&!["none","presentation"].includes(l)){let c=ee(e,!1);if(c&&!c.match(/^\\p{Co}+$/u)){let p={engine:"internal:role",selector:`${l}[name=${L(c,!0)}]`,score:gi};n.push([p]);for(let u of Te(c))n.push([{engine:"internal:role",selector:`${l}[name=${L(u.text,!1)}]`,score:Jr-u.scoreBonus}]);let d=ae(e,!1);if(d){n.push([{engine:"internal:role",selector:`${l}[name=${L(c,!0)}][description=${L(d,!0)}]`,score:gi+1}]);for(let u of Te(c))n.push([{engine:"internal:role",selector:`${l}[name=${L(u.text,!1)}][description=${L(d,!1)}]`,score:Jr-u.scoreBonus+1}])}}else{let p={engine:"internal:role",selector:`${l}`,score:Yr},d=ae(e,!1);d&&n.push([{engine:"internal:role",selector:`${l}[description=${L(d,!0)}]`,score:Yr+1}]);for(let u of a)n.push([p,{engine:"internal:has-text",selector:q(u.text,!1),score:rr-u.scoreBonus}]);if(t&&o.length<=80){let u=new RegExp("^"+ke(o)+"$");n.push([p,{engine:"internal:has-text",selector:q(u,!1),score:pi}])}}}return Kr(n),n}function wi(r){return/^[a-zA-Z][a-zA-Z0-9\\-\\_]+$/.test(r)?"#"+r:`[id=${be(r)}]`}function Gr(r){return r.some(e=>e.engine==="css"&&(e.selector.startsWith("#")||e.selector.startsWith(\'[id="\')))}function Ot(r,e,t){var a;let n=(a=t.root)!=null?a:e.ownerDocument,i=[];function s(l){let c=i.slice();l&&c.unshift(l);let p=c.join(" > "),d=r.parseSelector(p);return r.querySelector(d,n,!1)===e?p:void 0}function o(l){let c={engine:"css",selector:l,score:no},p=r.parseSelector(l),d=r.querySelectorAll(p,n);if(d.length===1)return[c];let u={engine:"nth",selector:String(d.indexOf(e)),score:Xr};return[c,u]}for(let l=e;l&&l!==n;l=I(l)){let c="";if(l.id&&!t.noCSSId){let u=wi(l.id),f=s(u);if(f)return o(f);c=u}let p=l.parentNode,d=[...l.classList].map(lo);for(let u=0;u<d.length;++u){let f="."+d.slice(0,u+1).join("."),h=s(f);if(h)return o(h);!c&&p&&p.querySelectorAll(f).length===1&&(c=f)}if(p){let u=[...p.children],f=l.nodeName,g=u.filter(S=>S.nodeName===f).indexOf(l)===0?te(l):`${te(l)}:nth-child(${1+u.indexOf(l)})`,m=s(g);if(m)return o(m);c||(c=g)}else c||(c=te(l));i.unshift(c)}return o(s())}function Kr(r){for(let e of r)for(let t of e)t.score>Js&&t.score<to&&(t.score+=Math.min(mi,t.selector.length/10|0))}function nr(r){let e=[],t="";for(let{engine:n,selector:i}of r)e.length&&(t!=="css"||n!=="css"||i.startsWith(":nth-match("))&&e.push(">>"),t=n,n==="css"?e.push(i):e.push(`${n}=${i}`);return e.join(" ")}function ve(r){let e=0;for(let t=0;t<r.length;t++)e+=r[t].score*(r.length-t);return e}function ao(r){let e,t=0;for(let n=0;n<r.length;++n){let i=r[n],s;if(!(i==="-"||i==="_")){if(i>="a"&&i<="z"?s="lower":i>="A"&&i<="Z"?s="upper":i>="0"&&i<="9"?s="digit":s="other",s==="lower"&&e==="upper"){e=s;continue}e&&e!==s&&++t,e=s}}return t>=r.length/4}function tr(r,e){if(r.length<=e)return r;r=r.substring(0,e);let t=r.match(/^(.*)\\b(.+?)$/);return t?t[1].trimEnd():""}function Te(r){let e=[];{let t=r.match(/^([\\d.,]+)[^.,\\w]/),n=t?t[1].length:0;if(n){let i=tr(r.substring(n).trimStart(),80);e.push({text:i,scoreBonus:i.length<=30?2:1})}}{let t=r.match(/[^.,\\w]([\\d.,]+)$/),n=t?t[1].length:0;if(n){let i=tr(r.substring(0,r.length-n).trimEnd(),80);e.push({text:i,scoreBonus:i.length<=30?2:1})}}return r.length<=30?e.push({text:r,scoreBonus:0}):(e.push({text:tr(r,80),scoreBonus:0}),e.push({text:tr(r,30),scoreBonus:1})),e=e.filter(t=>t.text),e.length||e.push({text:r.substring(0,80),scoreBonus:0}),e}function te(r){return r.nodeName.toLocaleLowerCase().replace(/[:\\.]/g,e=>"\\\\"+e)}function lo(r){let e="";for(let t=0;t<r.length;t++)e+=co(r,t);return e}function co(r,e){let t=r.charCodeAt(e);return t===0?"\\uFFFD":t>=1&&t<=31||t>=48&&t<=57&&(e===0||e===1&&r.charCodeAt(0)===45)?"\\\\"+t.toString(16)+" ":e===0&&t===45&&r.length===1?"\\\\"+r.charAt(e):t>=128||t===45||t===95||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?r.charAt(e):"\\\\"+r.charAt(e)}var en={queryAll(r,e){e.startsWith("/")&&r.nodeType!==Node.DOCUMENT_NODE&&(e="."+e);let t=[],n=r.ownerDocument||r;if(!n)return t;let i=n.evaluate(e,r,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE);for(let s=i.iterateNext();s;s=i.iterateNext())s.nodeType===Node.ELEMENT_NODE&&t.push(s);return t}};var qe=Symbol("selector"),Be=class Be{constructor(e,t,n){if(n!=null&&n.hasText&&(t+=` >> internal:has-text=${q(n.hasText,!1)}`),n!=null&&n.hasNotText&&(t+=` >> internal:has-not-text=${q(n.hasNotText,!1)}`),n!=null&&n.has&&(t+=" >> internal:has="+JSON.stringify(n.has[qe])),n!=null&&n.hasNot&&(t+=" >> internal:has-not="+JSON.stringify(n.hasNot[qe])),(n==null?void 0:n.visible)!==void 0&&(t+=` >> visible=${n.visible?"true":"false"}`),this[qe]=t,t){let o=e.parseSelector(t);this.element=e.querySelector(o,e.document,!1),this.elements=e.querySelectorAll(o,e.document)}let i=t,s=this;s.locator=(o,a)=>new Be(e,i?i+" >> "+o:o,a),s.getByTestId=o=>s.locator(Sn(e.testIdAttributeNameForStrictErrorAndConsoleCodegen(),o)),s.getByAltText=(o,a)=>s.locator(wn(o,a)),s.getByLabel=(o,a)=>s.locator(yn(o,a)),s.getByPlaceholder=(o,a)=>s.locator(Tn(o,a)),s.getByText=(o,a)=>s.locator(An(o,a)),s.getByTitle=(o,a)=>s.locator(vn(o,a)),s.getByRole=(o,a={})=>s.locator(_n(o,a)),s.filter=o=>new Be(e,t,o),s.first=()=>s.locator("nth=0"),s.last=()=>s.locator("nth=-1"),s.nth=o=>s.locator(`nth=${o}`),s.and=o=>new Be(e,i+" >> internal:and="+JSON.stringify(o[qe])),s.or=o=>new Be(e,i+" >> internal:or="+JSON.stringify(o[qe]))}},tn=Be,ir=class{constructor(e){this._injectedScript=e}install(){this._injectedScript.window.playwright||(this._injectedScript.window.playwright={$:(e,t)=>this._querySelector(e,!!t),$$:e=>this._querySelectorAll(e),inspect:e=>this._inspect(e),selector:e=>this._selector(e),generateLocator:(e,t)=>this._generateLocator(e,t),ariaSnapshot:(e,t)=>this._injectedScript.ariaSnapshot(e||this._injectedScript.document.body,t||{mode:"default"}),resume:()=>this._resume(),...new tn(this._injectedScript,"")},delete this._injectedScript.window.playwright.filter,delete this._injectedScript.window.playwright.first,delete this._injectedScript.window.playwright.last,delete this._injectedScript.window.playwright.nth,delete this._injectedScript.window.playwright.and,delete this._injectedScript.window.playwright.or)}_querySelector(e,t){if(typeof e!="string")throw new Error("Usage: playwright.query(\'Playwright >> selector\').");let n=this._injectedScript.parseSelector(e);return this._injectedScript.querySelector(n,this._injectedScript.document,t)}_querySelectorAll(e){if(typeof e!="string")throw new Error("Usage: playwright.$$(\'Playwright >> selector\').");let t=this._injectedScript.parseSelector(e);return this._injectedScript.querySelectorAll(t,this._injectedScript.document)}_inspect(e){if(typeof e!="string")throw new Error("Usage: playwright.inspect(\'Playwright >> selector\').");this._injectedScript.window.inspect(this._querySelector(e,!1))}_selector(e){if(!(e instanceof Element))throw new Error("Usage: playwright.selector(element).");return this._injectedScript.generateSelectorSimple(e)}_generateLocator(e,t){if(!(e instanceof Element))throw new Error("Usage: playwright.locator(element).");let n=this._injectedScript.generateSelectorSimple(e);return K(t||"javascript",n)}_resume(){if(!this._injectedScript.window.__pw_resume)return!1;this._injectedScript.window.__pw_resume().catch(()=>{})}};function uo(r){try{return r instanceof RegExp||Object.prototype.toString.call(r)==="[object RegExp]"}catch{return!1}}function ho(r){try{return r instanceof Date||Object.prototype.toString.call(r)==="[object Date]"}catch{return!1}}function fo(r){try{return r instanceof URL||Object.prototype.toString.call(r)==="[object URL]"}catch{return!1}}function po(r){var e;try{return r instanceof Error||r&&((e=Object.getPrototypeOf(r))==null?void 0:e.name)==="Error"}catch{return!1}}function go(r,e){try{return r instanceof e||Object.prototype.toString.call(r)===`[object ${e.name}]`}catch{return!1}}function mo(r){try{return r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]"}catch{return!1}}var Ai={i8:Int8Array,ui8:Uint8Array,ui8c:Uint8ClampedArray,i16:Int16Array,ui16:Uint16Array,i32:Int32Array,ui32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:BigInt64Array,bui64:BigUint64Array};function vi(r){if("toBase64"in r)return r.toBase64();let e=Array.from(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(t=>String.fromCharCode(t)).join("");return btoa(e)}function Ti(r,e){let t=atob(r),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new e(n.buffer)}function sr(r,e=[],t=new Map){if(!Object.is(r,void 0)){if(typeof r=="object"&&r){if("ref"in r)return t.get(r.ref);if("v"in r)return r.v==="undefined"?void 0:r.v==="null"?null:r.v==="NaN"?NaN:r.v==="Infinity"?1/0:r.v==="-Infinity"?-1/0:r.v==="-0"?-0:void 0;if("d"in r)return new Date(r.d);if("u"in r)return new URL(r.u);if("bi"in r)return BigInt(r.bi);if("e"in r){let n=new Error(r.e.m);return n.name=r.e.n,n.stack=r.e.s,n}if("r"in r)return new RegExp(r.r.p,r.r.f);if("a"in r){let n=[];t.set(r.id,n);for(let i of r.a)n.push(sr(i,e,t));return n}if("o"in r){let n={};t.set(r.id,n);for(let{k:i,v:s}of r.o)i!=="__proto__"&&(n[i]=sr(s,e,t));return n}if("h"in r)return e[r.h];if("ta"in r)return Ti(r.ta.b,Ai[r.ta.k]);if("ab"in r)return Ti(r.ab.b,Uint8Array).buffer}return r}}function _i(r,e){return rn(r,e,{visited:new Map,lastId:0})}function rn(r,e,t){if(r&&typeof r=="object"){if(typeof globalThis.Window=="function"&&r instanceof globalThis.Window)return"ref: <Window>";if(typeof globalThis.Document=="function"&&r instanceof globalThis.Document)return"ref: <Document>";if(typeof globalThis.Node=="function"&&r instanceof globalThis.Node)return"ref: <Node>"}return Ci(r,e,t)}function Ci(r,e,t){var s;let n=e(r);if("fallThrough"in n)r=n.fallThrough;else return n;if(typeof r=="symbol")return{v:"undefined"};if(Object.is(r,void 0))return{v:"undefined"};if(Object.is(r,null))return{v:"null"};if(Object.is(r,NaN))return{v:"NaN"};if(Object.is(r,1/0))return{v:"Infinity"};if(Object.is(r,-1/0))return{v:"-Infinity"};if(Object.is(r,-0))return{v:"-0"};if(typeof r=="boolean"||typeof r=="number"||typeof r=="string")return r;if(typeof r=="bigint")return{bi:r.toString()};if(po(r)){let o;return(s=r.stack)!=null&&s.startsWith(r.name+": "+r.message)?o=r.stack:o=`${r.name}: ${r.message}\n${r.stack}`,{e:{n:r.name,m:r.message,s:o}}}if(ho(r))return{d:r.toJSON()};if(fo(r))return{u:r.toJSON()};if(uo(r))return{r:{p:r.source,f:r.flags}};for(let[o,a]of Object.entries(Ai))if(go(r,a))return{ta:{b:vi(r),k:o}};if(mo(r))return{ab:{b:vi(new Uint8Array(r))}};let i=t.visited.get(r);if(i)return{ref:i};if(Array.isArray(r)){let o=[],a=++t.lastId;t.visited.set(r,a);for(let l=0;l<r.length;++l)o.push(rn(r[l],e,t));return{a:o,id:a}}if(typeof r=="object"){let o=[],a=++t.lastId;t.visited.set(r,a);for(let c of Object.keys(r)){let p;try{p=r[c]}catch{continue}c==="toJSON"&&typeof p=="function"?o.push({k:c,v:{o:[],id:0}}):o.push({k:c,v:rn(p,e,t)})}let l;try{o.length===0&&r.toJSON&&typeof r.toJSON=="function"&&(l={value:r.toJSON()})}catch{}return l?Ci(l.value,e,t):{o,id:a}}}var or=class{constructor(e,t){var n,i,s,o,a,l,c,p;this.global=e,this.isUnderTest=t,e.__pwClock?this.builtins=e.__pwClock.builtins:this.builtins={setTimeout:(n=e.setTimeout)==null?void 0:n.bind(e),clearTimeout:(i=e.clearTimeout)==null?void 0:i.bind(e),setInterval:(s=e.setInterval)==null?void 0:s.bind(e),clearInterval:(o=e.clearInterval)==null?void 0:o.bind(e),requestAnimationFrame:(a=e.requestAnimationFrame)==null?void 0:a.bind(e),cancelAnimationFrame:(l=e.cancelAnimationFrame)==null?void 0:l.bind(e),requestIdleCallback:(c=e.requestIdleCallback)==null?void 0:c.bind(e),cancelIdleCallback:(p=e.cancelIdleCallback)==null?void 0:p.bind(e),performance:e.performance,Intl:e.Intl,Date:e.Date,AbortSignal:e.AbortSignal},this.isUnderTest&&(e.builtins=this.builtins)}evaluate(e,t,n,i,...s){let o=s.slice(0,i),a=s.slice(i),l=[];for(let p=0;p<o.length;p++)l[p]=sr(o[p],a);let c=this.global.eval(n);return e===!0?c=c(...l):e===!1?c=c:typeof c=="function"&&(c=c(...l)),t?this._promiseAwareJsonValueNoThrow(c):c}jsonValue(e,t){if(t!==void 0)return _i(t,n=>({fallThrough:n}))}_promiseAwareJsonValueNoThrow(e){let t=n=>{try{return this.jsonValue(!0,n)}catch{return}};return e&&typeof e=="object"&&typeof e.then=="function"?(async()=>{let n=await e;return t(n)})():t(e)}};var nn=class{constructor(e,t){this._testIdAttributeNameForStrictErrorAndConsoleCodegen="data-testid";this._lastAriaSnapshotForTrack=new Map;this.utils={asLocator:K,cacheNormalizedWhitespaces:bn,elementText:P,getAriaRole:k,getElementAccessibleDescription:ae,getElementAccessibleName:ee,isElementVisible:W,isInsideScope:pt,normalizeWhiteSpace:v,parseAriaSnapshot:ln,generateAriaTree:ye,findNewElement:ci,builtins:null};this.window=e,this.document=e.document,this.isUnderTest=t.isUnderTest,this.utils.builtins=new or(e,t.isUnderTest).builtins,this._sdkLanguage=t.sdkLanguage,this._testIdAttributeNameForStrictErrorAndConsoleCodegen=t.testIdAttributeName,this._evaluator=new er,this.consoleApi=new ir(this),this.onGlobalListenersRemoved=new Set,this._autoClosingTags=new Set(["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","MENUITEM","META","PARAM","SOURCE","TRACK","WBR"]),this._booleanAttributes=new Set(["checked","selected","disabled","readonly","multiple"]),this._eventTypes=new Map([["auxclick","mouse"],["click","mouse"],["dblclick","mouse"],["mousedown","mouse"],["mouseeenter","mouse"],["mouseleave","mouse"],["mousemove","mouse"],["mouseout","mouse"],["mouseover","mouse"],["mouseup","mouse"],["mouseleave","mouse"],["mousewheel","mouse"],["keydown","keyboard"],["keyup","keyboard"],["keypress","keyboard"],["textInput","keyboard"],["touchstart","touch"],["touchmove","touch"],["touchend","touch"],["touchcancel","touch"],["pointerover","pointer"],["pointerout","pointer"],["pointerenter","pointer"],["pointerleave","pointer"],["pointerdown","pointer"],["pointerup","pointer"],["pointermove","pointer"],["pointercancel","pointer"],["gotpointercapture","pointer"],["lostpointercapture","pointer"],["focus","focus"],["blur","focus"],["drag","drag"],["dragstart","drag"],["dragend","drag"],["dragover","drag"],["dragenter","drag"],["dragleave","drag"],["dragexit","drag"],["drop","drag"],["wheel","wheel"],["deviceorientation","deviceorientation"],["deviceorientationabsolute","deviceorientation"],["devicemotion","devicemotion"]]),this._hoverHitTargetInterceptorEvents=new Set(["mousemove"]),this._tapHitTargetInterceptorEvents=new Set(["pointerdown","pointerup","touchstart","touchend","touchcancel"]),this._mouseHitTargetInterceptorEvents=new Set(["mousedown","mouseup","pointerdown","pointerup","click","auxclick","dblclick","contextmenu"]),this._allHitTargetInterceptorEvents=new Set([...this._hoverHitTargetInterceptorEvents,...this._tapHitTargetInterceptorEvents,...this._mouseHitTargetInterceptorEvents]),this._engines=new Map,this._engines.set("xpath",en),this._engines.set("xpath:light",en),this._engines.set("role",Wr(!1)),this._engines.set("text",this._createTextEngine(!0,!1)),this._engines.set("text:light",this._createTextEngine(!1,!1)),this._engines.set("id",this._createAttributeEngine("id",!0)),this._engines.set("id:light",this._createAttributeEngine("id",!1)),this._engines.set("data-testid",this._createAttributeEngine("data-testid",!0)),this._engines.set("data-testid:light",this._createAttributeEngine("data-testid",!1)),this._engines.set("data-test-id",this._createAttributeEngine("data-test-id",!0)),this._engines.set("data-test-id:light",this._createAttributeEngine("data-test-id",!1)),this._engines.set("data-test",this._createAttributeEngine("data-test",!0)),this._engines.set("data-test:light",this._createAttributeEngine("data-test",!1)),this._engines.set("css",this._createCSSEngine()),this._engines.set("nth",{queryAll:()=>[]}),this._engines.set("visible",this._createVisibleEngine()),this._engines.set("internal:control",this._createControlEngine()),this._engines.set("internal:has",this._createHasEngine()),this._engines.set("internal:has-not",this._createHasNotEngine()),this._engines.set("internal:and",{queryAll:()=>[]}),this._engines.set("internal:or",{queryAll:()=>[]}),this._engines.set("internal:chain",this._createInternalChainEngine()),this._engines.set("internal:label",this._createInternalLabelEngine()),this._engines.set("internal:text",this._createTextEngine(!0,!0)),this._engines.set("internal:has-text",this._createInternalHasTextEngine()),this._engines.set("internal:has-not-text",this._createInternalHasNotTextEngine()),this._engines.set("internal:attr",this._createNamedAttributeEngine()),this._engines.set("internal:testid",this._createTestIdEngine()),this._engines.set("internal:role",Wr(!0)),this._engines.set("internal:describe",this._createDescribeEngine()),this._engines.set("aria-ref",this._createAriaRefEngine());for(let{name:n,source:i}of t.customEngines)this._engines.set(n,this.eval(i));this._stableRafCount=t.stableRafCount,this._browserName=t.browserName,this._shouldPrependErrorPrefix=!!t.shouldPrependErrorPrefix,this._isUtilityWorld=!!t.isUtilityWorld,Rn({browserNameForWorkarounds:t.browserName}),this._setupGlobalListenersRemovalDetection(),this._setupHitTargetInterceptors(),this.isUnderTest&&(this.window.__injectedScript=this)}eval(e){return this.window.eval(e)}testIdAttributeNameForStrictErrorAndConsoleCodegen(){return this._testIdAttributeNameForStrictErrorAndConsoleCodegen}parseSelector(e){let t=ot(e);return mn(t,n=>{if(!this._engines.has(n.name))throw this.createStacklessError(`Unknown engine "${n.name}" while parsing selector ${e}`)}),t}generateSelector(e,t){return Zr(this,e,t)}generateSelectorSimple(e,t){return Zr(this,e,{...t,testIdAttributeName:this._testIdAttributeNameForStrictErrorAndConsoleCodegen}).selector}querySelector(e,t,n){let i=this.querySelectorAll(e,t);if(n&&i.length>1)throw this.strictModeViolationError(e,i);return this.checkDeprecatedSelectorUsage(e,i),i[0]}_queryNth(e,t){let n=[...e],i=+t.body;return i===-1&&(i=n.length-1),new Set(n.slice(i,i+1))}_queryLayoutSelector(e,t,n){let i=t.name,s=t.body,o=[],a=this.querySelectorAll(s.parsed,n);for(let l of e){let c=Yt(i,l,a,s.distance);c!==void 0&&o.push({element:l,score:c})}return o.sort((l,c)=>l.score-c.score),new Set(o.map(l=>l.element))}ariaSnapshot(e,t){return this.incrementalAriaSnapshot(e,t).full}incrementalAriaSnapshot(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Can only capture aria snapshot of Element nodes.");let n=ye(e,t),i=Se(n,t),s;if(t.track){let o=this._lastAriaSnapshotForTrack.get(t.track);o&&(s=Se(n,t,o).text),this._lastAriaSnapshotForTrack.set(t.track,n)}return this._lastAriaSnapshotForQuery=n,{full:i.text,incremental:s,iframeRefs:n.iframeRefs,iframeDepths:i.iframeDepths}}ariaSnapshotForRecorder(){let e=ye(this.document.body,{mode:"ai"}),{text:t}=Se(e,{mode:"ai"});return{ariaSnapshot:t,refs:e.refs}}getAllElementsMatchingExpectAriaTemplate(e,t){return si(e.documentElement,t)}querySelectorAll(e,t){if(e.capture!==void 0){if(e.parts.some(i=>i.name==="nth"))throw this.createStacklessError("Can\'t query n-th element in a request with the capture.");let n={parts:e.parts.slice(0,e.capture+1)};if(e.capture<e.parts.length-1){let i={parts:e.parts.slice(e.capture+1)},s={name:"internal:has",body:{parsed:i},source:$(i)};n.parts.push(s)}return this.querySelectorAll(n,t)}if(!t.querySelectorAll)throw this.createStacklessError("Node is not queryable.");if(e.capture!==void 0)throw this.createStacklessError("Internal error: there should not be a capture in the selector.");if(t.nodeType===11&&e.parts.length===1&&e.parts[0].name==="css"&&e.parts[0].source===":scope")return[t];this._evaluator.begin();try{let n=new Set([t]);for(let i of e.parts)if(i.name==="nth")n=this._queryNth(n,i);else if(i.name==="internal:and"){let s=this.querySelectorAll(i.body.parsed,t);n=new Set(s.filter(o=>n.has(o)))}else if(i.name==="internal:or"){let s=this.querySelectorAll(i.body.parsed,t);n=new Set(zr(new Set([...n,...s])))}else if(di.includes(i.name))n=this._queryLayoutSelector(n,i,t);else{let s=new Set;for(let o of n){let a=this._queryEngineAll(i,o);for(let l of a)s.add(l)}n=s}return[...n]}finally{this._evaluator.end()}}_queryEngineAll(e,t){let n=this._engines.get(e.name).queryAll(t,e.body);for(let i of n)if(!("nodeName"in i))throw this.createStacklessError(`Expected a Node but got ${Object.prototype.toString.call(i)}`);return n}_createAttributeEngine(e,t){let n=i=>[{simples:[{selector:{css:`[${e}=${JSON.stringify(i)}]`,functions:[]},combinator:""}]}];return{queryAll:(i,s)=>this._evaluator.query({scope:i,pierceShadow:t},n(s))}}_createCSSEngine(){return{queryAll:(e,t)=>this._evaluator.query({scope:e,pierceShadow:!0},t)}}_createTextEngine(e,t){return{queryAll:(i,s)=>{let{matcher:o,kind:a}=lr(s,t),l=[],c=null,p=u=>{if(a==="lax"&&c&&c.contains(u))return!1;let f=$e(this._evaluator._cacheText,u,o);f==="none"&&(c=u),(f==="self"||f==="selfAndChildren"&&a==="strict"&&!t)&&l.push(u)};i.nodeType===Node.ELEMENT_NODE&&p(i);let d=this._evaluator._queryCSS({scope:i,pierceShadow:e},"*");for(let u of d)p(u);return l}}}_createInternalHasTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let n=e,i=P(this._evaluator._cacheText,n),{matcher:s}=lr(t,!0);return s(i)?[n]:[]}}}_createInternalHasNotTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let n=e,i=P(this._evaluator._cacheText,n),{matcher:s}=lr(t,!0);return s(i)?[]:[n]}}}_createInternalLabelEngine(){return{queryAll:(e,t)=>{let{matcher:n}=lr(t,!0);return this._evaluator._queryCSS({scope:e,pierceShadow:!0},"*").filter(s=>Kt(this._evaluator._cacheText,s).some(o=>n(o)))}}}_createNamedAttributeEngine(){return{queryAll:(t,n)=>{let i=X(n,!0);if(i.name||i.attributes.length!==1)throw new Error("Malformed attribute selector: "+n);let{name:s}=i.attributes[0],o=ki(i.attributes[0]);return this._evaluator._queryCSS({scope:t,pierceShadow:!0},`[${s}]`).filter(l=>o(l.getAttribute(s)))}}}_createTestIdEngine(){return{queryAll:(t,n)=>{let i=X(n,!0);if(i.name||i.attributes.length!==1)throw new Error("Malformed test id selector: "+n);let s=Bt(i.attributes[0].name),o=ki(i.attributes[0]),a=s.map(c=>`[${c}]`).join(",");return this._evaluator._queryCSS({scope:t,pierceShadow:!0},a).filter(c=>s.some(p=>{let d=c.getAttribute(p);return d!==null&&o(d)}))}}}_createDescribeEngine(){return{queryAll:t=>t.nodeType!==1?[]:[t]}}_createControlEngine(){return{queryAll(e,t){if(t==="enter-frame")return[];if(t==="return-empty")return[];if(t==="component")return e.nodeType!==1?[]:[e.childElementCount===1?e.firstElementChild:e];throw new Error(`Internal error, unknown internal:control selector ${t}`)}}}_createHasEngine(){return{queryAll:(t,n)=>t.nodeType!==1?[]:!!this.querySelector(n.parsed,t,!1)?[t]:[]}}_createHasNotEngine(){return{queryAll:(t,n)=>t.nodeType!==1?[]:!!this.querySelector(n.parsed,t,!1)?[]:[t]}}_createVisibleEngine(){return{queryAll:(t,n)=>{if(t.nodeType!==1)return[];let i=n==="true";return W(t)===i?[t]:[]}}}_createInternalChainEngine(){return{queryAll:(t,n)=>this.querySelectorAll(n.parsed,t)}}extend(e,t){let n=this.window.eval(`\n (() => {\n const module = {};\n ${e}\n return module.exports.default();\n })()`);return new n(this,t)}async viewportRatio(e){return await new Promise(t=>{let n=new IntersectionObserver(i=>{t(i[0].intersectionRatio),n.disconnect()});n.observe(e),this.utils.builtins.requestAnimationFrame(()=>{})})}getElementBorderWidth(e){if(e.nodeType!==Node.ELEMENT_NODE||!e.ownerDocument||!e.ownerDocument.defaultView)return{left:0,top:0};let t=e.ownerDocument.defaultView.getComputedStyle(e);return{left:parseInt(t.borderLeftWidth||"",10),top:parseInt(t.borderTopWidth||"",10)}}describeIFrameStyle(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return"error:notconnected";let t=e.ownerDocument.defaultView;for(let i=e;i;i=I(i))if(t.getComputedStyle(i).transform!=="none")return"transformed";let n=t.getComputedStyle(e);return{left:parseInt(n.borderLeftWidth||"",10)+parseInt(n.paddingLeft||"",10),top:parseInt(n.borderTopWidth||"",10)+parseInt(n.paddingTop||"",10)}}retarget(e,t){let n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(!n)return null;if(t==="none")return n;if(!n.matches("input, textarea, select")&&!n.isContentEditable&&(t==="button-link"?n=n.closest("button, [role=button], a, [role=link]")||n:n=n.closest("button, [role=button], [role=checkbox], [role=radio]")||n),t==="follow-label"&&!n.matches("a, input, textarea, button, select, [role=link], [role=button], [role=checkbox], [role=radio]")&&!n.isContentEditable){let i=n.closest("label");i&&i.control&&(n=i.control)}return n}async checkElementStates(e,t){if(t.includes("stable")){let n=await this._checkElementIsStable(e);if(n===!1)return{missingState:"stable"};if(n==="error:notconnected")return"error:notconnected"}for(let n of t)if(n!=="stable"){let i=this.elementState(e,n);if(i.received==="error:notconnected")return"error:notconnected";if(!i.matches)return{missingState:n}}}async _checkElementIsStable(e){let t=Symbol("continuePolling"),n,i=0,s=0,o=()=>{let d=this.retarget(e,"no-follow-label");if(!d)return"error:notconnected";let u=this.utils.builtins.performance.now();if(this._stableRafCount>1&&u-s<15)return t;s=u;let f=d.getBoundingClientRect(),h={x:f.top,y:f.left,width:f.width,height:f.height};if(n){if(!(h.x===n.x&&h.y===n.y&&h.width===n.width&&h.height===n.height))return!1;if(++i>=this._stableRafCount)return!0}return n=h,t},a,l,c=new Promise((d,u)=>{a=d,l=u}),p=()=>{try{let d=o();d!==t?a(d):this.utils.builtins.requestAnimationFrame(p)}catch(d){l(d)}};return this.utils.builtins.requestAnimationFrame(p),c}_createAriaRefEngine(){return{queryAll:(t,n)=>{var s,o;let i=(o=(s=this._lastAriaSnapshotForQuery)==null?void 0:s.elements)==null?void 0:o.get(n);return i&&i.isConnected?[i]:[]}}}elementState(e,t){let n=this.retarget(e,["visible","hidden"].includes(t)?"none":"follow-label");if(!n||!n.isConnected)return t==="hidden"?{matches:!0,received:"hidden"}:{matches:!1,received:"error:notconnected"};if(t==="visible"||t==="hidden"){let i=W(n);return{matches:t==="visible"?i:!i,received:i?"visible":"hidden"}}if(t==="disabled"||t==="enabled"){let i=Ee(n);return{matches:t==="disabled"?i:!i,received:i?"disabled":"enabled"}}if(t==="editable"){let i=Ee(n),s=Jn(n);if(s==="error")throw this.createStacklessError("Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]");return{matches:!i&&!s,received:i?"disabled":s?"readOnly":"editable"}}if(t==="checked"||t==="unchecked"){let i=t==="checked",s=Gn(n);if(s==="error")throw this.createStacklessError("Not a checkbox or radio button");let o=n.nodeName==="INPUT"&&n.type==="radio";return{matches:i===s,received:s?"checked":"unchecked",isRadio:o}}if(t==="indeterminate"){let i=Qn(n);if(i==="error")throw this.createStacklessError("Not a checkbox or radio button");return{matches:i==="mixed",received:i===!0?"checked":i===!1?"unchecked":"mixed"}}throw this.createStacklessError(`Unexpected element state "${t}"`)}selectOptions(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()!=="select")throw this.createStacklessError("Element is not a <select> element");let i=n,s=[...i.options],o=[],a=t.slice();for(let l=0;l<s.length;l++){let c=s[l],p=v(c.label),d=u=>{if(u instanceof Node)return c===u;let f=g=>g===c.label||v(g)===p,h=!0;return u.valueOrLabel!==void 0&&(h=h&&(u.valueOrLabel===c.value||f(u.valueOrLabel))),u.value!==void 0&&(h=h&&u.value===c.value),u.label!==void 0&&(h=h&&f(u.label)),u.index!==void 0&&(h=h&&u.index===l),h};if(a.some(d)){if(!this.elementState(c,"enabled").matches)return"error:optionnotenabled";if(o.push(c),i.multiple)a=a.filter(u=>!d(u));else{a=[];break}}}return a.length?"error:optionsnotfound":(i.value=void 0,o.forEach(l=>l.selected=!0),i.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),i.dispatchEvent(new Event("change",{bubbles:!0})),o.map(l=>l.value))}fill(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()==="input"){let i=n,s=i.type.toLowerCase(),o=new Set(["color","date","time","datetime-local","month","range","week"]);if(!new Set(["","email","number","password","search","tel","text","url"]).has(s)&&!o.has(s))throw this.createStacklessError(`Input of type "${s}" cannot be filled`);if(s==="number"&&(t=t.trim(),isNaN(Number(t))))throw this.createStacklessError("Cannot type text into input[type=number]");if(s==="color"&&(t=t.toLowerCase()),o.has(s)){if(t=t.trim(),i.focus(),i.value=t,i.value!==t)throw this.createStacklessError("Malformed value");return n.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),"done"}}else if(n.nodeName.toLowerCase()!=="textarea"){if(!n.isContentEditable)throw this.createStacklessError("Element is not an <input>, <textarea> or [contenteditable] element")}return this.selectText(n),"needsinput"}selectText(e){let t=this.retarget(e,"follow-label");if(!t)return"error:notconnected";if(t.nodeName.toLowerCase()==="input"){let s=t;return s.select(),s.focus(),"done"}if(t.nodeName.toLowerCase()==="textarea"){let s=t;return s.selectionStart=0,s.selectionEnd=s.value.length,s.focus(),"done"}t.focus();let n=t.ownerDocument.createRange();n.selectNodeContents(t);let i=t.ownerDocument.defaultView.getSelection();return i&&(i.removeAllRanges(),i.addRange(n)),"done"}_activelyFocused(e){let t=e.getRootNode().activeElement,n=t===e&&!!e.ownerDocument&&e.ownerDocument.hasFocus();return{activeElement:t,isFocused:n}}focusNode(e,t){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");let{activeElement:n,isFocused:i}=this._activelyFocused(e);if(e.isContentEditable&&!i&&n&&n.blur&&n.blur(),e.focus(),e.focus(),t&&!i&&e.nodeName.toLowerCase()==="input")try{e.setSelectionRange(0,0)}catch{}return"done"}blurNode(e){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");return e.blur(),"done"}setInputFiles(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"Node is not of type HTMLElement";let n=e;if(n.nodeName!=="INPUT")return"Not an <input> element";let i=n;if((i.getAttribute("type")||"").toLowerCase()!=="file")return"Not an input[type=file] element";let o=t.map(l=>{let c=Uint8Array.from(atob(l.buffer),p=>p.charCodeAt(0));return new File([c],l.name,{type:l.mimeType,lastModified:l.lastModifiedMs})}),a=new DataTransfer;for(let l of o)a.items.add(l);i.files=a.files,i.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),i.dispatchEvent(new Event("change",{bubbles:!0}))}expectHitTarget(e,t){var p;let n=[],i=t;for(;i;){let d=Ut(i);if(!d||(n.push(d),d.nodeType===9))break;i=d.host}let s;for(let d=n.length-1;d>=0;d--){let u=n[d],f=u.elementsFromPoint(e.x,e.y),h=u.elementFromPoint(e.x,e.y);if(h&&f[0]&&I(h)===f[0]){let m=this.window.getComputedStyle(h);(m==null?void 0:m.display)==="contents"&&f.unshift(h)}f[0]&&f[0].shadowRoot===u&&f[1]===h&&f.shift();let g=f[0];if(!g||(s=g,d&&g!==n[d-1].host))break}let o=[];for(;s&&s!==t;)o.push(s),s=(p=s.assignedSlot)!=null?p:I(s);if(s===t)return"done";let a=this.previewNode(o[0]||this.document.documentElement),l,c=t;for(;c;){let d=o.indexOf(c);if(d!==-1){d>1&&(l=this.previewNode(o[d-1]));break}c=I(c)}return l?{hitTargetDescription:`${a} from ${l} subtree`}:{hitTargetDescription:a}}setupHitTargetInterceptor(e,t,n,i){let s=this.retarget(e,"button-link");if(!s||!s.isConnected)return"error:notconnected";if(n){let p=this.expectHitTarget(n,s);if(p!=="done")return p.hitTargetDescription}if(t==="drag")return{stop:()=>"done"};let o={hover:this._hoverHitTargetInterceptorEvents,tap:this._tapHitTargetInterceptorEvents,mouse:this._mouseHitTargetInterceptorEvents}[t],a,l=p=>{if(!o.has(p.type)||!p.isTrusted&&!p.__pwTrustedSynthetic)return;let d=this.window.TouchEvent&&p instanceof this.window.TouchEvent?p.touches[0]:p;a===void 0&&d&&(a=this.expectHitTarget({x:d.clientX,y:d.clientY},s)),(i||a!=="done"&&a!==void 0)&&(p.preventDefault(),p.stopPropagation(),p.stopImmediatePropagation())},c=()=>(this._hitTargetInterceptor===l&&(this._hitTargetInterceptor=void 0),a||"done");return this._hitTargetInterceptor=l,{stop:c}}dispatchEvent(e,t,n){var o,a,l,c,p;let i,s={bubbles:!0,cancelable:!0,composed:!0,...n};switch(this._eventTypes.get(t)){case"mouse":i=new MouseEvent(t,s);break;case"keyboard":i=new KeyboardEvent(t,s);break;case"touch":{if(this._browserName==="webkit"){let d=f=>{var m,S,E;if(f instanceof Touch)return f;let h=f.pageX;h===void 0&&f.clientX!==void 0&&(h=f.clientX+(((m=this.document.scrollingElement)==null?void 0:m.scrollLeft)||0));let g=f.pageY;return g===void 0&&f.clientY!==void 0&&(g=f.clientY+(((S=this.document.scrollingElement)==null?void 0:S.scrollTop)||0)),this.document.createTouch(this.window,(E=f.target)!=null?E:e,f.identifier,h,g,f.screenX,f.screenY,f.radiusX,f.radiusY,f.rotationAngle,f.force)},u=f=>f instanceof TouchList||!f?f:this.document.createTouchList(...f.map(d));(o=s.target)!=null||(s.target=e),s.touches=u(s.touches),s.targetTouches=u(s.targetTouches),s.changedTouches=u(s.changedTouches),i=new TouchEvent(t,s)}else(a=s.target)!=null||(s.target=e),s.touches=(l=s.touches)==null?void 0:l.map(d=>{var u;return d instanceof Touch?d:new Touch({...d,target:(u=d.target)!=null?u:e})}),s.targetTouches=(c=s.targetTouches)==null?void 0:c.map(d=>{var u;return d instanceof Touch?d:new Touch({...d,target:(u=d.target)!=null?u:e})}),s.changedTouches=(p=s.changedTouches)==null?void 0:p.map(d=>{var u;return d instanceof Touch?d:new Touch({...d,target:(u=d.target)!=null?u:e})}),i=new TouchEvent(t,s);break}case"pointer":i=new PointerEvent(t,s);break;case"focus":i=new FocusEvent(t,s);break;case"drag":i=new DragEvent(t,s);break;case"wheel":i=new WheelEvent(t,s);break;case"deviceorientation":try{i=new DeviceOrientationEvent(t,s)}catch{let{bubbles:d,cancelable:u,alpha:f,beta:h,gamma:g,absolute:m}=s;i=this.document.createEvent("DeviceOrientationEvent"),i.initDeviceOrientationEvent(t,d,u,f,h,g,m)}break;case"devicemotion":try{i=new DeviceMotionEvent(t,s)}catch{let{bubbles:d,cancelable:u,acceleration:f,accelerationIncludingGravity:h,rotationRate:g,interval:m}=s;i=this.document.createEvent("DeviceMotionEvent"),i.initDeviceMotionEvent(t,d,u,f,h,g,m)}break;default:i=new Event(t,s);break}e.dispatchEvent(i)}previewNode(e){if(e.nodeType===Node.TEXT_NODE)return ar(`#text=${e.nodeValue||""}`);if(e.nodeType!==Node.ELEMENT_NODE)return ar(`<${e.nodeName.toLowerCase()} />`);let t=e,n=[];for(let l=0;l<t.attributes.length;l++){let{name:c,value:p}=t.attributes[l];c!=="style"&&(!p&&this._booleanAttributes.has(c)?n.push(` ${c}`):n.push(` ${c}="${p}"`))}n.sort((l,c)=>l.length-c.length);let i=vr(n.join(""),500);if(this._autoClosingTags.has(t.nodeName))return ar(`<${t.nodeName.toLowerCase()}${i}/>`);let s=t.childNodes,o=!1;if(s.length<=5){o=!0;for(let l=0;l<s.length;l++)o=o&&s[l].nodeType===Node.TEXT_NODE}let a=o?t.textContent||"":s.length?"\\u2026":"";return ar(`<${t.nodeName.toLowerCase()}${i}>${vr(a,50)}</${t.nodeName.toLowerCase()}>`)}_generateSelectors(e){this._evaluator.begin(),le(),Re();try{let t=this._isUtilityWorld&&this._browserName==="firefox"?2:10;return e.slice(0,t).map(i=>({preview:this.previewNode(i),selector:this.generateSelectorSimple(i)})).map((i,s)=>`${s+1}) ${i.preview} aka ${K(this._sdkLanguage,i.selector)}`)}finally{Le(),ce(),this._evaluator.end()}}strictModeViolationError(e,t){let n=this._generateSelectors(t).map(i=>`\n `+i);return n.length<t.length&&n.push(`\n ...`),this.createStacklessError(`strict mode violation: ${K(this._sdkLanguage,$(e))} resolved to ${t.length} elements:${n.join("")}\n`)}checkDeprecatedSelectorUsage(e,t){let n=new Set(["_react","_vue","xpath:light","text:light","id:light","data-testid:light","data-test-id:light","data-test:light"]);if(!t.length)return;let i=e.parts.find(o=>n.has(o.name));if(!i)return;let s=this._generateSelectors(t).map(o=>`\n `+o);throw s.length<t.length&&s.push(`\n ...`),this.createStacklessError(`"${i.name}" selector is not supported: ${K(this._sdkLanguage,$(e))} resolved to ${t.length} element${t.length===1?"":"s"}:${s.join("")}\n`)}createStacklessError(e){let t=this._shouldPrependErrorPrefix?new Error("Error: "+e):new Error(e);return this._browserName==="firefox"?(t.stack="",t):(delete t.stack,t)}createHighlight(){return new Oe(this)}maskSelectors(e,t){let n=this._createHighlight(),i=[];for(let s of e)i.push(this.querySelectorAll(s,this.document.documentElement));n.maskElements(i.flat(),t)}_createHighlight(){return this._highlight&&this.hideHighlight(),this._highlight=new Oe(this),this._highlight.install(),this._highlight}_ensureHighlight(){return this._highlight||(this._highlight=new Oe(this),this._highlight.install()),this._highlight}addHighlight(e,t){this._ensureHighlight().addElementHighlight(e,t)}removeHighlight(e){this._ensureHighlight().removeElementHighlight(e)}setScreencastAnnotation(e){var i;let t=this._ensureHighlight();if(!e){t.updateHighlight([]),t.hideActionPoint(),t.hideActionTitle(),t.hideActionCursor();return}let n=(i=e.duration)!=null?i:500;e.box&&t.updateHighlight([{box:e.box,color:"rgba(0, 128, 255, 0.15)",borderColor:"rgba(0, 128, 255, 0.6)",fadeDuration:n}]),e.point&&(e.cursor!=="none"&&t.moveActionCursor(e.point.x,e.point.y,n),t.showActionPoint(e.point.x,e.point.y,n)),e.actionTitle&&t.showActionTitle(e.actionTitle,n,e.position,e.fontSize)}addUserOverlay(e,t){this._ensureHighlight().addUserOverlay(e,t)}getUserOverlay(e){return this._ensureHighlight().getUserOverlay(e)}removeUserOverlay(e){this._ensureHighlight().removeUserOverlay(e)}setUserOverlaysVisible(e){this._ensureHighlight().setUserOverlaysVisible(e)}hideHighlight(){this._highlight&&(this._highlight.uninstall(),delete this._highlight)}markTargetElements(e){let t=new CustomEvent("__playwright_reset_targets__",{bubbles:!0,cancelable:!0,composed:!0});this.document.dispatchEvent(t);let n=new CustomEvent("__playwright_mark_target__",{bubbles:!0,cancelable:!0,composed:!0});for(let i of e)i.dispatchEvent(n)}_setupGlobalListenersRemovalDetection(){let e="__playwright_global_listeners_check__",t=!1,n=()=>t=!0;this.window.addEventListener(e,n),new MutationObserver(i=>{if(i.some(o=>Array.from(o.addedNodes).includes(this.document.documentElement))&&(t=!1,this.window.dispatchEvent(new CustomEvent(e)),!t)){this.window.addEventListener(e,n);for(let o of this.onGlobalListenersRemoved)o()}}).observe(this.document,{childList:!0})}_setupHitTargetInterceptors(){let e=n=>{var i;return(i=this._hitTargetInterceptor)==null?void 0:i.call(this,n)},t=()=>{for(let n of this._allHitTargetInterceptorEvents)this.window.addEventListener(n,e,{capture:!0,passive:!1})};t(),this.onGlobalListenersRemoved.add(t)}async expect(e,t,n){let i=await this._expectCore(e,t,n),s=this._ariaSnapshotForExpect(e,t);return i.received===void 0&&s===void 0?{matches:i.matches,missingReceived:i.missingReceived}:{matches:i.matches,received:{value:i.received,ariaSnapshot:s},missingReceived:i.missingReceived}}_ariaSnapshotForExpect(e,t){let n=t.expression;if(!(n==="to.have.count"||n.endsWith(".array"))&&n!=="to.match.aria"){if(e&&W(e)){let i=n==="to.have.text";return this._renderAriaSnapshot(e,{mode:"default",depth:i?void 0:1})}if(this.document.body)return this._renderAriaSnapshot(this.document.body,{mode:"default"})}}_renderAriaSnapshot(e,t){return Se(ye(e,t),t).text}async _expectCore(e,t,n){var s,o;if(t.expression==="to.have.count"||t.expression.endsWith(".array"))return this.expectArray(n,t);if(!e){if(!t.isNot&&t.expression==="to.be.hidden")return{matches:!0};if(t.isNot&&t.expression==="to.be.visible")return{matches:!1};if(!t.isNot&&t.expression==="to.be.detached")return{matches:!0};if(t.isNot&&t.expression==="to.be.attached")return{matches:!1};if(t.isNot&&t.expression==="to.be.in.viewport")return{matches:!1};if(t.expression==="to.have.title"&&((s=t==null?void 0:t.expectedText)!=null&&s[0])){let a=new ue(t.expectedText[0]),l=this.document.title;return{received:l,matches:a.matches(l)}}if(t.expression==="to.have.url"&&((o=t==null?void 0:t.expectedText)!=null&&o[0])){let a=new ue(t.expectedText[0]),l=this.document.location.href;return{received:l,matches:a.matches(l)}}if(t.expression==="to.match.aria"&&!t.selector){if(!this.document.body)return{matches:t.isNot,missingReceived:!0};let a=Br(this.document.body,t.expectedValue);return{received:a.received,matches:!!a.matches.length}}return{matches:t.isNot,missingReceived:!0}}return await this.expectSingleElement(e,t)}async expectSingleElement(e,t){var i,s;let n=t.expression;{let o;if(n==="to.have.attribute"){let a=e.hasAttribute(t.expressionArg);o={matches:a,received:a?"attribute present":"attribute not present"}}else if(n==="to.be.checked"){let{checked:a,indeterminate:l}=t.expectedValue;if(l){if(a!==void 0)throw this.createStacklessError("Can\'t assert indeterminate and checked at the same time");o=this.elementState(e,"indeterminate")}else o=this.elementState(e,a===!1?"unchecked":"checked")}else if(n==="to.be.disabled")o=this.elementState(e,"disabled");else if(n==="to.be.editable")o=this.elementState(e,"editable");else if(n==="to.be.readonly")o=this.elementState(e,"editable"),o.matches=!o.matches;else if(n==="to.be.empty")if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){let a=e.value;o={matches:!a,received:a?"notEmpty":"empty"}}else{let a=(i=e.textContent)==null?void 0:i.trim();o={matches:!a,received:a?"notEmpty":"empty"}}else if(n==="to.be.enabled")o=this.elementState(e,"enabled");else if(n==="to.be.focused"){let a=this._activelyFocused(e).isFocused;o={matches:a,received:a?"focused":"inactive"}}else n==="to.be.hidden"?o=this.elementState(e,"hidden"):n==="to.be.visible"?o=this.elementState(e,"visible"):n==="to.be.attached"?o={matches:!0,received:"attached"}:n==="to.be.detached"&&(o={matches:!1,received:"attached"});if(o){if(o.received==="error:notconnected")throw this.createStacklessError("Element is not connected");return o}}if(n==="to.have.property"){let o=e,a=t.expressionArg.split(".");for(let p=0;p<a.length-1;p++){if(typeof o!="object"||!(a[p]in o))return{received:void 0,matches:!1};o=o[a[p]]}let l=o[a[a.length-1]],c=sn(l,t.expectedValue);return{received:l,matches:c}}if(n==="to.be.in.viewport"){let o=await this.viewportRatio(e);return{received:`viewport ratio ${o}`,matches:o>0&&o>((s=t.expectedNumber)!=null?s:0)-1e-9}}if(n==="to.have.values"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="SELECT"||!e.multiple)throw this.createStacklessError("Not a select element with a multiple attribute");let o=[...e.selectedOptions].map(a=>a.value);return o.length!==t.expectedText.length?{received:o,matches:!1}:{received:o,matches:o.map((a,l)=>new ue(t.expectedText[l]).matches(a)).every(Boolean)}}if(n==="to.match.aria"){let o=Br(e,t.expectedValue);return{received:o.received,matches:!!o.matches.length}}{let o;if(n==="to.have.attribute.value"){let a=e.getAttribute(t.expressionArg);if(a===null)return{received:null,matches:!1};o=a}else if(["to.have.class","to.contain.class"].includes(n)){if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);return{received:e.classList.toString(),matches:new ue(t.expectedText[0]).matchesClassList(this,e.classList,n==="to.contain.class")}}else if(n==="to.have.css")o=this.window.getComputedStyle(e,t.pseudo?`::${t.pseudo}`:void 0).getPropertyValue(t.expressionArg);else if(n==="to.have.id")o=e.id;else if(n==="to.have.text")o=t.useInnerText?e.innerText:P(new Map,e).full;else if(n==="to.have.accessible.name")o=ee(e,!1);else if(n==="to.have.accessible.description")o=ae(e,!1);else if(n==="to.have.accessible.error.message")o=zn(e);else if(n==="to.have.role")o=k(e)||"";else if(n==="to.have.value"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"&&e.nodeName!=="SELECT")throw this.createStacklessError("Not an input element");o=e.value}if(o!==void 0&&t.expectedText){let a=new ue(t.expectedText[0]);return{received:o,matches:a.matches(o)}}}throw this.createStacklessError("Unknown expect matcher: "+n)}expectArray(e,t){let n=t.expression;if(n==="to.have.count"){let l=e.length,c=l===t.expectedNumber;return{received:l,matches:c}}if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);if(["to.have.class.array","to.contain.class.array"].includes(n)){let l=e.map(d=>d.classList),c=l.map(String);if(l.length!==t.expectedText.length)return{received:c,matches:!1};let p=this._matchSequentially(t.expectedText,l,(d,u)=>d.matchesClassList(this,u,n==="to.contain.class.array"));return{received:c,matches:p}}if(!["to.contain.text.array","to.have.text.array"].includes(n))throw this.createStacklessError("Unknown expect matcher: "+n);let i=e.map(l=>t.useInnerText?l.innerText:P(new Map,l).full),s=n!=="to.contain.text.array";if(!(i.length===t.expectedText.length||!s))return{received:i,matches:!1};let a=this._matchSequentially(t.expectedText,i,(l,c)=>l.matches(c));return{received:i,matches:a}}_matchSequentially(e,t,n){let i=e.map(a=>new ue(a)),s=0,o=0;for(;s<i.length&&o<t.length;)n(i[s],t[o])&&++s,++o;return s===i.length}};function ar(r){return r.replace(/\\n/g,"\\u21B5").replace(/\\t/g,"\\u21C6")}function ki(r){let{value:e,caseSensitive:t}=r;if(e instanceof RegExp)return i=>!!i.match(e);if(t)return i=>i===e;let n=e.toLowerCase();return i=>i.toLowerCase().includes(n)}function bo(r){if(r=r.substring(1,r.length-1),!r.includes("\\\\"))return r;let e=[],t=0;for(;t<r.length;)r[t]==="\\\\"&&t+1<r.length&&t++,e.push(r[t++]);return e.join("")}function lr(r,e){if(r[0]==="/"&&r.lastIndexOf("/")>0){let i=r.lastIndexOf("/"),s=new RegExp(r.substring(1,i),r.substring(i+1));return{matcher:o=>s.test(o.full),kind:"regex"}}let t=e?JSON.parse.bind(JSON):bo,n=!1;return r.length>1&&r[0]===\'"\'&&r[r.length-1]===\'"\'?(r=t(r),n=!0):e&&r.length>1&&r[0]===\'"\'&&r[r.length-2]===\'"\'&&r[r.length-1]==="i"?(r=t(r.substring(0,r.length-1)),n=!1):e&&r.length>1&&r[0]===\'"\'&&r[r.length-2]===\'"\'&&r[r.length-1]==="s"?(r=t(r.substring(0,r.length-1)),n=!0):r.length>1&&r[0]==="\'"&&r[r.length-1]==="\'"&&(r=t(r),n=!0),r=v(r),n?e?{kind:"strict",matcher:s=>s.normalized===r}:{matcher:s=>!r&&!s.immediate.length?!0:s.immediate.some(o=>v(o)===r),kind:"strict"}:(r=r.toLowerCase(),{kind:"lax",matcher:i=>i.normalized.toLowerCase().includes(r)})}var ue=class{constructor(e){if(this._normalizeWhiteSpace=e.normalizeWhiteSpace,this._ignoreCase=e.ignoreCase,this._string=e.matchSubstring?void 0:this.normalize(e.string),this._substring=e.matchSubstring?this.normalize(e.string):void 0,e.regexSource){let t=new Set((e.regexFlags||"").split(""));e.ignoreCase===!1&&t.delete("i"),e.ignoreCase===!0&&t.add("i"),this._regex=new RegExp(e.regexSource,[...t].join(""))}}matches(e){return this._regex||(e=this.normalize(e)),this._string!==void 0?e===this._string:this._substring!==void 0?e.includes(this._substring):this._regex?!!this._regex.test(e):!1}matchesClassList(e,t,n){if(n){if(this._regex)throw e.createStacklessError("Partial matching does not support regular expressions. Please provide a string value.");return this._string.split(/\\s+/g).filter(Boolean).every(i=>t.contains(i))}return this.matches(t.toString())}normalize(e){return e&&(this._normalizeWhiteSpace&&(e=v(e)),this._ignoreCase&&(e=e.toLocaleLowerCase()),e)}};function sn(r,e){if(r===e)return!0;if(r&&e&&typeof r=="object"&&typeof e=="object"){if(r.constructor!==e.constructor)return!1;if(Array.isArray(r)){if(r.length!==e.length)return!1;for(let n=0;n<r.length;++n)if(!sn(r[n],e[n]))return!1;return!0}if(r instanceof RegExp)return r.source===e.source&&r.flags===e.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===e.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===e.toString();let t=Object.keys(r);if(t.length!==Object.keys(e).length)return!1;for(let n=0;n<t.length;++n)if(!e.hasOwnProperty(t[n]))return!1;for(let n of t)if(!sn(r[n],e[n]))return!1;return!0}return typeof r=="number"&&typeof e=="number"?isNaN(r)&&isNaN(e):!1}return qi(xo);})();\n';var Sh={block:"center",inline:"nearest"},dj=[Sh,{block:"end",inline:"end"},{block:"start",inline:"start"}],Bc=class e{constructor(t,r){this.cdp=t;this.cua=r;t.addListener("tabDetached",n=>{for(let o of this.playwrightInjectedTargets)(o===String(n)||o.startsWith(`${n}:`))&&this.playwrightInjectedTargets.delete(o)})}cdp;cua;playwrightInjectedTargets=new Set;static injectedConstant="__codexPlaywrightInjected";async resolvePlaywrightSelector(t,r){if(!Number.isFinite(t))throw new Error("resolvePlaywrightSelector requires numeric tab_id");if(!await this.evaluateWithPlaywrightInjected(t,`(() => {
${Fc}
const injected = window.${e.injectedConstant};
const parsed = injected.parseSelector(${JSON.stringify(r)});
const element = querySelectorStrictWithVisibleFallback(injected, parsed, document);
if (!element) {
return false;
}
element.setAttribute("data-codex-playwright-match", "1");
return true;
})()`,{telemetryAttrs:xr({operation:on("resolve_selector"),phase:"selector_eval"})}))throw new Error(`No element found for locator: ${r}`);try{return await this.resolveCssSelector(t,"[data-codex-playwright-match='1']")}finally{await this.cdp.call(t,"Runtime.evaluate",{expression:`(() => {
const element = document.querySelector("[data-codex-playwright-match='1']");
if (element) {
element.removeAttribute("data-codex-playwright-match");
}
})()`,returnByValue:!0},{telemetryAttrs:xr({operation:on("resolve_selector"),phase:"css_marker_cleanup"})})}}async evaluateOnPlaywrightSelector(t,r,n,o={}){return(await this.evaluateOnPlaywrightSelectorWithTarget(t,r,n,o)).result}async evaluateOnPlaywrightSelectorWithTarget(t,r,n,o={}){let i=se({timeout_ms:o.timeoutMs}),s=Date.now(),a=n.toString();for(;;)try{return await this.evaluateSingleSelectorWithTarget(X1(t),r,a,o.arg,{timeoutMs:i,telemetryAttrs:xr({operation:on("locator"),phase:"selector_eval"})})}catch(u){if(Z1(u))throw u;if(Date.now()-s>=i){let l=u instanceof Error?u.message:String(u);throw new Error(`Timed out after ${i}ms waiting for selector ${r}: ${l}`,{cause:u})}await new Promise(l=>setTimeout(l,100))}}async evaluateOnPlaywrightSelectorAll(t,r,n,o={}){let i=se({timeout_ms:o.timeoutMs}),s=Date.now(),a=n.toString();for(;;)try{return await this.evaluateSelectorAllInTarget(X1(t),r,a,o.arg,{timeoutMs:i,telemetryAttrs:xr({operation:on("locator"),phase:"selector_all_eval"})})}catch(u){if(Z1(u))throw u;if(Date.now()-s>=i){let l=u instanceof Error?u.message:String(u);throw new Error(`Timed out after ${i}ms waiting for selector ${r}: ${l}`,{cause:u})}await new Promise(l=>setTimeout(l,100))}}async evaluateOnPlaywrightPage(t,r,n={}){let o=r.toString();return await this.evaluateWithPlaywrightInjected(t,`(async () => {
const injected = window.${e.injectedConstant};
return await (${o})(injected, ${xh(n.arg)});
})()`,{telemetryAttrs:xr({operation:on("page"),phase:"page_eval"}),timeoutMs:n.timeoutMs})}async clickLocator(t,r){let n=k(t.tab_id),o=se(t),i=m1("button"in t?t.button:void 0),s=sn("modifiers"in t?t.modifiers:void 0),a="force"in t?t.force===!0:!1;await this.performPointerAction(t,{actionName:r===1?"click":"dblclick",dispatch:async u=>{await this.cua.clickPoint({button:i,clickCount:r,...Wa(u.target)?{loadTarget:u.target}:{},modifiers:s,point:u.point,tabId:n,timeoutMs:o})},force:a,requiredStates:a?[]:["visible","enabled"],timeoutMs:o})}async focusLocator(t,r){let n=["visible","enabled"];r.requireEditable&&n.push("editable");let{target:o}=await this.evaluateOnPlaywrightSelectorWithTarget(t.tab_id,t.selector,(i,s,a)=>{for(let d of a.states){let p=s.elementState(i,d);if(p.received==="error:notconnected")throw new Error("Element is not connected");if(!p.matches)throw new Error("Element is not "+d)}let u=a.retargetInput?s.retarget(i,"follow-label"):i;if(u==null)throw new Error("Element is not connected");i.scrollIntoView({block:"center",inline:"nearest"});let l=a.selectText?s.selectText(u):s.focusNode(u,!1);if(l!=="done")throw new Error(String(l));return a.iabInputTargetToken!=null&&Object.defineProperty(u,"__codexIabInputTargetToken",{configurable:!0,value:a.iabInputTargetToken,writable:!0}),!0},{arg:{iabInputTargetToken:r.iabInputTargetToken,retargetInput:r.requireEditable||r.selectText===!0,selectText:r.selectText===!0,states:n},timeoutMs:t.timeout_ms});return o}async readCheckedState(t){return await this.evaluateOnPlaywrightSelector(t.tab_id,t.selector,(r,n)=>{let o=n.elementState(r,"checked");if(o.received==="error:notconnected")throw new Error("Element is not connected");return{checked:!!o.matches,isRadio:!!o.isRadio}},{timeoutMs:t.timeout_ms})}async readElementState(t,r){return await this.evaluateOnPlaywrightSelectorAll(t.tab_id,t.selector,(n,o,i)=>{let s=n[0]??null;if(!s)return!1;let a=o.elementState(s,i.stateName);return a.received==="error:notconnected"?!1:!!a.matches},{arg:{stateName:r},timeoutMs:t.timeout_ms})}async performPointerAction(t,r){let n=r.force?[Sh]:dj,o=null;for(let i of n){let s=await this.resolvePointerActionTarget(t,{requiredStates:r.requiredStates,scrollAlignment:i});if(o=r.force?null:await this.obstructingFrameHitTarget(s,{timeoutMs:r.timeoutMs}),o==null){await r.dispatch(s);return}}throw new Error(`Element does not receive pointer events at the ${r.actionName} point; ${o??"another element"} intercepts the ${r.actionName}`)}async resolvePointerActionTarget(t,r){let n=await this.evaluateOnPlaywrightSelectorWithTarget(t.tab_id,t.selector,async(i,s,a,u)=>{let l={async waitForAnimationFrame(){await new Promise(f=>{let m=i.ownerDocument?.defaultView;if(typeof m?.requestAnimationFrame=="function"){m.requestAnimationFrame(()=>f());return}if(typeof setTimeout=="function"){setTimeout(f,0);return}f()})},sameRect(f,m){return f.left===m.left&&f.top===m.top&&f.width===m.width&&f.height===m.height},async waitForStableBoundingRect(){let f=i.getBoundingClientRect(),m=0;for(let h=0;h<10;h+=1){await l.waitForAnimationFrame();let y=i.getBoundingClientRect();if(l.sameRect(f,y)){if(m+=1,f=y,m>=2)break;continue}m=0,f=y}return f}};for(let f of a.requiredStates){let m=s.elementState(i,f);if(m.received==="error:notconnected")throw new Error("Element is not connected");if(!m.matches)throw new Error("Element is not "+f)}i.scrollIntoView({block:a.scrollAlignment.block,inline:a.scrollAlignment.inline,behavior:"instant"});let d=await l.waitForStableBoundingRect();for(let f of a.requiredStates){let m=s.elementState(i,f);if(m.received==="error:notconnected")throw new Error("Element is not connected");if(!m.matches)throw new Error("Element is not "+f)}let p=u.prepareFrameChainForPointerAction(a.scrollAlignment);if(!d||d.width<=0||d.height<=0)throw new Error("Element does not have a clickable bounding box");return{x:Math.max(0,p.left+d.left+d.width/2),y:Math.max(0,p.top+d.top+d.height/2)}},{arg:{requiredStates:r.requiredStates,scrollAlignment:r.scrollAlignment??Sh},timeoutMs:t.timeout_ms}),o=await this.currentTopLevelPointForAction(n.result,n.pointerOffset,n.oopifFrameChain,{timeoutMs:t.timeout_ms});return{frameBoundaries:o.frameBoundaries,point:o.point,target:n.target}}async currentTopLevelPointForAction(t,r,n,o={}){if(!n?.length||r==null)return{frameBoundaries:[],point:t};let i={x:t.x-r.x,y:t.y-r.y};try{let s=i,a=[];for(let u of n.slice().reverse()){let l=await this.currentFrameContentOffset(u,o);s={x:l.point.x+s.x,y:l.point.y+s.y},a.push({frame:u,ownerBackendNodeId:l.backendNodeId,point:s})}return{frameBoundaries:a,point:s}}catch{return{frameBoundaries:[],point:t}}}async currentFrameContentOffset(t,r={}){if(t.frameId==null)throw new Error("Cannot recompute OOPIF frame offset without a frame id");let{backendNodeId:n}=await this.callCdpTarget(t.parentTarget,"DOM.getFrameOwner",{frameId:t.frameId},r),{quads:o}=await this.callCdpTarget(t.parentTarget,"DOM.getContentQuads",{backendNodeId:n},r),i=o[0];if(i==null||i.length<8)throw new Error("Frame owner does not have content quads");return{backendNodeId:n,point:{x:i[0]??0,y:i[1]??0}}}async obstructingFrameHitTarget(t,r={}){for(let n of t.frameBoundaries.slice().reverse()){let o=await this.obstructingFrameBoundaryHitTarget(n,r);if(o!=null)return o}return null}async obstructingFrameBoundaryHitTarget(t,r={}){try{let n=await this.callCdpTarget(t.frame.parentTarget,"DOM.getNodeForLocation",{x:Math.round(t.point.x),y:Math.round(t.point.y),includeUserAgentShadowDOM:!0},{timeoutMs:r.timeoutMs,telemetryAttrs:xr({operation:on("locator"),phase:"hit_target_check"})});return n.backendNodeId===t.ownerBackendNodeId?null:await this.describeBackendNodeForHitTarget(t.frame.parentTarget,n.backendNodeId,r)}catch{return null}}async describeBackendNodeForHitTarget(t,r,n={}){try{let{node:o}=await this.callCdpTarget(t,"DOM.describeNode",{backendNodeId:r},n),i=o.localName||o.nodeName?.toLowerCase()||"unknown",s=Array.isArray(o.attributes)?o.attributes:[],a=ek(s,"id"),u=ek(s,"class");return`<${i}${a?`#${a}`:""}${u?`.${u.trim().split(/\s+/).slice(0,3).join(".")}`:""}>`}catch{return"another element"}}async resolveCssSelector(t,r){let{root:n}=await this.callCdpTarget({tabId:t},"DOM.getDocument",{depth:-1,pierce:!0}),{nodeId:o}=await this.callCdpTarget({tabId:t},"DOM.querySelector",{nodeId:n.nodeId,selector:r});if(!o)throw new Error(`No element found for locator: ${r}`);let{node:i}=await this.callCdpTarget({tabId:t},"DOM.describeNode",{nodeId:o});return i.backendNodeId}async evaluateSingleSelectorWithTarget(t,r,n,o,i={}){let s=await this.resolveSelectorTarget(t,r,i);return{result:await this.evaluateSingleSelectorInResolvedTarget(s,n,o,i),oopifFrameChain:s.oopifFrameChain,pointerOffset:s.pointerOffset,target:s.target}}async evaluateSingleSelectorInResolvedTarget(t,r,n,o={}){return await this.evaluateWithPlaywrightInjectedInTarget(t.target,`(async () => {
${Fc}
${e.selectorScopeFunctions()}
const outerFrameOffset = ${JSON.stringify(t.pointerOffset)};
const initialInjected = window.${e.injectedConstant};
const parsed = initialInjected.parseSelector(${JSON.stringify(t.selector)});
const scope = applyOuterFrameOffset(
selectorScopeFor(initialInjected, parsed),
outerFrameOffset
);
const element = scope
? querySelectorStrictWithVisibleFallback(scope.injected, scope.parsed, scope.root)
: null;
if (!element) throw new Error("No element matched selector");
return await (${r})(element, scope.injected, ${xh(n)}, scope);
})()`,o)}async evaluateSelectorAllInTarget(t,r,n,o,i={}){let s=await this.resolveSelectorTarget(t,r,i);return await this.evaluateWithPlaywrightInjectedInTarget(s.target,`(async () => {
${Fc}
${e.selectorScopeFunctions()}
const outerFrameOffset = ${JSON.stringify(s.pointerOffset)};
const initialInjected = window.${e.injectedConstant};
const parsed = initialInjected.parseSelector(${JSON.stringify(s.selector)});
const scope = applyOuterFrameOffset(
selectorScopeFor(initialInjected, parsed),
outerFrameOffset
);
const elements = scope
? scope.injected.querySelectorAll(scope.parsed, scope.root)
: [];
const scopedInjected = scope ? scope.injected : initialInjected;
return await (${n})(elements, scopedInjected, ${xh(o)});
})()`,i)}async resolveSelectorTarget(t,r,n={}){let o=t,i=r;for(;;){let s=await this.frameRouteForFirstOopif(o,i,n);if(s==null)return{oopifFrameChain:o.oopifFrameChain,pointerOffset:o.pointerOffset,selector:i,target:o.target};o=s,i=s.selector}}async frameRouteForFirstOopif(t,r,n={}){if(!r.includes(vh)||!gj(this.cdp))return null;await this.cdp.enableOopifAutoAttach(t.target.tabId,n);let o=`codex-${Date.now()}-${Math.random().toString(16).slice(2)}`,i;try{i=await this.evaluateWithPlaywrightInjectedInTarget(t.target,`(() => {
${Fc}
${e.selectorScopeFunctions()}
const initialInjected = window.${e.injectedConstant};
const parsedSelector = initialInjected.parseSelector(${JSON.stringify(r)});
let currentRoot = document;
let currentInjected = initialInjected;
let enterFrameCount = 0;
let partStart = 0;
let x = 0;
let y = 0;
while (true) {
const enterFrameIndex = parsedSelector.parts.findIndex(
(part, index) =>
index >= partStart &&
part.name === "internal:control" &&
part.body === "enter-frame"
);
if (enterFrameIndex === -1) return { matched: false };
const frameSelector = sliceParsedSelector(
parsedSelector,
partStart,
enterFrameIndex
);
const frameElement = querySelectorStrictWithVisibleFallback(
currentInjected,
frameSelector,
currentRoot
);
if (!frameElement) return { matched: false };
const tagName = String(frameElement.localName || frameElement.tagName || "").toLowerCase();
if (tagName !== "iframe" && tagName !== "frame") {
throw new Error("internal:control=enter-frame must target a frame element");
}
frameElement.scrollIntoView({
block: "center",
inline: "nearest",
behavior: "instant",
});
const rect = frameElement.getBoundingClientRect();
if (!rect || rect.width <= 0 || rect.height <= 0) {
throw new Error("Frame does not have an actionable bounding box");
}
const frameStyle = currentInjected.describeIFrameStyle(frameElement);
if (frameStyle === "error:notconnected") {
throw new Error("Frame is not connected");
}
if (frameStyle === "transformed") {
throw new Error(
"Cannot compute a reliable click point through a transformed iframe chain"
);
}
x += rect.left + frameStyle.left;
y += rect.top + frameStyle.top;
enterFrameCount += 1;
let frameWindow;
let frameDocument;
try {
frameWindow = frameElement.contentWindow;
frameDocument = frameElement.contentDocument || frameWindow?.document;
} catch {
frameElement.setAttribute("data-codex-playwright-frame-match", ${JSON.stringify(o)});
return {
enterFrameCount,
frameName: frameElement.name || undefined,
frameUrl: frameElement.src || undefined,
matched: true,
offset: { x, y },
};
}
if (!frameWindow || !frameDocument) {
frameElement.setAttribute("data-codex-playwright-frame-match", ${JSON.stringify(o)});
return {
enterFrameCount,
frameName: frameElement.name || undefined,
frameUrl: frameElement.src || undefined,
matched: true,
offset: { x, y },
};
}
currentRoot = frameDocument;
currentInjected = injectedForWindow(initialInjected, frameWindow);
partStart = enterFrameIndex + 1;
}
})()`,n)}catch(s){throw await this.removeFrameMarker(t.target,o,n),s}if(!i.matched)return null;try{let s=await this.frameIdForMarkedFrameElement(t.target,o,n).then(async l=>l??await this.frameIdForFrameMatch(t.target,i,n)),a=await this.targetForFrame(t.target.tabId,s,{...i.frameUrl!=null?{url:i.frameUrl}:{}},n);if(a==null)return null;let u=i.offset??{x:0,y:0};return{oopifFrameChain:[...t.oopifFrameChain,{frameId:s,parentTarget:t.target}],pointerOffset:{x:t.pointerOffset.x+u.x,y:t.pointerOffset.y+u.y},selector:mj(r,i.enterFrameCount??1),target:a}}finally{await this.removeFrameMarker(t.target,o,n)}}async frameIdForFrameMatch(t,r,n={}){if(r.frameUrl==null)return null;let{frameTree:o}=await this.callCdpTarget(t,"Page.getFrameTree",void 0,n),i=tk(o).filter(s=>s.url!==r.frameUrl?!1:r.frameName==null||s.name===r.frameName);return i.length===1?i[0]?.id??null:null}async targetForFrame(t,r,n,o={}){if(r!=null){let i=this.cdp.targetForFrame(t,r);if(i!=null)return i}return bj(this.cdp)?await this.cdp.targetForFrameOrAttach(t,r,o,n):null}async frameIdForMarkedFrameElement(t,r,n={}){let i=(await this.callCdpTarget(t,"Runtime.evaluate",{expression:Q1(r),returnByValue:!1},n).catch(()=>null))?.result?.objectId;if(typeof i=="string")try{let{node:l}=await this.callCdpTarget(t,"DOM.describeNode",{objectId:i},n);if(typeof l.frameId=="string")return l.frameId}finally{await this.callCdpTarget(t,"Runtime.releaseObject",{objectId:i},n).catch(()=>{})}let{root:s}=await this.callCdpTarget(t,"DOM.getDocument",{depth:-1,pierce:!0}),{nodeId:a}=await this.callCdpTarget(t,"DOM.querySelector",{nodeId:s.nodeId,selector:`[data-codex-playwright-frame-match='${r}']`},n);if(!a)return null;let{node:u}=await this.callCdpTarget(t,"DOM.describeNode",{nodeId:a},n);return typeof u.frameId=="string"?u.frameId:null}async removeFrameMarker(t,r,n={}){await this.callCdpTarget(t,"Runtime.evaluate",{expression:`(() => {
const element = ${Q1(r)};
if (element) element.removeAttribute("data-codex-playwright-frame-match");
})()`,returnByValue:!0},n).catch(()=>{})}async evaluateWithPlaywrightInjected(t,r,n){let o=k(t);return await this.evaluateWithPlaywrightInjectedInTarget({tabId:o},r,n)}async evaluateWithPlaywrightInjectedInTarget(t,r,n={}){await this.ensurePlaywrightInjectedInTarget(t,n);let o=await this.callCdpTarget(t,"Runtime.evaluate",{expression:r,returnByValue:!0,awaitPromise:!0,...n.timeoutMs==null||n.timeoutMs<=0?{}:{timeout:n.timeoutMs}},{telemetryAttrs:n.telemetryAttrs,timeoutMs:n.timeoutMs});return fj(o)}async ensurePlaywrightInjected(t,r={}){let n=Number(t);if(!Number.isFinite(n))throw new Error("ensurePlaywrightInjected requires numeric tab_id");await this.ensurePlaywrightInjectedInTarget({tabId:n},r)}async ensurePlaywrightInjectedInTarget(t,r={}){let n=hj(t),o=pj(r.telemetryAttrs)??"unknown";if(this.playwrightInjectedTargets.has(n)){let{result:i}=await this.callCdpTarget(t,"Runtime.evaluate",{expression:`!!window.${e.injectedConstant}`,returnByValue:!0},{timeoutMs:r.timeoutMs,telemetryAttrs:xr({operation:o,phase:"inject_check"})});if(i.value)return;this.playwrightInjectedTargets.delete(n)}await this.callCdpTarget(t,"Runtime.evaluate",{expression:`(() => {
if (!window.${e.injectedConstant}) {
${Y1}
window.${e.injectedConstant} = new PlaywrightInjected.InjectedScript(window, {
isUnderTest: false,
sdkLanguage: "javascript",
testIdAttributeName: "data-testid",
stableRafCount: 1,
browserName: "chromium",
customEngines: [],
});
}
})()`,returnByValue:!0},{timeoutMs:r.timeoutMs,telemetryAttrs:xr({operation:o,phase:"inject_install"})}),this.playwrightInjectedTargets.add(n)}async callCdpTarget(t,r,n,o={}){let i=this.cdp;return typeof i.callTarget=="function"?await i.callTarget(t,r,n,o):await this.cdp.call(t.tabId,r,n,o)}static selectorScopeFunctions(){return`
function injectedForWindow(rootInjected, targetWindow) {
if (!targetWindow) throw new Error("Frame window is not available");
if (targetWindow.${e.injectedConstant}) {
return targetWindow.${e.injectedConstant};
}
targetWindow.${e.injectedConstant} = new rootInjected.constructor(targetWindow, {
isUnderTest: false,
sdkLanguage: "javascript",
testIdAttributeName: "data-testid",
stableRafCount: 1,
browserName: "chromium",
customEngines: [],
});
return targetWindow.${e.injectedConstant};
}
const unsupportedFrameAccessMessage =
"Cross-origin or out-of-process iframes are not supported by this runtime selector path";
function sliceParsedSelector(parsedSelector, startIndex, endIndex) {
const sliced = {
...parsedSelector,
parts: parsedSelector.parts.slice(startIndex, endIndex),
};
if (parsedSelector.capture === undefined) {
delete sliced.capture;
} else if (
parsedSelector.capture >= startIndex &&
parsedSelector.capture < endIndex
) {
sliced.capture = parsedSelector.capture - startIndex;
} else {
delete sliced.capture;
}
return sliced;
}
function prepareFrameChainForPointerAction(frameChain, scrollAlignment) {
let left = 0;
let top = 0;
const block = scrollAlignment?.block ?? "center";
const inline = scrollAlignment?.inline ?? "nearest";
for (const frameScope of frameChain) {
frameScope.element.scrollIntoView({
block,
inline,
behavior: "instant",
});
const state = frameScope.injected.elementState(frameScope.element, "visible");
if (state.received === "error:notconnected") {
throw new Error("Frame is not connected");
}
if (!state.matches) {
throw new Error("Frame is not visible");
}
const rect = frameScope.element.getBoundingClientRect();
if (!rect || rect.width <= 0 || rect.height <= 0) {
throw new Error("Frame does not have an actionable bounding box");
}
const frameStyle = frameScope.injected.describeIFrameStyle(frameScope.element);
if (frameStyle === "error:notconnected") {
throw new Error("Frame is not connected");
}
if (frameStyle === "transformed") {
throw new Error(
"Cannot compute a reliable click point through a transformed iframe chain"
);
}
left += rect.left + frameStyle.left;
top += rect.top + frameStyle.top;
}
return { left, top };
}
function applyOuterFrameOffset(scope, outerFrameOffset) {
if (!scope) return scope;
const prepareFrameChainForPointerAction = scope.prepareFrameChainForPointerAction;
return {
...scope,
prepareFrameChainForPointerAction: (scrollAlignment) => {
const frameOffset = prepareFrameChainForPointerAction(scrollAlignment);
return {
left: outerFrameOffset.x + frameOffset.left,
top: outerFrameOffset.y + frameOffset.top,
};
},
};
}
function selectorScopeFor(initialInjected, parsedSelector) {
let currentRoot = document;
let currentInjected = initialInjected;
const frameChain = [];
let partStart = 0;
while (true) {
const enterFrameIndex = parsedSelector.parts.findIndex(
(part, index) =>
index >= partStart &&
part.name === "internal:control" &&
part.body === "enter-frame"
);
if (enterFrameIndex === -1) {
return {
frameChain,
injected: currentInjected,
prepareFrameChainForPointerAction: (scrollAlignment) =>
prepareFrameChainForPointerAction(frameChain, scrollAlignment),
root: currentRoot,
parsed: sliceParsedSelector(
parsedSelector,
partStart,
parsedSelector.parts.length
),
};
}
const frameSelector = sliceParsedSelector(
parsedSelector,
partStart,
enterFrameIndex
);
const frameElement = querySelectorStrictWithVisibleFallback(
currentInjected,
frameSelector,
currentRoot
);
if (!frameElement) return null;
const tagName = String(frameElement.localName || frameElement.tagName || "").toLowerCase();
if (tagName !== "iframe" && tagName !== "frame") {
throw new Error("internal:control=enter-frame must target a frame element");
}
let frameWindow;
let frameDocument;
try {
frameWindow = frameElement.contentWindow;
frameDocument = frameElement.contentDocument || frameWindow?.document;
} catch {
throw new Error(unsupportedFrameAccessMessage);
}
if (!frameWindow || !frameDocument) {
throw new Error(unsupportedFrameAccessMessage);
}
frameChain.push({ element: frameElement, injected: currentInjected });
currentRoot = frameDocument;
currentInjected = injectedForWindow(initialInjected, frameWindow);
partStart = enterFrameIndex + 1;
}
}
`}};function xr(e){return{"browser_use.playwright.operation":e.operation,"browser_use.playwright.phase":e.phase}}function pj(e){let t=e?.["browser_use.playwright.operation"];return typeof t=="string"?t:void 0}function fj(e){if(e.exceptionDetails){let t=e.exceptionDetails.exception?.value,r=e.exceptionDetails.exception?.description??e.exceptionDetails.text??(t==null?"Playwright selector evaluation failed.":String(t));throw new Error(`Browser Use encountered an error interacting with this webpage: ${r}`)}return e.result?.value}function Z1(e){let t=String(e instanceof Error?e.message:e);return t.includes("strict mode violation:")||t.includes("Cannot compute a reliable click point through a transformed iframe chain")}var Fc=`
function querySelectorStrictWithVisibleFallback(injected, parsedSelector, root) {
const matches = injected.querySelectorAll(parsedSelector, root);
if (!matches.length) {
injected.checkDeprecatedSelectorUsage(parsedSelector, matches);
return null;
}
if (matches.length === 1) {
injected.checkDeprecatedSelectorUsage(parsedSelector, matches);
return matches[0];
}
const visibleMatches = matches.filter((element) => {
const state = injected.elementState(element, "visible");
return !!state.matches;
});
if (visibleMatches.length === 1) return visibleMatches[0];
throw injected.strictModeViolationError(parsedSelector, matches);
}
`;function xh(e){return JSON.stringify(e)??"undefined"}var vh=" >> internal:control=enter-frame >> ";function X1(e){return{oopifFrameChain:[],pointerOffset:{x:0,y:0},target:{tabId:k(e)}}}function mj(e,t){return e.split(vh).slice(t).join(vh)}function tk(e){return[e.frame,...(e.childFrames??[]).flatMap(t=>tk(t))]}function hj(e){return e.sessionId!=null?`${e.tabId}:${e.sessionId}`:e.targetId!=null?`${e.tabId}:${e.targetId}`:String(e.tabId)}function Q1(e){return`(() => {
const markerSelector = ${JSON.stringify(`[data-codex-playwright-frame-match="${e}"]`)};
const findMarkedFrameElement = (root) => {
const directMatch = root.querySelector(markerSelector);
if (directMatch) return directMatch;
for (const frame of root.querySelectorAll("iframe, frame")) {
try {
const frameDocument = frame.contentDocument || frame.contentWindow?.document;
if (!frameDocument) continue;
const childMatch = findMarkedFrameElement(frameDocument);
if (childMatch) return childMatch;
} catch {
// Cross-process descendants are expected here; the marker lives on a
// reachable frame element before we enter the target process.
}
}
return null;
};
return findMarkedFrameElement(document);
})()`}function ek(e,t){for(let r=0;r<e.length;r+=2)if(e[r]===t)return e[r+1]}function gj(e){return typeof e.enableOopifAutoAttach=="function"&&typeof e.targetForFrame=="function"}function bj(e){return typeof e.targetForFrameOrAttach=="function"}var Lc=class{constructor(t){this.api=t}api;async moveMouse(t,r,n,o={}){try{let i=this.api.moveMouse({tabId:t,...o.waitForArrival===!1?{waitForArrival:!1}:{},x:r,y:n});if(o.waitForArrival===!1){i.catch(()=>{});return}await i}catch{}}};async function rk(e,t,r,n){let o=je(r);if(o==null)throw new Error(J(`Browser Use could not determine the current page origin before attempting to ${t} files from ${r}.`));let i=await kc(t,o,n);if(i?.decision==="approve")return;if(i?.decision==="deny")throw new Error(J(t==="download"?`The user has requested that files not be downloaded from ${r}.`:`The user has requested that files not be uploaded to ${r}.`));let s=e();if(s==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to ${t} files on ${r}. Please use another source or try another approach.`));let a=await s({message:t==="download"?`Allow download from ${r}?`:`Allow upload to ${r}?`,meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",persist:["session","always"],tool_params:{},file_transfer:t,origin:o}});if(await Ac(t,o,a,n),a.action!=="accept")throw new Error(J(t==="download"?`The user has requested that files not be downloaded from ${r}.`:`The user has requested that files not be uploaded to ${r}.`))}async function nk(e,t,r){let n=je(t);if(n==null)throw new Error(J("Raw CDP access requires a current web page origin."));let o=await k1(n,r);if(o?.decision==="approve")return;if(o?.decision==="deny")throw new Error(J(`The user has requested that raw CDP not be used on ${n}.`));let i=e();if(i==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to use raw CDP on ${n}. Please try another approach.`));let s=await i({message:`Allow Browser Use to use raw CDP on ${n}?`,meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",persist:["session","always"],tool_name:"access_browser_origin_with_raw_cdp",tool_title:"Use raw CDP on browser origin",tool_params:{origin:n},tool_params_display:[],full_cdp_access:!0,origin:n}});if(await R1(n,s,r),s.action!=="accept")throw new Error(J(`The user has requested that raw CDP not be used on ${n}.`))}async function ok(e,t,r){let n=je(t);if(n==null)throw new Error(J(`Browser Use could not determine the current page origin before attempting to download page assets from ${t??"the current page"}.`));await sk(e,n,`I need your permission to download assets used by ${new URL(n).host||n}`,r)}async function ik(e,t,r,n){let o=je(r);o==null||o===je(t)||await sk(e,o,`I need your permission to download an asset from ${new URL(o).host||o}`,n)}async function sk(e,t,r,n){let o=await kc("download",t,n);if(o?.decision==="approve")return;if(o?.decision==="deny")throw new Error(J(`The user has requested that files not be downloaded from ${t}.`));let i=e();if(i==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to download page assets from ${t}. Please use another source or try another approach.`));let s=await i({message:r,meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",persist:["session","always"],tool_params:{asset_origins:[t]},tool_params_display:[{name:"asset_origins",display_name:"Download from",value:t}]}});if(await Ac("download",t,s,n),s.action!=="accept")throw new Error(J(`The user has requested that files not be downloaded from ${t}.`))}var ak=async(e,t)=>{let r=globalThis.nodeRepl?.fetch;if(r==null)throw new Error(J("Browser Use cannot determine if this website is allowed. Please try again later or use another source."));return r(e,t)};var yj=1440*60*1e3,Eh=class{constructor(t=Date.now,r=Ue){this.now=t;this.getTurnMetadata=r}now;getTurnMetadata;cache=new Map;inflightRequests=new Map;async throwIfBlocksUrl(t,r){if(typeof t!="string")return;let n=this.getTurnMetadata(),o=Dy(t,{conversationId:n?.session_id,turnId:n?.turn_id,urlRequestSource:r==null?Nu:`${Nu}:${r}`});if(o==null)return;let i;try{i=await this.isBlocked(o)}catch{return}if(i)throw new Error(J(`Browser Use is not permitted on ${o.displayUrl}.`))}async isBlocked(t){let r=this.fetchBlocked(t),n=this.cachedBlocked(t.cacheKey);if(n!=null)return r.catch(()=>{}),n;let o=this.inflightRequests.get(t.cacheKey);if(o!=null)return r.catch(()=>{}),o;let i=r.then(s=>(this.cache.set(t.cacheKey,{blocked:s,timestampMs:this.now()}),s)).finally(()=>{this.inflightRequests.get(t.cacheKey)===i&&this.inflightRequests.delete(t.cacheKey)});return this.inflightRequests.set(t.cacheKey,i),i}cachedBlocked(t){let r=this.cache.get(t);return r==null||this.now()-r.timestampMs>=yj?(r!=null&&this.cache.delete(t),null):r.blocked}async fetchBlocked(t){let r=await ak(t.endpoint,{method:"GET"});if(!r.ok)throw new Error(J(`Browser Use cannot determine if ${t.displayUrl} is allowed. Please try again later or use another source.`));let n=await r.json();return Py(n)}},_j=new Eh;async function uk(e,t){await _j.throwIfBlocksUrl(e,t)}var wj=new Set(["navigate_tab_url"]),xj="browser_user_history",Sj="disabled-for-local-testing",vj=new Set(["browser_user_claim_tab","browser_user_open_tabs","close_tab","create_tab","list_tabs","name_session","playwright_wait_for_timeout","selected_tab"]),Uc=class{constructor(t,r){this.tabs=t;this.browserBackend=r}tabs;browserBackend;async ensureCommandAllowed(t){if(ri())return;if(t.type===xj){await O1(ti,Tj(t.params));return}let r=Ej(t);switch(r.kind){case"none":return;case"targetUrl":await this.ensureUrlOriginAllowed(r.url);return;case"currentTab":await this.ensureCurrentTabOriginAllowed(r.tabId);return}}async ensureDownloadAllowed(t){ri()||await this.ensureCurrentTabFileTransferAllowed(t,"download")}async ensureFileUploadAllowed(t){ri()||await this.ensureCurrentTabFileTransferAllowed(t,"upload")}async ensurePageAssetDownloadAllowed(t){ri()||await ok(ti,t)}async ensurePageAssetFallbackFetchAllowed(t,r){ri()||await ik(ti,t,r)}async ensureFullCdpAllowed(t){if(ri())return;let n=(await this.tabs.get(t)).url;if(typeof n!="string"||n.trim().length===0)throw new Error(J("Browser Use could not determine the current page URL before attempting to use raw CDP."));await nk(ti,n)}async ensureUrlOriginAllowed(t){Pj(t),await uk(t,this.browserBackend);let r=je(t);r!=null&&await N1(ti,r)}async ensureCurrentTabOriginAllowed(t){let r=await this.tabs.get(t);await this.ensureUrlOriginAllowed(r.url)}async ensureCurrentTabFileTransferAllowed(t,r){let o=(await this.tabs.get(t)).url;if(typeof o!="string"||o.trim().length===0)throw new Error(J(`Browser Use could not determine the current page URL before attempting to ${r} files.`));await rk(ti,r,o)}};function ti(){if(globalThis.nodeRepl==null)throw new Error("Browser security unavailable outside node repl");return globalThis.nodeRepl.createElicitation}function ri(){return Ly()===Sj}function Ej(e){if(vj.has(e.type))return{kind:"none"};if(wj.has(e.type))return{kind:"targetUrl",url:dk(e.params,"url")};let t=Cj(e.params);return t==null?{kind:"none"}:{kind:"currentTab",tabId:t}}function Cj(e){let t=dk(e,"tab_id"),r=Number(t);return!Number.isInteger(r)||r<=0?null:r}function dk(e,t){if(pk(e))return e[t]}function Tj(e){if(!pk(e))return{max_results:100};let t={};return kj(e,t,"query"),t.date_range=Ij(e.from,e.to),t.max_results=Aj(e.limit),t}function kj(e,t,r){let n=e[r];typeof n=="string"&&(t[r]=n)}function Aj(e){return typeof e=="number"?e:100}function Ij(e,t){let r=lk(e),n=lk(t);return r!=null&&n!=null?`${r} to ${n}`:r!=null?`Since ${r}`:n!=null?`Before ${n}`:"All history"}function lk(e){return typeof e!="string"?null:Rj(e)}function Rj(e){let t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(new Date(t))}function Pj(e){if(typeof e=="string"&&!_y(e))throw new Error(J("Browser Use cannot visit the requested page because its URL is blocked by the Browser Use URL policy."))}function pk(e){return typeof e=="object"&&e!=null}var jc=class{constructor(t,r,n){this.api=t;this.browserId=r;this.clientInfo=n;this.isIabBackend=n.type==="iab",this.cdp=new pc(t),this.browserUser=new yc(t,n),this.ui=new Lc(t),this.cua=new _c(this.cdp,this.ui),this.dev=new wc(this.cdp),this.tabs=new Mc(t,n),this.playwright=new Bc(this.cdp,this.cua),this.security=new Uc(this.tabs,n.type),this.downloads=new xc(t,this.cdp,this.security,n.type),this.pageAssets=new Oc(this.cdp,this.security),this.removeCloseListener=t.addCloseListener(()=>this.dispose())}api;browserId;clientInfo;cdp;browserUser;isIabBackend;cua;dev;downloads;pageAssets;tabs;playwright;ui;security;removeCloseListener;disposePromise;async nameSession(t){await this.api.nameSession(t)}async executeUnhandledCommand(t){return await this.api.executeUnhandledCommand(t)}async assertFullCdpAccessEnabled(){await JT()}async dispose(){this.disposePromise??=(async()=>{this.removeCloseListener(),await this.cdp.detachAllTabs(),await this.api.close()})(),await this.disposePromise}};import{readdir as wk}from"node:fs/promises";import Gj,{platform as xk}from"node:os";import Sk from"node:path";import{Buffer as Ch}from"node:buffer";import{endianness as fk}from"node:os";var bn=4;function mk(e){let t=Buffer.from(e,"utf8"),r=Buffer.alloc(bn+t.length);return Dj(r,t.length,0),t.copy(r,bn),r}function hk(e,t=0){return fk()==="LE"?e.readUInt32LE(t):e.readUInt32BE(t)}function Dj(e,t,r){fk()==="LE"?e.writeUInt32LE(t,r):e.writeUInt32BE(t,r)}function kh(){let e="privileged native pipe bridge is not available; browser-client is not trusted";return Kn()==="production"?e:`${e}. Browser Use loaded stale or overwritten bundled plugins. Another Codex app may have overwritten them. Ask the user to use Debug Menu > Plugins > Reload bundled plugins, then retry.`}function Ah(){let e=globalThis.nodeRepl?.nativePipe;return e==null||typeof e.createConnection!="function"?null:e}var qc=class e{constructor(t){this.socket=t;t!=null&&(t.on("data",r=>this.handleData(r)),t.on("error",r=>{this.socket===t&&this.markClosed(r)}),t.on("close",()=>{this.socket===t&&this.markClosed(new Error("native pipe closed before response"))}))}socket;messageCallback=null;frameDecoder=new Th;closeListeners=new Set;closePromise=null;terminalClose=null;static async create(t){let r=Ah();if(r!=null){let n=await r.createConnection(t);return new e(n)}throw new Error(kh())}sendMessage(t){if(this.socket==null)throw new Error("native pipe is closed");this.socket.write(mk(JSON.stringify(t)))}setMessageCallback(t){this.messageCallback=t}addCloseListener(t){return this.closeListeners.add(t),this.terminalClose!=null&&Promise.resolve().then(()=>t(this.terminalClose?.error)).catch(()=>{}),()=>{this.closeListeners.delete(t)}}async close(){this.closePromise??=(async()=>{let t=this.socket;await this.markClosed(),t?.end()})(),await this.closePromise}handleData(t){for(let r of this.frameDecoder.push(t))this.messageCallback?.(JSON.parse(r))}async notifyCloseListeners(t){await Promise.allSettled([...this.closeListeners].map(async r=>r(t)))}async markClosed(t){this.terminalClose==null&&(this.terminalClose={error:t},this.socket=null,await this.notifyCloseListeners(t))}},Th=class{chunks=[];byteLength=0;chunkStart=0;push(t){this.append(t);let r=[];for(;this.byteLength>=bn;){let n=hk(this.peekBytes(bn)),o=bn+n;if(this.byteLength<o)break;let i=this.consumeBytes(o);r.push(i.subarray(bn).toString("utf8"))}return r}append(t){if(t.byteLength===0)return;let r=Ch.from(t.buffer,t.byteOffset,t.byteLength);this.chunks.push(r),this.byteLength+=r.byteLength}peekBytes(t){let r=this.chunks[this.chunkStart];if(r&&r.byteLength>=t)return r.subarray(0,t);let n=Ch.allocUnsafe(t),o=0;for(let i=this.chunkStart;i<this.chunks.length;i+=1){let s=this.chunks[i];if(!s)throw new Error("native pipe frame decoder underflow");let a=s.copy(n,o,0,t-o);if(o+=a,o===t)break}return n}consumeBytes(t){let r=this.chunks[this.chunkStart];if(r&&r.byteLength>=t){let i=r.subarray(0,t);return r.byteLength===t?this.discardFirstChunk():this.chunks[this.chunkStart]=r.subarray(t),this.byteLength-=t,i}let n=Ch.allocUnsafe(t),o=0;for(;o<t;){let i=this.chunks[this.chunkStart];if(!i)throw new Error("native pipe frame decoder underflow");let s=i.copy(n,o,0,t-o);o+=s,this.byteLength-=s,s===i.byteLength?this.discardFirstChunk():this.chunks[this.chunkStart]=i.subarray(s)}return n}discardFirstChunk(){if(this.chunkStart+=1,this.chunkStart===this.chunks.length){this.chunks.length=0,this.chunkStart=0;return}this.chunkStart>1024&&this.chunkStart*2>this.chunks.length&&(this.chunks.splice(0,this.chunkStart),this.chunkStart=0)}};import{readFile as $j}from"fs/promises";import{resolve as zj}from"path";import{resolve as Nj}from"path";import{homedir as Oj,platform as Mj}from"os";var $c=Nj(Oj(),Mj()==="win32"?"AppData\\Local\\Google\\Chrome\\User Data":"Library/Application Support/Google/Chrome");import{ClassicLevel as Fj}from"./node_modules/classic-level.mjs";import{resolve as Ih}from"path";import{tmpdir as Bj}from"os";import{cp as Lj,mkdtemp as Uj,rm as gk}from"fs/promises";import{existsSync as jj}from"fs";var bk=async(e,t)=>{let r=Ih($c,e,"Local Extension Settings",t);if(!jj(r))return null;let n=await Uj(Ih(qj(),"codex"));await Lj(r,n,{recursive:!0}),await gk(Ih(n,"LOCK"));let o=new Fj(n,{createIfMissing:!1,keyEncoding:"utf8",valueEncoding:"utf8"});try{await o.open();let i=await o.get("extensionInstanceId");if(!i)return null;let s=JSON.parse(i);return typeof s!="string"?null:s}finally{await o.close(),await gk(n,{force:!0,recursive:!0})}},qj=()=>"nodeRepl"in globalThis&&globalThis.nodeRepl?globalThis.nodeRepl.tmpDir:Bj();var yk=async e=>{if(e.type!=="extension"||!e.metadata?.extensionInstanceId||!e.metadata.extensionId)return e;let t=await Wj(e.metadata.extensionId,e.metadata.extensionInstanceId);return t?{...e,metadata:{...e.metadata,profileName:t.name,profileIsLastUsed:t.isLastUsed.toString(),profileOrdering:t.orderingIndex.toString()}}:e},Wj=async(e,t)=>(await Hj(e)).find(o=>o.instanceId===t)||null,Hj=async e=>{let t=await Vj();return await Promise.all(t.map(async r=>({...r,instanceId:await bk(r.id,e).catch(n=>(ue(n),null))})))},Vj=async()=>{let e=zj($c,"Local State"),t=JSON.parse(await $j(e,"utf8"));return t.profile.profiles_order.map((r,n)=>{let o=t.profile.info_cache[r];return o?{id:r,name:o.name,isLastUsed:t.profile.last_used===r,orderingIndex:n,avatarUrl:o.avatar_icon}:null}).filter(r=>!!r)};var Ph=Iy(Gj.platform()),Kj=async(e,{codexSessionId:t})=>{let r=ap(Ey),n=e.filter(i=>i.info.type==="iab"),o=Jj(n,t,r);return await Promise.all(n.filter(i=>!o.includes(i)).map(async({api:i})=>i.close())),[...e.filter(i=>i.info.type!=="iab"),...o]},Jj=(e,t,r)=>t==null?[]:e.filter(n=>n.info.metadata?.codexSessionId===t&&(r==null||n.info.metadata.codexAppBuildFlavor===r));var vk=async e=>{Sc();let t=oq(),r=await Yj(),n=r.pipes,o=await Promise.all(n.map(l=>Zj(l,e))),i=o.map(l=>"browser"in l?l.browser:null).filter(l=>l!=null),s=await Kj(i,t),a={backendCounts:uq(s),browserCount:s.length,candidatePipeCount:o.length,currentCodexSessionId:t.codexSessionId??null,currentThreadId:t.threadId??null,currentThreadSource:t.threadSource??null,currentTurnId:t.turnId??null,discoveredIabCandidates:i.filter(l=>l.info.type==="iab").map(l=>({codexAppBuildFlavor:l.info.metadata?.codexAppBuildFlavor??null,codexSessionId:l.info.metadata?.codexSessionId??null})),failures:o.map(l=>"failure"in l?l.failure:null).filter(l=>l!=null).slice(0,8),iabBrowserCount:s.filter(l=>l.info.type==="iab").length,pipeListingError:r.error,pipeListingPipeCount:r.pipes.length},u=i.filter(l=>l.info.type==="iab").length;if(a.iabBrowserCount===0){let l=nq(u);sq(a,l,u),iq(a,l)}return{browsers:s,diagnostics:a}};async function Yj(){try{return{error:null,pipes:await eq()}}catch(e){return{error:Ek(e),pipes:[]}}}async function Zj(e,t){let r=null,n="pipe-connect";try{let o=await qc.create(e);r=t(o),n="backend-info-request";let i=await r.getInfo(),s=await yk(i).catch(a=>(ue(a),i));return{browser:{id:crypto.randomUUID().substring(8),api:r,info:Xj(await Qj(s))}}}catch(o){return await r?.close(),ue(o),{failure:`${n}/${Ek(o)}`}}}function Xj(e){return e.capabilities==null?e:{...e,capabilities:{browser:_k(e.capabilities.browser??[],"browser"),tab:_k(e.capabilities.tab??[],"tab")}}}async function Qj(e,{isFullCdpEnabled:t=KT}={}){if(!Xo(e.type)||!await t())return e;let r=e.capabilities?.tab??[];return r.some(n=>n.id===Mo.id)?e:{...e,capabilities:{...e.capabilities,tab:[...r,Mo.info]}}}function _k(e,t){return e.map(r=>({...r,docs:`Before using this capability, read docs/capabilities/${t}/${r.id}.md in plugin output or references/capabilities/${t}/${r.id}.md in skill output.`}))}function Ek(e){if(typeof e=="string")return e;if(e==null||typeof e!="object")return String(e);let t=Rh(e,"name"),r=Rh(e,"message")?.trim()??"",n=Rh(e,"code"),o=n!=null&&!r.startsWith(`${n}:`)?n:null,s=[t,o].filter(a=>typeof a=="string"&&a.length>0).join(": ");return s.length>0?r.length===0?s:`${s}: ${r}`:r.length>0?r:String(e)}var eq=()=>xk()==="win32"?rq():tq(),tq=async()=>(await wk(Ph)).map(t=>Sk.resolve(Ph,t)),rq=async()=>{let e="\\\\.\\pipe\\";return(await wk(e)).map(n=>Sk.resolve(e,n)).filter(n=>n.startsWith(Ph))};function nq(e){return aq()==null?"missing-session-metadata":e===0?"no-iab-backends":"no-session-match"}function oq(){let e=Ue();return{codexSessionId:gr(e),threadId:typeof e?.thread_id=="string"?e.thread_id:void 0,threadSource:typeof e?.thread_source=="string"?e.thread_source:void 0,turnId:typeof e?.turn_id=="string"?e.turn_id:void 0}}function iq(e,t){console.warn("IAB_DISCOVERY no session-owned iab browser",JSON.stringify({currentCodexSessionId:e.currentCodexSessionId,currentThreadId:e.currentThreadId,currentThreadSource:e.currentThreadSource,currentTurnId:e.currentTurnId,discoveredIabCandidates:e.discoveredIabCandidates,failures:e.failures,reason:t}))}function sq(e,t,r){vl("browser_use_backend_discovery_failed",t,{backend:"iab",browserCount:String(e.browserCount),candidatePipeCount:String(e.candidatePipeCount),discoveredIabBrowserCount:String(r),failureCount:String(e.failures.length),failures:JSON.stringify(e.failures),iabBrowserCount:String(e.iabBrowserCount),pipeListingError:e.pipeListingError??"none",pipeListingPipeCount:String(e.pipeListingPipeCount),platform:xk(),reason:t,release:pt})}var aq=()=>gr(Ue());function Rh(e,t){let r=e[t];return typeof r=="string"&&r.length>0?r:null}function uq(e){let t={cdp:0,extension:0,iab:0};for(let r of e)t[r.info.type]+=1;return t}function lq(e){return`extension=${e.extension}, iab=${e.iab}, cdp=${e.cdp}`}function Ck(e){let t=[`Discovered backends: ${lq(e.backendCounts)}.`];return e.failures.length>0&&t.push(`Discovery errors: ${e.failures.join("; ")}.`),e.iabBrowserCount===0&&e.discoveredIabCandidates.length>0&&t.push(`IAB candidates: ${e.discoveredIabCandidates.map(({codexAppBuildFlavor:r,codexSessionId:n})=>`${n??"none"}@${r??"none"}`).join(", ")}.`),e.pipeListingError!=null&&t.push(`Pipe listing error: ${e.pipeListingError}.`),t.join(" ")}var cq="Cannot access a chrome-extension:// URL of different extension",dq="Chrome is blocking automation because another extension UI is open on this page. Complete or dismiss that extension UI in Chrome, then ask me to continue.";function Tk(e){return pq(e)?new Error(dq,{cause:e instanceof Error?e:void 0}):e instanceof Error?e:new Error(kk(e))}function pq(e){return kk(e).includes(cq)}function kk(e){if(e instanceof Error)return e.message;if(e&&typeof e=="object"&&"message"in e){let t=e.message;if(typeof t=="string")return t}return String(e??"")}function fq(e){return`Downloads are not supported by ${e.name}.`}var mq=new Set(["playwright_download_path","playwright_wait_for_download","cua_download_media","dom_cua_download_media","playwright_locator_download_media"]);function hq(e){return mq.has(e)}function Ak({browserInfo:e,commandType:t}){if(hq(t)&&e.type==="iab")throw new Error(fq(e))}function gq(e){return`File uploads are not supported by ${e.name}.`}var bq=new Set(["playwright_file_chooser_set_files","playwright_wait_for_file_chooser"]);function yq(e){return bq.has(e)}function Ik({browserInfo:e,commandType:t}){if(yq(t)&&e.type==="iab")throw new Error(gq(e))}var _q={cdp:"cdp",extension:"chrome",iab:"iab"};function Dh(e){switch(e){case"extension":return"extension";case"iab":return"iab";case"cdp":return"cdp"}}function zc(e){return e==="extension"||e==="iab"||e==="cdp"}function Wc(e){return _q[e]}function Rk({browserId:e,clientInfo:t,requestedBrowserId:r}){return zc(r)?Dh(t.type)===r:e===r}var wq={chrome:"The Chrome Browser Use plugin is not available in this context.",iab:"The Browser Use plugin is not available in this context.",cdp:"The CDP Browser Use backend is not available in this context."};function Pk(e){if(e==="cdp")return;let t=Dk();if(!(t==null||t.includes(e)))throw new Error(xq(e))}function xq(e){return wq[e]}function Nh(e){if(e==="cdp")return!0;let t=Dk();return t==null||t.includes(e)}function Dk(){return Fy()}var Hc=class{ping(){return"pong"}};var Vc=class extends Gi{constructor(r,n,o){super(r);this.apiTransport=r;this.getTurnMetadata=o;this.registerRequestHandlerObject(n)}apiTransport;getTurnMetadata;addEventListener=super.addEventListener;ping(){return this.sendRequest("ping")}executeCdp(r){return this.sendSessionRequest("executeCdp",r)}attach(r){return this.sendSessionRequest("attach",{tabId:r})}attachTarget(r,n){return this.sendSessionRequest("attachTarget",{tabId:r,targetId:n})}detach(r){return this.sendSessionRequest("detach",{tabId:r})}detachTarget(r,n){return this.sendSessionRequest("detachTarget",{tabId:r,targetId:n})}getTabs(){return this.sendSessionRequest("getTabs",{})}getUserTabs(){return this.sendSessionRequest("getUserTabs",{})}getUserHistory(r){return this.sendSessionRequest("getUserHistory",r)}claimUserTab(r){return this.sendSessionRequest("claimUserTab",{tabId:r})}createTab(){return this.sendSessionRequest("createTab",{})}finalizeTabs(r){return this.sendSessionRequest("finalizeTabs",{keep:r})}nameSession(r){return this.sendSessionRequest("nameSession",{name:r})}executeUnhandledCommand(r){return this.sendSessionRequest("executeUnhandledCommand",r)}moveMouse(r){return this.sendSessionRequest("moveMouse",r)}getInfo(){return this.sendSessionRequest("getInfo",{})}addCloseListener(r){return this.apiTransport.addCloseListener?.(r)??(()=>{})}async close(){await this.apiTransport.close?.()}sendSessionRequest(r,n){return this.sendRequest(r,{...n,...this.getSessionParams()})}getSessionParams(){let r=this.getTurnMetadata(),n=gr(r);if(typeof n!="string")throw new Error("Missing required browser session_id");let o=r?.turn_id;if(typeof o!="string")throw new Error("Missing required browser turn_id");return{session_id:n,turn_id:o}}};import{platform as Gc}from"node:os";var Sq=Object.values(lh),vq="codex/browserUse",Oh=null;function Nk(e){e.nodeRepl?.setResponseMeta({[vq]:!0})}async function Nge({globals:e}){Nk(e),Fw(),Pt("browser_use_invocation_started","multi",{backend:"multi",platform:Gc(),release:pt});let t=e,r,n,o;try{if(Ah()==null)throw new Error(kh());Sc();let l=new Hc;({browsers:r,diagnostics:n}=await vk(p=>new Vc(p,l,Ue))),o=await Cq(r)}catch(l){let d=l instanceof Error?l.name||"Error":typeof l;throw Pt("browser_use_setup_failed",d,{backend:"multi",phase:"runtime-setup",platform:Gc(),reason:d,release:pt}),l}let i=o.map(l=>new jc(l.api,l.id,l.info));Oh&&await Oh(),Oh=async()=>{await Promise.all(i.map(l=>l.dispose()))};let s=Tq(e),a=f1({displayBridge:s,displayTruncateMaxChars:1e5}),u=new Oa({browserInfos:o.map(({id:l,info:d})=>{let p=Dh(d.type);return{capabilities:By(d.capabilities),id:l,name:d.name,type:p,metadata:d.metadata}}),transport:new Ma({displaySideEffect:a,async executeAgentCommand(l){Pt("browser_use_agent_command",l.type),Nk(e);let{type:d,...p}=l;if("browser_id"in p){if(zc(p.browser_id)){let h=Wc(p.browser_id);Nh(h)||Ok({diagnostics:n,reason:"backend-disabled",requestedBrowserId:p.browser_id}),Pk(h)}let f=i.find(h=>Rk({browserId:h.browserId,clientInfo:h.clientInfo,requestedBrowserId:p.browser_id}));if(!f)throw Ok({diagnostics:n,reason:"not-discovered",requestedBrowserId:p.browser_id}),new Error(Eq(p.browser_id,n));wf(f.clientInfo.type),Ak({browserInfo:f.clientInfo,commandType:d}),Ik({browserInfo:f.clientInfo,commandType:d});let m=Sq.find(h=>h.type===d);try{return await f.security.ensureCommandAllowed({type:d,params:p}),m?await m(p,f):await jl(d,p,async()=>await f.executeUnhandledCommand({type:d,...p}))}catch(h){throw Tk(h)}}throw new Error("Browser ID must be provided")}})});t.agent=u,t.display=a,Pt("browser_use_setup"),Pt("browser_use_invocation_ready","multi",{backend:"multi",backendCounts:JSON.stringify(n.backendCounts),platform:Gc(),release:pt})}function Ok({diagnostics:e,reason:t,requestedBrowserId:r}){Pt("browser_use_requested_browser_unavailable",t,{backend:zc(r)?Wc(r):"unknown",backendCounts:JSON.stringify(e.backendCounts),browserCount:String(e.browserCount),iabBrowserCount:String(e.iabBrowserCount),platform:Gc(),reason:t,release:pt,requestedBrowserId:r})}function Eq(e,t){return`Failed to connect to browser "${e}". `+Ck(t)}async function Cq(e){let t=[],r=[];for(let n of e)Nh(Wc(n.info.type))?t.push(n):r.push(n);return await Promise.all(r.map(({api:n})=>n.close())),t}var Tq=e=>({displayImage:async t=>{await e.nodeRepl?.emitImage(t)},displayValue:async t=>{let r=e.console;if(r&&typeof r.log=="function"){r.log(t);return}console.log(t)}});export{Nge as setupBrowserRuntime};