@player-devtools/basic-plugin 1.0.1-next.0 → 1.1.0-next.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/8a7a049d85b1ea1286a017c8d271a188/sandbox/processwrapper-sandbox/3134/execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/dist/index.global.js","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/utils/core/src/index.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/errors.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/common.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/plugins.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/scope.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/finalize.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/proxy.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/immerClass.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/current.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dequal@2.0.3/node_modules/dequal/dist/index.mjs","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/helpers/uuid.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/index.ts","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/content/src/constants.ts","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/content/_generated/flow.json","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/content/src/index.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/env.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/immer.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/reducer.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/constants.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/helpers/getNowTime.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/helpers/genDataChangeTransaction.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/plugin.ts"],"names":["BasicDevtoolsPlugin","dsetAssign","obj","keys","value","merge","key","length","Error","acc","target","slice","reduce","deepAssign","die","error","args","e","errors","msg","apply","isDraft","DRAFT_STATE","isDraftable","isPlainObject","Array","isArray","DRAFTABLE","constructor","isMap","isSet","proto","getPrototypeOf","Ctor","Object","hasOwnProperty","call","Function","toString","objectCtorString","each","iter","getArchtype","Reflect","ownKeys","forEach","entry","index","thing","state","type_","has","prop","prototype","set","propOrOldValue","t","add","is","x","y","Map","Set","latest","copy_","base_","shallowCopy","base","strict","isPlain","descriptors","getOwnPropertyDescriptors","i","desc","writable","configurable","get","enumerable","create","assign","dontMutateFrozenCollections","isFrozen","getPlugin","pluginKey","plugin","plugins","getCurrentScope","currentScope","createScope","parent_","immer_","drafts_","canAutoFreeze_","unfinalizedDrafts_","usePatchesInScope","scope","patchListener","patches_","inversePatches_","patchListener_","revokeScope","leaveScope","revokeDraft","enterScope","immer","draft","revoke_","revoked_","processResult","result","baseDraft","isReplaced","modified_","finalize","maybeFreeze","generateReplacementPatches_","NOTHING","rootScope","path","childValue","finalizeProperty","scope_","finalized_","resultEach","clear","generatePatches_","parentState","targetObject","rootPath","targetIsSet","assigned_","concat","res","autoFreeze_","propertyIsEnumerable","deep","freeze","createProxyProxy","parent","draft_","isManual_","traps","objectTraps","arrayTraps","Proxy","revocable","revoke","proxy","peek","source","readPropFromProto","getDescriptorFromProto","getOwnPropertyDescriptor","prepareCopy","useStrictShallowCopy_","createProxy","proxyMap_","proxySet_","push","current","currentImpl","find","tar","dequal","generateUUID","d","Date","getTime","d2","getNowTime","replace","c","r","Math","random","floor","__defProp","defineProperty","__getOwnPropDesc","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","__export","all","name","__copyProps","to","from","except","__toCommonJS","mod","src_exports","PLUGIN_ID","INTERACTIONS","EVALUATE_EXPRESSION","OVERRIDE_FLOW","flow_default","id","views","type","header","asset","values","label","main","binding","filter","footer","exp","navigation","BEGIN","Plugin","startState","CONFIG","state_type","ref","transitions","Config","Flow","Logs","Console","Editor","FLOW","LOGS","CONSOLE","EDITOR","schema","ROOT","playerConfig","flow","expression","default","validation","format","code","history","logs","logsType","time","message","severity","outcome","metricType","historyType","data","PLUGIN_VERSION","BasicPluginData","description","version","capabilities","actions","params","payload","useStateReducer","reducer","initialState","subscribers","getState","subscribe","subscriber","delete","dispatch","action","prevState","nextState","sub","pop","entries","item","record","Symbol","for","defineProperties","currentState","markChanged","Number","isNaN","deleteProperty","owner","setPrototypeOf","fn","arguments","Immer","config","produce","recipe","defaultBase","self","curriedProduce","hasError","p","ip","produceWithPatches","patches","inversePatches","autoFreeze","setAutoFreeze","useStrictShallowCopy","setUseStrictShallowCopy","createDraft","finishDraft","applyPatches","patch","op","applyPatchesImpl","applyPatches_","copy","foo","bar","ctor","len","tmp","RegExp","size","ArrayBuffer","Uint8Array","DataView","byteLength","getInt8","isView","containsInteraction","interactions","interaction","transaction","messages","pluginID","console","playerID","PLAYER_SELECTED","PLUGIN_INACTIVE_WARNING","globalThis","performance","now","NOOP_ID","genDataChangeTransaction","sender","context","timestamp","_messenger_","INITIAL_STATE","currentPlayer","DevtoolsPlugin","options","loggedWarning","announced","store","lastProcessedInteraction","start","end","processInteraction","bind","pluginData","registerMessenger","messenger","lastMessageIndex","newlyAdded","sendMessage","dispatchPlayerInit","dispatchPlayerStopped","dispatchDataUpdate","newData","checkIfDevtoolsIsActive","isActive","handler","log","player","teardown","logger","WeakRef","getVersion","getPlugins","map","hooks","dataController","tap","onUpdate","updates","newValue","asArray","onStart","f","JSON","parse","stringify","view","expressionEvaluator","evaluator","overrideFlow","evaluateExpression","deref","onError","intercept","evaluatorResult","evaluate","String","newFlow"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAIA,sBAAsB,AAAC;QC8GXC,aAAT,SAASA,WACdC,GAAA,EACAC,IAAA,EACAC,KAAA;YACAC,QAAAA,iEAAiB;QAEjB,IAAMC,MAAMH,IAAA,CAAKA,KAAKI,MAAA,GAAS,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AAI0X,SAAS;4BACX,IAAA,CAAKR,YAAA,CAAaQ;wBACpB;wBAEA;oBACF;gBACF;;;;MAnKuCtD;IvB85DvC,OAAOxJ,aAAaE;AACtB","sourcesContent":["\"use strict\";\nvar BasicDevtoolsPlugin = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n BasicDevtoolsPlugin: () => BasicDevtoolsPlugin\n });\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+basic-plugin-content@0.0.0/node_modules/@player-devtools/basic-plugin-content/dist/index.mjs\n var PLUGIN_ID = \"player-ui-basic-devtools-plugin\";\n var INTERACTIONS = {\n EVALUATE_EXPRESSION: \"evaluate-expression\",\n OVERRIDE_FLOW: \"override-flow\"\n };\n var flow_default = {\n id: \"player-ui-basic-devtools-plugin\",\n views: [\n {\n id: \"Config\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Config-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Config-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Config-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Config-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Config-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Config-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Config-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Config-main\",\n type: \"object-inspector\",\n binding: \"playerConfig\",\n label: {\n asset: {\n id: \"Config-main-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n }\n },\n {\n id: \"Flow\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Flow-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Flow-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Flow-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Flow-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Flow-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Flow-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Flow-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Flow-main\",\n type: \"object-inspector\",\n filter: true,\n binding: \"flow\",\n label: {\n asset: {\n id: \"Flow-main-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n footer: {\n asset: {\n id: \"Flow-footer\",\n type: \"copy-to-clipboard\",\n binding: \"flow\",\n label: {\n asset: {\n id: \"Flow-footer-label\",\n type: \"text\",\n value: \"Copy flow to the clipboard\"\n }\n }\n }\n }\n },\n {\n id: \"Logs\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Logs-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Logs-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Logs-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Logs-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Logs-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Logs-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Logs-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Logs-main\",\n type: \"table\",\n binding: \"logs\"\n }\n }\n },\n {\n id: \"Console\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Console-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Console-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Console-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Console-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Console-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Console-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Console-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Console-main\",\n type: \"console\",\n exp: \" publish('evaluate-expression', {{expression}}) \",\n binding: \"history\"\n }\n }\n },\n {\n id: \"Editor\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Editor-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Editor-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Editor-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Editor-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Editor-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Editor-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Editor-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Editor-main\",\n type: \"code-editor\",\n binding: \"flow\",\n exp: \" publish('override-flow', {{code}}) \"\n }\n }\n }\n ],\n navigation: {\n BEGIN: \"Plugin\",\n Plugin: {\n startState: \"CONFIG\",\n CONFIG: {\n state_type: \"VIEW\",\n ref: \"Config\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n FLOW: {\n state_type: \"VIEW\",\n ref: \"Flow\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n LOGS: {\n state_type: \"VIEW\",\n ref: \"Logs\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n CONSOLE: {\n state_type: \"VIEW\",\n ref: \"Console\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n EDITOR: {\n state_type: \"VIEW\",\n ref: \"Editor\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n }\n }\n },\n schema: {\n ROOT: {\n playerConfig: {\n type: \"RecordType\"\n },\n flow: {\n type: \"RecordType\"\n },\n expression: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n code: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n history: {\n type: \"historyType\",\n isArray: true\n },\n logs: {\n type: \"logsType\",\n isArray: true\n }\n },\n logsType: {\n id: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n time: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n type: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n message: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n severity: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n binding: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n from: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n to: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n state: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n error: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n outcome: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n metricType: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n }\n },\n historyType: {\n id: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n expression: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n result: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n severity: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n }\n }\n },\n data: {\n expression: \"\",\n flow: {},\n history: [],\n logs: [],\n playerConfig: {}\n }\n };\n var PLUGIN_VERSION = true ? \"1.0.1-next.0\" : \"unstamped\";\n var BasicPluginData = {\n id: PLUGIN_ID,\n name: \"Standard Devtools\",\n description: \"Standard Player UI Devtools\",\n version: PLUGIN_VERSION,\n flow: flow_default,\n capabilities: {\n description: \"Exposes Player runtime state (flow, data, logs, config) and supports expression evaluation and flow overrides.\",\n data: {\n flow: { description: \"The currently active Player flow JSON\" },\n data: { description: \"The current Player data model\" },\n logs: {\n description: \"Accumulated log messages emitted by the Player runtime\"\n },\n playerConfig: {\n description: \"Player version and list of registered plugin names\"\n },\n history: {\n description: \"Results of previous expression evaluations in this session\"\n }\n },\n actions: {\n [INTERACTIONS.EVALUATE_EXPRESSION]: {\n description: \"Evaluate a Player expression string and return the result\",\n params: {\n payload: {\n type: \"string\",\n description: \"The expression to evaluate\"\n }\n }\n },\n [INTERACTIONS.OVERRIDE_FLOW]: {\n description: \"Replace the currently running flow with a new flow JSON\",\n params: {\n payload: {\n type: \"string\",\n description: \"Stringified flow JSON to load\"\n }\n }\n }\n }\n }\n };\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+utils@0.0.0/node_modules/@player-devtools/utils/dist/index.mjs\n var useStateReducer = (reducer2, initialState) => {\n let state = initialState;\n const subscribers = /* @__PURE__ */ new Set();\n return {\n getState: () => state,\n /** Subscribe to state changes; returns an unsubscribe function. */\n subscribe(subscriber) {\n subscribers.add(subscriber);\n subscriber(state);\n return () => subscribers.delete(subscriber);\n },\n /** Dispatch an action through the reducer, then run side-effects. */\n dispatch(action) {\n const prevState = state;\n const nextState = reducer2(prevState, action);\n if (nextState !== prevState) {\n state = nextState;\n for (const sub of subscribers) sub(state);\n }\n }\n };\n };\n function deepAssign(target, source, merge = false) {\n if (Array.isArray(target) && Array.isArray(source)) {\n while (!merge && target.length > source.length) target.pop();\n for (const [index, item] of source.entries()) {\n target[index] = deepAssign(target[index], item, merge);\n }\n } else if (target && typeof target === \"object\" && !Array.isArray(target) && source && typeof source === \"object\" && !Array.isArray(source)) {\n const record = target;\n if (!merge)\n for (const key of Object.keys(target)) {\n if (!(key in source)) delete record[key];\n }\n for (const [key, item] of Object.entries(source)) {\n record[key] = deepAssign(record[key], item, merge);\n }\n } else {\n return source;\n }\n return target;\n }\n function dsetAssign(obj, keys, value, merge = false) {\n const key = keys[keys.length - 1];\n if (key === void 0)\n throw Error(\"Unable to assign at path containing undefined keys\");\n const target = keys.slice(0, -1).reduce(\n (acc, key2) => acc[key2] ?? (acc[key2] = {}),\n obj\n );\n target[key] = deepAssign(target[key], value, merge);\n }\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/dist/immer.mjs\n var NOTHING = Symbol.for(\"immer-nothing\");\n var DRAFTABLE = Symbol.for(\"immer-draftable\");\n var DRAFT_STATE = Symbol.for(\"immer-state\");\n function die(error, ...args) {\n if (false) {\n const e = errors[error];\n const msg = typeof e === \"function\" ? e.apply(null, args) : e;\n throw new Error(`[Immer] ${msg}`);\n }\n throw new Error(\n `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n );\n }\n var getPrototypeOf = Object.getPrototypeOf;\n function isDraft(value) {\n return !!value && !!value[DRAFT_STATE];\n }\n function isDraftable(value) {\n if (!value)\n return false;\n return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);\n }\n var objectCtorString = Object.prototype.constructor.toString();\n function isPlainObject(value) {\n if (!value || typeof value !== \"object\")\n return false;\n const proto = getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n const Ctor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n if (Ctor === Object)\n return true;\n return typeof Ctor == \"function\" && Function.toString.call(Ctor) === objectCtorString;\n }\n function each(obj, iter) {\n if (getArchtype(obj) === 0) {\n Reflect.ownKeys(obj).forEach((key) => {\n iter(key, obj[key], obj);\n });\n } else {\n obj.forEach((entry, index) => iter(index, entry, obj));\n }\n }\n function getArchtype(thing) {\n const state = thing[DRAFT_STATE];\n return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;\n }\n function has(thing, prop) {\n return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);\n }\n function set(thing, propOrOldValue, value) {\n const t = getArchtype(thing);\n if (t === 2)\n thing.set(propOrOldValue, value);\n else if (t === 3) {\n thing.add(value);\n } else\n thing[propOrOldValue] = value;\n }\n function is(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n }\n function isMap(target) {\n return target instanceof Map;\n }\n function isSet(target) {\n return target instanceof Set;\n }\n function latest(state) {\n return state.copy_ || state.base_;\n }\n function shallowCopy(base, strict) {\n if (isMap(base)) {\n return new Map(base);\n }\n if (isSet(base)) {\n return new Set(base);\n }\n if (Array.isArray(base))\n return Array.prototype.slice.call(base);\n const isPlain = isPlainObject(base);\n if (strict === true || strict === \"class_only\" && !isPlain) {\n const descriptors = Object.getOwnPropertyDescriptors(base);\n delete descriptors[DRAFT_STATE];\n let keys = Reflect.ownKeys(descriptors);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const desc = descriptors[key];\n if (desc.writable === false) {\n desc.writable = true;\n desc.configurable = true;\n }\n if (desc.get || desc.set)\n descriptors[key] = {\n configurable: true,\n writable: true,\n // could live with !!desc.set as well here...\n enumerable: desc.enumerable,\n value: base[key]\n };\n }\n return Object.create(getPrototypeOf(base), descriptors);\n } else {\n const proto = getPrototypeOf(base);\n if (proto !== null && isPlain) {\n return { ...base };\n }\n const obj = Object.create(proto);\n return Object.assign(obj, base);\n }\n }\n function freeze(obj, deep = false) {\n if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))\n return obj;\n if (getArchtype(obj) > 1) {\n Object.defineProperties(obj, {\n set: { value: dontMutateFrozenCollections },\n add: { value: dontMutateFrozenCollections },\n clear: { value: dontMutateFrozenCollections },\n delete: { value: dontMutateFrozenCollections }\n });\n }\n Object.freeze(obj);\n if (deep)\n Object.values(obj).forEach((value) => freeze(value, true));\n return obj;\n }\n function dontMutateFrozenCollections() {\n die(2);\n }\n function isFrozen(obj) {\n return Object.isFrozen(obj);\n }\n var plugins = {};\n function getPlugin(pluginKey) {\n const plugin = plugins[pluginKey];\n if (!plugin) {\n die(0, pluginKey);\n }\n return plugin;\n }\n var currentScope;\n function getCurrentScope() {\n return currentScope;\n }\n function createScope(parent_, immer_) {\n return {\n drafts_: [],\n parent_,\n immer_,\n // Whenever the modified draft contains a draft from another scope, we\n // need to prevent auto-freezing so the unowned draft can be finalized.\n canAutoFreeze_: true,\n unfinalizedDrafts_: 0\n };\n }\n function usePatchesInScope(scope, patchListener) {\n if (patchListener) {\n getPlugin(\"Patches\");\n scope.patches_ = [];\n scope.inversePatches_ = [];\n scope.patchListener_ = patchListener;\n }\n }\n function revokeScope(scope) {\n leaveScope(scope);\n scope.drafts_.forEach(revokeDraft);\n scope.drafts_ = null;\n }\n function leaveScope(scope) {\n if (scope === currentScope) {\n currentScope = scope.parent_;\n }\n }\n function enterScope(immer2) {\n return currentScope = createScope(currentScope, immer2);\n }\n function revokeDraft(draft) {\n const state = draft[DRAFT_STATE];\n if (state.type_ === 0 || state.type_ === 1)\n state.revoke_();\n else\n state.revoked_ = true;\n }\n function processResult(result, scope) {\n scope.unfinalizedDrafts_ = scope.drafts_.length;\n const baseDraft = scope.drafts_[0];\n const isReplaced = result !== void 0 && result !== baseDraft;\n if (isReplaced) {\n if (baseDraft[DRAFT_STATE].modified_) {\n revokeScope(scope);\n die(4);\n }\n if (isDraftable(result)) {\n result = finalize(scope, result);\n if (!scope.parent_)\n maybeFreeze(scope, result);\n }\n if (scope.patches_) {\n getPlugin(\"Patches\").generateReplacementPatches_(\n baseDraft[DRAFT_STATE].base_,\n result,\n scope.patches_,\n scope.inversePatches_\n );\n }\n } else {\n result = finalize(scope, baseDraft, []);\n }\n revokeScope(scope);\n if (scope.patches_) {\n scope.patchListener_(scope.patches_, scope.inversePatches_);\n }\n return result !== NOTHING ? result : void 0;\n }\n function finalize(rootScope, value, path) {\n if (isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n if (!state) {\n each(\n value,\n (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path)\n );\n return value;\n }\n if (state.scope_ !== rootScope)\n return value;\n if (!state.modified_) {\n maybeFreeze(rootScope, state.base_, true);\n return state.base_;\n }\n if (!state.finalized_) {\n state.finalized_ = true;\n state.scope_.unfinalizedDrafts_--;\n const result = state.copy_;\n let resultEach = result;\n let isSet2 = false;\n if (state.type_ === 3) {\n resultEach = new Set(result);\n result.clear();\n isSet2 = true;\n }\n each(\n resultEach,\n (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2)\n );\n maybeFreeze(rootScope, result, false);\n if (path && rootScope.patches_) {\n getPlugin(\"Patches\").generatePatches_(\n state,\n path,\n rootScope.patches_,\n rootScope.inversePatches_\n );\n }\n }\n return state.copy_;\n }\n function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {\n if (false)\n die(5);\n if (isDraft(childValue)) {\n const path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.\n !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;\n const res = finalize(rootScope, childValue, path);\n set(targetObject, prop, res);\n if (isDraft(res)) {\n rootScope.canAutoFreeze_ = false;\n } else\n return;\n } else if (targetIsSet) {\n targetObject.add(childValue);\n }\n if (isDraftable(childValue) && !isFrozen(childValue)) {\n if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n return;\n }\n finalize(rootScope, childValue);\n if ((!parentState || !parentState.scope_.parent_) && typeof prop !== \"symbol\" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)))\n maybeFreeze(rootScope, childValue);\n }\n }\n function maybeFreeze(scope, value, deep = false) {\n if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n freeze(value, deep);\n }\n }\n function createProxyProxy(base, parent) {\n const isArray = Array.isArray(base);\n const state = {\n type_: isArray ? 1 : 0,\n // Track which produce call this is associated with.\n scope_: parent ? parent.scope_ : getCurrentScope(),\n // True for both shallow and deep changes.\n modified_: false,\n // Used during finalization.\n finalized_: false,\n // Track which properties have been assigned (true) or deleted (false).\n assigned_: {},\n // The parent draft state.\n parent_: parent,\n // The base state.\n base_: base,\n // The base proxy.\n draft_: null,\n // set below\n // The base copy with any updated values.\n copy_: null,\n // Called by the `produce` function.\n revoke_: null,\n isManual_: false\n };\n let target = state;\n let traps = objectTraps;\n if (isArray) {\n target = [state];\n traps = arrayTraps;\n }\n const { revoke, proxy } = Proxy.revocable(target, traps);\n state.draft_ = proxy;\n state.revoke_ = revoke;\n return proxy;\n }\n var objectTraps = {\n get(state, prop) {\n if (prop === DRAFT_STATE)\n return state;\n const source = latest(state);\n if (!has(source, prop)) {\n return readPropFromProto(state, source, prop);\n }\n const value = source[prop];\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (value === peek(state.base_, prop)) {\n prepareCopy(state);\n return state.copy_[prop] = createProxy(value, state);\n }\n return value;\n },\n has(state, prop) {\n return prop in latest(state);\n },\n ownKeys(state) {\n return Reflect.ownKeys(latest(state));\n },\n set(state, prop, value) {\n const desc = getDescriptorFromProto(latest(state), prop);\n if (desc?.set) {\n desc.set.call(state.draft_, value);\n return true;\n }\n if (!state.modified_) {\n const current2 = peek(latest(state), prop);\n const currentState = current2?.[DRAFT_STATE];\n if (currentState && currentState.base_ === value) {\n state.copy_[prop] = value;\n state.assigned_[prop] = false;\n return true;\n }\n if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))\n return true;\n prepareCopy(state);\n markChanged(state);\n }\n if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'\n (value !== void 0 || prop in state.copy_) || // special case: NaN\n Number.isNaN(value) && Number.isNaN(state.copy_[prop]))\n return true;\n state.copy_[prop] = value;\n state.assigned_[prop] = true;\n return true;\n },\n deleteProperty(state, prop) {\n if (peek(state.base_, prop) !== void 0 || prop in state.base_) {\n state.assigned_[prop] = false;\n prepareCopy(state);\n markChanged(state);\n } else {\n delete state.assigned_[prop];\n }\n if (state.copy_) {\n delete state.copy_[prop];\n }\n return true;\n },\n // Note: We never coerce `desc.value` into an Immer draft, because we can't make\n // the same guarantee in ES5 mode.\n getOwnPropertyDescriptor(state, prop) {\n const owner = latest(state);\n const desc = Reflect.getOwnPropertyDescriptor(owner, prop);\n if (!desc)\n return desc;\n return {\n writable: true,\n configurable: state.type_ !== 1 || prop !== \"length\",\n enumerable: desc.enumerable,\n value: owner[prop]\n };\n },\n defineProperty() {\n die(11);\n },\n getPrototypeOf(state) {\n return getPrototypeOf(state.base_);\n },\n setPrototypeOf() {\n die(12);\n }\n };\n var arrayTraps = {};\n each(objectTraps, (key, fn) => {\n arrayTraps[key] = function() {\n arguments[0] = arguments[0][0];\n return fn.apply(this, arguments);\n };\n });\n arrayTraps.deleteProperty = function(state, prop) {\n if (false)\n die(13);\n return arrayTraps.set.call(this, state, prop, void 0);\n };\n arrayTraps.set = function(state, prop, value) {\n if (false)\n die(14);\n return objectTraps.set.call(this, state[0], prop, value, state[0]);\n };\n function peek(draft, prop) {\n const state = draft[DRAFT_STATE];\n const source = state ? latest(state) : draft;\n return source[prop];\n }\n function readPropFromProto(state, source, prop) {\n const desc = getDescriptorFromProto(source, prop);\n return desc ? `value` in desc ? desc.value : (\n // This is a very special case, if the prop is a getter defined by the\n // prototype, we should invoke it with the draft as context!\n desc.get?.call(state.draft_)\n ) : void 0;\n }\n function getDescriptorFromProto(source, prop) {\n if (!(prop in source))\n return void 0;\n let proto = getPrototypeOf(source);\n while (proto) {\n const desc = Object.getOwnPropertyDescriptor(proto, prop);\n if (desc)\n return desc;\n proto = getPrototypeOf(proto);\n }\n return void 0;\n }\n function markChanged(state) {\n if (!state.modified_) {\n state.modified_ = true;\n if (state.parent_) {\n markChanged(state.parent_);\n }\n }\n }\n function prepareCopy(state) {\n if (!state.copy_) {\n state.copy_ = shallowCopy(\n state.base_,\n state.scope_.immer_.useStrictShallowCopy_\n );\n }\n }\n var Immer2 = class {\n constructor(config) {\n this.autoFreeze_ = true;\n this.useStrictShallowCopy_ = false;\n this.produce = (base, recipe, patchListener) => {\n if (typeof base === \"function\" && typeof recipe !== \"function\") {\n const defaultBase = recipe;\n recipe = base;\n const self = this;\n return function curriedProduce(base2 = defaultBase, ...args) {\n return self.produce(base2, (draft) => recipe.call(this, draft, ...args));\n };\n }\n if (typeof recipe !== \"function\")\n die(6);\n if (patchListener !== void 0 && typeof patchListener !== \"function\")\n die(7);\n let result;\n if (isDraftable(base)) {\n const scope = enterScope(this);\n const proxy = createProxy(base, void 0);\n let hasError = true;\n try {\n result = recipe(proxy);\n hasError = false;\n } finally {\n if (hasError)\n revokeScope(scope);\n else\n leaveScope(scope);\n }\n usePatchesInScope(scope, patchListener);\n return processResult(result, scope);\n } else if (!base || typeof base !== \"object\") {\n result = recipe(base);\n if (result === void 0)\n result = base;\n if (result === NOTHING)\n result = void 0;\n if (this.autoFreeze_)\n freeze(result, true);\n if (patchListener) {\n const p = [];\n const ip = [];\n getPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip);\n patchListener(p, ip);\n }\n return result;\n } else\n die(1, base);\n };\n this.produceWithPatches = (base, recipe) => {\n if (typeof base === \"function\") {\n return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));\n }\n let patches, inversePatches;\n const result = this.produce(base, recipe, (p, ip) => {\n patches = p;\n inversePatches = ip;\n });\n return [result, patches, inversePatches];\n };\n if (typeof config?.autoFreeze === \"boolean\")\n this.setAutoFreeze(config.autoFreeze);\n if (typeof config?.useStrictShallowCopy === \"boolean\")\n this.setUseStrictShallowCopy(config.useStrictShallowCopy);\n }\n createDraft(base) {\n if (!isDraftable(base))\n die(8);\n if (isDraft(base))\n base = current(base);\n const scope = enterScope(this);\n const proxy = createProxy(base, void 0);\n proxy[DRAFT_STATE].isManual_ = true;\n leaveScope(scope);\n return proxy;\n }\n finishDraft(draft, patchListener) {\n const state = draft && draft[DRAFT_STATE];\n if (!state || !state.isManual_)\n die(9);\n const { scope_: scope } = state;\n usePatchesInScope(scope, patchListener);\n return processResult(void 0, scope);\n }\n /**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * By default, auto-freezing is enabled.\n */\n setAutoFreeze(value) {\n this.autoFreeze_ = value;\n }\n /**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\n setUseStrictShallowCopy(value) {\n this.useStrictShallowCopy_ = value;\n }\n applyPatches(base, patches) {\n let i;\n for (i = patches.length - 1; i >= 0; i--) {\n const patch = patches[i];\n if (patch.path.length === 0 && patch.op === \"replace\") {\n base = patch.value;\n break;\n }\n }\n if (i > -1) {\n patches = patches.slice(i + 1);\n }\n const applyPatchesImpl = getPlugin(\"Patches\").applyPatches_;\n if (isDraft(base)) {\n return applyPatchesImpl(base, patches);\n }\n return this.produce(\n base,\n (draft) => applyPatchesImpl(draft, patches)\n );\n }\n };\n function createProxy(value, parent) {\n const draft = isMap(value) ? getPlugin(\"MapSet\").proxyMap_(value, parent) : isSet(value) ? getPlugin(\"MapSet\").proxySet_(value, parent) : createProxyProxy(value, parent);\n const scope = parent ? parent.scope_ : getCurrentScope();\n scope.drafts_.push(draft);\n return draft;\n }\n function current(value) {\n if (!isDraft(value))\n die(10, value);\n return currentImpl(value);\n }\n function currentImpl(value) {\n if (!isDraftable(value) || isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n let copy;\n if (state) {\n if (!state.modified_)\n return state.base_;\n state.finalized_ = true;\n copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);\n } else {\n copy = shallowCopy(value, true);\n }\n each(copy, (key, childValue) => {\n set(copy, key, currentImpl(childValue));\n });\n if (state) {\n state.finalized_ = false;\n }\n return copy;\n }\n var immer = new Immer2();\n var produce = immer.produce;\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dequal@2.0.3/node_modules/dequal/dist/index.mjs\n var has2 = Object.prototype.hasOwnProperty;\n function find(iter, tar, key) {\n for (key of iter.keys()) {\n if (dequal(key, tar)) return key;\n }\n }\n function dequal(foo, bar) {\n var ctor, len, tmp;\n if (foo === bar) return true;\n if (foo && bar && (ctor = foo.constructor) === bar.constructor) {\n if (ctor === Date) return foo.getTime() === bar.getTime();\n if (ctor === RegExp) return foo.toString() === bar.toString();\n if (ctor === Array) {\n if ((len = foo.length) === bar.length) {\n while (len-- && dequal(foo[len], bar[len])) ;\n }\n return len === -1;\n }\n if (ctor === Set) {\n if (foo.size !== bar.size) {\n return false;\n }\n for (len of foo) {\n tmp = len;\n if (tmp && typeof tmp === \"object\") {\n tmp = find(bar, tmp);\n if (!tmp) return false;\n }\n if (!bar.has(tmp)) return false;\n }\n return true;\n }\n if (ctor === Map) {\n if (foo.size !== bar.size) {\n return false;\n }\n for (len of foo) {\n tmp = len[0];\n if (tmp && typeof tmp === \"object\") {\n tmp = find(bar, tmp);\n if (!tmp) return false;\n }\n if (!dequal(len[1], bar.get(tmp))) {\n return false;\n }\n }\n return true;\n }\n if (ctor === ArrayBuffer) {\n foo = new Uint8Array(foo);\n bar = new Uint8Array(bar);\n } else if (ctor === DataView) {\n if ((len = foo.byteLength) === bar.byteLength) {\n while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;\n }\n return len === -1;\n }\n if (ArrayBuffer.isView(foo)) {\n if ((len = foo.byteLength) === bar.byteLength) {\n while (len-- && foo[len] === bar[len]) ;\n }\n return len === -1;\n }\n if (!ctor || typeof foo === \"object\") {\n len = 0;\n for (ctor in foo) {\n if (has2.call(foo, ctor) && ++len && !has2.call(bar, ctor)) return false;\n if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n }\n return Object.keys(bar).length === len;\n }\n }\n return foo !== foo && bar !== bar;\n }\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+plugin@0.0.0/node_modules/@player-devtools/plugin/dist/index.mjs\n var containsInteraction = (interactions, interaction) => {\n return interactions.filter((i) => dequal(i, interaction)).length > 0;\n };\n var reducer = (state, transaction) => {\n switch (transaction.type) {\n case \"PLAYER_DEVTOOLS_PLAYER_INIT\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n dsetAssign(draft, [\"plugins\"], payload.plugins);\n const message = {\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload\n };\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLAYER_STOPPED\":\n return produce(state, (draft) => {\n const message = {\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: transaction.payload\n };\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n if (!payload.data) return state;\n try {\n dsetAssign(\n draft,\n [\"plugins\", transaction.payload.pluginID, \"flow\", \"data\"],\n transaction.payload.data\n );\n } catch {\n console.error(\"error setting data:\", transaction.payload.data);\n }\n const message = {\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload\n };\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_INTERACTION\":\n return produce(state, (draft) => {\n if (containsInteraction(draft.interactions, transaction)) return state;\n dsetAssign(\n draft,\n [\"interactions\"],\n [...draft.interactions, transaction]\n );\n });\n case \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\": {\n const { playerID } = transaction.payload;\n if (!playerID) return state;\n return produce(state, (draft) => {\n dsetAssign(draft, [\"currentPlayer\"], playerID);\n });\n }\n default:\n return state;\n }\n };\n var INTERACTIONS2 = {\n PLAYER_SELECTED: \"player-selected\"\n };\n var PLUGIN_INACTIVE_WARNING = \"The plugin has been registered, but the Player development tools are not active. If you are working in a production environment, it is recommended to remove the plugin. To activate, enable through the browser extension popup for web or configure the FlipperClient for mobile.\";\n var getNowTime = globalThis.performance ? () => globalThis.performance.now() : () => Date.now();\n function generateUUID() {\n let d = (/* @__PURE__ */ new Date()).getTime();\n let d2 = getNowTime() * 1e3;\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function(c) {\n let r = Math.random() * 16;\n if (d > 0) {\n r = (d + r) % 16 | 0;\n d = Math.floor(d / 16);\n } else {\n r = (d2 + r) % 16 | 0;\n d2 = Math.floor(d2 / 16);\n }\n return (c === \"x\" ? r : r & 3 | 8).toString(16);\n });\n }\n var NOOP_ID = -1;\n var genDataChangeTransaction = ({\n playerID,\n data,\n pluginID\n }) => {\n return {\n id: NOOP_ID,\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload: {\n pluginID,\n data\n },\n sender: playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true\n };\n };\n var INITIAL_STATE = {\n messages: [],\n plugins: {},\n interactions: [],\n currentPlayer: \"\"\n };\n var DevtoolsPlugin = class {\n constructor(options) {\n this.options = options;\n this.name = \"DevtoolsPlugin\";\n this.loggedWarning = false;\n this.announced = false;\n this.store = useStateReducer(reducer, INITIAL_STATE);\n this.lastProcessedInteraction = 0;\n this.store.subscribe(({ interactions }) => {\n const start = this.lastProcessedInteraction;\n const end = interactions.length ?? 0;\n if (start < end) {\n this.lastProcessedInteraction = end;\n interactions.slice(start, end).forEach(this.processInteraction.bind(this));\n }\n });\n }\n get pluginID() {\n return this.options.pluginData.id;\n }\n get playerID() {\n return this.options.playerID;\n }\n registerMessenger(messenger) {\n let lastMessageIndex = -1;\n return this.store.subscribe(({ messages }) => {\n const start = lastMessageIndex + 1;\n if (messages.length > start) {\n const newlyAdded = messages.slice(start);\n lastMessageIndex = messages.length - 1;\n for (const msg of newlyAdded) {\n messenger.sendMessage(msg);\n }\n }\n });\n }\n dispatchPlayerInit() {\n const transaction = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload: {\n plugins: {\n [this.pluginID]: this.options.pluginData\n }\n },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true\n };\n this.store.dispatch(transaction);\n this.announced = true;\n }\n dispatchPlayerStopped() {\n const transaction = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: { pluginID: this.pluginID },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true\n };\n this.store.dispatch(transaction);\n }\n // By default, we'll only write to the keys defined in data -- if undefined, data will be cleared\n dispatchDataUpdate(data) {\n const state = this.store.getState();\n const { plugins: plugins2 } = produce(this.store.getState(), (draft) => {\n if (!data)\n dsetAssign(draft, [\"plugins\", this.pluginID, \"flow\", \"data\"], data);\n else\n Object.entries(data).forEach(([key, value]) => {\n dsetAssign(\n draft,\n [\"plugins\", this.pluginID, \"flow\", \"data\", key],\n value\n );\n });\n });\n const newData = plugins2[this.pluginID].flow.data;\n if (dequal(state.plugins[this.pluginID]?.flow?.data, newData)) return;\n const transaction = genDataChangeTransaction({\n playerID: this.playerID,\n pluginID: this.pluginID,\n data: newData\n });\n this.store.dispatch(transaction);\n }\n checkIfDevtoolsIsActive() {\n const isActive = this.options.handler.checkIfDevtoolsIsActive();\n if (!isActive && !this.loggedWarning) {\n this.options.handler.log?.(PLUGIN_INACTIVE_WARNING);\n this.loggedWarning = true;\n }\n return isActive;\n }\n processInteraction(interaction) {\n this.options.handler.processInteraction(interaction);\n const {\n payload: { type, payload }\n } = interaction;\n if (type === INTERACTIONS2.PLAYER_SELECTED && payload) {\n this.store.dispatch({\n id: -1,\n type: \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\",\n payload: { playerID: payload },\n sender: this.playerID,\n context: \"player\",\n target: this.playerID,\n timestamp: Date.now(),\n _messenger_: true\n });\n }\n }\n apply(player) {\n if (!this.checkIfDevtoolsIsActive()) return;\n this.dispatchPlayerInit();\n }\n /**\n * Tell devtools this plugin is gone. Call it before the messenger is destroyed.\n * Safe to call more than once.\n */\n teardown() {\n if (!this.announced) return;\n this.announced = false;\n this.dispatchPlayerStopped();\n }\n };\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/plugin.ts\n var BasicDevtoolsPlugin = class extends DevtoolsPlugin {\n constructor(options) {\n super({\n ...options,\n pluginData: BasicPluginData\n });\n this.name = \"BasicDevtoolsPlugin\";\n this.data = {};\n this.playerConfig = {};\n this.logs = [];\n }\n apply(player) {\n this.logger = new WeakRef(player.logger);\n if (!this.checkIfDevtoolsIsActive()) return;\n super.apply(player);\n this.playerConfig = {\n version: player.getVersion(),\n plugins: player.getPlugins().map((plugin) => plugin.name)\n };\n this.dispatchDataUpdate({ playerConfig: this.playerConfig });\n player.hooks.dataController.tap(this.name, (dataController) => {\n dataController.hooks.onUpdate.tap(this.name, (updates) => {\n this.data = produce(this.data, (draft) => {\n updates.forEach(({ binding, newValue }) => {\n dsetAssign(draft, [\"data\", ...binding.asArray()], newValue);\n });\n });\n this.dispatchDataUpdate({ data: this.data });\n });\n });\n player.logger.hooks.log.tap(this.name, (severity, message) => {\n this.logs = [...this.logs, { severity, message }];\n this.dispatchDataUpdate({ logs: this.logs });\n });\n player.hooks.onStart.tap(this.name, (f) => {\n this.flow = JSON.parse(JSON.stringify(f));\n this.dispatchDataUpdate({ flow: this.flow });\n });\n player.hooks.view.tap(this.name, (view) => {\n this.view = new WeakRef(view);\n });\n player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {\n this.expressionEvaluator = new WeakRef(evaluator);\n });\n this.overrideFlow = player.start.bind(player);\n }\n evaluateExpression(expression) {\n const evaluator = this.expressionEvaluator?.deref();\n if (!evaluator) {\n return {\n id: generateUUID(),\n severity: \"error\",\n result: \"Expression evaluator not available\",\n expression\n };\n }\n try {\n evaluator.hooks.onError.intercept({\n call: (error) => {\n throw error;\n }\n });\n const evaluatorResult = evaluator.evaluate(expression);\n return {\n id: generateUUID(),\n result: evaluatorResult,\n expression\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error ?? \"Something went wrong\");\n return {\n id: generateUUID(),\n severity: \"error\",\n result: message,\n expression\n };\n }\n }\n processInteraction(interaction) {\n super.processInteraction(interaction);\n const {\n payload: { type, payload }\n } = interaction;\n if (type === INTERACTIONS.EVALUATE_EXPRESSION && this.expressionEvaluator && payload) {\n const result = this.evaluateExpression(payload);\n const current2 = this.store.getState()?.plugins?.[this.pluginID]?.flow?.data?.history || [];\n this.dispatchDataUpdate({ history: [...current2, result] });\n return;\n }\n if (type === INTERACTIONS.OVERRIDE_FLOW && payload && this.overrideFlow) {\n let newFlow;\n try {\n newFlow = JSON.parse(payload);\n } catch (e) {\n this.logger?.deref()?.error(this.name, \"Error parsing new flow\", e);\n }\n if (newFlow) {\n this.overrideFlow(newFlow);\n }\n return;\n }\n }\n };\n return __toCommonJS(src_exports);\n})();\n","export type Reducer<State, Action> = (state: State, action: Action) => State;\nexport type Dispatch<Action> = (action: Action) => void;\nexport type Subscriber<State> = (state: State) => void;\nexport type Subscribe<State> = (subscriber: Subscriber<State>) => Unsubscribe;\nexport type Unsubscribe = () => void;\n\nexport interface Store<State, Action> {\n getState: () => State;\n subscribe: Subscribe<State>;\n dispatch: Dispatch<Action>;\n}\n\nexport const useStateReducer = <State, Action>(\n reducer: Reducer<State, Action>,\n initialState: State,\n): Store<State, Action> => {\n let state = initialState;\n const subscribers = new Set<Subscriber<State>>();\n return {\n getState: () => state,\n\n /** Subscribe to state changes; returns an unsubscribe function. */\n subscribe(subscriber: Subscriber<State>): Unsubscribe {\n subscribers.add(subscriber);\n subscriber(state);\n return () => subscribers.delete(subscriber);\n },\n\n /** Dispatch an action through the reducer, then run side-effects. */\n dispatch(action: Action): void {\n const prevState = state;\n const nextState = reducer(prevState, action);\n\n if (nextState !== prevState) {\n state = nextState;\n for (const sub of subscribers) sub(state);\n }\n },\n };\n};\n\n/**\n * Recursively assigns the contents of `source` into `target`, preserving\n * existing object and array references to maintain key insertion order.\n *\n * - **Objects**: keys present in `target` but absent in `source` are deleted\n * (unless `merge` is true), then each source entry is recursed into.\n * - **Arrays**: target is truncated or extended to match source length\n * (unless `merge` is true), then each element is recursed into.\n * - **Primitives / type mismatch**: source is returned directly; the caller\n * is responsible for assigning the return value.\n *\n * @param target - The existing value to assign into.\n * @param source - The new value to assign from.\n * @param merge - When true, stale keys and excess array elements are preserved\n * rather than deleted. Defaults to false.\n * @returns The mutated `target`, or `source` if types are incompatible.\n */\nfunction deepAssign<T, V>(target: T, source: V, merge: boolean = false) {\n if (Array.isArray(target) && Array.isArray(source)) {\n while (!merge && target.length > source.length) target.pop();\n // recurse and assign new values\n for (const [index, item] of source.entries()) {\n target[index] = deepAssign(target[index], item, merge);\n }\n } else if (\n target &&\n typeof target === \"object\" &&\n !Array.isArray(target) &&\n source &&\n typeof source === \"object\" &&\n !Array.isArray(source)\n ) {\n const record = target as Record<string, unknown>;\n\n // clear stale keys\n if (!merge)\n for (const key of Object.keys(target)) {\n if (!(key in source)) delete record[key];\n }\n // recurse and assign new values\n for (const [key, item] of Object.entries(source)) {\n record[key] = deepAssign(record[key], item, merge);\n }\n } else {\n // new data doesn't match the types, so there is no referential equality to retain\n return source;\n }\n\n return target;\n}\n\ntype Index = string | number;\n\n/**\n * Deep-sets a value at a key path on an object, preserving existing nested\n * object and array references to maintain key insertion order.\n *\n * Intermediate objects are auto-vivified as needed. The final assignment is\n * handled by {@link deepAssign}, which mutates the existing value in place\n * rather than replacing it wholesale.\n *\n * @param obj - The root object to assign into.\n * @param keys - Path of keys leading to the target location.\n * @param value - The value to assign at the path.\n * @param merge - When true, stale keys and excess array elements are preserved\n * rather than deleted. Defaults to false.\n * @throws If `keys` is empty or contains an undefined key.\n *\n * @see {@link https://github.com/lukeed/dset} for the original dset implementation that inspired this API\n */\nexport function dsetAssign<V>(\n obj: Record<Index, unknown>,\n keys: Array<Index>,\n value: V,\n merge: boolean = false,\n): void {\n const key = keys[keys.length - 1];\n if (key === undefined)\n throw Error(\"Unable to assign at path containing undefined keys\");\n\n // Walk the path, auto-vivifying intermediate objects when necessary\n const target = keys\n .slice(0, -1)\n .reduce(\n (acc, key) => (acc[key] ??= {}) as Record<string | number, unknown>,\n obj,\n );\n\n // Deep assign the value into the target object for key\n target[key] = deepAssign(target[key], value, merge);\n}\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original<T>(value: T): T | undefined\nexport function original(value: Drafted<any>): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each<T extends Objectish>(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze<T>(obj: T, deep?: boolean): T\nexport function freeze<T>(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\t Object.defineProperties(obj, {\n set: {value: dontMutateFrozenCollections as any},\n add: {value: dontMutateFrozenCollections as any},\n clear: {value: dontMutateFrozenCollections as any},\n delete: {value: dontMutateFrozenCollections as any}\n })\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.values (only string-like, enumerables) instead of each()\n\t\tObject.values(obj).forEach(value => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_<T>(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_<T extends AnyMap>(target: T, parent?: ImmerState): T\n\t\tproxySet_<T extends AnySet>(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin<K extends keyof Plugins>(\n\tpluginKey: K\n): Exclude<Plugins[K], undefined> {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin<K extends keyof Plugins>(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map<any, boolean> | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted<AnyMap, MapState>\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map<any, Drafted> // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted<AnySet, SetState>\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen,\n\tisMap\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude<ImmerState, SetState>).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\t(isMap(targetObject)\n\t\t\t\t? targetObject.has(prop)\n\t\t\t\t: Object.prototype.propertyIsEnumerable.call(targetObject, prop))\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted<AnyObject, ProxyObjectState>\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted<AnyArray, ProxyArrayState>\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy<T extends Objectish>(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted<T, ProxyState> {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler<object | Array<any>> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler<ProxyState> = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft<T extends Objectish>(base: T): Draft<T> {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft<D extends Draft<any>>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft<infer T> ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches<T extends Objectish>(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy<T extends Objectish>(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted<T, ImmerState> {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current<T>(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","var has = Object.prototype.hasOwnProperty;\n\nfunction find(iter, tar, key) {\n\tfor (key of iter.keys()) {\n\t\tif (dequal(key, tar)) return key;\n\t}\n}\n\nexport function dequal(foo, bar) {\n\tvar ctor, len, tmp;\n\tif (foo === bar) return true;\n\n\tif (foo && bar && (ctor=foo.constructor) === bar.constructor) {\n\t\tif (ctor === Date) return foo.getTime() === bar.getTime();\n\t\tif (ctor === RegExp) return foo.toString() === bar.toString();\n\n\t\tif (ctor === Array) {\n\t\t\tif ((len=foo.length) === bar.length) {\n\t\t\t\twhile (len-- && dequal(foo[len], bar[len]));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ctor === Set) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len;\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!bar.has(tmp)) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === Map) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len[0];\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!dequal(len[1], bar.get(tmp))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === ArrayBuffer) {\n\t\t\tfoo = new Uint8Array(foo);\n\t\t\tbar = new Uint8Array(bar);\n\t\t} else if (ctor === DataView) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo.getInt8(len) === bar.getInt8(len));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ArrayBuffer.isView(foo)) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo[len] === bar[len]);\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (!ctor || typeof foo === 'object') {\n\t\t\tlen = 0;\n\t\t\tfor (ctor in foo) {\n\t\t\t\tif (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;\n\t\t\t\tif (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n\t\t\t}\n\t\t\treturn Object.keys(bar).length === len;\n\t\t}\n\t}\n\n\treturn foo !== foo && bar !== bar;\n}\n","import { getNowTime } from \"./getNowTime\";\n\n// TODO: Either polyfill crypto or use this (pulled from SO)\nexport function generateUUID(): string {\n // Public Domain/MIT\n let d = new Date().getTime(); //Timestamp\n let d2 = getNowTime() * 1000;\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n let r = Math.random() * 16; //random number between 0 and 16\n if (d > 0) {\n //Use timestamp until depleted\n r = (d + r) % 16 | 0;\n d = Math.floor(d / 16);\n } else {\n //Use microseconds since page-load if supported\n r = (d2 + r) % 16 | 0;\n d2 = Math.floor(d2 / 16);\n }\n return (c === \"x\" ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n","export { BasicDevtoolsPlugin } from \"./plugin\";\n","export const PLUGIN_ID = \"player-ui-basic-devtools-plugin\";\n\nexport const VIEWS_IDS = {\n CONFIG: \"Config\",\n FLOW: \"Flow\",\n LOGS: \"Logs\",\n CONSOLE: \"Console\",\n EDITOR: \"Editor\",\n};\n\nexport const INTERACTIONS = {\n EVALUATE_EXPRESSION: \"evaluate-expression\",\n OVERRIDE_FLOW: \"override-flow\",\n};\n","{\n \"id\": \"player-ui-basic-devtools-plugin\",\n \"views\": [\n {\n \"id\": \"Config\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Config-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Config-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Config-main\",\n \"type\": \"object-inspector\",\n \"binding\": \"playerConfig\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-main-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n }\n },\n {\n \"id\": \"Flow\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Flow-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Flow-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Flow-main\",\n \"type\": \"object-inspector\",\n \"filter\": true,\n \"binding\": \"flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-main-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n \"footer\": {\n \"asset\": {\n \"id\": \"Flow-footer\",\n \"type\": \"copy-to-clipboard\",\n \"binding\": \"flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-footer-label\",\n \"type\": \"text\",\n \"value\": \"Copy flow to the clipboard\"\n }\n }\n }\n }\n },\n {\n \"id\": \"Logs\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Logs-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Logs-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Logs-main\",\n \"type\": \"table\",\n \"binding\": \"logs\"\n }\n }\n },\n {\n \"id\": \"Console\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Console-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Console-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Console-main\",\n \"type\": \"console\",\n \"exp\": \" publish('evaluate-expression', {{expression}}) \",\n \"binding\": \"history\"\n }\n }\n },\n {\n \"id\": \"Editor\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Editor-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Editor-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Editor-main\",\n \"type\": \"code-editor\",\n \"binding\": \"flow\",\n \"exp\": \" publish('override-flow', {{code}}) \"\n }\n }\n }\n ],\n \"navigation\": {\n \"BEGIN\": \"Plugin\",\n \"Plugin\": {\n \"startState\": \"CONFIG\",\n \"CONFIG\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Config\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"FLOW\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Flow\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"LOGS\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Logs\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"CONSOLE\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Console\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"EDITOR\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Editor\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n }\n }\n },\n \"schema\": {\n \"ROOT\": {\n \"playerConfig\": {\n \"type\": \"RecordType\"\n },\n \"flow\": {\n \"type\": \"RecordType\"\n },\n \"expression\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"code\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"history\": {\n \"type\": \"historyType\",\n \"isArray\": true\n },\n \"logs\": {\n \"type\": \"logsType\",\n \"isArray\": true\n }\n },\n \"logsType\": {\n \"id\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"time\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"type\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"message\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"severity\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"binding\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"from\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"to\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"state\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"error\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"outcome\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"metricType\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n }\n },\n \"historyType\": {\n \"id\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"expression\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"result\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"severity\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"data\": {\n \"expression\": \"\",\n \"flow\": {},\n \"history\": [],\n \"logs\": [],\n \"playerConfig\": {}\n }\n}","import type { PluginData } from \"@player-devtools/types\";\nimport { PLUGIN_ID, INTERACTIONS } from \"./constants\";\n\n// Generated via dsl_compile target\nimport flow from \"../_generated/flow.json\";\n\n// Stamped by tsup at release build time; scoped to this module so that\n// packages declaring the same define don't collide in a shared TS program.\ndeclare const __VERSION__: string;\n\nconst PLUGIN_VERSION =\n typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"unstamped\";\n\nexport const BasicPluginData: PluginData = {\n id: PLUGIN_ID,\n name: \"Standard Devtools\",\n description: \"Standard Player UI Devtools\",\n version: PLUGIN_VERSION,\n flow,\n capabilities: {\n description:\n \"Exposes Player runtime state (flow, data, logs, config) and supports expression evaluation and flow overrides.\",\n data: {\n flow: { description: \"The currently active Player flow JSON\" },\n data: { description: \"The current Player data model\" },\n logs: {\n description: \"Accumulated log messages emitted by the Player runtime\",\n },\n playerConfig: {\n description: \"Player version and list of registered plugin names\",\n },\n history: {\n description:\n \"Results of previous expression evaluations in this session\",\n },\n },\n actions: {\n [INTERACTIONS.EVALUATE_EXPRESSION]: {\n description:\n \"Evaluate a Player expression string and return the result\",\n params: {\n payload: {\n type: \"string\",\n description: \"The expression to evaluate\",\n },\n },\n },\n [INTERACTIONS.OVERRIDE_FLOW]: {\n description: \"Replace the currently running flow with a new flow JSON\",\n params: {\n payload: {\n type: \"string\",\n description: \"Stringified flow JSON to load\",\n },\n },\n },\n },\n },\n};\n\nexport * from \"./constants\";\n","// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = /* @__PURE__ */ immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = /* @__PURE__ */ immer.setUseStrictShallowCopy.bind(\n\timmer\n)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = /* @__PURE__ */ immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft<T>(value: T): Draft<T> {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable<T>(value: T): Immutable<T> {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n","import { produce } from \"immer\";\nimport { dequal } from \"dequal\";\nimport type {\n DevtoolsDataChangeEvent,\n DevtoolsPluginsStore,\n ExtensionSupportedEvents,\n PlayerInitEvent,\n PlayerStoppedEvent,\n Transaction,\n} from \"@player-devtools/types\";\nimport { dsetAssign } from \"@player-devtools/utils\";\n\nconst containsInteraction = (\n interactions: DevtoolsPluginsStore[\"interactions\"],\n interaction: DevtoolsPluginsStore[\"interactions\"][number],\n) => {\n return interactions.filter((i) => dequal(i, interaction)).length > 0;\n};\n\n/** devtools plugin state reducer */\nexport const reducer = (\n state: DevtoolsPluginsStore,\n transaction: Transaction<ExtensionSupportedEvents>,\n): DevtoolsPluginsStore => {\n switch (transaction.type) {\n case \"PLAYER_DEVTOOLS_PLAYER_INIT\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n dsetAssign(draft, [\"plugins\"], payload.plugins);\n\n const message: PlayerInitEvent = {\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload,\n };\n\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLAYER_STOPPED\":\n return produce(state, (draft) => {\n const message: PlayerStoppedEvent = {\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: transaction.payload,\n };\n\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n\n if (!payload.data) return state;\n\n try {\n dsetAssign(\n draft,\n [\"plugins\", transaction.payload.pluginID, \"flow\", \"data\"],\n transaction.payload.data,\n );\n } catch {\n console.error(\"error setting data:\", transaction.payload.data);\n }\n const message: DevtoolsDataChangeEvent = {\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload,\n };\n\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_INTERACTION\":\n return produce(state, (draft) => {\n if (containsInteraction(draft.interactions, transaction)) return state;\n\n dsetAssign(\n draft,\n [\"interactions\"],\n [...draft.interactions, transaction],\n );\n });\n case \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\": {\n const { playerID } = transaction.payload;\n\n if (!playerID) return state;\n return produce(state, (draft) => {\n dsetAssign(draft, [\"currentPlayer\"], playerID);\n });\n }\n default:\n return state;\n }\n};\n","export const INTERACTIONS = {\n PLAYER_SELECTED: \"player-selected\",\n};\n\nexport const PLUGIN_INACTIVE_WARNING =\n \"The plugin has been registered, but the Player development tools are not active. If you are working in a production environment, it is recommended to remove the plugin. To activate, enable through the browser extension popup for web or configure the FlipperClient for mobile.\";\n","export const getNowTime: () => number = globalThis.performance\n ? () => globalThis.performance.now()\n : () => Date.now();\n","import type {\n DevtoolsDataChangeEvent,\n Transaction,\n} from \"@player-devtools/types\";\nimport type { Flow } from \"@player-ui/player\";\n\nconst NOOP_ID = -1;\n\n/**\n * Generates a data change transaction for the player devtools plugin.\n *\n * This function creates a transaction object that represents a change in data\n * within a player devtools plugin. The transaction includes details such as the\n * plugin ID, the changed data, and the player ID. It is used to communicate\n * changes between the plugin and devtools.\n */\nexport const genDataChangeTransaction = ({\n playerID,\n data,\n pluginID,\n}: {\n playerID: string;\n data: Flow[\"data\"];\n pluginID: string;\n}): Transaction<DevtoolsDataChangeEvent> => {\n return {\n id: NOOP_ID,\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload: {\n pluginID,\n data,\n },\n sender: playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true,\n };\n};\n","import type { Messenger } from \"@player-devtools/messenger\";\nimport {\n PluginData,\n DevtoolsPluginsStore,\n PlayerInitEvent,\n PlayerStoppedEvent,\n ExtensionSupportedEvents,\n Transaction,\n DevtoolsPluginInteractionEvent,\n} from \"@player-devtools/types\";\nimport { dsetAssign } from \"@player-devtools/utils\";\nimport type { DataModel, Player, PlayerPlugin } from \"@player-ui/player\";\nimport { produce } from \"immer\";\nimport {\n useStateReducer,\n type Store,\n type Unsubscribe,\n} from \"@player-devtools/utils\";\nimport { reducer } from \"./reducer\";\nimport { PLUGIN_INACTIVE_WARNING, INTERACTIONS } from \"./constants\";\nimport { genDataChangeTransaction } from \"./helpers\";\nimport { dequal } from \"dequal\";\n\nexport interface DevtoolsHandler {\n // TODO: Could return bool to signifiy handled to avoid double processing?\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void;\n checkIfDevtoolsIsActive(): boolean;\n log?(message: string): void;\n}\n\nexport interface DevtoolsPluginOptions {\n playerID: string;\n pluginData: PluginData;\n handler: DevtoolsHandler;\n}\n\nconst INITIAL_STATE: DevtoolsPluginsStore = {\n messages: [],\n plugins: {},\n interactions: [],\n currentPlayer: \"\",\n};\n\n// TODO: Rename to DevtoolsPluginStore? Need to rename DevtoolsPluginsStore to DevtoolsPluginState\nexport type PluginStore = Store<\n DevtoolsPluginsStore,\n Transaction<ExtensionSupportedEvents>\n>;\n\n/** Entrypoint for devtools plugins with platform-agnostic components */\nexport class DevtoolsPlugin implements PlayerPlugin, DevtoolsHandler {\n name: string = \"DevtoolsPlugin\";\n\n private loggedWarning = false;\n\n /** True once devtools has been told about this player */\n private announced = false;\n\n store: PluginStore = useStateReducer(reducer, INITIAL_STATE);\n protected lastProcessedInteraction = 0;\n\n get pluginID(): string {\n return this.options.pluginData.id;\n }\n\n get playerID(): string {\n return this.options.playerID;\n }\n\n constructor(protected options: DevtoolsPluginOptions) {\n this.store.subscribe(({ interactions }) => {\n const start = this.lastProcessedInteraction;\n const end = interactions.length ?? 0;\n if (start < end) {\n // Advance the cursor BEFORE processing: `processInteraction` may\n // dispatch synchronously (e.g. SELECTED_PLAYER_CHANGE), which re-enters\n // this subscriber. Advancing first makes that re-entrant pass a no-op\n // instead of reprocessing the same interactions.\n this.lastProcessedInteraction = end;\n interactions\n .slice(start, end)\n .forEach(this.processInteraction.bind(this));\n }\n });\n }\n\n registerMessenger(\n messenger: Messenger<ExtensionSupportedEvents>,\n ): Unsubscribe {\n // Propagate new messages from state to devtools via the messenger\n let lastMessageIndex = -1;\n return this.store.subscribe(({ messages }) => {\n const start = lastMessageIndex + 1;\n if (messages.length > start) {\n const newlyAdded = messages.slice(start);\n lastMessageIndex = messages.length - 1;\n for (const msg of newlyAdded) {\n messenger.sendMessage(msg);\n }\n }\n });\n }\n\n protected dispatchPlayerInit(): void {\n // Initial plugin content\n const transaction: Transaction<PlayerInitEvent> = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload: {\n plugins: {\n [this.pluginID]: this.options.pluginData,\n },\n },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true,\n };\n\n this.store.dispatch(transaction);\n this.announced = true;\n }\n\n protected dispatchPlayerStopped(): void {\n const transaction: Transaction<PlayerStoppedEvent> = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: { pluginID: this.pluginID },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true,\n };\n\n this.store.dispatch(transaction);\n }\n\n // By default, we'll only write to the keys defined in data -- if undefined, data will be cleared\n protected dispatchDataUpdate(data?: DataModel): void {\n const state = this.store.getState();\n\n const { plugins } = produce(this.store.getState(), (draft) => {\n if (!data)\n dsetAssign(draft, [\"plugins\", this.pluginID, \"flow\", \"data\"], data);\n else\n Object.entries(data).forEach(([key, value]) => {\n dsetAssign(\n draft,\n [\"plugins\", this.pluginID, \"flow\", \"data\", key],\n value,\n );\n });\n });\n\n const newData = plugins[this.pluginID]!.flow.data;\n if (dequal(state.plugins[this.pluginID]?.flow?.data, newData)) return;\n\n const transaction = genDataChangeTransaction({\n playerID: this.playerID,\n pluginID: this.pluginID,\n data: newData,\n });\n\n this.store.dispatch(transaction);\n }\n\n checkIfDevtoolsIsActive(): boolean {\n const isActive = this.options.handler.checkIfDevtoolsIsActive();\n if (!isActive && !this.loggedWarning) {\n this.options.handler.log?.(PLUGIN_INACTIVE_WARNING);\n this.loggedWarning = true;\n }\n\n return isActive;\n }\n\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void {\n this.options.handler.processInteraction(interaction);\n\n const {\n payload: { type, payload },\n } = interaction;\n\n if (type === INTERACTIONS.PLAYER_SELECTED && payload) {\n this.store.dispatch({\n id: -1,\n type: \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\",\n payload: { playerID: payload },\n sender: this.playerID,\n context: \"player\",\n target: this.playerID,\n timestamp: Date.now(),\n _messenger_: true,\n });\n }\n }\n\n apply(player: Player): void {\n if (!this.checkIfDevtoolsIsActive()) return;\n\n this.dispatchPlayerInit();\n }\n\n /**\n * Tell devtools this plugin is gone. Call it before the messenger is destroyed.\n * Safe to call more than once.\n */\n teardown(): void {\n if (!this.announced) return;\n this.announced = false;\n\n this.dispatchPlayerStopped();\n }\n}\n","import {\n INTERACTIONS,\n BasicPluginData,\n} from \"@player-devtools/basic-plugin-content\";\nimport {\n DevtoolsPlugin,\n DevtoolsPluginOptions,\n generateUUID,\n} from \"@player-devtools/plugin\";\nimport type { DevtoolsPluginInteractionEvent } from \"@player-devtools/types\";\nimport { dsetAssign } from \"@player-devtools/utils\";\nimport type {\n DataController,\n ExpressionEvaluator,\n Flow,\n Player,\n ViewInstance,\n Logger,\n} from \"@player-ui/player\";\nimport { produce } from \"immer\";\n\nimport { Evaluation } from \"./types\";\n\n/** Taps into the Player and ReactPlayer hooks and leverage the WrapperComponent to define and process the content. */\nexport class BasicDevtoolsPlugin extends DevtoolsPlugin {\n constructor(options: Omit<DevtoolsPluginOptions, \"pluginData\">) {\n super({\n ...options,\n pluginData: BasicPluginData,\n });\n }\n\n name = \"BasicDevtoolsPlugin\";\n\n data: Record<string, unknown> = {};\n\n playerConfig: Record<string, unknown> = {};\n\n logs: {\n severity: string;\n message: unknown;\n }[] = [];\n\n flow?: Flow;\n\n logger?: WeakRef<Logger>;\n\n expressionEvaluator?: WeakRef<ExpressionEvaluator>;\n\n view?: WeakRef<ViewInstance>;\n\n dataController?: WeakRef<DataController>;\n\n overrideFlow?: Player[\"start\"];\n\n apply(player: Player): void {\n this.logger = new WeakRef(player.logger);\n\n if (!this.checkIfDevtoolsIsActive()) return;\n\n super.apply(player);\n\n // Config\n this.playerConfig = {\n version: player.getVersion(),\n plugins: player.getPlugins().map((plugin) => plugin.name),\n };\n\n this.dispatchDataUpdate({ playerConfig: this.playerConfig });\n\n // Data\n player.hooks.dataController.tap(this.name, (dataController) => {\n dataController.hooks.onUpdate.tap(this.name, (updates) => {\n this.data = produce(this.data, (draft) => {\n updates.forEach(({ binding, newValue }) => {\n dsetAssign(draft, [\"data\", ...binding.asArray()], newValue);\n });\n });\n\n this.dispatchDataUpdate({ data: this.data });\n });\n });\n\n player.logger.hooks.log.tap(this.name, (severity, message) => {\n this.logs = [...this.logs, { severity, message }];\n\n this.dispatchDataUpdate({ logs: this.logs });\n });\n\n // Flow\n player.hooks.onStart.tap(this.name, (f) => {\n this.flow = JSON.parse(JSON.stringify(f));\n\n this.dispatchDataUpdate({ flow: this.flow });\n });\n\n // View\n player.hooks.view.tap(this.name, (view) => {\n this.view = new WeakRef(view);\n });\n\n // Expression evaluator\n player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {\n this.expressionEvaluator = new WeakRef(evaluator);\n });\n\n // Override flow\n this.overrideFlow = player.start.bind(player);\n }\n\n private evaluateExpression(expression: string): Evaluation {\n const evaluator = this.expressionEvaluator?.deref();\n\n if (!evaluator) {\n return {\n id: generateUUID(),\n severity: \"error\",\n result: \"Expression evaluator not available\",\n expression,\n };\n }\n\n try {\n evaluator.hooks.onError.intercept({\n call: (error: Error) => {\n throw error;\n },\n });\n\n const evaluatorResult = evaluator.evaluate(expression);\n\n return {\n id: generateUUID(),\n result: evaluatorResult,\n expression,\n };\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : String(error ?? \"Something went wrong\");\n return {\n id: generateUUID(),\n severity: \"error\",\n result: message,\n expression,\n };\n }\n }\n\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void {\n // invokes mobile specific handlers\n super.processInteraction(interaction);\n\n const {\n payload: { type, payload },\n } = interaction;\n if (\n type === INTERACTIONS.EVALUATE_EXPRESSION &&\n this.expressionEvaluator &&\n payload\n ) {\n const result = this.evaluateExpression(payload);\n const current: Array<Evaluation> =\n (this.store.getState()?.plugins?.[this.pluginID]?.flow?.data\n ?.history as Array<Evaluation>) || [];\n\n this.dispatchDataUpdate({ history: [...current, result] });\n\n return;\n }\n\n if (type === INTERACTIONS.OVERRIDE_FLOW && payload && this.overrideFlow) {\n let newFlow: Flow | undefined;\n\n try {\n newFlow = JSON.parse(payload);\n } catch (e) {\n this.logger?.deref()?.error(this.name, \"Error parsing new flow\", e);\n }\n\n if (newFlow) {\n this.overrideFlow(newFlow);\n }\n\n return;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/circleci/.cache/bazel/_bazel_circleci/8a7a049d85b1ea1286a017c8d271a188/sandbox/processwrapper-sandbox/3140/execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/dist/index.global.js","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/utils/core/src/index.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/errors.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/common.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/plugins.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/scope.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/finalize.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/proxy.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/immerClass.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/core/current.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dequal@2.0.3/node_modules/dequal/dist/index.mjs","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/helpers/uuid.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/src/utils.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/src/index.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/utils.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/index.ts","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/content/src/constants.ts","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/content/_generated/flow.json","../../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/content/src/index.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/utils/env.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/src/immer.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/reducer.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/constants.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/helpers/getNowTime.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/helpers/genDataChangeTransaction.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugin/core/src/plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/key.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/store.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/history.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/symbols.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/context/core/src/state-plugin.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/context.ts","../../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/plugin.ts"],"names":["BasicDevtoolsPlugin","dsetAssign","obj","keys","value","merge","key","length","Error","acc","target","slice","reduce","deepAssign","die","error","args","e","errors","msg","apply","isDraft","DRAFT_STATE","isDraftable","isPlainObject","Array","isArray","DRAFTABLE","constructor","isMap","isSet","proto","getPrototypeOf","Ctor","Object","hasOwnProperty","call","Function","toString","objectCtorString","each","iter","getArchtype","Reflect","ownKeys","forEach","entry","index","thing","state","type_","has","prop","prototype","set","propOrOldValue","t","add","is","x","y","Map","Set","latest","copy_","base_","shallowCopy","base","strict","isPlain","descriptors","getOwnPropertyDescriptors","i","desc","writable","configurable","get","enumerable","create","assign","dontMutateFrozenCollections","isFrozen","getPlugin","pluginKey","plugin","plugins","getCurrentScope","currentScope","createScope","parent_","immer_","drafts_","canAutoFreeze_","unfinalizedDrafts_","usePatchesInScope","scope","patchListener","patches_","inversePatches_","patchListener_","revokeScope","leaveScope","revokeDraft","enterScope","immer","draft","revoke_","revoked_","processResult","result","baseDraft","isReplaced","modified_","finalize","maybeFreeze","generateReplacementPatches_","NOTHING","rootScope","path","childValue","finalizeProperty","scope_","finalized_","resultEach","clear","generatePatches_","parentState","targetObject","rootPath","targetIsSet","assigned_","concat","res","autoFreeze_","propertyIsEnumerable","deep","freeze","createProxyProxy","parent","draft_","isManual_","traps","objectTraps","arrayTraps","Proxy","revocable","revoke","proxy","peek","source","readPropFromProto","getDescriptorFromProto","getOwnPropertyDescriptor","prepareCopy","useStrictShallowCopy_","createProxy","proxyMap_","proxySet_","push","current","currentImpl","find","tar","dequal","generateUUID","d","Date","getTime","d2","getNowTime","replace","c","r","Math","random","floor","equalToOrIn","check","includes","callTap","tap","ctx","context","callback","getContextPlugin","player","existing","findPlugin","ContextPluginSymbol","ContextPlugin","registerPlugin","__defProp","defineProperty","__getOwnPropDesc","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","__export","all","name","__copyProps","to","from","except","__toCommonJS","mod","src_exports","playerConfigContextKey","PLUGIN_ID","INTERACTIONS","EVALUATE_EXPRESSION","OVERRIDE_FLOW","flow_default","id","views","type","header","asset","values","label","main","binding","filter","footer","exp","navigation","BEGIN","Plugin","startState","CONFIG","state_type","ref","transitions","Config","Flow","Logs","Console","Editor","FLOW","LOGS","CONSOLE","EDITOR","schema","ROOT","playerConfig","flow","expression","default","validation","format","code","history","logs","logsType","time","message","severity","outcome","metricType","historyType","data","PLUGIN_VERSION","BasicPluginData","description","version","capabilities","actions","params","payload","useStateReducer","reducer","initialState","subscribers","getState","subscribe","subscriber","delete","dispatch","action","prevState","nextState","sub","pop","entries","item","record","Symbol","for","defineProperties","currentState","markChanged","Number","isNaN","deleteProperty","owner","setPrototypeOf","fn","arguments","Immer","config","produce","recipe","defaultBase","self","curriedProduce","hasError","p","ip","produceWithPatches","patches","inversePatches","autoFreeze","setAutoFreeze","useStrictShallowCopy","setUseStrictShallowCopy","createDraft","finishDraft","applyPatches","patch","op","applyPatchesImpl","applyPatches_","copy","foo","bar","ctor","len","tmp","RegExp","size","ArrayBuffer","Uint8Array","DataView","byteLength","getInt8","isView","containsInteraction","interactions","interaction","transaction","messages","pluginID","console","playerID","PLAYER_SELECTED","PLUGIN_INACTIVE_WARNING","globalThis","performance","now","NOOP_ID","genDataChangeTransaction","sender","timestamp","_messenger_","INITIAL_STATE","currentPlayer","DevtoolsPlugin","options","loggedWarning","announced","store","lastProcessedInteraction","start","end","processInteraction","bind","pluginData","registerMessenger","messenger","lastMessageIndex","newlyAdded","sendMessage","dispatchPlayerInit","dispatchPlayerStopped","dispatchDataUpdate","newData","checkIfDevtoolsIsActive","isActive","handler","log","teardown","InterceptionManager","interceptions","interceptionKeySet","isUsed","intercept","int","s","_a","_b","loop","err","asError","done","Hook","taps","resolvedOptions","before","insertionIndex","beforeSet","splice","untap","SyncHook","SyncWaterfallHook","rtn","rest","tapIndex","tapValue","KEY_NAMESPACE","defineContextKey","symbol","nameOfContextKey","k","keyFor","startsWith","deepFreezeEntry","tombstone","tombstoneFunctions","map","out","v","ContextStore","dependents","register","hasLiteral","literal","registerTransform","transform","previousSources","sources","src","stored","compute","Boolean","dependentsOf","sourceSymbol","targetSymbol","transitiveDependentsOf","visited","queue","shift","list","hasValue","hasTransform","meta","frozenEntries","computed","bySymbol","snapshot","flowId","endedAt","sym","reader","otherKey","ContextHistory","stack","subscriptionCounter","_ContextPlugin","hooks","onSet","resolveValue","onRegister","onFlowFrozen","transforms","perKeySubs","globalSubs","tokenIndex","lastNotified","historyStack","onStart","currentFlowId","onEnd","rotateStore","added","isFirstSighting","notifyIfChanged","raw","resolved","token","nextToken","bucket","subscribeAll","unsubscribe","setByName","ensureNamedKey","getByName","hasByName","subscribeByName","subscribeAllByName","publishIfChanged","dep","hasNotified","unchanged","notify","flowIdContextKey","flowStateContextKey","viewIdContextKey","viewContextKey","dataContextKey","playerStatusContextKey","validationContextKey","setDataActionKey","transitionActionKey","playerStateContextKey","StateContextPlugin","validationController","publishValidation","byBinding","canTransition","getBindings","getValidationForBinding","getAll","asString","displayTarget","blocking","some","status","read","flowState","transition","viewId","viewResolved","dataModel","setData","view","model","flowController","flowInstance","recordState","afterTransition","vc","viewController","initialView","onUpdate","dataController","publish","serialize","subscriptions","logger","WeakRef","getPlugins","previous","JSON","parse","stringify","publishConfig","getVersion","f","expressionEvaluator","evaluator","overrideFlow","evaluateExpression","deref","onError","evaluatorResult","evaluate","String","newFlow"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAC,qBAAG5F,iBAAJ;gCAAalD;6BAAM;wBAAE;wBAExD;oBACF;oBAEA,IAAI0G,SAASN,aAAaE,aAAA,IAAiByD,WAAW,IAAA,CAAK0R,YAAA,EAAc;wBACvE,IAAIO;wBAEJ,IAAI;4BACFA,UAAUf,KAAKC,KAAA,CAAMnR;wBACvB,EAAA,OAAS3P,GAAG;gCACV,oBAAA;6BAAA,eAAA,IAAA,CAAKygB,MAAA,cAAL,oCAAA,qBAAA,aAAac,KAAA,gBAAb,yCAAA,mBAAsBzhB,KAAA,CAAM,IAAA,CAAKwL,IAAA,EAAM,0BAA0BtL;wBACnE;wBAEA,IAAI4hB,SAAS;4BACX,IAAA,CAAKP,YAAA,CAAaO;wBACpB;wBAEA;oBACF;gBACF;;;;MA3LuCzM;IjCyqFvC,OAAOxJ,aAAaE;AACtB","sourcesContent":["\"use strict\";\nvar BasicDevtoolsPlugin = (() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/index.ts\n var src_exports = {};\n __export(src_exports, {\n BasicDevtoolsPlugin: () => BasicDevtoolsPlugin,\n playerConfigContextKey: () => playerConfigContextKey\n });\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+basic-plugin-content@0.0.0/node_modules/@player-devtools/basic-plugin-content/dist/index.mjs\n var PLUGIN_ID = \"player-ui-basic-devtools-plugin\";\n var INTERACTIONS = {\n EVALUATE_EXPRESSION: \"evaluate-expression\",\n OVERRIDE_FLOW: \"override-flow\"\n };\n var flow_default = {\n id: \"player-ui-basic-devtools-plugin\",\n views: [\n {\n id: \"Config\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Config-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Config-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Config-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Config-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Config-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Config-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Config-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Config-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Config-main\",\n type: \"object-inspector\",\n binding: \"playerConfig\",\n label: {\n asset: {\n id: \"Config-main-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n }\n },\n {\n id: \"Flow\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Flow-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Flow-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Flow-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Flow-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Flow-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Flow-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Flow-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Flow-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Flow-main\",\n type: \"object-inspector\",\n filter: true,\n binding: \"flow\",\n label: {\n asset: {\n id: \"Flow-main-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n footer: {\n asset: {\n id: \"Flow-footer\",\n type: \"copy-to-clipboard\",\n binding: \"flow\",\n label: {\n asset: {\n id: \"Flow-footer-label\",\n type: \"text\",\n value: \"Copy flow to the clipboard\"\n }\n }\n }\n }\n },\n {\n id: \"Logs\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Logs-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Logs-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Logs-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Logs-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Logs-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Logs-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Logs-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Logs-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Logs-main\",\n type: \"table\",\n binding: \"logs\"\n }\n }\n },\n {\n id: \"Console\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Console-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Console-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Console-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Console-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Console-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Console-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Console-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Console-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Console-main\",\n type: \"console\",\n exp: \" publish('evaluate-expression', {{expression}}) \",\n binding: \"history\"\n }\n }\n },\n {\n id: \"Editor\",\n type: \"stacked-view\",\n header: {\n asset: {\n id: \"Editor-header\",\n type: \"navigation\",\n values: [\n {\n asset: {\n id: \"Editor-header-values-0\",\n type: \"action\",\n value: \"Config\",\n label: {\n asset: {\n id: \"Editor-header-values-0-label\",\n type: \"text\",\n value: \"Config\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-1\",\n type: \"action\",\n value: \"Flow\",\n label: {\n asset: {\n id: \"Editor-header-values-1-label\",\n type: \"text\",\n value: \"Flow\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-2\",\n type: \"action\",\n value: \"Logs\",\n label: {\n asset: {\n id: \"Editor-header-values-2-label\",\n type: \"text\",\n value: \"Logs\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-3\",\n type: \"action\",\n value: \"Console\",\n label: {\n asset: {\n id: \"Editor-header-values-3-label\",\n type: \"text\",\n value: \"Console\"\n }\n }\n }\n },\n {\n asset: {\n id: \"Editor-header-values-4\",\n type: \"action\",\n value: \"Editor\",\n label: {\n asset: {\n id: \"Editor-header-values-4-label\",\n type: \"text\",\n value: \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n main: {\n asset: {\n id: \"Editor-main\",\n type: \"code-editor\",\n binding: \"flow\",\n exp: \" publish('override-flow', {{code}}) \"\n }\n }\n }\n ],\n navigation: {\n BEGIN: \"Plugin\",\n Plugin: {\n startState: \"CONFIG\",\n CONFIG: {\n state_type: \"VIEW\",\n ref: \"Config\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n FLOW: {\n state_type: \"VIEW\",\n ref: \"Flow\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n LOGS: {\n state_type: \"VIEW\",\n ref: \"Logs\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n CONSOLE: {\n state_type: \"VIEW\",\n ref: \"Console\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n },\n EDITOR: {\n state_type: \"VIEW\",\n ref: \"Editor\",\n transitions: {\n Config: \"CONFIG\",\n Flow: \"FLOW\",\n Logs: \"LOGS\",\n Console: \"CONSOLE\",\n Editor: \"EDITOR\"\n }\n }\n }\n },\n schema: {\n ROOT: {\n playerConfig: {\n type: \"RecordType\"\n },\n flow: {\n type: \"RecordType\"\n },\n expression: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n code: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n history: {\n type: \"historyType\",\n isArray: true\n },\n logs: {\n type: \"logsType\",\n isArray: true\n }\n },\n logsType: {\n id: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n time: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n type: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n message: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n severity: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n binding: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n from: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n to: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n state: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n error: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n outcome: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n metricType: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n }\n },\n historyType: {\n id: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n expression: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n result: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n },\n severity: {\n type: \"StringType\",\n default: \"\",\n validation: [\n {\n type: \"string\"\n }\n ],\n format: {\n type: \"string\"\n }\n }\n }\n },\n data: {\n expression: \"\",\n flow: {},\n history: [],\n logs: [],\n playerConfig: {}\n }\n };\n var PLUGIN_VERSION = true ? \"1.1.0-next.0\" : \"unstamped\";\n var BasicPluginData = {\n id: PLUGIN_ID,\n name: \"Standard Devtools\",\n description: \"Standard Player UI Devtools\",\n version: PLUGIN_VERSION,\n flow: flow_default,\n capabilities: {\n description: \"Exposes Player runtime state (flow, data, logs, config) and supports expression evaluation and flow overrides.\",\n data: {\n flow: { description: \"The currently active Player flow JSON\" },\n data: { description: \"The current Player data model\" },\n logs: {\n description: \"Accumulated log messages emitted by the Player runtime\"\n },\n playerConfig: {\n description: \"Player version and list of registered plugin names\"\n },\n history: {\n description: \"Results of previous expression evaluations in this session\"\n }\n },\n actions: {\n [INTERACTIONS.EVALUATE_EXPRESSION]: {\n description: \"Evaluate a Player expression string and return the result\",\n params: {\n payload: {\n type: \"string\",\n description: \"The expression to evaluate\"\n }\n }\n },\n [INTERACTIONS.OVERRIDE_FLOW]: {\n description: \"Replace the currently running flow with a new flow JSON\",\n params: {\n payload: {\n type: \"string\",\n description: \"Stringified flow JSON to load\"\n }\n }\n }\n }\n }\n };\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+utils@0.0.0/node_modules/@player-devtools/utils/dist/index.mjs\n var useStateReducer = (reducer2, initialState) => {\n let state = initialState;\n const subscribers = /* @__PURE__ */ new Set();\n return {\n getState: () => state,\n /** Subscribe to state changes; returns an unsubscribe function. */\n subscribe(subscriber) {\n subscribers.add(subscriber);\n subscriber(state);\n return () => subscribers.delete(subscriber);\n },\n /** Dispatch an action through the reducer, then run side-effects. */\n dispatch(action) {\n const prevState = state;\n const nextState = reducer2(prevState, action);\n if (nextState !== prevState) {\n state = nextState;\n for (const sub of subscribers) sub(state);\n }\n }\n };\n };\n function deepAssign(target, source, merge = false) {\n if (Array.isArray(target) && Array.isArray(source)) {\n while (!merge && target.length > source.length) target.pop();\n for (const [index, item] of source.entries()) {\n target[index] = deepAssign(target[index], item, merge);\n }\n } else if (target && typeof target === \"object\" && !Array.isArray(target) && source && typeof source === \"object\" && !Array.isArray(source)) {\n const record = target;\n if (!merge)\n for (const key of Object.keys(target)) {\n if (!(key in source)) delete record[key];\n }\n for (const [key, item] of Object.entries(source)) {\n record[key] = deepAssign(record[key], item, merge);\n }\n } else {\n return source;\n }\n return target;\n }\n function dsetAssign(obj, keys, value, merge = false) {\n const key = keys[keys.length - 1];\n if (key === void 0)\n throw Error(\"Unable to assign at path containing undefined keys\");\n const target = keys.slice(0, -1).reduce(\n (acc, key2) => acc[key2] ?? (acc[key2] = {}),\n obj\n );\n target[key] = deepAssign(target[key], value, merge);\n }\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/dist/immer.mjs\n var NOTHING = Symbol.for(\"immer-nothing\");\n var DRAFTABLE = Symbol.for(\"immer-draftable\");\n var DRAFT_STATE = Symbol.for(\"immer-state\");\n function die(error, ...args) {\n if (false) {\n const e = errors[error];\n const msg = typeof e === \"function\" ? e.apply(null, args) : e;\n throw new Error(`[Immer] ${msg}`);\n }\n throw new Error(\n `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n );\n }\n var getPrototypeOf = Object.getPrototypeOf;\n function isDraft(value) {\n return !!value && !!value[DRAFT_STATE];\n }\n function isDraftable(value) {\n if (!value)\n return false;\n return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);\n }\n var objectCtorString = Object.prototype.constructor.toString();\n function isPlainObject(value) {\n if (!value || typeof value !== \"object\")\n return false;\n const proto = getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n const Ctor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n if (Ctor === Object)\n return true;\n return typeof Ctor == \"function\" && Function.toString.call(Ctor) === objectCtorString;\n }\n function each(obj, iter) {\n if (getArchtype(obj) === 0) {\n Reflect.ownKeys(obj).forEach((key) => {\n iter(key, obj[key], obj);\n });\n } else {\n obj.forEach((entry, index) => iter(index, entry, obj));\n }\n }\n function getArchtype(thing) {\n const state = thing[DRAFT_STATE];\n return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;\n }\n function has(thing, prop) {\n return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);\n }\n function set(thing, propOrOldValue, value) {\n const t = getArchtype(thing);\n if (t === 2)\n thing.set(propOrOldValue, value);\n else if (t === 3) {\n thing.add(value);\n } else\n thing[propOrOldValue] = value;\n }\n function is(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n }\n function isMap(target) {\n return target instanceof Map;\n }\n function isSet(target) {\n return target instanceof Set;\n }\n function latest(state) {\n return state.copy_ || state.base_;\n }\n function shallowCopy(base, strict) {\n if (isMap(base)) {\n return new Map(base);\n }\n if (isSet(base)) {\n return new Set(base);\n }\n if (Array.isArray(base))\n return Array.prototype.slice.call(base);\n const isPlain = isPlainObject(base);\n if (strict === true || strict === \"class_only\" && !isPlain) {\n const descriptors = Object.getOwnPropertyDescriptors(base);\n delete descriptors[DRAFT_STATE];\n let keys = Reflect.ownKeys(descriptors);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const desc = descriptors[key];\n if (desc.writable === false) {\n desc.writable = true;\n desc.configurable = true;\n }\n if (desc.get || desc.set)\n descriptors[key] = {\n configurable: true,\n writable: true,\n // could live with !!desc.set as well here...\n enumerable: desc.enumerable,\n value: base[key]\n };\n }\n return Object.create(getPrototypeOf(base), descriptors);\n } else {\n const proto = getPrototypeOf(base);\n if (proto !== null && isPlain) {\n return { ...base };\n }\n const obj = Object.create(proto);\n return Object.assign(obj, base);\n }\n }\n function freeze(obj, deep = false) {\n if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))\n return obj;\n if (getArchtype(obj) > 1) {\n Object.defineProperties(obj, {\n set: { value: dontMutateFrozenCollections },\n add: { value: dontMutateFrozenCollections },\n clear: { value: dontMutateFrozenCollections },\n delete: { value: dontMutateFrozenCollections }\n });\n }\n Object.freeze(obj);\n if (deep)\n Object.values(obj).forEach((value) => freeze(value, true));\n return obj;\n }\n function dontMutateFrozenCollections() {\n die(2);\n }\n function isFrozen(obj) {\n return Object.isFrozen(obj);\n }\n var plugins = {};\n function getPlugin(pluginKey) {\n const plugin = plugins[pluginKey];\n if (!plugin) {\n die(0, pluginKey);\n }\n return plugin;\n }\n var currentScope;\n function getCurrentScope() {\n return currentScope;\n }\n function createScope(parent_, immer_) {\n return {\n drafts_: [],\n parent_,\n immer_,\n // Whenever the modified draft contains a draft from another scope, we\n // need to prevent auto-freezing so the unowned draft can be finalized.\n canAutoFreeze_: true,\n unfinalizedDrafts_: 0\n };\n }\n function usePatchesInScope(scope, patchListener) {\n if (patchListener) {\n getPlugin(\"Patches\");\n scope.patches_ = [];\n scope.inversePatches_ = [];\n scope.patchListener_ = patchListener;\n }\n }\n function revokeScope(scope) {\n leaveScope(scope);\n scope.drafts_.forEach(revokeDraft);\n scope.drafts_ = null;\n }\n function leaveScope(scope) {\n if (scope === currentScope) {\n currentScope = scope.parent_;\n }\n }\n function enterScope(immer2) {\n return currentScope = createScope(currentScope, immer2);\n }\n function revokeDraft(draft) {\n const state = draft[DRAFT_STATE];\n if (state.type_ === 0 || state.type_ === 1)\n state.revoke_();\n else\n state.revoked_ = true;\n }\n function processResult(result, scope) {\n scope.unfinalizedDrafts_ = scope.drafts_.length;\n const baseDraft = scope.drafts_[0];\n const isReplaced = result !== void 0 && result !== baseDraft;\n if (isReplaced) {\n if (baseDraft[DRAFT_STATE].modified_) {\n revokeScope(scope);\n die(4);\n }\n if (isDraftable(result)) {\n result = finalize(scope, result);\n if (!scope.parent_)\n maybeFreeze(scope, result);\n }\n if (scope.patches_) {\n getPlugin(\"Patches\").generateReplacementPatches_(\n baseDraft[DRAFT_STATE].base_,\n result,\n scope.patches_,\n scope.inversePatches_\n );\n }\n } else {\n result = finalize(scope, baseDraft, []);\n }\n revokeScope(scope);\n if (scope.patches_) {\n scope.patchListener_(scope.patches_, scope.inversePatches_);\n }\n return result !== NOTHING ? result : void 0;\n }\n function finalize(rootScope, value, path) {\n if (isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n if (!state) {\n each(\n value,\n (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path)\n );\n return value;\n }\n if (state.scope_ !== rootScope)\n return value;\n if (!state.modified_) {\n maybeFreeze(rootScope, state.base_, true);\n return state.base_;\n }\n if (!state.finalized_) {\n state.finalized_ = true;\n state.scope_.unfinalizedDrafts_--;\n const result = state.copy_;\n let resultEach = result;\n let isSet2 = false;\n if (state.type_ === 3) {\n resultEach = new Set(result);\n result.clear();\n isSet2 = true;\n }\n each(\n resultEach,\n (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2)\n );\n maybeFreeze(rootScope, result, false);\n if (path && rootScope.patches_) {\n getPlugin(\"Patches\").generatePatches_(\n state,\n path,\n rootScope.patches_,\n rootScope.inversePatches_\n );\n }\n }\n return state.copy_;\n }\n function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {\n if (false)\n die(5);\n if (isDraft(childValue)) {\n const path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.\n !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;\n const res = finalize(rootScope, childValue, path);\n set(targetObject, prop, res);\n if (isDraft(res)) {\n rootScope.canAutoFreeze_ = false;\n } else\n return;\n } else if (targetIsSet) {\n targetObject.add(childValue);\n }\n if (isDraftable(childValue) && !isFrozen(childValue)) {\n if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n return;\n }\n finalize(rootScope, childValue);\n if ((!parentState || !parentState.scope_.parent_) && typeof prop !== \"symbol\" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)))\n maybeFreeze(rootScope, childValue);\n }\n }\n function maybeFreeze(scope, value, deep = false) {\n if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n freeze(value, deep);\n }\n }\n function createProxyProxy(base, parent) {\n const isArray = Array.isArray(base);\n const state = {\n type_: isArray ? 1 : 0,\n // Track which produce call this is associated with.\n scope_: parent ? parent.scope_ : getCurrentScope(),\n // True for both shallow and deep changes.\n modified_: false,\n // Used during finalization.\n finalized_: false,\n // Track which properties have been assigned (true) or deleted (false).\n assigned_: {},\n // The parent draft state.\n parent_: parent,\n // The base state.\n base_: base,\n // The base proxy.\n draft_: null,\n // set below\n // The base copy with any updated values.\n copy_: null,\n // Called by the `produce` function.\n revoke_: null,\n isManual_: false\n };\n let target = state;\n let traps = objectTraps;\n if (isArray) {\n target = [state];\n traps = arrayTraps;\n }\n const { revoke, proxy } = Proxy.revocable(target, traps);\n state.draft_ = proxy;\n state.revoke_ = revoke;\n return proxy;\n }\n var objectTraps = {\n get(state, prop) {\n if (prop === DRAFT_STATE)\n return state;\n const source = latest(state);\n if (!has(source, prop)) {\n return readPropFromProto(state, source, prop);\n }\n const value = source[prop];\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (value === peek(state.base_, prop)) {\n prepareCopy(state);\n return state.copy_[prop] = createProxy(value, state);\n }\n return value;\n },\n has(state, prop) {\n return prop in latest(state);\n },\n ownKeys(state) {\n return Reflect.ownKeys(latest(state));\n },\n set(state, prop, value) {\n const desc = getDescriptorFromProto(latest(state), prop);\n if (desc?.set) {\n desc.set.call(state.draft_, value);\n return true;\n }\n if (!state.modified_) {\n const current2 = peek(latest(state), prop);\n const currentState = current2?.[DRAFT_STATE];\n if (currentState && currentState.base_ === value) {\n state.copy_[prop] = value;\n state.assigned_[prop] = false;\n return true;\n }\n if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))\n return true;\n prepareCopy(state);\n markChanged(state);\n }\n if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'\n (value !== void 0 || prop in state.copy_) || // special case: NaN\n Number.isNaN(value) && Number.isNaN(state.copy_[prop]))\n return true;\n state.copy_[prop] = value;\n state.assigned_[prop] = true;\n return true;\n },\n deleteProperty(state, prop) {\n if (peek(state.base_, prop) !== void 0 || prop in state.base_) {\n state.assigned_[prop] = false;\n prepareCopy(state);\n markChanged(state);\n } else {\n delete state.assigned_[prop];\n }\n if (state.copy_) {\n delete state.copy_[prop];\n }\n return true;\n },\n // Note: We never coerce `desc.value` into an Immer draft, because we can't make\n // the same guarantee in ES5 mode.\n getOwnPropertyDescriptor(state, prop) {\n const owner = latest(state);\n const desc = Reflect.getOwnPropertyDescriptor(owner, prop);\n if (!desc)\n return desc;\n return {\n writable: true,\n configurable: state.type_ !== 1 || prop !== \"length\",\n enumerable: desc.enumerable,\n value: owner[prop]\n };\n },\n defineProperty() {\n die(11);\n },\n getPrototypeOf(state) {\n return getPrototypeOf(state.base_);\n },\n setPrototypeOf() {\n die(12);\n }\n };\n var arrayTraps = {};\n each(objectTraps, (key, fn) => {\n arrayTraps[key] = function() {\n arguments[0] = arguments[0][0];\n return fn.apply(this, arguments);\n };\n });\n arrayTraps.deleteProperty = function(state, prop) {\n if (false)\n die(13);\n return arrayTraps.set.call(this, state, prop, void 0);\n };\n arrayTraps.set = function(state, prop, value) {\n if (false)\n die(14);\n return objectTraps.set.call(this, state[0], prop, value, state[0]);\n };\n function peek(draft, prop) {\n const state = draft[DRAFT_STATE];\n const source = state ? latest(state) : draft;\n return source[prop];\n }\n function readPropFromProto(state, source, prop) {\n const desc = getDescriptorFromProto(source, prop);\n return desc ? `value` in desc ? desc.value : (\n // This is a very special case, if the prop is a getter defined by the\n // prototype, we should invoke it with the draft as context!\n desc.get?.call(state.draft_)\n ) : void 0;\n }\n function getDescriptorFromProto(source, prop) {\n if (!(prop in source))\n return void 0;\n let proto = getPrototypeOf(source);\n while (proto) {\n const desc = Object.getOwnPropertyDescriptor(proto, prop);\n if (desc)\n return desc;\n proto = getPrototypeOf(proto);\n }\n return void 0;\n }\n function markChanged(state) {\n if (!state.modified_) {\n state.modified_ = true;\n if (state.parent_) {\n markChanged(state.parent_);\n }\n }\n }\n function prepareCopy(state) {\n if (!state.copy_) {\n state.copy_ = shallowCopy(\n state.base_,\n state.scope_.immer_.useStrictShallowCopy_\n );\n }\n }\n var Immer2 = class {\n constructor(config) {\n this.autoFreeze_ = true;\n this.useStrictShallowCopy_ = false;\n this.produce = (base, recipe, patchListener) => {\n if (typeof base === \"function\" && typeof recipe !== \"function\") {\n const defaultBase = recipe;\n recipe = base;\n const self = this;\n return function curriedProduce(base2 = defaultBase, ...args) {\n return self.produce(base2, (draft) => recipe.call(this, draft, ...args));\n };\n }\n if (typeof recipe !== \"function\")\n die(6);\n if (patchListener !== void 0 && typeof patchListener !== \"function\")\n die(7);\n let result;\n if (isDraftable(base)) {\n const scope = enterScope(this);\n const proxy = createProxy(base, void 0);\n let hasError = true;\n try {\n result = recipe(proxy);\n hasError = false;\n } finally {\n if (hasError)\n revokeScope(scope);\n else\n leaveScope(scope);\n }\n usePatchesInScope(scope, patchListener);\n return processResult(result, scope);\n } else if (!base || typeof base !== \"object\") {\n result = recipe(base);\n if (result === void 0)\n result = base;\n if (result === NOTHING)\n result = void 0;\n if (this.autoFreeze_)\n freeze(result, true);\n if (patchListener) {\n const p = [];\n const ip = [];\n getPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip);\n patchListener(p, ip);\n }\n return result;\n } else\n die(1, base);\n };\n this.produceWithPatches = (base, recipe) => {\n if (typeof base === \"function\") {\n return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));\n }\n let patches, inversePatches;\n const result = this.produce(base, recipe, (p, ip) => {\n patches = p;\n inversePatches = ip;\n });\n return [result, patches, inversePatches];\n };\n if (typeof config?.autoFreeze === \"boolean\")\n this.setAutoFreeze(config.autoFreeze);\n if (typeof config?.useStrictShallowCopy === \"boolean\")\n this.setUseStrictShallowCopy(config.useStrictShallowCopy);\n }\n createDraft(base) {\n if (!isDraftable(base))\n die(8);\n if (isDraft(base))\n base = current(base);\n const scope = enterScope(this);\n const proxy = createProxy(base, void 0);\n proxy[DRAFT_STATE].isManual_ = true;\n leaveScope(scope);\n return proxy;\n }\n finishDraft(draft, patchListener) {\n const state = draft && draft[DRAFT_STATE];\n if (!state || !state.isManual_)\n die(9);\n const { scope_: scope } = state;\n usePatchesInScope(scope, patchListener);\n return processResult(void 0, scope);\n }\n /**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * By default, auto-freezing is enabled.\n */\n setAutoFreeze(value) {\n this.autoFreeze_ = value;\n }\n /**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\n setUseStrictShallowCopy(value) {\n this.useStrictShallowCopy_ = value;\n }\n applyPatches(base, patches) {\n let i;\n for (i = patches.length - 1; i >= 0; i--) {\n const patch = patches[i];\n if (patch.path.length === 0 && patch.op === \"replace\") {\n base = patch.value;\n break;\n }\n }\n if (i > -1) {\n patches = patches.slice(i + 1);\n }\n const applyPatchesImpl = getPlugin(\"Patches\").applyPatches_;\n if (isDraft(base)) {\n return applyPatchesImpl(base, patches);\n }\n return this.produce(\n base,\n (draft) => applyPatchesImpl(draft, patches)\n );\n }\n };\n function createProxy(value, parent) {\n const draft = isMap(value) ? getPlugin(\"MapSet\").proxyMap_(value, parent) : isSet(value) ? getPlugin(\"MapSet\").proxySet_(value, parent) : createProxyProxy(value, parent);\n const scope = parent ? parent.scope_ : getCurrentScope();\n scope.drafts_.push(draft);\n return draft;\n }\n function current(value) {\n if (!isDraft(value))\n die(10, value);\n return currentImpl(value);\n }\n function currentImpl(value) {\n if (!isDraftable(value) || isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n let copy;\n if (state) {\n if (!state.modified_)\n return state.base_;\n state.finalized_ = true;\n copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);\n } else {\n copy = shallowCopy(value, true);\n }\n each(copy, (key, childValue) => {\n set(copy, key, currentImpl(childValue));\n });\n if (state) {\n state.finalized_ = false;\n }\n return copy;\n }\n var immer = new Immer2();\n var produce = immer.produce;\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dequal@2.0.3/node_modules/dequal/dist/index.mjs\n var has2 = Object.prototype.hasOwnProperty;\n function find(iter, tar, key) {\n for (key of iter.keys()) {\n if (dequal(key, tar)) return key;\n }\n }\n function dequal(foo, bar) {\n var ctor, len, tmp;\n if (foo === bar) return true;\n if (foo && bar && (ctor = foo.constructor) === bar.constructor) {\n if (ctor === Date) return foo.getTime() === bar.getTime();\n if (ctor === RegExp) return foo.toString() === bar.toString();\n if (ctor === Array) {\n if ((len = foo.length) === bar.length) {\n while (len-- && dequal(foo[len], bar[len])) ;\n }\n return len === -1;\n }\n if (ctor === Set) {\n if (foo.size !== bar.size) {\n return false;\n }\n for (len of foo) {\n tmp = len;\n if (tmp && typeof tmp === \"object\") {\n tmp = find(bar, tmp);\n if (!tmp) return false;\n }\n if (!bar.has(tmp)) return false;\n }\n return true;\n }\n if (ctor === Map) {\n if (foo.size !== bar.size) {\n return false;\n }\n for (len of foo) {\n tmp = len[0];\n if (tmp && typeof tmp === \"object\") {\n tmp = find(bar, tmp);\n if (!tmp) return false;\n }\n if (!dequal(len[1], bar.get(tmp))) {\n return false;\n }\n }\n return true;\n }\n if (ctor === ArrayBuffer) {\n foo = new Uint8Array(foo);\n bar = new Uint8Array(bar);\n } else if (ctor === DataView) {\n if ((len = foo.byteLength) === bar.byteLength) {\n while (len-- && foo.getInt8(len) === bar.getInt8(len)) ;\n }\n return len === -1;\n }\n if (ArrayBuffer.isView(foo)) {\n if ((len = foo.byteLength) === bar.byteLength) {\n while (len-- && foo[len] === bar[len]) ;\n }\n return len === -1;\n }\n if (!ctor || typeof foo === \"object\") {\n len = 0;\n for (ctor in foo) {\n if (has2.call(foo, ctor) && ++len && !has2.call(bar, ctor)) return false;\n if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n }\n return Object.keys(bar).length === len;\n }\n }\n return foo !== foo && bar !== bar;\n }\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+plugin@0.0.0/node_modules/@player-devtools/plugin/dist/index.mjs\n var containsInteraction = (interactions, interaction) => {\n return interactions.filter((i) => dequal(i, interaction)).length > 0;\n };\n var reducer = (state, transaction) => {\n switch (transaction.type) {\n case \"PLAYER_DEVTOOLS_PLAYER_INIT\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n dsetAssign(draft, [\"plugins\"], payload.plugins);\n const message = {\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload\n };\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLAYER_STOPPED\":\n return produce(state, (draft) => {\n const message = {\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: transaction.payload\n };\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n if (!payload.data) return state;\n try {\n dsetAssign(\n draft,\n [\"plugins\", transaction.payload.pluginID, \"flow\", \"data\"],\n transaction.payload.data\n );\n } catch {\n console.error(\"error setting data:\", transaction.payload.data);\n }\n const message = {\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload\n };\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_INTERACTION\":\n return produce(state, (draft) => {\n if (containsInteraction(draft.interactions, transaction)) return state;\n dsetAssign(\n draft,\n [\"interactions\"],\n [...draft.interactions, transaction]\n );\n });\n case \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\": {\n const { playerID } = transaction.payload;\n if (!playerID) return state;\n return produce(state, (draft) => {\n dsetAssign(draft, [\"currentPlayer\"], playerID);\n });\n }\n default:\n return state;\n }\n };\n var INTERACTIONS2 = {\n PLAYER_SELECTED: \"player-selected\"\n };\n var PLUGIN_INACTIVE_WARNING = \"The plugin has been registered, but the Player development tools are not active. If you are working in a production environment, it is recommended to remove the plugin. To activate, enable through the browser extension popup for web or configure the FlipperClient for mobile.\";\n var getNowTime = globalThis.performance ? () => globalThis.performance.now() : () => Date.now();\n function generateUUID() {\n let d = (/* @__PURE__ */ new Date()).getTime();\n let d2 = getNowTime() * 1e3;\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function(c) {\n let r = Math.random() * 16;\n if (d > 0) {\n r = (d + r) % 16 | 0;\n d = Math.floor(d / 16);\n } else {\n r = (d2 + r) % 16 | 0;\n d2 = Math.floor(d2 / 16);\n }\n return (c === \"x\" ? r : r & 3 | 8).toString(16);\n });\n }\n var NOOP_ID = -1;\n var genDataChangeTransaction = ({\n playerID,\n data,\n pluginID\n }) => {\n return {\n id: NOOP_ID,\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload: {\n pluginID,\n data\n },\n sender: playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true\n };\n };\n var INITIAL_STATE = {\n messages: [],\n plugins: {},\n interactions: [],\n currentPlayer: \"\"\n };\n var DevtoolsPlugin = class {\n constructor(options) {\n this.options = options;\n this.name = \"DevtoolsPlugin\";\n this.loggedWarning = false;\n this.announced = false;\n this.store = useStateReducer(reducer, INITIAL_STATE);\n this.lastProcessedInteraction = 0;\n this.store.subscribe(({ interactions }) => {\n const start = this.lastProcessedInteraction;\n const end = interactions.length ?? 0;\n if (start < end) {\n this.lastProcessedInteraction = end;\n interactions.slice(start, end).forEach(this.processInteraction.bind(this));\n }\n });\n }\n get pluginID() {\n return this.options.pluginData.id;\n }\n get playerID() {\n return this.options.playerID;\n }\n registerMessenger(messenger) {\n let lastMessageIndex = -1;\n return this.store.subscribe(({ messages }) => {\n const start = lastMessageIndex + 1;\n if (messages.length > start) {\n const newlyAdded = messages.slice(start);\n lastMessageIndex = messages.length - 1;\n for (const msg of newlyAdded) {\n messenger.sendMessage(msg);\n }\n }\n });\n }\n dispatchPlayerInit() {\n const transaction = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload: {\n plugins: {\n [this.pluginID]: this.options.pluginData\n }\n },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true\n };\n this.store.dispatch(transaction);\n this.announced = true;\n }\n dispatchPlayerStopped() {\n const transaction = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: { pluginID: this.pluginID },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true\n };\n this.store.dispatch(transaction);\n }\n // By default, we'll only write to the keys defined in data -- if undefined, data will be cleared\n dispatchDataUpdate(data) {\n const state = this.store.getState();\n const { plugins: plugins2 } = produce(this.store.getState(), (draft) => {\n if (!data)\n dsetAssign(draft, [\"plugins\", this.pluginID, \"flow\", \"data\"], data);\n else\n Object.entries(data).forEach(([key, value]) => {\n dsetAssign(\n draft,\n [\"plugins\", this.pluginID, \"flow\", \"data\", key],\n value\n );\n });\n });\n const newData = plugins2[this.pluginID].flow.data;\n if (dequal(state.plugins[this.pluginID]?.flow?.data, newData)) return;\n const transaction = genDataChangeTransaction({\n playerID: this.playerID,\n pluginID: this.pluginID,\n data: newData\n });\n this.store.dispatch(transaction);\n }\n checkIfDevtoolsIsActive() {\n const isActive = this.options.handler.checkIfDevtoolsIsActive();\n if (!isActive && !this.loggedWarning) {\n this.options.handler.log?.(PLUGIN_INACTIVE_WARNING);\n this.loggedWarning = true;\n }\n return isActive;\n }\n processInteraction(interaction) {\n this.options.handler.processInteraction(interaction);\n const {\n payload: { type, payload }\n } = interaction;\n if (type === INTERACTIONS2.PLAYER_SELECTED && payload) {\n this.store.dispatch({\n id: -1,\n type: \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\",\n payload: { playerID: payload },\n sender: this.playerID,\n context: \"player\",\n target: this.playerID,\n timestamp: Date.now(),\n _messenger_: true\n });\n }\n }\n apply(player) {\n if (!this.checkIfDevtoolsIsActive()) return;\n this.dispatchPlayerInit();\n }\n /**\n * Tell devtools this plugin is gone. Call it before the messenger is destroyed.\n * Safe to call more than once.\n */\n teardown() {\n if (!this.announced) return;\n this.announced = false;\n this.dispatchPlayerStopped();\n }\n };\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/dist/hooks.mjs\n function equalToOrIn(value, check) {\n if (Array.isArray(check)) {\n return check.includes(value);\n }\n return check === value;\n }\n function callTap(tap, args, ctx) {\n if (tap.context) {\n return tap.callback(ctx, ...args);\n }\n return tap.callback(...args);\n }\n var InterceptionManager = class {\n constructor() {\n this.interceptions = [];\n this.interceptionKeySet = /* @__PURE__ */ new Set();\n }\n isUsed() {\n return this.interceptions.length > 0;\n }\n intercept(int) {\n this.interceptions.push(int);\n Object.keys(int).forEach((s) => {\n this.interceptionKeySet.add(s);\n });\n }\n tap(tap) {\n if (this.interceptionKeySet.has(\"tap\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.tap) == null ? void 0 : _a.call(i, tap);\n });\n }\n }\n call(ctx, ...args) {\n if (this.interceptionKeySet.has(\"call\")) {\n this.interceptions.forEach((i) => {\n var _a, _b;\n if (i.context) {\n (_a = i.call) == null ? void 0 : _a.call(i, ctx, ...args);\n } else {\n (_b = i.call) == null ? void 0 : _b.call(i, ...args);\n }\n });\n }\n }\n loop(...args) {\n if (this.interceptionKeySet.has(\"loop\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.loop) == null ? void 0 : _a.call(i, ...args);\n });\n }\n }\n error(err) {\n if (this.interceptionKeySet.has(\"error\")) {\n if (err instanceof Error) {\n const asError = err;\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.error) == null ? void 0 : _a.call(i, asError);\n });\n }\n }\n }\n result(r) {\n if (this.interceptionKeySet.has(\"result\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.result) == null ? void 0 : _a.call(i, r);\n });\n }\n }\n done() {\n if (this.interceptionKeySet.has(\"done\")) {\n this.interceptions.forEach((i) => {\n var _a;\n (_a = i.done) == null ? void 0 : _a.call(i);\n });\n }\n }\n };\n var Hook = class {\n constructor() {\n this.taps = [];\n this.interceptions = new InterceptionManager();\n }\n tap(options, callback) {\n const resolvedOptions = typeof options === \"string\" ? {\n name: options,\n context: false\n } : {\n context: false,\n ...options\n };\n const key = Symbol(resolvedOptions.name);\n const tap = {\n key,\n ...resolvedOptions,\n callback\n };\n if (tap.before) {\n let insertionIndex = this.taps.length;\n const beforeSet = new Set(Array.isArray(tap.before) ? tap.before : [tap.before]);\n for (insertionIndex; insertionIndex > 0 && beforeSet.size > 0; insertionIndex--) {\n const t = this.taps[insertionIndex - 1];\n if (beforeSet.has(t.name)) {\n beforeSet.delete(t.name);\n }\n if (t.before && equalToOrIn(tap.name, t.before)) {\n break;\n }\n }\n this.taps.splice(insertionIndex, 0, tap);\n } else {\n this.taps.push(tap);\n }\n this.interceptions.tap(tap);\n return tap;\n }\n untap(tap) {\n this.taps = this.taps.filter((t) => t.key !== tap.key);\n }\n isUsed() {\n return this.taps.length > 0 || this.interceptions.isUsed();\n }\n intercept(int) {\n this.interceptions.intercept(int);\n }\n };\n var SyncHook = class extends Hook {\n call(...args) {\n if (!this.isUsed()) {\n return;\n }\n const ctx = {};\n this.interceptions.call(ctx, ...args);\n try {\n this.taps.forEach((t) => {\n callTap(t, args, ctx);\n });\n } catch (err) {\n this.interceptions.error(err);\n throw err;\n }\n this.interceptions.done();\n }\n };\n var SyncWaterfallHook = class extends Hook {\n call(...args) {\n const ctx = {};\n this.interceptions.call(ctx, ...args);\n let [rtn, ...rest] = args;\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = callTap(this.taps[tapIndex], [rtn, ...rest], ctx);\n if (tapValue !== void 0) {\n rtn = tapValue;\n }\n }\n this.interceptions.result(rtn);\n return rtn;\n }\n };\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+context-plugin@1.3.0_at_player-ui_player_1.3.0/node_modules/@player-ui/context-plugin/dist/index.mjs\n var KEY_NAMESPACE = \"player-ui.context.\";\n var defineContextKey = (name, description) => ({\n symbol: Symbol.for(`${KEY_NAMESPACE}${name}`),\n description\n });\n var nameOfContextKey = (key) => {\n const k = Symbol.keyFor(key.symbol);\n if (!k || !k.startsWith(KEY_NAMESPACE))\n return void 0;\n return k.slice(KEY_NAMESPACE.length);\n };\n var deepFreezeEntry = (entry) => {\n Object.freeze(entry);\n return entry;\n };\n var tombstone = (description) => () => {\n throw new Error(\n `[ContextPlugin] Action \"${description}\" is no longer valid \\u2014 its flow has ended`\n );\n };\n var tombstoneFunctions = (value, description) => {\n if (typeof value === \"function\") {\n return tombstone(description);\n }\n if (Array.isArray(value)) {\n return value.map((item) => tombstoneFunctions(item, description));\n }\n if (value !== null && typeof value === \"object\") {\n const out = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = tombstoneFunctions(v, description);\n }\n return out;\n }\n return value;\n };\n var ContextStore = class {\n constructor() {\n this.entries = /* @__PURE__ */ new Map();\n this.dependents = /* @__PURE__ */ new Map();\n }\n register(key) {\n if (this.entries.has(key.symbol)) {\n return false;\n }\n this.entries.set(key.symbol, { key, hasLiteral: false });\n return true;\n }\n set(key, value) {\n const existing = this.entries.get(key.symbol);\n if (existing) {\n existing.hasLiteral = true;\n existing.literal = value;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: true,\n literal: value\n });\n }\n }\n registerTransform(key, transform) {\n const existing = this.entries.get(key.symbol);\n const previousSources = existing?.transform?.sources;\n if (previousSources) {\n for (const src of previousSources) {\n this.dependents.get(src.symbol)?.delete(key.symbol);\n }\n }\n const stored = {\n sources: transform.sources,\n compute: transform.compute\n };\n if (existing) {\n existing.transform = stored;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: false,\n transform: stored\n });\n }\n for (const src of transform.sources) {\n let set2 = this.dependents.get(src.symbol);\n if (!set2) {\n set2 = /* @__PURE__ */ new Set();\n this.dependents.set(src.symbol, set2);\n }\n set2.add(key.symbol);\n }\n return { previousSources };\n }\n get(key) {\n return this.compute(key.symbol);\n }\n has(key) {\n const entry = this.entries.get(key.symbol);\n return Boolean(entry && (entry.hasLiteral || entry.transform));\n }\n /** Return the keys that depend on the given source key (direct dependents only). */\n dependentsOf(sourceSymbol) {\n const set2 = this.dependents.get(sourceSymbol);\n if (!set2 || set2.size === 0) {\n return [];\n }\n const out = [];\n for (const targetSymbol of set2) {\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n }\n return out;\n }\n /**\n * Return every key transitively downstream of [sourceSymbol] — direct\n * dependents, their dependents, and so on. Ordered breadth-first so nearer\n * dependents come first, deduped so a key reachable by several paths (a\n * diamond) appears once, and cycle-safe.\n *\n * The source itself is never included — `set()` notifies it directly, so\n * re-emitting it here would double-notify subscribers on a cyclic graph.\n */\n transitiveDependentsOf(sourceSymbol) {\n const visited = /* @__PURE__ */ new Set([sourceSymbol]);\n const out = [];\n const queue = [sourceSymbol];\n while (queue.length > 0) {\n const current2 = queue.shift();\n const set2 = this.dependents.get(current2);\n if (!set2)\n continue;\n for (const targetSymbol of set2) {\n if (visited.has(targetSymbol))\n continue;\n visited.add(targetSymbol);\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n queue.push(targetSymbol);\n }\n }\n return out;\n }\n list() {\n const out = [];\n for (const entry of this.entries.values()) {\n out.push({\n symbol: entry.key.symbol,\n description: entry.key.description,\n hasValue: entry.hasLiteral,\n hasTransform: Boolean(entry.transform)\n });\n }\n return out;\n }\n freeze(meta) {\n const frozenEntries = [];\n for (const entry of this.entries.values()) {\n if (!entry.hasLiteral && !entry.transform) {\n continue;\n }\n const computed = this.compute(entry.key.symbol);\n const value = tombstoneFunctions(computed, entry.key.description);\n frozenEntries.push(\n deepFreezeEntry({\n symbol: entry.key.symbol,\n name: nameOfContextKey(entry.key),\n description: entry.key.description,\n value\n })\n );\n }\n const bySymbol = new Map(frozenEntries.map((e) => [e.symbol, e.value]));\n const snapshot = {\n flowId: meta.flowId,\n endedAt: meta.endedAt,\n entries: Object.freeze(frozenEntries),\n get(key) {\n return bySymbol.get(key.symbol);\n }\n };\n return Object.freeze(snapshot);\n }\n compute(sym) {\n const entry = this.entries.get(sym);\n if (!entry)\n return void 0;\n if (entry.hasLiteral)\n return entry.literal;\n if (!entry.transform)\n return void 0;\n const reader = (otherKey) => this.compute(otherKey.symbol);\n return entry.transform.compute(reader);\n }\n };\n var ContextHistory = class {\n constructor() {\n this.stack = [];\n }\n push(snapshot) {\n this.stack.push(snapshot);\n }\n entries() {\n return this.stack;\n }\n size() {\n return this.stack.length;\n }\n clear() {\n this.stack = [];\n }\n };\n var ContextPluginSymbol = Symbol.for(\"ContextPlugin\");\n var subscriptionCounter = 0;\n var _ContextPlugin = class _ContextPlugin2 {\n constructor() {\n this.name = \"context\";\n this.symbol = _ContextPlugin2.Symbol;\n this.hooks = {\n onSet: new SyncHook(),\n resolveValue: new SyncWaterfallHook(),\n onRegister: new SyncHook(),\n onFlowFrozen: new SyncHook()\n };\n this.transforms = /* @__PURE__ */ new Map();\n this.perKeySubs = /* @__PURE__ */ new Map();\n this.globalSubs = /* @__PURE__ */ new Map();\n this.tokenIndex = /* @__PURE__ */ new Map();\n this.lastNotified = /* @__PURE__ */ new Map();\n this.store = new ContextStore();\n this.historyStack = new ContextHistory();\n }\n apply(player) {\n const existing = player.findPlugin(ContextPluginSymbol);\n if (existing !== void 0 && existing !== this) {\n this.store = existing.store;\n this.historyStack = existing.historyStack;\n this.transforms = existing.transforms;\n this.perKeySubs = existing.perKeySubs;\n this.globalSubs = existing.globalSubs;\n this.tokenIndex = existing.tokenIndex;\n this.lastNotified = existing.lastNotified;\n return;\n }\n player.hooks.onStart.tap(this.name, (flow) => {\n this.currentFlowId = flow?.id;\n });\n player.hooks.onEnd.tap(this.name, () => {\n const snapshot = this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now()\n });\n this.historyStack.push(snapshot);\n this.hooks.onFlowFrozen.call(snapshot);\n this.rotateStore();\n this.currentFlowId = void 0;\n });\n }\n register(key) {\n const added = this.store.register(key);\n if (added) {\n this.hooks.onRegister.call(key);\n }\n }\n set(key, value) {\n const isFirstSighting = !this.store.has(key);\n this.store.set(key, value);\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n this.notifyIfChanged(key, value);\n }\n get(key) {\n const raw = this.store.get(key);\n const resolved = this.hooks.resolveValue.call(raw, key);\n return resolved;\n }\n has(key) {\n return this.store.has(key);\n }\n registerTransform(key, transform) {\n const isFirstSighting = !this.store.has(key);\n this.store.registerTransform(key, transform);\n this.transforms.set(key.symbol, {\n key,\n transform: {\n sources: transform.sources,\n compute: transform.compute\n }\n });\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n }\n subscribe(key, handler) {\n const token = this.nextToken();\n let bucket = this.perKeySubs.get(key.symbol);\n if (!bucket) {\n bucket = /* @__PURE__ */ new Map();\n this.perKeySubs.set(key.symbol, bucket);\n }\n bucket.set(token, handler);\n this.tokenIndex.set(token, key.symbol);\n return token;\n }\n subscribeAll(handler) {\n const token = this.nextToken();\n this.globalSubs.set(token, handler);\n this.tokenIndex.set(token, void 0);\n return token;\n }\n unsubscribe(token) {\n const owner = this.tokenIndex.get(token);\n if (owner === void 0) {\n this.globalSubs.delete(token);\n } else {\n this.perKeySubs.get(owner)?.delete(token);\n }\n this.tokenIndex.delete(token);\n }\n list() {\n return this.store.list();\n }\n history() {\n return this.historyStack.entries();\n }\n snapshot() {\n return this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now()\n });\n }\n /**\n * Bridge-friendly: set a value by string name. Used by native wrappers that\n * cannot construct a `ContextKey` object directly.\n */\n setByName(name, description, value) {\n this.set(this.ensureNamedKey(name, description), value);\n }\n /** Bridge-friendly: get a value by string name. */\n getByName(name) {\n return this.get(this.ensureNamedKey(name));\n }\n /** Bridge-friendly: check presence by string name. */\n hasByName(name) {\n return this.has(this.ensureNamedKey(name));\n }\n /** Bridge-friendly: subscribe by string name. */\n subscribeByName(name, description, handler) {\n return this.subscribe(\n this.ensureNamedKey(name, description),\n (value) => handler(value, name)\n );\n }\n /**\n * Bridge-friendly: subscribe to all updates. The handler receives the\n * key's resolved name (or undefined for non-namespaced keys).\n */\n subscribeAllByName(handler) {\n return this.subscribeAll(\n (value, key) => handler(value, nameOfContextKey(key), key.description)\n );\n }\n ensureNamedKey(name, description) {\n return defineContextKey(name, description ?? name);\n }\n /**\n * Notify subscribers of `key` with `value`, unless it's `Object.is`-equal\n * to the value the last notification for this key carried. Then cascade to\n * every transitive dependent (a chained transform root -> mid -> top must\n * notify `top` when `root` changes, not just the directly-dependent `mid`),\n * applying the same unchanged-value guard to each. `transitiveDependentsOf`\n * already flattens the full downstream closure in one deduped, cycle-safe\n * pass, so this walks it directly rather than recursing back through this\n * method (which would re-walk the graph from each dependent and, on a\n * diamond, notify a shared descendant more than once).\n */\n notifyIfChanged(key, value) {\n this.publishIfChanged(key, value);\n for (const dep of this.store.transitiveDependentsOf(key.symbol)) {\n this.publishIfChanged(dep, this.store.get(dep));\n }\n }\n publishIfChanged(key, value) {\n const hasNotified = this.lastNotified.has(key.symbol);\n const unchanged = hasNotified && Object.is(this.lastNotified.get(key.symbol), value);\n this.lastNotified.set(key.symbol, value);\n if (!unchanged) {\n this.notify(key, value);\n }\n }\n notify(key, value) {\n this.hooks.onSet.call(key, value);\n const bucket = this.perKeySubs.get(key.symbol);\n if (bucket) {\n for (const handler of bucket.values()) {\n handler(value, key);\n }\n }\n for (const handler of this.globalSubs.values()) {\n handler(value, key);\n }\n }\n rotateStore() {\n this.store = new ContextStore();\n this.lastNotified.clear();\n for (const { key, transform } of this.transforms.values()) {\n this.store.registerTransform(key, transform);\n }\n }\n nextToken() {\n subscriptionCounter += 1;\n return `ctx_${subscriptionCounter}`;\n }\n };\n _ContextPlugin.Symbol = ContextPluginSymbol;\n var ContextPlugin = _ContextPlugin;\n function getContextPlugin(player) {\n const existing = player.findPlugin(ContextPluginSymbol);\n const plugin = existing ?? new ContextPlugin();\n if (!existing) {\n player.registerPlugin(plugin);\n }\n return plugin;\n }\n var flowIdContextKey = defineContextKey(\n \"player.flow.id\",\n \"Identifier of the running flow\"\n );\n var flowStateContextKey = defineContextKey(\n \"player.flow.state\",\n \"Name of the current FSM state in the running flow\"\n );\n var viewIdContextKey = defineContextKey(\n \"player.view.id\",\n \"Identifier of the currently-resolved view\"\n );\n var viewContextKey = defineContextKey(\n \"player.view\",\n \"Full resolved view object for the current FSM state\"\n );\n var dataContextKey = defineContextKey(\n \"player.data\",\n \"Full data model tree for the running flow\"\n );\n var playerStatusContextKey = defineContextKey(\n \"player.status\",\n \"Player flow status: not-started, in-progress, completed, or error\"\n );\n var validationContextKey = defineContextKey(\n \"player.validation\",\n \"Validation state for the running view, keyed by binding\"\n );\n var setDataActionKey = defineContextKey(\n \"player.data.set\",\n \"Set a value in the Player data model at the given binding\"\n );\n var transitionActionKey = defineContextKey(\n \"player.flow.transition\",\n \"Transition the current flow using the given transition value\"\n );\n var playerStateContextKey = defineContextKey(\n \"player.state\",\n \"Aggregated snapshot of every Player runtime context entry\"\n );\n var StateContextPlugin = class {\n constructor() {\n this.name = \"state-context\";\n }\n apply(player) {\n const ctx = getContextPlugin(player);\n let validationController;\n const publishValidation = () => {\n if (!validationController)\n return;\n const byBinding = {};\n let canTransition = true;\n validationController.getBindings().forEach((binding) => {\n const all = validationController.getValidationForBinding(binding)?.getAll() ?? [];\n if (all.length === 0)\n return;\n byBinding[binding.asString()] = all.map((v) => ({\n severity: v.severity,\n message: v.message,\n displayTarget: v.displayTarget,\n blocking: v.blocking\n }));\n if (all.some((v) => v.blocking)) {\n canTransition = false;\n }\n });\n ctx.set(validationContextKey, { canTransition, byBinding });\n };\n ctx.register(flowIdContextKey);\n ctx.register(flowStateContextKey);\n ctx.register(viewIdContextKey);\n ctx.register(viewContextKey);\n ctx.register(dataContextKey);\n ctx.register(playerStatusContextKey);\n ctx.register(validationContextKey);\n ctx.register(setDataActionKey);\n ctx.register(transitionActionKey);\n ctx.set(playerStatusContextKey, player.getState().status);\n ctx.registerTransform(playerStateContextKey, {\n sources: [\n flowIdContextKey,\n flowStateContextKey,\n viewIdContextKey,\n viewContextKey,\n dataContextKey,\n playerStatusContextKey,\n validationContextKey,\n setDataActionKey,\n transitionActionKey\n ],\n compute: (read) => {\n const flowId = read(flowIdContextKey);\n const flowState = read(flowStateContextKey);\n const transition = read(transitionActionKey);\n const viewId = read(viewIdContextKey);\n const viewResolved = read(viewContextKey);\n const dataModel = read(dataContextKey);\n const setData = read(setDataActionKey);\n return {\n // Always present — seeded eagerly above and kept live by the\n // `player.hooks.state` tap below.\n status: read(playerStatusContextKey) ?? \"not-started\",\n flow: flowId !== void 0 || flowState !== void 0 || transition !== void 0 ? { id: flowId, state: flowState, transition } : void 0,\n view: viewId !== void 0 || viewResolved !== void 0 ? { id: viewId, resolved: viewResolved } : void 0,\n data: dataModel !== void 0 || setData !== void 0 ? { model: dataModel, set: setData } : void 0,\n validation: read(validationContextKey)\n };\n }\n });\n player.hooks.onStart.tap(this.name, (flow) => {\n if (flow?.id) {\n ctx.set(flowIdContextKey, flow.id);\n }\n });\n player.hooks.state.tap(this.name, (state) => {\n ctx.set(playerStatusContextKey, state.status);\n });\n player.hooks.flowController.tap(this.name, (flowController) => {\n const transition = (value) => flowController.transition(value);\n ctx.set(transitionActionKey, transition);\n flowController.hooks.flow.tap(this.name, (flowInstance) => {\n const recordState = () => {\n const name = flowInstance.currentState?.name;\n if (name) {\n ctx.set(flowStateContextKey, name);\n }\n };\n recordState();\n flowInstance.hooks.afterTransition.tap(this.name, recordState);\n });\n });\n player.hooks.validationController.tap(this.name, (vc) => {\n validationController = vc;\n publishValidation();\n });\n player.hooks.viewController.tap(this.name, (viewController) => {\n viewController.hooks.view.tap(this.name, (view) => {\n const id = view.initialView?.id;\n if (id) {\n ctx.set(viewIdContextKey, id);\n }\n view.hooks.onUpdate.tap(this.name, (resolved) => {\n ctx.set(viewContextKey, resolved);\n if (resolved?.id) {\n ctx.set(viewIdContextKey, resolved.id);\n }\n publishValidation();\n });\n });\n });\n player.hooks.dataController.tap(this.name, (dataController) => {\n const setData = (binding, value) => {\n dataController.set([[binding, value]]);\n };\n ctx.set(setDataActionKey, setData);\n const publish = () => {\n ctx.set(dataContextKey, dataController.serialize());\n publishValidation();\n };\n dataController.hooks.onUpdate.tap(this.name, publish);\n publish();\n });\n }\n };\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/context.ts\n var playerConfigContextKey = defineContextKey(\n \"devtools.player.config\",\n \"Player version and the names of its registered plugins\"\n );\n\n // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/basic/core/src/plugin.ts\n var BasicDevtoolsPlugin = class extends DevtoolsPlugin {\n constructor(options) {\n super({\n ...options,\n pluginData: BasicPluginData\n });\n this.name = \"BasicDevtoolsPlugin\";\n this.data = {};\n this.playerConfig = {};\n this.logs = [];\n /** Subscriptions are tied to the context plugin they were made on, which differs per Player */\n this.subscriptions = [];\n }\n apply(player) {\n this.logger = new WeakRef(player.logger);\n if (!this.checkIfDevtoolsIsActive()) return;\n super.apply(player);\n const context = getContextPlugin(player);\n if (!player.getPlugins().some((p) => p.name === \"state-context\")) {\n player.registerPlugin(new StateContextPlugin());\n }\n this.subscriptions.forEach(\n ({ context: previous, token }) => previous.unsubscribe(token)\n );\n this.subscriptions = [\n {\n context,\n token: context.subscribe(playerConfigContextKey, (playerConfig) => {\n if (!playerConfig) return;\n this.playerConfig = { ...playerConfig };\n this.dispatchDataUpdate({ playerConfig: this.playerConfig });\n })\n },\n {\n context,\n token: context.subscribe(dataContextKey, (model) => {\n this.data = {\n data: model === void 0 ? model : JSON.parse(JSON.stringify(model))\n };\n this.dispatchDataUpdate({ data: this.data });\n })\n }\n ];\n const publishConfig = () => context.set(playerConfigContextKey, {\n version: player.getVersion(),\n plugins: player.getPlugins().map((plugin) => plugin.name)\n });\n publishConfig();\n player.logger.hooks.log.tap(this.name, (severity, message) => {\n this.logs = [...this.logs, { severity, message }];\n this.dispatchDataUpdate({ logs: this.logs });\n });\n player.hooks.onStart.tap(this.name, (f) => {\n this.flow = JSON.parse(JSON.stringify(f));\n this.dispatchDataUpdate({ flow: this.flow });\n });\n player.hooks.onStart.tap(this.name, publishConfig);\n player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {\n this.expressionEvaluator = new WeakRef(evaluator);\n });\n this.overrideFlow = player.start.bind(player);\n }\n evaluateExpression(expression) {\n const evaluator = this.expressionEvaluator?.deref();\n if (!evaluator) {\n return {\n id: generateUUID(),\n severity: \"error\",\n result: \"Expression evaluator not available\",\n expression\n };\n }\n try {\n evaluator.hooks.onError.intercept({\n call: (error) => {\n throw error;\n }\n });\n const evaluatorResult = evaluator.evaluate(expression);\n return {\n id: generateUUID(),\n result: evaluatorResult,\n expression\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error ?? \"Something went wrong\");\n return {\n id: generateUUID(),\n severity: \"error\",\n result: message,\n expression\n };\n }\n }\n processInteraction(interaction) {\n super.processInteraction(interaction);\n const {\n payload: { type, payload }\n } = interaction;\n if (type === INTERACTIONS.EVALUATE_EXPRESSION && this.expressionEvaluator && payload) {\n const result = this.evaluateExpression(payload);\n const current2 = this.store.getState()?.plugins?.[this.pluginID]?.flow?.data?.history || [];\n this.dispatchDataUpdate({ history: [...current2, result] });\n return;\n }\n if (type === INTERACTIONS.OVERRIDE_FLOW && payload && this.overrideFlow) {\n let newFlow;\n try {\n newFlow = JSON.parse(payload);\n } catch (e) {\n this.logger?.deref()?.error(this.name, \"Error parsing new flow\", e);\n }\n if (newFlow) {\n this.overrideFlow(newFlow);\n }\n return;\n }\n }\n };\n return __toCommonJS(src_exports);\n})();\n","export type Reducer<State, Action> = (state: State, action: Action) => State;\nexport type Dispatch<Action> = (action: Action) => void;\nexport type Subscriber<State> = (state: State) => void;\nexport type Subscribe<State> = (subscriber: Subscriber<State>) => Unsubscribe;\nexport type Unsubscribe = () => void;\n\nexport interface Store<State, Action> {\n getState: () => State;\n subscribe: Subscribe<State>;\n dispatch: Dispatch<Action>;\n}\n\nexport const useStateReducer = <State, Action>(\n reducer: Reducer<State, Action>,\n initialState: State,\n): Store<State, Action> => {\n let state = initialState;\n const subscribers = new Set<Subscriber<State>>();\n return {\n getState: () => state,\n\n /** Subscribe to state changes; returns an unsubscribe function. */\n subscribe(subscriber: Subscriber<State>): Unsubscribe {\n subscribers.add(subscriber);\n subscriber(state);\n return () => subscribers.delete(subscriber);\n },\n\n /** Dispatch an action through the reducer, then run side-effects. */\n dispatch(action: Action): void {\n const prevState = state;\n const nextState = reducer(prevState, action);\n\n if (nextState !== prevState) {\n state = nextState;\n for (const sub of subscribers) sub(state);\n }\n },\n };\n};\n\n/**\n * Recursively assigns the contents of `source` into `target`, preserving\n * existing object and array references to maintain key insertion order.\n *\n * - **Objects**: keys present in `target` but absent in `source` are deleted\n * (unless `merge` is true), then each source entry is recursed into.\n * - **Arrays**: target is truncated or extended to match source length\n * (unless `merge` is true), then each element is recursed into.\n * - **Primitives / type mismatch**: source is returned directly; the caller\n * is responsible for assigning the return value.\n *\n * @param target - The existing value to assign into.\n * @param source - The new value to assign from.\n * @param merge - When true, stale keys and excess array elements are preserved\n * rather than deleted. Defaults to false.\n * @returns The mutated `target`, or `source` if types are incompatible.\n */\nfunction deepAssign<T, V>(target: T, source: V, merge: boolean = false) {\n if (Array.isArray(target) && Array.isArray(source)) {\n while (!merge && target.length > source.length) target.pop();\n // recurse and assign new values\n for (const [index, item] of source.entries()) {\n target[index] = deepAssign(target[index], item, merge);\n }\n } else if (\n target &&\n typeof target === \"object\" &&\n !Array.isArray(target) &&\n source &&\n typeof source === \"object\" &&\n !Array.isArray(source)\n ) {\n const record = target as Record<string, unknown>;\n\n // clear stale keys\n if (!merge)\n for (const key of Object.keys(target)) {\n if (!(key in source)) delete record[key];\n }\n // recurse and assign new values\n for (const [key, item] of Object.entries(source)) {\n record[key] = deepAssign(record[key], item, merge);\n }\n } else {\n // new data doesn't match the types, so there is no referential equality to retain\n return source;\n }\n\n return target;\n}\n\ntype Index = string | number;\n\n/**\n * Deep-sets a value at a key path on an object, preserving existing nested\n * object and array references to maintain key insertion order.\n *\n * Intermediate objects are auto-vivified as needed. The final assignment is\n * handled by {@link deepAssign}, which mutates the existing value in place\n * rather than replacing it wholesale.\n *\n * @param obj - The root object to assign into.\n * @param keys - Path of keys leading to the target location.\n * @param value - The value to assign at the path.\n * @param merge - When true, stale keys and excess array elements are preserved\n * rather than deleted. Defaults to false.\n * @throws If `keys` is empty or contains an undefined key.\n *\n * @see {@link https://github.com/lukeed/dset} for the original dset implementation that inspired this API\n */\nexport function dsetAssign<V>(\n obj: Record<Index, unknown>,\n keys: Array<Index>,\n value: V,\n merge: boolean = false,\n): void {\n const key = keys[keys.length - 1];\n if (key === undefined)\n throw Error(\"Unable to assign at path containing undefined keys\");\n\n // Walk the path, auto-vivifying intermediate objects when necessary\n const target = keys\n .slice(0, -1)\n .reduce(\n (acc, key) => (acc[key] ??= {}) as Record<string | number, unknown>,\n obj,\n );\n\n // Deep assign the value into the target object for key\n target[key] = deepAssign(target[key], value, merge);\n}\n","export const errors =\n\tprocess.env.NODE_ENV !== \"production\"\n\t\t? [\n\t\t\t\t// All error codes, starting by 0:\n\t\t\t\tfunction(plugin: string) {\n\t\t\t\t\treturn `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`\n\t\t\t\t},\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`\n\t\t\t\t},\n\t\t\t\t\"This object has been frozen and should not be mutated\",\n\t\t\t\tfunction(data: any) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t\"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" +\n\t\t\t\t\t\tdata\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\t\"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n\t\t\t\t\"Immer forbids circular references\",\n\t\t\t\t\"The first or second argument to `produce` must be a function\",\n\t\t\t\t\"The third argument to `produce` must be a function or undefined\",\n\t\t\t\t\"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n\t\t\t\t\"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'current' expects a draft, got: ${thing}`\n\t\t\t\t},\n\t\t\t\t\"Object.defineProperty() cannot be used on an Immer draft\",\n\t\t\t\t\"Object.setPrototypeOf() cannot be used on an Immer draft\",\n\t\t\t\t\"Immer only supports deleting array indices\",\n\t\t\t\t\"Immer only supports setting array indices and the 'length' property\",\n\t\t\t\tfunction(thing: string) {\n\t\t\t\t\treturn `'original' expects a draft, got: ${thing}`\n\t\t\t\t}\n\t\t\t\t// Note: if more errors are added, the errorOffset in Patches.ts should be increased\n\t\t\t\t// See Patches.ts for additional errors\n\t\t ]\n\t\t: []\n\nexport function die(error: number, ...args: any[]): never {\n\tif (process.env.NODE_ENV !== \"production\") {\n\t\tconst e = errors[error]\n\t\tconst msg = typeof e === \"function\" ? e.apply(null, args as any) : e\n\t\tthrow new Error(`[Immer] ${msg}`)\n\t}\n\tthrow new Error(\n\t\t`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n\t)\n}\n","import {\n\tDRAFT_STATE,\n\tDRAFTABLE,\n\tObjectish,\n\tDrafted,\n\tAnyObject,\n\tAnyMap,\n\tAnySet,\n\tImmerState,\n\tArchType,\n\tdie,\n\tStrictMode\n} from \"../internal\"\n\nexport const getPrototypeOf = Object.getPrototypeOf\n\n/** Returns true if the given value is an Immer draft */\n/*#__PURE__*/\nexport function isDraft(value: any): boolean {\n\treturn !!value && !!value[DRAFT_STATE]\n}\n\n/** Returns true if the given value can be drafted by Immer */\n/*#__PURE__*/\nexport function isDraftable(value: any): boolean {\n\tif (!value) return false\n\treturn (\n\t\tisPlainObject(value) ||\n\t\tArray.isArray(value) ||\n\t\t!!value[DRAFTABLE] ||\n\t\t!!value.constructor?.[DRAFTABLE] ||\n\t\tisMap(value) ||\n\t\tisSet(value)\n\t)\n}\n\nconst objectCtorString = Object.prototype.constructor.toString()\n/*#__PURE__*/\nexport function isPlainObject(value: any): boolean {\n\tif (!value || typeof value !== \"object\") return false\n\tconst proto = getPrototypeOf(value)\n\tif (proto === null) {\n\t\treturn true\n\t}\n\tconst Ctor =\n\t\tObject.hasOwnProperty.call(proto, \"constructor\") && proto.constructor\n\n\tif (Ctor === Object) return true\n\n\treturn (\n\t\ttypeof Ctor == \"function\" &&\n\t\tFunction.toString.call(Ctor) === objectCtorString\n\t)\n}\n\n/** Get the underlying object that is represented by the given draft */\n/*#__PURE__*/\nexport function original<T>(value: T): T | undefined\nexport function original(value: Drafted<any>): any {\n\tif (!isDraft(value)) die(15, value)\n\treturn value[DRAFT_STATE].base_\n}\n\n/**\n * Each iterates a map, set or array.\n * Or, if any other kind of object, all of its own properties.\n * Regardless whether they are enumerable or symbols\n */\nexport function each<T extends Objectish>(\n\tobj: T,\n\titer: (key: string | number, value: any, source: T) => void\n): void\nexport function each(obj: any, iter: any) {\n\tif (getArchtype(obj) === ArchType.Object) {\n\t\tReflect.ownKeys(obj).forEach(key => {\n\t\t\titer(key, obj[key], obj)\n\t\t})\n\t} else {\n\t\tobj.forEach((entry: any, index: any) => iter(index, entry, obj))\n\t}\n}\n\n/*#__PURE__*/\nexport function getArchtype(thing: any): ArchType {\n\tconst state: undefined | ImmerState = thing[DRAFT_STATE]\n\treturn state\n\t\t? state.type_\n\t\t: Array.isArray(thing)\n\t\t? ArchType.Array\n\t\t: isMap(thing)\n\t\t? ArchType.Map\n\t\t: isSet(thing)\n\t\t? ArchType.Set\n\t\t: ArchType.Object\n}\n\n/*#__PURE__*/\nexport function has(thing: any, prop: PropertyKey): boolean {\n\treturn getArchtype(thing) === ArchType.Map\n\t\t? thing.has(prop)\n\t\t: Object.prototype.hasOwnProperty.call(thing, prop)\n}\n\n/*#__PURE__*/\nexport function get(thing: AnyMap | AnyObject, prop: PropertyKey): any {\n\t// @ts-ignore\n\treturn getArchtype(thing) === ArchType.Map ? thing.get(prop) : thing[prop]\n}\n\n/*#__PURE__*/\nexport function set(thing: any, propOrOldValue: PropertyKey, value: any) {\n\tconst t = getArchtype(thing)\n\tif (t === ArchType.Map) thing.set(propOrOldValue, value)\n\telse if (t === ArchType.Set) {\n\t\tthing.add(value)\n\t} else thing[propOrOldValue] = value\n}\n\n/*#__PURE__*/\nexport function is(x: any, y: any): boolean {\n\t// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n\tif (x === y) {\n\t\treturn x !== 0 || 1 / x === 1 / y\n\t} else {\n\t\treturn x !== x && y !== y\n\t}\n}\n\n/*#__PURE__*/\nexport function isMap(target: any): target is AnyMap {\n\treturn target instanceof Map\n}\n\n/*#__PURE__*/\nexport function isSet(target: any): target is AnySet {\n\treturn target instanceof Set\n}\n/*#__PURE__*/\nexport function latest(state: ImmerState): any {\n\treturn state.copy_ || state.base_\n}\n\n/*#__PURE__*/\nexport function shallowCopy(base: any, strict: StrictMode) {\n\tif (isMap(base)) {\n\t\treturn new Map(base)\n\t}\n\tif (isSet(base)) {\n\t\treturn new Set(base)\n\t}\n\tif (Array.isArray(base)) return Array.prototype.slice.call(base)\n\n\tconst isPlain = isPlainObject(base)\n\n\tif (strict === true || (strict === \"class_only\" && !isPlain)) {\n\t\t// Perform a strict copy\n\t\tconst descriptors = Object.getOwnPropertyDescriptors(base)\n\t\tdelete descriptors[DRAFT_STATE as any]\n\t\tlet keys = Reflect.ownKeys(descriptors)\n\t\tfor (let i = 0; i < keys.length; i++) {\n\t\t\tconst key: any = keys[i]\n\t\t\tconst desc = descriptors[key]\n\t\t\tif (desc.writable === false) {\n\t\t\t\tdesc.writable = true\n\t\t\t\tdesc.configurable = true\n\t\t\t}\n\t\t\t// like object.assign, we will read any _own_, get/set accessors. This helps in dealing\n\t\t\t// with libraries that trap values, like mobx or vue\n\t\t\t// unlike object.assign, non-enumerables will be copied as well\n\t\t\tif (desc.get || desc.set)\n\t\t\t\tdescriptors[key] = {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true, // could live with !!desc.set as well here...\n\t\t\t\t\tenumerable: desc.enumerable,\n\t\t\t\t\tvalue: base[key]\n\t\t\t\t}\n\t\t}\n\t\treturn Object.create(getPrototypeOf(base), descriptors)\n\t} else {\n\t\t// perform a sloppy copy\n\t\tconst proto = getPrototypeOf(base)\n\t\tif (proto !== null && isPlain) {\n\t\t\treturn {...base} // assumption: better inner class optimization than the assign below\n\t\t}\n\t\tconst obj = Object.create(proto)\n\t\treturn Object.assign(obj, base)\n\t}\n}\n\n/**\n * Freezes draftable objects. Returns the original object.\n * By default freezes shallowly, but if the second argument is `true` it will freeze recursively.\n *\n * @param obj\n * @param deep\n */\nexport function freeze<T>(obj: T, deep?: boolean): T\nexport function freeze<T>(obj: any, deep: boolean = false): T {\n\tif (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj\n\tif (getArchtype(obj) > 1 /* Map or Set */) {\n\t\t Object.defineProperties(obj, {\n set: {value: dontMutateFrozenCollections as any},\n add: {value: dontMutateFrozenCollections as any},\n clear: {value: dontMutateFrozenCollections as any},\n delete: {value: dontMutateFrozenCollections as any}\n })\n\t}\n\tObject.freeze(obj)\n\tif (deep)\n\t\t// See #590, don't recurse into non-enumerable / Symbol properties when freezing\n\t\t// So use Object.values (only string-like, enumerables) instead of each()\n\t\tObject.values(obj).forEach(value => freeze(value, true))\n\treturn obj\n}\n\nfunction dontMutateFrozenCollections() {\n\tdie(2)\n}\n\nexport function isFrozen(obj: any): boolean {\n\treturn Object.isFrozen(obj)\n}\n","import {\n\tImmerState,\n\tPatch,\n\tDrafted,\n\tImmerBaseState,\n\tAnyMap,\n\tAnySet,\n\tArchType,\n\tdie\n} from \"../internal\"\n\n/** Plugin utilities */\nconst plugins: {\n\tPatches?: {\n\t\tgeneratePatches_(\n\t\t\tstate: ImmerState,\n\t\t\tbasePath: PatchPath,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tgenerateReplacementPatches_(\n\t\t\tbase: any,\n\t\t\treplacement: any,\n\t\t\tpatches: Patch[],\n\t\t\tinversePatches: Patch[]\n\t\t): void\n\t\tapplyPatches_<T>(draft: T, patches: readonly Patch[]): T\n\t}\n\tMapSet?: {\n\t\tproxyMap_<T extends AnyMap>(target: T, parent?: ImmerState): T\n\t\tproxySet_<T extends AnySet>(target: T, parent?: ImmerState): T\n\t}\n} = {}\n\ntype Plugins = typeof plugins\n\nexport function getPlugin<K extends keyof Plugins>(\n\tpluginKey: K\n): Exclude<Plugins[K], undefined> {\n\tconst plugin = plugins[pluginKey]\n\tif (!plugin) {\n\t\tdie(0, pluginKey)\n\t}\n\t// @ts-ignore\n\treturn plugin\n}\n\nexport function loadPlugin<K extends keyof Plugins>(\n\tpluginKey: K,\n\timplementation: Plugins[K]\n): void {\n\tif (!plugins[pluginKey]) plugins[pluginKey] = implementation\n}\n/** Map / Set plugin */\n\nexport interface MapState extends ImmerBaseState {\n\ttype_: ArchType.Map\n\tcopy_: AnyMap | undefined\n\tassigned_: Map<any, boolean> | undefined\n\tbase_: AnyMap\n\trevoked_: boolean\n\tdraft_: Drafted<AnyMap, MapState>\n}\n\nexport interface SetState extends ImmerBaseState {\n\ttype_: ArchType.Set\n\tcopy_: AnySet | undefined\n\tbase_: AnySet\n\tdrafts_: Map<any, Drafted> // maps the original value to the draft value in the new set\n\trevoked_: boolean\n\tdraft_: Drafted<AnySet, SetState>\n}\n\n/** Patches plugin */\n\nexport type PatchPath = (string | number)[]\n","import {\n\tPatch,\n\tPatchListener,\n\tDrafted,\n\tImmer,\n\tDRAFT_STATE,\n\tImmerState,\n\tArchType,\n\tgetPlugin\n} from \"../internal\"\n\n/** Each scope represents a `produce` call. */\n\nexport interface ImmerScope {\n\tpatches_?: Patch[]\n\tinversePatches_?: Patch[]\n\tcanAutoFreeze_: boolean\n\tdrafts_: any[]\n\tparent_?: ImmerScope\n\tpatchListener_?: PatchListener\n\timmer_: Immer\n\tunfinalizedDrafts_: number\n}\n\nlet currentScope: ImmerScope | undefined\n\nexport function getCurrentScope() {\n\treturn currentScope!\n}\n\nfunction createScope(\n\tparent_: ImmerScope | undefined,\n\timmer_: Immer\n): ImmerScope {\n\treturn {\n\t\tdrafts_: [],\n\t\tparent_,\n\t\timmer_,\n\t\t// Whenever the modified draft contains a draft from another scope, we\n\t\t// need to prevent auto-freezing so the unowned draft can be finalized.\n\t\tcanAutoFreeze_: true,\n\t\tunfinalizedDrafts_: 0\n\t}\n}\n\nexport function usePatchesInScope(\n\tscope: ImmerScope,\n\tpatchListener?: PatchListener\n) {\n\tif (patchListener) {\n\t\tgetPlugin(\"Patches\") // assert we have the plugin\n\t\tscope.patches_ = []\n\t\tscope.inversePatches_ = []\n\t\tscope.patchListener_ = patchListener\n\t}\n}\n\nexport function revokeScope(scope: ImmerScope) {\n\tleaveScope(scope)\n\tscope.drafts_.forEach(revokeDraft)\n\t// @ts-ignore\n\tscope.drafts_ = null\n}\n\nexport function leaveScope(scope: ImmerScope) {\n\tif (scope === currentScope) {\n\t\tcurrentScope = scope.parent_\n\t}\n}\n\nexport function enterScope(immer: Immer) {\n\treturn (currentScope = createScope(currentScope, immer))\n}\n\nfunction revokeDraft(draft: Drafted) {\n\tconst state: ImmerState = draft[DRAFT_STATE]\n\tif (state.type_ === ArchType.Object || state.type_ === ArchType.Array)\n\t\tstate.revoke_()\n\telse state.revoked_ = true\n}\n","import {\n\tImmerScope,\n\tDRAFT_STATE,\n\tisDraftable,\n\tNOTHING,\n\tPatchPath,\n\teach,\n\thas,\n\tfreeze,\n\tImmerState,\n\tisDraft,\n\tSetState,\n\tset,\n\tArchType,\n\tgetPlugin,\n\tdie,\n\trevokeScope,\n\tisFrozen,\n\tisMap\n} from \"../internal\"\n\nexport function processResult(result: any, scope: ImmerScope) {\n\tscope.unfinalizedDrafts_ = scope.drafts_.length\n\tconst baseDraft = scope.drafts_![0]\n\tconst isReplaced = result !== undefined && result !== baseDraft\n\tif (isReplaced) {\n\t\tif (baseDraft[DRAFT_STATE].modified_) {\n\t\t\trevokeScope(scope)\n\t\t\tdie(4)\n\t\t}\n\t\tif (isDraftable(result)) {\n\t\t\t// Finalize the result in case it contains (or is) a subset of the draft.\n\t\t\tresult = finalize(scope, result)\n\t\t\tif (!scope.parent_) maybeFreeze(scope, result)\n\t\t}\n\t\tif (scope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(\n\t\t\t\tbaseDraft[DRAFT_STATE].base_,\n\t\t\t\tresult,\n\t\t\t\tscope.patches_,\n\t\t\t\tscope.inversePatches_!\n\t\t\t)\n\t\t}\n\t} else {\n\t\t// Finalize the base draft.\n\t\tresult = finalize(scope, baseDraft, [])\n\t}\n\trevokeScope(scope)\n\tif (scope.patches_) {\n\t\tscope.patchListener_!(scope.patches_, scope.inversePatches_!)\n\t}\n\treturn result !== NOTHING ? result : undefined\n}\n\nfunction finalize(rootScope: ImmerScope, value: any, path?: PatchPath) {\n\t// Don't recurse in tho recursive data structures\n\tif (isFrozen(value)) return value\n\n\tconst state: ImmerState = value[DRAFT_STATE]\n\t// A plain object, might need freezing, might contain drafts\n\tif (!state) {\n\t\teach(value, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, value, key, childValue, path)\n\t\t)\n\t\treturn value\n\t}\n\t// Never finalize drafts owned by another scope.\n\tif (state.scope_ !== rootScope) return value\n\t// Unmodified draft, return the (frozen) original\n\tif (!state.modified_) {\n\t\tmaybeFreeze(rootScope, state.base_, true)\n\t\treturn state.base_\n\t}\n\t// Not finalized yet, let's do that now\n\tif (!state.finalized_) {\n\t\tstate.finalized_ = true\n\t\tstate.scope_.unfinalizedDrafts_--\n\t\tconst result = state.copy_\n\t\t// Finalize all children of the copy\n\t\t// For sets we clone before iterating, otherwise we can get in endless loop due to modifying during iteration, see #628\n\t\t// To preserve insertion order in all cases we then clear the set\n\t\t// And we let finalizeProperty know it needs to re-add non-draft children back to the target\n\t\tlet resultEach = result\n\t\tlet isSet = false\n\t\tif (state.type_ === ArchType.Set) {\n\t\t\tresultEach = new Set(result)\n\t\t\tresult.clear()\n\t\t\tisSet = true\n\t\t}\n\t\teach(resultEach, (key, childValue) =>\n\t\t\tfinalizeProperty(rootScope, state, result, key, childValue, path, isSet)\n\t\t)\n\t\t// everything inside is frozen, we can freeze here\n\t\tmaybeFreeze(rootScope, result, false)\n\t\t// first time finalizing, let's create those patches\n\t\tif (path && rootScope.patches_) {\n\t\t\tgetPlugin(\"Patches\").generatePatches_(\n\t\t\t\tstate,\n\t\t\t\tpath,\n\t\t\t\trootScope.patches_,\n\t\t\t\trootScope.inversePatches_!\n\t\t\t)\n\t\t}\n\t}\n\treturn state.copy_\n}\n\nfunction finalizeProperty(\n\trootScope: ImmerScope,\n\tparentState: undefined | ImmerState,\n\ttargetObject: any,\n\tprop: string | number,\n\tchildValue: any,\n\trootPath?: PatchPath,\n\ttargetIsSet?: boolean\n) {\n\tif (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n\t\tdie(5)\n\tif (isDraft(childValue)) {\n\t\tconst path =\n\t\t\trootPath &&\n\t\t\tparentState &&\n\t\t\tparentState!.type_ !== ArchType.Set && // Set objects are atomic since they have no keys.\n\t\t\t!has((parentState as Exclude<ImmerState, SetState>).assigned_!, prop) // Skip deep patches for assigned keys.\n\t\t\t\t? rootPath!.concat(prop)\n\t\t\t\t: undefined\n\t\t// Drafts owned by `scope` are finalized here.\n\t\tconst res = finalize(rootScope, childValue, path)\n\t\tset(targetObject, prop, res)\n\t\t// Drafts from another scope must prevented to be frozen\n\t\t// if we got a draft back from finalize, we're in a nested produce and shouldn't freeze\n\t\tif (isDraft(res)) {\n\t\t\trootScope.canAutoFreeze_ = false\n\t\t} else return\n\t} else if (targetIsSet) {\n\t\ttargetObject.add(childValue)\n\t}\n\t// Search new objects for unfinalized drafts. Frozen objects should never contain drafts.\n\tif (isDraftable(childValue) && !isFrozen(childValue)) {\n\t\tif (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n\t\t\t// optimization: if an object is not a draft, and we don't have to\n\t\t\t// deepfreeze everything, and we are sure that no drafts are left in the remaining object\n\t\t\t// cause we saw and finalized all drafts already; we can stop visiting the rest of the tree.\n\t\t\t// This benefits especially adding large data tree's without further processing.\n\t\t\t// See add-data.js perf test\n\t\t\treturn\n\t\t}\n\t\tfinalize(rootScope, childValue)\n\t\t// Immer deep freezes plain objects, so if there is no parent state, we freeze as well\n\t\t// Per #590, we never freeze symbolic properties. Just to make sure don't accidentally interfere\n\t\t// with other frameworks.\n\t\tif (\n\t\t\t(!parentState || !parentState.scope_.parent_) &&\n\t\t\ttypeof prop !== \"symbol\" &&\n\t\t\t(isMap(targetObject)\n\t\t\t\t? targetObject.has(prop)\n\t\t\t\t: Object.prototype.propertyIsEnumerable.call(targetObject, prop))\n\t\t)\n\t\t\tmaybeFreeze(rootScope, childValue)\n\t}\n}\n\nfunction maybeFreeze(scope: ImmerScope, value: any, deep = false) {\n\t// we never freeze for a non-root scope; as it would prevent pruning for drafts inside wrapping objects\n\tif (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n\t\tfreeze(value, deep)\n\t}\n}\n","import {\n\teach,\n\thas,\n\tis,\n\tisDraftable,\n\tshallowCopy,\n\tlatest,\n\tImmerBaseState,\n\tImmerState,\n\tDrafted,\n\tAnyObject,\n\tAnyArray,\n\tObjectish,\n\tgetCurrentScope,\n\tgetPrototypeOf,\n\tDRAFT_STATE,\n\tdie,\n\tcreateProxy,\n\tArchType,\n\tImmerScope\n} from \"../internal\"\n\ninterface ProxyBaseState extends ImmerBaseState {\n\tassigned_: {\n\t\t[property: string]: boolean\n\t}\n\tparent_?: ImmerState\n\trevoke_(): void\n}\n\nexport interface ProxyObjectState extends ProxyBaseState {\n\ttype_: ArchType.Object\n\tbase_: any\n\tcopy_: any\n\tdraft_: Drafted<AnyObject, ProxyObjectState>\n}\n\nexport interface ProxyArrayState extends ProxyBaseState {\n\ttype_: ArchType.Array\n\tbase_: AnyArray\n\tcopy_: AnyArray | null\n\tdraft_: Drafted<AnyArray, ProxyArrayState>\n}\n\ntype ProxyState = ProxyObjectState | ProxyArrayState\n\n/**\n * Returns a new draft of the `base` object.\n *\n * The second argument is the parent draft-state (used internally).\n */\nexport function createProxyProxy<T extends Objectish>(\n\tbase: T,\n\tparent?: ImmerState\n): Drafted<T, ProxyState> {\n\tconst isArray = Array.isArray(base)\n\tconst state: ProxyState = {\n\t\ttype_: isArray ? ArchType.Array : (ArchType.Object as any),\n\t\t// Track which produce call this is associated with.\n\t\tscope_: parent ? parent.scope_ : getCurrentScope()!,\n\t\t// True for both shallow and deep changes.\n\t\tmodified_: false,\n\t\t// Used during finalization.\n\t\tfinalized_: false,\n\t\t// Track which properties have been assigned (true) or deleted (false).\n\t\tassigned_: {},\n\t\t// The parent draft state.\n\t\tparent_: parent,\n\t\t// The base state.\n\t\tbase_: base,\n\t\t// The base proxy.\n\t\tdraft_: null as any, // set below\n\t\t// The base copy with any updated values.\n\t\tcopy_: null,\n\t\t// Called by the `produce` function.\n\t\trevoke_: null as any,\n\t\tisManual_: false\n\t}\n\n\t// the traps must target something, a bit like the 'real' base.\n\t// but also, we need to be able to determine from the target what the relevant state is\n\t// (to avoid creating traps per instance to capture the state in closure,\n\t// and to avoid creating weird hidden properties as well)\n\t// So the trick is to use 'state' as the actual 'target'! (and make sure we intercept everything)\n\t// Note that in the case of an array, we put the state in an array to have better Reflect defaults ootb\n\tlet target: T = state as any\n\tlet traps: ProxyHandler<object | Array<any>> = objectTraps\n\tif (isArray) {\n\t\ttarget = [state] as any\n\t\ttraps = arrayTraps\n\t}\n\n\tconst {revoke, proxy} = Proxy.revocable(target, traps)\n\tstate.draft_ = proxy as any\n\tstate.revoke_ = revoke\n\treturn proxy as any\n}\n\n/**\n * Object drafts\n */\nexport const objectTraps: ProxyHandler<ProxyState> = {\n\tget(state, prop) {\n\t\tif (prop === DRAFT_STATE) return state\n\n\t\tconst source = latest(state)\n\t\tif (!has(source, prop)) {\n\t\t\t// non-existing or non-own property...\n\t\t\treturn readPropFromProto(state, source, prop)\n\t\t}\n\t\tconst value = source[prop]\n\t\tif (state.finalized_ || !isDraftable(value)) {\n\t\t\treturn value\n\t\t}\n\t\t// Check for existing draft in modified state.\n\t\t// Assigned values are never drafted. This catches any drafts we created, too.\n\t\tif (value === peek(state.base_, prop)) {\n\t\t\tprepareCopy(state)\n\t\t\treturn (state.copy_![prop as any] = createProxy(value, state))\n\t\t}\n\t\treturn value\n\t},\n\thas(state, prop) {\n\t\treturn prop in latest(state)\n\t},\n\townKeys(state) {\n\t\treturn Reflect.ownKeys(latest(state))\n\t},\n\tset(\n\t\tstate: ProxyObjectState,\n\t\tprop: string /* strictly not, but helps TS */,\n\t\tvalue\n\t) {\n\t\tconst desc = getDescriptorFromProto(latest(state), prop)\n\t\tif (desc?.set) {\n\t\t\t// special case: if this write is captured by a setter, we have\n\t\t\t// to trigger it with the correct context\n\t\t\tdesc.set.call(state.draft_, value)\n\t\t\treturn true\n\t\t}\n\t\tif (!state.modified_) {\n\t\t\t// the last check is because we need to be able to distinguish setting a non-existing to undefined (which is a change)\n\t\t\t// from setting an existing property with value undefined to undefined (which is not a change)\n\t\t\tconst current = peek(latest(state), prop)\n\t\t\t// special case, if we assigning the original value to a draft, we can ignore the assignment\n\t\t\tconst currentState: ProxyObjectState = current?.[DRAFT_STATE]\n\t\t\tif (currentState && currentState.base_ === value) {\n\t\t\t\tstate.copy_![prop] = value\n\t\t\t\tstate.assigned_[prop] = false\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (is(value, current) && (value !== undefined || has(state.base_, prop)))\n\t\t\t\treturn true\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t}\n\n\t\tif (\n\t\t\t(state.copy_![prop] === value &&\n\t\t\t\t// special case: handle new props with value 'undefined'\n\t\t\t\t(value !== undefined || prop in state.copy_)) ||\n\t\t\t// special case: NaN\n\t\t\t(Number.isNaN(value) && Number.isNaN(state.copy_![prop]))\n\t\t)\n\t\t\treturn true\n\n\t\t// @ts-ignore\n\t\tstate.copy_![prop] = value\n\t\tstate.assigned_[prop] = true\n\t\treturn true\n\t},\n\tdeleteProperty(state, prop: string) {\n\t\t// The `undefined` check is a fast path for pre-existing keys.\n\t\tif (peek(state.base_, prop) !== undefined || prop in state.base_) {\n\t\t\tstate.assigned_[prop] = false\n\t\t\tprepareCopy(state)\n\t\t\tmarkChanged(state)\n\t\t} else {\n\t\t\t// if an originally not assigned property was deleted\n\t\t\tdelete state.assigned_[prop]\n\t\t}\n\t\tif (state.copy_) {\n\t\t\tdelete state.copy_[prop]\n\t\t}\n\t\treturn true\n\t},\n\t// Note: We never coerce `desc.value` into an Immer draft, because we can't make\n\t// the same guarantee in ES5 mode.\n\tgetOwnPropertyDescriptor(state, prop) {\n\t\tconst owner = latest(state)\n\t\tconst desc = Reflect.getOwnPropertyDescriptor(owner, prop)\n\t\tif (!desc) return desc\n\t\treturn {\n\t\t\twritable: true,\n\t\t\tconfigurable: state.type_ !== ArchType.Array || prop !== \"length\",\n\t\t\tenumerable: desc.enumerable,\n\t\t\tvalue: owner[prop]\n\t\t}\n\t},\n\tdefineProperty() {\n\t\tdie(11)\n\t},\n\tgetPrototypeOf(state) {\n\t\treturn getPrototypeOf(state.base_)\n\t},\n\tsetPrototypeOf() {\n\t\tdie(12)\n\t}\n}\n\n/**\n * Array drafts\n */\n\nconst arrayTraps: ProxyHandler<[ProxyArrayState]> = {}\neach(objectTraps, (key, fn) => {\n\t// @ts-ignore\n\tarrayTraps[key] = function() {\n\t\targuments[0] = arguments[0][0]\n\t\treturn fn.apply(this, arguments)\n\t}\n})\narrayTraps.deleteProperty = function(state, prop) {\n\tif (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop as any)))\n\t\tdie(13)\n\t// @ts-ignore\n\treturn arrayTraps.set!.call(this, state, prop, undefined)\n}\narrayTraps.set = function(state, prop, value) {\n\tif (\n\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\tprop !== \"length\" &&\n\t\tisNaN(parseInt(prop as any))\n\t)\n\t\tdie(14)\n\treturn objectTraps.set!.call(this, state[0], prop, value, state[0])\n}\n\n// Access a property without creating an Immer draft.\nfunction peek(draft: Drafted, prop: PropertyKey) {\n\tconst state = draft[DRAFT_STATE]\n\tconst source = state ? latest(state) : draft\n\treturn source[prop]\n}\n\nfunction readPropFromProto(state: ImmerState, source: any, prop: PropertyKey) {\n\tconst desc = getDescriptorFromProto(source, prop)\n\treturn desc\n\t\t? `value` in desc\n\t\t\t? desc.value\n\t\t\t: // This is a very special case, if the prop is a getter defined by the\n\t\t\t // prototype, we should invoke it with the draft as context!\n\t\t\t desc.get?.call(state.draft_)\n\t\t: undefined\n}\n\nfunction getDescriptorFromProto(\n\tsource: any,\n\tprop: PropertyKey\n): PropertyDescriptor | undefined {\n\t// 'in' checks proto!\n\tif (!(prop in source)) return undefined\n\tlet proto = getPrototypeOf(source)\n\twhile (proto) {\n\t\tconst desc = Object.getOwnPropertyDescriptor(proto, prop)\n\t\tif (desc) return desc\n\t\tproto = getPrototypeOf(proto)\n\t}\n\treturn undefined\n}\n\nexport function markChanged(state: ImmerState) {\n\tif (!state.modified_) {\n\t\tstate.modified_ = true\n\t\tif (state.parent_) {\n\t\t\tmarkChanged(state.parent_)\n\t\t}\n\t}\n}\n\nexport function prepareCopy(state: {\n\tbase_: any\n\tcopy_: any\n\tscope_: ImmerScope\n}) {\n\tif (!state.copy_) {\n\t\tstate.copy_ = shallowCopy(\n\t\t\tstate.base_,\n\t\t\tstate.scope_.immer_.useStrictShallowCopy_\n\t\t)\n\t}\n}\n","import {\n\tIProduceWithPatches,\n\tIProduce,\n\tImmerState,\n\tDrafted,\n\tisDraftable,\n\tprocessResult,\n\tPatch,\n\tObjectish,\n\tDRAFT_STATE,\n\tDraft,\n\tPatchListener,\n\tisDraft,\n\tisMap,\n\tisSet,\n\tcreateProxyProxy,\n\tgetPlugin,\n\tdie,\n\tenterScope,\n\trevokeScope,\n\tleaveScope,\n\tusePatchesInScope,\n\tgetCurrentScope,\n\tNOTHING,\n\tfreeze,\n\tcurrent\n} from \"../internal\"\n\ninterface ProducersFns {\n\tproduce: IProduce\n\tproduceWithPatches: IProduceWithPatches\n}\n\nexport type StrictMode = boolean | \"class_only\";\n\nexport class Immer implements ProducersFns {\n\tautoFreeze_: boolean = true\n\tuseStrictShallowCopy_: StrictMode = false\n\n\tconstructor(config?: {\n\t\tautoFreeze?: boolean\n\t\tuseStrictShallowCopy?: StrictMode\n\t}) {\n\t\tif (typeof config?.autoFreeze === \"boolean\")\n\t\t\tthis.setAutoFreeze(config!.autoFreeze)\n\t\tif (typeof config?.useStrictShallowCopy === \"boolean\")\n\t\t\tthis.setUseStrictShallowCopy(config!.useStrictShallowCopy)\n\t}\n\n\t/**\n\t * The `produce` function takes a value and a \"recipe function\" (whose\n\t * return value often depends on the base state). The recipe function is\n\t * free to mutate its first argument however it wants. All mutations are\n\t * only ever applied to a __copy__ of the base state.\n\t *\n\t * Pass only a function to create a \"curried producer\" which relieves you\n\t * from passing the recipe function every time.\n\t *\n\t * Only plain objects and arrays are made mutable. All other objects are\n\t * considered uncopyable.\n\t *\n\t * Note: This function is __bound__ to its `Immer` instance.\n\t *\n\t * @param {any} base - the initial state\n\t * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n\t * @param {Function} patchListener - optional function that will be called with all the patches produced here\n\t * @returns {any} a new state, or the initial state if nothing was modified\n\t */\n\tproduce: IProduce = (base: any, recipe?: any, patchListener?: any) => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\" && typeof recipe !== \"function\") {\n\t\t\tconst defaultBase = recipe\n\t\t\trecipe = base\n\n\t\t\tconst self = this\n\t\t\treturn function curriedProduce(\n\t\t\t\tthis: any,\n\t\t\t\tbase = defaultBase,\n\t\t\t\t...args: any[]\n\t\t\t) {\n\t\t\t\treturn self.produce(base, (draft: Drafted) => recipe.call(this, draft, ...args)) // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\tif (typeof recipe !== \"function\") die(6)\n\t\tif (patchListener !== undefined && typeof patchListener !== \"function\")\n\t\t\tdie(7)\n\n\t\tlet result\n\n\t\t// Only plain objects, arrays, and \"immerable classes\" are drafted.\n\t\tif (isDraftable(base)) {\n\t\t\tconst scope = enterScope(this)\n\t\t\tconst proxy = createProxy(base, undefined)\n\t\t\tlet hasError = true\n\t\t\ttry {\n\t\t\t\tresult = recipe(proxy)\n\t\t\t\thasError = false\n\t\t\t} finally {\n\t\t\t\t// finally instead of catch + rethrow better preserves original stack\n\t\t\t\tif (hasError) revokeScope(scope)\n\t\t\t\telse leaveScope(scope)\n\t\t\t}\n\t\t\tusePatchesInScope(scope, patchListener)\n\t\t\treturn processResult(result, scope)\n\t\t} else if (!base || typeof base !== \"object\") {\n\t\t\tresult = recipe(base)\n\t\t\tif (result === undefined) result = base\n\t\t\tif (result === NOTHING) result = undefined\n\t\t\tif (this.autoFreeze_) freeze(result, true)\n\t\t\tif (patchListener) {\n\t\t\t\tconst p: Patch[] = []\n\t\t\t\tconst ip: Patch[] = []\n\t\t\t\tgetPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip)\n\t\t\t\tpatchListener(p, ip)\n\t\t\t}\n\t\t\treturn result\n\t\t} else die(1, base)\n\t}\n\n\tproduceWithPatches: IProduceWithPatches = (base: any, recipe?: any): any => {\n\t\t// curried invocation\n\t\tif (typeof base === \"function\") {\n\t\t\treturn (state: any, ...args: any[]) =>\n\t\t\t\tthis.produceWithPatches(state, (draft: any) => base(draft, ...args))\n\t\t}\n\n\t\tlet patches: Patch[], inversePatches: Patch[]\n\t\tconst result = this.produce(base, recipe, (p: Patch[], ip: Patch[]) => {\n\t\t\tpatches = p\n\t\t\tinversePatches = ip\n\t\t})\n\t\treturn [result, patches!, inversePatches!]\n\t}\n\n\tcreateDraft<T extends Objectish>(base: T): Draft<T> {\n\t\tif (!isDraftable(base)) die(8)\n\t\tif (isDraft(base)) base = current(base)\n\t\tconst scope = enterScope(this)\n\t\tconst proxy = createProxy(base, undefined)\n\t\tproxy[DRAFT_STATE].isManual_ = true\n\t\tleaveScope(scope)\n\t\treturn proxy as any\n\t}\n\n\tfinishDraft<D extends Draft<any>>(\n\t\tdraft: D,\n\t\tpatchListener?: PatchListener\n\t): D extends Draft<infer T> ? T : never {\n\t\tconst state: ImmerState = draft && (draft as any)[DRAFT_STATE]\n\t\tif (!state || !state.isManual_) die(9)\n\t\tconst {scope_: scope} = state\n\t\tusePatchesInScope(scope, patchListener)\n\t\treturn processResult(undefined, scope)\n\t}\n\n\t/**\n\t * Pass true to automatically freeze all copies created by Immer.\n\t *\n\t * By default, auto-freezing is enabled.\n\t */\n\tsetAutoFreeze(value: boolean) {\n\t\tthis.autoFreeze_ = value\n\t}\n\n\t/**\n\t * Pass true to enable strict shallow copy.\n\t *\n\t * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n\t */\n\tsetUseStrictShallowCopy(value: StrictMode) {\n\t\tthis.useStrictShallowCopy_ = value\n\t}\n\n\tapplyPatches<T extends Objectish>(base: T, patches: readonly Patch[]): T {\n\t\t// If a patch replaces the entire state, take that replacement as base\n\t\t// before applying patches\n\t\tlet i: number\n\t\tfor (i = patches.length - 1; i >= 0; i--) {\n\t\t\tconst patch = patches[i]\n\t\t\tif (patch.path.length === 0 && patch.op === \"replace\") {\n\t\t\t\tbase = patch.value\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t// If there was a patch that replaced the entire state, start from the\n\t\t// patch after that.\n\t\tif (i > -1) {\n\t\t\tpatches = patches.slice(i + 1)\n\t\t}\n\n\t\tconst applyPatchesImpl = getPlugin(\"Patches\").applyPatches_\n\t\tif (isDraft(base)) {\n\t\t\t// N.B: never hits if some patch a replacement, patches are never drafts\n\t\t\treturn applyPatchesImpl(base, patches)\n\t\t}\n\t\t// Otherwise, produce a copy of the base state.\n\t\treturn this.produce(base, (draft: Drafted) =>\n\t\t\tapplyPatchesImpl(draft, patches)\n\t\t)\n\t}\n}\n\nexport function createProxy<T extends Objectish>(\n\tvalue: T,\n\tparent?: ImmerState\n): Drafted<T, ImmerState> {\n\t// precondition: createProxy should be guarded by isDraftable, so we know we can safely draft\n\tconst draft: Drafted = isMap(value)\n\t\t? getPlugin(\"MapSet\").proxyMap_(value, parent)\n\t\t: isSet(value)\n\t\t? getPlugin(\"MapSet\").proxySet_(value, parent)\n\t\t: createProxyProxy(value, parent)\n\n\tconst scope = parent ? parent.scope_ : getCurrentScope()\n\tscope.drafts_.push(draft)\n\treturn draft\n}\n","import {\n\tdie,\n\tisDraft,\n\tshallowCopy,\n\teach,\n\tDRAFT_STATE,\n\tset,\n\tImmerState,\n\tisDraftable,\n\tisFrozen\n} from \"../internal\"\n\n/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */\nexport function current<T>(value: T): T\nexport function current(value: any): any {\n\tif (!isDraft(value)) die(10, value)\n\treturn currentImpl(value)\n}\n\nfunction currentImpl(value: any): any {\n\tif (!isDraftable(value) || isFrozen(value)) return value\n\tconst state: ImmerState | undefined = value[DRAFT_STATE]\n\tlet copy: any\n\tif (state) {\n\t\tif (!state.modified_) return state.base_\n\t\t// Optimization: avoid generating new drafts during copying\n\t\tstate.finalized_ = true\n\t\tcopy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_)\n\t} else {\n\t\tcopy = shallowCopy(value, true)\n\t}\n\t// recurse\n\teach(copy, (key, childValue) => {\n\t\tset(copy, key, currentImpl(childValue))\n\t})\n\tif (state) {\n\t\tstate.finalized_ = false\n\t}\n\treturn copy\n}\n","var has = Object.prototype.hasOwnProperty;\n\nfunction find(iter, tar, key) {\n\tfor (key of iter.keys()) {\n\t\tif (dequal(key, tar)) return key;\n\t}\n}\n\nexport function dequal(foo, bar) {\n\tvar ctor, len, tmp;\n\tif (foo === bar) return true;\n\n\tif (foo && bar && (ctor=foo.constructor) === bar.constructor) {\n\t\tif (ctor === Date) return foo.getTime() === bar.getTime();\n\t\tif (ctor === RegExp) return foo.toString() === bar.toString();\n\n\t\tif (ctor === Array) {\n\t\t\tif ((len=foo.length) === bar.length) {\n\t\t\t\twhile (len-- && dequal(foo[len], bar[len]));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ctor === Set) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len;\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!bar.has(tmp)) return false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === Map) {\n\t\t\tif (foo.size !== bar.size) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tfor (len of foo) {\n\t\t\t\ttmp = len[0];\n\t\t\t\tif (tmp && typeof tmp === 'object') {\n\t\t\t\t\ttmp = find(bar, tmp);\n\t\t\t\t\tif (!tmp) return false;\n\t\t\t\t}\n\t\t\t\tif (!dequal(len[1], bar.get(tmp))) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tif (ctor === ArrayBuffer) {\n\t\t\tfoo = new Uint8Array(foo);\n\t\t\tbar = new Uint8Array(bar);\n\t\t} else if (ctor === DataView) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo.getInt8(len) === bar.getInt8(len));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (ArrayBuffer.isView(foo)) {\n\t\t\tif ((len=foo.byteLength) === bar.byteLength) {\n\t\t\t\twhile (len-- && foo[len] === bar[len]);\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (!ctor || typeof foo === 'object') {\n\t\t\tlen = 0;\n\t\t\tfor (ctor in foo) {\n\t\t\t\tif (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;\n\t\t\t\tif (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n\t\t\t}\n\t\t\treturn Object.keys(bar).length === len;\n\t\t}\n\t}\n\n\treturn foo !== foo && bar !== bar;\n}\n","import { getNowTime } from \"./getNowTime\";\n\n// TODO: Either polyfill crypto or use this (pulled from SO)\nexport function generateUUID(): string {\n // Public Domain/MIT\n let d = new Date().getTime(); //Timestamp\n let d2 = getNowTime() * 1000;\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n let r = Math.random() * 16; //random number between 0 and 16\n if (d > 0) {\n //Use timestamp until depleted\n r = (d + r) % 16 | 0;\n d = Math.floor(d / 16);\n } else {\n //Use microseconds since page-load if supported\n r = (d2 + r) % 16 | 0;\n d2 = Math.floor(d2 / 16);\n }\n return (c === \"x\" ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n","/**\n * Checks if `value` is equal to `check` if `check` is a string or in `check` if check is an Array\n *\n * @param value - the value being searched for\n * @param check - the values to check against\n * @returns `boolean`\n */\nexport function equalToOrIn(value: string, check: string | Array<string>) {\n if (Array.isArray(check)) {\n return check.includes(value);\n }\n\n return check === value;\n}\n","import { equalToOrIn } from \"./utils\";\n\nexport type Interceptor<Args extends any[], ReturnType, ContextType> = {\n /** An optional name for the interceptor */\n name?: string;\n /** Callback for each loop when used by the hook */\n loop?: (...args: Args) => void;\n /** Callback when an error occurs during the hook's call */\n error?: (err: Error) => void;\n /** Callback when a result is found for a hook's invocation */\n result?: (\n r: ReturnType extends Promise<infer AwaitedValue>\n ? AwaitedValue\n : ReturnType\n ) => void;\n /** Callback when a hook's call is complete */\n done?: () => void;\n /** Callback when a hook is tapped */\n tap?: (tap: Tap<Args, ReturnType, ContextType>) => void;\n} & (\n | {\n /** If context should be omitted from the 'call'. This is the default */\n context?: false;\n /** Callback when the hook is tapped without context */\n call?: (...args: Args) => void;\n }\n | {\n /** If context should be included in the 'call' */\n context: true;\n /** Callback when the hook is tapped with context */\n call?: (context: ContextType, ...args: Args) => void;\n }\n);\n\nexport type Tap<Args extends any[], ReturnType, ContextType = unknown> = {\n key: symbol;\n name: string;\n before?: string | Array<string>;\n} & (\n | {\n context: false;\n callback: (...args: Args) => ReturnType;\n }\n | {\n context: true;\n callback: (context: ContextType, ...args: Args) => ReturnType;\n }\n);\n\ntype BasicTap<Args extends any[], ReturnType, ContextType> = (\n name: string,\n callback: (...args: Args) => ReturnType,\n before?: string | Array<string>\n) => Tap<Args, ReturnType, ContextType>;\n\ntype TapWithContext<Args extends any[], ReturnType, ContextType> =\n | ((\n options: {\n name: string;\n context?: false;\n before?: string | Array<string>;\n },\n callback: (...args: Args) => ReturnType\n ) => Tap<Args, ReturnType>)\n | ((\n options: {\n name: string;\n context: true;\n before?: string | Array<string>;\n },\n callback: (context: ContextType, ...args: Args) => ReturnType\n ) => Tap<Args, ReturnType>);\n\ninterface SyncBaseHookType<Args extends any[], ReturnType, ContextType> {\n tap:\n | BasicTap<Args, ReturnType, ContextType>\n | TapWithContext<Args, ReturnType, ContextType>;\n call(...args: Args): void;\n untap(key: Tap<Args, ReturnType>): void;\n isUsed(): boolean;\n intercept(int: Interceptor<Args, ReturnType, ContextType>): void;\n}\n\nfunction callTap<Args extends any[], ReturnType, ContextType>(\n tap: Tap<Args, ReturnType, ContextType>,\n args: Args,\n ctx: ContextType\n) {\n if (tap.context) {\n return tap.callback(ctx, ...args);\n }\n\n return tap.callback(...args);\n}\n\n/** A manager for all intercepts inside of a tap */\nclass InterceptionManager<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> {\n protected interceptions: Array<Interceptor<Args, ReturnType, ContextType>>;\n private interceptionKeySet: Set<\n keyof Interceptor<Args, ReturnType, ContextType>\n >;\n\n constructor() {\n this.interceptions = [];\n this.interceptionKeySet = new Set();\n }\n\n isUsed() {\n return this.interceptions.length > 0;\n }\n\n intercept(int: Interceptor<Args, ReturnType, ContextType>): void {\n this.interceptions.push(int);\n Object.keys(int).forEach((s) => {\n this.interceptionKeySet.add(s as any);\n });\n }\n\n tap(tap: Tap<Args, ReturnType, ContextType>): void {\n if (this.interceptionKeySet.has(\"tap\")) {\n this.interceptions.forEach((i) => {\n i.tap?.(tap);\n });\n }\n }\n\n call(ctx: ContextType, ...args: Args): void {\n if (this.interceptionKeySet.has(\"call\")) {\n this.interceptions.forEach((i) => {\n if (i.context) {\n i.call?.(ctx, ...args);\n } else {\n i.call?.(...args);\n }\n });\n }\n }\n\n loop(...args: Args): void {\n if (this.interceptionKeySet.has(\"loop\")) {\n this.interceptions.forEach((i) => {\n i.loop?.(...args);\n });\n }\n }\n\n error(err: unknown): void {\n if (this.interceptionKeySet.has(\"error\")) {\n if (err instanceof Error) {\n const asError: Error = err;\n this.interceptions.forEach((i) => {\n i.error?.(asError);\n });\n }\n }\n }\n\n result(\n r: ReturnType extends Promise<infer AwaitedValue>\n ? AwaitedValue\n : ReturnType\n ): void {\n if (this.interceptionKeySet.has(\"result\")) {\n this.interceptions.forEach((i) => {\n i.result?.(r);\n });\n }\n }\n\n done(): void {\n if (this.interceptionKeySet.has(\"done\")) {\n this.interceptions.forEach((i) => {\n i.done?.();\n });\n }\n }\n}\n\nabstract class Hook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> implements SyncBaseHookType<Args, ReturnType, ContextType>\n{\n protected taps: Array<Tap<Args, ReturnType, ContextType>>;\n protected interceptions: InterceptionManager<Args, ReturnType, ContextType>;\n\n constructor() {\n this.taps = [];\n this.interceptions = new InterceptionManager<\n Args,\n ReturnType,\n ContextType\n >();\n }\n\n public tap(\n options: { name: string; context?: false; before?: string | Array<string> },\n callback: (...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(\n options: { name: string; context: true; before?: string | Array<string> },\n callback: (ctx: ContextType, ...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(\n name: string,\n callback: (...args: Args) => ReturnType\n ): Tap<Args, ReturnType, ContextType>;\n\n public tap(options: any, callback: any): Tap<Args, ReturnType, ContextType> {\n const resolvedOptions =\n typeof options === \"string\"\n ? {\n name: options,\n context: false,\n }\n : {\n context: false,\n ...options,\n };\n\n const key = Symbol(resolvedOptions.name);\n const tap: Tap<Args, ReturnType, ContextType> = {\n key,\n ...resolvedOptions,\n callback,\n };\n\n if (tap.before) {\n let insertionIndex = this.taps.length;\n const beforeSet = new Set(\n Array.isArray(tap.before) ? tap.before : [tap.before]\n );\n for (\n insertionIndex;\n insertionIndex > 0 && beforeSet.size > 0;\n insertionIndex--\n ) {\n const t = this.taps[insertionIndex - 1];\n if (beforeSet.has(t.name)) {\n beforeSet.delete(t.name);\n }\n\n if (t.before && equalToOrIn(tap.name, t.before)) {\n break;\n }\n }\n\n this.taps.splice(insertionIndex, 0, tap);\n } else {\n this.taps.push(tap);\n }\n\n this.interceptions.tap(tap);\n\n return tap;\n }\n\n abstract call(...args: Args): ReturnType;\n\n public untap(tap: Tap<Args, ReturnType, ContextType>) {\n this.taps = this.taps.filter((t) => t.key !== tap.key);\n }\n\n public isUsed() {\n return this.taps.length > 0 || this.interceptions.isUsed();\n }\n\n public intercept(int: Interceptor<Args, ReturnType, ContextType>): void {\n this.interceptions.intercept(int);\n }\n}\n\nexport class SyncHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, void, ContextType> {\n public call(...args: Args) {\n if (!this.isUsed()) {\n return;\n }\n\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n this.taps.forEach((t) => {\n callTap(t, args, ctx);\n });\n } catch (err: unknown) {\n this.interceptions.error(err);\n\n throw err;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class SyncBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, ReturnType | undefined | null, ContextType> {\n public call(...args: Args): ReturnType | undefined | null {\n if (!this.isUsed()) {\n return;\n }\n\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = callTap(this.taps[tapIndex], args, ctx);\n if (rtn !== undefined) {\n this.interceptions.result(rtn as any);\n return rtn;\n }\n }\n\n this.interceptions.done();\n }\n}\n\nexport class SyncWaterfallHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Args[0], ContextType> {\n public call(...args: Args): Args[0] {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n // eslint-disable-next-line prefer-const\n let [rtn, ...rest] = args;\n\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = callTap(this.taps[tapIndex], [rtn, ...rest] as any, ctx);\n if (tapValue !== undefined) {\n rtn = tapValue;\n }\n }\n\n this.interceptions.result(rtn);\n\n return rtn;\n }\n}\n\nexport class SyncLoopHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, void, ContextType> {\n public call(...args: Args) {\n let finished = false;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n while (finished !== true) {\n finished = true;\n this.interceptions.loop(...args);\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = callTap(this.taps[tapIndex], args, ctx);\n\n if (rtn !== undefined) {\n finished = false;\n break;\n }\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncParallelHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n const ctx: ContextType = {} as any;\n this.interceptions.call(ctx, ...args);\n\n await Promise.allSettled(this.taps.map((tap) => callTap(tap, args, ctx)));\n this.interceptions.done();\n }\n}\n\nexport class AsyncParallelBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<ReturnType>, ContextType> {\n public async call(...args: Args): Promise<ReturnType> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n const rtn = await Promise.race(\n this.taps.map((tap) => callTap(tap, args, ctx))\n );\n\n this.interceptions.result(rtn as any);\n return rtn;\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n }\n}\n\nexport class AsyncSeriesHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n await callTap(this.taps[tapIndex], args, ctx);\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncSeriesBailHook<\n Args extends any[],\n ReturnType,\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<ReturnType | undefined | null>, ContextType> {\n public async call(...args: Args): Promise<ReturnType | undefined | null> {\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = await callTap(this.taps[tapIndex], args, ctx);\n if (rtn !== undefined) {\n this.interceptions.result(rtn);\n return rtn;\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n\nexport class AsyncSeriesWaterfallHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<Args[0]>, ContextType> {\n public async call(...args: Args): Promise<Args[0]> {\n // eslint-disable-next-line prefer-const\n let [rtn, ...rest] = args;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const tapValue = await callTap(\n this.taps[tapIndex],\n [rtn, ...rest] as any,\n ctx\n );\n if (tapValue !== undefined) {\n rtn = tapValue;\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.result(rtn);\n\n return rtn;\n }\n}\n\nexport class AsyncSeriesLoopHook<\n Args extends any[],\n ContextType = Record<string, any>\n> extends Hook<Args, Promise<void>, ContextType> {\n public async call(...args: Args): Promise<void> {\n let finished = false;\n const ctx: ContextType = {} as any;\n\n this.interceptions.call(ctx, ...args);\n\n try {\n while (finished !== true) {\n finished = true;\n this.interceptions.loop(...args);\n for (let tapIndex = 0; tapIndex < this.taps.length; tapIndex += 1) {\n const rtn = await callTap(this.taps[tapIndex], args, ctx);\n\n if (rtn !== undefined) {\n finished = false;\n break;\n }\n }\n }\n } catch (e: unknown) {\n this.interceptions.error(e);\n throw e;\n }\n\n this.interceptions.done();\n }\n}\n","import type { Player } from \"@player-ui/player\";\nimport { ContextPlugin } from \"./plugin\";\nimport { ContextPluginSymbol } from \"./symbols\";\n\n/**\n * Returns the existing ContextPlugin or creates and registers a new one.\n */\nexport function getContextPlugin(player: Player): ContextPlugin {\n const existing = player.findPlugin<ContextPlugin>(ContextPluginSymbol);\n const plugin = existing ?? new ContextPlugin();\n\n if (!existing) {\n player.registerPlugin(plugin);\n }\n\n return plugin;\n}\n","export { BasicDevtoolsPlugin } from \"./plugin\";\nexport { playerConfigContextKey, type PlayerConfig } from \"./context\";\n","export const PLUGIN_ID = \"player-ui-basic-devtools-plugin\";\n\nexport const VIEWS_IDS = {\n CONFIG: \"Config\",\n FLOW: \"Flow\",\n LOGS: \"Logs\",\n CONSOLE: \"Console\",\n EDITOR: \"Editor\",\n};\n\nexport const INTERACTIONS = {\n EVALUATE_EXPRESSION: \"evaluate-expression\",\n OVERRIDE_FLOW: \"override-flow\",\n};\n","{\n \"id\": \"player-ui-basic-devtools-plugin\",\n \"views\": [\n {\n \"id\": \"Config\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Config-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Config-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Config-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Config-main\",\n \"type\": \"object-inspector\",\n \"binding\": \"playerConfig\",\n \"label\": {\n \"asset\": {\n \"id\": \"Config-main-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n }\n },\n {\n \"id\": \"Flow\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Flow-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Flow-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Flow-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Flow-main\",\n \"type\": \"object-inspector\",\n \"filter\": true,\n \"binding\": \"flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-main-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n \"footer\": {\n \"asset\": {\n \"id\": \"Flow-footer\",\n \"type\": \"copy-to-clipboard\",\n \"binding\": \"flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Flow-footer-label\",\n \"type\": \"text\",\n \"value\": \"Copy flow to the clipboard\"\n }\n }\n }\n }\n },\n {\n \"id\": \"Logs\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Logs-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Logs-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Logs-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Logs-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Logs-main\",\n \"type\": \"table\",\n \"binding\": \"logs\"\n }\n }\n },\n {\n \"id\": \"Console\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Console-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Console-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Console-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Console-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Console-main\",\n \"type\": \"console\",\n \"exp\": \" publish('evaluate-expression', {{expression}}) \",\n \"binding\": \"history\"\n }\n }\n },\n {\n \"id\": \"Editor\",\n \"type\": \"stacked-view\",\n \"header\": {\n \"asset\": {\n \"id\": \"Editor-header\",\n \"type\": \"navigation\",\n \"values\": [\n {\n \"asset\": {\n \"id\": \"Editor-header-values-0\",\n \"type\": \"action\",\n \"value\": \"Config\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-0-label\",\n \"type\": \"text\",\n \"value\": \"Config\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-1\",\n \"type\": \"action\",\n \"value\": \"Flow\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-1-label\",\n \"type\": \"text\",\n \"value\": \"Flow\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-2\",\n \"type\": \"action\",\n \"value\": \"Logs\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-2-label\",\n \"type\": \"text\",\n \"value\": \"Logs\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-3\",\n \"type\": \"action\",\n \"value\": \"Console\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-3-label\",\n \"type\": \"text\",\n \"value\": \"Console\"\n }\n }\n }\n },\n {\n \"asset\": {\n \"id\": \"Editor-header-values-4\",\n \"type\": \"action\",\n \"value\": \"Editor\",\n \"label\": {\n \"asset\": {\n \"id\": \"Editor-header-values-4-label\",\n \"type\": \"text\",\n \"value\": \"Editor\"\n }\n }\n }\n }\n ]\n }\n },\n \"main\": {\n \"asset\": {\n \"id\": \"Editor-main\",\n \"type\": \"code-editor\",\n \"binding\": \"flow\",\n \"exp\": \" publish('override-flow', {{code}}) \"\n }\n }\n }\n ],\n \"navigation\": {\n \"BEGIN\": \"Plugin\",\n \"Plugin\": {\n \"startState\": \"CONFIG\",\n \"CONFIG\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Config\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"FLOW\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Flow\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"LOGS\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Logs\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"CONSOLE\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Console\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n },\n \"EDITOR\": {\n \"state_type\": \"VIEW\",\n \"ref\": \"Editor\",\n \"transitions\": {\n \"Config\": \"CONFIG\",\n \"Flow\": \"FLOW\",\n \"Logs\": \"LOGS\",\n \"Console\": \"CONSOLE\",\n \"Editor\": \"EDITOR\"\n }\n }\n }\n },\n \"schema\": {\n \"ROOT\": {\n \"playerConfig\": {\n \"type\": \"RecordType\"\n },\n \"flow\": {\n \"type\": \"RecordType\"\n },\n \"expression\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"code\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"history\": {\n \"type\": \"historyType\",\n \"isArray\": true\n },\n \"logs\": {\n \"type\": \"logsType\",\n \"isArray\": true\n }\n },\n \"logsType\": {\n \"id\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"time\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"type\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"message\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"severity\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"binding\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"from\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"to\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"state\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"error\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"outcome\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"metricType\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n }\n },\n \"historyType\": {\n \"id\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"expression\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"result\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n },\n \"severity\": {\n \"type\": \"StringType\",\n \"default\": \"\",\n \"validation\": [\n {\n \"type\": \"string\"\n }\n ],\n \"format\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"data\": {\n \"expression\": \"\",\n \"flow\": {},\n \"history\": [],\n \"logs\": [],\n \"playerConfig\": {}\n }\n}","import type { PluginData } from \"@player-devtools/types\";\nimport { PLUGIN_ID, INTERACTIONS } from \"./constants\";\n\n// Generated via dsl_compile target\nimport flow from \"../_generated/flow.json\";\n\n// Stamped by tsup at release build time; scoped to this module so that\n// packages declaring the same define don't collide in a shared TS program.\ndeclare const __VERSION__: string;\n\nconst PLUGIN_VERSION =\n typeof __VERSION__ !== \"undefined\" ? __VERSION__ : \"unstamped\";\n\nexport const BasicPluginData: PluginData = {\n id: PLUGIN_ID,\n name: \"Standard Devtools\",\n description: \"Standard Player UI Devtools\",\n version: PLUGIN_VERSION,\n flow,\n capabilities: {\n description:\n \"Exposes Player runtime state (flow, data, logs, config) and supports expression evaluation and flow overrides.\",\n data: {\n flow: { description: \"The currently active Player flow JSON\" },\n data: { description: \"The current Player data model\" },\n logs: {\n description: \"Accumulated log messages emitted by the Player runtime\",\n },\n playerConfig: {\n description: \"Player version and list of registered plugin names\",\n },\n history: {\n description:\n \"Results of previous expression evaluations in this session\",\n },\n },\n actions: {\n [INTERACTIONS.EVALUATE_EXPRESSION]: {\n description:\n \"Evaluate a Player expression string and return the result\",\n params: {\n payload: {\n type: \"string\",\n description: \"The expression to evaluate\",\n },\n },\n },\n [INTERACTIONS.OVERRIDE_FLOW]: {\n description: \"Replace the currently running flow with a new flow JSON\",\n params: {\n payload: {\n type: \"string\",\n description: \"Stringified flow JSON to load\",\n },\n },\n },\n },\n },\n};\n\nexport * from \"./constants\";\n","// Should be no imports here!\n\n/**\n * The sentinel value returned by producers to replace the draft with undefined.\n */\nexport const NOTHING: unique symbol = Symbol.for(\"immer-nothing\")\n\n/**\n * To let Immer treat your class instances as plain immutable objects\n * (albeit with a custom prototype), you must define either an instance property\n * or a static property on each of your custom classes.\n *\n * Otherwise, your class instance will never be drafted, which means it won't be\n * safe to mutate in a produce callback.\n */\nexport const DRAFTABLE: unique symbol = Symbol.for(\"immer-draftable\")\n\nexport const DRAFT_STATE: unique symbol = Symbol.for(\"immer-state\")\n","import {\n\tIProduce,\n\tIProduceWithPatches,\n\tImmer,\n\tDraft,\n\tImmutable\n} from \"./internal\"\n\nexport {\n\tDraft,\n\tWritableDraft,\n\tImmutable,\n\tPatch,\n\tPatchListener,\n\tProducer,\n\toriginal,\n\tcurrent,\n\tisDraft,\n\tisDraftable,\n\tNOTHING as nothing,\n\tDRAFTABLE as immerable,\n\tfreeze,\n\tObjectish,\n\tStrictMode\n} from \"./internal\"\n\nconst immer = new Immer()\n\n/**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\nexport const produce: IProduce = /* @__PURE__ */ immer.produce\n\n/**\n * Like `produce`, but `produceWithPatches` always returns a tuple\n * [nextState, patches, inversePatches] (instead of just the next state)\n */\nexport const produceWithPatches: IProduceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(\n\timmer\n)\n\n/**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * Always freeze by default, even in production mode\n */\nexport const setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer)\n\n/**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\nexport const setUseStrictShallowCopy = /* @__PURE__ */ immer.setUseStrictShallowCopy.bind(\n\timmer\n)\n\n/**\n * Apply an array of Immer patches to the first argument.\n *\n * This function is a producer, which means copy-on-write is in effect.\n */\nexport const applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer)\n\n/**\n * Create an Immer draft from the given base state, which may be a draft itself.\n * The draft can be modified until you finalize it with the `finishDraft` function.\n */\nexport const createDraft = /* @__PURE__ */ immer.createDraft.bind(immer)\n\n/**\n * Finalize an Immer draft from a `createDraft` call, returning the base state\n * (if no changes were made) or a modified copy. The draft must *not* be\n * mutated afterwards.\n *\n * Pass a function as the 2nd argument to generate Immer patches based on the\n * changes that were made.\n */\nexport const finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer)\n\n/**\n * This function is actually a no-op, but can be used to cast an immutable type\n * to an draft type and make TypeScript happy\n *\n * @param value\n */\nexport function castDraft<T>(value: T): Draft<T> {\n\treturn value as any\n}\n\n/**\n * This function is actually a no-op, but can be used to cast a mutable type\n * to an immutable type and make TypeScript happy\n * @param value\n */\nexport function castImmutable<T>(value: T): Immutable<T> {\n\treturn value as any\n}\n\nexport {Immer}\n\nexport {enablePatches} from \"./plugins/patches\"\nexport {enableMapSet} from \"./plugins/mapset\"\n","import { produce } from \"immer\";\nimport { dequal } from \"dequal\";\nimport type {\n DevtoolsDataChangeEvent,\n DevtoolsPluginsStore,\n ExtensionSupportedEvents,\n PlayerInitEvent,\n PlayerStoppedEvent,\n Transaction,\n} from \"@player-devtools/types\";\nimport { dsetAssign } from \"@player-devtools/utils\";\n\nconst containsInteraction = (\n interactions: DevtoolsPluginsStore[\"interactions\"],\n interaction: DevtoolsPluginsStore[\"interactions\"][number],\n) => {\n return interactions.filter((i) => dequal(i, interaction)).length > 0;\n};\n\n/** devtools plugin state reducer */\nexport const reducer = (\n state: DevtoolsPluginsStore,\n transaction: Transaction<ExtensionSupportedEvents>,\n): DevtoolsPluginsStore => {\n switch (transaction.type) {\n case \"PLAYER_DEVTOOLS_PLAYER_INIT\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n dsetAssign(draft, [\"plugins\"], payload.plugins);\n\n const message: PlayerInitEvent = {\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload,\n };\n\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLAYER_STOPPED\":\n return produce(state, (draft) => {\n const message: PlayerStoppedEvent = {\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: transaction.payload,\n };\n\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\":\n return produce(state, (draft) => {\n const { payload } = transaction;\n\n if (!payload.data) return state;\n\n try {\n dsetAssign(\n draft,\n [\"plugins\", transaction.payload.pluginID, \"flow\", \"data\"],\n transaction.payload.data,\n );\n } catch {\n console.error(\"error setting data:\", transaction.payload.data);\n }\n const message: DevtoolsDataChangeEvent = {\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload,\n };\n\n draft.messages.push(message);\n });\n case \"PLAYER_DEVTOOLS_PLUGIN_INTERACTION\":\n return produce(state, (draft) => {\n if (containsInteraction(draft.interactions, transaction)) return state;\n\n dsetAssign(\n draft,\n [\"interactions\"],\n [...draft.interactions, transaction],\n );\n });\n case \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\": {\n const { playerID } = transaction.payload;\n\n if (!playerID) return state;\n return produce(state, (draft) => {\n dsetAssign(draft, [\"currentPlayer\"], playerID);\n });\n }\n default:\n return state;\n }\n};\n","export const INTERACTIONS = {\n PLAYER_SELECTED: \"player-selected\",\n};\n\nexport const PLUGIN_INACTIVE_WARNING =\n \"The plugin has been registered, but the Player development tools are not active. If you are working in a production environment, it is recommended to remove the plugin. To activate, enable through the browser extension popup for web or configure the FlipperClient for mobile.\";\n","export const getNowTime: () => number = globalThis.performance\n ? () => globalThis.performance.now()\n : () => Date.now();\n","import type {\n DevtoolsDataChangeEvent,\n Transaction,\n} from \"@player-devtools/types\";\nimport type { Flow } from \"@player-ui/player\";\n\nconst NOOP_ID = -1;\n\n/**\n * Generates a data change transaction for the player devtools plugin.\n *\n * This function creates a transaction object that represents a change in data\n * within a player devtools plugin. The transaction includes details such as the\n * plugin ID, the changed data, and the player ID. It is used to communicate\n * changes between the plugin and devtools.\n */\nexport const genDataChangeTransaction = ({\n playerID,\n data,\n pluginID,\n}: {\n playerID: string;\n data: Flow[\"data\"];\n pluginID: string;\n}): Transaction<DevtoolsDataChangeEvent> => {\n return {\n id: NOOP_ID,\n type: \"PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE\",\n payload: {\n pluginID,\n data,\n },\n sender: playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true,\n };\n};\n","import type { Messenger } from \"@player-devtools/messenger\";\nimport {\n PluginData,\n DevtoolsPluginsStore,\n PlayerInitEvent,\n PlayerStoppedEvent,\n ExtensionSupportedEvents,\n Transaction,\n DevtoolsPluginInteractionEvent,\n} from \"@player-devtools/types\";\nimport { dsetAssign } from \"@player-devtools/utils\";\nimport type { DataModel, Player, PlayerPlugin } from \"@player-ui/player\";\nimport { produce } from \"immer\";\nimport {\n useStateReducer,\n type Store,\n type Unsubscribe,\n} from \"@player-devtools/utils\";\nimport { reducer } from \"./reducer\";\nimport { PLUGIN_INACTIVE_WARNING, INTERACTIONS } from \"./constants\";\nimport { genDataChangeTransaction } from \"./helpers\";\nimport { dequal } from \"dequal\";\n\nexport interface DevtoolsHandler {\n // TODO: Could return bool to signifiy handled to avoid double processing?\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void;\n checkIfDevtoolsIsActive(): boolean;\n log?(message: string): void;\n}\n\nexport interface DevtoolsPluginOptions {\n playerID: string;\n pluginData: PluginData;\n handler: DevtoolsHandler;\n}\n\nconst INITIAL_STATE: DevtoolsPluginsStore = {\n messages: [],\n plugins: {},\n interactions: [],\n currentPlayer: \"\",\n};\n\n// TODO: Rename to DevtoolsPluginStore? Need to rename DevtoolsPluginsStore to DevtoolsPluginState\nexport type PluginStore = Store<\n DevtoolsPluginsStore,\n Transaction<ExtensionSupportedEvents>\n>;\n\n/** Entrypoint for devtools plugins with platform-agnostic components */\nexport class DevtoolsPlugin implements PlayerPlugin, DevtoolsHandler {\n name: string = \"DevtoolsPlugin\";\n\n private loggedWarning = false;\n\n /** True once devtools has been told about this player */\n private announced = false;\n\n store: PluginStore = useStateReducer(reducer, INITIAL_STATE);\n protected lastProcessedInteraction = 0;\n\n get pluginID(): string {\n return this.options.pluginData.id;\n }\n\n get playerID(): string {\n return this.options.playerID;\n }\n\n constructor(protected options: DevtoolsPluginOptions) {\n this.store.subscribe(({ interactions }) => {\n const start = this.lastProcessedInteraction;\n const end = interactions.length ?? 0;\n if (start < end) {\n // Advance the cursor BEFORE processing: `processInteraction` may\n // dispatch synchronously (e.g. SELECTED_PLAYER_CHANGE), which re-enters\n // this subscriber. Advancing first makes that re-entrant pass a no-op\n // instead of reprocessing the same interactions.\n this.lastProcessedInteraction = end;\n interactions\n .slice(start, end)\n .forEach(this.processInteraction.bind(this));\n }\n });\n }\n\n registerMessenger(\n messenger: Messenger<ExtensionSupportedEvents>,\n ): Unsubscribe {\n // Propagate new messages from state to devtools via the messenger\n let lastMessageIndex = -1;\n return this.store.subscribe(({ messages }) => {\n const start = lastMessageIndex + 1;\n if (messages.length > start) {\n const newlyAdded = messages.slice(start);\n lastMessageIndex = messages.length - 1;\n for (const msg of newlyAdded) {\n messenger.sendMessage(msg);\n }\n }\n });\n }\n\n protected dispatchPlayerInit(): void {\n // Initial plugin content\n const transaction: Transaction<PlayerInitEvent> = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_INIT\",\n payload: {\n plugins: {\n [this.pluginID]: this.options.pluginData,\n },\n },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true,\n };\n\n this.store.dispatch(transaction);\n this.announced = true;\n }\n\n protected dispatchPlayerStopped(): void {\n const transaction: Transaction<PlayerStoppedEvent> = {\n id: -1,\n type: \"PLAYER_DEVTOOLS_PLAYER_STOPPED\",\n payload: { pluginID: this.pluginID },\n sender: this.options.playerID,\n context: \"player\",\n target: \"player\",\n timestamp: Date.now(),\n _messenger_: true,\n };\n\n this.store.dispatch(transaction);\n }\n\n // By default, we'll only write to the keys defined in data -- if undefined, data will be cleared\n protected dispatchDataUpdate(data?: DataModel): void {\n const state = this.store.getState();\n\n const { plugins } = produce(this.store.getState(), (draft) => {\n if (!data)\n dsetAssign(draft, [\"plugins\", this.pluginID, \"flow\", \"data\"], data);\n else\n Object.entries(data).forEach(([key, value]) => {\n dsetAssign(\n draft,\n [\"plugins\", this.pluginID, \"flow\", \"data\", key],\n value,\n );\n });\n });\n\n const newData = plugins[this.pluginID]!.flow.data;\n if (dequal(state.plugins[this.pluginID]?.flow?.data, newData)) return;\n\n const transaction = genDataChangeTransaction({\n playerID: this.playerID,\n pluginID: this.pluginID,\n data: newData,\n });\n\n this.store.dispatch(transaction);\n }\n\n checkIfDevtoolsIsActive(): boolean {\n const isActive = this.options.handler.checkIfDevtoolsIsActive();\n if (!isActive && !this.loggedWarning) {\n this.options.handler.log?.(PLUGIN_INACTIVE_WARNING);\n this.loggedWarning = true;\n }\n\n return isActive;\n }\n\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void {\n this.options.handler.processInteraction(interaction);\n\n const {\n payload: { type, payload },\n } = interaction;\n\n if (type === INTERACTIONS.PLAYER_SELECTED && payload) {\n this.store.dispatch({\n id: -1,\n type: \"PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE\",\n payload: { playerID: payload },\n sender: this.playerID,\n context: \"player\",\n target: this.playerID,\n timestamp: Date.now(),\n _messenger_: true,\n });\n }\n }\n\n apply(player: Player): void {\n if (!this.checkIfDevtoolsIsActive()) return;\n\n this.dispatchPlayerInit();\n }\n\n /**\n * Tell devtools this plugin is gone. Call it before the messenger is destroyed.\n * Safe to call more than once.\n */\n teardown(): void {\n if (!this.announced) return;\n this.announced = false;\n\n this.dispatchPlayerStopped();\n }\n}\n","import type { ContextKey } from \"./types\";\n\nconst KEY_NAMESPACE = \"player-ui.context.\";\n\n/**\n * Create a typed, globally-identifiable context key.\n *\n * Identity is backed by `Symbol.for`, so two keys created with the same `name`\n * in different bundles refer to the same store entry. The `description` is the\n * human-readable label used by introspection consumers.\n */\nexport const defineContextKey = <Value>(\n name: string,\n description: string,\n): ContextKey<Value> => ({\n symbol: Symbol.for(`${KEY_NAMESPACE}${name}`),\n description,\n});\n\n/**\n * Resolve the global symbol for a context key name. Used by native wrappers\n * that cross the JS bridge with string names instead of JS symbols.\n */\nexport const resolveContextKeySymbol = (name: string): symbol =>\n Symbol.for(`${KEY_NAMESPACE}${name}`);\n\n/**\n * Reverse-derive the name from a key created via `defineContextKey`. Returns\n * `undefined` if the key's symbol was not created in the context namespace.\n */\nexport const nameOfContextKey = (key: ContextKey): string | undefined => {\n const k = Symbol.keyFor(key.symbol);\n if (!k || !k.startsWith(KEY_NAMESPACE)) return undefined;\n return k.slice(KEY_NAMESPACE.length);\n};\n","import type {\n ContextEntryDescriptor,\n ContextKey,\n ContextTransform,\n FrozenContextEntry,\n FrozenContextSnapshot,\n} from \"./types\";\nimport { nameOfContextKey } from \"./key\";\n\ntype Entry = {\n key: ContextKey;\n hasLiteral: boolean;\n literal?: unknown;\n transform?: ContextTransform<unknown>;\n};\n\nconst deepFreezeEntry = (entry: FrozenContextEntry): FrozenContextEntry => {\n Object.freeze(entry);\n return entry;\n};\n\n/**\n * A poisoned stand-in for a function captured into a history snapshot. The\n * key and description survive in the snapshot — the capability *existed* —\n * but the callable is dead: invoking it throws because the flow it was bound\n * to has ended. This preserves the distinction between \"context that never\n * held this action\" and \"an action that is no longer valid\".\n */\nconst tombstone = (description: string) => (): never => {\n throw new Error(\n `[ContextPlugin] Action \"${description}\" is no longer valid — its flow has ended`,\n );\n};\n\n/**\n * Recursively replace every function in [value] (top-level or nested) with a\n * {@link tombstone}, so a frozen history snapshot carries no live callables.\n */\nconst tombstoneFunctions = (value: unknown, description: string): unknown => {\n if (typeof value === \"function\") {\n return tombstone(description);\n }\n if (Array.isArray(value)) {\n return value.map((item) => tombstoneFunctions(item, description));\n }\n if (value !== null && typeof value === \"object\") {\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value)) {\n out[k] = tombstoneFunctions(v, description);\n }\n return out;\n }\n return value;\n};\n\n/**\n * Mutable per-flow context store. Owned by a single flow lifecycle; the plugin\n * rotates the store on flow end and freezes the prior one into a snapshot.\n */\nexport class ContextStore {\n private entries = new Map<symbol, Entry>();\n /** source symbol -> set of target symbols (reverse index for invalidation). */\n private dependents = new Map<symbol, Set<symbol>>();\n\n register(key: ContextKey): boolean {\n if (this.entries.has(key.symbol)) {\n return false;\n }\n this.entries.set(key.symbol, { key, hasLiteral: false });\n return true;\n }\n\n set<Value>(key: ContextKey<Value>, value: Value): void {\n const existing = this.entries.get(key.symbol);\n if (existing) {\n existing.hasLiteral = true;\n existing.literal = value;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: true,\n literal: value,\n });\n }\n }\n\n registerTransform<Value>(\n key: ContextKey<Value>,\n transform: ContextTransform<Value>,\n ): { previousSources?: ReadonlyArray<ContextKey> } {\n const existing = this.entries.get(key.symbol);\n const previousSources = existing?.transform?.sources;\n\n if (previousSources) {\n for (const src of previousSources) {\n this.dependents.get(src.symbol)?.delete(key.symbol);\n }\n }\n\n const stored: ContextTransform<unknown> = {\n sources: transform.sources,\n compute: transform.compute as ContextTransform<unknown>[\"compute\"],\n };\n\n if (existing) {\n existing.transform = stored;\n existing.key = key;\n } else {\n this.entries.set(key.symbol, {\n key,\n hasLiteral: false,\n transform: stored,\n });\n }\n\n for (const src of transform.sources) {\n let set = this.dependents.get(src.symbol);\n if (!set) {\n set = new Set();\n this.dependents.set(src.symbol, set);\n }\n set.add(key.symbol);\n }\n\n return { previousSources };\n }\n\n get<Value>(key: ContextKey<Value>): Value | undefined {\n return this.compute(key.symbol) as Value | undefined;\n }\n\n has(key: ContextKey): boolean {\n const entry = this.entries.get(key.symbol);\n return Boolean(entry && (entry.hasLiteral || entry.transform));\n }\n\n /** Return the keys that depend on the given source key (direct dependents only). */\n dependentsOf(sourceSymbol: symbol): ReadonlyArray<ContextKey> {\n const set = this.dependents.get(sourceSymbol);\n if (!set || set.size === 0) {\n return [];\n }\n const out: ContextKey[] = [];\n for (const targetSymbol of set) {\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n }\n return out;\n }\n\n /**\n * Return every key transitively downstream of [sourceSymbol] — direct\n * dependents, their dependents, and so on. Ordered breadth-first so nearer\n * dependents come first, deduped so a key reachable by several paths (a\n * diamond) appears once, and cycle-safe.\n *\n * The source itself is never included — `set()` notifies it directly, so\n * re-emitting it here would double-notify subscribers on a cyclic graph.\n */\n transitiveDependentsOf(sourceSymbol: symbol): ReadonlyArray<ContextKey> {\n const visited = new Set<symbol>([sourceSymbol]);\n const out: ContextKey[] = [];\n const queue: symbol[] = [sourceSymbol];\n\n while (queue.length > 0) {\n const current = queue.shift() as symbol;\n const set = this.dependents.get(current);\n if (!set) continue;\n for (const targetSymbol of set) {\n if (visited.has(targetSymbol)) continue;\n visited.add(targetSymbol);\n const target = this.entries.get(targetSymbol);\n if (target) {\n out.push(target.key);\n }\n queue.push(targetSymbol);\n }\n }\n\n return out;\n }\n\n list(): ReadonlyArray<ContextEntryDescriptor> {\n const out: ContextEntryDescriptor[] = [];\n for (const entry of this.entries.values()) {\n out.push({\n symbol: entry.key.symbol,\n description: entry.key.description,\n hasValue: entry.hasLiteral,\n hasTransform: Boolean(entry.transform),\n });\n }\n return out;\n }\n\n freeze(meta: { flowId?: string; endedAt: number }): FrozenContextSnapshot {\n const frozenEntries: FrozenContextEntry[] = [];\n for (const entry of this.entries.values()) {\n if (!entry.hasLiteral && !entry.transform) {\n continue;\n }\n const computed = this.compute(entry.key.symbol);\n const value = tombstoneFunctions(computed, entry.key.description);\n frozenEntries.push(\n deepFreezeEntry({\n symbol: entry.key.symbol,\n name: nameOfContextKey(entry.key),\n description: entry.key.description,\n value,\n }),\n );\n }\n const bySymbol = new Map(frozenEntries.map((e) => [e.symbol, e.value]));\n const snapshot: FrozenContextSnapshot = {\n flowId: meta.flowId,\n endedAt: meta.endedAt,\n entries: Object.freeze(frozenEntries),\n get<Value>(key: ContextKey<Value>): Value | undefined {\n return bySymbol.get(key.symbol) as Value | undefined;\n },\n };\n return Object.freeze(snapshot);\n }\n\n private compute(sym: symbol): unknown {\n const entry = this.entries.get(sym);\n if (!entry) return undefined;\n if (entry.hasLiteral) return entry.literal;\n if (!entry.transform) return undefined;\n const reader = <V>(otherKey: { symbol: symbol }): V | undefined =>\n this.compute(otherKey.symbol) as V | undefined;\n return entry.transform.compute(reader);\n }\n}\n","import type { FrozenContextSnapshot } from \"./types\";\n\n/**\n * Append-only stack of frozen per-flow snapshots. The plugin pushes one\n * snapshot on each flow end; consumers read via `entries()`.\n */\nexport class ContextHistory {\n private stack: FrozenContextSnapshot[] = [];\n\n push(snapshot: FrozenContextSnapshot): void {\n this.stack.push(snapshot);\n }\n\n entries(): ReadonlyArray<FrozenContextSnapshot> {\n return this.stack;\n }\n\n size(): number {\n return this.stack.length;\n }\n\n clear(): void {\n this.stack = [];\n }\n}\n","export const ContextPluginSymbol = Symbol.for(\"ContextPlugin\");\n","import type { Player, PlayerPlugin, Flow } from \"@player-ui/player\";\nimport { SyncHook, SyncWaterfallHook } from \"tapable-ts\";\nimport { ContextStore } from \"./store\";\nimport { ContextHistory } from \"./history\";\nimport { ContextPluginSymbol } from \"./symbols\";\nimport { defineContextKey, nameOfContextKey } from \"./key\";\nimport type {\n ContextEntryDescriptor,\n ContextGlobalSubscriber,\n ContextKey,\n ContextSubscriber,\n ContextTransform,\n FrozenContextSnapshot,\n SubscriptionToken,\n} from \"./types\";\n\ntype TransformRegistration = {\n key: ContextKey;\n transform: ContextTransform<unknown>;\n};\n\nlet subscriptionCounter = 0;\n\n/**\n * Maintains a per-flow store of context entries keyed by symbol, with\n * registered transforms for derived values and a subscription API for\n * external consumers. On flow end the active store is frozen into a snapshot\n * and pushed onto a history stack; a fresh store is created for the next flow,\n * with transforms re-applied. Subscribers persist across flow rotations.\n */\nexport class ContextPlugin implements PlayerPlugin {\n name = \"context\";\n\n static Symbol: symbol = ContextPluginSymbol;\n public readonly symbol: symbol = ContextPlugin.Symbol;\n\n public readonly hooks = {\n onSet: new SyncHook<[ContextKey, unknown]>(),\n resolveValue: new SyncWaterfallHook<[unknown, ContextKey]>(),\n onRegister: new SyncHook<[ContextKey]>(),\n onFlowFrozen: new SyncHook<[FrozenContextSnapshot]>(),\n };\n\n protected store: ContextStore;\n protected historyStack: ContextHistory;\n private transforms = new Map<symbol, TransformRegistration>();\n private perKeySubs = new Map<\n symbol,\n Map<SubscriptionToken, ContextSubscriber<unknown>>\n >();\n private globalSubs = new Map<SubscriptionToken, ContextGlobalSubscriber>();\n private tokenIndex = new Map<SubscriptionToken, symbol | undefined>();\n /** Last value notify() fired with, per key — dedupes redundant publishes. */\n private lastNotified = new Map<symbol, unknown>();\n private currentFlowId: string | undefined;\n\n constructor() {\n this.store = new ContextStore();\n this.historyStack = new ContextHistory();\n }\n\n apply(player: Player) {\n const existing = player.findPlugin<ContextPlugin>(ContextPluginSymbol);\n if (existing !== undefined && existing !== this) {\n this.store = existing.store;\n this.historyStack = existing.historyStack;\n this.transforms = existing.transforms;\n this.perKeySubs = existing.perKeySubs;\n this.globalSubs = existing.globalSubs;\n this.tokenIndex = existing.tokenIndex;\n this.lastNotified = existing.lastNotified;\n return;\n }\n\n player.hooks.onStart.tap(this.name, (flow: Flow) => {\n this.currentFlowId = flow?.id;\n });\n\n player.hooks.onEnd.tap(this.name, () => {\n const snapshot = this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now(),\n });\n this.historyStack.push(snapshot);\n this.hooks.onFlowFrozen.call(snapshot);\n this.rotateStore();\n this.currentFlowId = undefined;\n });\n }\n\n register<Value>(key: ContextKey<Value>): void {\n const added = this.store.register(key);\n if (added) {\n this.hooks.onRegister.call(key);\n }\n }\n\n set<Value>(key: ContextKey<Value>, value: Value): void {\n const isFirstSighting = !this.store.has(key);\n this.store.set(key, value);\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n this.notifyIfChanged(key, value);\n }\n\n get<Value>(key: ContextKey<Value>): Value | undefined {\n const raw = this.store.get(key);\n const resolved = this.hooks.resolveValue.call(raw, key);\n return resolved as Value | undefined;\n }\n\n has(key: ContextKey): boolean {\n return this.store.has(key);\n }\n\n registerTransform<Value>(\n key: ContextKey<Value>,\n transform: ContextTransform<Value>,\n ): void {\n const isFirstSighting = !this.store.has(key);\n this.store.registerTransform(key, transform);\n this.transforms.set(key.symbol, {\n key,\n transform: {\n sources: transform.sources,\n compute: transform.compute as ContextTransform<unknown>[\"compute\"],\n },\n });\n if (isFirstSighting) {\n this.hooks.onRegister.call(key);\n }\n }\n\n subscribe<Value>(\n key: ContextKey<Value>,\n handler: ContextSubscriber<Value>,\n ): SubscriptionToken {\n const token = this.nextToken();\n let bucket = this.perKeySubs.get(key.symbol);\n if (!bucket) {\n bucket = new Map();\n this.perKeySubs.set(key.symbol, bucket);\n }\n bucket.set(token, handler as ContextSubscriber<unknown>);\n this.tokenIndex.set(token, key.symbol);\n return token;\n }\n\n subscribeAll(handler: ContextGlobalSubscriber): SubscriptionToken {\n const token = this.nextToken();\n this.globalSubs.set(token, handler);\n this.tokenIndex.set(token, undefined);\n return token;\n }\n\n unsubscribe(token: SubscriptionToken): void {\n const owner = this.tokenIndex.get(token);\n if (owner === undefined) {\n this.globalSubs.delete(token);\n } else {\n this.perKeySubs.get(owner)?.delete(token);\n }\n this.tokenIndex.delete(token);\n }\n\n list(): ReadonlyArray<ContextEntryDescriptor> {\n return this.store.list();\n }\n\n history(): ReadonlyArray<FrozenContextSnapshot> {\n return this.historyStack.entries();\n }\n\n snapshot(): FrozenContextSnapshot {\n return this.store.freeze({\n flowId: this.currentFlowId,\n endedAt: Date.now(),\n });\n }\n\n /**\n * Bridge-friendly: set a value by string name. Used by native wrappers that\n * cannot construct a `ContextKey` object directly.\n */\n setByName(name: string, description: string, value: unknown): void {\n this.set(this.ensureNamedKey(name, description), value);\n }\n\n /** Bridge-friendly: get a value by string name. */\n getByName(name: string): unknown {\n return this.get(this.ensureNamedKey(name));\n }\n\n /** Bridge-friendly: check presence by string name. */\n hasByName(name: string): boolean {\n return this.has(this.ensureNamedKey(name));\n }\n\n /** Bridge-friendly: subscribe by string name. */\n subscribeByName(\n name: string,\n description: string,\n handler: (value: unknown, name: string) => void,\n ): SubscriptionToken {\n return this.subscribe(this.ensureNamedKey(name, description), (value) =>\n handler(value, name),\n );\n }\n\n /**\n * Bridge-friendly: subscribe to all updates. The handler receives the\n * key's resolved name (or undefined for non-namespaced keys).\n */\n subscribeAllByName(\n handler: (\n value: unknown,\n name: string | undefined,\n description: string,\n ) => void,\n ): SubscriptionToken {\n return this.subscribeAll((value, key) =>\n handler(value, nameOfContextKey(key), key.description),\n );\n }\n\n private ensureNamedKey(\n name: string,\n description?: string,\n ): ContextKey<unknown> {\n return defineContextKey<unknown>(name, description ?? name);\n }\n\n /**\n * Notify subscribers of `key` with `value`, unless it's `Object.is`-equal\n * to the value the last notification for this key carried. Then cascade to\n * every transitive dependent (a chained transform root -> mid -> top must\n * notify `top` when `root` changes, not just the directly-dependent `mid`),\n * applying the same unchanged-value guard to each. `transitiveDependentsOf`\n * already flattens the full downstream closure in one deduped, cycle-safe\n * pass, so this walks it directly rather than recursing back through this\n * method (which would re-walk the graph from each dependent and, on a\n * diamond, notify a shared descendant more than once).\n */\n private notifyIfChanged<Value>(\n key: ContextKey<Value>,\n value: Value | undefined,\n ) {\n this.publishIfChanged(key, value);\n\n for (const dep of this.store.transitiveDependentsOf(key.symbol)) {\n this.publishIfChanged(dep, this.store.get(dep));\n }\n }\n\n private publishIfChanged<Value>(\n key: ContextKey<Value>,\n value: Value | undefined,\n ) {\n const hasNotified = this.lastNotified.has(key.symbol);\n const unchanged =\n hasNotified && Object.is(this.lastNotified.get(key.symbol), value);\n this.lastNotified.set(key.symbol, value);\n if (!unchanged) {\n this.notify(key, value);\n }\n }\n\n private notify<Value>(key: ContextKey<Value>, value: Value | undefined) {\n this.hooks.onSet.call(key, value);\n const bucket = this.perKeySubs.get(key.symbol);\n if (bucket) {\n for (const handler of bucket.values()) {\n (handler as ContextSubscriber<Value>)(value, key);\n }\n }\n for (const handler of this.globalSubs.values()) {\n handler(value, key);\n }\n }\n\n private rotateStore() {\n this.store = new ContextStore();\n this.lastNotified.clear();\n for (const { key, transform } of this.transforms.values()) {\n this.store.registerTransform(key, transform);\n }\n }\n\n private nextToken(): SubscriptionToken {\n subscriptionCounter += 1;\n return `ctx_${subscriptionCounter}`;\n }\n}\n","import type { Player, PlayerPlugin } from \"@player-ui/player\";\nimport { defineContextKey } from \"./key\";\nimport { getContextPlugin } from \"./utils\";\nimport type { ContextKey } from \"./types\";\n\n/** Set a single binding in the Player data model. */\nexport type SetDataAction = (binding: string, value: unknown) => void;\n\n/** Transition the running flow using the given transition value. */\nexport type TransitionAction = (transition: string) => void;\n\n/** A single validation, projected to its serializable fields. */\nexport type ContextValidation = {\n severity: \"error\" | \"warning\";\n message: string;\n displayTarget?: \"page\" | \"section\" | \"field\";\n blocking?: boolean | \"once\";\n};\n\n/** Validation state for the running view, keyed by binding. */\nexport type ValidationContext = {\n /** Whether the view has no blocking validations (derived, no side effects). */\n canTransition: boolean;\n /** Active validations per binding string. */\n byBinding: Record<string, ReadonlyArray<ContextValidation>>;\n};\n\n/** Identifier of the currently-running flow. */\nexport const flowIdContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.flow.id\",\n \"Identifier of the running flow\",\n);\n\n/** Name of the current FSM state within the running flow. */\nexport const flowStateContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.flow.state\",\n \"Name of the current FSM state in the running flow\",\n);\n\n/** Identifier of the view currently resolved by the ViewController. */\nexport const viewIdContextKey: ContextKey<string> = defineContextKey<string>(\n \"player.view.id\",\n \"Identifier of the currently-resolved view\",\n);\n\n/** Full resolved view object for the current FSM state. */\nexport const viewContextKey: ContextKey<unknown> = defineContextKey<unknown>(\n \"player.view\",\n \"Full resolved view object for the current FSM state\",\n);\n\n/** Full data model tree for the running flow. */\nexport const dataContextKey: ContextKey<unknown> = defineContextKey<unknown>(\n \"player.data\",\n \"Full data model tree for the running flow\",\n);\n\n/** Player flow status: not-started, in-progress, completed, or error. */\nexport const playerStatusContextKey: ContextKey<string> =\n defineContextKey<string>(\n \"player.status\",\n \"Player flow status: not-started, in-progress, completed, or error\",\n );\n\n/** Validation state for the running view, keyed by binding. */\nexport const validationContextKey: ContextKey<ValidationContext> =\n defineContextKey<ValidationContext>(\n \"player.validation\",\n \"Validation state for the running view, keyed by binding\",\n );\n\n/**\n * Action entry whose value is a callable that sets a binding in the data\n * model. Read via `ctx.get(setDataActionKey)`; absent until a flow is running.\n */\nexport const setDataActionKey: ContextKey<SetDataAction> =\n defineContextKey<SetDataAction>(\n \"player.data.set\",\n \"Set a value in the Player data model at the given binding\",\n );\n\n/**\n * Action entry whose value is a callable that transitions the running flow.\n * Read via `ctx.get(transitionActionKey)`; absent until a flow is running.\n */\nexport const transitionActionKey: ContextKey<TransitionAction> =\n defineContextKey<TransitionAction>(\n \"player.flow.transition\",\n \"Transition the current flow using the given transition value\",\n );\n\n/**\n * Aggregated snapshot composed from every other StateContextPlugin key.\n *\n * Actions are scoped to the construct they operate on — `transition` lives\n * under `flow`, `set` under `data` — rather than in a flat actions bag. Each\n * is bound to the live controller and is absent until a flow is in-progress.\n */\nexport type PlayerStateContext = {\n /** Always present — \"not-started\" before a flow has ever started. */\n status: string;\n /** Absent until a flow has started. */\n flow?: {\n id?: string;\n state?: string;\n /** Transition the running flow (e.g. 'Next'). */\n transition?: TransitionAction;\n };\n /** Absent until a view has resolved. */\n view?: {\n id?: string;\n resolved?: unknown;\n };\n /** Absent until a data controller is bound. */\n data?: {\n /** Full data model tree for the running flow. */\n model?: unknown;\n /** Set a value in the data model at the given binding. */\n set?: SetDataAction;\n };\n /** Validation state for the running view, keyed by binding. Absent until a\n * validation controller is bound. */\n validation?: ValidationContext;\n};\n\n/**\n * Single roll-up key that aggregates every other [[StateContextPlugin]] entry\n * into one object. Backed by a transform — reading recomputes from the latest\n * source values, and subscribers fire whenever any source updates.\n */\nexport const playerStateContextKey: ContextKey<PlayerStateContext> =\n defineContextKey<PlayerStateContext>(\n \"player.state\",\n \"Aggregated snapshot of every Player runtime context entry\",\n );\n\n/**\n * A consumer plugin that mirrors Player runtime state into the ContextPlugin\n * store. Registers a small, opinionated set of context entries (flow id,\n * current FSM state, view id, full view, data model, status) so external\n * automation/devtools can observe the running Player without tapping every\n * controller hook themselves.\n *\n * Auto-registers a [[ContextPlugin]] if one isn't already on the player.\n */\nexport class StateContextPlugin implements PlayerPlugin {\n name = \"state-context\";\n\n apply(player: Player) {\n const ctx = getContextPlugin(player);\n\n // The validation controller for the running flow, captured so data/view\n // updates can re-publish a passive (side-effect-free) validation snapshot.\n type ValidationControllerLike = Parameters<\n Parameters<typeof player.hooks.validationController.tap>[1]\n >[0];\n let validationController: ValidationControllerLike | undefined;\n\n const publishValidation = () => {\n if (!validationController) return;\n const byBinding: Record<string, ReadonlyArray<ContextValidation>> = {};\n let canTransition = true;\n validationController.getBindings().forEach((binding) => {\n const all = (validationController!\n .getValidationForBinding(binding)\n ?.getAll() ?? []) as ReadonlyArray<ContextValidation>;\n if (all.length === 0) return;\n byBinding[binding.asString()] = all.map((v) => ({\n severity: v.severity,\n message: v.message,\n displayTarget: v.displayTarget,\n blocking: v.blocking,\n }));\n if (all.some((v) => v.blocking)) {\n canTransition = false;\n }\n });\n ctx.set(validationContextKey, { canTransition, byBinding });\n };\n\n ctx.register(flowIdContextKey);\n ctx.register(flowStateContextKey);\n ctx.register(viewIdContextKey);\n ctx.register(viewContextKey);\n ctx.register(dataContextKey);\n ctx.register(playerStatusContextKey);\n ctx.register(validationContextKey);\n ctx.register(setDataActionKey);\n ctx.register(transitionActionKey);\n\n // Player's own state is synchronously \"not-started\" from construction —\n // seed it eagerly so `status` is always present, unlike the other\n // sources, which only populate once a flow actually starts.\n ctx.set(playerStatusContextKey, player.getState().status);\n\n ctx.registerTransform(playerStateContextKey, {\n sources: [\n flowIdContextKey,\n flowStateContextKey,\n viewIdContextKey,\n viewContextKey,\n dataContextKey,\n playerStatusContextKey,\n validationContextKey,\n setDataActionKey,\n transitionActionKey,\n ],\n compute: (read) => {\n const flowId = read(flowIdContextKey);\n const flowState = read(flowStateContextKey);\n const transition = read(transitionActionKey);\n const viewId = read(viewIdContextKey);\n const viewResolved = read(viewContextKey);\n const dataModel = read(dataContextKey);\n const setData = read(setDataActionKey);\n\n return {\n // Always present — seeded eagerly above and kept live by the\n // `player.hooks.state` tap below.\n status: read(playerStatusContextKey) ?? \"not-started\",\n flow:\n flowId !== undefined ||\n flowState !== undefined ||\n transition !== undefined\n ? { id: flowId, state: flowState, transition }\n : undefined,\n view:\n viewId !== undefined || viewResolved !== undefined\n ? { id: viewId, resolved: viewResolved }\n : undefined,\n data:\n dataModel !== undefined || setData !== undefined\n ? { model: dataModel, set: setData }\n : undefined,\n validation: read(validationContextKey),\n };\n },\n });\n\n player.hooks.onStart.tap(this.name, (flow) => {\n if (flow?.id) {\n ctx.set(flowIdContextKey, flow.id);\n }\n });\n\n player.hooks.state.tap(this.name, (state) => {\n ctx.set(playerStatusContextKey, state.status);\n });\n\n player.hooks.flowController.tap(this.name, (flowController) => {\n // Bind to the concrete controller instance for the running flow.\n const transition: TransitionAction = (value) =>\n flowController.transition(value);\n ctx.set(transitionActionKey, transition);\n\n flowController.hooks.flow.tap(this.name, (flowInstance) => {\n const recordState = () => {\n const name = flowInstance.currentState?.name;\n if (name) {\n ctx.set(flowStateContextKey, name);\n }\n };\n recordState();\n flowInstance.hooks.afterTransition.tap(this.name, recordState);\n });\n });\n\n player.hooks.validationController.tap(this.name, (vc) => {\n validationController = vc;\n publishValidation();\n });\n\n player.hooks.viewController.tap(this.name, (viewController) => {\n viewController.hooks.view.tap(this.name, (view) => {\n const id = view.initialView?.id;\n if (id) {\n ctx.set(viewIdContextKey, id);\n }\n view.hooks.onUpdate.tap(this.name, (resolved) => {\n ctx.set(viewContextKey, resolved);\n if (resolved?.id) {\n ctx.set(viewIdContextKey, resolved.id);\n }\n // Validation resets per view; re-publish for the resolved view.\n publishValidation();\n });\n });\n });\n\n player.hooks.dataController.tap(this.name, (dataController) => {\n // Bind the set-data action to this concrete controller instance.\n const setData: SetDataAction = (binding, value) => {\n dataController.set([[binding, value]]);\n };\n ctx.set(setDataActionKey, setData);\n\n const publish = () => {\n ctx.set(dataContextKey, dataController.serialize());\n // Validation re-evaluates on data change.\n publishValidation();\n };\n dataController.hooks.onUpdate.tap(this.name, publish);\n publish();\n });\n }\n}\n","import { defineContextKey } from \"@player-ui/context-plugin\";\n\n/** Player version and the names of the plugins registered on it. */\nexport interface PlayerConfig {\n version: string;\n plugins: string[];\n}\n\n/** Published by the basic devtools plugin so other context consumers can read the Player config. */\nexport const playerConfigContextKey = defineContextKey<PlayerConfig>(\n \"devtools.player.config\",\n \"Player version and the names of its registered plugins\",\n);\n","import {\n INTERACTIONS,\n BasicPluginData,\n} from \"@player-devtools/basic-plugin-content\";\nimport {\n DevtoolsPlugin,\n DevtoolsPluginOptions,\n generateUUID,\n} from \"@player-devtools/plugin\";\nimport type { DevtoolsPluginInteractionEvent } from \"@player-devtools/types\";\nimport {\n StateContextPlugin,\n dataContextKey,\n getContextPlugin,\n type ContextPlugin,\n type SubscriptionToken,\n} from \"@player-ui/context-plugin\";\nimport type {\n ExpressionEvaluator,\n Flow,\n Player,\n Logger,\n} from \"@player-ui/player\";\n\nimport { playerConfigContextKey, type PlayerConfig } from \"./context\";\nimport { Evaluation } from \"./types\";\n\n/** Taps into the Player and ReactPlayer hooks and leverage the WrapperComponent to define and process the content. */\nexport class BasicDevtoolsPlugin extends DevtoolsPlugin {\n constructor(options: Omit<DevtoolsPluginOptions, \"pluginData\">) {\n super({\n ...options,\n pluginData: BasicPluginData,\n });\n }\n\n name = \"BasicDevtoolsPlugin\";\n\n data: Record<string, unknown> = {};\n\n playerConfig: Partial<PlayerConfig> = {};\n\n logs: {\n severity: string;\n message: unknown;\n }[] = [];\n\n flow?: Flow;\n\n logger?: WeakRef<Logger>;\n\n expressionEvaluator?: WeakRef<ExpressionEvaluator>;\n\n /** Subscriptions are tied to the context plugin they were made on, which differs per Player */\n private subscriptions: Array<{\n context: ContextPlugin;\n token: SubscriptionToken;\n }> = [];\n\n overrideFlow?: Player[\"start\"];\n\n apply(player: Player): void {\n this.logger = new WeakRef(player.logger);\n\n if (!this.checkIfDevtoolsIsActive()) return;\n\n super.apply(player);\n\n // State is read from the context plugin rather than tapping Player hooks directly\n const context = getContextPlugin(player);\n\n if (!player.getPlugins().some((p) => p.name === \"state-context\")) {\n player.registerPlugin(new StateContextPlugin());\n }\n\n // Subscriptions persist across flows on the context plugin, so drop any\n // left by an earlier apply of this plugin, on whichever Player it was.\n this.subscriptions.forEach(({ context: previous, token }) =>\n previous.unsubscribe(token),\n );\n\n this.subscriptions = [\n {\n context,\n token: context.subscribe(playerConfigContextKey, (playerConfig) => {\n // The context clears at flow end; keep the last known config until republished\n if (!playerConfig) return;\n\n this.playerConfig = { ...playerConfig };\n this.dispatchDataUpdate({ playerConfig: this.playerConfig });\n }),\n },\n {\n context,\n token: context.subscribe(dataContextKey, (model) => {\n // The model is Player's live data model, so clone it rather than let immer freeze it\n this.data = {\n data:\n model === undefined ? model : JSON.parse(JSON.stringify(model)),\n };\n this.dispatchDataUpdate({ data: this.data });\n }),\n },\n ];\n\n // The context store is reset when a flow ends, so republish on each start\n const publishConfig = () =>\n context.set(playerConfigContextKey, {\n version: player.getVersion(),\n plugins: player.getPlugins().map((plugin) => plugin.name),\n });\n\n publishConfig();\n\n player.logger.hooks.log.tap(this.name, (severity, message) => {\n this.logs = [...this.logs, { severity, message }];\n\n this.dispatchDataUpdate({ logs: this.logs });\n });\n\n // Flow\n player.hooks.onStart.tap(this.name, (f) => {\n this.flow = JSON.parse(JSON.stringify(f));\n\n this.dispatchDataUpdate({ flow: this.flow });\n });\n\n player.hooks.onStart.tap(this.name, publishConfig);\n\n // Expression evaluator\n player.hooks.expressionEvaluator.tap(this.name, (evaluator) => {\n this.expressionEvaluator = new WeakRef(evaluator);\n });\n\n // Override flow\n this.overrideFlow = player.start.bind(player);\n }\n\n private evaluateExpression(expression: string): Evaluation {\n const evaluator = this.expressionEvaluator?.deref();\n\n if (!evaluator) {\n return {\n id: generateUUID(),\n severity: \"error\",\n result: \"Expression evaluator not available\",\n expression,\n };\n }\n\n try {\n evaluator.hooks.onError.intercept({\n call: (error: Error) => {\n throw error;\n },\n });\n\n const evaluatorResult = evaluator.evaluate(expression);\n\n return {\n id: generateUUID(),\n result: evaluatorResult,\n expression,\n };\n } catch (error) {\n const message =\n error instanceof Error\n ? error.message\n : String(error ?? \"Something went wrong\");\n return {\n id: generateUUID(),\n severity: \"error\",\n result: message,\n expression,\n };\n }\n }\n\n processInteraction(interaction: DevtoolsPluginInteractionEvent): void {\n // invokes mobile specific handlers\n super.processInteraction(interaction);\n\n const {\n payload: { type, payload },\n } = interaction;\n if (\n type === INTERACTIONS.EVALUATE_EXPRESSION &&\n this.expressionEvaluator &&\n payload\n ) {\n const result = this.evaluateExpression(payload);\n const current: Array<Evaluation> =\n (this.store.getState()?.plugins?.[this.pluginID]?.flow?.data\n ?.history as Array<Evaluation>) || [];\n\n this.dispatchDataUpdate({ history: [...current, result] });\n\n return;\n }\n\n if (type === INTERACTIONS.OVERRIDE_FLOW && payload && this.overrideFlow) {\n let newFlow: Flow | undefined;\n\n try {\n newFlow = JSON.parse(payload);\n } catch (e) {\n this.logger?.deref()?.error(this.name, \"Error parsing new flow\", e);\n }\n\n if (newFlow) {\n this.overrideFlow(newFlow);\n }\n\n return;\n }\n }\n}\n"]}