actionagent 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/builds/action_agent.css +1 -1
- data/app/assets/builds/action_agent.js +76 -73
- data/app/assets/builds/action_agent_recorder.js +78 -0
- data/app/assets/builds/action_agent_replay.js +226 -0
- data/app/controllers/action_agent/api/agent_runs_controller.rb +3 -1
- data/app/controllers/action_agent/api/agents_controller.rb +1 -0
- data/app/controllers/action_agent/api/api_keys_controller.rb +12 -2
- data/app/controllers/action_agent/api/base_controller.rb +63 -2
- data/app/controllers/action_agent/api/claude_logins_controller.rb +93 -0
- data/app/controllers/action_agent/api/code_sessions_controller.rb +71 -12
- data/app/controllers/action_agent/api/dashboard_assistant_controller.rb +2 -2
- data/app/controllers/action_agent/api/draft_pull_requests_controller.rb +248 -0
- data/app/controllers/action_agent/api/evaluation_fixes_controller.rb +27 -0
- data/app/controllers/action_agent/api/evaluations_controller.rb +58 -7
- data/app/controllers/action_agent/api/explorations_controller.rb +213 -0
- data/app/controllers/action_agent/api/github_app_manifests_controller.rb +125 -0
- data/app/controllers/action_agent/api/github_connections_controller.rb +40 -2
- data/app/controllers/action_agent/api/github_installations_controller.rb +280 -0
- data/app/controllers/action_agent/api/input_requests_controller.rb +77 -0
- data/app/controllers/action_agent/api/mcp_controller.rb +46 -12
- data/app/controllers/action_agent/api/members_controller.rb +36 -0
- data/app/controllers/action_agent/api/project_explorations_controller.rb +80 -0
- data/app/controllers/action_agent/api/project_install_pull_requests_controller.rb +305 -0
- data/app/controllers/action_agent/api/project_secrets_controller.rb +96 -0
- data/app/controllers/action_agent/api/project_setup_controller.rb +151 -0
- data/app/controllers/action_agent/api/project_sign_ins_controller.rb +112 -0
- data/app/controllers/action_agent/api/projects_controller.rb +512 -0
- data/app/controllers/action_agent/api/provider_keys_controller.rb +176 -24
- data/app/controllers/action_agent/api/provider_models_controller.rb +37 -15
- data/app/controllers/action_agent/api/recording_event_ingest_controller.rb +67 -0
- data/app/controllers/action_agent/api/sandbox_browser_tickets_controller.rb +50 -0
- data/app/controllers/action_agent/api/sandbox_browsers_controller.rb +65 -0
- data/app/controllers/action_agent/api/sandboxes_controller.rb +148 -8
- data/app/controllers/action_agent/api/scenario_catalog_entries_controller.rb +188 -0
- data/app/controllers/action_agent/api/scenario_catalogs_controller.rb +302 -0
- data/app/controllers/action_agent/api/session_recordings_controller.rb +165 -34
- data/app/controllers/action_agent/api/sessions_controller.rb +111 -0
- data/app/controllers/action_agent/api/telemetry_keys_controller.rb +21 -0
- data/app/controllers/action_agent/dashboard_controller.rb +17 -6
- data/app/controllers/action_agent/session_player_controller.rb +58 -0
- data/app/controllers/concerns/action_agent/api/agent_serialization.rb +1 -0
- data/app/controllers/concerns/action_agent/api/mcp_dashboard_tools.rb +627 -20
- data/app/controllers/concerns/action_agent/api/project_browser.rb +46 -0
- data/app/controllers/concerns/action_agent/api/project_secret_authorization.rb +57 -0
- data/app/jobs/action_agent/agent_execution_job.rb +9 -39
- data/app/jobs/action_agent/agent_resume_job.rb +84 -0
- data/app/jobs/action_agent/code_session_job.rb +39 -10
- data/app/jobs/action_agent/draft_pull_request_job.rb +43 -0
- data/app/jobs/action_agent/exploration_job.rb +80 -0
- data/app/jobs/action_agent/input_request_expiry_job.rb +22 -0
- data/app/jobs/action_agent/project_evaluation_job.rb +59 -0
- data/app/jobs/action_agent/project_setup_job.rb +21 -0
- data/app/jobs/action_agent/sandbox_cleanup_job.rb +20 -3
- data/app/jobs/action_agent/sandbox_provision_job.rb +77 -10
- data/app/jobs/action_agent/sandbox_run_job.rb +9 -37
- data/app/jobs/action_agent/verify_evaluation_fix_job.rb +37 -0
- data/app/models/action_agent/agent.rb +72 -26
- data/app/models/action_agent/agent_run.rb +134 -23
- data/app/models/action_agent/agent_template.rb +35 -1
- data/app/models/action_agent/api_key.rb +14 -0
- data/app/models/action_agent/catalog_scenario.rb +75 -0
- data/app/models/action_agent/code_session.rb +21 -5
- data/app/models/action_agent/draft_pull_request.rb +131 -0
- data/app/models/action_agent/evaluation.rb +148 -0
- data/app/models/action_agent/evaluation_run.rb +143 -53
- data/app/models/action_agent/evaluation_scenario_result.rb +15 -3
- data/app/models/action_agent/exploration.rb +847 -0
- data/app/models/action_agent/github_installation.rb +159 -0
- data/app/models/action_agent/input_request.rb +291 -0
- data/app/models/action_agent/model_pricing.rb +214 -34
- data/app/models/action_agent/project.rb +789 -0
- data/app/models/action_agent/project_secret.rb +339 -0
- data/app/models/action_agent/provider_key.rb +207 -4
- data/app/models/action_agent/recording_event.rb +145 -0
- data/app/models/action_agent/recording_snapshot.rb +7 -7
- data/app/models/action_agent/sandbox_session.rb +300 -16
- data/app/models/action_agent/scenario_catalog.rb +172 -0
- data/app/models/action_agent/scenario_product.rb +57 -0
- data/app/models/action_agent/scenario_set.rb +138 -0
- data/app/models/action_agent/session_recording.rb +121 -14
- data/app/models/action_agent/telemetry_trace.rb +74 -19
- data/app/models/concerns/action_agent/ownable.rb +84 -13
- data/app/serializers/action_agent/evaluation_serializer.rb +41 -10
- data/app/serializers/action_agent/input_request_serializer.rb +47 -0
- data/app/serializers/action_agent/scenario_catalog_serializer.rb +23 -0
- data/app/serializers/action_agent/session_summary_serializer.rb +146 -0
- data/app/services/action_agent/agent_execution_service.rb +450 -72
- data/app/services/action_agent/agent_scorecard.rb +50 -21
- data/app/services/action_agent/agent_sync.rb +5 -2
- data/app/services/action_agent/agent_tool_roster.rb +19 -4
- data/app/services/action_agent/agent_toolbox.rb +215 -9
- data/app/services/action_agent/browser_live_ticket.rb +78 -0
- data/app/services/action_agent/browser_sidecar.rb +213 -0
- data/app/services/action_agent/browser_sign_in.rb +163 -0
- data/app/services/action_agent/browser_tool_redaction.rb +92 -0
- data/app/services/action_agent/claude_code_auth.rb +70 -4
- data/app/services/action_agent/codex_session_events.rb +37 -0
- data/app/services/action_agent/dashboard_assistant_service.rb +24 -10
- data/app/services/action_agent/draft_pull_request_publisher.rb +719 -0
- data/app/services/action_agent/evaluation_fix.rb +101 -0
- data/app/services/action_agent/evaluation_fix_comparison.rb +66 -0
- data/app/services/action_agent/evaluation_report_import.rb +84 -5
- data/app/services/action_agent/evaluation_run_cost.rb +609 -0
- data/app/services/action_agent/evaluation_runner_service.rb +29 -10
- data/app/services/action_agent/evaluation_standing.rb +152 -0
- data/app/services/action_agent/explorer_execution_service.rb +517 -0
- data/app/services/action_agent/github_client.rb +405 -64
- data/app/services/action_agent/live_updates.rb +31 -0
- data/app/services/action_agent/local_sandbox_backend.rb +1263 -102
- data/app/services/action_agent/local_sandbox_claude_login.rb +151 -0
- data/app/services/action_agent/mcp_client.rb +6 -2
- data/app/services/action_agent/mcp_recording_middleware.rb +104 -145
- data/app/services/action_agent/mcp_tool_dispatcher.rb +36 -13
- data/app/services/action_agent/mock_sandbox_backend.rb +3 -1
- data/app/services/action_agent/playwright_mcp_client.rb +7 -0
- data/app/services/action_agent/project_boot_fix.rb +309 -0
- data/app/services/action_agent/project_capabilities.rb +200 -0
- data/app/services/action_agent/project_install_pull_request.rb +225 -0
- data/app/services/action_agent/project_preflight.rb +178 -0
- data/app/services/action_agent/project_secret_discovery.rb +142 -0
- data/app/services/action_agent/project_setup.rb +429 -0
- data/app/services/action_agent/provider_credentials.rb +102 -0
- data/app/services/action_agent/recording_event_ingest.rb +181 -0
- data/app/services/action_agent/runtime_tool_roster.rb +52 -0
- data/app/services/action_agent/sample_data/conference_ticket.rb +516 -0
- data/app/services/action_agent/sandbox_boot_spec.rb +558 -0
- data/app/services/action_agent/sandbox_browser.rb +299 -0
- data/app/services/action_agent/sandbox_browser_driver.rb +85 -0
- data/app/services/action_agent/sandbox_credential_paths.rb +26 -0
- data/app/services/action_agent/sandbox_mail.rb +103 -0
- data/app/services/action_agent/sandbox_manifest.rb +166 -13
- data/app/services/action_agent/sandbox_orchestrator.rb +290 -23
- data/app/services/action_agent/sandbox_patch.rb +253 -0
- data/app/services/action_agent/scenario_catalog_import.rb +255 -0
- data/app/services/action_agent/scenario_catalog_repository_import.rb +81 -0
- data/app/services/action_agent/scenario_evaluation_runner.rb +121 -17
- data/app/services/action_agent/secret_scrubber.rb +33 -4
- data/app/services/action_agent/session_index.rb +270 -0
- data/app/services/action_agent/session_recording_service.rb +11 -0
- data/app/services/action_agent/session_timeline.rb +505 -0
- data/app/views/action_agent/github_app_manifests/created.html.erb +55 -0
- data/app/views/action_agent/session_player/show.html.erb +19 -0
- data/config/routes.rb +153 -2
- data/lib/action_agent/claude_login_process.rb +107 -0
- data/lib/action_agent/engine.rb +55 -5
- data/lib/action_agent/secret_requests.rb +80 -0
- data/lib/action_agent/version.rb +1 -1
- data/lib/action_agent.rb +513 -22
- data/lib/generators/action_agent/install_generator.rb +45 -5
- data/lib/generators/action_agent/templates/action_agent.rb.erb +161 -0
- data/lib/generators/action_agent/templates/add_code_session_runner.rb.erb +9 -0
- data/lib/generators/action_agent/templates/migrations/015_add_provider_key_scope.rb.erb +72 -0
- data/lib/generators/action_agent/templates/migrations/016_create_active_agent_input_requests.rb.erb +85 -0
- data/lib/generators/action_agent/templates/migrations/017_create_active_agent_recording_events.rb.erb +57 -0
- data/lib/generators/action_agent/templates/migrations/018_add_browser_to_active_agent_sandbox_sessions.rb.erb +25 -0
- data/lib/generators/action_agent/templates/migrations/019_create_active_agent_projects.rb.erb +79 -0
- data/lib/generators/action_agent/templates/migrations/020_add_github_app_installations.rb.erb +62 -0
- data/lib/generators/action_agent/templates/migrations/021_create_active_agent_explorations.rb.erb +63 -0
- data/lib/generators/action_agent/templates/migrations/023_create_active_agent_draft_pull_requests.rb.erb +75 -0
- data/lib/generators/action_agent/templates/migrations/024_add_kind_to_active_agent_project_secrets.rb.erb +14 -0
- data/lib/generators/action_agent/templates/migrations/025_create_active_agent_scenario_catalogs.rb.erb +110 -0
- data/lib/generators/action_agent/templates/migrations/026_add_evaluation_fixes_to_code_sessions.rb.erb +21 -0
- data/lib/tasks/action_agent.rake +33 -0
- data/lib/tasks/browser.rake +22 -0
- data/lib/tasks/sandbox.rake +1 -1
- data/lib/tasks/scenario_catalogs.rake +71 -0
- metadata +100 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var rr=Object.defineProperty,nr=(e,t,r)=>t in e?rr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t,r)=>nr(e,typeof t!="symbol"?t+"":t,r),ht,R=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e))(R||{}),v=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(v||{}),B=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(B||{}),Q=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Q||{}),he=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(he||{}),ae=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ae||{}),A=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(A||{}),ft={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},pt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Re={},Ot={},sr=()=>!!globalThis.Zone;function it(e){if(Re[e])return Re[e];let t=globalThis[e],r=t.prototype,n=e in ft?ft[e]:void 0,s=!!(n&&n.every(c=>{var i,h;return!!((h=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&h.toString().includes("[native code]"))})),o=e in pt?pt[e]:void 0,a=!!(o&&o.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(s&&a&&!sr())return Re[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let h=i[e].prototype;if(!h)return c.remove(),r;let u=navigator.userAgent;return u.includes("Safari")&&!u.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),Ot[e]=()=>c.remove()):c.remove(),Re[e]=h}catch{return r}}var Ve={};function H(e,t,r){var n,s;let o=(n=Ve[e])==null?void 0:n[r];if(o)return o.call(t);let a=it(e),c=(s=Object.getOwnPropertyDescriptor(a,r))==null?void 0:s.get;return c?((Ve[e]||(Ve[e]={}))[r]=c,c.call(t)):t[r]}var je={};function Et(e,t,r){let n=`${e}.${String(r)}`;if(je[n])return je[n].bind(t);let o=it(e)[r];return typeof o!="function"?t[r]:(je[n]=o,o.bind(t))}function or(e){return H("Node",e,"ownerDocument")}function ir(e){return H("Node",e,"childNodes")}function ar(e){return H("Node",e,"parentNode")}function lr(e){return H("Node",e,"parentElement")}function cr(e){return H("Node",e,"textContent")}function ur(e){return H("Node",e,"firstChild")}function dr(e){return H("Node",e,"lastChild")}function hr(e){return H("Node",e,"nextSibling")}function fr(e){return H("Node",e,"previousSibling")}function pr(e,t){return Et("Node",e,"contains")(t)}function mr(e){return Et("Node",e,"getRootNode")()}function gr(e){return!e||!("host"in e)?null:H("ShadowRoot",e,"host")}function yr(e){return e.styleSheets}function Sr(e){return!e||!("shadowRoot"in e)?null:H("Element",e,"shadowRoot")}function br(e,t){return H("Element",e,"querySelector")(t)}function Cr(e,t){return H("Element",e,"querySelectorAll")(t)}function Nt(){return[it("MutationObserver").constructor,Ot.MutationObserver??(()=>{})]}var be=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(be=()=>new Date().getTime());function oe(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}var b={ownerDocument:or,childNodes:ir,parentNode:ar,parentElement:lr,textContent:cr,firstChild:ur,lastChild:dr,nextSibling:hr,previousSibling:fr,contains:pr,getRootNode:mr,host:gr,styleSheets:yr,shadowRoot:Sr,querySelector:br,querySelectorAll:Cr,nowTimestamp:be,mutationObserverCtor:Nt,patch:oe};function kt(e){return e.nodeType===e.ELEMENT_NODE}function ge(e){let t=e&&"host"in e&&"mode"in e&&b.host(e)||null;return!!(t&&"shadowRoot"in t&&b.shadowRoot(t)===e)}function ye(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function wr(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Mr(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Xe(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,s=>Tt(s,r)).join("");return wr(n)}catch{return null}}function Tt(e,t){if(Ir(e)){let r;try{r=Xe(e.styleSheet)||Mr(e)}catch{r=e.cssText}return e.styleSheet.href?_e(r,e.styleSheet.href):r}else{let r=e.cssText;return Rr(e)&&e.selectorText.includes(":")&&(r=vr(r)),t?_e(r,t):r}}function vr(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Ir(e){return"styleSheet"in e}function Rr(e){return"selectorText"in e}var xe=class{constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Or(){return new xe}function Le({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:o}){let a=s||"",c=n&&ee(n);return(t[r.toLowerCase()]||c&&t[c])&&(o?a=o(a,e):a="*".repeat(a.length)),a}function ee(e){return e.toLowerCase()}var mt="__rrweb_original__";function Er(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let o=t.getImageData,a=mt in o?o[mt]:o;if(new Uint32Array(a.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(i=>i!==0))return!1}return!0}function De(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ee(t):null}function xt(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(n);return s?.[1]??null}function Nr(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var kr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Tr=/^(?:[a-z+]+:)?\/\//i,xr=/^www\..*/i,Lr=/^(data:)([^,]*),(.*)/i;function _e(e,t){return(e||"").replace(kr,(r,n,s,o,a,c)=>{let i=s||a||c,h=n||o||"";if(!i)return r;if(Tr.test(i)||xr.test(i))return`url(${h}${i}${h})`;if(Lr.test(i))return`url(${h}${i}${h})`;if(i[0]==="/")return`url(${h}${Nr(t)+i}${h})`;let u=i.split("#")[0],d=i.substring(u.length),p=t.split("#")[0].split("/"),f=u.split("/");p.pop();for(let m of f)m!=="."&&(m===".."?p.pop():p.push(m));return`url(${h}${p.join("/")}${d}${h})`})}var Lt="(?:/\\*[^*]*\\*/)|[\\s;]",Dr=new RegExp(`${Lt}|\\b(0)px?`,"g"),_r=new RegExp(Lt,"g");function Oe(e,t=!1){return t?e.replace(_r,""):e.replace(Dr,"$1")}function Ar(e,t,r=!1){let n=Array.from(t.childNodes),s=[],o=0;if(n.length>1&&e&&typeof e=="string"){let a=Oe(e,r),c=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){let h=Oe(n[i].textContent,r),u=100,d=3;for(;d<h.length&&(h[d].match(/[a-zA-Z0-9]/)||h.indexOf(h.substring(0,d),1)!==-1);d++);for(;d<h.length;d++){let p=h.substring(0,d),f=a.split(p),m=-1;if(f.length===2)m=f[0].length;else if(f.length>2&&f[0]===""&&n[i-1].textContent!=="")m=a.indexOf(p,1);else if(f.length===1){if(p=p.substring(0,p.length-1),f=a.split(p),f.length<=1)return s.push(e),s;d=u+1}else d===h.length-1&&(m=a.indexOf(p));if(f.length>=2&&d>u){let l=n[i-1].textContent;if(l&&typeof l=="string"){let S=Oe(l).length;m=a.indexOf(p,S)}m===-1&&(m=f[0].length)}if(m!==-1){let l=Math.floor(m/c);for(;l>0&&l<e.length;){if(o+=1,o>50*n.length)return s.push(e),s;let S=Oe(e.substring(0,l),r);if(S.length===m){s.push(e.substring(0,l)),e=e.substring(l),a=a.substring(m);break}else S.length<m?l+=Math.max(1,Math.floor((m-S.length)/c)):l-=Math.max(1,Math.floor((S.length-m)*c))}break}}}}return s.push(e),s}function Fr(e,t){return Ar(e,t).join("/* rr_split */")}var Pr=1,Wr=new RegExp("[^a-z0-9-_:]"),Ae=-2;function Dt(){return Pr++}function Ur(e){if(e instanceof HTMLFormElement)return"form";let t=ee(e.tagName);return Wr.test(t)?"div":t}var ie,gt,Br=/^[^ \t\n\r\u000c]+/,zr=/^[, \t\n\r\u000c]+/;function Hr(e,t){if(t.trim()==="")return t;let r=0;function n(o){let a,c=o.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let s=[];for(;n(zr),!(r>=t.length);){let o=n(Br);if(o.slice(-1)===",")o=ce(e,o.substring(0,o.length-1)),s.push(o);else{let a="";o=ce(e,o);let c=!1;for(;;){let i=t.charAt(r);if(i===""){s.push((o+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,s.push((o+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return s.join(", ")}var yt=new WeakMap;function ce(e,t){return!t||t.trim()===""?t:at(e,t)}function Gr(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function at(e,t){let r=yt.get(e);if(r||(r=e.createElement("a"),yt.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function _t(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?ce(e,n):r==="srcset"?Hr(e,n):r==="style"?_e(n,at(e)):t==="object"&&r==="data"?ce(e,n):n)}function At(e,t,r){return["video","audio"].includes(e)&&ee(t)==="autoplay"}function Vr(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}function Fe(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Fe(b.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}return r?Fe(b.parentNode(e),t,r):!1}function Ft(e,t,r,n){let s;if(kt(e)){if(s=e,!b.childNodes(s).length)return!1}else{if(b.parentElement(e)===null)return!1;s=b.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(Fe(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}function jr(e,t,r){let n=e.contentWindow;if(!n)return;let s=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let c=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),s=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function $r(e,t,r){let n=!1,s;try{s=e.sheet}catch{return}if(s)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function qr(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:h,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:f,keepIframeSrcFn:m,newlyAddedElement:l=!1,cssCaptured:S=!1}=t,w=Xr(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:A.Document,childNodes:[],compatMode:e.compatMode}:{type:A.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:A.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return Jr(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:c,maskInputOptions:i,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:f,keepIframeSrcFn:m,newlyAddedElement:l,rootId:w});case e.TEXT_NODE:return Yr(e,{doc:r,needsMask:a,maskTextFn:h,rootId:w,cssCaptured:S});case e.CDATA_SECTION_NODE:return{type:A.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:A.Comment,textContent:b.textContent(e)||"",rootId:w};default:return!1}}function Xr(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Yr(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:o}=t,a=b.parentNode(e),c=a&&a.tagName,i="",h=c==="STYLE"?!0:void 0,u=c==="SCRIPT"?!0:void 0;return u?i="SCRIPT_PLACEHOLDER":o||(i=b.textContent(e),h&&i&&(i=_e(i,at(t.doc)))),!h&&!u&&i&&r&&(i=n?n(i,b.parentElement(e)):i.replace(/[\S]/g,"*")),{type:A.Text,textContent:i||"",rootId:s}}function Jr(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:c,dataURLOptions:i={},inlineImages:h,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:f}=t,m=Vr(e,n,s),l=Ur(e),S={},w=e.attributes.length;for(let y=0;y<w;y++){let M=e.attributes[y];At(l,M.name,M.value)||(S[M.name]=_t(r,l,ee(M.name),M.value))}if(l==="link"&&o){let y=Array.from(r.styleSheets).find(T=>T.href===e.href),M=null;y&&(M=Xe(y)),M&&(delete S.rel,delete S.href,S._cssText=M)}if(l==="style"&&e.sheet){let y=Xe(e.sheet);y&&(e.childNodes.length>1&&(y=Fr(y,e)),S._cssText=y)}if(["input","textarea","select"].includes(l)){let y=e.value,M=e.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&y?S.value=Le({element:e,type:De(e),tagName:l,value:y,maskInputOptions:a,maskInputFn:c}):M&&(S.checked=M)}if(l==="option"&&(e.selected&&!a.select?S.selected=!0:delete S.selected),l==="dialog"&&e.open&&(S.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),l==="canvas"&&u){if(e.__context==="2d")Er(e)||(S.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){let y=e.toDataURL(i.type,i.quality),M=r.createElement("canvas");M.width=e.width,M.height=e.height;let T=M.toDataURL(i.type,i.quality);y!==T&&(S.rr_dataURL=y)}}if(l==="img"&&h){ie||(ie=r.createElement("canvas"),gt=ie.getContext("2d"));let y=e,M=y.currentSrc||y.getAttribute("src")||"<unknown-src>",T=y.crossOrigin,x=()=>{y.removeEventListener("load",x);try{ie.width=y.naturalWidth,ie.height=y.naturalHeight,gt.drawImage(y,0,0),S.rr_dataURL=ie.toDataURL(i.type,i.quality)}catch(P){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x);return}else console.warn(`Cannot inline img src=${M}! Error: ${P}`)}y.crossOrigin==="anonymous"&&(T?S.crossOrigin=T:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?x():y.addEventListener("load",x)}if(["audio","video"].includes(l)){let y=S;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),m){let{width:y,height:M}=e.getBoundingClientRect();S={class:S.class,rr_width:`${y}px`,rr_height:`${M}px`}}l==="iframe"&&!d(S.src)&&(e.contentDocument||(S.rr_src=S.src),delete S.src);let C;try{customElements.get(l)&&(C=!0)}catch{}return{type:A.Element,tagName:l,attributes:S,childNodes:[],isSVG:Gr(e)||void 0,needBlock:m,rootId:f,isCustom:C}}function k(e){return e==null?"":e.toLowerCase()}function Pt(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Zr(e,t){if(t.comment&&e.type===A.Comment)return!0;if(e.type===A.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&xt(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(k(e.attributes.name).match(/^msapplication-tile(image|color)$/)||k(e.attributes.name)==="application-name"||k(e.attributes.rel)==="icon"||k(e.attributes.rel)==="apple-touch-icon"||k(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&k(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(k(e.attributes.property).match(/^(og|twitter|fb):/)||k(e.attributes.name).match(/^(og|twitter):/)||k(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(k(e.attributes.name)==="robots"||k(e.attributes.name)==="googlebot"||k(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(k(e.attributes.name)==="author"||k(e.attributes.name)==="generator"||k(e.attributes.name)==="framework"||k(e.attributes.name)==="publisher"||k(e.attributes.name)==="progid"||k(e.attributes.property).match(/^article:/)||k(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(k(e.attributes.name)==="google-site-verification"||k(e.attributes.name)==="yandex-verification"||k(e.attributes.name)==="csrf-token"||k(e.attributes.name)==="p:domain_verify"||k(e.attributes.name)==="verify-v1"||k(e.attributes.name)==="verification"||k(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function ue(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:h=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m={},inlineImages:l=!1,recordCanvas:S=!1,onSerialize:w,onIframeLoad:C,iframeLoadTimeout:y=5e3,onStylesheetLoad:M,stylesheetLoadTimeout:T=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:P=!1,cssCaptured:Y=!1}=t,{needsMask:G}=t,{preserveWhiteSpace:$=!0}=t;G||(G=Ft(e,a,c,G===void 0));let V=qr(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:G,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:m,inlineImages:l,recordCanvas:S,keepIframeSrcFn:x,newlyAddedElement:P,cssCaptured:Y});if(!V)return console.warn(e,"not serialized"),null;let J;n.hasNode(e)?J=n.getId(e):Zr(V,f)||!$&&V.type===A.Text&&!V.textContent.replace(/^\s+|\s+$/gm,"").length?J=Ae:J=Dt();let O=Object.assign(V,{id:J});if(n.add(e,O),J===Ae)return null;w&&w(e);let fe=!i;if(O.type===A.Element){fe=fe&&!O.needBlock,delete O.needBlock;let F=b.shadowRoot(e);F&&ye(F)&&(O.isShadowHost=!0)}if((O.type===A.Document||O.type===A.Element)&&fe){f.headWhitespace&&O.type===A.Element&&O.tagName==="head"&&($=!1);let F={doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:G,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:S,preserveWhiteSpace:$,onSerialize:w,onIframeLoad:C,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:T,keepIframeSrcFn:x,cssCaptured:!1};if(!(O.type===A.Element&&O.tagName==="textarea"&&O.attributes.value!==void 0)){O.type===A.Element&&O.attributes._cssText!==void 0&&typeof O.attributes._cssText=="string"&&(F.cssCaptured=!0);for(let te of Array.from(b.childNodes(e))){let Z=ue(te,F);Z&&O.childNodes.push(Z)}}let j=null;if(kt(e)&&(j=b.shadowRoot(e)))for(let te of Array.from(b.childNodes(j))){let Z=ue(te,F);Z&&(ye(j)&&(Z.isShadow=!0),O.childNodes.push(Z))}}let pe=b.parentNode(e);return pe&&ge(pe)&&ye(pe)&&(O.isShadow=!0),O.type===A.Element&&O.tagName==="iframe"&&jr(e,()=>{let F=e.contentDocument;if(F&&C){let j=ue(F,{doc:F,mirror:n,blockClass:s,blockSelector:o,needsMask:G,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:S,preserveWhiteSpace:$,onSerialize:w,onIframeLoad:C,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:T,keepIframeSrcFn:x});j&&C(e,j)}},y),O.type===A.Element&&O.tagName==="link"&&typeof O.attributes.rel=="string"&&(O.attributes.rel==="stylesheet"||O.attributes.rel==="preload"&&typeof O.attributes.href=="string"&&xt(O.attributes.href)==="css")&&$r(e,()=>{if(M){let F=ue(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:G,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:h,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:S,preserveWhiteSpace:$,onSerialize:w,onIframeLoad:C,iframeLoadTimeout:y,onStylesheetLoad:M,stylesheetLoadTimeout:T,keepIframeSrcFn:x});F&&M(e,F)}},T),O}function Qr(e,t){let{mirror:r=new xe,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:h=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:f=!1,dataURLOptions:m,preserveWhiteSpace:l,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:C,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:T=()=>!1}=t,x=u===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:u===!1?{password:!0}:u,P=Pt(f);return ue(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:x,maskTextFn:d,maskInputFn:p,slimDOMOptions:P,dataURLOptions:m,inlineImages:i,recordCanvas:h,preserveWhiteSpace:l,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:C,onStylesheetLoad:y,stylesheetLoadTimeout:M,keepIframeSrcFn:T,newlyAddedElement:!1})}var Ye=class e{constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function W(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var le=`Please stop import mirror directly. Instead of that,\r
|
|
2
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,St={map:{},getId(){return console.error(le),-1},getNode(){return console.error(le),null},removeNodeFromMap(){console.error(le)},has(){return console.error(le),!1},reset(){console.error(le)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(St=new Proxy(St,{get(e,t,r){return t==="map"&&console.error(le),Reflect.get(e,t,r)}}));function Ce(e,t,r={}){let n=null,s=0;return function(...o){let a=Date.now();!s&&r.leading===!1&&(s=a);let c=t-(a-s),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),s=a,e.apply(i,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(i,o)},c))}}function Be(e,t,r,n,s=window){let o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>Be(e,t,o||{},!0)}function Wt(e){var t,r,n,s;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=b.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=b.parentElement(o.body))==null?void 0:n.scrollTop)||((s=o?.body)==null?void 0:s.scrollTop)||0}}function Ut(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Bt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function zt(e){return e?e.nodeType===e.ELEMENT_NODE?e:b.parentElement(e):null}function U(e,t,r,n){if(!e)return!1;let s=zt(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return!0}else if(Fe(s,t,n))return!0}catch{}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}function Kr(e,t){return t.getId(e)!==-1}function $e(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Ae}function Ht(e,t){if(ge(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=b.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Ht(n,t):!0}function Je(e){return!!e.changedTouches}function en(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Gt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Vt(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Ze(e){return e?e instanceof Ye&&"shadowRoot"in e?!!e.shadowRoot:!!b.shadowRoot(e):!1}var Qe=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function jt(e){var t;let r=null;return"getRootNode"in e&&((t=b.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&b.host(b.getRootNode(e))&&(r=b.host(b.getRootNode(e))),r}function tn(e){let t=e,r;for(;r=jt(t);)t=r;return t}function rn(e){let t=b.ownerDocument(e);if(!t)return!1;let r=tn(e);return b.contains(t,r)}function $t(e){let t=b.ownerDocument(e);return t?b.contains(t,e)||rn(e):!1}var bt=(e,t)=>`${e}@${t}`,Ke=class{constructor(){g(this,"frozen",!1),g(this,"locked",!1),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"canvasManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let p of this.movedSet){let f=b.parentNode(p);this.removesSubTreeCache.has(f)&&!this.movedSet.has(f)||this.addedSet.add(p)}let n=null,s=null,o=-1,a=null,c=!1,i=new Set,h=this.addedSet.values(),u=h.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(b.previousSibling(n)))a=n,n=b.previousSibling(n);else{for(this.addedSet.has(u.value)||(u=h.next()),n=u.value;;){if(s=b.parentNode(n),this.addedSet.has(s)){n=s;continue}break}if(i.has(s))s=null;else if(s){if($t(s)?(c=Ct(this.droppedSet,s)||this.removesSubTreeCache.has(s),c&&Ct(this.movedSet,n)&&(c=!1)):c=!0,this.addedSet.has(b.lastChild(s)))n=b.lastChild(s),a=null;else for(;;){if(a=b.nextSibling(n),this.addedSet.has(a)){n=a;continue}break}if(o=ge(s)?this.mirror.getId(jt(n)):this.mirror.getId(s),o===-1&&s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let l=b.host(s);o=this.mirror.getId(l)}}}if(this.addedSet.delete(n),!s||o===-1){i.add(n);continue}else if(c){this.droppedSet.add(n);continue}let p=!1;if(n.nodeType===Node.TEXT_NODE){let l=s.tagName;if(l==="TEXTAREA")continue;l==="STYLE"&&r.has(o)&&(p=!0)}let f=a?this.mirror.getId(a):null;for(;f===Ae;)a=a&&b.nextSibling(a),f=a&&this.mirror.getId(a);if(f===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",a),n=null;continue}let m=ue(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:l=>{Gt(l,this.mirror)&&this.iframeManager.addIframe(l),Vt(l,this.mirror)&&this.stylesheetManager.trackLinkElement(l),Ze(n)&&this.shadowDomManager.addShadowRoot(b.shadowRoot(n),this.doc)},onIframeLoad:(l,S)=>{this.iframeManager.attachIframe(l,S),this.shadowDomManager.observeAttachShadow(l)},onStylesheetLoad:(l,S)=>{this.stylesheetManager.attachLinkElement(l,S)},cssCaptured:p});m&&(t.push({parentId:o,nextId:f,node:m}),r.add(m.id))}let d={texts:this.texts.map(p=>{let f=p.node,m=b.parentNode(f);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(f),value:p.value}}).filter(p=>!r.has(p.id)).filter(p=>this.mirror.has(p.id)),attributes:this.attributes.map(p=>{let{attributes:f}=p;if(typeof f.style=="string"){let m=JSON.stringify(p.styleDiff),l=JSON.stringify(p._unchangedStyles);m.length<f.style.length&&(m+l).split("var(").length===f.style.split("var(").length&&(f.style=p.styleDiff)}return{id:this.mirror.getId(p.node),attributes:f}}).filter(p=>!r.has(p.id)).filter(p=>this.mirror.has(p.id)),removes:this.removes,adds:t};!d.texts.length&&!d.attributes.length&&!d.removes.length&&!d.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(d))}),g(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(b.childNodes(t),s=>b.textContent(s)||"").join("");r.attributes.value=Le({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:De(t),value:n,maskInputFn:this.maskInputFn})}),g(this,"processMutation",t=>{if(!$e(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=b.textContent(t.target);!U(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Ft(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,zt(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=ee(r.tagName),s=t.attributeName,o=t.target.getAttribute(s);if(s==="value"){let c=De(r);o=Le({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:o,maskInputFn:this.maskInputFn})}if(U(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(n==="iframe"&&s==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)s="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),s==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!At(n,s))if(a.attributes[s]=_t(this.doc,n,ee(s),o),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let h=r.style.getPropertyValue(i),u=r.style.getPropertyPriority(i);h!==c.style.getPropertyValue(i)||u!==c.style.getPropertyPriority(i)?u===""?a.styleDiff[i]=h:a.styleDiff[i]=[h,u]:a._unchangedStyles[i]=[h,u]}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(U(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),s=ge(t.target)?this.mirror.getId(b.host(t.target)):this.mirror.getId(t.target);U(t.target,this.blockClass,this.blockSelector,!1)||$e(r,this.mirror,this.slimDOMOptions)||!Kr(r,this.mirror)||(this.addedSet.has(r)?(et(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Ht(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[bt(n,s)]?et(this.movedSet,r):(this.removes.push({parentId:s,id:n,isShadow:ge(t.target)&&ye(t.target)?!0:void 0}),nn(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),g(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if($e(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[bt(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);U(t,this.blockClass,this.blockSelector,!1)||(b.childNodes(t).forEach(n=>this.genAdds(n)),Ze(t)&&b.childNodes(b.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}};function et(e,t){e.delete(t),b.childNodes(t).forEach(r=>et(e,r))}function nn(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),b.childNodes(n).forEach(s=>r.push(s)))}}function Ct(e,t){return e.size===0?!1:qt(e,t)}function qt(e,t){if(e.has(t))return!0;let r=b.parentNode(t);return r?qt(e,r):!1}var Se;function sn(e){Se=e}function on(){Se=void 0}var I=e=>Se?(...r)=>{try{return e(...r)}catch(n){if(Se&&Se(n)===!0)return;throw n}}:e,se=[];function we(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Xt(e,t){let r=new Ke;se.push(r),r.init(e);let[n,s]=Nt(),o=new n(I(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[o,s]}function an({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=Ce(I(d=>{let p=Date.now()-c;e(a.map(f=>(f.timeOffset-=p,f)),d),a=[],c=null}),o),h=I(Ce(I(d=>{let p=we(d),{clientX:f,clientY:m}=Je(d)?d.changedTouches[0]:d;c||(c=be()),a.push({x:f,y:m,id:n.getId(p),timeOffset:be()-c}),i(typeof DragEvent<"u"&&d instanceof DragEvent?v.Drag:d instanceof MouseEvent?v.MouseMove:v.TouchMove)}),s,{trailing:!1})),u=[W("mousemove",h,r),W("touchmove",h,r),W("drag",h,r)];return I(()=>{u.forEach(d=>d())})}function ln({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[],i=null,h=u=>d=>{let p=we(d);if(U(p,n,s,!0))return;let f=null,m=u;if("pointerType"in d){switch(d.pointerType){case"mouse":f=Q.Mouse;break;case"touch":f=Q.Touch;break;case"pen":f=Q.Pen;break}f===Q.Touch?B[u]===B.MouseDown?m="TouchStart":B[u]===B.MouseUp&&(m="TouchEnd"):Q.Pen}else Je(d)&&(f=Q.Touch);f!==null?(i=f,(m.startsWith("Touch")&&f===Q.Touch||m.startsWith("Mouse")&&f===Q.Mouse)&&(f=null)):B[u]===B.Click&&(f=i,i=null);let l=Je(d)?d.changedTouches[0]:d;if(!l)return;let S=r.getId(p),{clientX:w,clientY:C}=l;I(e)({type:B[m],id:S,x:w,y:C,...f!==null&&{pointerType:f}})};return Object.keys(B).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{let d=ee(u),p=h(u);if(window.PointerEvent)switch(B[u]){case B.MouseDown:case B.MouseUp:d=d.replace("mouse","pointer");break;case B.TouchStart:case B.TouchEnd:return}c.push(W(d,p,t))}),I(()=>{c.forEach(u=>u())})}function Yt({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){let a=I(Ce(I(c=>{let i=we(c);if(!i||U(i,n,s,!0))return;let h=r.getId(i);if(i===t&&t.defaultView){let u=Wt(t.defaultView);e({id:h,x:u.left,y:u.top})}else e({id:h,x:i.scrollLeft,y:i.scrollTop})}),o.scroll||100));return W("scroll",a,t)}function cn({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=I(Ce(I(()=>{let o=Ut(),a=Bt();(r!==o||n!==a)&&(e({width:Number(a),height:Number(o)}),r=o,n=a)}),200));return W("resize",s,t)}var un=["INPUT","TEXTAREA","SELECT"],wt=new WeakMap;function dn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:h,userTriggeredOnInput:u}){function d(C){let y=we(C),M=C.isTrusted,T=y&&y.tagName;if(y&&T==="OPTION"&&(y=b.parentElement(y)),!y||!T||un.indexOf(T)<0||U(y,n,s,!0)||y.classList.contains(o)||a&&y.matches(a))return;let x=y.value,P=!1,Y=De(y)||"";Y==="radio"||Y==="checkbox"?P=y.checked:(c[T.toLowerCase()]||c[Y])&&(x=Le({element:y,maskInputOptions:c,tagName:T,type:Y,value:x,maskInputFn:i})),p(y,u?{text:x,isChecked:P,userTriggered:M}:{text:x,isChecked:P});let G=y.name;Y==="radio"&&G&&P&&t.querySelectorAll(`input[type="radio"][name="${G}"]`).forEach($=>{if($!==y){let V=$.value;p($,u?{text:V,isChecked:!P,userTriggered:!1}:{text:V,isChecked:!P})}})}function p(C,y){let M=wt.get(C);if(!M||M.text!==y.text||M.isChecked!==y.isChecked){wt.set(C,y);let T=r.getId(C);I(e)({...y,id:T})}}let m=(h.input==="last"?["change"]:["input","change"]).map(C=>W(C,I(d),t)),l=t.defaultView;if(!l)return()=>{m.forEach(C=>C())};let S=l.Object.getOwnPropertyDescriptor(l.HTMLInputElement.prototype,"value"),w=[[l.HTMLInputElement.prototype,"value"],[l.HTMLInputElement.prototype,"checked"],[l.HTMLSelectElement.prototype,"value"],[l.HTMLTextAreaElement.prototype,"value"],[l.HTMLSelectElement.prototype,"selectedIndex"],[l.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&m.push(...w.map(C=>Be(C[0],C[1],{set(){I(d)({target:this,isTrusted:!1})}},!1,l))),I(()=>{m.forEach(C=>C())})}function Pe(e){let t=[];function r(n,s){if(Ee("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ee("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ee("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ee("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(a),r(n.parentRule,s)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(a)}return s}return r(e,t)}function K(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function hn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:I((u,d,p)=>{let[f,m]=p,{id:l,styleId:S}=K(d,t,r.styleMirror);return(l&&l!==-1||S&&S!==-1)&&e({id:l,styleId:S,adds:[{rule:f,index:m}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let f=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[f,p])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:I((u,d,p)=>{let[f]=p,{id:m,styleId:l}=K(d,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,removes:[{index:f}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:I((u,d,p)=>{let[f]=p,{id:m,styleId:l}=K(d,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replace:f}),u.apply(d,p)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:I((u,d,p)=>{let[f]=p,{id:m,styleId:l}=K(d,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replaceSync:f}),u.apply(d,p)})}));let i={};Ne("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(Ne("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),Ne("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),Ne("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let h={};return Object.entries(i).forEach(([u,d])=>{h[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(h[u].insertRule,{apply:I((p,f,m)=>{let[l,S]=m,{id:w,styleId:C}=K(f.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||C&&C!==-1)&&e({id:w,styleId:C,adds:[{rule:l,index:[...Pe(f),S||0]}]}),p.apply(f,m)})}),d.prototype.deleteRule=new Proxy(h[u].deleteRule,{apply:I((p,f,m)=>{let[l]=m,{id:S,styleId:w}=K(f.parentStyleSheet,t,r.styleMirror);return(S&&S!==-1||w&&w!==-1)&&e({id:S,styleId:w,removes:[{index:[...Pe(f),l]}]}),p.apply(f,m)})})}),I(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([u,d])=>{d.prototype.insertRule=h[u].insertRule,d.prototype.deleteRule=h[u].deleteRule})})}function Jt({mirror:e,stylesheetManager:t},r){var n,s,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(b.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:o.ShadowRoot,i=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var h;return(h=i.get)==null?void 0:h.call(this)},set(h){var u;let d=(u=i.set)==null?void 0:u.call(this,h);if(a!==null&&a!==-1)try{t.adoptStyleSheets(h,a)}catch{}return d}}),I(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function fn({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:I((c,i,h)=>{var u;let[d,p,f]=h;if(r.has(d))return o.apply(i,[d,p,f]);let{id:m,styleId:l}=K((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,set:{property:d,value:p,priority:f},index:Pe(i.parentRule)}),c.apply(i,h)})});let a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:I((c,i,h)=>{var u;let[d]=h;if(r.has(d))return a.apply(i,[d]);let{id:p,styleId:f}=K((u=i.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,remove:{property:d},index:Pe(i.parentRule)}),c.apply(i,h)})}),I(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}function pn({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:o}){let a=I(i=>Ce(I(h=>{let u=we(h);if(!u||U(u,t,r,!0))return;let{currentTime:d,volume:p,muted:f,playbackRate:m,loop:l}=u;e({type:i,id:n.getId(u),currentTime:d,volume:p,muted:f,playbackRate:m,loop:l})}),s.media||500)),c=[W("play",a(ae.Play),o),W("pause",a(ae.Pause),o),W("seeked",a(ae.Seeked),o),W("volumechange",a(ae.VolumeChange),o),W("ratechange",a(ae.RateChange),o)];return I(()=>{c.forEach(i=>i())})}function mn({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,o=r.FontFace;r.FontFace=function(i,h,u){let d=new o(i,h,u);return s.set(d,{family:i,buffer:typeof h!="string",descriptors:u,fontSource:typeof h=="string"?h:JSON.stringify(Array.from(new Uint8Array(h)))}),d};let a=oe(t.fonts,"add",function(c){return function(i){return setTimeout(I(()=>{let h=s.get(i);h&&(e(h),s.delete(i))}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=o}),n.push(a),I(()=>{n.forEach(c=>c())})}function gn(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:o}=e,a=!0,c=I(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let h=[],u=i.rangeCount||0;for(let d=0;d<u;d++){let p=i.getRangeAt(d),{startContainer:f,startOffset:m,endContainer:l,endOffset:S}=p;U(f,n,s,!0)||U(l,n,s,!0)||h.push({start:r.getId(f),startOffset:m,end:r.getId(l),endOffset:S})}o({ranges:h})});return c(),W("selectionchange",c)}function yn({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:oe(r.customElements,"define",function(s){return function(o,a,c){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return s.apply(this,[o,a,c])}})}function Sn(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:h,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:f,customElementCb:m}=e;e.mutationCb=(...l)=>{t.mutation&&t.mutation(...l),r(...l)},e.mousemoveCb=(...l)=>{t.mousemove&&t.mousemove(...l),n(...l)},e.mouseInteractionCb=(...l)=>{t.mouseInteraction&&t.mouseInteraction(...l),s(...l)},e.scrollCb=(...l)=>{t.scroll&&t.scroll(...l),o(...l)},e.viewportResizeCb=(...l)=>{t.viewportResize&&t.viewportResize(...l),a(...l)},e.inputCb=(...l)=>{t.input&&t.input(...l),c(...l)},e.mediaInteractionCb=(...l)=>{t.mediaInteaction&&t.mediaInteaction(...l),i(...l)},e.styleSheetRuleCb=(...l)=>{t.styleSheetRule&&t.styleSheetRule(...l),h(...l)},e.styleDeclarationCb=(...l)=>{t.styleDeclaration&&t.styleDeclaration(...l),u(...l)},e.canvasMutationCb=(...l)=>{t.canvasMutation&&t.canvasMutation(...l),d(...l)},e.fontCb=(...l)=>{t.font&&t.font(...l),p(...l)},e.selectionCb=(...l)=>{t.selection&&t.selection(...l),f(...l)},e.customElementCb=(...l)=>{t.customElement&&t.customElement(...l),m(...l)}}function bn(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};Sn(e,t);let n,s=()=>{};e.recordDOM&&([n,s]=Xt(e,e.doc));let o=an(e),a=ln(e),c=Yt(e),i=cn(e,{win:r}),h=dn(e),u=pn(e),d=()=>{},p=()=>{},f=()=>{},m=()=>{};e.recordDOM&&(d=hn(e,{win:r}),p=Jt(e,e.doc),f=fn(e,{win:r}),e.collectFonts&&(m=mn(e)));let l=gn(e),S=yn(e),w=[];for(let C of e.plugins)w.push(C.observer(C.callback,r,C.options));return I(()=>{se.forEach(C=>C.reset()),n?.disconnect(),s(),o(),a(),c(),i(),h(),u(),d(),p(),f(),m(),l(),S(),w.forEach(C=>C())})}function Ee(e){return typeof window[e]<"u"}function Ne(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var We=class{constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,s){let o=n||this.getIdToRemoteIdMap(t),a=s||this.getRemoteIdToIdMap(t),c=o.get(r);return c||(c=this.generateIdFn(),o.set(r,c),a.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,s))}getRemoteId(t,r,n){let s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=s.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},tt=class{constructor(t){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new We(Dt)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new We(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n,s;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(s=this.loadListener)==null||s.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let s=this.crossOriginIframeMap.get(t.source);if(!s)return;let o=this.transformCrossOriginEvent(s,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case R.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:R.IncrementalSnapshot,data:{source:v.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case R.Meta:case R.Load:case R.DomContentLoaded:return!1;case R.Plugin:return r;case R.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case R.IncrementalSnapshot:switch(r.data.source){case v.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(s.node,o)}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"])}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"])}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case v.Drag:case v.TouchMove:case v.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case v.ViewportResize:return!1;case v.MediaInteraction:case v.MouseInteraction:case v.Scroll:case v.CanvasMutation:case v.Input:return this.replaceIds(r.data,t,["id"]),r;case v.StyleSheetRule:case v.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case v.Font:return r;case v.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"])}),r;case v.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(s=>{this.replaceStyleIds(s,t,["styleId"])}),r}}return!1}replace(t,r,n,s){for(let o of s)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==A.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},rt=class{constructor(t){g(this,"shadowDoms",new WeakSet),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!ye(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let[n]=Xt({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(Yt({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(b.host(t))),this.restoreHandlers.push(Jt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(oe(t.prototype,"attachShadow",function(s){return function(o){let a=s.call(this,o),c=b.shadowRoot(this);return c&&$t(this)&&n.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},de="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(me=0;me<de.length;me++)Cn[de.charCodeAt(me)]=me;var me,wn=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=de[t[r]>>2],s+=de[(t[r]&3)<<4|t[r+1]>>4],s+=de[(t[r+1]&15)<<2|t[r+2]>>6],s+=de[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},Mt=new Map;function Mn(e,t){let r=Mt.get(e);return r||(r=new Map,Mt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Zt=(e,t,r)=>{if(!e||!(Kt(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=Mn(r,n),o=s.indexOf(e);return o===-1&&(o=s.length,s.push(e)),o};function ke(e,t,r){if(e instanceof Array)return e.map(n=>ke(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,s=wn(e);return{rr_type:n,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ke(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:s}=e;return{rr_type:n,src:s}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",s=e.toDataURL();return{rr_type:n,src:s}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[ke(e.data,t,r),e.width,e.height]};if(Kt(e,t)||typeof e=="object"){let n=e.constructor.name,s=Zt(e,t,r);return{rr_type:n,index:s}}}}return e}var Qt=(e,t,r)=>e.map(n=>ke(n,t,r)),Kt=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function vn(e,t,r,n){let s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=oe(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...h){return U(this.canvas,r,n,!0)||setTimeout(()=>{let u=Qt(h,t,this);e(this.canvas,{type:he["2D"],property:a,args:u})},0),i.apply(this,h)}});s.push(c)}catch{let c=Be(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:he["2D"],property:a,args:[i],setter:!0})}});s.push(c)}return()=>{s.forEach(a=>a())}}function In(e){return e==="experimental-webgl"?"webgl":e}function vt(e,t,r,n){let s=[];try{let o=oe(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!U(this,t,r,!0)){let h=In(c);if("__context"in this||(this.__context=h),n&&["webgl","webgl2"].includes(h))if(i[0]&&typeof i[0]=="object"){let u=i[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});s.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(o=>o())}}function It(e,t,r,n,s,o){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let h=oe(e,i,function(u){return function(...d){let p=u.apply(this,d);if(Zt(p,o,this),"tagName"in this.canvas&&!U(this.canvas,n,s,!0)){let f=Qt(d,o,this),m={type:t,property:i,args:f};r(this.canvas,m)}return p}});a.push(h)}catch{let h=Be(e,i,{set(u){r(this.canvas,{type:t,property:i,args:[u],setter:!0})}});a.push(h)}return a}function Rn(e,t,r,n){let s=[];return typeof t.WebGLRenderingContext<"u"&&s.push(...It(t.WebGLRenderingContext.prototype,he.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...It(t.WebGL2RenderingContext.prototype,he.WebGL2,e,r,n,t)),()=>{s.forEach(o=>o())}}var er=`(function() {
|
|
4
|
+
"use strict";
|
|
5
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
|
+
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
7
|
+
for (var i = 0; i < chars.length; i++) {
|
|
8
|
+
lookup[chars.charCodeAt(i)] = i;
|
|
9
|
+
}
|
|
10
|
+
var encode = function(arraybuffer) {
|
|
11
|
+
var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";
|
|
12
|
+
for (i2 = 0; i2 < len; i2 += 3) {
|
|
13
|
+
base64 += chars[bytes[i2] >> 2];
|
|
14
|
+
base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];
|
|
15
|
+
base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];
|
|
16
|
+
base64 += chars[bytes[i2 + 2] & 63];
|
|
17
|
+
}
|
|
18
|
+
if (len % 3 === 2) {
|
|
19
|
+
base64 = base64.substring(0, base64.length - 1) + "=";
|
|
20
|
+
} else if (len % 3 === 1) {
|
|
21
|
+
base64 = base64.substring(0, base64.length - 2) + "==";
|
|
22
|
+
}
|
|
23
|
+
return base64;
|
|
24
|
+
};
|
|
25
|
+
const lastBlobMap = /* @__PURE__ */ new Map();
|
|
26
|
+
const transparentBlobMap = /* @__PURE__ */ new Map();
|
|
27
|
+
async function getTransparentBlobFor(width, height, dataURLOptions) {
|
|
28
|
+
const id = \`\${width}-\${height}\`;
|
|
29
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
30
|
+
if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
|
|
31
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
32
|
+
offscreen.getContext("2d");
|
|
33
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
34
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
35
|
+
const base64 = encode(arrayBuffer);
|
|
36
|
+
transparentBlobMap.set(id, base64);
|
|
37
|
+
return base64;
|
|
38
|
+
} else {
|
|
39
|
+
return "";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const worker = self;
|
|
43
|
+
worker.onmessage = async function(e) {
|
|
44
|
+
if ("OffscreenCanvas" in globalThis) {
|
|
45
|
+
const { id, bitmap, width, height, dataURLOptions } = e.data;
|
|
46
|
+
const transparentBase64 = getTransparentBlobFor(
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
dataURLOptions
|
|
50
|
+
);
|
|
51
|
+
const offscreen = new OffscreenCanvas(width, height);
|
|
52
|
+
const ctx = offscreen.getContext("2d");
|
|
53
|
+
ctx.drawImage(bitmap, 0, 0);
|
|
54
|
+
bitmap.close();
|
|
55
|
+
const blob = await offscreen.convertToBlob(dataURLOptions);
|
|
56
|
+
const type = blob.type;
|
|
57
|
+
const arrayBuffer = await blob.arrayBuffer();
|
|
58
|
+
const base64 = encode(arrayBuffer);
|
|
59
|
+
if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
|
|
60
|
+
lastBlobMap.set(id, base64);
|
|
61
|
+
return worker.postMessage({ id });
|
|
62
|
+
}
|
|
63
|
+
if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
|
|
64
|
+
worker.postMessage({
|
|
65
|
+
id,
|
|
66
|
+
type,
|
|
67
|
+
base64,
|
|
68
|
+
width,
|
|
69
|
+
height
|
|
70
|
+
});
|
|
71
|
+
lastBlobMap.set(id, base64);
|
|
72
|
+
} else {
|
|
73
|
+
return worker.postMessage({ id: e.data.id });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
})();
|
|
77
|
+
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
78
|
+
`,Rt=typeof self<"u"&&self.Blob&&new Blob([er],{type:"text/javascript;charset=utf-8"});function On(e){let t;try{if(t=Rt&&(self.URL||self.webkitURL).createObjectURL(Rt),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(er),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var nt=class{constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"processMutation",(i,h)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(h)});let{sampling:r="all",win:n,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,s,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,s,o,{dataURLOptions:c})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,s,o){let a=vt(r,n,s,!0),c=new Map,i=new On;i.onmessage=m=>{let{id:l}=m.data;if(c.set(l,!1),!("base64"in m.data))return;let{base64:S,type:w,width:C,height:y}=m.data;this.mutationCb({id:l,type:he["2D"],commands:[{property:"clearRect",args:[0,0,C,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:w}]},0,0]}]})};let h=1e3/t,u=0,d,p=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(l=>{U(l,n,s,!0)||m.push(l)}),m},f=m=>{if(u&&m-u<h){d=requestAnimationFrame(f);return}u=m,p().forEach(async l=>{var S;let w=this.mirror.getId(l);if(c.get(w)||l.width===0||l.height===0)return;if(c.set(w,!0),["webgl","webgl2"].includes(l.__context)){let y=l.getContext(l.__context);((S=y?.getContextAttributes())==null?void 0:S.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let C=await createImageBitmap(l);i.postMessage({id:w,bitmap:C,width:l.width,height:l.height,dataURLOptions:o.dataURLOptions},[C])}),d=requestAnimationFrame(f)};d=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let s=vt(t,r,n,!1),o=vn(this.processMutation.bind(this),t,r,n),a=Rn(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{s(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let s=n.map(a=>{let{type:c,...i}=a;return i}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:s}),this.pendingCanvasMutations.delete(t)}},st=class{constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new Qe),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},s=[];for(let o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(c,i)=>({rule:Tt(c,o.href),index:i}))})),n.styleIds.push(a)}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},ot=class{constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},_,Te,qe,Ue=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((ht=e.contentWindow)==null?void 0:ht.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var X=Or();function Me(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:h=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:f,maskInputFn:m,maskTextFn:l,hooks:S,packFn:w,sampling:C={},dataURLOptions:y={},mousemoveWait:M,recordDOM:T=!0,recordCanvas:x=!1,recordCrossOriginIframes:P=!1,recordAfter:Y=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:G=!1,collectFonts:$=!1,inlineImages:V=!1,plugins:J,keepIframeSrcFn:O=()=>!1,ignoreCSSAttributes:fe=new Set([]),errorHandler:pe}=e;sn(pe);let F=P?window.parent===window:!0,j=!1;if(!F)try{window.parent.document&&(j=!1)}catch{j=!0}if(F&&!t)throw new Error("emit function is required");if(!F&&!j)return()=>{};M!==void 0&&C.mousemove===void 0&&(C.mousemove=M),X.reset();let te=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},Z=Pt(f);en();let lt,ze=0,ct=E=>{for(let q of J||[])q.eventProcessor&&(E=q.eventProcessor(E));return w&&!j&&(E=w(E)),E};_=(E,q)=>{var L;let D=E;if(D.timestamp=be(),(L=se[0])!=null&&L.isFrozen()&&D.type!==R.FullSnapshot&&!(D.type===R.IncrementalSnapshot&&D.data.source===v.Mutation)&&se.forEach(z=>z.unfreeze()),F)t?.(ct(D),q);else if(j){let z={type:"rrweb",event:ct(D),origin:window.location.origin,isCheckout:q};window.parent.postMessage(z,"*")}if(D.type===R.FullSnapshot)lt=D,ze=0;else if(D.type===R.IncrementalSnapshot){if(D.data.source===v.Mutation&&D.data.isAttachIframe)return;ze++;let z=n&&ze>=n,N=r&&D.timestamp-lt.timestamp>r;(z||N)&&Te(!0)}};let ve=E=>{_({type:R.IncrementalSnapshot,data:{source:v.Mutation,...E}})},ut=E=>_({type:R.IncrementalSnapshot,data:{source:v.Scroll,...E}}),dt=E=>_({type:R.IncrementalSnapshot,data:{source:v.CanvasMutation,...E}}),tr=E=>_({type:R.IncrementalSnapshot,data:{source:v.AdoptedStyleSheet,...E}}),re=new st({mutationCb:ve,adoptedStyleSheetCb:tr}),ne=new tt({mirror:X,mutationCb:ve,stylesheetManager:re,recordCrossOriginIframes:P,wrappedEmit:_});for(let E of J||[])E.getMirror&&E.getMirror({nodeMirror:X,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});let He=new ot;qe=new nt({recordCanvas:x,mutationCb:dt,win:window,blockClass:s,blockSelector:o,mirror:X,sampling:C.canvas,dataURLOptions:y});let Ie=new rt({mutationCb:ve,scrollCb:ut,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:h,inlineStylesheet:u,maskInputOptions:te,dataURLOptions:y,maskTextFn:l,maskInputFn:m,recordCanvas:x,inlineImages:V,sampling:C,slimDOMOptions:Z,iframeManager:ne,stylesheetManager:re,canvasManager:qe,keepIframeSrcFn:O,processedNodeManager:He},mirror:X});Te=(E=!1)=>{if(!T)return;_({type:R.Meta,data:{href:window.location.href,width:Bt(),height:Ut()}},E),re.reset(),Ie.init(),se.forEach(L=>L.lock());let q=Qr(document,{mirror:X,blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:h,inlineStylesheet:u,maskAllInputs:te,maskTextFn:l,maskInputFn:m,slimDOM:Z,dataURLOptions:y,recordCanvas:x,inlineImages:V,onSerialize:L=>{Gt(L,X)&&ne.addIframe(L),Vt(L,X)&&re.trackLinkElement(L),Ze(L)&&Ie.addShadowRoot(b.shadowRoot(L),document)},onIframeLoad:(L,D)=>{ne.attachIframe(L,D),Ie.observeAttachShadow(L)},onStylesheetLoad:(L,D)=>{re.attachLinkElement(L,D)},keepIframeSrcFn:O});if(!q)return console.warn("Failed to snapshot the document");_({type:R.FullSnapshot,data:{node:q,initialOffset:Wt(window)}},E),se.forEach(L=>L.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&re.adoptStyleSheets(document.adoptedStyleSheets,X.getId(document))};try{let E=[],q=D=>{var z;return I(bn)({mutationCb:ve,mousemoveCb:(N,Ge)=>_({type:R.IncrementalSnapshot,data:{source:Ge,positions:N}}),mouseInteractionCb:N=>_({type:R.IncrementalSnapshot,data:{source:v.MouseInteraction,...N}}),scrollCb:ut,viewportResizeCb:N=>_({type:R.IncrementalSnapshot,data:{source:v.ViewportResize,...N}}),inputCb:N=>_({type:R.IncrementalSnapshot,data:{source:v.Input,...N}}),mediaInteractionCb:N=>_({type:R.IncrementalSnapshot,data:{source:v.MediaInteraction,...N}}),styleSheetRuleCb:N=>_({type:R.IncrementalSnapshot,data:{source:v.StyleSheetRule,...N}}),styleDeclarationCb:N=>_({type:R.IncrementalSnapshot,data:{source:v.StyleDeclaration,...N}}),canvasMutationCb:dt,fontCb:N=>_({type:R.IncrementalSnapshot,data:{source:v.Font,...N}}),selectionCb:N=>{_({type:R.IncrementalSnapshot,data:{source:v.Selection,...N}})},customElementCb:N=>{_({type:R.IncrementalSnapshot,data:{source:v.CustomElement,...N}})},blockClass:s,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:h,maskInputOptions:te,inlineStylesheet:u,sampling:C,recordDOM:T,recordCanvas:x,inlineImages:V,userTriggeredOnInput:G,collectFonts:$,doc:D,maskInputFn:m,maskTextFn:l,keepIframeSrcFn:O,blockSelector:o,slimDOMOptions:Z,dataURLOptions:y,mirror:X,iframeManager:ne,stylesheetManager:re,shadowDomManager:Ie,processedNodeManager:He,canvasManager:qe,ignoreCSSAttributes:fe,plugins:((z=J?.filter(N=>N.observer))==null?void 0:z.map(N=>({observer:N.observer,options:N.options,callback:Ge=>_({type:R.Plugin,data:{plugin:N.name,payload:Ge}})})))||[]},S)};ne.addLoadListener(D=>{try{E.push(q(D.contentDocument))}catch(z){console.warn(z)}});let L=()=>{Te(),E.push(q(document)),Ue=!0};return["interactive","complete"].includes(document.readyState)?L():(E.push(W("DOMContentLoaded",()=>{_({type:R.DomContentLoaded,data:{}}),Y==="DOMContentLoaded"&&L()})),E.push(W("load",()=>{_({type:R.Load,data:{}}),Y==="load"&&L()},window))),()=>{E.forEach(D=>{try{D()}catch(z){String(z).toLowerCase().includes("cross-origin")||console.warn(z)}}),He.destroy(),Ue=!1,on()}}catch(E){console.warn(E)}}Me.addCustomEvent=(e,t)=>{if(!Ue)throw new Error("please add custom event after start recording");_({type:R.Custom,data:{tag:e,payload:t}})};Me.freezePage=()=>{se.forEach(e=>e.freeze())};Me.takeFullSnapshot=e=>{if(!Ue)throw new Error("please take full snapshot after start recording");Te(e)};Me.mirror=X;export{Me as record};
|