@rxova/journey-devtools-bridge 0.3.0 → 0.5.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @rxova/journey-devtools-bridge
2
2
 
3
- Explicit bridge to connect Journey machines with browser devtools extensions.
3
+ Bridge that connects Journey machines to the browser devtools extension.
4
4
 
5
5
  ## Install
6
6
 
@@ -8,7 +8,7 @@ Explicit bridge to connect Journey machines with browser devtools extensions.
8
8
  npm i @rxova/journey-devtools-bridge
9
9
  ```
10
10
 
11
- ## Core Usage
11
+ ## Usage
12
12
 
13
13
  ```ts
14
14
  import { createJourneyMachine } from "@rxova/journey-core";
@@ -19,66 +19,24 @@ const machine = createJourneyMachine(journey);
19
19
  const detach = attachJourneyDevtools(machine, {
20
20
  label: "Checkout Flow"
21
21
  });
22
-
23
- // later
24
- // detach();
25
22
  ```
26
23
 
27
- ## React Usage
28
-
29
- ```tsx
30
- import { useEffect } from "react";
31
- import { useJourneyMachine } from "@rxova/journey-react";
32
- import { attachJourneyDevtools } from "@rxova/journey-devtools-bridge";
33
-
34
- export const JourneyDevtoolsBridge = () => {
35
- const machine = useJourneyMachine();
36
-
37
- useEffect(() => {
38
- return attachJourneyDevtools(machine, { label: "Signup Flow" });
39
- }, [machine]);
40
-
41
- return null;
42
- };
43
- ```
44
-
45
- ## API
46
-
47
- - `attachJourneyDevtools(machine, options?) => detach`
48
- - `JourneyDevtoolsBridgeOptions`
49
- - `JourneyDevtoolsCommand`
50
- - `JourneyDevtoolsEnvelope`
51
-
52
- Default behavior:
53
-
54
- - enabled when `NODE_ENV` is set to a non-production value
55
- - disabled in production and when `NODE_ENV` is unavailable (unless `enabled: true` is passed)
56
- - no-op when `window` is unavailable
57
- - commands enabled when `NODE_ENV` is set to a non-production value
58
- - commands disabled in production and when `NODE_ENV` is unavailable by default (unless `commandsEnabled: true` is passed)
59
-
60
- ## Breaking Behavior (This Branch)
61
-
62
- Legacy command-auth APIs were removed and are no longer supported in this branch.
63
-
64
- ## Migration Note
65
-
66
- If your production debugging flow sends commands from devtools, use explicit runtime opts:
67
-
68
- ```ts
69
- attachJourneyDevtools(machine, { enabled: true, commandsEnabled: true });
70
- ```
24
+ ## Protocol Notes
71
25
 
72
- If your browser bundle does not expose `process.env.NODE_ENV`, use the same explicit opts to enable the bridge.
26
+ Bridge command support includes:
73
27
 
74
- ## Threat Model Note
28
+ - `goToNextStep`, `terminateMachine`, `completeJourney`, `resetMachine`
29
+ - `goToStepById`
30
+ - `goToPreviousStep`
31
+ - `goToLastVisitedStep`
32
+ - `updateStepMetadata`
33
+ - `send` (custom event)
34
+ - `clearStepError`
75
35
 
76
- - Same-origin page scripts can emit synthetic `postMessage` envelopes.
77
- - Keep `commandsEnabled` disabled by default in production.
78
- - Prefer inspect-only mode in sensitive environments (`commandsEnabled: false`).
79
- - Bridge robustness controls include strict origin checks, rate limiting, and payload validation.
80
- - `window.postMessage` transport is visible to same-page scripts; this is not a hard boundary against malicious same-page code.
36
+ Snapshots include `history.timeline`, `history.index`, `currentStepId`, `visited`, `stepMeta`, `status`, and `async`.
81
37
 
82
- ## License
38
+ ## Runtime Defaults
83
39
 
84
- MIT
40
+ - Enabled in non-production by default.
41
+ - Disabled in production unless `enabled: true`.
42
+ - Commands disabled in production unless `commandsEnabled: true`.
package/dist/bridge.d.ts CHANGED
@@ -6,5 +6,4 @@ export type JourneyDevtoolsBridgeOptions = {
6
6
  appName?: string;
7
7
  commandsEnabled?: boolean;
8
8
  };
9
- export declare const attachJourneyDevtools: <TContext, TStepId extends string, TEventType extends string, TPayloadMap extends JourneyEventPayloadMap<TEventType>>(machine: JourneyMachine<TContext, TStepId, TEventType, TPayloadMap>, options?: JourneyDevtoolsBridgeOptions) => (() => void);
10
- //# sourceMappingURL=bridge.d.ts.map
9
+ export declare const attachJourneyDevtools: <TContext, TStepId extends string, TEventType extends string, TPayloadMap extends JourneyEventPayloadMap<TEventType>, TStepMeta>(machine: JourneyMachine<TContext, TStepId, TEventType, TPayloadMap, TStepMeta>, options?: JourneyDevtoolsBridgeOptions) => (() => void);
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var J=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var Y=(e,n)=>{for(var o in n)J(e,o,{get:n[o],enumerable:!0})},P=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of M(n))!A.call(e,r)&&r!==o&&J(e,r,{get:()=>n[r],enumerable:!(t=L(n,r))||t.enumerable});return e};var H=e=>P(J({},"__esModule",{value:!0}),e);var Q={};Y(Q,{JOURNEY_DEVTOOLS_BRIDGE_SOURCE:()=>c,JOURNEY_DEVTOOLS_CHANNEL:()=>m,JOURNEY_DEVTOOLS_EXTENSION_SOURCE:()=>E,JOURNEY_DEVTOOLS_PROTOCOL_VERSION:()=>g,attachJourneyDevtools:()=>b,isJourneyDevtoolsBridgeEnvelope:()=>O,isJourneyDevtoolsCommand:()=>D,isJourneyDevtoolsEnvelope:()=>v,isJourneyDevtoolsExtensionEnvelope:()=>h});module.exports=H(Q);var g=1,m="__RXOVA_JOURNEY_DEVTOOLS__",c="rxova-journey-bridge",E="rxova-journey-extension",p=e=>typeof e=="object"&&e!==null,V=e=>e===c||e===E;var u=(e,n=0)=>{if(n>10)return!1;if(e==null||["string","number","boolean"].includes(typeof e))return!0;if(typeof e=="object"){try{if(JSON.stringify(e).length>5e5)return!1}catch{return!1}return Array.isArray(e)?e.every(t=>u(t,n+1)):Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:Object.values(e).every(t=>u(t,n+1))}return!1},R=e=>p(e)?e.channel===m&&e.version===1&&V(e.source)&&typeof e.kind=="string"&&typeof e.machineId=="string"&&typeof e.timestamp=="number":!1,j=e=>!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>100?!1:"payload"in e&&e.payload!==void 0?u(e.payload):!0,D=e=>{if(!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>50)return!1;switch(e.type){case"next":case"back":case"close":case"submit":case"reset":case"clearHistory":return Object.keys(e).length===1;case"goTo":return typeof e.to=="string"&&e.to.length>0&&e.to.length<=100&&Object.keys(e).length===2;case"send":return j(e.event)&&Object.keys(e).length===2;case"clearStepError":return(e.stepId===void 0||typeof e.stepId=="string"&&e.stepId.length<=100)&&Object.keys(e).length<=2;case"trimHistory":return(e.maxHistory===void 0||e.maxHistory===null||typeof e.maxHistory=="number"&&Number.isInteger(e.maxHistory)&&e.maxHistory>=0&&e.maxHistory<=1e4)&&Object.keys(e).length<=2;default:return!1}},O=e=>{if(!R(e)||e.source!==c)return!1;let n=e;switch(e.kind){case"register":return p(n.meta)&&p(n.snapshot)&&u(n.meta)&&u(n.snapshot);case"unregister":return!0;case"snapshot":return p(n.snapshot)&&u(n.snapshot);case"commandResult":return typeof n.requestId=="string"&&n.requestId.length>0&&n.requestId.length<=100&&p(n.snapshot)&&u(n.snapshot);case"commandError":return typeof n.requestId=="string"&&n.requestId.length>0&&n.requestId.length<=100&&p(n.error);default:return!1}},h=e=>{if(!R(e)||e.source!==E||e.kind!=="command")return!1;let n=e;return typeof n.requestId=="string"&&n.requestId.length>0&&n.requestId.length<=100&&D(n.command)},v=e=>O(e)||h(e);var q="Journey Machine",z=e=>typeof e=="object"&&e!==null,X=e=>e==="idle"||e==="evaluating-when"||e==="running-effect"||e==="error",G=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},W=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},F=()=>typeof window>"u"||window.location.origin==="null"?"*":window.location.origin,K=e=>{if(e.length===0||typeof window>"u")return!1;let n=window.location.origin;return n==="null"?e==="null":e===n},$=()=>`journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,_=class{constructor(n=100,o=1e4){this.commandTimestamps=[];this.maxCommandsPerWindow=n,this.windowMs=o}isAllowed(){let n=Date.now(),o=n-this.windowMs;return this.commandTimestamps=this.commandTimestamps.filter(t=>t>o),this.commandTimestamps.length>=this.maxCommandsPerWindow?!1:(this.commandTimestamps.push(n),!0)}reset(){this.commandTimestamps=[]}},S=e=>{if(typeof structuredClone=="function")try{return structuredClone(e)}catch{}let n=new WeakSet;try{let o=JSON.stringify(e,(t,r)=>{if(typeof r=="bigint")return r.toString();if(typeof r=="function")return`[Function ${r.name||"anonymous"}]`;if(typeof r=="symbol")return r.toString();if(typeof r=="object"&&r!==null){if(n.has(r))return"[Circular]";n.add(r)}return r});return o===void 0?void 0:JSON.parse(o)}catch{return String(e)}},T=e=>{if(e instanceof Error){let n="cause"in e&&e.cause!==void 0?e.cause:null;return{name:e.name,message:e.message,stack:typeof e.stack=="string"?e.stack:null,cause:S(n)}}return{name:null,message:typeof e=="string"?e:"Unknown error",stack:null,cause:S(e)}},I=e=>{let n={};for(let[o,t]of Object.entries(e.async.byStep))z(t)&&(n[o]={phase:X(t.phase)?t.phase:"idle",eventType:typeof t.eventType=="string"?t.eventType:null,transitionId:typeof t.transitionId=="string"?t.transitionId:null,error:t.error===null?null:S(t.error)});return{current:String(e.current),context:S(e.context),history:e.history.map(o=>String(o)),visited:e.visited.map(o=>String(o)),status:e.status,async:{isLoading:e.async.isLoading,byStep:n}}},Z=async(e,n)=>{switch(n.type){case"next":case"back":case"close":case"submit":{let o=await e.send({type:n.type});return{snapshot:o.snapshot,transitioned:o.transitioned,...o.transitionId?{transitionId:o.transitionId}:{}}}case"goTo":{let o=await e.send({type:"goTo",to:n.to});return{snapshot:o.snapshot,transitioned:o.transitioned,...o.transitionId?{transitionId:o.transitionId}:{}}}case"send":{let o=n.event.payload===void 0?{type:n.event.type}:{type:n.event.type,payload:n.event.payload},t=await e.send(o);return{snapshot:t.snapshot,transitioned:t.transitioned,...t.transitionId?{transitionId:t.transitionId}:{}}}case"reset":return{snapshot:e.reset()};case"clearStepError":return{snapshot:e.clearStepError(n.stepId)};case"clearHistory":return{snapshot:e.clearHistory()};case"trimHistory":return{snapshot:e.trimHistory(n.maxHistory)}}},b=(e,n={})=>{if(!(n.enabled??G())||typeof window>"u")return()=>{};let t=n.commandsEnabled??W(),r=n.machineId?.trim()||$(),C={machineId:r,label:n.label?.trim()||q,appName:n.appName?.trim()||(typeof document<"u"?document.title:"")||null,commandsEnabled:t},N=F(),d=s=>({channel:m,version:1,source:c,kind:s,machineId:r,timestamp:Date.now()}),l=s=>{window.postMessage(s,N)},B=s=>{let a={...d("snapshot"),snapshot:I(s)};l(a)},y=!1,x=new _,w=s=>{if(s.source!==window||!K(s.origin)||y||!v(s.data)||s.data.source!==E||s.data.kind!=="command")return;let a=s.data;if(a.machineId!==r)return;if(!x.isAllowed()){let i={...d("commandError"),requestId:a.requestId,error:T("Command rate limit exceeded. Too many commands in a short time window.")};l(i);return}if(!t){let i={...d("commandError"),requestId:a.requestId,error:T("Bridge commands are disabled by configuration.")};l(i);return}(async()=>{try{let i=await Z(e,a.command);if(y)return;let f={...d("commandResult"),requestId:a.requestId,snapshot:I(i.snapshot),...i.transitioned!==void 0?{transitioned:i.transitioned}:{},...i.transitionId?{transitionId:i.transitionId}:{}};l(f)}catch(i){if(y)return;let f={...d("commandError"),requestId:a.requestId,error:T(i)};l(f)}})()};window.addEventListener("message",w);let k=e.subscribe(()=>{y||B(e.getSnapshot())}),U={...d("register"),meta:C,snapshot:I(e.getSnapshot())};return l(U),()=>{if(y)return;y=!0,x.reset(),k(),window.removeEventListener("message",w);let s={...d("unregister")};l(s)}};0&&(module.exports={JOURNEY_DEVTOOLS_BRIDGE_SOURCE,JOURNEY_DEVTOOLS_CHANNEL,JOURNEY_DEVTOOLS_EXTENSION_SOURCE,JOURNEY_DEVTOOLS_PROTOCOL_VERSION,attachJourneyDevtools,isJourneyDevtoolsBridgeEnvelope,isJourneyDevtoolsCommand,isJourneyDevtoolsEnvelope,isJourneyDevtoolsExtensionEnvelope});
1
+ "use strict";var f=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var P=(e,t)=>{for(var n in t)f(e,n,{get:t[n],enumerable:!0})},Y=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of U(t))!A.call(e,r)&&r!==n&&f(e,r,{get:()=>t[r],enumerable:!(o=L(t,r))||o.enumerable});return e};var V=e=>Y(f({},"__esModule",{value:!0}),e);var Q={};P(Q,{JOURNEY_DEVTOOLS_BRIDGE_SOURCE:()=>c,JOURNEY_DEVTOOLS_CHANNEL:()=>g,JOURNEY_DEVTOOLS_EXTENSION_SOURCE:()=>E,JOURNEY_DEVTOOLS_PROTOCOL_VERSION:()=>m,attachJourneyDevtools:()=>b,isJourneyDevtoolsBridgeEnvelope:()=>O,isJourneyDevtoolsCommand:()=>D,isJourneyDevtoolsEnvelope:()=>v,isJourneyDevtoolsExtensionEnvelope:()=>h});module.exports=V(Q);var m=3,g="__RXOVA_JOURNEY_DEVTOOLS__",c="rxova-journey-bridge",E="rxova-journey-extension",p=e=>typeof e=="object"&&e!==null,j=e=>e===c||e===E;var d=(e,t=0)=>{if(t>10)return!1;if(e==null||["string","number","boolean"].includes(typeof e))return!0;if(typeof e=="object"){try{if(JSON.stringify(e).length>5e5)return!1}catch{return!1}return Array.isArray(e)?e.every(o=>d(o,t+1)):Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:Object.values(e).every(o=>d(o,t+1))}return!1},x=e=>p(e)?e.channel===g&&e.version===3&&j(e.source)&&typeof e.kind=="string"&&typeof e.machineId=="string"&&typeof e.timestamp=="number":!1,q=e=>!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>100?!1:"payload"in e&&e.payload!==void 0?d(e.payload):!0,D=e=>{if(!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>50)return!1;switch(e.type){case"goToNextStep":case"terminateMachine":case"completeJourney":case"resetMachine":case"goToLastVisitedStep":return Object.keys(e).length===1;case"goToStepById":return typeof e.stepId=="string"&&e.stepId.length>0&&e.stepId.length<=100&&Object.keys(e).length===2;case"goToPreviousStep":return(e.steps===void 0||typeof e.steps=="number"&&Number.isInteger(e.steps)&&e.steps>=1&&e.steps<=1e4)&&Object.keys(e).length<=2;case"send":return q(e.event)&&Object.keys(e).length===2;case"updateStepMetadata":return typeof e.stepId=="string"&&e.stepId.length>0&&e.stepId.length<=100&&d(e.metadata)&&Object.keys(e).length===3;case"clearStepError":return(e.stepId===void 0||typeof e.stepId=="string"&&e.stepId.length<=100)&&Object.keys(e).length<=2;default:return!1}},O=e=>{if(!x(e)||e.source!==c)return!1;let t=e;switch(e.kind){case"register":return p(t.meta)&&p(t.snapshot)&&d(t.meta)&&d(t.snapshot);case"unregister":return!0;case"snapshot":return p(t.snapshot)&&d(t.snapshot);case"commandResult":return typeof t.requestId=="string"&&t.requestId.length>0&&t.requestId.length<=100&&p(t.snapshot)&&d(t.snapshot);case"commandError":return typeof t.requestId=="string"&&t.requestId.length>0&&t.requestId.length<=100&&p(t.error);default:return!1}},h=e=>{if(!x(e)||e.source!==E||e.kind!=="command")return!1;let t=e;return typeof t.requestId=="string"&&t.requestId.length>0&&t.requestId.length<=100&&D(t.command)},v=e=>O(e)||h(e);var z="Journey Machine",X=e=>typeof e=="object"&&e!==null,G=e=>e==="idle"||e==="evaluating-when"||e==="running-effect"||e==="error",H=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},W=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},F=()=>typeof window>"u"||window.location.origin==="null"?"*":window.location.origin,K=e=>{if(e.length===0||typeof window>"u")return!1;let t=window.location.origin;return t==="null"?e==="null":e===t},$=()=>`journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,w=class{constructor(t=100,n=1e4){this.commandTimestamps=[];this.maxCommandsPerWindow=t,this.windowMs=n}isAllowed(){let t=Date.now(),n=t-this.windowMs;return this.commandTimestamps=this.commandTimestamps.filter(o=>o>n),this.commandTimestamps.length>=this.maxCommandsPerWindow?!1:(this.commandTimestamps.push(t),!0)}reset(){this.commandTimestamps=[]}},S=e=>{if(typeof structuredClone=="function")try{return structuredClone(e)}catch{}let t=new WeakSet;try{let n=JSON.stringify(e,(o,r)=>{if(typeof r=="bigint")return r.toString();if(typeof r=="function")return`[Function ${r.name||"anonymous"}]`;if(typeof r=="symbol")return r.toString();if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return r});return n===void 0?void 0:JSON.parse(n)}catch{return String(e)}},T=e=>{if(e instanceof Error){let t="cause"in e&&e.cause!==void 0?e.cause:null;return{name:e.name,message:e.message,stack:typeof e.stack=="string"?e.stack:null,cause:S(t)}}return{name:null,message:typeof e=="string"?e:"Unknown error",stack:null,cause:S(e)}},I=e=>{let t={};for(let[n,o]of Object.entries(e.async.byStep))X(o)&&(t[n]={phase:G(o.phase)?o.phase:"idle",eventType:typeof o.eventType=="string"?o.eventType:null,transitionId:typeof o.transitionId=="string"?o.transitionId:null,error:o.error===null?null:S(o.error)});return{currentStepId:String(e.currentStepId),context:S(e.context),history:{timeline:e.history.timeline.map(n=>String(n)),index:e.history.index},visited:Object.fromEntries(Object.entries(e.visited).map(([n,o])=>[String(n),o===!0])),stepMeta:S(e.stepMeta),status:e.status,async:{isLoading:e.async.isLoading,byStep:t}}},Z=async(e,t)=>{switch(t.type){case"goToNextStep":case"completeJourney":{let n=await e.send({type:t.type});return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"terminateMachine":{let n=await e.send({type:"terminateJourney"});return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"goToStepById":{let n=await e.send({type:"goToStepById",stepId:t.stepId});return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"goToPreviousStep":{let n=await e.goToPreviousStep(t.steps);return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"goToLastVisitedStep":{let n=await e.goToLastVisitedStep();return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"send":{let n=t.event.payload===void 0?{type:t.event.type}:{type:t.event.type,payload:t.event.payload},o=await e.send(n);return{snapshot:o.snapshot,transitioned:o.transitioned,...o.transitionId?{transitionId:o.transitionId}:{}}}case"updateStepMetadata":return{snapshot:e.updateStepMetadata(t.stepId,()=>t.metadata)};case"resetMachine":return{snapshot:e.resetMachine()};case"clearStepError":return{snapshot:e.clearStepError(t.stepId)}}},b=(e,t={})=>{if(!(t.enabled??H())||typeof window>"u")return()=>{};let o=t.commandsEnabled??W(),r=t.machineId?.trim()||$(),C={machineId:r,label:t.label?.trim()||z,appName:t.appName?.trim()||(typeof document<"u"?document.title:"")||null,commandsEnabled:o},N=F(),u=s=>({channel:g,version:3,source:c,kind:s,machineId:r,timestamp:Date.now()}),l=s=>{window.postMessage(s,N)},B=s=>{let a={...u("snapshot"),snapshot:I(s)};l(a)},y=!1,_=new w,R=s=>{if(s.source!==window||!K(s.origin)||y||!v(s.data)||s.data.source!==E||s.data.kind!=="command")return;let a=s.data;if(a.machineId!==r)return;if(!_.isAllowed()){let i={...u("commandError"),requestId:a.requestId,error:T("Command rate limit exceeded. Too many commands in a short time window.")};l(i);return}if(!o){let i={...u("commandError"),requestId:a.requestId,error:T("Bridge commands are disabled by configuration.")};l(i);return}(async()=>{try{let i=await Z(e,a.command);if(y)return;let J={...u("commandResult"),requestId:a.requestId,snapshot:I(i.snapshot),...i.transitioned!==void 0?{transitioned:i.transitioned}:{},...i.transitionId?{transitionId:i.transitionId}:{}};l(J)}catch(i){if(y)return;let J={...u("commandError"),requestId:a.requestId,error:T(i)};l(J)}})()};window.addEventListener("message",R);let M=e.subscribe(()=>{y||B(e.getSnapshot())}),k={...u("register"),meta:C,snapshot:I(e.getSnapshot())};return l(k),()=>{if(y)return;y=!0,_.reset(),M(),window.removeEventListener("message",R);let s={...u("unregister")};l(s)}};0&&(module.exports={JOURNEY_DEVTOOLS_BRIDGE_SOURCE,JOURNEY_DEVTOOLS_CHANNEL,JOURNEY_DEVTOOLS_EXTENSION_SOURCE,JOURNEY_DEVTOOLS_PROTOCOL_VERSION,attachJourneyDevtools,isJourneyDevtoolsBridgeEnvelope,isJourneyDevtoolsCommand,isJourneyDevtoolsEnvelope,isJourneyDevtoolsExtensionEnvelope});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/protocol.ts", "../src/bridge.ts"],
4
- "sourcesContent": ["export { attachJourneyDevtools, type JourneyDevtoolsBridgeOptions } from \"./bridge\";\n\nexport {\n JOURNEY_DEVTOOLS_CHANNEL,\n JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n JOURNEY_DEVTOOLS_EXTENSION_SOURCE,\n isJourneyDevtoolsCommand,\n isJourneyDevtoolsEnvelope,\n isJourneyDevtoolsBridgeEnvelope,\n isJourneyDevtoolsExtensionEnvelope,\n type JourneyDevtoolsBridgeCommandErrorEnvelope,\n type JourneyDevtoolsBridgeCommandResultEnvelope,\n type JourneyDevtoolsBridgeEnvelope,\n type JourneyDevtoolsBridgeRegisterEnvelope,\n type JourneyDevtoolsBridgeSnapshotEnvelope,\n type JourneyDevtoolsBridgeUnregisterEnvelope,\n type JourneyDevtoolsCommand,\n type JourneyDevtoolsEnvelope,\n type JourneyDevtoolsExtensionEnvelope,\n type JourneyDevtoolsExtensionCommandEnvelope,\n type JourneyDevtoolsMachineMeta,\n type JourneyDevtoolsSerializableSnapshot,\n type JourneyDevtoolsSerializedError\n} from \"./protocol\";\n", "import type { JourneySnapshot, JourneyStepAsyncState } from \"@rxova/journey-core\";\n\nexport const JOURNEY_DEVTOOLS_PROTOCOL_VERSION = 1 as const;\nexport const JOURNEY_DEVTOOLS_CHANNEL = \"__RXOVA_JOURNEY_DEVTOOLS__\" as const;\n\nexport const JOURNEY_DEVTOOLS_BRIDGE_SOURCE = \"rxova-journey-bridge\" as const;\nexport const JOURNEY_DEVTOOLS_EXTENSION_SOURCE = \"rxova-journey-extension\" as const;\n\nexport type JourneyDevtoolsSource =\n | typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE\n | typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\nexport type JourneyDevtoolsStepAsyncState = JourneyStepAsyncState;\n\nexport type JourneyDevtoolsSerializableSnapshot = JourneySnapshot<unknown, string>;\n\nexport type JourneyDevtoolsMachineMeta = {\n machineId: string;\n label: string;\n appName: string | null;\n commandsEnabled?: boolean;\n};\n\nexport type JourneyDevtoolsSerializedError = {\n name: string | null;\n message: string;\n stack: string | null;\n cause: unknown;\n};\n\nexport type JourneyDevtoolsCommand =\n | { type: \"next\" }\n | { type: \"back\" }\n | { type: \"close\" }\n | { type: \"submit\" }\n | { type: \"goTo\"; to: string }\n | { type: \"send\"; event: { type: string; payload?: unknown } }\n | { type: \"reset\" }\n | { type: \"clearStepError\"; stepId?: string }\n | { type: \"clearHistory\" }\n | { type: \"trimHistory\"; maxHistory?: number | null };\n\nexport type JourneyDevtoolsEnvelopeBase = {\n channel: typeof JOURNEY_DEVTOOLS_CHANNEL;\n version: typeof JOURNEY_DEVTOOLS_PROTOCOL_VERSION;\n source: JourneyDevtoolsSource;\n kind: string;\n machineId: string;\n timestamp: number;\n};\n\nexport type JourneyDevtoolsBridgeRegisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"register\";\n meta: JourneyDevtoolsMachineMeta;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeUnregisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"unregister\";\n};\n\nexport type JourneyDevtoolsBridgeSnapshotEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"snapshot\";\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeCommandResultEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandResult\";\n requestId: string;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nexport type JourneyDevtoolsBridgeCommandErrorEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandError\";\n requestId: string;\n error: JourneyDevtoolsSerializedError;\n};\n\nexport type JourneyDevtoolsExtensionCommandEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n kind: \"command\";\n requestId: string;\n command: JourneyDevtoolsCommand;\n};\n\nexport type JourneyDevtoolsBridgeEnvelope =\n | JourneyDevtoolsBridgeRegisterEnvelope\n | JourneyDevtoolsBridgeUnregisterEnvelope\n | JourneyDevtoolsBridgeSnapshotEnvelope\n | JourneyDevtoolsBridgeCommandResultEnvelope\n | JourneyDevtoolsBridgeCommandErrorEnvelope;\n\nexport type JourneyDevtoolsExtensionEnvelope = JourneyDevtoolsExtensionCommandEnvelope;\n\nexport type JourneyDevtoolsEnvelope =\n | JourneyDevtoolsBridgeEnvelope\n | JourneyDevtoolsExtensionEnvelope;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isKnownSource = (value: unknown): value is JourneyDevtoolsSource =>\n value === JOURNEY_DEVTOOLS_BRIDGE_SOURCE || value === JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\n/**\n * Maximum depth for nested object validation.\n * Prevents stack overflow and excessive processing from deeply nested malicious payloads.\n */\nconst MAX_PAYLOAD_DEPTH = 10;\n\n/**\n * Maximum size (in JSON string length) for serialized payloads.\n * Prevents memory exhaustion from extremely large payloads.\n */\nconst MAX_PAYLOAD_SIZE = 500_000; // 500KB\n\n/**\n * Validates that a value is safe for transport.\n * Checks depth and size constraints to prevent malicious payloads.\n */\nconst isSafePayload = (value: unknown, depth = 0): boolean => {\n if (depth > MAX_PAYLOAD_DEPTH) {\n return false;\n }\n\n if (value === null || value === undefined) {\n return true;\n }\n\n const primitiveTypes = [\"string\", \"number\", \"boolean\"];\n if (primitiveTypes.includes(typeof value)) {\n return true;\n }\n\n if (typeof value === \"object\") {\n // Check JSON serialization size\n try {\n const serialized = JSON.stringify(value);\n if (serialized.length > MAX_PAYLOAD_SIZE) {\n return false;\n }\n } catch {\n // Circular references or non-serializable objects are not safe\n return false;\n }\n\n // Recursively validate nested objects and arrays\n if (Array.isArray(value)) {\n return value.every((item) => isSafePayload(item, depth + 1));\n }\n\n // Validate plain objects (guard against prototype pollution)\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n ) {\n return false;\n }\n\n return Object.values(value).every((prop) => isSafePayload(prop, depth + 1));\n }\n\n // Reject functions, symbols, and other non-serializable types\n return false;\n};\n\nconst hasBaseEnvelopeShape = (value: unknown): value is JourneyDevtoolsEnvelopeBase => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n value.channel === JOURNEY_DEVTOOLS_CHANNEL &&\n value.version === JOURNEY_DEVTOOLS_PROTOCOL_VERSION &&\n isKnownSource(value.source) &&\n typeof value.kind === \"string\" &&\n typeof value.machineId === \"string\" &&\n typeof value.timestamp === \"number\"\n );\n};\n\nconst isSendEvent = (value: unknown): value is { type: string; payload?: unknown } => {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.type !== \"string\" || value.type.length === 0 || value.type.length > 100) {\n return false;\n }\n\n // Validate payload if present\n if (\"payload\" in value && value.payload !== undefined) {\n return isSafePayload(value.payload);\n }\n\n return true;\n};\n\nexport const isJourneyDevtoolsCommand = (value: unknown): value is JourneyDevtoolsCommand => {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n // Validate command type is within reasonable length\n if (value.type.length === 0 || value.type.length > 50) {\n return false;\n }\n\n switch (value.type) {\n case \"next\":\n case \"back\":\n case \"close\":\n case \"submit\":\n case \"reset\":\n case \"clearHistory\":\n // These commands should have no extra properties beyond type\n return Object.keys(value).length === 1;\n case \"goTo\":\n return (\n typeof value.to === \"string\" &&\n value.to.length > 0 &&\n value.to.length <= 100 &&\n Object.keys(value).length === 2\n );\n case \"send\":\n return isSendEvent(value.event) && Object.keys(value).length === 2;\n case \"clearStepError\":\n return (\n (value.stepId === undefined ||\n (typeof value.stepId === \"string\" && value.stepId.length <= 100)) &&\n Object.keys(value).length <= 2\n );\n case \"trimHistory\":\n return (\n (value.maxHistory === undefined ||\n value.maxHistory === null ||\n (typeof value.maxHistory === \"number\" &&\n Number.isInteger(value.maxHistory) &&\n value.maxHistory >= 0 &&\n value.maxHistory <= 10000)) &&\n Object.keys(value).length <= 2\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsBridgeEnvelope = (\n value: unknown\n): value is JourneyDevtoolsBridgeEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_BRIDGE_SOURCE) {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n\n switch (value.kind) {\n case \"register\":\n return (\n isRecord(envelope.meta) &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.meta) &&\n isSafePayload(envelope.snapshot)\n );\n case \"unregister\":\n return true;\n case \"snapshot\":\n return isRecord(envelope.snapshot) && isSafePayload(envelope.snapshot);\n case \"commandResult\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.snapshot)\n );\n case \"commandError\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.error)\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsExtensionEnvelope = (\n value: unknown\n): value is JourneyDevtoolsExtensionEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE) {\n return false;\n }\n\n if (value.kind !== \"command\") {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isJourneyDevtoolsCommand(envelope.command)\n );\n};\n\nexport const isJourneyDevtoolsEnvelope = (value: unknown): value is JourneyDevtoolsEnvelope =>\n isJourneyDevtoolsBridgeEnvelope(value) || isJourneyDevtoolsExtensionEnvelope(value);\n", "import type {\n JourneyEventPayloadMap,\n JourneyMachine,\n JourneySendResult,\n JourneySnapshot\n} from \"@rxova/journey-core\";\nimport {\n JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n JOURNEY_DEVTOOLS_CHANNEL,\n JOURNEY_DEVTOOLS_EXTENSION_SOURCE,\n JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n isJourneyDevtoolsEnvelope,\n type JourneyDevtoolsBridgeCommandErrorEnvelope,\n type JourneyDevtoolsBridgeCommandResultEnvelope,\n type JourneyDevtoolsBridgeEnvelope,\n type JourneyDevtoolsBridgeRegisterEnvelope,\n type JourneyDevtoolsBridgeSnapshotEnvelope,\n type JourneyDevtoolsBridgeUnregisterEnvelope,\n type JourneyDevtoolsCommand,\n type JourneyDevtoolsExtensionCommandEnvelope,\n type JourneyDevtoolsMachineMeta,\n type JourneyDevtoolsSerializableSnapshot,\n type JourneyDevtoolsSerializedError\n} from \"./protocol\";\n\ndeclare const process: { env?: { NODE_ENV?: string } } | undefined;\n\nexport type JourneyDevtoolsBridgeOptions = {\n machineId?: string;\n label?: string;\n enabled?: boolean;\n appName?: string;\n commandsEnabled?: boolean;\n};\n\ntype JourneySendEvent<TStepId extends string> = Parameters<\n JourneyMachine<unknown, TStepId, string>[\"send\"]\n>[0];\n\ntype SendOutcome<TContext, TStepId extends string> = {\n snapshot: JourneySnapshot<TContext, TStepId>;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nconst DEFAULT_MACHINE_LABEL = \"Journey Machine\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isJourneyAsyncPhase = (\n value: unknown\n): value is JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string][\"phase\"] =>\n value === \"idle\" ||\n value === \"evaluating-when\" ||\n value === \"running-effect\" ||\n value === \"error\";\n\nconst resolveDefaultEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveDefaultCommandsEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveWindowTargetOrigin = (): string => {\n if (typeof window === \"undefined\") {\n return \"*\";\n }\n\n return window.location.origin === \"null\" ? \"*\" : window.location.origin;\n};\n\n// No session token infrastructure needed\n\n/**\n * Validates that the message origin matches the current window origin.\n * This prevents messages from other origins from being processed.\n *\n * Note: This is part of defense-in-depth but not a hard security boundary.\n * Code running in the same origin can still send messages.\n */\nconst isExpectedWindowOrigin = (origin: string): boolean => {\n if (origin.length === 0) {\n return false;\n }\n\n if (typeof window === \"undefined\") {\n return false;\n }\n\n const expected = window.location.origin;\n if (expected === \"null\") {\n // For file:// or sandboxed contexts where origin is \"null\"\n return origin === \"null\";\n }\n\n // Strict equality check - no wildcard matching\n return origin === expected;\n};\n\nconst createMachineId = (): string =>\n `journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n\n/**\n * Simple rate limiter to prevent command abuse.\n * Tracks command timestamps and enforces a maximum rate.\n */\nclass CommandRateLimiter {\n private commandTimestamps: number[] = [];\n private readonly maxCommandsPerWindow: number;\n private readonly windowMs: number;\n\n constructor(maxCommandsPerWindow = 100, windowMs = 10000) {\n this.maxCommandsPerWindow = maxCommandsPerWindow;\n this.windowMs = windowMs;\n }\n\n /**\n * Checks if a command is allowed based on rate limits.\n * Returns true if allowed, false if rate limit exceeded.\n */\n isAllowed(): boolean {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n\n // Remove old timestamps outside the window\n this.commandTimestamps = this.commandTimestamps.filter((ts) => ts > windowStart);\n\n if (this.commandTimestamps.length >= this.maxCommandsPerWindow) {\n return false;\n }\n\n this.commandTimestamps.push(now);\n return true;\n }\n\n reset(): void {\n this.commandTimestamps = [];\n }\n}\n\nconst cloneForTransport = (value: unknown): unknown => {\n if (typeof structuredClone === \"function\") {\n try {\n return structuredClone(value);\n } catch {\n // Fall through to the JSON serializer below.\n }\n }\n\n const seen = new WeakSet<object>();\n\n try {\n const serialized = JSON.stringify(value, (_key, currentValue) => {\n if (typeof currentValue === \"bigint\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"function\") {\n return `[Function ${currentValue.name || \"anonymous\"}]`;\n }\n if (typeof currentValue === \"symbol\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"object\" && currentValue !== null) {\n if (seen.has(currentValue)) {\n return \"[Circular]\";\n }\n seen.add(currentValue);\n }\n return currentValue;\n });\n\n if (serialized === undefined) {\n return undefined;\n }\n\n return JSON.parse(serialized) as unknown;\n } catch {\n return String(value);\n }\n};\n\nconst serializeError = (error: unknown): JourneyDevtoolsSerializedError => {\n if (error instanceof Error) {\n const cause =\n \"cause\" in error && (error as { cause?: unknown }).cause !== undefined\n ? (error as { cause?: unknown }).cause\n : null;\n return {\n name: error.name,\n message: error.message,\n stack: typeof error.stack === \"string\" ? error.stack : null,\n cause: cloneForTransport(cause)\n };\n }\n\n return {\n name: null,\n message: typeof error === \"string\" ? error : \"Unknown error\",\n stack: null,\n cause: cloneForTransport(error)\n };\n};\n\nconst serializeSnapshot = <TContext, TStepId extends string>(\n snapshot: JourneySnapshot<TContext, TStepId>\n): JourneyDevtoolsSerializableSnapshot => {\n const byStep: Record<string, JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string]> = {};\n\n for (const [stepId, stepState] of Object.entries(\n snapshot.async.byStep as Record<string, unknown>\n )) {\n if (!isRecord(stepState)) {\n continue;\n }\n\n byStep[stepId] = {\n phase: isJourneyAsyncPhase(stepState.phase) ? stepState.phase : \"idle\",\n eventType: typeof stepState.eventType === \"string\" ? stepState.eventType : null,\n transitionId: typeof stepState.transitionId === \"string\" ? stepState.transitionId : null,\n error: stepState.error === null ? null : cloneForTransport(stepState.error)\n };\n }\n\n return {\n current: String(snapshot.current),\n context: cloneForTransport(snapshot.context),\n history: snapshot.history.map((stepId) => String(stepId)),\n visited: snapshot.visited.map((stepId) => String(stepId)),\n status: snapshot.status,\n async: {\n isLoading: snapshot.async.isLoading,\n byStep\n }\n };\n};\n\nconst runCommand = async <TContext, TStepId extends string>(\n machine: JourneyMachine<TContext, TStepId, string>,\n command: JourneyDevtoolsCommand\n): Promise<SendOutcome<TContext, TStepId>> => {\n switch (command.type) {\n case \"next\":\n case \"back\":\n case \"close\":\n case \"submit\": {\n const result = await machine.send({ type: command.type } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goTo\": {\n const result = await machine.send({\n type: \"goTo\",\n to: command.to\n } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"send\": {\n const sendEvent =\n command.event.payload === undefined\n ? { type: command.event.type }\n : { type: command.event.type, payload: command.event.payload };\n const result: JourneySendResult<TContext, TStepId> = await machine.send(\n sendEvent as JourneySendEvent<TStepId>\n );\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"reset\":\n return {\n snapshot: machine.reset()\n };\n case \"clearStepError\":\n return {\n snapshot: machine.clearStepError(command.stepId as TStepId | undefined)\n };\n case \"clearHistory\":\n return {\n snapshot: machine.clearHistory()\n };\n case \"trimHistory\":\n return {\n snapshot: machine.trimHistory(command.maxHistory)\n };\n }\n};\n\nexport const attachJourneyDevtools = <\n TContext,\n TStepId extends string,\n TEventType extends string,\n TPayloadMap extends JourneyEventPayloadMap<TEventType>\n>(\n machine: JourneyMachine<TContext, TStepId, TEventType, TPayloadMap>,\n options: JourneyDevtoolsBridgeOptions = {}\n): (() => void) => {\n const enabled = options.enabled ?? resolveDefaultEnabled();\n if (!enabled || typeof window === \"undefined\") {\n return () => {};\n }\n const commandsEnabled = options.commandsEnabled ?? resolveDefaultCommandsEnabled();\n\n const machineId = options.machineId?.trim() || createMachineId();\n const meta: JourneyDevtoolsMachineMeta = {\n machineId,\n label: options.label?.trim() || DEFAULT_MACHINE_LABEL,\n appName:\n options.appName?.trim() || (typeof document !== \"undefined\" ? document.title : \"\") || null,\n commandsEnabled\n };\n const targetOrigin = resolveWindowTargetOrigin();\n\n const createBaseEnvelope = <TKind extends JourneyDevtoolsBridgeEnvelope[\"kind\"]>(\n kind: TKind\n ) => ({\n channel: JOURNEY_DEVTOOLS_CHANNEL,\n version: JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n source: JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n kind,\n machineId,\n timestamp: Date.now()\n });\n\n const post = (envelope: JourneyDevtoolsBridgeEnvelope) => {\n window.postMessage(envelope, targetOrigin);\n };\n\n const postSnapshot = (snapshot: JourneySnapshot<TContext, TStepId>) => {\n const envelope: JourneyDevtoolsBridgeSnapshotEnvelope = {\n ...createBaseEnvelope(\"snapshot\"),\n snapshot: serializeSnapshot(snapshot)\n };\n post(envelope);\n };\n\n let isDetached = false;\n const rateLimiter = new CommandRateLimiter();\n\n const onMessage = (event: MessageEvent<unknown>) => {\n if (\n event.source !== window ||\n !isExpectedWindowOrigin(event.origin) ||\n isDetached ||\n !isJourneyDevtoolsEnvelope(event.data)\n ) {\n return;\n }\n\n if (event.data.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE || event.data.kind !== \"command\") {\n return;\n }\n\n const commandEnvelope: JourneyDevtoolsExtensionCommandEnvelope = event.data;\n if (commandEnvelope.machineId !== machineId) {\n return;\n }\n\n // Rate limiting to prevent command abuse\n if (!rateLimiter.isAllowed()) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\n \"Command rate limit exceeded. Too many commands in a short time window.\"\n )\n };\n post(errorEnvelope);\n return;\n }\n\n if (!commandsEnabled) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\"Bridge commands are disabled by configuration.\")\n };\n post(errorEnvelope);\n return;\n }\n\n const run = async () => {\n try {\n const outcome = await runCommand(\n machine as JourneyMachine<TContext, TStepId, string>,\n commandEnvelope.command\n );\n if (isDetached) {\n return;\n }\n\n const resultEnvelope: JourneyDevtoolsBridgeCommandResultEnvelope = {\n ...createBaseEnvelope(\"commandResult\"),\n requestId: commandEnvelope.requestId,\n snapshot: serializeSnapshot(outcome.snapshot),\n ...(outcome.transitioned !== undefined ? { transitioned: outcome.transitioned } : {}),\n ...(outcome.transitionId ? { transitionId: outcome.transitionId } : {})\n };\n post(resultEnvelope);\n } catch (error) {\n if (isDetached) {\n return;\n }\n\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(error)\n };\n post(errorEnvelope);\n }\n };\n\n void run();\n };\n\n window.addEventListener(\"message\", onMessage);\n\n const unsubscribe = machine.subscribe(() => {\n if (isDetached) {\n return;\n }\n postSnapshot(machine.getSnapshot());\n });\n\n const registerEnvelope: JourneyDevtoolsBridgeRegisterEnvelope = {\n ...createBaseEnvelope(\"register\"),\n meta,\n snapshot: serializeSnapshot(machine.getSnapshot())\n };\n post(registerEnvelope);\n\n return () => {\n if (isDetached) {\n return;\n }\n\n isDetached = true;\n rateLimiter.reset();\n unsubscribe();\n window.removeEventListener(\"message\", onMessage);\n\n const unregisterEnvelope: JourneyDevtoolsBridgeUnregisterEnvelope = {\n ...createBaseEnvelope(\"unregister\")\n };\n post(unregisterEnvelope);\n };\n};\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,EAAA,6BAAAC,EAAA,sCAAAC,EAAA,sCAAAC,EAAA,0BAAAC,EAAA,oCAAAC,EAAA,6BAAAC,EAAA,8BAAAC,EAAA,uCAAAC,IAAA,eAAAC,EAAAX,GCEO,IAAMY,EAAoC,EACpCC,EAA2B,6BAE3BC,EAAiC,uBACjCC,EAAoC,0BAmG3CC,EAAYC,GAChB,OAAOA,GAAU,UAAYA,IAAU,KAEnCC,EAAiBD,GACrBA,IAAUH,GAAkCG,IAAUF,EAkBxD,IAAMI,EAAgB,CAACC,EAAgBC,EAAQ,IAAe,CAC5D,GAAIA,EAAQ,GACV,MAAO,GAQT,GALID,GAAU,MAIS,CAAC,SAAU,SAAU,SAAS,EAClC,SAAS,OAAOA,CAAK,EACtC,MAAO,GAGT,GAAI,OAAOA,GAAU,SAAU,CAE7B,GAAI,CAEF,GADmB,KAAK,UAAUA,CAAK,EACxB,OAAS,IACtB,MAAO,EAEX,MAAQ,CAEN,MAAO,EACT,CAGA,OAAI,MAAM,QAAQA,CAAK,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AMU,EAA8D,CAClE,GAAGnB,EAAmB,YAAY,CACpC,EACAI,EAAKe,CAAkB,CACzB,CACF",
6
- "names": ["index_exports", "__export", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "JOURNEY_DEVTOOLS_PROTOCOL_VERSION", "attachJourneyDevtools", "isJourneyDevtoolsBridgeEnvelope", "isJourneyDevtoolsCommand", "isJourneyDevtoolsEnvelope", "isJourneyDevtoolsExtensionEnvelope", "__toCommonJS", "JOURNEY_DEVTOOLS_PROTOCOL_VERSION", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isRecord", "value", "isKnownSource", "isSafePayload", "value", "depth", "item", "prop", "hasBaseEnvelopeShape", "isRecord", "JOURNEY_DEVTOOLS_CHANNEL", "isKnownSource", "isSendEvent", "isJourneyDevtoolsCommand", "isJourneyDevtoolsBridgeEnvelope", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "envelope", "isJourneyDevtoolsExtensionEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isJourneyDevtoolsEnvelope", "DEFAULT_MACHINE_LABEL", "isRecord", "value", "isJourneyAsyncPhase", "resolveDefaultEnabled", "nodeEnv", "resolveDefaultCommandsEnabled", "resolveWindowTargetOrigin", "isExpectedWindowOrigin", "origin", "expected", "createMachineId", "CommandRateLimiter", "maxCommandsPerWindow", "windowMs", "now", "windowStart", "ts", "cloneForTransport", "seen", "serialized", "_key", "currentValue", "serializeError", "error", "cause", "serializeSnapshot", "snapshot", "byStep", "stepId", "stepState", "runCommand", "machine", "command", "result", "sendEvent", "attachJourneyDevtools", "options", "commandsEnabled", "machineId", "meta", "targetOrigin", "createBaseEnvelope", "kind", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "post", "envelope", "postSnapshot", "isDetached", "rateLimiter", "onMessage", "event", "isJourneyDevtoolsEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "commandEnvelope", "errorEnvelope", "outcome", "resultEnvelope", "unsubscribe", "registerEnvelope", "unregisterEnvelope"]
4
+ "sourcesContent": ["export { attachJourneyDevtools, type JourneyDevtoolsBridgeOptions } from \"./bridge\";\n\nexport {\n JOURNEY_DEVTOOLS_CHANNEL,\n JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n JOURNEY_DEVTOOLS_EXTENSION_SOURCE,\n isJourneyDevtoolsCommand,\n isJourneyDevtoolsEnvelope,\n isJourneyDevtoolsBridgeEnvelope,\n isJourneyDevtoolsExtensionEnvelope,\n type JourneyDevtoolsBridgeCommandErrorEnvelope,\n type JourneyDevtoolsBridgeCommandResultEnvelope,\n type JourneyDevtoolsBridgeEnvelope,\n type JourneyDevtoolsBridgeRegisterEnvelope,\n type JourneyDevtoolsBridgeSnapshotEnvelope,\n type JourneyDevtoolsBridgeUnregisterEnvelope,\n type JourneyDevtoolsCommand,\n type JourneyDevtoolsEnvelope,\n type JourneyDevtoolsExtensionEnvelope,\n type JourneyDevtoolsExtensionCommandEnvelope,\n type JourneyDevtoolsMachineMeta,\n type JourneyDevtoolsSerializableSnapshot,\n type JourneyDevtoolsSerializedError\n} from \"./protocol\";\n", "import type { JourneySnapshot, JourneyStepAsyncState } from \"@rxova/journey-core\";\n\nexport const JOURNEY_DEVTOOLS_PROTOCOL_VERSION = 3 as const;\nexport const JOURNEY_DEVTOOLS_CHANNEL = \"__RXOVA_JOURNEY_DEVTOOLS__\" as const;\n\nexport const JOURNEY_DEVTOOLS_BRIDGE_SOURCE = \"rxova-journey-bridge\" as const;\nexport const JOURNEY_DEVTOOLS_EXTENSION_SOURCE = \"rxova-journey-extension\" as const;\n\nexport type JourneyDevtoolsSource =\n | typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE\n | typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\nexport type JourneyDevtoolsStepAsyncState = JourneyStepAsyncState;\n\nexport type JourneyDevtoolsSerializableSnapshot = JourneySnapshot<unknown, string>;\n\nexport type JourneyDevtoolsMachineMeta = {\n machineId: string;\n label: string;\n appName: string | null;\n commandsEnabled?: boolean;\n};\n\nexport type JourneyDevtoolsSerializedError = {\n name: string | null;\n message: string;\n stack: string | null;\n cause: unknown;\n};\n\nexport type JourneyDevtoolsCommand =\n | { type: \"goToNextStep\" }\n | { type: \"terminateMachine\" }\n | { type: \"completeJourney\" }\n | { type: \"goToStepById\"; stepId: string }\n | { type: \"goToPreviousStep\"; steps?: number }\n | { type: \"goToLastVisitedStep\" }\n | { type: \"send\"; event: { type: string; payload?: unknown } }\n | { type: \"updateStepMetadata\"; stepId: string; metadata: unknown }\n | { type: \"resetMachine\" }\n | { type: \"clearStepError\"; stepId?: string };\n\nexport type JourneyDevtoolsEnvelopeBase = {\n channel: typeof JOURNEY_DEVTOOLS_CHANNEL;\n version: typeof JOURNEY_DEVTOOLS_PROTOCOL_VERSION;\n source: JourneyDevtoolsSource;\n kind: string;\n machineId: string;\n timestamp: number;\n};\n\nexport type JourneyDevtoolsBridgeRegisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"register\";\n meta: JourneyDevtoolsMachineMeta;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeUnregisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"unregister\";\n};\n\nexport type JourneyDevtoolsBridgeSnapshotEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"snapshot\";\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeCommandResultEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandResult\";\n requestId: string;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nexport type JourneyDevtoolsBridgeCommandErrorEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandError\";\n requestId: string;\n error: JourneyDevtoolsSerializedError;\n};\n\nexport type JourneyDevtoolsExtensionCommandEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n kind: \"command\";\n requestId: string;\n command: JourneyDevtoolsCommand;\n};\n\nexport type JourneyDevtoolsBridgeEnvelope =\n | JourneyDevtoolsBridgeRegisterEnvelope\n | JourneyDevtoolsBridgeUnregisterEnvelope\n | JourneyDevtoolsBridgeSnapshotEnvelope\n | JourneyDevtoolsBridgeCommandResultEnvelope\n | JourneyDevtoolsBridgeCommandErrorEnvelope;\n\nexport type JourneyDevtoolsExtensionEnvelope = JourneyDevtoolsExtensionCommandEnvelope;\n\nexport type JourneyDevtoolsEnvelope =\n | JourneyDevtoolsBridgeEnvelope\n | JourneyDevtoolsExtensionEnvelope;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isKnownSource = (value: unknown): value is JourneyDevtoolsSource =>\n value === JOURNEY_DEVTOOLS_BRIDGE_SOURCE || value === JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\n/**\n * Maximum depth for nested object validation.\n * Prevents stack overflow and excessive processing from deeply nested malicious payloads.\n */\nconst MAX_PAYLOAD_DEPTH = 10;\n\n/**\n * Maximum size (in JSON string length) for serialized payloads.\n * Prevents memory exhaustion from extremely large payloads.\n */\nconst MAX_PAYLOAD_SIZE = 500_000; // 500KB\n\n/**\n * Validates that a value is safe for transport.\n * Checks depth and size constraints to prevent malicious payloads.\n */\nconst isSafePayload = (value: unknown, depth = 0): boolean => {\n if (depth > MAX_PAYLOAD_DEPTH) {\n return false;\n }\n\n if (value === null || value === undefined) {\n return true;\n }\n\n const primitiveTypes = [\"string\", \"number\", \"boolean\"];\n if (primitiveTypes.includes(typeof value)) {\n return true;\n }\n\n if (typeof value === \"object\") {\n // Check JSON serialization size\n try {\n const serialized = JSON.stringify(value);\n if (serialized.length > MAX_PAYLOAD_SIZE) {\n return false;\n }\n } catch {\n // Circular references or non-serializable objects are not safe\n return false;\n }\n\n // Recursively validate nested objects and arrays\n if (Array.isArray(value)) {\n return value.every((item) => isSafePayload(item, depth + 1));\n }\n\n // Validate plain objects (guard against prototype pollution)\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n ) {\n return false;\n }\n\n return Object.values(value).every((prop) => isSafePayload(prop, depth + 1));\n }\n\n // Reject functions, symbols, and other non-serializable types\n return false;\n};\n\nconst hasBaseEnvelopeShape = (value: unknown): value is JourneyDevtoolsEnvelopeBase => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n value.channel === JOURNEY_DEVTOOLS_CHANNEL &&\n value.version === JOURNEY_DEVTOOLS_PROTOCOL_VERSION &&\n isKnownSource(value.source) &&\n typeof value.kind === \"string\" &&\n typeof value.machineId === \"string\" &&\n typeof value.timestamp === \"number\"\n );\n};\n\nconst isSendEvent = (value: unknown): value is { type: string; payload?: unknown } => {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.type !== \"string\" || value.type.length === 0 || value.type.length > 100) {\n return false;\n }\n\n // Validate payload if present\n if (\"payload\" in value && value.payload !== undefined) {\n return isSafePayload(value.payload);\n }\n\n return true;\n};\n\nexport const isJourneyDevtoolsCommand = (value: unknown): value is JourneyDevtoolsCommand => {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n // Validate command type is within reasonable length\n if (value.type.length === 0 || value.type.length > 50) {\n return false;\n }\n\n switch (value.type) {\n case \"goToNextStep\":\n case \"terminateMachine\":\n case \"completeJourney\":\n case \"resetMachine\":\n case \"goToLastVisitedStep\":\n // These commands should have no extra properties beyond type\n return Object.keys(value).length === 1;\n case \"goToStepById\":\n return (\n typeof value.stepId === \"string\" &&\n value.stepId.length > 0 &&\n value.stepId.length <= 100 &&\n Object.keys(value).length === 2\n );\n case \"goToPreviousStep\":\n return (\n (value.steps === undefined ||\n (typeof value.steps === \"number\" &&\n Number.isInteger(value.steps) &&\n value.steps >= 1 &&\n value.steps <= 10000)) &&\n Object.keys(value).length <= 2\n );\n case \"send\":\n return isSendEvent(value.event) && Object.keys(value).length === 2;\n case \"updateStepMetadata\":\n return (\n typeof value.stepId === \"string\" &&\n value.stepId.length > 0 &&\n value.stepId.length <= 100 &&\n isSafePayload(value.metadata) &&\n Object.keys(value).length === 3\n );\n case \"clearStepError\":\n return (\n (value.stepId === undefined ||\n (typeof value.stepId === \"string\" && value.stepId.length <= 100)) &&\n Object.keys(value).length <= 2\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsBridgeEnvelope = (\n value: unknown\n): value is JourneyDevtoolsBridgeEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_BRIDGE_SOURCE) {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n\n switch (value.kind) {\n case \"register\":\n return (\n isRecord(envelope.meta) &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.meta) &&\n isSafePayload(envelope.snapshot)\n );\n case \"unregister\":\n return true;\n case \"snapshot\":\n return isRecord(envelope.snapshot) && isSafePayload(envelope.snapshot);\n case \"commandResult\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.snapshot)\n );\n case \"commandError\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.error)\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsExtensionEnvelope = (\n value: unknown\n): value is JourneyDevtoolsExtensionEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE) {\n return false;\n }\n\n if (value.kind !== \"command\") {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isJourneyDevtoolsCommand(envelope.command)\n );\n};\n\nexport const isJourneyDevtoolsEnvelope = (value: unknown): value is JourneyDevtoolsEnvelope =>\n isJourneyDevtoolsBridgeEnvelope(value) || isJourneyDevtoolsExtensionEnvelope(value);\n", "import type {\n JourneyEventPayloadMap,\n JourneyMachine,\n JourneySendResult,\n JourneySnapshot\n} from \"@rxova/journey-core\";\nimport {\n JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n JOURNEY_DEVTOOLS_CHANNEL,\n JOURNEY_DEVTOOLS_EXTENSION_SOURCE,\n JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n isJourneyDevtoolsEnvelope,\n type JourneyDevtoolsBridgeCommandErrorEnvelope,\n type JourneyDevtoolsBridgeCommandResultEnvelope,\n type JourneyDevtoolsBridgeEnvelope,\n type JourneyDevtoolsBridgeRegisterEnvelope,\n type JourneyDevtoolsBridgeSnapshotEnvelope,\n type JourneyDevtoolsBridgeUnregisterEnvelope,\n type JourneyDevtoolsCommand,\n type JourneyDevtoolsExtensionCommandEnvelope,\n type JourneyDevtoolsMachineMeta,\n type JourneyDevtoolsSerializableSnapshot,\n type JourneyDevtoolsSerializedError\n} from \"./protocol\";\n\ndeclare const process: { env?: { NODE_ENV?: string } } | undefined;\n\nexport type JourneyDevtoolsBridgeOptions = {\n machineId?: string;\n label?: string;\n enabled?: boolean;\n appName?: string;\n commandsEnabled?: boolean;\n};\n\ntype JourneySendEvent<TStepId extends string> = Parameters<\n JourneyMachine<unknown, TStepId, string, Record<never, never>, unknown>[\"send\"]\n>[0];\n\ntype SendOutcome<TContext, TStepId extends string, TStepMeta> = {\n snapshot: JourneySnapshot<TContext, TStepId, TStepMeta>;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nconst DEFAULT_MACHINE_LABEL = \"Journey Machine\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isJourneyAsyncPhase = (\n value: unknown\n): value is JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string][\"phase\"] =>\n value === \"idle\" ||\n value === \"evaluating-when\" ||\n value === \"running-effect\" ||\n value === \"error\";\n\nconst resolveDefaultEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveDefaultCommandsEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveWindowTargetOrigin = (): string => {\n if (typeof window === \"undefined\") {\n return \"*\";\n }\n\n return window.location.origin === \"null\" ? \"*\" : window.location.origin;\n};\n\n// No session token infrastructure needed\n\n/**\n * Validates that the message origin matches the current window origin.\n * This prevents messages from other origins from being processed.\n *\n * Note: This is part of defense-in-depth but not a hard security boundary.\n * Code running in the same origin can still send messages.\n */\nconst isExpectedWindowOrigin = (origin: string): boolean => {\n if (origin.length === 0) {\n return false;\n }\n\n if (typeof window === \"undefined\") {\n return false;\n }\n\n const expected = window.location.origin;\n if (expected === \"null\") {\n // For file:// or sandboxed contexts where origin is \"null\"\n return origin === \"null\";\n }\n\n // Strict equality check - no wildcard matching\n return origin === expected;\n};\n\nconst createMachineId = (): string =>\n `journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n\n/**\n * Simple rate limiter to prevent command abuse.\n * Tracks command timestamps and enforces a maximum rate.\n */\nclass CommandRateLimiter {\n private commandTimestamps: number[] = [];\n private readonly maxCommandsPerWindow: number;\n private readonly windowMs: number;\n\n constructor(maxCommandsPerWindow = 100, windowMs = 10000) {\n this.maxCommandsPerWindow = maxCommandsPerWindow;\n this.windowMs = windowMs;\n }\n\n /**\n * Checks if a command is allowed based on rate limits.\n * Returns true if allowed, false if rate limit exceeded.\n */\n isAllowed(): boolean {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n\n // Remove old timestamps outside the window\n this.commandTimestamps = this.commandTimestamps.filter((ts) => ts > windowStart);\n\n if (this.commandTimestamps.length >= this.maxCommandsPerWindow) {\n return false;\n }\n\n this.commandTimestamps.push(now);\n return true;\n }\n\n reset(): void {\n this.commandTimestamps = [];\n }\n}\n\nconst cloneForTransport = (value: unknown): unknown => {\n if (typeof structuredClone === \"function\") {\n try {\n return structuredClone(value);\n } catch {\n // Fall through to the JSON serializer below.\n }\n }\n\n const seen = new WeakSet<object>();\n\n try {\n const serialized = JSON.stringify(value, (_key, currentValue) => {\n if (typeof currentValue === \"bigint\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"function\") {\n return `[Function ${currentValue.name || \"anonymous\"}]`;\n }\n if (typeof currentValue === \"symbol\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"object\" && currentValue !== null) {\n if (seen.has(currentValue)) {\n return \"[Circular]\";\n }\n seen.add(currentValue);\n }\n return currentValue;\n });\n\n if (serialized === undefined) {\n return undefined;\n }\n\n return JSON.parse(serialized) as unknown;\n } catch {\n return String(value);\n }\n};\n\nconst serializeError = (error: unknown): JourneyDevtoolsSerializedError => {\n if (error instanceof Error) {\n const cause =\n \"cause\" in error && (error as { cause?: unknown }).cause !== undefined\n ? (error as { cause?: unknown }).cause\n : null;\n return {\n name: error.name,\n message: error.message,\n stack: typeof error.stack === \"string\" ? error.stack : null,\n cause: cloneForTransport(cause)\n };\n }\n\n return {\n name: null,\n message: typeof error === \"string\" ? error : \"Unknown error\",\n stack: null,\n cause: cloneForTransport(error)\n };\n};\n\nconst serializeSnapshot = <TContext, TStepId extends string, TStepMeta>(\n snapshot: JourneySnapshot<TContext, TStepId, TStepMeta>\n): JourneyDevtoolsSerializableSnapshot => {\n const byStep: Record<string, JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string]> = {};\n\n for (const [stepId, stepState] of Object.entries(\n snapshot.async.byStep as Record<string, unknown>\n )) {\n if (!isRecord(stepState)) {\n continue;\n }\n\n byStep[stepId] = {\n phase: isJourneyAsyncPhase(stepState.phase) ? stepState.phase : \"idle\",\n eventType: typeof stepState.eventType === \"string\" ? stepState.eventType : null,\n transitionId: typeof stepState.transitionId === \"string\" ? stepState.transitionId : null,\n error: stepState.error === null ? null : cloneForTransport(stepState.error)\n };\n }\n\n return {\n currentStepId: String(snapshot.currentStepId),\n context: cloneForTransport(snapshot.context),\n history: {\n timeline: snapshot.history.timeline.map((stepId) => String(stepId)),\n index: snapshot.history.index\n },\n visited: Object.fromEntries(\n Object.entries(snapshot.visited as Record<string, boolean>).map(([stepId, isVisited]) => [\n String(stepId),\n isVisited === true\n ])\n ),\n stepMeta: cloneForTransport(snapshot.stepMeta) as Record<string, unknown>,\n status: snapshot.status,\n async: {\n isLoading: snapshot.async.isLoading,\n byStep\n }\n };\n};\n\nconst runCommand = async <TContext, TStepId extends string, TStepMeta>(\n machine: JourneyMachine<TContext, TStepId, string, Record<never, never>, TStepMeta>,\n command: JourneyDevtoolsCommand\n): Promise<SendOutcome<TContext, TStepId, TStepMeta>> => {\n switch (command.type) {\n case \"goToNextStep\":\n case \"completeJourney\": {\n const result = await machine.send({ type: command.type } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"terminateMachine\": {\n const result = await machine.send({ type: \"terminateJourney\" } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goToStepById\": {\n const result = await machine.send({\n type: \"goToStepById\",\n stepId: command.stepId\n } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goToPreviousStep\": {\n const result = await machine.goToPreviousStep(command.steps);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goToLastVisitedStep\": {\n const result = await machine.goToLastVisitedStep();\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"send\": {\n const sendEvent =\n command.event.payload === undefined\n ? { type: command.event.type }\n : { type: command.event.type, payload: command.event.payload };\n const result: JourneySendResult<TContext, TStepId, TStepMeta> = await machine.send(\n sendEvent as JourneySendEvent<TStepId>\n );\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"updateStepMetadata\":\n return {\n snapshot: machine.updateStepMetadata(\n command.stepId as TStepId,\n () => command.metadata as TStepMeta\n )\n };\n case \"resetMachine\":\n return {\n snapshot: machine.resetMachine()\n };\n case \"clearStepError\":\n return {\n snapshot: machine.clearStepError(command.stepId as TStepId | undefined)\n };\n }\n};\n\nexport const attachJourneyDevtools = <\n TContext,\n TStepId extends string,\n TEventType extends string,\n TPayloadMap extends JourneyEventPayloadMap<TEventType>,\n TStepMeta\n>(\n machine: JourneyMachine<TContext, TStepId, TEventType, TPayloadMap, TStepMeta>,\n options: JourneyDevtoolsBridgeOptions = {}\n): (() => void) => {\n const enabled = options.enabled ?? resolveDefaultEnabled();\n if (!enabled || typeof window === \"undefined\") {\n return () => {};\n }\n const commandsEnabled = options.commandsEnabled ?? resolveDefaultCommandsEnabled();\n\n const machineId = options.machineId?.trim() || createMachineId();\n const meta: JourneyDevtoolsMachineMeta = {\n machineId,\n label: options.label?.trim() || DEFAULT_MACHINE_LABEL,\n appName:\n options.appName?.trim() || (typeof document !== \"undefined\" ? document.title : \"\") || null,\n commandsEnabled\n };\n const targetOrigin = resolveWindowTargetOrigin();\n\n const createBaseEnvelope = <TKind extends JourneyDevtoolsBridgeEnvelope[\"kind\"]>(\n kind: TKind\n ) => ({\n channel: JOURNEY_DEVTOOLS_CHANNEL,\n version: JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n source: JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n kind,\n machineId,\n timestamp: Date.now()\n });\n\n const post = (envelope: JourneyDevtoolsBridgeEnvelope) => {\n window.postMessage(envelope, targetOrigin);\n };\n\n const postSnapshot = (snapshot: JourneySnapshot<TContext, TStepId, TStepMeta>) => {\n const envelope: JourneyDevtoolsBridgeSnapshotEnvelope = {\n ...createBaseEnvelope(\"snapshot\"),\n snapshot: serializeSnapshot(snapshot)\n };\n post(envelope);\n };\n\n let isDetached = false;\n const rateLimiter = new CommandRateLimiter();\n\n const onMessage = (event: MessageEvent<unknown>) => {\n if (\n event.source !== window ||\n !isExpectedWindowOrigin(event.origin) ||\n isDetached ||\n !isJourneyDevtoolsEnvelope(event.data)\n ) {\n return;\n }\n\n if (event.data.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE || event.data.kind !== \"command\") {\n return;\n }\n\n const commandEnvelope: JourneyDevtoolsExtensionCommandEnvelope = event.data;\n if (commandEnvelope.machineId !== machineId) {\n return;\n }\n\n // Rate limiting to prevent command abuse\n if (!rateLimiter.isAllowed()) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\n \"Command rate limit exceeded. Too many commands in a short time window.\"\n )\n };\n post(errorEnvelope);\n return;\n }\n\n if (!commandsEnabled) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\"Bridge commands are disabled by configuration.\")\n };\n post(errorEnvelope);\n return;\n }\n\n const run = async () => {\n try {\n const outcome = await runCommand(\n machine as JourneyMachine<TContext, TStepId, string, Record<never, never>, TStepMeta>,\n commandEnvelope.command\n );\n if (isDetached) {\n return;\n }\n\n const resultEnvelope: JourneyDevtoolsBridgeCommandResultEnvelope = {\n ...createBaseEnvelope(\"commandResult\"),\n requestId: commandEnvelope.requestId,\n snapshot: serializeSnapshot(outcome.snapshot),\n ...(outcome.transitioned !== undefined ? { transitioned: outcome.transitioned } : {}),\n ...(outcome.transitionId ? { transitionId: outcome.transitionId } : {})\n };\n post(resultEnvelope);\n } catch (error) {\n if (isDetached) {\n return;\n }\n\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(error)\n };\n post(errorEnvelope);\n }\n };\n\n void run();\n };\n\n window.addEventListener(\"message\", onMessage);\n\n const unsubscribe = machine.subscribe(() => {\n if (isDetached) {\n return;\n }\n postSnapshot(machine.getSnapshot());\n });\n\n const registerEnvelope: JourneyDevtoolsBridgeRegisterEnvelope = {\n ...createBaseEnvelope(\"register\"),\n meta,\n snapshot: serializeSnapshot(machine.getSnapshot())\n };\n post(registerEnvelope);\n\n return () => {\n if (isDetached) {\n return;\n }\n\n isDetached = true;\n rateLimiter.reset();\n unsubscribe();\n window.removeEventListener(\"message\", onMessage);\n\n const unregisterEnvelope: JourneyDevtoolsBridgeUnregisterEnvelope = {\n ...createBaseEnvelope(\"unregister\")\n };\n post(unregisterEnvelope);\n };\n};\n"],
5
+ "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oCAAAE,EAAA,6BAAAC,EAAA,sCAAAC,EAAA,sCAAAC,EAAA,0BAAAC,EAAA,oCAAAC,EA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,EAAQ,YAAY,CAAC,CACnD,EACA,OAAAc,EAAKc,CAAgB,EAEd,IAAM,CACX,GAAIX,EACF,OAGFA,EAAa,GACbC,EAAY,MAAM,EAClBS,EAAY,EACZ,OAAO,oBAAoB,UAAWR,CAAS,EAE/C,IAAMU,EAA8D,CAClE,GAAGnB,EAAmB,YAAY,CACpC,EACAI,EAAKe,CAAkB,CACzB,CACF",
6
+ "names": ["index_exports", "__export", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "JOURNEY_DEVTOOLS_PROTOCOL_VERSION", "attachJourneyDevtools", "isJourneyDevtoolsBridgeEnvelope", "isJourneyDevtoolsCommand", "isJourneyDevtoolsEnvelope", "isJourneyDevtoolsExtensionEnvelope", "__toCommonJS", "JOURNEY_DEVTOOLS_PROTOCOL_VERSION", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isRecord", "value", "isKnownSource", "isSafePayload", "value", "depth", "item", "prop", "hasBaseEnvelopeShape", "isRecord", "JOURNEY_DEVTOOLS_CHANNEL", "isKnownSource", "isSendEvent", "isJourneyDevtoolsCommand", "isJourneyDevtoolsBridgeEnvelope", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "envelope", "isJourneyDevtoolsExtensionEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isJourneyDevtoolsEnvelope", "DEFAULT_MACHINE_LABEL", "isRecord", "value", "isJourneyAsyncPhase", "resolveDefaultEnabled", "nodeEnv", "resolveDefaultCommandsEnabled", "resolveWindowTargetOrigin", "isExpectedWindowOrigin", "origin", "expected", "createMachineId", "CommandRateLimiter", "maxCommandsPerWindow", "windowMs", "now", "windowStart", "ts", "cloneForTransport", "seen", "serialized", "_key", "currentValue", "serializeError", "error", "cause", "serializeSnapshot", "snapshot", "byStep", "stepId", "stepState", "isVisited", "runCommand", "machine", "command", "result", "sendEvent", "attachJourneyDevtools", "options", "commandsEnabled", "machineId", "meta", "targetOrigin", "createBaseEnvelope", "kind", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "post", "envelope", "postSnapshot", "isDetached", "rateLimiter", "onMessage", "event", "isJourneyDevtoolsEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "commandEnvelope", "errorEnvelope", "outcome", "resultEnvelope", "unsubscribe", "registerEnvelope", "unregisterEnvelope"]
7
7
  }
package/dist/index.d.cts CHANGED
@@ -1,3 +1,2 @@
1
1
  export { attachJourneyDevtools, type JourneyDevtoolsBridgeOptions } from "./bridge";
2
2
  export { JOURNEY_DEVTOOLS_CHANNEL, JOURNEY_DEVTOOLS_PROTOCOL_VERSION, JOURNEY_DEVTOOLS_BRIDGE_SOURCE, JOURNEY_DEVTOOLS_EXTENSION_SOURCE, isJourneyDevtoolsCommand, isJourneyDevtoolsEnvelope, isJourneyDevtoolsBridgeEnvelope, isJourneyDevtoolsExtensionEnvelope, type JourneyDevtoolsBridgeCommandErrorEnvelope, type JourneyDevtoolsBridgeCommandResultEnvelope, type JourneyDevtoolsBridgeEnvelope, type JourneyDevtoolsBridgeRegisterEnvelope, type JourneyDevtoolsBridgeSnapshotEnvelope, type JourneyDevtoolsBridgeUnregisterEnvelope, type JourneyDevtoolsCommand, type JourneyDevtoolsEnvelope, type JourneyDevtoolsExtensionEnvelope, type JourneyDevtoolsExtensionCommandEnvelope, type JourneyDevtoolsMachineMeta, type JourneyDevtoolsSerializableSnapshot, type JourneyDevtoolsSerializedError } from "./protocol";
3
- //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export { attachJourneyDevtools, type JourneyDevtoolsBridgeOptions } from "./bridge";
2
2
  export { JOURNEY_DEVTOOLS_CHANNEL, JOURNEY_DEVTOOLS_PROTOCOL_VERSION, JOURNEY_DEVTOOLS_BRIDGE_SOURCE, JOURNEY_DEVTOOLS_EXTENSION_SOURCE, isJourneyDevtoolsCommand, isJourneyDevtoolsEnvelope, isJourneyDevtoolsBridgeEnvelope, isJourneyDevtoolsExtensionEnvelope, type JourneyDevtoolsBridgeCommandErrorEnvelope, type JourneyDevtoolsBridgeCommandResultEnvelope, type JourneyDevtoolsBridgeEnvelope, type JourneyDevtoolsBridgeRegisterEnvelope, type JourneyDevtoolsBridgeSnapshotEnvelope, type JourneyDevtoolsBridgeUnregisterEnvelope, type JourneyDevtoolsCommand, type JourneyDevtoolsEnvelope, type JourneyDevtoolsExtensionEnvelope, type JourneyDevtoolsExtensionCommandEnvelope, type JourneyDevtoolsMachineMeta, type JourneyDevtoolsSerializableSnapshot, type JourneyDevtoolsSerializedError } from "./protocol";
3
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var S=1,m="__RXOVA_JOURNEY_DEVTOOLS__",c="rxova-journey-bridge",E="rxova-journey-extension",p=e=>typeof e=="object"&&e!==null,k=e=>e===c||e===E;var u=(e,n=0)=>{if(n>10)return!1;if(e==null||["string","number","boolean"].includes(typeof e))return!0;if(typeof e=="object"){try{if(JSON.stringify(e).length>5e5)return!1}catch{return!1}return Array.isArray(e)?e.every(t=>u(t,n+1)):Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:Object.values(e).every(t=>u(t,n+1))}return!1},I=e=>p(e)?e.channel===m&&e.version===1&&k(e.source)&&typeof e.kind=="string"&&typeof e.machineId=="string"&&typeof e.timestamp=="number":!1,U=e=>!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>100?!1:"payload"in e&&e.payload!==void 0?u(e.payload):!0,_=e=>{if(!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>50)return!1;switch(e.type){case"next":case"back":case"close":case"submit":case"reset":case"clearHistory":return Object.keys(e).length===1;case"goTo":return typeof e.to=="string"&&e.to.length>0&&e.to.length<=100&&Object.keys(e).length===2;case"send":return U(e.event)&&Object.keys(e).length===2;case"clearStepError":return(e.stepId===void 0||typeof e.stepId=="string"&&e.stepId.length<=100)&&Object.keys(e).length<=2;case"trimHistory":return(e.maxHistory===void 0||e.maxHistory===null||typeof e.maxHistory=="number"&&Number.isInteger(e.maxHistory)&&e.maxHistory>=0&&e.maxHistory<=1e4)&&Object.keys(e).length<=2;default:return!1}},x=e=>{if(!I(e)||e.source!==c)return!1;let n=e;switch(e.kind){case"register":return p(n.meta)&&p(n.snapshot)&&u(n.meta)&&u(n.snapshot);case"unregister":return!0;case"snapshot":return p(n.snapshot)&&u(n.snapshot);case"commandResult":return typeof n.requestId=="string"&&n.requestId.length>0&&n.requestId.length<=100&&p(n.snapshot)&&u(n.snapshot);case"commandError":return typeof n.requestId=="string"&&n.requestId.length>0&&n.requestId.length<=100&&p(n.error);default:return!1}},w=e=>{if(!I(e)||e.source!==E||e.kind!=="command")return!1;let n=e;return typeof n.requestId=="string"&&n.requestId.length>0&&n.requestId.length<=100&&_(n.command)},f=e=>x(e)||w(e);var L="Journey Machine",M=e=>typeof e=="object"&&e!==null,A=e=>e==="idle"||e==="evaluating-when"||e==="running-effect"||e==="error",Y=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},P=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},H=()=>typeof window>"u"||window.location.origin==="null"?"*":window.location.origin,V=e=>{if(e.length===0||typeof window>"u")return!1;let n=window.location.origin;return n==="null"?e==="null":e===n},j=()=>`journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,O=class{constructor(n=100,o=1e4){this.commandTimestamps=[];this.maxCommandsPerWindow=n,this.windowMs=o}isAllowed(){let n=Date.now(),o=n-this.windowMs;return this.commandTimestamps=this.commandTimestamps.filter(t=>t>o),this.commandTimestamps.length>=this.maxCommandsPerWindow?!1:(this.commandTimestamps.push(n),!0)}reset(){this.commandTimestamps=[]}},g=e=>{if(typeof structuredClone=="function")try{return structuredClone(e)}catch{}let n=new WeakSet;try{let o=JSON.stringify(e,(t,r)=>{if(typeof r=="bigint")return r.toString();if(typeof r=="function")return`[Function ${r.name||"anonymous"}]`;if(typeof r=="symbol")return r.toString();if(typeof r=="object"&&r!==null){if(n.has(r))return"[Circular]";n.add(r)}return r});return o===void 0?void 0:JSON.parse(o)}catch{return String(e)}},J=e=>{if(e instanceof Error){let n="cause"in e&&e.cause!==void 0?e.cause:null;return{name:e.name,message:e.message,stack:typeof e.stack=="string"?e.stack:null,cause:g(n)}}return{name:null,message:typeof e=="string"?e:"Unknown error",stack:null,cause:g(e)}},D=e=>{let n={};for(let[o,t]of Object.entries(e.async.byStep))M(t)&&(n[o]={phase:A(t.phase)?t.phase:"idle",eventType:typeof t.eventType=="string"?t.eventType:null,transitionId:typeof t.transitionId=="string"?t.transitionId:null,error:t.error===null?null:g(t.error)});return{current:String(e.current),context:g(e.context),history:e.history.map(o=>String(o)),visited:e.visited.map(o=>String(o)),status:e.status,async:{isLoading:e.async.isLoading,byStep:n}}},q=async(e,n)=>{switch(n.type){case"next":case"back":case"close":case"submit":{let o=await e.send({type:n.type});return{snapshot:o.snapshot,transitioned:o.transitioned,...o.transitionId?{transitionId:o.transitionId}:{}}}case"goTo":{let o=await e.send({type:"goTo",to:n.to});return{snapshot:o.snapshot,transitioned:o.transitioned,...o.transitionId?{transitionId:o.transitionId}:{}}}case"send":{let o=n.event.payload===void 0?{type:n.event.type}:{type:n.event.type,payload:n.event.payload},t=await e.send(o);return{snapshot:t.snapshot,transitioned:t.transitioned,...t.transitionId?{transitionId:t.transitionId}:{}}}case"reset":return{snapshot:e.reset()};case"clearStepError":return{snapshot:e.clearStepError(n.stepId)};case"clearHistory":return{snapshot:e.clearHistory()};case"trimHistory":return{snapshot:e.trimHistory(n.maxHistory)}}},z=(e,n={})=>{if(!(n.enabled??Y())||typeof window>"u")return()=>{};let t=n.commandsEnabled??P(),r=n.machineId?.trim()||j(),R={machineId:r,label:n.label?.trim()||L,appName:n.appName?.trim()||(typeof document<"u"?document.title:"")||null,commandsEnabled:t},b=H(),d=s=>({channel:m,version:1,source:c,kind:s,machineId:r,timestamp:Date.now()}),l=s=>{window.postMessage(s,b)},C=s=>{let a={...d("snapshot"),snapshot:D(s)};l(a)},y=!1,h=new O,T=s=>{if(s.source!==window||!V(s.origin)||y||!f(s.data)||s.data.source!==E||s.data.kind!=="command")return;let a=s.data;if(a.machineId!==r)return;if(!h.isAllowed()){let i={...d("commandError"),requestId:a.requestId,error:J("Command rate limit exceeded. Too many commands in a short time window.")};l(i);return}if(!t){let i={...d("commandError"),requestId:a.requestId,error:J("Bridge commands are disabled by configuration.")};l(i);return}(async()=>{try{let i=await q(e,a.command);if(y)return;let v={...d("commandResult"),requestId:a.requestId,snapshot:D(i.snapshot),...i.transitioned!==void 0?{transitioned:i.transitioned}:{},...i.transitionId?{transitionId:i.transitionId}:{}};l(v)}catch(i){if(y)return;let v={...d("commandError"),requestId:a.requestId,error:J(i)};l(v)}})()};window.addEventListener("message",T);let N=e.subscribe(()=>{y||C(e.getSnapshot())}),B={...d("register"),meta:R,snapshot:D(e.getSnapshot())};return l(B),()=>{if(y)return;y=!0,h.reset(),N(),window.removeEventListener("message",T);let s={...d("unregister")};l(s)}};export{c as JOURNEY_DEVTOOLS_BRIDGE_SOURCE,m as JOURNEY_DEVTOOLS_CHANNEL,E as JOURNEY_DEVTOOLS_EXTENSION_SOURCE,S as JOURNEY_DEVTOOLS_PROTOCOL_VERSION,z as attachJourneyDevtools,x as isJourneyDevtoolsBridgeEnvelope,_ as isJourneyDevtoolsCommand,f as isJourneyDevtoolsEnvelope,w as isJourneyDevtoolsExtensionEnvelope};
1
+ var v=3,S="__RXOVA_JOURNEY_DEVTOOLS__",c="rxova-journey-bridge",E="rxova-journey-extension",p=e=>typeof e=="object"&&e!==null,M=e=>e===c||e===E;var d=(e,t=0)=>{if(t>10)return!1;if(e==null||["string","number","boolean"].includes(typeof e))return!0;if(typeof e=="object"){try{if(JSON.stringify(e).length>5e5)return!1}catch{return!1}return Array.isArray(e)?e.every(o=>d(o,t+1)):Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:Object.values(e).every(o=>d(o,t+1))}return!1},I=e=>p(e)?e.channel===S&&e.version===3&&M(e.source)&&typeof e.kind=="string"&&typeof e.machineId=="string"&&typeof e.timestamp=="number":!1,k=e=>!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>100?!1:"payload"in e&&e.payload!==void 0?d(e.payload):!0,w=e=>{if(!p(e)||typeof e.type!="string"||e.type.length===0||e.type.length>50)return!1;switch(e.type){case"goToNextStep":case"terminateMachine":case"completeJourney":case"resetMachine":case"goToLastVisitedStep":return Object.keys(e).length===1;case"goToStepById":return typeof e.stepId=="string"&&e.stepId.length>0&&e.stepId.length<=100&&Object.keys(e).length===2;case"goToPreviousStep":return(e.steps===void 0||typeof e.steps=="number"&&Number.isInteger(e.steps)&&e.steps>=1&&e.steps<=1e4)&&Object.keys(e).length<=2;case"send":return k(e.event)&&Object.keys(e).length===2;case"updateStepMetadata":return typeof e.stepId=="string"&&e.stepId.length>0&&e.stepId.length<=100&&d(e.metadata)&&Object.keys(e).length===3;case"clearStepError":return(e.stepId===void 0||typeof e.stepId=="string"&&e.stepId.length<=100)&&Object.keys(e).length<=2;default:return!1}},_=e=>{if(!I(e)||e.source!==c)return!1;let t=e;switch(e.kind){case"register":return p(t.meta)&&p(t.snapshot)&&d(t.meta)&&d(t.snapshot);case"unregister":return!0;case"snapshot":return p(t.snapshot)&&d(t.snapshot);case"commandResult":return typeof t.requestId=="string"&&t.requestId.length>0&&t.requestId.length<=100&&p(t.snapshot)&&d(t.snapshot);case"commandError":return typeof t.requestId=="string"&&t.requestId.length>0&&t.requestId.length<=100&&p(t.error);default:return!1}},R=e=>{if(!I(e)||e.source!==E||e.kind!=="command")return!1;let t=e;return typeof t.requestId=="string"&&t.requestId.length>0&&t.requestId.length<=100&&w(t.command)},J=e=>_(e)||R(e);var L="Journey Machine",U=e=>typeof e=="object"&&e!==null,A=e=>e==="idle"||e==="evaluating-when"||e==="running-effect"||e==="error",P=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},Y=()=>{let e=typeof process<"u"?process.env?.NODE_ENV:void 0;return typeof e!="string"?!1:e!=="production"},V=()=>typeof window>"u"||window.location.origin==="null"?"*":window.location.origin,j=e=>{if(e.length===0||typeof window>"u")return!1;let t=window.location.origin;return t==="null"?e==="null":e===t},q=()=>`journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`,O=class{constructor(t=100,n=1e4){this.commandTimestamps=[];this.maxCommandsPerWindow=t,this.windowMs=n}isAllowed(){let t=Date.now(),n=t-this.windowMs;return this.commandTimestamps=this.commandTimestamps.filter(o=>o>n),this.commandTimestamps.length>=this.maxCommandsPerWindow?!1:(this.commandTimestamps.push(t),!0)}reset(){this.commandTimestamps=[]}},g=e=>{if(typeof structuredClone=="function")try{return structuredClone(e)}catch{}let t=new WeakSet;try{let n=JSON.stringify(e,(o,r)=>{if(typeof r=="bigint")return r.toString();if(typeof r=="function")return`[Function ${r.name||"anonymous"}]`;if(typeof r=="symbol")return r.toString();if(typeof r=="object"&&r!==null){if(t.has(r))return"[Circular]";t.add(r)}return r});return n===void 0?void 0:JSON.parse(n)}catch{return String(e)}},f=e=>{if(e instanceof Error){let t="cause"in e&&e.cause!==void 0?e.cause:null;return{name:e.name,message:e.message,stack:typeof e.stack=="string"?e.stack:null,cause:g(t)}}return{name:null,message:typeof e=="string"?e:"Unknown error",stack:null,cause:g(e)}},D=e=>{let t={};for(let[n,o]of Object.entries(e.async.byStep))U(o)&&(t[n]={phase:A(o.phase)?o.phase:"idle",eventType:typeof o.eventType=="string"?o.eventType:null,transitionId:typeof o.transitionId=="string"?o.transitionId:null,error:o.error===null?null:g(o.error)});return{currentStepId:String(e.currentStepId),context:g(e.context),history:{timeline:e.history.timeline.map(n=>String(n)),index:e.history.index},visited:Object.fromEntries(Object.entries(e.visited).map(([n,o])=>[String(n),o===!0])),stepMeta:g(e.stepMeta),status:e.status,async:{isLoading:e.async.isLoading,byStep:t}}},z=async(e,t)=>{switch(t.type){case"goToNextStep":case"completeJourney":{let n=await e.send({type:t.type});return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"terminateMachine":{let n=await e.send({type:"terminateJourney"});return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"goToStepById":{let n=await e.send({type:"goToStepById",stepId:t.stepId});return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"goToPreviousStep":{let n=await e.goToPreviousStep(t.steps);return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"goToLastVisitedStep":{let n=await e.goToLastVisitedStep();return{snapshot:n.snapshot,transitioned:n.transitioned,...n.transitionId?{transitionId:n.transitionId}:{}}}case"send":{let n=t.event.payload===void 0?{type:t.event.type}:{type:t.event.type,payload:t.event.payload},o=await e.send(n);return{snapshot:o.snapshot,transitioned:o.transitioned,...o.transitionId?{transitionId:o.transitionId}:{}}}case"updateStepMetadata":return{snapshot:e.updateStepMetadata(t.stepId,()=>t.metadata)};case"resetMachine":return{snapshot:e.resetMachine()};case"clearStepError":return{snapshot:e.clearStepError(t.stepId)}}},X=(e,t={})=>{if(!(t.enabled??P())||typeof window>"u")return()=>{};let o=t.commandsEnabled??Y(),r=t.machineId?.trim()||q(),x={machineId:r,label:t.label?.trim()||L,appName:t.appName?.trim()||(typeof document<"u"?document.title:"")||null,commandsEnabled:o},b=V(),u=s=>({channel:S,version:3,source:c,kind:s,machineId:r,timestamp:Date.now()}),l=s=>{window.postMessage(s,b)},C=s=>{let a={...u("snapshot"),snapshot:D(s)};l(a)},y=!1,h=new O,T=s=>{if(s.source!==window||!j(s.origin)||y||!J(s.data)||s.data.source!==E||s.data.kind!=="command")return;let a=s.data;if(a.machineId!==r)return;if(!h.isAllowed()){let i={...u("commandError"),requestId:a.requestId,error:f("Command rate limit exceeded. Too many commands in a short time window.")};l(i);return}if(!o){let i={...u("commandError"),requestId:a.requestId,error:f("Bridge commands are disabled by configuration.")};l(i);return}(async()=>{try{let i=await z(e,a.command);if(y)return;let m={...u("commandResult"),requestId:a.requestId,snapshot:D(i.snapshot),...i.transitioned!==void 0?{transitioned:i.transitioned}:{},...i.transitionId?{transitionId:i.transitionId}:{}};l(m)}catch(i){if(y)return;let m={...u("commandError"),requestId:a.requestId,error:f(i)};l(m)}})()};window.addEventListener("message",T);let N=e.subscribe(()=>{y||C(e.getSnapshot())}),B={...u("register"),meta:x,snapshot:D(e.getSnapshot())};return l(B),()=>{if(y)return;y=!0,h.reset(),N(),window.removeEventListener("message",T);let s={...u("unregister")};l(s)}};export{c as JOURNEY_DEVTOOLS_BRIDGE_SOURCE,S as JOURNEY_DEVTOOLS_CHANNEL,E as JOURNEY_DEVTOOLS_EXTENSION_SOURCE,v as JOURNEY_DEVTOOLS_PROTOCOL_VERSION,X as attachJourneyDevtools,_ as isJourneyDevtoolsBridgeEnvelope,w as isJourneyDevtoolsCommand,J as isJourneyDevtoolsEnvelope,R as isJourneyDevtoolsExtensionEnvelope};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/protocol.ts", "../src/bridge.ts"],
4
- "sourcesContent": ["import type { JourneySnapshot, JourneyStepAsyncState } from \"@rxova/journey-core\";\n\nexport const JOURNEY_DEVTOOLS_PROTOCOL_VERSION = 1 as const;\nexport const JOURNEY_DEVTOOLS_CHANNEL = \"__RXOVA_JOURNEY_DEVTOOLS__\" as const;\n\nexport const JOURNEY_DEVTOOLS_BRIDGE_SOURCE = \"rxova-journey-bridge\" as const;\nexport const JOURNEY_DEVTOOLS_EXTENSION_SOURCE = \"rxova-journey-extension\" as const;\n\nexport type JourneyDevtoolsSource =\n | typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE\n | typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\nexport type JourneyDevtoolsStepAsyncState = JourneyStepAsyncState;\n\nexport type JourneyDevtoolsSerializableSnapshot = JourneySnapshot<unknown, string>;\n\nexport type JourneyDevtoolsMachineMeta = {\n machineId: string;\n label: string;\n appName: string | null;\n commandsEnabled?: boolean;\n};\n\nexport type JourneyDevtoolsSerializedError = {\n name: string | null;\n message: string;\n stack: string | null;\n cause: unknown;\n};\n\nexport type JourneyDevtoolsCommand =\n | { type: \"next\" }\n | { type: \"back\" }\n | { type: \"close\" }\n | { type: \"submit\" }\n | { type: \"goTo\"; to: string }\n | { type: \"send\"; event: { type: string; payload?: unknown } }\n | { type: \"reset\" }\n | { type: \"clearStepError\"; stepId?: string }\n | { type: \"clearHistory\" }\n | { type: \"trimHistory\"; maxHistory?: number | null };\n\nexport type JourneyDevtoolsEnvelopeBase = {\n channel: typeof JOURNEY_DEVTOOLS_CHANNEL;\n version: typeof JOURNEY_DEVTOOLS_PROTOCOL_VERSION;\n source: JourneyDevtoolsSource;\n kind: string;\n machineId: string;\n timestamp: number;\n};\n\nexport type JourneyDevtoolsBridgeRegisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"register\";\n meta: JourneyDevtoolsMachineMeta;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeUnregisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"unregister\";\n};\n\nexport type JourneyDevtoolsBridgeSnapshotEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"snapshot\";\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeCommandResultEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandResult\";\n requestId: string;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nexport type JourneyDevtoolsBridgeCommandErrorEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandError\";\n requestId: string;\n error: JourneyDevtoolsSerializedError;\n};\n\nexport type JourneyDevtoolsExtensionCommandEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n kind: \"command\";\n requestId: string;\n command: JourneyDevtoolsCommand;\n};\n\nexport type JourneyDevtoolsBridgeEnvelope =\n | JourneyDevtoolsBridgeRegisterEnvelope\n | JourneyDevtoolsBridgeUnregisterEnvelope\n | JourneyDevtoolsBridgeSnapshotEnvelope\n | JourneyDevtoolsBridgeCommandResultEnvelope\n | JourneyDevtoolsBridgeCommandErrorEnvelope;\n\nexport type JourneyDevtoolsExtensionEnvelope = JourneyDevtoolsExtensionCommandEnvelope;\n\nexport type JourneyDevtoolsEnvelope =\n | JourneyDevtoolsBridgeEnvelope\n | JourneyDevtoolsExtensionEnvelope;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isKnownSource = (value: unknown): value is JourneyDevtoolsSource =>\n value === JOURNEY_DEVTOOLS_BRIDGE_SOURCE || value === JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\n/**\n * Maximum depth for nested object validation.\n * Prevents stack overflow and excessive processing from deeply nested malicious payloads.\n */\nconst MAX_PAYLOAD_DEPTH = 10;\n\n/**\n * Maximum size (in JSON string length) for serialized payloads.\n * Prevents memory exhaustion from extremely large payloads.\n */\nconst MAX_PAYLOAD_SIZE = 500_000; // 500KB\n\n/**\n * Validates that a value is safe for transport.\n * Checks depth and size constraints to prevent malicious payloads.\n */\nconst isSafePayload = (value: unknown, depth = 0): boolean => {\n if (depth > MAX_PAYLOAD_DEPTH) {\n return false;\n }\n\n if (value === null || value === undefined) {\n return true;\n }\n\n const primitiveTypes = [\"string\", \"number\", \"boolean\"];\n if (primitiveTypes.includes(typeof value)) {\n return true;\n }\n\n if (typeof value === \"object\") {\n // Check JSON serialization size\n try {\n const serialized = JSON.stringify(value);\n if (serialized.length > MAX_PAYLOAD_SIZE) {\n return false;\n }\n } catch {\n // Circular references or non-serializable objects are not safe\n return false;\n }\n\n // Recursively validate nested objects and arrays\n if (Array.isArray(value)) {\n return value.every((item) => isSafePayload(item, depth + 1));\n }\n\n // Validate plain objects (guard against prototype pollution)\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n ) {\n return false;\n }\n\n return Object.values(value).every((prop) => isSafePayload(prop, depth + 1));\n }\n\n // Reject functions, symbols, and other non-serializable types\n return false;\n};\n\nconst hasBaseEnvelopeShape = (value: unknown): value is JourneyDevtoolsEnvelopeBase => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n value.channel === JOURNEY_DEVTOOLS_CHANNEL &&\n value.version === JOURNEY_DEVTOOLS_PROTOCOL_VERSION &&\n isKnownSource(value.source) &&\n typeof value.kind === \"string\" &&\n typeof value.machineId === \"string\" &&\n typeof value.timestamp === \"number\"\n );\n};\n\nconst isSendEvent = (value: unknown): value is { type: string; payload?: unknown } => {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.type !== \"string\" || value.type.length === 0 || value.type.length > 100) {\n return false;\n }\n\n // Validate payload if present\n if (\"payload\" in value && value.payload !== undefined) {\n return isSafePayload(value.payload);\n }\n\n return true;\n};\n\nexport const isJourneyDevtoolsCommand = (value: unknown): value is JourneyDevtoolsCommand => {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n // Validate command type is within reasonable length\n if (value.type.length === 0 || value.type.length > 50) {\n return false;\n }\n\n switch (value.type) {\n case \"next\":\n case \"back\":\n case \"close\":\n case \"submit\":\n case \"reset\":\n case \"clearHistory\":\n // These commands should have no extra properties beyond type\n return Object.keys(value).length === 1;\n case \"goTo\":\n return (\n typeof value.to === \"string\" &&\n value.to.length > 0 &&\n value.to.length <= 100 &&\n Object.keys(value).length === 2\n );\n case \"send\":\n return isSendEvent(value.event) && Object.keys(value).length === 2;\n case \"clearStepError\":\n return (\n (value.stepId === undefined ||\n (typeof value.stepId === \"string\" && value.stepId.length <= 100)) &&\n Object.keys(value).length <= 2\n );\n case \"trimHistory\":\n return (\n (value.maxHistory === undefined ||\n value.maxHistory === null ||\n (typeof value.maxHistory === \"number\" &&\n Number.isInteger(value.maxHistory) &&\n value.maxHistory >= 0 &&\n value.maxHistory <= 10000)) &&\n Object.keys(value).length <= 2\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsBridgeEnvelope = (\n value: unknown\n): value is JourneyDevtoolsBridgeEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_BRIDGE_SOURCE) {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n\n switch (value.kind) {\n case \"register\":\n return (\n isRecord(envelope.meta) &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.meta) &&\n isSafePayload(envelope.snapshot)\n );\n case \"unregister\":\n return true;\n case \"snapshot\":\n return isRecord(envelope.snapshot) && isSafePayload(envelope.snapshot);\n case \"commandResult\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.snapshot)\n );\n case \"commandError\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.error)\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsExtensionEnvelope = (\n value: unknown\n): value is JourneyDevtoolsExtensionEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE) {\n return false;\n }\n\n if (value.kind !== \"command\") {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isJourneyDevtoolsCommand(envelope.command)\n );\n};\n\nexport const isJourneyDevtoolsEnvelope = (value: unknown): value is JourneyDevtoolsEnvelope =>\n isJourneyDevtoolsBridgeEnvelope(value) || isJourneyDevtoolsExtensionEnvelope(value);\n", "import type {\n JourneyEventPayloadMap,\n JourneyMachine,\n JourneySendResult,\n JourneySnapshot\n} from \"@rxova/journey-core\";\nimport {\n JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n JOURNEY_DEVTOOLS_CHANNEL,\n JOURNEY_DEVTOOLS_EXTENSION_SOURCE,\n JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n isJourneyDevtoolsEnvelope,\n type JourneyDevtoolsBridgeCommandErrorEnvelope,\n type JourneyDevtoolsBridgeCommandResultEnvelope,\n type JourneyDevtoolsBridgeEnvelope,\n type JourneyDevtoolsBridgeRegisterEnvelope,\n type JourneyDevtoolsBridgeSnapshotEnvelope,\n type JourneyDevtoolsBridgeUnregisterEnvelope,\n type JourneyDevtoolsCommand,\n type JourneyDevtoolsExtensionCommandEnvelope,\n type JourneyDevtoolsMachineMeta,\n type JourneyDevtoolsSerializableSnapshot,\n type JourneyDevtoolsSerializedError\n} from \"./protocol\";\n\ndeclare const process: { env?: { NODE_ENV?: string } } | undefined;\n\nexport type JourneyDevtoolsBridgeOptions = {\n machineId?: string;\n label?: string;\n enabled?: boolean;\n appName?: string;\n commandsEnabled?: boolean;\n};\n\ntype JourneySendEvent<TStepId extends string> = Parameters<\n JourneyMachine<unknown, TStepId, string>[\"send\"]\n>[0];\n\ntype SendOutcome<TContext, TStepId extends string> = {\n snapshot: JourneySnapshot<TContext, TStepId>;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nconst DEFAULT_MACHINE_LABEL = \"Journey Machine\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isJourneyAsyncPhase = (\n value: unknown\n): value is JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string][\"phase\"] =>\n value === \"idle\" ||\n value === \"evaluating-when\" ||\n value === \"running-effect\" ||\n value === \"error\";\n\nconst resolveDefaultEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveDefaultCommandsEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveWindowTargetOrigin = (): string => {\n if (typeof window === \"undefined\") {\n return \"*\";\n }\n\n return window.location.origin === \"null\" ? \"*\" : window.location.origin;\n};\n\n// No session token infrastructure needed\n\n/**\n * Validates that the message origin matches the current window origin.\n * This prevents messages from other origins from being processed.\n *\n * Note: This is part of defense-in-depth but not a hard security boundary.\n * Code running in the same origin can still send messages.\n */\nconst isExpectedWindowOrigin = (origin: string): boolean => {\n if (origin.length === 0) {\n return false;\n }\n\n if (typeof window === \"undefined\") {\n return false;\n }\n\n const expected = window.location.origin;\n if (expected === \"null\") {\n // For file:// or sandboxed contexts where origin is \"null\"\n return origin === \"null\";\n }\n\n // Strict equality check - no wildcard matching\n return origin === expected;\n};\n\nconst createMachineId = (): string =>\n `journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n\n/**\n * Simple rate limiter to prevent command abuse.\n * Tracks command timestamps and enforces a maximum rate.\n */\nclass CommandRateLimiter {\n private commandTimestamps: number[] = [];\n private readonly maxCommandsPerWindow: number;\n private readonly windowMs: number;\n\n constructor(maxCommandsPerWindow = 100, windowMs = 10000) {\n this.maxCommandsPerWindow = maxCommandsPerWindow;\n this.windowMs = windowMs;\n }\n\n /**\n * Checks if a command is allowed based on rate limits.\n * Returns true if allowed, false if rate limit exceeded.\n */\n isAllowed(): boolean {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n\n // Remove old timestamps outside the window\n this.commandTimestamps = this.commandTimestamps.filter((ts) => ts > windowStart);\n\n if (this.commandTimestamps.length >= this.maxCommandsPerWindow) {\n return false;\n }\n\n this.commandTimestamps.push(now);\n return true;\n }\n\n reset(): void {\n this.commandTimestamps = [];\n }\n}\n\nconst cloneForTransport = (value: unknown): unknown => {\n if (typeof structuredClone === \"function\") {\n try {\n return structuredClone(value);\n } catch {\n // Fall through to the JSON serializer below.\n }\n }\n\n const seen = new WeakSet<object>();\n\n try {\n const serialized = JSON.stringify(value, (_key, currentValue) => {\n if (typeof currentValue === \"bigint\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"function\") {\n return `[Function ${currentValue.name || \"anonymous\"}]`;\n }\n if (typeof currentValue === \"symbol\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"object\" && currentValue !== null) {\n if (seen.has(currentValue)) {\n return \"[Circular]\";\n }\n seen.add(currentValue);\n }\n return currentValue;\n });\n\n if (serialized === undefined) {\n return undefined;\n }\n\n return JSON.parse(serialized) as unknown;\n } catch {\n return String(value);\n }\n};\n\nconst serializeError = (error: unknown): JourneyDevtoolsSerializedError => {\n if (error instanceof Error) {\n const cause =\n \"cause\" in error && (error as { cause?: unknown }).cause !== undefined\n ? (error as { cause?: unknown }).cause\n : null;\n return {\n name: error.name,\n message: error.message,\n stack: typeof error.stack === \"string\" ? error.stack : null,\n cause: cloneForTransport(cause)\n };\n }\n\n return {\n name: null,\n message: typeof error === \"string\" ? error : \"Unknown error\",\n stack: null,\n cause: cloneForTransport(error)\n };\n};\n\nconst serializeSnapshot = <TContext, TStepId extends string>(\n snapshot: JourneySnapshot<TContext, TStepId>\n): JourneyDevtoolsSerializableSnapshot => {\n const byStep: Record<string, JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string]> = {};\n\n for (const [stepId, stepState] of Object.entries(\n snapshot.async.byStep as Record<string, unknown>\n )) {\n if (!isRecord(stepState)) {\n continue;\n }\n\n byStep[stepId] = {\n phase: isJourneyAsyncPhase(stepState.phase) ? stepState.phase : \"idle\",\n eventType: typeof stepState.eventType === \"string\" ? stepState.eventType : null,\n transitionId: typeof stepState.transitionId === \"string\" ? stepState.transitionId : null,\n error: stepState.error === null ? null : cloneForTransport(stepState.error)\n };\n }\n\n return {\n current: String(snapshot.current),\n context: cloneForTransport(snapshot.context),\n history: snapshot.history.map((stepId) => String(stepId)),\n visited: snapshot.visited.map((stepId) => String(stepId)),\n status: snapshot.status,\n async: {\n isLoading: snapshot.async.isLoading,\n byStep\n }\n };\n};\n\nconst runCommand = async <TContext, TStepId extends string>(\n machine: JourneyMachine<TContext, TStepId, string>,\n command: JourneyDevtoolsCommand\n): Promise<SendOutcome<TContext, TStepId>> => {\n switch (command.type) {\n case \"next\":\n case \"back\":\n case \"close\":\n case \"submit\": {\n const result = await machine.send({ type: command.type } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goTo\": {\n const result = await machine.send({\n type: \"goTo\",\n to: command.to\n } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"send\": {\n const sendEvent =\n command.event.payload === undefined\n ? { type: command.event.type }\n : { type: command.event.type, payload: command.event.payload };\n const result: JourneySendResult<TContext, TStepId> = await machine.send(\n sendEvent as JourneySendEvent<TStepId>\n );\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"reset\":\n return {\n snapshot: machine.reset()\n };\n case \"clearStepError\":\n return {\n snapshot: machine.clearStepError(command.stepId as TStepId | undefined)\n };\n case \"clearHistory\":\n return {\n snapshot: machine.clearHistory()\n };\n case \"trimHistory\":\n return {\n snapshot: machine.trimHistory(command.maxHistory)\n };\n }\n};\n\nexport const attachJourneyDevtools = <\n TContext,\n TStepId extends string,\n TEventType extends string,\n TPayloadMap extends JourneyEventPayloadMap<TEventType>\n>(\n machine: JourneyMachine<TContext, TStepId, TEventType, TPayloadMap>,\n options: JourneyDevtoolsBridgeOptions = {}\n): (() => void) => {\n const enabled = options.enabled ?? resolveDefaultEnabled();\n if (!enabled || typeof window === \"undefined\") {\n return () => {};\n }\n const commandsEnabled = options.commandsEnabled ?? resolveDefaultCommandsEnabled();\n\n const machineId = options.machineId?.trim() || createMachineId();\n const meta: JourneyDevtoolsMachineMeta = {\n machineId,\n label: options.label?.trim() || DEFAULT_MACHINE_LABEL,\n appName:\n options.appName?.trim() || (typeof document !== \"undefined\" ? document.title : \"\") || null,\n commandsEnabled\n };\n const targetOrigin = resolveWindowTargetOrigin();\n\n const createBaseEnvelope = <TKind extends JourneyDevtoolsBridgeEnvelope[\"kind\"]>(\n kind: TKind\n ) => ({\n channel: JOURNEY_DEVTOOLS_CHANNEL,\n version: JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n source: JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n kind,\n machineId,\n timestamp: Date.now()\n });\n\n const post = (envelope: JourneyDevtoolsBridgeEnvelope) => {\n window.postMessage(envelope, targetOrigin);\n };\n\n const postSnapshot = (snapshot: JourneySnapshot<TContext, TStepId>) => {\n const envelope: JourneyDevtoolsBridgeSnapshotEnvelope = {\n ...createBaseEnvelope(\"snapshot\"),\n snapshot: serializeSnapshot(snapshot)\n };\n post(envelope);\n };\n\n let isDetached = false;\n const rateLimiter = new CommandRateLimiter();\n\n const onMessage = (event: MessageEvent<unknown>) => {\n if (\n event.source !== window ||\n !isExpectedWindowOrigin(event.origin) ||\n isDetached ||\n !isJourneyDevtoolsEnvelope(event.data)\n ) {\n return;\n }\n\n if (event.data.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE || event.data.kind !== \"command\") {\n return;\n }\n\n const commandEnvelope: JourneyDevtoolsExtensionCommandEnvelope = event.data;\n if (commandEnvelope.machineId !== machineId) {\n return;\n }\n\n // Rate limiting to prevent command abuse\n if (!rateLimiter.isAllowed()) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\n \"Command rate limit exceeded. Too many commands in a short time window.\"\n )\n };\n post(errorEnvelope);\n return;\n }\n\n if (!commandsEnabled) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\"Bridge commands are disabled by configuration.\")\n };\n post(errorEnvelope);\n return;\n }\n\n const run = async () => {\n try {\n const outcome = await runCommand(\n machine as JourneyMachine<TContext, TStepId, string>,\n commandEnvelope.command\n );\n if (isDetached) {\n return;\n }\n\n const resultEnvelope: JourneyDevtoolsBridgeCommandResultEnvelope = {\n ...createBaseEnvelope(\"commandResult\"),\n requestId: commandEnvelope.requestId,\n snapshot: serializeSnapshot(outcome.snapshot),\n ...(outcome.transitioned !== undefined ? { transitioned: outcome.transitioned } : {}),\n ...(outcome.transitionId ? { transitionId: outcome.transitionId } : {})\n };\n post(resultEnvelope);\n } catch (error) {\n if (isDetached) {\n return;\n }\n\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(error)\n };\n post(errorEnvelope);\n }\n };\n\n void run();\n };\n\n window.addEventListener(\"message\", onMessage);\n\n const unsubscribe = machine.subscribe(() => {\n if (isDetached) {\n return;\n }\n postSnapshot(machine.getSnapshot());\n });\n\n const registerEnvelope: JourneyDevtoolsBridgeRegisterEnvelope = {\n ...createBaseEnvelope(\"register\"),\n meta,\n snapshot: serializeSnapshot(machine.getSnapshot())\n };\n post(registerEnvelope);\n\n return () => {\n if (isDetached) {\n return;\n }\n\n isDetached = true;\n rateLimiter.reset();\n unsubscribe();\n window.removeEventListener(\"message\", onMessage);\n\n const unregisterEnvelope: JourneyDevtoolsBridgeUnregisterEnvelope = {\n ...createBaseEnvelope(\"unregister\")\n };\n post(unregisterEnvelope);\n };\n};\n"],
5
- "mappings": "AAEO,IAAMA,EAAoC,EACpCC,EAA2B,6BAE3BC,EAAiC,uBACjCC,EAAoC,0BAmG3CC,EAAYC,GAChB,OAAOA,GAAU,UAAYA,IAAU,KAEnCC,EAAiBD,GACrBA,IAAUH,GAAkCG,IAAUF,EAkBxD,IAAMI,EAAgB,CAACC,EAAgBC,EAAQ,IAAe,CAC5D,GAAIA,EAAQ,GACV,MAAO,GAQT,GALID,GAAU,MAIS,CAAC,SAAU,SAAU,SAAS,EAClC,SAAS,OAAOA,CAAK,EACtC,MAAO,GAGT,GAAI,OAAOA,GAAU,SAAU,CAE7B,GAAI,CAEF,GADmB,KAAK,UAAUA,CAAK,EACxB,OAAS,IACtB,MAAO,EAEX,MAAQ,CAEN,MAAO,EACT,CAGA,OAAI,MAAM,QAAQA,CAAK,EACdA,EAAM,MAAOE,GAASH,EAAcG,EAAMD,EAAQ,CAAC,CAAC,EAK3D,OAAO,eAAeD,CAAK,IAAM,OAAO,WACxC,OAAO,eAAeA,CAAK,IAAM,KAE1B,GAGF,OAAO,OAAOA,CAAK,EAAE,MAAOG,GAASJ,EAAcI,EAAMF,EAAQ,CAAC,CAAC,CAC5E,CAGA,MAAO,EACT,EAEMG,EAAwBJ,GACvBK,EAASL,CAAK,EAKjBA,EAAM,UAAYM,GAClBN,EAAM,UAAY,GAClBO,EAAcP,EAAM,MAAM,GAC1B,OAAOA,EAAM,MAAS,UACtB,OAAO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B,EACA,GAAIN,EACF,OAGF,IAAMS,EAA6D,CACjE,GAAGhB,EAAmB,eAAe,EACrC,UAAWa,EAAgB,UAC3B,SAAU7B,EAAkB+B,EAAQ,QAAQ,EAC5C,GAAIA,EAAQ,eAAiB,OAAY,CAAE,aAAcA,EAAQ,YAAa,EAAI,CAAC,EACnF,GAAIA,EAAQ,aAAe,CAAE,aAAcA,EAAQ,YAAa,EAAI,CAAC,CACvE,EACAX,EAAKY,CAAc,CACrB,OAASlC,EAAO,CACd,GAAIyB,EACF,OAGF,IAAMO,EAA2D,CAC/D,GAAGd,EAAmB,cAAc,EACpC,UAAWa,EAAgB,UAC3B,MAAOhC,EAAeC,CAAK,CAC7B,EACAsB,EAAKU,CAAa,CACpB,CACF,GAES,CACX,EAEA,OAAO,iBAAiB,UAAWL,CAAS,EAE5C,IAAMQ,EAAc3B,EAAQ,UAAU,IAAM,CACtCiB,GAGJD,EAAahB,EAAQ,YAAY,CAAC,CACpC,CAAC,EAEK4B,EAA0D,CAC9D,GAAGlB,EAAmB,UAAU,EAChC,KAAAF,EACA,SAAUd,EAAkBM,EAAQ,YAAY,CAAC,CACnD,EACA,OAAAc,EAAKc,CAAgB,EAEd,IAAM,CACX,GAAIX,EACF,OAGFA,EAAa,GACbC,EAAY,MAAM,EAClBS,EAAY,EACZ,OAAO,oBAAoB,UAAWR,CAAS,EAE/C,IAAMU,EAA8D,CAClE,GAAGnB,EAAmB,YAAY,CACpC,EACAI,EAAKe,CAAkB,CACzB,CACF",
6
- "names": ["JOURNEY_DEVTOOLS_PROTOCOL_VERSION", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isRecord", "value", "isKnownSource", "isSafePayload", "value", "depth", "item", "prop", "hasBaseEnvelopeShape", "isRecord", "JOURNEY_DEVTOOLS_CHANNEL", "isKnownSource", "isSendEvent", "isJourneyDevtoolsCommand", "isJourneyDevtoolsBridgeEnvelope", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "envelope", "isJourneyDevtoolsExtensionEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isJourneyDevtoolsEnvelope", "DEFAULT_MACHINE_LABEL", "isRecord", "value", "isJourneyAsyncPhase", "resolveDefaultEnabled", "nodeEnv", "resolveDefaultCommandsEnabled", "resolveWindowTargetOrigin", "isExpectedWindowOrigin", "origin", "expected", "createMachineId", "CommandRateLimiter", "maxCommandsPerWindow", "windowMs", "now", "windowStart", "ts", "cloneForTransport", "seen", "serialized", "_key", "currentValue", "serializeError", "error", "cause", "serializeSnapshot", "snapshot", "byStep", "stepId", "stepState", "runCommand", "machine", "command", "result", "sendEvent", "attachJourneyDevtools", "options", "commandsEnabled", "machineId", "meta", "targetOrigin", "createBaseEnvelope", "kind", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "post", "envelope", "postSnapshot", "isDetached", "rateLimiter", "onMessage", "event", "isJourneyDevtoolsEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "commandEnvelope", "errorEnvelope", "outcome", "resultEnvelope", "unsubscribe", "registerEnvelope", "unregisterEnvelope"]
4
+ "sourcesContent": ["import type { JourneySnapshot, JourneyStepAsyncState } from \"@rxova/journey-core\";\n\nexport const JOURNEY_DEVTOOLS_PROTOCOL_VERSION = 3 as const;\nexport const JOURNEY_DEVTOOLS_CHANNEL = \"__RXOVA_JOURNEY_DEVTOOLS__\" as const;\n\nexport const JOURNEY_DEVTOOLS_BRIDGE_SOURCE = \"rxova-journey-bridge\" as const;\nexport const JOURNEY_DEVTOOLS_EXTENSION_SOURCE = \"rxova-journey-extension\" as const;\n\nexport type JourneyDevtoolsSource =\n | typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE\n | typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\nexport type JourneyDevtoolsStepAsyncState = JourneyStepAsyncState;\n\nexport type JourneyDevtoolsSerializableSnapshot = JourneySnapshot<unknown, string>;\n\nexport type JourneyDevtoolsMachineMeta = {\n machineId: string;\n label: string;\n appName: string | null;\n commandsEnabled?: boolean;\n};\n\nexport type JourneyDevtoolsSerializedError = {\n name: string | null;\n message: string;\n stack: string | null;\n cause: unknown;\n};\n\nexport type JourneyDevtoolsCommand =\n | { type: \"goToNextStep\" }\n | { type: \"terminateMachine\" }\n | { type: \"completeJourney\" }\n | { type: \"goToStepById\"; stepId: string }\n | { type: \"goToPreviousStep\"; steps?: number }\n | { type: \"goToLastVisitedStep\" }\n | { type: \"send\"; event: { type: string; payload?: unknown } }\n | { type: \"updateStepMetadata\"; stepId: string; metadata: unknown }\n | { type: \"resetMachine\" }\n | { type: \"clearStepError\"; stepId?: string };\n\nexport type JourneyDevtoolsEnvelopeBase = {\n channel: typeof JOURNEY_DEVTOOLS_CHANNEL;\n version: typeof JOURNEY_DEVTOOLS_PROTOCOL_VERSION;\n source: JourneyDevtoolsSource;\n kind: string;\n machineId: string;\n timestamp: number;\n};\n\nexport type JourneyDevtoolsBridgeRegisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"register\";\n meta: JourneyDevtoolsMachineMeta;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeUnregisterEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"unregister\";\n};\n\nexport type JourneyDevtoolsBridgeSnapshotEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"snapshot\";\n snapshot: JourneyDevtoolsSerializableSnapshot;\n};\n\nexport type JourneyDevtoolsBridgeCommandResultEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandResult\";\n requestId: string;\n snapshot: JourneyDevtoolsSerializableSnapshot;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nexport type JourneyDevtoolsBridgeCommandErrorEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_BRIDGE_SOURCE;\n kind: \"commandError\";\n requestId: string;\n error: JourneyDevtoolsSerializedError;\n};\n\nexport type JourneyDevtoolsExtensionCommandEnvelope = JourneyDevtoolsEnvelopeBase & {\n source: typeof JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n kind: \"command\";\n requestId: string;\n command: JourneyDevtoolsCommand;\n};\n\nexport type JourneyDevtoolsBridgeEnvelope =\n | JourneyDevtoolsBridgeRegisterEnvelope\n | JourneyDevtoolsBridgeUnregisterEnvelope\n | JourneyDevtoolsBridgeSnapshotEnvelope\n | JourneyDevtoolsBridgeCommandResultEnvelope\n | JourneyDevtoolsBridgeCommandErrorEnvelope;\n\nexport type JourneyDevtoolsExtensionEnvelope = JourneyDevtoolsExtensionCommandEnvelope;\n\nexport type JourneyDevtoolsEnvelope =\n | JourneyDevtoolsBridgeEnvelope\n | JourneyDevtoolsExtensionEnvelope;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isKnownSource = (value: unknown): value is JourneyDevtoolsSource =>\n value === JOURNEY_DEVTOOLS_BRIDGE_SOURCE || value === JOURNEY_DEVTOOLS_EXTENSION_SOURCE;\n\n/**\n * Maximum depth for nested object validation.\n * Prevents stack overflow and excessive processing from deeply nested malicious payloads.\n */\nconst MAX_PAYLOAD_DEPTH = 10;\n\n/**\n * Maximum size (in JSON string length) for serialized payloads.\n * Prevents memory exhaustion from extremely large payloads.\n */\nconst MAX_PAYLOAD_SIZE = 500_000; // 500KB\n\n/**\n * Validates that a value is safe for transport.\n * Checks depth and size constraints to prevent malicious payloads.\n */\nconst isSafePayload = (value: unknown, depth = 0): boolean => {\n if (depth > MAX_PAYLOAD_DEPTH) {\n return false;\n }\n\n if (value === null || value === undefined) {\n return true;\n }\n\n const primitiveTypes = [\"string\", \"number\", \"boolean\"];\n if (primitiveTypes.includes(typeof value)) {\n return true;\n }\n\n if (typeof value === \"object\") {\n // Check JSON serialization size\n try {\n const serialized = JSON.stringify(value);\n if (serialized.length > MAX_PAYLOAD_SIZE) {\n return false;\n }\n } catch {\n // Circular references or non-serializable objects are not safe\n return false;\n }\n\n // Recursively validate nested objects and arrays\n if (Array.isArray(value)) {\n return value.every((item) => isSafePayload(item, depth + 1));\n }\n\n // Validate plain objects (guard against prototype pollution)\n if (\n Object.getPrototypeOf(value) !== Object.prototype &&\n Object.getPrototypeOf(value) !== null\n ) {\n return false;\n }\n\n return Object.values(value).every((prop) => isSafePayload(prop, depth + 1));\n }\n\n // Reject functions, symbols, and other non-serializable types\n return false;\n};\n\nconst hasBaseEnvelopeShape = (value: unknown): value is JourneyDevtoolsEnvelopeBase => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n value.channel === JOURNEY_DEVTOOLS_CHANNEL &&\n value.version === JOURNEY_DEVTOOLS_PROTOCOL_VERSION &&\n isKnownSource(value.source) &&\n typeof value.kind === \"string\" &&\n typeof value.machineId === \"string\" &&\n typeof value.timestamp === \"number\"\n );\n};\n\nconst isSendEvent = (value: unknown): value is { type: string; payload?: unknown } => {\n if (!isRecord(value)) {\n return false;\n }\n\n if (typeof value.type !== \"string\" || value.type.length === 0 || value.type.length > 100) {\n return false;\n }\n\n // Validate payload if present\n if (\"payload\" in value && value.payload !== undefined) {\n return isSafePayload(value.payload);\n }\n\n return true;\n};\n\nexport const isJourneyDevtoolsCommand = (value: unknown): value is JourneyDevtoolsCommand => {\n if (!isRecord(value) || typeof value.type !== \"string\") {\n return false;\n }\n\n // Validate command type is within reasonable length\n if (value.type.length === 0 || value.type.length > 50) {\n return false;\n }\n\n switch (value.type) {\n case \"goToNextStep\":\n case \"terminateMachine\":\n case \"completeJourney\":\n case \"resetMachine\":\n case \"goToLastVisitedStep\":\n // These commands should have no extra properties beyond type\n return Object.keys(value).length === 1;\n case \"goToStepById\":\n return (\n typeof value.stepId === \"string\" &&\n value.stepId.length > 0 &&\n value.stepId.length <= 100 &&\n Object.keys(value).length === 2\n );\n case \"goToPreviousStep\":\n return (\n (value.steps === undefined ||\n (typeof value.steps === \"number\" &&\n Number.isInteger(value.steps) &&\n value.steps >= 1 &&\n value.steps <= 10000)) &&\n Object.keys(value).length <= 2\n );\n case \"send\":\n return isSendEvent(value.event) && Object.keys(value).length === 2;\n case \"updateStepMetadata\":\n return (\n typeof value.stepId === \"string\" &&\n value.stepId.length > 0 &&\n value.stepId.length <= 100 &&\n isSafePayload(value.metadata) &&\n Object.keys(value).length === 3\n );\n case \"clearStepError\":\n return (\n (value.stepId === undefined ||\n (typeof value.stepId === \"string\" && value.stepId.length <= 100)) &&\n Object.keys(value).length <= 2\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsBridgeEnvelope = (\n value: unknown\n): value is JourneyDevtoolsBridgeEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_BRIDGE_SOURCE) {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n\n switch (value.kind) {\n case \"register\":\n return (\n isRecord(envelope.meta) &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.meta) &&\n isSafePayload(envelope.snapshot)\n );\n case \"unregister\":\n return true;\n case \"snapshot\":\n return isRecord(envelope.snapshot) && isSafePayload(envelope.snapshot);\n case \"commandResult\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.snapshot) &&\n isSafePayload(envelope.snapshot)\n );\n case \"commandError\":\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isRecord(envelope.error)\n );\n default:\n return false;\n }\n};\n\nexport const isJourneyDevtoolsExtensionEnvelope = (\n value: unknown\n): value is JourneyDevtoolsExtensionEnvelope => {\n if (!hasBaseEnvelopeShape(value) || value.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE) {\n return false;\n }\n\n if (value.kind !== \"command\") {\n return false;\n }\n\n const envelope = value as Record<string, unknown>;\n return (\n typeof envelope.requestId === \"string\" &&\n envelope.requestId.length > 0 &&\n envelope.requestId.length <= 100 &&\n isJourneyDevtoolsCommand(envelope.command)\n );\n};\n\nexport const isJourneyDevtoolsEnvelope = (value: unknown): value is JourneyDevtoolsEnvelope =>\n isJourneyDevtoolsBridgeEnvelope(value) || isJourneyDevtoolsExtensionEnvelope(value);\n", "import type {\n JourneyEventPayloadMap,\n JourneyMachine,\n JourneySendResult,\n JourneySnapshot\n} from \"@rxova/journey-core\";\nimport {\n JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n JOURNEY_DEVTOOLS_CHANNEL,\n JOURNEY_DEVTOOLS_EXTENSION_SOURCE,\n JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n isJourneyDevtoolsEnvelope,\n type JourneyDevtoolsBridgeCommandErrorEnvelope,\n type JourneyDevtoolsBridgeCommandResultEnvelope,\n type JourneyDevtoolsBridgeEnvelope,\n type JourneyDevtoolsBridgeRegisterEnvelope,\n type JourneyDevtoolsBridgeSnapshotEnvelope,\n type JourneyDevtoolsBridgeUnregisterEnvelope,\n type JourneyDevtoolsCommand,\n type JourneyDevtoolsExtensionCommandEnvelope,\n type JourneyDevtoolsMachineMeta,\n type JourneyDevtoolsSerializableSnapshot,\n type JourneyDevtoolsSerializedError\n} from \"./protocol\";\n\ndeclare const process: { env?: { NODE_ENV?: string } } | undefined;\n\nexport type JourneyDevtoolsBridgeOptions = {\n machineId?: string;\n label?: string;\n enabled?: boolean;\n appName?: string;\n commandsEnabled?: boolean;\n};\n\ntype JourneySendEvent<TStepId extends string> = Parameters<\n JourneyMachine<unknown, TStepId, string, Record<never, never>, unknown>[\"send\"]\n>[0];\n\ntype SendOutcome<TContext, TStepId extends string, TStepMeta> = {\n snapshot: JourneySnapshot<TContext, TStepId, TStepMeta>;\n transitioned?: boolean;\n transitionId?: string;\n};\n\nconst DEFAULT_MACHINE_LABEL = \"Journey Machine\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isJourneyAsyncPhase = (\n value: unknown\n): value is JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string][\"phase\"] =>\n value === \"idle\" ||\n value === \"evaluating-when\" ||\n value === \"running-effect\" ||\n value === \"error\";\n\nconst resolveDefaultEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveDefaultCommandsEnabled = (): boolean => {\n const nodeEnv = typeof process !== \"undefined\" ? process.env?.NODE_ENV : undefined;\n if (typeof nodeEnv !== \"string\") {\n return false;\n }\n\n return nodeEnv !== \"production\";\n};\n\nconst resolveWindowTargetOrigin = (): string => {\n if (typeof window === \"undefined\") {\n return \"*\";\n }\n\n return window.location.origin === \"null\" ? \"*\" : window.location.origin;\n};\n\n// No session token infrastructure needed\n\n/**\n * Validates that the message origin matches the current window origin.\n * This prevents messages from other origins from being processed.\n *\n * Note: This is part of defense-in-depth but not a hard security boundary.\n * Code running in the same origin can still send messages.\n */\nconst isExpectedWindowOrigin = (origin: string): boolean => {\n if (origin.length === 0) {\n return false;\n }\n\n if (typeof window === \"undefined\") {\n return false;\n }\n\n const expected = window.location.origin;\n if (expected === \"null\") {\n // For file:// or sandboxed contexts where origin is \"null\"\n return origin === \"null\";\n }\n\n // Strict equality check - no wildcard matching\n return origin === expected;\n};\n\nconst createMachineId = (): string =>\n `journey-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n\n/**\n * Simple rate limiter to prevent command abuse.\n * Tracks command timestamps and enforces a maximum rate.\n */\nclass CommandRateLimiter {\n private commandTimestamps: number[] = [];\n private readonly maxCommandsPerWindow: number;\n private readonly windowMs: number;\n\n constructor(maxCommandsPerWindow = 100, windowMs = 10000) {\n this.maxCommandsPerWindow = maxCommandsPerWindow;\n this.windowMs = windowMs;\n }\n\n /**\n * Checks if a command is allowed based on rate limits.\n * Returns true if allowed, false if rate limit exceeded.\n */\n isAllowed(): boolean {\n const now = Date.now();\n const windowStart = now - this.windowMs;\n\n // Remove old timestamps outside the window\n this.commandTimestamps = this.commandTimestamps.filter((ts) => ts > windowStart);\n\n if (this.commandTimestamps.length >= this.maxCommandsPerWindow) {\n return false;\n }\n\n this.commandTimestamps.push(now);\n return true;\n }\n\n reset(): void {\n this.commandTimestamps = [];\n }\n}\n\nconst cloneForTransport = (value: unknown): unknown => {\n if (typeof structuredClone === \"function\") {\n try {\n return structuredClone(value);\n } catch {\n // Fall through to the JSON serializer below.\n }\n }\n\n const seen = new WeakSet<object>();\n\n try {\n const serialized = JSON.stringify(value, (_key, currentValue) => {\n if (typeof currentValue === \"bigint\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"function\") {\n return `[Function ${currentValue.name || \"anonymous\"}]`;\n }\n if (typeof currentValue === \"symbol\") {\n return currentValue.toString();\n }\n if (typeof currentValue === \"object\" && currentValue !== null) {\n if (seen.has(currentValue)) {\n return \"[Circular]\";\n }\n seen.add(currentValue);\n }\n return currentValue;\n });\n\n if (serialized === undefined) {\n return undefined;\n }\n\n return JSON.parse(serialized) as unknown;\n } catch {\n return String(value);\n }\n};\n\nconst serializeError = (error: unknown): JourneyDevtoolsSerializedError => {\n if (error instanceof Error) {\n const cause =\n \"cause\" in error && (error as { cause?: unknown }).cause !== undefined\n ? (error as { cause?: unknown }).cause\n : null;\n return {\n name: error.name,\n message: error.message,\n stack: typeof error.stack === \"string\" ? error.stack : null,\n cause: cloneForTransport(cause)\n };\n }\n\n return {\n name: null,\n message: typeof error === \"string\" ? error : \"Unknown error\",\n stack: null,\n cause: cloneForTransport(error)\n };\n};\n\nconst serializeSnapshot = <TContext, TStepId extends string, TStepMeta>(\n snapshot: JourneySnapshot<TContext, TStepId, TStepMeta>\n): JourneyDevtoolsSerializableSnapshot => {\n const byStep: Record<string, JourneyDevtoolsSerializableSnapshot[\"async\"][\"byStep\"][string]> = {};\n\n for (const [stepId, stepState] of Object.entries(\n snapshot.async.byStep as Record<string, unknown>\n )) {\n if (!isRecord(stepState)) {\n continue;\n }\n\n byStep[stepId] = {\n phase: isJourneyAsyncPhase(stepState.phase) ? stepState.phase : \"idle\",\n eventType: typeof stepState.eventType === \"string\" ? stepState.eventType : null,\n transitionId: typeof stepState.transitionId === \"string\" ? stepState.transitionId : null,\n error: stepState.error === null ? null : cloneForTransport(stepState.error)\n };\n }\n\n return {\n currentStepId: String(snapshot.currentStepId),\n context: cloneForTransport(snapshot.context),\n history: {\n timeline: snapshot.history.timeline.map((stepId) => String(stepId)),\n index: snapshot.history.index\n },\n visited: Object.fromEntries(\n Object.entries(snapshot.visited as Record<string, boolean>).map(([stepId, isVisited]) => [\n String(stepId),\n isVisited === true\n ])\n ),\n stepMeta: cloneForTransport(snapshot.stepMeta) as Record<string, unknown>,\n status: snapshot.status,\n async: {\n isLoading: snapshot.async.isLoading,\n byStep\n }\n };\n};\n\nconst runCommand = async <TContext, TStepId extends string, TStepMeta>(\n machine: JourneyMachine<TContext, TStepId, string, Record<never, never>, TStepMeta>,\n command: JourneyDevtoolsCommand\n): Promise<SendOutcome<TContext, TStepId, TStepMeta>> => {\n switch (command.type) {\n case \"goToNextStep\":\n case \"completeJourney\": {\n const result = await machine.send({ type: command.type } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"terminateMachine\": {\n const result = await machine.send({ type: \"terminateJourney\" } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goToStepById\": {\n const result = await machine.send({\n type: \"goToStepById\",\n stepId: command.stepId\n } as JourneySendEvent<TStepId>);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goToPreviousStep\": {\n const result = await machine.goToPreviousStep(command.steps);\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"goToLastVisitedStep\": {\n const result = await machine.goToLastVisitedStep();\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"send\": {\n const sendEvent =\n command.event.payload === undefined\n ? { type: command.event.type }\n : { type: command.event.type, payload: command.event.payload };\n const result: JourneySendResult<TContext, TStepId, TStepMeta> = await machine.send(\n sendEvent as JourneySendEvent<TStepId>\n );\n return {\n snapshot: result.snapshot,\n transitioned: result.transitioned,\n ...(result.transitionId ? { transitionId: result.transitionId } : {})\n };\n }\n case \"updateStepMetadata\":\n return {\n snapshot: machine.updateStepMetadata(\n command.stepId as TStepId,\n () => command.metadata as TStepMeta\n )\n };\n case \"resetMachine\":\n return {\n snapshot: machine.resetMachine()\n };\n case \"clearStepError\":\n return {\n snapshot: machine.clearStepError(command.stepId as TStepId | undefined)\n };\n }\n};\n\nexport const attachJourneyDevtools = <\n TContext,\n TStepId extends string,\n TEventType extends string,\n TPayloadMap extends JourneyEventPayloadMap<TEventType>,\n TStepMeta\n>(\n machine: JourneyMachine<TContext, TStepId, TEventType, TPayloadMap, TStepMeta>,\n options: JourneyDevtoolsBridgeOptions = {}\n): (() => void) => {\n const enabled = options.enabled ?? resolveDefaultEnabled();\n if (!enabled || typeof window === \"undefined\") {\n return () => {};\n }\n const commandsEnabled = options.commandsEnabled ?? resolveDefaultCommandsEnabled();\n\n const machineId = options.machineId?.trim() || createMachineId();\n const meta: JourneyDevtoolsMachineMeta = {\n machineId,\n label: options.label?.trim() || DEFAULT_MACHINE_LABEL,\n appName:\n options.appName?.trim() || (typeof document !== \"undefined\" ? document.title : \"\") || null,\n commandsEnabled\n };\n const targetOrigin = resolveWindowTargetOrigin();\n\n const createBaseEnvelope = <TKind extends JourneyDevtoolsBridgeEnvelope[\"kind\"]>(\n kind: TKind\n ) => ({\n channel: JOURNEY_DEVTOOLS_CHANNEL,\n version: JOURNEY_DEVTOOLS_PROTOCOL_VERSION,\n source: JOURNEY_DEVTOOLS_BRIDGE_SOURCE,\n kind,\n machineId,\n timestamp: Date.now()\n });\n\n const post = (envelope: JourneyDevtoolsBridgeEnvelope) => {\n window.postMessage(envelope, targetOrigin);\n };\n\n const postSnapshot = (snapshot: JourneySnapshot<TContext, TStepId, TStepMeta>) => {\n const envelope: JourneyDevtoolsBridgeSnapshotEnvelope = {\n ...createBaseEnvelope(\"snapshot\"),\n snapshot: serializeSnapshot(snapshot)\n };\n post(envelope);\n };\n\n let isDetached = false;\n const rateLimiter = new CommandRateLimiter();\n\n const onMessage = (event: MessageEvent<unknown>) => {\n if (\n event.source !== window ||\n !isExpectedWindowOrigin(event.origin) ||\n isDetached ||\n !isJourneyDevtoolsEnvelope(event.data)\n ) {\n return;\n }\n\n if (event.data.source !== JOURNEY_DEVTOOLS_EXTENSION_SOURCE || event.data.kind !== \"command\") {\n return;\n }\n\n const commandEnvelope: JourneyDevtoolsExtensionCommandEnvelope = event.data;\n if (commandEnvelope.machineId !== machineId) {\n return;\n }\n\n // Rate limiting to prevent command abuse\n if (!rateLimiter.isAllowed()) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\n \"Command rate limit exceeded. Too many commands in a short time window.\"\n )\n };\n post(errorEnvelope);\n return;\n }\n\n if (!commandsEnabled) {\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(\"Bridge commands are disabled by configuration.\")\n };\n post(errorEnvelope);\n return;\n }\n\n const run = async () => {\n try {\n const outcome = await runCommand(\n machine as JourneyMachine<TContext, TStepId, string, Record<never, never>, TStepMeta>,\n commandEnvelope.command\n );\n if (isDetached) {\n return;\n }\n\n const resultEnvelope: JourneyDevtoolsBridgeCommandResultEnvelope = {\n ...createBaseEnvelope(\"commandResult\"),\n requestId: commandEnvelope.requestId,\n snapshot: serializeSnapshot(outcome.snapshot),\n ...(outcome.transitioned !== undefined ? { transitioned: outcome.transitioned } : {}),\n ...(outcome.transitionId ? { transitionId: outcome.transitionId } : {})\n };\n post(resultEnvelope);\n } catch (error) {\n if (isDetached) {\n return;\n }\n\n const errorEnvelope: JourneyDevtoolsBridgeCommandErrorEnvelope = {\n ...createBaseEnvelope(\"commandError\"),\n requestId: commandEnvelope.requestId,\n error: serializeError(error)\n };\n post(errorEnvelope);\n }\n };\n\n void run();\n };\n\n window.addEventListener(\"message\", onMessage);\n\n const unsubscribe = machine.subscribe(() => {\n if (isDetached) {\n return;\n }\n postSnapshot(machine.getSnapshot());\n });\n\n const registerEnvelope: JourneyDevtoolsBridgeRegisterEnvelope = {\n ...createBaseEnvelope(\"register\"),\n meta,\n snapshot: serializeSnapshot(machine.getSnapshot())\n };\n post(registerEnvelope);\n\n return () => {\n if (isDetached) {\n return;\n }\n\n isDetached = true;\n rateLimiter.reset();\n unsubscribe();\n window.removeEventListener(\"message\", onMessage);\n\n const unregisterEnvelope: JourneyDevtoolsBridgeUnregisterEnvelope = {\n ...createBaseEnvelope(\"unregister\")\n };\n post(unregisterEnvelope);\n };\n};\n"],
5
+ "mappings": "AAEO,IAAMA,EAAoC,EACpCC,EAA2B,6BAE3BC,EAAiC,uBACjCC,EAAoC,0BAmG3CC,EAAYC,GAChB,OAAOA,GAAU,UAAYA,IAAU,KAEnCC,EAAiBD,GACrBA,IAAUH,GAAkCG,IAAUF,EAkBxD,IAAMI,EAAgB,CAACC,EAAgBC,EAAQ,IAAe,CAC5D,GAAIA,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ION", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isRecord", "value", "isKnownSource", "isSafePayload", "value", "depth", "item", "prop", "hasBaseEnvelopeShape", "isRecord", "JOURNEY_DEVTOOLS_CHANNEL", "isKnownSource", "isSendEvent", "isJourneyDevtoolsCommand", "isJourneyDevtoolsBridgeEnvelope", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "envelope", "isJourneyDevtoolsExtensionEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "isJourneyDevtoolsEnvelope", "DEFAULT_MACHINE_LABEL", "isRecord", "value", "isJourneyAsyncPhase", "resolveDefaultEnabled", "nodeEnv", "resolveDefaultCommandsEnabled", "resolveWindowTargetOrigin", "isExpectedWindowOrigin", "origin", "expected", "createMachineId", "CommandRateLimiter", "maxCommandsPerWindow", "windowMs", "now", "windowStart", "ts", "cloneForTransport", "seen", "serialized", "_key", "currentValue", "serializeError", "error", "cause", "serializeSnapshot", "snapshot", "byStep", "stepId", "stepState", "isVisited", "runCommand", "machine", "command", "result", "sendEvent", "attachJourneyDevtools", "options", "commandsEnabled", "machineId", "meta", "targetOrigin", "createBaseEnvelope", "kind", "JOURNEY_DEVTOOLS_CHANNEL", "JOURNEY_DEVTOOLS_BRIDGE_SOURCE", "post", "envelope", "postSnapshot", "isDetached", "rateLimiter", "onMessage", "event", "isJourneyDevtoolsEnvelope", "JOURNEY_DEVTOOLS_EXTENSION_SOURCE", "commandEnvelope", "errorEnvelope", "outcome", "resultEnvelope", "unsubscribe", "registerEnvelope", "unregisterEnvelope"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  import type { JourneySnapshot, JourneyStepAsyncState } from "@rxova/journey-core";
2
- export declare const JOURNEY_DEVTOOLS_PROTOCOL_VERSION: 1;
2
+ export declare const JOURNEY_DEVTOOLS_PROTOCOL_VERSION: 3;
3
3
  export declare const JOURNEY_DEVTOOLS_CHANNEL: "__RXOVA_JOURNEY_DEVTOOLS__";
4
4
  export declare const JOURNEY_DEVTOOLS_BRIDGE_SOURCE: "rxova-journey-bridge";
5
5
  export declare const JOURNEY_DEVTOOLS_EXTENSION_SOURCE: "rxova-journey-extension";
@@ -19,16 +19,19 @@ export type JourneyDevtoolsSerializedError = {
19
19
  cause: unknown;
20
20
  };
21
21
  export type JourneyDevtoolsCommand = {
22
- type: "next";
22
+ type: "goToNextStep";
23
23
  } | {
24
- type: "back";
24
+ type: "terminateMachine";
25
25
  } | {
26
- type: "close";
26
+ type: "completeJourney";
27
27
  } | {
28
- type: "submit";
28
+ type: "goToStepById";
29
+ stepId: string;
29
30
  } | {
30
- type: "goTo";
31
- to: string;
31
+ type: "goToPreviousStep";
32
+ steps?: number;
33
+ } | {
34
+ type: "goToLastVisitedStep";
32
35
  } | {
33
36
  type: "send";
34
37
  event: {
@@ -36,15 +39,14 @@ export type JourneyDevtoolsCommand = {
36
39
  payload?: unknown;
37
40
  };
38
41
  } | {
39
- type: "reset";
42
+ type: "updateStepMetadata";
43
+ stepId: string;
44
+ metadata: unknown;
45
+ } | {
46
+ type: "resetMachine";
40
47
  } | {
41
48
  type: "clearStepError";
42
49
  stepId?: string;
43
- } | {
44
- type: "clearHistory";
45
- } | {
46
- type: "trimHistory";
47
- maxHistory?: number | null;
48
50
  };
49
51
  export type JourneyDevtoolsEnvelopeBase = {
50
52
  channel: typeof JOURNEY_DEVTOOLS_CHANNEL;
@@ -96,4 +98,3 @@ export declare const isJourneyDevtoolsCommand: (value: unknown) => value is Jour
96
98
  export declare const isJourneyDevtoolsBridgeEnvelope: (value: unknown) => value is JourneyDevtoolsBridgeEnvelope;
97
99
  export declare const isJourneyDevtoolsExtensionEnvelope: (value: unknown) => value is JourneyDevtoolsExtensionEnvelope;
98
100
  export declare const isJourneyDevtoolsEnvelope: (value: unknown) => value is JourneyDevtoolsEnvelope;
99
- //# sourceMappingURL=protocol.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxova/journey-devtools-bridge",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Bridge API to connect Journey machines to browser devtools.",
5
5
  "keywords": [
6
6
  "journey",
@@ -45,23 +45,24 @@
45
45
  ],
46
46
  "sideEffects": false,
47
47
  "dependencies": {
48
- "@rxova/journey-core": "workspace:^"
48
+ "@rxova/journey-core": "^0.5.0"
49
49
  },
50
+ "size-limit": [
51
+ {
52
+ "name": "devtools-bridge/attachJourneyDevtools",
53
+ "path": "dist/index.js",
54
+ "import": "{ attachJourneyDevtools }",
55
+ "limit": "3 kB"
56
+ }
57
+ ],
50
58
  "scripts": {
51
59
  "build": "pnpm run clean && node ./scripts/build.mjs && tsc -p tsconfig.build.json && node ../../scripts/copy-types.mjs dist",
52
- "clean": "rm -rf dist",
60
+ "clean": "rm -rf dist tsconfig.build.tsbuildinfo",
61
+ "coverage": "pnpm --workspace-root vitest run --coverage --coverage.include=packages/devtools-bridge/src/** --coverage.reporter=text-summary",
53
62
  "typecheck": "tsc --noEmit -p tsconfig.json",
54
63
  "publint": "publint",
55
64
  "attw": "attw --pack .",
56
65
  "size": "pnpm run size:check",
57
66
  "size:check": "pnpm run build && size-limit"
58
- },
59
- "size-limit": [
60
- {
61
- "name": "devtools-bridge/attachJourneyDevtools",
62
- "path": "dist/index.js",
63
- "import": "{ attachJourneyDevtools }",
64
- "limit": "5.5 kB"
65
- }
66
- ]
67
- }
67
+ }
68
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,cAAc,EAGf,MAAM,qBAAqB,CAAC;AAsB7B,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAoRF,eAAO,MAAM,qBAAqB,GAChC,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,UAAU,SAAS,MAAM,EACzB,WAAW,SAAS,sBAAsB,CAAC,UAAU,CAAC,EAEtD,SAAS,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,EACnE,UAAS,4BAAiC,KACzC,CAAC,MAAM,IAAI,CAuJb,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAEpF,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,8BAA8B,EAC9B,iCAAiC,EACjC,wBAAwB,EACxB,yBAAyB,EACzB,+BAA+B,EAC/B,kCAAkC,EAClC,KAAK,yCAAyC,EAC9C,KAAK,0CAA0C,EAC/C,KAAK,6BAA6B,EAClC,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC1C,KAAK,uCAAuC,EAC5C,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,EAC5C,KAAK,0BAA0B,EAC/B,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EACpC,MAAM,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAEpF,OAAO,EACL,wBAAwB,EACxB,iCAAiC,EACjC,8BAA8B,EAC9B,iCAAiC,EACjC,wBAAwB,EACxB,yBAAyB,EACzB,+BAA+B,EAC/B,kCAAkC,EAClC,KAAK,yCAAyC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AgBX,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,uBACiB,CAAC"}
@@ -1 +0,0 @@
1
- {"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.full.d.ts","../../core/dist/types.d.ts","../../core/dist/machine.d.ts","../../core/dist/persistence.d.ts","../../core/dist/index.d.ts","../src/protocol.ts","../src/bridge.ts","../src/index.ts","../../../node_modules/@types/aria-query/index.d.ts","../../../node_modules/@types/deep-eql/index.d.ts","../../../node_modules/assertion-error/index.d.ts","../../../node_modules/@types/chai/index.d.ts","../../../node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/@types/node/web-globals/blob.d.ts","../../../node_modules/@types/node/web-globals/console.d.ts","../../../node_modules/@types/node/web-globals/crypto.d.ts","../../../node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/@types/node/web-globals/encoding.d.ts","../../../node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/undici-types/utility.d.ts","../../../node_modules/undici-types/header.d.ts","../../../node_modules/undici-types/readable.d.ts","../../../node_modules/undici-types/fetch.d.ts","../../../node_modules/undici-types/formdata.d.ts","../../../node_modules/undici-types/connector.d.ts","../../../node_modules/undici-types/client-stats.d.ts","../../../node_modules/undici-types/client.d.ts","../../../node_modules/undici-types/errors.d.ts","../../../node_modules/undici-types/dispatcher.d.ts","../../../node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/undici-types/global-origin.d.ts","../../../node_modules/undici-types/pool-stats.d.ts","../../../node_modules/undici-types/pool.d.ts","../../../node_modules/undici-types/handlers.d.ts","../../../node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/undici-types/h2c-client.d.ts","../../../node_modules/undici-types/agent.d.ts","../../../node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/undici-types/mock-call-history.d.ts","../../../node_modules/undici-types/mock-agent.d.ts","../../../node_modules/undici-types/mock-client.d.ts","../../../node_modules/undici-types/mock-pool.d.ts","../../../node_modules/undici-types/snapshot-agent.d.ts","../../../node_modules/undici-types/mock-errors.d.ts","../../../node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/undici-types/retry-handler.d.ts","../../../node_modules/undici-types/retry-agent.d.ts","../../../node_modules/undici-types/api.d.ts","../../../node_modules/undici-types/cache-interceptor.d.ts","../../../node_modules/undici-types/interceptors.d.ts","../../../node_modules/undici-types/util.d.ts","../../../node_modules/undici-types/cookies.d.ts","../../../node_modules/undici-types/patch.d.ts","../../../node_modules/undici-types/websocket.d.ts","../../../node_modules/undici-types/eventsource.d.ts","../../../node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/undici-types/content-type.d.ts","../../../node_modules/undici-types/cache.d.ts","../../../node_modules/undici-types/index.d.ts","../../../node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/@types/node/web-globals/importmeta.d.ts","../../../node_modules/@types/node/web-globals/messaging.d.ts","../../../node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/@types/node/web-globals/performance.d.ts","../../../node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/@types/node/web-globals/streams.d.ts","../../../node_modules/@types/node/web-globals/timers.d.ts","../../../node_modules/@types/node/web-globals/url.d.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/@types/node/inspector/promises.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/path/posix.d.ts","../../../node_modules/@types/node/path/win32.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/quic.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/sea.d.ts","../../../node_modules/@types/node/sqlite.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/test/reporters.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/util/types.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/@types/conventional-commits-parser/index.d.ts","../../../node_modules/@types/estree/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts"],"fileIdsList":[[67,129,137,141,144,146,147,148,160],[62,63,67,129,137,141,144,146,147,148,160],[67,129,137,141,144,146,147,148,160,165,185],[67,126,127,129,137,141,144,146,147,148,160],[67,128,129,137,141,144,146,147,148,160],[129,137,141,144,146,147,148,160],[67,129,137,141,144,146,147,148,160,168],[67,129,130,135,137,140,141,144,146,147,148,150,160,165,177],[67,129,130,131,137,140,141,144,146,147,148,160],[67,129,132,137,141,144,146,147,148,160,178],[67,129,133,134,137,141,144,146,147,148,151,160],[67,129,134,137,141,144,146,147,148,160,165,174],[67,129,135,137,140,141,144,146,147,148,150,160],[67,128,129,136,137,141,144,146,147,148,160],[67,129,137,138,141,144,146,147,148,160],[67,129,137,139,140,141,144,146,147,148,160],[67,128,129,137,140,141,144,146,147,148,160],[67,129,137,140,141,142,144,146,147,148,160,165,177],[67,129,137,140,141,142,144,146,147,148,160,165,168],[67,116,129,137,140,141,143,144,146,147,148,150,160,165,177],[67,129,137,140,141,143,144,146,147,148,150,160,165,174,177],[67,129,137,141,143,144,145,146,147,148,160,165,174,177],[65,66,67,68,69,70,71,72,73,74,75,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184],[67,129,137,140,141,144,146,147,148,160],[67,129,137,141,144,146,148,160],[67,129,137,141,144,146,147,148,149,160,177],[67,129,137,140,141,144,146,147,148,150,160,165],[67,129,137,141,144,146,147,148,151,160],[67,129,137,141,144,146,147,148,152,160],[67,129,137,140,141,144,146,147,148,155,160],[67,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184],[67,129,137,141,144,146,147,148,157,160],[67,129,137,141,144,146,147,148,158,160],[67,129,134,137,141,144,146,147,148,150,160,168],[67,129,137,140,141,144,146,147,148,160,161],[67,129,137,141,144,146,147,148,160,162,178,181],[67,129,137,140,141,144,146,147,148,160,165,167,168],[67,129,137,141,144,146,147,148,160,166,168],[67,129,137,141,144,146,147,148,160,168,178],[67,129,137,141,144,146,147,148,160,169],[67,126,129,137,141,144,146,147,148,160,165,171],[67,129,137,141,144,146,147,148,160,165,170],[67,129,137,140,141,144,146,147,148,160,172,173],[67,129,137,141,144,146,147,148,160,172,173],[67,129,134,137,141,144,146,147,148,150,160,165,174],[67,129,137,141,144,146,147,148,160,175],[67,129,137,141,144,146,147,148,150,160,176],[67,129,137,141,143,144,146,147,148,158,160,177],[67,129,137,141,144,146,147,148,160,178,179],[67,129,134,137,141,144,146,147,148,160,179],[67,129,137,141,144,146,147,148,160,165,180],[67,129,137,141,144,146,147,148,149,160,181],[67,129,137,141,144,146,147,148,160,182],[67,129,132,137,141,144,146,147,148,160],[67,129,134,137,141,144,146,147,148,160],[67,129,137,141,144,146,147,148,160,178],[67,116,129,137,141,144,146,147,148,160],[67,129,137,141,144,146,147,148,160,177],[67,129,137,141,144,146,147,148,160,183],[67,129,137,141,144,146,147,148,155,160],[67,129,137,141,144,146,147,148,160,173],[67,116,129,137,140,141,142,144,146,147,148,155,160,165,168,177,180,181,183],[67,129,137,141,144,146,147,148,160,165,184],[67,82,85,88,89,129,137,141,144,146,147,148,160,177],[67,85,129,137,141,144,146,147,148,160,165,177],[67,85,89,129,137,141,144,146,147,148,160,177],[67,129,137,141,144,146,147,148,160,165],[67,79,129,137,141,144,146,147,148,160],[67,83,129,137,141,144,146,147,148,160],[67,81,82,85,129,137,141,144,146,147,148,160,177],[67,129,137,141,144,146,147,148,150,160,174],[67,129,137,141,144,146,147,148,160,185],[67,79,129,137,141,144,146,147,148,160,185],[67,81,85,129,137,141,144,146,147,148,150,160,177],[67,76,77,78,80,84,129,137,140,141,144,146,147,148,160,165,177],[67,85,93,101,129,137,141,144,146,147,148,160],[67,77,83,129,137,141,144,146,147,148,160],[67,85,110,111,129,137,141,144,146,147,148,160],[67,77,80,85,129,137,141,144,146,147,148,160,168,177,185],[67,85,129,137,141,144,146,147,148,160],[67,81,85,129,137,141,144,146,147,148,160,177],[67,76,129,137,141,144,146,147,148,160],[67,79,80,81,83,84,85,86,87,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,111,112,113,114,115,129,137,141,144,146,147,148,160],[67,85,103,106,129,137,141,144,146,147,148,160],[67,85,93,94,95,129,137,141,144,146,147,148,160],[67,83,85,94,96,129,137,141,144,146,147,148,160],[67,84,129,137,141,144,146,147,148,160],[67,77,79,85,129,137,141,144,146,147,148,160],[67,85,89,94,96,129,137,141,144,146,147,148,160],[67,89,129,137,141,144,146,147,148,160],[67,83,85,88,129,137,141,144,146,147,148,160,177],[67,77,81,85,93,129,137,141,144,146,147,148,160],[67,85,103,129,137,141,144,146,147,148,160],[67,96,129,137,141,144,146,147,148,160],[67,79,85,110,129,137,141,144,146,147,148,160,168,183,185],[54,55,56,67,129,137,141,144,146,147,148,160],[54,67,129,137,141,144,146,147,148,160],[57,58,67,129,137,141,144,146,147,148,160],[58,59,67,129,137,141,144,146,147,148,160],[57,67,129,137,141,144,146,147,148,160]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1305d1e76ca44e30fb8b2b8075fa522b83f60c0bcf5d4326a9d2cf79b53724f8","impliedFormat":1},"b9dc4534a8b8abf7a231fdee9aeba909fe6a5d9d8ffc64336eb662c28164af1c","3d3e7b4efbe8891f0b0f37b832ce6adf587b32c4de869b557c2e2613d5363a65","64a4320c603b4e6640d2813fd4817ab65f14fe57327373634a10ddc0016b6435","bdd8041fa7979a7f7a52eea92f4ecafc4155db4f964e0339b57ea05ca57afb8d",{"version":"568738a9d1b96222f590d48d5bc2d14e3ab373fb8734bce4ba17710d5722571a","signature":"4ee0b9b6f5a48133815942f26006670762a6474dd19adf0e832d3e169ae3170e"},{"version":"ea895d13bb32ec03bd5b77fc0900c404a832c2815e7ecaacf3b4bc38001a4d26","signature":"203d912c803ff7c6d416349a607b31af12b251f408aa1fe16bfa16999627a85b"},{"version":"c115030defbf2713e8f30d559a8e2b00a4b4971b1ac990f7e7c6219a3793f85a","signature":"d245711e9cc3d763a5e1d4fe5ba153635a9cd37bf3e36ee9db0f8d937daf9410"},{"version":"ae77d81a5541a8abb938a0efedf9ac4bea36fb3a24cc28cfa11c598863aba571","impliedFormat":1},{"version":"427fe2004642504828c1476d0af4270e6ad4db6de78c0b5da3e4c5ca95052a99","impliedFormat":1},{"version":"2eeffcee5c1661ddca53353929558037b8cf305ffb86a803512982f99bcab50d","impliedFormat":99},{"version":"9afb4cb864d297e4092a79ee2871b5d3143ea14153f62ef0bb04ede25f432030","affectsGlobalScope":true,"impliedFormat":99},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"0ccdaa19852d25ecd84eec365c3bfa16e7859cadecf6e9ca6d0dbbbee439743f","affectsGlobalScope":true,"impliedFormat":1},{"version":"438b41419b1df9f1fbe33b5e1b18f5853432be205991d1b19f5b7f351675541e","affectsGlobalScope":true,"impliedFormat":1},{"version":"096116f8fedc1765d5bd6ef360c257b4a9048e5415054b3bf3c41b07f8951b0b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5e01375c9e124a83b52ee4b3244ed1a4d214a6cfb54ac73e164a823a4a7860a","affectsGlobalScope":true,"impliedFormat":1},{"version":"f90ae2bbce1505e67f2f6502392e318f5714bae82d2d969185c4a6cecc8af2fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b58e207b93a8f1c88bbf2a95ddc686ac83962b13830fe8ad3f404ffc7051fb4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1fefabcb2b06736a66d2904074d56268753654805e829989a46a0161cd8412c5","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"c18a99f01eb788d849ad032b31cafd49de0b19e083fe775370834c5675d7df8e","affectsGlobalScope":true,"impliedFormat":1},{"version":"5247874c2a23b9a62d178ae84f2db6a1d54e6c9a2e7e057e178cc5eea13757fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"23cd712e2ce083d68afe69224587438e5914b457b8acf87073c22494d706a3d0","impliedFormat":1},{"version":"487b694c3de27ddf4ad107d4007ad304d29effccf9800c8ae23c2093638d906a","impliedFormat":1},{"version":"3a80bc85f38526ca3b08007ee80712e7bb0601df178b23fbf0bf87036fce40ce","impliedFormat":1},{"version":"ccf4552357ce3c159ef75f0f0114e80401702228f1898bdc9402214c9499e8c0","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"2931540c47ee0ff8a62860e61782eb17b155615db61e36986e54645ec67f67c2","impliedFormat":1},{"version":"ccab02f3920fc75c01174c47fcf67882a11daf16baf9e81701d0a94636e94556","impliedFormat":1},{"version":"f6faf5f74e4c4cc309a6c6a6c4da02dbb840be5d3e92905a23dcd7b2b0bd1986","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"33e981bf6376e939f99bd7f89abec757c64897d33c005036b9a10d9587d80187","impliedFormat":1},{"version":"7fd1b31fd35876b0aa650811c25ec2c97a3c6387e5473eb18004bed86cdd76b6","impliedFormat":1},{"version":"b41767d372275c154c7ea6c9d5449d9a741b8ce080f640155cc88ba1763e35b3","impliedFormat":1},{"version":"3bacf516d686d08682751a3bd2519ea3b8041a164bfb4f1d35728993e70a2426","impliedFormat":1},{"version":"7fb266686238369442bd1719bc0d7edd0199da4fb8540354e1ff7f16669b4323","impliedFormat":1},{"version":"0a60a292b89ca7218b8616f78e5bbd1c96b87e048849469cccb4355e98af959a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"5b03a034c72146b61573aab280f295b015b9168470f2df05f6080a2122f9b4df","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"249b9cab7f5d628b71308c7d9bb0a808b50b091e640ba3ed6e2d0516f4a8d91d","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"54c3e2371e3d016469ad959697fd257e5621e16296fa67082c2575d0bf8eced0","impliedFormat":1},{"version":"beb8233b2c220cfa0feea31fbe9218d89fa02faa81ef744be8dce5acb89bb1fd","impliedFormat":1},{"version":"c183b931b68ad184bc8e8372bf663f3d33304772fb482f29fb91b3c391031f3e","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"59af37caec41ecf7b2e76059c9672a49e682c1a2aa6f9d7dc78878f53aa284d6","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"48cc3ec153b50985fb95153258a710782b25975b10dd4ac8a4f3920632d10790","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"e1528ca65ac90f6fa0e4a247eb656b4263c470bb22d9033e466463e13395e599","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"866078923a56d026e39243b4392e282c1c63159723996fa89243140e1388a98d","impliedFormat":1},{"version":"c3f5289820990ab66b70c7fb5b63cb674001009ff84b13de40619619a9c8175f","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3275d55fac10b799c9546804126239baf020d220136163f763b55a74e50e750","affectsGlobalScope":true,"impliedFormat":1},{"version":"fa68a0a3b7cb32c00e39ee3cd31f8f15b80cac97dce51b6ee7fc14a1e8deb30b","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c36e755bced82df7fb6ce8169265d0a7bb046ab4e2cb6d0da0cb72b22033e89","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"7a93de4ff8a63bafe62ba86b89af1df0ccb5e40bb85b0c67d6bbcfdcf96bf3d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"90e85f9bc549dfe2b5749b45fe734144e96cd5d04b38eae244028794e142a77e","affectsGlobalScope":true,"impliedFormat":1},{"version":"e0a5deeb610b2a50a6350bd23df6490036a1773a8a71d70f2f9549ab009e67ee","affectsGlobalScope":true,"impliedFormat":1},{"version":"435b3711465425770ed2ee2f1cf00ce071835265e0851a7dc4600ab4b007550e","impliedFormat":1},{"version":"7e49f52a159435fc8df4de9dc377ef5860732ca2dc9efec1640531d3cf5da7a3","impliedFormat":1},{"version":"dd4bde4bdc2e5394aed6855e98cf135dfdf5dd6468cad842e03116d31bbcc9bc","impliedFormat":1},{"version":"4d4e879009a84a47c05350b8dca823036ba3a29a3038efed1be76c9f81e45edf","affectsGlobalScope":true,"impliedFormat":1},{"version":"237ba5ac2a95702a114a309e39c53a5bddff5f6333b325db9764df9b34f3502b","impliedFormat":1},{"version":"9ba13b47cb450a438e3076c4a3f6afb9dc85e17eae50f26d4b2d72c0688c9251","impliedFormat":1},{"version":"b64cd4401633ea4ecadfd700ddc8323a13b63b106ac7127c1d2726f32424622c","impliedFormat":1},{"version":"37c6e5fe5715814412b43cc9b50b24c67a63c4e04e753e0d1305970d65417a60","impliedFormat":1},{"version":"1d024184fb57c58c5c91823f9d10b4915a4867b7934e89115fd0d861a9df27c8","impliedFormat":1},{"version":"ee0e4946247f842c6dd483cbb60a5e6b484fee07996e3a7bc7343dfb68a04c5d","impliedFormat":1},{"version":"ef051f42b7e0ef5ca04552f54c4552eac84099d64b6c5ad0ef4033574b6035b8","impliedFormat":1},{"version":"853a43154f1d01b0173d9cbd74063507ece57170bad7a3b68f3fa1229ad0a92f","impliedFormat":1},{"version":"56231e3c39a031bfb0afb797690b20ed4537670c93c0318b72d5180833d98b72","impliedFormat":1},{"version":"5cc7c39031bfd8b00ad58f32143d59eb6ffc24f5d41a20931269011dccd36c5e","impliedFormat":1},{"version":"b0b69c61b0f0ec8ca15db4c8c41f6e77f4cacb784d42bca948f42dea33e8757e","affectsGlobalScope":true,"impliedFormat":1},{"version":"f96a48183254c00d24575401f1a761b4ce4927d927407e7862a83e06ce5d6964","impliedFormat":1},{"version":"cc25940cfb27aa538e60d465f98bb5068d4d7d33131861ace43f04fe6947d68f","impliedFormat":1},{"version":"f83fb2b1338afbb3f9d733c7d6e8b135826c41b0518867df0c0ace18ae1aa270","impliedFormat":1},{"version":"01ff95aa1443e3f7248974e5a771f513cb2ac158c8898f470a1792f817bee497","impliedFormat":1},{"version":"757227c8b345c57d76f7f0e3bbad7a91ffca23f1b2547cbed9e10025816c9cb7","impliedFormat":1},{"version":"42a05d8f239f74587d4926aba8cc54792eed8e8a442c7adc9b38b516642aadfe","impliedFormat":1},{"version":"5d21b58d60383cc6ab9ad3d3e265d7d25af24a2c9b506247e0e50b0a884920be","impliedFormat":1},{"version":"101f482fd48cb4c7c0468dcc6d62c843d842977aea6235644b1edd05e81fbf22","impliedFormat":1},{"version":"ae6757460f37078884b1571a3de3ebaf724d827d7e1d53626c02b3c2a408ac63","affectsGlobalScope":true,"impliedFormat":1},{"version":"9451a46a89ed209e2e08329e6cac59f89356eae79a7230f916d8cc38725407c7","impliedFormat":1},{"version":"3ef397f12387eff17f550bc484ea7c27d21d43816bbe609d495107f44b97e933","impliedFormat":1},{"version":"1023282e2ba810bc07905d3668349fbd37a26411f0c8f94a70ef3c05fe523fcf","impliedFormat":1},{"version":"b214ebcf76c51b115453f69729ee8aa7b7f8eccdae2a922b568a45c2d7ff52f7","impliedFormat":1},{"version":"429c9cdfa7d126255779efd7e6d9057ced2d69c81859bbab32073bad52e9ba76","impliedFormat":1},{"version":"e236b5eba291f51bdf32c231673e6cab81b5410850e61f51a7a524dddadc0f95","impliedFormat":1},{"version":"f7ba0e839daa0702e3ff1a1a871c0d8ea2d586ce684dd8a72c786c36a680b1d9","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f2c62938251b45715fd2a9887060ec4fbc8724727029d1cbce373747252bdd7","impliedFormat":1},{"version":"e3ace08b6bbd84655d41e244677b474fd995923ffef7149ddb68af8848b60b05","impliedFormat":1},{"version":"132580b0e86c48fab152bab850fc57a4b74fe915c8958d2ccb052b809a44b61c","impliedFormat":1},{"version":"af4ab0aa8908fc9a655bb833d3bc28e117c4f0e1038c5a891546158beb25accb","impliedFormat":1},{"version":"69c9a5a9392e8564bd81116e1ed93b13205201fb44cb35a7fde8c9f9e21c4b23","impliedFormat":1},{"version":"5f8fc37f8434691ffac1bfd8fc2634647da2c0e84253ab5d2dd19a7718915b35","impliedFormat":1},{"version":"5981c2340fd8b076cae8efbae818d42c11ffc615994cb060b1cd390795f1be2b","impliedFormat":1},{"version":"f64deb26664af64dc274637343bde8d82f930c77af05a412c7d310b77207a448","impliedFormat":1},{"version":"ed4f674fc8c0c993cc7e145069ac44129e03519b910c62be206a0cc777bdc60b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0250da3eb85c99624f974e77ef355cdf86f43980251bc371475c2b397ba55bcd","impliedFormat":1},{"version":"f1c93e046fb3d9b7f8249629f4b63dc068dd839b824dd0aa39a5e68476dc9420","impliedFormat":1},{"version":"3d3a5f27ffbc06c885dd4d5f9ee20de61faf877fe2c3a7051c4825903d9a7fdc","impliedFormat":1},{"version":"12806f9f085598ef930edaf2467a5fa1789a878fba077cd27e85dc5851e11834","impliedFormat":1},{"version":"17d06eb5709839c7ce719f0c38ada6f308fb433f2cd6d8c87b35856e07400950","impliedFormat":1},{"version":"a43fe41c33d0a192a0ecaf9b92e87bef3709c9972e6d53c42c49251ccb962d69","impliedFormat":1},{"version":"a177959203c017fad3ecc4f3d96c8757a840957a4959a3ae00dab9d35961ca6c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6fc727ccf9b36e257ff982ea0badeffbfc2c151802f741bddff00c6af3b784cf","impliedFormat":1},{"version":"2a00d005e3af99cd1cfa75220e60c61b04bfb6be7ca7453bfe2ef6cca37cc03c","impliedFormat":1},{"version":"4844a4c9b4b1e812b257676ed8a80b3f3be0e29bf05e742cc2ea9c3c6865e6c6","impliedFormat":1},{"version":"064878a60367e0407c42fb7ba02a2ea4d83257357dc20088e549bd4d89433e9c","impliedFormat":1},{"version":"14d4bd22d1b05824971b98f7e91b2484c90f1a684805c330476641417c3d9735","impliedFormat":1},{"version":"c3877fef8a43cd434f9728f25a97575b0eb73d92f38b5c87c840daccc3e21d97","impliedFormat":1},{"version":"b484ec11ba00e3a2235562a41898d55372ccabe607986c6fa4f4aba72093749f","impliedFormat":1},{"version":"1dbd83860e7634f9c236647f45dbc5d3c4f9eba8827d87209d6e9826fdf4dbd5","impliedFormat":1},{"version":"41ef7992c555671a8fe54db302788adefa191ded810a50329b79d20a6772d14c","impliedFormat":1},{"version":"041a7781b9127ab568d2cdcce62c58fdea7c7407f40b8c50045d7866a2727130","impliedFormat":1},{"version":"b37f83e7deea729aa9ce5593f78905afb45b7532fdff63041d374f60059e7852","impliedFormat":1},{"version":"e1cb68f3ef3a8dd7b2a9dfb3de482ed6c0f1586ba0db4e7d73c1d2147b6ffc51","impliedFormat":1},{"version":"55cdbeebe76a1fa18bbd7e7bf73350a2173926bd3085bb050cf5a5397025ee4e","impliedFormat":1},{"version":"08d0edb791962d21d5103692070d25605106d2527d013718d5962ae4d4c02481","impliedFormat":1},{"version":"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","impliedFormat":1},{"version":"f3d8c757e148ad968f0d98697987db363070abada5f503da3c06aefd9d4248c1","impliedFormat":1}],"root":[[58,60]],"options":{"composite":true,"declaration":true,"declarationDir":"./","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"exactOptionalPropertyTypes":true,"jsx":4,"module":99,"noFallthroughCasesInSwitch":true,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":7,"tsBuildInfoFile":"./tsconfig.build.tsbuildinfo"},"referencedMap":[[51,1],[52,1],[10,1],[8,1],[9,1],[14,1],[13,1],[2,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[22,1],[3,1],[23,1],[24,1],[4,1],[25,1],[29,1],[26,1],[27,1],[28,1],[30,1],[31,1],[32,1],[5,1],[33,1],[34,1],[35,1],[36,1],[6,1],[40,1],[37,1],[38,1],[39,1],[41,1],[7,1],[42,1],[53,1],[47,1],[48,1],[43,1],[44,1],[45,1],[46,1],[1,1],[49,1],[50,1],[12,1],[11,1],[61,1],[64,2],[186,3],[62,1],[187,1],[188,1],[126,4],[127,4],[128,5],[67,6],[129,7],[130,8],[131,9],[65,1],[132,10],[133,11],[134,12],[135,13],[136,14],[137,15],[138,15],[139,16],[140,17],[141,18],[142,19],[68,1],[66,1],[143,20],[144,21],[145,22],[185,23],[146,24],[147,25],[148,24],[149,26],[150,27],[151,28],[152,29],[153,29],[154,29],[155,30],[156,31],[157,32],[158,33],[159,34],[160,35],[161,35],[162,36],[163,1],[164,1],[165,37],[166,38],[167,37],[168,39],[169,40],[170,41],[171,42],[172,43],[173,44],[174,45],[175,46],[176,47],[177,48],[178,49],[179,50],[180,51],[181,52],[182,53],[69,24],[70,1],[71,54],[72,55],[73,1],[74,56],[75,1],[117,57],[118,58],[119,59],[120,59],[121,60],[122,1],[123,7],[124,61],[125,58],[183,62],[184,63],[63,1],[93,64],[105,65],[91,66],[106,67],[115,68],[82,69],[83,70],[81,71],[114,72],[109,73],[113,74],[85,75],[102,76],[84,77],[112,78],[79,79],[80,73],[86,80],[87,1],[92,81],[90,80],[77,82],[116,83],[107,84],[96,85],[95,80],[97,86],[100,87],[94,88],[98,89],[110,72],[88,90],[89,91],[101,92],[78,67],[104,93],[103,80],[99,94],[108,1],[76,1],[111,95],[57,96],[55,97],[56,97],[54,1],[59,98],[60,99],[58,100]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}